@astryxdesign/lab 0.3.0-canary.fb2d385 → 0.3.0-canary.fbf9c0b

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.
@@ -12,7 +12,7 @@
12
12
  import { type ReactNode } from 'react';
13
13
  import { type ComplexSelectorProps } from '@astryxdesign/core/ComplexSelector';
14
14
  import { type TransferListProps } from './TransferList';
15
- type TransferListSelectorShellProp = 'label' | 'triggerLabel' | 'isLabelHidden' | 'description' | 'isOptional' | 'isRequired' | 'isDisabled' | 'isLoading' | 'status' | 'statusVariant' | 'labelTooltip' | 'size' | 'width' | 'placement' | 'contentXstyle' | 'xstyle' | 'className' | 'style' | 'data-testid';
15
+ type TransferListSelectorShellProp = 'label' | 'triggerLabel' | 'isLabelHidden' | 'description' | 'isOptional' | 'isRequired' | 'isDisabled' | 'isLoading' | 'status' | 'statusVariant' | 'labelTooltip' | 'size' | 'width' | 'placement' | 'xstyle' | 'className' | 'style' | 'data-testid';
16
16
  type TransferListContentProp = 'options' | 'selectedLabel' | 'availableLabel' | 'hasSearch' | 'searchLabel' | 'searchPlaceholder' | 'isReorderable' | 'hasSelectAll' | 'hasClear' | 'renderOption' | 'selectedEmptyText' | 'availableEmptyText' | 'noResultsText';
17
17
  export type TransferListSelectorCommitBehavior = 'immediate' | 'staged';
18
18
  export type TransferListSelectorProps<T extends string = string> = Pick<ComplexSelectorProps<readonly T[]>, TransferListSelectorShellProp> & Pick<TransferListProps<T>, TransferListContentProp> & {
@@ -49,7 +49,7 @@ export type TransferListSelectorProps<T extends string = string> = Pick<ComplexS
49
49
  * />
50
50
  * ```
51
51
  */
52
- export declare function TransferListSelector<T extends string = string>({ label, description, options, value, onChange, changeAction, commitBehavior, triggerLabel, isDisabled, isLoading, width, contentXstyle, applyLabel, cancelLabel, selectedLabel, availableLabel, hasSearch, searchLabel, searchPlaceholder, isReorderable, hasSelectAll, hasClear, renderOption, selectedEmptyText, availableEmptyText, noResultsText, ...selectorProps }: TransferListSelectorProps<T>): ReactNode;
52
+ export declare function TransferListSelector<T extends string = string>({ label, description, options, value, onChange, changeAction, commitBehavior, triggerLabel, isDisabled, isLoading, width, applyLabel, cancelLabel, selectedLabel, availableLabel, hasSearch, searchLabel, searchPlaceholder, isReorderable, hasSelectAll, hasClear, renderOption, selectedEmptyText, availableEmptyText, noResultsText, ...selectorProps }: TransferListSelectorProps<T>): ReactNode;
53
53
  export declare namespace TransferListSelector {
54
54
  var displayName: string;
55
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TransferListSelector.d.ts","sourceRoot":"","sources":["../../src/TransferList/TransferListSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAA2C,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG/E,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAe,KAAK,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AA0CpE,KAAK,6BAA6B,GAC9B,OAAO,GACP,cAAc,GACd,eAAe,GACf,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,eAAe,GACf,cAAc,GACd,MAAM,GACN,OAAO,GACP,WAAW,GACX,eAAe,GACf,QAAQ,GACR,WAAW,GACX,OAAO,GACP,aAAa,CAAC;AAElB,KAAK,uBAAuB,GACxB,SAAS,GACT,eAAe,GACf,gBAAgB,GAChB,WAAW,GACX,aAAa,GACb,mBAAmB,GACnB,eAAe,GACf,cAAc,GACd,UAAU,GACV,cAAc,GACd,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,CAAC;AAEpB,MAAM,MAAM,kCAAkC,GAAG,WAAW,GAAG,QAAQ,CAAC;AAExE,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CACrE,oBAAoB,CAAC,SAAS,CAAC,EAAE,CAAC,EAClC,6BAA6B,CAC9B,GACC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,uBAAuB,CAAC,GAAG;IACpD,mDAAmD;IACnD,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IACpB,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC;IACxC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D;;;OAGG;IACH,cAAc,CAAC,EAAE,kCAAkC,CAAC;IACpD,yFAAyF;IACzF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AA+BJ;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAC9D,KAAK,EACL,WAAW,EACX,OAAO,EACP,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,cAA4B,EAC5B,YAAY,EACZ,UAAU,EACV,SAAS,EACT,KAAK,EACL,aAAa,EACb,UAAoB,EACpB,WAAsB,EACtB,aAAa,EACb,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,GAAG,aAAa,EACjB,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAAG,SAAS,CA+G1C;yBA3Ie,oBAAoB"}
1
+ {"version":3,"file":"TransferListSelector.d.ts","sourceRoot":"","sources":["../../src/TransferList/TransferListSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAA2C,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG/E,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oC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wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAC9D,KAAK,EACL,WAAW,EACX,OAAO,EACP,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,cAA4B,EAC5B,YAAY,EACZ,UAAU,EACV,SAAS,EACT,KAAK,EACL,UAAoB,EACpB,WAAsB,EACtB,aAAa,EACb,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,GAAG,aAAa,EACjB,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAAG,SAAS,CAoH1C;yBA/Ie,oBAAoB"}
@@ -23,16 +23,22 @@ import { borderVars, colorVars } from '@astryxdesign/core/theme/tokens.stylex';
23
23
  import { TransferList } from "./TransferList.js";
24
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
25
  const DEFAULT_SELECTOR_WIDTH = 'min(41rem, calc(100vw - 32px))';
26
+ const _temp = {
27
+ kskxy: "x12ajvvl",
28
+ kmVPX3: "x1717udv",
29
+ kVQacm: "xb3r6kr",
30
+ kaIpWk: "x1pjcqnp",
31
+ "$$css": true
32
+ };
26
33
  const styles = {
27
- content: {
28
- kzqmXN: "x1nalo9x",
29
- ks0D6T: "x1rk9ocf",
30
- kskxy: "x12ajvvl",
31
- kmVPX3: "x1717udv",
32
- kVQacm: "xb3r6kr",
33
- kaIpWk: "x1pjcqnp",
34
+ content: width => [_temp, {
35
+ kzqmXN: width != null ? "x5lhr3w" : width,
36
+ ks0D6T: width != null ? "xf68679" : width,
34
37
  $$css: true
35
- },
38
+ }, {
39
+ "--x-width": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(width),
40
+ "--x-maxWidth": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(width)
41
+ }],
36
42
  footer: {
37
43
  kmuXW: "x2lah0s",
38
44
  kEafiO: "x11xkdxz",
@@ -88,7 +94,6 @@ export function TransferListSelector({
88
94
  isDisabled,
89
95
  isLoading,
90
96
  width,
91
- contentXstyle,
92
97
  applyLabel = 'Apply',
93
98
  cancelLabel = 'Cancel',
94
99
  selectedLabel,
@@ -124,6 +129,7 @@ export function TransferListSelector({
124
129
  }
125
130
  previousCommitBehaviorRef.current = commitBehavior;
126
131
  }, [commitBehavior, resetDraft]);
132
+ const resolvedWidth = typeof width === 'number' ? `${width}px` : width ?? DEFAULT_SELECTOR_WIDTH;
127
133
  return /*#__PURE__*/_jsx(ComplexSelector, {
128
134
  ...selectorProps,
129
135
  label: label,
@@ -134,8 +140,8 @@ export function TransferListSelector({
134
140
  triggerLabel: triggerLabel ?? `${value.length} selected`,
135
141
  isDisabled: isDisabled,
136
142
  isLoading: isLoading,
137
- width: width ?? DEFAULT_SELECTOR_WIDTH,
138
- contentXstyle: [styles.content, contentXstyle],
143
+ width: resolvedWidth,
144
+ contentXstyle: styles.content(resolvedWidth),
139
145
  children: (appliedValue, commit, close, state) => {
140
146
  const isStaged = commitBehavior === 'staged';
141
147
  const transferListValue = isStaged ? draftValue : appliedValue;
package/dist/lab.css CHANGED
@@ -604,7 +604,6 @@
604
604
  .x1va8c73:not(#\#):not(#\#):not(#\#):not(#\#){max-width:320px}
605
605
  .x1k2d6hx:not(#\#):not(#\#):not(#\#):not(#\#){max-width:44px}
606
606
  .x11gisft:not(#\#):not(#\#):not(#\#):not(#\#){max-width:640px}
607
- .x1rk9ocf:not(#\#):not(#\#):not(#\#):not(#\#){max-width:min(41rem,calc(100vw - 32px))}
608
607
  .x1x1rfll:not(#\#):not(#\#):not(#\#):not(#\#){max-width:none}
609
608
  .xf68679:not(#\#):not(#\#):not(#\#):not(#\#){max-width:var(--x-maxWidth)}
610
609
  .x2lwn1j:not(#\#):not(#\#):not(#\#):not(#\#){min-height:0}
@@ -648,7 +647,6 @@
648
647
  .x1849jeq:not(#\#):not(#\#):not(#\#):not(#\#){width:30px}
649
648
  .x1td3qas:not(#\#):not(#\#):not(#\#):not(#\#){width:32px}
650
649
  .x1ftt334:not(#\#):not(#\#):not(#\#):not(#\#){width:5px}
651
- .x1nalo9x:not(#\#):not(#\#):not(#\#):not(#\#){width:min(41rem,calc(100vw - 32px))}
652
650
  .x1oai4fc:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--icon-size)}
653
651
  .x1m747yf:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--size-element-lg)}
654
652
  .xx9zwd3:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--spacing-1)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/lab",
3
- "version": "0.3.0-canary.fb2d385",
3
+ "version": "0.3.0-canary.fbf9c0b",
4
4
  "description": "Experimental Astryx components — published to npm only under the @canary dist-tag for early testing; never released as a stable (latest) version.",
5
5
  "author": "Meta Open Source",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@stylexjs/stylex": ">=0.10.0",
48
- "@astryxdesign/core": "0.3.0-canary.fb2d385",
48
+ "@astryxdesign/core": "0.3.0-canary.fbf9c0b",
49
49
  "react": ">=19.0.0",
50
50
  "react-dom": ">=19.0.0",
51
51
  "lexical": "^0.46.0",
@@ -66,7 +66,7 @@
66
66
  "d3-shape": "^3.2.0"
67
67
  },
68
68
  "devDependencies": {
69
- "@astryxdesign/cli": "0.3.0-canary.fb2d385",
69
+ "@astryxdesign/cli": "0.3.0-canary.fbf9c0b",
70
70
  "@lexical/code": "^0.46.0",
71
71
  "@lexical/headless": "^0.46.0",
72
72
  "@lexical/html": "^0.46.0",
@@ -187,7 +187,7 @@ export const docs = {
187
187
  name: 'width',
188
188
  type: 'SizeValue',
189
189
  description:
190
- 'Width of the external field. Its default matches the responsive popup width; use contentXstyle to override the popup.',
190
+ 'Width of the field and its popup — both track this one value.',
191
191
  default: "'min(41rem, calc(100vw - 32px))'",
192
192
  },
193
193
  {
@@ -238,12 +238,6 @@ export const docs = {
238
238
  description:
239
239
  'Optional async action run after each immediate commit or a changed staged Apply; drives optimistic and busy state.',
240
240
  },
241
- {
242
- name: 'contentXstyle',
243
- type: 'StyleXStyles',
244
- description:
245
- 'StyleX styles composed after the default zero-padding, clipped popover content style.',
246
- },
247
241
  {
248
242
  name: 'xstyle',
249
243
  type: 'StyleXStyles',
@@ -710,7 +704,6 @@ export const docsDense = {
710
704
  labelTooltip: 'Field-label tooltip.',
711
705
  changeAction:
712
706
  'Async action after each immediate commit or changed staged Apply.',
713
- contentXstyle: 'Popover-content StyleX override.',
714
707
  xstyle: 'External field StyleX override.',
715
708
  className: 'External field class name.',
716
709
  style: 'External field inline styles.',
@@ -28,14 +28,16 @@ import {TransferList, type TransferListProps} from './TransferList';
28
28
  const DEFAULT_SELECTOR_WIDTH = 'min(41rem, calc(100vw - 32px))';
29
29
 
30
30
  const styles = stylex.create({
31
- content: {
32
- width: DEFAULT_SELECTOR_WIDTH,
33
- maxWidth: DEFAULT_SELECTOR_WIDTH,
31
+ // Width tracks the `width` prop, so the field and its popup are one
32
+ // measurement rather than two that can disagree.
33
+ content: (width: string) => ({
34
+ width,
35
+ maxWidth: width,
34
36
  maxHeight: 'calc(100vh - 32px)',
35
37
  padding: 0,
36
38
  overflow: 'hidden',
37
39
  borderRadius: 'inherit',
38
- },
40
+ }),
39
41
  surface: {
40
42
  display: 'flex',
41
43
  flexDirection: 'column',
@@ -80,7 +82,6 @@ type TransferListSelectorShellProp =
80
82
  | 'size'
81
83
  | 'width'
82
84
  | 'placement'
83
- | 'contentXstyle'
84
85
  | 'xstyle'
85
86
  | 'className'
86
87
  | 'style'
@@ -183,7 +184,6 @@ export function TransferListSelector<T extends string = string>({
183
184
  isDisabled,
184
185
  isLoading,
185
186
  width,
186
- contentXstyle,
187
187
  applyLabel = 'Apply',
188
188
  cancelLabel = 'Cancel',
189
189
  selectedLabel,
@@ -223,6 +223,11 @@ export function TransferListSelector<T extends string = string>({
223
223
  previousCommitBehaviorRef.current = commitBehavior;
224
224
  }, [commitBehavior, resetDraft]);
225
225
 
226
+ const resolvedWidth =
227
+ typeof width === 'number'
228
+ ? `${width}px`
229
+ : (width ?? DEFAULT_SELECTOR_WIDTH);
230
+
226
231
  return (
227
232
  <ComplexSelector
228
233
  {...selectorProps}
@@ -234,8 +239,8 @@ export function TransferListSelector<T extends string = string>({
234
239
  triggerLabel={triggerLabel ?? `${value.length} selected`}
235
240
  isDisabled={isDisabled}
236
241
  isLoading={isLoading}
237
- width={width ?? DEFAULT_SELECTOR_WIDTH}
238
- contentXstyle={[styles.content, contentXstyle]}>
242
+ width={resolvedWidth}
243
+ contentXstyle={styles.content(resolvedWidth)}>
239
244
  {(appliedValue, commit, close, state) => {
240
245
  const isStaged = commitBehavior === 'staged';
241
246
  const transferListValue = isStaged ? draftValue : appliedValue;