@ews-admin/global-design-system 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/components/Input/Input.d.ts +4 -0
  2. package/dist/components/Input/Input.d.ts.map +1 -1
  3. package/dist/components/Logo/Logo.d.ts +1 -1
  4. package/dist/components/Logo/Logo.d.ts.map +1 -1
  5. package/dist/components/MultiSearchAutocomplete/MultiSearchAutocomplete.d.ts +1 -1
  6. package/dist/components/MultiSearchAutocomplete/MultiSearchAutocomplete.d.ts.map +1 -1
  7. package/dist/components/Select/Select.d.ts +91 -0
  8. package/dist/components/Select/Select.d.ts.map +1 -0
  9. package/dist/components/Select/index.d.ts +3 -0
  10. package/dist/components/Select/index.d.ts.map +1 -0
  11. package/dist/components/ThemeDebugger/ThemeDebugger.d.ts +6 -0
  12. package/dist/components/ThemeDebugger/ThemeDebugger.d.ts.map +1 -0
  13. package/dist/components/ThemeDebugger/index.d.ts +3 -0
  14. package/dist/components/ThemeDebugger/index.d.ts.map +1 -0
  15. package/dist/hooks/index.d.ts +2 -0
  16. package/dist/hooks/index.d.ts.map +1 -1
  17. package/dist/hooks/useSelectField.d.ts +16 -0
  18. package/dist/hooks/useSelectField.d.ts.map +1 -0
  19. package/dist/icons/ArrowRightIcon.d.ts +4 -0
  20. package/dist/icons/ArrowRightIcon.d.ts.map +1 -0
  21. package/dist/icons/CheckIcon.d.ts +4 -0
  22. package/dist/icons/CheckIcon.d.ts.map +1 -0
  23. package/dist/icons/EyeIcon.d.ts +4 -0
  24. package/dist/icons/EyeIcon.d.ts.map +1 -0
  25. package/dist/icons/EyeOffIcon.d.ts +4 -0
  26. package/dist/icons/EyeOffIcon.d.ts.map +1 -0
  27. package/dist/icons/SearchIcon.d.ts +4 -0
  28. package/dist/icons/SearchIcon.d.ts.map +1 -0
  29. package/dist/index.css +2 -2
  30. package/dist/index.d.ts +118 -4
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.esm.css +2 -2
  33. package/dist/index.esm.js +763 -10
  34. package/dist/index.esm.js.map +1 -1
  35. package/dist/index.js +764 -8
  36. package/dist/index.js.map +1 -1
  37. package/package.json +7 -6
  38. package/src/components/Input/Input.tsx +10 -4
  39. package/src/components/Logo/Logo.tsx +1 -1
  40. package/src/components/MultiSearchAutocomplete/MultiSearchAutocomplete.tsx +1 -1
  41. package/src/components/Select/Select.tsx +553 -0
  42. package/src/components/Select/index.ts +2 -0
  43. package/src/components/ThemeDebugger/ThemeDebugger.tsx +101 -0
  44. package/src/components/ThemeDebugger/index.ts +2 -0
  45. package/src/hooks/index.ts +2 -0
  46. package/src/hooks/useSelectField.ts +53 -0
  47. package/src/index.ts +8 -1
  48. package/src/styles/index.css +49 -0
package/dist/index.js CHANGED
@@ -207,11 +207,11 @@ const createLucideIcon = (iconName, iconNode) => {
207
207
  */
208
208
 
209
209
 
210
- const __iconNode$b = [
210
+ const __iconNode$c = [
211
211
  ["path", { d: "M5 12h14", key: "1ays0h" }],
212
212
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
213
213
  ];
214
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$b);
214
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$c);
215
215
 
216
216
  /**
217
217
  * @license lucide-react v0.544.0 - ISC
@@ -221,8 +221,19 @@ const ArrowRight = createLucideIcon("arrow-right", __iconNode$b);
221
221
  */
222
222
 
223
223
 
224
- const __iconNode$a = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
225
- const Check = createLucideIcon("check", __iconNode$a);
224
+ const __iconNode$b = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
225
+ const Check = createLucideIcon("check", __iconNode$b);
226
+
227
+ /**
228
+ * @license lucide-react v0.544.0 - ISC
229
+ *
230
+ * This source code is licensed under the ISC license.
231
+ * See the LICENSE file in the root directory of this source tree.
232
+ */
233
+
234
+
235
+ const __iconNode$a = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
236
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$a);
226
237
 
227
238
  /**
228
239
  * @license lucide-react v0.544.0 - ISC
@@ -424,7 +435,7 @@ const UserIcon = ({ size = 24, color = "currentColor", className = "", ...props
424
435
  return jsxRuntime.jsx(User, { size: size, color: color, className: className, ...props });
425
436
  };
426
437
 
427
- const Input = React.forwardRef(({ className, variant = "default", size = "md", label, helperText, error, leftIcon, rightIcon, fullWidth = false, showPasswordToggle = false, id, type = "text", ...props }, ref) => {
438
+ const Input = React.forwardRef(({ className, variant = "default", size = "md", label, helperText, error, leftIcon, rightIcon, fullWidth = false, showPasswordToggle = false, required = false, id, type = "text", ...props }, ref) => {
428
439
  const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
429
440
  const hasError = Boolean(error);
430
441
  const actualVariant = hasError ? "error" : variant;
@@ -449,10 +460,237 @@ const Input = React.forwardRef(({ className, variant = "default", size = "md", l
449
460
  md: "h-5 w-5",
450
461
  lg: "h-6 w-6",
451
462
  };
452
- return (jsxRuntime.jsxs("div", { className: cn("space-y-1", fullWidth ? "w-full" : "w-auto"), children: [label && (jsxRuntime.jsx("label", { htmlFor: inputId, className: "block text-sm font-medium text-ews-gray-700", children: label })), jsxRuntime.jsxs("div", { className: "relative", children: [leftIcon && (jsxRuntime.jsx("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none", children: jsxRuntime.jsx("span", { className: cn("text-ews-gray-400", iconSizes[size]), children: leftIcon }) })), jsxRuntime.jsx("input", { id: inputId, type: actualType, className: cn(baseStyles, variants[actualVariant], sizes[size], leftIcon && "pl-10", (rightIcon || shouldShowPasswordToggle) && "pr-10", className), ref: ref, ...props }), rightIcon && !shouldShowPasswordToggle && (jsxRuntime.jsx("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none", children: jsxRuntime.jsx("span", { className: cn("text-ews-gray-400", iconSizes[size]), children: rightIcon }) })), shouldShowPasswordToggle && (jsxRuntime.jsx("button", { type: "button", className: "absolute inset-y-0 right-0 pr-3 flex items-center", onClick: () => setShowPassword(!showPassword), tabIndex: -1, children: jsxRuntime.jsx("span", { className: cn("text-ews-gray-400 hover:text-ews-gray-600 transition-colors", iconSizes[size]), children: showPassword ? jsxRuntime.jsx(EyeOff, { size: 16 }) : jsxRuntime.jsx(Eye, { size: 16 }) }) }))] }), (error || helperText) && (jsxRuntime.jsx("p", { className: cn("text-sm", error ? "text-ews-error" : "text-ews-gray-500"), children: error || helperText }))] }));
463
+ return (jsxRuntime.jsxs("div", { className: cn("space-y-1", fullWidth ? "w-full" : "w-auto"), children: [label && (jsxRuntime.jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium text-ews-gray-700", children: [label, required && jsxRuntime.jsx("span", { className: "ml-1 text-ews-error", children: "*" })] })), jsxRuntime.jsxs("div", { className: "relative", children: [leftIcon && (jsxRuntime.jsx("div", { className: "flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none", children: jsxRuntime.jsx("span", { className: cn("text-ews-gray-400", iconSizes[size]), children: leftIcon }) })), jsxRuntime.jsx("input", { id: inputId, type: actualType, className: cn(baseStyles, variants[actualVariant], sizes[size], leftIcon && "pl-10", (rightIcon || shouldShowPasswordToggle) && "pr-10", className), ref: ref, ...props }), rightIcon && !shouldShowPasswordToggle && (jsxRuntime.jsx("div", { className: "flex absolute inset-y-0 right-0 items-center pr-3 pointer-events-none", children: jsxRuntime.jsx("span", { className: cn("text-ews-gray-400", iconSizes[size]), children: rightIcon }) })), shouldShowPasswordToggle && (jsxRuntime.jsx("button", { type: "button", className: "flex absolute inset-y-0 right-0 items-center pr-3", onClick: () => setShowPassword(!showPassword), tabIndex: -1, children: jsxRuntime.jsx("span", { className: cn("transition-colors text-ews-gray-400 hover:text-ews-gray-600", iconSizes[size]), children: showPassword ? jsxRuntime.jsx(EyeOff, { size: 16 }) : jsxRuntime.jsx(Eye, { size: 16 }) }) }))] }), (error || helperText) && (jsxRuntime.jsx("p", { className: cn("text-sm", error ? "text-ews-error" : "text-ews-gray-500"), children: error || helperText }))] }));
453
464
  });
454
465
  Input.displayName = "Input";
455
466
 
467
+ const Select = React.forwardRef(({ options = [], value, onChange, placeholder = "Select an option...", label, helperText, error, isError = false, size = "md", disabled = false, required = false, searchable = false, multiple: _multiple = false, selectClassName, containerClassName, dropdownClassName, maxHeight = 200, clearable = false, renderOption, renderValue, ...props }, ref) => {
468
+ const generatedId = React.useId();
469
+ const selectId = `select-${generatedId}`;
470
+ const hasError = isError || !!error;
471
+ const [isOpen, setIsOpen] = React.useState(false);
472
+ const [searchTerm, setSearchTerm] = React.useState("");
473
+ const [focusedIndex, setFocusedIndex] = React.useState(-1);
474
+ const [dropdownPosition, setDropdownPosition] = React.useState("bottom");
475
+ const containerRef = React.useRef(null);
476
+ const inputRef = React.useRef(null);
477
+ const dropdownRef = React.useRef(null);
478
+ const optionRefs = React.useRef([]);
479
+ // Find selected option
480
+ const selectedOption = options.find((option) => option.value === value);
481
+ // Filter options based on search term
482
+ const filteredOptions = searchable
483
+ ? options.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()))
484
+ : options;
485
+ // Calculate dropdown position based on available space
486
+ const calculateDropdownPosition = () => {
487
+ if (!containerRef.current)
488
+ return;
489
+ const containerRect = containerRef.current.getBoundingClientRect();
490
+ const viewportHeight = window.innerHeight;
491
+ // More accurate height calculation
492
+ const optionHeight = 40; // Approximate height per option
493
+ const searchHeight = searchable ? 60 : 0;
494
+ const padding = 16; // py-1 = 8px top + 8px bottom
495
+ const dropdownHeight = Math.min(maxHeight, filteredOptions.length * optionHeight + searchHeight + padding);
496
+ const spaceBelow = viewportHeight - containerRect.bottom;
497
+ const spaceAbove = containerRect.top;
498
+ // Add some buffer (20px) to prevent edge cases
499
+ const buffer = 20;
500
+ console.log("Position calculation:", {
501
+ spaceBelow,
502
+ spaceAbove,
503
+ dropdownHeight,
504
+ viewportHeight,
505
+ containerBottom: containerRect.bottom,
506
+ shouldOpenTop: spaceBelow < dropdownHeight + buffer &&
507
+ spaceAbove > dropdownHeight + buffer,
508
+ });
509
+ // If there's not enough space below but enough space above, position on top
510
+ if (spaceBelow < dropdownHeight + buffer &&
511
+ spaceAbove > dropdownHeight + buffer) {
512
+ setDropdownPosition("top");
513
+ }
514
+ else {
515
+ setDropdownPosition("bottom");
516
+ }
517
+ };
518
+ // Alternative calculation using actual dropdown element when available
519
+ const calculateDropdownPositionWithElement = () => {
520
+ if (!containerRef.current || !dropdownRef.current)
521
+ return;
522
+ const containerRect = containerRef.current.getBoundingClientRect();
523
+ const dropdownRect = dropdownRef.current.getBoundingClientRect();
524
+ const viewportHeight = window.innerHeight;
525
+ const spaceBelow = viewportHeight - containerRect.bottom;
526
+ const spaceAbove = containerRect.top;
527
+ const actualDropdownHeight = dropdownRect.height;
528
+ console.log("Position calculation with element:", {
529
+ spaceBelow,
530
+ spaceAbove,
531
+ actualDropdownHeight,
532
+ viewportHeight,
533
+ containerBottom: containerRect.bottom,
534
+ });
535
+ // If there's not enough space below but enough space above, position on top
536
+ if (spaceBelow < actualDropdownHeight &&
537
+ spaceAbove > actualDropdownHeight) {
538
+ setDropdownPosition("top");
539
+ }
540
+ else {
541
+ setDropdownPosition("bottom");
542
+ }
543
+ };
544
+ // Handle click outside
545
+ React.useEffect(() => {
546
+ const handleClickOutside = (event) => {
547
+ if (containerRef.current &&
548
+ !containerRef.current.contains(event.target)) {
549
+ setIsOpen(false);
550
+ setSearchTerm("");
551
+ setFocusedIndex(-1);
552
+ }
553
+ };
554
+ document.addEventListener("mousedown", handleClickOutside);
555
+ return () => document.removeEventListener("mousedown", handleClickOutside);
556
+ }, []);
557
+ // Calculate position when dropdown opens
558
+ React.useEffect(() => {
559
+ if (isOpen) {
560
+ // First calculation based on estimated height
561
+ calculateDropdownPosition();
562
+ // Second calculation after dropdown is rendered with actual height
563
+ requestAnimationFrame(() => {
564
+ calculateDropdownPositionWithElement();
565
+ });
566
+ }
567
+ }, [isOpen, filteredOptions.length, searchable, maxHeight]);
568
+ // Recalculate position on window resize
569
+ React.useEffect(() => {
570
+ const handleResize = () => {
571
+ if (isOpen) {
572
+ calculateDropdownPosition();
573
+ }
574
+ };
575
+ window.addEventListener("resize", handleResize);
576
+ window.addEventListener("scroll", handleResize);
577
+ return () => {
578
+ window.removeEventListener("resize", handleResize);
579
+ window.removeEventListener("scroll", handleResize);
580
+ };
581
+ }, [isOpen]);
582
+ // Handle keyboard navigation
583
+ const handleKeyDown = (event) => {
584
+ if (disabled)
585
+ return;
586
+ switch (event.key) {
587
+ case "ArrowDown":
588
+ event.preventDefault();
589
+ if (!isOpen) {
590
+ setIsOpen(true);
591
+ }
592
+ else {
593
+ setFocusedIndex((prev) => prev < filteredOptions.length - 1 ? prev + 1 : 0);
594
+ }
595
+ break;
596
+ case "ArrowUp":
597
+ event.preventDefault();
598
+ if (!isOpen) {
599
+ setIsOpen(true);
600
+ }
601
+ else {
602
+ setFocusedIndex((prev) => prev > 0 ? prev - 1 : filteredOptions.length - 1);
603
+ }
604
+ break;
605
+ case "Enter":
606
+ event.preventDefault();
607
+ if (isOpen &&
608
+ focusedIndex >= 0 &&
609
+ focusedIndex < filteredOptions.length) {
610
+ handleSelect(filteredOptions[focusedIndex]);
611
+ }
612
+ else if (!isOpen) {
613
+ setIsOpen(true);
614
+ }
615
+ break;
616
+ case "Escape":
617
+ event.preventDefault();
618
+ setIsOpen(false);
619
+ setSearchTerm("");
620
+ setFocusedIndex(-1);
621
+ break;
622
+ case "Tab":
623
+ setIsOpen(false);
624
+ setSearchTerm("");
625
+ setFocusedIndex(-1);
626
+ break;
627
+ }
628
+ };
629
+ // Handle option selection
630
+ const handleSelect = (option) => {
631
+ if (option.disabled)
632
+ return;
633
+ onChange?.(option.value, option);
634
+ setIsOpen(false);
635
+ setSearchTerm("");
636
+ setFocusedIndex(-1);
637
+ };
638
+ // Handle clear
639
+ const handleClear = (event) => {
640
+ event.stopPropagation();
641
+ onChange?.(undefined, {});
642
+ };
643
+ // Handle toggle
644
+ const handleToggle = () => {
645
+ if (disabled)
646
+ return;
647
+ setIsOpen(!isOpen);
648
+ if (!isOpen && searchable) {
649
+ setTimeout(() => inputRef.current?.focus(), 0);
650
+ }
651
+ };
652
+ // Scroll focused option into view
653
+ React.useEffect(() => {
654
+ if (focusedIndex >= 0 && optionRefs.current[focusedIndex]) {
655
+ optionRefs.current[focusedIndex]?.scrollIntoView({
656
+ block: "nearest",
657
+ });
658
+ }
659
+ }, [focusedIndex]);
660
+ const sizeClasses = {
661
+ sm: "text-sm px-3 py-1.5",
662
+ md: "text-sm px-3 py-2",
663
+ lg: "text-base px-4 py-2.5",
664
+ };
665
+ const iconSizeClasses = {
666
+ sm: "w-4 h-4",
667
+ md: "w-4 h-4",
668
+ lg: "w-5 h-5",
669
+ };
670
+ return (jsxRuntime.jsxs("div", { className: cn("w-full", containerClassName), ref: containerRef, children: [label && (jsxRuntime.jsxs("label", { htmlFor: selectId, className: cn("block text-sm font-medium mb-1", hasError ? "text-ews-error" : "text-ews-gray-700", disabled && "text-ews-gray-400"), children: [label, required && jsxRuntime.jsx("span", { className: "ml-1 text-ews-error", children: "*" })] })), jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx("div", { ref: ref, role: "combobox", "aria-expanded": isOpen, "aria-haspopup": "listbox", "aria-labelledby": label ? selectId : undefined, tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown, onClick: handleToggle, className: cn(
671
+ // Base styles
672
+ "ews-select-trigger w-full bg-white border rounded-md shadow-sm transition-colors cursor-pointer", "focus:outline-none focus:ring-2 focus:ring-offset-0", "disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-ews-gray-50",
673
+ // Size
674
+ sizeClasses[size],
675
+ // Border and focus states
676
+ hasError
677
+ ? "border-ews-error focus:border-ews-error focus:ring-ews-error/20"
678
+ : "border-ews-gray-300 focus:border-ews-primary focus:ring-ews-primary/20",
679
+ // Hover state
680
+ !disabled && !hasError && "hover:border-ews-gray-400",
681
+ // Text color
682
+ "text-ews-gray-900",
683
+ // Padding for icons
684
+ "pr-10", selectClassName), ...props, children: jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [jsxRuntime.jsx("div", { className: "flex-1 min-w-0", children: selectedOption ? (renderValue ? (renderValue(selectedOption)) : (jsxRuntime.jsx("span", { className: "truncate", children: selectedOption.label }))) : (jsxRuntime.jsx("span", { className: "text-ews-gray-500", children: placeholder })) }), jsxRuntime.jsxs("div", { className: "flex items-center ml-2 space-x-1", children: [clearable && selectedOption && !disabled && (jsxRuntime.jsx("button", { type: "button", onClick: handleClear, className: "p-1 rounded hover:bg-ews-gray-100", children: jsxRuntime.jsx(X, { className: cn(iconSizeClasses[size], "text-ews-gray-400") }) })), jsxRuntime.jsx(ChevronDown, { className: cn(iconSizeClasses[size], hasError ? "text-ews-error" : "text-ews-gray-400", disabled && "text-ews-gray-300", isOpen && "rotate-180 transition-transform") })] })] }) }), isOpen && (jsxRuntime.jsxs("div", { ref: dropdownRef, role: "listbox", className: cn("absolute z-50 w-full bg-white rounded-md border shadow-lg border-ews-gray-300", "focus:outline-none", dropdownPosition === "top"
685
+ ? "bottom-full mb-1"
686
+ : "top-full mt-1", dropdownClassName), style: { maxHeight: `${maxHeight}px` }, children: [searchable && (jsxRuntime.jsx("div", { className: "p-2 border-b border-ews-gray-200", children: jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(Search, { className: "absolute left-3 top-1/2 w-4 h-4 transform -translate-y-1/2 text-ews-gray-400" }), jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), placeholder: "Search options...", className: "py-2 pr-3 pl-9 w-full text-sm rounded-md border border-ews-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-0 focus:ring-ews-primary/20 focus:border-ews-primary" })] }) })), jsxRuntime.jsx("div", { className: "overflow-auto py-1", style: { maxHeight: `${maxHeight - (searchable ? 60 : 0)}px` }, children: filteredOptions.length === 0 ? (jsxRuntime.jsx("div", { className: "px-3 py-2 text-sm text-ews-gray-500", children: searchTerm ? "No options found" : "No options available" })) : (filteredOptions.map((option, index) => {
687
+ const isSelected = option.value === value;
688
+ const isFocused = index === focusedIndex;
689
+ return (jsxRuntime.jsx("div", { ref: (el) => (optionRefs.current[index] = el), role: "option", "aria-selected": isSelected, onClick: () => handleSelect(option), className: cn("px-3 py-2 text-sm cursor-pointer transition-colors", isSelected && "bg-ews-primary text-white", !isSelected && isFocused && "bg-ews-gray-100", !isSelected && !isFocused && "hover:bg-ews-gray-50", option.disabled && "opacity-50 cursor-not-allowed"), children: renderOption ? (renderOption(option, isSelected)) : (jsxRuntime.jsx("span", { className: "truncate", children: option.label })) }, `${String(option.value)}-${index}`));
690
+ })) })] }))] }), (helperText || error) && (jsxRuntime.jsx("div", { className: "mt-1", children: error ? (jsxRuntime.jsx("p", { className: "text-sm text-ews-error", children: error })) : (jsxRuntime.jsx("p", { className: "text-sm text-ews-gray-500", children: helperText })) }))] }));
691
+ });
692
+ Select.displayName = "Select";
693
+
456
694
  const DEFAULT_DELAY = 500;
457
695
  /**
458
696
  * A custom hook that debounces a value
@@ -501,6 +739,506 @@ function useDebouncedCallback(callback, delay) {
501
739
  return debouncedCallback;
502
740
  }
503
741
 
742
+ var isCheckBoxInput = (element) => element.type === 'checkbox';
743
+
744
+ var isDateObject = (value) => value instanceof Date;
745
+
746
+ var isNullOrUndefined = (value) => value == null;
747
+
748
+ const isObjectType = (value) => typeof value === 'object';
749
+ var isObject = (value) => !isNullOrUndefined(value) &&
750
+ !Array.isArray(value) &&
751
+ isObjectType(value) &&
752
+ !isDateObject(value);
753
+
754
+ var getEventValue = (event) => isObject(event) && event.target
755
+ ? isCheckBoxInput(event.target)
756
+ ? event.target.checked
757
+ : event.target.value
758
+ : event;
759
+
760
+ var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
761
+
762
+ var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
763
+
764
+ var isPlainObject = (tempObject) => {
765
+ const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
766
+ return (isObject(prototypeCopy) && prototypeCopy.hasOwnProperty('isPrototypeOf'));
767
+ };
768
+
769
+ var isWeb = typeof window !== 'undefined' &&
770
+ typeof window.HTMLElement !== 'undefined' &&
771
+ typeof document !== 'undefined';
772
+
773
+ function cloneObject(data) {
774
+ let copy;
775
+ const isArray = Array.isArray(data);
776
+ const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
777
+ if (data instanceof Date) {
778
+ copy = new Date(data);
779
+ }
780
+ else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
781
+ (isArray || isObject(data))) {
782
+ copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));
783
+ if (!isArray && !isPlainObject(data)) {
784
+ copy = data;
785
+ }
786
+ else {
787
+ for (const key in data) {
788
+ if (data.hasOwnProperty(key)) {
789
+ copy[key] = cloneObject(data[key]);
790
+ }
791
+ }
792
+ }
793
+ }
794
+ else {
795
+ return data;
796
+ }
797
+ return copy;
798
+ }
799
+
800
+ var isKey = (value) => /^\w*$/.test(value);
801
+
802
+ var isUndefined = (val) => val === undefined;
803
+
804
+ var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
805
+
806
+ var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
807
+
808
+ var get = (object, path, defaultValue) => {
809
+ if (!path || !isObject(object)) {
810
+ return defaultValue;
811
+ }
812
+ const result = (isKey(path) ? [path] : stringToPath(path)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
813
+ return isUndefined(result) || result === object
814
+ ? isUndefined(object[path])
815
+ ? defaultValue
816
+ : object[path]
817
+ : result;
818
+ };
819
+
820
+ var isBoolean = (value) => typeof value === 'boolean';
821
+
822
+ var set = (object, path, value) => {
823
+ let index = -1;
824
+ const tempPath = isKey(path) ? [path] : stringToPath(path);
825
+ const length = tempPath.length;
826
+ const lastIndex = length - 1;
827
+ while (++index < length) {
828
+ const key = tempPath[index];
829
+ let newValue = value;
830
+ if (index !== lastIndex) {
831
+ const objValue = object[key];
832
+ newValue =
833
+ isObject(objValue) || Array.isArray(objValue)
834
+ ? objValue
835
+ : !isNaN(+tempPath[index + 1])
836
+ ? []
837
+ : {};
838
+ }
839
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
840
+ return;
841
+ }
842
+ object[key] = newValue;
843
+ object = object[key];
844
+ }
845
+ };
846
+
847
+ const EVENTS = {
848
+ BLUR: 'blur',
849
+ CHANGE: 'change',
850
+ };
851
+ const VALIDATION_MODE = {
852
+ all: 'all',
853
+ };
854
+
855
+ const HookFormContext = React.createContext(null);
856
+ HookFormContext.displayName = 'HookFormContext';
857
+ /**
858
+ * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.
859
+ *
860
+ * @remarks
861
+ * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
862
+ *
863
+ * @returns return all useForm methods
864
+ *
865
+ * @example
866
+ * ```tsx
867
+ * function App() {
868
+ * const methods = useForm();
869
+ * const onSubmit = data => console.log(data);
870
+ *
871
+ * return (
872
+ * <FormProvider {...methods} >
873
+ * <form onSubmit={methods.handleSubmit(onSubmit)}>
874
+ * <NestedInput />
875
+ * <input type="submit" />
876
+ * </form>
877
+ * </FormProvider>
878
+ * );
879
+ * }
880
+ *
881
+ * function NestedInput() {
882
+ * const { register } = useFormContext(); // retrieve all hook methods
883
+ * return <input {...register("test")} />;
884
+ * }
885
+ * ```
886
+ */
887
+ const useFormContext = () => React.useContext(HookFormContext);
888
+
889
+ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
890
+ const result = {
891
+ defaultValues: control._defaultValues,
892
+ };
893
+ for (const key in formState) {
894
+ Object.defineProperty(result, key, {
895
+ get: () => {
896
+ const _key = key;
897
+ if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
898
+ control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
899
+ }
900
+ localProxyFormState && (localProxyFormState[_key] = true);
901
+ return formState[_key];
902
+ },
903
+ });
904
+ }
905
+ return result;
906
+ };
907
+
908
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
909
+
910
+ /**
911
+ * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
912
+ *
913
+ * @remarks
914
+ * [API](https://react-hook-form.com/docs/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly)
915
+ *
916
+ * @param props - include options on specify fields to subscribe. {@link UseFormStateReturn}
917
+ *
918
+ * @example
919
+ * ```tsx
920
+ * function App() {
921
+ * const { register, handleSubmit, control } = useForm({
922
+ * defaultValues: {
923
+ * firstName: "firstName"
924
+ * }});
925
+ * const { dirtyFields } = useFormState({
926
+ * control
927
+ * });
928
+ * const onSubmit = (data) => console.log(data);
929
+ *
930
+ * return (
931
+ * <form onSubmit={handleSubmit(onSubmit)}>
932
+ * <input {...register("firstName")} placeholder="First Name" />
933
+ * {dirtyFields.firstName && <p>Field is dirty.</p>}
934
+ * <input type="submit" />
935
+ * </form>
936
+ * );
937
+ * }
938
+ * ```
939
+ */
940
+ function useFormState(props) {
941
+ const methods = useFormContext();
942
+ const { control = methods.control, disabled, name, exact } = props || {};
943
+ const [formState, updateFormState] = React.useState(control._formState);
944
+ const _localProxyFormState = React.useRef({
945
+ isDirty: false,
946
+ isLoading: false,
947
+ dirtyFields: false,
948
+ touchedFields: false,
949
+ validatingFields: false,
950
+ isValidating: false,
951
+ isValid: false,
952
+ errors: false,
953
+ });
954
+ useIsomorphicLayoutEffect(() => control._subscribe({
955
+ name,
956
+ formState: _localProxyFormState.current,
957
+ exact,
958
+ callback: (formState) => {
959
+ !disabled &&
960
+ updateFormState({
961
+ ...control._formState,
962
+ ...formState,
963
+ });
964
+ },
965
+ }), [name, disabled, exact]);
966
+ React.useEffect(() => {
967
+ _localProxyFormState.current.isValid && control._setValid(true);
968
+ }, [control]);
969
+ return React.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
970
+ }
971
+
972
+ var isString = (value) => typeof value === 'string';
973
+
974
+ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
975
+ if (isString(names)) {
976
+ return get(formValues, names, defaultValue);
977
+ }
978
+ if (Array.isArray(names)) {
979
+ return names.map((fieldName) => (get(formValues, fieldName)));
980
+ }
981
+ return formValues;
982
+ };
983
+
984
+ var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
985
+
986
+ function deepEqual(object1, object2, _internal_visited = new WeakSet()) {
987
+ if (isPrimitive(object1) || isPrimitive(object2)) {
988
+ return object1 === object2;
989
+ }
990
+ if (isDateObject(object1) && isDateObject(object2)) {
991
+ return object1.getTime() === object2.getTime();
992
+ }
993
+ const keys1 = Object.keys(object1);
994
+ const keys2 = Object.keys(object2);
995
+ if (keys1.length !== keys2.length) {
996
+ return false;
997
+ }
998
+ if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
999
+ return true;
1000
+ }
1001
+ _internal_visited.add(object1);
1002
+ _internal_visited.add(object2);
1003
+ for (const key of keys1) {
1004
+ const val1 = object1[key];
1005
+ if (!keys2.includes(key)) {
1006
+ return false;
1007
+ }
1008
+ if (key !== 'ref') {
1009
+ const val2 = object2[key];
1010
+ if ((isDateObject(val1) && isDateObject(val2)) ||
1011
+ (isObject(val1) && isObject(val2)) ||
1012
+ (Array.isArray(val1) && Array.isArray(val2))
1013
+ ? !deepEqual(val1, val2, _internal_visited)
1014
+ : val1 !== val2) {
1015
+ return false;
1016
+ }
1017
+ }
1018
+ }
1019
+ return true;
1020
+ }
1021
+
1022
+ /**
1023
+ * Custom hook to subscribe to field change and isolate re-rendering at the component level.
1024
+ *
1025
+ * @remarks
1026
+ *
1027
+ * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)
1028
+ *
1029
+ * @example
1030
+ * ```tsx
1031
+ * const { control } = useForm();
1032
+ * const values = useWatch({
1033
+ * name: "fieldName"
1034
+ * control,
1035
+ * })
1036
+ * ```
1037
+ */
1038
+ function useWatch(props) {
1039
+ const methods = useFormContext();
1040
+ const { control = methods.control, name, defaultValue, disabled, exact, compute, } = props || {};
1041
+ const _defaultValue = React.useRef(defaultValue);
1042
+ const _compute = React.useRef(compute);
1043
+ const _computeFormValues = React.useRef(undefined);
1044
+ _compute.current = compute;
1045
+ const defaultValueMemo = React.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
1046
+ const [value, updateValue] = React.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
1047
+ useIsomorphicLayoutEffect(() => control._subscribe({
1048
+ name,
1049
+ formState: {
1050
+ values: true,
1051
+ },
1052
+ exact,
1053
+ callback: (formState) => {
1054
+ if (!disabled) {
1055
+ const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
1056
+ if (_compute.current) {
1057
+ const computedFormValues = _compute.current(formValues);
1058
+ if (!deepEqual(computedFormValues, _computeFormValues.current)) {
1059
+ updateValue(computedFormValues);
1060
+ _computeFormValues.current = computedFormValues;
1061
+ }
1062
+ }
1063
+ else {
1064
+ updateValue(formValues);
1065
+ }
1066
+ }
1067
+ },
1068
+ }), [control, disabled, name, exact]);
1069
+ React.useEffect(() => control._removeUnmounted());
1070
+ return value;
1071
+ }
1072
+
1073
+ /**
1074
+ * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.
1075
+ *
1076
+ * @remarks
1077
+ * [API](https://react-hook-form.com/docs/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)
1078
+ *
1079
+ * @param props - the path name to the form field value, and validation rules.
1080
+ *
1081
+ * @returns field properties, field and form state. {@link UseControllerReturn}
1082
+ *
1083
+ * @example
1084
+ * ```tsx
1085
+ * function Input(props) {
1086
+ * const { field, fieldState, formState } = useController(props);
1087
+ * return (
1088
+ * <div>
1089
+ * <input {...field} placeholder={props.name} />
1090
+ * <p>{fieldState.isTouched && "Touched"}</p>
1091
+ * <p>{formState.isSubmitted ? "submitted" : ""}</p>
1092
+ * </div>
1093
+ * );
1094
+ * }
1095
+ * ```
1096
+ */
1097
+ function useController(props) {
1098
+ const methods = useFormContext();
1099
+ const { name, disabled, control = methods.control, shouldUnregister, defaultValue, } = props;
1100
+ const isArrayField = isNameInFieldArray(control._names.array, name);
1101
+ const defaultValueMemo = React.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
1102
+ const value = useWatch({
1103
+ control,
1104
+ name,
1105
+ defaultValue: defaultValueMemo,
1106
+ exact: true,
1107
+ });
1108
+ const formState = useFormState({
1109
+ control,
1110
+ name,
1111
+ exact: true,
1112
+ });
1113
+ const _props = React.useRef(props);
1114
+ const _registerProps = React.useRef(control.register(name, {
1115
+ ...props.rules,
1116
+ value,
1117
+ ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
1118
+ }));
1119
+ _props.current = props;
1120
+ const fieldState = React.useMemo(() => Object.defineProperties({}, {
1121
+ invalid: {
1122
+ enumerable: true,
1123
+ get: () => !!get(formState.errors, name),
1124
+ },
1125
+ isDirty: {
1126
+ enumerable: true,
1127
+ get: () => !!get(formState.dirtyFields, name),
1128
+ },
1129
+ isTouched: {
1130
+ enumerable: true,
1131
+ get: () => !!get(formState.touchedFields, name),
1132
+ },
1133
+ isValidating: {
1134
+ enumerable: true,
1135
+ get: () => !!get(formState.validatingFields, name),
1136
+ },
1137
+ error: {
1138
+ enumerable: true,
1139
+ get: () => get(formState.errors, name),
1140
+ },
1141
+ }), [formState, name]);
1142
+ const onChange = React.useCallback((event) => _registerProps.current.onChange({
1143
+ target: {
1144
+ value: getEventValue(event),
1145
+ name: name,
1146
+ },
1147
+ type: EVENTS.CHANGE,
1148
+ }), [name]);
1149
+ const onBlur = React.useCallback(() => _registerProps.current.onBlur({
1150
+ target: {
1151
+ value: get(control._formValues, name),
1152
+ name: name,
1153
+ },
1154
+ type: EVENTS.BLUR,
1155
+ }), [name, control._formValues]);
1156
+ const ref = React.useCallback((elm) => {
1157
+ const field = get(control._fields, name);
1158
+ if (field && elm) {
1159
+ field._f.ref = {
1160
+ focus: () => elm.focus && elm.focus(),
1161
+ select: () => elm.select && elm.select(),
1162
+ setCustomValidity: (message) => elm.setCustomValidity(message),
1163
+ reportValidity: () => elm.reportValidity(),
1164
+ };
1165
+ }
1166
+ }, [control._fields, name]);
1167
+ const field = React.useMemo(() => ({
1168
+ name,
1169
+ value,
1170
+ ...(isBoolean(disabled) || formState.disabled
1171
+ ? { disabled: formState.disabled || disabled }
1172
+ : {}),
1173
+ onChange,
1174
+ onBlur,
1175
+ ref,
1176
+ }), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);
1177
+ React.useEffect(() => {
1178
+ const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
1179
+ control.register(name, {
1180
+ ..._props.current.rules,
1181
+ ...(isBoolean(_props.current.disabled)
1182
+ ? { disabled: _props.current.disabled }
1183
+ : {}),
1184
+ });
1185
+ const updateMounted = (name, value) => {
1186
+ const field = get(control._fields, name);
1187
+ if (field && field._f) {
1188
+ field._f.mount = value;
1189
+ }
1190
+ };
1191
+ updateMounted(name, true);
1192
+ if (_shouldUnregisterField) {
1193
+ const value = cloneObject(get(control._options.defaultValues, name));
1194
+ set(control._defaultValues, name, value);
1195
+ if (isUndefined(get(control._formValues, name))) {
1196
+ set(control._formValues, name, value);
1197
+ }
1198
+ }
1199
+ !isArrayField && control.register(name);
1200
+ return () => {
1201
+ (isArrayField
1202
+ ? _shouldUnregisterField && !control._state.action
1203
+ : _shouldUnregisterField)
1204
+ ? control.unregister(name)
1205
+ : updateMounted(name, false);
1206
+ };
1207
+ }, [name, control, isArrayField, shouldUnregister]);
1208
+ React.useEffect(() => {
1209
+ control._setDisabledField({
1210
+ disabled,
1211
+ name,
1212
+ });
1213
+ }, [disabled, name, control]);
1214
+ return React.useMemo(() => ({
1215
+ field,
1216
+ formState,
1217
+ fieldState,
1218
+ }), [field, formState, fieldState]);
1219
+ }
1220
+
1221
+ function useSelectField({ name, control, options: _options, rules, defaultValue, }) {
1222
+ const { field, fieldState: { error, invalid }, } = useController({
1223
+ name,
1224
+ control,
1225
+ rules,
1226
+ defaultValue,
1227
+ });
1228
+ const selectProps = {
1229
+ value: field.value,
1230
+ onChange: (value) => field.onChange(value),
1231
+ isError: invalid,
1232
+ error: error?.message,
1233
+ };
1234
+ return {
1235
+ selectProps,
1236
+ field,
1237
+ error,
1238
+ invalid,
1239
+ };
1240
+ }
1241
+
504
1242
  function SearchAutocomplete({ onSelect, selectedId, searchFunction, getEntityById, getDisplayValue, getSecondaryText, placeholder, icon = Search, disabled = false, minSearchLength = 2, debounceTime = 300, error, }) {
505
1243
  const [searchTerm, setSearchTerm] = React.useState("");
506
1244
  const [entities, setEntities] = React.useState([]);
@@ -630,7 +1368,7 @@ function SearchAutocomplete({ onSelect, selectedId, searchFunction, getEntityByI
630
1368
  : "No results found. Try a different search term." })), isLoading && showDropdown && (jsxRuntime.jsx("div", { className: "absolute z-10 p-4 mt-1 w-full text-center text-gray-500 bg-white rounded-md shadow-lg", children: jsxRuntime.jsxs("div", { className: "flex justify-center items-center", children: [jsxRuntime.jsx("div", { className: "mr-2 w-4 h-4 rounded-full border-b-2 animate-spin border-ews-primary" }), "Loading..."] }) }))] }));
631
1369
  }
632
1370
 
633
- function MultiSearchAutocomplete({ items, selectedItems, onSelectionChange, onSearch, getEntityById, getPrimaryText, getSecondaryText, placeholder, disabled = false, loading = false, multiple = true, className, renderSelectedItem, renderListItem, keepOpenOnSelect = true, error, minSearchLength = 2, debounceTime = 300, }) {
1371
+ function MultiSearchAutocomplete({ items, selectedItems, onSelectionChange, onSearch, getEntityById: _getEntityById, getPrimaryText, getSecondaryText, placeholder, disabled = false, loading = false, multiple = true, className, renderSelectedItem, renderListItem, keepOpenOnSelect = true, error, minSearchLength = 2, debounceTime = 300, }) {
634
1372
  const [searchTerm, setSearchTerm] = React.useState("");
635
1373
  const [isOpen, setIsOpen] = React.useState(false);
636
1374
  const [filteredItems, setFilteredItems] = React.useState(items);
@@ -814,7 +1552,7 @@ const Modal = ({ isOpen, onClose, title, children, variant = "info", primaryActi
814
1552
  return (jsxRuntime.jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [jsxRuntime.jsx("div", { className: "absolute inset-0 bg-black/50 backdrop-blur-sm", onClick: handleOverlayClick }), jsxRuntime.jsxs("div", { className: cn("relative w-full max-w-md mx-4 bg-white rounded-lg shadow-xl transform transition-all", "animate-in fade-in-0 zoom-in-95 duration-200", className), role: "dialog", "aria-modal": "true", "aria-labelledby": "modal-title", children: [jsxRuntime.jsxs("div", { className: cn("flex items-center justify-between p-6 border-b", variantStyles.borderColor), children: [jsxRuntime.jsxs("div", { className: "flex items-center space-x-3", children: [jsxRuntime.jsx("div", { className: cn("p-2 rounded-full", variantStyles.iconBg), children: variantStyles.icon }), jsxRuntime.jsx("h2", { id: "modal-title", className: cn("text-lg font-semibold", variantStyles.titleColor), children: title })] }), jsxRuntime.jsx("button", { onClick: onClose, className: "p-1 text-gray-400 hover:text-gray-600 transition-colors", "aria-label": "Close modal", children: jsxRuntime.jsx(X, { className: "w-5 h-5" }) })] }), jsxRuntime.jsx("div", { className: cn("p-6", contentClassName), children: jsxRuntime.jsx("div", { className: "text-gray-700 leading-relaxed", children: error && variant === "error" ? (jsxRuntime.jsxs("div", { className: "space-y-3", children: [jsxRuntime.jsx("p", { children: error.message }), error.fields && error.fields.length > 0 && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: "font-semibold text-gray-900", children: "Erreurs de champ:" }), jsxRuntime.jsx("ul", { className: "mt-2 space-y-1", children: error.fields.map((field, index) => (jsxRuntime.jsxs("li", { className: "text-ews-error", children: ["\u2022 ", field.path, ": ", field.message] }, index))) })] }))] })) : (children) }) }), (primaryAction || secondaryAction) && (jsxRuntime.jsxs("div", { className: "flex items-center justify-end space-x-3 p-6 pt-0", children: [secondaryAction && (jsxRuntime.jsx(Button, { variant: "ghost", onClick: onSecondaryAction || onClose, disabled: isLoading, children: secondaryAction })), primaryAction && (jsxRuntime.jsx(Button, { variant: variant === "error" ? "error" : "primary", onClick: onPrimaryAction, loading: isLoading, children: primaryAction }))] }))] })] }));
815
1553
  };
816
1554
 
817
- const Logo = ({ size = "md", showTagline = true, iconOnly = false, variant = "normal", className, onClick, }) => {
1555
+ const Logo = ({ size = "md", showTagline: _showTagline = true, iconOnly = false, variant = "normal", className, onClick, }) => {
818
1556
  const sizes = {
819
1557
  sm: "h-8",
820
1558
  md: "h-12",
@@ -933,6 +1671,21 @@ const ThemeToggle = ({ className }) => {
933
1671
  : "text-gray-600 hover:text-gray-900"}`, children: "MED" })] })] }));
934
1672
  };
935
1673
 
1674
+ const ThemeDebugger = ({ className = "", }) => {
1675
+ const { theme, themeConfig, setTheme } = useTheme();
1676
+ const getComputedStyleValue = (property) => {
1677
+ if (typeof window !== "undefined") {
1678
+ return getComputedStyle(document.documentElement).getPropertyValue(property);
1679
+ }
1680
+ return "N/A";
1681
+ };
1682
+ return (jsxRuntime.jsxs("div", { className: `p-4 border rounded-lg bg-gray-50 ${className}`, children: [jsxRuntime.jsx("h3", { className: "text-lg font-semibold mb-4", children: "Theme Debugger" }), jsxRuntime.jsxs("div", { className: "space-y-3", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Current Theme:" }), " ", theme] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Theme Config:" }), jsxRuntime.jsx("pre", { className: "text-xs bg-gray-100 p-2 rounded mt-1", children: JSON.stringify(themeConfig, null, 2) })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "CSS Variables:" }), jsxRuntime.jsxs("div", { className: "text-xs space-y-1 mt-1", children: [jsxRuntime.jsxs("div", { children: ["--ews-primary: ", getComputedStyleValue("--ews-primary")] }), jsxRuntime.jsxs("div", { children: ["--ews-secondary: ", getComputedStyleValue("--ews-secondary")] }), jsxRuntime.jsxs("div", { children: ["--ews-primary-hover:", " ", getComputedStyleValue("--ews-primary-hover")] }), jsxRuntime.jsxs("div", { children: ["--ews-secondary-hover:", " ", getComputedStyleValue("--ews-secondary-hover")] })] })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Data Theme Attribute:" }), " ", document.documentElement.getAttribute("data-theme")] }), jsxRuntime.jsxs("div", { className: "flex space-x-2", children: [jsxRuntime.jsx("button", { onClick: () => setTheme("PROMED"), className: `px-3 py-1 text-xs rounded ${theme === "PROMED"
1683
+ ? "bg-ews-primary text-white"
1684
+ : "bg-gray-200 text-gray-700"}`, children: "PROMED" }), jsxRuntime.jsx("button", { onClick: () => setTheme("MED"), className: `px-3 py-1 text-xs rounded ${theme === "MED"
1685
+ ? "bg-ews-primary text-white"
1686
+ : "bg-gray-200 text-gray-700"}`, children: "MED" })] }), jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2 mt-4", children: [jsxRuntime.jsx("div", { className: "bg-ews-primary text-white p-2 rounded text-center", children: "Primary" }), jsxRuntime.jsx("div", { className: "bg-ews-secondary text-white p-2 rounded text-center", children: "Secondary" }), jsxRuntime.jsx("div", { className: "bg-ews-success text-white p-2 rounded text-center", children: "Success" }), jsxRuntime.jsx("div", { className: "bg-ews-warning text-white p-2 rounded text-center", children: "Warning" })] })] })] }));
1687
+ };
1688
+
936
1689
  const SpecialtySearchAutocomplete = ({ selectedSpecialties = [], onSpecialtiesChange, placeholder = "Search and select medical specialties...", className = "", disabled = false, maxSelections, showSelectedCount = true, }) => {
937
1690
  const [specialties, setSpecialties] = React.useState([]);
938
1691
  const [isLoading, setIsLoading] = React.useState(false);
@@ -1004,7 +1757,9 @@ exports.MultiSearchAutocomplete = MultiSearchAutocomplete;
1004
1757
  exports.PatientIcon = PatientIcon;
1005
1758
  exports.Search = Search;
1006
1759
  exports.SearchAutocomplete = SearchAutocomplete;
1760
+ exports.Select = Select;
1007
1761
  exports.SpecialtySearchAutocomplete = SpecialtySearchAutocomplete;
1762
+ exports.ThemeDebugger = ThemeDebugger;
1008
1763
  exports.ThemeProvider = ThemeProvider;
1009
1764
  exports.ThemeToggle = ThemeToggle;
1010
1765
  exports.UserIcon = UserIcon;
@@ -1015,5 +1770,6 @@ exports.formatDate = formatDate;
1015
1770
  exports.generateId = generateId;
1016
1771
  exports.useDebounce = useDebounce;
1017
1772
  exports.useDebouncedCallback = useDebouncedCallback;
1773
+ exports.useSelectField = useSelectField;
1018
1774
  exports.useTheme = useTheme;
1019
1775
  //# sourceMappingURL=index.js.map