@bolio-ui/core 3.0.0-alpha.2 → 3.0.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 (171) hide show
  1. package/dist/Alert/Alert.d.ts +20 -0
  2. package/dist/Alert/index.d.ts +3 -0
  3. package/dist/Alert/index.js +16 -0
  4. package/dist/BolioUIProvider/index.js +7 -6
  5. package/dist/Button/index.js +3 -3
  6. package/dist/ButtonDropdown/index.js +3 -2
  7. package/dist/Calendar/index.js +2 -2
  8. package/dist/Chip/Chip.d.ts +17 -0
  9. package/dist/Chip/ChipContext.d.ts +11 -0
  10. package/dist/Chip/ChipGroup.d.ts +16 -0
  11. package/dist/Chip/index.d.ts +9 -0
  12. package/dist/Chip/index.js +15 -0
  13. package/dist/ColorInput/index.js +3 -2
  14. package/dist/Combobox/index.js +3 -2
  15. package/dist/Command/index.js +9 -8
  16. package/dist/ContextMenu/index.js +5 -4
  17. package/dist/DatePicker/index.js +4 -3
  18. package/dist/DateRangePicker/index.js +4 -3
  19. package/dist/Drawer/index.js +6 -5
  20. package/dist/Grid/Grid.d.ts +16 -16
  21. package/dist/Grid/GridContainer.d.ts +16 -16
  22. package/dist/Mention/Mention.d.ts +25 -0
  23. package/dist/Mention/index.d.ts +3 -0
  24. package/dist/Mention/index.js +17 -0
  25. package/dist/Menu/index.js +4 -3
  26. package/dist/Modal/index.js +8 -7
  27. package/dist/Note/Note.d.ts +10 -0
  28. package/dist/Note/index.js +3 -2
  29. package/dist/Popover/index.js +4 -3
  30. package/dist/Select/index.js +7 -6
  31. package/dist/Table/index.js +3 -3
  32. package/dist/Toolbar/Toolbar.d.ts +11 -0
  33. package/dist/Toolbar/ToolbarSeparator.d.ts +4 -0
  34. package/dist/Toolbar/index.d.ts +9 -0
  35. package/dist/Toolbar/index.js +14 -0
  36. package/dist/Tooltip/index.js +3 -2
  37. package/dist/Tour/index.js +5 -4
  38. package/dist/{chunk-PGQYW6YF.js → chunk-25NFUHLR.js} +12 -8
  39. package/dist/{chunk-AFBCMW2I.js → chunk-26KDVRFS.js} +1 -3
  40. package/dist/{chunk-4ZGR7UMX.js → chunk-4DH6SOK4.js} +10 -6
  41. package/dist/chunk-CGS2MT3G.js +10 -0
  42. package/dist/{chunk-6ZBFUZSL.js → chunk-CU6SNPIM.js} +25 -22
  43. package/dist/chunk-CY5KTINE.js +107 -0
  44. package/dist/{chunk-IJGIEX5J.js → chunk-DEMQXB46.js} +6 -2
  45. package/dist/{chunk-3S6G7WGK.js → chunk-DYYSUJ35.js} +2 -2
  46. package/dist/chunk-EUYSKHRS.js +13 -0
  47. package/dist/{chunk-FL6J36B7.js → chunk-FLUNRVVG.js} +9 -5
  48. package/dist/chunk-FQWH4PDK.js +165 -0
  49. package/dist/chunk-FSO65ZAH.js +249 -0
  50. package/dist/{chunk-2EYJZXS4.js → chunk-ICACLCJR.js} +13 -8
  51. package/dist/{chunk-XF4TPE2W.js → chunk-IL7L3BEL.js} +7 -2
  52. package/dist/{chunk-MGHMAZRL.js → chunk-KRSISARC.js} +7 -3
  53. package/dist/{chunk-4QA7Z7VP.js → chunk-M64V32WO.js} +6 -3
  54. package/dist/chunk-Q3I54DUS.js +131 -0
  55. package/dist/{chunk-SGWX6H4Y.js → chunk-RWRFOGCU.js} +6 -2
  56. package/dist/{chunk-STYC6O24.js → chunk-SJVWKNGY.js} +10 -6
  57. package/dist/{chunk-P245HSVB.js → chunk-TLVSZCKU.js} +2 -1
  58. package/dist/{chunk-AG2NWQYL.js → chunk-WCTANCLG.js} +3 -1
  59. package/dist/{chunk-DIMJQLWY.js → chunk-XUNC7RB7.js} +9 -5
  60. package/dist/{chunk-GGCVPMXO.js → chunk-Y432C24Z.js} +2 -2
  61. package/dist/{chunk-BHQRX76X.js → chunk-YLLPYRJH.js} +12 -7
  62. package/dist/css/Alert.css +53 -0
  63. package/dist/css/Chip-ChipGroup.css +8 -0
  64. package/dist/css/Chip.css +65 -0
  65. package/dist/css/ColorInput.css +7 -1
  66. package/dist/css/ColorPicker.css +5 -1
  67. package/dist/css/Combobox.css +1 -0
  68. package/dist/css/DatePicker.css +1 -0
  69. package/dist/css/DateRangePicker.css +1 -0
  70. package/dist/css/Input.css +1 -0
  71. package/dist/css/Mention.css +93 -0
  72. package/dist/css/Modal-ModalAction.css +6 -1
  73. package/dist/css/Modal-ModalActions.css +9 -2
  74. package/dist/css/NumberInput.css +1 -0
  75. package/dist/css/PinInput.css +1 -0
  76. package/dist/css/TagsInput.css +1 -0
  77. package/dist/css/Textarea.css +1 -0
  78. package/dist/css/Toolbar.css +32 -0
  79. package/dist/index.d.ts +8 -0
  80. package/dist/index.js +78 -60
  81. package/dist/styles.css +3487 -3201
  82. package/dist/utils/surface.d.ts +6 -0
  83. package/esm/Alert/Alert.d.ts +20 -0
  84. package/esm/Alert/index.d.ts +3 -0
  85. package/esm/Alert/index.js +16 -0
  86. package/esm/BolioUIProvider/index.js +6 -5
  87. package/esm/Button/index.js +2 -2
  88. package/esm/ButtonDropdown/index.js +2 -1
  89. package/esm/Calendar/index.js +1 -1
  90. package/esm/Chip/Chip.d.ts +17 -0
  91. package/esm/Chip/ChipContext.d.ts +11 -0
  92. package/esm/Chip/ChipGroup.d.ts +16 -0
  93. package/esm/Chip/index.d.ts +9 -0
  94. package/esm/Chip/index.js +15 -0
  95. package/esm/ColorInput/index.js +2 -1
  96. package/esm/Combobox/index.js +2 -1
  97. package/esm/Command/index.js +8 -7
  98. package/esm/ContextMenu/index.js +4 -3
  99. package/esm/DatePicker/index.js +3 -2
  100. package/esm/DateRangePicker/index.js +3 -2
  101. package/esm/Drawer/index.js +5 -4
  102. package/esm/Grid/Grid.d.ts +16 -16
  103. package/esm/Grid/GridContainer.d.ts +16 -16
  104. package/esm/Mention/Mention.d.ts +25 -0
  105. package/esm/Mention/index.d.ts +3 -0
  106. package/esm/Mention/index.js +17 -0
  107. package/esm/Menu/index.js +3 -2
  108. package/esm/Modal/index.js +7 -6
  109. package/esm/Note/Note.d.ts +10 -0
  110. package/esm/Note/index.js +2 -1
  111. package/esm/Popover/index.js +3 -2
  112. package/esm/Select/index.js +6 -5
  113. package/esm/Table/index.js +2 -2
  114. package/esm/Toolbar/Toolbar.d.ts +11 -0
  115. package/esm/Toolbar/ToolbarSeparator.d.ts +4 -0
  116. package/esm/Toolbar/index.d.ts +9 -0
  117. package/esm/Toolbar/index.js +14 -0
  118. package/esm/Tooltip/index.js +2 -1
  119. package/esm/Tour/index.js +4 -3
  120. package/esm/{chunk-PGQYW6YF.js → chunk-25NFUHLR.js} +7 -3
  121. package/esm/{chunk-AFBCMW2I.js → chunk-26KDVRFS.js} +2 -4
  122. package/esm/{chunk-4ZGR7UMX.js → chunk-4DH6SOK4.js} +10 -6
  123. package/esm/chunk-CGS2MT3G.js +10 -0
  124. package/esm/{chunk-6ZBFUZSL.js → chunk-CU6SNPIM.js} +15 -12
  125. package/esm/chunk-CY5KTINE.js +107 -0
  126. package/esm/{chunk-IJGIEX5J.js → chunk-DEMQXB46.js} +6 -2
  127. package/esm/{chunk-3S6G7WGK.js → chunk-DYYSUJ35.js} +1 -1
  128. package/esm/chunk-EUYSKHRS.js +13 -0
  129. package/esm/{chunk-FL6J36B7.js → chunk-FLUNRVVG.js} +8 -4
  130. package/esm/chunk-FQWH4PDK.js +165 -0
  131. package/esm/chunk-FSO65ZAH.js +249 -0
  132. package/esm/{chunk-2EYJZXS4.js → chunk-ICACLCJR.js} +8 -3
  133. package/esm/{chunk-XF4TPE2W.js → chunk-IL7L3BEL.js} +7 -2
  134. package/esm/{chunk-MGHMAZRL.js → chunk-KRSISARC.js} +7 -3
  135. package/esm/{chunk-4QA7Z7VP.js → chunk-M64V32WO.js} +5 -2
  136. package/esm/chunk-Q3I54DUS.js +131 -0
  137. package/esm/{chunk-SGWX6H4Y.js → chunk-RWRFOGCU.js} +6 -2
  138. package/esm/{chunk-STYC6O24.js → chunk-SJVWKNGY.js} +7 -3
  139. package/esm/{chunk-P245HSVB.js → chunk-TLVSZCKU.js} +2 -1
  140. package/esm/{chunk-AG2NWQYL.js → chunk-WCTANCLG.js} +3 -1
  141. package/esm/{chunk-DIMJQLWY.js → chunk-XUNC7RB7.js} +9 -5
  142. package/esm/{chunk-GGCVPMXO.js → chunk-Y432C24Z.js} +1 -1
  143. package/esm/{chunk-BHQRX76X.js → chunk-YLLPYRJH.js} +8 -3
  144. package/esm/css/Alert.css +53 -0
  145. package/esm/css/Chip-ChipGroup.css +8 -0
  146. package/esm/css/Chip.css +65 -0
  147. package/esm/css/ColorInput.css +7 -1
  148. package/esm/css/ColorPicker.css +5 -1
  149. package/esm/css/Combobox.css +1 -0
  150. package/esm/css/DatePicker.css +1 -0
  151. package/esm/css/DateRangePicker.css +1 -0
  152. package/esm/css/Input.css +1 -0
  153. package/esm/css/Mention.css +93 -0
  154. package/esm/css/Modal-ModalAction.css +6 -1
  155. package/esm/css/Modal-ModalActions.css +9 -2
  156. package/esm/css/NumberInput.css +1 -0
  157. package/esm/css/PinInput.css +1 -0
  158. package/esm/css/TagsInput.css +1 -0
  159. package/esm/css/Textarea.css +1 -0
  160. package/esm/css/Toolbar.css +32 -0
  161. package/esm/index.d.ts +8 -0
  162. package/esm/index.js +94 -76
  163. package/esm/styles.css +3482 -3196
  164. package/esm/utils/surface.d.ts +6 -0
  165. package/package.json +1 -1
  166. package/dist/{chunk-DXHNQANX.js → chunk-TPZUTHTQ.js} +3 -3
  167. package/dist/{chunk-TKIUVNKP.js → chunk-XKJDF225.js} +2 -2
  168. package/dist/{chunk-ZNDN2VPZ.js → chunk-Y5CFWIGV.js} +2 -2
  169. package/esm/{chunk-DXHNQANX.js → chunk-TPZUTHTQ.js} +3 -3
  170. package/esm/{chunk-TKIUVNKP.js → chunk-XKJDF225.js} +3 -3
  171. package/esm/{chunk-ZNDN2VPZ.js → chunk-Y5CFWIGV.js} +3 -3
@@ -0,0 +1,165 @@
1
+ import {
2
+ getVariantColors
3
+ } from "./chunk-GJZT47MP.js";
4
+ import {
5
+ use_scale_default,
6
+ with_scale_default
7
+ } from "./chunk-MAICNLTY.js";
8
+ import {
9
+ use_theme_default
10
+ } from "./chunk-V5I4ORQQ.js";
11
+ import {
12
+ use_classes_default
13
+ } from "./chunk-5KUROAEP.js";
14
+
15
+ // core/Chip/Chip.tsx
16
+ import React2, { useState } from "react";
17
+
18
+ // core/Chip/ChipContext.ts
19
+ import React from "react";
20
+ var ChipContext = React.createContext(null);
21
+ var useChipContext = () => React.useContext(ChipContext);
22
+
23
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Chip/Chip.module.css.bolio-css-module-source
24
+ var Chip_module_css_default = { "chip": "Chip-module_chip__r494r", "input": "Chip-module_input__GhNGk", "text": "Chip-module_text__sYRMh" };
25
+
26
+ // core/Chip/Chip.tsx
27
+ import { jsx, jsxs } from "react/jsx-runtime";
28
+ var ChipComponent = React2.forwardRef(
29
+ ({
30
+ value,
31
+ checked: customChecked,
32
+ initialChecked = false,
33
+ onChange,
34
+ type = "primary",
35
+ disabled = false,
36
+ className = "",
37
+ children,
38
+ style,
39
+ ...props
40
+ }, ref) => {
41
+ const theme = use_theme_default();
42
+ const { SCALES } = use_scale_default();
43
+ const group = useChipContext();
44
+ const [selfChecked, setSelfChecked] = useState(initialChecked);
45
+ const checked = group ? group.value.includes(value) : customChecked !== void 0 ? customChecked : selfChecked;
46
+ const changeHandler = (event) => {
47
+ if (group) {
48
+ if (group.toggle) group.toggle(value);
49
+ return;
50
+ }
51
+ setSelfChecked(event.target.checked);
52
+ if (onChange) onChange(event.target.checked);
53
+ };
54
+ const { bg, color, border } = getVariantColors(theme.palette, type, "light");
55
+ const chipStyle = {
56
+ height: SCALES.height(2),
57
+ margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`,
58
+ fontSize: SCALES.font(0.875),
59
+ "--chip-color": theme.palette.accents_6,
60
+ "--chip-border": theme.palette.accents_3,
61
+ "--chip-hover-bg": theme.palette.accents_1,
62
+ "--chip-checked-bg": bg,
63
+ "--chip-checked-color": color,
64
+ "--chip-checked-border": border,
65
+ "--chip-focus": theme.palette[type],
66
+ ...style
67
+ };
68
+ return /* @__PURE__ */ jsxs("label", { className: use_classes_default(Chip_module_css_default.chip, className), style: chipStyle, children: [
69
+ /* @__PURE__ */ jsx(
70
+ "input",
71
+ {
72
+ ref,
73
+ type: group && !group.multiple ? "radio" : "checkbox",
74
+ className: Chip_module_css_default.input,
75
+ name: group == null ? void 0 : group.name,
76
+ value,
77
+ checked,
78
+ disabled: disabled || (group == null ? void 0 : group.disabled),
79
+ onChange: changeHandler,
80
+ ...props
81
+ }
82
+ ),
83
+ /* @__PURE__ */ jsxs("span", { className: Chip_module_css_default.text, children: [
84
+ checked && /* @__PURE__ */ jsx(
85
+ "svg",
86
+ {
87
+ viewBox: "0 0 24 24",
88
+ width: "14",
89
+ height: "14",
90
+ fill: "none",
91
+ stroke: "currentColor",
92
+ strokeWidth: "3",
93
+ strokeLinecap: "round",
94
+ strokeLinejoin: "round",
95
+ "aria-hidden": "true",
96
+ children: /* @__PURE__ */ jsx("path", { d: "m5 12 5 5L20 7" })
97
+ }
98
+ ),
99
+ children
100
+ ] })
101
+ ] });
102
+ }
103
+ );
104
+ ChipComponent.displayName = "BolioUIChip";
105
+ var Chip = with_scale_default(ChipComponent);
106
+ var Chip_default = Chip;
107
+
108
+ // core/Chip/ChipGroup.tsx
109
+ import React3, { useId, useMemo, useState as useState2 } from "react";
110
+
111
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Chip/ChipGroup.module.css.bolio-css-module-source
112
+ var ChipGroup_module_css_default = { "group": "ChipGroup-module_group__6ARIk" };
113
+
114
+ // core/Chip/ChipGroup.tsx
115
+ import { jsx as jsx2 } from "react/jsx-runtime";
116
+ var ChipGroup = React3.forwardRef(
117
+ ({
118
+ value: customValue,
119
+ initialValue = [],
120
+ onChange,
121
+ multiple = false,
122
+ disabled = false,
123
+ className = "",
124
+ children,
125
+ ...props
126
+ }, ref) => {
127
+ const name = useId();
128
+ const [selfValue, setSelfValue] = useState2(initialValue);
129
+ const value = customValue !== void 0 ? customValue : selfValue;
130
+ const providerValue = useMemo(
131
+ () => ({
132
+ name,
133
+ multiple,
134
+ value,
135
+ disabled,
136
+ toggle: (chip) => {
137
+ const next = !multiple ? [chip] : value.includes(chip) ? value.filter((v) => v !== chip) : [...value, chip];
138
+ setSelfValue(next);
139
+ if (onChange) onChange(next);
140
+ }
141
+ }),
142
+ [name, multiple, value, disabled, onChange]
143
+ );
144
+ return /* @__PURE__ */ jsx2(ChipContext.Provider, { value: providerValue, children: /* @__PURE__ */ jsx2(
145
+ "div",
146
+ {
147
+ ref,
148
+ role: multiple ? "group" : "radiogroup",
149
+ className: use_classes_default(ChipGroup_module_css_default.group, className),
150
+ ...props,
151
+ children
152
+ }
153
+ ) });
154
+ }
155
+ );
156
+ ChipGroup.displayName = "BolioUIChipGroup";
157
+ var ChipGroup_default = ChipGroup;
158
+
159
+ // core/Chip/index.ts
160
+ Chip_default.Group = ChipGroup_default;
161
+ var Chip_default2 = Chip_default;
162
+
163
+ export {
164
+ Chip_default2 as Chip_default
165
+ };
@@ -0,0 +1,249 @@
1
+ import {
2
+ getColors
3
+ } from "./chunk-KBZEYKCZ.js";
4
+ import {
5
+ getSurface
6
+ } from "./chunk-EUYSKHRS.js";
7
+ import {
8
+ use_scale_default,
9
+ with_scale_default
10
+ } from "./chunk-MAICNLTY.js";
11
+ import {
12
+ use_theme_default
13
+ } from "./chunk-V5I4ORQQ.js";
14
+ import {
15
+ joinClasses,
16
+ use_classes_default
17
+ } from "./chunk-5KUROAEP.js";
18
+
19
+ // core/Mention/Mention.tsx
20
+ import React, {
21
+ useEffect,
22
+ useId,
23
+ useLayoutEffect,
24
+ useMemo,
25
+ useRef,
26
+ useState
27
+ } from "react";
28
+
29
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Mention/Mention.module.css.bolio-css-module-source
30
+ var Mention_module_css_default = { "mention": "Mention-module_mention__R3-5t", "field": "Mention-module_field__U5FXf", "list": "Mention-module_list__QQ5RM", "empty": "Mention-module_empty__YkZOO", "option": "Mention-module_option__8CupI", "active": "Mention-module_active__8GmDl", "disabled": "Mention-module_disabled__4PL94" };
31
+
32
+ // core/Mention/Mention.tsx
33
+ import { jsx, jsxs } from "react/jsx-runtime";
34
+ var getLabel = (option) => {
35
+ var _a;
36
+ return (_a = option.label) != null ? _a : option.value;
37
+ };
38
+ var escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
39
+ var MentionComponent = React.forwardRef(
40
+ ({
41
+ options,
42
+ trigger = "@",
43
+ value: customValue,
44
+ initialValue = "",
45
+ onChange,
46
+ onSelect,
47
+ placeholder,
48
+ rows = 3,
49
+ disabled = false,
50
+ type = "default",
51
+ emptyText = "No results",
52
+ className = "",
53
+ onKeyDown,
54
+ onBlur,
55
+ style,
56
+ ...props
57
+ }, ref) => {
58
+ const theme = use_theme_default();
59
+ const surface = getSurface(theme);
60
+ const { SCALES } = use_scale_default();
61
+ const colors = getColors(theme.palette, type, disabled, {});
62
+ const baseId = useId();
63
+ const listId = `${baseId}-list`;
64
+ const optionId = (index) => `${baseId}-option-${index}`;
65
+ const field = useRef(null);
66
+ const setRef = (node) => {
67
+ field.current = node;
68
+ if (typeof ref === "function") ref(node);
69
+ else if (ref) ref.current = node;
70
+ };
71
+ const isControlled = customValue !== void 0;
72
+ const [selfValue, setSelfValue] = useState(initialValue);
73
+ const text = isControlled ? customValue : selfValue;
74
+ const [caret, setCaret] = useState(text.length);
75
+ const [dismissed, setDismissed] = useState(false);
76
+ const [activeIndex, setActiveIndex] = useState(-1);
77
+ const pendingCaret = useRef(null);
78
+ const token = useMemo(() => {
79
+ const t = escapeRegExp(trigger);
80
+ const match = new RegExp(`(^|\\s)${t}([^\\s${t}]*)$`).exec(
81
+ text.slice(0, caret)
82
+ );
83
+ return match ? { query: match[2], start: caret - match[2].length - trigger.length } : null;
84
+ }, [text, caret, trigger]);
85
+ const visible = useMemo(
86
+ () => token ? options.filter(
87
+ (option) => getLabel(option).toLowerCase().includes(token.query.toLowerCase())
88
+ ) : [],
89
+ [options, token]
90
+ );
91
+ const open = !!token && !dismissed && !disabled;
92
+ const expanded = open && visible.length > 0;
93
+ useEffect(() => {
94
+ setActiveIndex(
95
+ open ? visible.findIndex((option) => !option.disabled) : -1
96
+ );
97
+ }, [open, token == null ? void 0 : token.query]);
98
+ useEffect(() => {
99
+ var _a, _b;
100
+ if (activeIndex < 0) return;
101
+ (_b = (_a = document.getElementById(optionId(activeIndex))) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, { block: "nearest" });
102
+ }, [activeIndex]);
103
+ useLayoutEffect(() => {
104
+ if (pendingCaret.current === null || !field.current) return;
105
+ field.current.setSelectionRange(
106
+ pendingCaret.current,
107
+ pendingCaret.current
108
+ );
109
+ pendingCaret.current = null;
110
+ }, [text]);
111
+ const update = (next) => {
112
+ if (!isControlled) setSelfValue(next);
113
+ if (onChange) onChange(next);
114
+ };
115
+ const choose = (option) => {
116
+ if (option.disabled || !token) return;
117
+ const inserted = `${trigger}${option.value} `;
118
+ const next = text.slice(0, token.start) + inserted + text.slice(caret);
119
+ const position = token.start + inserted.length;
120
+ pendingCaret.current = position;
121
+ setCaret(position);
122
+ update(next);
123
+ if (onSelect) onSelect(option);
124
+ };
125
+ const changeHandler = (event) => {
126
+ setCaret(event.target.selectionStart);
127
+ setDismissed(false);
128
+ update(event.target.value);
129
+ };
130
+ const move = (direction) => {
131
+ const count = visible.length;
132
+ let index = activeIndex;
133
+ for (let step = 0; step < count; step++) {
134
+ index = (index + direction + count) % count;
135
+ if (!visible[index].disabled) return setActiveIndex(index);
136
+ }
137
+ };
138
+ const keyDownHandler = (event) => {
139
+ if (onKeyDown) onKeyDown(event);
140
+ if (event.defaultPrevented || !expanded) return;
141
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
142
+ event.preventDefault();
143
+ move(event.key === "ArrowDown" ? 1 : -1);
144
+ } else if ((event.key === "Enter" || event.key === "Tab") && activeIndex >= 0) {
145
+ event.preventDefault();
146
+ choose(visible[activeIndex]);
147
+ } else if (event.key === "Escape") {
148
+ event.preventDefault();
149
+ setDismissed(true);
150
+ }
151
+ };
152
+ const syncCaret = (event) => {
153
+ const next = event.currentTarget.selectionStart;
154
+ if (next !== caret) {
155
+ setCaret(next);
156
+ setDismissed(false);
157
+ }
158
+ };
159
+ const blurHandler = (event) => {
160
+ if (onBlur) onBlur(event);
161
+ setDismissed(true);
162
+ };
163
+ const mentionStyle = {
164
+ "--mention-font-size": SCALES.font(0.875),
165
+ "--mention-width": SCALES.width(1, "100%"),
166
+ "--mention-height": SCALES.height(1, "auto"),
167
+ "--mention-margin-top": SCALES.mt(0),
168
+ "--mention-margin-right": SCALES.mr(0),
169
+ "--mention-margin-bottom": SCALES.mb(0),
170
+ "--mention-margin-left": SCALES.ml(0),
171
+ "--mention-text-color": theme.palette.foreground,
172
+ "--mention-bg": surface.bg,
173
+ "--mention-border-color": theme.palette.border,
174
+ "--mention-radius": theme.layout.radius,
175
+ "--mention-field-color": colors.color,
176
+ "--mention-field-bg": colors.bgColor,
177
+ "--mention-field-border": colors.borderColor,
178
+ "--mention-field-hover-bg": colors.hoverBgColor,
179
+ "--mention-field-hover-border": colors.hoverBorder,
180
+ "--mention-focus-border-color": colors.focusBorder,
181
+ "--mention-placeholder-color": colors.placeholderColor,
182
+ "--mention-shadow": surface.shadow,
183
+ "--mention-active-bg": surface.hover,
184
+ "--mention-empty-color": theme.palette.accents_5,
185
+ ...style
186
+ };
187
+ return /* @__PURE__ */ jsxs(
188
+ "div",
189
+ {
190
+ className: use_classes_default(Mention_module_css_default.mention, className),
191
+ style: mentionStyle,
192
+ children: [
193
+ /* @__PURE__ */ jsx(
194
+ "textarea",
195
+ {
196
+ ref: setRef,
197
+ "aria-autocomplete": "list",
198
+ "aria-controls": expanded ? listId : void 0,
199
+ "aria-activedescendant": expanded && activeIndex >= 0 ? optionId(activeIndex) : void 0,
200
+ value: text,
201
+ rows,
202
+ placeholder,
203
+ disabled,
204
+ onChange: changeHandler,
205
+ onKeyDown: keyDownHandler,
206
+ onKeyUp: syncCaret,
207
+ onClick: syncCaret,
208
+ onSelect: syncCaret,
209
+ onBlur: blurHandler,
210
+ className: Mention_module_css_default.field,
211
+ ...props
212
+ }
213
+ ),
214
+ expanded && /* @__PURE__ */ jsx("ul", { id: listId, role: "listbox", className: Mention_module_css_default.list, children: visible.map((option, index) => /* @__PURE__ */ jsx(
215
+ "li",
216
+ {
217
+ id: optionId(index),
218
+ role: "option",
219
+ "aria-selected": index === activeIndex,
220
+ "aria-disabled": option.disabled || void 0,
221
+ className: joinClasses(Mention_module_css_default.option, {
222
+ [Mention_module_css_default.active]: index === activeIndex,
223
+ [Mention_module_css_default.disabled]: option.disabled
224
+ }),
225
+ onMouseDown: (event) => {
226
+ event.preventDefault();
227
+ choose(option);
228
+ },
229
+ onMouseMove: () => !option.disabled && setActiveIndex(index),
230
+ children: getLabel(option)
231
+ },
232
+ option.value
233
+ )) }),
234
+ open && visible.length === 0 && /* @__PURE__ */ jsx("div", { className: Mention_module_css_default.empty, children: emptyText })
235
+ ]
236
+ }
237
+ );
238
+ }
239
+ );
240
+ MentionComponent.displayName = "BolioUIMention";
241
+ var Mention = with_scale_default(MentionComponent);
242
+ var Mention_default = Mention;
243
+
244
+ // core/Mention/index.ts
245
+ var Mention_default2 = Mention_default;
246
+
247
+ export {
248
+ Mention_default2 as Mention_default
249
+ };
@@ -6,10 +6,13 @@ import {
6
6
  fromISO,
7
7
  startOfDay,
8
8
  toISO
9
- } from "./chunk-P245HSVB.js";
9
+ } from "./chunk-TLVSZCKU.js";
10
10
  import {
11
11
  use_click_away_default
12
12
  } from "./chunk-DGXZP4VJ.js";
13
+ import {
14
+ getSurface
15
+ } from "./chunk-EUYSKHRS.js";
13
16
  import {
14
17
  use_scale_default,
15
18
  with_scale_default
@@ -52,6 +55,7 @@ var DatePickerComponent = React.forwardRef(
52
55
  ...props
53
56
  }, ref) => {
54
57
  const theme = use_theme_default();
58
+ const surface = getSurface(theme);
55
59
  const { SCALES } = use_scale_default();
56
60
  const colors = getColors(theme.palette, type, disabled, {
57
61
  filled,
@@ -117,7 +121,8 @@ var DatePickerComponent = React.forwardRef(
117
121
  "--datepicker-margin-bottom": SCALES.mb(0),
118
122
  "--datepicker-margin-left": SCALES.ml(0),
119
123
  "--datepicker-text-color": theme.palette.foreground,
120
- "--datepicker-bg": theme.palette.background,
124
+ "--datepicker-bg": surface.bg,
125
+ "--calendar-popup-hover": surface.hover,
121
126
  "--datepicker-border-color": theme.palette.border,
122
127
  "--datepicker-radius": rounded ? "25px" : theme.layout.radius,
123
128
  "--datepicker-popup-radius": theme.layout.radius,
@@ -131,7 +136,7 @@ var DatePickerComponent = React.forwardRef(
131
136
  "--datepicker-toggle-color": colors.iconColor,
132
137
  "--datepicker-toggle-hover-color": colors.color,
133
138
  "--datepicker-toggle-disabled-color": colors.iconColor,
134
- "--datepicker-shadow": theme.expressiveness.shadowMedium
139
+ "--datepicker-shadow": surface.shadow
135
140
  };
136
141
  return /* @__PURE__ */ jsxs(
137
142
  "div",
@@ -20,6 +20,9 @@ import {
20
20
  import {
21
21
  use_click_away_default
22
22
  } from "./chunk-DGXZP4VJ.js";
23
+ import {
24
+ getSurface
25
+ } from "./chunk-EUYSKHRS.js";
23
26
  import {
24
27
  use_scale_default,
25
28
  with_scale_default
@@ -319,6 +322,8 @@ var TooltipContent = ({
319
322
  [type, theme.palette, light, ghost, subtle]
320
323
  );
321
324
  const hasShadow = type === "default";
325
+ const surface = getSurface(theme);
326
+ const bgColor = hasShadow && colors.bgColor === theme.palette.background ? surface.bg : colors.bgColor;
322
327
  const classes = use_classes_default(
323
328
  "tooltip-content",
324
329
  TooltipContent_module_css_default.tooltipContent,
@@ -350,14 +355,14 @@ var TooltipContent = ({
350
355
  const contentStyle = {
351
356
  "--tooltip-icon-offset-x": iconOffset.x,
352
357
  "--tooltip-icon-offset-y": iconOffset.y,
353
- "--tooltip-content-bg": colors.bgColor,
358
+ "--tooltip-content-bg": bgColor,
354
359
  top: rect.top,
355
360
  left: rect.left,
356
361
  transform: rect.transform,
357
362
  color: colors.color,
358
363
  border: `1px solid ${colors.borderColor}`,
359
364
  borderRadius: theme.layout.radius,
360
- boxShadow: hasShadow ? theme.expressiveness.shadowMedium : "none",
365
+ boxShadow: hasShadow ? surface.shadow : "none",
361
366
  width: SCALES.width(1, "auto"),
362
367
  height: SCALES.height(1, "auto")
363
368
  };
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  getColors
3
3
  } from "./chunk-KBZEYKCZ.js";
4
+ import {
5
+ getSurface
6
+ } from "./chunk-EUYSKHRS.js";
4
7
  import {
5
8
  use_scale_default,
6
9
  with_scale_default
@@ -50,6 +53,7 @@ var ComboboxComponent = React.forwardRef(
50
53
  ...props
51
54
  }, ref) => {
52
55
  const theme = use_theme_default();
56
+ const surface = getSurface(theme);
53
57
  const { SCALES } = use_scale_default();
54
58
  const colors = getColors(theme.palette, type, disabled, {
55
59
  filled,
@@ -148,7 +152,7 @@ var ComboboxComponent = React.forwardRef(
148
152
  "--combobox-margin-bottom": SCALES.mb(0),
149
153
  "--combobox-margin-left": SCALES.ml(0),
150
154
  "--combobox-text-color": theme.palette.foreground,
151
- "--combobox-bg": theme.palette.background,
155
+ "--combobox-bg": surface.bg,
152
156
  "--combobox-border-color": theme.palette.border,
153
157
  "--combobox-radius": rounded ? "25px" : theme.layout.radius,
154
158
  "--combobox-popup-radius": theme.layout.radius,
@@ -160,8 +164,8 @@ var ComboboxComponent = React.forwardRef(
160
164
  "--combobox-focus-border-color": colors.focusBorder,
161
165
  "--combobox-placeholder-color": colors.placeholderColor,
162
166
  "--combobox-disabled-color": theme.palette.accents_4,
163
- "--combobox-shadow": theme.expressiveness.shadowMedium,
164
- "--combobox-active-bg": theme.palette.accents_2,
167
+ "--combobox-shadow": surface.shadow,
168
+ "--combobox-active-bg": surface.hover,
165
169
  "--combobox-empty-color": theme.palette.accents_5
166
170
  };
167
171
  return /* @__PURE__ */ jsxs(
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  Modal_default
3
- } from "./chunk-6ZBFUZSL.js";
3
+ } from "./chunk-CU6SNPIM.js";
4
4
  import {
5
5
  Input_default
6
6
  } from "./chunk-NEG5UNM6.js";
7
+ import {
8
+ getSurface
9
+ } from "./chunk-EUYSKHRS.js";
7
10
  import {
8
11
  use_theme_default
9
12
  } from "./chunk-V5I4ORQQ.js";
@@ -97,7 +100,7 @@ var Command = ({
97
100
  "aria-selected": index === active,
98
101
  className: Command_module_css_default.item,
99
102
  style: {
100
- backgroundColor: index === active ? theme.palette.accents_2 : void 0
103
+ backgroundColor: index === active ? getSurface(theme).hover : void 0
101
104
  },
102
105
  onMouseEnter: () => setActive(index),
103
106
  onClick: () => select(item),
@@ -0,0 +1,131 @@
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/Toolbar/Toolbar.tsx
13
+ import React, { useEffect, useRef } from "react";
14
+
15
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Toolbar/Toolbar.module.css.bolio-css-module-source
16
+ var Toolbar_module_css_default = { "toolbar": "Toolbar-module_toolbar__GZv6U", "vertical": "Toolbar-module_vertical__bTAsV", "separator": "Toolbar-module_separator__Gs9-M" };
17
+
18
+ // core/Toolbar/Toolbar.tsx
19
+ import { jsx } from "react/jsx-runtime";
20
+ var ITEMS = "button, a[href], input, select, textarea";
21
+ var ToolbarComponent = React.forwardRef(
22
+ ({
23
+ orientation = "horizontal",
24
+ className = "",
25
+ children,
26
+ onKeyDown,
27
+ onFocus,
28
+ style,
29
+ ...props
30
+ }, innerRef) => {
31
+ const theme = use_theme_default();
32
+ const { SCALES } = use_scale_default();
33
+ const ref = useRef(null);
34
+ const current = useRef(null);
35
+ const getItems = () => {
36
+ var _a, _b;
37
+ return Array.from(
38
+ (_b = (_a = ref.current) == null ? void 0 : _a.querySelectorAll(ITEMS)) != null ? _b : []
39
+ ).filter(
40
+ (item) => !item.disabled && item.getAttribute("role") !== "separator"
41
+ );
42
+ };
43
+ useEffect(() => {
44
+ var _a;
45
+ const items = getItems();
46
+ const active = (_a = items.find((item) => item === current.current)) != null ? _a : items[0];
47
+ items.forEach(
48
+ (item) => item.setAttribute("tabindex", item === active ? "0" : "-1")
49
+ );
50
+ });
51
+ const setRef = (node) => {
52
+ ref.current = node;
53
+ if (typeof innerRef === "function") innerRef(node);
54
+ else if (innerRef) innerRef.current = node;
55
+ };
56
+ const focusHandler = (event) => {
57
+ if (onFocus) onFocus(event);
58
+ const items = getItems();
59
+ if (items.includes(event.target)) {
60
+ current.current = event.target;
61
+ items.forEach(
62
+ (item) => item.setAttribute("tabindex", item === event.target ? "0" : "-1")
63
+ );
64
+ }
65
+ };
66
+ const keyHandler = (event) => {
67
+ if (onKeyDown) onKeyDown(event);
68
+ if (event.defaultPrevented) return;
69
+ const vertical = orientation === "vertical";
70
+ const items = getItems();
71
+ const index = items.indexOf(event.target);
72
+ if (index === -1) return;
73
+ let next = -1;
74
+ if (event.key === (vertical ? "ArrowDown" : "ArrowRight"))
75
+ next = (index + 1) % items.length;
76
+ else if (event.key === (vertical ? "ArrowUp" : "ArrowLeft"))
77
+ next = (index - 1 + items.length) % items.length;
78
+ else if (event.key === "Home") next = 0;
79
+ else if (event.key === "End") next = items.length - 1;
80
+ if (next === -1) return;
81
+ event.preventDefault();
82
+ items[next].focus();
83
+ };
84
+ const toolbarStyle = {
85
+ margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`,
86
+ "--toolbar-border": theme.palette.border,
87
+ "--toolbar-radius": theme.layout.radius,
88
+ ...style
89
+ };
90
+ return /* @__PURE__ */ jsx(
91
+ "div",
92
+ {
93
+ ref: setRef,
94
+ role: "toolbar",
95
+ "aria-orientation": orientation,
96
+ className: use_classes_default(Toolbar_module_css_default.toolbar, Toolbar_module_css_default[orientation], className),
97
+ onKeyDown: keyHandler,
98
+ onFocus: focusHandler,
99
+ ...props,
100
+ style: toolbarStyle,
101
+ children
102
+ }
103
+ );
104
+ }
105
+ );
106
+ ToolbarComponent.displayName = "BolioUIToolbar";
107
+ var Toolbar = with_scale_default(ToolbarComponent);
108
+ var Toolbar_default = Toolbar;
109
+
110
+ // core/Toolbar/ToolbarSeparator.tsx
111
+ import React2 from "react";
112
+ import { jsx as jsx2 } from "react/jsx-runtime";
113
+ var ToolbarSeparator = React2.forwardRef(({ className = "", ...props }, ref) => /* @__PURE__ */ jsx2(
114
+ "div",
115
+ {
116
+ ref,
117
+ role: "separator",
118
+ className: use_classes_default(Toolbar_module_css_default.separator, className),
119
+ ...props
120
+ }
121
+ ));
122
+ ToolbarSeparator.displayName = "BolioUIToolbarSeparator";
123
+ var ToolbarSeparator_default = ToolbarSeparator;
124
+
125
+ // core/Toolbar/index.ts
126
+ Toolbar_default.Separator = ToolbarSeparator_default;
127
+ var Toolbar_default2 = Toolbar_default;
128
+
129
+ export {
130
+ Toolbar_default2 as Toolbar_default
131
+ };