@caligo-ui/core 1.0.0 → 1.2.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 (226) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/README.md +6 -5
  3. package/agent/caligo.json +648 -41
  4. package/dist/css/Accordion.css +6 -0
  5. package/dist/css/AccordionSummary.css +2 -0
  6. package/dist/css/Alert.css +8 -0
  7. package/dist/css/AppBar.css +2 -0
  8. package/dist/css/Avatar.css +4 -0
  9. package/dist/css/AvatarGroup.css +6 -0
  10. package/dist/css/Badge.css +6 -0
  11. package/dist/css/Breadcrumb.css +2 -0
  12. package/dist/css/Breadcrumbs.css +2 -0
  13. package/dist/css/Button.css +2 -0
  14. package/dist/css/ButtonGroup.css +4 -0
  15. package/dist/css/Card.css +4 -0
  16. package/dist/css/Checkbox.css +2 -0
  17. package/dist/css/Chip.css +4 -0
  18. package/dist/css/CircularProgress.css +2 -0
  19. package/dist/css/Collapse.css +2 -0
  20. package/dist/css/Collapsible.css +8 -0
  21. package/dist/css/Container.css +2 -0
  22. package/dist/css/Dialog.css +2 -0
  23. package/dist/css/Divider.css +2 -0
  24. package/dist/css/Drawer.css +2 -0
  25. package/dist/css/ErrorPanel.css +6 -0
  26. package/dist/css/FormControl.css +2 -0
  27. package/dist/css/FormControlLabel.css +2 -0
  28. package/dist/css/FormGroup.css +2 -0
  29. package/dist/css/FormHelperText.css +2 -0
  30. package/dist/css/FormLabel.css +2 -0
  31. package/dist/css/Grid.css +2 -0
  32. package/dist/css/Icon.css +4 -0
  33. package/dist/css/IconButton.css +4 -0
  34. package/dist/css/InputAdornment.css +2 -0
  35. package/dist/css/InputBase.css +2 -0
  36. package/dist/css/InputGroup.css +12 -0
  37. package/dist/css/Label.css +2 -0
  38. package/dist/css/LicenseInfo.css +2 -0
  39. package/dist/css/LinearProgress.css +2 -0
  40. package/dist/css/Link.css +2 -0
  41. package/dist/css/List.css +2 -0
  42. package/dist/css/ListItem.css +6 -0
  43. package/dist/css/ListItemAvatar.css +2 -0
  44. package/dist/css/ListItemButton.css +2 -0
  45. package/dist/css/ListItemIcon.css +4 -0
  46. package/dist/css/ListItemText.css +4 -0
  47. package/dist/css/ListSubheader.css +2 -0
  48. package/dist/css/Menu.css +2 -0
  49. package/dist/css/MenuItem.css +2 -0
  50. package/dist/css/MenuList.css +6 -0
  51. package/dist/css/NotificationBadge.css +6 -0
  52. package/dist/css/Pagination.css +6 -0
  53. package/dist/css/PaginationItem.css +4 -0
  54. package/dist/css/Paper.css +2 -0
  55. package/dist/css/Popover.css +2 -0
  56. package/dist/css/PreviewCard.css +4 -0
  57. package/dist/css/Progress.css +4 -0
  58. package/dist/css/Radio.css +2 -0
  59. package/dist/css/RadioGroup.css +2 -0
  60. package/dist/css/ScrollArea.css +2 -0
  61. package/dist/css/Select.css +10 -0
  62. package/dist/css/Separator.css +2 -0
  63. package/dist/css/Sheet.css +2 -0
  64. package/dist/css/Skeleton.css +2 -0
  65. package/dist/css/Slider.css +2 -0
  66. package/dist/css/Snackbar.css +4 -0
  67. package/dist/css/SnackbarContent.css +2 -0
  68. package/dist/css/Spinner.css +2 -0
  69. package/dist/css/Stack.css +2 -0
  70. package/dist/css/Switch.css +2 -0
  71. package/dist/css/Tab.css +2 -0
  72. package/dist/css/Table.css +2 -0
  73. package/dist/css/TableBody.css +2 -0
  74. package/dist/css/TableCell.css +2 -0
  75. package/dist/css/TableContainer.css +2 -0
  76. package/dist/css/TableFooter.css +2 -0
  77. package/dist/css/TableHead.css +2 -0
  78. package/dist/css/TableRow.css +2 -0
  79. package/dist/css/TableSortLabel.css +2 -0
  80. package/dist/css/Tabs.css +2 -0
  81. package/dist/css/Tag.css +4 -0
  82. package/dist/css/TextField.css +10 -0
  83. package/dist/css/Toast.css +4 -0
  84. package/dist/css/ToggleButton.css +2 -0
  85. package/dist/css/ToggleButtonGroup.css +2 -0
  86. package/dist/css/ToggleGroup.css +2 -0
  87. package/dist/css/Toolbar.css +2 -0
  88. package/dist/css/Tooltip.css +2 -0
  89. package/dist/css/Typography.css +2 -0
  90. package/dist/css/VirtualList.css +2 -0
  91. package/dist/esm/Alert/Alert.css +1 -1
  92. package/dist/esm/Alert/Alert2.js +2 -0
  93. package/dist/esm/Alert/Alert2.js.map +1 -1
  94. package/dist/esm/Avatar/Avatar.css +1 -1
  95. package/dist/esm/Avatar/Avatar2.js +33 -39
  96. package/dist/esm/Avatar/Avatar2.js.map +1 -1
  97. package/dist/esm/Breadcrumbs/Breadcrumbs.css +1 -1
  98. package/dist/esm/Button/Button.css +1 -1
  99. package/dist/esm/Button/Button2.js +36 -36
  100. package/dist/esm/Button/Button2.js.map +1 -1
  101. package/dist/esm/Button/buttonClasses.js +1 -1
  102. package/dist/esm/Button/buttonClasses.js.map +1 -1
  103. package/dist/esm/Card/Card.css +1 -1
  104. package/dist/esm/Checkbox/Checkbox.css +1 -1
  105. package/dist/esm/Chip/Chip.css +1 -1
  106. package/dist/esm/Chip/Chip2.js +30 -53
  107. package/dist/esm/Chip/Chip2.js.map +1 -1
  108. package/dist/esm/Dialog/Dialog.css +1 -1
  109. package/dist/esm/Dialog/Dialog2.js.map +1 -1
  110. package/dist/esm/Drawer/Drawer.css +1 -1
  111. package/dist/esm/FormLabel/FormLabel.css +1 -1
  112. package/dist/esm/IconButton/IconButton.css +1 -1
  113. package/dist/esm/IconButton/IconButton2.js +9 -8
  114. package/dist/esm/IconButton/IconButton2.js.map +1 -1
  115. package/dist/esm/InputBase/InputBase.js +52 -0
  116. package/dist/esm/InputBase/InputBase.js.map +1 -0
  117. package/dist/esm/InputBase/index.js +1 -0
  118. package/dist/esm/List/List.css +1 -1
  119. package/dist/esm/Menu/Menu.css +1 -1
  120. package/dist/esm/MenuItem/MenuItem.css +1 -1
  121. package/dist/esm/Paper/Paper.css +1 -1
  122. package/dist/esm/Popover/Popover.css +1 -1
  123. package/dist/esm/Radio/Radio.css +1 -1
  124. package/dist/esm/Radio/Radio2.js +74 -45
  125. package/dist/esm/Radio/Radio2.js.map +1 -1
  126. package/dist/esm/RadioGroup/RadioGroup.js +29 -22
  127. package/dist/esm/RadioGroup/RadioGroup.js.map +1 -1
  128. package/dist/esm/RadioGroup/radioGroupContext.js.map +1 -1
  129. package/dist/esm/ScrollArea/ScrollArea.css +1 -0
  130. package/dist/esm/ScrollArea/ScrollArea2.js +25 -0
  131. package/dist/esm/ScrollArea/ScrollArea2.js.map +1 -0
  132. package/dist/esm/ScrollArea/index.js +1 -0
  133. package/dist/esm/Select/Select.css +1 -1
  134. package/dist/esm/Snackbar/Snackbar.css +1 -1
  135. package/dist/esm/Switch/Switch.css +1 -1
  136. package/dist/esm/Switch/Switch2.js +47 -42
  137. package/dist/esm/Switch/Switch2.js.map +1 -1
  138. package/dist/esm/Tab/Tab.css +1 -1
  139. package/dist/esm/Tab/Tab2.js +29 -24
  140. package/dist/esm/Tab/Tab2.js.map +1 -1
  141. package/dist/esm/Table/Table.css +1 -1
  142. package/dist/esm/TableCell/TableCell.js +6 -6
  143. package/dist/esm/TableCell/TableCell.js.map +1 -1
  144. package/dist/esm/Tabs/Tabs.css +1 -1
  145. package/dist/esm/TextField/TextField.css +1 -1
  146. package/dist/esm/TextField/TextField2.js +106 -86
  147. package/dist/esm/TextField/TextField2.js.map +1 -1
  148. package/dist/esm/TextField/textFieldClasses.js +2 -0
  149. package/dist/esm/TextField/textFieldClasses.js.map +1 -1
  150. package/dist/esm/ToggleButton/ToggleButton.css +1 -1
  151. package/dist/esm/Toolbar/Toolbar.css +1 -1
  152. package/dist/esm/Tooltip/Tooltip.css +1 -1
  153. package/dist/esm/Tooltip/Tooltip2.js +50 -33
  154. package/dist/esm/Tooltip/Tooltip2.js.map +1 -1
  155. package/dist/esm/Typography/Typography.css +1 -1
  156. package/dist/esm/caligo.css +1 -1
  157. package/dist/esm/index.js +65 -63
  158. package/dist/esm/internal/glyphs.js +5 -0
  159. package/dist/esm/internal/glyphs.js.map +1 -1
  160. package/dist/esm/internal/hues.js +23 -0
  161. package/dist/esm/internal/hues.js.map +1 -0
  162. package/dist/esm/internal/inputEvent.js +22 -0
  163. package/dist/esm/internal/inputEvent.js.map +1 -0
  164. package/dist/esm/internal/releaseInfo.js +1 -1
  165. package/dist/esm/internal/releaseInfo.js.map +1 -1
  166. package/dist/esm/mui/index.js.map +1 -1
  167. package/dist/esm/mui/themeValues.js +106 -0
  168. package/dist/esm/mui/themeValues.js.map +1 -1
  169. package/dist/esm/parts/Breadcrumb.js +68 -0
  170. package/dist/esm/parts/Breadcrumb.js.map +1 -0
  171. package/dist/esm/parts/Combobox.js +171 -0
  172. package/dist/esm/parts/Combobox.js.map +1 -0
  173. package/dist/esm/parts/ContextMenu.js +17 -17
  174. package/dist/esm/parts/ContextMenu.js.map +1 -1
  175. package/dist/esm/parts/Menu.js +105 -24
  176. package/dist/esm/parts/Menu.js.map +1 -1
  177. package/dist/esm/parts/Select.js +120 -0
  178. package/dist/esm/parts/Select.js.map +1 -0
  179. package/dist/esm/parts/Toast.js +95 -0
  180. package/dist/esm/parts/Toast.js.map +1 -0
  181. package/dist/esm/parts/Toolbar.js +100 -0
  182. package/dist/esm/parts/Toolbar.js.map +1 -0
  183. package/dist/esm/parts/Tooltip.js +20 -8
  184. package/dist/esm/parts/Tooltip.js.map +1 -1
  185. package/dist/esm/parts/index.js +156 -87
  186. package/dist/esm/parts/index.js.map +1 -1
  187. package/dist/global/caligo-ui.css +1 -1
  188. package/dist/global/caligo-ui.js +1 -1
  189. package/dist/global/caligo-ui.js.map +1 -1
  190. package/dist/types/Alert/Alert.d.ts +7 -2
  191. package/dist/types/Avatar/Avatar.d.ts +38 -3
  192. package/dist/types/Button/Button.d.ts +9 -2
  193. package/dist/types/Button/buttonClasses.d.ts +2 -0
  194. package/dist/types/Chip/Chip.d.ts +21 -0
  195. package/dist/types/Dialog/Dialog.d.ts +1 -0
  196. package/dist/types/IconButton/IconButton.d.ts +6 -0
  197. package/dist/types/InputBase/InputBase.d.ts +64 -0
  198. package/dist/types/InputBase/index.d.ts +2 -0
  199. package/dist/types/Radio/Radio.d.ts +5 -3
  200. package/dist/types/RadioGroup/RadioGroup.d.ts +4 -2
  201. package/dist/types/RadioGroup/radioGroupContext.d.ts +6 -2
  202. package/dist/types/ScrollArea/ScrollArea.d.ts +28 -0
  203. package/dist/types/ScrollArea/index.d.ts +2 -0
  204. package/dist/types/Switch/Switch.d.ts +4 -3
  205. package/dist/types/Tab/Tab.d.ts +7 -0
  206. package/dist/types/TableCell/TableCell.d.ts +6 -0
  207. package/dist/types/TextField/TextField.d.ts +11 -0
  208. package/dist/types/TextField/textFieldClasses.d.ts +4 -0
  209. package/dist/types/Tooltip/Tooltip.d.ts +20 -0
  210. package/dist/types/index.d.ts +2 -0
  211. package/dist/types/internal/glyphs.d.ts +1 -0
  212. package/dist/types/internal/hues.d.ts +10 -0
  213. package/dist/types/internal/inputEvent.d.ts +13 -0
  214. package/dist/types/internal/releaseInfo.d.ts +1 -1
  215. package/dist/types/mui/index.d.ts +2 -0
  216. package/dist/types/mui/themeValues.d.ts +106 -0
  217. package/dist/types/parts/Breadcrumb.d.ts +24 -0
  218. package/dist/types/parts/Combobox.d.ts +88 -0
  219. package/dist/types/parts/ContextMenu.d.ts +2 -2
  220. package/dist/types/parts/Menu.d.ts +44 -0
  221. package/dist/types/parts/Select.d.ts +72 -0
  222. package/dist/types/parts/Toast.d.ts +46 -0
  223. package/dist/types/parts/Toolbar.d.ts +47 -0
  224. package/dist/types/parts/Tooltip.d.ts +6 -0
  225. package/dist/types/parts/index.d.ts +95 -4
  226. package/package.json +13 -2
@@ -1,63 +1,144 @@
1
1
  "use client";
2
2
  import { cx as e } from "../internal/cx.js";
3
- import { Divider as t } from "../Divider/Divider2.js";
4
- import { MenuItemHostContext as n } from "../internal/menuItemHost.js";
3
+ import { MenuItemHostContext as t } from "../internal/menuItemHost.js";
4
+ import { Divider as n } from "../Divider/Divider2.js";
5
5
  import { MenuItem as r } from "../MenuItem/MenuItem2.js";
6
+ import { Glyph as i } from "../internal/glyphs.js";
6
7
  /* empty css */
7
- import * as i from "react";
8
- import { jsx as a } from "react/jsx-runtime";
9
- import { Menu as o } from "@base-ui/react/menu";
8
+ import * as a from "react";
9
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
10
+ import { Menu as c } from "@base-ui/react/menu";
10
11
  // src/parts/Menu.tsx
11
- function s(e) {
12
- return /* @__PURE__ */ a(o.Root, { ...e });
12
+ function l(e) {
13
+ return /* @__PURE__ */ o(c.Root, { ...e });
13
14
  }
14
- var c = i.forwardRef(function(e, t) {
15
- return /* @__PURE__ */ a(o.Trigger, {
15
+ var u = a.forwardRef(function(e, t) {
16
+ return /* @__PURE__ */ o(c.Trigger, {
16
17
  ref: t,
17
18
  ...e
18
19
  });
19
- }), l = i.forwardRef(function(t, r) {
20
- let { align: i = "start", children: s, className: c, container: l, keepMounted: u = !1, side: d = "bottom", sideOffset: f = 4, ...p } = t;
21
- return /* @__PURE__ */ a(o.Portal, {
20
+ }), d = a.forwardRef(function(n, r) {
21
+ let { align: i = "start", children: a, className: s, container: l, keepMounted: u = !1, side: d = "bottom", sideOffset: f = 4, ...p } = n;
22
+ return /* @__PURE__ */ o(c.Portal, {
22
23
  keepMounted: u,
23
24
  ...l ? { container: l } : null,
24
- children: /* @__PURE__ */ a(o.Positioner, {
25
+ children: /* @__PURE__ */ o(c.Positioner, {
25
26
  side: d,
26
27
  align: i,
27
28
  sideOffset: f,
28
29
  collisionPadding: 16,
29
30
  className: "CaligoMenu-root",
30
- children: /* @__PURE__ */ a(o.Popup, {
31
+ children: /* @__PURE__ */ o(c.Popup, {
31
32
  ref: r,
32
- className: e("CaligoMenu-paper CaligoMenu-list", c),
33
+ className: e("CaligoMenu-paper CaligoMenu-list", s),
33
34
  ...p,
34
- children: /* @__PURE__ */ a(n.Provider, {
35
+ children: /* @__PURE__ */ o(t.Provider, {
35
36
  value: "menu",
36
- children: s
37
+ children: a
37
38
  })
38
39
  })
39
40
  })
40
41
  });
41
- }), u = i.forwardRef(function(e, t) {
42
+ }), f = a.forwardRef(function(e, t) {
42
43
  let { closeOnClick: n = !0, ...i } = e;
43
- return /* @__PURE__ */ a(r, {
44
+ return /* @__PURE__ */ o(r, {
44
45
  ref: t,
45
46
  closeOnClick: n,
46
47
  ...i
47
48
  });
48
- }), d = i.forwardRef(function(e, t) {
49
- return /* @__PURE__ */ a(o.Group, {
49
+ }), p = a.forwardRef(function(e, t) {
50
+ return /* @__PURE__ */ o(c.Group, {
50
51
  ref: t,
51
52
  ...e
52
53
  });
53
- }), f = i.forwardRef(function(t, n) {
54
+ }), m = a.forwardRef(function(t, n) {
54
55
  let { className: r, ...i } = t;
55
- return /* @__PURE__ */ a(o.GroupLabel, {
56
+ return /* @__PURE__ */ o(c.GroupLabel, {
56
57
  ref: n,
57
58
  className: e("CaligoMenu-label", r),
58
59
  ...i
59
60
  });
61
+ }), h = (t, n, r) => e("CaligoMenuItem-root CaligoMenuItem-gutters", t === "error" && "CaligoMenuItem-colorError", n && "CaligoMenuItem-dense", typeof r == "string" && r), g = ({ children: e }) => e == null ? null : /* @__PURE__ */ o("span", {
62
+ className: "CaligoMenuItem-shortcut",
63
+ children: e
64
+ }), _ = a.forwardRef(function(e, t) {
65
+ let { children: n, className: r, color: a, dense: l, shortcut: u, ...d } = e;
66
+ return /* @__PURE__ */ s(c.CheckboxItem, {
67
+ ref: t,
68
+ className: h(a, l, r),
69
+ ...d,
70
+ children: [
71
+ /* @__PURE__ */ o("span", {
72
+ className: "CaligoMenuItem-mark CaligoMenuItem-markCheckbox",
73
+ "aria-hidden": !0,
74
+ children: /* @__PURE__ */ o(i, { name: "check" })
75
+ }),
76
+ n,
77
+ /* @__PURE__ */ o(g, { children: u })
78
+ ]
79
+ });
80
+ }), v = a.forwardRef(function(e, t) {
81
+ return /* @__PURE__ */ o(c.RadioGroup, {
82
+ ref: t,
83
+ ...e
84
+ });
85
+ }), y = a.forwardRef(function(e, t) {
86
+ let { children: n, className: r, color: i, dense: a, shortcut: l, ...u } = e;
87
+ return /* @__PURE__ */ s(c.RadioItem, {
88
+ ref: t,
89
+ className: h(i, a, r),
90
+ ...u,
91
+ children: [
92
+ /* @__PURE__ */ o("span", {
93
+ className: "CaligoMenuItem-mark CaligoMenuItem-markRadio",
94
+ "aria-hidden": !0
95
+ }),
96
+ n,
97
+ /* @__PURE__ */ o(g, { children: l })
98
+ ]
99
+ });
100
+ }), b = a.forwardRef(function(e, t) {
101
+ let { children: n, className: r, color: a, component: l = "a", dense: u, external: d, href: f, rel: p, shortcut: m, target: _, ...v } = e;
102
+ return /* @__PURE__ */ s(c.Item, {
103
+ ref: t,
104
+ className: h(a, u, r),
105
+ render: /* @__PURE__ */ o(l, {
106
+ href: f,
107
+ target: d ? "_blank" : _,
108
+ rel: d ? "noopener noreferrer" : p
109
+ }),
110
+ ...v,
111
+ children: [n, /* @__PURE__ */ o(g, { children: m ?? (d ? /* @__PURE__ */ o(i, { name: "external-link" }) : void 0) })]
112
+ });
113
+ });
114
+ function x(e) {
115
+ return /* @__PURE__ */ o(c.SubmenuRoot, { ...e });
116
+ }
117
+ var S = a.forwardRef(function(e, t) {
118
+ let { children: n, className: r, dense: a, shortcut: l, ...u } = e;
119
+ return /* @__PURE__ */ s(c.SubmenuTrigger, {
120
+ ref: t,
121
+ className: h("default", a, r),
122
+ ...u,
123
+ children: [
124
+ n,
125
+ /* @__PURE__ */ o(g, { children: l }),
126
+ /* @__PURE__ */ o(i, {
127
+ name: "chevron-right",
128
+ className: "CaligoMenuItem-submenuIcon"
129
+ })
130
+ ]
131
+ });
132
+ }), C = a.forwardRef(function(e, t) {
133
+ let { side: n = "right", align: r = "start", sideOffset: i = 0, ...a } = e;
134
+ return /* @__PURE__ */ o(d, {
135
+ ref: t,
136
+ side: n,
137
+ align: r,
138
+ sideOffset: i,
139
+ ...a
140
+ });
60
141
  });
61
- export { l as Content, d as Group, u as Item, f as Label, s as Root, t as Separator, c as Trigger };
142
+ export { _ as CheckboxItem, d as Content, p as Group, f as Item, m as Label, b as LinkItem, v as RadioGroup, y as RadioItem, l as Root, n as Separator, x as Submenu, C as SubmenuContent, S as SubmenuTrigger, u as Trigger };
62
143
 
63
144
  //# sourceMappingURL=Menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","names":["BaseMenu","React","Root","Menu","props","Trigger","Content","other","container","cx","className","MenuItemHostContext","Item","MenuItem","Group","Label","Divider"],"sources":["../../../src/parts/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as BaseMenu } from '@base-ui/react/menu';\nimport { cx } from '../internal/cx';\nimport { MenuItemHostContext } from '../internal/menuItemHost';\nimport { MenuItem, type MenuItemProps } from '../MenuItem';\nimport type { PartProps, PlacementProps } from './types';\nimport '../Menu/Menu.css';\n\nexport type RootProps = React.ComponentProps<typeof BaseMenu.Root>;\n\n/** Holds whether the menu is open: `open` with `onOpenChange`, or `defaultOpen`. Renders no element. */\nexport function Root(props: RootProps) {\n return <BaseMenu.Root {...props} />;\n}\n\nexport type TriggerProps = PartProps<typeof BaseMenu.Trigger>;\n\n/** Opens the menu, which is anchored to it. A plain button: `render={<Button variant=\"outlined\" />}` gives it Caligo's look. */\nexport const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(function MenuTrigger(props, ref) {\n return <BaseMenu.Trigger ref={ref} {...props} />;\n});\n\nexport interface ContentProps extends PartProps<typeof BaseMenu.Popup>, PlacementProps {}\n\n/** The menu's surface, with the same classes as Caligo's `Menu`. Holds `Item`s, `Separator`s and `Group`s. */\nexport const Content = React.forwardRef<HTMLDivElement, ContentProps>(function MenuContent(props, ref) {\n const { align = 'start', children, className, container, keepMounted = false, side = 'bottom', sideOffset = 4, ...other } = props;\n return (\n <BaseMenu.Portal keepMounted={keepMounted} {...(container ? { container } : null)}>\n <BaseMenu.Positioner side={side} align={align} sideOffset={sideOffset} collisionPadding={16} className=\"CaligoMenu-root\">\n <BaseMenu.Popup ref={ref} className={cx('CaligoMenu-paper CaligoMenu-list', className)} {...other}>\n <MenuItemHostContext.Provider value=\"menu\">{children}</MenuItemHostContext.Provider>\n </BaseMenu.Popup>\n </BaseMenu.Positioner>\n </BaseMenu.Portal>\n );\n});\n\nexport interface ItemProps extends MenuItemProps {\n /**\n * Whether choosing the item closes the menu. Caligo's `MenuItem` inside a `Menu` leaves it open, as\n * Material UI does; an item in a menu made from parts closes it, as shadcn/ui's does.\n * @default true\n */\n closeOnClick?: boolean;\n}\n\n/** One choice: Caligo's `MenuItem`, with its `color`, `dense`, `disabled`, `selected` and `shortcut`. */\nexport const Item = React.forwardRef<HTMLElement, ItemProps>(function MenuPartItem(props, ref) {\n const { closeOnClick = true, ...other } = props;\n return <MenuItem ref={ref} {...({ closeOnClick } as object)} {...other} />;\n});\n\nexport type GroupProps = PartProps<typeof BaseMenu.Group>;\n\n/** Items that belong together. Give it a `Label`, which names the group. */\nexport const Group = React.forwardRef<HTMLDivElement, GroupProps>(function MenuGroup(props, ref) {\n return <BaseMenu.Group ref={ref} {...props} />;\n});\n\nexport type LabelProps = PartProps<typeof BaseMenu.GroupLabel>;\n\n/** A small heading for a `Group`. */\nexport const Label = React.forwardRef<HTMLDivElement, LabelProps>(function MenuLabel(props, ref) {\n const { className, ...other } = props;\n return <BaseMenu.GroupLabel ref={ref} className={cx('CaligoMenu-label', className)} {...other} />;\n});\n\n/** A line between items: Caligo's `Divider`. */\nexport { Divider as Separator } from '../Divider';\n"],"mappings":";;;;;;;;;;AAWA,SAAgBE,EAAK,GAAkB;CACrC,OAAO,kBAACF,EAAS,MAAV,EAAe,GAAII,EAAQ,CAAA;AACpC;AAKA,IAAaC,IAAUJ,EAAM,WAA4C,SAAqB,GAAO,GAAK;CACxG,OAAO,kBAACD,EAAS,SAAV;EAAuB;EAAK,GAAII;CAAQ,CAAA;AACjD,CAAC,GAKYE,IAAUL,EAAM,WAAyC,SAAqB,GAAO,GAAK;CACrG,IAAM,EAAE,WAAQ,SAAS,aAAU,cAAW,cAAW,iBAAc,IAAO,UAAO,UAAU,gBAAa,GAAG,GAAGM,MAAUH;CAC5H,OACE,kBAACJ,EAAS,QAAV;EAA8B;EAAa,GAAKQ,IAAY,EAAE,aAAU,IAAI;EAC1E,UAAA,kBAACR,EAAS,YAAV;GAA2B;GAAa;GAAmB;GAAY,kBAAkB;GAAI,WAAU;GACrG,UAAA,kBAACA,EAAS,OAAV;IAAqB;IAAK,WAAWS,EAAG,oCAAoCC,CAAS;IAAG,GAAIH;IAC1F,UAAA,kBAACI,EAAoB,UAArB;KAA8B,OAAM;KAAQ;IAAuC,CAAA;GACrE,CAAA;EACG,CAAA;CACN,CAAA;AAErB,CAAC,GAYYC,IAAOX,EAAM,WAAmC,SAAsB,GAAO,GAAK;CAC7F,IAAM,EAAE,kBAAe,IAAM,GAAGM,MAAUH;CAC1C,OAAO,kBAACS,GAAD;EAAe;EAAY;EAA2B,GAAIN;CAAQ,CAAA;AAC3E,CAAC,GAKYO,IAAQb,EAAM,WAAuC,SAAmB,GAAO,GAAK;CAC/F,OAAO,kBAACD,EAAS,OAAV;EAAqB;EAAK,GAAII;CAAQ,CAAA;AAC/C,CAAC,GAKYW,IAAQd,EAAM,WAAuC,SAAmB,GAAO,GAAK;CAC/F,IAAM,EAAE,cAAW,GAAGM,MAAUH;CAChC,OAAO,kBAACJ,EAAS,YAAV;EAA0B;EAAK,WAAWS,EAAG,oBAAoBC,CAAS;EAAG,GAAIH;CAAQ,CAAA;AAClG,CAAC"}
1
+ {"version":3,"file":"Menu.js","names":["BaseMenu","React","Root","Menu","props","Trigger","Content","other","container","cx","className","MenuItemHostContext","Item","MenuItem","Group","Label","itemClass","color","dense","Shortcut","children","CheckboxItem","Glyph","shortcut","RadioGroup","RadioItem","LinkItem","Link","external","target","rel","Submenu","SubmenuTrigger","SubmenuContent","Divider"],"sources":["../../../src/parts/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as BaseMenu } from '@base-ui/react/menu';\nimport { cx } from '../internal/cx';\nimport { MenuItemHostContext } from '../internal/menuItemHost';\nimport { MenuItem, type MenuItemProps } from '../MenuItem';\nimport { Glyph } from '../internal/glyphs';\nimport type { PartProps, PlacementProps } from './types';\nimport '../Menu/Menu.css';\n\nexport type RootProps = React.ComponentProps<typeof BaseMenu.Root>;\n\n/** Holds whether the menu is open: `open` with `onOpenChange`, or `defaultOpen`. Renders no element. */\nexport function Root(props: RootProps) {\n return <BaseMenu.Root {...props} />;\n}\n\nexport type TriggerProps = PartProps<typeof BaseMenu.Trigger>;\n\n/** Opens the menu, which is anchored to it. A plain button: `render={<Button variant=\"outlined\" />}` gives it Caligo's look. */\nexport const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(function MenuTrigger(props, ref) {\n return <BaseMenu.Trigger ref={ref} {...props} />;\n});\n\nexport interface ContentProps extends PartProps<typeof BaseMenu.Popup>, PlacementProps {}\n\n/** The menu's surface, with the same classes as Caligo's `Menu`. Holds `Item`s, `Separator`s and `Group`s. */\nexport const Content = React.forwardRef<HTMLDivElement, ContentProps>(function MenuContent(props, ref) {\n const { align = 'start', children, className, container, keepMounted = false, side = 'bottom', sideOffset = 4, ...other } = props;\n return (\n <BaseMenu.Portal keepMounted={keepMounted} {...(container ? { container } : null)}>\n <BaseMenu.Positioner side={side} align={align} sideOffset={sideOffset} collisionPadding={16} className=\"CaligoMenu-root\">\n <BaseMenu.Popup ref={ref} className={cx('CaligoMenu-paper CaligoMenu-list', className)} {...other}>\n <MenuItemHostContext.Provider value=\"menu\">{children}</MenuItemHostContext.Provider>\n </BaseMenu.Popup>\n </BaseMenu.Positioner>\n </BaseMenu.Portal>\n );\n});\n\nexport interface ItemProps extends MenuItemProps {\n /**\n * Whether choosing the item closes the menu. Caligo's `MenuItem` inside a `Menu` leaves it open, as\n * Material UI does; an item in a menu made from parts closes it, as shadcn/ui's does.\n * @default true\n */\n closeOnClick?: boolean;\n}\n\n/** One choice: Caligo's `MenuItem`, with its `color`, `dense`, `disabled`, `selected` and `shortcut`. */\nexport const Item = React.forwardRef<HTMLElement, ItemProps>(function MenuPartItem(props, ref) {\n const { closeOnClick = true, ...other } = props;\n return <MenuItem ref={ref} {...({ closeOnClick } as object)} {...other} />;\n});\n\nexport type GroupProps = PartProps<typeof BaseMenu.Group>;\n\n/** Items that belong together. Give it a `Label`, which names the group. */\nexport const Group = React.forwardRef<HTMLDivElement, GroupProps>(function MenuGroup(props, ref) {\n return <BaseMenu.Group ref={ref} {...props} />;\n});\n\nexport type LabelProps = PartProps<typeof BaseMenu.GroupLabel>;\n\n/** A small heading for a `Group`. */\nexport const Label = React.forwardRef<HTMLDivElement, LabelProps>(function MenuLabel(props, ref) {\n const { className, ...other } = props;\n return <BaseMenu.GroupLabel ref={ref} className={cx('CaligoMenu-label', className)} {...other} />;\n});\n\n/** A line between items: Caligo's `Divider`. */\nexport { Divider as Separator } from '../Divider';\n\n/** The classes of Caligo's `MenuItem`, for the item kinds below, which Base UI renders. */\nconst itemClass = (color: 'default' | 'error' | undefined, dense: boolean | undefined, className: unknown) =>\n cx('CaligoMenuItem-root CaligoMenuItem-gutters', color === 'error' && 'CaligoMenuItem-colorError', dense && 'CaligoMenuItem-dense', typeof className === 'string' && className);\n\ninterface ItemLookProps {\n /** `error` for a destructive item. @default 'default' */\n color?: 'default' | 'error';\n /** A smaller row. */\n dense?: boolean;\n /** Trailing text, such as a keyboard shortcut. */\n shortcut?: React.ReactNode;\n}\n\nconst Shortcut = ({ children }: { children?: React.ReactNode }) => (children == null ? null : <span className=\"CaligoMenuItem-shortcut\">{children}</span>);\n\nexport interface CheckboxItemProps extends Omit<PartProps<typeof BaseMenu.CheckboxItem>, 'color'>, ItemLookProps {}\n\n/**\n * An item that turns a setting on and off, with a check box drawn before its label. `checked` with\n * `onCheckedChange`, or `defaultChecked`. Choosing it leaves the menu open.\n */\nexport const CheckboxItem = React.forwardRef<HTMLDivElement, CheckboxItemProps>(function MenuCheckboxItem(props, ref) {\n const { children, className, color, dense, shortcut, ...other } = props;\n return (\n <BaseMenu.CheckboxItem ref={ref} className={itemClass(color, dense, className)} {...other}>\n <span className=\"CaligoMenuItem-mark CaligoMenuItem-markCheckbox\" aria-hidden><Glyph name=\"check\" /></span>\n {children}\n <Shortcut>{shortcut}</Shortcut>\n </BaseMenu.CheckboxItem>\n );\n});\n\nexport type RadioGroupProps = PartProps<typeof BaseMenu.RadioGroup>;\n\n/** Radio items of which one is chosen: `value` with `onValueChange`, or `defaultValue`. */\nexport const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(function MenuRadioGroup(props, ref) {\n return <BaseMenu.RadioGroup ref={ref} {...props} />;\n});\n\nexport interface RadioItemProps extends Omit<PartProps<typeof BaseMenu.RadioItem>, 'color'>, ItemLookProps {}\n\n/** One choice in a `RadioGroup`, with a radio mark before its label. Choosing it leaves the menu open. */\nexport const RadioItem = React.forwardRef<HTMLDivElement, RadioItemProps>(function MenuRadioItem(props, ref) {\n const { children, className, color, dense, shortcut, ...other } = props;\n return (\n <BaseMenu.RadioItem ref={ref} className={itemClass(color, dense, className)} {...other}>\n <span className=\"CaligoMenuItem-mark CaligoMenuItem-markRadio\" aria-hidden />\n {children}\n <Shortcut>{shortcut}</Shortcut>\n </BaseMenu.RadioItem>\n );\n});\n\nexport interface LinkItemProps extends Omit<PartProps<typeof BaseMenu.Item>, 'color' | 'render'>, ItemLookProps {\n href: string;\n /** Opens in a new tab, with `rel=\"noopener noreferrer\"` and an external-link mark. */\n external?: boolean;\n target?: string;\n rel?: string;\n /** Your router's link, such as Next.js's `Link`: it gets `href` and the item's props. @default 'a' */\n component?: React.ElementType;\n}\n\n/** An item that goes somewhere: a link, which the keyboard and a middle click treat as one. */\nexport const LinkItem = React.forwardRef<HTMLElement, LinkItemProps>(function MenuLinkItem(props, ref) {\n const { children, className, color, component: Link = 'a', dense, external, href, rel, shortcut, target, ...other } = props;\n return (\n <BaseMenu.Item\n ref={ref as React.Ref<HTMLDivElement>}\n className={itemClass(color, dense, className)}\n render={<Link href={href} target={external ? '_blank' : target} rel={external ? 'noopener noreferrer' : rel} />}\n {...other}\n >\n {children}\n <Shortcut>{shortcut ?? (external ? <Glyph name=\"external-link\" /> : undefined)}</Shortcut>\n </BaseMenu.Item>\n );\n});\n\nexport type SubmenuProps = React.ComponentProps<typeof BaseMenu.SubmenuRoot>;\n\n/** A menu inside a menu: holds a `SubmenuTrigger` and a `SubmenuContent`. Renders no element. */\nexport function Submenu(props: SubmenuProps) {\n return <BaseMenu.SubmenuRoot {...props} />;\n}\n\nexport interface SubmenuTriggerProps extends Omit<PartProps<typeof BaseMenu.SubmenuTrigger>, 'color'>, Omit<ItemLookProps, 'color'> {}\n\n/** The item that opens a submenu, on hover, a click or the right arrow key. It carries a chevron. */\nexport const SubmenuTrigger = React.forwardRef<HTMLDivElement, SubmenuTriggerProps>(function MenuSubmenuTrigger(props, ref) {\n const { children, className, dense, shortcut, ...other } = props;\n return (\n <BaseMenu.SubmenuTrigger ref={ref} className={itemClass('default', dense, className)} {...other}>\n {children}\n <Shortcut>{shortcut}</Shortcut>\n <Glyph name=\"chevron-right\" className=\"CaligoMenuItem-submenuIcon\" />\n </BaseMenu.SubmenuTrigger>\n );\n});\n\n/** A submenu's surface: `Content`, opened beside its trigger. */\nexport const SubmenuContent = React.forwardRef<HTMLDivElement, ContentProps>(function MenuSubmenuContent(props, ref) {\n const { side = 'right', align = 'start', sideOffset = 0, ...other } = props;\n return <Content ref={ref} side={side} align={align} sideOffset={sideOffset} {...other} />;\n});\n"],"mappings":";;;;;;;;;;;AAYA,SAAgBE,EAAK,GAAkB;CACrC,OAAO,kBAACF,EAAS,MAAV,EAAe,GAAII,EAAQ,CAAA;AACpC;AAKA,IAAaC,IAAUJ,EAAM,WAA4C,SAAqB,GAAO,GAAK;CACxG,OAAO,kBAACD,EAAS,SAAV;EAAuB;EAAK,GAAII;CAAQ,CAAA;AACjD,CAAC,GAKYE,IAAUL,EAAM,WAAyC,SAAqB,GAAO,GAAK;CACrG,IAAM,EAAE,WAAQ,SAAS,aAAU,cAAW,cAAW,iBAAc,IAAO,UAAO,U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;AAKD,SAAgBS,EAAQ,GAAqB;CAC3C,OAAO,kBAAC/B,EAAS,aAAV,EAAsB,GAAII,EAAQ,CAAA;AAC3C;AAKA,IAAa4B,IAAiB/B,EAAM,WAAgD,SAA4B,GAAO,GAAK;CAC1H,IAAM,EAAE,aAAU,cAAW,UAAO,aAAU,GAAGM,MAAUH;CAC3D,OACE,kBAACJ,EAAS,gBAAV;EAA8B;EAAK,WAAWgB,EAAU,WAAWE,GAAOR,CAAS;EAAG,GAAIH;EAA1F,UAAA;GACGa;GACD,kBAACD,GAAD,EAAA,UAAWI,EAAmB,CAAA;GAC9B,kBAACD,GAAD;IAAO,MAAK;IAAgB,WAAU;GAA8B,CAAA;EAC7C;;AAE7B,CAAC,GAGYW,IAAiBhC,EAAM,WAAyC,SAA4B,GAAO,GAAK;CACnH,IAAM,EAAE,UAAO,SAAS,WAAQ,SAAS,gBAAa,GAAG,GAAGM,MAAUH;CACtE,OAAO,kBAACE,GAAD;EAAc;EAAW;EAAa;EAAmB;EAAY,GAAIC;CAAQ,CAAA;AAC1F,CAAC"}
@@ -0,0 +1,120 @@
1
+ "use client";
2
+ import { capitalize as e } from "../internal/classes.js";
3
+ import { cx as t } from "../internal/cx.js";
4
+ import { Glyph as n } from "../internal/glyphs.js";
5
+ /* empty css */
6
+ /* empty css */
7
+ /* empty css */
8
+ /* empty css */
9
+ import * as r from "react";
10
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
11
+ import { Select as s } from "@base-ui/react/select";
12
+ // src/parts/Select.tsx
13
+ function c(e) {
14
+ return /* @__PURE__ */ a(s.Root, { ...e });
15
+ }
16
+ var l = r.forwardRef(function(n, r) {
17
+ let { children: c, className: l, error: f, fullWidth: p, size: m = "medium", variant: h = "outlined", ...g } = n;
18
+ return /* @__PURE__ */ a("span", {
19
+ className: t("CaligoTextField-root", `CaligoTextField-${h}`, `CaligoTextField-size${e(m)}`, p && "CaligoTextField-fullWidth", f && "Caligo-error"),
20
+ children: /* @__PURE__ */ a(s.Trigger, {
21
+ ref: r,
22
+ "aria-invalid": f || void 0,
23
+ className: t("CaligoTextField-inputRoot CaligoSelect-select", f && "Caligo-error", l),
24
+ ...g,
25
+ children: c ?? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(u, {}), /* @__PURE__ */ a(d, {})] })
26
+ })
27
+ });
28
+ }), u = r.forwardRef(function(e, n) {
29
+ let { className: r, ...i } = e;
30
+ return /* @__PURE__ */ a(s.Value, {
31
+ ref: n,
32
+ className: t("CaligoSelect-value", r),
33
+ ...i
34
+ });
35
+ }), d = r.forwardRef(function(e, r) {
36
+ let { className: i, children: o, ...c } = e;
37
+ return /* @__PURE__ */ a(s.Icon, {
38
+ ref: r,
39
+ className: t("CaligoSelect-icon", i),
40
+ ...c,
41
+ children: o ?? /* @__PURE__ */ a(n, { name: "chevron-down" })
42
+ });
43
+ }), f = r.forwardRef(function(e, n) {
44
+ let { align: r = "start", anchor: i, children: o, className: c, container: l, side: u = "bottom", sideOffset: d = 4, style: f, ...p } = e;
45
+ return /* @__PURE__ */ a(s.Portal, {
46
+ ...l ? { container: l } : null,
47
+ children: /* @__PURE__ */ a(s.Positioner, {
48
+ ...i ? { anchor: i } : null,
49
+ side: u,
50
+ align: r,
51
+ sideOffset: d,
52
+ alignItemWithTrigger: !1,
53
+ collisionPadding: 16,
54
+ className: "CaligoMenu-root CaligoSelect-popper",
55
+ children: /* @__PURE__ */ a(s.Popup, {
56
+ ref: n,
57
+ className: t("CaligoMenu-paper CaligoSelect-paper", c),
58
+ style: {
59
+ minWidth: "var(--anchor-width)",
60
+ ...f
61
+ },
62
+ ...p,
63
+ children: /* @__PURE__ */ a(s.List, { children: o })
64
+ })
65
+ })
66
+ });
67
+ }), p = r.forwardRef(function(e, r) {
68
+ let { children: i, className: c, dense: l, description: u, icon: d, shortcut: f, ...p } = e, m = /* @__PURE__ */ a(s.ItemText, {
69
+ render: /* @__PURE__ */ a("span", { className: "CaligoMenuItem-text CaligoSelect-optionLabel" }),
70
+ children: i
71
+ });
72
+ return /* @__PURE__ */ o(s.Item, {
73
+ ref: r,
74
+ className: t("CaligoMenuItem-root CaligoMenuItem-gutters CaligoSelect-option", l && "CaligoMenuItem-dense", c),
75
+ ...p,
76
+ children: [
77
+ d != null && /* @__PURE__ */ a("span", {
78
+ className: "CaligoSelect-optionIcon",
79
+ children: d
80
+ }),
81
+ u == null ? m : /* @__PURE__ */ o("span", {
82
+ className: "CaligoSelect-optionText",
83
+ children: [m, /* @__PURE__ */ a("span", {
84
+ className: "CaligoSelect-optionDescription",
85
+ children: u
86
+ })]
87
+ }),
88
+ f != null && /* @__PURE__ */ a("span", {
89
+ className: "CaligoMenuItem-shortcut",
90
+ children: f
91
+ }),
92
+ /* @__PURE__ */ a(s.ItemIndicator, {
93
+ render: /* @__PURE__ */ a("span", { className: "CaligoSelect-check" }),
94
+ children: /* @__PURE__ */ a(n, { name: "check" })
95
+ })
96
+ ]
97
+ });
98
+ }), m = r.forwardRef(function(e, t) {
99
+ return /* @__PURE__ */ a(s.Group, {
100
+ ref: t,
101
+ ...e
102
+ });
103
+ }), h = r.forwardRef(function(e, n) {
104
+ let { className: r, ...i } = e;
105
+ return /* @__PURE__ */ a(s.GroupLabel, {
106
+ ref: n,
107
+ className: t("CaligoMenu-label", r),
108
+ ...i
109
+ });
110
+ }), g = r.forwardRef(function(e, n) {
111
+ let { className: r, ...i } = e;
112
+ return /* @__PURE__ */ a(s.Separator, {
113
+ ref: n,
114
+ className: t("CaligoDivider-root CaligoSelect-separator", r),
115
+ ...i
116
+ });
117
+ });
118
+ export { f as Content, m as Group, d as Icon, p as Item, h as Label, c as Root, g as Separator, l as Trigger, u as Value };
119
+
120
+ //# sourceMappingURL=Select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.js","names":["BaseSelect","_Fragment","React","Root","Select","props","Trigger","other","cx","variant","capitalize","size","fullWidth","error","className","children","Fragment","Value","Icon","Glyph","Content","container","anchor","style","Item","text","dense","icon","description","shortcut","Group","Label","Separator"],"sources":["../../../src/parts/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Select as BaseSelect } from '@base-ui/react/select';\nimport { capitalize } from '../internal/classes';\nimport { cx } from '../internal/cx';\nimport { Glyph } from '../internal/glyphs';\nimport type { PartProps, PlacementProps } from './types';\nimport '../TextField/TextField.css';\nimport '../Menu/Menu.css';\nimport '../MenuItem/MenuItem.css';\nimport '../Select/Select.css';\n\nexport type RootProps<Value = unknown, Multiple extends boolean | undefined = false> = React.ComponentProps<typeof BaseSelect.Root<Value, Multiple>>;\n\n/**\n * Holds the value (`value` with `onValueChange`, or `defaultValue`; `multiple` for several) and whether it is open.\n * Give it `items` (`[{ value, label }]` or `{ value: label }`) so `Value` shows the chosen item's label rather than its\n * value. Renders no element.\n */\nexport function Root<Value, Multiple extends boolean | undefined = false>(props: RootProps<Value, Multiple>) {\n return <BaseSelect.Root {...props} />;\n}\n\nexport interface TriggerProps extends PartProps<typeof BaseSelect.Trigger> {\n /** The field's look, as on TextField, or `ghost` (no edge until hover), as on InputBase. @default 'outlined' */\n variant?: 'outlined' | 'filled' | 'standard' | 'ghost';\n /** The field's height, as on TextField. @default 'medium' */\n size?: 'xsmall' | 'small' | 'medium' | 'large';\n /** Takes the width of its container. */\n fullWidth?: boolean;\n /** Draws the field in the error colour. */\n error?: boolean;\n}\n\n/**\n * The field that opens the list: Caligo's field box (the same classes as `Select` and `TextField`). With no children it\n * shows `Value` and the chevron; pass your own children to lay it out yourself.\n */\nexport const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(function SelectTrigger(props, ref) {\n const { children, className, error, fullWidth, size = 'medium', variant = 'outlined', ...other } = props;\n return (\n <span className={cx('CaligoTextField-root', `CaligoTextField-${variant}`, `CaligoTextField-size${capitalize(size)}`, fullWidth && 'CaligoTextField-fullWidth', error && 'Caligo-error')}>\n <BaseSelect.Trigger ref={ref} aria-invalid={error || undefined} className={cx('CaligoTextField-inputRoot CaligoSelect-select', error && 'Caligo-error', className)} {...other}>\n {children ?? (\n <>\n <Value />\n <Icon />\n </>\n )}\n </BaseSelect.Trigger>\n </span>\n );\n});\n\nexport type ValueProps = PartProps<typeof BaseSelect.Value>;\n\n/** The chosen item's text, or `placeholder` (drawn in the placeholder colour) while nothing is chosen. */\nexport const Value = React.forwardRef<HTMLSpanElement, ValueProps>(function SelectValue(props, ref) {\n const { className, ...other } = props;\n return <BaseSelect.Value ref={ref} className={cx('CaligoSelect-value', className)} {...other} />;\n});\n\n/** The chevron at the end of the trigger. */\nexport const Icon = React.forwardRef<HTMLSpanElement, PartProps<typeof BaseSelect.Icon>>(function SelectIcon(props, ref) {\n const { className, children, ...other } = props;\n return <BaseSelect.Icon ref={ref} className={cx('CaligoSelect-icon', className)} {...other}>{children ?? <Glyph name=\"chevron-down\" />}</BaseSelect.Icon>;\n});\n\nexport interface ContentProps extends PartProps<typeof BaseSelect.Popup>, Omit<PlacementProps, 'keepMounted'> {\n /** What the list lines up with, if not the trigger: an element, a ref to one, or a virtual element. */\n anchor?: React.ComponentProps<typeof BaseSelect.Positioner>['anchor'];\n}\n\n/** The list's surface, at least as wide as the trigger: the same classes as `Select`'s. Holds `Item`s, `Group`s and `Separator`s. */\nexport const Content = React.forwardRef<HTMLDivElement, ContentProps>(function SelectContent(props, ref) {\n const { align = 'start', anchor, children, className, container, side = 'bottom', sideOffset = 4, style, ...other } = props;\n return (\n <BaseSelect.Portal {...(container ? { container } : null)}>\n <BaseSelect.Positioner {...(anchor ? { anchor } : null)} side={side} align={align} sideOffset={sideOffset} alignItemWithTrigger={false} collisionPadding={16} className=\"CaligoMenu-root CaligoSelect-popper\">\n <BaseSelect.Popup ref={ref} className={cx('CaligoMenu-paper CaligoSelect-paper', className)} style={{ minWidth: 'var(--anchor-width)', ...style }} {...other}>\n <BaseSelect.List>{children}</BaseSelect.List>\n </BaseSelect.Popup>\n </BaseSelect.Positioner>\n </BaseSelect.Portal>\n );\n});\n\nexport interface ItemProps extends PartProps<typeof BaseSelect.Item> {\n /** Trailing text, such as a count. */\n shortcut?: React.ReactNode;\n /** A smaller row. */\n dense?: boolean;\n /** An icon or avatar before the label. */\n icon?: React.ReactNode;\n /** A second line under the label. Not part of the item's text, so the chosen value doesn't show it. */\n description?: React.ReactNode;\n}\n\n/**\n * One option: a `MenuItem` row with a check on the chosen one (a check box before each label when the select is\n * `multiple`). Give it `value`, and `label` when its children aren't plain text.\n */\nexport const Item = React.forwardRef<HTMLDivElement, ItemProps>(function SelectItem(props, ref) {\n const { children, className, dense, description, icon, shortcut, ...other } = props;\n const text = <BaseSelect.ItemText render={<span className=\"CaligoMenuItem-text CaligoSelect-optionLabel\" />}>{children}</BaseSelect.ItemText>;\n return (\n <BaseSelect.Item ref={ref} className={cx('CaligoMenuItem-root CaligoMenuItem-gutters CaligoSelect-option', dense && 'CaligoMenuItem-dense', className)} {...other}>\n {icon != null && <span className=\"CaligoSelect-optionIcon\">{icon}</span>}\n {description != null ? <span className=\"CaligoSelect-optionText\">{text}<span className=\"CaligoSelect-optionDescription\">{description}</span></span> : text}\n {shortcut != null && <span className=\"CaligoMenuItem-shortcut\">{shortcut}</span>}\n <BaseSelect.ItemIndicator render={<span className=\"CaligoSelect-check\" />}><Glyph name=\"check\" /></BaseSelect.ItemIndicator>\n </BaseSelect.Item>\n );\n});\n\nexport type GroupProps = PartProps<typeof BaseSelect.Group>;\n\n/** Options that belong together. Give it a `Label`. */\nexport const Group = React.forwardRef<HTMLDivElement, GroupProps>(function SelectGroup(props, ref) {\n return <BaseSelect.Group ref={ref} {...props} />;\n});\n\n/** A small heading for a `Group`. */\nexport const Label = React.forwardRef<HTMLDivElement, PartProps<typeof BaseSelect.GroupLabel>>(function SelectLabel(props, ref) {\n const { className, ...other } = props;\n return <BaseSelect.GroupLabel ref={ref} className={cx('CaligoMenu-label', className)} {...other} />;\n});\n\n/** A line between options. */\nexport const Separator = React.forwardRef<HTMLDivElement, PartProps<typeof BaseSelect.Separator>>(function SelectSeparator(props, ref) {\n const { className, ...other } =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,kBAAC7B,EAAW,eAAZ;IAA0B,QAAQ,kBAAC,QAAD,EAAM,WAAU,qBAAsB,CAAA;IAAG,UAAA,kBAACmB,GAAD,EAAO,MAAK,QAAS,CAAA;GAA2B,CAAA;EAC5G;;AAErB,CAAC,GAKYW,IAAQ5B,EAAM,WAAuC,SAAqB,GAAO,GAAK;CACjG,OAAO,kBAACF,EAAW,OAAZ;EAAuB;EAAK,GAAIK;CAAQ,CAAA;AACjD,CAAC,GAGY0B,IAAQ7B,EAAM,WAAoE,SAAqB,GAAO,GAAK;CAC9H,IAAM,EAAE,cAAW,GAAGK,MAAUF;CAChC,OAAO,kBAACL,EAAW,YAAZ;EAA4B;EAAK,WAAWQ,EAAG,oBAAoBM,CAAS;EAAG,GAAIP;CAAQ,CAAA;AACpG,CAAC,GAGYyB,IAAY9B,EAAM,WAAmE,SAAyB,GAAO,GAAK;CACrI,IAAM,EAAE,cAAW,GAAGK,MAAUF;CAChC,OAAO,kBAACL,EAAW,WAAZ;EAA2B;EAAK,WAAWQ,EAAG,6CAA6CM,CAAS;EAAG,GAAIP;CAAQ,CAAA;AAC5H,CAAC"}
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { cx as e } from "../internal/cx.js";
3
+ import { Glyph as t } from "../internal/glyphs.js";
4
+ import { Alert as n } from "../Alert/Alert2.js";
5
+ import { Button as r } from "../Button/Button2.js";
6
+ import { CircularProgress as i } from "../CircularProgress/CircularProgress2.js";
7
+ import { IconButton as a } from "../IconButton/IconButton2.js";
8
+ /* empty css */
9
+ import * as o from "react";
10
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
11
+ import { Toast as l } from "@base-ui/react/toast";
12
+ // src/parts/Toast.tsx
13
+ var u = l.Provider, d = l.useToastManager, f = l.createToastManager, p = o.forwardRef(function(t, n) {
14
+ let { className: r, container: i, position: a = "bottom-end", ...o } = t;
15
+ return /* @__PURE__ */ s(l.Portal, {
16
+ ...i ? { container: i } : null,
17
+ children: /* @__PURE__ */ s(l.Viewport, {
18
+ ref: n,
19
+ "data-position": a,
20
+ className: e("CaligoToast-viewport", r),
21
+ ...o
22
+ })
23
+ });
24
+ }), m = o.forwardRef(function(t, n) {
25
+ let { className: r, ...i } = t;
26
+ return /* @__PURE__ */ s(l.Root, {
27
+ ref: n,
28
+ className: e("CaligoToast-root", r),
29
+ ...i
30
+ });
31
+ }), h = o.forwardRef(function(e, t) {
32
+ return /* @__PURE__ */ s(l.Title, {
33
+ ref: t,
34
+ render: /* @__PURE__ */ s("span", {}),
35
+ ...e
36
+ });
37
+ }), g = o.forwardRef(function(e, t) {
38
+ return /* @__PURE__ */ s(l.Description, {
39
+ ref: t,
40
+ render: /* @__PURE__ */ s("span", {}),
41
+ ...e
42
+ });
43
+ }), _ = o.forwardRef(function(e, t) {
44
+ return /* @__PURE__ */ s(l.Action, {
45
+ ref: t,
46
+ render: /* @__PURE__ */ s(r, {
47
+ variant: "text",
48
+ color: "inherit",
49
+ size: "xsmall"
50
+ }),
51
+ ...e
52
+ });
53
+ }), v = o.forwardRef(function(e, n) {
54
+ let { children: r, ...i } = e;
55
+ return /* @__PURE__ */ s(l.Close, {
56
+ ref: n,
57
+ "aria-label": "Close",
58
+ render: /* @__PURE__ */ s(a, { size: "xsmall" }),
59
+ ...i,
60
+ children: r ?? /* @__PURE__ */ s(t, { name: "x" })
61
+ });
62
+ }), y = {
63
+ success: "success",
64
+ info: "info",
65
+ warning: "warning",
66
+ error: "error",
67
+ danger: "error"
68
+ };
69
+ function b(e) {
70
+ let { variant: t = "outlined", ...r } = e, { toasts: a } = l.useToastManager();
71
+ return /* @__PURE__ */ s(p, {
72
+ ...r,
73
+ children: a.map((e) => {
74
+ let r = e.type === "loading";
75
+ return /* @__PURE__ */ s(m, {
76
+ toast: e,
77
+ children: /* @__PURE__ */ s(n, {
78
+ role: "presentation",
79
+ severity: y[e.type ?? ""] ?? "info",
80
+ variant: t,
81
+ icon: r ? /* @__PURE__ */ s(i, { size: 16 }) : void 0,
82
+ title: e.title == null ? void 0 : /* @__PURE__ */ s(h, {}),
83
+ action: /* @__PURE__ */ c("span", {
84
+ className: "CaligoToast-actions",
85
+ children: [e.actionProps && /* @__PURE__ */ s(_, {}), /* @__PURE__ */ s(v, {})]
86
+ }),
87
+ children: e.description != null && /* @__PURE__ */ s(g, {})
88
+ })
89
+ }, e.id);
90
+ })
91
+ });
92
+ }
93
+ export { _ as Action, v as Close, g as Description, u as Provider, m as Root, h as Title, b as Toaster, p as Viewport, f as createToastManager, d as useToastManager };
94
+
95
+ //# sourceMappingURL=Toast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.js","names":["BaseToast","React","Provider","Toast","useToastManager","createToastManager","Viewport","other","props","container","position","cx","className","Root","Title","Description","Action","Button","Close","IconButton","children","Glyph","SEVERITY","Toaster","viewport","toasts","loading","toast","Alert","CircularProgress"],"sources":["../../../src/parts/Toast.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Toast as BaseToast } from '@base-ui/react/toast';\nimport { cx } from '../internal/cx';\nimport { Glyph } from '../internal/glyphs';\nimport { Alert } from '../Alert';\nimport { Button } from '../Button';\nimport { CircularProgress } from '../CircularProgress';\nimport { IconButton } from '../IconButton';\nimport type { PartProps } from './types';\nimport '../Snackbar/Snackbar.css';\n\n/*\n * A managed toast queue: toasts stack, time out, pause on hover, swipe away and are announced, and a promise can drive\n * one from loading to done. Base UI's Toast, each toast drawn as Caligo's outlined Alert. Put a `Provider` around the\n * app and a `Toaster` in it, then add toasts with `useToastManager().add({ title, description, type })`, or from\n * outside React with a manager from `createToastManager()` passed to the Provider.\n */\n\n/** Holds the queue: `limit` (3), `timeout` (5000ms), and `toastManager` for a manager made outside React. */\nexport const Provider = BaseToast.Provider;\n\n/** Adds, updates and closes toasts: `{ add, update, close, promise, toasts }`. Call it inside a `Provider`. */\nexport const useToastManager = BaseToast.useToastManager;\n\n/** A manager for adding toasts from outside React (an API client, a store). Pass it to `Provider`'s `toastManager`. */\nexport const createToastManager = BaseToast.createToastManager;\n\nexport interface ViewportProps extends PartProps<typeof BaseToast.Viewport> {\n /** Where the stack sits. @default 'bottom-end' */\n position?: 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';\n container?: HTMLElement | null;\n}\n\n/** The fixed area toasts stack in, and the live region that announces them. For your own toasts; `Toaster` includes one. */\nexport const Viewport = React.forwardRef<HTMLDivElement, ViewportProps>(function ToastViewport(props, ref) {\n const { className, container, position = 'bottom-end', ...other } = props;\n return (\n <BaseToast.Portal {...(container ? { container } : null)}>\n <BaseToast.Viewport ref={ref} data-position={position} className={cx('CaligoToast-viewport', className)} {...other} />\n </BaseToast.Portal>\n );\n});\n\n/** One toast, for a list you draw yourself: `toast` is an item of `useToastManager().toasts`. */\nexport const Root = React.forwardRef<HTMLDivElement, PartProps<typeof BaseToast.Root>>(function ToastRoot(props, ref) {\n const { className, ...other } = props;\n return <BaseToast.Root ref={ref} className={cx('CaligoToast-root', className)} {...other} />;\n});\n\n/** The toast's title: Alert's title type, not a page heading. */\nexport const Title = React.forwardRef<HTMLElement, PartProps<typeof BaseToast.Title>>(function ToastTitle(props, ref) {\n return <BaseToast.Title ref={ref as React.Ref<HTMLHeadingElement>} render={<span />} {...props} />;\n});\n/** The toast's text. */\nexport const Description = React.forwardRef<HTMLElement, PartProps<typeof BaseToast.Description>>(function ToastDescription(props, ref) {\n return <BaseToast.Description ref={ref as React.Ref<HTMLParagraphElement>} render={<span />} {...props} />;\n});\n\n/** A button in the toast (Undo, View): a small text button. */\nexport const Action = React.forwardRef<HTMLButtonElement, PartProps<typeof BaseToast.Action>>(function ToastAction(props, ref) {\n return <BaseToast.Action ref={ref} render={<Button variant=\"text\" color=\"inherit\" size=\"xsmall\" />} {...props} />;\n});\n\n/** Closes the toast: a small icon button. */\nexport const Close = React.forwardRef<HTMLButtonElement, PartProps<typeof BaseToast.Close>>(function ToastClose(props, ref) {\n const { children, ...other } = props;\n return <BaseToast.Close ref={ref} aria-label=\"Close\" render={<IconButton size=\"xsmall\" />} {...other}>{children ?? <Glyph name=\"x\" />}</BaseToast.Close>;\n});\n\nconst SEVERITY: Record<string, 'success' | 'info' | 'warning' | 'error'> = { success: 'success', info: 'info', warning: 'warning', error: 'error', danger: 'error' };\n\nexport interface ToasterProps extends Omit<ViewportProps, 'children'> {\n /** The look of each toast, as on Alert. @default 'outlined' */\n variant?: 'standard' | 'outlined' | 'filled';\n}\n\n/**\n * The ready-made stack: every toast in the queue drawn as an Alert, its `type` (`success`, `info`, `warning`, `error`,\n * `loading`) as the severity, with its `actionProps` as a button and a close button.\n */\nexport function Toaster(props: ToasterProps) {\n const { variant = 'outlined', ...viewport } = props;\n const { toasts } = BaseToast.useToastManager();\n return (\n <Viewport {...viewport}>\n {toasts.map((toast) => {\n const loading = toast.type === 'loading';\n return (\n <Root key={toast.id} toast={toast}>\n <Alert\n role=\"presentation\"\n severity={SEVERITY[toast.type ?? ''] ?? 'info'}\n variant={variant}\n icon={loading ? <CircularProgress size={16} /> : undefined}\n title={toast.title != null ? <Title /> : undefined}\n action={\n <span className=\"CaligoToast-actions\">\n {toast.actionProps && <Action />}\n <Close />\n </span>\n }\n >\n {toast.description != null && <Description />}\n </Alert>\n </Root>\n );\n })}\n </Viewport>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAaE,IAAWF,EAAU,UAGrBI,IAAkBJ,EAAU,iBAG5BK,IAAqBL,EAAU,oBAS/BM,IAAWL,EAAM,WAA0C,SAAuB,GAAO,GAAK;CACzG,IAAM,EAAE,cAAW,cAAW,cAAW,cAAc,GAAGM,MAAUC;CACpE,OACE,kBAACR,EAAU,QAAX;EAAkB,GAAKS,IAAY,EAAE,aAAU,IAAI;EACjD,UAAA,kBAACT,EAAU,UAAX;GAAyB;GAAK,iBAAeU;GAAU,WAAWC,EAAG,wBAAwBC,CAAS;GAAG,GAAIL;EAAQ,CAAA;CACrG,CAAA;AAEtB,CAAC,GAGYM,IAAOZ,EAAM,WAA6D,SAAmB,GAAO,GAA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AAK,MAAU;GACrB,IAAMC,IAAUC,EAAM,SAAS;GAC/B,OACE,kBAACd,GAAD;IAA4B;IAC1B,UAAA,kBAACe,GAAD;KACE,MAAK;KACL,UAAUN,EAASK,EAAM,QAAQ,OAAO;KAC/B;KACT,MAAMD,IAAU,kBAACG,GAAD,EAAkB,MAAM,GAAK,CAAA,IAAI,KAAA;KACjD,OAAOF,EAAM,SAAS,OAAmB,KAAA,IAAZ,kBAACb,GAAD,CAAQ,CAAA;KACrC,QACE,kBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACGa,EAAM,eAAe,kBAACX,GAAD,CAAS,CAAA,GAC/B,kBAACE,GAAD,CAAQ,CAAA,CACJ;;KAGP,UAAAS,EAAM,eAAe,QAAQ,kBAACZ,GAAD,CAAc,CAAA;IACvC,CAAA;GACH,GAhBKY,EAAM,EAgBX;EAEV,CAAC;CACO,CAAA;AAEd"}
@@ -0,0 +1,100 @@
1
+ "use client";
2
+ import { cx as e } from "../internal/cx.js";
3
+ import { Button as t } from "../Button/Button2.js";
4
+ import { IconButton as n } from "../IconButton/IconButton2.js";
5
+ import { Divider as r } from "../Divider/Divider2.js";
6
+ /* empty css */
7
+ import * as i from "react";
8
+ import { jsx as a } from "react/jsx-runtime";
9
+ import { Toolbar as o } from "@base-ui/react/toolbar";
10
+ import { Toggle as s } from "@base-ui/react/toggle";
11
+ // src/parts/Toolbar.tsx
12
+ var c = i.forwardRef(function(t, n) {
13
+ let { className: r, elevation: i = "flat", orientation: s = "horizontal", ...c } = t;
14
+ return /* @__PURE__ */ a(o.Root, {
15
+ ref: n,
16
+ orientation: s,
17
+ className: e("CaligoToolbar-root CaligoToolbar-grouped CaligoToolbar-gutters", s === "vertical" && "CaligoToolbar-vertical", i === "raised" && "CaligoToolbar-raised", r),
18
+ ...c
19
+ });
20
+ }), l = i.forwardRef(function(t, n) {
21
+ let { className: r, ...i } = t;
22
+ return /* @__PURE__ */ a(o.Group, {
23
+ ref: n,
24
+ className: e("CaligoToolbar-group", r),
25
+ ...i
26
+ });
27
+ }), u = i.forwardRef(function(e, r) {
28
+ let { children: i, icon: s, size: c = "xsmall", ...l } = e;
29
+ return i == null ? /* @__PURE__ */ a(o.Button, {
30
+ ref: r,
31
+ render: /* @__PURE__ */ a(n, {
32
+ variant: "text",
33
+ color: "inherit",
34
+ size: c
35
+ }),
36
+ ...l,
37
+ children: s
38
+ }) : /* @__PURE__ */ a(o.Button, {
39
+ ref: r,
40
+ render: /* @__PURE__ */ a(t, {
41
+ variant: "text",
42
+ color: "inherit",
43
+ size: c,
44
+ startIcon: s
45
+ }),
46
+ ...l,
47
+ children: i
48
+ });
49
+ }), d = i.forwardRef(function(e, r) {
50
+ let { children: c, defaultPressed: l, icon: u, onPressedChange: d, pressed: f, size: p = "xsmall", ...m } = e, [h, g] = i.useState(l ?? !1), _ = f ?? h;
51
+ return /* @__PURE__ */ a(o.Button, {
52
+ ref: r,
53
+ render: /* @__PURE__ */ a(s, {
54
+ pressed: _,
55
+ onPressedChange: (e) => {
56
+ g(e), d?.(e);
57
+ },
58
+ render: c == null ? /* @__PURE__ */ a(n, {
59
+ variant: "text",
60
+ color: "inherit",
61
+ size: p,
62
+ className: _ ? "Caligo-selected" : void 0
63
+ }) : /* @__PURE__ */ a(t, {
64
+ variant: "text",
65
+ color: "inherit",
66
+ size: p,
67
+ startIcon: u,
68
+ className: _ ? "Caligo-selected" : void 0
69
+ })
70
+ }),
71
+ ...m,
72
+ children: c ?? u
73
+ });
74
+ }), f = i.forwardRef(function(t, n) {
75
+ let { className: r, ...i } = t;
76
+ return /* @__PURE__ */ a(o.Link, {
77
+ ref: n,
78
+ className: e("CaligoToolbar-link", r),
79
+ ...i
80
+ });
81
+ }), p = i.forwardRef(function(t, n) {
82
+ let { className: r, ...i } = t;
83
+ return /* @__PURE__ */ a(o.Input, {
84
+ ref: n,
85
+ className: e("CaligoToolbar-input", r),
86
+ ...i
87
+ });
88
+ }), m = i.forwardRef(function(e, t) {
89
+ return /* @__PURE__ */ a(o.Separator, {
90
+ ref: t,
91
+ render: /* @__PURE__ */ a(r, {
92
+ orientation: "vertical",
93
+ flexItem: !0
94
+ }),
95
+ ...e
96
+ });
97
+ });
98
+ export { u as Button, l as Group, p as Input, f as Link, c as Root, m as Separator, d as Toggle };
99
+
100
+ //# sourceMappingURL=Toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toolbar.js","names":["BaseToolbar","CaligoButton","Toggle","BaseToggle","React","Root","other","props","Toolbar","cx","orientation","elevation","className","Group","ToolbarButton","children","IconButton","icon","Button","Toggle$1","inner","setInner","defaultPressed","on","pressed","Toggle","next","onPressedChange","Link","Input","Separator","Divider"],"sources":["../../../src/parts/Toolbar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Toolbar as BaseToolbar } from '@base-ui/react/toolbar';\nimport { Toggle as BaseToggle } from '@base-ui/react/toggle';\nimport { cx } from '../internal/cx';\nimport { Button as CaligoButton, type ButtonProps as CaligoButtonProps } from '../Button';\nimport { IconButton } from '../IconButton';\nimport { Divider } from '../Divider';\nimport type { PartProps } from './types';\nimport '../Toolbar/Toolbar.css';\n\n/*\n * A toolbar with one tab stop: arrow keys move between its controls (WAI-ARIA's toolbar pattern), as in a text\n * editor. Base UI's Toolbar, drawn as Caligo's grouped Toolbar with quiet icon buttons, which rise to the key level\n * while a `Toggle` is on.\n */\n\nexport interface RootProps extends PartProps<typeof BaseToolbar.Root> {\n /** `raised` floats it on a surface with a popover's shadow, for a toolbar over content. @default 'flat' */\n elevation?: 'flat' | 'raised';\n}\n\n/** The bar. Name it with `aria-label`. */\nexport const Root = React.forwardRef<HTMLDivElement, RootProps>(function ToolbarRoot(props, ref) {\n const { className, elevation = 'flat', orientation = 'horizontal', ...other } = props;\n return (\n <BaseToolbar.Root\n ref={ref}\n orientation={orientation}\n className={cx('CaligoToolbar-root CaligoToolbar-grouped CaligoToolbar-gutters', orientation === 'vertical' && 'CaligoToolbar-vertical', elevation === 'raised' && 'CaligoToolbar-raised', className)}\n {...other}\n />\n );\n});\n\n/** Controls that belong together, such as the text styles. */\nexport const Group = React.forwardRef<HTMLDivElement, PartProps<typeof BaseToolbar.Group>>(function ToolbarGroup(props, ref) {\n const { className, ...other } = props;\n return <BaseToolbar.Group ref={ref} className={cx('CaligoToolbar-group', className)} {...other} />;\n});\n\nexport interface ButtonProps extends Omit<PartProps<typeof BaseToolbar.Button>, 'color'> {\n /** An icon. Alone it makes a square icon button, which needs an `aria-label`; with children, a labelled button. */\n icon?: React.ReactNode;\n /** @default 'xsmall' */\n size?: CaligoButtonProps['size'];\n}\n\n/** A control in the bar: a quiet icon button, or a labelled text button when it has children. */\nconst ToolbarButton = React.forwardRef<HTMLButtonElement, ButtonProps>(function ToolbarButton(props, ref) {\n const { children, icon, size = 'xsmall', ...other } = props;\n if (children != null) {\n return <BaseToolbar.Button ref={ref} render={<CaligoButton variant=\"text\" color=\"inherit\" size={size} startIcon={icon} />} {...other}>{children}</BaseToolbar.Button>;\n }\n return <BaseToolbar.Button ref={ref} render={<IconButton variant=\"text\" color=\"inherit\" size={size as 'xsmall'} />} {...other}>{icon}</BaseToolbar.Button>;\n});\nexport { ToolbarButton as Button };\n\nexport interface ToggleProps extends Omit<PartProps<typeof BaseToolbar.Button>, 'color'> {\n icon?: React.ReactNode;\n /** Whether it is on: `pressed` with `onPressedChange`, or `defaultPressed`. */\n pressed?: boolean;\n defaultPressed?: boolean;\n onPressedChange?: (pressed: boolean) => void;\n /** @default 'xsmall' */\n size?: CaligoButtonProps['size'];\n}\n\n/** A control that stays on (bold, a panel): a quiet icon button that rises to the key level while it is on. */\nexport const Toggle = React.forwardRef<HTMLButtonElement, ToggleProps>(function ToolbarToggle(props, ref) {\n const { children, defaultPressed, icon, onPressedChange, pressed, size = 'xsmall', ...other } = props;\n const [inner, setInner] = React.useState(defaultPressed ?? false);\n const on = pressed ?? inner;\n return (\n <BaseToolbar.Button\n ref={ref}\n render={\n <BaseToggle\n pressed={on}\n onPressedChange={(next: boolean) => { setInner(next); onPressedChange?.(next); }}\n render={children != null\n ? <CaligoButton variant=\"text\" color=\"inherit\" size={size} startIcon={icon} className={on ? 'Caligo-selected' : undefined} />\n : <IconButton variant=\"text\" color=\"inherit\" size={size as 'xsmall'} className={on ? 'Caligo-selected' : undefined} />}\n />\n }\n {...other}\n >\n {children ?? icon}\n </BaseToolbar.Button>\n );\n});\n\n/** A link in the bar, in the arrow-key order. */\nexport const Link = React.forwardRef<HTMLAnchorElement, PartProps<typeof BaseToolbar.Link>>(function ToolbarLink(props, ref) {\n const { className, ...other } = props;\n return <BaseToolbar.Link ref={ref} className={cx('CaligoToolbar-link', className)} {...other} />;\n});\n\n/** A text field in the bar, in the arrow-key order. */\nexport const Input = React.forwardRef<HTMLInputElement, PartProps<typeof BaseToolbar.Input>>(function ToolbarInput(props, ref) {\n const { className, ...other } = props;\n return <BaseToolbar.Input ref={ref} className={cx('CaligoToolbar-input', className)} {...other} />;\n});\n\n/** A line between groups: Caligo's vertical `Divider`. */\nexport const Separator = React.forwardRef<HTMLDivElement, PartProps<typeof BaseToolbar.Separator>>(function ToolbarSeparator(props, ref) {\n return <BaseToolbar.Separator ref={ref} render={<Divider orientation=\"vertical\" flexItem />} {...props} />;\n});\n"],"mappings":";;;;;;;;;;;AAsBA,IAAaK,IAAOD,EAAM,WAAsC,SAAqB,GAAO,GAAK;CAC/F,IAAM,EAAE,cAAW,eAAY,QAAQ,iBAAc,cAAc,GAAGE,MAAUC;CAChF,OACE,kBAACP,EAAY,MAAb;EACO;EACQ;EACb,WAAWS,EAAG,kEAAkEC,MAAgB,cAAc,0BAA0BC,MAAc,YAAY,wBAAwBC,CAAS;EACnM,GAAIN;CACL,CAAA;AAEL,CAAC,GAGYO,IAAQT,EAAM,WAAgE,SAAsB,GAAO,GAAK;CAC3H,IAAM,EAAE,cAAW,GAAGE,MAAUC;CAChC,OAAO,kBAACP,EAAY,OAAb;EAAwB;EAAK,WAAWS,EAAG,uBAAuBG,CAAS;EAAG,GAAIN;CA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Y,MAAb;EAAuB;EAAK,WAAWS,EAAG,sBAAsBG,CAAS;EAAG,GAAIN;CAAQ,CAAA;AACjG,CAAC,GAGYuB,IAAQzB,EAAM,WAAkE,SAAsB,GAAO,GAAK;CAC7H,IAAM,EAAE,cAAW,GAAGE,MAAUC;CAChC,OAAO,kBAACP,EAAY,OAAb;EAAwB;EAAK,WAAWS,EAAG,uBAAuBG,CAAS;EAAG,GAAIN;CAAQ,CAAA;AACnG,CAAC,GAGYwB,IAAY1B,EAAM,WAAoE,SAA0B,GAAO,GAAK;CACvI,OAAO,kBAACJ,EAAY,WAAb;EAA4B;EAAK,QAAQ,kBAAC+B,GAAD;GAAS,aAAY;GAAW,UAAA;EAAU,CAAA;EAAG,GAAIxB;CAAQ,CAAA;AAC3G,CAAC"}
@@ -19,20 +19,32 @@ var c = n.forwardRef(function(e, t) {
19
19
  ...e
20
20
  });
21
21
  }), l = n.forwardRef(function(n, o) {
22
- let { align: s = "center", arrow: c = !1, children: l, className: u, container: d, keepMounted: f = !1, side: p = "bottom", sideOffset: m, ...h } = n;
22
+ let { align: s = "center", alignOffset: c, arrow: l = !1, children: u, className: d, collisionPadding: f, container: p, keepMounted: m = !1, shortcut: h, side: g = "bottom", sideOffset: _, ...v } = n, y = h == null ? null : typeof h == "string" ? h.split(/\s*\+\s*|\s+/).filter(Boolean) : h;
23
23
  return /* @__PURE__ */ r(a.Portal, {
24
- keepMounted: f,
25
- ...d ? { container: d } : null,
24
+ keepMounted: m,
25
+ ...p ? { container: p } : null,
26
26
  children: /* @__PURE__ */ r(a.Positioner, {
27
- side: p,
27
+ side: g,
28
28
  align: s,
29
- sideOffset: m ?? (c ? 10 : 8),
29
+ sideOffset: _ ?? (l ? 10 : 8),
30
+ ...c === void 0 ? null : { alignOffset: c },
31
+ ...f === void 0 ? null : { collisionPadding: f },
30
32
  className: "CaligoTooltip-popper CaligoTooltip-popperInteractive",
31
33
  children: /* @__PURE__ */ i(a.Popup, {
32
34
  ref: o,
33
- className: e("CaligoTooltip-tooltip", c && "CaligoTooltip-tooltipArrow", `CaligoTooltip-tooltipPlacement${t(p)}`, u),
34
- ...h,
35
- children: [l, c && /* @__PURE__ */ r(a.Arrow, { className: "CaligoTooltip-arrow" })]
35
+ className: e("CaligoTooltip-tooltip", l && "CaligoTooltip-tooltipArrow", `CaligoTooltip-tooltipPlacement${t(g)}`, d),
36
+ ...v,
37
+ children: [
38
+ u,
39
+ y && /* @__PURE__ */ r("span", {
40
+ className: "CaligoTooltip-shortcut",
41
+ children: y.map((e, t) => /* @__PURE__ */ r("kbd", {
42
+ className: "CaligoTooltip-key",
43
+ children: e
44
+ }, `${e}-${t}`))
45
+ }),
46
+ l && /* @__PURE__ */ r(a.Arrow, { className: "CaligoTooltip-arrow" })
47
+ ]
36
48
  })
37
49
  })
38
50
  });