@kanso-labs/kanso-ui 0.26.6 → 0.28.0
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/styles.js +12 -2
- package/dist/collection/styles.js.map +1 -1
- package/dist/components/app-bar/index.d.ts +13 -1
- package/dist/components/app-bar/index.js +82 -68
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +1 -1
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/color-field/index.d.ts +2 -1
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/color-picker/index.d.ts +9 -1
- package/dist/components/color-picker/index.js +84 -73
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +3 -2
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +12 -3
- package/dist/components/date-picker/index.js +31 -23
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +12 -3
- package/dist/components/date-range-picker/index.js +31 -23
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/form/index.d.ts +13 -2
- package/dist/components/form/index.js +4 -0
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/index.d.ts +26 -25
- package/dist/components/list/index.d.ts +23 -17
- package/dist/components/list/index.js +27 -25
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +8 -2
- package/dist/components/list-box/index.js +56 -50
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/list-detail/index.d.ts +14 -0
- package/dist/components/list-detail/index.js +5 -0
- package/dist/components/list-detail/index.js.map +1 -1
- package/dist/components/list-item/index.d.ts +1 -1
- package/dist/components/list-item/index.js +50 -31
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +1 -1
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +6 -0
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +1 -1
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +10 -3
- package/dist/components/snackbar/index.js +58 -49
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/text/index.d.ts +7 -2
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/time-field/index.d.ts +3 -2
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +1 -1
- package/dist/components/tree/index.js +1 -1
- package/dist/components/tree/index.js.map +1 -1
- package/dist/field/root.js +9 -0
- package/dist/field/root.js.map +1 -1
- package/dist/index.d.ts +26 -25
- package/dist/styles.css +30 -32
- package/package.json +3 -3
|
@@ -40,8 +40,8 @@ import { Button, DateInput, DateRangePicker, Dialog, Group, Popover } from "reac
|
|
|
40
40
|
* which is the element a layout positions.
|
|
41
41
|
*/
|
|
42
42
|
function DateRangePicker$1(t0) {
|
|
43
|
-
const $ = c(
|
|
44
|
-
const { description, error, floatingLabel: t1, isDisabled: t2, label, leadingIcon, separator: t3, triggerLabel: t4, variant: t5, ...props$1 } = t0;
|
|
43
|
+
const $ = c(39);
|
|
44
|
+
const { container, description, error, floatingLabel: t1, isDisabled: t2, label, leadingIcon, separator: t3, triggerLabel: t4, variant: t5, ...props$1 } = t0;
|
|
45
45
|
const floatingLabel = t1 === void 0 ? true : t1;
|
|
46
46
|
const isDisabled = t2 === void 0 ? false : t2;
|
|
47
47
|
const separator = t3 === void 0 ? "–" : t3;
|
|
@@ -158,19 +158,27 @@ function DateRangePicker$1(t0) {
|
|
|
158
158
|
} else t18 = $[23];
|
|
159
159
|
let t19;
|
|
160
160
|
if ($[24] !== label) {
|
|
161
|
-
t19 = /* @__PURE__ */ jsx(
|
|
162
|
-
...
|
|
163
|
-
children: /* @__PURE__ */ jsx(
|
|
164
|
-
...t18,
|
|
165
|
-
children: /* @__PURE__ */ jsx(RangeCalendar$1, { "aria-label": label })
|
|
166
|
-
})
|
|
161
|
+
t19 = /* @__PURE__ */ jsx(Dialog, {
|
|
162
|
+
...t18,
|
|
163
|
+
children: /* @__PURE__ */ jsx(RangeCalendar$1, { "aria-label": label })
|
|
167
164
|
});
|
|
168
165
|
$[24] = label;
|
|
169
166
|
$[25] = t19;
|
|
170
167
|
} else t19 = $[25];
|
|
171
168
|
let t20;
|
|
172
|
-
if ($[26] !==
|
|
173
|
-
t20 = /* @__PURE__ */
|
|
169
|
+
if ($[26] !== container || $[27] !== t19) {
|
|
170
|
+
t20 = /* @__PURE__ */ jsx(Popover, {
|
|
171
|
+
UNSTABLE_portalContainer: container,
|
|
172
|
+
...t17,
|
|
173
|
+
children: t19
|
|
174
|
+
});
|
|
175
|
+
$[26] = container;
|
|
176
|
+
$[27] = t19;
|
|
177
|
+
$[28] = t20;
|
|
178
|
+
} else t20 = $[28];
|
|
179
|
+
let t21;
|
|
180
|
+
if ($[29] !== T0 || $[30] !== isDisabled || $[31] !== props$1 || $[32] !== t15 || $[33] !== t16 || $[34] !== t20 || $[35] !== t6 || $[36] !== t7 || $[37] !== validationBehavior) {
|
|
181
|
+
t21 = /* @__PURE__ */ jsxs(T0, {
|
|
174
182
|
isDisabled,
|
|
175
183
|
isInvalid: t6,
|
|
176
184
|
validationBehavior,
|
|
@@ -179,21 +187,21 @@ function DateRangePicker$1(t0) {
|
|
|
179
187
|
children: [
|
|
180
188
|
t15,
|
|
181
189
|
t16,
|
|
182
|
-
|
|
190
|
+
t20
|
|
183
191
|
]
|
|
184
192
|
});
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
} else
|
|
196
|
-
return
|
|
193
|
+
$[29] = T0;
|
|
194
|
+
$[30] = isDisabled;
|
|
195
|
+
$[31] = props$1;
|
|
196
|
+
$[32] = t15;
|
|
197
|
+
$[33] = t16;
|
|
198
|
+
$[34] = t20;
|
|
199
|
+
$[35] = t6;
|
|
200
|
+
$[36] = t7;
|
|
201
|
+
$[37] = validationBehavior;
|
|
202
|
+
$[38] = t21;
|
|
203
|
+
} else t21 = $[38];
|
|
204
|
+
return t21;
|
|
197
205
|
}
|
|
198
206
|
//#endregion
|
|
199
207
|
export { DateRangePicker$1 as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","DateValue","DateRangePickerProps","RACDateRangePickerProps","stylex","Button","RACButton","DateInput","RACDateInput","DateRangePicker","RACDateRangePicker","Dialog","RACDialog","Group","RACGroup","Popover","RACPopover","FieldBox","FieldMessage","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","CalendarGlyph","renderSegment","segmentStyles","focus","mergeStatefulStyles","overlay","picker","triggerClassName","colors","typography","RangeCalendar","className","T","description","error","floatingLabel","label","leadingIcon","separator","style","triggerLabel","variant","Omit","t0","$","_c","t1","isDisabled","t2","t3","t4","t5","props","undefined","validationBehavior","T0","t6","t7","root","t8","Symbol","for","group","t9","input","t10","t11","t12","triggerGlyph","t13","t14","t15","t16","t17","popup","popover","t18","popupDialog","ring","t19","t20"],"sources":["../../../src/components/date-range-picker/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { DateValue, DateRangePickerProps as RACDateRangePickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, DateInput as RACDateInput, DateRangePicker as RACDateRangePicker, Dialog as RACDialog, Group as RACGroup, Popover as RACPopover } from 'react-aria-components';\nimport { FieldBox, FieldMessage, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CalendarGlyph } from '../../glyphs';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport { picker, triggerClassName } from '../../styles/picker';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\nimport RangeCalendar from '../range-calendar';\n\n// `DatePicker` picking two dates rather than one. Every part it draws is\n// already here — the segments from `src/segments`, the trigger and the\n// overlay from `src/styles/picker`, the calendar from `RangeCalendar` — so\n// the two pickers cannot come apart. What a range adds is a second segment\n// group and the dash between them.\n//\n// The date pickers page draws a range as a configuration of the *modal*\n// picker: a full-screen selector with a header and two text fields, plus a\n// modal date input variant. It carries no docked range picker and no range\n// token of its own — its token set is `docked.*` and `modal.*`, and neither\n// names a range. So the docked shape here follows the docked single picker,\n// the same choice `RangeCalendar` records for the band it draws.\n//\n// Two things are this component's own.\n//\n// **The dash is decoration, not content.** It reads as a range to someone\n// looking, and React Aria has already told a screen reader which group is\n// which — every segment is named \"Start Date\" or \"End Date\" — so repeating\n// it aloud would be a third telling. It is `aria-hidden` and takes the muted\n// role, which is what keeps it quieter than the dates either side.\n//\n// **Both segment groups and the trigger sit in one React Aria `Group`.** The\n// box draws once around all three, so a reader tabs start, end, trigger\n// rather than meeting three controls in a row.\n\ntype DateRangePickerProps<T extends DateValue> = {\n /** A function may compute the class from the picker's render state. */\n className?: RACDateRangePickerProps<T>['className'];\n /** Supporting text under the field. */\n description?: string;\n /** The message shown instead of the description, which also marks the field invalid. */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /** An icon at the box's leading end. */\n leadingIcon?: ReactNode;\n /**\n * What is drawn between the two segment groups. Decoration — a screen\n * reader is told which group is which by React Aria.\n * @default '–'\n */\n separator?: string;\n /** A function may compute the style from the picker's render state. */\n style?: RACDateRangePickerProps<T>['style'];\n /**\n * What the button that opens the calendar is called, for a screen reader.\n * @default 'Choose a date range'\n */\n triggerLabel?: string;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: 'filled' | 'outlined';\n} & Omit<RACDateRangePickerProps<T>, 'children' | 'className' | 'style'>;\n\n/**\n * A date range typed into a field, or picked from a calendar behind a\n * button. The value is React Aria's — pass `value` with `onChange` to\n * control it, or `defaultValue` — as a `{ start, end }` pair of\n * `@internationalized/date` values from this package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <DateRangePicker\n * defaultValue={{\n * end: new CalendarDate(2026, 9, 20),\n * start: new CalendarDate(2026, 9, 15),\n * }}\n * label=\"Label\"\n * />\n * ```\n *\n * The segments are `DateField`'s and the calendar is `RangeCalendar`, so\n * `granularity`, `minValue`, `maxValue` and `isDateUnavailable` all behave\n * as they do there. Above the medium breakpoint the calendar is docked to\n * the field; below it, it opens centred, the same swap `DatePicker` makes.\n *\n * The call site's `className` and `style` land on the picker as a whole,\n * which is the element a layout positions.\n */\nfunction DateRangePicker<T extends DateValue>({\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n separator = '–',\n triggerLabel = 'Choose a date range',\n variant = 'filled',\n ...props\n}: DateRangePickerProps<T>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACDateRangePicker<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // Always populated, which buys exactly one thing: the outlined\n // notch. The box decides populated twice over — in CSS for the\n // label's type, and in React for the notch, since CSS cannot cut an\n // outline to a width it has no way to measure. React Aria renders a\n // hidden input per segment group, neither carrying a placeholder, so\n // the CSS half reads as populated on its own; the React half reads\n // React Aria's input context, which a picker does not provide.\n // Without this the notch stays shut across segments already showing\n // `mm/dd/yyyy`.\n isPopulated label={label} leading={leadingIcon} variant={variant}>\n <FieldValue>\n <RACGroup {...stylex.props(picker.group)}>\n <RACDateInput slot=\"start\" {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n <span aria-hidden=\"true\" className=\"x1w5n3ug x2lah0s x16svsjw x1848etk xh7dzej\">\n {separator}\n </span>\n <RACDateInput slot=\"end\" {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n <RACButton aria-label={triggerLabel} className={triggerClassName}>\n <CalendarGlyph {...stylex.props(picker.triggerGlyph)} />\n </RACButton>\n </RACGroup>\n </FieldValue>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover {...stylex.props(overlay.popup, picker.popover)}>\n <RACDialog {...stylex.props(overlay.popupDialog, focus.ring)}>\n <RangeCalendar aria-label={label} />\n </RACDialog>\n </RACPopover>\n </RACDateRangePicker>;\n}\nexport type { DateRangePickerProps };\nexport default DateRangePicker;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,SAAAS,kBAAAqC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAA8C,MAAA,EAAAZ,aAAAC,OAAAC,eAAAW,IAAAC,YAAAC,IAAAZ,OAAAC,aAAAC,WAAAW,IAAAT,cAAAU,IAAAT,SAAAU,IAAA,GAAAC,YAAAT;CAG5C,MAAAR,gBAAAW,OAAAO,KAAAA,IAAA,OAAAP;CACA,MAAAC,aAAAC,OAAAK,KAAAA,IAAA,QAAAL;CAGA,MAAAV,YAAAW,OAAAI,KAAAA,IAAA,MAAAJ;CACA,MAAAT,eAAAU,OAAAG,KAAAA,IAAA,wBAAAH;CACA,MAAAT,UAAAU,OAAAE,KAAAA,IAAA,WAAAF;CAGA,MAAAG,qBAA2BnC,2BAA2B;CAC9C,MAAAoC,KAAAhD;CAAkB,IAAAiD;CAAA,IAAAZ,EAAA,OAAAV,OAAA;EAAuCsB,KAAAtC,YAAYgB,KAAK;EAACU,EAAA,KAAAV;EAAAU,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAyD,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AActD,MAAKuD,IAAK;EAAClC,EAAA,MAAAgC;CAAA,OAAAA,MAAAhC,EAAA;CAAA,IAAAmC;CAAA,IAAAnC,EAAA,QAAAR,OAAA;EAD9D2C,MAAA,oBAAC,SAAD;GAAW,GAAKN;GACd,UAAA,oBAAC,QAAD;IAAU,GAAKG;IACb,UAAA,oBAAC,iBAAD,EAA2BxC,cAAAA,MAAK,CAAA;GADxB,CAAA;EADD,CAAA;EAIEQ,EAAA,MAAAR;EAAAQ,EAAA,MAAAmC;CAAA,OAAAA,MAAAnC,EAAA;CAAA,IAAAoC;CAAA,IAAApC,EAAA,QAAAW,MAAAX,EAAA,QAAAG,cAAAH,EAAA,QAAAQ,WAAAR,EAAA,QAAA2B,OAAA3B,EAAA,QAAA4B,OAAA5B,EAAA,QAAAmC,OAAAnC,EAAA,QAAAY,MAAAZ,EAAA,QAAAa,MAAAb,EAAA,QAAAU,oBAAA;EAlCV0B,MAAA,qBAAC,IAAD;GAAmCjC;GAAuB,WAAAS;GAAwCF;GAAkB,GAAMF;GAAK,GAAMK;GAArI,UAAA;IACHc;IA4BAC;IACAO;GA9BsB;;EAmCHnC,EAAA,MAAAW;EAAAX,EAAA,MAAAG;EAAAH,EAAA,MAAAQ;EAAAR,EAAA,MAAA2B;EAAA3B,EAAA,MAAA4B;EAAA5B,EAAA,MAAAmC;EAAAnC,EAAA,MAAAY;EAAAZ,EAAA,MAAAa;EAAAb,EAAA,MAAAU;EAAAV,EAAA,MAAAoC;CAAA,OAAAA,MAAApC,EAAA;CAAA,OAnChBoC;AAmCgB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","DateValue","DateRangePickerProps","RACDateRangePickerProps","stylex","Button","RACButton","DateInput","RACDateInput","DateRangePicker","RACDateRangePicker","Dialog","RACDialog","Group","RACGroup","Popover","RACPopover","FieldVariant","FieldBox","FieldMessage","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","CalendarGlyph","renderSegment","segmentStyles","focus","mergeStatefulStyles","overlay","picker","triggerClassName","colors","typography","RangeCalendar","className","T","container","Element","description","error","floatingLabel","label","leadingIcon","separator","style","triggerLabel","variant","Omit","t0","$","_c","t1","isDisabled","t2","t3","t4","t5","props","undefined","validationBehavior","T0","t6","t7","root","t8","Symbol","for","group","t9","input","t10","t11","t12","triggerGlyph","t13","t14","t15","t16","t17","popup","popover","t18","popupDialog","ring","t19","t20","t21"],"sources":["../../../src/components/date-range-picker/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { DateValue, DateRangePickerProps as RACDateRangePickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, DateInput as RACDateInput, DateRangePicker as RACDateRangePicker, Dialog as RACDialog, Group as RACGroup, Popover as RACPopover } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CalendarGlyph } from '../../glyphs';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport { picker, triggerClassName } from '../../styles/picker';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\nimport RangeCalendar from '../range-calendar';\n\n// `DatePicker` picking two dates rather than one. Every part it draws is\n// already here — the segments from `src/segments`, the trigger and the\n// overlay from `src/styles/picker`, the calendar from `RangeCalendar` — so\n// the two pickers cannot come apart. What a range adds is a second segment\n// group and the dash between them.\n//\n// The date pickers page draws a range as a configuration of the *modal*\n// picker: a full-screen selector with a header and two text fields, plus a\n// modal date input variant. It carries no docked range picker and no range\n// token of its own — its token set is `docked.*` and `modal.*`, and neither\n// names a range. So the docked shape here follows the docked single picker,\n// the same choice `RangeCalendar` records for the band it draws.\n//\n// Two things are this component's own.\n//\n// **The dash is decoration, not content.** It reads as a range to someone\n// looking, and React Aria has already told a screen reader which group is\n// which — every segment is named \"Start Date\" or \"End Date\" — so repeating\n// it aloud would be a third telling. It is `aria-hidden` and takes the muted\n// role, which is what keeps it quieter than the dates either side.\n//\n// **Both segment groups and the trigger sit in one React Aria `Group`.** The\n// box draws once around all three, so a reader tabs start, end, trigger\n// rather than meeting three controls in a row.\n\ntype DateRangePickerProps<T extends DateValue = DateValue> = {\n /** A function may compute the class from the picker's render state. */\n className?: RACDateRangePickerProps<T>['className'];\n /**\n * Where to portal the calendar. Defaults to the end of `<body>`, which is\n * right for an app that sets its StyleX theme on `:root`. An app that\n * scopes the theme to a subtree has to point this at an element inside it,\n * or the calendar renders outside the theme and falls back to the tokens'\n * `prefers-color-scheme` default.\n */\n container?: Element;\n /** Supporting text under the field. */\n description?: string;\n /** The message shown instead of the description, which also marks the field invalid. */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /** An icon at the box's leading end. */\n leadingIcon?: ReactNode;\n /**\n * What is drawn between the two segment groups. Decoration — a screen\n * reader is told which group is which by React Aria.\n * @default '–'\n */\n separator?: string;\n /** A function may compute the style from the picker's render state. */\n style?: RACDateRangePickerProps<T>['style'];\n /**\n * What the button that opens the calendar is called, for a screen reader.\n * @default 'Choose a date range'\n */\n triggerLabel?: string;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACDateRangePickerProps<T>, 'children' | 'className' | 'style'>;\n\n/**\n * A date range typed into a field, or picked from a calendar behind a\n * button. The value is React Aria's — pass `value` with `onChange` to\n * control it, or `defaultValue` — as a `{ start, end }` pair of\n * `@internationalized/date` values from this package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <DateRangePicker\n * defaultValue={{\n * end: new CalendarDate(2026, 9, 20),\n * start: new CalendarDate(2026, 9, 15),\n * }}\n * label=\"Label\"\n * />\n * ```\n *\n * The segments are `DateField`'s and the calendar is `RangeCalendar`, so\n * `granularity`, `minValue`, `maxValue` and `isDateUnavailable` all behave\n * as they do there. Above the medium breakpoint the calendar is docked to\n * the field; below it, it opens centred, the same swap `DatePicker` makes.\n *\n * The call site's `className` and `style` land on the picker as a whole,\n * which is the element a layout positions.\n */\nfunction DateRangePicker<T extends DateValue>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n separator = '–',\n triggerLabel = 'Choose a date range',\n variant = 'filled',\n ...props\n}: DateRangePickerProps<T>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACDateRangePicker<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // Always populated, which buys exactly one thing: the outlined\n // notch. The box decides populated twice over — in CSS for the\n // label's type, and in React for the notch, since CSS cannot cut an\n // outline to a width it has no way to measure. React Aria renders a\n // hidden input per segment group, neither carrying a placeholder, so\n // the CSS half reads as populated on its own; the React half reads\n // React Aria's input context, which a picker does not provide.\n // Without this the notch stays shut across segments already showing\n // `mm/dd/yyyy`.\n isPopulated label={label} leading={leadingIcon} variant={variant}>\n <FieldValue>\n <RACGroup {...stylex.props(picker.group)}>\n <RACDateInput slot=\"start\" {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n <span aria-hidden=\"true\" className=\"x1w5n3ug x2lah0s x16svsjw x1848etk xh7dzej\">\n {separator}\n </span>\n <RACDateInput slot=\"end\" {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n <RACButton aria-label={triggerLabel} className={triggerClassName}>\n <CalendarGlyph {...stylex.props(picker.triggerGlyph)} />\n </RACButton>\n </RACGroup>\n </FieldValue>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...stylex.props(overlay.popup, picker.popover)}>\n <RACDialog {...stylex.props(overlay.popupDialog, focus.ring)}>\n <RangeCalendar aria-label={label} />\n </RACDialog>\n </RACPopover>\n </RACDateRangePicker>;\n}\nexport type { DateRangePickerProps };\nexport default DateRangePicker;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,SAAAS,kBAAAwC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAA8C,MAAA,EAAAd,WAAAE,aAAAC,OAAAC,eAAAW,IAAAC,YAAAC,IAAAZ,OAAAC,aAAAC,WAAAW,IAAAT,cAAAU,IAAAT,SAAAU,IAAA,GAAAC,YAAAT;CAI5C,MAAAR,gBAAAW,OAAAO,KAAAA,IAAA,OAAAP;CACA,MAAAC,aAAAC,OAAAK,KAAAA,IAAA,QAAAL;CAGA,MAAAV,YAAAW,OAAAI,KAAAA,IAAA,MAAAJ;CACA,MAAAT,eAAAU,OAAAG,KAAAA,IAAA,wBAAAH;CACA,MAAAT,UAAAU,OAAAE,KAAAA,IAAA,WAAAF;CAGA,MAAAG,qBAA2BrC,2BAA2B;CAC9C,MAAAsC,KAAAnD;CAAkB,IAAAoD;CAAA,IAAAZ,EAAA,OAAAV,OAAA;EAAuCsB,KAAAxC,YAAYkB,KAAK;EAACU,EAAA,KAAAV;EAAAU,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAyD,MAAAa,KAAAnC,oBAAoBxB,MAAaiB,YAAW2C,IAAK,GAAGN,OAAK;CAAC,IAAAO;CAAA,IAAAf,EAAA,OAAAgB,OAAAC,IAAA,2BAAA,GAAA;EAahLF,KAAA7D,MAAa0B,OAAMsC,KAAM;EAAClB,EAAA,KAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,IAAAmB;CAAA,IAAAnB,EAAA,OAAAgB,O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AA,MAAAmC;CAAA,OAAAA,MAAAnC,EAAA;CAAA,IAAAoC;CAAA,IAAApC,EAAA,QAAAb,aAAAa,EAAA,QAAAmC,KAAA;EALdC,MAAA,oBAAC,SAAD;GAEwBjD,0BAAAA;GAAS,GAAM0C;GACrCM,UAAAA;EAHS,CAAA;EAMEnC,EAAA,MAAAb;EAAAa,EAAA,MAAAmC;EAAAnC,EAAA,MAAAoC;CAAA,OAAAA,MAAApC,EAAA;CAAA,IAAAqC;CAAA,IAAArC,EAAA,QAAAW,MAAAX,EAAA,QAAAG,cAAAH,EAAA,QAAAQ,WAAAR,EAAA,QAAA2B,OAAA3B,EAAA,QAAA4B,OAAA5B,EAAA,QAAAoC,OAAApC,EAAA,QAAAY,MAAAZ,EAAA,QAAAa,MAAAb,EAAA,QAAAU,oBAAA;EApCV2B,MAAA,qBAAC,IAAD;GAAmClC;GAAuB,WAAAS;GAAwCF;GAAkB,GAAMF;GAAK,GAAMK;GAArI,UAAA;IACHc;IA4BAC;IACAQ;GA9BsB;;EAqCHpC,EAAA,MAAAW;EAAAX,EAAA,MAAAG;EAAAH,EAAA,MAAAQ;EAAAR,EAAA,MAAA2B;EAAA3B,EAAA,MAAA4B;EAAA5B,EAAA,MAAAoC;EAAApC,EAAA,MAAAY;EAAAZ,EAAA,MAAAa;EAAAb,EAAA,MAAAU;EAAAV,EAAA,MAAAqC;CAAA,OAAAA,MAAArC,EAAA;CAAA,OArChBqC;AAqCgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","DisclosurePanelProps","RACDisclosurePanelProps","DisclosureProps","RACDisclosureProps","stylex","useContext","DisclosureStateContext","Button","RACButton","Disclosure","RACDisclosure","DisclosurePanel","RACDisclosurePanel","Heading","RACHeading","ChevronEndGlyph","RowContent","rowStyles","mergeStatefulStyles","colors","motion","spacing","styles","header","kzqmXN","k9WMMc","$$css","DisclosureHeaderProps","children","headingLevel","leading","supporting","Omit","className","style","chevronFor","isExpanded","t0","$","_c","T0","t1","t2","t3","props","DisclosureHeader","undefined","state","headerClassName","t4","headerContent","t5","t6","Symbol","for","0","1","isDisabled","base","list","interactive","twoLine","disabled","Header","Panel"],"sources":["../../../src/components/disclosure/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { DisclosureStateContext, Button as RACButton, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, Heading as RACHeading } from 'react-aria-components';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, spacing } from '../../tokens/design.tokens.stylex';\n\n// A section that opens to show what is under it, and closes again. The\n// header is the row every list here draws — `src/row`, shared with ListItem,\n// ListBox and List — so its 56dp floor, body-large headline, body-medium\n// supporting line and state layers are that module's, and a header sitting\n// above a list cannot drift from the rows below it.\n//\n// The lists page gives the expand interaction its own token set, which its\n// widget keeps behind a menu that does not open to a script. What the page\n// states in words covers the row, which is what the shared module already\n// carries; the chevron's size and the panel's inset below are the library's\n// own, taken from the row's own trailing slot and inline padding rather than\n// invented.\n//\n// Three things are this component's own.\n//\n// **The header is a heading with a button in it.** React Aria wants both —\n// the heading is what a screen reader jumps between, and the button is what\n// opens the section — so `Disclosure.Header` renders the pair rather than\n// leaving a call site to remember. `headingLevel` says where in the page's\n// outline it sits.\n//\n// **The panel opens to its own height, without one being measured.** A grid\n// whose single row goes from `0fr` to `1fr` interpolates between nothing and\n// the content's natural height, so no height is read from the DOM and no\n// number is written down. Under `prefers-reduced-motion` the row snaps\n// instead.\n//\n// **Only the opening animates, and that is React Aria's doing rather than a\n// choice here.** It marks the collapsed panel `hidden=\"until-found\"`, so on\n// the way closed the content stops being laid out at once and the track has\n// nothing left to shrink. Worth knowing before reaching for a closing\n// animation: it needs the panel kept in the layout, which would cost the\n// find-in-page behaviour that attribute buys.\n\nconst styles = {\n header: {\n kzqmXN: \"xh8yej3\",\n k9WMMc: \"x1yc453h\",\n $$css: true\n }\n};\ntype DisclosureHeaderProps = {\n /** The header's headline — what the section is about. */\n children?: ReactNode;\n /**\n * Where the header sits in the page's outline. React Aria renders the\n * trigger inside a heading, and a screen reader moves between them.\n * @default 3\n */\n headingLevel?: number;\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n};\ntype DisclosurePanelProps = Omit<RACDisclosurePanelProps, 'className' | 'style'> & {\n /** A function may compute the class from the panel's render state. */\n className?: RACDisclosurePanelProps['className'];\n /** A function may compute the style from the panel's render state. */\n style?: RACDisclosurePanelProps['style'];\n};\ntype DisclosureProps = Omit<RACDisclosureProps, 'children'> & {\n /** A `Disclosure.Header` and a `Disclosure.Panel`. */\n children?: ReactNode;\n};\n\n// The chevron, turned or not. A call rather than JSX written at the prop,\n// which is what react-perf's jsx-no-jsx-as-prop is after; the React Compiler\n// memoises the result on `isExpanded`.\nfunction chevronFor(isExpanded: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"xxk0z11 x1w5n3ug x2lah0s xvy4d1p x19axjrm x1c071of xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"xxk0z11 x1w5n3ug x2lah0s xvy4d1p xkzkux9 x11xpdln xpc4ca7 x1y10d4b x1iffjtl\"\n }\n }[!!isExpanded << 0]} />;\n}\n\n/**\n * A section that opens to show what is under it. Whether it is open is React\n * Aria's: pass `isExpanded` with `onExpandedChange` to control it, or\n * `defaultExpanded` to let it keep its own.\n *\n * ```tsx\n * <Disclosure>\n * <Disclosure.Header>Headline</Disclosure.Header>\n * <Disclosure.Panel>Supporting line</Disclosure.Panel>\n * </Disclosure>\n * ```\n *\n * The header is the row every list here draws, so a section above a list of\n * rows lines up with them. The panel opens to whatever height its content\n * turns out to have, and snaps rather than sliding under\n * `prefers-reduced-motion`.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction Disclosure({\n children,\n ...props\n}: DisclosureProps) {\n return <RACDisclosure {...props} {...mergeStatefulStyles({\n className: \"x9f619 x78zum5 xdt5ytf\"\n }, props)}>\n {children}\n </RACDisclosure>;\n}\n\n/**\n * The row that opens the section. It renders the heading React Aria wants\n * around the trigger and the button inside it, and draws the shared row's\n * slots with a chevron in the trailing one.\n */\nfunction DisclosureHeader({\n children,\n headingLevel = 3,\n leading,\n supporting\n}: DisclosureHeaderProps) {\n // The chevron turns with the section, and React Aria's button render state\n // reports the press states rather than what the button controls — so\n // whether the section is open comes from the disclosure's own context.\n const state = useContext(DisclosureStateContext);\n return <RACHeading level={headingLevel} className=\"x1qlqyl8 x1pd3egz x1ghz6dp\">\n <RACButton className={headerClassName(supporting)} slot=\"trigger\">\n {headerContent(children, leading, supporting, state?.isExpanded === true)}\n </RACButton>\n </RACHeading>;\n}\n\n/**\n * What the section shows while it is open. Its content lines up with the\n * headline above it, and it takes the group role React Aria gives it —\n * `role=\"region\"` names it in the landmark list instead, for a section a\n * reader should be able to jump to.\n */\nfunction DisclosurePanel({\n children,\n ...props\n}: DisclosurePanelProps) {\n // The track has to know, and React Aria hands the render state to the panel\n // rather than to what wraps it — so the state comes from its context, the\n // same one its own panel reads.\n const state = useContext(DisclosureStateContext);\n return <div {...{\n 0: {\n className: \"x12w9bfk xrvj5dj xihq33y xjvfotl x1qn9uv2 x1seskgd\"\n },\n 1: {\n className: \"x12w9bfk xrvj5dj xjvfotl x1qn9uv2 x1seskgd x1tu4anv\"\n }\n }[!!(state?.isExpanded === true) << 0]}>\n <RACDisclosurePanel {...props} {...mergeStatefulStyles({\n className: \"x9f619 x2lwn1j xb3r6kr\"\n }, props)}>\n <div className=\"x9f619 xzfxn0k x790zyz\">{children}</div>\n </RACDisclosurePanel>\n </div>;\n}\n\n// The trigger's classes, from React Aria's render state. `isSelected` is not\n// among them — a disclosure's button reports `aria-expanded` rather than a\n// selection — so the row draws unselected throughout and only its disabled\n// state changes.\n//\n// A supporting line moves the header from the page's one-line container\n// height to its two-line one, which is a floor rather than something the\n// row's own box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as\n// an argument rather than read from the render state, since React Aria\n// reports what the trigger is doing and not what it holds; the classes are\n// built by a call for the same reason `headerContent` is.\nfunction headerClassName(supporting: ReactNode) {\n return (state: {\n isDisabled: boolean;\n }) => stylex.props(rowStyles.base, rowStyles.list, rowStyles.interactive, styles.header, supporting !== undefined && rowStyles.twoLine, state.isDisabled && rowStyles.disabled).className ?? '';\n}\n\n// What the header row draws. Built by a call rather than written inline at\n// the prop, which is what react-perf's no-new-function-as-prop is after; the\n// React Compiler memoises the result on its inputs.\nfunction headerContent(children: ReactNode, leading: ReactNode, supporting: ReactNode, isExpanded: boolean) {\n return (state: {\n isDisabled: boolean;\n }) => <RowContent isDisabled={state.isDisabled} leading={leading} supporting={supporting} trailing={chevronFor(isExpanded)}>\n {children}\n </RowContent>;\n}\nDisclosure.Header = DisclosureHeader;\nDisclosure.Panel = DisclosurePanel;\nexport type { DisclosureHeaderProps, DisclosurePanelProps, DisclosureProps };\nexport default Disclosure;"],"mappings":";;;;;;;;;;AA8CA,MAAMuB,SAAS,EACbC,QAAQ;CACNC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA6BA,SAASS,WAAWC,YAAqB;CACvC,OAAO,oBAAC,iBAAD,EAAiB,GAAI;EAC1B,GAAG,EACDH,WAAW,8EACb;EACA,GAAG,EACDA,WAAW,8EACb;CACF,EAAE,CAAC,CAACG,cAAc,GAAG,CAAA;AACvB;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAA3B,aAAA4B,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAZ;CAAA,IAAAa;CAAA,IAAAC;CAAA,IAAAJ,EAAA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Ae,CAAA;EAAAU,EAAA,KAAAV;EAAAU,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAE,MAAAF,EAAA,OAAAM,SAAAN,EAAA,OAAAK,MAAAL,EAAA,OAAAW,IAAA;EAH1DE,KAAA,oBAAC,IAAD;GAAmB,GAAKP;GAAK,GAAMD;GAGjCM,UAAAA;EAHiB,CAAA;EAIEX,EAAA,KAAAE;EAAAF,EAAA,KAAAM;EAAAN,EAAA,KAAAK;EAAAL,EAAA,KAAAW;EAAAX,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAc;CAAA,IAAAd,EAAA,OAAAI,MAAAJ,EAAA,OAAAa,IAAA;EAZlBC,KAAA,oBAAA,OAAA;GAaC,GAbQV;GAQZS,UAAAA;EAKI,CAAA;EAAAb,EAAA,KAAAI;EAAAJ,EAAA,KAAAa;EAAAb,EAAA,MAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAbDc;AAaC;AAcV,SAASJ,gBAAgBjB,YAAuB;CAC9C,QAAQgB,UAEF3C,MAAaa,UAAUyC,MAAMzC,UAAU0C,MAAM1C,UAAU2C,aAAatC,OAAOC,QAAQQ,eAAee,KAAAA,KAAa7B,UAAU4C,SAASd,MAAMU,cAAcxC,UAAU6C,QAAQ,CAAC,CAAC7B,aAAa;AAC/L;AAKA,SAASiB,cAActB,UAAqBE,SAAoBC,YAAuBK,YAAqB;CAC1G,QAAQW,UAEF,oBAAC,YAAD;EAAY,YAAYA,MAAMU;EAAqB3B;EAAqBC;EAAY,UAAUI,WAAWC,UAAU;EACpHR;CACS,CAAA;AAChB;AACAnB,aAAWsD,SAASlB;AACpBpC,aAAWuD,QAAQrD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","DisclosurePanelProps","RACDisclosurePanelProps","DisclosureProps","RACDisclosureProps","stylex","useContext","DisclosureStateContext","Button","RACButton","Disclosure","RACDisclosure","DisclosurePanel","RACDisclosurePanel","Heading","RACHeading","ChevronEndGlyph","RowContent","rowStyles","mergeStatefulStyles","colors","motion","spacing","styles","header","kzqmXN","k9WMMc","$$css","DisclosureHeaderProps","children","headingLevel","leading","supporting","Omit","className","style","chevronFor","isExpanded","t0","$","_c","T0","t1","t2","t3","props","DisclosureHeader","undefined","state","headerClassName","t4","headerContent","t5","t6","Symbol","for","0","1","isDisabled","base","list","interactive","twoLine","disabled","Header","Panel"],"sources":["../../../src/components/disclosure/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { DisclosureStateContext, Button as RACButton, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, Heading as RACHeading } from 'react-aria-components';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, spacing } from '../../tokens/design.tokens.stylex';\n\n// A section that opens to show what is under it, and closes again. The\n// header is the row every list here draws — `src/row`, shared with ListItem,\n// ListBox and List — so its 56dp floor, body-large headline, body-medium\n// supporting line and state layers are that module's, and a header sitting\n// above a list cannot drift from the rows below it.\n//\n// The lists page gives the expand interaction its own token set, which its\n// widget keeps behind a menu that does not open to a script. What the page\n// states in words covers the row, which is what the shared module already\n// carries; the chevron's size and the panel's inset below are the library's\n// own, taken from the row's own trailing slot and inline padding rather than\n// invented.\n//\n// Three things are this component's own.\n//\n// **The header is a heading with a button in it.** React Aria wants both —\n// the heading is what a screen reader jumps between, and the button is what\n// opens the section — so `Disclosure.Header` renders the pair rather than\n// leaving a call site to remember. `headingLevel` says where in the page's\n// outline it sits.\n//\n// **The panel opens to its own height, without one being measured.** A grid\n// whose single row goes from `0fr` to `1fr` interpolates between nothing and\n// the content's natural height, so no height is read from the DOM and no\n// number is written down. Under `prefers-reduced-motion` the row snaps\n// instead.\n//\n// **Only the opening animates, and that is React Aria's doing rather than a\n// choice here.** It marks the collapsed panel `hidden=\"until-found\"`, so on\n// the way closed the content stops being laid out at once and the track has\n// nothing left to shrink. Worth knowing before reaching for a closing\n// animation: it needs the panel kept in the layout, which would cost the\n// find-in-page behaviour that attribute buys.\n\nconst styles = {\n header: {\n kzqmXN: \"xh8yej3\",\n k9WMMc: \"x1yc453h\",\n $$css: true\n }\n};\ntype DisclosureHeaderProps = {\n /** The header's headline — what the section is about. */\n children?: ReactNode;\n /**\n * Where the header sits in the page's outline. React Aria renders the\n * trigger inside a heading, and a screen reader moves between them.\n * @default 3\n */\n headingLevel?: number;\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n};\ntype DisclosurePanelProps = Omit<RACDisclosurePanelProps, 'className' | 'style'> & {\n /** A function may compute the class from the panel's render state. */\n className?: RACDisclosurePanelProps['className'];\n /** A function may compute the style from the panel's render state. */\n style?: RACDisclosurePanelProps['style'];\n};\ntype DisclosureProps = Omit<RACDisclosureProps, 'children'> & {\n /** A `Disclosure.Header` and a `Disclosure.Panel`. */\n children?: ReactNode;\n};\n\n// The chevron, turned or not. A call rather than JSX written at the prop,\n// which is what react-perf's jsx-no-jsx-as-prop is after; the React Compiler\n// memoises the result on `isExpanded`.\nfunction chevronFor(isExpanded: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"xxk0z11 x1w5n3ug x2lah0s xvy4d1p x19axjrm x1c071of xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"xxk0z11 x1w5n3ug x2lah0s xvy4d1p xkzkux9 x11xpdln xpc4ca7 x1y10d4b x1iffjtl\"\n }\n }[!!isExpanded << 0]} />;\n}\n\n/**\n * A section that opens to show what is under it. Whether it is open is React\n * Aria's: pass `isExpanded` with `onExpandedChange` to control it, or\n * `defaultExpanded` to let it keep its own.\n *\n * ```tsx\n * <Disclosure>\n * <Disclosure.Header>Headline</Disclosure.Header>\n * <Disclosure.Panel>Supporting line</Disclosure.Panel>\n * </Disclosure>\n * ```\n *\n * The header is the row every list here draws, so a section above a list of\n * rows lines up with them. The panel opens to whatever height its content\n * turns out to have, and snaps rather than sliding under\n * `prefers-reduced-motion`.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction Disclosure({\n children,\n ...props\n}: DisclosureProps) {\n return <RACDisclosure {...props} {...mergeStatefulStyles({\n className: \"x9f619 x78zum5 xdt5ytf\"\n }, props)}>\n {children}\n </RACDisclosure>;\n}\n\n/**\n * The row that opens the section. It renders the heading React Aria wants\n * around the trigger and the button inside it, and draws the shared row's\n * slots with a chevron in the trailing one.\n */\nfunction DisclosureHeader({\n children,\n headingLevel = 3,\n leading,\n supporting\n}: DisclosureHeaderProps) {\n // The chevron turns with the section, and React Aria's button render state\n // reports the press states rather than what the button controls — so\n // whether the section is open comes from the disclosure's own context.\n const state = useContext(DisclosureStateContext);\n return <RACHeading level={headingLevel} className=\"x1qlqyl8 x1pd3egz x1ghz6dp\">\n <RACButton className={headerClassName(supporting)} slot=\"trigger\">\n {headerContent(children, leading, supporting, state?.isExpanded === true)}\n </RACButton>\n </RACHeading>;\n}\n\n/**\n * What the section shows while it is open. Its content lines up with the\n * headline above it, and it takes the group role React Aria gives it —\n * `role=\"region\"` names it in the landmark list instead, for a section a\n * reader should be able to jump to.\n */\nfunction DisclosurePanel({\n children,\n ...props\n}: DisclosurePanelProps) {\n // The track has to know, and React Aria hands the render state to the panel\n // rather than to what wraps it — so the state comes from its context, the\n // same one its own panel reads.\n const state = useContext(DisclosureStateContext);\n return <div {...{\n 0: {\n className: \"x12w9bfk xrvj5dj xihq33y xjvfotl x1qn9uv2 x1seskgd\"\n },\n 1: {\n className: \"x12w9bfk xrvj5dj xjvfotl x1qn9uv2 x1seskgd x1tu4anv\"\n }\n }[!!(state?.isExpanded === true) << 0]}>\n <RACDisclosurePanel {...props} {...mergeStatefulStyles({\n className: \"x9f619 x2lwn1j xb3r6kr\"\n }, props)}>\n <div className=\"x9f619 xzfxn0k x790zyz\">{children}</div>\n </RACDisclosurePanel>\n </div>;\n}\n\n// The trigger's classes, from React Aria's render state. `isSelected` is not\n// among them — a disclosure's button reports `aria-expanded` rather than a\n// selection — so the row draws unselected throughout and only its disabled\n// state changes.\n//\n// A supporting line moves the header from the page's one-line container\n// height to its two-line one, which is a floor rather than something the\n// row's own box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as\n// an argument rather than read from the render state, since React Aria\n// reports what the trigger is doing and not what it holds; the classes are\n// built by a call for the same reason `headerContent` is.\n// No overline, and so no three-line header. The row takes the list\n// variant's metrics because a header looks like a list row, but what it\n// follows is its own page, and that page gives a headline and a supporting\n// line — the three-line item belongs to the lists page, which `List.Item`\n// and `ListBox.Item` draw.\nfunction headerClassName(supporting: ReactNode) {\n return (state: {\n isDisabled: boolean;\n }) => stylex.props(rowStyles.base, rowStyles.list, rowStyles.interactive, styles.header, supporting !== undefined && rowStyles.twoLine, state.isDisabled && rowStyles.disabled).className ?? '';\n}\n\n// What the header row draws. Built by a call rather than written inline at\n// the prop, which is what react-perf's no-new-function-as-prop is after; the\n// React Compiler memoises the result on its inputs.\nfunction headerContent(children: ReactNode, leading: ReactNode, supporting: ReactNode, isExpanded: boolean) {\n return (state: {\n isDisabled: boolean;\n }) => <RowContent isDisabled={state.isDisabled} leading={leading} supporting={supporting} trailing={chevronFor(isExpanded)}>\n {children}\n </RowContent>;\n}\nDisclosure.Header = DisclosureHeader;\nDisclosure.Panel = DisclosurePanel;\nexport type { DisclosureHeaderProps, DisclosurePanelProps, DisclosureProps };\nexport default Disclosure;"],"mappings":";;;;;;;;;;AA8CA,MAAMuB,SAAS,EACbC,QAAQ;CACNC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA6BA,SAASS,WAAWC,YAAqB;CACvC,OAAO,oB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AC,YAAD;EAAY,YAAYA,MAAMU;EAAqB3B;EAAqBC;EAAY,UAAUI,WAAWC,UAAU;EACpHR;CACS,CAAA;AAChB;AACAnB,aAAWsD,SAASlB;AACpBpC,aAAWuD,QAAQrD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
2
|
import { FormProps } from "react-aria-components";
|
|
3
3
|
//#region src/components/form/index.d.ts
|
|
4
|
-
type FormProps$1 =
|
|
4
|
+
type FormProps$1 = {
|
|
5
5
|
className?: string;
|
|
6
6
|
style?: CSSProperties;
|
|
7
7
|
/**
|
|
@@ -10,10 +10,17 @@ type FormProps$1 = Omit<FormProps, 'className' | 'style'> & {
|
|
|
10
10
|
* regardless. `native` hands validation to the browser: a required or
|
|
11
11
|
* malformed field blocks submission, and its message is the browser's
|
|
12
12
|
* own, shown once submission is tried.
|
|
13
|
+
*
|
|
14
|
+
* Under `aria`, moving focus after a server answers is the call site's.
|
|
15
|
+
* The errors are associated — `aria-invalid` on each control, the message
|
|
16
|
+
* in its `aria-describedby` — but nothing moves and nothing is read out,
|
|
17
|
+
* because no part of the form knows a round trip happened. `validationErrors`
|
|
18
|
+
* is a prop rather than an event, so a form cannot tell a submission coming
|
|
19
|
+
* back from a first render that was given errors to begin with.
|
|
13
20
|
* @default 'aria'
|
|
14
21
|
*/
|
|
15
22
|
validationBehavior?: 'aria' | 'native';
|
|
16
|
-
}
|
|
23
|
+
} & Omit<FormProps, 'className' | 'style'>;
|
|
17
24
|
/**
|
|
18
25
|
* A form: the fields inside it and what they are told about validation. Pass
|
|
19
26
|
* `validationErrors`, an object keyed by field `name`, to show what a server
|
|
@@ -22,6 +29,10 @@ type FormProps$1 = Omit<FormProps, 'className' | 'style'> & {
|
|
|
22
29
|
* the submit event; call `preventDefault` on it to handle the submission
|
|
23
30
|
* yourself, and read the values from `new FormData(event.currentTarget)`.
|
|
24
31
|
*
|
|
32
|
+
* Handing `validationErrors` back from a submission is where a reader has to
|
|
33
|
+
* be told something arrived: see `validationBehavior` for what the form does
|
|
34
|
+
* and what it leaves to the call site.
|
|
35
|
+
*
|
|
25
36
|
* The call site's `className` and `style` land on the form element, which is
|
|
26
37
|
* the element a layout positions.
|
|
27
38
|
*/
|
|
@@ -12,6 +12,10 @@ import { Form } from "react-aria-components";
|
|
|
12
12
|
* the submit event; call `preventDefault` on it to handle the submission
|
|
13
13
|
* yourself, and read the values from `new FormData(event.currentTarget)`.
|
|
14
14
|
*
|
|
15
|
+
* Handing `validationErrors` back from a submission is where a reader has to
|
|
16
|
+
* be told something arrived: see `validationBehavior` for what the form does
|
|
17
|
+
* and what it leaves to the call site.
|
|
18
|
+
*
|
|
15
19
|
* The call site's `className` and `style` land on the form element, which is
|
|
16
20
|
* the element a layout positions.
|
|
17
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CSSProperties","FormProps","RACFormProps","stylex","Form","RACForm","FIELD_VALIDATION_BEHAVIOR","mergeStyles","
|
|
1
|
+
{"version":3,"file":"index.js","names":["CSSProperties","FormProps","RACFormProps","stylex","Form","RACForm","FIELD_VALIDATION_BEHAVIOR","mergeStyles","className","style","validationBehavior","Omit","t0","$","_c","T0","t1","t2","t3","t4","props","undefined"],"sources":["../../../src/components/form/index.tsx"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { FormProps as RACFormProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Form as RACForm } from 'react-aria-components';\nimport { FIELD_VALIDATION_BEHAVIOR } from '../../field/root';\nimport { mergeStyles } from '../../styles/merge';\n\n// No page of its own: a form is the fields inside it, and the text fields\n// page is what each of them draws — the error a form reports lands in the\n// field's supporting text, in the error role, under the box. The form\n// draws nothing, and lays nothing out either; a Stack inside it is what\n// spaces the fields.\n//\n// React Aria's `Form` is the element. It hands two things to the fields\n// inside it through context: `validationErrors`, keyed by each field's\n// `name`, which is how a server's answer reaches the fields without any of\n// them changing, and `validationBehavior`, which every field reads in place\n// of its own default. React Aria's own default for that is `native`; the\n// library's is `aria`, set here so a form and a field agree, with `native`\n// the opt-in.\n\ntype FormProps = {\n className?: string;\n style?: CSSProperties;\n /**\n * How the fields inside validate. `aria` marks a field invalid and shows\n * its message as soon as the field says so, and lets the form submit\n * regardless. `native` hands validation to the browser: a required or\n * malformed field blocks submission, and its message is the browser's\n * own, shown once submission is tried.\n *\n * Under `aria`, moving focus after a server answers is the call site's.\n * The errors are associated — `aria-invalid` on each control, the message\n * in its `aria-describedby` — but nothing moves and nothing is read out,\n * because no part of the form knows a round trip happened. `validationErrors`\n * is a prop rather than an event, so a form cannot tell a submission coming\n * back from a first render that was given errors to begin with.\n * @default 'aria'\n */\n validationBehavior?: 'aria' | 'native';\n} & Omit<RACFormProps, 'className' | 'style'>;\n\n/**\n * A form: the fields inside it and what they are told about validation. Pass\n * `validationErrors`, an object keyed by field `name`, to show what a server\n * sent back under each field, and `validationBehavior=\"native\"` to let the\n * browser's own constraint validation block submission. `onSubmit` is handed\n * the submit event; call `preventDefault` on it to handle the submission\n * yourself, and read the values from `new FormData(event.currentTarget)`.\n *\n * Handing `validationErrors` back from a submission is where a reader has to\n * be told something arrived: see `validationBehavior` for what the form does\n * and what it leaves to the call site.\n *\n * The call site's `className` and `style` land on the form element, which is\n * the element a layout positions.\n */\nfunction Form({\n validationBehavior = FIELD_VALIDATION_BEHAVIOR,\n ...props\n}: FormProps) {\n return <RACForm validationBehavior={validationBehavior} {...props} {...mergeStyles({\n className: \"x9f619\"\n }, props)} />;\n}\nexport type { FormProps };\nexport default Form;"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyDA,SAAAI,OAAAQ,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAc,MAAA,EAAAF,oBAAAS,IAAA,GAAAC,UAAAR;EACZ,MAAAF,qBAAAS,OAAAE,KAAAA,IAAAf,4BAAAa;EAGQJ,KAAAV;EAA4BK,KAAAA;EAAwBU,KAAAA;EAAWF,KAAAX,YAAY,EAAAC,WACtE,SACb,GAAGY,KAAK;EAACP,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAA;EAAAH,KAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;CAAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,OAAAE,MAAAF,EAAA,OAAAG,MAAAH,EAAA,OAAAI,MAAAJ,EAAA,OAAAK,IAAA;EAFFC,KAAA,oBAAC,IAAD;GAA6BT,oBAAAA;GAAkB,GAAMU;GAAK,GAAMF;EAE9D,CAAA;EAAIL,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFNM;AAEM"}
|
|
@@ -1,70 +1,71 @@
|
|
|
1
|
+
import { FieldVariant } from "../field/index.js";
|
|
1
2
|
import AppBar, { AppBarProps } from "./app-bar/index.js";
|
|
2
|
-
import Autocomplete, { AutocompleteProps } from "./autocomplete/index.js";
|
|
3
|
+
import Autocomplete, { AutocompleteFilter, AutocompleteProps } from "./autocomplete/index.js";
|
|
3
4
|
import Avatar, { AvatarProps } from "./avatar/index.js";
|
|
4
|
-
import Breadcrumbs, { BreadcrumbsProps } from "./breadcrumbs/index.js";
|
|
5
|
-
import Button, { ButtonProps } from "./button/index.js";
|
|
5
|
+
import Breadcrumbs, { BreadcrumbsItemProps, BreadcrumbsProps } from "./breadcrumbs/index.js";
|
|
6
|
+
import Button, { ButtonProps, ButtonSize, ButtonVariant } from "./button/index.js";
|
|
6
7
|
import Calendar, { CalendarProps } from "./calendar/index.js";
|
|
7
8
|
import Card, { CardProps } from "./card/index.js";
|
|
8
9
|
import Checkbox, { CheckboxProps } from "./checkbox/index.js";
|
|
9
10
|
import CheckboxGroup, { CheckboxGroupProps } from "./checkbox-group/index.js";
|
|
10
11
|
import Chip, { ChipProps } from "./chip/index.js";
|
|
11
|
-
import ChipGroup, { ChipGroupProps } from "./chip-group/index.js";
|
|
12
|
+
import ChipGroup, { ChipGroupChipProps, ChipGroupProps } from "./chip-group/index.js";
|
|
12
13
|
import Code, { CodeProps } from "./code/index.js";
|
|
13
14
|
import ColorArea, { ColorAreaProps } from "./color-area/index.js";
|
|
14
15
|
import ColorField, { ColorFieldProps } from "./color-field/index.js";
|
|
15
16
|
import ColorPicker, { ColorPickerProps } from "./color-picker/index.js";
|
|
16
17
|
import ColorSlider, { ColorSliderProps } from "./color-slider/index.js";
|
|
17
18
|
import ColorSwatch, { ColorSwatchProps } from "./color-swatch/index.js";
|
|
18
|
-
import ColorSwatchPicker, { ColorSwatchPickerProps } from "./color-swatch-picker/index.js";
|
|
19
|
+
import ColorSwatchPicker, { ColorSwatchPickerItemProps, ColorSwatchPickerProps } from "./color-swatch-picker/index.js";
|
|
19
20
|
import ColorWheel, { ColorWheelProps } from "./color-wheel/index.js";
|
|
20
|
-
import ComboBox, { ComboBoxProps } from "./combo-box/index.js";
|
|
21
|
+
import ComboBox, { ComboBoxProps, ComboBoxSelectionMode } from "./combo-box/index.js";
|
|
21
22
|
import Container, { ContainerProps } from "./container/index.js";
|
|
22
23
|
import CopyField, { CopyFieldProps } from "./copy-field/index.js";
|
|
23
24
|
import Currency, { CurrencyProps } from "./currency/index.js";
|
|
24
25
|
import DateField, { DateFieldProps } from "./date-field/index.js";
|
|
25
26
|
import DatePicker, { DatePickerProps } from "./date-picker/index.js";
|
|
26
27
|
import DateRangePicker, { DateRangePickerProps } from "./date-range-picker/index.js";
|
|
27
|
-
import Dialog, { DialogProps } from "./dialog/index.js";
|
|
28
|
-
import Disclosure, { DisclosureProps } from "./disclosure/index.js";
|
|
28
|
+
import Dialog, { DialogContentProps, DialogProps, DialogTitleProps } from "./dialog/index.js";
|
|
29
|
+
import Disclosure, { DisclosureHeaderProps, DisclosurePanelProps, DisclosureProps } from "./disclosure/index.js";
|
|
29
30
|
import DisclosureGroup, { DisclosureGroupProps } from "./disclosure-group/index.js";
|
|
30
31
|
import DropZone, { DropZoneProps, FileTrigger, FileTriggerProps } from "./drop-zone/index.js";
|
|
31
32
|
import Feed, { FeedProps } from "./feed/index.js";
|
|
32
33
|
import Form, { FormProps } from "./form/index.js";
|
|
33
|
-
import IconButton, { IconButtonProps } from "./icon-button/index.js";
|
|
34
|
+
import IconButton, { IconButtonProps, IconButtonSize, IconButtonVariant } from "./icon-button/index.js";
|
|
34
35
|
import Keycap, { KeycapProps } from "./keycap/index.js";
|
|
35
|
-
import Link, { LinkProps } from "./link/index.js";
|
|
36
|
-
import List, { ListProps } from "./list/index.js";
|
|
37
|
-
import ListBox, { ListBoxProps } from "./list-box/index.js";
|
|
36
|
+
import Link, { LinkProps, LinkTone, LinkUnderline } from "./link/index.js";
|
|
37
|
+
import List, { ListLoadMoreProps, ListProps, ListRowProps, ListSectionProps } from "./list/index.js";
|
|
38
|
+
import ListBox, { ListBoxItemProps, ListBoxLoadMoreProps, ListBoxProps, ListBoxSectionProps } from "./list-box/index.js";
|
|
38
39
|
import ListDetail, { ListDetailProps } from "./list-detail/index.js";
|
|
39
40
|
import ListItem, { ListItemProps } from "./list-item/index.js";
|
|
40
|
-
import Separator, { SeparatorProps } from "./separator/index.js";
|
|
41
|
-
import Menu, { MenuProps } from "./menu/index.js";
|
|
42
|
-
import Meter, { MeterProps } from "./meter/index.js";
|
|
41
|
+
import Separator, { SeparatorInset, SeparatorProps } from "./separator/index.js";
|
|
42
|
+
import Menu, { MenuAlign, MenuContentProps, MenuItemProps, MenuLoadMoreProps, MenuProps, MenuSectionProps, MenuSeparatorProps, MenuSide, MenuSubmenuProps } from "./menu/index.js";
|
|
43
|
+
import Meter, { MeterProps, MeterTone } from "./meter/index.js";
|
|
43
44
|
import NavigationTree, { NavigationTreeHeaderProps, NavigationTreeItemProps, NavigationTreeProps, NavigationTreeSectionProps } from "./navigation-tree/index.js";
|
|
44
45
|
import NumberField, { NumberFieldProps } from "./number-field/index.js";
|
|
45
|
-
import Popover, { PopoverProps } from "./popover/index.js";
|
|
46
|
+
import Popover, { PopoverAlign, PopoverContentProps, PopoverDescriptionProps, PopoverProps, PopoverSide, PopoverSize, PopoverTitleProps, PopoverTrigger } from "./popover/index.js";
|
|
46
47
|
import ProductIcon, { ProductIconProps } from "./product-icon/index.js";
|
|
47
|
-
import ProgressIndicator, { ProgressIndicatorProps } from "./progress-indicator/index.js";
|
|
48
|
+
import ProgressIndicator, { ProgressIndicatorProps, ProgressIndicatorTone, ProgressIndicatorVariant } from "./progress-indicator/index.js";
|
|
48
49
|
import RadioGroup, { Radio, RadioGroupProps, RadioProps } from "./radio-group/index.js";
|
|
49
50
|
import RangeCalendar, { RangeCalendarProps } from "./range-calendar/index.js";
|
|
50
51
|
import SearchField, { SearchFieldProps } from "./search-field/index.js";
|
|
51
52
|
import SegmentedButton, { SegmentedButtonProps, SegmentedButtonSegmentProps } from "./segmented-button/index.js";
|
|
52
53
|
import Select, { SelectProps } from "./select/index.js";
|
|
53
|
-
import Sheet, { SheetProps } from "./sheet/index.js";
|
|
54
|
+
import Sheet, { SheetContentProps, SheetProps, SheetTitleProps } from "./sheet/index.js";
|
|
54
55
|
import Slider, { SliderProps } from "./slider/index.js";
|
|
55
|
-
import Snackbar, { SnackbarProps } from "./snackbar/index.js";
|
|
56
|
+
import Snackbar, { SnackbarAction, SnackbarMessage, SnackbarOptions, SnackbarProps, SnackbarQueue, SnackbarRegionRenderProps as ToastRegionRenderProps } from "./snackbar/index.js";
|
|
56
57
|
import Stack, { StackAlign, StackGap, StackJustify, StackProps } from "./stack/index.js";
|
|
57
58
|
import SupportingPane, { SupportingPaneProps } from "./supporting-pane/index.js";
|
|
58
59
|
import Switch, { SwitchProps } from "./switch/index.js";
|
|
59
|
-
import Table, { TableBodyProps, TableCellProps, TableColumnProps, TableFooterProps, TableHeaderProps, TableProps, TableRowProps } from "./table/index.js";
|
|
60
|
-
import Tabs, { TabsProps } from "./tabs/index.js";
|
|
60
|
+
import Table, { TableBodyProps, TableCellProps, TableColumnProps, TableFooterProps, TableHeaderProps, TableLoadMoreProps, TableProps, TableRowProps } from "./table/index.js";
|
|
61
|
+
import Tabs, { TabsListProps, TabsPanelProps, TabsPanelsProps, TabsProps, TabsTabProps } from "./tabs/index.js";
|
|
61
62
|
import Tag, { TagProps } from "./tag/index.js";
|
|
62
63
|
import Text, { TextProps } from "./text/index.js";
|
|
63
64
|
import TextArea, { TextAreaProps } from "./text-area/index.js";
|
|
64
65
|
import TextField, { TextFieldProps } from "./text-field/index.js";
|
|
65
66
|
import TimeField, { TimeFieldProps } from "./time-field/index.js";
|
|
66
|
-
import TokenField, { TokenFieldProps } from "./token-field/index.js";
|
|
67
|
-
import Toolbar, { ToolbarProps } from "./toolbar/index.js";
|
|
68
|
-
import Tooltip, { TooltipProps } from "./tooltip/index.js";
|
|
67
|
+
import TokenField, { TokenFieldProps, TokenSegment } from "./token-field/index.js";
|
|
68
|
+
import Toolbar, { ToolbarProps, ToolbarTone } from "./toolbar/index.js";
|
|
69
|
+
import Tooltip, { TooltipAlign, TooltipProps, TooltipSide } from "./tooltip/index.js";
|
|
69
70
|
import Tree, { TreeHeaderProps, TreeItemProps, TreeLoadMoreProps, TreeProps, TreeSectionProps } from "./tree/index.js";
|
|
70
|
-
export { AppBar, type AppBarProps, Autocomplete, type AutocompleteProps, Avatar, type AvatarProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, Calendar, type CalendarProps, Card, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, ChipGroup, type ChipGroupProps, type ChipProps, Code, type CodeProps, ColorArea, type ColorAreaProps, ColorField, type ColorFieldProps, ColorPicker, type ColorPickerProps, ColorSlider, type ColorSliderProps, ColorSwatch, ColorSwatchPicker, type ColorSwatchPickerProps, type ColorSwatchProps, ColorWheel, type ColorWheelProps, ComboBox, type ComboBoxProps, Container, type ContainerProps, CopyField, type CopyFieldProps, Currency, type CurrencyProps, DateField, type DateFieldProps, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, Dialog, type DialogProps, Disclosure, DisclosureGroup, type DisclosureGroupProps, type DisclosureProps, DropZone, type DropZoneProps, Feed, type FeedProps, FileTrigger, type FileTriggerProps, Form, type FormProps, IconButton, type IconButtonProps, Keycap, type KeycapProps, Link, type LinkProps, List, ListBox, type ListBoxProps, ListDetail, type ListDetailProps, ListItem, type ListItemProps, type ListProps, Menu, type MenuProps, Meter, type MeterProps, NavigationTree, type NavigationTreeHeaderProps, type NavigationTreeItemProps, type NavigationTreeProps, type NavigationTreeSectionProps, NumberField, type NumberFieldProps, Popover, type PopoverProps, ProductIcon, type ProductIconProps, ProgressIndicator, type ProgressIndicatorProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RangeCalendar, type RangeCalendarProps, SearchField, type SearchFieldProps, SegmentedButton, type SegmentedButtonProps, type SegmentedButtonSegmentProps, Select, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Slider, type SliderProps, Snackbar, type SnackbarProps, Stack, type StackAlign, type StackGap, type StackJustify, type StackProps, SupportingPane, type SupportingPaneProps, Switch, type SwitchProps, Table, type TableBodyProps, type TableCellProps, type TableColumnProps, type TableFooterProps, type TableHeaderProps, type TableProps, type TableRowProps, Tabs, type TabsProps, Tag, type TagProps, Text, TextArea, type TextAreaProps, TextField, type TextFieldProps, type TextProps, TimeField, type TimeFieldProps, TokenField, type TokenFieldProps, Toolbar, type ToolbarProps, Tooltip, type TooltipProps, Tree, type TreeHeaderProps, type TreeItemProps, type TreeLoadMoreProps, type TreeProps, type TreeSectionProps };
|
|
71
|
+
export { AppBar, type AppBarProps, Autocomplete, type AutocompleteFilter, type AutocompleteProps, Avatar, type AvatarProps, Breadcrumbs, type BreadcrumbsItemProps, type BreadcrumbsProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, type CalendarProps, Card, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, ChipGroup, type ChipGroupChipProps, type ChipGroupProps, type ChipProps, Code, type CodeProps, ColorArea, type ColorAreaProps, ColorField, type ColorFieldProps, ColorPicker, type ColorPickerProps, ColorSlider, type ColorSliderProps, ColorSwatch, ColorSwatchPicker, type ColorSwatchPickerItemProps, type ColorSwatchPickerProps, type ColorSwatchProps, ColorWheel, type ColorWheelProps, ComboBox, type ComboBoxProps, type ComboBoxSelectionMode, Container, type ContainerProps, CopyField, type CopyFieldProps, Currency, type CurrencyProps, DateField, type DateFieldProps, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, Dialog, type DialogContentProps, type DialogProps, type DialogTitleProps, Disclosure, DisclosureGroup, type DisclosureGroupProps, type DisclosureHeaderProps, type DisclosurePanelProps, type DisclosureProps, DropZone, type DropZoneProps, Feed, type FeedProps, type FieldVariant, FileTrigger, type FileTriggerProps, Form, type FormProps, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, Keycap, type KeycapProps, Link, type LinkProps, type LinkTone, type LinkUnderline, List, ListBox, type ListBoxItemProps, type ListBoxLoadMoreProps, type ListBoxProps, type ListBoxSectionProps, ListDetail, type ListDetailProps, ListItem, type ListItemProps, type ListLoadMoreProps, type ListProps, type ListRowProps, type ListSectionProps, Menu, type MenuAlign, type MenuContentProps, type MenuItemProps, type MenuLoadMoreProps, type MenuProps, type MenuSectionProps, type MenuSeparatorProps, type MenuSide, type MenuSubmenuProps, Meter, type MeterProps, type MeterTone, NavigationTree, type NavigationTreeHeaderProps, type NavigationTreeItemProps, type NavigationTreeProps, type NavigationTreeSectionProps, NumberField, type NumberFieldProps, Popover, type PopoverAlign, type PopoverContentProps, type PopoverDescriptionProps, type PopoverProps, type PopoverSide, type PopoverSize, type PopoverTitleProps, type PopoverTrigger, ProductIcon, type ProductIconProps, ProgressIndicator, type ProgressIndicatorProps, type ProgressIndicatorTone, type ProgressIndicatorVariant, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RangeCalendar, type RangeCalendarProps, SearchField, type SearchFieldProps, SegmentedButton, type SegmentedButtonProps, type SegmentedButtonSegmentProps, Select, type SelectProps, Separator, type SeparatorInset, type SeparatorProps, Sheet, type SheetContentProps, type SheetProps, type SheetTitleProps, Slider, type SliderProps, Snackbar, type SnackbarAction, type SnackbarMessage, type SnackbarOptions, type SnackbarProps, type SnackbarQueue, type ToastRegionRenderProps as SnackbarRegionRenderProps, Stack, type StackAlign, type StackGap, type StackJustify, type StackProps, SupportingPane, type SupportingPaneProps, Switch, type SwitchProps, Table, type TableBodyProps, type TableCellProps, type TableColumnProps, type TableFooterProps, type TableHeaderProps, type TableLoadMoreProps, type TableProps, type TableRowProps, Tabs, type TabsListProps, type TabsPanelProps, type TabsPanelsProps, type TabsProps, type TabsTabProps, Tag, type TagProps, Text, TextArea, type TextAreaProps, TextField, type TextFieldProps, type TextProps, TimeField, type TimeFieldProps, TokenField, type TokenFieldProps, type TokenSegment, Toolbar, type ToolbarProps, type ToolbarTone, Tooltip, type TooltipAlign, type TooltipProps, type TooltipSide, Tree, type TreeHeaderProps, type TreeItemProps, type TreeLoadMoreProps, type TreeProps, type TreeSectionProps };
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { GridListItemProps, GridListLoadMoreItemProps, GridListProps, GridListSectionProps } from "react-aria-components";
|
|
3
3
|
//#region src/components/list/index.d.ts
|
|
4
|
-
type ListItemProps<T extends object = object> = {
|
|
5
|
-
/** The row's headline — the one thing it is mostly about. */
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
/** A function may compute the class from the row's render state. */
|
|
8
|
-
className?: GridListItemProps<T>['className'];
|
|
9
|
-
/** Content before the headline: an avatar, an icon. */
|
|
10
|
-
leading?: ReactNode;
|
|
11
|
-
/** A function may compute the style from the row's render state. */
|
|
12
|
-
style?: GridListItemProps<T>['style'];
|
|
13
|
-
/** A second line under the headline, in the muted role. */
|
|
14
|
-
supporting?: ReactNode;
|
|
15
|
-
/** Content after the headline, such as an amount or a control. */
|
|
16
|
-
trailing?: ReactNode;
|
|
17
|
-
} & Omit<GridListItemProps<T>, 'children' | 'className' | 'style'>;
|
|
18
4
|
type ListLoadMoreProps = Omit<GridListLoadMoreItemProps, 'children'> & {
|
|
19
5
|
/**
|
|
20
6
|
* What the row says while it is loading. Read by a screen reader; the ring
|
|
@@ -23,7 +9,7 @@ type ListLoadMoreProps = Omit<GridListLoadMoreItemProps, 'children'> & {
|
|
|
23
9
|
*/
|
|
24
10
|
label?: string;
|
|
25
11
|
};
|
|
26
|
-
type ListProps<T extends object> = Omit<GridListProps<T>, 'className' | 'style'> & {
|
|
12
|
+
type ListProps<T extends object = object> = Omit<GridListProps<T>, 'className' | 'style'> & {
|
|
27
13
|
/** A function may compute the class from the list's render state. */
|
|
28
14
|
className?: GridListProps<T>['className'];
|
|
29
15
|
/**
|
|
@@ -35,6 +21,26 @@ type ListProps<T extends object> = Omit<GridListProps<T>, 'className' | 'style'>
|
|
|
35
21
|
/** A function may compute the style from the list's render state. */
|
|
36
22
|
style?: GridListProps<T>['style'];
|
|
37
23
|
};
|
|
24
|
+
type ListRowProps<T extends object = object> = {
|
|
25
|
+
/** The row's headline — the one thing it is mostly about. */
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
/** A function may compute the class from the row's render state. */
|
|
28
|
+
className?: GridListItemProps<T>['className'];
|
|
29
|
+
/** Content before the headline: an avatar, an icon. */
|
|
30
|
+
leading?: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* A line above the headline, in the page's label-small and the same muted
|
|
33
|
+
* role the supporting line takes — a category, a date, a status. Given
|
|
34
|
+
* alongside `supporting` it makes the row the page's three-line item.
|
|
35
|
+
*/
|
|
36
|
+
overline?: ReactNode;
|
|
37
|
+
/** A function may compute the style from the row's render state. */
|
|
38
|
+
style?: GridListItemProps<T>['style'];
|
|
39
|
+
/** A second line under the headline, in the muted role. */
|
|
40
|
+
supporting?: ReactNode;
|
|
41
|
+
/** Content after the headline, such as an amount or a control. */
|
|
42
|
+
trailing?: ReactNode;
|
|
43
|
+
} & Omit<GridListItemProps<T>, 'children' | 'className' | 'style'>;
|
|
38
44
|
type ListSectionProps<T extends object = object> = Omit<GridListSectionProps<T>, 'children'> & {
|
|
39
45
|
/**
|
|
40
46
|
* The rows in the section. A section built from data puts React Aria's
|
|
@@ -80,7 +86,7 @@ declare namespace List {
|
|
|
80
86
|
* A list that selects with checkboxes draws one before whatever `leading`
|
|
81
87
|
* holds, from the state React Aria reports rather than from a prop here.
|
|
82
88
|
*/
|
|
83
|
-
declare function ListItem<T extends object = object>({ children, leading, supporting, textValue, trailing, ...props }:
|
|
89
|
+
declare function ListItem<T extends object = object>({ children, leading, overline, supporting, textValue, trailing, ...props }: ListRowProps<T>): import("react").JSX.Element;
|
|
84
90
|
/**
|
|
85
91
|
* The row the list shows while it is fetching more. React Aria calls
|
|
86
92
|
* `onLoadMore` when this comes into view, and draws it only while
|
|
@@ -93,5 +99,5 @@ declare function ListLoadMore({ label, ...props }: ListLoadMoreProps): import("r
|
|
|
93
99
|
*/
|
|
94
100
|
declare function ListSection<T extends object = object>({ children, header, ...props }: ListSectionProps<T>): import("react").JSX.Element;
|
|
95
101
|
//#endregion
|
|
96
|
-
export { type
|
|
102
|
+
export { type ListLoadMoreProps, type ListProps, type ListRowProps, type ListSectionProps, List as default };
|
|
97
103
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -10,11 +10,12 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
import { GridList, GridListHeader, GridListItem, GridListLoadMoreItem, GridListSection } from "react-aria-components";
|
|
11
11
|
//#region src/components/list/index.tsx
|
|
12
12
|
const SelectLabelContext = createContext("Select");
|
|
13
|
-
function itemContent(children, leading, supporting, trailing, selectLabel) {
|
|
13
|
+
function itemContent(children, leading, overline, supporting, trailing, selectLabel) {
|
|
14
14
|
return (state) => /* @__PURE__ */ jsx(RowContent, {
|
|
15
15
|
isDisabled: state.isDisabled,
|
|
16
16
|
isSelected: state.isSelected,
|
|
17
17
|
leading: leadingFor(state, leading, selectLabel),
|
|
18
|
+
overline,
|
|
18
19
|
supporting,
|
|
19
20
|
trailing,
|
|
20
21
|
children
|
|
@@ -58,13 +59,13 @@ function List(t0) {
|
|
|
58
59
|
let t2;
|
|
59
60
|
let t3;
|
|
60
61
|
if ($[0] !== t0) {
|
|
61
|
-
const { selectLabel: t4, ...props$
|
|
62
|
+
const { selectLabel: t4, ...props$1 } = t0;
|
|
62
63
|
const selectLabel = t4 === void 0 ? "Select" : t4;
|
|
63
64
|
T1 = SelectLabelContext;
|
|
64
65
|
t3 = selectLabel;
|
|
65
66
|
T0 = GridList;
|
|
66
|
-
t1 = props$
|
|
67
|
-
t2 = mergeStatefulStyles(props(collectionStyles.container), props$
|
|
67
|
+
t1 = props$1;
|
|
68
|
+
t2 = mergeStatefulStyles(props(collectionStyles.container), props$1);
|
|
68
69
|
$[0] = t0;
|
|
69
70
|
$[1] = T0;
|
|
70
71
|
$[2] = T1;
|
|
@@ -111,8 +112,8 @@ function List(t0) {
|
|
|
111
112
|
* holds, from the state React Aria reports rather than from a prop here.
|
|
112
113
|
*/
|
|
113
114
|
function ListItem(t0) {
|
|
114
|
-
const $ = c(
|
|
115
|
-
const { children, leading, supporting, textValue, trailing, ...props } = t0;
|
|
115
|
+
const $ = c(16);
|
|
116
|
+
const { children, leading, overline, supporting, textValue, trailing, ...props } = t0;
|
|
116
117
|
const selectLabel = useContext(SelectLabelContext);
|
|
117
118
|
const T0 = GridListItem;
|
|
118
119
|
let t1;
|
|
@@ -122,32 +123,33 @@ function ListItem(t0) {
|
|
|
122
123
|
$[1] = textValue;
|
|
123
124
|
$[2] = t1;
|
|
124
125
|
} else t1 = $[2];
|
|
125
|
-
const t2 = mergeStatefulStyles(rowItemStyles(supporting), props);
|
|
126
|
+
const t2 = mergeStatefulStyles(rowItemStyles(supporting, overline), props);
|
|
126
127
|
let t3;
|
|
127
|
-
if ($[3] !== children || $[4] !== leading || $[5] !==
|
|
128
|
-
t3 = itemContent(children, leading, supporting, trailing, selectLabel);
|
|
128
|
+
if ($[3] !== children || $[4] !== leading || $[5] !== overline || $[6] !== selectLabel || $[7] !== supporting || $[8] !== trailing) {
|
|
129
|
+
t3 = itemContent(children, leading, overline, supporting, trailing, selectLabel);
|
|
129
130
|
$[3] = children;
|
|
130
131
|
$[4] = leading;
|
|
131
|
-
$[5] =
|
|
132
|
-
$[6] =
|
|
133
|
-
$[7] =
|
|
134
|
-
$[8] =
|
|
135
|
-
|
|
132
|
+
$[5] = overline;
|
|
133
|
+
$[6] = selectLabel;
|
|
134
|
+
$[7] = supporting;
|
|
135
|
+
$[8] = trailing;
|
|
136
|
+
$[9] = t3;
|
|
137
|
+
} else t3 = $[9];
|
|
136
138
|
let t4;
|
|
137
|
-
if ($[
|
|
139
|
+
if ($[10] !== T0 || $[11] !== props || $[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
|
|
138
140
|
t4 = /* @__PURE__ */ jsx(T0, {
|
|
139
141
|
textValue: t1,
|
|
140
142
|
...props,
|
|
141
143
|
...t2,
|
|
142
144
|
children: t3
|
|
143
145
|
});
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
} else t4 = $[
|
|
146
|
+
$[10] = T0;
|
|
147
|
+
$[11] = props;
|
|
148
|
+
$[12] = t1;
|
|
149
|
+
$[13] = t2;
|
|
150
|
+
$[14] = t3;
|
|
151
|
+
$[15] = t4;
|
|
152
|
+
} else t4 = $[15];
|
|
151
153
|
return t4;
|
|
152
154
|
}
|
|
153
155
|
/**
|
|
@@ -162,11 +164,11 @@ function ListLoadMore(t0) {
|
|
|
162
164
|
let t1;
|
|
163
165
|
let t2;
|
|
164
166
|
if ($[0] !== t0) {
|
|
165
|
-
const { label: t3, ...props$
|
|
167
|
+
const { label: t3, ...props$2 } = t0;
|
|
166
168
|
label = t3 === void 0 ? "Loading more" : t3;
|
|
167
169
|
T0 = GridListLoadMoreItem;
|
|
168
|
-
t1 = props$
|
|
169
|
-
t2 = mergeStyles(props(collectionStyles.loading), props$
|
|
170
|
+
t1 = props$2;
|
|
171
|
+
t2 = mergeStyles(props(collectionStyles.loading), props$2);
|
|
170
172
|
$[0] = t0;
|
|
171
173
|
$[1] = T0;
|
|
172
174
|
$[2] = label;
|