@salt-ds/core 1.46.0 → 1.47.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/CHANGELOG.md +23 -0
- package/css/salt-core.css +17 -13
- package/dist-cjs/button/Button.js +2 -2
- package/dist-cjs/button/Button.js.map +1 -1
- package/dist-cjs/checkbox/CheckboxIcon.css.js +1 -1
- package/dist-cjs/dialog/DialogHeader.js +13 -6
- package/dist-cjs/dialog/DialogHeader.js.map +1 -1
- package/dist-cjs/form-field/FormField.js +6 -2
- package/dist-cjs/form-field/FormField.js.map +1 -1
- package/dist-cjs/form-field/FormFieldHelperText.css.js +1 -1
- package/dist-cjs/form-field/FormFieldHelperText.js +7 -1
- package/dist-cjs/form-field/FormFieldHelperText.js.map +1 -1
- package/dist-cjs/form-field/FormFieldLabel.js +15 -3
- package/dist-cjs/form-field/FormFieldLabel.js.map +1 -1
- package/dist-cjs/form-field-context/FormFieldContext.js.map +1 -1
- package/dist-cjs/overlay/OverlayHeader.js +10 -4
- package/dist-cjs/overlay/OverlayHeader.js.map +1 -1
- package/dist-cjs/pagination/PageButton.css.js +1 -1
- package/dist-es/button/Button.js +1 -1
- package/dist-es/button/Button.js.map +1 -1
- package/dist-es/checkbox/CheckboxIcon.css.js +1 -1
- package/dist-es/dialog/DialogHeader.js +9 -2
- package/dist-es/dialog/DialogHeader.js.map +1 -1
- package/dist-es/form-field/FormField.js +7 -3
- package/dist-es/form-field/FormField.js.map +1 -1
- package/dist-es/form-field/FormFieldHelperText.css.js +1 -1
- package/dist-es/form-field/FormFieldHelperText.js +7 -1
- package/dist-es/form-field/FormFieldHelperText.js.map +1 -1
- package/dist-es/form-field/FormFieldLabel.js +15 -3
- package/dist-es/form-field/FormFieldLabel.js.map +1 -1
- package/dist-es/form-field-context/FormFieldContext.js.map +1 -1
- package/dist-es/overlay/OverlayHeader.js +7 -1
- package/dist-es/overlay/OverlayHeader.js.map +1 -1
- package/dist-es/pagination/PageButton.css.js +1 -1
- package/dist-types/dialog/DialogHeader.d.ts +1 -1
- package/dist-types/form-field/FormFieldLabel.d.ts +1 -1
- package/dist-types/form-field-context/FormFieldContext.d.ts +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @salt-ds/core
|
|
2
2
|
|
|
3
|
+
## 1.47.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b99afaa: - Updated Pagination styles to include a border on the selected state.
|
|
8
|
+
- Updated Pagination to use default text styles instead of action text.
|
|
9
|
+
- Fixed hover styles overriding selected styles on Pagination.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- edcd33d: Fixed clicking on `FormField` labels' not focusing/interacting with the associated form control.
|
|
14
|
+
- a3a0608: Fixed the alignment of the status indicator inside FormField's helper text.
|
|
15
|
+
- 0c140c0: Fixed `Checkbox`'s checked color styles applying when `Checkbox` is indeterminate.
|
|
16
|
+
- Updated dependencies [dd3e21d]
|
|
17
|
+
- @salt-ds/icons@1.14.0
|
|
18
|
+
|
|
19
|
+
## 1.46.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- f107d63: Fixed some internal import pointing to package name, preventing component loading in certain setup like module federation. Fixes
|
|
24
|
+
#5118.
|
|
25
|
+
|
|
3
26
|
## 1.46.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/css/salt-core.css
CHANGED
|
@@ -930,15 +930,19 @@ a:focus .saltCard-interactable.saltCard-disabled {
|
|
|
930
930
|
clip-path: border-box;
|
|
931
931
|
box-sizing: border-box;
|
|
932
932
|
}
|
|
933
|
+
.saltCheckboxIcon-checked,
|
|
934
|
+
.saltCheckbox:hover .saltCheckboxIcon-checked {
|
|
935
|
+
border-color: var(--salt-selectable-borderColor-selected);
|
|
936
|
+
color: var(--salt-selectable-foreground-selected);
|
|
937
|
+
}
|
|
933
938
|
.saltCheckbox:hover .saltCheckboxIcon,
|
|
934
939
|
.saltCheckbox:hover .saltCheckboxIcon-indeterminate {
|
|
935
940
|
border-color: var(--salt-selectable-borderColor-hover);
|
|
936
941
|
color: var(--salt-selectable-foreground-hover);
|
|
937
942
|
}
|
|
938
|
-
.saltCheckboxIcon-checked
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
color: var(--salt-selectable-foreground-selected);
|
|
943
|
+
.saltCheckboxIcon-checked.saltCheckboxIcon-indeterminate {
|
|
944
|
+
border-color: var(--salt-selectable-borderColor);
|
|
945
|
+
color: var(--salt-selectable-foreground);
|
|
942
946
|
}
|
|
943
947
|
.saltCheckboxIcon-disabled,
|
|
944
948
|
.saltCheckbox:hover .saltCheckboxIcon-disabled,
|
|
@@ -1638,6 +1642,9 @@ a:focus .saltCard-interactable.saltCard-disabled {
|
|
|
1638
1642
|
.saltFormFieldHelperText-withValidation {
|
|
1639
1643
|
column-gap: var(--salt-spacing-75);
|
|
1640
1644
|
}
|
|
1645
|
+
.saltFormFieldHelperText .saltFormFieldHelperText-statusIndicator {
|
|
1646
|
+
margin-top: calc((var(--salt-text-label-lineHeight) - max(var(--salt-size-icon), 12px)) / 2);
|
|
1647
|
+
}
|
|
1641
1648
|
|
|
1642
1649
|
/* src/form-field/FormFieldLabel.css */
|
|
1643
1650
|
.saltFormFieldLabel.saltText {
|
|
@@ -2866,9 +2873,9 @@ a:focus .saltCard-interactable.saltCard-disabled {
|
|
|
2866
2873
|
padding: 0 var(--salt-spacing-100);
|
|
2867
2874
|
border: none;
|
|
2868
2875
|
font-size: var(--salt-text-fontSize);
|
|
2869
|
-
font-family: var(--salt-text-
|
|
2876
|
+
font-family: var(--salt-text-fontFamily);
|
|
2870
2877
|
line-height: var(--salt-text-lineHeight);
|
|
2871
|
-
letter-spacing: var(--salt-text-
|
|
2878
|
+
letter-spacing: var(--salt-text-letterSpacing);
|
|
2872
2879
|
cursor: var(--salt-selectable-cursor-hover);
|
|
2873
2880
|
border-radius: var(--salt-palette-corner-weak, 0);
|
|
2874
2881
|
}
|
|
@@ -2876,8 +2883,7 @@ a:focus .saltCard-interactable.saltCard-disabled {
|
|
|
2876
2883
|
.saltPageButton:focus-visible {
|
|
2877
2884
|
background: var(--salt-selectable-background-hover);
|
|
2878
2885
|
}
|
|
2879
|
-
.saltPageButton:active
|
|
2880
|
-
.saltPageButton-active {
|
|
2886
|
+
.saltPageButton:active {
|
|
2881
2887
|
background: var(--salt-selectable-background-selected);
|
|
2882
2888
|
}
|
|
2883
2889
|
.saltPageButton:focus-visible {
|
|
@@ -2888,10 +2894,8 @@ a:focus .saltCard-interactable.saltCard-disabled {
|
|
|
2888
2894
|
background: var(--salt-selectable-background);
|
|
2889
2895
|
cursor: var(--salt-editable-cursor-readonly);
|
|
2890
2896
|
}
|
|
2891
|
-
.saltPageButton-
|
|
2892
|
-
|
|
2893
|
-
}
|
|
2894
|
-
.saltPageButton-selected:focus-visible {
|
|
2897
|
+
.saltPageButton[aria-current=page] {
|
|
2898
|
+
border: var(--salt-size-border) var(--salt-selectable-borderStyle) var(--salt-selectable-borderColor);
|
|
2895
2899
|
background: var(--salt-selectable-background-selected);
|
|
2896
2900
|
}
|
|
2897
2901
|
.saltPageButton-fixed {
|
|
@@ -5250,4 +5254,4 @@ label.saltText small,
|
|
|
5250
5254
|
color: var(--salt-status-error-foreground-informative);
|
|
5251
5255
|
}
|
|
5252
5256
|
|
|
5253
|
-
/* src/
|
|
5257
|
+
/* src/54777b0d-1abe-491d-990e-59e0c5f969c0.css */
|
|
@@ -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;AA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BAAA,EAAA,CAAA;AAAA,UAED;AAAA;AAAA;AAAA,KACH;AAAA;AAGN;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".saltCheckboxIcon {\n --checkbox-size: var(--salt-size-selectable);\n width: var(--checkbox-size);\n min-width: var(--checkbox-size);\n height: var(--checkbox-size);\n min-height: var(--checkbox-size);\n border: var(--salt-size-border) var(--salt-selectable-borderStyle) var(--salt-selectable-borderColor);\n border-radius: var(--salt-palette-corner-weaker, 0);\n color: var(--salt-selectable-foreground);\n background: var(--salt-container-primary-background);\n position: relative;\n --saltIcon-size: 100%;\n display: flex;\n /* Using overflow:hidden here causes a thin white line */\n clip-path: border-box;\n box-sizing: border-box;\n}\n\n.saltCheckbox:hover .saltCheckboxIcon,\n.saltCheckbox:hover .saltCheckboxIcon-indeterminate {\n border-color: var(--salt-selectable-borderColor-hover);\n color: var(--salt-selectable-foreground-hover);\n}\n\n.saltCheckboxIcon-checked
|
|
3
|
+
var css_248z = ".saltCheckboxIcon {\n --checkbox-size: var(--salt-size-selectable);\n width: var(--checkbox-size);\n min-width: var(--checkbox-size);\n height: var(--checkbox-size);\n min-height: var(--checkbox-size);\n border: var(--salt-size-border) var(--salt-selectable-borderStyle) var(--salt-selectable-borderColor);\n border-radius: var(--salt-palette-corner-weaker, 0);\n color: var(--salt-selectable-foreground);\n background: var(--salt-container-primary-background);\n position: relative;\n --saltIcon-size: 100%;\n display: flex;\n /* Using overflow:hidden here causes a thin white line */\n clip-path: border-box;\n box-sizing: border-box;\n}\n\n.saltCheckboxIcon-checked,\n.saltCheckbox:hover .saltCheckboxIcon-checked {\n border-color: var(--salt-selectable-borderColor-selected);\n color: var(--salt-selectable-foreground-selected);\n}\n\n.saltCheckbox:hover .saltCheckboxIcon,\n.saltCheckbox:hover .saltCheckboxIcon-indeterminate {\n border-color: var(--salt-selectable-borderColor-hover);\n color: var(--salt-selectable-foreground-hover);\n}\n\n.saltCheckboxIcon-checked.saltCheckboxIcon-indeterminate {\n border-color: var(--salt-selectable-borderColor);\n color: var(--salt-selectable-foreground);\n}\n\n.saltCheckboxIcon-disabled,\n.saltCheckbox:hover .saltCheckboxIcon-disabled,\n.saltCheckboxIcon-disabled.saltCheckboxIcon-indeterminate,\n.saltCheckbox:hover .saltCheckboxIcon-disabled.saltCheckboxIcon-indeterminate {\n border-color: var(--salt-selectable-borderColor-disabled);\n background: var(--salt-container-primary-background-disabled);\n color: var(--salt-selectable-foreground-disabled);\n}\n\n.saltCheckboxIcon-checked.saltCheckboxIcon-disabled,\n.saltCheckbox:hover .saltCheckboxIcon-checked.saltCheckboxIcon-disabled {\n border-color: var(--salt-selectable-borderColor-selectedDisabled);\n color: var(--salt-selectable-foreground-selectedDisabled);\n}\n\n.saltCheckboxIcon-indeterminate::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: calc(var(--checkbox-size) - 6px);\n height: 2px;\n background: currentColor;\n transform: translate(-50%, -50%);\n}\n\n.saltCheckboxIcon-error,\n.saltCheckbox:hover .saltCheckboxIcon-error {\n color: var(--salt-status-error-foreground-decorative);\n border-color: var(--salt-status-error-borderColor);\n outline-color: var(--salt-status-error-foreground-decorative);\n}\n\n.saltCheckboxIcon-warning,\n.saltCheckbox:hover .saltCheckboxIcon-warning {\n color: var(--salt-status-warning-foreground-decorative);\n border-color: var(--salt-status-warning-borderColor);\n outline-color: var(--salt-status-warning-foreground-decorative);\n}\n\n.saltCheckboxIcon-readOnly,\n.saltCheckbox:hover .saltCheckboxIcon-readOnly {\n border-color: var(--salt-selectable-borderColor-readonly);\n color: var(--salt-content-primary-foreground);\n}\n\n.saltCheckboxIcon > svg {\n position: absolute;\n /* Ensure a gap doesn't appear when device scaling is used */\n transform: scale(1.01);\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=CheckboxIcon.css.js.map
|
|
@@ -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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../utils/capitalize.js');
|
|
10
10
|
var makePrefixer = require('../utils/makePrefixer.js');
|
|
11
11
|
require('../utils/useFloatingUI/useFloatingUI.js');
|
|
12
|
+
var useForkRef = require('../utils/useForkRef.js');
|
|
12
13
|
var useId = require('../utils/useId.js');
|
|
13
14
|
require('../salt-provider/SaltProvider.js');
|
|
14
15
|
require('../viewport/ViewportProvider.js');
|
|
@@ -33,13 +34,15 @@ const FormField = React.forwardRef(
|
|
|
33
34
|
css: FormField$1,
|
|
34
35
|
window: targetWindow
|
|
35
36
|
});
|
|
37
|
+
const formFieldRef = React.useRef(null);
|
|
38
|
+
const handleRef = useForkRef.useForkRef(ref, formFieldRef);
|
|
36
39
|
const formId = useId.useId(idProp);
|
|
37
40
|
const labelId = formId ? `label-${formId}` : void 0;
|
|
38
41
|
const helperTextId = formId ? `helperText-${formId}` : void 0;
|
|
39
42
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
40
43
|
"div",
|
|
41
44
|
{
|
|
42
|
-
ref,
|
|
45
|
+
ref: handleRef,
|
|
43
46
|
className: clsx.clsx(
|
|
44
47
|
withBaseName(),
|
|
45
48
|
{
|
|
@@ -60,7 +63,8 @@ const FormField = React.forwardRef(
|
|
|
60
63
|
disabled,
|
|
61
64
|
necessity,
|
|
62
65
|
readOnly,
|
|
63
|
-
validationStatus
|
|
66
|
+
validationStatus,
|
|
67
|
+
formFieldRef
|
|
64
68
|
},
|
|
65
69
|
children
|
|
66
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","sources":["../src/form-field/FormField.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { type HTMLAttributes, forwardRef } from \"react\";\nimport { type A11yValueProps, FormFieldContext } from \"../form-field-context\";\nimport { capitalize, makePrefixer, useId } from \"../utils\";\n\nimport formFieldCss from \"./FormField.css\";\n\nexport type FormFieldLabelPlacement = \"top\" | \"left\" | \"right\";\n\nexport interface FormFieldProps\n extends HTMLAttributes<HTMLDivElement>,\n A11yValueProps {\n /**\n * If `true`, the field will be disabled.\n */\n disabled?: boolean;\n /**\n * Location of the label relative to the control.\n *\n * Either 'top', 'left', or 'right'`.\n */\n labelPlacement?: FormFieldLabelPlacement;\n /**\n * If `true`, the field will be read-only.\n */\n readOnly?: boolean;\n /**\n * Optional id prop\n *\n * Used as suffix of FormFieldLabel id: `label-{id}`\n * Used as suffix of FormFieldHelperText id: `helperText-{id}`\n */\n id?: string;\n /**\n * Displays necessity on label\n */\n necessity?: \"required\" | \"optional\" | \"asterisk\";\n /**\n * Validation status\n */\n validationStatus?: \"error\" | \"warning\" | \"success\";\n}\n\nconst withBaseName = makePrefixer(\"saltFormField\");\n\nexport const FormField = forwardRef<HTMLDivElement, FormFieldProps>(\n (\n {\n children,\n className,\n disabled = false,\n id: idProp,\n labelPlacement = \"top\",\n necessity,\n readOnly = false,\n validationStatus,\n ...restProps\n },\n ref,\n ) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field\",\n css: formFieldCss,\n window: targetWindow,\n });\n\n const formId = useId(idProp);\n\n const labelId = formId ? `label-${formId}` : undefined;\n const helperTextId = formId ? `helperText-${formId}` : undefined;\n\n return (\n <div\n ref={
|
|
1
|
+
{"version":3,"file":"FormField.js","sources":["../src/form-field/FormField.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { type HTMLAttributes, forwardRef, useRef } from \"react\";\nimport { type A11yValueProps, FormFieldContext } from \"../form-field-context\";\nimport { capitalize, makePrefixer, useForkRef, useId } from \"../utils\";\n\nimport formFieldCss from \"./FormField.css\";\n\nexport type FormFieldLabelPlacement = \"top\" | \"left\" | \"right\";\n\nexport interface FormFieldProps\n extends HTMLAttributes<HTMLDivElement>,\n A11yValueProps {\n /**\n * If `true`, the field will be disabled.\n */\n disabled?: boolean;\n /**\n * Location of the label relative to the control.\n *\n * Either 'top', 'left', or 'right'`.\n */\n labelPlacement?: FormFieldLabelPlacement;\n /**\n * If `true`, the field will be read-only.\n */\n readOnly?: boolean;\n /**\n * Optional id prop\n *\n * Used as suffix of FormFieldLabel id: `label-{id}`\n * Used as suffix of FormFieldHelperText id: `helperText-{id}`\n */\n id?: string;\n /**\n * Displays necessity on label\n */\n necessity?: \"required\" | \"optional\" | \"asterisk\";\n /**\n * Validation status\n */\n validationStatus?: \"error\" | \"warning\" | \"success\";\n}\n\nconst withBaseName = makePrefixer(\"saltFormField\");\n\nexport const FormField = forwardRef<HTMLDivElement, FormFieldProps>(\n (\n {\n children,\n className,\n disabled = false,\n id: idProp,\n labelPlacement = \"top\",\n necessity,\n readOnly = false,\n validationStatus,\n ...restProps\n },\n ref,\n ) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field\",\n css: formFieldCss,\n window: targetWindow,\n });\n\n const formFieldRef = useRef<HTMLDivElement>(null);\n const handleRef = useForkRef(ref, formFieldRef);\n\n const formId = useId(idProp);\n\n const labelId = formId ? `label-${formId}` : undefined;\n const helperTextId = formId ? `helperText-${formId}` : undefined;\n\n return (\n <div\n ref={handleRef}\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(`label${capitalize(labelPlacement)}`)]:\n labelPlacement,\n },\n className,\n )}\n {...restProps}\n >\n <FormFieldContext.Provider\n value={{\n a11yProps: {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": helperTextId,\n },\n disabled,\n necessity,\n readOnly,\n validationStatus,\n formFieldRef,\n }}\n >\n {children}\n </FormFieldContext.Provider>\n </div>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","useWindow","useComponentCssInjection","formFieldCss","useRef","useForkRef","useId","jsx","clsx","capitalize","FormFieldContext"],"mappings":";;;;;;;;;;;;;;;;;AA6CA,MAAM,YAAA,GAAeA,0BAAa,eAAe,C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jB;AAAA,YACC,KAAO,EAAA;AAAA,cACL,SAAW,EAAA;AAAA,gBACT,iBAAmB,EAAA,OAAA;AAAA,gBACnB,kBAAoB,EAAA;AAAA,eACtB;AAAA,cACA,QAAA;AAAA,cACA,SAAA;AAAA,cACA,QAAA;AAAA,cACA,gBAAA;AAAA,cACA;AAAA,aACF;AAAA,YAEC;AAAA;AAAA;AACH;AAAA,KACF;AAAA;AAGN;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".saltFormFieldHelperText {\n cursor: default;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n\n.saltFormFieldHelperText .saltText {\n font-style: var(--saltFormField-helperText-fontStyle, var(--salt-editable-help-fontStyle));\n}\n\n.saltFormFieldHelperText-withValidation {\n column-gap: var(--salt-spacing-75);\n}\n";
|
|
3
|
+
var css_248z = ".saltFormFieldHelperText {\n cursor: default;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n\n.saltFormFieldHelperText .saltText {\n font-style: var(--saltFormField-helperText-fontStyle, var(--salt-editable-help-fontStyle));\n}\n\n.saltFormFieldHelperText-withValidation {\n column-gap: var(--salt-spacing-75);\n}\n\n.saltFormFieldHelperText .saltFormFieldHelperText-statusIndicator {\n margin-top: calc((var(--salt-text-label-lineHeight) - max(var(--salt-size-icon), 12px)) / 2);\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=FormFieldHelperText.css.js.map
|
|
@@ -44,7 +44,13 @@ const FormFieldHelperText = ({
|
|
|
44
44
|
className
|
|
45
45
|
),
|
|
46
46
|
children: [
|
|
47
|
-
!disabled && !readOnly && validationStatus && /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
!disabled && !readOnly && validationStatus && /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
StatusIndicator.StatusIndicator,
|
|
49
|
+
{
|
|
50
|
+
className: withBaseName("statusIndicator"),
|
|
51
|
+
status: validationStatus
|
|
52
|
+
}
|
|
53
|
+
),
|
|
48
54
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
49
55
|
Text.Text,
|
|
50
56
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldHelperText.js","sources":["../src/form-field/FormFieldHelperText.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { StatusIndicator } from \"../status-indicator\";\nimport { Text, type TextProps } from \"../text\";\nimport { makePrefixer } from \"../utils\";\n\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport formFieldHelperTextCss from \"./FormFieldHelperText.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldHelperText\");\n\nexport interface FormFieldHelperTextProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {}\n\nexport const FormFieldHelperText = ({\n className,\n children,\n ...restProps\n}: FormFieldHelperTextProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-helper-text\",\n css: formFieldHelperTextCss,\n window: targetWindow,\n });\n\n const { a11yProps, disabled, readOnly, validationStatus } =\n useFormFieldProps();\n\n return (\n <div\n className={clsx(\n withBaseName(),\n { [withBaseName(\"withValidation\")]: validationStatus },\n className,\n )}\n >\n {!disabled && !readOnly && validationStatus && (\n <StatusIndicator
|
|
1
|
+
{"version":3,"file":"FormFieldHelperText.js","sources":["../src/form-field/FormFieldHelperText.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { StatusIndicator } from \"../status-indicator\";\nimport { Text, type TextProps } from \"../text\";\nimport { makePrefixer } from \"../utils\";\n\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport formFieldHelperTextCss from \"./FormFieldHelperText.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldHelperText\");\n\nexport interface FormFieldHelperTextProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {}\n\nexport const FormFieldHelperText = ({\n className,\n children,\n ...restProps\n}: FormFieldHelperTextProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-helper-text\",\n css: formFieldHelperTextCss,\n window: targetWindow,\n });\n\n const { a11yProps, disabled, readOnly, validationStatus } =\n useFormFieldProps();\n\n return (\n <div\n className={clsx(\n withBaseName(),\n { [withBaseName(\"withValidation\")]: validationStatus },\n className,\n )}\n >\n {!disabled && !readOnly && validationStatus && (\n <StatusIndicator\n className={withBaseName(\"statusIndicator\")}\n status={validationStatus}\n />\n )}\n <Text\n disabled={disabled}\n id={a11yProps?.[\"aria-describedby\"]}\n styleAs=\"label\"\n color={validationStatus ?? \"secondary\"}\n {...restProps}\n >\n {children}\n </Text>\n </div>\n );\n};\n"],"names":["makePrefixer","useWindow","useComponentCssInjection","formFieldHelperTextCss","useFormFieldProps","jsxs","jsx","StatusIndicator","Text"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,YAAA,GAAeA,0BAAa,yBAAyB,CAAA;AAKpD,MAAM,sBAAsB,CAAC;AAAA,EAClC,SAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAgC,KAAA;AAC9B,EAAA,MAAM,eAAeC,gBAAU,EAAA;AAC/B,EAAyBC,+BAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,6BAAA;AAAA,IACR,GAAK,EAAAC,qBAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAA,MAAM,EAAE,SAAW,EAAA,QAAA,EAAU,QAAU,EAAA,gBAAA,KACrCC,mCAAkB,EAAA;AAEpB,EACE,uBAAAC,eAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,QACT,YAAa,EAAA;AAAA,QACb,EAAE,CAAC,YAAA,CAAa,gBAAgB,CAAC,GAAG,gBAAiB,EAAA;AAAA,QACrD;AAAA,OACF;AAAA,MAEC,QAAA,EAAA;AAAA,QAAC,CAAA,QAAA,IAAY,CAAC,QAAA,IAAY,gBACzB,oBAAAC,cAAA;AAAA,UAACC,+BAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAW,aAAa,iBAAiB,CAAA;AAAA,YACzC,MAAQ,EAAA;AAAA;AAAA,SACV;AAAA,wBAEFD,cAAA;AAAA,UAACE,SAAA;AAAA,UAAA;AAAA,YACC,QAAA;AAAA,YACA,IAAI,SAAY,IAAA,IAAA,GAAA,MAAA,GAAA,SAAA,CAAA,kBAAA,CAAA;AAAA,YAChB,OAAQ,EAAA,OAAA;AAAA,YACR,OAAO,gBAAoB,IAAA,WAAA;AAAA,YAC1B,GAAG,SAAA;AAAA,YAEH;AAAA;AAAA;AACH;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -27,24 +27,36 @@ const FormFieldLabel = ({
|
|
|
27
27
|
className,
|
|
28
28
|
children,
|
|
29
29
|
intent = "label",
|
|
30
|
+
onClick,
|
|
30
31
|
...restProps
|
|
31
32
|
}) => {
|
|
32
|
-
const { a11yProps, disabled, necessity } = useFormFieldProps.useFormFieldProps();
|
|
33
|
+
const { a11yProps, disabled, necessity, formFieldRef } = useFormFieldProps.useFormFieldProps();
|
|
33
34
|
const targetWindow = window.useWindow();
|
|
34
35
|
styles.useComponentCssInjection({
|
|
35
36
|
testId: "salt-form-field-label",
|
|
36
37
|
css: FormFieldLabel$1,
|
|
37
38
|
window: targetWindow
|
|
38
39
|
});
|
|
40
|
+
const id = a11yProps == null ? void 0 : a11yProps["aria-labelledby"];
|
|
41
|
+
const handleClick = (event) => {
|
|
42
|
+
if (formFieldRef == null ? void 0 : formFieldRef.current) {
|
|
43
|
+
const element = formFieldRef.current.querySelector(
|
|
44
|
+
`[aria-labelledby*="${id}"]`
|
|
45
|
+
);
|
|
46
|
+
element == null ? void 0 : element.focus();
|
|
47
|
+
element == null ? void 0 : element.click();
|
|
48
|
+
}
|
|
49
|
+
onClick == null ? void 0 : onClick(event);
|
|
50
|
+
};
|
|
39
51
|
const necessityLabel = necessity ? necessity === "asterisk" ? " *" : ` (${capitalize.capitalize(necessity)})` : void 0;
|
|
40
52
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
41
53
|
Label.Label,
|
|
42
54
|
{
|
|
43
|
-
as: "label",
|
|
44
55
|
className: clsx.clsx(withBaseName(), withBaseName(intent), className),
|
|
45
|
-
id
|
|
56
|
+
id,
|
|
46
57
|
disabled,
|
|
47
58
|
variant: "secondary",
|
|
59
|
+
onClick: handleClick,
|
|
48
60
|
...restProps,
|
|
49
61
|
children: [
|
|
50
62
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldLabel.js","sources":["../src/form-field/FormFieldLabel.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { Label, type TextProps } from \"../text\";\nimport { capitalize, makePrefixer } from \"../utils\";\n\nimport formFieldLabelCss from \"./FormFieldLabel.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldLabel\");\n\nexport interface FormFieldLabelProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {\n /**\n * Intent for the label.\n *\n * Defaults to \"label\"\n * Using \"sentence\" gives more prominent styling\n */\n intent?: \"label\" | \"sentence\";\n}\n\nexport const FormFieldLabel = ({\n className,\n children,\n intent = \"label\",\n ...restProps\n}: FormFieldLabelProps) => {\n const { a11yProps, disabled, necessity } = useFormFieldProps();\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-label\",\n css: formFieldLabelCss,\n window: targetWindow,\n });\n\n const necessityLabel = necessity\n ? necessity === \"asterisk\"\n ? \" *\"\n : ` (${capitalize(necessity)})`\n : undefined;\n\n return (\n <Label\n
|
|
1
|
+
{"version":3,"file":"FormFieldLabel.js","sources":["../src/form-field/FormFieldLabel.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport type { MouseEvent } from \"react\";\n\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { Label, type TextProps } from \"../text\";\nimport { capitalize, makePrefixer } from \"../utils\";\n\nimport formFieldLabelCss from \"./FormFieldLabel.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldLabel\");\n\nexport interface FormFieldLabelProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {\n /**\n * Intent for the label.\n *\n * Defaults to \"label\"\n * Using \"sentence\" gives more prominent styling\n */\n intent?: \"label\" | \"sentence\";\n}\n\nexport const FormFieldLabel = ({\n className,\n children,\n intent = \"label\",\n onClick,\n ...restProps\n}: FormFieldLabelProps) => {\n const { a11yProps, disabled, necessity, formFieldRef } = useFormFieldProps();\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-label\",\n css: formFieldLabelCss,\n window: targetWindow,\n });\n\n const id = a11yProps?.[\"aria-labelledby\"];\n\n const handleClick = (event: MouseEvent<HTMLLabelElement>) => {\n if (formFieldRef?.current) {\n const element = formFieldRef.current.querySelector<HTMLElement>(\n `[aria-labelledby*=\"${id}\"]`,\n );\n element?.focus();\n element?.click();\n }\n onClick?.(event);\n };\n\n const necessityLabel = necessity\n ? necessity === \"asterisk\"\n ? \" *\"\n : ` (${capitalize(necessity)})`\n : undefined;\n\n return (\n <Label\n className={clsx(withBaseName(), withBaseName(intent), className)}\n id={id}\n disabled={disabled}\n variant=\"secondary\"\n onClick={handleClick}\n {...restProps}\n >\n {children}\n {necessityLabel && (\n <span className={withBaseName(\"necessityLabel\")}>{necessityLabel}</span>\n )}\n </Label>\n );\n};\n"],"names":["makePrefixer","useFormFieldProps","useWindow","useComponentCssInjection","formFieldLabelCss","capit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C,WAAWC,SAAK,CAAA,YAAA,IAAgB,YAAa,CAAA,MAAM,GAAG,SAAS,CAAA;AAAA,MAC/D,EAAA;AAAA,MACA,QAAA;AAAA,MACA,OAAQ,EAAA,WAAA;AAAA,MACR,OAAS,EAAA,WAAA;AAAA,MACR,GAAG,SAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,QACA,kCACEC,cAAA,CAAA,MAAA,EAAA,EAAK,WAAW,YAAa,CAAA,gBAAgB,GAAI,QAAe,EAAA,cAAA,EAAA;AAAA;AAAA;AAAA,GAErE;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldContext.js","sources":["../src/form-field-context/FormFieldContext.ts"],"sourcesContent":["import { createContext } from \"../utils\";\n\nexport interface A11yValueProps {\n /**\n * id for FormFieldHelperText\n */\n helperTextId?: string;\n /**\n * id for FormFieldLabel\n */\n labelId?: string;\n}\n\nexport type NecessityType = \"required\" | \"optional\" | \"asterisk\";\n\nexport interface a11yValueAriaProps {\n \"aria-labelledby\": A11yValueProps[\"labelId\"];\n \"aria-describedby\": A11yValueProps[\"helperTextId\"] | undefined;\n}\n\nexport interface FormFieldContextValue {\n a11yProps: a11yValueAriaProps;\n disabled: boolean;\n necessity: NecessityType | undefined;\n readOnly: boolean;\n validationStatus: \"error\" | \"warning\" | \"success\" | undefined;\n}\n\nexport const FormFieldContext = createContext(\n \"FormFieldContext\",\n {} as FormFieldContextValue,\n);\n"],"names":["createContext"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FormFieldContext.js","sources":["../src/form-field-context/FormFieldContext.ts"],"sourcesContent":["import type { RefObject } from \"react\";\nimport { createContext } from \"../utils\";\n\nexport interface A11yValueProps {\n /**\n * id for FormFieldHelperText\n */\n helperTextId?: string;\n /**\n * id for FormFieldLabel\n */\n labelId?: string;\n}\n\nexport type NecessityType = \"required\" | \"optional\" | \"asterisk\";\n\nexport interface a11yValueAriaProps {\n \"aria-labelledby\": A11yValueProps[\"labelId\"];\n \"aria-describedby\": A11yValueProps[\"helperTextId\"] | undefined;\n}\n\nexport interface FormFieldContextValue {\n a11yProps: a11yValueAriaProps;\n disabled: boolean;\n necessity: NecessityType | undefined;\n readOnly: boolean;\n validationStatus: \"error\" | \"warning\" | \"success\" | undefined;\n formFieldRef?: RefObject<HTMLDivElement>;\n}\n\nexport const FormFieldContext = createContext(\n \"FormFieldContext\",\n {} as FormFieldContextValue,\n);\n"],"names":["createContext"],"mappings":";;;;;;;;;;;AA8BO,MAAM,gBAAmB,GAAAA,2BAAA;AAAA,EAC9B,kBAAA;AAAA,EACA;AACF;;;;"}
|
|
@@ -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;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".saltPageButton {\n min-width: var(--salt-size-base);\n font-weight: var(--salt-text-fontWeight);\n height: var(--salt-size-base);\n color: var(--salt-content-primary-foreground);\n background: var(--salt-selectable-background);\n appearance: none;\n box-sizing: border-box;\n padding: 0 var(--salt-spacing-100);\n border: none;\n font-size: var(--salt-text-fontSize);\n font-family: var(--salt-text-
|
|
3
|
+
var css_248z = ".saltPageButton {\n min-width: var(--salt-size-base);\n font-weight: var(--salt-text-fontWeight);\n height: var(--salt-size-base);\n color: var(--salt-content-primary-foreground);\n background: var(--salt-selectable-background);\n appearance: none;\n box-sizing: border-box;\n padding: 0 var(--salt-spacing-100);\n border: none;\n font-size: var(--salt-text-fontSize);\n font-family: var(--salt-text-fontFamily);\n line-height: var(--salt-text-lineHeight);\n letter-spacing: var(--salt-text-letterSpacing);\n cursor: var(--salt-selectable-cursor-hover);\n border-radius: var(--salt-palette-corner-weak, 0);\n}\n\n.saltPageButton:hover,\n.saltPageButton:focus-visible {\n background: var(--salt-selectable-background-hover);\n}\n\n.saltPageButton:active {\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton:focus-visible {\n outline: var(--salt-focused-outline);\n}\n\n.saltPageButton:disabled {\n color: var(--salt-content-secondary-foreground);\n background: var(--salt-selectable-background);\n cursor: var(--salt-editable-cursor-readonly);\n}\n\n.saltPageButton[aria-current=\"page\"] {\n border: var(--salt-size-border) var(--salt-selectable-borderStyle) var(--salt-selectable-borderColor);\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton-fixed {\n padding: 0;\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=PageButton.css.js.map
|
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;AAA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EAAS,SAAW,EAAA,YAAA,CAAa,SAAS,CAAA,EAClD,QACH,EAAA,mBAAA,EAAA,CAAA;AAAA,UAED;AAAA;AAAA;AAAA,KACH;AAAA;AAGN;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var css_248z = ".saltCheckboxIcon {\n --checkbox-size: var(--salt-size-selectable);\n width: var(--checkbox-size);\n min-width: var(--checkbox-size);\n height: var(--checkbox-size);\n min-height: var(--checkbox-size);\n border: var(--salt-size-border) var(--salt-selectable-borderStyle) var(--salt-selectable-borderColor);\n border-radius: var(--salt-palette-corner-weaker, 0);\n color: var(--salt-selectable-foreground);\n background: var(--salt-container-primary-background);\n position: relative;\n --saltIcon-size: 100%;\n display: flex;\n /* Using overflow:hidden here causes a thin white line */\n clip-path: border-box;\n box-sizing: border-box;\n}\n\n.saltCheckbox:hover .saltCheckboxIcon,\n.saltCheckbox:hover .saltCheckboxIcon-indeterminate {\n border-color: var(--salt-selectable-borderColor-hover);\n color: var(--salt-selectable-foreground-hover);\n}\n\n.saltCheckboxIcon-checked
|
|
1
|
+
var css_248z = ".saltCheckboxIcon {\n --checkbox-size: var(--salt-size-selectable);\n width: var(--checkbox-size);\n min-width: var(--checkbox-size);\n height: var(--checkbox-size);\n min-height: var(--checkbox-size);\n border: var(--salt-size-border) var(--salt-selectable-borderStyle) var(--salt-selectable-borderColor);\n border-radius: var(--salt-palette-corner-weaker, 0);\n color: var(--salt-selectable-foreground);\n background: var(--salt-container-primary-background);\n position: relative;\n --saltIcon-size: 100%;\n display: flex;\n /* Using overflow:hidden here causes a thin white line */\n clip-path: border-box;\n box-sizing: border-box;\n}\n\n.saltCheckboxIcon-checked,\n.saltCheckbox:hover .saltCheckboxIcon-checked {\n border-color: var(--salt-selectable-borderColor-selected);\n color: var(--salt-selectable-foreground-selected);\n}\n\n.saltCheckbox:hover .saltCheckboxIcon,\n.saltCheckbox:hover .saltCheckboxIcon-indeterminate {\n border-color: var(--salt-selectable-borderColor-hover);\n color: var(--salt-selectable-foreground-hover);\n}\n\n.saltCheckboxIcon-checked.saltCheckboxIcon-indeterminate {\n border-color: var(--salt-selectable-borderColor);\n color: var(--salt-selectable-foreground);\n}\n\n.saltCheckboxIcon-disabled,\n.saltCheckbox:hover .saltCheckboxIcon-disabled,\n.saltCheckboxIcon-disabled.saltCheckboxIcon-indeterminate,\n.saltCheckbox:hover .saltCheckboxIcon-disabled.saltCheckboxIcon-indeterminate {\n border-color: var(--salt-selectable-borderColor-disabled);\n background: var(--salt-container-primary-background-disabled);\n color: var(--salt-selectable-foreground-disabled);\n}\n\n.saltCheckboxIcon-checked.saltCheckboxIcon-disabled,\n.saltCheckbox:hover .saltCheckboxIcon-checked.saltCheckboxIcon-disabled {\n border-color: var(--salt-selectable-borderColor-selectedDisabled);\n color: var(--salt-selectable-foreground-selectedDisabled);\n}\n\n.saltCheckboxIcon-indeterminate::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: calc(var(--checkbox-size) - 6px);\n height: 2px;\n background: currentColor;\n transform: translate(-50%, -50%);\n}\n\n.saltCheckboxIcon-error,\n.saltCheckbox:hover .saltCheckboxIcon-error {\n color: var(--salt-status-error-foreground-decorative);\n border-color: var(--salt-status-error-borderColor);\n outline-color: var(--salt-status-error-foreground-decorative);\n}\n\n.saltCheckboxIcon-warning,\n.saltCheckbox:hover .saltCheckboxIcon-warning {\n color: var(--salt-status-warning-foreground-decorative);\n border-color: var(--salt-status-warning-borderColor);\n outline-color: var(--salt-status-warning-foreground-decorative);\n}\n\n.saltCheckboxIcon-readOnly,\n.saltCheckbox:hover .saltCheckboxIcon-readOnly {\n border-color: var(--salt-selectable-borderColor-readonly);\n color: var(--salt-content-primary-foreground);\n}\n\n.saltCheckboxIcon > svg {\n position: absolute;\n /* Ensure a gap doesn't appear when device scaling is used */\n transform: scale(1.01);\n}\n";
|
|
2
2
|
|
|
3
3
|
export { css_248z as default };
|
|
4
4
|
//# sourceMappingURL=CheckboxIcon.css.js.map
|
|
@@ -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,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AAAA,aACH,EAAA,CAAA;AAAA,YACC,WAAA,wBACE,IAAK,EAAA,EAAA,KAAA,EAAM,aAAY,SAAW,EAAA,YAAA,CAAa,aAAa,CAAA,EAC1D,QACH,EAAA,WAAA,EAAA;AAAA,WAEJ,EAAA,CAAA;AAAA,UACC,2BACE,GAAA,CAAA,KAAA,EAAA,EAAI,WAAW,YAAa,CAAA,kBAAkB,GAAI,QAAQ,EAAA,OAAA,EAAA;AAAA;AAAA;AAAA,KAE/D;AAAA;AAGN;;;;"}
|
|
@@ -2,11 +2,12 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
3
|
import { useWindow } from '@salt-ds/window';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
|
-
import { forwardRef } from 'react';
|
|
5
|
+
import { forwardRef, useRef } from 'react';
|
|
6
6
|
import { FormFieldContext } from '../form-field-context/FormFieldContext.js';
|
|
7
7
|
import { capitalize } from '../utils/capitalize.js';
|
|
8
8
|
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
9
9
|
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
10
|
+
import { useForkRef } from '../utils/useForkRef.js';
|
|
10
11
|
import { useId } from '../utils/useId.js';
|
|
11
12
|
import '../salt-provider/SaltProvider.js';
|
|
12
13
|
import '../viewport/ViewportProvider.js';
|
|
@@ -31,13 +32,15 @@ const FormField = forwardRef(
|
|
|
31
32
|
css: css_248z,
|
|
32
33
|
window: targetWindow
|
|
33
34
|
});
|
|
35
|
+
const formFieldRef = useRef(null);
|
|
36
|
+
const handleRef = useForkRef(ref, formFieldRef);
|
|
34
37
|
const formId = useId(idProp);
|
|
35
38
|
const labelId = formId ? `label-${formId}` : void 0;
|
|
36
39
|
const helperTextId = formId ? `helperText-${formId}` : void 0;
|
|
37
40
|
return /* @__PURE__ */ jsx(
|
|
38
41
|
"div",
|
|
39
42
|
{
|
|
40
|
-
ref,
|
|
43
|
+
ref: handleRef,
|
|
41
44
|
className: clsx(
|
|
42
45
|
withBaseName(),
|
|
43
46
|
{
|
|
@@ -58,7 +61,8 @@ const FormField = forwardRef(
|
|
|
58
61
|
disabled,
|
|
59
62
|
necessity,
|
|
60
63
|
readOnly,
|
|
61
|
-
validationStatus
|
|
64
|
+
validationStatus,
|
|
65
|
+
formFieldRef
|
|
62
66
|
},
|
|
63
67
|
children
|
|
64
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","sources":["../src/form-field/FormField.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { type HTMLAttributes, forwardRef } from \"react\";\nimport { type A11yValueProps, FormFieldContext } from \"../form-field-context\";\nimport { capitalize, makePrefixer, useId } from \"../utils\";\n\nimport formFieldCss from \"./FormField.css\";\n\nexport type FormFieldLabelPlacement = \"top\" | \"left\" | \"right\";\n\nexport interface FormFieldProps\n extends HTMLAttributes<HTMLDivElement>,\n A11yValueProps {\n /**\n * If `true`, the field will be disabled.\n */\n disabled?: boolean;\n /**\n * Location of the label relative to the control.\n *\n * Either 'top', 'left', or 'right'`.\n */\n labelPlacement?: FormFieldLabelPlacement;\n /**\n * If `true`, the field will be read-only.\n */\n readOnly?: boolean;\n /**\n * Optional id prop\n *\n * Used as suffix of FormFieldLabel id: `label-{id}`\n * Used as suffix of FormFieldHelperText id: `helperText-{id}`\n */\n id?: string;\n /**\n * Displays necessity on label\n */\n necessity?: \"required\" | \"optional\" | \"asterisk\";\n /**\n * Validation status\n */\n validationStatus?: \"error\" | \"warning\" | \"success\";\n}\n\nconst withBaseName = makePrefixer(\"saltFormField\");\n\nexport const FormField = forwardRef<HTMLDivElement, FormFieldProps>(\n (\n {\n children,\n className,\n disabled = false,\n id: idProp,\n labelPlacement = \"top\",\n necessity,\n readOnly = false,\n validationStatus,\n ...restProps\n },\n ref,\n ) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field\",\n css: formFieldCss,\n window: targetWindow,\n });\n\n const formId = useId(idProp);\n\n const labelId = formId ? `label-${formId}` : undefined;\n const helperTextId = formId ? `helperText-${formId}` : undefined;\n\n return (\n <div\n ref={
|
|
1
|
+
{"version":3,"file":"FormField.js","sources":["../src/form-field/FormField.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { type HTMLAttributes, forwardRef, useRef } from \"react\";\nimport { type A11yValueProps, FormFieldContext } from \"../form-field-context\";\nimport { capitalize, makePrefixer, useForkRef, useId } from \"../utils\";\n\nimport formFieldCss from \"./FormField.css\";\n\nexport type FormFieldLabelPlacement = \"top\" | \"left\" | \"right\";\n\nexport interface FormFieldProps\n extends HTMLAttributes<HTMLDivElement>,\n A11yValueProps {\n /**\n * If `true`, the field will be disabled.\n */\n disabled?: boolean;\n /**\n * Location of the label relative to the control.\n *\n * Either 'top', 'left', or 'right'`.\n */\n labelPlacement?: FormFieldLabelPlacement;\n /**\n * If `true`, the field will be read-only.\n */\n readOnly?: boolean;\n /**\n * Optional id prop\n *\n * Used as suffix of FormFieldLabel id: `label-{id}`\n * Used as suffix of FormFieldHelperText id: `helperText-{id}`\n */\n id?: string;\n /**\n * Displays necessity on label\n */\n necessity?: \"required\" | \"optional\" | \"asterisk\";\n /**\n * Validation status\n */\n validationStatus?: \"error\" | \"warning\" | \"success\";\n}\n\nconst withBaseName = makePrefixer(\"saltFormField\");\n\nexport const FormField = forwardRef<HTMLDivElement, FormFieldProps>(\n (\n {\n children,\n className,\n disabled = false,\n id: idProp,\n labelPlacement = \"top\",\n necessity,\n readOnly = false,\n validationStatus,\n ...restProps\n },\n ref,\n ) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field\",\n css: formFieldCss,\n window: targetWindow,\n });\n\n const formFieldRef = useRef<HTMLDivElement>(null);\n const handleRef = useForkRef(ref, formFieldRef);\n\n const formId = useId(idProp);\n\n const labelId = formId ? `label-${formId}` : undefined;\n const helperTextId = formId ? `helperText-${formId}` : undefined;\n\n return (\n <div\n ref={handleRef}\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(`label${capitalize(labelPlacement)}`)]:\n labelPlacement,\n },\n className,\n )}\n {...restProps}\n >\n <FormFieldContext.Provider\n value={{\n a11yProps: {\n \"aria-labelledby\": labelId,\n \"aria-describedby\": helperTextId,\n },\n disabled,\n necessity,\n readOnly,\n validationStatus,\n formFieldRef,\n }}\n >\n {children}\n </FormFieldContext.Provider>\n </div>\n );\n },\n);\n"],"names":["formFieldCss"],"mappings":";;;;;;;;;;;;;;;AA6CA,MAAM,YAAA,GAAe,aAAa,eAAe,CAAA;AAE1C,MAAM,SAAY,GAAA,UAAA;AAAA,EACvB,CACE;AAAA,IACE,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,EAAI,EAAA,MAAA;AAAA,IACJ,cAAiB,GAAA,KAAA;AAAA,IACjB,SAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,gBAAA;AAAA,IACA,GAAG;AAAA,KAEL,GACG,KAAA;AACH,IAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,iBAAA;AAAA,MACR,GAAK,EAAAA,QAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AAED,IAAM,MAAA,YAAA,GAAe,OAAuB,IAAI,CAAA;AAChD,IAAM,MAAA,SAAA,GAAY,UAAW,CAAA,GAAA,EAAK,YAAY,CAAA;AAE9C,IAAM,MAAA,MAAA,GAAS,MAAM,MAAM,CAAA;AAE3B,IAAA,MAAM,OAAU,GAAA,MAAA,GAAS,CAAS,MAAA,EAAA,MAAM,CAAK,CAAA,GAAA,MAAA;AAC7C,IAAA,MAAM,YAAe,GAAA,MAAA,GAAS,CAAc,WAAA,EAAA,MAAM,CAAK,CAAA,GAAA,MAAA;AAEvD,IACE,uBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,SAAA;AAAA,QACL,SAAW,EAAA,IAAA;AAAA,UACT,YAAa,EAAA;AAAA,UACb;AAAA,YACE,CAAC,YAAA,CAAa,UAAU,CAAC,GAAG,QAAA;AAAA,YAC5B,CAAC,aAAa,CAAQ,KAAA,EAAA,UAAA,CAAW,cAAc,CAAC,CAAA,CAAE,CAAC,GACjD;AAAA,WACJ;AAAA,UACA;AAAA,SACF;AAAA,QACC,GAAG,SAAA;AAAA,QAEJ,QAAA,kBAAA,GAAA;AAAA,UAAC,gBAAiB,CAAA,QAAA;AAAA,UAAjB;AAAA,YACC,KAAO,EAAA;AAAA,cACL,SAAW,EAAA;AAAA,gBACT,iBAAmB,EAAA,OAAA;AAAA,gBACnB,kBAAoB,EAAA;AAAA,eACtB;AAAA,cACA,QAAA;AAAA,cACA,SAAA;AAAA,cACA,QAAA;AAAA,cACA,gBAAA;AAAA,cACA;AAAA,aACF;AAAA,YAEC;AAAA;AAAA;AACH;AAAA,KACF;AAAA;AAGN;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var css_248z = ".saltFormFieldHelperText {\n cursor: default;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n\n.saltFormFieldHelperText .saltText {\n font-style: var(--saltFormField-helperText-fontStyle, var(--salt-editable-help-fontStyle));\n}\n\n.saltFormFieldHelperText-withValidation {\n column-gap: var(--salt-spacing-75);\n}\n";
|
|
1
|
+
var css_248z = ".saltFormFieldHelperText {\n cursor: default;\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n\n.saltFormFieldHelperText .saltText {\n font-style: var(--saltFormField-helperText-fontStyle, var(--salt-editable-help-fontStyle));\n}\n\n.saltFormFieldHelperText-withValidation {\n column-gap: var(--salt-spacing-75);\n}\n\n.saltFormFieldHelperText .saltFormFieldHelperText-statusIndicator {\n margin-top: calc((var(--salt-text-label-lineHeight) - max(var(--salt-size-icon), 12px)) / 2);\n}\n";
|
|
2
2
|
|
|
3
3
|
export { css_248z as default };
|
|
4
4
|
//# sourceMappingURL=FormFieldHelperText.css.js.map
|
|
@@ -42,7 +42,13 @@ const FormFieldHelperText = ({
|
|
|
42
42
|
className
|
|
43
43
|
),
|
|
44
44
|
children: [
|
|
45
|
-
!disabled && !readOnly && validationStatus && /* @__PURE__ */ jsx(
|
|
45
|
+
!disabled && !readOnly && validationStatus && /* @__PURE__ */ jsx(
|
|
46
|
+
StatusIndicator,
|
|
47
|
+
{
|
|
48
|
+
className: withBaseName("statusIndicator"),
|
|
49
|
+
status: validationStatus
|
|
50
|
+
}
|
|
51
|
+
),
|
|
46
52
|
/* @__PURE__ */ jsx(
|
|
47
53
|
Text,
|
|
48
54
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldHelperText.js","sources":["../src/form-field/FormFieldHelperText.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { StatusIndicator } from \"../status-indicator\";\nimport { Text, type TextProps } from \"../text\";\nimport { makePrefixer } from \"../utils\";\n\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport formFieldHelperTextCss from \"./FormFieldHelperText.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldHelperText\");\n\nexport interface FormFieldHelperTextProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {}\n\nexport const FormFieldHelperText = ({\n className,\n children,\n ...restProps\n}: FormFieldHelperTextProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-helper-text\",\n css: formFieldHelperTextCss,\n window: targetWindow,\n });\n\n const { a11yProps, disabled, readOnly, validationStatus } =\n useFormFieldProps();\n\n return (\n <div\n className={clsx(\n withBaseName(),\n { [withBaseName(\"withValidation\")]: validationStatus },\n className,\n )}\n >\n {!disabled && !readOnly && validationStatus && (\n <StatusIndicator
|
|
1
|
+
{"version":3,"file":"FormFieldHelperText.js","sources":["../src/form-field/FormFieldHelperText.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { StatusIndicator } from \"../status-indicator\";\nimport { Text, type TextProps } from \"../text\";\nimport { makePrefixer } from \"../utils\";\n\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport formFieldHelperTextCss from \"./FormFieldHelperText.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldHelperText\");\n\nexport interface FormFieldHelperTextProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {}\n\nexport const FormFieldHelperText = ({\n className,\n children,\n ...restProps\n}: FormFieldHelperTextProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-helper-text\",\n css: formFieldHelperTextCss,\n window: targetWindow,\n });\n\n const { a11yProps, disabled, readOnly, validationStatus } =\n useFormFieldProps();\n\n return (\n <div\n className={clsx(\n withBaseName(),\n { [withBaseName(\"withValidation\")]: validationStatus },\n className,\n )}\n >\n {!disabled && !readOnly && validationStatus && (\n <StatusIndicator\n className={withBaseName(\"statusIndicator\")}\n status={validationStatus}\n />\n )}\n <Text\n disabled={disabled}\n id={a11yProps?.[\"aria-describedby\"]}\n styleAs=\"label\"\n color={validationStatus ?? \"secondary\"}\n {...restProps}\n >\n {children}\n </Text>\n </div>\n );\n};\n"],"names":["formFieldHelperTextCss"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,YAAA,GAAe,aAAa,yBAAyB,CAAA;AAKpD,MAAM,sBAAsB,CAAC;AAAA,EAClC,SAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAgC,KAAA;AAC9B,EAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,6BAAA;AAAA,IACR,GAAK,EAAAA,QAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAA,MAAM,EAAE,SAAW,EAAA,QAAA,EAAU,QAAU,EAAA,gBAAA,KACrC,iBAAkB,EAAA;AAEpB,EACE,uBAAA,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,QACT,YAAa,EAAA;AAAA,QACb,EAAE,CAAC,YAAA,CAAa,gBAAgB,CAAC,GAAG,gBAAiB,EAAA;AAAA,QACrD;AAAA,OACF;AAAA,MAEC,QAAA,EAAA;AAAA,QAAC,CAAA,QAAA,IAAY,CAAC,QAAA,IAAY,gBACzB,oBAAA,GAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAW,aAAa,iBAAiB,CAAA;AAAA,YACzC,MAAQ,EAAA;AAAA;AAAA,SACV;AAAA,wBAEF,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,QAAA;AAAA,YACA,IAAI,SAAY,IAAA,IAAA,GAAA,MAAA,GAAA,SAAA,CAAA,kBAAA,CAAA;AAAA,YAChB,OAAQ,EAAA,OAAA;AAAA,YACR,OAAO,gBAAoB,IAAA,WAAA;AAAA,YAC1B,GAAG,SAAA;AAAA,YAEH;AAAA;AAAA;AACH;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -25,24 +25,36 @@ const FormFieldLabel = ({
|
|
|
25
25
|
className,
|
|
26
26
|
children,
|
|
27
27
|
intent = "label",
|
|
28
|
+
onClick,
|
|
28
29
|
...restProps
|
|
29
30
|
}) => {
|
|
30
|
-
const { a11yProps, disabled, necessity } = useFormFieldProps();
|
|
31
|
+
const { a11yProps, disabled, necessity, formFieldRef } = useFormFieldProps();
|
|
31
32
|
const targetWindow = useWindow();
|
|
32
33
|
useComponentCssInjection({
|
|
33
34
|
testId: "salt-form-field-label",
|
|
34
35
|
css: css_248z,
|
|
35
36
|
window: targetWindow
|
|
36
37
|
});
|
|
38
|
+
const id = a11yProps == null ? void 0 : a11yProps["aria-labelledby"];
|
|
39
|
+
const handleClick = (event) => {
|
|
40
|
+
if (formFieldRef == null ? void 0 : formFieldRef.current) {
|
|
41
|
+
const element = formFieldRef.current.querySelector(
|
|
42
|
+
`[aria-labelledby*="${id}"]`
|
|
43
|
+
);
|
|
44
|
+
element == null ? void 0 : element.focus();
|
|
45
|
+
element == null ? void 0 : element.click();
|
|
46
|
+
}
|
|
47
|
+
onClick == null ? void 0 : onClick(event);
|
|
48
|
+
};
|
|
37
49
|
const necessityLabel = necessity ? necessity === "asterisk" ? " *" : ` (${capitalize(necessity)})` : void 0;
|
|
38
50
|
return /* @__PURE__ */ jsxs(
|
|
39
51
|
Label,
|
|
40
52
|
{
|
|
41
|
-
as: "label",
|
|
42
53
|
className: clsx(withBaseName(), withBaseName(intent), className),
|
|
43
|
-
id
|
|
54
|
+
id,
|
|
44
55
|
disabled,
|
|
45
56
|
variant: "secondary",
|
|
57
|
+
onClick: handleClick,
|
|
46
58
|
...restProps,
|
|
47
59
|
children: [
|
|
48
60
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldLabel.js","sources":["../src/form-field/FormFieldLabel.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { Label, type TextProps } from \"../text\";\nimport { capitalize, makePrefixer } from \"../utils\";\n\nimport formFieldLabelCss from \"./FormFieldLabel.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldLabel\");\n\nexport interface FormFieldLabelProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {\n /**\n * Intent for the label.\n *\n * Defaults to \"label\"\n * Using \"sentence\" gives more prominent styling\n */\n intent?: \"label\" | \"sentence\";\n}\n\nexport const FormFieldLabel = ({\n className,\n children,\n intent = \"label\",\n ...restProps\n}: FormFieldLabelProps) => {\n const { a11yProps, disabled, necessity } = useFormFieldProps();\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-label\",\n css: formFieldLabelCss,\n window: targetWindow,\n });\n\n const necessityLabel = necessity\n ? necessity === \"asterisk\"\n ? \" *\"\n : ` (${capitalize(necessity)})`\n : undefined;\n\n return (\n <Label\n
|
|
1
|
+
{"version":3,"file":"FormFieldLabel.js","sources":["../src/form-field/FormFieldLabel.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport type { MouseEvent } from \"react\";\n\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { Label, type TextProps } from \"../text\";\nimport { capitalize, makePrefixer } from \"../utils\";\n\nimport formFieldLabelCss from \"./FormFieldLabel.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldLabel\");\n\nexport interface FormFieldLabelProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {\n /**\n * Intent for the label.\n *\n * Defaults to \"label\"\n * Using \"sentence\" gives more prominent styling\n */\n intent?: \"label\" | \"sentence\";\n}\n\nexport const FormFieldLabel = ({\n className,\n children,\n intent = \"label\",\n onClick,\n ...restProps\n}: FormFieldLabelProps) => {\n const { a11yProps, disabled, necessity, formFieldRef } = useFormFieldProps();\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-label\",\n css: formFieldLabelCss,\n window: targetWindow,\n });\n\n const id = a11yProps?.[\"aria-labelledby\"];\n\n const handleClick = (event: MouseEvent<HTMLLabelElement>) => {\n if (formFieldRef?.current) {\n const element = formFieldRef.current.querySelector<HTMLElement>(\n `[aria-labelledby*=\"${id}\"]`,\n );\n element?.focus();\n element?.click();\n }\n onClick?.(event);\n };\n\n const necessityLabel = necessity\n ? necessity === \"asterisk\"\n ? \" *\"\n : ` (${capitalize(necessity)})`\n : undefined;\n\n return (\n <Label\n className={clsx(withBaseName(), withBaseName(intent), className)}\n id={id}\n disabled={disabled}\n variant=\"secondary\"\n onClick={handleClick}\n {...restProps}\n >\n {children}\n {necessityLabel && (\n <span className={withBaseName(\"necessityLabel\")}>{necessityLabel}</span>\n )}\n </Label>\n );\n};\n"],"names":["formFieldLabelCss"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,YAAA,GAAe,aAAa,oBAAoB,CAAA;AAa/C,MAAM,iBAAiB,CAAC;AAAA,EAC7B,SAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAS,GAAA,OAAA;AAAA,EACT,OAAA;AAAA,EACA,GAAG;AACL,CAA2B,KAAA;AACzB,EAAA,MAAM,EAAE,SAAW,EAAA,QAAA,EAAU,SAAW,EAAA,YAAA,KAAiB,iBAAkB,EAAA;AAC3E,EAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,uBAAA;AAAA,IACR,GAAK,EAAAA,QAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAA,MAAM,KAAK,SAAY,IAAA,IAAA,GAAA,MAAA,GAAA,SAAA,CAAA,iBAAA,CAAA;AAEvB,EAAM,MAAA,WAAA,GAAc,CAAC,KAAwC,KAAA;AAC3D,IAAA,IAAI,6CAAc,OAAS,EAAA;AACzB,MAAM,MAAA,OAAA,GAAU,aAAa,OAAQ,CAAA,aAAA;AAAA,QACnC,sBAAsB,EAAE,CAAA,EAAA;AAAA,OAC1B;AACA,MAAS,OAAA,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,CAAA,KAAA,EAAA;AACT,MAAS,OAAA,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,CAAA,KAAA,EAAA;AAAA;AAEX,IAAU,OAAA,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,CAAA,KAAA,CAAA;AAAA,GACZ;AAEA,EAAM,MAAA,cAAA,GAAiB,YACnB,SAAc,KAAA,UAAA,GACZ,OACA,CAAK,EAAA,EAAA,UAAA,CAAW,SAAS,CAAC,CAC5B,CAAA,CAAA,GAAA,MAAA;AAEJ,EACE,uBAAA,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAW,IAAK,CAAA,YAAA,IAAgB,YAAa,CAAA,MAAM,GAAG,SAAS,CAAA;AAAA,MAC/D,EAAA;AAAA,MACA,QAAA;AAAA,MACA,OAAQ,EAAA,WAAA;AAAA,MACR,OAAS,EAAA,WAAA;AAAA,MACR,GAAG,SAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,QACA,kCACE,GAAA,CAAA,MAAA,EAAA,EAAK,WAAW,YAAa,CAAA,gBAAgB,GAAI,QAAe,EAAA,cAAA,EAAA;AAAA;AAAA;AAAA,GAErE;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldContext.js","sources":["../src/form-field-context/FormFieldContext.ts"],"sourcesContent":["import { createContext } from \"../utils\";\n\nexport interface A11yValueProps {\n /**\n * id for FormFieldHelperText\n */\n helperTextId?: string;\n /**\n * id for FormFieldLabel\n */\n labelId?: string;\n}\n\nexport type NecessityType = \"required\" | \"optional\" | \"asterisk\";\n\nexport interface a11yValueAriaProps {\n \"aria-labelledby\": A11yValueProps[\"labelId\"];\n \"aria-describedby\": A11yValueProps[\"helperTextId\"] | undefined;\n}\n\nexport interface FormFieldContextValue {\n a11yProps: a11yValueAriaProps;\n disabled: boolean;\n necessity: NecessityType | undefined;\n readOnly: boolean;\n validationStatus: \"error\" | \"warning\" | \"success\" | undefined;\n}\n\nexport const FormFieldContext = createContext(\n \"FormFieldContext\",\n {} as FormFieldContextValue,\n);\n"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FormFieldContext.js","sources":["../src/form-field-context/FormFieldContext.ts"],"sourcesContent":["import type { RefObject } from \"react\";\nimport { createContext } from \"../utils\";\n\nexport interface A11yValueProps {\n /**\n * id for FormFieldHelperText\n */\n helperTextId?: string;\n /**\n * id for FormFieldLabel\n */\n labelId?: string;\n}\n\nexport type NecessityType = \"required\" | \"optional\" | \"asterisk\";\n\nexport interface a11yValueAriaProps {\n \"aria-labelledby\": A11yValueProps[\"labelId\"];\n \"aria-describedby\": A11yValueProps[\"helperTextId\"] | undefined;\n}\n\nexport interface FormFieldContextValue {\n a11yProps: a11yValueAriaProps;\n disabled: boolean;\n necessity: NecessityType | undefined;\n readOnly: boolean;\n validationStatus: \"error\" | \"warning\" | \"success\" | undefined;\n formFieldRef?: RefObject<HTMLDivElement>;\n}\n\nexport const FormFieldContext = createContext(\n \"FormFieldContext\",\n {} as FormFieldContextValue,\n);\n"],"names":[],"mappings":";;;;;;;;;AA8BO,MAAM,gBAAmB,GAAA,aAAA;AAAA,EAC9B,kBAAA;AAAA,EACA;AACF;;;;"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { 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';
|
|
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,4 +1,4 @@
|
|
|
1
|
-
var css_248z = ".saltPageButton {\n min-width: var(--salt-size-base);\n font-weight: var(--salt-text-fontWeight);\n height: var(--salt-size-base);\n color: var(--salt-content-primary-foreground);\n background: var(--salt-selectable-background);\n appearance: none;\n box-sizing: border-box;\n padding: 0 var(--salt-spacing-100);\n border: none;\n font-size: var(--salt-text-fontSize);\n font-family: var(--salt-text-
|
|
1
|
+
var css_248z = ".saltPageButton {\n min-width: var(--salt-size-base);\n font-weight: var(--salt-text-fontWeight);\n height: var(--salt-size-base);\n color: var(--salt-content-primary-foreground);\n background: var(--salt-selectable-background);\n appearance: none;\n box-sizing: border-box;\n padding: 0 var(--salt-spacing-100);\n border: none;\n font-size: var(--salt-text-fontSize);\n font-family: var(--salt-text-fontFamily);\n line-height: var(--salt-text-lineHeight);\n letter-spacing: var(--salt-text-letterSpacing);\n cursor: var(--salt-selectable-cursor-hover);\n border-radius: var(--salt-palette-corner-weak, 0);\n}\n\n.saltPageButton:hover,\n.saltPageButton:focus-visible {\n background: var(--salt-selectable-background-hover);\n}\n\n.saltPageButton:active {\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton:focus-visible {\n outline: var(--salt-focused-outline);\n}\n\n.saltPageButton:disabled {\n color: var(--salt-content-secondary-foreground);\n background: var(--salt-selectable-background);\n cursor: var(--salt-editable-cursor-readonly);\n}\n\n.saltPageButton[aria-current=\"page\"] {\n border: var(--salt-size-border) var(--salt-selectable-borderStyle) var(--salt-selectable-borderColor);\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton-fixed {\n padding: 0;\n}\n";
|
|
2
2
|
|
|
3
3
|
export { css_248z as default };
|
|
4
4
|
//# sourceMappingURL=PageButton.css.js.map
|
|
@@ -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
|
|
@@ -8,4 +8,4 @@ export interface FormFieldLabelProps extends Omit<TextProps<"label">, "variant"
|
|
|
8
8
|
*/
|
|
9
9
|
intent?: "label" | "sentence";
|
|
10
10
|
}
|
|
11
|
-
export declare const FormFieldLabel: ({ className, children, intent, ...restProps }: FormFieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const FormFieldLabel: ({ className, children, intent, onClick, ...restProps }: FormFieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
1
2
|
export interface A11yValueProps {
|
|
2
3
|
/**
|
|
3
4
|
* id for FormFieldHelperText
|
|
@@ -19,5 +20,6 @@ export interface FormFieldContextValue {
|
|
|
19
20
|
necessity: NecessityType | undefined;
|
|
20
21
|
readOnly: boolean;
|
|
21
22
|
validationStatus: "error" | "warning" | "success" | undefined;
|
|
23
|
+
formFieldRef?: RefObject<HTMLDivElement>;
|
|
22
24
|
}
|
|
23
25
|
export declare const FormFieldContext: import("react").Context<FormFieldContextValue>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salt-ds/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@floating-ui/react": "^0.26.28",
|
|
17
|
-
"@salt-ds/icons": "^1.
|
|
17
|
+
"@salt-ds/icons": "^1.14.0",
|
|
18
18
|
"@salt-ds/styles": "0.2.1",
|
|
19
19
|
"@salt-ds/window": "0.1.1",
|
|
20
20
|
"clsx": "^2.0.0"
|