@salt-ds/core 1.8.0-rc.0 → 1.8.0-rc.2
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/dist-cjs/card/Card.css.js +1 -1
- package/dist-cjs/checkbox/Checkbox.css.js +1 -1
- package/dist-cjs/checkbox/Checkbox.js +35 -10
- package/dist-cjs/checkbox/Checkbox.js.map +1 -1
- package/dist-cjs/checkbox/CheckboxGroup.css.js +1 -1
- package/dist-cjs/checkbox/CheckboxGroup.js +21 -3
- package/dist-cjs/checkbox/CheckboxGroup.js.map +1 -1
- package/dist-cjs/checkbox/CheckboxIcon.css.js +1 -1
- package/dist-cjs/checkbox/CheckboxIcon.js +7 -5
- package/dist-cjs/checkbox/CheckboxIcon.js.map +1 -1
- package/dist-cjs/checkbox/internal/CheckboxGroupContext.js.map +1 -1
- package/dist-cjs/form-field/FormField.css.js +1 -1
- package/dist-cjs/form-field/FormField.js +4 -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/FormFieldLabel.css.js +1 -1
- package/dist-cjs/form-field/FormFieldLabel.js +11 -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/index.js +0 -2
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/input/Input.css.js +1 -1
- package/dist-cjs/input/Input.js +22 -6
- package/dist-cjs/input/Input.js.map +1 -1
- package/dist-cjs/radio-button/RadioButton.css.js +1 -1
- package/dist-cjs/radio-button/RadioButton.js +36 -8
- package/dist-cjs/radio-button/RadioButton.js.map +1 -1
- package/dist-cjs/radio-button/RadioButtonGroup.css.js +1 -1
- package/dist-cjs/radio-button/RadioButtonGroup.js +19 -1
- package/dist-cjs/radio-button/RadioButtonGroup.js.map +1 -1
- package/dist-cjs/radio-button/RadioButtonIcon.css.js +1 -1
- package/dist-cjs/radio-button/RadioButtonIcon.js +5 -3
- package/dist-cjs/radio-button/RadioButtonIcon.js.map +1 -1
- package/dist-cjs/radio-button/internal/RadioGroupContext.js.map +1 -1
- package/dist-cjs/status-adornment/StatusAdornment.css.js +1 -1
- package/dist-cjs/status-adornment/StatusAdornment.js.map +1 -1
- package/dist-cjs/tooltip/Tooltip.js +12 -2
- package/dist-cjs/tooltip/Tooltip.js.map +1 -1
- package/dist-cjs/utils/useResponsiveProp.js +7 -5
- package/dist-cjs/utils/useResponsiveProp.js.map +1 -1
- package/dist-es/card/Card.css.js +1 -1
- package/dist-es/checkbox/Checkbox.css.js +1 -1
- package/dist-es/checkbox/Checkbox.js +35 -10
- package/dist-es/checkbox/Checkbox.js.map +1 -1
- package/dist-es/checkbox/CheckboxGroup.css.js +1 -1
- package/dist-es/checkbox/CheckboxGroup.js +21 -3
- package/dist-es/checkbox/CheckboxGroup.js.map +1 -1
- package/dist-es/checkbox/CheckboxIcon.css.js +1 -1
- package/dist-es/checkbox/CheckboxIcon.js +7 -5
- package/dist-es/checkbox/CheckboxIcon.js.map +1 -1
- package/dist-es/checkbox/internal/CheckboxGroupContext.js.map +1 -1
- package/dist-es/form-field/FormField.css.js +1 -1
- package/dist-es/form-field/FormField.js +4 -2
- 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/FormFieldLabel.css.js +1 -1
- package/dist-es/form-field/FormFieldLabel.js +12 -4
- package/dist-es/form-field/FormFieldLabel.js.map +1 -1
- package/dist-es/form-field-context/FormFieldContext.js.map +1 -1
- package/dist-es/index.js +0 -1
- package/dist-es/index.js.map +1 -1
- package/dist-es/input/Input.css.js +1 -1
- package/dist-es/input/Input.js +22 -6
- package/dist-es/input/Input.js.map +1 -1
- package/dist-es/radio-button/RadioButton.css.js +1 -1
- package/dist-es/radio-button/RadioButton.js +36 -8
- package/dist-es/radio-button/RadioButton.js.map +1 -1
- package/dist-es/radio-button/RadioButtonGroup.css.js +1 -1
- package/dist-es/radio-button/RadioButtonGroup.js +19 -1
- package/dist-es/radio-button/RadioButtonGroup.js.map +1 -1
- package/dist-es/radio-button/RadioButtonIcon.css.js +1 -1
- package/dist-es/radio-button/RadioButtonIcon.js +5 -3
- package/dist-es/radio-button/RadioButtonIcon.js.map +1 -1
- package/dist-es/radio-button/internal/RadioGroupContext.js.map +1 -1
- package/dist-es/status-adornment/StatusAdornment.css.js +1 -1
- package/dist-es/status-adornment/StatusAdornment.js.map +1 -1
- package/dist-es/tooltip/Tooltip.js +12 -2
- package/dist-es/tooltip/Tooltip.js.map +1 -1
- package/dist-es/utils/useResponsiveProp.js +7 -5
- package/dist-es/utils/useResponsiveProp.js.map +1 -1
- package/dist-types/checkbox/Checkbox.d.ts +9 -0
- package/dist-types/checkbox/CheckboxGroup.d.ts +9 -0
- package/dist-types/checkbox/CheckboxIcon.d.ts +3 -1
- package/dist-types/checkbox/internal/CheckboxGroupContext.d.ts +5 -0
- package/dist-types/form-field/FormField.d.ts +5 -1
- package/dist-types/form-field/index.d.ts +0 -1
- package/dist-types/form-field-context/FormFieldContext.d.ts +3 -0
- package/dist-types/input/Input.d.ts +10 -2
- package/dist-types/radio-button/RadioButton.d.ts +9 -0
- package/dist-types/radio-button/RadioButtonGroup.d.ts +8 -0
- package/dist-types/radio-button/RadioButtonIcon.d.ts +3 -1
- package/dist-types/radio-button/internal/RadioGroupContext.d.ts +5 -0
- package/dist-types/status-adornment/StatusAdornment.d.ts +1 -2
- package/package.json +3 -2
- package/dist-cjs/form-field/FormFieldControlWrapper.css.js +0 -6
- package/dist-cjs/form-field/FormFieldControlWrapper.css.js.map +0 -1
- package/dist-cjs/form-field/FormFieldControlWrapper.js +0 -32
- package/dist-cjs/form-field/FormFieldControlWrapper.js.map +0 -1
- package/dist-es/form-field/FormFieldControlWrapper.css.js +0 -4
- package/dist-es/form-field/FormFieldControlWrapper.css.js.map +0 -1
- package/dist-es/form-field/FormFieldControlWrapper.js +0 -28
- package/dist-es/form-field/FormFieldControlWrapper.js.map +0 -1
- package/dist-types/form-field/FormFieldControlWrapper.d.ts +0 -2
|
@@ -14,6 +14,8 @@ import '../viewport/ViewportProvider.js';
|
|
|
14
14
|
import { mergeProps } from '../utils/mergeProps.js';
|
|
15
15
|
import { useTooltip } from './useTooltip.js';
|
|
16
16
|
import css_248z from './Tooltip.css.js';
|
|
17
|
+
import '../form-field-context/FormFieldContext.js';
|
|
18
|
+
import { useFormFieldProps } from '../form-field-context/useFormFieldProps.js';
|
|
17
19
|
|
|
18
20
|
const withBaseName = makePrefixer("saltTooltip");
|
|
19
21
|
const Tooltip = forwardRef(
|
|
@@ -21,17 +23,24 @@ const Tooltip = forwardRef(
|
|
|
21
23
|
const {
|
|
22
24
|
children,
|
|
23
25
|
className,
|
|
24
|
-
disabled,
|
|
26
|
+
disabled: disabledProp,
|
|
25
27
|
hideArrow = false,
|
|
26
28
|
hideIcon = false,
|
|
27
29
|
open: openProp,
|
|
28
30
|
content,
|
|
29
|
-
status = "info",
|
|
31
|
+
status: statusProp = "info",
|
|
30
32
|
placement = "right",
|
|
31
33
|
enterDelay = 300,
|
|
32
34
|
leaveDelay = 0,
|
|
33
35
|
...rest
|
|
34
36
|
} = props;
|
|
37
|
+
const {
|
|
38
|
+
a11yProps,
|
|
39
|
+
disabled: formFieldDisabled,
|
|
40
|
+
validationStatus: formFieldValidationStatus
|
|
41
|
+
} = useFormFieldProps();
|
|
42
|
+
const disabled = formFieldDisabled != null ? formFieldDisabled : disabledProp;
|
|
43
|
+
const status = formFieldValidationStatus != null ? formFieldValidationStatus : statusProp;
|
|
35
44
|
const targetWindow = useWindow();
|
|
36
45
|
useComponentCssInjection({
|
|
37
46
|
testId: "salt-tooltip",
|
|
@@ -84,6 +93,7 @@ const Tooltip = forwardRef(
|
|
|
84
93
|
className: withBaseName("icon")
|
|
85
94
|
}),
|
|
86
95
|
/* @__PURE__ */ jsx("span", {
|
|
96
|
+
id: a11yProps == null ? void 0 : a11yProps["aria-describedby"],
|
|
87
97
|
className: withBaseName("content"),
|
|
88
98
|
children: content
|
|
89
99
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../src/tooltip/Tooltip.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n cloneElement,\n forwardRef,\n HTMLAttributes,\n isValidElement,\n ReactNode,\n Ref,\n} from \"react\";\nimport { FloatingArrow, FloatingPortal } from \"@floating-ui/react\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport { StatusIndicator, ValidationStatus } from \"../status-indicator\";\nimport {\n makePrefixer,\n mergeProps,\n UseFloatingUIProps,\n useForkRef,\n} from \"../utils\";\nimport { SaltProvider } from \"../salt-provider\";\n\nimport { useTooltip, UseTooltipProps } from \"./useTooltip\";\nimport tooltipCss from \"./Tooltip.css\";\n\nconst withBaseName = makePrefixer(\"saltTooltip\");\n\nexport interface TooltipProps\n extends Pick<UseFloatingUIProps, \"open\" | \"onOpenChange\" | \"placement\">,\n Omit<HTMLAttributes<HTMLDivElement>, \"content\"> {\n /**\n * The children will be the Tooltip's trigger.\n */\n children: ReactNode;\n /**\n * Whether to hide the Tooltip arrow. Defaults to `false`.\n */\n hideArrow?: boolean;\n /**\n * Whether to hide the status icon within the Tooltip. Defaults to `false`.\n */\n hideIcon?: boolean;\n /**\n * Content displayed inside the Tooltip. Can be a string or a React component.\n */\n content: ReactNode;\n /**\n * A string to determine the status of the Tooltip. Defaults to `info`.\n */\n status?: ValidationStatus;\n /**\n * Delay in milliseconds before the Tooltip is shown.\n */\n enterDelay?: number;\n /**\n * Delay in milliseconds before the Tooltip is hidden.\n */\n leaveDelay?: number;\n /**\n * Option to not display the Tooltip. Can be used in conditional situations like text truncation.\n */\n disabled?: boolean;\n /**\n * Option to remove the hover listener.\n */\n disableHoverListener?: boolean;\n /**\n * Option to remove the focus listener.\n */\n disableFocusListener?: boolean;\n}\n\nexport const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(\n function Tooltip(props, ref) {\n const {\n children,\n className,\n disabled,\n hideArrow = false,\n hideIcon = false,\n open: openProp,\n content,\n status = \"info\",\n placement = \"right\",\n enterDelay = 300,\n leaveDelay = 0,\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-tooltip\",\n css: tooltipCss,\n window: targetWindow,\n });\n\n const hookProps: UseTooltipProps = {\n open: openProp,\n placement,\n enterDelay,\n leaveDelay,\n ...rest,\n };\n\n const {\n arrowProps,\n open,\n floating,\n reference,\n getTriggerProps,\n getTooltipProps,\n } = useTooltip(hookProps);\n\n const triggerRef = useForkRef(\n // @ts-ignore\n isValidElement(children) ? children.ref : null,\n reference\n );\n\n const floatingRef = useForkRef(floating, ref) as Ref<HTMLDivElement>;\n\n return (\n <>\n {isValidElement(children) &&\n cloneElement(children, {\n ...mergeProps(getTriggerProps(), children.props),\n ref: triggerRef,\n })}\n\n {open && !disabled && (\n <FloatingPortal>\n {/* The provider is needed to support the use case where an app has nested modes. The element that is portalled needs to have the same style as the current scope */}\n <SaltProvider>\n <div\n className={clsx(\n withBaseName(),\n withBaseName(status),\n className\n )}\n ref={floatingRef}\n {...getTooltipProps()}\n >\n <div className={withBaseName(\"container\")}>\n {!hideIcon && (\n <StatusIndicator\n status={status}\n size={1}\n className={withBaseName(\"icon\")}\n />\n )}\n <span
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../src/tooltip/Tooltip.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n cloneElement,\n forwardRef,\n HTMLAttributes,\n isValidElement,\n ReactNode,\n Ref,\n} from \"react\";\nimport { FloatingArrow, FloatingPortal } from \"@floating-ui/react\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport { StatusIndicator, ValidationStatus } from \"../status-indicator\";\nimport {\n makePrefixer,\n mergeProps,\n UseFloatingUIProps,\n useForkRef,\n} from \"../utils\";\nimport { SaltProvider } from \"../salt-provider\";\n\nimport { useTooltip, UseTooltipProps } from \"./useTooltip\";\nimport tooltipCss from \"./Tooltip.css\";\nimport { useFormFieldProps } from \"../form-field-context\";\n\nconst withBaseName = makePrefixer(\"saltTooltip\");\n\nexport interface TooltipProps\n extends Pick<UseFloatingUIProps, \"open\" | \"onOpenChange\" | \"placement\">,\n Omit<HTMLAttributes<HTMLDivElement>, \"content\"> {\n /**\n * The children will be the Tooltip's trigger.\n */\n children: ReactNode;\n /**\n * Whether to hide the Tooltip arrow. Defaults to `false`.\n */\n hideArrow?: boolean;\n /**\n * Whether to hide the status icon within the Tooltip. Defaults to `false`.\n */\n hideIcon?: boolean;\n /**\n * Content displayed inside the Tooltip. Can be a string or a React component.\n */\n content: ReactNode;\n /**\n * A string to determine the status of the Tooltip. Defaults to `info`.\n */\n status?: ValidationStatus;\n /**\n * Delay in milliseconds before the Tooltip is shown.\n */\n enterDelay?: number;\n /**\n * Delay in milliseconds before the Tooltip is hidden.\n */\n leaveDelay?: number;\n /**\n * Option to not display the Tooltip. Can be used in conditional situations like text truncation.\n */\n disabled?: boolean;\n /**\n * Option to remove the hover listener.\n */\n disableHoverListener?: boolean;\n /**\n * Option to remove the focus listener.\n */\n disableFocusListener?: boolean;\n}\n\nexport const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(\n function Tooltip(props, ref) {\n const {\n children,\n className,\n disabled: disabledProp,\n hideArrow = false,\n hideIcon = false,\n open: openProp,\n content,\n status: statusProp = \"info\",\n placement = \"right\",\n enterDelay = 300,\n leaveDelay = 0,\n ...rest\n } = props;\n\n const {\n a11yProps,\n disabled: formFieldDisabled,\n validationStatus: formFieldValidationStatus,\n } = useFormFieldProps();\n\n const disabled = formFieldDisabled ?? disabledProp;\n const status = formFieldValidationStatus ?? statusProp;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-tooltip\",\n css: tooltipCss,\n window: targetWindow,\n });\n\n const hookProps: UseTooltipProps = {\n open: openProp,\n placement,\n enterDelay,\n leaveDelay,\n ...rest,\n };\n\n const {\n arrowProps,\n open,\n floating,\n reference,\n getTriggerProps,\n getTooltipProps,\n } = useTooltip(hookProps);\n\n const triggerRef = useForkRef(\n // @ts-ignore\n isValidElement(children) ? children.ref : null,\n reference\n );\n\n const floatingRef = useForkRef(floating, ref) as Ref<HTMLDivElement>;\n\n return (\n <>\n {isValidElement(children) &&\n cloneElement(children, {\n ...mergeProps(getTriggerProps(), children.props),\n ref: triggerRef,\n })}\n\n {open && !disabled && (\n <FloatingPortal>\n {/* The provider is needed to support the use case where an app has nested modes. The element that is portalled needs to have the same style as the current scope */}\n <SaltProvider>\n <div\n className={clsx(\n withBaseName(),\n withBaseName(status),\n className\n )}\n ref={floatingRef}\n {...getTooltipProps()}\n >\n <div className={withBaseName(\"container\")}>\n {!hideIcon && (\n <StatusIndicator\n status={status}\n size={1}\n className={withBaseName(\"icon\")}\n />\n )}\n <span\n id={a11yProps?.[\"aria-describedby\"]}\n className={withBaseName(\"content\")}\n >\n {content}\n </span>\n </div>\n {!hideArrow && (\n <FloatingArrow\n {...arrowProps}\n className={withBaseName(\"arrow\")}\n strokeWidth={1}\n fill=\"var(--salt-container-primary-background)\"\n stroke=\"var(--tooltip-status-borderColor)\"\n height={5}\n width={10}\n />\n )}\n </div>\n </SaltProvider>\n </FloatingPortal>\n )}\n </>\n );\n }\n);\n"],"names":["Tooltip","tooltipCss"],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA,MAAM,YAAA,GAAe,aAAa,aAAa,CAAA,CAAA;AA+CxC,MAAM,OAAU,GAAA,UAAA;AAAA,EACrB,SAASA,QAAQ,CAAA,KAAA,EAAO,GAAK,EAAA;AAC3B,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAU,EAAA,YAAA;AAAA,MACV,SAAY,GAAA,KAAA;AAAA,MACZ,QAAW,GAAA,KAAA;AAAA,MACX,IAAM,EAAA,Q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,CAAA;AAAA,kBACb,IAAK,EAAA,0CAAA;AAAA,kBACL,MAAO,EAAA,mCAAA;AAAA,kBACP,MAAQ,EAAA,CAAA;AAAA,kBACR,KAAO,EAAA,EAAA;AAAA,iBACT,CAAA;AAAA,eAAA;AAAA,aAEJ,CAAA;AAAA,WACF,CAAA;AAAA,SACF,CAAA;AAAA,OAAA;AAAA,KAEJ,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -2,7 +2,9 @@ import { useBreakpoints } from '../salt-provider/SaltProvider.js';
|
|
|
2
2
|
import { useViewport } from '../viewport/ViewportProvider.js';
|
|
3
3
|
|
|
4
4
|
const getCurrentBreakpoint = (breakpoints, width) => {
|
|
5
|
-
const breakpointList = Object.entries(breakpoints)
|
|
5
|
+
const breakpointList = Object.entries(breakpoints).sort(
|
|
6
|
+
([, a], [, b]) => a - b
|
|
7
|
+
);
|
|
6
8
|
const [currentBreakpoint] = breakpointList.reduce((acc, val) => {
|
|
7
9
|
const [, accWidth] = acc;
|
|
8
10
|
const [breakpoint, breakpointWidth] = val;
|
|
@@ -20,8 +22,7 @@ const useCurrentBreakpoint = () => {
|
|
|
20
22
|
};
|
|
21
23
|
const useOrderedBreakpoints = () => {
|
|
22
24
|
const breakpoints = useBreakpoints();
|
|
23
|
-
|
|
24
|
-
return orderedBreakpoints;
|
|
25
|
+
return Object.entries(breakpoints).sort(([, a], [, b]) => a - b).map(([key]) => key);
|
|
25
26
|
};
|
|
26
27
|
const isObject = (value) => {
|
|
27
28
|
const type = typeof value;
|
|
@@ -31,7 +32,7 @@ const hasBreakpointValues = (value, breakpoints) => {
|
|
|
31
32
|
return isObject(value) && Object.keys(value).every((key) => key in breakpoints);
|
|
32
33
|
};
|
|
33
34
|
const getResponsiveValue = (breakpointValues, breakpoints, viewport, defaultValue) => {
|
|
34
|
-
|
|
35
|
+
return Object.entries(breakpointValues).reduce(
|
|
35
36
|
(acc, val) => {
|
|
36
37
|
const [accWidth] = acc;
|
|
37
38
|
const [breakpoint, breakpointValue] = val;
|
|
@@ -43,11 +44,12 @@ const getResponsiveValue = (breakpointValues, breakpoints, viewport, defaultValu
|
|
|
43
44
|
},
|
|
44
45
|
[0, defaultValue]
|
|
45
46
|
)[1];
|
|
46
|
-
return value;
|
|
47
47
|
};
|
|
48
48
|
const useResponsiveProp = (value, defaultValue) => {
|
|
49
49
|
const breakpoints = useBreakpoints();
|
|
50
50
|
const viewport = useViewport();
|
|
51
|
+
if (value === defaultValue)
|
|
52
|
+
return defaultValue;
|
|
51
53
|
const currentViewport = getCurrentBreakpoint(breakpoints, viewport);
|
|
52
54
|
if (hasBreakpointValues(value, breakpoints)) {
|
|
53
55
|
return getResponsiveValue(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResponsiveProp.js","sources":["../src/utils/useResponsiveProp.ts"],"sourcesContent":["import { Breakpoints } from \"../breakpoints\";\nimport { useBreakpoints } from \"../salt-provider\";\nimport { useViewport } from \"../viewport\";\n\ntype BreakpointProp<T> = {\n [K in keyof Breakpoints]?: T;\n};\n\nexport type ResponsiveProp<T> = T | BreakpointProp<T>;\n\nexport const getCurrentBreakpoint = (\n breakpoints: Breakpoints,\n width: number\n) => {\n const breakpointList = Object.entries(breakpoints)
|
|
1
|
+
{"version":3,"file":"useResponsiveProp.js","sources":["../src/utils/useResponsiveProp.ts"],"sourcesContent":["import { Breakpoints } from \"../breakpoints\";\nimport { useBreakpoints } from \"../salt-provider\";\nimport { useViewport } from \"../viewport\";\n\ntype BreakpointProp<T> = {\n [K in keyof Breakpoints]?: T;\n};\n\nexport type ResponsiveProp<T> = T | BreakpointProp<T>;\n\nexport const getCurrentBreakpoint = (\n breakpoints: Breakpoints,\n width: number\n) => {\n const breakpointList = Object.entries(breakpoints).sort(\n ([, a], [, b]) => a - b\n );\n const [currentBreakpoint] = (\n breakpointList as [keyof Breakpoints, number][]\n ).reduce((acc, val) => {\n const [, accWidth] = acc;\n const [breakpoint, breakpointWidth] = val;\n if (breakpointWidth < width && breakpointWidth > accWidth) {\n return [breakpoint, breakpointWidth];\n }\n return [...acc];\n }, breakpointList[0] as [keyof Breakpoints, number]);\n\n return currentBreakpoint;\n};\n\nexport const useCurrentBreakpoint = () => {\n const viewport = useViewport();\n\n const breakpoints = useBreakpoints();\n\n return getCurrentBreakpoint(breakpoints, viewport);\n};\n\nexport const useOrderedBreakpoints = () => {\n const breakpoints = useBreakpoints();\n\n return Object.entries(breakpoints)\n .sort(([, a], [, b]) => a - b)\n .map(([key]) => key);\n};\n\nconst isObject = <T>(\n value: T\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): value is Record<string | number | symbol, any> => {\n const type = typeof value;\n return value !== null && (type === \"object\" || type === \"function\");\n};\n\nconst hasBreakpointValues = <T>(\n value: ResponsiveProp<T>,\n breakpoints: Breakpoints\n): value is BreakpointProp<T> => {\n return (\n isObject(value) && Object.keys(value).every((key) => key in breakpoints)\n );\n};\n\nconst getResponsiveValue = <T>(\n breakpointValues: BreakpointProp<T>,\n breakpoints: Breakpoints,\n viewport: keyof Breakpoints,\n defaultValue: T\n) => {\n return Object.entries(breakpointValues).reduce<[number, T]>(\n (acc, val) => {\n const [accWidth] = acc;\n const [breakpoint, breakpointValue] = val;\n\n const breakpointWidth =\n breakpoints[breakpoint as keyof typeof breakpoints];\n\n if (\n breakpointWidth >= accWidth &&\n breakpointWidth <= breakpoints[viewport]\n ) {\n return [breakpointWidth, breakpointValue];\n }\n\n return acc;\n },\n [0, defaultValue]\n )[1];\n};\n\nexport const useResponsiveProp = <T>(\n value: ResponsiveProp<T>,\n defaultValue: T\n) => {\n const breakpoints = useBreakpoints();\n const viewport = useViewport();\n // return early if the values are the same\n if (value === defaultValue) return defaultValue;\n\n const currentViewport = getCurrentBreakpoint(breakpoints, viewport);\n if (hasBreakpointValues(value, breakpoints)) {\n return getResponsiveValue(\n value,\n breakpoints,\n currentViewport,\n defaultValue\n );\n }\n return value;\n};\n"],"names":[],"mappings":";;;AAUa,MAAA,oBA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,WAAA,EAAa,QAAQ,CAAA,CAAA;AAClE,EAAI,IAAA,mBAAA,CAAoB,KAAO,EAAA,WAAW,CAAG,EAAA;AAC3C,IAAO,OAAA,kBAAA;AAAA,MACL,KAAA;AAAA,MACA,WAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,KACF,CAAA;AAAA,GACF;AACA,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChangeEventHandler, FocusEventHandler, InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { AdornmentValidationStatus } from "../status-adornment";
|
|
2
3
|
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLLabelElement>, "onChange" | "onBlur" | "onFocus"> {
|
|
3
4
|
/**
|
|
4
5
|
* If `true`, the checkbox will be checked.
|
|
@@ -14,6 +15,7 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLLabelElement
|
|
|
14
15
|
*/
|
|
15
16
|
disabled?: boolean;
|
|
16
17
|
/**
|
|
18
|
+
* **Deprecated**: Use validationStatus instead
|
|
17
19
|
* If `true`, the checkbox will be in the error state.
|
|
18
20
|
*/
|
|
19
21
|
error?: boolean;
|
|
@@ -51,5 +53,12 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLLabelElement
|
|
|
51
53
|
* The value of the checkbox.
|
|
52
54
|
*/
|
|
53
55
|
value?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Validation status, one of "warning" | "error" | "success"
|
|
58
|
+
*
|
|
59
|
+
* Checkbox has styling variants for "error" and "warning".
|
|
60
|
+
* No visual styling will be applied on "success" variant.
|
|
61
|
+
*/
|
|
62
|
+
validationStatus?: AdornmentValidationStatus;
|
|
54
63
|
}
|
|
55
64
|
export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChangeEventHandler, ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { AdornmentValidationStatus } from "../status-adornment";
|
|
2
3
|
export interface CheckboxGroupProps extends Omit<ComponentPropsWithoutRef<"fieldset">, "onChange"> {
|
|
3
4
|
/**
|
|
4
5
|
* The current checked options.
|
|
@@ -12,6 +13,10 @@ export interface CheckboxGroupProps extends Omit<ComponentPropsWithoutRef<"field
|
|
|
12
13
|
* Display group of elements in a compact row.
|
|
13
14
|
*/
|
|
14
15
|
direction?: "horizontal" | "vertical";
|
|
16
|
+
/**
|
|
17
|
+
* Disable the Checkbox group
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
15
20
|
/**
|
|
16
21
|
* The name used to reference the value of the control.
|
|
17
22
|
*/
|
|
@@ -25,5 +30,9 @@ export interface CheckboxGroupProps extends Omit<ComponentPropsWithoutRef<"field
|
|
|
25
30
|
* Only for horizontal direction. When `true` the text in radio button label will wrap to fit within the container. Otherwise, the checkboxes will wrap onto the next line.
|
|
26
31
|
*/
|
|
27
32
|
wrap?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Validation status.
|
|
35
|
+
*/
|
|
36
|
+
validationStatus?: AdornmentValidationStatus;
|
|
28
37
|
}
|
|
29
38
|
export declare const CheckboxGroup: import("react").ForwardRefExoticComponent<CheckboxGroupProps & import("react").RefAttributes<HTMLFieldSetElement>>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { AdornmentValidationStatus } from "../status-adornment";
|
|
2
3
|
export interface CheckboxIconProps {
|
|
3
4
|
checked?: boolean;
|
|
4
5
|
className?: string;
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
error?: boolean;
|
|
7
8
|
indeterminate?: boolean;
|
|
9
|
+
validationStatus?: AdornmentValidationStatus;
|
|
8
10
|
}
|
|
9
|
-
export declare const CheckboxIcon: ({ checked, className: classNameProp, disabled, error, indeterminate, }: CheckboxIconProps) => JSX.Element;
|
|
11
|
+
export declare const CheckboxIcon: ({ checked, className: classNameProp, disabled, error, indeterminate, validationStatus, }: CheckboxIconProps) => JSX.Element;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { a11yValueAriaProps } from "../../form-field-context";
|
|
3
|
+
import { AdornmentValidationStatus } from "../../status-adornment";
|
|
2
4
|
import { CheckboxGroupProps } from "../CheckboxGroup";
|
|
3
5
|
export interface CheckboxGroupState {
|
|
6
|
+
a11yProps?: a11yValueAriaProps;
|
|
7
|
+
disabled?: boolean;
|
|
4
8
|
name?: CheckboxGroupProps["name"];
|
|
5
9
|
onChange?: CheckboxGroupProps["onChange"];
|
|
6
10
|
checkedValues?: CheckboxGroupProps["checkedValues"];
|
|
11
|
+
validationStatus?: AdornmentValidationStatus;
|
|
7
12
|
}
|
|
8
13
|
declare const CheckboxGroupContext: import("react").Context<CheckboxGroupState>;
|
|
9
14
|
export { CheckboxGroupContext };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
import { A11yValueProps } from "../form-field-context";
|
|
3
|
-
export declare type FormFieldLabelPlacement = "top" | "left";
|
|
3
|
+
export declare type FormFieldLabelPlacement = "top" | "left" | "right";
|
|
4
4
|
export interface FormFieldProps extends HTMLAttributes<HTMLDivElement>, A11yValueProps {
|
|
5
5
|
/**
|
|
6
6
|
* Disabled prop
|
|
@@ -21,6 +21,10 @@ export interface FormFieldProps extends HTMLAttributes<HTMLDivElement>, A11yValu
|
|
|
21
21
|
* Used as suffix of FormFieldHelperText id: `helperText-{id}`
|
|
22
22
|
*/
|
|
23
23
|
id?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Displays necessity on label
|
|
26
|
+
*/
|
|
27
|
+
necessity?: "required" | "optional" | "asterisk";
|
|
24
28
|
/**
|
|
25
29
|
* Validation status
|
|
26
30
|
*/
|
|
@@ -9,6 +9,7 @@ export interface A11yValueProps {
|
|
|
9
9
|
*/
|
|
10
10
|
labelId?: string;
|
|
11
11
|
}
|
|
12
|
+
declare type NecessityType = "required" | "optional" | "asterisk";
|
|
12
13
|
export interface a11yValueAriaProps {
|
|
13
14
|
"aria-labelledby": A11yValueProps["labelId"];
|
|
14
15
|
"aria-describedby": A11yValueProps["helperTextId"] | undefined;
|
|
@@ -16,7 +17,9 @@ export interface a11yValueAriaProps {
|
|
|
16
17
|
export interface FormFieldContextValue {
|
|
17
18
|
a11yProps: a11yValueAriaProps;
|
|
18
19
|
disabled: boolean;
|
|
20
|
+
necessity: NecessityType | undefined;
|
|
19
21
|
readOnly: boolean;
|
|
20
22
|
validationStatus: "error" | "warning" | "success" | undefined;
|
|
21
23
|
}
|
|
22
24
|
export declare const FormFieldContext: import("react").Context<FormFieldContextValue>;
|
|
25
|
+
export {};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, InputHTMLAttributes, Ref } from "react";
|
|
2
|
-
export interface InputProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue">, Pick<ComponentPropsWithoutRef<"input">, "disabled" | "value" | "defaultValue"> {
|
|
1
|
+
import { ComponentPropsWithoutRef, InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
export interface InputProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue">, Pick<ComponentPropsWithoutRef<"input">, "disabled" | "value" | "defaultValue" | "placeholder"> {
|
|
3
3
|
/**
|
|
4
4
|
* The marker to use in an empty read only Input.
|
|
5
5
|
* Use `''` to disable this feature. Defaults to '—'.
|
|
6
6
|
*/
|
|
7
7
|
emptyReadOnlyMarker?: string;
|
|
8
|
+
/**
|
|
9
|
+
* End adornment component
|
|
10
|
+
*/
|
|
11
|
+
endAdornment?: ReactNode;
|
|
8
12
|
/**
|
|
9
13
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
10
14
|
*/
|
|
@@ -17,6 +21,10 @@ export interface InputProps extends Omit<ComponentPropsWithoutRef<"div">, "defau
|
|
|
17
21
|
* If `true`, the component is read only.
|
|
18
22
|
*/
|
|
19
23
|
readOnly?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Start adornment component
|
|
26
|
+
*/
|
|
27
|
+
startAdornment?: ReactNode;
|
|
20
28
|
/**
|
|
21
29
|
* Alignment of text within container. Defaults to "left"
|
|
22
30
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChangeEventHandler, FocusEventHandler, HTMLAttributes, InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { AdornmentValidationStatus } from "../status-adornment";
|
|
2
3
|
export interface RadioButtonProps extends Omit<HTMLAttributes<HTMLLabelElement>, "onChange" | "onBlur" | "onFocus"> {
|
|
3
4
|
/**
|
|
4
5
|
* Set the default selected radio button in the group
|
|
@@ -9,6 +10,7 @@ export interface RadioButtonProps extends Omit<HTMLAttributes<HTMLLabelElement>,
|
|
|
9
10
|
*/
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
/**
|
|
13
|
+
* **Deprecated**: Use validationStatus instead
|
|
12
14
|
* Set the error state
|
|
13
15
|
*/
|
|
14
16
|
error?: boolean;
|
|
@@ -40,5 +42,12 @@ export interface RadioButtonProps extends Omit<HTMLAttributes<HTMLLabelElement>,
|
|
|
40
42
|
* Value of radio button
|
|
41
43
|
*/
|
|
42
44
|
value?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Validation status, one of "warning" | "error" | "success"
|
|
47
|
+
*
|
|
48
|
+
* RadioButton has styling variants for "error" and "warning".
|
|
49
|
+
* No visual styling will be applied on "success" variant.
|
|
50
|
+
*/
|
|
51
|
+
validationStatus?: AdornmentValidationStatus;
|
|
43
52
|
}
|
|
44
53
|
export declare const RadioButton: import("react").ForwardRefExoticComponent<RadioButtonProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
@@ -8,6 +8,10 @@ export interface RadioButtonGroupProps extends Omit<ComponentPropsWithoutRef<"fi
|
|
|
8
8
|
* Set the group direction.
|
|
9
9
|
*/
|
|
10
10
|
direction?: "horizontal" | "vertical";
|
|
11
|
+
/**
|
|
12
|
+
* Disable the RadioButton group
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
11
15
|
/**
|
|
12
16
|
* Only for horizontal direction. When `true` the text in radio button label will wrap to fit within the container. Otherwise the radio buttons will wrap onto the next line.
|
|
13
17
|
*/
|
|
@@ -24,5 +28,9 @@ export interface RadioButtonGroupProps extends Omit<ComponentPropsWithoutRef<"fi
|
|
|
24
28
|
* The value of the radio group, required for a controlled component.
|
|
25
29
|
*/
|
|
26
30
|
value?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Validation status.
|
|
33
|
+
*/
|
|
34
|
+
validationStatus?: "error" | "warning";
|
|
27
35
|
}
|
|
28
36
|
export declare const RadioButtonGroup: import("react").ForwardRefExoticComponent<RadioButtonGroupProps & import("react").RefAttributes<HTMLFieldSetElement>>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { AdornmentValidationStatus } from "../status-adornment";
|
|
2
3
|
export interface RadioButtonIconProps {
|
|
3
4
|
checked?: boolean;
|
|
4
5
|
error?: boolean;
|
|
5
6
|
disabled?: boolean;
|
|
7
|
+
validationStatus?: AdornmentValidationStatus;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* Default radio icon
|
|
9
11
|
*/
|
|
10
|
-
export declare const RadioButtonIcon: ({ checked, error, disabled, }: RadioButtonIconProps) => JSX.Element;
|
|
12
|
+
export declare const RadioButtonIcon: ({ checked, error, disabled, validationStatus, }: RadioButtonIconProps) => JSX.Element;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ChangeEventHandler } from "react";
|
|
2
|
+
import { a11yValueAriaProps } from "../../form-field-context";
|
|
3
|
+
import { AdornmentValidationStatus } from "../../status-adornment";
|
|
2
4
|
export interface RadioGroupContextValue {
|
|
5
|
+
a11yProps?: a11yValueAriaProps;
|
|
6
|
+
disabled?: boolean;
|
|
3
7
|
name?: string;
|
|
4
8
|
value?: string;
|
|
5
9
|
onChange?: ChangeEventHandler<HTMLElement>;
|
|
10
|
+
validationStatus?: AdornmentValidationStatus;
|
|
6
11
|
}
|
|
7
12
|
export declare const RadioGroupContext: import("react").Context<RadioGroupContextValue>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconProps } from "@salt-ds/icons";
|
|
3
3
|
import { ValidationStatus } from "../status-indicator";
|
|
4
|
-
declare type AdornmentValidationStatus = Exclude<ValidationStatus, "info">;
|
|
4
|
+
export declare type AdornmentValidationStatus = Exclude<ValidationStatus, "info">;
|
|
5
5
|
export interface StatusAdornmentProps extends IconProps {
|
|
6
6
|
/**
|
|
7
7
|
* Status adornment to be displayed.
|
|
@@ -9,4 +9,3 @@ export interface StatusAdornmentProps extends IconProps {
|
|
|
9
9
|
status: AdornmentValidationStatus;
|
|
10
10
|
}
|
|
11
11
|
export declare const StatusAdornment: import("react").ForwardRefExoticComponent<StatusAdornmentProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
12
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salt-ds/core",
|
|
3
|
-
"version": "1.8.0-rc.
|
|
3
|
+
"version": "1.8.0-rc.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist-cjs/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": {
|
|
18
|
-
"directory": "../../dist/salt-ds-core"
|
|
18
|
+
"directory": "../../dist/salt-ds-core",
|
|
19
|
+
"provenance": true
|
|
19
20
|
},
|
|
20
21
|
"module": "dist-es/index.js",
|
|
21
22
|
"typings": "dist-types/index.d.ts",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var css_248z = ".saltFormFieldControlWrapper {\n align-items: center;\n display: grid;\n grid-auto-columns: minmax(min-content, 1fr);\n grid-auto-flow: column;\n grid-column-gap: var(--salt-size-unit);\n}\n";
|
|
4
|
-
|
|
5
|
-
module.exports = css_248z;
|
|
6
|
-
//# sourceMappingURL=FormFieldControlWrapper.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldControlWrapper.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
require('react');
|
|
7
|
-
var makePrefixer = require('../utils/makePrefixer.js');
|
|
8
|
-
require('../utils/useFloatingUI.js');
|
|
9
|
-
require('../utils/useId.js');
|
|
10
|
-
require('../salt-provider/SaltProvider.js');
|
|
11
|
-
require('../viewport/ViewportProvider.js');
|
|
12
|
-
require('clsx');
|
|
13
|
-
var window = require('@salt-ds/window');
|
|
14
|
-
var styles = require('@salt-ds/styles');
|
|
15
|
-
var FormFieldControlWrapper$1 = require('./FormFieldControlWrapper.css.js');
|
|
16
|
-
|
|
17
|
-
const withBaseName = makePrefixer.makePrefixer("saltFormFieldControlWrapper");
|
|
18
|
-
const FormFieldControlWrapper = ({ children }) => {
|
|
19
|
-
const targetWindow = window.useWindow();
|
|
20
|
-
styles.useComponentCssInjection({
|
|
21
|
-
testId: "salt-form-field-control-wrapper",
|
|
22
|
-
css: FormFieldControlWrapper$1,
|
|
23
|
-
window: targetWindow
|
|
24
|
-
});
|
|
25
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
26
|
-
className: withBaseName(),
|
|
27
|
-
children
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
exports.FormFieldControlWrapper = FormFieldControlWrapper;
|
|
32
|
-
//# sourceMappingURL=FormFieldControlWrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldControlWrapper.js","sources":["../src/form-field/FormFieldControlWrapper.tsx"],"sourcesContent":["import { PropsWithChildren } from \"react\";\nimport { makePrefixer } from \"../utils\";\n\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport formFieldControlWrapper from \"./FormFieldControlWrapper.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldControlWrapper\");\n\nexport const FormFieldControlWrapper = ({ children }: PropsWithChildren) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-control-wrapper\",\n css: formFieldControlWrapper,\n window: targetWindow,\n });\n return <div className={withBaseName()}>{children}</div>;\n};\n"],"names":["makePrefixer","useWindow","useComponentCssInjection","formFieldControlWrapper","jsx"],"mappings":";;;;;;;;;;;;;;;;AAQA,MAAM,YAAA,GAAeA,0BAAa,6BAA6B,CAAA,CAAA;AAExD,MAAM,uBAA0B,GAAA,CAAC,EAAE,QAAA,EAAkC,KAAA;AAC1E,EAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,EAAyBC,+BAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,iCAAA;AAAA,IACR,GAAK,EAAAC,yBAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AACD,EAAA,uBAAQC,cAAA,CAAA,KAAA,EAAA;AAAA,IAAI,WAAW,YAAa,EAAA;AAAA,IAAI,QAAA;AAAA,GAAS,CAAA,CAAA;AACnD;;;;"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var css_248z = ".saltFormFieldControlWrapper {\n align-items: center;\n display: grid;\n grid-auto-columns: minmax(min-content, 1fr);\n grid-auto-flow: column;\n grid-column-gap: var(--salt-size-unit);\n}\n";
|
|
2
|
-
|
|
3
|
-
export { css_248z as default };
|
|
4
|
-
//# sourceMappingURL=FormFieldControlWrapper.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldControlWrapper.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
4
|
-
import '../utils/useFloatingUI.js';
|
|
5
|
-
import '../utils/useId.js';
|
|
6
|
-
import '../salt-provider/SaltProvider.js';
|
|
7
|
-
import '../viewport/ViewportProvider.js';
|
|
8
|
-
import 'clsx';
|
|
9
|
-
import { useWindow } from '@salt-ds/window';
|
|
10
|
-
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
11
|
-
import css_248z from './FormFieldControlWrapper.css.js';
|
|
12
|
-
|
|
13
|
-
const withBaseName = makePrefixer("saltFormFieldControlWrapper");
|
|
14
|
-
const FormFieldControlWrapper = ({ children }) => {
|
|
15
|
-
const targetWindow = useWindow();
|
|
16
|
-
useComponentCssInjection({
|
|
17
|
-
testId: "salt-form-field-control-wrapper",
|
|
18
|
-
css: css_248z,
|
|
19
|
-
window: targetWindow
|
|
20
|
-
});
|
|
21
|
-
return /* @__PURE__ */ jsx("div", {
|
|
22
|
-
className: withBaseName(),
|
|
23
|
-
children
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export { FormFieldControlWrapper };
|
|
28
|
-
//# sourceMappingURL=FormFieldControlWrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldControlWrapper.js","sources":["../src/form-field/FormFieldControlWrapper.tsx"],"sourcesContent":["import { PropsWithChildren } from \"react\";\nimport { makePrefixer } from \"../utils\";\n\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport formFieldControlWrapper from \"./FormFieldControlWrapper.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldControlWrapper\");\n\nexport const FormFieldControlWrapper = ({ children }: PropsWithChildren) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-form-field-control-wrapper\",\n css: formFieldControlWrapper,\n window: targetWindow,\n });\n return <div className={withBaseName()}>{children}</div>;\n};\n"],"names":["formFieldControlWrapper"],"mappings":";;;;;;;;;;;;AAQA,MAAM,YAAA,GAAe,aAAa,6BAA6B,CAAA,CAAA;AAExD,MAAM,uBAA0B,GAAA,CAAC,EAAE,QAAA,EAAkC,KAAA;AAC1E,EAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,iCAAA;AAAA,IACR,GAAK,EAAAA,QAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AACD,EAAA,uBAAQ,GAAA,CAAA,KAAA,EAAA;AAAA,IAAI,WAAW,YAAa,EAAA;AAAA,IAAI,QAAA;AAAA,GAAS,CAAA,CAAA;AACnD;;;;"}
|