@domphy/ui 0.18.22 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -111,16 +111,36 @@ declare function breadcrumbEllipsis(props?: {
111
111
  color?: ValueOrState<ThemeColor>;
112
112
  }): PartialElement;
113
113
 
114
+ /**
115
+ * The `fontSize` step for `button()`/`buttonGhost()`'s `size` prop. Padding stays
116
+ * per-component (button and buttonGhost start from different base paddings) so
117
+ * only the part that's genuinely identical — the font-size step — lives here.
118
+ */
119
+ declare const BUTTON_SIZE_FONT: {
120
+ readonly small: "decrease-1";
121
+ readonly medium: "inherit";
122
+ readonly large: "increase-1";
123
+ };
124
+ type ButtonSize = keyof typeof BUTTON_SIZE_FONT;
125
+
126
+ type ButtonVariant = "solid" | "outline" | "ghost";
114
127
  /**
115
128
  * A themed button control with density-aware padding/radius and hover, focus-visible,
116
129
  * `[disabled]`, and `[aria-busy=true]` states. Apply to a `<button>` element.
117
130
  *
118
131
  * @hostTag button
119
132
  * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default "primary".
133
+ * @param props.variant - Visual style: `"outline"` (tinted background + outline, default,
134
+ * backward compatible), `"solid"` (filled background, readable contrast text), or `"ghost"`
135
+ * (no background/border — delegates to `buttonGhost()` so the two stay visually identical).
136
+ * @param props.size - Button size preset. Optional `"small" | "medium" | "large"`, defaults to `"medium"`.
120
137
  * @example { button: "Save", $: [button({ color: "primary" })] }
138
+ * @example { button: "Delete", $: [button({ color: "error", variant: "solid" })] }
121
139
  */
122
140
  declare function button(props?: {
123
141
  color?: ValueOrState<ThemeColor>;
142
+ variant?: ButtonVariant;
143
+ size?: ButtonSize;
124
144
  }): PartialElement;
125
145
 
126
146
  /**
@@ -130,11 +150,13 @@ declare function button(props?: {
130
150
  *
131
151
  * @hostTag button
132
152
  * @param props.color - Text color tone. Optional `ValueOrState<ThemeColor>`, defaults to `"neutral"`.
153
+ * @param props.size - Button size preset. Optional `"small" | "medium" | "large"`, defaults to `"medium"`.
133
154
  * @example { button: "×", $: [buttonGhost()] }
134
155
  * @example { button: { span: null, $: [icon({ name: "trash" })] }, $: [buttonGhost({ color: "error" })] }
135
156
  */
136
157
  declare function buttonGhost(props?: {
137
158
  color?: ValueOrState<ThemeColor>;
159
+ size?: ButtonSize;
138
160
  }): PartialElement;
139
161
 
140
162
  /**
@@ -923,6 +945,29 @@ declare function pagination(props: {
923
945
  accentColor?: ThemeColor;
924
946
  }): PartialElement;
925
947
 
948
+ /**
949
+ * A padded section for side-panel/inspector UIs — density-aware padding on
950
+ * all sides, with an optional bottom divider for sections stacked one after
951
+ * another. A thin wrapper: it does not impose flex layout on its children —
952
+ * pair it with `stack()` or `row()` for that. No host-tag check; apply to
953
+ * any block element.
954
+ *
955
+ * @param props.padding - Spacing multiplier for padding on all sides (default 4 = 1em at density 1).
956
+ * @param props.divider - Adds a bottom border, for sections stacked one after another. Defaults to `false`.
957
+ * @param props.color - Theme color tone for the divider border. Defaults to `"neutral"`.
958
+ * @example { div: [{ h3: "Parameters" }, { p: "..." }], $: [panelSection()] }
959
+ * @example
960
+ * { div: [
961
+ * { div: "Section A", $: [panelSection({ divider: true })] },
962
+ * { div: "Section B", $: [panelSection()] },
963
+ * ], $: [stack({ gap: 0 })] }
964
+ */
965
+ declare function panelSection(props?: {
966
+ padding?: number;
967
+ divider?: boolean;
968
+ color?: ValueOrState<ThemeColor>;
969
+ }): PartialElement;
970
+
926
971
  /**
927
972
  * Themed paragraph primitive: comfortable line-height, reset margins and themed
928
973
  * text color. Apply to a `<p>` element.
@@ -1053,6 +1098,45 @@ declare function ringProgress(props?: {
1053
1098
  thickness?: number;
1054
1099
  }): PartialElement;
1055
1100
 
1101
+ type FlexAlign = "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
1102
+ /**
1103
+ * A vertical flex column with spacing between children. The general-purpose
1104
+ * primitive for stacking blocks — form sections, panel content, card bodies —
1105
+ * instead of hand-rolling `display: flex; flexDirection: column; gap: ...`.
1106
+ * Styles the host only; apply to any block element.
1107
+ *
1108
+ * @param props.gap - Spacing multiplier for gap between children (default 3 = 0.75em at density 1).
1109
+ * @param props.align - Cross-axis alignment (`alignItems`). Unset by default (flex default, stretch).
1110
+ * @example { div: [{ h3: "Title" }, { p: "Body" }], $: [stack()] }
1111
+ * @example { div: [...], $: [stack({ gap: 2, align: "center" })] }
1112
+ */
1113
+ declare function stack(props?: {
1114
+ gap?: number;
1115
+ align?: FlexAlign;
1116
+ }): PartialElement;
1117
+
1118
+ type FlexJustify = "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly";
1119
+ /**
1120
+ * A horizontal flex row with spacing between children, vertically centered by
1121
+ * default. The general-purpose primitive for icon+label rows, field rows,
1122
+ * and button groups — instead of hand-rolling `display: flex; alignItems:
1123
+ * center; gap: ...`. `toolbar()` is a semantic alias of this same shape for
1124
+ * headers/nav bars. Styles the host only; apply to any block element.
1125
+ *
1126
+ * @param props.gap - Spacing multiplier for gap between items (default 4 = 1em at density 1).
1127
+ * @param props.align - Cross-axis alignment (`alignItems`). Defaults to `"center"`.
1128
+ * @param props.justify - Main-axis distribution (`justifyContent`). Unset by default (flex-start).
1129
+ * @param props.wrap - Allow items to wrap onto multiple lines. Defaults to `false`.
1130
+ * @example { div: [{ span: "Icon" }, { span: "Label" }], $: [row()] }
1131
+ * @example { div: [...], $: [row({ justify: "space-between", wrap: true })] }
1132
+ */
1133
+ declare function row(props?: {
1134
+ gap?: number;
1135
+ align?: FlexAlign;
1136
+ justify?: FlexJustify;
1137
+ wrap?: boolean;
1138
+ }): PartialElement;
1139
+
1056
1140
  /**
1057
1141
  * Applies thin, themed overlay scrollbars to any scrollable container.
1058
1142
  * Covers WebKit (Chrome/Safari/Edge) via `::-webkit-scrollbar` pseudo-elements
@@ -1071,7 +1155,7 @@ declare function scrollArea(props?: {
1071
1155
  type SegmentedItem = {
1072
1156
  /** Button label — plain string (auto-wrapped) or any DomphyElement. */
1073
1157
  label: string | DomphyElement;
1074
- /** Stable key. Defaults to the item's zero-based index as a string. */
1158
+ /** Stable key. Defaults to the item's zero-based index. */
1075
1159
  key?: string;
1076
1160
  };
1077
1161
  /**
@@ -1477,7 +1561,9 @@ declare function toggleGroup(props?: {
1477
1561
 
1478
1562
  /**
1479
1563
  * A horizontal flex row with vertically centered items. Useful for headers,
1480
- * toolbars, navigation bars, and action strips.
1564
+ * toolbars, navigation bars, and action strips. A semantic alias of `row()`
1565
+ * at its default alignment — reach for `row()` directly for `justify`/`wrap`/
1566
+ * `align` beyond this shape.
1481
1567
  *
1482
1568
  * @param props.gap - Spacing multiplier for gap between items (default 4 = 1em).
1483
1569
  * @example { header: [...], $: [toolbar()] }
@@ -1537,4 +1623,4 @@ declare function unorderedList(props?: {
1537
1623
  color?: ValueOrState<ThemeColor>;
1538
1624
  }): PartialElement;
1539
1625
 
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 };
1626
+ export { type ButtonVariant, type DatePickerProps, type DatePickerValue, type FlexAlign, type FlexJustify, 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, panelSection, paragraph, popover, popoverArrow, preformated, progress, rating, ringProgress, row, scrollArea, segmented, select, selectBox, selectItem, selectList, skeleton, small, spinner, splitter, splitterHandle, splitterPanel, stack, steps, strong, subscript, superscript, table, tabs, tag, textarea, timeline, timelineItem, toast, toggleGroup, toolbar, toolbarSpacer, tooltip, transitionGroup, unorderedList };
package/dist/index.d.ts CHANGED
@@ -111,16 +111,36 @@ declare function breadcrumbEllipsis(props?: {
111
111
  color?: ValueOrState<ThemeColor>;
112
112
  }): PartialElement;
113
113
 
114
+ /**
115
+ * The `fontSize` step for `button()`/`buttonGhost()`'s `size` prop. Padding stays
116
+ * per-component (button and buttonGhost start from different base paddings) so
117
+ * only the part that's genuinely identical — the font-size step — lives here.
118
+ */
119
+ declare const BUTTON_SIZE_FONT: {
120
+ readonly small: "decrease-1";
121
+ readonly medium: "inherit";
122
+ readonly large: "increase-1";
123
+ };
124
+ type ButtonSize = keyof typeof BUTTON_SIZE_FONT;
125
+
126
+ type ButtonVariant = "solid" | "outline" | "ghost";
114
127
  /**
115
128
  * A themed button control with density-aware padding/radius and hover, focus-visible,
116
129
  * `[disabled]`, and `[aria-busy=true]` states. Apply to a `<button>` element.
117
130
  *
118
131
  * @hostTag button
119
132
  * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default "primary".
133
+ * @param props.variant - Visual style: `"outline"` (tinted background + outline, default,
134
+ * backward compatible), `"solid"` (filled background, readable contrast text), or `"ghost"`
135
+ * (no background/border — delegates to `buttonGhost()` so the two stay visually identical).
136
+ * @param props.size - Button size preset. Optional `"small" | "medium" | "large"`, defaults to `"medium"`.
120
137
  * @example { button: "Save", $: [button({ color: "primary" })] }
138
+ * @example { button: "Delete", $: [button({ color: "error", variant: "solid" })] }
121
139
  */
122
140
  declare function button(props?: {
123
141
  color?: ValueOrState<ThemeColor>;
142
+ variant?: ButtonVariant;
143
+ size?: ButtonSize;
124
144
  }): PartialElement;
125
145
 
126
146
  /**
@@ -130,11 +150,13 @@ declare function button(props?: {
130
150
  *
131
151
  * @hostTag button
132
152
  * @param props.color - Text color tone. Optional `ValueOrState<ThemeColor>`, defaults to `"neutral"`.
153
+ * @param props.size - Button size preset. Optional `"small" | "medium" | "large"`, defaults to `"medium"`.
133
154
  * @example { button: "×", $: [buttonGhost()] }
134
155
  * @example { button: { span: null, $: [icon({ name: "trash" })] }, $: [buttonGhost({ color: "error" })] }
135
156
  */
136
157
  declare function buttonGhost(props?: {
137
158
  color?: ValueOrState<ThemeColor>;
159
+ size?: ButtonSize;
138
160
  }): PartialElement;
139
161
 
140
162
  /**
@@ -923,6 +945,29 @@ declare function pagination(props: {
923
945
  accentColor?: ThemeColor;
924
946
  }): PartialElement;
925
947
 
948
+ /**
949
+ * A padded section for side-panel/inspector UIs — density-aware padding on
950
+ * all sides, with an optional bottom divider for sections stacked one after
951
+ * another. A thin wrapper: it does not impose flex layout on its children —
952
+ * pair it with `stack()` or `row()` for that. No host-tag check; apply to
953
+ * any block element.
954
+ *
955
+ * @param props.padding - Spacing multiplier for padding on all sides (default 4 = 1em at density 1).
956
+ * @param props.divider - Adds a bottom border, for sections stacked one after another. Defaults to `false`.
957
+ * @param props.color - Theme color tone for the divider border. Defaults to `"neutral"`.
958
+ * @example { div: [{ h3: "Parameters" }, { p: "..." }], $: [panelSection()] }
959
+ * @example
960
+ * { div: [
961
+ * { div: "Section A", $: [panelSection({ divider: true })] },
962
+ * { div: "Section B", $: [panelSection()] },
963
+ * ], $: [stack({ gap: 0 })] }
964
+ */
965
+ declare function panelSection(props?: {
966
+ padding?: number;
967
+ divider?: boolean;
968
+ color?: ValueOrState<ThemeColor>;
969
+ }): PartialElement;
970
+
926
971
  /**
927
972
  * Themed paragraph primitive: comfortable line-height, reset margins and themed
928
973
  * text color. Apply to a `<p>` element.
@@ -1053,6 +1098,45 @@ declare function ringProgress(props?: {
1053
1098
  thickness?: number;
1054
1099
  }): PartialElement;
1055
1100
 
1101
+ type FlexAlign = "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
1102
+ /**
1103
+ * A vertical flex column with spacing between children. The general-purpose
1104
+ * primitive for stacking blocks — form sections, panel content, card bodies —
1105
+ * instead of hand-rolling `display: flex; flexDirection: column; gap: ...`.
1106
+ * Styles the host only; apply to any block element.
1107
+ *
1108
+ * @param props.gap - Spacing multiplier for gap between children (default 3 = 0.75em at density 1).
1109
+ * @param props.align - Cross-axis alignment (`alignItems`). Unset by default (flex default, stretch).
1110
+ * @example { div: [{ h3: "Title" }, { p: "Body" }], $: [stack()] }
1111
+ * @example { div: [...], $: [stack({ gap: 2, align: "center" })] }
1112
+ */
1113
+ declare function stack(props?: {
1114
+ gap?: number;
1115
+ align?: FlexAlign;
1116
+ }): PartialElement;
1117
+
1118
+ type FlexJustify = "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly";
1119
+ /**
1120
+ * A horizontal flex row with spacing between children, vertically centered by
1121
+ * default. The general-purpose primitive for icon+label rows, field rows,
1122
+ * and button groups — instead of hand-rolling `display: flex; alignItems:
1123
+ * center; gap: ...`. `toolbar()` is a semantic alias of this same shape for
1124
+ * headers/nav bars. Styles the host only; apply to any block element.
1125
+ *
1126
+ * @param props.gap - Spacing multiplier for gap between items (default 4 = 1em at density 1).
1127
+ * @param props.align - Cross-axis alignment (`alignItems`). Defaults to `"center"`.
1128
+ * @param props.justify - Main-axis distribution (`justifyContent`). Unset by default (flex-start).
1129
+ * @param props.wrap - Allow items to wrap onto multiple lines. Defaults to `false`.
1130
+ * @example { div: [{ span: "Icon" }, { span: "Label" }], $: [row()] }
1131
+ * @example { div: [...], $: [row({ justify: "space-between", wrap: true })] }
1132
+ */
1133
+ declare function row(props?: {
1134
+ gap?: number;
1135
+ align?: FlexAlign;
1136
+ justify?: FlexJustify;
1137
+ wrap?: boolean;
1138
+ }): PartialElement;
1139
+
1056
1140
  /**
1057
1141
  * Applies thin, themed overlay scrollbars to any scrollable container.
1058
1142
  * Covers WebKit (Chrome/Safari/Edge) via `::-webkit-scrollbar` pseudo-elements
@@ -1071,7 +1155,7 @@ declare function scrollArea(props?: {
1071
1155
  type SegmentedItem = {
1072
1156
  /** Button label — plain string (auto-wrapped) or any DomphyElement. */
1073
1157
  label: string | DomphyElement;
1074
- /** Stable key. Defaults to the item's zero-based index as a string. */
1158
+ /** Stable key. Defaults to the item's zero-based index. */
1075
1159
  key?: string;
1076
1160
  };
1077
1161
  /**
@@ -1477,7 +1561,9 @@ declare function toggleGroup(props?: {
1477
1561
 
1478
1562
  /**
1479
1563
  * A horizontal flex row with vertically centered items. Useful for headers,
1480
- * toolbars, navigation bars, and action strips.
1564
+ * toolbars, navigation bars, and action strips. A semantic alias of `row()`
1565
+ * at its default alignment — reach for `row()` directly for `justify`/`wrap`/
1566
+ * `align` beyond this shape.
1481
1567
  *
1482
1568
  * @param props.gap - Spacing multiplier for gap between items (default 4 = 1em).
1483
1569
  * @example { header: [...], $: [toolbar()] }
@@ -1537,4 +1623,4 @@ declare function unorderedList(props?: {
1537
1623
  color?: ValueOrState<ThemeColor>;
1538
1624
  }): PartialElement;
1539
1625
 
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 };
1626
+ export { type ButtonVariant, type DatePickerProps, type DatePickerValue, type FlexAlign, type FlexJustify, 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, panelSection, paragraph, popover, popoverArrow, preformated, progress, rating, ringProgress, row, scrollArea, segmented, select, selectBox, selectItem, selectList, skeleton, small, spinner, splitter, splitterHandle, splitterPanel, stack, steps, strong, subscript, superscript, table, tabs, tag, textarea, timeline, timelineItem, toast, toggleGroup, toolbar, toolbarSpacer, tooltip, transitionGroup, unorderedList };