@domphy/ui 0.20.11 → 0.21.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/CHANGELOG.md +3 -0
- package/dist/core-theme-ui.global.js +5 -4
- package/dist/core-theme-ui.global.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -22
- package/dist/index.d.ts +80 -22
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ValueOrState, PartialElement, DomphyElement, State } from '@domphy/core';
|
|
1
|
+
import { ValueOrState, PartialElement, DomphyElement, State, Listener } from '@domphy/core';
|
|
2
2
|
import { ThemeColor } from '@domphy/theme';
|
|
3
3
|
import { Placement as Placement$1 } from '@domphy/floating';
|
|
4
4
|
export { Placement } from '@domphy/floating';
|
|
@@ -501,6 +501,43 @@ declare function formGroup(props?: {
|
|
|
501
501
|
layout?: "horizontal" | "vertical";
|
|
502
502
|
}): PartialElement;
|
|
503
503
|
|
|
504
|
+
type FlexAlign = "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
|
|
505
|
+
/**
|
|
506
|
+
* A vertical flex column with spacing between children. The general-purpose
|
|
507
|
+
* primitive for stacking blocks — form sections, panel content, card bodies —
|
|
508
|
+
* instead of hand-rolling `display: flex; flexDirection: column; gap: ...`.
|
|
509
|
+
* Styles the host only; apply to any block element.
|
|
510
|
+
*
|
|
511
|
+
* @param props.gap - Spacing multiplier for gap between children (default 3 = 0.75em at density 1).
|
|
512
|
+
* @param props.align - Cross-axis alignment (`alignItems`). Unset by default (flex default, stretch).
|
|
513
|
+
* @example { div: [{ h3: "Title" }, { p: "Body" }], $: [stack()] }
|
|
514
|
+
* @example { div: [...], $: [stack({ gap: 2, align: "center" })] }
|
|
515
|
+
*/
|
|
516
|
+
declare function stack(props?: {
|
|
517
|
+
gap?: number;
|
|
518
|
+
align?: FlexAlign;
|
|
519
|
+
}): PartialElement;
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* A CSS grid with a column template and spacing between cells — the
|
|
523
|
+
* general-purpose primitive for card/property/stat grids instead of
|
|
524
|
+
* hand-rolling `display: "grid"; gridTemplateColumns: ...; gap: ...`.
|
|
525
|
+
* Mirrors `row()`'s contract. Styles the host only; apply to any block
|
|
526
|
+
* element.
|
|
527
|
+
*
|
|
528
|
+
* @param props.columns - Column count (expanded to `repeat(N, minmax(0, 1fr))`)
|
|
529
|
+
* or a raw `grid-template-columns` value. Defaults to `1`.
|
|
530
|
+
* @param props.gap - Spacing multiplier for gap between cells (default 4 = 1em at density 1).
|
|
531
|
+
* @param props.align - Block-axis alignment of items (`alignItems`). Unset by default.
|
|
532
|
+
* @example { div: [{ div: "A" }, { div: "B" }], $: [grid({ columns: 2 })] }
|
|
533
|
+
* @example { div: [...], $: [grid({ columns: "repeat(auto-fill, minmax(12em, 1fr))", gap: 6 })] }
|
|
534
|
+
*/
|
|
535
|
+
declare function grid(props?: {
|
|
536
|
+
columns?: number | string;
|
|
537
|
+
gap?: number;
|
|
538
|
+
align?: FlexAlign;
|
|
539
|
+
}): PartialElement;
|
|
540
|
+
|
|
504
541
|
/**
|
|
505
542
|
* Styles a heading, scaling its font size by level (h1 largest … h6 smallest)
|
|
506
543
|
* relative to the theme base size. Apply to a heading element `<h1>`–`<h6>`.
|
|
@@ -712,17 +749,19 @@ declare function inputSwitch(props?: {
|
|
|
712
749
|
}): PartialElement;
|
|
713
750
|
|
|
714
751
|
/**
|
|
715
|
-
* Themed single-line text input primitive. Sets `type
|
|
716
|
-
* field with themed border, focus ring, placeholder, disabled and
|
|
717
|
-
* (`data-status`) states. Apply to an `<input>` element.
|
|
752
|
+
* Themed single-line text input primitive. Sets `type` (default `"text"`) and
|
|
753
|
+
* styles the field with themed border, focus ring, placeholder, disabled and
|
|
754
|
+
* validation (`data-status`) states. Apply to an `<input>` element.
|
|
718
755
|
*
|
|
719
756
|
* @hostTag input
|
|
720
757
|
* @param props - Optional configuration.
|
|
758
|
+
* @param props.type - The input's `type` attribute (e.g. `"email"`, `"url"`, `"tel"`). Defaults to `"text"`.
|
|
721
759
|
* @param props.color - Base color tone for text/border/background. Defaults to `"neutral"`.
|
|
722
760
|
* @param props.accentColor - Accent color tone for the hover/focus outline. Defaults to `"primary"`.
|
|
723
761
|
* @example { input: "", type: "text", placeholder: "Name", $: [inputText()] }
|
|
724
762
|
*/
|
|
725
763
|
declare function inputText(props?: {
|
|
764
|
+
type?: string;
|
|
726
765
|
color?: ValueOrState<ThemeColor>;
|
|
727
766
|
accentColor?: ValueOrState<ThemeColor>;
|
|
728
767
|
}): PartialElement;
|
|
@@ -1089,23 +1128,6 @@ declare function ringProgress(props?: {
|
|
|
1089
1128
|
thickness?: number;
|
|
1090
1129
|
}): PartialElement;
|
|
1091
1130
|
|
|
1092
|
-
type FlexAlign = "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
|
|
1093
|
-
/**
|
|
1094
|
-
* A vertical flex column with spacing between children. The general-purpose
|
|
1095
|
-
* primitive for stacking blocks — form sections, panel content, card bodies —
|
|
1096
|
-
* instead of hand-rolling `display: flex; flexDirection: column; gap: ...`.
|
|
1097
|
-
* Styles the host only; apply to any block element.
|
|
1098
|
-
*
|
|
1099
|
-
* @param props.gap - Spacing multiplier for gap between children (default 3 = 0.75em at density 1).
|
|
1100
|
-
* @param props.align - Cross-axis alignment (`alignItems`). Unset by default (flex default, stretch).
|
|
1101
|
-
* @example { div: [{ h3: "Title" }, { p: "Body" }], $: [stack()] }
|
|
1102
|
-
* @example { div: [...], $: [stack({ gap: 2, align: "center" })] }
|
|
1103
|
-
*/
|
|
1104
|
-
declare function stack(props?: {
|
|
1105
|
-
gap?: number;
|
|
1106
|
-
align?: FlexAlign;
|
|
1107
|
-
}): PartialElement;
|
|
1108
|
-
|
|
1109
1131
|
type FlexJustify = "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
1110
1132
|
/**
|
|
1111
1133
|
* A horizontal flex row with spacing between children, vertically centered by
|
|
@@ -1615,4 +1637,40 @@ declare function unorderedList(props?: {
|
|
|
1615
1637
|
color?: ValueOrState<ThemeColor>;
|
|
1616
1638
|
}): PartialElement;
|
|
1617
1639
|
|
|
1618
|
-
|
|
1640
|
+
/**
|
|
1641
|
+
* Visually hides an element while keeping it in the accessibility tree — the
|
|
1642
|
+
* classic "sr-only" recipe for screen-reader-only labels, live-region text,
|
|
1643
|
+
* and skip links (before focus). Styles the host only; apply to any element.
|
|
1644
|
+
*
|
|
1645
|
+
* @example { span: "Opens in a new tab", $: [visuallyHidden()] }
|
|
1646
|
+
*/
|
|
1647
|
+
declare function visuallyHidden(): PartialElement;
|
|
1648
|
+
|
|
1649
|
+
/** Named elevation levels for floating/raised surfaces. */
|
|
1650
|
+
type ElevationLevel = "low" | "medium" | "high";
|
|
1651
|
+
/**
|
|
1652
|
+
* Shared box-shadow value for a named elevation level. Used by floating/raised
|
|
1653
|
+
* surface patches (popover, menu, dialog, drawer, toast, tooltip, combobox/
|
|
1654
|
+
* selectBox dropdown, datePicker popup, fab) so elevation reads consistently
|
|
1655
|
+
* across the library instead of each patch picking its own shadow.
|
|
1656
|
+
*/
|
|
1657
|
+
declare function elevation(level: ElevationLevel): string;
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* Shared `:focus-visible` ring — ring-offset pattern used by Radix / shadcn /
|
|
1661
|
+
* Vercel / Linear:
|
|
1662
|
+
*
|
|
1663
|
+
* 1. 2px "gap" in the surface tone (reads as space between control + ring)
|
|
1664
|
+
* 2. 2px accent halo outside that gap
|
|
1665
|
+
*
|
|
1666
|
+
* Implemented as a layered `box-shadow` so it composes with a control's own
|
|
1667
|
+
* resting outline / elevation instead of replacing them. Prefer this over a
|
|
1668
|
+
* flush `0 0 0 2px` ring (looks like a thick pastel border glued to the edge)
|
|
1669
|
+
* and over the browser default outline.
|
|
1670
|
+
*
|
|
1671
|
+
* Accent at `shift-9` stays legible on both light and dark surfaces; the
|
|
1672
|
+
* washed `shift-6` flush ring is what made focus look broken in product UIs.
|
|
1673
|
+
*/
|
|
1674
|
+
declare function focusRing(listener: Listener, color?: ThemeColor): string;
|
|
1675
|
+
|
|
1676
|
+
export { type ButtonVariant, type DatePickerProps, type DatePickerValue, type ElevationLevel, 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, elevation, emphasis, empty, errorBoundary, fab, figure, focusRing, formGroup, grid, 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, visuallyHidden };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ValueOrState, PartialElement, DomphyElement, State } from '@domphy/core';
|
|
1
|
+
import { ValueOrState, PartialElement, DomphyElement, State, Listener } from '@domphy/core';
|
|
2
2
|
import { ThemeColor } from '@domphy/theme';
|
|
3
3
|
import { Placement as Placement$1 } from '@domphy/floating';
|
|
4
4
|
export { Placement } from '@domphy/floating';
|
|
@@ -501,6 +501,43 @@ declare function formGroup(props?: {
|
|
|
501
501
|
layout?: "horizontal" | "vertical";
|
|
502
502
|
}): PartialElement;
|
|
503
503
|
|
|
504
|
+
type FlexAlign = "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
|
|
505
|
+
/**
|
|
506
|
+
* A vertical flex column with spacing between children. The general-purpose
|
|
507
|
+
* primitive for stacking blocks — form sections, panel content, card bodies —
|
|
508
|
+
* instead of hand-rolling `display: flex; flexDirection: column; gap: ...`.
|
|
509
|
+
* Styles the host only; apply to any block element.
|
|
510
|
+
*
|
|
511
|
+
* @param props.gap - Spacing multiplier for gap between children (default 3 = 0.75em at density 1).
|
|
512
|
+
* @param props.align - Cross-axis alignment (`alignItems`). Unset by default (flex default, stretch).
|
|
513
|
+
* @example { div: [{ h3: "Title" }, { p: "Body" }], $: [stack()] }
|
|
514
|
+
* @example { div: [...], $: [stack({ gap: 2, align: "center" })] }
|
|
515
|
+
*/
|
|
516
|
+
declare function stack(props?: {
|
|
517
|
+
gap?: number;
|
|
518
|
+
align?: FlexAlign;
|
|
519
|
+
}): PartialElement;
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* A CSS grid with a column template and spacing between cells — the
|
|
523
|
+
* general-purpose primitive for card/property/stat grids instead of
|
|
524
|
+
* hand-rolling `display: "grid"; gridTemplateColumns: ...; gap: ...`.
|
|
525
|
+
* Mirrors `row()`'s contract. Styles the host only; apply to any block
|
|
526
|
+
* element.
|
|
527
|
+
*
|
|
528
|
+
* @param props.columns - Column count (expanded to `repeat(N, minmax(0, 1fr))`)
|
|
529
|
+
* or a raw `grid-template-columns` value. Defaults to `1`.
|
|
530
|
+
* @param props.gap - Spacing multiplier for gap between cells (default 4 = 1em at density 1).
|
|
531
|
+
* @param props.align - Block-axis alignment of items (`alignItems`). Unset by default.
|
|
532
|
+
* @example { div: [{ div: "A" }, { div: "B" }], $: [grid({ columns: 2 })] }
|
|
533
|
+
* @example { div: [...], $: [grid({ columns: "repeat(auto-fill, minmax(12em, 1fr))", gap: 6 })] }
|
|
534
|
+
*/
|
|
535
|
+
declare function grid(props?: {
|
|
536
|
+
columns?: number | string;
|
|
537
|
+
gap?: number;
|
|
538
|
+
align?: FlexAlign;
|
|
539
|
+
}): PartialElement;
|
|
540
|
+
|
|
504
541
|
/**
|
|
505
542
|
* Styles a heading, scaling its font size by level (h1 largest … h6 smallest)
|
|
506
543
|
* relative to the theme base size. Apply to a heading element `<h1>`–`<h6>`.
|
|
@@ -712,17 +749,19 @@ declare function inputSwitch(props?: {
|
|
|
712
749
|
}): PartialElement;
|
|
713
750
|
|
|
714
751
|
/**
|
|
715
|
-
* Themed single-line text input primitive. Sets `type
|
|
716
|
-
* field with themed border, focus ring, placeholder, disabled and
|
|
717
|
-
* (`data-status`) states. Apply to an `<input>` element.
|
|
752
|
+
* Themed single-line text input primitive. Sets `type` (default `"text"`) and
|
|
753
|
+
* styles the field with themed border, focus ring, placeholder, disabled and
|
|
754
|
+
* validation (`data-status`) states. Apply to an `<input>` element.
|
|
718
755
|
*
|
|
719
756
|
* @hostTag input
|
|
720
757
|
* @param props - Optional configuration.
|
|
758
|
+
* @param props.type - The input's `type` attribute (e.g. `"email"`, `"url"`, `"tel"`). Defaults to `"text"`.
|
|
721
759
|
* @param props.color - Base color tone for text/border/background. Defaults to `"neutral"`.
|
|
722
760
|
* @param props.accentColor - Accent color tone for the hover/focus outline. Defaults to `"primary"`.
|
|
723
761
|
* @example { input: "", type: "text", placeholder: "Name", $: [inputText()] }
|
|
724
762
|
*/
|
|
725
763
|
declare function inputText(props?: {
|
|
764
|
+
type?: string;
|
|
726
765
|
color?: ValueOrState<ThemeColor>;
|
|
727
766
|
accentColor?: ValueOrState<ThemeColor>;
|
|
728
767
|
}): PartialElement;
|
|
@@ -1089,23 +1128,6 @@ declare function ringProgress(props?: {
|
|
|
1089
1128
|
thickness?: number;
|
|
1090
1129
|
}): PartialElement;
|
|
1091
1130
|
|
|
1092
|
-
type FlexAlign = "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
|
|
1093
|
-
/**
|
|
1094
|
-
* A vertical flex column with spacing between children. The general-purpose
|
|
1095
|
-
* primitive for stacking blocks — form sections, panel content, card bodies —
|
|
1096
|
-
* instead of hand-rolling `display: flex; flexDirection: column; gap: ...`.
|
|
1097
|
-
* Styles the host only; apply to any block element.
|
|
1098
|
-
*
|
|
1099
|
-
* @param props.gap - Spacing multiplier for gap between children (default 3 = 0.75em at density 1).
|
|
1100
|
-
* @param props.align - Cross-axis alignment (`alignItems`). Unset by default (flex default, stretch).
|
|
1101
|
-
* @example { div: [{ h3: "Title" }, { p: "Body" }], $: [stack()] }
|
|
1102
|
-
* @example { div: [...], $: [stack({ gap: 2, align: "center" })] }
|
|
1103
|
-
*/
|
|
1104
|
-
declare function stack(props?: {
|
|
1105
|
-
gap?: number;
|
|
1106
|
-
align?: FlexAlign;
|
|
1107
|
-
}): PartialElement;
|
|
1108
|
-
|
|
1109
1131
|
type FlexJustify = "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
1110
1132
|
/**
|
|
1111
1133
|
* A horizontal flex row with spacing between children, vertically centered by
|
|
@@ -1615,4 +1637,40 @@ declare function unorderedList(props?: {
|
|
|
1615
1637
|
color?: ValueOrState<ThemeColor>;
|
|
1616
1638
|
}): PartialElement;
|
|
1617
1639
|
|
|
1618
|
-
|
|
1640
|
+
/**
|
|
1641
|
+
* Visually hides an element while keeping it in the accessibility tree — the
|
|
1642
|
+
* classic "sr-only" recipe for screen-reader-only labels, live-region text,
|
|
1643
|
+
* and skip links (before focus). Styles the host only; apply to any element.
|
|
1644
|
+
*
|
|
1645
|
+
* @example { span: "Opens in a new tab", $: [visuallyHidden()] }
|
|
1646
|
+
*/
|
|
1647
|
+
declare function visuallyHidden(): PartialElement;
|
|
1648
|
+
|
|
1649
|
+
/** Named elevation levels for floating/raised surfaces. */
|
|
1650
|
+
type ElevationLevel = "low" | "medium" | "high";
|
|
1651
|
+
/**
|
|
1652
|
+
* Shared box-shadow value for a named elevation level. Used by floating/raised
|
|
1653
|
+
* surface patches (popover, menu, dialog, drawer, toast, tooltip, combobox/
|
|
1654
|
+
* selectBox dropdown, datePicker popup, fab) so elevation reads consistently
|
|
1655
|
+
* across the library instead of each patch picking its own shadow.
|
|
1656
|
+
*/
|
|
1657
|
+
declare function elevation(level: ElevationLevel): string;
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* Shared `:focus-visible` ring — ring-offset pattern used by Radix / shadcn /
|
|
1661
|
+
* Vercel / Linear:
|
|
1662
|
+
*
|
|
1663
|
+
* 1. 2px "gap" in the surface tone (reads as space between control + ring)
|
|
1664
|
+
* 2. 2px accent halo outside that gap
|
|
1665
|
+
*
|
|
1666
|
+
* Implemented as a layered `box-shadow` so it composes with a control's own
|
|
1667
|
+
* resting outline / elevation instead of replacing them. Prefer this over a
|
|
1668
|
+
* flush `0 0 0 2px` ring (looks like a thick pastel border glued to the edge)
|
|
1669
|
+
* and over the browser default outline.
|
|
1670
|
+
*
|
|
1671
|
+
* Accent at `shift-9` stays legible on both light and dark surfaces; the
|
|
1672
|
+
* washed `shift-6` flush ring is what made focus look broken in product UIs.
|
|
1673
|
+
*/
|
|
1674
|
+
declare function focusRing(listener: Listener, color?: ThemeColor): string;
|
|
1675
|
+
|
|
1676
|
+
export { type ButtonVariant, type DatePickerProps, type DatePickerValue, type ElevationLevel, 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, elevation, emphasis, empty, errorBoundary, fab, figure, focusRing, formGroup, grid, 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, visuallyHidden };
|