@navikt/ds-react 6.8.0 → 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/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/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/index.d.ts +1 -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.js +12 -22
- 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/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/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/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/index.d.ts +1 -1
- 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.js +13 -23
- 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/omit.js +2 -3
- package/esm/util/omit.js.map +1 -1
- package/package.json +3 -3
- package/src/chat/Bubble.tsx +4 -4
- package/src/chat/Chat.tsx +6 -4
- 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/parts/item/ItemIcon.tsx +3 -1
- package/src/form/file-upload/utils/is-accepted-file-type.ts +4 -1
- package/src/index.ts +1 -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 +29 -35
- 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/util/omit.ts +5 -9
- 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/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/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/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
|
@@ -62,12 +62,10 @@ const axisLabels = (start, end, direction, templates) => {
|
|
|
62
62
|
if (totalDays < 40) {
|
|
63
63
|
return dayLabels(start, end, totalDays, direction, templates === null || templates === void 0 ? void 0 : templates.day);
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
if (totalDays < 370) {
|
|
66
66
|
return monthLabels(start, end, direction, templates === null || templates === void 0 ? void 0 : templates.month);
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
return yearLabels(start, end, direction, templates === null || templates === void 0 ? void 0 : templates.year);
|
|
70
|
-
}
|
|
68
|
+
return yearLabels(start, end, direction, templates === null || templates === void 0 ? void 0 : templates.year);
|
|
71
69
|
};
|
|
72
70
|
export const AxisLabels = ({ templates, }) => {
|
|
73
71
|
const { endDate, startDate, direction } = useTimelineContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AxisLabels.js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AC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,SAAS,GAGV,EAAE,EAAE;IACH,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAC/D,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,MAAM,CACxE,SAAS,CACV,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,4BAA4B,iBAAa,MAAM,IAC3D,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACvB,oBAAC,MAAM,IACL,SAAS,EAAC,kCAAkC,EAC5C,EAAE,EAAC,KAAK,EACR,GAAG,EAAE,OAAO,CAAC,KAAK,EAClB,KAAK,EAAE;YACL,cAAc,EAAE,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU;YAChE,CAAC,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,kBAAkB,GAAG;YAC7C,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,GAAG;SAC3B,IAEA,OAAO,CAAC,KAAK,CACP,CACV,CAAC,CACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
package/esm/util/debounce.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/util/debounce.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,oFAAoF;AACpF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG;IAC/C,IAAI,
|
|
1
|
+
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/util/debounce.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,oFAAoF;AACpF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG;IAC/C,IAAI,OAAsC,CAAC;IAC3C,SAAS,SAAS,CAAY,GAAG,IAAI;QACnC,MAAM,KAAK,GAAG,GAAG,EAAE;YACjB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC;QACF,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,SAAS,CAAC,KAAK,GAAG,GAAG,EAAE;QACrB,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -22,9 +22,7 @@ export function sortNodes(nodes) {
|
|
|
22
22
|
compare & Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC) {
|
|
23
23
|
throw Error("Cannot sort the given nodes.");
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
return 0;
|
|
27
|
-
}
|
|
25
|
+
return 0;
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
28
|
export const isElement = (el) => typeof el == "object" &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/util/hooks/descendants/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACzB,MAAM,OAAO,GAAG,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;QAE7C,IACE,OAAO,GAAG,IAAI,CAAC,2BAA2B;YAC1C,OAAO,GAAG,IAAI,CAAC,8BAA8B,EAC7C,CAAC;YACD,QAAQ;YACR,OAAO,CAAC,CAAC,CAAC;QACZ,CAAC;QAED,IACE,OAAO,GAAG,IAAI,CAAC,2BAA2B;YAC1C,OAAO,GAAG,IAAI,CAAC,0BAA0B,EACzC,CAA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,OAAO,GAAG,CAAC,CAAC;IACvB,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG;QAAE,IAAI,GAAG,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,GAAW,EAAE,IAAa;IACtE,IAAI,IAAI,GAAG,OAAO,GAAG,CAAC,CAAC;IACvB,IAAI,IAAI,IAAI,IAAI,GAAG,CAAC;QAAE,IAAI,GAAG,GAAG,CAAC;IACjC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,CAAI,KAAU,EAAE,EAAE,CAAC,KAAU,CAAC"}
|
package/esm/util/omit.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export function omit(obj, props) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
.reduce((prevObj, [key, value]) => (Object.assign(Object.assign({}, prevObj), { [key]: value })), {});
|
|
2
|
+
const filteredEntries = Object.entries(obj).filter(([key]) => !props.includes(key));
|
|
3
|
+
return Object.fromEntries(filteredEntries);
|
|
5
4
|
}
|
|
6
5
|
//# sourceMappingURL=omit.js.map
|
package/esm/util/omit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/util/omit.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,IAAI,CAClB,GAAM,EACN,KAAU;IAEV,
|
|
1
|
+
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/util/omit.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,IAAI,CAClB,GAAM,EACN,KAAU;IAEV,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAChD,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAQ,CAAC,CACrC,CAAC;IAEF,OAAO,MAAM,CAAC,WAAW,CAAC,eAAe,CAAe,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.9.0",
|
|
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",
|
|
@@ -594,8 +594,8 @@
|
|
|
594
594
|
"dependencies": {
|
|
595
595
|
"@floating-ui/react": "0.25.4",
|
|
596
596
|
"@floating-ui/react-dom": "^2.0.9",
|
|
597
|
-
"@navikt/aksel-icons": "^6.
|
|
598
|
-
"@navikt/ds-tokens": "^6.
|
|
597
|
+
"@navikt/aksel-icons": "^6.9.0",
|
|
598
|
+
"@navikt/ds-tokens": "^6.9.0",
|
|
599
599
|
"clsx": "^2.1.0",
|
|
600
600
|
"date-fns": "^3.0.0",
|
|
601
601
|
"react-day-picker": "8.10.0"
|
package/src/chat/Bubble.tsx
CHANGED
|
@@ -4,19 +4,19 @@ import { Detail } from "../typography";
|
|
|
4
4
|
|
|
5
5
|
export interface ChatBubbleProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
/**
|
|
7
|
-
* Bubble text
|
|
7
|
+
* Bubble text.
|
|
8
8
|
*/
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Name/sender on bubble.
|
|
12
12
|
*/
|
|
13
13
|
name?: string;
|
|
14
14
|
/**
|
|
15
|
-
* Timestamp for sent message
|
|
15
|
+
* Timestamp for sent message.
|
|
16
16
|
*/
|
|
17
17
|
timestamp?: string;
|
|
18
18
|
/**
|
|
19
|
-
* Overrides hoizontal position of toptext
|
|
19
|
+
* Overrides hoizontal position of toptext.
|
|
20
20
|
*/
|
|
21
21
|
toptextPosition?: "left" | "right";
|
|
22
22
|
}
|
package/src/chat/Chat.tsx
CHANGED
|
@@ -13,15 +13,17 @@ export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
*/
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Name/sender on first bubble.
|
|
17
17
|
*/
|
|
18
18
|
name?: string;
|
|
19
19
|
/**
|
|
20
|
-
* Timestamp
|
|
20
|
+
* Timestamp on first bubble.
|
|
21
21
|
*/
|
|
22
22
|
timestamp?: string;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* We recommend using an SVG or plain text initials as avatar.
|
|
25
|
+
*
|
|
26
|
+
* **Hidden for screen readers.**
|
|
25
27
|
*/
|
|
26
28
|
avatar?: React.ReactNode;
|
|
27
29
|
/**
|
|
@@ -58,7 +60,7 @@ interface ChatComponent
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
/**
|
|
61
|
-
* A component for communicating
|
|
63
|
+
* A component for communicating a dialog between two or more parties.
|
|
62
64
|
*
|
|
63
65
|
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/chat)
|
|
64
66
|
* @see 🏷️ {@link ChatProps}
|
|
@@ -26,9 +26,13 @@ const disableMonth = (month: Date, fromDate?: Date, toDate?: Date) => {
|
|
|
26
26
|
(compareAsc(month, fromDate) === -1 && !isSameMonth(month, fromDate)) ||
|
|
27
27
|
(compareDesc(month, toDate) === -1 && !isSameMonth(month, toDate))
|
|
28
28
|
);
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (fromDate) {
|
|
30
32
|
return compareAsc(month, fromDate) === -1 && !isSameMonth(month, fromDate);
|
|
31
|
-
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (toDate) {
|
|
32
36
|
return compareDesc(month, toDate) === -1 && !isSameMonth(month, toDate);
|
|
33
37
|
}
|
|
34
38
|
return false;
|
|
@@ -8,6 +8,6 @@ export const dateIsInCurrentMonth = (
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
/** @private */
|
|
11
|
-
export function isValidDate(day
|
|
12
|
-
return day && !isNaN(day
|
|
11
|
+
export function isValidDate(day?: Date): boolean {
|
|
12
|
+
return !!(day && !Number.isNaN(day.getTime()) && day.getFullYear() > 999);
|
|
13
13
|
}
|
|
@@ -9,7 +9,9 @@ export const disableDate = (
|
|
|
9
9
|
let result: boolean = false;
|
|
10
10
|
if (disabledSelection instanceof Date) {
|
|
11
11
|
return isSameDay(disabledSelection, date);
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (Array.isArray(disabledSelection)) {
|
|
13
15
|
for (let i = 0; i < disabledSelection.length; i++) {
|
|
14
16
|
const selection = disabledSelection[i];
|
|
15
17
|
if (isDateRange(selection)) {
|
|
@@ -2,7 +2,7 @@ import { setYear } from "date-fns";
|
|
|
2
2
|
import { Matcher, isMatch } from "./is-match";
|
|
3
3
|
|
|
4
4
|
export const nextEnabled = (
|
|
5
|
-
months,
|
|
5
|
+
months: Date[],
|
|
6
6
|
key: string,
|
|
7
7
|
disabled: Matcher[],
|
|
8
8
|
currentMonth: Date,
|
|
@@ -258,13 +258,13 @@ const isOutOfRange = (
|
|
|
258
258
|
|
|
259
259
|
const nextOnRow = (
|
|
260
260
|
currentIndex: number,
|
|
261
|
-
months,
|
|
261
|
+
months: Date[],
|
|
262
262
|
yearState: Date,
|
|
263
263
|
disabled: Matcher[],
|
|
264
264
|
mode: "home" | "end",
|
|
265
265
|
) => {
|
|
266
266
|
const row = getRow(currentIndex);
|
|
267
|
-
let monthsOfRow;
|
|
267
|
+
let monthsOfRow: Date[] = [];
|
|
268
268
|
|
|
269
269
|
switch (row) {
|
|
270
270
|
case 1:
|
|
@@ -29,7 +29,7 @@ export const parseDate = (
|
|
|
29
29
|
type: "date" | "month",
|
|
30
30
|
allowTwoDigitYear: boolean,
|
|
31
31
|
): Date => {
|
|
32
|
-
let parsed;
|
|
32
|
+
let parsed: Date;
|
|
33
33
|
const ALLOWED_FORMATS =
|
|
34
34
|
type === "date" ? ALLOWED_INPUT_FORMATS_DATE : ALLOWED_INPUT_FORMATS_MONTH;
|
|
35
35
|
|
|
@@ -43,6 +43,7 @@ export const parseDate = (
|
|
|
43
43
|
return parsed;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
|
|
46
47
|
for (const format of [
|
|
47
48
|
...ALLOWED_FORMATS.map((x) => x.replace("yyyy", "yy")),
|
|
48
49
|
]) {
|
|
@@ -55,28 +56,33 @@ export const parseDate = (
|
|
|
55
56
|
|
|
56
57
|
if (isValidDate(new Date(convertedDate))) {
|
|
57
58
|
return new Date(convertedDate);
|
|
58
|
-
} else {
|
|
59
|
-
return new Date("Invalid date");
|
|
60
59
|
}
|
|
60
|
+
return new Date("Invalid date");
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
return new Date("Invalid date");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
for (const format of ALLOWED_FORMATS) {
|
|
67
|
+
parsed = parse(date, format, today, { locale });
|
|
68
|
+
if (
|
|
69
|
+
isValidDate(parsed) &&
|
|
70
|
+
!isTwoDigitYear(date, today, locale, ALLOWED_FORMATS)
|
|
71
|
+
) {
|
|
72
|
+
return parsed;
|
|
73
73
|
}
|
|
74
|
-
return new Date("Invalid date");
|
|
75
74
|
}
|
|
75
|
+
|
|
76
|
+
return new Date("Invalid date");
|
|
76
77
|
};
|
|
77
78
|
|
|
78
|
-
function isTwoDigitYear(
|
|
79
|
-
|
|
79
|
+
function isTwoDigitYear(
|
|
80
|
+
dateString: string,
|
|
81
|
+
today: Date,
|
|
82
|
+
locale: Locale,
|
|
83
|
+
formats: string[],
|
|
84
|
+
) {
|
|
85
|
+
let parsed: Date;
|
|
80
86
|
const newFormat = formats.map((x) => x.replace("yyyy", "yy"));
|
|
81
87
|
for (const format of newFormat) {
|
|
82
88
|
parsed = parse(dateString, format, today, { locale });
|
|
@@ -83,29 +83,27 @@ const FilteredOptionsProvider = ({
|
|
|
83
83
|
const [isMouseLastUsedInputDevice, setIsMouseLastUsedInputDevice] =
|
|
84
84
|
useState(false);
|
|
85
85
|
|
|
86
|
-
const filteredOptionsMap = useMemo(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
[allowNewValues, customOptions, id, options, value],
|
|
108
|
-
);
|
|
86
|
+
const filteredOptionsMap = useMemo(() => {
|
|
87
|
+
const initialMap = {
|
|
88
|
+
[filteredOptionsUtils.getAddNewOptionId(id)]: allowNewValues
|
|
89
|
+
? toComboboxOption(value)
|
|
90
|
+
: undefined,
|
|
91
|
+
...customOptions.reduce((acc, customOption) => {
|
|
92
|
+
const _id = filteredOptionsUtils.getOptionId(id, customOption.label);
|
|
93
|
+
acc[_id] = customOption;
|
|
94
|
+
return acc;
|
|
95
|
+
}, {}),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Add the options to the map
|
|
99
|
+
const finalMap = options.reduce((map, _option) => {
|
|
100
|
+
const _id = filteredOptionsUtils.getOptionId(id, _option.label);
|
|
101
|
+
map[_id] = _option;
|
|
102
|
+
return map;
|
|
103
|
+
}, initialMap);
|
|
104
|
+
|
|
105
|
+
return finalMap;
|
|
106
|
+
}, [allowNewValues, customOptions, id, options, value]);
|
|
109
107
|
|
|
110
108
|
useClientLayoutEffect(() => {
|
|
111
109
|
if (
|
|
@@ -148,7 +146,7 @@ const FilteredOptionsProvider = ({
|
|
|
148
146
|
);
|
|
149
147
|
|
|
150
148
|
const ariaDescribedBy = useMemo(() => {
|
|
151
|
-
let activeOption;
|
|
149
|
+
let activeOption: string = "";
|
|
152
150
|
if (!isLoading && filteredOptions.length === 0 && !allowNewValues) {
|
|
153
151
|
activeOption = filteredOptionsUtils.getNoHitsId(id);
|
|
154
152
|
} else if (value || isLoading) {
|
|
@@ -164,6 +162,7 @@ const FilteredOptionsProvider = ({
|
|
|
164
162
|
const maybeMaxSelectedOptionsId =
|
|
165
163
|
maxSelected?.isLimitReached &&
|
|
166
164
|
filteredOptionsUtils.getMaxSelectedOptionsId(id);
|
|
165
|
+
|
|
167
166
|
return (
|
|
168
167
|
cl(activeOption, maybeMaxSelectedOptionsId, partialAriaDescribedBy) ||
|
|
169
168
|
undefined
|
|
@@ -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 => ({
|
|
@@ -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
|
}
|
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";
|
|
@@ -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";
|