@salt-ds/core 1.46.0 → 1.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/css/salt-core.css +1 -1
- package/dist-cjs/button/Button.js +2 -2
- package/dist-cjs/button/Button.js.map +1 -1
- package/dist-cjs/dialog/DialogHeader.js +13 -6
- package/dist-cjs/dialog/DialogHeader.js.map +1 -1
- package/dist-cjs/overlay/OverlayHeader.js +10 -4
- package/dist-cjs/overlay/OverlayHeader.js.map +1 -1
- package/dist-es/button/Button.js +1 -1
- package/dist-es/button/Button.js.map +1 -1
- package/dist-es/dialog/DialogHeader.js +9 -2
- package/dist-es/dialog/DialogHeader.js.map +1 -1
- package/dist-es/overlay/OverlayHeader.js +7 -1
- package/dist-es/overlay/OverlayHeader.js.map +1 -1
- package/dist-types/dialog/DialogHeader.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/css/salt-core.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var core = require('@salt-ds/core');
|
|
5
4
|
var styles = require('@salt-ds/styles');
|
|
6
5
|
var window = require('@salt-ds/window');
|
|
7
6
|
var clsx = require('clsx');
|
|
8
7
|
var React = require('react');
|
|
8
|
+
var Spinner = require('../spinner/Spinner.js');
|
|
9
9
|
var makePrefixer = require('../utils/makePrefixer.js');
|
|
10
10
|
require('../utils/useFloatingUI/useFloatingUI.js');
|
|
11
11
|
require('../utils/useId.js');
|
|
@@ -95,7 +95,7 @@ const Button = React.forwardRef(
|
|
|
95
95
|
ref,
|
|
96
96
|
type,
|
|
97
97
|
children: [
|
|
98
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: withBaseName("spinner"), "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: withBaseName("spinner"), "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(Spinner.Spinner, { size: "small", "aria-hidden": true, disableAnnouncer: true }) }),
|
|
99
99
|
typeof loadingAnnouncement === "string" && /* @__PURE__ */ jsxRuntime.jsx("span", { role: "status", className: withBaseName("sr-only"), children: loadingAnnouncement }),
|
|
100
100
|
children
|
|
101
101
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../src/button/Button.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../src/button/Button.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type ReactElement,\n forwardRef,\n} from \"react\";\nimport { Spinner } from \"../spinner\";\nimport { makePrefixer } from \"../utils\";\n\nimport buttonCss from \"./Button.css\";\nimport { useButton } from \"./useButton\";\n\nconst withBaseName = makePrefixer(\"saltButton\");\n\nexport const ButtonVariantValues = [\"primary\", \"secondary\", \"cta\"] as const;\nexport const ButtonAppearanceValues = [\n \"solid\",\n \"bordered\",\n \"transparent\",\n] as const;\nexport const ButtonSentimentValues = [\n \"accented\",\n \"neutral\",\n \"positive\",\n \"negative\",\n \"caution\",\n] as const;\nexport type ButtonVariant = (typeof ButtonVariantValues)[number];\nexport type ButtonAppearance = (typeof ButtonAppearanceValues)[number];\nexport type ButtonSentiment = (typeof ButtonSentimentValues)[number];\n\nexport interface ButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n /**\n * If `true`, the button will be disabled.\n */\n disabled?: boolean;\n /**\n * If `true`, the button will be focusable when disabled.\n */\n focusableWhenDisabled?: boolean;\n /**\n * The variant to use. Options are 'primary', 'secondary' and 'cta'.\n * 'primary' is the default value.\n *\n * @deprecated Use `appearance` and `sentiment` instead.\n *\n * | variant | appearance | sentiment |\n * | ----------- | ------------- | ----------- |\n * | `cta` | `solid` | `accented` |\n * | `primary` | `solid` | `neutral` |\n * | `secondary` | `transparent` | `neutral` |\n */\n variant?: ButtonVariant;\n /**\n * The appearance of the button. Options are 'solid', 'bordered', and 'transparent'.\n * 'solid' is the default value.\n *\n * @since 1.36.0.\n */\n appearance?: ButtonAppearance;\n /**\n * The sentiment of the button. Options are 'accented', 'neutral', 'positive', 'negative' and 'caution'.\n * 'neutral' is the default value.\n *\n * @since 1.36.0.\n */\n sentiment?: ButtonSentiment;\n\n /**\n * If `true`, the button will be in a loading state. This allows a spinner to be nested inside the button.\n *\n * @since 1.38.0.\n */\n loading?: boolean;\n\n /**\n * Text to be announced by screen readers, intended to be used in conjunction with the `loading` prop.\n *\n * @since 1.38.0.\n */\n loadingAnnouncement?: string;\n}\n\nfunction variantToAppearanceAndColor(\n variant: ButtonVariant,\n): Pick<ButtonProps, \"appearance\" | \"sentiment\"> {\n switch (variant) {\n case \"primary\":\n return { appearance: \"solid\", sentiment: \"neutral\" };\n case \"secondary\":\n return { appearance: \"transparent\", sentiment: \"neutral\" };\n case \"cta\":\n return { appearance: \"solid\", sentiment: \"accented\" };\n }\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n {\n children,\n className,\n disabled,\n focusableWhenDisabled,\n onKeyUp,\n onKeyDown,\n onBlur,\n onClick,\n loading,\n loadingAnnouncement,\n appearance: appearanceProp,\n sentiment: sentimentProp,\n type = \"button\",\n variant = \"primary\",\n ...restProps\n },\n ref?,\n ): ReactElement<ButtonProps> {\n const { active, buttonProps } = useButton({\n loading,\n disabled,\n focusableWhenDisabled,\n onKeyUp,\n onKeyDown,\n onBlur,\n onClick,\n });\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-button\",\n css: buttonCss,\n window: targetWindow,\n });\n\n const mapped = variantToAppearanceAndColor(variant);\n const appearance: ButtonAppearance =\n appearanceProp ?? mapped?.appearance ?? \"solid\";\n\n const sentiment: ButtonSentiment =\n sentimentProp ?? mapped?.sentiment ?? \"neutral\";\n\n // we do not want to spread tab index in this case because the button element\n // does not require tabindex=\"0\" attribute\n const { tabIndex, ...restButtonProps } = buttonProps;\n return (\n <button\n {...restButtonProps}\n className={clsx(\n withBaseName(),\n withBaseName(variant),\n {\n [withBaseName(\"loading\")]: loading,\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"active\")]: active,\n [withBaseName(appearance)]: appearance,\n [withBaseName(sentiment)]: sentiment,\n },\n className,\n )}\n {...restProps}\n ref={ref}\n type={type}\n >\n {loading && (\n <div className={withBaseName(\"spinner\")} aria-hidden>\n <Spinner size=\"small\" aria-hidden disableAnnouncer />\n </div>\n )}\n {typeof loadingAnnouncement === \"string\" && (\n <span role=\"status\" className={withBaseName(\"sr-only\")}>\n {loadingAnnouncement}\n </span>\n )}\n {children}\n </button>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","Button","useButton","useWindow","useComponentCssInjection","buttonCss","jsxs","clsx","jsx","Spinner"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAM,YAAA,GAAeA,0BAAa,YAAY,CAAA;AAEvC,MAAM,mBAAsB,GAAA,CAAC,SAAW,EAAA,WAAA,EAAa,KAAK;AAC1D,MAAM,sBAAyB,GAAA;AAAA,EACpC,OAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF;AACO,MAAM,qBAAwB,GAAA;AAAA,EACnC,UAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF;AAyDA,SAAS,4BACP,OAC+C,EAAA;AAC/C,EAAA,QAAQ,OAAS;AAAA,IACf,KAAK,SAAA;AACH,MAAA,OAAO,EAAE,UAAA,EAAY,OAAS,EAAA,SAAA,EAAW,SAAU,EAAA;AAAA,IACrD,KAAK,WAAA;AACH,MAAA,OAAO,EAAE,UAAA,EAAY,aAAe,EAAA,SAAA,EAAW,SAAU,EAAA;AAAA,IAC3D,KAAK,KAAA;AACH,MAAA,O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AA,MAAA;AAAA,QACE,GAAG,eAAA;AAAA,QACJ,SAAW,EAAAC,SAAA;AAAA,UACT,YAAa,EAAA;AAAA,UACb,aAAa,OAAO,CAAA;AAAA,UACpB;AAAA,YACE,CAAC,YAAA,CAAa,SAAS,CAAC,GAAG,OAAA;AAAA,YAC3B,CAAC,YAAA,CAAa,UAAU,CAAC,GAAG,QAAA;AAAA,YAC5B,CAAC,YAAA,CAAa,QAAQ,CAAC,GAAG,MAAA;AAAA,YAC1B,CAAC,YAAA,CAAa,UAAU,CAAC,GAAG,UAAA;AAAA,YAC5B,CAAC,YAAA,CAAa,SAAS,CAAC,GAAG;AAAA,WAC7B;AAAA,UACA;AAAA,SACF;AAAA,QACC,GAAG,SAAA;AAAA,QACJ,GAAA;AAAA,QACA,IAAA;AAAA,QAEC,QAAA,EAAA;AAAA,UAAA,OAAA,mCACE,KAAI,EAAA,EAAA,SAAA,EAAW,YAAa,CAAA,SAAS,GAAG,aAAW,EAAA,IAAA,EAClD,QAAC,kBAAAC,cAAA,CAAAC,eAAA,EAAA,EAAQ,MAAK,OAAQ,EAAA,aAAA,EAAW,IAAC,EAAA,gBAAA,EAAgB,MAAC,CACrD,EAAA,CAAA;AAAA,UAED,OAAO,mBAAwB,KAAA,QAAA,oBAC7BD,cAAA,CAAA,MAAA,EAAA,EAAK,IAAK,EAAA,QAAA,EAAS,SAAW,EAAA,YAAA,CAAa,SAAS,CAAA,EAClD,QACH,EAAA,mBAAA,EAAA,CAAA;AAAA,UAED;AAAA;AAAA;AAAA,KACH;AAAA;AAGN;;;;;;;"}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var core = require('@salt-ds/core');
|
|
5
4
|
var styles = require('@salt-ds/styles');
|
|
6
5
|
var window = require('@salt-ds/window');
|
|
7
6
|
var clsx = require('clsx');
|
|
8
7
|
var React = require('react');
|
|
9
|
-
var
|
|
8
|
+
var StatusIndicator = require('../status-indicator/StatusIndicator.js');
|
|
9
|
+
var Text = require('../text/Text.js');
|
|
10
|
+
require('../text/Code.js');
|
|
11
|
+
require('../text/Display.js');
|
|
12
|
+
var Headings = require('../text/Headings.js');
|
|
13
|
+
require('../text/Label.js');
|
|
14
|
+
require('../text/TextAction.js');
|
|
15
|
+
require('../text/TextNotation.js');
|
|
10
16
|
var makePrefixer = require('../utils/makePrefixer.js');
|
|
11
17
|
require('../utils/useFloatingUI/useFloatingUI.js');
|
|
12
18
|
require('../utils/useId.js');
|
|
13
19
|
require('../salt-provider/SaltProvider.js');
|
|
14
20
|
require('../viewport/ViewportProvider.js');
|
|
21
|
+
var DialogContext = require('./DialogContext.js');
|
|
15
22
|
var DialogHeader$1 = require('./DialogHeader.css.js');
|
|
16
23
|
|
|
17
24
|
const withBaseName = makePrefixer.makePrefixer("saltDialogHeader");
|
|
@@ -50,13 +57,13 @@ const DialogHeader = React.forwardRef(
|
|
|
50
57
|
ref,
|
|
51
58
|
...rest,
|
|
52
59
|
children: [
|
|
53
|
-
status && /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
+
status && /* @__PURE__ */ jsxRuntime.jsx(StatusIndicator.StatusIndicator, { status }),
|
|
54
61
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: withBaseName("container"), children: [
|
|
55
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
56
|
-
preheader && /* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Headings.H2, { className: withBaseName("header"), children: [
|
|
63
|
+
preheader && /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { color: "primary", children: preheader }),
|
|
57
64
|
header
|
|
58
65
|
] }),
|
|
59
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { color: "secondary", className: withBaseName("description"), children: description })
|
|
60
67
|
] }),
|
|
61
68
|
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: withBaseName("actionsContainer"), children: actions })
|
|
62
69
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogHeader.js","sources":["../src/dialog/DialogHeader.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"DialogHeader.js","sources":["../src/dialog/DialogHeader.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type ReactNode,\n forwardRef,\n} from \"react\";\nimport { StatusIndicator, type ValidationStatus } from \"../status-indicator\";\nimport { H2, Text } from \"../text\";\nimport { makePrefixer } from \"../utils\";\nimport { useDialogContext } from \"./DialogContext\";\nimport dialogHeaderCss from \"./DialogHeader.css\";\n\nconst withBaseName = makePrefixer(\"saltDialogHeader\");\n\nexport interface DialogHeaderProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The status of the Dialog\n */\n status?: ValidationStatus | undefined;\n /**\n * Displays the accent bar in the Dialog Title */\n disableAccent?: boolean;\n /**\n * Displays the header at the top of the Dialog\n */\n header: ReactNode;\n /**\n * Displays the preheader just above the header\n **/\n preheader?: ReactNode;\n /**\n * Description text is displayed just below the header\n **/\n description?: ReactNode;\n /**\n * Actions to be displayed in header\n */\n actions?: ReactNode;\n}\n\nexport const DialogHeader = forwardRef<HTMLDivElement, DialogHeaderProps>(\n function DialogHeader(props, ref) {\n const {\n className,\n description,\n disableAccent,\n actions,\n header,\n preheader,\n status: statusProp,\n ...rest\n } = props;\n const { status: statusContext, id } = useDialogContext();\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dialog-header\",\n css: dialogHeaderCss,\n window: targetWindow,\n });\n\n const status = statusProp ?? statusContext;\n\n return (\n <div\n id={id}\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"withAccent\")]: !disableAccent && !status,\n [withBaseName(status ?? \"\")]: !!status,\n },\n className,\n )}\n ref={ref}\n {...rest}\n >\n {status && <StatusIndicator status={status} />}\n <div className={withBaseName(\"container\")}>\n <H2 className={withBaseName(\"header\")}>\n {preheader && <Text color=\"primary\">{preheader}</Text>}\n {header}\n </H2>\n {description && (\n <Text color=\"secondary\" className={withBaseName(\"description\")}>\n {description}\n </Text>\n )}\n </div>\n {actions && (\n <div className={withBaseName(\"actionsContainer\")}>{actions}</div>\n )}\n </div>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","DialogHeader","useDialogContext","useWindow","useComponentCssInjection","dialogHeaderCss","jsxs","clsx","jsx","StatusIndicator","H2","Text"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,YAAA,GAAeA,0BAAa,kBAAkB,CAAA;AA4B7C,MAAM,YAAe,GAAAC,gBAAA;AAAA,EAC1B,SAASC,aAAa,CAAA,KAAA,EAAO,GAAK,EAAA;AAChC,IAAM,MAAA;AAAA,MACJ,SAAA;AAAA,MACA,WAAA;AAAA,MACA,aAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,MAAQ,EAAA,UAAA;AAAA,MACR,GAAG;AAAA,KACD,GAAA,KAAA;AACJ,IAAA,MAAM,EAAE,MAAA,EAAQ,aAAe,EAAA,EAAA,KAAOC,8BAAiB,EAAA;AAEvD,IAAA,MAAM,eAAeC,gBAAU,EAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,oBAAA;AAAA,MACR,GAAK,EAAAC,cAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AAED,IAAA,MAAM,SAAS,UAAc,IAAA,aAAA;AAE7B,IACE,uBAAAC,eAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,EAAA;AAAA,QACA,SAAW,EAAAC,SAAA;AAAA,UACT,YAAa,EAAA;AAAA,UACb;AAAA,YACE,CAAC,YAAa,CAAA,YAAY,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAA;AAAA,YACjD,CAAC,YAAa,CAAA,MAAA,IAAU,EAAE,CAAC,GAAG,CAAC,CAAC;AAAA,WAClC;AAAA,UACA;AAAA,SACF;AAAA,QACA,GAAA;AAAA,QACC,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAU,MAAA,oBAAAC,cAAA,CAACC,mCAAgB,MAAgB,EAAA,CAAA;AAAA,0BAC3CH,eAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,YAAA,CAAa,WAAW,CACtC,EAAA,QAAA,EAAA;AAAA,4BAAAA,eAAA,CAACI,WAAG,EAAA,EAAA,SAAA,EAAW,YAAa,CAAA,QAAQ,CACjC,EAAA,QAAA,EAAA;AAAA,cAAA,SAAA,oBAAcF,cAAA,CAAAG,SAAA,EAAA,EAAK,KAAM,EAAA,SAAA,EAAW,QAAU,EAAA,SAAA,EAAA,CAAA;AAAA,cAC9C;AAAA,aACH,EAAA,CAAA;AAAA,YACC,WAAA,mCACEA,SAAK,EAAA,EAAA,KAAA,EAAM,aAAY,SAAW,EAAA,YAAA,CAAa,aAAa,CAAA,EAC1D,QACH,EAAA,WAAA,EAAA;AAAA,WAEJ,EAAA,CAAA;AAAA,UACC,2BACEH,cAAA,CAAA,KAAA,EAAA,EAAI,WAAW,YAAa,CAAA,kBAAkB,GAAI,QAAQ,EAAA,OAAA,EAAA;AAAA;AAAA;AAAA,KAE/D;AAAA;AAGN;;;;"}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var core = require('@salt-ds/core');
|
|
5
4
|
var styles = require('@salt-ds/styles');
|
|
6
5
|
var window = require('@salt-ds/window');
|
|
7
6
|
var clsx = require('clsx');
|
|
8
7
|
var React = require('react');
|
|
8
|
+
var Text = require('../text/Text.js');
|
|
9
|
+
require('../text/Code.js');
|
|
10
|
+
require('../text/Display.js');
|
|
11
|
+
var Headings = require('../text/Headings.js');
|
|
12
|
+
require('../text/Label.js');
|
|
13
|
+
require('../text/TextAction.js');
|
|
14
|
+
require('../text/TextNotation.js');
|
|
9
15
|
var makePrefixer = require('../utils/makePrefixer.js');
|
|
10
16
|
require('../utils/useFloatingUI/useFloatingUI.js');
|
|
11
17
|
require('../utils/useId.js');
|
|
@@ -25,11 +31,11 @@ const OverlayHeader = React.forwardRef(
|
|
|
25
31
|
const { className, description, header, actions, preheader, ...rest } = props;
|
|
26
32
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx(withBaseName(), className), ...rest, ref, children: [
|
|
27
33
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: withBaseName("container"), children: [
|
|
28
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
29
|
-
preheader && /* @__PURE__ */ jsxRuntime.jsx(
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Headings.H2, { styleAs: "h4", className: withBaseName("header"), children: [
|
|
35
|
+
preheader && /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { color: "primary", children: preheader }),
|
|
30
36
|
header
|
|
31
37
|
] }),
|
|
32
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { color: "secondary", className: withBaseName("description"), children: description })
|
|
33
39
|
] }),
|
|
34
40
|
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: withBaseName("actionsContainer"), children: actions })
|
|
35
41
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayHeader.js","sources":["../src/overlay/OverlayHeader.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"OverlayHeader.js","sources":["../src/overlay/OverlayHeader.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type ReactNode,\n forwardRef,\n} from \"react\";\nimport { H2, Text } from \"../text\";\nimport { makePrefixer } from \"../utils\";\n\nimport overlayHeaderCss from \"./OverlayHeader.css\";\n\nconst withBaseName = makePrefixer(\"saltOverlayHeader\");\n\nexport interface OverlayHeaderProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Description text is displayed just below the header\n **/\n description?: ReactNode;\n /**\n * Actions to be displayed in header\n */\n actions?: ReactNode;\n /**\n * Header text\n */\n header?: ReactNode;\n /**\n * Preheader text is displayed just above the header\n **/\n preheader?: ReactNode;\n}\n\nexport const OverlayHeader = forwardRef<HTMLDivElement, OverlayHeaderProps>(\n function OverlayHeader(props, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-overlay-header\",\n css: overlayHeaderCss,\n window: targetWindow,\n });\n\n const { className, description, header, actions, preheader, ...rest } =\n props;\n\n return (\n <div className={clsx(withBaseName(), className)} {...rest} ref={ref}>\n <div className={withBaseName(\"container\")}>\n <H2 styleAs=\"h4\" className={withBaseName(\"header\")}>\n {preheader && <Text color=\"primary\">{preheader}</Text>}\n {header}\n </H2>\n {description && (\n <Text color=\"secondary\" className={withBaseName(\"description\")}>\n {description}\n </Text>\n )}\n </div>\n {actions && (\n <div className={withBaseName(\"actionsContainer\")}>{actions}</div>\n )}\n </div>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","OverlayHeader","useWindow","useComponentCssInjection","overlayHeaderCss","jsxs","clsx","H2","jsx","Text"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,YAAA,GAAeA,0BAAa,mBAAmB,CAAA;AAqB9C,MAAM,aAAgB,GAAAC,gBAAA;AAAA,EAC3B,SAASC,cAAc,CAAA,KAAA,EAAO,GAAK,EAAA;AACjC,IAAA,MAAM,eAAeC,gBAAU,EAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,qBAAA;AAAA,MACR,GAAK,EAAAC,eAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AAED,IAAM,MAAA,EAAE,WAAW,WAAa,EAAA,MAAA,EAAQ,SAAS,SAAW,EAAA,GAAG,MAC7D,GAAA,KAAA;AAEF,IACE,uBAAAC,eAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAWC,SAAK,CAAA,YAAA,IAAgB,SAAS,CAAA,EAAI,GAAG,IAAA,EAAM,GACzD,EAAA,QAAA,EAAA;AAAA,sBAAAD,eAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,YAAa,CAAA,WAAW,CACtC,EAAA,QAAA,EAAA;AAAA,wBAAAA,eAAA,CAACE,eAAG,OAAQ,EAAA,IAAA,EAAK,SAAW,EAAA,YAAA,CAAa,QAAQ,CAC9C,EAAA,QAAA,EAAA;AAAA,UAAA,SAAA,oBAAcC,cAAA,CAAAC,SAAA,EAAA,EAAK,KAAM,EAAA,SAAA,EAAW,QAAU,EAAA,SAAA,EAAA,CAAA;AAAA,UAC9C;AAAA,SACH,EAAA,CAAA;AAAA,QACC,WAAA,mCACEA,SAAK,EAAA,EAAA,KAAA,EAAM,aAAY,SAAW,EAAA,YAAA,CAAa,aAAa,CAAA,EAC1D,QACH,EAAA,WAAA,EAAA;AAAA,OAEJ,EAAA,CAAA;AAAA,MACC,2BACED,cAAA,CAAA,KAAA,EAAA,EAAI,WAAW,YAAa,CAAA,kBAAkB,GAAI,QAAQ,EAAA,OAAA,EAAA;AAAA,KAE/D,EAAA,CAAA;AAAA;AAGN;;;;"}
|
package/dist-es/button/Button.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Spinner } from '@salt-ds/core';
|
|
3
2
|
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
4
3
|
import { useWindow } from '@salt-ds/window';
|
|
5
4
|
import { clsx } from 'clsx';
|
|
6
5
|
import { forwardRef } from 'react';
|
|
6
|
+
import { Spinner } from '../spinner/Spinner.js';
|
|
7
7
|
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
8
8
|
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
9
9
|
import '../utils/useId.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../src/button/Button.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../src/button/Button.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type ReactElement,\n forwardRef,\n} from \"react\";\nimport { Spinner } from \"../spinner\";\nimport { makePrefixer } from \"../utils\";\n\nimport buttonCss from \"./Button.css\";\nimport { useButton } from \"./useButton\";\n\nconst withBaseName = makePrefixer(\"saltButton\");\n\nexport const ButtonVariantValues = [\"primary\", \"secondary\", \"cta\"] as const;\nexport const ButtonAppearanceValues = [\n \"solid\",\n \"bordered\",\n \"transparent\",\n] as const;\nexport const ButtonSentimentValues = [\n \"accented\",\n \"neutral\",\n \"positive\",\n \"negative\",\n \"caution\",\n] as const;\nexport type ButtonVariant = (typeof ButtonVariantValues)[number];\nexport type ButtonAppearance = (typeof ButtonAppearanceValues)[number];\nexport type ButtonSentiment = (typeof ButtonSentimentValues)[number];\n\nexport interface ButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n /**\n * If `true`, the button will be disabled.\n */\n disabled?: boolean;\n /**\n * If `true`, the button will be focusable when disabled.\n */\n focusableWhenDisabled?: boolean;\n /**\n * The variant to use. Options are 'primary', 'secondary' and 'cta'.\n * 'primary' is the default value.\n *\n * @deprecated Use `appearance` and `sentiment` instead.\n *\n * | variant | appearance | sentiment |\n * | ----------- | ------------- | ----------- |\n * | `cta` | `solid` | `accented` |\n * | `primary` | `solid` | `neutral` |\n * | `secondary` | `transparent` | `neutral` |\n */\n variant?: ButtonVariant;\n /**\n * The appearance of the button. Options are 'solid', 'bordered', and 'transparent'.\n * 'solid' is the default value.\n *\n * @since 1.36.0.\n */\n appearance?: ButtonAppearance;\n /**\n * The sentiment of the button. Options are 'accented', 'neutral', 'positive', 'negative' and 'caution'.\n * 'neutral' is the default value.\n *\n * @since 1.36.0.\n */\n sentiment?: ButtonSentiment;\n\n /**\n * If `true`, the button will be in a loading state. This allows a spinner to be nested inside the button.\n *\n * @since 1.38.0.\n */\n loading?: boolean;\n\n /**\n * Text to be announced by screen readers, intended to be used in conjunction with the `loading` prop.\n *\n * @since 1.38.0.\n */\n loadingAnnouncement?: string;\n}\n\nfunction variantToAppearanceAndColor(\n variant: ButtonVariant,\n): Pick<ButtonProps, \"appearance\" | \"sentiment\"> {\n switch (variant) {\n case \"primary\":\n return { appearance: \"solid\", sentiment: \"neutral\" };\n case \"secondary\":\n return { appearance: \"transparent\", sentiment: \"neutral\" };\n case \"cta\":\n return { appearance: \"solid\", sentiment: \"accented\" };\n }\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n {\n children,\n className,\n disabled,\n focusableWhenDisabled,\n onKeyUp,\n onKeyDown,\n onBlur,\n onClick,\n loading,\n loadingAnnouncement,\n appearance: appearanceProp,\n sentiment: sentimentProp,\n type = \"button\",\n variant = \"primary\",\n ...restProps\n },\n ref?,\n ): ReactElement<ButtonProps> {\n const { active, buttonProps } = useButton({\n loading,\n disabled,\n focusableWhenDisabled,\n onKeyUp,\n onKeyDown,\n onBlur,\n onClick,\n });\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-button\",\n css: buttonCss,\n window: targetWindow,\n });\n\n const mapped = variantToAppearanceAndColor(variant);\n const appearance: ButtonAppearance =\n appearanceProp ?? mapped?.appearance ?? \"solid\";\n\n const sentiment: ButtonSentiment =\n sentimentProp ?? mapped?.sentiment ?? \"neutral\";\n\n // we do not want to spread tab index in this case because the button element\n // does not require tabindex=\"0\" attribute\n const { tabIndex, ...restButtonProps } = buttonProps;\n return (\n <button\n {...restButtonProps}\n className={clsx(\n withBaseName(),\n withBaseName(variant),\n {\n [withBaseName(\"loading\")]: loading,\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"active\")]: active,\n [withBaseName(appearance)]: appearance,\n [withBaseName(sentiment)]: sentiment,\n },\n className,\n )}\n {...restProps}\n ref={ref}\n type={type}\n >\n {loading && (\n <div className={withBaseName(\"spinner\")} aria-hidden>\n <Spinner size=\"small\" aria-hidden disableAnnouncer />\n </div>\n )}\n {typeof loadingAnnouncement === \"string\" && (\n <span role=\"status\" className={withBaseName(\"sr-only\")}>\n {loadingAnnouncement}\n </span>\n )}\n {children}\n </button>\n );\n },\n);\n"],"names":["Button","buttonCss"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,YAAA,GAAe,aAAa,YAAY,CAAA;AAEvC,MAAM,mBAAsB,GAAA,CAAC,SAAW,EAAA,WAAA,EAAa,KAAK;AAC1D,MAAM,sBAAyB,GAAA;AAAA,EACpC,OAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF;AACO,MAAM,qBAAwB,GAAA;AAAA,EACnC,UAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF;AAyDA,SAAS,4BACP,OAC+C,EAAA;AAC/C,EAAA,QAAQ,OAAS;AAAA,IACf,KAAK,SAAA;AACH,MAAA,OAAO,EAAE,UAAA,EAAY,OAAS,EAAA,SAAA,EAAW,SAAU,EAAA;AAAA,IACrD,KAAK,WAAA;AACH,MAAA,OAAO,EAAE,UAAA,EAAY,aAAe,EAAA,SAAA,EAAW,SAAU,EAAA;AAAA,IAC3D,KAAK,KAAA;AACH,MAAA,OAAO,EAAE,UAAA,EAAY,OAAS,EAAA,SAAA,EAAW,UAAW,EAAA;AAAA;AAE1D;AAEO,MAAM,MAAS,GAAA,UAAA;AAAA,EACpB,SAASA,OACP,CAAA;AAAA,IACE,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,qB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CAAa,UAAU,CAAC,GAAG,QAAA;AAAA,YAC5B,CAAC,YAAA,CAAa,QAAQ,CAAC,GAAG,MAAA;AAAA,YAC1B,CAAC,YAAA,CAAa,UAAU,CAAC,GAAG,UAAA;AAAA,YAC5B,CAAC,YAAA,CAAa,SAAS,CAAC,GAAG;AAAA,WAC7B;AAAA,UACA;AAAA,SACF;AAAA,QACC,GAAG,SAAA;AAAA,QACJ,GAAA;AAAA,QACA,IAAA;AAAA,QAEC,QAAA,EAAA;AAAA,UAAA,OAAA,wBACE,KAAI,EAAA,EAAA,SAAA,EAAW,YAAa,CAAA,SAAS,GAAG,aAAW,EAAA,IAAA,EAClD,QAAC,kBAAA,GAAA,CAAA,OAAA,EAAA,EAAQ,MAAK,OAAQ,EAAA,aAAA,EAAW,IAAC,EAAA,gBAAA,EAAgB,MAAC,CACrD,EAAA,CAAA;AAAA,UAED,OAAO,mBAAwB,KAAA,QAAA,oBAC7B,GAAA,CAAA,MAAA,EAAA,EAAK,IAAK,EAAA,QAAA,EAAS,SAAW,EAAA,YAAA,CAAa,SAAS,CAAA,EAClD,QACH,EAAA,mBAAA,EAAA,CAAA;AAAA,UAED;AAAA;AAAA;AAAA,KACH;AAAA;AAGN;;;;"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { StatusIndicator, H2, Text } from '@salt-ds/core';
|
|
3
2
|
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
4
3
|
import { useWindow } from '@salt-ds/window';
|
|
5
4
|
import { clsx } from 'clsx';
|
|
6
5
|
import { forwardRef } from 'react';
|
|
7
|
-
import {
|
|
6
|
+
import { StatusIndicator } from '../status-indicator/StatusIndicator.js';
|
|
7
|
+
import { Text } from '../text/Text.js';
|
|
8
|
+
import '../text/Code.js';
|
|
9
|
+
import '../text/Display.js';
|
|
10
|
+
import { H2 } from '../text/Headings.js';
|
|
11
|
+
import '../text/Label.js';
|
|
12
|
+
import '../text/TextAction.js';
|
|
13
|
+
import '../text/TextNotation.js';
|
|
8
14
|
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
9
15
|
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
10
16
|
import '../utils/useId.js';
|
|
11
17
|
import '../salt-provider/SaltProvider.js';
|
|
12
18
|
import '../viewport/ViewportProvider.js';
|
|
19
|
+
import { useDialogContext } from './DialogContext.js';
|
|
13
20
|
import css_248z from './DialogHeader.css.js';
|
|
14
21
|
|
|
15
22
|
const withBaseName = makePrefixer("saltDialogHeader");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogHeader.js","sources":["../src/dialog/DialogHeader.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"DialogHeader.js","sources":["../src/dialog/DialogHeader.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type ReactNode,\n forwardRef,\n} from \"react\";\nimport { StatusIndicator, type ValidationStatus } from \"../status-indicator\";\nimport { H2, Text } from \"../text\";\nimport { makePrefixer } from \"../utils\";\nimport { useDialogContext } from \"./DialogContext\";\nimport dialogHeaderCss from \"./DialogHeader.css\";\n\nconst withBaseName = makePrefixer(\"saltDialogHeader\");\n\nexport interface DialogHeaderProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The status of the Dialog\n */\n status?: ValidationStatus | undefined;\n /**\n * Displays the accent bar in the Dialog Title */\n disableAccent?: boolean;\n /**\n * Displays the header at the top of the Dialog\n */\n header: ReactNode;\n /**\n * Displays the preheader just above the header\n **/\n preheader?: ReactNode;\n /**\n * Description text is displayed just below the header\n **/\n description?: ReactNode;\n /**\n * Actions to be displayed in header\n */\n actions?: ReactNode;\n}\n\nexport const DialogHeader = forwardRef<HTMLDivElement, DialogHeaderProps>(\n function DialogHeader(props, ref) {\n const {\n className,\n description,\n disableAccent,\n actions,\n header,\n preheader,\n status: statusProp,\n ...rest\n } = props;\n const { status: statusContext, id } = useDialogContext();\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dialog-header\",\n css: dialogHeaderCss,\n window: targetWindow,\n });\n\n const status = statusProp ?? statusContext;\n\n return (\n <div\n id={id}\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"withAccent\")]: !disableAccent && !status,\n [withBaseName(status ?? \"\")]: !!status,\n },\n className,\n )}\n ref={ref}\n {...rest}\n >\n {status && <StatusIndicator status={status} />}\n <div className={withBaseName(\"container\")}>\n <H2 className={withBaseName(\"header\")}>\n {preheader && <Text color=\"primary\">{preheader}</Text>}\n {header}\n </H2>\n {description && (\n <Text color=\"secondary\" className={withBaseName(\"description\")}>\n {description}\n </Text>\n )}\n </div>\n {actions && (\n <div className={withBaseName(\"actionsContainer\")}>{actions}</div>\n )}\n </div>\n );\n },\n);\n"],"names":["DialogHeader","dialogHeaderCss"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,YAAA,GAAe,aAAa,kBAAkB,CAAA;AA4B7C,MAAM,YAAe,GAAA,UAAA;AAAA,EAC1B,SAASA,aAAa,CAAA,KAAA,EAAO,GAAK,EAAA;AAChC,IAAM,MAAA;AAAA,MACJ,SAAA;AAAA,MACA,WAAA;AAAA,MACA,aAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,MAAQ,EAAA,UAAA;AAAA,MACR,GAAG;AAAA,KACD,GAAA,KAAA;AACJ,IAAA,MAAM,EAAE,MAAA,EAAQ,aAAe,EAAA,EAAA,KAAO,gBAAiB,EAAA;AAEvD,IAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,oBAAA;AAAA,MACR,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AAED,IAAA,MAAM,SAAS,UAAc,IAAA,aAA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';
|
|
4
3
|
import { useWindow } from '@salt-ds/window';
|
|
5
4
|
import { clsx } from 'clsx';
|
|
6
5
|
import { forwardRef } from 'react';
|
|
6
|
+
import { Text } from '../text/Text.js';
|
|
7
|
+
import '../text/Code.js';
|
|
8
|
+
import '../text/Display.js';
|
|
9
|
+
import { H2 } from '../text/Headings.js';
|
|
10
|
+
import '../text/Label.js';
|
|
11
|
+
import '../text/TextAction.js';
|
|
12
|
+
import '../text/TextNotation.js';
|
|
7
13
|
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
8
14
|
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
9
15
|
import '../utils/useId.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayHeader.js","sources":["../src/overlay/OverlayHeader.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"OverlayHeader.js","sources":["../src/overlay/OverlayHeader.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type ReactNode,\n forwardRef,\n} from \"react\";\nimport { H2, Text } from \"../text\";\nimport { makePrefixer } from \"../utils\";\n\nimport overlayHeaderCss from \"./OverlayHeader.css\";\n\nconst withBaseName = makePrefixer(\"saltOverlayHeader\");\n\nexport interface OverlayHeaderProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Description text is displayed just below the header\n **/\n description?: ReactNode;\n /**\n * Actions to be displayed in header\n */\n actions?: ReactNode;\n /**\n * Header text\n */\n header?: ReactNode;\n /**\n * Preheader text is displayed just above the header\n **/\n preheader?: ReactNode;\n}\n\nexport const OverlayHeader = forwardRef<HTMLDivElement, OverlayHeaderProps>(\n function OverlayHeader(props, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-overlay-header\",\n css: overlayHeaderCss,\n window: targetWindow,\n });\n\n const { className, description, header, actions, preheader, ...rest } =\n props;\n\n return (\n <div className={clsx(withBaseName(), className)} {...rest} ref={ref}>\n <div className={withBaseName(\"container\")}>\n <H2 styleAs=\"h4\" className={withBaseName(\"header\")}>\n {preheader && <Text color=\"primary\">{preheader}</Text>}\n {header}\n </H2>\n {description && (\n <Text color=\"secondary\" className={withBaseName(\"description\")}>\n {description}\n </Text>\n )}\n </div>\n {actions && (\n <div className={withBaseName(\"actionsContainer\")}>{actions}</div>\n )}\n </div>\n );\n },\n);\n"],"names":["OverlayHeader","overlayHeaderCss"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,MAAM,YAAA,GAAe,aAAa,mBAAmB,CAAA;AAqB9C,MAAM,aAAgB,GAAA,UAAA;AAAA,EAC3B,SAASA,cAAc,CAAA,KAAA,EAAO,GAAK,EAAA;AACjC,IAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,qBAAA;AAAA,MACR,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AAED,IAAM,MAAA,EAAE,WAAW,WAAa,EAAA,MAAA,EAAQ,SAAS,SAAW,EAAA,GAAG,MAC7D,GAAA,KAAA;AAEF,IACE,uBAAA,IAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,IAAK,CAAA,YAAA,IAAgB,SAAS,CAAA,EAAI,GAAG,IAAA,EAAM,GACzD,EAAA,QAAA,EAAA;AAAA,sBAAA,IAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,YAAa,CAAA,WAAW,CACtC,EAAA,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,MAAG,OAAQ,EAAA,IAAA,EAAK,SAAW,EAAA,YAAA,CAAa,QAAQ,CAC9C,EAAA,QAAA,EAAA;AAAA,UAAA,SAAA,oBAAc,GAAA,CAAA,IAAA,EAAA,EAAK,KAAM,EAAA,SAAA,EAAW,QAAU,EAAA,SAAA,EAAA,CAAA;AAAA,UAC9C;AAAA,SACH,EAAA,CAAA;AAAA,QACC,WAAA,wBACE,IAAK,EAAA,EAAA,KAAA,EAAM,aAAY,SAAW,EAAA,YAAA,CAAa,aAAa,CAAA,EAC1D,QACH,EAAA,WAAA,EAAA;AAAA,OAEJ,EAAA,CAAA;AAAA,MACC,2BACE,GAAA,CAAA,KAAA,EAAA,EAAI,WAAW,YAAa,CAAA,kBAAkB,GAAI,QAAQ,EAAA,OAAA,EAAA;AAAA,KAE/D,EAAA,CAAA;AAAA;AAGN;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ValidationStatus } from "@salt-ds/core";
|
|
2
1
|
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
import { type ValidationStatus } from "../status-indicator";
|
|
3
3
|
export interface DialogHeaderProps extends ComponentPropsWithoutRef<"div"> {
|
|
4
4
|
/**
|
|
5
5
|
* The status of the Dialog
|