@datum-cloud/datum-ui 0.2.0-alpha.3 → 0.2.0-alpha.4

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 (132) hide show
  1. package/README.md +46 -21
  2. package/dist/alert/index.mjs +3 -0
  3. package/dist/alert-BC2Mccfo.mjs +95 -0
  4. package/dist/autocomplete/index.mjs +7 -0
  5. package/dist/autocomplete-DZtI97HP.mjs +295 -0
  6. package/dist/avatar-stack/index.mjs +5 -0
  7. package/dist/avatar-stack-JCfBlPB9.mjs +80 -0
  8. package/dist/badge/index.mjs +3 -0
  9. package/dist/badge-bFgeYceE.mjs +185 -0
  10. package/dist/breadcrumb/index.mjs +4 -0
  11. package/dist/breadcrumb-BGYJgom_.mjs +71 -0
  12. package/dist/button/index.mjs +4 -0
  13. package/dist/button-AzpnV-WB.mjs +49 -0
  14. package/dist/button-C1wRfGtT.mjs +230 -0
  15. package/dist/button-group/index.mjs +5 -0
  16. package/dist/button-group-C1IB2K5s.mjs +40 -0
  17. package/dist/calendar/index.mjs +5 -0
  18. package/dist/calendar-DlIHeWb0.mjs +113 -0
  19. package/dist/card/index.mjs +4 -0
  20. package/dist/card-3Kd0VdNf.mjs +63 -0
  21. package/dist/chart/index.mjs +4 -0
  22. package/dist/chart-BZqUKpkh.mjs +143 -0
  23. package/dist/checkbox/index.mjs +4 -0
  24. package/dist/checkbox-LG1OKTpG.mjs +34 -0
  25. package/dist/col-lrLMZaTJ.mjs +184 -0
  26. package/dist/collapsible/index.mjs +3 -0
  27. package/dist/collapsible-Bt9UYfv3.mjs +9 -0
  28. package/dist/command/index.mjs +5 -0
  29. package/dist/command-s0Yv3abE.mjs +86 -0
  30. package/dist/components/features/date-picker/index.d.ts +3 -0
  31. package/dist/components/features/date-picker/index.d.ts.map +1 -0
  32. package/dist/components/features/dropzone/index.d.ts +1 -0
  33. package/dist/components/features/dropzone/index.d.ts.map +1 -1
  34. package/dist/date-picker/index.mjs +9 -0
  35. package/dist/{datum.provider-D6VMjSV0.mjs → datum.provider-B77goJgl.mjs} +1 -1
  36. package/dist/dialog/index.mjs +5 -0
  37. package/dist/dialog-DXBaT9gA.mjs +86 -0
  38. package/dist/dialog-bnMMf9GD.mjs +73 -0
  39. package/dist/dropdown/index.mjs +3 -0
  40. package/dist/dropdown-DtSa_lqc.mjs +112 -0
  41. package/dist/dropzone/index.mjs +5 -0
  42. package/dist/dropzone-BkOnwrS4.mjs +221 -0
  43. package/dist/empty-content/index.mjs +3 -0
  44. package/dist/empty-content-BM9rzI13.mjs +196 -0
  45. package/dist/exports/map.d.ts +3 -0
  46. package/dist/exports/map.d.ts.map +1 -0
  47. package/dist/form/index.mjs +146 -0
  48. package/dist/grid/index.mjs +3 -0
  49. package/dist/hooks/index.mjs +2 -3
  50. package/dist/hover-card/index.mjs +4 -0
  51. package/dist/hover-card-CUPfFUqE.mjs +33 -0
  52. package/dist/icon-wrapper-9ticVbRL.mjs +14 -0
  53. package/dist/icons/index.mjs +3 -3
  54. package/dist/index.mjs +66 -8
  55. package/dist/input/index.mjs +5 -0
  56. package/dist/input-DuyjEKEW.mjs +17 -0
  57. package/dist/input-fzXBheCN.mjs +17 -0
  58. package/dist/input-group/index.mjs +7 -0
  59. package/dist/input-group-CPaFSTEV.mjs +80 -0
  60. package/dist/input-number/index.mjs +6 -0
  61. package/dist/input-number-9o62JHRl.mjs +106 -0
  62. package/dist/input-with-addons/index.mjs +3 -0
  63. package/dist/input-with-addons-BQn7KCTU.mjs +30 -0
  64. package/dist/label/index.mjs +4 -0
  65. package/dist/label-_ste_Re3.mjs +44 -0
  66. package/dist/link-button-TIF2Zdrk.mjs +36 -0
  67. package/dist/loader-overlay/index.mjs +3 -0
  68. package/dist/loader-overlay-DUaQSZQP.mjs +17 -0
  69. package/dist/map/index.mjs +13 -0
  70. package/dist/map-Df8QMcX0.mjs +1094 -0
  71. package/dist/more-actions/index.mjs +5 -0
  72. package/dist/more-actions-Ch1f6Mh3.mjs +54 -0
  73. package/dist/nprogress/index.mjs +32 -0
  74. package/dist/page-title/index.mjs +3 -0
  75. package/dist/page-title-BJuo81rT.mjs +26 -0
  76. package/dist/popover/index.mjs +4 -0
  77. package/dist/popover-SQlKSz6L.mjs +36 -0
  78. package/dist/provider/index.mjs +4 -0
  79. package/dist/radio-group/index.mjs +4 -0
  80. package/dist/radio-group-Oshv0b-U.mjs +49 -0
  81. package/dist/select/index.mjs +4 -0
  82. package/dist/select-DVlEzD2W.mjs +166 -0
  83. package/dist/separator/index.mjs +4 -0
  84. package/dist/separator-T2ppyD-8.mjs +18 -0
  85. package/dist/sheet/index.mjs +5 -0
  86. package/dist/sheet-BKiCwtNO.mjs +45 -0
  87. package/dist/sheet-CtnP6gTD.mjs +77 -0
  88. package/dist/sidebar/index.mjs +11 -0
  89. package/dist/sidebar-DfqezV8t.mjs +945 -0
  90. package/dist/skeleton/index.mjs +4 -0
  91. package/dist/skeleton-vzbxA-DQ.mjs +13 -0
  92. package/dist/spinner/index.mjs +4 -0
  93. package/dist/spinner-BE7k2bAD.mjs +16 -0
  94. package/dist/{icon-wrapper-BgPkifId.mjs → spinner.icon-Bg8zgGh0.mjs} +1 -12
  95. package/dist/stepper/index.mjs +5 -0
  96. package/dist/stepper-SWB-u_nM.mjs +323 -0
  97. package/dist/switch/index.mjs +4 -0
  98. package/dist/switch-Calk7Gyw.mjs +32 -0
  99. package/dist/table/index.mjs +4 -0
  100. package/dist/table-CsXBcQLI.mjs +68 -0
  101. package/dist/tabs/index.mjs +3 -0
  102. package/dist/tabs-D8n-dqnw.mjs +52 -0
  103. package/dist/tag-input/index.mjs +5 -0
  104. package/dist/tag-input-Di7SDNbK.mjs +284 -0
  105. package/dist/task-queue/index.mjs +7 -0
  106. package/dist/task-queue-dropdown-DW72ikDH.mjs +1356 -0
  107. package/dist/textarea/index.mjs +5 -0
  108. package/dist/textarea-CxE3YbC7.mjs +17 -0
  109. package/dist/textarea-QYRcDEpK.mjs +15 -0
  110. package/dist/theme/index.mjs +4 -0
  111. package/dist/theme-script-XBouzsNR.mjs +66 -0
  112. package/dist/to-api-format-C2xjQUcI.mjs +1506 -0
  113. package/dist/toast/index.mjs +3 -0
  114. package/dist/tooltip/index.mjs +4 -0
  115. package/dist/tooltip-Dd3ActSS.mjs +74 -0
  116. package/dist/typography/index.mjs +3 -0
  117. package/dist/typography-UA7ZZvgJ.mjs +200 -0
  118. package/dist/use-copy-to-clipboard-ki-WoTml.mjs +31 -0
  119. package/dist/use-stepper-BaToCYMs.mjs +2017 -0
  120. package/dist/{use-copy-to-clipboard-BfrpD6G8.mjs → use-toast-mdn_CqRY.mjs} +34 -27
  121. package/dist/utils/index.mjs +0 -1
  122. package/dist/utils-Bfgoe-Gm.mjs +20 -0
  123. package/dist/visually-hidden/index.mjs +3 -0
  124. package/dist/visuallyhidden-aaTUk4Yo.mjs +7 -0
  125. package/package.json +208 -8
  126. package/dist/components/index.mjs +0 -8
  127. package/dist/providers/index.mjs +0 -4
  128. package/dist/theme-script-DHyLk25i.mjs +0 -11128
  129. /package/dist/{close.icon-chkXPAUC.mjs → close.icon-CMNMoXM_.mjs} +0 -0
  130. /package/dist/{map-leaflet-imports-OKaoesjZ.mjs → map-leaflet-imports-CdzvEnzY.mjs} +0 -0
  131. /package/dist/{theme.provider-DpFLwtHe.mjs → theme.provider-DgGshapa.mjs} +0 -0
  132. /package/dist/{use-debounce-BYB-jPeX.mjs → use-debounce-DQ1tmxOL.mjs} +0 -0
@@ -0,0 +1,284 @@
1
+ import { t as cn } from "./cn-DWCc1QRE.mjs";
2
+ import { t as Badge } from "./badge-bFgeYceE.mjs";
3
+ import { t as Icon } from "./icon-wrapper-9ticVbRL.mjs";
4
+ import { t as Input } from "./input-fzXBheCN.mjs";
5
+ import { X } from "lucide-react";
6
+ import React from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { z } from "zod";
9
+
10
+ //#region src/components/features/tag-input/tag-input.tsx
11
+ /**
12
+ * Used for identifying split characters when pasting
13
+ * Splits on: newlines, tabs, semicolons, commas, and pipes
14
+ * Does NOT split on dots (.) or slashes (/) to preserve email addresses and URLs
15
+ */
16
+ const SPLITTER_REGEX = /[\n\t;,|]+/;
17
+ /**
18
+ * Used for trimming leading/trailing whitespace and special characters
19
+ * Preserves alphanumeric characters, dots, @, hyphens, and underscores
20
+ */
21
+ const FORMATTING_REGEX = /^[\s"'<>]+|[\s"'<>]+$/g;
22
+ const TagInputContext = React.createContext(null);
23
+ function TagsInput({ ref, value, onValueChange, placeholder, maxItems, minItems, className, dir, validator, onValidationError, error, showValidationErrors = true, name, key, ...props }) {
24
+ const [activeIndex, setActiveIndex] = React.useState(-1);
25
+ const [inputValue, setInputValue] = React.useState("");
26
+ const [disableInput, setDisableInput] = React.useState(false);
27
+ const [disableButton, setDisableButton] = React.useState(false);
28
+ const [isValueSelected, setIsValueSelected] = React.useState(false);
29
+ const [selectedValue, setSelectedValue] = React.useState("");
30
+ const [validationError, setValidationError] = React.useState(null);
31
+ const parseMinItems = minItems ?? 0;
32
+ const parseMaxItems = maxItems ?? Infinity;
33
+ const onValueChangeHandler = React.useCallback((val) => {
34
+ const setError = (errorMessage) => {
35
+ setValidationError(errorMessage);
36
+ if (onValidationError) onValidationError(errorMessage);
37
+ };
38
+ setError(null);
39
+ if (!val.trim()) return;
40
+ if (value.includes(val)) {
41
+ setError("This tag already exists");
42
+ return;
43
+ }
44
+ if (value.length >= parseMaxItems) {
45
+ setError(`Maximum of ${parseMaxItems} tags allowed`);
46
+ return;
47
+ }
48
+ if (validator) try {
49
+ validator.parse(val);
50
+ onValueChange([...value, val]);
51
+ } catch (error) {
52
+ if (error instanceof z.ZodError) setError(error.issues[0]?.message || "Invalid input");
53
+ else setError("Validation failed");
54
+ }
55
+ else onValueChange([...value, val]);
56
+ }, [
57
+ value,
58
+ validator,
59
+ parseMaxItems
60
+ ]);
61
+ const RemoveValue = React.useCallback((val) => {
62
+ if (value.includes(val) && value.length > parseMinItems) onValueChange(value.filter((item) => item !== val));
63
+ }, [value]);
64
+ const handlePaste = React.useCallback((e) => {
65
+ e.preventDefault();
66
+ const pastedText = e.clipboardData.getData("text");
67
+ if (!pastedText) return;
68
+ const values = pastedText.split(SPLITTER_REGEX).map((val) => val.trim()).filter(Boolean).map((val) => val.replace(FORMATTING_REGEX, ""));
69
+ if (values.length === 0) return;
70
+ if (values.length === 1) {
71
+ onValueChangeHandler(values[0]);
72
+ return;
73
+ }
74
+ const validValues = [];
75
+ let hasError = false;
76
+ for (const val of values) {
77
+ if (value.includes(val) || validValues.includes(val)) continue;
78
+ if (value.length + validValues.length >= parseMaxItems) break;
79
+ if (validator) try {
80
+ validator.parse(val);
81
+ validValues.push(val);
82
+ } catch {
83
+ hasError = true;
84
+ continue;
85
+ }
86
+ else validValues.push(val);
87
+ }
88
+ if (validValues.length > 0) onValueChange([...value, ...validValues]);
89
+ if (hasError && validator) {
90
+ setValidationError("Some pasted values were invalid and skipped");
91
+ if (onValidationError) onValidationError("Some pasted values were invalid and skipped");
92
+ setTimeout(() => {
93
+ setValidationError(null);
94
+ if (onValidationError) onValidationError(null);
95
+ }, 3e3);
96
+ }
97
+ }, [
98
+ value,
99
+ onValueChangeHandler,
100
+ validator,
101
+ parseMaxItems,
102
+ onValidationError
103
+ ]);
104
+ const handleSelect = React.useCallback((e) => {
105
+ const target = e.target;
106
+ const selection = inputValue.substring(target.selectionStart ?? 0, target.selectionEnd ?? 0);
107
+ setSelectedValue(selection);
108
+ setIsValueSelected(selection === inputValue);
109
+ }, [inputValue]);
110
+ React.useEffect(() => {
111
+ const VerifyDisable = () => {
112
+ if (value.length - 1 >= parseMinItems) setDisableButton(false);
113
+ else setDisableButton(true);
114
+ if (value.length + 1 <= parseMaxItems) setDisableInput(false);
115
+ else setDisableInput(true);
116
+ };
117
+ VerifyDisable();
118
+ }, [
119
+ value,
120
+ parseMinItems,
121
+ parseMaxItems
122
+ ]);
123
+ const handleKeyDown = React.useCallback(async (e) => {
124
+ e.stopPropagation();
125
+ const moveNext = () => {
126
+ setActiveIndex(activeIndex + 1 > value.length - 1 ? -1 : activeIndex + 1);
127
+ };
128
+ const movePrev = () => {
129
+ setActiveIndex(activeIndex - 1 < 0 ? value.length - 1 : activeIndex - 1);
130
+ };
131
+ const moveCurrent = () => {
132
+ setActiveIndex(activeIndex - 1 <= 0 ? value.length - 1 === 0 ? -1 : 0 : activeIndex - 1);
133
+ };
134
+ const target = e.currentTarget;
135
+ switch (e.key) {
136
+ case "ArrowLeft":
137
+ if (dir === "rtl") {
138
+ if (value.length > 0 && activeIndex !== -1) moveNext();
139
+ } else if (value.length > 0 && target.selectionStart === 0) movePrev();
140
+ break;
141
+ case "ArrowRight":
142
+ if (dir === "rtl") {
143
+ if (value.length > 0 && target.selectionStart === 0) movePrev();
144
+ } else if (value.length > 0 && activeIndex !== -1) moveNext();
145
+ break;
146
+ case "Backspace":
147
+ case "Delete":
148
+ if (value.length > 0) {
149
+ if (activeIndex !== -1 && activeIndex < value.length) {
150
+ RemoveValue(value[activeIndex]);
151
+ moveCurrent();
152
+ } else if (target.selectionStart === 0) {
153
+ if (selectedValue === inputValue || isValueSelected) RemoveValue(value[value.length - 1]);
154
+ }
155
+ }
156
+ break;
157
+ case "Escape":
158
+ setActiveIndex(activeIndex === -1 ? value.length - 1 : -1);
159
+ break;
160
+ case "Enter":
161
+ case ",":
162
+ if (inputValue.trim() !== "") {
163
+ e.preventDefault();
164
+ onValueChangeHandler(inputValue);
165
+ setInputValue("");
166
+ }
167
+ break;
168
+ }
169
+ }, [
170
+ activeIndex,
171
+ value,
172
+ inputValue,
173
+ RemoveValue,
174
+ dir,
175
+ selectedValue,
176
+ isValueSelected,
177
+ onValueChangeHandler
178
+ ]);
179
+ const mousePreventDefault = React.useCallback((e) => {
180
+ e.preventDefault();
181
+ e.stopPropagation();
182
+ }, []);
183
+ const handleChange = React.useCallback((e) => {
184
+ setInputValue(e.currentTarget.value);
185
+ }, []);
186
+ const handleBlur = React.useCallback((e) => {
187
+ const relatedTarget = e.relatedTarget;
188
+ if (!(relatedTarget?.tagName === "BUTTON" && (relatedTarget?.getAttribute("type") === "submit" || relatedTarget?.closest("button[type=\"submit\"]"))) && inputValue.trim() !== "") {
189
+ onValueChangeHandler(inputValue);
190
+ setInputValue("");
191
+ }
192
+ }, [inputValue, onValueChangeHandler]);
193
+ return /* @__PURE__ */ jsxs(TagInputContext, {
194
+ value: React.useMemo(() => ({
195
+ value,
196
+ onValueChange,
197
+ inputValue,
198
+ setInputValue,
199
+ activeIndex,
200
+ setActiveIndex,
201
+ validator,
202
+ validationError,
203
+ setValidationError
204
+ }), [
205
+ value,
206
+ onValueChange,
207
+ inputValue,
208
+ activeIndex,
209
+ validator,
210
+ validationError
211
+ ]),
212
+ children: [/* @__PURE__ */ jsxs("div", {
213
+ ...props,
214
+ ref,
215
+ dir,
216
+ className: cn("border-input-border bg-input-background/50 text-input-foreground flex min-h-10 flex-wrap items-center gap-1 overflow-hidden rounded-lg border px-3 py-2 transition-all", activeIndex === -1 ? "focus-within:border-input-focus-border focus-within:shadow-(--input-focus-shadow) focus-within:ring-0 focus-within:ring-offset-0 focus-within:outline-hidden" : "focus-within:ring-0 focus-within:ring-offset-0 focus-within:outline-hidden", className),
217
+ suppressHydrationWarning: true,
218
+ children: [
219
+ (showValidationErrors && validationError || error) && /* @__PURE__ */ jsx("div", {
220
+ className: "mb-1 w-full text-sm text-red-500",
221
+ children: error ? Array.isArray(error) ? error[0] : error : validationError
222
+ }),
223
+ value.map((item, index) => /* @__PURE__ */ jsxs(Badge, {
224
+ tabIndex: activeIndex !== -1 ? 0 : activeIndex,
225
+ "aria-disabled": disableButton,
226
+ "data-active": activeIndex === index,
227
+ className: cn("data-[active='true']:ring-muted-foreground relative flex items-center gap-1 truncate rounded px-1 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 data-[active='true']:ring-2"),
228
+ type: "secondary",
229
+ children: [/* @__PURE__ */ jsx("span", {
230
+ className: "text-xs",
231
+ children: item
232
+ }), /* @__PURE__ */ jsxs("button", {
233
+ type: "button",
234
+ "aria-label": `Remove ${item} option`,
235
+ "aria-roledescription": "button to remove option",
236
+ disabled: disableButton,
237
+ onMouseDown: mousePreventDefault,
238
+ onClick: () => RemoveValue(item),
239
+ className: "disabled:cursor-not-allowed",
240
+ children: [/* @__PURE__ */ jsxs("span", {
241
+ className: "sr-only",
242
+ children: [
243
+ "Remove",
244
+ item,
245
+ " ",
246
+ "option"
247
+ ]
248
+ }), /* @__PURE__ */ jsx(Icon, {
249
+ icon: X,
250
+ className: "hover:stroke-destructive h-4 w-4"
251
+ })]
252
+ })]
253
+ }, item)),
254
+ /* @__PURE__ */ jsx(Input, {
255
+ tabIndex: 0,
256
+ "aria-label": "input tag",
257
+ disabled: disableInput,
258
+ onKeyDown: handleKeyDown,
259
+ onPaste: handlePaste,
260
+ onBlur: handleBlur,
261
+ value: inputValue,
262
+ onSelect: handleSelect,
263
+ onChange: activeIndex === -1 ? handleChange : void 0,
264
+ placeholder,
265
+ onClick: () => setActiveIndex(-1),
266
+ className: cn("text-input-foreground h-6 min-w-fit flex-1 border-0 bg-transparent p-0 py-1 shadow-none", "placeholder:text-input-placeholder", "focus-visible:border-transparent focus-visible:shadow-none focus-visible:ring-0 focus-visible:ring-offset-0", activeIndex !== -1 && "caret-transparent")
267
+ })
268
+ ]
269
+ }), /* @__PURE__ */ jsxs("select", {
270
+ name,
271
+ id: props.id,
272
+ multiple: true,
273
+ value,
274
+ defaultValue: void 0,
275
+ className: "absolute top-0 left-0 h-0 w-0",
276
+ onChange: () => void 0,
277
+ children: [/* @__PURE__ */ jsx("option", { value: "" }), value.map((option, idx) => /* @__PURE__ */ jsx("option", { value: option }, `${option}-${idx}`))]
278
+ }, key)]
279
+ });
280
+ }
281
+ TagsInput.displayName = "TagsInput";
282
+
283
+ //#endregion
284
+ export { TagsInput as t };
@@ -0,0 +1,7 @@
1
+ import "../utils-Bfgoe-Gm.mjs";
2
+ import "../dialog-DXBaT9gA.mjs";
3
+ import "../table-CsXBcQLI.mjs";
4
+ import "../tooltip-Dd3ActSS.mjs";
5
+ import { _ as RedisTaskStorage, a as TaskPanelItem, b as createProjectMetadata, c as TaskPanelHeader, d as useCurrentScope, f as useTasksWithLabels, g as detectStorage, h as TaskQueue, i as TaskPanel, l as getContextLabel, m as TaskQueueProvider, n as TaskSummaryDialog, o as TaskPanelCounter, p as useTaskQueue, r as TaskQueueTrigger, s as TaskPanelActions, t as TaskQueueDropdown, u as matchesCurrentScope, v as LocalTaskStorage, x as createUserMetadata, y as createOrgMetadata } from "../task-queue-dropdown-DW72ikDH.mjs";
6
+
7
+ export { LocalTaskStorage, RedisTaskStorage, TaskPanel, TaskPanelActions, TaskPanelCounter, TaskPanelHeader, TaskPanelItem, TaskQueue, TaskQueueDropdown, TaskQueueProvider, TaskQueueTrigger, TaskSummaryDialog, createOrgMetadata, createProjectMetadata, createUserMetadata, detectStorage, getContextLabel, matchesCurrentScope, useCurrentScope, useTaskQueue, useTasksWithLabels };