@astryxdesign/core 0.7.3-canary.b74cf21 → 0.7.3-canary.ca48bb7
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/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +8 -4
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +7 -0
- package/dist/Calendar/Calendar.js +3 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +19 -24
- package/dist/ClickableCard/ClickableCard.d.ts +2 -2
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +11 -9
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +11 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +23 -5
- package/dist/DateInput/DateInput.d.ts +4 -4
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +27 -20
- package/dist/DateInput/NativeDateField.d.ts.map +1 -1
- package/dist/DateInput/NativeDateField.js +14 -8
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +14 -10
- package/dist/DateRangeInput/DateRangeInput.d.ts +5 -5
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +27 -18
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +9 -4
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +52 -10
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +34 -1
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +15 -0
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts +21 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +375 -42
- package/dist/DropdownMenu/menuRegionStops.d.ts +2 -2
- package/dist/DropdownMenu/menuRegionStops.js +2 -2
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +14 -12
- package/dist/Link/Link.d.ts +2 -3
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +11 -19
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +48 -15
- package/dist/MultiSelector/MultiSelector.d.ts +4 -4
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.d.ts +2 -0
- package/dist/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.d.ts.map +1 -0
- package/dist/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.js +48 -0
- package/dist/MultiSelector/MultiSelector.js +25 -18
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +5 -2
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +8 -4
- package/dist/Selector/Selector.d.ts +4 -4
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +23 -14
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +7 -14
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +25 -17
- package/dist/Switch/switch.markers.stylex.d.ts +2 -0
- package/dist/Switch/switch.markers.stylex.d.ts.map +1 -1
- package/dist/Switch/switch.markers.stylex.js +6 -0
- package/dist/TimeInput/TimeInput.d.ts +2 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +41 -8
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +8 -3
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +36 -14
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +2 -2
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +1 -0
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +8 -3
- package/dist/astryx.css +7 -2
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +10 -1
- package/dist/hooks/useMenuPress.d.ts +11 -1
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +43 -5
- package/dist/utils/disabledInteraction.d.ts +21 -0
- package/dist/utils/disabledInteraction.d.ts.map +1 -0
- package/dist/utils/disabledInteraction.js +33 -0
- package/dist/utils/timeParser.d.ts +4 -0
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +9 -2
- package/package.json +3 -3
- package/src/Banner/Banner.spec.md +37 -32
- package/src/BottomSheet/BottomSheet.spec.md +26 -53
- package/src/BottomSheet/BottomSheet.test.tsx +29 -0
- package/src/BottomSheet/BottomSheet.tsx +8 -4
- package/src/BottomSheet/BottomSheetSwitcher.spec.md +45 -48
- package/src/BottomSheet/BottomSheetSwitcher.test.tsx +26 -0
- package/src/BottomSheet/BottomSheetSwitcher.tsx +6 -0
- package/src/Calendar/Calendar.test.tsx +68 -24
- package/src/Calendar/Calendar.tsx +2 -1
- package/src/CheckboxInput/CheckboxInput.test.tsx +44 -5
- package/src/CheckboxInput/CheckboxInput.tsx +16 -26
- package/src/CheckboxInput/__tests__/Checkbox.a11y.states.ts +3 -3
- package/src/CheckboxList/CheckboxList.test.tsx +9 -6
- package/src/ClickableCard/ClickableCard.doc.mjs +2 -2
- package/src/ClickableCard/ClickableCard.test.tsx +5 -4
- package/src/ClickableCard/ClickableCard.tsx +9 -9
- package/src/CodeBlock/CodeBlock.highlightStyles.test.tsx +87 -0
- package/src/CodeBlock/CodeBlock.tsx +11 -1
- package/src/ComplexSelector/ComplexSelector.focusableDisabled.test.tsx +76 -0
- package/src/ComplexSelector/ComplexSelector.tsx +21 -4
- package/src/ContextMenu/ContextMenu.test.tsx +41 -0
- package/src/DateInput/DateInput.doc.mjs +9 -8
- package/src/DateInput/DateInput.test.tsx +88 -13
- package/src/DateInput/DateInput.tsx +49 -21
- package/src/DateInput/DateInputTouch.test.tsx +22 -1
- package/src/DateInput/NativeDateField.test.tsx +29 -3
- package/src/DateInput/NativeDateField.tsx +20 -7
- package/src/DateInput/TouchDateField.tsx +24 -9
- package/src/DateRangeInput/DateRangeInput.doc.mjs +6 -5
- package/src/DateRangeInput/DateRangeInput.test.tsx +82 -16
- package/src/DateRangeInput/DateRangeInput.tsx +40 -20
- package/src/Dialog/Dialog.test.tsx +39 -0
- package/src/Dialog/Dialog.tsx +9 -4
- package/src/DropdownMenu/DropdownMenu.spec.md +33 -2
- package/src/DropdownMenu/DropdownMenu.tsx +79 -8
- package/src/DropdownMenu/DropdownMenuContext.public.test.ts +22 -0
- package/src/DropdownMenu/DropdownMenuContext.tsx +39 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +16 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +623 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +556 -99
- package/src/DropdownMenu/__tests__/SubMenuHeaderFooter.a11y.chromium.spec.ts +267 -0
- package/src/DropdownMenu/menuRegionStops.ts +2 -2
- package/src/DropdownMenu/modules/useMenuPress.spec.md +9 -0
- package/src/FieldStatus/FieldStatus.spec.md +3 -2
- package/src/FileInput/FileInput.test.tsx +30 -7
- package/src/FileInput/FileInput.tsx +21 -11
- package/src/Link/Link.test.tsx +21 -7
- package/src/Link/Link.tsx +16 -24
- package/src/Link/__tests__/Link.a11y.states.ts +1 -1
- package/src/Markdown/Markdown.rerender.test.tsx +143 -0
- package/src/Markdown/Markdown.tsx +89 -35
- package/src/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.ts +71 -0
- package/src/MultiSelector/MultiSelector.doc.mjs +5 -5
- package/src/MultiSelector/MultiSelector.focusableDisabled.test.tsx +121 -0
- package/src/MultiSelector/MultiSelector.test.tsx +49 -7
- package/src/MultiSelector/MultiSelector.tsx +53 -29
- package/src/Pagination/Pagination.test.tsx +5 -1
- package/src/Pagination/Pagination.tsx +3 -1
- package/src/Popover/Popover.test.tsx +15 -0
- package/src/Popover/Popover.tsx +19 -8
- package/src/PowerSearch/PowerSearchFilterEditor.test.tsx +3 -2
- package/src/PowerSearch/PowerSearchToken.test.tsx +7 -5
- package/src/Selector/Selector.doc.mjs +4 -4
- package/src/Selector/Selector.focusableDisabled.test.tsx +127 -0
- package/src/Selector/Selector.test.tsx +48 -6
- package/src/Selector/Selector.tsx +51 -21
- package/src/SideNav/SideNav.test.tsx +35 -0
- package/src/Slider/Slider.test.tsx +3 -3
- package/src/Slider/Slider.tsx +8 -15
- package/src/Switch/Switch.test.tsx +85 -8
- package/src/Switch/Switch.tsx +26 -16
- package/src/Switch/__tests__/Switch.a11y.states.ts +2 -2
- package/src/Switch/switch.markers.stylex.ts +4 -0
- package/src/Table/plugins/selection/useTableSelection.test.tsx +5 -3
- package/src/TimeInput/TimeInput.doc.mjs +5 -3
- package/src/TimeInput/TimeInput.test.tsx +20 -0
- package/src/TimeInput/TimeInput.tsx +2 -1
- package/src/Timestamp/Timestamp.doc.mjs +1 -1
- package/src/Timestamp/Timestamp.test.tsx +168 -0
- package/src/Timestamp/Timestamp.tsx +62 -11
- package/src/Token/Token.test.tsx +26 -4
- package/src/Token/Token.tsx +6 -2
- package/src/Tooltip/Tooltip.test.tsx +51 -6
- package/src/Tooltip/Tooltip.tsx +41 -18
- package/src/Tooltip/__tests__/Tooltip.a11y.chromium.spec.ts +129 -0
- package/src/Tooltip/__tests__/Tooltip.a11y.renders.tsx +86 -0
- package/src/Tooltip/__tests__/Tooltip.a11y.states.ts +132 -0
- package/src/Tooltip/__tests__/Tooltip.a11y.test.tsx +126 -0
- package/src/TopNav/TopNav.tsx +11 -1
- package/src/TopNav/TopNavHeading.tsx +1 -0
- package/src/TopNav/__tests__/TopNavMobileLongHeading.a11y.chromium.spec.ts +74 -0
- package/src/TreeList/TreeList.test.tsx +28 -0
- package/src/TreeList/TreeListItem.tsx +6 -2
- package/src/__tests__/DisabledTriggerFocus.a11y.chromium.spec.ts +86 -0
- package/src/hooks/useGridFocus.ts +16 -1
- package/src/hooks/useMenuPress.ts +45 -7
- package/src/utils/disabledInteraction.ts +40 -0
- package/src/utils/timeParser.test.ts +11 -0
- package/src/utils/timeParser.ts +9 -2
|
@@ -122,6 +122,11 @@ const sizeStyles = {
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
const styles = {
|
|
125
|
+
disabledFocusRing: {
|
|
126
|
+
kVAM5u: "xvy26l8 x2uiyk",
|
|
127
|
+
kGVxlE: "x1gnnqk1 xxsos93",
|
|
128
|
+
$$css: true
|
|
129
|
+
},
|
|
125
130
|
wrapper: {
|
|
126
131
|
kOIVth: "x1txdalj",
|
|
127
132
|
$$css: true
|
|
@@ -276,11 +281,11 @@ export function TouchDateField({
|
|
|
276
281
|
const isBusy = isLoading || optimisticValue !== value;
|
|
277
282
|
const isEffectivelyDisabled = isDisabled || isBusy;
|
|
278
283
|
|
|
279
|
-
//
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
//
|
|
283
|
-
//
|
|
284
|
+
// Same contract as DateInput: a disabled or busy field never renders native
|
|
285
|
+
// `disabled` (spec:AST-085 FR1); the input stays focusable via
|
|
286
|
+
// aria-disabled. The disabled-reason tooltip's listeners attach to the
|
|
287
|
+
// wrapper. Only the persistent disabled state surfaces a reason, never the
|
|
288
|
+
// transient busy one.
|
|
284
289
|
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
285
290
|
const disabledMessageTooltip = useTooltip({
|
|
286
291
|
placement: 'above',
|
|
@@ -791,14 +796,14 @@ export function TouchDateField({
|
|
|
791
796
|
size,
|
|
792
797
|
status: status?.type ?? null,
|
|
793
798
|
disabled: isDisabled ? 'disabled' : null
|
|
794
|
-
}), stylex.props(inputWrapperStyles.base, sizeStyles[size], styles.wrapper, isEffectivelyDisabled && inputWrapperStyles.disabled, status && inputStatusBorderStyles[status.type], status && !isEffectivelyDisabled && inputStatusHoverShadowStyles[status.type], status && inputStatusFocusWithinStyles[status.type], inputGroup && groupStyles.inGroup, controlXstyle), controlClassName, controlStyle),
|
|
799
|
+
}), stylex.props(inputWrapperStyles.base, sizeStyles[size], styles.wrapper, isEffectivelyDisabled && inputWrapperStyles.disabled, isEffectivelyDisabled && styles.disabledFocusRing, status && inputStatusBorderStyles[status.type], status && !isEffectivelyDisabled && inputStatusHoverShadowStyles[status.type], status && inputStatusFocusWithinStyles[status.type], inputGroup && groupStyles.inGroup, controlXstyle), controlClassName, controlStyle),
|
|
795
800
|
children: [inputGroup && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
796
801
|
id: inputLabelID,
|
|
797
802
|
children: label
|
|
798
803
|
}), /*#__PURE__*/_jsx("button", {
|
|
799
804
|
type: "button",
|
|
800
805
|
onClick: openSheet,
|
|
801
|
-
disabled: isEffectivelyDisabled,
|
|
806
|
+
"aria-disabled": isEffectivelyDisabled || undefined,
|
|
802
807
|
"aria-label": t('@astryx.dateInput.openCalendar'),
|
|
803
808
|
tabIndex: -1,
|
|
804
809
|
...stylex.props(focusOutlineStyles.focusVisible, styles.iconButton, isEffectivelyDisabled && styles.iconButtonDisabled),
|
|
@@ -825,11 +830,10 @@ export function TouchDateField({
|
|
|
825
830
|
readOnly: true,
|
|
826
831
|
inputMode: "none",
|
|
827
832
|
onChange: () => {},
|
|
828
|
-
onClick: chainEventHandlers(openSheet, onClickProp),
|
|
833
|
+
onClick: isEffectivelyDisabled ? undefined : chainEventHandlers(openSheet, onClickProp),
|
|
829
834
|
onKeyDown: chainEventHandlers(handleInputKeyDown, onKeyDownProp),
|
|
830
835
|
placeholder: placeholder,
|
|
831
|
-
disabled: isEffectivelyDisabled
|
|
832
|
-
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
836
|
+
"aria-disabled": isEffectivelyDisabled ? 'true' : undefined,
|
|
833
837
|
"aria-labelledby": ariaLabelledByProp != null ? joinAriaIDs(ariaLabelledBy ?? fieldLabelID, ariaLabelledByProp) : ariaLabelledBy,
|
|
834
838
|
"aria-describedby": ariaDescribedBy,
|
|
835
839
|
"aria-required": isEffectivelyRequired ? 'true' : undefined,
|
|
@@ -43,12 +43,12 @@ export interface DateRangeInputProps extends Omit<FieldInputBaseProps<HTMLButton
|
|
|
43
43
|
/**
|
|
44
44
|
* Explains why the input is disabled. When set together with
|
|
45
45
|
* `isDisabled`, the input shows a tooltip with this text on hover and
|
|
46
|
-
* keyboard focus, and the trigger
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* keyboard focus, and the trigger is described by it, so the reason is
|
|
47
|
+
* discoverable by keyboard and assistive technology. Activation stays
|
|
48
|
+
* blocked.
|
|
49
49
|
*
|
|
50
|
-
* Use this instead of wrapping a disabled input in `Tooltip
|
|
51
|
-
*
|
|
50
|
+
* Use this instead of wrapping a disabled input in `Tooltip`, so the
|
|
51
|
+
* reason is tied to the field.
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
54
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../src/DateRangeInput/DateRangeInput.tsx"],"names":[],"mappings":"AA4CA,OAAO,EAGL,KAAK,WAAW,EAKhB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAIlB,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,aA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ACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAEnC;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAEvB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,QAAe,EACf,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,cAAkB,EAClB,YAAY,EACZ,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,GAAG,SAAS,EACb,EAAE,mBAAmB,+BAqVrB;yBAxXe,cAAc"}
|
|
@@ -41,6 +41,11 @@ import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
|
41
41
|
import { useLocale, useTranslator } from "../i18n/index.js";
|
|
42
42
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
43
43
|
const styles = {
|
|
44
|
+
disabledFocusRing: {
|
|
45
|
+
kVAM5u: "xvy26l8 x6q1khz",
|
|
46
|
+
kGVxlE: "x1gnnqk1 xuihb5h",
|
|
47
|
+
$$css: true
|
|
48
|
+
},
|
|
44
49
|
iconButton: {
|
|
45
50
|
k1xSpc: "x78zum5",
|
|
46
51
|
kGNEyG: "x6s0dn4",
|
|
@@ -234,12 +239,12 @@ export function DateRangeInput({
|
|
|
234
239
|
const isBusy = isLoading || optimisticValue !== value;
|
|
235
240
|
const isEffectivelyDisabled = isDisabled || isBusy;
|
|
236
241
|
|
|
237
|
-
//
|
|
238
|
-
//
|
|
239
|
-
//
|
|
240
|
-
// disabled
|
|
241
|
-
//
|
|
242
|
-
//
|
|
242
|
+
// A disabled or busy field never renders native `disabled` (spec:AST-085
|
|
243
|
+
// FR1): its buttons stay focusable via aria-disabled, and activation is
|
|
244
|
+
// blocked by the isEffectivelyDisabled guard in handleToggle. The
|
|
245
|
+
// disabled-reason tooltip's listeners attach to the trigger container. Only
|
|
246
|
+
// the persistent isDisabled state (not the transient busy state) surfaces a
|
|
247
|
+
// reason.
|
|
243
248
|
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
244
249
|
const disabledMessageTooltip = useTooltip({
|
|
245
250
|
placement: 'above',
|
|
@@ -343,11 +348,11 @@ export function DateRangeInput({
|
|
|
343
348
|
size,
|
|
344
349
|
status: status?.type ?? null,
|
|
345
350
|
disabled: isDisabled ? 'disabled' : null
|
|
346
|
-
}), stylex.props(inputWrapperStyles.base, sizeStyles[size], isEffectivelyDisabled && inputWrapperStyles.disabled, status && inputStatusBorderStyles[status.type], status && !isEffectivelyDisabled && inputStatusHoverShadowStyles[status.type], status && inputStatusFocusWithinStyles[status.type], controlXstyle), controlClassName, controlStyle),
|
|
351
|
+
}), stylex.props(inputWrapperStyles.base, sizeStyles[size], isEffectivelyDisabled && inputWrapperStyles.disabled, isEffectivelyDisabled && styles.disabledFocusRing, status && inputStatusBorderStyles[status.type], status && !isEffectivelyDisabled && inputStatusHoverShadowStyles[status.type], status && inputStatusFocusWithinStyles[status.type], controlXstyle), controlClassName, controlStyle),
|
|
347
352
|
children: [/*#__PURE__*/_jsx("button", {
|
|
348
353
|
type: "button",
|
|
349
354
|
onClick: handleToggle,
|
|
350
|
-
disabled: isEffectivelyDisabled,
|
|
355
|
+
"aria-disabled": isEffectivelyDisabled || undefined,
|
|
351
356
|
"aria-label": popover.isOpen ? t('@astryx.dateInput.toggleCalendarClose') : t('@astryx.dateInput.openCalendar'),
|
|
352
357
|
tabIndex: -1,
|
|
353
358
|
...stylex.props(focusOutlineStyles.focusVisible, styles.iconButton, isEffectivelyDisabled && styles.iconButtonDisabled),
|
|
@@ -363,14 +368,12 @@ export function DateRangeInput({
|
|
|
363
368
|
...controlProps,
|
|
364
369
|
ref: triggerButtonRef,
|
|
365
370
|
id: id,
|
|
366
|
-
type: "button"
|
|
367
|
-
|
|
368
|
-
//
|
|
369
|
-
// aria-disabled so the reason is focus-discoverable; activation is
|
|
370
|
-
// still blocked by the isEffectivelyDisabled guard in handleToggle.
|
|
371
|
+
type: "button"
|
|
372
|
+
// The browser still dispatches a click on an aria-disabled button,
|
|
373
|
+
// so a caller's onClick is skipped too (spec:AST-085 FR2).
|
|
371
374
|
,
|
|
372
|
-
|
|
373
|
-
"aria-disabled":
|
|
375
|
+
onClick: isEffectivelyDisabled ? undefined : chainEventHandlers(handleToggle, onClickProp),
|
|
376
|
+
"aria-disabled": isEffectivelyDisabled ? 'true' : undefined
|
|
374
377
|
// A caller aria-label replaces the trigger's name; a caller
|
|
375
378
|
// aria-labelledby is read after it (label and selected range).
|
|
376
379
|
,
|
|
@@ -433,9 +436,15 @@ export function DateRangeInput({
|
|
|
433
436
|
// marked with aria-current (not aria-selected, a listbox
|
|
434
437
|
// concept that contradicted the Tab interaction) (forms-5).
|
|
435
438
|
,
|
|
436
|
-
"aria-current": isActive ? 'true' : undefined
|
|
437
|
-
disabled:
|
|
438
|
-
|
|
439
|
+
"aria-current": isActive ? 'true' : undefined
|
|
440
|
+
// Focusable while disabled (AR3, spec:AST-085 FR1).
|
|
441
|
+
,
|
|
442
|
+
"aria-disabled": isPresetDisabled || undefined,
|
|
443
|
+
onClick: () => {
|
|
444
|
+
if (!isPresetDisabled) {
|
|
445
|
+
handleRangeSelect(presetRange);
|
|
446
|
+
}
|
|
447
|
+
},
|
|
439
448
|
...mergeProps(themeProps('date-range-input-preset', {
|
|
440
449
|
selected: isActive ? 'selected' : null,
|
|
441
450
|
disabled: isPresetDisabled ? 'disabled' : null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA2B5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAMhD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAyB9C;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD,4EAA4E;AAC5E,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,mBAAmB;IACzD,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAuBD,2FAA2F;AAC3F,eAAO,MAAM,uCAAuC;;;;;;;;;;;CAW1C,CAAC;AAoJX;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAA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ACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,QAAgB,EAChB,YAAY,EACZ,KAAW,EACX,SAAmB,EACnB,QAAQ,EACR,OAAoB,EACpB,OAAgB,EAChB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,sCA4Vb;yBA5We,MAAM"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -472,11 +472,16 @@ export function Dialog({
|
|
|
472
472
|
// Escape presses the stack owns never arrive here — it preventDefault()s
|
|
473
473
|
// those, which suppresses the close watcher.
|
|
474
474
|
//
|
|
475
|
-
//
|
|
476
|
-
//
|
|
477
|
-
//
|
|
478
|
-
//
|
|
475
|
+
// A `cancel` that bubbles up from inside is not a close request for this
|
|
476
|
+
// dialog: a file input fires one when its picker is dismissed. It is left
|
|
477
|
+
// alone. Otherwise always preventDefault so the browser cannot close a
|
|
478
|
+
// controlled <dialog> behind React's back, then answer the request with the
|
|
479
|
+
// stack's own rules: only the top-most layer dismisses, a `required` dialog
|
|
480
|
+
// swallows it, and nothing dismisses while an IME composition is in progress.
|
|
479
481
|
const handleCancel = event => {
|
|
482
|
+
if (event.target !== event.currentTarget) {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
480
485
|
event.preventDefault();
|
|
481
486
|
if (!shouldDismissOnCloseRequest()) {
|
|
482
487
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,WAAW,CAAC;AAKnD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,WAAW,CAAC;AAKnD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AA6B9D,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;AAO1C,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAStE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgM5C;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,qBAAqB,EACnB,MAAM,GACN,SAAS,GACT,YAAY,GACZ,SAAS,GACT,aAAa,GACb,YAAY,GACZ,kBAAkB,GAClB,MAAM,GACN,QAAQ,GACR,KAAK,CACR;IACC;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,KAAK,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,C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js";
|
|
|
42
42
|
import { Icon } from "../Icon/index.js";
|
|
43
43
|
import { renderDropdownItems } from "./renderDropdownItems.js";
|
|
44
44
|
import { MENU_ITEM_ROLES, MENU_ITEM_SELECTOR, MENU_BOUNDARY_SELECTOR, activateMenuItem } from "./menuItemRoles.js";
|
|
45
|
-
import { DropdownMenuContext, DropdownMenuRootOpenContext } from "./DropdownMenuContext.js";
|
|
45
|
+
import { DropdownMenuContext, DropdownMenuRootOpenContext, DropdownMenuSurfaceContext } from "./DropdownMenuContext.js";
|
|
46
46
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
47
47
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
48
48
|
import { useMenuPress } from "../hooks/useMenuPress.js";
|
|
@@ -76,6 +76,13 @@ const MENU_BLOCK_CAP = '300px';
|
|
|
76
76
|
const MENU_MAX_BLOCK_SIZE = `min(${MENU_BLOCK_CAP}, ${layerViewportInset.maxBlockSize})`;
|
|
77
77
|
const MENU_MAX_BLOCK_SIZE_FALLBACK = `min(${MENU_BLOCK_CAP}, ${layerViewportInset.maxBlockSizeFallback})`;
|
|
78
78
|
const MENU_TRIGGER_OPEN_BACKGROUND = `linear-gradient(${colorVars['--color-overlay-pressed']}, ${colorVars['--color-overlay-pressed']})`;
|
|
79
|
+
|
|
80
|
+
// A sub-menu's drilled-in view with a header or footer renders in the surface
|
|
81
|
+
// host that follows the menu, as the frame marked
|
|
82
|
+
// `data-astryx-submenu-regions="view"` (hidden while a deeper view shows).
|
|
83
|
+
// While one shows, the menu and its header and footer step aside. The rule
|
|
84
|
+
// reads that from the DOM, so no state mirrors which view shows.
|
|
85
|
+
const STEPS_ASIDE_FOR_VIEW = ':has(~ * > [data-astryx-submenu-regions="view"]:not([hidden]))';
|
|
79
86
|
const _temp = {
|
|
80
87
|
kzqmXN: "x1uyokj7",
|
|
81
88
|
"$$css": true
|
|
@@ -92,7 +99,7 @@ const styles = {
|
|
|
92
99
|
},
|
|
93
100
|
dropdown: {
|
|
94
101
|
kB7OPa: "x9f619",
|
|
95
|
-
k1xSpc: "x78zum5",
|
|
102
|
+
k1xSpc: "x78zum5 x1ab7gxt",
|
|
96
103
|
kXwgrk: "xdt5ytf",
|
|
97
104
|
kOIVth: "x1lsbc85",
|
|
98
105
|
kI3sdo: "x1a2a7pz",
|
|
@@ -1098,6 +1105,21 @@ function DropdownMenuPopover({
|
|
|
1098
1105
|
drillIn,
|
|
1099
1106
|
wrapContent
|
|
1100
1107
|
} = useMenuDrillIn(isOpen);
|
|
1108
|
+
// The surface host is owned through a ref. State keeps only a key that
|
|
1109
|
+
// changes whenever a host element attaches, the host included when it
|
|
1110
|
+
// moves (a header or footer coming or going), so sub-menus re-render into
|
|
1111
|
+
// the element that is mounted.
|
|
1112
|
+
const surfaceHostRef = useRef(null);
|
|
1113
|
+
const [surfaceHostKey, setSurfaceHostKey] = useState(0);
|
|
1114
|
+
const attachSurfaceHost = useCallback(node => {
|
|
1115
|
+
surfaceHostRef.current = node;
|
|
1116
|
+
if (node != null) {
|
|
1117
|
+
setSurfaceHostKey(key => key + 1);
|
|
1118
|
+
}
|
|
1119
|
+
}, []);
|
|
1120
|
+
const surfaceHost = useMemo(() => ({
|
|
1121
|
+
getElement: () => surfaceHostKey > 0 ? surfaceHostRef.current : null
|
|
1122
|
+
}), [surfaceHostKey]);
|
|
1101
1123
|
const resolvedMaxHeight = menuMaxHeight == null ? null : `${menuMaxHeight}px`;
|
|
1102
1124
|
// Context for compound items
|
|
1103
1125
|
const contextValue = useMemo(() => ({
|
|
@@ -1106,31 +1128,48 @@ function DropdownMenuPopover({
|
|
|
1106
1128
|
drillIn,
|
|
1107
1129
|
menuLabel
|
|
1108
1130
|
}), [closeMenu, menuSize, drillIn, menuLabel]);
|
|
1131
|
+
// What a sub-menu with a header or footer needs, on an internal context.
|
|
1132
|
+
const surfaceValue = useMemo(() => ({
|
|
1133
|
+
host: surfaceHost,
|
|
1134
|
+
ownerId: menuId,
|
|
1135
|
+
menuMaxHeight: resolvedMaxHeight ?? undefined
|
|
1136
|
+
}), [surfaceHost, menuId, resolvedMaxHeight]);
|
|
1109
1137
|
|
|
1110
1138
|
// Resolve menu content: data-driven items become components
|
|
1111
1139
|
const menuContent = wrapContent(props.items !== undefined ? renderDropdownItems(items) : children);
|
|
1112
1140
|
const hasOverflow = useMenuOverflow(listRef, menuContent, popover.isOpen);
|
|
1113
1141
|
|
|
1114
1142
|
// The header and footer sit beside the menu inside the popover, never inside
|
|
1115
|
-
// the role="menu" element: a menu holds only its rows.
|
|
1143
|
+
// the role="menu" element: a menu holds only its rows. The surface host
|
|
1144
|
+
// follows the menu, so a sub-menu with a header or footer renders beside the
|
|
1145
|
+
// menu too; while such a sub-menu's drilled-in view shows there, the menu and
|
|
1146
|
+
// the regions step aside (STEPS_ASIDE_FOR_VIEW).
|
|
1147
|
+
const surfaceHostElement = /*#__PURE__*/_jsx("div", {
|
|
1148
|
+
ref: attachSurfaceHost,
|
|
1149
|
+
...{
|
|
1150
|
+
className: "xjp7ctv"
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1116
1153
|
const renderWithRegions = menu => hasRegions ? /*#__PURE__*/_jsxs("div", {
|
|
1117
1154
|
...stylex.props(styles.regionsFrame, resolvedMaxHeight != null && dynamicStyles.menuMaxHeight(resolvedMaxHeight)),
|
|
1118
1155
|
children: [isRenderable(header) && /*#__PURE__*/_jsx("div", {
|
|
1119
1156
|
ref: headerRef,
|
|
1120
1157
|
onKeyDown: handleRegionKeyDown,
|
|
1121
1158
|
...{
|
|
1122
|
-
className: "x2lah0s x9epnlk"
|
|
1159
|
+
className: "x2lah0s x9epnlk x1ab7gxt"
|
|
1123
1160
|
},
|
|
1124
1161
|
children: header
|
|
1125
1162
|
}), menu, isRenderable(footer) && /*#__PURE__*/_jsx("div", {
|
|
1126
1163
|
ref: footerRef,
|
|
1127
1164
|
onKeyDown: handleRegionKeyDown,
|
|
1128
1165
|
...{
|
|
1129
|
-
className: "x2lah0s x9epnlk"
|
|
1166
|
+
className: "x2lah0s x9epnlk x1ab7gxt"
|
|
1130
1167
|
},
|
|
1131
1168
|
children: footer
|
|
1132
|
-
})]
|
|
1133
|
-
}) :
|
|
1169
|
+
}), surfaceHostElement]
|
|
1170
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
1171
|
+
children: [menu, surfaceHostElement]
|
|
1172
|
+
});
|
|
1134
1173
|
const triggerProps = {
|
|
1135
1174
|
ref: el => {
|
|
1136
1175
|
buttonRef.current = el;
|
|
@@ -1228,9 +1267,12 @@ function DropdownMenuPopover({
|
|
|
1228
1267
|
value: hasRegions,
|
|
1229
1268
|
children: /*#__PURE__*/_jsx(DropdownMenuContext, {
|
|
1230
1269
|
value: contextValue,
|
|
1231
|
-
children: /*#__PURE__*/_jsx(
|
|
1232
|
-
value:
|
|
1233
|
-
children:
|
|
1270
|
+
children: /*#__PURE__*/_jsx(DropdownMenuSurfaceContext, {
|
|
1271
|
+
value: surfaceValue,
|
|
1272
|
+
children: /*#__PURE__*/_jsx(DropdownMenuRootOpenContext, {
|
|
1273
|
+
value: isOpen,
|
|
1274
|
+
children: menuContent
|
|
1275
|
+
})
|
|
1234
1276
|
})
|
|
1235
1277
|
})
|
|
1236
1278
|
})
|
|
@@ -25,7 +25,10 @@ export interface DropdownMenuDrillIn {
|
|
|
25
25
|
viewStack: ReadonlyArray<string>;
|
|
26
26
|
/** The element a shown view renders its rows into (a portal target). */
|
|
27
27
|
host: HTMLElement | null;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Show a sub-menu's view in place of the current rows. A view with a header
|
|
30
|
+
* or footer renders into the root's surface host instead of `host`.
|
|
31
|
+
*/
|
|
29
32
|
push: (viewId: string) => void;
|
|
30
33
|
/** Return to the rows the shown view replaced. */
|
|
31
34
|
pop: () => void;
|
|
@@ -43,6 +46,36 @@ export interface DropdownMenuContextValue {
|
|
|
43
46
|
*/
|
|
44
47
|
menuLabel?: string;
|
|
45
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* The root's surface host. The root owns the element through a ref; this
|
|
51
|
+
* object is new whenever a new element attaches, so a sub-menu re-renders
|
|
52
|
+
* into it.
|
|
53
|
+
*/
|
|
54
|
+
export interface DropdownMenuSurfaceHost {
|
|
55
|
+
/** The host element, or `null` before it attaches. */
|
|
56
|
+
getElement: () => HTMLElement | null;
|
|
57
|
+
}
|
|
58
|
+
/** What a sub-menu with a header or footer needs from the root. Internal. */
|
|
59
|
+
export interface DropdownMenuSurfaceValue {
|
|
60
|
+
/**
|
|
61
|
+
* An element inside the root's popover but outside every `role="menu"`
|
|
62
|
+
* element, where such a sub-menu renders its surface (its flyout layer, or
|
|
63
|
+
* its drilled-in view, while which the root's menu and regions step aside).
|
|
64
|
+
*/
|
|
65
|
+
host: DropdownMenuSurfaceHost;
|
|
66
|
+
/**
|
|
67
|
+
* The root menu's `id`, which a sub-menu's menu in the host names so the
|
|
68
|
+
* press model counts it, and only it, as nested in the root.
|
|
69
|
+
*/
|
|
70
|
+
ownerId: string;
|
|
71
|
+
/** The root's resolved `menuMaxHeight`, which a drilled-in view caps at. */
|
|
72
|
+
menuMaxHeight?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The root's surface; `null` under a root with none (ContextMenu). Internal,
|
|
76
|
+
* off the public menu context, and layer-scoped, so each flyout re-provides it.
|
|
77
|
+
*/
|
|
78
|
+
export declare const DropdownMenuSurfaceContext: import("react").Context<DropdownMenuSurfaceValue | null>;
|
|
46
79
|
/**
|
|
47
80
|
* Whether the root menu of this layer tree is open; internal companion to
|
|
48
81
|
* `DropdownMenuContext`, on its own unexported context so the public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuContext.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuContext.tsx"],"names":[],"mappings":"AAmBA,uDAAuD;AACvD,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,4EAA4E;IAC5E,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC,wEAAwE;IACxE,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB
|
|
1
|
+
{"version":3,"file":"DropdownMenuContext.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuContext.tsx"],"names":[],"mappings":"AAmBA,uDAAuD;AACvD,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,4EAA4E;IAC5E,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC,wEAAwE;IACxE,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB;;;OAGG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,kDAAkD;IAClD,GAAG,EAAE,MAAM,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,uEAAuE;IACvE,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,yCAAyC;IACzC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,sEAAsE;IACtE,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;CACtC;AAED,6EAA6E;AAC7E,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,IAAI,EAAE,uBAAuB,CAAC;IAC9B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,0DAC0B,CAAC;AAGlE;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,yCAEjC,CAAC;AAGR;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD;AAED,eAAO,MAAM,mBAAmB,0DACiC,CAAC;AAGlE;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,wBAAwB,GAAG,IAAI,CAExE;AAMD,MAAM,WAAW,kCAAkC;IACjD,iDAAiD;IACjD,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,qEAAqE;IACrE,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,6BAA6B,oEACsB,CAAC;AAGjE;;;GAGG;AACH,wBAAgB,gCAAgC,IAAI,kCAAkC,GAAG,IAAI,CAE5F"}
|
|
@@ -32,6 +32,21 @@ import { createLayerScopedContext } from "../Layer/layerScopedContext.js";
|
|
|
32
32
|
* @internal
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* The root's surface host. The root owns the element through a ref; this
|
|
37
|
+
* object is new whenever a new element attaches, so a sub-menu re-renders
|
|
38
|
+
* into it.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/** What a sub-menu with a header or footer needs from the root. Internal. */
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The root's surface; `null` under a root with none (ContextMenu). Internal,
|
|
45
|
+
* off the public menu context, and layer-scoped, so each flyout re-provides it.
|
|
46
|
+
*/
|
|
47
|
+
export const DropdownMenuSurfaceContext = createLayerScopedContext(null);
|
|
48
|
+
DropdownMenuSurfaceContext.displayName = 'DropdownMenuSurfaceContext';
|
|
49
|
+
|
|
35
50
|
/**
|
|
36
51
|
* Whether the root menu of this layer tree is open; internal companion to
|
|
37
52
|
* `DropdownMenuContext`, on its own unexported context so the public
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* Spinner, and DropdownMenu context + item roles
|
|
6
6
|
* @output Exports DropdownMenuSubMenu — a single menu row that reveals a nested
|
|
7
7
|
* menu of its own children/items: a flyout beside the row, or, on a phone,
|
|
8
|
-
* a drilled-in view in place of the parent rows.
|
|
8
|
+
* a drilled-in view in place of the parent rows. With a header or footer,
|
|
9
|
+
* that surface is a modal dialog rendered into the root's surface host,
|
|
10
|
+
* beside every menu element.
|
|
9
11
|
* @position Sub-component; place inside a DropdownMenu (or ContextMenu)
|
|
10
12
|
* alongside plain items.
|
|
11
13
|
*
|
|
@@ -83,13 +85,30 @@ interface DropdownMenuSubMenuBaseProps extends Omit<BaseProps, 'role' | 'tabInde
|
|
|
83
85
|
* 'adaptive'
|
|
84
86
|
*/
|
|
85
87
|
presentation?: DropdownMenuSubMenuPresentation;
|
|
88
|
+
/**
|
|
89
|
+
* Content above the sub-menu's rows: a field that filters them, say. Like
|
|
90
|
+
* the root menu's `header`, it sits beside the sub-menu's `role="menu"`
|
|
91
|
+
* element, never inside it, and keeps its own keys and presses. With a
|
|
92
|
+
* header or footer the sub-menu's surface (the flyout, or the drilled-in
|
|
93
|
+
* view on a phone) is a modal dialog named by the row: the row says
|
|
94
|
+
* `aria-haspopup="dialog"`, Tab and Shift+Tab walk the header's controls,
|
|
95
|
+
* the rows as one stop and the footer's controls and wrap, and Escape
|
|
96
|
+
* returns to the row. A pointer leaving the flyout does not close it while
|
|
97
|
+
* focus is inside. A `ContextMenu` does not show it.
|
|
98
|
+
*/
|
|
99
|
+
header?: ReactNode;
|
|
100
|
+
/**
|
|
101
|
+
* Content below the sub-menu's rows: a door to where the options are
|
|
102
|
+
* managed, say. Same rules as `header`.
|
|
103
|
+
*/
|
|
104
|
+
footer?: ReactNode;
|
|
86
105
|
/** Test id for the trigger row. */
|
|
87
106
|
'data-testid'?: string;
|
|
88
107
|
/** Test id for the flyout menu. */
|
|
89
108
|
menuDataTestId?: string;
|
|
90
109
|
/**
|
|
91
110
|
* Ref forwarded to the trigger row — the element carrying `role="menuitem"`
|
|
92
|
-
* and `aria-haspopup="menu"
|
|
111
|
+
* and `aria-haspopup="menu"` (`"dialog"` with a header or footer).
|
|
93
112
|
*/
|
|
94
113
|
ref?: React.Ref<HTMLElement>;
|
|
95
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuSubMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuSubMenu.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"DropdownMenuSubMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuSubMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAwC5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA6N5C,MAAM,MAAM,+BAA+B,GACzC,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAErC,UAAU,4BAA6B,SAAQ,IAAI,CACjD,SAAS,EACT,MAAM,GAAG,UAAU,CACpB;IACC,2DAA2D;IAC3D,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,8CAA8C;IAC9C,KAAK,EAAE,SAAS,CAAC;IACjB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,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