@astryxdesign/core 0.7.1-canary.c4df922 → 0.7.1-canary.cbafe4a
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/Button/Button.d.ts +1 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +5 -2
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +191 -32
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +12 -4
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +21 -2
- package/dist/Field/InputClearButton.d.ts +8 -4
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +23 -7
- package/dist/InputGroup/InputGroup.d.ts +2 -4
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +2 -4
- package/dist/InputGroup/groupStyles.d.ts +10 -2
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +19 -2
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +6 -0
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +57 -15
- package/dist/Resizable/useResizable.d.ts +23 -0
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +78 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +8 -0
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +10 -2
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +18 -7
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +6 -3
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +7 -1
- package/dist/astryx.css +6 -0
- package/dist/hooks/useTreeFocus.d.ts +21 -0
- package/dist/hooks/useTreeFocus.d.ts.map +1 -1
- package/dist/hooks/useTreeFocus.js +40 -2
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +1 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
- package/dist/utils/plainDate.d.ts +12 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +50 -6
- package/locales/en.json +4 -0
- package/locales/pseudo.json +3 -0
- package/package.json +3 -3
- package/src/AlertDialog/AlertDialog.doc.mjs +6 -0
- package/src/AlertDialog/AlertDialog.spec.md +205 -0
- package/src/AlertDialog/AlertDialog.test.tsx +3 -14
- package/src/AlertDialog/__tests__/AlertDialog.a11y.chromium.spec.ts +115 -0
- package/src/AlertDialog/__tests__/AlertDialog.a11y.renders.tsx +52 -0
- package/src/AlertDialog/__tests__/AlertDialog.a11y.states.ts +68 -0
- package/src/AlertDialog/__tests__/AlertDialog.a11y.test.tsx +144 -0
- package/src/Button/Button.test.tsx +37 -0
- package/src/Button/Button.tsx +5 -1
- package/src/Calendar/Calendar.doc.mjs +234 -60
- package/src/Calendar/Calendar.spec.md +209 -0
- package/src/Calendar/Calendar.test.tsx +559 -20
- package/src/Calendar/Calendar.tsx +258 -41
- package/src/Calendar/__tests__/Calendar.a11y.chromium.spec.ts +126 -0
- package/src/Calendar/__tests__/Calendar.a11y.known-failures.ts +12 -0
- package/src/Calendar/__tests__/Calendar.a11y.renders.tsx +57 -0
- package/src/Calendar/__tests__/Calendar.a11y.states.ts +139 -0
- package/src/Calendar/__tests__/Calendar.a11y.test.tsx +137 -0
- package/src/Carousel/Carousel.test.tsx +54 -71
- package/src/Carousel/__tests__/Carousel.a11y.chromium.spec.ts +192 -0
- package/src/Carousel/__tests__/Carousel.a11y.known-failures.ts +27 -0
- package/src/Carousel/__tests__/Carousel.a11y.renders.tsx +39 -0
- package/src/Carousel/__tests__/Carousel.a11y.states.ts +139 -0
- package/src/Carousel/__tests__/Carousel.a11y.test.tsx +127 -0
- package/src/Collapsible/CollapsibleGroup.spec.md +17 -8
- package/src/Collapsible/__tests__/CollapsibleGroup.a11y.renders.tsx +45 -0
- package/src/Collapsible/__tests__/CollapsibleGroup.a11y.states.ts +139 -0
- package/src/Collapsible/__tests__/CollapsibleGroup.a11y.test.tsx +135 -0
- package/src/Collapsible/__tests__/CollapsibleGroupAccordion.a11y.chromium.spec.ts +128 -0
- package/src/ComplexSelector/ComplexSelector.spec.md +14 -9
- package/src/DateInput/DateInput.spec.md +20 -10
- package/src/DateInput/DateInputTouch.test.tsx +22 -0
- package/src/DateInput/MonthScroller.tsx +12 -4
- package/src/DropdownMenu/DropdownMenu.spec.md +49 -16
- package/src/DropdownMenu/DropdownMenu.test.tsx +49 -0
- package/src/DropdownMenu/DropdownMenu.tsx +23 -2
- package/src/Field/InputClearButton.test.tsx +29 -4
- package/src/Field/InputClearButton.tsx +26 -8
- package/src/Grid/Grid.spec.md +50 -32
- package/src/InputGroup/InputGroup.doc.mjs +11 -1
- package/src/InputGroup/InputGroup.tsx +2 -4
- package/src/InputGroup/groupStyles.ts +40 -2
- package/src/Link/__tests__/Link.a11y.chromium.spec.ts +142 -0
- package/src/Link/__tests__/Link.a11y.renders.tsx +97 -0
- package/src/Link/__tests__/Link.a11y.states.ts +104 -0
- package/src/Link/__tests__/Link.a11y.test.tsx +127 -0
- package/src/Markdown/Markdown.fr23.perf.test.ts +161 -40
- package/src/MoreMenu/MoreMenu.spec.md +18 -7
- package/src/MoreMenu/MoreMenu.test.tsx +38 -0
- package/src/MultiSelector/MultiSelector.spec.md +1 -1
- package/src/PowerSearch/PowerSearchEditPopover.test.tsx +78 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +6 -0
- package/src/Resizable/Resizable.spec.md +39 -9
- package/src/Resizable/ResizeHandle.test.tsx +429 -2
- package/src/Resizable/ResizeHandle.tsx +81 -21
- package/src/Resizable/useResizable.ts +95 -0
- package/src/Selector/Selector.spec.md +23 -13
- package/src/Selector/Selector.test.tsx +52 -0
- package/src/Selector/Selector.tsx +8 -0
- package/src/SideNav/SideNav.test.tsx +35 -0
- package/src/SideNav/SideNav.tsx +16 -2
- package/src/Slider/Slider.spec.md +43 -17
- package/src/Slider/Slider.test.tsx +134 -0
- package/src/Slider/Slider.tsx +29 -6
- package/src/Slider/__tests__/Slider.a11y.chromium.spec.ts +112 -0
- package/src/Slider/__tests__/Slider.a11y.known-failures.ts +12 -0
- package/src/Slider/__tests__/Slider.a11y.renders.tsx +42 -0
- package/src/Slider/__tests__/Slider.a11y.states.ts +106 -0
- package/src/Slider/__tests__/Slider.a11y.test.tsx +105 -0
- package/src/TreeList/TreeList.spec.md +33 -8
- package/src/TreeList/TreeList.test.tsx +72 -0
- package/src/TreeList/TreeList.tsx +10 -6
- package/src/TreeList/TreeListItem.tsx +5 -0
- package/src/TreeList/__tests__/TreeList.a11y.chromium.spec.ts +125 -0
- package/src/TreeList/__tests__/TreeList.a11y.renders.tsx +44 -0
- package/src/TreeList/__tests__/TreeList.a11y.states.ts +164 -0
- package/src/TreeList/__tests__/TreeList.a11y.test.tsx +138 -0
- package/src/TreeList/__tests__/TreeListRowNames.a11y.chromium.spec.ts +82 -0
- package/src/hooks/useTreeFocus.test.tsx +37 -0
- package/src/hooks/useTreeFocus.ts +55 -2
- package/src/i18n/generated-locales/en.generated.ts +1 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
- package/src/utils/plainDate.test.ts +48 -0
- package/src/utils/plainDate.ts +53 -6
package/dist/Button/Button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Button.tsx
|
|
3
|
-
* @input Uses React, ButtonHTMLAttributes, ReactNode, i18n (useTranslator)
|
|
3
|
+
* @input Uses React, ButtonHTMLAttributes, ReactNode, i18n (useTranslator), group contexts
|
|
4
4
|
* @output Exports Button component, ButtonProps, ButtonVariant types
|
|
5
5
|
* @position Core implementation; consumed by index.ts, tested by Button.test.tsx
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAwB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAwB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AA4B3C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAMrD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAgI9C,QAAA,MAAM,UAAU;;;;;;;;;;EAUd,CAAC;AA2CH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,UAAU,CAAC;AAQjD,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC/D,w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AIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAuJD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,OAAqB,EACrB,IAAI,EAAE,QAAQ,EACd,IAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,eAAuB,EACvB,WAAW,EACX,IAAI,EACJ,UAAkB,EAClB,KAAK,EACL,SAAkB,EAClB,QAAQ,EACR,UAAU,EACV,OAAO,EACP,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,SAAS,CAmQzB;yBA5Re,MAAM"}
|
package/dist/Button/Button.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Button.tsx
|
|
7
|
-
* @input Uses React, ButtonHTMLAttributes, ReactNode, i18n (useTranslator)
|
|
7
|
+
* @input Uses React, ButtonHTMLAttributes, ReactNode, i18n (useTranslator), group contexts
|
|
8
8
|
* @output Exports Button component, ButtonProps, ButtonVariant types
|
|
9
9
|
* @position Core implementation; consumed by index.ts, tested by Button.test.tsx
|
|
10
10
|
*
|
|
@@ -29,6 +29,8 @@ import { iconBoxSizeStyles } from "../Icon/IconSize.stylex.js";
|
|
|
29
29
|
import { EDGE_COMP_ATTR } from "../Layout/edgeCompensation.stylex.js";
|
|
30
30
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
31
31
|
import { useButtonGroup } from "../ButtonGroup/ButtonGroupContext.js";
|
|
32
|
+
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
33
|
+
import { groupStyles as inputGroupStyles } from "../InputGroup/groupStyles.js";
|
|
32
34
|
import { mergeProps } from "../utils/index.js";
|
|
33
35
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
34
36
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
@@ -347,6 +349,7 @@ export function Button({
|
|
|
347
349
|
const t = useTranslator();
|
|
348
350
|
const size = useSize(sizeProp, 'md');
|
|
349
351
|
const buttonGroup = useButtonGroup();
|
|
352
|
+
const inputGroup = useInputGroup();
|
|
350
353
|
const [isPending, startTransition] = useTransition();
|
|
351
354
|
// clickAction is normally fire-once (submit/save/pay), so a same-tick
|
|
352
355
|
// double-click must dedupe — which neither isPending nor useOptimistic do.
|
|
@@ -428,7 +431,7 @@ export function Button({
|
|
|
428
431
|
} : null;
|
|
429
432
|
|
|
430
433
|
// Shared StyleX props for both button and link rendering
|
|
431
|
-
const sharedStylexProps = focusOutlineProps.focusVisible(styles.base, sizeStyles[size], isIconOnly && styles.iconOnly, interactionOverlayStyles.backgroundImage, buttonDisabled && styles.inactive, visuallyDisabled && styles.disabled, useAriaDisabled && styles.ariaDisabled, renderAsLink && styles.link, !buttonGroup && styles.pressable, buttonGroup && (buttonGroup.orientation === 'horizontal' ? groupStyles.horizontal : groupStyles.vertical), buttonGroup && (variant === 'primary' || variant === 'destructive') && (buttonGroup.orientation === 'horizontal' ? groupStyles.onSolidHorizontal : groupStyles.onSolidVertical),
|
|
434
|
+
const sharedStylexProps = focusOutlineProps.focusVisible(styles.base, sizeStyles[size], isIconOnly && styles.iconOnly, interactionOverlayStyles.backgroundImage, buttonDisabled && styles.inactive, visuallyDisabled && styles.disabled, useAriaDisabled && styles.ariaDisabled, renderAsLink && styles.link, !buttonGroup && styles.pressable, buttonGroup && (buttonGroup.orientation === 'horizontal' ? groupStyles.horizontal : groupStyles.vertical), inputGroup != null && buttonGroup == null && inputGroupStyles.buttonAddon, buttonGroup && (variant === 'primary' || variant === 'destructive') && (buttonGroup.orientation === 'horizontal' ? groupStyles.onSolidHorizontal : groupStyles.onSolidVertical),
|
|
432
435
|
// Standalone floating buttons only — a grouped button's elevation is owned
|
|
433
436
|
// by the ButtonGroup so the shared surface lifts as one unit.
|
|
434
437
|
!buttonGroup && elevationStyles[elevation], width != null && dynamicStyles.width(width),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAsD5C,YAAY,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,EACV,MAAM,oBAAoB,CAAC;AAS5B,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,UAAU,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C;AAID,UAAU,iBAAkB,SAAQ,IAAI,CACtC,SAAS,CAAC,cAAc,CAAC,EACzB,UAAU,GAAG,cAAc,CAC5B;IACC,kDAAkD;IAClD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACtC,+CAA+C;IAC/C,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAEvB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,aAAa,CAAC;IAEpB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,aAAa,CAAC;IAEpB;;;OAGG;IACH,eAAe,CAAC,E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B,QAAQ,CAAC,EAAC,GAAG,EAAE,GAAG,KAAK,EAAC,EAAE,aAAa,+BAghBtD;yBAhhBe,QAAQ"}
|
|
@@ -24,7 +24,7 @@ import { Icon } from "../Icon/index.js";
|
|
|
24
24
|
import { useAnnounce, useGridFocus } from "../hooks/index.js";
|
|
25
25
|
import { useCalendarDays, useCalendarConstraints } from "./hooks/index.js";
|
|
26
26
|
import { calendarStyles, monthGridStyles, dayCellStyles, dayCellTheme } from "./styles.js";
|
|
27
|
-
import { plainDateFromISO, plainDateToISO, plainDateToDate, plainDateToday, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateAddDays, plainDateIsBefore, plainDateIsEqual, plainDateGetWeekNumber, plainDateFormat, DATE_FORMAT_WITH_WEEKDAY, DATE_FORMAT_MONTH_YEAR } from "../utils/plainDate.js";
|
|
27
|
+
import { plainDateFromISO, plainDateToISO, plainDateToDate, plainDateToday, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateAddDays, plainDateDiffDays, getDaysInMonth, plainDateIsAfter, plainDateIsBefore, plainDateIsEqual, plainDateGetWeekNumber, plainDateFormat, plainDateWeekFieldName, DATE_FORMAT_WITH_WEEKDAY, DATE_FORMAT_MONTH_YEAR } from "../utils/plainDate.js";
|
|
28
28
|
import { mergeProps, composeEventHandlers, rtlStyles } from "../utils/index.js";
|
|
29
29
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
30
30
|
import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
|
|
@@ -39,6 +39,9 @@ import { computeDayCellState, computeRangeRounding, computePreviewRounding, comp
|
|
|
39
39
|
import { normalizeDayOfWeek } from "../utils/dateTypes.js";
|
|
40
40
|
import { themeProps } from "../utils/themeProps.js";
|
|
41
41
|
import { useLocale, useTranslator } from "../i18n/index.js";
|
|
42
|
+
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
43
|
+
|
|
44
|
+
/** How a month navigation moves the focused day: by its row offset in days, or by whole months. */
|
|
42
45
|
|
|
43
46
|
/** Imperative handle for Calendar handleRef */
|
|
44
47
|
|
|
@@ -46,6 +49,22 @@ import { useLocale, useTranslator } from "../i18n/index.js";
|
|
|
46
49
|
|
|
47
50
|
// ─── Mode-specific Props (discriminated union) ────────────────
|
|
48
51
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
52
|
+
/** The first day of `month`'s month that `isDisabled` allows, or null. */
|
|
53
|
+
function firstEnabledDayOfMonth(month, isDisabled) {
|
|
54
|
+
const days = getDaysInMonth(month.year, month.month);
|
|
55
|
+
for (let day = 1; day <= days; day += 1) {
|
|
56
|
+
const pd = {
|
|
57
|
+
year: month.year,
|
|
58
|
+
month: month.month,
|
|
59
|
+
day
|
|
60
|
+
};
|
|
61
|
+
if (!isDisabled(pd)) {
|
|
62
|
+
return pd;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
49
68
|
// =============================================================================
|
|
50
69
|
// Main Component
|
|
51
70
|
// =============================================================================
|
|
@@ -157,6 +176,30 @@ export function Calendar({
|
|
|
157
176
|
});
|
|
158
177
|
}, [baseMonth, numberOfMonths]);
|
|
159
178
|
|
|
179
|
+
// A pending target is claimed by the grid that shows its month, or dropped
|
|
180
|
+
// by the next focus move that is not onto the target day: when a controlled
|
|
181
|
+
// owner refuses the month change, no grid shows the target's month, and a
|
|
182
|
+
// stale target would later steal focus (and Enter) when that month does
|
|
183
|
+
// appear. Only a grid showing the target's month receives it; any other
|
|
184
|
+
// focus change (an arrow to another day, the month header's buttons, or out
|
|
185
|
+
// of the calendar) drops it (see onBlur below).
|
|
186
|
+
const claimablePendingFocus = useMemo(() => {
|
|
187
|
+
if (pendingFocus == null) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const target = plainDateFromISO(pendingFocus);
|
|
191
|
+
return visibleMonths.some(pd => pd.year === target.year && pd.month === target.month) ? pendingFocus : null;
|
|
192
|
+
}, [pendingFocus, visibleMonths]);
|
|
193
|
+
const handleRootBlur = useCallback(e => {
|
|
194
|
+
// Only the move onto the target day itself keeps the target: an arrow
|
|
195
|
+
// to any other day, a move to the header buttons, or focus leaving the
|
|
196
|
+
// calendar all drop it.
|
|
197
|
+
const movesToTarget = e.relatedTarget instanceof Element && e.relatedTarget.getAttribute('data-date') === pendingFocus;
|
|
198
|
+
if (pendingFocus != null && !movesToTarget) {
|
|
199
|
+
setPendingFocus(null);
|
|
200
|
+
}
|
|
201
|
+
}, [pendingFocus]);
|
|
202
|
+
|
|
160
203
|
// Format month header
|
|
161
204
|
const monthYearLabel = useMemo(() => {
|
|
162
205
|
if (numberOfMonths === 1) {
|
|
@@ -185,6 +228,8 @@ export function Calendar({
|
|
|
185
228
|
}, [monthYearLabel, announce]);
|
|
186
229
|
|
|
187
230
|
// Determine if prev/next navigation is possible based on min/max
|
|
231
|
+
const minDateForKeys = useMemo(() => min ? plainDateFromISO(min) : null, [min]);
|
|
232
|
+
const maxDateForKeys = useMemo(() => max ? plainDateFromISO(max) : null, [max]);
|
|
188
233
|
const canNavigatePrevious = useMemo(() => {
|
|
189
234
|
if (!min) {
|
|
190
235
|
return true;
|
|
@@ -204,23 +249,109 @@ export function Calendar({
|
|
|
204
249
|
}, [max, baseMonth, numberOfMonths]);
|
|
205
250
|
|
|
206
251
|
// Navigation handlers
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
252
|
+
// The same constraint view the grids use, so a key can resolve its target
|
|
253
|
+
// before the month changes.
|
|
254
|
+
const rootRangeAnchor = useMemo(() => mode === 'range' && rangeSelectionStart ? plainDateFromISO(rangeSelectionStart) : null, [mode, rangeSelectionStart]);
|
|
255
|
+
const {
|
|
256
|
+
isDateDisabled: isRootDateDisabled
|
|
257
|
+
} = useCalendarConstraints({
|
|
258
|
+
min,
|
|
259
|
+
max,
|
|
260
|
+
dateConstraints,
|
|
261
|
+
maxRangeSpan,
|
|
262
|
+
minRangeSpan,
|
|
263
|
+
rangeAnchor: rootRangeAnchor
|
|
264
|
+
});
|
|
265
|
+
const navigateMonth = useCallback((delta, focusedDate, offset, unit = 'days') => {
|
|
266
|
+
const monthIndex = pd => pd.year * 12 + pd.month;
|
|
267
|
+
const firstShown = monthIndex(baseMonth);
|
|
268
|
+
const lastShown = firstShown + numberOfMonths - 1;
|
|
269
|
+
|
|
270
|
+
// The Previous/Next buttons move the month with no focused day.
|
|
271
|
+
if (!focusedDate) {
|
|
272
|
+
if (delta < 0 && !canNavigatePrevious || delta > 0 && !canNavigateNext) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const newPd = plainDateAddMonths(baseMonth, delta);
|
|
276
|
+
if (onFocusDateChange) {
|
|
277
|
+
onFocusDateChange(plainDateToISO(newPd));
|
|
278
|
+
} else {
|
|
279
|
+
setInternalFocusDate(newPd);
|
|
280
|
+
}
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
210
283
|
|
|
211
|
-
//
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
284
|
+
// A key resolves its TARGET day first and decides by that, so a
|
|
285
|
+
// boundary blocks only out-of-range targets, never the month movement
|
|
286
|
+
// itself (ArrowUp from February 3 reaches January 27 at a January
|
|
287
|
+
// minimum), and a direction with no enabled day left changes nothing
|
|
288
|
+
// rather than dropping focus.
|
|
289
|
+
const currentPd = plainDateFromISO(focusedDate);
|
|
290
|
+
const inRange = pd => !(minDateForKeys && plainDateIsBefore(pd, minDateForKeys)) && !(maxDateForKeys && plainDateIsAfter(pd, maxDateForKeys));
|
|
291
|
+
let targetPd;
|
|
292
|
+
if (unit === 'months') {
|
|
293
|
+
// A page targets the same day of the month a month away (clamped to
|
|
294
|
+
// that month's length). Past `min`/`max` nothing moves; a month with
|
|
295
|
+
// no enabled day is no destination either, the same as an arrow with
|
|
296
|
+
// no enabled day in its direction; a target disabled by a constraint
|
|
297
|
+
// lands on that month's first enabled day instead.
|
|
298
|
+
const candidate = plainDateAddMonths(currentPd, delta);
|
|
299
|
+
if (!inRange(candidate)) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (isRootDateDisabled(candidate)) {
|
|
303
|
+
const firstEnabled = firstEnabledDayOfMonth(candidate, isRootDateDisabled);
|
|
304
|
+
if (firstEnabled == null) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
targetPd = firstEnabled;
|
|
308
|
+
} else {
|
|
309
|
+
targetPd = candidate;
|
|
310
|
+
}
|
|
311
|
+
} else {
|
|
312
|
+
// Walk the arrow's direction to the first enabled day, up to a year
|
|
313
|
+
// away; past `min`/`max` or with every day disabled, nothing moves.
|
|
314
|
+
const step = delta * (offset ?? 7);
|
|
315
|
+
let candidate = plainDateAddDays(currentPd, step);
|
|
316
|
+
let found = null;
|
|
317
|
+
while (Math.abs(plainDateDiffDays(currentPd, candidate)) <= 366) {
|
|
318
|
+
if (!inRange(candidate)) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (!isRootDateDisabled(candidate)) {
|
|
322
|
+
found = candidate;
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
candidate = plainDateAddDays(candidate, step);
|
|
326
|
+
}
|
|
327
|
+
if (found == null) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
targetPd = found;
|
|
217
331
|
}
|
|
332
|
+
|
|
333
|
+
// Focus moves to the target; the months change only when the target's
|
|
334
|
+
// month is not already shown. The view shifts the least it can in the
|
|
335
|
+
// key's direction, so the target month becomes the first (backwards)
|
|
336
|
+
// or last (forwards) month shown.
|
|
337
|
+
const resolved = targetPd;
|
|
338
|
+
const targetMonth = monthIndex(resolved);
|
|
339
|
+
setPendingFocus(plainDateToISO(resolved));
|
|
340
|
+
if (targetMonth >= firstShown && targetMonth <= lastShown) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const targetFirst = {
|
|
344
|
+
year: resolved.year,
|
|
345
|
+
month: resolved.month,
|
|
346
|
+
day: 1
|
|
347
|
+
};
|
|
348
|
+
const newPd = targetMonth < firstShown ? targetFirst : plainDateAddMonths(targetFirst, -(numberOfMonths - 1));
|
|
218
349
|
if (onFocusDateChange) {
|
|
219
|
-
onFocusDateChange(
|
|
350
|
+
onFocusDateChange(plainDateToISO(newPd));
|
|
220
351
|
} else {
|
|
221
352
|
setInternalFocusDate(newPd);
|
|
222
353
|
}
|
|
223
|
-
}, [baseMonth, onFocusDateChange]);
|
|
354
|
+
}, [baseMonth, canNavigateNext, canNavigatePrevious, isRootDateDisabled, maxDateForKeys, minDateForKeys, numberOfMonths, onFocusDateChange]);
|
|
224
355
|
|
|
225
356
|
// Escape key handler to cancel range selection
|
|
226
357
|
const handleCalendarKeyDown = useCallback(e => {
|
|
@@ -294,6 +425,7 @@ export function Calendar({
|
|
|
294
425
|
return /*#__PURE__*/_jsxs("div", {
|
|
295
426
|
ref: ref,
|
|
296
427
|
...rest,
|
|
428
|
+
onBlur: composeEventHandlers(rest.onBlur, handleRootBlur),
|
|
297
429
|
...mergeProps(themeProps('calendar', {
|
|
298
430
|
mode
|
|
299
431
|
}), stylex.props(calendarStyles.calendar, xstyle), className, style),
|
|
@@ -365,9 +497,9 @@ export function Calendar({
|
|
|
365
497
|
onDayClick: handleDayClick,
|
|
366
498
|
onDayHover: date => setHoveredDate(date ? plainDateToISO(date) : null),
|
|
367
499
|
today: today,
|
|
368
|
-
onNavigatePrevious: (focusedDate, offset) => navigateMonth(-1, focusedDate, offset),
|
|
369
|
-
onNavigateNext: (focusedDate, offset) => navigateMonth(1, focusedDate, offset),
|
|
370
|
-
pendingFocus:
|
|
500
|
+
onNavigatePrevious: (focusedDate, offset, unit) => navigateMonth(-1, focusedDate, offset, unit),
|
|
501
|
+
onNavigateNext: (focusedDate, offset, unit) => navigateMonth(1, focusedDate, offset, unit),
|
|
502
|
+
pendingFocus: claimablePendingFocus,
|
|
371
503
|
onPendingFocusHandled: () => setPendingFocus(null)
|
|
372
504
|
}, `${month.year}-${month.month}`))
|
|
373
505
|
})]
|
|
@@ -501,13 +633,13 @@ function MonthGrid({
|
|
|
501
633
|
const handlePageUp = useCallback(() => {
|
|
502
634
|
const focusedDate = getFocusedDate();
|
|
503
635
|
if (focusedDate) {
|
|
504
|
-
onNavigatePrevious?.(focusedDate,
|
|
636
|
+
onNavigatePrevious?.(focusedDate, 1, 'months');
|
|
505
637
|
}
|
|
506
638
|
}, [getFocusedDate, onNavigatePrevious]);
|
|
507
639
|
const handlePageDown = useCallback(() => {
|
|
508
640
|
const focusedDate = getFocusedDate();
|
|
509
641
|
if (focusedDate) {
|
|
510
|
-
onNavigateNext?.(focusedDate,
|
|
642
|
+
onNavigateNext?.(focusedDate, 1, 'months');
|
|
511
643
|
}
|
|
512
644
|
}, [getFocusedDate, onNavigateNext]);
|
|
513
645
|
|
|
@@ -527,7 +659,12 @@ function MonthGrid({
|
|
|
527
659
|
} = useGridFocus({
|
|
528
660
|
columns: 7,
|
|
529
661
|
cellSelector: '[role="gridcell"]',
|
|
530
|
-
|
|
662
|
+
// A borrowed adjacent-month day is exposed aria-disabled (its click does
|
|
663
|
+
// nothing, but it can still take pointer focus) and may also be natively
|
|
664
|
+
// disabled by bounds or a constraint; the keyboard skips it either way
|
|
665
|
+
// and crosses into that month through the grid edge instead, so focus
|
|
666
|
+
// lands on the real day in the month now shown (FR5).
|
|
667
|
+
isCellFocusable: cell => cell.querySelector('button:not([disabled]):not([aria-disabled="true"])') !== null,
|
|
531
668
|
getFocusTarget: cell => cell.querySelector('button'),
|
|
532
669
|
hasRovingTabIndex: true,
|
|
533
670
|
onNavigateBefore: handleNavigatePrevious,
|
|
@@ -536,27 +673,38 @@ function MonthGrid({
|
|
|
536
673
|
onPageDown: handlePageDown
|
|
537
674
|
});
|
|
538
675
|
|
|
539
|
-
// Handle pending focus after month navigation
|
|
676
|
+
// Handle pending focus after month navigation. Every mounted month grid
|
|
677
|
+
// sees the same pending date; only the grid showing that date's month acts,
|
|
678
|
+
// so a neighbouring grid's fallback never overrides the right target. The
|
|
679
|
+
// target is the real day in this month, never an outside-day copy; when it
|
|
680
|
+
// is disabled, the month's first enabled day takes focus instead.
|
|
540
681
|
useEffect(() => {
|
|
541
682
|
if (!pendingFocus || !gridRef.current) {
|
|
542
683
|
return;
|
|
543
684
|
}
|
|
544
|
-
const buttons = gridRef.current.querySelectorAll('button:not([disabled])');
|
|
545
685
|
const targetPd = plainDateFromISO(pendingFocus);
|
|
686
|
+
if (targetPd.year !== year || targetPd.month !== month.month) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
546
689
|
const targetIso = plainDateToISO(targetPd);
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
690
|
+
const buttons = Array.from(gridRef.current.querySelectorAll('button[data-date]:not([disabled]):not([aria-disabled="true"])'));
|
|
691
|
+
|
|
692
|
+
// The real target day, else the month's first enabled day, else — in a
|
|
693
|
+
// month with no enabled day — the first day button that can still take
|
|
694
|
+
// focus (a borrowed adjacent-month day), so focus stays in the grid
|
|
695
|
+
// rather than dropping to the page.
|
|
696
|
+
const targetButton = buttons.find(button => button.getAttribute('data-date') === targetIso) ?? buttons[0] ?? gridRef.current.querySelector('button[data-date]:not([disabled])') ?? null;
|
|
697
|
+
if (targetButton != null) {
|
|
698
|
+
// The target becomes this grid's one Tab stop before it takes focus,
|
|
699
|
+
// the way the hook's own arrow moves do (FR2): a programmatic focus
|
|
700
|
+
// alone would leave the stop on the day the grid mounted with.
|
|
701
|
+
for (const button of gridRef.current.querySelectorAll('button[data-date]')) {
|
|
702
|
+
button.tabIndex = button === targetButton ? 0 : -1;
|
|
552
703
|
}
|
|
704
|
+
targetButton.focus();
|
|
553
705
|
}
|
|
554
|
-
if (!targetButton && buttons.length > 0) {
|
|
555
|
-
targetButton = buttons[0];
|
|
556
|
-
}
|
|
557
|
-
targetButton?.focus();
|
|
558
706
|
onPendingFocusHandled?.();
|
|
559
|
-
}, [pendingFocus, gridRef, onPendingFocusHandled]);
|
|
707
|
+
}, [pendingFocus, gridRef, month.month, onPendingFocusHandled, year]);
|
|
560
708
|
|
|
561
709
|
// Parse selection
|
|
562
710
|
let selectedDate = null;
|
|
@@ -613,8 +761,19 @@ function MonthGrid({
|
|
|
613
761
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
614
762
|
role: "row",
|
|
615
763
|
...stylex.props(monthGridStyles.weekRow),
|
|
616
|
-
children: [hasWeekNumbers &&
|
|
617
|
-
|
|
764
|
+
children: [hasWeekNumbers &&
|
|
765
|
+
/*#__PURE__*/
|
|
766
|
+
// The corner above the week-number column is a header cell like
|
|
767
|
+
// the weekday names beside it (APG grid: every cell in a row is a
|
|
768
|
+
// gridcell, columnheader or rowheader). Its name is the locale's
|
|
769
|
+
// own word for the week field, as visually hidden text so the
|
|
770
|
+
// column stays blank and the header is not empty to axe.
|
|
771
|
+
_jsx("div", {
|
|
772
|
+
role: "columnheader",
|
|
773
|
+
...stylex.props(monthGridStyles.dayName, monthGridStyles.weekNumberHeader),
|
|
774
|
+
children: /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
775
|
+
children: plainDateWeekFieldName(locale)
|
|
776
|
+
})
|
|
618
777
|
}), dayNameHeaders.map(({
|
|
619
778
|
dayOfWeek,
|
|
620
779
|
name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthScroller.d.ts","sourceRoot":"","sources":["../../src/DateInput/MonthScroller.tsx"],"names":[],"mappings":"AAoDA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,SAAS,EAQf,MAAM,UAAU,CAAC;AA6MlB,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;CACxE;AAED,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,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8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,+DAA+D;IAC/D,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,+BAA+B;IAC/B,YAAY,EAAE,SAAS,GAAG,IAAI,CAAC;IAC/B,4CAA4C;IAC5C,KAAK,EAAE,SAAS,CAAC;IACjB,2DAA2D;IAC3D,cAAc,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IAC7C,gCAAgC;IAChC,YAAY,EAAE,SAAS,CAAC;IACxB,kCAAkC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CAC1C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,KAAK,EACL,cAAc,EACd,YAAY,EACZ,QAAQ,GACT,EAAE,kBAAkB,+BAyapB;yBApbe,aAAa"}
|
|
@@ -439,12 +439,16 @@ export function MonthScroller({
|
|
|
439
439
|
// Column within the displayed week, which is what Home/End move to —
|
|
440
440
|
// not the day of the month.
|
|
441
441
|
const column = (plainDateDayOfWeek(date) - weekStartsOn + 7) % 7;
|
|
442
|
+
// The horizontal arrows follow the reading direction (APG grid): under
|
|
443
|
+
// RTL the next day sits to the left.
|
|
444
|
+
const forward = isRTL ? 'ArrowLeft' : 'ArrowRight';
|
|
445
|
+
const backward = isRTL ? 'ArrowRight' : 'ArrowLeft';
|
|
442
446
|
switch (event.key) {
|
|
443
|
-
case
|
|
447
|
+
case backward:
|
|
444
448
|
event.preventDefault();
|
|
445
449
|
moveFocus(date, -1);
|
|
446
450
|
break;
|
|
447
|
-
case
|
|
451
|
+
case forward:
|
|
448
452
|
event.preventDefault();
|
|
449
453
|
moveFocus(date, 1);
|
|
450
454
|
break;
|
|
@@ -467,7 +471,7 @@ export function MonthScroller({
|
|
|
467
471
|
default:
|
|
468
472
|
break;
|
|
469
473
|
}
|
|
470
|
-
}, [moveFocus, weekStartsOn]);
|
|
474
|
+
}, [isRTL, moveFocus, weekStartsOn]);
|
|
471
475
|
|
|
472
476
|
// The focused day may have been in an unmounted pane a frame ago; focus it
|
|
473
477
|
// once it exists, and only in response to a key press so a scroll never
|
|
@@ -477,7 +481,10 @@ export function MonthScroller({
|
|
|
477
481
|
if (!shouldRestoreFocusRef.current || focusedISO == null) {
|
|
478
482
|
return;
|
|
479
483
|
}
|
|
480
|
-
|
|
484
|
+
// A date can be mounted twice: as a real day in its own pane and as a
|
|
485
|
+
// dimmed, disabled spill copy at the edge of a neighbouring pane. Only
|
|
486
|
+
// the real day may take focus, or Enter and Space would select nothing.
|
|
487
|
+
const target = scrollerRef.current?.querySelector(`[data-date="${focusedISO}"]:not([data-outside])`);
|
|
481
488
|
if (target != null) {
|
|
482
489
|
shouldRestoreFocusRef.current = false;
|
|
483
490
|
// preventScroll: the scroller is already snapping to this month; a
|
|
@@ -605,6 +612,7 @@ function MonthPane({
|
|
|
605
612
|
children: /*#__PURE__*/_jsx("button", {
|
|
606
613
|
type: "button",
|
|
607
614
|
"data-date": day.iso,
|
|
615
|
+
"data-outside": day.isOutside ? '' : undefined,
|
|
608
616
|
tabIndex: day.iso === tabbableISO ? 0 : -1,
|
|
609
617
|
"aria-label": plainDateFormat(day.date, DATE_FORMAT_WITH_WEEKDAY, locale),
|
|
610
618
|
"aria-disabled": isDisabled || undefined,
|
|
@@ -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,C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,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAC3B,qBAAqB,GAAG,yBAAyB,CAAC;AAgmCpD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBA4CpD;yBA5Ce,YAAY"}
|
|
@@ -465,7 +465,15 @@ function DropdownMenuBottomSheet({
|
|
|
465
465
|
openModalityRef.current = 'keyboard';
|
|
466
466
|
}
|
|
467
467
|
};
|
|
468
|
-
const handleSheetTriggerClick =
|
|
468
|
+
const handleSheetTriggerClick = event => {
|
|
469
|
+
// A caller-rendered trigger that is natively or aria-disabled must not
|
|
470
|
+
// open the sheet; the default Button already refuses its own click.
|
|
471
|
+
// The DOM check covers the built-in Button too (it renders aria-disabled
|
|
472
|
+
// when focusable-disabled); a caller's own enabled control wins over a
|
|
473
|
+
// `button.isDisabled` left on the props.
|
|
474
|
+
if (event.currentTarget.matches(':disabled, [aria-disabled="true"]')) {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
469
477
|
onClick?.();
|
|
470
478
|
setOpen(!isOpen);
|
|
471
479
|
};
|
|
@@ -884,6 +892,13 @@ function DropdownMenuPopover({
|
|
|
884
892
|
}
|
|
885
893
|
}, [closeMenu]);
|
|
886
894
|
const openAndFocus = useCallback((modality = 'keyboard', notifyClick = false) => {
|
|
895
|
+
// An unavailable trigger never opens the menu. Button keeps an
|
|
896
|
+
// aria-disabled trigger focusable for its tooltip and swallows only
|
|
897
|
+
// Enter and Space, so the arrow keys, a press and a click would still
|
|
898
|
+
// arrive here; a custom trigger may be natively disabled instead.
|
|
899
|
+
if (buttonRef.current?.matches(':disabled, [aria-disabled="true"]') === true) {
|
|
900
|
+
return false;
|
|
901
|
+
}
|
|
887
902
|
acceptedOpenRef.current = false;
|
|
888
903
|
notifyClickOnShowRef.current = notifyClick;
|
|
889
904
|
pendingControlledOpenRef.current = isControlled;
|
|
@@ -993,7 +1008,11 @@ function DropdownMenuPopover({
|
|
|
993
1008
|
return;
|
|
994
1009
|
}
|
|
995
1010
|
focusLastOnOpenRef.current = e.key === 'ArrowUp';
|
|
996
|
-
openAndFocus()
|
|
1011
|
+
if (!openAndFocus()) {
|
|
1012
|
+
// A refused open (disabled trigger) must not leave ArrowUp's
|
|
1013
|
+
// "land on the last row" armed for a later open.
|
|
1014
|
+
focusLastOnOpenRef.current = false;
|
|
1015
|
+
}
|
|
997
1016
|
}
|
|
998
1017
|
return;
|
|
999
1018
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file InputClearButton.tsx
|
|
3
|
-
* @input Uses React, Button, and
|
|
4
|
-
* @output Exports the public InputClearButton and an internal popup-aware variant
|
|
5
|
-
*
|
|
3
|
+
* @input Uses React, Button, Icon, and the i18n translator
|
|
4
|
+
* @output Exports the public InputClearButton and an internal popup-aware variant.
|
|
5
|
+
* Both show the localized generic "Clear" tooltip and keep the caller's
|
|
6
|
+
* contextual label as the accessible name.
|
|
6
7
|
* @position Shared primitive. Every input that renders a clear affordance —
|
|
7
8
|
* TextInput, NumberInput, TimeInput, DateInput, DateTimeInput,
|
|
8
9
|
* DateRangeInput, Selector, MultiSelector, Typeahead, Tokenizer, FileInput —
|
|
@@ -13,7 +14,10 @@
|
|
|
13
14
|
import type { ReactNode } from 'react';
|
|
14
15
|
import * as stylex from '@stylexjs/stylex';
|
|
15
16
|
export interface InputClearButtonProps {
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Contextual accessible name for the button, such as "Clear Search". The
|
|
19
|
+
* visible tooltip is always the localized generic "Clear".
|
|
20
|
+
*/
|
|
17
21
|
label: string;
|
|
18
22
|
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
19
23
|
xstyle?: stylex.StyleXStyles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputClearButton.d.ts","sourceRoot":"","sources":["../../src/Field/InputClearButton.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"InputClearButton.d.ts","sourceRoot":"","sources":["../../src/Field/InputClearButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAmD3C,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;IAC7B,iFAAiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,6BAA8B,SAAQ,qBAAqB;IACnE,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACtD,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CACtD;AAsDD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAMxE;yBANe,gBAAgB;;;AAQhC,4EAA4E;AAC5E,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,6BAA6B,GACnC,SAAS,CAMX"}
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file InputClearButton.tsx
|
|
7
|
-
* @input Uses React, Button, and
|
|
8
|
-
* @output Exports the public InputClearButton and an internal popup-aware variant
|
|
9
|
-
*
|
|
7
|
+
* @input Uses React, Button, Icon, and the i18n translator
|
|
8
|
+
* @output Exports the public InputClearButton and an internal popup-aware variant.
|
|
9
|
+
* Both show the localized generic "Clear" tooltip and keep the caller's
|
|
10
|
+
* contextual label as the accessible name.
|
|
10
11
|
* @position Shared primitive. Every input that renders a clear affordance —
|
|
11
12
|
* TextInput, NumberInput, TimeInput, DateInput, DateTimeInput,
|
|
12
13
|
* DateRangeInput, Selector, MultiSelector, Typeahead, Tokenizer, FileInput —
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
import * as stylex from '@stylexjs/stylex';
|
|
18
19
|
import { Button } from "../Button/index.js";
|
|
19
20
|
import { Icon } from "../Icon/index.js";
|
|
21
|
+
import { useTranslator } from "../i18n/index.js";
|
|
20
22
|
import { themeProps } from "../utils/themeProps.js";
|
|
21
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
24
|
const styles = {
|
|
@@ -34,6 +36,7 @@ const styles = {
|
|
|
34
36
|
};
|
|
35
37
|
function renderInputClearButton({
|
|
36
38
|
label,
|
|
39
|
+
tooltip,
|
|
37
40
|
onClick,
|
|
38
41
|
onPointerDown,
|
|
39
42
|
onClickCapture,
|
|
@@ -49,8 +52,13 @@ function renderInputClearButton({
|
|
|
49
52
|
return /*#__PURE__*/_jsx(Button, {
|
|
50
53
|
variant: "ghost",
|
|
51
54
|
size: "sm",
|
|
52
|
-
label: label
|
|
53
|
-
|
|
55
|
+
label: label
|
|
56
|
+
// The field's label already sits beside the glyph, so the tooltip names
|
|
57
|
+
// only the action; repeating a long label reads as awkward copy. The
|
|
58
|
+
// contextual label stays the accessible name, which still contains
|
|
59
|
+
// the visible word (WCAG 2.5.3, label in name).
|
|
60
|
+
,
|
|
61
|
+
tooltip: tooltip,
|
|
54
62
|
className: buttonTargetClassName,
|
|
55
63
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
56
64
|
icon: "close",
|
|
@@ -70,11 +78,19 @@ function renderInputClearButton({
|
|
|
70
78
|
});
|
|
71
79
|
}
|
|
72
80
|
export function InputClearButton(props) {
|
|
73
|
-
|
|
81
|
+
const t = useTranslator();
|
|
82
|
+
return renderInputClearButton({
|
|
83
|
+
...props,
|
|
84
|
+
tooltip: t('@astryx.inputClearButton.tooltip')
|
|
85
|
+
});
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
/** Internal variant used while popup-aware clear behavior is rolled out. */
|
|
77
89
|
export function InternalInputClearButton(props) {
|
|
78
|
-
|
|
90
|
+
const t = useTranslator();
|
|
91
|
+
return renderInputClearButton({
|
|
92
|
+
...props,
|
|
93
|
+
tooltip: t('@astryx.inputClearButton.tooltip')
|
|
94
|
+
});
|
|
79
95
|
}
|
|
80
96
|
InputClearButton.displayName = 'InputClearButton';
|
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
* @output Exports InputGroup component with group label/description ARIA wiring
|
|
5
5
|
* @position Groups input with prefix/suffix addons; consumed by index.ts
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* to remove their own border/radius so the group container provides
|
|
10
|
-
* the unified border treatment.
|
|
7
|
+
* Compatible input children consume InputGroup context to remove competing
|
|
8
|
+
* border/radius geometry. Button addons consume it to join the same outer shape.
|
|
11
9
|
*
|
|
12
10
|
* SYNC: When modified, update these files to stay in sync:
|
|
13
11
|
* - /packages/core/src/InputGroup/InputGroup.doc.mjs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputGroup.d.ts","sourceRoot":"","sources":["../../src/InputGroup/InputGroup.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"InputGroup.d.ts","sourceRoot":"","sources":["../../src/InputGroup/InputGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAiB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAQ,KAAK,WAAW,EAAC,MAAM,UAAU,CAAC;AAGjD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AA0BhD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,SAAS,CAAC,cAAc,CAAC,EACzB,UAAU,CACX;IACC,mDAAmD;IACnD,GAAG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