@navikt/ds-react 7.7.0 → 7.8.1
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/chips/Removable.d.ts +0 -5
- package/cjs/chips/Removable.js +2 -2
- package/cjs/chips/Removable.js.map +1 -1
- package/cjs/date/context/index.d.ts +2 -1
- package/cjs/date/context/index.js +5 -2
- package/cjs/date/context/index.js.map +1 -1
- package/cjs/date/context/useDateInputContext.d.ts +3 -3
- package/cjs/date/context/useDateInputContext.js +4 -4
- package/cjs/date/context/useDateInputContext.js.map +1 -1
- package/cjs/date/context/useDateTranslationContext.d.ts +8 -0
- package/cjs/date/context/useDateTranslationContext.js +7 -0
- package/cjs/date/context/useDateTranslationContext.js.map +1 -0
- package/cjs/date/datepicker/DatePicker.js +18 -16
- package/cjs/date/datepicker/DatePicker.js.map +1 -1
- package/cjs/date/datepicker/DatePickerStandalone.js +17 -14
- package/cjs/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/cjs/date/datepicker/parts/Caption.js +2 -3
- package/cjs/date/datepicker/parts/Caption.js.map +1 -1
- package/cjs/date/datepicker/parts/DropdownCaption.js +2 -2
- package/cjs/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/cjs/date/datepicker/parts/WeekNumber.js +3 -4
- package/cjs/date/datepicker/parts/WeekNumber.js.map +1 -1
- package/cjs/date/datepicker/parts/WeekRow.js +2 -3
- package/cjs/date/datepicker/parts/WeekRow.js.map +1 -1
- package/cjs/date/datepicker/types.d.ts +8 -0
- package/cjs/date/monthpicker/MonthCaption.js +1 -3
- package/cjs/date/monthpicker/MonthCaption.js.map +1 -1
- package/cjs/date/monthpicker/MonthPicker.js +30 -28
- package/cjs/date/monthpicker/MonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/MonthPickerStandalone.js +16 -12
- package/cjs/date/monthpicker/MonthPickerStandalone.js.map +1 -1
- package/cjs/date/monthpicker/types.d.ts +8 -0
- package/cjs/date/parts/DateInput.js +1 -2
- package/cjs/date/parts/DateInput.js.map +1 -1
- package/cjs/date/parts/DateWrapper.d.ts +3 -1
- package/cjs/date/parts/DateWrapper.js +3 -3
- package/cjs/date/parts/DateWrapper.js.map +1 -1
- package/cjs/date/utils/index.d.ts +1 -1
- package/cjs/date/utils/index.js +2 -1
- package/cjs/date/utils/index.js.map +1 -1
- package/cjs/date/utils/locale.d.ts +12 -2
- package/cjs/date/utils/locale.js +18 -2
- package/cjs/date/utils/locale.js.map +1 -1
- package/cjs/form/combobox/Combobox.d.ts +1 -1
- package/cjs/form/combobox/ComboboxWrapper.js +6 -7
- package/cjs/form/combobox/ComboboxWrapper.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptionsItem.js +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptionsItem.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/MaxSelectedMessage.d.ts +1 -1
- package/cjs/form/combobox/FilteredOptions/MaxSelectedMessage.js +2 -5
- package/cjs/form/combobox/FilteredOptions/MaxSelectedMessage.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +4 -4
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/Input/Input.js +10 -10
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/form/combobox/Input/InputController.d.ts +1 -1
- package/cjs/form/combobox/Input/InputController.js +15 -11
- package/cjs/form/combobox/Input/InputController.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +2 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +14 -5
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/cjs/form/combobox/types.d.ts +7 -17
- package/cjs/form/search/Search.d.ts +3 -2
- package/cjs/form/search/Search.js +1 -1
- package/cjs/form/search/Search.js.map +1 -1
- package/cjs/form/textarea/Textarea.d.ts +1 -0
- package/cjs/form/textarea/Textarea.js.map +1 -1
- package/cjs/guide-panel/GuidePanel.js +11 -3
- package/cjs/guide-panel/GuidePanel.js.map +1 -1
- package/cjs/guide-panel/Illustration.d.ts +2 -8
- package/cjs/guide-panel/Illustration.darkside.d.ts +2 -0
- package/cjs/guide-panel/Illustration.darkside.js +30 -0
- package/cjs/guide-panel/Illustration.darkside.js.map +1 -0
- package/cjs/guide-panel/Illustration.js +2 -18
- package/cjs/guide-panel/Illustration.js.map +1 -1
- package/cjs/guide-panel/index.d.ts +0 -1
- package/cjs/guide-panel/index.js +1 -3
- package/cjs/guide-panel/index.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +2 -3
- package/cjs/index.js.map +1 -1
- package/cjs/layout/box/Box.d.ts +3 -2
- package/cjs/layout/box/Box.darkside.d.ts +10 -6
- package/cjs/layout/box/Box.darkside.js.map +1 -1
- package/cjs/layout/box/Box.js.map +1 -1
- package/cjs/layout/utilities/types.d.ts +7 -23
- package/cjs/modal/Modal.js +1 -1
- package/cjs/modal/Modal.js.map +1 -1
- package/cjs/modal/ModalHeader.js +1 -1
- package/cjs/modal/ModalHeader.js.map +1 -1
- package/cjs/popover/Popover.js +1 -1
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/provider/Provider.d.ts +35 -10
- package/cjs/provider/Provider.js +13 -14
- package/cjs/provider/Provider.js.map +1 -1
- package/cjs/table/ExpandableRow.js +3 -3
- package/cjs/table/ExpandableRow.js.map +1 -1
- package/cjs/tabs/Tabs.context.d.ts +1 -1
- package/cjs/tag/Tag.d.ts +1 -1
- package/cjs/tag/Tag.js +4 -1
- package/cjs/tag/Tag.js.map +1 -1
- package/cjs/timeline/Pin.js +5 -2
- package/cjs/timeline/Pin.js.map +1 -1
- package/cjs/timeline/Timeline.d.ts +1 -0
- package/cjs/timeline/Timeline.js.map +1 -1
- package/cjs/timeline/hooks/useTimelineRows.d.ts +5 -1
- package/cjs/timeline/hooks/useTimelineRows.js +14 -3
- package/cjs/timeline/hooks/useTimelineRows.js.map +1 -1
- package/cjs/timeline/period/ClickablePeriod.js +5 -2
- package/cjs/timeline/period/ClickablePeriod.js.map +1 -1
- package/cjs/tooltip/Tooltip.js +6 -3
- package/cjs/tooltip/Tooltip.js.map +1 -1
- package/cjs/util/i18n/i18n.context.d.ts +1 -1
- package/cjs/util/i18n/i18n.context.js +15 -14
- package/cjs/util/i18n/i18n.context.js.map +1 -1
- package/cjs/util/i18n/locales/en.d.ts +50 -54
- package/cjs/util/i18n/locales/en.js +52 -56
- package/cjs/util/i18n/locales/en.js.map +1 -1
- package/cjs/util/i18n/locales/index.d.ts +3 -0
- package/cjs/util/i18n/locales/index.js +14 -0
- package/cjs/util/i18n/locales/index.js.map +1 -0
- package/cjs/util/i18n/locales/nb.d.ts +53 -57
- package/cjs/util/i18n/locales/nb.js +56 -60
- package/cjs/util/i18n/locales/nb.js.map +1 -1
- package/cjs/util/i18n/locales/nn.d.ts +50 -54
- package/cjs/util/i18n/locales/nn.js +52 -56
- package/cjs/util/i18n/locales/nn.js.map +1 -1
- package/esm/chips/Removable.d.ts +0 -5
- package/esm/chips/Removable.js +2 -2
- package/esm/chips/Removable.js.map +1 -1
- package/esm/date/context/index.d.ts +2 -1
- package/esm/date/context/index.js +2 -1
- package/esm/date/context/index.js.map +1 -1
- package/esm/date/context/useDateInputContext.d.ts +3 -3
- package/esm/date/context/useDateInputContext.js +3 -3
- package/esm/date/context/useDateInputContext.js.map +1 -1
- package/esm/date/context/useDateTranslationContext.d.ts +8 -0
- package/esm/date/context/useDateTranslationContext.js +3 -0
- package/esm/date/context/useDateTranslationContext.js.map +1 -0
- package/esm/date/datepicker/DatePicker.js +21 -19
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/DatePickerStandalone.js +19 -16
- package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/esm/date/datepicker/parts/Caption.js +2 -3
- package/esm/date/datepicker/parts/Caption.js.map +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js +3 -3
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/esm/date/datepicker/parts/WeekNumber.js +3 -4
- package/esm/date/datepicker/parts/WeekNumber.js.map +1 -1
- package/esm/date/datepicker/parts/WeekRow.js +2 -3
- package/esm/date/datepicker/parts/WeekRow.js.map +1 -1
- package/esm/date/datepicker/types.d.ts +8 -0
- package/esm/date/monthpicker/MonthCaption.js +2 -4
- package/esm/date/monthpicker/MonthCaption.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.js +33 -31
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/monthpicker/MonthPickerStandalone.js +18 -14
- package/esm/date/monthpicker/MonthPickerStandalone.js.map +1 -1
- package/esm/date/monthpicker/types.d.ts +8 -0
- package/esm/date/parts/DateInput.js +2 -3
- package/esm/date/parts/DateInput.js.map +1 -1
- package/esm/date/parts/DateWrapper.d.ts +3 -1
- package/esm/date/parts/DateWrapper.js +4 -4
- package/esm/date/parts/DateWrapper.js.map +1 -1
- package/esm/date/utils/index.d.ts +1 -1
- package/esm/date/utils/index.js +1 -1
- package/esm/date/utils/index.js.map +1 -1
- package/esm/date/utils/locale.d.ts +12 -2
- package/esm/date/utils/locale.js +16 -1
- package/esm/date/utils/locale.js.map +1 -1
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/ComboboxWrapper.js +6 -7
- package/esm/form/combobox/ComboboxWrapper.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptionsItem.js +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptionsItem.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/MaxSelectedMessage.d.ts +1 -1
- package/esm/form/combobox/FilteredOptions/MaxSelectedMessage.js +2 -5
- package/esm/form/combobox/FilteredOptions/MaxSelectedMessage.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +4 -4
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/Input.js +10 -10
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/Input/InputController.d.ts +1 -1
- package/esm/form/combobox/Input/InputController.js +15 -11
- package/esm/form/combobox/Input/InputController.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +2 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +14 -5
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/combobox/types.d.ts +7 -17
- package/esm/form/search/Search.d.ts +3 -2
- package/esm/form/search/Search.js +1 -1
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/textarea/Textarea.d.ts +1 -0
- package/esm/form/textarea/Textarea.js.map +1 -1
- package/esm/guide-panel/GuidePanel.js +11 -3
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/guide-panel/Illustration.d.ts +2 -8
- package/esm/guide-panel/Illustration.darkside.d.ts +2 -0
- package/esm/guide-panel/Illustration.darkside.js +23 -0
- package/esm/guide-panel/Illustration.darkside.js.map +1 -0
- package/esm/guide-panel/Illustration.js +2 -18
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/guide-panel/index.d.ts +0 -1
- package/esm/guide-panel/index.js +0 -1
- package/esm/guide-panel/index.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/layout/box/Box.d.ts +3 -2
- package/esm/layout/box/Box.darkside.d.ts +10 -6
- package/esm/layout/box/Box.darkside.js.map +1 -1
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/utilities/types.d.ts +7 -23
- package/esm/modal/Modal.js +2 -2
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/ModalHeader.js +1 -1
- package/esm/modal/ModalHeader.js.map +1 -1
- package/esm/popover/Popover.js +2 -2
- package/esm/popover/Popover.js.map +1 -1
- package/esm/provider/Provider.d.ts +35 -10
- package/esm/provider/Provider.js +11 -15
- package/esm/provider/Provider.js.map +1 -1
- package/esm/table/ExpandableRow.js +3 -3
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/tabs/Tabs.context.d.ts +1 -1
- package/esm/tag/Tag.d.ts +1 -1
- package/esm/tag/Tag.js +4 -1
- package/esm/tag/Tag.js.map +1 -1
- package/esm/timeline/Pin.js +5 -2
- package/esm/timeline/Pin.js.map +1 -1
- package/esm/timeline/Timeline.d.ts +1 -0
- package/esm/timeline/Timeline.js.map +1 -1
- package/esm/timeline/hooks/useTimelineRows.d.ts +5 -1
- package/esm/timeline/hooks/useTimelineRows.js +14 -3
- package/esm/timeline/hooks/useTimelineRows.js.map +1 -1
- package/esm/timeline/period/ClickablePeriod.js +5 -2
- package/esm/timeline/period/ClickablePeriod.js.map +1 -1
- package/esm/tooltip/Tooltip.js +6 -3
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/util/i18n/i18n.context.d.ts +1 -1
- package/esm/util/i18n/i18n.context.js +15 -14
- package/esm/util/i18n/i18n.context.js.map +1 -1
- package/esm/util/i18n/locales/en.d.ts +50 -54
- package/esm/util/i18n/locales/en.js +52 -56
- package/esm/util/i18n/locales/en.js.map +1 -1
- package/esm/util/i18n/locales/index.d.ts +3 -0
- package/esm/util/i18n/locales/index.js +5 -0
- package/esm/util/i18n/locales/index.js.map +1 -0
- package/esm/util/i18n/locales/nb.d.ts +53 -57
- package/esm/util/i18n/locales/nb.js +56 -60
- package/esm/util/i18n/locales/nb.js.map +1 -1
- package/esm/util/i18n/locales/nn.d.ts +50 -54
- package/esm/util/i18n/locales/nn.js +52 -56
- package/esm/util/i18n/locales/nn.js.map +1 -1
- package/package.json +14 -4
- package/src/chips/Removable.tsx +1 -9
- package/src/date/context/index.ts +5 -1
- package/src/date/context/useDateInputContext.tsx +6 -4
- package/src/date/context/useDateTranslationContext.ts +9 -0
- package/src/date/datepicker/DatePicker.tsx +41 -32
- package/src/date/datepicker/DatePickerStandalone.tsx +46 -37
- package/src/date/datepicker/parts/Caption.tsx +2 -3
- package/src/date/datepicker/parts/DropdownCaption.tsx +3 -3
- package/src/date/datepicker/parts/WeekNumber.tsx +3 -9
- package/src/date/datepicker/parts/WeekRow.tsx +2 -3
- package/src/date/datepicker/types.ts +8 -0
- package/src/date/monthpicker/MonthCaption.tsx +2 -4
- package/src/date/monthpicker/MonthPicker.tsx +67 -54
- package/src/date/monthpicker/MonthPickerStandalone.tsx +39 -26
- package/src/date/monthpicker/types.ts +8 -0
- package/src/date/parts/DateInput.tsx +2 -3
- package/src/date/parts/DateWrapper.tsx +6 -4
- package/src/date/utils/index.ts +5 -1
- package/src/date/utils/locale.ts +17 -1
- package/src/form/combobox/ComboboxWrapper.tsx +6 -7
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +4 -4
- package/src/form/combobox/FilteredOptions/FilteredOptionsItem.tsx +1 -1
- package/src/form/combobox/FilteredOptions/MaxSelectedMessage.tsx +2 -9
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +4 -4
- package/src/form/combobox/Input/Input.context.tsx +1 -1
- package/src/form/combobox/Input/Input.tsx +10 -10
- package/src/form/combobox/Input/InputController.tsx +14 -25
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +14 -7
- package/src/form/combobox/types.ts +12 -20
- package/src/form/search/Search.tsx +3 -2
- package/src/form/textarea/Textarea.tsx +1 -0
- package/src/guide-panel/GuidePanel.tsx +59 -15
- package/src/guide-panel/Illustration.darkside.tsx +96 -0
- package/src/guide-panel/Illustration.tsx +2 -22
- package/src/guide-panel/index.ts +0 -1
- package/src/index.ts +1 -5
- package/src/layout/box/Box.darkside.tsx +19 -14
- package/src/layout/box/Box.tsx +4 -2
- package/src/layout/utilities/types.ts +20 -42
- package/src/modal/Modal.tsx +2 -2
- package/src/modal/ModalHeader.tsx +1 -1
- package/src/popover/Popover.tsx +2 -2
- package/src/provider/Provider.tsx +56 -13
- package/src/table/ExpandableRow.tsx +10 -3
- package/src/tag/Tag.tsx +32 -18
- package/src/timeline/Pin.tsx +16 -10
- package/src/timeline/Timeline.tsx +1 -0
- package/src/timeline/hooks/useTimelineRows.ts +25 -9
- package/src/timeline/period/ClickablePeriod.tsx +16 -10
- package/src/timeline/tests/useTimelineRows.test.ts +131 -0
- package/src/tooltip/Tooltip.tsx +7 -2
- package/src/util/i18n/i18n.context.test.tsx +29 -8
- package/src/util/i18n/i18n.context.ts +15 -14
- package/src/util/i18n/locales/en.ts +52 -56
- package/src/util/i18n/locales/index.ts +4 -0
- package/src/util/i18n/locales/nb.ts +56 -60
- package/src/util/i18n/locales/nn.ts +52 -56
- package/cjs/provider/i18n/LanguageProvider.d.ts +0 -26
- package/cjs/provider/i18n/LanguageProvider.js +0 -54
- package/cjs/provider/i18n/LanguageProvider.js.map +0 -1
- package/esm/provider/i18n/LanguageProvider.d.ts +0 -26
- package/esm/provider/i18n/LanguageProvider.js +0 -23
- package/esm/provider/i18n/LanguageProvider.js.map +0 -1
- package/src/provider/i18n/LanguageProvider.tsx +0 -49
|
@@ -5,6 +5,51 @@ export default {
|
|
|
5
5
|
showMore: "Vis meir",
|
|
6
6
|
showLess: "Vis mindre",
|
|
7
7
|
readOnly: "Skrivebeskytta",
|
|
8
|
+
close: "Lukk",
|
|
9
|
+
},
|
|
10
|
+
Alert: {
|
|
11
|
+
closeAlert: "Lukk varsel",
|
|
12
|
+
closeMessage: "Lukk melding",
|
|
13
|
+
error: "Feil",
|
|
14
|
+
info: "Informasjon",
|
|
15
|
+
success: "Suksess",
|
|
16
|
+
warning: "Åtvaring",
|
|
17
|
+
},
|
|
18
|
+
Chips: {
|
|
19
|
+
Removable: {
|
|
20
|
+
labelSuffix: "slett",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
Combobox: {
|
|
24
|
+
addOption: "Legg til",
|
|
25
|
+
loading: "Søker…",
|
|
26
|
+
maxSelected: "{selected} av maks {limit} er valt.",
|
|
27
|
+
},
|
|
28
|
+
CopyButton: {
|
|
29
|
+
title: "Kopier",
|
|
30
|
+
activeText: "Kopiert!",
|
|
31
|
+
},
|
|
32
|
+
DatePicker: {
|
|
33
|
+
chooseDate: "Vel dato",
|
|
34
|
+
chooseDates: "Vel datoar",
|
|
35
|
+
chooseDateRange: "Vel start- og sluttdato",
|
|
36
|
+
chooseMonth: "Vel månad",
|
|
37
|
+
week: "Veke",
|
|
38
|
+
weekNumber: "Veke {week}",
|
|
39
|
+
selectWeekNumber: "Vel veke {week}",
|
|
40
|
+
month: "Månad",
|
|
41
|
+
goToNextMonth: "Gå til neste månad",
|
|
42
|
+
goToPreviousMonth: "Gå til førre månad",
|
|
43
|
+
year: "År",
|
|
44
|
+
goToNextYear: "Gå til neste år",
|
|
45
|
+
goToPreviousYear: "Gå til førre år",
|
|
46
|
+
openDatePicker: "Opne datoveljar",
|
|
47
|
+
openMonthPicker: "Opne månadsveljar",
|
|
48
|
+
closeDatePicker: "Lukk datoveljar",
|
|
49
|
+
closeMonthPicker: "Lukk månadsveljar",
|
|
50
|
+
},
|
|
51
|
+
ErrorSummary: {
|
|
52
|
+
heading: "Du må rette desse feila før du kan halde fram:",
|
|
8
53
|
},
|
|
9
54
|
FileUpload: {
|
|
10
55
|
dropzone: {
|
|
@@ -29,35 +74,18 @@ export default {
|
|
|
29
74
|
showAllSteps: "Vis alle steg",
|
|
30
75
|
hideAllSteps: "Skjul alle steg",
|
|
31
76
|
},
|
|
32
|
-
Alert: {
|
|
33
|
-
closeAlert: "Lukk varsel",
|
|
34
|
-
closeMessage: "Lukk melding",
|
|
35
|
-
error: "Feil",
|
|
36
|
-
info: "Informasjon",
|
|
37
|
-
success: "Suksess",
|
|
38
|
-
warning: "Åtvaring",
|
|
39
|
-
},
|
|
40
|
-
Chips: {
|
|
41
|
-
Removable: {
|
|
42
|
-
labelSuffix: "slett",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
CopyButton: {
|
|
46
|
-
title: "Kopier",
|
|
47
|
-
activeText: "Kopiert!",
|
|
48
|
-
},
|
|
49
|
-
ErrorSummary: {
|
|
50
|
-
heading: "Du må rette desse feila før du kan halde fram:",
|
|
51
|
-
},
|
|
52
77
|
FormSummary: {
|
|
53
78
|
editAnswer: "Endre svar",
|
|
54
79
|
},
|
|
80
|
+
GuidePanel: {
|
|
81
|
+
illustrationLabel: "Illustrasjon av rettleiar",
|
|
82
|
+
},
|
|
83
|
+
HelpText: {
|
|
84
|
+
title: "Meir informasjon",
|
|
85
|
+
},
|
|
55
86
|
Loader: {
|
|
56
87
|
title: "Ventar…",
|
|
57
88
|
},
|
|
58
|
-
Modal: {
|
|
59
|
-
close: "Lukk",
|
|
60
|
-
},
|
|
61
89
|
Pagination: {
|
|
62
90
|
previous: "Førre",
|
|
63
91
|
next: "Neste",
|
|
@@ -67,7 +95,7 @@ export default {
|
|
|
67
95
|
progressUnknown: "Framdrift kan ikkje bereknast, antatt tid er {seconds} sekund.",
|
|
68
96
|
},
|
|
69
97
|
Search: {
|
|
70
|
-
clear: "Tøm",
|
|
98
|
+
clear: "Tøm feltet",
|
|
71
99
|
search: "Søk",
|
|
72
100
|
},
|
|
73
101
|
Textarea: {
|
|
@@ -100,37 +128,5 @@ export default {
|
|
|
100
128
|
reset: "Tilbakestill tidsperspektiv",
|
|
101
129
|
},
|
|
102
130
|
},
|
|
103
|
-
DatePicker: {
|
|
104
|
-
close: "Lukk",
|
|
105
|
-
chooseDate: "Vel dato",
|
|
106
|
-
chooseDates: "Vel datoar",
|
|
107
|
-
chooseDateRange: "Vel start- og sluttdato",
|
|
108
|
-
chooseMonth: "Vel månad",
|
|
109
|
-
week: "Veke",
|
|
110
|
-
weekNumber: "Veke {week}",
|
|
111
|
-
selectWeekNumber: "Vel veke {week}",
|
|
112
|
-
month: "Månad",
|
|
113
|
-
goToNextMonth: "Gå til neste månad",
|
|
114
|
-
goToPreviousMonth: "Gå til førre månad",
|
|
115
|
-
year: "År",
|
|
116
|
-
goToNextYear: "Gå til neste år",
|
|
117
|
-
goToPreviousYear: "Gå til førre år",
|
|
118
|
-
openDatePicker: "Opne datoveljar",
|
|
119
|
-
openMonthPicker: "Opne månadsveljar",
|
|
120
|
-
closeDatePicker: "Lukk datoveljar",
|
|
121
|
-
closeMonthPicker: "Lukk månadsveljar",
|
|
122
|
-
},
|
|
123
|
-
Combobox: {
|
|
124
|
-
addOption: "Legg til",
|
|
125
|
-
loading: "Søker…",
|
|
126
|
-
maxSelected: "{selected} av maks {limit} er valt.",
|
|
127
|
-
clear: "Tøm",
|
|
128
|
-
},
|
|
129
|
-
GuidePanel: {
|
|
130
|
-
illustrationLabel: "Illustrasjon av rettleiar",
|
|
131
|
-
},
|
|
132
|
-
HelpText: {
|
|
133
|
-
title: "Meir informasjon",
|
|
134
|
-
},
|
|
135
131
|
};
|
|
136
132
|
//# sourceMappingURL=nn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nn.js","sourceRoot":"","sources":["../../../../src/util/i18n/locales/nn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAGrC,eAAe;IACb,MAAM,EAAE;QACN,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"nn.js","sourceRoot":"","sources":["../../../../src/util/i18n/locales/nn.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.8.1",
|
|
4
4
|
"description": "React components from the Norwegian Labour and Welfare Administration.",
|
|
5
5
|
"author": "Aksel, a team part of the Norwegian Labour and Welfare Administration.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"react",
|
|
9
9
|
"typescript",
|
|
10
10
|
"javascript",
|
|
11
|
-
"
|
|
11
|
+
"Nav"
|
|
12
12
|
],
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -40,6 +40,16 @@
|
|
|
40
40
|
"default": "./cjs/index.js"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
+
"./locales": {
|
|
44
|
+
"import": {
|
|
45
|
+
"types": "./esm/util/i18n/locales/index.d.ts",
|
|
46
|
+
"default": "./esm/util/i18n/locales/index.js"
|
|
47
|
+
},
|
|
48
|
+
"require": {
|
|
49
|
+
"types": "./cjs/util/i18n/locales/index.d.ts",
|
|
50
|
+
"default": "./cjs/util/i18n/locales/index.js"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
43
53
|
"./Accordion": {
|
|
44
54
|
"import": {
|
|
45
55
|
"types": "./esm/accordion/index.d.ts",
|
|
@@ -604,8 +614,8 @@
|
|
|
604
614
|
"dependencies": {
|
|
605
615
|
"@floating-ui/react": "0.25.4",
|
|
606
616
|
"@floating-ui/react-dom": "^2.0.9",
|
|
607
|
-
"@navikt/aksel-icons": "^7.
|
|
608
|
-
"@navikt/ds-tokens": "^7.
|
|
617
|
+
"@navikt/aksel-icons": "^7.8.1",
|
|
618
|
+
"@navikt/ds-tokens": "^7.8.1",
|
|
609
619
|
"clsx": "^2.1.0",
|
|
610
620
|
"date-fns": "^3.0.0",
|
|
611
621
|
"react-day-picker": "8.10.1"
|
package/src/chips/Removable.tsx
CHANGED
|
@@ -16,11 +16,6 @@ export interface ChipsRemovableProps
|
|
|
16
16
|
* Click callback
|
|
17
17
|
*/
|
|
18
18
|
onDelete?: () => void;
|
|
19
|
-
/**
|
|
20
|
-
* Replaces label read for screen-readers
|
|
21
|
-
* @default "slett"
|
|
22
|
-
*/
|
|
23
|
-
removeLabel?: string;
|
|
24
19
|
}
|
|
25
20
|
|
|
26
21
|
export const RemovableChips = forwardRef<
|
|
@@ -32,7 +27,6 @@ export const RemovableChips = forwardRef<
|
|
|
32
27
|
children,
|
|
33
28
|
variant = "action",
|
|
34
29
|
onDelete,
|
|
35
|
-
removeLabel,
|
|
36
30
|
className,
|
|
37
31
|
onClick,
|
|
38
32
|
type = "button",
|
|
@@ -51,9 +45,7 @@ export const RemovableChips = forwardRef<
|
|
|
51
45
|
className,
|
|
52
46
|
`navds-chips__removable--${variant}`,
|
|
53
47
|
)}
|
|
54
|
-
aria-label={`${children} ${
|
|
55
|
-
removeLabel ?? translate("Removable.labelSuffix")
|
|
56
|
-
}`}
|
|
48
|
+
aria-label={`${children} ${translate("Removable.labelSuffix")}`}
|
|
57
49
|
onClick={composeEventHandlers(onClick, onDelete)}
|
|
58
50
|
>
|
|
59
51
|
<span className="navds-chips__chip-text">{children}</span>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export { useDateInputContext,
|
|
1
|
+
export { useDateInputContext, DateInputContext } from "./useDateInputContext";
|
|
2
2
|
export {
|
|
3
3
|
useSharedMonthContext,
|
|
4
4
|
SharedMonthProvider,
|
|
5
5
|
} from "./useSharedMonthContext";
|
|
6
|
+
export {
|
|
7
|
+
useDateTranslationContext,
|
|
8
|
+
DateTranslationContextProvider,
|
|
9
|
+
} from "./useDateTranslationContext";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface DateInputContextProps {
|
|
4
4
|
/**
|
|
5
5
|
* Open state for popover
|
|
6
6
|
*/
|
|
@@ -19,13 +19,15 @@ interface DateContextContextProps {
|
|
|
19
19
|
defined: boolean;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const
|
|
22
|
+
export const DateInputContext = createContext<DateInputContextProps | null>(
|
|
23
|
+
null,
|
|
24
|
+
);
|
|
23
25
|
|
|
24
26
|
export const useDateInputContext = () => {
|
|
25
|
-
const context = useContext(
|
|
27
|
+
const context = useContext(DateInputContext);
|
|
26
28
|
|
|
27
29
|
if (!context) {
|
|
28
|
-
console.warn("useDateInputContext must be used with
|
|
30
|
+
console.warn("useDateInputContext must be used with DateInputContext");
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
return context;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from "../../util/create-context";
|
|
2
|
+
import { TFunction } from "../../util/i18n/i18n.context";
|
|
3
|
+
|
|
4
|
+
interface DateTranslationContextProps {
|
|
5
|
+
translate: TFunction<"DatePicker">;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const [DateTranslationContextProvider, useDateTranslationContext] =
|
|
9
|
+
createContext<DateTranslationContextProps>();
|
|
@@ -5,11 +5,11 @@ import { DateRange, DayPicker, isMatch } from "react-day-picker";
|
|
|
5
5
|
import { omit } from "../../util";
|
|
6
6
|
import { useId } from "../../util/hooks";
|
|
7
7
|
import { useMergeRefs } from "../../util/hooks/useMergeRefs";
|
|
8
|
-
import { useDateLocale } from "../../util/i18n/i18n.context";
|
|
9
|
-
import {
|
|
8
|
+
import { useDateLocale, useI18n } from "../../util/i18n/i18n.context";
|
|
9
|
+
import { DateInputContext, DateTranslationContextProvider } from "../context";
|
|
10
10
|
import { DatePickerInput } from "../parts/DateInput";
|
|
11
11
|
import { DateWrapper } from "../parts/DateWrapper";
|
|
12
|
-
import { getLocaleFromString } from "../utils";
|
|
12
|
+
import { getLocaleFromString, getTranslations } from "../utils";
|
|
13
13
|
import DatePickerStandalone from "./DatePickerStandalone";
|
|
14
14
|
import Caption from "./parts/Caption";
|
|
15
15
|
import DropdownCaption from "./parts/DropdownCaption";
|
|
@@ -68,6 +68,7 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
|
68
68
|
{
|
|
69
69
|
children,
|
|
70
70
|
locale,
|
|
71
|
+
translations,
|
|
71
72
|
dropdownCaption,
|
|
72
73
|
disabled = [],
|
|
73
74
|
disableWeekends = false,
|
|
@@ -86,6 +87,11 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
|
86
87
|
},
|
|
87
88
|
ref,
|
|
88
89
|
) => {
|
|
90
|
+
const translate = useI18n(
|
|
91
|
+
"DatePicker",
|
|
92
|
+
translations,
|
|
93
|
+
getTranslations(locale),
|
|
94
|
+
);
|
|
89
95
|
const langProviderLocale = useDateLocale();
|
|
90
96
|
const ariaId = useId(id);
|
|
91
97
|
const [open, setOpen] = useState(_open ?? false);
|
|
@@ -151,37 +157,40 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
|
151
157
|
);
|
|
152
158
|
|
|
153
159
|
return (
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<div
|
|
166
|
-
ref={mergedRef}
|
|
167
|
-
className={cl("navds-date__wrapper", wrapperClassName)}
|
|
160
|
+
<DateTranslationContextProvider translate={translate}>
|
|
161
|
+
<DateInputContext.Provider
|
|
162
|
+
value={{
|
|
163
|
+
open: _open ?? open,
|
|
164
|
+
onOpen: () => {
|
|
165
|
+
setOpen((x) => !x);
|
|
166
|
+
onOpenToggle?.();
|
|
167
|
+
},
|
|
168
|
+
ariaId,
|
|
169
|
+
defined: true,
|
|
170
|
+
}}
|
|
168
171
|
>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
anchor={wrapperRef}
|
|
173
|
-
onClose={() => onClose?.() ?? setOpen(false)}
|
|
174
|
-
locale={locale}
|
|
175
|
-
variant={mode}
|
|
176
|
-
popoverProps={{
|
|
177
|
-
id: ariaId,
|
|
178
|
-
strategy,
|
|
179
|
-
}}
|
|
172
|
+
<div
|
|
173
|
+
ref={mergedRef}
|
|
174
|
+
className={cl("navds-date__wrapper", wrapperClassName)}
|
|
180
175
|
>
|
|
181
|
-
{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
176
|
+
{children}
|
|
177
|
+
<DateWrapper
|
|
178
|
+
open={_open ?? open}
|
|
179
|
+
anchor={wrapperRef}
|
|
180
|
+
onClose={() => onClose?.() ?? setOpen(false)}
|
|
181
|
+
locale={locale}
|
|
182
|
+
translate={translate}
|
|
183
|
+
variant={mode}
|
|
184
|
+
popoverProps={{
|
|
185
|
+
id: ariaId,
|
|
186
|
+
strategy,
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
{DatePickerComponent}
|
|
190
|
+
</DateWrapper>
|
|
191
|
+
</div>
|
|
192
|
+
</DateInputContext.Provider>
|
|
193
|
+
</DateTranslationContextProvider>
|
|
185
194
|
);
|
|
186
195
|
},
|
|
187
196
|
) as DatePickerComponent;
|
|
@@ -3,8 +3,9 @@ import { isWeekend } from "date-fns";
|
|
|
3
3
|
import React, { forwardRef } from "react";
|
|
4
4
|
import { DateRange, DayPicker, isMatch } from "react-day-picker";
|
|
5
5
|
import { omit } from "../../util";
|
|
6
|
-
import { useDateLocale } from "../../util/i18n/i18n.context";
|
|
7
|
-
import {
|
|
6
|
+
import { useDateLocale, useI18n } from "../../util/i18n/i18n.context";
|
|
7
|
+
import { DateTranslationContextProvider } from "../context";
|
|
8
|
+
import { getLocaleFromString, getTranslations } from "../utils";
|
|
8
9
|
import Caption from "./parts/Caption";
|
|
9
10
|
import DropdownCaption from "./parts/DropdownCaption";
|
|
10
11
|
import { HeadRow } from "./parts/HeadRow";
|
|
@@ -51,6 +52,7 @@ export const DatePickerStandalone: DatePickerStandaloneType = forwardRef<
|
|
|
51
52
|
{
|
|
52
53
|
className,
|
|
53
54
|
locale,
|
|
55
|
+
translations,
|
|
54
56
|
dropdownCaption,
|
|
55
57
|
disabled = [],
|
|
56
58
|
disableWeekends = false,
|
|
@@ -64,6 +66,11 @@ export const DatePickerStandalone: DatePickerStandaloneType = forwardRef<
|
|
|
64
66
|
},
|
|
65
67
|
ref,
|
|
66
68
|
) => {
|
|
69
|
+
const translate = useI18n(
|
|
70
|
+
"DatePicker",
|
|
71
|
+
translations,
|
|
72
|
+
getTranslations(locale),
|
|
73
|
+
);
|
|
67
74
|
const langProviderLocale = useDateLocale();
|
|
68
75
|
const [selectedDates, setSelectedDates] = React.useState<
|
|
69
76
|
Date | Date[] | DateRange | undefined
|
|
@@ -84,41 +91,43 @@ export const DatePickerStandalone: DatePickerStandaloneType = forwardRef<
|
|
|
84
91
|
ref={ref}
|
|
85
92
|
className={cl("navds-date__standalone-wrapper", className)}
|
|
86
93
|
>
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
94
|
+
<DateTranslationContextProvider translate={translate}>
|
|
95
|
+
<DayPicker
|
|
96
|
+
locale={locale ? getLocaleFromString(locale) : langProviderLocale}
|
|
97
|
+
mode={mode}
|
|
98
|
+
onSelect={handleSelect}
|
|
99
|
+
selected={selected ?? selectedDates}
|
|
100
|
+
components={{
|
|
101
|
+
Caption: dropdownCaption ? DropdownCaption : Caption,
|
|
102
|
+
Head: TableHead,
|
|
103
|
+
HeadRow,
|
|
104
|
+
WeekNumber,
|
|
105
|
+
Row,
|
|
106
|
+
}}
|
|
107
|
+
className="navds-date"
|
|
108
|
+
classNames={{ vhidden: "navds-sr-only" }}
|
|
109
|
+
disabled={(day) => {
|
|
110
|
+
return (
|
|
111
|
+
(disableWeekends && isWeekend(day)) || isMatch(day, disabled)
|
|
112
|
+
);
|
|
113
|
+
}}
|
|
114
|
+
weekStartsOn={1}
|
|
115
|
+
initialFocus={false}
|
|
116
|
+
modifiers={{
|
|
117
|
+
weekend: (day) => disableWeekends && isWeekend(day),
|
|
118
|
+
}}
|
|
119
|
+
modifiersClassNames={{
|
|
120
|
+
weekend: "rdp-day__weekend",
|
|
121
|
+
}}
|
|
122
|
+
showWeekNumber={showWeekNumber}
|
|
123
|
+
onWeekNumberClick={
|
|
124
|
+
mode === "multiple" ? onWeekNumberClick : undefined
|
|
125
|
+
}
|
|
126
|
+
fixedWeeks={fixedWeeks}
|
|
127
|
+
showOutsideDays
|
|
128
|
+
{...omit(rest, ["children", "id"])}
|
|
129
|
+
/>
|
|
130
|
+
</DateTranslationContextProvider>
|
|
122
131
|
</div>
|
|
123
132
|
);
|
|
124
133
|
},
|
|
@@ -3,8 +3,7 @@ import { CaptionProps, useDayPicker, useNavigation } from "react-day-picker";
|
|
|
3
3
|
import { ArrowLeftIcon, ArrowRightIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { Button } from "../../../button";
|
|
5
5
|
import { Label } from "../../../typography";
|
|
6
|
-
import {
|
|
7
|
-
import { getTranslations } from "../../utils";
|
|
6
|
+
import { useDateTranslationContext } from "../../context";
|
|
8
7
|
import WeekRow from "./WeekRow";
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -16,7 +15,7 @@ export const DatePickerCaption = ({ displayMonth, id }: CaptionProps) => {
|
|
|
16
15
|
formatters: { formatCaption },
|
|
17
16
|
locale,
|
|
18
17
|
} = useDayPicker();
|
|
19
|
-
const translate =
|
|
18
|
+
const translate = useDateTranslationContext().translate;
|
|
20
19
|
|
|
21
20
|
return (
|
|
22
21
|
<>
|
|
@@ -4,8 +4,8 @@ import { CaptionProps, useDayPicker, useNavigation } from "react-day-picker";
|
|
|
4
4
|
import { ArrowLeftIcon, ArrowRightIcon } from "@navikt/aksel-icons";
|
|
5
5
|
import { Button } from "../../../button";
|
|
6
6
|
import { Select } from "../../../form/select";
|
|
7
|
-
import {
|
|
8
|
-
import { getMonths,
|
|
7
|
+
import { useDateTranslationContext } from "../../context";
|
|
8
|
+
import { getMonths, getYears } from "../../utils";
|
|
9
9
|
import WeekRow from "./WeekRow";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -19,7 +19,7 @@ export const DropdownCaption = ({ displayMonth, id }: CaptionProps) => {
|
|
|
19
19
|
formatters: { formatYearCaption, formatMonthCaption, formatCaption },
|
|
20
20
|
locale,
|
|
21
21
|
} = useDayPicker();
|
|
22
|
-
const translate =
|
|
22
|
+
const translate = useDateTranslationContext().translate;
|
|
23
23
|
|
|
24
24
|
if (!fromDate || !toDate) {
|
|
25
25
|
console.warn("Using dropdownCaption required fromDate and toDate");
|
|
@@ -4,8 +4,7 @@ import { Button as RDPButton, useDayPicker } from "react-day-picker";
|
|
|
4
4
|
import { Button } from "../../../button";
|
|
5
5
|
import { UNSAFE_useAkselTheme } from "../../../provider";
|
|
6
6
|
import { Detail } from "../../../typography";
|
|
7
|
-
import {
|
|
8
|
-
import { getTranslations } from "../../utils";
|
|
7
|
+
import { useDateTranslationContext } from "../../context";
|
|
9
8
|
|
|
10
9
|
export interface WeekNumberProps {
|
|
11
10
|
/** The number of the week. */
|
|
@@ -21,14 +20,9 @@ function WeekNumber({
|
|
|
21
20
|
number: weekNumber,
|
|
22
21
|
dates,
|
|
23
22
|
}: WeekNumberProps): JSX.Element {
|
|
24
|
-
const {
|
|
25
|
-
onWeekNumberClick,
|
|
26
|
-
styles,
|
|
27
|
-
classNames,
|
|
28
|
-
locale: { code },
|
|
29
|
-
} = useDayPicker();
|
|
23
|
+
const { onWeekNumberClick, styles, classNames } = useDayPicker();
|
|
30
24
|
const themeContext = UNSAFE_useAkselTheme(false);
|
|
31
|
-
const translate =
|
|
25
|
+
const translate = useDateTranslationContext().translate;
|
|
32
26
|
|
|
33
27
|
if (!onWeekNumberClick) {
|
|
34
28
|
return (
|
|
@@ -3,14 +3,13 @@ import { useDayPicker } from "react-day-picker";
|
|
|
3
3
|
import { Show } from "../../../layout/responsive";
|
|
4
4
|
import { Detail } from "../../../typography";
|
|
5
5
|
import { useId } from "../../../util/hooks";
|
|
6
|
-
import {
|
|
7
|
-
import { getTranslations } from "../../utils";
|
|
6
|
+
import { useDateTranslationContext } from "../../context";
|
|
8
7
|
import { getMonthWeeks } from "../../utils/get-month-weeks";
|
|
9
8
|
import WeekNumber from "./WeekNumber";
|
|
10
9
|
|
|
11
10
|
const WeekRow = ({ displayMonth }: { displayMonth: Date }) => {
|
|
12
11
|
const { locale, fixedWeeks, onWeekNumberClick } = useDayPicker();
|
|
13
|
-
const translate =
|
|
12
|
+
const translate = useDateTranslationContext().translate;
|
|
14
13
|
const labelId = useId();
|
|
15
14
|
|
|
16
15
|
if (!onWeekNumberClick) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DateRange, DayPickerBase, Matcher } from "react-day-picker";
|
|
2
|
+
import { ComponentTranslation } from "../../util/i18n/i18n.types";
|
|
2
3
|
|
|
3
4
|
export type SingleMode = {
|
|
4
5
|
mode?: "single";
|
|
@@ -52,8 +53,15 @@ export interface DatePickerDefaultProps
|
|
|
52
53
|
/**
|
|
53
54
|
* Changes datepicker locale
|
|
54
55
|
* @default "nb" (norsk bokmål)
|
|
56
|
+
* @deprecated Use `<Provider />`-component
|
|
55
57
|
*/
|
|
56
58
|
locale?: "nb" | "nn" | "en";
|
|
59
|
+
/**
|
|
60
|
+
* i18n-API for customizing texts and labels.
|
|
61
|
+
*
|
|
62
|
+
* **NB: If you need to change the language, use [Provider](https://aksel.nav.no/komponenter/core/provider#84d7ea5ec517) instead.**
|
|
63
|
+
*/
|
|
64
|
+
translations?: ComponentTranslation<"DatePicker">;
|
|
57
65
|
/**
|
|
58
66
|
* The earliest day to start navigation.
|
|
59
67
|
*/
|
|
@@ -10,9 +10,7 @@ import { useDayPicker } from "react-day-picker";
|
|
|
10
10
|
import { ArrowLeftIcon, ArrowRightIcon } from "@navikt/aksel-icons";
|
|
11
11
|
import { Button } from "../../button";
|
|
12
12
|
import { Select } from "../../form/select";
|
|
13
|
-
import {
|
|
14
|
-
import { useSharedMonthContext } from "../context";
|
|
15
|
-
import { getTranslations } from "../utils";
|
|
13
|
+
import { useDateTranslationContext, useSharedMonthContext } from "../context";
|
|
16
14
|
|
|
17
15
|
export const MonthCaption = () => {
|
|
18
16
|
const {
|
|
@@ -22,7 +20,7 @@ export const MonthCaption = () => {
|
|
|
22
20
|
locale,
|
|
23
21
|
} = useDayPicker();
|
|
24
22
|
const { hasDropdown, year, toYear } = useSharedMonthContext();
|
|
25
|
-
const translate =
|
|
23
|
+
const translate = useDateTranslationContext().translate;
|
|
26
24
|
|
|
27
25
|
const years: Date[] = [];
|
|
28
26
|
|