@digdir/designsystemet-react 1.0.0-next.34 → 1.0.0-next.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Accordion/AccordionContent.js +1 -2
- package/dist/cjs/components/Accordion/AccordionHeading.js +4 -6
- package/dist/cjs/components/Accordion/AccordionItem.js +16 -52
- package/dist/cjs/components/Alert/Alert.js +1 -2
- package/dist/cjs/components/Avatar/Avatar.js +1 -7
- package/dist/cjs/components/Badge/Badge.js +1 -7
- package/dist/cjs/components/Breadcrumbs/Breadcrumbs.js +1 -2
- package/dist/cjs/components/Button/Button.js +4 -3
- package/dist/cjs/components/Card/Card.js +24 -6
- package/dist/cjs/components/Card/{CardMedia.js → CardBlock.js} +3 -4
- package/dist/cjs/components/Card/index.js +6 -17
- package/dist/cjs/components/Chip/Chips.js +50 -0
- package/dist/cjs/components/Chip/index.js +12 -11
- package/dist/cjs/components/Dropdown/DropdownHeading.js +2 -5
- package/dist/cjs/components/ErrorSummary/ErrorSummaryHeading.js +2 -2
- package/dist/cjs/components/{Typography/Heading → Heading}/Heading.js +2 -3
- package/dist/cjs/components/{Typography/Label → Label}/Label.js +2 -3
- package/dist/cjs/components/List/Lists.js +1 -2
- package/dist/cjs/components/Modal/Modal.js +45 -0
- package/dist/cjs/components/Modal/ModalBlock.js +14 -0
- package/dist/cjs/components/Modal/ModalContext.js +17 -0
- package/dist/cjs/components/Modal/ModalTrigger.js +4 -5
- package/dist/cjs/components/Modal/index.js +12 -22
- package/dist/cjs/components/Pagination/Pagination.js +9 -14
- package/dist/cjs/components/Pagination/PaginationButton.js +4 -4
- package/dist/cjs/components/Pagination/PaginationItem.js +1 -4
- package/dist/cjs/components/Pagination/PaginationList.js +2 -5
- package/dist/cjs/components/Pagination/index.js +5 -19
- package/dist/cjs/components/Pagination/usePagination.js +46 -51
- package/dist/cjs/components/{Typography/Paragraph → Paragraph}/Paragraph.js +2 -8
- package/dist/cjs/components/Popover/Popover.js +3 -4
- package/dist/cjs/components/SkipLink/SkipLink.js +4 -4
- package/dist/cjs/components/Table/Table.js +1 -2
- package/dist/cjs/components/Tabs/TabsPanel.js +1 -2
- package/dist/cjs/components/Tabs/TabsTab.js +1 -2
- package/dist/cjs/components/Tag/Tag.js +1 -2
- package/dist/cjs/components/Tooltip/Tooltip.js +5 -6
- package/dist/cjs/components/{Typography/ValidationMessage → ValidationMessage}/ValidationMessage.js +2 -2
- package/dist/cjs/components/form/CharacterCounter.js +1 -1
- package/dist/cjs/components/form/Checkbox/Checkbox.js +2 -2
- package/dist/cjs/components/form/Combobox/Combobox.js +1 -2
- package/dist/cjs/components/form/Combobox/Custom.js +1 -1
- package/dist/cjs/components/form/Combobox/Empty.js +1 -1
- package/dist/cjs/components/form/Combobox/Option/Option.js +1 -1
- package/dist/cjs/components/form/Combobox/internal/ComboboxChips.js +2 -2
- package/dist/cjs/components/form/Combobox/internal/ComboboxError.js +1 -1
- package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +2 -2
- package/dist/cjs/components/form/Combobox/internal/ComboboxLabel.js +2 -2
- package/dist/cjs/components/form/Fieldset/Fieldset.js +3 -3
- package/dist/cjs/components/form/Radio/Radio.js +2 -2
- package/dist/cjs/components/form/Search/Search.js +2 -2
- package/dist/cjs/components/form/Select/Select.js +3 -3
- package/dist/cjs/components/form/Switch/Switch.js +3 -3
- package/dist/cjs/components/form/Textarea/Textarea.js +3 -3
- package/dist/cjs/components/form/Textfield/Textfield.js +3 -3
- package/dist/cjs/components/loaders/Skeleton/Skeleton.js +4 -2
- package/dist/cjs/index.js +17 -39
- package/dist/esm/components/Accordion/AccordionContent.js +1 -2
- package/dist/esm/components/Accordion/AccordionHeading.js +4 -6
- package/dist/esm/components/Accordion/AccordionItem.js +17 -53
- package/dist/esm/components/Alert/Alert.js +1 -2
- package/dist/esm/components/Avatar/Avatar.js +1 -7
- package/dist/esm/components/Badge/Badge.js +1 -7
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +1 -2
- package/dist/esm/components/Button/Button.js +5 -4
- package/dist/esm/components/Card/Card.js +25 -7
- package/dist/esm/components/Card/{CardMedia.js → CardBlock.js} +3 -4
- package/dist/esm/components/Card/index.js +6 -14
- package/dist/esm/components/Chip/Chips.js +45 -0
- package/dist/esm/components/Chip/index.js +9 -9
- package/dist/esm/components/Dropdown/DropdownHeading.js +3 -6
- package/dist/esm/components/ErrorSummary/ErrorSummaryHeading.js +2 -2
- package/dist/esm/components/{Typography/Heading → Heading}/Heading.js +2 -3
- package/dist/esm/components/Label/Label.js +18 -0
- package/dist/esm/components/List/Lists.js +1 -2
- package/dist/esm/components/Modal/Modal.js +43 -0
- package/dist/esm/components/Modal/ModalBlock.js +12 -0
- package/dist/esm/components/Modal/ModalContext.js +14 -0
- package/dist/esm/components/Modal/ModalTrigger.js +4 -5
- package/dist/esm/components/Modal/index.js +11 -18
- package/dist/esm/components/Pagination/Pagination.js +11 -17
- package/dist/esm/components/Pagination/PaginationButton.js +3 -3
- package/dist/esm/components/Pagination/PaginationItem.js +2 -5
- package/dist/esm/components/Pagination/PaginationList.js +3 -6
- package/dist/esm/components/Pagination/index.js +6 -16
- package/dist/esm/components/Pagination/usePagination.js +47 -52
- package/dist/esm/components/Paragraph/Paragraph.js +18 -0
- package/dist/esm/components/Popover/Popover.js +3 -4
- package/dist/esm/components/SkipLink/SkipLink.js +4 -4
- package/dist/esm/components/Table/Table.js +1 -2
- package/dist/esm/components/Tabs/TabsPanel.js +1 -2
- package/dist/esm/components/Tabs/TabsTab.js +1 -2
- package/dist/esm/components/Tag/Tag.js +1 -2
- package/dist/esm/components/Tooltip/Tooltip.js +5 -6
- package/dist/esm/components/{Typography/ValidationMessage → ValidationMessage}/ValidationMessage.js +2 -2
- package/dist/esm/components/form/CharacterCounter.js +1 -1
- package/dist/esm/components/form/Checkbox/Checkbox.js +2 -2
- package/dist/esm/components/form/Combobox/Combobox.js +2 -3
- package/dist/esm/components/form/Combobox/Custom.js +1 -1
- package/dist/esm/components/form/Combobox/Empty.js +1 -1
- package/dist/esm/components/form/Combobox/Option/Option.js +1 -1
- package/dist/esm/components/form/Combobox/internal/ComboboxChips.js +2 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxError.js +1 -1
- package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +2 -2
- package/dist/esm/components/form/Combobox/internal/ComboboxLabel.js +2 -2
- package/dist/esm/components/form/Fieldset/Fieldset.js +3 -3
- package/dist/esm/components/form/Radio/Radio.js +2 -2
- package/dist/esm/components/form/Search/Search.js +2 -2
- package/dist/esm/components/form/Select/Select.js +3 -3
- package/dist/esm/components/form/Switch/Switch.js +3 -3
- package/dist/esm/components/form/Textarea/Textarea.js +3 -3
- package/dist/esm/components/form/Textfield/Textfield.js +3 -3
- package/dist/esm/components/loaders/Skeleton/Skeleton.js +4 -2
- package/dist/esm/index.js +8 -20
- package/dist/types/components/Accordion/AccordionContent.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionHeading.d.ts +2 -2
- package/dist/types/components/Accordion/AccordionHeading.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionItem.d.ts +8 -8
- package/dist/types/components/Accordion/AccordionItem.d.ts.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts.map +1 -1
- package/dist/types/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/types/components/Badge/Badge.d.ts.map +1 -1
- package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Card/Card.d.ts +5 -15
- package/dist/types/components/Card/Card.d.ts.map +1 -1
- package/dist/types/components/Card/{CardMedia.d.ts → CardBlock.d.ts} +3 -3
- package/dist/types/components/Card/{CardMedia.d.ts.map → CardBlock.d.ts.map} +1 -1
- package/dist/types/components/Card/index.d.ts +12 -16
- package/dist/types/components/Card/index.d.ts.map +1 -1
- package/dist/types/components/Chip/Chips.d.ts +45 -0
- package/dist/types/components/Chip/Chips.d.ts.map +1 -0
- package/dist/types/components/Chip/index.d.ts +20 -21
- package/dist/types/components/Chip/index.d.ts.map +1 -1
- package/dist/types/components/Dropdown/DropdownHeading.d.ts.map +1 -1
- package/dist/types/components/ErrorSummary/ErrorSummaryHeading.d.ts +1 -2
- package/dist/types/components/ErrorSummary/ErrorSummaryHeading.d.ts.map +1 -1
- package/dist/types/components/ErrorSummary/index.d.ts +0 -1
- package/dist/types/components/ErrorSummary/index.d.ts.map +1 -1
- package/dist/types/components/{Typography/Heading → Heading}/Heading.d.ts +0 -4
- package/dist/types/components/Heading/Heading.d.ts.map +1 -0
- package/dist/types/components/Heading/index.d.ts.map +1 -0
- package/dist/types/components/{Typography/Label → Label}/Label.d.ts +0 -4
- package/dist/types/components/Label/Label.d.ts.map +1 -0
- package/dist/types/components/Label/index.d.ts.map +1 -0
- package/dist/types/components/List/Lists.d.ts.map +1 -1
- package/dist/types/components/Modal/Modal.d.ts +38 -0
- package/dist/types/components/Modal/Modal.d.ts.map +1 -0
- package/dist/types/components/{Card/CardFooter.d.ts → Modal/ModalBlock.d.ts} +3 -3
- package/dist/types/components/Modal/ModalBlock.d.ts.map +1 -0
- package/dist/types/components/Modal/ModalContext.d.ts +10 -0
- package/dist/types/components/Modal/ModalContext.d.ts.map +1 -0
- package/dist/types/components/Modal/ModalTrigger.d.ts.map +1 -1
- package/dist/types/components/Modal/index.d.ts +31 -20
- package/dist/types/components/Modal/index.d.ts.map +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +23 -36
- package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationButton.d.ts +4 -3
- package/dist/types/components/Pagination/PaginationButton.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationItem.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationList.d.ts +1 -1
- package/dist/types/components/Pagination/PaginationList.d.ts.map +1 -1
- package/dist/types/components/Pagination/index.d.ts +16 -17
- package/dist/types/components/Pagination/index.d.ts.map +1 -1
- package/dist/types/components/Pagination/usePagination.d.ts +41 -17
- package/dist/types/components/Pagination/usePagination.d.ts.map +1 -1
- package/dist/types/components/{Typography/Paragraph → Paragraph}/Paragraph.d.ts +2 -6
- package/dist/types/components/Paragraph/Paragraph.d.ts.map +1 -0
- package/dist/types/components/Paragraph/index.d.ts.map +1 -0
- package/dist/types/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/components/SkipLink/SkipLink.d.ts +7 -5
- package/dist/types/components/SkipLink/SkipLink.d.ts.map +1 -1
- package/dist/types/components/Table/Table.d.ts.map +1 -1
- package/dist/types/components/Tabs/TabsPanel.d.ts.map +1 -1
- package/dist/types/components/Tabs/TabsTab.d.ts.map +1 -1
- package/dist/types/components/Tag/Tag.d.ts +2 -5
- package/dist/types/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/components/{Typography/ValidationMessage → ValidationMessage}/ValidationMessage.d.ts +0 -4
- package/dist/types/components/ValidationMessage/ValidationMessage.d.ts.map +1 -0
- package/dist/types/components/ValidationMessage/index.d.ts.map +1 -0
- package/dist/types/components/form/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxLabel.d.ts.map +1 -1
- package/dist/types/components/form/Fieldset/Fieldset.d.ts.map +1 -1
- package/dist/types/components/form/Radio/Radio.d.ts.map +1 -1
- package/dist/types/components/form/Search/Search.d.ts.map +1 -1
- package/dist/types/components/form/Select/Select.d.ts.map +1 -1
- package/dist/types/components/form/Switch/Switch.d.ts.map +1 -1
- package/dist/types/components/form/Textarea/Textarea.d.ts.map +1 -1
- package/dist/types/components/form/Textfield/Textfield.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/loaders/Skeleton/Skeleton.d.ts +8 -17
- package/dist/types/components/loaders/Skeleton/Skeleton.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/components/Card/CardContent.js +0 -16
- package/dist/cjs/components/Card/CardFooter.js +0 -16
- package/dist/cjs/components/Card/CardHeader.js +0 -16
- package/dist/cjs/components/Chip/Group/Group.js +0 -15
- package/dist/cjs/components/Chip/Removable/Removable.js +0 -17
- package/dist/cjs/components/Chip/Toggle/Toggle.js +0 -18
- package/dist/cjs/components/Modal/ModaContent.js +0 -15
- package/dist/cjs/components/Modal/ModalDialog.js +0 -73
- package/dist/cjs/components/Modal/ModalFooter.js +0 -15
- package/dist/cjs/components/Modal/ModalHeader.js +0 -20
- package/dist/cjs/components/Modal/ModalRoot.js +0 -31
- package/dist/cjs/components/Modal/useModalState.js +0 -30
- package/dist/cjs/components/Modal/useScrollLock.js +0 -29
- package/dist/cjs/components/Pagination/PaginationEllipsis.js +0 -15
- package/dist/cjs/components/Pagination/PaginationNextPrev.js +0 -16
- package/dist/cjs/components/Pagination/PaginationRoot.js +0 -18
- package/dist/cjs/components/Typography/Ingress/Ingress.js +0 -21
- package/dist/esm/components/Card/CardContent.js +0 -14
- package/dist/esm/components/Card/CardFooter.js +0 -14
- package/dist/esm/components/Card/CardHeader.js +0 -14
- package/dist/esm/components/Chip/Group/Group.js +0 -12
- package/dist/esm/components/Chip/Removable/Removable.js +0 -15
- package/dist/esm/components/Chip/Toggle/Toggle.js +0 -16
- package/dist/esm/components/Modal/ModaContent.js +0 -13
- package/dist/esm/components/Modal/ModalDialog.js +0 -71
- package/dist/esm/components/Modal/ModalFooter.js +0 -13
- package/dist/esm/components/Modal/ModalHeader.js +0 -18
- package/dist/esm/components/Modal/ModalRoot.js +0 -28
- package/dist/esm/components/Modal/useModalState.js +0 -28
- package/dist/esm/components/Modal/useScrollLock.js +0 -27
- package/dist/esm/components/Pagination/PaginationEllipsis.js +0 -13
- package/dist/esm/components/Pagination/PaginationNextPrev.js +0 -13
- package/dist/esm/components/Pagination/PaginationRoot.js +0 -15
- package/dist/esm/components/Typography/Ingress/Ingress.js +0 -19
- package/dist/esm/components/Typography/Label/Label.js +0 -19
- package/dist/esm/components/Typography/Paragraph/Paragraph.js +0 -24
- package/dist/types/components/Card/CardContent.d.ts +0 -16
- package/dist/types/components/Card/CardContent.d.ts.map +0 -1
- package/dist/types/components/Card/CardFooter.d.ts.map +0 -1
- package/dist/types/components/Card/CardHeader.d.ts +0 -16
- package/dist/types/components/Card/CardHeader.d.ts.map +0 -1
- package/dist/types/components/Chip/Group/Group.d.ts +0 -20
- package/dist/types/components/Chip/Group/Group.d.ts.map +0 -1
- package/dist/types/components/Chip/Removable/Removable.d.ts +0 -17
- package/dist/types/components/Chip/Removable/Removable.d.ts.map +0 -1
- package/dist/types/components/Chip/Toggle/Toggle.d.ts +0 -33
- package/dist/types/components/Chip/Toggle/Toggle.d.ts.map +0 -1
- package/dist/types/components/Modal/ModaContent.d.ts +0 -16
- package/dist/types/components/Modal/ModaContent.d.ts.map +0 -1
- package/dist/types/components/Modal/ModalDialog.d.ts +0 -38
- package/dist/types/components/Modal/ModalDialog.d.ts.map +0 -1
- package/dist/types/components/Modal/ModalFooter.d.ts +0 -16
- package/dist/types/components/Modal/ModalFooter.d.ts.map +0 -1
- package/dist/types/components/Modal/ModalHeader.d.ts +0 -44
- package/dist/types/components/Modal/ModalHeader.d.ts.map +0 -1
- package/dist/types/components/Modal/ModalRoot.d.ts +0 -17
- package/dist/types/components/Modal/ModalRoot.d.ts.map +0 -1
- package/dist/types/components/Modal/useModalState.d.ts +0 -2
- package/dist/types/components/Modal/useModalState.d.ts.map +0 -1
- package/dist/types/components/Modal/useScrollLock.d.ts +0 -2
- package/dist/types/components/Modal/useScrollLock.d.ts.map +0 -1
- package/dist/types/components/Pagination/PaginationEllipsis.d.ts +0 -4
- package/dist/types/components/Pagination/PaginationEllipsis.d.ts.map +0 -1
- package/dist/types/components/Pagination/PaginationNextPrev.d.ts +0 -10
- package/dist/types/components/Pagination/PaginationNextPrev.d.ts.map +0 -1
- package/dist/types/components/Pagination/PaginationRoot.d.ts +0 -53
- package/dist/types/components/Pagination/PaginationRoot.d.ts.map +0 -1
- package/dist/types/components/Typography/Heading/Heading.d.ts.map +0 -1
- package/dist/types/components/Typography/Heading/index.d.ts.map +0 -1
- package/dist/types/components/Typography/Ingress/Ingress.d.ts +0 -34
- package/dist/types/components/Typography/Ingress/Ingress.d.ts.map +0 -1
- package/dist/types/components/Typography/Ingress/index.d.ts +0 -2
- package/dist/types/components/Typography/Ingress/index.d.ts.map +0 -1
- package/dist/types/components/Typography/Label/Label.d.ts.map +0 -1
- package/dist/types/components/Typography/Label/index.d.ts.map +0 -1
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts.map +0 -1
- package/dist/types/components/Typography/Paragraph/index.d.ts.map +0 -1
- package/dist/types/components/Typography/ValidationMessage/ValidationMessage.d.ts.map +0 -1
- package/dist/types/components/Typography/ValidationMessage/index.d.ts.map +0 -1
- package/dist/types/components/Typography/index.d.ts +0 -6
- package/dist/types/components/Typography/index.d.ts.map +0 -1
- package/dist/types/utilities/AnimateHeight/AnimateHeight.d.ts +0 -9
- package/dist/types/utilities/AnimateHeight/AnimateHeight.d.ts.map +0 -1
- package/dist/types/utilities/AnimateHeight/index.d.ts +0 -3
- package/dist/types/utilities/AnimateHeight/index.d.ts.map +0 -1
- /package/dist/types/components/{Typography/Heading → Heading}/index.d.ts +0 -0
- /package/dist/types/components/{Typography/Label → Label}/index.d.ts +0 -0
- /package/dist/types/components/{Typography/Paragraph → Paragraph}/index.d.ts +0 -0
- /package/dist/types/components/{Typography/ValidationMessage → ValidationMessage}/index.d.ts +0 -0
|
@@ -2,22 +2,17 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
6
|
+
var cl = require('clsx/lite');
|
|
5
7
|
var react = require('react');
|
|
6
|
-
var PaginationButton = require('./PaginationButton.js');
|
|
7
|
-
var PaginationEllipsis = require('./PaginationEllipsis.js');
|
|
8
|
-
var PaginationItem = require('./PaginationItem.js');
|
|
9
|
-
var PaginationList = require('./PaginationList.js');
|
|
10
|
-
var PaginationNextPrev = require('./PaginationNextPrev.js');
|
|
11
|
-
var PaginationRoot = require('./PaginationRoot.js');
|
|
12
|
-
var usePagination = require('./usePagination.js');
|
|
13
8
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
return (jsxRuntime.jsx(PaginationRoot.PaginationRoot, { "aria-label": 'Pagination', compact: compact, ref: ref, size: size, ...rest, children: jsxRuntime.jsxs(PaginationList.PaginationList, { children: [jsxRuntime.jsx(PaginationItem.PaginationItem, { children: jsxRuntime.jsx(PaginationNextPrev.PaginationPrevious, { "aria-label": previousLabel, disabled: !showPreviousPage, onClick: () => onChange(currentPage - 1), children: !hideLabels && previousLabel }) }), pages.map((page, i) => (jsxRuntime.jsx(PaginationItem.PaginationItem, { children: page === 'ellipsis' ? (jsxRuntime.jsx(PaginationEllipsis.PaginationEllipsis, {})) : (jsxRuntime.jsx(PaginationButton.PaginationButton, { "aria-current": currentPage === page, "aria-label": itemLabel(page), isActive: currentPage === page, onClick: () => onChange(page), children: page })) }, `${page}${i}`))), jsxRuntime.jsx(PaginationItem.PaginationItem, { children: jsxRuntime.jsx(PaginationNextPrev.PaginationNext, { "aria-label": nextLabel, disabled: !showNextPage, onClick: () => onChange(currentPage + 1), children: !hideLabels && nextLabel }) })] }) }));
|
|
9
|
+
const PaginationContext = react.createContext({
|
|
10
|
+
size: 'md',
|
|
11
|
+
});
|
|
12
|
+
const Pagination = react.forwardRef(function Pagination({ 'aria-label': ariaLabel = 'Sidenavigering', asChild, className, size = 'md', ...rest }, ref) {
|
|
13
|
+
const Component = asChild ? reactSlot.Slot : 'nav';
|
|
14
|
+
return (jsxRuntime.jsx(PaginationContext.Provider, { value: { size }, children: jsxRuntime.jsx(Component, { "aria-label": ariaLabel, className: cl('ds-pagination', className), ref: ref, ...rest }) }));
|
|
21
15
|
});
|
|
22
16
|
|
|
23
17
|
exports.Pagination = Pagination;
|
|
18
|
+
exports.PaginationContext = PaginationContext;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var Button = require('../Button/Button.js');
|
|
7
|
-
var
|
|
7
|
+
var Pagination = require('./Pagination.js');
|
|
8
8
|
|
|
9
|
-
const PaginationButton = react.forwardRef(function PaginationButton(
|
|
10
|
-
const { size } = react.useContext(
|
|
11
|
-
return
|
|
9
|
+
const PaginationButton = react.forwardRef(function PaginationButton(rest, ref) {
|
|
10
|
+
const { size } = react.useContext(Pagination.PaginationContext);
|
|
11
|
+
return jsxRuntime.jsx(Button.Button, { ref: ref, size: size, ...rest });
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
exports.PaginationButton = PaginationButton;
|
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var reactSlot = require('@radix-ui/react-slot');
|
|
6
|
-
var cl = require('clsx/lite');
|
|
7
6
|
var react = require('react');
|
|
8
|
-
var PaginationRoot = require('./PaginationRoot.js');
|
|
9
7
|
|
|
10
8
|
const PaginationItem = react.forwardRef(function PaginationItem({ asChild, className, ...rest }, ref) {
|
|
11
9
|
const Component = asChild ? reactSlot.Slot : 'li';
|
|
12
|
-
|
|
13
|
-
return (jsxRuntime.jsx(Component, { ref: ref, className: cl('ds-pagination__item', `ds-pagination--${size}`, compact && 'ds-pagination--compact', className), ...rest }));
|
|
10
|
+
return jsxRuntime.jsx(Component, { ref: ref, ...rest });
|
|
14
11
|
});
|
|
15
12
|
|
|
16
13
|
exports.PaginationItem = PaginationItem;
|
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var reactSlot = require('@radix-ui/react-slot');
|
|
6
|
-
var cl = require('clsx/lite');
|
|
7
6
|
var react = require('react');
|
|
8
|
-
var PaginationRoot = require('./PaginationRoot.js');
|
|
9
7
|
|
|
10
|
-
const PaginationList = react.forwardRef(function PaginationList({ asChild,
|
|
11
|
-
const { size } = react.useContext(PaginationRoot.PaginationContext);
|
|
8
|
+
const PaginationList = react.forwardRef(function PaginationList({ asChild, ...rest }, ref) {
|
|
12
9
|
const Component = asChild ? reactSlot.Slot : 'ul';
|
|
13
|
-
return
|
|
10
|
+
return jsxRuntime.jsx(Component, { ref: ref, ...rest });
|
|
14
11
|
});
|
|
15
12
|
|
|
16
13
|
exports.PaginationList = PaginationList;
|
|
@@ -3,33 +3,19 @@
|
|
|
3
3
|
|
|
4
4
|
var Pagination$1 = require('./Pagination.js');
|
|
5
5
|
var PaginationButton = require('./PaginationButton.js');
|
|
6
|
-
var PaginationEllipsis = require('./PaginationEllipsis.js');
|
|
7
6
|
var PaginationItem = require('./PaginationItem.js');
|
|
8
7
|
var PaginationList = require('./PaginationList.js');
|
|
9
|
-
var PaginationNextPrev = require('./PaginationNextPrev.js');
|
|
10
|
-
var PaginationRoot = require('./PaginationRoot.js');
|
|
11
8
|
|
|
12
|
-
const Pagination = Pagination$1.Pagination
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Pagination.Ellipsis = PaginationEllipsis.PaginationEllipsis;
|
|
18
|
-
Pagination.Previous = PaginationNextPrev.PaginationPrevious;
|
|
19
|
-
Pagination.Next = PaginationNextPrev.PaginationNext;
|
|
20
|
-
Pagination.Root.displayName = 'Pagination.Root';
|
|
9
|
+
const Pagination = Object.assign(Pagination$1.Pagination, {
|
|
10
|
+
List: PaginationList.PaginationList,
|
|
11
|
+
Item: PaginationItem.PaginationItem,
|
|
12
|
+
Button: PaginationButton.PaginationButton,
|
|
13
|
+
});
|
|
21
14
|
Pagination.List.displayName = 'Pagination.List';
|
|
22
15
|
Pagination.Item.displayName = 'Pagination.Item';
|
|
23
16
|
Pagination.Button.displayName = 'Pagination.Button';
|
|
24
|
-
Pagination.Ellipsis.displayName = 'Pagination.Ellipsis';
|
|
25
|
-
Pagination.Previous.displayName = 'Pagination.Previous';
|
|
26
|
-
Pagination.Next.displayName = 'Pagination.Next';
|
|
27
17
|
|
|
28
18
|
exports.PaginationButton = PaginationButton.PaginationButton;
|
|
29
|
-
exports.PaginationEllipsis = PaginationEllipsis.PaginationEllipsis;
|
|
30
19
|
exports.PaginationItem = PaginationItem.PaginationItem;
|
|
31
20
|
exports.PaginationList = PaginationList.PaginationList;
|
|
32
|
-
exports.PaginationNext = PaginationNextPrev.PaginationNext;
|
|
33
|
-
exports.PaginationPrevious = PaginationNextPrev.PaginationPrevious;
|
|
34
|
-
exports.PaginationRoot = PaginationRoot.PaginationRoot;
|
|
35
21
|
exports.Pagination = Pagination;
|
|
@@ -3,63 +3,58 @@
|
|
|
3
3
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
|
|
6
|
-
const getSteps = (
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const siblingsStart = Math.max(Math.min(currentPage - siblingCount, totalPages - boundaryCount - siblingCount * 2 - 1), boundaryCount + 2);
|
|
17
|
-
const siblingsEnd = siblingsStart + siblingCount * 2;
|
|
18
|
-
return [
|
|
19
|
-
...startPages,
|
|
20
|
-
siblingsStart - (startPages[startPages.length - 1] ?? 0) === 2
|
|
21
|
-
? siblingsStart - 1
|
|
22
|
-
: 'ellipsis',
|
|
23
|
-
...range(siblingsStart, siblingsEnd),
|
|
24
|
-
(endPages[0] ?? totalPages + 1) - siblingsEnd === 2
|
|
25
|
-
? siblingsEnd + 1
|
|
26
|
-
: 'ellipsis',
|
|
27
|
-
...endPages,
|
|
28
|
-
];
|
|
6
|
+
const getSteps = (now, max, show) => {
|
|
7
|
+
const offset = (show - 1) / 2;
|
|
8
|
+
const start = Math.min(Math.max(now - Math.floor(offset), 1), max - show + 1);
|
|
9
|
+
const end = Math.min(Math.max(now + Math.ceil(offset), show), max);
|
|
10
|
+
const pages = Array.from({ length: end + 1 - start }, (_, i) => i + start);
|
|
11
|
+
if (show > 4 && start > 1)
|
|
12
|
+
pages.splice(0, 2, 1, 0);
|
|
13
|
+
if (show > 3 && end < max)
|
|
14
|
+
pages.splice(-2, 2, 0, max);
|
|
15
|
+
return pages;
|
|
29
16
|
};
|
|
30
17
|
/** Hook to help manage pagination state */
|
|
31
|
-
const usePagination = ({
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
setCurrentPage(currentPage + 1 <= totalPages ? currentPage + 1 : totalPages);
|
|
41
|
-
};
|
|
42
|
-
const previousPage = () => {
|
|
43
|
-
setCurrentPage(currentPage - 1 > 0 ? currentPage - 1 : 1);
|
|
18
|
+
const usePagination = ({ currentPage = 1, setCurrentPage, onChange, totalPages, showPages = 7, }) => react.useMemo(() => {
|
|
19
|
+
const hasNext = currentPage < totalPages;
|
|
20
|
+
const hasPrev = currentPage !== 1;
|
|
21
|
+
const handleClick = (page) => (event) => {
|
|
22
|
+
if (page < 1 || page > totalPages)
|
|
23
|
+
return event.preventDefault(); // Prevent out of bounds navigation
|
|
24
|
+
onChange?.(event, page);
|
|
25
|
+
if (!event.defaultPrevented)
|
|
26
|
+
setCurrentPage?.(page); // Allow stopping change by calling event.preventDefault() in onChange
|
|
44
27
|
};
|
|
45
28
|
return {
|
|
46
29
|
/** Number of steps */
|
|
47
|
-
pages,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
|
|
30
|
+
pages: getSteps(currentPage, totalPages, showPages).map((page, index) => ({
|
|
31
|
+
page: page || '',
|
|
32
|
+
itemKey: page ? `page-${page}` : `ellipsis-${index}`, // React key utility
|
|
33
|
+
buttonProps: {
|
|
34
|
+
'aria-current': page === currentPage ? 'page' : undefined,
|
|
35
|
+
'aria-hidden': !page || undefined, // Hide ellipsis from screen reader
|
|
36
|
+
onClick: handleClick(page),
|
|
37
|
+
tabIndex: page ? undefined : -1, // Hide ellipsis keyboard
|
|
38
|
+
variant: page === currentPage ? 'primary' : 'tertiary',
|
|
39
|
+
},
|
|
40
|
+
})),
|
|
41
|
+
/** Properties to spread on Pagination.Button used for previous naviagation */
|
|
42
|
+
prevButtonProps: {
|
|
43
|
+
'aria-disabled': !hasPrev, // Using aria-disabled to support all HTML elements because of potential asChild
|
|
44
|
+
onClick: handleClick(currentPage - 1),
|
|
45
|
+
variant: 'tertiary',
|
|
46
|
+
},
|
|
47
|
+
/** Properties to spread on Pagination.Button used for next naviagation */
|
|
48
|
+
nextButtonProps: {
|
|
49
|
+
'aria-disabled': !hasNext, // Using aria-disabled to support all HTML elements because of potential asChild
|
|
50
|
+
onClick: handleClick(currentPage + 1),
|
|
51
|
+
variant: 'tertiary',
|
|
52
|
+
},
|
|
60
53
|
/** Indication if previous page action should be shown or not */
|
|
61
|
-
|
|
54
|
+
hasPrev,
|
|
55
|
+
/** Indication if next page action should be shown or not */
|
|
56
|
+
hasNext,
|
|
62
57
|
};
|
|
63
|
-
};
|
|
58
|
+
}, [currentPage, totalPages, showPages]);
|
|
64
59
|
|
|
65
60
|
exports.usePagination = usePagination;
|
|
@@ -6,21 +6,15 @@ var reactSlot = require('@radix-ui/react-slot');
|
|
|
6
6
|
var cl = require('clsx/lite');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
|
|
9
|
-
const lineHeightMap = {
|
|
10
|
-
short: 'ds-line-height--sm',
|
|
11
|
-
default: 'ds-line-height--md',
|
|
12
|
-
long: 'ds-line-height--lg',
|
|
13
|
-
};
|
|
14
9
|
/**
|
|
15
10
|
* Use `Paragraph` to display text with paragraph text styles.
|
|
16
11
|
*
|
|
17
12
|
* @example
|
|
18
13
|
* <Paragraph size='lg'>Paragraph</Paragraph>
|
|
19
14
|
*/
|
|
20
|
-
const Paragraph = react.forwardRef(({ className,
|
|
15
|
+
const Paragraph = react.forwardRef(function Paragraph({ className, size = 'md', asChild, variant = 'default', ...rest }, ref) {
|
|
21
16
|
const Component = asChild ? reactSlot.Slot : 'p';
|
|
22
|
-
return (jsxRuntime.jsx(Component, { ref: ref, className: cl(
|
|
17
|
+
return (jsxRuntime.jsx(Component, { ref: ref, className: cl(`ds-paragraph`, className), "data-size": size, "data-variant": variant, ...rest }));
|
|
23
18
|
});
|
|
24
|
-
Paragraph.displayName = 'Paragraph';
|
|
25
19
|
|
|
26
20
|
exports.Paragraph = Paragraph;
|
|
@@ -8,7 +8,6 @@ var reactSlot = require('@radix-ui/react-slot');
|
|
|
8
8
|
var cl = require('clsx/lite');
|
|
9
9
|
var react = require('react');
|
|
10
10
|
var PopoverContext = require('./PopoverContext.js');
|
|
11
|
-
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
12
11
|
|
|
13
12
|
const ARROW_HEIGHT = 7;
|
|
14
13
|
const ARROW_GAP = 4;
|
|
@@ -76,9 +75,9 @@ const Popover = react.forwardRef(function Popover({ id, className, onClose, onOp
|
|
|
76
75
|
if (id)
|
|
77
76
|
setPopoverId?.(id);
|
|
78
77
|
}, [id]);
|
|
79
|
-
return (jsxRuntime.jsx(
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
return (jsxRuntime.jsx(Component, { className: cl('ds-popover', className), "data-size": size, "data-variant": variant, id: id || popoverId,
|
|
79
|
+
// @ts-ignore @types/react-dom does not understand popover yet
|
|
80
|
+
popover: 'manual', ref: mergedRefs, ...rest }));
|
|
82
81
|
});
|
|
83
82
|
const arrowPseudoElement = {
|
|
84
83
|
name: 'ArrowPseudoElement',
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var cl = require('clsx/lite');
|
|
6
|
+
var react = require('react');
|
|
6
7
|
|
|
7
|
-
const SkipLink = ({
|
|
8
|
-
return (jsxRuntime.jsx("a", {
|
|
9
|
-
};
|
|
10
|
-
SkipLink.displayName = 'SkipLink';
|
|
8
|
+
const SkipLink = react.forwardRef(function SkipLink({ children, className, ...rest }, ref) {
|
|
9
|
+
return (jsxRuntime.jsx("a", { className: cl('ds-skiplink', className), ...rest, ref: ref, children: children }));
|
|
10
|
+
});
|
|
11
11
|
|
|
12
12
|
exports.SkipLink = SkipLink;
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var cl = require('clsx/lite');
|
|
6
6
|
var react = require('react');
|
|
7
|
-
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
8
7
|
|
|
9
8
|
const Table = react.forwardRef(function Table({ zebra = false, stickyHeader = false, border = false, hover = false, size = 'md', className, children, ...rest }, ref) {
|
|
10
|
-
return (jsxRuntime.jsx(
|
|
9
|
+
return (jsxRuntime.jsx("table", { className: cl('ds-table', className), "data-border": border || undefined, "data-hover": hover || undefined, "data-size": size, "data-sticky-header": stickyHeader || undefined, "data-zebra": zebra || undefined, ref: ref, ...rest, children: children }));
|
|
11
10
|
});
|
|
12
11
|
|
|
13
12
|
exports.Table = Table;
|
|
@@ -5,7 +5,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var cl = require('clsx/lite');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var Tabs = require('./Tabs.js');
|
|
8
|
-
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* A single content item in a Tabs component.
|
|
@@ -17,7 +16,7 @@ var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
|
17
16
|
const TabsPanel = react.forwardRef(function TabsPanel({ children, value, className, ...rest }, ref) {
|
|
18
17
|
const { value: tabsValue, size } = react.useContext(Tabs.Context);
|
|
19
18
|
const active = value === tabsValue;
|
|
20
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: active && (jsxRuntime.jsx(
|
|
19
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: active && (jsxRuntime.jsx("div", { className: cl('ds-tabs__panel', className), ref: ref, ...rest, children: children })) }));
|
|
21
20
|
});
|
|
22
21
|
|
|
23
22
|
exports.TabsPanel = TabsPanel;
|
|
@@ -6,7 +6,6 @@ var cl = require('clsx/lite');
|
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var RovingFocusItem = require('../../utilities/RovingFocus/RovingFocusItem.js');
|
|
8
8
|
var Tabs = require('./Tabs.js');
|
|
9
|
-
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* A single item in a Tabs component.
|
|
@@ -16,7 +15,7 @@ var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
|
16
15
|
const TabsTab = react.forwardRef(function TabsTab({ className, value, ...rest }, ref) {
|
|
17
16
|
const tabs = react.useContext(Tabs.Context);
|
|
18
17
|
const buttonId = `tab-${react.useId()}`;
|
|
19
|
-
return (jsxRuntime.jsx(RovingFocusItem.RovingFocusItem, { value: value, ...rest, asChild: true, children: jsxRuntime.jsx(
|
|
18
|
+
return (jsxRuntime.jsx(RovingFocusItem.RovingFocusItem, { value: value, ...rest, asChild: true, children: jsxRuntime.jsx("button", { ...rest, "aria-selected": tabs.value === value, className: cl('ds-tabs__tab', className), id: buttonId, onClick: () => tabs.onChange?.(value), ref: ref, role: 'tab', type: 'button' }) }));
|
|
20
19
|
});
|
|
21
20
|
|
|
22
21
|
exports.TabsTab = TabsTab;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var cl = require('clsx/lite');
|
|
6
6
|
var react = require('react');
|
|
7
|
-
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Use `Tag` to display a small piece of information.
|
|
@@ -12,7 +11,7 @@ var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
|
12
11
|
* <Tag color='success'>Success</Tag>
|
|
13
12
|
*/
|
|
14
13
|
const Tag = react.forwardRef(function Tag({ size = 'md', color = 'neutral', className, ...rest }, ref) {
|
|
15
|
-
return (jsxRuntime.jsx(
|
|
14
|
+
return (jsxRuntime.jsx("span", { className: cl('ds-tag', className), "data-color": color, "data-size": size, ref: ref, ...rest }));
|
|
16
15
|
});
|
|
17
16
|
|
|
18
17
|
exports.Tag = Tag;
|
|
@@ -5,7 +5,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var react$1 = require('@floating-ui/react');
|
|
6
6
|
var cl = require('clsx/lite');
|
|
7
7
|
var react = require('react');
|
|
8
|
-
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
9
8
|
|
|
10
9
|
const ARROW_HEIGHT = 7;
|
|
11
10
|
const ARROW_GAP = 4;
|
|
@@ -63,11 +62,11 @@ const Tooltip = react.forwardRef(({ children, content, placement = 'top', delay
|
|
|
63
62
|
}
|
|
64
63
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [react.cloneElement(children, getReferenceProps({
|
|
65
64
|
ref: childMergedRef,
|
|
66
|
-
})), internalOpen && (jsxRuntime.jsx(Container, { children: jsxRuntime.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
})), internalOpen && (jsxRuntime.jsx(Container, { children: jsxRuntime.jsxs("div", { ref: refs.setFloating, style: { ...floatingStyles, ...animationStyles, ...style }, role: 'tooltip', ...getFloatingProps({
|
|
66
|
+
className: cl('ds-tooltip', className),
|
|
67
|
+
ref: mergedRef,
|
|
68
|
+
...rest,
|
|
69
|
+
}), children: [content, jsxRuntime.jsx(react$1.FloatingArrow, { ref: arrowRef, context: context, className: 'ds-tooltip__arrow', height: ARROW_HEIGHT })] }) }))] }));
|
|
71
70
|
});
|
|
72
71
|
Tooltip.displayName = 'Tooltip';
|
|
73
72
|
|
package/dist/cjs/components/{Typography/ValidationMessage → ValidationMessage}/ValidationMessage.js
RENAMED
|
@@ -7,9 +7,9 @@ var cl = require('clsx/lite');
|
|
|
7
7
|
var react = require('react');
|
|
8
8
|
|
|
9
9
|
/** Use `ValidationMessage` to display validation text */
|
|
10
|
-
const ValidationMessage = react.forwardRef(function ValidationMessage({ size = 'md', className,
|
|
10
|
+
const ValidationMessage = react.forwardRef(function ValidationMessage({ size = 'md', className, asChild, error = true, ...rest }, ref) {
|
|
11
11
|
const Component = asChild ? reactSlot.Slot : 'div';
|
|
12
|
-
return (jsxRuntime.jsx(Component, {
|
|
12
|
+
return (jsxRuntime.jsx(Component, { className: cl(`ds-validation-message--${size}`, className), "data-error": error || undefined, ref: ref, ...rest }));
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
exports.ValidationMessage = ValidationMessage;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var ValidationMessage = require('../
|
|
5
|
+
var ValidationMessage = require('../ValidationMessage/ValidationMessage.js');
|
|
6
6
|
|
|
7
7
|
const defaultLabel = (count) => count > -1 ? `${count} tegn igjen` : `${Math.abs(count)} tegn for mye`;
|
|
8
8
|
const defaultSrLabel = (maxCount) => `Tekstfelt med plass til ${maxCount} tegn`;
|
|
@@ -6,9 +6,9 @@ var react$1 = require('@floating-ui/react');
|
|
|
6
6
|
var cl = require('clsx/lite');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var useCheckbox = require('./useCheckbox.js');
|
|
9
|
-
var Paragraph = require('../../
|
|
9
|
+
var Paragraph = require('../../Paragraph/Paragraph.js');
|
|
10
10
|
var omit = require('../../../utilities/omit/omit.js');
|
|
11
|
-
var Label = require('../../
|
|
11
|
+
var Label = require('../../Label/Label.js');
|
|
12
12
|
|
|
13
13
|
const Checkbox = react.forwardRef((props, ref) => {
|
|
14
14
|
const { children, description, className, style, ...rest } = props;
|
|
@@ -26,7 +26,6 @@ const ComboboxComponent = react.forwardRef(({ value, initialValue = [], onValueC
|
|
|
26
26
|
const inputRef = react.useRef(null);
|
|
27
27
|
const portalRef = react.useRef(null);
|
|
28
28
|
const listRef = react.useRef([]);
|
|
29
|
-
const listId = react.useId();
|
|
30
29
|
const [inputValue, setInputValue] = react.useState(rest.inputValue || '');
|
|
31
30
|
react.useEffect(() => {
|
|
32
31
|
if (typeof rest.inputValue === 'string') {
|
|
@@ -179,7 +178,7 @@ const ComboboxComponent = react.forwardRef(({ value, initialValue = [], onValueC
|
|
|
179
178
|
setListRef: (index, node) => {
|
|
180
179
|
listRef.current[index] = node;
|
|
181
180
|
},
|
|
182
|
-
}, children: [jsxRuntime.jsxs("div", { className: cl('ds-combobox', `ds-combobox--${size}`, disabled && 'ds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsxRuntime.jsx(ComboboxNative, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsxRuntime.jsx(ComboboxLabel, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsxRuntime.jsx(ComboboxInput, { ...omit.omit(['inputValue'], rest), hideClearButton: hideClearButton, listId:
|
|
181
|
+
}, children: [jsxRuntime.jsxs("div", { className: cl('ds-combobox', `ds-combobox--${size}`, disabled && 'ds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsxRuntime.jsx(ComboboxNative, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsxRuntime.jsx(ComboboxLabel, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsxRuntime.jsx(ComboboxInput, { ...omit.omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: context.floatingId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsxRuntime.jsx(ComboboxError, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsxRuntime.jsx(react$1.FloatingPortal, { root: portal ? null : portalRef, children: jsxRuntime.jsx(react$1.FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxRuntime.jsxs("div", { "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
|
|
183
182
|
ref: refs.setFloating,
|
|
184
183
|
style: {
|
|
185
184
|
...floatingStyles,
|
|
@@ -8,7 +8,7 @@ var cl = require('clsx/lite');
|
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var ComboboxContext = require('./ComboboxContext.js');
|
|
10
10
|
var ComboboxIdContext = require('./ComboboxIdContext.js');
|
|
11
|
-
var Label = require('../../
|
|
11
|
+
var Label = require('../../Label/Label.js');
|
|
12
12
|
var omit = require('../../../utilities/omit/omit.js');
|
|
13
13
|
|
|
14
14
|
const ComboboxCustom = react.forwardRef(({ asChild, interactive, id, className, ...rest }, ref) => {
|
|
@@ -5,7 +5,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var cl = require('clsx/lite');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var ComboboxContext = require('./ComboboxContext.js');
|
|
8
|
-
var Label = require('../../
|
|
8
|
+
var Label = require('../../Label/Label.js');
|
|
9
9
|
|
|
10
10
|
const ComboboxEmpty = react.forwardRef(({ children, className, ...rest }, ref) => {
|
|
11
11
|
const context = react.useContext(ComboboxContext.ComboboxContext);
|
|
@@ -9,7 +9,7 @@ var ComboboxContext = require('../ComboboxContext.js');
|
|
|
9
9
|
var Description = require('./Description.js');
|
|
10
10
|
var SelectedIcon = require('./SelectedIcon.js');
|
|
11
11
|
var useComboboxOption = require('./useComboboxOption.js');
|
|
12
|
-
var Label = require('../../../
|
|
12
|
+
var Label = require('../../../Label/Label.js');
|
|
13
13
|
|
|
14
14
|
const ComboboxOption = react.memo(react.forwardRef(({ value, description, children, className, ...rest }, forwardedRef) => {
|
|
15
15
|
const labelId = react.useId();
|
|
@@ -5,7 +5,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var react = require('react');
|
|
6
6
|
require('../../../Chip/index.js');
|
|
7
7
|
var ComboboxContext = require('../ComboboxContext.js');
|
|
8
|
-
var
|
|
8
|
+
var Chips = require('../../../Chip/Chips.js');
|
|
9
9
|
|
|
10
10
|
const ComboboxChips = () => {
|
|
11
11
|
const context = react.useContext(ComboboxContext.ComboboxContext);
|
|
@@ -14,7 +14,7 @@ const ComboboxChips = () => {
|
|
|
14
14
|
}
|
|
15
15
|
const { size, readOnly, disabled, selectedOptions, chipSrLabel, handleSelectOption, inputRef, } = context;
|
|
16
16
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Object.keys(selectedOptions).map((value) => {
|
|
17
|
-
return (jsxRuntime.jsx(
|
|
17
|
+
return (jsxRuntime.jsx(Chips.ChipRemovable, { size: size, disabled: disabled, onKeyDown: (e) => {
|
|
18
18
|
if (readOnly)
|
|
19
19
|
return;
|
|
20
20
|
if (disabled)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var ValidationMessage = require('../../../
|
|
5
|
+
var ValidationMessage = require('../../../ValidationMessage/ValidationMessage.js');
|
|
6
6
|
|
|
7
7
|
const ComboboxError = ({ size, error, formFieldProps }) => {
|
|
8
8
|
return (jsxRuntime.jsx("div", { className: 'ds-combobox__error-message', id: formFieldProps.errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', children: error && jsxRuntime.jsx(ValidationMessage.ValidationMessage, { size: size, children: error }) }));
|
|
@@ -11,7 +11,7 @@ var ComboboxIdContext = require('../ComboboxIdContext.js');
|
|
|
11
11
|
var utilities = require('../utilities.js');
|
|
12
12
|
var ComboboxChips = require('./ComboboxChips.js');
|
|
13
13
|
var ComboboxClearButton = require('./ComboboxClearButton.js');
|
|
14
|
-
var Paragraph = require('../../../
|
|
14
|
+
var Paragraph = require('../../../Paragraph/Paragraph.js');
|
|
15
15
|
var omit = require('../../../../utilities/omit/omit.js');
|
|
16
16
|
|
|
17
17
|
const ComboboxInput = ({ hideClearButton, listId, error, hideChips, handleKeyDown, ...rest }) => {
|
|
@@ -70,7 +70,7 @@ const ComboboxInput = ({ hideClearButton, listId, error, hideChips, handleKeyDow
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
});
|
|
73
|
-
return (jsxRuntime.jsx(Paragraph.Paragraph, { size: size, asChild: true, children: jsxRuntime.jsxs("div", { ...props, "aria-disabled": disabled ? 'true' : undefined, className: cl('ds-textfield__input', 'ds-combobox__input__wrapper', readOnly && 'ds-combobox--readonly', error && 'ds-combobox--error'), children: [jsxRuntime.jsxs("div", { className: 'ds-combobox__chip-and-input', children: [multiple && !hideChips && jsxRuntime.jsx(ComboboxChips, {}), jsxRuntime.jsx(Paragraph.Paragraph, { size: size, asChild: true, children: jsxRuntime.jsx("input", { ref: mergedRefs, "aria-activedescendant": props['aria-activedescendant'], readOnly: readOnly, "aria-autocomplete": 'list', role: 'combobox', "aria-expanded": open, "aria-controls": listId, autoComplete: 'off', size: htmlSize, value: inputValue, ...omit.omit(['style', 'className'], rest), ...formFieldProps.inputProps, className: 'ds-combobox__input', onChange: (e) => {
|
|
73
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { size: size, asChild: true, children: jsxRuntime.jsxs("div", { ...props, "aria-disabled": disabled ? 'true' : undefined, className: cl('ds-textfield__input', 'ds-combobox__input__wrapper', readOnly && 'ds-combobox--readonly', error && 'ds-combobox--error'), children: [jsxRuntime.jsxs("div", { className: 'ds-combobox__chip-and-input', children: [multiple && !hideChips && jsxRuntime.jsx(ComboboxChips, {}), jsxRuntime.jsx(Paragraph.Paragraph, { size: size, asChild: true, children: jsxRuntime.jsx("input", { ref: mergedRefs, "aria-activedescendant": props['aria-activedescendant'], readOnly: readOnly, "aria-autocomplete": 'list', role: 'combobox', "aria-expanded": open, "aria-controls": open ? listId : undefined, autoComplete: 'off', size: htmlSize, value: inputValue, ...omit.omit(['style', 'className'], rest), ...formFieldProps.inputProps, className: 'ds-combobox__input', onChange: (e) => {
|
|
74
74
|
onChange(e);
|
|
75
75
|
!open && setOpen(true);
|
|
76
76
|
rest.onChange?.(e);
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var akselIcons = require('@navikt/aksel-icons');
|
|
6
6
|
var cl = require('clsx/lite');
|
|
7
|
-
var Label = require('../../../
|
|
8
|
-
var Paragraph = require('../../../
|
|
7
|
+
var Label = require('../../../Label/Label.js');
|
|
8
|
+
var Paragraph = require('../../../Paragraph/Paragraph.js');
|
|
9
9
|
|
|
10
10
|
const ComboboxLabel = ({ label, description, hideLabel, size, readOnly, formFieldProps, }) => {
|
|
11
11
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [label && (jsxRuntime.jsxs(Label.Label, { size: size, htmlFor: formFieldProps.inputProps.id, className: cl('ds-combobox__label', hideLabel && `ds-sr-only`), children: [readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { "aria-hidden": true, className: 'ds-combobox__readonly__icon' })), label] })), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: formFieldProps.descriptionId, className: cl('ds-combobox__description', hideLabel && `ds-sr-only`), children: description }) }))] }));
|
|
@@ -6,9 +6,9 @@ var cl = require('clsx/lite');
|
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var useFormField = require('../useFormField.js');
|
|
8
8
|
var FieldsetContext = require('./FieldsetContext.js');
|
|
9
|
-
var Label = require('../../
|
|
10
|
-
var Paragraph = require('../../
|
|
11
|
-
var ValidationMessage = require('../../
|
|
9
|
+
var Label = require('../../Label/Label.js');
|
|
10
|
+
var Paragraph = require('../../Paragraph/Paragraph.js');
|
|
11
|
+
var ValidationMessage = require('../../ValidationMessage/ValidationMessage.js');
|
|
12
12
|
|
|
13
13
|
const Fieldset = react.forwardRef(function Fieldset(props, ref) {
|
|
14
14
|
const { children, legend, description, error, hideLegend, className, ...rest } = props;
|
|
@@ -5,9 +5,9 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var cl = require('clsx/lite');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var useRadio = require('./useRadio.js');
|
|
8
|
-
var Paragraph = require('../../
|
|
8
|
+
var Paragraph = require('../../Paragraph/Paragraph.js');
|
|
9
9
|
var omit = require('../../../utilities/omit/omit.js');
|
|
10
|
-
var Label = require('../../
|
|
10
|
+
var Label = require('../../Label/Label.js');
|
|
11
11
|
|
|
12
12
|
const Radio = react.forwardRef((props, ref) => {
|
|
13
13
|
const { children, description, className, style, ...rest } = props;
|
|
@@ -8,8 +8,8 @@ var cl = require('clsx/lite');
|
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var Button = require('../../Button/Button.js');
|
|
10
10
|
var useSearch = require('./useSearch.js');
|
|
11
|
-
var Paragraph = require('../../
|
|
12
|
-
var Label = require('../../
|
|
11
|
+
var Paragraph = require('../../Paragraph/Paragraph.js');
|
|
12
|
+
var Label = require('../../Label/Label.js');
|
|
13
13
|
var omit = require('../../../utilities/omit/omit.js');
|
|
14
14
|
|
|
15
15
|
/** Search field
|
|
@@ -6,10 +6,10 @@ var akselIcons = require('@navikt/aksel-icons');
|
|
|
6
6
|
var cl = require('clsx/lite');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var useSelect = require('./useSelect.js');
|
|
9
|
-
var
|
|
9
|
+
var Paragraph = require('../../Paragraph/Paragraph.js');
|
|
10
|
+
var Label = require('../../Label/Label.js');
|
|
10
11
|
var omit = require('../../../utilities/omit/omit.js');
|
|
11
|
-
var ValidationMessage = require('../../
|
|
12
|
-
var Paragraph = require('../../Typography/Paragraph/Paragraph.js');
|
|
12
|
+
var ValidationMessage = require('../../ValidationMessage/ValidationMessage.js');
|
|
13
13
|
|
|
14
14
|
const Select = react.forwardRef(function Select(props, ref) {
|
|
15
15
|
const { children, disabled = false, label, description, hideLabel = false, error, className, htmlSize = 0, ...rest } = props;
|