@navikt/ds-react 3.4.2 → 4.1.0
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/_docs.json +5912 -3911
- package/cjs/accordion/Accordion.js +22 -2
- package/cjs/alert/Alert.js +9 -0
- package/cjs/button/Button.js +10 -0
- package/cjs/chat/Chat.js +16 -0
- package/cjs/chips/Chips.js +27 -0
- package/cjs/chips/Toggle.js +4 -6
- package/cjs/copybutton/CopyButton.js +11 -0
- package/cjs/date/DateInput.js +1 -1
- package/cjs/date/datepicker/DatePicker.js +22 -0
- package/cjs/date/hooks/index.js +4 -4
- package/cjs/date/hooks/useDatepicker.js +13 -0
- package/cjs/date/hooks/useMonthPicker.js +13 -0
- package/cjs/date/hooks/useRangeDatepicker.js +12 -0
- package/cjs/date/index.js +6 -6
- package/cjs/date/monthpicker/MonthPicker.js +22 -0
- package/cjs/dropdown/Dropdown.js +88 -0
- package/cjs/dropdown/Menu/Divider.js +47 -0
- package/cjs/dropdown/Menu/GroupedList/Heading.js +47 -0
- package/cjs/dropdown/Menu/GroupedList/Item.js +54 -0
- package/cjs/dropdown/Menu/GroupedList/index.js +51 -0
- package/cjs/dropdown/Menu/GroupedList/package.json +6 -0
- package/cjs/dropdown/Menu/List/Item.js +54 -0
- package/cjs/dropdown/Menu/List/index.js +49 -0
- package/cjs/dropdown/Menu/List/package.json +6 -0
- package/cjs/dropdown/Menu/index.js +64 -0
- package/cjs/dropdown/Menu/package.json +6 -0
- package/cjs/dropdown/Toggle.js +66 -0
- package/cjs/dropdown/index.js +23 -0
- package/cjs/dropdown/package.json +6 -0
- package/cjs/expansion-card/ExpansionCard.js +18 -0
- package/cjs/form/ConfirmationPanel.js +18 -0
- package/cjs/form/Select.js +16 -0
- package/cjs/form/Switch.js +11 -0
- package/cjs/form/TextField.js +11 -0
- package/cjs/form/Textarea.js +11 -0
- package/cjs/form/checkbox/CheckboxGroup.js +15 -0
- package/cjs/form/error-summary/ErrorSummary.js +18 -0
- package/cjs/form/radio/RadioGroup.js +10 -0
- package/cjs/form/search/Search.js +13 -0
- package/cjs/guide-panel/GuidePanel.js +15 -0
- package/cjs/help-text/HelpText.js +13 -0
- package/cjs/index.js +4 -0
- package/cjs/internal-header/InternalHeader.js +83 -0
- package/cjs/internal-header/InternalHeaderButton.js +47 -0
- package/cjs/internal-header/InternalHeaderTitle.js +48 -0
- package/cjs/internal-header/InternalHeaderUser.js +51 -0
- package/cjs/internal-header/InternalHeaderUserButton.js +54 -0
- package/cjs/internal-header/index.js +8 -0
- package/cjs/internal-header/package.json +6 -0
- package/cjs/link/Link.js +13 -0
- package/cjs/link-panel/LinkPanel.js +17 -0
- package/cjs/loader/Loader.js +11 -0
- package/cjs/modal/Modal.js +27 -0
- package/cjs/pagination/Pagination.js +17 -0
- package/cjs/panel/Panel.js +19 -0
- package/cjs/popover/Popover.js +20 -0
- package/cjs/provider/Provider.js +13 -0
- package/cjs/read-more/ReadMore.js +17 -0
- package/cjs/skeleton/Skeleton.js +51 -0
- package/cjs/skeleton/index.js +8 -0
- package/cjs/skeleton/package.json +6 -0
- package/cjs/stepper/Step.js +3 -4
- package/cjs/stepper/Stepper.js +24 -0
- package/cjs/table/Table.js +32 -0
- package/cjs/tabs/Tabs.js +27 -1
- package/cjs/tag/Tag.js +11 -0
- package/cjs/timeline/AxisLabels.js +90 -0
- package/cjs/timeline/Pin.js +106 -0
- package/cjs/timeline/Timeline.js +180 -0
- package/cjs/timeline/TimelineRow.js +86 -0
- package/cjs/timeline/hooks/usePeriodContext.js +16 -0
- package/cjs/timeline/hooks/useRowContext.js +18 -0
- package/cjs/timeline/hooks/useTimelineContext.js +23 -0
- package/cjs/timeline/hooks/useTimelineRows.js +79 -0
- package/cjs/timeline/index.js +8 -0
- package/cjs/timeline/package.json +6 -0
- package/cjs/timeline/period/ClickablePeriod.js +120 -0
- package/cjs/timeline/period/NonClickablePeriod.js +18 -0
- package/cjs/timeline/period/index.js +46 -0
- package/cjs/timeline/period/package.json +6 -0
- package/cjs/timeline/utils/calc.js +19 -0
- package/cjs/timeline/utils/filter.js +18 -0
- package/cjs/timeline/utils/index.js +7 -0
- package/cjs/timeline/utils/package.json +6 -0
- package/cjs/timeline/utils/period.js +40 -0
- package/cjs/timeline/utils/sort.js +10 -0
- package/cjs/timeline/utils/timeline.js +79 -0
- package/cjs/timeline/utils/types.external.js +2 -0
- package/cjs/timeline/utils/types.internal.js +2 -0
- package/cjs/timeline/zoom/ZoomButton.js +68 -0
- package/cjs/timeline/zoom/index.js +50 -0
- package/cjs/timeline/zoom/package.json +6 -0
- package/cjs/toggle-group/ToggleGroup.js +17 -2
- package/cjs/tooltip/Tooltip.js +13 -0
- package/cjs/typography/BodyLong.js +14 -0
- package/cjs/typography/BodyShort.js +14 -0
- package/cjs/typography/Detail.js +14 -0
- package/cjs/typography/ErrorMessage.js +14 -0
- package/cjs/typography/Heading.js +14 -0
- package/cjs/typography/Ingress.js +14 -0
- package/cjs/typography/Label.js +14 -0
- package/esm/accordion/Accordion.d.ts +40 -6
- package/esm/accordion/Accordion.js +22 -2
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionContent.d.ts +1 -2
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.d.ts +1 -2
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/accordion/AccordionItem.d.ts +1 -2
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/alert/Alert.d.ts +9 -0
- package/esm/alert/Alert.js +9 -0
- package/esm/alert/Alert.js.map +1 -1
- package/esm/button/Button.d.ts +10 -0
- package/esm/button/Button.js +10 -0
- package/esm/button/Button.js.map +1 -1
- package/esm/chat/Bubble.d.ts +1 -2
- package/esm/chat/Bubble.js.map +1 -1
- package/esm/chat/Chat.d.ts +21 -2
- package/esm/chat/Chat.js +16 -0
- package/esm/chat/Chat.js.map +1 -1
- package/esm/chips/Chips.d.ts +42 -4
- package/esm/chips/Chips.js +27 -0
- package/esm/chips/Chips.js.map +1 -1
- package/esm/chips/Removable.d.ts +0 -2
- package/esm/chips/Removable.js.map +1 -1
- package/esm/chips/Toggle.d.ts +11 -3
- package/esm/chips/Toggle.js +4 -6
- package/esm/chips/Toggle.js.map +1 -1
- package/esm/copybutton/CopyButton.d.ts +11 -0
- package/esm/copybutton/CopyButton.js +11 -0
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/DateInput.d.ts +2 -3
- package/esm/date/DateInput.js +1 -1
- package/esm/date/DateInput.js.map +1 -1
- package/esm/date/datepicker/DatePicker.d.ts +38 -2
- package/esm/date/datepicker/DatePicker.js +22 -0
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/hooks/index.d.ts +3 -3
- package/esm/date/hooks/index.js +3 -3
- package/esm/date/hooks/index.js.map +1 -1
- package/esm/date/hooks/useDatepicker.d.ts +13 -0
- package/esm/date/hooks/useDatepicker.js +13 -0
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.d.ts +13 -0
- package/esm/date/hooks/useMonthPicker.js +13 -0
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/hooks/useRangeDatepicker.d.ts +12 -0
- package/esm/date/hooks/useRangeDatepicker.js +12 -0
- package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/index.d.ts +3 -3
- package/esm/date/index.js +3 -3
- package/esm/date/index.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.d.ts +34 -4
- package/esm/date/monthpicker/MonthPicker.js +22 -0
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/dropdown/Dropdown.d.ts +74 -0
- package/esm/dropdown/Dropdown.js +60 -0
- package/esm/dropdown/Dropdown.js.map +1 -0
- package/esm/dropdown/Menu/Divider.d.ts +3 -0
- package/esm/dropdown/Menu/Divider.js +19 -0
- package/esm/dropdown/Menu/Divider.js.map +1 -0
- package/esm/dropdown/Menu/GroupedList/Heading.d.ts +9 -0
- package/esm/dropdown/Menu/GroupedList/Heading.js +19 -0
- package/esm/dropdown/Menu/GroupedList/Heading.js.map +1 -0
- package/esm/dropdown/Menu/GroupedList/Item.d.ts +10 -0
- package/esm/dropdown/Menu/GroupedList/Item.js +26 -0
- package/esm/dropdown/Menu/GroupedList/Item.js.map +1 -0
- package/esm/dropdown/Menu/GroupedList/index.d.ts +23 -0
- package/esm/dropdown/Menu/GroupedList/index.js +23 -0
- package/esm/dropdown/Menu/GroupedList/index.js.map +1 -0
- package/esm/dropdown/Menu/List/Item.d.ts +10 -0
- package/esm/dropdown/Menu/List/Item.js +26 -0
- package/esm/dropdown/Menu/List/Item.js.map +1 -0
- package/esm/dropdown/Menu/List/index.d.ts +18 -0
- package/esm/dropdown/Menu/List/index.js +21 -0
- package/esm/dropdown/Menu/List/index.js.map +1 -0
- package/esm/dropdown/Menu/index.d.ts +35 -0
- package/esm/dropdown/Menu/index.js +36 -0
- package/esm/dropdown/Menu/index.js.map +1 -0
- package/esm/dropdown/Toggle.d.ts +9 -0
- package/esm/dropdown/Toggle.js +38 -0
- package/esm/dropdown/Toggle.js.map +1 -0
- package/esm/dropdown/index.d.ts +2 -0
- package/esm/dropdown/index.js +3 -0
- package/esm/dropdown/index.js.map +1 -0
- package/esm/expansion-card/ExpansionCard.d.ts +40 -8
- package/esm/expansion-card/ExpansionCard.js +18 -0
- package/esm/expansion-card/ExpansionCard.js.map +1 -1
- package/esm/expansion-card/ExpansionCardContent.d.ts +1 -2
- package/esm/expansion-card/ExpansionCardContent.js.map +1 -1
- package/esm/expansion-card/ExpansionCardDescription.d.ts +2 -4
- package/esm/expansion-card/ExpansionCardDescription.js.map +1 -1
- package/esm/expansion-card/ExpansionCardHeader.d.ts +1 -2
- package/esm/expansion-card/ExpansionCardHeader.js.map +1 -1
- package/esm/expansion-card/ExpansionCardTitle.d.ts +2 -4
- package/esm/expansion-card/ExpansionCardTitle.js.map +1 -1
- package/esm/form/ConfirmationPanel.d.ts +18 -0
- package/esm/form/ConfirmationPanel.js +18 -0
- package/esm/form/ConfirmationPanel.js.map +1 -1
- package/esm/form/Select.d.ts +16 -0
- package/esm/form/Select.js +16 -0
- package/esm/form/Select.js.map +1 -1
- package/esm/form/Switch.d.ts +11 -0
- package/esm/form/Switch.js +11 -0
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/TextField.d.ts +11 -0
- package/esm/form/TextField.js +11 -0
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.d.ts +11 -0
- package/esm/form/Textarea.js +11 -0
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/CheckboxGroup.d.ts +15 -0
- package/esm/form/checkbox/CheckboxGroup.js +15 -0
- package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.d.ts +18 -0
- package/esm/form/error-summary/ErrorSummary.js +18 -0
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/radio/RadioGroup.d.ts +10 -0
- package/esm/form/radio/RadioGroup.js +10 -0
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/form/search/Search.d.ts +13 -0
- package/esm/form/search/Search.js +13 -0
- package/esm/form/search/Search.js.map +1 -1
- package/esm/guide-panel/GuidePanel.d.ts +15 -0
- package/esm/guide-panel/GuidePanel.js +15 -0
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +13 -0
- package/esm/help-text/HelpText.js +13 -0
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/index.d.ts +4 -0
- package/esm/index.js +4 -0
- package/esm/index.js.map +1 -1
- package/esm/internal-header/InternalHeader.d.ts +60 -0
- package/esm/internal-header/InternalHeader.js +55 -0
- package/esm/internal-header/InternalHeader.js.map +1 -0
- package/esm/internal-header/InternalHeaderButton.d.ts +10 -0
- package/esm/internal-header/InternalHeaderButton.js +19 -0
- package/esm/internal-header/InternalHeaderButton.js.map +1 -0
- package/esm/internal-header/InternalHeaderTitle.d.ts +10 -0
- package/esm/internal-header/InternalHeaderTitle.js +20 -0
- package/esm/internal-header/InternalHeaderTitle.js.map +1 -0
- package/esm/internal-header/InternalHeaderUser.d.ts +13 -0
- package/esm/internal-header/InternalHeaderUser.js +23 -0
- package/esm/internal-header/InternalHeaderUser.js.map +1 -0
- package/esm/internal-header/InternalHeaderUserButton.d.ts +14 -0
- package/esm/internal-header/InternalHeaderUserButton.js +26 -0
- package/esm/internal-header/InternalHeaderUserButton.js.map +1 -0
- package/esm/internal-header/index.d.ts +5 -0
- package/esm/internal-header/index.js +2 -0
- package/esm/internal-header/index.js.map +1 -0
- package/esm/link/Link.d.ts +13 -0
- package/esm/link/Link.js +13 -0
- package/esm/link/Link.js.map +1 -1
- package/esm/link-panel/LinkPanel.d.ts +28 -4
- package/esm/link-panel/LinkPanel.js +17 -0
- package/esm/link-panel/LinkPanel.js.map +1 -1
- package/esm/link-panel/LinkPanelDescription.d.ts +2 -4
- package/esm/link-panel/LinkPanelDescription.js.map +1 -1
- package/esm/link-panel/LinkPanelTitle.d.ts +2 -4
- package/esm/link-panel/LinkPanelTitle.js.map +1 -1
- package/esm/list/List.d.ts +5 -2
- package/esm/list/List.js.map +1 -1
- package/esm/list/ListItem.d.ts +1 -3
- package/esm/list/ListItem.js.map +1 -1
- package/esm/loader/Loader.d.ts +11 -0
- package/esm/loader/Loader.js +11 -0
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.d.ts +27 -0
- package/esm/modal/Modal.js +27 -0
- package/esm/modal/Modal.js.map +1 -1
- package/esm/pagination/Pagination.d.ts +17 -0
- package/esm/pagination/Pagination.js +17 -0
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/panel/Panel.d.ts +19 -0
- package/esm/panel/Panel.js +19 -0
- package/esm/panel/Panel.js.map +1 -1
- package/esm/popover/Popover.d.ts +20 -0
- package/esm/popover/Popover.js +20 -0
- package/esm/popover/Popover.js.map +1 -1
- package/esm/provider/Provider.d.ts +13 -0
- package/esm/provider/Provider.js +13 -0
- package/esm/provider/Provider.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +17 -0
- package/esm/read-more/ReadMore.js +17 -0
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/skeleton/Skeleton.d.ts +18 -0
- package/esm/skeleton/Skeleton.js +23 -0
- package/esm/skeleton/Skeleton.js.map +1 -0
- package/esm/skeleton/index.d.ts +2 -0
- package/esm/skeleton/index.js +2 -0
- package/esm/skeleton/index.js.map +1 -0
- package/esm/stepper/Step.d.ts +1 -4
- package/esm/stepper/Step.js +1 -2
- package/esm/stepper/Step.js.map +1 -1
- package/esm/stepper/Stepper.d.ts +31 -2
- package/esm/stepper/Stepper.js +24 -0
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/table/Table.d.ts +32 -0
- package/esm/table/Table.js +32 -0
- package/esm/table/Table.js.map +1 -1
- package/esm/tabs/Tab.d.ts +1 -2
- package/esm/tabs/Tab.js.map +1 -1
- package/esm/tabs/TabList.d.ts +1 -2
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/TabPanel.d.ts +1 -2
- package/esm/tabs/TabPanel.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +43 -6
- package/esm/tabs/Tabs.js +27 -1
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tag/Tag.d.ts +11 -0
- package/esm/tag/Tag.js +11 -0
- package/esm/tag/Tag.js.map +1 -1
- package/esm/timeline/AxisLabels.d.ts +6 -0
- package/esm/timeline/AxisLabels.js +81 -0
- package/esm/timeline/AxisLabels.js.map +1 -0
- package/esm/timeline/Pin.d.ts +17 -0
- package/esm/timeline/Pin.js +81 -0
- package/esm/timeline/Pin.js.map +1 -0
- package/esm/timeline/Timeline.d.ts +63 -0
- package/esm/timeline/Timeline.js +152 -0
- package/esm/timeline/Timeline.js.map +1 -0
- package/esm/timeline/TimelineRow.d.ts +22 -0
- package/esm/timeline/TimelineRow.js +58 -0
- package/esm/timeline/TimelineRow.js.map +1 -0
- package/esm/timeline/hooks/usePeriodContext.d.ts +9 -0
- package/esm/timeline/hooks/usePeriodContext.js +13 -0
- package/esm/timeline/hooks/usePeriodContext.js.map +1 -0
- package/esm/timeline/hooks/useRowContext.d.ts +11 -0
- package/esm/timeline/hooks/useRowContext.js +15 -0
- package/esm/timeline/hooks/useRowContext.js.map +1 -0
- package/esm/timeline/hooks/useTimelineContext.d.ts +15 -0
- package/esm/timeline/hooks/useTimelineContext.js +20 -0
- package/esm/timeline/hooks/useTimelineContext.js.map +1 -0
- package/esm/timeline/hooks/useTimelineRows.d.ts +4 -0
- package/esm/timeline/hooks/useTimelineRows.js +74 -0
- package/esm/timeline/hooks/useTimelineRows.js.map +1 -0
- package/esm/timeline/index.d.ts +6 -0
- package/esm/timeline/index.js +2 -0
- package/esm/timeline/index.js.map +1 -0
- package/esm/timeline/period/ClickablePeriod.d.ts +9 -0
- package/esm/timeline/period/ClickablePeriod.js +93 -0
- package/esm/timeline/period/ClickablePeriod.js.map +1 -0
- package/esm/timeline/period/NonClickablePeriod.d.ts +7 -0
- package/esm/timeline/period/NonClickablePeriod.js +14 -0
- package/esm/timeline/period/NonClickablePeriod.js.map +1 -0
- package/esm/timeline/period/index.d.ts +57 -0
- package/esm/timeline/period/index.js +18 -0
- package/esm/timeline/period/index.js.map +1 -0
- package/esm/timeline/utils/calc.d.ts +5 -0
- package/esm/timeline/utils/calc.js +15 -0
- package/esm/timeline/utils/calc.js.map +1 -0
- package/esm/timeline/utils/filter.d.ts +10 -0
- package/esm/timeline/utils/filter.js +11 -0
- package/esm/timeline/utils/filter.js.map +1 -0
- package/esm/timeline/utils/index.d.ts +1 -0
- package/esm/timeline/utils/index.js +2 -0
- package/esm/timeline/utils/index.js.map +1 -0
- package/esm/timeline/utils/period.d.ts +2 -0
- package/esm/timeline/utils/period.js +33 -0
- package/esm/timeline/utils/period.js.map +1 -0
- package/esm/timeline/utils/sort.d.ts +4 -0
- package/esm/timeline/utils/sort.js +5 -0
- package/esm/timeline/utils/sort.js.map +1 -0
- package/esm/timeline/utils/timeline.d.ts +12 -0
- package/esm/timeline/utils/timeline.js +73 -0
- package/esm/timeline/utils/timeline.js.map +1 -0
- package/esm/timeline/utils/types.external.d.ts +53 -0
- package/esm/timeline/utils/types.external.js +2 -0
- package/esm/timeline/utils/types.external.js.map +1 -0
- package/esm/timeline/utils/types.internal.d.ts +61 -0
- package/esm/timeline/utils/types.internal.js +2 -0
- package/esm/timeline/utils/types.internal.js.map +1 -0
- package/esm/timeline/zoom/ZoomButton.d.ts +19 -0
- package/esm/timeline/zoom/ZoomButton.js +43 -0
- package/esm/timeline/zoom/ZoomButton.js.map +1 -0
- package/esm/timeline/zoom/index.d.ts +11 -0
- package/esm/timeline/zoom/index.js +22 -0
- package/esm/timeline/zoom/index.js.map +1 -0
- package/esm/toggle-group/ToggleGroup.d.ts +20 -2
- package/esm/toggle-group/ToggleGroup.js +17 -2
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/toggle-group/ToggleItem.d.ts +1 -2
- package/esm/toggle-group/ToggleItem.js.map +1 -1
- package/esm/tooltip/Tooltip.d.ts +13 -0
- package/esm/tooltip/Tooltip.js +13 -0
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/BodyLong.d.ts +14 -0
- package/esm/typography/BodyLong.js +14 -0
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/BodyShort.d.ts +14 -0
- package/esm/typography/BodyShort.js +14 -0
- package/esm/typography/BodyShort.js.map +1 -1
- package/esm/typography/Detail.d.ts +14 -0
- package/esm/typography/Detail.js +14 -0
- package/esm/typography/Detail.js.map +1 -1
- package/esm/typography/ErrorMessage.d.ts +14 -0
- package/esm/typography/ErrorMessage.js +14 -0
- package/esm/typography/ErrorMessage.js.map +1 -1
- package/esm/typography/Heading.d.ts +14 -0
- package/esm/typography/Heading.js +14 -0
- package/esm/typography/Heading.js.map +1 -1
- package/esm/typography/Ingress.d.ts +14 -0
- package/esm/typography/Ingress.js +14 -0
- package/esm/typography/Ingress.js.map +1 -1
- package/esm/typography/Label.d.ts +14 -0
- package/esm/typography/Label.js +14 -0
- package/esm/typography/Label.js.map +1 -1
- package/package.json +2 -2
- package/src/accordion/Accordion.tsx +49 -7
- package/src/accordion/AccordionContent.tsx +1 -5
- package/src/accordion/AccordionHeader.tsx +1 -5
- package/src/accordion/AccordionItem.tsx +1 -5
- package/src/accordion/accordion.stories.tsx +4 -2
- package/src/alert/Alert.tsx +9 -0
- package/src/button/Button.tsx +10 -0
- package/src/chat/Bubble.tsx +1 -5
- package/src/chat/Chat.tsx +23 -2
- package/src/chips/Chips.tsx +42 -4
- package/src/chips/Removable.tsx +1 -4
- package/src/chips/Toggle.tsx +47 -11
- package/src/chips/chips.stories.tsx +73 -20
- package/src/copybutton/CopyButton.tsx +11 -0
- package/src/date/DateInput.tsx +105 -115
- package/src/date/datepicker/DatePicker.tsx +40 -2
- package/src/date/datepicker/datepicker.stories.tsx +19 -21
- package/src/date/datepicker/datepicker.test.tsx +5 -5
- package/src/date/hooks/index.ts +3 -3
- package/src/date/hooks/useDatepicker.tsx +13 -0
- package/src/date/hooks/useMonthPicker.tsx +13 -0
- package/src/date/hooks/useRangeDatepicker.test.tsx +6 -6
- package/src/date/hooks/useRangeDatepicker.tsx +13 -1
- package/src/date/index.ts +5 -5
- package/src/date/monthpicker/MonthPicker.tsx +36 -4
- package/src/date/monthpicker/monthpicker.stories.tsx +5 -5
- package/src/date/utils/__tests__/get-dates.test.ts +0 -1
- package/src/dropdown/Dropdown.tsx +119 -0
- package/src/dropdown/Menu/Divider.tsx +15 -0
- package/src/dropdown/Menu/GroupedList/Heading.tsx +28 -0
- package/src/dropdown/Menu/GroupedList/Item.tsx +41 -0
- package/src/dropdown/Menu/GroupedList/index.tsx +43 -0
- package/src/dropdown/Menu/List/Item.tsx +38 -0
- package/src/dropdown/Menu/List/index.tsx +32 -0
- package/src/dropdown/Menu/index.tsx +96 -0
- package/src/dropdown/Toggle.tsx +48 -0
- package/src/dropdown/dropdown.stories.tsx +91 -0
- package/src/dropdown/index.ts +2 -0
- package/src/expansion-card/ExpansionCard.tsx +46 -8
- package/src/expansion-card/ExpansionCardContent.tsx +25 -28
- package/src/expansion-card/ExpansionCardDescription.tsx +22 -24
- package/src/expansion-card/ExpansionCardHeader.tsx +31 -34
- package/src/expansion-card/ExpansionCardTitle.tsx +3 -5
- package/src/form/ConfirmationPanel.tsx +18 -0
- package/src/form/Select.tsx +16 -0
- package/src/form/Switch.tsx +11 -0
- package/src/form/TextField.tsx +11 -0
- package/src/form/Textarea.tsx +11 -0
- package/src/form/checkbox/CheckboxGroup.tsx +15 -0
- package/src/form/error-summary/ErrorSummary.tsx +18 -0
- package/src/form/radio/RadioGroup.tsx +10 -0
- package/src/form/search/Search.tsx +13 -0
- package/src/guide-panel/GuidePanel.tsx +15 -0
- package/src/help-text/HelpText.tsx +13 -0
- package/src/index.ts +4 -0
- package/src/internal-header/InternalHeader.tsx +93 -0
- package/src/internal-header/InternalHeaderButton.tsx +23 -0
- package/src/internal-header/InternalHeaderTitle.tsx +27 -0
- package/src/internal-header/InternalHeaderUser.tsx +35 -0
- package/src/internal-header/InternalHeaderUserButton.tsx +40 -0
- package/src/internal-header/header.stories.tsx +225 -0
- package/src/internal-header/index.ts +8 -0
- package/src/link/Link.tsx +13 -0
- package/src/link-panel/LinkPanel.tsx +30 -4
- package/src/link-panel/LinkPanelDescription.tsx +12 -15
- package/src/link-panel/LinkPanelTitle.tsx +15 -18
- package/src/list/List.tsx +7 -2
- package/src/list/ListItem.tsx +1 -6
- package/src/loader/Loader.tsx +11 -0
- package/src/modal/Modal.tsx +27 -0
- package/src/pagination/Pagination.tsx +17 -0
- package/src/panel/Panel.tsx +19 -0
- package/src/popover/Popover.tsx +20 -0
- package/src/provider/Provider.tsx +13 -0
- package/src/read-more/ReadMore.tsx +17 -0
- package/src/skeleton/Skeleton.tsx +48 -0
- package/src/skeleton/index.ts +2 -0
- package/src/skeleton/skeleton.stories.tsx +118 -0
- package/src/stepper/Step.tsx +57 -60
- package/src/stepper/Stepper.tsx +31 -2
- package/src/table/Table.tsx +32 -0
- package/src/tabs/Tab.tsx +38 -39
- package/src/tabs/TabList.tsx +1 -5
- package/src/tabs/TabPanel.tsx +1 -5
- package/src/tabs/Tabs.tsx +48 -7
- package/src/tag/Tag.tsx +11 -0
- package/src/timeline/AxisLabels.tsx +143 -0
- package/src/timeline/Pin.tsx +169 -0
- package/src/timeline/Timeline.tsx +237 -0
- package/src/timeline/TimelineRow.tsx +122 -0
- package/src/timeline/hooks/usePeriodContext.tsx +22 -0
- package/src/timeline/hooks/useRowContext.tsx +26 -0
- package/src/timeline/hooks/useTimelineContext.tsx +37 -0
- package/src/timeline/hooks/useTimelineRows.ts +161 -0
- package/src/timeline/index.ts +6 -0
- package/src/timeline/period/ClickablePeriod.tsx +193 -0
- package/src/timeline/period/NonClickablePeriod.tsx +46 -0
- package/src/timeline/period/index.tsx +130 -0
- package/src/timeline/timeline.stories.tsx +444 -0
- package/src/timeline/utils/calc.ts +26 -0
- package/src/timeline/utils/filter.ts +32 -0
- package/src/timeline/utils/index.ts +6 -0
- package/src/timeline/utils/period.ts +48 -0
- package/src/timeline/utils/sort.ts +11 -0
- package/src/timeline/utils/timeline.ts +83 -0
- package/src/timeline/utils/types.external.ts +67 -0
- package/src/timeline/utils/types.internal.ts +76 -0
- package/src/timeline/zoom/ZoomButton.tsx +83 -0
- package/src/timeline/zoom/index.tsx +30 -0
- package/src/toggle-group/ToggleGroup.tsx +23 -3
- package/src/toggle-group/ToggleItem.tsx +1 -5
- package/src/tooltip/Tooltip.tsx +13 -0
- package/src/typography/BodyLong.tsx +14 -0
- package/src/typography/BodyShort.tsx +14 -0
- package/src/typography/Detail.tsx +14 -0
- package/src/typography/ErrorMessage.tsx +14 -0
- package/src/typography/Heading.tsx +14 -0
- package/src/typography/Ingress.tsx +14 -0
- package/src/typography/Label.tsx +14 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { DateInputProps } from "../DateInput";
|
|
3
3
|
import { Matcher } from "../utils";
|
|
4
4
|
import { MonthPickerStandaloneType } from "./MonthPickerStandalone";
|
|
5
5
|
export interface MonthPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -80,13 +80,43 @@ export interface MonthPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
80
80
|
}
|
|
81
81
|
interface MonthPickerComponent extends React.ForwardRefExoticComponent<MonthPickerProps> {
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```jsx
|
|
85
|
+
* <MonthPicker.Standalone
|
|
86
|
+
* dropdownCaption
|
|
87
|
+
* fromDate={new Date("1 Oct 2020")}
|
|
88
|
+
* toDate={new Date("1 Oct 2024")}
|
|
89
|
+
* />
|
|
90
|
+
* ```
|
|
84
91
|
*/
|
|
85
92
|
Standalone: MonthPickerStandaloneType;
|
|
86
93
|
/**
|
|
87
|
-
*
|
|
94
|
+
* Custom TextField for MonthPicker
|
|
95
|
+
* @see 🏷️ {@link DateInputProps}
|
|
88
96
|
*/
|
|
89
|
-
Input:
|
|
97
|
+
Input: React.ForwardRefExoticComponent<DateInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
90
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* A component that displays a month picker.
|
|
101
|
+
*
|
|
102
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/monthpicker)
|
|
103
|
+
* @see 🏷️ {@link MonthPickerProps}
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```jsx
|
|
107
|
+
* const { inputProps, monthpickerProps } = useMonthpicker({
|
|
108
|
+
* onMonthChange: console.log,
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* return (
|
|
112
|
+
* <MonthPicker {...monthpickerProps} dropdownCaption>
|
|
113
|
+
* <MonthPicker.Input
|
|
114
|
+
* {...inputProps}
|
|
115
|
+
* label="Velg måned"
|
|
116
|
+
* />
|
|
117
|
+
* </MonthPicker>
|
|
118
|
+
* );
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
91
121
|
export declare const MonthPicker: MonthPickerComponent;
|
|
92
122
|
export default MonthPicker;
|
|
@@ -8,6 +8,28 @@ import { getLocaleFromString } from "../utils";
|
|
|
8
8
|
import MonthCaption from "./MonthCaption";
|
|
9
9
|
import MonthPickerStandalone from "./MonthPickerStandalone";
|
|
10
10
|
import MonthSelector from "./MonthSelector";
|
|
11
|
+
/**
|
|
12
|
+
* A component that displays a month picker.
|
|
13
|
+
*
|
|
14
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/monthpicker)
|
|
15
|
+
* @see 🏷️ {@link MonthPickerProps}
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```jsx
|
|
19
|
+
* const { inputProps, monthpickerProps } = useMonthpicker({
|
|
20
|
+
* onMonthChange: console.log,
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* return (
|
|
24
|
+
* <MonthPicker {...monthpickerProps} dropdownCaption>
|
|
25
|
+
* <MonthPicker.Input
|
|
26
|
+
* {...inputProps}
|
|
27
|
+
* label="Velg måned"
|
|
28
|
+
* />
|
|
29
|
+
* </MonthPicker>
|
|
30
|
+
* );
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
11
33
|
export const MonthPicker = forwardRef(({ children, dropdownCaption = false, fromDate, toDate, disabled = [], selected, open: _open, id, onClose, onOpenToggle, locale = "nb", onMonthSelect, className, wrapperClassName, defaultSelected, year, onYearChange, strategy = "absolute", }, ref) => {
|
|
12
34
|
const ariaId = useId(id);
|
|
13
35
|
const [open, setOpen] = useState(_open !== null && _open !== void 0 ? _open : false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthPicker.js","sourceRoot":"","sources":["../../../src/date/monthpicker/MonthPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,MAAM,CAAC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|
3
|
+
import { MenuType } from "./Menu";
|
|
4
|
+
export interface DropdownProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Handler called when an item is selected.
|
|
8
|
+
*/
|
|
9
|
+
onSelect?: (element: React.MouseEvent) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the Menu closes when a selection is made.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
closeOnSelect?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Controlled state of the dropdown. When set, you will need to handle onClose and onSelect manually.
|
|
21
|
+
*/
|
|
22
|
+
open?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface DropdownType extends React.FC<DropdownProps> {
|
|
25
|
+
/**
|
|
26
|
+
* @see 🏷️ {@link ToggleProps}
|
|
27
|
+
*/
|
|
28
|
+
Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
29
|
+
/**
|
|
30
|
+
* @see 🏷️ {@link MenuType}
|
|
31
|
+
*/
|
|
32
|
+
Menu: MenuType;
|
|
33
|
+
}
|
|
34
|
+
export interface DropdownContextType {
|
|
35
|
+
readonly isOpen: boolean;
|
|
36
|
+
handleToggle: (v: boolean) => void;
|
|
37
|
+
readonly anchorEl: Element | null;
|
|
38
|
+
setAnchorEl: React.Dispatch<React.SetStateAction<Element | null>>;
|
|
39
|
+
onSelect: (element: React.MouseEvent) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare const DropdownContext: React.Context<DropdownContextType | null>;
|
|
42
|
+
/**
|
|
43
|
+
* A component that displays a dropdown menu when the user clicks on its toggle button.
|
|
44
|
+
*
|
|
45
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/dropdown)
|
|
46
|
+
* @see 🏷️ {@link DropdownProps}
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```jsx
|
|
50
|
+
* <Dropdown>
|
|
51
|
+
* <Button as={Dropdown.Toggle}>Toggle</Button>
|
|
52
|
+
* <Dropdown.Menu>
|
|
53
|
+
* <Dropdown.Menu.GroupedList>
|
|
54
|
+
* <Dropdown.Menu.GroupedList.Heading>
|
|
55
|
+
* Systemer og oppslagsverk
|
|
56
|
+
* </Dropdown.Menu.GroupedList.Heading>
|
|
57
|
+
* <Dropdown.Menu.GroupedList.Item>
|
|
58
|
+
* Gosys
|
|
59
|
+
* </Dropdown.Menu.GroupedList.Item>
|
|
60
|
+
* <Dropdown.Menu.GroupedList.Item>
|
|
61
|
+
* Infotrygd
|
|
62
|
+
* </Dropdown.Menu.GroupedList.Item>
|
|
63
|
+
* </Dropdown.Menu.GroupedList>
|
|
64
|
+
* <Dropdown.Menu.Divider />
|
|
65
|
+
* <Dropdown.Menu.List>
|
|
66
|
+
* <Dropdown.Menu.List.Item>Gosys</Dropdown.Menu.List.Item>
|
|
67
|
+
* <Dropdown.Menu.List.Item>Infotrygd</Dropdown.Menu.List.Item>
|
|
68
|
+
* </Dropdown.Menu.List>
|
|
69
|
+
* </Dropdown.Menu>
|
|
70
|
+
* </Dropdown>
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare const Dropdown: DropdownType;
|
|
74
|
+
export default Dropdown;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { createContext, useState } from "react";
|
|
2
|
+
import Toggle from "./Toggle";
|
|
3
|
+
import Menu from "./Menu";
|
|
4
|
+
export const DropdownContext = createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* A component that displays a dropdown menu when the user clicks on its toggle button.
|
|
7
|
+
*
|
|
8
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/dropdown)
|
|
9
|
+
* @see 🏷️ {@link DropdownProps}
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```jsx
|
|
13
|
+
* <Dropdown>
|
|
14
|
+
* <Button as={Dropdown.Toggle}>Toggle</Button>
|
|
15
|
+
* <Dropdown.Menu>
|
|
16
|
+
* <Dropdown.Menu.GroupedList>
|
|
17
|
+
* <Dropdown.Menu.GroupedList.Heading>
|
|
18
|
+
* Systemer og oppslagsverk
|
|
19
|
+
* </Dropdown.Menu.GroupedList.Heading>
|
|
20
|
+
* <Dropdown.Menu.GroupedList.Item>
|
|
21
|
+
* Gosys
|
|
22
|
+
* </Dropdown.Menu.GroupedList.Item>
|
|
23
|
+
* <Dropdown.Menu.GroupedList.Item>
|
|
24
|
+
* Infotrygd
|
|
25
|
+
* </Dropdown.Menu.GroupedList.Item>
|
|
26
|
+
* </Dropdown.Menu.GroupedList>
|
|
27
|
+
* <Dropdown.Menu.Divider />
|
|
28
|
+
* <Dropdown.Menu.List>
|
|
29
|
+
* <Dropdown.Menu.List.Item>Gosys</Dropdown.Menu.List.Item>
|
|
30
|
+
* <Dropdown.Menu.List.Item>Infotrygd</Dropdown.Menu.List.Item>
|
|
31
|
+
* </Dropdown.Menu.List>
|
|
32
|
+
* </Dropdown.Menu>
|
|
33
|
+
* </Dropdown>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export const Dropdown = (({ children, onSelect, closeOnSelect = true, defaultOpen = false, open, }) => {
|
|
37
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
38
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
39
|
+
const handleToggle = (v) => {
|
|
40
|
+
if (open === undefined) {
|
|
41
|
+
setIsOpen(v);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return (React.createElement(DropdownContext.Provider, { value: {
|
|
45
|
+
isOpen: open !== null && open !== void 0 ? open : isOpen,
|
|
46
|
+
handleToggle,
|
|
47
|
+
anchorEl,
|
|
48
|
+
setAnchorEl,
|
|
49
|
+
onSelect: (event) => {
|
|
50
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event);
|
|
51
|
+
if (closeOnSelect) {
|
|
52
|
+
open === undefined && setIsOpen(false);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
} }, children));
|
|
56
|
+
});
|
|
57
|
+
Dropdown.Toggle = Toggle;
|
|
58
|
+
Dropdown.Menu = Menu;
|
|
59
|
+
export default Dropdown;
|
|
60
|
+
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../src/dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,MAAuB,MAAM,UAAU,CAAC;AAC/C,OAAO,IAAkB,MAAM,QAAQ,CAAC;AA4CxC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAA6B,IAAI,CAAC,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,EACxB,QAAQ,EACR,QAAQ,EACR,aAAa,GAAG,IAAI,EACpB,WAAW,GAAG,KAAK,EACnB,IAAI,GACL,EAAE,EAAE;IACH,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,WAAW,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAC;IAE/D,MAAM,YAAY,GAAG,CAAC,CAAU,EAAE,EAAE;QAClC,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,SAAS,CAAC,CAAC,CAAC,CAAC;SACd;IACH,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,eAAe,CAAC,QAAQ,IACvB,KAAK,EAAE;YACL,MAAM,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,MAAM;YACtB,YAAY;YACZ,QAAQ;YACR,WAAW;YACX,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBAClB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,KAAK,CAAC,CAAC;gBAClB,IAAI,aAAa,EAAE;oBACjB,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;iBACxC;YACH,CAAC;SACF,IAEA,QAAQ,CACgB,CAC5B,CAAC;AACJ,CAAC,CAAiB,CAAC;AAEnB,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;AACzB,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;AAErB,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
export const Divider = forwardRef((_a, ref) => {
|
|
15
|
+
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
16
|
+
return (React.createElement("hr", Object.assign({}, rest, { ref: ref, className: cl("navds-dropdown__divider", className) })));
|
|
17
|
+
});
|
|
18
|
+
export default Divider;
|
|
19
|
+
//# sourceMappingURL=Divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.js","sourceRoot":"","sources":["../../../src/dropdown/Menu/Divider.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,MAAM,CAAC;AAEtB,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAG/B,CAAC,EAAsB,EAAE,GAAG,EAAE,EAAE;QAA/B,EAAE,SAAS,OAAW,EAAN,IAAI,cAApB,aAAsB,CAAF;IAAY,OAAA,CACjC,4CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,IACnD,CACH,CAAA;CAAA,CAAC,CAAC;AAEH,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface GroupedHeadingProps extends React.HTMLAttributes<HTMLDetailsElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Heading
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const GroupedHeading: React.ForwardRefExoticComponent<GroupedHeadingProps & React.RefAttributes<HTMLDetailsElement>>;
|
|
9
|
+
export default GroupedHeading;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
export const GroupedHeading = forwardRef((_a, ref) => {
|
|
15
|
+
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
16
|
+
return (React.createElement("dt", Object.assign({}, rest, { ref: ref, className: cl("navds-dropdown__list-heading", "navds-heading", "navds-heading--xsmall", className) })));
|
|
17
|
+
});
|
|
18
|
+
export default GroupedHeading;
|
|
19
|
+
//# sourceMappingURL=Heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/GroupedList/Heading.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,MAAM,CAAC;AAUtB,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAGtC,CAAC,EAAsB,EAAE,GAAG,EAAE,EAAE;QAA/B,EAAE,SAAS,OAAW,EAAN,IAAI,cAApB,aAAsB,CAAF;IAAY,OAAA,CACjC,4CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,8BAA8B,EAC9B,eAAe,EACf,uBAAuB,EACvB,SAAS,CACV,IACD,CACH,CAAA;CAAA,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OverridableComponent } from "../../../util/OverridableComponent";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export interface GroupedItemProps extends React.ButtonHTMLAttributes<HTMLElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Menu item content
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const GroupedItem: OverridableComponent<GroupedItemProps, HTMLButtonElement>;
|
|
10
|
+
export default GroupedItem;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import cl from "clsx";
|
|
13
|
+
import React, { forwardRef, useContext } from "react";
|
|
14
|
+
import { DropdownContext } from "../../Dropdown";
|
|
15
|
+
export const GroupedItem = forwardRef((_a, ref) => {
|
|
16
|
+
var { as: Component = "button", className } = _a, rest = __rest(_a, ["as", "className"]);
|
|
17
|
+
const context = useContext(DropdownContext);
|
|
18
|
+
return (React.createElement("dd", { className: "navds-dropdown__list-item" },
|
|
19
|
+
React.createElement(Component, Object.assign({}, rest, { value: rest.children, onClick: (event) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
(_a = context === null || context === void 0 ? void 0 : context.onSelect) === null || _a === void 0 ? void 0 : _a.call(context, event);
|
|
22
|
+
(_b = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _b === void 0 ? void 0 : _b.call(rest, event);
|
|
23
|
+
}, ref: ref, className: cl("navds-dropdown__item", "navds-body-short", "navds-body-short--small", className) }))));
|
|
24
|
+
});
|
|
25
|
+
export default GroupedItem;
|
|
26
|
+
//# sourceMappingURL=Item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/GroupedList/Item.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAUjD,MAAM,CAAC,MAAM,WAAW,GAGpB,UAAU,CAAC,CAAC,EAAgD,EAAE,GAAG,EAAE,EAAE;QAAzD,EAAE,EAAE,EAAE,SAAS,GAAG,QAAQ,EAAE,SAAS,OAAW,EAAN,IAAI,cAA9C,mBAAgD,CAAF;IAC5D,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5C,OAAO,CACL,4BAAI,SAAS,EAAC,2BAA2B;QACvC,oBAAC,SAAS,oBACJ,IAAI,IACR,KAAK,EAAE,IAAI,CAAC,QAAQ,EACpB,OAAO,EAAE,CAAC,KAAgD,EAAE,EAAE;;gBAC5D,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,wDAAG,KAAK,CAAC,CAAC;gBAC3B,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,qDAAG,KAAK,CAAC,CAAC;YACzB,CAAC,EACD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,CACV,IACD,CACC,CACN,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OverridableComponent } from "../../../util/OverridableComponent";
|
|
3
|
+
import { GroupedHeadingProps } from "./Heading";
|
|
4
|
+
import { GroupedItemProps } from "./Item";
|
|
5
|
+
export interface GroupedListProps extends React.HTMLAttributes<HTMLDListElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Menu list content
|
|
8
|
+
*/
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface GroupedListType extends React.ForwardRefExoticComponent<GroupedListProps & React.RefAttributes<HTMLDListElement>> {
|
|
12
|
+
/**
|
|
13
|
+
* @see 🏷️ {@link GroupedHeadingProps}
|
|
14
|
+
*/
|
|
15
|
+
Heading: React.ForwardRefExoticComponent<GroupedHeadingProps & React.RefAttributes<HTMLDetailsElement>>;
|
|
16
|
+
/**
|
|
17
|
+
* @see 🏷️ {@link GroupedItemProps}
|
|
18
|
+
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
|
19
|
+
*/
|
|
20
|
+
Item: OverridableComponent<GroupedItemProps, HTMLButtonElement>;
|
|
21
|
+
}
|
|
22
|
+
export declare const DescriptionList: GroupedListType;
|
|
23
|
+
export default DescriptionList;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import cl from "clsx";
|
|
13
|
+
import React, { forwardRef } from "react";
|
|
14
|
+
import GroupedHeading from "./Heading";
|
|
15
|
+
import GroupedItem from "./Item";
|
|
16
|
+
export const DescriptionList = forwardRef((_a, ref) => {
|
|
17
|
+
var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
|
|
18
|
+
return (React.createElement("dl", Object.assign({}, rest, { ref: ref, className: cl("navds-dropdown__list", className) }), children));
|
|
19
|
+
});
|
|
20
|
+
DescriptionList.Heading = GroupedHeading;
|
|
21
|
+
DescriptionList.Item = GroupedItem;
|
|
22
|
+
export default DescriptionList;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/GroupedList/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,cAAuC,MAAM,WAAW,CAAC;AAChE,OAAO,WAAiC,MAAM,QAAQ,CAAC;AA2BvD,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CACvC,CAAC,EAAgC,EAAE,GAAG,EAAE,EAAE;QAAzC,EAAE,SAAS,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAAY,OAAA,CACzC,4CAAQ,IAAI,IAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KACrE,QAAQ,CACN,CACN,CAAA;CAAA,CACiB,CAAC;AAErB,eAAe,CAAC,OAAO,GAAG,cAAc,CAAC;AACzC,eAAe,CAAC,IAAI,GAAG,WAAW,CAAC;AAEnC,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OverridableComponent } from "../../../util/OverridableComponent";
|
|
3
|
+
export interface ListItemProps extends React.ButtonHTMLAttributes<HTMLElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Menu item content
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const ListItem: OverridableComponent<ListItemProps, HTMLButtonElement>;
|
|
10
|
+
export default ListItem;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef, useContext } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import { DropdownContext } from "../../Dropdown";
|
|
15
|
+
export const ListItem = forwardRef((_a, ref) => {
|
|
16
|
+
var { as: Component = "button", className } = _a, rest = __rest(_a, ["as", "className"]);
|
|
17
|
+
const context = useContext(DropdownContext);
|
|
18
|
+
return (React.createElement("li", { className: "navds-dropdown__list-item" },
|
|
19
|
+
React.createElement(Component, Object.assign({}, rest, { value: rest.children, onClick: (event) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
(_a = context === null || context === void 0 ? void 0 : context.onSelect) === null || _a === void 0 ? void 0 : _a.call(context, event);
|
|
22
|
+
(_b = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _b === void 0 ? void 0 : _b.call(rest, event);
|
|
23
|
+
}, ref: ref, className: cl("navds-dropdown__item", "navds-body-short", "navds-body-short--small", className) }))));
|
|
24
|
+
});
|
|
25
|
+
export default ListItem;
|
|
26
|
+
//# sourceMappingURL=Item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/List/Item.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,MAAM,MAAM,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AASjD,MAAM,CAAC,MAAM,QAAQ,GACnB,UAAU,CAAC,CAAC,EAAgD,EAAE,GAAG,EAAE,EAAE;QAAzD,EAAE,EAAE,EAAE,SAAS,GAAG,QAAQ,EAAE,SAAS,OAAW,EAAN,IAAI,cAA9C,mBAAgD,CAAF;IACxD,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5C,OAAO,CACL,4BAAI,SAAS,EAAC,2BAA2B;QACvC,oBAAC,SAAS,oBACJ,IAAI,IACR,KAAK,EAAE,IAAI,CAAC,QAAQ,EACpB,OAAO,EAAE,CAAC,KAAgD,EAAE,EAAE;;gBAC5D,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,wDAAG,KAAK,CAAC,CAAC;gBAC3B,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,qDAAG,KAAK,CAAC,CAAC;YACzB,CAAC,EACD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,CACV,IACD,CACC,CACN,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OverridableComponent } from "../../../util/OverridableComponent";
|
|
3
|
+
import { ListItemProps } from "./Item";
|
|
4
|
+
export interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Menu list content
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface ListType extends React.ForwardRefExoticComponent<ListProps & React.RefAttributes<HTMLUListElement>> {
|
|
11
|
+
/**
|
|
12
|
+
* @see 🏷️ {@link ListItemProps}
|
|
13
|
+
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
|
14
|
+
*/
|
|
15
|
+
Item: OverridableComponent<ListItemProps, HTMLButtonElement>;
|
|
16
|
+
}
|
|
17
|
+
export declare const List: ListType;
|
|
18
|
+
export default List;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import cl from "clsx";
|
|
13
|
+
import React, { forwardRef } from "react";
|
|
14
|
+
import ListItem from "./Item";
|
|
15
|
+
export const List = forwardRef((_a, ref) => {
|
|
16
|
+
var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
|
|
17
|
+
return (React.createElement("ul", Object.assign({}, rest, { ref: ref, className: cl("navds-dropdown__list", className) }), children));
|
|
18
|
+
});
|
|
19
|
+
List.Item = ListItem;
|
|
20
|
+
export default List;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/List/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,QAA2B,MAAM,QAAQ,CAAC;AAoBjD,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,EAAgC,EAAE,GAAG,EAAE,EAAE;QAAzC,EAAE,SAAS,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAAY,OAAA,CACxE,4CAAQ,IAAI,IAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KACrE,QAAQ,CACN,CACN,CAAA;CAAA,CAAa,CAAC;AAEf,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;AAErB,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { GroupedListType } from "./GroupedList";
|
|
3
|
+
import { ListType } from "./List";
|
|
4
|
+
interface MenuProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Dropdown content
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* onClose callback
|
|
11
|
+
*/
|
|
12
|
+
onClose?: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Popover positionion strategy
|
|
15
|
+
* @default "absolute"
|
|
16
|
+
*/
|
|
17
|
+
strategy?: "fixed" | "absolute";
|
|
18
|
+
placement?: "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end";
|
|
19
|
+
}
|
|
20
|
+
export interface MenuType<Props = MenuProps> extends React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>> {
|
|
21
|
+
/**
|
|
22
|
+
* @see 🏷️ {@link ListType}
|
|
23
|
+
*/
|
|
24
|
+
List: ListType;
|
|
25
|
+
/**
|
|
26
|
+
* @see 🏷️ {@link GroupedListType}
|
|
27
|
+
*/
|
|
28
|
+
GroupedList: GroupedListType;
|
|
29
|
+
/**
|
|
30
|
+
* @see 🏷️ {@link React.HTMLAttributes<HTMLHRElement>}
|
|
31
|
+
*/
|
|
32
|
+
Divider: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHRElement> & React.RefAttributes<HTMLHRElement>>;
|
|
33
|
+
}
|
|
34
|
+
export declare const Menu: MenuType<MenuProps>;
|
|
35
|
+
export default Menu;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import cl from "clsx";
|
|
13
|
+
import React, { forwardRef, useContext } from "react";
|
|
14
|
+
import { Popover } from "../../popover";
|
|
15
|
+
import { DropdownContext } from "../Dropdown";
|
|
16
|
+
import Divider from "./Divider";
|
|
17
|
+
import GroupedList from "./GroupedList";
|
|
18
|
+
import List from "./List";
|
|
19
|
+
export const Menu = forwardRef((_a, ref) => {
|
|
20
|
+
var { className, onClose, placement = "bottom-end" } = _a, rest = __rest(_a, ["className", "onClose", "placement"]);
|
|
21
|
+
const context = useContext(DropdownContext);
|
|
22
|
+
if (!context) {
|
|
23
|
+
console.warn("Dropdown.Menu has to be wrapped in <Dropdown />");
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const { isOpen, anchorEl, handleToggle } = context;
|
|
27
|
+
return (React.createElement(Popover, Object.assign({}, rest, { placement: placement, ref: ref, arrow: false, className: cl("navds-dropdown__menu", className), offset: -4, anchorEl: anchorEl, open: isOpen, onClose: () => {
|
|
28
|
+
handleToggle(false);
|
|
29
|
+
onClose && onClose();
|
|
30
|
+
} })));
|
|
31
|
+
});
|
|
32
|
+
Menu.List = List;
|
|
33
|
+
Menu.GroupedList = GroupedList;
|
|
34
|
+
Menu.Divider = Divider;
|
|
35
|
+
export default Menu;
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drop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IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAEvB,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Button content
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export default Toggle;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef, useContext } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import { DropdownContext } from ".";
|
|
15
|
+
export const Toggle = forwardRef((_a, ref) => {
|
|
16
|
+
var { className, onClick } = _a, rest = __rest(_a, ["className", "onClick"]);
|
|
17
|
+
const context = useContext(DropdownContext);
|
|
18
|
+
if (!context) {
|
|
19
|
+
console.warn("Dropdown.Toggle has to be wrapped in <Dropdown />");
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const { setAnchorEl, handleToggle, isOpen } = context;
|
|
23
|
+
return (React.createElement("button", Object.assign({}, rest, { ref: (el) => {
|
|
24
|
+
setAnchorEl(el);
|
|
25
|
+
if (typeof ref === "function") {
|
|
26
|
+
ref(el);
|
|
27
|
+
}
|
|
28
|
+
else if (ref != null) {
|
|
29
|
+
ref.current = el;
|
|
30
|
+
}
|
|
31
|
+
}, onClick: (e) => {
|
|
32
|
+
setAnchorEl(e.currentTarget);
|
|
33
|
+
handleToggle(!isOpen);
|
|
34
|
+
onClick && onClick(e);
|
|
35
|
+
}, "aria-expanded": isOpen, className: cl("navds-dropdown__toggle", className) })));
|
|
36
|
+
});
|
|
37
|
+
export default Toggle;
|
|
38
|
+
//# sourceMappingURL=Toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.js","sourceRoot":"","sources":["../../src/dropdown/Toggle.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAUpC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,EAA+B,EAAE,GAAG,EAAE,EAAE;QAAxC,EAAE,SAAS,EAAE,OAAO,OAAW,EAAN,IAAI,cAA7B,wBAA+B,CAAF;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;KACb;IAED,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEtD,OAAO,CACL,gDACM,IAAI,IACR,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;YACV,WAAW,CAAC,EAAE,CAAC,CAAC;YAEhB,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;gBAC7B,GAAG,CAAC,EAAE,C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