@sunggang/ui-lib 0.3.25 → 0.3.27

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.
package/index.esm2.js CHANGED
@@ -18224,252 +18224,68 @@ var DropImage = function(param) {
18224
18224
  });
18225
18225
  };
18226
18226
 
18227
- var COLORS = [
18228
- "blue",
18229
- "orange",
18230
- "yellow",
18231
- "red",
18232
- "purple",
18233
- "amber",
18234
- "lime",
18235
- "green",
18236
- "emerald",
18237
- "teal",
18238
- "cyan",
18239
- "sky",
18240
- "violet",
18241
- "indigo",
18242
- "purple",
18243
- "fuchsia",
18244
- "pink",
18245
- "rose"
18246
- ];
18247
- var DEFAULT_THEME = "blue";
18248
- var THEME_DATA = {
18249
- bg: {
18250
- blue: "bg-blue-500",
18251
- orange: "bg-orange-500",
18252
- yellow: "bg-yellow-500",
18253
- red: "bg-red-500",
18254
- purple: "bg-purple-500",
18255
- amber: "bg-amber-500",
18256
- lime: "bg-lime-500",
18257
- green: "bg-green-500",
18258
- emerald: "bg-emerald-500",
18259
- teal: "bg-teal-500",
18260
- cyan: "bg-cyan-500",
18261
- sky: "bg-sky-500",
18262
- indigo: "bg-indigo-500",
18263
- violet: "bg-violet-500",
18264
- fuchsia: "bg-fuchsia-500",
18265
- pink: "bg-pink-500",
18266
- rose: "bg-rose-500"
18267
- },
18268
- bgHover: {
18269
- blue: "hover:bg-blue-100",
18270
- orange: "hover:bg-orange-100",
18271
- yellow: "hover:bg-yellow-100",
18272
- red: "hover:bg-red-100",
18273
- purple: "hover:bg-purple-100",
18274
- amber: "hover:bg-amber-100",
18275
- lime: "hover:bg-lime-100",
18276
- green: "hover:bg-green-100",
18277
- emerald: "hover:bg-emerald-100",
18278
- teal: "hover:bg-teal-100",
18279
- cyan: "hover:bg-cyan-100",
18280
- sky: "hover:bg-sky-100",
18281
- indigo: "hover:bg-indigo-100",
18282
- violet: "hover:bg-violet-100",
18283
- fuchsia: "hover:bg-fuchsia-100",
18284
- pink: "hover:bg-pink-100",
18285
- rose: "hover:bg-rose-100"
18286
- },
18287
- ring: {
18288
- blue: "focus:ring-blue-500/20",
18289
- orange: "focus:ring-orange-500/20",
18290
- yellow: "focus:ring-yellow-500/20",
18291
- red: "focus:ring-red-500/20",
18292
- purple: "focus:ring-purple-500/20",
18293
- amber: "focus:ring-amber-500/20",
18294
- lime: "focus:ring-lime-500/20",
18295
- green: "focus:ring-green-500/20",
18296
- emerald: "focus:ring-emerald-500/20",
18297
- teal: "focus:ring-teal-500/20",
18298
- cyan: "focus:ring-cyan-500/20",
18299
- sky: "focus:ring-sky-500/20",
18300
- indigo: "focus:ring-indigo-500/20",
18301
- violet: "focus:ring-violet-500/20",
18302
- fuchsia: "focus:ring-fuchsia-500/20",
18303
- pink: "focus:ring-pink-500/20",
18304
- rose: "focus:ring-rose-500/20"
18305
- },
18306
- borderFocus: {
18307
- blue: "focus:border-blue-500",
18308
- orange: "focus:border-orange-500",
18309
- yellow: "focus:border-yellow-500",
18310
- red: "focus:border-red-500",
18311
- purple: "focus:border-purple-500",
18312
- amber: "focus:border-amber-500",
18313
- lime: "focus:border-lime-500",
18314
- green: "focus:border-green-500",
18315
- emerald: "focus:border-emerald-500",
18316
- teal: "focus:border-teal-500",
18317
- cyan: "focus:border-cyan-500",
18318
- sky: "focus:border-sky-500",
18319
- indigo: "focus:border-indigo-500",
18320
- violet: "focus:border-violet-500",
18321
- fuchsia: "focus:border-fuchsia-500",
18322
- pink: "focus:border-pink-500",
18323
- rose: "focus:border-rose-500"
18324
- },
18325
- text: {
18326
- blue: "text-blue-500",
18327
- orange: "text-orange-500",
18328
- yellow: "text-yellow-500",
18329
- red: "text-red-500",
18330
- purple: "text-purple-500",
18331
- amber: "text-amber-500",
18332
- lime: "text-lime-500",
18333
- green: "text-green-500",
18334
- emerald: "text-emerald-500",
18335
- teal: "text-teal-500",
18336
- cyan: "text-cyan-500",
18337
- sky: "text-sky-500",
18338
- indigo: "text-indigo-500",
18339
- violet: "text-violet-500",
18340
- fuchsia: "text-fuchsia-500",
18341
- pink: "text-pink-500",
18342
- rose: "text-rose-500"
18343
- },
18344
- textHover: {
18345
- blue: "hover:text-blue-500",
18346
- orange: "hover:text-orange-500",
18347
- yellow: "hover:text-yellow-500",
18348
- red: "hover:text-red-500",
18349
- purple: "hover:text-purple-500",
18350
- amber: "hover:text-amber-500",
18351
- lime: "hover:text-lime-500",
18352
- green: "hover:text-green-500",
18353
- emerald: "hover:text-emerald-500",
18354
- teal: "hover:text-teal-500",
18355
- cyan: "hover:text-cyan-500",
18356
- sky: "hover:text-sky-500",
18357
- indigo: "hover:text-indigo-500",
18358
- violet: "hover:text-violet-500",
18359
- fuchsia: "hover:text-fuchsia-500",
18360
- pink: "hover:text-pink-500",
18361
- rose: "hover:text-rose-500"
18362
- }
18227
+ var index$2 = /*#__PURE__*/Object.freeze({
18228
+ __proto__: null,
18229
+ DropImage: DropImage
18230
+ });
18231
+
18232
+ var dynamic$1 = {
18233
+ exports: {}
18363
18234
  };
18364
18235
 
18365
- function useOnClickOutside(ref, handler) {
18366
- useEffect(function() {
18367
- var listener = function(event) {
18368
- if (!ref.current || ref.current.contains(event.target)) {
18369
- return;
18370
- }
18371
- handler(event);
18372
- };
18373
- document.addEventListener("mousedown", listener);
18374
- document.addEventListener("touchstart", listener);
18375
- return function() {
18376
- document.removeEventListener("mousedown", listener);
18377
- document.removeEventListener("touchstart", listener);
18378
- };
18379
- }, [
18380
- ref,
18381
- handler
18382
- ]);
18236
+ var _interop_require_default$1 = {};
18237
+
18238
+ _interop_require_default$1._ = _interop_require_default$1._interop_require_default = _interop_require_default;
18239
+ function _interop_require_default(obj) {
18240
+ return obj && obj.__esModule ? obj : {
18241
+ default: obj
18242
+ };
18383
18243
  }
18384
18244
 
18385
- var CloseIcon = function(param) {
18386
- var _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
18387
- return /*#__PURE__*/ jsx("svg", {
18388
- className: className,
18389
- fill: "currentColor",
18390
- viewBox: "0 0 20 20",
18391
- xmlns: "http://www.w3.org/2000/svg",
18392
- children: /*#__PURE__*/ jsx("path", {
18393
- fillRule: "evenodd",
18394
- d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
18395
- clipRule: "evenodd"
18396
- })
18397
- });
18398
- };
18399
- var ChevronIcon = function(param) {
18400
- var _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
18401
- return /*#__PURE__*/ jsx("svg", {
18402
- className: className,
18403
- fill: "currentColor",
18404
- viewBox: "0 0 20 20",
18405
- xmlns: "http://www.w3.org/2000/svg",
18406
- children: /*#__PURE__*/ jsx("path", {
18407
- fillRule: "evenodd",
18408
- d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
18409
- clipRule: "evenodd"
18410
- })
18411
- });
18412
- };
18413
- var SearchIcon = function(param) {
18414
- var _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
18415
- return /*#__PURE__*/ jsx("svg", {
18416
- className: className,
18417
- fill: "none",
18418
- stroke: "currentColor",
18419
- viewBox: "0 0 24 24",
18420
- xmlns: "http://www.w3.org/2000/svg",
18421
- children: /*#__PURE__*/ jsx("path", {
18422
- strokeLinecap: "round",
18423
- strokeLinejoin: "round",
18424
- strokeWidth: 2,
18425
- d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
18426
- })
18427
- });
18428
- };
18245
+ var loadable_sharedRuntime = {};
18429
18246
 
18430
- var SelectContext = /*#__PURE__*/ createContext({
18431
- value: null,
18432
- handleValueChange: function(selected) {
18433
- console.log("selected:", selected);
18434
- },
18435
- formatGroupLabel: null,
18436
- formatOptionLabel: null,
18437
- classNames: undefined
18438
- });
18439
- var useSelectContext = function() {
18440
- return useContext(SelectContext);
18441
- };
18442
- var SelectProvider = function(param) {
18443
- var value = param.value, handleValueChange = param.handleValueChange, otherData = param.otherData, children = param.children;
18444
- var store = useMemo$1(function() {
18445
- return {
18446
- value: value,
18447
- handleValueChange: handleValueChange,
18448
- formatGroupLabel: otherData && typeof otherData.formatGroupLabel === "function" ? otherData.formatGroupLabel : null,
18449
- formatOptionLabel: otherData && typeof otherData.formatOptionLabel === "function" ? otherData.formatOptionLabel : null,
18450
- classNames: (otherData === null || otherData === void 0 ? void 0 : otherData.classNames) || undefined
18451
- };
18452
- }, [
18453
- handleValueChange,
18454
- otherData,
18455
- value
18456
- ]);
18457
- return /*#__PURE__*/ jsx(SelectContext.Provider, {
18458
- value: store,
18459
- children: children
18460
- });
18461
- };
18247
+ var loadableContext_sharedRuntime = {};
18462
18248
 
18463
- var DisabledItem = function(param) {
18464
- var children = param.children;
18465
- var classNames = useContext(SelectContext).classNames;
18466
- return /*#__PURE__*/ jsx("div", {
18467
- className: classNames && classNames.listDisabledItem ? classNames.listDisabledItem : "px-2 py-2 cursor-not-allowed truncate text-gray-400 select-none",
18468
- children: children
18469
- });
18470
- };
18249
+ (function (exports) {
18250
+ "use client";
18251
+ Object.defineProperty(exports, "__esModule", {
18252
+ value: true
18253
+ });
18254
+ Object.defineProperty(exports, "LoadableContext", {
18255
+ enumerable: true,
18256
+ get: function get() {
18257
+ return LoadableContext;
18258
+ }
18259
+ });
18260
+ var _interop_require_default = _interop_require_default$1;
18261
+ var _react = /*#__PURE__*/ _interop_require_default._(React__default);
18262
+ var LoadableContext = _react.default.createContext(null);
18263
+ if (process.env.NODE_ENV !== "production") {
18264
+ LoadableContext.displayName = "LoadableContext";
18265
+ }
18266
+ }(loadableContext_sharedRuntime));
18471
18267
 
18472
- function _define_property$n(obj, key, value) {
18268
+ (function (exports) {
18269
+ function _class_call_check(instance, Constructor) {
18270
+ if (!(instance instanceof Constructor)) {
18271
+ throw new TypeError("Cannot call a class as a function");
18272
+ }
18273
+ }
18274
+ function _defineProperties(target, props) {
18275
+ for(var i = 0; i < props.length; i++){
18276
+ var descriptor = props[i];
18277
+ descriptor.enumerable = descriptor.enumerable || false;
18278
+ descriptor.configurable = true;
18279
+ if ("value" in descriptor) descriptor.writable = true;
18280
+ Object.defineProperty(target, descriptor.key, descriptor);
18281
+ }
18282
+ }
18283
+ function _create_class(Constructor, protoProps, staticProps) {
18284
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
18285
+ if (staticProps) _defineProperties(Constructor, staticProps);
18286
+ return Constructor;
18287
+ }
18288
+ function _define_property(obj, key, value) {
18473
18289
  if (key in obj) {
18474
18290
  Object.defineProperty(obj, key, {
18475
18291
  value: value,
@@ -18482,7 +18298,7 @@ function _define_property$n(obj, key, value) {
18482
18298
  }
18483
18299
  return obj;
18484
18300
  }
18485
- function _object_spread$m(target) {
18301
+ function _object_spread(target) {
18486
18302
  for(var i = 1; i < arguments.length; i++){
18487
18303
  var source = arguments[i] != null ? arguments[i] : {};
18488
18304
  var ownKeys = Object.keys(source);
@@ -18492,12 +18308,12 @@ function _object_spread$m(target) {
18492
18308
  }));
18493
18309
  }
18494
18310
  ownKeys.forEach(function(key) {
18495
- _define_property$n(target, key, source[key]);
18311
+ _define_property(target, key, source[key]);
18496
18312
  });
18497
18313
  }
18498
18314
  return target;
18499
18315
  }
18500
- function ownKeys$i(object, enumerableOnly) {
18316
+ function ownKeys(object, enumerableOnly) {
18501
18317
  var keys = Object.keys(object);
18502
18318
  if (Object.getOwnPropertySymbols) {
18503
18319
  var symbols = Object.getOwnPropertySymbols(object);
@@ -18510,285 +18326,289 @@ function ownKeys$i(object, enumerableOnly) {
18510
18326
  }
18511
18327
  return keys;
18512
18328
  }
18513
- function _object_spread_props$i(target, source) {
18329
+ function _object_spread_props(target, source) {
18514
18330
  source = source != null ? source : {};
18515
18331
  if (Object.getOwnPropertyDescriptors) {
18516
18332
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
18517
18333
  } else {
18518
- ownKeys$i(Object(source)).forEach(function(key) {
18334
+ ownKeys(Object(source)).forEach(function(key) {
18519
18335
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
18520
18336
  });
18521
18337
  }
18522
18338
  return target;
18523
18339
  }
18524
- var Item = function(param) {
18525
- var item = param.item, primaryColor = param.primaryColor;
18526
- var _useSelectContext = useSelectContext(), classNames = _useSelectContext.classNames, value = _useSelectContext.value, handleValueChange = _useSelectContext.handleValueChange, formatOptionLabel = _useSelectContext.formatOptionLabel;
18527
- var isSelected = useMemo$1(function() {
18528
- return value !== null && !Array.isArray(value) && value.value === item.value;
18529
- }, [
18530
- item.value,
18531
- value
18532
- ]);
18533
- var textHoverColor = useMemo$1(function() {
18534
- if (COLORS.includes(primaryColor)) {
18535
- return THEME_DATA.textHover[primaryColor];
18536
- }
18537
- return THEME_DATA.textHover[DEFAULT_THEME];
18538
- }, [
18539
- primaryColor
18540
- ]);
18541
- var bgColor = useMemo$1(function() {
18542
- if (COLORS.includes(primaryColor)) {
18543
- return THEME_DATA.bg[primaryColor];
18544
- }
18545
- return THEME_DATA.bg[DEFAULT_THEME];
18546
- }, [
18547
- primaryColor
18548
- ]);
18549
- var bgHoverColor = useMemo$1(function() {
18550
- if (COLORS.includes(primaryColor)) {
18551
- return THEME_DATA.bgHover[primaryColor];
18552
- }
18553
- return THEME_DATA.bgHover[DEFAULT_THEME];
18554
- }, [
18555
- primaryColor
18556
- ]);
18557
- var getItemClass = useCallback$1(function() {
18558
- var baseClass = "block transition duration-200 px-2 py-2 cursor-pointer select-none truncate rounded";
18559
- var selectedClass = isSelected ? "text-white ".concat(bgColor) : "text-gray-500 ".concat(bgHoverColor, " ").concat(textHoverColor);
18560
- return classNames && classNames.listItem ? classNames.listItem({
18561
- isSelected: isSelected
18562
- }) : "".concat(baseClass, " ").concat(selectedClass);
18563
- }, [
18564
- bgColor,
18565
- bgHoverColor,
18566
- classNames,
18567
- isSelected,
18568
- textHoverColor
18569
- ]);
18570
- return /*#__PURE__*/ jsx(Fragment$1, {
18571
- children: formatOptionLabel ? /*#__PURE__*/ jsx("div", {
18572
- onClick: function() {
18573
- return handleValueChange(item);
18574
- },
18575
- children: formatOptionLabel(_object_spread_props$i(_object_spread$m({}, item), {
18576
- isSelected: isSelected
18577
- }))
18578
- }) : /*#__PURE__*/ jsx(Fragment$1, {
18579
- children: item.disabled ? /*#__PURE__*/ jsx(DisabledItem, {
18580
- children: item.label
18581
- }) : /*#__PURE__*/ jsx("li", {
18582
- tabIndex: 0,
18583
- onKeyDown: function(e) {
18584
- if (e.key === " " || e.key === "Enter") {
18585
- handleValueChange(item);
18586
- }
18587
- },
18588
- "aria-selected": isSelected,
18589
- role: "option",
18590
- onClick: function() {
18591
- return handleValueChange(item);
18592
- },
18593
- className: getItemClass(),
18594
- children: item.label
18595
- })
18596
- })
18597
- });
18598
- };
18599
-
18600
- var GroupItem = function(param) {
18601
- var item = param.item, primaryColor = param.primaryColor;
18602
- var _useSelectContext = useSelectContext(), classNames = _useSelectContext.classNames, formatGroupLabel = _useSelectContext.formatGroupLabel;
18603
- return /*#__PURE__*/ jsx(Fragment$1, {
18604
- children: item.options.length > 0 && /*#__PURE__*/ jsxs(Fragment$1, {
18605
- children: [
18606
- formatGroupLabel ? /*#__PURE__*/ jsx(Fragment$1, {
18607
- children: formatGroupLabel(item)
18608
- }) : /*#__PURE__*/ jsx("div", {
18609
- className: (classNames === null || classNames === void 0 ? void 0 : classNames.listGroupLabel) ? classNames.listGroupLabel : "pr-2 py-2 cursor-default select-none truncate font-bold text-gray-700",
18610
- children: item.label
18611
- }),
18612
- item.options.map(function(item, index) {
18613
- return /*#__PURE__*/ jsx(Item, {
18614
- primaryColor: primaryColor,
18615
- item: item
18616
- }, index);
18617
- })
18618
- ]
18619
- })
18340
+ Object.defineProperty(exports, "__esModule", {
18341
+ value: true
18342
+ });
18343
+ Object.defineProperty(exports, "default", {
18344
+ enumerable: true,
18345
+ get: function get() {
18346
+ return _default;
18347
+ }
18348
+ });
18349
+ var _interop_require_default = _interop_require_default$1;
18350
+ var _react = /*#__PURE__*/ _interop_require_default._(React__default);
18351
+ var _loadablecontextsharedruntime = loadableContext_sharedRuntime;
18352
+ function resolve(obj) {
18353
+ return obj && obj.default ? obj.default : obj;
18354
+ }
18355
+ var ALL_INITIALIZERS = [];
18356
+ var READY_INITIALIZERS = [];
18357
+ var initialized = false;
18358
+ function load(loader) {
18359
+ var promise = loader();
18360
+ var state = {
18361
+ loading: true,
18362
+ loaded: null,
18363
+ error: null
18364
+ };
18365
+ state.promise = promise.then(function(loaded) {
18366
+ state.loading = false;
18367
+ state.loaded = loaded;
18368
+ return loaded;
18369
+ }).catch(function(err) {
18370
+ state.loading = false;
18371
+ state.error = err;
18372
+ throw err;
18620
18373
  });
18621
- };
18622
-
18623
- var Options = function(param) {
18624
- var list = param.list, noOptionsMessage = param.noOptionsMessage, text = param.text, isMultiple = param.isMultiple, value = param.value, _param_primaryColor = param.primaryColor, primaryColor = _param_primaryColor === void 0 ? DEFAULT_THEME : _param_primaryColor;
18625
- var classNames = useContext(SelectContext).classNames;
18626
- var filterByText = useCallback$1(function() {
18627
- var filterItem = function(item) {
18628
- return item.label.toLowerCase().indexOf(text.toLowerCase()) > -1;
18629
- };
18630
- var result = list.map(function(item) {
18631
- if ("options" in item) {
18632
- return {
18633
- label: item.label,
18634
- options: item.options.filter(filterItem)
18635
- };
18636
- }
18637
- return item;
18638
- });
18639
- result = result.filter(function(item) {
18640
- if ("options" in item) {
18641
- return item.options.length > 0;
18642
- }
18643
- return filterItem(item);
18644
- });
18645
- return result;
18646
- }, [
18647
- text,
18648
- list
18649
- ]);
18650
- var removeValues = useCallback$1(function(array) {
18651
- if (!isMultiple) {
18652
- return array;
18653
- }
18654
- if (Array.isArray(value)) {
18655
- var valueId = value.map(function(item) {
18656
- return item.value;
18657
- });
18658
- var filterItem = function(item) {
18659
- return !valueId.includes(item.value);
18374
+ return state;
18375
+ }
18376
+ function createLoadableComponent(loadFn, options) {
18377
+ var opts = Object.assign({
18378
+ loader: null,
18379
+ loading: null,
18380
+ delay: 200,
18381
+ timeout: null,
18382
+ webpack: null,
18383
+ modules: null
18384
+ }, options);
18385
+ /** @type LoadableSubscription */ var subscription = null;
18386
+ function init() {
18387
+ if (!subscription) {
18388
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
18389
+ var sub = new LoadableSubscription(loadFn, opts);
18390
+ subscription = {
18391
+ getCurrentValue: sub.getCurrentValue.bind(sub),
18392
+ subscribe: sub.subscribe.bind(sub),
18393
+ retry: sub.retry.bind(sub),
18394
+ promise: sub.promise.bind(sub)
18660
18395
  };
18661
- var newArray = array.map(function(item) {
18662
- if ("options" in item) {
18663
- return {
18664
- label: item.label,
18665
- options: item.options.filter(filterItem)
18666
- };
18667
- }
18668
- return item;
18669
- });
18670
- newArray = newArray.filter(function(item) {
18671
- if ("options" in item) {
18672
- return item.options.length > 0;
18673
- } else {
18674
- return filterItem(item);
18675
- }
18676
- });
18677
- return newArray;
18678
18396
  }
18679
- return array;
18680
- }, [
18681
- isMultiple,
18682
- value
18683
- ]);
18684
- var filterResult = useMemo$1(function() {
18685
- return removeValues(filterByText());
18686
- }, [
18687
- filterByText,
18688
- removeValues
18397
+ return subscription.promise();
18398
+ }
18399
+ // Server only
18400
+ if (typeof window === "undefined") {
18401
+ ALL_INITIALIZERS.push(init);
18402
+ }
18403
+ // Client only
18404
+ if (!initialized && typeof window !== "undefined") {
18405
+ // require.resolveWeak check is needed for environments that don't have it available like Jest
18406
+ var moduleIds = opts.webpack && typeof commonjsRequire.resolveWeak === "function" ? opts.webpack() : opts.modules;
18407
+ if (moduleIds) {
18408
+ READY_INITIALIZERS.push(function(ids) {
18409
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
18410
+ try {
18411
+ for(var _iterator = moduleIds[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
18412
+ var moduleId = _step.value;
18413
+ if (ids.includes(moduleId)) {
18414
+ return init();
18415
+ }
18416
+ }
18417
+ } catch (err) {
18418
+ _didIteratorError = true;
18419
+ _iteratorError = err;
18420
+ } finally{
18421
+ try {
18422
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
18423
+ _iterator.return();
18424
+ }
18425
+ } finally{
18426
+ if (_didIteratorError) {
18427
+ throw _iteratorError;
18428
+ }
18429
+ }
18430
+ }
18431
+ });
18432
+ }
18433
+ }
18434
+ function useLoadableModule() {
18435
+ init();
18436
+ var context = _react.default.useContext(_loadablecontextsharedruntime.LoadableContext);
18437
+ if (context && Array.isArray(opts.modules)) {
18438
+ opts.modules.forEach(function(moduleName) {
18439
+ context(moduleName);
18440
+ });
18441
+ }
18442
+ }
18443
+ function LoadableComponent(props, ref) {
18444
+ useLoadableModule();
18445
+ var state = _react.default.useSyncExternalStore(subscription.subscribe, subscription.getCurrentValue, subscription.getCurrentValue);
18446
+ _react.default.useImperativeHandle(ref, function() {
18447
+ return {
18448
+ retry: subscription.retry
18449
+ };
18450
+ }, []);
18451
+ return _react.default.useMemo(function() {
18452
+ if (state.loading || state.error) {
18453
+ return /*#__PURE__*/ _react.default.createElement(opts.loading, {
18454
+ isLoading: state.loading,
18455
+ pastDelay: state.pastDelay,
18456
+ timedOut: state.timedOut,
18457
+ error: state.error,
18458
+ retry: subscription.retry
18459
+ });
18460
+ } else if (state.loaded) {
18461
+ return /*#__PURE__*/ _react.default.createElement(resolve(state.loaded), props);
18462
+ } else {
18463
+ return null;
18464
+ }
18465
+ }, [
18466
+ props,
18467
+ state
18468
+ ]);
18469
+ }
18470
+ LoadableComponent.preload = function() {
18471
+ return init();
18472
+ };
18473
+ LoadableComponent.displayName = "LoadableComponent";
18474
+ return /*#__PURE__*/ _react.default.forwardRef(LoadableComponent);
18475
+ }
18476
+ var LoadableSubscription = /*#__PURE__*/ function() {
18477
+ function LoadableSubscription(loadFn, opts) {
18478
+ _class_call_check(this, LoadableSubscription);
18479
+ this._loadFn = loadFn;
18480
+ this._opts = opts;
18481
+ this._callbacks = new Set();
18482
+ this._delay = null;
18483
+ this._timeout = null;
18484
+ this.retry();
18485
+ }
18486
+ _create_class(LoadableSubscription, [
18487
+ {
18488
+ key: "promise",
18489
+ value: function promise() {
18490
+ return this._res.promise;
18491
+ }
18492
+ },
18493
+ {
18494
+ key: "retry",
18495
+ value: function retry() {
18496
+ var _this = this;
18497
+ this._clearTimeouts();
18498
+ this._res = this._loadFn(this._opts.loader);
18499
+ this._state = {
18500
+ pastDelay: false,
18501
+ timedOut: false
18502
+ };
18503
+ var _this1 = this, res = _this1._res, opts = _this1._opts;
18504
+ if (res.loading) {
18505
+ if (typeof opts.delay === "number") {
18506
+ if (opts.delay === 0) {
18507
+ this._state.pastDelay = true;
18508
+ } else {
18509
+ this._delay = setTimeout(function() {
18510
+ _this._update({
18511
+ pastDelay: true
18512
+ });
18513
+ }, opts.delay);
18514
+ }
18515
+ }
18516
+ if (typeof opts.timeout === "number") {
18517
+ this._timeout = setTimeout(function() {
18518
+ _this._update({
18519
+ timedOut: true
18520
+ });
18521
+ }, opts.timeout);
18522
+ }
18523
+ }
18524
+ this._res.promise.then(function() {
18525
+ _this._update({});
18526
+ _this._clearTimeouts();
18527
+ }).catch(function(_err) {
18528
+ _this._update({});
18529
+ _this._clearTimeouts();
18530
+ });
18531
+ this._update({});
18532
+ }
18533
+ },
18534
+ {
18535
+ key: "_update",
18536
+ value: function _update(partial) {
18537
+ this._state = _object_spread(_object_spread_props(_object_spread({}, this._state), {
18538
+ error: this._res.error,
18539
+ loaded: this._res.loaded,
18540
+ loading: this._res.loading
18541
+ }), partial);
18542
+ this._callbacks.forEach(function(callback) {
18543
+ return callback();
18544
+ });
18545
+ }
18546
+ },
18547
+ {
18548
+ key: "_clearTimeouts",
18549
+ value: function _clearTimeouts() {
18550
+ clearTimeout(this._delay);
18551
+ clearTimeout(this._timeout);
18552
+ }
18553
+ },
18554
+ {
18555
+ key: "getCurrentValue",
18556
+ value: function getCurrentValue() {
18557
+ return this._state;
18558
+ }
18559
+ },
18560
+ {
18561
+ key: "subscribe",
18562
+ value: function subscribe(callback) {
18563
+ var _this = this;
18564
+ this._callbacks.add(callback);
18565
+ return function() {
18566
+ _this._callbacks.delete(callback);
18567
+ };
18568
+ }
18569
+ }
18689
18570
  ]);
18690
- return /*#__PURE__*/ jsxs("div", {
18691
- role: "options",
18692
- className: classNames && classNames.list ? classNames.list : "max-h-72 overflow-y-auto",
18693
- children: [
18694
- filterResult.map(function(item, index) {
18695
- return /*#__PURE__*/ jsx(React__default.Fragment, {
18696
- children: "options" in item ? /*#__PURE__*/ jsxs(Fragment$1, {
18697
- children: [
18698
- /*#__PURE__*/ jsx("div", {
18699
- className: "px-2.5",
18700
- children: /*#__PURE__*/ jsx(GroupItem, {
18701
- primaryColor: primaryColor || DEFAULT_THEME,
18702
- item: item
18703
- })
18704
- }),
18705
- index + 1 < filterResult.length && /*#__PURE__*/ jsx("hr", {
18706
- className: "my-1"
18707
- })
18708
- ]
18709
- }) : /*#__PURE__*/ jsx("div", {
18710
- className: "px-2.5",
18711
- children: /*#__PURE__*/ jsx(Item, {
18712
- primaryColor: primaryColor || DEFAULT_THEME,
18713
- item: item
18714
- })
18715
- })
18716
- }, index);
18717
- }),
18718
- filterResult.length === 0 && /*#__PURE__*/ jsx(DisabledItem, {
18719
- children: noOptionsMessage
18720
- })
18721
- ]
18571
+ return LoadableSubscription;
18572
+ }();
18573
+ function Loadable(opts) {
18574
+ return createLoadableComponent(load, opts);
18575
+ }
18576
+ function flushInitializers(initializers, ids) {
18577
+ var promises = [];
18578
+ while(initializers.length){
18579
+ var init = initializers.pop();
18580
+ promises.push(init(ids));
18581
+ }
18582
+ return Promise.all(promises).then(function() {
18583
+ if (initializers.length) {
18584
+ return flushInitializers(initializers, ids);
18585
+ }
18722
18586
  });
18723
- };
18724
-
18725
- var SearchInput = /*#__PURE__*/ forwardRef(function SearchInput(param, ref) {
18726
- var _param_placeholder = param.placeholder, placeholder = _param_placeholder === void 0 ? "" : _param_placeholder, _param_value = param.value, value = _param_value === void 0 ? "" : _param_value, onChange = param.onChange, _param_name = param.name, name = _param_name === void 0 ? "" : _param_name;
18727
- var classNames = useContext(SelectContext).classNames;
18728
- return /*#__PURE__*/ jsxs("div", {
18729
- className: classNames && classNames.searchContainer ? classNames.searchContainer : "relative py-1 px-2.5",
18730
- children: [
18731
- /*#__PURE__*/ jsx(SearchIcon, {
18732
- className: classNames && classNames.searchIcon ? classNames.searchIcon : "absolute w-5 h-5 mt-2.5 pb-0.5 ml-2 text-gray-500"
18733
- }),
18734
- /*#__PURE__*/ jsx("input", {
18735
- ref: ref,
18736
- className: classNames && classNames.searchBox ? classNames.searchBox : "w-full py-2 pl-8 text-sm text-gray-500 bg-gray-100 border border-gray-200 rounded focus:border-gray-200 focus:ring-0 focus:outline-none",
18737
- type: "text",
18738
- placeholder: placeholder,
18739
- value: value,
18740
- onChange: onChange,
18741
- name: name
18742
- })
18743
- ]
18587
+ }
18588
+ Loadable.preloadAll = function() {
18589
+ return new Promise(function(resolveInitializers, reject) {
18590
+ flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject);
18744
18591
  });
18745
- });
18746
-
18747
- var Spinner = function(param) {
18748
- var _param_primaryColor = param.primaryColor, primaryColor = _param_primaryColor === void 0 ? DEFAULT_THEME : _param_primaryColor;
18749
- var spinnerColor = useMemo$1(function() {
18750
- if (COLORS.includes(primaryColor)) {
18751
- return THEME_DATA.text[primaryColor];
18752
- }
18753
- return THEME_DATA.text[DEFAULT_THEME];
18754
- }, [
18755
- primaryColor
18756
- ]);
18757
- return /*#__PURE__*/ jsxs("svg", {
18758
- className: "animate-spin mr-0.5 h-5 w-5 ".concat(spinnerColor),
18759
- xmlns: "http://www.w3.org/2000/svg",
18760
- fill: "none",
18761
- viewBox: "0 0 24 24",
18762
- children: [
18763
- /*#__PURE__*/ jsx("circle", {
18764
- className: "opacity-25",
18765
- cx: "12",
18766
- cy: "12",
18767
- r: "10",
18768
- stroke: "currentColor",
18769
- strokeWidth: "4"
18770
- }),
18771
- /*#__PURE__*/ jsx("path", {
18772
- className: "opacity-75",
18773
- fill: "currentColor",
18774
- 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"
18775
- })
18776
- ]
18592
+ };
18593
+ Loadable.preloadReady = function(ids) {
18594
+ if (ids === void 0) ids = [];
18595
+ return new Promise(function(resolvePreload) {
18596
+ var res = function() {
18597
+ initialized = true;
18598
+ return resolvePreload();
18599
+ };
18600
+ // We always will resolve, errors should be handled within loading UIs.
18601
+ flushInitializers(READY_INITIALIZERS, ids).then(res, res);
18777
18602
  });
18778
18603
  };
18779
-
18780
- function _array_like_to_array$m(arr, len) {
18781
- if (len == null || len > arr.length) len = arr.length;
18782
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
18783
- return arr2;
18784
- }
18785
- function _array_with_holes$j(arr) {
18786
- if (Array.isArray(arr)) return arr;
18787
- }
18788
- function _array_without_holes$7(arr) {
18789
- if (Array.isArray(arr)) return _array_like_to_array$m(arr);
18604
+ if (typeof window !== "undefined") {
18605
+ window.__NEXT_PRELOADREADY = Loadable.preloadReady;
18790
18606
  }
18791
- function _define_property$m(obj, key, value) {
18607
+ var _default = Loadable;
18608
+ }(loadable_sharedRuntime));
18609
+
18610
+ (function (module, exports) {
18611
+ function _define_property(obj, key, value) {
18792
18612
  if (key in obj) {
18793
18613
  Object.defineProperty(obj, key, {
18794
18614
  value: value,
@@ -18801,40 +18621,14 @@ function _define_property$m(obj, key, value) {
18801
18621
  }
18802
18622
  return obj;
18803
18623
  }
18804
- function _iterable_to_array$7(iter) {
18805
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
18806
- }
18807
- function _iterable_to_array_limit$j(arr, i) {
18808
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
18809
- if (_i == null) return;
18810
- var _arr = [];
18811
- var _n = true;
18812
- var _d = false;
18813
- var _s, _e;
18814
- try {
18815
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18816
- _arr.push(_s.value);
18817
- if (i && _arr.length === i) break;
18818
- }
18819
- } catch (err) {
18820
- _d = true;
18821
- _e = err;
18822
- } finally{
18823
- try {
18824
- if (!_n && _i["return"] != null) _i["return"]();
18825
- } finally{
18826
- if (_d) throw _e;
18827
- }
18624
+ function _instanceof(left, right) {
18625
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
18626
+ return !!right[Symbol.hasInstance](left);
18627
+ } else {
18628
+ return left instanceof right;
18828
18629
  }
18829
- return _arr;
18830
- }
18831
- function _non_iterable_rest$j() {
18832
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
18833
- }
18834
- function _non_iterable_spread$7() {
18835
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
18836
18630
  }
18837
- function _object_spread$l(target) {
18631
+ function _object_spread(target) {
18838
18632
  for(var i = 1; i < arguments.length; i++){
18839
18633
  var source = arguments[i] != null ? arguments[i] : {};
18840
18634
  var ownKeys = Object.keys(source);
@@ -18844,12 +18638,12 @@ function _object_spread$l(target) {
18844
18638
  }));
18845
18639
  }
18846
18640
  ownKeys.forEach(function(key) {
18847
- _define_property$m(target, key, source[key]);
18641
+ _define_property(target, key, source[key]);
18848
18642
  });
18849
18643
  }
18850
18644
  return target;
18851
18645
  }
18852
- function ownKeys$h(object, enumerableOnly) {
18646
+ function ownKeys(object, enumerableOnly) {
18853
18647
  var keys = Object.keys(object);
18854
18648
  if (Object.getOwnPropertySymbols) {
18855
18649
  var symbols = Object.getOwnPropertySymbols(object);
@@ -18862,116 +18656,888 @@ function ownKeys$h(object, enumerableOnly) {
18862
18656
  }
18863
18657
  return keys;
18864
18658
  }
18865
- function _object_spread_props$h(target, source) {
18659
+ function _object_spread_props(target, source) {
18866
18660
  source = source != null ? source : {};
18867
18661
  if (Object.getOwnPropertyDescriptors) {
18868
18662
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
18869
18663
  } else {
18870
- ownKeys$h(Object(source)).forEach(function(key) {
18664
+ ownKeys(Object(source)).forEach(function(key) {
18871
18665
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
18872
18666
  });
18873
18667
  }
18874
18668
  return target;
18875
18669
  }
18876
- function _sliced_to_array$j(arr, i) {
18877
- return _array_with_holes$j(arr) || _iterable_to_array_limit$j(arr, i) || _unsupported_iterable_to_array$m(arr, i) || _non_iterable_rest$j();
18670
+ Object.defineProperty(exports, "__esModule", {
18671
+ value: true
18672
+ });
18673
+ function _export(target, all) {
18674
+ for(var name in all)Object.defineProperty(target, name, {
18675
+ enumerable: true,
18676
+ get: all[name]
18677
+ });
18878
18678
  }
18879
- function _to_consumable_array$7(arr) {
18880
- return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$m(arr) || _non_iterable_spread$7();
18679
+ _export(exports, {
18680
+ noSSR: function noSSR1() {
18681
+ return noSSR;
18682
+ },
18683
+ default: function _default() {
18684
+ return dynamic;
18685
+ }
18686
+ });
18687
+ var _interop_require_default = _interop_require_default$1;
18688
+ var _react = /*#__PURE__*/ _interop_require_default._(React__default);
18689
+ var _loadablesharedruntime = /*#__PURE__*/ _interop_require_default._(loadable_sharedRuntime);
18690
+ var isServerSide = typeof window === "undefined";
18691
+ // Normalize loader to return the module as form { default: Component } for `React.lazy`.
18692
+ // Also for backward compatible since next/dynamic allows to resolve a component directly with loader
18693
+ // Client component reference proxy need to be converted to a module.
18694
+ function convertModule(mod) {
18695
+ return {
18696
+ default: (mod == null ? void 0 : mod.default) || mod
18697
+ };
18881
18698
  }
18882
- function _unsupported_iterable_to_array$m(o, minLen) {
18883
- if (!o) return;
18884
- if (typeof o === "string") return _array_like_to_array$m(o, minLen);
18885
- var n = Object.prototype.toString.call(o).slice(8, -1);
18886
- if (n === "Object" && o.constructor) n = o.constructor.name;
18887
- if (n === "Map" || n === "Set") return Array.from(n);
18888
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$m(o, minLen);
18699
+ function noSSR(LoadableInitializer, loadableOptions) {
18700
+ // Removing webpack and modules means react-loadable won't try preloading
18701
+ delete loadableOptions.webpack;
18702
+ delete loadableOptions.modules;
18703
+ // This check is necessary to prevent react-loadable from initializing on the server
18704
+ if (!isServerSide) {
18705
+ return LoadableInitializer(loadableOptions);
18706
+ }
18707
+ var Loading = loadableOptions.loading;
18708
+ // This will only be rendered on the server side
18709
+ return function() {
18710
+ return /*#__PURE__*/ _react.default.createElement(Loading, {
18711
+ error: null,
18712
+ isLoading: true,
18713
+ pastDelay: false,
18714
+ timedOut: false
18715
+ });
18716
+ };
18889
18717
  }
18890
- var DropDown = function(param) {
18891
- var _param_options = param.options, options = _param_options === void 0 ? [] : _param_options, _param_value = param.value, value = _param_value === void 0 ? null : _param_value, onChange = param.onChange, onSearchInputChange = param.onSearchInputChange, _param_placeholder = param.placeholder, placeholder = _param_placeholder === void 0 ? "Select..." : _param_placeholder, _param_searchInputPlaceholder = param.searchInputPlaceholder, searchInputPlaceholder = _param_searchInputPlaceholder === void 0 ? "Search..." : _param_searchInputPlaceholder, _param_isMultiple = param.isMultiple, isMultiple = _param_isMultiple === void 0 ? false : _param_isMultiple, _param_isClearable = param.isClearable, isClearable = _param_isClearable === void 0 ? false : _param_isClearable, _param_isSearchable = param.isSearchable, isSearchable = _param_isSearchable === void 0 ? false : _param_isSearchable, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading, _param_menuIsOpen = param.menuIsOpen, menuIsOpen = _param_menuIsOpen === void 0 ? false : _param_menuIsOpen, _param_noOptionsMessage = param.noOptionsMessage, noOptionsMessage = _param_noOptionsMessage === void 0 ? "No options found" : _param_noOptionsMessage, _param_primaryColor = param.primaryColor, primaryColor = _param_primaryColor === void 0 ? DEFAULT_THEME : _param_primaryColor, _param_formatGroupLabel = param.formatGroupLabel, formatGroupLabel = _param_formatGroupLabel === void 0 ? null : _param_formatGroupLabel, _param_formatOptionLabel = param.formatOptionLabel, formatOptionLabel = _param_formatOptionLabel === void 0 ? null : _param_formatOptionLabel, classNames = param.classNames;
18892
- var _useState = _sliced_to_array$j(useState(menuIsOpen), 2), open = _useState[0], setOpen = _useState[1];
18893
- var _useState1 = _sliced_to_array$j(useState(options), 2), list = _useState1[0], setList = _useState1[1];
18894
- var _useState2 = _sliced_to_array$j(useState(""), 2), inputValue = _useState2[0], setInputValue = _useState2[1];
18895
- var ref = useRef(null);
18896
- var searchBoxRef = useRef(null);
18897
- useEffect(function() {
18898
- var formatItem = function(item) {
18899
- if ("disabled" in item) return item;
18900
- return _object_spread_props$h(_object_spread$l({}, item), {
18901
- disabled: false
18902
- });
18903
- };
18904
- setList(options.map(function(item) {
18905
- if ("options" in item) {
18906
- return {
18907
- label: item.label,
18908
- options: item.options.map(formatItem)
18909
- };
18910
- } else {
18911
- return formatItem(item);
18912
- }
18913
- }));
18914
- }, [
18915
- options
18916
- ]);
18917
- useEffect(function() {
18918
- if (isSearchable) {
18919
- if (open) {
18920
- var _searchBoxRef_current;
18921
- (_searchBoxRef_current = searchBoxRef.current) === null || _searchBoxRef_current === void 0 ? void 0 : _searchBoxRef_current.select();
18922
- } else {
18923
- setInputValue("");
18924
- }
18925
- }
18926
- }, [
18927
- open,
18928
- isSearchable
18929
- ]);
18930
- var toggle = useCallback$1(function() {
18931
- if (!isDisabled) {
18932
- setOpen(!open);
18933
- }
18934
- }, [
18935
- isDisabled,
18936
- open
18937
- ]);
18938
- var closeDropDown = useCallback$1(function() {
18939
- if (open) setOpen(false);
18940
- }, [
18941
- open
18942
- ]);
18943
- useOnClickOutside(ref, function() {
18944
- closeDropDown();
18945
- });
18946
- var onPressEnterOrSpace = useCallback$1(function(e) {
18947
- e.preventDefault();
18948
- if ((e.code === "Enter" || e.code === "Space") && !isDisabled) {
18949
- toggle();
18950
- }
18951
- }, [
18952
- isDisabled,
18953
- toggle
18954
- ]);
18955
- var handleValueChange = useCallback$1(function(selected) {
18956
- var update = function update() {
18957
- if (!isMultiple && !Array.isArray(value)) {
18958
- closeDropDown();
18959
- onChange(selected);
18960
- }
18961
- if (isMultiple && (Array.isArray(value) || value === null)) {
18962
- onChange(value === null ? [
18963
- selected
18964
- ] : _to_consumable_array$7(value).concat([
18965
- selected
18966
- ]));
18718
+ function dynamic(dynamicOptions, options) {
18719
+ var loadableFn = _loadablesharedruntime.default;
18720
+ var loadableOptions = {
18721
+ // A loading component is not required, so we default it
18722
+ loading: function(param) {
18723
+ var error = param.error, isLoading = param.isLoading, pastDelay = param.pastDelay;
18724
+ if (!pastDelay) return null;
18725
+ if (process.env.NODE_ENV !== "production") {
18726
+ if (isLoading) {
18727
+ return null;
18728
+ }
18729
+ if (error) {
18730
+ return /*#__PURE__*/ _react.default.createElement("p", null, error.message, /*#__PURE__*/ _react.default.createElement("br", null), error.stack);
18731
+ }
18967
18732
  }
18968
- };
18969
- if (selected !== value) {
18970
- update();
18733
+ return null;
18971
18734
  }
18972
- }, [
18973
- closeDropDown,
18974
- isMultiple,
18735
+ };
18736
+ // Support for direct import(), eg: dynamic(import('../hello-world'))
18737
+ // Note that this is only kept for the edge case where someone is passing in a promise as first argument
18738
+ // The react-loadable babel plugin will turn dynamic(import('../hello-world')) into dynamic(() => import('../hello-world'))
18739
+ // To make sure we don't execute the import without rendering first
18740
+ if (_instanceof(dynamicOptions, Promise)) {
18741
+ loadableOptions.loader = function() {
18742
+ return dynamicOptions;
18743
+ };
18744
+ // Support for having import as a function, eg: dynamic(() => import('../hello-world'))
18745
+ } else if (typeof dynamicOptions === "function") {
18746
+ loadableOptions.loader = dynamicOptions;
18747
+ // Support for having first argument being options, eg: dynamic({loader: import('../hello-world')})
18748
+ } else if (typeof dynamicOptions === "object") {
18749
+ loadableOptions = _object_spread({}, loadableOptions, dynamicOptions);
18750
+ }
18751
+ // Support for passing options, eg: dynamic(import('../hello-world'), {loading: () => <p>Loading something</p>})
18752
+ loadableOptions = _object_spread({}, loadableOptions, options);
18753
+ var loaderFn = loadableOptions.loader;
18754
+ var loader = function() {
18755
+ return loaderFn != null ? loaderFn().then(convertModule) : Promise.resolve(convertModule(function() {
18756
+ return null;
18757
+ }));
18758
+ };
18759
+ // coming from build/babel/plugins/react-loadable-plugin.js
18760
+ if (loadableOptions.loadableGenerated) {
18761
+ loadableOptions = _object_spread({}, loadableOptions, loadableOptions.loadableGenerated);
18762
+ delete loadableOptions.loadableGenerated;
18763
+ }
18764
+ // support for disabling server side rendering, eg: dynamic(() => import('../hello-world'), {ssr: false}).
18765
+ if (typeof loadableOptions.ssr === "boolean" && !loadableOptions.ssr) {
18766
+ delete loadableOptions.webpack;
18767
+ delete loadableOptions.modules;
18768
+ return noSSR(loadableFn, loadableOptions);
18769
+ }
18770
+ return loadableFn(_object_spread_props(_object_spread({}, loadableOptions), {
18771
+ loader: loader
18772
+ }));
18773
+ }
18774
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
18775
+ Object.defineProperty(exports.default, "__esModule", {
18776
+ value: true
18777
+ });
18778
+ Object.assign(exports.default, exports);
18779
+ module.exports = exports.default;
18780
+ }
18781
+ }(dynamic$1, dynamic$1.exports));
18782
+
18783
+ var dynamic = dynamic$1.exports;
18784
+
18785
+ var CSRDropImage = dynamic(function() {
18786
+ return Promise.resolve().then(function () { return index$2; }).then(function(mod) {
18787
+ return mod.DropImage;
18788
+ });
18789
+ }, {
18790
+ ssr: false
18791
+ });
18792
+
18793
+ var COLORS = [
18794
+ "blue",
18795
+ "orange",
18796
+ "yellow",
18797
+ "red",
18798
+ "purple",
18799
+ "amber",
18800
+ "lime",
18801
+ "green",
18802
+ "emerald",
18803
+ "teal",
18804
+ "cyan",
18805
+ "sky",
18806
+ "violet",
18807
+ "indigo",
18808
+ "purple",
18809
+ "fuchsia",
18810
+ "pink",
18811
+ "rose"
18812
+ ];
18813
+ var DEFAULT_THEME = "blue";
18814
+ var THEME_DATA = {
18815
+ bg: {
18816
+ blue: "bg-blue-500",
18817
+ orange: "bg-orange-500",
18818
+ yellow: "bg-yellow-500",
18819
+ red: "bg-red-500",
18820
+ purple: "bg-purple-500",
18821
+ amber: "bg-amber-500",
18822
+ lime: "bg-lime-500",
18823
+ green: "bg-green-500",
18824
+ emerald: "bg-emerald-500",
18825
+ teal: "bg-teal-500",
18826
+ cyan: "bg-cyan-500",
18827
+ sky: "bg-sky-500",
18828
+ indigo: "bg-indigo-500",
18829
+ violet: "bg-violet-500",
18830
+ fuchsia: "bg-fuchsia-500",
18831
+ pink: "bg-pink-500",
18832
+ rose: "bg-rose-500"
18833
+ },
18834
+ bgHover: {
18835
+ blue: "hover:bg-blue-100",
18836
+ orange: "hover:bg-orange-100",
18837
+ yellow: "hover:bg-yellow-100",
18838
+ red: "hover:bg-red-100",
18839
+ purple: "hover:bg-purple-100",
18840
+ amber: "hover:bg-amber-100",
18841
+ lime: "hover:bg-lime-100",
18842
+ green: "hover:bg-green-100",
18843
+ emerald: "hover:bg-emerald-100",
18844
+ teal: "hover:bg-teal-100",
18845
+ cyan: "hover:bg-cyan-100",
18846
+ sky: "hover:bg-sky-100",
18847
+ indigo: "hover:bg-indigo-100",
18848
+ violet: "hover:bg-violet-100",
18849
+ fuchsia: "hover:bg-fuchsia-100",
18850
+ pink: "hover:bg-pink-100",
18851
+ rose: "hover:bg-rose-100"
18852
+ },
18853
+ ring: {
18854
+ blue: "focus:ring-blue-500/20",
18855
+ orange: "focus:ring-orange-500/20",
18856
+ yellow: "focus:ring-yellow-500/20",
18857
+ red: "focus:ring-red-500/20",
18858
+ purple: "focus:ring-purple-500/20",
18859
+ amber: "focus:ring-amber-500/20",
18860
+ lime: "focus:ring-lime-500/20",
18861
+ green: "focus:ring-green-500/20",
18862
+ emerald: "focus:ring-emerald-500/20",
18863
+ teal: "focus:ring-teal-500/20",
18864
+ cyan: "focus:ring-cyan-500/20",
18865
+ sky: "focus:ring-sky-500/20",
18866
+ indigo: "focus:ring-indigo-500/20",
18867
+ violet: "focus:ring-violet-500/20",
18868
+ fuchsia: "focus:ring-fuchsia-500/20",
18869
+ pink: "focus:ring-pink-500/20",
18870
+ rose: "focus:ring-rose-500/20"
18871
+ },
18872
+ borderFocus: {
18873
+ blue: "focus:border-blue-500",
18874
+ orange: "focus:border-orange-500",
18875
+ yellow: "focus:border-yellow-500",
18876
+ red: "focus:border-red-500",
18877
+ purple: "focus:border-purple-500",
18878
+ amber: "focus:border-amber-500",
18879
+ lime: "focus:border-lime-500",
18880
+ green: "focus:border-green-500",
18881
+ emerald: "focus:border-emerald-500",
18882
+ teal: "focus:border-teal-500",
18883
+ cyan: "focus:border-cyan-500",
18884
+ sky: "focus:border-sky-500",
18885
+ indigo: "focus:border-indigo-500",
18886
+ violet: "focus:border-violet-500",
18887
+ fuchsia: "focus:border-fuchsia-500",
18888
+ pink: "focus:border-pink-500",
18889
+ rose: "focus:border-rose-500"
18890
+ },
18891
+ text: {
18892
+ blue: "text-blue-500",
18893
+ orange: "text-orange-500",
18894
+ yellow: "text-yellow-500",
18895
+ red: "text-red-500",
18896
+ purple: "text-purple-500",
18897
+ amber: "text-amber-500",
18898
+ lime: "text-lime-500",
18899
+ green: "text-green-500",
18900
+ emerald: "text-emerald-500",
18901
+ teal: "text-teal-500",
18902
+ cyan: "text-cyan-500",
18903
+ sky: "text-sky-500",
18904
+ indigo: "text-indigo-500",
18905
+ violet: "text-violet-500",
18906
+ fuchsia: "text-fuchsia-500",
18907
+ pink: "text-pink-500",
18908
+ rose: "text-rose-500"
18909
+ },
18910
+ textHover: {
18911
+ blue: "hover:text-blue-500",
18912
+ orange: "hover:text-orange-500",
18913
+ yellow: "hover:text-yellow-500",
18914
+ red: "hover:text-red-500",
18915
+ purple: "hover:text-purple-500",
18916
+ amber: "hover:text-amber-500",
18917
+ lime: "hover:text-lime-500",
18918
+ green: "hover:text-green-500",
18919
+ emerald: "hover:text-emerald-500",
18920
+ teal: "hover:text-teal-500",
18921
+ cyan: "hover:text-cyan-500",
18922
+ sky: "hover:text-sky-500",
18923
+ indigo: "hover:text-indigo-500",
18924
+ violet: "hover:text-violet-500",
18925
+ fuchsia: "hover:text-fuchsia-500",
18926
+ pink: "hover:text-pink-500",
18927
+ rose: "hover:text-rose-500"
18928
+ }
18929
+ };
18930
+
18931
+ function useOnClickOutside(ref, handler) {
18932
+ useEffect(function() {
18933
+ var listener = function(event) {
18934
+ if (!ref.current || ref.current.contains(event.target)) {
18935
+ return;
18936
+ }
18937
+ handler(event);
18938
+ };
18939
+ document.addEventListener("mousedown", listener);
18940
+ document.addEventListener("touchstart", listener);
18941
+ return function() {
18942
+ document.removeEventListener("mousedown", listener);
18943
+ document.removeEventListener("touchstart", listener);
18944
+ };
18945
+ }, [
18946
+ ref,
18947
+ handler
18948
+ ]);
18949
+ }
18950
+
18951
+ var CloseIcon = function(param) {
18952
+ var _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
18953
+ return /*#__PURE__*/ jsx("svg", {
18954
+ className: className,
18955
+ fill: "currentColor",
18956
+ viewBox: "0 0 20 20",
18957
+ xmlns: "http://www.w3.org/2000/svg",
18958
+ children: /*#__PURE__*/ jsx("path", {
18959
+ fillRule: "evenodd",
18960
+ d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
18961
+ clipRule: "evenodd"
18962
+ })
18963
+ });
18964
+ };
18965
+ var ChevronIcon = function(param) {
18966
+ var _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
18967
+ return /*#__PURE__*/ jsx("svg", {
18968
+ className: className,
18969
+ fill: "currentColor",
18970
+ viewBox: "0 0 20 20",
18971
+ xmlns: "http://www.w3.org/2000/svg",
18972
+ children: /*#__PURE__*/ jsx("path", {
18973
+ fillRule: "evenodd",
18974
+ d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
18975
+ clipRule: "evenodd"
18976
+ })
18977
+ });
18978
+ };
18979
+ var SearchIcon = function(param) {
18980
+ var _param_className = param.className, className = _param_className === void 0 ? "" : _param_className;
18981
+ return /*#__PURE__*/ jsx("svg", {
18982
+ className: className,
18983
+ fill: "none",
18984
+ stroke: "currentColor",
18985
+ viewBox: "0 0 24 24",
18986
+ xmlns: "http://www.w3.org/2000/svg",
18987
+ children: /*#__PURE__*/ jsx("path", {
18988
+ strokeLinecap: "round",
18989
+ strokeLinejoin: "round",
18990
+ strokeWidth: 2,
18991
+ d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
18992
+ })
18993
+ });
18994
+ };
18995
+
18996
+ var SelectContext = /*#__PURE__*/ createContext({
18997
+ value: null,
18998
+ handleValueChange: function(selected) {
18999
+ console.log("selected:", selected);
19000
+ },
19001
+ formatGroupLabel: null,
19002
+ formatOptionLabel: null,
19003
+ classNames: undefined
19004
+ });
19005
+ var useSelectContext = function() {
19006
+ return useContext(SelectContext);
19007
+ };
19008
+ var SelectProvider = function(param) {
19009
+ var value = param.value, handleValueChange = param.handleValueChange, otherData = param.otherData, children = param.children;
19010
+ var store = useMemo$1(function() {
19011
+ return {
19012
+ value: value,
19013
+ handleValueChange: handleValueChange,
19014
+ formatGroupLabel: otherData && typeof otherData.formatGroupLabel === "function" ? otherData.formatGroupLabel : null,
19015
+ formatOptionLabel: otherData && typeof otherData.formatOptionLabel === "function" ? otherData.formatOptionLabel : null,
19016
+ classNames: (otherData === null || otherData === void 0 ? void 0 : otherData.classNames) || undefined
19017
+ };
19018
+ }, [
19019
+ handleValueChange,
19020
+ otherData,
19021
+ value
19022
+ ]);
19023
+ return /*#__PURE__*/ jsx(SelectContext.Provider, {
19024
+ value: store,
19025
+ children: children
19026
+ });
19027
+ };
19028
+
19029
+ var DisabledItem = function(param) {
19030
+ var children = param.children;
19031
+ var classNames = useContext(SelectContext).classNames;
19032
+ return /*#__PURE__*/ jsx("div", {
19033
+ className: classNames && classNames.listDisabledItem ? classNames.listDisabledItem : "px-2 py-2 cursor-not-allowed truncate text-gray-400 select-none",
19034
+ children: children
19035
+ });
19036
+ };
19037
+
19038
+ function _define_property$n(obj, key, value) {
19039
+ if (key in obj) {
19040
+ Object.defineProperty(obj, key, {
19041
+ value: value,
19042
+ enumerable: true,
19043
+ configurable: true,
19044
+ writable: true
19045
+ });
19046
+ } else {
19047
+ obj[key] = value;
19048
+ }
19049
+ return obj;
19050
+ }
19051
+ function _object_spread$m(target) {
19052
+ for(var i = 1; i < arguments.length; i++){
19053
+ var source = arguments[i] != null ? arguments[i] : {};
19054
+ var ownKeys = Object.keys(source);
19055
+ if (typeof Object.getOwnPropertySymbols === "function") {
19056
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
19057
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
19058
+ }));
19059
+ }
19060
+ ownKeys.forEach(function(key) {
19061
+ _define_property$n(target, key, source[key]);
19062
+ });
19063
+ }
19064
+ return target;
19065
+ }
19066
+ function ownKeys$i(object, enumerableOnly) {
19067
+ var keys = Object.keys(object);
19068
+ if (Object.getOwnPropertySymbols) {
19069
+ var symbols = Object.getOwnPropertySymbols(object);
19070
+ if (enumerableOnly) {
19071
+ symbols = symbols.filter(function(sym) {
19072
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
19073
+ });
19074
+ }
19075
+ keys.push.apply(keys, symbols);
19076
+ }
19077
+ return keys;
19078
+ }
19079
+ function _object_spread_props$i(target, source) {
19080
+ source = source != null ? source : {};
19081
+ if (Object.getOwnPropertyDescriptors) {
19082
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
19083
+ } else {
19084
+ ownKeys$i(Object(source)).forEach(function(key) {
19085
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
19086
+ });
19087
+ }
19088
+ return target;
19089
+ }
19090
+ var Item = function(param) {
19091
+ var item = param.item, primaryColor = param.primaryColor;
19092
+ var _useSelectContext = useSelectContext(), classNames = _useSelectContext.classNames, value = _useSelectContext.value, handleValueChange = _useSelectContext.handleValueChange, formatOptionLabel = _useSelectContext.formatOptionLabel;
19093
+ var isSelected = useMemo$1(function() {
19094
+ return value !== null && !Array.isArray(value) && value.value === item.value;
19095
+ }, [
19096
+ item.value,
19097
+ value
19098
+ ]);
19099
+ var textHoverColor = useMemo$1(function() {
19100
+ if (COLORS.includes(primaryColor)) {
19101
+ return THEME_DATA.textHover[primaryColor];
19102
+ }
19103
+ return THEME_DATA.textHover[DEFAULT_THEME];
19104
+ }, [
19105
+ primaryColor
19106
+ ]);
19107
+ var bgColor = useMemo$1(function() {
19108
+ if (COLORS.includes(primaryColor)) {
19109
+ return THEME_DATA.bg[primaryColor];
19110
+ }
19111
+ return THEME_DATA.bg[DEFAULT_THEME];
19112
+ }, [
19113
+ primaryColor
19114
+ ]);
19115
+ var bgHoverColor = useMemo$1(function() {
19116
+ if (COLORS.includes(primaryColor)) {
19117
+ return THEME_DATA.bgHover[primaryColor];
19118
+ }
19119
+ return THEME_DATA.bgHover[DEFAULT_THEME];
19120
+ }, [
19121
+ primaryColor
19122
+ ]);
19123
+ var getItemClass = useCallback$1(function() {
19124
+ var baseClass = "block transition duration-200 px-2 py-2 cursor-pointer select-none truncate rounded";
19125
+ var selectedClass = isSelected ? "text-white ".concat(bgColor) : "text-gray-500 ".concat(bgHoverColor, " ").concat(textHoverColor);
19126
+ return classNames && classNames.listItem ? classNames.listItem({
19127
+ isSelected: isSelected
19128
+ }) : "".concat(baseClass, " ").concat(selectedClass);
19129
+ }, [
19130
+ bgColor,
19131
+ bgHoverColor,
19132
+ classNames,
19133
+ isSelected,
19134
+ textHoverColor
19135
+ ]);
19136
+ return /*#__PURE__*/ jsx(Fragment$1, {
19137
+ children: formatOptionLabel ? /*#__PURE__*/ jsx("div", {
19138
+ onClick: function() {
19139
+ return handleValueChange(item);
19140
+ },
19141
+ children: formatOptionLabel(_object_spread_props$i(_object_spread$m({}, item), {
19142
+ isSelected: isSelected
19143
+ }))
19144
+ }) : /*#__PURE__*/ jsx(Fragment$1, {
19145
+ children: item.disabled ? /*#__PURE__*/ jsx(DisabledItem, {
19146
+ children: item.label
19147
+ }) : /*#__PURE__*/ jsx("li", {
19148
+ tabIndex: 0,
19149
+ onKeyDown: function(e) {
19150
+ if (e.key === " " || e.key === "Enter") {
19151
+ handleValueChange(item);
19152
+ }
19153
+ },
19154
+ "aria-selected": isSelected,
19155
+ role: "option",
19156
+ onClick: function() {
19157
+ return handleValueChange(item);
19158
+ },
19159
+ className: getItemClass(),
19160
+ children: item.label
19161
+ })
19162
+ })
19163
+ });
19164
+ };
19165
+
19166
+ var GroupItem = function(param) {
19167
+ var item = param.item, primaryColor = param.primaryColor;
19168
+ var _useSelectContext = useSelectContext(), classNames = _useSelectContext.classNames, formatGroupLabel = _useSelectContext.formatGroupLabel;
19169
+ return /*#__PURE__*/ jsx(Fragment$1, {
19170
+ children: item.options.length > 0 && /*#__PURE__*/ jsxs(Fragment$1, {
19171
+ children: [
19172
+ formatGroupLabel ? /*#__PURE__*/ jsx(Fragment$1, {
19173
+ children: formatGroupLabel(item)
19174
+ }) : /*#__PURE__*/ jsx("div", {
19175
+ className: (classNames === null || classNames === void 0 ? void 0 : classNames.listGroupLabel) ? classNames.listGroupLabel : "pr-2 py-2 cursor-default select-none truncate font-bold text-gray-700",
19176
+ children: item.label
19177
+ }),
19178
+ item.options.map(function(item, index) {
19179
+ return /*#__PURE__*/ jsx(Item, {
19180
+ primaryColor: primaryColor,
19181
+ item: item
19182
+ }, index);
19183
+ })
19184
+ ]
19185
+ })
19186
+ });
19187
+ };
19188
+
19189
+ var Options = function(param) {
19190
+ var list = param.list, noOptionsMessage = param.noOptionsMessage, text = param.text, isMultiple = param.isMultiple, value = param.value, _param_primaryColor = param.primaryColor, primaryColor = _param_primaryColor === void 0 ? DEFAULT_THEME : _param_primaryColor;
19191
+ var classNames = useContext(SelectContext).classNames;
19192
+ var filterByText = useCallback$1(function() {
19193
+ var filterItem = function(item) {
19194
+ return item.label.toLowerCase().indexOf(text.toLowerCase()) > -1;
19195
+ };
19196
+ var result = list.map(function(item) {
19197
+ if ("options" in item) {
19198
+ return {
19199
+ label: item.label,
19200
+ options: item.options.filter(filterItem)
19201
+ };
19202
+ }
19203
+ return item;
19204
+ });
19205
+ result = result.filter(function(item) {
19206
+ if ("options" in item) {
19207
+ return item.options.length > 0;
19208
+ }
19209
+ return filterItem(item);
19210
+ });
19211
+ return result;
19212
+ }, [
19213
+ text,
19214
+ list
19215
+ ]);
19216
+ var removeValues = useCallback$1(function(array) {
19217
+ if (!isMultiple) {
19218
+ return array;
19219
+ }
19220
+ if (Array.isArray(value)) {
19221
+ var valueId = value.map(function(item) {
19222
+ return item.value;
19223
+ });
19224
+ var filterItem = function(item) {
19225
+ return !valueId.includes(item.value);
19226
+ };
19227
+ var newArray = array.map(function(item) {
19228
+ if ("options" in item) {
19229
+ return {
19230
+ label: item.label,
19231
+ options: item.options.filter(filterItem)
19232
+ };
19233
+ }
19234
+ return item;
19235
+ });
19236
+ newArray = newArray.filter(function(item) {
19237
+ if ("options" in item) {
19238
+ return item.options.length > 0;
19239
+ } else {
19240
+ return filterItem(item);
19241
+ }
19242
+ });
19243
+ return newArray;
19244
+ }
19245
+ return array;
19246
+ }, [
19247
+ isMultiple,
19248
+ value
19249
+ ]);
19250
+ var filterResult = useMemo$1(function() {
19251
+ return removeValues(filterByText());
19252
+ }, [
19253
+ filterByText,
19254
+ removeValues
19255
+ ]);
19256
+ return /*#__PURE__*/ jsxs("div", {
19257
+ role: "options",
19258
+ className: classNames && classNames.list ? classNames.list : "max-h-72 overflow-y-auto",
19259
+ children: [
19260
+ filterResult.map(function(item, index) {
19261
+ return /*#__PURE__*/ jsx(React__default.Fragment, {
19262
+ children: "options" in item ? /*#__PURE__*/ jsxs(Fragment$1, {
19263
+ children: [
19264
+ /*#__PURE__*/ jsx("div", {
19265
+ className: "px-2.5",
19266
+ children: /*#__PURE__*/ jsx(GroupItem, {
19267
+ primaryColor: primaryColor || DEFAULT_THEME,
19268
+ item: item
19269
+ })
19270
+ }),
19271
+ index + 1 < filterResult.length && /*#__PURE__*/ jsx("hr", {
19272
+ className: "my-1"
19273
+ })
19274
+ ]
19275
+ }) : /*#__PURE__*/ jsx("div", {
19276
+ className: "px-2.5",
19277
+ children: /*#__PURE__*/ jsx(Item, {
19278
+ primaryColor: primaryColor || DEFAULT_THEME,
19279
+ item: item
19280
+ })
19281
+ })
19282
+ }, index);
19283
+ }),
19284
+ filterResult.length === 0 && /*#__PURE__*/ jsx(DisabledItem, {
19285
+ children: noOptionsMessage
19286
+ })
19287
+ ]
19288
+ });
19289
+ };
19290
+
19291
+ var SearchInput = /*#__PURE__*/ forwardRef(function SearchInput(param, ref) {
19292
+ var _param_placeholder = param.placeholder, placeholder = _param_placeholder === void 0 ? "" : _param_placeholder, _param_value = param.value, value = _param_value === void 0 ? "" : _param_value, onChange = param.onChange, _param_name = param.name, name = _param_name === void 0 ? "" : _param_name;
19293
+ var classNames = useContext(SelectContext).classNames;
19294
+ return /*#__PURE__*/ jsxs("div", {
19295
+ className: classNames && classNames.searchContainer ? classNames.searchContainer : "relative py-1 px-2.5",
19296
+ children: [
19297
+ /*#__PURE__*/ jsx(SearchIcon, {
19298
+ className: classNames && classNames.searchIcon ? classNames.searchIcon : "absolute w-5 h-5 mt-2.5 pb-0.5 ml-2 text-gray-500"
19299
+ }),
19300
+ /*#__PURE__*/ jsx("input", {
19301
+ ref: ref,
19302
+ className: classNames && classNames.searchBox ? classNames.searchBox : "w-full py-2 pl-8 text-sm text-gray-500 bg-gray-100 border border-gray-200 rounded focus:border-gray-200 focus:ring-0 focus:outline-none",
19303
+ type: "text",
19304
+ placeholder: placeholder,
19305
+ value: value,
19306
+ onChange: onChange,
19307
+ name: name
19308
+ })
19309
+ ]
19310
+ });
19311
+ });
19312
+
19313
+ var Spinner = function(param) {
19314
+ var _param_primaryColor = param.primaryColor, primaryColor = _param_primaryColor === void 0 ? DEFAULT_THEME : _param_primaryColor;
19315
+ var spinnerColor = useMemo$1(function() {
19316
+ if (COLORS.includes(primaryColor)) {
19317
+ return THEME_DATA.text[primaryColor];
19318
+ }
19319
+ return THEME_DATA.text[DEFAULT_THEME];
19320
+ }, [
19321
+ primaryColor
19322
+ ]);
19323
+ return /*#__PURE__*/ jsxs("svg", {
19324
+ className: "animate-spin mr-0.5 h-5 w-5 ".concat(spinnerColor),
19325
+ xmlns: "http://www.w3.org/2000/svg",
19326
+ fill: "none",
19327
+ viewBox: "0 0 24 24",
19328
+ children: [
19329
+ /*#__PURE__*/ jsx("circle", {
19330
+ className: "opacity-25",
19331
+ cx: "12",
19332
+ cy: "12",
19333
+ r: "10",
19334
+ stroke: "currentColor",
19335
+ strokeWidth: "4"
19336
+ }),
19337
+ /*#__PURE__*/ jsx("path", {
19338
+ className: "opacity-75",
19339
+ fill: "currentColor",
19340
+ 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"
19341
+ })
19342
+ ]
19343
+ });
19344
+ };
19345
+
19346
+ function _array_like_to_array$m(arr, len) {
19347
+ if (len == null || len > arr.length) len = arr.length;
19348
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
19349
+ return arr2;
19350
+ }
19351
+ function _array_with_holes$j(arr) {
19352
+ if (Array.isArray(arr)) return arr;
19353
+ }
19354
+ function _array_without_holes$7(arr) {
19355
+ if (Array.isArray(arr)) return _array_like_to_array$m(arr);
19356
+ }
19357
+ function _define_property$m(obj, key, value) {
19358
+ if (key in obj) {
19359
+ Object.defineProperty(obj, key, {
19360
+ value: value,
19361
+ enumerable: true,
19362
+ configurable: true,
19363
+ writable: true
19364
+ });
19365
+ } else {
19366
+ obj[key] = value;
19367
+ }
19368
+ return obj;
19369
+ }
19370
+ function _iterable_to_array$7(iter) {
19371
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
19372
+ }
19373
+ function _iterable_to_array_limit$j(arr, i) {
19374
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
19375
+ if (_i == null) return;
19376
+ var _arr = [];
19377
+ var _n = true;
19378
+ var _d = false;
19379
+ var _s, _e;
19380
+ try {
19381
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
19382
+ _arr.push(_s.value);
19383
+ if (i && _arr.length === i) break;
19384
+ }
19385
+ } catch (err) {
19386
+ _d = true;
19387
+ _e = err;
19388
+ } finally{
19389
+ try {
19390
+ if (!_n && _i["return"] != null) _i["return"]();
19391
+ } finally{
19392
+ if (_d) throw _e;
19393
+ }
19394
+ }
19395
+ return _arr;
19396
+ }
19397
+ function _non_iterable_rest$j() {
19398
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19399
+ }
19400
+ function _non_iterable_spread$7() {
19401
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19402
+ }
19403
+ function _object_spread$l(target) {
19404
+ for(var i = 1; i < arguments.length; i++){
19405
+ var source = arguments[i] != null ? arguments[i] : {};
19406
+ var ownKeys = Object.keys(source);
19407
+ if (typeof Object.getOwnPropertySymbols === "function") {
19408
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
19409
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
19410
+ }));
19411
+ }
19412
+ ownKeys.forEach(function(key) {
19413
+ _define_property$m(target, key, source[key]);
19414
+ });
19415
+ }
19416
+ return target;
19417
+ }
19418
+ function ownKeys$h(object, enumerableOnly) {
19419
+ var keys = Object.keys(object);
19420
+ if (Object.getOwnPropertySymbols) {
19421
+ var symbols = Object.getOwnPropertySymbols(object);
19422
+ if (enumerableOnly) {
19423
+ symbols = symbols.filter(function(sym) {
19424
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
19425
+ });
19426
+ }
19427
+ keys.push.apply(keys, symbols);
19428
+ }
19429
+ return keys;
19430
+ }
19431
+ function _object_spread_props$h(target, source) {
19432
+ source = source != null ? source : {};
19433
+ if (Object.getOwnPropertyDescriptors) {
19434
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
19435
+ } else {
19436
+ ownKeys$h(Object(source)).forEach(function(key) {
19437
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
19438
+ });
19439
+ }
19440
+ return target;
19441
+ }
19442
+ function _sliced_to_array$j(arr, i) {
19443
+ return _array_with_holes$j(arr) || _iterable_to_array_limit$j(arr, i) || _unsupported_iterable_to_array$m(arr, i) || _non_iterable_rest$j();
19444
+ }
19445
+ function _to_consumable_array$7(arr) {
19446
+ return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$m(arr) || _non_iterable_spread$7();
19447
+ }
19448
+ function _unsupported_iterable_to_array$m(o, minLen) {
19449
+ if (!o) return;
19450
+ if (typeof o === "string") return _array_like_to_array$m(o, minLen);
19451
+ var n = Object.prototype.toString.call(o).slice(8, -1);
19452
+ if (n === "Object" && o.constructor) n = o.constructor.name;
19453
+ if (n === "Map" || n === "Set") return Array.from(n);
19454
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$m(o, minLen);
19455
+ }
19456
+ var DropDown = function(param) {
19457
+ var _param_options = param.options, options = _param_options === void 0 ? [] : _param_options, _param_value = param.value, value = _param_value === void 0 ? null : _param_value, onChange = param.onChange, onSearchInputChange = param.onSearchInputChange, _param_placeholder = param.placeholder, placeholder = _param_placeholder === void 0 ? "Select..." : _param_placeholder, _param_searchInputPlaceholder = param.searchInputPlaceholder, searchInputPlaceholder = _param_searchInputPlaceholder === void 0 ? "Search..." : _param_searchInputPlaceholder, _param_isMultiple = param.isMultiple, isMultiple = _param_isMultiple === void 0 ? false : _param_isMultiple, _param_isClearable = param.isClearable, isClearable = _param_isClearable === void 0 ? false : _param_isClearable, _param_isSearchable = param.isSearchable, isSearchable = _param_isSearchable === void 0 ? false : _param_isSearchable, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading, _param_menuIsOpen = param.menuIsOpen, menuIsOpen = _param_menuIsOpen === void 0 ? false : _param_menuIsOpen, _param_noOptionsMessage = param.noOptionsMessage, noOptionsMessage = _param_noOptionsMessage === void 0 ? "No options found" : _param_noOptionsMessage, _param_primaryColor = param.primaryColor, primaryColor = _param_primaryColor === void 0 ? DEFAULT_THEME : _param_primaryColor, _param_formatGroupLabel = param.formatGroupLabel, formatGroupLabel = _param_formatGroupLabel === void 0 ? null : _param_formatGroupLabel, _param_formatOptionLabel = param.formatOptionLabel, formatOptionLabel = _param_formatOptionLabel === void 0 ? null : _param_formatOptionLabel, classNames = param.classNames;
19458
+ var _useState = _sliced_to_array$j(useState(menuIsOpen), 2), open = _useState[0], setOpen = _useState[1];
19459
+ var _useState1 = _sliced_to_array$j(useState(options), 2), list = _useState1[0], setList = _useState1[1];
19460
+ var _useState2 = _sliced_to_array$j(useState(""), 2), inputValue = _useState2[0], setInputValue = _useState2[1];
19461
+ var ref = useRef(null);
19462
+ var searchBoxRef = useRef(null);
19463
+ useEffect(function() {
19464
+ var formatItem = function(item) {
19465
+ if ("disabled" in item) return item;
19466
+ return _object_spread_props$h(_object_spread$l({}, item), {
19467
+ disabled: false
19468
+ });
19469
+ };
19470
+ setList(options.map(function(item) {
19471
+ if ("options" in item) {
19472
+ return {
19473
+ label: item.label,
19474
+ options: item.options.map(formatItem)
19475
+ };
19476
+ } else {
19477
+ return formatItem(item);
19478
+ }
19479
+ }));
19480
+ }, [
19481
+ options
19482
+ ]);
19483
+ useEffect(function() {
19484
+ if (isSearchable) {
19485
+ if (open) {
19486
+ var _searchBoxRef_current;
19487
+ (_searchBoxRef_current = searchBoxRef.current) === null || _searchBoxRef_current === void 0 ? void 0 : _searchBoxRef_current.select();
19488
+ } else {
19489
+ setInputValue("");
19490
+ }
19491
+ }
19492
+ }, [
19493
+ open,
19494
+ isSearchable
19495
+ ]);
19496
+ var toggle = useCallback$1(function() {
19497
+ if (!isDisabled) {
19498
+ setOpen(!open);
19499
+ }
19500
+ }, [
19501
+ isDisabled,
19502
+ open
19503
+ ]);
19504
+ var closeDropDown = useCallback$1(function() {
19505
+ if (open) setOpen(false);
19506
+ }, [
19507
+ open
19508
+ ]);
19509
+ useOnClickOutside(ref, function() {
19510
+ closeDropDown();
19511
+ });
19512
+ var onPressEnterOrSpace = useCallback$1(function(e) {
19513
+ e.preventDefault();
19514
+ if ((e.code === "Enter" || e.code === "Space") && !isDisabled) {
19515
+ toggle();
19516
+ }
19517
+ }, [
19518
+ isDisabled,
19519
+ toggle
19520
+ ]);
19521
+ var handleValueChange = useCallback$1(function(selected) {
19522
+ var update = function update() {
19523
+ if (!isMultiple && !Array.isArray(value)) {
19524
+ closeDropDown();
19525
+ onChange(selected);
19526
+ }
19527
+ if (isMultiple && (Array.isArray(value) || value === null)) {
19528
+ onChange(value === null ? [
19529
+ selected
19530
+ ] : _to_consumable_array$7(value).concat([
19531
+ selected
19532
+ ]));
19533
+ }
19534
+ };
19535
+ if (selected !== value) {
19536
+ update();
19537
+ }
19538
+ }, [
19539
+ closeDropDown,
19540
+ isMultiple,
18975
19541
  onChange,
18976
19542
  value
18977
19543
  ]);
@@ -22761,364 +23327,12 @@ function _object_spread$j(target) {
22761
23327
  }));
22762
23328
  }
22763
23329
  ownKeys.forEach(function(key) {
22764
- _define_property$k(target, key, source[key]);
22765
- });
22766
- }
22767
- return target;
22768
- }
22769
- function ownKeys$f(object, enumerableOnly) {
22770
- var keys = Object.keys(object);
22771
- if (Object.getOwnPropertySymbols) {
22772
- var symbols = Object.getOwnPropertySymbols(object);
22773
- if (enumerableOnly) {
22774
- symbols = symbols.filter(function(sym) {
22775
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
22776
- });
22777
- }
22778
- keys.push.apply(keys, symbols);
22779
- }
22780
- return keys;
22781
- }
22782
- function _object_spread_props$f(target, source) {
22783
- source = source != null ? source : {};
22784
- if (Object.getOwnPropertyDescriptors) {
22785
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
22786
- } else {
22787
- ownKeys$f(Object(source)).forEach(function(key) {
22788
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
22789
- });
22790
- }
22791
- return target;
22792
- }
22793
- var FormProvider = function(param) {
22794
- var children = param.children, onSubmit = param.onSubmit, onError = param.onError, _param_defaultValues = param.defaultValues, defaultValues = _param_defaultValues === void 0 ? {} : _param_defaultValues;
22795
- var methods = useForm({
22796
- defaultValues: defaultValues
22797
- });
22798
- return /*#__PURE__*/ jsx(FormProvider$1, _object_spread_props$f(_object_spread$j({}, methods), {
22799
- children: /*#__PURE__*/ jsx("form", {
22800
- onSubmit: methods.handleSubmit(onSubmit, onError),
22801
- children: children
22802
- })
22803
- }));
22804
- };
22805
-
22806
- function _define_property$j(obj, key, value) {
22807
- if (key in obj) {
22808
- Object.defineProperty(obj, key, {
22809
- value: value,
22810
- enumerable: true,
22811
- configurable: true,
22812
- writable: true
22813
- });
22814
- } else {
22815
- obj[key] = value;
22816
- }
22817
- return obj;
22818
- }
22819
- function _object_spread$i(target) {
22820
- for(var i = 1; i < arguments.length; i++){
22821
- var source = arguments[i] != null ? arguments[i] : {};
22822
- var ownKeys = Object.keys(source);
22823
- if (typeof Object.getOwnPropertySymbols === "function") {
22824
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
22825
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
22826
- }));
22827
- }
22828
- ownKeys.forEach(function(key) {
22829
- _define_property$j(target, key, source[key]);
22830
- });
22831
- }
22832
- return target;
22833
- }
22834
- function ownKeys$e(object, enumerableOnly) {
22835
- var keys = Object.keys(object);
22836
- if (Object.getOwnPropertySymbols) {
22837
- var symbols = Object.getOwnPropertySymbols(object);
22838
- if (enumerableOnly) {
22839
- symbols = symbols.filter(function(sym) {
22840
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
22841
- });
22842
- }
22843
- keys.push.apply(keys, symbols);
22844
- }
22845
- return keys;
22846
- }
22847
- function _object_spread_props$e(target, source) {
22848
- source = source != null ? source : {};
22849
- if (Object.getOwnPropertyDescriptors) {
22850
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
22851
- } else {
22852
- ownKeys$e(Object(source)).forEach(function(key) {
22853
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
22854
- });
22855
- }
22856
- return target;
22857
- }
22858
- function _object_without_properties$a(source, excluded) {
22859
- if (source == null) return {};
22860
- var target = _object_without_properties_loose$a(source, excluded);
22861
- var key, i;
22862
- if (Object.getOwnPropertySymbols) {
22863
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
22864
- for(i = 0; i < sourceSymbolKeys.length; i++){
22865
- key = sourceSymbolKeys[i];
22866
- if (excluded.indexOf(key) >= 0) continue;
22867
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
22868
- target[key] = source[key];
22869
- }
22870
- }
22871
- return target;
22872
- }
22873
- function _object_without_properties_loose$a(source, excluded) {
22874
- if (source == null) return {};
22875
- var target = {};
22876
- var sourceKeys = Object.keys(source);
22877
- var key, i;
22878
- for(i = 0; i < sourceKeys.length; i++){
22879
- key = sourceKeys[i];
22880
- if (excluded.indexOf(key) >= 0) continue;
22881
- target[key] = source[key];
22882
- }
22883
- return target;
22884
- }
22885
- var Switch = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
22886
- var _param_size = _param.size, size = _param_size === void 0 ? "large" : _param_size, color = _param.color, props = _object_without_properties$a(_param, [
22887
- "size",
22888
- "color"
22889
- ]);
22890
- var control = useForm().control;
22891
- var name = props.name, className = props.className;
22892
- var bgColor = color === "blue" ? "data-[state=checked]:bg-blue-500" : color === "red" ? "data-[state=checked]:bg-red-500" : color === "green" ? "data-[state=checked]:bg-green-500" : color === "yellow" ? "data-[state=checked]:bg-yellow-500" : "data-[state=checked]:bg-blue-500";
22893
- var sizeClass = {
22894
- small: {
22895
- root: "h-4 w-7",
22896
- thumb: "h-3 w-3 data-[state=checked]:translate-x-3"
22897
- },
22898
- medium: {
22899
- root: "h-5 w-9",
22900
- thumb: "h-4 w-4 data-[state=checked]:translate-x-4"
22901
- },
22902
- large: {
22903
- root: "h-6 w-11",
22904
- thumb: "h-5 w-5 data-[state=checked]:translate-x-5"
22905
- }
22906
- };
22907
- return /*#__PURE__*/ jsx("div", {
22908
- className: [
22909
- "h-24 w-full",
22910
- className
22911
- ].join(" "),
22912
- children: /*#__PURE__*/ jsx(Controller$2, {
22913
- name: name || "",
22914
- control: control,
22915
- render: function(param) {
22916
- param.field;
22917
- return /*#__PURE__*/ jsx(SwitchPrimitives.Root, _object_spread_props$e(_object_spread$i({
22918
- className: cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50", bgColor, sizeClass[size].root, "data-[state=unchecked]:bg-input")
22919
- }, props), {
22920
- ref: ref,
22921
- children: /*#__PURE__*/ jsx(SwitchPrimitives.Thumb, {
22922
- className: cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0", sizeClass[size].thumb)
22923
- })
22924
- }));
22925
- }
22926
- })
22927
- });
22928
- });
22929
-
22930
- function _define_property$i(obj, key, value) {
22931
- if (key in obj) {
22932
- Object.defineProperty(obj, key, {
22933
- value: value,
22934
- enumerable: true,
22935
- configurable: true,
22936
- writable: true
22937
- });
22938
- } else {
22939
- obj[key] = value;
22940
- }
22941
- return obj;
22942
- }
22943
- function _object_spread$h(target) {
22944
- for(var i = 1; i < arguments.length; i++){
22945
- var source = arguments[i] != null ? arguments[i] : {};
22946
- var ownKeys = Object.keys(source);
22947
- if (typeof Object.getOwnPropertySymbols === "function") {
22948
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
22949
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
22950
- }));
22951
- }
22952
- ownKeys.forEach(function(key) {
22953
- _define_property$i(target, key, source[key]);
22954
- });
22955
- }
22956
- return target;
22957
- }
22958
- function ownKeys$d(object, enumerableOnly) {
22959
- var keys = Object.keys(object);
22960
- if (Object.getOwnPropertySymbols) {
22961
- var symbols = Object.getOwnPropertySymbols(object);
22962
- if (enumerableOnly) {
22963
- symbols = symbols.filter(function(sym) {
22964
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
22965
- });
22966
- }
22967
- keys.push.apply(keys, symbols);
22968
- }
22969
- return keys;
22970
- }
22971
- function _object_spread_props$d(target, source) {
22972
- source = source != null ? source : {};
22973
- if (Object.getOwnPropertyDescriptors) {
22974
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
22975
- } else {
22976
- ownKeys$d(Object(source)).forEach(function(key) {
22977
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
22978
- });
22979
- }
22980
- return target;
22981
- }
22982
- function _object_without_properties$9(source, excluded) {
22983
- if (source == null) return {};
22984
- var target = _object_without_properties_loose$9(source, excluded);
22985
- var key, i;
22986
- if (Object.getOwnPropertySymbols) {
22987
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
22988
- for(i = 0; i < sourceSymbolKeys.length; i++){
22989
- key = sourceSymbolKeys[i];
22990
- if (excluded.indexOf(key) >= 0) continue;
22991
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
22992
- target[key] = source[key];
22993
- }
22994
- }
22995
- return target;
22996
- }
22997
- function _object_without_properties_loose$9(source, excluded) {
22998
- if (source == null) return {};
22999
- var target = {};
23000
- var sourceKeys = Object.keys(source);
23001
- var key, i;
23002
- for(i = 0; i < sourceKeys.length; i++){
23003
- key = sourceKeys[i];
23004
- if (excluded.indexOf(key) >= 0) continue;
23005
- target[key] = source[key];
23006
- }
23007
- return target;
23008
- }
23009
- var buttonVariants = cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", {
23010
- variants: {
23011
- variant: {
23012
- custom: "bg-inherit",
23013
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
23014
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
23015
- outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
23016
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
23017
- ghost: "hover:bg-accent hover:text-accent-foreground",
23018
- link: "text-primary underline-offset-4 hover:underline"
23019
- },
23020
- size: {
23021
- default: "h-9 px-4 py-2",
23022
- sm: "h-8 rounded-md px-3 text-xs",
23023
- lg: "h-10 rounded-md px-8",
23024
- icon: "h-9 w-9"
23025
- }
23026
- },
23027
- defaultVariants: {
23028
- variant: "default",
23029
- size: "default"
23030
- }
23031
- });
23032
- var Button = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
23033
- var className = _param.className, variant = _param.variant, size = _param.size, _param_asChild = _param.asChild, asChild = _param_asChild === void 0 ? false : _param_asChild, _param_isLoading = _param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, customClassName = _param.customClassName, children = _param.children, props = _object_without_properties$9(_param, [
23034
- "className",
23035
- "variant",
23036
- "size",
23037
- "asChild",
23038
- "isLoading",
23039
- "customClassName",
23040
- "children"
23041
- ]);
23042
- var Comp = asChild ? Slot : "button";
23043
- return /*#__PURE__*/ jsx(Comp, _object_spread_props$d(_object_spread$h({
23044
- className: cn(variant !== "custom" ? buttonVariants({
23045
- variant: variant,
23046
- size: size,
23047
- className: className
23048
- }) : "", isLoading ? "pointer-events-none opacity-70" : "pointer-events-auto opacity-100"),
23049
- ref: ref
23050
- }, props), {
23051
- disabled: isLoading || props.disabled,
23052
- children: variant === "custom" ? /*#__PURE__*/ jsxs("div", {
23053
- className: [
23054
- "flex items-center gap-1",
23055
- customClassName,
23056
- props.disabled ? "pointer-events-none opacity-70" : ""
23057
- ].join(" "),
23058
- children: [
23059
- isLoading && /*#__PURE__*/ jsx("div", {
23060
- className: "w-4 h-4 rounded-full border-2 border-solid border-white border-t-[#939393] animate-spin mr-2"
23061
- }),
23062
- children
23063
- ]
23064
- }) : /*#__PURE__*/ jsxs(Fragment$1, {
23065
- children: [
23066
- isLoading && /*#__PURE__*/ jsx("div", {
23067
- className: "w-4 h-4 rounded-full border-2 border-solid border-white border-t-[#939393] animate-spin mr-2"
23068
- }),
23069
- children
23070
- ]
23071
- })
23072
- }));
23073
- });
23074
-
23075
- function _define_property$h(obj, key, value) {
23076
- if (key in obj) {
23077
- Object.defineProperty(obj, key, {
23078
- value: value,
23079
- enumerable: true,
23080
- configurable: true,
23081
- writable: true
23082
- });
23083
- } else {
23084
- obj[key] = value;
23085
- }
23086
- return obj;
23087
- }
23088
- function _extends$3() {
23089
- _extends$3 = Object.assign || function(target) {
23090
- for(var i = 1; i < arguments.length; i++){
23091
- var source = arguments[i];
23092
- for(var key in source){
23093
- if (Object.prototype.hasOwnProperty.call(source, key)) {
23094
- target[key] = source[key];
23095
- }
23096
- }
23097
- }
23098
- return target;
23099
- };
23100
- return _extends$3.apply(this, arguments);
23101
- }
23102
- function _object_destructuring_empty$2(o) {
23103
- if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
23104
- return o;
23105
- }
23106
- function _object_spread$g(target) {
23107
- for(var i = 1; i < arguments.length; i++){
23108
- var source = arguments[i] != null ? arguments[i] : {};
23109
- var ownKeys = Object.keys(source);
23110
- if (typeof Object.getOwnPropertySymbols === "function") {
23111
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
23112
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
23113
- }));
23114
- }
23115
- ownKeys.forEach(function(key) {
23116
- _define_property$h(target, key, source[key]);
23330
+ _define_property$k(target, key, source[key]);
23117
23331
  });
23118
23332
  }
23119
23333
  return target;
23120
23334
  }
23121
- function ownKeys$c(object, enumerableOnly) {
23335
+ function ownKeys$f(object, enumerableOnly) {
23122
23336
  var keys = Object.keys(object);
23123
23337
  if (Object.getOwnPropertySymbols) {
23124
23338
  var symbols = Object.getOwnPropertySymbols(object);
@@ -23131,106 +23345,31 @@ function ownKeys$c(object, enumerableOnly) {
23131
23345
  }
23132
23346
  return keys;
23133
23347
  }
23134
- function _object_spread_props$c(target, source) {
23348
+ function _object_spread_props$f(target, source) {
23135
23349
  source = source != null ? source : {};
23136
23350
  if (Object.getOwnPropertyDescriptors) {
23137
23351
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
23138
23352
  } else {
23139
- ownKeys$c(Object(source)).forEach(function(key) {
23353
+ ownKeys$f(Object(source)).forEach(function(key) {
23140
23354
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
23141
23355
  });
23142
23356
  }
23143
23357
  return target;
23144
23358
  }
23145
- function _object_without_properties$8(source, excluded) {
23146
- if (source == null) return {};
23147
- var target = _object_without_properties_loose$8(source, excluded);
23148
- var key, i;
23149
- if (Object.getOwnPropertySymbols) {
23150
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
23151
- for(i = 0; i < sourceSymbolKeys.length; i++){
23152
- key = sourceSymbolKeys[i];
23153
- if (excluded.indexOf(key) >= 0) continue;
23154
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
23155
- target[key] = source[key];
23156
- }
23157
- }
23158
- return target;
23159
- }
23160
- function _object_without_properties_loose$8(source, excluded) {
23161
- if (source == null) return {};
23162
- var target = {};
23163
- var sourceKeys = Object.keys(source);
23164
- var key, i;
23165
- for(i = 0; i < sourceKeys.length; i++){
23166
- key = sourceKeys[i];
23167
- if (excluded.indexOf(key) >= 0) continue;
23168
- target[key] = source[key];
23169
- }
23170
- return target;
23171
- }
23172
- function Calendar$2(_param) {
23173
- var className = _param.className, classNames = _param.classNames, _param_showOutsideDays = _param.showOutsideDays, showOutsideDays = _param_showOutsideDays === void 0 ? true : _param_showOutsideDays, props = _object_without_properties$8(_param, [
23174
- "className",
23175
- "classNames",
23176
- "showOutsideDays"
23177
- ]);
23178
- return /*#__PURE__*/ jsx(DayPicker, _object_spread_props$c(_object_spread$g({
23179
- showOutsideDays: showOutsideDays,
23180
- className: cn("p-3", className),
23181
- classNames: _object_spread$g({
23182
- months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
23183
- month: "space-y-4",
23184
- caption: "flex justify-center pt-1 relative items-center",
23185
- caption_label: "text-sm font-medium",
23186
- nav: "space-x-1 flex items-center",
23187
- nav_button: cn(buttonVariants({
23188
- variant: "outline"
23189
- }), "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),
23190
- nav_button_previous: "absolute left-1",
23191
- nav_button_next: "absolute right-1",
23192
- table: "w-full border-collapse space-y-1",
23193
- head_row: "flex",
23194
- head_cell: "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
23195
- row: "flex w-full mt-2",
23196
- cell: cn("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md", props.mode === "range" ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" : "[&:has([aria-selected])]:rounded-md"),
23197
- day: cn(buttonVariants({
23198
- variant: "ghost"
23199
- }), "h-8 w-8 p-0 font-normal aria-selected:opacity-100"),
23200
- day_range_start: "day-range-start",
23201
- day_range_end: "day-range-end",
23202
- day_selected: "bg-[#000] text-[#fff] hover:bg-[#000] hover:text-[#fff] focus:bg-[#000] focus:text-[#fff]",
23203
- day_today: "bg-accent text-accent-foreground",
23204
- day_outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
23205
- day_disabled: "text-muted-foreground opacity-50",
23206
- day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
23207
- day_hidden: "invisible"
23208
- }, classNames),
23209
- components: {
23210
- IconLeft: function(_param) {
23211
- _extends$3({}, _object_destructuring_empty$2(_param));
23212
- return /*#__PURE__*/ jsx(Icon, {
23213
- icon: "heroicons-solid:arrow-left",
23214
- width: "1rem",
23215
- height: "1rem"
23216
- });
23217
- },
23218
- IconRight: function(_param) {
23219
- _extends$3({}, _object_destructuring_empty$2(_param));
23220
- return /*#__PURE__*/ jsx(Icon, {
23221
- icon: "heroicons-solid:arrow-right",
23222
- width: "1rem",
23223
- height: "1rem"
23224
- });
23225
- }
23226
- }
23227
- }, props), {
23228
- locale: zhTW
23359
+ var FormProvider = function(param) {
23360
+ var children = param.children, onSubmit = param.onSubmit, onError = param.onError, _param_defaultValues = param.defaultValues, defaultValues = _param_defaultValues === void 0 ? {} : _param_defaultValues;
23361
+ var methods = useForm({
23362
+ defaultValues: defaultValues
23363
+ });
23364
+ return /*#__PURE__*/ jsx(FormProvider$1, _object_spread_props$f(_object_spread$j({}, methods), {
23365
+ children: /*#__PURE__*/ jsx("form", {
23366
+ onSubmit: methods.handleSubmit(onSubmit, onError),
23367
+ children: children
23368
+ })
23229
23369
  }));
23230
- }
23231
- Calendar$2.displayName = "Calendar";
23370
+ };
23232
23371
 
23233
- function _define_property$g(obj, key, value) {
23372
+ function _define_property$j(obj, key, value) {
23234
23373
  if (key in obj) {
23235
23374
  Object.defineProperty(obj, key, {
23236
23375
  value: value,
@@ -23243,7 +23382,7 @@ function _define_property$g(obj, key, value) {
23243
23382
  }
23244
23383
  return obj;
23245
23384
  }
23246
- function _object_spread$f(target) {
23385
+ function _object_spread$i(target) {
23247
23386
  for(var i = 1; i < arguments.length; i++){
23248
23387
  var source = arguments[i] != null ? arguments[i] : {};
23249
23388
  var ownKeys = Object.keys(source);
@@ -23253,413 +23392,108 @@ function _object_spread$f(target) {
23253
23392
  }));
23254
23393
  }
23255
23394
  ownKeys.forEach(function(key) {
23256
- _define_property$g(target, key, source[key]);
23395
+ _define_property$j(target, key, source[key]);
23257
23396
  });
23258
23397
  }
23259
23398
  return target;
23260
23399
  }
23261
- function _object_without_properties$7(source, excluded) {
23262
- if (source == null) return {};
23263
- var target = _object_without_properties_loose$7(source, excluded);
23264
- var key, i;
23400
+ function ownKeys$e(object, enumerableOnly) {
23401
+ var keys = Object.keys(object);
23265
23402
  if (Object.getOwnPropertySymbols) {
23266
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
23267
- for(i = 0; i < sourceSymbolKeys.length; i++){
23268
- key = sourceSymbolKeys[i];
23269
- if (excluded.indexOf(key) >= 0) continue;
23270
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
23271
- target[key] = source[key];
23403
+ var symbols = Object.getOwnPropertySymbols(object);
23404
+ if (enumerableOnly) {
23405
+ symbols = symbols.filter(function(sym) {
23406
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
23407
+ });
23272
23408
  }
23409
+ keys.push.apply(keys, symbols);
23273
23410
  }
23274
- return target;
23411
+ return keys;
23275
23412
  }
23276
- function _object_without_properties_loose$7(source, excluded) {
23277
- if (source == null) return {};
23278
- var target = {};
23279
- var sourceKeys = Object.keys(source);
23280
- var key, i;
23281
- for(i = 0; i < sourceKeys.length; i++){
23282
- key = sourceKeys[i];
23283
- if (excluded.indexOf(key) >= 0) continue;
23284
- target[key] = source[key];
23413
+ function _object_spread_props$e(target, source) {
23414
+ source = source != null ? source : {};
23415
+ if (Object.getOwnPropertyDescriptors) {
23416
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
23417
+ } else {
23418
+ ownKeys$e(Object(source)).forEach(function(key) {
23419
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
23420
+ });
23285
23421
  }
23286
23422
  return target;
23287
23423
  }
23288
- var Popover = PopoverPrimitive.Root;
23289
- var PopoverTrigger = PopoverPrimitive.Trigger;
23290
- var PopoverContent = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
23291
- var className = _param.className, _param_align = _param.align, align = _param_align === void 0 ? "center" : _param_align, _param_sideOffset = _param.sideOffset, sideOffset = _param_sideOffset === void 0 ? 4 : _param_sideOffset, props = _object_without_properties$7(_param, [
23292
- "className",
23293
- "align",
23294
- "sideOffset"
23295
- ]);
23296
- return /*#__PURE__*/ jsx(PopoverPrimitive.Portal, {
23297
- children: /*#__PURE__*/ jsx(PopoverPrimitive.Content, _object_spread$f({
23298
- ref: ref,
23299
- align: align,
23300
- sideOffset: sideOffset,
23301
- className: cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className)
23302
- }, props))
23303
- });
23304
- });
23305
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
23306
-
23307
- function DateRangePicker(param) {
23308
- var className = param.className, inputClassName = param.inputClassName, disable = param.disable, _param_isShowCleanBtn = param.isShowCleanBtn, isShowCleanBtn = _param_isShowCleanBtn === void 0 ? true : _param_isShowCleanBtn, onChange = param.onChange, dates = param.dates, setDates = param.setDates;
23309
- var handleDateChange = function(newDate) {
23310
- if (newDate) {
23311
- setDates(newDate);
23312
- if (onChange) onChange(newDate);
23313
- }
23314
- };
23315
- return /*#__PURE__*/ jsxs("div", {
23316
- className: "flex gap-2 items-center",
23317
- children: [
23318
- /*#__PURE__*/ jsx("div", {
23319
- className: cn("grid gap-2", className, disable ? "pointer-events-none opacity-55" : "pointer-events-auto opacity-100"),
23320
- children: /*#__PURE__*/ jsxs(Popover, {
23321
- children: [
23322
- /*#__PURE__*/ jsx(PopoverTrigger, {
23323
- asChild: true,
23324
- children: /*#__PURE__*/ jsxs(Button, {
23325
- id: "date",
23326
- variant: "outline",
23327
- className: cn("w-[300px] justify-start text-left font-normal", !dates && "text-muted-foreground", inputClassName),
23328
- children: [
23329
- /*#__PURE__*/ jsx(Calendar$3, {
23330
- className: "mr-2 h-4 w-4"
23331
- }),
23332
- (dates === null || dates === void 0 ? void 0 : dates.from) ? dates.to ? /*#__PURE__*/ jsxs(Fragment$1, {
23333
- children: [
23334
- format(dates.from, "yyyy-MM-dd"),
23335
- " -",
23336
- " ",
23337
- format(dates.to, "yyyy-MM-dd")
23338
- ]
23339
- }) : format(dates.from, "yyyy-MM-dd") : /*#__PURE__*/ jsx("span", {
23340
- children: "請選擇日期"
23341
- })
23342
- ]
23343
- })
23344
- }),
23345
- /*#__PURE__*/ jsx(PopoverContent, {
23346
- className: "w-auto p-0",
23347
- align: "start",
23348
- children: /*#__PURE__*/ jsx(Calendar$2, {
23349
- initialFocus: true,
23350
- mode: "range",
23351
- defaultMonth: dates === null || dates === void 0 ? void 0 : dates.from,
23352
- selected: dates,
23353
- onSelect: handleDateChange,
23354
- numberOfMonths: 2
23355
- })
23356
- })
23357
- ]
23358
- })
23359
- }),
23360
- isShowCleanBtn && /*#__PURE__*/ jsx(Button, {
23361
- variant: "ghost",
23362
- className: cn("justify-start text-left font-normal"),
23363
- onClick: function() {
23364
- return setDates(undefined);
23365
- },
23366
- children: "清除日期"
23367
- })
23368
- ]
23369
- });
23370
- }
23371
-
23372
- function _array_like_to_array$i(arr, len) {
23373
- if (len == null || len > arr.length) len = arr.length;
23374
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
23375
- return arr2;
23376
- }
23377
- function _array_with_holes$f(arr) {
23378
- if (Array.isArray(arr)) return arr;
23379
- }
23380
- function _iterable_to_array_limit$f(arr, i) {
23381
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
23382
- if (_i == null) return;
23383
- var _arr = [];
23384
- var _n = true;
23385
- var _d = false;
23386
- var _s, _e;
23387
- try {
23388
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
23389
- _arr.push(_s.value);
23390
- if (i && _arr.length === i) break;
23391
- }
23392
- } catch (err) {
23393
- _d = true;
23394
- _e = err;
23395
- } finally{
23396
- try {
23397
- if (!_n && _i["return"] != null) _i["return"]();
23398
- } finally{
23399
- if (_d) throw _e;
23400
- }
23401
- }
23402
- return _arr;
23403
- }
23404
- function _non_iterable_rest$f() {
23405
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
23406
- }
23407
- function _sliced_to_array$f(arr, i) {
23408
- return _array_with_holes$f(arr) || _iterable_to_array_limit$f(arr, i) || _unsupported_iterable_to_array$i(arr, i) || _non_iterable_rest$f();
23409
- }
23410
- function _unsupported_iterable_to_array$i(o, minLen) {
23411
- if (!o) return;
23412
- if (typeof o === "string") return _array_like_to_array$i(o, minLen);
23413
- var n = Object.prototype.toString.call(o).slice(8, -1);
23414
- if (n === "Object" && o.constructor) n = o.constructor.name;
23415
- if (n === "Map" || n === "Set") return Array.from(n);
23416
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$i(o, minLen);
23417
- }
23418
- var SingleDatePicker = function(param) {
23419
- var disable = param.disable, onChange = param.onChange;
23420
- var _useState = _sliced_to_array$f(useState(), 2), date = _useState[0], setDate = _useState[1];
23421
- var handleDate = function(newDate) {
23422
- if (newDate) {
23423
- setDate(newDate);
23424
- if (onChange) onChange(newDate);
23425
- }
23426
- };
23427
- return /*#__PURE__*/ jsx("div", {
23428
- className: cn(disable ? "pointer-events-none opacity-55" : "pointer-events-auto opacity-100"),
23429
- children: /*#__PURE__*/ jsxs(Popover, {
23430
- children: [
23431
- /*#__PURE__*/ jsx(PopoverTrigger, {
23432
- asChild: true,
23433
- children: /*#__PURE__*/ jsxs(Button, {
23434
- variant: "outline",
23435
- className: cn("w-[280px] justify-start text-left font-normal", !date && "text-muted-foreground"),
23436
- children: [
23437
- /*#__PURE__*/ jsx(Calendar$3, {
23438
- className: "mr-2 h-4 w-4"
23439
- }),
23440
- date ? format(date, "yyyy-MM-dd") : /*#__PURE__*/ jsx("span", {
23441
- children: "請選擇日期"
23442
- })
23443
- ]
23444
- })
23445
- }),
23446
- /*#__PURE__*/ jsx(PopoverContent, {
23447
- className: "w-auto p-0",
23448
- children: /*#__PURE__*/ jsx(Calendar$2, {
23449
- mode: "single",
23450
- selected: date,
23451
- onSelect: handleDate,
23452
- initialFocus: true
23453
- })
23454
- })
23455
- ]
23456
- })
23457
- });
23458
- };
23459
-
23460
- function _array_like_to_array$h(arr, len) {
23461
- if (len == null || len > arr.length) len = arr.length;
23462
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
23463
- return arr2;
23464
- }
23465
- function _array_with_holes$e(arr) {
23466
- if (Array.isArray(arr)) return arr;
23467
- }
23468
- function _iterable_to_array_limit$e(arr, i) {
23469
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
23470
- if (_i == null) return;
23471
- var _arr = [];
23472
- var _n = true;
23473
- var _d = false;
23474
- var _s, _e;
23475
- try {
23476
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
23477
- _arr.push(_s.value);
23478
- if (i && _arr.length === i) break;
23479
- }
23480
- } catch (err) {
23481
- _d = true;
23482
- _e = err;
23483
- } finally{
23484
- try {
23485
- if (!_n && _i["return"] != null) _i["return"]();
23486
- } finally{
23487
- if (_d) throw _e;
23488
- }
23489
- }
23490
- return _arr;
23491
- }
23492
- function _non_iterable_rest$e() {
23493
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
23494
- }
23495
- function _sliced_to_array$e(arr, i) {
23496
- return _array_with_holes$e(arr) || _iterable_to_array_limit$e(arr, i) || _unsupported_iterable_to_array$h(arr, i) || _non_iterable_rest$e();
23497
- }
23498
- function _unsupported_iterable_to_array$h(o, minLen) {
23499
- if (!o) return;
23500
- if (typeof o === "string") return _array_like_to_array$h(o, minLen);
23501
- var n = Object.prototype.toString.call(o).slice(8, -1);
23502
- if (n === "Object" && o.constructor) n = o.constructor.name;
23503
- if (n === "Map" || n === "Set") return Array.from(n);
23504
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$h(o, minLen);
23505
- }
23506
- var ReactDateRange = function(param) {
23507
- var className = param.className, item = param.item, onChange = param.onChange, dates = param.dates, date = param.date;
23508
- var _useState = _sliced_to_array$e(useState("zhTW"), 1), locale = _useState[0];
23509
- var _useState1 = _sliced_to_array$e(useState(""), 2), calendarData = _useState1[0], setCalendarData = _useState1[1];
23510
- var _useState2 = _sliced_to_array$e(useState({
23511
- startDate: new Date(),
23512
- endDate: addDays(new Date(), 7),
23513
- key: "selection"
23514
- }), 2), range = _useState2[0], setRange = _useState2[1];
23515
- var _useState3 = _sliced_to_array$e(useState(false), 2), open = _useState3[0], setOpen = _useState3[1];
23516
- var refOne = useRef(null);
23517
- var hideOnEscape = function(e) {
23518
- if (e.key === "Escape") {
23519
- setOpen(false);
23520
- }
23521
- };
23522
- var hideOnClickOutside = function(e) {
23523
- if (refOne.current && !refOne.current.contains(e.target)) {
23524
- setOpen(false);
23525
- }
23526
- };
23527
- useEffect(function() {
23528
- setCalendarData(date);
23529
- }, [
23530
- date
23531
- ]);
23532
- useEffect(function() {
23533
- if (!dates) return;
23534
- setRange(dates);
23535
- }, [
23536
- dates
23537
- ]);
23538
- useEffect(function() {
23539
- document.addEventListener("keydown", hideOnEscape, true);
23540
- document.addEventListener("click", hideOnClickOutside, true);
23541
- return function() {
23542
- document.removeEventListener("keydown", hideOnEscape, true);
23543
- document.removeEventListener("click", hideOnClickOutside, true);
23544
- };
23545
- }, []);
23546
- var formatDates = function() {
23547
- if (!range) return;
23548
- var startDate = range.startDate, endDate = range.endDate;
23549
- return "".concat(format$1(startDate, "yyyy-MM-dd"), " ~ ").concat(format$1(endDate, "yyyy-MM-dd"));
23550
- };
23551
- var formatDate = calendarData ? format$1(calendarData, (item === null || item === void 0 ? void 0 : item.dateDisplayFormat) || "yyyy-MM-dd") : "";
23552
- return /*#__PURE__*/ jsxs("div", {
23553
- className: [
23554
- className,
23555
- "relative"
23556
- ].join(" "),
23557
- children: [
23558
- (item === null || item === void 0 ? void 0 : item.label) && /*#__PURE__*/ jsx("div", {
23559
- className: "text-gray-700 font-medium mb-2 h-6",
23560
- children: item === null || item === void 0 ? void 0 : item.label
23561
- }),
23562
- /*#__PURE__*/ jsx("input", {
23563
- className: "border-solid border rounded p-2 h-10 w-full timePicker border-gray-300",
23564
- name: item === null || item === void 0 ? void 0 : item.name,
23565
- onClick: function() {
23566
- return setOpen(function(openState) {
23567
- return !openState;
23568
- });
23569
- },
23570
- placeholder: item === null || item === void 0 ? void 0 : item.placeholder,
23571
- value: (item === null || item === void 0 ? void 0 : item.type) === "date" ? formatDate : formatDates(),
23572
- autoComplete: "off"
23573
- }),
23574
- open && /*#__PURE__*/ jsxs("div", {
23575
- className: "absolute top-[72px] left-0 z-50 shadow-md",
23576
- ref: refOne,
23577
- children: [
23578
- open && (item === null || item === void 0 ? void 0 : item.type) === "date" && /*#__PURE__*/ jsx(Calendar$4, {
23579
- data: calendarData,
23580
- locale: locales[locale],
23581
- dateDisplayFormat: item === null || item === void 0 ? void 0 : item.dateDisplayFormat,
23582
- onChange: function(value) {
23583
- setCalendarData(value);
23584
- if (onChange) onChange(value);
23585
- setOpen(false);
23586
- }
23587
- }),
23588
- open && (item === null || item === void 0 ? void 0 : item.type) === "dateRange" && /*#__PURE__*/ jsx(DateRange, {
23589
- editableDateInputs: true,
23590
- onChange: function(value) {
23591
- setRange(value.selection);
23592
- if (onChange) onChange(value.selection);
23593
- },
23594
- ranges: [
23595
- range
23596
- ],
23597
- locale: locales[locale],
23598
- dateDisplayFormat: "yyyy.MM.dd"
23599
- })
23600
- ]
23601
- })
23602
- ]
23603
- });
23604
- };
23605
-
23606
- var dynamic$1 = {
23607
- exports: {}
23608
- };
23609
-
23610
- var _interop_require_default$1 = {};
23611
-
23612
- _interop_require_default$1._ = _interop_require_default$1._interop_require_default = _interop_require_default;
23613
- function _interop_require_default(obj) {
23614
- return obj && obj.__esModule ? obj : {
23615
- default: obj
23616
- };
23617
- }
23618
-
23619
- var loadable_sharedRuntime = {};
23620
-
23621
- var loadableContext_sharedRuntime = {};
23622
-
23623
- (function (exports) {
23624
- "use client";
23625
- Object.defineProperty(exports, "__esModule", {
23626
- value: true
23627
- });
23628
- Object.defineProperty(exports, "LoadableContext", {
23629
- enumerable: true,
23630
- get: function get() {
23631
- return LoadableContext;
23632
- }
23633
- });
23634
- var _interop_require_default = _interop_require_default$1;
23635
- var _react = /*#__PURE__*/ _interop_require_default._(React__default);
23636
- var LoadableContext = _react.default.createContext(null);
23637
- if (process.env.NODE_ENV !== "production") {
23638
- LoadableContext.displayName = "LoadableContext";
23639
- }
23640
- }(loadableContext_sharedRuntime));
23641
-
23642
- (function (exports) {
23643
- function _class_call_check(instance, Constructor) {
23644
- if (!(instance instanceof Constructor)) {
23645
- throw new TypeError("Cannot call a class as a function");
23424
+ function _object_without_properties$a(source, excluded) {
23425
+ if (source == null) return {};
23426
+ var target = _object_without_properties_loose$a(source, excluded);
23427
+ var key, i;
23428
+ if (Object.getOwnPropertySymbols) {
23429
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
23430
+ for(i = 0; i < sourceSymbolKeys.length; i++){
23431
+ key = sourceSymbolKeys[i];
23432
+ if (excluded.indexOf(key) >= 0) continue;
23433
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
23434
+ target[key] = source[key];
23435
+ }
23646
23436
  }
23437
+ return target;
23647
23438
  }
23648
- function _defineProperties(target, props) {
23649
- for(var i = 0; i < props.length; i++){
23650
- var descriptor = props[i];
23651
- descriptor.enumerable = descriptor.enumerable || false;
23652
- descriptor.configurable = true;
23653
- if ("value" in descriptor) descriptor.writable = true;
23654
- Object.defineProperty(target, descriptor.key, descriptor);
23439
+ function _object_without_properties_loose$a(source, excluded) {
23440
+ if (source == null) return {};
23441
+ var target = {};
23442
+ var sourceKeys = Object.keys(source);
23443
+ var key, i;
23444
+ for(i = 0; i < sourceKeys.length; i++){
23445
+ key = sourceKeys[i];
23446
+ if (excluded.indexOf(key) >= 0) continue;
23447
+ target[key] = source[key];
23655
23448
  }
23449
+ return target;
23656
23450
  }
23657
- function _create_class(Constructor, protoProps, staticProps) {
23658
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
23659
- if (staticProps) _defineProperties(Constructor, staticProps);
23660
- return Constructor;
23661
- }
23662
- function _define_property(obj, key, value) {
23451
+ var Switch = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
23452
+ var _param_size = _param.size, size = _param_size === void 0 ? "large" : _param_size, color = _param.color, props = _object_without_properties$a(_param, [
23453
+ "size",
23454
+ "color"
23455
+ ]);
23456
+ var control = useForm().control;
23457
+ var name = props.name, className = props.className;
23458
+ var bgColor = color === "blue" ? "data-[state=checked]:bg-blue-500" : color === "red" ? "data-[state=checked]:bg-red-500" : color === "green" ? "data-[state=checked]:bg-green-500" : color === "yellow" ? "data-[state=checked]:bg-yellow-500" : "data-[state=checked]:bg-blue-500";
23459
+ var sizeClass = {
23460
+ small: {
23461
+ root: "h-4 w-7",
23462
+ thumb: "h-3 w-3 data-[state=checked]:translate-x-3"
23463
+ },
23464
+ medium: {
23465
+ root: "h-5 w-9",
23466
+ thumb: "h-4 w-4 data-[state=checked]:translate-x-4"
23467
+ },
23468
+ large: {
23469
+ root: "h-6 w-11",
23470
+ thumb: "h-5 w-5 data-[state=checked]:translate-x-5"
23471
+ }
23472
+ };
23473
+ return /*#__PURE__*/ jsx("div", {
23474
+ className: [
23475
+ "h-24 w-full",
23476
+ className
23477
+ ].join(" "),
23478
+ children: /*#__PURE__*/ jsx(Controller$2, {
23479
+ name: name || "",
23480
+ control: control,
23481
+ render: function(param) {
23482
+ param.field;
23483
+ return /*#__PURE__*/ jsx(SwitchPrimitives.Root, _object_spread_props$e(_object_spread$i({
23484
+ className: cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50", bgColor, sizeClass[size].root, "data-[state=unchecked]:bg-input")
23485
+ }, props), {
23486
+ ref: ref,
23487
+ children: /*#__PURE__*/ jsx(SwitchPrimitives.Thumb, {
23488
+ className: cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0", sizeClass[size].thumb)
23489
+ })
23490
+ }));
23491
+ }
23492
+ })
23493
+ });
23494
+ });
23495
+
23496
+ function _define_property$i(obj, key, value) {
23663
23497
  if (key in obj) {
23664
23498
  Object.defineProperty(obj, key, {
23665
23499
  value: value,
@@ -23672,7 +23506,7 @@ function _define_property(obj, key, value) {
23672
23506
  }
23673
23507
  return obj;
23674
23508
  }
23675
- function _object_spread(target) {
23509
+ function _object_spread$h(target) {
23676
23510
  for(var i = 1; i < arguments.length; i++){
23677
23511
  var source = arguments[i] != null ? arguments[i] : {};
23678
23512
  var ownKeys = Object.keys(source);
@@ -23682,12 +23516,12 @@ function _object_spread(target) {
23682
23516
  }));
23683
23517
  }
23684
23518
  ownKeys.forEach(function(key) {
23685
- _define_property(target, key, source[key]);
23519
+ _define_property$i(target, key, source[key]);
23686
23520
  });
23687
23521
  }
23688
23522
  return target;
23689
23523
  }
23690
- function ownKeys(object, enumerableOnly) {
23524
+ function ownKeys$d(object, enumerableOnly) {
23691
23525
  var keys = Object.keys(object);
23692
23526
  if (Object.getOwnPropertySymbols) {
23693
23527
  var symbols = Object.getOwnPropertySymbols(object);
@@ -23700,289 +23534,269 @@ function ownKeys(object, enumerableOnly) {
23700
23534
  }
23701
23535
  return keys;
23702
23536
  }
23703
- function _object_spread_props(target, source) {
23537
+ function _object_spread_props$d(target, source) {
23704
23538
  source = source != null ? source : {};
23705
23539
  if (Object.getOwnPropertyDescriptors) {
23706
23540
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
23707
23541
  } else {
23708
- ownKeys(Object(source)).forEach(function(key) {
23542
+ ownKeys$d(Object(source)).forEach(function(key) {
23709
23543
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
23710
23544
  });
23711
23545
  }
23712
23546
  return target;
23713
23547
  }
23714
- Object.defineProperty(exports, "__esModule", {
23715
- value: true
23716
- });
23717
- Object.defineProperty(exports, "default", {
23718
- enumerable: true,
23719
- get: function get() {
23720
- return _default;
23548
+ function _object_without_properties$9(source, excluded) {
23549
+ if (source == null) return {};
23550
+ var target = _object_without_properties_loose$9(source, excluded);
23551
+ var key, i;
23552
+ if (Object.getOwnPropertySymbols) {
23553
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
23554
+ for(i = 0; i < sourceSymbolKeys.length; i++){
23555
+ key = sourceSymbolKeys[i];
23556
+ if (excluded.indexOf(key) >= 0) continue;
23557
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
23558
+ target[key] = source[key];
23559
+ }
23721
23560
  }
23722
- });
23723
- var _interop_require_default = _interop_require_default$1;
23724
- var _react = /*#__PURE__*/ _interop_require_default._(React__default);
23725
- var _loadablecontextsharedruntime = loadableContext_sharedRuntime;
23726
- function resolve(obj) {
23727
- return obj && obj.default ? obj.default : obj;
23561
+ return target;
23728
23562
  }
23729
- var ALL_INITIALIZERS = [];
23730
- var READY_INITIALIZERS = [];
23731
- var initialized = false;
23732
- function load(loader) {
23733
- var promise = loader();
23734
- var state = {
23735
- loading: true,
23736
- loaded: null,
23737
- error: null
23738
- };
23739
- state.promise = promise.then(function(loaded) {
23740
- state.loading = false;
23741
- state.loaded = loaded;
23742
- return loaded;
23743
- }).catch(function(err) {
23744
- state.loading = false;
23745
- state.error = err;
23746
- throw err;
23747
- });
23748
- return state;
23563
+ function _object_without_properties_loose$9(source, excluded) {
23564
+ if (source == null) return {};
23565
+ var target = {};
23566
+ var sourceKeys = Object.keys(source);
23567
+ var key, i;
23568
+ for(i = 0; i < sourceKeys.length; i++){
23569
+ key = sourceKeys[i];
23570
+ if (excluded.indexOf(key) >= 0) continue;
23571
+ target[key] = source[key];
23572
+ }
23573
+ return target;
23749
23574
  }
23750
- function createLoadableComponent(loadFn, options) {
23751
- var opts = Object.assign({
23752
- loader: null,
23753
- loading: null,
23754
- delay: 200,
23755
- timeout: null,
23756
- webpack: null,
23757
- modules: null
23758
- }, options);
23759
- /** @type LoadableSubscription */ var subscription = null;
23760
- function init() {
23761
- if (!subscription) {
23762
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
23763
- var sub = new LoadableSubscription(loadFn, opts);
23764
- subscription = {
23765
- getCurrentValue: sub.getCurrentValue.bind(sub),
23766
- subscribe: sub.subscribe.bind(sub),
23767
- retry: sub.retry.bind(sub),
23768
- promise: sub.promise.bind(sub)
23769
- };
23575
+ var buttonVariants = cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", {
23576
+ variants: {
23577
+ variant: {
23578
+ custom: "bg-inherit",
23579
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
23580
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
23581
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
23582
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
23583
+ ghost: "hover:bg-accent hover:text-accent-foreground",
23584
+ link: "text-primary underline-offset-4 hover:underline"
23585
+ },
23586
+ size: {
23587
+ default: "h-9 px-4 py-2",
23588
+ sm: "h-8 rounded-md px-3 text-xs",
23589
+ lg: "h-10 rounded-md px-8",
23590
+ icon: "h-9 w-9"
23770
23591
  }
23771
- return subscription.promise();
23592
+ },
23593
+ defaultVariants: {
23594
+ variant: "default",
23595
+ size: "default"
23772
23596
  }
23773
- // Server only
23774
- if (typeof window === "undefined") {
23775
- ALL_INITIALIZERS.push(init);
23597
+ });
23598
+ var Button = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
23599
+ var className = _param.className, variant = _param.variant, size = _param.size, _param_asChild = _param.asChild, asChild = _param_asChild === void 0 ? false : _param_asChild, _param_isLoading = _param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, customClassName = _param.customClassName, children = _param.children, props = _object_without_properties$9(_param, [
23600
+ "className",
23601
+ "variant",
23602
+ "size",
23603
+ "asChild",
23604
+ "isLoading",
23605
+ "customClassName",
23606
+ "children"
23607
+ ]);
23608
+ var Comp = asChild ? Slot : "button";
23609
+ return /*#__PURE__*/ jsx(Comp, _object_spread_props$d(_object_spread$h({
23610
+ className: cn(variant !== "custom" ? buttonVariants({
23611
+ variant: variant,
23612
+ size: size,
23613
+ className: className
23614
+ }) : "", isLoading ? "pointer-events-none opacity-70" : "pointer-events-auto opacity-100"),
23615
+ ref: ref
23616
+ }, props), {
23617
+ disabled: isLoading || props.disabled,
23618
+ children: variant === "custom" ? /*#__PURE__*/ jsxs("div", {
23619
+ className: [
23620
+ "flex items-center gap-1",
23621
+ customClassName,
23622
+ props.disabled ? "pointer-events-none opacity-70" : ""
23623
+ ].join(" "),
23624
+ children: [
23625
+ isLoading && /*#__PURE__*/ jsx("div", {
23626
+ className: "w-4 h-4 rounded-full border-2 border-solid border-white border-t-[#939393] animate-spin mr-2"
23627
+ }),
23628
+ children
23629
+ ]
23630
+ }) : /*#__PURE__*/ jsxs(Fragment$1, {
23631
+ children: [
23632
+ isLoading && /*#__PURE__*/ jsx("div", {
23633
+ className: "w-4 h-4 rounded-full border-2 border-solid border-white border-t-[#939393] animate-spin mr-2"
23634
+ }),
23635
+ children
23636
+ ]
23637
+ })
23638
+ }));
23639
+ });
23640
+
23641
+ function _define_property$h(obj, key, value) {
23642
+ if (key in obj) {
23643
+ Object.defineProperty(obj, key, {
23644
+ value: value,
23645
+ enumerable: true,
23646
+ configurable: true,
23647
+ writable: true
23648
+ });
23649
+ } else {
23650
+ obj[key] = value;
23776
23651
  }
23777
- // Client only
23778
- if (!initialized && typeof window !== "undefined") {
23779
- // require.resolveWeak check is needed for environments that don't have it available like Jest
23780
- var moduleIds = opts.webpack && typeof commonjsRequire.resolveWeak === "function" ? opts.webpack() : opts.modules;
23781
- if (moduleIds) {
23782
- READY_INITIALIZERS.push(function(ids) {
23783
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
23784
- try {
23785
- for(var _iterator = moduleIds[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
23786
- var moduleId = _step.value;
23787
- if (ids.includes(moduleId)) {
23788
- return init();
23789
- }
23790
- }
23791
- } catch (err) {
23792
- _didIteratorError = true;
23793
- _iteratorError = err;
23794
- } finally{
23795
- try {
23796
- if (!_iteratorNormalCompletion && _iterator.return != null) {
23797
- _iterator.return();
23798
- }
23799
- } finally{
23800
- if (_didIteratorError) {
23801
- throw _iteratorError;
23802
- }
23803
- }
23652
+ return obj;
23653
+ }
23654
+ function _extends$3() {
23655
+ _extends$3 = Object.assign || function(target) {
23656
+ for(var i = 1; i < arguments.length; i++){
23657
+ var source = arguments[i];
23658
+ for(var key in source){
23659
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
23660
+ target[key] = source[key];
23804
23661
  }
23805
- });
23662
+ }
23663
+ }
23664
+ return target;
23665
+ };
23666
+ return _extends$3.apply(this, arguments);
23667
+ }
23668
+ function _object_destructuring_empty$2(o) {
23669
+ if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
23670
+ return o;
23671
+ }
23672
+ function _object_spread$g(target) {
23673
+ for(var i = 1; i < arguments.length; i++){
23674
+ var source = arguments[i] != null ? arguments[i] : {};
23675
+ var ownKeys = Object.keys(source);
23676
+ if (typeof Object.getOwnPropertySymbols === "function") {
23677
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
23678
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
23679
+ }));
23806
23680
  }
23681
+ ownKeys.forEach(function(key) {
23682
+ _define_property$h(target, key, source[key]);
23683
+ });
23807
23684
  }
23808
- function useLoadableModule() {
23809
- init();
23810
- var context = _react.default.useContext(_loadablecontextsharedruntime.LoadableContext);
23811
- if (context && Array.isArray(opts.modules)) {
23812
- opts.modules.forEach(function(moduleName) {
23813
- context(moduleName);
23685
+ return target;
23686
+ }
23687
+ function ownKeys$c(object, enumerableOnly) {
23688
+ var keys = Object.keys(object);
23689
+ if (Object.getOwnPropertySymbols) {
23690
+ var symbols = Object.getOwnPropertySymbols(object);
23691
+ if (enumerableOnly) {
23692
+ symbols = symbols.filter(function(sym) {
23693
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
23814
23694
  });
23815
23695
  }
23696
+ keys.push.apply(keys, symbols);
23816
23697
  }
23817
- function LoadableComponent(props, ref) {
23818
- useLoadableModule();
23819
- var state = _react.default.useSyncExternalStore(subscription.subscribe, subscription.getCurrentValue, subscription.getCurrentValue);
23820
- _react.default.useImperativeHandle(ref, function() {
23821
- return {
23822
- retry: subscription.retry
23823
- };
23824
- }, []);
23825
- return _react.default.useMemo(function() {
23826
- if (state.loading || state.error) {
23827
- return /*#__PURE__*/ _react.default.createElement(opts.loading, {
23828
- isLoading: state.loading,
23829
- pastDelay: state.pastDelay,
23830
- timedOut: state.timedOut,
23831
- error: state.error,
23832
- retry: subscription.retry
23833
- });
23834
- } else if (state.loaded) {
23835
- return /*#__PURE__*/ _react.default.createElement(resolve(state.loaded), props);
23836
- } else {
23837
- return null;
23838
- }
23839
- }, [
23840
- props,
23841
- state
23842
- ]);
23698
+ return keys;
23699
+ }
23700
+ function _object_spread_props$c(target, source) {
23701
+ source = source != null ? source : {};
23702
+ if (Object.getOwnPropertyDescriptors) {
23703
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
23704
+ } else {
23705
+ ownKeys$c(Object(source)).forEach(function(key) {
23706
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
23707
+ });
23843
23708
  }
23844
- LoadableComponent.preload = function() {
23845
- return init();
23846
- };
23847
- LoadableComponent.displayName = "LoadableComponent";
23848
- return /*#__PURE__*/ _react.default.forwardRef(LoadableComponent);
23709
+ return target;
23849
23710
  }
23850
- var LoadableSubscription = /*#__PURE__*/ function() {
23851
- function LoadableSubscription(loadFn, opts) {
23852
- _class_call_check(this, LoadableSubscription);
23853
- this._loadFn = loadFn;
23854
- this._opts = opts;
23855
- this._callbacks = new Set();
23856
- this._delay = null;
23857
- this._timeout = null;
23858
- this.retry();
23711
+ function _object_without_properties$8(source, excluded) {
23712
+ if (source == null) return {};
23713
+ var target = _object_without_properties_loose$8(source, excluded);
23714
+ var key, i;
23715
+ if (Object.getOwnPropertySymbols) {
23716
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
23717
+ for(i = 0; i < sourceSymbolKeys.length; i++){
23718
+ key = sourceSymbolKeys[i];
23719
+ if (excluded.indexOf(key) >= 0) continue;
23720
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
23721
+ target[key] = source[key];
23722
+ }
23859
23723
  }
23860
- _create_class(LoadableSubscription, [
23861
- {
23862
- key: "promise",
23863
- value: function promise() {
23864
- return this._res.promise;
23865
- }
23866
- },
23867
- {
23868
- key: "retry",
23869
- value: function retry() {
23870
- var _this = this;
23871
- this._clearTimeouts();
23872
- this._res = this._loadFn(this._opts.loader);
23873
- this._state = {
23874
- pastDelay: false,
23875
- timedOut: false
23876
- };
23877
- var _this1 = this, res = _this1._res, opts = _this1._opts;
23878
- if (res.loading) {
23879
- if (typeof opts.delay === "number") {
23880
- if (opts.delay === 0) {
23881
- this._state.pastDelay = true;
23882
- } else {
23883
- this._delay = setTimeout(function() {
23884
- _this._update({
23885
- pastDelay: true
23886
- });
23887
- }, opts.delay);
23888
- }
23889
- }
23890
- if (typeof opts.timeout === "number") {
23891
- this._timeout = setTimeout(function() {
23892
- _this._update({
23893
- timedOut: true
23894
- });
23895
- }, opts.timeout);
23896
- }
23897
- }
23898
- this._res.promise.then(function() {
23899
- _this._update({});
23900
- _this._clearTimeouts();
23901
- }).catch(function(_err) {
23902
- _this._update({});
23903
- _this._clearTimeouts();
23904
- });
23905
- this._update({});
23906
- }
23907
- },
23908
- {
23909
- key: "_update",
23910
- value: function _update(partial) {
23911
- this._state = _object_spread(_object_spread_props(_object_spread({}, this._state), {
23912
- error: this._res.error,
23913
- loaded: this._res.loaded,
23914
- loading: this._res.loading
23915
- }), partial);
23916
- this._callbacks.forEach(function(callback) {
23917
- return callback();
23918
- });
23919
- }
23920
- },
23921
- {
23922
- key: "_clearTimeouts",
23923
- value: function _clearTimeouts() {
23924
- clearTimeout(this._delay);
23925
- clearTimeout(this._timeout);
23926
- }
23927
- },
23928
- {
23929
- key: "getCurrentValue",
23930
- value: function getCurrentValue() {
23931
- return this._state;
23932
- }
23933
- },
23934
- {
23935
- key: "subscribe",
23936
- value: function subscribe(callback) {
23937
- var _this = this;
23938
- this._callbacks.add(callback);
23939
- return function() {
23940
- _this._callbacks.delete(callback);
23941
- };
23724
+ return target;
23725
+ }
23726
+ function _object_without_properties_loose$8(source, excluded) {
23727
+ if (source == null) return {};
23728
+ var target = {};
23729
+ var sourceKeys = Object.keys(source);
23730
+ var key, i;
23731
+ for(i = 0; i < sourceKeys.length; i++){
23732
+ key = sourceKeys[i];
23733
+ if (excluded.indexOf(key) >= 0) continue;
23734
+ target[key] = source[key];
23735
+ }
23736
+ return target;
23737
+ }
23738
+ function Calendar$2(_param) {
23739
+ var className = _param.className, classNames = _param.classNames, _param_showOutsideDays = _param.showOutsideDays, showOutsideDays = _param_showOutsideDays === void 0 ? true : _param_showOutsideDays, props = _object_without_properties$8(_param, [
23740
+ "className",
23741
+ "classNames",
23742
+ "showOutsideDays"
23743
+ ]);
23744
+ return /*#__PURE__*/ jsx(DayPicker, _object_spread_props$c(_object_spread$g({
23745
+ showOutsideDays: showOutsideDays,
23746
+ className: cn("p-3", className),
23747
+ classNames: _object_spread$g({
23748
+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
23749
+ month: "space-y-4",
23750
+ caption: "flex justify-center pt-1 relative items-center",
23751
+ caption_label: "text-sm font-medium",
23752
+ nav: "space-x-1 flex items-center",
23753
+ nav_button: cn(buttonVariants({
23754
+ variant: "outline"
23755
+ }), "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),
23756
+ nav_button_previous: "absolute left-1",
23757
+ nav_button_next: "absolute right-1",
23758
+ table: "w-full border-collapse space-y-1",
23759
+ head_row: "flex",
23760
+ head_cell: "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
23761
+ row: "flex w-full mt-2",
23762
+ cell: cn("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md", props.mode === "range" ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" : "[&:has([aria-selected])]:rounded-md"),
23763
+ day: cn(buttonVariants({
23764
+ variant: "ghost"
23765
+ }), "h-8 w-8 p-0 font-normal aria-selected:opacity-100"),
23766
+ day_range_start: "day-range-start",
23767
+ day_range_end: "day-range-end",
23768
+ day_selected: "bg-[#000] text-[#fff] hover:bg-[#000] hover:text-[#fff] focus:bg-[#000] focus:text-[#fff]",
23769
+ day_today: "bg-accent text-accent-foreground",
23770
+ day_outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
23771
+ day_disabled: "text-muted-foreground opacity-50",
23772
+ day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
23773
+ day_hidden: "invisible"
23774
+ }, classNames),
23775
+ components: {
23776
+ IconLeft: function(_param) {
23777
+ _extends$3({}, _object_destructuring_empty$2(_param));
23778
+ return /*#__PURE__*/ jsx(Icon, {
23779
+ icon: "heroicons-solid:arrow-left",
23780
+ width: "1rem",
23781
+ height: "1rem"
23782
+ });
23783
+ },
23784
+ IconRight: function(_param) {
23785
+ _extends$3({}, _object_destructuring_empty$2(_param));
23786
+ return /*#__PURE__*/ jsx(Icon, {
23787
+ icon: "heroicons-solid:arrow-right",
23788
+ width: "1rem",
23789
+ height: "1rem"
23790
+ });
23942
23791
  }
23943
23792
  }
23944
- ]);
23945
- return LoadableSubscription;
23946
- }();
23947
- function Loadable(opts) {
23948
- return createLoadableComponent(load, opts);
23949
- }
23950
- function flushInitializers(initializers, ids) {
23951
- var promises = [];
23952
- while(initializers.length){
23953
- var init = initializers.pop();
23954
- promises.push(init(ids));
23955
- }
23956
- return Promise.all(promises).then(function() {
23957
- if (initializers.length) {
23958
- return flushInitializers(initializers, ids);
23959
- }
23960
- });
23961
- }
23962
- Loadable.preloadAll = function() {
23963
- return new Promise(function(resolveInitializers, reject) {
23964
- flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject);
23965
- });
23966
- };
23967
- Loadable.preloadReady = function(ids) {
23968
- if (ids === void 0) ids = [];
23969
- return new Promise(function(resolvePreload) {
23970
- var res = function() {
23971
- initialized = true;
23972
- return resolvePreload();
23973
- };
23974
- // We always will resolve, errors should be handled within loading UIs.
23975
- flushInitializers(READY_INITIALIZERS, ids).then(res, res);
23976
- });
23977
- };
23978
- if (typeof window !== "undefined") {
23979
- window.__NEXT_PRELOADREADY = Loadable.preloadReady;
23793
+ }, props), {
23794
+ locale: zhTW
23795
+ }));
23980
23796
  }
23981
- var _default = Loadable;
23982
- }(loadable_sharedRuntime));
23797
+ Calendar$2.displayName = "Calendar";
23983
23798
 
23984
- (function (module, exports) {
23985
- function _define_property(obj, key, value) {
23799
+ function _define_property$g(obj, key, value) {
23986
23800
  if (key in obj) {
23987
23801
  Object.defineProperty(obj, key, {
23988
23802
  value: value,
@@ -23995,14 +23809,7 @@ function _define_property(obj, key, value) {
23995
23809
  }
23996
23810
  return obj;
23997
23811
  }
23998
- function _instanceof(left, right) {
23999
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
24000
- return !!right[Symbol.hasInstance](left);
24001
- } else {
24002
- return left instanceof right;
24003
- }
24004
- }
24005
- function _object_spread(target) {
23812
+ function _object_spread$f(target) {
24006
23813
  for(var i = 1; i < arguments.length; i++){
24007
23814
  var source = arguments[i] != null ? arguments[i] : {};
24008
23815
  var ownKeys = Object.keys(source);
@@ -24012,149 +23819,355 @@ function _object_spread(target) {
24012
23819
  }));
24013
23820
  }
24014
23821
  ownKeys.forEach(function(key) {
24015
- _define_property(target, key, source[key]);
23822
+ _define_property$g(target, key, source[key]);
24016
23823
  });
24017
23824
  }
24018
23825
  return target;
24019
23826
  }
24020
- function ownKeys(object, enumerableOnly) {
24021
- var keys = Object.keys(object);
23827
+ function _object_without_properties$7(source, excluded) {
23828
+ if (source == null) return {};
23829
+ var target = _object_without_properties_loose$7(source, excluded);
23830
+ var key, i;
24022
23831
  if (Object.getOwnPropertySymbols) {
24023
- var symbols = Object.getOwnPropertySymbols(object);
24024
- if (enumerableOnly) {
24025
- symbols = symbols.filter(function(sym) {
24026
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
24027
- });
23832
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
23833
+ for(i = 0; i < sourceSymbolKeys.length; i++){
23834
+ key = sourceSymbolKeys[i];
23835
+ if (excluded.indexOf(key) >= 0) continue;
23836
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
23837
+ target[key] = source[key];
24028
23838
  }
24029
- keys.push.apply(keys, symbols);
24030
23839
  }
24031
- return keys;
23840
+ return target;
24032
23841
  }
24033
- function _object_spread_props(target, source) {
24034
- source = source != null ? source : {};
24035
- if (Object.getOwnPropertyDescriptors) {
24036
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
24037
- } else {
24038
- ownKeys(Object(source)).forEach(function(key) {
24039
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
24040
- });
23842
+ function _object_without_properties_loose$7(source, excluded) {
23843
+ if (source == null) return {};
23844
+ var target = {};
23845
+ var sourceKeys = Object.keys(source);
23846
+ var key, i;
23847
+ for(i = 0; i < sourceKeys.length; i++){
23848
+ key = sourceKeys[i];
23849
+ if (excluded.indexOf(key) >= 0) continue;
23850
+ target[key] = source[key];
24041
23851
  }
24042
23852
  return target;
24043
23853
  }
24044
- Object.defineProperty(exports, "__esModule", {
24045
- value: true
23854
+ var Popover = PopoverPrimitive.Root;
23855
+ var PopoverTrigger = PopoverPrimitive.Trigger;
23856
+ var PopoverContent = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
23857
+ var className = _param.className, _param_align = _param.align, align = _param_align === void 0 ? "center" : _param_align, _param_sideOffset = _param.sideOffset, sideOffset = _param_sideOffset === void 0 ? 4 : _param_sideOffset, props = _object_without_properties$7(_param, [
23858
+ "className",
23859
+ "align",
23860
+ "sideOffset"
23861
+ ]);
23862
+ return /*#__PURE__*/ jsx(PopoverPrimitive.Portal, {
23863
+ children: /*#__PURE__*/ jsx(PopoverPrimitive.Content, _object_spread$f({
23864
+ ref: ref,
23865
+ align: align,
23866
+ sideOffset: sideOffset,
23867
+ className: cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className)
23868
+ }, props))
23869
+ });
24046
23870
  });
24047
- function _export(target, all) {
24048
- for(var name in all)Object.defineProperty(target, name, {
24049
- enumerable: true,
24050
- get: all[name]
23871
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
23872
+
23873
+ function DateRangePicker(param) {
23874
+ var className = param.className, inputClassName = param.inputClassName, disable = param.disable, _param_isShowCleanBtn = param.isShowCleanBtn, isShowCleanBtn = _param_isShowCleanBtn === void 0 ? true : _param_isShowCleanBtn, onChange = param.onChange, dates = param.dates, setDates = param.setDates;
23875
+ var handleDateChange = function(newDate) {
23876
+ if (newDate) {
23877
+ setDates(newDate);
23878
+ if (onChange) onChange(newDate);
23879
+ }
23880
+ };
23881
+ return /*#__PURE__*/ jsxs("div", {
23882
+ className: "flex gap-2 items-center",
23883
+ children: [
23884
+ /*#__PURE__*/ jsx("div", {
23885
+ className: cn("grid gap-2", className, disable ? "pointer-events-none opacity-55" : "pointer-events-auto opacity-100"),
23886
+ children: /*#__PURE__*/ jsxs(Popover, {
23887
+ children: [
23888
+ /*#__PURE__*/ jsx(PopoverTrigger, {
23889
+ asChild: true,
23890
+ children: /*#__PURE__*/ jsxs(Button, {
23891
+ id: "date",
23892
+ variant: "outline",
23893
+ className: cn("w-[300px] justify-start text-left font-normal", !dates && "text-muted-foreground", inputClassName),
23894
+ children: [
23895
+ /*#__PURE__*/ jsx(Calendar$3, {
23896
+ className: "mr-2 h-4 w-4"
23897
+ }),
23898
+ (dates === null || dates === void 0 ? void 0 : dates.from) ? dates.to ? /*#__PURE__*/ jsxs(Fragment$1, {
23899
+ children: [
23900
+ format(dates.from, "yyyy-MM-dd"),
23901
+ " -",
23902
+ " ",
23903
+ format(dates.to, "yyyy-MM-dd")
23904
+ ]
23905
+ }) : format(dates.from, "yyyy-MM-dd") : /*#__PURE__*/ jsx("span", {
23906
+ children: "請選擇日期"
23907
+ })
23908
+ ]
23909
+ })
23910
+ }),
23911
+ /*#__PURE__*/ jsx(PopoverContent, {
23912
+ className: "w-auto p-0",
23913
+ align: "start",
23914
+ children: /*#__PURE__*/ jsx(Calendar$2, {
23915
+ initialFocus: true,
23916
+ mode: "range",
23917
+ defaultMonth: dates === null || dates === void 0 ? void 0 : dates.from,
23918
+ selected: dates,
23919
+ onSelect: handleDateChange,
23920
+ numberOfMonths: 2
23921
+ })
23922
+ })
23923
+ ]
23924
+ })
23925
+ }),
23926
+ isShowCleanBtn && /*#__PURE__*/ jsx(Button, {
23927
+ variant: "ghost",
23928
+ className: cn("justify-start text-left font-normal"),
23929
+ onClick: function() {
23930
+ return setDates(undefined);
23931
+ },
23932
+ children: "清除日期"
23933
+ })
23934
+ ]
24051
23935
  });
24052
23936
  }
24053
- _export(exports, {
24054
- noSSR: function noSSR1() {
24055
- return noSSR;
24056
- },
24057
- default: function _default() {
24058
- return dynamic;
23937
+
23938
+ function _array_like_to_array$i(arr, len) {
23939
+ if (len == null || len > arr.length) len = arr.length;
23940
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
23941
+ return arr2;
23942
+ }
23943
+ function _array_with_holes$f(arr) {
23944
+ if (Array.isArray(arr)) return arr;
23945
+ }
23946
+ function _iterable_to_array_limit$f(arr, i) {
23947
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
23948
+ if (_i == null) return;
23949
+ var _arr = [];
23950
+ var _n = true;
23951
+ var _d = false;
23952
+ var _s, _e;
23953
+ try {
23954
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
23955
+ _arr.push(_s.value);
23956
+ if (i && _arr.length === i) break;
23957
+ }
23958
+ } catch (err) {
23959
+ _d = true;
23960
+ _e = err;
23961
+ } finally{
23962
+ try {
23963
+ if (!_n && _i["return"] != null) _i["return"]();
23964
+ } finally{
23965
+ if (_d) throw _e;
23966
+ }
24059
23967
  }
24060
- });
24061
- var _interop_require_default = _interop_require_default$1;
24062
- var _react = /*#__PURE__*/ _interop_require_default._(React__default);
24063
- var _loadablesharedruntime = /*#__PURE__*/ _interop_require_default._(loadable_sharedRuntime);
24064
- var isServerSide = typeof window === "undefined";
24065
- // Normalize loader to return the module as form { default: Component } for `React.lazy`.
24066
- // Also for backward compatible since next/dynamic allows to resolve a component directly with loader
24067
- // Client component reference proxy need to be converted to a module.
24068
- function convertModule(mod) {
24069
- return {
24070
- default: (mod == null ? void 0 : mod.default) || mod
23968
+ return _arr;
23969
+ }
23970
+ function _non_iterable_rest$f() {
23971
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
23972
+ }
23973
+ function _sliced_to_array$f(arr, i) {
23974
+ return _array_with_holes$f(arr) || _iterable_to_array_limit$f(arr, i) || _unsupported_iterable_to_array$i(arr, i) || _non_iterable_rest$f();
23975
+ }
23976
+ function _unsupported_iterable_to_array$i(o, minLen) {
23977
+ if (!o) return;
23978
+ if (typeof o === "string") return _array_like_to_array$i(o, minLen);
23979
+ var n = Object.prototype.toString.call(o).slice(8, -1);
23980
+ if (n === "Object" && o.constructor) n = o.constructor.name;
23981
+ if (n === "Map" || n === "Set") return Array.from(n);
23982
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$i(o, minLen);
23983
+ }
23984
+ var SingleDatePicker = function(param) {
23985
+ var disable = param.disable, onChange = param.onChange;
23986
+ var _useState = _sliced_to_array$f(useState(), 2), date = _useState[0], setDate = _useState[1];
23987
+ var handleDate = function(newDate) {
23988
+ if (newDate) {
23989
+ setDate(newDate);
23990
+ if (onChange) onChange(newDate);
23991
+ }
24071
23992
  };
23993
+ return /*#__PURE__*/ jsx("div", {
23994
+ className: cn(disable ? "pointer-events-none opacity-55" : "pointer-events-auto opacity-100"),
23995
+ children: /*#__PURE__*/ jsxs(Popover, {
23996
+ children: [
23997
+ /*#__PURE__*/ jsx(PopoverTrigger, {
23998
+ asChild: true,
23999
+ children: /*#__PURE__*/ jsxs(Button, {
24000
+ variant: "outline",
24001
+ className: cn("w-[280px] justify-start text-left font-normal", !date && "text-muted-foreground"),
24002
+ children: [
24003
+ /*#__PURE__*/ jsx(Calendar$3, {
24004
+ className: "mr-2 h-4 w-4"
24005
+ }),
24006
+ date ? format(date, "yyyy-MM-dd") : /*#__PURE__*/ jsx("span", {
24007
+ children: "請選擇日期"
24008
+ })
24009
+ ]
24010
+ })
24011
+ }),
24012
+ /*#__PURE__*/ jsx(PopoverContent, {
24013
+ className: "w-auto p-0",
24014
+ children: /*#__PURE__*/ jsx(Calendar$2, {
24015
+ mode: "single",
24016
+ selected: date,
24017
+ onSelect: handleDate,
24018
+ initialFocus: true
24019
+ })
24020
+ })
24021
+ ]
24022
+ })
24023
+ });
24024
+ };
24025
+
24026
+ function _array_like_to_array$h(arr, len) {
24027
+ if (len == null || len > arr.length) len = arr.length;
24028
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
24029
+ return arr2;
24072
24030
  }
24073
- function noSSR(LoadableInitializer, loadableOptions) {
24074
- // Removing webpack and modules means react-loadable won't try preloading
24075
- delete loadableOptions.webpack;
24076
- delete loadableOptions.modules;
24077
- // This check is necessary to prevent react-loadable from initializing on the server
24078
- if (!isServerSide) {
24079
- return LoadableInitializer(loadableOptions);
24031
+ function _array_with_holes$e(arr) {
24032
+ if (Array.isArray(arr)) return arr;
24033
+ }
24034
+ function _iterable_to_array_limit$e(arr, i) {
24035
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
24036
+ if (_i == null) return;
24037
+ var _arr = [];
24038
+ var _n = true;
24039
+ var _d = false;
24040
+ var _s, _e;
24041
+ try {
24042
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
24043
+ _arr.push(_s.value);
24044
+ if (i && _arr.length === i) break;
24045
+ }
24046
+ } catch (err) {
24047
+ _d = true;
24048
+ _e = err;
24049
+ } finally{
24050
+ try {
24051
+ if (!_n && _i["return"] != null) _i["return"]();
24052
+ } finally{
24053
+ if (_d) throw _e;
24054
+ }
24080
24055
  }
24081
- var Loading = loadableOptions.loading;
24082
- // This will only be rendered on the server side
24083
- return function() {
24084
- return /*#__PURE__*/ _react.default.createElement(Loading, {
24085
- error: null,
24086
- isLoading: true,
24087
- pastDelay: false,
24088
- timedOut: false
24089
- });
24090
- };
24056
+ return _arr;
24091
24057
  }
24092
- function dynamic(dynamicOptions, options) {
24093
- var loadableFn = _loadablesharedruntime.default;
24094
- var loadableOptions = {
24095
- // A loading component is not required, so we default it
24096
- loading: function(param) {
24097
- var error = param.error, isLoading = param.isLoading, pastDelay = param.pastDelay;
24098
- if (!pastDelay) return null;
24099
- if (process.env.NODE_ENV !== "production") {
24100
- if (isLoading) {
24101
- return null;
24102
- }
24103
- if (error) {
24104
- return /*#__PURE__*/ _react.default.createElement("p", null, error.message, /*#__PURE__*/ _react.default.createElement("br", null), error.stack);
24105
- }
24106
- }
24107
- return null;
24058
+ function _non_iterable_rest$e() {
24059
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
24060
+ }
24061
+ function _sliced_to_array$e(arr, i) {
24062
+ return _array_with_holes$e(arr) || _iterable_to_array_limit$e(arr, i) || _unsupported_iterable_to_array$h(arr, i) || _non_iterable_rest$e();
24063
+ }
24064
+ function _unsupported_iterable_to_array$h(o, minLen) {
24065
+ if (!o) return;
24066
+ if (typeof o === "string") return _array_like_to_array$h(o, minLen);
24067
+ var n = Object.prototype.toString.call(o).slice(8, -1);
24068
+ if (n === "Object" && o.constructor) n = o.constructor.name;
24069
+ if (n === "Map" || n === "Set") return Array.from(n);
24070
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$h(o, minLen);
24071
+ }
24072
+ var ReactDateRange = function(param) {
24073
+ var className = param.className, item = param.item, onChange = param.onChange, dates = param.dates, date = param.date;
24074
+ var _useState = _sliced_to_array$e(useState("zhTW"), 1), locale = _useState[0];
24075
+ var _useState1 = _sliced_to_array$e(useState(""), 2), calendarData = _useState1[0], setCalendarData = _useState1[1];
24076
+ var _useState2 = _sliced_to_array$e(useState({
24077
+ startDate: new Date(),
24078
+ endDate: addDays(new Date(), 7),
24079
+ key: "selection"
24080
+ }), 2), range = _useState2[0], setRange = _useState2[1];
24081
+ var _useState3 = _sliced_to_array$e(useState(false), 2), open = _useState3[0], setOpen = _useState3[1];
24082
+ var refOne = useRef(null);
24083
+ var hideOnEscape = function(e) {
24084
+ if (e.key === "Escape") {
24085
+ setOpen(false);
24108
24086
  }
24109
24087
  };
24110
- // Support for direct import(), eg: dynamic(import('../hello-world'))
24111
- // Note that this is only kept for the edge case where someone is passing in a promise as first argument
24112
- // The react-loadable babel plugin will turn dynamic(import('../hello-world')) into dynamic(() => import('../hello-world'))
24113
- // To make sure we don't execute the import without rendering first
24114
- if (_instanceof(dynamicOptions, Promise)) {
24115
- loadableOptions.loader = function() {
24116
- return dynamicOptions;
24088
+ var hideOnClickOutside = function(e) {
24089
+ if (refOne.current && !refOne.current.contains(e.target)) {
24090
+ setOpen(false);
24091
+ }
24092
+ };
24093
+ useEffect(function() {
24094
+ setCalendarData(date);
24095
+ }, [
24096
+ date
24097
+ ]);
24098
+ useEffect(function() {
24099
+ if (!dates) return;
24100
+ setRange(dates);
24101
+ }, [
24102
+ dates
24103
+ ]);
24104
+ useEffect(function() {
24105
+ document.addEventListener("keydown", hideOnEscape, true);
24106
+ document.addEventListener("click", hideOnClickOutside, true);
24107
+ return function() {
24108
+ document.removeEventListener("keydown", hideOnEscape, true);
24109
+ document.removeEventListener("click", hideOnClickOutside, true);
24117
24110
  };
24118
- // Support for having import as a function, eg: dynamic(() => import('../hello-world'))
24119
- } else if (typeof dynamicOptions === "function") {
24120
- loadableOptions.loader = dynamicOptions;
24121
- // Support for having first argument being options, eg: dynamic({loader: import('../hello-world')})
24122
- } else if (typeof dynamicOptions === "object") {
24123
- loadableOptions = _object_spread({}, loadableOptions, dynamicOptions);
24124
- }
24125
- // Support for passing options, eg: dynamic(import('../hello-world'), {loading: () => <p>Loading something</p>})
24126
- loadableOptions = _object_spread({}, loadableOptions, options);
24127
- var loaderFn = loadableOptions.loader;
24128
- var loader = function() {
24129
- return loaderFn != null ? loaderFn().then(convertModule) : Promise.resolve(convertModule(function() {
24130
- return null;
24131
- }));
24111
+ }, []);
24112
+ var formatDates = function() {
24113
+ if (!range) return;
24114
+ var startDate = range.startDate, endDate = range.endDate;
24115
+ return "".concat(format$1(startDate, "yyyy-MM-dd"), " ~ ").concat(format$1(endDate, "yyyy-MM-dd"));
24132
24116
  };
24133
- // coming from build/babel/plugins/react-loadable-plugin.js
24134
- if (loadableOptions.loadableGenerated) {
24135
- loadableOptions = _object_spread({}, loadableOptions, loadableOptions.loadableGenerated);
24136
- delete loadableOptions.loadableGenerated;
24137
- }
24138
- // support for disabling server side rendering, eg: dynamic(() => import('../hello-world'), {ssr: false}).
24139
- if (typeof loadableOptions.ssr === "boolean" && !loadableOptions.ssr) {
24140
- delete loadableOptions.webpack;
24141
- delete loadableOptions.modules;
24142
- return noSSR(loadableFn, loadableOptions);
24143
- }
24144
- return loadableFn(_object_spread_props(_object_spread({}, loadableOptions), {
24145
- loader: loader
24146
- }));
24147
- }
24148
- if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
24149
- Object.defineProperty(exports.default, "__esModule", {
24150
- value: true
24117
+ var formatDate = calendarData ? format$1(calendarData, (item === null || item === void 0 ? void 0 : item.dateDisplayFormat) || "yyyy-MM-dd") : "";
24118
+ return /*#__PURE__*/ jsxs("div", {
24119
+ className: [
24120
+ className,
24121
+ "relative"
24122
+ ].join(" "),
24123
+ children: [
24124
+ (item === null || item === void 0 ? void 0 : item.label) && /*#__PURE__*/ jsx("div", {
24125
+ className: "text-gray-700 font-medium mb-2 h-6",
24126
+ children: item === null || item === void 0 ? void 0 : item.label
24127
+ }),
24128
+ /*#__PURE__*/ jsx("input", {
24129
+ className: "border-solid border rounded p-2 h-10 w-full timePicker border-gray-300",
24130
+ name: item === null || item === void 0 ? void 0 : item.name,
24131
+ onClick: function() {
24132
+ return setOpen(function(openState) {
24133
+ return !openState;
24134
+ });
24135
+ },
24136
+ placeholder: item === null || item === void 0 ? void 0 : item.placeholder,
24137
+ value: (item === null || item === void 0 ? void 0 : item.type) === "date" ? formatDate : formatDates(),
24138
+ autoComplete: "off"
24139
+ }),
24140
+ open && /*#__PURE__*/ jsxs("div", {
24141
+ className: "absolute top-[72px] left-0 z-50 shadow-md",
24142
+ ref: refOne,
24143
+ children: [
24144
+ open && (item === null || item === void 0 ? void 0 : item.type) === "date" && /*#__PURE__*/ jsx(Calendar$4, {
24145
+ data: calendarData,
24146
+ locale: locales[locale],
24147
+ dateDisplayFormat: item === null || item === void 0 ? void 0 : item.dateDisplayFormat,
24148
+ onChange: function(value) {
24149
+ setCalendarData(value);
24150
+ if (onChange) onChange(value);
24151
+ setOpen(false);
24152
+ }
24153
+ }),
24154
+ open && (item === null || item === void 0 ? void 0 : item.type) === "dateRange" && /*#__PURE__*/ jsx(DateRange, {
24155
+ editableDateInputs: true,
24156
+ onChange: function(value) {
24157
+ setRange(value.selection);
24158
+ if (onChange) onChange(value.selection);
24159
+ },
24160
+ ranges: [
24161
+ range
24162
+ ],
24163
+ locale: locales[locale],
24164
+ dateDisplayFormat: "yyyy.MM.dd"
24165
+ })
24166
+ ]
24167
+ })
24168
+ ]
24151
24169
  });
24152
- Object.assign(exports.default, exports);
24153
- module.exports = exports.default;
24154
- }
24155
- }(dynamic$1, dynamic$1.exports));
24156
-
24157
- var dynamic = dynamic$1.exports;
24170
+ };
24158
24171
 
24159
24172
  function _arrayWithHoles(r) {
24160
24173
  if (Array.isArray(r)) return r;
@@ -48860,6 +48873,7 @@ var Form = {
48860
48873
  Row: Row,
48861
48874
  TextField: TextField,
48862
48875
  SingleSelect: SingleSelect,
48876
+ BaseSelect: BaseSelect,
48863
48877
  MultipleSelect: MultipleSelect,
48864
48878
  FieldLabel: FieldLabel,
48865
48879
  RadioField: RadioField,
@@ -78782,4 +78796,4 @@ var useLiffContext = function() {
78782
78796
  return context;
78783
78797
  };
78784
78798
 
78785
- export { CustomUploadField as $, verifyId as A, BaseSwitch as B, Controller$2 as C, DropImage as D, verifyTaxId as E, FieldLabel as F, BigCalender as G, DnDCalendar as H, InputOTPs as I, CustomSelect as J, LiffProvider as K, LiffContext as L, useLiffContext as M, FormProvider as N, useForm as O, useController as P, useFieldArray as Q, ReactDateRange as R, Spin as S, TabsPanel as T, UiLibrary as U, useFormState as V, useWatch as W, City as X, Textarea as Y, Fields as Z, __spreadArray as _, __read as a, Row as a0, Form as a1, __extends as b, __assign as c, __makeTemplateObject as d, __awaiter as e, __generator as f, commonjsGlobal as g, __values as h, getAugmentedNamespace as i, getDefaultExportFromCjs as j, DropDown as k, CustomUpload$1 as l, Switch as m, DateRangePicker as n, SingleDatePicker as o, propTypes$1 as p, Button as q, buttonVariants as r, StackCards as s, DataTable as t, useFormContext as u, validateMsg as v, BaseTable as w, Drawer as x, Regex as y, verifyTaiwanIdIntermediateString as z };
78799
+ export { Fields as $, verifyTaiwanIdIntermediateString as A, BaseSwitch as B, Controller$2 as C, DropImage as D, verifyId as E, FieldLabel as F, verifyTaxId as G, BigCalender as H, InputOTPs as I, DnDCalendar as J, CustomSelect as K, LiffContext as L, LiffProvider as M, useLiffContext as N, FormProvider as O, useForm as P, useController as Q, ReactDateRange as R, Spin as S, TabsPanel as T, UiLibrary as U, useFieldArray as V, useFormState as W, useWatch as X, City as Y, Textarea as Z, __spreadArray as _, __read as a, CustomUploadField as a0, Row as a1, Form as a2, __extends as b, __assign as c, __makeTemplateObject as d, __awaiter as e, __generator as f, commonjsGlobal as g, __values as h, getAugmentedNamespace as i, getDefaultExportFromCjs as j, CSRDropImage as k, DropDown as l, CustomUpload$1 as m, Switch as n, DateRangePicker as o, propTypes$1 as p, SingleDatePicker as q, Button as r, buttonVariants as s, StackCards as t, useFormContext as u, validateMsg as v, DataTable as w, BaseTable as x, Drawer as y, Regex as z };