@salt-ds/core 1.46.1 → 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 +16 -0
- package/css/salt-core.css +17 -13
- package/dist-cjs/checkbox/CheckboxIcon.css.js +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/pagination/PageButton.css.js +1 -1
- package/dist-es/checkbox/CheckboxIcon.css.js +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/pagination/PageButton.css.js +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,21 @@
|
|
|
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
|
+
|
|
3
19
|
## 1.46.1
|
|
4
20
|
|
|
5
21
|
### Patch 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,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
|
|
@@ -9,6 +9,7 @@ var FormFieldContext = require('../form-field-context/FormFieldContext.js');
|
|
|
9
9
|
var capitalize = require('../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,CAAA;AAE1C,MAAM,SAAY,GAAAC,gBAAA;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,eAAeC,gBAAU,EAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,iBAAA;AAAA,MACR,GAAK,EAAAC,WAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AAED,IAAM,MAAA,YAAA,GAAeC,aAAuB,IAAI,CAAA;AAChD,IAAM,MAAA,SAAA,GAAYC,qBAAW,CAAA,GAAA,EAAK,YAAY,CAAA;AAE9C,IAAM,MAAA,MAAA,GAASC,YAAM,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,uBAAAC,cAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,SAAA;AAAA,QACL,SAAW,EAAAC,SAAA;AAAA,UACT,YAAa,EAAA;AAAA,UACb;AAAA,YACE,CAAC,YAAA,CAAa,UAAU,CAAC,GAAG,QAAA;AAAA,YAC5B,CAAC,aAAa,CAAQ,KAAA,EAAAC,qBAAA,CAAW,cAAc,CAAC,CAAA,CAAE,CAAC,GACjD;AAAA,WACJ;AAAA,UACA;AAAA,SACF;AAAA,QACC,GAAG,SAAA;AAAA,QAEJ,QAAA,kBAAAF,cAAA;AAAA,UAACG,iCAAiB,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,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","capitalize","jsxs","Label","clsx","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,YAAA,GAAeA,0BAAa,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,KAAiBC,mCAAkB,EAAA;AAC3E,EAAA,MAAM,eAAeC,gBAAU,EAAA;AAC/B,EAAyBC,+BAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,uBAAA;AAAA,IACR,GAAK,EAAAC,gBAAA;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,EAAAC,qBAAA,CAAW,SAAS,CAAC,CAC5B,CAAA,CAAA,GAAA,MAAA;AAEJ,EACE,uBAAAC,eAAA;AAAA,IAACC,WAAA;AAAA,IAAA;AAAA,MACC,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,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
|
|
@@ -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
|
|
@@ -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,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
|
|
@@ -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"
|