@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
package/cjs/alert/Alert.js
CHANGED
|
@@ -69,7 +69,7 @@ const IconMap = {
|
|
|
69
69
|
exports.Alert = (0, react_1.forwardRef)((_a, ref) => {
|
|
70
70
|
var { children, className, variant, size = "medium", fullWidth = false, contentMaxWidth = true, inline = false, closeButton = false, onClose } = _a, rest = __rest(_a, ["children", "className", "variant", "size", "fullWidth", "contentMaxWidth", "inline", "closeButton", "onClose"]);
|
|
71
71
|
const { cn } = (0, Theme_1.useRenameCSS)();
|
|
72
|
-
const translate = (0, i18n_hooks_1.useI18n)("
|
|
72
|
+
const translate = (0, i18n_hooks_1.useI18n)("global");
|
|
73
73
|
const Icon = IconMap[variant];
|
|
74
74
|
return (react_1.default.createElement("div", Object.assign({}, rest, { "data-color": variantToRole(variant), "data-variant": variant, ref: ref, className: cn(className, "navds-alert", `navds-alert--${variant}`, `navds-alert--${size}`, {
|
|
75
75
|
"navds-alert--full-width": fullWidth,
|
|
@@ -79,9 +79,7 @@ exports.Alert = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
79
79
|
react_1.default.createElement(Icon, { title: translate(variant), className: cn("navds-alert__icon") }),
|
|
80
80
|
react_1.default.createElement(typography_1.BodyLong, { as: "div", size: size, className: cn("navds-alert__wrapper", contentMaxWidth && "navds-alert__wrapper--maxwidth") }, children),
|
|
81
81
|
closeButton && !inline && (react_1.default.createElement("div", { className: cn("navds-alert__button-wrapper") },
|
|
82
|
-
react_1.default.createElement(button_1.Button, { className: cn("navds-alert__button"), size: "small", variant: "tertiary-neutral", onClick: onClose, type: "button", icon: react_1.default.createElement(aksel_icons_1.XMarkIcon, { title:
|
|
83
|
-
? translate("closeAlert")
|
|
84
|
-
: translate("closeMessage") }) })))));
|
|
82
|
+
react_1.default.createElement(button_1.Button, { className: cn("navds-alert__button"), size: "small", variant: "tertiary-neutral", onClick: onClose, type: "button", icon: react_1.default.createElement(aksel_icons_1.XMarkIcon, { title: translate("close") }) })))));
|
|
85
83
|
});
|
|
86
84
|
function variantToRole(variant) {
|
|
87
85
|
switch (variant) {
|
package/cjs/alert/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/alert/Alert.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAC1C,qDAM6B;AAC7B,sCAAmC;AACnC,0CAA8C;AAE9C,8CAAyC;AACzC,wDAAkD;AAkDlD,MAAM,OAAO,GAAG;IACd,KAAK,EAAE,kCAAoB;IAC3B,OAAO,EAAE,6CAA+B;IACxC,IAAI,EAAE,uCAAyB;IAC/B,OAAO,EAAE,qCAAuB;CACjC,CAAC;AAEF;;;;;;;;GAQG;AACU,QAAA,KAAK,GAAG,IAAA,kBAAU,EAC7B,CACE,EAWC,EACD,GAAG,EACH,EAAE;QAbF,EACE,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,SAAS,GAAG,KAAK,EACjB,eAAe,GAAG,IAAI,EACtB,MAAM,GAAG,KAAK,EACd,WAAW,GAAG,KAAK,EACnB,OAAO,OAER,EADI,IAAI,cAVT,gHAWC,CADQ;IAIT,MAAM,EAAE,EAAE,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAA,oBAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/alert/Alert.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAC1C,qDAM6B;AAC7B,sCAAmC;AACnC,0CAA8C;AAE9C,8CAAyC;AACzC,wDAAkD;AAkDlD,MAAM,OAAO,GAAG;IACd,KAAK,EAAE,kCAAoB;IAC3B,OAAO,EAAE,6CAA+B;IACxC,IAAI,EAAE,uCAAyB;IAC/B,OAAO,EAAE,qCAAuB;CACjC,CAAC;AAEF;;;;;;;;GAQG;AACU,QAAA,KAAK,GAAG,IAAA,kBAAU,EAC7B,CACE,EAWC,EACD,GAAG,EACH,EAAE;QAbF,EACE,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,SAAS,GAAG,KAAK,EACjB,eAAe,GAAG,IAAI,EACtB,MAAM,GAAG,KAAK,EACd,WAAW,GAAG,KAAK,EACnB,OAAO,OAER,EADI,IAAI,cAVT,gHAWC,CADQ;IAIT,MAAM,EAAE,EAAE,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAA,oBAAO,EAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,OAAO,CACL,uDACM,IAAI,kBACI,aAAa,CAAC,OAAO,CAAC,kBACpB,OAAO,EACrB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,SAAS,EACT,aAAa,EACb,gBAAgB,OAAO,EAAE,EACzB,gBAAgB,IAAI,EAAE,EACtB;YACE,yBAAyB,EAAE,SAAS;YACpC,qBAAqB,EAAE,MAAM;YAC7B,2BAA2B,EAAE,WAAW;SACzC,CACF;QAED,8BAAC,IAAI,IAAC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAI;QACvE,8BAAC,qBAAQ,IACP,EAAE,EAAC,KAAK,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,sBAAsB,EACtB,eAAe,IAAI,gCAAgC,CACpD,IAEA,QAAQ,CACA;QACV,WAAW,IAAI,CAAC,MAAM,IAAI,CACzB,uCAAK,SAAS,EAAE,EAAE,CAAC,6BAA6B,CAAC;YAC/C,8BAAC,eAAM,IACL,SAAS,EAAE,EAAE,CAAC,qBAAqB,CAAC,EACpC,IAAI,EAAC,OAAO,EACZ,OAAO,EAAC,kBAAkB,EAC1B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,8BAAC,uBAAS,IAAC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,GAAI,GAC9C,CACE,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,SAAS,aAAa,CAAC,OAA8B;IACnD,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAED,kBAAe,aAAK,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type BaseAlertCloseButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
3
|
+
/**
|
|
4
|
+
* @see 🏷️ {@link BaseAlertCloseButtonProps}
|
|
5
|
+
* @example
|
|
6
|
+
* ```jsx
|
|
7
|
+
* <BaseAlert>
|
|
8
|
+
* <BaseAlert.Header>
|
|
9
|
+
* <BaseAlert.Title>Info title</BaseAlert.Title>
|
|
10
|
+
* <BaseAlert.CloseButton onClick={...} />
|
|
11
|
+
* </BaseAlert.Header>
|
|
12
|
+
* </BaseAlert>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare const BaseAlertCloseButton: React.ForwardRefExoticComponent<BaseAlertCloseButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
export { BaseAlertCloseButton };
|
|
17
|
+
export type { BaseAlertCloseButtonProps };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.BaseAlertCloseButton = void 0;
|
|
48
|
+
const react_1 = __importStar(require("react"));
|
|
49
|
+
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
50
|
+
const button_1 = require("../../../button");
|
|
51
|
+
const Theme_1 = require("../../../theme/Theme");
|
|
52
|
+
const i18n_hooks_1 = require("../../../util/i18n/i18n.hooks");
|
|
53
|
+
/**
|
|
54
|
+
* @see 🏷️ {@link BaseAlertCloseButtonProps}
|
|
55
|
+
* @example
|
|
56
|
+
* ```jsx
|
|
57
|
+
* <BaseAlert>
|
|
58
|
+
* <BaseAlert.Header>
|
|
59
|
+
* <BaseAlert.Title>Info title</BaseAlert.Title>
|
|
60
|
+
* <BaseAlert.CloseButton onClick={...} />
|
|
61
|
+
* </BaseAlert.Header>
|
|
62
|
+
* </BaseAlert>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
const BaseAlertCloseButton = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
66
|
+
var { className } = _a, restProps = __rest(_a, ["className"]);
|
|
67
|
+
const { cn } = (0, Theme_1.useRenameCSS)();
|
|
68
|
+
const translate = (0, i18n_hooks_1.useI18n)("global");
|
|
69
|
+
return (react_1.default.createElement(button_1.Button, Object.assign({ ref: forwardedRef, type: "button" }, restProps, { "data-color": "neutral", variant: "tertiary-neutral", className: cn(className, "navds-base-alert__close-button"), size: "small", title: translate("close"), icon: react_1.default.createElement(aksel_icons_1.XMarkIcon, { "aria-hidden": true }) })));
|
|
70
|
+
});
|
|
71
|
+
exports.BaseAlertCloseButton = BaseAlertCloseButton;
|
|
72
|
+
//# sourceMappingURL=BaseAlertCloseButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAlertCloseButton.js","sourceRoot":"","sources":["../../../../src/alert/base-alert/close-button/BaseAlertCloseButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAC1C,qDAAgD;AAChD,4CAAyC;AACzC,gDAAoD;AACpD,8DAAwD;AAIxD;;;;;;;;;;;GAWG;AACH,MAAM,oBAAoB,GAAG,IAAA,kBAAU,EAGrC,CAAC,EAAsD,EAAE,YAAY,EAAE,EAAE;QAAxE,EAAE,SAAS,OAA2C,EAAtC,SAAS,cAAzB,aAA2B,CAAF;IAC1B,MAAM,EAAE,EAAE,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAA,oBAAO,EAAC,QAAQ,CAAC,CAAC;IAEpC,OAAO,CACL,8BAAC,eAAM,kBACL,GAAG,EAAE,YAAY,EACjB,IAAI,EAAC,QAAQ,IACT,SAAS,kBACF,SAAS,EACpB,OAAO,EAAC,kBAAkB,EAC1B,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,gCAAgC,CAAC,EAC1D,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,EACzB,IAAI,EAAE,8BAAC,uBAAS,0BAAe,IAC/B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEM,oDAAoB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface BaseAlertContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* @see 🏷️ {@link BaseAlertContentProps}
|
|
7
|
+
* @example
|
|
8
|
+
* ```jsx
|
|
9
|
+
* <BaseAlert>
|
|
10
|
+
* <BaseAlert.Header>
|
|
11
|
+
* <BaseAlert.Title>Info title</BaseAlert.Title>
|
|
12
|
+
* </BaseAlert.Header>
|
|
13
|
+
*
|
|
14
|
+
* <BaseAlert.Content>Content</BaseAlert.Content>
|
|
15
|
+
* </BaseAlert>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare const BaseAlertContent: React.ForwardRefExoticComponent<BaseAlertContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export { BaseAlertContent };
|
|
20
|
+
export type { BaseAlertContentProps };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.BaseAlertContent = void 0;
|
|
48
|
+
const react_1 = __importStar(require("react"));
|
|
49
|
+
const Theme_1 = require("../../../theme/Theme");
|
|
50
|
+
/**
|
|
51
|
+
* @see 🏷️ {@link BaseAlertContentProps}
|
|
52
|
+
* @example
|
|
53
|
+
* ```jsx
|
|
54
|
+
* <BaseAlert>
|
|
55
|
+
* <BaseAlert.Header>
|
|
56
|
+
* <BaseAlert.Title>Info title</BaseAlert.Title>
|
|
57
|
+
* </BaseAlert.Header>
|
|
58
|
+
*
|
|
59
|
+
* <BaseAlert.Content>Content</BaseAlert.Content>
|
|
60
|
+
* </BaseAlert>
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
const BaseAlertContent = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
64
|
+
var { children, className } = _a, restProps = __rest(_a, ["children", "className"]);
|
|
65
|
+
const { cn } = (0, Theme_1.useRenameCSS)();
|
|
66
|
+
const themeContext = (0, Theme_1.useThemeInternal)(false);
|
|
67
|
+
return (react_1.default.createElement("div", Object.assign({ ref: forwardedRef, "data-color": themeContext === null || themeContext === void 0 ? void 0 : themeContext.color }, restProps, { className: cn(className, "navds-base-alert__content") }), children));
|
|
68
|
+
});
|
|
69
|
+
exports.BaseAlertContent = BaseAlertContent;
|
|
70
|
+
//# sourceMappingURL=BaseAlertContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAlertContent.js","sourceRoot":"","sources":["../../../../src/alert/base-alert/content/BaseAlertContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAC1C,gDAAsE;AAMtE;;;;;;;;;;;;GAYG;AACH,MAAM,gBAAgB,GAAG,IAAA,kBAAU,EACjC,CACE,EAA4D,EAC5D,YAAY,EACZ,EAAE;QAFF,EAAE,QAAQ,EAAE,SAAS,OAAuC,EAAlC,SAAS,cAAnC,yBAAqC,CAAF;IAGnC,MAAM,EAAE,EAAE,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAC9B,MAAM,YAAY,GAAG,IAAA,wBAAgB,EAAC,KAAK,CAAC,CAAC;IAE7C,OAAO,CACL,qDACE,GAAG,EAAE,YAAY,gBACL,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,IAC3B,SAAS,IACb,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,2BAA2B,CAAC,KAEpD,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEO,4CAAgB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface BaseAlertHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Icon to display in the header.
|
|
6
|
+
*/
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @see 🏷️ {@link BaseAlertHeaderProps}
|
|
11
|
+
* @example
|
|
12
|
+
* ```jsx
|
|
13
|
+
* <BaseAlert>
|
|
14
|
+
* <BaseAlert.Header icon={<InformationSquareIcon aria-hidden />}>
|
|
15
|
+
* <BaseAlert.Title>Info title</BaseAlert.Title>
|
|
16
|
+
* </BaseAlert.Header>
|
|
17
|
+
* </BaseAlert>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const BaseAlertHeader: React.ForwardRefExoticComponent<BaseAlertHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export { BaseAlertHeader };
|
|
22
|
+
export type { BaseAlertHeaderProps };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.BaseAlertHeader = void 0;
|
|
48
|
+
const react_1 = __importStar(require("react"));
|
|
49
|
+
const Theme_1 = require("../../../theme/Theme");
|
|
50
|
+
const typography_1 = require("../../../typography");
|
|
51
|
+
const i18n_hooks_1 = require("../../../util/i18n/i18n.hooks");
|
|
52
|
+
const BaseAlertRoot_context_1 = require("../root/BaseAlertRoot.context");
|
|
53
|
+
const BaseAlertRoot_utils_1 = require("../root/BaseAlertRoot.utils");
|
|
54
|
+
/**
|
|
55
|
+
* @see 🏷️ {@link BaseAlertHeaderProps}
|
|
56
|
+
* @example
|
|
57
|
+
* ```jsx
|
|
58
|
+
* <BaseAlert>
|
|
59
|
+
* <BaseAlert.Header icon={<InformationSquareIcon aria-hidden />}>
|
|
60
|
+
* <BaseAlert.Title>Info title</BaseAlert.Title>
|
|
61
|
+
* </BaseAlert.Header>
|
|
62
|
+
* </BaseAlert>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
const BaseAlertHeader = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
66
|
+
var { children, className, icon } = _a, restProps = __rest(_a, ["children", "className", "icon"]);
|
|
67
|
+
const { cn } = (0, Theme_1.useRenameCSS)();
|
|
68
|
+
const { status, color, statusId } = (0, BaseAlertRoot_context_1.useBaseAlert)();
|
|
69
|
+
const translate = (0, i18n_hooks_1.useI18n)("global");
|
|
70
|
+
const headerIcon = icon !== null && icon !== void 0 ? icon : (status ? react_1.default.createElement(BaseAlertRoot_utils_1.BaseAlertStatusIcon, { status: status }) : null);
|
|
71
|
+
return (react_1.default.createElement("div", Object.assign({ ref: forwardedRef }, restProps, { "data-color": color, className: cn(className, "navds-base-alert__header") }),
|
|
72
|
+
headerIcon && (react_1.default.createElement("div", { className: cn("navds-base-alert__icon") }, headerIcon)),
|
|
73
|
+
status && (react_1.default.createElement(typography_1.BodyShort, { id: statusId, "aria-hidden": true, visuallyHidden: true }, `${translate(status)}: `)),
|
|
74
|
+
children));
|
|
75
|
+
});
|
|
76
|
+
exports.BaseAlertHeader = BaseAlertHeader;
|
|
77
|
+
//# sourceMappingURL=BaseAlertHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAlertHeader.js","sourceRoot":"","sources":["../../../../src/alert/base-alert/header/BaseAlertHeader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAC1C,gDAAoD;AACpD,oDAAgD;AAChD,8DAAwD;AACxD,yEAA6D;AAC7D,qEAAkE;AAUlE;;;;;;;;;;GAUG;AACH,MAAM,eAAe,GAAG,IAAA,kBAAU,EAChC,CACE,EAAiE,EACjE,YAAY,EACZ,EAAE;QAFF,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,OAAsC,EAAjC,SAAS,cAAzC,iCAA2C,CAAF;IAGzC,MAAM,EAAE,EAAE,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAA,oCAAY,GAAE,CAAC;IACnD,MAAM,SAAS,GAAG,IAAA,oBAAO,EAAC,QAAQ,CAAC,CAAC;IAEpC,MAAM,UAAU,GACd,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC,MAAM,CAAC,CAAC,CAAC,8BAAC,yCAAmB,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEpE,OAAO,CACL,qDACE,GAAG,EAAE,YAAY,IACb,SAAS,kBACD,KAAK,EACjB,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,0BAA0B,CAAC;QAEnD,UAAU,IAAI,CACb,uCAAK,SAAS,EAAE,EAAE,CAAC,wBAAwB,CAAC,IAAG,UAAU,CAAO,CACjE;QACA,MAAM,IAAI,CACT,8BAAC,sBAAS,IAAC,EAAE,EAAE,QAAQ,uBAAc,cAAc,UAChD,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CACf,CACb;QACA,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEO,0CAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as BaseAlert from "./namespace";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.BaseAlert = void 0;
|
|
38
|
+
exports.BaseAlert = __importStar(require("./namespace"));
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/alert/base-alert/index.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,yDAAyC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export type { BaseAlertCloseButtonProps as CloseButtonProps } from "./close-button/BaseAlertCloseButton";
|
|
7
|
+
export type { BaseAlertContentProps as ContentProps } from "./content/BaseAlertContent";
|
|
8
|
+
export type { BaseAlertTitleProps as TitleProps } from "./title/BaseAlertTitle";
|
|
9
|
+
export type { BaseAlertHeaderProps as HeaderProps } from "./header/BaseAlertHeader";
|
|
10
|
+
export type { BaseAlertProps as RootProps } from "./root/BaseAlertRoot";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Root = exports.Header = exports.Title = exports.Content = exports.CloseButton = void 0;
|
|
4
|
+
var BaseAlertCloseButton_1 = require("./close-button/BaseAlertCloseButton");
|
|
5
|
+
Object.defineProperty(exports, "CloseButton", { enumerable: true, get: function () { return BaseAlertCloseButton_1.BaseAlertCloseButton; } });
|
|
6
|
+
var BaseAlertContent_1 = require("./content/BaseAlertContent");
|
|
7
|
+
Object.defineProperty(exports, "Content", { enumerable: true, get: function () { return BaseAlertContent_1.BaseAlertContent; } });
|
|
8
|
+
var BaseAlertTitle_1 = require("./title/BaseAlertTitle");
|
|
9
|
+
Object.defineProperty(exports, "Title", { enumerable: true, get: function () { return BaseAlertTitle_1.BaseAlertTitle; } });
|
|
10
|
+
var BaseAlertHeader_1 = require("./header/BaseAlertHeader");
|
|
11
|
+
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return BaseAlertHeader_1.BaseAlertHeader; } });
|
|
12
|
+
var BaseAlertRoot_1 = require("./root/BaseAlertRoot");
|
|
13
|
+
Object.defineProperty(exports, "Root", { enumerable: true, get: function () { return BaseAlertRoot_1.BaseAlert; } });
|
|
14
|
+
//# sourceMappingURL=namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/alert/base-alert/namespace.ts"],"names":[],"mappings":";;;AAAA,4EAA0F;AAAjF,mHAAA,oBAAoB,OAAe;AAC5C,+DAAyE;AAAhE,2GAAA,gBAAgB,OAAW;AACpC,yDAAiE;AAAxD,uGAAA,cAAc,OAAS;AAChC,4DAAqE;AAA5D,yGAAA,eAAe,OAAU;AAClC,sDAAyD;AAAhD,qGAAA,SAAS,OAAQ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AkselColor } from "../../../types";
|
|
2
|
+
type BaseAlertContextProps = {
|
|
3
|
+
size: "medium" | "small";
|
|
4
|
+
status?: "announcement" | "success" | "warning" | "error";
|
|
5
|
+
color: AkselColor | undefined;
|
|
6
|
+
statusId: string;
|
|
7
|
+
};
|
|
8
|
+
declare const BaseAlertProvider: import("react").ForwardRefExoticComponent<BaseAlertContextProps & {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
} & import("react").RefAttributes<unknown>>, useBaseAlert: <S extends boolean = true>(strict?: S) => S extends true ? BaseAlertContextProps : BaseAlertContextProps | undefined;
|
|
11
|
+
export { BaseAlertProvider, useBaseAlert };
|
|
12
|
+
export type { BaseAlertContextProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBaseAlert = exports.BaseAlertProvider = void 0;
|
|
4
|
+
const create_context_1 = require("../../../util/create-context");
|
|
5
|
+
const [BaseAlertProvider, useBaseAlert] = (0, create_context_1.createContext)({
|
|
6
|
+
name: "BaseAlert",
|
|
7
|
+
errorMessage: "useBaseAlert must be used within a BaseAlertProvider",
|
|
8
|
+
});
|
|
9
|
+
exports.BaseAlertProvider = BaseAlertProvider;
|
|
10
|
+
exports.useBaseAlert = useBaseAlert;
|
|
11
|
+
//# sourceMappingURL=BaseAlertRoot.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAlertRoot.context.js","sourceRoot":"","sources":["../../../../src/alert/base-alert/root/BaseAlertRoot.context.tsx"],"names":[],"mappings":";;;AACA,iEAA6D;AAS7D,MAAM,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG,IAAA,8BAAa,EAAwB;IAC7E,IAAI,EAAE,WAAW;IACjB,YAAY,EAAE,sDAAsD;CACrE,CAAC,CAAC;AAEM,8CAAiB;AAAE,oCAAY"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AkselColor } from "../../../types";
|
|
3
|
+
import { type BaseAlertContextProps } from "./BaseAlertRoot.context";
|
|
4
|
+
interface BaseAlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Component content.
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Changes the size.
|
|
11
|
+
* @default "medium"
|
|
12
|
+
*/
|
|
13
|
+
size?: BaseAlertContextProps["size"];
|
|
14
|
+
/**
|
|
15
|
+
* Overrides color
|
|
16
|
+
*/
|
|
17
|
+
"data-color"?: AkselColor;
|
|
18
|
+
/**
|
|
19
|
+
* Intensity of the alert
|
|
20
|
+
*/
|
|
21
|
+
type: "moderate" | "strong";
|
|
22
|
+
/**
|
|
23
|
+
* Centers content and removes border-radius
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
global?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Type of alert
|
|
29
|
+
*/
|
|
30
|
+
status?: BaseAlertContextProps["status"];
|
|
31
|
+
/**
|
|
32
|
+
* Changes the HTML element used for the root element.
|
|
33
|
+
*
|
|
34
|
+
* **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.
|
|
35
|
+
* In those cases, consider using `div` as the root element, or adding unique `aria-label` or `aria-labelledby` props.
|
|
36
|
+
* @see [📝 Landmarks unique](https://dequeuniversity.com/rules/axe/4.6/landmark-unique)
|
|
37
|
+
* @default "section"
|
|
38
|
+
*/
|
|
39
|
+
as?: "section" | "div";
|
|
40
|
+
}
|
|
41
|
+
declare const BaseAlert: React.ForwardRefExoticComponent<BaseAlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
export { BaseAlert };
|
|
43
|
+
export type { BaseAlertProps };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.BaseAlert = void 0;
|
|
48
|
+
const react_1 = __importStar(require("react"));
|
|
49
|
+
const Theme_1 = require("../../../theme/Theme");
|
|
50
|
+
const util_1 = require("../../../util");
|
|
51
|
+
const i18n_hooks_1 = require("../../../util/i18n/i18n.hooks");
|
|
52
|
+
const BaseAlertRoot_context_1 = require("./BaseAlertRoot.context");
|
|
53
|
+
const BaseAlertRoot_utils_1 = require("./BaseAlertRoot.utils");
|
|
54
|
+
const BaseAlert = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
55
|
+
var { children, className, size = "medium", "data-color": dataColor, type, global = false, status, as: Component = "section", "aria-label": ariaLabel, role } = _a, restProps = __rest(_a, ["children", "className", "size", "data-color", "type", "global", "status", "as", "aria-label", "role"]);
|
|
56
|
+
const { cn } = (0, Theme_1.useRenameCSS)();
|
|
57
|
+
const statusId = (0, util_1.useId)();
|
|
58
|
+
const translate = (0, i18n_hooks_1.useI18n)("global");
|
|
59
|
+
const alertColor = status ? (0, BaseAlertRoot_utils_1.baseAlertStatusToDataColor)(status) : dataColor;
|
|
60
|
+
return (react_1.default.createElement(BaseAlertRoot_context_1.BaseAlertProvider, { size: size, status: status, color: alertColor, statusId: statusId },
|
|
61
|
+
react_1.default.createElement(Component, Object.assign({ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : (!status || Component === "div" ? undefined : translate(status)), ref: forwardedRef }, restProps, { className: cn(className, "navds-base-alert"), "data-size": size, "data-color": alertColor, "data-variant": type, "data-global": global }),
|
|
62
|
+
react_1.default.createElement("div", { role: role }, children))));
|
|
63
|
+
});
|
|
64
|
+
exports.BaseAlert = BaseAlert;
|
|
65
|
+
//# sourceMappingURL=BaseAlertRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAlertRoot.js","sourceRoot":"","sources":["../../../../src/alert/base-alert/root/BaseAlertRoot.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAC1C,gDAAoD;AAEpD,wCAAsC;AACtC,8DAAwD;AACxD,mEAGiC;AACjC,+DAAmE;AAwCnE,MAAM,SAAS,GAAG,IAAA,kBAAU,EAC1B,CACE,EAYiB,EACjB,YAAY,EACZ,EAAE;QAdF,EACE,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,QAAQ,EACf,YAAY,EAAE,SAAS,EACvB,IAAI,EACJ,MAAM,GAAG,KAAK,EACd,MAAM,EACN,EAAE,EAAE,SAAS,GAAG,SAAS,EACzB,YAAY,EAAE,SAAS,EACvB,IAAI,OAEW,EADZ,SAAS,cAXd,uGAYC,CADa;IAId,MAAM,EAAE,EAAE,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAE9B,MAAM,QAAQ,GAAG,IAAA,YAAK,GAAE,CAAC;IACzB,MAAM,SAAS,GAAG,IAAA,oBAAO,EAAC,QAAQ,CAAC,CAAC;IAEpC,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,IAAA,gDAA0B,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,CACL,8BAAC,yCAAiB,IAChB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,QAAQ;QAElB,8BAAC,SAAS,gCAEN,SAAS,aAAT,SAAS,cAAT,SAAS,GACT,CAAC,CAAC,MAAM,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAElE,GAAG,EAAE,YAAY,IACb,SAAS,IACb,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC,eACjC,IAAI,gBACH,UAAU,kBACR,IAAI,iBACL,MAAM;YAEnB,uCAAK,IAAI,EAAE,IAAI,IAAG,QAAQ,CAAO,CACvB,CACM,CACrB,CAAC;AACJ,CAAC,CACF,CAAC;AAEO,8BAAS"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { AkselColor } from "../../../types";
|
|
3
|
+
import type { BaseAlertContextProps } from "../root/BaseAlertRoot.context";
|
|
4
|
+
declare function baseAlertStatusToDataColor(status: BaseAlertContextProps["status"]): AkselColor;
|
|
5
|
+
declare function BaseAlertStatusIcon({ status, fill, }: {
|
|
6
|
+
status: BaseAlertContextProps["status"];
|
|
7
|
+
fill?: boolean;
|
|
8
|
+
}): React.JSX.Element | null;
|
|
9
|
+
export { BaseAlertStatusIcon, baseAlertStatusToDataColor };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BaseAlertStatusIcon = BaseAlertStatusIcon;
|
|
7
|
+
exports.baseAlertStatusToDataColor = baseAlertStatusToDataColor;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
10
|
+
function baseAlertStatusToDataColor(status) {
|
|
11
|
+
switch (status) {
|
|
12
|
+
case "announcement":
|
|
13
|
+
return "neutral";
|
|
14
|
+
case "success":
|
|
15
|
+
return "success";
|
|
16
|
+
case "warning":
|
|
17
|
+
return "warning";
|
|
18
|
+
case "error":
|
|
19
|
+
return "danger";
|
|
20
|
+
}
|
|
21
|
+
return "neutral";
|
|
22
|
+
}
|
|
23
|
+
const STATUS_ICONS = {
|
|
24
|
+
announcement: {
|
|
25
|
+
fill: aksel_icons_1.MegaphoneSpeakingFillIcon,
|
|
26
|
+
outline: aksel_icons_1.MegaphoneSpeakingIcon,
|
|
27
|
+
},
|
|
28
|
+
success: {
|
|
29
|
+
fill: aksel_icons_1.CheckmarkCircleFillIcon,
|
|
30
|
+
outline: aksel_icons_1.CheckmarkCircleIcon,
|
|
31
|
+
},
|
|
32
|
+
warning: {
|
|
33
|
+
fill: aksel_icons_1.ExclamationmarkTriangleFillIcon,
|
|
34
|
+
outline: aksel_icons_1.ExclamationmarkTriangleIcon,
|
|
35
|
+
},
|
|
36
|
+
error: {
|
|
37
|
+
fill: aksel_icons_1.XMarkOctagonFillIcon,
|
|
38
|
+
outline: aksel_icons_1.XMarkOctagonIcon,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
function BaseAlertStatusIcon({ status, fill = true, }) {
|
|
42
|
+
if (!status) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const Icon = fill ? STATUS_ICONS[status].fill : STATUS_ICONS[status].outline;
|
|
46
|
+
return react_1.default.createElement(Icon, { "aria-hidden": true });
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=BaseAlertRoot.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAlertRoot.utils.js","sourceRoot":"","sources":["../../../../src/alert/base-alert/root/BaseAlertRoot.utils.tsx"],"names":[],"mappings":";;;;;AAkES,kDAAmB;AAAE,gEAA0B;AAlExD,kDAA0B;AAC1B,qDAS6B;AAI7B,SAAS,0BAA0B,CACjC,MAAuC;IAEvC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,cAAc;YACjB,OAAO,SAAS,CAAC;QACnB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,YAAY,GAAG;IACnB,YAAY,EAAE;QACZ,IAAI,EAAE,uCAAyB;QAC/B,OAAO,EAAE,mCAAqB;KAC/B;IACD,OAAO,EAAE;QACP,IAAI,EAAE,qCAAuB;QAC7B,OAAO,EAAE,iCAAmB;KAC7B;IACD,OAAO,EAAE;QACP,IAAI,EAAE,6CAA+B;QACrC,OAAO,EAAE,yCAA2B;KACrC;IACD,KAAK,EAAE;QACL,IAAI,EAAE,kCAAoB;QAC1B,OAAO,EAAE,8BAAgB;KAC1B;CACO,CAAC;AAEX,SAAS,mBAAmB,CAAC,EAC3B,MAAM,EACN,IAAI,GAAG,IAAI,GAIZ;IACC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;IAE7E,OAAO,8BAAC,IAAI,0BAAe,CAAC;AAC9B,CAAC"}
|