@domphy/ui 0.18.14 → 0.18.16

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/index.d.cts CHANGED
@@ -808,39 +808,39 @@ declare function mark(props?: {
808
808
  accentColor?: ValueOrState<ThemeColor>;
809
809
  }): PartialElement;
810
810
 
811
- /**
812
- * Themed menu container that provides selection context (`activeKey`,
813
- * `selectable`) to child `menuItem` patches and lays them out vertically.
814
- * Sets `role="menu"`. Typically applied to a container element such as a
815
- * `<div>` or `<ul>`.
816
- *
817
- * @param props - Optional configuration.
818
- * @param props.activeKey - Currently selected item key, accepts a value or `State`. Defaults to `null`.
811
+ /** One item inside a menu. */
812
+ type MenuItem = {
813
+ /** Button label — plain string (auto-wrapped) or any DomphyElement (e.g. icon + text). */
814
+ label: string | DomphyElement;
815
+ /** Stable key. Defaults to the item's zero-based index. */
816
+ key?: string | number;
817
+ /** Called when the item is clicked. */
818
+ onClick?: () => void;
819
+ };
820
+ /**
821
+ * All-in-one vertical menu. Generates `<button>` `[role=menuitem]` elements
822
+ * from the `items` array with keyboard navigation (Arrow/Home/End/Enter/Space).
823
+ * Apply to any wrapper element (`div`, `ul`, …).
824
+ *
825
+ * @param props.items - Item definitions `{ label, key?, onClick? }`. Pass `[]`
826
+ * to keep the wrapper's own children (escape hatch for fully custom rows —
827
+ * only the menu container styling and `role="menu"` semantics apply then).
828
+ * @param props.activeKey - Currently selected key (value or State). Defaults to `null`.
819
829
  * @param props.selectable - Whether items track and update the active selection. Defaults to `true`.
820
830
  * @param props.color - Background color tone for the menu. Defaults to `"neutral"`.
821
- * @example { div: "", $: [menu({ activeKey: 0 })] }
831
+ * @param props.accentColor - Accent color for the active/focus item. Defaults to `"primary"`.
832
+ * @example
833
+ * { div: null, $: [menu({ items: [
834
+ * { label: "Profile", key: "profile", onClick: () => navigate("/profile") },
835
+ * { label: "Settings", key: "settings", onClick: () => navigate("/settings") },
836
+ * ] })] }
822
837
  */
823
838
  declare function menu(props?: {
824
- activeKey?: ValueOrState<number | string>;
839
+ items: MenuItem[];
840
+ activeKey?: ValueOrState<number | string | null>;
825
841
  selectable?: boolean;
826
842
  color?: ThemeColor;
827
- }): PartialElement;
828
-
829
- /**
830
- * Themed menu entry for use inside a `menu`. Sets `role="menuitem"`, wires
831
- * click/keyboard selection (Enter/Space activate; Arrow/Home/End move focus),
832
- * and reflects the active item via `aria-current`. Apply to a `<button>`
833
- * element placed within a `menu`.
834
- *
835
- * @hostTag button
836
- * @param props - Optional configuration.
837
- * @param props.accentColor - Accent color tone for the active/focus indicator. Defaults to `"primary"`.
838
- * @param props.color - Base color tone for the item. Defaults to `"neutral"`.
839
- * @example { button: "Profile", $: [menuItem()] }
840
- */
841
- declare function menuItem(props?: {
842
843
  accentColor?: ThemeColor;
843
- color?: ThemeColor;
844
844
  }): PartialElement;
845
845
 
846
846
  /**
@@ -1067,31 +1067,33 @@ declare function scrollArea(props?: {
1067
1067
  color?: ValueOrState<ThemeColor>;
1068
1068
  }): PartialElement;
1069
1069
 
1070
+ /** One item inside a segmented control. */
1071
+ type SegmentedItem = {
1072
+ /** Button label — plain string (auto-wrapped) or any DomphyElement. */
1073
+ label: string | DomphyElement;
1074
+ /** Stable key. Defaults to the item's zero-based index as a string. */
1075
+ key?: string;
1076
+ };
1070
1077
  /**
1071
- * Container patch that establishes a `segmented` context for single-select navigation.
1072
- * Style: inline pill-shaped control with muted background. Use with `segmentedItem` patches on child `<button>` elements.
1078
+ * All-in-one single-select segmented control. Generates `<button>` option
1079
+ * elements from the `items` array. Apply to any wrapper element.
1073
1080
  *
1074
- * @param props.value - Initially selected item key. Accepts a value or state. Defaults to `""`.
1081
+ * @param props.items - Item definitions `{ label, key? }`.
1082
+ * @param props.value - Initially selected key (value or State). Defaults to the first item's key.
1075
1083
  * @param props.color - Theme color for the control background. Defaults to `"neutral"`.
1076
- * @example { div: null, $: [segmented({ value: "month" })] }
1084
+ * @param props.accentColor - Theme color for the selected item. Defaults to `"primary"`.
1085
+ * @example
1086
+ * { div: null, $: [segmented({ items: [
1087
+ * { label: "Day", key: "day" },
1088
+ * { label: "Month", key: "month" },
1089
+ * { label: "Year", key: "year" },
1090
+ * ] })] }
1077
1091
  */
1078
1092
  declare function segmented(props?: {
1093
+ items: SegmentedItem[];
1079
1094
  value?: ValueOrState<string>;
1080
1095
  color?: ThemeColor;
1081
- }): PartialElement;
1082
-
1083
- /**
1084
- * Styles and wires a single option inside a `segmented` control on the host `<button>`.
1085
- * Sets `aria-checked` and handles click-to-select against the parent `segmented` context.
1086
- *
1087
- * @hostTag button
1088
- * @param props.color - Theme color for resting state. Defaults to `"neutral"`.
1089
- * @param props.accentColor - Theme color for selected state. Defaults to `"primary"`.
1090
- * @example { button: "Month", $: [segmentedItem()] }
1091
- */
1092
- declare function segmentedItem(props?: {
1093
- color?: ValueOrState<ThemeColor>;
1094
- accentColor?: ValueOrState<ThemeColor>;
1096
+ accentColor?: ThemeColor;
1095
1097
  }): PartialElement;
1096
1098
 
1097
1099
  /**
@@ -1241,7 +1243,11 @@ declare function splitter(props?: {
1241
1243
  /**
1242
1244
  * The resizable panel inside a `splitter`. Reads the `splitter` context and binds its
1243
1245
  * width (horizontal) or height (vertical) to the context `size` state, updating reactively as
1244
- * the handle is dragged. Warns if used outside a `splitter`. Takes no props.
1246
+ * the handle is dragged. Intended for exactly two panels either side of one `splitterHandle`:
1247
+ * the first `splitterPanel` mounted takes `size`%, and the second takes the complementary
1248
+ * `100 - size`% — so the pair always sums to the full width/height instead of both tracking
1249
+ * the same number (which would make them grow and shrink together instead of trading space).
1250
+ * Warns if used outside a `splitter`. Takes no props.
1245
1251
  *
1246
1252
  * @example { div: [...], $: [splitterPanel()] }
1247
1253
  */
@@ -1257,26 +1263,31 @@ declare function splitterPanel(): PartialElement;
1257
1263
  */
1258
1264
  declare function splitterHandle(): PartialElement;
1259
1265
 
1266
+ /** One step entry. */
1267
+ type StepItem = {
1268
+ /** Step label — plain string (auto-wrapped) or any DomphyElement. */
1269
+ label: string | DomphyElement;
1270
+ /** Stable key. Defaults to the item's zero-based index. */
1271
+ key?: string | number;
1272
+ };
1260
1273
  /**
1261
- * Styles a single step inside a `steps` container. Sets `data-status`
1262
- * (`"pending"` | `"active"` | `"done"`) and `aria-current="step"` on the host element
1263
- * based on the parent `steps` context. The element's content is the step label.
1264
- *
1265
- * @example { li: "Shipping", $: [stepItem()] }
1266
- */
1267
- declare function stepItem(): PartialElement;
1268
-
1269
- /**
1270
- * Container patch for a step-progress indicator. Establishes `steps` context
1271
- * with a reactive `current` index. Use with `stepItem` patches on child elements.
1274
+ * All-in-one step-progress indicator. Generates `<li>` step elements from the
1275
+ * `items` array. Apply to an `<ol>` or `<ul>` element.
1272
1276
  *
1273
- * @param props.current - Zero-based index of the active step. Accepts a value or state. Defaults to `0`.
1277
+ * @param props.items - Step definitions `{ label, key? }`.
1278
+ * @param props.current - Zero-based index of the active step (value or State). Defaults to `0`.
1274
1279
  * @param props.direction - `"horizontal"` (default) or `"vertical"` layout.
1275
1280
  * @param props.color - Theme color for pending/track elements. Defaults to `"neutral"`.
1276
1281
  * @param props.accentColor - Theme color for active/completed elements. Defaults to `"primary"`.
1277
- * @example { ol: null, $: [steps({ current: 1 })] }
1282
+ * @example
1283
+ * { ol: null, $: [steps({ current: 1, items: [
1284
+ * { label: "Cart" },
1285
+ * { label: "Shipping" },
1286
+ * { label: "Payment" },
1287
+ * ] })] }
1278
1288
  */
1279
1289
  declare function steps(props?: {
1290
+ items: StepItem[];
1280
1291
  current?: ValueOrState<number>;
1281
1292
  direction?: "horizontal" | "vertical";
1282
1293
  color?: ThemeColor;
@@ -1318,22 +1329,6 @@ declare function superscript(props?: {
1318
1329
  color?: ValueOrState<ThemeColor>;
1319
1330
  }): PartialElement;
1320
1331
 
1321
- /**
1322
- * Styles a single tab trigger inside a `tabs` tablist on the host `<button>` element.
1323
- * Wires up the tab's id/aria-controls/aria-selected, click selection, and
1324
- * arrow/Home/End keyboard navigation via the surrounding `tabs` context.
1325
- * Must be used inside a `tabs` patch.
1326
- *
1327
- * @hostTag button
1328
- * @param props.accentColor - Theme color for the active/focus underline. Optional. Defaults to `"primary"`.
1329
- * @param props.color - Theme color for the resting/hover underline and text. Optional. Defaults to `"neutral"`.
1330
- * @example { button: "Tab 1", $: [tab()] }
1331
- */
1332
- declare function tab(props?: {
1333
- accentColor?: ThemeColor;
1334
- color?: ThemeColor;
1335
- }): PartialElement;
1336
-
1337
1332
  /**
1338
1333
  * Styles a data table (header/body/footer cells, caption, row hover, borders)
1339
1334
  * on the host `<table>` element.
@@ -1346,26 +1341,38 @@ declare function table(props?: {
1346
1341
  color?: ValueOrState<ThemeColor>;
1347
1342
  }): PartialElement;
1348
1343
 
1344
+ /** One tab entry: a trigger label and its panel content. */
1345
+ type TabItem = {
1346
+ /** Tab button label — a plain string (auto-wrapped in span) or any DomphyElement. */
1347
+ label: string | DomphyElement;
1348
+ /** Panel content rendered when this tab is active. */
1349
+ content: DomphyElement;
1350
+ /** Stable identity key. Defaults to the item's zero-based index. */
1351
+ key?: string | number;
1352
+ };
1349
1353
  /**
1350
- * Styles a tab panel inside a `tabs` tablist. Wires up the panel's
1351
- * id/aria-labelledby and toggles `hidden` based on the surrounding `tabs`
1352
- * context's active key. Must be used inside a `tabs` patch. Takes no props.
1354
+ * All-in-one tabs patch. Generates a `[role=tablist]` button row and
1355
+ * `[role=tabpanel]` panels from the `items` array. Apply to any wrapper
1356
+ * element (`div`, `section`, …). No companion `tab()` / `tabPanel()` needed.
1353
1357
  *
1354
- * @hostTag div
1355
- * @example { div: "Panel content", $: [tabPanel()] }
1356
- */
1357
- declare function tabPanel(): PartialElement;
1358
-
1359
- /**
1360
- * Container patch that establishes a `tabs` context (with a shared `activeKey`
1361
- * state) and the `tablist` role for child `tab`/`tabPanel` patches. No host tag
1362
- * check; typically applied to a wrapper element.
1358
+ * To control the active tab programmatically, pass an external `State` as
1359
+ * `activeKey` and call `.set()` on it from outside.
1363
1360
  *
1364
- * @param props.activeKey - Initially active tab key. Optional, accepts a value or state of `number | string`. Defaults to `0`.
1365
- * @example { div: null, $: [tabs({ activeKey: 0 })] }
1361
+ * @param props.items - Tab definitions `{ label, content, key? }`.
1362
+ * @param props.activeKey - Initially active key (value or State). Defaults to the first item's key.
1363
+ * @param props.accentColor - Theme color for the active underline indicator. Defaults to `"primary"`.
1364
+ * @param props.color - Theme color for the resting underline. Defaults to `"neutral"`.
1365
+ * @example
1366
+ * { div: null, $: [tabs({ items: [
1367
+ * { label: "Overview", content: { p: "Overview content" } },
1368
+ * { label: "API", content: { p: "API content" } },
1369
+ * ] })] }
1366
1370
  */
1367
1371
  declare function tabs(props?: {
1368
- activeKey?: ValueOrState<number | string>;
1372
+ items: TabItem[];
1373
+ activeKey?: ValueOrState<string | number>;
1374
+ accentColor?: ThemeColor;
1375
+ color?: ThemeColor;
1369
1376
  }): PartialElement;
1370
1377
 
1371
1378
  /**
@@ -1438,37 +1445,34 @@ declare function toast(props?: {
1438
1445
  color?: ThemeColor;
1439
1446
  }): PartialElement;
1440
1447
 
1448
+ /** One item inside a toggle group. */
1449
+ type ToggleItem = {
1450
+ /** Button label — plain string (auto-wrapped) or any DomphyElement. */
1451
+ label: string | DomphyElement;
1452
+ /** Stable key. Defaults to the item's zero-based index as a string. */
1453
+ key?: string;
1454
+ };
1441
1455
  /**
1442
- * Styles a single toggle button inside a `toggleGroup` on the host `<button>`
1443
- * element. Wires up `aria-pressed` and click-to-toggle against the surrounding
1444
- * `toggleGroup` context (single- or multi-select). Must be used inside a
1445
- * `toggleGroup` patch.
1456
+ * All-in-one toggle group — single or multi-select button group. Generates
1457
+ * `<button>` toggle elements from the `items` array. Apply to any wrapper element.
1446
1458
  *
1447
- * @hostTag button
1448
- * @param props.color - Theme color for the resting/hover background and text. Optional, accepts a value or state. Defaults to `"neutral"`.
1449
- * @param props.accentColor - Theme color for the pressed/focus state. Optional, accepts a value or state. Defaults to `"primary"`.
1450
- * @example { button: "Bold", $: [toggle()] }
1451
- */
1452
- declare function toggle(props?: {
1453
- color?: ValueOrState<ThemeColor>;
1454
- accentColor?: ValueOrState<ThemeColor>;
1455
- }): PartialElement;
1456
-
1457
- /**
1458
- * Container patch that establishes a `toggleGroup` context (shared selection
1459
- * `value` + `multiple` flag) and `group` role for child `toggle` patches, with
1460
- * a bordered segmented-control style. No host tag check; typically applied to a
1461
- * wrapper element.
1462
- *
1463
- * @param props.value - Selected toggle key(s). Optional, accepts a value or state of `string | string[]`. Defaults to `[]` when `multiple`, otherwise `""`.
1464
- * @param props.multiple - When true, allows multiple toggles selected at once. Optional. Defaults to `false`.
1465
- * @param props.color - Theme color for the group background/border. Optional. Defaults to `"neutral"`.
1466
- * @example { div: null, $: [toggleGroup({ multiple: true })] }
1459
+ * @param props.items - Item definitions `{ label, key? }`.
1460
+ * @param props.value - Selected key(s) (value or State). Defaults to `[]` (multiple) or `""` (single).
1461
+ * @param props.multiple - Allow multiple items selected at once. Defaults to `false`.
1462
+ * @param props.color - Theme color for the group background/border. Defaults to `"neutral"`.
1463
+ * @param props.accentColor - Theme color for the pressed state. Defaults to `"primary"`.
1464
+ * @example
1465
+ * { div: null, $: [toggleGroup({ multiple: true, items: [
1466
+ * { label: "Bold", key: "bold" },
1467
+ * { label: "Italic", key: "italic" },
1468
+ * ] })] }
1467
1469
  */
1468
1470
  declare function toggleGroup(props?: {
1471
+ items: ToggleItem[];
1469
1472
  value?: ValueOrState<string | string[]>;
1470
1473
  multiple?: boolean;
1471
1474
  color?: ThemeColor;
1475
+ accentColor?: ThemeColor;
1472
1476
  }): PartialElement;
1473
1477
 
1474
1478
  /**
@@ -1533,4 +1537,4 @@ declare function unorderedList(props?: {
1533
1537
  color?: ValueOrState<ThemeColor>;
1534
1538
  }): PartialElement;
1535
1539
 
1536
- export { type DatePickerProps, type DatePickerValue, type MotionKeyframe, type MotionProps, abbreviation, accordion, alert, avatar, badge, blockquote, breadcrumb, breadcrumbEllipsis, button, buttonGhost, buttonSwitch, card, code, combobox, command, commandItem, commandSearch, datePicker, descriptionList, details, dialog, divider, drawer, emphasis, empty, errorBoundary, fab, figure, formGroup, heading, horizontalRule, icon, image, inputCheckbox, inputColor, inputDateTime, inputFile, inputNumber, inputOTP, inputPassword, inputRadio, inputRange, inputSearch, inputSwitch, inputText, keyboard, label, link, linkButton, list, listItem, listItemButton, mark, menu, menuItem, motion, orderedList, pagination, paragraph, popover, popoverArrow, preformated, progress, rating, ringProgress, scrollArea, segmented, segmentedItem, select, selectBox, selectItem, selectList, skeleton, small, spinner, splitter, splitterHandle, splitterPanel, stepItem, steps, strong, subscript, superscript, tab, tabPanel, table, tabs, tag, textarea, timeline, timelineItem, toast, toggle, toggleGroup, toolbar, toolbarSpacer, tooltip, transitionGroup, unorderedList };
1540
+ export { type DatePickerProps, type DatePickerValue, type MenuItem, type MotionKeyframe, type MotionProps, type SegmentedItem, type StepItem, type TabItem, type ToggleItem, abbreviation, accordion, alert, avatar, badge, blockquote, breadcrumb, breadcrumbEllipsis, button, buttonGhost, buttonSwitch, card, code, combobox, command, commandItem, commandSearch, datePicker, descriptionList, details, dialog, divider, drawer, emphasis, empty, errorBoundary, fab, figure, formGroup, heading, horizontalRule, icon, image, inputCheckbox, inputColor, inputDateTime, inputFile, inputNumber, inputOTP, inputPassword, inputRadio, inputRange, inputSearch, inputSwitch, inputText, keyboard, label, link, linkButton, list, listItem, listItemButton, mark, menu, motion, orderedList, pagination, paragraph, popover, popoverArrow, preformated, progress, rating, ringProgress, scrollArea, segmented, select, selectBox, selectItem, selectList, skeleton, small, spinner, splitter, splitterHandle, splitterPanel, steps, strong, subscript, superscript, table, tabs, tag, textarea, timeline, timelineItem, toast, toggleGroup, toolbar, toolbarSpacer, tooltip, transitionGroup, unorderedList };
package/dist/index.d.ts CHANGED
@@ -808,39 +808,39 @@ declare function mark(props?: {
808
808
  accentColor?: ValueOrState<ThemeColor>;
809
809
  }): PartialElement;
810
810
 
811
- /**
812
- * Themed menu container that provides selection context (`activeKey`,
813
- * `selectable`) to child `menuItem` patches and lays them out vertically.
814
- * Sets `role="menu"`. Typically applied to a container element such as a
815
- * `<div>` or `<ul>`.
816
- *
817
- * @param props - Optional configuration.
818
- * @param props.activeKey - Currently selected item key, accepts a value or `State`. Defaults to `null`.
811
+ /** One item inside a menu. */
812
+ type MenuItem = {
813
+ /** Button label — plain string (auto-wrapped) or any DomphyElement (e.g. icon + text). */
814
+ label: string | DomphyElement;
815
+ /** Stable key. Defaults to the item's zero-based index. */
816
+ key?: string | number;
817
+ /** Called when the item is clicked. */
818
+ onClick?: () => void;
819
+ };
820
+ /**
821
+ * All-in-one vertical menu. Generates `<button>` `[role=menuitem]` elements
822
+ * from the `items` array with keyboard navigation (Arrow/Home/End/Enter/Space).
823
+ * Apply to any wrapper element (`div`, `ul`, …).
824
+ *
825
+ * @param props.items - Item definitions `{ label, key?, onClick? }`. Pass `[]`
826
+ * to keep the wrapper's own children (escape hatch for fully custom rows —
827
+ * only the menu container styling and `role="menu"` semantics apply then).
828
+ * @param props.activeKey - Currently selected key (value or State). Defaults to `null`.
819
829
  * @param props.selectable - Whether items track and update the active selection. Defaults to `true`.
820
830
  * @param props.color - Background color tone for the menu. Defaults to `"neutral"`.
821
- * @example { div: "", $: [menu({ activeKey: 0 })] }
831
+ * @param props.accentColor - Accent color for the active/focus item. Defaults to `"primary"`.
832
+ * @example
833
+ * { div: null, $: [menu({ items: [
834
+ * { label: "Profile", key: "profile", onClick: () => navigate("/profile") },
835
+ * { label: "Settings", key: "settings", onClick: () => navigate("/settings") },
836
+ * ] })] }
822
837
  */
823
838
  declare function menu(props?: {
824
- activeKey?: ValueOrState<number | string>;
839
+ items: MenuItem[];
840
+ activeKey?: ValueOrState<number | string | null>;
825
841
  selectable?: boolean;
826
842
  color?: ThemeColor;
827
- }): PartialElement;
828
-
829
- /**
830
- * Themed menu entry for use inside a `menu`. Sets `role="menuitem"`, wires
831
- * click/keyboard selection (Enter/Space activate; Arrow/Home/End move focus),
832
- * and reflects the active item via `aria-current`. Apply to a `<button>`
833
- * element placed within a `menu`.
834
- *
835
- * @hostTag button
836
- * @param props - Optional configuration.
837
- * @param props.accentColor - Accent color tone for the active/focus indicator. Defaults to `"primary"`.
838
- * @param props.color - Base color tone for the item. Defaults to `"neutral"`.
839
- * @example { button: "Profile", $: [menuItem()] }
840
- */
841
- declare function menuItem(props?: {
842
843
  accentColor?: ThemeColor;
843
- color?: ThemeColor;
844
844
  }): PartialElement;
845
845
 
846
846
  /**
@@ -1067,31 +1067,33 @@ declare function scrollArea(props?: {
1067
1067
  color?: ValueOrState<ThemeColor>;
1068
1068
  }): PartialElement;
1069
1069
 
1070
+ /** One item inside a segmented control. */
1071
+ type SegmentedItem = {
1072
+ /** Button label — plain string (auto-wrapped) or any DomphyElement. */
1073
+ label: string | DomphyElement;
1074
+ /** Stable key. Defaults to the item's zero-based index as a string. */
1075
+ key?: string;
1076
+ };
1070
1077
  /**
1071
- * Container patch that establishes a `segmented` context for single-select navigation.
1072
- * Style: inline pill-shaped control with muted background. Use with `segmentedItem` patches on child `<button>` elements.
1078
+ * All-in-one single-select segmented control. Generates `<button>` option
1079
+ * elements from the `items` array. Apply to any wrapper element.
1073
1080
  *
1074
- * @param props.value - Initially selected item key. Accepts a value or state. Defaults to `""`.
1081
+ * @param props.items - Item definitions `{ label, key? }`.
1082
+ * @param props.value - Initially selected key (value or State). Defaults to the first item's key.
1075
1083
  * @param props.color - Theme color for the control background. Defaults to `"neutral"`.
1076
- * @example { div: null, $: [segmented({ value: "month" })] }
1084
+ * @param props.accentColor - Theme color for the selected item. Defaults to `"primary"`.
1085
+ * @example
1086
+ * { div: null, $: [segmented({ items: [
1087
+ * { label: "Day", key: "day" },
1088
+ * { label: "Month", key: "month" },
1089
+ * { label: "Year", key: "year" },
1090
+ * ] })] }
1077
1091
  */
1078
1092
  declare function segmented(props?: {
1093
+ items: SegmentedItem[];
1079
1094
  value?: ValueOrState<string>;
1080
1095
  color?: ThemeColor;
1081
- }): PartialElement;
1082
-
1083
- /**
1084
- * Styles and wires a single option inside a `segmented` control on the host `<button>`.
1085
- * Sets `aria-checked` and handles click-to-select against the parent `segmented` context.
1086
- *
1087
- * @hostTag button
1088
- * @param props.color - Theme color for resting state. Defaults to `"neutral"`.
1089
- * @param props.accentColor - Theme color for selected state. Defaults to `"primary"`.
1090
- * @example { button: "Month", $: [segmentedItem()] }
1091
- */
1092
- declare function segmentedItem(props?: {
1093
- color?: ValueOrState<ThemeColor>;
1094
- accentColor?: ValueOrState<ThemeColor>;
1096
+ accentColor?: ThemeColor;
1095
1097
  }): PartialElement;
1096
1098
 
1097
1099
  /**
@@ -1241,7 +1243,11 @@ declare function splitter(props?: {
1241
1243
  /**
1242
1244
  * The resizable panel inside a `splitter`. Reads the `splitter` context and binds its
1243
1245
  * width (horizontal) or height (vertical) to the context `size` state, updating reactively as
1244
- * the handle is dragged. Warns if used outside a `splitter`. Takes no props.
1246
+ * the handle is dragged. Intended for exactly two panels either side of one `splitterHandle`:
1247
+ * the first `splitterPanel` mounted takes `size`%, and the second takes the complementary
1248
+ * `100 - size`% — so the pair always sums to the full width/height instead of both tracking
1249
+ * the same number (which would make them grow and shrink together instead of trading space).
1250
+ * Warns if used outside a `splitter`. Takes no props.
1245
1251
  *
1246
1252
  * @example { div: [...], $: [splitterPanel()] }
1247
1253
  */
@@ -1257,26 +1263,31 @@ declare function splitterPanel(): PartialElement;
1257
1263
  */
1258
1264
  declare function splitterHandle(): PartialElement;
1259
1265
 
1266
+ /** One step entry. */
1267
+ type StepItem = {
1268
+ /** Step label — plain string (auto-wrapped) or any DomphyElement. */
1269
+ label: string | DomphyElement;
1270
+ /** Stable key. Defaults to the item's zero-based index. */
1271
+ key?: string | number;
1272
+ };
1260
1273
  /**
1261
- * Styles a single step inside a `steps` container. Sets `data-status`
1262
- * (`"pending"` | `"active"` | `"done"`) and `aria-current="step"` on the host element
1263
- * based on the parent `steps` context. The element's content is the step label.
1264
- *
1265
- * @example { li: "Shipping", $: [stepItem()] }
1266
- */
1267
- declare function stepItem(): PartialElement;
1268
-
1269
- /**
1270
- * Container patch for a step-progress indicator. Establishes `steps` context
1271
- * with a reactive `current` index. Use with `stepItem` patches on child elements.
1274
+ * All-in-one step-progress indicator. Generates `<li>` step elements from the
1275
+ * `items` array. Apply to an `<ol>` or `<ul>` element.
1272
1276
  *
1273
- * @param props.current - Zero-based index of the active step. Accepts a value or state. Defaults to `0`.
1277
+ * @param props.items - Step definitions `{ label, key? }`.
1278
+ * @param props.current - Zero-based index of the active step (value or State). Defaults to `0`.
1274
1279
  * @param props.direction - `"horizontal"` (default) or `"vertical"` layout.
1275
1280
  * @param props.color - Theme color for pending/track elements. Defaults to `"neutral"`.
1276
1281
  * @param props.accentColor - Theme color for active/completed elements. Defaults to `"primary"`.
1277
- * @example { ol: null, $: [steps({ current: 1 })] }
1282
+ * @example
1283
+ * { ol: null, $: [steps({ current: 1, items: [
1284
+ * { label: "Cart" },
1285
+ * { label: "Shipping" },
1286
+ * { label: "Payment" },
1287
+ * ] })] }
1278
1288
  */
1279
1289
  declare function steps(props?: {
1290
+ items: StepItem[];
1280
1291
  current?: ValueOrState<number>;
1281
1292
  direction?: "horizontal" | "vertical";
1282
1293
  color?: ThemeColor;
@@ -1318,22 +1329,6 @@ declare function superscript(props?: {
1318
1329
  color?: ValueOrState<ThemeColor>;
1319
1330
  }): PartialElement;
1320
1331
 
1321
- /**
1322
- * Styles a single tab trigger inside a `tabs` tablist on the host `<button>` element.
1323
- * Wires up the tab's id/aria-controls/aria-selected, click selection, and
1324
- * arrow/Home/End keyboard navigation via the surrounding `tabs` context.
1325
- * Must be used inside a `tabs` patch.
1326
- *
1327
- * @hostTag button
1328
- * @param props.accentColor - Theme color for the active/focus underline. Optional. Defaults to `"primary"`.
1329
- * @param props.color - Theme color for the resting/hover underline and text. Optional. Defaults to `"neutral"`.
1330
- * @example { button: "Tab 1", $: [tab()] }
1331
- */
1332
- declare function tab(props?: {
1333
- accentColor?: ThemeColor;
1334
- color?: ThemeColor;
1335
- }): PartialElement;
1336
-
1337
1332
  /**
1338
1333
  * Styles a data table (header/body/footer cells, caption, row hover, borders)
1339
1334
  * on the host `<table>` element.
@@ -1346,26 +1341,38 @@ declare function table(props?: {
1346
1341
  color?: ValueOrState<ThemeColor>;
1347
1342
  }): PartialElement;
1348
1343
 
1344
+ /** One tab entry: a trigger label and its panel content. */
1345
+ type TabItem = {
1346
+ /** Tab button label — a plain string (auto-wrapped in span) or any DomphyElement. */
1347
+ label: string | DomphyElement;
1348
+ /** Panel content rendered when this tab is active. */
1349
+ content: DomphyElement;
1350
+ /** Stable identity key. Defaults to the item's zero-based index. */
1351
+ key?: string | number;
1352
+ };
1349
1353
  /**
1350
- * Styles a tab panel inside a `tabs` tablist. Wires up the panel's
1351
- * id/aria-labelledby and toggles `hidden` based on the surrounding `tabs`
1352
- * context's active key. Must be used inside a `tabs` patch. Takes no props.
1354
+ * All-in-one tabs patch. Generates a `[role=tablist]` button row and
1355
+ * `[role=tabpanel]` panels from the `items` array. Apply to any wrapper
1356
+ * element (`div`, `section`, …). No companion `tab()` / `tabPanel()` needed.
1353
1357
  *
1354
- * @hostTag div
1355
- * @example { div: "Panel content", $: [tabPanel()] }
1356
- */
1357
- declare function tabPanel(): PartialElement;
1358
-
1359
- /**
1360
- * Container patch that establishes a `tabs` context (with a shared `activeKey`
1361
- * state) and the `tablist` role for child `tab`/`tabPanel` patches. No host tag
1362
- * check; typically applied to a wrapper element.
1358
+ * To control the active tab programmatically, pass an external `State` as
1359
+ * `activeKey` and call `.set()` on it from outside.
1363
1360
  *
1364
- * @param props.activeKey - Initially active tab key. Optional, accepts a value or state of `number | string`. Defaults to `0`.
1365
- * @example { div: null, $: [tabs({ activeKey: 0 })] }
1361
+ * @param props.items - Tab definitions `{ label, content, key? }`.
1362
+ * @param props.activeKey - Initially active key (value or State). Defaults to the first item's key.
1363
+ * @param props.accentColor - Theme color for the active underline indicator. Defaults to `"primary"`.
1364
+ * @param props.color - Theme color for the resting underline. Defaults to `"neutral"`.
1365
+ * @example
1366
+ * { div: null, $: [tabs({ items: [
1367
+ * { label: "Overview", content: { p: "Overview content" } },
1368
+ * { label: "API", content: { p: "API content" } },
1369
+ * ] })] }
1366
1370
  */
1367
1371
  declare function tabs(props?: {
1368
- activeKey?: ValueOrState<number | string>;
1372
+ items: TabItem[];
1373
+ activeKey?: ValueOrState<string | number>;
1374
+ accentColor?: ThemeColor;
1375
+ color?: ThemeColor;
1369
1376
  }): PartialElement;
1370
1377
 
1371
1378
  /**
@@ -1438,37 +1445,34 @@ declare function toast(props?: {
1438
1445
  color?: ThemeColor;
1439
1446
  }): PartialElement;
1440
1447
 
1448
+ /** One item inside a toggle group. */
1449
+ type ToggleItem = {
1450
+ /** Button label — plain string (auto-wrapped) or any DomphyElement. */
1451
+ label: string | DomphyElement;
1452
+ /** Stable key. Defaults to the item's zero-based index as a string. */
1453
+ key?: string;
1454
+ };
1441
1455
  /**
1442
- * Styles a single toggle button inside a `toggleGroup` on the host `<button>`
1443
- * element. Wires up `aria-pressed` and click-to-toggle against the surrounding
1444
- * `toggleGroup` context (single- or multi-select). Must be used inside a
1445
- * `toggleGroup` patch.
1456
+ * All-in-one toggle group — single or multi-select button group. Generates
1457
+ * `<button>` toggle elements from the `items` array. Apply to any wrapper element.
1446
1458
  *
1447
- * @hostTag button
1448
- * @param props.color - Theme color for the resting/hover background and text. Optional, accepts a value or state. Defaults to `"neutral"`.
1449
- * @param props.accentColor - Theme color for the pressed/focus state. Optional, accepts a value or state. Defaults to `"primary"`.
1450
- * @example { button: "Bold", $: [toggle()] }
1451
- */
1452
- declare function toggle(props?: {
1453
- color?: ValueOrState<ThemeColor>;
1454
- accentColor?: ValueOrState<ThemeColor>;
1455
- }): PartialElement;
1456
-
1457
- /**
1458
- * Container patch that establishes a `toggleGroup` context (shared selection
1459
- * `value` + `multiple` flag) and `group` role for child `toggle` patches, with
1460
- * a bordered segmented-control style. No host tag check; typically applied to a
1461
- * wrapper element.
1462
- *
1463
- * @param props.value - Selected toggle key(s). Optional, accepts a value or state of `string | string[]`. Defaults to `[]` when `multiple`, otherwise `""`.
1464
- * @param props.multiple - When true, allows multiple toggles selected at once. Optional. Defaults to `false`.
1465
- * @param props.color - Theme color for the group background/border. Optional. Defaults to `"neutral"`.
1466
- * @example { div: null, $: [toggleGroup({ multiple: true })] }
1459
+ * @param props.items - Item definitions `{ label, key? }`.
1460
+ * @param props.value - Selected key(s) (value or State). Defaults to `[]` (multiple) or `""` (single).
1461
+ * @param props.multiple - Allow multiple items selected at once. Defaults to `false`.
1462
+ * @param props.color - Theme color for the group background/border. Defaults to `"neutral"`.
1463
+ * @param props.accentColor - Theme color for the pressed state. Defaults to `"primary"`.
1464
+ * @example
1465
+ * { div: null, $: [toggleGroup({ multiple: true, items: [
1466
+ * { label: "Bold", key: "bold" },
1467
+ * { label: "Italic", key: "italic" },
1468
+ * ] })] }
1467
1469
  */
1468
1470
  declare function toggleGroup(props?: {
1471
+ items: ToggleItem[];
1469
1472
  value?: ValueOrState<string | string[]>;
1470
1473
  multiple?: boolean;
1471
1474
  color?: ThemeColor;
1475
+ accentColor?: ThemeColor;
1472
1476
  }): PartialElement;
1473
1477
 
1474
1478
  /**
@@ -1533,4 +1537,4 @@ declare function unorderedList(props?: {
1533
1537
  color?: ValueOrState<ThemeColor>;
1534
1538
  }): PartialElement;
1535
1539
 
1536
- export { type DatePickerProps, type DatePickerValue, type MotionKeyframe, type MotionProps, abbreviation, accordion, alert, avatar, badge, blockquote, breadcrumb, breadcrumbEllipsis, button, buttonGhost, buttonSwitch, card, code, combobox, command, commandItem, commandSearch, datePicker, descriptionList, details, dialog, divider, drawer, emphasis, empty, errorBoundary, fab, figure, formGroup, heading, horizontalRule, icon, image, inputCheckbox, inputColor, inputDateTime, inputFile, inputNumber, inputOTP, inputPassword, inputRadio, inputRange, inputSearch, inputSwitch, inputText, keyboard, label, link, linkButton, list, listItem, listItemButton, mark, menu, menuItem, motion, orderedList, pagination, paragraph, popover, popoverArrow, preformated, progress, rating, ringProgress, scrollArea, segmented, segmentedItem, select, selectBox, selectItem, selectList, skeleton, small, spinner, splitter, splitterHandle, splitterPanel, stepItem, steps, strong, subscript, superscript, tab, tabPanel, table, tabs, tag, textarea, timeline, timelineItem, toast, toggle, toggleGroup, toolbar, toolbarSpacer, tooltip, transitionGroup, unorderedList };
1540
+ export { type DatePickerProps, type DatePickerValue, type MenuItem, type MotionKeyframe, type MotionProps, type SegmentedItem, type StepItem, type TabItem, type ToggleItem, abbreviation, accordion, alert, avatar, badge, blockquote, breadcrumb, breadcrumbEllipsis, button, buttonGhost, buttonSwitch, card, code, combobox, command, commandItem, commandSearch, datePicker, descriptionList, details, dialog, divider, drawer, emphasis, empty, errorBoundary, fab, figure, formGroup, heading, horizontalRule, icon, image, inputCheckbox, inputColor, inputDateTime, inputFile, inputNumber, inputOTP, inputPassword, inputRadio, inputRange, inputSearch, inputSwitch, inputText, keyboard, label, link, linkButton, list, listItem, listItemButton, mark, menu, motion, orderedList, pagination, paragraph, popover, popoverArrow, preformated, progress, rating, ringProgress, scrollArea, segmented, select, selectBox, selectItem, selectList, skeleton, small, spinner, splitter, splitterHandle, splitterPanel, steps, strong, subscript, superscript, table, tabs, tag, textarea, timeline, timelineItem, toast, toggleGroup, toolbar, toolbarSpacer, tooltip, transitionGroup, unorderedList };