@bricks-toolkit/toolkit 0.1.25 → 0.1.26

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.
@@ -255,9 +255,11 @@ var DateTimePicker = react.forwardRef(
255
255
  use12Hour = false,
256
256
  id: idProp,
257
257
  name,
258
+ type,
258
259
  "aria-label": ariaLabel,
259
260
  "aria-describedby": ariaDescribedby
260
261
  }, ref) => {
262
+ const internalRef = react.useRef(null);
261
263
  const genId = react.useId();
262
264
  const inputId = idProp ?? genId;
263
265
  const popoverId = `${inputId}-popover`;
@@ -281,8 +283,7 @@ var DateTimePicker = react.forwardRef(
281
283
  react.useEffect(() => {
282
284
  if (!isOpen) return;
283
285
  const h = (e) => {
284
- const wrapper = ref && typeof ref === "object" && "current" in ref ? ref.current : null;
285
- if (wrapper && !wrapper.contains(e.target)) {
286
+ if (internalRef.current && !internalRef.current.contains(e.target)) {
286
287
  setIsOpen(false);
287
288
  setViewMode("day");
288
289
  }
@@ -395,7 +396,14 @@ var DateTimePicker = react.forwardRef(
395
396
  return /* @__PURE__ */ jsxRuntime.jsxs(
396
397
  "div",
397
398
  {
398
- ref,
399
+ ref: (node) => {
400
+ internalRef.current = node;
401
+ if (typeof ref === "function") {
402
+ ref(node);
403
+ } else if (ref) {
404
+ ref.current = node;
405
+ }
406
+ },
399
407
  className: chunkL5VQZZVR_cjs.cn(
400
408
  "flex flex-col gap-1 relative",
401
409
  fullWidth ? "w-full" : "w-fit",
@@ -430,7 +438,7 @@ var DateTimePicker = react.forwardRef(
430
438
  "button",
431
439
  {
432
440
  id: inputId,
433
- type: "button",
441
+ type: type ?? "button",
434
442
  role: "combobox",
435
443
  "aria-expanded": isOpen,
436
444
  "aria-haspopup": "dialog",
@@ -1,6 +1,6 @@
1
1
  import { parseISODate, toISODateString, buildCalendarGrid, getYearRange, MONTH_NAMES, DAY_NAMES_SHORT, isSameDay, isDisabledDate, MONTH_NAMES_SHORT, formatDate } from './chunk-4PRNRENN.mjs';
2
2
  import { cn } from './chunk-OCPFOFJ4.mjs';
3
- import { forwardRef, useId, useState, useMemo, useEffect, useCallback, useRef } from 'react';
3
+ import { forwardRef, useRef, useId, useState, useMemo, useEffect, useCallback } from 'react';
4
4
  import { CalendarIcon, XMarkIcon, ClockIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/24/outline';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
 
@@ -253,9 +253,11 @@ var DateTimePicker = forwardRef(
253
253
  use12Hour = false,
254
254
  id: idProp,
255
255
  name,
256
+ type,
256
257
  "aria-label": ariaLabel,
257
258
  "aria-describedby": ariaDescribedby
258
259
  }, ref) => {
260
+ const internalRef = useRef(null);
259
261
  const genId = useId();
260
262
  const inputId = idProp ?? genId;
261
263
  const popoverId = `${inputId}-popover`;
@@ -279,8 +281,7 @@ var DateTimePicker = forwardRef(
279
281
  useEffect(() => {
280
282
  if (!isOpen) return;
281
283
  const h = (e) => {
282
- const wrapper = ref && typeof ref === "object" && "current" in ref ? ref.current : null;
283
- if (wrapper && !wrapper.contains(e.target)) {
284
+ if (internalRef.current && !internalRef.current.contains(e.target)) {
284
285
  setIsOpen(false);
285
286
  setViewMode("day");
286
287
  }
@@ -393,7 +394,14 @@ var DateTimePicker = forwardRef(
393
394
  return /* @__PURE__ */ jsxs(
394
395
  "div",
395
396
  {
396
- ref,
397
+ ref: (node) => {
398
+ internalRef.current = node;
399
+ if (typeof ref === "function") {
400
+ ref(node);
401
+ } else if (ref) {
402
+ ref.current = node;
403
+ }
404
+ },
397
405
  className: cn(
398
406
  "flex flex-col gap-1 relative",
399
407
  fullWidth ? "w-full" : "w-fit",
@@ -428,7 +436,7 @@ var DateTimePicker = forwardRef(
428
436
  "button",
429
437
  {
430
438
  id: inputId,
431
- type: "button",
439
+ type: type ?? "button",
432
440
  role: "combobox",
433
441
  "aria-expanded": isOpen,
434
442
  "aria-haspopup": "dialog",
@@ -256,9 +256,11 @@ var TimePicker = react.forwardRef(
256
256
  minuteStep = 1,
257
257
  use12Hour = false,
258
258
  name,
259
+ type,
259
260
  "aria-label": ariaLabel,
260
261
  "aria-describedby": ariaDescribedby
261
262
  }, ref) => {
263
+ const internalRef = react.useRef(null);
262
264
  const generatedId = react.useId();
263
265
  const inputId = idProp ?? generatedId;
264
266
  const helperId = `${inputId}-helper`;
@@ -277,8 +279,7 @@ var TimePicker = react.forwardRef(
277
279
  react.useEffect(() => {
278
280
  if (!isOpen) return;
279
281
  function handleClick(e) {
280
- const wrapper = ref && typeof ref === "object" && "current" in ref ? ref.current : null;
281
- if (wrapper && !wrapper.contains(e.target)) {
282
+ if (internalRef.current && !internalRef.current.contains(e.target)) {
282
283
  setIsOpen(false);
283
284
  }
284
285
  }
@@ -338,7 +339,14 @@ var TimePicker = react.forwardRef(
338
339
  return /* @__PURE__ */ jsxRuntime.jsxs(
339
340
  "div",
340
341
  {
341
- ref,
342
+ ref: (node) => {
343
+ internalRef.current = node;
344
+ if (typeof ref === "function") {
345
+ ref(node);
346
+ } else if (ref) {
347
+ ref.current = node;
348
+ }
349
+ },
342
350
  className: chunkL5VQZZVR_cjs.cn(
343
351
  "flex flex-col gap-1 relative",
344
352
  fullWidth ? "w-full" : "w-fit",
@@ -373,7 +381,7 @@ var TimePicker = react.forwardRef(
373
381
  "button",
374
382
  {
375
383
  id: inputId,
376
- type: "button",
384
+ type: type ?? "button",
377
385
  role: "combobox",
378
386
  "aria-expanded": isOpen,
379
387
  "aria-haspopup": "dialog",
@@ -135,9 +135,11 @@ var DatePicker = react.forwardRef(
135
135
  disabledDates,
136
136
  locale = "en-US",
137
137
  name,
138
+ type,
138
139
  "aria-label": ariaLabel,
139
140
  "aria-describedby": ariaDescribedby
140
141
  }, ref) => {
142
+ const internalRef = react.useRef(null);
141
143
  const generatedId = react.useId();
142
144
  const inputId = idProp ?? generatedId;
143
145
  const helperId = `${inputId}-helper`;
@@ -164,8 +166,7 @@ var DatePicker = react.forwardRef(
164
166
  react.useEffect(() => {
165
167
  if (!isOpen) return;
166
168
  function handleClick(e) {
167
- const wrapper = ref && typeof ref === "object" && "current" in ref ? ref.current : null;
168
- if (wrapper && !wrapper.contains(e.target)) {
169
+ if (internalRef.current && !internalRef.current.contains(e.target)) {
169
170
  setIsOpen(false);
170
171
  setViewMode("day");
171
172
  }
@@ -238,7 +239,14 @@ var DatePicker = react.forwardRef(
238
239
  return /* @__PURE__ */ jsxRuntime.jsxs(
239
240
  "div",
240
241
  {
241
- ref,
242
+ ref: (node) => {
243
+ internalRef.current = node;
244
+ if (typeof ref === "function") {
245
+ ref(node);
246
+ } else if (ref) {
247
+ ref.current = node;
248
+ }
249
+ },
242
250
  className: chunkL5VQZZVR_cjs.cn(
243
251
  "flex flex-col gap-1 relative",
244
252
  fullWidth ? "w-full" : "w-fit",
@@ -273,7 +281,7 @@ var DatePicker = react.forwardRef(
273
281
  "button",
274
282
  {
275
283
  id: inputId,
276
- type: "button",
284
+ type: type ?? "button",
277
285
  role: "combobox",
278
286
  "aria-expanded": isOpen,
279
287
  "aria-haspopup": "dialog",
@@ -1,5 +1,5 @@
1
1
  import { cn } from './chunk-OCPFOFJ4.mjs';
2
- import { forwardRef, useId, useState, useEffect, useCallback, useRef } from 'react';
2
+ import { forwardRef, useRef, useId, useState, useEffect, useCallback } from 'react';
3
3
  import { ClockIcon, XMarkIcon, ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/24/outline';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -254,9 +254,11 @@ var TimePicker = forwardRef(
254
254
  minuteStep = 1,
255
255
  use12Hour = false,
256
256
  name,
257
+ type,
257
258
  "aria-label": ariaLabel,
258
259
  "aria-describedby": ariaDescribedby
259
260
  }, ref) => {
261
+ const internalRef = useRef(null);
260
262
  const generatedId = useId();
261
263
  const inputId = idProp ?? generatedId;
262
264
  const helperId = `${inputId}-helper`;
@@ -275,8 +277,7 @@ var TimePicker = forwardRef(
275
277
  useEffect(() => {
276
278
  if (!isOpen) return;
277
279
  function handleClick(e) {
278
- const wrapper = ref && typeof ref === "object" && "current" in ref ? ref.current : null;
279
- if (wrapper && !wrapper.contains(e.target)) {
280
+ if (internalRef.current && !internalRef.current.contains(e.target)) {
280
281
  setIsOpen(false);
281
282
  }
282
283
  }
@@ -336,7 +337,14 @@ var TimePicker = forwardRef(
336
337
  return /* @__PURE__ */ jsxs(
337
338
  "div",
338
339
  {
339
- ref,
340
+ ref: (node) => {
341
+ internalRef.current = node;
342
+ if (typeof ref === "function") {
343
+ ref(node);
344
+ } else if (ref) {
345
+ ref.current = node;
346
+ }
347
+ },
340
348
  className: cn(
341
349
  "flex flex-col gap-1 relative",
342
350
  fullWidth ? "w-full" : "w-fit",
@@ -371,7 +379,7 @@ var TimePicker = forwardRef(
371
379
  "button",
372
380
  {
373
381
  id: inputId,
374
- type: "button",
382
+ type: type ?? "button",
375
383
  role: "combobox",
376
384
  "aria-expanded": isOpen,
377
385
  "aria-haspopup": "dialog",
@@ -1,6 +1,6 @@
1
1
  import { parseISODate, buildCalendarGrid, getYearRange, formatDate, MONTH_NAMES, DAY_NAMES_SHORT, isSameDay, isDisabledDate, MONTH_NAMES_SHORT, toISODateString } from './chunk-4PRNRENN.mjs';
2
2
  import { cn } from './chunk-OCPFOFJ4.mjs';
3
- import { forwardRef, useId, useState, useMemo, useRef, useEffect } from 'react';
3
+ import { forwardRef, useRef, useId, useState, useMemo, useEffect } from 'react';
4
4
  import { CalendarIcon, XMarkIcon, ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
 
@@ -133,9 +133,11 @@ var DatePicker = forwardRef(
133
133
  disabledDates,
134
134
  locale = "en-US",
135
135
  name,
136
+ type,
136
137
  "aria-label": ariaLabel,
137
138
  "aria-describedby": ariaDescribedby
138
139
  }, ref) => {
140
+ const internalRef = useRef(null);
139
141
  const generatedId = useId();
140
142
  const inputId = idProp ?? generatedId;
141
143
  const helperId = `${inputId}-helper`;
@@ -162,8 +164,7 @@ var DatePicker = forwardRef(
162
164
  useEffect(() => {
163
165
  if (!isOpen) return;
164
166
  function handleClick(e) {
165
- const wrapper = ref && typeof ref === "object" && "current" in ref ? ref.current : null;
166
- if (wrapper && !wrapper.contains(e.target)) {
167
+ if (internalRef.current && !internalRef.current.contains(e.target)) {
167
168
  setIsOpen(false);
168
169
  setViewMode("day");
169
170
  }
@@ -236,7 +237,14 @@ var DatePicker = forwardRef(
236
237
  return /* @__PURE__ */ jsxs(
237
238
  "div",
238
239
  {
239
- ref,
240
+ ref: (node) => {
241
+ internalRef.current = node;
242
+ if (typeof ref === "function") {
243
+ ref(node);
244
+ } else if (ref) {
245
+ ref.current = node;
246
+ }
247
+ },
240
248
  className: cn(
241
249
  "flex flex-col gap-1 relative",
242
250
  fullWidth ? "w-full" : "w-fit",
@@ -271,7 +279,7 @@ var DatePicker = forwardRef(
271
279
  "button",
272
280
  {
273
281
  id: inputId,
274
- type: "button",
282
+ type: type ?? "button",
275
283
  role: "combobox",
276
284
  "aria-expanded": isOpen,
277
285
  "aria-haspopup": "dialog",
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkDL6RO422_cjs = require('../chunk-DL6RO422.cjs');
3
+ var chunkIINDMJBE_cjs = require('../chunk-IINDMJBE.cjs');
4
4
  require('../chunk-J53N2LAE.cjs');
5
5
  require('../chunk-L5VQZZVR.cjs');
6
6
 
@@ -8,5 +8,5 @@ require('../chunk-L5VQZZVR.cjs');
8
8
 
9
9
  Object.defineProperty(exports, "DatePicker", {
10
10
  enumerable: true,
11
- get: function () { return chunkDL6RO422_cjs.DatePicker; }
11
+ get: function () { return chunkIINDMJBE_cjs.DatePicker; }
12
12
  });
@@ -43,6 +43,7 @@ interface DatePickerProps {
43
43
  minDate?: Date;
44
44
  maxDate?: Date;
45
45
  disabledDates?: Date[];
46
+ type?: 'button' | 'submit' | 'reset';
46
47
  'aria-label'?: string;
47
48
  'aria-describedby'?: string;
48
49
  }
@@ -43,6 +43,7 @@ interface DatePickerProps {
43
43
  minDate?: Date;
44
44
  maxDate?: Date;
45
45
  disabledDates?: Date[];
46
+ type?: 'button' | 'submit' | 'reset';
46
47
  'aria-label'?: string;
47
48
  'aria-describedby'?: string;
48
49
  }
@@ -1,3 +1,3 @@
1
- export { DatePicker } from '../chunk-GQCJTIVO.mjs';
1
+ export { DatePicker } from '../chunk-XDN5IK2K.mjs';
2
2
  import '../chunk-4PRNRENN.mjs';
3
3
  import '../chunk-OCPFOFJ4.mjs';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkWVWZ73XT_cjs = require('../chunk-WVWZ73XT.cjs');
3
+ var chunk6GU53FA5_cjs = require('../chunk-6GU53FA5.cjs');
4
4
  require('../chunk-J53N2LAE.cjs');
5
5
  require('../chunk-L5VQZZVR.cjs');
6
6
 
@@ -8,5 +8,5 @@ require('../chunk-L5VQZZVR.cjs');
8
8
 
9
9
  Object.defineProperty(exports, "DateTimePicker", {
10
10
  enumerable: true,
11
- get: function () { return chunkWVWZ73XT_cjs.DateTimePicker; }
11
+ get: function () { return chunk6GU53FA5_cjs.DateTimePicker; }
12
12
  });
@@ -43,6 +43,7 @@ interface DateTimePickerProps {
43
43
  disabledDates?: Date[];
44
44
  minuteStep?: number;
45
45
  use12Hour?: boolean;
46
+ type?: 'button' | 'submit' | 'reset';
46
47
  'aria-label'?: string;
47
48
  'aria-describedby'?: string;
48
49
  }
@@ -43,6 +43,7 @@ interface DateTimePickerProps {
43
43
  disabledDates?: Date[];
44
44
  minuteStep?: number;
45
45
  use12Hour?: boolean;
46
+ type?: 'button' | 'submit' | 'reset';
46
47
  'aria-label'?: string;
47
48
  'aria-describedby'?: string;
48
49
  }
@@ -1,3 +1,3 @@
1
- export { DateTimePicker } from '../chunk-EKN2P6XK.mjs';
1
+ export { DateTimePicker } from '../chunk-BLELGRQT.mjs';
2
2
  import '../chunk-4PRNRENN.mjs';
3
3
  import '../chunk-OCPFOFJ4.mjs';
package/dist/index.cjs CHANGED
@@ -7,7 +7,7 @@ require('./chunk-NMJ5CVZH.cjs');
7
7
  var chunkOEU5VG3D_cjs = require('./chunk-OEU5VG3D.cjs');
8
8
  var chunkY6AN7AWX_cjs = require('./chunk-Y6AN7AWX.cjs');
9
9
  var chunkXFNRKHHF_cjs = require('./chunk-XFNRKHHF.cjs');
10
- var chunkPMOWOLIQ_cjs = require('./chunk-PMOWOLIQ.cjs');
10
+ var chunkG2VVB2YP_cjs = require('./chunk-G2VVB2YP.cjs');
11
11
  var chunkYMMNWJT6_cjs = require('./chunk-YMMNWJT6.cjs');
12
12
  var chunkQ3IFXFFD_cjs = require('./chunk-Q3IFXFFD.cjs');
13
13
  var chunkYK7IS7JL_cjs = require('./chunk-YK7IS7JL.cjs');
@@ -22,8 +22,8 @@ var chunkBIKJK4L4_cjs = require('./chunk-BIKJK4L4.cjs');
22
22
  var chunkVRZFAKSV_cjs = require('./chunk-VRZFAKSV.cjs');
23
23
  var chunk7R5JRJ2W_cjs = require('./chunk-7R5JRJ2W.cjs');
24
24
  var chunkKLBABQEJ_cjs = require('./chunk-KLBABQEJ.cjs');
25
- var chunkDL6RO422_cjs = require('./chunk-DL6RO422.cjs');
26
- var chunkWVWZ73XT_cjs = require('./chunk-WVWZ73XT.cjs');
25
+ var chunkIINDMJBE_cjs = require('./chunk-IINDMJBE.cjs');
26
+ var chunk6GU53FA5_cjs = require('./chunk-6GU53FA5.cjs');
27
27
  require('./chunk-J53N2LAE.cjs');
28
28
  var chunkOPOCCRJG_cjs = require('./chunk-OPOCCRJG.cjs');
29
29
  var chunkAJXVELXK_cjs = require('./chunk-AJXVELXK.cjs');
@@ -651,7 +651,7 @@ Object.defineProperty(exports, "TextInput", {
651
651
  });
652
652
  Object.defineProperty(exports, "TimePicker", {
653
653
  enumerable: true,
654
- get: function () { return chunkPMOWOLIQ_cjs.TimePicker; }
654
+ get: function () { return chunkG2VVB2YP_cjs.TimePicker; }
655
655
  });
656
656
  Object.defineProperty(exports, "Toaster", {
657
657
  enumerable: true,
@@ -727,11 +727,11 @@ Object.defineProperty(exports, "ComboBox", {
727
727
  });
728
728
  Object.defineProperty(exports, "DatePicker", {
729
729
  enumerable: true,
730
- get: function () { return chunkDL6RO422_cjs.DatePicker; }
730
+ get: function () { return chunkIINDMJBE_cjs.DatePicker; }
731
731
  });
732
732
  Object.defineProperty(exports, "DateTimePicker", {
733
733
  enumerable: true,
734
- get: function () { return chunkWVWZ73XT_cjs.DateTimePicker; }
734
+ get: function () { return chunk6GU53FA5_cjs.DateTimePicker; }
735
735
  });
736
736
  Object.defineProperty(exports, "Dialog", {
737
737
  enumerable: true,
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import './chunk-SBNNV6FE.mjs';
5
5
  export { Pagination, Table } from './chunk-7364SUK6.mjs';
6
6
  export { Tabs } from './chunk-G4HVY6FM.mjs';
7
7
  export { TextInput } from './chunk-CMER5LO3.mjs';
8
- export { TimePicker } from './chunk-EGGXXVN2.mjs';
8
+ export { TimePicker } from './chunk-S55DHXC3.mjs';
9
9
  export { Toaster } from './chunk-YOTCXSXL.mjs';
10
10
  export { Sidebar } from './chunk-PJH2KEWK.mjs';
11
11
  export { Header } from './chunk-EL7COTGN.mjs';
@@ -20,8 +20,8 @@ export { Phone } from './chunk-3YIGXRMU.mjs';
20
20
  export { RadioButton } from './chunk-DN2GFJF4.mjs';
21
21
  export { Select } from './chunk-TIVSMCXZ.mjs';
22
22
  export { ComboBox } from './chunk-4DA7CRNV.mjs';
23
- export { DatePicker } from './chunk-GQCJTIVO.mjs';
24
- export { DateTimePicker } from './chunk-EKN2P6XK.mjs';
23
+ export { DatePicker } from './chunk-XDN5IK2K.mjs';
24
+ export { DateTimePicker } from './chunk-BLELGRQT.mjs';
25
25
  import './chunk-4PRNRENN.mjs';
26
26
  export { Dialog, DialogBody, DialogCloseButton, DialogFooter, DialogHeader } from './chunk-OQPCL5XX.mjs';
27
27
  export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from './chunk-2POU3NX4.mjs';
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkPMOWOLIQ_cjs = require('../chunk-PMOWOLIQ.cjs');
3
+ var chunkG2VVB2YP_cjs = require('../chunk-G2VVB2YP.cjs');
4
4
  require('../chunk-L5VQZZVR.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "TimePicker", {
9
9
  enumerable: true,
10
- get: function () { return chunkPMOWOLIQ_cjs.TimePicker; }
10
+ get: function () { return chunkG2VVB2YP_cjs.TimePicker; }
11
11
  });
@@ -42,6 +42,7 @@ interface TimePickerProps {
42
42
  minuteStep?: number;
43
43
  /** Show 12-hour AM/PM mode. Default false */
44
44
  use12Hour?: boolean;
45
+ type?: 'button' | 'submit' | 'reset';
45
46
  'aria-label'?: string;
46
47
  'aria-describedby'?: string;
47
48
  }
@@ -42,6 +42,7 @@ interface TimePickerProps {
42
42
  minuteStep?: number;
43
43
  /** Show 12-hour AM/PM mode. Default false */
44
44
  use12Hour?: boolean;
45
+ type?: 'button' | 'submit' | 'reset';
45
46
  'aria-label'?: string;
46
47
  'aria-describedby'?: string;
47
48
  }
@@ -1,2 +1,2 @@
1
- export { TimePicker } from '../chunk-EGGXXVN2.mjs';
1
+ export { TimePicker } from '../chunk-S55DHXC3.mjs';
2
2
  import '../chunk-OCPFOFJ4.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bricks-toolkit/toolkit",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Micro-modularized, fully independent, type-safe UI component library",
5
5
  "license": "MIT",
6
6
  "author": "ITProfound",