@kanso-labs/kanso-ui 0.18.0 → 0.19.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.
@@ -15,8 +15,11 @@ import Form, { FormProps } from "./form/index.js";
15
15
  import IconButton, { IconButtonProps } from "./icon-button/index.js";
16
16
  import Keycap, { KeycapProps } from "./keycap/index.js";
17
17
  import Link, { LinkProps } from "./link/index.js";
18
+ import ListBox, { ListBoxProps } from "./list-box/index.js";
18
19
  import ListDetail, { ListDetailProps } from "./list-detail/index.js";
19
20
  import ListItem, { ListItemProps } from "./list-item/index.js";
21
+ import Separator, { SeparatorProps } from "./separator/index.js";
22
+ import Menu, { MenuProps } from "./menu/index.js";
20
23
  import Meter, { MeterProps } from "./meter/index.js";
21
24
  import NumberField, { NumberFieldProps } from "./number-field/index.js";
22
25
  import Popover, { PopoverProps } from "./popover/index.js";
@@ -24,7 +27,6 @@ import ProductIcon, { ProductIconProps } from "./product-icon/index.js";
24
27
  import ProgressIndicator, { ProgressIndicatorProps } from "./progress-indicator/index.js";
25
28
  import RadioGroup, { Radio, RadioGroupProps, RadioProps } from "./radio-group/index.js";
26
29
  import SearchField, { SearchFieldProps } from "./search-field/index.js";
27
- import Separator, { SeparatorProps } from "./separator/index.js";
28
30
  import Sheet, { SheetProps } from "./sheet/index.js";
29
31
  import Slider, { SliderProps } from "./slider/index.js";
30
32
  import Snackbar, { SnackbarProps } from "./snackbar/index.js";
@@ -37,4 +39,4 @@ import Text, { TextProps } from "./text/index.js";
37
39
  import TextArea, { TextAreaProps } from "./text-area/index.js";
38
40
  import TextField, { TextFieldProps } from "./text-field/index.js";
39
41
  import Tooltip, { TooltipProps } from "./tooltip/index.js";
40
- export { AppBar, type AppBarProps, Avatar, type AvatarProps, Button, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, type ChipProps, Code, type CodeProps, Container, type ContainerProps, CopyField, type CopyFieldProps, Currency, type CurrencyProps, Dialog, type DialogProps, Feed, type FeedProps, Form, type FormProps, IconButton, type IconButtonProps, Keycap, type KeycapProps, Link, type LinkProps, ListDetail, type ListDetailProps, ListItem, type ListItemProps, Meter, type MeterProps, NumberField, type NumberFieldProps, Popover, type PopoverProps, ProductIcon, type ProductIconProps, ProgressIndicator, type ProgressIndicatorProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, SearchField, type SearchFieldProps, 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, Tabs, type TabsProps, Tag, type TagProps, Text, TextArea, type TextAreaProps, TextField, type TextFieldProps, type TextProps, Tooltip, type TooltipProps };
42
+ export { AppBar, type AppBarProps, Avatar, type AvatarProps, Button, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, type ChipProps, Code, type CodeProps, Container, type ContainerProps, CopyField, type CopyFieldProps, Currency, type CurrencyProps, Dialog, type DialogProps, Feed, type FeedProps, Form, type FormProps, IconButton, type IconButtonProps, Keycap, type KeycapProps, Link, type LinkProps, ListBox, type ListBoxProps, ListDetail, type ListDetailProps, ListItem, type ListItemProps, Menu, type MenuProps, Meter, type MeterProps, NumberField, type NumberFieldProps, Popover, type PopoverProps, ProductIcon, type ProductIconProps, ProgressIndicator, type ProgressIndicatorProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, SearchField, type SearchFieldProps, 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, Tabs, type TabsProps, Tag, type TagProps, Text, TextArea, type TextAreaProps, TextField, type TextFieldProps, type TextProps, Tooltip, type TooltipProps };
@@ -0,0 +1,84 @@
1
+ import { ReactNode } from "react";
2
+ import { ListBoxItemProps, ListBoxLoadMoreItemProps, ListBoxProps, ListBoxSectionProps } from "react-aria-components";
3
+ //#region src/components/list-box/index.d.ts
4
+ type ListBoxItemProps$1<T extends object = object> = {
5
+ /** The option's headline — the one thing it is mostly about. */
6
+ children?: ReactNode;
7
+ /** A function may compute the class from the option's render state. */
8
+ className?: ListBoxItemProps<T>['className'];
9
+ /** Content before the headline: an avatar, an icon, a checkbox. */
10
+ leading?: ReactNode;
11
+ /** A function may compute the style from the option's render state. */
12
+ style?: ListBoxItemProps<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<ListBoxItemProps<T>, 'children' | 'className' | 'style'>;
18
+ type ListBoxLoadMoreProps = Omit<ListBoxLoadMoreItemProps, 'children'> & {
19
+ /**
20
+ * What the row says while it is loading. Read by a screen reader; the ring
21
+ * itself carries no text.
22
+ * @default 'Loading more'
23
+ */
24
+ label?: string;
25
+ };
26
+ type ListBoxProps$1<T extends object> = Omit<ListBoxProps<T>, 'className' | 'style'> & {
27
+ /** A function may compute the class from the list's render state. */
28
+ className?: ListBoxProps<T>['className'];
29
+ /** A function may compute the style from the list's render state. */
30
+ style?: ListBoxProps<T>['style'];
31
+ };
32
+ type ListBoxSectionProps$1<T extends object = object> = Omit<ListBoxSectionProps<T>, 'children'> & {
33
+ /**
34
+ * The options in the section. A section built from data puts React Aria's
35
+ * `Collection` in here rather than a render function, since the header is
36
+ * an element beside them.
37
+ */
38
+ children?: ReactNode;
39
+ /**
40
+ * The section's heading, rendered through React Aria's header so the
41
+ * section is named by it. A section without one is a group with no name.
42
+ */
43
+ header?: ReactNode;
44
+ };
45
+ /**
46
+ * A list of options one or more of which can be selected. Selection is React
47
+ * Aria's: set `selectionMode` to `single` or `multiple`, and pass
48
+ * `selectedKeys` with `onSelectionChange` to control it or
49
+ * `defaultSelectedKeys` to let it keep its own. A list that only responds to
50
+ * a press takes `onAction` on the option instead.
51
+ *
52
+ * Composed from parts, since an option's slots take arbitrary content:
53
+ * `ListBox.Item`, `ListBox.Section` and `ListBox.LoadMore`. Name the list
54
+ * with `aria-label` or `aria-labelledby` — nothing here labels it for you.
55
+ *
56
+ * The call site's `className` and `style` land on the container, which is
57
+ * the element a layout positions.
58
+ */
59
+ declare function ListBox$1<T extends object>(props: ListBoxProps$1<T>): import("react").JSX.Element;
60
+ declare namespace ListBox$1 {
61
+ var Item: typeof ListBoxItem$1;
62
+ var LoadMore: typeof ListBoxLoadMore;
63
+ var Section: typeof ListBoxSection$1;
64
+ }
65
+ /**
66
+ * One option. Its slots are the row's: `leading`, the headline as children,
67
+ * `supporting` under it, and `trailing`. Give every option an `id` — that is
68
+ * the key selection is reported by.
69
+ */
70
+ declare function ListBoxItem$1<T extends object = object>({ children, leading, supporting, trailing, ...props }: ListBoxItemProps$1<T>): import("react").JSX.Element;
71
+ /**
72
+ * The row the list shows while it is fetching more. React Aria calls
73
+ * `onLoadMore` when this comes into view, and draws it only while
74
+ * `isLoading` — so a list that pages as it scrolls needs nothing else.
75
+ */
76
+ declare function ListBoxLoadMore({ label, ...props }: ListBoxLoadMoreProps): import("react").JSX.Element;
77
+ /**
78
+ * A named group of options. `header` names it, and is what a screen reader
79
+ * reads before the options inside.
80
+ */
81
+ declare function ListBoxSection$1<T extends object = object>({ children, header, ...props }: ListBoxSectionProps$1<T>): import("react").JSX.Element;
82
+ //#endregion
83
+ export { type ListBoxItemProps$1 as ListBoxItemProps, type ListBoxLoadMoreProps, type ListBoxProps$1 as ListBoxProps, type ListBoxSectionProps$1 as ListBoxSectionProps, ListBox$1 as default };
84
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,200 @@
1
+ import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
2
+ import { mergeStatefulStyles, mergeStyles } from "../../styles/merge.js";
3
+ import ProgressIndicator from "../progress-indicator/index.js";
4
+ import { rowStyles } from "../../row/styles.js";
5
+ import { RowContent } from "../../row/index.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { c } from "react/compiler-runtime";
8
+ import { Header, ListBox, ListBoxItem, ListBoxLoadMoreItem, ListBoxSection } from "react-aria-components";
9
+ //#region src/components/list-box/index.tsx
10
+ function itemContent(children, leading, supporting, trailing) {
11
+ return (state) => /* @__PURE__ */ jsx(RowContent, {
12
+ isDisabled: state.isDisabled,
13
+ isSelected: state.isSelected,
14
+ leading,
15
+ supporting,
16
+ trailing,
17
+ children
18
+ });
19
+ }
20
+ function itemStyles(state) {
21
+ return props(rowStyles.base, rowStyles.list, rowStyles.interactive, state.isSelected && rowStyles.selectedList, state.isDisabled && rowStyles.disabled);
22
+ }
23
+ /**
24
+ * A list of options one or more of which can be selected. Selection is React
25
+ * Aria's: set `selectionMode` to `single` or `multiple`, and pass
26
+ * `selectedKeys` with `onSelectionChange` to control it or
27
+ * `defaultSelectedKeys` to let it keep its own. A list that only responds to
28
+ * a press takes `onAction` on the option instead.
29
+ *
30
+ * Composed from parts, since an option's slots take arbitrary content:
31
+ * `ListBox.Item`, `ListBox.Section` and `ListBox.LoadMore`. Name the list
32
+ * with `aria-label` or `aria-labelledby` — nothing here labels it for you.
33
+ *
34
+ * The call site's `className` and `style` land on the container, which is
35
+ * the element a layout positions.
36
+ */
37
+ function ListBox$1(props) {
38
+ const $ = c(5);
39
+ let t0;
40
+ if ($[0] !== props) {
41
+ t0 = mergeStatefulStyles({ className: "x9f619 x78zum5 xdt5ytf x1t137rt x1cmllll" }, props);
42
+ $[0] = props;
43
+ $[1] = t0;
44
+ } else t0 = $[1];
45
+ let t1;
46
+ if ($[2] !== props || $[3] !== t0) {
47
+ t1 = /* @__PURE__ */ jsx(ListBox, {
48
+ ...props,
49
+ ...t0
50
+ });
51
+ $[2] = props;
52
+ $[3] = t0;
53
+ $[4] = t1;
54
+ } else t1 = $[4];
55
+ return t1;
56
+ }
57
+ /**
58
+ * One option. Its slots are the row's: `leading`, the headline as children,
59
+ * `supporting` under it, and `trailing`. Give every option an `id` — that is
60
+ * the key selection is reported by.
61
+ */
62
+ function ListBoxItem$1(t0) {
63
+ const $ = c(18);
64
+ let T0;
65
+ let children;
66
+ let leading;
67
+ let supporting;
68
+ let t1;
69
+ let t2;
70
+ let trailing;
71
+ if ($[0] !== t0) {
72
+ const { children: t3, leading: t4, supporting: t5, trailing: t6, ...props } = t0;
73
+ children = t3;
74
+ leading = t4;
75
+ supporting = t5;
76
+ trailing = t6;
77
+ T0 = ListBoxItem;
78
+ t1 = props;
79
+ t2 = mergeStatefulStyles(itemStyles, props);
80
+ $[0] = t0;
81
+ $[1] = T0;
82
+ $[2] = children;
83
+ $[3] = leading;
84
+ $[4] = supporting;
85
+ $[5] = t1;
86
+ $[6] = t2;
87
+ $[7] = trailing;
88
+ } else {
89
+ T0 = $[1];
90
+ children = $[2];
91
+ leading = $[3];
92
+ supporting = $[4];
93
+ t1 = $[5];
94
+ t2 = $[6];
95
+ trailing = $[7];
96
+ }
97
+ let t3;
98
+ if ($[8] !== children || $[9] !== leading || $[10] !== supporting || $[11] !== trailing) {
99
+ t3 = itemContent(children, leading, supporting, trailing);
100
+ $[8] = children;
101
+ $[9] = leading;
102
+ $[10] = supporting;
103
+ $[11] = trailing;
104
+ $[12] = t3;
105
+ } else t3 = $[12];
106
+ let t4;
107
+ if ($[13] !== T0 || $[14] !== t1 || $[15] !== t2 || $[16] !== t3) {
108
+ t4 = /* @__PURE__ */ jsx(T0, {
109
+ ...t1,
110
+ ...t2,
111
+ children: t3
112
+ });
113
+ $[13] = T0;
114
+ $[14] = t1;
115
+ $[15] = t2;
116
+ $[16] = t3;
117
+ $[17] = t4;
118
+ } else t4 = $[17];
119
+ return t4;
120
+ }
121
+ /**
122
+ * The row the list shows while it is fetching more. React Aria calls
123
+ * `onLoadMore` when this comes into view, and draws it only while
124
+ * `isLoading` — so a list that pages as it scrolls needs nothing else.
125
+ */
126
+ function ListBoxLoadMore({ label = "Loading more", ...props }) {
127
+ return /* @__PURE__ */ jsx(ListBoxLoadMoreItem, {
128
+ ...props,
129
+ ...mergeStyles({ className: "x6s0dn4 x9f619 x78zum5 xl56j7k xbktkl8" }, props),
130
+ children: /* @__PURE__ */ jsx(ProgressIndicator, {
131
+ "aria-label": label,
132
+ isIndeterminate: true,
133
+ size: "24px",
134
+ variant: "circular"
135
+ })
136
+ });
137
+ }
138
+ /**
139
+ * A named group of options. `header` names it, and is what a screen reader
140
+ * reads before the options inside.
141
+ */
142
+ function ListBoxSection$1(t0) {
143
+ const $ = c(14);
144
+ let T0;
145
+ let children;
146
+ let header;
147
+ let t1;
148
+ let t2;
149
+ if ($[0] !== t0) {
150
+ const { children: t3, header: t4, ...props } = t0;
151
+ children = t3;
152
+ header = t4;
153
+ T0 = ListBoxSection;
154
+ t1 = props;
155
+ t2 = mergeStyles({ className: "x9f619 x78zum5 xdt5ytf" }, props);
156
+ $[0] = t0;
157
+ $[1] = T0;
158
+ $[2] = children;
159
+ $[3] = header;
160
+ $[4] = t1;
161
+ $[5] = t2;
162
+ } else {
163
+ T0 = $[1];
164
+ children = $[2];
165
+ header = $[3];
166
+ t1 = $[4];
167
+ t2 = $[5];
168
+ }
169
+ let t3;
170
+ if ($[6] !== header) {
171
+ t3 = header === void 0 ? null : /* @__PURE__ */ jsx(Header, {
172
+ className: "x9f619 x1w5n3ug xrgwony x12s497w x1szcwkt xo803ec xyl1r0q xw3mh6e x1clyivc x790zyz",
173
+ children: header
174
+ });
175
+ $[6] = header;
176
+ $[7] = t3;
177
+ } else t3 = $[7];
178
+ let t4;
179
+ if ($[8] !== T0 || $[9] !== children || $[10] !== t1 || $[11] !== t2 || $[12] !== t3) {
180
+ t4 = /* @__PURE__ */ jsxs(T0, {
181
+ ...t1,
182
+ ...t2,
183
+ children: [t3, children]
184
+ });
185
+ $[8] = T0;
186
+ $[9] = children;
187
+ $[10] = t1;
188
+ $[11] = t2;
189
+ $[12] = t3;
190
+ $[13] = t4;
191
+ } else t4 = $[13];
192
+ return t4;
193
+ }
194
+ ListBox$1.Item = ListBoxItem$1;
195
+ ListBox$1.LoadMore = ListBoxLoadMore;
196
+ ListBox$1.Section = ListBoxSection$1;
197
+ //#endregion
198
+ export { ListBox$1 as default };
199
+
200
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["props","header","children"],"sources":["../../../src/components/list-box/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ListBoxItemRenderProps, ListBoxItemProps as RACListBoxItemProps, ListBoxLoadMoreItemProps as RACListBoxLoadMoreItemProps, ListBoxProps as RACListBoxProps, ListBoxSectionProps as RACListBoxSectionProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Header, ListBox as RACListBox, ListBoxItem as RACListBoxItem, ListBoxLoadMoreItem as RACListBoxLoadMoreItem, ListBoxSection as RACListBoxSection } from 'react-aria-components';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing, typography } from '../../tokens/design.tokens.stylex';\nimport ProgressIndicator from '../progress-indicator';\n\n// The lists page's selectable list. Each option is the row every list here\n// draws — `src/row`, shared with ListItem and with every collection the\n// coverage plan adds after this one — so the 56dp floor, the body-large\n// headline, the body-medium supporting line, the state layers and the\n// disabled treatment are all that module's and none of them is written\n// again. What is here is the container around those rows, the section and\n// its header, and the row the list shows while it is fetching more.\n//\n// The container takes the page's 8dp above and below its rows and no\n// background of its own, which is what lets the same list sit on the page\n// and inside a popover without knowing which it is in. Select, ComboBox and\n// Autocomplete are each a field plus one of these in an overlay, so that is\n// not a detail — it is the reason the container is transparent.\n//\n// A selected option takes primary container and on primary container, the\n// page's selected state, through the row module's `list` variant. The page\n// also draws a checkbox in the trailing slot on a list that selects more\n// than one; that is left to the call site rather than added by the option,\n// since which of the two affordances a list wants is the list's decision and\n// the slot is already there for it.\n//\n// Three things are worth knowing about how this maps onto React Aria.\n//\n// **The option's styles are a function of its render state.** StyleX cannot\n// target `[data-selected]` on the element it is styling, so selection,\n// disabled and the rest are read from the state React Aria hands the\n// `className` function — the same mechanism Tabs and Chip use, wrapped in\n// `mergeStatefulStyles` so a call site's own `className` survives.\n//\n// **A section's heading is React Aria's `Header`**, which is what points the\n// section's `aria-labelledby` at it. The lists page names no subhead in its\n// anatomy, so the type is title-small in on surface variant at the row's own\n// 16dp inline padding, which is what the page's own guidance draws.\n//\n// **The load-more row is a sentinel, not a button.** React Aria's\n// `ListBoxLoadMoreItem` calls `onLoadMore` when it comes into view and\n// renders whatever it is given while `isLoading`; ours renders the ring, so\n// a list that fetches as it scrolls says so with the same indicator every\n// other pending state in the library uses.\n\ntype ListBoxItemProps<T extends object = object> = {\n /** The option's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /** A function may compute the class from the option's render state. */\n className?: RACListBoxItemProps<T>['className'];\n /** Content before the headline: an avatar, an icon, a checkbox. */\n leading?: ReactNode;\n /** A function may compute the style from the option's render state. */\n style?: RACListBoxItemProps<T>['style'];\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as an amount or a control. */\n trailing?: ReactNode;\n} & Omit<RACListBoxItemProps<T>, 'children' | 'className' | 'style'>;\ntype ListBoxLoadMoreProps = Omit<RACListBoxLoadMoreItemProps, 'children'> & {\n /**\n * What the row says while it is loading. Read by a screen reader; the ring\n * itself carries no text.\n * @default 'Loading more'\n */\n label?: string;\n};\ntype ListBoxProps<T extends object> = Omit<RACListBoxProps<T>, 'className' | 'style'> & {\n /** A function may compute the class from the list's render state. */\n className?: RACListBoxProps<T>['className'];\n /** A function may compute the style from the list's render state. */\n style?: RACListBoxProps<T>['style'];\n};\ntype ListBoxSectionProps<T extends object = object> = Omit<RACListBoxSectionProps<T>, 'children'> & {\n /**\n * The options 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// What the option 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.\n//\n// It reads the render state for one thing: which colour the supporting line\n// takes. The muted role the page gives it holds only on the surface — over a\n// selected row's container it is a second colour family, and on a disabled\n// row it stays at full strength while the headline above it fades. The row\n// module decides; this hands it the two flags.\nfunction itemContent(children: ReactNode, leading: ReactNode, supporting: ReactNode, trailing: ReactNode) {\n return (state: ListBoxItemRenderProps) => <RowContent isDisabled={state.isDisabled} isSelected={state.isSelected} leading={leading} supporting={supporting} trailing={trailing}>\n {children}\n </RowContent>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so an\n// option'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 selected branches, and StyleX replaces a property\n// whole, so it takes their hover states with it.\nfunction itemStyles(state: ListBoxItemRenderProps) {\n return stylex.props(rowStyles.base, rowStyles.list, rowStyles.interactive, state.isSelected && rowStyles.selectedList, state.isDisabled && rowStyles.disabled);\n}\n\n/**\n * A list of options one or more of which can be selected. Selection is React\n * Aria's: set `selectionMode` to `single` or `multiple`, and pass\n * `selectedKeys` with `onSelectionChange` to control it or\n * `defaultSelectedKeys` to let it keep its own. A list that only responds to\n * a press takes `onAction` on the option instead.\n *\n * Composed from parts, since an option's slots take arbitrary content:\n * `ListBox.Item`, `ListBox.Section` and `ListBox.LoadMore`. Name the list\n * with `aria-label` or `aria-labelledby` — nothing here labels it for you.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction ListBox<T extends object>(props: ListBoxProps<T>) {\n return <RACListBox {...props} {...mergeStatefulStyles({\n className: \"x9f619 x78zum5 xdt5ytf x1t137rt x1cmllll\"\n }, props)} />;\n}\n\n/**\n * One option. Its slots are the row's: `leading`, the headline as children,\n * `supporting` under it, and `trailing`. Give every option an `id` — that is\n * the key selection is reported by.\n */\nfunction ListBoxItem<T extends object = object>({\n children,\n leading,\n supporting,\n trailing,\n ...props\n}: ListBoxItemProps<T>) {\n return <RACListBoxItem {...props} {...mergeStatefulStyles(itemStyles, props)}>\n {itemContent(children, leading, supporting, trailing)}\n </RACListBoxItem>;\n}\n\n/**\n * The row the list shows while it is fetching more. React Aria calls\n * `onLoadMore` when this comes into view, and draws it only while\n * `isLoading` — so a list that pages as it scrolls needs nothing else.\n */\nfunction ListBoxLoadMore({\n label = 'Loading more',\n ...props\n}: ListBoxLoadMoreProps) {\n return <RACListBoxLoadMoreItem {...props} {...mergeStyles({\n className: \"x6s0dn4 x9f619 x78zum5 xl56j7k xbktkl8\"\n }, props)}>\n <ProgressIndicator aria-label={label} isIndeterminate size=\"24px\" variant=\"circular\" />\n </RACListBoxLoadMoreItem>;\n}\n\n/**\n * A named group of options. `header` names it, and is what a screen reader\n * reads before the options inside.\n */\nfunction ListBoxSection<T extends object = object>({\n children,\n header,\n ...props\n}: ListBoxSectionProps<T>) {\n return <RACListBoxSection {...props} {...mergeStyles({\n className: \"x9f619 x78zum5 xdt5ytf\"\n }, props)}>\n {header === undefined ? null : <Header className=\"x9f619 x1w5n3ug xrgwony x12s497w x1szcwkt xo803ec xyl1r0q xw3mh6e x1clyivc x790zyz\">{header}</Header>}\n {children}\n </RACListBoxSection>;\n}\nListBox.Item = ListBoxItem;\nListBox.LoadMore = ListBoxLoadMore;\nListBox.Section = ListBoxSection;\nexport type { ListBoxItemProps, ListBoxLoadMoreProps, ListBoxProps, ListBoxSectionProps };\nexport default ListBox;"],"mappings":";;;;;;;;;AAuGA,SAAS,YAAY,UAAqB,SAAoB,YAAuB,UAAqB;CACxG,QAAQ,UAAkC,oBAAC,YAAD;EAAY,YAAY,MAAM;EAAY,YAAY,MAAM;EAAqB;EAAqB;EAAsB;EACjK;CACS,CAAA;AAChB;AAOA,SAAS,WAAW,OAA+B;CACjD,OAAO,MAAa,UAAU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AA,SAAA,EAAA;EAAA,KAAA,EAAA;EAAA,KAAA,EAAA;CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,QAAA;EACJ,KAAA,WAAW,KAAA,IAAX,OAA8B,oBAAC,QAAD;GAAkB,WAAA;GAAsF,UAAA;EAAjG,CAAA;EAAiH,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,MAAA,EAAA,OAAA,YAAA,EAAA,QAAA,MAAA,EAAA,QAAA,MAAA,EAAA,QAAA,IAAA;EAHpJ,KAAA,qBAAC,IAAD;GAAkB,GAAKA;GAAK,GAAM;GAAlC,UAAA,CAGF,IACA,QAJoB;;EAKH,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OALf;AAKe;AAExB,UAAQ,OAAO;AACf,UAAQ,WAAW;AACnB,UAAQ,UAAU"}
@@ -0,0 +1,151 @@
1
+ import { OverlayAlign, OverlaySide } from "../../styles/overlay.js";
2
+ import Separator$1 from "../separator/index.js";
3
+ import { ComponentProps, ReactElement, ReactNode } from "react";
4
+ import { MenuItemProps, MenuLoadMoreItemProps, MenuProps, MenuSectionProps, MenuTriggerProps } from "react-aria-components";
5
+ //#region src/components/menu/index.d.ts
6
+ type MenuAlign = OverlayAlign;
7
+ type MenuContentProps<T extends object = object> = Omit<MenuProps<T>, 'className' | 'style'> & {
8
+ /** Where the menu lines up along that side. @default 'start' */
9
+ align?: MenuAlign;
10
+ /** Moves the menu along that side, in pixels. */
11
+ alignOffset?: number;
12
+ /** A function may compute the class from the menu's render state. */
13
+ className?: MenuProps<T>['className'];
14
+ /**
15
+ * Where to portal the menu. Defaults to the end of `<body>`, which is right
16
+ * for an app that sets its StyleX theme on `:root`. An app that scopes the
17
+ * theme to a subtree has to point this at an element inside it, or the menu
18
+ * renders outside the theme and falls back to the tokens'
19
+ * `prefers-color-scheme` default.
20
+ */
21
+ container?: Element;
22
+ /** Which side of the trigger the menu opens on. @default 'bottom' */
23
+ side?: MenuSide;
24
+ /** How far the menu sits from the trigger, in pixels. @default 8 */
25
+ sideOffset?: number;
26
+ /** A function may compute the style from the menu's render state. */
27
+ style?: MenuProps<T>['style'];
28
+ };
29
+ type MenuItemProps$1<T extends object = object> = {
30
+ /** The item's label — what it does. */
31
+ children?: ReactNode;
32
+ /** A function may compute the class from the item's render state. */
33
+ className?: MenuItemProps<T>['className'];
34
+ /** Content before the label, usually an icon. */
35
+ leading?: ReactNode;
36
+ /**
37
+ * The keystroke that runs the item, drawn as a keycap at the end. Goes
38
+ * through React Aria's keyboard slot, so a screen reader announces it
39
+ * apart from the label rather than reading the two as one name.
40
+ */
41
+ shortcut?: ReactNode;
42
+ /** A function may compute the style from the item's render state. */
43
+ style?: MenuItemProps<T>['style'];
44
+ /** Content after the label, before the shortcut. */
45
+ trailing?: ReactNode;
46
+ } & Omit<MenuItemProps<T>, 'children' | 'className' | 'style'>;
47
+ type MenuLoadMoreProps = Omit<MenuLoadMoreItemProps, 'children'> & {
48
+ /**
49
+ * What the row says while it is loading. Read by a screen reader; the ring
50
+ * itself carries no text.
51
+ * @default 'Loading more'
52
+ */
53
+ label?: string;
54
+ };
55
+ type MenuProps$1 = Omit<MenuTriggerProps, 'children'> & {
56
+ /** The trigger, then the `Menu.Content` it opens. */
57
+ children?: ReactNode;
58
+ };
59
+ type MenuSectionProps$1<T extends object = object> = Omit<MenuSectionProps<T>, 'children'> & {
60
+ /**
61
+ * The items in the section. A section built from data puts React Aria's
62
+ * `Collection` in here rather than a render function, since the header is
63
+ * an element beside them.
64
+ */
65
+ children?: ReactNode;
66
+ /**
67
+ * The section's heading, rendered through React Aria's header so the
68
+ * section is named by it. A section without one is a group with no name.
69
+ */
70
+ header?: ReactNode;
71
+ };
72
+ type MenuSeparatorProps = Omit<ComponentProps<typeof Separator$1>, 'orientation'>;
73
+ type MenuSide = OverlaySide;
74
+ type MenuSubmenuProps = {
75
+ /**
76
+ * The item that opens the submenu, then the `Menu.Content` it opens.
77
+ * Exactly those two, in that order.
78
+ */
79
+ children: ReactElement[];
80
+ /**
81
+ * How long the pointer rests on the item before the submenu opens, in
82
+ * milliseconds.
83
+ * @default 200
84
+ */
85
+ delay?: number;
86
+ };
87
+ /**
88
+ * A list of actions opened from a control. Open state is React Aria's: pass
89
+ * `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it keep
90
+ * its own.
91
+ *
92
+ * A `Button` or `IconButton` placed directly inside opens it; everything the
93
+ * menu shows goes in `Menu.Content`, since the trigger lives in the page
94
+ * while the menu is portalled out to the end of the body.
95
+ *
96
+ * ```tsx
97
+ * <Menu>
98
+ * <Button>Open</Button>
99
+ * <Menu.Content aria-label="Label">
100
+ * <Menu.Item id="first">First item</Menu.Item>
101
+ * </Menu.Content>
102
+ * </Menu>
103
+ * ```
104
+ */
105
+ declare function Menu$1({ children, ...props }: MenuProps$1): import("react").JSX.Element;
106
+ declare namespace Menu$1 {
107
+ var Content: typeof MenuContent;
108
+ var Item: typeof MenuItem$1;
109
+ var LoadMore: typeof MenuLoadMore;
110
+ var Section: typeof MenuSection$1;
111
+ var Separator: typeof MenuSeparator;
112
+ var Submenu: typeof MenuSubmenu;
113
+ }
114
+ /**
115
+ * The menu itself, and the surface it is drawn on. React Aria names it after
116
+ * the control that opened it, so `aria-label` here is ignored — name the
117
+ * trigger instead.
118
+ *
119
+ * The call site's `className` and `style` land on the surface, which is the
120
+ * element a layout positions.
121
+ */
122
+ declare function MenuContent<T extends object = object>({ align, alignOffset, className, container, side, sideOffset, style, ...props }: MenuContentProps<T>): import("react").JSX.Element;
123
+ /**
124
+ * One action. Its slots are the row's: `leading` before the label, the label
125
+ * as children, and `trailing` after it, with `shortcut` at the end. An item
126
+ * that opens a submenu draws the chevron itself.
127
+ */
128
+ declare function MenuItem$1<T extends object = object>({ children, leading, shortcut, trailing, ...props }: MenuItemProps$1<T>): import("react").JSX.Element;
129
+ /**
130
+ * The row shown while more items are being fetched. React Aria calls
131
+ * `onLoadMore` when it comes into view, and draws it only while `isLoading`.
132
+ */
133
+ declare function MenuLoadMore({ label, ...props }: MenuLoadMoreProps): import("react").JSX.Element;
134
+ /**
135
+ * A named group of items. `header` names it, and is what a screen reader
136
+ * reads before the items inside.
137
+ */
138
+ declare function MenuSection$1<T extends object = object>({ children, header, ...props }: MenuSectionProps$1<T>): import("react").JSX.Element;
139
+ /**
140
+ * A rule between groups of items. It takes its role from the menu around it,
141
+ * so it needs no slot from the call site.
142
+ */
143
+ declare function MenuSeparator(props: MenuSeparatorProps): import("react").JSX.Element;
144
+ /**
145
+ * An item that opens a menu of its own. Takes exactly two children: the
146
+ * `Menu.Item` that opens it, then the `Menu.Content` it opens.
147
+ */
148
+ declare function MenuSubmenu(props: MenuSubmenuProps): import("react").JSX.Element;
149
+ //#endregion
150
+ export { type MenuAlign, type MenuContentProps, type MenuItemProps$1 as MenuItemProps, type MenuLoadMoreProps, type MenuProps$1 as MenuProps, type MenuSectionProps$1 as MenuSectionProps, type MenuSeparatorProps, type MenuSide, type MenuSubmenuProps, Menu$1 as default };
151
+ //# sourceMappingURL=index.d.ts.map