@astryxdesign/core 0.1.2-canary.deb5aa0 → 0.1.2-canary.df46db7
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/Center/Center.d.ts +11 -1
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +9 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts +23 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +47 -7
- package/dist/CheckboxList/CheckboxList.d.ts +13 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +28 -6
- package/dist/CheckboxList/CheckboxListContext.d.ts +7 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +3 -3
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +5 -5
- package/dist/DateInput/DateInput.d.ts +23 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +42 -6
- package/dist/DateRangeInput/DateRangeInput.d.ts +23 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +33 -5
- package/dist/DateTimeInput/DateTimeInput.d.ts +23 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +59 -9
- package/dist/FileInput/FileInput.d.ts +22 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +29 -4
- package/dist/Grid/Grid.d.ts +11 -1
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +32 -6
- package/dist/InputGroup/InputGroup.d.ts +2 -2
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +10 -4
- package/dist/InputGroup/InputGroupContext.d.ts +4 -0
- package/dist/InputGroup/InputGroupContext.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupContext.js +2 -2
- package/dist/InputGroup/index.d.ts +1 -0
- package/dist/InputGroup/index.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +23 -3
- package/dist/Layout/Layout.d.ts +4 -11
- package/dist/Layout/Layout.d.ts.map +1 -1
- package/dist/Layout/Layout.js +10 -11
- package/dist/Layout/LayoutFooter.d.ts +2 -2
- package/dist/Layout/LayoutFooter.d.ts.map +1 -1
- package/dist/Layout/LayoutHeader.d.ts +2 -2
- package/dist/Layout/LayoutHeader.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.d.ts +2 -2
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts +25 -2
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +31 -6
- package/dist/NumberInput/NumberInput.d.ts +23 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +55 -11
- package/dist/Popover/Popover.d.ts +18 -2
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +5 -2
- package/dist/Popover/usePopover.d.ts +13 -1
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +6 -3
- package/dist/PowerSearch/PowerSearch.d.ts +11 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +2 -0
- package/dist/RadioList/RadioList.d.ts +19 -1
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +30 -7
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +13 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts +12 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +30 -8
- package/dist/SegmentedControl/SegmentedControlContext.d.ts +7 -0
- package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +9 -2
- package/dist/Selector/Selector.d.ts +22 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +31 -6
- package/dist/Slider/Slider.d.ts +21 -0
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +36 -9
- package/dist/Stack/Stack.d.ts +11 -23
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +8 -0
- package/dist/Stack/StackItem.d.ts +0 -22
- package/dist/Stack/StackItem.d.ts.map +1 -1
- package/dist/Switch/Switch.d.ts +23 -2
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +39 -7
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -2
- package/dist/TextArea/TextArea.d.ts +22 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +39 -5
- package/dist/TextInput/TextInput.d.ts +23 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +55 -10
- package/dist/TimeInput/TimeInput.d.ts +23 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +147 -76
- package/dist/Toast/ToastViewport.js +0 -1
- package/dist/Tokenizer/Tokenizer.d.ts +12 -1
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +26 -4
- package/dist/Typeahead/BaseTypeahead.d.ts +9 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +9 -2
- package/dist/Typeahead/Typeahead.d.ts +24 -1
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +29 -5
- package/dist/astryx.css +4 -3
- package/dist/astryx.umd.js +54 -54
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/useKeyboardHint.d.ts +1 -1
- package/dist/hooks/useKeyboardHint.d.ts.map +1 -1
- package/dist/hooks/useKeyboardHint.js +90 -136
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/inputAria.d.ts +29 -0
- package/dist/utils/inputAria.d.ts.map +1 -0
- package/dist/utils/inputAria.js +30 -0
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +5 -2
- package/docs.mjs +2 -2
- package/package.json +2 -4
- package/src/Carousel/Carousel.doc.mjs +7 -1
- package/src/Center/Center.doc.mjs +12 -2
- package/src/Center/Center.tsx +28 -3
- package/src/CheckboxInput/CheckboxInput.doc.mjs +10 -0
- package/src/CheckboxInput/CheckboxInput.test.tsx +158 -2
- package/src/CheckboxInput/CheckboxInput.tsx +74 -4
- package/src/CheckboxList/CheckboxList.doc.mjs +9 -0
- package/src/CheckboxList/CheckboxList.test.tsx +139 -2
- package/src/CheckboxList/CheckboxList.tsx +38 -0
- package/src/CheckboxList/CheckboxListContext.tsx +7 -0
- package/src/Citation/Citation.doc.mjs +10 -0
- package/src/Citation/Citation.test.tsx +117 -0
- package/src/Citation/Citation.tsx +9 -1
- package/src/CommandPalette/CommandPalette.test.tsx +47 -1
- package/src/CommandPalette/CommandPalette.tsx +9 -21
- package/src/DateInput/DateInput.doc.mjs +281 -56
- package/src/DateInput/DateInput.test.tsx +129 -2
- package/src/DateInput/DateInput.tsx +65 -3
- package/src/DateRangeInput/DateRangeInput.doc.mjs +251 -46
- package/src/DateRangeInput/DateRangeInput.test.tsx +113 -2
- package/src/DateRangeInput/DateRangeInput.tsx +56 -2
- package/src/DateTimeInput/DateTimeInput.doc.mjs +357 -71
- package/src/DateTimeInput/DateTimeInput.test.tsx +157 -2
- package/src/DateTimeInput/DateTimeInput.tsx +80 -4
- package/src/Field/Field.doc.mjs +59 -18
- package/src/FileInput/FileInput.doc.mjs +17 -0
- package/src/FileInput/FileInput.test.tsx +180 -1
- package/src/FileInput/FileInput.tsx +49 -1
- package/src/Grid/Grid.doc.mjs +17 -4
- package/src/Grid/Grid.test.tsx +43 -30
- package/src/Grid/Grid.tsx +38 -3
- package/src/InputGroup/InputGroup.doc.mjs +111 -23
- package/src/InputGroup/InputGroup.test.tsx +80 -0
- package/src/InputGroup/InputGroup.tsx +17 -3
- package/src/InputGroup/InputGroupContext.ts +9 -4
- package/src/InputGroup/index.ts +1 -0
- package/src/Layer/useLayer.test.tsx +111 -0
- package/src/Layer/useLayer.tsx +23 -3
- package/src/Layout/Layout.tsx +8 -16
- package/src/Layout/LayoutFooter.doc.mjs +4 -4
- package/src/Layout/LayoutFooter.tsx +3 -3
- package/src/Layout/LayoutHeader.doc.mjs +4 -4
- package/src/Layout/LayoutHeader.tsx +3 -3
- package/src/Layout/LayoutPanel.tsx +3 -3
- package/src/Lightbox/Lightbox.doc.mjs +9 -0
- package/src/MultiSelector/MultiSelector.doc.mjs +25 -0
- package/src/MultiSelector/MultiSelector.test.tsx +150 -1
- package/src/MultiSelector/MultiSelector.tsx +55 -3
- package/src/NumberInput/NumberInput.doc.mjs +17 -0
- package/src/NumberInput/NumberInput.test.tsx +170 -2
- package/src/NumberInput/NumberInput.tsx +77 -10
- package/src/Popover/Popover.doc.mjs +26 -0
- package/src/Popover/Popover.test.tsx +121 -0
- package/src/Popover/Popover.tsx +23 -2
- package/src/Popover/usePopover.doc.mjs +2 -0
- package/src/Popover/usePopover.tsx +22 -7
- package/src/PowerSearch/PowerSearch.doc.mjs +15 -0
- package/src/PowerSearch/PowerSearch.test.tsx +97 -1
- package/src/PowerSearch/PowerSearch.tsx +13 -3
- package/src/RadioList/RadioList.doc.mjs +9 -0
- package/src/RadioList/RadioList.test.tsx +123 -2
- package/src/RadioList/RadioList.tsx +64 -3
- package/src/RadioList/RadioListItem.tsx +14 -2
- package/src/SegmentedControl/SegmentedControl.doc.mjs +9 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +130 -2
- package/src/SegmentedControl/SegmentedControl.tsx +52 -4
- package/src/SegmentedControl/SegmentedControlContext.ts +7 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +12 -2
- package/src/Selector/Selector.doc.mjs +21 -0
- package/src/Selector/Selector.test.tsx +123 -1
- package/src/Selector/Selector.tsx +53 -3
- package/src/Slider/Slider.doc.mjs +15 -0
- package/src/Slider/Slider.test.tsx +155 -2
- package/src/Slider/Slider.tsx +53 -5
- package/src/Stack/Stack.doc.mjs +20 -0
- package/src/Stack/Stack.tsx +20 -23
- package/src/Stack/StackItem.tsx +0 -23
- package/src/Switch/Switch.doc.mjs +15 -0
- package/src/Switch/Switch.test.tsx +162 -27
- package/src/Switch/Switch.tsx +59 -5
- package/src/Table/Table.doc.mjs +2 -0
- package/src/Table/index.ts +0 -2
- package/src/TextArea/TextArea.doc.mjs +17 -0
- package/src/TextArea/TextArea.test.tsx +167 -35
- package/src/TextArea/TextArea.tsx +59 -2
- package/src/TextInput/TextInput.doc.mjs +17 -0
- package/src/TextInput/TextInput.test.tsx +168 -34
- package/src/TextInput/TextInput.tsx +77 -9
- package/src/TimeInput/TimeInput.doc.mjs +340 -60
- package/src/TimeInput/TimeInput.test.tsx +255 -7
- package/src/TimeInput/TimeInput.tsx +176 -70
- package/src/Toast/ToastViewport.test.tsx +10 -0
- package/src/Toast/ToastViewport.tsx +3 -3
- package/src/Tokenizer/Tokenizer.doc.mjs +15 -0
- package/src/Tokenizer/Tokenizer.test.tsx +105 -1
- package/src/Tokenizer/Tokenizer.tsx +37 -1
- package/src/Typeahead/BaseTypeahead.tsx +17 -1
- package/src/Typeahead/Typeahead.doc.mjs +136 -30
- package/src/Typeahead/Typeahead.test.tsx +171 -1
- package/src/Typeahead/Typeahead.tsx +52 -1
- package/src/docs-script.test.mjs +50 -0
- package/src/hooks/useKeyboardHint.doc.mjs +4 -4
- package/src/hooks/useKeyboardHint.test.tsx +70 -0
- package/src/hooks/useKeyboardHint.tsx +84 -128
- package/src/hooks/useListFocus.doc.mjs +1 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/inputAria.test.ts +39 -0
- package/src/utils/inputAria.ts +58 -0
- package/src/utils/timeParser.test.ts +10 -0
- package/src/utils/timeParser.ts +5 -2
package/dist/Center/Center.d.ts
CHANGED
|
@@ -35,6 +35,16 @@ export interface CenterProps extends BaseProps<HTMLDivElement> {
|
|
|
35
35
|
* Numbers are treated as pixels, strings are used as-is (e.g., '100%').
|
|
36
36
|
*/
|
|
37
37
|
height?: SizeValue;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum width of the container.
|
|
40
|
+
* Numbers are treated as pixels, strings are used as-is (e.g., '100%').
|
|
41
|
+
*/
|
|
42
|
+
maxWidth?: SizeValue;
|
|
43
|
+
/**
|
|
44
|
+
* Minimum height of the container.
|
|
45
|
+
* Numbers are treated as pixels, strings are used as-is (e.g., '100%').
|
|
46
|
+
*/
|
|
47
|
+
minHeight?: SizeValue;
|
|
38
48
|
/**
|
|
39
49
|
* Whether to make the container inline-flex (useful for text/icons).
|
|
40
50
|
* @default false
|
|
@@ -58,7 +68,7 @@ export interface CenterProps extends BaseProps<HTMLDivElement> {
|
|
|
58
68
|
* </Center>
|
|
59
69
|
* ```
|
|
60
70
|
*/
|
|
61
|
-
export declare function Center({ axis, width, height, isInline, children, xstyle, className, style, ref, ...props }: CenterProps): import("react").JSX.Element;
|
|
71
|
+
export declare function Center({ axis, width, height, maxWidth, minHeight, isInline, children, xstyle, className, style, ref, ...props }: CenterProps): import("react").JSX.Element;
|
|
62
72
|
export declare namespace Center {
|
|
63
73
|
var displayName: string;
|
|
64
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Center.d.ts","sourceRoot":"","sources":["../../src/Center/Center.tsx"],"names":[],"mappings":"A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BAwBb;yBArCe,MAAM"}
|
package/dist/Center/Center.js
CHANGED
|
@@ -39,13 +39,17 @@ const styles = {
|
|
|
39
39
|
|
|
40
40
|
// Dynamic styles for sizing props
|
|
41
41
|
const dynamicStyles = {
|
|
42
|
-
sizing: (width, height) => [{
|
|
42
|
+
sizing: (width, height, maxWidth, minHeight) => [{
|
|
43
43
|
kzqmXN: width != null ? "x5lhr3w" : width,
|
|
44
44
|
kZKoxP: height != null ? "x16ye13r" : height,
|
|
45
|
+
ks0D6T: maxWidth != null ? "xf68679" : maxWidth,
|
|
46
|
+
kAzted: minHeight != null ? "x82snj4" : minHeight,
|
|
45
47
|
$$css: true
|
|
46
48
|
}, {
|
|
47
49
|
"--x-width": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(width),
|
|
48
|
-
"--x-height": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(height)
|
|
50
|
+
"--x-height": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(height),
|
|
51
|
+
"--x-maxWidth": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(maxWidth),
|
|
52
|
+
"--x-minHeight": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(minHeight)
|
|
49
53
|
}]
|
|
50
54
|
};
|
|
51
55
|
/**
|
|
@@ -65,6 +69,8 @@ export function Center({
|
|
|
65
69
|
axis = 'both',
|
|
66
70
|
width,
|
|
67
71
|
height,
|
|
72
|
+
maxWidth,
|
|
73
|
+
minHeight,
|
|
68
74
|
isInline = false,
|
|
69
75
|
children,
|
|
70
76
|
xstyle,
|
|
@@ -75,7 +81,7 @@ export function Center({
|
|
|
75
81
|
}) {
|
|
76
82
|
const stylexProps = mergeProps(themeProps('center', {
|
|
77
83
|
axis
|
|
78
|
-
}), stylex.props(isInline ? styles.inline : styles.base, (axis === 'both' || axis === 'vertical') && styles.alignItemsCenter, (axis === 'both' || axis === 'horizontal') && styles.justifyContentCenter, dynamicStyles.sizing(width ?? null, height ?? null), xstyle), className, style);
|
|
84
|
+
}), stylex.props(isInline ? styles.inline : styles.base, (axis === 'both' || axis === 'vertical') && styles.alignItemsCenter, (axis === 'both' || axis === 'horizontal') && styles.justifyContentCenter, dynamicStyles.sizing(width ?? null, height ?? null, maxWidth ?? null, minHeight ?? null), xstyle), className, style);
|
|
79
85
|
return /*#__PURE__*/_jsx("div", {
|
|
80
86
|
ref: ref,
|
|
81
87
|
...stylexProps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file CheckboxInput.tsx
|
|
3
|
-
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus
|
|
3
|
+
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus, useTooltip
|
|
4
4
|
* @output Exports CheckboxInput component, CheckboxInputProps
|
|
5
5
|
* @position Core implementation; consumed by index.ts, tested by CheckboxInput.test.tsx
|
|
6
6
|
*
|
|
@@ -66,6 +66,27 @@ export interface CheckboxInputProps extends Omit<BaseProps, 'onChange'> {
|
|
|
66
66
|
* @default false
|
|
67
67
|
*/
|
|
68
68
|
isDisabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Explains why the checkbox is disabled. When set together with
|
|
71
|
+
* `isDisabled`, the checkbox shows a tooltip with this text on hover and
|
|
72
|
+
* keyboard focus, and the control stays focusable (via `aria-disabled`) so
|
|
73
|
+
* the reason is discoverable by keyboard and assistive technology.
|
|
74
|
+
* Activation stays blocked.
|
|
75
|
+
*
|
|
76
|
+
* Use this instead of wrapping a disabled checkbox in `Tooltip` — disabled
|
|
77
|
+
* controls don't emit the pointer events an external tooltip needs.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```
|
|
81
|
+
* <CheckboxInput
|
|
82
|
+
* label="Accept terms"
|
|
83
|
+
* value={accepted}
|
|
84
|
+
* isDisabled
|
|
85
|
+
* disabledMessage="Terms are managed by your administrator"
|
|
86
|
+
* />
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
disabledMessage?: string;
|
|
69
90
|
/**
|
|
70
91
|
* Whether the checkbox is read-only.
|
|
71
92
|
* Displays the current state at full opacity but prevents interaction.
|
|
@@ -132,7 +153,7 @@ export interface CheckboxInputProps extends Omit<BaseProps, 'onChange'> {
|
|
|
132
153
|
* />
|
|
133
154
|
* ```
|
|
134
155
|
*/
|
|
135
|
-
export declare function CheckboxInput({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, isReadOnly, isOptional, isRequired, size, onFocus, onBlur, labelIcon, status, width, xstyle, className, style, ref, }: CheckboxInputProps): import("react").JSX.Element;
|
|
156
|
+
export declare function CheckboxInput({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, disabledMessage, isReadOnly, isOptional, isRequired, size, onFocus, onBlur, labelIcon, status, width, xstyle, className, style, ref, }: CheckboxInputProps): import("react").JSX.Element;
|
|
136
157
|
export declare namespace CheckboxInput {
|
|
137
158
|
var displayName: string;
|
|
138
159
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAY3C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WA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AAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,IAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,GACJ,EAAE,kBAAkB,+BAmNpB;yBA1Oe,aAAa"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file CheckboxInput.tsx
|
|
7
|
-
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus
|
|
7
|
+
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus, useTooltip
|
|
8
8
|
* @output Exports CheckboxInput component, CheckboxInputProps
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by CheckboxInput.test.tsx
|
|
10
10
|
*
|
|
@@ -15,17 +15,19 @@
|
|
|
15
15
|
* - /apps/storybook/stories/CheckboxInput.stories.tsx (storybook stories)
|
|
16
16
|
* - /packages/cli/templates/blocks/components/CheckboxInput/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
-
import { useId, useCallback, useOptimistic, useTransition } from 'react';
|
|
18
|
+
import { useId, useCallback, use, useOptimistic, useTransition } from 'react';
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
20
|
import "../theme/tokens.stylex.js";
|
|
21
21
|
import { colorVars, spacingVars, radiusVars, durationVars, easeVars, typographyVars, typeScaleVars, fontWeightVars, borderVars } from "../theme/tokens.stylex.js";
|
|
22
22
|
import { FieldLabel } from "../Field/FieldLabel.js";
|
|
23
23
|
import { FieldStatus } from "../FieldStatus/FieldStatus.js";
|
|
24
24
|
import { Spinner } from "../Spinner/index.js";
|
|
25
|
+
import { useTooltip } from "../Tooltip/index.js";
|
|
25
26
|
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
26
27
|
import "./checkbox.markers.stylex.js";
|
|
27
28
|
import { checkboxScope } from "./checkbox.markers.stylex.js";
|
|
28
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
30
|
+
import { CheckboxListContext } from "../CheckboxList/CheckboxListContext.js";
|
|
29
31
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
32
|
const styles = {
|
|
31
33
|
container: {
|
|
@@ -203,6 +205,7 @@ export function CheckboxInput({
|
|
|
203
205
|
isLoading = false,
|
|
204
206
|
value,
|
|
205
207
|
isDisabled = false,
|
|
208
|
+
disabledMessage,
|
|
206
209
|
isReadOnly = false,
|
|
207
210
|
isOptional = false,
|
|
208
211
|
isRequired = false,
|
|
@@ -223,6 +226,26 @@ export function CheckboxInput({
|
|
|
223
226
|
const [, startTransition] = useTransition();
|
|
224
227
|
const [optimisticValue, setOptimisticValue] = useOptimistic(value);
|
|
225
228
|
const isBusy = isLoading || optimisticValue !== value;
|
|
229
|
+
|
|
230
|
+
// Disabled-reason tooltip. Disabled controls swallow pointer events, so the
|
|
231
|
+
// tooltip listeners attach to the checkbox row (which already exists) and the
|
|
232
|
+
// native checkbox stays perceivable via aria-disabled instead of the disabled
|
|
233
|
+
// attribute. Value mutation is blocked by the isDisabled guard in onChange.
|
|
234
|
+
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
235
|
+
// Keep the native checkbox focusable via aria-disabled either when it renders
|
|
236
|
+
// its own reason tooltip, or when it sits in a CheckboxList whose whole-group
|
|
237
|
+
// `disabledMessage` (shown on the group container) needs each checkbox to
|
|
238
|
+
// stay keyboard-perceivable. The group signals this through context rather
|
|
239
|
+
// than a public prop.
|
|
240
|
+
const checkboxListContext = use(CheckboxListContext);
|
|
241
|
+
const isFocusableDisabled = isDisabled && (showsDisabledMessage || (checkboxListContext?.hasDisabledMessage ?? false));
|
|
242
|
+
const disabledMessageTooltip = useTooltip({
|
|
243
|
+
placement: 'above',
|
|
244
|
+
// The container row is not naturally focusable; focusin bubbles up from the
|
|
245
|
+
// native checkbox, so always attach focus listeners.
|
|
246
|
+
focusTrigger: 'always',
|
|
247
|
+
isEnabled: showsDisabledMessage
|
|
248
|
+
});
|
|
226
249
|
const isIndeterminate = optimisticValue === 'indeterminate';
|
|
227
250
|
const isChecked = optimisticValue === true;
|
|
228
251
|
const isCheckedOrIndeterminate = isChecked || isIndeterminate;
|
|
@@ -246,25 +269,42 @@ export function CheckboxInput({
|
|
|
246
269
|
if (status?.message) {
|
|
247
270
|
describedByParts.push(statusMessageID);
|
|
248
271
|
}
|
|
272
|
+
if (showsDisabledMessage) {
|
|
273
|
+
describedByParts.push(disabledMessageTooltip.describedBy);
|
|
274
|
+
}
|
|
249
275
|
const ariaDescribedBy = describedByParts.length > 0 ? describedByParts.join(' ') : undefined;
|
|
250
276
|
return /*#__PURE__*/_jsxs("div", {
|
|
251
277
|
...mergeProps(themeProps('checkbox-input', {
|
|
252
278
|
size
|
|
253
279
|
}), stylex.props(width != null && dynamicWidthStyles.width(width), xstyle), className, style),
|
|
254
280
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
281
|
+
ref: el => {
|
|
282
|
+
// Interaction (hover/focus) listeners for the disabled-message
|
|
283
|
+
// tooltip attach to the whole row for a larger trigger target;
|
|
284
|
+
// positioning anchors on the checkbox itself (below) so the tooltip
|
|
285
|
+
// appears next to the control, not the far edge of the row.
|
|
286
|
+
// Handlers are gated internally by isEnabled, so attaching
|
|
287
|
+
// unconditionally is safe.
|
|
288
|
+
disabledMessageTooltip.interactionRef(el);
|
|
289
|
+
},
|
|
255
290
|
...stylex.props(styles.container, isLabelHidden && styles.containerLabelHidden, !isDisabled && checkboxScope),
|
|
256
291
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
257
292
|
...stylex.props(styles.checkboxWrapper, wrapperSizeStyles[size]),
|
|
258
293
|
children: [/*#__PURE__*/_jsx("input", {
|
|
259
|
-
ref: mergeRefs(ref, indeterminateRef),
|
|
294
|
+
ref: mergeRefs(ref, indeterminateRef, disabledMessageTooltip.positionRef),
|
|
260
295
|
id: id,
|
|
261
296
|
type: "checkbox",
|
|
262
|
-
checked: isChecked
|
|
263
|
-
|
|
297
|
+
checked: isChecked
|
|
298
|
+
// With a disabledMessage the checkbox keeps focusability via
|
|
299
|
+
// aria-disabled so the reason is focus-discoverable; toggling is
|
|
300
|
+
// still blocked by the isDisabled guard in onChange below.
|
|
301
|
+
,
|
|
302
|
+
disabled: isDisabled && !isFocusableDisabled,
|
|
303
|
+
"aria-disabled": isFocusableDisabled ? 'true' : undefined,
|
|
264
304
|
readOnly: isReadOnly,
|
|
265
305
|
required: isRequired,
|
|
266
306
|
onChange: e => {
|
|
267
|
-
if (isBusy || isReadOnly) {
|
|
307
|
+
if (isDisabled || isBusy || isReadOnly) {
|
|
268
308
|
return;
|
|
269
309
|
}
|
|
270
310
|
const checked = e.target.checked;
|
|
@@ -331,7 +371,7 @@ export function CheckboxInput({
|
|
|
331
371
|
message: status.message,
|
|
332
372
|
id: statusMessageID,
|
|
333
373
|
variant: "detached"
|
|
334
|
-
})]
|
|
374
|
+
}), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
335
375
|
});
|
|
336
376
|
}
|
|
337
377
|
CheckboxInput.displayName = 'CheckboxInput';
|
|
@@ -67,6 +67,18 @@ export interface CheckboxListProps extends Omit<BaseProps<HTMLDivElement>, 'onCh
|
|
|
67
67
|
* @default false
|
|
68
68
|
*/
|
|
69
69
|
isDisabled?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Explains why the checkbox group is disabled. Applies to the whole-group
|
|
72
|
+
* disabled state (`isDisabled`), not individual items. When set together with
|
|
73
|
+
* `isDisabled`, the group shows a tooltip with this text on hover and keyboard
|
|
74
|
+
* focus, and its checkboxes stay focusable (via `aria-disabled`) so the reason
|
|
75
|
+
* is discoverable by keyboard and assistive technology. Toggling stays
|
|
76
|
+
* blocked.
|
|
77
|
+
*
|
|
78
|
+
* Use this instead of wrapping a disabled group in `Tooltip` — disabled
|
|
79
|
+
* controls don't emit the pointer events an external tooltip needs.
|
|
80
|
+
*/
|
|
81
|
+
disabledMessage?: string;
|
|
70
82
|
/**
|
|
71
83
|
* Whether all checkbox items are read-only.
|
|
72
84
|
* Displays the current state at full opacity but prevents interaction.
|
|
@@ -103,7 +115,7 @@ export interface CheckboxListProps extends Omit<BaseProps<HTMLDivElement>, 'onCh
|
|
|
103
115
|
* </CheckboxList>
|
|
104
116
|
* ```
|
|
105
117
|
*/
|
|
106
|
-
export declare function CheckboxList({ label, isLabelHidden, description, status, value, onChange, changeAction, density, hasDividers, isDisabled, isReadOnly, children, ref, width, xstyle, className, style, 'data-testid': dataTestId, }: CheckboxListProps): import("react").JSX.Element;
|
|
118
|
+
export declare function CheckboxList({ label, isLabelHidden, description, status, value, onChange, changeAction, density, hasDividers, isDisabled, disabledMessage, isReadOnly, children, ref, width, xstyle, className, style, 'data-testid': dataTestId, }: CheckboxListProps): import("react").JSX.Element;
|
|
107
119
|
export declare namespace CheckboxList {
|
|
108
120
|
var displayName: string;
|
|
109
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxList.d.ts","sourceRoot":"","sources":["../../src/CheckboxList/CheckboxList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC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C,CAAC;IAC1D;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,MAAM,EACN,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,OAAoB,EACpB,WAAmB,EACnB,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,QAAQ,EACR,GAAG,EACH,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,UAAU,GAC1B,EAAE,iBAAiB,+BA0HnB;yBA9Ie,YAAY"}
|
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
import { useCallback, useId, useMemo, useOptimistic, useTransition } from 'react';
|
|
19
19
|
import { Field } from "../Field/Field.js";
|
|
20
20
|
import { List } from "../List/List.js";
|
|
21
|
+
import { useTooltip } from "../Tooltip/index.js";
|
|
21
22
|
import { mergeProps } from "../utils/index.js";
|
|
22
23
|
import { themeProps } from "../utils/themeProps.js";
|
|
23
24
|
import { CheckboxListContext } from "./CheckboxListContext.js";
|
|
24
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
26
|
const EMPTY_ARRAY = [];
|
|
26
27
|
/**
|
|
27
28
|
* A checkbox group component for multi-value selection.
|
|
@@ -52,6 +53,7 @@ export function CheckboxList({
|
|
|
52
53
|
density = 'balanced',
|
|
53
54
|
hasDividers = false,
|
|
54
55
|
isDisabled = false,
|
|
56
|
+
disabledMessage,
|
|
55
57
|
isReadOnly = false,
|
|
56
58
|
children,
|
|
57
59
|
ref,
|
|
@@ -72,6 +74,19 @@ export function CheckboxList({
|
|
|
72
74
|
// Tracks which item has a pending `changeAction`. Auto-reverts to null when
|
|
73
75
|
// the transition settles, so the spinner clears without manual cleanup.
|
|
74
76
|
const [loadingValue, setLoadingValue] = useOptimistic(null);
|
|
77
|
+
|
|
78
|
+
// Disabled-reason tooltip. Applies to the whole-group disabled state. Disabled
|
|
79
|
+
// controls swallow pointer events, so the tooltip listeners attach to the
|
|
80
|
+
// group container and the checkboxes stay perceivable via aria-disabled
|
|
81
|
+
// instead of the disabled attribute. Toggling is blocked in the item.
|
|
82
|
+
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
83
|
+
const disabledMessageTooltip = useTooltip({
|
|
84
|
+
placement: 'above',
|
|
85
|
+
// The group container is not naturally focusable; focusin bubbles up from
|
|
86
|
+
// the checkboxes, so always attach focus listeners.
|
|
87
|
+
focusTrigger: 'always',
|
|
88
|
+
isEnabled: showsDisabledMessage
|
|
89
|
+
});
|
|
75
90
|
const handleChange = useCallback((newValues, toggledValue) => {
|
|
76
91
|
onChange?.(newValues);
|
|
77
92
|
if (changeAction) {
|
|
@@ -88,10 +103,11 @@ export function CheckboxList({
|
|
|
88
103
|
value: isCollectionMode ? optimisticValue : undefined,
|
|
89
104
|
onChange: isCollectionMode ? handleChange : undefined,
|
|
90
105
|
isDisabled,
|
|
106
|
+
hasDisabledMessage: showsDisabledMessage,
|
|
91
107
|
isReadOnly,
|
|
92
108
|
loadingValue
|
|
93
|
-
}), [isCollectionMode, optimisticValue, handleChange, isDisabled, isReadOnly, loadingValue]);
|
|
94
|
-
return /*#__PURE__*/
|
|
109
|
+
}), [isCollectionMode, optimisticValue, handleChange, isDisabled, showsDisabledMessage, isReadOnly, loadingValue]);
|
|
110
|
+
return /*#__PURE__*/_jsxs(Field, {
|
|
95
111
|
ref: ref,
|
|
96
112
|
"data-testid": dataTestId,
|
|
97
113
|
label: label,
|
|
@@ -114,19 +130,25 @@ export function CheckboxList({
|
|
|
114
130
|
className,
|
|
115
131
|
style
|
|
116
132
|
}),
|
|
117
|
-
children: /*#__PURE__*/_jsx(CheckboxListContext, {
|
|
133
|
+
children: [/*#__PURE__*/_jsx(CheckboxListContext, {
|
|
118
134
|
value: contextValue,
|
|
119
135
|
children: /*#__PURE__*/_jsx("div", {
|
|
136
|
+
ref: el => {
|
|
137
|
+
// Anchor + hover/focus listeners for the disabled-message tooltip.
|
|
138
|
+
// Handlers are gated internally by isEnabled, so attaching
|
|
139
|
+
// unconditionally is safe.
|
|
140
|
+
disabledMessageTooltip.ref(el);
|
|
141
|
+
},
|
|
120
142
|
role: "group",
|
|
121
143
|
"aria-labelledby": labelID,
|
|
122
|
-
"aria-describedby": [description ? descriptionID : null, status?.message ? statusMessageID : null].filter(Boolean).join(' ') || undefined,
|
|
144
|
+
"aria-describedby": [description ? descriptionID : null, status?.message ? statusMessageID : null, showsDisabledMessage ? disabledMessageTooltip.describedBy : null].filter(Boolean).join(' ') || undefined,
|
|
123
145
|
children: /*#__PURE__*/_jsx(List, {
|
|
124
146
|
density: density,
|
|
125
147
|
hasDividers: hasDividers,
|
|
126
148
|
children: children
|
|
127
149
|
})
|
|
128
150
|
})
|
|
129
|
-
})
|
|
151
|
+
}), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
130
152
|
});
|
|
131
153
|
}
|
|
132
154
|
CheckboxList.displayName = 'CheckboxList';
|
|
@@ -8,6 +8,13 @@ export interface CheckboxListContextValue {
|
|
|
8
8
|
*/
|
|
9
9
|
onChange?: (values: string[], toggledValue?: string) => void;
|
|
10
10
|
isDisabled: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* True when the whole group is disabled *and* a `disabledMessage` is set. In
|
|
13
|
+
* that mode items stay focusable via `aria-disabled` (instead of the native
|
|
14
|
+
* `disabled` attribute) so the group's disabled-reason tooltip is keyboard-
|
|
15
|
+
* and AT-discoverable; toggling is still blocked.
|
|
16
|
+
*/
|
|
17
|
+
hasDisabledMessage?: boolean;
|
|
11
18
|
isReadOnly: boolean;
|
|
12
19
|
/**
|
|
13
20
|
* The value of the item with a pending `changeAction`, or null when idle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxListContext.d.ts","sourceRoot":"","sources":["../../src/CheckboxList/CheckboxListContext.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,mBAAmB,0DACsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"CheckboxListContext.d.ts","sourceRoot":"","sources":["../../src/CheckboxList/CheckboxListContext.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,mBAAmB,0DACsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Citation.d.ts","sourceRoot":"","sources":["../../src/Citation/Citation.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC3D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9B;
|
|
1
|
+
{"version":3,"file":"Citation.d.ts","sourceRoot":"","sources":["../../src/Citation/Citation.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC3D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9B;AAuGD,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,MAAM,EACN,MAAM,EACN,OAAiB,EACjB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,IAAI,EACR,EAAE,aAAa,GAAG,KAAK,CAAC,YAAY,CA0EpC;yBApFe,QAAQ"}
|
|
@@ -50,7 +50,7 @@ const styles = {
|
|
|
50
50
|
},
|
|
51
51
|
labelHover: {
|
|
52
52
|
kWkggS: "xe9uy6x",
|
|
53
|
-
kMwMTN: "x140uwzg",
|
|
53
|
+
kMwMTN: "xv1l7n4 x140uwzg",
|
|
54
54
|
$$css: true
|
|
55
55
|
},
|
|
56
56
|
number: {
|
|
@@ -61,7 +61,7 @@ const styles = {
|
|
|
61
61
|
kGuDYH: "x141an7d",
|
|
62
62
|
k63SB2: "x2mo6ok",
|
|
63
63
|
kLWn49: "x1ltkj2j",
|
|
64
|
-
kMwMTN: "
|
|
64
|
+
kMwMTN: "xv1l7n4",
|
|
65
65
|
kWkggS: "xgcxg3y",
|
|
66
66
|
kaIpWk: "xjspbzw",
|
|
67
67
|
k7Eaqz: "x16asifk",
|
|
@@ -75,7 +75,7 @@ const styles = {
|
|
|
75
75
|
$$css: true
|
|
76
76
|
},
|
|
77
77
|
numberHover: {
|
|
78
|
-
kWkggS: "xe9uy6x",
|
|
78
|
+
kWkggS: "xgcxg3y xe9uy6x",
|
|
79
79
|
$$css: true
|
|
80
80
|
}
|
|
81
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../src/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../src/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,YAAY,EA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,cAAc,GAAG,cAAc,EAAE,EACxE,GAAG,EACH,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,UAAU,EACV,eAA8B,EAC9B,kBAAqC,EACrC,KAAK,EAAE,eAAe,EACtB,aAAa,EACb,KAAyB,EACzB,KAAW,EACX,SAAe,GAChB,EAAE,mBAAmB,CAAC,CAAC,CAAC,+BAkRxB;yBAlSe,cAAc"}
|
|
@@ -314,12 +314,12 @@ export function CommandPalette({
|
|
|
314
314
|
isBusy
|
|
315
315
|
}), [optimisticSearch, setOptimisticSearch, runSearch, value, setValue, listId, combobox.highlightedIndex, combobox.setHighlightedIndex, combobox.getItemId, selectableItems, optimisticResults, selectItem, handleKeyDown, handleClose, isOpen, isBusy]);
|
|
316
316
|
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
317
|
+
// `search` is the committed query the on-screen results correspond to (it
|
|
318
|
+
// still holds the previous query while a transition is pending). Keeping both
|
|
319
|
+
// flags ungated by `isPending` makes them exhaustive over the empty case, so
|
|
320
|
+
// the empty state is never unmounted and re-added mid-search (which flashed).
|
|
321
321
|
const showEmptyBootstrap = search === '' && optimisticResults.length === 0;
|
|
322
|
-
const showEmptySearch =
|
|
322
|
+
const showEmptySearch = search !== '' && optimisticResults.length === 0;
|
|
323
323
|
let listContent;
|
|
324
324
|
if (showEmptyBootstrap) {
|
|
325
325
|
listContent = /*#__PURE__*/_jsx(CommandPaletteEmpty, {
|
|
@@ -50,6 +50,28 @@ export interface DateInputProps extends Omit<BaseProps, 'onChange' | 'defaultVal
|
|
|
50
50
|
* @default false
|
|
51
51
|
*/
|
|
52
52
|
isDisabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Explains why the input is disabled. When set together with
|
|
55
|
+
* `isDisabled`, the input shows a tooltip with this text on hover and
|
|
56
|
+
* keyboard focus, and the field stays focusable (via `aria-disabled`)
|
|
57
|
+
* so the reason is discoverable by keyboard and assistive technology.
|
|
58
|
+
* Typing and calendar activation stay blocked.
|
|
59
|
+
*
|
|
60
|
+
* Use this instead of wrapping a disabled input in `Tooltip` — disabled
|
|
61
|
+
* controls don't emit the pointer events an external tooltip needs.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```
|
|
65
|
+
* <DateInput
|
|
66
|
+
* label="Event date"
|
|
67
|
+
* value={date}
|
|
68
|
+
* onChange={setDate}
|
|
69
|
+
* isDisabled
|
|
70
|
+
* disabledMessage="You need the Editor role to change this"
|
|
71
|
+
* />
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
disabledMessage?: string;
|
|
53
75
|
/**
|
|
54
76
|
* The selected date in ISO format (YYYY-MM-DD).
|
|
55
77
|
*/
|
|
@@ -132,7 +154,7 @@ export interface DateInputProps extends Omit<BaseProps, 'onChange' | 'defaultVal
|
|
|
132
154
|
* />
|
|
133
155
|
* ```
|
|
134
156
|
*/
|
|
135
|
-
export declare function DateInput({ label, isLabelHidden, description, isOptional, isRequired, isDisabled, value, onChange, changeAction, isLoading, min, max, dateConstraints, placeholder, size, status, labelTooltip, hasClear, numberOfMonths, width, xstyle, className, style, ref, ...rest }: DateInputProps): import("react").JSX.Element;
|
|
157
|
+
export declare function DateInput({ label, isLabelHidden, description, isOptional, isRequired, isDisabled, disabledMessage, value, onChange, changeAction, isLoading, min, max, dateConstraints, placeholder, size, status, labelTooltip, hasClear, numberOfMonths, width, xstyle, className, style, ref, ...rest }: DateInputProps): import("react").JSX.Element;
|
|
136
158
|
export declare namespace DateInput {
|
|
137
159
|
var displayName: string;
|
|
138
160
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/DateInput/DateInput.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAU3C,OAAO,EAEL,KAAK,WAAW,EAMjB,MAAM,UAAU,CAAC;AAIlB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
|
|
26
26
|
import { Calendar } from "../Calendar/index.js";
|
|
27
27
|
import { useCalendarConstraints } from "../Calendar/hooks/index.js";
|
|
28
28
|
import { usePopover } from "../Popover/index.js";
|
|
29
|
+
import { useTooltip } from "../Tooltip/index.js";
|
|
29
30
|
import { parseDateInput } from "../utils/index.js";
|
|
30
31
|
import { plainDateFromISO, plainDateToISO, plainDateFormat, DATE_FORMAT_LONG } from "../utils/plainDate.js";
|
|
31
32
|
const sizeStyles = {
|
|
@@ -70,6 +71,7 @@ export function DateInput({
|
|
|
70
71
|
isOptional = false,
|
|
71
72
|
isRequired = false,
|
|
72
73
|
isDisabled = false,
|
|
74
|
+
disabledMessage,
|
|
73
75
|
value,
|
|
74
76
|
onChange,
|
|
75
77
|
changeAction,
|
|
@@ -101,6 +103,22 @@ export function DateInput({
|
|
|
101
103
|
const isBusy = isLoading || optimisticValue !== value;
|
|
102
104
|
const isEffectivelyDisabled = isDisabled || isBusy;
|
|
103
105
|
|
|
106
|
+
// Disabled-reason tooltip. Disabled controls swallow pointer events, so the
|
|
107
|
+
// tooltip listeners attach to the input container (which already exists) and
|
|
108
|
+
// the text input stays perceivable via aria-disabled instead of the disabled
|
|
109
|
+
// attribute. Typing is blocked with readOnly and value mutation guards;
|
|
110
|
+
// calendar activation is blocked by the isEffectivelyDisabled guards. Only
|
|
111
|
+
// the persistent isDisabled state (not the transient busy state) surfaces a
|
|
112
|
+
// reason.
|
|
113
|
+
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
114
|
+
const disabledMessageTooltip = useTooltip({
|
|
115
|
+
placement: 'above',
|
|
116
|
+
// The container div is not naturally focusable; focusin bubbles up from
|
|
117
|
+
// the input, so always attach focus listeners.
|
|
118
|
+
focusTrigger: 'always',
|
|
119
|
+
isEnabled: showsDisabledMessage
|
|
120
|
+
});
|
|
121
|
+
|
|
104
122
|
// Status icon mapping
|
|
105
123
|
const statusIconMap = {
|
|
106
124
|
warning: 'warning',
|
|
@@ -121,7 +139,7 @@ export function DateInput({
|
|
|
121
139
|
max,
|
|
122
140
|
dateConstraints
|
|
123
141
|
});
|
|
124
|
-
const ariaDescribedBy = [description ? descriptionID : null, status?.message ? statusMessageID : null].filter(Boolean).join(' ') || undefined;
|
|
142
|
+
const ariaDescribedBy = [description ? descriptionID : null, status?.message ? statusMessageID : null, showsDisabledMessage ? disabledMessageTooltip.describedBy : null].filter(Boolean).join(' ') || undefined;
|
|
125
143
|
|
|
126
144
|
// Pending input while user is typing (null = show formatted value)
|
|
127
145
|
const [pendingInput, setPendingInput] = useState(null);
|
|
@@ -199,6 +217,11 @@ export function DateInput({
|
|
|
199
217
|
|
|
200
218
|
// Handle input text change - update immediately if valid and allowed
|
|
201
219
|
const handleInputChange = useCallback(e => {
|
|
220
|
+
// With a disabledMessage the input drops `disabled` for focusability, so
|
|
221
|
+
// guard value mutation explicitly (readOnly also blocks typing).
|
|
222
|
+
if (isEffectivelyDisabled) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
202
225
|
const newValue = e.target.value;
|
|
203
226
|
setPendingInput(newValue);
|
|
204
227
|
|
|
@@ -211,7 +234,7 @@ export function DateInput({
|
|
|
211
234
|
// Navigate calendar to show the parsed date's month
|
|
212
235
|
calendarRef.current?.navigateTo(parsedISO);
|
|
213
236
|
}
|
|
214
|
-
}, [value, fireChange, isDateDisabled]);
|
|
237
|
+
}, [value, fireChange, isDateDisabled, isEffectivelyDisabled]);
|
|
215
238
|
|
|
216
239
|
// Commit pending input (shared by blur and Enter key)
|
|
217
240
|
const commitPendingInput = useCallback(() => {
|
|
@@ -276,7 +299,13 @@ export function DateInput({
|
|
|
276
299
|
labelTooltip: labelTooltip,
|
|
277
300
|
width: width,
|
|
278
301
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
279
|
-
ref:
|
|
302
|
+
ref: el => {
|
|
303
|
+
popover.triggerRef(el);
|
|
304
|
+
// Anchor + hover/focus listeners for the disabled-message tooltip.
|
|
305
|
+
// Handlers are gated internally by isEnabled, and anchor names
|
|
306
|
+
// compose, so attaching unconditionally is safe.
|
|
307
|
+
disabledMessageTooltip.ref(el);
|
|
308
|
+
},
|
|
280
309
|
...rest,
|
|
281
310
|
...mergeProps(themeProps('date-input', {
|
|
282
311
|
size,
|
|
@@ -310,8 +339,15 @@ export function DateInput({
|
|
|
310
339
|
onBlur: handleBlur,
|
|
311
340
|
onClick: handleInputClick,
|
|
312
341
|
onKeyDown: handleInputKeyDown,
|
|
313
|
-
placeholder: placeholder
|
|
314
|
-
|
|
342
|
+
placeholder: placeholder
|
|
343
|
+
// With a disabledMessage the input keeps focusability via
|
|
344
|
+
// aria-disabled so the reason is focus-discoverable; typing is
|
|
345
|
+
// blocked with readOnly and the mutation guards, and calendar
|
|
346
|
+
// activation is blocked by the isEffectivelyDisabled guards.
|
|
347
|
+
,
|
|
348
|
+
disabled: isEffectivelyDisabled && !showsDisabledMessage,
|
|
349
|
+
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
350
|
+
readOnly: showsDisabledMessage || undefined,
|
|
315
351
|
"aria-describedby": ariaDescribedBy,
|
|
316
352
|
"aria-required": isRequired === true ? 'true' : undefined,
|
|
317
353
|
"aria-invalid": status?.type === 'error' || !isInputValid ? 'true' : undefined,
|
|
@@ -371,7 +407,7 @@ export function DateInput({
|
|
|
371
407
|
}), {
|
|
372
408
|
placement: 'below',
|
|
373
409
|
alignment: 'start'
|
|
374
|
-
})]
|
|
410
|
+
}), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
375
411
|
});
|
|
376
412
|
}
|
|
377
413
|
DateInput.displayName = 'DateInput';
|