@kanso-labs/kanso-ui 0.34.0 → 0.34.2
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/collection/text.js +17 -0
- package/dist/collection/text.js.map +1 -0
- package/dist/components/avatar/index.js +49 -34
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/chip-group/index.js +1 -3
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/combo-box/index.js +112 -77
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/disclosure/index.js +35 -29
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list/index.d.ts +1 -1
- package/dist/components/list/index.js +70 -50
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +1 -1
- package/dist/components/list-box/index.js +72 -88
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +4 -3
- package/dist/components/menu/index.js +57 -69
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +3 -2
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +1 -1
- package/dist/components/navigation-tree/index.js +62 -76
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/product-icon/index.js +49 -34
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/token-field/index.js +4 -2
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +1 -1
- package/dist/components/tree/index.js +74 -52
- package/dist/components/tree/index.js.map +1 -1
- package/dist/hooks/useImageLoadingStatus.js +14 -7
- package/dist/hooks/useImageLoadingStatus.js.map +1 -1
- package/dist/hooks/useRipple.js +209 -216
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/styles/overlay.js +1 -0
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles.css +4 -0
- package/package.json +2 -2
|
@@ -21,8 +21,9 @@ type MeterProps$1 = Omit<MeterProps, 'children' | 'className' | 'style'> & {
|
|
|
21
21
|
/**
|
|
22
22
|
* Which colours the measurement is drawn in. `primary` states without
|
|
23
23
|
* ranking; `negative` and `positive` say the value is bad or good, and
|
|
24
|
-
* recolour the active indicator
|
|
25
|
-
* one
|
|
24
|
+
* recolour the active indicator and the stop indicator, leaving the track
|
|
25
|
+
* in its secondary container so a column of meters still shares one
|
|
26
|
+
* track.
|
|
26
27
|
* @default 'primary'
|
|
27
28
|
*/
|
|
28
29
|
tone?: MeterTone;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","MeterRenderProps","MeterProps","RACMeterProps","stylex","Meter","RACMeter","IndicatorTone","IndicatorLabels","IndicatorLine","indicatorStyles","mergeStatefulStyles","Omit","className","label","showValue","style","tone","MeterTone","Extract","t0","$","_c","T0","t1","t2","t3","t4","t5","maxValue","t6","minValue","t7","t8","t9","props","undefined","root","meterContent","state","valueText","percentage"],"sources":["../../../src/components/meter/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { MeterRenderProps, MeterProps as RACMeterProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Meter as RACMeter } from 'react-aria-components';\nimport type { IndicatorTone } from '../../indicator/styles';\nimport { IndicatorLabels, IndicatorLine } from '../../indicator';\nimport { indicatorStyles } from '../../indicator/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A meter is the progress indicators page's line, drawn for a measurement\n// rather than for a task: the same three parts at the same 4dp, the same\n// label row above them, and the same motion when the number changes. All of\n// that is `src/indicator`, shared with ProgressIndicator, so what is here is\n// the two things that make it a meter rather than a progress bar.\n//\n// The first is the role. React Aria's `Meter` reports `meter` rather than\n// `progressbar`, and a screen reader says the two differently: one is how\n// full something is, the other how far along something is. That difference\n// is the whole reason both exist, and it is why a meter has no\n// indeterminate state to offer — a measurement whose value is unknown is\n// not a measurement.\n//\n// The second is `tone`. The page draws one colour pair, which is right for\n// a task: progress does not become good or bad on its way to done. A\n// measurement does — a disk at 96% and a signal at 96% mean opposite\n// things — so `negative` and `positive` recolour the active indicator and\n// the stop indicator while leaving the track alone. A column of meters then\n// reads as one scale with bars of different colours, rather than as several\n// gauges that happen to sit together. Which tone a value deserves is the\n// call site's to decide: nothing here reads the number and picks one, since\n// where the line falls between good and bad is the measurement's own\n// business.\n//\n// The value is shown by default, where a progress indicator hides it. A\n// meter is the number — a bar with no figure beside it says only \"some\" —\n// and `formatOptions` is what makes that figure read as a percentage, bytes\n// or a plain count, in the page's locale.\n\ntype MeterProps = Omit<RACMeterProps, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the meter's render state. */\n className?: RACMeterProps['className'];\n /**\n * What is being measured, shown above the line. A screen reader reads it\n * as the meter's name; a meter whose surroundings name it takes\n * `aria-label` instead and leaves this out.\n */\n label?: ReactNode;\n /**\n * Whether the value is shown beside the label.\n * @default true\n */\n showValue?: boolean;\n /** A function may compute the style from the meter's render state. */\n style?: RACMeterProps['style'];\n /**\n * Which colours the measurement is drawn in. `primary` states without\n * ranking; `negative` and `positive` say the value is bad or good, and\n * recolour the active indicator
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","MeterRenderProps","MeterProps","RACMeterProps","stylex","Meter","RACMeter","IndicatorTone","IndicatorLabels","IndicatorLine","indicatorStyles","mergeStatefulStyles","Omit","className","label","showValue","style","tone","MeterTone","Extract","t0","$","_c","T0","t1","t2","t3","t4","t5","maxValue","t6","minValue","t7","t8","t9","props","undefined","root","meterContent","state","valueText","percentage"],"sources":["../../../src/components/meter/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { MeterRenderProps, MeterProps as RACMeterProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Meter as RACMeter } from 'react-aria-components';\nimport type { IndicatorTone } from '../../indicator/styles';\nimport { IndicatorLabels, IndicatorLine } from '../../indicator';\nimport { indicatorStyles } from '../../indicator/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A meter is the progress indicators page's line, drawn for a measurement\n// rather than for a task: the same three parts at the same 4dp, the same\n// label row above them, and the same motion when the number changes. All of\n// that is `src/indicator`, shared with ProgressIndicator, so what is here is\n// the two things that make it a meter rather than a progress bar.\n//\n// The first is the role. React Aria's `Meter` reports `meter` rather than\n// `progressbar`, and a screen reader says the two differently: one is how\n// full something is, the other how far along something is. That difference\n// is the whole reason both exist, and it is why a meter has no\n// indeterminate state to offer — a measurement whose value is unknown is\n// not a measurement.\n//\n// The second is `tone`. The page draws one colour pair, which is right for\n// a task: progress does not become good or bad on its way to done. A\n// measurement does — a disk at 96% and a signal at 96% mean opposite\n// things — so `negative` and `positive` recolour the active indicator and\n// the stop indicator while leaving the track alone. A column of meters then\n// reads as one scale with bars of different colours, rather than as several\n// gauges that happen to sit together. Which tone a value deserves is the\n// call site's to decide: nothing here reads the number and picks one, since\n// where the line falls between good and bad is the measurement's own\n// business.\n//\n// The value is shown by default, where a progress indicator hides it. A\n// meter is the number — a bar with no figure beside it says only \"some\" —\n// and `formatOptions` is what makes that figure read as a percentage, bytes\n// or a plain count, in the page's locale.\n\ntype MeterProps = Omit<RACMeterProps, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the meter's render state. */\n className?: RACMeterProps['className'];\n /**\n * What is being measured, shown above the line. A screen reader reads it\n * as the meter's name; a meter whose surroundings name it takes\n * `aria-label` instead and leaves this out.\n */\n label?: ReactNode;\n /**\n * Whether the value is shown beside the label.\n * @default true\n */\n showValue?: boolean;\n /** A function may compute the style from the meter's render state. */\n style?: RACMeterProps['style'];\n /**\n * Which colours the measurement is drawn in. `primary` states without\n * ranking; `negative` and `positive` say the value is bad or good, and\n * recolour the active indicator and the stop indicator, leaving the track\n * in its secondary container so a column of meters still shares one\n * track.\n * @default 'primary'\n */\n tone?: MeterTone;\n};\n\n// The three of the shared line's four tones a meter draws. The fourth,\n// `inherit`, is for an indicator inside something that carries its own\n// colour, which is a pending button rather than a measurement.\ntype MeterTone = Extract<IndicatorTone, 'negative' | 'positive' | 'primary'>;\n\n/**\n * How full something is, on a scale it names: disk used, storage left,\n * a rating out of five. Pass `value` between `minValue` and `maxValue`, and\n * `formatOptions` to say how the number reads. For how far along a task is,\n * reach for ProgressIndicator instead — a meter has no indeterminate state,\n * because a measurement always has a value.\n *\n * The call site's `className` and `style` land on the meter as a whole,\n * which is the element a layout positions.\n */\nfunction Meter({\n label,\n maxValue = 100,\n minValue = 0,\n showValue = true,\n tone = 'primary',\n ...props\n}: MeterProps) {\n return <RACMeter maxValue={maxValue} minValue={minValue} {...props} {...mergeStatefulStyles(stylex.props(indicatorStyles.root), props)}>\n {meterContent(label, showValue, tone)}\n </RACMeter>;\n}\n\n// What the meter draws, from React Aria's render state. Built by a call\n// rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result\n// on its inputs.\nfunction meterContent(label: ReactNode, showValue: boolean, tone: MeterTone) {\n return (state: MeterRenderProps) => <>\n <IndicatorLabels label={label} value={showValue ? state.valueText : undefined} />\n <IndicatorLine percentage={state.percentage} tone={tone} />\n </>;\n}\nexport type { MeterProps, MeterTone };\nexport default Meter;"],"mappings":";;;;;;;;;;;;;;;;;;AAgFA,SAAAK,QAAAe,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAT;CAAA,IAAAC;CAAA,IAAAS;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAV;CAAA,IAAAI,EAAA,OAAAD,IAAA;EAAe,MAAA,EAAAN,OAAAc,IAAAC,UAAAC,IAAAC,UAAAC,IAAAjB,WAAAkB,IAAAhB,MAAAiB,IAAA,GAAAC,YAAAf;EAAAN,QAAAc;EAEb,MAAAC,WAAAC,OAAAM,KAAAA,IAAA,MAAAN;EACA,MAAAC,WAAAC,OAAAI,KAAAA,IAAA,IAAAJ;EACAjB,YAAAkB,O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;CAAA,OAFNS;AAEM;AAOf,SAASQ,aAAaxB,OAAkBC,WAAoBE,MAAiB;CAC3E,QAAQsB,UAA4B,qBAAA,UAAA,EAAA,UAAA,CAChC,oBAAC,iBAAD;EAAwBzB;EAAO,OAAOC,YAAYwB,MAAMC,YAAYJ,KAAAA;CAAU,CAAA,GAC9E,oBAAC,eAAD;EAAe,YAAYG,MAAME;EAAkBxB;CAAK,CAAA,CAC1D,EAAA,CAAA;AACJ"}
|
|
@@ -84,7 +84,7 @@ declare namespace NavigationTree$1 {
|
|
|
84
84
|
* Rows nested as `children` are what make it a branch; a row with none is a
|
|
85
85
|
* leaf and draws no caret.
|
|
86
86
|
*/
|
|
87
|
-
declare function NavigationTreeItem$1<T extends object = object>({ children, label, leading, supporting, textValue, trailing, ...props }: NavigationTreeItemProps$1<T>): import("react").JSX.Element;
|
|
87
|
+
declare function NavigationTreeItem$1<T extends object = object>({ children, label, leading, onContextMenu, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, supporting, textValue, trailing, ...props }: NavigationTreeItemProps$1<T>): import("react").JSX.Element;
|
|
88
88
|
/**
|
|
89
89
|
* A named group of rows, with its heading above them.
|
|
90
90
|
*/
|
|
@@ -2,6 +2,7 @@ import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
|
2
2
|
import { mergeStatefulStyles, mergeStyles } from "../../styles/merge.js";
|
|
3
3
|
import { ChevronEndGlyph } from "../../glyphs/index.js";
|
|
4
4
|
import { focus } from "../../styles/focus.js";
|
|
5
|
+
import { useRipple } from "../../hooks/useRipple.js";
|
|
5
6
|
import { rowStyles } from "../../row/styles.js";
|
|
6
7
|
import { collectionStyles } from "../../collection/styles.js";
|
|
7
8
|
import { RowContent } from "../../row/index.js";
|
|
@@ -43,8 +44,8 @@ function chevronFor(state) {
|
|
|
43
44
|
}[!!state.isExpanded << 0] })
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
|
-
function itemContent(label, leading, supporting, trailing) {
|
|
47
|
-
return (state) => /* @__PURE__ */ jsx(RowContent, {
|
|
47
|
+
function itemContent(label, leading, supporting, trailing, ripple) {
|
|
48
|
+
return (state) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(RowContent, {
|
|
48
49
|
isDisabled: state.isDisabled,
|
|
49
50
|
isEmphasized: state.isCurrentAncestor,
|
|
50
51
|
isSelected: state.isCurrent,
|
|
@@ -53,7 +54,7 @@ function itemContent(label, leading, supporting, trailing) {
|
|
|
53
54
|
trailing,
|
|
54
55
|
variant: "drawer",
|
|
55
56
|
children: label
|
|
56
|
-
});
|
|
57
|
+
}), state.isDisabled ? null : ripple] });
|
|
57
58
|
}
|
|
58
59
|
function itemStyles(state) {
|
|
59
60
|
return props(rowStyles.base, rowStyles.drawer, rowStyles.interactive, styles.indent, state.isCurrent && rowStyles.selectedDrawer, state.isDisabled && rowStyles.disabled);
|
|
@@ -135,85 +136,70 @@ function NavigationTreeHeader$1(t0) {
|
|
|
135
136
|
* leaf and draws no caret.
|
|
136
137
|
*/
|
|
137
138
|
function NavigationTreeItem$1(t0) {
|
|
138
|
-
const $ = c(
|
|
139
|
-
|
|
140
|
-
let children;
|
|
141
|
-
let label;
|
|
142
|
-
let leading;
|
|
143
|
-
let supporting;
|
|
139
|
+
const $ = c(25);
|
|
140
|
+
const { children, label, leading, onContextMenu, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, supporting, textValue, trailing, ...props } = t0;
|
|
144
141
|
let t1;
|
|
142
|
+
if ($[0] !== onContextMenu || $[1] !== onPointerCancel || $[2] !== onPointerDown || $[3] !== onPointerLeave || $[4] !== onPointerUp) {
|
|
143
|
+
t1 = {
|
|
144
|
+
onContextMenu,
|
|
145
|
+
onPointerCancel,
|
|
146
|
+
onPointerDown,
|
|
147
|
+
onPointerLeave,
|
|
148
|
+
onPointerUp
|
|
149
|
+
};
|
|
150
|
+
$[0] = onContextMenu;
|
|
151
|
+
$[1] = onPointerCancel;
|
|
152
|
+
$[2] = onPointerDown;
|
|
153
|
+
$[3] = onPointerLeave;
|
|
154
|
+
$[4] = onPointerUp;
|
|
155
|
+
$[5] = t1;
|
|
156
|
+
} else t1 = $[5];
|
|
157
|
+
const ripple = useRipple(true, t1, true);
|
|
158
|
+
const T0 = NavigationTreeItem;
|
|
145
159
|
let t2;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
trailing = t8;
|
|
155
|
-
T0 = NavigationTreeItem;
|
|
156
|
-
if ($[10] !== label || $[11] !== textValue) {
|
|
157
|
-
t1 = textValueFor(textValue, label);
|
|
158
|
-
$[10] = label;
|
|
159
|
-
$[11] = textValue;
|
|
160
|
-
$[12] = t1;
|
|
161
|
-
} else t1 = $[12];
|
|
162
|
-
t2 = props;
|
|
163
|
-
t3 = mergeStatefulStyles(itemStyles, props);
|
|
164
|
-
$[0] = t0;
|
|
165
|
-
$[1] = T0;
|
|
166
|
-
$[2] = children;
|
|
167
|
-
$[3] = label;
|
|
168
|
-
$[4] = leading;
|
|
169
|
-
$[5] = supporting;
|
|
170
|
-
$[6] = t1;
|
|
171
|
-
$[7] = t2;
|
|
172
|
-
$[8] = t3;
|
|
173
|
-
$[9] = trailing;
|
|
174
|
-
} else {
|
|
175
|
-
T0 = $[1];
|
|
176
|
-
children = $[2];
|
|
177
|
-
label = $[3];
|
|
178
|
-
leading = $[4];
|
|
179
|
-
supporting = $[5];
|
|
180
|
-
t1 = $[6];
|
|
181
|
-
t2 = $[7];
|
|
182
|
-
t3 = $[8];
|
|
183
|
-
trailing = $[9];
|
|
184
|
-
}
|
|
185
|
-
let t4;
|
|
186
|
-
if ($[13] !== label || $[14] !== leading || $[15] !== supporting || $[16] !== trailing) {
|
|
187
|
-
t4 = itemContent(label, leading, supporting, trailing);
|
|
188
|
-
$[13] = label;
|
|
189
|
-
$[14] = leading;
|
|
190
|
-
$[15] = supporting;
|
|
191
|
-
$[16] = trailing;
|
|
192
|
-
$[17] = t4;
|
|
193
|
-
} else t4 = $[17];
|
|
160
|
+
if ($[6] !== label || $[7] !== textValue) {
|
|
161
|
+
t2 = textValueFor(textValue, label);
|
|
162
|
+
$[6] = label;
|
|
163
|
+
$[7] = textValue;
|
|
164
|
+
$[8] = t2;
|
|
165
|
+
} else t2 = $[8];
|
|
166
|
+
const t3 = ripple.handlers;
|
|
167
|
+
const t4 = mergeStatefulStyles(itemStyles, props);
|
|
194
168
|
let t5;
|
|
195
|
-
if ($[
|
|
196
|
-
t5 =
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
|
|
169
|
+
if ($[9] !== label || $[10] !== leading || $[11] !== ripple.surface || $[12] !== supporting || $[13] !== trailing) {
|
|
170
|
+
t5 = itemContent(label, leading, supporting, trailing, ripple.surface);
|
|
171
|
+
$[9] = label;
|
|
172
|
+
$[10] = leading;
|
|
173
|
+
$[11] = ripple.surface;
|
|
174
|
+
$[12] = supporting;
|
|
175
|
+
$[13] = trailing;
|
|
176
|
+
$[14] = t5;
|
|
177
|
+
} else t5 = $[14];
|
|
200
178
|
let t6;
|
|
201
|
-
if ($[
|
|
202
|
-
t6 = /* @__PURE__ */
|
|
203
|
-
|
|
204
|
-
|
|
179
|
+
if ($[15] !== t5) {
|
|
180
|
+
t6 = /* @__PURE__ */ jsx(NavigationTreeItemContent, { children: t5 });
|
|
181
|
+
$[15] = t5;
|
|
182
|
+
$[16] = t6;
|
|
183
|
+
} else t6 = $[16];
|
|
184
|
+
let t7;
|
|
185
|
+
if ($[17] !== T0 || $[18] !== children || $[19] !== props || $[20] !== ripple.handlers || $[21] !== t2 || $[22] !== t4 || $[23] !== t6) {
|
|
186
|
+
t7 = /* @__PURE__ */ jsxs(T0, {
|
|
187
|
+
textValue: t2,
|
|
205
188
|
...t3,
|
|
206
|
-
|
|
189
|
+
...props,
|
|
190
|
+
...t4,
|
|
191
|
+
children: [t6, children]
|
|
207
192
|
});
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
|
|
216
|
-
|
|
193
|
+
$[17] = T0;
|
|
194
|
+
$[18] = children;
|
|
195
|
+
$[19] = props;
|
|
196
|
+
$[20] = ripple.handlers;
|
|
197
|
+
$[21] = t2;
|
|
198
|
+
$[22] = t4;
|
|
199
|
+
$[23] = t6;
|
|
200
|
+
$[24] = t7;
|
|
201
|
+
} else t7 = $[24];
|
|
202
|
+
return t7;
|
|
217
203
|
}
|
|
218
204
|
/**
|
|
219
205
|
* A named group of rows, with its heading above them.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","NavigationTreeItemRenderProps","NavigationTreeItemProps","RACNavigationTreeItemProps","NavigationTreeProps","RACNavigationTreeProps","stylex","Button","RACButton","NavigationTree","RACNavigationTree","NavigationTreeHeader","RACNavigationTreeHeader","NavigationTreeItem","RACNavigationTreeItem","NavigationTreeItemContent","RACNavigationTreeItemContent","NavigationTreeSection","RACNavigationTreeSection","collectionStyles","ChevronEndGlyph","RowContent","rowStyles","focus","mergeStatefulStyles","mergeStyles","colors","motion","radii","spacing","typography","styles","chevron","kGNEyG","kWkggS","kaIpWk","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kmuXW","kjj79g","kmVPX3","$$css","indent","kZCmMZ","NavigationTreeHeaderProps","children","NavigationTreeItemText","Omit","T","className","leading","style","supporting","trailing","label","textValue","NavigationTreeSectionProps","Parameters","header","chevronClassName","props","ring","chevronFor","state","hasChildItems","isExpanded","itemContent","isDisabled","isCurrentAncestor","isCurrent","leadingFor","itemStyles","base","drawer","interactive","selectedDrawer","disabled","$","_c","t0","container","t1","T0","t2","t3","t4","t5","t6","t7","t8","textValueFor","section","undefined","Item","Section"],"sources":["../../../src/components/navigation-tree/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { NavigationTreeItemRenderProps, NavigationTreeItemProps as RACNavigationTreeItemProps, NavigationTreeProps as RACNavigationTreeProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, NavigationTree as RACNavigationTree, NavigationTreeHeader as RACNavigationTreeHeader, NavigationTreeItem as RACNavigationTreeItem, NavigationTreeItemContent as RACNavigationTreeItemContent, NavigationTreeSection as RACNavigationTreeSection } from 'react-aria-components';\nimport { collectionStyles } from '../../collection/styles';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// The navigation drawer page's contents: a nested set of links with the\n// current one marked. Each row is the row every list here draws — `src/row`,\n// shared with ListItem, ListBox, List, Tree and Disclosure — under that\n// module's `drawer` variant, which is the page's own 56dp row with a\n// label-large label and a secondary-container pill on the current one.\n//\n// This is Tree's shape over React Aria's navigation primitive, and the\n// difference is what the two are for. A tree selects: rows are chosen and\n// the choice is reported. A navigation tree navigates: each row is a link,\n// and which one is current is decided by matching the route rather than by\n// anything the reader selected. So this takes `selectedRoute` where Tree\n// takes `selectedKeys`, and has no selection at all — React Aria omits every\n// selection prop from it.\n//\n// Three things are this component's own.\n//\n// **A level indents by one caret's width**, exactly as Tree does and for the\n// same reason: React Aria writes the depth on each row as a custom property,\n// and 24dp is the size the drawer page gives its icon, so a level of nesting\n// is as wide as the glyph beside it.\n//\n// **An ancestor of the current row is marked too, and softly.** React Aria\n// reports it, and a drawer whose current row is collapsed out of sight would\n// otherwise show nothing at all. It takes the label's weight rather than the\n// pill, so the trail reads as a trail rather than as a second current row.\n//\n// That weight goes on the label itself, through the row module's\n// `isEmphasized`, and it has to: the row's own `font-weight` never reaches\n// the text, since `RowContent` draws the label in a span stating the\n// label-large role in full, weight included. The pair also has to differ by\n// more than a step — the label's own weight is already the medium one, so a\n// trail set in medium is a trail nobody can see.\n//\n// **The pill's shape is the library's own.** The page gives the active\n// indicator's colour, height and width but keeps its shape behind a token\n// set that does not open to a script — the same gap recorded on the buttons\n// and lists pages. It is drawn as a full pill, which is what the page's own\n// images show and what 56dp of height comes to.\n\nconst styles = {\n chevron: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n $$css: true\n },\n indent: {\n kZCmMZ: \"x1187sqy\",\n $$css: true\n }\n};\ntype NavigationTreeHeaderProps = {\n /** The section's heading. */\n children?: ReactNode;\n};\ntype NavigationTreeItemProps<T extends object = object> = NavigationTreeItemText & Omit<RACNavigationTreeItemProps<T>, 'children' | 'className' | 'style' | 'textValue'> & {\n /** The rows nested under this one, as further `NavigationTree.Item` entries. */\n children?: ReactNode;\n /** A function may compute the class from the row's render state. */\n className?: RACNavigationTreeItemProps<T>['className'];\n /** Content before the label: an icon. */\n leading?: ReactNode;\n /** A function may compute the style from the row's render state. */\n style?: RACNavigationTreeItemProps<T>['style'];\n /** A second line under the label, in the muted role. */\n supporting?: ReactNode;\n /** Content after the label, such as a count. */\n trailing?: ReactNode;\n};\n\n// What the row is worth as text, which React Aria requires: a row here wraps\n// its label in elements, so it cannot read one off the children the way a\n// plain-string child would give it. A string label is taken as the value,\n// which is the common case; anything else has to say what it is worth, and\n// this is what makes the compiler ask rather than leaving a row unnamed.\ntype NavigationTreeItemText = {\n /** The row's label — where it goes. */\n label: string;\n /** What typeahead matches the row on. Defaults to the label. */\n textValue?: string;\n} | {\n /** The row's label, as something other than a plain string. */\n label?: ReactNode;\n /** What typeahead matches the row on, and what names it. */\n textValue: string;\n};\ntype NavigationTreeProps<T extends object = object> = Omit<RACNavigationTreeProps<T>, 'className' | 'style'> & {\n /** A function may compute the class from the tree's render state. */\n className?: RACNavigationTreeProps<T>['className'];\n /** A function may compute the style from the tree's render state. */\n style?: RACNavigationTreeProps<T>['style'];\n};\ntype NavigationTreeSectionProps<T extends object = object> = Omit<Parameters<typeof RACNavigationTreeSection<T>>[0], 'children'> & {\n /**\n * The rows in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\n\n// The button itself never turns — the glyph inside it does, so the press\n// target stays a square whichever way the row is pointing.\nfunction chevronClassName() {\n return stylex.props(styles.chevron, focus.ring).className ?? '';\n}\n\n// The caret, or the space it would have taken. Written as a call rather than\n// inline at the prop, which is what react-perf's no-new-function-as-prop and\n// jsx-no-jsx-as-prop are after; the React Compiler memoises the result on\n// its inputs.\n//\n// A leaf gets the space rather than nothing, so its label lines up with the\n// label of a sibling that opens.\nfunction chevronFor(state: NavigationTreeItemRenderProps): ReactNode {\n if (!state.hasChildItems) {\n return <span className=\"xxk0z11 x2lah0s xvy4d1p\" />;\n }\n return <RACButton className={chevronClassName} slot=\"chevron\">\n <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p x19axjrm x1c071of xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x1y10d4b x1iffjtl\"\n }\n }[!!state.isExpanded << 0]} />\n </RACButton>;\n}\n\n// What a row draws, from React Aria's render state. The caret comes first,\n// then whatever the row was given — one order, always, which is what keeps a\n// column of rows reading down.\nfunction itemContent(label: ReactNode, leading: ReactNode, supporting: ReactNode, trailing: ReactNode) {\n return (state: NavigationTreeItemRenderProps): ReactNode => <RowContent isDisabled={state.isDisabled} isEmphasized={state.isCurrentAncestor} isSelected={state.isCurrent} leading={leadingFor(state, leading)} supporting={supporting} trailing={trailing} variant=\"drawer\">\n {label}\n </RowContent>;\n}\n\n// StyleX cannot target `[data-current]` on the element it is styling, so a\n// row's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so it wins over both the\n// interactive and the current branches, and StyleX replaces a property\n// whole, so it takes their hover states with it.\n// No overline, and so no three-line row: the navigation drawer page gives\n// one item height and one line of text. `List.Item` and `ListBox.Item` take\n// the prop because the lists page is what they draw; this row follows the\n// drawer's own metrics.\nfunction itemStyles(state: NavigationTreeItemRenderProps) {\n return stylex.props(rowStyles.base, rowStyles.drawer, rowStyles.interactive, styles.indent, state.isCurrent && rowStyles.selectedDrawer, state.isDisabled && rowStyles.disabled);\n}\n\n/**\n * The caret, then whatever the row was given. Its return type is written out\n * rather than inferred: `ReactNode` is a union that includes a promise, and\n * a function inferred as returning one has to be `async`.\n */\nfunction leadingFor(state: NavigationTreeItemRenderProps, leading: ReactNode): ReactNode {\n return <>\n {chevronFor(state)}\n {leading}\n </>;\n}\n\n/**\n * A nested set of links, with the current one marked. Which row is current\n * is React Aria's: give the tree a `selectedRoute` and each row an `href`,\n * and the row whose `href` matches is the current one — its ancestors are\n * marked too, so a collapsed trail still shows where you are.\n *\n * ```tsx\n * <NavigationTree aria-label=\"Label\" selectedRoute=\"#second\">\n * <NavigationTree.Item href=\"#first\" id=\"first\" label=\"First item\">\n * <NavigationTree.Item href=\"#second\" id=\"second\" label=\"Second item\" />\n * </NavigationTree.Item>\n * </NavigationTree>\n * ```\n *\n * There is no selection here, and that is React Aria's design rather than an\n * omission: a navigation tree navigates, so what is current comes from the\n * route rather than from anything the reader picked. `Tree` is the one that\n * selects.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction NavigationTree<T extends object>(props: NavigationTreeProps<T>) {\n return <RACNavigationTree<T> {...props} {...mergeStatefulStyles(stylex.props(collectionStyles.container), props)} />;\n}\n\n/**\n * A named group of rows. `header` names it, and is what a screen reader\n * reads before the rows inside.\n */\nfunction NavigationTreeHeader({\n children\n}: NavigationTreeHeaderProps) {\n return <RACNavigationTreeHeader className=\"x9f619 x1w5n3ug xkknnkr x14zspaw x1v9cpvo x155f00i x1lz68p4 xw3mh6e x1clyivc x140yoea\">\n {children}\n </RACNavigationTreeHeader>;\n}\n\n/**\n * One row, and the rows under it. Give it an `href` — that is what\n * `selectedRoute` is matched against — and an `id`, which is the key\n * expansion is reported by.\n *\n * Rows nested as `children` are what make it a branch; a row with none is a\n * leaf and draws no caret.\n */\nfunction NavigationTreeItem<T extends object = object>({\n children,\n label,\n leading,\n supporting,\n textValue,\n trailing,\n ...props\n}: NavigationTreeItemProps<T>) {\n return <RACNavigationTreeItem<T> textValue={textValueFor(textValue, label)} {...props} {...mergeStatefulStyles(itemStyles, props)}>\n <RACNavigationTreeItemContent>\n {itemContent(label, leading, supporting, trailing)}\n </RACNavigationTreeItemContent>\n {children}\n </RACNavigationTreeItem>;\n}\n\n/**\n * A named group of rows, with its heading above them.\n */\nfunction NavigationTreeSection<T extends object = object>({\n children,\n header,\n ...props\n}: NavigationTreeSectionProps<T>) {\n return <RACNavigationTreeSection<T> {...props} {...mergeStyles(stylex.props(collectionStyles.section), props)}>\n {header === undefined ? null : <NavigationTreeHeader>{header}</NavigationTreeHeader>}\n {children}\n </RACNavigationTreeSection>;\n}\n\n// What React Aria matches typeahead on, and what names the row.\n// `NavigationTreeItemText` makes one of the two a string, so the last branch\n// is unreachable through the public type — it is there because destructuring\n// the two apart is what loses the narrowing, not because a row can arrive\n// without either.\nfunction textValueFor(textValue: string | undefined, label: ReactNode) {\n if (textValue !== undefined) {\n return textValue;\n }\n return typeof label === 'string' ? label : '';\n}\nNavigationTree.Item = NavigationTreeItem;\nNavigationTree.Section = NavigationTreeSection;\nexport type { NavigationTreeHeaderProps, NavigationTreeItemProps, NavigationTreeProps, NavigationTreeSectionProps };\nexport default NavigationTree;"],"mappings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A,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAK,MAAAL,EAAA,OAAAhC,YAAAgC,EAAA,QAAAI,MAAAJ,EAAA,QAAAM,MAAAN,EAAA,QAAAO,IAAA;EADjFC,KAAA,qBAAC,IAAD;GAAyB,GAAQzB;GAAK,GAAMuB;GAA5C,UAAA,CACFC,IACAvC,QAF2B;;EAGHgC,EAAA,KAAAK;EAAAL,EAAA,KAAAhC;EAAAgC,EAAA,MAAAI;EAAAJ,EAAA,MAAAM;EAAAN,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAHtBQ;AAGsB;AAQ/B,SAASK,aAAanC,WAA+BD,OAAkB;CACrE,IAAIC,cAAcqC,KAAAA,GAChB,OAAOrC;CAET,OAAO,OAAOD,UAAU,WAAWA,QAAQ;AAC7C;AACAhD,iBAAeuF,OAAOnF;AACtBJ,iBAAewF,UAAUhF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","NavigationTreeItemRenderProps","NavigationTreeItemProps","RACNavigationTreeItemProps","NavigationTreeProps","RACNavigationTreeProps","stylex","Button","RACButton","NavigationTree","RACNavigationTree","NavigationTreeHeader","RACNavigationTreeHeader","NavigationTreeItem","RACNavigationTreeItem","NavigationTreeItemContent","RACNavigationTreeItemContent","NavigationTreeSection","RACNavigationTreeSection","collectionStyles","ChevronEndGlyph","useRipple","RowContent","rowStyles","focus","mergeStatefulStyles","mergeStyles","colors","motion","radii","spacing","typography","styles","chevron","kGNEyG","kWkggS","kaIpWk","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kmuXW","kjj79g","kmVPX3","$$css","indent","kZCmMZ","NavigationTreeHeaderProps","children","NavigationTreeItemText","Omit","T","className","leading","style","supporting","trailing","label","textValue","NavigationTreeSectionProps","Parameters","header","chevronClassName","props","ring","chevronFor","state","hasChildItems","isExpanded","itemContent","ripple","isDisabled","isCurrentAncestor","isCurrent","leadingFor","itemStyles","base","drawer","interactive","selectedDrawer","disabled","$","_c","t0","container","t1","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","T0","t2","textValueFor","t3","handlers","t4","t5","surface","t6","t7","section","undefined","Item","Section"],"sources":["../../../src/components/navigation-tree/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { NavigationTreeItemRenderProps, NavigationTreeItemProps as RACNavigationTreeItemProps, NavigationTreeProps as RACNavigationTreeProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, NavigationTree as RACNavigationTree, NavigationTreeHeader as RACNavigationTreeHeader, NavigationTreeItem as RACNavigationTreeItem, NavigationTreeItemContent as RACNavigationTreeItemContent, NavigationTreeSection as RACNavigationTreeSection } from 'react-aria-components';\nimport { collectionStyles } from '../../collection/styles';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// The navigation drawer page's contents: a nested set of links with the\n// current one marked. Each row is the row every list here draws — `src/row`,\n// shared with ListItem, ListBox, List, Tree and Disclosure — under that\n// module's `drawer` variant, which is the page's own 56dp row with a\n// label-large label and a secondary-container pill on the current one.\n//\n// This is Tree's shape over React Aria's navigation primitive, and the\n// difference is what the two are for. A tree selects: rows are chosen and\n// the choice is reported. A navigation tree navigates: each row is a link,\n// and which one is current is decided by matching the route rather than by\n// anything the reader selected. So this takes `selectedRoute` where Tree\n// takes `selectedKeys`, and has no selection at all — React Aria omits every\n// selection prop from it.\n//\n// Three things are this component's own.\n//\n// **A level indents by one caret's width**, exactly as Tree does and for the\n// same reason: React Aria writes the depth on each row as a custom property,\n// and 24dp is the size the drawer page gives its icon, so a level of nesting\n// is as wide as the glyph beside it.\n//\n// **An ancestor of the current row is marked too, and softly.** React Aria\n// reports it, and a drawer whose current row is collapsed out of sight would\n// otherwise show nothing at all. It takes the label's weight rather than the\n// pill, so the trail reads as a trail rather than as a second current row.\n//\n// That weight goes on the label itself, through the row module's\n// `isEmphasized`, and it has to: the row's own `font-weight` never reaches\n// the text, since `RowContent` draws the label in a span stating the\n// label-large role in full, weight included. The pair also has to differ by\n// more than a step — the label's own weight is already the medium one, so a\n// trail set in medium is a trail nobody can see.\n//\n// **The pill's shape is the library's own.** The page gives the active\n// indicator's colour, height and width but keeps its shape behind a token\n// set that does not open to a script — the same gap recorded on the buttons\n// and lists pages. It is drawn as a full pill, which is what the page's own\n// images show and what 56dp of height comes to.\n\nconst styles = {\n chevron: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n $$css: true\n },\n indent: {\n kZCmMZ: \"x1187sqy\",\n $$css: true\n }\n};\ntype NavigationTreeHeaderProps = {\n /** The section's heading. */\n children?: ReactNode;\n};\ntype NavigationTreeItemProps<T extends object = object> = NavigationTreeItemText & Omit<RACNavigationTreeItemProps<T>, 'children' | 'className' | 'style' | 'textValue'> & {\n /** The rows nested under this one, as further `NavigationTree.Item` entries. */\n children?: ReactNode;\n /** A function may compute the class from the row's render state. */\n className?: RACNavigationTreeItemProps<T>['className'];\n /** Content before the label: an icon. */\n leading?: ReactNode;\n /** A function may compute the style from the row's render state. */\n style?: RACNavigationTreeItemProps<T>['style'];\n /** A second line under the label, in the muted role. */\n supporting?: ReactNode;\n /** Content after the label, such as a count. */\n trailing?: ReactNode;\n};\n\n// What the row is worth as text, which React Aria requires: a row here wraps\n// its label in elements, so it cannot read one off the children the way a\n// plain-string child would give it. A string label is taken as the value,\n// which is the common case; anything else has to say what it is worth, and\n// this is what makes the compiler ask rather than leaving a row unnamed.\ntype NavigationTreeItemText = {\n /** The row's label — where it goes. */\n label: string;\n /** What typeahead matches the row on. Defaults to the label. */\n textValue?: string;\n} | {\n /** The row's label, as something other than a plain string. */\n label?: ReactNode;\n /** What typeahead matches the row on, and what names it. */\n textValue: string;\n};\ntype NavigationTreeProps<T extends object = object> = Omit<RACNavigationTreeProps<T>, 'className' | 'style'> & {\n /** A function may compute the class from the tree's render state. */\n className?: RACNavigationTreeProps<T>['className'];\n /** A function may compute the style from the tree's render state. */\n style?: RACNavigationTreeProps<T>['style'];\n};\ntype NavigationTreeSectionProps<T extends object = object> = Omit<Parameters<typeof RACNavigationTreeSection<T>>[0], 'children'> & {\n /**\n * The rows in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\n\n// The button itself never turns — the glyph inside it does, so the press\n// target stays a square whichever way the row is pointing.\nfunction chevronClassName() {\n return stylex.props(styles.chevron, focus.ring).className ?? '';\n}\n\n// The caret, or the space it would have taken. Written as a call rather than\n// inline at the prop, which is what react-perf's no-new-function-as-prop and\n// jsx-no-jsx-as-prop are after; the React Compiler memoises the result on\n// its inputs.\n//\n// A leaf gets the space rather than nothing, so its label lines up with the\n// label of a sibling that opens.\nfunction chevronFor(state: NavigationTreeItemRenderProps): ReactNode {\n if (!state.hasChildItems) {\n return <span className=\"xxk0z11 x2lah0s xvy4d1p\" />;\n }\n return <RACButton className={chevronClassName} slot=\"chevron\">\n <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p x19axjrm x1c071of xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x1y10d4b x1iffjtl\"\n }\n }[!!state.isExpanded << 0]} />\n </RACButton>;\n}\n\n// What a row draws, from React Aria's render state. The caret comes first,\n// then whatever the row was given — one order, always, which is what keeps a\n// column of rows reading down.\nfunction itemContent(label: ReactNode, leading: ReactNode, supporting: ReactNode, trailing: ReactNode, ripple: ReactNode) {\n return (state: NavigationTreeItemRenderProps): ReactNode => <>\n <RowContent isDisabled={state.isDisabled} isEmphasized={state.isCurrentAncestor} isSelected={state.isCurrent} leading={leadingFor(state, leading)} supporting={supporting} trailing={trailing} variant=\"drawer\">\n {label}\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n}\n\n// StyleX cannot target `[data-current]` on the element it is styling, so a\n// row's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so it wins over both the\n// interactive and the current branches, and StyleX replaces a property\n// whole, so it takes their hover states with it.\n// No overline, and so no three-line row: the navigation drawer page gives\n// one item height and one line of text. `List.Item` and `ListBox.Item` take\n// the prop because the lists page is what they draw; this row follows the\n// drawer's own metrics.\nfunction itemStyles(state: NavigationTreeItemRenderProps) {\n return stylex.props(rowStyles.base, rowStyles.drawer, rowStyles.interactive, styles.indent, state.isCurrent && rowStyles.selectedDrawer, state.isDisabled && rowStyles.disabled);\n}\n\n/**\n * The caret, then whatever the row was given. Its return type is written out\n * rather than inferred: `ReactNode` is a union that includes a promise, and\n * a function inferred as returning one has to be `async`.\n */\nfunction leadingFor(state: NavigationTreeItemRenderProps, leading: ReactNode): ReactNode {\n return <>\n {chevronFor(state)}\n {leading}\n </>;\n}\n\n/**\n * A nested set of links, with the current one marked. Which row is current\n * is React Aria's: give the tree a `selectedRoute` and each row an `href`,\n * and the row whose `href` matches is the current one — its ancestors are\n * marked too, so a collapsed trail still shows where you are.\n *\n * ```tsx\n * <NavigationTree aria-label=\"Label\" selectedRoute=\"#second\">\n * <NavigationTree.Item href=\"#first\" id=\"first\" label=\"First item\">\n * <NavigationTree.Item href=\"#second\" id=\"second\" label=\"Second item\" />\n * </NavigationTree.Item>\n * </NavigationTree>\n * ```\n *\n * There is no selection here, and that is React Aria's design rather than an\n * omission: a navigation tree navigates, so what is current comes from the\n * route rather than from anything the reader picked. `Tree` is the one that\n * selects.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction NavigationTree<T extends object>(props: NavigationTreeProps<T>) {\n return <RACNavigationTree<T> {...props} {...mergeStatefulStyles(stylex.props(collectionStyles.container), props)} />;\n}\n\n/**\n * A named group of rows. `header` names it, and is what a screen reader\n * reads before the rows inside.\n */\nfunction NavigationTreeHeader({\n children\n}: NavigationTreeHeaderProps) {\n return <RACNavigationTreeHeader className=\"x9f619 x1w5n3ug xkknnkr x14zspaw x1v9cpvo x155f00i x1lz68p4 xw3mh6e x1clyivc x140yoea\">\n {children}\n </RACNavigationTreeHeader>;\n}\n\n/**\n * One row, and the rows under it. Give it an `href` — that is what\n * `selectedRoute` is matched against — and an `id`, which is the key\n * expansion is reported by.\n *\n * Rows nested as `children` are what make it a branch; a row with none is a\n * leaf and draws no caret.\n */\nfunction NavigationTreeItem<T extends object = object>({\n children,\n label,\n leading,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n supporting,\n textValue,\n trailing,\n ...props\n}: NavigationTreeItemProps<T>) {\n // The press ripple List's rows draw — see ListItem there.\n const ripple = useRipple<HTMLDivElement>(true, {\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACNavigationTreeItem<T> textValue={textValueFor(textValue, label)} {...ripple.handlers} {...props} {...mergeStatefulStyles(itemStyles, props)}>\n <RACNavigationTreeItemContent>\n {itemContent(label, leading, supporting, trailing, ripple.surface)}\n </RACNavigationTreeItemContent>\n {children}\n </RACNavigationTreeItem>;\n}\n\n/**\n * A named group of rows, with its heading above them.\n */\nfunction NavigationTreeSection<T extends object = object>({\n children,\n header,\n ...props\n}: NavigationTreeSectionProps<T>) {\n return <RACNavigationTreeSection<T> {...props} {...mergeStyles(stylex.props(collectionStyles.section), props)}>\n {header === undefined ? null : <NavigationTreeHeader>{header}</NavigationTreeHeader>}\n {children}\n </RACNavigationTreeSection>;\n}\n\n// What React Aria matches typeahead on, and what names the row.\n// `NavigationTreeItemText` makes one of the two a string, so the last branch\n// is unreachable through the public type — it is there because destructuring\n// the two apart is what loses the narrowing, not because a row can arrive\n// without either.\nfunction textValueFor(textValue: string | undefined, label: ReactNode) {\n if (textValue !== undefined) {\n return textValue;\n }\n return typeof label === 'string' ? label : '';\n}\nNavigationTree.Item = NavigationTreeItem;\nNavigationTree.Section = NavigationTreeSection;\nexport type { NavigationTreeHeaderProps, NavigationTreeItemProps, NavigationTreeProps, NavigationTreeSectionProps };\nexport default NavigationTree;"],"mappings":";;;;;;;;;;;;AAqDA,MAAMgC,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,QAAQ;EACNC,QAAQ;EACRF,OAAO;CACT;AACF;AA0DA,SAASkB,mBAAmB;CAC1B,OAAOzD,MAAa0B,OAAOC,SAAST,MAAMyC,IAAI,CAAC,CAACZ,aAAa;AAC/D;AASA,SAASa,WAAWC,OAAiD;CACnE,IAAI,CAACA,MAAMC,eACT,OAAO,oBAAC,QAAD,EAAM,WAAU,0BAAyB,CAAA;CAElD,OAAO,oBAAC,QAAD;EAAW,WAAWL;EAAkB,MAAK;EAChD,UAAA,oBAAC,iBAAD,EAAiB,GAAI;GACrB,GAAG,EACDV,WAAW,sEACb;GACA,GAAG,EACDA,WAAW,sEACb;EACF,EAAE,CAAC,CAACc,MAAME,cAAc,GAAG,CAAA;CAChB,CAAA;AACf;AAKA,SAASC,YAAYZ,OAAkBJ,SAAoBE,YA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ductIcon(t0) {
|
|
92
|
-
const $ = c(
|
|
92
|
+
const $ = c(18);
|
|
93
93
|
const { name, render, size: t1, src, tone: t2, ...props$1 } = t0;
|
|
94
94
|
const size = t1 === void 0 ? "md" : t1;
|
|
95
95
|
const tone = t2 === void 0 ? "primary" : t2;
|
|
96
96
|
const status = useImageLoadingStatus(src);
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
let t3;
|
|
98
|
+
if ($[0] !== name) {
|
|
99
|
+
t3 = name.trim();
|
|
100
|
+
$[0] = name;
|
|
101
|
+
$[1] = t3;
|
|
102
|
+
} else t3 = $[1];
|
|
103
|
+
const named = t3 !== "";
|
|
104
|
+
const t4 = "span";
|
|
99
105
|
let t5;
|
|
100
|
-
if ($[
|
|
101
|
-
t5 =
|
|
106
|
+
if ($[2] !== name || $[3] !== named) {
|
|
107
|
+
t5 = named ? {
|
|
108
|
+
"aria-label": name,
|
|
109
|
+
role: "img"
|
|
110
|
+
} : {};
|
|
111
|
+
$[2] = name;
|
|
112
|
+
$[3] = named;
|
|
113
|
+
$[4] = t5;
|
|
114
|
+
} else t5 = $[4];
|
|
115
|
+
let t6;
|
|
116
|
+
if ($[5] !== name || $[6] !== src || $[7] !== status || $[8] !== tone) {
|
|
117
|
+
t6 = status === "loaded" ? /* @__PURE__ */ jsx("img", {
|
|
102
118
|
alt: "",
|
|
103
119
|
src,
|
|
104
120
|
className: "x5yr21d xh8yej3 x19kjcj4"
|
|
@@ -106,40 +122,39 @@ function ProductIcon(t0) {
|
|
|
106
122
|
...props(styles.fallback, styles[tone]),
|
|
107
123
|
children: initialFrom(name)
|
|
108
124
|
});
|
|
109
|
-
$[0] = name;
|
|
110
|
-
$[1] = src;
|
|
111
|
-
$[2] = status;
|
|
112
|
-
$[3] = tone;
|
|
113
|
-
$[4] = t5;
|
|
114
|
-
} else t5 = $[4];
|
|
115
|
-
const t6 = mergeStyles(props(styles.base, styles[size]), props$1);
|
|
116
|
-
let t7;
|
|
117
|
-
if ($[5] !== name || $[6] !== props$1 || $[7] !== t5 || $[8] !== t6) {
|
|
118
|
-
t7 = {
|
|
119
|
-
"aria-label": name,
|
|
120
|
-
role: t4,
|
|
121
|
-
...props$1,
|
|
122
|
-
children: t5,
|
|
123
|
-
...t6
|
|
124
|
-
};
|
|
125
125
|
$[5] = name;
|
|
126
|
-
$[6] =
|
|
127
|
-
$[7] =
|
|
128
|
-
$[8] =
|
|
129
|
-
$[9] =
|
|
130
|
-
} else
|
|
126
|
+
$[6] = src;
|
|
127
|
+
$[7] = status;
|
|
128
|
+
$[8] = tone;
|
|
129
|
+
$[9] = t6;
|
|
130
|
+
} else t6 = $[9];
|
|
131
|
+
const t7 = mergeStyles(props(styles.base, styles[size]), props$1);
|
|
131
132
|
let t8;
|
|
132
|
-
if ($[10] !==
|
|
133
|
+
if ($[10] !== props$1 || $[11] !== t5 || $[12] !== t6 || $[13] !== t7) {
|
|
133
134
|
t8 = {
|
|
134
|
-
|
|
135
|
-
props
|
|
135
|
+
...t5,
|
|
136
|
+
...props$1,
|
|
137
|
+
children: t6,
|
|
138
|
+
...t7
|
|
139
|
+
};
|
|
140
|
+
$[10] = props$1;
|
|
141
|
+
$[11] = t5;
|
|
142
|
+
$[12] = t6;
|
|
143
|
+
$[13] = t7;
|
|
144
|
+
$[14] = t8;
|
|
145
|
+
} else t8 = $[14];
|
|
146
|
+
let t9;
|
|
147
|
+
if ($[15] !== render || $[16] !== t8) {
|
|
148
|
+
t9 = {
|
|
149
|
+
defaultTagName: t4,
|
|
150
|
+
props: t8,
|
|
136
151
|
render
|
|
137
152
|
};
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
} else
|
|
142
|
-
return useRender(
|
|
153
|
+
$[15] = render;
|
|
154
|
+
$[16] = t8;
|
|
155
|
+
$[17] = t9;
|
|
156
|
+
} else t9 = $[17];
|
|
157
|
+
return useRender(t9);
|
|
143
158
|
}
|
|
144
159
|
//#endregion
|
|
145
160
|
export { ProductIcon as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["stylex","RenderComponentProps","useImageLoadingStatus","useRender","mergeStyles","colors","radii","typography","styles","base","kGNEyG","kaIpWk","kB7OPa","k1xSpc","kmuXW","kMv6JI","k63SB2","kjj79g","kVQacm","kfSwDN","$$css","fallback","kZKoxP","kzqmXN","image","kVIFPx","lg","kGuDYH","md","negative","kWkggS","kMwMTN","positive","primary","secondary","sm","tertiary","ProductIconProps","Omit","name","size","src","tone","initialFrom","trimmed","trim","Array","from","toLocaleUpperCase","ProductIcon","t0","$","_c","render","t1","t2","props","undefined","status","t3","t4","t5","t6","t7","
|
|
1
|
+
{"version":3,"file":"index.js","names":["stylex","RenderComponentProps","useImageLoadingStatus","useRender","mergeStyles","colors","radii","typography","styles","base","kGNEyG","kaIpWk","kB7OPa","k1xSpc","kmuXW","kMv6JI","k63SB2","kjj79g","kVQacm","kfSwDN","$$css","fallback","kZKoxP","kzqmXN","image","kVIFPx","lg","kGuDYH","md","negative","kWkggS","kMwMTN","positive","primary","secondary","sm","tertiary","ProductIconProps","Omit","name","size","src","tone","initialFrom","trimmed","trim","Array","from","toLocaleUpperCase","ProductIcon","t0","$","_c","render","t1","t2","props","undefined","status","t3","named","t4","t5","role","t6","t7","t8","children","t9","defaultTagName"],"sources":["../../../src/components/product-icon/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useImageLoadingStatus } from '../../hooks/useImageLoadingStatus';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, typography } from '../../tokens/design.tokens.stylex';\n\n// The counterpart to Avatar: Avatar stands for a person, this stands for\n// everything else — an application, a service, a brand. The two are the same\n// three sizes so either can fill a leading slot without moving what sits\n// beside it, and they differ in the two ways that matter for a mark rather\n// than a face.\n//\n// A rounded square rather than a circle. A logo is drawn to its own bounding\n// box, and a circle crops the corners it was composed with.\n//\n// `contain` rather than `cover`. Cropping a face to fill a circle loses\n// nothing anyone minds; cropping a wordmark loses the word. The cost is\n// letterboxing — a wide mark leaves space above and below — and that is the\n// right trade for a mark whose whole job is to be recognised.\n//\n// That cost is also why `tone` tints the fallback rather than the root. A mark\n// letterboxed into the square does not cover it, and neither does one drawn\n// with transparency, so a tint on the root showed as a coloured box around\n// every logo that was not an opaque square. On the fallback it is seen exactly\n// when it is meant to be: while there is no mark, or none has loaded.\n//\n// No Material Design page draws a product mark, so its sizes are Avatar's —\n// 36, 40 and 56 — which is what lets a mark and a person fill the same slot.\n// Avatar's own comment is where those three are argued, against the\n// library's control scale rather than against a page. The fallback's tint is\n// a container role under its on-colour, the pairing every filled surface in\n// the system uses.\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kaIpWk: \"x1xdvaa9\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n k63SB2: \"x1bf3uqz\",\n kjj79g: \"xl56j7k\",\n kVQacm: \"xb3r6kr\",\n kfSwDN: \"x87ps6o\",\n $$css: true\n },\n fallback: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"x5yr21d\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"xh8yej3\",\n kjj79g: \"xl56j7k\",\n $$css: true\n },\n image: {\n kZKoxP: \"x5yr21d\",\n kzqmXN: \"xh8yej3\",\n kVIFPx: \"x19kjcj4\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xnnlda6\",\n kGuDYH: \"x1848etk\",\n kzqmXN: \"x15yg21f\",\n $$css: true\n },\n md: {\n kZKoxP: \"x1vqgdyp\",\n kGuDYH: \"x14zspaw\",\n kzqmXN: \"x100vrsf\",\n $$css: true\n },\n negative: {\n kWkggS: \"xkz0cvf\",\n kMwMTN: \"xylzu7l\",\n $$css: true\n },\n positive: {\n kWkggS: \"xa3zu90\",\n kMwMTN: \"x1di7zbg\",\n $$css: true\n },\n primary: {\n kWkggS: \"xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n secondary: {\n kWkggS: \"x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n sm: {\n kZKoxP: \"xc9qbxq\",\n kGuDYH: \"xkucv67\",\n kzqmXN: \"x14qfxbe\",\n $$css: true\n },\n tertiary: {\n kWkggS: \"xs6yvni\",\n kMwMTN: \"x3cbcwg\",\n $$css: true\n }\n};\ntype ProductIconProps = Omit<RenderComponentProps<'span'>, 'children'> & {\n /**\n * What this identifies. Supplies both the fallback initial and the\n * accessible name, so a screen reader announces the thing rather than\n * reading a letter aloud.\n */\n name: string;\n /**\n * Edge length: `sm` 36px, `md` 40px, `lg` 56px. The same three Avatar uses,\n * so the two are interchangeable wherever one leads a row or a card.\n * @default 'md'\n */\n size?: 'lg' | 'md' | 'sm';\n /**\n * The mark to show in place of the initial. The initial stays until it has\n * loaded, and comes back if it fails.\n */\n src?: string;\n /**\n * Which container/on-container colour pair to tint the fallback with. It is\n * the fallback's own background, so it is gone once `src` has loaded rather\n * than sitting behind the mark.\n * @default 'primary'\n */\n tone?: 'negative' | 'positive' | 'primary' | 'secondary' | 'tertiary';\n};\n\n// One letter, where Avatar takes two. A person has a first name and a last\n// name to initialise; a thing usually has neither, so the same rule applied\n// to \"Second Item\" would produce \"SI\" — a pair of initials for something that\n// was never two words in that sense. Array.from rather than indexing, so a\n// name starting outside the Basic Multilingual Plane yields its whole first\n// character instead of half a surrogate pair.\nfunction initialFrom(name: string) {\n const trimmed = name.trim();\n return (Array.from(trimmed)[0] ?? '').toLocaleUpperCase();\n}\n\n/**\n * A small square mark identifying something that is not a person — an\n * application, a service, a brand. Reach for Avatar when it is a person.\n *\n * The mark is letterboxed rather than cropped, so a logo of any aspect ratio\n * can be handed over as it was drawn.\n */\nfunction ProductIcon({\n name,\n render,\n size = 'md',\n src,\n tone = 'primary',\n ...props\n}: ProductIconProps) {\n // The mark is shown only once it has loaded, and the letter stays until\n // then and comes back if it fails — see useImageLoadingStatus.\n const status = useImageLoadingStatus(src);\n\n // role/aria-label rather than letting the fallback letter be read: \"B\" is\n // not what anyone means to announce. Marking the root as an image also\n // makes its contents presentational, so neither the mark nor the letter\n // is announced a second time underneath the name. A span rather than an\n // <img>, which is void: this element's whole job is to hold the letter\n // shown when there is no mark, or none has loaded yet.\n //\n // A blank name — one still loading, say — names nothing, so the icon is\n // then a plain element rather than an image with no name, which a screen\n // reader reads as a bare \"image\". Its empty initial, or its mark with an\n // empty alt, leave it nothing to announce.\n const named = name.trim() !== '';\n return useRender({\n defaultTagName: 'span',\n props: {\n ...(named ? {\n 'aria-label': name,\n role: 'img'\n } : {}),\n ...props,\n children: status === 'loaded' ? <img alt=\"\" src={src} className=\"x5yr21d xh8yej3 x19kjcj4\" /> : <span {...stylex.props(styles.fallback, styles[tone])}>\n {initialFrom(name)}\n </span>,\n ...mergeStyles(stylex.props(styles.base, styles[size]), props)\n },\n render\n });\n}\nexport type { ProductIconProps };\nexport default ProductIcon;"],"mappings":";;;;;;;AAkCA,MAAMQ,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRX,QAAQ;EACRY,QAAQ;EACRT,QAAQ;EACRU,QAAQ;EACRN,QAAQ;EACRG,OAAO;CACT;CACAI,OAAO;EACLF,QAAQ;EACRC,QAAQ;EACRE,QAAQ;EACRL,OAAO;CACT;CACAM,IAAI;EACFJ,QAAQ;EACRK,QAAQ;EACRJ,QAAQ;EACRH,OAAO;CACT;CACAQ,IAAI;EACFN,QAAQ;EACRK,QAAQ;EACRJ,QAAQ;EACRH,OAAO;CACT;CACAS,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRX,OAAO;CACT;CACAY,UAAU;EAC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T,MAAA;EAEIsB,KAAAN,WAAW,WAAW,oBAAA,OAAA;GAAS,KAAA;GAAQjB;GAAe,WAAA;EAA0B,CAAA,IAAM,oBAAA,QAAA;GAErF,GAF+FzC,MAAaQ,OAAMa,UAAWb,OAAOkC,KAAK;GAC7IC,UAAAA,YAAYJ,IAAI;EACZ,CAAA;EAAAY,EAAA,KAAAZ;EAAAY,EAAA,KAAAV;EAAAU,EAAA,KAAAO;EAAAP,EAAA,KAAAT;EAAAS,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CACR,MAAAc,KAAA7D,YAAYJ,MAAaQ,OAAMC,MAAOD,OAAOgC,KAAK,GAAGgB,OAAK;CAAC,IAAAU;CAAA,IAAAf,EAAA,QAAAK,WAAAL,EAAA,QAAAW,MAAAX,EAAA,QAAAa,MAAAb,EAAA,QAAAc,IAAA;EATzDC,KAAA;GAAA,GACDJ;GAGE,GACHN;GAAKW,UACEH;GAEC,GACRC;EACL;EAACd,EAAA,MAAAK;EAAAL,EAAA,MAAAW;EAAAX,EAAA,MAAAa;EAAAb,EAAA,MAAAc;EAAAd,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,IAAAiB;CAAA,IAAAjB,EAAA,QAAAE,UAAAF,EAAA,QAAAe,IAAA;EAZcE,KAAA;GAAAC,gBACCR;GAAML,OACfU;GAUNb;EAEH;EAACF,EAAA,MAAAE;EAAAF,EAAA,MAAAe;EAAAf,EAAA,MAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAdMhD,UAAUiE,EAchB;AAAC"}
|
|
@@ -11,7 +11,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
import { Token, TokenField, TokenInput } from "react-aria-components";
|
|
12
12
|
//#region src/components/token-field/index.tsx
|
|
13
13
|
const styles = { token: {
|
|
14
|
-
kfSwDN: "x87ps6o",
|
|
15
14
|
kXLuUW: "xxymvpz",
|
|
16
15
|
$$css: true
|
|
17
16
|
} };
|
|
@@ -25,9 +24,12 @@ function isPopulated(value) {
|
|
|
25
24
|
if (value === void 0) return;
|
|
26
25
|
return value.segments.some((segment) => segment.text.length > 0);
|
|
27
26
|
}
|
|
27
|
+
function tokenClassName({ isSelected }) {
|
|
28
|
+
return props(chipStyles.base, focus.ring, isSelected ? chipStyles.selected : chipStyles.unselected, styles.token).className ?? "";
|
|
29
|
+
}
|
|
28
30
|
function tokenContent(renderToken) {
|
|
29
31
|
return (segment) => /* @__PURE__ */ jsx(Token, {
|
|
30
|
-
|
|
32
|
+
className: tokenClassName,
|
|
31
33
|
children: chipLabel(renderToken === void 0 ? segment.text : renderToken(segment))
|
|
32
34
|
});
|
|
33
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","TokenFieldProps","RACTokenFieldProps","TokenInputProps","RACTokenInputProps","stylex","useState","Token","RACToken","TokenField","RACTokenField","TokenInput","RACTokenInput","TokenFieldValue","FieldVariant","chipLabel","chipStyles","FieldBox","FieldMessage","fieldStyles","invalidFrom","focus","mergeStatefulStyles","colors","typography","TOKEN_LINE","styles","token","kfSwDN","kXLuUW","$$css","className","T","description","error","floatingLabel","label","leadingIcon","renderToken","segment","TokenSegment","style","trailingIcon","variant","Omit","Parameters","changeHandler","setHeld","value","onChange","isPopulated","undefined","segments","some","text","length","tokenContent","props","base","ring","unselected","t0","$","_c","t1","t2","held","defaultValue","populated","T0","t3","t4","root","t5","isDisabled","t6","t7","Symbol","for","0","1","t8","t9","t10","t11","t12","t13"],"sources":["../../../src/components/token-field/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { TokenFieldProps as RACTokenFieldProps, TokenInputProps as RACTokenInputProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useState } from 'react';\nimport { Token as RACToken, TokenField as RACTokenField, TokenInput as RACTokenInput, TokenFieldValue } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { chipLabel } from '../../chip';\nimport { chipStyles } from '../../chip/styles';\nimport { FieldBox, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom } from '../../field/root';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\n\n// The chips page's input chips inside a text field: a field whose value is\n// text with pills in it — a tag input, a mention field, a structured search\n// box. The box, label, supporting line and error are the field chrome in\n// `src/field`, shared with every other field; the pill is the chip module's\n// in `src/chip`, shared with Chip and ChipGroup. What is here is React Aria's\n// `TokenField` around them.\n//\n// The value is React Aria's `TokenFieldValue`, a list of text and token\n// segments rather than a string, and this component does not wrap it. What\n// counts as a token is the whole question a token field exists to answer — a\n// hash tag, an @ mention, a chosen contact — and a wrapper would be a second\n// place to decide it. The class is re-exported from the package so a call\n// site can subclass it and override `tokenize`.\n//\n// Three things are worth knowing.\n//\n// **The editable area is not an input.** React Aria draws a contenteditable\n// element, since a token cannot live inside an `<input>`. So the box is drawn\n// `multiline` and grows with what it holds, and the chrome is told whether it\n// is populated rather than reading an input's value — a token field is the\n// third control the chrome cannot ask, after a select and a picker.\n//\n// **The box's whole height is the editable area.** A press anywhere in the\n// box has to put the caret in the text, so the box is not covered by a press\n// target the way Select's is; React Aria's own element fills the control's\n// place and takes the press.\n//\n// **A token is drawn by the call site, or by this.** `renderToken` takes a\n// segment and returns what the pill holds; without it the pill holds the\n// segment's own text. Either way the pill is the page's, so a token here and\n// a chip elsewhere cannot drift.\n\n// A token's pill is 32dp tall inside a body line of 24, so the control's\n// line makes room for it or the pills overlap once the value wraps. Stated\n// once because the control's floor and its line have to agree, and the\n// clearance under the label is measured from it.\nconst TOKEN_LINE = '32px';\nconst styles = {\n token: {\n kfSwDN: \"x87ps6o\",\n kXLuUW: \"xxymvpz\",\n $$css: true\n }\n};\ntype TokenFieldProps<T extends TokenFieldValue = TokenFieldValue> = {\n /** A function may compute the class from the field's render state. */\n className?: RACTokenFieldProps<T>['className'];\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message and the red underline both\n * follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or holds something. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a field with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. An icon drawn in `em` takes\n * that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * What each token holds. Given a segment, return what to draw inside its\n * pill; without it the pill holds the segment's own text.\n */\n renderToken?: (segment: TokenSegment) => ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACTokenFieldProps<T>['style'];\n /**\n * An icon at the end of the box, after the value: the page's 24dp trailing\n * icon, in the muted role and the error role once the field has an error.\n * An icon drawn in `em` takes that size from the slot.\n */\n trailingIcon?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACTokenFieldProps<T>, 'children' | 'className' | 'style'>;\n\n// One token, as React Aria hands it to the editable area's render function.\n// Taken from that prop rather than imported, since the type lives in\n// `react-stately`, which this package does not depend on directly.\ntype TokenSegment = Parameters<RACTokenInputProps['children']>[0];\n\n// Keeps the mirrored copy in step and then hands the change on to the call\n// site. Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its input.\nfunction changeHandler<T extends TokenFieldValue>(setHeld: (value: T) => void, onChange: ((value: T) => void) | undefined) {\n return (value: T) => {\n setHeld(value);\n onChange?.(value);\n };\n}\n\n// Whether the field holds anything, for the floating label. A token field's\n// editable area is a contenteditable element rather than an input, so the\n// chrome cannot read a value off it and is told instead.\nfunction isPopulated(value: TokenFieldValue | undefined) {\n if (value === undefined) {\n return undefined;\n }\n return value.segments.some(segment => segment.text.length > 0);\n}\n\n// What each token draws. Built by a call rather than written inline at the\n// prop, which is what react-perf's no-new-function-as-prop is after; the\n// React Compiler memoises the result on its input.\nfunction tokenContent(renderToken: TokenFieldProps['renderToken']) {\n return (segment: TokenSegment) => <RACToken {...stylex.props(chipStyles.base, focus.ring, chipStyles.unselected, styles.token)}>\n {chipLabel(renderToken === undefined ? segment.text : renderToken(segment))}\n </RACToken>;\n}\n\n/**\n * A labelled field whose value is text with inline tokens — a tag input, a\n * mention field, a structured search box. Its value is React Aria's\n * `TokenFieldValue`: pass `value` with `onChange` to control it, or\n * `defaultValue` to let it keep its own.\n *\n * ```tsx\n * const [value, setValue] = useState(new TokenFieldValue([]))\n *\n * <TokenField label=\"Label\" onChange={setValue} value={value} />\n * ```\n *\n * What counts as a token is the call site's: subclass `TokenFieldValue` and\n * override `tokenize`, which the package re-exports for that. `renderToken`\n * decides what each pill holds; without it, the segment's own text.\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, and the pill is the chip module's, shared with Chip and\n * ChipGroup.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction TokenField<T extends TokenFieldValue = TokenFieldValue>({\n description,\n error,\n floatingLabel = true,\n label,\n leadingIcon,\n renderToken,\n trailingIcon,\n variant = 'filled',\n ...props\n}: TokenFieldProps<T>) {\n // A copy of what the field holds, kept only so the label can float from\n // it. React Aria's token field reports `isDisabled` and `isReadOnly`\n // through its render props and not its value, and it hands its state down\n // a context of its own that nothing outside the module can read — so an\n // uncontrolled field has no other way to say what it is holding now.\n //\n // This mirrors rather than controls: `defaultValue` still goes through, so\n // React Aria keeps owning the value and the editing it does with it. A\n // controlled field is read straight off the prop, which already moves.\n const [held, setHeld] = useState(props.defaultValue);\n const populated = isPopulated(props.value ?? held);\n return <RACTokenField<T> {...props} onChange={changeHandler(setHeld, props.onChange)} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `TokenField` does not, so the\n // box is told outright or its label and its underline never turn.\n isDisabled={props.isDisabled} isInvalid={invalidFrom(error)} isPopulated={populated} label={label} leading={leadingIcon} multiline trailing={trailingIcon} variant={variant}>\n <RACTokenInput<T> {...{\n 0: {\n className: \"x9f619 x139gbkf x1lliihq x16svsjw x1848etk x1c52epr xh8yej3 x1qn8t5l xcgk4ki x21xpn4 x1t137rt x126k92a\"\n },\n 1: {\n className: \"x9f619 x139gbkf x1lliihq x16svsjw x1848etk x1c52epr xh8yej3 x1qn8t5l xcgk4ki x1t137rt x126k92a xhm3zzy xczxdwi\"\n }\n }[!!(variant === 'filled') << 0]}>\n {tokenContent(renderToken)}\n </RACTokenInput>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACTokenField>;\n}\nexport type { TokenFieldProps, TokenSegment };\nexport default TokenField;"],"mappings":";;;;;;;;;;;;AAoDA,MAAM0B,SAAS,EACbC,OAAO;CACLC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AAkEA,SAASgB,cAAyCC,SAA6BE,UAA4C;CACzH,QAAQD,UAAa;EACnBD,QAAQC,KAAK;EACbC,WAAWD,KAAK;CAClB;AACF;AAKA,SAASE,YAAYF,OAAoC;CACvD,IAAIA,UAAUG,KAAAA,GACZ;CAEF,OAAOH,MAAMI,SAASC,MAAKd,YAAWA,QAAQe,KAAKC,SAAS,CAAC;AAC/D;AAKA,SAASC,aAAalB,aAA6C;CACjE,QAAQC,YAA0B,oBAAC,OAAD;EAAU,GAAIlC,MAAaW,WAAW0C,MAAMrC,MAAMsC,MAAM3C,WAAW4C,YAAYlC,OAAOC,KAAK;EACxHZ,UAAAA,UAAUuB,gBAAgBa,KAAAA,IAAYZ,QAAQe,OAAOhB,YAAYC,OAAO,CAAC;CA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;GAAiB,UAAAa;GAAsC,GAAMC;GAAnF,UAAA,CACHa,KAgBAC,GAjBiB;;EAkBHvB,EAAA,MAAAO;EAAAP,EAAA,MAAAL;EAAAK,EAAA,MAAAsB;EAAAtB,EAAA,MAAAuB;EAAAvB,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;EAAAT,EAAA,MAAAwB;CAAA,OAAAA,MAAAxB,EAAA;CAAA,OAlBXwB;AAkBW"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","TokenFieldProps","RACTokenFieldProps","TokenInputProps","RACTokenInputProps","TokenRenderProps","stylex","useState","Token","RACToken","TokenField","RACTokenField","TokenInput","RACTokenInput","TokenFieldValue","FieldVariant","chipLabel","chipStyles","FieldBox","FieldMessage","fieldStyles","invalidFrom","focus","mergeStatefulStyles","colors","typography","TOKEN_LINE","styles","token","kXLuUW","$$css","className","T","description","error","floatingLabel","label","leadingIcon","renderToken","segment","TokenSegment","style","trailingIcon","variant","Omit","Parameters","changeHandler","setHeld","value","onChange","isPopulated","undefined","segments","some","text","length","tokenClassName","isSelected","props","base","ring","selected","unselected","tokenContent","t0","$","_c","t1","t2","held","defaultValue","populated","T0","t3","t4","root","t5","isDisabled","t6","t7","Symbol","for","0","1","t8","t9","t10","t11","t12","t13"],"sources":["../../../src/components/token-field/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { TokenFieldProps as RACTokenFieldProps, TokenInputProps as RACTokenInputProps, TokenRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useState } from 'react';\nimport { Token as RACToken, TokenField as RACTokenField, TokenInput as RACTokenInput, TokenFieldValue } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { chipLabel } from '../../chip';\nimport { chipStyles } from '../../chip/styles';\nimport { FieldBox, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom } from '../../field/root';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\n\n// The chips page's input chips inside a text field: a field whose value is\n// text with pills in it — a tag input, a mention field, a structured search\n// box. The box, label, supporting line and error are the field chrome in\n// `src/field`, shared with every other field; the pill is the chip module's\n// in `src/chip`, shared with Chip and ChipGroup. What is here is React Aria's\n// `TokenField` around them.\n//\n// The value is React Aria's `TokenFieldValue`, a list of text and token\n// segments rather than a string, and this component does not wrap it. What\n// counts as a token is the whole question a token field exists to answer — a\n// hash tag, an @ mention, a chosen contact — and a wrapper would be a second\n// place to decide it. The class is re-exported from the package so a call\n// site can subclass it and override `tokenize`.\n//\n// Three things are worth knowing.\n//\n// **The editable area is not an input.** React Aria draws a contenteditable\n// element, since a token cannot live inside an `<input>`. So the box is drawn\n// `multiline` and grows with what it holds, and the chrome is told whether it\n// is populated rather than reading an input's value — a token field is the\n// third control the chrome cannot ask, after a select and a picker.\n//\n// **The box's whole height is the editable area.** A press anywhere in the\n// box has to put the caret in the text, so the box is not covered by a press\n// target the way Select's is; React Aria's own element fills the control's\n// place and takes the press.\n//\n// **A token is drawn by the call site, or by this.** `renderToken` takes a\n// segment and returns what the pill holds; without it the pill holds the\n// segment's own text. Either way the pill is the page's, so a token here and\n// a chip elsewhere cannot drift.\n\n// A token's pill is 32dp tall inside a body line of 24, so the control's\n// line makes room for it or the pills overlap once the value wraps. Stated\n// once because the control's floor and its line have to agree, and the\n// clearance under the label is measured from it.\nconst TOKEN_LINE = '32px';\nconst styles = {\n token: {\n kXLuUW: \"xxymvpz\",\n $$css: true\n }\n};\ntype TokenFieldProps<T extends TokenFieldValue = TokenFieldValue> = {\n /** A function may compute the class from the field's render state. */\n className?: RACTokenFieldProps<T>['className'];\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message and the red underline both\n * follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or holds something. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a field with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. An icon drawn in `em` takes\n * that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * What each token holds. Given a segment, return what to draw inside its\n * pill; without it the pill holds the segment's own text.\n */\n renderToken?: (segment: TokenSegment) => ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACTokenFieldProps<T>['style'];\n /**\n * An icon at the end of the box, after the value: the page's 24dp trailing\n * icon, in the muted role and the error role once the field has an error.\n * An icon drawn in `em` takes that size from the slot.\n */\n trailingIcon?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACTokenFieldProps<T>, 'children' | 'className' | 'style'>;\n\n// One token, as React Aria hands it to the editable area's render function.\n// Taken from that prop rather than imported, since the type lives in\n// `react-stately`, which this package does not depend on directly.\ntype TokenSegment = Parameters<RACTokenInputProps['children']>[0];\n\n// Keeps the mirrored copy in step and then hands the change on to the call\n// site. Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its input.\nfunction changeHandler<T extends TokenFieldValue>(setHeld: (value: T) => void, onChange: ((value: T) => void) | undefined) {\n return (value: T) => {\n setHeld(value);\n onChange?.(value);\n };\n}\n\n// Whether the field holds anything, for the floating label. A token field's\n// editable area is a contenteditable element rather than an input, so the\n// chrome cannot read a value off it and is told instead.\nfunction isPopulated(value: TokenFieldValue | undefined) {\n if (value === undefined) {\n return undefined;\n }\n return value.segments.some(segment => segment.text.length > 0);\n}\n\n// What each token draws. Built by a call rather than written inline at the\n// prop, which is what react-perf's no-new-function-as-prop is after; the\n// React Compiler memoises the result on its input.\n// A token is the chip it looks like: unselected at rest, and the selected\n// chip — Material's selected input chip — once the selection covers it. A\n// click selects the whole token, since React Aria gives it\n// `user-select: all`, and so does the keyboard's selection running across\n// it; either way it is the token Backspace removes next, and this is what\n// says so.\nfunction tokenClassName({\n isSelected\n}: TokenRenderProps) {\n return stylex.props(chipStyles.base, focus.ring, isSelected ? chipStyles.selected : chipStyles.unselected, styles.token).className ?? '';\n}\nfunction tokenContent(renderToken: TokenFieldProps['renderToken']) {\n return (segment: TokenSegment) => <RACToken className={tokenClassName}>\n {chipLabel(renderToken === undefined ? segment.text : renderToken(segment))}\n </RACToken>;\n}\n\n/**\n * A labelled field whose value is text with inline tokens — a tag input, a\n * mention field, a structured search box. Its value is React Aria's\n * `TokenFieldValue`: pass `value` with `onChange` to control it, or\n * `defaultValue` to let it keep its own.\n *\n * ```tsx\n * const [value, setValue] = useState(new TokenFieldValue([]))\n *\n * <TokenField label=\"Label\" onChange={setValue} value={value} />\n * ```\n *\n * What counts as a token is the call site's: subclass `TokenFieldValue` and\n * override `tokenize`, which the package re-exports for that. `renderToken`\n * decides what each pill holds; without it, the segment's own text.\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, and the pill is the chip module's, shared with Chip and\n * ChipGroup.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction TokenField<T extends TokenFieldValue = TokenFieldValue>({\n description,\n error,\n floatingLabel = true,\n label,\n leadingIcon,\n renderToken,\n trailingIcon,\n variant = 'filled',\n ...props\n}: TokenFieldProps<T>) {\n // A copy of what the field holds, kept only so the label can float from\n // it. React Aria's token field reports `isDisabled` and `isReadOnly`\n // through its render props and not its value, and it hands its state down\n // a context of its own that nothing outside the module can read — so an\n // uncontrolled field has no other way to say what it is holding now.\n //\n // This mirrors rather than controls: `defaultValue` still goes through, so\n // React Aria keeps owning the value and the editing it does with it. A\n // controlled field is read straight off the prop, which already moves.\n const [held, setHeld] = useState(props.defaultValue);\n const populated = isPopulated(props.value ?? held);\n return <RACTokenField<T> {...props} onChange={changeHandler(setHeld, props.onChange)} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `TokenField` does not, so the\n // box is told outright or its label and its underline never turn.\n isDisabled={props.isDisabled} isInvalid={invalidFrom(error)} isPopulated={populated} label={label} leading={leadingIcon} multiline trailing={trailingIcon} variant={variant}>\n <RACTokenInput<T> {...{\n 0: {\n className: \"x9f619 x139gbkf x1lliihq x16svsjw x1848etk x1c52epr xh8yej3 x1qn8t5l xcgk4ki x21xpn4 x1t137rt x126k92a\"\n },\n 1: {\n className: \"x9f619 x139gbkf x1lliihq x16svsjw x1848etk x1c52epr xh8yej3 x1qn8t5l xcgk4ki x1t137rt x126k92a xhm3zzy xczxdwi\"\n }\n }[!!(variant === 'filled') << 0]}>\n {tokenContent(renderToken)}\n </RACTokenInput>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACTokenField>;\n}\nexport type { TokenFieldProps, TokenSegment };\nexport default TokenField;"],"mappings":";;;;;;;;;;;;AAoDA,MAAM2B,SAAS,EACbC,OAAO;CACLC,QAAQ;CACRC,OAAO;AACT,EACF;AAkEA,SAASgB,cAAyCC,SAA6BE,UAA4C;CACzH,QAAQD,UAAa;EACnBD,QAAQC,KAAK;EACbC,WAAWD,KAAK;CAClB;AACF;AAKA,SAASE,YAAYF,OAAoC;CACvD,IAAIA,UAAUG,KAAAA,GACZ;CAEF,OAAOH,MAAMI,SAASC,MAAKd,YAAWA,QAAQe,KAAKC,SAAS,CAAC;AAC/D;AAWA,SAASC,eAAe,EACtBC,cACmB;CACnB,OAAOnD,MAAaW,WAAW0C,MAAMrC,MAAMsC,MAAMH,aAAaxC,WAAW4C,WAAW5C,WAAW6C,YAAYnC,OAAOC,KAAK,CAAC,CAACG,aAAa;AACxI;AACA,SAASgC,aAAazB,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AP,EAAA,QAAAP,WAAAO,EAAA,QAAAsB,OAAAtB,EAAA,QAAAuB,OAAAvB,EAAA,QAAAQ,MAAAR,EAAA,QAAAS,IAAA;EAjBrDe,MAAA,qBAAC,IAAD;GAAc,GAAQ/B;GAAiB,UAAAe;GAAsC,GAAMC;GAAnF,UAAA,CACHa,KAgBAC,GAjBiB;;EAkBHvB,EAAA,MAAAO;EAAAP,EAAA,MAAAP;EAAAO,EAAA,MAAAsB;EAAAtB,EAAA,MAAAuB;EAAAvB,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;EAAAT,EAAA,MAAAwB;CAAA,OAAAA,MAAAxB,EAAA;CAAA,OAlBXwB;AAkBW"}
|
|
@@ -100,7 +100,7 @@ declare namespace Tree$1 {
|
|
|
100
100
|
* leaf and draws no caret. `textValue` is what typeahead matches on, and is
|
|
101
101
|
* taken from a plain-string headline when it is not given.
|
|
102
102
|
*/
|
|
103
|
-
declare function TreeItem$1<T extends object = object>({ children, headline, leading, supporting, textValue, trailing, ...props }: TreeItemProps$1<T>): import("react").JSX.Element;
|
|
103
|
+
declare function TreeItem$1<T extends object = object>({ children, headline, leading, onContextMenu, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, supporting, textValue, trailing, ...props }: TreeItemProps$1<T>): import("react").JSX.Element;
|
|
104
104
|
/**
|
|
105
105
|
* The row the tree shows while it is fetching more. React Aria calls
|
|
106
106
|
* `onLoadMore` when this comes into view, and draws it only while
|