@luminescent/ui 0.16.6 → 0.18.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.
@@ -767,166 +767,21 @@ const Shuffle = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQr
767
767
  ], "p0.width")
768
768
  }, 0, "zt_0");
769
769
  }, "Shuffle_component_DnmmsuyAgDE"));
770
- const ColorInput = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
771
- const props1 = qwik._restProps(props, [
772
- "onInput$",
773
- "value",
774
- "presetColors",
775
- "preview",
776
- "class"
777
- ]);
778
- const store = qwik.useStore({
779
- opened: false
780
- });
781
- return /* @__PURE__ */ qwik._jsxQ("div", null, {
782
- class: "relative"
783
- }, [
784
- /* @__PURE__ */ qwik._jsxQ("label", {
785
- for: qwik._wrapSignal(props1, "id")
786
- }, {
787
- class: "text-gray-300 pb-1 flex select-none"
788
- }, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "0s_0"), 1, null),
789
- /* @__PURE__ */ qwik._jsxC(TextInputRaw, {
790
- get class() {
791
- return {
792
- "w-full": true,
793
- ...props.class
794
- };
795
- },
796
- ...props1,
797
- get value() {
798
- return props.value ?? "#000000";
799
- },
800
- onFocus$: /* @__PURE__ */ qwik.inlinedQrl(() => {
801
- const [store2] = qwik.useLexicalScope();
802
- store2.opened = true;
803
- }, "ColorInput_component_div_TextInputRaw_onFocus_9bHrhSeTgfI", [
804
- store
805
- ]),
806
- onBlur$: /* @__PURE__ */ qwik.inlinedQrl(() => {
807
- const [store2] = qwik.useLexicalScope();
808
- store2.opened = false;
809
- }, "ColorInput_component_div_TextInputRaw_onBlur_giB7aSy8tnc", [
810
- store
811
- ]),
812
- onInput$: /* @__PURE__ */ qwik.inlinedQrl((e, el) => {
813
- const [props12, props2] = qwik.useLexicalScope();
814
- const div = document.getElementById(`${props12.id}-picker`);
815
- const event = new Event("change");
816
- div.dispatchEvent(event);
817
- props2.onInput$?.(el.value);
818
- }, "ColorInput_component_div_TextInputRaw_onInput_nsV3cUv0Sxg", [
819
- props1,
820
- props
821
- ]),
822
- style: (props.preview ?? "left") == "full" ? {
823
- backgroundColor: `${props.value ?? "#000000"}`,
824
- color: getBrightness(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000"))) > 0.5 ? "black" : "white"
825
- } : (props.preview ?? "left") == "left" ? {
826
- borderLeft: `35px solid ${props.value ?? "#000000"}`
827
- } : (props.preview ?? "left") == "right" ? {
828
- borderRight: `35px solid ${props.value ?? "#000000"}`
829
- } : (props.preview ?? "left") == "top" ? {
830
- borderTop: `10px solid ${props.value ?? "#000000"}`
831
- } : (props.preview ?? "left") == "bottom" ? {
832
- borderBottom: `10px solid ${props.value ?? "#000000"}`
833
- } : {},
834
- [qwik._IMMUTABLE]: {
835
- class: qwik._fnSignal((p0) => ({
836
- "w-full": true,
837
- ...p0.class
838
- }), [
839
- props
840
- ], '{"w-full":true,...p0.class}'),
841
- value: qwik._fnSignal((p0) => p0.value ?? "#000000", [
842
- props
843
- ], 'p0.value??"#000000"'),
844
- onFocus$: qwik._IMMUTABLE,
845
- onBlur$: qwik._IMMUTABLE
846
- }
847
- }, 0, "0s_1"),
848
- /* @__PURE__ */ qwik._jsxC(ColorPickerRaw, {
849
- get id() {
850
- return props1.id;
851
- },
852
- get color() {
853
- return props.value ?? "#000000";
854
- },
855
- colors: [
856
- "#FAEDCB",
857
- "#C9E4DE",
858
- "#C6DEF1",
859
- "#DBCDF0",
860
- "#F2C6DE",
861
- "#FCD05C",
862
- "#5FE2C5",
863
- "#4498DB",
864
- "#9863E7",
865
- "#E43A96",
866
- "#000000",
867
- "#555555",
868
- "#AAAAAA",
869
- "#FFFFFF",
870
- ...props.presetColors ?? []
871
- ],
872
- get class() {
873
- return {
874
- "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
875
- "opacity-0 scale-95 pointer-events-none": !store.opened
876
- };
877
- },
878
- onInput$: /* @__PURE__ */ qwik.inlinedQrl((color) => {
879
- const [props12, props2] = qwik.useLexicalScope();
880
- const el = document.getElementById(props12.id);
881
- el.value = color;
882
- switch (props2.preview ?? "left") {
883
- case "full":
884
- el.style.backgroundColor = color;
885
- el.style.color = getBrightness(hexNumberToRgb(hexStringToNumber(color))) > 0.5 ? "black" : "white";
886
- break;
887
- case "left":
888
- el.style.borderLeft = `35px solid ${color}`;
889
- break;
890
- case "right":
891
- el.style.borderRight = `35px solid ${color}`;
892
- break;
893
- case "top":
894
- el.style.borderTop = `10px solid ${color}`;
895
- break;
896
- case "bottom":
897
- el.style.borderBottom = `10px solid ${color}`;
898
- break;
899
- }
900
- props2.onInput$?.(color);
901
- }, "ColorInput_component_div_ColorPickerRaw_onInput_wTO4B2czR7s", [
902
- props1,
903
- props
904
- ]),
905
- [qwik._IMMUTABLE]: {
906
- id: qwik._wrapProp(props1, "id"),
907
- color: qwik._fnSignal((p0) => p0.value ?? "#000000", [
908
- props
909
- ], 'p0.value??"#000000"'),
910
- class: qwik._fnSignal((p0) => ({
911
- "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
912
- "opacity-0 scale-95 pointer-events-none": !p0.opened
913
- }), [
914
- store
915
- ], '{"motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]":true,"opacity-0 scale-95 pointer-events-none":!p0.opened}')
916
- }
917
- }, 3, "0s_2")
918
- ], 1, "0s_3");
919
- }, "ColorInput_component_jilGo0Bn3Ps"));
920
- const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
770
+ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
771
+ qwik._jsxBranch();
921
772
  const props1 = qwik._restProps(props, [
922
773
  "id",
923
- "color",
774
+ "value",
924
775
  "colors",
925
- "onInput$"
776
+ "color",
777
+ "onInput$",
778
+ "preview",
779
+ "horizontal",
780
+ "showInput"
926
781
  ]);
927
782
  const width = 125;
928
783
  const maxHue = 148;
929
- const hsvColor = rgbToHsv(hexNumberToRgb(hexStringToNumber(props.color)));
784
+ const hsvColor = rgbToHsv(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000")));
930
785
  const store = qwik.useStore({
931
786
  hue: {
932
787
  position: hsvColor.h * maxHue,
@@ -938,12 +793,12 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
938
793
  },
939
794
  bPosition: (1 - hsvColor.v) * maxHue,
940
795
  sPosition: hsvColor.s * width,
941
- color: props.color
796
+ value: props.value ?? "#000000"
942
797
  });
943
798
  const setColor = /* @__PURE__ */ qwik.inlinedQrl((color) => {
944
799
  const [maxHue2, props2, store2, width2] = qwik.useLexicalScope();
945
- store2.color = color;
946
800
  const hsv = rgbToHsv(hexNumberToRgb(hexStringToNumber(color)));
801
+ store2.value = rgbToHex(hsvToRgb(hsv));
947
802
  store2.hue.position = hsv.h * maxHue2;
948
803
  store2.hue.color = rgbToHex(hsvToRgb({
949
804
  h: hsv.h,
@@ -952,8 +807,8 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
952
807
  }));
953
808
  store2.sPosition = hsv.s * width2;
954
809
  store2.bPosition = (1 - hsv.v) * maxHue2;
955
- props2.onInput$?.(color);
956
- }, "ColorPickerRaw_component_setColor_KSE5T0GnULs", [
810
+ props2.onInput$?.(store2.value);
811
+ }, "ColorPicker_component_setColor_QqVIlZ9HOqM", [
957
812
  maxHue,
958
813
  props,
959
814
  store,
@@ -963,7 +818,7 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
963
818
  const [maxHue2, props2, store2] = qwik.useLexicalScope();
964
819
  const { y } = getMousePosition(e);
965
820
  store2.hue.position = clamp(maxHue2 - (y - hOffset), 0, maxHue2);
966
- const hsvColor2 = rgbToHsv(hexNumberToRgb(hexStringToNumber(store2.color)));
821
+ const hsvColor2 = rgbToHsv(hexNumberToRgb(hexStringToNumber(store2.value)));
967
822
  const h = store2.hue.position / maxHue2;
968
823
  hsvColor2.h = h;
969
824
  store2.hue.color = rgbToHex(hsvToRgb({
@@ -971,9 +826,9 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
971
826
  s: 1,
972
827
  v: 1
973
828
  }));
974
- store2.color = rgbToHex(hsvToRgb(hsvColor2));
975
- props2.onInput$?.(store2.color);
976
- }, "ColorPickerRaw_component_hueChange_za4ruRb84uA", [
829
+ store2.value = rgbToHex(hsvToRgb(hsvColor2));
830
+ props2.onInput$?.(store2.value);
831
+ }, "ColorPicker_component_hueChange_mB1ILUl3lVg", [
977
832
  maxHue,
978
833
  props,
979
834
  store
@@ -993,7 +848,7 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
993
848
  };
994
849
  window.addEventListener("mouseup", mouseUpListener);
995
850
  window.addEventListener("touchend", mouseUpListener);
996
- }, "ColorPickerRaw_component_hueMouseDown_IbHBnI0jzpg", [
851
+ }, "ColorPicker_component_hueMouseDown_469EJwWnUmc", [
997
852
  hueChange
998
853
  ]);
999
854
  const sbChange = /* @__PURE__ */ qwik.inlinedQrl((e, hOffset) => {
@@ -1003,13 +858,13 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
1003
858
  store2.sPosition = clamp(x - hOffset.left, 0, width2);
1004
859
  const s = store2.sPosition / width2;
1005
860
  const v = 1 - store2.bPosition / maxHue2;
1006
- store2.color = rgbToHex(hsvToRgb({
861
+ store2.value = rgbToHex(hsvToRgb({
1007
862
  h: store2.hue.position / maxHue2,
1008
863
  s,
1009
864
  v
1010
865
  }));
1011
- props2.onInput$?.(store2.color);
1012
- }, "ColorPickerRaw_component_sbChange_yhwlg2HYP8Y", [
866
+ props2.onInput$?.(store2.value);
867
+ }, "ColorPicker_component_sbChange_PWXSO5Wzkt4", [
1013
868
  maxHue,
1014
869
  props,
1015
870
  store,
@@ -1030,7 +885,7 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
1030
885
  };
1031
886
  window.addEventListener("mouseup", mouseUpListener);
1032
887
  window.addEventListener("touchend", mouseUpListener);
1033
- }, "ColorPickerRaw_component_sbMouseDown_hRgkP7lymfY", [
888
+ }, "ColorPicker_component_sbMouseDown_lP7vsjR4o9U", [
1034
889
  sbChange
1035
890
  ]);
1036
891
  qwik.useOn("change", /* @__PURE__ */ qwik.inlinedQrl(() => {
@@ -1041,18 +896,18 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
1041
896
  if (!inputElement)
1042
897
  return;
1043
898
  setColor2(inputElement.value);
1044
- }, "ColorPickerRaw_component_useOn_hsh00WCnzOE", [
899
+ }, "ColorPicker_component_useOn_U80lAP6qXKg", [
1045
900
  props,
1046
901
  setColor
1047
902
  ]));
1048
903
  return /* @__PURE__ */ qwik._jsxQ("div", {
1049
904
  class: {
1050
- "motion-safe:transition-all p-4 bg-gray-800/50 backdrop-blur-xl flex flex-col gap-6 rounded-lg border border-gray-700 touch-none": true,
905
+ "motion-safe:transition-all p-4 bg-gray-800/50 backdrop-blur-xl flex gap-6 rounded-lg border border-gray-700 touch-none": true,
906
+ "flex": true,
907
+ "flex-col": !props.horizontal,
1051
908
  ...props1.class
1052
909
  }
1053
910
  }, {
1054
- "preventdefault:mousedown": true,
1055
- "preventdefault:touchstart": true,
1056
911
  id: qwik._fnSignal((p0) => p0.id ? `${p0.id}-picker` : void 0, [
1057
912
  props
1058
913
  ], "p0.id?`${p0.id}-picker`:undefined")
@@ -1073,18 +928,23 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
1073
928
  onTouchStart$: sbMouseDown
1074
929
  }, [
1075
930
  /* @__PURE__ */ qwik._jsxQ("div", null, {
1076
- class: "w-[123px] h-[148px] rounded-[0.3rem] bg-gradient-to-b from-transparent to-black"
931
+ class: "w-[123px] h-[149px] rounded-[0.3rem] bg-gradient-to-b from-transparent to-black"
1077
932
  }, null, 3, null),
1078
- /* @__PURE__ */ qwik._jsxQ("div", null, {
1079
- class: "absolute -top-2 -left-2 w-4 h-4 border border-white rounded-full bg-white",
933
+ /* @__PURE__ */ qwik._jsxQ("div", {
934
+ class: {
935
+ "absolute -top-2 -left-2 w-4 h-4 border rounded-full bg-white": true,
936
+ "border-white": getBrightness(hexNumberToRgb(hexStringToNumber(store.value))) < 0.5,
937
+ "border-black": getBrightness(hexNumberToRgb(hexStringToNumber(store.value))) > 0.5
938
+ }
939
+ }, {
1080
940
  style: qwik._fnSignal((p0) => ({
1081
- background: p0.color,
941
+ background: p0.value,
1082
942
  transform: `translate(${p0.sPosition}px, ${p0.bPosition}px)`
1083
943
  }), [
1084
944
  store
1085
- ], "{background:p0.color,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
945
+ ], "{background:p0.value,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
1086
946
  }, null, 3, null)
1087
- ], 3, null),
947
+ ], 1, null),
1088
948
  /* @__PURE__ */ qwik._jsxQ("div", null, {
1089
949
  class: "h-[150px] relative w-2 border border-gray-700 rounded-md",
1090
950
  style: {
@@ -1103,49 +963,90 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
1103
963
  store
1104
964
  ], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
1105
965
  }, null, 3, null), 3, null)
1106
- ], 3, null),
966
+ ], 1, null),
1107
967
  /* @__PURE__ */ qwik._jsxQ("div", null, {
1108
- class: "w-[150px] flex flex-wrap gap-1 justify-evenly"
968
+ class: "w-[150px] flex flex-wrap gap-1 justify-between"
1109
969
  }, [
1110
- props.colors.map((color, i) => {
970
+ (props.showInput ?? true) && /* @__PURE__ */ qwik._jsxC(TextInputRaw, {
971
+ class: {
972
+ "w-[150px] mb-4": true
973
+ },
974
+ get value() {
975
+ return store.value;
976
+ },
977
+ style: (props.preview ?? "left") == "full" ? {
978
+ backgroundColor: `${store.value}`,
979
+ color: getBrightness(hexNumberToRgb(hexStringToNumber(store.value))) > 0.5 ? "black" : "white"
980
+ } : (props.preview ?? "left") == "left" ? {
981
+ borderLeft: `35px solid ${store.value}`
982
+ } : (props.preview ?? "left") == "right" ? {
983
+ borderRight: `35px solid ${store.value}`
984
+ } : (props.preview ?? "left") == "top" ? {
985
+ borderTop: `10px solid ${store.value}`
986
+ } : (props.preview ?? "left") == "bottom" ? {
987
+ borderBottom: `10px solid ${store.value}`
988
+ } : {},
989
+ get color() {
990
+ return props.color ?? "gray";
991
+ },
992
+ onInput$: /* @__PURE__ */ qwik.inlinedQrl((e, el) => {
993
+ const [setColor2] = qwik.useLexicalScope();
994
+ setColor2(el.value);
995
+ }, "ColorPicker_component_div_div_TextInputRaw_onInput_nhKRhFMCxTk", [
996
+ setColor
997
+ ]),
998
+ [qwik._IMMUTABLE]: {
999
+ class: qwik._IMMUTABLE,
1000
+ value: qwik._fnSignal((p0) => p0.value, [
1001
+ store
1002
+ ], "p0.value"),
1003
+ color: qwik._fnSignal((p0) => p0.color ?? "gray", [
1004
+ props
1005
+ ], 'p0.color??"gray"'),
1006
+ onInput$: qwik._IMMUTABLE
1007
+ }
1008
+ }, 3, "sj_0"),
1009
+ (props.colors ?? [
1010
+ "#FAEDCB",
1011
+ "#C9E4DE",
1012
+ "#C6DEF1",
1013
+ "#DBCDF0",
1014
+ "#F2C6DE",
1015
+ "#FCD05C",
1016
+ "#5FE2C5",
1017
+ "#4498DB",
1018
+ "#9863E7",
1019
+ "#E43A96",
1020
+ "#000000",
1021
+ "#555555",
1022
+ "#AAAAAA",
1023
+ "#FFFFFF"
1024
+ ]).map((color, i) => {
1111
1025
  return /* @__PURE__ */ qwik._jsxQ("button", {
1112
- style: `background: ${color}`,
1113
- onMouseDown$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1114
- const [color2, setColor2] = qwik.useLexicalScope();
1115
- setColor2(color2);
1116
- }, "ColorPickerRaw_component_div_div_button_onMouseDown_C5tqQYvx7wA", [
1117
- color,
1118
- setColor
1119
- ]),
1120
- onTouchStart$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1026
+ style: {
1027
+ background: color,
1028
+ outline: color === store.value ? "2px solid #ffffffaa" : void 0
1029
+ },
1030
+ onClick$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1121
1031
  const [color2, setColor2] = qwik.useLexicalScope();
1122
1032
  setColor2(color2);
1123
- }, "ColorPickerRaw_component_div_div_button_onTouchStart_qgiiO8Blb88", [
1033
+ }, "ColorPicker_component_div_div_button_onClick_Ta02Z5rle88", [
1124
1034
  color,
1125
1035
  setColor
1126
1036
  ])
1127
1037
  }, {
1128
- class: "w-[1.6rem] h-[1.6rem] border border-gray-700 rounded-md hover:scale-110 motion-safe:transition-all",
1129
- "preventdefault:mousedown": true,
1130
- "preventdefault:touchstart": true
1038
+ class: {
1039
+ "w-[1.6rem] h-[1.6rem] rounded-md hover:scale-110 motion-safe:transition-all -outline-offset-1 outline outline-1 outline-white/30": true
1040
+ }
1131
1041
  }, null, 2, i);
1132
1042
  }),
1133
1043
  /* @__PURE__ */ qwik._jsxQ("button", null, {
1134
1044
  class: "w-[1.6rem] h-[1.6rem] border border-gray-700 rounded-md hover:scale-110 motion-safe:transition-all",
1135
- "preventdefault:mousedown": true,
1136
- "preventdefault:touchstart": true,
1137
- onMouseDown$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1138
- const [setColor2] = qwik.useLexicalScope();
1139
- const color = `#${Math.floor(Math.random() * 16777215).toString(16)}`;
1140
- setColor2(color);
1141
- }, "ColorPickerRaw_component_div_div_button_onMouseDown_1_30vaDl3iDKc", [
1142
- setColor
1143
- ]),
1144
- onTouchStart$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1045
+ onClick$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1145
1046
  const [setColor2] = qwik.useLexicalScope();
1146
1047
  const color = `#${Math.floor(Math.random() * 16777215).toString(16)}`;
1147
1048
  setColor2(color);
1148
- }, "ColorPickerRaw_component_div_div_button_onTouchStart_1_w30s4j6SxyE", [
1049
+ }, "ColorPicker_component_div_div_button_onClick_1_f6gYSNc77Ik", [
1149
1050
  setColor
1150
1051
  ])
1151
1052
  }, /* @__PURE__ */ qwik._jsxC(Shuffle, {
@@ -1153,10 +1054,175 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
1153
1054
  [qwik._IMMUTABLE]: {
1154
1055
  class: qwik._IMMUTABLE
1155
1056
  }
1156
- }, 3, "0s_4"), 1, null)
1057
+ }, 3, "sj_1"), 1, null)
1157
1058
  ], 1, null)
1158
- ], 1, "0s_5");
1159
- }, "ColorPickerRaw_component_CWQPPcezhyA"));
1059
+ ], 1, "sj_2");
1060
+ }, "ColorPicker_component_D1OSB6ycLrI"));
1061
+ const ColorInput = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
1062
+ const props1 = qwik._restProps(props, [
1063
+ "onInput$",
1064
+ "value",
1065
+ "colors",
1066
+ "preview",
1067
+ "horizontal",
1068
+ "class",
1069
+ "showInput"
1070
+ ]);
1071
+ const store = qwik.useStore({
1072
+ opened: false
1073
+ });
1074
+ return /* @__PURE__ */ qwik._jsxQ("div", null, {
1075
+ class: "relative"
1076
+ }, [
1077
+ /* @__PURE__ */ qwik._jsxQ("label", {
1078
+ for: qwik._wrapSignal(props1, "id")
1079
+ }, {
1080
+ class: "text-gray-300 pb-1 flex select-none"
1081
+ }, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "0s_0"), 1, null),
1082
+ /* @__PURE__ */ qwik._jsxC(TextInputRaw, {
1083
+ get class() {
1084
+ return {
1085
+ "w-full": true,
1086
+ ...props.class
1087
+ };
1088
+ },
1089
+ ...props1,
1090
+ get value() {
1091
+ return props.value ?? "#000000";
1092
+ },
1093
+ onFocus$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1094
+ const [props12, store2] = qwik.useLexicalScope();
1095
+ const abortController = new AbortController();
1096
+ document.addEventListener("click", (e) => {
1097
+ if (e.target instanceof HTMLElement && !e.target.closest(`#${props12.id}-picker`) && !e.target.closest(`#${props12.id}`)) {
1098
+ store2.opened = false;
1099
+ abortController.abort();
1100
+ }
1101
+ }, {
1102
+ signal: abortController.signal
1103
+ });
1104
+ store2.opened = true;
1105
+ }, "ColorInput_component_div_TextInputRaw_onFocus_9bHrhSeTgfI", [
1106
+ props1,
1107
+ store
1108
+ ]),
1109
+ onInput$: /* @__PURE__ */ qwik.inlinedQrl((e, el) => {
1110
+ const [props12, props2] = qwik.useLexicalScope();
1111
+ const div = document.getElementById(`${props12.id}-picker`);
1112
+ const event = new Event("change");
1113
+ div.dispatchEvent(event);
1114
+ props2.onInput$?.(el.value);
1115
+ }, "ColorInput_component_div_TextInputRaw_onInput_nsV3cUv0Sxg", [
1116
+ props1,
1117
+ props
1118
+ ]),
1119
+ style: (props.preview ?? "left") == "full" ? {
1120
+ backgroundColor: `${props.value ?? "#000000"}`,
1121
+ color: getBrightness(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000"))) > 0.5 ? "black" : "white"
1122
+ } : (props.preview ?? "left") == "left" ? {
1123
+ borderLeft: `35px solid ${props.value ?? "#000000"}`
1124
+ } : (props.preview ?? "left") == "right" ? {
1125
+ borderRight: `35px solid ${props.value ?? "#000000"}`
1126
+ } : (props.preview ?? "left") == "top" ? {
1127
+ borderTop: `10px solid ${props.value ?? "#000000"}`
1128
+ } : (props.preview ?? "left") == "bottom" ? {
1129
+ borderBottom: `10px solid ${props.value ?? "#000000"}`
1130
+ } : {},
1131
+ [qwik._IMMUTABLE]: {
1132
+ class: qwik._fnSignal((p0) => ({
1133
+ "w-full": true,
1134
+ ...p0.class
1135
+ }), [
1136
+ props
1137
+ ], '{"w-full":true,...p0.class}'),
1138
+ value: qwik._fnSignal((p0) => p0.value ?? "#000000", [
1139
+ props
1140
+ ], 'p0.value??"#000000"')
1141
+ }
1142
+ }, 0, "0s_1"),
1143
+ /* @__PURE__ */ qwik._jsxC(ColorPicker, {
1144
+ get id() {
1145
+ return props1.id;
1146
+ },
1147
+ get value() {
1148
+ return props.value ?? "#000000";
1149
+ },
1150
+ get color() {
1151
+ return props1.color;
1152
+ },
1153
+ get colors() {
1154
+ return props.colors;
1155
+ },
1156
+ get preview() {
1157
+ return props.preview ?? "left";
1158
+ },
1159
+ get horizontal() {
1160
+ return props.horizontal;
1161
+ },
1162
+ get showInput() {
1163
+ return props.showInput ?? false;
1164
+ },
1165
+ get class() {
1166
+ return {
1167
+ "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
1168
+ "opacity-0 scale-95 pointer-events-none": !store.opened
1169
+ };
1170
+ },
1171
+ onInput$: /* @__PURE__ */ qwik.inlinedQrl((color) => {
1172
+ const [props12, props2] = qwik.useLexicalScope();
1173
+ const el = document.getElementById(props12.id);
1174
+ el.value = color;
1175
+ switch (props2.preview ?? "left") {
1176
+ case "full":
1177
+ el.style.backgroundColor = color;
1178
+ el.style.color = getBrightness(hexNumberToRgb(hexStringToNumber(color))) > 0.5 ? "black" : "white";
1179
+ break;
1180
+ case "left":
1181
+ el.style.borderLeft = `35px solid ${color}`;
1182
+ break;
1183
+ case "right":
1184
+ el.style.borderRight = `35px solid ${color}`;
1185
+ break;
1186
+ case "top":
1187
+ el.style.borderTop = `10px solid ${color}`;
1188
+ break;
1189
+ case "bottom":
1190
+ el.style.borderBottom = `10px solid ${color}`;
1191
+ break;
1192
+ }
1193
+ props2.onInput$?.(color);
1194
+ }, "ColorInput_component_div_ColorPicker_onInput_iZguRdHILBQ", [
1195
+ props1,
1196
+ props
1197
+ ]),
1198
+ [qwik._IMMUTABLE]: {
1199
+ id: qwik._wrapProp(props1, "id"),
1200
+ value: qwik._fnSignal((p0) => p0.value ?? "#000000", [
1201
+ props
1202
+ ], 'p0.value??"#000000"'),
1203
+ color: qwik._wrapProp(props1, "color"),
1204
+ colors: qwik._fnSignal((p0) => p0.colors, [
1205
+ props
1206
+ ], "p0.colors"),
1207
+ preview: qwik._fnSignal((p0) => p0.preview ?? "left", [
1208
+ props
1209
+ ], 'p0.preview??"left"'),
1210
+ horizontal: qwik._fnSignal((p0) => p0.horizontal, [
1211
+ props
1212
+ ], "p0.horizontal"),
1213
+ showInput: qwik._fnSignal((p0) => p0.showInput ?? false, [
1214
+ props
1215
+ ], "p0.showInput??false"),
1216
+ class: qwik._fnSignal((p0) => ({
1217
+ "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
1218
+ "opacity-0 scale-95 pointer-events-none": !p0.opened
1219
+ }), [
1220
+ store
1221
+ ], '{"motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]":true,"opacity-0 scale-95 pointer-events-none":!p0.opened}')
1222
+ }
1223
+ }, 3, "0s_2")
1224
+ ], 1, "0s_3");
1225
+ }, "ColorInput_component_jilGo0Bn3Ps"));
1160
1226
  const ChevronDown = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
1161
1227
  return /* @__PURE__ */ qwik._jsxS("svg", {
1162
1228
  xmlns: "http://www.w3.org/2000/svg",
@@ -2718,7 +2784,7 @@ exports.Button = Button;
2718
2784
  exports.ButtonAnchor = ButtonAnchor;
2719
2785
  exports.Card = Card;
2720
2786
  exports.ColorInput = ColorInput;
2721
- exports.ColorPickerRaw = ColorPickerRaw;
2787
+ exports.ColorPicker = ColorPicker;
2722
2788
  exports.Dropdown = Dropdown;
2723
2789
  exports.DropdownRaw = DropdownRaw;
2724
2790
  exports.Header = Header;
@@ -1,4 +1,4 @@
1
- import { componentQrl, inlinedQrl, _jsxQ, _fnSignal, _restProps, _jsxS, _jsxC, Slot, _jsxBranch, _IMMUTABLE, _wrapSignal, useStore, useLexicalScope, _wrapProp, useOn, useStylesQrl, useSignal } from "@builder.io/qwik";
1
+ import { componentQrl, inlinedQrl, _jsxQ, _fnSignal, _restProps, _jsxS, _jsxC, Slot, _jsxBranch, _IMMUTABLE, _wrapSignal, useStore, useOn, useLexicalScope, _wrapProp, useStylesQrl, useSignal } from "@builder.io/qwik";
2
2
  import { Fragment } from "@builder.io/qwik/jsx-runtime";
3
3
  const Anchor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => /* @__PURE__ */ _jsxQ("span", null, {
4
4
  id: _fnSignal((p0) => p0.id, [
@@ -765,166 +765,21 @@ const Shuffle = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
765
765
  ], "p0.width")
766
766
  }, 0, "zt_0");
767
767
  }, "Shuffle_component_DnmmsuyAgDE"));
768
- const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
769
- const props1 = _restProps(props, [
770
- "onInput$",
771
- "value",
772
- "presetColors",
773
- "preview",
774
- "class"
775
- ]);
776
- const store = useStore({
777
- opened: false
778
- });
779
- return /* @__PURE__ */ _jsxQ("div", null, {
780
- class: "relative"
781
- }, [
782
- /* @__PURE__ */ _jsxQ("label", {
783
- for: _wrapSignal(props1, "id")
784
- }, {
785
- class: "text-gray-300 pb-1 flex select-none"
786
- }, /* @__PURE__ */ _jsxC(Slot, null, 3, "0s_0"), 1, null),
787
- /* @__PURE__ */ _jsxC(TextInputRaw, {
788
- get class() {
789
- return {
790
- "w-full": true,
791
- ...props.class
792
- };
793
- },
794
- ...props1,
795
- get value() {
796
- return props.value ?? "#000000";
797
- },
798
- onFocus$: /* @__PURE__ */ inlinedQrl(() => {
799
- const [store2] = useLexicalScope();
800
- store2.opened = true;
801
- }, "ColorInput_component_div_TextInputRaw_onFocus_9bHrhSeTgfI", [
802
- store
803
- ]),
804
- onBlur$: /* @__PURE__ */ inlinedQrl(() => {
805
- const [store2] = useLexicalScope();
806
- store2.opened = false;
807
- }, "ColorInput_component_div_TextInputRaw_onBlur_giB7aSy8tnc", [
808
- store
809
- ]),
810
- onInput$: /* @__PURE__ */ inlinedQrl((e, el) => {
811
- const [props12, props2] = useLexicalScope();
812
- const div = document.getElementById(`${props12.id}-picker`);
813
- const event = new Event("change");
814
- div.dispatchEvent(event);
815
- props2.onInput$?.(el.value);
816
- }, "ColorInput_component_div_TextInputRaw_onInput_nsV3cUv0Sxg", [
817
- props1,
818
- props
819
- ]),
820
- style: (props.preview ?? "left") == "full" ? {
821
- backgroundColor: `${props.value ?? "#000000"}`,
822
- color: getBrightness(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000"))) > 0.5 ? "black" : "white"
823
- } : (props.preview ?? "left") == "left" ? {
824
- borderLeft: `35px solid ${props.value ?? "#000000"}`
825
- } : (props.preview ?? "left") == "right" ? {
826
- borderRight: `35px solid ${props.value ?? "#000000"}`
827
- } : (props.preview ?? "left") == "top" ? {
828
- borderTop: `10px solid ${props.value ?? "#000000"}`
829
- } : (props.preview ?? "left") == "bottom" ? {
830
- borderBottom: `10px solid ${props.value ?? "#000000"}`
831
- } : {},
832
- [_IMMUTABLE]: {
833
- class: _fnSignal((p0) => ({
834
- "w-full": true,
835
- ...p0.class
836
- }), [
837
- props
838
- ], '{"w-full":true,...p0.class}'),
839
- value: _fnSignal((p0) => p0.value ?? "#000000", [
840
- props
841
- ], 'p0.value??"#000000"'),
842
- onFocus$: _IMMUTABLE,
843
- onBlur$: _IMMUTABLE
844
- }
845
- }, 0, "0s_1"),
846
- /* @__PURE__ */ _jsxC(ColorPickerRaw, {
847
- get id() {
848
- return props1.id;
849
- },
850
- get color() {
851
- return props.value ?? "#000000";
852
- },
853
- colors: [
854
- "#FAEDCB",
855
- "#C9E4DE",
856
- "#C6DEF1",
857
- "#DBCDF0",
858
- "#F2C6DE",
859
- "#FCD05C",
860
- "#5FE2C5",
861
- "#4498DB",
862
- "#9863E7",
863
- "#E43A96",
864
- "#000000",
865
- "#555555",
866
- "#AAAAAA",
867
- "#FFFFFF",
868
- ...props.presetColors ?? []
869
- ],
870
- get class() {
871
- return {
872
- "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
873
- "opacity-0 scale-95 pointer-events-none": !store.opened
874
- };
875
- },
876
- onInput$: /* @__PURE__ */ inlinedQrl((color) => {
877
- const [props12, props2] = useLexicalScope();
878
- const el = document.getElementById(props12.id);
879
- el.value = color;
880
- switch (props2.preview ?? "left") {
881
- case "full":
882
- el.style.backgroundColor = color;
883
- el.style.color = getBrightness(hexNumberToRgb(hexStringToNumber(color))) > 0.5 ? "black" : "white";
884
- break;
885
- case "left":
886
- el.style.borderLeft = `35px solid ${color}`;
887
- break;
888
- case "right":
889
- el.style.borderRight = `35px solid ${color}`;
890
- break;
891
- case "top":
892
- el.style.borderTop = `10px solid ${color}`;
893
- break;
894
- case "bottom":
895
- el.style.borderBottom = `10px solid ${color}`;
896
- break;
897
- }
898
- props2.onInput$?.(color);
899
- }, "ColorInput_component_div_ColorPickerRaw_onInput_wTO4B2czR7s", [
900
- props1,
901
- props
902
- ]),
903
- [_IMMUTABLE]: {
904
- id: _wrapProp(props1, "id"),
905
- color: _fnSignal((p0) => p0.value ?? "#000000", [
906
- props
907
- ], 'p0.value??"#000000"'),
908
- class: _fnSignal((p0) => ({
909
- "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
910
- "opacity-0 scale-95 pointer-events-none": !p0.opened
911
- }), [
912
- store
913
- ], '{"motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]":true,"opacity-0 scale-95 pointer-events-none":!p0.opened}')
914
- }
915
- }, 3, "0s_2")
916
- ], 1, "0s_3");
917
- }, "ColorInput_component_jilGo0Bn3Ps"));
918
- const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
768
+ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
769
+ _jsxBranch();
919
770
  const props1 = _restProps(props, [
920
771
  "id",
921
- "color",
772
+ "value",
922
773
  "colors",
923
- "onInput$"
774
+ "color",
775
+ "onInput$",
776
+ "preview",
777
+ "horizontal",
778
+ "showInput"
924
779
  ]);
925
780
  const width = 125;
926
781
  const maxHue = 148;
927
- const hsvColor = rgbToHsv(hexNumberToRgb(hexStringToNumber(props.color)));
782
+ const hsvColor = rgbToHsv(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000")));
928
783
  const store = useStore({
929
784
  hue: {
930
785
  position: hsvColor.h * maxHue,
@@ -936,12 +791,12 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
936
791
  },
937
792
  bPosition: (1 - hsvColor.v) * maxHue,
938
793
  sPosition: hsvColor.s * width,
939
- color: props.color
794
+ value: props.value ?? "#000000"
940
795
  });
941
796
  const setColor = /* @__PURE__ */ inlinedQrl((color) => {
942
797
  const [maxHue2, props2, store2, width2] = useLexicalScope();
943
- store2.color = color;
944
798
  const hsv = rgbToHsv(hexNumberToRgb(hexStringToNumber(color)));
799
+ store2.value = rgbToHex(hsvToRgb(hsv));
945
800
  store2.hue.position = hsv.h * maxHue2;
946
801
  store2.hue.color = rgbToHex(hsvToRgb({
947
802
  h: hsv.h,
@@ -950,8 +805,8 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
950
805
  }));
951
806
  store2.sPosition = hsv.s * width2;
952
807
  store2.bPosition = (1 - hsv.v) * maxHue2;
953
- props2.onInput$?.(color);
954
- }, "ColorPickerRaw_component_setColor_KSE5T0GnULs", [
808
+ props2.onInput$?.(store2.value);
809
+ }, "ColorPicker_component_setColor_QqVIlZ9HOqM", [
955
810
  maxHue,
956
811
  props,
957
812
  store,
@@ -961,7 +816,7 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
961
816
  const [maxHue2, props2, store2] = useLexicalScope();
962
817
  const { y } = getMousePosition(e);
963
818
  store2.hue.position = clamp(maxHue2 - (y - hOffset), 0, maxHue2);
964
- const hsvColor2 = rgbToHsv(hexNumberToRgb(hexStringToNumber(store2.color)));
819
+ const hsvColor2 = rgbToHsv(hexNumberToRgb(hexStringToNumber(store2.value)));
965
820
  const h = store2.hue.position / maxHue2;
966
821
  hsvColor2.h = h;
967
822
  store2.hue.color = rgbToHex(hsvToRgb({
@@ -969,9 +824,9 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
969
824
  s: 1,
970
825
  v: 1
971
826
  }));
972
- store2.color = rgbToHex(hsvToRgb(hsvColor2));
973
- props2.onInput$?.(store2.color);
974
- }, "ColorPickerRaw_component_hueChange_za4ruRb84uA", [
827
+ store2.value = rgbToHex(hsvToRgb(hsvColor2));
828
+ props2.onInput$?.(store2.value);
829
+ }, "ColorPicker_component_hueChange_mB1ILUl3lVg", [
975
830
  maxHue,
976
831
  props,
977
832
  store
@@ -991,7 +846,7 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
991
846
  };
992
847
  window.addEventListener("mouseup", mouseUpListener);
993
848
  window.addEventListener("touchend", mouseUpListener);
994
- }, "ColorPickerRaw_component_hueMouseDown_IbHBnI0jzpg", [
849
+ }, "ColorPicker_component_hueMouseDown_469EJwWnUmc", [
995
850
  hueChange
996
851
  ]);
997
852
  const sbChange = /* @__PURE__ */ inlinedQrl((e, hOffset) => {
@@ -1001,13 +856,13 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
1001
856
  store2.sPosition = clamp(x - hOffset.left, 0, width2);
1002
857
  const s = store2.sPosition / width2;
1003
858
  const v = 1 - store2.bPosition / maxHue2;
1004
- store2.color = rgbToHex(hsvToRgb({
859
+ store2.value = rgbToHex(hsvToRgb({
1005
860
  h: store2.hue.position / maxHue2,
1006
861
  s,
1007
862
  v
1008
863
  }));
1009
- props2.onInput$?.(store2.color);
1010
- }, "ColorPickerRaw_component_sbChange_yhwlg2HYP8Y", [
864
+ props2.onInput$?.(store2.value);
865
+ }, "ColorPicker_component_sbChange_PWXSO5Wzkt4", [
1011
866
  maxHue,
1012
867
  props,
1013
868
  store,
@@ -1028,7 +883,7 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
1028
883
  };
1029
884
  window.addEventListener("mouseup", mouseUpListener);
1030
885
  window.addEventListener("touchend", mouseUpListener);
1031
- }, "ColorPickerRaw_component_sbMouseDown_hRgkP7lymfY", [
886
+ }, "ColorPicker_component_sbMouseDown_lP7vsjR4o9U", [
1032
887
  sbChange
1033
888
  ]);
1034
889
  useOn("change", /* @__PURE__ */ inlinedQrl(() => {
@@ -1039,18 +894,18 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
1039
894
  if (!inputElement)
1040
895
  return;
1041
896
  setColor2(inputElement.value);
1042
- }, "ColorPickerRaw_component_useOn_hsh00WCnzOE", [
897
+ }, "ColorPicker_component_useOn_U80lAP6qXKg", [
1043
898
  props,
1044
899
  setColor
1045
900
  ]));
1046
901
  return /* @__PURE__ */ _jsxQ("div", {
1047
902
  class: {
1048
- "motion-safe:transition-all p-4 bg-gray-800/50 backdrop-blur-xl flex flex-col gap-6 rounded-lg border border-gray-700 touch-none": true,
903
+ "motion-safe:transition-all p-4 bg-gray-800/50 backdrop-blur-xl flex gap-6 rounded-lg border border-gray-700 touch-none": true,
904
+ "flex": true,
905
+ "flex-col": !props.horizontal,
1049
906
  ...props1.class
1050
907
  }
1051
908
  }, {
1052
- "preventdefault:mousedown": true,
1053
- "preventdefault:touchstart": true,
1054
909
  id: _fnSignal((p0) => p0.id ? `${p0.id}-picker` : void 0, [
1055
910
  props
1056
911
  ], "p0.id?`${p0.id}-picker`:undefined")
@@ -1071,18 +926,23 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
1071
926
  onTouchStart$: sbMouseDown
1072
927
  }, [
1073
928
  /* @__PURE__ */ _jsxQ("div", null, {
1074
- class: "w-[123px] h-[148px] rounded-[0.3rem] bg-gradient-to-b from-transparent to-black"
929
+ class: "w-[123px] h-[149px] rounded-[0.3rem] bg-gradient-to-b from-transparent to-black"
1075
930
  }, null, 3, null),
1076
- /* @__PURE__ */ _jsxQ("div", null, {
1077
- class: "absolute -top-2 -left-2 w-4 h-4 border border-white rounded-full bg-white",
931
+ /* @__PURE__ */ _jsxQ("div", {
932
+ class: {
933
+ "absolute -top-2 -left-2 w-4 h-4 border rounded-full bg-white": true,
934
+ "border-white": getBrightness(hexNumberToRgb(hexStringToNumber(store.value))) < 0.5,
935
+ "border-black": getBrightness(hexNumberToRgb(hexStringToNumber(store.value))) > 0.5
936
+ }
937
+ }, {
1078
938
  style: _fnSignal((p0) => ({
1079
- background: p0.color,
939
+ background: p0.value,
1080
940
  transform: `translate(${p0.sPosition}px, ${p0.bPosition}px)`
1081
941
  }), [
1082
942
  store
1083
- ], "{background:p0.color,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
943
+ ], "{background:p0.value,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
1084
944
  }, null, 3, null)
1085
- ], 3, null),
945
+ ], 1, null),
1086
946
  /* @__PURE__ */ _jsxQ("div", null, {
1087
947
  class: "h-[150px] relative w-2 border border-gray-700 rounded-md",
1088
948
  style: {
@@ -1101,49 +961,90 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
1101
961
  store
1102
962
  ], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
1103
963
  }, null, 3, null), 3, null)
1104
- ], 3, null),
964
+ ], 1, null),
1105
965
  /* @__PURE__ */ _jsxQ("div", null, {
1106
- class: "w-[150px] flex flex-wrap gap-1 justify-evenly"
966
+ class: "w-[150px] flex flex-wrap gap-1 justify-between"
1107
967
  }, [
1108
- props.colors.map((color, i) => {
968
+ (props.showInput ?? true) && /* @__PURE__ */ _jsxC(TextInputRaw, {
969
+ class: {
970
+ "w-[150px] mb-4": true
971
+ },
972
+ get value() {
973
+ return store.value;
974
+ },
975
+ style: (props.preview ?? "left") == "full" ? {
976
+ backgroundColor: `${store.value}`,
977
+ color: getBrightness(hexNumberToRgb(hexStringToNumber(store.value))) > 0.5 ? "black" : "white"
978
+ } : (props.preview ?? "left") == "left" ? {
979
+ borderLeft: `35px solid ${store.value}`
980
+ } : (props.preview ?? "left") == "right" ? {
981
+ borderRight: `35px solid ${store.value}`
982
+ } : (props.preview ?? "left") == "top" ? {
983
+ borderTop: `10px solid ${store.value}`
984
+ } : (props.preview ?? "left") == "bottom" ? {
985
+ borderBottom: `10px solid ${store.value}`
986
+ } : {},
987
+ get color() {
988
+ return props.color ?? "gray";
989
+ },
990
+ onInput$: /* @__PURE__ */ inlinedQrl((e, el) => {
991
+ const [setColor2] = useLexicalScope();
992
+ setColor2(el.value);
993
+ }, "ColorPicker_component_div_div_TextInputRaw_onInput_nhKRhFMCxTk", [
994
+ setColor
995
+ ]),
996
+ [_IMMUTABLE]: {
997
+ class: _IMMUTABLE,
998
+ value: _fnSignal((p0) => p0.value, [
999
+ store
1000
+ ], "p0.value"),
1001
+ color: _fnSignal((p0) => p0.color ?? "gray", [
1002
+ props
1003
+ ], 'p0.color??"gray"'),
1004
+ onInput$: _IMMUTABLE
1005
+ }
1006
+ }, 3, "sj_0"),
1007
+ (props.colors ?? [
1008
+ "#FAEDCB",
1009
+ "#C9E4DE",
1010
+ "#C6DEF1",
1011
+ "#DBCDF0",
1012
+ "#F2C6DE",
1013
+ "#FCD05C",
1014
+ "#5FE2C5",
1015
+ "#4498DB",
1016
+ "#9863E7",
1017
+ "#E43A96",
1018
+ "#000000",
1019
+ "#555555",
1020
+ "#AAAAAA",
1021
+ "#FFFFFF"
1022
+ ]).map((color, i) => {
1109
1023
  return /* @__PURE__ */ _jsxQ("button", {
1110
- style: `background: ${color}`,
1111
- onMouseDown$: /* @__PURE__ */ inlinedQrl(() => {
1112
- const [color2, setColor2] = useLexicalScope();
1113
- setColor2(color2);
1114
- }, "ColorPickerRaw_component_div_div_button_onMouseDown_C5tqQYvx7wA", [
1115
- color,
1116
- setColor
1117
- ]),
1118
- onTouchStart$: /* @__PURE__ */ inlinedQrl(() => {
1024
+ style: {
1025
+ background: color,
1026
+ outline: color === store.value ? "2px solid #ffffffaa" : void 0
1027
+ },
1028
+ onClick$: /* @__PURE__ */ inlinedQrl(() => {
1119
1029
  const [color2, setColor2] = useLexicalScope();
1120
1030
  setColor2(color2);
1121
- }, "ColorPickerRaw_component_div_div_button_onTouchStart_qgiiO8Blb88", [
1031
+ }, "ColorPicker_component_div_div_button_onClick_Ta02Z5rle88", [
1122
1032
  color,
1123
1033
  setColor
1124
1034
  ])
1125
1035
  }, {
1126
- class: "w-[1.6rem] h-[1.6rem] border border-gray-700 rounded-md hover:scale-110 motion-safe:transition-all",
1127
- "preventdefault:mousedown": true,
1128
- "preventdefault:touchstart": true
1036
+ class: {
1037
+ "w-[1.6rem] h-[1.6rem] rounded-md hover:scale-110 motion-safe:transition-all -outline-offset-1 outline outline-1 outline-white/30": true
1038
+ }
1129
1039
  }, null, 2, i);
1130
1040
  }),
1131
1041
  /* @__PURE__ */ _jsxQ("button", null, {
1132
1042
  class: "w-[1.6rem] h-[1.6rem] border border-gray-700 rounded-md hover:scale-110 motion-safe:transition-all",
1133
- "preventdefault:mousedown": true,
1134
- "preventdefault:touchstart": true,
1135
- onMouseDown$: /* @__PURE__ */ inlinedQrl(() => {
1136
- const [setColor2] = useLexicalScope();
1137
- const color = `#${Math.floor(Math.random() * 16777215).toString(16)}`;
1138
- setColor2(color);
1139
- }, "ColorPickerRaw_component_div_div_button_onMouseDown_1_30vaDl3iDKc", [
1140
- setColor
1141
- ]),
1142
- onTouchStart$: /* @__PURE__ */ inlinedQrl(() => {
1043
+ onClick$: /* @__PURE__ */ inlinedQrl(() => {
1143
1044
  const [setColor2] = useLexicalScope();
1144
1045
  const color = `#${Math.floor(Math.random() * 16777215).toString(16)}`;
1145
1046
  setColor2(color);
1146
- }, "ColorPickerRaw_component_div_div_button_onTouchStart_1_w30s4j6SxyE", [
1047
+ }, "ColorPicker_component_div_div_button_onClick_1_f6gYSNc77Ik", [
1147
1048
  setColor
1148
1049
  ])
1149
1050
  }, /* @__PURE__ */ _jsxC(Shuffle, {
@@ -1151,10 +1052,175 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
1151
1052
  [_IMMUTABLE]: {
1152
1053
  class: _IMMUTABLE
1153
1054
  }
1154
- }, 3, "0s_4"), 1, null)
1055
+ }, 3, "sj_1"), 1, null)
1155
1056
  ], 1, null)
1156
- ], 1, "0s_5");
1157
- }, "ColorPickerRaw_component_CWQPPcezhyA"));
1057
+ ], 1, "sj_2");
1058
+ }, "ColorPicker_component_D1OSB6ycLrI"));
1059
+ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1060
+ const props1 = _restProps(props, [
1061
+ "onInput$",
1062
+ "value",
1063
+ "colors",
1064
+ "preview",
1065
+ "horizontal",
1066
+ "class",
1067
+ "showInput"
1068
+ ]);
1069
+ const store = useStore({
1070
+ opened: false
1071
+ });
1072
+ return /* @__PURE__ */ _jsxQ("div", null, {
1073
+ class: "relative"
1074
+ }, [
1075
+ /* @__PURE__ */ _jsxQ("label", {
1076
+ for: _wrapSignal(props1, "id")
1077
+ }, {
1078
+ class: "text-gray-300 pb-1 flex select-none"
1079
+ }, /* @__PURE__ */ _jsxC(Slot, null, 3, "0s_0"), 1, null),
1080
+ /* @__PURE__ */ _jsxC(TextInputRaw, {
1081
+ get class() {
1082
+ return {
1083
+ "w-full": true,
1084
+ ...props.class
1085
+ };
1086
+ },
1087
+ ...props1,
1088
+ get value() {
1089
+ return props.value ?? "#000000";
1090
+ },
1091
+ onFocus$: /* @__PURE__ */ inlinedQrl(() => {
1092
+ const [props12, store2] = useLexicalScope();
1093
+ const abortController = new AbortController();
1094
+ document.addEventListener("click", (e) => {
1095
+ if (e.target instanceof HTMLElement && !e.target.closest(`#${props12.id}-picker`) && !e.target.closest(`#${props12.id}`)) {
1096
+ store2.opened = false;
1097
+ abortController.abort();
1098
+ }
1099
+ }, {
1100
+ signal: abortController.signal
1101
+ });
1102
+ store2.opened = true;
1103
+ }, "ColorInput_component_div_TextInputRaw_onFocus_9bHrhSeTgfI", [
1104
+ props1,
1105
+ store
1106
+ ]),
1107
+ onInput$: /* @__PURE__ */ inlinedQrl((e, el) => {
1108
+ const [props12, props2] = useLexicalScope();
1109
+ const div = document.getElementById(`${props12.id}-picker`);
1110
+ const event = new Event("change");
1111
+ div.dispatchEvent(event);
1112
+ props2.onInput$?.(el.value);
1113
+ }, "ColorInput_component_div_TextInputRaw_onInput_nsV3cUv0Sxg", [
1114
+ props1,
1115
+ props
1116
+ ]),
1117
+ style: (props.preview ?? "left") == "full" ? {
1118
+ backgroundColor: `${props.value ?? "#000000"}`,
1119
+ color: getBrightness(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000"))) > 0.5 ? "black" : "white"
1120
+ } : (props.preview ?? "left") == "left" ? {
1121
+ borderLeft: `35px solid ${props.value ?? "#000000"}`
1122
+ } : (props.preview ?? "left") == "right" ? {
1123
+ borderRight: `35px solid ${props.value ?? "#000000"}`
1124
+ } : (props.preview ?? "left") == "top" ? {
1125
+ borderTop: `10px solid ${props.value ?? "#000000"}`
1126
+ } : (props.preview ?? "left") == "bottom" ? {
1127
+ borderBottom: `10px solid ${props.value ?? "#000000"}`
1128
+ } : {},
1129
+ [_IMMUTABLE]: {
1130
+ class: _fnSignal((p0) => ({
1131
+ "w-full": true,
1132
+ ...p0.class
1133
+ }), [
1134
+ props
1135
+ ], '{"w-full":true,...p0.class}'),
1136
+ value: _fnSignal((p0) => p0.value ?? "#000000", [
1137
+ props
1138
+ ], 'p0.value??"#000000"')
1139
+ }
1140
+ }, 0, "0s_1"),
1141
+ /* @__PURE__ */ _jsxC(ColorPicker, {
1142
+ get id() {
1143
+ return props1.id;
1144
+ },
1145
+ get value() {
1146
+ return props.value ?? "#000000";
1147
+ },
1148
+ get color() {
1149
+ return props1.color;
1150
+ },
1151
+ get colors() {
1152
+ return props.colors;
1153
+ },
1154
+ get preview() {
1155
+ return props.preview ?? "left";
1156
+ },
1157
+ get horizontal() {
1158
+ return props.horizontal;
1159
+ },
1160
+ get showInput() {
1161
+ return props.showInput ?? false;
1162
+ },
1163
+ get class() {
1164
+ return {
1165
+ "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
1166
+ "opacity-0 scale-95 pointer-events-none": !store.opened
1167
+ };
1168
+ },
1169
+ onInput$: /* @__PURE__ */ inlinedQrl((color) => {
1170
+ const [props12, props2] = useLexicalScope();
1171
+ const el = document.getElementById(props12.id);
1172
+ el.value = color;
1173
+ switch (props2.preview ?? "left") {
1174
+ case "full":
1175
+ el.style.backgroundColor = color;
1176
+ el.style.color = getBrightness(hexNumberToRgb(hexStringToNumber(color))) > 0.5 ? "black" : "white";
1177
+ break;
1178
+ case "left":
1179
+ el.style.borderLeft = `35px solid ${color}`;
1180
+ break;
1181
+ case "right":
1182
+ el.style.borderRight = `35px solid ${color}`;
1183
+ break;
1184
+ case "top":
1185
+ el.style.borderTop = `10px solid ${color}`;
1186
+ break;
1187
+ case "bottom":
1188
+ el.style.borderBottom = `10px solid ${color}`;
1189
+ break;
1190
+ }
1191
+ props2.onInput$?.(color);
1192
+ }, "ColorInput_component_div_ColorPicker_onInput_iZguRdHILBQ", [
1193
+ props1,
1194
+ props
1195
+ ]),
1196
+ [_IMMUTABLE]: {
1197
+ id: _wrapProp(props1, "id"),
1198
+ value: _fnSignal((p0) => p0.value ?? "#000000", [
1199
+ props
1200
+ ], 'p0.value??"#000000"'),
1201
+ color: _wrapProp(props1, "color"),
1202
+ colors: _fnSignal((p0) => p0.colors, [
1203
+ props
1204
+ ], "p0.colors"),
1205
+ preview: _fnSignal((p0) => p0.preview ?? "left", [
1206
+ props
1207
+ ], 'p0.preview??"left"'),
1208
+ horizontal: _fnSignal((p0) => p0.horizontal, [
1209
+ props
1210
+ ], "p0.horizontal"),
1211
+ showInput: _fnSignal((p0) => p0.showInput ?? false, [
1212
+ props
1213
+ ], "p0.showInput??false"),
1214
+ class: _fnSignal((p0) => ({
1215
+ "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
1216
+ "opacity-0 scale-95 pointer-events-none": !p0.opened
1217
+ }), [
1218
+ store
1219
+ ], '{"motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]":true,"opacity-0 scale-95 pointer-events-none":!p0.opened}')
1220
+ }
1221
+ }, 3, "0s_2")
1222
+ ], 1, "0s_3");
1223
+ }, "ColorInput_component_jilGo0Bn3Ps"));
1158
1224
  const ChevronDown = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1159
1225
  return /* @__PURE__ */ _jsxS("svg", {
1160
1226
  xmlns: "http://www.w3.org/2000/svg",
@@ -2717,7 +2783,7 @@ export {
2717
2783
  ButtonAnchor,
2718
2784
  Card,
2719
2785
  ColorInput,
2720
- ColorPickerRaw,
2786
+ ColorPicker,
2721
2787
  Dropdown,
2722
2788
  DropdownRaw,
2723
2789
  Header,
@@ -1,19 +1,12 @@
1
- import type { PropsOf, QRL } from '@builder.io/qwik';
1
+ import type { QRL } from '@builder.io/qwik';
2
2
  import type { TextInputRawProps } from './TextInput';
3
3
  export interface ColorInputProps extends Omit<TextInputRawProps, 'onInput$' | 'children'> {
4
4
  onInput$?: QRL<(color: string) => void>;
5
5
  value?: string;
6
- presetColors?: string[];
6
+ colors?: string[];
7
7
  preview?: 'left' | 'right' | 'top' | 'bottom' | 'full';
8
+ horizontal?: boolean;
9
+ showInput?: boolean;
8
10
  id: string;
9
11
  }
10
12
  export declare const ColorInput: import("@builder.io/qwik").Component<ColorInputProps>;
11
- export interface ColorPickerProps extends Omit<PropsOf<'div'>, 'class' | 'onInput$'> {
12
- class: {
13
- [key: string]: boolean;
14
- };
15
- onInput$?: QRL<(color: string) => void>;
16
- color: string;
17
- colors: string[];
18
- }
19
- export declare const ColorPickerRaw: import("@builder.io/qwik").Component<ColorPickerProps>;
@@ -0,0 +1,15 @@
1
+ import type { PropsOf, QRL } from '@builder.io/qwik';
2
+ import type { TextInputRawProps } from './TextInput';
3
+ export interface ColorPickerProps extends Omit<PropsOf<'div'>, 'class' | 'onInput$'> {
4
+ class?: {
5
+ [key: string]: boolean;
6
+ };
7
+ onInput$?: QRL<(color: string) => void>;
8
+ value?: string;
9
+ colors?: string[];
10
+ color?: TextInputRawProps['color'];
11
+ preview?: 'left' | 'right' | 'top' | 'bottom' | 'full';
12
+ horizontal?: boolean;
13
+ showInput?: boolean;
14
+ }
15
+ export declare const ColorPicker: import("@builder.io/qwik").Component<ColorPickerProps>;
@@ -3,6 +3,7 @@ export * from './elements/Blobs';
3
3
  export * from './elements/Button';
4
4
  export * from './elements/Card';
5
5
  export * from './elements/ColorInput';
6
+ export * from './elements/ColorPicker';
6
7
  export * from './elements/Dropdown';
7
8
  export * from './elements/Header';
8
9
  export * from './elements/LoadingIcon';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luminescent/ui",
3
- "version": "0.16.6",
3
+ "version": "0.18.0",
4
4
  "description": "Luminescent UI library",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",
@@ -41,22 +41,22 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@anuragroy/tailwindcss-animate": "^1.0.6",
44
- "@builder.io/qwik": "1.5.4",
45
- "@builder.io/qwik-city": "^1.5.4",
44
+ "@builder.io/qwik": "1.5.6",
45
+ "@builder.io/qwik-city": "^1.5.6",
46
46
  "@types/eslint": "^8.56.10",
47
- "@types/node": "^20.12.11",
48
- "@typescript-eslint/eslint-plugin": "^7.8.0",
49
- "@typescript-eslint/parser": "^7.8.0",
47
+ "@types/node": "^20.14.2",
48
+ "@typescript-eslint/eslint-plugin": "^7.13.0",
49
+ "@typescript-eslint/parser": "^7.13.0",
50
50
  "autoprefixer": "^10.4.19",
51
- "chart.js": "^4.4.2",
51
+ "chart.js": "^4.4.3",
52
52
  "eslint": "^8.57.0",
53
53
  "eslint-plugin-qwik": "latest",
54
54
  "np": "^10.0.5",
55
55
  "postcss": "^8.4.38",
56
- "tailwindcss": "3.4.3",
56
+ "tailwindcss": "3.4.4",
57
57
  "typescript": "5.4.5",
58
58
  "undici": "*",
59
- "vite": "^5.2.11",
59
+ "vite": "^5.2.13",
60
60
  "vite-tsconfig-paths": "^4.3.2"
61
61
  }
62
62
  }
@@ -1,2 +0,0 @@
1
- declare const _default: import("@builder.io/qwik").Component<unknown>;
2
- export default _default;
@@ -1,19 +0,0 @@
1
- import type { JSXChildren, PropsOf } from '@builder.io/qwik';
2
- import type { buttonColorClasses, sizeClasses } from './Button';
3
- interface SelectInputProps extends Omit<PropsOf<'select'>, 'class' | 'size'> {
4
- class?: {
5
- [key: string]: boolean;
6
- };
7
- display?: JSXChildren;
8
- color?: keyof typeof buttonColorClasses;
9
- size?: keyof typeof sizeClasses;
10
- id: string;
11
- values: {
12
- name: JSXChildren;
13
- value: string | number;
14
- color?: keyof typeof buttonColorClasses;
15
- }[];
16
- }
17
- export declare const SelectInput: import("@builder.io/qwik").Component<SelectInputProps>;
18
- export declare const SelectInputRaw: import("@builder.io/qwik").Component<SelectInputProps>;
19
- export {};