@bolio-ui/core 3.0.0-alpha.0 → 3.0.0-alpha.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 (206) hide show
  1. package/dist/BolioUIProvider/index.js +3 -3
  2. package/dist/Calendar/Calendar.d.ts +1 -0
  3. package/dist/Calendar/index.js +2 -2
  4. package/dist/Carousel/Carousel.d.ts +21 -0
  5. package/dist/Carousel/index.d.ts +3 -0
  6. package/dist/Carousel/index.js +14 -0
  7. package/dist/Collapse/Collapse.d.ts +3 -0
  8. package/dist/Collapse/index.js +3 -3
  9. package/dist/ColorInput/ColorInput.d.ts +24 -0
  10. package/dist/ColorInput/index.d.ts +3 -0
  11. package/dist/ColorInput/index.js +20 -0
  12. package/dist/ColorPicker/ColorPicker.d.ts +17 -0
  13. package/dist/ColorPicker/color-utils.d.ts +10 -0
  14. package/dist/ColorPicker/index.d.ts +3 -0
  15. package/dist/ColorPicker/index.js +14 -0
  16. package/dist/Command/index.js +4 -4
  17. package/dist/ContextMenu/ContextMenu.d.ts +13 -0
  18. package/dist/ContextMenu/index.d.ts +3 -0
  19. package/dist/ContextMenu/index.js +25 -0
  20. package/dist/CssBaseline/index.js +2 -2
  21. package/dist/DatePicker/index.js +3 -3
  22. package/dist/DateRangePicker/DateRangePicker.d.ts +29 -0
  23. package/dist/DateRangePicker/index.d.ts +3 -0
  24. package/dist/DateRangePicker/index.js +19 -0
  25. package/dist/Drawer/index.js +2 -2
  26. package/dist/Dropzone/Dropzone.d.ts +25 -0
  27. package/dist/Dropzone/DropzoneThumbnail.d.ts +9 -0
  28. package/dist/Dropzone/index.d.ts +3 -0
  29. package/dist/Dropzone/index.js +14 -0
  30. package/dist/Menu/index.js +3 -3
  31. package/dist/Modal/index.js +2 -2
  32. package/dist/PinInput/PinInput.d.ts +25 -0
  33. package/dist/PinInput/index.d.ts +3 -0
  34. package/dist/PinInput/index.js +16 -0
  35. package/dist/SegmentedControl/SegmentedControl.d.ts +16 -0
  36. package/dist/SegmentedControl/SegmentedControlContext.d.ts +10 -0
  37. package/dist/SegmentedControl/SegmentedControlItem.d.ts +13 -0
  38. package/dist/SegmentedControl/index.d.ts +10 -0
  39. package/dist/SegmentedControl/index.js +14 -0
  40. package/dist/Select/SelectDropdown.d.ts +2 -0
  41. package/dist/Select/index.js +6 -6
  42. package/dist/Slider/index.js +3 -3
  43. package/dist/Table/index.js +1 -1
  44. package/dist/TagsInput/TagsInput.d.ts +26 -0
  45. package/dist/TagsInput/index.d.ts +3 -0
  46. package/dist/TagsInput/index.js +17 -0
  47. package/dist/Tree/Tree.d.ts +17 -0
  48. package/dist/Tree/TreeContext.d.ts +17 -0
  49. package/dist/Tree/TreeNode.d.ts +8 -0
  50. package/dist/Tree/index.d.ts +3 -0
  51. package/dist/Tree/index.js +14 -0
  52. package/dist/chunk-2A4BSQ66.js +130 -0
  53. package/dist/{chunk-HIFS4JIO.js → chunk-2EYJZXS4.js} +7 -7
  54. package/dist/chunk-4X4ELIMQ.js +231 -0
  55. package/dist/{chunk-UVVBMWR4.js → chunk-AG2NWQYL.js} +18 -4
  56. package/dist/chunk-AVO2SK2I.js +109 -0
  57. package/dist/{chunk-YHZFOVVI.js → chunk-DIMJQLWY.js} +27 -37
  58. package/dist/chunk-G4KB56RO.js +217 -0
  59. package/dist/chunk-GYFW5NLU.js +257 -0
  60. package/dist/chunk-IJGIEX5J.js +211 -0
  61. package/dist/chunk-K6UULETP.js +244 -0
  62. package/dist/chunk-MDSRXACM.js +212 -0
  63. package/dist/chunk-OKZRHSSG.js +271 -0
  64. package/dist/{chunk-IBC5BABS.js → chunk-P245HSVB.js} +190 -155
  65. package/dist/{chunk-6KMHJRCY.js → chunk-TDJGMSGT.js} +1 -0
  66. package/dist/{chunk-FQU5SKDF.js → chunk-WFGUAR7K.js} +58 -24
  67. package/dist/chunk-X4TPC7HS.js +160 -0
  68. package/dist/{chunk-6BCLZSSK.js → chunk-XLPOECCE.js} +2 -2
  69. package/dist/css/Button-ButtonIcon.css +3 -2
  70. package/dist/css/ButtonGroup.css +1 -0
  71. package/dist/css/Calendar.css +12 -1
  72. package/dist/css/Carousel.css +128 -0
  73. package/dist/css/Collapse.css +29 -9
  74. package/dist/css/ColorInput.css +97 -0
  75. package/dist/css/ColorPicker.css +186 -0
  76. package/dist/css/Combobox.css +2 -0
  77. package/dist/css/ContextMenu.css +17 -0
  78. package/dist/css/DatePicker.css +4 -1
  79. package/dist/css/DateRangePicker.css +110 -0
  80. package/dist/css/Dropzone.css +163 -0
  81. package/dist/css/Fieldset-FieldsetGroup.css +1 -0
  82. package/dist/css/Input.css +4 -3
  83. package/dist/css/Menu-MenuList.css +1 -0
  84. package/dist/css/NumberInput.css +5 -4
  85. package/dist/css/PinInput.css +41 -0
  86. package/dist/css/Radio.css +1 -0
  87. package/dist/css/SegmentedControl-SegmentedControlItem.css +65 -0
  88. package/dist/css/SegmentedControl.css +14 -0
  89. package/dist/css/Select-SelectDropdown.css +5 -2
  90. package/dist/css/Select-SelectMultipleValue.css +1 -0
  91. package/dist/css/Select-SelectOption.css +28 -7
  92. package/dist/css/Select.css +3 -1
  93. package/dist/css/TagsInput.css +101 -0
  94. package/dist/css/Textarea.css +1 -0
  95. package/dist/css/Toggle.css +1 -0
  96. package/dist/css/Tree.css +88 -0
  97. package/dist/css/use-toasts-toast-item.css +1 -0
  98. package/dist/index.d.ts +20 -0
  99. package/dist/index.js +80 -40
  100. package/dist/styles.css +3494 -2400
  101. package/esm/BolioUIProvider/index.js +2 -2
  102. package/esm/Calendar/Calendar.d.ts +1 -0
  103. package/esm/Calendar/index.js +1 -1
  104. package/esm/Carousel/Carousel.d.ts +21 -0
  105. package/esm/Carousel/index.d.ts +3 -0
  106. package/esm/Carousel/index.js +14 -0
  107. package/esm/Collapse/Collapse.d.ts +3 -0
  108. package/esm/Collapse/index.js +2 -2
  109. package/esm/ColorInput/ColorInput.d.ts +24 -0
  110. package/esm/ColorInput/index.d.ts +3 -0
  111. package/esm/ColorInput/index.js +20 -0
  112. package/esm/ColorPicker/ColorPicker.d.ts +17 -0
  113. package/esm/ColorPicker/color-utils.d.ts +10 -0
  114. package/esm/ColorPicker/index.d.ts +3 -0
  115. package/esm/ColorPicker/index.js +14 -0
  116. package/esm/Command/index.js +4 -4
  117. package/esm/ContextMenu/ContextMenu.d.ts +13 -0
  118. package/esm/ContextMenu/index.d.ts +3 -0
  119. package/esm/ContextMenu/index.js +25 -0
  120. package/esm/CssBaseline/index.js +1 -1
  121. package/esm/DatePicker/index.js +2 -2
  122. package/esm/DateRangePicker/DateRangePicker.d.ts +29 -0
  123. package/esm/DateRangePicker/index.d.ts +3 -0
  124. package/esm/DateRangePicker/index.js +19 -0
  125. package/esm/Drawer/index.js +2 -2
  126. package/esm/Dropzone/Dropzone.d.ts +25 -0
  127. package/esm/Dropzone/DropzoneThumbnail.d.ts +9 -0
  128. package/esm/Dropzone/index.d.ts +3 -0
  129. package/esm/Dropzone/index.js +14 -0
  130. package/esm/Menu/index.js +2 -2
  131. package/esm/Modal/index.js +2 -2
  132. package/esm/PinInput/PinInput.d.ts +25 -0
  133. package/esm/PinInput/index.d.ts +3 -0
  134. package/esm/PinInput/index.js +16 -0
  135. package/esm/SegmentedControl/SegmentedControl.d.ts +16 -0
  136. package/esm/SegmentedControl/SegmentedControlContext.d.ts +10 -0
  137. package/esm/SegmentedControl/SegmentedControlItem.d.ts +13 -0
  138. package/esm/SegmentedControl/index.d.ts +10 -0
  139. package/esm/SegmentedControl/index.js +14 -0
  140. package/esm/Select/SelectDropdown.d.ts +2 -0
  141. package/esm/Select/index.js +5 -5
  142. package/esm/Slider/index.js +2 -2
  143. package/esm/Table/index.js +1 -1
  144. package/esm/TagsInput/TagsInput.d.ts +26 -0
  145. package/esm/TagsInput/index.d.ts +3 -0
  146. package/esm/TagsInput/index.js +17 -0
  147. package/esm/Tree/Tree.d.ts +17 -0
  148. package/esm/Tree/TreeContext.d.ts +17 -0
  149. package/esm/Tree/TreeNode.d.ts +8 -0
  150. package/esm/Tree/index.d.ts +3 -0
  151. package/esm/Tree/index.js +14 -0
  152. package/esm/chunk-2A4BSQ66.js +130 -0
  153. package/esm/{chunk-HIFS4JIO.js → chunk-2EYJZXS4.js} +4 -4
  154. package/esm/chunk-4X4ELIMQ.js +231 -0
  155. package/esm/{chunk-UVVBMWR4.js → chunk-AG2NWQYL.js} +18 -4
  156. package/esm/chunk-AVO2SK2I.js +109 -0
  157. package/esm/{chunk-YHZFOVVI.js → chunk-DIMJQLWY.js} +27 -37
  158. package/esm/chunk-G4KB56RO.js +217 -0
  159. package/esm/chunk-GYFW5NLU.js +257 -0
  160. package/esm/chunk-IJGIEX5J.js +211 -0
  161. package/esm/chunk-K6UULETP.js +244 -0
  162. package/esm/chunk-MDSRXACM.js +212 -0
  163. package/esm/chunk-OKZRHSSG.js +271 -0
  164. package/esm/chunk-P245HSVB.js +450 -0
  165. package/esm/{chunk-6KMHJRCY.js → chunk-TDJGMSGT.js} +1 -0
  166. package/esm/{chunk-FQU5SKDF.js → chunk-WFGUAR7K.js} +60 -26
  167. package/esm/chunk-X4TPC7HS.js +160 -0
  168. package/esm/{chunk-6BCLZSSK.js → chunk-XLPOECCE.js} +1 -1
  169. package/esm/css/Button-ButtonIcon.css +3 -2
  170. package/esm/css/ButtonGroup.css +1 -0
  171. package/esm/css/Calendar.css +12 -1
  172. package/esm/css/Carousel.css +128 -0
  173. package/esm/css/Collapse.css +29 -9
  174. package/esm/css/ColorInput.css +97 -0
  175. package/esm/css/ColorPicker.css +186 -0
  176. package/esm/css/Combobox.css +2 -0
  177. package/esm/css/ContextMenu.css +17 -0
  178. package/esm/css/DatePicker.css +4 -1
  179. package/esm/css/DateRangePicker.css +110 -0
  180. package/esm/css/Dropzone.css +163 -0
  181. package/esm/css/Fieldset-FieldsetGroup.css +1 -0
  182. package/esm/css/Input.css +4 -3
  183. package/esm/css/Menu-MenuList.css +1 -0
  184. package/esm/css/NumberInput.css +5 -4
  185. package/esm/css/PinInput.css +41 -0
  186. package/esm/css/Radio.css +1 -0
  187. package/esm/css/SegmentedControl-SegmentedControlItem.css +65 -0
  188. package/esm/css/SegmentedControl.css +14 -0
  189. package/esm/css/Select-SelectDropdown.css +5 -2
  190. package/esm/css/Select-SelectMultipleValue.css +1 -0
  191. package/esm/css/Select-SelectOption.css +28 -7
  192. package/esm/css/Select.css +3 -1
  193. package/esm/css/TagsInput.css +101 -0
  194. package/esm/css/Textarea.css +1 -0
  195. package/esm/css/Toggle.css +1 -0
  196. package/esm/css/Tree.css +88 -0
  197. package/esm/css/use-toasts-toast-item.css +1 -0
  198. package/esm/index.d.ts +20 -0
  199. package/esm/index.js +93 -53
  200. package/esm/styles.css +3470 -2376
  201. package/package.json +3 -3
  202. package/esm/chunk-IBC5BABS.js +0 -415
  203. package/dist/{chunk-2PRUFY2Q.js → chunk-4ZGR7UMX.js} +2 -2
  204. package/dist/{chunk-FLK7EAOE.js → chunk-IUZV5Y27.js} +2 -2
  205. package/esm/{chunk-2PRUFY2Q.js → chunk-4ZGR7UMX.js} +3 -3
  206. package/esm/{chunk-FLK7EAOE.js → chunk-IUZV5Y27.js} +3 -3
@@ -0,0 +1,211 @@
1
+ import {
2
+ ColorPicker_default,
3
+ normalizeHex
4
+ } from "./chunk-OKZRHSSG.js";
5
+ import {
6
+ InputBlockLabel_default
7
+ } from "./chunk-UOGCO6CV.js";
8
+ import {
9
+ getColors
10
+ } from "./chunk-KBZEYKCZ.js";
11
+ import {
12
+ use_click_away_default
13
+ } from "./chunk-DGXZP4VJ.js";
14
+ import {
15
+ use_scale_default,
16
+ with_scale_default
17
+ } from "./chunk-MAICNLTY.js";
18
+ import {
19
+ use_theme_default
20
+ } from "./chunk-V5I4ORQQ.js";
21
+ import {
22
+ use_classes_default
23
+ } from "./chunk-5KUROAEP.js";
24
+
25
+ // core/ColorInput/ColorInput.tsx
26
+ import React, {
27
+ useEffect,
28
+ useId,
29
+ useImperativeHandle,
30
+ useRef,
31
+ useState
32
+ } from "react";
33
+
34
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/ColorInput/ColorInput.module.css.bolio-css-module-source
35
+ var ColorInput_module_css_default = { "colorinput": "ColorInput-module_colorinput__nYel-", "field": "ColorInput-module_field__JQwJJ", "swatch": "ColorInput-module_swatch__sLvyf", "input": "ColorInput-module_input__ExawP", "popup": "ColorInput-module_popup__p91ry" };
36
+
37
+ // core/ColorInput/ColorInput.tsx
38
+ import { jsx, jsxs } from "react/jsx-runtime";
39
+ var ColorInputComponent = React.forwardRef(
40
+ ({
41
+ value: customValue,
42
+ initialValue = "#000000",
43
+ onChange,
44
+ swatches,
45
+ placeholder = "#000000",
46
+ disabled = false,
47
+ type = "default",
48
+ rounded = false,
49
+ filled = false,
50
+ light = false,
51
+ ghost = false,
52
+ subtle = false,
53
+ pickerLabel = "Choose color",
54
+ className = "",
55
+ children,
56
+ onBlur,
57
+ ...props
58
+ }, ref) => {
59
+ const theme = use_theme_default();
60
+ const { SCALES } = use_scale_default();
61
+ const generatedId = useId();
62
+ const inputId = props.id || generatedId;
63
+ const colors = getColors(theme.palette, type, disabled, {
64
+ filled,
65
+ light,
66
+ ghost,
67
+ subtle
68
+ });
69
+ const isControlled = customValue !== void 0;
70
+ const [selfHex, setSelfHex] = useState(
71
+ normalizeHex(initialValue) || "#000000"
72
+ );
73
+ const hex = (isControlled ? normalizeHex(customValue) : selfHex) || "#000000";
74
+ const [text, setText] = useState(hex);
75
+ const [open, setOpen] = useState(false);
76
+ useEffect(() => setText(hex), [hex]);
77
+ const rootRef = useRef(null);
78
+ const inputRef = useRef(null);
79
+ const buttonRef = useRef(null);
80
+ const popupRef = useRef(null);
81
+ useImperativeHandle(ref, () => inputRef.current);
82
+ use_click_away_default(rootRef, () => setOpen(false));
83
+ useEffect(() => {
84
+ var _a, _b;
85
+ if (open)
86
+ (_b = (_a = popupRef.current) == null ? void 0 : _a.querySelector('[role="slider"]')) == null ? void 0 : _b.focus();
87
+ }, [open]);
88
+ const commit = (next) => {
89
+ if (next === hex) return;
90
+ if (!isControlled) setSelfHex(next);
91
+ if (onChange) onChange(next);
92
+ };
93
+ const changeHandler = (event) => {
94
+ setText(event.target.value);
95
+ const typed = /^#?[0-9a-f]{6}$/i.test(event.target.value.trim()) ? normalizeHex(event.target.value) : null;
96
+ if (typed) commit(typed);
97
+ };
98
+ const blurHandler = (event) => {
99
+ if (onBlur) onBlur(event);
100
+ const typed = normalizeHex(text);
101
+ if (typed) commit(typed);
102
+ setText(hex);
103
+ };
104
+ const keyDownHandler = (event) => {
105
+ var _a;
106
+ if (event.key !== "Escape") return;
107
+ event.stopPropagation();
108
+ setOpen(false);
109
+ (_a = buttonRef.current) == null ? void 0 : _a.focus();
110
+ };
111
+ const colorInputStyle = {
112
+ "--colorinput-height": SCALES.height(2.25),
113
+ "--colorinput-width": SCALES.width(1, "initial"),
114
+ "--colorinput-font-size": SCALES.font(0.875),
115
+ "--colorinput-margin": `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`,
116
+ "--colorinput-border": colors.borderColor,
117
+ "--colorinput-radius": rounded ? "25px" : theme.layout.radius,
118
+ "--colorinput-popup-radius": theme.layout.radius,
119
+ "--colorinput-bg": colors.bgColor,
120
+ "--colorinput-hover-border": colors.hoverBorder,
121
+ "--colorinput-hover-bg": colors.hoverBgColor,
122
+ "--colorinput-focus-border": colors.focusBorder,
123
+ "--colorinput-placeholder": colors.placeholderColor,
124
+ "--colorinput-color": colors.color,
125
+ "--colorinput-popup-bg": theme.palette.background,
126
+ "--colorinput-popup-border": theme.palette.border,
127
+ "--colorinput-shadow": theme.expressiveness.shadowMedium
128
+ };
129
+ return /* @__PURE__ */ jsxs(
130
+ "div",
131
+ {
132
+ ref: rootRef,
133
+ className: use_classes_default(ColorInput_module_css_default.colorinput, className),
134
+ style: colorInputStyle,
135
+ children: [
136
+ children && /* @__PURE__ */ jsx(InputBlockLabel_default, { htmlFor: inputId, children }),
137
+ /* @__PURE__ */ jsxs(
138
+ "div",
139
+ {
140
+ className: use_classes_default(ColorInput_module_css_default.field, {
141
+ [ColorInput_module_css_default.disabled]: disabled
142
+ }),
143
+ children: [
144
+ /* @__PURE__ */ jsx(
145
+ "button",
146
+ {
147
+ ref: buttonRef,
148
+ type: "button",
149
+ className: ColorInput_module_css_default.swatch,
150
+ style: { backgroundColor: hex },
151
+ "aria-label": pickerLabel,
152
+ "aria-haspopup": "dialog",
153
+ "aria-expanded": open,
154
+ disabled,
155
+ onClick: () => setOpen((last) => !last)
156
+ }
157
+ ),
158
+ /* @__PURE__ */ jsx(
159
+ "input",
160
+ {
161
+ ref: inputRef,
162
+ type: "text",
163
+ autoComplete: "off",
164
+ spellCheck: false,
165
+ value: text,
166
+ placeholder,
167
+ disabled,
168
+ onChange: changeHandler,
169
+ onBlur: blurHandler,
170
+ className: ColorInput_module_css_default.input,
171
+ ...props,
172
+ id: inputId
173
+ }
174
+ )
175
+ ]
176
+ }
177
+ ),
178
+ open && /* @__PURE__ */ jsx(
179
+ "div",
180
+ {
181
+ ref: popupRef,
182
+ role: "dialog",
183
+ "aria-label": pickerLabel,
184
+ className: ColorInput_module_css_default.popup,
185
+ onKeyDown: keyDownHandler,
186
+ children: /* @__PURE__ */ jsx(
187
+ ColorPicker_default,
188
+ {
189
+ value: hex,
190
+ onChange: commit,
191
+ swatches,
192
+ hexInput: false
193
+ }
194
+ )
195
+ }
196
+ )
197
+ ]
198
+ }
199
+ );
200
+ }
201
+ );
202
+ ColorInputComponent.displayName = "BolioUIColorInput";
203
+ var ColorInput = with_scale_default(ColorInputComponent);
204
+ var ColorInput_default = ColorInput;
205
+
206
+ // core/ColorInput/index.ts
207
+ var ColorInput_default2 = ColorInput_default;
208
+
209
+ export {
210
+ ColorInput_default2 as ColorInput_default
211
+ };
@@ -0,0 +1,244 @@
1
+ import {
2
+ use_scale_default,
3
+ with_scale_default
4
+ } from "./chunk-MAICNLTY.js";
5
+ import {
6
+ use_theme_default
7
+ } from "./chunk-V5I4ORQQ.js";
8
+ import {
9
+ joinClasses,
10
+ use_classes_default
11
+ } from "./chunk-5KUROAEP.js";
12
+
13
+ // core/Tree/Tree.tsx
14
+ import React3, { useCallback, useMemo, useRef, useState } from "react";
15
+
16
+ // core/Tree/TreeContext.ts
17
+ import React from "react";
18
+ var TreeContext = React.createContext({
19
+ selected: null,
20
+ expanded: [],
21
+ tabbable: void 0,
22
+ activate: () => void 0,
23
+ register: () => void 0
24
+ });
25
+ var useTreeContext = () => React.useContext(TreeContext);
26
+
27
+ // core/Tree/TreeNode.tsx
28
+ import { useId } from "react";
29
+
30
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Tree/Tree.module.css.bolio-css-module-source
31
+ var Tree_module_css_default = { "tree": "Tree-module_tree__2jgbS", "group": "Tree-module_group__H2325", "item": "Tree-module_item__wk8rO", "row": "Tree-module_row__lm4LA", "selected": "Tree-module_selected__DwSTb", "disabled": "Tree-module_disabled__9ghlS", "chevron": "Tree-module_chevron__V-147", "chevronIcon": "Tree-module_chevronIcon__YhP38", "open": "Tree-module_open__kBS5H", "icon": "Tree-module_icon__wiWbw", "label": "Tree-module_label__EoRFb" };
32
+
33
+ // core/Tree/TreeNode.tsx
34
+ import { jsx, jsxs } from "react/jsx-runtime";
35
+ function TreeNode({ node, level }) {
36
+ var _a;
37
+ const { selected, expanded, tabbable, activate, register } = useTreeContext();
38
+ const labelId = useId();
39
+ const hasChildren = Boolean(node.children && node.children.length);
40
+ const isExpanded = hasChildren && expanded.includes(node.value);
41
+ return /* @__PURE__ */ jsxs(
42
+ "li",
43
+ {
44
+ ref: (element) => register(node.value, element),
45
+ role: "treeitem",
46
+ "data-value": node.value,
47
+ "aria-labelledby": labelId,
48
+ "aria-level": level,
49
+ "aria-expanded": hasChildren ? isExpanded : void 0,
50
+ "aria-selected": selected === node.value,
51
+ "aria-disabled": node.disabled || void 0,
52
+ tabIndex: tabbable === node.value ? 0 : -1,
53
+ className: Tree_module_css_default.item,
54
+ children: [
55
+ /* @__PURE__ */ jsxs(
56
+ "div",
57
+ {
58
+ className: joinClasses(Tree_module_css_default.row, {
59
+ [Tree_module_css_default.selected]: selected === node.value,
60
+ [Tree_module_css_default.disabled]: Boolean(node.disabled)
61
+ }),
62
+ style: { "--tree-level": level - 1 },
63
+ onClick: () => activate(node),
64
+ children: [
65
+ /* @__PURE__ */ jsx("span", { className: Tree_module_css_default.chevron, "aria-hidden": "true", children: hasChildren && /* @__PURE__ */ jsx(
66
+ "svg",
67
+ {
68
+ viewBox: "0 0 24 24",
69
+ width: "1em",
70
+ height: "1em",
71
+ fill: "none",
72
+ stroke: "currentColor",
73
+ strokeWidth: "2",
74
+ strokeLinecap: "round",
75
+ strokeLinejoin: "round",
76
+ className: joinClasses(Tree_module_css_default.chevronIcon, {
77
+ [Tree_module_css_default.open]: isExpanded
78
+ }),
79
+ children: /* @__PURE__ */ jsx("path", { d: "M9 6l6 6-6 6" })
80
+ }
81
+ ) }),
82
+ node.icon && /* @__PURE__ */ jsx("span", { className: Tree_module_css_default.icon, "aria-hidden": "true", children: node.icon }),
83
+ /* @__PURE__ */ jsx("span", { id: labelId, className: Tree_module_css_default.label, children: node.label })
84
+ ]
85
+ }
86
+ ),
87
+ isExpanded && /* @__PURE__ */ jsx("ul", { role: "group", className: Tree_module_css_default.group, children: (_a = node.children) == null ? void 0 : _a.map((child) => /* @__PURE__ */ jsx(TreeNode, { node: child, level: level + 1 }, child.value)) })
88
+ ]
89
+ }
90
+ );
91
+ }
92
+ var TreeNode_default = TreeNode;
93
+
94
+ // core/Tree/Tree.tsx
95
+ import { jsx as jsx2 } from "react/jsx-runtime";
96
+ var noExpanded = [];
97
+ var TreeComponent = React3.forwardRef(
98
+ ({
99
+ data,
100
+ value: customValue,
101
+ initialValue = null,
102
+ onChange,
103
+ expanded: customExpanded,
104
+ initialExpanded = noExpanded,
105
+ onExpandedChange,
106
+ className = "",
107
+ style,
108
+ onKeyDown,
109
+ onFocus,
110
+ ...props
111
+ }, ref) => {
112
+ var _a;
113
+ const theme = use_theme_default();
114
+ const { SCALES } = use_scale_default();
115
+ const [selfValue, setSelfValue] = useState(initialValue);
116
+ const selected = customValue !== void 0 ? customValue : selfValue;
117
+ const [selfExpanded, setSelfExpanded] = useState(initialExpanded);
118
+ const expanded = customExpanded !== void 0 ? customExpanded : selfExpanded;
119
+ const [focused, setFocused] = useState();
120
+ const items = useRef(/* @__PURE__ */ new Map());
121
+ const visible = useMemo(() => {
122
+ const list = [];
123
+ const walk = (nodes, parent) => nodes.forEach((node) => {
124
+ list.push({ node, parent });
125
+ if (node.children && expanded.includes(node.value))
126
+ walk(node.children, node);
127
+ });
128
+ walk(data, null);
129
+ return list;
130
+ }, [data, expanded]);
131
+ const enabled = visible.filter(({ node }) => !node.disabled);
132
+ const tabbable = (_a = [focused, selected].map((value) => enabled.find(({ node }) => node.value === value)).find(Boolean) || enabled[0]) == null ? void 0 : _a.node.value;
133
+ const setExpanded = (next) => {
134
+ if (customExpanded === void 0) setSelfExpanded(next);
135
+ if (onExpandedChange) onExpandedChange(next);
136
+ };
137
+ const toggle = (node) => setExpanded(
138
+ expanded.includes(node.value) ? expanded.filter((value) => value !== node.value) : [...expanded, node.value]
139
+ );
140
+ const select = (node) => {
141
+ if (node.value === selected) return;
142
+ setSelfValue(node.value);
143
+ if (onChange) onChange(node.value, node);
144
+ };
145
+ const activate = (node) => {
146
+ if (node.disabled) return;
147
+ select(node);
148
+ if (node.children && node.children.length) toggle(node);
149
+ };
150
+ const register = useCallback(
151
+ (value, element) => {
152
+ if (element) items.current.set(value, element);
153
+ else items.current.delete(value);
154
+ },
155
+ []
156
+ );
157
+ const focusNode = (target) => {
158
+ var _a2;
159
+ if (target) (_a2 = items.current.get(target.node.value)) == null ? void 0 : _a2.focus();
160
+ };
161
+ const keyDownHandler = (event) => {
162
+ if (onKeyDown) onKeyDown(event);
163
+ if (event.defaultPrevented) return;
164
+ const element = event.target.closest(
165
+ '[role="treeitem"]'
166
+ );
167
+ const current = enabled.find(
168
+ ({ node: node2 }) => node2.value === (element == null ? void 0 : element.dataset.value)
169
+ );
170
+ if (!current) return;
171
+ const index = enabled.indexOf(current);
172
+ const { node, parent } = current;
173
+ const hasChildren = Boolean(node.children && node.children.length);
174
+ const isOpen = hasChildren && expanded.includes(node.value);
175
+ const actions = {
176
+ ArrowDown: () => focusNode(enabled[index + 1]),
177
+ ArrowUp: () => focusNode(enabled[index - 1]),
178
+ Home: () => focusNode(enabled[0]),
179
+ End: () => focusNode(enabled[enabled.length - 1]),
180
+ ArrowRight: () => {
181
+ if (!hasChildren) return;
182
+ if (!isOpen) return toggle(node);
183
+ focusNode(enabled.find((item) => item.parent === node));
184
+ },
185
+ ArrowLeft: () => {
186
+ if (isOpen) return toggle(node);
187
+ focusNode(enabled.find((item) => item.node === parent));
188
+ },
189
+ Enter: () => activate(node),
190
+ " ": () => activate(node)
191
+ };
192
+ const action = actions[event.key];
193
+ if (!action) return;
194
+ event.preventDefault();
195
+ action();
196
+ };
197
+ const focusHandler = (event) => {
198
+ var _a2;
199
+ if (onFocus) onFocus(event);
200
+ const value = (_a2 = event.target.closest(
201
+ '[role="treeitem"]'
202
+ )) == null ? void 0 : _a2.dataset.value;
203
+ if (value !== void 0) setFocused(value);
204
+ };
205
+ const config = { selected, expanded, tabbable, activate, register };
206
+ const treeStyle = {
207
+ margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`,
208
+ width: SCALES.width(1, "auto"),
209
+ fontSize: SCALES.font(0.875),
210
+ "--tree-color": theme.palette.accents_6,
211
+ "--tree-hover-bg": theme.palette.accents_1,
212
+ "--tree-selected-color": theme.palette.foreground,
213
+ "--tree-selected-bg": theme.palette.accents_2,
214
+ "--tree-icon-color": theme.palette.accents_5,
215
+ "--tree-disabled-color": theme.palette.accents_4,
216
+ "--tree-focus": theme.palette.primary,
217
+ "--tree-radius": theme.layout.radius,
218
+ ...style
219
+ };
220
+ return /* @__PURE__ */ jsx2(TreeContext.Provider, { value: config, children: /* @__PURE__ */ jsx2(
221
+ "ul",
222
+ {
223
+ ref,
224
+ role: "tree",
225
+ className: use_classes_default(Tree_module_css_default.tree, className),
226
+ ...props,
227
+ style: treeStyle,
228
+ onKeyDown: keyDownHandler,
229
+ onFocus: focusHandler,
230
+ children: data.map((node) => /* @__PURE__ */ jsx2(TreeNode_default, { node, level: 1 }, node.value))
231
+ }
232
+ ) });
233
+ }
234
+ );
235
+ TreeComponent.displayName = "BolioUITree";
236
+ var Tree = with_scale_default(TreeComponent);
237
+ var Tree_default = Tree;
238
+
239
+ // core/Tree/index.ts
240
+ var Tree_default2 = Tree_default;
241
+
242
+ export {
243
+ Tree_default2 as Tree_default
244
+ };
@@ -0,0 +1,212 @@
1
+ import {
2
+ use_scale_default,
3
+ with_scale_default
4
+ } from "./chunk-MAICNLTY.js";
5
+ import {
6
+ use_theme_default
7
+ } from "./chunk-V5I4ORQQ.js";
8
+ import {
9
+ use_classes_default
10
+ } from "./chunk-5KUROAEP.js";
11
+
12
+ // core/Carousel/Carousel.tsx
13
+ import React, { useEffect, useRef, useState } from "react";
14
+
15
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Carousel/Carousel.module.css.bolio-css-module-source
16
+ var Carousel_module_css_default = { "carousel": "Carousel-module_carousel__Rr2by", "viewport": "Carousel-module_viewport__rbEeR", "slide": "Carousel-module_slide__xIqxO", "footer": "Carousel-module_footer__ySplI", "control": "Carousel-module_control__SdAV-", "indicator": "Carousel-module_indicator__YSuaU", "indicators": "Carousel-module_indicators__ZtrIN" };
17
+
18
+ // core/Carousel/Carousel.tsx
19
+ import { jsx, jsxs } from "react/jsx-runtime";
20
+ var CarouselComponent = React.forwardRef(
21
+ ({
22
+ slidesToShow = 1,
23
+ gap = "1rem",
24
+ controls = true,
25
+ indicators = true,
26
+ value,
27
+ initialValue = 0,
28
+ onChange,
29
+ previousLabel = "Previous slide",
30
+ nextLabel = "Next slide",
31
+ slideLabel = (index, count) => `${index + 1} of ${count}`,
32
+ indicatorLabel = (index) => `Go to slide ${index + 1}`,
33
+ className = "",
34
+ children,
35
+ style,
36
+ ...props
37
+ }, ref) => {
38
+ const theme = use_theme_default();
39
+ const { SCALES } = use_scale_default();
40
+ const slides = React.Children.toArray(children).filter(React.isValidElement);
41
+ const visible = Math.max(1, Math.floor(slidesToShow));
42
+ const positions = Math.max(1, slides.length - visible + 1);
43
+ const viewport = useRef(null);
44
+ const settle = useRef(void 0);
45
+ const [selfIndex, setSelfIndex] = useState(initialValue);
46
+ const isControlled = value !== void 0;
47
+ const index = Math.min(isControlled ? value : selfIndex, positions - 1);
48
+ const latest = useRef(index);
49
+ latest.current = index;
50
+ const commit = (next) => {
51
+ if (next === latest.current) return;
52
+ latest.current = next;
53
+ if (!isControlled) setSelfIndex(next);
54
+ if (onChange) onChange(next);
55
+ };
56
+ const scrollTo = (next) => {
57
+ var _a;
58
+ const element = (_a = viewport.current) == null ? void 0 : _a.children[next];
59
+ if (viewport.current && element)
60
+ viewport.current.scrollLeft = element.offsetLeft;
61
+ };
62
+ const go = (next) => {
63
+ const target = Math.max(0, Math.min(next, positions - 1));
64
+ scrollTo(target);
65
+ commit(target);
66
+ };
67
+ const scrollHandler = () => {
68
+ window.clearTimeout(settle.current);
69
+ settle.current = window.setTimeout(() => {
70
+ const element = viewport.current;
71
+ if (!element) return;
72
+ const offsets = Array.from(element.children).map(
73
+ (child) => child.offsetLeft
74
+ );
75
+ const closest = offsets.reduce(
76
+ (best, offset, position) => Math.abs(offset - element.scrollLeft) < Math.abs(offsets[best] - element.scrollLeft) ? position : best,
77
+ 0
78
+ );
79
+ commit(Math.min(closest, positions - 1));
80
+ }, 100);
81
+ };
82
+ useEffect(() => () => window.clearTimeout(settle.current), []);
83
+ useEffect(() => {
84
+ if (value !== void 0) scrollTo(Math.min(value, positions - 1));
85
+ }, [value]);
86
+ const carouselStyle = {
87
+ width: SCALES.width(1, "100%"),
88
+ margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`,
89
+ fontSize: SCALES.font(0.875),
90
+ "--carousel-visible": visible,
91
+ "--carousel-gap": gap,
92
+ "--carousel-border": theme.palette.accents_2,
93
+ "--carousel-color": theme.palette.accents_6,
94
+ "--carousel-hover-bg": theme.palette.accents_1,
95
+ "--carousel-dot": theme.palette.accents_3,
96
+ "--carousel-dot-active": theme.palette.foreground,
97
+ "--carousel-focus": theme.palette.primary,
98
+ "--carousel-radius": theme.layout.radius,
99
+ ...style
100
+ };
101
+ const showFooter = positions > 1 && (controls || indicators);
102
+ return /* @__PURE__ */ jsxs(
103
+ "div",
104
+ {
105
+ ref,
106
+ role: "region",
107
+ "aria-roledescription": "carousel",
108
+ className: use_classes_default(Carousel_module_css_default.carousel, className),
109
+ ...props,
110
+ style: carouselStyle,
111
+ children: [
112
+ /* @__PURE__ */ jsx(
113
+ "div",
114
+ {
115
+ ref: viewport,
116
+ className: Carousel_module_css_default.viewport,
117
+ tabIndex: 0,
118
+ onScroll: scrollHandler,
119
+ children: slides.map((slide, position) => {
120
+ var _a;
121
+ return /* @__PURE__ */ jsx(
122
+ "div",
123
+ {
124
+ role: "group",
125
+ "aria-roledescription": "slide",
126
+ "aria-label": slideLabel(position, slides.length),
127
+ className: Carousel_module_css_default.slide,
128
+ children: slide
129
+ },
130
+ (_a = slide.key) != null ? _a : position
131
+ );
132
+ })
133
+ }
134
+ ),
135
+ showFooter && /* @__PURE__ */ jsxs("div", { className: Carousel_module_css_default.footer, children: [
136
+ controls && /* @__PURE__ */ jsx(
137
+ "button",
138
+ {
139
+ type: "button",
140
+ className: Carousel_module_css_default.control,
141
+ "aria-label": previousLabel,
142
+ disabled: index === 0,
143
+ onClick: () => go(index - 1),
144
+ children: /* @__PURE__ */ jsx(
145
+ "svg",
146
+ {
147
+ viewBox: "0 0 24 24",
148
+ width: "1.25em",
149
+ height: "1.25em",
150
+ fill: "none",
151
+ stroke: "currentColor",
152
+ strokeWidth: "2",
153
+ strokeLinecap: "round",
154
+ strokeLinejoin: "round",
155
+ "aria-hidden": "true",
156
+ children: /* @__PURE__ */ jsx("path", { d: "M15 6l-6 6 6 6" })
157
+ }
158
+ )
159
+ }
160
+ ),
161
+ indicators && /* @__PURE__ */ jsx("div", { className: Carousel_module_css_default.indicators, children: Array.from({ length: positions }, (_, position) => /* @__PURE__ */ jsx(
162
+ "button",
163
+ {
164
+ type: "button",
165
+ className: Carousel_module_css_default.indicator,
166
+ "aria-label": indicatorLabel(position),
167
+ "aria-current": position === index || void 0,
168
+ onClick: () => go(position)
169
+ },
170
+ position
171
+ )) }),
172
+ controls && /* @__PURE__ */ jsx(
173
+ "button",
174
+ {
175
+ type: "button",
176
+ className: Carousel_module_css_default.control,
177
+ "aria-label": nextLabel,
178
+ disabled: index === positions - 1,
179
+ onClick: () => go(index + 1),
180
+ children: /* @__PURE__ */ jsx(
181
+ "svg",
182
+ {
183
+ viewBox: "0 0 24 24",
184
+ width: "1.25em",
185
+ height: "1.25em",
186
+ fill: "none",
187
+ stroke: "currentColor",
188
+ strokeWidth: "2",
189
+ strokeLinecap: "round",
190
+ strokeLinejoin: "round",
191
+ "aria-hidden": "true",
192
+ children: /* @__PURE__ */ jsx("path", { d: "M9 6l6 6-6 6" })
193
+ }
194
+ )
195
+ }
196
+ )
197
+ ] })
198
+ ]
199
+ }
200
+ );
201
+ }
202
+ );
203
+ CarouselComponent.displayName = "BolioUICarousel";
204
+ var Carousel = with_scale_default(CarouselComponent);
205
+ var Carousel_default = Carousel;
206
+
207
+ // core/Carousel/index.ts
208
+ var Carousel_default2 = Carousel_default;
209
+
210
+ export {
211
+ Carousel_default2 as Carousel_default
212
+ };