@astryxdesign/core 0.5.0-canary.e6dc4bd → 0.5.0-canary.ea888ef
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/DateInput/DateInput.d.ts +0 -43
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +0 -19
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.d.ts.map +1 -1
- package/dist/Indicator/CheckboxIndicator.d.ts.map +1 -1
- package/dist/Indicator/CheckboxIndicator.js +2 -6
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +26 -2
- package/dist/astryx.css +0 -15
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +25 -3
- package/dist/theme/syntax/tokens.d.ts +1 -1
- package/dist/theme/syntax/tokens.d.ts.map +1 -1
- package/dist/theme/syntax/tokens.js +2 -5
- package/package.json +2 -2
- package/src/DateInput/DateInput.doc.mjs +0 -16
- package/src/DateInput/DateInput.tsx +0 -52
- package/src/DateInput/DateInputTouch.test.tsx +9 -32
- package/src/DateInput/index.ts +0 -1
- package/src/Indicator/CheckboxIndicator.tsx +8 -14
- package/src/Indicator/Indicator.doc.mjs +0 -2
- package/src/Kbd/Kbd.test.tsx +17 -0
- package/src/Kbd/Kbd.tsx +26 -2
- package/src/hooks/useHotkeys.test.ts +18 -0
- package/src/hooks/useHotkeys.ts +25 -3
- package/src/theme/syntax/tokens.ts +2 -5
- package/dist/DateInput/NativeDateField.d.ts +0 -10
- package/dist/DateInput/NativeDateField.d.ts.map +0 -1
- package/dist/DateInput/NativeDateField.js +0 -477
- package/dist/utils/isApplePlatform.d.ts +0 -18
- package/dist/utils/isApplePlatform.d.ts.map +0 -1
- package/dist/utils/isApplePlatform.js +0 -37
- package/src/DateInput/NativeDateField.test.tsx +0 -565
- package/src/DateInput/NativeDateField.tsx +0 -623
- package/src/utils/isApplePlatform.test.ts +0 -61
- package/src/utils/isApplePlatform.ts +0 -37
|
@@ -31,16 +31,6 @@ export type DateInputSize = keyof typeof sizeStyles;
|
|
|
31
31
|
* types stay in compile-time lockstep: renaming or removing one of these
|
|
32
32
|
* members from `TimestampFormat` breaks this type at build time.
|
|
33
33
|
*/
|
|
34
|
-
/**
|
|
35
|
-
* When DateInput hands date picking to the browser/OS instead of its own
|
|
36
|
-
* surfaces.
|
|
37
|
-
*
|
|
38
|
-
* - `'touch'`: native on touch devices (coarse pointer), Astryx's calendar
|
|
39
|
-
* popover on mouse-driven ones
|
|
40
|
-
* - `'always'`: native wherever the browser supports `<input type="date">`
|
|
41
|
-
* - `'never'`: Astryx's own pickers everywhere
|
|
42
|
-
*/
|
|
43
|
-
export type DateInputNativePicker = 'touch' | 'always' | 'never';
|
|
44
34
|
export type DateInputFormat = Extract<TimestampFormat, 'date' | 'date_long' | 'date_weekday' | 'system_date'>;
|
|
45
35
|
export type { InputStatus as DateInputStatus, InputStatusType as DateInputStatusType, } from '../Field';
|
|
46
36
|
import type { BaseProps } from '../BaseProps';
|
|
@@ -212,39 +202,6 @@ export interface DateInputProps extends Omit<BaseProps, 'onChange' | 'defaultVal
|
|
|
212
202
|
* ```
|
|
213
203
|
*/
|
|
214
204
|
format?: DateInputFormat | ((value: ISODateString) => string);
|
|
215
|
-
/**
|
|
216
|
-
* When date picking is handed to the browser/OS instead of Astryx's own
|
|
217
|
-
* surfaces: the field becomes an `<input type="date">` and the platform
|
|
218
|
-
* draws the picker — the iOS wheel, the Android calendar dialog — with the
|
|
219
|
-
* OS's own hit areas, momentum scrolling, locale and accessibility
|
|
220
|
-
* settings.
|
|
221
|
-
*
|
|
222
|
-
* - `'touch'` (default): native on touch devices (coarse pointer), the text
|
|
223
|
-
* field and calendar popover on mouse-driven ones
|
|
224
|
-
* - `'always'`: native wherever the browser supports `<input type="date">`
|
|
225
|
-
* - `'never'`: Astryx's own pickers everywhere — the touch picker on a
|
|
226
|
-
* finger, the calendar popover on a mouse
|
|
227
|
-
*
|
|
228
|
-
* `format` and `placeholder` still apply in native mode: DateInput paints
|
|
229
|
-
* the closed field's text itself, over the control. `numberOfMonths` and
|
|
230
|
-
* `weekStartsOn` do not — they describe a calendar grid the native picker
|
|
231
|
-
* does not have — so a field that needs either should pass `'never'`.
|
|
232
|
-
*
|
|
233
|
-
* `min` and `max` are forwarded, but note that a native picker may not
|
|
234
|
-
* *show* them: on iOS they are constraint-validation flags rather than
|
|
235
|
-
* clamps, so an out-of-range date can be selected and is refused on commit
|
|
236
|
-
* (announced to assistive technology) rather than being greyed out in the
|
|
237
|
-
* picker. `dateConstraints` is enforced the same way, on commit, and is
|
|
238
|
-
* reason enough to prefer `'never'` on a field that uses it.
|
|
239
|
-
*
|
|
240
|
-
* @default 'touch'
|
|
241
|
-
* @example
|
|
242
|
-
* ```
|
|
243
|
-
* // Astryx's own touch picker instead of the platform's
|
|
244
|
-
* <DateInput label="Event date" value={date} onChange={setDate} nativePicker="never" />
|
|
245
|
-
* ```
|
|
246
|
-
*/
|
|
247
|
-
nativePicker?: DateInputNativePicker;
|
|
248
205
|
}
|
|
249
206
|
/**
|
|
250
207
|
* A date picker that fits the pointer it is being used with.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/DateInput/DateInput.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAS3C,OAAO,EAGL,KAAK,WAAW,EAKhB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAOlB,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/DateInput/DateInput.tsx"],"names":[],"mappings":"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"}
|
|
@@ -32,7 +32,6 @@ import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
|
|
32
32
|
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
33
33
|
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
34
34
|
import { usePopover } from "../Popover/index.js";
|
|
35
|
-
import { NativeDateField } from "./NativeDateField.js";
|
|
36
35
|
import { TouchDateField } from "./TouchDateField.js";
|
|
37
36
|
import { useTooltip } from "../Tooltip/index.js";
|
|
38
37
|
import { getInputARIA, isImeKeyEvent, parseDateInput } from "../utils/index.js";
|
|
@@ -88,15 +87,6 @@ const sizeStyles = {
|
|
|
88
87
|
* types stay in compile-time lockstep: renaming or removing one of these
|
|
89
88
|
* members from `TimestampFormat` breaks this type at build time.
|
|
90
89
|
*/
|
|
91
|
-
/**
|
|
92
|
-
* When DateInput hands date picking to the browser/OS instead of its own
|
|
93
|
-
* surfaces.
|
|
94
|
-
*
|
|
95
|
-
* - `'touch'`: native on touch devices (coarse pointer), Astryx's calendar
|
|
96
|
-
* popover on mouse-driven ones
|
|
97
|
-
* - `'always'`: native wherever the browser supports `<input type="date">`
|
|
98
|
-
* - `'never'`: Astryx's own pickers everywhere
|
|
99
|
-
*/
|
|
100
90
|
|
|
101
91
|
// Re-export shared types for convenience
|
|
102
92
|
|
|
@@ -570,15 +560,6 @@ PointerDateField.displayName = 'PointerDateField';
|
|
|
570
560
|
*/
|
|
571
561
|
export function DateInput(props) {
|
|
572
562
|
const isTouch = useMediaQuery(TOUCH_POINTER_QUERY);
|
|
573
|
-
const nativePicker = props.nativePicker ?? 'touch';
|
|
574
|
-
|
|
575
|
-
// The platform's picker, where the consumer asked for it — see the
|
|
576
|
-
// `nativePicker` prop for what that trades away.
|
|
577
|
-
if (nativePicker === 'always' || nativePicker === 'touch' && isTouch) {
|
|
578
|
-
return /*#__PURE__*/_jsx(NativeDateField, {
|
|
579
|
-
...props
|
|
580
|
-
});
|
|
581
|
-
}
|
|
582
563
|
return isTouch ? /*#__PURE__*/_jsx(TouchDateField, {
|
|
583
564
|
...props
|
|
584
565
|
}) : /*#__PURE__*/_jsx(PointerDateField, {
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* @position Package entry point for DateInput
|
|
6
6
|
*/
|
|
7
7
|
export { DateInput } from './DateInput';
|
|
8
|
-
export type { DateInputProps, DateInputSize, DateInputFormat,
|
|
8
|
+
export type { DateInputProps, DateInputSize, DateInputFormat, DateInputStatus, DateInputStatusType, } from './DateInput';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput/index.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,YAAY,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput/index.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,YAAY,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,eAAe,EACf,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxIndicator.d.ts","sourceRoot":"","sources":["../../src/Indicator/CheckboxIndicator.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAwI5C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,IAAW,EACX,UAAkB,EAClB,QAAQ,EACR,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,gBAAgB,CAAC,+
|
|
1
|
+
{"version":3,"file":"CheckboxIndicator.d.ts","sourceRoot":"","sources":["../../src/Indicator/CheckboxIndicator.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAwI5C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,IAAW,EACX,UAAkB,EAClB,QAAQ,EACR,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,gBAAgB,CAAC,+BAwElC;yBAlFe,iBAAiB"}
|
|
@@ -155,9 +155,7 @@ export function CheckboxIndicator({
|
|
|
155
155
|
children: isRenderable(children) ? children : /*#__PURE__*/_jsxs(_Fragment, {
|
|
156
156
|
children: [/*#__PURE__*/_jsx("svg", {
|
|
157
157
|
viewBox: "0 0 10 10",
|
|
158
|
-
...
|
|
159
|
-
size
|
|
160
|
-
}), stylex.props(styles.checkmark, checkmarkSizeStyles[size], isChecked && styles.checkmarkVisible)),
|
|
158
|
+
...stylex.props(styles.checkmark, checkmarkSizeStyles[size], isChecked && styles.checkmarkVisible),
|
|
161
159
|
children: /*#__PURE__*/_jsx("path", {
|
|
162
160
|
d: "M8.5 2.5L4 7.5L1.5 5",
|
|
163
161
|
stroke: "currentColor",
|
|
@@ -167,9 +165,7 @@ export function CheckboxIndicator({
|
|
|
167
165
|
strokeLinejoin: "round"
|
|
168
166
|
})
|
|
169
167
|
}), /*#__PURE__*/_jsx("span", {
|
|
170
|
-
...
|
|
171
|
-
size
|
|
172
|
-
}), stylex.props(styles.indeterminateMark, indeterminateSizeStyles[size], isIndeterminate && styles.indeterminateMarkVisible))
|
|
168
|
+
...stylex.props(styles.indeterminateMark, indeterminateSizeStyles[size], isIndeterminate && styles.indeterminateMarkVisible)
|
|
173
169
|
})]
|
|
174
170
|
})
|
|
175
171
|
});
|
package/dist/Kbd/Kbd.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Kbd.d.ts","sourceRoot":"","sources":["../../src/Kbd/Kbd.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,KAA6B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Kbd.d.ts","sourceRoot":"","sources":["../../src/Kbd/Kbd.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,KAA6B,MAAM,OAAO,CAAC;AAGlD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAmI5C,MAAM,WAAW,QAAS,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC1D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACjC;;;;;;;;;;;;OAYG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,GAAG,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAC,EAAE,QAAQ,qBAgC3E;yBAhCe,GAAG"}
|
package/dist/Kbd/Kbd.js
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
import React, { useSyncExternalStore } from 'react';
|
|
16
16
|
import * as stylex from '@stylexjs/stylex';
|
|
17
17
|
import { mergeProps } from "../utils/index.js";
|
|
18
|
-
import { isApplePlatform } from "../utils/isApplePlatform.js";
|
|
19
18
|
import { themeProps } from "../utils/themeProps.js";
|
|
20
19
|
import "../theme/tokens.stylex.js";
|
|
21
20
|
import { colorVars, spacingVars, radiusVars, typographyVars, fontWeightVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
@@ -99,6 +98,31 @@ function subscribeToPlatformChanges() {
|
|
|
99
98
|
function getServerPlatformSnapshot() {
|
|
100
99
|
return false;
|
|
101
100
|
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Detects whether the current platform is macOS/iOS.
|
|
104
|
+
* Prefers the User-Agent Client Hints API when it names a platform (modern
|
|
105
|
+
* Chrome/Edge), falls back to navigator.platform (deprecated but universally
|
|
106
|
+
* supported) when it is absent or blank.
|
|
107
|
+
*/
|
|
108
|
+
function detectMac() {
|
|
109
|
+
if (typeof navigator === 'undefined') {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
// Prefer User-Agent Client Hints API (not deprecated)
|
|
113
|
+
const uaData = 'userAgentData' in navigator ? navigator.userAgentData : null;
|
|
114
|
+
if (uaData && typeof uaData === 'object' && 'platform' in uaData) {
|
|
115
|
+
const uaPlatform = uaData.platform;
|
|
116
|
+
// A blank platform is no answer, not a negative one. Builds that rewrite
|
|
117
|
+
// their client-hints identity ship '', so fall through rather than
|
|
118
|
+
// reading it as "not Apple".
|
|
119
|
+
if (typeof uaPlatform === 'string' && uaPlatform.trim() !== '') {
|
|
120
|
+
return /mac/i.test(uaPlatform);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Fallback: navigator.platform (deprecated but still shipped everywhere)
|
|
124
|
+
return /Mac|iPhone|iPad|iPod/.test(navigator.platform ?? '');
|
|
125
|
+
}
|
|
102
126
|
/**
|
|
103
127
|
* Displays a keyboard shortcut as styled <kbd> elements.
|
|
104
128
|
*
|
|
@@ -122,7 +146,7 @@ export function Kbd({
|
|
|
122
146
|
style,
|
|
123
147
|
...rest
|
|
124
148
|
}) {
|
|
125
|
-
const isMac = useSyncExternalStore(subscribeToPlatformChanges,
|
|
149
|
+
const isMac = useSyncExternalStore(subscribeToPlatformChanges, detectMac, getServerPlatformSnapshot);
|
|
126
150
|
const parts = keys.split('+').map(key => key.trim().toLowerCase());
|
|
127
151
|
|
|
128
152
|
// Screen-reader name: the joined spoken labels (e.g. "Command + K"), since
|
package/dist/astryx.css
CHANGED
|
@@ -434,7 +434,6 @@
|
|
|
434
434
|
.x98rzlu:not(#\#):not(#\#){flex:1}
|
|
435
435
|
.xxhr3t:not(#\#):not(#\#){gap:0}
|
|
436
436
|
.x1jnr06f:not(#\#):not(#\#){gap:4px}
|
|
437
|
-
.x167g77z:not(#\#):not(#\#){gap:8px}
|
|
438
437
|
.x14kbac9:not(#\#):not(#\#){gap:inherit}
|
|
439
438
|
.x1lsbc85:not(#\#):not(#\#){gap:var(--spacing-0-5)}
|
|
440
439
|
.xsn7fz1:not(#\#):not(#\#){gap:var(--spacing-0)}
|
|
@@ -559,7 +558,6 @@
|
|
|
559
558
|
@media (hover: hover){.x61roa7.x61roa7.x61roa7:where(.x1odsvnm:hover *):not(#\#):not(#\#){border-color:var(--color-border)}}
|
|
560
559
|
@media (hover: hover){.x1xwh4np.x1xwh4np.x1xwh4np:hover:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#){border-color:var(--color-border-emphasized)}}
|
|
561
560
|
@media (hover: hover){.x13nosk6.x13nosk6.x13nosk6:hover:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#){text-decoration:underline}}
|
|
562
|
-
.x1lugfcp:not(#\#):not(#\#):not(#\#){-webkit-appearance:none}
|
|
563
561
|
.x67t5t6:not(#\#):not(#\#):not(#\#){-webkit-backdrop-filter:blur(12px)}
|
|
564
562
|
.x1ua5tub:not(#\#):not(#\#):not(#\#){-webkit-box-orient:vertical}
|
|
565
563
|
.x1yhjpo9:not(#\#):not(#\#):not(#\#){-webkit-line-clamp:var(--x-WebkitLineClamp)}
|
|
@@ -569,7 +567,6 @@
|
|
|
569
567
|
.xt2iwb0:not(#\#):not(#\#):not(#\#){-webkit-mask-image:linear-gradient(transparent,transparent)}
|
|
570
568
|
.x5lxg6s:not(#\#):not(#\#):not(#\#){-webkit-overflow-scrolling:touch}
|
|
571
569
|
.x1i10hfl:not(#\#):not(#\#):not(#\#){-webkit-tap-highlight-color:transparent}
|
|
572
|
-
.xg7jpbn:not(#\#):not(#\#):not(#\#){-webkit-text-fill-color:transparent}
|
|
573
570
|
.xpdipgo:not(#\#):not(#\#):not(#\#){-webkit-touch-callout:none}
|
|
574
571
|
.x8gbvx8:not(#\#):not(#\#):not(#\#){align-content:flex-start}
|
|
575
572
|
.x1pha0wt:not(#\#):not(#\#):not(#\#){align-items:baseline}
|
|
@@ -1466,7 +1463,6 @@
|
|
|
1466
1463
|
.xs02d24:not(#\#):not(#\#):not(#\#):not(#\#){height:calc(100% + 1px)}
|
|
1467
1464
|
.x12qplqi:not(#\#):not(#\#):not(#\#):not(#\#){height:calc(100% + var(--container-padding-block-start,0px) + var(--container-padding-block-end,0px))}
|
|
1468
1465
|
.xpa73km:not(#\#):not(#\#):not(#\#):not(#\#){height:calc(100dvh - var(--_app-shell-header-height,0px))}
|
|
1469
|
-
.x1oglpa6:not(#\#):not(#\#):not(#\#):not(#\#){height:calc(max(1rem,var(--text-body-size)) * var(--text-body-leading));height:1lh}
|
|
1470
1466
|
.x1tpcejd:not(#\#):not(#\#):not(#\#):not(#\#){height:calc(var(--_sheet-budget) + 48px)}
|
|
1471
1467
|
.x1uiybsj:not(#\#):not(#\#):not(#\#):not(#\#){height:calc(var(--size-element-lg) - 4px)}
|
|
1472
1468
|
.x102lyln:not(#\#):not(#\#):not(#\#):not(#\#){height:calc(var(--size-element-lg) - 8px)}
|
|
@@ -1770,13 +1766,7 @@
|
|
|
1770
1766
|
.xxyica1:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{border-radius:inherit}
|
|
1771
1767
|
.x17gn2l9:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{grid-column:1}
|
|
1772
1768
|
.xd54j2p:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{inset-block:0}
|
|
1773
|
-
.xpsyfx0:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-date-and-time-value{margin-block:0}
|
|
1774
|
-
.x1qqcexc:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-date-and-time-value{margin-inline:0}
|
|
1775
|
-
.x1x4c3m6:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-date-and-time-value{padding-block:0}
|
|
1776
|
-
.xtbxizx:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-datetime-edit{padding-block:0}
|
|
1777
1769
|
@starting-style{.x5rzir7.x5rzir7:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#){padding-bottom:0}}
|
|
1778
|
-
.xkqr7wz:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-date-and-time-value{padding-inline:0}
|
|
1779
|
-
.xslb4at:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-datetime-edit{padding-inline:0}
|
|
1780
1770
|
.xvtkv6q:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{transition:background-color .15s ease,width .15s ease}
|
|
1781
1771
|
.x17s1k9h:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{transition:opacity .15s ease}
|
|
1782
1772
|
.x19ds33d:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{align-self:start}
|
|
@@ -1800,15 +1790,12 @@
|
|
|
1800
1790
|
.xc2ndz5:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{content:counter(astryx-list) "."}
|
|
1801
1791
|
.xh3pasq:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{content:var(--_input-clear-hit-content)}
|
|
1802
1792
|
.xhkezso:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{display:block}
|
|
1803
|
-
.xolhmmf:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-calendar-picker-indicator{display:none}
|
|
1804
1793
|
.x3nzp0f:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{font-family:var(--font-family-code)}
|
|
1805
1794
|
.xekda60:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{inset-inline-end:-2px}
|
|
1806
1795
|
.x1unh1gc:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{inset-inline-end:0}
|
|
1807
1796
|
.xvw6utc:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{inset-inline-start:-2px}
|
|
1808
1797
|
.x1iygr5g:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{inset-inline-start:0}
|
|
1809
1798
|
.x1km86hw:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{inset-inline-start:calc(var(--spacing-4) + var(--_codeblock-gutter-width) + var(--spacing-3))}
|
|
1810
|
-
.x15bqym3:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-datetime-edit{line-height:inherit}
|
|
1811
|
-
.x1f74mqm:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-date-and-time-value{line-height:inherit}
|
|
1812
1799
|
.xph5o2a:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::backdrop{opacity:0}
|
|
1813
1800
|
.xb3n6bw:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::backdrop{opacity:1}
|
|
1814
1801
|
.xni466t:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::backdrop{opacity:var(--_sheet-scrim-opacity,1)}
|
|
@@ -1819,7 +1806,6 @@
|
|
|
1819
1806
|
.x1hmns74:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{position:absolute}
|
|
1820
1807
|
.x1j6awrg:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{position:absolute}
|
|
1821
1808
|
.x1wnbjh8:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{text-align:end}
|
|
1822
|
-
.x9rmy9g:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-date-and-time-value{text-align:start}
|
|
1823
1809
|
.x1fgylwi:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{transform-origin:center top}
|
|
1824
1810
|
.xgu12d:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{transform-origin:left center}
|
|
1825
1811
|
.x1e8txe:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{transform:scaleX(0)}
|
|
@@ -1859,7 +1845,6 @@
|
|
|
1859
1845
|
.xe80sof:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{bottom:-2px}
|
|
1860
1846
|
.x1xrz1ek:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{bottom:0}
|
|
1861
1847
|
.xu6fald:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{height:var(--_sheet-keyboard-inset,0px)}
|
|
1862
|
-
.xec4aax:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::-webkit-date-and-time-value{min-height:0}
|
|
1863
1848
|
.x51xajf:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{top:-2px}
|
|
1864
1849
|
.x1m1drc7:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{top:0}
|
|
1865
1850
|
.xkj6t0a:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{width:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHotkeys.d.ts","sourceRoot":"","sources":["../../src/hooks/useHotkeys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useHotkeys.d.ts","sourceRoot":"","sources":["../../src/hooks/useHotkeys.ts"],"names":[],"mappings":"AA6BA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;;;;;;;;;;OAeG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gEAAgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAkGD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAkClD"}
|
package/dist/hooks/useHotkeys.js
CHANGED
|
@@ -18,15 +18,13 @@
|
|
|
18
18
|
* unless a hotkey opts in via `allowInInputs`.
|
|
19
19
|
*
|
|
20
20
|
* Platform-aware: `mod` maps to metaKey (⌘) on Apple platforms and
|
|
21
|
-
* ctrlKey elsewhere
|
|
22
|
-
* displayed and handled shortcuts cannot disagree.
|
|
21
|
+
* ctrlKey elsewhere — mirrors the detection used by Kbd.
|
|
23
22
|
*
|
|
24
23
|
* SYNC: When modified, update:
|
|
25
24
|
* - /packages/core/src/hooks/index.ts
|
|
26
25
|
* - /packages/core/src/hooks/useHotkeys.doc.mjs
|
|
27
26
|
*/
|
|
28
27
|
import { useEffect, useRef } from 'react';
|
|
29
|
-
import { isApplePlatform } from "../utils/isApplePlatform.js";
|
|
30
28
|
|
|
31
29
|
/**
|
|
32
30
|
* A single keyboard shortcut registration.
|
|
@@ -44,6 +42,30 @@ const KEY_ALIASES = {
|
|
|
44
42
|
plus: '+'
|
|
45
43
|
};
|
|
46
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Detects whether the current platform is macOS/iOS.
|
|
47
|
+
* Prefers the User-Agent Client Hints API when it names a platform (modern
|
|
48
|
+
* Chrome/Edge), falls back to navigator.platform (deprecated but universally
|
|
49
|
+
* supported) when it is absent or blank.
|
|
50
|
+
* Mirrors the detection used by Kbd so displayed and handled shortcuts agree.
|
|
51
|
+
*/
|
|
52
|
+
function isApplePlatform() {
|
|
53
|
+
if (typeof navigator === 'undefined') {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const uaData = 'userAgentData' in navigator ? navigator.userAgentData : null;
|
|
57
|
+
if (uaData && typeof uaData === 'object' && 'platform' in uaData) {
|
|
58
|
+
const uaPlatform = uaData.platform;
|
|
59
|
+
// A blank platform is no answer, not a negative one. Builds that rewrite
|
|
60
|
+
// their client-hints identity ship '', so fall through rather than
|
|
61
|
+
// reading it as "not Apple".
|
|
62
|
+
if (typeof uaPlatform === 'string' && uaPlatform.trim() !== '') {
|
|
63
|
+
return /mac/i.test(uaPlatform);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return /Mac|iPhone|iPad|iPod/.test(navigator.platform ?? '');
|
|
67
|
+
}
|
|
68
|
+
|
|
47
69
|
/**
|
|
48
70
|
* Whether the event target is a typing surface where global shortcuts
|
|
49
71
|
* should stay silent by default.
|
|
@@ -29,7 +29,7 @@ export declare const syntaxTokenDefaults: {
|
|
|
29
29
|
readonly '--color-syntax-tag': "var(--color-text-red)";
|
|
30
30
|
readonly '--color-syntax-attribute': "var(--color-text-teal)";
|
|
31
31
|
readonly '--color-syntax-property': "var(--color-text-cyan)";
|
|
32
|
-
readonly '--color-syntax-punctuation': "var(--color-text-
|
|
32
|
+
readonly '--color-syntax-punctuation': "var(--color-text-disabled)";
|
|
33
33
|
readonly '--color-syntax-background': "var(--color-background-muted)";
|
|
34
34
|
};
|
|
35
35
|
export type SyntaxTokenName = keyof typeof syntaxTokenDefaults;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/theme/syntax/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/theme/syntax/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;CA6BtB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,mBAAmB,CAAC"}
|
|
@@ -44,11 +44,8 @@ export const syntaxTokenDefaults = {
|
|
|
44
44
|
'--color-syntax-attribute': 'var(--color-text-teal)',
|
|
45
45
|
// property -> cyan text (object properties)
|
|
46
46
|
'--color-syntax-property': 'var(--color-text-cyan)',
|
|
47
|
-
// punctuation ->
|
|
48
|
-
|
|
49
|
-
// controls), and punctuation in a code sample is normal, always-active
|
|
50
|
-
// text — see #5386.
|
|
51
|
-
'--color-syntax-punctuation': 'var(--color-text-secondary)',
|
|
47
|
+
// punctuation -> disabled text (brackets, semicolons)
|
|
48
|
+
'--color-syntax-punctuation': 'var(--color-text-disabled)',
|
|
52
49
|
// background -> muted surface
|
|
53
50
|
'--color-syntax-background': 'var(--color-background-muted)'
|
|
54
51
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.5.0-canary.
|
|
3
|
+
"version": "0.5.0-canary.ea888ef",
|
|
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",
|
|
@@ -661,7 +661,7 @@
|
|
|
661
661
|
"react-dom": ">=19.0.0"
|
|
662
662
|
},
|
|
663
663
|
"devDependencies": {
|
|
664
|
-
"@astryxdesign/cli": "0.5.0-canary.
|
|
664
|
+
"@astryxdesign/cli": "0.5.0-canary.ea888ef",
|
|
665
665
|
"@babel/cli": "^8.0.4",
|
|
666
666
|
"@babel/core": "^7.29.7",
|
|
667
667
|
"@babel/preset-react": "^8.0.1",
|
|
@@ -156,13 +156,6 @@ export const docs = {
|
|
|
156
156
|
"How the committed date value is displayed. Named values are reused from Timestamp's format vocabulary: 'date' shows 'Mar 21, 2026', 'date_long' shows 'March 21, 2026', 'date_weekday' shows 'Wed, Mar 21, 2026', 'system_date' shows '2026-03-21'. A function receives the ISO value and returns a custom string. Applies only to the committed value, never to text being typed.",
|
|
157
157
|
default: "'date_long'",
|
|
158
158
|
},
|
|
159
|
-
{
|
|
160
|
-
name: 'nativePicker',
|
|
161
|
-
type: "'touch' | 'always' | 'never'",
|
|
162
|
-
description:
|
|
163
|
-
"Which surface draws the date picker. 'touch' (the default) hands a touch device to the browser/OS \u2014 the field becomes an input type=date and the platform draws the picker (the iOS wheel, the Android calendar dialog); 'always' does that wherever the browser supports input type=date; 'never' keeps Astryx's own pickers everywhere (the bottom-sheet picker on a finger, the calendar popover on a mouse). Use 'never' for a field that needs weekStartsOn, numberOfMonths or dateConstraints, none of which a native picker can express. format and placeholder still apply in native mode; min and max are forwarded, but a native picker may not show them (on iOS an out-of-range date can be selected and is refused on commit rather than greyed out).",
|
|
164
|
-
default: "'touch'",
|
|
165
|
-
},
|
|
166
159
|
{
|
|
167
160
|
name: 'width',
|
|
168
161
|
type: 'SizeValue',
|
|
@@ -444,13 +437,6 @@ export const docsZh = {
|
|
|
444
437
|
"已选日期的显示格式。命名值复用 Timestamp 的格式词汇:'date' 显示 'Mar 21, 2026','date_long' 显示 'March 21, 2026','date_weekday' 显示 'Wed, Mar 21, 2026','system_date' 显示 '2026-03-21'。函数接收 ISO 值并返回自定义字符串。仅作用于已提交的值,不影响正在输入的文本。",
|
|
445
438
|
default: "'date_long'",
|
|
446
439
|
},
|
|
447
|
-
{
|
|
448
|
-
name: 'nativePicker',
|
|
449
|
-
type: "'touch' | 'always' | 'never'",
|
|
450
|
-
description:
|
|
451
|
-
"由哪个界面绘制日期选择器。'touch'(默认)在触摸设备上交给浏览器/操作系统:字段变为 input type=date,由平台绘制选择器(iOS 滚轮、Android 日历对话框);'always' 在所有支持 input type=date 的浏览器上都这样做;'never' 始终使用 Astryx 自带的选择器(触摸设备用底部弹出选择器,鼠标设备用日历弹出层)。需要 weekStartsOn、numberOfMonths 或 dateConstraints 的字段应使用 'never',原生选择器无法表达这些。原生模式下 format 和 placeholder 仍然生效;min 和 max 会传递给原生控件,但原生选择器可能不会显示这些限制(在 iOS 上仍可选中超出范围的日期,会在提交时被拒绝,而不是变灰)。",
|
|
452
|
-
default: "'touch'",
|
|
453
|
-
},
|
|
454
440
|
{
|
|
455
441
|
name: 'xstyle',
|
|
456
442
|
type: 'StyleXStyles',
|
|
@@ -551,8 +537,6 @@ export const docsDense = {
|
|
|
551
537
|
weekStartsOn: 'first day of week in calendar (0=Sunday, or name e.g. "mon")',
|
|
552
538
|
format:
|
|
553
539
|
"committed-value display: 'date_long' (default, March 21, 2026), 'date' (Mar 21, 2026), 'date_weekday' (Wed, Mar 21, 2026), 'system_date' (2026-03-21), or (iso)=>string; reuses Timestamp vocabulary. Committed value only, not while typing.",
|
|
554
|
-
nativePicker:
|
|
555
|
-
"which surface draws the picker: 'touch' (default) = browser/OS on a coarse pointer, 'always', 'never' = Astryx's own everywhere. use 'never' for weekStartsOn/numberOfMonths/dateConstraints. format+placeholder still apply; min/max forwarded but not necessarily shown by the OS picker \u2014 refused on commit instead.",
|
|
556
540
|
xstyle: 'StyleX styles for layout; must be stylex.create() value',
|
|
557
541
|
},
|
|
558
542
|
};
|
|
@@ -62,7 +62,6 @@ import {useInputStatusIcon} from '../hooks/useInputStatusIcon';
|
|
|
62
62
|
import {useMediaQuery} from '../hooks/useMediaQuery';
|
|
63
63
|
import {useResolvedRequired} from '../hooks/useResolvedRequired';
|
|
64
64
|
import {usePopover} from '../Popover';
|
|
65
|
-
import {NativeDateField} from './NativeDateField';
|
|
66
65
|
import {TouchDateField} from './TouchDateField';
|
|
67
66
|
import {useTooltip} from '../Tooltip';
|
|
68
67
|
import {getInputARIA, isImeKeyEvent, parseDateInput} from '../utils';
|
|
@@ -151,17 +150,6 @@ export type DateInputSize = keyof typeof sizeStyles;
|
|
|
151
150
|
* types stay in compile-time lockstep: renaming or removing one of these
|
|
152
151
|
* members from `TimestampFormat` breaks this type at build time.
|
|
153
152
|
*/
|
|
154
|
-
/**
|
|
155
|
-
* When DateInput hands date picking to the browser/OS instead of its own
|
|
156
|
-
* surfaces.
|
|
157
|
-
*
|
|
158
|
-
* - `'touch'`: native on touch devices (coarse pointer), Astryx's calendar
|
|
159
|
-
* popover on mouse-driven ones
|
|
160
|
-
* - `'always'`: native wherever the browser supports `<input type="date">`
|
|
161
|
-
* - `'never'`: Astryx's own pickers everywhere
|
|
162
|
-
*/
|
|
163
|
-
export type DateInputNativePicker = 'touch' | 'always' | 'never';
|
|
164
|
-
|
|
165
153
|
export type DateInputFormat = Extract<
|
|
166
154
|
TimestampFormat,
|
|
167
155
|
'date' | 'date_long' | 'date_weekday' | 'system_date'
|
|
@@ -373,40 +361,6 @@ export interface DateInputProps extends Omit<
|
|
|
373
361
|
* ```
|
|
374
362
|
*/
|
|
375
363
|
format?: DateInputFormat | ((value: ISODateString) => string);
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* When date picking is handed to the browser/OS instead of Astryx's own
|
|
379
|
-
* surfaces: the field becomes an `<input type="date">` and the platform
|
|
380
|
-
* draws the picker — the iOS wheel, the Android calendar dialog — with the
|
|
381
|
-
* OS's own hit areas, momentum scrolling, locale and accessibility
|
|
382
|
-
* settings.
|
|
383
|
-
*
|
|
384
|
-
* - `'touch'` (default): native on touch devices (coarse pointer), the text
|
|
385
|
-
* field and calendar popover on mouse-driven ones
|
|
386
|
-
* - `'always'`: native wherever the browser supports `<input type="date">`
|
|
387
|
-
* - `'never'`: Astryx's own pickers everywhere — the touch picker on a
|
|
388
|
-
* finger, the calendar popover on a mouse
|
|
389
|
-
*
|
|
390
|
-
* `format` and `placeholder` still apply in native mode: DateInput paints
|
|
391
|
-
* the closed field's text itself, over the control. `numberOfMonths` and
|
|
392
|
-
* `weekStartsOn` do not — they describe a calendar grid the native picker
|
|
393
|
-
* does not have — so a field that needs either should pass `'never'`.
|
|
394
|
-
*
|
|
395
|
-
* `min` and `max` are forwarded, but note that a native picker may not
|
|
396
|
-
* *show* them: on iOS they are constraint-validation flags rather than
|
|
397
|
-
* clamps, so an out-of-range date can be selected and is refused on commit
|
|
398
|
-
* (announced to assistive technology) rather than being greyed out in the
|
|
399
|
-
* picker. `dateConstraints` is enforced the same way, on commit, and is
|
|
400
|
-
* reason enough to prefer `'never'` on a field that uses it.
|
|
401
|
-
*
|
|
402
|
-
* @default 'touch'
|
|
403
|
-
* @example
|
|
404
|
-
* ```
|
|
405
|
-
* // Astryx's own touch picker instead of the platform's
|
|
406
|
-
* <DateInput label="Event date" value={date} onChange={setDate} nativePicker="never" />
|
|
407
|
-
* ```
|
|
408
|
-
*/
|
|
409
|
-
nativePicker?: DateInputNativePicker;
|
|
410
364
|
}
|
|
411
365
|
|
|
412
366
|
/**
|
|
@@ -933,13 +887,7 @@ PointerDateField.displayName = 'PointerDateField';
|
|
|
933
887
|
*/
|
|
934
888
|
export function DateInput(props: DateInputProps) {
|
|
935
889
|
const isTouch = useMediaQuery(TOUCH_POINTER_QUERY);
|
|
936
|
-
const nativePicker = props.nativePicker ?? 'touch';
|
|
937
890
|
|
|
938
|
-
// The platform's picker, where the consumer asked for it — see the
|
|
939
|
-
// `nativePicker` prop for what that trades away.
|
|
940
|
-
if (nativePicker === 'always' || (nativePicker === 'touch' && isTouch)) {
|
|
941
|
-
return <NativeDateField {...props} />;
|
|
942
|
-
}
|
|
943
891
|
return isTouch ? (
|
|
944
892
|
<TouchDateField {...props} />
|
|
945
893
|
) : (
|