@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolio-ui/core",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-alpha.1",
4
4
  "description": "Amazing, modern and creative tools for React UI. 🥷🏼",
5
5
  "keywords": [
6
6
  "bolio",
@@ -70,8 +70,8 @@
70
70
  "clear-all": "rm -rf .next _static node_modules",
71
71
  "re-start": "rm -rf .next _static node_modules && yarn install && yarn dev",
72
72
  "re-build": "rm -rf .next _static node_modules && yarn install && yarn build",
73
- "release": "yarn build && yarn build:package && npm publish --access public",
74
- "release:next": "yarn build:package && npm publish --access public --tag next"
73
+ "release": "yarn build && yarn build:package && npm publish --access public --registry https://registry.npmjs.org/",
74
+ "release:next": "yarn build:package && npm publish --access public --tag next --registry https://registry.npmjs.org/"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@babel/core": "^7.26.0",
@@ -1,415 +0,0 @@
1
- import {
2
- use_scale_default,
3
- with_scale_default
4
- } from "./chunk-MAICNLTY.js";
5
- import {
6
- use_theme_default
7
- } from "./chunk-V5I4ORQQ.js";
8
- import {
9
- joinClasses,
10
- use_classes_default
11
- } from "./chunk-5KUROAEP.js";
12
-
13
- // core/Calendar/Calendar.tsx
14
- import React, { useEffect, useId, useMemo, useRef, useState } from "react";
15
-
16
- // core/Calendar/date-utils.ts
17
- var startOfDay = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate());
18
- var addDays = (date, amount) => new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
19
- var addMonths = (date, amount) => {
20
- const target = new Date(date.getFullYear(), date.getMonth() + amount, 1);
21
- const lastDay = new Date(
22
- target.getFullYear(),
23
- target.getMonth() + 1,
24
- 0
25
- ).getDate();
26
- return new Date(
27
- target.getFullYear(),
28
- target.getMonth(),
29
- Math.min(date.getDate(), lastDay)
30
- );
31
- };
32
- var isSameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
33
- var clampDate = (date, min, max) => {
34
- if (min && date < min) return min;
35
- if (max && date > max) return max;
36
- return date;
37
- };
38
- var pad = (value) => String(value).padStart(2, "0");
39
- var toISO = (date) => `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
40
- var fromISO = (text) => {
41
- const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text.trim());
42
- if (!match) return null;
43
- const [year, month, day] = [+match[1], +match[2], +match[3]];
44
- const date = new Date(year, month - 1, day);
45
- const isReal = date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;
46
- return isReal ? date : null;
47
- };
48
- var getISOWeek = (date) => {
49
- const thursday = addDays(date, 3 - (date.getDay() + 6) % 7);
50
- const firstThursday = new Date(thursday.getFullYear(), 0, 4);
51
- const weekOne = addDays(firstThursday, 3 - (firstThursday.getDay() + 6) % 7);
52
- return 1 + Math.round((thursday.getTime() - weekOne.getTime()) / 6048e5);
53
- };
54
-
55
- // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Calendar/Calendar.module.css.bolio-css-module-source
56
- var Calendar_module_css_default = { "calendar": "Calendar-module_calendar__KlHdi", "header": "Calendar-module_header__d6VGN", "title": "Calendar-module_title__r0GX1", "table": "Calendar-module_table__q-H-S", "th": "Calendar-module_th__N9m4h", "td": "Calendar-module_td__YyI6L", "button": "Calendar-module_button__h3ZK-", "navButton": "Calendar-module_navButton__jmnwu", "dayButton": "Calendar-module_dayButton__-4eeR", "today": "Calendar-module_today__fx9vj", "selected": "Calendar-module_selected__kIUsl", "outside": "Calendar-module_outside__cSs5z", "inRange": "Calendar-module_inRange__0XK-F", "rangeStart": "Calendar-module_rangeStart__T1amH", "rangeEnd": "Calendar-module_rangeEnd__B55oD", "weekNumber": "Calendar-module_weekNumber__J1hkP" };
57
-
58
- // core/Calendar/Calendar.tsx
59
- import { jsx, jsxs } from "react/jsx-runtime";
60
- var CalendarComponent = React.forwardRef(
61
- ({
62
- mode = "single",
63
- value: customValue,
64
- onChange,
65
- maxSelected,
66
- min,
67
- max,
68
- shouldDisableDate,
69
- locale = "en-US",
70
- weekStartsOn = 0,
71
- showOutsideDays = false,
72
- showWeekNumbers = false,
73
- month: customMonth,
74
- defaultMonth,
75
- onMonthChange,
76
- autoFocus = false,
77
- previousLabel = "Previous month",
78
- nextLabel = "Next month",
79
- weekLabel = "Week",
80
- className = "",
81
- style,
82
- ...props
83
- }, ref) => {
84
- const theme = use_theme_default();
85
- const { SCALES } = use_scale_default();
86
- const headingId = useId();
87
- const minDay = useMemo(() => min ? startOfDay(min) : void 0, [min]);
88
- const maxDay = useMemo(() => max ? startOfDay(max) : void 0, [max]);
89
- const [selfValue, setSelfValue] = useState(
90
- mode === "multiple" ? [] : mode === "range" ? [null, null] : null
91
- );
92
- const current = customValue !== void 0 ? customValue : selfValue;
93
- const isRange = mode === "range";
94
- const [rangeStart, rangeEnd] = isRange ? current : [];
95
- const selectedDays = isRange ? [rangeStart, rangeEnd].filter(Boolean) : mode === "multiple" ? current : current ? [current] : [];
96
- const anchor = selectedDays[0] || null;
97
- const [hovered, setHovered] = useState(null);
98
- const [focused, setFocused] = useState(
99
- () => clampDate(
100
- startOfDay(anchor || customMonth || defaultMonth || /* @__PURE__ */ new Date()),
101
- minDay,
102
- maxDay
103
- )
104
- );
105
- const gridRef = useRef(null);
106
- const moveFocus = useRef(autoFocus);
107
- const time = anchor ? anchor.getTime() : null;
108
- useEffect(() => {
109
- if (time === null) return;
110
- setFocused(clampDate(startOfDay(new Date(time)), minDay, maxDay));
111
- }, [time, minDay, maxDay]);
112
- const monthTime = customMonth ? new Date(customMonth.getFullYear(), customMonth.getMonth(), 1).getTime() : null;
113
- useEffect(() => {
114
- if (monthTime === null) return;
115
- const target = new Date(monthTime);
116
- setFocused(
117
- (last) => last.getFullYear() === target.getFullYear() && last.getMonth() === target.getMonth() ? last : clampDate(target, minDay, maxDay)
118
- );
119
- }, [monthTime, minDay, maxDay]);
120
- useEffect(() => {
121
- var _a, _b;
122
- if (!moveFocus.current) return;
123
- moveFocus.current = false;
124
- (_b = (_a = gridRef.current) == null ? void 0 : _a.querySelector(`[data-date="${toISO(focused)}"]`)) == null ? void 0 : _b.focus();
125
- }, [focused]);
126
- const formats = useMemo(
127
- () => ({
128
- month: new Intl.DateTimeFormat(locale, {
129
- month: "long",
130
- year: "numeric"
131
- }),
132
- day: new Intl.DateTimeFormat(locale, {
133
- weekday: "long",
134
- year: "numeric",
135
- month: "long",
136
- day: "numeric"
137
- }),
138
- short: new Intl.DateTimeFormat(locale, { weekday: "short" }),
139
- long: new Intl.DateTimeFormat(locale, { weekday: "long" })
140
- }),
141
- [locale]
142
- );
143
- const weekdays = useMemo(
144
- () => Array.from({ length: 7 }, (_, index) => {
145
- const date = new Date(2023, 0, 1 + (weekStartsOn + index) % 7);
146
- return {
147
- short: formats.short.format(date),
148
- long: formats.long.format(date)
149
- };
150
- }),
151
- [formats, weekStartsOn]
152
- );
153
- const year = focused.getFullYear();
154
- const month = focused.getMonth();
155
- const weeks = useMemo(() => {
156
- const offset = (new Date(year, month, 1).getDay() - weekStartsOn + 7) % 7;
157
- const total = new Date(year, month + 1, 0).getDate();
158
- const cells = [
159
- ...Array.from(
160
- { length: offset },
161
- (_, index) => showOutsideDays ? new Date(year, month, index - offset + 1) : null
162
- ),
163
- ...Array.from(
164
- { length: total },
165
- (_, index) => new Date(year, month, index + 1)
166
- )
167
- ];
168
- while (cells.length % 7)
169
- cells.push(
170
- showOutsideDays ? new Date(year, month, cells.length - offset + 1) : null
171
- );
172
- return Array.from(
173
- { length: cells.length / 7 },
174
- (_, index) => cells.slice(index * 7, index * 7 + 7)
175
- );
176
- }, [year, month, weekStartsOn, showOutsideDays]);
177
- const lastMonth = useRef(`${year}-${month}`);
178
- useEffect(() => {
179
- const key = `${year}-${month}`;
180
- if (key === lastMonth.current) return;
181
- lastMonth.current = key;
182
- if (onMonthChange) onMonthChange(new Date(year, month, 1));
183
- }, [year, month]);
184
- const isDisabled = (date) => Boolean(
185
- minDay && date < minDay || maxDay && date > maxDay || shouldDisableDate && shouldDisableDate(date)
186
- );
187
- const today = /* @__PURE__ */ new Date();
188
- const previousDisabled = Boolean(
189
- minDay && new Date(year, month, 0) < minDay
190
- );
191
- const nextDisabled = Boolean(
192
- maxDay && new Date(year, month + 1, 1) > maxDay
193
- );
194
- const commit = (next) => {
195
- if (customValue === void 0) setSelfValue(next);
196
- if (onChange) onChange(next);
197
- };
198
- const select = (date) => {
199
- if (isDisabled(date)) return;
200
- setFocused(date);
201
- if (isRange) {
202
- const start = rangeStart;
203
- const startsNew = !start || rangeEnd || date < start;
204
- return commit(startsNew ? [date, null] : [start, date]);
205
- }
206
- if (mode === "multiple") {
207
- const list = current;
208
- if (list.some((item) => isSameDay(item, date)))
209
- return commit(list.filter((item) => !isSameDay(item, date)));
210
- if (maxSelected !== void 0 && list.length >= maxSelected) return;
211
- return commit([...list, date].sort((a, b) => +a - +b));
212
- }
213
- commit(date);
214
- };
215
- const isSelected = (date) => selectedDays.some((item) => isSameDay(item, date));
216
- const previewEnd = isRange ? rangeEnd || hovered : null;
217
- const [low, high] = rangeStart && previewEnd ? rangeStart <= previewEnd ? [rangeStart, previewEnd] : [previewEnd, rangeStart] : [null, null];
218
- const isInRange = (date) => Boolean(low && high && date > low && date < high);
219
- const keyDownHandler = (event, date) => {
220
- if (event.key === "Enter" || event.key === " ") {
221
- event.preventDefault();
222
- return select(date);
223
- }
224
- const weekIndex = (date.getDay() - weekStartsOn + 7) % 7;
225
- const targets = {
226
- ArrowLeft: addDays(date, -1),
227
- ArrowRight: addDays(date, 1),
228
- ArrowUp: addDays(date, -7),
229
- ArrowDown: addDays(date, 7),
230
- Home: addDays(date, -weekIndex),
231
- End: addDays(date, 6 - weekIndex),
232
- PageUp: addMonths(date, event.shiftKey ? -12 : -1),
233
- PageDown: addMonths(date, event.shiftKey ? 12 : 1)
234
- };
235
- if (!(event.key in targets)) return;
236
- event.preventDefault();
237
- moveFocus.current = true;
238
- setFocused(clampDate(targets[event.key], minDay, maxDay));
239
- };
240
- const calendarStyle = {
241
- "--calendar-font-size": SCALES.font(1),
242
- "--calendar-text-color": theme.palette.foreground,
243
- "--calendar-width": SCALES.width(1, "auto"),
244
- "--calendar-height": SCALES.height(1, "auto"),
245
- "--calendar-padding-top": SCALES.pt(0),
246
- "--calendar-padding-right": SCALES.pr(0),
247
- "--calendar-padding-bottom": SCALES.pb(0),
248
- "--calendar-padding-left": SCALES.pl(0),
249
- "--calendar-margin-top": SCALES.mt(0),
250
- "--calendar-margin-right": SCALES.mr(0),
251
- "--calendar-margin-bottom": SCALES.mb(0),
252
- "--calendar-margin-left": SCALES.ml(0),
253
- "--calendar-weekday-color": theme.palette.accents_5,
254
- "--calendar-radius": theme.layout.radius,
255
- "--calendar-hover-bg": theme.palette.accents_2,
256
- "--calendar-focus-outline": theme.palette.primary,
257
- "--calendar-disabled-color": theme.palette.accents_3,
258
- "--calendar-today-border": theme.palette.accents_4,
259
- "--calendar-selected-color": "#fff",
260
- "--calendar-selected-bg": theme.palette.primary,
261
- "--calendar-range-bg": `color-mix(in srgb, ${theme.palette.primary} 18%, transparent)`,
262
- "--calendar-outside-color": theme.palette.accents_4,
263
- "--calendar-week-color": theme.palette.accents_4,
264
- ...style
265
- };
266
- return /* @__PURE__ */ jsxs(
267
- "div",
268
- {
269
- ref,
270
- className: use_classes_default(Calendar_module_css_default.calendar, className),
271
- style: calendarStyle,
272
- ...props,
273
- children: [
274
- /* @__PURE__ */ jsxs("div", { className: Calendar_module_css_default.header, children: [
275
- /* @__PURE__ */ jsx(
276
- "button",
277
- {
278
- type: "button",
279
- className: joinClasses(Calendar_module_css_default.button, Calendar_module_css_default.navButton),
280
- "aria-label": previousLabel,
281
- disabled: previousDisabled,
282
- onClick: () => setFocused(clampDate(addMonths(focused, -1), minDay, maxDay)),
283
- children: "\u2039"
284
- }
285
- ),
286
- /* @__PURE__ */ jsx("div", { id: headingId, className: Calendar_module_css_default.title, "aria-live": "polite", children: formats.month.format(focused) }),
287
- /* @__PURE__ */ jsx(
288
- "button",
289
- {
290
- type: "button",
291
- className: joinClasses(Calendar_module_css_default.button, Calendar_module_css_default.navButton),
292
- "aria-label": nextLabel,
293
- disabled: nextDisabled,
294
- onClick: () => setFocused(clampDate(addMonths(focused, 1), minDay, maxDay)),
295
- children: "\u203A"
296
- }
297
- )
298
- ] }),
299
- /* @__PURE__ */ jsxs(
300
- "table",
301
- {
302
- ref: gridRef,
303
- role: "grid",
304
- "aria-labelledby": headingId,
305
- className: Calendar_module_css_default.table,
306
- "aria-multiselectable": mode !== "single" || void 0,
307
- onMouseLeave: () => setHovered(null),
308
- children: [
309
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { role: "row", children: [
310
- showWeekNumbers && /* @__PURE__ */ jsx("th", { role: "columnheader", className: Calendar_module_css_default.th }),
311
- weekdays.map((weekday) => /* @__PURE__ */ jsx(
312
- "th",
313
- {
314
- role: "columnheader",
315
- scope: "col",
316
- className: Calendar_module_css_default.th,
317
- children: /* @__PURE__ */ jsx("abbr", { title: weekday.long, children: weekday.short })
318
- },
319
- weekday.long
320
- ))
321
- ] }) }),
322
- /* @__PURE__ */ jsx("tbody", { children: weeks.map((week, index) => {
323
- const reference = week.find(Boolean);
324
- const weekNumber = getISOWeek(
325
- addDays(reference, 3 - week.indexOf(reference))
326
- );
327
- return /* @__PURE__ */ jsxs("tr", { role: "row", children: [
328
- showWeekNumbers && /* @__PURE__ */ jsx(
329
- "th",
330
- {
331
- role: "rowheader",
332
- scope: "row",
333
- className: Calendar_module_css_default.weekNumber,
334
- "aria-label": `${weekLabel} ${weekNumber}`,
335
- children: weekNumber
336
- }
337
- ),
338
- week.map((date, cell) => {
339
- if (!date)
340
- return /* @__PURE__ */ jsx(
341
- "td",
342
- {
343
- role: "gridcell",
344
- className: Calendar_module_css_default.td,
345
- "aria-hidden": "true"
346
- },
347
- cell
348
- );
349
- const selectedDay = isSelected(date);
350
- const outside = date.getMonth() !== month;
351
- return /* @__PURE__ */ jsx(
352
- "td",
353
- {
354
- role: "gridcell",
355
- className: joinClasses(Calendar_module_css_default.td, {
356
- [Calendar_module_css_default.inRange]: isInRange(date),
357
- [Calendar_module_css_default.rangeStart]: Boolean(
358
- low && isSameDay(date, low) && high
359
- ),
360
- [Calendar_module_css_default.rangeEnd]: Boolean(
361
- high && isSameDay(date, high) && low
362
- )
363
- }),
364
- "aria-selected": selectedDay || isInRange(date),
365
- children: /* @__PURE__ */ jsx(
366
- "button",
367
- {
368
- type: "button",
369
- "data-date": toISO(date),
370
- "aria-label": formats.day.format(date),
371
- "aria-current": isSameDay(date, today) ? "date" : void 0,
372
- className: joinClasses(
373
- Calendar_module_css_default.button,
374
- Calendar_module_css_default.dayButton,
375
- {
376
- [Calendar_module_css_default.selected]: selectedDay,
377
- [Calendar_module_css_default.today]: isSameDay(date, today),
378
- [Calendar_module_css_default.outside]: outside
379
- }
380
- ),
381
- tabIndex: isSameDay(date, focused) ? 0 : -1,
382
- disabled: isDisabled(date),
383
- onClick: () => select(date),
384
- onMouseEnter: () => isRange && setHovered(date),
385
- onKeyDown: (event) => keyDownHandler(event, date),
386
- children: date.getDate()
387
- }
388
- )
389
- },
390
- cell
391
- );
392
- })
393
- ] }, index);
394
- }) })
395
- ]
396
- }
397
- )
398
- ]
399
- }
400
- );
401
- }
402
- );
403
- CalendarComponent.displayName = "BolioUICalendar";
404
- var Calendar = with_scale_default(CalendarComponent);
405
- var Calendar_default = Calendar;
406
-
407
- // core/Calendar/index.ts
408
- var Calendar_default2 = Calendar_default;
409
-
410
- export {
411
- startOfDay,
412
- toISO,
413
- fromISO,
414
- Calendar_default2 as Calendar_default
415
- };
@@ -14,10 +14,10 @@ var _chunkLDTDMDE6js = require('./chunk-LDTDMDE6.js');
14
14
  var _chunkBXDUHMWSjs = require('./chunk-BXDUHMWS.js');
15
15
 
16
16
 
17
- var _chunkZRORQ2WHjs = require('./chunk-ZRORQ2WH.js');
17
+ var _chunk33BUV2RXjs = require('./chunk-33BUV2RX.js');
18
18
 
19
19
 
20
- var _chunk33BUV2RXjs = require('./chunk-33BUV2RX.js');
20
+ var _chunkZRORQ2WHjs = require('./chunk-ZRORQ2WH.js');
21
21
 
22
22
 
23
23
  var _chunkDXHNQANXjs = require('./chunk-DXHNQANX.js');
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkZRORQ2WHjs = require('./chunk-ZRORQ2WH.js');
3
+ var _chunk33BUV2RXjs = require('./chunk-33BUV2RX.js');
4
4
 
5
5
 
6
- var _chunk33BUV2RXjs = require('./chunk-33BUV2RX.js');
6
+ var _chunkZRORQ2WHjs = require('./chunk-ZRORQ2WH.js');
7
7
 
8
8
 
9
9
 
@@ -12,12 +12,12 @@ import {
12
12
  import {
13
13
  use_portal_default
14
14
  } from "./chunk-BXDUHMWS.js";
15
- import {
16
- use_latest_default
17
- } from "./chunk-ZRORQ2WH.js";
18
15
  import {
19
16
  use_current_state_default
20
17
  } from "./chunk-33BUV2RX.js";
18
+ import {
19
+ use_latest_default
20
+ } from "./chunk-ZRORQ2WH.js";
21
21
  import {
22
22
  Button_default
23
23
  } from "./chunk-DXHNQANX.js";
@@ -1,9 +1,9 @@
1
- import {
2
- use_latest_default
3
- } from "./chunk-ZRORQ2WH.js";
4
1
  import {
5
2
  use_current_state_default
6
3
  } from "./chunk-33BUV2RX.js";
4
+ import {
5
+ use_latest_default
6
+ } from "./chunk-ZRORQ2WH.js";
7
7
  import {
8
8
  use_scale_default,
9
9
  with_scale_default