coles-solid-library 0.2.7 → 0.3.0

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/dist/index.esm.js CHANGED
@@ -516,11 +516,11 @@ function styleInject(css, ref) {
516
516
  }
517
517
  }
518
518
 
519
- var css_248z$g = ".Button_customButtonStyle__1TOXE {\n border-radius: 8px;\n font-family: \"Roboto, sans-serif\";\n padding: 8px 8px;\n border: none;\n outline: none;\n transition: transform 0.2s ease, background 0.2s ease;\n}\n.Button_customButtonStyle__1TOXE:active {\n transform: scale(0.9);\n box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);\n}\n.Button_customButtonStyle__1TOXE:not(:disabled):hover {\n cursor: pointer;\n box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.15);\n}\n.Button_customButtonStyle__1TOXE:disabled:hover {\n cursor: not-allowed;\n}\n\n.Button_primary__auYD2 {\n background-color: var(--primary-color, #4CAF50);\n color: var(--on-primary-color, #fff);\n}\n\n.Button_primaryVariant__NbKc2 {\n background-color: var(--primary-color-varient, #43A047);\n color: var(--on-primary-color, #fff);\n}\n\n.Button_secondary__DVppl {\n background-color: var(--secondary-color, #14b9c3);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button_secondaryVariant__suwON {\n background-color: var(--secondary-color-varient, #0b969f);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button_background__E82uk {\n background-color: var(--background-color, #ffffff);\n color: var(--on-background-color, #000000);\n}\n\n.Button_surface__EF0NA {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n\n.Button_surfaceVariant__-SFxJ {\n background-color: var(--surface-color-variant, #ccc);\n color: var(--on-surface-color, #000000);\n}\n\n.Button_container__E1Hq5 {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n\n.Button_error__Yab6f {\n background-color: var(--error-color, #B00020);\n color: var(--on-error-color, #ffffff);\n}\n\n.Button_borderPrimary__uJ-qE {\n border: 1px solid var(--primary-color, #4CAF50);\n}\n\n.Button_borderPrimaryVariant__qkdEf {\n border: 1px solid var(--primary-color-varient, #43A047);\n}\n\n.Button_borderSecondary__-P9is {\n border: 1px solid var(--secondary-color, #14b9c3);\n}\n\n.Button_borderSecondaryVariant__6dCZ7 {\n border: 1px solid var(--secondary-color-varient, #0b969f);\n}\n\n.Button_borderBackground__lm7yB {\n border: 1px solid var(--background-color, #ffffff);\n}\n\n.Button_borderSurface__AJQxT {\n border: 1px solid var(--surface-color, #EEEEEE);\n}\n\n.Button_borderSurfaceVariant__Cfk2f {\n border: 1px solid var(--surface-color-variant, #ccc);\n}\n\n.Button_borderContainer__GXDhL {\n border: 1px solid var(--container-color, #ffffff);\n}\n\n.Button_borderError__f2lZ- {\n border: 1px solid var(--error-color, #B00020);\n}\n\n.Button_none__vPYWY {\n border: none;\n}\n\n.Button_transparent__aet0J {\n background-color: transparent !important;\n border: none;\n outline: none;\n padding: 0px;\n margin: 0px;\n}";
519
+ var css_248z$j = ".Button_customButtonStyle__1TOXE {\n border-radius: 8px;\n font-family: \"Roboto, sans-serif\";\n padding: 8px 8px;\n border: none;\n outline: none;\n transition: transform 0.2s ease, background 0.2s ease;\n}\n.Button_customButtonStyle__1TOXE:active {\n transform: scale(0.9);\n box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);\n}\n.Button_customButtonStyle__1TOXE:not(:disabled):hover {\n cursor: pointer;\n box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.15);\n}\n.Button_customButtonStyle__1TOXE:disabled:hover {\n cursor: not-allowed;\n}\n\n.Button_primary__auYD2 {\n background-color: var(--primary-color, #4CAF50);\n color: var(--on-primary-color, #fff);\n}\n\n.Button_primaryVariant__NbKc2 {\n background-color: var(--primary-color-varient, #43A047);\n color: var(--on-primary-color, #fff);\n}\n\n.Button_secondary__DVppl {\n background-color: var(--secondary-color, #14b9c3);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button_secondaryVariant__suwON {\n background-color: var(--secondary-color-varient, #0b969f);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button_background__E82uk {\n background-color: var(--background-color, #ffffff);\n color: var(--on-background-color, #000000);\n}\n\n.Button_surface__EF0NA {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n\n.Button_surfaceVariant__-SFxJ {\n background-color: var(--surface-color-variant, #ccc);\n color: var(--on-surface-color, #000000);\n}\n\n.Button_container__E1Hq5 {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n\n.Button_error__Yab6f {\n background-color: var(--error-color, #B00020);\n color: var(--on-error-color, #ffffff);\n}\n\n.Button_borderPrimary__uJ-qE {\n border: 1px solid var(--primary-color, #4CAF50);\n}\n\n.Button_borderPrimaryVariant__qkdEf {\n border: 1px solid var(--primary-color-varient, #43A047);\n}\n\n.Button_borderSecondary__-P9is {\n border: 1px solid var(--secondary-color, #14b9c3);\n}\n\n.Button_borderSecondaryVariant__6dCZ7 {\n border: 1px solid var(--secondary-color-varient, #0b969f);\n}\n\n.Button_borderBackground__lm7yB {\n border: 1px solid var(--background-color, #ffffff);\n}\n\n.Button_borderSurface__AJQxT {\n border: 1px solid var(--surface-color, #EEEEEE);\n}\n\n.Button_borderSurfaceVariant__Cfk2f {\n border: 1px solid var(--surface-color-variant, #ccc);\n}\n\n.Button_borderContainer__GXDhL {\n border: 1px solid var(--container-color, #ffffff);\n}\n\n.Button_borderError__f2lZ- {\n border: 1px solid var(--error-color, #B00020);\n}\n\n.Button_none__vPYWY {\n border: none;\n}\n\n.Button_transparent__aet0J {\n background-color: transparent !important;\n border: none;\n outline: none;\n padding: 0px;\n margin: 0px;\n}";
520
520
  var style$8 = {"customButtonStyle":"Button_customButtonStyle__1TOXE","primary":"Button_primary__auYD2","primaryVariant":"Button_primaryVariant__NbKc2","secondary":"Button_secondary__DVppl","secondaryVariant":"Button_secondaryVariant__suwON","background":"Button_background__E82uk","surface":"Button_surface__EF0NA","surfaceVariant":"Button_surfaceVariant__-SFxJ","container":"Button_container__E1Hq5","error":"Button_error__Yab6f","borderPrimary":"Button_borderPrimary__uJ-qE","borderPrimaryVariant":"Button_borderPrimaryVariant__qkdEf","borderSecondary":"Button_borderSecondary__-P9is","borderSecondaryVariant":"Button_borderSecondaryVariant__6dCZ7","borderBackground":"Button_borderBackground__lm7yB","borderSurface":"Button_borderSurface__AJQxT","borderSurfaceVariant":"Button_borderSurfaceVariant__Cfk2f","borderContainer":"Button_borderContainer__GXDhL","borderError":"Button_borderError__f2lZ-","none":"Button_none__vPYWY","transparent":"Button_transparent__aet0J"};
521
- styleInject(css_248z$g);
521
+ styleInject(css_248z$j);
522
522
 
523
- var _tmpl$$l = /*#__PURE__*/template(`<button>`);
523
+ var _tmpl$$o = /*#__PURE__*/template(`<button>`);
524
524
  const Button = props => {
525
525
  const [local, others] = splitProps(props, ["theme", "transparent", "borderTheme"]);
526
526
  const isTransparent = () => {
@@ -529,6 +529,7 @@ const Button = props => {
529
529
  }
530
530
  return false;
531
531
  };
532
+ const [buttonRef, setButtonRef] = createSignal();
532
533
  const transparent = createMemo(() => isTransparent() ? style$8.transparent : "");
533
534
  const getBorderThemeName = theme => {
534
535
  switch (theme) {
@@ -555,7 +556,12 @@ const Button = props => {
555
556
  }
556
557
  };
557
558
  return (() => {
558
- var _el$ = _tmpl$$l();
559
+ var _el$ = _tmpl$$o();
560
+ use(ref => {
561
+ setButtonRef(ref);
562
+ // @ts-ignore
563
+ props?.ref?.(ref);
564
+ }, _el$);
559
565
  spread(_el$, mergeProps(others, {
560
566
  get ["class"]() {
561
567
  return `${style$8[local?.theme ?? "container"]} ${style$8[getBorderThemeName(local?.borderTheme ?? 'none')]} ${style$8.customButtonStyle} ${transparent()} ${props?.class ?? ""} `;
@@ -566,12 +572,12 @@ const Button = props => {
566
572
  })();
567
573
  };
568
574
 
569
- var css_248z$f = ".Carosel-module_carouselHeader__JAhGf {\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.Carosel-module_carouselHeader__JAhGf div {\n flex-grow: 1;\n text-align: center;\n}\n.Carosel-module_carouselHeader__JAhGf button {\n flex-basis: 1;\n}\n\n.Carosel-module_carousel__cHoMx {\n position: relative;\n width: 100%;\n margin: auto;\n overflow: hidden;\n border-radius: 10px;\n}\n\n.Carosel-module_carouselSlides__MgPU3 {\n display: flex;\n transition: transform 0.5s ease-in-out;\n width: 100%;\n height: 100%;\n}\n\n.Carosel-module_carouselSlide__--NkY {\n min-width: 100%;\n padding: 5px;\n box-sizing: border-box;\n}\n\n.Carosel-module_carouselButton__E1gGu {\n opacity: 0.5;\n border: none;\n padding: 10px;\n cursor: pointer;\n}\n.Carosel-module_carouselButton__E1gGu:hover {\n opacity: 1;\n}";
575
+ var css_248z$i = ".Carosel-module_carouselHeader__JAhGf {\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.Carosel-module_carouselHeader__JAhGf div {\n flex-grow: 1;\n text-align: center;\n}\n.Carosel-module_carouselHeader__JAhGf button {\n flex-basis: 1;\n}\n\n.Carosel-module_carousel__cHoMx {\n position: relative;\n width: 100%;\n margin: auto;\n overflow: hidden;\n border-radius: 10px;\n}\n\n.Carosel-module_carouselSlides__MgPU3 {\n display: flex;\n transition: transform 0.5s ease-in-out;\n width: 100%;\n height: 100%;\n}\n\n.Carosel-module_carouselSlide__--NkY {\n min-width: 100%;\n padding: 5px;\n box-sizing: border-box;\n}\n\n.Carosel-module_carouselButton__E1gGu {\n opacity: 0.5;\n border: none;\n padding: 10px;\n cursor: pointer;\n}\n.Carosel-module_carouselButton__E1gGu:hover {\n opacity: 1;\n}";
570
576
  var style$7 = {"carouselHeader":"Carosel-module_carouselHeader__JAhGf","carousel":"Carosel-module_carousel__cHoMx","carouselSlides":"Carosel-module_carouselSlides__MgPU3","carouselSlide":"Carosel-module_carouselSlide__--NkY","carouselButton":"Carosel-module_carouselButton__E1gGu"};
571
- styleInject(css_248z$f);
577
+ styleInject(css_248z$i);
572
578
 
573
- var _tmpl$$k = /*#__PURE__*/template(`<div>No <!> Found`),
574
- _tmpl$2$a = /*#__PURE__*/template(`<div>No Elements Found`),
579
+ var _tmpl$$n = /*#__PURE__*/template(`<div>No <!> Found`),
580
+ _tmpl$2$c = /*#__PURE__*/template(`<div>No Elements Found`),
575
581
  _tmpl$3$4 = /*#__PURE__*/template(`<div>`),
576
582
  _tmpl$4$2 = /*#__PURE__*/template(`<div><div><div></div></div><div>`);
577
583
  const carouselTitleContext = createContext(createSignal([]));
@@ -643,13 +649,13 @@ const Carousel = ({
643
649
  }
644
650
  }
645
651
  return props.notFoundName ? (() => {
646
- var _el$ = _tmpl$$k(),
652
+ var _el$ = _tmpl$$n(),
647
653
  _el$2 = _el$.firstChild,
648
654
  _el$4 = _el$2.nextSibling;
649
655
  _el$4.nextSibling;
650
656
  insert(_el$, () => props.notFoundName, _el$4);
651
657
  return _el$;
652
- })() : _tmpl$2$a();
658
+ })() : _tmpl$2$c();
653
659
  });
654
660
  // ----- Functions -----
655
661
  const nextSlide = () => {
@@ -749,12 +755,12 @@ const Slide = props => {
749
755
  return createMemo(() => props.children);
750
756
  };
751
757
 
752
- var css_248z$e = ".Chip-module_Chip__HWK4W {\n display: flex;\n flex-direction: row;\n padding: 5px 10px;\n margin-left: 8px;\n border-radius: 15px;\n height: -moz-max-content;\n height: max-content;\n min-width: -moz-min-content;\n min-width: min-content;\n max-width: -moz-max-content;\n max-width: max-content;\n margin: 5px;\n}\n.Chip-module_Chip__HWK4W span {\n margin: 0px 2px;\n width: -moz-max-content;\n width: max-content;\n max-width: 10em;\n text-overflow: ellipsis;\n}\n.Chip-module_Chip__HWK4W button {\n font-size: 1rem !important;\n height: -moz-min-content;\n height: min-content;\n margin: auto 0px;\n padding: 0px 4px !important;\n margin-left: 5px !important;\n border-radius: 8px;\n}\n\n.Chip-module_removeChipButton__kl1mU {\n margin: 0 !important;\n margin-left: 5px !important;\n padding: 0 !important;\n font-size: 1rem !important;\n}\n\n.Chip-module_hover__fvVQS:hover {\n cursor: pointer;\n}\n\n.Chip-module_tertiary__TtdnV {\n background-color: inherit;\n color: var(--on-container-color, #000);\n border: 1px solid var(--primary-color, #4CAF50);\n margin-right: 6px;\n}\n.Chip-module_tertiary__TtdnV button {\n background-color: inherit;\n color: var(--on-container-color, #000);\n font-weight: 700;\n}";
758
+ var css_248z$h = ".Chip-module_Chip__HWK4W {\n display: flex;\n flex-direction: row;\n padding: 5px 10px;\n margin-left: 8px;\n border-radius: 15px;\n height: -moz-max-content;\n height: max-content;\n min-width: -moz-min-content;\n min-width: min-content;\n max-width: -moz-max-content;\n max-width: max-content;\n margin: 5px;\n}\n.Chip-module_Chip__HWK4W span {\n margin: 0px 2px;\n width: -moz-max-content;\n width: max-content;\n max-width: 10em;\n text-overflow: ellipsis;\n}\n.Chip-module_Chip__HWK4W button {\n font-size: 1rem !important;\n height: -moz-min-content;\n height: min-content;\n margin: auto 0px;\n padding: 0px 4px !important;\n margin-left: 5px !important;\n border-radius: 8px;\n}\n\n.Chip-module_removeChipButton__kl1mU {\n margin: 0 !important;\n margin-left: 5px !important;\n padding: 0 !important;\n font-size: 1rem !important;\n}\n\n.Chip-module_hover__fvVQS:hover {\n cursor: pointer;\n}\n\n.Chip-module_tertiary__TtdnV {\n background-color: inherit;\n color: var(--on-container-color, #000);\n border: 1px solid var(--primary-color, #4CAF50);\n margin-right: 6px;\n}\n.Chip-module_tertiary__TtdnV button {\n background-color: inherit;\n color: var(--on-container-color, #000);\n font-weight: 700;\n}";
753
759
  var style$6 = {"Chip":"Chip-module_Chip__HWK4W","removeChipButton":"Chip-module_removeChipButton__kl1mU","hover":"Chip-module_hover__fvVQS","tertiary":"Chip-module_tertiary__TtdnV"};
754
- styleInject(css_248z$e);
760
+ styleInject(css_248z$h);
755
761
 
756
- var _tmpl$$j = /*#__PURE__*/template(`<span>`),
757
- _tmpl$2$9 = /*#__PURE__*/template(`<span>:`),
762
+ var _tmpl$$m = /*#__PURE__*/template(`<span>`),
763
+ _tmpl$2$b = /*#__PURE__*/template(`<span>:`),
758
764
  _tmpl$3$3 = /*#__PURE__*/template(`<span><span>`);
759
765
  const Chip = props => {
760
766
  const hoverChip = props.onClick ? `${style$6.hover}` : "";
@@ -768,10 +774,10 @@ const Chip = props => {
768
774
  },
769
775
  get children() {
770
776
  return [(() => {
771
- var _el$2 = _tmpl$$j();
777
+ var _el$2 = _tmpl$$m();
772
778
  insert(_el$2, () => props.key);
773
779
  return _el$2;
774
- })(), _tmpl$2$9()];
780
+ })(), _tmpl$2$b()];
775
781
  }
776
782
  }), _el$4);
777
783
  insert(_el$4, () => ' ' + props.value);
@@ -798,12 +804,12 @@ const Chip = props => {
798
804
  };
799
805
  delegateEvents(["click"]);
800
806
 
801
- var css_248z$d = ".chipbar-module_chipbar__PjssB {\n display: flex;\n flex-direction: row;\n min-width: 100%;\n width: -moz-max-content;\n width: max-content;\n max-width: 100%;\n padding: var(--spacing-1, 8px) 0px;\n border-bottom: 1px solid var(--on-background, white);\n}\n\n.chipbar-module_chipContainer__lnYfX {\n display: flex;\n flex-direction: row;\n overflow-x: hidden;\n scroll-behavior: smooth;\n flex-grow: 1;\n}\n.chipbar-module_chipContainer__lnYfX span {\n height: -moz-min-content;\n height: min-content;\n margin: auto 0px;\n}\n.chipbar-module_chipContainer__lnYfX span button {\n width: -moz-max-content;\n width: max-content;\n padding: 5px;\n}\n\n.chipbar-module_leftArrow__OS8vV {\n margin-right: 10px;\n align-self: flex-start;\n margin: auto 0px;\n}\n\n.chipbar-module_rightArrow__T4ubJ {\n margin-left: 10px;\n align-self: flex-end;\n margin: auto 0px;\n}";
807
+ var css_248z$g = ".chipbar-module_chipbar__PjssB {\n display: flex;\n flex-direction: row;\n min-width: 100%;\n width: -moz-max-content;\n width: max-content;\n max-width: 100%;\n padding: var(--spacing-1, 8px) 0px;\n border-bottom: 1px solid var(--on-background, white);\n}\n\n.chipbar-module_chipContainer__lnYfX {\n display: flex;\n flex-direction: row;\n overflow-x: hidden;\n scroll-behavior: smooth;\n flex-grow: 1;\n}\n.chipbar-module_chipContainer__lnYfX span {\n height: -moz-min-content;\n height: min-content;\n margin: auto 0px;\n}\n.chipbar-module_chipContainer__lnYfX span button {\n width: -moz-max-content;\n width: max-content;\n padding: 5px;\n}\n\n.chipbar-module_leftArrow__OS8vV {\n margin-right: 10px;\n align-self: flex-start;\n margin: auto 0px;\n}\n\n.chipbar-module_rightArrow__T4ubJ {\n margin-left: 10px;\n align-self: flex-end;\n margin: auto 0px;\n}";
802
808
  var style$5 = {"chipbar":"chipbar-module_chipbar__PjssB","chipContainer":"chipbar-module_chipContainer__lnYfX","leftArrow":"chipbar-module_leftArrow__OS8vV","rightArrow":"chipbar-module_rightArrow__T4ubJ"};
803
- styleInject(css_248z$d);
809
+ styleInject(css_248z$g);
804
810
 
805
- var _tmpl$$i = /*#__PURE__*/template(`<span>`),
806
- _tmpl$2$8 = /*#__PURE__*/template(`<div><div>`);
811
+ var _tmpl$$l = /*#__PURE__*/template(`<span>`),
812
+ _tmpl$2$a = /*#__PURE__*/template(`<div><div>`);
807
813
  function Chipbar(props) {
808
814
  const hasSignalChips = props.chips !== undefined;
809
815
  const [chipContainer, setChipContainer] = createSignal();
@@ -857,14 +863,14 @@ function Chipbar(props) {
857
863
  setShowLeft(true);
858
864
  };
859
865
  return (() => {
860
- var _el$ = _tmpl$2$8(),
866
+ var _el$ = _tmpl$2$a(),
861
867
  _el$3 = _el$.firstChild;
862
868
  insert(_el$, createComponent(Show, {
863
869
  get when() {
864
870
  return showLeft();
865
871
  },
866
872
  get children() {
867
- var _el$2 = _tmpl$$i();
873
+ var _el$2 = _tmpl$$l();
868
874
  insert(_el$2, createComponent(Button, {
869
875
  onMouseDown: scrollLeft,
870
876
  children: "\u2190"
@@ -879,7 +885,7 @@ function Chipbar(props) {
879
885
  return (hasSignalChips || !hasSignalChips && props.clearAll !== undefined);
880
886
  },
881
887
  get children() {
882
- var _el$4 = _tmpl$$i();
888
+ var _el$4 = _tmpl$$l();
883
889
  insert(_el$4, createComponent(Button, {
884
890
  onClick: () => clearAll() ,
885
891
  children: "Clear All"
@@ -923,7 +929,7 @@ function Chipbar(props) {
923
929
  return showRight();
924
930
  },
925
931
  get children() {
926
- var _el$5 = _tmpl$$i();
932
+ var _el$5 = _tmpl$$l();
927
933
  insert(_el$5, createComponent(Button, {
928
934
  onMouseDown: scrollRight,
929
935
  children: "\u2192"
@@ -946,18 +952,18 @@ function Chipbar(props) {
946
952
  })();
947
953
  }
948
954
 
949
- var css_248z$c = ".body-module_compBody__d3HyU {\n width: 70%;\n margin: 0 auto;\n border-radius: 15px;\n padding: 8px;\n padding-top: 0px;\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n@media screen and (max-width: 768px) {\n .body-module_compBody__d3HyU {\n width: 95%;\n margin: 0 auto;\n }\n}";
950
- var styles$7 = {"compBody":"body-module_compBody__d3HyU"};
951
- styleInject(css_248z$c);
955
+ var css_248z$f = ".body-module_compBody__d3HyU {\n width: 70%;\n margin: 0 auto;\n border-radius: 15px;\n padding: 8px;\n padding-top: 0px;\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n@media screen and (max-width: 768px) {\n .body-module_compBody__d3HyU {\n width: 95%;\n margin: 0 auto;\n }\n}";
956
+ var styles$a = {"compBody":"body-module_compBody__d3HyU"};
957
+ styleInject(css_248z$f);
952
958
 
953
- var _tmpl$$h = /*#__PURE__*/template(`<div>`);
959
+ var _tmpl$$k = /*#__PURE__*/template(`<div>`);
954
960
  const Body = props => {
955
961
  const [customProps, normalProps] = splitProps(props, ["children", "class", 'style']);
956
962
  return (() => {
957
- var _el$ = _tmpl$$h();
963
+ var _el$ = _tmpl$$k();
958
964
  spread(_el$, mergeProps(normalProps, {
959
965
  get ["class"]() {
960
- return `${styles$7.compBody} ${customProps.class ?? ""}`;
966
+ return `${styles$a.compBody} ${customProps.class ?? ""}`;
961
967
  }
962
968
  }), false, true);
963
969
  insert(_el$, () => customProps.children);
@@ -1149,17 +1155,26 @@ function useClickOutside(elementRefs, callback) {
1149
1155
  };
1150
1156
  // Set up the event listener when the component mounts.
1151
1157
  onMount(() => {
1152
- document.addEventListener('click', handleClick);
1158
+ const handleClick = event => {
1159
+ const path = event.composedPath();
1160
+ // If click is inside ANY ref’ed element, do nothing
1161
+ if (elementRefs.some(ref => {
1162
+ const el = ref();
1163
+ return el && path.includes(el);
1164
+ })) return;
1165
+ callback();
1166
+ };
1167
+ document.addEventListener('pointerdown', handleClick); // capture phase
1153
1168
  });
1154
1169
  // Clean up the event listener when the component unmounts.
1155
1170
  onCleanup(() => {
1156
- document.removeEventListener('click', handleClick);
1171
+ document.removeEventListener('pointerdown', handleClick);
1157
1172
  });
1158
1173
  }
1159
1174
 
1160
- var css_248z$b = "@charset \"UTF-8\";\n.input-module_input__-LMoi {\n width: 100%;\n max-width: 400px;\n border-radius: var(--border-radius-lg, 16px);\n font-size: var(--font-size-base, 16px);\n}\n@media screen and (max-width: 768px) {\n .input-module_input__-LMoi {\n width: 100%;\n max-width: 100%;\n }\n}\n.input-module_input__-LMoi[type=checkbox] {\n width: -moz-min-content;\n width: min-content;\n -webkit-appearance: none;\n border: 1px solid #cacece;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05);\n padding: var(--spacing-1, 8px);\n border-radius: var(--border-radius-sm);\n display: inline-block;\n position: relative;\n}\n.input-module_input__-LMoi[type=checkbox]:checked {\n background-color: inherit;\n border: 1px solid #adb8c0;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05), inset 15px 10px -12px rgba(255, 255, 255, 0.1);\n color: inherit;\n}\n.input-module_input__-LMoi[type=checkbox]:checked:after {\n content: \"✔\";\n position: absolute;\n top: -15%;\n left: 15%;\n width: 10px;\n height: 10px;\n border-radius: 10%;\n}\n.input-module_input__-LMoi:not([type=checkbox])::-moz-placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:not([type=checkbox])::placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:focus {\n outline: none;\n}\n.input-module_input__-LMoi.input-module_error__vs2kz {\n border: 1px solid var(--warn-color);\n}\n.input-module_input__-LMoi.input-module_success__beiu5 {\n border: 1px solid green;\n}\n.input-module_input__-LMoi.input-module_warning__b6S5s {\n border: 1px solid orange;\n}\n.input-module_input__-LMoi.input-module_info__pWO0n {\n border: 1px solid blue;\n}\n.input-module_input__-LMoi.input-module_disabled__40ZHw {\n border: 1px solid gray;\n}\n\n.input-module_inFormField__kk-PD {\n border: none;\n outline: none;\n}\n\n.input-module_checkbox__Yu-9M {\n cursor: pointer;\n}\n\n.input-module_transparent__aXcGX {\n background-color: inherit !important;\n opacity: 1;\n color: inherit !important;\n border: none;\n}\n.input-module_transparent__aXcGX :focus {\n outline: none;\n}";
1161
- var styles$6 = {"input":"input-module_input__-LMoi","inFormField":"input-module_inFormField__kk-PD","transparent":"input-module_transparent__aXcGX"};
1162
- styleInject(css_248z$b);
1175
+ var css_248z$e = "@charset \"UTF-8\";\n.input-module_input__-LMoi {\n width: 100%;\n max-width: 400px;\n border-radius: var(--border-radius-lg, 16px);\n font-size: var(--font-size-base, 16px);\n transition: border 0.7s ease, padding 0.7s ease;\n}\n@media screen and (max-width: 768px) {\n .input-module_input__-LMoi {\n width: 100%;\n max-width: 100%;\n }\n}\n.input-module_input__-LMoi[type=checkbox] {\n width: -moz-min-content;\n width: min-content;\n -webkit-appearance: none;\n border: 1px solid #cacece;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05);\n padding: var(--spacing-1, 8px);\n border-radius: var(--border-radius-sm);\n display: inline-block;\n position: relative;\n}\n.input-module_input__-LMoi[type=checkbox]:checked {\n background-color: inherit;\n border: 1px solid #adb8c0;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05), inset 15px 10px -12px rgba(255, 255, 255, 0.1);\n color: inherit;\n}\n.input-module_input__-LMoi[type=checkbox]:checked:after {\n content: \"✔\";\n position: absolute;\n top: -15%;\n left: 15%;\n width: 10px;\n height: 10px;\n border-radius: 10%;\n}\n.input-module_input__-LMoi:not([type=checkbox])::-moz-placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:not([type=checkbox])::placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:focus {\n outline: none;\n}\n.input-module_input__-LMoi.input-module_error__vs2kz {\n border: 1px solid var(--warn-color);\n}\n.input-module_input__-LMoi.input-module_success__beiu5 {\n border: 1px solid green;\n}\n.input-module_input__-LMoi.input-module_warning__b6S5s {\n border: 1px solid orange;\n}\n.input-module_input__-LMoi.input-module_info__pWO0n {\n border: 1px solid blue;\n}\n.input-module_input__-LMoi.input-module_disabled__40ZHw {\n border: 1px solid gray;\n}\n\n.input-module_inFormField__kk-PD {\n border: none;\n outline: none;\n transition: padding 0.7s ease;\n}\n\n.input-module_checkbox__Yu-9M {\n cursor: pointer;\n}\n\n.input-module_transparent__aXcGX {\n background-color: inherit !important;\n opacity: 1;\n color: inherit !important;\n border: none;\n}\n.input-module_transparent__aXcGX :focus {\n outline: none;\n}";
1176
+ var styles$9 = {"input":"input-module_input__-LMoi","inFormField":"input-module_inFormField__kk-PD","transparent":"input-module_transparent__aXcGX"};
1177
+ styleInject(css_248z$e);
1163
1178
 
1164
1179
  const $RAW = Symbol("store-raw"),
1165
1180
  $NODE = Symbol("store-node"),
@@ -1375,7 +1390,7 @@ function createStore(...[store, options]) {
1375
1390
  return [wrappedStore, setStore];
1376
1391
  }
1377
1392
 
1378
- var _tmpl$$g = /*#__PURE__*/template(`<form>`);
1393
+ var _tmpl$$j = /*#__PURE__*/template(`<form>`);
1379
1394
  const FormContext = createContext();
1380
1395
  const useFormContext = () => {
1381
1396
  return useContext(FormContext);
@@ -1411,7 +1426,7 @@ const FormInner = props => {
1411
1426
  formRef()?.removeEventListener('submit', submitFunction);
1412
1427
  });
1413
1428
  return (() => {
1414
- var _el$ = _tmpl$$g();
1429
+ var _el$ = _tmpl$$j();
1415
1430
  use(setFormRef, _el$);
1416
1431
  insert(_el$, () => props.children);
1417
1432
  return _el$;
@@ -1434,59 +1449,54 @@ const Provider = props => {
1434
1449
  });
1435
1450
  };
1436
1451
 
1437
- var _tmpl$$f = /*#__PURE__*/template(`<input>`);
1452
+ var _tmpl$$i = /*#__PURE__*/template(`<input>`);
1438
1453
  const Input = props => {
1439
1454
  const [customProps, normalProps] = splitProps(props, ["tooltip", "transparent", "value", "onChange"]);
1440
- const noTransparent = type => "checkbox" !== (type ?? "text");
1441
1455
  const context = useFormProvider();
1442
1456
  const formContext = useFormContext();
1457
+ // Determine the input's value using form context or provided prop value
1443
1458
  const inputValue = createMemo(() => {
1444
- if (!isNullish(formContext?.data?.[context.formName ?? ''])) {
1445
- return formContext.data[context.formName ?? ''];
1459
+ if (!isNullish(props?.value)) {
1460
+ return props.value;
1461
+ }
1462
+ if (!isNullish(formContext?.data?.[context.formName ?? ""])) {
1463
+ return formContext.data[context.formName ?? ""];
1446
1464
  }
1447
1465
  if (!isNullish(context.getValue)) {
1448
1466
  return context.getValue();
1449
1467
  }
1450
1468
  return props.value;
1451
1469
  });
1452
- const hasTrasparent = createMemo(() => {
1453
- return Object.keys(customProps).includes("transparent");
1470
+ const isRequired = createMemo(() => {
1471
+ if (context && formContext) {
1472
+ const key = context?.formName ?? "";
1473
+ return formContext?.formGroup?.hasValidator?.(key, 'required');
1474
+ }
1475
+ return Object.keys(normalProps).includes("required") && props?.required !== false || props?.required === true;
1454
1476
  });
1477
+ // onChange only handles non-checkbox values
1455
1478
  const onChange = e => {
1456
- if (!isNullish(formContext?.setData)) {
1457
- if (props.type === "checkbox") {
1458
- formContext.formGroup.set(context.formName ?? '', e.currentTarget.checked ? "true" : "");
1459
- formContext.setData(old => ({
1460
- ...old,
1461
- [context.formName ?? '']: e.currentTarget.checked ? "true" : ""
1462
- }));
1463
- } else {
1464
- const textInside = !isNullish(e.currentTarget.value) && e.currentTarget.value !== '';
1465
- context.setTextInside(textInside);
1466
- formContext.formGroup.set(context.formName ?? '', e.currentTarget.value);
1467
- formContext.setData(old => ({
1468
- ...old,
1469
- [context.formName ?? '']: e.currentTarget.value
1470
- }));
1471
- }
1472
- } else if (!isNullish(context.getName)) {
1479
+ if (!isNullish(formContext?.setData) && !!formContext?.formGroup?.get) {
1480
+ const textInside = !isNullish(e.currentTarget.value) && e.currentTarget.value?.trim() !== "";
1481
+ context?.setTextInside?.(textInside);
1482
+ formContext.formGroup?.set?.(context.formName ?? "", e.currentTarget.value);
1483
+ formContext?.setData?.(old => ({
1484
+ ...old,
1485
+ [context.formName ?? ""]: e.currentTarget.value
1486
+ }));
1487
+ } else if (!isNullish(context.getName) && !!context?.getName?.()) {
1473
1488
  if (e.currentTarget.value.trim()) {
1474
- context.setValue(e.currentTarget.value);
1489
+ context?.setValue(e.currentTarget.value);
1475
1490
  context.setTextInside(true);
1476
1491
  } else {
1477
- if (props.type === "checkbox") {
1478
- context.setValue(e.currentTarget.checked ? "true" : "");
1479
- context.setTextInside(e.currentTarget.checked);
1480
- } else {
1481
- context.setValue("");
1482
- context.setTextInside(false);
1483
- }
1492
+ context.setValue("");
1493
+ context.setTextInside(false);
1484
1494
  }
1485
1495
  }
1486
1496
  if (props.onChange) props.onChange(e);
1487
1497
  };
1488
1498
  createEffect(() => {
1489
- if (Object.keys(props).includes("required") || props?.required === true) {
1499
+ if (isRequired()) {
1490
1500
  context?.setName?.(old => `${old} *`);
1491
1501
  } else {
1492
1502
  context?.setName?.(old => old);
@@ -1494,9 +1504,10 @@ const Input = props => {
1494
1504
  });
1495
1505
  onMount(() => {
1496
1506
  if (!isNullish(context.getName)) {
1497
- context.setFieldType(props.type ?? "text");
1507
+ // Force a non-checkbox field type
1508
+ context.setFieldType(props.type === "checkbox" ? "text" : props.type ?? "text");
1498
1509
  if (!isNullish(formContext?.data)) {
1499
- const formValue = formContext.data[context.formName ?? ''];
1510
+ const formValue = formContext.data[context.formName ?? ""]?.trim();
1500
1511
  if (formValue) {
1501
1512
  context.setValue(formValue);
1502
1513
  context.setTextInside(true);
@@ -1504,22 +1515,25 @@ const Input = props => {
1504
1515
  }
1505
1516
  }
1506
1517
  });
1507
- const placeholder = createMemo(() => {
1508
- if (!context?.getTextInside?.() && !context?.getFocused?.()) {
1509
- return context?.getName?.() ?? props?.placeholder ?? "";
1518
+ const placeholder = () => {
1519
+ const reqText = isRequired() ? " *" : "";
1520
+ if (context?.getTextInside?.() && !context?.getFocused?.()) {
1521
+ return (context?.getName?.() ?? props?.placeholder ?? "") + reqText;
1510
1522
  }
1511
- return props.placeholder;
1512
- });
1523
+ if (props?.placeholder) {
1524
+ return props.placeholder + reqText;
1525
+ }
1526
+ return "";
1527
+ };
1513
1528
  createEffect(() => {
1514
- const hasInputValue = isNullish(inputValue()) || inputValue() === '';
1515
- if (!isNullish(context) && !hasInputValue !== context?.getTextInside?.()) {
1516
- context?.getTextInside?.();
1529
+ const hasInputValue = isNullish(inputValue()) || inputValue() === "";
1530
+ if (!isNullish(context) && hasInputValue !== context?.getTextInside?.()) {
1517
1531
  context?.getFocused?.();
1518
1532
  context?.setTextInside?.(!hasInputValue);
1519
1533
  }
1520
1534
  });
1521
1535
  return (() => {
1522
- var _el$ = _tmpl$$f();
1536
+ var _el$ = _tmpl$$i();
1523
1537
  spread(_el$, mergeProps(normalProps, {
1524
1538
  get placeholder() {
1525
1539
  return placeholder();
@@ -1527,7 +1541,7 @@ const Input = props => {
1527
1541
  get value() {
1528
1542
  return inputValue();
1529
1543
  },
1530
- "onFocus": e => {
1544
+ "onFocus": () => {
1531
1545
  if (!isNullish(context.getName)) {
1532
1546
  context.setFocused?.(true);
1533
1547
  }
@@ -1536,22 +1550,22 @@ const Input = props => {
1536
1550
  if (!isNullish(context.getName)) {
1537
1551
  context?.setFocused?.(prev => {
1538
1552
  if (prev) {
1539
- formContext?.formGroup?.validate?.(context?.formName ?? '');
1553
+ formContext?.formGroup?.validate?.(context?.formName ?? "");
1540
1554
  }
1541
1555
  return false;
1542
1556
  });
1543
1557
  const noValue = !e.currentTarget?.value?.trim();
1544
- const noFormValue = !formContext?.data?.[context?.formName ?? ''];
1558
+ const noFormValue = !formContext?.data?.[context?.formName ?? ""];
1545
1559
  const noContextValue = !context?.getValue();
1546
- context.setTextInside(!(noValue && noFormValue && noContextValue));
1560
+ context.setTextInside(noValue && noFormValue && noContextValue);
1547
1561
  }
1548
1562
  },
1549
1563
  get type() {
1550
- return createMemo(() => context?.getFieldType?.().length > 0)() ? context?.getFieldType?.() : props.type;
1564
+ return props.type === "checkbox" ? "text" : props.type ?? "text";
1551
1565
  },
1552
1566
  "onChange": onChange,
1553
1567
  get ["class"]() {
1554
- return `${styles$6.input} ${hasTrasparent() && noTransparent(normalProps.type) ? styles$6?.transparent : ""} ${!!context?.getName?.() ? styles$6?.inFormField : ''} ${props?.class ?? ""}`;
1568
+ return `${styles$9.input} ${customProps.transparent ? styles$9.transparent : ""} ${!!context?.getName?.() ? styles$9.inFormField : ""} ${props?.class ?? ""}`;
1555
1569
  },
1556
1570
  get title() {
1557
1571
  return customProps.tooltip;
@@ -1561,16 +1575,163 @@ const Input = props => {
1561
1575
  })();
1562
1576
  };
1563
1577
 
1564
- var css_248z$a = ".selectStyles-module_solid_select__placeholder__VO5-- {\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.selectStyles-module_solid_select__transparent__nOpvm {\n background-color: transparent;\n}\n\n.selectStyles-module_solid_select__3plh1 {\n display: inline-block;\n position: relative;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n text-align: left;\n border-radius: 8px;\n width: 100%;\n margin: 0px 6px;\n}\n\n.selectStyles-module_solid_select__control__Wmmpg {\n display: flex;\n align-items: center;\n width: 100%;\n max-height: 48px;\n border-radius: 8px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n cursor: pointer;\n}\n.selectStyles-module_solid_select__control__Wmmpg:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control__Wmmpg:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__control_no_form__Cq9Sc {\n display: flex;\n align-items: center;\n width: 100%;\n height: 48px;\n border-radius: 8px;\n width: 200px;\n margin-top: 2px;\n cursor: pointer;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__arrow__OPCZo {\n font-size: 0.7em;\n}\n\n.selectStyles-module_solid_select__value__rNtqF {\n flex-grow: 1;\n}\n\n.selectStyles-module_solid_select__dropdown__UCt-N {\n position: absolute;\n background-color: var(--surface-color, #EEEEEE);\n top: 100%;\n left: 0;\n z-index: 999999999999999;\n max-height: 200px;\n border-radius: 8px;\n overflow-x: hidden;\n overflow-y: auto;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\n transform-origin: top;\n transform: scaleY(0);\n transition: transform 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n}\n\n.selectStyles-module_dropTop__IVz9p {\n transform-origin: bottom;\n}\n\n.selectStyles-module_dropBottom__cYJF0 {\n transform-origin: top;\n}\n\n.selectStyles-module_open__f8zLA {\n transform: scaleY(1);\n opacity: 1;\n}\n\n.selectStyles-module_solid_select__option__47WMY {\n padding: 8px;\n cursor: pointer;\n display: flex;\n align-items: center;\n min-height: 32px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n border-radius: 8px;\n}\n.selectStyles-module_solid_select__option__47WMY:hover {\n border: 2px inset var(--primary-color-varient, #43A047);\n}\n.selectStyles-module_solid_select__option__47WMY:has(.selectStyles-module_selected__1-CKm) {\n font-weight: bold;\n}\n\n.selectStyles-module_checkmark__UWcbd {\n display: inline-block;\n width: 1.2em;\n margin-right: 4px;\n text-align: center;\n}\n\n.selectStyles-module_option-label__bBFSW {\n width: -moz-max-content;\n width: max-content;\n height: -moz-max-content;\n height: max-content;\n}";
1565
- var styles$5 = {"solid_select__placeholder":"selectStyles-module_solid_select__placeholder__VO5--","solid_select__transparent":"selectStyles-module_solid_select__transparent__nOpvm","solid_select":"selectStyles-module_solid_select__3plh1","solid_select__control":"selectStyles-module_solid_select__control__Wmmpg","solid_select__control_no_form":"selectStyles-module_solid_select__control_no_form__Cq9Sc","solid_select__arrow":"selectStyles-module_solid_select__arrow__OPCZo","solid_select__value":"selectStyles-module_solid_select__value__rNtqF","solid_select__dropdown":"selectStyles-module_solid_select__dropdown__UCt-N","dropTop":"selectStyles-module_dropTop__IVz9p","dropBottom":"selectStyles-module_dropBottom__cYJF0","open":"selectStyles-module_open__f8zLA","solid_select__option":"selectStyles-module_solid_select__option__47WMY","selected":"selectStyles-module_selected__1-CKm","checkmark":"selectStyles-module_checkmark__UWcbd","option-label":"selectStyles-module_option-label__bBFSW"};
1566
- styleInject(css_248z$a);
1578
+ var css_248z$d = ".checkbox-module_checkbox__LzFLC {\n display: flex;\n align-items: center;\n cursor: pointer;\n width: -moz-fit-content;\n width: fit-content;\n}\n\n.checkbox-module_checkbox--disabled__5PdL7 {\n cursor: not-allowed;\n}\n\n.checkbox-module_checkbox__input__pTELL {\n position: absolute;\n opacity: 0;\n pointer-events: none;\n}\n\n.checkbox-module_checkbox__checkmark__0kdFq {\n position: relative;\n width: 16px;\n height: 16px;\n border: 2px solid #666;\n border-radius: 4px;\n background: transparent;\n margin-right: 0.5em;\n flex-shrink: 0;\n}\n\n.checkbox-module_checkbox__checkmark__0kdFq:after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 5px;\n height: 10px;\n border: solid #fff;\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n display: none;\n}\n\n.checkbox-module_checkbox__input__pTELL:checked + .checkbox-module_checkbox__checkmark__0kdFq {\n background: #007bff;\n border-color: #007bff;\n}\n\n.checkbox-module_checkbox__input__pTELL:checked + .checkbox-module_checkbox__checkmark__0kdFq:after {\n display: block;\n}\n\n.checkbox-module_checkbox__LzFLC:hover .checkbox-module_checkbox__checkmark__0kdFq {\n border-color: #444;\n}\n\n.checkbox-module_checkbox__LzFLC:focus-within .checkbox-module_checkbox__checkmark__0kdFq {\n outline: 2px solid #80bdff;\n outline-offset: 2px;\n}\n\n.checkbox-module_checkbox__label__YXjgj {\n vertical-align: middle;\n}\n\n.checkbox-module_checkbox--disabled__5PdL7 .checkbox-module_checkbox__checkmark__0kdFq {\n border-color: #ccc;\n background: transparent;\n}\n\n.checkbox-module_checkbox--disabled__5PdL7 .checkbox-module_checkbox__checkmark__0kdFq:after {\n border-color: #ccc;\n}\n\n.checkbox-module_checkbox--disabled__5PdL7 .checkbox-module_checkbox__label__YXjgj {\n color: #ccc;\n}";
1579
+ var styles$8 = {"checkbox":"checkbox-module_checkbox__LzFLC","checkbox--disabled":"checkbox-module_checkbox--disabled__5PdL7","checkbox__input":"checkbox-module_checkbox__input__pTELL","checkbox__checkmark":"checkbox-module_checkbox__checkmark__0kdFq","checkbox__label":"checkbox-module_checkbox__label__YXjgj"};
1580
+ styleInject(css_248z$d);
1581
+
1582
+ var _tmpl$$h = /*#__PURE__*/template(`<label><input type=checkbox><span>`),
1583
+ _tmpl$2$9 = /*#__PURE__*/template(`<span>`);
1584
+ function Checkbox(props) {
1585
+ // Handle controlled vs. uncontrolled state
1586
+ const [internalChecked, setInternalChecked] = createSignal(props.defaultChecked ?? false);
1587
+ const checkedState = createMemo(() => props.checked !== undefined ? props.checked : internalChecked());
1588
+ const handleChange = e => {
1589
+ const target = e.currentTarget;
1590
+ const newChecked = target.checked;
1591
+ if (props.checked === undefined) {
1592
+ setInternalChecked(newChecked);
1593
+ }
1594
+ props.onChange?.(newChecked);
1595
+ };
1596
+ return (() => {
1597
+ var _el$ = _tmpl$$h(),
1598
+ _el$2 = _el$.firstChild,
1599
+ _el$3 = _el$2.nextSibling;
1600
+ _el$2.addEventListener("change", handleChange);
1601
+ insert(_el$, (() => {
1602
+ var _c$ = createMemo(() => !!props.label);
1603
+ return () => _c$() && (() => {
1604
+ var _el$4 = _tmpl$2$9();
1605
+ insert(_el$4, () => props.label);
1606
+ createRenderEffect(() => className(_el$4, styles$8["checkbox__label"]));
1607
+ return _el$4;
1608
+ })();
1609
+ })(), null);
1610
+ createRenderEffect(_p$ => {
1611
+ var _v$ = styles$8.checkbox,
1612
+ _v$2 = {
1613
+ [styles$8["checkbox--disabled"]]: props.disabled,
1614
+ [styles$8["checkbox--checked"]]: checkedState()
1615
+ },
1616
+ _v$3 = styles$8["checkbox__input"],
1617
+ _v$4 = props.disabled,
1618
+ _v$5 = props.label ? undefined : props.ariaLabel,
1619
+ _v$6 = styles$8["checkbox__checkmark"];
1620
+ _v$ !== _p$.e && className(_el$, _p$.e = _v$);
1621
+ _p$.t = classList(_el$, _v$2, _p$.t);
1622
+ _v$3 !== _p$.a && className(_el$2, _p$.a = _v$3);
1623
+ _v$4 !== _p$.o && (_el$2.disabled = _p$.o = _v$4);
1624
+ _v$5 !== _p$.i && setAttribute(_el$2, "aria-label", _p$.i = _v$5);
1625
+ _v$6 !== _p$.n && className(_el$3, _p$.n = _v$6);
1626
+ return _p$;
1627
+ }, {
1628
+ e: undefined,
1629
+ t: undefined,
1630
+ a: undefined,
1631
+ o: undefined,
1632
+ i: undefined,
1633
+ n: undefined
1634
+ });
1635
+ createRenderEffect(() => _el$2.checked = checkedState());
1636
+ return _el$;
1637
+ })();
1638
+ }
1639
+
1640
+ var css_248z$c = ".selectStyles-module_solid_select__placeholder__VO5-- {\n opacity: var(--text-emphasis-medium, 87%);\n transition: all 0.7s ease;\n}\n\n.selectStyles-module_solid_select__transparent__nOpvm {\n background-color: transparent;\n}\n\n.selectStyles-module_solid_select__3plh1 {\n display: inline-block;\n position: relative;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n text-align: left;\n border-radius: 8px;\n width: 100%;\n margin: 0px 6px;\n}\n\n.selectStyles-module_solid_select__control__Wmmpg {\n display: flex;\n align-items: center;\n width: 100%;\n max-height: 48px;\n border-radius: 8px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n cursor: pointer;\n transition: border 0.7s ease, padding 0.7s ease;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.selectStyles-module_solid_select__control__Wmmpg:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control__Wmmpg:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__control_no_form__Cq9Sc {\n display: flex;\n align-items: center;\n width: 100%;\n height: 48px;\n border-radius: 8px;\n width: 200px;\n margin-top: 2px;\n cursor: pointer;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__arrow__OPCZo {\n font-size: 0.7em;\n}\n\n.selectStyles-module_solid_select__value__rNtqF {\n flex-grow: 1;\n transition: all 0.3s ease;\n}\n\n.selectStyles-module_solid_select__dropdown__UCt-N {\n position: absolute;\n background-color: var(--surface-color, #EEEEEE);\n top: 100%;\n left: 0;\n z-index: 999999999999999;\n max-height: 200px;\n border-radius: 8px;\n overflow-x: hidden;\n overflow-y: auto;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\n transform-origin: top;\n transform: scaleY(0);\n transition: transform 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n}\n\n.selectStyles-module_dropTop__IVz9p {\n transform-origin: bottom;\n}\n\n.selectStyles-module_dropBottom__cYJF0 {\n transform-origin: top;\n}\n\n.selectStyles-module_open__f8zLA {\n transform: scaleY(1);\n opacity: 1;\n}\n\n.selectStyles-module_solid_select__option__47WMY {\n padding: 8px;\n cursor: pointer;\n display: flex;\n align-items: center;\n min-height: 32px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n border-radius: 8px;\n}\n.selectStyles-module_solid_select__option__47WMY:hover {\n border: 2px inset var(--primary-color-varient, #43A047);\n}\n.selectStyles-module_solid_select__option__47WMY:has(.selectStyles-module_selected__1-CKm) {\n font-weight: bold;\n}\n\n.selectStyles-module_checkmark__UWcbd {\n display: inline-block;\n width: 1.2em;\n margin-right: 4px;\n text-align: center;\n}\n\n.selectStyles-module_option-label__bBFSW {\n width: -moz-max-content;\n width: max-content;\n height: -moz-max-content;\n height: max-content;\n}";
1641
+ var styles$7 = {"solid_select__placeholder":"selectStyles-module_solid_select__placeholder__VO5--","solid_select__transparent":"selectStyles-module_solid_select__transparent__nOpvm","solid_select":"selectStyles-module_solid_select__3plh1","solid_select__control":"selectStyles-module_solid_select__control__Wmmpg","solid_select__control_no_form":"selectStyles-module_solid_select__control_no_form__Cq9Sc","solid_select__arrow":"selectStyles-module_solid_select__arrow__OPCZo","solid_select__value":"selectStyles-module_solid_select__value__rNtqF","solid_select__dropdown":"selectStyles-module_solid_select__dropdown__UCt-N","dropTop":"selectStyles-module_dropTop__IVz9p","dropBottom":"selectStyles-module_dropBottom__cYJF0","open":"selectStyles-module_open__f8zLA","solid_select__option":"selectStyles-module_solid_select__option__47WMY","selected":"selectStyles-module_selected__1-CKm","checkmark":"selectStyles-module_checkmark__UWcbd","option-label":"selectStyles-module_option-label__bBFSW"};
1642
+ styleInject(css_248z$c);
1643
+
1644
+ const manager = new class WinManager {
1645
+ data = [];
1646
+ ignore = [];
1647
+ get entries() {
1648
+ return this.data;
1649
+ }
1650
+ get ignoreElements() {
1651
+ return this.ignore;
1652
+ }
1653
+ register(entry) {
1654
+ this.data.push(entry);
1655
+ }
1656
+ unregister(entry) {
1657
+ const index = this.data.indexOf(entry);
1658
+ if (index !== -1) {
1659
+ this.data.splice(index, 1);
1660
+ }
1661
+ }
1662
+ ignoreElement(element) {
1663
+ this.ignore.push(element);
1664
+ }
1665
+ unignoreElement(element) {
1666
+ const index = this.ignore.indexOf(element);
1667
+ if (index !== -1) {
1668
+ this.ignore.splice(index, 1);
1669
+ }
1670
+ }
1671
+ }();
1672
+ // Register an element along with its click-outside callback.
1673
+ function registerWindowManager(entry) {
1674
+ manager.register(entry);
1675
+ }
1676
+ function getEntryAmount() {
1677
+ return manager.entries.length;
1678
+ }
1679
+ function ignoreWindowManager(element) {
1680
+ manager.ignoreElement(element);
1681
+ }
1682
+ // Unregister the given element.
1683
+ function unregisterWindowManager(entry) {
1684
+ manager.unregister(entry);
1685
+ }
1686
+ // Global event handler that only lets the topmost window close.
1687
+ function handleGlobalClick(e) {
1688
+ if (manager.entries.length === 0) return;
1689
+ // Get the topmost (last registered) entry.
1690
+ const topEntry = manager.entries[manager.entries.length - 1];
1691
+ const toIgnore = manager.ignoreElements;
1692
+ if (toIgnore.length > 0) {
1693
+ for (const el of toIgnore) {
1694
+ if (el.contains(e.target)) {
1695
+ return;
1696
+ }
1697
+ }
1698
+ }
1699
+ // If the click target is not inside the top entry element, trigger its callback.
1700
+ if (!topEntry.element.contains(e.target)) {
1701
+ topEntry.onClickOutside(e);
1702
+ unregisterWindowManager(topEntry);
1703
+ }
1704
+ }
1705
+ // Attach the global event listeners in capture phase.
1706
+ if (typeof document !== 'undefined') {
1707
+ document.addEventListener('mousedown', handleGlobalClick, true);
1708
+ document.addEventListener('touchstart', handleGlobalClick, true);
1709
+ }
1710
+
1711
+ const SelectContext = createContext({});
1712
+ const useSelectContext = () => {
1713
+ const context = useContext(SelectContext);
1714
+ if (!context) {
1715
+ throw new Error("<Select> must be used within a <SelectContext.Provider>");
1716
+ }
1717
+ return context;
1718
+ };
1719
+ const SelectContextProvider = props => {
1720
+ return createComponent(SelectContext.Provider, {
1721
+ get value() {
1722
+ return props.value;
1723
+ },
1724
+ get children() {
1725
+ return props.children;
1726
+ }
1727
+ });
1728
+ };
1567
1729
 
1568
- var _tmpl$$e = /*#__PURE__*/template(`<span>`),
1569
- _tmpl$2$7 = /*#__PURE__*/template(`<span>▲`),
1730
+ var _tmpl$$g = /*#__PURE__*/template(`<span>`),
1731
+ _tmpl$2$8 = /*#__PURE__*/template(`<span>▲`),
1570
1732
  _tmpl$3$2 = /*#__PURE__*/template(`<span>▼`),
1571
1733
  _tmpl$4$1 = /*#__PURE__*/template(`<div>`),
1572
- _tmpl$5$1 = /*#__PURE__*/template(`<div is=coles-solid-select tabindex=0><div><span>`, true, false, false);
1573
- const SelectContext = createContext();
1734
+ _tmpl$5$1 = /*#__PURE__*/template(`<div is=coles-solid-select role=button aria-haspopup=listbox tabindex=0><div><span>`, true, false, false);
1574
1735
  function Select(props) {
1575
1736
  const isMultiple = Object.keys(props).includes("multiple") || props.multiple === true;
1576
1737
  const [placeholder, setPlaceholder] = createSignal(props?.placeholder ?? "Select...");
@@ -1617,6 +1778,7 @@ function Select(props) {
1617
1778
  // Function to handle selecting/toggling an option for single or multi-select
1618
1779
  // When not using a form or greater FormContext
1619
1780
  const selectValue = val => {
1781
+ console.log("selectValue", val);
1620
1782
  if (isMultiple) {
1621
1783
  // For multi-select, toggle the value in the array
1622
1784
  const current = props?.value ?? [];
@@ -1628,9 +1790,11 @@ function Select(props) {
1628
1790
  }
1629
1791
  setSelected(() => newSelected);
1630
1792
  props?.onChange?.(newSelected);
1793
+ props?.onSelect?.(newSelected);
1631
1794
  } else {
1632
1795
  setSelected(() => val);
1633
1796
  props?.onChange?.(val);
1797
+ props?.onSelect?.(val);
1634
1798
  setOpen(false);
1635
1799
  }
1636
1800
  };
@@ -1642,16 +1806,16 @@ function Select(props) {
1642
1806
  if (selectedArray.length === 0) {
1643
1807
  if (hasForm && form.getTextInside() && !form.getFocused()) {
1644
1808
  return (() => {
1645
- var _el$ = _tmpl$$e();
1646
- insert(_el$, () => form.getName() || props.placeholder || "Select...");
1647
- createRenderEffect(() => className(_el$, `${styles$5["solid_select__placeholder"]}`));
1809
+ var _el$ = _tmpl$$g();
1810
+ _el$.style.setProperty("opacity", "0");
1811
+ createRenderEffect(() => className(_el$, `${styles$7["solid_select__placeholder"]}`));
1648
1812
  return _el$;
1649
1813
  })();
1650
1814
  }
1651
1815
  return (() => {
1652
- var _el$2 = _tmpl$$e();
1816
+ var _el$2 = _tmpl$$g();
1653
1817
  insert(_el$2, () => props.placeholder || "Select...");
1654
- createRenderEffect(() => className(_el$2, `${styles$5["solid_select__placeholder"]}`));
1818
+ createRenderEffect(() => className(_el$2, `${styles$7["solid_select__placeholder"]}`));
1655
1819
  return _el$2;
1656
1820
  })();
1657
1821
  }
@@ -1660,8 +1824,9 @@ function Select(props) {
1660
1824
  } else {
1661
1825
  const labels = selectedArray.map(val => optionsMap.get(val) || String(val));
1662
1826
  return (() => {
1663
- var _el$3 = _tmpl$$e();
1827
+ var _el$3 = _tmpl$$g();
1664
1828
  insert(_el$3, () => labels.join(", "));
1829
+ createRenderEffect(() => className(_el$3, `${styles$7["solid_select__value"]}`));
1665
1830
  return _el$3;
1666
1831
  })();
1667
1832
  }
@@ -1671,16 +1836,15 @@ function Select(props) {
1671
1836
  if (isNullish(singleVal) || typeof singleVal === "string" && !!!singleVal.trim()) {
1672
1837
  if (hasForm && form.getTextInside() && !form.getFocused()) {
1673
1838
  return (() => {
1674
- var _el$4 = _tmpl$$e();
1675
- insert(_el$4, () => form.getName() || props.placeholder || "Select...");
1676
- createRenderEffect(() => className(_el$4, `${styles$5["solid_select__placeholder"]}`));
1839
+ var _el$4 = _tmpl$$g();
1840
+ createRenderEffect(() => className(_el$4, `${styles$7["solid_select__placeholder"]}`));
1677
1841
  return _el$4;
1678
1842
  })();
1679
1843
  }
1680
1844
  return (() => {
1681
- var _el$5 = _tmpl$$e();
1845
+ var _el$5 = _tmpl$$g();
1682
1846
  insert(_el$5, () => props.placeholder || "Select...");
1683
- createRenderEffect(() => className(_el$5, `${styles$5["solid_select__placeholder"]}`));
1847
+ createRenderEffect(() => className(_el$5, `${styles$7["solid_select__placeholder"]}`));
1684
1848
  return _el$5;
1685
1849
  })();
1686
1850
  } else if (props.renderValue) {
@@ -1688,8 +1852,9 @@ function Select(props) {
1688
1852
  } else {
1689
1853
  const label = optionsMap.get(singleVal) || String(singleVal);
1690
1854
  return (() => {
1691
- var _el$6 = _tmpl$$e();
1855
+ var _el$6 = _tmpl$$g();
1692
1856
  insert(_el$6, label);
1857
+ createRenderEffect(() => className(_el$6, `${styles$7["solid_select__value"]}`));
1693
1858
  return _el$6;
1694
1859
  })();
1695
1860
  }
@@ -1703,9 +1868,11 @@ function Select(props) {
1703
1868
  }
1704
1869
  return false;
1705
1870
  };
1706
- const selectLocation = () => {
1707
- if (menuLocRef()) {
1708
- const rect = menuLocRef().getBoundingClientRect();
1871
+ const [menuRect, setMenuRect] = createSignal();
1872
+ const selectLocation = createMemo(() => {
1873
+ const select = selectRef();
1874
+ const menuLoc = menuLocRef();
1875
+ const getLocation = rect => {
1709
1876
  if (dropdownBelowScreen()) {
1710
1877
  return {
1711
1878
  x: rect.left,
@@ -1716,11 +1883,41 @@ function Select(props) {
1716
1883
  x: rect.left,
1717
1884
  y: rect.bottom
1718
1885
  };
1886
+ };
1887
+ if (hasForm || hasFormContext) {
1888
+ if (menuLoc) {
1889
+ const rect = menuRect() ?? menuLoc.getBoundingClientRect();
1890
+ return getLocation(rect);
1891
+ } else if (select) {
1892
+ const rect = select.getBoundingClientRect();
1893
+ return getLocation(rect);
1894
+ }
1895
+ } else {
1896
+ if (select) {
1897
+ const rect = select.getBoundingClientRect();
1898
+ return getLocation(rect);
1899
+ }
1719
1900
  }
1720
1901
  return {
1721
1902
  x: 0,
1722
1903
  y: 0
1723
1904
  };
1905
+ });
1906
+ const updatePosition = () => {
1907
+ const menuLoc = dropdownRef();
1908
+ const select = selectRef();
1909
+ if (menuLoc && select) {
1910
+ const selectRect = select.getBoundingClientRect();
1911
+ const dropdownRect = menuLoc.getBoundingClientRect();
1912
+ let newX = selectRect.left + window.scrollX;
1913
+ let newY = selectRect.bottom + window.scrollY;
1914
+ if (selectRect.bottom + dropdownRect.height > window.innerHeight) {
1915
+ newY = selectRect.top + window.scrollY - dropdownRect.height;
1916
+ }
1917
+ menuLoc.style.left = `${newX}px`;
1918
+ menuLoc.style.top = `${newY}px`;
1919
+ menuLoc.style.width = `${selectRect.width}px`;
1920
+ }
1724
1921
  };
1725
1922
  // Update width of select to match option text width
1726
1923
  createEffect(() => {
@@ -1764,6 +1961,7 @@ function Select(props) {
1764
1961
  });
1765
1962
  });
1766
1963
  onMount(() => {
1964
+ setMenuRect(menuLocRef()?.getBoundingClientRect());
1767
1965
  if (hasForm) {
1768
1966
  const formValue = currentValue() ?? isMultiple ? [] : undefined;
1769
1967
  const typedFormValue = isMultiple ? formValue : formValue;
@@ -1789,33 +1987,59 @@ function Select(props) {
1789
1987
  }
1790
1988
  }
1791
1989
  }
1990
+ const dropdown = dropdownRef();
1991
+ if (dropdown) {
1992
+ ignoreWindowManager(dropdown);
1993
+ }
1994
+ document.addEventListener('scroll', updatePosition, true);
1995
+ window.addEventListener('resize', updatePosition);
1996
+ onCleanup(() => {
1997
+ document.removeEventListener('scroll', updatePosition, true);
1998
+ window.removeEventListener('resize', updatePosition);
1999
+ });
1792
2000
  });
2001
+ children(() => props.children);
2002
+ const selectDropX = createMemo(() => `${selectLocation().x}px`);
2003
+ const selectDropY = createMemo(() => `${selectLocation().y}px`);
2004
+ const providerValue = createMemo(() => ({
2005
+ isSelected,
2006
+ selectValue,
2007
+ registerOption,
2008
+ unregisterOption,
2009
+ selectRef,
2010
+ selectStyle: currStyle
2011
+ }));
1793
2012
  return (() => {
1794
2013
  var _el$7 = _tmpl$5$1(),
1795
2014
  _el$8 = _el$7.firstChild,
1796
2015
  _el$9 = _el$8.firstChild;
1797
2016
  _el$7.$$keydown = e => {
1798
- // (Optional) keyboard support for navigation can be added here
1799
- if (e.key === "Escape") setOpen(false);
2017
+ if (e.key === "ArrowDown") {
2018
+ // Open dropdown if not open and set highlightedIndex to 0
2019
+ if (!open()) {
2020
+ setOpen(true);
2021
+ // set highlightedIndex(0);
2022
+ }
2023
+ } else if (e.key === "ArrowUp") ; else if (e.key === "Enter") ; else if (e.key === "Escape") {
2024
+ setOpen(false);
2025
+ }
1800
2026
  };
1801
2027
  _el$7.addEventListener("focus", () => form?.setFocused?.(true));
1802
2028
  _el$7._$owner = getOwner();
1803
2029
  _el$8.$$click = e => {
2030
+ const menuRect = menuLocRef()?.getBoundingClientRect();
2031
+ setMenuRect(menuRect);
1804
2032
  setOpen(old => !old);
1805
2033
  };
1806
2034
  use(setSelectRef, _el$8);
1807
- _el$9.$$click = e => {
1808
- setOpen(old => !old);
1809
- e.stopPropagation();
1810
- };
1811
2035
  insert(_el$9, displayValue);
1812
2036
  insert(_el$8, createComponent(Show, {
1813
2037
  get when() {
1814
2038
  return open();
1815
2039
  },
1816
2040
  get children() {
1817
- var _el$10 = _tmpl$2$7();
1818
- createRenderEffect(() => className(_el$10, styles$5['solid_select__arrow']));
2041
+ var _el$10 = _tmpl$2$8();
2042
+ createRenderEffect(() => className(_el$10, styles$7['solid_select__arrow']));
1819
2043
  return _el$10;
1820
2044
  }
1821
2045
  }), null);
@@ -1825,18 +2049,13 @@ function Select(props) {
1825
2049
  },
1826
2050
  get children() {
1827
2051
  var _el$11 = _tmpl$3$2();
1828
- createRenderEffect(() => className(_el$11, styles$5['solid_select__arrow']));
2052
+ createRenderEffect(() => className(_el$11, styles$7['solid_select__arrow']));
1829
2053
  return _el$11;
1830
2054
  }
1831
2055
  }), null);
1832
- insert(_el$7, createComponent(SelectContext.Provider, {
1833
- value: {
1834
- isSelected,
1835
- selectValue,
1836
- registerOption,
1837
- unregisterOption,
1838
- selectRef,
1839
- selectStyle: currStyle
2056
+ insert(_el$7, createComponent(SelectContextProvider, {
2057
+ get value() {
2058
+ return providerValue();
1840
2059
  },
1841
2060
  get children() {
1842
2061
  return createComponent(Portal, {
@@ -1845,9 +2064,9 @@ function Select(props) {
1845
2064
  use(setDropdownRef, _el$12);
1846
2065
  insert(_el$12, () => props.children);
1847
2066
  createRenderEffect(_p$ => {
1848
- var _v$ = `${styles$5['solid_select__dropdown']} ${dropdownBelowScreen() ? styles$5.dropTop : styles$5.dropBottom} ${open() ? styles$5.open : ''} ${props.dropdownClass || ""}`,
1849
- _v$2 = `${selectLocation().y}px`,
1850
- _v$3 = `${selectLocation().x}px`,
2067
+ var _v$ = `${styles$7['solid_select__dropdown']} ${dropdownBelowScreen() ? styles$7.dropTop : styles$7.dropBottom} ${open() ? styles$7.open : ''} ${props.dropdownClass || ""}`,
2068
+ _v$2 = selectDropY(),
2069
+ _v$3 = selectDropX(),
1851
2070
  _v$4 = `${menuLocRef()?.getBoundingClientRect().width ?? 100}px !important`;
1852
2071
  _v$ !== _p$.e && className(_el$12, _p$.e = _v$);
1853
2072
  _v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$12.style.setProperty("top", _v$2) : _el$12.style.removeProperty("top"));
@@ -1867,19 +2086,21 @@ function Select(props) {
1867
2086
  }), null);
1868
2087
  createRenderEffect(_p$ => {
1869
2088
  var _v$5 = props.id,
1870
- _v$6 = `${styles$5.solid_select__control_no_form} ${styles$5[styleClassTransparent]} coles-solid-selectControl`,
1871
- _v$7 = props.tooltip,
1872
- _v$8 = `${styles$5['solid_select__control']} ${props.class || ""}`,
1873
- _v$9 = !hasForm ? {
2089
+ _v$6 = `${styles$7.solid_select__control_no_form} ${styles$7[styleClassTransparent]} coles-solid-selectControl`,
2090
+ _v$7 = open(),
2091
+ _v$8 = props.tooltip,
2092
+ _v$9 = `${styles$7['solid_select__control']} ${props.class || ""}`,
2093
+ _v$10 = !hasForm ? {
1874
2094
  height: '48px'
1875
2095
  } : {},
1876
- _v$10 = styles$5['solid_select__value'];
2096
+ _v$11 = styles$7['solid_select__value'];
1877
2097
  _v$5 !== _p$.e && (_el$7.id = _p$.e = _v$5);
1878
2098
  _v$6 !== _p$.t && className(_el$7, _p$.t = _v$6);
1879
- _v$7 !== _p$.a && (_el$7.title = _p$.a = _v$7);
1880
- _v$8 !== _p$.o && className(_el$8, _p$.o = _v$8);
1881
- _p$.i = style$9(_el$8, _v$9, _p$.i);
1882
- _v$10 !== _p$.n && className(_el$9, _p$.n = _v$10);
2099
+ _v$7 !== _p$.a && (_el$7.ariaExpanded = _p$.a = _v$7);
2100
+ _v$8 !== _p$.o && (_el$7.title = _p$.o = _v$8);
2101
+ _v$9 !== _p$.i && className(_el$8, _p$.i = _v$9);
2102
+ _p$.n = style$9(_el$8, _v$10, _p$.n);
2103
+ _v$11 !== _p$.s && className(_el$9, _p$.s = _v$11);
1883
2104
  return _p$;
1884
2105
  }, {
1885
2106
  e: undefined,
@@ -1887,22 +2108,22 @@ function Select(props) {
1887
2108
  a: undefined,
1888
2109
  o: undefined,
1889
2110
  i: undefined,
1890
- n: undefined
2111
+ n: undefined,
2112
+ s: undefined
1891
2113
  });
1892
2114
  return _el$7;
1893
2115
  })();
1894
2116
  }
1895
2117
  delegateEvents(["keydown", "click"]);
1896
2118
 
1897
- var _tmpl$$d = /*#__PURE__*/template(`<div><span></span><span is=coles-select-label>`, true, false, false);
2119
+ var _tmpl$$f = /*#__PURE__*/template(`<div role=option><span></span><span is=coles-select-label>`, true, false, false);
1898
2120
  function Option(props) {
1899
- const select = useContext(SelectContext);
1900
- if (!select) {
1901
- throw new Error("<Option> must be used within a <Select>");
1902
- }
1903
2121
  const formField = useFormProvider();
1904
2122
  const formContext = useFormContext();
1905
- onMount(() => select.registerOption?.(props.value, props.children));
2123
+ const select = useSelectContext();
2124
+ onMount(() => {
2125
+ select.registerOption?.(props.value, props.children);
2126
+ });
1906
2127
  onCleanup(() => select.unregisterOption?.(props.value));
1907
2128
  const selectFormFieldValue = value => {
1908
2129
  if (!!formField?.getName?.()) {
@@ -1963,211 +2184,48 @@ function Option(props) {
1963
2184
  const contextSuccess = selectFormContextValue(props.value);
1964
2185
  !contextSuccess ? selectFormFieldValue(props.value) : true;
1965
2186
  if (!formField?.getName?.()) {
2187
+ console.log('selected!', props.value, select);
1966
2188
  select.selectValue?.(props.value);
1967
2189
  formField?.setFocused?.(true);
1968
2190
  }
1969
2191
  };
1970
2192
  return (() => {
1971
- var _el$ = _tmpl$$d(),
2193
+ var _el$ = _tmpl$$f(),
1972
2194
  _el$2 = _el$.firstChild,
1973
2195
  _el$3 = _el$2.nextSibling;
1974
2196
  _el$.$$click = handleClick;
1975
- insert(_el$2, () => select.isSelected(props.value) ? "✓" : "");
2197
+ insert(_el$2, () => select?.isSelected?.(props.value) ?? false ? "✓" : "");
1976
2198
  _el$3._$owner = getOwner();
1977
2199
  insert(_el$3, () => props.children ?? "");
1978
2200
  createRenderEffect(_p$ => {
1979
- var _v$ = `${styles$5['solid_select__option']} ${props.class || ""}`,
1980
- _v$2 = !!select.isSelected(props.value),
1981
- _v$3 = `${styles$5['checkmark']}`,
1982
- _v$4 = `${styles$5['option-label']}`;
1983
- _v$ !== _p$.e && className(_el$, _p$.e = _v$);
1984
- _v$2 !== _p$.t && _el$.classList.toggle("selected", _p$.t = _v$2);
1985
- _v$3 !== _p$.a && className(_el$2, _p$.a = _v$3);
1986
- _v$4 !== _p$.o && className(_el$3, _p$.o = _v$4);
2201
+ var _v$ = select?.isSelected?.(props.value) ?? false,
2202
+ _v$2 = `${styles$7['solid_select__option']} ${props.class || ""}`,
2203
+ _v$3 = !!(select?.isSelected?.(props.value) ?? false),
2204
+ _v$4 = `${styles$7['checkmark']}`,
2205
+ _v$5 = `${styles$7['option-label']}`;
2206
+ _v$ !== _p$.e && setAttribute(_el$, "aria-selected", _p$.e = _v$);
2207
+ _v$2 !== _p$.t && className(_el$, _p$.t = _v$2);
2208
+ _v$3 !== _p$.a && _el$.classList.toggle("selected", _p$.a = _v$3);
2209
+ _v$4 !== _p$.o && className(_el$2, _p$.o = _v$4);
2210
+ _v$5 !== _p$.i && className(_el$3, _p$.i = _v$5);
1987
2211
  return _p$;
1988
2212
  }, {
1989
2213
  e: undefined,
1990
2214
  t: undefined,
1991
2215
  a: undefined,
1992
- o: undefined
2216
+ o: undefined,
2217
+ i: undefined
1993
2218
  });
1994
2219
  return _el$;
1995
2220
  })();
1996
2221
  }
1997
2222
  delegateEvents(["click"]);
1998
2223
 
1999
- var css_248z$9 = ".snackbar-module_snack__Dkcmp {\n position: fixed;\n bottom: 10px;\n left: 45vw;\n right: 45vw;\n border-radius: 15px;\n margin: 0;\n padding: 0;\n z-index: 9999;\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n max-width: 10vw;\n padding: 5px;\n}\n@media screen and (max-width: 768px) {\n .snackbar-module_snack__Dkcmp {\n left: 8vw;\n right: 8vw;\n bottom: 20vh;\n max-width: 70vw;\n }\n}\n.snackbar-module_snack__Dkcmp span {\n flex-grow: 1;\n margin: auto 0;\n text-wrap: wrap;\n}\n.snackbar-module_snack__Dkcmp button {\n margin: auto 0;\n}\n\n.snackbar-module_error__7IShA {\n border: 2px solid var(--error-color, #B00020);\n font-weight: bold;\n}\n\n.snackbar-module_success__JPkNY {\n border-color: #4caf50;\n border: 2px solid #4caf50;\n color: #4caf50;\n}\n\n.snackbar-module_info__52mgJ {\n border: 2px solid var(--secondary-color, #14b9c3);\n}\n\n.snackbar-module_warning__K1oCK {\n border-color: #ff9800;\n border: 2px solid #ff9800;\n color: #ff9800;\n}\n\n.snackbar-module_open__Bdhg1 {\n animation: snackbar-module_slideIn__aM-2K 0.5s forwards;\n}\n\n.snackbar-module_close__-JXxs {\n animation: snackbar-module_slideOut__6sQkv 0.5s forwards;\n}\n\n.snackbar-module_primary__j2zPB {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.snackbar-module_primary__j2zPB:hover {\n cursor: pointer;\n}";
2000
- var style$4 = {"snack":"snackbar-module_snack__Dkcmp","error":"snackbar-module_error__7IShA","success":"snackbar-module_success__JPkNY","info":"snackbar-module_info__52mgJ","warning":"snackbar-module_warning__K1oCK","open":"snackbar-module_open__Bdhg1","slideIn":"snackbar-module_slideIn__aM-2K","close":"snackbar-module_close__-JXxs","slideOut":"snackbar-module_slideOut__6sQkv","primary":"snackbar-module_primary__j2zPB"};
2001
- styleInject(css_248z$9);
2002
-
2003
- var _tmpl$$c = /*#__PURE__*/template(`<div>`),
2004
- _tmpl$2$6 = /*#__PURE__*/template(`<div><span>`);
2005
- const [snackbars, setSnackbars] = createSignal([]);
2006
- const addSnackbar = snack => {
2007
- setSnackbars(old => [...old, snack]);
2008
- };
2009
- const removeSnackbar = index => {
2010
- setSnackbars(old => old.filter((_, i) => i !== index));
2011
- };
2012
- const SnackbarController = () => {
2013
- return createComponent(Show, {
2014
- get when() {
2015
- return snackbars().length > 0;
2016
- },
2017
- get children() {
2018
- var _el$ = _tmpl$$c();
2019
- insert(_el$, createComponent(For, {
2020
- get each() {
2021
- return snackbars();
2022
- },
2023
- children: (snack, index) => createComponent(Snackbar, mergeProps(snack, {
2024
- get index() {
2025
- return index();
2026
- },
2027
- onClose: () => removeSnackbar(index())
2028
- }))
2029
- }));
2030
- createRenderEffect(() => className(_el$, style$4.snackContainer));
2031
- return _el$;
2032
- }
2033
- });
2034
- };
2035
- const Snackbar = props => {
2036
- const [isOpen, setIsOpen] = createSignal(true);
2037
- if (props.closeTimeout) setTimeout(() => props.onClose(), props.closeTimeout);
2038
- if (!props.closeTimeout) setTimeout(() => props.onClose(), 5000);
2039
- const messageLength = Math.floor(props.message.length / 17);
2040
- return createComponent(Portal, {
2041
- get mount() {
2042
- return document.body;
2043
- },
2044
- get children() {
2045
- return createComponent(Show, {
2046
- get when() {
2047
- return isOpen();
2048
- },
2049
- get children() {
2050
- var _el$2 = _tmpl$2$6(),
2051
- _el$3 = _el$2.firstChild;
2052
- insert(_el$3, () => props.message);
2053
- insert(_el$2, createComponent(Button, {
2054
- get onClick() {
2055
- return props.onClose;
2056
- },
2057
- children: "X"
2058
- }), null);
2059
- createRenderEffect(_p$ => {
2060
- var _v$ = `${10 + props.index * (50 + messageLength * 8)}px`,
2061
- _v$2 = `${style$4.primary} ${style$4.snack} ${style$4[props.severity ?? 'info']}`;
2062
- _v$ !== _p$.e && ((_p$.e = _v$) != null ? _el$2.style.setProperty("bottom", _v$) : _el$2.style.removeProperty("bottom"));
2063
- _v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
2064
- return _p$;
2065
- }, {
2066
- e: undefined,
2067
- t: undefined
2068
- });
2069
- return _el$2;
2070
- }
2071
- });
2072
- }
2073
- });
2074
- };
2075
-
2076
- var css_248z$8 = ".popup-module_popup__Oeq7F {\n padding: 0px;\n padding-top: 8px;\n padding-bottom: 8px;\n overflow: hidden;\n position: fixed;\n top: 50%;\n left: 50%;\n border: var(--primary-color, #4CAF50) 1px solid;\n border-radius: 8px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n z-index: 1000;\n text-align: center;\n}\n\n.popup-module_wrapper__S7cXt {\n padding: 0px;\n overflow-y: hidden;\n padding-bottom: 5px;\n display: flex;\n flex-direction: column;\n}\n.popup-module_wrapper__S7cXt :not(span):nth-child(2) {\n margin-top: 5%;\n height: 95%;\n flex-grow: 1;\n overflow-y: auto;\n}\n\n.popup-module_header__aKiI0 {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: 5%;\n overflow-y: hidden;\n padding: 5px;\n min-height: 2em;\n}\n.popup-module_header__aKiI0 button {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n}\n.popup-module_header__aKiI0 h2 {\n text-align: left;\n margin-left: 5%;\n flex-grow: 1;\n padding: 0px;\n padding-bottom: 5px;\n margin: 0px;\n margin-left: 1em;\n}\n.popup-module_header__aKiI0 span {\n flex-shrink: 0;\n width: -moz-min-content;\n width: min-content;\n height: -moz-min-content;\n height: min-content;\n}\n.popup-module_header__aKiI0 span button:hover {\n cursor: pointer;\n}\n\n.popup-module_body__ouRAt {\n flex-grow: 1;\n}\n\n.popup-module_tertiary__69E41, .popup-module_accent__AzLZ1, .popup-module_primary__tm77N {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}";
2077
- var style$3 = {"popup":"popup-module_popup__Oeq7F","wrapper":"popup-module_wrapper__S7cXt","header":"popup-module_header__aKiI0","body":"popup-module_body__ouRAt","primary":"popup-module_primary__tm77N"};
2078
- styleInject(css_248z$8);
2079
-
2080
- var _tmpl$$b = /*#__PURE__*/template(`<b>X`),
2081
- _tmpl$2$5 = /*#__PURE__*/template(`<div><div><h2></h2><span></span></div><div>`);
2082
- const Modal = props => {
2083
- const defaultX = props.translate?.x ?? "-50%";
2084
- const defaultY = props.translate?.y ?? "-50%";
2085
- const [popupRef, setPopupRef] = createSignal();
2086
- // Flag to ignore the click that triggered opening the modal.
2087
- const [ignoreFirstClick, setIgnoreFirstClick] = createSignal(true);
2088
- const isShown = createMemo(() => props.show[0]());
2089
- // When the modal becomes visible, set the flag and clear it on the next tick.
2090
- createEffect(() => {
2091
- if (isShown()) {
2092
- setIgnoreFirstClick(true);
2093
- // Use a 0ms timeout to clear the flag after the current event loop.
2094
- setTimeout(() => setIgnoreFirstClick(false), 0);
2095
- }
2096
- });
2097
- const clickOutside = e => {
2098
- // Only process if modal is visible and we're not in the first click.
2099
- if (!props.show[0]() || ignoreFirstClick()) return;
2100
- const popupBox = popupRef()?.getBoundingClientRect();
2101
- if (!isNullish(popupBox)) {
2102
- const outLeft = e.clientX < popupBox.left;
2103
- const outRight = e.clientX > popupBox.right;
2104
- const outTop = e.clientY < popupBox.top;
2105
- const outBottom = e.clientY > popupBox.bottom;
2106
- if (outLeft || outRight || outTop || outBottom) {
2107
- props.show[1](false);
2108
- }
2109
- }
2110
- };
2111
- onMount(() => {
2112
- document.addEventListener("click", clickOutside);
2113
- });
2114
- onCleanup(() => {
2115
- document.removeEventListener("click", clickOutside);
2116
- });
2117
- return createComponent(Show, {
2118
- get when() {
2119
- return isShown();
2120
- },
2121
- get children() {
2122
- return createComponent(Portal, {
2123
- get children() {
2124
- var _el$ = _tmpl$2$5(),
2125
- _el$2 = _el$.firstChild,
2126
- _el$3 = _el$2.firstChild,
2127
- _el$4 = _el$3.nextSibling,
2128
- _el$6 = _el$2.nextSibling;
2129
- use(el => setPopupRef(el), _el$);
2130
- `translate(${defaultX}, ${defaultY})` != null ? _el$.style.setProperty("transform", `translate(${defaultX}, ${defaultY})`) : _el$.style.removeProperty("transform");
2131
- insert(_el$3, () => props.title ?? "Modal");
2132
- insert(_el$4, createComponent(Button, {
2133
- transparent: true,
2134
- onClick: () => props.show[1](old => !old),
2135
- get children() {
2136
- return _tmpl$$b();
2137
- }
2138
- }));
2139
- insert(_el$6, () => props.children);
2140
- createRenderEffect(_p$ => {
2141
- var _v$ = props.width ? props.width : isMobile() ? "90vw" : "45vw",
2142
- _v$2 = props.height ? props.height : isMobile() ? "90vh" : "60vh",
2143
- _v$3 = `${style$3["primary"]} ${style$3.wrapper} ${style$3.popup}`,
2144
- _v$4 = style$3.header,
2145
- _v$5 = style$3.body;
2146
- _v$ !== _p$.e && ((_p$.e = _v$) != null ? _el$.style.setProperty("width", _v$) : _el$.style.removeProperty("width"));
2147
- _v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("height", _v$2) : _el$.style.removeProperty("height"));
2148
- _v$3 !== _p$.a && className(_el$, _p$.a = _v$3);
2149
- _v$4 !== _p$.o && className(_el$2, _p$.o = _v$4);
2150
- _v$5 !== _p$.i && className(_el$6, _p$.i = _v$5);
2151
- return _p$;
2152
- }, {
2153
- e: undefined,
2154
- t: undefined,
2155
- a: undefined,
2156
- o: undefined,
2157
- i: undefined
2158
- });
2159
- return _el$;
2160
- }
2161
- });
2162
- }
2163
- });
2164
- };
2165
-
2166
- var css_248z$7 = ".TextArea-module_areaStyle__AshKi {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n padding: 0.5rem;\n margin-right: calc(var(--spacing-1, 8px) / 2);\n border: 1px solid #ccc;\n border-radius: var(--border-radius-md, 6px);\n width: 98%;\n height: 100%;\n resize: none;\n}\n@media screen and (max-width: 768px) {\n .TextArea-module_areaStyle__AshKi {\n width: 90%;\n }\n}\n.TextArea-module_areaStyle__AshKi::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.TextArea-module_areaStyle__AshKi::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.TextArea-module_picButton__TV9ZE {\n padding: calc(var(--spacing-1, 8px) / 2) var(--spacing-1, 8px) !important;\n background-color: transparent;\n border-top: 1px solid white;\n border-bottom: 1px solid white;\n}\n\n.TextArea-module_transparent__pwXRO {\n background-color: transparent;\n border: none;\n color: white;\n padding: 0.5rem;\n width: inherit;\n height: 100%;\n resize: none;\n}\n.TextArea-module_transparent__pwXRO:focus {\n outline: none;\n border: none;\n}";
2167
- var style$2 = {"areaStyle":"TextArea-module_areaStyle__AshKi"};
2168
- styleInject(css_248z$7);
2224
+ var css_248z$b = ".TextArea-module_areaStyle__AshKi {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n padding: 0.5rem;\n margin-right: calc(var(--spacing-1, 8px) / 2);\n border: 1px solid #ccc;\n border-radius: var(--border-radius-md, 6px);\n width: 98%;\n height: 100%;\n resize: none;\n}\n@media screen and (max-width: 768px) {\n .TextArea-module_areaStyle__AshKi {\n width: 90%;\n }\n}\n.TextArea-module_areaStyle__AshKi::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.TextArea-module_areaStyle__AshKi::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.TextArea-module_picButton__TV9ZE {\n padding: calc(var(--spacing-1, 8px) / 2) var(--spacing-1, 8px) !important;\n background-color: transparent;\n border-top: 1px solid white;\n border-bottom: 1px solid white;\n}\n\n.TextArea-module_transparent__pwXRO {\n background-color: transparent;\n border: none;\n color: white;\n padding: 0.5rem;\n width: inherit;\n height: 100%;\n resize: none;\n}\n.TextArea-module_transparent__pwXRO:focus {\n outline: none;\n border: none;\n}";
2225
+ var style$4 = {"areaStyle":"TextArea-module_areaStyle__AshKi"};
2226
+ styleInject(css_248z$b);
2169
2227
 
2170
- var _tmpl$$a = /*#__PURE__*/template(`<textarea>`);
2228
+ var _tmpl$$e = /*#__PURE__*/template(`<textarea>`);
2171
2229
  const TextArea = props => {
2172
2230
  let myElement;
2173
2231
  const [customProps, normalProps] = splitProps(props, ["minSize", "text", "setText", "class", "tooltip", "transparent"]);
@@ -2202,7 +2260,7 @@ const TextArea = props => {
2202
2260
  }
2203
2261
  });
2204
2262
  return (() => {
2205
- var _el$ = _tmpl$$a();
2263
+ var _el$ = _tmpl$$e();
2206
2264
  use(el => {
2207
2265
  myElement = el;
2208
2266
  OnInput();
@@ -2219,10 +2277,10 @@ const TextArea = props => {
2219
2277
  }
2220
2278
  },
2221
2279
  get placeholder() {
2222
- return createMemo(() => !!(!!context.getName && context.getTextInside() && !context.getFocused()))() ? context.getName() : props.placeholder;
2280
+ return !!context.getName && context.getTextInside() && !context.getFocused() ? "" : props.placeholder;
2223
2281
  },
2224
2282
  get ["class"]() {
2225
- return `${style$2.areaStyle} ${customProps.class ?? ""} ${customProps.transparent ? customProps.transparent : ""}`;
2283
+ return `${style$4.areaStyle} ${customProps.class ?? ""} ${customProps.transparent ? customProps.transparent : ""}`;
2226
2284
  },
2227
2285
  get value() {
2228
2286
  return customProps.text();
@@ -2246,46 +2304,157 @@ const TextArea = props => {
2246
2304
  })();
2247
2305
  };
2248
2306
 
2249
- var css_248z$6 = ".expansion-module_header__eaZ-i {\n width: 100%;\n max-width: 100%;\n display: flex;\n flex-direction: row;\n height: -moz-min-content;\n height: min-content;\n text-wrap: wrap;\n}\n.expansion-module_header__eaZ-i :first-child {\n flex-grow: 1;\n}\n.expansion-module_header__eaZ-i :last-child {\n align-self: flex-end;\n padding: 10px;\n fill: var(--on-container-color, #000);\n}\n.expansion-module_header__eaZ-i button {\n height: -moz-min-content;\n height: min-content;\n background: none;\n}\n.expansion-module_header__eaZ-i button svg {\n height: 50%;\n}\n\n.expansion-module_opened__BFLJk {\n border-radius: 8px 8px 0px 0px;\n}\n\n.expansion-module_closed__VmSJ7 {\n border-radius: 4px 4px 8px 8px;\n}\n\n.expansion-module_body__OYZTn {\n display: hidden;\n max-height: 0;\n opacity: 0;\n transition: max-height 0.5s ease, opacity 0.5s ease;\n padding: calc(var(--spacing-1, 8px) - 2px);\n border-radius: 0px 0px 8px 8px;\n}\n.expansion-module_body__OYZTn :nth-child(n) {\n text-wrap: wrap !important;\n}\n\n.expansion-module_open__L1UJR {\n max-height: 800px;\n opacity: 1;\n}\n\n.expansion-module_totalPanel__o0hyd {\n max-width: 100%;\n display: flex !important;\n flex-direction: column !important;\n border-radius: 4px 4px 8px 8px;\n}\n\n.expansion-module_hover__lzPNA:hover {\n cursor: pointer;\n}\n\n.expansion-module_accent__HYwcP {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}";
2250
- var style$1 = {"header":"expansion-module_header__eaZ-i","opened":"expansion-module_opened__BFLJk","closed":"expansion-module_closed__VmSJ7","body":"expansion-module_body__OYZTn","open":"expansion-module_open__L1UJR","totalPanel":"expansion-module_totalPanel__o0hyd","hover":"expansion-module_hover__lzPNA","accent":"expansion-module_accent__HYwcP"};
2251
- styleInject(css_248z$6);
2252
-
2253
- var _tmpl$$9 = /*#__PURE__*/template(`<svg width=46 height=44><path d="M24.15 12.7875L37.6625 25.575C39.1 26.95 39.1 29.15 37.6625 30.525C36.225 31.9 33.925 31.9 32.4875 30.525L24.15 22.6875C23.4312 22 22.425 22 21.7062 22.6875L13.3687 30.525C11.9312 31.9 9.63123 31.9 8.19373 30.525C6.75623 29.15 6.75623 26.95 8.19373 25.575L21.7062 12.7875C22.425 12.2375 23.575 12.2375 24.15 12.7875Z"stroke=white stroke-width=2 stroke-miterlimit=10 stroke-linecap=round stroke-linejoin=round>`),
2254
- _tmpl$2$4 = /*#__PURE__*/template(`<svg width=44 height=43><path d="M20.7625 31.8469L7.83752 19.35C6.46252 18.0062 6.46252 15.8562 7.83752 14.5125C9.21252 13.1687 11.4125 13.1687 12.7875 14.5125L20.7625 22.1719C21.45 22.8437 22.4125 22.8437 23.1 22.1719L31.075 14.5125C32.45 13.1687 34.65 13.1687 36.025 14.5125C37.4 15.8562 37.4 18.0062 36.025 19.35L23.1 31.8469C22.55 32.3844 21.45 32.3844 20.7625 31.8469Z"stroke=white stroke-width=2 stroke-miterlimit=10 stroke-linecap=round stroke-linejoin=round>`);
2255
- const UpArrow = props => {
2256
- return (() => {
2257
- var _el$ = _tmpl$$9();
2258
- spread(_el$, mergeProps(props, {
2259
- "viewBox": "0 0 46 44",
2260
- "fill": "none",
2261
- "xmlns": "http://www.w3.org/2000/svg"
2262
- }), true, true);
2263
- return _el$;
2264
- })();
2265
- };
2266
- const DownArrow = props => {
2267
- return (() => {
2268
- var _el$2 = _tmpl$2$4();
2269
- spread(_el$2, mergeProps(props, {
2270
- "viewBox": "0 0 44 43",
2271
- "fill": "none",
2272
- "xmlns": "http://www.w3.org/2000/svg"
2273
- }), true, true);
2274
- return _el$2;
2275
- })();
2276
- };
2307
+ var css_248z$a = ".popup-module_popup__5A6Ji {\n padding: 0px;\n padding-top: 8px;\n padding-bottom: 8px;\n overflow: hidden;\n position: fixed;\n top: 50%;\n left: 50%;\n border: var(--primary-color, #4CAF50) 1px solid;\n border-radius: 8px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n z-index: 1001;\n text-align: center;\n}\n@media (min-width: 768px) {\n .popup-module_popup__5A6Ji {\n transform: translate(-50%, -50%);\n }\n}\n@media (max-width: 768px) {\n .popup-module_popup__5A6Ji {\n top: 0;\n left: 0;\n transform: translate(5%, 0%);\n }\n}\n\n.popup-module_wrapper__iyFpP {\n padding: 0px;\n overflow-y: hidden;\n padding-bottom: 5px;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n}\n\n.popup-module_header__-CekS {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n overflow-y: hidden;\n padding: 5px;\n min-height: 2em;\n}\n.popup-module_header__-CekS button {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n}\n.popup-module_header__-CekS h2 {\n text-align: left;\n margin-left: 5%;\n flex-grow: 1;\n padding: 0px;\n padding-bottom: 5px;\n margin: 0px;\n margin-left: 1em;\n}\n.popup-module_header__-CekS span {\n flex-shrink: 0;\n width: -moz-min-content;\n width: min-content;\n height: -moz-min-content;\n height: min-content;\n}\n.popup-module_header__-CekS span button:hover {\n cursor: pointer;\n}\n\n.popup-module_body__IhaZc {\n flex-basis: auto;\n overflow-y: auto;\n flex-grow: 1;\n justify-self: flex-end;\n}\n\n.popup-module_tertiary__RM-hn, .popup-module_accent__cBwGV, .popup-module_primary__Q9k96 {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n\n.popup-module_backdrop__o8l1M {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.4); /* dark overlay */\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1000; /* sit beneath your modal */\n}";
2308
+ var style$3 = {"popup":"popup-module_popup__5A6Ji","wrapper":"popup-module_wrapper__iyFpP","header":"popup-module_header__-CekS","body":"popup-module_body__IhaZc","primary":"popup-module_primary__Q9k96","backdrop":"popup-module_backdrop__o8l1M"};
2309
+ styleInject(css_248z$a);
2277
2310
 
2278
- var _tmpl$$8 = /*#__PURE__*/template(`<div><div><span></span></div><div>`);
2279
- const ExpansionPanel = props => {
2280
- const [open, setOpen] = createSignal(!!props.startOpen);
2281
- return (() => {
2282
- var _el$ = _tmpl$$8(),
2283
- _el$2 = _el$.firstChild,
2311
+ var _tmpl$$d = /*#__PURE__*/template(`<b>X`),
2312
+ _tmpl$2$7 = /*#__PURE__*/template(`<div><div><div><h2></h2><span></span></div><div>`);
2313
+ const Modal = props => {
2314
+ const defaultX = createMemo(() => props.translate?.x ?? "-50%");
2315
+ const defaultY = createMemo(() => props.translate?.y ?? "-50%");
2316
+ const isShown = createMemo(() => props.show[0]());
2317
+ const [innerPopup, setInnerPopup] = createSignal();
2318
+ // const [ignoreClicks, setIgnoreClicks] = createSignal(true);
2319
+ createEffect(() => {
2320
+ const entry = {
2321
+ element: innerPopup(),
2322
+ onClickOutside: e => {
2323
+ props.show[1](false);
2324
+ }
2325
+ };
2326
+ if (isShown()) {
2327
+ setTimeout(() => {
2328
+ registerWindowManager(entry);
2329
+ }, 250);
2330
+ } else {
2331
+ unregisterWindowManager(entry);
2332
+ }
2333
+ });
2334
+ const widthStyle = createMemo(() => {
2335
+ if (props.width) {
2336
+ return props.width;
2337
+ }
2338
+ if (isMobile()) {
2339
+ return "90vw";
2340
+ }
2341
+ return "45vw";
2342
+ });
2343
+ const heightStyle = createMemo(() => {
2344
+ if (props.height) {
2345
+ return props.height;
2346
+ }
2347
+ if (isMobile()) {
2348
+ return "95vh";
2349
+ }
2350
+ return "60vh";
2351
+ });
2352
+ const shouldTranslate = createMemo(() => {
2353
+ if (props.translate?.x || props.translate?.y) {
2354
+ return `translate(${defaultX()}, ${defaultY()})`;
2355
+ } else {
2356
+ return "";
2357
+ }
2358
+ });
2359
+ return createComponent(Show, {
2360
+ get when() {
2361
+ return isShown();
2362
+ },
2363
+ get children() {
2364
+ return createComponent(Portal, {
2365
+ get children() {
2366
+ var _el$ = _tmpl$2$7(),
2367
+ _el$2 = _el$.firstChild,
2368
+ _el$3 = _el$2.firstChild,
2369
+ _el$4 = _el$3.firstChild,
2370
+ _el$5 = _el$4.nextSibling,
2371
+ _el$7 = _el$3.nextSibling;
2372
+ use(el => {
2373
+ setInnerPopup(el);
2374
+ // @ts-ignore
2375
+ props?.ref?.(el);
2376
+ }, _el$2);
2377
+ insert(_el$4, () => props.title ?? "Modal");
2378
+ insert(_el$5, createComponent(Button, {
2379
+ transparent: true,
2380
+ onClick: () => props.show[1](false),
2381
+ get children() {
2382
+ return _tmpl$$d();
2383
+ }
2384
+ }));
2385
+ insert(_el$7, () => props.children);
2386
+ createRenderEffect(_p$ => {
2387
+ var _v$ = style$3.backdrop,
2388
+ _v$2 = widthStyle(),
2389
+ _v$3 = heightStyle(),
2390
+ _v$4 = shouldTranslate(),
2391
+ _v$5 = `${style$3["primary"]} ${style$3.wrapper} ${style$3.popup}`,
2392
+ _v$6 = style$3.header,
2393
+ _v$7 = style$3.body;
2394
+ _v$ !== _p$.e && className(_el$, _p$.e = _v$);
2395
+ _v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$2.style.setProperty("width", _v$2) : _el$2.style.removeProperty("width"));
2396
+ _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$2.style.setProperty("height", _v$3) : _el$2.style.removeProperty("height"));
2397
+ _v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$2.style.setProperty("transform", _v$4) : _el$2.style.removeProperty("transform"));
2398
+ _v$5 !== _p$.i && className(_el$2, _p$.i = _v$5);
2399
+ _v$6 !== _p$.n && className(_el$3, _p$.n = _v$6);
2400
+ _v$7 !== _p$.s && className(_el$7, _p$.s = _v$7);
2401
+ return _p$;
2402
+ }, {
2403
+ e: undefined,
2404
+ t: undefined,
2405
+ a: undefined,
2406
+ o: undefined,
2407
+ i: undefined,
2408
+ n: undefined,
2409
+ s: undefined
2410
+ });
2411
+ return _el$;
2412
+ }
2413
+ });
2414
+ }
2415
+ });
2416
+ };
2417
+
2418
+ var css_248z$9 = ".expansion-module_header__eaZ-i {\n width: 100%;\n max-width: 100%;\n display: flex;\n flex-direction: row;\n height: -moz-min-content;\n height: min-content;\n text-wrap: wrap;\n}\n.expansion-module_header__eaZ-i :first-child {\n flex-grow: 1;\n}\n.expansion-module_header__eaZ-i :last-child {\n align-self: flex-end;\n padding: 10px;\n fill: var(--on-container-color, #000);\n}\n.expansion-module_header__eaZ-i button {\n height: -moz-min-content;\n height: min-content;\n background: none;\n}\n.expansion-module_header__eaZ-i button svg {\n height: 50%;\n}\n\n.expansion-module_opened__BFLJk {\n border-radius: 8px 8px 0px 0px;\n}\n\n.expansion-module_closed__VmSJ7 {\n border-radius: 4px 4px 8px 8px;\n}\n\n.expansion-module_body__OYZTn {\n display: hidden;\n max-height: 0;\n opacity: 0;\n transition: max-height 0.5s ease, opacity 0.5s ease;\n padding: calc(var(--spacing-1, 8px) - 2px);\n border-radius: 0px 0px 8px 8px;\n}\n.expansion-module_body__OYZTn :nth-child(n) {\n text-wrap: wrap !important;\n}\n\n.expansion-module_open__L1UJR {\n max-height: 800px;\n opacity: 1;\n}\n\n.expansion-module_totalPanel__o0hyd {\n max-width: 100%;\n display: flex !important;\n flex-direction: column !important;\n border-radius: 4px 4px 8px 8px;\n}\n\n.expansion-module_hover__lzPNA:hover {\n cursor: pointer;\n}\n\n.expansion-module_accent__HYwcP {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}";
2419
+ var style$2 = {"header":"expansion-module_header__eaZ-i","opened":"expansion-module_opened__BFLJk","closed":"expansion-module_closed__VmSJ7","body":"expansion-module_body__OYZTn","open":"expansion-module_open__L1UJR","totalPanel":"expansion-module_totalPanel__o0hyd","hover":"expansion-module_hover__lzPNA","accent":"expansion-module_accent__HYwcP"};
2420
+ styleInject(css_248z$9);
2421
+
2422
+ var _tmpl$$c = /*#__PURE__*/template(`<svg width=46 height=44><path d="M24.15 12.7875L37.6625 25.575C39.1 26.95 39.1 29.15 37.6625 30.525C36.225 31.9 33.925 31.9 32.4875 30.525L24.15 22.6875C23.4312 22 22.425 22 21.7062 22.6875L13.3687 30.525C11.9312 31.9 9.63123 31.9 8.19373 30.525C6.75623 29.15 6.75623 26.95 8.19373 25.575L21.7062 12.7875C22.425 12.2375 23.575 12.2375 24.15 12.7875Z"stroke=white stroke-width=2 stroke-miterlimit=10 stroke-linecap=round stroke-linejoin=round>`),
2423
+ _tmpl$2$6 = /*#__PURE__*/template(`<svg width=44 height=43><path d="M20.7625 31.8469L7.83752 19.35C6.46252 18.0062 6.46252 15.8562 7.83752 14.5125C9.21252 13.1687 11.4125 13.1687 12.7875 14.5125L20.7625 22.1719C21.45 22.8437 22.4125 22.8437 23.1 22.1719L31.075 14.5125C32.45 13.1687 34.65 13.1687 36.025 14.5125C37.4 15.8562 37.4 18.0062 36.025 19.35L23.1 31.8469C22.55 32.3844 21.45 32.3844 20.7625 31.8469Z"stroke=white stroke-width=2 stroke-miterlimit=10 stroke-linecap=round stroke-linejoin=round>`);
2424
+ const UpArrow = props => {
2425
+ return (() => {
2426
+ var _el$ = _tmpl$$c();
2427
+ spread(_el$, mergeProps(props, {
2428
+ "viewBox": "0 0 46 44",
2429
+ "fill": "none",
2430
+ "xmlns": "http://www.w3.org/2000/svg"
2431
+ }), true, true);
2432
+ return _el$;
2433
+ })();
2434
+ };
2435
+ const DownArrow = props => {
2436
+ return (() => {
2437
+ var _el$2 = _tmpl$2$6();
2438
+ spread(_el$2, mergeProps(props, {
2439
+ "viewBox": "0 0 44 43",
2440
+ "fill": "none",
2441
+ "xmlns": "http://www.w3.org/2000/svg"
2442
+ }), true, true);
2443
+ return _el$2;
2444
+ })();
2445
+ };
2446
+
2447
+ var _tmpl$$b = /*#__PURE__*/template(`<div><div><span></span></div><div>`);
2448
+ const ExpansionPanel = props => {
2449
+ const [open, setOpen] = createSignal(!!props.startOpen);
2450
+ return (() => {
2451
+ var _el$ = _tmpl$$b(),
2452
+ _el$2 = _el$.firstChild,
2284
2453
  _el$3 = _el$2.firstChild,
2285
2454
  _el$4 = _el$2.nextSibling;
2286
2455
  spread(_el$, mergeProps(props, {
2287
2456
  get ["class"]() {
2288
- return `${style$1.totalPanel}`;
2457
+ return `${style$2.totalPanel}`;
2289
2458
  }
2290
2459
  }), false, true);
2291
2460
  _el$3.style.setProperty("width", "min-content");
@@ -2303,7 +2472,7 @@ const ExpansionPanel = props => {
2303
2472
  props.extraLogic ? props.extraLogic() : null;
2304
2473
  },
2305
2474
  get ["class"]() {
2306
- return `${style$1.hover}`;
2475
+ return `${style$2.hover}`;
2307
2476
  },
2308
2477
  get children() {
2309
2478
  return [createComponent(Show, {
@@ -2347,8 +2516,8 @@ const ExpansionPanel = props => {
2347
2516
  }), null);
2348
2517
  insert(_el$4, () => props.children[1]);
2349
2518
  createRenderEffect(_p$ => {
2350
- var _v$ = `${style$1['accent']} ${style$1.header} ${open() ? style$1.opened : style$1.closed}`,
2351
- _v$2 = `${style$1['accent']} ${style$1.body} ${open() ? style$1.open : ''}`;
2519
+ var _v$ = `${style$2['accent']} ${style$2.header} ${open() ? style$2.opened : style$2.closed}`,
2520
+ _v$2 = `${style$2['accent']} ${style$2.body} ${open() ? style$2.open : ''}`;
2352
2521
  _v$ !== _p$.e && className(_el$2, _p$.e = _v$);
2353
2522
  _v$2 !== _p$.t && className(_el$4, _p$.t = _v$2);
2354
2523
  return _p$;
@@ -2360,110 +2529,95 @@ const ExpansionPanel = props => {
2360
2529
  })();
2361
2530
  };
2362
2531
 
2363
- var css_248z$5 = ".icon-module_icon__K4BP- {\n outline: none !important;\n border: none !important;\n}\n.icon-module_icon__K4BP-:focus {\n outline: none !important;\n border: none !important;\n}\n.icon-module_icon__K4BP-:active {\n outline: none !important;\n border: none !important;\n}";
2364
- var styles$4 = {"icon":"icon-module_icon__K4BP-"};
2365
- styleInject(css_248z$5);
2532
+ var css_248z$8 = ".snackbar-module_snack__Dkcmp {\n position: fixed;\n bottom: 10px;\n left: 45vw;\n right: 45vw;\n border-radius: 15px;\n margin: 0;\n padding: 0;\n z-index: 9999;\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n max-width: 10vw;\n padding: 5px;\n}\n@media screen and (max-width: 768px) {\n .snackbar-module_snack__Dkcmp {\n left: 8vw;\n right: 8vw;\n bottom: 20vh;\n max-width: 70vw;\n }\n}\n.snackbar-module_snack__Dkcmp span {\n flex-grow: 1;\n margin: auto 0;\n text-wrap: wrap;\n}\n.snackbar-module_snack__Dkcmp button {\n margin: auto 0;\n}\n\n.snackbar-module_error__7IShA {\n border: 2px solid var(--error-color, #B00020);\n font-weight: bold;\n}\n\n.snackbar-module_success__JPkNY {\n border-color: #4caf50;\n border: 2px solid #4caf50;\n color: #4caf50;\n}\n\n.snackbar-module_info__52mgJ {\n border: 2px solid var(--secondary-color, #14b9c3);\n}\n\n.snackbar-module_warning__K1oCK {\n border-color: #ff9800;\n border: 2px solid #ff9800;\n color: #ff9800;\n}\n\n.snackbar-module_open__Bdhg1 {\n animation: snackbar-module_slideIn__aM-2K 0.5s forwards;\n}\n\n.snackbar-module_close__-JXxs {\n animation: snackbar-module_slideOut__6sQkv 0.5s forwards;\n}\n\n.snackbar-module_primary__j2zPB {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.snackbar-module_primary__j2zPB:hover {\n cursor: pointer;\n}";
2533
+ var style$1 = {"snack":"snackbar-module_snack__Dkcmp","error":"snackbar-module_error__7IShA","success":"snackbar-module_success__JPkNY","info":"snackbar-module_info__52mgJ","warning":"snackbar-module_warning__K1oCK","open":"snackbar-module_open__Bdhg1","slideIn":"snackbar-module_slideIn__aM-2K","close":"snackbar-module_close__-JXxs","slideOut":"snackbar-module_slideOut__6sQkv","primary":"snackbar-module_primary__j2zPB"};
2534
+ styleInject(css_248z$8);
2366
2535
 
2367
- var _tmpl$$7 = /*#__PURE__*/template(`<img tabindex=-1>`);
2368
- const defaultSizeMap = {
2369
- small: 16,
2370
- medium: 24,
2371
- large: 32
2536
+ var _tmpl$$a = /*#__PURE__*/template(`<div>`),
2537
+ _tmpl$2$5 = /*#__PURE__*/template(`<div><span>`);
2538
+ const [snackbars, setSnackbars] = createSignal([]);
2539
+ const addSnackbar = snack => {
2540
+ setSnackbars(old => [...old, snack]);
2372
2541
  };
2373
- const weightMapping = {
2374
- thin: "300",
2375
- regular: "400",
2376
- bold: "400" // Using "400" for both regular and bold in this implementation.
2542
+ const removeSnackbar = index => {
2543
+ setSnackbars(old => old.filter((_, i) => i !== index));
2377
2544
  };
2378
- const Icon = props => {
2379
- // Signal to hold the dynamically loaded icon component.
2380
- const [IconSvg, setIconSvg] = createSignal();
2381
- // Resolve size in pixels.
2382
- const sizePx = typeof props.size === "number" ? props.size : defaultSizeMap[props.size || "medium"];
2383
- // Default color.
2384
- const color = props.color || "currentColor";
2385
- // Map weight prop to a string representing the SVG package folder.
2386
- weightMapping[props.weight || "regular"];
2387
- // Set variant (outlined by default).
2388
- const variant = props.variant || "outlined";
2389
- // Add "-fill" to the filename if filled is true.
2390
- const filledSuffix = props.filled ? `${props.name}-fill` : `${props.name}`;
2391
- // @ts-ignore
2392
- const outlinedIcons = import.meta.glob('/node_modules/@material-symbols/svg-400/outlined/*.svg');
2393
- // @ts-ignore
2394
- const roundedIcons = import.meta.glob('/node_modules/@material-symbols/svg-400/rounded/*.svg');
2395
- // @ts-ignore
2396
- const sharpIcons = import.meta.glob('/node_modules/@material-symbols/svg-400/sharp/*.svg');
2397
- const icons = path => {
2398
- switch (variant) {
2399
- case "outlined":
2400
- return outlinedIcons[path];
2401
- case "rounded":
2402
- return roundedIcons[path];
2403
- case "sharp":
2404
- return sharpIcons[path];
2405
- default:
2406
- return outlinedIcons[path];
2545
+ const SnackbarController = () => {
2546
+ return createComponent(Show, {
2547
+ get when() {
2548
+ return snackbars().length > 0;
2549
+ },
2550
+ get children() {
2551
+ var _el$ = _tmpl$$a();
2552
+ insert(_el$, createComponent(For, {
2553
+ get each() {
2554
+ return snackbars();
2555
+ },
2556
+ children: (snack, index) => createComponent(Snackbar, mergeProps(snack, {
2557
+ get index() {
2558
+ return index();
2559
+ },
2560
+ onClose: () => removeSnackbar(index())
2561
+ }))
2562
+ }));
2563
+ createRenderEffect(() => className(_el$, style$1.snackContainer));
2564
+ return _el$;
2407
2565
  }
2408
- };
2409
- createEffect(() => {
2410
- // Build the relative path based on props:
2411
- const iconPath = `/node_modules/@material-symbols/svg-400/${variant}/${filledSuffix}.svg`;
2412
- if (icons(iconPath)) {
2413
- icons(iconPath)().then(mod => {
2414
- setIconSvg(() => mod.default);
2415
- }).catch(err => {
2416
- console.error(`Failed to load icon: ${iconPath}`, err);
2566
+ });
2567
+ };
2568
+ const Snackbar = props => {
2569
+ const [isOpen, setIsOpen] = createSignal(true);
2570
+ if (props.closeTimeout) setTimeout(() => props.onClose(), props.closeTimeout);
2571
+ if (!props.closeTimeout) setTimeout(() => props.onClose(), 5000);
2572
+ const messageLength = Math.floor(props.message.length / 17);
2573
+ return createComponent(Portal, {
2574
+ get mount() {
2575
+ return document.body;
2576
+ },
2577
+ get children() {
2578
+ return createComponent(Show, {
2579
+ get when() {
2580
+ return isOpen();
2581
+ },
2582
+ get children() {
2583
+ var _el$2 = _tmpl$2$5(),
2584
+ _el$3 = _el$2.firstChild;
2585
+ insert(_el$3, () => props.message);
2586
+ insert(_el$2, createComponent(Button, {
2587
+ get onClick() {
2588
+ return props.onClose;
2589
+ },
2590
+ children: "X"
2591
+ }), null);
2592
+ createRenderEffect(_p$ => {
2593
+ var _v$ = `${10 + props.index * (50 + messageLength * 8)}px`,
2594
+ _v$2 = `${style$1.primary} ${style$1.snack} ${style$1[props.severity ?? 'info']}`;
2595
+ _v$ !== _p$.e && ((_p$.e = _v$) != null ? _el$2.style.setProperty("bottom", _v$) : _el$2.style.removeProperty("bottom"));
2596
+ _v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
2597
+ return _p$;
2598
+ }, {
2599
+ e: undefined,
2600
+ t: undefined
2601
+ });
2602
+ return _el$2;
2603
+ }
2417
2604
  });
2418
- } else {
2419
- console.error(`Icon not found: ${iconPath}`);
2420
2605
  }
2421
2606
  });
2422
- return (() => {
2423
- var _el$ = _tmpl$$7();
2424
- addEventListener(_el$, "click", props.onClick, true);
2425
- _el$.$$pointerdown = e => {
2426
- e.stopPropagation();
2427
- e.preventDefault();
2428
- };
2429
- `${sizePx}px` != null ? _el$.style.setProperty("width", `${sizePx}px`) : _el$.style.removeProperty("width");
2430
- `${sizePx}px` != null ? _el$.style.setProperty("height", `${sizePx}px`) : _el$.style.removeProperty("height");
2431
- color != null ? _el$.style.setProperty("color", color) : _el$.style.removeProperty("color");
2432
- _el$.style.setProperty("display", "block");
2433
- _el$.style.setProperty("pointer-events", "none");
2434
- _el$.style.setProperty("outline-color", "transparent");
2435
- _el$.style.setProperty("border-block-color", "transparent");
2436
- _el$.style.setProperty("border-inline-color", "transparent");
2437
- createRenderEffect(_p$ => {
2438
- var _v$ = styles$4.icon,
2439
- _v$2 = IconSvg(),
2440
- _v$3 = props.ariaLabel || "";
2441
- _v$ !== _p$.e && className(_el$, _p$.e = _v$);
2442
- _v$2 !== _p$.t && setAttribute(_el$, "src", _p$.t = _v$2);
2443
- _v$3 !== _p$.a && setAttribute(_el$, "alt", _p$.a = _v$3);
2444
- return _p$;
2445
- }, {
2446
- e: undefined,
2447
- t: undefined,
2448
- a: undefined
2449
- });
2450
- return _el$;
2451
- })();
2452
2607
  };
2453
- delegateEvents(["pointerdown", "click"]);
2454
2608
 
2455
- var css_248z$4 = ".container-module_primary__EvZuR {\n background-color: var(--primary-color, #4CAF50);\n color: var(--on-primary-color, #fff);\n}\n\n.container-module_primaryVariant__lC3Dg {\n background-color: var(--primary-color-varient, #43A047);\n color: var(--on-primary-color, #fff);\n}\n\n.container-module_secondary__-ywDW {\n background-color: var(--secondary-color, #14b9c3);\n color: var(--on-secondary-color, #000000);\n}\n\n.container-module_secondaryVariant__E7Gxe {\n background-color: var(--secondary-color-varient, #0b969f);\n color: var(--on-secondary-color, #000000);\n}\n\n.container-module_background__TT8pn {\n background-color: var(--background-color, #ffffff);\n color: var(--on-background-color, #000000);\n}\n\n.container-module_surface__59oDI {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n\n.container-module_surfaceVariant__S9Pyg {\n background-color: var(--surface-color-variant, #ccc);\n color: var(--on-surface-color, #000000);\n}\n\n.container-module_container__Xfc8t {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n\n.container-module_error__anU8a {\n background-color: var(--error-color, #B00020);\n color: var(--on-error-color, #ffffff);\n}\n\n.container-module_header__2SLww {\n background-color: var(--header-background-color, #2E7D32);\n color: var(--header-on-background-color, #fff);\n height: 50px;\n}\n\n.container-module_subheader__Y2LUC {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n height: 38px;\n}";
2456
- var styles$3 = {"primary":"container-module_primary__EvZuR","primaryVariant":"container-module_primaryVariant__lC3Dg","secondary":"container-module_secondary__-ywDW","secondaryVariant":"container-module_secondaryVariant__E7Gxe","background":"container-module_background__TT8pn","surface":"container-module_surface__59oDI","surfaceVariant":"container-module_surfaceVariant__S9Pyg","container":"container-module_container__Xfc8t","error":"container-module_error__anU8a","header":"container-module_header__2SLww","subheader":"container-module_subheader__Y2LUC"};
2457
- styleInject(css_248z$4);
2609
+ var css_248z$7 = ".container-module_primary__EvZuR {\n background-color: var(--primary-color, #4CAF50);\n color: var(--on-primary-color, #fff);\n fill: var(--on-primary-color, #fff);\n}\n\n.container-module_primaryVariant__lC3Dg {\n background-color: var(--primary-color-varient, #43A047);\n color: var(--on-primary-color, #fff);\n fill: var(--on-primary-color, #fff);\n}\n\n.container-module_secondary__-ywDW {\n background-color: var(--secondary-color, #14b9c3);\n color: var(--on-secondary-color, #000000);\n fill: var(--on-secondary-color, #000000);\n}\n\n.container-module_secondaryVariant__E7Gxe {\n background-color: var(--secondary-color-varient, #0b969f);\n color: var(--on-secondary-color, #000000);\n fill: var(--on-secondary-color, #000000);\n}\n\n.container-module_background__TT8pn {\n background-color: var(--background-color, #ffffff);\n color: var(--on-background-color, #000000);\n fill: var(--on-background-color, #000000);\n}\n\n.container-module_surface__59oDI {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n fill: var(--on-surface-color, #000000);\n}\n\n.container-module_surfaceVariant__S9Pyg {\n background-color: var(--surface-color-variant, #ccc);\n color: var(--on-surface-color, #000000);\n fill: var(--on-surface-color, #000000);\n}\n\n.container-module_container__Xfc8t {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n fill: var(--on-container-color, #000);\n}\n\n.container-module_error__anU8a {\n background-color: var(--error-color, #B00020);\n color: var(--on-error-color, #ffffff);\n fill: var(--on-error-color, #ffffff);\n}\n\n.container-module_header__2SLww {\n background-color: var(--header-background-color, #2E7D32);\n color: var(--header-on-background-color, #fff);\n fill: var(--header-on-background-color, #fff);\n height: 50px;\n}\n.container-module_header__2SLww a {\n color: var(--header-on-background-color, #fff);\n}\n\n.container-module_subheader__Y2LUC {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n fill: var(--subheader-on-background-color, #fff);\n height: 38px;\n}";
2610
+ var styles$6 = {"primary":"container-module_primary__EvZuR","primaryVariant":"container-module_primaryVariant__lC3Dg","secondary":"container-module_secondary__-ywDW","secondaryVariant":"container-module_secondaryVariant__E7Gxe","background":"container-module_background__TT8pn","surface":"container-module_surface__59oDI","surfaceVariant":"container-module_surfaceVariant__S9Pyg","container":"container-module_container__Xfc8t","error":"container-module_error__anU8a","header":"container-module_header__2SLww","subheader":"container-module_subheader__Y2LUC"};
2611
+ styleInject(css_248z$7);
2458
2612
 
2459
- var _tmpl$$6 = /*#__PURE__*/template(`<div>`);
2613
+ var _tmpl$$9 = /*#__PURE__*/template(`<div>`);
2460
2614
  const Container = props => {
2461
2615
  const [local, other] = splitProps(props, ["children", "class", "theme"]);
2462
2616
  return (() => {
2463
- var _el$ = _tmpl$$6();
2617
+ var _el$ = _tmpl$$9();
2464
2618
  spread(_el$, mergeProps(other, {
2465
2619
  get ["class"]() {
2466
- return `${styles$3[local.theme]} ${local.class}`;
2620
+ return `${styles$6[local.theme]} ${local.class}`;
2467
2621
  }
2468
2622
  }), false, true);
2469
2623
  insert(_el$, () => local.children);
@@ -2471,35 +2625,141 @@ const Container = props => {
2471
2625
  })();
2472
2626
  };
2473
2627
 
2474
- var css_248z$3 = ".menu-module_menu__UDlDL {\n background-color: var(--header-background-color, #2E7D32);\n color: var(--header-on-background-color, #fff);\n padding: 1px;\n margin: 0px;\n width: 100px;\n border-radius: 8px;\n transform-origin: top;\n max-height: 0;\n transition: max-height 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n display: none;\n}\n\n.menu-module_open__TpFnL {\n max-height: 800px !important;\n opacity: 1 !important;\n display: block;\n}\n\n.menu-module_list__WPlII {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n width: 100%;\n list-style: none;\n padding: 4px 0;\n margin: 0;\n border-radius: 8px;\n}\n\n.menu-module_listHeader__Hv-1- {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding-left: 4px;\n}\n\n.menu-module_menuDropdown__uQA25 button:focus, .menu-module_menuDropdown__uQA25 button:active, .menu-module_menuDropdown__uQA25 button:focus-within, .menu-module_menuDropdown__uQA25 button:focus-visible {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n -webkit-tap-highlight-color: transparent !important;\n}\n.menu-module_menuDropdown__uQA25 button::-moz-focus-inner {\n border: 0;\n}\n\n.menu-module_droplist__-e059 {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n padding: 1px;\n margin: 0px;\n width: 98%;\n border-radius: 8px;\n transform-origin: top;\n max-height: 0;\n transition: max-height 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n}\n\n.menu-module_openDropList__pYIA- {\n max-height: 800px !important;\n opacity: 1 !important;\n}\n\n.menu-module_icon__nvdCD {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n -webkit-tap-highlight-color: transparent !important;\n}\n.menu-module_icon__nvdCD:focus, .menu-module_icon__nvdCD:active, .menu-module_icon__nvdCD:focus-within, .menu-module_icon__nvdCD:focus-visible {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n -webkit-tap-highlight-color: transparent !important;\n}\n.menu-module_icon__nvdCD::-moz-focus-inner {\n border: 0;\n}\n\n.menu-module_header__xWzbR {\n flex-grow: 1;\n}\n\n.menu-module_menuItem__oXBNs {\n padding: 0.5rem 0;\n width: 100%;\n}\n.menu-module_menuItem__oXBNs:hover {\n background-color: var(--surface-color-variant, #ccc);\n cursor: pointer;\n}";
2475
- var styles$2 = {"menu":"menu-module_menu__UDlDL","open":"menu-module_open__TpFnL","list":"menu-module_list__WPlII","listHeader":"menu-module_listHeader__Hv-1-","menuDropdown":"menu-module_menuDropdown__uQA25","droplist":"menu-module_droplist__-e059","header":"menu-module_header__xWzbR","menuItem":"menu-module_menuItem__oXBNs"};
2476
- styleInject(css_248z$3);
2628
+ var css_248z$6 = ".icon-module_icon__K4BP- {\n outline: none !important;\n border: none !important;\n}\n.icon-module_icon__K4BP-:focus {\n outline: none !important;\n border: none !important;\n}\n.icon-module_icon__K4BP-:active {\n outline: none !important;\n border: none !important;\n}";
2629
+ var styles$5 = {"icon":"icon-module_icon__K4BP-"};
2630
+ styleInject(css_248z$6);
2631
+
2632
+ var _tmpl$$8 = /*#__PURE__*/template(`<div>`);
2633
+ // @ts-ignore
2634
+ const icons = import.meta.glob('/node_modules/@material-symbols/svg-400/**/*.svg', {
2635
+ query: '?raw',
2636
+ import: 'default'
2637
+ });
2638
+ const Icon = props => {
2639
+ const [svg, setSvg] = createSignal("");
2640
+ const sizeMap = {
2641
+ small: 16,
2642
+ medium: 24,
2643
+ large: 32
2644
+ };
2645
+ const size = createMemo(() => {
2646
+ if (typeof props.size === "number") {
2647
+ return props.size;
2648
+ }
2649
+ if (props.size && sizeMap[props.size]) {
2650
+ return sizeMap[props.size];
2651
+ }
2652
+ return 24;
2653
+ });
2654
+ const color = props.color ?? "currentColor";
2655
+ const variant = props.variant ?? "outlined";
2656
+ const key = `/node_modules/@material-symbols/svg-400/${variant}/${props.name}.svg`;
2657
+ if (!icons[key]) throw new Error(`Icon not found: ${key}`);
2658
+ icons[key]().then(raw => {
2659
+ setSvg(raw.replace(/fill=".*?"/g, 'fill="currentColor"').replace(/width=".*?"/g, `width="${untrack(size)}"`).replace(/height=".*?"/g, `height="${untrack(size)}"`));
2660
+ }).catch(console.error);
2661
+ const [iconRef, setIconRef] = createSignal();
2662
+ return (() => {
2663
+ var _el$ = _tmpl$$8();
2664
+ use(ref => {
2665
+ setIconRef(ref);
2666
+ // @ts-ignore
2667
+ props?.ref?.(ref);
2668
+ }, _el$);
2669
+ _el$.style.setProperty("display", "inline-block");
2670
+ color != null ? _el$.style.setProperty("color", color) : _el$.style.removeProperty("color");
2671
+ createRenderEffect(_p$ => {
2672
+ var _v$ = styles$5.icon,
2673
+ _v$2 = `${size()}px`,
2674
+ _v$3 = `${size()}px`,
2675
+ _v$4 = svg();
2676
+ _v$ !== _p$.e && className(_el$, _p$.e = _v$);
2677
+ _v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("width", _v$2) : _el$.style.removeProperty("width"));
2678
+ _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("height", _v$3) : _el$.style.removeProperty("height"));
2679
+ _v$4 !== _p$.o && (_el$.innerHTML = _p$.o = _v$4);
2680
+ return _p$;
2681
+ }, {
2682
+ e: undefined,
2683
+ t: undefined,
2684
+ a: undefined,
2685
+ o: undefined
2686
+ });
2687
+ return _el$;
2688
+ })();
2689
+ };
2690
+
2691
+ var css_248z$5 = ".menu-module_menu__UDlDL {\n background-color: var(--header-background-color, #2E7D32);\n color: var(--header-on-background-color, #fff);\n fill: var(--header-on-background-color, #fff);\n padding: 1px;\n margin: 0px;\n width: 100px;\n border-radius: 8px;\n transform-origin: top;\n max-height: 0;\n transition: max-height 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n visibility: hidden;\n}\n\n.menu-module_open__TpFnL {\n max-height: 800px !important;\n opacity: 1 !important;\n visibility: visible;\n}\n\n.menu-module_list__WPlII {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n fill: var(--on-container-color, #000);\n width: 100%;\n list-style: none;\n padding: 4px 0;\n margin: 0;\n border-radius: 8px;\n}\n\n.menu-module_listHeader__Hv-1- {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding-left: 4px;\n opacity: 1 !important;\n}\n\n.menu-module_menuDropdown__uQA25 {\n opacity: 1 !important;\n}\n.menu-module_menuDropdown__uQA25 button:focus, .menu-module_menuDropdown__uQA25 button:active, .menu-module_menuDropdown__uQA25 button:focus-within, .menu-module_menuDropdown__uQA25 button:focus-visible {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n -webkit-tap-highlight-color: transparent !important;\n}\n.menu-module_menuDropdown__uQA25 button::-moz-focus-inner {\n border: 0;\n}\n\n.menu-module_droplist__-e059 {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n fill: var(--on-container-color, #000);\n padding: 1px;\n margin: 0px;\n width: 98%;\n border-radius: 8px;\n transform-origin: top;\n max-height: 0;\n transition: max-height 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n pointer-events: none;\n}\n\n.menu-module_openDropList__pYIA- {\n max-height: 800px !important;\n opacity: 1 !important;\n pointer-events: auto;\n}\n\n.menu-module_icon__nvdCD {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n fill: var(--header-on-background-color, #fff);\n -webkit-tap-highlight-color: transparent !important;\n}\n.menu-module_icon__nvdCD:focus, .menu-module_icon__nvdCD:active, .menu-module_icon__nvdCD:focus-within, .menu-module_icon__nvdCD:focus-visible {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n -webkit-tap-highlight-color: transparent !important;\n}\n.menu-module_icon__nvdCD::-moz-focus-inner {\n border: 0;\n}\n\n.menu-module_header__xWzbR {\n flex-grow: 1;\n}\n\n.menu-module_menuItem__oXBNs {\n padding: 0.5rem 0;\n width: 100%;\n}\n.menu-module_menuItem__oXBNs:hover {\n background-color: var(--surface-color-variant, #ccc);\n cursor: pointer;\n}";
2692
+ var styles$4 = {"menu":"menu-module_menu__UDlDL","open":"menu-module_open__TpFnL","list":"menu-module_list__WPlII","listHeader":"menu-module_listHeader__Hv-1-","menuDropdown":"menu-module_menuDropdown__uQA25","droplist":"menu-module_droplist__-e059","openDropList":"menu-module_openDropList__pYIA-","header":"menu-module_header__xWzbR","menuItem":"menu-module_menuItem__oXBNs"};
2693
+ styleInject(css_248z$5);
2694
+
2695
+ const MenuContext = createContext();
2696
+ const useMenuContext = () => {
2697
+ return useContext(MenuContext);
2698
+ };
2477
2699
 
2478
- var _tmpl$$5 = /*#__PURE__*/template(`<div><ul>`);
2700
+ var _tmpl$$7 = /*#__PURE__*/template(`<div><ul>`);
2479
2701
  const Menu = props => {
2480
2702
  const [local, others] = splitProps(props, ['anchorElement', 'children', 'ref', 'show', 'position']);
2481
2703
  const [menuRef, setMenuRef] = createSignal();
2704
+ const menuContext = useMenuContext();
2482
2705
  const openStyle = () => {
2483
2706
  if (local.show[0]()) {
2484
- return styles$2.open;
2707
+ return styles$4.open;
2485
2708
  }
2486
2709
  return '';
2487
2710
  };
2488
2711
  createEffect(() => {
2712
+ const entry = {
2713
+ element: menuRef(),
2714
+ onClickOutside: e => {
2715
+ props.show[1](false);
2716
+ }
2717
+ };
2718
+ if (props.show[0]() && menuRef()) {
2719
+ entry.element.style.zIndex = `${999 + getEntryAmount()}`;
2720
+ registerWindowManager(entry);
2721
+ } else {
2722
+ unregisterWindowManager(entry);
2723
+ }
2724
+ });
2725
+ const getAndSetPosition = (menu, anchor) => {
2726
+ const rect = anchor.getBoundingClientRect();
2727
+ menu.style.position = 'absolute';
2728
+ menu.style.top = `${rect.bottom}px`;
2729
+ if ((local?.position ?? 'left') === 'left') {
2730
+ menu.style.left = `${rect.left}px`;
2731
+ } else if (local.position === 'center') {
2732
+ menu.style.left = `${rect.left + rect.width - menu.offsetWidth / 2 - anchor.offsetWidth / 2}px`;
2733
+ } else {
2734
+ const mod = rect.width < 12 ? 1.25 : 1;
2735
+ const menuFix = menu.getBoundingClientRect().width * mod;
2736
+ menu.style.left = `${rect.right - (menuFix + window.scrollX)}px`;
2737
+ }
2738
+ };
2739
+ const updatePosition = () => {
2489
2740
  const menu = menuRef();
2490
2741
  const anchor = local.anchorElement();
2491
2742
  if (menu && anchor) {
2492
- const rect = anchor.getBoundingClientRect();
2493
- menu.style.position = 'absolute';
2494
- menu.style.top = `${rect.bottom}px`;
2495
- if ((local?.position ?? 'left') === 'left') {
2496
- menu.style.left = `${rect.left}px`;
2497
- } else if (local.position === 'center') {
2498
- menu.style.left = `${rect.left + rect.width - menu.offsetWidth / 2 - anchor.offsetWidth / 2}px`;
2499
- } else {
2500
- menu.style.left = `${rect.left + rect.width - menu.offsetWidth}px`;
2743
+ getAndSetPosition(menu, anchor);
2744
+ }
2745
+ };
2746
+ onMount(() => {
2747
+ const menu = menuRef();
2748
+ const anchor = local.anchorElement();
2749
+ if (menu && anchor) {
2750
+ setTimeout(() => {
2751
+ getAndSetPosition(menu, anchor);
2752
+ }, 50);
2753
+ if (!isNullish(menuContext)) {
2754
+ menuContext.registerWithParent(menu);
2501
2755
  }
2756
+ document.addEventListener('scroll', updatePosition, true);
2757
+ window.addEventListener('resize', updatePosition);
2502
2758
  }
2759
+ onCleanup(() => {
2760
+ document.removeEventListener('scroll', updatePosition, true);
2761
+ window.removeEventListener('resize', updatePosition);
2762
+ });
2503
2763
  });
2504
2764
  onCleanup(() => {
2505
2765
  const menu = menuRef();
@@ -2507,43 +2767,35 @@ const Menu = props => {
2507
2767
  menu.style.top = '';
2508
2768
  menu.style.left = '';
2509
2769
  }
2510
- });
2511
- useClickOutside([menuRef, local.anchorElement], () => {
2512
- local.show[1](false);
2770
+ if (!isNullish(menuContext)) {
2771
+ menuContext.unregisterWithParent(menuRef());
2772
+ }
2513
2773
  });
2514
2774
  return createComponent(Portal, {
2515
2775
  get children() {
2516
- var _el$ = _tmpl$$5(),
2776
+ var _el$ = _tmpl$$7(),
2517
2777
  _el$2 = _el$.firstChild;
2518
2778
  use(setMenuRef, _el$);
2519
2779
  spread(_el$, mergeProps(others, {
2520
2780
  get ["class"]() {
2521
- return `${styles$2.menu} ${openStyle()}`;
2781
+ return `${styles$4.menu} ${openStyle()}`;
2522
2782
  }
2523
2783
  }), false, true);
2524
- _el$2.$$click = e => {
2525
- e.stopPropagation();
2526
- e.preventDefault();
2527
- };
2528
- _el$2.$$pointerdown = e => {
2529
- e.stopPropagation();
2530
- };
2531
2784
  insert(_el$2, () => local.children);
2532
- createRenderEffect(() => className(_el$2, `${styles$2.list}`));
2785
+ createRenderEffect(() => className(_el$2, `${styles$4.list}`));
2533
2786
  return _el$;
2534
2787
  }
2535
2788
  });
2536
2789
  };
2537
- delegateEvents(["pointerdown", "click"]);
2538
2790
 
2539
- var _tmpl$$4 = /*#__PURE__*/template(`<li>`);
2791
+ var _tmpl$$6 = /*#__PURE__*/template(`<li>`);
2540
2792
  const MenuItem = props => {
2541
2793
  const [local, others] = splitProps(props, ['children', 'class']);
2542
2794
  return (() => {
2543
- var _el$ = _tmpl$$4();
2795
+ var _el$ = _tmpl$$6();
2544
2796
  spread(_el$, mergeProps(others, {
2545
2797
  get ["class"]() {
2546
- return `${styles$2.menuItem} ${local.class}`;
2798
+ return `${styles$4.menuItem} ${local.class}`;
2547
2799
  }
2548
2800
  }), false, true);
2549
2801
  insert(_el$, () => local.children);
@@ -2551,33 +2803,27 @@ const MenuItem = props => {
2551
2803
  })();
2552
2804
  };
2553
2805
 
2554
- var _tmpl$$3 = /*#__PURE__*/template(`<li><span><span>`),
2555
- _tmpl$2$3 = /*#__PURE__*/template(`<ul>`);
2806
+ var _tmpl$$5 = /*#__PURE__*/template(`<li><span><span></span></span><ul>`);
2556
2807
  const MenuDropdown = props => {
2557
2808
  const [local, others] = splitProps(props, ['children', 'class', 'header']);
2558
2809
  const [isOpen, setIsOpen] = createSignal(false);
2559
2810
  const onButtonClick = e => {
2560
- e.stopPropagation();
2561
- e.preventDefault();
2562
2811
  setIsOpen(old => {
2563
2812
  return !old;
2564
2813
  });
2565
2814
  };
2566
- return [(() => {
2567
- var _el$ = _tmpl$$3(),
2815
+ return (() => {
2816
+ var _el$ = _tmpl$$5(),
2568
2817
  _el$2 = _el$.firstChild,
2569
- _el$3 = _el$2.firstChild;
2818
+ _el$3 = _el$2.firstChild,
2819
+ _el$4 = _el$2.nextSibling;
2570
2820
  spread(_el$, mergeProps(others, {
2571
2821
  get ["class"]() {
2572
- return `${styles$2.menuDropdown} ${local.class}`;
2822
+ return `${styles$4.menuDropdown} ${local.class}`;
2573
2823
  }
2574
2824
  }), false, true);
2575
- insert(_el$3, () => local?.header);
2825
+ insert(_el$3, () => props?.header?.());
2576
2826
  insert(_el$2, createComponent(Button, {
2577
- onPointerDown: e => {
2578
- e.stopPropagation();
2579
- e.preventDefault();
2580
- },
2581
2827
  onClick: onButtonClick,
2582
2828
  get children() {
2583
2829
  return [createComponent(Show, {
@@ -2586,8 +2832,11 @@ const MenuDropdown = props => {
2586
2832
  },
2587
2833
  get children() {
2588
2834
  return createComponent(Icon, {
2589
- size: "medium",
2590
- name: "keyboard_arrow_up"
2835
+ name: "keyboard_arrow_up",
2836
+ onClick: e => {
2837
+ // onButtonClick(e);
2838
+ e.stopPropagation();
2839
+ }
2591
2840
  });
2592
2841
  }
2593
2842
  }), createComponent(Show, {
@@ -2596,193 +2845,240 @@ const MenuDropdown = props => {
2596
2845
  },
2597
2846
  get children() {
2598
2847
  return createComponent(Icon, {
2599
- size: "medium",
2600
- name: "keyboard_arrow_down"
2848
+ name: "keyboard_arrow_down",
2849
+ onClick: e => {
2850
+ // onButtonClick(e);
2851
+ e.stopPropagation();
2852
+ }
2601
2853
  });
2602
2854
  }
2603
2855
  })];
2604
2856
  }
2605
2857
  }), null);
2858
+ insert(_el$4, () => props.children);
2606
2859
  createRenderEffect(_p$ => {
2607
- var _v$ = `${styles$2.listHeader}`,
2608
- _v$2 = `${styles$2.header}`;
2860
+ var _v$ = `${styles$4.listHeader}`,
2861
+ _v$2 = `${styles$4.header}`,
2862
+ _v$3 = `${styles$4.list} ${styles$4.droplist} ${isOpen() ? styles$4.openDropList : ''}`;
2609
2863
  _v$ !== _p$.e && className(_el$2, _p$.e = _v$);
2610
2864
  _v$2 !== _p$.t && className(_el$3, _p$.t = _v$2);
2865
+ _v$3 !== _p$.a && className(_el$4, _p$.a = _v$3);
2611
2866
  return _p$;
2612
2867
  }, {
2613
2868
  e: undefined,
2614
- t: undefined
2869
+ t: undefined,
2870
+ a: undefined
2615
2871
  });
2616
2872
  return _el$;
2617
- })(), (() => {
2618
- var _el$4 = _tmpl$2$3();
2619
- insert(_el$4, () => local.children);
2620
- createRenderEffect(() => className(_el$4, `${styles$2.list} ${styles$2.droplist} ${isOpen() ? styles$2.open : ''}`));
2621
- return _el$4;
2622
- })()];
2873
+ })();
2623
2874
  };
2624
2875
 
2625
- var css_248z$2 = ".formfield-module_formField__w6mH9 {\n display: inline-block;\n border-radius: var(--border-radius-md);\n box-sizing: border-box;\n border: none;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n margin-top: 0px !important;\n margin-bottom: 0px !important;\n}\n.formfield-module_formField__w6mH9 label {\n position: relative;\n top: -0.5rem;\n padding-right: 10px;\n}\n.formfield-module_formField__w6mH9:has(textarea) {\n position: relative;\n margin: 8px;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n width: auto;\n min-width: 95%;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n padding-bottom: 8px;\n border: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea:focus {\n outline: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) legend {\n height: 24px;\n position: absolute;\n top: -16px;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) {\n position: relative;\n height: 48px !important;\n padding: 0px !important;\n width: 100%;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) legend {\n position: absolute;\n transform: translateY(-20px);\n height: 16px;\n max-height: 16px;\n transition: all 0.25s ease;\n top: 8px;\n z-index: 10000;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) [is=coles-solid-select] {\n position: absolute;\n left: 0px;\n right: 0px;\n padding: 0px !important;\n margin: 0px !important;\n height: 48px !important;\n border-radius: 4px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: auto;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) [is=coles-solid-select]:nth-child(n) {\n border-radius: 4px;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) {\n height: 48px;\n position: relative;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) legend {\n position: absolute;\n height: 24px;\n top: -16px;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text] {\n background-color: transparent !important;\n height: 24px;\n border-radius: 4px;\n margin: 8px 0px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: 100%;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text]::-moz-placeholder {\n opacity: 0.75;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text]::placeholder {\n opacity: 0.75;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) {\n height: 48px;\n position: relative;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) legend {\n height: 24px;\n position: absolute;\n top: -16px;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number] {\n background-color: transparent !important;\n color: var(--on-primary-color, #fff);\n height: 24px;\n border-radius: 4px;\n margin: 8px 0px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: 100%;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number]::-moz-placeholder {\n opacity: 0.75;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number]::placeholder {\n opacity: 0.75;\n}\n@media screen and (max-width: 768px) {\n .formfield-module_formField__w6mH9 {\n max-width: 75%;\n }\n}\n\n.formfield-module_topMargin__dahW5 {\n margin-top: 12px;\n}\n\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text] {\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text]::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text]::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number] {\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number]::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number]::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has([is=coles-solid-select]) [is=coles-solid-select] {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(textarea) {\n width: 100%;\n height: auto;\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.formfield-module_legendStyle__gnI49 {\n background-color: transparent;\n opacity: var(--text-emphasis-medium, 87%);\n width: 100%;\n}\n\n.formfield-module_moveLegendInside__zQ4vt {\n opacity: 0;\n visibility: hidden;\n}\n\n.formfield-module_moveLegendOutside__CPF3p {\n visibility: visible;\n}\n\n.formfield-module_movedLegendOutside__hmyRU {\n margin-top: 0px;\n}\n\n.formfield-module_checkboxPadding__DU1CG {\n padding: 0px;\n padding-bottom: 10px;\n padding-left: 10px;\n padding-right: 10px;\n}\n\n.formfield-module_errorContainer__HR4PL {\n position: relative;\n min-height: 2rem;\n}\n\n.formfield-module_error__wNBh2 {\n position: absolute;\n background: transparent;\n color: var(--error-color, #B00020);\n font-size: 10px;\n}";
2626
- var style = {"formField":"formfield-module_formField__w6mH9","primary":"formfield-module_primary__7BYyQ","legendStyle":"formfield-module_legendStyle__gnI49","moveLegendInside":"formfield-module_moveLegendInside__zQ4vt","moveLegendOutside":"formfield-module_moveLegendOutside__CPF3p","movedLegendOutside":"formfield-module_movedLegendOutside__hmyRU","errorContainer":"formfield-module_errorContainer__HR4PL","error":"formfield-module_error__wNBh2"};
2627
- styleInject(css_248z$2);
2876
+ var css_248z$4 = ".radio-group-module_radio-group__label__UV7dt {\n display: block;\n margin-bottom: 0.5em;\n font-weight: 600;\n}\n\n.radio-group-module_radio-group__options__AnbeY .radio-group-module_radio__6oLZe:not(:last-child) {\n margin-bottom: 0.5em;\n}\n\n.radio-group-module_radio-group--disabled__sI9-e .radio-group-module_radio-group__label__UV7dt {\n color: #ccc;\n}";
2877
+ var styles$3 = {"radio-group__label":"radio-group-module_radio-group__label__UV7dt","radio-group__options":"radio-group-module_radio-group__options__AnbeY","radio-group--disabled":"radio-group-module_radio-group--disabled__sI9-e"};
2878
+ styleInject(css_248z$4);
2628
2879
 
2629
- var _tmpl$$2 = /*#__PURE__*/template(`<fieldset><legend><span>`),
2630
- _tmpl$2$2 = /*#__PURE__*/template(`<div>`);
2631
- const FormField = props => {
2632
- return createComponent(Provider$1, {
2633
- get name() {
2634
- return props.name;
2635
- },
2636
- get formName() {
2637
- return props.formName;
2638
- },
2639
- get children() {
2640
- return createComponent(FormField2, props);
2880
+ var _tmpl$$4 = /*#__PURE__*/template(`<div><div role=radiogroup>`),
2881
+ _tmpl$2$4 = /*#__PURE__*/template(`<div>`);
2882
+ const RadioGroupContext = createContext();
2883
+ let radioGroupCount = 0;
2884
+ function RadioGroup(props) {
2885
+ radioGroupCount++;
2886
+ const groupName = props.name ?? `radio-group-${radioGroupCount}`;
2887
+ const [internalValue, setInternalValue] = createSignal(props.defaultValue);
2888
+ const selectedValue = () => props.value !== undefined ? props.value : internalValue();
2889
+ const setSelectedValue = val => {
2890
+ if (props.value === undefined) {
2891
+ setInternalValue(val);
2641
2892
  }
2642
- });
2643
- };
2644
- const FormField2 = props => {
2645
- const [local, others] = splitProps(props, ["children", "styleType", "name", "class", "legendClass", "formName"]);
2646
- const context = useFormProvider();
2647
- const formContext = useFormContext();
2648
- const hasValue = val => {
2649
- if (val === undefined || val === null) return false;
2650
- if (typeof val === "string" && val.trim() === "") return false;
2651
- if (Array.isArray(val) && val.length === 0) return false;
2652
- return true;
2893
+ props.onChange?.(val);
2653
2894
  };
2654
- const hasInsideText = createMemo(() => {
2655
- let currentVal;
2656
- if (hasValue(formContext?.data?.[local?.formName ?? ''])) {
2657
- currentVal = formContext?.data?.[local?.formName ?? ''];
2895
+ const radioRefs = [];
2896
+ const register = el => {
2897
+ radioRefs.push(el);
2898
+ };
2899
+ const unregister = el => {
2900
+ const index = radioRefs.indexOf(el);
2901
+ if (index >= 0) {
2902
+ radioRefs.splice(index, 1);
2658
2903
  }
2659
- if (hasValue(context?.getValue?.())) {
2660
- currentVal = context?.getValue?.();
2661
- }
2662
- const isFocused = context?.getFocused?.();
2663
- const hasText = !context?.getTextInside?.();
2664
- return !isFocused && (!hasText || !hasValue(currentVal));
2665
- });
2666
- const [fieldRef, setFieldRef] = createSignal();
2667
- const theChildren = children(() => props.children);
2668
- const formErrors = () => {
2669
- const allErrors = (formContext?.formGroup.getErrors(local?.formName ?? '') ?? []).filter(error => error.hasError);
2670
- if (allErrors.length === 0) return [];
2671
- let errKeys = allErrors.map(error => error.key);
2672
- // test just require
2673
- if (errKeys.includes('required')) {
2674
- errKeys = errKeys.filter(err => err !== 'minLength' && err !== 'maxLength');
2904
+ };
2905
+ const handleKeyDown = e => {
2906
+ const key = e.key;
2907
+ if (key === "ArrowLeft" || key === "ArrowUp" || key === "Left" || key === "Up") {
2908
+ e.preventDefault();
2909
+ const currentIndex = radioRefs.indexOf(e.currentTarget);
2910
+ const prevIndex = currentIndex > 0 ? currentIndex - 1 : radioRefs.length - 1;
2911
+ const prevRadio = radioRefs[prevIndex];
2912
+ setSelectedValue(prevRadio.value);
2913
+ prevRadio.focus();
2914
+ } else if (key === "ArrowRight" || key === "ArrowDown" || key === "Right" || key === "Down") {
2915
+ e.preventDefault();
2916
+ const currentIndex = radioRefs.indexOf(e.currentTarget);
2917
+ const nextIndex = currentIndex < radioRefs.length - 1 ? currentIndex + 1 : 0;
2918
+ const nextRadio = radioRefs[nextIndex];
2919
+ setSelectedValue(nextRadio.value);
2920
+ nextRadio.focus();
2921
+ } else if (key === "Home") {
2922
+ e.preventDefault();
2923
+ if (radioRefs.length > 0) {
2924
+ setSelectedValue(radioRefs[0].value);
2925
+ radioRefs[0].focus();
2926
+ }
2927
+ } else if (key === "End") {
2928
+ e.preventDefault();
2929
+ if (radioRefs.length > 0) {
2930
+ const lastIndex = radioRefs.length - 1;
2931
+ setSelectedValue(radioRefs[lastIndex].value);
2932
+ radioRefs[lastIndex].focus();
2933
+ }
2675
2934
  }
2676
- //---
2677
- return context?.getErrors?.().err.filter(err => errKeys.includes(err.key));
2678
2935
  };
2679
- const hasRequired = createMemo(() => {
2680
- if (isNullish(local?.formName)) return false;
2681
- if (Object.keys(props).includes('required') && props.required !== false) return true;
2682
- return formContext?.formGroup?.hasValidator?.(local?.formName ?? '', 'required');
2683
- });
2684
- const getErrorLocStyle = index => {
2685
- const fieldBox = fieldRef()?.getBoundingClientRect();
2686
- if (!fieldBox) return {};
2687
- return {
2688
- top: `${index * 12}px`
2689
- };
2936
+ const contextValue = {
2937
+ name: groupName,
2938
+ selectedValue,
2939
+ setSelectedValue,
2940
+ register,
2941
+ unregister,
2942
+ handleKeyDown,
2943
+ disabled: !!props.disabled
2690
2944
  };
2691
- createEffect(() => {
2692
- context.setName(props.name);
2693
- });
2694
- context?.setFocused?.(false);
2695
- useClickOutside([fieldRef], () => {
2696
- if (!isNullish(formContext?.data)) {
2697
- context?.setTextInside(!hasValue(formContext?.data?.[local?.formName ?? '']));
2698
- } else if (!isNullish(context?.getValue)) {
2699
- context?.setTextInside(!hasValue(context?.getValue()));
2700
- }
2701
- context?.setFocused(prev => {
2702
- if (prev) {
2703
- formContext?.formGroup?.validate?.(local?.formName ?? '');
2945
+ return (() => {
2946
+ var _el$ = _tmpl$$4(),
2947
+ _el$2 = _el$.firstChild;
2948
+ insert(_el$, (() => {
2949
+ var _c$ = createMemo(() => !!props.label);
2950
+ return () => _c$() && (() => {
2951
+ var _el$3 = _tmpl$2$4();
2952
+ setAttribute(_el$3, "id", `${groupName}-label`);
2953
+ insert(_el$3, () => props.label);
2954
+ createRenderEffect(() => className(_el$3, styles$3["radio-group__label"]));
2955
+ return _el$3;
2956
+ })();
2957
+ })(), _el$2);
2958
+ insert(_el$2, createComponent(RadioGroupContext.Provider, {
2959
+ value: contextValue,
2960
+ get children() {
2961
+ return props.children;
2704
2962
  }
2705
- return false;
2963
+ }));
2964
+ createRenderEffect(_p$ => {
2965
+ var _v$ = styles$3["radio-group"],
2966
+ _v$2 = {
2967
+ [styles$3["radio-group--disabled"]]: props.disabled
2968
+ },
2969
+ _v$3 = styles$3["radio-group__options"],
2970
+ _v$4 = props.label ? `${groupName}-label` : undefined,
2971
+ _v$5 = props.label ? undefined : props.ariaLabel,
2972
+ _v$6 = props.disabled ? "true" : undefined;
2973
+ _v$ !== _p$.e && className(_el$, _p$.e = _v$);
2974
+ _p$.t = classList(_el$, _v$2, _p$.t);
2975
+ _v$3 !== _p$.a && className(_el$2, _p$.a = _v$3);
2976
+ _v$4 !== _p$.o && setAttribute(_el$2, "aria-labelledby", _p$.o = _v$4);
2977
+ _v$5 !== _p$.i && setAttribute(_el$2, "aria-label", _p$.i = _v$5);
2978
+ _v$6 !== _p$.n && setAttribute(_el$2, "aria-disabled", _p$.n = _v$6);
2979
+ return _p$;
2980
+ }, {
2981
+ e: undefined,
2982
+ t: undefined,
2983
+ a: undefined,
2984
+ o: undefined,
2985
+ i: undefined,
2986
+ n: undefined
2706
2987
  });
2707
- });
2988
+ return _el$;
2989
+ })();
2990
+ }
2991
+
2992
+ var css_248z$3 = ".radio-module_radio__HTGQn {\n display: flex;\n align-items: center;\n cursor: pointer;\n}\n\n.radio-module_radio--disabled__oPPg9 {\n cursor: not-allowed;\n}\n\n.radio-module_radio__input__64jm3 {\n position: absolute;\n opacity: 0;\n pointer-events: none;\n}\n\n.radio-module_radio__circle__oVf3f {\n position: relative;\n width: 16px;\n height: 16px;\n border: 2px solid #666;\n border-radius: 50%;\n background: transparent;\n margin-right: 0.5em;\n flex-shrink: 0;\n}\n\n.radio-module_radio__circle__oVf3f:after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 8px;\n height: 8px;\n background: #007bff;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n display: none;\n}\n\n.radio-module_radio__input__64jm3:checked + .radio-module_radio__circle__oVf3f {\n border-color: #007bff;\n}\n\n.radio-module_radio__input__64jm3:checked + .radio-module_radio__circle__oVf3f:after {\n display: block;\n}\n\n.radio-module_radio__HTGQn:hover .radio-module_radio__circle__oVf3f {\n border-color: #444;\n}\n\n.radio-module_radio__HTGQn:focus-within .radio-module_radio__circle__oVf3f {\n outline: 2px solid #80bdff;\n outline-offset: 2px;\n}\n\n.radio-module_radio__label__ktLh- {\n vertical-align: middle;\n}\n\n.radio-module_radio__input__64jm3:disabled + .radio-module_radio__circle__oVf3f {\n border-color: #ccc;\n}\n\n.radio-module_radio__input__64jm3:disabled + .radio-module_radio__circle__oVf3f:after {\n background: #ccc;\n}\n\n.radio-module_radio--disabled__oPPg9 .radio-module_radio__label__ktLh- {\n color: #ccc;\n}";
2993
+ var styles$2 = {"radio":"radio-module_radio__HTGQn","radio--disabled":"radio-module_radio--disabled__oPPg9","radio__input":"radio-module_radio__input__64jm3","radio__circle":"radio-module_radio__circle__oVf3f","radio__label":"radio-module_radio__label__ktLh-"};
2994
+ styleInject(css_248z$3);
2995
+
2996
+ var _tmpl$$3 = /*#__PURE__*/template(`<label><input type=radio><span>`),
2997
+ _tmpl$2$3 = /*#__PURE__*/template(`<span>`);
2998
+ function Radio(props) {
2999
+ const group = useContext(RadioGroupContext);
3000
+ const isInGroup = !!group;
3001
+ // Manage controlled vs. uncontrolled state
3002
+ const [internalChecked, setInternalChecked] = createSignal(props.defaultChecked ?? false);
3003
+ const checkedState = () => {
3004
+ if (isInGroup) {
3005
+ return group.selectedValue() === props.value;
3006
+ }
3007
+ return props.checked !== undefined ? props.checked : internalChecked();
3008
+ };
3009
+ const isDisabled = () => !!(props.disabled || isInGroup && group.disabled);
3010
+ const handleChange = e => {
3011
+ if (isInGroup) {
3012
+ group.setSelectedValue(props.value);
3013
+ } else {
3014
+ if (props.checked === undefined) {
3015
+ setInternalChecked(true);
3016
+ }
3017
+ props.onChange?.(props.value);
3018
+ }
3019
+ };
3020
+ let inputRef;
2708
3021
  onMount(() => {
2709
- if (context?.getValue !== undefined) {
2710
- const textInside = !hasValue(context?.getValue?.());
2711
- context.setTextInside(textInside);
3022
+ if (isInGroup && inputRef) {
3023
+ group.register(inputRef);
2712
3024
  }
2713
3025
  });
2714
- createEffect(() => {
2715
- const fieldRefer = fieldRef?.();
2716
- if (fieldRefer) {
2717
- context?.setFormFieldRef?.(fieldRefer);
3026
+ onCleanup(() => {
3027
+ if (isInGroup && inputRef) {
3028
+ group.unregister(inputRef);
2718
3029
  }
2719
3030
  });
2720
- return [(() => {
2721
- var _el$ = _tmpl$$2(),
3031
+ return (() => {
3032
+ var _el$ = _tmpl$$3(),
2722
3033
  _el$2 = _el$.firstChild,
2723
- _el$3 = _el$2.firstChild;
2724
- use(setFieldRef, _el$);
2725
- spread(_el$, mergeProps(others, {
2726
- get ["class"]() {
2727
- return `${style["primary"]} ${hasInsideText() ? style.movedLegendInside : style.movedLegendOutside} ${style.formField} ${local.class ?? ''}`;
2728
- }
2729
- }), false, true);
2730
- insert(_el$3, createComponent(Show, {
2731
- get when() {
2732
- return !hasRequired();
2733
- },
2734
- get children() {
2735
- return context.getName();
2736
- }
2737
- }), null);
2738
- insert(_el$3, createComponent(Show, {
2739
- get when() {
2740
- return hasRequired();
2741
- },
2742
- get children() {
2743
- return [createMemo(() => context?.getName()), " *"];
2744
- }
2745
- }), null);
2746
- insert(_el$, theChildren, null);
3034
+ _el$3 = _el$2.nextSibling;
3035
+ addEventListener(_el$2, "keydown", isInGroup ? group.handleKeyDown : undefined, true);
3036
+ _el$2.addEventListener("change", handleChange);
3037
+ var _ref$ = inputRef;
3038
+ typeof _ref$ === "function" ? use(_ref$, _el$2) : inputRef = _el$2;
3039
+ insert(_el$, (() => {
3040
+ var _c$ = createMemo(() => !!props.label);
3041
+ return () => _c$() && (() => {
3042
+ var _el$4 = _tmpl$2$3();
3043
+ insert(_el$4, () => props.label);
3044
+ createRenderEffect(() => className(_el$4, styles$2["radio__label"]));
3045
+ return _el$4;
3046
+ })();
3047
+ })(), null);
2747
3048
  createRenderEffect(_p$ => {
2748
- var _v$ = `${hasInsideText() ? style.moveLegendInside : style.moveLegendOutside} ${local?.legendClass ?? ''}`,
2749
- _v$2 = `${style.legendStyle}`;
2750
- _v$ !== _p$.e && className(_el$2, _p$.e = _v$);
2751
- _v$2 !== _p$.t && className(_el$3, _p$.t = _v$2);
3049
+ var _v$ = styles$2.radio,
3050
+ _v$2 = {
3051
+ [styles$2["radio--disabled"]]: isDisabled(),
3052
+ [styles$2["radio--checked"]]: checkedState()
3053
+ },
3054
+ _v$3 = styles$2["radio__input"],
3055
+ _v$4 = isInGroup ? group.name : props.name,
3056
+ _v$5 = isDisabled(),
3057
+ _v$6 = props.label ? undefined : props.ariaLabel,
3058
+ _v$7 = styles$2["radio__circle"];
3059
+ _v$ !== _p$.e && className(_el$, _p$.e = _v$);
3060
+ _p$.t = classList(_el$, _v$2, _p$.t);
3061
+ _v$3 !== _p$.a && className(_el$2, _p$.a = _v$3);
3062
+ _v$4 !== _p$.o && setAttribute(_el$2, "name", _p$.o = _v$4);
3063
+ _v$5 !== _p$.i && (_el$2.disabled = _p$.i = _v$5);
3064
+ _v$6 !== _p$.n && setAttribute(_el$2, "aria-label", _p$.n = _v$6);
3065
+ _v$7 !== _p$.s && className(_el$3, _p$.s = _v$7);
2752
3066
  return _p$;
2753
3067
  }, {
2754
3068
  e: undefined,
2755
- t: undefined
3069
+ t: undefined,
3070
+ a: undefined,
3071
+ o: undefined,
3072
+ i: undefined,
3073
+ n: undefined,
3074
+ s: undefined
2756
3075
  });
3076
+ createRenderEffect(() => _el$2.value = props.value.toString());
3077
+ createRenderEffect(() => _el$2.checked = checkedState());
2757
3078
  return _el$;
2758
- })(), (() => {
2759
- var _el$4 = _tmpl$2$2();
2760
- insert(_el$4, createComponent(For, {
2761
- get each() {
2762
- return formErrors();
2763
- },
2764
- children: (error, index) => {
2765
- return (() => {
2766
- var _el$5 = _tmpl$2$2();
2767
- insert(_el$5, () => error.display);
2768
- createRenderEffect(_p$ => {
2769
- var _v$3 = style.error,
2770
- _v$4 = getErrorLocStyle(index());
2771
- _v$3 !== _p$.e && className(_el$5, _p$.e = _v$3);
2772
- _p$.t = style$9(_el$5, _v$4, _p$.t);
2773
- return _p$;
2774
- }, {
2775
- e: undefined,
2776
- t: undefined
2777
- });
2778
- return _el$5;
2779
- })();
2780
- }
2781
- }));
2782
- createRenderEffect(() => className(_el$4, style.errorContainer));
2783
- return _el$4;
2784
- })()];
2785
- };
3079
+ })();
3080
+ }
3081
+ delegateEvents(["keydown"]);
2786
3082
 
2787
3083
  /**
2788
3084
  * A class that encapsulates an array of form controls along with their validation logic.
@@ -2816,52 +3112,159 @@ class FormArray {
2816
3112
  * @private
2817
3113
  */
2818
3114
  errors = [];
3115
+ /**
3116
+ * The current values of the form controls in the array.
3117
+ *
3118
+ * @private
3119
+ */
3120
+ internalValues;
3121
+ /**
3122
+ * A function to update the current values of the form controls.
3123
+ *
3124
+ * @private
3125
+ */
3126
+ setValues;
2819
3127
  /**
2820
3128
  * Creates an instance of FormArray.
2821
3129
  *
2822
3130
  * @param arrayValidation - A tuple where the first element is an initial array of control-level validation definitions
2823
3131
  * and the second element is an array of array-level validators.
3132
+ * @param initialValues - Optional initial values for the form controls.
2824
3133
  */
2825
- constructor(arrayValidation) {
3134
+ constructor(arrayValidation, initialValues = []) {
2826
3135
  const [valid, setValid] = createStore(arrayValidation[0]);
3136
+ const [values, setValues] = createStore(initialValues);
2827
3137
  this.internalArrayValidation = arrayValidation[1];
2828
3138
  this.internalValidation = valid;
2829
3139
  this.setValidation = setValid;
3140
+ this.internalValues = values;
3141
+ this.setValues = setValues;
3142
+ }
3143
+ /**
3144
+ * Gets the current values of the form controls in the array.
3145
+ *
3146
+ * @returns A cloned copy of the values array.
3147
+ */
3148
+ get() {
3149
+ return this.internalValues;
3150
+ }
3151
+ /**
3152
+ * Gets the value of a specific control in the array.
3153
+ *
3154
+ * @param index - The index of the control.
3155
+ * @returns A cloned copy of the control value.
3156
+ */
3157
+ getAt(index) {
3158
+ if (index < 0 || index >= this.internalValues.length) {
3159
+ return undefined;
3160
+ }
3161
+ return Clone(this.internalValues[index]);
3162
+ }
3163
+ /**
3164
+ * Gets a property value from an object at the specified index.
3165
+ *
3166
+ * @param index - The index of the control.
3167
+ * @param key - The property key to retrieve.
3168
+ * @returns The property value, or undefined if not found.
3169
+ */
3170
+ getProperty(index, key) {
3171
+ const item = this.getAt(index);
3172
+ return item ? item[key] : undefined;
2830
3173
  }
2831
3174
  /**
2832
- * Removes a control's validation at the specified index.
3175
+ * Sets the values of all controls in the array.
3176
+ *
3177
+ * @param values - The new values for the controls.
3178
+ */
3179
+ set(values) {
3180
+ this.setValues(Clone(values));
3181
+ }
3182
+ /**
3183
+ * Sets the value of a control at the specified index.
3184
+ *
3185
+ * @param index - The index of the control to update.
3186
+ * @param value - The new value for the control.
3187
+ */
3188
+ setAt(index, value) {
3189
+ if (index < 0 || index >= this.internalValues.length) {
3190
+ console.error(`Index ${index} out of bounds.`);
3191
+ return;
3192
+ }
3193
+ this.setValues(index, Clone(value));
3194
+ }
3195
+ /**
3196
+ * Sets a property value on an object at the specified index.
3197
+ *
3198
+ * @param index - The index of the control.
3199
+ * @param key - The property key to set.
3200
+ * @param value - The new value for the property.
3201
+ */
3202
+ setProperty(index, key, value) {
3203
+ if (index < 0 || index >= this.internalValues.length) {
3204
+ console.error(`Index ${index} out of bounds.`);
3205
+ return;
3206
+ }
3207
+ this.setValues(index, oldValue => {
3208
+ const newValue = {
3209
+ ...oldValue
3210
+ };
3211
+ newValue[key] = Clone(value);
3212
+ return newValue;
3213
+ });
3214
+ }
3215
+ /**
3216
+ * Removes a control at the specified index.
2833
3217
  *
2834
3218
  * @param index - The index of the control to remove.
2835
3219
  */
2836
3220
  remove(index) {
3221
+ // Remove validation
2837
3222
  this.setValidation(old => {
2838
3223
  const copy = [...old];
2839
3224
  copy.splice(index, 1);
2840
3225
  return copy;
2841
3226
  });
3227
+ // Remove value
3228
+ this.setValues(old => {
3229
+ const copy = [...old];
3230
+ copy.splice(index, 1);
3231
+ return copy;
3232
+ });
3233
+ // Remove errors
3234
+ if (this.errors.length > index) {
3235
+ this.errors.splice(index, 1);
3236
+ }
2842
3237
  }
2843
3238
  /**
2844
- * Replaces a control's validation at the specified index with a new validation.
3239
+ * Replaces a control at the specified index with new validation and value.
2845
3240
  *
2846
3241
  * @param index - The index of the control to replace.
2847
3242
  * @param controlValidation - The new validation to apply for the control.
3243
+ * @param value - The new value for the control.
2848
3244
  */
2849
- replace(index, controlValidation) {
3245
+ replace(index, controlValidation, value) {
2850
3246
  this.setValidation(old => {
2851
3247
  const copy = [...old];
2852
3248
  copy.splice(index, 1, controlValidation);
2853
3249
  return copy;
2854
3250
  });
3251
+ if (value !== undefined) {
3252
+ this.setValues(index, Clone(value));
3253
+ }
2855
3254
  }
2856
3255
  /**
2857
- * Adds a new control validation to the array.
3256
+ * Adds a new control to the array with validation and optional value.
2858
3257
  *
2859
3258
  * @param controlValidation - The validation definition to add.
3259
+ * @param value - Optional value for the new control.
2860
3260
  */
2861
- add(controlValidation) {
3261
+ add(controlValidation, value) {
2862
3262
  this.setValidation(old => {
2863
3263
  return [...old, controlValidation];
2864
3264
  });
3265
+ this.setValues(old => {
3266
+ return [...old, value ? Clone(value) : {}];
3267
+ });
2865
3268
  }
2866
3269
  /**
2867
3270
  * Checks if any validation errors exist.
@@ -2888,6 +3291,35 @@ class FormArray {
2888
3291
  hasValidator(index, errKey) {
2889
3292
  return this.errors[index].some(error => error.key === errKey);
2890
3293
  }
3294
+ /**
3295
+ * Gets all errors for the form array.
3296
+ *
3297
+ * @returns An array of error arrays for each control.
3298
+ */
3299
+ getErrors() {
3300
+ return Clone(this.errors);
3301
+ }
3302
+ /**
3303
+ * Gets errors for a specific control in the array.
3304
+ *
3305
+ * @param index - The index of the control.
3306
+ * @returns An array of errors for the control, or an empty array if not found.
3307
+ */
3308
+ getErrorsAt(index) {
3309
+ if (index < 0 || index >= this.errors.length) {
3310
+ return [];
3311
+ }
3312
+ return Clone(this.errors[index]);
3313
+ }
3314
+ /**
3315
+ * Validates the form array using current values.
3316
+ *
3317
+ * @param index - Optional index to validate just one control.
3318
+ * @returns True if validation passes, false otherwise.
3319
+ */
3320
+ validateCurrent(index) {
3321
+ return this.validate(this.internalValues, index);
3322
+ }
2891
3323
  /**
2892
3324
  * Validates the provided form control values.
2893
3325
  *
@@ -2901,35 +3333,206 @@ class FormArray {
2901
3333
  console.error('Data is null');
2902
3334
  return false;
2903
3335
  }
2904
- // Validate all controls in the form array.
2905
- if (isNullish(index)) {
2906
- this.errors = values.map((value, i) => {
2907
- const errors = this.internalValidation.map(([_, validators]) => {
2908
- return validators.map(validator => ({
2909
- key: validator.errKey,
2910
- hasError: !validator.revalidate(value)
2911
- }));
2912
- });
2913
- const arrayErrors = this.internalArrayValidation.map(validator => ({
2914
- key: validator.errKey,
2915
- hasError: !validator.revalidate(values)
2916
- }));
2917
- this.errors[i] = [...errors.flat(), ...arrayErrors];
2918
- return [...errors.flat(), ...arrayErrors];
2919
- });
2920
- return this.errors.flat().every(error => !error.hasError);
3336
+ // Validate all controls in the form array.
3337
+ if (isNullish(index)) {
3338
+ const cleanValue = val => {
3339
+ if (isNullish(val)) {
3340
+ return [];
3341
+ } else if (Array.isArray(val)) {
3342
+ return val;
3343
+ } else {
3344
+ return [val];
3345
+ }
3346
+ };
3347
+ this.errors = cleanValue(values).map((value, i) => {
3348
+ const errors = this.internalValidation.map(([_, validators]) => {
3349
+ return validators.map(validator => ({
3350
+ key: validator.errKey,
3351
+ hasError: !validator.revalidate(value)
3352
+ }));
3353
+ });
3354
+ const arrayErrors = this.internalArrayValidation.map(validator => ({
3355
+ key: validator.errKey,
3356
+ hasError: !validator.revalidate(values)
3357
+ }));
3358
+ this.errors[i] = [...errors.flat(), ...arrayErrors];
3359
+ return [...errors.flat(), ...arrayErrors];
3360
+ });
3361
+ return this.errors.flat().every(error => !error.hasError);
3362
+ }
3363
+ // Validate a specific control in the form array.
3364
+ const errors = this.internalValidation.map(([_, validators]) => {
3365
+ return validators.map(validator => ({
3366
+ key: validator.errKey,
3367
+ hasError: !validator.revalidate(values[index])
3368
+ }));
3369
+ });
3370
+ this.errors[index] = errors.flat();
3371
+ return this.errors[index].every(error => !error.hasError);
3372
+ }
3373
+ }
3374
+
3375
+ var css_248z$2 = ".formfield-module_formField__w6mH9:focus-within > legend, .formfield-module_has-focus__9ingx > legend {\n top: -8px !important;\n font-size: 0.75rem !important;\n}\n\n.formfield-module_formField__w6mH9 {\n position: relative;\n display: inline-block;\n border-radius: var(--border-radius-md);\n box-sizing: border-box;\n border: none;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n margin-top: 0px !important;\n margin-bottom: 0px !important;\n}\n.formfield-module_formField__w6mH9 > legend {\n position: absolute;\n left: 12px;\n top: calc(50% - 0.5em);\n font-size: 1rem;\n transition: top 0.25s ease, font-size 0.25s ease;\n pointer-events: none;\n}\n.formfield-module_formField__w6mH9 input::-moz-placeholder, .formfield-module_formField__w6mH9 select::-moz-placeholder {\n opacity: 0 !important;\n -moz-transition: opacity 0.25s ease;\n transition: opacity 0.25s ease;\n}\n.formfield-module_formField__w6mH9 input::placeholder,\n.formfield-module_formField__w6mH9 select::placeholder {\n opacity: 0 !important;\n transition: opacity 0.25s ease;\n}\n.formfield-module_formField__w6mH9 label {\n position: relative;\n top: -0.5rem;\n padding-right: 10px;\n}\n.formfield-module_formField__w6mH9:has(textarea) {\n position: relative;\n margin: 8px;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n width: auto;\n min-width: 95%;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n padding-bottom: 8px;\n border: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea:focus {\n outline: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) legend {\n height: 24px;\n position: absolute;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) {\n position: relative;\n height: 48px !important;\n padding: 0px !important;\n width: 100%;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) legend {\n height: 16px;\n max-height: 16px;\n transition: all 0.25s ease;\n top: calc(50% - 1em);\n z-index: 10000;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) [is=coles-solid-select] {\n position: absolute;\n left: 0px;\n right: 0px;\n padding: 0px !important;\n margin: 0px !important;\n height: 48px !important;\n border-radius: 4px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: auto;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) [is=coles-solid-select]:nth-child(n) {\n border-radius: 4px;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) {\n height: 48px;\n position: relative;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) legend {\n position: absolute;\n height: 24px;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text] {\n background-color: transparent !important;\n height: 24px;\n border-radius: 4px;\n margin: 8px 0px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: 100%;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text]::-moz-placeholder {\n opacity: 0;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text]::placeholder {\n opacity: 0;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) {\n height: 48px;\n position: relative;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) legend {\n height: 24px;\n position: absolute;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number] {\n background-color: transparent !important;\n color: var(--on-primary-color, #fff);\n height: 24px;\n border-radius: 4px;\n margin: 8px 0px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: 100%;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number]::-moz-placeholder {\n opacity: 0;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number]::placeholder {\n opacity: 0;\n}\n@media screen and (max-width: 768px) {\n .formfield-module_formField__w6mH9 {\n max-width: 75%;\n }\n}\n\n.formfield-module_topMargin__dahW5 {\n margin-top: 12px;\n}\n\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text] {\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text]::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text]::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number] {\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number]::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number]::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has([is=coles-solid-select]) [is=coles-solid-select] {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(textarea) {\n width: 100%;\n height: auto;\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.formfield-module_legendStyle__gnI49 {\n background-color: transparent;\n opacity: var(--text-emphasis-medium, 87%);\n width: 100%;\n transition: all 0.3s ease;\n}\n\n.formfield-module_checkboxPadding__DU1CG {\n padding: 0px;\n padding-bottom: 10px;\n padding-left: 10px;\n padding-right: 10px;\n}\n\n.formfield-module_errorContainer__HR4PL {\n position: relative;\n min-height: 2rem;\n}\n\n.formfield-module_error__wNBh2 {\n position: absolute;\n background: transparent;\n color: var(--error-color, #B00020);\n font-size: 10px;\n}";
3376
+ var style = {"formField":"formfield-module_formField__w6mH9","has-focus":"formfield-module_has-focus__9ingx","primary":"formfield-module_primary__7BYyQ","legendStyle":"formfield-module_legendStyle__gnI49","errorContainer":"formfield-module_errorContainer__HR4PL","error":"formfield-module_error__wNBh2"};
3377
+ styleInject(css_248z$2);
3378
+
3379
+ var _tmpl$$2 = /*#__PURE__*/template(`<fieldset><legend><span>`),
3380
+ _tmpl$2$2 = /*#__PURE__*/template(`<div>`);
3381
+ const FormField = props => {
3382
+ return createComponent(Provider$1, {
3383
+ get name() {
3384
+ return props.name;
3385
+ },
3386
+ get formName() {
3387
+ return props.formName;
3388
+ },
3389
+ get children() {
3390
+ return createComponent(FormField2, props);
3391
+ }
3392
+ });
3393
+ };
3394
+ const FormField2 = props => {
3395
+ const [local, others] = splitProps(props, ["children", "styleType", "name", "class", "legendClass", "formName"]);
3396
+ const context = useFormProvider();
3397
+ const formContext = useFormContext();
3398
+ const [fieldRef, setFieldRef] = createSignal(); // Moved up before it's used
3399
+ const hasValue = val => {
3400
+ if (val === undefined || val === null) return false;
3401
+ if (typeof val === "string" && val.trim() === "") return false;
3402
+ if (Array.isArray(val) && val.length === 0) return false;
3403
+ return true;
3404
+ };
3405
+ const shouldFloat = createMemo(() => {
3406
+ let currentVal;
3407
+ if (hasValue(formContext?.data?.[local?.formName ?? ''])) {
3408
+ currentVal = formContext?.data?.[local?.formName ?? ''];
3409
+ }
3410
+ if (hasValue(context?.getValue?.())) {
3411
+ currentVal = context?.getValue?.();
3412
+ }
3413
+ return hasValue(currentVal) || context?.getFocused?.();
3414
+ });
3415
+ const theChildren = children(() => props.children);
3416
+ const formErrors = () => {
3417
+ const allErrors = (formContext?.formGroup.getErrors(local?.formName ?? '') ?? []).filter(error => error.hasError);
3418
+ if (allErrors.length === 0) return [];
3419
+ let errKeys = allErrors.map(error => error.key);
3420
+ // test just require
3421
+ if (errKeys.includes('required')) {
3422
+ errKeys = errKeys.filter(err => err !== 'minLength' && err !== 'maxLength');
3423
+ }
3424
+ //---
3425
+ return context?.getErrors?.().err.filter(err => errKeys.includes(err.key));
3426
+ };
3427
+ const hasRequired = createMemo(() => {
3428
+ if (isNullish(local?.formName)) return false;
3429
+ if (Object.keys(props).includes('required') && props.required !== false) return true;
3430
+ return formContext?.formGroup?.hasValidator?.(local?.formName ?? '', 'required');
3431
+ });
3432
+ const getErrorLocStyle = index => {
3433
+ const fieldBox = fieldRef()?.getBoundingClientRect();
3434
+ if (!fieldBox) return {};
3435
+ return {
3436
+ top: `${index * 12}px`
3437
+ };
3438
+ };
3439
+ createEffect(() => {
3440
+ context.setName(props.name);
3441
+ });
3442
+ context?.setFocused?.(false);
3443
+ useClickOutside([fieldRef], () => {
3444
+ if (!isNullish(formContext?.data)) {
3445
+ const value = formContext?.data?.[local?.formName ?? ''];
3446
+ context?.setTextInside(!hasValue(value));
3447
+ } else if (!isNullish(context?.getValue)) {
3448
+ const val = context?.getValue?.();
3449
+ context?.setTextInside(!hasValue(val));
3450
+ }
3451
+ context?.setFocused(prev => {
3452
+ if (prev) {
3453
+ formContext?.formGroup?.validate?.(local?.formName ?? '');
3454
+ }
3455
+ return false;
3456
+ });
3457
+ });
3458
+ onMount(() => {
3459
+ if (context?.getValue !== undefined) {
3460
+ const textInside = !hasValue(context?.getValue?.());
3461
+ context.setTextInside(textInside);
3462
+ }
3463
+ });
3464
+ createEffect(() => {
3465
+ const fieldRefer = fieldRef?.();
3466
+ if (fieldRefer) {
3467
+ context?.setFormFieldRef?.(fieldRefer);
2921
3468
  }
2922
- // Validate a specific control in the form array.
2923
- const errors = this.internalValidation.map(([_, validators]) => {
2924
- return validators.map(validator => ({
2925
- key: validator.errKey,
2926
- hasError: !validator.revalidate(values[index])
2927
- }));
3469
+ });
3470
+ return [(() => {
3471
+ var _el$ = _tmpl$$2(),
3472
+ _el$2 = _el$.firstChild,
3473
+ _el$3 = _el$2.firstChild;
3474
+ use(setFieldRef, _el$);
3475
+ spread(_el$, mergeProps(others, {
3476
+ get ["class"]() {
3477
+ return `${style["primary"]} ${style.formField} ${shouldFloat() ? style["has-focus"] : ""} ${local.class ?? ''}`;
3478
+ }
3479
+ }), false, true);
3480
+ insert(_el$3, createComponent(Show, {
3481
+ get when() {
3482
+ return !hasRequired();
3483
+ },
3484
+ get children() {
3485
+ return context.getName();
3486
+ }
3487
+ }), null);
3488
+ insert(_el$3, createComponent(Show, {
3489
+ get when() {
3490
+ return hasRequired();
3491
+ },
3492
+ get children() {
3493
+ return [createMemo(() => context?.getName()), " *"];
3494
+ }
3495
+ }), null);
3496
+ insert(_el$, theChildren, null);
3497
+ createRenderEffect(_p$ => {
3498
+ var _v$ = `${local?.legendClass ?? ''}`,
3499
+ _v$2 = `${style.legendStyle}`;
3500
+ _v$ !== _p$.e && className(_el$2, _p$.e = _v$);
3501
+ _v$2 !== _p$.t && className(_el$3, _p$.t = _v$2);
3502
+ return _p$;
3503
+ }, {
3504
+ e: undefined,
3505
+ t: undefined
2928
3506
  });
2929
- this.errors[index] = errors.flat();
2930
- return this.errors[index].every(error => !error.hasError);
2931
- }
2932
- }
3507
+ return _el$;
3508
+ })(), (() => {
3509
+ var _el$4 = _tmpl$2$2();
3510
+ insert(_el$4, createComponent(For, {
3511
+ get each() {
3512
+ return formErrors();
3513
+ },
3514
+ children: (error, index) => {
3515
+ return (() => {
3516
+ var _el$5 = _tmpl$2$2();
3517
+ insert(_el$5, () => error.display);
3518
+ createRenderEffect(_p$ => {
3519
+ var _v$3 = style.error,
3520
+ _v$4 = getErrorLocStyle(index());
3521
+ _v$3 !== _p$.e && className(_el$5, _p$.e = _v$3);
3522
+ _p$.t = style$9(_el$5, _v$4, _p$.t);
3523
+ return _p$;
3524
+ }, {
3525
+ e: undefined,
3526
+ t: undefined
3527
+ });
3528
+ return _el$5;
3529
+ })();
3530
+ }
3531
+ }));
3532
+ createRenderEffect(() => className(_el$4, style.errorContainer));
3533
+ return _el$4;
3534
+ })()];
3535
+ };
2933
3536
 
2934
3537
  /**
2935
3538
  * A collection of static validator functions that return a ValidatorResult.
@@ -3070,7 +3673,8 @@ class FormGroup {
3070
3673
  this.keys.push(key);
3071
3674
  if (value instanceof FormArray) {
3072
3675
  // If the value is a FormArray, store it directly.
3073
- newData[key] = value;
3676
+ // We need to ensure that when T[key] is an array type, we store the array returned by FormArray
3677
+ newData[key] = value.get();
3074
3678
  } else {
3075
3679
  // Otherwise, initialize the data, validators, and errors for the control.
3076
3680
  newData[key] = value[0];
@@ -3087,8 +3691,26 @@ class FormGroup {
3087
3691
  }
3088
3692
  get(key) {
3089
3693
  if (!key) return Clone(this.internalDataSignal[0]);
3694
+ // If the control is a FormArray, use its get method
3695
+ if (this.internalDataSignal[0][key] instanceof FormArray) {
3696
+ // Return the array from FormArray.get() as the expected type T[K]
3697
+ return this.internalDataSignal[0][key].get();
3698
+ }
3090
3699
  return Clone(this.internalDataSignal[0][key]);
3091
3700
  }
3701
+ /**
3702
+ * Gets a specific item from a FormArray at the given index
3703
+ *
3704
+ * @param key - The key of the form control containing the FormArray
3705
+ * @param index - The index to retrieve from the array
3706
+ * @returns The item at the specified index, or undefined if not found
3707
+ */
3708
+ getArrayItem(key, index) {
3709
+ if (this.internalDataSignal[0][key] instanceof FormArray) {
3710
+ return this.internalDataSignal[0][key].getAt(index);
3711
+ }
3712
+ return undefined;
3713
+ }
3092
3714
  /**
3093
3715
  * Checks whether a specific validator error exists for a given control.
3094
3716
  *
@@ -3097,10 +3719,22 @@ class FormGroup {
3097
3719
  * @returns `true` if the error exists, otherwise `false`.
3098
3720
  */
3099
3721
  hasValidator(key, errKey) {
3100
- return this.errors[0]()?.[key]?.some(error => error.key === errKey);
3722
+ if (this.internalDataSignal[0][key] instanceof FormArray) {
3723
+ return this.internalDataSignal[0][key].hasError();
3724
+ }
3725
+ return this.errors[0]()?.[key]?.some(error => error.key === errKey) ?? false;
3101
3726
  }
3727
+ /**
3728
+ * Gets all errors for a specific control
3729
+ *
3730
+ * @param key - The key of the form control
3731
+ * @returns An array of errors for the control
3732
+ */
3102
3733
  getErrors(key) {
3103
- return this.errors[0]()?.[key];
3734
+ if (this.internalDataSignal[0][key] instanceof FormArray) {
3735
+ return [];
3736
+ }
3737
+ return this.errors[0]()?.[key] ?? [];
3104
3738
  }
3105
3739
  /**
3106
3740
  * Determines if a specific control has any validation errors.
@@ -3109,10 +3743,24 @@ class FormGroup {
3109
3743
  * @returns `true` if any error is present, otherwise `false`.
3110
3744
  */
3111
3745
  hasError(key) {
3112
- return this.errors[0]()?.[key]?.some(error => error.hasError);
3746
+ if (this.internalDataSignal[0][key] instanceof FormArray) {
3747
+ return this.internalDataSignal[0][key].hasError();
3748
+ }
3749
+ return this.errors[0]()?.[key]?.some(error => error.hasError) ?? false;
3113
3750
  }
3751
+ /**
3752
+ * Sets an error state for a validator on a specific control
3753
+ *
3754
+ * @param key - The key of the form control
3755
+ * @param errKey - The error key to update
3756
+ * @param hasError - Whether the error should be set or cleared
3757
+ */
3114
3758
  setError(key, errKey, hasError) {
3115
- const errorIndex = this.errors[0]()[key].findIndex(error => error.key === errKey);
3759
+ if (this.internalDataSignal[0][key] instanceof FormArray) {
3760
+ // Not supported for FormArray - errors are managed internally
3761
+ return;
3762
+ }
3763
+ const errorIndex = this.errors[0]()[key]?.findIndex(error => error.key === errKey);
3116
3764
  if (errorIndex !== -1) {
3117
3765
  this.errors[1](old => {
3118
3766
  old[key][errorIndex].hasError = hasError;
@@ -3127,11 +3775,41 @@ class FormGroup {
3127
3775
  * @param value - The new value to assign to the control.
3128
3776
  */
3129
3777
  set(key, value) {
3778
+ // If the control is a FormArray, use its set method
3779
+ if (this.internalDataSignal[0][key] instanceof FormArray) {
3780
+ if (Array.isArray(value)) {
3781
+ this.internalDataSignal[0][key].set(value);
3782
+ }
3783
+ return;
3784
+ }
3130
3785
  this.internalDataSignal[1](old => ({
3131
3786
  ...old,
3132
3787
  [key]: value
3133
3788
  }));
3134
3789
  }
3790
+ /**
3791
+ * Adds an item to a FormArray control
3792
+ *
3793
+ * @param key - The key of the FormArray control
3794
+ * @param controlValidation - The validation for the new item
3795
+ * @param value - Optional initial value for the new item
3796
+ */
3797
+ addToArray(key, controlValidation, value) {
3798
+ if (this.internalDataSignal[0][key] instanceof FormArray) {
3799
+ this.internalDataSignal[0][key].add(controlValidation, value);
3800
+ }
3801
+ }
3802
+ /**
3803
+ * Removes an item from a FormArray control
3804
+ *
3805
+ * @param key - The key of the FormArray control
3806
+ * @param index - The index of the item to remove
3807
+ */
3808
+ removeFromArray(key, index) {
3809
+ if (this.internalDataSignal[0][key] instanceof FormArray) {
3810
+ this.internalDataSignal[0][key].remove(index);
3811
+ }
3812
+ }
3135
3813
  /**
3136
3814
  * Validates the form data.
3137
3815
  *
@@ -3145,14 +3823,12 @@ class FormGroup {
3145
3823
  console.error('Data is null');
3146
3824
  return false;
3147
3825
  }
3148
- // Validate all controls if no key is specified.
3149
3826
  if (!key) {
3150
- const results = this.keys.map(key => this.validate(key));
3827
+ const results = this.keys.map(k => this.validate(k));
3151
3828
  return results.every(result => result);
3152
3829
  }
3153
- // For a specific control key, handle FormArray differently.
3154
- if (this.internalDataSignal[0][key] instanceof FormArray) {
3155
- return this.internalDataSignal[0][key].validate(this.internalDataSignal[0][key].get());
3830
+ if (this.internalDataSignal?.[0]?.[key] instanceof FormArray) {
3831
+ return this.internalDataSignal[0][key].validateCurrent();
3156
3832
  }
3157
3833
  const validators = this.validators[key];
3158
3834
  if (!validators) return true;
@@ -3206,26 +3882,41 @@ const useColumnContext = () => {
3206
3882
  return useContext(ColumnContext);
3207
3883
  };
3208
3884
 
3209
- var css_248z$1 = ".table-module_table__um-mK {\n border-collapse: collapse;\n text-align: center;\n}\n.table-module_table__um-mK thead tr th {\n padding: 0.5rem;\n}\n.table-module_table__um-mK tr[isdropheader=true] {\n cursor: pointer;\n}\n.table-module_table__um-mK tr td {\n padding: 0.5rem;\n width: -moz-max-content;\n width: max-content;\n}\n\n.table-module_dropRow__BugV9 {\n transform-origin: top;\n max-height: 0;\n display: none;\n animation: table-module_rowDropping__zE5Uz 0.5s reverse forwards;\n}\n\n.table-module_openDropRow__rjfjd {\n display: block;\n max-height: 2000px;\n animation: table-module_rowDropping__zE5Uz 0.5s forwards;\n}\n\n@keyframes table-module_rowDropping__zE5Uz {\n 0% {\n display: none;\n max-height: 0;\n opacity: 0;\n }\n 1% {\n display: block;\n max-height: 0;\n opacity: 0;\n }\n 100% {\n max-height: 2000px;\n opacity: 1;\n }\n}";
3885
+ var css_248z$1 = ".table-module_table__um-mK {\n border-collapse: collapse;\n text-align: center;\n}\n.table-module_table__um-mK thead tr th {\n padding: 0.5rem;\n}\n.table-module_table__um-mK tr[isdropheader=true] {\n cursor: pointer;\n}\n.table-module_table__um-mK tr[isdropheader=true]:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.table-module_table__um-mK tr td {\n padding: 0.5rem;\n width: -moz-max-content;\n width: max-content;\n}\n\n.table-module_dropRow__BugV9 {\n transform-origin: top;\n animation: table-module_rowDropping__zE5Uz 0.5s reverse forwards;\n display: none;\n}\n\n.table-module_openDropRow__rjfjd {\n animation: table-module_rowDropping__zE5Uz 0.5s forwards;\n display: table-row;\n}\n\n@keyframes table-module_rowDropping__zE5Uz {\n 0% {\n max-height: 0;\n opacity: 0;\n }\n 1% {\n max-height: 0;\n opacity: 0;\n }\n 100% {\n max-height: 2000px;\n opacity: 1;\n }\n}";
3210
3886
  var styles$1 = {"table":"table-module_table__um-mK","dropRow":"table-module_dropRow__BugV9","openDropRow":"table-module_openDropRow__rjfjd"};
3211
3887
  styleInject(css_248z$1);
3212
3888
 
3213
- var _tmpl$$1 = /*#__PURE__*/template(`<table><colgroup></colgroup><thead></thead><tbody></tbody><tfoot>`),
3214
- _tmpl$2$1 = /*#__PURE__*/template(`<col>`),
3215
- _tmpl$3$1 = /*#__PURE__*/template(`<tr>`),
3216
- _tmpl$4 = /*#__PURE__*/template(`<th>`),
3217
- _tmpl$5 = /*#__PURE__*/template(`<td>`);
3889
+ var _tmpl$$1 = /*#__PURE__*/template(`<span>Error`),
3890
+ _tmpl$2$1 = /*#__PURE__*/template(`<table><colgroup></colgroup><thead></thead><tbody></tbody><tfoot>`),
3891
+ _tmpl$3$1 = /*#__PURE__*/template(`<col>`),
3892
+ _tmpl$4 = /*#__PURE__*/template(`<tr>`),
3893
+ _tmpl$5 = /*#__PURE__*/template(`<th>`),
3894
+ _tmpl$6 = /*#__PURE__*/template(`<td>`);
3218
3895
  const Table = props => {
3219
- const formContext = useFormContext();
3896
+ const [redrawRows, setRedrawRows] = createSignal(false);
3897
+ const [mounted, setMounted] = createSignal(false);
3220
3898
  const tableContext = {};
3221
3899
  const getProps = () => props;
3222
- // const internalData = (() => {
3223
- // return props.data();
3224
- // });
3225
- // tableContext.getDataSource = () => props.data();
3900
+ const tableData = () => {
3901
+ redrawRows();
3902
+ return props.data() ?? [];
3903
+ };
3904
+ // Create a reactive memo for columns to handle dynamic changes
3905
+ const reactiveColumns = createMemo(() => getProps().columns);
3906
+ // Add effect to reset column styles when columns change
3907
+ createEffect(() => {
3908
+ const columns = reactiveColumns();
3909
+ if (columns.length > 0) {
3910
+ // Reset column styles when columns change
3911
+ setColumnStyle({});
3912
+ }
3913
+ });
3226
3914
  tableContext.setDataSource = data => {
3227
3915
  getProps().setData?.(() => [...data]);
3228
- formContext.setData(data);
3916
+ };
3917
+ tableContext.getDataSource = () => {
3918
+ const data = getProps().data();
3919
+ return data;
3229
3920
  };
3230
3921
  const [headers, setHeaders] = createSignal({});
3231
3922
  tableContext.addHeaderCell = (name, index, header) => {
@@ -3239,31 +3930,72 @@ const Table = props => {
3239
3930
  });
3240
3931
  });
3241
3932
  };
3242
- const [rows, setRows] = createSignal({});
3243
- tableContext.addRowCell = (index, name, cell) => {
3933
+ // const [rows, setRows] = createSignal<RowOrganized<T>>({});
3934
+ const [rowData, setRows] = createStore({});
3935
+ const rows = () => {
3936
+ mounted();
3937
+ return rowData;
3938
+ };
3939
+ tableContext.addRowCell = (index, name, cell, isDropDown) => {
3244
3940
  setRows(old => {
3245
- return {
3246
- ...old,
3247
- [index]: {
3248
- ...old[index],
3249
- [name]: {
3250
- element: cell,
3251
- dropRow: old?.[index]?.[name]?.dropRow ?? false
3252
- }
3253
- }
3941
+ const newRows = {
3942
+ ...old
3943
+ };
3944
+ if (!newRows[index]) {
3945
+ newRows[index] = {};
3946
+ }
3947
+ // Preserve any existing dropHeader flag when updating a row
3948
+ const existingData = old[index]?.[name];
3949
+ newRows[index][name] = {
3950
+ element: cell,
3951
+ dropRow: !!isDropDown,
3952
+ dropHeader: existingData?.dropHeader || false
3953
+ };
3954
+ return newRows;
3955
+ });
3956
+ };
3957
+ tableContext.removeRowCell = (index, name) => {
3958
+ setRows(old => {
3959
+ if (!old[index] || !old[index][name]) return old;
3960
+ const newRows = {
3961
+ ...old
3962
+ };
3963
+ const newRowData = {
3964
+ ...newRows[index]
3254
3965
  };
3966
+ delete newRowData[name];
3967
+ newRows[index] = newRowData;
3968
+ return newRows;
3255
3969
  });
3256
3970
  };
3257
3971
  const [footerCell, setFooterCell] = createSignal({});
3258
3972
  tableContext.addFooterCell = (index, name, cell) => {
3259
3973
  setFooterCell(old => {
3260
- return {
3261
- ...old,
3262
- [index]: {
3263
- ...old[index],
3264
- [name]: cell
3265
- }
3974
+ const newFooter = {
3975
+ ...old
3976
+ };
3977
+ if (!newFooter[index]) {
3978
+ newFooter[index] = {};
3979
+ }
3980
+ newFooter[index] = {
3981
+ ...newFooter[index],
3982
+ [name]: cell
3983
+ };
3984
+ return newFooter;
3985
+ });
3986
+ };
3987
+ tableContext.removeFooterCell = (index, name) => {
3988
+ setFooterCell(old => {
3989
+ if (!old[index] || !old[index][name]) return old;
3990
+ const newFooter = {
3991
+ ...old
3992
+ };
3993
+ const newRowData = {
3994
+ ...newFooter[index]
3266
3995
  };
3996
+ delete newRowData[name];
3997
+ newFooter[index] = newRowData;
3998
+ return newFooter;
3267
3999
  });
3268
4000
  };
3269
4001
  const [headerStyle, setHeaderStyle] = createSignal({});
@@ -3303,27 +4035,43 @@ const Table = props => {
3303
4035
  });
3304
4036
  };
3305
4037
  const [rowStyle, setRowStyle] = createSignal({});
3306
- tableContext.addRowStyle = (index, style, isDroprow, isDropHeader) => {
3307
- if (!!isDroprow) {
3308
- const firstColumn = getProps()?.columns?.[0];
3309
- if (!isNullish(firstColumn)) {
3310
- setRows(old => {
3311
- return {
3312
- ...old,
3313
- [index]: {
3314
- [firstColumn]: {
3315
- element: old?.[index]?.[firstColumn]?.element ?? (() => []),
3316
- dropRow: true
3317
- }
4038
+ tableContext.addRowStyle = (index, style, isDropRow, isDropHeader) => {
4039
+ // If this is a dropdown row or dropdown header, update the row data
4040
+ const firstColumn = reactiveColumns()?.[0];
4041
+ if (!isNullish(firstColumn)) {
4042
+ setRows(old => {
4043
+ // Get existing row data
4044
+ const existingRow = old[index] || {};
4045
+ const existingCell = existingRow[firstColumn] || {
4046
+ element: () => []
4047
+ };
4048
+ return {
4049
+ ...old,
4050
+ [index]: {
4051
+ ...existingRow,
4052
+ [firstColumn]: {
4053
+ ...existingCell,
4054
+ element: existingCell.element,
4055
+ // Set dropRow based on isDropRow param or preserve existing value
4056
+ dropRow: isDropRow === true ? true : existingCell.dropRow || false,
4057
+ // Set dropHeader based on isDropHeader param or preserve existing value
4058
+ dropHeader: isDropHeader === true ? true : existingCell.dropHeader || false
3318
4059
  }
3319
- };
3320
- });
3321
- }
4060
+ }
4061
+ };
4062
+ });
3322
4063
  }
4064
+ // Update row style
3323
4065
  setRowStyle(old => {
3324
4066
  return {
3325
4067
  ...old,
3326
- [index]: style
4068
+ [index]: {
4069
+ ...style,
4070
+ all: {
4071
+ ...style?.all,
4072
+ isDropHeader: isDropHeader === true ? true : undefined
4073
+ }
4074
+ }
3327
4075
  };
3328
4076
  });
3329
4077
  };
@@ -3354,22 +4102,73 @@ const Table = props => {
3354
4102
  };
3355
4103
  });
3356
4104
  };
4105
+ // Add a removeColumnStyle method to allow cleanup
4106
+ tableContext.removeColumnStyle = name => {
4107
+ setColumnStyle(old => {
4108
+ const newStyles = {
4109
+ ...old
4110
+ };
4111
+ delete newStyles[name];
4112
+ return newStyles;
4113
+ });
4114
+ };
3357
4115
  const headerFactory = (index, column) => {
3358
4116
  return headers()?.[index]?.[column];
3359
4117
  };
3360
4118
  const rowStyleFactory = rowNum => {
3361
- return rowStyle()?.[rowNum];
4119
+ return rowStyle()?.[rowNum] ?? {};
3362
4120
  };
3363
4121
  const [dropOpenStore, setDropOpenStore] = createStore([]);
4122
+ // Enhanced renderCell with better type safety and error handling
4123
+ const renderCell = (cell, item, index) => {
4124
+ if (typeof cell === 'function') {
4125
+ try {
4126
+ return cell(item, index);
4127
+ } catch (error) {
4128
+ console.error('Error rendering table cell:', error, {
4129
+ cellType: typeof cell,
4130
+ itemType: typeof item,
4131
+ index
4132
+ });
4133
+ return (() => {
4134
+ var _el$ = _tmpl$$1();
4135
+ createRenderEffect(() => className(_el$, styles$1.errorCell));
4136
+ return _el$;
4137
+ })();
4138
+ }
4139
+ }
4140
+ // Handle null or undefined cells gracefully
4141
+ if (cell === null || cell === undefined) {
4142
+ return "Cell nully";
4143
+ }
4144
+ return cell;
4145
+ };
4146
+ onMount(() => {
4147
+ setMounted(true);
4148
+ });
4149
+ const getIsDropOpen = (rowNum, index) => {
4150
+ // Check if this row should be displayed based on its position
4151
+ const firstColumn = reactiveColumns()?.[0];
4152
+ const rowData = rows()?.[rowNum]?.[firstColumn];
4153
+ // For regular rows, show normally
4154
+ if (!rowData?.dropRow) {
4155
+ return true;
4156
+ }
4157
+ // For dropdown rows, respect the dropdown state
4158
+ return dropOpenStore[index] ?? false;
4159
+ };
4160
+ const dropRowStyle = (rowNum, index) => {
4161
+ return getIsDropOpen(rowNum, index) ? styles$1.openDropRow : styles$1.dropRow;
4162
+ };
3364
4163
  return createComponent(TableProvider, mergeProps(tableContext, {
3365
4164
  get children() {
3366
4165
  return [(() => {
3367
- var _el$ = _tmpl$$1(),
3368
- _el$2 = _el$.firstChild,
3369
- _el$3 = _el$2.nextSibling,
4166
+ var _el$2 = _tmpl$2$1(),
4167
+ _el$3 = _el$2.firstChild,
3370
4168
  _el$4 = _el$3.nextSibling,
3371
- _el$5 = _el$4.nextSibling;
3372
- spread(_el$2, mergeProps(() => getProps()?.otherStyles?.colGroup?.all, {
4169
+ _el$5 = _el$4.nextSibling,
4170
+ _el$6 = _el$5.nextSibling;
4171
+ spread(_el$3, mergeProps(() => getProps()?.otherStyles?.colGroup?.all, {
3373
4172
  get style() {
3374
4173
  return getProps().otherStyles?.colGroup?.style;
3375
4174
  },
@@ -3377,13 +4176,13 @@ const Table = props => {
3377
4176
  return getProps().otherStyles?.colGroup?.class;
3378
4177
  }
3379
4178
  }), false, true);
3380
- insert(_el$2, createComponent(For, {
4179
+ insert(_el$3, createComponent(For, {
3381
4180
  get each() {
3382
- return getProps().columns;
4181
+ return reactiveColumns();
3383
4182
  },
3384
4183
  children: column => (() => {
3385
- var _el$6 = _tmpl$2$1();
3386
- spread(_el$6, mergeProps(() => columnStyle()[column]?.all, {
4184
+ var _el$7 = _tmpl$3$1();
4185
+ spread(_el$7, mergeProps(() => columnStyle()[column]?.all, {
3387
4186
  get style() {
3388
4187
  return columnStyle()[column]?.style;
3389
4188
  },
@@ -3391,10 +4190,10 @@ const Table = props => {
3391
4190
  return columnStyle()[column]?.class;
3392
4191
  }
3393
4192
  }), false, false);
3394
- return _el$6;
4193
+ return _el$7;
3395
4194
  })()
3396
4195
  }));
3397
- spread(_el$3, mergeProps(() => getProps()?.otherStyles?.thead?.all, {
4196
+ spread(_el$4, mergeProps(() => getProps()?.otherStyles?.thead?.all, {
3398
4197
  get style() {
3399
4198
  return getProps().otherStyles?.thead?.style;
3400
4199
  },
@@ -3402,22 +4201,22 @@ const Table = props => {
3402
4201
  return getProps().otherStyles?.thead?.class;
3403
4202
  }
3404
4203
  }), false, true);
3405
- insert(_el$3, createComponent(For, {
4204
+ insert(_el$4, createComponent(For, {
3406
4205
  get each() {
3407
4206
  return Object.keys(headers()).map(key => parseInt(key)).sort((a, b) => a - b);
3408
4207
  },
3409
4208
  children: rowNum => {
3410
4209
  return (() => {
3411
- var _el$7 = _tmpl$3$1();
3412
- insert(_el$7, createComponent(For, {
4210
+ var _el$8 = _tmpl$4();
4211
+ insert(_el$8, createComponent(For, {
3413
4212
  get each() {
3414
- return getProps().columns;
4213
+ return reactiveColumns();
3415
4214
  },
3416
4215
  children: (column, index) => {
3417
4216
  const headCell = headers()[rowNum]?.[column];
3418
4217
  return !!headCell ? (() => {
3419
- var _el$8 = _tmpl$4();
3420
- spread(_el$8, mergeProps(() => headerStyle()[column]?.[rowNum]?.all, {
4218
+ var _el$9 = _tmpl$5();
4219
+ spread(_el$9, mergeProps(() => headerStyle()[column]?.[rowNum]?.all, {
3421
4220
  get style() {
3422
4221
  return headerStyle()[column]?.[rowNum]?.style;
3423
4222
  },
@@ -3425,26 +4224,26 @@ const Table = props => {
3425
4224
  return headerStyle()[column]?.[rowNum]?.class;
3426
4225
  }
3427
4226
  }), false, true);
3428
- insert(_el$8, () => headerFactory(rowNum, column));
3429
- return _el$8;
4227
+ insert(_el$9, () => headerFactory(rowNum, column));
4228
+ return _el$9;
3430
4229
  })() : [];
3431
4230
  }
3432
4231
  }));
3433
4232
  createRenderEffect(_p$ => {
3434
4233
  var _v$4 = headerRowStyle()[rowNum]?.style,
3435
4234
  _v$5 = headerRowStyle()[rowNum]?.class;
3436
- _p$.e = style$9(_el$7, _v$4, _p$.e);
3437
- _v$5 !== _p$.t && className(_el$7, _p$.t = _v$5);
4235
+ _p$.e = style$9(_el$8, _v$4, _p$.e);
4236
+ _v$5 !== _p$.t && className(_el$8, _p$.t = _v$5);
3438
4237
  return _p$;
3439
4238
  }, {
3440
4239
  e: undefined,
3441
4240
  t: undefined
3442
4241
  });
3443
- return _el$7;
4242
+ return _el$8;
3444
4243
  })();
3445
4244
  }
3446
4245
  }));
3447
- spread(_el$4, mergeProps(() => getProps()?.otherStyles?.tbody?.all, {
4246
+ spread(_el$5, mergeProps(() => getProps()?.otherStyles?.tbody?.all, {
3448
4247
  get style() {
3449
4248
  return getProps().otherStyles?.tbody?.style;
3450
4249
  },
@@ -3452,9 +4251,9 @@ const Table = props => {
3452
4251
  return getProps().otherStyles?.tbody?.class;
3453
4252
  }
3454
4253
  }), false, true);
3455
- insert(_el$4, createComponent(For, {
4254
+ insert(_el$5, createComponent(For, {
3456
4255
  get each() {
3457
- return getProps().data();
4256
+ return tableData();
3458
4257
  },
3459
4258
  children: (item, index) => createComponent(For, {
3460
4259
  get each() {
@@ -3462,53 +4261,56 @@ const Table = props => {
3462
4261
  },
3463
4262
  children: rowNum => {
3464
4263
  return (() => {
3465
- var _el$9 = _tmpl$3$1();
3466
- spread(_el$9, mergeProps(() => rowStyleFactory(rowNum)?.all, {
4264
+ var _el$10 = _tmpl$4();
4265
+ spread(_el$10, mergeProps(() => rowStyleFactory?.(rowNum)?.all, {
3467
4266
  get style() {
3468
- return rowStyleFactory(rowNum)?.style;
4267
+ return rowStyleFactory?.(rowNum)?.style;
3469
4268
  },
3470
4269
  "onClick": e => {
3471
- e.stopPropagation();
3472
- e.preventDefault();
3473
- // @ts-ignore
3474
- if (Object.keys(rowStyleFactory(rowNum).all).includes('isDropHeader')) {
3475
- setDropOpenStore(index(), !!!dropOpenStore[index()]);
4270
+ const firstColumn = reactiveColumns()?.[0];
4271
+ const rowData = rows()?.[rowNum]?.[firstColumn];
4272
+ // Only toggle dropdown state if this is a header row
4273
+ if (rowData?.dropHeader === true) {
4274
+ e.preventDefault();
4275
+ setDropOpenStore(index(), !dropOpenStore[index()]);
4276
+ }
4277
+ // Call any additional click handlers
4278
+ if (rowStyleFactory !== undefined) {
4279
+ const onClick = rowStyleFactory(rowNum).all?.onClick;
4280
+ if (typeof onClick === 'function') {
4281
+ onClick(e);
4282
+ }
3476
4283
  }
3477
- // @ts-ignore
3478
- rowStyleFactory(rowNum).all?.onClick?.(e);
3479
4284
  },
3480
4285
  get ["class"]() {
3481
- return rowStyleFactory(rowNum)?.class;
4286
+ return `${dropRowStyle(rowNum, index())} ${rowStyleFactory?.(rowNum)?.all?.class ?? ''}`;
3482
4287
  }
3483
4288
  }), false, true);
3484
- insert(_el$9, createComponent(For, {
4289
+ insert(_el$10, createComponent(For, {
3485
4290
  get each() {
3486
- return getProps().columns;
4291
+ return reactiveColumns();
3487
4292
  },
3488
4293
  children: column => {
3489
4294
  const tableSpot = rows()[rowNum]?.[column];
3490
4295
  const cell = tableSpot?.element;
3491
- if (!!tableSpot?.dropRow) {
3492
- setDropOpenStore(index(), old => old ?? false);
4296
+ // Initialize dropdown state for this row if dropdown capabilities exist
4297
+ if (tableSpot?.dropRow === true || tableSpot?.dropHeader === true) {
4298
+ // Initialize with closed state if not already set
4299
+ if (dropOpenStore[index()] === undefined) {
4300
+ setDropOpenStore(index(), false);
4301
+ }
4302
+ }
4303
+ if (Object.keys(tableSpot ?? {}).includes('dropRow') && tableSpot?.dropRow !== false) {
3493
4304
  return (() => {
3494
- var _el$10 = _tmpl$5();
3495
- insert(_el$10, () => cell(item, index()));
3496
- createRenderEffect(_p$ => {
3497
- var _v$6 = `${styles$1.dropRow} ${!!dropOpenStore[index()] === true ? styles$1.openDropRow : ''} `,
3498
- _v$7 = getProps().columns.length;
3499
- _v$6 !== _p$.e && className(_el$10, _p$.e = _v$6);
3500
- _v$7 !== _p$.t && setAttribute(_el$10, "colspan", _p$.t = _v$7);
3501
- return _p$;
3502
- }, {
3503
- e: undefined,
3504
- t: undefined
3505
- });
3506
- return _el$10;
4305
+ var _el$11 = _tmpl$6();
4306
+ insert(_el$11, () => renderCell(cell, item, index()));
4307
+ createRenderEffect(() => setAttribute(_el$11, "colspan", reactiveColumns().length));
4308
+ return _el$11;
3507
4309
  })();
3508
4310
  }
3509
4311
  return !isNullish(cell) ? (() => {
3510
- var _el$11 = _tmpl$5();
3511
- spread(_el$11, mergeProps(() => cellStyle?.()?.[rowNum]?.[column]?.all, {
4312
+ var _el$12 = _tmpl$6();
4313
+ spread(_el$12, mergeProps(() => cellStyle?.()?.[rowNum]?.[column]?.all, {
3512
4314
  get style() {
3513
4315
  return cellStyle()[rowNum]?.[column]?.style;
3514
4316
  },
@@ -3516,17 +4318,17 @@ const Table = props => {
3516
4318
  return cellStyle()[rowNum]?.[column]?.class;
3517
4319
  }
3518
4320
  }), false, true);
3519
- insert(_el$11, () => cell(item, index()));
3520
- return _el$11;
4321
+ insert(_el$12, () => renderCell(cell, item, index()));
4322
+ return _el$12;
3521
4323
  })() : [];
3522
4324
  }
3523
4325
  }));
3524
- return _el$9;
4326
+ return _el$10;
3525
4327
  })();
3526
4328
  }
3527
4329
  })
3528
4330
  }));
3529
- spread(_el$5, mergeProps(() => getProps()?.otherStyles?.tfoot?.all, {
4331
+ spread(_el$6, mergeProps(() => getProps()?.otherStyles?.tfoot?.all, {
3530
4332
  get style() {
3531
4333
  return getProps().otherStyles?.tfoot?.style;
3532
4334
  },
@@ -3534,14 +4336,14 @@ const Table = props => {
3534
4336
  return getProps().otherStyles?.tfoot?.class;
3535
4337
  }
3536
4338
  }), false, true);
3537
- insert(_el$5, createComponent(For, {
4339
+ insert(_el$6, createComponent(For, {
3538
4340
  get each() {
3539
4341
  return Object.keys(footerCell()).map(key => parseInt(key)).sort((a, b) => a - b);
3540
4342
  },
3541
4343
  children: rowNum => {
3542
4344
  return (() => {
3543
- var _el$12 = _tmpl$3$1();
3544
- spread(_el$12, mergeProps(() => footerStyle()[rowNum]?.all, {
4345
+ var _el$13 = _tmpl$4();
4346
+ spread(_el$13, mergeProps(() => footerStyle()[rowNum]?.all, {
3545
4347
  get style() {
3546
4348
  return footerStyle()[rowNum]?.style;
3547
4349
  },
@@ -3549,15 +4351,15 @@ const Table = props => {
3549
4351
  return footerStyle()[rowNum]?.class;
3550
4352
  }
3551
4353
  }), false, true);
3552
- insert(_el$12, createComponent(For, {
4354
+ insert(_el$13, createComponent(For, {
3553
4355
  get each() {
3554
- return getProps().columns;
4356
+ return reactiveColumns();
3555
4357
  },
3556
4358
  children: column => {
3557
4359
  const footCell = footerCell()[rowNum]?.[column];
3558
4360
  return !!footCell ? (() => {
3559
- var _el$13 = _tmpl$5();
3560
- spread(_el$13, mergeProps(() => footCellStyle()?.[rowNum]?.[column]?.all, {
4361
+ var _el$14 = _tmpl$6();
4362
+ spread(_el$14, mergeProps(() => footCellStyle()?.[rowNum]?.[column]?.all, {
3561
4363
  get style() {
3562
4364
  return footCellStyle()[rowNum]?.[column]?.style;
3563
4365
  },
@@ -3565,29 +4367,29 @@ const Table = props => {
3565
4367
  return footCellStyle()[rowNum]?.[column]?.class;
3566
4368
  }
3567
4369
  }), false, true);
3568
- insert(_el$13, footCell);
3569
- return _el$13;
4370
+ insert(_el$14, footCell);
4371
+ return _el$14;
3570
4372
  })() : [];
3571
4373
  }
3572
4374
  }));
3573
- return _el$12;
4375
+ return _el$13;
3574
4376
  })();
3575
4377
  }
3576
4378
  }));
3577
4379
  createRenderEffect(_p$ => {
3578
4380
  var _v$ = getProps().id,
3579
- _v$2 = `${styles$1.table} ${getProps().class}`,
4381
+ _v$2 = `${styles$1.table} ${getProps().class || ''}`,
3580
4382
  _v$3 = getProps().style;
3581
- _v$ !== _p$.e && setAttribute(_el$, "id", _p$.e = _v$);
3582
- _v$2 !== _p$.t && className(_el$, _p$.t = _v$2);
3583
- _p$.a = style$9(_el$, _v$3, _p$.a);
4383
+ _v$ !== _p$.e && setAttribute(_el$2, "id", _p$.e = _v$);
4384
+ _v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
4385
+ _p$.a = style$9(_el$2, _v$3, _p$.a);
3584
4386
  return _p$;
3585
4387
  }, {
3586
4388
  e: undefined,
3587
4389
  t: undefined,
3588
4390
  a: undefined
3589
4391
  });
3590
- return _el$;
4392
+ return _el$2;
3591
4393
  })(), createMemo(() => props.children)];
3592
4394
  }
3593
4395
  }));
@@ -3634,52 +4436,129 @@ const Row = props => {
3634
4436
 
3635
4437
  const Column = props => {
3636
4438
  const {
3637
- addColumnStyle
4439
+ addColumnStyle,
4440
+ removeColumnStyle
3638
4441
  } = useTableContext();
3639
4442
  const [local, others] = splitProps(props, ["name", "rowNumber", "children", "class", "style"]);
4443
+ // Track the name to handle changes
4444
+ let currentName = local.name;
4445
+ // Create a reactive effect to update styles
3640
4446
  createEffect(() => {
3641
- addColumnStyle?.(local.name, {
4447
+ const newName = local.name;
4448
+ // If the name has changed, remove the old style
4449
+ if (currentName !== newName && currentName && removeColumnStyle) {
4450
+ removeColumnStyle(currentName);
4451
+ }
4452
+ // Update the current name
4453
+ currentName = newName;
4454
+ // Add the style with the new name
4455
+ addColumnStyle?.(newName, {
3642
4456
  class: local.class,
3643
4457
  style: local.style,
3644
4458
  all: others
3645
4459
  });
3646
4460
  });
4461
+ // Clean up when the component is unmounted
4462
+ onCleanup(() => {
4463
+ if (removeColumnStyle && currentName) {
4464
+ removeColumnStyle(currentName);
4465
+ }
4466
+ });
3647
4467
  return createComponent(ColumnProvider, {
3648
4468
  get name() {
3649
- return props?.name ?? ``;
4469
+ return local.name ?? ``;
3650
4470
  },
3651
4471
  get children() {
3652
- return props.children;
4472
+ return local.children;
3653
4473
  }
3654
4474
  });
3655
4475
  };
3656
4476
 
3657
4477
  const Cell = props => {
3658
- const {
3659
- name
3660
- } = useColumnContext();
4478
+ const columnContext = useColumnContext();
3661
4479
  const {
3662
4480
  addFooterCell,
3663
4481
  addFootCellStyle,
4482
+ removeFooterCell,
3664
4483
  addRowCell,
3665
- addCellStyle
4484
+ addCellStyle,
4485
+ removeRowCell
3666
4486
  } = useTableContext();
3667
- const [local, others] = splitProps(props, ["children", "class", "style", "footer", "rowNumber"]);
4487
+ const [local, others] = splitProps(props, ["children", "class", "style", "footer", "rowNumber", "header"]);
4488
+ // Get the column name from context or props
4489
+ const cellName = () => columnContext.name;
4490
+ // Get the current row number with a default of 1
4491
+ const rowNumber = () => (local?.rowNumber ?? 1) - 1;
4492
+ // Track registrations for cleanup
4493
+ let registeredAsFooter = false;
4494
+ let registeredAsRow = false;
3668
4495
  createEffect(() => {
3669
- if (Object.keys(props).includes('footer') && props.footer !== false) {
3670
- addFooterCell?.((local?.rowNumber ?? 1) - 1, name, local.children);
3671
- addFootCellStyle?.((local?.rowNumber ?? 1) - 1, name, {
3672
- class: local.class,
3673
- style: local.style,
3674
- all: others
3675
- });
4496
+ const name = cellName();
4497
+ const row = rowNumber();
4498
+ props.children;
4499
+ // Skip if no valid column name
4500
+ if (!name) return;
4501
+ // First clean up any previous registrations
4502
+ if (registeredAsFooter) {
4503
+ removeFooterCell?.(row, name);
4504
+ registeredAsFooter = false;
4505
+ }
4506
+ if (registeredAsRow) {
4507
+ removeRowCell?.(row, name);
4508
+ registeredAsRow = false;
4509
+ }
4510
+ // Register based on current props
4511
+ const isFooter = local.footer === true;
4512
+ const isHeader = local.header === true;
4513
+ if (isFooter) {
4514
+ // Handle footer cell registration
4515
+ if (addFooterCell && addFootCellStyle) {
4516
+ addFooterCell(row, name, local.children);
4517
+ addFootCellStyle(row, name, {
4518
+ class: local.class,
4519
+ style: local.style,
4520
+ all: others
4521
+ });
4522
+ registeredAsFooter = true;
4523
+ }
4524
+ } else if (!isHeader) {
4525
+ // Handle regular data cell registration
4526
+ if (addRowCell && addCellStyle) {
4527
+ addRowCell(row, name, local.children);
4528
+ addCellStyle(row, name, {
4529
+ class: local.class,
4530
+ style: local.style,
4531
+ all: {
4532
+ ...others,
4533
+ colSpan: others?.colSpan ?? 1
4534
+ }
4535
+ });
4536
+ registeredAsRow = true;
4537
+ }
3676
4538
  } else {
3677
- addRowCell?.((local?.rowNumber ?? 1) - 1, name, local.children);
3678
- addCellStyle?.((local?.rowNumber ?? 1) - 1, name, {
3679
- class: local.class,
3680
- style: local.style,
3681
- all: others
3682
- });
4539
+ // Handle header cell registration
4540
+ if (addRowCell && addCellStyle) {
4541
+ addRowCell(row, name, local.children);
4542
+ addCellStyle(row, name, {
4543
+ class: local.class,
4544
+ style: local.style,
4545
+ all: others
4546
+ });
4547
+ registeredAsRow = true;
4548
+ }
4549
+ }
4550
+ });
4551
+ // Clean up registered cells when component unmounts
4552
+ onCleanup(() => {
4553
+ const name = cellName();
4554
+ const row = rowNumber();
4555
+ if (name) {
4556
+ if (registeredAsFooter && removeFooterCell) {
4557
+ removeFooterCell(row, name);
4558
+ }
4559
+ if (registeredAsRow && removeRowCell) {
4560
+ removeRowCell(row, name);
4561
+ }
3683
4562
  }
3684
4563
  });
3685
4564
  return [];
@@ -3869,4 +4748,4 @@ const ColeError = props => {
3869
4748
  return [];
3870
4749
  };
3871
4750
 
3872
- export { Body, Button, Carousel, Cell, Chip, Chipbar, Column, Container, ExpansionPanel, ColeError as FieldError, Form, FormField, FormGroup, Header, Icon, Input, Menu, MenuDropdown, MenuItem, Modal, Option, Row, Select, SelectContext, Slide, SnackbarController, TabBar, Table, TextArea, Validators, addSnackbar, addTheme, carouselTitleContext };
4751
+ export { Body, Button, Carousel, Cell, Checkbox, Chip, Chipbar, Column, Container, ExpansionPanel, ColeError as FieldError, Form, FormArray, FormField, FormGroup, Header, Icon, Input, Menu, MenuDropdown, MenuItem, Modal, Option, Radio, RadioGroup, RadioGroupContext, Row, Select, Slide, SnackbarController, TabBar, Table, TextArea, Validators, addSnackbar, addTheme, carouselTitleContext };