@astryxdesign/core 0.4.6 → 0.4.7-canary.29be96d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/BottomSheet/BottomSheet.d.ts +1 -0
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +54 -15
- package/dist/BottomSheet/BottomSheetEdgeTint.d.ts +6 -0
- package/dist/BottomSheet/BottomSheetEdgeTint.d.ts.map +1 -0
- package/dist/BottomSheet/BottomSheetEdgeTint.js +62 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +1 -0
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts +1 -0
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +10 -4
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +23 -5
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +5 -5
- package/dist/Calendar/Calendar.d.ts +3 -1
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +13 -14
- package/dist/Calendar/getInitialFocusDate.d.ts +46 -0
- package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -0
- package/dist/Calendar/getInitialFocusDate.js +62 -0
- package/dist/Chat/ChatMessageList.d.ts +22 -3
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +6 -3
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +34 -1
- package/dist/Dialog/Dialog.d.ts +7 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +48 -22
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +6 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +10 -3
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.d.ts.map +1 -1
- package/dist/Markdown/parser.d.ts +38 -1
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +149 -23
- package/dist/MultiSelector/MultiSelector.d.ts +15 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +17 -6
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.d.ts.map +1 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +5 -0
- package/dist/Stepper/Step.d.ts +140 -0
- package/dist/Stepper/Step.d.ts.map +1 -0
- package/dist/Stepper/Step.js +1045 -0
- package/dist/Stepper/StepStatus.d.ts +24 -0
- package/dist/Stepper/StepStatus.d.ts.map +1 -0
- package/dist/Stepper/StepStatus.js +1 -0
- package/dist/Stepper/Stepper.d.ts +93 -0
- package/dist/Stepper/Stepper.d.ts.map +1 -0
- package/dist/Stepper/Stepper.js +184 -0
- package/dist/Stepper/StepperContext.d.ts +41 -0
- package/dist/Stepper/StepperContext.d.ts.map +1 -0
- package/dist/Stepper/StepperContext.js +34 -0
- package/dist/Stepper/index.d.ts +8 -0
- package/dist/Stepper/index.d.ts.map +1 -0
- package/dist/Stepper/index.js +7 -0
- package/dist/Stepper/stepper.stylex.d.ts +15 -0
- package/dist/Stepper/stepper.stylex.d.ts.map +1 -0
- package/dist/Stepper/stepper.stylex.js +20 -0
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +5 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +4 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts.map +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +20 -8
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.js +10 -3
- package/dist/Table/plugins/selection/useTableSelection.d.ts +16 -0
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +19 -5
- package/dist/Table/types.d.ts +22 -4
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +5 -0
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +6 -2
- package/dist/astryx.css +41 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +10 -3
- package/dist/hooks/useListFocus.d.ts +5 -2
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +12 -6
- package/dist/hooks/useMergedRefs.d.ts +18 -0
- package/dist/hooks/useMergedRefs.d.ts.map +1 -0
- package/dist/hooks/useMergedRefs.js +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/utils/timeParser.d.ts +1 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +26 -12
- package/locales/en.json +14 -6
- package/locales/pseudo.json +6 -0
- package/package.json +8 -3
- package/src/Avatar/Avatar.doc.mjs +2 -1
- package/src/BottomSheet/BottomSheet.test.tsx +123 -0
- package/src/BottomSheet/BottomSheet.tsx +36 -4
- package/src/BottomSheet/BottomSheetEdgeTint.test.tsx +225 -0
- package/src/BottomSheet/BottomSheetEdgeTint.tsx +82 -0
- package/src/BottomSheet/BottomSheetPanel.test.tsx +66 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +19 -0
- package/src/BottomSheet/BottomSheetSwitcher.tsx +13 -0
- package/src/BottomSheet/useSheetGestures.test.ts +27 -0
- package/src/BottomSheet/useSheetGestures.ts +25 -5
- package/src/Breadcrumbs/BreadcrumbItem.tsx +2 -1
- package/src/Button/Button.doc.mjs +22 -0
- package/src/Calendar/Calendar.doc.mjs +4 -3
- package/src/Calendar/Calendar.test.tsx +52 -0
- package/src/Calendar/Calendar.tsx +18 -15
- package/src/Calendar/getInitialFocusDate.test.ts +94 -0
- package/src/Calendar/getInitialFocusDate.ts +93 -0
- package/src/Chat/ChatMessageList.doc.mjs +9 -1
- package/src/Chat/ChatMessageList.test.tsx +46 -0
- package/src/Chat/ChatMessageList.tsx +28 -4
- package/src/CodeBlock/CodeBlock.doc.mjs +6 -0
- package/src/ContextMenu/ContextMenu.doc.mjs +5 -0
- package/src/DateInput/DateInputTouch.test.tsx +36 -0
- package/src/DateInput/TouchDateField.tsx +35 -1
- package/src/Dialog/Dialog.doc.mjs +8 -3
- package/src/Dialog/Dialog.test.tsx +71 -0
- package/src/Dialog/Dialog.tsx +72 -20
- package/src/Field/Field.doc.mjs +11 -0
- package/src/Heading/Heading.test.tsx +23 -1
- package/src/Heading/Heading.tsx +6 -2
- package/src/Kbd/Kbd.test.tsx +17 -0
- package/src/Kbd/Kbd.tsx +10 -3
- package/src/Link/Link.doc.mjs +11 -0
- package/src/Markdown/index.ts +1 -0
- package/src/Markdown/parser.perf.test.ts +71 -1
- package/src/Markdown/parser.test.ts +145 -2
- package/src/Markdown/parser.ts +208 -22
- package/src/MoreMenu/MoreMenu.doc.mjs +7 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +10 -0
- package/src/MultiSelector/MultiSelector.test.tsx +105 -0
- package/src/MultiSelector/MultiSelector.tsx +50 -6
- package/src/MultiSelector/index.ts +1 -0
- package/src/NumberInput/NumberInput.doc.mjs +5 -0
- package/src/Popover/Popover.test.tsx +27 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +10 -0
- package/src/Selector/Selector.doc.mjs +11 -0
- package/src/Selector/Selector.test.tsx +21 -0
- package/src/Selector/Selector.tsx +11 -1
- package/src/Stepper/Step.doc.mjs +98 -0
- package/src/Stepper/Step.tsx +1638 -0
- package/src/Stepper/StepStatus.ts +26 -0
- package/src/Stepper/Stepper.doc.mjs +370 -0
- package/src/Stepper/Stepper.test.tsx +1024 -0
- package/src/Stepper/Stepper.tsx +258 -0
- package/src/Stepper/StepperContext.ts +71 -0
- package/src/Stepper/index.ts +18 -0
- package/src/Stepper/stepper.stylex.ts +19 -0
- package/src/TabList/Tab.tsx +5 -1
- package/src/TabList/TabList.test.tsx +21 -4
- package/src/Table/BaseTable.tsx +6 -3
- package/src/Table/Table.test.tsx +35 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows-perf.test.tsx +112 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.test.tsx +100 -0
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +17 -8
- package/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx +13 -7
- package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +12 -3
- package/src/Table/plugins/selection/useTableSelection.test.tsx +76 -0
- package/src/Table/plugins/selection/useTableSelection.tsx +40 -7
- package/src/Table/types.ts +22 -4
- package/src/Table/useBaseTablePlugins.ts +5 -0
- package/src/Table/useTableGroupedRows.doc.mjs +5 -4
- package/src/Table/useTableRowStatus.doc.mjs +1 -1
- package/src/Table/useTableSelection.doc.mjs +31 -0
- package/src/Text/Text.test.tsx +23 -1
- package/src/Text/Text.tsx +6 -2
- package/src/TextInput/TextInput.doc.mjs +10 -0
- package/src/Toast/Toast.doc.mjs +6 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +10 -0
- package/src/Toolbar/Toolbar.doc.mjs +5 -0
- package/src/__tests__/apiContractDrift.test.tsx +80 -0
- package/src/__tests__/fieldContract.test.tsx +24 -0
- package/src/__tests__/structuralComponentContract.test.tsx +39 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useHotkeys.test.ts +18 -0
- package/src/hooks/useHotkeys.ts +10 -3
- package/src/hooks/useListFocus.doc.mjs +2 -2
- package/src/hooks/useListFocus.test.tsx +65 -3
- package/src/hooks/useListFocus.ts +15 -7
- package/src/hooks/useMergedRefs.doc.mjs +79 -0
- package/src/hooks/useMergedRefs.test.tsx +62 -0
- package/src/hooks/useMergedRefs.ts +36 -0
- package/src/index.ts +1 -0
- package/src/theme/MediaTheme.doc.mjs +5 -5
- package/src/utils/timeParser.test.ts +6 -1
- package/src/utils/timeParser.ts +35 -13
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAGH,YAAY,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAG3C,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AA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B,EAAC,MAAM,SAAS,CAAC;AAGlE,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AACxC,YAAY,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAG1B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,YAAY,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACzC,cAAc,SAAS,CAAC;AAGxB,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -53,6 +53,7 @@ export * from "./NavIcon/index.js";
|
|
|
53
53
|
export * from "./NavMenu/index.js";
|
|
54
54
|
export * from "./Slider/index.js";
|
|
55
55
|
export * from "./Stack/index.js";
|
|
56
|
+
export * from "./Stepper/index.js";
|
|
56
57
|
export * from "./Switch/index.js";
|
|
57
58
|
export * from "./DateInput/index.js";
|
|
58
59
|
export * from "./DateTimeInput/index.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file timeParser.ts
|
|
3
3
|
* @input Uses string parsing
|
|
4
4
|
* @output Exports time parsing and formatting utilities
|
|
5
|
-
* @position Shared utility; used by
|
|
5
|
+
* @position Shared utility; used by TimeInput and DateTimeInput
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update this header
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeParser.d.ts","sourceRoot":"","sources":["../../src/utils/timeParser.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7 +4,7 @@
|
|
|
4
4
|
* @file timeParser.ts
|
|
5
5
|
* @input Uses string parsing
|
|
6
6
|
* @output Exports time parsing and formatting utilities
|
|
7
|
-
* @position Shared utility; used by
|
|
7
|
+
* @position Shared utility; used by TimeInput and DateTimeInput
|
|
8
8
|
*
|
|
9
9
|
* SYNC: When modified, update this header
|
|
10
10
|
*/
|
|
@@ -134,17 +134,29 @@ export function parseTimeInput(input, includeSeconds = false) {
|
|
|
134
134
|
|
|
135
135
|
// Remove AM/PM suffix
|
|
136
136
|
const timeStr = trimmed.replace(/\s*[ap]\.?m?\.?\s*$/i, '').trim();
|
|
137
|
+
const convertHourTo24Hour = hour => {
|
|
138
|
+
if (!hasMeridiem) {
|
|
139
|
+
return hour;
|
|
140
|
+
}
|
|
141
|
+
if (hour < 1 || hour > 12) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
if (isPM && hour !== 12) {
|
|
145
|
+
return hour + 12;
|
|
146
|
+
}
|
|
147
|
+
if (isAM && hour === 12) {
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
return hour;
|
|
151
|
+
};
|
|
137
152
|
|
|
138
153
|
// Handle formats like "2pm" -> "2"
|
|
139
154
|
if (/^\d{1,2}$/.test(timeStr)) {
|
|
140
155
|
const hour = parseInt(timeStr, 10);
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
if (isAM && hour === 12) {
|
|
147
|
-
hour24 = 0;
|
|
156
|
+
if (hasMeridiem) {
|
|
157
|
+
const hour24 = convertHourTo24Hour(hour);
|
|
158
|
+
if (hour24 === null) {
|
|
159
|
+
return null;
|
|
148
160
|
}
|
|
149
161
|
return formatISOTime({
|
|
150
162
|
hour: hour24,
|
|
@@ -166,9 +178,10 @@ export function parseTimeInput(input, includeSeconds = false) {
|
|
|
166
178
|
if (/^\d{4}$/.test(timeStr)) {
|
|
167
179
|
const hour = parseInt(timeStr.slice(0, 2), 10);
|
|
168
180
|
const minute = parseInt(timeStr.slice(2, 4), 10);
|
|
169
|
-
|
|
181
|
+
const hour24 = convertHourTo24Hour(hour);
|
|
182
|
+
if (hour24 !== null && hour24 >= 0 && hour24 <= 23 && minute >= 0 && minute <= 59) {
|
|
170
183
|
return formatISOTime({
|
|
171
|
-
hour,
|
|
184
|
+
hour: hour24,
|
|
172
185
|
minute,
|
|
173
186
|
second: 0
|
|
174
187
|
}, includeSeconds);
|
|
@@ -181,9 +194,10 @@ export function parseTimeInput(input, includeSeconds = false) {
|
|
|
181
194
|
const hour = parseInt(timeStr.slice(0, 2), 10);
|
|
182
195
|
const minute = parseInt(timeStr.slice(2, 4), 10);
|
|
183
196
|
const second = parseInt(timeStr.slice(4, 6), 10);
|
|
184
|
-
|
|
197
|
+
const hour24 = convertHourTo24Hour(hour);
|
|
198
|
+
if (hour24 !== null && hour24 >= 0 && hour24 <= 23 && minute >= 0 && minute <= 59 && second >= 0 && second <= 59) {
|
|
185
199
|
return formatISOTime({
|
|
186
|
-
hour,
|
|
200
|
+
hour: hour24,
|
|
187
201
|
minute,
|
|
188
202
|
second
|
|
189
203
|
}, includeSeconds);
|
package/locales/en.json
CHANGED
|
@@ -563,6 +563,10 @@
|
|
|
563
563
|
"defaultMessage": "Apply",
|
|
564
564
|
"description": "Primary button label inside a table's filter panel/popover; commits pending filter values. Imperative verb; pairs with `Reset`."
|
|
565
565
|
},
|
|
566
|
+
"@astryx.table.rowStatus.columnHeader": {
|
|
567
|
+
"defaultMessage": "Row status",
|
|
568
|
+
"description": "Screen-reader-only column header for the narrow status-indicator gutter a Table gains from useTableRowStatus. Sighted users see a blank gutter; assistive tech announces this as the column name."
|
|
569
|
+
},
|
|
566
570
|
"@astryx.table.selection.selectAllRows": {
|
|
567
571
|
"defaultMessage": "Select all rows",
|
|
568
572
|
"description": "Aria label for the \"select all rows\" checkbox in a Table header."
|
|
@@ -1067,29 +1071,33 @@
|
|
|
1067
1071
|
"defaultMessage": "Expand all rows",
|
|
1068
1072
|
"description": "Screen-reader-only label on the header expand-all/collapse-all button when at least one row is collapsed (clicking expands every expandable row). Part of the four-way set."
|
|
1069
1073
|
},
|
|
1074
|
+
"@astryx.stepper.label": {
|
|
1075
|
+
"defaultMessage": "Progress",
|
|
1076
|
+
"description": "Screen-reader-only fallback name for the Stepper's ordered list of steps, describing the sequence as a whole (e.g. `Progress`). Used as the aria-label when the consumer does not pass a `label`. Singular per ARIA convention."
|
|
1077
|
+
},
|
|
1070
1078
|
"@astryx.step.goToStep": {
|
|
1071
1079
|
"defaultMessage": "Go to step {stepNumber, number}: {label}",
|
|
1072
|
-
"description": "Accessible name for a clickable step in the
|
|
1080
|
+
"description": "Accessible name for a clickable step in the Stepper. {stepNumber} is the 1-based position, {label} is the step's visible label."
|
|
1073
1081
|
},
|
|
1074
1082
|
"@astryx.step.goToStepWithStatus": {
|
|
1075
1083
|
"defaultMessage": "Go to step {stepNumber, number}: {label}, {status}",
|
|
1076
|
-
"description": "Accessible name for a clickable
|
|
1084
|
+
"description": "Accessible name for a clickable Stepper step that also carries a status. {status} is one of the translated `step.status.*` words (completed/warning/error). Keep the pattern parallel to `step.goToStep`."
|
|
1077
1085
|
},
|
|
1078
1086
|
"@astryx.step.optional": {
|
|
1079
1087
|
"defaultMessage": "Optional",
|
|
1080
|
-
"description": "Visible indicator appended after a
|
|
1088
|
+
"description": "Visible indicator appended after a Stepper step's label when the step is optional (isOptional). Very short; appears inline after the label text."
|
|
1081
1089
|
},
|
|
1082
1090
|
"@astryx.step.status.completed": {
|
|
1083
1091
|
"defaultMessage": "completed",
|
|
1084
|
-
"description": "Screen-reader-only status word rendered next to a
|
|
1092
|
+
"description": "Screen-reader-only status word rendered next to a Stepper step label when the step is done (either progress-completed or status=success). Lowercase adjective; it is read mid-sentence after the step label."
|
|
1085
1093
|
},
|
|
1086
1094
|
"@astryx.step.status.warning": {
|
|
1087
1095
|
"defaultMessage": "warning",
|
|
1088
|
-
"description": "Screen-reader-only status word rendered next to a
|
|
1096
|
+
"description": "Screen-reader-only status word rendered next to a Stepper step label when status=warning. Lowercase noun/adjective; read mid-sentence after the step label."
|
|
1089
1097
|
},
|
|
1090
1098
|
"@astryx.step.status.error": {
|
|
1091
1099
|
"defaultMessage": "error",
|
|
1092
|
-
"description": "Screen-reader-only status word rendered next to a
|
|
1100
|
+
"description": "Screen-reader-only status word rendered next to a Stepper step label when status=error. Lowercase noun; read mid-sentence after the step label."
|
|
1093
1101
|
},
|
|
1094
1102
|
"@astryx.tableTree.collapseRow": {
|
|
1095
1103
|
"defaultMessage": "Collapse row",
|
package/locales/pseudo.json
CHANGED
|
@@ -422,6 +422,9 @@
|
|
|
422
422
|
"@astryx.table.filter.apply": {
|
|
423
423
|
"defaultMessage": "⟦Àþþłý⟧"
|
|
424
424
|
},
|
|
425
|
+
"@astryx.table.rowStatus.columnHeader": {
|
|
426
|
+
"defaultMessage": "⟦Řóŵ šţàţúš⟧"
|
|
427
|
+
},
|
|
425
428
|
"@astryx.table.selection.selectAllRows": {
|
|
426
429
|
"defaultMessage": "⟦Šéłéçţ àłł řóŵš⟧"
|
|
427
430
|
},
|
|
@@ -800,6 +803,9 @@
|
|
|
800
803
|
"@astryx.tableRowExpansion.expandAllRows": {
|
|
801
804
|
"defaultMessage": "⟦Éẋþàñð àłł řóŵš⟧"
|
|
802
805
|
},
|
|
806
|
+
"@astryx.stepper.label": {
|
|
807
|
+
"defaultMessage": "⟦Þřóĝřéšš⟧"
|
|
808
|
+
},
|
|
803
809
|
"@astryx.step.goToStep": {
|
|
804
810
|
"defaultMessage": "⟦Ĝó ţó šţéþ {stepNumber, number}: {label}⟧"
|
|
805
811
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7-canary.29be96d",
|
|
4
4
|
"displayName": "Astryx Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -489,6 +489,11 @@
|
|
|
489
489
|
"types": "./dist/StatusDot/index.d.ts",
|
|
490
490
|
"default": "./dist/StatusDot/index.js"
|
|
491
491
|
},
|
|
492
|
+
"./Stepper": {
|
|
493
|
+
"source": "./src/Stepper/index.ts",
|
|
494
|
+
"types": "./dist/Stepper/index.d.ts",
|
|
495
|
+
"default": "./dist/Stepper/index.js"
|
|
496
|
+
},
|
|
492
497
|
"./Switch": {
|
|
493
498
|
"source": "./src/Switch/index.ts",
|
|
494
499
|
"types": "./dist/Switch/index.d.ts",
|
|
@@ -656,6 +661,7 @@
|
|
|
656
661
|
"react-dom": ">=19.0.0"
|
|
657
662
|
},
|
|
658
663
|
"devDependencies": {
|
|
664
|
+
"@astryxdesign/cli": "0.4.7-canary.29be96d",
|
|
659
665
|
"@babel/cli": "^8.0.4",
|
|
660
666
|
"@babel/core": "^7.29.7",
|
|
661
667
|
"@babel/preset-react": "^8.0.1",
|
|
@@ -664,8 +670,7 @@
|
|
|
664
670
|
"@testing-library/dom": "^10.0.0",
|
|
665
671
|
"@testing-library/jest-dom": "^6.6.0",
|
|
666
672
|
"@testing-library/react": "^16.3.2",
|
|
667
|
-
"rimraf": "^6.0.1"
|
|
668
|
-
"@astryxdesign/cli": "0.4.6"
|
|
673
|
+
"rimraf": "^6.0.1"
|
|
669
674
|
},
|
|
670
675
|
"dependencies": {
|
|
671
676
|
"intl-messageformat": "^11.2.9"
|
|
@@ -148,7 +148,8 @@ export const docsDense = {
|
|
|
148
148
|
{guidance: true, description: 'Match size to context: xsm/sm inline, md/lg in lists, xl for profiles.'},
|
|
149
149
|
{guidance: true, description: 'Add a status dot in chat or team views where availability matters.'},
|
|
150
150
|
{guidance: true, description: 'When wrapping Avatar in your own Tooltip or HoverCard, set tooltip={false} so the built-in name tooltip does not overlap yours.'},
|
|
151
|
-
{guidance: true, description: 'Interactive avatars (href/onClick) need name or alt; without one they warn in development.
|
|
151
|
+
{guidance: true, description: 'Interactive avatars (href/onClick) need name or alt; without one they warn in development.'},
|
|
152
|
+
{guidance: false, description: 'Rely on a status label to name an interactive avatar. "Online" says nothing about where the link goes.'},
|
|
152
153
|
{guidance: false, description: 'Use for logos or product images. Use an image or icon instead.'},
|
|
153
154
|
{guidance: false, description: 'Force a square or custom shape. Avatars are always circular.'},
|
|
154
155
|
],
|
|
@@ -334,6 +334,106 @@ describe('BottomSheet', () => {
|
|
|
334
334
|
expect(onOpenChange).toHaveBeenCalledWith(false);
|
|
335
335
|
});
|
|
336
336
|
|
|
337
|
+
it('ignores Escape while an IME composition is active', () => {
|
|
338
|
+
const onOpenChange = vi.fn();
|
|
339
|
+
render(
|
|
340
|
+
<BottomSheet isOpen onOpenChange={onOpenChange} label="Filters">
|
|
341
|
+
<input aria-label="Search" />
|
|
342
|
+
</BottomSheet>,
|
|
343
|
+
);
|
|
344
|
+
const dialog = screen.getByRole('dialog');
|
|
345
|
+
|
|
346
|
+
fireEvent.keyDown(dialog, {key: 'Escape', isComposing: true});
|
|
347
|
+
fireEvent.keyDown(dialog, {key: 'Escape', keyCode: 229});
|
|
348
|
+
|
|
349
|
+
expect(onOpenChange).not.toHaveBeenCalled();
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
it('claims the composing Escape so no native close request follows', () => {
|
|
353
|
+
const onOpenChange = vi.fn();
|
|
354
|
+
render(
|
|
355
|
+
<BottomSheet isOpen onOpenChange={onOpenChange} label="Filters">
|
|
356
|
+
<input aria-label="Search" />
|
|
357
|
+
</BottomSheet>,
|
|
358
|
+
);
|
|
359
|
+
const dialog = screen.getByRole('dialog');
|
|
360
|
+
|
|
361
|
+
// An unclaimed Escape lets the browser raise its own close request, which
|
|
362
|
+
// arrives as `cancel` and dismisses the sheet on the same keypress. The
|
|
363
|
+
// guard has to swallow the composing Escape, not merely skip dismissal.
|
|
364
|
+
const wasNotClaimed = fireEvent.keyDown(dialog, {
|
|
365
|
+
key: 'Escape',
|
|
366
|
+
isComposing: true,
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
expect(wasNotClaimed).toBe(false);
|
|
370
|
+
expect(onOpenChange).not.toHaveBeenCalled();
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
it('keeps a form sheet open when Escape cancels a field composition', () => {
|
|
374
|
+
const onOpenChange = vi.fn();
|
|
375
|
+
render(
|
|
376
|
+
<BottomSheet
|
|
377
|
+
isOpen
|
|
378
|
+
purpose="form"
|
|
379
|
+
onOpenChange={onOpenChange}
|
|
380
|
+
label="Edit profile">
|
|
381
|
+
<input aria-label="Name" />
|
|
382
|
+
</BottomSheet>,
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
// The reported path: the keydown starts at the composing field and bubbles
|
|
386
|
+
// to the sheet's <dialog>, so the guard has to survive the trip.
|
|
387
|
+
fireEvent.keyDown(screen.getByRole('textbox', {name: 'Name'}), {
|
|
388
|
+
key: 'Escape',
|
|
389
|
+
isComposing: true,
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
expect(onOpenChange).not.toHaveBeenCalled();
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
it('still dismisses on the Escape after a composition is cancelled', () => {
|
|
396
|
+
const onOpenChange = vi.fn();
|
|
397
|
+
render(
|
|
398
|
+
<BottomSheet isOpen onOpenChange={onOpenChange} label="Filters">
|
|
399
|
+
<input aria-label="Search" />
|
|
400
|
+
</BottomSheet>,
|
|
401
|
+
);
|
|
402
|
+
const dialog = screen.getByRole('dialog');
|
|
403
|
+
|
|
404
|
+
fireEvent.keyDown(dialog, {key: 'Escape', isComposing: true});
|
|
405
|
+
expect(onOpenChange).not.toHaveBeenCalled();
|
|
406
|
+
|
|
407
|
+
fireEvent.keyDown(dialog, {key: 'Escape'});
|
|
408
|
+
|
|
409
|
+
expect(onOpenChange).toHaveBeenCalledWith(false);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it('leaves the IME the composition keys that are not Escape', () => {
|
|
413
|
+
const onOpenChange = vi.fn();
|
|
414
|
+
render(
|
|
415
|
+
<BottomSheet isOpen onOpenChange={onOpenChange} label="Filters">
|
|
416
|
+
<input aria-label="Search" />
|
|
417
|
+
</BottomSheet>,
|
|
418
|
+
);
|
|
419
|
+
const dialog = screen.getByRole('dialog');
|
|
420
|
+
|
|
421
|
+
// Enter commits a candidate and the arrows walk the candidate window. The
|
|
422
|
+
// sheet must claim neither, or the IME loses keys it owns.
|
|
423
|
+
const enterUnclaimed = fireEvent.keyDown(dialog, {
|
|
424
|
+
key: 'Enter',
|
|
425
|
+
isComposing: true,
|
|
426
|
+
});
|
|
427
|
+
const arrowUnclaimed = fireEvent.keyDown(dialog, {
|
|
428
|
+
key: 'ArrowDown',
|
|
429
|
+
isComposing: true,
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
expect(enterUnclaimed).toBe(true);
|
|
433
|
+
expect(arrowUnclaimed).toBe(true);
|
|
434
|
+
expect(onOpenChange).not.toHaveBeenCalled();
|
|
435
|
+
});
|
|
436
|
+
|
|
337
437
|
it('requests close when the scrim (dialog element itself) is clicked', () => {
|
|
338
438
|
const onOpenChange = vi.fn();
|
|
339
439
|
render(
|
|
@@ -474,6 +574,29 @@ describe('BottomSheet', () => {
|
|
|
474
574
|
expect(onOpenChange).toHaveBeenCalledWith(false);
|
|
475
575
|
});
|
|
476
576
|
|
|
577
|
+
it('ignores Escape while an IME composition is active', () => {
|
|
578
|
+
const onOpenChange = vi.fn();
|
|
579
|
+
render(
|
|
580
|
+
<BottomSheet
|
|
581
|
+
isOpen
|
|
582
|
+
hasScrim={false}
|
|
583
|
+
onOpenChange={onOpenChange}
|
|
584
|
+
label="Filters">
|
|
585
|
+
<input aria-label="Search" />
|
|
586
|
+
</BottomSheet>,
|
|
587
|
+
);
|
|
588
|
+
|
|
589
|
+
// Escape is this sheet's only keyboard route out — there is no native
|
|
590
|
+
// close request behind it — so the guard is all that stands between a
|
|
591
|
+
// composing CJK user and a dismissed sheet.
|
|
592
|
+
fireEvent.keyDown(screen.getByRole('dialog'), {
|
|
593
|
+
key: 'Escape',
|
|
594
|
+
isComposing: true,
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
expect(onOpenChange).not.toHaveBeenCalled();
|
|
598
|
+
});
|
|
599
|
+
|
|
477
600
|
it('still dismisses on a downward swipe past the threshold', () => {
|
|
478
601
|
const onOpenChange = vi.fn();
|
|
479
602
|
render(
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* SYNC: When modified, update these files to stay in sync:
|
|
18
18
|
* - /packages/core/src/BottomSheet/BottomSheetPanel.tsx
|
|
19
|
+
* - /packages/core/src/BottomSheet/BottomSheetEdgeTint.tsx
|
|
19
20
|
* - /packages/core/src/BottomSheet/BottomSheet.doc.mjs
|
|
20
21
|
* - /packages/core/src/BottomSheet/BottomSheet.test.tsx
|
|
21
22
|
* - /packages/core/src/BottomSheet/BottomSheetSwitcher.tsx
|
|
@@ -37,12 +38,13 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
37
38
|
import type {BaseProps} from '../BaseProps';
|
|
38
39
|
import type {DialogPurpose} from '../Dialog';
|
|
39
40
|
import {colorVars, durationVars, easeVars} from '../theme/tokens.stylex';
|
|
40
|
-
import {useDevWarning, useScrollLock} from '../hooks';
|
|
41
|
+
import {isImeKeyEvent, useDevWarning, useScrollLock} from '../hooks';
|
|
41
42
|
import {
|
|
42
43
|
BottomSheetPanel,
|
|
43
44
|
type BottomSheetPanelMotion,
|
|
44
45
|
type BottomSheetPanelState,
|
|
45
46
|
} from './BottomSheetPanel';
|
|
47
|
+
import {BottomSheetEdgeTint} from './BottomSheetEdgeTint';
|
|
46
48
|
import {
|
|
47
49
|
BottomSheetSwitcherContext,
|
|
48
50
|
type BottomSheetSwitcherContextValue,
|
|
@@ -93,6 +95,20 @@ const styles = stylex.create({
|
|
|
93
95
|
},
|
|
94
96
|
},
|
|
95
97
|
},
|
|
98
|
+
/**
|
|
99
|
+
* The dim leaves with the sheet, on a curve that matches.
|
|
100
|
+
*
|
|
101
|
+
* A fade covers no distance, so the decelerate token front-loads its
|
|
102
|
+
* progress and simply ends it early: `--ease-standard` puts the scrim at 90%
|
|
103
|
+
* faded in 163ms of a 410ms close, leaving an undimmed page under a sheet
|
|
104
|
+
* that is still sliding across it. `linear` spends the duration it is given.
|
|
105
|
+
* Same reasoning the touch date picker's surface swap already carries.
|
|
106
|
+
*/
|
|
107
|
+
scrimClosing: {
|
|
108
|
+
'::backdrop': {
|
|
109
|
+
transitionTimingFunction: 'linear',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
96
112
|
positioner: {
|
|
97
113
|
position: 'absolute',
|
|
98
114
|
insetInline: 0,
|
|
@@ -298,6 +314,9 @@ function StandaloneBottomSheet({
|
|
|
298
314
|
|
|
299
315
|
const handleCancel = useCallback(
|
|
300
316
|
(event: React.SyntheticEvent<HTMLDialogElement>) => {
|
|
317
|
+
// No IME guard here: `cancel` is a plain Event carrying no composition
|
|
318
|
+
// state, and handleKeyDown claims a composing Escape before the browser
|
|
319
|
+
// can raise the close request that would arrive here.
|
|
301
320
|
event.preventDefault();
|
|
302
321
|
dismissOnEscape();
|
|
303
322
|
},
|
|
@@ -305,10 +324,20 @@ function StandaloneBottomSheet({
|
|
|
305
324
|
);
|
|
306
325
|
const handleKeyDown = useCallback(
|
|
307
326
|
(event: React.KeyboardEvent<HTMLDialogElement>) => {
|
|
308
|
-
if (event.key
|
|
309
|
-
|
|
310
|
-
dismissOnEscape();
|
|
327
|
+
if (event.key !== 'Escape') {
|
|
328
|
+
return;
|
|
311
329
|
}
|
|
330
|
+
// Claim the key before reading it: an unclaimed Escape lets the browser
|
|
331
|
+
// raise its own close request, which lands on handleCancel and dismisses
|
|
332
|
+
// on the same keypress.
|
|
333
|
+
event.preventDefault();
|
|
334
|
+
// An IME fires this keydown to cancel an in-progress composition, ahead
|
|
335
|
+
// of compositionend. It is a composition cancel, not a dismissal command
|
|
336
|
+
// — see utils/ime; Dialog and BottomSheetSwitcher guard the same way.
|
|
337
|
+
if (isImeKeyEvent(event.nativeEvent)) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
dismissOnEscape();
|
|
312
341
|
},
|
|
313
342
|
[dismissOnEscape],
|
|
314
343
|
);
|
|
@@ -327,6 +356,7 @@ function StandaloneBottomSheet({
|
|
|
327
356
|
styles.dialog,
|
|
328
357
|
shouldPresent && styles.dialogOpen,
|
|
329
358
|
hasScrim && styles.scrim,
|
|
359
|
+
hasScrim && !isOpen && isPresented && styles.scrimClosing,
|
|
330
360
|
!hasScrim && styles.dialogNonModal,
|
|
331
361
|
)}
|
|
332
362
|
ref={dialogRef}
|
|
@@ -355,6 +385,8 @@ function StandaloneBottomSheet({
|
|
|
355
385
|
{children}
|
|
356
386
|
</BottomSheetPanel>
|
|
357
387
|
</div>
|
|
388
|
+
{/* A modal sheet's ::backdrop already answers Safari's edge sampler. */}
|
|
389
|
+
{hasScrim ? null : <BottomSheetEdgeTint />}
|
|
358
390
|
</dialog>
|
|
359
391
|
);
|
|
360
392
|
}
|