@navikt/ds-react 7.33.5 → 7.35.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/alert/Alert.js +2 -4
- package/cjs/alert/Alert.js.map +1 -1
- package/cjs/alert/base-alert/close-button/BaseAlertCloseButton.d.ts +17 -0
- package/cjs/alert/base-alert/close-button/BaseAlertCloseButton.js +72 -0
- package/cjs/alert/base-alert/close-button/BaseAlertCloseButton.js.map +1 -0
- package/cjs/alert/base-alert/content/BaseAlertContent.d.ts +20 -0
- package/cjs/alert/base-alert/content/BaseAlertContent.js +70 -0
- package/cjs/alert/base-alert/content/BaseAlertContent.js.map +1 -0
- package/cjs/alert/base-alert/header/BaseAlertHeader.d.ts +22 -0
- package/cjs/alert/base-alert/header/BaseAlertHeader.js +77 -0
- package/cjs/alert/base-alert/header/BaseAlertHeader.js.map +1 -0
- package/cjs/alert/base-alert/index.d.ts +1 -0
- package/cjs/alert/base-alert/index.js +39 -0
- package/cjs/alert/base-alert/index.js.map +1 -0
- package/cjs/alert/base-alert/namespace.d.ts +10 -0
- package/cjs/alert/base-alert/namespace.js +14 -0
- package/cjs/alert/base-alert/namespace.js.map +1 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.context.d.ts +12 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.context.js +11 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.context.js.map +1 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.d.ts +43 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.js +65 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.js.map +1 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.utils.d.ts +9 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.utils.js +48 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.utils.js.map +1 -0
- package/cjs/alert/base-alert/title/BaseAlertTitle.d.ts +24 -0
- package/cjs/alert/base-alert/title/BaseAlertTitle.js +77 -0
- package/cjs/alert/base-alert/title/BaseAlertTitle.js.map +1 -0
- package/cjs/alert/global-alert/close-button/GlobalAlertCloseButton.d.ts +17 -0
- package/cjs/alert/global-alert/close-button/GlobalAlertCloseButton.js +19 -0
- package/cjs/alert/global-alert/close-button/GlobalAlertCloseButton.js.map +1 -0
- package/cjs/alert/global-alert/content/GlobalAlertContent.d.ts +18 -0
- package/cjs/alert/global-alert/content/GlobalAlertContent.js +20 -0
- package/cjs/alert/global-alert/content/GlobalAlertContent.js.map +1 -0
- package/cjs/alert/global-alert/header/GlobalAlertHeader.d.ts +17 -0
- package/cjs/alert/global-alert/header/GlobalAlertHeader.js +54 -0
- package/cjs/alert/global-alert/header/GlobalAlertHeader.js.map +1 -0
- package/cjs/alert/global-alert/index.d.ts +2 -0
- package/cjs/alert/global-alert/index.js +11 -0
- package/cjs/alert/global-alert/index.js.map +1 -0
- package/cjs/alert/global-alert/root/GlobalAlertRoot.d.ts +81 -0
- package/cjs/alert/global-alert/root/GlobalAlertRoot.js +69 -0
- package/cjs/alert/global-alert/root/GlobalAlertRoot.js.map +1 -0
- package/cjs/alert/global-alert/title/GlobalAlertTitle.d.ts +17 -0
- package/cjs/alert/global-alert/title/GlobalAlertTitle.js +19 -0
- package/cjs/alert/global-alert/title/GlobalAlertTitle.js.map +1 -0
- package/cjs/alert/info-card/content/InfoCardContent.d.ts +18 -0
- package/cjs/alert/info-card/content/InfoCardContent.js +20 -0
- package/cjs/alert/info-card/content/InfoCardContent.js.map +1 -0
- package/cjs/alert/info-card/header/InfoCardHeader.d.ts +16 -0
- package/cjs/alert/info-card/header/InfoCardHeader.js +18 -0
- package/cjs/alert/info-card/header/InfoCardHeader.js.map +1 -0
- package/cjs/alert/info-card/index.d.ts +2 -0
- package/cjs/alert/info-card/index.js +10 -0
- package/cjs/alert/info-card/index.js.map +1 -0
- package/cjs/alert/info-card/root/InfoCardRoot.d.ts +76 -0
- package/cjs/alert/info-card/root/InfoCardRoot.js +78 -0
- package/cjs/alert/info-card/root/InfoCardRoot.js.map +1 -0
- package/cjs/alert/info-card/title/InfoCardTitle.d.ts +17 -0
- package/cjs/alert/info-card/title/InfoCardTitle.js +19 -0
- package/cjs/alert/info-card/title/InfoCardTitle.js.map +1 -0
- package/cjs/alert/local-alert/close-button/LocalAlertCloseButton.d.ts +17 -0
- package/cjs/alert/local-alert/close-button/LocalAlertCloseButton.js +19 -0
- package/cjs/alert/local-alert/close-button/LocalAlertCloseButton.js.map +1 -0
- package/cjs/alert/local-alert/content/LocalAlertContent.d.ts +18 -0
- package/cjs/alert/local-alert/content/LocalAlertContent.js +20 -0
- package/cjs/alert/local-alert/content/LocalAlertContent.js.map +1 -0
- package/cjs/alert/local-alert/header/LocalAlertHeader.d.ts +17 -0
- package/cjs/alert/local-alert/header/LocalAlertHeader.js +54 -0
- package/cjs/alert/local-alert/header/LocalAlertHeader.js.map +1 -0
- package/cjs/alert/local-alert/index.d.ts +2 -0
- package/cjs/alert/local-alert/index.js +11 -0
- package/cjs/alert/local-alert/index.js.map +1 -0
- package/cjs/alert/local-alert/root/LocalAlertRoot.d.ts +81 -0
- package/cjs/alert/local-alert/root/LocalAlertRoot.js +81 -0
- package/cjs/alert/local-alert/root/LocalAlertRoot.js.map +1 -0
- package/cjs/alert/local-alert/title/LocalAlertTitle.d.ts +17 -0
- package/cjs/alert/local-alert/title/LocalAlertTitle.js +19 -0
- package/cjs/alert/local-alert/title/LocalAlertTitle.js.map +1 -0
- package/cjs/date/Date.locale.d.ts +5 -0
- package/cjs/form/combobox/FilteredOptions/NoSearchHitsMessage.js +3 -1
- package/cjs/form/combobox/FilteredOptions/NoSearchHitsMessage.js.map +1 -1
- package/cjs/index.d.ts +4 -0
- package/cjs/index.js +9 -1
- package/cjs/index.js.map +1 -1
- package/cjs/inline-message/icon/InlineMessageIcon.d.ts +5 -0
- package/cjs/inline-message/icon/InlineMessageIcon.js +24 -0
- package/cjs/inline-message/icon/InlineMessageIcon.js.map +1 -0
- package/cjs/inline-message/index.d.ts +2 -0
- package/cjs/inline-message/index.js +7 -0
- package/cjs/inline-message/index.js.map +1 -0
- package/cjs/inline-message/root/InlineMessage.d.ts +36 -0
- package/cjs/inline-message/root/InlineMessage.js +91 -0
- package/cjs/inline-message/root/InlineMessage.js.map +1 -0
- package/cjs/timeline/period/ClickablePeriod.js +3 -15
- package/cjs/timeline/period/ClickablePeriod.js.map +1 -1
- package/cjs/timeline/pin/PinInternal.js +3 -15
- package/cjs/timeline/pin/PinInternal.js.map +1 -1
- package/cjs/util/i18n/locales/en.d.ts +2 -4
- package/cjs/util/i18n/locales/en.js +2 -4
- package/cjs/util/i18n/locales/en.js.map +1 -1
- package/cjs/util/i18n/locales/nb.d.ts +4 -6
- package/cjs/util/i18n/locales/nb.js +4 -6
- package/cjs/util/i18n/locales/nb.js.map +1 -1
- package/cjs/util/i18n/locales/nn.d.ts +2 -4
- package/cjs/util/i18n/locales/nn.js +2 -4
- package/cjs/util/i18n/locales/nn.js.map +1 -1
- package/esm/alert/Alert.js +2 -4
- package/esm/alert/Alert.js.map +1 -1
- package/esm/alert/base-alert/close-button/BaseAlertCloseButton.d.ts +17 -0
- package/esm/alert/base-alert/close-button/BaseAlertCloseButton.js +36 -0
- package/esm/alert/base-alert/close-button/BaseAlertCloseButton.js.map +1 -0
- package/esm/alert/base-alert/content/BaseAlertContent.d.ts +20 -0
- package/esm/alert/base-alert/content/BaseAlertContent.js +34 -0
- package/esm/alert/base-alert/content/BaseAlertContent.js.map +1 -0
- package/esm/alert/base-alert/header/BaseAlertHeader.d.ts +22 -0
- package/esm/alert/base-alert/header/BaseAlertHeader.js +41 -0
- package/esm/alert/base-alert/header/BaseAlertHeader.js.map +1 -0
- package/esm/alert/base-alert/index.d.ts +1 -0
- package/esm/alert/base-alert/index.js +3 -0
- package/esm/alert/base-alert/index.js.map +1 -0
- package/esm/alert/base-alert/namespace.d.ts +10 -0
- package/esm/alert/base-alert/namespace.js +6 -0
- package/esm/alert/base-alert/namespace.js.map +1 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.context.d.ts +12 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.context.js +7 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.context.js.map +1 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.d.ts +43 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.js +29 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.js.map +1 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.utils.d.ts +9 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.utils.js +42 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.utils.js.map +1 -0
- package/esm/alert/base-alert/title/BaseAlertTitle.d.ts +24 -0
- package/esm/alert/base-alert/title/BaseAlertTitle.js +38 -0
- package/esm/alert/base-alert/title/BaseAlertTitle.js.map +1 -0
- package/esm/alert/global-alert/close-button/GlobalAlertCloseButton.d.ts +17 -0
- package/esm/alert/global-alert/close-button/GlobalAlertCloseButton.js +16 -0
- package/esm/alert/global-alert/close-button/GlobalAlertCloseButton.js.map +1 -0
- package/esm/alert/global-alert/content/GlobalAlertContent.d.ts +18 -0
- package/esm/alert/global-alert/content/GlobalAlertContent.js +17 -0
- package/esm/alert/global-alert/content/GlobalAlertContent.js.map +1 -0
- package/esm/alert/global-alert/header/GlobalAlertHeader.d.ts +17 -0
- package/esm/alert/global-alert/header/GlobalAlertHeader.js +18 -0
- package/esm/alert/global-alert/header/GlobalAlertHeader.js.map +1 -0
- package/esm/alert/global-alert/index.d.ts +2 -0
- package/esm/alert/global-alert/index.js +3 -0
- package/esm/alert/global-alert/index.js.map +1 -0
- package/esm/alert/global-alert/root/GlobalAlertRoot.d.ts +81 -0
- package/esm/alert/global-alert/root/GlobalAlertRoot.js +30 -0
- package/esm/alert/global-alert/root/GlobalAlertRoot.js.map +1 -0
- package/esm/alert/global-alert/title/GlobalAlertTitle.d.ts +17 -0
- package/esm/alert/global-alert/title/GlobalAlertTitle.js +16 -0
- package/esm/alert/global-alert/title/GlobalAlertTitle.js.map +1 -0
- package/esm/alert/info-card/content/InfoCardContent.d.ts +18 -0
- package/esm/alert/info-card/content/InfoCardContent.js +17 -0
- package/esm/alert/info-card/content/InfoCardContent.js.map +1 -0
- package/esm/alert/info-card/header/InfoCardHeader.d.ts +16 -0
- package/esm/alert/info-card/header/InfoCardHeader.js +15 -0
- package/esm/alert/info-card/header/InfoCardHeader.js.map +1 -0
- package/esm/alert/info-card/index.d.ts +2 -0
- package/esm/alert/info-card/index.js +3 -0
- package/esm/alert/info-card/index.js.map +1 -0
- package/esm/alert/info-card/root/InfoCardRoot.d.ts +76 -0
- package/esm/alert/info-card/root/InfoCardRoot.js +40 -0
- package/esm/alert/info-card/root/InfoCardRoot.js.map +1 -0
- package/esm/alert/info-card/title/InfoCardTitle.d.ts +17 -0
- package/esm/alert/info-card/title/InfoCardTitle.js +16 -0
- package/esm/alert/info-card/title/InfoCardTitle.js.map +1 -0
- package/esm/alert/local-alert/close-button/LocalAlertCloseButton.d.ts +17 -0
- package/esm/alert/local-alert/close-button/LocalAlertCloseButton.js +16 -0
- package/esm/alert/local-alert/close-button/LocalAlertCloseButton.js.map +1 -0
- package/esm/alert/local-alert/content/LocalAlertContent.d.ts +18 -0
- package/esm/alert/local-alert/content/LocalAlertContent.js +17 -0
- package/esm/alert/local-alert/content/LocalAlertContent.js.map +1 -0
- package/esm/alert/local-alert/header/LocalAlertHeader.d.ts +17 -0
- package/esm/alert/local-alert/header/LocalAlertHeader.js +18 -0
- package/esm/alert/local-alert/header/LocalAlertHeader.js.map +1 -0
- package/esm/alert/local-alert/index.d.ts +2 -0
- package/esm/alert/local-alert/index.js +3 -0
- package/esm/alert/local-alert/index.js.map +1 -0
- package/esm/alert/local-alert/root/LocalAlertRoot.d.ts +81 -0
- package/esm/alert/local-alert/root/LocalAlertRoot.js +42 -0
- package/esm/alert/local-alert/root/LocalAlertRoot.js.map +1 -0
- package/esm/alert/local-alert/title/LocalAlertTitle.d.ts +17 -0
- package/esm/alert/local-alert/title/LocalAlertTitle.js +16 -0
- package/esm/alert/local-alert/title/LocalAlertTitle.js.map +1 -0
- package/esm/date/Date.locale.d.ts +5 -0
- package/esm/form/combobox/FilteredOptions/NoSearchHitsMessage.js +3 -1
- package/esm/form/combobox/FilteredOptions/NoSearchHitsMessage.js.map +1 -1
- package/esm/index.d.ts +4 -0
- package/esm/index.js +4 -0
- package/esm/index.js.map +1 -1
- package/esm/inline-message/icon/InlineMessageIcon.d.ts +5 -0
- package/esm/inline-message/icon/InlineMessageIcon.js +19 -0
- package/esm/inline-message/icon/InlineMessageIcon.js.map +1 -0
- package/esm/inline-message/index.d.ts +2 -0
- package/esm/inline-message/index.js +3 -0
- package/esm/inline-message/index.js.map +1 -0
- package/esm/inline-message/root/InlineMessage.d.ts +36 -0
- package/esm/inline-message/root/InlineMessage.js +52 -0
- package/esm/inline-message/root/InlineMessage.js.map +1 -0
- package/esm/timeline/period/ClickablePeriod.js +6 -18
- package/esm/timeline/period/ClickablePeriod.js.map +1 -1
- package/esm/timeline/pin/PinInternal.js +6 -18
- package/esm/timeline/pin/PinInternal.js.map +1 -1
- package/esm/util/i18n/locales/en.d.ts +2 -4
- package/esm/util/i18n/locales/en.js +2 -4
- package/esm/util/i18n/locales/en.js.map +1 -1
- package/esm/util/i18n/locales/nb.d.ts +4 -6
- package/esm/util/i18n/locales/nb.js +4 -6
- package/esm/util/i18n/locales/nb.js.map +1 -1
- package/esm/util/i18n/locales/nn.d.ts +2 -4
- package/esm/util/i18n/locales/nn.js +2 -4
- package/esm/util/i18n/locales/nn.js.map +1 -1
- package/package.json +45 -4
- package/src/alert/Alert.tsx +2 -10
- package/src/alert/base-alert/close-button/BaseAlertCloseButton.tsx +44 -0
- package/src/alert/base-alert/content/BaseAlertContent.tsx +43 -0
- package/src/alert/base-alert/header/BaseAlertHeader.tsx +61 -0
- package/src/alert/base-alert/index.ts +2 -0
- package/src/alert/base-alert/namespace.ts +11 -0
- package/src/alert/base-alert/root/BaseAlertRoot.context.tsx +17 -0
- package/src/alert/base-alert/root/BaseAlertRoot.tsx +102 -0
- package/src/alert/base-alert/root/BaseAlertRoot.utils.tsx +67 -0
- package/src/alert/base-alert/title/BaseAlertTitle.tsx +63 -0
- package/src/alert/global-alert/close-button/GlobalAlertCloseButton.tsx +20 -0
- package/src/alert/global-alert/content/GlobalAlertContent.tsx +21 -0
- package/src/alert/global-alert/header/GlobalAlertHeader.tsx +24 -0
- package/src/alert/global-alert/index.ts +16 -0
- package/src/alert/global-alert/root/GlobalAlertRoot.tsx +132 -0
- package/src/alert/global-alert/title/GlobalAlertTitle.tsx +20 -0
- package/src/alert/info-card/content/InfoCardContent.tsx +21 -0
- package/src/alert/info-card/header/InfoCardHeader.tsx +19 -0
- package/src/alert/info-card/index.ts +14 -0
- package/src/alert/info-card/root/InfoCardRoot.tsx +123 -0
- package/src/alert/info-card/title/InfoCardTitle.tsx +20 -0
- package/src/alert/local-alert/close-button/LocalAlertCloseButton.tsx +20 -0
- package/src/alert/local-alert/content/LocalAlertContent.tsx +21 -0
- package/src/alert/local-alert/header/LocalAlertHeader.tsx +24 -0
- package/src/alert/local-alert/index.ts +16 -0
- package/src/alert/local-alert/root/LocalAlertRoot.tsx +133 -0
- package/src/alert/local-alert/title/LocalAlertTitle.tsx +20 -0
- package/src/form/combobox/FilteredOptions/NoSearchHitsMessage.tsx +4 -1
- package/src/index.ts +24 -0
- package/src/inline-message/icon/InlineMessageIcon.tsx +33 -0
- package/src/inline-message/index.ts +3 -0
- package/src/inline-message/root/InlineMessage.tsx +92 -0
- package/src/timeline/period/ClickablePeriod.tsx +5 -34
- package/src/timeline/pin/PinInternal.tsx +5 -28
- package/src/util/i18n/locales/en.ts +2 -5
- package/src/util/i18n/locales/nb.ts +2 -5
- package/src/util/i18n/locales/nn.ts +2 -5
- package/cjs/util/renderStoriesForChromatic.d.ts +0 -5
- package/cjs/util/renderStoriesForChromatic.js +0 -21
- package/cjs/util/renderStoriesForChromatic.js.map +0 -1
- package/esm/util/renderStoriesForChromatic.d.ts +0 -5
- package/esm/util/renderStoriesForChromatic.js +0 -15
- package/esm/util/renderStoriesForChromatic.js.map +0 -1
- package/src/util/renderStoriesForChromatic.tsx +0 -26
|
@@ -5,14 +5,11 @@ declare const _default: {
|
|
|
5
5
|
showLess: string;
|
|
6
6
|
readOnly: string;
|
|
7
7
|
close: string;
|
|
8
|
-
};
|
|
9
|
-
Alert: {
|
|
10
|
-
closeAlert: string;
|
|
11
|
-
closeMessage: string;
|
|
12
8
|
error: string;
|
|
13
9
|
info: string;
|
|
14
10
|
success: string;
|
|
15
11
|
warning: string;
|
|
12
|
+
announcement: string;
|
|
16
13
|
};
|
|
17
14
|
Chips: {
|
|
18
15
|
Removable: {
|
|
@@ -21,6 +18,7 @@ declare const _default: {
|
|
|
21
18
|
};
|
|
22
19
|
Combobox: {
|
|
23
20
|
addOption: string;
|
|
21
|
+
noMatches: string;
|
|
24
22
|
loading: string;
|
|
25
23
|
maxSelected: string;
|
|
26
24
|
};
|
|
@@ -6,14 +6,11 @@ export default {
|
|
|
6
6
|
showLess: "Vis mindre",
|
|
7
7
|
readOnly: "Skrivebeskytta",
|
|
8
8
|
close: "Lukk",
|
|
9
|
-
},
|
|
10
|
-
Alert: {
|
|
11
|
-
closeAlert: "Lukk varsel",
|
|
12
|
-
closeMessage: "Lukk melding",
|
|
13
9
|
error: "Feil",
|
|
14
10
|
info: "Informasjon",
|
|
15
11
|
success: "Suksess",
|
|
16
12
|
warning: "Åtvaring",
|
|
13
|
+
announcement: "Kunngjering",
|
|
17
14
|
},
|
|
18
15
|
Chips: {
|
|
19
16
|
Removable: {
|
|
@@ -22,6 +19,7 @@ export default {
|
|
|
22
19
|
},
|
|
23
20
|
Combobox: {
|
|
24
21
|
addOption: "Legg til",
|
|
22
|
+
noMatches: "Ingen søketreff",
|
|
25
23
|
loading: "Søker…",
|
|
26
24
|
maxSelected: "{selected} av maks {limit} er valt.",
|
|
27
25
|
},
|
|
@@ -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;QAC1B,KAAK,EAAE,MAAM;
|
|
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.35.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",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"/esm",
|
|
31
31
|
"/src",
|
|
32
32
|
"!**/*.tsbuildinfo",
|
|
33
|
-
"!**/*.stories.*"
|
|
33
|
+
"!**/*.stories.*",
|
|
34
|
+
"!**/renderStoriesForChromatic.tsx"
|
|
34
35
|
],
|
|
35
36
|
"main": "./cjs/index.js",
|
|
36
37
|
"module": "./esm/index.js",
|
|
@@ -628,6 +629,46 @@
|
|
|
628
629
|
"default": "./cjs/form/form-progress/index.js"
|
|
629
630
|
}
|
|
630
631
|
},
|
|
632
|
+
"./InlineMessage": {
|
|
633
|
+
"import": {
|
|
634
|
+
"types": "./esm/inline-message/index.d.ts",
|
|
635
|
+
"default": "./esm/inline-message/index.js"
|
|
636
|
+
},
|
|
637
|
+
"require": {
|
|
638
|
+
"types": "./cjs/inline-message/index.d.ts",
|
|
639
|
+
"default": "./cjs/inline-message/index.js"
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
"./GlobalAlert": {
|
|
643
|
+
"import": {
|
|
644
|
+
"types": "./esm/alert/global-alert/index.d.ts",
|
|
645
|
+
"default": "./esm/alert/global-alert/index.js"
|
|
646
|
+
},
|
|
647
|
+
"require": {
|
|
648
|
+
"types": "./cjs/alert/global-alert/index.d.ts",
|
|
649
|
+
"default": "./cjs/alert/global-alert/index.js"
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
"./InfoCard": {
|
|
653
|
+
"import": {
|
|
654
|
+
"types": "./esm/alert/info-card/index.d.ts",
|
|
655
|
+
"default": "./esm/alert/info-card/index.js"
|
|
656
|
+
},
|
|
657
|
+
"require": {
|
|
658
|
+
"types": "./cjs/alert/info-card/index.d.ts",
|
|
659
|
+
"default": "./cjs/alert/info-card/index.js"
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
"./LocalAlert": {
|
|
663
|
+
"import": {
|
|
664
|
+
"types": "./esm/alert/local-alert/index.d.ts",
|
|
665
|
+
"default": "./esm/alert/local-alert/index.js"
|
|
666
|
+
},
|
|
667
|
+
"require": {
|
|
668
|
+
"types": "./cjs/alert/local-alert/index.d.ts",
|
|
669
|
+
"default": "./cjs/alert/local-alert/index.js"
|
|
670
|
+
}
|
|
671
|
+
},
|
|
631
672
|
"./package.json": "./package.json",
|
|
632
673
|
"./Theme": {
|
|
633
674
|
"import": {
|
|
@@ -654,8 +695,8 @@
|
|
|
654
695
|
"dependencies": {
|
|
655
696
|
"@floating-ui/react": "0.27.8",
|
|
656
697
|
"@floating-ui/react-dom": "^2.1.6",
|
|
657
|
-
"@navikt/aksel-icons": "^7.
|
|
658
|
-
"@navikt/ds-tokens": "^7.
|
|
698
|
+
"@navikt/aksel-icons": "^7.35.0",
|
|
699
|
+
"@navikt/ds-tokens": "^7.35.0",
|
|
659
700
|
"clsx": "^2.1.0",
|
|
660
701
|
"date-fns": "^4.0.0",
|
|
661
702
|
"react-day-picker": "9.7.0"
|
package/src/alert/Alert.tsx
CHANGED
|
@@ -93,7 +93,7 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
|
93
93
|
ref,
|
|
94
94
|
) => {
|
|
95
95
|
const { cn } = useRenameCSS();
|
|
96
|
-
const translate = useI18n("
|
|
96
|
+
const translate = useI18n("global");
|
|
97
97
|
const Icon = IconMap[variant];
|
|
98
98
|
return (
|
|
99
99
|
<div
|
|
@@ -132,15 +132,7 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
|
132
132
|
variant="tertiary-neutral"
|
|
133
133
|
onClick={onClose}
|
|
134
134
|
type="button"
|
|
135
|
-
icon={
|
|
136
|
-
<XMarkIcon
|
|
137
|
-
title={
|
|
138
|
-
["error", "warning"].includes(variant)
|
|
139
|
-
? translate("closeAlert")
|
|
140
|
-
: translate("closeMessage")
|
|
141
|
-
}
|
|
142
|
-
/>
|
|
143
|
-
}
|
|
135
|
+
icon={<XMarkIcon title={translate("close")} />}
|
|
144
136
|
/>
|
|
145
137
|
</div>
|
|
146
138
|
)}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
3
|
+
import { Button } from "../../../button";
|
|
4
|
+
import { useRenameCSS } from "../../../theme/Theme";
|
|
5
|
+
import { useI18n } from "../../../util/i18n/i18n.hooks";
|
|
6
|
+
|
|
7
|
+
type BaseAlertCloseButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @see 🏷️ {@link BaseAlertCloseButtonProps}
|
|
11
|
+
* @example
|
|
12
|
+
* ```jsx
|
|
13
|
+
* <BaseAlert>
|
|
14
|
+
* <BaseAlert.Header>
|
|
15
|
+
* <BaseAlert.Title>Info title</BaseAlert.Title>
|
|
16
|
+
* <BaseAlert.CloseButton onClick={...} />
|
|
17
|
+
* </BaseAlert.Header>
|
|
18
|
+
* </BaseAlert>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
const BaseAlertCloseButton = forwardRef<
|
|
22
|
+
HTMLButtonElement,
|
|
23
|
+
BaseAlertCloseButtonProps
|
|
24
|
+
>(({ className, ...restProps }: BaseAlertCloseButtonProps, forwardedRef) => {
|
|
25
|
+
const { cn } = useRenameCSS();
|
|
26
|
+
const translate = useI18n("global");
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Button
|
|
30
|
+
ref={forwardedRef}
|
|
31
|
+
type="button"
|
|
32
|
+
{...restProps}
|
|
33
|
+
data-color="neutral"
|
|
34
|
+
variant="tertiary-neutral"
|
|
35
|
+
className={cn(className, "navds-base-alert__close-button")}
|
|
36
|
+
size="small"
|
|
37
|
+
title={translate("close")}
|
|
38
|
+
icon={<XMarkIcon aria-hidden />}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { BaseAlertCloseButton };
|
|
44
|
+
export type { BaseAlertCloseButtonProps };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { useRenameCSS, useThemeInternal } from "../../../theme/Theme";
|
|
3
|
+
|
|
4
|
+
interface BaseAlertContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @see 🏷️ {@link BaseAlertContentProps}
|
|
10
|
+
* @example
|
|
11
|
+
* ```jsx
|
|
12
|
+
* <BaseAlert>
|
|
13
|
+
* <BaseAlert.Header>
|
|
14
|
+
* <BaseAlert.Title>Info title</BaseAlert.Title>
|
|
15
|
+
* </BaseAlert.Header>
|
|
16
|
+
*
|
|
17
|
+
* <BaseAlert.Content>Content</BaseAlert.Content>
|
|
18
|
+
* </BaseAlert>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
const BaseAlertContent = forwardRef<HTMLDivElement, BaseAlertContentProps>(
|
|
22
|
+
(
|
|
23
|
+
{ children, className, ...restProps }: BaseAlertContentProps,
|
|
24
|
+
forwardedRef,
|
|
25
|
+
) => {
|
|
26
|
+
const { cn } = useRenameCSS();
|
|
27
|
+
const themeContext = useThemeInternal(false);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
ref={forwardedRef}
|
|
32
|
+
data-color={themeContext?.color}
|
|
33
|
+
{...restProps}
|
|
34
|
+
className={cn(className, "navds-base-alert__content")}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export { BaseAlertContent };
|
|
43
|
+
export type { BaseAlertContentProps };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { useRenameCSS } from "../../../theme/Theme";
|
|
3
|
+
import { BodyShort } from "../../../typography";
|
|
4
|
+
import { useI18n } from "../../../util/i18n/i18n.hooks";
|
|
5
|
+
import { useBaseAlert } from "../root/BaseAlertRoot.context";
|
|
6
|
+
import { BaseAlertStatusIcon } from "../root/BaseAlertRoot.utils";
|
|
7
|
+
|
|
8
|
+
interface BaseAlertHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Icon to display in the header.
|
|
12
|
+
*/
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @see 🏷️ {@link BaseAlertHeaderProps}
|
|
18
|
+
* @example
|
|
19
|
+
* ```jsx
|
|
20
|
+
* <BaseAlert>
|
|
21
|
+
* <BaseAlert.Header icon={<InformationSquareIcon aria-hidden />}>
|
|
22
|
+
* <BaseAlert.Title>Info title</BaseAlert.Title>
|
|
23
|
+
* </BaseAlert.Header>
|
|
24
|
+
* </BaseAlert>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
const BaseAlertHeader = forwardRef<HTMLDivElement, BaseAlertHeaderProps>(
|
|
28
|
+
(
|
|
29
|
+
{ children, className, icon, ...restProps }: BaseAlertHeaderProps,
|
|
30
|
+
forwardedRef,
|
|
31
|
+
) => {
|
|
32
|
+
const { cn } = useRenameCSS();
|
|
33
|
+
const { status, color, statusId } = useBaseAlert();
|
|
34
|
+
const translate = useI18n("global");
|
|
35
|
+
|
|
36
|
+
const headerIcon =
|
|
37
|
+
icon ?? (status ? <BaseAlertStatusIcon status={status} /> : null);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
ref={forwardedRef}
|
|
42
|
+
{...restProps}
|
|
43
|
+
data-color={color}
|
|
44
|
+
className={cn(className, "navds-base-alert__header")}
|
|
45
|
+
>
|
|
46
|
+
{headerIcon && (
|
|
47
|
+
<div className={cn("navds-base-alert__icon")}>{headerIcon}</div>
|
|
48
|
+
)}
|
|
49
|
+
{status && (
|
|
50
|
+
<BodyShort id={statusId} aria-hidden visuallyHidden>
|
|
51
|
+
{`${translate(status)}: `}
|
|
52
|
+
</BodyShort>
|
|
53
|
+
)}
|
|
54
|
+
{children}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export { BaseAlertHeader };
|
|
61
|
+
export type { BaseAlertHeaderProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { BaseAlertCloseButton as CloseButton } from "./close-button/BaseAlertCloseButton";
|
|
2
|
+
export { BaseAlertContent as Content } from "./content/BaseAlertContent";
|
|
3
|
+
export { BaseAlertTitle as Title } from "./title/BaseAlertTitle";
|
|
4
|
+
export { BaseAlertHeader as Header } from "./header/BaseAlertHeader";
|
|
5
|
+
export { BaseAlert as Root } from "./root/BaseAlertRoot";
|
|
6
|
+
|
|
7
|
+
export type { BaseAlertCloseButtonProps as CloseButtonProps } from "./close-button/BaseAlertCloseButton";
|
|
8
|
+
export type { BaseAlertContentProps as ContentProps } from "./content/BaseAlertContent";
|
|
9
|
+
export type { BaseAlertTitleProps as TitleProps } from "./title/BaseAlertTitle";
|
|
10
|
+
export type { BaseAlertHeaderProps as HeaderProps } from "./header/BaseAlertHeader";
|
|
11
|
+
export type { BaseAlertProps as RootProps } from "./root/BaseAlertRoot";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AkselColor } from "../../../types";
|
|
2
|
+
import { createContext } from "../../../util/create-context";
|
|
3
|
+
|
|
4
|
+
type BaseAlertContextProps = {
|
|
5
|
+
size: "medium" | "small";
|
|
6
|
+
status?: "announcement" | "success" | "warning" | "error";
|
|
7
|
+
color: AkselColor | undefined;
|
|
8
|
+
statusId: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const [BaseAlertProvider, useBaseAlert] = createContext<BaseAlertContextProps>({
|
|
12
|
+
name: "BaseAlert",
|
|
13
|
+
errorMessage: "useBaseAlert must be used within a BaseAlertProvider",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { BaseAlertProvider, useBaseAlert };
|
|
17
|
+
export type { BaseAlertContextProps };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { useRenameCSS } from "../../../theme/Theme";
|
|
3
|
+
import { AkselColor } from "../../../types";
|
|
4
|
+
import { useId } from "../../../util";
|
|
5
|
+
import { useI18n } from "../../../util/i18n/i18n.hooks";
|
|
6
|
+
import {
|
|
7
|
+
type BaseAlertContextProps,
|
|
8
|
+
BaseAlertProvider,
|
|
9
|
+
} from "./BaseAlertRoot.context";
|
|
10
|
+
import { baseAlertStatusToDataColor } from "./BaseAlertRoot.utils";
|
|
11
|
+
|
|
12
|
+
interface BaseAlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
/**
|
|
14
|
+
* Component content.
|
|
15
|
+
*/
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Changes the size.
|
|
19
|
+
* @default "medium"
|
|
20
|
+
*/
|
|
21
|
+
size?: BaseAlertContextProps["size"];
|
|
22
|
+
/**
|
|
23
|
+
* Overrides color
|
|
24
|
+
*/
|
|
25
|
+
"data-color"?: AkselColor;
|
|
26
|
+
/**
|
|
27
|
+
* Intensity of the alert
|
|
28
|
+
*/
|
|
29
|
+
type: "moderate" | "strong";
|
|
30
|
+
/**
|
|
31
|
+
* Centers content and removes border-radius
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
global?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Type of alert
|
|
37
|
+
*/
|
|
38
|
+
status?: BaseAlertContextProps["status"];
|
|
39
|
+
/**
|
|
40
|
+
* Changes the HTML element used for the root element.
|
|
41
|
+
*
|
|
42
|
+
* **Testing**: When using `axe-core` for accessibility testing, `section` might warn about unique landmarks if you have multiple Alerts on page with the same status.
|
|
43
|
+
* In those cases, consider using `div` as the root element, or adding unique `aria-label` or `aria-labelledby` props.
|
|
44
|
+
* @see [📝 Landmarks unique](https://dequeuniversity.com/rules/axe/4.6/landmark-unique)
|
|
45
|
+
* @default "section"
|
|
46
|
+
*/
|
|
47
|
+
as?: "section" | "div";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const BaseAlert = forwardRef<HTMLDivElement, BaseAlertProps>(
|
|
51
|
+
(
|
|
52
|
+
{
|
|
53
|
+
children,
|
|
54
|
+
className,
|
|
55
|
+
size = "medium",
|
|
56
|
+
"data-color": dataColor,
|
|
57
|
+
type,
|
|
58
|
+
global = false,
|
|
59
|
+
status,
|
|
60
|
+
as: Component = "section",
|
|
61
|
+
"aria-label": ariaLabel,
|
|
62
|
+
role,
|
|
63
|
+
...restProps
|
|
64
|
+
}: BaseAlertProps,
|
|
65
|
+
forwardedRef,
|
|
66
|
+
) => {
|
|
67
|
+
const { cn } = useRenameCSS();
|
|
68
|
+
|
|
69
|
+
const statusId = useId();
|
|
70
|
+
const translate = useI18n("global");
|
|
71
|
+
|
|
72
|
+
const alertColor = status ? baseAlertStatusToDataColor(status) : dataColor;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<BaseAlertProvider
|
|
76
|
+
size={size}
|
|
77
|
+
status={status}
|
|
78
|
+
color={alertColor}
|
|
79
|
+
statusId={statusId}
|
|
80
|
+
>
|
|
81
|
+
<Component
|
|
82
|
+
aria-label={
|
|
83
|
+
ariaLabel ??
|
|
84
|
+
(!status || Component === "div" ? undefined : translate(status))
|
|
85
|
+
}
|
|
86
|
+
ref={forwardedRef}
|
|
87
|
+
{...restProps}
|
|
88
|
+
className={cn(className, "navds-base-alert")}
|
|
89
|
+
data-size={size}
|
|
90
|
+
data-color={alertColor}
|
|
91
|
+
data-variant={type}
|
|
92
|
+
data-global={global}
|
|
93
|
+
>
|
|
94
|
+
<div role={role}>{children}</div>
|
|
95
|
+
</Component>
|
|
96
|
+
</BaseAlertProvider>
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
export { BaseAlert };
|
|
102
|
+
export type { BaseAlertProps };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
CheckmarkCircleFillIcon,
|
|
4
|
+
CheckmarkCircleIcon,
|
|
5
|
+
ExclamationmarkTriangleFillIcon,
|
|
6
|
+
ExclamationmarkTriangleIcon,
|
|
7
|
+
MegaphoneSpeakingFillIcon,
|
|
8
|
+
MegaphoneSpeakingIcon,
|
|
9
|
+
XMarkOctagonFillIcon,
|
|
10
|
+
XMarkOctagonIcon,
|
|
11
|
+
} from "@navikt/aksel-icons";
|
|
12
|
+
import type { AkselColor } from "../../../types";
|
|
13
|
+
import type { BaseAlertContextProps } from "../root/BaseAlertRoot.context";
|
|
14
|
+
|
|
15
|
+
function baseAlertStatusToDataColor(
|
|
16
|
+
status: BaseAlertContextProps["status"],
|
|
17
|
+
): AkselColor {
|
|
18
|
+
switch (status) {
|
|
19
|
+
case "announcement":
|
|
20
|
+
return "neutral";
|
|
21
|
+
case "success":
|
|
22
|
+
return "success";
|
|
23
|
+
case "warning":
|
|
24
|
+
return "warning";
|
|
25
|
+
case "error":
|
|
26
|
+
return "danger";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return "neutral";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const STATUS_ICONS = {
|
|
33
|
+
announcement: {
|
|
34
|
+
fill: MegaphoneSpeakingFillIcon,
|
|
35
|
+
outline: MegaphoneSpeakingIcon,
|
|
36
|
+
},
|
|
37
|
+
success: {
|
|
38
|
+
fill: CheckmarkCircleFillIcon,
|
|
39
|
+
outline: CheckmarkCircleIcon,
|
|
40
|
+
},
|
|
41
|
+
warning: {
|
|
42
|
+
fill: ExclamationmarkTriangleFillIcon,
|
|
43
|
+
outline: ExclamationmarkTriangleIcon,
|
|
44
|
+
},
|
|
45
|
+
error: {
|
|
46
|
+
fill: XMarkOctagonFillIcon,
|
|
47
|
+
outline: XMarkOctagonIcon,
|
|
48
|
+
},
|
|
49
|
+
} as const;
|
|
50
|
+
|
|
51
|
+
function BaseAlertStatusIcon({
|
|
52
|
+
status,
|
|
53
|
+
fill = true,
|
|
54
|
+
}: {
|
|
55
|
+
status: BaseAlertContextProps["status"];
|
|
56
|
+
fill?: boolean;
|
|
57
|
+
}) {
|
|
58
|
+
if (!status) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const Icon = fill ? STATUS_ICONS[status].fill : STATUS_ICONS[status].outline;
|
|
63
|
+
|
|
64
|
+
return <Icon aria-hidden />;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { BaseAlertStatusIcon, baseAlertStatusToDataColor };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import { useRenameCSS } from "../../../theme/Theme";
|
|
4
|
+
import { BodyShort } from "../../../typography";
|
|
5
|
+
import { useId } from "../../../util";
|
|
6
|
+
import { useBaseAlert } from "../root/BaseAlertRoot.context";
|
|
7
|
+
|
|
8
|
+
interface BaseAlertTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Changes the HTML element used for the title.
|
|
12
|
+
* @default "h2"
|
|
13
|
+
*/
|
|
14
|
+
as?: "h2" | "h3" | "h4" | "h5" | "h6" | "div";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Title component for BaseAlert. Remember to use correct heading-level with the `as` prop.
|
|
19
|
+
* @see 🏷️ {@link BaseAlertTitleProps}
|
|
20
|
+
* @example
|
|
21
|
+
* ```jsx
|
|
22
|
+
* <BaseAlert>
|
|
23
|
+
* <BaseAlert.Header>
|
|
24
|
+
* <BaseAlert.Title as="h2">Info title</BaseAlert.Title>
|
|
25
|
+
* </BaseAlert.Header>
|
|
26
|
+
* </BaseAlert>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
const BaseAlertTitle = forwardRef<HTMLHeadingElement, BaseAlertTitleProps>(
|
|
30
|
+
(
|
|
31
|
+
{
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
as = "h2",
|
|
35
|
+
id: idProp,
|
|
36
|
+
...restProps
|
|
37
|
+
}: BaseAlertTitleProps,
|
|
38
|
+
forwardedRef,
|
|
39
|
+
) => {
|
|
40
|
+
const { cn } = useRenameCSS();
|
|
41
|
+
const { size, statusId } = useBaseAlert();
|
|
42
|
+
|
|
43
|
+
const titleId = useId(idProp);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<BodyShort
|
|
47
|
+
ref={forwardedRef}
|
|
48
|
+
{...restProps}
|
|
49
|
+
as={as}
|
|
50
|
+
size={size === "medium" ? "large" : "medium"}
|
|
51
|
+
weight="semibold"
|
|
52
|
+
className={cn(className, "navds-base-alert__title")}
|
|
53
|
+
id={titleId}
|
|
54
|
+
aria-labelledby={cl(statusId, titleId)}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</BodyShort>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
export { BaseAlertTitle };
|
|
63
|
+
export type { BaseAlertTitleProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseAlert } from "../../base-alert";
|
|
2
|
+
|
|
3
|
+
type GlobalAlertCloseButtonProps = BaseAlert.CloseButtonProps;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @see 🏷️ {@link GlobalAlertCloseButtonProps}
|
|
7
|
+
* @example
|
|
8
|
+
* ```jsx
|
|
9
|
+
* <GlobalAlert>
|
|
10
|
+
* <GlobalAlert.Header>
|
|
11
|
+
* <GlobalAlert.Title>Info title</GlobalAlert.Title>
|
|
12
|
+
* <GlobalAlert.CloseButton onClick={() => alert("Closed!")} />
|
|
13
|
+
* </GlobalAlert.Header>
|
|
14
|
+
* </GlobalAlert>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
const GlobalAlertCloseButton = BaseAlert.CloseButton;
|
|
18
|
+
|
|
19
|
+
export { GlobalAlertCloseButton };
|
|
20
|
+
export type { GlobalAlertCloseButtonProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseAlert } from "../../base-alert";
|
|
2
|
+
|
|
3
|
+
type GlobalAlertContentProps = BaseAlert.ContentProps;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @see 🏷️ {@link GlobalAlertContentProps}
|
|
7
|
+
* @example
|
|
8
|
+
* ```jsx
|
|
9
|
+
* <GlobalAlert>
|
|
10
|
+
* <GlobalAlert.Header>
|
|
11
|
+
* <GlobalAlert.Title>Info title</GlobalAlert.Title>
|
|
12
|
+
* </GlobalAlert.Header>
|
|
13
|
+
*
|
|
14
|
+
* <GlobalAlert.Content>Content</GlobalAlert.Content>
|
|
15
|
+
* </GlobalAlert>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const GlobalAlertContent = BaseAlert.Content;
|
|
19
|
+
|
|
20
|
+
export { GlobalAlertContent };
|
|
21
|
+
export type { GlobalAlertContentProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { BaseAlert } from "../../base-alert";
|
|
3
|
+
|
|
4
|
+
type GlobalAlertHeaderProps = Omit<BaseAlert.HeaderProps, "icon">;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @see 🏷️ {@link GlobalAlertHeaderProps}
|
|
8
|
+
* @example
|
|
9
|
+
* ```jsx
|
|
10
|
+
* <GlobalAlert status="success">
|
|
11
|
+
* <GlobalAlert.Header>
|
|
12
|
+
* <GlobalAlert.Title>Info title</GlobalAlert.Title>
|
|
13
|
+
* </GlobalAlert.Header>
|
|
14
|
+
* </GlobalAlert>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
const GlobalAlertHeader = forwardRef<HTMLDivElement, GlobalAlertHeaderProps>(
|
|
18
|
+
(props, forwardedRef) => {
|
|
19
|
+
return <BaseAlert.Header ref={forwardedRef} {...props} />;
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export { GlobalAlertHeader };
|
|
24
|
+
export type { GlobalAlertHeaderProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export {
|
|
3
|
+
GlobalAlert,
|
|
4
|
+
GlobalAlertHeader,
|
|
5
|
+
GlobalAlertTitle,
|
|
6
|
+
GlobalAlertContent,
|
|
7
|
+
GlobalAlertCloseButton,
|
|
8
|
+
} from "./root/GlobalAlertRoot";
|
|
9
|
+
|
|
10
|
+
export type {
|
|
11
|
+
GlobalAlertProps,
|
|
12
|
+
GlobalAlertHeaderProps,
|
|
13
|
+
GlobalAlertTitleProps,
|
|
14
|
+
GlobalAlertContentProps,
|
|
15
|
+
GlobalAlertCloseButtonProps,
|
|
16
|
+
} from "./root/GlobalAlertRoot";
|