@navikt/ds-react 6.1.1 → 6.3.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/accordion/Accordion.d.ts +4 -4
- package/cjs/alert/Alert.d.ts +12 -10
- package/cjs/alert/Alert.js.map +1 -1
- package/cjs/button/Button.d.ts +9 -8
- package/cjs/button/Button.js.map +1 -1
- package/cjs/chat/Chat.d.ts +6 -6
- package/cjs/chips/Chips.d.ts +2 -2
- package/cjs/copybutton/CopyButton.d.ts +14 -12
- package/cjs/copybutton/CopyButton.js.map +1 -1
- package/cjs/date/datepicker/types.d.ts +7 -6
- package/cjs/date/hooks/useDatepicker.d.ts +4 -3
- package/cjs/date/hooks/useDatepicker.js.map +1 -1
- package/cjs/date/hooks/useMonthPicker.d.ts +4 -3
- package/cjs/date/hooks/useMonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/types.d.ts +2 -1
- package/cjs/date/parts/DateInput.d.ts +1 -1
- package/cjs/expansion-card/ExpansionCardTitle.d.ts +1 -1
- package/cjs/form/checkbox/CheckboxGroup.d.ts +3 -3
- package/cjs/form/checkbox/types.d.ts +4 -4
- package/cjs/form/combobox/ComboboxProvider.js +5 -1
- package/cjs/form/combobox/ComboboxProvider.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +14 -12
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filtered-options-util.d.ts +3 -3
- package/cjs/form/combobox/FilteredOptions/filtered-options-util.js +1 -3
- package/cjs/form/combobox/FilteredOptions/filtered-options-util.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +8 -5
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +8 -13
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/Input/Input.js +9 -7
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.d.ts +2 -1
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +3 -3
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +10 -7
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +6 -8
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/cjs/form/combobox/combobox-utils.d.ts +10 -0
- package/cjs/form/combobox/combobox-utils.js +27 -0
- package/cjs/form/combobox/combobox-utils.js.map +1 -0
- package/cjs/form/combobox/customOptionsContext.d.ts +5 -4
- package/cjs/form/combobox/customOptionsContext.js +1 -1
- package/cjs/form/combobox/customOptionsContext.js.map +1 -1
- package/cjs/form/combobox/types.d.ts +33 -22
- package/cjs/form/error-summary/ErrorSummary.d.ts +5 -5
- package/cjs/form/file-upload/FileUpload.context.d.ts +8 -0
- package/cjs/form/file-upload/FileUpload.context.js +7 -0
- package/cjs/form/file-upload/FileUpload.context.js.map +1 -0
- package/cjs/form/file-upload/FileUpload.d.ts +118 -0
- package/cjs/form/file-upload/FileUpload.js +73 -0
- package/cjs/form/file-upload/FileUpload.js.map +1 -0
- package/cjs/form/file-upload/FileUpload.types.d.ts +55 -0
- package/cjs/form/file-upload/FileUpload.types.js +8 -0
- package/cjs/form/file-upload/FileUpload.types.js.map +1 -0
- package/cjs/form/file-upload/i18n/get.d.ts +2 -0
- package/cjs/form/file-upload/i18n/get.js +38 -0
- package/cjs/form/file-upload/i18n/get.js.map +1 -0
- package/cjs/form/file-upload/i18n/i18n.context.d.ts +11 -0
- package/cjs/form/file-upload/i18n/i18n.context.js +39 -0
- package/cjs/form/file-upload/i18n/i18n.context.js.map +1 -0
- package/cjs/form/file-upload/i18n/i18n.types.d.ts +13 -0
- package/cjs/form/file-upload/i18n/i18n.types.js +3 -0
- package/cjs/form/file-upload/i18n/i18n.types.js.map +1 -0
- package/cjs/form/file-upload/i18n/locales/nb.json +20 -0
- package/cjs/form/file-upload/i18n/merge.d.ts +2 -0
- package/cjs/form/file-upload/i18n/merge.js +29 -0
- package/cjs/form/file-upload/i18n/merge.js.map +1 -0
- package/cjs/form/file-upload/index.d.ts +7 -0
- package/cjs/form/file-upload/index.js +16 -0
- package/cjs/form/file-upload/index.js.map +1 -0
- package/cjs/form/file-upload/parts/Trigger.d.ts +7 -0
- package/cjs/form/file-upload/parts/Trigger.js +43 -0
- package/cjs/form/file-upload/parts/Trigger.js.map +1 -0
- package/cjs/form/file-upload/parts/dropzone/Dropzone.d.ts +4 -0
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js +106 -0
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js.map +1 -0
- package/cjs/form/file-upload/parts/dropzone/dropzone.types.d.ts +18 -0
- package/cjs/form/file-upload/parts/dropzone/dropzone.types.js +3 -0
- package/cjs/form/file-upload/parts/dropzone/dropzone.types.js.map +1 -0
- package/cjs/form/file-upload/parts/dropzone/useDropzone.d.ts +13 -0
- package/cjs/form/file-upload/parts/dropzone/useDropzone.js +34 -0
- package/cjs/form/file-upload/parts/dropzone/useDropzone.js.map +1 -0
- package/cjs/form/file-upload/parts/item/Item.d.ts +55 -0
- package/cjs/form/file-upload/parts/item/Item.js +79 -0
- package/cjs/form/file-upload/parts/item/Item.js.map +1 -0
- package/cjs/form/file-upload/parts/item/Item.types.d.ts +5 -0
- package/cjs/form/file-upload/parts/item/Item.types.js +3 -0
- package/cjs/form/file-upload/parts/item/Item.types.js.map +1 -0
- package/cjs/form/file-upload/parts/item/ItemButton.d.ts +12 -0
- package/cjs/form/file-upload/parts/item/ItemButton.js +22 -0
- package/cjs/form/file-upload/parts/item/ItemButton.js.map +1 -0
- package/cjs/form/file-upload/parts/item/ItemIcon.d.ts +9 -0
- package/cjs/form/file-upload/parts/item/ItemIcon.js +51 -0
- package/cjs/form/file-upload/parts/item/ItemIcon.js.map +1 -0
- package/cjs/form/file-upload/parts/item/ItemName.d.ts +9 -0
- package/cjs/form/file-upload/parts/item/ItemName.js +32 -0
- package/cjs/form/file-upload/parts/item/ItemName.js.map +1 -0
- package/cjs/form/file-upload/parts/item/utils/download-file.d.ts +1 -0
- package/cjs/form/file-upload/parts/item/utils/download-file.js +13 -0
- package/cjs/form/file-upload/parts/item/utils/download-file.js.map +1 -0
- package/cjs/form/file-upload/parts/item/utils/file-type-checker.d.ts +2 -0
- package/cjs/form/file-upload/parts/item/utils/file-type-checker.js +6 -0
- package/cjs/form/file-upload/parts/item/utils/file-type-checker.js.map +1 -0
- package/cjs/form/file-upload/parts/item/utils/format-file-size.d.ts +2 -0
- package/cjs/form/file-upload/parts/item/utils/format-file-size.js +24 -0
- package/cjs/form/file-upload/parts/item/utils/format-file-size.js.map +1 -0
- package/cjs/form/file-upload/useFileUpload.d.ts +12 -0
- package/cjs/form/file-upload/useFileUpload.js +33 -0
- package/cjs/form/file-upload/useFileUpload.js.map +1 -0
- package/cjs/form/file-upload/utils/is-accepted-file-type.d.ts +1 -0
- package/cjs/form/file-upload/utils/is-accepted-file-type.js +26 -0
- package/cjs/form/file-upload/utils/is-accepted-file-type.js.map +1 -0
- package/cjs/form/file-upload/utils/is-accepted-size.d.ts +1 -0
- package/cjs/form/file-upload/utils/is-accepted-size.js +11 -0
- package/cjs/form/file-upload/utils/is-accepted-size.js.map +1 -0
- package/cjs/form/file-upload/utils/validate-files.d.ts +8 -0
- package/cjs/form/file-upload/utils/validate-files.js +48 -0
- package/cjs/form/file-upload/utils/validate-files.js.map +1 -0
- package/cjs/form/radio/RadioGroup.d.ts +1 -1
- package/cjs/form/search/Search.d.ts +3 -2
- package/cjs/form/search/Search.js.map +1 -1
- package/cjs/form/select/Select.d.ts +9 -9
- package/cjs/form/switch/Switch.d.ts +5 -5
- package/cjs/form/textarea/Textarea.d.ts +5 -4
- package/cjs/form/textarea/Textarea.js.map +1 -1
- package/cjs/form/useFormField.d.ts +10 -8
- package/cjs/form/useFormField.js.map +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/bleed/Bleed.d.ts +9 -1
- package/cjs/layout/bleed/Bleed.js.map +1 -1
- package/cjs/layout/box/Box.d.ts +5 -5
- package/cjs/layout/grid/HGrid.d.ts +1 -3
- package/cjs/layout/grid/HGrid.js.map +1 -1
- package/cjs/layout/page/Page.d.ts +2 -2
- package/cjs/layout/responsive/Responsive.d.ts +2 -4
- package/cjs/layout/responsive/Responsive.js.map +1 -1
- package/cjs/layout/stack/Stack.d.ts +18 -4
- package/cjs/layout/stack/Stack.js.map +1 -1
- package/cjs/list/types.d.ts +1 -1
- package/cjs/loader/Loader.d.ts +0 -6
- package/cjs/loader/Loader.js.map +1 -1
- package/cjs/modal/Modal.js +2 -2
- package/cjs/modal/types.d.ts +8 -8
- package/cjs/pagination/Pagination.d.ts +3 -2
- package/cjs/pagination/Pagination.js.map +1 -1
- package/cjs/pagination/PaginationItem.d.ts +1 -1
- package/cjs/popover/Popover.d.ts +2 -1
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/read-more/ReadMore.d.ts +7 -7
- package/cjs/stepper/Step.d.ts +4 -4
- package/cjs/stepper/Stepper.d.ts +7 -5
- package/cjs/stepper/Stepper.js.map +1 -1
- package/cjs/table/AnimateHeight.d.ts +1 -1
- package/cjs/table/DataCell.d.ts +1 -3
- package/cjs/table/DataCell.js.map +1 -1
- package/cjs/tabs/TabList.d.ts +1 -1
- package/cjs/tabs/Tabs.d.ts +7 -7
- package/cjs/timeline/Timeline.d.ts +6 -3
- package/cjs/timeline/Timeline.js +2 -1
- package/cjs/timeline/Timeline.js.map +1 -1
- package/cjs/timeline/period/index.d.ts +3 -2
- package/cjs/timeline/period/index.js.map +1 -1
- package/cjs/tooltip/Tooltip.d.ts +19 -12
- package/cjs/tooltip/Tooltip.js.map +1 -1
- package/cjs/util/create-context.d.ts +1 -0
- package/cjs/util/create-context.js.map +1 -1
- package/cjs/util/hooks/useEventListener.d.ts +1 -1
- package/cjs/util/hooks/useMergeRefs.d.ts +1 -1
- package/esm/accordion/Accordion.d.ts +4 -4
- package/esm/alert/Alert.d.ts +12 -10
- package/esm/alert/Alert.js.map +1 -1
- package/esm/button/Button.d.ts +9 -8
- package/esm/button/Button.js.map +1 -1
- package/esm/chat/Chat.d.ts +6 -6
- package/esm/chips/Chips.d.ts +2 -2
- package/esm/copybutton/CopyButton.d.ts +14 -12
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/datepicker/types.d.ts +7 -6
- package/esm/date/hooks/useDatepicker.d.ts +4 -3
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.d.ts +4 -3
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/monthpicker/types.d.ts +2 -1
- package/esm/date/parts/DateInput.d.ts +1 -1
- package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
- package/esm/form/checkbox/CheckboxGroup.d.ts +3 -3
- package/esm/form/checkbox/types.d.ts +4 -4
- package/esm/form/combobox/ComboboxProvider.js +5 -1
- package/esm/form/combobox/ComboboxProvider.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +14 -12
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filtered-options-util.d.ts +3 -3
- package/esm/form/combobox/FilteredOptions/filtered-options-util.js +1 -3
- package/esm/form/combobox/FilteredOptions/filtered-options-util.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +8 -5
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +8 -13
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/Input.js +9 -7
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.d.ts +2 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js +3 -3
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +10 -7
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +6 -8
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/combobox/combobox-utils.d.ts +10 -0
- package/esm/form/combobox/combobox-utils.js +22 -0
- package/esm/form/combobox/combobox-utils.js.map +1 -0
- package/esm/form/combobox/customOptionsContext.d.ts +5 -4
- package/esm/form/combobox/customOptionsContext.js +1 -1
- package/esm/form/combobox/customOptionsContext.js.map +1 -1
- package/esm/form/combobox/types.d.ts +33 -22
- package/esm/form/error-summary/ErrorSummary.d.ts +5 -5
- package/esm/form/file-upload/FileUpload.context.d.ts +8 -0
- package/esm/form/file-upload/FileUpload.context.js +3 -0
- package/esm/form/file-upload/FileUpload.context.js.map +1 -0
- package/esm/form/file-upload/FileUpload.d.ts +118 -0
- package/esm/form/file-upload/FileUpload.js +44 -0
- package/esm/form/file-upload/FileUpload.js.map +1 -0
- package/esm/form/file-upload/FileUpload.types.d.ts +55 -0
- package/esm/form/file-upload/FileUpload.types.js +5 -0
- package/esm/form/file-upload/FileUpload.types.js.map +1 -0
- package/esm/form/file-upload/i18n/get.d.ts +2 -0
- package/esm/form/file-upload/i18n/get.js +34 -0
- package/esm/form/file-upload/i18n/get.js.map +1 -0
- package/esm/form/file-upload/i18n/i18n.context.d.ts +11 -0
- package/esm/form/file-upload/i18n/i18n.context.js +32 -0
- package/esm/form/file-upload/i18n/i18n.context.js.map +1 -0
- package/esm/form/file-upload/i18n/i18n.types.d.ts +13 -0
- package/esm/form/file-upload/i18n/i18n.types.js +2 -0
- package/esm/form/file-upload/i18n/i18n.types.js.map +1 -0
- package/esm/form/file-upload/i18n/locales/nb.json +20 -0
- package/esm/form/file-upload/i18n/merge.d.ts +2 -0
- package/esm/form/file-upload/i18n/merge.js +25 -0
- package/esm/form/file-upload/i18n/merge.js.map +1 -0
- package/esm/form/file-upload/index.d.ts +7 -0
- package/esm/form/file-upload/index.js +6 -0
- package/esm/form/file-upload/index.js.map +1 -0
- package/esm/form/file-upload/parts/Trigger.d.ts +7 -0
- package/esm/form/file-upload/parts/Trigger.js +18 -0
- package/esm/form/file-upload/parts/Trigger.js.map +1 -0
- package/esm/form/file-upload/parts/dropzone/Dropzone.d.ts +4 -0
- package/esm/form/file-upload/parts/dropzone/Dropzone.js +78 -0
- package/esm/form/file-upload/parts/dropzone/Dropzone.js.map +1 -0
- package/esm/form/file-upload/parts/dropzone/dropzone.types.d.ts +18 -0
- package/esm/form/file-upload/parts/dropzone/dropzone.types.js +2 -0
- package/esm/form/file-upload/parts/dropzone/dropzone.types.js.map +1 -0
- package/esm/form/file-upload/parts/dropzone/useDropzone.d.ts +13 -0
- package/esm/form/file-upload/parts/dropzone/useDropzone.js +30 -0
- package/esm/form/file-upload/parts/dropzone/useDropzone.js.map +1 -0
- package/esm/form/file-upload/parts/item/Item.d.ts +55 -0
- package/esm/form/file-upload/parts/item/Item.js +50 -0
- package/esm/form/file-upload/parts/item/Item.js.map +1 -0
- package/esm/form/file-upload/parts/item/Item.types.d.ts +5 -0
- package/esm/form/file-upload/parts/item/Item.types.js +2 -0
- package/esm/form/file-upload/parts/item/Item.types.js.map +1 -0
- package/esm/form/file-upload/parts/item/ItemButton.d.ts +12 -0
- package/esm/form/file-upload/parts/item/ItemButton.js +17 -0
- package/esm/form/file-upload/parts/item/ItemButton.js.map +1 -0
- package/esm/form/file-upload/parts/item/ItemIcon.d.ts +9 -0
- package/esm/form/file-upload/parts/item/ItemIcon.js +46 -0
- package/esm/form/file-upload/parts/item/ItemIcon.js.map +1 -0
- package/esm/form/file-upload/parts/item/ItemName.d.ts +9 -0
- package/esm/form/file-upload/parts/item/ItemName.js +27 -0
- package/esm/form/file-upload/parts/item/ItemName.js.map +1 -0
- package/esm/form/file-upload/parts/item/utils/download-file.d.ts +1 -0
- package/esm/form/file-upload/parts/item/utils/download-file.js +9 -0
- package/esm/form/file-upload/parts/item/utils/download-file.js.map +1 -0
- package/esm/form/file-upload/parts/item/utils/file-type-checker.d.ts +2 -0
- package/esm/form/file-upload/parts/item/utils/file-type-checker.js +2 -0
- package/esm/form/file-upload/parts/item/utils/file-type-checker.js.map +1 -0
- package/esm/form/file-upload/parts/item/utils/format-file-size.d.ts +2 -0
- package/esm/form/file-upload/parts/item/utils/format-file-size.js +20 -0
- package/esm/form/file-upload/parts/item/utils/format-file-size.js.map +1 -0
- package/esm/form/file-upload/useFileUpload.d.ts +12 -0
- package/esm/form/file-upload/useFileUpload.js +29 -0
- package/esm/form/file-upload/useFileUpload.js.map +1 -0
- package/esm/form/file-upload/utils/is-accepted-file-type.d.ts +1 -0
- package/esm/form/file-upload/utils/is-accepted-file-type.js +22 -0
- package/esm/form/file-upload/utils/is-accepted-file-type.js.map +1 -0
- package/esm/form/file-upload/utils/is-accepted-size.d.ts +1 -0
- package/esm/form/file-upload/utils/is-accepted-size.js +7 -0
- package/esm/form/file-upload/utils/is-accepted-size.js.map +1 -0
- package/esm/form/file-upload/utils/validate-files.d.ts +8 -0
- package/esm/form/file-upload/utils/validate-files.js +44 -0
- package/esm/form/file-upload/utils/validate-files.js.map +1 -0
- package/esm/form/radio/RadioGroup.d.ts +1 -1
- package/esm/form/search/Search.d.ts +3 -2
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/select/Select.d.ts +9 -9
- package/esm/form/switch/Switch.d.ts +5 -5
- package/esm/form/textarea/Textarea.d.ts +5 -4
- package/esm/form/textarea/Textarea.js.map +1 -1
- package/esm/form/useFormField.d.ts +10 -8
- package/esm/form/useFormField.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/layout/bleed/Bleed.d.ts +9 -1
- package/esm/layout/bleed/Bleed.js.map +1 -1
- package/esm/layout/box/Box.d.ts +5 -5
- package/esm/layout/grid/HGrid.d.ts +1 -3
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/page/Page.d.ts +2 -2
- package/esm/layout/responsive/Responsive.d.ts +2 -4
- package/esm/layout/responsive/Responsive.js.map +1 -1
- package/esm/layout/stack/Stack.d.ts +18 -4
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/list/types.d.ts +1 -1
- package/esm/loader/Loader.d.ts +0 -6
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.js +2 -2
- package/esm/modal/types.d.ts +8 -8
- package/esm/pagination/Pagination.d.ts +3 -2
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.d.ts +1 -1
- package/esm/popover/Popover.d.ts +2 -1
- package/esm/popover/Popover.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +7 -7
- package/esm/stepper/Step.d.ts +4 -4
- package/esm/stepper/Stepper.d.ts +7 -5
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/table/AnimateHeight.d.ts +1 -1
- package/esm/table/DataCell.d.ts +1 -3
- package/esm/table/DataCell.js.map +1 -1
- package/esm/tabs/TabList.d.ts +1 -1
- package/esm/tabs/Tabs.d.ts +7 -7
- package/esm/timeline/Timeline.d.ts +6 -3
- package/esm/timeline/Timeline.js +2 -1
- package/esm/timeline/Timeline.js.map +1 -1
- package/esm/timeline/period/index.d.ts +3 -2
- package/esm/timeline/period/index.js.map +1 -1
- package/esm/tooltip/Tooltip.d.ts +19 -12
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/util/create-context.d.ts +1 -0
- package/esm/util/create-context.js.map +1 -1
- package/esm/util/hooks/useEventListener.d.ts +1 -1
- package/esm/util/hooks/useMergeRefs.d.ts +1 -1
- package/package.json +13 -3
- package/src/accordion/Accordion.tsx +4 -4
- package/src/accordion/accordion.stories.tsx +0 -2
- package/src/alert/Alert.tsx +12 -10
- package/src/button/Button.tsx +9 -8
- package/src/chat/Chat.tsx +6 -6
- package/src/chips/Chips.tsx +2 -2
- package/src/copybutton/CopyButton.tsx +14 -12
- package/src/date/datepicker/datepicker.stories.tsx +0 -1
- package/src/date/datepicker/types.ts +7 -6
- package/src/date/hooks/useDatepicker.tsx +4 -3
- package/src/date/hooks/useMonthPicker.tsx +4 -3
- package/src/date/monthpicker/types.ts +2 -1
- package/src/date/parts/DateInput.tsx +1 -1
- package/src/expansion-card/ExpansionCardTitle.tsx +1 -1
- package/src/form/checkbox/CheckboxGroup.tsx +3 -3
- package/src/form/checkbox/types.ts +4 -4
- package/src/form/combobox/ComboboxProvider.tsx +7 -3
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +22 -15
- package/src/form/combobox/FilteredOptions/filtered-options-util.ts +5 -10
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +19 -29
- package/src/form/combobox/Input/Input.tsx +14 -8
- package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +8 -5
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +24 -25
- package/src/form/combobox/combobox-utils.test.ts +67 -0
- package/src/form/combobox/combobox-utils.ts +32 -0
- package/src/form/combobox/combobox.stories.tsx +67 -32
- package/src/form/combobox/combobox.test.tsx +32 -1
- package/src/form/combobox/customOptionsContext.tsx +9 -8
- package/src/form/combobox/types.ts +34 -22
- package/src/form/error-summary/ErrorSummary.tsx +5 -5
- package/src/form/file-upload/FileUpload.context.tsx +9 -0
- package/src/form/file-upload/FileUpload.tsx +142 -0
- package/src/form/file-upload/FileUpload.types.ts +57 -0
- package/src/form/file-upload/file-upload-dropzone.stories.tsx +123 -0
- package/src/form/file-upload/file-upload-item.stories.tsx +136 -0
- package/src/form/file-upload/file-upload.stories.tsx +236 -0
- package/src/form/file-upload/i18n/get.ts +48 -0
- package/src/form/file-upload/i18n/i18n.context.test.tsx +92 -0
- package/src/form/file-upload/i18n/i18n.context.ts +67 -0
- package/src/form/file-upload/i18n/i18n.types.ts +20 -0
- package/src/form/file-upload/i18n/locales/nb.json +20 -0
- package/src/form/file-upload/i18n/merge.ts +35 -0
- package/src/form/file-upload/index.ts +21 -0
- package/src/form/file-upload/parts/Trigger.tsx +48 -0
- package/src/form/file-upload/parts/dropzone/Dropzone.tsx +180 -0
- package/src/form/file-upload/parts/dropzone/dropzone.types.ts +22 -0
- package/src/form/file-upload/parts/dropzone/useDropzone.ts +43 -0
- package/src/form/file-upload/parts/item/Item.tsx +165 -0
- package/src/form/file-upload/parts/item/Item.types.ts +6 -0
- package/src/form/file-upload/parts/item/ItemButton.tsx +52 -0
- package/src/form/file-upload/parts/item/ItemIcon.tsx +74 -0
- package/src/form/file-upload/parts/item/ItemName.tsx +58 -0
- package/src/form/file-upload/parts/item/utils/download-file.ts +9 -0
- package/src/form/file-upload/parts/item/utils/file-type-checker.ts +4 -0
- package/src/form/file-upload/parts/item/utils/format-file-size.test.ts +76 -0
- package/src/form/file-upload/parts/item/utils/format-file-size.ts +25 -0
- package/src/form/file-upload/useFileUpload.ts +54 -0
- package/src/form/file-upload/utils/is-accepted-file-type.test.ts +69 -0
- package/src/form/file-upload/utils/is-accepted-file-type.ts +25 -0
- package/src/form/file-upload/utils/is-accepted-size.test.ts +26 -0
- package/src/form/file-upload/utils/is-accepted-size.ts +7 -0
- package/src/form/file-upload/utils/validate-files.test.ts +132 -0
- package/src/form/file-upload/utils/validate-files.ts +62 -0
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/form/search/Search.tsx +3 -2
- package/src/form/select/Select.tsx +9 -9
- package/src/form/select/select.stories.tsx +32 -37
- package/src/form/switch/Switch.tsx +5 -5
- package/src/form/textarea/Textarea.tsx +5 -4
- package/src/form/useFormField.ts +10 -8
- package/src/index.ts +14 -0
- package/src/internal-header/header.stories.tsx +8 -5
- package/src/layout/bleed/Bleed.tsx +9 -1
- package/src/layout/box/Box.tsx +5 -5
- package/src/layout/grid/HGrid.tsx +1 -3
- package/src/layout/page/Page.tsx +2 -2
- package/src/layout/responsive/Responsive.tsx +2 -4
- package/src/layout/stack/Stack.tsx +18 -4
- package/src/list/types.ts +1 -1
- package/src/loader/Loader.tsx +0 -6
- package/src/modal/Modal.tsx +2 -2
- package/src/modal/types.ts +8 -8
- package/src/pagination/Pagination.tsx +3 -2
- package/src/pagination/PaginationItem.tsx +1 -1
- package/src/popover/Popover.tsx +2 -1
- package/src/read-more/ReadMore.tsx +7 -7
- package/src/stepper/Step.tsx +4 -4
- package/src/stepper/Stepper.tsx +7 -5
- package/src/table/AnimateHeight.tsx +1 -1
- package/src/table/DataCell.tsx +1 -6
- package/src/tabs/TabList.tsx +1 -1
- package/src/tabs/Tabs.tsx +7 -7
- package/src/timeline/Timeline.tsx +6 -3
- package/src/timeline/period/index.tsx +3 -2
- package/src/tooltip/Tooltip.tsx +19 -12
- package/src/util/create-context.tsx +1 -0
- package/src/util/hooks/useMergeRefs.ts +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { validateFiles } from "./validate-files";
|
|
2
|
+
|
|
3
|
+
const createTxtFile = (name: string = "foo.txt") =>
|
|
4
|
+
new File(["foo"], name, {
|
|
5
|
+
type: "text/plain",
|
|
6
|
+
});
|
|
7
|
+
const createCsvFile = (name: string = "bar.csv") =>
|
|
8
|
+
new File(["abc,123"], name, {
|
|
9
|
+
type: "text/csv",
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe("partitionFiles", () => {
|
|
13
|
+
test("accepts all files when accept parameter is undefined", () => {
|
|
14
|
+
const files = [createTxtFile(), createCsvFile()];
|
|
15
|
+
const {
|
|
16
|
+
partitionedFiles: { accepted, rejected },
|
|
17
|
+
} = validateFiles(files);
|
|
18
|
+
|
|
19
|
+
expect(accepted.length).toBe(2);
|
|
20
|
+
expect(rejected.length).toBe(0);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("accepts all files when accept parameter is empty", () => {
|
|
24
|
+
const files = [createTxtFile(), createCsvFile()];
|
|
25
|
+
const {
|
|
26
|
+
partitionedFiles: { accepted, rejected },
|
|
27
|
+
} = validateFiles(files, "");
|
|
28
|
+
|
|
29
|
+
expect(accepted.length).toBe(2);
|
|
30
|
+
expect(rejected.length).toBe(0);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("rejects file that does not match accept parameter", () => {
|
|
34
|
+
const txtFileName = "foo.txt";
|
|
35
|
+
const csvFileName = "bar.csv";
|
|
36
|
+
const files = [createTxtFile(txtFileName), createCsvFile(csvFileName)];
|
|
37
|
+
const {
|
|
38
|
+
partitionedFiles: { accepted, rejected },
|
|
39
|
+
} = validateFiles(files, ".txt");
|
|
40
|
+
|
|
41
|
+
expect(accepted.length).toBe(1);
|
|
42
|
+
expect(rejected.length).toBe(1);
|
|
43
|
+
expect(accepted[0].name).toBe(txtFileName);
|
|
44
|
+
expect(rejected[0].file.name).toBe(csvFileName);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("rejects file that does not pass validator", () => {
|
|
48
|
+
const txtFileName = "foo.txt";
|
|
49
|
+
const csvFileName = "bar.csv";
|
|
50
|
+
const csvFile = createCsvFile(csvFileName);
|
|
51
|
+
const txtFile = createTxtFile(txtFileName);
|
|
52
|
+
const files = [txtFile, csvFile];
|
|
53
|
+
const validator = (file: File) => {
|
|
54
|
+
if (file.name === txtFile.name) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return "custom validation error";
|
|
58
|
+
};
|
|
59
|
+
const {
|
|
60
|
+
partitionedFiles: { accepted, rejected },
|
|
61
|
+
} = validateFiles(files, undefined, validator);
|
|
62
|
+
|
|
63
|
+
expect(accepted.length).toBe(1);
|
|
64
|
+
expect(rejected.length).toBe(1);
|
|
65
|
+
expect(accepted[0].name).toBe(txtFileName);
|
|
66
|
+
expect(rejected[0].file.name).toBe(csvFileName);
|
|
67
|
+
expect(rejected[0].reasons).toEqual(["custom validation error"]);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("rejects file that passes accept parameter but does not pass validator", () => {
|
|
71
|
+
const txtFileName = "foo.txt";
|
|
72
|
+
const csvFileName = "bar.csv";
|
|
73
|
+
const csvFile = createCsvFile(csvFileName);
|
|
74
|
+
const txtFile = createTxtFile(txtFileName);
|
|
75
|
+
const files = [txtFile, csvFile];
|
|
76
|
+
const validator = (file: File) => {
|
|
77
|
+
if (file.name === txtFile.name) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return "custom validation error";
|
|
81
|
+
};
|
|
82
|
+
const {
|
|
83
|
+
partitionedFiles: { accepted, rejected },
|
|
84
|
+
} = validateFiles(files, ".txt, .csv", validator);
|
|
85
|
+
|
|
86
|
+
expect(accepted.length).toBe(1);
|
|
87
|
+
expect(rejected.length).toBe(1);
|
|
88
|
+
expect(accepted[0].name).toBe(txtFileName);
|
|
89
|
+
expect(rejected[0].file.name).toBe(csvFileName);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test("rejects file that passes validator but does not pass accept parameter", () => {
|
|
93
|
+
const txtFileName = "foo.txt";
|
|
94
|
+
const csvFileName = "bar.csv";
|
|
95
|
+
const csvFile = createCsvFile(csvFileName);
|
|
96
|
+
const txtFile = createTxtFile(txtFileName);
|
|
97
|
+
const files = [txtFile, csvFile];
|
|
98
|
+
const validator = (file: File) => {
|
|
99
|
+
if (file.name === csvFile.name || file.name === txtFile.name) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return "custom validation error";
|
|
103
|
+
};
|
|
104
|
+
const {
|
|
105
|
+
partitionedFiles: { accepted, rejected },
|
|
106
|
+
} = validateFiles(files, ".csv", validator);
|
|
107
|
+
|
|
108
|
+
expect(accepted.length).toBe(1);
|
|
109
|
+
expect(rejected.length).toBe(1);
|
|
110
|
+
expect(accepted[0].name).toBe(csvFileName);
|
|
111
|
+
expect(rejected[0].file.name).toBe(txtFileName);
|
|
112
|
+
expect(rejected[0].reasons).toEqual(["fileType"]);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test("rejects file that is too large", () => {
|
|
116
|
+
const txtFileName = "foo.txt";
|
|
117
|
+
const csvFileName = "bar.csv";
|
|
118
|
+
const csvFile = createCsvFile(csvFileName);
|
|
119
|
+
const txtFile = createTxtFile(txtFileName);
|
|
120
|
+
const files = [txtFile, csvFile];
|
|
121
|
+
const maxSizeInBytes = 5;
|
|
122
|
+
const {
|
|
123
|
+
partitionedFiles: { accepted, rejected },
|
|
124
|
+
} = validateFiles(files, undefined, undefined, maxSizeInBytes);
|
|
125
|
+
|
|
126
|
+
expect(accepted.length).toBe(1);
|
|
127
|
+
expect(rejected.length).toBe(1);
|
|
128
|
+
expect(accepted[0].name).toBe(txtFileName);
|
|
129
|
+
expect(rejected[0].file.name).toBe(csvFileName);
|
|
130
|
+
expect(rejected[0].reasons).toEqual(["fileSize"]);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FileObject,
|
|
3
|
+
FileUploadBaseProps,
|
|
4
|
+
FilesPartitioned,
|
|
5
|
+
fileRejectionReason,
|
|
6
|
+
} from "../FileUpload.types";
|
|
7
|
+
import { isAcceptedFileType } from "./is-accepted-file-type";
|
|
8
|
+
import { isAcceptedSize } from "./is-accepted-size";
|
|
9
|
+
|
|
10
|
+
export const validateFiles = (
|
|
11
|
+
files: File[],
|
|
12
|
+
accept?: string,
|
|
13
|
+
validator?: FileUploadBaseProps["validator"],
|
|
14
|
+
maxSizeInBytes: number = -1,
|
|
15
|
+
) => {
|
|
16
|
+
const allFiles: FileObject[] = [];
|
|
17
|
+
const accepted: File[] = [];
|
|
18
|
+
const rejected: FilesPartitioned["rejected"] = [];
|
|
19
|
+
|
|
20
|
+
files.forEach((file) => {
|
|
21
|
+
const acceptedFileType = isAcceptedFileType(file, accept);
|
|
22
|
+
const acceptedFileSize = isAcceptedSize(file, maxSizeInBytes);
|
|
23
|
+
const customValidation = validator ? validator(file) : true;
|
|
24
|
+
|
|
25
|
+
const reasons: FilesPartitioned["rejected"][0]["reasons"] = [];
|
|
26
|
+
if (customValidation !== true) {
|
|
27
|
+
reasons.push(customValidation);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!acceptedFileType) {
|
|
31
|
+
reasons.push(fileRejectionReason.FileType);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!acceptedFileSize) {
|
|
35
|
+
reasons.push(fileRejectionReason.FileSize);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
allFiles.push({
|
|
39
|
+
file,
|
|
40
|
+
error: reasons.length > 0,
|
|
41
|
+
reasons,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (reasons.length === 0) {
|
|
45
|
+
accepted.push(file);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
rejected.push({
|
|
50
|
+
file,
|
|
51
|
+
reasons,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
files: allFiles,
|
|
57
|
+
partitionedFiles: {
|
|
58
|
+
accepted,
|
|
59
|
+
rejected,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -26,8 +26,9 @@ export interface SearchProps
|
|
|
26
26
|
Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "type"> {
|
|
27
27
|
children?: React.ReactNode;
|
|
28
28
|
/**
|
|
29
|
-
* Search label
|
|
30
|
-
*
|
|
29
|
+
* Search label.
|
|
30
|
+
*
|
|
31
|
+
* Will be hidden by default, is required for accessibility reasons.
|
|
31
32
|
*/
|
|
32
33
|
label: React.ReactNode;
|
|
33
34
|
/**
|
|
@@ -8,27 +8,27 @@ import { FormFieldProps, useFormField } from "../useFormField";
|
|
|
8
8
|
|
|
9
9
|
export interface SelectProps
|
|
10
10
|
extends FormFieldProps,
|
|
11
|
-
Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
|
|
11
|
+
Omit<SelectHTMLAttributes<HTMLSelectElement>, "size" | "multiple"> {
|
|
12
12
|
/**
|
|
13
|
-
* Collection of <option />-elements
|
|
13
|
+
* Collection of <option />-elements.
|
|
14
14
|
*/
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
/**
|
|
17
|
-
* Exposes the HTML size attribute
|
|
17
|
+
* Exposes the HTML size attribute.
|
|
18
18
|
*/
|
|
19
19
|
htmlSize?: number;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Sets inline-style on select wrapper.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Label for select.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
label: React.ReactNode;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Shows label and description for screenreaders only.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
hideLabel?: boolean;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -1,36 +1,15 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import Select from "./Select";
|
|
3
|
+
import Select, { SelectProps } from "./Select";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const meta: Meta<typeof Select> = {
|
|
6
6
|
title: "ds-react/Select",
|
|
7
7
|
component: Select,
|
|
8
|
-
argTypes: {
|
|
9
|
-
size: {
|
|
10
|
-
control: {
|
|
11
|
-
type: "radio",
|
|
12
|
-
options: ["medium", "small"],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
description: {
|
|
16
|
-
type: "string",
|
|
17
|
-
},
|
|
18
|
-
error: {
|
|
19
|
-
type: "string",
|
|
20
|
-
},
|
|
21
|
-
hideLabel: {
|
|
22
|
-
type: "boolean",
|
|
23
|
-
},
|
|
24
|
-
disabled: {
|
|
25
|
-
type: "boolean",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
8
|
parameters: {
|
|
29
9
|
chromatic: { disable: true },
|
|
30
10
|
},
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
type Story = StoryObj<typeof Select>;
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
34
13
|
|
|
35
14
|
const content = (
|
|
36
15
|
<>
|
|
@@ -40,16 +19,32 @@ const content = (
|
|
|
40
19
|
</>
|
|
41
20
|
);
|
|
42
21
|
|
|
43
|
-
export const Default =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
22
|
+
export const Default: StoryFn<Omit<SelectProps, "children">> = (props) => (
|
|
23
|
+
<Select {...props}>{content}</Select>
|
|
24
|
+
);
|
|
25
|
+
Default.args = {
|
|
26
|
+
label: "Ipsum enim quis culpa",
|
|
27
|
+
};
|
|
28
|
+
Default.argTypes = {
|
|
29
|
+
description: {
|
|
30
|
+
type: "string",
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
control: { type: "radio" },
|
|
34
|
+
options: ["medium", "small"],
|
|
35
|
+
},
|
|
36
|
+
error: {
|
|
37
|
+
type: "string",
|
|
38
|
+
},
|
|
39
|
+
hideLabel: {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
},
|
|
45
|
+
readOnly: {
|
|
46
|
+
type: "boolean",
|
|
50
47
|
},
|
|
51
|
-
|
|
52
|
-
args: {},
|
|
53
48
|
};
|
|
54
49
|
|
|
55
50
|
export const Small = () => {
|
|
@@ -138,12 +133,12 @@ export const Readonly = () => {
|
|
|
138
133
|
);
|
|
139
134
|
};
|
|
140
135
|
|
|
141
|
-
export const Chromatic:
|
|
136
|
+
export const Chromatic: StoryObj<typeof Select> = {
|
|
142
137
|
render: () => (
|
|
143
138
|
<div>
|
|
144
139
|
<div>
|
|
145
140
|
<h2>Default</h2>
|
|
146
|
-
|
|
141
|
+
<Default label="Ipsum enim quis culpa" />
|
|
147
142
|
</div>
|
|
148
143
|
<div>
|
|
149
144
|
<h2>Small</h2>
|
|
@@ -36,24 +36,24 @@ export interface SwitchProps
|
|
|
36
36
|
extends Omit<FormFieldProps, "error" | "errorId">,
|
|
37
37
|
Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
38
38
|
/**
|
|
39
|
-
* Switch-label
|
|
39
|
+
* Switch-label.
|
|
40
40
|
*/
|
|
41
41
|
children: React.ReactNode;
|
|
42
42
|
/**
|
|
43
|
-
* If enabled shows the label and description for screenreaders only
|
|
43
|
+
* If enabled shows the label and description for screenreaders only.
|
|
44
44
|
*/
|
|
45
45
|
hideLabel?: boolean;
|
|
46
46
|
/**
|
|
47
|
-
* Toggles loading state with loader-component on switch
|
|
47
|
+
* Toggles loading state with loader-component on switch.
|
|
48
48
|
*/
|
|
49
49
|
loading?: boolean;
|
|
50
50
|
/**
|
|
51
|
-
* Positions switch on left/right side of label
|
|
51
|
+
* Positions switch on left/right side of label.
|
|
52
52
|
* @default "left"
|
|
53
53
|
*/
|
|
54
54
|
position?: "left" | "right";
|
|
55
55
|
/**
|
|
56
|
-
* Adds a description to extend labling of Switch
|
|
56
|
+
* Adds a description to extend labling of Switch.
|
|
57
57
|
*/
|
|
58
58
|
description?: string;
|
|
59
59
|
}
|
|
@@ -17,7 +17,8 @@ export interface TextareaProps
|
|
|
17
17
|
React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
18
18
|
/**
|
|
19
19
|
* Allowed character-count for content
|
|
20
|
-
*
|
|
20
|
+
*
|
|
21
|
+
* This is just a visual indicator! You will still need to handle actual character-limits/validation if needed.
|
|
21
22
|
*/
|
|
22
23
|
maxLength?: number;
|
|
23
24
|
/**
|
|
@@ -37,15 +38,15 @@ export interface TextareaProps
|
|
|
37
38
|
*/
|
|
38
39
|
minRows?: number;
|
|
39
40
|
/**
|
|
40
|
-
* Textarea label
|
|
41
|
+
* Textarea label.
|
|
41
42
|
*/
|
|
42
43
|
label: React.ReactNode;
|
|
43
44
|
/**
|
|
44
|
-
* If enabled shows the label and description for screenreaders only
|
|
45
|
+
* If enabled shows the label and description for screenreaders only.
|
|
45
46
|
*/
|
|
46
47
|
hideLabel?: boolean;
|
|
47
48
|
/**
|
|
48
|
-
* Enables resizing of field
|
|
49
|
+
* Enables resizing of field.
|
|
49
50
|
*/
|
|
50
51
|
resize?: boolean | "vertical" | "horizontal";
|
|
51
52
|
/**
|
package/src/form/useFormField.ts
CHANGED
|
@@ -5,32 +5,34 @@ import { FieldsetContext } from "./fieldset/context";
|
|
|
5
5
|
|
|
6
6
|
export interface FormFieldProps {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Adds a description to extend labling of the field.
|
|
9
|
+
* Error message for element.
|
|
9
10
|
*/
|
|
10
11
|
error?: React.ReactNode;
|
|
11
12
|
/**
|
|
12
|
-
* Override internal errorId
|
|
13
|
+
* Override internal errorId.
|
|
13
14
|
*/
|
|
14
15
|
errorId?: string;
|
|
15
16
|
/**
|
|
16
|
-
* Changes font-size, padding and gaps
|
|
17
|
+
* Changes font-size, padding and gaps.
|
|
17
18
|
*/
|
|
18
19
|
size?: "medium" | "small";
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* **Avoid using if possible for accessibility purposes**.
|
|
22
|
+
*
|
|
23
|
+
* Disables element.
|
|
22
24
|
*/
|
|
23
25
|
disabled?: boolean;
|
|
24
26
|
/**
|
|
25
|
-
* Adds a description to extend labling of a field
|
|
27
|
+
* Adds a description to extend labling of a field.
|
|
26
28
|
*/
|
|
27
29
|
description?: React.ReactNode;
|
|
28
30
|
/**
|
|
29
|
-
* Override internal id
|
|
31
|
+
* Override internal id.
|
|
30
32
|
*/
|
|
31
33
|
id?: string;
|
|
32
34
|
/**
|
|
33
|
-
* Read
|
|
35
|
+
* Read-only state.
|
|
34
36
|
*/
|
|
35
37
|
readOnly?: boolean;
|
|
36
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -136,6 +136,20 @@ export { Select, type SelectProps } from "./form/select";
|
|
|
136
136
|
export { Switch, type SwitchProps } from "./form/switch";
|
|
137
137
|
export { Textarea, type TextareaProps } from "./form/textarea";
|
|
138
138
|
export { TextField, type TextFieldProps } from "./form/textfield";
|
|
139
|
+
export {
|
|
140
|
+
UNSAFE_FileUpload,
|
|
141
|
+
type FileUploadDropzoneProps,
|
|
142
|
+
type FileUploadTriggerProps,
|
|
143
|
+
type FileObject,
|
|
144
|
+
type FileRejected,
|
|
145
|
+
type FileAccepted,
|
|
146
|
+
type FileRejectedPartitioned,
|
|
147
|
+
type FilesPartitioned,
|
|
148
|
+
type FileRejectionReason,
|
|
149
|
+
type FileUploadItemProps,
|
|
150
|
+
type FileItem,
|
|
151
|
+
type FileMetadata,
|
|
152
|
+
} from "./form/file-upload";
|
|
139
153
|
|
|
140
154
|
/**
|
|
141
155
|
* @deprecated
|
|
@@ -2,10 +2,12 @@ import { Meta } from "@storybook/react";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import {
|
|
4
4
|
ChevronDownIcon,
|
|
5
|
+
CogIcon,
|
|
5
6
|
ExternalLinkIcon,
|
|
7
|
+
LeaveIcon,
|
|
6
8
|
MenuGridIcon,
|
|
7
9
|
} from "@navikt/aksel-icons";
|
|
8
|
-
import { BodyLong, BodyShort, Detail } from "@navikt/ds-react";
|
|
10
|
+
import { BodyLong, BodyShort, Detail, Spacer } from "@navikt/ds-react";
|
|
9
11
|
import { Dropdown } from "../dropdown";
|
|
10
12
|
import InternalHeader from "./InternalHeader";
|
|
11
13
|
|
|
@@ -102,10 +104,11 @@ export const Default = {
|
|
|
102
104
|
<Dropdown.Menu.Divider />
|
|
103
105
|
<Dropdown.Menu.List>
|
|
104
106
|
<Dropdown.Menu.List.Item as="a" href="/#settings">
|
|
105
|
-
Innstillinger
|
|
107
|
+
Innstillinger <Spacer />{" "}
|
|
108
|
+
<CogIcon aria-hidden fontSize="1.5rem" />
|
|
106
109
|
</Dropdown.Menu.List.Item>
|
|
107
110
|
<Dropdown.Menu.List.Item onClick={() => console.log("logg ut")}>
|
|
108
|
-
Logg ut
|
|
111
|
+
Logg ut <Spacer /> <LeaveIcon aria-hidden fontSize="1.5rem" />
|
|
109
112
|
</Dropdown.Menu.List.Item>
|
|
110
113
|
</Dropdown.Menu.List>
|
|
111
114
|
</Dropdown.Menu>
|
|
@@ -180,10 +183,10 @@ export const UserWithMenu = () => (
|
|
|
180
183
|
<Dropdown.Menu.Divider />
|
|
181
184
|
<Dropdown.Menu.List>
|
|
182
185
|
<Dropdown.Menu.List.Item as="a" href="/#settings">
|
|
183
|
-
Innstillinger
|
|
186
|
+
Innstillinger <Spacer /> <CogIcon aria-hidden fontSize="1.5rem" />
|
|
184
187
|
</Dropdown.Menu.List.Item>
|
|
185
188
|
<Dropdown.Menu.List.Item onClick={() => console.log("logg ut")}>
|
|
186
|
-
Logg ut
|
|
189
|
+
Logg ut <Spacer /> <LeaveIcon aria-hidden fontSize="1.5rem" />
|
|
187
190
|
</Dropdown.Menu.List.Item>
|
|
188
191
|
</Dropdown.Menu.List>
|
|
189
192
|
</Dropdown.Menu>
|
|
@@ -9,7 +9,11 @@ export type BleedSpacingBlock = "0" | "px" | SpacingScale;
|
|
|
9
9
|
|
|
10
10
|
export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
11
|
/** **Negative** horizontal margin around children.
|
|
12
|
-
*
|
|
12
|
+
* Accepts a spacing token or an object of spacing tokens for different breakpoints.
|
|
13
|
+
*
|
|
14
|
+
* The `px` value is useful to nudge by just 1px.
|
|
15
|
+
* The `full` value is used to extend the margin to the full width of the parent.
|
|
16
|
+
*
|
|
13
17
|
* @example
|
|
14
18
|
* marginInline='4'
|
|
15
19
|
* marginInline='4 5'
|
|
@@ -20,6 +24,10 @@ export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
20
24
|
>;
|
|
21
25
|
/** **Negative** vertical margin around children.
|
|
22
26
|
* Accepts a spacing token or an object of spacing tokens for different breakpoints.
|
|
27
|
+
*
|
|
28
|
+
* The `px` value is useful to nudge by just 1px.
|
|
29
|
+
* This prop does **not** accept the `full` value.
|
|
30
|
+
*
|
|
23
31
|
* @example
|
|
24
32
|
* marginBlock='4'
|
|
25
33
|
* marginBlock='4 5'
|
package/src/layout/box/Box.tsx
CHANGED
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
} from "../utilities/types";
|
|
14
14
|
|
|
15
15
|
export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
-
/**
|
|
16
|
+
/** CSS `background-color` property. Accepts a color token. */
|
|
17
17
|
background?: BackgroundToken;
|
|
18
|
-
/**
|
|
18
|
+
/** CSS `border-color` property. Accepts a color token. */
|
|
19
19
|
borderColor?: BorderColorToken;
|
|
20
|
-
/**
|
|
20
|
+
/** CSS `border-radius` property. Accepts a radius token, or an object of radius tokens for different breakpoints.
|
|
21
21
|
* @example
|
|
22
22
|
* borderRadius='full'
|
|
23
23
|
* borderRadius='0 full large small'
|
|
@@ -25,13 +25,13 @@ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
25
25
|
*/
|
|
26
26
|
borderRadius?: ResponsiveProp<SpaceDelimitedAttribute<BorderRadiiToken>>;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* CSS `border-width` property. If this is not set there will be no border.
|
|
29
29
|
* @example
|
|
30
30
|
* borderWidth='2'
|
|
31
31
|
* borderWidth='1 2 3 4'
|
|
32
32
|
*/
|
|
33
33
|
borderWidth?: SpaceDelimitedAttribute<"0" | "1" | "2" | "3" | "4" | "5">;
|
|
34
|
-
/**
|
|
34
|
+
/** Padding around children. Accepts a spacing token or an object of spacing tokens for different breakpoints.
|
|
35
35
|
* @example
|
|
36
36
|
* padding='4'
|
|
37
37
|
* padding={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
@@ -6,13 +6,11 @@ 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 with a unit or tokens for
|
|
9
|
+
* Number of columns to display. Can be a number, a string with a unit, or tokens 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"}}
|
|
13
|
-
* @example
|
|
14
13
|
* columns={3}
|
|
15
|
-
* @example
|
|
16
14
|
* columns="repeat(3, minmax(0, 1fr))"
|
|
17
15
|
*/
|
|
18
16
|
columns?: ResponsiveProp<number | string>;
|
package/src/layout/page/Page.tsx
CHANGED
|
@@ -12,7 +12,7 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
12
12
|
as?: "div" | "body";
|
|
13
13
|
/**
|
|
14
14
|
* Background color. Accepts a color token.
|
|
15
|
-
* @default bg-default
|
|
15
|
+
* @default "bg-default"
|
|
16
16
|
*/
|
|
17
17
|
background?: keyof typeof bgColors.a | "surface-subtle";
|
|
18
18
|
/**
|
|
@@ -25,7 +25,7 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
25
25
|
footerPosition?: "belowFold";
|
|
26
26
|
/**
|
|
27
27
|
* Adds a standardised padding of 4rem between content and footer
|
|
28
|
-
* @default
|
|
28
|
+
* @default "end"
|
|
29
29
|
*/
|
|
30
30
|
contentBlockPadding?: "end" | "none";
|
|
31
31
|
}
|
|
@@ -6,13 +6,11 @@ import { BreakpointsAlias } from "../utilities/types";
|
|
|
6
6
|
export interface ResponsiveProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* above='md'
|
|
9
|
+
* Will show/hide element above breakpoint (inclusive)
|
|
11
10
|
*/
|
|
12
11
|
above?: Exclude<BreakpointsAlias, "xs">;
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
* below='md'
|
|
13
|
+
* Will show/hide element below breakpoint (inclusive)
|
|
16
14
|
*/
|
|
17
15
|
below?: Exclude<BreakpointsAlias, "xs">;
|
|
18
16
|
/**
|
|
@@ -7,7 +7,11 @@ import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
|
7
7
|
export interface StackProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* CSS `justify-content` property.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* justify='center'
|
|
14
|
+
* justify={{xs: 'start', sm: 'center', md: 'end', lg: 'space-around', xl: 'space-between'}}
|
|
11
15
|
*/
|
|
12
16
|
justify?: ResponsiveProp<
|
|
13
17
|
| "start"
|
|
@@ -18,22 +22,32 @@ export interface StackProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
18
22
|
| "space-evenly"
|
|
19
23
|
>;
|
|
20
24
|
/**
|
|
21
|
-
*
|
|
25
|
+
* CSS `align-items` property.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* align='center'
|
|
29
|
+
* align={{xs: 'start', sm: 'center', md: 'end', lg: 'baseline', xl: 'stretch'}}
|
|
22
30
|
*/
|
|
23
31
|
align?: ResponsiveProp<"start" | "center" | "end" | "baseline" | "stretch">;
|
|
24
32
|
/**
|
|
25
|
-
* flex-wrap
|
|
33
|
+
* Sets the CSS `flex-wrap` property.
|
|
26
34
|
*/
|
|
27
35
|
wrap?: boolean;
|
|
28
36
|
/**
|
|
37
|
+
* CSS `gap` property.
|
|
38
|
+
*
|
|
29
39
|
* @example
|
|
30
40
|
* gap='4'
|
|
31
41
|
* gap={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
32
42
|
*/
|
|
33
43
|
gap?: ResponsiveProp<SpacingScale>;
|
|
34
44
|
/**
|
|
35
|
-
* flex-direction
|
|
45
|
+
* CSS `flex-direction` property.
|
|
36
46
|
* @default "row"
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* direction='row'
|
|
50
|
+
* direction={{xs: 'row', sm: 'column'}}
|
|
37
51
|
*/
|
|
38
52
|
direction?: ResponsiveProp<"row" | "column">;
|
|
39
53
|
}
|