@domphy/ui 0.21.1 → 0.21.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/dist/index.d.cts CHANGED
@@ -358,6 +358,8 @@ declare function details(props?: {
358
358
  * fades via opacity, locks page scroll while open, traps Tab focus within the
359
359
  * dialog, restores focus to the previously focused element on close, sets
360
360
  * `aria-modal`, and closes on outside (backdrop) click. Apply to a `<dialog>`.
361
+ * Closed state is inline `visibility`/`pointer-events`/`display:none` so a
362
+ * consumer `style.display` cannot keep the node in layout.
361
363
  *
362
364
  * Accessible name/description: pass `labelledBy`/`describedBy` the `id` of a
363
365
  * heading/paragraph inside the dialog (Radix Title/Description parity). The
@@ -458,6 +460,10 @@ declare function empty(props?: {
458
460
  * caught. Errors during static construction propagate normally — those are
459
461
  * programming errors, not runtime data errors.
460
462
  *
463
+ * `reset()` restores the original children (including a reactive children
464
+ * function) so the next evaluation runs again — it does not leave the host
465
+ * empty.
466
+ *
461
467
  * @hostTag any
462
468
  * @param props.fallback - Fallback element or factory `(error, reset) => element`. Defaults to a plain error message div.
463
469
  * @param props.onError - Optional callback for logging/telemetry.
@@ -613,7 +619,7 @@ declare function inputCheckbox(props?: {
613
619
  /**
614
620
  * Styles a native color picker swatch with themed padding, rounded swatch and
615
621
  * disabled styling. Apply to an `<input>` element of type `color` (the patch
616
- * sets `type: "color"`).
622
+ * default is `type: "color"`; a native `type` wins).
617
623
  *
618
624
  * @hostTag input
619
625
  * @param props.color - Optional theme color tone used for the disabled state (`ValueOrState<ThemeColor>`). Defaults to `"neutral"`.
@@ -629,7 +635,7 @@ type InputDateTimeMode = "date" | "time" | "week" | "month" | "datetime-local";
629
635
  /**
630
636
  * Styles a native date/time input with themed border, padding, hover, focus,
631
637
  * invalid and disabled states. The `mode` selects the input `type`. Apply to
632
- * an `<input>` element (the patch sets `type` to the chosen `mode`).
638
+ * an `<input>` element (the patch default `type` is the chosen `mode`; a native `type` wins).
633
639
  *
634
640
  * @hostTag input
635
641
  * @param props.mode - Input mode selecting the host `type`: `"date" | "time" | "week" | "month" | "datetime-local"`. Defaults to `"datetime-local"`.
@@ -646,7 +652,7 @@ declare function inputDateTime(props?: {
646
652
  /**
647
653
  * Styles a native file input with a themed upload button, border, hover, focus
648
654
  * and disabled states. Apply to an `<input>` element of type `file` (the patch
649
- * sets `type: "file"`).
655
+ * default is `type: "file"`; a native `type` wins).
650
656
  *
651
657
  * @hostTag input
652
658
  * @param props.color - Optional theme color tone for text/border and the upload button (`ValueOrState<ThemeColor>`). Defaults to `"neutral"`.
@@ -661,7 +667,7 @@ declare function inputFile(props?: {
661
667
  /**
662
668
  * Styles a native number input with themed border, padding, visible spin
663
669
  * buttons, hover, focus and disabled states. Apply to an `<input>` element of
664
- * type `number` (the patch sets `type: "number"`).
670
+ * type `number` (the patch default is `type: "number"`; a native `type` wins).
665
671
  *
666
672
  * @hostTag input
667
673
  * @param props.color - Optional theme color tone for text/border (`ValueOrState<ThemeColor>`). Defaults to `"neutral"`.
@@ -687,16 +693,32 @@ declare function inputOTP(): PartialElement;
687
693
  /**
688
694
  * Password input wrapper: a styled `<div>` that inserts an `<input type="password">`
689
695
  * and a show/hide toggle button. The outer div carries the focus-ring outline via
690
- * `:focus-within`. Apply to an empty `<div>`.
696
+ * `:focus-within`. Apply to an empty `<div>`. Host `value`/`name`/`onInput`/
697
+ * `disabled`/`required` are forwarded onto the real input so the field
698
+ * participates in FormData.
691
699
  *
692
700
  * @hostTag div
693
701
  * @param props.color - Base color tone for border/background/text. Defaults to `"neutral"`.
694
702
  * @param props.accentColor - Accent outline color on focus-within. Defaults to `"primary"`.
695
- * @example { div: null, $: [inputPassword()] }
703
+ * @param props.value - Forwarded onto the inner input. Optional.
704
+ * @param props.name - Forwarded onto the inner input (FormData key). Optional.
705
+ * @param props.onInput - Forwarded onto the inner input. Optional.
706
+ * @param props.disabled - Forwarded onto the inner input. Optional.
707
+ * @param props.required - Forwarded onto the inner input. Optional.
708
+ * @param props.autocomplete - Native autocomplete token. Defaults to `"current-password"`.
709
+ * @param props.ariaLabel - Accessible name for the inner input. Defaults to `"Password"`.
710
+ * @example { div: null, name: "password", $: [inputPassword()] }
696
711
  */
697
712
  declare function inputPassword(props?: {
698
713
  color?: ValueOrState<ThemeColor>;
699
714
  accentColor?: ValueOrState<ThemeColor>;
715
+ value?: ValueOrState<string>;
716
+ name?: string;
717
+ onInput?: (event: Event) => void;
718
+ disabled?: ValueOrState<boolean>;
719
+ required?: boolean;
720
+ autocomplete?: string;
721
+ ariaLabel?: string;
700
722
  }): PartialElement;
701
723
 
702
724
  /**
@@ -732,7 +754,7 @@ declare function inputRange(props?: {
732
754
  /**
733
755
  * Styles a search input with themed border, padding, placeholder color, native
734
756
  * search decorations, hover, focus and disabled states. Apply to an `<input>`
735
- * element of type `search` (the patch sets `type: "search"`).
757
+ * element of type `search` (the patch default is `type: "search"`; a native `type` wins).
736
758
  *
737
759
  * @hostTag input
738
760
  * @param props.color - Optional theme color tone for text/border/placeholder (`ValueOrState<ThemeColor>`). Defaults to `"neutral"`.
@@ -845,7 +867,7 @@ declare function linkButton(props?: {
845
867
  * @param props.color - Surface color tone. Optional `ThemeColor`, defaults to `"neutral"`.
846
868
  * @example { ul: [...], $: [list()] }
847
869
  */
848
- declare function list(_props?: {
870
+ declare function list(props?: {
849
871
  color?: ThemeColor;
850
872
  }): PartialElement;
851
873
  /**
@@ -1094,11 +1116,22 @@ declare function progress(props?: {
1094
1116
  accentColor?: ValueOrState<ThemeColor>;
1095
1117
  }): PartialElement;
1096
1118
 
1119
+ type RatingProps = {
1120
+ value?: ValueOrState<number>;
1121
+ max?: number;
1122
+ onChange?: (value: number) => void;
1123
+ readOnly?: boolean;
1124
+ color?: ThemeColor;
1125
+ };
1097
1126
  /**
1098
1127
  * Interactive star rating applied to a container `<div>`. Manages its own star
1099
1128
  * children: click to set, Arrow keys to adjust, hover to preview. In `readOnly`
1100
1129
  * mode stars are non-interactive. Apply to a `<div>` element.
1101
1130
  *
1131
+ * Star insert runs in `_onInit` (SSR markup). `onChange`/`readOnly`/`max` and
1132
+ * a plain-number `value` stay live via `behavior()` `update()` so a reused
1133
+ * node picks up the latest factory props.
1134
+ *
1102
1135
  * @hostTag div
1103
1136
  * @param props.value - Current rating (0 – max). `ValueOrState<number>`, defaults to `0`.
1104
1137
  * @param props.max - Total number of stars. Optional `number`, defaults to `5`.
@@ -1107,13 +1140,7 @@ declare function progress(props?: {
1107
1140
  * @param props.color - Star color tone. Optional `ThemeColor`, defaults to `"warning"`.
1108
1141
  * @example { div: null, $: [rating({ value: ratingState, onChange: (v) => ratingState.set(v) })] }
1109
1142
  */
1110
- declare function rating(props?: {
1111
- value?: ValueOrState<number>;
1112
- max?: number;
1113
- onChange?: (value: number) => void;
1114
- readOnly?: boolean;
1115
- color?: ThemeColor;
1116
- }): PartialElement;
1143
+ declare function rating(props?: RatingProps): PartialElement;
1117
1144
 
1118
1145
  /**
1119
1146
  * Circular ring progress indicator rendered via CSS `conic-gradient` and a
@@ -1350,17 +1377,6 @@ declare function splitter(props?: {
1350
1377
  min?: number;
1351
1378
  max?: number;
1352
1379
  }): PartialElement;
1353
- /**
1354
- * The resizable panel inside a `splitter`. Reads the `splitter` context and binds its
1355
- * width (horizontal) or height (vertical) to the context `size` state, updating reactively as
1356
- * the handle is dragged. Intended for exactly two panels either side of one `splitterHandle`:
1357
- * the first `splitterPanel` mounted takes `size`%, and the second takes the complementary
1358
- * `100 - size`% — so the pair always sums to the full width/height instead of both tracking
1359
- * the same number (which would make them grow and shrink together instead of trading space).
1360
- * Warns if used outside a `splitter`. Takes no props.
1361
- *
1362
- * @example { div: [...], $: [splitterPanel()] }
1363
- */
1364
1380
  declare function splitterPanel(): PartialElement;
1365
1381
  /**
1366
1382
  * The draggable divider inside a `splitter`. Reads the `splitter` context, shows the
@@ -1488,11 +1504,11 @@ declare function tabs(props?: {
1488
1504
  /**
1489
1505
  * Styles an inline chip/tag (rounded, bordered, optional remove button).
1490
1506
  * No host tag check; typically applied to a `<span>`. When `removable` is true,
1491
- * a close button is inserted that removes the host node on click.
1507
+ * a close button is inserted that removes the host node on click or Enter/Space.
1492
1508
  *
1493
1509
  * @hostTag span
1494
1510
  * @param props.color - Theme color for the chip background/border/text. Optional, accepts a value or state. Defaults to `"neutral"`.
1495
- * @param props.removable - When true, renders a remove (x) button that removes the tag on click. Optional. Defaults to `false`.
1511
+ * @param props.removable - When true, renders a remove (x) button that removes the tag on click or Enter/Space. Optional. Defaults to `false`.
1496
1512
  * @example { span: "Label", $: [tag({ removable: true })] }
1497
1513
  */
1498
1514
  declare function tag(props?: {
@@ -1507,7 +1523,7 @@ declare function tag(props?: {
1507
1523
  * @hostTag textarea
1508
1524
  * @param props.color - Theme color for the border and text. Optional, accepts a value or state. Defaults to `"neutral"`.
1509
1525
  * @param props.accentColor - Theme color for hover/focus outline. Optional, accepts a value or state. Defaults to `"primary"`.
1510
- * @param props.autoResize - When true, grows the textarea height to fit its content on input. Optional. Defaults to `false`.
1526
+ * @param props.autoResize - When true, grows the textarea height to fit its content on input and when `value` updates. Optional. Defaults to `false`.
1511
1527
  * @example { textarea: null, $: [textarea({ autoResize: true })] }
1512
1528
  */
1513
1529
  declare function textarea(props?: {
package/dist/index.d.ts CHANGED
@@ -358,6 +358,8 @@ declare function details(props?: {
358
358
  * fades via opacity, locks page scroll while open, traps Tab focus within the
359
359
  * dialog, restores focus to the previously focused element on close, sets
360
360
  * `aria-modal`, and closes on outside (backdrop) click. Apply to a `<dialog>`.
361
+ * Closed state is inline `visibility`/`pointer-events`/`display:none` so a
362
+ * consumer `style.display` cannot keep the node in layout.
361
363
  *
362
364
  * Accessible name/description: pass `labelledBy`/`describedBy` the `id` of a
363
365
  * heading/paragraph inside the dialog (Radix Title/Description parity). The
@@ -458,6 +460,10 @@ declare function empty(props?: {
458
460
  * caught. Errors during static construction propagate normally — those are
459
461
  * programming errors, not runtime data errors.
460
462
  *
463
+ * `reset()` restores the original children (including a reactive children
464
+ * function) so the next evaluation runs again — it does not leave the host
465
+ * empty.
466
+ *
461
467
  * @hostTag any
462
468
  * @param props.fallback - Fallback element or factory `(error, reset) => element`. Defaults to a plain error message div.
463
469
  * @param props.onError - Optional callback for logging/telemetry.
@@ -613,7 +619,7 @@ declare function inputCheckbox(props?: {
613
619
  /**
614
620
  * Styles a native color picker swatch with themed padding, rounded swatch and
615
621
  * disabled styling. Apply to an `<input>` element of type `color` (the patch
616
- * sets `type: "color"`).
622
+ * default is `type: "color"`; a native `type` wins).
617
623
  *
618
624
  * @hostTag input
619
625
  * @param props.color - Optional theme color tone used for the disabled state (`ValueOrState<ThemeColor>`). Defaults to `"neutral"`.
@@ -629,7 +635,7 @@ type InputDateTimeMode = "date" | "time" | "week" | "month" | "datetime-local";
629
635
  /**
630
636
  * Styles a native date/time input with themed border, padding, hover, focus,
631
637
  * invalid and disabled states. The `mode` selects the input `type`. Apply to
632
- * an `<input>` element (the patch sets `type` to the chosen `mode`).
638
+ * an `<input>` element (the patch default `type` is the chosen `mode`; a native `type` wins).
633
639
  *
634
640
  * @hostTag input
635
641
  * @param props.mode - Input mode selecting the host `type`: `"date" | "time" | "week" | "month" | "datetime-local"`. Defaults to `"datetime-local"`.
@@ -646,7 +652,7 @@ declare function inputDateTime(props?: {
646
652
  /**
647
653
  * Styles a native file input with a themed upload button, border, hover, focus
648
654
  * and disabled states. Apply to an `<input>` element of type `file` (the patch
649
- * sets `type: "file"`).
655
+ * default is `type: "file"`; a native `type` wins).
650
656
  *
651
657
  * @hostTag input
652
658
  * @param props.color - Optional theme color tone for text/border and the upload button (`ValueOrState<ThemeColor>`). Defaults to `"neutral"`.
@@ -661,7 +667,7 @@ declare function inputFile(props?: {
661
667
  /**
662
668
  * Styles a native number input with themed border, padding, visible spin
663
669
  * buttons, hover, focus and disabled states. Apply to an `<input>` element of
664
- * type `number` (the patch sets `type: "number"`).
670
+ * type `number` (the patch default is `type: "number"`; a native `type` wins).
665
671
  *
666
672
  * @hostTag input
667
673
  * @param props.color - Optional theme color tone for text/border (`ValueOrState<ThemeColor>`). Defaults to `"neutral"`.
@@ -687,16 +693,32 @@ declare function inputOTP(): PartialElement;
687
693
  /**
688
694
  * Password input wrapper: a styled `<div>` that inserts an `<input type="password">`
689
695
  * and a show/hide toggle button. The outer div carries the focus-ring outline via
690
- * `:focus-within`. Apply to an empty `<div>`.
696
+ * `:focus-within`. Apply to an empty `<div>`. Host `value`/`name`/`onInput`/
697
+ * `disabled`/`required` are forwarded onto the real input so the field
698
+ * participates in FormData.
691
699
  *
692
700
  * @hostTag div
693
701
  * @param props.color - Base color tone for border/background/text. Defaults to `"neutral"`.
694
702
  * @param props.accentColor - Accent outline color on focus-within. Defaults to `"primary"`.
695
- * @example { div: null, $: [inputPassword()] }
703
+ * @param props.value - Forwarded onto the inner input. Optional.
704
+ * @param props.name - Forwarded onto the inner input (FormData key). Optional.
705
+ * @param props.onInput - Forwarded onto the inner input. Optional.
706
+ * @param props.disabled - Forwarded onto the inner input. Optional.
707
+ * @param props.required - Forwarded onto the inner input. Optional.
708
+ * @param props.autocomplete - Native autocomplete token. Defaults to `"current-password"`.
709
+ * @param props.ariaLabel - Accessible name for the inner input. Defaults to `"Password"`.
710
+ * @example { div: null, name: "password", $: [inputPassword()] }
696
711
  */
697
712
  declare function inputPassword(props?: {
698
713
  color?: ValueOrState<ThemeColor>;
699
714
  accentColor?: ValueOrState<ThemeColor>;
715
+ value?: ValueOrState<string>;
716
+ name?: string;
717
+ onInput?: (event: Event) => void;
718
+ disabled?: ValueOrState<boolean>;
719
+ required?: boolean;
720
+ autocomplete?: string;
721
+ ariaLabel?: string;
700
722
  }): PartialElement;
701
723
 
702
724
  /**
@@ -732,7 +754,7 @@ declare function inputRange(props?: {
732
754
  /**
733
755
  * Styles a search input with themed border, padding, placeholder color, native
734
756
  * search decorations, hover, focus and disabled states. Apply to an `<input>`
735
- * element of type `search` (the patch sets `type: "search"`).
757
+ * element of type `search` (the patch default is `type: "search"`; a native `type` wins).
736
758
  *
737
759
  * @hostTag input
738
760
  * @param props.color - Optional theme color tone for text/border/placeholder (`ValueOrState<ThemeColor>`). Defaults to `"neutral"`.
@@ -845,7 +867,7 @@ declare function linkButton(props?: {
845
867
  * @param props.color - Surface color tone. Optional `ThemeColor`, defaults to `"neutral"`.
846
868
  * @example { ul: [...], $: [list()] }
847
869
  */
848
- declare function list(_props?: {
870
+ declare function list(props?: {
849
871
  color?: ThemeColor;
850
872
  }): PartialElement;
851
873
  /**
@@ -1094,11 +1116,22 @@ declare function progress(props?: {
1094
1116
  accentColor?: ValueOrState<ThemeColor>;
1095
1117
  }): PartialElement;
1096
1118
 
1119
+ type RatingProps = {
1120
+ value?: ValueOrState<number>;
1121
+ max?: number;
1122
+ onChange?: (value: number) => void;
1123
+ readOnly?: boolean;
1124
+ color?: ThemeColor;
1125
+ };
1097
1126
  /**
1098
1127
  * Interactive star rating applied to a container `<div>`. Manages its own star
1099
1128
  * children: click to set, Arrow keys to adjust, hover to preview. In `readOnly`
1100
1129
  * mode stars are non-interactive. Apply to a `<div>` element.
1101
1130
  *
1131
+ * Star insert runs in `_onInit` (SSR markup). `onChange`/`readOnly`/`max` and
1132
+ * a plain-number `value` stay live via `behavior()` `update()` so a reused
1133
+ * node picks up the latest factory props.
1134
+ *
1102
1135
  * @hostTag div
1103
1136
  * @param props.value - Current rating (0 – max). `ValueOrState<number>`, defaults to `0`.
1104
1137
  * @param props.max - Total number of stars. Optional `number`, defaults to `5`.
@@ -1107,13 +1140,7 @@ declare function progress(props?: {
1107
1140
  * @param props.color - Star color tone. Optional `ThemeColor`, defaults to `"warning"`.
1108
1141
  * @example { div: null, $: [rating({ value: ratingState, onChange: (v) => ratingState.set(v) })] }
1109
1142
  */
1110
- declare function rating(props?: {
1111
- value?: ValueOrState<number>;
1112
- max?: number;
1113
- onChange?: (value: number) => void;
1114
- readOnly?: boolean;
1115
- color?: ThemeColor;
1116
- }): PartialElement;
1143
+ declare function rating(props?: RatingProps): PartialElement;
1117
1144
 
1118
1145
  /**
1119
1146
  * Circular ring progress indicator rendered via CSS `conic-gradient` and a
@@ -1350,17 +1377,6 @@ declare function splitter(props?: {
1350
1377
  min?: number;
1351
1378
  max?: number;
1352
1379
  }): PartialElement;
1353
- /**
1354
- * The resizable panel inside a `splitter`. Reads the `splitter` context and binds its
1355
- * width (horizontal) or height (vertical) to the context `size` state, updating reactively as
1356
- * the handle is dragged. Intended for exactly two panels either side of one `splitterHandle`:
1357
- * the first `splitterPanel` mounted takes `size`%, and the second takes the complementary
1358
- * `100 - size`% — so the pair always sums to the full width/height instead of both tracking
1359
- * the same number (which would make them grow and shrink together instead of trading space).
1360
- * Warns if used outside a `splitter`. Takes no props.
1361
- *
1362
- * @example { div: [...], $: [splitterPanel()] }
1363
- */
1364
1380
  declare function splitterPanel(): PartialElement;
1365
1381
  /**
1366
1382
  * The draggable divider inside a `splitter`. Reads the `splitter` context, shows the
@@ -1488,11 +1504,11 @@ declare function tabs(props?: {
1488
1504
  /**
1489
1505
  * Styles an inline chip/tag (rounded, bordered, optional remove button).
1490
1506
  * No host tag check; typically applied to a `<span>`. When `removable` is true,
1491
- * a close button is inserted that removes the host node on click.
1507
+ * a close button is inserted that removes the host node on click or Enter/Space.
1492
1508
  *
1493
1509
  * @hostTag span
1494
1510
  * @param props.color - Theme color for the chip background/border/text. Optional, accepts a value or state. Defaults to `"neutral"`.
1495
- * @param props.removable - When true, renders a remove (x) button that removes the tag on click. Optional. Defaults to `false`.
1511
+ * @param props.removable - When true, renders a remove (x) button that removes the tag on click or Enter/Space. Optional. Defaults to `false`.
1496
1512
  * @example { span: "Label", $: [tag({ removable: true })] }
1497
1513
  */
1498
1514
  declare function tag(props?: {
@@ -1507,7 +1523,7 @@ declare function tag(props?: {
1507
1523
  * @hostTag textarea
1508
1524
  * @param props.color - Theme color for the border and text. Optional, accepts a value or state. Defaults to `"neutral"`.
1509
1525
  * @param props.accentColor - Theme color for hover/focus outline. Optional, accepts a value or state. Defaults to `"primary"`.
1510
- * @param props.autoResize - When true, grows the textarea height to fit its content on input. Optional. Defaults to `false`.
1526
+ * @param props.autoResize - When true, grows the textarea height to fit its content on input and when `value` updates. Optional. Defaults to `false`.
1511
1527
  * @example { textarea: null, $: [textarea({ autoResize: true })] }
1512
1528
  */
1513
1529
  declare function textarea(props?: {