@milktop/react-ui 0.2.1 → 0.2.3

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/README.md CHANGED
@@ -35,6 +35,13 @@ so a hand-built component looks just like the shortcut:
35
35
  No CLI and no copied snippets: every shortcut ships in the package, and
36
36
  where one doesn't fit you build from the parts.
37
37
 
38
+ Our own parts hang off their component the same way, so one import covers
39
+ them: `Sidebar.Section`, `Sidebar.Item`, `Menu.Item`, `Tabs.Tab`,
40
+ `Accordion.Item`. Where one of ours takes a name Ark also uses, Ark's part
41
+ moves aside (`Accordion.RawItem`). They're also exported by name
42
+ (`NavSection`, `MenuItem`, `Tab`…), for imports by name and, later, server
43
+ components; the dotted form is the one the docs use.
44
+
38
45
  ## Components
39
46
 
40
47
  So far:
@@ -57,18 +64,17 @@ So far:
57
64
  - Forms: Field · Fields
58
65
  - Overlays: Tooltip · Popover · HoverCard · Dialog · Sheet (both: props or
59
66
  composed from Header/Body/Footer) · ActionBar · Menu · ContextMenu (Menu.Item,
60
- Separator, Group, Checkbox, RadioGroup/Radio, Submenu; also as MenuItem…) ·
67
+ Separator, Group, Checkbox, RadioGroup/Radio, Submenu) ·
61
68
  Toaster (`toaster.success(…)` from anywhere) · `confirm()` (`await confirm({ … })`
62
69
  from anywhere, no state or markup)
63
70
  - Scheduling and ordering (React only): EventCalendar (day, n days, work week or
64
71
  week by the hour, with resources such as vets or rooms as columns; drag to
65
72
  select a time, drag or arrow-key events to move and resize them, all-day
66
73
  events, a date jump) · SortableList (drag or keyboard, on dnd-kit)
67
- - Disclosure: Tabs/Tab (with counts and dots, inline or in the corner) · Accordion · Collapsible
74
+ - Disclosure: Tabs (Tabs.Tab, with counts and dots, inline or in the corner) · Accordion · Collapsible
68
75
  - Navigation: AppShell (flat or inset; the sidebar collapses to a rail with ⌘B
69
76
  and is a drawer on phones; inset, or `scroll="page"`, scrolls only the page
70
- on wide screens) · Topbar · Sidebar (NavSection, NavGroup, NavItem,
71
- SidebarUser; also Sidebar.Section…) · Page · Breadcrumbs · Command (⌘K)
77
+ on wide screens) · Topbar · Sidebar (Sidebar.Section, Group, Item, User) · Page · Breadcrumbs · Command (⌘K)
72
78
 
73
79
  That's all of svelte-ui's components.
74
80
 
package/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ export { colorScheme, useColorScheme, type Scheme } from './color-scheme.js';
29
29
  export { Appearance } from './appearance-panel/Appearance.js';
30
30
  export { appearance, useAppearance, accents, accentScale, accentSteps, sidebarStyles, type AccentName, type AppearanceValue, type SidebarStyle, } from './appearance.js';
31
31
  export { Tooltip } from './tooltip/Tooltip.js';
32
- export { Menu, ContextMenu, MenuItem, MenuSeparator, MenuGroup, MenuCheckbox, MenuRadioGroup, MenuRadio, Submenu, type MenuEntry, type MenuOptionChange, } from './menu/Menu.js';
32
+ export { Menu, ContextMenu, MenuItem, MenuSeparator, MenuGroup, MenuCheckbox, MenuRadioGroup, MenuRadio, Submenu, type MenuEntry, type MenuOptionChange, type MenuIndicator, } from './menu/Menu.js';
33
33
  export { Tabs, Tab } from './tabs/Tabs.js';
34
34
  export { Dialog } from './dialog/Dialog.js';
35
35
  export { confirm, type ConfirmOptions } from './confirm/confirm.js';
@@ -29,6 +29,10 @@
29
29
  * component must pass them on, as Button does)
30
30
  * - `placement`: 'bottom-start' (default), 'bottom-end', …
31
31
  * - `label`: a small label above the items
32
+ * - `indicator`: where checkbox and radio items show they're checked: 'end'
33
+ * (default; a tick after the label, so labels line up with the other
34
+ * items) or 'start' (a tick, or a dot for radios, before it); submenus
35
+ * follow their menu's unless they set one
32
36
  * - `keepOpen`: stay open after an item is chosen (to tick several); an
33
37
  * item's own `keepOpen` overrides it
34
38
  * - `context`: open on right-click (or long-press) of the trigger, at the
@@ -48,6 +52,7 @@ import { type Classes } from '../utils.js';
48
52
  import '../theme.css';
49
53
  import './menu.css';
50
54
  type Value = string | number;
55
+ export type MenuIndicator = 'start' | 'end';
51
56
  export type MenuEntry = string | number | {
52
57
  label?: ReactNode;
53
58
  value?: Value;
@@ -157,15 +162,17 @@ declare function Radio({ value, icon, shortcut, disabled, keepOpen, children }:
157
162
  * </Menu.Submenu>
158
163
  *
159
164
  * - `label`: the row's text; `icon`: an optional Iconify name before it
160
- * - `items`: as on Menu; `keepOpen` for its items (it follows its menu)
165
+ * - `items`: as on Menu; `keepOpen` and `indicator` for its items (they
166
+ * follow its menu's)
161
167
  *
162
168
  * Its items' selections reach the outer Menu's `onSelect`.
163
169
  */
164
- declare function Submenu({ label, icon, items, keepOpen, className, children }: {
170
+ declare function Submenu({ label, icon, items, keepOpen, indicator, className, children }: {
165
171
  label: ReactNode;
166
172
  icon?: string | null;
167
173
  items?: MenuEntry[];
168
174
  keepOpen?: boolean | null;
175
+ indicator?: MenuIndicator | null;
169
176
  className?: string;
170
177
  children?: ReactNode;
171
178
  }): import("react").JSX.Element;
@@ -177,6 +184,7 @@ export type MenuProps = Omit<Ark.ContentProps, 'onSelect' | 'onChange'> & {
177
184
  trigger?: ReactElement | null;
178
185
  placement?: NonNullable<Ark.RootProps['positioning']>['placement'];
179
186
  label?: ReactNode;
187
+ indicator?: MenuIndicator;
180
188
  keepOpen?: boolean;
181
189
  context?: boolean;
182
190
  open?: boolean;
@@ -186,7 +194,7 @@ export type MenuProps = Omit<Ark.ContentProps, 'onSelect' | 'onChange'> & {
186
194
  onChange?: (change: MenuOptionChange) => void;
187
195
  classes?: Classes<'positioner' | 'content' | 'menuLabel'>;
188
196
  };
189
- declare function MenuShortcut({ items, labelKey, valueKey, disabledKey, trigger, placement, label, keepOpen, context, open, defaultOpen, onOpenChange, onSelect, onChange, className, classes, children, ...rest }: MenuProps): import("react").JSX.Element;
197
+ declare function MenuShortcut({ items, labelKey, valueKey, disabledKey, trigger, placement, label, indicator, keepOpen, context, open, defaultOpen, onOpenChange, onSelect, onChange, className, classes, children, ...rest }: MenuProps): import("react").JSX.Element;
190
198
  export declare const Menu: typeof MenuShortcut & {
191
199
  Item: typeof Item;
192
200
  Separator: typeof Separator;
package/dist/menu/Menu.js CHANGED
@@ -30,6 +30,10 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
30
30
  * component must pass them on, as Button does)
31
31
  * - `placement`: 'bottom-start' (default), 'bottom-end', …
32
32
  * - `label`: a small label above the items
33
+ * - `indicator`: where checkbox and radio items show they're checked: 'end'
34
+ * (default; a tick after the label, so labels line up with the other
35
+ * items) or 'start' (a tick, or a dot for radios, before it); submenus
36
+ * follow their menu's unless they set one
33
37
  * - `keepOpen`: stay open after an item is chosen (to tick several); an
34
38
  * item's own `keepOpen` overrides it
35
39
  * - `context`: open on right-click (or long-press) of the trigger, at the
@@ -109,7 +113,7 @@ function Checkbox({ checked, defaultChecked = false, onCheckedChange, value, ico
109
113
  const id = useId();
110
114
  const [own, setOwn] = useState(defaultChecked);
111
115
  const on = checked ?? own;
112
- return (_jsxs(Ark.CheckboxItem, { ...menu.part('item'), value: String(value ?? id), checked: on, disabled: !!disabled, ...closeFor(keepOpen), onCheckedChange: (next) => { setOwn(next); onCheckedChange?.(next); }, children: [_jsx("span", { ...menu.part('indicator'), children: _jsx(Ark.ItemIndicator, { ...menu.part('item-indicator'), "data-type": "checkbox", children: _jsx("iconify-icon", { icon: "lucide:check", "aria-hidden": "true" }) }) }), _jsx(ItemInside, { part: menu.part, icon: icon, shortcut: shortcut, children: children })] }));
116
+ return (_jsxs(Ark.CheckboxItem, { ...menu.part('item'), value: String(value ?? id), checked: on, disabled: !!disabled, ...closeFor(keepOpen), onCheckedChange: (next) => { setOwn(next); onCheckedChange?.(next); }, children: [_jsx("span", { ...menu.part('indicator'), "data-side": menu.indicator, children: _jsx(Ark.ItemIndicator, { ...menu.part('item-indicator'), "data-type": "checkbox", children: _jsx("iconify-icon", { icon: "lucide:check", "aria-hidden": "true" }) }) }), _jsx(ItemInside, { part: menu.part, icon: icon, shortcut: shortcut, children: children })] }));
113
117
  }
114
118
  // A radio group's id and value, for its radios.
115
119
  const RadioContext = createContext(null);
@@ -152,7 +156,7 @@ function Radio({ value, icon = null, shortcut = null, disabled = false, keepOpen
152
156
  const values = useContext(RadioValues);
153
157
  const key = `${group?.id}/${value}`;
154
158
  values?.set(key, value);
155
- return (_jsxs(Ark.RadioItem, { ...menu.part('item'), value: key, disabled: !!disabled, ...closeFor(keepOpen), children: [_jsx("span", { ...menu.part('indicator'), children: _jsx(Ark.ItemIndicator, { ...menu.part('item-indicator'), "data-type": "radio" }) }), _jsx(ItemInside, { part: menu.part, icon: icon, shortcut: shortcut, children: children })] }));
159
+ return (_jsxs(Ark.RadioItem, { ...menu.part('item'), value: key, disabled: !!disabled, ...closeFor(keepOpen), children: [_jsx("span", { ...menu.part('indicator'), "data-side": menu.indicator, children: _jsx(Ark.ItemIndicator, { ...menu.part('item-indicator'), "data-type": "radio", children: menu.indicator === 'end' && _jsx("iconify-icon", { icon: "lucide:check", "aria-hidden": "true" }) }) }), _jsx(ItemInside, { part: menu.part, icon: icon, shortcut: shortcut, children: children })] }));
156
160
  }
157
161
  /**
158
162
  * A submenu inside a Menu (or another Submenu): a row that opens a nested
@@ -163,15 +167,17 @@ function Radio({ value, icon = null, shortcut = null, disabled = false, keepOpen
163
167
  * </Menu.Submenu>
164
168
  *
165
169
  * - `label`: the row's text; `icon`: an optional Iconify name before it
166
- * - `items`: as on Menu; `keepOpen` for its items (it follows its menu)
170
+ * - `items`: as on Menu; `keepOpen` and `indicator` for its items (they
171
+ * follow its menu's)
167
172
  *
168
173
  * Its items' selections reach the outer Menu's `onSelect`.
169
174
  */
170
- function Submenu({ label, icon = null, items = [], keepOpen = null, className, children }) {
175
+ function Submenu({ label, icon = null, items = [], keepOpen = null, indicator = null, className, children }) {
171
176
  const outer = useMenu();
172
177
  const part = outer.part;
173
178
  const stays = keepOpen ?? outer.keepOpen;
174
- return (_jsxs(Ark.Root, { closeOnSelect: !stays, positioning: { placement: 'right-start', strategy: 'fixed', gutter: 2 }, navigate: (details) => details.node.click(), onSelect: (details) => outer.select(details.value), children: [_jsxs(Ark.TriggerItem, { ...part('item'), children: [icon && _jsx("iconify-icon", { ...part('icon'), icon: icon, "aria-hidden": "true" }), _jsx("span", { ...part('label'), children: label }), _jsx("iconify-icon", { ...part('chevron'), icon: "lucide:chevron-right", "aria-hidden": "true" })] }), _jsx(Ark.Positioner, { ...part('positioner'), children: _jsx(Ark.Content, { ...part('content'), className: className, children: _jsxs(MenuContext.Provider, { value: { ...outer, keepOpen: stays }, children: [_jsx(Entries, { items: items }), children] }) }) })] }));
179
+ const side = indicator ?? outer.indicator;
180
+ return (_jsxs(Ark.Root, { closeOnSelect: !stays, positioning: { placement: 'right-start', strategy: 'fixed', gutter: 2 }, navigate: (details) => details.node.click(), onSelect: (details) => outer.select(details.value), children: [_jsxs(Ark.TriggerItem, { ...part('item'), children: [icon && _jsx("iconify-icon", { ...part('icon'), icon: icon, "aria-hidden": "true" }), _jsx("span", { ...part('label'), children: label }), _jsx("iconify-icon", { ...part('chevron'), icon: "lucide:chevron-right", "aria-hidden": "true" })] }), _jsx(Ark.Positioner, { ...part('positioner'), children: _jsx(Ark.Content, { ...part('content'), className: className, children: _jsxs(MenuContext.Provider, { value: { ...outer, keepOpen: stays, indicator: side }, children: [_jsx(Entries, { items: items }), children] }) }) })] }));
175
181
  }
176
182
  // A checkbox or radio entry from `items`, checked by the root menu. Zag's
177
183
  // option props straight onto it: Ark's RadioItem wants a RadioItemGroup round it.
@@ -183,7 +189,7 @@ function Option({ entry, optionKey, label, disabled, siblings }) {
183
189
  valueText: typeof label === 'string' ? label : optionKey, ...closeFor(entry.keepOpen),
184
190
  onCheckedChange: (on) => menu.check(entry, optionKey, on, siblings),
185
191
  };
186
- return (_jsxs("div", { ...api.getOptionItemProps(props), ...menu.part('item'), "data-danger": entry.danger || undefined, children: [_jsx("span", { ...menu.part('indicator'), children: _jsx("span", { ...api.getItemIndicatorProps(props), ...menu.part('item-indicator'), "data-type": entry.type, children: entry.type === 'checkbox' && _jsx("iconify-icon", { icon: "lucide:check", "aria-hidden": "true" }) }) }), entry.icon && _jsx("iconify-icon", { ...menu.part('icon'), icon: entry.icon, "aria-hidden": "true" }), _jsx("span", { ...menu.part('label'), children: label }), entry.shortcut && _jsx("kbd", { ...menu.part('shortcut'), children: entry.shortcut })] }));
192
+ return (_jsxs("div", { ...api.getOptionItemProps(props), ...menu.part('item'), "data-danger": entry.danger || undefined, children: [_jsx("span", { ...menu.part('indicator'), "data-side": menu.indicator, children: _jsx("span", { ...api.getItemIndicatorProps(props), ...menu.part('item-indicator'), "data-type": entry.type, children: (entry.type === 'checkbox' || menu.indicator === 'end') && _jsx("iconify-icon", { icon: "lucide:check", "aria-hidden": "true" }) }) }), entry.icon && _jsx("iconify-icon", { ...menu.part('icon'), icon: entry.icon, "aria-hidden": "true" }), _jsx("span", { ...menu.part('label'), children: label }), entry.shortcut && _jsx("kbd", { ...menu.part('shortcut'), children: entry.shortcut })] }));
187
193
  }
188
194
  // A menu's `items` array, as the components above.
189
195
  function Entries({ items }) {
@@ -210,13 +216,13 @@ function Entries({ items }) {
210
216
  return (_jsx(Item, { value: value, href: entry.href, icon: entry.icon, shortcut: entry.shortcut, danger: entry.danger, disabled: disabled, keepOpen: entry.keepOpen, children: label }, i));
211
217
  }) });
212
218
  }
213
- function MenuShortcut({ items = [], labelKey = 'label', valueKey = 'value', disabledKey = 'disabled', trigger = null, placement = 'bottom-start', label = null, keepOpen = false, context = false, open, defaultOpen, onOpenChange, onSelect, onChange, className, classes, children, ...rest }) {
219
+ function MenuShortcut({ items = [], labelKey = 'label', valueKey = 'value', disabledKey = 'disabled', trigger = null, placement = 'bottom-start', label = null, indicator = 'end', keepOpen = false, context = false, open, defaultOpen, onOpenChange, onSelect, onChange, className, classes, children, ...rest }) {
214
220
  const part = partsOf('menu', classes);
215
221
  const values = useRef(new Map());
216
222
  // `items` checkbox and radio entries, starting from their own `checked`.
217
223
  const [checks, setChecks] = useState({});
218
224
  const shared = {
219
- part, keepOpen, keys: { labelKey, valueKey, disabledKey },
225
+ part, keepOpen, indicator, keys: { labelKey, valueKey, disabledKey },
220
226
  remember: (key, value) => { values.current.set(key, value); },
221
227
  select: (key) => { if (values.current.has(key))
222
228
  onSelect?.(values.current.get(key)); },
@@ -28,6 +28,9 @@
28
28
  [data-scope=menu][data-part=item-indicator] {
29
29
  &[data-type=checkbox] { display: block; font-size: 14px; color: var(--ui-accent); }
30
30
  &[data-type=radio] { display: block; width: 6px; height: 6px; border-radius: 9999px; background: var(--ui-accent); box-shadow: 0 0 0 3px var(--ui-accent-soft); } }
31
+ /* indicator='end' (the default): a tick after the label and any shortcut, for radios too. */
32
+ [data-scope=menu][data-part=indicator][data-side=end] { order: 1;
33
+ & > [data-type=radio] { width: auto; height: auto; font-size: 14px; color: var(--ui-accent); border-radius: 0; background: none; box-shadow: none; } }
31
34
  [data-scope=menu][data-part=chevron] { display: block; font-size: 14px; margin-left: auto; color: var(--ui-muted); }
32
35
  /* A div or an <hr> (Ark's): no border of its own. */
33
36
  [data-scope=menu][data-part=separator] { display: block; height: 1px; margin: 0.25rem -0.25rem; border: none; background: var(--ui-border); }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Nav items under a label that opens and closes.
3
3
  *
4
- * <NavGroup label="Forms" icon="lucide:form" defaultOpen>
5
- * <NavItem href="/input">Input</NavItem>
6
- * </NavGroup>
4
+ * <Sidebar.Group label="Forms" icon="lucide:form" defaultOpen>
5
+ * <Sidebar.Item href="/input">Input</Sidebar.Item>
6
+ * </Sidebar.Group>
7
7
  *
8
8
  * - `label`: its text; `icon`: an Iconify name
9
9
  * - `open`, `defaultOpen`; `onOpenChange`: called with the new open state.
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /**
3
3
  * Nav items under a label that opens and closes.
4
4
  *
5
- * <NavGroup label="Forms" icon="lucide:form" defaultOpen>
6
- * <NavItem href="/input">Input</NavItem>
7
- * </NavGroup>
5
+ * <Sidebar.Group label="Forms" icon="lucide:form" defaultOpen>
6
+ * <Sidebar.Item href="/input">Input</Sidebar.Item>
7
+ * </Sidebar.Group>
8
8
  *
9
9
  * - `label`: its text; `icon`: an Iconify name
10
10
  * - `open`, `defaultOpen`; `onOpenChange`: called with the new open state.
@@ -2,8 +2,8 @@
2
2
  * A sidebar link (or a button, without `href`). Other props (onClick,
3
3
  * data-*) go on the link.
4
4
  *
5
- * <NavItem icon="lucide:users" href="/students" active={isCurrent('/students')} badge={3}>Students</NavItem>
6
- * <NavItem icon="lucide:users" link={<Link to="/students" />}>Students</NavItem>
5
+ * <Sidebar.Item icon="lucide:users" href="/students" active={isCurrent('/students')} badge={3}>Students</Sidebar.Item>
6
+ * <Sidebar.Item icon="lucide:users" link={<Link to="/students" />}>Students</Sidebar.Item>
7
7
  *
8
8
  * - `icon`: an Iconify name
9
9
  * - `href`: where it goes (without one it's a button: give it `onClick`)
@@ -3,8 +3,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
3
3
  * A sidebar link (or a button, without `href`). Other props (onClick,
4
4
  * data-*) go on the link.
5
5
  *
6
- * <NavItem icon="lucide:users" href="/students" active={isCurrent('/students')} badge={3}>Students</NavItem>
7
- * <NavItem icon="lucide:users" link={<Link to="/students" />}>Students</NavItem>
6
+ * <Sidebar.Item icon="lucide:users" href="/students" active={isCurrent('/students')} badge={3}>Students</Sidebar.Item>
7
+ * <Sidebar.Item icon="lucide:users" link={<Link to="/students" />}>Students</Sidebar.Item>
8
8
  *
9
9
  * - `icon`: an Iconify name
10
10
  * - `href`: where it goes (without one it's a button: give it `onClick`)
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A group of nav items, with an optional heading (hidden in the rail).
3
3
  *
4
- * <NavSection heading="Settings" collapsible>…NavGroups…</NavSection>
4
+ * <Sidebar.Section heading="Settings" collapsible>…groups…</Sidebar.Section>
5
5
  *
6
6
  * - `heading`
7
7
  * - `collapsible`: a button beside the heading that collapses (or expands)
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /**
3
3
  * A group of nav items, with an optional heading (hidden in the rail).
4
4
  *
5
- * <NavSection heading="Settings" collapsible>…NavGroups…</NavSection>
5
+ * <Sidebar.Section heading="Settings" collapsible>…groups…</Sidebar.Section>
6
6
  *
7
7
  * - `heading`
8
8
  * - `collapsible`: a button beside the heading that collapses (or expands)
@@ -2,16 +2,16 @@
2
2
  * An app sidebar: a logo, the nav, and a footer. In an AppShell it collapses
3
3
  * to an icon rail (its button, or ⌘B) and becomes a drawer on phones.
4
4
  *
5
- * <Sidebar logo="TutorApp" footer={<SidebarUser name="Ada Lovelace" items={account} />}>
6
- * <NavSection heading="Menu">
7
- * <NavItem icon="lucide:house" href="/" active>Dashboard</NavItem>
8
- * <NavGroup label="Settings" icon="lucide:settings">…</NavGroup>
9
- * </NavSection>
5
+ * <Sidebar logo="TutorApp" footer={<Sidebar.User name="Ada Lovelace" items={account} />}>
6
+ * <Sidebar.Section heading="Menu">
7
+ * <Sidebar.Item icon="lucide:house" href="/" active>Dashboard</Sidebar.Item>
8
+ * <Sidebar.Group label="Settings" icon="lucide:settings">…</Sidebar.Group>
9
+ * </Sidebar.Section>
10
10
  * </Sidebar>
11
11
  *
12
12
  * - `logo`; `logoCollapsed`: shown instead in the rail (a mark)
13
- * - `footer`: along the bottom (a SidebarUser)
14
- * - `accordion`: one NavGroup open at a time
13
+ * - `footer`: along the bottom (a Sidebar.User)
14
+ * - `accordion`: one Sidebar.Group open at a time
15
15
  * - `items`: the nav as data, in place of (or before) the content:
16
16
  * `[{ heading, items: [{ label, icon, href, active, badge, items }] }]`
17
17
  * - `edge`: a thin strip along the right edge that collapses or expands it
@@ -21,8 +21,8 @@
21
21
  * - restyle its items with the `--ui-sidebar-*` tokens, e.g.
22
22
  * style={{ '--ui-sidebar-active': 'var(--ui-accent-soft)' }}
23
23
  *
24
- * Its parts are on it too: Sidebar.Section, Sidebar.Group, Sidebar.Item and
25
- * Sidebar.User are NavSection, NavGroup, NavItem and SidebarUser.
24
+ * Its parts are on it: Sidebar.Section, Sidebar.Group, Sidebar.Item and
25
+ * Sidebar.User (also exported as NavSection, NavGroup, NavItem and SidebarUser).
26
26
  */
27
27
  import { type HTMLAttributes, type ReactNode } from 'react';
28
28
  import '../icons.js';
@@ -3,16 +3,16 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
3
3
  * An app sidebar: a logo, the nav, and a footer. In an AppShell it collapses
4
4
  * to an icon rail (its button, or ⌘B) and becomes a drawer on phones.
5
5
  *
6
- * <Sidebar logo="TutorApp" footer={<SidebarUser name="Ada Lovelace" items={account} />}>
7
- * <NavSection heading="Menu">
8
- * <NavItem icon="lucide:house" href="/" active>Dashboard</NavItem>
9
- * <NavGroup label="Settings" icon="lucide:settings">…</NavGroup>
10
- * </NavSection>
6
+ * <Sidebar logo="TutorApp" footer={<Sidebar.User name="Ada Lovelace" items={account} />}>
7
+ * <Sidebar.Section heading="Menu">
8
+ * <Sidebar.Item icon="lucide:house" href="/" active>Dashboard</Sidebar.Item>
9
+ * <Sidebar.Group label="Settings" icon="lucide:settings">…</Sidebar.Group>
10
+ * </Sidebar.Section>
11
11
  * </Sidebar>
12
12
  *
13
13
  * - `logo`; `logoCollapsed`: shown instead in the rail (a mark)
14
- * - `footer`: along the bottom (a SidebarUser)
15
- * - `accordion`: one NavGroup open at a time
14
+ * - `footer`: along the bottom (a Sidebar.User)
15
+ * - `accordion`: one Sidebar.Group open at a time
16
16
  * - `items`: the nav as data, in place of (or before) the content:
17
17
  * `[{ heading, items: [{ label, icon, href, active, badge, items }] }]`
18
18
  * - `edge`: a thin strip along the right edge that collapses or expands it
@@ -22,8 +22,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
22
22
  * - restyle its items with the `--ui-sidebar-*` tokens, e.g.
23
23
  * style={{ '--ui-sidebar-active': 'var(--ui-accent-soft)' }}
24
24
  *
25
- * Its parts are on it too: Sidebar.Section, Sidebar.Group, Sidebar.Item and
26
- * Sidebar.User are NavSection, NavGroup, NavItem and SidebarUser.
25
+ * Its parts are on it: Sidebar.Section, Sidebar.Group, Sidebar.Item and
26
+ * Sidebar.User (also exported as NavSection, NavGroup, NavItem and SidebarUser).
27
27
  */
28
28
  import { useMemo, useState } from 'react';
29
29
  import '../icons.js';
@@ -3,7 +3,7 @@
3
3
  * it, opening a menu of account actions upwards (to the right in the rail,
4
4
  * where only the avatar shows).
5
5
  *
6
- * <SidebarUser name="Ada Lovelace" description="ada@example.com" items={account} onSelect={run} />
6
+ * <Sidebar.User name="Ada Lovelace" description="ada@example.com" items={account} onSelect={run} />
7
7
  *
8
8
  * It's a Menu with the user as its trigger: give it `items`, Menu's child
9
9
  * components, or both, and `onSelect` (the rest of Menu's props apply too).
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Tabs: the Tab children are the panels, and the tab list is built from
3
- * their labels.
2
+ * Tabs: the Tabs.Tab children (also Tab) are the panels, and the tab list
3
+ * is built from their labels.
4
4
  *
5
5
  * <Tabs value={tab} onValueChange={setTab}>
6
- * <Tab value="lessons" label="Lessons" icon="lucide:calendar">…</Tab>
7
- * <Tab value="invoices" label="Invoices" count={2} countColor="danger">…</Tab>
6
+ * <Tabs.Tab value="lessons" label="Lessons" icon="lucide:calendar">…</Tabs.Tab>
7
+ * <Tabs.Tab value="invoices" label="Invoices" count={2} countColor="danger">…</Tabs.Tab>
8
8
  * </Tabs>
9
9
  *
10
10
  * Arrow keys move between tabs (selecting as they go), Home/End jump to the
@@ -73,6 +73,7 @@ export type TabsProps = Omit<Ark.RootProps, 'value' | 'defaultValue' | 'onValueC
73
73
  };
74
74
  declare function TabsShortcut({ value, defaultValue, onValueChange, variant, counts, renderTrigger, className, classes, children, ...rest }: TabsProps): import("react").JSX.Element;
75
75
  export declare const Tabs: typeof TabsShortcut & {
76
+ Tab: typeof Tab;
76
77
  Root: import("react").ForwardRefExoticComponent<Ark.RootProps & import("react").RefAttributes<HTMLDivElement>>;
77
78
  List: import("react").ForwardRefExoticComponent<Ark.ListProps & import("react").RefAttributes<HTMLDivElement>>;
78
79
  Trigger: import("react").ForwardRefExoticComponent<Ark.TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
package/dist/tabs/Tabs.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /**
3
- * Tabs: the Tab children are the panels, and the tab list is built from
4
- * their labels.
3
+ * Tabs: the Tabs.Tab children (also Tab) are the panels, and the tab list
4
+ * is built from their labels.
5
5
  *
6
6
  * <Tabs value={tab} onValueChange={setTab}>
7
- * <Tab value="lessons" label="Lessons" icon="lucide:calendar">…</Tab>
8
- * <Tab value="invoices" label="Invoices" count={2} countColor="danger">…</Tab>
7
+ * <Tabs.Tab value="lessons" label="Lessons" icon="lucide:calendar">…</Tabs.Tab>
8
+ * <Tabs.Tab value="invoices" label="Invoices" count={2} countColor="danger">…</Tabs.Tab>
9
9
  * </Tabs>
10
10
  *
11
11
  * Arrow keys move between tabs (selecting as they go), Home/End jump to the
@@ -80,6 +80,7 @@ function TabsShortcut({ value, defaultValue, onValueChange, variant = 'line', co
80
80
  }), _jsx(Ark.Indicator, { ...part('indicator') })] }), _jsx("div", { ...part('panels'), children: children })] }));
81
81
  }
82
82
  export const Tabs = withParts(TabsShortcut, {
83
+ Tab,
83
84
  Root: Ark.Root,
84
85
  List: Ark.List,
85
86
  Trigger: Ark.Trigger,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milktop/react-ui",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "React components on Ark UI (Zag state machines), with imba-ui's API and design",
5
5
  "license": "MIT",
6
6
  "author": "André Goldstein",