@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,26 @@
1
+ import React from 'react';
2
+ import { NormalTypes } from '../utils/prop-types';
3
+ interface Props {
4
+ value?: Array<string>;
5
+ initialValue?: Array<string>;
6
+ onChange?: (tags: Array<string>) => void;
7
+ max?: number;
8
+ allowDuplicates?: boolean;
9
+ type?: NormalTypes;
10
+ rounded?: boolean;
11
+ filled?: boolean;
12
+ light?: boolean;
13
+ ghost?: boolean;
14
+ subtle?: boolean;
15
+ disabled?: boolean;
16
+ readOnly?: boolean;
17
+ error?: boolean;
18
+ errorMessage?: string;
19
+ className?: string;
20
+ }
21
+ type NativeAttrs = Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof Props | 'defaultValue' | 'type'>;
22
+ export type TagsInputProps = Props & NativeAttrs;
23
+ declare const TagsInput: import("../use-scale/with-scale").ScaleComponent<HTMLInputElement, Props & NativeAttrs & {
24
+ children?: React.ReactNode | undefined;
25
+ } & React.RefAttributes<HTMLInputElement>>;
26
+ export default TagsInput;
@@ -0,0 +1,3 @@
1
+ import TagsInput from './TagsInput';
2
+ export type { TagsInputProps } from './TagsInput';
3
+ export default TagsInput;
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+ import {
3
+ TagsInput_default
4
+ } from "../chunk-G4KB56RO.js";
5
+ import "../chunk-UOGCO6CV.js";
6
+ import "../chunk-KBZEYKCZ.js";
7
+ import "../chunk-GJZT47MP.js";
8
+ import "../chunk-MAICNLTY.js";
9
+ import "../chunk-UX2B3G6U.js";
10
+ import "../chunk-V5I4ORQQ.js";
11
+ import "../chunk-FEA5BJ35.js";
12
+ import "../chunk-X5PGXMVQ.js";
13
+ import "../chunk-SZIX7BM5.js";
14
+ import "../chunk-5KUROAEP.js";
15
+ export {
16
+ TagsInput_default as default
17
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { TreeNodeData } from './TreeContext';
3
+ export type { TreeNodeData } from './TreeContext';
4
+ interface Props {
5
+ data: Array<TreeNodeData>;
6
+ value?: string | null;
7
+ initialValue?: string | null;
8
+ onChange?: (value: string, node: TreeNodeData) => void;
9
+ expanded?: Array<string>;
10
+ initialExpanded?: Array<string>;
11
+ onExpandedChange?: (expanded: Array<string>) => void;
12
+ className?: string;
13
+ }
14
+ type NativeAttrs = Omit<React.HTMLAttributes<HTMLUListElement>, keyof Props | 'defaultValue'>;
15
+ export type TreeProps = Props & NativeAttrs;
16
+ declare const Tree: import("../use-scale/with-scale").ScaleComponent<HTMLUListElement, Props & NativeAttrs & React.RefAttributes<HTMLUListElement>>;
17
+ export default Tree;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export interface TreeNodeData {
3
+ value: string;
4
+ label: React.ReactNode;
5
+ icon?: React.ReactNode;
6
+ disabled?: boolean;
7
+ children?: Array<TreeNodeData>;
8
+ }
9
+ export interface TreeConfig {
10
+ selected: string | null;
11
+ expanded: Array<string>;
12
+ tabbable: string | undefined;
13
+ activate: (node: TreeNodeData) => void;
14
+ register: (value: string, element: HTMLLIElement | null) => void;
15
+ }
16
+ export declare const TreeContext: React.Context<TreeConfig>;
17
+ export declare const useTreeContext: () => TreeConfig;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { TreeNodeData } from './TreeContext';
3
+ interface Props {
4
+ node: TreeNodeData;
5
+ level: number;
6
+ }
7
+ declare function TreeNode({ node, level }: Props): React.JSX.Element;
8
+ export default TreeNode;
@@ -0,0 +1,3 @@
1
+ import Tree from './Tree';
2
+ export type { TreeProps, TreeNodeData } from './Tree';
3
+ export default Tree;
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ import {
3
+ Tree_default
4
+ } from "../chunk-K6UULETP.js";
5
+ import "../chunk-MAICNLTY.js";
6
+ import "../chunk-UX2B3G6U.js";
7
+ import "../chunk-V5I4ORQQ.js";
8
+ import "../chunk-FEA5BJ35.js";
9
+ import "../chunk-X5PGXMVQ.js";
10
+ import "../chunk-SZIX7BM5.js";
11
+ import "../chunk-5KUROAEP.js";
12
+ export {
13
+ Tree_default as default
14
+ };
@@ -0,0 +1,130 @@
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/SegmentedControl/SegmentedControl.tsx
13
+ import React2, { useId, useMemo, useState } from "react";
14
+
15
+ // core/SegmentedControl/SegmentedControlContext.ts
16
+ import React from "react";
17
+ var SegmentedControlContext = React.createContext({ disabled: false });
18
+ var useSegmentedControlContext = () => React.useContext(SegmentedControlContext);
19
+
20
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/SegmentedControl/SegmentedControl.module.css.bolio-css-module-source
21
+ var SegmentedControl_module_css_default = { "segmented": "SegmentedControl-module_segmented__DCgXM" };
22
+
23
+ // core/SegmentedControl/SegmentedControl.tsx
24
+ import { jsx } from "react/jsx-runtime";
25
+ var SegmentedControlComponent = React2.forwardRef(
26
+ ({
27
+ value,
28
+ initialValue,
29
+ onChange,
30
+ disabled = false,
31
+ fullWidth = false,
32
+ className = "",
33
+ children,
34
+ style,
35
+ ...props
36
+ }, ref) => {
37
+ const theme = use_theme_default();
38
+ const { SCALES } = use_scale_default();
39
+ const name = useId();
40
+ const [selfValue, setSelfValue] = useState(initialValue);
41
+ const current = value !== void 0 ? value : selfValue;
42
+ const providerValue = useMemo(
43
+ () => ({
44
+ name,
45
+ value: current,
46
+ disabled,
47
+ select: (next) => {
48
+ setSelfValue(next);
49
+ if (onChange) onChange(next);
50
+ }
51
+ }),
52
+ [name, current, disabled, onChange]
53
+ );
54
+ const groupStyle = {
55
+ width: SCALES.width(1, fullWidth ? "100%" : "fit-content"),
56
+ height: SCALES.height(2.25),
57
+ margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`,
58
+ fontSize: SCALES.font(0.875),
59
+ "--segmented-bg": theme.palette.accents_1,
60
+ "--segmented-border": theme.palette.border,
61
+ "--segmented-color": theme.palette.accents_5,
62
+ "--segmented-hover-color": theme.palette.foreground,
63
+ "--segmented-active-bg": theme.palette.background,
64
+ "--segmented-active-color": theme.palette.foreground,
65
+ "--segmented-shadow": theme.expressiveness.shadowSmall,
66
+ "--segmented-focus": theme.palette.primary,
67
+ "--segmented-radius": theme.layout.radius,
68
+ ...style
69
+ };
70
+ return /* @__PURE__ */ jsx(SegmentedControlContext.Provider, { value: providerValue, children: /* @__PURE__ */ jsx(
71
+ "div",
72
+ {
73
+ ref,
74
+ role: "radiogroup",
75
+ "aria-disabled": disabled || void 0,
76
+ className: use_classes_default(SegmentedControl_module_css_default.segmented, className),
77
+ ...props,
78
+ style: groupStyle,
79
+ children
80
+ }
81
+ ) });
82
+ }
83
+ );
84
+ SegmentedControlComponent.displayName = "BolioUISegmentedControl";
85
+ var SegmentedControl = with_scale_default(SegmentedControlComponent);
86
+ var SegmentedControl_default = SegmentedControl;
87
+
88
+ // core/SegmentedControl/SegmentedControlItem.tsx
89
+ import React3 from "react";
90
+
91
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/SegmentedControl/SegmentedControlItem.module.css.bolio-css-module-source
92
+ var SegmentedControlItem_module_css_default = { "item": "SegmentedControlItem-module_item__R48V1", "input": "SegmentedControlItem-module_input__Q8UWL", "text": "SegmentedControlItem-module_text__7YVZC" };
93
+
94
+ // core/SegmentedControl/SegmentedControlItem.tsx
95
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
96
+ var SegmentedControlItem = React3.forwardRef(
97
+ ({ value, disabled = false, className = "", children, style, ...props }, ref) => {
98
+ const group = useSegmentedControlContext();
99
+ return /* @__PURE__ */ jsxs("label", { className: use_classes_default(SegmentedControlItem_module_css_default.item, className), style, children: [
100
+ /* @__PURE__ */ jsx2(
101
+ "input",
102
+ {
103
+ ref,
104
+ type: "radio",
105
+ className: SegmentedControlItem_module_css_default.input,
106
+ name: group.name,
107
+ value,
108
+ checked: group.value === value,
109
+ disabled: disabled || group.disabled,
110
+ onChange: () => {
111
+ var _a;
112
+ return (_a = group.select) == null ? void 0 : _a.call(group, value);
113
+ },
114
+ ...props
115
+ }
116
+ ),
117
+ /* @__PURE__ */ jsx2("span", { className: SegmentedControlItem_module_css_default.text, children })
118
+ ] });
119
+ }
120
+ );
121
+ SegmentedControlItem.displayName = "BolioUISegmentedControlItem";
122
+ var SegmentedControlItem_default = SegmentedControlItem;
123
+
124
+ // core/SegmentedControl/index.ts
125
+ SegmentedControl_default.Item = SegmentedControlItem_default;
126
+ var SegmentedControl_default2 = SegmentedControl_default;
127
+
128
+ export {
129
+ SegmentedControl_default2 as SegmentedControl_default
130
+ };
@@ -1,12 +1,12 @@
1
+ import {
2
+ getColors
3
+ } from "./chunk-KBZEYKCZ.js";
1
4
  import {
2
5
  Calendar_default,
3
6
  fromISO,
4
7
  startOfDay,
5
8
  toISO
6
- } from "./chunk-IBC5BABS.js";
7
- import {
8
- getColors
9
- } from "./chunk-KBZEYKCZ.js";
9
+ } from "./chunk-P245HSVB.js";
10
10
  import {
11
11
  use_click_away_default
12
12
  } from "./chunk-DGXZP4VJ.js";
@@ -0,0 +1,231 @@
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/Dropzone/Dropzone.tsx
13
+ import React2, { useState as useState2 } from "react";
14
+
15
+ // core/Dropzone/DropzoneThumbnail.tsx
16
+ import { useEffect, useState } from "react";
17
+
18
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Dropzone/Dropzone.module.css.bolio-css-module-source
19
+ var Dropzone_module_css_default = { "dropzone": "Dropzone-module_dropzone__-6nFN", "input": "Dropzone-module_input__-FpKo", "content": "Dropzone-module_content__Uafwo", "dragging": "Dropzone-module_dragging__z9VG8", "disabled": "Dropzone-module_disabled__rvXlc", "thumbnails": "Dropzone-module_thumbnails__x67bm", "thumbnail": "Dropzone-module_thumbnail__-ke6R", "tile": "Dropzone-module_tile__o-TLL", "preview": "Dropzone-module_preview__pQ3gz", "fileIcon": "Dropzone-module_fileIcon__hnpZV", "format": "Dropzone-module_format__oEMEw", "remove": "Dropzone-module_remove__pjfHy", "name": "Dropzone-module_name__OAPKM" };
20
+
21
+ // core/Dropzone/DropzoneThumbnail.tsx
22
+ import { jsx, jsxs } from "react/jsx-runtime";
23
+ var formatOf = (file) => {
24
+ const extension = file.name.includes(".") ? file.name.split(".").pop() : file.type.split("/")[1];
25
+ return (extension || "file").slice(0, 4).toUpperCase();
26
+ };
27
+ function DropzoneThumbnail({ file, removeLabel, disabled, onRemove }) {
28
+ const previewable = file.type.startsWith("image/");
29
+ const [url, setUrl] = useState();
30
+ useEffect(() => {
31
+ if (!previewable) return;
32
+ const objectUrl = URL.createObjectURL(file);
33
+ setUrl(objectUrl);
34
+ return () => URL.revokeObjectURL(objectUrl);
35
+ }, [file, previewable]);
36
+ return /* @__PURE__ */ jsxs("li", { className: Dropzone_module_css_default.thumbnail, children: [
37
+ /* @__PURE__ */ jsxs("div", { className: Dropzone_module_css_default.tile, children: [
38
+ previewable ? (
39
+ // the name below the tile describes the file
40
+ url && /* @__PURE__ */ jsx("img", { src: url, alt: "", className: Dropzone_module_css_default.preview })
41
+ ) : /* @__PURE__ */ jsxs(
42
+ "svg",
43
+ {
44
+ viewBox: "0 0 24 24",
45
+ width: "2.5em",
46
+ height: "2.5em",
47
+ fill: "none",
48
+ stroke: "currentColor",
49
+ strokeWidth: "1.5",
50
+ strokeLinecap: "round",
51
+ strokeLinejoin: "round",
52
+ className: Dropzone_module_css_default.fileIcon,
53
+ "aria-hidden": "true",
54
+ children: [
55
+ /* @__PURE__ */ jsx("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
56
+ /* @__PURE__ */ jsx("path", { d: "M14 3v5h5" })
57
+ ]
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsx("span", { className: Dropzone_module_css_default.format, children: formatOf(file) }),
61
+ /* @__PURE__ */ jsx(
62
+ "button",
63
+ {
64
+ type: "button",
65
+ className: Dropzone_module_css_default.remove,
66
+ "aria-label": removeLabel,
67
+ disabled,
68
+ onClick: onRemove,
69
+ children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
70
+ "path",
71
+ {
72
+ d: "M6 6l12 12M18 6L6 18",
73
+ fill: "none",
74
+ stroke: "currentColor",
75
+ strokeWidth: "2",
76
+ strokeLinecap: "round"
77
+ }
78
+ ) })
79
+ }
80
+ )
81
+ ] }),
82
+ /* @__PURE__ */ jsx("span", { className: Dropzone_module_css_default.name, title: file.name, children: file.name })
83
+ ] });
84
+ }
85
+ var DropzoneThumbnail_default = DropzoneThumbnail;
86
+
87
+ // core/Dropzone/Dropzone.tsx
88
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
89
+ var matchesAccept = (file, accept) => {
90
+ if (!accept) return true;
91
+ const name = file.name.toLowerCase();
92
+ return accept.split(",").map((token) => token.trim().toLowerCase()).filter(Boolean).some(
93
+ (token) => token.startsWith(".") ? name.endsWith(token) : token.endsWith("/*") ? file.type.toLowerCase().startsWith(token.slice(0, -1)) : file.type.toLowerCase() === token
94
+ );
95
+ };
96
+ var DropzoneComponent = React2.forwardRef(
97
+ ({
98
+ accept,
99
+ multiple = false,
100
+ maxSize,
101
+ maxFiles,
102
+ onDrop,
103
+ thumbnails = false,
104
+ value,
105
+ onChange,
106
+ removeLabel = (file) => `Remove ${file.name}`,
107
+ disabled = false,
108
+ className = "",
109
+ children = "Drag files here or click to choose them",
110
+ style,
111
+ ...props
112
+ }, ref) => {
113
+ const theme = use_theme_default();
114
+ const { SCALES } = use_scale_default();
115
+ const [dragging, setDragging] = useState2(false);
116
+ const [selfFiles, setSelfFiles] = useState2([]);
117
+ const files = value !== void 0 ? value : selfFiles;
118
+ const updateFiles = (next) => {
119
+ if (value === void 0) setSelfFiles(next);
120
+ if (onChange) onChange(next);
121
+ };
122
+ const receive = (list) => {
123
+ if (disabled || !list) return;
124
+ const kept = thumbnails && multiple ? files : [];
125
+ const limit = multiple ? (maxFiles != null ? maxFiles : Infinity) - kept.length : 1;
126
+ const accepted = [];
127
+ const rejected = [];
128
+ Array.from(list).forEach((file) => {
129
+ if (!matchesAccept(file, accept))
130
+ rejected.push({ file, reason: "file-type" });
131
+ else if (maxSize !== void 0 && file.size > maxSize)
132
+ rejected.push({ file, reason: "file-too-large" });
133
+ else if (accepted.length >= limit)
134
+ rejected.push({ file, reason: "too-many-files" });
135
+ else accepted.push(file);
136
+ });
137
+ if (thumbnails && accepted.length)
138
+ updateFiles(multiple ? [...kept, ...accepted] : accepted);
139
+ if (onDrop) onDrop(accepted, rejected);
140
+ };
141
+ const dragHandler = (event) => {
142
+ if (disabled) return;
143
+ event.preventDefault();
144
+ if (event.type === "dragleave" && event.currentTarget.contains(event.relatedTarget))
145
+ return;
146
+ setDragging(event.type !== "dragleave");
147
+ };
148
+ const dropHandler = (event) => {
149
+ if (disabled) return;
150
+ event.preventDefault();
151
+ setDragging(false);
152
+ receive(event.dataTransfer.files);
153
+ };
154
+ const changeHandler = (event) => {
155
+ receive(event.target.files);
156
+ event.target.value = "";
157
+ };
158
+ const dropzoneStyle = {
159
+ width: SCALES.width(1, "100%"),
160
+ height: SCALES.height(1, "auto"),
161
+ margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`,
162
+ fontSize: SCALES.font(0.875),
163
+ "--dropzone-color": theme.palette.accents_6,
164
+ "--dropzone-bg": theme.palette.background,
165
+ "--dropzone-border": theme.palette.accents_3,
166
+ "--dropzone-hover-border": theme.palette.accents_5,
167
+ "--dropzone-active": theme.palette.primary,
168
+ "--dropzone-radius": theme.layout.radius,
169
+ "--dropzone-tile-bg": theme.palette.accents_1,
170
+ "--dropzone-tile-color": theme.palette.accents_4,
171
+ "--dropzone-name-color": theme.palette.accents_6,
172
+ "--dropzone-badge-bg": theme.palette.foreground,
173
+ "--dropzone-badge-color": theme.palette.background,
174
+ "--dropzone-remove-bg": theme.palette.background,
175
+ "--dropzone-remove-color": theme.palette.accents_6,
176
+ "--dropzone-remove-hover-color": theme.palette.foreground,
177
+ ...style
178
+ };
179
+ return /* @__PURE__ */ jsxs2("div", { className, style: dropzoneStyle, children: [
180
+ /* @__PURE__ */ jsxs2(
181
+ "label",
182
+ {
183
+ className: use_classes_default(Dropzone_module_css_default.dropzone, {
184
+ [Dropzone_module_css_default.dragging]: dragging,
185
+ [Dropzone_module_css_default.disabled]: disabled
186
+ }),
187
+ onDragEnter: dragHandler,
188
+ onDragOver: dragHandler,
189
+ onDragLeave: dragHandler,
190
+ onDrop: dropHandler,
191
+ children: [
192
+ /* @__PURE__ */ jsx2(
193
+ "input",
194
+ {
195
+ ref,
196
+ type: "file",
197
+ className: Dropzone_module_css_default.input,
198
+ accept,
199
+ multiple,
200
+ disabled,
201
+ onChange: changeHandler,
202
+ ...props
203
+ }
204
+ ),
205
+ /* @__PURE__ */ jsx2("span", { className: Dropzone_module_css_default.content, children })
206
+ ]
207
+ }
208
+ ),
209
+ thumbnails && files.length > 0 && /* @__PURE__ */ jsx2("ul", { className: Dropzone_module_css_default.thumbnails, children: files.map((file, index) => /* @__PURE__ */ jsx2(
210
+ DropzoneThumbnail_default,
211
+ {
212
+ file,
213
+ removeLabel: removeLabel(file),
214
+ disabled,
215
+ onRemove: () => updateFiles(files.filter((_, i) => i !== index))
216
+ },
217
+ `${file.name}-${file.size}-${file.lastModified}-${index}`
218
+ )) })
219
+ ] });
220
+ }
221
+ );
222
+ DropzoneComponent.displayName = "BolioUIDropzone";
223
+ var Dropzone = with_scale_default(DropzoneComponent);
224
+ var Dropzone_default = Dropzone;
225
+
226
+ // core/Dropzone/index.ts
227
+ var Dropzone_default2 = Dropzone_default;
228
+
229
+ export {
230
+ Dropzone_default2 as Dropzone_default
231
+ };
@@ -53,12 +53,16 @@ var defaultRect = {
53
53
  top: -1e3,
54
54
  left: -1e3,
55
55
  right: -1e3,
56
- width: 0
56
+ width: 0,
57
+ elementTop: -1e3
57
58
  };
59
+ var GAP = 2;
58
60
  var Dropdown = React.memo(
59
61
  ({ children, parent, visible, disableMatchWidth, getPopupContainer }) => {
60
62
  const el = use_portal_default("dropdown", getPopupContainer);
61
63
  const [rect, setRect] = useState(defaultRect);
64
+ const [menu, setMenu] = useState(null);
65
+ const [flipHeight, setFlipHeight] = useState(null);
62
66
  if (parent && process.env.NODE_ENV !== "production") {
63
67
  if (getPopupContainer && getPopupContainer()) {
64
68
  const el2 = getPopupContainer();
@@ -76,9 +80,10 @@ var Dropdown = React.memo(
76
80
  top,
77
81
  left,
78
82
  right,
79
- width: nativeWidth
83
+ width: nativeWidth,
84
+ elementTop
80
85
  } = getRefRect(parent, getPopupContainer);
81
- setRect({ top, left, right, width: nativeWidth });
86
+ setRect({ top, left, right, width: nativeWidth, elementTop });
82
87
  };
83
88
  use_resize_default(updateRect);
84
89
  use_click_anywhere_default(() => {
@@ -106,10 +111,18 @@ var Dropdown = React.memo(
106
111
  const mouseDownHandler = (event) => {
107
112
  event.preventDefault();
108
113
  };
114
+ useEffect2(() => {
115
+ const trigger = parent == null ? void 0 : parent.current;
116
+ if (!visible || !trigger || !menu) return setFlipHeight(null);
117
+ const { top, bottom } = trigger.getBoundingClientRect();
118
+ const height = menu.offsetHeight;
119
+ const below = window.innerHeight - bottom;
120
+ setFlipHeight(height + GAP > below && top > below ? height : null);
121
+ }, [visible, parent, menu, rect]);
109
122
  if (!parent || !el) return null;
110
123
  const dropdownStyle = {
111
124
  position: "absolute",
112
- top: rect.top + 2,
125
+ top: flipHeight === null ? rect.top + GAP : rect.elementTop - flipHeight - GAP,
113
126
  left: rect.left,
114
127
  zIndex: 1100,
115
128
  ...disableMatchWidth ? { minWidth: rect.width } : { width: rect.width }
@@ -118,6 +131,7 @@ var Dropdown = React.memo(
118
131
  /* @__PURE__ */ jsx(css_transition_default, { visible, children: /* @__PURE__ */ jsx(
119
132
  "div",
120
133
  {
134
+ ref: setMenu,
121
135
  className: "",
122
136
  onClick: clickHandler,
123
137
  onMouseDown: mouseDownHandler,
@@ -0,0 +1,109 @@
1
+ import {
2
+ Menu_default
3
+ } from "./chunk-XLPOECCE.js";
4
+ import {
5
+ with_scale_default
6
+ } from "./chunk-MAICNLTY.js";
7
+ import {
8
+ use_classes_default
9
+ } from "./chunk-5KUROAEP.js";
10
+
11
+ // core/ContextMenu/ContextMenu.tsx
12
+ import React, { useEffect, useRef, useState } from "react";
13
+
14
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/ContextMenu/ContextMenu.module.css.bolio-css-module-source
15
+ var ContextMenu_module_css_default = { "area": "ContextMenu-module_area__IAOF5", "trigger": "ContextMenu-module_trigger__OY2LR" };
16
+
17
+ // core/ContextMenu/ContextMenu.tsx
18
+ import { jsx, jsxs } from "react/jsx-runtime";
19
+ var ContextMenuComponent = React.forwardRef(
20
+ ({
21
+ content,
22
+ disabled = false,
23
+ onVisibleChange,
24
+ className = "",
25
+ children,
26
+ onContextMenu,
27
+ ...props
28
+ }, ref) => {
29
+ const [point, setPoint] = useState(null);
30
+ const area = useRef(null);
31
+ const setRefs = (element) => {
32
+ area.current = element;
33
+ if (typeof ref === "function") ref(element);
34
+ else if (ref) ref.current = element;
35
+ };
36
+ const change = (visible, next = null) => {
37
+ setPoint(visible ? next : null);
38
+ if (onVisibleChange) onVisibleChange(visible);
39
+ };
40
+ const contextMenuHandler = (event) => {
41
+ if (onContextMenu) onContextMenu(event);
42
+ if (disabled || event.defaultPrevented) return;
43
+ event.preventDefault();
44
+ change(true, { x: event.clientX, y: event.clientY });
45
+ };
46
+ const open = point !== null;
47
+ useEffect(() => {
48
+ if (!open) return;
49
+ const close = () => {
50
+ setPoint(null);
51
+ if (onVisibleChange) onVisibleChange(false);
52
+ };
53
+ window.addEventListener("scroll", close, { capture: true, once: true });
54
+ return () => window.removeEventListener("scroll", close, true);
55
+ }, [open, onVisibleChange]);
56
+ return /* @__PURE__ */ jsxs(
57
+ "div",
58
+ {
59
+ ref: setRefs,
60
+ className: use_classes_default(ContextMenu_module_css_default.area, className),
61
+ ...props,
62
+ onContextMenu: contextMenuHandler,
63
+ children: [
64
+ children,
65
+ point && // a new point opens a new menu, so it is placed there
66
+ /* @__PURE__ */ jsx(
67
+ Menu_default,
68
+ {
69
+ visible: true,
70
+ onVisibleChange: (visible) => change(visible),
71
+ style: {
72
+ position: "fixed",
73
+ left: point.x,
74
+ top: point.y,
75
+ width: 0,
76
+ height: 0
77
+ },
78
+ trigger: /* @__PURE__ */ jsx(
79
+ "button",
80
+ {
81
+ type: "button",
82
+ tabIndex: -1,
83
+ "aria-hidden": "true",
84
+ className: ContextMenu_module_css_default.trigger,
85
+ onFocus: () => {
86
+ var _a;
87
+ return (_a = area.current) == null ? void 0 : _a.focus();
88
+ }
89
+ }
90
+ ),
91
+ children: content
92
+ },
93
+ `${point.x}:${point.y}`
94
+ )
95
+ ]
96
+ }
97
+ );
98
+ }
99
+ );
100
+ ContextMenuComponent.displayName = "BolioUIContextMenu";
101
+ var ContextMenu = with_scale_default(ContextMenuComponent);
102
+ var ContextMenu_default = ContextMenu;
103
+
104
+ // core/ContextMenu/index.ts
105
+ var ContextMenu_default2 = ContextMenu_default;
106
+
107
+ export {
108
+ ContextMenu_default2 as ContextMenu_default
109
+ };