diff --git a/src/components/button/button.scss b/src/components/button/button.scss index e87e8b5b..1884e37b 100644 --- a/src/components/button/button.scss +++ b/src/components/button/button.scss @@ -12,16 +12,18 @@ --mykn-button-height: auto; --mykn-button-width: auto; --mykn-button-offset: 0px; - --mykn-button-padding-v: var(--spacing-v); - --mykn-button-padding-h: var(--spacing-h); + + --mykn-button-padding-v: 0; + --mykn-button-padding-h: 0; align-items: center; appearance: none; margin: 0; - padding: 0; + padding-block: var(--mykn-button-padding-v); + padding-inline: var(--mykn-button-padding-h); background-color: var(--mykn-button-color-background); border: 1px solid var(--mykn-button-color-border); - border-radius: var(--border-radius-l); + border-radius: var(--border-radius-s); box-shadow: 0 calc(var(--mykn-button-offset) * -1) var(--mykn-button-color-shadow); box-sizing: border-box; @@ -41,12 +43,9 @@ width: var(--mykn-button-width); &[disabled] { - --mykn-button-color-background: var( - --mykn-button-color-background-mute, - #ccc - ) !important; --mykn-button-offset: 0 !important; pointer-events: none; + opacity: 0.4; } &--align-start { @@ -77,29 +76,30 @@ } &--pad-h { - padding-inline-start: var(--mykn-button-padding-h); - padding-inline-end: var(--mykn-button-padding-h); + --mykn-button-padding-h: var(--mykn-button-padding-xs, var(--spacing-h)); } &--pad-v { - padding-block-start: var(--mykn-button-padding-h); - padding-block-end: var(--mykn-button-padding-h); + --mykn-button-padding-v: var(--mykn-button-padding-xs, var(--spacing-v)); } &--size-xs { --mykn-button-font-size: var(--typography-font-size-body-xs); --mykn-button-line-height: var(--typography-line-height-body-xs); + --mykn-button-padding-xs: calc(var(--spacing-h) / 2); } &--square { --mykn-button-height: calc( - var(--typography-line-height-body-s) + 2 * var(--spacing-v) + var(--mykn-button-line-height) + 2 * + var(--mykn-button-padding-xs, var(--mykn-button-padding-v)) + 2px ); --mykn-button-width: calc( - var(--typography-line-height-body-s) + 2 * var(--spacing-v) + var(--mykn-button-line-height) + 2 * + var(--mykn-button-padding-xs, var(--mykn-button-padding-v)) + 2px ); - --mykn-button-padding-v: 0; - --mykn-button-padding-h: 0; + padding-block: 0; + padding-inline: 0; flex-shrink: 0; } diff --git a/src/components/button/button.tsx b/src/components/button/button.tsx index 341d0486..0f22be08 100644 --- a/src/components/button/button.tsx +++ b/src/components/button/button.tsx @@ -12,6 +12,9 @@ type BaseButtonProps = { /** Whether the text should be presented bold. */ bold?: boolean; + /** Additional class names. */ + className?: string; + /** Whether the buttons width should be set to 100%. */ justify?: boolean; @@ -42,17 +45,6 @@ export type ButtonLinkProps = React.AnchorHTMLAttributes & /** * Button component - * @param active - * @param align - * @param bold - * @param justify - * @param muted - * @param pad - * @param size - * @param square - * @param variant - * @param wrap - * @constructor */ export const Button = React.forwardRef( ( @@ -60,6 +52,7 @@ export const Button = React.forwardRef( active = false, align = "center", bold = false, + className, justify = false, muted = false, pad = true, @@ -89,6 +82,7 @@ export const Button = React.forwardRef( "mykn-button--square": square, "mykn-button--wrap": wrap, }, + className, )} {...props} > @@ -100,18 +94,7 @@ export const Button = React.forwardRef( Button.displayName = "Button"; /** - * Button component - * @param active - * @param align - * @param bold - * @param justify - * @param muted - * @param pad - * @param size - * @param square - * @param variant - * @param wrap - * @constructor + * Button (link) )component */ export const ButtonLink = React.forwardRef( ( @@ -119,6 +102,7 @@ export const ButtonLink = React.forwardRef( active = false, align = "center", bold = false, + className, justify = false, muted = false, pad = true, @@ -133,22 +117,25 @@ export const ButtonLink = React.forwardRef( return ( } - className={clsx( - "mykn-button", - `mykn-button--align-${align}`, - `mykn-button--size-${size}`, - `mykn-button--variant-${variant}`, - { - "mykn-button--active": active, - "mykn-button--bold": bold, - "mykn-button--justify": justify, - "mykn-button--muted": muted, - "mykn-button--pad-h": pad === true || pad === "h", - "mykn-button--pad-v": pad === true || pad === "v", - "mykn-button--square": square, - "mykn-button--wrap": wrap, - }, - )} + className={ + (clsx( + "mykn-button", + `mykn-button--align-${align}`, + `mykn-button--size-${size}`, + `mykn-button--variant-${variant}`, + { + "mykn-button--active": active, + "mykn-button--bold": bold, + "mykn-button--justify": justify, + "mykn-button--muted": muted, + "mykn-button--pad-h": pad === true || pad === "h", + "mykn-button--pad-v": pad === true || pad === "v", + "mykn-button--square": square, + "mykn-button--wrap": wrap, + }, + ), + className) + } {...props} > {props.children} diff --git a/src/components/data/datagrid/datagrid.tsx b/src/components/data/datagrid/datagrid.tsx index 255bd6b4..9338cc59 100644 --- a/src/components/data/datagrid/datagrid.tsx +++ b/src/components/data/datagrid/datagrid.tsx @@ -604,7 +604,7 @@ export const DataGridFooter: React.FC = ({ selectable ? renderableFields.length + 1 : renderableFields.length } > - + .mykn-icon { + inset-inline-start: 100%; + margin-inline-start: var(--spacing-h); + position: absolute; + } } @media screen and (max-width: constants.$breakpoint-desktop - 1px) { - width: 100%; + flex-wrap: wrap; - &__section--form { - display: none; + &__section { + flex-basis: calc(50% - var(--spacing-v) / 2); + white-space: nowrap; } - &__section { - width: 100%; - justify-content: flex-end; + &__section--meta { + position: static; + text-align: end; + transform: none; + } - .mykn-button { - justify-content: center !important; - } + &__section--options { + flex-basis: 100%; + } + + &__ellipsis, + &__button--page { + display: none; } } } diff --git a/src/components/data/paginator/paginator.tsx b/src/components/data/paginator/paginator.tsx index b9009402..6a0c01cd 100644 --- a/src/components/data/paginator/paginator.tsx +++ b/src/components/data/paginator/paginator.tsx @@ -4,8 +4,9 @@ import { ucFirst } from "../../../lib/format/string"; import { formatMessage } from "../../../lib/i18n/formatmessage"; import { useIntl } from "../../../lib/i18n/useIntl"; import { Button } from "../../button"; -import { Input, Option, Select, SelectProps } from "../../form"; +import { Option, Select, SelectProps } from "../../form"; import { Outline } from "../../icon"; +import { Toolbar } from "../../toolbar"; import { P } from "../../typography"; import "./paginator.scss"; @@ -69,21 +70,6 @@ export type PaginatorProps = React.HTMLAttributes & { * * The `onPageChange` callback is debounced and provided a mechanism for a * spinner to appear during load (see docs). - * - * All labels that are passed to this component may contain the following - * placeholders: - * - * - {count} - * - {index} - * - {page} - * - {pageCount} - * - {pageStart} - * - {pageEnd} - * - {pageSize} - * - * @param children - * @param props - * @constructor */ export const Paginator: React.FC = ({ count, @@ -124,43 +110,6 @@ export const Paginator: React.FC = ({ const intl = useIntl(); - const _labelCurrentPageRange = labelCurrentPageRange - ? formatMessage(labelCurrentPageRange, context) - : intl.formatMessage( - { - id: "mykn.components.Paginator.labelCurrentPageRange", - description: - "mykn.components.Paginator: The current page range (accessible) label", - defaultMessage: - "resultaat {pageStart} t/m {pageEnd} van {pageCount} pagina's", - }, - context, - ); - - const _labelGoToPage = labelGoToPage - ? formatMessage(labelGoToPage, context) - : intl.formatMessage( - { - id: "mykn.components.Paginator.labelGoToPage", - description: - "mykn.components.Paginator: The go to page (accessible) label", - defaultMessage: "naar pagina", - }, - context, - ); - - const _labelPageSize = labelPageSize - ? formatMessage(labelPageSize, context) - : intl.formatMessage( - { - id: "mykn.components.Paginator.labelPageSize", - description: - "mykn.components.Paginator: The page size (accessible) label", - defaultMessage: "aantal resultaten", - }, - context, - ); - const _labelPagination = labelPagination ? formatMessage(labelPagination, context) : intl.formatMessage( @@ -173,42 +122,6 @@ export const Paginator: React.FC = ({ context, ); - const _labelPrevious = labelPrevious - ? formatMessage(labelPrevious, context) - : intl.formatMessage( - { - id: "mykn.components.Paginator.labelPrevious", - description: - "mykn.components.Paginator: The go to previous page (accessible) label", - defaultMessage: "vorige", - }, - context, - ); - - const _labelNext = labelNext - ? formatMessage(labelNext, context) - : intl.formatMessage( - { - id: "mykn.components.Paginator.labelNext", - description: - "mykn.components.Paginator: The go to next page (accessible) label", - defaultMessage: "volgende", - }, - context, - ); - - const _labelLoading = labelLoading - ? formatMessage(labelLoading, context) - : intl.formatMessage( - { - id: "mykn.components.Paginator.labelLoading", - description: - "mykn.components.Paginator: The loading (accessible) label", - defaultMessage: "bezig met laden...", - }, - context, - ); - useEffect(() => setPageState(page), [page]); useEffect(() => setPageSizeState(pageSize), [pageSize]); @@ -249,30 +162,10 @@ export const Paginator: React.FC = ({ /** * Gets called when the page input is changed. - * @param event - */ - const handlePageChange: React.ChangeEventHandler = ( - event, - ) => { - const value = parseInt(event.target.value); - const sanitizedValue = Math.max(Math.min(value, pageCount), 1); - setPageState(sanitizedValue); - }; - - /** - * Gets called when the previous button is changed. - */ - const handlePrevious: React.MouseEventHandler = () => { - const sanitizedValue = Math.max(pageState - 1, 1); - setPageState(sanitizedValue); - }; - - /** - * Gets called when the page input is changed. + * @param page */ - const handleNext: React.MouseEventHandler = () => { - const sanitizedValue = Math.min(pageState + 1, pageCount); - setPageState(sanitizedValue); + const handlePageChange = (page: number) => { + setPageState(page); }; // `loading` takes precedence over `loadingState` (derived from Promise). @@ -284,61 +177,355 @@ export const Paginator: React.FC = ({ aria-label={ucFirst(_labelPagination)} {...props} > -
- {_labelLoading && ( -