@bricks-toolkit/toolkit 0.1.19 → 0.1.21

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 (100) hide show
  1. package/dist/chunk-4PRNRENN.mjs +104 -0
  2. package/dist/chunk-62JXQJBD.cjs +533 -0
  3. package/dist/chunk-6LBTRQZD.mjs +806 -0
  4. package/dist/chunk-J53N2LAE.cjs +115 -0
  5. package/dist/chunk-M6XPQ5BE.cjs +808 -0
  6. package/dist/chunk-UPSMZISM.mjs +567 -0
  7. package/dist/chunk-YV3WWKQY.cjs +569 -0
  8. package/dist/chunk-Z5FRCULF.mjs +531 -0
  9. package/dist/date-picker/index.cjs +3 -2
  10. package/dist/date-picker/index.mjs +2 -1
  11. package/dist/date-time-picker/index.cjs +12 -0
  12. package/dist/date-time-picker/index.mjs +3 -0
  13. package/dist/index.cjs +27 -21
  14. package/dist/index.mjs +7 -5
  15. package/dist/time-picker/index.cjs +2 -2
  16. package/dist/time-picker/index.mjs +1 -1
  17. package/package.json +11 -1
  18. package/dist/Button.types-BsQYqZml.d.ts +0 -27
  19. package/dist/Button.types-D-srlWFf.d.mts +0 -27
  20. package/dist/TextInput.types-DRI8HQza.d.mts +0 -32
  21. package/dist/TextInput.types-DRI8HQza.d.ts +0 -32
  22. package/dist/Tooltip.types-PbUasE3C.d.mts +0 -36
  23. package/dist/Tooltip.types-PbUasE3C.d.ts +0 -36
  24. package/dist/avatar/index.d.mts +0 -29
  25. package/dist/avatar/index.d.ts +0 -29
  26. package/dist/badge/index.d.mts +0 -57
  27. package/dist/badge/index.d.ts +0 -57
  28. package/dist/breadcrumbs/index.d.mts +0 -32
  29. package/dist/breadcrumbs/index.d.ts +0 -32
  30. package/dist/button/index.d.mts +0 -8
  31. package/dist/button/index.d.ts +0 -8
  32. package/dist/card/index.d.mts +0 -42
  33. package/dist/card/index.d.ts +0 -42
  34. package/dist/checkbox/index.d.mts +0 -36
  35. package/dist/checkbox/index.d.ts +0 -36
  36. package/dist/chunk-7WNJ7L4Z.mjs +0 -335
  37. package/dist/chunk-DHC5LI2P.cjs +0 -338
  38. package/dist/chunk-VKQDW7C2.mjs +0 -336
  39. package/dist/chunk-W2ZAPLQH.cjs +0 -337
  40. package/dist/combo-box/index.d.mts +0 -62
  41. package/dist/combo-box/index.d.ts +0 -62
  42. package/dist/date-picker/index.d.mts +0 -32
  43. package/dist/date-picker/index.d.ts +0 -32
  44. package/dist/dialog/index.d.mts +0 -61
  45. package/dist/dialog/index.d.ts +0 -61
  46. package/dist/dropdown-menu/index.d.mts +0 -34
  47. package/dist/dropdown-menu/index.d.ts +0 -34
  48. package/dist/email/index.d.mts +0 -38
  49. package/dist/email/index.d.ts +0 -38
  50. package/dist/file-upload/index.d.mts +0 -27
  51. package/dist/file-upload/index.d.ts +0 -27
  52. package/dist/header/index.d.mts +0 -28
  53. package/dist/header/index.d.ts +0 -28
  54. package/dist/icon-button/index.d.mts +0 -16
  55. package/dist/icon-button/index.d.ts +0 -16
  56. package/dist/image/index.d.mts +0 -48
  57. package/dist/image/index.d.ts +0 -48
  58. package/dist/index.d.mts +0 -141
  59. package/dist/index.d.ts +0 -141
  60. package/dist/link/index.d.mts +0 -25
  61. package/dist/link/index.d.ts +0 -25
  62. package/dist/loader/index.d.mts +0 -21
  63. package/dist/loader/index.d.ts +0 -21
  64. package/dist/modal/index.d.mts +0 -116
  65. package/dist/modal/index.d.ts +0 -116
  66. package/dist/multi-select/index.d.mts +0 -59
  67. package/dist/multi-select/index.d.ts +0 -59
  68. package/dist/otp-input/index.d.mts +0 -57
  69. package/dist/otp-input/index.d.ts +0 -57
  70. package/dist/password-input/index.d.mts +0 -32
  71. package/dist/password-input/index.d.ts +0 -32
  72. package/dist/phone/index.d.mts +0 -41
  73. package/dist/phone/index.d.ts +0 -41
  74. package/dist/radio-button/index.d.mts +0 -56
  75. package/dist/radio-button/index.d.ts +0 -56
  76. package/dist/search-input/index.d.mts +0 -22
  77. package/dist/search-input/index.d.ts +0 -22
  78. package/dist/select/index.d.mts +0 -36
  79. package/dist/select/index.d.ts +0 -36
  80. package/dist/sidebar/index.d.mts +0 -96
  81. package/dist/sidebar/index.d.ts +0 -96
  82. package/dist/skeleton/index.d.mts +0 -76
  83. package/dist/skeleton/index.d.ts +0 -76
  84. package/dist/styles.d.mts +0 -2
  85. package/dist/styles.d.ts +0 -2
  86. package/dist/table/index.d.mts +0 -92
  87. package/dist/table/index.d.ts +0 -92
  88. package/dist/tabs/index.d.mts +0 -26
  89. package/dist/tabs/index.d.ts +0 -26
  90. package/dist/text-input/index.d.mts +0 -7
  91. package/dist/text-input/index.d.ts +0 -7
  92. package/dist/theme-provider/index.d.mts +0 -122
  93. package/dist/theme-provider/index.d.ts +0 -122
  94. package/dist/theme.css +0 -62
  95. package/dist/time-picker/index.d.mts +0 -32
  96. package/dist/time-picker/index.d.ts +0 -32
  97. package/dist/toaster/index.d.mts +0 -28
  98. package/dist/toaster/index.d.ts +0 -28
  99. package/dist/tooltip/index.d.mts +0 -7
  100. package/dist/tooltip/index.d.ts +0 -7
@@ -1,36 +0,0 @@
1
- import { InputHTMLAttributes, ReactNode } from 'react';
2
-
3
- type CheckboxSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
- type CheckboxState = 'default' | 'error' | 'success' | 'warning';
5
- interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
6
- /** The primary label to display next to the checkbox */
7
- label?: ReactNode;
8
- /** Additional helper text displayed beneath the checkbox */
9
- helperText?: ReactNode;
10
- /** Error message displayed beneath the checkbox when state is 'error' */
11
- errorMessage?: ReactNode;
12
- /** Success message displayed beneath the checkbox when state is 'success' */
13
- successMessage?: ReactNode;
14
- /** Warning message displayed beneath the checkbox when state is 'warning' */
15
- warningMessage?: ReactNode;
16
- /** The size of the checkbox and its associated text */
17
- size?: CheckboxSize;
18
- /** The validation state of the checkbox */
19
- state?: CheckboxState;
20
- /** Whether the checkbox represents a mixed or indeterminate state */
21
- indeterminate?: boolean;
22
- /** Custom class for the outermost container */
23
- containerClassName?: string;
24
- /** Alias for containerClassName to match other components */
25
- wrapperClassName?: string;
26
- /** Custom class for the underlying input element */
27
- inputClassName?: string;
28
- /** Custom class for the label element */
29
- labelClassName?: string;
30
- /** Custom class for the helper/message text element */
31
- messageClassName?: string;
32
- }
33
-
34
- declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
35
-
36
- export { Checkbox, type CheckboxProps, type CheckboxSize, type CheckboxState };
@@ -1,36 +0,0 @@
1
- import { InputHTMLAttributes, ReactNode } from 'react';
2
-
3
- type CheckboxSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
- type CheckboxState = 'default' | 'error' | 'success' | 'warning';
5
- interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
6
- /** The primary label to display next to the checkbox */
7
- label?: ReactNode;
8
- /** Additional helper text displayed beneath the checkbox */
9
- helperText?: ReactNode;
10
- /** Error message displayed beneath the checkbox when state is 'error' */
11
- errorMessage?: ReactNode;
12
- /** Success message displayed beneath the checkbox when state is 'success' */
13
- successMessage?: ReactNode;
14
- /** Warning message displayed beneath the checkbox when state is 'warning' */
15
- warningMessage?: ReactNode;
16
- /** The size of the checkbox and its associated text */
17
- size?: CheckboxSize;
18
- /** The validation state of the checkbox */
19
- state?: CheckboxState;
20
- /** Whether the checkbox represents a mixed or indeterminate state */
21
- indeterminate?: boolean;
22
- /** Custom class for the outermost container */
23
- containerClassName?: string;
24
- /** Alias for containerClassName to match other components */
25
- wrapperClassName?: string;
26
- /** Custom class for the underlying input element */
27
- inputClassName?: string;
28
- /** Custom class for the label element */
29
- labelClassName?: string;
30
- /** Custom class for the helper/message text element */
31
- messageClassName?: string;
32
- }
33
-
34
- declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
35
-
36
- export { Checkbox, type CheckboxProps, type CheckboxSize, type CheckboxState };
@@ -1,335 +0,0 @@
1
- import { cn } from './chunk-OCPFOFJ4.mjs';
2
- import { forwardRef, useId } from 'react';
3
- import { XMarkIcon } from '@heroicons/react/24/outline';
4
- import { jsx, jsxs } from 'react/jsx-runtime';
5
-
6
- var sizeClasses = {
7
- xs: "h-6 px-2 text-xs",
8
- sm: "h-8 px-3 text-sm",
9
- md: "h-10 px-3 text-sm",
10
- lg: "h-11 px-4 text-base",
11
- xl: "h-12 px-4 text-lg"
12
- };
13
- var labelSizeClasses = {
14
- xs: "text-xs",
15
- sm: "text-xs",
16
- md: "text-sm",
17
- lg: "text-sm",
18
- xl: "text-base"
19
- };
20
- var variantClasses = {
21
- default: "rounded-md border border-border bg-surface shadow-sm focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-0 transition-all duration-normal",
22
- filled: "rounded-md border border-transparent bg-surface-secondary focus:bg-surface focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-0 transition-all duration-normal",
23
- flushed: "rounded-none border-0 border-b border-border bg-transparent focus:outline-none focus:ring-0",
24
- unstyled: "border-0 bg-transparent p-0 focus:outline-none focus:ring-0"
25
- };
26
- var stateVariantClasses = {
27
- default: {
28
- default: "border-border focus:border-primary focus:ring-primary/40",
29
- filled: "focus:border-primary focus:ring-primary/40",
30
- flushed: "border-border focus:border-primary",
31
- unstyled: ""
32
- },
33
- error: {
34
- default: "border-error focus:border-error focus:ring-error/20",
35
- filled: "bg-error/5 focus:border-error focus:ring-error/20",
36
- flushed: "border-error focus:border-error",
37
- unstyled: ""
38
- },
39
- success: {
40
- default: "border-success focus:border-success focus:ring-success/20",
41
- filled: "bg-success/5 focus:border-success focus:ring-success/20",
42
- flushed: "border-success focus:border-success",
43
- unstyled: ""
44
- },
45
- warning: {
46
- default: "border-warning focus:border-warning focus:ring-warning/20",
47
- filled: "bg-warning/5 focus:border-warning focus:ring-warning/20",
48
- flushed: "border-warning focus:border-warning",
49
- unstyled: ""
50
- }
51
- };
52
- var stateMessageClasses = {
53
- default: "text-text-muted",
54
- error: "text-error font-medium",
55
- success: "text-success font-medium",
56
- warning: "text-warning font-medium"
57
- };
58
- var disabledClasses = "disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-surface-secondary";
59
- function getAddonPadding(hasLeft, hasRight, size) {
60
- const leftPad = {
61
- xs: "pl-6",
62
- sm: "pl-8",
63
- md: "pl-9",
64
- lg: "pl-10",
65
- xl: "pl-11"
66
- };
67
- const rightPad = {
68
- xs: "pr-6",
69
- sm: "pr-8",
70
- md: "pr-9",
71
- lg: "pr-10",
72
- xl: "pr-11"
73
- };
74
- const parts = [];
75
- if (hasLeft) parts.push(leftPad[size]);
76
- if (hasRight) parts.push(rightPad[size]);
77
- return parts.join(" ");
78
- }
79
- function getStateMessage(state, errorMessage, successMessage, warningMessage) {
80
- if (state === "error" && errorMessage) return errorMessage;
81
- if (state === "success" && successMessage) return successMessage;
82
- if (state === "warning" && warningMessage) return warningMessage;
83
- return void 0;
84
- }
85
- function AddonIcon({
86
- children,
87
- side,
88
- size,
89
- pointerEvents = false
90
- }) {
91
- const iconSizeClasses = {
92
- xs: "w-3.5 h-3.5",
93
- sm: "w-4 h-4",
94
- md: "w-4 h-4",
95
- lg: "w-5 h-5",
96
- xl: "w-5 h-5"
97
- };
98
- return /* @__PURE__ */ jsx(
99
- "span",
100
- {
101
- "aria-hidden": "true",
102
- className: cn(
103
- "absolute top-1/2 -translate-y-1/2 text-text-secondary flex items-center justify-center",
104
- !pointerEvents && "pointer-events-none",
105
- side === "left" ? "left-3" : "right-3",
106
- iconSizeClasses[size]
107
- ),
108
- children
109
- }
110
- );
111
- }
112
- function Addon({ children, side }) {
113
- return /* @__PURE__ */ jsx(
114
- "span",
115
- {
116
- "aria-hidden": "true",
117
- className: cn(
118
- "inline-flex items-center border border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",
119
- side === "left" ? "rounded-l-md border-r-0" : "rounded-r-md border-l-0"
120
- ),
121
- children
122
- }
123
- );
124
- }
125
- var DatePicker = forwardRef(function DatePicker2({
126
- label,
127
- required = false,
128
- helperText,
129
- errorMessage,
130
- successMessage,
131
- warningMessage,
132
- variant = "default",
133
- size = "md",
134
- state = "default",
135
- fullWidth = true,
136
- leftElement,
137
- rightElement,
138
- prefix,
139
- suffix,
140
- wrapperClassName,
141
- inputGroupClassName,
142
- inputClassName,
143
- labelClassName,
144
- helperClassName,
145
- id: idProp,
146
- disabled,
147
- className,
148
- clearable,
149
- isLoading,
150
- value,
151
- onChange,
152
- ...rest
153
- }, ref) {
154
- const generatedId = useId();
155
- const inputId = idProp ?? generatedId;
156
- const helperId = `${inputId}-helper`;
157
- const stateMessageId = `${inputId}-state`;
158
- const isValueString = typeof value === "string";
159
- const showClear = clearable && isValueString && value.length > 0;
160
- const hasLeftElement = leftElement !== void 0;
161
- const hasRightElement = rightElement !== void 0 || Boolean(showClear) || Boolean(isLoading);
162
- const stateMessage = getStateMessage(state, errorMessage, successMessage, warningMessage);
163
- const describedBy = [helperText ? helperId : null, stateMessage ? stateMessageId : null].filter(Boolean).join(" ") || void 0;
164
- const handleClear = () => {
165
- if (ref && typeof ref !== "function" && ref.current) {
166
- const descriptor = Reflect.getOwnPropertyDescriptor(
167
- window.HTMLInputElement.prototype,
168
- "value"
169
- );
170
- const nativeInputValueSetter = descriptor?.set;
171
- if (nativeInputValueSetter) {
172
- Reflect.apply(nativeInputValueSetter, ref.current, [""]);
173
- }
174
- const event = new Event("input", { bubbles: true });
175
- ref.current.dispatchEvent(event);
176
- } else if (onChange) {
177
- const e = {
178
- target: { value: "" },
179
- currentTarget: { value: "" },
180
- preventDefault: () => {
181
- },
182
- stopPropagation: () => {
183
- }
184
- };
185
- onChange(e);
186
- }
187
- };
188
- const renderRightIcon = () => {
189
- if (isLoading) {
190
- return /* @__PURE__ */ jsxs(
191
- "svg",
192
- {
193
- className: "animate-spin h-full w-full text-text-muted",
194
- xmlns: "http://www.w3.org/2000/svg",
195
- fill: "none",
196
- viewBox: "0 0 24 24",
197
- children: [
198
- /* @__PURE__ */ jsx(
199
- "circle",
200
- {
201
- className: "opacity-25",
202
- cx: "12",
203
- cy: "12",
204
- r: "10",
205
- stroke: "currentColor",
206
- strokeWidth: "4"
207
- }
208
- ),
209
- /* @__PURE__ */ jsx(
210
- "path",
211
- {
212
- className: "opacity-75",
213
- fill: "currentColor",
214
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
215
- }
216
- )
217
- ]
218
- }
219
- );
220
- }
221
- if (showClear) {
222
- return /* @__PURE__ */ jsx(
223
- "button",
224
- {
225
- type: "button",
226
- onClick: handleClear,
227
- className: "flex items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-hover p-0.5 transition-all duration-fast",
228
- "aria-label": "Clear input",
229
- children: /* @__PURE__ */ jsx(XMarkIcon, { className: "w-full h-full", strokeWidth: 2.5 })
230
- }
231
- );
232
- }
233
- return rightElement;
234
- };
235
- const inputElement = /* @__PURE__ */ jsx(
236
- "input",
237
- {
238
- ref,
239
- id: inputId,
240
- disabled: Boolean(disabled) || Boolean(isLoading),
241
- type: "date",
242
- value,
243
- onChange,
244
- "aria-invalid": state === "error" ? true : void 0,
245
- "aria-describedby": describedBy,
246
- "aria-required": required,
247
- className: cn(
248
- "w-full transition-colors duration-150",
249
- sizeClasses[size],
250
- variantClasses[variant],
251
- stateVariantClasses[state][variant],
252
- disabledClasses,
253
- getAddonPadding(hasLeftElement, hasRightElement, size),
254
- inputClassName
255
- ),
256
- ...rest
257
- }
258
- );
259
- return /* @__PURE__ */ jsxs(
260
- "div",
261
- {
262
- className: cn(
263
- "flex flex-col gap-1",
264
- fullWidth ? "w-full" : "w-fit",
265
- wrapperClassName,
266
- className
267
- ),
268
- children: [
269
- label !== void 0 && /* @__PURE__ */ jsxs(
270
- "label",
271
- {
272
- htmlFor: inputId,
273
- className: cn(
274
- "font-black leading-none text-text uppercase tracking-widest",
275
- labelSizeClasses[size],
276
- labelClassName
277
- ),
278
- children: [
279
- label,
280
- required && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "ml-1 text-error", children: "*" })
281
- ]
282
- }
283
- ),
284
- /* @__PURE__ */ jsxs(
285
- "div",
286
- {
287
- className: cn("flex items-stretch", fullWidth ? "w-full" : "w-fit", inputGroupClassName),
288
- children: [
289
- prefix !== void 0 && /* @__PURE__ */ jsx(Addon, { side: "left", children: prefix }),
290
- /* @__PURE__ */ jsxs("div", { className: "relative flex flex-1 items-center", children: [
291
- hasLeftElement && /* @__PURE__ */ jsx(AddonIcon, { side: "left", size, children: leftElement }),
292
- /* @__PURE__ */ jsx(
293
- "div",
294
- {
295
- className: cn(
296
- "flex-1",
297
- prefix !== void 0 && suffix !== void 0 ? "[&>input]:rounded-none" : prefix !== void 0 ? "[&>input]:rounded-l-none" : suffix !== void 0 ? "[&>input]:rounded-r-none" : ""
298
- ),
299
- children: inputElement
300
- }
301
- ),
302
- hasRightElement && /* @__PURE__ */ jsx(AddonIcon, { side: "right", size, pointerEvents: !rightElement && Boolean(showClear), children: renderRightIcon() })
303
- ] }),
304
- suffix !== void 0 && /* @__PURE__ */ jsx(Addon, { side: "right", children: suffix })
305
- ]
306
- }
307
- ),
308
- helperText !== void 0 && /* @__PURE__ */ jsx(
309
- "p",
310
- {
311
- id: helperId,
312
- className: cn("text-xs leading-tight text-text-muted font-medium", helperClassName),
313
- children: helperText
314
- }
315
- ),
316
- stateMessage !== void 0 && /* @__PURE__ */ jsx(
317
- "p",
318
- {
319
- id: stateMessageId,
320
- role: state === "error" ? "alert" : void 0,
321
- className: cn(
322
- "text-xs leading-tight mt-1 font-medium",
323
- stateMessageClasses[state],
324
- helperClassName
325
- ),
326
- children: stateMessage
327
- }
328
- )
329
- ]
330
- }
331
- );
332
- });
333
- DatePicker.displayName = "DatePicker";
334
-
335
- export { DatePicker };