@navikt/ds-react 7.2.1 → 7.3.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/accordion/AccordionHeader.js +1 -1
- package/cjs/accordion/AccordionHeader.js.map +1 -1
- package/cjs/alert/Alert.d.ts +0 -3
- package/cjs/alert/Alert.js +11 -17
- package/cjs/alert/Alert.js.map +1 -1
- package/cjs/chips/Removable.d.ts +5 -5
- package/cjs/chips/Removable.js +4 -2
- package/cjs/chips/Removable.js.map +1 -1
- package/cjs/collapsible/Collapsible.context.d.ts +1 -1
- package/cjs/date/datepicker/DatePicker.d.ts +2 -2
- package/cjs/date/monthpicker/MonthPicker.d.ts +2 -2
- package/cjs/form/combobox/Input/Input.js +1 -1
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/form/combobox/types.d.ts +3 -1
- package/cjs/form/file-upload/FileUpload.context.d.ts +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +4 -2
- package/cjs/index.js.map +1 -1
- package/cjs/layout/base/BasePrimitive.d.ts +3 -0
- package/cjs/layout/base/BasePrimitive.js.map +1 -1
- package/cjs/layout/box/Box.d.ts +2 -2
- package/cjs/layout/box/Box.js.map +1 -1
- package/cjs/layout/grid/HGrid.d.ts +2 -2
- package/cjs/layout/grid/HGrid.js.map +1 -1
- package/cjs/layout/stack/Stack.d.ts +2 -2
- package/cjs/layout/stack/Stack.js.map +1 -1
- package/cjs/modal/ModalHeader.js +6 -1
- package/cjs/modal/ModalHeader.js.map +1 -1
- package/cjs/modal/dialog-polyfill.js +2 -2
- package/cjs/modal/dialog-polyfill.js.map +1 -1
- package/cjs/overlays/action-menu/ActionMenu.d.ts +310 -0
- package/cjs/overlays/action-menu/ActionMenu.js +227 -0
- package/cjs/overlays/action-menu/ActionMenu.js.map +1 -0
- package/cjs/overlays/action-menu/index.d.ts +1 -0
- package/cjs/overlays/action-menu/index.js +19 -0
- package/cjs/overlays/action-menu/index.js.map +1 -0
- package/cjs/overlays/floating/Floating.js +9 -10
- package/cjs/overlays/floating/Floating.js.map +1 -1
- package/cjs/overlays/floating/Floating.utils.d.ts +3 -5
- package/cjs/overlays/floating/Floating.utils.js +0 -2
- package/cjs/overlays/floating/Floating.utils.js.map +1 -1
- package/cjs/overlays/floating-menu/Menu.d.ts +15 -21
- package/cjs/overlays/floating-menu/Menu.js +119 -230
- package/cjs/overlays/floating-menu/Menu.js.map +1 -1
- package/cjs/overlays/floating-menu/parts/RovingFocus.d.ts +1 -1
- package/cjs/overlays/floating-menu/parts/RovingFocus.js.map +1 -1
- package/cjs/pagination/Pagination.d.ts +1 -6
- package/cjs/pagination/Pagination.js.map +1 -1
- package/cjs/provider/i18n/LanguageProvider.d.ts +3 -3
- package/cjs/stepper/context.d.ts +1 -1
- package/cjs/table/Body.d.ts +2 -4
- package/cjs/table/Body.js.map +1 -1
- package/cjs/table/ColumnHeader.d.ts +1 -2
- package/cjs/table/ColumnHeader.js.map +1 -1
- package/cjs/table/ExpandableRow.d.ts +1 -2
- package/cjs/table/ExpandableRow.js.map +1 -1
- package/cjs/table/Header.d.ts +2 -4
- package/cjs/table/Header.js.map +1 -1
- package/cjs/table/HeaderCell.d.ts +1 -2
- package/cjs/table/HeaderCell.js.map +1 -1
- package/cjs/table/Row.d.ts +1 -2
- package/cjs/table/Row.js.map +1 -1
- package/cjs/tabs/Tabs.context.d.ts +1 -1
- package/cjs/toggle-group/ToggleGroup.context.d.ts +1 -1
- package/cjs/util/hooks/descendants/useDescendant.js +4 -4
- package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
- package/cjs/util/i18n/get.d.ts +2 -2
- package/cjs/util/i18n/get.js.map +1 -1
- package/cjs/util/i18n/i18n.context.d.ts +2 -3
- package/cjs/util/i18n/i18n.context.js.map +1 -1
- package/cjs/util/i18n/i18n.types.d.ts +5 -9
- package/cjs/util/i18n/locales/en.d.ts +39 -0
- package/cjs/util/i18n/locales/en.js +41 -0
- package/cjs/util/i18n/locales/en.js.map +1 -0
- package/cjs/util/i18n/locales/nb.d.ts +14 -0
- package/cjs/util/i18n/locales/nb.js +14 -0
- package/cjs/util/i18n/locales/nb.js.map +1 -1
- package/cjs/util/i18n/locales/nn.d.ts +39 -0
- package/cjs/util/i18n/locales/nn.js +41 -0
- package/cjs/util/i18n/locales/nn.js.map +1 -0
- package/cjs/util/requireReactElement.d.ts +2 -0
- package/cjs/util/requireReactElement.js +22 -0
- package/cjs/util/requireReactElement.js.map +1 -0
- package/cjs/util/virtualfocus/Context.d.ts +1 -1
- package/cjs/util/virtualfocus/parts/VirtualFocusContent.d.ts +1 -2
- package/cjs/util/virtualfocus/parts/VirtualFocusContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +1 -1
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/alert/Alert.d.ts +0 -3
- package/esm/alert/Alert.js +11 -17
- package/esm/alert/Alert.js.map +1 -1
- package/esm/chips/Removable.d.ts +5 -5
- package/esm/chips/Removable.js +4 -2
- package/esm/chips/Removable.js.map +1 -1
- package/esm/collapsible/Collapsible.context.d.ts +1 -1
- package/esm/date/datepicker/DatePicker.d.ts +2 -2
- package/esm/date/monthpicker/MonthPicker.d.ts +2 -2
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/types.d.ts +3 -1
- package/esm/form/file-upload/FileUpload.context.d.ts +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/base/BasePrimitive.d.ts +3 -0
- package/esm/layout/base/BasePrimitive.js.map +1 -1
- package/esm/layout/box/Box.d.ts +2 -2
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/grid/HGrid.d.ts +2 -2
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/stack/Stack.d.ts +2 -2
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/modal/ModalHeader.js +6 -1
- package/esm/modal/ModalHeader.js.map +1 -1
- package/esm/modal/dialog-polyfill.js +2 -2
- package/esm/modal/dialog-polyfill.js.map +1 -1
- package/esm/overlays/action-menu/ActionMenu.d.ts +310 -0
- package/esm/overlays/action-menu/ActionMenu.js +197 -0
- package/esm/overlays/action-menu/ActionMenu.js.map +1 -0
- package/esm/overlays/action-menu/index.d.ts +1 -0
- package/esm/overlays/action-menu/index.js +3 -0
- package/esm/overlays/action-menu/index.js.map +1 -0
- package/esm/overlays/floating/Floating.js +9 -10
- package/esm/overlays/floating/Floating.js.map +1 -1
- package/esm/overlays/floating/Floating.utils.d.ts +3 -5
- package/esm/overlays/floating/Floating.utils.js +0 -2
- package/esm/overlays/floating/Floating.utils.js.map +1 -1
- package/esm/overlays/floating-menu/Menu.d.ts +15 -21
- package/esm/overlays/floating-menu/Menu.js +119 -230
- package/esm/overlays/floating-menu/Menu.js.map +1 -1
- package/esm/overlays/floating-menu/parts/RovingFocus.d.ts +1 -1
- package/esm/overlays/floating-menu/parts/RovingFocus.js.map +1 -1
- package/esm/pagination/Pagination.d.ts +1 -6
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/provider/i18n/LanguageProvider.d.ts +3 -3
- package/esm/stepper/context.d.ts +1 -1
- package/esm/table/Body.d.ts +2 -4
- package/esm/table/Body.js.map +1 -1
- package/esm/table/ColumnHeader.d.ts +1 -2
- package/esm/table/ColumnHeader.js.map +1 -1
- package/esm/table/ExpandableRow.d.ts +1 -2
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/table/Header.d.ts +2 -4
- package/esm/table/Header.js.map +1 -1
- package/esm/table/HeaderCell.d.ts +1 -2
- package/esm/table/HeaderCell.js.map +1 -1
- package/esm/table/Row.d.ts +1 -2
- package/esm/table/Row.js.map +1 -1
- package/esm/tabs/Tabs.context.d.ts +1 -1
- package/esm/toggle-group/ToggleGroup.context.d.ts +1 -1
- package/esm/util/hooks/descendants/useDescendant.js +4 -4
- package/esm/util/hooks/descendants/useDescendant.js.map +1 -1
- package/esm/util/i18n/get.d.ts +2 -2
- package/esm/util/i18n/get.js.map +1 -1
- package/esm/util/i18n/i18n.context.d.ts +2 -3
- package/esm/util/i18n/i18n.context.js.map +1 -1
- package/esm/util/i18n/i18n.types.d.ts +5 -9
- package/esm/util/i18n/locales/en.d.ts +39 -0
- package/esm/util/i18n/locales/en.js +39 -0
- package/esm/util/i18n/locales/en.js.map +1 -0
- package/esm/util/i18n/locales/nb.d.ts +14 -0
- package/esm/util/i18n/locales/nb.js +14 -0
- package/esm/util/i18n/locales/nb.js.map +1 -1
- package/esm/util/i18n/locales/nn.d.ts +39 -0
- package/esm/util/i18n/locales/nn.js +39 -0
- package/esm/util/i18n/locales/nn.js.map +1 -0
- package/esm/util/requireReactElement.d.ts +2 -0
- package/esm/util/requireReactElement.js +15 -0
- package/esm/util/requireReactElement.js.map +1 -0
- package/esm/util/virtualfocus/Context.d.ts +1 -1
- package/esm/util/virtualfocus/parts/VirtualFocusContent.d.ts +1 -2
- package/esm/util/virtualfocus/parts/VirtualFocusContent.js.map +1 -1
- package/package.json +15 -7
- package/src/accordion/AccordionHeader.tsx +0 -1
- package/src/alert/Alert.tsx +11 -20
- package/src/chips/Removable.tsx +13 -9
- package/src/date/datepicker/DatePicker.tsx +2 -2
- package/src/date/monthpicker/MonthPicker.tsx +2 -2
- package/src/form/checkbox/Checkbox.test.tsx +2 -3
- package/src/form/combobox/Input/Input.tsx +1 -1
- package/src/form/combobox/types.ts +3 -1
- package/src/form/confirmation-panel/ConfirmationPanel.test.tsx +1 -2
- package/src/form/radio/Radio.test.tsx +4 -5
- package/src/index.ts +1 -0
- package/src/layout/base/BasePrimitive.tsx +3 -0
- package/src/layout/box/Box.tsx +35 -36
- package/src/layout/grid/HGrid.tsx +26 -27
- package/src/layout/stack/Stack.tsx +53 -54
- package/src/modal/ModalHeader.tsx +6 -0
- package/src/modal/dialog-polyfill.ts +2 -2
- package/src/overlays/action-menu/ActionMenu.tsx +971 -0
- package/src/overlays/action-menu/index.ts +29 -0
- package/src/overlays/floating/Floating.tsx +6 -12
- package/src/overlays/floating/Floating.utils.ts +2 -5
- package/src/overlays/floating-menu/Menu.tsx +183 -332
- package/src/overlays/floating-menu/parts/RovingFocus.tsx +3 -3
- package/src/pagination/Pagination.tsx +4 -1
- package/src/pagination/steps.test.ts +15 -16
- package/src/provider/i18n/LanguageProvider.tsx +3 -3
- package/src/table/Body.tsx +4 -6
- package/src/table/ColumnHeader.tsx +3 -4
- package/src/table/ExpandableRow.tsx +3 -4
- package/src/table/Header.tsx +4 -6
- package/src/table/HeaderCell.tsx +3 -4
- package/src/table/Row.tsx +3 -4
- package/src/util/hooks/descendants/useDescendant.tsx +5 -5
- package/src/util/i18n/get.ts +3 -3
- package/src/util/i18n/i18n.context.ts +2 -3
- package/src/util/i18n/i18n.types.ts +7 -11
- package/src/util/i18n/locales/en.ts +40 -0
- package/src/util/i18n/locales/nb.ts +23 -1
- package/src/util/i18n/locales/nn.ts +40 -0
- package/src/util/i18n/locales.test.tsx +23 -0
- package/src/util/requireReactElement.ts +25 -0
- package/src/util/virtualfocus/parts/VirtualFocusContent.tsx +4 -2
- package/cjs/util/i18n/merge.d.ts +0 -2
- package/cjs/util/i18n/merge.js +0 -28
- package/cjs/util/i18n/merge.js.map +0 -1
- package/esm/util/i18n/merge.d.ts +0 -2
- package/esm/util/i18n/merge.js +0 -25
- package/esm/util/i18n/merge.js.map +0 -1
- package/src/util/i18n/merge.ts +0 -35
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
FileUpload: {
|
|
3
|
+
dropzone: {
|
|
4
|
+
button: "Vel fil",
|
|
5
|
+
buttonMultiple: "Vel filer",
|
|
6
|
+
dragAndDrop: "Dra og slepp fila her",
|
|
7
|
+
dragAndDropMultiple: "Dra og slepp filer her",
|
|
8
|
+
drop: "Slepp",
|
|
9
|
+
or: "eller",
|
|
10
|
+
disabled: "Filopplasting er deaktivert",
|
|
11
|
+
disabledFilelimit: "Du kan ikkje laste opp fleire filer",
|
|
12
|
+
},
|
|
13
|
+
item: {
|
|
14
|
+
retryButtonTitle: "Prøv å laste opp fila på nytt",
|
|
15
|
+
deleteButtonTitle: "Slett fila",
|
|
16
|
+
uploading: "Lastar opp…",
|
|
17
|
+
downloading: "Lastar ned…",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
FormProgress: {
|
|
21
|
+
step: "Steg {activeStep} av {totalSteps}",
|
|
22
|
+
showAllSteps: "Vis alle steg",
|
|
23
|
+
hideAllSteps: "Skjul alle steg",
|
|
24
|
+
},
|
|
25
|
+
Alert: {
|
|
26
|
+
closeAlert: "Lukk varsel",
|
|
27
|
+
closeMessage: "Lukk melding",
|
|
28
|
+
error: "Feil",
|
|
29
|
+
info: "Informasjon",
|
|
30
|
+
success: "Suksess",
|
|
31
|
+
warning: "Åtvaring",
|
|
32
|
+
},
|
|
33
|
+
Chips: {
|
|
34
|
+
Removable: {
|
|
35
|
+
labelSuffix: "slett",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=nn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nn.js","sourceRoot":"","sources":["../../../../src/util/i18n/locales/nn.ts"],"names":[],"mappings":"AAEA,eAAe;IACb,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,MAAM,EAAE,SAAS;YACjB,cAAc,EAAE,WAAW;YAC3B,WAAW,EAAE,uBAAuB;YACpC,mBAAmB,EAAE,wBAAwB;YAC7C,IAAI,EAAE,OAAO;YACb,EAAE,EAAE,OAAO;YACX,QAAQ,EAAE,6BAA6B;YACvC,iBAAiB,EAAE,qCAAqC;SACzD;QACD,IAAI,EAAE;YACJ,gBAAgB,EAAE,+BAA+B;YACjD,iBAAiB,EAAE,YAAY;YAC/B,SAAS,EAAE,aAAa;YACxB,WAAW,EAAE,aAAa;SAC3B;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,mCAAmC;QACzC,YAAY,EAAE,eAAe;QAC7B,YAAY,EAAE,iBAAiB;KAChC;IACD,KAAK,EAAE;QACL,UAAU,EAAE,aAAa;QACzB,YAAY,EAAE,cAAc;QAC5B,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,UAAU;KACpB;IACD,KAAK,EAAE;QACL,SAAS,EAAE;YACT,WAAW,EAAE,OAAO;SACrB;KACF;CACqB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export const requireReactElement = (children) => {
|
|
3
|
+
const isReactElement = React.isValidElement(children);
|
|
4
|
+
if (!isReactElement) {
|
|
5
|
+
throw Error(`Expected a single React Element child, but got: ${React.Children.toArray(children)
|
|
6
|
+
.map((child) => typeof child === "object" &&
|
|
7
|
+
"type" in child &&
|
|
8
|
+
typeof child.type === "string"
|
|
9
|
+
? child.type
|
|
10
|
+
: typeof child)
|
|
11
|
+
.join(", ")}`);
|
|
12
|
+
}
|
|
13
|
+
return children;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=requireReactElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireReactElement.js","sourceRoot":"","sources":["../../src/util/requireReactElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,QAAW,EACR,EAAE;IACL,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEtD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,KAAK,CACT,mDAAmD,KAAK,CAAC,QAAQ,CAAC,OAAO,CACvE,QAAQ,CACT;aACE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACb,OAAO,KAAK,KAAK,QAAQ;YACzB,MAAM,IAAI,KAAK;YACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAC5B,CAAC,CAAC,KAAK,CAAC,IAAI;YACZ,CAAC,CAAC,OAAO,KAAK,CACjB;aACA,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -29,7 +29,7 @@ export declare const VirtualFocusInternalContextProvider: import("react").Forwar
|
|
|
29
29
|
loop: boolean;
|
|
30
30
|
uniqueId: string;
|
|
31
31
|
} & {
|
|
32
|
-
children:
|
|
32
|
+
children: import("react").ReactNode;
|
|
33
33
|
} & import("react").RefAttributes<unknown>>, useVirtualFocusInternalContext: <S extends boolean = true>(strict?: S) => S extends true ? {
|
|
34
34
|
virtualFocusIdx: number;
|
|
35
35
|
setVirtualFocusIdx: Dispatch<SetStateAction<number>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export
|
|
3
|
-
}
|
|
2
|
+
export type VirtualFocusContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, "id">;
|
|
4
3
|
export declare const VirtualFocusContent: React.ForwardRefExoticComponent<VirtualFocusContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualFocusContent.js","sourceRoot":"","sources":["../../../../src/util/virtualfocus/parts/VirtualFocusContent.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"VirtualFocusContent.js","sourceRoot":"","sources":["../../../../src/util/virtualfocus/parts/VirtualFocusContent.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAO5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAG3C,CAAC,EAAqB,EAAE,GAAG,EAAE,EAAE;QAA9B,EAAE,QAAQ,OAAW,EAAN,IAAI,cAAnB,YAAqB,CAAF;IACpB,MAAM,EAAE,QAAQ,EAAE,GAAG,8BAA8B,EAAE,CAAC;IACtD,OAAO,CACL,2CAAK,GAAG,EAAE,GAAG,IAAM,IAAI,IAAE,EAAE,EAAE,gBAAgB,QAAQ,UAAU,KAC5D,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.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",
|
|
@@ -50,6 +50,16 @@
|
|
|
50
50
|
"default": "./cjs/accordion/index.js"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
+
"./ActionMenu": {
|
|
54
|
+
"import": {
|
|
55
|
+
"types": "./esm/overlays/action-menu/index.d.ts",
|
|
56
|
+
"default": "./esm/overlays/action-menu/index.js"
|
|
57
|
+
},
|
|
58
|
+
"require": {
|
|
59
|
+
"types": "./cjs/overlays/action-menu/index.d.ts",
|
|
60
|
+
"default": "./cjs/overlays/action-menu/index.js"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
53
63
|
"./Alert": {
|
|
54
64
|
"import": {
|
|
55
65
|
"types": "./esm/alert/index.d.ts",
|
|
@@ -594,8 +604,8 @@
|
|
|
594
604
|
"dependencies": {
|
|
595
605
|
"@floating-ui/react": "0.25.4",
|
|
596
606
|
"@floating-ui/react-dom": "^2.0.9",
|
|
597
|
-
"@navikt/aksel-icons": "^7.
|
|
598
|
-
"@navikt/ds-tokens": "^7.
|
|
607
|
+
"@navikt/aksel-icons": "^7.3.1",
|
|
608
|
+
"@navikt/ds-tokens": "^7.3.1",
|
|
599
609
|
"clsx": "^2.1.0",
|
|
600
610
|
"date-fns": "^3.0.0",
|
|
601
611
|
"react-day-picker": "8.10.0"
|
|
@@ -605,9 +615,7 @@
|
|
|
605
615
|
"@testing-library/jest-dom": "^5.16.0",
|
|
606
616
|
"@testing-library/react": "^15.0.7",
|
|
607
617
|
"@testing-library/user-event": "^14.2.0",
|
|
608
|
-
"
|
|
609
|
-
"concurrently": "7.2.1",
|
|
610
|
-
"faker": "5.5.3",
|
|
618
|
+
"concurrently": "9.0.1",
|
|
611
619
|
"fast-glob": "3.2.11",
|
|
612
620
|
"jsdom": "24.0.0",
|
|
613
621
|
"react-dom": "^18.0.0",
|
|
@@ -616,7 +624,7 @@
|
|
|
616
624
|
"swr": "^1.1.2",
|
|
617
625
|
"tsc-alias": "1.8.8",
|
|
618
626
|
"tsx": "^4.19.1",
|
|
619
|
-
"typescript": "
|
|
627
|
+
"typescript": "5.5.4",
|
|
620
628
|
"vitest": "^1.2.2"
|
|
621
629
|
},
|
|
622
630
|
"peerDependencies": {
|
package/src/alert/Alert.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "@navikt/aksel-icons";
|
|
10
10
|
import { Button } from "../button";
|
|
11
11
|
import { BodyLong } from "../typography";
|
|
12
|
+
import { useI18n } from "../util/i18n/i18n.context";
|
|
12
13
|
|
|
13
14
|
export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
15
|
/**
|
|
@@ -54,25 +55,13 @@ export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
54
55
|
onClose?: () => void;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return <ExclamationmarkTriangleFillIcon title="Advarsel" {...props} />;
|
|
63
|
-
case "info":
|
|
64
|
-
return <InformationSquareFillIcon title="Informasjon" {...props} />;
|
|
65
|
-
case "success":
|
|
66
|
-
return <CheckmarkCircleFillIcon title="Suksess" {...props} />;
|
|
67
|
-
default:
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
58
|
+
const IconMap = {
|
|
59
|
+
error: XMarkOctagonFillIcon,
|
|
60
|
+
warning: ExclamationmarkTriangleFillIcon,
|
|
61
|
+
info: InformationSquareFillIcon,
|
|
62
|
+
success: CheckmarkCircleFillIcon,
|
|
70
63
|
};
|
|
71
64
|
|
|
72
|
-
export interface AlertContextProps {
|
|
73
|
-
size: "medium" | "small";
|
|
74
|
-
}
|
|
75
|
-
|
|
76
65
|
/**
|
|
77
66
|
* A component for displaying alerts
|
|
78
67
|
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/alert)
|
|
@@ -98,6 +87,8 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
|
98
87
|
},
|
|
99
88
|
ref,
|
|
100
89
|
) => {
|
|
90
|
+
const translate = useI18n("Alert");
|
|
91
|
+
const Icon = IconMap[variant];
|
|
101
92
|
return (
|
|
102
93
|
<div
|
|
103
94
|
{...rest}
|
|
@@ -114,7 +105,7 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
|
114
105
|
},
|
|
115
106
|
)}
|
|
116
107
|
>
|
|
117
|
-
<Icon
|
|
108
|
+
<Icon title={translate(variant)} className="navds-alert__icon" />
|
|
118
109
|
<BodyLong
|
|
119
110
|
as="div"
|
|
120
111
|
size={size}
|
|
@@ -137,8 +128,8 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
|
137
128
|
<XMarkIcon
|
|
138
129
|
title={
|
|
139
130
|
["error", "warning"].includes(variant)
|
|
140
|
-
? "
|
|
141
|
-
: "
|
|
131
|
+
? translate("closeAlert")
|
|
132
|
+
: translate("closeMessage")
|
|
142
133
|
}
|
|
143
134
|
/>
|
|
144
135
|
}
|
package/src/chips/Removable.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import cl from "clsx";
|
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
3
|
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { composeEventHandlers } from "../util/composeEventHandlers";
|
|
5
|
+
import { useI18n } from "../util/i18n/i18n.context";
|
|
5
6
|
|
|
6
7
|
export interface ChipsRemovableProps
|
|
7
8
|
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -11,15 +12,15 @@ export interface ChipsRemovableProps
|
|
|
11
12
|
* @default "action"
|
|
12
13
|
*/
|
|
13
14
|
variant?: "action" | "neutral";
|
|
14
|
-
/**
|
|
15
|
-
* Replaces label read for screen-readers
|
|
16
|
-
* @default "slett filter"
|
|
17
|
-
*/
|
|
18
|
-
removeLabel?: string;
|
|
19
15
|
/**
|
|
20
16
|
* Click callback
|
|
21
17
|
*/
|
|
22
18
|
onDelete?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Replaces label read for screen-readers
|
|
21
|
+
* @default "slett"
|
|
22
|
+
*/
|
|
23
|
+
removeLabel?: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const RemovableChips = forwardRef<
|
|
@@ -28,17 +29,18 @@ export const RemovableChips = forwardRef<
|
|
|
28
29
|
>(
|
|
29
30
|
(
|
|
30
31
|
{
|
|
31
|
-
className,
|
|
32
32
|
children,
|
|
33
33
|
variant = "action",
|
|
34
|
-
removeLabel = "slett",
|
|
35
34
|
onDelete,
|
|
36
|
-
|
|
35
|
+
removeLabel,
|
|
36
|
+
className,
|
|
37
37
|
onClick,
|
|
38
|
+
type = "button",
|
|
38
39
|
...rest
|
|
39
40
|
},
|
|
40
41
|
ref,
|
|
41
42
|
) => {
|
|
43
|
+
const translate = useI18n("Chips");
|
|
42
44
|
return (
|
|
43
45
|
<button
|
|
44
46
|
{...rest}
|
|
@@ -49,7 +51,9 @@ export const RemovableChips = forwardRef<
|
|
|
49
51
|
className,
|
|
50
52
|
`navds-chips__removable--${variant}`,
|
|
51
53
|
)}
|
|
52
|
-
aria-label={`${children} ${
|
|
54
|
+
aria-label={`${children} ${
|
|
55
|
+
removeLabel ?? translate("Removable.labelSuffix")
|
|
56
|
+
}`}
|
|
53
57
|
onClick={composeEventHandlers(onClick, onDelete)}
|
|
54
58
|
>
|
|
55
59
|
<span className="navds-chips__chip-text">{children}</span>
|
|
@@ -27,8 +27,8 @@ interface DatePickerComponent
|
|
|
27
27
|
* ```jsx
|
|
28
28
|
* <DatePicker.Standalone
|
|
29
29
|
* dropdownCaption
|
|
30
|
-
* fromDate={new Date("
|
|
31
|
-
* toDate={new Date("
|
|
30
|
+
* fromDate={new Date("2022-10-01")}
|
|
31
|
+
* toDate={new Date("2026-10-01")}
|
|
32
32
|
* />
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
@@ -19,8 +19,8 @@ interface MonthPickerComponent
|
|
|
19
19
|
* ```jsx
|
|
20
20
|
* <MonthPicker.Standalone
|
|
21
21
|
* dropdownCaption
|
|
22
|
-
* fromDate={new Date("1 Oct
|
|
23
|
-
* toDate={new Date("1 Oct
|
|
22
|
+
* fromDate={new Date("1 Oct 2022")}
|
|
23
|
+
* toDate={new Date("1 Oct 2026")}
|
|
24
24
|
* />
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { fireEvent, render, screen } from "@testing-library/react";
|
|
2
|
-
import faker from "faker";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { describe, expect, test, vi } from "vitest";
|
|
5
4
|
import { Checkbox, CheckboxGroup } from ".";
|
|
@@ -10,8 +9,8 @@ const firstArgumentOfFirstCall = (fn: ReturnType<typeof vi.fn>) =>
|
|
|
10
9
|
test("checkbox group chains onChange calls", async () => {
|
|
11
10
|
const onGroupChange = vi.fn();
|
|
12
11
|
const onChange = vi.fn();
|
|
13
|
-
const value =
|
|
14
|
-
const label =
|
|
12
|
+
const value = "Checkbox value";
|
|
13
|
+
const label = "My pretty label";
|
|
15
14
|
|
|
16
15
|
render(
|
|
17
16
|
<CheckboxGroup legend="legend" onChange={onGroupChange}>
|
|
@@ -253,7 +253,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
253
253
|
type="text"
|
|
254
254
|
role="combobox"
|
|
255
255
|
value={value}
|
|
256
|
-
onBlur={composeEventHandlers(onBlur, virtualFocus.
|
|
256
|
+
onBlur={composeEventHandlers(onBlur, virtualFocus.resetFocus)}
|
|
257
257
|
onClick={() => {
|
|
258
258
|
setHideCaret(!!maxSelected?.isLimitReached);
|
|
259
259
|
value !== searchTerm && onChange(value);
|
|
@@ -45,7 +45,9 @@ export interface ComboboxProps
|
|
|
45
45
|
*/
|
|
46
46
|
allowNewValues?: boolean;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Adds a button to clear the input value when not empty.
|
|
49
|
+
* NB: Will not clear selected values.
|
|
50
|
+
* @default true
|
|
49
51
|
*/
|
|
50
52
|
clearButton?: boolean;
|
|
51
53
|
/**
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { render, screen } from "@testing-library/react";
|
|
2
|
-
import faker from "faker";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { expect, test } from "vitest";
|
|
5
4
|
import { ConfirmationPanel } from ".";
|
|
6
5
|
|
|
7
6
|
test("omits error id from input", async () => {
|
|
8
|
-
const label =
|
|
7
|
+
const label = "My label";
|
|
9
8
|
|
|
10
9
|
render(<ConfirmationPanel label={label} errorId="wat"></ConfirmationPanel>);
|
|
11
10
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { render, screen } from "@testing-library/react";
|
|
2
2
|
import userEvent from "@testing-library/user-event";
|
|
3
|
-
import faker from "faker";
|
|
4
3
|
import React from "react";
|
|
5
4
|
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
|
6
5
|
import { Radio, RadioGroup } from ".";
|
|
7
6
|
|
|
8
|
-
const value1 =
|
|
9
|
-
const label1 =
|
|
10
|
-
const value2 =
|
|
11
|
-
const label2 =
|
|
7
|
+
const value1 = "My first value";
|
|
8
|
+
const label1 = "World's best radio label";
|
|
9
|
+
const value2 = "Life changing value";
|
|
10
|
+
const label2 = "Radio label of the year";
|
|
12
11
|
|
|
13
12
|
const Group = (props) => (
|
|
14
13
|
<RadioGroup {...props} legend="legend">
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { Accordion, type AccordionProps } from "./accordion";
|
|
3
|
+
export { ActionMenu, type ActionMenuProps } from "./overlays/action-menu";
|
|
3
4
|
export { Alert, type AlertProps } from "./alert";
|
|
4
5
|
export { Button, type ButtonProps } from "./button";
|
|
5
6
|
export { Chat, type ChatProps } from "./chat";
|
|
@@ -5,6 +5,9 @@ import { getResponsiveProps, getResponsiveValue } from "../utilities/css";
|
|
|
5
5
|
import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
6
6
|
|
|
7
7
|
export type PrimitiveProps = {
|
|
8
|
+
/**
|
|
9
|
+
* @private Hides prop from documentation
|
|
10
|
+
*/
|
|
8
11
|
className?: string;
|
|
9
12
|
/**
|
|
10
13
|
* Padding around children.
|
package/src/layout/box/Box.tsx
CHANGED
|
@@ -19,42 +19,41 @@ import {
|
|
|
19
19
|
SurfaceColorToken,
|
|
20
20
|
} from "../utilities/types";
|
|
21
21
|
|
|
22
|
-
export type BoxProps =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
22
|
+
export type BoxProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
23
|
+
/**
|
|
24
|
+
* CSS `background-color` property.
|
|
25
|
+
* Accepts a [background/surface color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#afff774dad80).
|
|
26
|
+
*/
|
|
27
|
+
background?: BackgroundColorToken | SurfaceColorToken;
|
|
28
|
+
/**
|
|
29
|
+
* CSS `border-color` property.
|
|
30
|
+
* Accepts a [border color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#adb1767e2f87).
|
|
31
|
+
*/
|
|
32
|
+
borderColor?: BorderColorToken;
|
|
33
|
+
/**
|
|
34
|
+
* CSS `border-radius` property.
|
|
35
|
+
* Accepts a [radius token](https://aksel.nav.no/grunnleggende/styling/design-tokens#6d79c5605d31)
|
|
36
|
+
* or an object of radius tokens for different breakpoints.
|
|
37
|
+
* @example
|
|
38
|
+
* borderRadius='full'
|
|
39
|
+
* borderRadius='0 full large small'
|
|
40
|
+
* borderRadius={{xs: 'small large', sm: '0', md: 'large', lg: 'full'}}
|
|
41
|
+
*/
|
|
42
|
+
borderRadius?: ResponsiveProp<SpaceDelimitedAttribute<BorderRadiiToken>>;
|
|
43
|
+
/**
|
|
44
|
+
* CSS `border-width` property. If this is not set there will be no border.
|
|
45
|
+
* @example
|
|
46
|
+
* borderWidth='2'
|
|
47
|
+
* borderWidth='1 2 3 4'
|
|
48
|
+
*/
|
|
49
|
+
borderWidth?: SpaceDelimitedAttribute<"0" | "1" | "2" | "3" | "4" | "5">;
|
|
50
|
+
/** Shadow on box. Accepts a shadow token.
|
|
51
|
+
* @example
|
|
52
|
+
* shadow='small'
|
|
53
|
+
*/
|
|
54
|
+
shadow?: ShadowToken;
|
|
55
|
+
} & PrimitiveProps &
|
|
56
|
+
PrimitiveAsChildProps;
|
|
58
57
|
|
|
59
58
|
/**
|
|
60
59
|
* Foundational Layout-primitive for generic encapsulation & styling.
|
|
@@ -10,33 +10,32 @@ import { PrimitiveAsChildProps } from "../base/PrimitiveAsChildProps";
|
|
|
10
10
|
import { getResponsiveProps, getResponsiveValue } from "../utilities/css";
|
|
11
11
|
import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
12
12
|
|
|
13
|
-
export type HGridProps =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
13
|
+
export type HGridProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
14
|
+
/**
|
|
15
|
+
* Number of columns to display. Can be a number, a string, or an object with values for specific breakpoints.
|
|
16
|
+
* Sets `grid-template-columns`, so `fr`, `minmax` etc. works.
|
|
17
|
+
* @example
|
|
18
|
+
* columns={{ sm: 1, md: 1, lg: "1fr auto", xl: "1fr auto"}}
|
|
19
|
+
* columns={3}
|
|
20
|
+
* columns="repeat(3, minmax(0, 1fr))"
|
|
21
|
+
*/
|
|
22
|
+
columns?: ResponsiveProp<number | string>;
|
|
23
|
+
/**
|
|
24
|
+
* Spacing between columns.
|
|
25
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
26
|
+
* or an object of spacing tokens for different breakpoints.
|
|
27
|
+
* @example
|
|
28
|
+
* gap="6"
|
|
29
|
+
* gap="8 4"
|
|
30
|
+
* gap={{ sm: "2", md: "2", lg: "6", xl: "6"}}
|
|
31
|
+
*/
|
|
32
|
+
gap?: ResponsiveProp<SpacingScale | `${SpacingScale} ${SpacingScale}`>;
|
|
33
|
+
/**
|
|
34
|
+
* Vertical alignment of children. Elements will by default stretch to the height of parent-element.
|
|
35
|
+
*/
|
|
36
|
+
align?: "start" | "center" | "end";
|
|
37
|
+
} & PrimitiveProps &
|
|
38
|
+
PrimitiveAsChildProps;
|
|
40
39
|
/**
|
|
41
40
|
* Horizontal Grid Primitive with dynamic columns and gap based on breakpoints.
|
|
42
41
|
*
|