@luminescent/ui 0.17.0 → 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,151 +767,17 @@ 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
- "colors",
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(ColorPicker, {
849
- get id() {
850
- return props1.id;
851
- },
852
- get value() {
853
- return props.value ?? "#000000";
854
- },
855
- get colors() {
856
- return props.colors;
857
- },
858
- get class() {
859
- return {
860
- "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
861
- "opacity-0 scale-95 pointer-events-none": !store.opened
862
- };
863
- },
864
- onInput$: /* @__PURE__ */ qwik.inlinedQrl((color) => {
865
- const [props12, props2] = qwik.useLexicalScope();
866
- const el = document.getElementById(props12.id);
867
- el.value = color;
868
- switch (props2.preview ?? "left") {
869
- case "full":
870
- el.style.backgroundColor = color;
871
- el.style.color = getBrightness(hexNumberToRgb(hexStringToNumber(color))) > 0.5 ? "black" : "white";
872
- break;
873
- case "left":
874
- el.style.borderLeft = `35px solid ${color}`;
875
- break;
876
- case "right":
877
- el.style.borderRight = `35px solid ${color}`;
878
- break;
879
- case "top":
880
- el.style.borderTop = `10px solid ${color}`;
881
- break;
882
- case "bottom":
883
- el.style.borderBottom = `10px solid ${color}`;
884
- break;
885
- }
886
- props2.onInput$?.(color);
887
- }, "ColorInput_component_div_ColorPicker_onInput_iZguRdHILBQ", [
888
- props1,
889
- props
890
- ]),
891
- [qwik._IMMUTABLE]: {
892
- id: qwik._wrapProp(props1, "id"),
893
- value: qwik._fnSignal((p0) => p0.value ?? "#000000", [
894
- props
895
- ], 'p0.value??"#000000"'),
896
- colors: qwik._fnSignal((p0) => p0.colors, [
897
- props
898
- ], "p0.colors"),
899
- class: qwik._fnSignal((p0) => ({
900
- "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
901
- "opacity-0 scale-95 pointer-events-none": !p0.opened
902
- }), [
903
- store
904
- ], '{"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}')
905
- }
906
- }, 3, "0s_2")
907
- ], 1, "0s_3");
908
- }, "ColorInput_component_jilGo0Bn3Ps"));
909
770
  const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
771
+ qwik._jsxBranch();
910
772
  const props1 = qwik._restProps(props, [
911
773
  "id",
912
774
  "value",
913
775
  "colors",
914
- "onInput$"
776
+ "color",
777
+ "onInput$",
778
+ "preview",
779
+ "horizontal",
780
+ "showInput"
915
781
  ]);
916
782
  const width = 125;
917
783
  const maxHue = 148;
@@ -931,8 +797,8 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
931
797
  });
932
798
  const setColor = /* @__PURE__ */ qwik.inlinedQrl((color) => {
933
799
  const [maxHue2, props2, store2, width2] = qwik.useLexicalScope();
934
- store2.value = color;
935
800
  const hsv = rgbToHsv(hexNumberToRgb(hexStringToNumber(color)));
801
+ store2.value = rgbToHex(hsvToRgb(hsv));
936
802
  store2.hue.position = hsv.h * maxHue2;
937
803
  store2.hue.color = rgbToHex(hsvToRgb({
938
804
  h: hsv.h,
@@ -941,8 +807,8 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
941
807
  }));
942
808
  store2.sPosition = hsv.s * width2;
943
809
  store2.bPosition = (1 - hsv.v) * maxHue2;
944
- props2.onInput$?.(color);
945
- }, "ColorPicker_component_setColor_dQW0vdqeCN0", [
810
+ props2.onInput$?.(store2.value);
811
+ }, "ColorPicker_component_setColor_QqVIlZ9HOqM", [
946
812
  maxHue,
947
813
  props,
948
814
  store,
@@ -962,7 +828,7 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
962
828
  }));
963
829
  store2.value = rgbToHex(hsvToRgb(hsvColor2));
964
830
  props2.onInput$?.(store2.value);
965
- }, "ColorPicker_component_hueChange_hJtp8803ipI", [
831
+ }, "ColorPicker_component_hueChange_mB1ILUl3lVg", [
966
832
  maxHue,
967
833
  props,
968
834
  store
@@ -982,7 +848,7 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
982
848
  };
983
849
  window.addEventListener("mouseup", mouseUpListener);
984
850
  window.addEventListener("touchend", mouseUpListener);
985
- }, "ColorPicker_component_hueMouseDown_6A9i0ZBsZm8", [
851
+ }, "ColorPicker_component_hueMouseDown_469EJwWnUmc", [
986
852
  hueChange
987
853
  ]);
988
854
  const sbChange = /* @__PURE__ */ qwik.inlinedQrl((e, hOffset) => {
@@ -998,7 +864,7 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
998
864
  v
999
865
  }));
1000
866
  props2.onInput$?.(store2.value);
1001
- }, "ColorPicker_component_sbChange_0v0ifR3opLw", [
867
+ }, "ColorPicker_component_sbChange_PWXSO5Wzkt4", [
1002
868
  maxHue,
1003
869
  props,
1004
870
  store,
@@ -1019,7 +885,7 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
1019
885
  };
1020
886
  window.addEventListener("mouseup", mouseUpListener);
1021
887
  window.addEventListener("touchend", mouseUpListener);
1022
- }, "ColorPicker_component_sbMouseDown_hy5wUud5AMs", [
888
+ }, "ColorPicker_component_sbMouseDown_lP7vsjR4o9U", [
1023
889
  sbChange
1024
890
  ]);
1025
891
  qwik.useOn("change", /* @__PURE__ */ qwik.inlinedQrl(() => {
@@ -1030,18 +896,18 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
1030
896
  if (!inputElement)
1031
897
  return;
1032
898
  setColor2(inputElement.value);
1033
- }, "ColorPicker_component_useOn_M72kyUTBS6Q", [
899
+ }, "ColorPicker_component_useOn_U80lAP6qXKg", [
1034
900
  props,
1035
901
  setColor
1036
902
  ]));
1037
903
  return /* @__PURE__ */ qwik._jsxQ("div", {
1038
904
  class: {
1039
- "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,
1040
908
  ...props1.class
1041
909
  }
1042
910
  }, {
1043
- "preventdefault:mousedown": true,
1044
- "preventdefault:touchstart": true,
1045
911
  id: qwik._fnSignal((p0) => p0.id ? `${p0.id}-picker` : void 0, [
1046
912
  props
1047
913
  ], "p0.id?`${p0.id}-picker`:undefined")
@@ -1062,10 +928,15 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
1062
928
  onTouchStart$: sbMouseDown
1063
929
  }, [
1064
930
  /* @__PURE__ */ qwik._jsxQ("div", null, {
1065
- 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"
1066
932
  }, null, 3, null),
1067
- /* @__PURE__ */ qwik._jsxQ("div", null, {
1068
- 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
+ }, {
1069
940
  style: qwik._fnSignal((p0) => ({
1070
941
  background: p0.value,
1071
942
  transform: `translate(${p0.sPosition}px, ${p0.bPosition}px)`
@@ -1073,7 +944,7 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
1073
944
  store
1074
945
  ], "{background:p0.value,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
1075
946
  }, null, 3, null)
1076
- ], 3, null),
947
+ ], 1, null),
1077
948
  /* @__PURE__ */ qwik._jsxQ("div", null, {
1078
949
  class: "h-[150px] relative w-2 border border-gray-700 rounded-md",
1079
950
  style: {
@@ -1092,10 +963,49 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
1092
963
  store
1093
964
  ], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
1094
965
  }, null, 3, null), 3, null)
1095
- ], 3, null),
966
+ ], 1, null),
1096
967
  /* @__PURE__ */ qwik._jsxQ("div", null, {
1097
- class: "w-[150px] flex flex-wrap gap-1 justify-evenly"
968
+ class: "w-[150px] flex flex-wrap gap-1 justify-between"
1098
969
  }, [
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"),
1099
1009
  (props.colors ?? [
1100
1010
  "#FAEDCB",
1101
1011
  "#C9E4DE",
@@ -1113,43 +1023,30 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
1113
1023
  "#FFFFFF"
1114
1024
  ]).map((color, i) => {
1115
1025
  return /* @__PURE__ */ qwik._jsxQ("button", {
1116
- style: `background: ${color}`,
1117
- onMouseDown$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1118
- const [color2, setColor2] = qwik.useLexicalScope();
1119
- setColor2(color2);
1120
- }, "ColorPicker_component_div_div_button_onMouseDown_Q70JtgqzpdY", [
1121
- color,
1122
- setColor
1123
- ]),
1124
- 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(() => {
1125
1031
  const [color2, setColor2] = qwik.useLexicalScope();
1126
1032
  setColor2(color2);
1127
- }, "ColorPicker_component_div_div_button_onTouchStart_m0QkWI0vvWo", [
1033
+ }, "ColorPicker_component_div_div_button_onClick_Ta02Z5rle88", [
1128
1034
  color,
1129
1035
  setColor
1130
1036
  ])
1131
1037
  }, {
1132
- 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
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
+ }
1135
1041
  }, null, 2, i);
1136
1042
  }),
1137
1043
  /* @__PURE__ */ qwik._jsxQ("button", null, {
1138
1044
  class: "w-[1.6rem] h-[1.6rem] border border-gray-700 rounded-md hover:scale-110 motion-safe:transition-all",
1139
- "preventdefault:mousedown": true,
1140
- "preventdefault:touchstart": true,
1141
- onMouseDown$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1142
- const [setColor2] = qwik.useLexicalScope();
1143
- const color = `#${Math.floor(Math.random() * 16777215).toString(16)}`;
1144
- setColor2(color);
1145
- }, "ColorPicker_component_div_div_button_onMouseDown_1_BkgpnioHbWM", [
1146
- setColor
1147
- ]),
1148
- onTouchStart$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1045
+ onClick$: /* @__PURE__ */ qwik.inlinedQrl(() => {
1149
1046
  const [setColor2] = qwik.useLexicalScope();
1150
1047
  const color = `#${Math.floor(Math.random() * 16777215).toString(16)}`;
1151
1048
  setColor2(color);
1152
- }, "ColorPicker_component_div_div_button_onTouchStart_1_WXsfg0rO47c", [
1049
+ }, "ColorPicker_component_div_div_button_onClick_1_f6gYSNc77Ik", [
1153
1050
  setColor
1154
1051
  ])
1155
1052
  }, /* @__PURE__ */ qwik._jsxC(Shuffle, {
@@ -1157,10 +1054,175 @@ const ColorPicker = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
1157
1054
  [qwik._IMMUTABLE]: {
1158
1055
  class: qwik._IMMUTABLE
1159
1056
  }
1160
- }, 3, "0s_4"), 1, null)
1057
+ }, 3, "sj_1"), 1, null)
1161
1058
  ], 1, null)
1162
- ], 1, "0s_5");
1163
- }, "ColorPicker_component_01s3C1v6iWI"));
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"));
1164
1226
  const ChevronDown = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
1165
1227
  return /* @__PURE__ */ qwik._jsxS("svg", {
1166
1228
  xmlns: "http://www.w3.org/2000/svg",
@@ -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,151 +765,17 @@ 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
- "colors",
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(ColorPicker, {
847
- get id() {
848
- return props1.id;
849
- },
850
- get value() {
851
- return props.value ?? "#000000";
852
- },
853
- get colors() {
854
- return props.colors;
855
- },
856
- get class() {
857
- return {
858
- "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
859
- "opacity-0 scale-95 pointer-events-none": !store.opened
860
- };
861
- },
862
- onInput$: /* @__PURE__ */ inlinedQrl((color) => {
863
- const [props12, props2] = useLexicalScope();
864
- const el = document.getElementById(props12.id);
865
- el.value = color;
866
- switch (props2.preview ?? "left") {
867
- case "full":
868
- el.style.backgroundColor = color;
869
- el.style.color = getBrightness(hexNumberToRgb(hexStringToNumber(color))) > 0.5 ? "black" : "white";
870
- break;
871
- case "left":
872
- el.style.borderLeft = `35px solid ${color}`;
873
- break;
874
- case "right":
875
- el.style.borderRight = `35px solid ${color}`;
876
- break;
877
- case "top":
878
- el.style.borderTop = `10px solid ${color}`;
879
- break;
880
- case "bottom":
881
- el.style.borderBottom = `10px solid ${color}`;
882
- break;
883
- }
884
- props2.onInput$?.(color);
885
- }, "ColorInput_component_div_ColorPicker_onInput_iZguRdHILBQ", [
886
- props1,
887
- props
888
- ]),
889
- [_IMMUTABLE]: {
890
- id: _wrapProp(props1, "id"),
891
- value: _fnSignal((p0) => p0.value ?? "#000000", [
892
- props
893
- ], 'p0.value??"#000000"'),
894
- colors: _fnSignal((p0) => p0.colors, [
895
- props
896
- ], "p0.colors"),
897
- class: _fnSignal((p0) => ({
898
- "motion-safe:transition-all absolute top-full mt-2 left-0 gap-1 z-[1000]": true,
899
- "opacity-0 scale-95 pointer-events-none": !p0.opened
900
- }), [
901
- store
902
- ], '{"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}')
903
- }
904
- }, 3, "0s_2")
905
- ], 1, "0s_3");
906
- }, "ColorInput_component_jilGo0Bn3Ps"));
907
768
  const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
769
+ _jsxBranch();
908
770
  const props1 = _restProps(props, [
909
771
  "id",
910
772
  "value",
911
773
  "colors",
912
- "onInput$"
774
+ "color",
775
+ "onInput$",
776
+ "preview",
777
+ "horizontal",
778
+ "showInput"
913
779
  ]);
914
780
  const width = 125;
915
781
  const maxHue = 148;
@@ -929,8 +795,8 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
929
795
  });
930
796
  const setColor = /* @__PURE__ */ inlinedQrl((color) => {
931
797
  const [maxHue2, props2, store2, width2] = useLexicalScope();
932
- store2.value = color;
933
798
  const hsv = rgbToHsv(hexNumberToRgb(hexStringToNumber(color)));
799
+ store2.value = rgbToHex(hsvToRgb(hsv));
934
800
  store2.hue.position = hsv.h * maxHue2;
935
801
  store2.hue.color = rgbToHex(hsvToRgb({
936
802
  h: hsv.h,
@@ -939,8 +805,8 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
939
805
  }));
940
806
  store2.sPosition = hsv.s * width2;
941
807
  store2.bPosition = (1 - hsv.v) * maxHue2;
942
- props2.onInput$?.(color);
943
- }, "ColorPicker_component_setColor_dQW0vdqeCN0", [
808
+ props2.onInput$?.(store2.value);
809
+ }, "ColorPicker_component_setColor_QqVIlZ9HOqM", [
944
810
  maxHue,
945
811
  props,
946
812
  store,
@@ -960,7 +826,7 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
960
826
  }));
961
827
  store2.value = rgbToHex(hsvToRgb(hsvColor2));
962
828
  props2.onInput$?.(store2.value);
963
- }, "ColorPicker_component_hueChange_hJtp8803ipI", [
829
+ }, "ColorPicker_component_hueChange_mB1ILUl3lVg", [
964
830
  maxHue,
965
831
  props,
966
832
  store
@@ -980,7 +846,7 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
980
846
  };
981
847
  window.addEventListener("mouseup", mouseUpListener);
982
848
  window.addEventListener("touchend", mouseUpListener);
983
- }, "ColorPicker_component_hueMouseDown_6A9i0ZBsZm8", [
849
+ }, "ColorPicker_component_hueMouseDown_469EJwWnUmc", [
984
850
  hueChange
985
851
  ]);
986
852
  const sbChange = /* @__PURE__ */ inlinedQrl((e, hOffset) => {
@@ -996,7 +862,7 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
996
862
  v
997
863
  }));
998
864
  props2.onInput$?.(store2.value);
999
- }, "ColorPicker_component_sbChange_0v0ifR3opLw", [
865
+ }, "ColorPicker_component_sbChange_PWXSO5Wzkt4", [
1000
866
  maxHue,
1001
867
  props,
1002
868
  store,
@@ -1017,7 +883,7 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
1017
883
  };
1018
884
  window.addEventListener("mouseup", mouseUpListener);
1019
885
  window.addEventListener("touchend", mouseUpListener);
1020
- }, "ColorPicker_component_sbMouseDown_hy5wUud5AMs", [
886
+ }, "ColorPicker_component_sbMouseDown_lP7vsjR4o9U", [
1021
887
  sbChange
1022
888
  ]);
1023
889
  useOn("change", /* @__PURE__ */ inlinedQrl(() => {
@@ -1028,18 +894,18 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
1028
894
  if (!inputElement)
1029
895
  return;
1030
896
  setColor2(inputElement.value);
1031
- }, "ColorPicker_component_useOn_M72kyUTBS6Q", [
897
+ }, "ColorPicker_component_useOn_U80lAP6qXKg", [
1032
898
  props,
1033
899
  setColor
1034
900
  ]));
1035
901
  return /* @__PURE__ */ _jsxQ("div", {
1036
902
  class: {
1037
- "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,
1038
906
  ...props1.class
1039
907
  }
1040
908
  }, {
1041
- "preventdefault:mousedown": true,
1042
- "preventdefault:touchstart": true,
1043
909
  id: _fnSignal((p0) => p0.id ? `${p0.id}-picker` : void 0, [
1044
910
  props
1045
911
  ], "p0.id?`${p0.id}-picker`:undefined")
@@ -1060,10 +926,15 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
1060
926
  onTouchStart$: sbMouseDown
1061
927
  }, [
1062
928
  /* @__PURE__ */ _jsxQ("div", null, {
1063
- 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"
1064
930
  }, null, 3, null),
1065
- /* @__PURE__ */ _jsxQ("div", null, {
1066
- 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
+ }, {
1067
938
  style: _fnSignal((p0) => ({
1068
939
  background: p0.value,
1069
940
  transform: `translate(${p0.sPosition}px, ${p0.bPosition}px)`
@@ -1071,7 +942,7 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
1071
942
  store
1072
943
  ], "{background:p0.value,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
1073
944
  }, null, 3, null)
1074
- ], 3, null),
945
+ ], 1, null),
1075
946
  /* @__PURE__ */ _jsxQ("div", null, {
1076
947
  class: "h-[150px] relative w-2 border border-gray-700 rounded-md",
1077
948
  style: {
@@ -1090,10 +961,49 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
1090
961
  store
1091
962
  ], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
1092
963
  }, null, 3, null), 3, null)
1093
- ], 3, null),
964
+ ], 1, null),
1094
965
  /* @__PURE__ */ _jsxQ("div", null, {
1095
- class: "w-[150px] flex flex-wrap gap-1 justify-evenly"
966
+ class: "w-[150px] flex flex-wrap gap-1 justify-between"
1096
967
  }, [
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"),
1097
1007
  (props.colors ?? [
1098
1008
  "#FAEDCB",
1099
1009
  "#C9E4DE",
@@ -1111,43 +1021,30 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
1111
1021
  "#FFFFFF"
1112
1022
  ]).map((color, i) => {
1113
1023
  return /* @__PURE__ */ _jsxQ("button", {
1114
- style: `background: ${color}`,
1115
- onMouseDown$: /* @__PURE__ */ inlinedQrl(() => {
1116
- const [color2, setColor2] = useLexicalScope();
1117
- setColor2(color2);
1118
- }, "ColorPicker_component_div_div_button_onMouseDown_Q70JtgqzpdY", [
1119
- color,
1120
- setColor
1121
- ]),
1122
- onTouchStart$: /* @__PURE__ */ inlinedQrl(() => {
1024
+ style: {
1025
+ background: color,
1026
+ outline: color === store.value ? "2px solid #ffffffaa" : void 0
1027
+ },
1028
+ onClick$: /* @__PURE__ */ inlinedQrl(() => {
1123
1029
  const [color2, setColor2] = useLexicalScope();
1124
1030
  setColor2(color2);
1125
- }, "ColorPicker_component_div_div_button_onTouchStart_m0QkWI0vvWo", [
1031
+ }, "ColorPicker_component_div_div_button_onClick_Ta02Z5rle88", [
1126
1032
  color,
1127
1033
  setColor
1128
1034
  ])
1129
1035
  }, {
1130
- class: "w-[1.6rem] h-[1.6rem] border border-gray-700 rounded-md hover:scale-110 motion-safe:transition-all",
1131
- "preventdefault:mousedown": true,
1132
- "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
+ }
1133
1039
  }, null, 2, i);
1134
1040
  }),
1135
1041
  /* @__PURE__ */ _jsxQ("button", null, {
1136
1042
  class: "w-[1.6rem] h-[1.6rem] border border-gray-700 rounded-md hover:scale-110 motion-safe:transition-all",
1137
- "preventdefault:mousedown": true,
1138
- "preventdefault:touchstart": true,
1139
- onMouseDown$: /* @__PURE__ */ inlinedQrl(() => {
1140
- const [setColor2] = useLexicalScope();
1141
- const color = `#${Math.floor(Math.random() * 16777215).toString(16)}`;
1142
- setColor2(color);
1143
- }, "ColorPicker_component_div_div_button_onMouseDown_1_BkgpnioHbWM", [
1144
- setColor
1145
- ]),
1146
- onTouchStart$: /* @__PURE__ */ inlinedQrl(() => {
1043
+ onClick$: /* @__PURE__ */ inlinedQrl(() => {
1147
1044
  const [setColor2] = useLexicalScope();
1148
1045
  const color = `#${Math.floor(Math.random() * 16777215).toString(16)}`;
1149
1046
  setColor2(color);
1150
- }, "ColorPicker_component_div_div_button_onTouchStart_1_WXsfg0rO47c", [
1047
+ }, "ColorPicker_component_div_div_button_onClick_1_f6gYSNc77Ik", [
1151
1048
  setColor
1152
1049
  ])
1153
1050
  }, /* @__PURE__ */ _jsxC(Shuffle, {
@@ -1155,10 +1052,175 @@ const ColorPicker = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
1155
1052
  [_IMMUTABLE]: {
1156
1053
  class: _IMMUTABLE
1157
1054
  }
1158
- }, 3, "0s_4"), 1, null)
1055
+ }, 3, "sj_1"), 1, null)
1159
1056
  ], 1, null)
1160
- ], 1, "0s_5");
1161
- }, "ColorPicker_component_01s3C1v6iWI"));
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"));
1162
1224
  const ChevronDown = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1163
1225
  return /* @__PURE__ */ _jsxS("svg", {
1164
1226
  xmlns: "http://www.w3.org/2000/svg",
@@ -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
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
- value?: string;
17
- colors?: string[];
18
- }
19
- export declare const ColorPicker: 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.17.0",
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",