@ngrok/mantle 0.90.4 → 0.91.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 (183) hide show
  1. package/dist/accordion.d.ts +3 -5
  2. package/dist/agent.json +7 -7
  3. package/dist/{alert-CTAmHdLa.d.ts → alert-BV0VWU2o.d.ts} +5 -7
  4. package/dist/{alert-xJELJxL4.js → alert-QXHRO9ji.js} +1 -1
  5. package/dist/alert-center.d.ts +2 -4
  6. package/dist/alert-center.js +1 -1
  7. package/dist/alert-dialog.d.ts +5 -7
  8. package/dist/alert-dialog.js +1 -1
  9. package/dist/alert.d.ts +1 -1
  10. package/dist/alert.js +1 -1
  11. package/dist/anchor.d.ts +2 -6
  12. package/dist/app-layout.d.ts +9 -27
  13. package/dist/app-layout.js +1 -1
  14. package/dist/area-chart.d.ts +2 -4
  15. package/dist/area-chart.js +1 -1
  16. package/dist/{as-child-D23mGo4f.d.ts → as-child-DFxX3U2i.d.ts} +0 -2
  17. package/dist/avatar.d.ts +2 -4
  18. package/dist/badge.d.ts +3 -5
  19. package/dist/bar-chart.d.ts +2 -4
  20. package/dist/bar-chart.js +1 -1
  21. package/dist/breadcrumb.d.ts +2 -6
  22. package/dist/breadcrumb.js +1 -1
  23. package/dist/browser-only.d.ts +0 -2
  24. package/dist/{button-BZT5f79d.d.ts → button-BFAvonp1.d.ts} +3 -7
  25. package/dist/{button-mzUR1U0Y.d.ts → button-BOCRKR5v.d.ts} +3 -7
  26. package/dist/button-CZ-q7fYv.js +1 -0
  27. package/dist/button-Cwrv2Mwv.js +1 -0
  28. package/dist/{button-BRjAW1ec.d.ts → button-Dt9LZMT5.d.ts} +5 -7
  29. package/dist/{button-BCoI4bhP.d.ts → button-L4exxu_L.d.ts} +0 -2
  30. package/dist/button.d.ts +4 -4
  31. package/dist/button.js +1 -1
  32. package/dist/calendar.d.ts +1 -3
  33. package/dist/card.d.ts +3 -5
  34. package/dist/centered-layout.d.ts +9 -32
  35. package/dist/chart-D2LtDZtV.js +2 -0
  36. package/dist/{chart-23KQ1ZNO.d.ts → chart-ynMysD16.d.ts} +40 -15
  37. package/dist/checkbox.d.ts +2 -4
  38. package/dist/{choice-BCiyqLgO.d.ts → choice-BLR0_MeB.d.ts} +3 -5
  39. package/dist/choice.d.ts +1 -1
  40. package/dist/{code-block-D5eDP379.d.ts → code-block-Bqw9VyK_.d.ts} +0 -22
  41. package/dist/code-block.d.ts +4 -12
  42. package/dist/code-block.js +6 -6
  43. package/dist/code-block_highlight-utils.d.ts +1 -1
  44. package/dist/code.d.ts +2 -4
  45. package/dist/color.d.ts +1 -1
  46. package/dist/combobox.d.ts +4 -6
  47. package/dist/combobox.js +1 -1
  48. package/dist/command.d.ts +3 -13
  49. package/dist/command.js +1 -1
  50. package/dist/cx.d.ts +0 -6
  51. package/dist/{data-slot-CChfb_cv.d.ts → data-slot-B-LqAcBB.d.ts} +0 -2
  52. package/dist/data-table.d.ts +5 -9
  53. package/dist/data-table.js +1 -1
  54. package/dist/description-list.d.ts +3 -5
  55. package/dist/{dialog-CgwSNHs1.d.ts → dialog-DedsCsnk.d.ts} +3 -5
  56. package/dist/{dialog-CZYD3xL-.d.ts → dialog-Dp0QGWwo.d.ts} +0 -2
  57. package/dist/dialog-eL61O8eg.js +1 -0
  58. package/dist/dialog.d.ts +2 -2
  59. package/dist/dialog.js +1 -1
  60. package/dist/{direction-BjU0bPST.d.ts → direction-CpRzTtZh.d.ts} +0 -2
  61. package/dist/{dropdown-menu-Cef0Cz2B.d.ts → dropdown-menu-ByQQIsQE.d.ts} +2 -4
  62. package/dist/dropdown-menu-C4C1x-7W.js +1 -0
  63. package/dist/dropdown-menu.d.ts +1 -2
  64. package/dist/dropdown-menu.js +1 -1
  65. package/dist/empty.d.ts +3 -5
  66. package/dist/{field-7QeiTFwl.d.ts → field-V_gnkcmN.d.ts} +0 -2
  67. package/dist/field.d.ts +7 -15
  68. package/dist/field.js +1 -1
  69. package/dist/flag.d.ts +1 -5
  70. package/dist/hooks.d.ts +1 -37
  71. package/dist/hover-card.d.ts +1 -3
  72. package/dist/hover-card.js +1 -1
  73. package/dist/{icon-ucVgZeXn.d.ts → icon-ByLVhdYq.d.ts} +2 -4
  74. package/dist/{icon-D1RY5Tcj.d.ts → icon-CgNqu-fl.d.ts} +0 -2
  75. package/dist/{icon-r2NvfTWW.d.ts → icon-DXDyhy2N.d.ts} +2 -4
  76. package/dist/icon.d.ts +3 -3
  77. package/dist/icons-exKDODyp.js +1 -0
  78. package/dist/icons.d.ts +3 -17
  79. package/dist/icons.js +1 -1
  80. package/dist/{in-view-Ch5vJtWo.d.ts → in-view-B3nMAzfE.d.ts} +0 -6
  81. package/dist/{index-DorCusfG.d.ts → index-BZhHLrBi.d.ts} +0 -2
  82. package/dist/{index-DA4ig3gj.d.ts → index-C6s5cGCr.d.ts} +2 -10
  83. package/dist/{input-eEKzP3cE.js → input-CpQ6jlpI.js} +1 -1
  84. package/dist/{input-bbB1tC0h.d.ts → input-Dx5owTCc.d.ts} +2 -6
  85. package/dist/input.d.ts +3 -7
  86. package/dist/input.js +1 -1
  87. package/dist/kbd.d.ts +1 -3
  88. package/dist/{label-C-KbNls8.d.ts → label-Dn5CPJUj.d.ts} +1 -3
  89. package/dist/label.d.ts +1 -1
  90. package/dist/layer-container.d.ts +0 -2
  91. package/dist/line-chart.d.ts +2 -4
  92. package/dist/line-chart.js +1 -1
  93. package/dist/list.d.ts +2 -8
  94. package/dist/live-region.d.ts +2 -4
  95. package/dist/llms.txt +4 -4
  96. package/dist/main.d.ts +1 -3
  97. package/dist/mantle-dark.css +2 -12
  98. package/dist/mantle.css +86 -13
  99. package/dist/media-object.d.ts +2 -4
  100. package/dist/migrations/0011-eliminate-high-contrast.yml +869 -0
  101. package/dist/multi-select.d.ts +4 -6
  102. package/dist/multi-select.js +1 -1
  103. package/dist/otp-input.d.ts +3 -5
  104. package/dist/pagination.d.ts +3 -7
  105. package/dist/pagination.js +1 -1
  106. package/dist/{popover-Dvls7-j4.d.ts → popover-BfB2I9G0.d.ts} +1 -3
  107. package/dist/{popover-oQDUvcZ2.js → popover-q2-rCY1q.js} +1 -1
  108. package/dist/popover.d.ts +1 -1
  109. package/dist/popover.js +1 -1
  110. package/dist/progress.d.ts +1 -7
  111. package/dist/progress.js +1 -1
  112. package/dist/qr-code.d.ts +2 -4
  113. package/dist/radio-group.d.ts +2 -4
  114. package/dist/radio-group.js +1 -1
  115. package/dist/sandbar.d.ts +5 -8
  116. package/dist/sandbar.js +1 -1
  117. package/dist/sandboxed-on-click.d.ts +1 -3
  118. package/dist/scatter-plot.d.ts +2 -4
  119. package/dist/scatter-plot.js +1 -1
  120. package/dist/select-BdF_CnfJ.js +1 -0
  121. package/dist/{select-DlohFa54.d.ts → select-CRp_ndSJ.d.ts} +3 -5
  122. package/dist/select.d.ts +1 -1
  123. package/dist/select.js +1 -1
  124. package/dist/selectable-list.d.ts +3 -5
  125. package/dist/selectable-list.js +1 -1
  126. package/dist/{separator-BWGjCIl7.d.ts → separator-DNovVsrx.d.ts} +3 -5
  127. package/dist/separator.d.ts +1 -1
  128. package/dist/shake-u3qyeThI.js +1 -0
  129. package/dist/sheet-BIyuxMmF.js +1 -0
  130. package/dist/sheet.d.ts +3 -5
  131. package/dist/sheet.js +1 -1
  132. package/dist/sidebar.d.ts +5 -9
  133. package/dist/sidebar.js +1 -1
  134. package/dist/{skeleton-zfqoDAxT.js → skeleton-DBpI-ko5.js} +1 -1
  135. package/dist/skeleton.d.ts +2 -4
  136. package/dist/skeleton.js +1 -1
  137. package/dist/skip-to-main-link.d.ts +1 -3
  138. package/dist/slider.d.ts +1 -3
  139. package/dist/{slot-Q996Hqk9.d.ts → slot-C0OCJjdJ.d.ts} +2 -4
  140. package/dist/slot.d.ts +1 -1
  141. package/dist/split-button.d.ts +5 -7
  142. package/dist/split-button.js +1 -1
  143. package/dist/strata.d.ts +2 -4
  144. package/dist/switch.d.ts +2 -4
  145. package/dist/switch.js +1 -1
  146. package/dist/{table-BhzITa19.d.ts → table-vT6Okwfa.d.ts} +1 -3
  147. package/dist/table.d.ts +1 -1
  148. package/dist/tabs.d.ts +3 -5
  149. package/dist/text-area.d.ts +2 -4
  150. package/dist/text-area.js +1 -1
  151. package/dist/theme-CBGxDNFc.js +1 -0
  152. package/dist/theme-switcher.d.ts +67 -213
  153. package/dist/theme-switcher.js +1 -1
  154. package/dist/{theme-6OxNhf6l.d.ts → theme-w1CrMM-x.d.ts} +3 -5
  155. package/dist/theme.d.ts +78 -177
  156. package/dist/theme.js +1 -1
  157. package/dist/toast.d.ts +4 -6
  158. package/dist/toast.js +1 -1
  159. package/dist/tooltip-BwMlCD6k.js +1 -0
  160. package/dist/{tooltip-CngH7Kl6.d.ts → tooltip-NcLIeBy5.d.ts} +1 -3
  161. package/dist/tooltip.d.ts +1 -1
  162. package/dist/tooltip.js +1 -1
  163. package/dist/truncated-text.d.ts +2 -4
  164. package/dist/truncated-text.js +1 -1
  165. package/dist/types.d.ts +3 -3
  166. package/dist/utils.d.ts +2 -4
  167. package/dist/visually-hidden.d.ts +2 -4
  168. package/dist/well.d.ts +3 -5
  169. package/dist/{with-style-props-Dq5Vntqy.d.ts → with-style-props-CuT30s0W.d.ts} +0 -2
  170. package/package.json +2 -10
  171. package/dist/button-Bkl_QYpp.js +0 -1
  172. package/dist/button-b2HKEIE2.js +0 -1
  173. package/dist/chart-BfJ835dr.js +0 -2
  174. package/dist/dialog-C9QGvVNG.js +0 -1
  175. package/dist/dropdown-menu-DMA8dGxZ.d.ts +0 -1
  176. package/dist/dropdown-menu-j4RbBbGa.js +0 -1
  177. package/dist/icons-CW9lV9E1.js +0 -1
  178. package/dist/mantle-dark-high-contrast.css +0 -354
  179. package/dist/mantle-light-high-contrast.css +0 -353
  180. package/dist/select-Os5GVejP.js +0 -1
  181. package/dist/sheet-CAFS09pT.js +0 -1
  182. package/dist/theme-Dzem-qRB.js +0 -1
  183. package/dist/tooltip-NhYXqStK.js +0 -1
@@ -1,47 +1,43 @@
1
- import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
2
- import { t as WithStyleProps } from "./with-style-props-Dq5Vntqy.js";
3
- import { n as IconButtonProps, r as IconButtonAppearance } from "./button-BZT5f79d.js";
4
- import { t as DropdownMenu } from "./dropdown-menu-Cef0Cz2B.js";
5
- import "./dropdown-menu-DMA8dGxZ.js";
6
- import { ComponentProps } from "react";
7
- //#region src/components/theme-switcher/theme-switcher.d.ts
1
+ import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
2
+ import { t as WithStyleProps } from "./with-style-props-CuT30s0W.js";
3
+ import { n as IconButtonProps, r as IconButtonAppearance } from "./button-BFAvonp1.js";
8
4
  /**
9
- * The props for the `ThemeDropdownMenuRadioGroup` component.
5
+ * The props for the `ThemeDropdownMenuItem` component.
10
6
  */
11
- type ThemeDropdownMenuRadioGroupProps = WithStyleProps & Pick<ComponentProps<"div">, "aria-label" | "aria-labelledby">;
7
+ type ThemeDropdownMenuItemProps = WithStyleProps & {
8
+ /**
9
+ * The visible label of the item. When set, it is also the accessible
10
+ * name. When omitted, the label is "Theme", and the accessible name also
11
+ * says which theme the next press shows, such as "Theme: Switch to dark
12
+ * theme". Set it for localization.
13
+ */
14
+ label?: string;
15
+ };
12
16
  /**
13
17
  * Must render inside a `DropdownMenu.Content` or `DropdownMenu.SubContent` —
14
18
  * the type system cannot express this constraint, so it is on you to uphold it.
15
19
  *
16
- * The theme-selection radio group for mantle's theme system. Renders one
17
- * `role="menuitemradio"` item per mantle theme via `DropdownMenu.RadioGroup`;
18
- * the active theme is `aria-checked` and choosing an item persists the new
19
- * theme through `useTheme`, so a `ThemeProvider` ancestor is required
20
- * (`useTheme` throws outside of one). Use it to embed theme selection in an
21
- * existing menu (e.g. an account menu submenu); for a standalone picker,
22
- * reach for `ThemeSwitcher` instead.
20
+ * The light/dark toggle for an existing menu, such as an account menu: one
21
+ * "Theme" row that ends in the `ThemeSwitcher` icon. It is the menu form of
22
+ * `ThemeSwitcher`. A press flips the theme the same way a `ThemeSwitcher`
23
+ * click does, and the icon swaps between the sun and the moon. The menu stays
24
+ * open, and the new theme grows in a circle from the icon.
23
25
  *
24
- * The group is named "Theme" by default. Pass `aria-label` to rename it, or
25
- * `aria-labelledby` to point at a visible heading such as a
26
- * `DropdownMenu.Label`.
26
+ * Reads and writes the theme via `useTheme`, so it must render inside a
27
+ * `ThemeProvider`. Under a provider with `forceTheme`, it shows the forced
28
+ * theme and is disabled. For a control in a header or toolbar, use
29
+ * `ThemeSwitcher` instead.
27
30
  *
28
- * @see https://mantle.ngrok.com/components/forms/theme-switcher
31
+ * **Data attributes:**
29
32
  *
30
- * @example
31
- * Standalone inside a `DropdownMenu.Content`:
32
- * ```tsx
33
- * <DropdownMenu.Root>
34
- * <DropdownMenu.Trigger asChild>
35
- * <Button type="button" appearance="outlined" intent="neutral">Theme</Button>
36
- * </DropdownMenu.Trigger>
37
- * <DropdownMenu.Content>
38
- * <ThemeDropdownMenuRadioGroup />
39
- * </DropdownMenu.Content>
40
- * </DropdownMenu.Root>
41
- * ```
33
+ * | Data Attribute | Value | Description |
34
+ * | --- | --- | --- |
35
+ * | `data-slot` | `"theme-dropdown-menu-item"` | On the item element. |
36
+ * | `data-slot` | `"theme-dropdown-menu-item-label"` | On the `<span>` that holds the `label`. |
37
+ *
38
+ * @see https://mantle.ngrok.com/components/forms/theme-switcher#themedropdownmenuitem
42
39
  *
43
40
  * @example
44
- * Embedded in a submenu of an existing menu (e.g. an account menu):
45
41
  * ```tsx
46
42
  * <DropdownMenu.Root>
47
43
  * <DropdownMenu.Trigger asChild>
@@ -49,210 +45,68 @@ type ThemeDropdownMenuRadioGroupProps = WithStyleProps & Pick<ComponentProps<"di
49
45
  * </DropdownMenu.Trigger>
50
46
  * <DropdownMenu.Content>
51
47
  * <DropdownMenu.Item>Profile</DropdownMenu.Item>
52
- * <DropdownMenu.Sub>
53
- * <DropdownMenu.SubTrigger>Theme</DropdownMenu.SubTrigger>
54
- * <DropdownMenu.SubContent>
55
- * <ThemeDropdownMenuRadioGroup />
56
- * </DropdownMenu.SubContent>
57
- * </DropdownMenu.Sub>
48
+ * <ThemeDropdownMenuItem />
58
49
  * </DropdownMenu.Content>
59
50
  * </DropdownMenu.Root>
60
51
  * ```
61
52
  */
62
- declare const ThemeDropdownMenuRadioGroup: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, style }: ThemeDropdownMenuRadioGroupProps) => import("react").JSX.Element;
63
- /**
64
- * The props for the `ThemeSwitcher.Root` component. Identical to
65
- * `DropdownMenu.Root`'s props — `Root` forwards everything through.
66
- */
67
- type ThemeSwitcherRootProps = ComponentProps<typeof DropdownMenu.Root>;
68
- /**
69
- * The stateful root of the theme switcher: a thin forwarding wrapper over
70
- * `DropdownMenu.Root` that owns the menu's open/closed state. Renders no DOM
71
- * of its own. Compose `ThemeSwitcher.Trigger` and `ThemeSwitcher.Content`
72
- * inside it.
73
- *
74
- * @see https://mantle.ngrok.com/components/forms/theme-switcher
75
- *
76
- * @example
77
- * ```tsx
78
- * <ThemeSwitcher.Root>
79
- * <ThemeSwitcher.Trigger />
80
- * <ThemeSwitcher.Content />
81
- * </ThemeSwitcher.Root>
82
- * ```
83
- */
84
- declare const Root: (props: ThemeSwitcherRootProps) => import("react").JSX.Element;
53
+ declare function ThemeDropdownMenuItem({ className, label, style }: ThemeDropdownMenuItemProps): import("react").JSX.Element;
85
54
  /**
86
- * The props for the `ThemeSwitcher.Trigger` component. Forwards
87
- * `IconButton`'s props, except the parts the trigger owns: `icon` (the
88
- * SSR-safe themed icon) and `intent` (always `"neutral"`). `asChild` and
89
- * `children` are removed: the trigger renders only its icon (the `label`
90
- * renders as `aria-label`), so both would be silently meaningless.
91
- * `appearance` and `label` become optional with theme-switcher defaults.
55
+ * The props for the `ThemeSwitcher` component. Forwards `IconButton`'s props,
56
+ * except the parts the switcher owns: `icon` (the SSR-safe themed icon) and
57
+ * `intent` (always `"neutral"`). `asChild` and `children` are removed: the
58
+ * switcher renders only its icon (the `label` renders as `aria-label`), so
59
+ * both would be silently meaningless. `appearance` and `label` become optional
60
+ * with theme-switcher defaults.
92
61
  */
93
- type ThemeSwitcherTriggerProps = Omit<IconButtonProps, "appearance" | "asChild" | "children" | "icon" | "intent" | "label"> & WithDataSlot & {
62
+ type ThemeSwitcherProps = Omit<IconButtonProps, "appearance" | "asChild" | "children" | "icon" | "intent" | "label"> & WithDataSlot & {
94
63
  /**
95
- * The visual style of the trigger `IconButton`. Optional here —
96
- * `ThemeSwitcher.Trigger` defaults to `"ghost"` so the trigger sits
97
- * quietly in headers and toolbars.
64
+ * The visual style of the `IconButton`. Optional here: `ThemeSwitcher`
65
+ * defaults to `"ghost"` so it sits quietly in headers and toolbars.
98
66
  *
99
67
  * @default "ghost"
100
68
  */
101
69
  appearance?: IconButtonAppearance;
102
70
  /**
103
- * The accessible name for the trigger `IconButton`, rendered as its
104
- * `aria-label`. Override it for localization.
105
- *
106
- * @default "Change Theme"
71
+ * The accessible name of the button, rendered as its `aria-label`. When
72
+ * omitted, the name says which theme the next click shows, such as
73
+ * "Switch to dark theme" or "Switch to light theme (system default)".
74
+ * Set it for localization.
107
75
  */
108
76
  label?: string;
109
77
  };
110
78
  /**
111
- * The button that opens the theme menu: an `IconButton` (ghost by default)
112
- * wired up as the menu trigger. The trigger icon is SSR-safe: the applied
113
- * theme is unknowable server-side, so a `Skeleton` renders until hydration,
114
- * then the icon matching the applied theme. The icon is owned by the trigger;
115
- * to render a completely custom trigger, compose `DropdownMenu` +
116
- * `ThemeDropdownMenuRadioGroup` directly instead.
117
- *
118
- * @see https://mantle.ngrok.com/components/forms/theme-switcher
119
- *
120
- * @example
121
- * ```tsx
122
- * <ThemeSwitcher.Root>
123
- * <ThemeSwitcher.Trigger appearance="outlined" label="Choose a theme" />
124
- * <ThemeSwitcher.Content />
125
- * </ThemeSwitcher.Root>
126
- * ```
127
- */
128
- declare const Trigger: ({ appearance, "data-slot": dataSlot, disabled, label, ref, ...props }: ThemeSwitcherTriggerProps) => import("react").JSX.Element;
129
- /**
130
- * The props for the `ThemeSwitcher.Content` component. Identical to
131
- * `DropdownMenu.Content`'s props — positioning and collision behavior
132
- * (`align`, `side`, `collisionPadding`, …) plus `className`/`style` all
133
- * forward through.
134
- */
135
- type ThemeSwitcherContentProps = ComponentProps<typeof DropdownMenu.Content> & WithDataSlot;
136
- /**
137
- * The popover the trigger opens: a thin forwarding wrapper over
138
- * `DropdownMenu.Content`. When `children` are omitted (or `null`/`undefined`)
139
- * it renders `ThemeDropdownMenuRadioGroup`, the five-theme radio group; pass
140
- * `children` to own the menu contents instead (compose
141
- * `ThemeDropdownMenuRadioGroup` yourself alongside extra items). Any
142
- * non-nullish children replace the default entirely, including render-nothing
143
- * values like `false`; a lone `{condition && <Item />}` child suppresses the
144
- * radio group when the condition is false.
79
+ * The canonical theme control for headers and toolbars: an `IconButton`
80
+ * (ghost by default) that shows the applied theme and flips between light and
81
+ * dark on each click. The new theme grows in a circle from the button in a
82
+ * view transition, and swaps at once under reduced motion. It stores three
83
+ * states with two visible ones. A click
84
+ * shows the opposite of the applied theme, and stores `"system"` instead of a
85
+ * pin when that opposite matches the OS preference. So a second click always
86
+ * returns the user to the OS default.
87
+ *
88
+ * Reads and writes the theme via `useTheme`, so it must render inside a
89
+ * `ThemeProvider`. Under a provider with `forceTheme`, it shows the forced
90
+ * theme and is disabled, because a click cannot change what the page shows. The icon is SSR-safe: a `Skeleton` renders until
91
+ * hydration, then the icon of the applied theme. To put the same control in
92
+ * an existing menu, use `ThemeDropdownMenuItem`.
145
93
  *
146
94
  * @see https://mantle.ngrok.com/components/forms/theme-switcher
147
- *
148
- * @example
149
- * ```tsx
150
- * <ThemeSwitcher.Root>
151
- * <ThemeSwitcher.Trigger />
152
- * <ThemeSwitcher.Content align="end" collisionPadding={{ right: 16 }} />
153
- * </ThemeSwitcher.Root>
154
- * ```
155
- *
156
- * @example
157
- * Extending the menu beyond theme selection:
158
- * ```tsx
159
- * <ThemeSwitcher.Content>
160
- * <ThemeDropdownMenuRadioGroup />
161
- * <DropdownMenu.Separator />
162
- * <DropdownMenu.Item>Appearance settings…</DropdownMenu.Item>
163
- * </ThemeSwitcher.Content>
164
- * ```
165
- */
166
- declare const Content: ({ children, "data-slot": dataSlot, ...props }: ThemeSwitcherContentProps) => import("react").JSX.Element;
167
- /**
168
- * The canonical picker for mantle's theme system: a compact `IconButton`
169
- * trigger (ghost by default) that opens a `DropdownMenu` hosting
170
- * `ThemeDropdownMenuRadioGroup`, the theme-selection radio group.
171
- *
172
- * Reads and writes the active theme via `useTheme`, so it must render inside
173
- * a `ThemeProvider` — `useTheme` throws outside of one.
174
- *
175
- * To embed theme selection in an existing menu instead (e.g. an account menu
176
- * submenu), use `ThemeDropdownMenuRadioGroup` directly.
177
- *
178
- * @see https://mantle.ngrok.com/components/forms/theme-switcher
179
- *
180
- * @example
181
- * Composition:
182
- * ```
183
- * ThemeSwitcher.Root
184
- * ├── ThemeSwitcher.Trigger
185
- * └── ThemeSwitcher.Content
186
- * ```
95
+ * @see https://lea.verou.me/blog/2026/dark-mode-toggles/
187
96
  *
188
97
  * @example
189
98
  * ```tsx
190
99
  * <ThemeProvider>
191
100
  * <header>
192
- * <ThemeSwitcher.Root>
193
- * <ThemeSwitcher.Trigger />
194
- * <ThemeSwitcher.Content />
195
- * </ThemeSwitcher.Root>
101
+ * <ThemeSwitcher />
196
102
  * </header>
197
103
  * </ThemeProvider>
198
104
  * ```
105
+ *
106
+ * @example
107
+ * ```tsx
108
+ * <ThemeSwitcher appearance="outlined" label="Cambiar tema" />
109
+ * ```
199
110
  */
200
- declare const ThemeSwitcher: {
201
- /**
202
- * The stateful root: a thin forwarding wrapper over `DropdownMenu.Root`
203
- * that owns the menu's open/closed state. Renders no DOM of its own.
204
- *
205
- * @see https://mantle.ngrok.com/components/forms/theme-switcher
206
- *
207
- * @example
208
- * ```tsx
209
- * <ThemeSwitcher.Root>
210
- * <ThemeSwitcher.Trigger />
211
- * <ThemeSwitcher.Content />
212
- * </ThemeSwitcher.Root>
213
- * ```
214
- */
215
- readonly Root: typeof Root;
216
- /**
217
- * The button that opens the theme menu: an `IconButton` (ghost by default)
218
- * wired up as the menu trigger. The trigger icon is SSR-safe: the applied
219
- * theme is unknowable server-side, so a `Skeleton` renders until hydration,
220
- * then the icon matching the applied theme. The icon is owned by the trigger;
221
- * to render a completely custom trigger, compose `DropdownMenu` +
222
- * `ThemeDropdownMenuRadioGroup` directly instead.
223
- *
224
- * @see https://mantle.ngrok.com/components/forms/theme-switcher
225
- *
226
- * @example
227
- * ```tsx
228
- * <ThemeSwitcher.Root>
229
- * <ThemeSwitcher.Trigger appearance="outlined" label="Choose a theme" />
230
- * <ThemeSwitcher.Content />
231
- * </ThemeSwitcher.Root>
232
- * ```
233
- */
234
- readonly Trigger: typeof Trigger;
235
- /**
236
- * The popover the trigger opens: a thin forwarding wrapper over
237
- * `DropdownMenu.Content`. When `children` are omitted (or `null`/`undefined`)
238
- * it renders `ThemeDropdownMenuRadioGroup`, the five-theme radio group; pass
239
- * `children` to own the menu contents instead (compose
240
- * `ThemeDropdownMenuRadioGroup` yourself alongside extra items). Any
241
- * non-nullish children replace the default entirely, including render-nothing
242
- * values like `false`; a lone `{condition && <Item />}` child suppresses the
243
- * radio group when the condition is false.
244
- *
245
- * @see https://mantle.ngrok.com/components/forms/theme-switcher
246
- *
247
- * @example
248
- * ```tsx
249
- * <ThemeSwitcher.Root>
250
- * <ThemeSwitcher.Trigger />
251
- * <ThemeSwitcher.Content align="end" collisionPadding={{ right: 16 }} />
252
- * </ThemeSwitcher.Root>
253
- * ```
254
- */
255
- readonly Content: typeof Content;
256
- };
257
- //#endregion
258
- export { ThemeDropdownMenuRadioGroup, type ThemeDropdownMenuRadioGroupProps, ThemeSwitcher, type ThemeSwitcherContentProps, type ThemeSwitcherRootProps, type ThemeSwitcherTriggerProps };
111
+ declare function ThemeSwitcher({ appearance, "data-slot": dataSlot, disabled, label, onClick, ...props }: ThemeSwitcherProps): import("react").JSX.Element;
112
+ export { ThemeDropdownMenuItem, type ThemeDropdownMenuItemProps, ThemeSwitcher, type ThemeSwitcherProps };
@@ -1 +1 @@
1
- import{t as e}from"./data-slot-EM6s2WEU.js";import{t}from"./icon-kK0c-POG.js";import{t as n}from"./button-Bkl_QYpp.js";import{t as r}from"./browser-only-Crr3sgA0.js";import{t as i}from"./skeleton-zfqoDAxT.js";import{t as a}from"./dropdown-menu-j4RbBbGa.js";import{d as o,h as s,l as c,p as l}from"./theme-Dzem-qRB.js";import{n as u,t as d}from"./icons-CW9lV9E1.js";import{c as f}from"react/compiler-runtime";import{jsx as p,jsxs as m}from"react/jsx-runtime";const h={system:`System Preference`,light:`Light Mode`,dark:`Dark Mode`,"light-high-contrast":`Light High Contrast`,"dark-high-contrast":`Dark High Contrast`},g=e=>{let t=f(10),{"aria-label":n,"aria-labelledby":r,className:i,style:o}=e,[u,d]=c(),m=r==null?n??`Theme`:n,h;t[0]===d?h=t[1]:(h=e=>{l(e)&&d(e)},t[0]=d,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=s.map(v),t[2]=g):g=t[2];let _;return t[3]!==r||t[4]!==i||t[5]!==u||t[6]!==o||t[7]!==m||t[8]!==h?(_=/* @__PURE__ */ p(a.RadioGroup,{"aria-label":m,"aria-labelledby":r,"data-slot":`theme-dropdown-menu-radio-group`,className:i,style:o,value:u,onValueChange:h,children:g}),t[3]=r,t[4]=i,t[5]=u,t[6]=o,t[7]=m,t[8]=h,t[9]=_):_=t[9],_},_={Root:e=>{let t=f(2),n;return t[0]===e?n=t[1]:(n=/* @__PURE__ */ p(a.Root,{...e}),t[0]=e,t[1]=n),n},Trigger:t=>{let o=f(20),s,c,l,u,d,m;o[0]===t?(s=o[1],c=o[2],l=o[3],u=o[4],d=o[5],m=o[6]):({appearance:d,"data-slot":s,disabled:c,label:m,ref:u,...l}=t,o[0]=t,o[1]=s,o[2]=c,o[3]=l,o[4]=u,o[5]=d,o[6]=m);let h=d===void 0?`ghost`:d,g=m===void 0?`Change Theme`:m,_;o[7]===s?_=o[8]:(_=e(s,`theme-switcher-trigger`),o[7]=s,o[8]=_);let v;o[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=/* @__PURE__ */ p(r,{fallback:/* @__PURE__ */ p(i,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ p(`span`,{})}),children:y}),o[9]=v):v=o[9];let b;o[10]!==h||o[11]!==c||o[12]!==g||o[13]!==l||o[14]!==u||o[15]!==_?(b=/* @__PURE__ */ p(n,{ref:u,appearance:h,disabled:c,"data-slot":_,intent:`neutral`,icon:v,label:g,...l}),o[10]=h,o[11]=c,o[12]=g,o[13]=l,o[14]=u,o[15]=_,o[16]=b):b=o[16];let x;return o[17]!==c||o[18]!==b?(x=/* @__PURE__ */ p(a.Trigger,{asChild:!0,disabled:c,children:b}),o[17]=c,o[18]=b,o[19]=x):x=o[19],x},Content:t=>{let n=f(12),r,i,o;n[0]===t?(r=n[1],i=n[2],o=n[3]):({children:r,"data-slot":i,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o);let s;n[4]===i?s=n[5]:(s=e(i,`theme-switcher-content`),n[4]=i,n[5]=s);let c;n[6]===r?c=n[7]:(c=r??/* @__PURE__ */ p(g,{}),n[6]=r,n[7]=c);let l;return n[8]!==o||n[9]!==s||n[10]!==c?(l=/* @__PURE__ */ p(a.Content,{"data-slot":s,...o,children:c}),n[8]=o,n[9]=s,n[10]=c,n[11]=l):l=n[11],l}};function v(e){return/* @__PURE__ */ m(a.RadioItem,{value:o(e),children:[/* @__PURE__ */ p(t,{svg:/* @__PURE__ */ p(u,{theme:e})}),h[e]]},e)}function y(){return/* @__PURE__ */ p(d,{className:`size-5`})}export{g as ThemeDropdownMenuRadioGroup,_ as ThemeSwitcher};
1
+ import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{r as n}from"./button-CZ-q7fYv.js";import{t as r}from"./button-Cwrv2Mwv.js";import{t as i}from"./use-matches-media-query-m860lols.js";import{t as a}from"./use-is-hydrated-DDCqXmju.js";import{t as o}from"./browser-only-Crr3sgA0.js";import{t as s}from"./skeleton-DBpI-ko5.js";import{t as c}from"./dropdown-menu-C4C1x-7W.js";import{c as l,p as u,s as d,u as f}from"./theme-CBGxDNFc.js";import{n as p}from"./icons-exKDODyp.js";import{c as m}from"react/compiler-runtime";import{useRef as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v={light:/* @__PURE__ */ g(p,{theme:`light`}),dark:/* @__PURE__ */ g(p,{theme:`dark`})};function y(t){let r=m(23),{className:a,label:o,style:s}=t,[p,y]=f(),b=d(),S=l(),C=i(`(prefers-color-scheme: dark)`),w=h(null),T,E;if(r[0]!==o||r[1]!==C||r[2]!==p){let e=u({theme:p,prefersDarkMode:C});T=c.Item,E=o==null?`Theme: ${x(e,{prefersDarkMode:C})}`:void 0,r[0]=o,r[1]=C,r[2]=p,r[3]=T,r[4]=E}else T=r[3],E=r[4];let D;r[5]===a?D=r[6]:(D=e(`gap-2`,a),r[5]=a,r[6]=D);let O=S!=null,k;r[7]!==C||r[8]!==y?(k=e=>{e.preventDefault(),y(e=>u({theme:e,prefersDarkMode:C}),{origin:w.current})},r[7]=C,r[8]=y,r[9]=k):k=r[9];let A=o??`Theme`,j;r[10]===A?j=r[11]:(j=/* @__PURE__ */ g(`span`,{"data-slot":`theme-dropdown-menu-item-label`,className:`flex-1`,children:A}),r[10]=A,r[11]=j);let M;r[12]===b?M=r[13]:(M=/* @__PURE__ */ g(`span`,{ref:w,"aria-hidden":!0,className:`flex size-7 shrink-0 items-center justify-center text-muted [&_svg]:size-5`,children:/* @__PURE__ */ g(n,{active:b,icons:v})}),r[12]=b,r[13]=M);let N;return r[14]!==T||r[15]!==s||r[16]!==E||r[17]!==D||r[18]!==O||r[19]!==k||r[20]!==j||r[21]!==M?(N=/* @__PURE__ */ _(T,{"aria-label":E,"data-slot":`theme-dropdown-menu-item`,className:D,disabled:O,style:s,onSelect:k,children:[j,M]}),r[14]=T,r[15]=s,r[16]=E,r[17]=D,r[18]=O,r[19]=k,r[20]=j,r[21]=M,r[22]=N):N=r[22],N}function b(e){let c=m(28),p,h,_,y,b,S;c[0]===e?(p=c[1],h=c[2],_=c[3],y=c[4],b=c[5],S=c[6]):({appearance:S,"data-slot":p,disabled:h,label:_,onClick:y,...b}=e,c[0]=e,c[1]=p,c[2]=h,c[3]=_,c[4]=y,c[5]=b,c[6]=S);let C=S===void 0?`ghost`:S,[w,T]=f(),E=d(),D=l(),O=i(`(prefers-color-scheme: dark)`),k=a(),A;if(c[7]!==k||c[8]!==O||c[9]!==w){let e=u({theme:w,prefersDarkMode:O});A=k?x(e,{prefersDarkMode:O}):`Toggle theme`,c[7]=k,c[8]=O,c[9]=w,c[10]=A}else A=c[10];let j=A,M;c[11]===p?M=c[12]:(M=t(p,`theme-switcher`),c[11]=p,c[12]=M);let N=D!=null||h,P;c[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=/* @__PURE__ */ g(s,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ g(`span`,{})}),c[13]=P):P=c[13];let F;c[14]===E?F=c[15]:(F=/* @__PURE__ */ g(o,{fallback:P,children:()=>/* @__PURE__ */ g(n,{active:E,icons:v})}),c[14]=E,c[15]=F);let I=_??(D==null?j:`Theme set by this page`),L;c[16]!==y||c[17]!==O||c[18]!==T?(L=e=>{y?.(e),e.defaultPrevented||T(e=>u({theme:e,prefersDarkMode:O}),{origin:e.currentTarget})},c[16]=y,c[17]=O,c[18]=T,c[19]=L):L=c[19];let R;return c[20]!==C||c[21]!==b||c[22]!==M||c[23]!==N||c[24]!==F||c[25]!==I||c[26]!==L?(R=/* @__PURE__ */ g(r,{appearance:C,"data-slot":M,disabled:N,intent:`neutral`,icon:F,label:I,onClick:L,...b}),c[20]=C,c[21]=b,c[22]=M,c[23]=N,c[24]=F,c[25]=I,c[26]=L,c[27]=R):R=c[27],R}function x(e,{prefersDarkMode:t}){return e===`system`?t?`Switch to dark theme (system default)`:`Switch to light theme (system default)`:`Switch to ${e} theme`}export{y as ThemeDropdownMenuItem,b as ThemeSwitcher};
@@ -1,10 +1,9 @@
1
- //#region src/components/theme/themes.d.ts
2
1
  /**
3
- * The four concrete themes `"system"` resolves to.
2
+ * The two concrete themes `"system"` resolves to.
4
3
  *
5
4
  * @see https://mantle.ngrok.com/components/primitives/theme
6
5
  */
7
- declare const resolvedThemes: readonly ["light", "dark", "light-high-contrast", "dark-high-contrast"];
6
+ declare const resolvedThemes: readonly ["light", "dark"];
8
7
  /**
9
8
  * One concrete theme, never `"system"`.
10
9
  *
@@ -16,7 +15,7 @@ type ResolvedTheme = (typeof resolvedThemes)[number];
16
15
  *
17
16
  * @see https://mantle.ngrok.com/components/primitives/theme
18
17
  */
19
- declare const themes: readonly ["system", "light", "dark", "light-high-contrast", "dark-high-contrast"];
18
+ declare const themes: readonly ["system", "light", "dark"];
20
19
  /**
21
20
  * One theme a consumer can set, including `"system"`.
22
21
  *
@@ -47,5 +46,4 @@ declare const $resolvedTheme: <T extends ResolvedTheme = ResolvedTheme>(value: T
47
46
  * @see https://mantle.ngrok.com/components/primitives/theme
48
47
  */
49
48
  declare function isResolvedTheme(value: unknown): value is ResolvedTheme;
50
- //#endregion
51
49
  export { isResolvedTheme as a, themes as c, Theme as i, $theme as n, isTheme as o, ResolvedTheme as r, resolvedThemes as s, $resolvedTheme as t };