@astryxdesign/core 0.7.8-canary.da689f9 → 0.7.8-canary.ea33daf
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/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +34 -6
- package/dist/Icon/Icon.d.ts +3 -3
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +15 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +15 -15
- package/dist/Resizable/createResizable.d.ts +70 -16
- package/dist/Resizable/createResizable.d.ts.map +1 -1
- package/dist/Resizable/createResizable.js +180 -22
- package/dist/Resizable/separatorAttributes.d.ts +45 -0
- package/dist/Resizable/separatorAttributes.d.ts.map +1 -0
- package/dist/Resizable/separatorAttributes.js +35 -0
- package/dist/Resizable/useResizable.js +2 -2
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +12 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +13 -3
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +11 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +27 -14
- package/dist/astryx.css +10 -1
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +5 -4
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts +8 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.js +13 -0
- package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.js +3 -1
- package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.js +3 -1
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +4 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +4 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +14 -13
- package/dist/theme/themeMotion.d.ts.map +1 -1
- package/dist/theme/themeMotion.js +8 -2
- package/dist/theme/tokens.stylex.d.ts +3 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +4 -1
- package/dist/utils/pressFeedback.d.ts +6 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +4 -4
- package/locales/en.json +16 -0
- package/locales/pseudo.json +12 -0
- package/package.json +4 -4
- package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +5 -0
- package/src/DateInput/PickerWheel.tsx +2 -4
- package/src/DateInput/Wheel.tsx +67 -21
- package/src/Icon/Icon.doc.mjs +3 -3
- package/src/Icon/Icon.tsx +19 -4
- package/src/Resizable/ResizeHandle.tsx +18 -26
- package/src/Resizable/createResizable.ts +242 -27
- package/src/Resizable/separatorAttributes.ts +73 -0
- package/src/Resizable/useResizable.ts +2 -2
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +27 -7
- package/src/Table/plugins/tree/useTableTreeData.tsx +43 -20
- package/src/Table/useTableRowExpansion.doc.mjs +9 -0
- package/src/Table/useTableTreeData.doc.mjs +15 -3
- package/src/hooks/actionGroupTracker.ts +5 -4
- package/src/i18n/generated-english/Resizable/createResizable.generated.ts +14 -0
- package/src/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.ts +3 -1
- package/src/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.ts +3 -1
- package/src/i18n/generated-locales/en.generated.ts +4 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +4 -0
- package/src/theme/generateThemeRules.ts +14 -12
- package/src/theme/themeMotion.ts +10 -2
- package/src/theme/tokens.stylex.ts +2 -0
- package/src/utils/pressFeedback.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickerWheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/PickerWheel.tsx"],"names":[],"mappings":"AAmDA,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"PickerWheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/PickerWheel.tsx"],"names":[],"mappings":"AAmDA,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AA2HxB;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAe,GAChB,EAAE,UAAU,+BAghBZ;yBAthBe,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/Wheel.tsx"],"names":[],"mappings":"AAoDA,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../src/DateInput/Wheel.tsx"],"names":[],"mappings":"AAoDA,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAC;AAoMxB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,+BAKtC;yBALe,KAAK;;;AASrB;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAe,GAChB,EAAE,UAAU,+BAoUZ;yBA1Ue,WAAW"}
|
package/dist/DateInput/Wheel.js
CHANGED
|
@@ -51,10 +51,21 @@ const ITEM_BLOCK_SIZE = dateInputTouchSizes.wheelItemSize;
|
|
|
51
51
|
* at the top — which is what a `view()` timeline over the `cover` range means,
|
|
52
52
|
* and why this reads as a cylinder rotating under the finger.
|
|
53
53
|
*/
|
|
54
|
-
const
|
|
54
|
+
const tip = "x18sn2u9-B";
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Colour keeps every row at WCAG AA, which an opacity fade does not. The ends
|
|
58
|
+
* stop halfway to the secondary text colour, because that colour alone falls
|
|
59
|
+
* below AA in two shipped themes.
|
|
60
|
+
*/
|
|
61
|
+
const fade = "x1ofkhwi-B";
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A disabled row keeps its disabled colour and fades by opacity instead: WCAG
|
|
65
|
+
* 1.4.3 exempts inactive components from the contrast minimum.
|
|
66
|
+
*/
|
|
67
|
+
const tipAndDim = "x1tut0r7-B";
|
|
68
|
+
const dim = "xuvekqa-B";
|
|
58
69
|
const styles = {
|
|
59
70
|
scroller: {
|
|
60
71
|
kZKoxP: "xm8gem",
|
|
@@ -409,20 +420,37 @@ export function ScrollWheel({
|
|
|
409
420
|
0: {
|
|
410
421
|
className: "x78zum5 x6s0dn4 xl56j7k x6hpsvf xf314gf x1hdbdi8 xc342km xng3xce xjbqb8w x18juvz8 x1sodnla x1tgivj0 xuxw1ft x1ypdohk x16khyan x87ps6o x1jbe559 xuedmi6"
|
|
411
422
|
},
|
|
423
|
+
4: {
|
|
424
|
+
className: "x78zum5 x6s0dn4 xl56j7k x6hpsvf xf314gf x1hdbdi8 xc342km xng3xce xjbqb8w x18juvz8 x1sodnla x1tgivj0 xuxw1ft x1ypdohk x16khyan x87ps6o x1jbe559 xuedmi6 xssvwzl x190lv1 xg8s4dl x1u6ievf xwms9i0 x1esw782"
|
|
425
|
+
},
|
|
412
426
|
2: {
|
|
413
427
|
className: "x78zum5 x6s0dn4 xl56j7k x6hpsvf xf314gf x1hdbdi8 xc342km xng3xce xjbqb8w x18juvz8 xuxw1ft x1ypdohk x16khyan x87ps6o x1jbe559 xuedmi6 xjse4m1 x2mo6ok"
|
|
414
428
|
},
|
|
429
|
+
6: {
|
|
430
|
+
className: "x78zum5 x6s0dn4 xl56j7k x6hpsvf xf314gf x1hdbdi8 xc342km xng3xce xjbqb8w x18juvz8 xuxw1ft x1ypdohk x16khyan x87ps6o x1jbe559 xuedmi6 xssvwzl x190lv1 xg8s4dl x1u6ievf xwms9i0 x1esw782 xjse4m1 x2mo6ok"
|
|
431
|
+
},
|
|
415
432
|
1: {
|
|
416
433
|
className: "x78zum5 x6s0dn4 xl56j7k x6hpsvf xf314gf x1hdbdi8 xc342km xng3xce xjbqb8w x18juvz8 x1sodnla xuxw1ft x87ps6o x1jbe559 xuedmi6 xnbbluu xt0e3qv"
|
|
417
434
|
},
|
|
435
|
+
5: {
|
|
436
|
+
className: "x78zum5 x6s0dn4 xl56j7k x6hpsvf xf314gf x1hdbdi8 xc342km xng3xce xjbqb8w x18juvz8 x1sodnla xuxw1ft x87ps6o x1jbe559 xuedmi6 xssvwzl x190lv1 xg8s4dl x1u6ievf xwms9i0 x1esw782 xnbbluu xt0e3qv"
|
|
437
|
+
},
|
|
418
438
|
3: {
|
|
419
439
|
className: "x78zum5 x6s0dn4 xl56j7k x6hpsvf xf314gf x1hdbdi8 xc342km xng3xce xjbqb8w x18juvz8 xuxw1ft x87ps6o x1jbe559 xuedmi6 x2mo6ok xnbbluu xt0e3qv"
|
|
440
|
+
},
|
|
441
|
+
7: {
|
|
442
|
+
className: "x78zum5 x6s0dn4 xl56j7k x6hpsvf xf314gf x1hdbdi8 xc342km xng3xce xjbqb8w x18juvz8 xuxw1ft x87ps6o x1jbe559 xuedmi6 xssvwzl x190lv1 xg8s4dl x1u6ievf xwms9i0 x1esw782 x2mo6ok xnbbluu xt0e3qv"
|
|
420
443
|
}
|
|
421
|
-
}[!!(index === activeIndex) << 1 | !!option.isDisabled << 0],
|
|
444
|
+
}[!!(index !== activeIndex && !option.isDisabled) << 2 | !!(index === activeIndex) << 1 | !!option.isDisabled << 0],
|
|
422
445
|
children: /*#__PURE__*/_jsx("span", {
|
|
423
446
|
...{
|
|
424
|
-
|
|
425
|
-
|
|
447
|
+
0: {
|
|
448
|
+
className: "x78zum5 x6s0dn4 xl56j7k xh8yej3 x5yr21d xb3r6kr xlyipyv x1trhrh1 x1pljy2o x190lv1 xg8s4dl x1u6ievf xwms9i0 x1esw782 xlp1x4z"
|
|
449
|
+
},
|
|
450
|
+
1: {
|
|
451
|
+
className: "x78zum5 x6s0dn4 xl56j7k xh8yej3 x5yr21d xb3r6kr xlyipyv x190lv1 xg8s4dl x1u6ievf xwms9i0 x1esw782 xlp1x4z x1iu2jvn xk3h8ob"
|
|
452
|
+
}
|
|
453
|
+
}[!!option.isDisabled << 0],
|
|
426
454
|
children: option.label
|
|
427
455
|
})
|
|
428
456
|
}, option.value))
|
package/dist/Icon/Icon.d.ts
CHANGED
|
@@ -106,9 +106,9 @@ export type IconType = ComponentType<SVGProps<SVGSVGElement>>;
|
|
|
106
106
|
*/
|
|
107
107
|
export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'> {
|
|
108
108
|
/**
|
|
109
|
-
* Ref to the rendered SVG element
|
|
110
|
-
*
|
|
111
|
-
*
|
|
109
|
+
* Ref to the rendered SVG element. For a semantic or namespaced name it is
|
|
110
|
+
* the `<svg>` inside Icon's wrapper, or `null` when the resolved glyph has
|
|
111
|
+
* no `<svg>`.
|
|
112
112
|
*/
|
|
113
113
|
ref?: React.Ref<SVGSVGElement>;
|
|
114
114
|
/**
|
package/dist/Icon/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,EAAc,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAInD,OAAO,KAAK,EAAC,QAAQ,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAKzC,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAEhE,YAAY,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAiDhD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Df,CAAC;AAMH,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,WAAW,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,IAAI,CACrC,QAAQ,CAAC,aAAa,CAAC,EACvB,KAAK,GAAG,OAAO,CAChB;IACC;;;;OAIG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B;;;;;;OAMG;IACH,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,kBAAkB,CAAC;IAC/C;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AA6BD;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,KAAiB,EACjB,IAAI,EAAE,QAAQ,EACd,OAAO,EACP,KAAK,EACL,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,KAAK,EACT,EAAE,SAAS,qBAqDX;yBAhEe,IAAI;;;AAyJpB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,QAAQ,EAChC,KAAK,CAAC,EAAE;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAC,GAC3C,KAAK,CAAC,SAAS,CAYjB"}
|
package/dist/Icon/Icon.js
CHANGED
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
* - /apps/storybook/stories/Icon.stories.tsx (storybook stories)
|
|
30
30
|
* - /packages/cli/assets/templates/blocks/components/Icon/ (showcase blocks)
|
|
31
31
|
*/
|
|
32
|
-
import React from 'react';
|
|
32
|
+
import React, { useCallback } from 'react';
|
|
33
33
|
import * as stylex from '@stylexjs/stylex';
|
|
34
34
|
import "../theme/tokens.stylex.js";
|
|
35
35
|
import { colorVars } from "../theme/tokens.stylex.js";
|
|
36
36
|
import { useThemeName } from "../theme/useTheme.js";
|
|
37
37
|
import { resolveIcon } from "./globalIconRegistry.js";
|
|
38
38
|
import { mergeProps } from "../utils/mergeProps.js";
|
|
39
|
+
import { mergeRefs } from "../utils/mergeRefs.js";
|
|
39
40
|
import { themeProps } from "../utils/themeProps.js";
|
|
40
41
|
import { useIconSize } from "./IconDefaultSizeContext.js";
|
|
41
42
|
import { iconSizeStyles } from "./IconSize.stylex.js";
|
|
@@ -251,6 +252,7 @@ export function Icon({
|
|
|
251
252
|
className: className,
|
|
252
253
|
style: style,
|
|
253
254
|
xstyle: xstyle,
|
|
255
|
+
svgRef: ref,
|
|
254
256
|
spanProps: props
|
|
255
257
|
});
|
|
256
258
|
}
|
|
@@ -295,6 +297,7 @@ function IconFromRegistry({
|
|
|
295
297
|
className,
|
|
296
298
|
style,
|
|
297
299
|
xstyle,
|
|
300
|
+
svgRef,
|
|
298
301
|
spanProps
|
|
299
302
|
}) {
|
|
300
303
|
const themeName = useThemeName();
|
|
@@ -302,6 +305,11 @@ function IconFromRegistry({
|
|
|
302
305
|
size,
|
|
303
306
|
variant
|
|
304
307
|
});
|
|
308
|
+
// The glyph can change while the span stays. Attach the ref again when it
|
|
309
|
+
// does.
|
|
310
|
+
const attachSvgRef = useCallback(span => svgRef == null ? undefined : mergeRefs(svgRef)(span?.querySelector('svg') ?? null),
|
|
311
|
+
// eslint-disable-next-line @eslint-react/exhaustive-deps -- resolveIcon's inputs: a new glyph gets a new attach, and a function entry's new element each render does not.
|
|
312
|
+
[svgRef, name, themeName, size, variant]);
|
|
305
313
|
if (resolvedIcon == null) {
|
|
306
314
|
return null;
|
|
307
315
|
}
|
|
@@ -313,6 +321,12 @@ function IconFromRegistry({
|
|
|
313
321
|
// precedence (spread before the internal merge).
|
|
314
322
|
const restSpanProps = spanProps ?? {};
|
|
315
323
|
return /*#__PURE__*/_jsx("span", {
|
|
324
|
+
ref: svgRef == null ? undefined : attachSvgRef
|
|
325
|
+
// Derived a11y — decorative (aria-hidden) by default, or a meaningful
|
|
326
|
+
// image (role="img" + aria-label) when `label` is set. Placed BEFORE the
|
|
327
|
+
// prop spread so consumers can still override it with explicit
|
|
328
|
+
// aria-hidden/role/aria-label. This mirrors component-mode Icon.
|
|
329
|
+
,
|
|
316
330
|
...a11yProps,
|
|
317
331
|
...restSpanProps,
|
|
318
332
|
...mergeProps(themeProps('icon', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../src/Resizable/ResizeHandle.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAiB,SAAS,EAAC,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../src/Resizable/ResizeHandle.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAiB,SAAS,EAAC,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAmBxB,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AA8PzD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,SAAS,CAAC,cAAc,CAAC,EACzB,OAAO,CACR;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IAEtC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAEhC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,6CAA6C;IAC7C,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,YAAY,CAAC,EAC3B,SAAwB,EACxB,QAAQ,EAAE,YAAuB,EACjC,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAsB,EACtB,aAAsB,EACtB,KAAK,EAAE,cAAc,EACrB,SAAS,EACT,QAAQ,EACR,MAAM,EACN,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAsSnB;yBArTe,YAAY"}
|
|
@@ -19,6 +19,7 @@ import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
|
19
19
|
import { mergeProps, rtlStyles } from "../utils/index.js";
|
|
20
20
|
import { getCollapseControls, getEffectiveMaxPx } from "./useResizable.js";
|
|
21
21
|
import { createResizeGesture } from "./resizeGesture.js";
|
|
22
|
+
import { separatorAttributes } from "./separatorAttributes.js";
|
|
22
23
|
import { themeProps } from "../utils/themeProps.js";
|
|
23
24
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
24
25
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
@@ -410,20 +411,25 @@ export function ResizeHandle({
|
|
|
410
411
|
}, [hasRegion, regionGesture]);
|
|
411
412
|
|
|
412
413
|
// --- ARIA ---
|
|
413
|
-
// When collapsed the panel's real size (0) sits below aria-valuemin, which
|
|
414
|
-
// is invalid per WCAG 4.1.2. Clamp aria-valuenow to the minimum and announce
|
|
415
|
-
// the true state via aria-valuetext instead; the valuetext is removed as
|
|
416
|
-
// soon as the panel expands so the numeric value reads again.
|
|
417
414
|
const sizeNow = resizable?._size;
|
|
418
415
|
const minNow = resizable?._minSizePx;
|
|
419
|
-
const ariaValueNow = sizeNow == null || minNow == null ? undefined : isCollapsed ? Math.max(sizeNow, minNow) : sizeNow;
|
|
420
|
-
const ariaValueMin = minNow;
|
|
421
416
|
// A separator with a value needs a maximum (WAI-ARIA, APG window splitter).
|
|
422
417
|
// Unbounded regions report the basis they can fill; a hand-built props
|
|
423
418
|
// object without it reports only a configured maximum.
|
|
424
419
|
const effectiveMax = resizable ? getEffectiveMaxPx(resizable) ?? (resizable._maxSizePx !== Infinity ? resizable._maxSizePx : undefined) : undefined;
|
|
425
|
-
|
|
426
|
-
|
|
420
|
+
// The attributes createResizable writes on a plain element, from the same
|
|
421
|
+
// derivation.
|
|
422
|
+
const aria = separatorAttributes({
|
|
423
|
+
direction,
|
|
424
|
+
isDisabled,
|
|
425
|
+
value: sizeNow == null || minNow == null ? undefined : {
|
|
426
|
+
size: sizeNow,
|
|
427
|
+
minPx: minNow,
|
|
428
|
+
maxPx: effectiveMax,
|
|
429
|
+
isCollapsed,
|
|
430
|
+
collapsedText: t('@astryx.resizable.collapsed')
|
|
431
|
+
}
|
|
432
|
+
});
|
|
427
433
|
|
|
428
434
|
// The Grip pill takes the pointer as the Grab zone does, so a pill drawn
|
|
429
435
|
// outside the zone still resizes.
|
|
@@ -447,14 +453,8 @@ export function ResizeHandle({
|
|
|
447
453
|
return /*#__PURE__*/_jsxs("div", {
|
|
448
454
|
ref: useMergedRefs(ref, handleRef),
|
|
449
455
|
role: "separator",
|
|
450
|
-
|
|
451
|
-
"aria-valuenow": ariaValueNow,
|
|
452
|
-
"aria-valuemin": ariaValueMin,
|
|
453
|
-
"aria-valuemax": ariaValueMax,
|
|
454
|
-
"aria-valuetext": ariaValueText,
|
|
456
|
+
...aria,
|
|
455
457
|
"aria-label": label,
|
|
456
|
-
"aria-disabled": isDisabled || undefined,
|
|
457
|
-
tabIndex: isDisabled ? -1 : 0,
|
|
458
458
|
onDoubleClick: () => {
|
|
459
459
|
if (!isDisabled) {
|
|
460
460
|
gesture?.doubleClick();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SizeValue } from '../utils/types.js';
|
|
2
2
|
import { type ResizableDirection } from './resizableModel.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type ResizeGestureModel } from './resizeGesture.js';
|
|
4
4
|
import type { ResizableSize } from './utils.js';
|
|
5
5
|
export interface CreateResizableOptions {
|
|
6
6
|
/**
|
|
@@ -44,6 +44,31 @@ export interface CreateResizableOptions {
|
|
|
44
44
|
onSizeChange?: (size: number) => void;
|
|
45
45
|
/** Called when an interaction collapses or expands the region. */
|
|
46
46
|
onCollapseChange?: (isCollapsed: boolean) => void;
|
|
47
|
+
/**
|
|
48
|
+
* The handle sits before the panel it resizes (the panel is at the end), so
|
|
49
|
+
* a drag toward the start grows it.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
isReversed?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Ignores pointer and keyboard input and says so; a plain element keeps its
|
|
55
|
+
* tab stop.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
isDisabled?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* A plain element's accessible name, when it has none of its own. Without
|
|
61
|
+
* it, the factory uses the message catalog's English message.
|
|
62
|
+
* @default 'Resize handle'
|
|
63
|
+
*/
|
|
64
|
+
label?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Replaces the catalog's "Collapsed" that the handle announces as its
|
|
67
|
+
* `aria-valuetext` while the region is collapsed. Absent, the factory
|
|
68
|
+
* announces the shipped English message.
|
|
69
|
+
* @default 'Collapsed'
|
|
70
|
+
*/
|
|
71
|
+
collapsedLabel?: string;
|
|
47
72
|
}
|
|
48
73
|
export interface ResizableController {
|
|
49
74
|
/** The region's size in px, 0 while collapsed. */
|
|
@@ -67,12 +92,15 @@ export interface ResizableController {
|
|
|
67
92
|
* that stops it.
|
|
68
93
|
*/
|
|
69
94
|
subscribe(listener: () => void): () => void;
|
|
70
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Removes every listener, observer and attribute the factory added and the
|
|
97
|
+
* body's drag cursor; a drag in flight ends as cancelled.
|
|
98
|
+
*/
|
|
71
99
|
destroy(): void;
|
|
72
100
|
}
|
|
73
101
|
/**
|
|
74
|
-
* The state a region with `options` starts in
|
|
75
|
-
* hook's first render. A container is not measured
|
|
102
|
+
* The state a region with `options` starts in, before its handle exists: the
|
|
103
|
+
* server's render and a hook's first render. A container is not measured
|
|
76
104
|
* yet, so a percentage of it resolves against the deterministic 1200px basis
|
|
77
105
|
* until the factory measures it. `'server'` reads the state the server
|
|
78
106
|
* rendered, for a render that hydrates it: the 1200px basis for a viewport
|
|
@@ -108,28 +136,54 @@ interface ResizableInternals {
|
|
|
108
136
|
syncContainer(): void;
|
|
109
137
|
/**
|
|
110
138
|
* Lets go of the page and keeps the region. A gesture in flight ends as
|
|
111
|
-
* cancelled, and the
|
|
112
|
-
* and report. For a React caller
|
|
113
|
-
* `<Activity>` hides.
|
|
139
|
+
* cancelled, and the handle's listeners, its attributes and the observers
|
|
140
|
+
* go. Collapse, expand and resize still apply and report. For a React caller
|
|
141
|
+
* whose component unmounts or an `<Activity>` hides.
|
|
114
142
|
*/
|
|
115
143
|
suspend(): void;
|
|
116
|
-
/** Takes the page back after `suspend`: the observers. */
|
|
144
|
+
/** Takes the page back after `suspend`: the handle, and the observers. */
|
|
117
145
|
resume(): void;
|
|
118
146
|
/**
|
|
119
|
-
* The region's side of a
|
|
120
|
-
* ResizeHandle given the configuration object's props.
|
|
147
|
+
* The region's side of a gesture the factory does not own: the drag and
|
|
148
|
+
* keys of a ResizeHandle given the configuration object's props.
|
|
121
149
|
*/
|
|
122
150
|
model: ResizeGestureModel;
|
|
123
151
|
}
|
|
124
152
|
/** The factory's internal channel, or undefined for anything else. */
|
|
125
153
|
export declare function readResizableInternals(controller: ResizableController): ResizableInternals | undefined;
|
|
126
154
|
/**
|
|
127
|
-
*
|
|
128
|
-
* reports the size, and the caller applies it.
|
|
129
|
-
*
|
|
130
|
-
* `
|
|
155
|
+
* Make `handle` a window splitter that resizes a region. The factory never
|
|
156
|
+
* sizes the panel: it reports the size, and the caller applies it.
|
|
157
|
+
*
|
|
158
|
+
* It gives the handle `role="separator"`, its orientation and its value. It
|
|
159
|
+
* adds a tab stop and an accessible name when the handle has none. It answers
|
|
160
|
+
* a pointer drag, the arrow keys, Home and End, and holds the pointer for a
|
|
161
|
+
* whole drag. Enter and a double-click collapse and restore. A horizontal
|
|
162
|
+
* region resizes along the inline axis, and under right-to-left the drag
|
|
163
|
+
* follows the pointer. `destroy` takes all of it away. With a null handle the
|
|
164
|
+
* region still answers collapse, expand, resize and subscribe, and touches no
|
|
165
|
+
* element. Outside a provider, its name and its collapsed text are the
|
|
166
|
+
* shipped English messages. `label` names it, and `collapsedLabel` replaces
|
|
167
|
+
* its collapsed text in another language.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```
|
|
171
|
+
* const sidebar = document.querySelector('#sidebar');
|
|
172
|
+
* const resizable = createResizable(document.querySelector('#divider'), {
|
|
173
|
+
* defaultSize: 260,
|
|
174
|
+
* minSize: 180,
|
|
175
|
+
* maxSize: 480,
|
|
176
|
+
* collapsible: true,
|
|
177
|
+
* autoSaveId: 'sidebar',
|
|
178
|
+
* });
|
|
179
|
+
* const paint = () => {
|
|
180
|
+
* sidebar.style.width = `${resizable.size}px`;
|
|
181
|
+
* };
|
|
182
|
+
* paint();
|
|
183
|
+
* resizable.subscribe(paint);
|
|
184
|
+
* ```
|
|
131
185
|
*/
|
|
132
|
-
export declare function createResizable(options?: CreateResizableOptions): ResizableController;
|
|
186
|
+
export declare function createResizable(handle: HTMLElement | null, options?: CreateResizableOptions): ResizableController;
|
|
133
187
|
/**
|
|
134
188
|
* Who a factory's development warnings speak for: the bare factory, or the
|
|
135
189
|
* configuration-object useResizable built on it, whose warnings keep the
|
|
@@ -140,6 +194,6 @@ export type ResizableWarningSource = 'createResizable' | 'useResizable';
|
|
|
140
194
|
* createResizable, with its development warnings in the words of `source`:
|
|
141
195
|
* the package's own entry, for useResizable.
|
|
142
196
|
*/
|
|
143
|
-
export declare function createResizableAs(source: ResizableWarningSource, options?: CreateResizableOptions): ResizableController;
|
|
197
|
+
export declare function createResizableAs(source: ResizableWarningSource, handle: HTMLElement | null, options?: CreateResizableOptions): ResizableController;
|
|
144
198
|
export {};
|
|
145
199
|
//# sourceMappingURL=createResizable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createResizable.d.ts","sourceRoot":"","sources":["../../src/Resizable/createResizable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createResizable.d.ts","sourceRoot":"","sources":["../../src/Resizable/createResizable.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAcL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGL,KAAK,kBAAkB,EAExB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAa3C,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACxC,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,mEAAmE;IACnE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE;QAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;KAAC,CAAC;IACtD,+DAA+D;IAC/D,SA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