@espressif/dashboard-ui-components 1.13.0 → 1.14.1

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.
Files changed (178) hide show
  1. package/.claude/rules/dashboard-ui-consumption.md +42 -0
  2. package/.cursor/rules/dashboard-ui-consumption.mdc +40 -1
  3. package/CHANGELOG.md +272 -0
  4. package/README.md +68 -6
  5. package/dist/{alert.props-CcKo49Rb.d.ts → alert.props-BuLuWmXA.d.ts} +3 -3
  6. package/dist/common/copyright-card/copyright-card.js +1 -1
  7. package/dist/common/footer-card/footer-card.js +2 -2
  8. package/dist/common/index.d.ts +3 -0
  9. package/dist/common/my-account-menu/my-account-menu.js +2 -2
  10. package/dist/common/page-loader/page-loader.js +4 -1
  11. package/dist/common/profile-card/profile-card.js +2 -2
  12. package/dist/components/accordion/accordion.js +6 -11
  13. package/dist/components/alert/index.d.ts +5 -5
  14. package/dist/components/anchored-panel/anchored-panel.js +4 -4
  15. package/dist/components/async-multi-select/async-multi-select.js +8 -8
  16. package/dist/components/avatar/avatar.js +1 -1
  17. package/dist/components/badge/index.d.ts +1 -1
  18. package/dist/components/bottom-sheet/_hooks/use-sheet-drag.js +112 -0
  19. package/dist/components/bottom-sheet/bottom-sheet.js +84 -0
  20. package/dist/components/bottom-sheet/index.d.ts +50 -0
  21. package/dist/components/bottom-sheet/index.js +3 -0
  22. package/dist/components/bubble/bubble.js +1 -1
  23. package/dist/components/button/button.js +2 -2
  24. package/dist/components/button/flash-button.js +4 -4
  25. package/dist/components/calendar/calendar.js +5 -5
  26. package/dist/components/cards/animated-card/animated-card.js +1 -1
  27. package/dist/components/cards/basic-details-card.js +2 -2
  28. package/dist/components/cards/collapsible-card.js +1 -1
  29. package/dist/components/cards/index.d.ts +2 -2
  30. package/dist/components/cards/no-data-card/no-data-card.js +2 -2
  31. package/dist/components/cards/section-card.js +12 -12
  32. package/dist/components/cards/simple-card.js +2 -5
  33. package/dist/components/category-card/category-card.js +2 -2
  34. package/dist/components/chart/chart.js +4 -4
  35. package/dist/components/chart/donut-chart.js +1 -1
  36. package/dist/components/chart/treemap-chart.js +1 -1
  37. package/dist/components/choice-card/choice-card.js +3 -3
  38. package/dist/components/code-editor/code-editor.js +4 -3
  39. package/dist/components/data-table/table-header.js +1 -1
  40. package/dist/components/date-range-picker/date-range-picker.js +3 -3
  41. package/dist/components/dynamic-list/dynamic-list.js +14 -13
  42. package/dist/components/dynamic-list/index.d.ts +1 -1
  43. package/dist/components/error-display/full-size-error/full-size-error.js +2 -2
  44. package/dist/components/expandable-text/expandable-text-overlay.js +1 -1
  45. package/dist/components/facet-filters/filter-group.js +2 -2
  46. package/dist/components/feature-grid/feature-grid.js +3 -3
  47. package/dist/components/file-input/file-input.js +8 -8
  48. package/dist/components/file-upload/file-upload.js +4 -4
  49. package/dist/components/fullscreen-dialog/fullscreen-dialog.js +1 -1
  50. package/dist/components/gradient-ring-button/_hooks/use-ring-geometry.js +116 -0
  51. package/dist/components/gradient-ring-button/gradient-ring-button.js +44 -0
  52. package/dist/components/gradient-ring-button/gradient-ring.js +77 -0
  53. package/dist/components/gradient-ring-button/index.d.ts +66 -0
  54. package/dist/components/gradient-ring-button/index.js +3 -0
  55. package/dist/components/horizontal-stepper/horizontal-stepper.js +4 -8
  56. package/dist/components/horizontal-stepper/index.d.ts +1 -1
  57. package/dist/components/icon-avatar/index.d.ts +3 -3
  58. package/dist/components/icon-text-action-card/index.d.ts +4 -4
  59. package/dist/components/index.d.ts +9 -7
  60. package/dist/components/index.js +5 -1
  61. package/dist/components/key-value-manager/key-value-manager-add-popover.js +1 -1
  62. package/dist/components/key-value-manager/key-value-manager-table.js +1 -1
  63. package/dist/components/link/link.js +7 -7
  64. package/dist/components/list/list-item.utils.js +5 -4
  65. package/dist/components/list/list.js +1 -1
  66. package/dist/components/list-details/index.d.ts +2 -2
  67. package/dist/components/markdown-content/markdown-content.components.js +2 -2
  68. package/dist/components/media-card/media-card-reveal.js +2 -2
  69. package/dist/components/media-card/media-card.js +2 -2
  70. package/dist/components/monospace-content/index.d.ts +4 -4
  71. package/dist/components/monospace-content/monospace-content.js +9 -11
  72. package/dist/components/nav-bar/nav-bar-mobile-menu.js +3 -3
  73. package/dist/components/nav-bar/nav-bar.js +4 -4
  74. package/dist/components/notice-strip/notice-strip.js +1 -1
  75. package/dist/components/option-card-group/option-card-group.js +2 -2
  76. package/dist/components/overflow-badge-list/index.d.ts +2 -2
  77. package/dist/components/overflow-badge-list/overflow-badge-list.js +3 -3
  78. package/dist/components/page-banner/page-banner.js +1 -1
  79. package/dist/components/page-container/page-container.js +1 -1
  80. package/dist/components/pagination/pagination.js +1 -1
  81. package/dist/components/progress-bar/progress-bar.js +2 -2
  82. package/dist/components/qr-code/qr-code.js +2 -2
  83. package/dist/components/radio-group/radio-group.js +3 -3
  84. package/dist/components/range-field/range-field.js +9 -12
  85. package/dist/components/readout/readout.js +1 -1
  86. package/dist/components/requirement-list/requirement-list.js +5 -10
  87. package/dist/components/scrollable-sections/scrollable-sections.js +1 -1
  88. package/dist/components/search-field-shell.js +8 -8
  89. package/dist/components/selectable-card-list/selectable-card-list-shared.js +6 -6
  90. package/dist/components/showcase-card/showcase-card.js +2 -2
  91. package/dist/components/sidebar/sidebar.js +13 -15
  92. package/dist/components/simple-clickable-card/index.d.ts +4 -4
  93. package/dist/components/simple-clickable-card/simple-clickable-card-shared.js +17 -23
  94. package/dist/components/simple-info-card/index.d.ts +3 -3
  95. package/dist/components/simple-list/index.d.ts +1 -1
  96. package/dist/components/simple-list/simple-list.js +8 -8
  97. package/dist/components/simple-paginated-list/simple-paginated-list.js +1 -4
  98. package/dist/components/stat-card/stat-card.js +7 -13
  99. package/dist/components/status-badge/index.d.ts +3 -3
  100. package/dist/components/status-badge/status-badge.js +4 -4
  101. package/dist/components/status-card-list/status-card-list.js +6 -6
  102. package/dist/components/tag/index.d.ts +1 -1
  103. package/dist/components/tag/tag.js +4 -4
  104. package/dist/components/tag-input/tag-input.js +12 -12
  105. package/dist/components/timeline/timeline.js +2 -2
  106. package/dist/components/toast/index.d.ts +1 -1
  107. package/dist/components/toast/toast.js +2 -2
  108. package/dist/components/toolbar/index.d.ts +5 -2
  109. package/dist/components/toolbar/toolbar-button.js +1 -1
  110. package/dist/components/toolbar/toolbar.js +9 -3
  111. package/dist/components/trace/trace.js +1 -1
  112. package/dist/components/transfer-list/transfer-list.js +2 -2
  113. package/dist/components/typography/index.d.ts +12 -3
  114. package/dist/components/typography/typography-variants.js +98 -13
  115. package/dist/components/typography/typography.js +4 -2
  116. package/dist/components/user-type-badge/user-type-badge.js +4 -4
  117. package/dist/components/vertical-stepper/vertical-stepper.js +11 -7
  118. package/dist/core/alert.js +3 -3
  119. package/dist/core/animate-ui/components/animate/code-header.js +1 -1
  120. package/dist/core/animate-ui/components/animate/code.js +1 -1
  121. package/dist/core/animate-ui/components/animate/tabs.js +6 -6
  122. package/dist/core/animate-ui/components/animate/tooltip.js +1 -1
  123. package/dist/core/animate-ui/components/base/progress.js +2 -2
  124. package/dist/core/animate-ui/components/radix/accordion.js +2 -2
  125. package/dist/core/animate-ui/components/radix/dialog.js +2 -2
  126. package/dist/core/animate-ui/components/radix/dropdown-menu.js +6 -6
  127. package/dist/core/animate-ui/components/radix/sheet.js +2 -2
  128. package/dist/core/animate-ui/components/radix/sidebar.js +8 -8
  129. package/dist/core/animate-ui/components/radix/toggle-group.js +4 -4
  130. package/dist/core/animate-ui/components/radix/toggle.js +1 -1
  131. package/dist/core/animate-ui/primitives/animate/tooltip.js +3 -0
  132. package/dist/core/badge.js +1 -1
  133. package/dist/core/breadcrumb.js +1 -1
  134. package/dist/core/button/button.js +2 -2
  135. package/dist/core/button/craft-button.js +4 -4
  136. package/dist/core/button-group.js +1 -1
  137. package/dist/core/button.js +2 -2
  138. package/dist/core/card.js +2 -2
  139. package/dist/core/combobox/combobox.js +3 -3
  140. package/dist/core/command.js +5 -5
  141. package/dist/core/field-label-row.js +4 -4
  142. package/dist/core/form.js +2 -2
  143. package/dist/core/index.d.ts +1 -1
  144. package/dist/core/input/input.js +11 -11
  145. package/dist/core/input-otp/input-otp.js +12 -12
  146. package/dist/core/label.js +1 -1
  147. package/dist/core/select.js +6 -6
  148. package/dist/core/separator.js +1 -1
  149. package/dist/core/table.js +2 -2
  150. package/dist/core/textarea/textarea.js +9 -9
  151. package/dist/{icon-avatar.props-RYtw2eSW.d.ts → icon-avatar.props-BJe0-vva.d.ts} +1 -1
  152. package/dist/{icon-text-action-card.props-B2ggncUK.d.ts → icon-text-action-card.props-BU7yFi2Q.d.ts} +2 -2
  153. package/dist/index.d.ts +9 -7
  154. package/dist/index.js +6 -2
  155. package/dist/layouts/entry-layout/entry-layout.js +1 -1
  156. package/dist/layouts/index.d.ts +21 -6
  157. package/dist/layouts/index.js +1 -1
  158. package/dist/layouts/minimal-workspace-layout/minimal-workspace-layout.js +10 -18
  159. package/dist/layouts/minimal-workspace-layout/sidebar-trigger.js +35 -7
  160. package/dist/layouts/workspace-layout/footer/footer.js +1 -1
  161. package/dist/markdown/index.d.ts +4 -4
  162. package/dist/{section-card-B7c5uc08.d.ts → section-card-DqQeQkzU.d.ts} +1 -1
  163. package/dist/{simple-clickable-card.props-BrPCw7CR.d.ts → simple-clickable-card.props-BhhotZMp.d.ts} +2 -2
  164. package/dist/{status-badge.props-lKlEOfRt.d.ts → status-badge.props-BVe8CmQZ.d.ts} +1 -1
  165. package/dist/styles/type-scale.js +153 -0
  166. package/dist/tailwind-preset.js +120 -1
  167. package/dist/toast/index.d.ts +1 -1
  168. package/dist/utils/cn.js +16 -5
  169. package/dist/utils/color.js +10 -1
  170. package/dist/utils/index.d.ts +37 -3
  171. package/dist/utils/index.js +2 -1
  172. package/dist/utils/variant.js +76 -76
  173. package/dist/{variant-D81RhpbR.d.ts → variant-DjdaxfIA.d.ts} +6 -1
  174. package/package.json +6 -2
  175. package/src/styles/colors.css +23 -2
  176. package/src/styles/theme.css +8 -3
  177. package/src/styles/type-scale.css +152 -0
  178. package/tailwind.preset.ts +23 -0
@@ -5,20 +5,31 @@ import { useSidebar } from "../../core/animate-ui/components/radix/sidebar.js";
5
5
  import { useMinimalWorkspaceLayout } from "./minimal-workspace-layout-context.js";
6
6
  import { useEffect } from "react";
7
7
  import { jsx } from "react/jsx-runtime";
8
- import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
8
+ import { Menu, PanelLeftClose, PanelLeftOpen } from "lucide-react";
9
9
  //#region src/layouts/minimal-workspace-layout/sidebar-trigger.tsx
10
10
  /**
11
11
  * A button that opens the sidebar inline and closes it again: the app's own
12
12
  * handle on a `hideWhenCollapsed` sidebar, usually placed in `topRightContent`
13
- * (it also expands and collapses the icon rail). Must render inside
14
- * `MinimalWorkspaceLayout`. Renders nothing when the sidebar is not
15
- * `expandable`, and on mobile, where the top bar has its own menu button.
13
+ * or the page's own toolbar (it also expands and collapses the icon rail).
14
+ * Must render inside `MinimalWorkspaceLayout`. On desktop it renders nothing
15
+ * when the sidebar is not `expandable`. On mobile it renders nothing while the
16
+ * layout's top bar carries the menu button; with `hideMobileTopBar` it is that
17
+ * menu button, opening the menu sheet.
16
18
  */
17
19
  function MinimalWorkspaceSidebarTrigger({ className, ...props }) {
18
20
  const { isMobile, setOpen } = useSidebar();
19
- const { sidebarId, pinned, expandable, showLabel, hideLabel, registerTrigger } = useMinimalWorkspaceLayout();
21
+ const { sidebarId, pinned, expandable, showLabel, hideLabel, mobileTopBar, menuLabel, registerTrigger } = useMinimalWorkspaceLayout();
20
22
  useEffect(() => registerTrigger(), [registerTrigger]);
21
- if (!expandable || isMobile) return null;
23
+ if (isMobile) {
24
+ if (mobileTopBar) return null;
25
+ return /* @__PURE__ */ jsx(MobileMenuButton, {
26
+ label: menuLabel,
27
+ "data-sidebar": "trigger",
28
+ className,
29
+ ...props
30
+ });
31
+ }
32
+ if (!expandable) return null;
22
33
  const label = pinned ? hideLabel : showLabel;
23
34
  return /* @__PURE__ */ jsx(Tooltip, {
24
35
  content: label,
@@ -38,5 +49,22 @@ function MinimalWorkspaceSidebarTrigger({ className, ...props }) {
38
49
  })
39
50
  });
40
51
  }
52
+ /**
53
+ * Opens the mobile menu sheet: the layout's own top bar draws it, and so does
54
+ * `MinimalWorkspaceSidebarTrigger` on mobile with `hideMobileTopBar`.
55
+ */
56
+ function MobileMenuButton({ label, className, ...props }) {
57
+ const { setOpenMobile } = useSidebar();
58
+ return /* @__PURE__ */ jsx(Button, {
59
+ variant: "ghost",
60
+ size: "icon",
61
+ hideRingOnHover: true,
62
+ "aria-label": label,
63
+ className: cn("size-9 shrink-0", className),
64
+ onClick: () => setOpenMobile(true),
65
+ ...props,
66
+ children: /* @__PURE__ */ jsx(Menu, { className: "size-5" })
67
+ });
68
+ }
41
69
  //#endregion
42
- export { MinimalWorkspaceSidebarTrigger };
70
+ export { MinimalWorkspaceSidebarTrigger, MobileMenuButton };
@@ -6,7 +6,7 @@ function Footer({ hidden = false }) {
6
6
  return /* @__PURE__ */ jsx("footer", {
7
7
  className: cn("bg-sidebar", hidden ? "h-[var(--espd-workspace-layout-hidden-footer-height,var(--espd-hidden-footer-height))]" : "h-[var(--espd-workspace-layout-footer-height,var(--espd-footer-height))]"),
8
8
  children: !hidden && /* @__PURE__ */ jsx("div", {
9
- className: "text-[10px] text-muted-foreground h-full flex items-center justify-center tracking-normal",
9
+ className: "type-caption text-muted-foreground h-full flex items-center justify-center tracking-normal",
10
10
  children: /* @__PURE__ */ jsx(FooterCard, {})
11
11
  })
12
12
  });
@@ -4,8 +4,8 @@ export { CodeEditor, CodeEditorProps } from '../components/code-editor/index.js'
4
4
  export { MonospaceContent, MonospaceContentProps } from '../components/monospace-content/index.js';
5
5
  import 'react';
6
6
  import '../style-axes-DSQ2DGc5.js';
7
- import '../alert.props-CcKo49Rb.js';
7
+ import '../alert.props-BuLuWmXA.js';
8
8
  import '../index-BQANnKs9.js';
9
- import '../variant-D81RhpbR.js';
10
- import '../icon-avatar.props-RYtw2eSW.js';
11
- import '../icon-text-action-card.props-B2ggncUK.js';
9
+ import '../variant-DjdaxfIA.js';
10
+ import '../icon-avatar.props-BJe0-vva.js';
11
+ import '../icon-text-action-card.props-BU7yFi2Q.js';
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { ReactNode, CSSProperties } from 'react';
3
3
  import { C as Color } from './index-BQANnKs9.js';
4
4
  import { k as StyleAxisProps } from './style-axes-DSQ2DGc5.js';
5
- import { f as Variant } from './variant-D81RhpbR.js';
5
+ import { f as Variant } from './variant-DjdaxfIA.js';
6
6
 
7
7
  type SectionCardSize = "sm" | "default" | "lg";
8
8
  /** `solid` / `soft` / `outline` / `gradient` — see `resolveVariantStyles` in `@/utils/variant`. */
@@ -1,8 +1,8 @@
1
1
  import { ButtonHTMLAttributes, ReactNode } from 'react';
2
2
  import { C as Color, S as Size } from './index-BQANnKs9.js';
3
- import { f as Variant } from './variant-D81RhpbR.js';
3
+ import { f as Variant } from './variant-DjdaxfIA.js';
4
4
  import { k as StyleAxisProps } from './style-axes-DSQ2DGc5.js';
5
- import { b as IconAvatarVariant } from './icon-avatar.props-RYtw2eSW.js';
5
+ import { b as IconAvatarVariant } from './icon-avatar.props-BJe0-vva.js';
6
6
 
7
7
  type SimpleClickableCardVariant = Variant;
8
8
  interface SimpleClickableCardProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "title">, Pick<StyleAxisProps, "radius"> {
@@ -1,7 +1,7 @@
1
1
  import { ReactElement, HTMLAttributes } from 'react';
2
2
  import { LucideIcon } from 'lucide-react';
3
3
  import { C as Color, S as Size } from './index-BQANnKs9.js';
4
- import { f as Variant } from './variant-D81RhpbR.js';
4
+ import { f as Variant } from './variant-DjdaxfIA.js';
5
5
  import { k as StyleAxisProps } from './style-axes-DSQ2DGc5.js';
6
6
 
7
7
  /**
@@ -0,0 +1,153 @@
1
+ //#region src/styles/type-scale.ts
2
+ /** Every text role, largest first. */
3
+ var TYPE_ROLES = [
4
+ "display",
5
+ "lead",
6
+ "title",
7
+ "headline",
8
+ "heading",
9
+ "subheading",
10
+ "prose",
11
+ "body",
12
+ "secondary",
13
+ "caption",
14
+ "label",
15
+ "input",
16
+ "code"
17
+ ];
18
+ /** The breakpoint where `md` values start: Tailwind's `md`, as `useIsMobile` and the inputs use. */
19
+ var TYPE_SCALE_MD = "48rem";
20
+ var TYPE_SCALE = {
21
+ display: {
22
+ use: "Marketing headline",
23
+ phone: {
24
+ size: "clamp(2.5rem, 7vw, 5.5rem)",
25
+ line: "1.04",
26
+ weight: "800"
27
+ },
28
+ token: {
29
+ size: "var(--text-display)",
30
+ line: "var(--text-display--line-height)",
31
+ weight: "var(--text-display--font-weight)"
32
+ }
33
+ },
34
+ lead: {
35
+ use: "The paragraph under a display headline",
36
+ phone: {
37
+ size: "clamp(1.0625rem, 1.5vw, 1.3125rem)",
38
+ line: "1.6",
39
+ weight: "400"
40
+ },
41
+ token: {
42
+ size: "var(--text-lead)",
43
+ line: "var(--text-lead--line-height)"
44
+ }
45
+ },
46
+ title: {
47
+ use: "A page's heading",
48
+ phone: {
49
+ size: "1.375rem",
50
+ line: "1.75rem",
51
+ weight: "700"
52
+ },
53
+ md: {
54
+ size: "1.625rem",
55
+ line: "2rem"
56
+ }
57
+ },
58
+ headline: {
59
+ use: "A section of a page (the step between a page and a card)",
60
+ phone: {
61
+ size: "1.125rem",
62
+ line: "1.5rem",
63
+ weight: "600"
64
+ },
65
+ md: {
66
+ size: "1.25rem",
67
+ line: "1.75rem"
68
+ }
69
+ },
70
+ heading: {
71
+ use: "A card, panel or dialog title",
72
+ phone: {
73
+ size: "1rem",
74
+ line: "1.375rem",
75
+ weight: "600"
76
+ }
77
+ },
78
+ subheading: {
79
+ use: "A smaller title (an alert's, a list group's)",
80
+ phone: {
81
+ size: "0.875rem",
82
+ line: "1.25rem",
83
+ weight: "600"
84
+ }
85
+ },
86
+ prose: {
87
+ use: "Long reading text (a description page, a document)",
88
+ phone: {
89
+ size: "1rem",
90
+ line: "1.5rem",
91
+ weight: "400"
92
+ },
93
+ md: { line: "1.625rem" }
94
+ },
95
+ body: {
96
+ use: "Running text in an interface: descriptions, alert bodies, messages",
97
+ phone: {
98
+ size: "0.875rem",
99
+ line: "1.3125rem",
100
+ weight: "400"
101
+ }
102
+ },
103
+ secondary: {
104
+ use: "A supporting line under a title, card meta",
105
+ phone: {
106
+ size: "0.8125rem",
107
+ line: "1.125rem",
108
+ weight: "400"
109
+ }
110
+ },
111
+ caption: {
112
+ use: "Timestamps, counts, hints, badges, footnotes",
113
+ phone: {
114
+ size: "0.75rem",
115
+ line: "1rem",
116
+ weight: "400"
117
+ }
118
+ },
119
+ label: {
120
+ use: "Form labels, tab, menu and button text",
121
+ phone: {
122
+ size: "0.875rem",
123
+ line: "1.25rem",
124
+ weight: "500"
125
+ }
126
+ },
127
+ input: {
128
+ use: "What a person types, and its placeholder",
129
+ phone: {
130
+ size: "1rem",
131
+ line: "1.5rem",
132
+ weight: "400"
133
+ },
134
+ md: {
135
+ size: "0.875rem",
136
+ line: "1.25rem"
137
+ }
138
+ },
139
+ code: {
140
+ use: "Code, logs, file paths (with font-mono)",
141
+ phone: {
142
+ size: "0.75rem",
143
+ line: "1.125rem",
144
+ weight: "400"
145
+ },
146
+ md: {
147
+ size: "0.8125rem",
148
+ line: "1.25rem"
149
+ }
150
+ }
151
+ };
152
+ //#endregion
153
+ export { TYPE_ROLES, TYPE_SCALE, TYPE_SCALE_MD };
@@ -1,4 +1,122 @@
1
1
  // tailwind.preset.ts
2
+ import plugin from "tailwindcss/plugin";
3
+
4
+ // src/styles/type-scale.ts
5
+ var TYPE_ROLES = [
6
+ "display",
7
+ "lead",
8
+ "title",
9
+ "headline",
10
+ "heading",
11
+ "subheading",
12
+ "prose",
13
+ "body",
14
+ "secondary",
15
+ "caption",
16
+ "label",
17
+ "input",
18
+ "code"
19
+ ];
20
+ var TYPE_SCALE_MD = "48rem";
21
+ var TYPE_SCALE = {
22
+ display: {
23
+ use: "Marketing headline",
24
+ phone: { size: "clamp(2.5rem, 7vw, 5.5rem)", line: "1.04", weight: "800" },
25
+ token: { size: "var(--text-display)", line: "var(--text-display--line-height)", weight: "var(--text-display--font-weight)" }
26
+ },
27
+ lead: {
28
+ use: "The paragraph under a display headline",
29
+ phone: { size: "clamp(1.0625rem, 1.5vw, 1.3125rem)", line: "1.6", weight: "400" },
30
+ token: { size: "var(--text-lead)", line: "var(--text-lead--line-height)" }
31
+ },
32
+ title: {
33
+ use: "A page's heading",
34
+ phone: { size: "1.375rem", line: "1.75rem", weight: "700" },
35
+ md: { size: "1.625rem", line: "2rem" }
36
+ },
37
+ headline: {
38
+ use: "A section of a page (the step between a page and a card)",
39
+ phone: { size: "1.125rem", line: "1.5rem", weight: "600" },
40
+ md: { size: "1.25rem", line: "1.75rem" }
41
+ },
42
+ heading: {
43
+ use: "A card, panel or dialog title",
44
+ phone: { size: "1rem", line: "1.375rem", weight: "600" }
45
+ },
46
+ subheading: {
47
+ use: "A smaller title (an alert's, a list group's)",
48
+ phone: { size: "0.875rem", line: "1.25rem", weight: "600" }
49
+ },
50
+ prose: {
51
+ use: "Long reading text (a description page, a document)",
52
+ phone: { size: "1rem", line: "1.5rem", weight: "400" },
53
+ md: { line: "1.625rem" }
54
+ },
55
+ body: {
56
+ use: "Running text in an interface: descriptions, alert bodies, messages",
57
+ phone: { size: "0.875rem", line: "1.3125rem", weight: "400" }
58
+ },
59
+ secondary: {
60
+ use: "A supporting line under a title, card meta",
61
+ phone: { size: "0.8125rem", line: "1.125rem", weight: "400" }
62
+ },
63
+ caption: {
64
+ use: "Timestamps, counts, hints, badges, footnotes",
65
+ phone: { size: "0.75rem", line: "1rem", weight: "400" }
66
+ },
67
+ label: {
68
+ use: "Form labels, tab, menu and button text",
69
+ phone: { size: "0.875rem", line: "1.25rem", weight: "500" }
70
+ },
71
+ input: {
72
+ use: "What a person types, and its placeholder",
73
+ phone: { size: "1rem", line: "1.5rem", weight: "400" },
74
+ md: { size: "0.875rem", line: "1.25rem" }
75
+ },
76
+ code: {
77
+ use: "Code, logs, file paths (with font-mono)",
78
+ phone: { size: "0.75rem", line: "1.125rem", weight: "400" },
79
+ md: { size: "0.8125rem", line: "1.25rem" }
80
+ }
81
+ };
82
+ var PROPS = ["size", "line", "weight"];
83
+ function typeToken(role, prop) {
84
+ return `--espd-type-${role}-${prop}`;
85
+ }
86
+ function typeScaleRootTokens() {
87
+ const out = {};
88
+ for (const role of TYPE_ROLES) {
89
+ const spec = TYPE_SCALE[role];
90
+ for (const prop of PROPS) out[typeToken(role, prop)] = spec.token?.[prop] ?? spec.phone[prop];
91
+ }
92
+ return out;
93
+ }
94
+ function typeScaleMdTokens() {
95
+ const out = {};
96
+ for (const role of TYPE_ROLES) {
97
+ const md = TYPE_SCALE[role].md;
98
+ if (!md) continue;
99
+ for (const prop of PROPS) if (md[prop] !== void 0) out[typeToken(role, prop)] = md[prop];
100
+ }
101
+ return out;
102
+ }
103
+ function typeUtilityDeclarations(role) {
104
+ const { phone } = TYPE_SCALE[role];
105
+ return {
106
+ "font-size": `var(${typeToken(role, "size")}, ${phone.size})`,
107
+ "line-height": `var(--tw-leading, var(${typeToken(role, "line")}, ${phone.line}))`,
108
+ "font-weight": `var(--tw-font-weight, var(${typeToken(role, "weight")}, ${phone.weight}))`
109
+ };
110
+ }
111
+
112
+ // tailwind.preset.ts
113
+ var typeScale = plugin(({ addBase, addUtilities }) => {
114
+ addBase({
115
+ ":root": typeScaleRootTokens(),
116
+ [`@media (width >= ${TYPE_SCALE_MD})`]: { ":root": typeScaleMdTokens() }
117
+ });
118
+ addUtilities(Object.fromEntries(TYPE_ROLES.map((role) => [`.type-${role}`, typeUtilityDeclarations(role)])));
119
+ });
2
120
  var espPreset = {
3
121
  darkMode: "class",
4
122
  theme: {
@@ -108,7 +226,8 @@ var espPreset = {
108
226
  sm: "var(--radius-sm)"
109
227
  }
110
228
  }
111
- }
229
+ },
230
+ plugins: [typeScale]
112
231
  };
113
232
  var tailwind_preset_default = espPreset;
114
233
  export {
@@ -3,4 +3,4 @@ import 'sonner';
3
3
  import 'react';
4
4
  import '../index-BQANnKs9.js';
5
5
  import '../style-axes-DSQ2DGc5.js';
6
- import '../variant-D81RhpbR.js';
6
+ import '../variant-DjdaxfIA.js';
package/dist/utils/cn.js CHANGED
@@ -1,11 +1,22 @@
1
+ import { TYPE_ROLES } from "../styles/type-scale.js";
1
2
  import { clsx } from "clsx";
2
3
  import { extendTailwindMerge } from "tailwind-merge";
3
4
  //#region src/utils/cn.ts
4
- var twMerge = extendTailwindMerge({ extend: { classGroups: { shadow: [{ shadow: [
5
- (value) => /^\[shadow:.+\]$/.test(value),
6
- "glow",
7
- "float"
8
- ] }] } } });
5
+ var twMerge = extendTailwindMerge({ extend: {
6
+ classGroups: {
7
+ shadow: [{ shadow: [
8
+ (value) => /^\[shadow:.+\]$/.test(value),
9
+ "glow",
10
+ "float"
11
+ ] }],
12
+ "type-role": [{ type: [...TYPE_ROLES] }],
13
+ "font-weight": [{ font: [(value) => /^\[weight:.+\]$/.test(value)] }]
14
+ },
15
+ conflictingClassGroups: {
16
+ "type-role": ["font-size"],
17
+ "font-size": ["type-role"]
18
+ }
19
+ } });
9
20
  function cn(...inputs) {
10
21
  return twMerge(clsx(inputs));
11
22
  }
@@ -16,54 +16,63 @@ function isPresetColor(color) {
16
16
  var presetClassMap = {
17
17
  primary: {
18
18
  bg: "bg-primary",
19
+ solid: "bg-primary",
19
20
  text: "text-primary",
20
21
  border: "border-primary",
21
22
  fg: "text-primary-foreground"
22
23
  },
23
24
  secondary: {
24
25
  bg: "bg-secondary",
26
+ solid: "bg-secondary",
25
27
  text: "text-secondary",
26
28
  border: "border-secondary",
27
29
  fg: "text-secondary-foreground"
28
30
  },
29
31
  error: {
30
32
  bg: "bg-error",
33
+ solid: "bg-error",
31
34
  text: "text-error",
32
35
  border: "border-error",
33
36
  fg: "text-error-foreground"
34
37
  },
35
38
  info: {
36
39
  bg: "bg-info",
40
+ solid: "bg-info",
37
41
  text: "text-info",
38
42
  border: "border-info",
39
43
  fg: "text-info-foreground"
40
44
  },
41
45
  success: {
42
46
  bg: "bg-success",
47
+ solid: "bg-success",
43
48
  text: "text-success",
44
49
  border: "border-success",
45
50
  fg: "text-success-foreground"
46
51
  },
47
52
  warning: {
48
53
  bg: "bg-warning",
54
+ solid: "bg-warning-solid",
49
55
  text: "text-warning",
50
56
  border: "border-warning",
51
57
  fg: "text-warning-foreground"
52
58
  },
53
59
  disabled: {
54
60
  bg: "bg-disabled",
61
+ solid: "bg-disabled-solid",
55
62
  text: "text-disabled",
56
63
  border: "border-disabled",
57
64
  fg: "text-disabled-foreground"
58
65
  },
59
66
  gray: {
60
67
  bg: "bg-gray",
68
+ solid: "bg-gray",
61
69
  text: "text-gray",
62
70
  border: "border-input",
63
71
  fg: "text-gray-foreground"
64
72
  },
65
73
  mist: {
66
74
  bg: "bg-mist",
75
+ solid: "bg-mist",
67
76
  text: "text-mist",
68
77
  border: "border-mist-border",
69
78
  fg: "text-mist-foreground"
@@ -81,7 +90,7 @@ var ON_ARBITRARY_FILL = "var(--espd-on-solid-foreground, #fff)";
81
90
  function resolveColor(color, target) {
82
91
  if (isPresetColor(color)) return { className: presetClassMap[color][target] };
83
92
  if (target === "fg") return { style: { color: ON_ARBITRARY_FILL } };
84
- return { style: { [target === "bg" ? "backgroundColor" : target === "text" ? "color" : "borderColor"]: color } };
93
+ return { style: { [target === "bg" || target === "solid" ? "backgroundColor" : target === "text" ? "color" : "borderColor"]: color } };
85
94
  }
86
95
  var SUPPORTS_RELATIVE_COLOR = typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("color", "lch(from red l c h)");
87
96
  /**
@@ -1,17 +1,51 @@
1
1
  export { c as cn } from '../cn-Cbsgs0XP.js';
2
2
  import { C as Color } from '../index-BQANnKs9.js';
3
- export { V as VARIANTS, f as Variant, g as VariantRecipe, h as VariantRegistry, i as VariantStyles, l as listVariants, r as registerVariant, k as resolveVariantStyles } from '../variant-D81RhpbR.js';
3
+ export { V as VARIANTS, f as Variant, g as VariantRecipe, h as VariantRegistry, i as VariantStyles, l as listVariants, r as registerVariant, k as resolveVariantStyles } from '../variant-DjdaxfIA.js';
4
4
  export { B as BORDERS, a as Border, b as BorderRegistry, D as DENSITIES, c as Density, d as DensityProps, e as DensityRegistry, f as DensityTokens, E as ELEVATIONS, g as Elevation, h as ElevationRegistry, R as RADII, i as Radius, j as RadiusRegistry, S as StyleAxis, k as StyleAxisProps, l as StyleValueAxis, m as densityStyle, n as listStyleValues, r as registerDensity, o as registerStyleValue, p as resolveDensity, q as resolveStyleValue, u as useStyleAxes } from '../style-axes-DSQ2DGc5.js';
5
5
  import 'clsx';
6
6
  import 'react';
7
7
 
8
+ /** Every text role, largest first. */
9
+ declare const TYPE_ROLES: readonly ["display", "lead", "title", "headline", "heading", "subheading", "prose", "body", "secondary", "caption", "label", "input", "code"];
10
+ type TypeRole = (typeof TYPE_ROLES)[number];
11
+ interface TypeRoleValue {
12
+ /** `font-size`. */
13
+ size: string;
14
+ /** `line-height`. */
15
+ line: string;
16
+ /** `font-weight`. */
17
+ weight: string;
18
+ }
19
+ interface TypeRoleSpec {
20
+ /** What the role is for, in a few words (docs and the demo). */
21
+ use: string;
22
+ /** The phone value, and the fallback inside every `var()` that reads it. */
23
+ phone: TypeRoleValue;
24
+ /** What changes from 768px (`md`) up. Omitted: the phone value holds. */
25
+ md?: Partial<TypeRoleValue>;
26
+ /**
27
+ * The value the token is declared with, when it points at another token
28
+ * (`display` and `lead` take the marketing sizes the theme already ships).
29
+ * Omitted: the token is declared with the phone value.
30
+ */
31
+ token?: Partial<TypeRoleValue>;
32
+ }
33
+ /** The breakpoint where `md` values start: Tailwind's `md`, as `useIsMobile` and the inputs use. */
34
+ declare const TYPE_SCALE_MD = "48rem";
35
+ declare const TYPE_SCALE: Record<TypeRole, TypeRoleSpec>;
36
+
8
37
  declare function isPresetColor(color: Color): color is Exclude<Color, string & {}>;
9
38
  /**
10
39
  * What the colour paints: a fill (`bg`), text or icons in that colour
11
40
  * (`text`), a border (`border`), or the text that reads ON a fill of that
12
41
  * colour (`fg` — the preset's `-foreground` token).
13
42
  */
14
- type ColorTarget = "bg" | "text" | "border" | "fg";
43
+ /**
44
+ * `bg` is the colour itself (tints, bars, dots); `solid` is the fill that
45
+ * carries text or an icon in `fg` (deeper for `warning` and `disabled`, so
46
+ * white reads on it).
47
+ */
48
+ type ColorTarget = "bg" | "solid" | "text" | "border" | "fg";
15
49
  type ColorResult = {
16
50
  className: string;
17
51
  style?: undefined;
@@ -33,4 +67,4 @@ declare function resolveColor(color: Color, target: ColorTarget): ColorResult;
33
67
  */
34
68
  declare function startViewTransition(update: () => void): void;
35
69
 
36
- export { isPresetColor, resolveColor, startViewTransition };
70
+ export { TYPE_ROLES, TYPE_SCALE, TYPE_SCALE_MD, type TypeRole, type TypeRoleSpec, type TypeRoleValue, isPresetColor, resolveColor, startViewTransition };
@@ -1,6 +1,7 @@
1
+ import { TYPE_ROLES, TYPE_SCALE, TYPE_SCALE_MD } from "../styles/type-scale.js";
1
2
  import { cn } from "./cn.js";
2
3
  import { isPresetColor, resolveColor } from "./color.js";
3
4
  import { VARIANTS, listVariants, registerVariant, resolveVariantStyles } from "./variant.js";
4
5
  import { BORDERS, DENSITIES, ELEVATIONS, RADII, densityStyle, listStyleValues, registerDensity, registerStyleValue, resolveDensity, resolveStyleValue, useStyleAxes } from "./style-axes.js";
5
6
  import { startViewTransition } from "./view-transition.js";
6
- export { BORDERS, DENSITIES, ELEVATIONS, RADII, VARIANTS, cn, densityStyle, isPresetColor, listStyleValues, listVariants, registerDensity, registerStyleValue, registerVariant, resolveColor, resolveDensity, resolveStyleValue, resolveVariantStyles, startViewTransition, useStyleAxes };
7
+ export { BORDERS, DENSITIES, ELEVATIONS, RADII, TYPE_ROLES, TYPE_SCALE, TYPE_SCALE_MD, VARIANTS, cn, densityStyle, isPresetColor, listStyleValues, listVariants, registerDensity, registerStyleValue, registerVariant, resolveColor, resolveDensity, resolveStyleValue, resolveVariantStyles, startViewTransition, useStyleAxes };