@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
@@ -1,15 +1,15 @@
1
- import {
2
- dropdown_default
3
- } from "./chunk-UVVBMWR4.js";
4
1
  import {
5
2
  Grid_default
6
3
  } from "./chunk-JFNYQSEZ.js";
7
4
  import {
8
- log_warning_default
9
- } from "./chunk-AXYDJGTN.js";
5
+ dropdown_default
6
+ } from "./chunk-AG2NWQYL.js";
10
7
  import {
11
8
  getColors
12
9
  } from "./chunk-KBZEYKCZ.js";
10
+ import {
11
+ log_warning_default
12
+ } from "./chunk-AXYDJGTN.js";
13
13
  import {
14
14
  use_current_state_default
15
15
  } from "./chunk-33BUV2RX.js";
@@ -85,6 +85,7 @@ import { jsx as jsx2 } from "react/jsx-runtime";
85
85
  var SelectDropdown = React3.forwardRef(
86
86
  ({
87
87
  visible,
88
+ colors,
88
89
  children,
89
90
  className = "",
90
91
  dropdownStyle = {},
@@ -113,8 +114,10 @@ var SelectDropdown = React3.forwardRef(
113
114
  className: classes,
114
115
  style: {
115
116
  "--select-dropdown-radius": theme.layout.radius,
116
- "--select-dropdown-shadow": theme.expressiveness.shadowLarge,
117
- "--select-dropdown-bg": theme.palette.accents_2,
117
+ "--select-dropdown-shadow": theme.expressiveness.shadowMedium,
118
+ "--select-dropdown-bg": colors.bgColor,
119
+ "--select-dropdown-border": colors.borderColor,
120
+ "--select-dropdown-color": colors.color,
118
121
  ...dropdownStyle
119
122
  },
120
123
  children
@@ -431,7 +434,7 @@ var SelectComponent = React7.forwardRef(
431
434
  "--select-padding-top": SCALES.pt(0),
432
435
  "--select-padding-right": SCALES.pr(0.334),
433
436
  "--select-padding-bottom": SCALES.pb(0),
434
- "--select-padding-left": SCALES.pl(0.667),
437
+ "--select-padding-left": SCALES.pl(0.875),
435
438
  "--select-margin-top": SCALES.mt(0),
436
439
  "--select-margin-right": SCALES.mr(0),
437
440
  "--select-margin-bottom": SCALES.mb(0),
@@ -443,7 +446,7 @@ var SelectComponent = React7.forwardRef(
443
446
  "--select-placeholder-color": colors.placeholderColor,
444
447
  "--select-icon-color": colors.iconColor,
445
448
  "--select-color": colors.color,
446
- "--select-placeholder-font-size": SCALES.font(0.775),
449
+ "--select-placeholder-font-size": SCALES.font(0.875),
447
450
  "--select-icon-right": theme.layout.gapQuarter,
448
451
  "--select-icon-rotate": visible ? "180deg" : "0deg",
449
452
  ...style
@@ -477,6 +480,7 @@ var SelectComponent = React7.forwardRef(
477
480
  {
478
481
  ref: dropdownRef,
479
482
  visible,
483
+ colors,
480
484
  className: dropdownClassName,
481
485
  dropdownStyle,
482
486
  disableMatchWidth,
@@ -498,7 +502,7 @@ var Select_default = Select;
498
502
  import { useMemo as useMemo2 } from "react";
499
503
 
500
504
  // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Select/SelectOption.module.css.bolio-css-module-source
501
- var SelectOption_module_css_default = { "option": "SelectOption-module_option__NAlFp", "divider": "SelectOption-module_divider__mmqJj", "label": "SelectOption-module_label__NtVM7" };
505
+ var SelectOption_module_css_default = { "option": "SelectOption-module_option__NAlFp", "label": "SelectOption-module_label__NtVM7", "divider": "SelectOption-module_divider__mmqJj", "disabled": "SelectOption-module_disabled__cDMWS", "selected": "SelectOption-module_selected__HOwTO" };
502
506
 
503
507
  // core/Select/SelectOption.tsx
504
508
  import { jsx as jsx8 } from "react/jsx-runtime";
@@ -513,7 +517,6 @@ function SelectOptionComponent({
513
517
  style,
514
518
  ...props
515
519
  }) {
516
- const theme = use_theme_default();
517
520
  const { SCALES } = use_scale_default();
518
521
  const { updateValue, value, disableAll } = useSelectContext();
519
522
  const isDisabled = useMemo2(
@@ -521,11 +524,6 @@ function SelectOptionComponent({
521
524
  [disabled, disableAll]
522
525
  );
523
526
  const isLabel = useMemo2(() => label || divider, [label, divider]);
524
- const classes = use_classes_default(
525
- SelectOption_module_css_default.option,
526
- { [SelectOption_module_css_default.divider]: divider, [SelectOption_module_css_default.label]: label },
527
- className
528
- );
529
527
  if (!isLabel && identValue === void 0) {
530
528
  log_warning_default('The props "value" is required.', "Select Option");
531
529
  }
@@ -536,18 +534,16 @@ function SelectOptionComponent({
536
534
  }
537
535
  return value.includes(`${identValue}`);
538
536
  }, [identValue, value]);
539
- const bgColor = useMemo2(() => {
540
- if (isDisabled) return theme.palette.accents_3;
541
- return selected ? theme.palette.accents_3 : theme.palette.accents_2;
542
- }, [selected, isDisabled, theme.palette]);
543
- const hoverBgColor = useMemo2(() => {
544
- if (isDisabled || isLabel || selected) return bgColor;
545
- return theme.palette.accents_1;
546
- }, [selected, isDisabled, theme.palette, isLabel, bgColor]);
547
- const color = useMemo2(() => {
548
- if (isDisabled) return theme.palette.accents_4;
549
- return selected ? theme.palette.foreground : theme.palette.accents_5;
550
- }, [selected, isDisabled, theme.palette]);
537
+ const classes = use_classes_default(
538
+ SelectOption_module_css_default.option,
539
+ {
540
+ [SelectOption_module_css_default.divider]: divider,
541
+ [SelectOption_module_css_default.label]: label,
542
+ [SelectOption_module_css_default.selected]: selected,
543
+ [SelectOption_module_css_default.disabled]: isDisabled
544
+ },
545
+ className
546
+ );
551
547
  const clickHandler = (event) => {
552
548
  if (preventAllEvents) return;
553
549
  event.stopPropagation();
@@ -557,23 +553,18 @@ function SelectOptionComponent({
557
553
  if (updateValue) updateValue(identValue);
558
554
  };
559
555
  const optionStyle = {
560
- "--select-option-bg": bgColor,
561
- "--select-option-color": color,
562
556
  "--select-option-cursor": isDisabled ? "not-allowed" : "pointer",
563
- "--select-font-size": SCALES.font(0.75),
557
+ "--select-font-size": SCALES.font(0.875),
564
558
  "--select-option-width": SCALES.width(1, "100%"),
565
559
  "--select-option-height": SCALES.height(2.25),
566
560
  "--select-option-padding-top": SCALES.pt(0),
567
- "--select-option-padding-right": SCALES.pr(0.667),
561
+ "--select-option-padding-right": SCALES.pr(0.75),
568
562
  "--select-option-padding-bottom": SCALES.pb(0),
569
- "--select-option-padding-left": SCALES.pl(0.667),
563
+ "--select-option-padding-left": SCALES.pl(0.75),
570
564
  "--select-option-margin-top": SCALES.mt(0),
571
565
  "--select-option-margin-right": SCALES.mr(0),
572
566
  "--select-option-margin-bottom": SCALES.mb(0),
573
567
  "--select-option-margin-left": SCALES.ml(0),
574
- "--select-option-hover-bg": hoverBgColor,
575
- "--select-option-hover-color": theme.palette.accents_7,
576
- "--select-option-divider-border": theme.palette.accents_3,
577
568
  "--select-option-divider-height": SCALES.height(1, 0),
578
569
  "--select-option-divider-padding-top": SCALES.pt(0),
579
570
  "--select-option-divider-padding-right": SCALES.pr(0),
@@ -583,7 +574,6 @@ function SelectOptionComponent({
583
574
  "--select-option-divider-margin-right": SCALES.mr(0),
584
575
  "--select-option-divider-margin-bottom": SCALES.mb(0.5),
585
576
  "--select-option-divider-margin-left": SCALES.ml(0),
586
- "--select-option-label-color": theme.palette.accents_7,
587
577
  "--select-option-label-font-size": SCALES.font(0.875),
588
578
  ...style
589
579
  };
@@ -0,0 +1,217 @@
1
+ import {
2
+ InputBlockLabel_default
3
+ } from "./chunk-UOGCO6CV.js";
4
+ import {
5
+ getColors
6
+ } from "./chunk-KBZEYKCZ.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
+ use_classes_default
16
+ } from "./chunk-5KUROAEP.js";
17
+
18
+ // core/TagsInput/TagsInput.tsx
19
+ import React, { useId, useState } from "react";
20
+
21
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/TagsInput/TagsInput.module.css.bolio-css-module-source
22
+ var TagsInput_module_css_default = { "withLabel": "TagsInput-module_withLabel__-n8Kq", "field": "TagsInput-module_field__ieR7N", "disabled": "TagsInput-module_disabled__cCN-w", "tag": "TagsInput-module_tag__dhER4", "remove": "TagsInput-module_remove__oullb", "input": "TagsInput-module_input__RFYNn" };
23
+
24
+ // core/TagsInput/TagsInput.tsx
25
+ import { jsx, jsxs } from "react/jsx-runtime";
26
+ var noTags = [];
27
+ var TagsInputComponent = React.forwardRef(
28
+ ({
29
+ value: customValue,
30
+ initialValue = noTags,
31
+ onChange,
32
+ max,
33
+ allowDuplicates = false,
34
+ type = "default",
35
+ rounded = false,
36
+ filled = false,
37
+ light = false,
38
+ ghost = false,
39
+ subtle = false,
40
+ disabled = false,
41
+ readOnly = false,
42
+ error = false,
43
+ errorMessage,
44
+ className = "",
45
+ children,
46
+ style,
47
+ onKeyDown,
48
+ onBlur,
49
+ ...props
50
+ }, ref) => {
51
+ const theme = use_theme_default();
52
+ const { SCALES } = use_scale_default();
53
+ const generatedId = useId();
54
+ const inputId = props.id || generatedId;
55
+ const errorId = `${inputId}-error`;
56
+ const describedBy = [props["aria-describedby"], error && errorMessage ? errorId : void 0].filter(Boolean).join(" ") || void 0;
57
+ const colors = getColors(theme.palette, type, disabled, {
58
+ filled,
59
+ light,
60
+ ghost,
61
+ subtle
62
+ });
63
+ const isControlled = customValue !== void 0;
64
+ const [selfValue, setSelfValue] = useState(initialValue);
65
+ const tags = isControlled ? customValue : selfValue;
66
+ const [text, setText] = useState("");
67
+ const locked = disabled || readOnly;
68
+ const commit = (next) => {
69
+ if (!isControlled) setSelfValue(next);
70
+ onChange == null ? void 0 : onChange(next);
71
+ };
72
+ const add = (entries) => {
73
+ const next = [...tags];
74
+ entries.map((entry) => entry.trim()).filter(Boolean).forEach((entry) => {
75
+ if (max !== void 0 && next.length >= max) return;
76
+ if (!allowDuplicates && next.includes(entry)) return;
77
+ next.push(entry);
78
+ });
79
+ if (next.length !== tags.length) commit(next);
80
+ };
81
+ const remove = (index) => {
82
+ if (locked) return;
83
+ commit(tags.filter((_, i) => i !== index));
84
+ };
85
+ const changeHandler = (event) => {
86
+ const parts = event.target.value.split(",");
87
+ if (parts.length === 1) return setText(parts[0]);
88
+ add(parts.slice(0, -1));
89
+ setText(parts[parts.length - 1]);
90
+ };
91
+ const keyDownHandler = (event) => {
92
+ onKeyDown == null ? void 0 : onKeyDown(event);
93
+ if (event.defaultPrevented || locked) return;
94
+ if (event.key === "Enter" && text.trim()) {
95
+ event.preventDefault();
96
+ add([text]);
97
+ setText("");
98
+ } else if (event.key === "Backspace" && !text && tags.length) {
99
+ remove(tags.length - 1);
100
+ }
101
+ };
102
+ const blurHandler = (event) => {
103
+ onBlur == null ? void 0 : onBlur(event);
104
+ if (locked || !text) return;
105
+ add([text]);
106
+ setText("");
107
+ };
108
+ const rootStyle = {
109
+ "--input-height": SCALES.height(2.25),
110
+ fontSize: SCALES.font(0.875),
111
+ width: SCALES.width(1, "100%"),
112
+ margin: `${SCALES.mt(0)} ${SCALES.mr(0)} ${SCALES.mb(0)} ${SCALES.ml(0)}`,
113
+ ...style
114
+ };
115
+ const fieldStyle = {
116
+ "--input-border": colors.borderColor,
117
+ "--input-radius": rounded ? "25px" : theme.layout.radius,
118
+ "--input-bg": colors.bgColor,
119
+ "--input-hover-border": colors.hoverBorder,
120
+ "--input-hover-bg": colors.hoverBgColor,
121
+ "--input-focus-border": colors.focusBorder,
122
+ "--input-placeholder-color": colors.placeholderColor,
123
+ "--input-color": colors.color,
124
+ "--tag-bg": theme.palette.accents_2,
125
+ "--tag-color": disabled ? theme.palette.accents_4 : theme.palette.foreground,
126
+ "--tag-remove-color": colors.iconColor,
127
+ "--tag-remove-hover-color": colors.color
128
+ };
129
+ return /* @__PURE__ */ jsxs(
130
+ "div",
131
+ {
132
+ className: use_classes_default(TagsInput_module_css_default.withLabel, className),
133
+ style: rootStyle,
134
+ children: [
135
+ children && /* @__PURE__ */ jsx(InputBlockLabel_default, { htmlFor: inputId, children }),
136
+ /* @__PURE__ */ jsxs(
137
+ "div",
138
+ {
139
+ className: use_classes_default(TagsInput_module_css_default.field, {
140
+ [TagsInput_module_css_default.disabled]: disabled
141
+ }),
142
+ style: fieldStyle,
143
+ onClick: (event) => {
144
+ var _a;
145
+ return (_a = event.currentTarget.querySelector("input")) == null ? void 0 : _a.focus();
146
+ },
147
+ children: [
148
+ tags.map((tag, index) => /* @__PURE__ */ jsxs("span", { className: TagsInput_module_css_default.tag, children: [
149
+ tag,
150
+ /* @__PURE__ */ jsx(
151
+ "button",
152
+ {
153
+ type: "button",
154
+ className: TagsInput_module_css_default.remove,
155
+ "aria-label": `Remove ${tag}`,
156
+ disabled: locked,
157
+ onClick: () => remove(index),
158
+ children: /* @__PURE__ */ jsx(
159
+ "svg",
160
+ {
161
+ viewBox: "0 0 24 24",
162
+ width: "1em",
163
+ height: "1em",
164
+ "aria-hidden": "true",
165
+ children: /* @__PURE__ */ jsx(
166
+ "path",
167
+ {
168
+ d: "M6 6l12 12M18 6L6 18",
169
+ fill: "none",
170
+ stroke: "currentColor",
171
+ strokeWidth: "2",
172
+ strokeLinecap: "round"
173
+ }
174
+ )
175
+ }
176
+ )
177
+ }
178
+ )
179
+ ] }, `${tag}-${index}`)),
180
+ /* @__PURE__ */ jsx(
181
+ "input",
182
+ {
183
+ ref,
184
+ type: "text",
185
+ autoComplete: "off",
186
+ value: text,
187
+ disabled,
188
+ readOnly,
189
+ onChange: changeHandler,
190
+ onKeyDown: keyDownHandler,
191
+ onBlur: blurHandler,
192
+ ...props,
193
+ id: inputId,
194
+ "aria-invalid": error || void 0,
195
+ "aria-describedby": describedBy,
196
+ className: TagsInput_module_css_default.input
197
+ }
198
+ )
199
+ ]
200
+ }
201
+ ),
202
+ error && /* @__PURE__ */ jsx(InputBlockLabel_default, { error, id: errorId, children: errorMessage })
203
+ ]
204
+ }
205
+ );
206
+ }
207
+ );
208
+ TagsInputComponent.displayName = "BolioUITagsInput";
209
+ var TagsInput = with_scale_default(TagsInputComponent);
210
+ var TagsInput_default = TagsInput;
211
+
212
+ // core/TagsInput/index.ts
213
+ var TagsInput_default2 = TagsInput_default;
214
+
215
+ export {
216
+ TagsInput_default2 as TagsInput_default
217
+ };
@@ -0,0 +1,257 @@
1
+ import {
2
+ getColors
3
+ } from "./chunk-KBZEYKCZ.js";
4
+ import {
5
+ Calendar_default,
6
+ fromISO,
7
+ startOfDay,
8
+ toISO
9
+ } from "./chunk-P245HSVB.js";
10
+ import {
11
+ use_click_away_default
12
+ } from "./chunk-DGXZP4VJ.js";
13
+ import {
14
+ use_scale_default,
15
+ with_scale_default
16
+ } from "./chunk-MAICNLTY.js";
17
+ import {
18
+ use_theme_default
19
+ } from "./chunk-V5I4ORQQ.js";
20
+ import {
21
+ use_classes_default
22
+ } from "./chunk-5KUROAEP.js";
23
+
24
+ // core/DateRangePicker/DateRangePicker.tsx
25
+ import React, { useEffect, useRef, useState } from "react";
26
+
27
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/DateRangePicker/DateRangePicker.module.css.bolio-css-module-source
28
+ var DateRangePicker_module_css_default = { "daterange": "DateRangePicker-module_daterange__id9HF", "field": "DateRangePicker-module_field__4UZhH", "input": "DateRangePicker-module_input__h9sDj", "separator": "DateRangePicker-module_separator__StR3E", "toggle": "DateRangePicker-module_toggle__gNukh", "popup": "DateRangePicker-module_popup__hKExw" };
29
+
30
+ // core/DateRangePicker/DateRangePicker.tsx
31
+ import { jsx, jsxs } from "react/jsx-runtime";
32
+ var emptyRange = [null, null];
33
+ var format = (date) => date ? toISO(date) : "";
34
+ var DateRangePickerComponent = React.forwardRef(
35
+ ({
36
+ value: customValue,
37
+ initialValue = emptyRange,
38
+ onChange,
39
+ min,
40
+ max,
41
+ locale,
42
+ weekStartsOn,
43
+ startPlaceholder = "YYYY-MM-DD",
44
+ endPlaceholder = "YYYY-MM-DD",
45
+ startLabel = "Start date",
46
+ endLabel = "End date",
47
+ calendarLabel = "Choose dates",
48
+ disabled = false,
49
+ type = "default",
50
+ rounded = false,
51
+ filled = false,
52
+ light = false,
53
+ ghost = false,
54
+ subtle = false,
55
+ className = "",
56
+ style,
57
+ ...props
58
+ }, ref) => {
59
+ const theme = use_theme_default();
60
+ const { SCALES } = use_scale_default();
61
+ const colors = getColors(theme.palette, type, disabled, {
62
+ filled,
63
+ light,
64
+ ghost,
65
+ subtle
66
+ });
67
+ const isControlled = customValue !== void 0;
68
+ const [selfValue, setSelfValue] = useState(initialValue);
69
+ const range = isControlled ? customValue : selfValue;
70
+ const [start, end] = range;
71
+ const startText = format(start);
72
+ const endText = format(end);
73
+ const [texts, setTexts] = useState({ start: startText, end: endText });
74
+ const [open, setOpen] = useState(false);
75
+ useEffect(() => {
76
+ setTexts({ start: startText, end: endText });
77
+ }, [startText, endText]);
78
+ const rootRef = useRef(null);
79
+ const endRef = useRef(null);
80
+ const buttonRef = useRef(null);
81
+ use_click_away_default(rootRef, () => setOpen(false));
82
+ const isInBounds = (date) => !(min && date < startOfDay(min) || max && date > startOfDay(max));
83
+ const commit = (next) => {
84
+ if (!isControlled) setSelfValue(next);
85
+ if (onChange) onChange(next);
86
+ };
87
+ const inputHandler = (edge) => (event) => {
88
+ const next = event.target.value;
89
+ setTexts((last) => ({ ...last, [edge]: next }));
90
+ const other = edge === "start" ? end : start;
91
+ if (next === "") {
92
+ return commit(edge === "start" ? [null, other] : [other, null]);
93
+ }
94
+ const date = fromISO(next);
95
+ if (!date || !isInBounds(date)) return;
96
+ if (other && (edge === "start" ? date > other : date < other)) return;
97
+ commit(edge === "start" ? [date, other] : [other, date]);
98
+ };
99
+ const blurHandler = () => setTexts({ start: startText, end: endText });
100
+ const pick = (next) => {
101
+ var _a;
102
+ commit(next);
103
+ if (!next[1]) return;
104
+ setOpen(false);
105
+ (_a = endRef.current) == null ? void 0 : _a.focus();
106
+ };
107
+ const keyDownHandler = (event) => {
108
+ var _a;
109
+ if (event.key !== "Escape") return;
110
+ event.stopPropagation();
111
+ setOpen(false);
112
+ (_a = buttonRef.current) == null ? void 0 : _a.focus();
113
+ };
114
+ const rangeStyle = {
115
+ "--daterange-font-size": SCALES.font(0.875),
116
+ "--daterange-input-height": SCALES.height(2.25),
117
+ "--daterange-width": SCALES.width(1, "initial"),
118
+ "--daterange-height": SCALES.height(1, "auto"),
119
+ "--daterange-padding-top": SCALES.pt(0),
120
+ "--daterange-padding-right": SCALES.pr(0),
121
+ "--daterange-padding-bottom": SCALES.pb(0),
122
+ "--daterange-padding-left": SCALES.pl(0),
123
+ "--daterange-margin-top": SCALES.mt(0),
124
+ "--daterange-margin-right": SCALES.mr(0),
125
+ "--daterange-margin-bottom": SCALES.mb(0),
126
+ "--daterange-margin-left": SCALES.ml(0),
127
+ "--daterange-bg": theme.palette.background,
128
+ "--daterange-border-color": theme.palette.border,
129
+ "--daterange-radius": rounded ? "25px" : theme.layout.radius,
130
+ "--daterange-popup-radius": theme.layout.radius,
131
+ "--daterange-field-color": colors.color,
132
+ "--daterange-field-bg": colors.bgColor,
133
+ "--daterange-field-border": colors.borderColor,
134
+ "--daterange-field-hover-bg": colors.hoverBgColor,
135
+ "--daterange-field-hover-border": colors.hoverBorder,
136
+ "--daterange-focus-border-color": colors.focusBorder,
137
+ "--daterange-placeholder-color": colors.placeholderColor,
138
+ "--daterange-separator-color": colors.iconColor,
139
+ "--daterange-toggle-color": colors.iconColor,
140
+ "--daterange-toggle-hover-color": colors.color,
141
+ "--daterange-shadow": theme.expressiveness.shadowMedium,
142
+ ...style
143
+ };
144
+ const inputProps = {
145
+ type: "text",
146
+ autoComplete: "off",
147
+ inputMode: "numeric",
148
+ disabled,
149
+ onBlur: blurHandler,
150
+ className: DateRangePicker_module_css_default.input
151
+ };
152
+ return /* @__PURE__ */ jsxs(
153
+ "div",
154
+ {
155
+ ref: (node) => {
156
+ rootRef.current = node;
157
+ if (typeof ref === "function") ref(node);
158
+ else if (ref) ref.current = node;
159
+ },
160
+ className: use_classes_default(DateRangePicker_module_css_default.daterange, className),
161
+ style: rangeStyle,
162
+ role: "group",
163
+ ...props,
164
+ children: [
165
+ /* @__PURE__ */ jsxs("div", { className: DateRangePicker_module_css_default.field, children: [
166
+ /* @__PURE__ */ jsx(
167
+ "input",
168
+ {
169
+ ...inputProps,
170
+ value: texts.start,
171
+ placeholder: startPlaceholder,
172
+ "aria-label": startLabel,
173
+ onChange: inputHandler("start")
174
+ }
175
+ ),
176
+ /* @__PURE__ */ jsx("span", { className: DateRangePicker_module_css_default.separator, "aria-hidden": "true", children: "\u2013" }),
177
+ /* @__PURE__ */ jsx(
178
+ "input",
179
+ {
180
+ ...inputProps,
181
+ ref: endRef,
182
+ value: texts.end,
183
+ placeholder: endPlaceholder,
184
+ "aria-label": endLabel,
185
+ onChange: inputHandler("end")
186
+ }
187
+ ),
188
+ /* @__PURE__ */ jsx(
189
+ "button",
190
+ {
191
+ ref: buttonRef,
192
+ type: "button",
193
+ className: DateRangePicker_module_css_default.toggle,
194
+ "aria-label": calendarLabel,
195
+ "aria-haspopup": "dialog",
196
+ "aria-expanded": open,
197
+ disabled,
198
+ onClick: () => setOpen((last) => !last),
199
+ children: /* @__PURE__ */ jsxs(
200
+ "svg",
201
+ {
202
+ viewBox: "0 0 24 24",
203
+ width: "1.25em",
204
+ height: "1.25em",
205
+ fill: "none",
206
+ stroke: "currentColor",
207
+ strokeWidth: "2",
208
+ strokeLinecap: "round",
209
+ strokeLinejoin: "round",
210
+ "aria-hidden": "true",
211
+ children: [
212
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
213
+ /* @__PURE__ */ jsx("path", { d: "M16 2v4M8 2v4M3 10h18" })
214
+ ]
215
+ }
216
+ )
217
+ }
218
+ )
219
+ ] }),
220
+ open && /* @__PURE__ */ jsx(
221
+ "div",
222
+ {
223
+ role: "dialog",
224
+ "aria-label": calendarLabel,
225
+ className: DateRangePicker_module_css_default.popup,
226
+ onKeyDown: keyDownHandler,
227
+ children: /* @__PURE__ */ jsx(
228
+ Calendar_default,
229
+ {
230
+ mode: "range",
231
+ numberOfMonths: 2,
232
+ autoFocus: true,
233
+ value: range,
234
+ min,
235
+ max,
236
+ locale,
237
+ weekStartsOn,
238
+ onChange: pick
239
+ }
240
+ )
241
+ }
242
+ )
243
+ ]
244
+ }
245
+ );
246
+ }
247
+ );
248
+ DateRangePickerComponent.displayName = "BolioUIDateRangePicker";
249
+ var DateRangePicker = with_scale_default(DateRangePickerComponent);
250
+ var DateRangePicker_default = DateRangePicker;
251
+
252
+ // core/DateRangePicker/index.ts
253
+ var DateRangePicker_default2 = DateRangePicker_default;
254
+
255
+ export {
256
+ DateRangePicker_default2 as DateRangePicker_default
257
+ };