@navikt/ds-react 6.7.1 → 6.9.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/cjs/chat/Bubble.d.ts +4 -4
- package/cjs/chat/Chat.d.ts +6 -4
- package/cjs/chat/Chat.js +1 -1
- package/cjs/chat/Chat.js.map +1 -1
- package/cjs/collapsible/parts/Collapsible.Trigger.d.ts +4 -0
- package/cjs/collapsible/parts/Collapsible.Trigger.js +1 -1
- package/cjs/collapsible/parts/Collapsible.Trigger.js.map +1 -1
- package/cjs/date/monthpicker/MonthButton.js +2 -2
- package/cjs/date/monthpicker/MonthButton.js.map +1 -1
- package/cjs/date/utils/check-dates.d.ts +1 -1
- package/cjs/date/utils/check-dates.js +1 -1
- package/cjs/date/utils/check-dates.js.map +1 -1
- package/cjs/date/utils/dates-disabled.js +1 -1
- package/cjs/date/utils/dates-disabled.js.map +1 -1
- package/cjs/date/utils/navigation.d.ts +1 -1
- package/cjs/date/utils/navigation.js +1 -1
- package/cjs/date/utils/navigation.js.map +1 -1
- package/cjs/date/utils/parse-date.js +7 -11
- package/cjs/date/utils/parse-date.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +17 -4
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/useVirtualFocus.js +1 -3
- package/cjs/form/combobox/FilteredOptions/useVirtualFocus.js.map +1 -1
- package/cjs/form/combobox/combobox-utils.js +1 -3
- package/cjs/form/combobox/combobox-utils.js.map +1 -1
- package/cjs/form/file-upload/FileUpload.context.d.ts +1 -1
- package/cjs/form/file-upload/FileUpload.d.ts +1 -1
- package/cjs/form/file-upload/FileUpload.js.map +1 -1
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js +1 -1
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/cjs/form/file-upload/parts/dropzone/dropzone.types.d.ts +1 -1
- package/cjs/form/file-upload/parts/item/Item.d.ts +1 -1
- package/cjs/form/file-upload/parts/item/Item.js +1 -1
- package/cjs/form/file-upload/parts/item/Item.js.map +1 -1
- package/cjs/form/file-upload/parts/item/ItemIcon.js +1 -1
- package/cjs/form/file-upload/parts/item/ItemIcon.js.map +1 -1
- package/cjs/form/file-upload/utils/is-accepted-file-type.js +1 -1
- package/cjs/form/file-upload/utils/is-accepted-file-type.js.map +1 -1
- package/cjs/form/form-progress/FormProgress.d.ts +66 -0
- package/cjs/form/form-progress/FormProgress.js +85 -0
- package/cjs/form/form-progress/FormProgress.js.map +1 -0
- package/cjs/form/form-progress/index.d.ts +1 -0
- package/cjs/form/form-progress/index.js +11 -0
- package/cjs/form/form-progress/index.js.map +1 -0
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/bleed/Bleed.d.ts +8 -4
- package/cjs/layout/bleed/Bleed.js.map +1 -1
- package/cjs/layout/box/Box.d.ts +16 -4
- package/cjs/layout/box/Box.js.map +1 -1
- package/cjs/layout/grid/HGrid.d.ts +7 -3
- package/cjs/layout/grid/HGrid.js.map +1 -1
- package/cjs/layout/stack/Stack.d.ts +3 -1
- package/cjs/layout/stack/Stack.js.map +1 -1
- package/cjs/layout/utilities/css.js +1 -1
- package/cjs/layout/utilities/css.js.map +1 -1
- package/cjs/list/List.d.ts +15 -3
- package/cjs/list/List.js +15 -0
- package/cjs/list/List.js.map +1 -1
- package/cjs/list/ListItem.d.ts +4 -11
- package/cjs/list/ListItem.js +3 -0
- package/cjs/list/ListItem.js.map +1 -1
- package/cjs/list/index.d.ts +2 -2
- package/cjs/list/index.js.map +1 -1
- package/cjs/list/types.d.ts +19 -5
- package/cjs/modal/Modal.js +4 -1
- package/cjs/modal/Modal.js.map +1 -1
- package/cjs/modal/dialog-polyfill.js +4 -1
- package/cjs/modal/dialog-polyfill.js.map +1 -1
- package/cjs/{overlay/dismiss → overlays/dismissablelayer}/DismissableLayer.d.ts +6 -0
- package/cjs/{overlay/dismiss → overlays/dismissablelayer}/DismissableLayer.js +36 -14
- package/cjs/overlays/dismissablelayer/DismissableLayer.js.map +1 -0
- package/{esm/overlay/dismiss → cjs/overlays/dismissablelayer}/util/dispatchCustomEvent.d.ts +1 -1
- package/cjs/overlays/dismissablelayer/util/dispatchCustomEvent.js.map +1 -0
- package/cjs/overlays/dismissablelayer/util/useEscapeKeydown.js.map +1 -0
- package/cjs/overlays/dismissablelayer/util/useFocusOutside.js.map +1 -0
- package/cjs/overlays/dismissablelayer/util/usePointerDownOutside.js.map +1 -0
- package/cjs/pagination/Pagination.js +1 -1
- package/cjs/pagination/Pagination.js.map +1 -1
- package/cjs/popover/Popover.js +1 -1
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/stepper/Step.d.ts +0 -5
- package/cjs/stepper/Step.js +8 -13
- package/cjs/stepper/Step.js.map +1 -1
- package/cjs/stepper/Stepper.d.ts +1 -1
- package/cjs/stepper/Stepper.js +13 -23
- package/cjs/stepper/Stepper.js.map +1 -1
- package/cjs/stepper/context.d.ts +6 -3
- package/cjs/stepper/context.js +9 -3
- package/cjs/stepper/context.js.map +1 -1
- package/cjs/table/AnimateHeight.js +1 -1
- package/cjs/table/AnimateHeight.js.map +1 -1
- package/cjs/tabs/parts/tablist/useScrollButtons.js +1 -1
- package/cjs/tabs/parts/tablist/useScrollButtons.js.map +1 -1
- package/cjs/timeline/AxisLabels.js +2 -4
- package/cjs/timeline/AxisLabels.js.map +1 -1
- package/cjs/util/debounce.js.map +1 -1
- package/cjs/util/hooks/descendants/utils.js +1 -3
- package/cjs/util/hooks/descendants/utils.js.map +1 -1
- package/cjs/util/i18n/get.js.map +1 -0
- package/cjs/util/i18n/i18n.context.js.map +1 -0
- package/cjs/util/i18n/i18n.types.js.map +1 -0
- package/{esm/form/file-upload → cjs/util}/i18n/locales/nb.d.ts +5 -0
- package/cjs/{form/file-upload → util}/i18n/locales/nb.js +5 -0
- package/cjs/util/i18n/locales/nb.js.map +1 -0
- package/cjs/util/i18n/merge.js.map +1 -0
- package/cjs/util/omit.js +2 -3
- package/cjs/util/omit.js.map +1 -1
- package/esm/chat/Bubble.d.ts +4 -4
- package/esm/chat/Chat.d.ts +6 -4
- package/esm/chat/Chat.js +1 -1
- package/esm/chat/Chat.js.map +1 -1
- package/esm/collapsible/parts/Collapsible.Trigger.d.ts +4 -0
- package/esm/collapsible/parts/Collapsible.Trigger.js +1 -1
- package/esm/collapsible/parts/Collapsible.Trigger.js.map +1 -1
- package/esm/date/monthpicker/MonthButton.js +2 -2
- package/esm/date/monthpicker/MonthButton.js.map +1 -1
- package/esm/date/utils/check-dates.d.ts +1 -1
- package/esm/date/utils/check-dates.js +1 -1
- package/esm/date/utils/check-dates.js.map +1 -1
- package/esm/date/utils/dates-disabled.js +1 -1
- package/esm/date/utils/dates-disabled.js.map +1 -1
- package/esm/date/utils/navigation.d.ts +1 -1
- package/esm/date/utils/navigation.js +1 -1
- package/esm/date/utils/navigation.js.map +1 -1
- package/esm/date/utils/parse-date.js +7 -11
- package/esm/date/utils/parse-date.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +17 -4
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/useVirtualFocus.js +1 -3
- package/esm/form/combobox/FilteredOptions/useVirtualFocus.js.map +1 -1
- package/esm/form/combobox/combobox-utils.js +1 -3
- package/esm/form/combobox/combobox-utils.js.map +1 -1
- package/esm/form/file-upload/FileUpload.context.d.ts +1 -1
- package/esm/form/file-upload/FileUpload.d.ts +1 -1
- package/esm/form/file-upload/FileUpload.js.map +1 -1
- package/esm/form/file-upload/parts/dropzone/Dropzone.js +1 -1
- package/esm/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/esm/form/file-upload/parts/dropzone/dropzone.types.d.ts +1 -1
- package/esm/form/file-upload/parts/item/Item.d.ts +1 -1
- package/esm/form/file-upload/parts/item/Item.js +1 -1
- package/esm/form/file-upload/parts/item/Item.js.map +1 -1
- package/esm/form/file-upload/parts/item/ItemIcon.js +1 -1
- package/esm/form/file-upload/parts/item/ItemIcon.js.map +1 -1
- package/esm/form/file-upload/utils/is-accepted-file-type.js +1 -1
- package/esm/form/file-upload/utils/is-accepted-file-type.js.map +1 -1
- package/esm/form/form-progress/FormProgress.d.ts +66 -0
- package/esm/form/form-progress/FormProgress.js +56 -0
- package/esm/form/form-progress/FormProgress.js.map +1 -0
- package/esm/form/form-progress/index.d.ts +1 -0
- package/esm/form/form-progress/index.js +3 -0
- package/esm/form/form-progress/index.js.map +1 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/layout/bleed/Bleed.d.ts +8 -4
- package/esm/layout/bleed/Bleed.js.map +1 -1
- package/esm/layout/box/Box.d.ts +16 -4
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/grid/HGrid.d.ts +7 -3
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/stack/Stack.d.ts +3 -1
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/layout/utilities/css.js +1 -1
- package/esm/layout/utilities/css.js.map +1 -1
- package/esm/list/List.d.ts +15 -3
- package/esm/list/List.js +15 -0
- package/esm/list/List.js.map +1 -1
- package/esm/list/ListItem.d.ts +4 -11
- package/esm/list/ListItem.js +3 -0
- package/esm/list/ListItem.js.map +1 -1
- package/esm/list/index.d.ts +2 -2
- package/esm/list/index.js.map +1 -1
- package/esm/list/types.d.ts +19 -5
- package/esm/modal/Modal.js +4 -1
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/dialog-polyfill.js +4 -1
- package/esm/modal/dialog-polyfill.js.map +1 -1
- package/esm/{overlay/dismiss → overlays/dismissablelayer}/DismissableLayer.d.ts +6 -0
- package/esm/{overlay/dismiss → overlays/dismissablelayer}/DismissableLayer.js +37 -15
- package/esm/overlays/dismissablelayer/DismissableLayer.js.map +1 -0
- package/{cjs/overlay/dismiss → esm/overlays/dismissablelayer}/util/dispatchCustomEvent.d.ts +1 -1
- package/esm/overlays/dismissablelayer/util/dispatchCustomEvent.js.map +1 -0
- package/esm/overlays/dismissablelayer/util/useEscapeKeydown.js.map +1 -0
- package/esm/overlays/dismissablelayer/util/useFocusOutside.js.map +1 -0
- package/esm/overlays/dismissablelayer/util/usePointerDownOutside.js.map +1 -0
- package/esm/pagination/Pagination.js +1 -1
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/popover/Popover.js +1 -1
- package/esm/popover/Popover.js.map +1 -1
- package/esm/stepper/Step.d.ts +0 -5
- package/esm/stepper/Step.js +10 -15
- package/esm/stepper/Step.js.map +1 -1
- package/esm/stepper/Stepper.d.ts +1 -1
- package/esm/stepper/Stepper.js +14 -24
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/stepper/context.d.ts +6 -3
- package/esm/stepper/context.js +7 -2
- package/esm/stepper/context.js.map +1 -1
- package/esm/table/AnimateHeight.js +1 -1
- package/esm/table/AnimateHeight.js.map +1 -1
- package/esm/tabs/parts/tablist/useScrollButtons.js +1 -1
- package/esm/tabs/parts/tablist/useScrollButtons.js.map +1 -1
- package/esm/timeline/AxisLabels.js +2 -4
- package/esm/timeline/AxisLabels.js.map +1 -1
- package/esm/util/debounce.js.map +1 -1
- package/esm/util/hooks/descendants/utils.js +1 -3
- package/esm/util/hooks/descendants/utils.js.map +1 -1
- package/esm/util/i18n/get.js.map +1 -0
- package/esm/util/i18n/i18n.context.js.map +1 -0
- package/esm/util/i18n/i18n.types.js.map +1 -0
- package/{cjs/form/file-upload → esm/util}/i18n/locales/nb.d.ts +5 -0
- package/esm/{form/file-upload → util}/i18n/locales/nb.js +5 -0
- package/esm/util/i18n/locales/nb.js.map +1 -0
- package/esm/util/i18n/merge.js.map +1 -0
- package/esm/util/omit.js +2 -3
- package/esm/util/omit.js.map +1 -1
- package/package.json +13 -3
- package/src/chat/Bubble.tsx +4 -4
- package/src/chat/Chat.tsx +6 -4
- package/src/collapsible/parts/Collapsible.Trigger.tsx +5 -1
- package/src/date/monthpicker/MonthButton.tsx +6 -2
- package/src/date/utils/check-dates.ts +2 -2
- package/src/date/utils/dates-disabled.ts +3 -1
- package/src/date/utils/navigation.ts +3 -3
- package/src/date/utils/parse-date.ts +21 -15
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +23 -24
- package/src/form/combobox/FilteredOptions/useVirtualFocus.ts +2 -2
- package/src/form/combobox/combobox-utils.ts +5 -5
- package/src/form/file-upload/FileUpload.context.tsx +1 -1
- package/src/form/file-upload/FileUpload.tsx +1 -1
- package/src/form/file-upload/parts/dropzone/Dropzone.tsx +1 -1
- package/src/form/file-upload/parts/dropzone/dropzone.types.ts +1 -1
- package/src/form/file-upload/parts/item/Item.tsx +2 -2
- package/src/form/file-upload/parts/item/ItemIcon.tsx +3 -1
- package/src/form/file-upload/utils/is-accepted-file-type.ts +4 -1
- package/src/form/form-progress/FormProgress.tsx +152 -0
- package/src/form/form-progress/index.ts +7 -0
- package/src/index.ts +2 -1
- package/src/layout/bleed/Bleed.tsx +8 -4
- package/src/layout/box/Box.tsx +16 -4
- package/src/layout/grid/HGrid.tsx +7 -3
- package/src/layout/stack/Stack.tsx +5 -1
- package/src/layout/utilities/css.ts +3 -1
- package/src/list/List.tsx +15 -3
- package/src/list/ListItem.tsx +4 -15
- package/src/list/index.ts +2 -2
- package/src/list/types.ts +20 -5
- package/src/modal/Modal.tsx +6 -1
- package/src/modal/dialog-polyfill.ts +8 -2
- package/src/{overlay/dismiss → overlays/dismissablelayer}/DismissableLayer.tsx +40 -19
- package/src/{overlay/dismiss → overlays/dismissablelayer}/util/dispatchCustomEvent.ts +1 -1
- package/src/pagination/Pagination.tsx +1 -1
- package/src/popover/Popover.tsx +1 -1
- package/src/stepper/Step.tsx +24 -38
- package/src/stepper/Stepper.tsx +30 -36
- package/src/stepper/context.ts +11 -4
- package/src/table/AnimateHeight.tsx +1 -1
- package/src/tabs/parts/tablist/useScrollButtons.ts +2 -2
- package/src/timeline/AxisLabels.tsx +5 -3
- package/src/util/__tests__/omit.test.ts +36 -0
- package/src/util/debounce.ts +1 -1
- package/src/util/hooks/descendants/utils.ts +2 -2
- package/src/{form/file-upload → util}/i18n/locales/nb.ts +5 -0
- package/src/util/omit.ts +5 -9
- package/cjs/form/file-upload/i18n/get.js.map +0 -1
- package/cjs/form/file-upload/i18n/i18n.context.js.map +0 -1
- package/cjs/form/file-upload/i18n/i18n.types.js.map +0 -1
- package/cjs/form/file-upload/i18n/locales/nb.js.map +0 -1
- package/cjs/form/file-upload/i18n/merge.js.map +0 -1
- package/cjs/overlay/dismiss/DismissableLayer.js.map +0 -1
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.js.map +0 -1
- package/cjs/overlay/dismiss/util/useEscapeKeydown.js.map +0 -1
- package/cjs/overlay/dismiss/util/useFocusOutside.js.map +0 -1
- package/cjs/overlay/dismiss/util/usePointerDownOutside.js.map +0 -1
- package/esm/form/file-upload/i18n/get.js.map +0 -1
- package/esm/form/file-upload/i18n/i18n.context.js.map +0 -1
- package/esm/form/file-upload/i18n/i18n.types.js.map +0 -1
- package/esm/form/file-upload/i18n/locales/nb.js.map +0 -1
- package/esm/form/file-upload/i18n/merge.js.map +0 -1
- package/esm/overlay/dismiss/DismissableLayer.js.map +0 -1
- package/esm/overlay/dismiss/util/dispatchCustomEvent.js.map +0 -1
- package/esm/overlay/dismiss/util/useEscapeKeydown.js.map +0 -1
- package/esm/overlay/dismiss/util/useFocusOutside.js.map +0 -1
- package/esm/overlay/dismiss/util/usePointerDownOutside.js.map +0 -1
- /package/cjs/{overlay/dismiss → overlays/dismissablelayer}/util/dispatchCustomEvent.js +0 -0
- /package/cjs/{overlay/dismiss → overlays/dismissablelayer}/util/useEscapeKeydown.d.ts +0 -0
- /package/cjs/{overlay/dismiss → overlays/dismissablelayer}/util/useEscapeKeydown.js +0 -0
- /package/cjs/{overlay/dismiss → overlays/dismissablelayer}/util/useFocusOutside.d.ts +0 -0
- /package/cjs/{overlay/dismiss → overlays/dismissablelayer}/util/useFocusOutside.js +0 -0
- /package/cjs/{overlay/dismiss → overlays/dismissablelayer}/util/usePointerDownOutside.d.ts +0 -0
- /package/cjs/{overlay/dismiss → overlays/dismissablelayer}/util/usePointerDownOutside.js +0 -0
- /package/cjs/{form/file-upload → util}/i18n/get.d.ts +0 -0
- /package/cjs/{form/file-upload → util}/i18n/get.js +0 -0
- /package/cjs/{form/file-upload → util}/i18n/i18n.context.d.ts +0 -0
- /package/cjs/{form/file-upload → util}/i18n/i18n.context.js +0 -0
- /package/cjs/{form/file-upload → util}/i18n/i18n.types.d.ts +0 -0
- /package/cjs/{form/file-upload → util}/i18n/i18n.types.js +0 -0
- /package/cjs/{form/file-upload → util}/i18n/merge.d.ts +0 -0
- /package/cjs/{form/file-upload → util}/i18n/merge.js +0 -0
- /package/esm/{overlay/dismiss → overlays/dismissablelayer}/util/dispatchCustomEvent.js +0 -0
- /package/esm/{overlay/dismiss → overlays/dismissablelayer}/util/useEscapeKeydown.d.ts +0 -0
- /package/esm/{overlay/dismiss → overlays/dismissablelayer}/util/useEscapeKeydown.js +0 -0
- /package/esm/{overlay/dismiss → overlays/dismissablelayer}/util/useFocusOutside.d.ts +0 -0
- /package/esm/{overlay/dismiss → overlays/dismissablelayer}/util/useFocusOutside.js +0 -0
- /package/esm/{overlay/dismiss → overlays/dismissablelayer}/util/usePointerDownOutside.d.ts +0 -0
- /package/esm/{overlay/dismiss → overlays/dismissablelayer}/util/usePointerDownOutside.js +0 -0
- /package/esm/{form/file-upload → util}/i18n/get.d.ts +0 -0
- /package/esm/{form/file-upload → util}/i18n/get.js +0 -0
- /package/esm/{form/file-upload → util}/i18n/i18n.context.d.ts +0 -0
- /package/esm/{form/file-upload → util}/i18n/i18n.context.js +0 -0
- /package/esm/{form/file-upload → util}/i18n/i18n.types.d.ts +0 -0
- /package/esm/{form/file-upload → util}/i18n/i18n.types.js +0 -0
- /package/esm/{form/file-upload → util}/i18n/merge.d.ts +0 -0
- /package/esm/{form/file-upload → util}/i18n/merge.js +0 -0
- /package/src/{overlay → overlays/dismissablelayer}/README.md +0 -0
- /package/src/{overlay/dismiss → overlays/dismissablelayer}/util/useEscapeKeydown.ts +0 -0
- /package/src/{overlay/dismiss → overlays/dismissablelayer}/util/useFocusOutside.ts +0 -0
- /package/src/{overlay/dismiss → overlays/dismissablelayer}/util/usePointerDownOutside.ts +0 -0
- /package/src/{form/file-upload → util}/i18n/get.ts +0 -0
- /package/src/{form/file-upload → util}/i18n/i18n.context.test.tsx +0 -0
- /package/src/{form/file-upload → util}/i18n/i18n.context.ts +0 -0
- /package/src/{form/file-upload → util}/i18n/i18n.types.ts +0 -0
- /package/src/{form/file-upload → util}/i18n/merge.ts +0 -0
|
@@ -68,9 +68,9 @@ const useVirtualFocus = (
|
|
|
68
68
|
const _currentIndex = elementsAbleToReceiveFocus.indexOf(activeElement);
|
|
69
69
|
if (_currentIndex === elementsAbleToReceiveFocus.length - 1) {
|
|
70
70
|
return;
|
|
71
|
-
} else {
|
|
72
|
-
_moveFocusAndScrollTo(elementsAbleToReceiveFocus[_currentIndex + 1]);
|
|
73
71
|
}
|
|
72
|
+
|
|
73
|
+
_moveFocusAndScrollTo(elementsAbleToReceiveFocus[_currentIndex + 1]);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const moveFocusToTop = () => _moveFocusAndScrollTo(undefined);
|
|
@@ -10,12 +10,12 @@ const isInList = (option: ComboboxOption | string, list: ComboboxOption[]) => {
|
|
|
10
10
|
return list.some(
|
|
11
11
|
(listItem) => listItem.label === option || listItem.value === option,
|
|
12
12
|
);
|
|
13
|
-
} else {
|
|
14
|
-
return list.some(
|
|
15
|
-
(listItem) =>
|
|
16
|
-
listItem.label === option.label && listItem.value === option.value,
|
|
17
|
-
);
|
|
18
13
|
}
|
|
14
|
+
|
|
15
|
+
return list.some(
|
|
16
|
+
(listItem) =>
|
|
17
|
+
listItem.label === option.label && listItem.value === option.value,
|
|
18
|
+
);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const toComboboxOption = (value: string): ComboboxOption => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from "../../util/create-context";
|
|
2
|
-
import { ComponentTranslation } from "
|
|
2
|
+
import { ComponentTranslation } from "../../util/i18n/i18n.types";
|
|
3
3
|
|
|
4
4
|
export type FileUploadLocaleContextProps = {
|
|
5
5
|
translations?: ComponentTranslation<"FileUpload">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { HTMLAttributes, forwardRef } from "react";
|
|
3
|
+
import { ComponentTranslation } from "../../util/i18n/i18n.types";
|
|
3
4
|
import { FileUploadLocaleContextProvider } from "./FileUpload.context";
|
|
4
|
-
import { ComponentTranslation } from "./i18n/i18n.types";
|
|
5
5
|
import Trigger from "./parts/Trigger";
|
|
6
6
|
import Dropzone from "./parts/dropzone/Dropzone";
|
|
7
7
|
import Item from "./parts/item/Item";
|
|
@@ -5,10 +5,10 @@ import { Button } from "../../../../button";
|
|
|
5
5
|
import { BodyShort, ErrorMessage, Label } from "../../../../typography";
|
|
6
6
|
import { composeEventHandlers } from "../../../../util/composeEventHandlers";
|
|
7
7
|
import { useId } from "../../../../util/hooks";
|
|
8
|
+
import { useI18n } from "../../../../util/i18n/i18n.context";
|
|
8
9
|
import { omit } from "../../../../util/omit";
|
|
9
10
|
import { useFormField } from "../../../useFormField";
|
|
10
11
|
import { useFileUploadTranslation } from "../../FileUpload.context";
|
|
11
|
-
import { useI18n } from "../../i18n/i18n.context";
|
|
12
12
|
import { useFileUpload } from "../../useFileUpload";
|
|
13
13
|
import { FileUploadDropzoneProps } from "./dropzone.types";
|
|
14
14
|
import { useDropzone } from "./useDropzone";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ComponentTranslation } from "../../../../util/i18n/i18n.types";
|
|
1
2
|
import { FormFieldProps } from "../../../useFormField";
|
|
2
3
|
import { FileUploadBaseProps } from "../../FileUpload.types";
|
|
3
|
-
import { ComponentTranslation } from "../../i18n/i18n.types";
|
|
4
4
|
|
|
5
5
|
export interface FileUploadDropzoneProps
|
|
6
6
|
extends FileUploadBaseProps,
|
|
@@ -3,9 +3,9 @@ import React, { MouseEvent, forwardRef } from "react";
|
|
|
3
3
|
import { ExclamationmarkTriangleIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { BodyShort } from "../../../../typography";
|
|
5
5
|
import { OverridableComponent } from "../../../../util";
|
|
6
|
+
import { useI18n } from "../../../../util/i18n/i18n.context";
|
|
7
|
+
import { ComponentTranslation } from "../../../../util/i18n/i18n.types";
|
|
6
8
|
import { useFileUploadTranslation } from "../../FileUpload.context";
|
|
7
|
-
import { useI18n } from "../../i18n/i18n.context";
|
|
8
|
-
import { ComponentTranslation } from "../../i18n/i18n.types";
|
|
9
9
|
import { FileItem } from "./Item.types";
|
|
10
10
|
import ItemButton from "./ItemButton";
|
|
11
11
|
import ItemIcon from "./ItemIcon";
|
|
@@ -15,11 +15,14 @@ export function isAcceptedFileType(
|
|
|
15
15
|
|
|
16
16
|
if (isExtensionType) {
|
|
17
17
|
return file.name.toLowerCase().endsWith(validType.toLowerCase());
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (isWildcardMimeType) {
|
|
19
21
|
const baseMimeType = mimeType.replace(/\/.*$/, "");
|
|
20
22
|
const baseValidType = validType.replace(/\/.*$/, "");
|
|
21
23
|
return baseMimeType === baseValidType;
|
|
22
24
|
}
|
|
25
|
+
|
|
23
26
|
return mimeType === validType;
|
|
24
27
|
});
|
|
25
28
|
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
3
|
+
import Button from "../../button/Button";
|
|
4
|
+
import Collapsible from "../../collapsible/Collapsible";
|
|
5
|
+
import { HStack } from "../../layout/stack";
|
|
6
|
+
import { ProgressBar } from "../../progress-bar";
|
|
7
|
+
import { Stepper, StepperStepProps } from "../../stepper";
|
|
8
|
+
import { BodyShort } from "../../typography";
|
|
9
|
+
import { useI18n } from "../../util/i18n/i18n.context";
|
|
10
|
+
import { ComponentTranslation } from "../../util/i18n/i18n.types";
|
|
11
|
+
|
|
12
|
+
export interface FormProgressProps
|
|
13
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
/**
|
|
15
|
+
* Total number of steps.
|
|
16
|
+
*/
|
|
17
|
+
totalSteps: number;
|
|
18
|
+
/**
|
|
19
|
+
* Current active step.
|
|
20
|
+
*
|
|
21
|
+
* Index starts at 1, not 0.
|
|
22
|
+
*/
|
|
23
|
+
activeStep: number;
|
|
24
|
+
/**
|
|
25
|
+
* Shows Stepper if `true`, hides if `false`.
|
|
26
|
+
* Using this prop removes automatic control of open-state.
|
|
27
|
+
*/
|
|
28
|
+
open?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Callback for current open-state
|
|
31
|
+
*/
|
|
32
|
+
onOpenChange?: (open: boolean) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Should contain <FormProgress.Step> elements.
|
|
35
|
+
*/
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Callback for next `activeStep`.
|
|
39
|
+
*
|
|
40
|
+
* Index starts at 1, not 0.
|
|
41
|
+
*/
|
|
42
|
+
onStepChange?: (step: number) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Makes Stepper non-interactive if false.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
interactiveSteps?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* i18n API for customizing texts and labels.
|
|
50
|
+
*/
|
|
51
|
+
translations?: ComponentTranslation<"FormProgress">;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type FormProgressStepProps = StepperStepProps;
|
|
55
|
+
|
|
56
|
+
interface FormProgressComponent
|
|
57
|
+
extends React.ForwardRefExoticComponent<
|
|
58
|
+
FormProgressProps & React.RefAttributes<HTMLDivElement>
|
|
59
|
+
> {
|
|
60
|
+
/**
|
|
61
|
+
* To be used inside `<FormProgress>`.
|
|
62
|
+
*/
|
|
63
|
+
Step: typeof Stepper.Step;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Component for visualizing progression in a form with multiple steps.
|
|
68
|
+
*
|
|
69
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/formprogress)
|
|
70
|
+
* @see 🏷️ {@link FormProgressProps}
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* <FormProgress activeStep={2} totalSteps={3}>
|
|
74
|
+
* <FormProgress.Step completed href="#">Children</FormProgress.Step>
|
|
75
|
+
* <FormProgress.Step href="#">Personal information</FormProgress.Step>
|
|
76
|
+
* <FormProgress.Step interactive={false}>Summary</FormProgress.Step>
|
|
77
|
+
* </FormProgress>
|
|
78
|
+
*/
|
|
79
|
+
export const FormProgress = forwardRef<HTMLDivElement, FormProgressProps>(
|
|
80
|
+
(
|
|
81
|
+
{
|
|
82
|
+
totalSteps,
|
|
83
|
+
activeStep,
|
|
84
|
+
open,
|
|
85
|
+
onOpenChange,
|
|
86
|
+
children,
|
|
87
|
+
onStepChange,
|
|
88
|
+
interactiveSteps,
|
|
89
|
+
translations,
|
|
90
|
+
...rest
|
|
91
|
+
}: FormProgressProps,
|
|
92
|
+
ref,
|
|
93
|
+
) => {
|
|
94
|
+
const translate = useI18n("FormProgress", translations);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div ref={ref} {...rest}>
|
|
98
|
+
<ProgressBar
|
|
99
|
+
aria-hidden
|
|
100
|
+
value={activeStep}
|
|
101
|
+
valueMax={totalSteps}
|
|
102
|
+
className="navds-form-progress__bar"
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
<Collapsible lazy open={open} onOpenChange={onOpenChange}>
|
|
106
|
+
<HStack justify="space-between" align="center">
|
|
107
|
+
<BodyShort as="span">
|
|
108
|
+
{translate("step", {
|
|
109
|
+
replacements: { activeStep, totalSteps },
|
|
110
|
+
})}
|
|
111
|
+
</BodyShort>
|
|
112
|
+
<Collapsible.Trigger asChild aria-expanded={undefined}>
|
|
113
|
+
<Button
|
|
114
|
+
variant="tertiary"
|
|
115
|
+
size="small"
|
|
116
|
+
className="navds-form-progress__button"
|
|
117
|
+
icon={<ChevronDownIcon aria-hidden />}
|
|
118
|
+
>
|
|
119
|
+
<span className="navds-form-progress__btn-txt-hide">
|
|
120
|
+
{translate("hideAllSteps")}
|
|
121
|
+
</span>
|
|
122
|
+
<span className="navds-form-progress__btn-txt-show">
|
|
123
|
+
{translate("showAllSteps")}
|
|
124
|
+
</span>
|
|
125
|
+
</Button>
|
|
126
|
+
</Collapsible.Trigger>
|
|
127
|
+
</HStack>
|
|
128
|
+
|
|
129
|
+
<Collapsible.Content className="navds-form-progress__collapsible">
|
|
130
|
+
<div className="navds-form-progress__collapsible-content">
|
|
131
|
+
<div className="navds-form-progress__stepper">
|
|
132
|
+
<Stepper
|
|
133
|
+
activeStep={activeStep}
|
|
134
|
+
onStepChange={onStepChange}
|
|
135
|
+
interactive={interactiveSteps}
|
|
136
|
+
>
|
|
137
|
+
{children}
|
|
138
|
+
</Stepper>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</Collapsible.Content>
|
|
142
|
+
</Collapsible>
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
) as FormProgressComponent;
|
|
147
|
+
|
|
148
|
+
FormProgress.Step = Stepper.Step;
|
|
149
|
+
|
|
150
|
+
export const FormProgressStep = Stepper.Step;
|
|
151
|
+
|
|
152
|
+
export default FormProgress;
|
package/src/index.ts
CHANGED
|
@@ -53,7 +53,7 @@ export {
|
|
|
53
53
|
type VStackProps,
|
|
54
54
|
} from "./layout/stack";
|
|
55
55
|
export { Link, type LinkProps } from "./link";
|
|
56
|
-
export { List, type ListProps } from "./list";
|
|
56
|
+
export { List, type ListProps, type ListItemProps } from "./list";
|
|
57
57
|
export { Loader, type LoaderProps } from "./loader";
|
|
58
58
|
export { Modal, type ModalProps } from "./modal";
|
|
59
59
|
export { Pagination, type PaginationProps } from "./pagination";
|
|
@@ -141,6 +141,7 @@ export {
|
|
|
141
141
|
type FilesPartitioned,
|
|
142
142
|
} from "./form/file-upload";
|
|
143
143
|
export { FormSummary, type FormSummaryProps } from "./form/form-summary";
|
|
144
|
+
export { FormProgress, type FormProgressProps } from "./form/form-progress";
|
|
144
145
|
export {
|
|
145
146
|
Radio,
|
|
146
147
|
RadioGroup,
|
|
@@ -8,8 +8,10 @@ export type BleedSpacingInline = "0" | "full" | "px" | SpacingScale;
|
|
|
8
8
|
export type BleedSpacingBlock = "0" | "px" | SpacingScale;
|
|
9
9
|
|
|
10
10
|
export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
11
|
+
/**
|
|
12
|
+
* **Negative** horizontal margin around children.
|
|
13
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
14
|
+
* or an object of spacing tokens for different breakpoints.
|
|
13
15
|
*
|
|
14
16
|
* The `px` value is useful to nudge by just 1px.
|
|
15
17
|
* The `full` value is used to extend the margin to the full width of the parent.
|
|
@@ -22,8 +24,10 @@ export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
22
24
|
marginInline?: ResponsiveProp<
|
|
23
25
|
BleedSpacingInline | `${BleedSpacingInline} ${BleedSpacingInline}`
|
|
24
26
|
>;
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
+
/**
|
|
28
|
+
* **Negative** vertical margin around children.
|
|
29
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
30
|
+
* or an object of spacing tokens for different breakpoints.
|
|
27
31
|
*
|
|
28
32
|
* The `px` value is useful to nudge by just 1px.
|
|
29
33
|
* This prop does **not** accept the `full` value.
|
package/src/layout/box/Box.tsx
CHANGED
|
@@ -17,7 +17,10 @@ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
17
17
|
background?: BackgroundToken;
|
|
18
18
|
/** CSS `border-color` property. Accepts a color token. */
|
|
19
19
|
borderColor?: BorderColorToken;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* CSS `border-radius` property.
|
|
22
|
+
* Accepts a [radius token](https://aksel.nav.no/grunnleggende/styling/design-tokens#6d79c5605d31)
|
|
23
|
+
* or an object of radius tokens for different breakpoints.
|
|
21
24
|
* @example
|
|
22
25
|
* borderRadius='full'
|
|
23
26
|
* borderRadius='0 full large small'
|
|
@@ -31,13 +34,19 @@ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
31
34
|
* borderWidth='1 2 3 4'
|
|
32
35
|
*/
|
|
33
36
|
borderWidth?: SpaceDelimitedAttribute<"0" | "1" | "2" | "3" | "4" | "5">;
|
|
34
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Padding around children.
|
|
39
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
40
|
+
* or an object of spacing tokens for different breakpoints.
|
|
35
41
|
* @example
|
|
36
42
|
* padding='4'
|
|
37
43
|
* padding={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
38
44
|
*/
|
|
39
45
|
padding?: ResponsiveProp<SpacingScale>;
|
|
40
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Horizontal padding around children.
|
|
48
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
49
|
+
* or an object of spacing tokens for different breakpoints.
|
|
41
50
|
* @example
|
|
42
51
|
* paddingInline='4'
|
|
43
52
|
* paddingInline='4 5'
|
|
@@ -46,7 +55,10 @@ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
46
55
|
paddingInline?: ResponsiveProp<
|
|
47
56
|
SpacingScale | `${SpacingScale} ${SpacingScale}`
|
|
48
57
|
>;
|
|
49
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Vertical padding around children.
|
|
60
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
61
|
+
* or an object of spacing tokens for different breakpoints.
|
|
50
62
|
* @example
|
|
51
63
|
* paddingBlock='4'
|
|
52
64
|
* paddingBlock='4 5'
|
|
@@ -6,7 +6,7 @@ import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
|
6
6
|
export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/**
|
|
9
|
-
* Number of columns to display. Can be a number, a string
|
|
9
|
+
* Number of columns to display. Can be a number, a string, or an object with values for specific breakpoints.
|
|
10
10
|
* Sets `grid-template-columns`, so `fr`, `minmax` etc. works.
|
|
11
11
|
* @example
|
|
12
12
|
* columns={{ sm: 1, md: 1, lg: "1fr auto", xl: "1fr auto"}}
|
|
@@ -14,12 +14,16 @@ export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
14
14
|
* columns="repeat(3, minmax(0, 1fr))"
|
|
15
15
|
*/
|
|
16
16
|
columns?: ResponsiveProp<number | string>;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Spacing between columns.
|
|
19
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
20
|
+
* or an object of spacing tokens for different breakpoints.
|
|
18
21
|
* @example
|
|
19
22
|
* gap="6"
|
|
23
|
+
* gap="8 4"
|
|
20
24
|
* gap={{ sm: "2", md: "2", lg: "6", xl: "6"}}
|
|
21
25
|
*/
|
|
22
|
-
gap?: ResponsiveProp<SpacingScale
|
|
26
|
+
gap?: ResponsiveProp<SpacingScale | `${SpacingScale} ${SpacingScale}`>;
|
|
23
27
|
/**
|
|
24
28
|
* Vertical alignment of children. Elements will by default stretch to the height of parent-element.
|
|
25
29
|
*/
|
|
@@ -35,6 +35,8 @@ export interface StackProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
35
35
|
wrap?: boolean;
|
|
36
36
|
/**
|
|
37
37
|
* CSS `gap` property.
|
|
38
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
39
|
+
* or an object of spacing tokens for different breakpoints.
|
|
38
40
|
*
|
|
39
41
|
* @example
|
|
40
42
|
* gap='4'
|
|
@@ -49,7 +51,9 @@ export interface StackProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
49
51
|
* direction='row'
|
|
50
52
|
* direction={{xs: 'row', sm: 'column'}}
|
|
51
53
|
*/
|
|
52
|
-
direction?: ResponsiveProp<
|
|
54
|
+
direction?: ResponsiveProp<
|
|
55
|
+
"row" | "column" | "row-reverse" | "column-reverse"
|
|
56
|
+
>;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
export const Stack: OverridableComponent<StackProps, HTMLDivElement> =
|
|
@@ -44,7 +44,9 @@ const translateTokenStringToCSS = (
|
|
|
44
44
|
if (componentProp === "margin-inline" && x === "full") {
|
|
45
45
|
const width = 100 / arr.length;
|
|
46
46
|
return `calc((100vw - ${width}%)/-2)`;
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (componentProp === "padding-inline" && x === "full") {
|
|
48
50
|
const width = 100 / arr.length;
|
|
49
51
|
return `calc((100vw - ${width}%)/2)`;
|
|
50
52
|
}
|
package/src/list/List.tsx
CHANGED
|
@@ -10,12 +10,24 @@ export interface ListComponent
|
|
|
10
10
|
extends React.ForwardRefExoticComponent<
|
|
11
11
|
ListProps & React.RefAttributes<HTMLDivElement>
|
|
12
12
|
> {
|
|
13
|
-
/**
|
|
14
|
-
* @see 🏷️ {@link ListItemProps}
|
|
15
|
-
*/
|
|
16
13
|
Item: typeof ListItem;
|
|
17
14
|
}
|
|
18
15
|
|
|
16
|
+
/**
|
|
17
|
+
* A list component
|
|
18
|
+
*
|
|
19
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/list)
|
|
20
|
+
* @see 🏷️ {@link ListProps | Props}
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```jsx
|
|
24
|
+
* <List>
|
|
25
|
+
* <List.Item>Coffee</List.Item>
|
|
26
|
+
* <List.Item>Tea</List.Item>
|
|
27
|
+
* <List.Item>Milk</List.Item>
|
|
28
|
+
* </List>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
19
31
|
export const List = forwardRef<HTMLDivElement, ListProps>(
|
|
20
32
|
(
|
|
21
33
|
{
|
package/src/list/ListItem.tsx
CHANGED
|
@@ -2,22 +2,11 @@ import cl from "clsx";
|
|
|
2
2
|
import React, { forwardRef, useContext } from "react";
|
|
3
3
|
import { BodyShort, Label } from "../typography";
|
|
4
4
|
import { ListContext } from "./context";
|
|
5
|
+
import { ListItemProps } from "./types";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* Title for the list item
|
|
13
|
-
*/
|
|
14
|
-
title?: string;
|
|
15
|
-
/*
|
|
16
|
-
* Icon to be used as list marker for unordered lists.
|
|
17
|
-
*/
|
|
18
|
-
icon?: React.ReactNode;
|
|
19
|
-
}
|
|
20
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @see 🏷️ {@link ListItemProps}
|
|
9
|
+
*/
|
|
21
10
|
export const ListItem = forwardRef<HTMLLIElement, ListItemProps>(
|
|
22
11
|
({ className, children, title, icon, ...rest }, ref) => {
|
|
23
12
|
const { listType, size } = useContext(ListContext);
|
package/src/list/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { default as List } from "./List";
|
|
3
|
-
export type { ListProps } from "./types";
|
|
4
|
-
export { default as ListItem
|
|
3
|
+
export type { ListProps, ListItemProps } from "./types";
|
|
4
|
+
export { default as ListItem } from "./ListItem";
|
package/src/list/types.ts
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
export interface ListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
2
|
children: React.ReactNode;
|
|
3
3
|
/**
|
|
4
|
-
* HTML list element to render
|
|
4
|
+
* HTML list element to render.
|
|
5
5
|
* @default "ul"
|
|
6
6
|
*/
|
|
7
7
|
as?: "ul" | "ol";
|
|
8
8
|
/**
|
|
9
|
-
* List heading title
|
|
9
|
+
* List heading title.
|
|
10
10
|
*/
|
|
11
11
|
title?: string;
|
|
12
12
|
/**
|
|
13
|
-
* List heading description
|
|
13
|
+
* List heading description.
|
|
14
14
|
*/
|
|
15
15
|
description?: string;
|
|
16
16
|
/**
|
|
17
|
-
* Allows setting a different HTML h-tag
|
|
17
|
+
* Allows setting a different HTML h-tag.
|
|
18
18
|
* @default "h3"
|
|
19
19
|
*/
|
|
20
20
|
headingTag?: React.ElementType<any>;
|
|
21
21
|
/**
|
|
22
|
-
* Changes padding, height and font-size
|
|
22
|
+
* Changes padding, height and font-size.
|
|
23
23
|
* @default "medium"
|
|
24
24
|
*/
|
|
25
25
|
size?: "medium" | "small";
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
export interface ListItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
29
|
+
/**
|
|
30
|
+
* List item content.
|
|
31
|
+
*/
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* List item title.
|
|
35
|
+
*/
|
|
36
|
+
title?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Icon to be used instead of bullet (unordered lists only).
|
|
39
|
+
*/
|
|
40
|
+
icon?: React.ReactNode;
|
|
41
|
+
}
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
import dialogPolyfill, { needPolyfill } from "./dialog-polyfill";
|
|
22
22
|
import { ModalProps } from "./types";
|
|
23
23
|
|
|
24
|
+
const polyfillClassName = "navds-modal--polyfilled";
|
|
25
|
+
|
|
24
26
|
interface ModalComponent
|
|
25
27
|
extends React.ForwardRefExoticComponent<
|
|
26
28
|
ModalProps & React.RefAttributes<HTMLDialogElement>
|
|
@@ -115,6 +117,9 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
|
|
|
115
117
|
// We check both to avoid activating polyfill twice when not using portal.
|
|
116
118
|
if (needPolyfill && modalRef.current && portalNode) {
|
|
117
119
|
dialogPolyfill.registerDialog(modalRef.current);
|
|
120
|
+
|
|
121
|
+
// Force-add the "polyfilled" class in case of SSR (needPolyfill will always be false on the server)
|
|
122
|
+
modalRef.current.classList.add(polyfillClassName);
|
|
118
123
|
}
|
|
119
124
|
// We set autofocus on the dialog element to prevent the default behavior where first focusable element gets focus when modal is opened.
|
|
120
125
|
// This is mainly to fix an edge case where having a Tooltip as the first focusable element would make it activate when you open the modal.
|
|
@@ -142,7 +147,7 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
|
|
|
142
147
|
typeof width === "string" && ["small", "medium"].includes(width);
|
|
143
148
|
|
|
144
149
|
const mergedClassName = cl("navds-modal", className, {
|
|
145
|
-
|
|
150
|
+
polyfillClassName: needPolyfill,
|
|
146
151
|
"navds-modal--autowidth": !width,
|
|
147
152
|
[`navds-modal--${width}`]: isWidthPreset,
|
|
148
153
|
});
|
|
@@ -260,7 +260,7 @@ function dialogPolyfillInfo(dialog) {
|
|
|
260
260
|
removed ? this.downgradeModal() : this.maybeHideModal();
|
|
261
261
|
removed = false;
|
|
262
262
|
}.bind(this);
|
|
263
|
-
var timeout
|
|
263
|
+
var timeout: ReturnType<typeof setTimeout>;
|
|
264
264
|
var delayModel = function (ev) {
|
|
265
265
|
if (ev.target !== dialog) {
|
|
266
266
|
return;
|
|
@@ -631,12 +631,16 @@ dialogPolyfill.DialogManager = function () {
|
|
|
631
631
|
this.mo_ = new MutationObserver(function (records) {
|
|
632
632
|
var removed = [];
|
|
633
633
|
records.forEach(function (rec) {
|
|
634
|
+
// biome-ignore lint/suspicious/noImplicitAnyLet: Reduntant to type c in this scenario
|
|
634
635
|
for (var i = 0, c; (c = rec.removedNodes[i]); ++i) {
|
|
635
636
|
if (!(c instanceof Element)) {
|
|
636
637
|
continue;
|
|
637
|
-
}
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
if (c.localName === "dialog") {
|
|
638
641
|
removed.push(c);
|
|
639
642
|
}
|
|
643
|
+
|
|
640
644
|
removed = removed.concat(c.querySelectorAll("dialog"));
|
|
641
645
|
}
|
|
642
646
|
});
|
|
@@ -675,6 +679,7 @@ dialogPolyfill.DialogManager.prototype.unblockDocument = function () {
|
|
|
675
679
|
dialogPolyfill.DialogManager.prototype.updateStacking = function () {
|
|
676
680
|
var zIndex = this.zIndexHigh_;
|
|
677
681
|
|
|
682
|
+
// biome-ignore lint/suspicious/noImplicitAnyLet: Reduntant to type dpi in this scenario
|
|
678
683
|
for (var i = 0, dpi; (dpi = this.pendingDialogStack[i]); ++i) {
|
|
679
684
|
dpi.updateZIndex(--zIndex, --zIndex);
|
|
680
685
|
if (i === 0) {
|
|
@@ -700,6 +705,7 @@ dialogPolyfill.DialogManager.prototype.containedByTopDialog_ = function (
|
|
|
700
705
|
candidate,
|
|
701
706
|
) {
|
|
702
707
|
while ((candidate = findNearestDialog(candidate))) {
|
|
708
|
+
// biome-ignore lint/suspicious/noImplicitAnyLet: Reduntant to type dpi in this scenario
|
|
703
709
|
for (var i = 0, dpi; (dpi = this.pendingDialogStack[i]); ++i) {
|
|
704
710
|
if (dpi.dialog === candidate) {
|
|
705
711
|
return i === 0; // only valid if top-most
|