@espressif/dashboard-ui-components 1.12.0 → 1.14.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.
Files changed (192) hide show
  1. package/.claude/rules/dashboard-ui-consumption.md +63 -2
  2. package/.cursor/rules/dashboard-ui-consumption.mdc +61 -3
  3. package/CHANGELOG.md +265 -0
  4. package/README.md +59 -8
  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/badge/index.d.ts +1 -1
  17. package/dist/components/bottom-sheet/_hooks/use-sheet-drag.js +112 -0
  18. package/dist/components/bottom-sheet/bottom-sheet.js +84 -0
  19. package/dist/components/bottom-sheet/index.d.ts +50 -0
  20. package/dist/components/bottom-sheet/index.js +3 -0
  21. package/dist/components/bubble/bubble.js +1 -1
  22. package/dist/components/calendar/calendar.js +5 -5
  23. package/dist/components/cards/animated-card/animated-card.js +1 -1
  24. package/dist/components/cards/basic-details-card.js +2 -2
  25. package/dist/components/cards/collapsible-card.js +1 -1
  26. package/dist/components/cards/index.d.ts +2 -2
  27. package/dist/components/cards/no-data-card/no-data-card.js +2 -2
  28. package/dist/components/cards/section-card.js +49 -41
  29. package/dist/components/cards/simple-card.js +2 -5
  30. package/dist/components/category-card/category-card.js +2 -2
  31. package/dist/components/chart/chart.js +4 -4
  32. package/dist/components/chart/donut-chart.js +1 -1
  33. package/dist/components/chart/treemap-chart.js +1 -1
  34. package/dist/components/choice-card/choice-card.js +3 -3
  35. package/dist/components/code-editor/code-editor.js +4 -3
  36. package/dist/components/data-table/table-header.js +1 -1
  37. package/dist/components/date-range-picker/date-range-picker.js +3 -3
  38. package/dist/components/dynamic-list/dynamic-list.js +14 -13
  39. package/dist/components/dynamic-list/index.d.ts +1 -1
  40. package/dist/components/error-display/full-size-error/full-size-error.js +2 -2
  41. package/dist/components/expandable-text/expandable-text-overlay.js +1 -1
  42. package/dist/components/facet-filters/filter-group.js +2 -2
  43. package/dist/components/feature-grid/feature-grid.js +3 -3
  44. package/dist/components/file-input/file-input.js +8 -8
  45. package/dist/components/file-upload/file-upload.js +4 -4
  46. package/dist/components/floating-window/_hooks/use-drag-move.js +1 -0
  47. package/dist/components/floating-window/_hooks/use-resize.js +133 -0
  48. package/dist/components/floating-window/floating-window.js +67 -40
  49. package/dist/components/floating-window/index.d.ts +21 -2
  50. package/dist/components/fullscreen-dialog/fullscreen-dialog.js +1 -1
  51. package/dist/components/gradient-ring-button/_hooks/use-ring-geometry.js +116 -0
  52. package/dist/components/gradient-ring-button/gradient-ring-button.js +44 -0
  53. package/dist/components/gradient-ring-button/gradient-ring.js +77 -0
  54. package/dist/components/gradient-ring-button/index.d.ts +66 -0
  55. package/dist/components/gradient-ring-button/index.js +3 -0
  56. package/dist/components/horizontal-stepper/horizontal-stepper.js +2 -6
  57. package/dist/components/horizontal-stepper/index.d.ts +2 -2
  58. package/dist/components/icon-avatar/index.d.ts +3 -3
  59. package/dist/components/icon-text-action-card/index.d.ts +4 -4
  60. package/dist/components/index.d.ts +14 -8
  61. package/dist/components/index.js +15 -6
  62. package/dist/components/key-value-manager/key-value-manager-add-popover.js +1 -1
  63. package/dist/components/key-value-manager/key-value-manager-table.js +1 -1
  64. package/dist/components/keyframes/index.d.ts +53 -0
  65. package/dist/components/keyframes/index.js +3 -0
  66. package/dist/components/keyframes/keyframes-motion.js +23 -0
  67. package/dist/components/keyframes/keyframes.js +37 -0
  68. package/dist/components/link/link.js +7 -7
  69. package/dist/components/list/list-item.utils.js +5 -4
  70. package/dist/components/list/list.js +1 -1
  71. package/dist/components/list-details/index.d.ts +2 -2
  72. package/dist/components/markdown-content/markdown-content.components.js +2 -2
  73. package/dist/components/media-card/media-card-reveal.js +2 -2
  74. package/dist/components/media-card/media-card.js +2 -2
  75. package/dist/components/monospace-content/index.d.ts +4 -4
  76. package/dist/components/monospace-content/monospace-content.js +9 -11
  77. package/dist/components/nav-bar/nav-bar-mobile-menu.js +3 -3
  78. package/dist/components/nav-bar/nav-bar.js +4 -4
  79. package/dist/components/notice-strip/notice-strip.js +1 -1
  80. package/dist/components/option-card-group/option-card-group.js +2 -2
  81. package/dist/components/overflow-badge-list/index.d.ts +2 -2
  82. package/dist/components/overflow-badge-list/overflow-badge-list.js +3 -3
  83. package/dist/components/page-banner/page-banner.js +1 -1
  84. package/dist/components/page-container/page-container.js +1 -1
  85. package/dist/components/pagination/pagination.js +1 -1
  86. package/dist/components/progress-bar/progress-bar.js +2 -2
  87. package/dist/components/qr-code/index.d.ts +26 -0
  88. package/dist/components/qr-code/index.js +2 -0
  89. package/dist/components/qr-code/qr-code.js +69 -0
  90. package/dist/components/radio-group/radio-group.js +3 -3
  91. package/dist/components/range-field/index.d.ts +45 -0
  92. package/dist/components/range-field/index.js +2 -0
  93. package/dist/components/range-field/range-field.js +161 -0
  94. package/dist/components/readout/readout.js +1 -1
  95. package/dist/components/requirement-list/requirement-list.js +5 -10
  96. package/dist/components/reveal/index.d.ts +6 -3
  97. package/dist/components/reveal/reveal.js +7 -4
  98. package/dist/components/scrollable-sections/scrollable-sections.js +1 -1
  99. package/dist/components/search-box/index.d.ts +3 -1
  100. package/dist/components/search-box/search-box.js +7 -12
  101. package/dist/components/search-field-shell.js +8 -8
  102. package/dist/components/selectable-card-list/selectable-card-list-shared.js +6 -6
  103. package/dist/components/showcase-card/index.d.ts +14 -3
  104. package/dist/components/showcase-card/showcase-card.js +43 -2
  105. package/dist/components/sidebar/sidebar.js +13 -15
  106. package/dist/components/simple-clickable-card/index.d.ts +4 -4
  107. package/dist/components/simple-clickable-card/simple-clickable-card-shared.js +19 -23
  108. package/dist/components/simple-info-card/index.d.ts +3 -3
  109. package/dist/components/simple-list/index.d.ts +1 -1
  110. package/dist/components/simple-list/simple-list.js +8 -8
  111. package/dist/components/simple-paginated-list/simple-paginated-list.js +1 -4
  112. package/dist/components/stat-card/stat-card.js +7 -13
  113. package/dist/components/status-badge/index.d.ts +3 -3
  114. package/dist/components/status-badge/status-badge.js +4 -4
  115. package/dist/components/status-card-list/status-card-list.js +6 -6
  116. package/dist/components/step-tabs/index.d.ts +1 -1
  117. package/dist/components/tag/index.d.ts +1 -1
  118. package/dist/components/tag/tag.js +4 -4
  119. package/dist/components/tag-input/tag-input.js +12 -12
  120. package/dist/components/timeline/timeline.js +2 -2
  121. package/dist/components/toast/index.d.ts +1 -1
  122. package/dist/components/toast/toast.js +2 -2
  123. package/dist/components/toolbar/index.d.ts +5 -2
  124. package/dist/components/toolbar/toolbar-button.js +1 -1
  125. package/dist/components/toolbar/toolbar.js +9 -3
  126. package/dist/components/trace/index.d.ts +49 -0
  127. package/dist/components/trace/index.js +2 -0
  128. package/dist/components/trace/trace.js +109 -0
  129. package/dist/components/transfer-list/transfer-list.js +2 -2
  130. package/dist/components/typography/index.d.ts +12 -3
  131. package/dist/components/typography/typography-variants.js +98 -13
  132. package/dist/components/typography/typography.js +4 -2
  133. package/dist/components/user-type-badge/user-type-badge.js +4 -4
  134. package/dist/components/vertical-stepper/index.d.ts +2 -2
  135. package/dist/components/vertical-stepper/vertical-stepper.js +18 -11
  136. package/dist/core/alert.js +3 -3
  137. package/dist/core/animate-ui/components/animate/code-header.js +1 -1
  138. package/dist/core/animate-ui/components/animate/code.js +1 -1
  139. package/dist/core/animate-ui/components/animate/tabs.js +6 -6
  140. package/dist/core/animate-ui/components/animate/tooltip.js +1 -1
  141. package/dist/core/animate-ui/components/base/progress.js +2 -2
  142. package/dist/core/animate-ui/components/radix/accordion.js +2 -2
  143. package/dist/core/animate-ui/components/radix/dialog.js +2 -2
  144. package/dist/core/animate-ui/components/radix/dropdown-menu.js +6 -6
  145. package/dist/core/animate-ui/components/radix/sheet.js +2 -2
  146. package/dist/core/animate-ui/components/radix/sidebar.js +8 -8
  147. package/dist/core/animate-ui/components/radix/toggle.js +1 -1
  148. package/dist/core/badge.js +1 -1
  149. package/dist/core/breadcrumb.js +1 -1
  150. package/dist/core/button/button.js +2 -2
  151. package/dist/core/button-group.js +1 -1
  152. package/dist/core/button.js +2 -2
  153. package/dist/core/card.js +2 -2
  154. package/dist/core/combobox/combobox.js +3 -3
  155. package/dist/core/command.js +5 -5
  156. package/dist/core/field-label-row.js +4 -4
  157. package/dist/core/form.js +2 -2
  158. package/dist/core/index.d.ts +1 -1
  159. package/dist/core/input/input.js +11 -11
  160. package/dist/core/input-otp/input-otp.js +12 -12
  161. package/dist/core/label.js +1 -1
  162. package/dist/core/select.js +6 -6
  163. package/dist/core/separator.js +1 -1
  164. package/dist/core/table.js +2 -2
  165. package/dist/core/textarea/textarea.js +9 -9
  166. package/dist/{icon-avatar.props-RYtw2eSW.d.ts → icon-avatar.props-BJe0-vva.d.ts} +1 -1
  167. package/dist/{icon-text-action-card.props-B2ggncUK.d.ts → icon-text-action-card.props-BU7yFi2Q.d.ts} +2 -2
  168. package/dist/index.d.ts +14 -8
  169. package/dist/index.js +16 -7
  170. package/dist/layouts/entry-layout/entry-layout.js +1 -1
  171. package/dist/layouts/index.d.ts +21 -6
  172. package/dist/layouts/index.js +1 -1
  173. package/dist/layouts/minimal-workspace-layout/minimal-workspace-layout.js +10 -18
  174. package/dist/layouts/minimal-workspace-layout/sidebar-trigger.js +35 -7
  175. package/dist/layouts/workspace-layout/footer/footer.js +1 -1
  176. package/dist/markdown/index.d.ts +4 -4
  177. package/dist/{section-card-B7c5uc08.d.ts → section-card-DqQeQkzU.d.ts} +1 -1
  178. package/dist/{simple-clickable-card.props-BrPCw7CR.d.ts → simple-clickable-card.props-BhhotZMp.d.ts} +2 -2
  179. package/dist/{status-badge.props-lKlEOfRt.d.ts → status-badge.props-BVe8CmQZ.d.ts} +1 -1
  180. package/dist/styles/type-scale.js +153 -0
  181. package/dist/tailwind-preset.js +120 -1
  182. package/dist/toast/index.d.ts +1 -1
  183. package/dist/utils/cn.js +16 -5
  184. package/dist/utils/index.d.ts +31 -2
  185. package/dist/utils/index.js +2 -1
  186. package/dist/utils/variant.js +47 -47
  187. package/dist/{variant-D81RhpbR.d.ts → variant-DjdaxfIA.d.ts} +6 -1
  188. package/dist/{vertical-stepper.props-BXYcbW70.d.ts → vertical-stepper.props-DONJJXIy.d.ts} +1 -0
  189. package/package.json +9 -1
  190. package/src/styles/theme.css +23 -3
  191. package/src/styles/type-scale.css +152 -0
  192. package/tailwind.preset.ts +23 -0
@@ -1,5 +1,4 @@
1
1
  import { cn } from "../../utils/cn.js";
2
- import { Button } from "../../components/button/button.js";
3
2
  import { SidebarInset, SidebarProvider, useSidebar } from "../../core/animate-ui/components/radix/sidebar.js";
4
3
  import Sidebar from "../../components/sidebar/sidebar.js";
5
4
  import AccountMenu from "../workspace-layout/account-menu/account-menu.js";
@@ -8,9 +7,9 @@ import { resolveFooterBranding } from "../shared/footer-branding.js";
8
7
  import { accountMenuProps } from "../shared/account-menu-props.js";
9
8
  import { RailLogo } from "./rail-logo.js";
10
9
  import { MinimalWorkspaceLayoutContextProvider } from "./minimal-workspace-layout-context.js";
10
+ import { MobileMenuButton } from "./sidebar-trigger.js";
11
11
  import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
- import { Menu } from "lucide-react";
14
13
  //#region src/layouts/minimal-workspace-layout/minimal-workspace-layout.tsx
15
14
  var LOGO_HEIGHT = "var(--espd-minimal-workspace-layout-logo-height,3.5rem)";
16
15
  /**
@@ -91,7 +90,7 @@ var hiddenGapClass = "data-[sidebar-mode=peek]:[&_[data-slot=sidebar-gap]]:w-0 d
91
90
  * Mouse-only by design (the trigger and ⌘/Ctrl+B serve the keyboard).
92
91
  */
93
92
  var edgeClass = cn("absolute inset-y-0 left-0 z-10 w-[var(--espd-minimal-workspace-layout-edge-hit-width,12px)] cursor-e-resize select-none", "before:absolute before:inset-y-0 before:left-0 before:w-[var(--espd-minimal-workspace-layout-edge-width,3px)] before:bg-[var(--espd-minimal-workspace-layout-edge-color,var(--color-primary))]", "before:opacity-0 before:transition-opacity before:duration-[var(--espd-duration-fast,150ms)] motion-reduce:before:transition-none hover:before:opacity-100");
94
- function MinimalWorkspaceShell({ appName, logo, logoCollapsed, logoMobile, logoAssets, footerBranding, children, sidebarConfig, headerConfig, topRightContent, labels, onLogoutClick, onProfileCardClick, onColorThemeChange, colorTheme, onLanguageChange, languages, currentLanguage, accountMenuItems, hiddenSidebar }) {
93
+ function MinimalWorkspaceShell({ appName, logo, logoCollapsed, logoMobile, logoAssets, footerBranding, children, sidebarConfig, headerConfig, topRightContent, hideMobileTopBar = false, labels, onLogoutClick, onProfileCardClick, onColorThemeChange, colorTheme, onLanguageChange, languages, currentLanguage, accountMenuItems, hiddenSidebar }) {
95
94
  const { state, isMobile, setOpen } = useSidebar();
96
95
  const sidebarId = useId();
97
96
  const expandable = sidebarConfig.expandable ?? true;
@@ -100,6 +99,8 @@ function MinimalWorkspaceShell({ appName, logo, logoCollapsed, logoMobile, logoA
100
99
  const darkMode = colorTheme === "dark";
101
100
  const LinkComponent = sidebarConfig.linkComponent;
102
101
  const topRight = topRightContent ?? headerConfig?.rightContent;
102
+ const mobileTopBar = isMobile && !hideMobileTopBar;
103
+ const menuLabel = labels?.openMenu ?? "Open menu";
103
104
  const showLabel = hide ? labels?.showSidebar ?? "Show sidebar" : labels?.expandSidebar ?? "Expand sidebar";
104
105
  const hideLabel = hide ? labels?.hideSidebar ?? "Hide sidebar" : labels?.collapseSidebar ?? "Collapse sidebar";
105
106
  const [triggers, setTriggers] = useState(0);
@@ -239,6 +240,8 @@ function MinimalWorkspaceShell({ appName, logo, logoCollapsed, logoMobile, logoA
239
240
  hidden: hide,
240
241
  showLabel,
241
242
  hideLabel,
243
+ mobileTopBar: !hideMobileTopBar,
244
+ menuLabel,
242
245
  registerTrigger
243
246
  },
244
247
  children: [/* @__PURE__ */ jsx(Sidebar, {
@@ -276,10 +279,11 @@ function MinimalWorkspaceShell({ appName, logo, logoCollapsed, logoMobile, logoA
276
279
  }), /* @__PURE__ */ jsxs(SidebarInset, {
277
280
  "data-slot": "minimal-workspace-layout-main",
278
281
  className: "h-[var(--espd-minimal-workspace-layout-height,100dvh)] max-h-[var(--espd-minimal-workspace-layout-height,100dvh)] overflow-hidden bg-[var(--espd-minimal-workspace-layout-content-background,var(--color-background))]",
279
- children: [isMobile && /* @__PURE__ */ jsxs("div", {
282
+ children: [mobileTopBar && /* @__PURE__ */ jsxs("div", {
283
+ "data-slot": "minimal-workspace-layout-mobile-bar",
280
284
  className: "flex h-12 shrink-0 items-center gap-2 border-b border-[color:color-mix(in_oklab,var(--espd-minimal-workspace-layout-content-background,var(--color-background))_90%,var(--color-foreground))] px-2",
281
285
  children: [
282
- /* @__PURE__ */ jsx(MobileMenuButton, { label: labels?.openMenu ?? "Open menu" }),
286
+ /* @__PURE__ */ jsx(MobileMenuButton, { label: menuLabel }),
283
287
  mobileLogo({
284
288
  logoMobile,
285
289
  logoAssets,
@@ -309,7 +313,7 @@ function MinimalWorkspaceShell({ appName, logo, logoCollapsed, logoMobile, logoA
309
313
  onPointerEnter: onEdgePointerEnter,
310
314
  onPointerLeave: cancelHoverPeek
311
315
  }),
312
- !isMobile && topRight != null && /* @__PURE__ */ jsx("div", {
316
+ !mobileTopBar && topRight != null && /* @__PURE__ */ jsx("div", {
313
317
  "data-slot": "minimal-workspace-layout-top-right",
314
318
  className: "pointer-events-none absolute top-[var(--espd-minimal-workspace-layout-top-right-offset-y,0.75rem)] right-[var(--espd-minimal-workspace-layout-top-right-offset-x,1rem)] z-20 flex",
315
319
  children: /* @__PURE__ */ jsx("div", {
@@ -322,18 +326,6 @@ function MinimalWorkspaceShell({ appName, logo, logoCollapsed, logoMobile, logoA
322
326
  })]
323
327
  });
324
328
  }
325
- function MobileMenuButton({ label }) {
326
- const { setOpenMobile } = useSidebar();
327
- return /* @__PURE__ */ jsx(Button, {
328
- variant: "ghost",
329
- size: "icon",
330
- hideRingOnHover: true,
331
- "aria-label": label,
332
- className: "size-9 shrink-0",
333
- onClick: () => setOpenMobile(true),
334
- children: /* @__PURE__ */ jsx(Menu, { className: "size-5" })
335
- });
336
- }
337
329
  /**
338
330
  * Header-less app shell: an icon rail that expands into a labelled sidebar
339
331
  * (or, with `sidebarConfig.hideWhenCollapsed`, a hidden sidebar that peeks
@@ -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
  }
@@ -1,10 +1,39 @@
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
@@ -33,4 +62,4 @@ declare function resolveColor(color: Color, target: ColorTarget): ColorResult;
33
62
  */
34
63
  declare function startViewTransition(update: () => void): void;
35
64
 
36
- export { isPresetColor, resolveColor, startViewTransition };
65
+ 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 };