@luminescent/ui 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.qwik.cjs +95 -66
- package/lib/index.qwik.mjs +96 -67
- package/lib-types/components/elements/NumberInput.d.ts +2 -6
- package/package.json +1 -1
- package/lib-types/components/logos/LoadingIcon.d.ts +0 -8
- package/lib-types/utils/simple-color-picker/index.d.ts +0 -145
- package/lib-types/utils/simple-color-picker/utils.d.ts +0 -6
package/lib/index.qwik.cjs
CHANGED
|
@@ -434,6 +434,16 @@ const ColorInput = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inline
|
|
|
434
434
|
}, "ColorInput_component_div_TextInputRaw_onFocus_9bHrhSeTgfI", [
|
|
435
435
|
store
|
|
436
436
|
]),
|
|
437
|
+
onInput$: /* @__PURE__ */ qwik.inlinedQrl((e, el) => {
|
|
438
|
+
const [props12, props2] = qwik.useLexicalScope();
|
|
439
|
+
const div = document.getElementById(`${props12.id}-picker`);
|
|
440
|
+
const event = new Event("change");
|
|
441
|
+
div.dispatchEvent(event);
|
|
442
|
+
props2.onInput$?.(el.value);
|
|
443
|
+
}, "ColorInput_component_div_TextInputRaw_onInput_nsV3cUv0Sxg", [
|
|
444
|
+
props1,
|
|
445
|
+
props
|
|
446
|
+
]),
|
|
437
447
|
style: (props.preview ?? "left") == "full" ? {
|
|
438
448
|
backgroundColor: `${props.value ?? "#000000"}`,
|
|
439
449
|
color: getBrightness(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000"))) > 0.5 ? "black" : "white"
|
|
@@ -455,6 +465,9 @@ const ColorInput = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inline
|
|
|
455
465
|
}
|
|
456
466
|
}, 0, "0s_1"),
|
|
457
467
|
/* @__PURE__ */ qwik._jsxC(ColorPickerRaw, {
|
|
468
|
+
get id() {
|
|
469
|
+
return props1.id;
|
|
470
|
+
},
|
|
458
471
|
get color() {
|
|
459
472
|
return props.value ?? "#000000";
|
|
460
473
|
},
|
|
@@ -530,13 +543,15 @@ const ColorInput = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inline
|
|
|
530
543
|
...p0.presetColors ?? []
|
|
531
544
|
], [
|
|
532
545
|
props
|
|
533
|
-
], '["#FAEDCB","#C9E4DE","#C6DEF1","#DBCDF0","#F2C6DE","#FCD05C","#5FE2C5","#4498DB","#9863E7","#E43A96",...p0.presetColors??[]]')
|
|
546
|
+
], '["#FAEDCB","#C9E4DE","#C6DEF1","#DBCDF0","#F2C6DE","#FCD05C","#5FE2C5","#4498DB","#9863E7","#E43A96",...p0.presetColors??[]]'),
|
|
547
|
+
id: qwik._wrapProp(props1, "id")
|
|
534
548
|
}
|
|
535
549
|
}, 3, "0s_2")
|
|
536
550
|
], 1, "0s_3");
|
|
537
551
|
}, "ColorInput_component_jilGo0Bn3Ps"));
|
|
538
552
|
const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
539
553
|
const props1 = qwik._restProps(props, [
|
|
554
|
+
"id",
|
|
540
555
|
"color",
|
|
541
556
|
"colors",
|
|
542
557
|
"onInput$"
|
|
@@ -650,60 +665,79 @@ const ColorPickerRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
|
|
|
650
665
|
}, "ColorPickerRaw_component_sbMouseDown_hRgkP7lymfY", [
|
|
651
666
|
sbChange
|
|
652
667
|
]);
|
|
668
|
+
qwik.useOn("change", /* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
669
|
+
const [props2, setColor2] = qwik.useLexicalScope();
|
|
670
|
+
if (!props2.id)
|
|
671
|
+
return;
|
|
672
|
+
const inputElement = document.getElementById(props2.id);
|
|
673
|
+
if (!inputElement)
|
|
674
|
+
return;
|
|
675
|
+
setColor2(inputElement.value);
|
|
676
|
+
}, "ColorPickerRaw_component_useOn_hsh00WCnzOE", [
|
|
677
|
+
props,
|
|
678
|
+
setColor
|
|
679
|
+
]));
|
|
653
680
|
return /* @__PURE__ */ qwik._jsxQ("div", {
|
|
654
681
|
class: {
|
|
655
|
-
"transition-all p-4
|
|
682
|
+
"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,
|
|
656
683
|
...props1.class
|
|
657
684
|
}
|
|
658
685
|
}, {
|
|
686
|
+
id: qwik._fnSignal((p0) => p0.id ? `${p0.id}-picker` : void 0, [
|
|
687
|
+
props
|
|
688
|
+
], "p0.id?`${p0.id}-picker`:undefined"),
|
|
659
689
|
"preventdefault:mousedown": true,
|
|
660
690
|
"preventdefault:touchstart": true
|
|
661
691
|
}, [
|
|
662
692
|
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
663
|
-
class: "
|
|
664
|
-
onMouseDown$: sbMouseDown,
|
|
665
|
-
onTouchStart$: sbMouseDown,
|
|
666
|
-
"preventdefault:mousedown": true,
|
|
667
|
-
"preventdefault:touchstart": true,
|
|
668
|
-
style: qwik._fnSignal((p0) => ({
|
|
669
|
-
background: `linear-gradient(to right, #FFFFFF, ${p0.hue.color})`
|
|
670
|
-
}), [
|
|
671
|
-
store
|
|
672
|
-
], "{background:`linear-gradient(to right, #FFFFFF, ${p0.hue.color})`}")
|
|
693
|
+
class: "flex gap-4"
|
|
673
694
|
}, [
|
|
674
695
|
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
675
|
-
class: "w-[125px] h-[150px] border border-gray-700 rounded-md
|
|
676
|
-
|
|
696
|
+
class: "w-[125px] h-[150px] border border-gray-700 rounded-md relative",
|
|
697
|
+
onMouseDown$: sbMouseDown,
|
|
698
|
+
onTouchStart$: sbMouseDown,
|
|
699
|
+
"preventdefault:mousedown": true,
|
|
700
|
+
"preventdefault:touchstart": true,
|
|
701
|
+
style: qwik._fnSignal((p0) => ({
|
|
702
|
+
background: `linear-gradient(to right, #FFFFFF, ${p0.hue.color})`
|
|
703
|
+
}), [
|
|
704
|
+
store
|
|
705
|
+
], "{background:`linear-gradient(to right, #FFFFFF, ${p0.hue.color})`}")
|
|
706
|
+
}, [
|
|
707
|
+
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
708
|
+
class: "w-[125px] h-[150px] border border-gray-700 rounded-md bg-gradient-to-b from-transparent to-black"
|
|
709
|
+
}, null, 3, null),
|
|
710
|
+
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
711
|
+
class: "absolute -top-2 -left-2 w-4 h-4 border border-white rounded-full bg-white",
|
|
712
|
+
style: qwik._fnSignal((p0) => ({
|
|
713
|
+
background: p0.color,
|
|
714
|
+
transform: `translate(${p0.sPosition}px, ${p0.bPosition}px)`
|
|
715
|
+
}), [
|
|
716
|
+
store
|
|
717
|
+
], "{background:p0.color,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
|
|
718
|
+
}, null, 3, null)
|
|
719
|
+
], 3, null),
|
|
677
720
|
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
678
|
-
class: "
|
|
721
|
+
class: "h-[150px] relative w-2 border border-gray-700 rounded-md",
|
|
722
|
+
onMouseDown$: hueMouseDown,
|
|
723
|
+
onTouchStart$: hueMouseDown,
|
|
724
|
+
"preventdefault:mousedown": true,
|
|
725
|
+
"preventdefault:touchstart": true,
|
|
726
|
+
style: {
|
|
727
|
+
background: "linear-gradient(to bottom, #ff0000, #ff00ff, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000)"
|
|
728
|
+
}
|
|
729
|
+
}, /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
730
|
+
class: "absolute -bottom-2 -left-[5px] w-4 h-4 border border-white rounded-full bg-[#ff0000]",
|
|
679
731
|
style: qwik._fnSignal((p0) => ({
|
|
680
|
-
|
|
681
|
-
|
|
732
|
+
transform: `translateY(${-p0.hue.position}px)`,
|
|
733
|
+
background: p0.hue.color
|
|
682
734
|
}), [
|
|
683
735
|
store
|
|
684
|
-
], "{
|
|
685
|
-
}, null, 3, null)
|
|
736
|
+
], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
|
|
737
|
+
}, null, 3, null), 3, null)
|
|
686
738
|
], 3, null),
|
|
687
739
|
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
688
|
-
class: "
|
|
689
|
-
onMouseDown$: hueMouseDown,
|
|
690
|
-
onTouchStart$: hueMouseDown,
|
|
691
|
-
"preventdefault:mousedown": true,
|
|
692
|
-
"preventdefault:touchstart": true,
|
|
693
|
-
style: {
|
|
694
|
-
background: "linear-gradient(to bottom, #ff0000, #ff00ff, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000)"
|
|
695
|
-
}
|
|
696
|
-
}, /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
697
|
-
class: "absolute -bottom-2 -left-[5px] w-4 h-4 border border-white rounded-full bg-[#ff0000]",
|
|
698
|
-
style: qwik._fnSignal((p0) => ({
|
|
699
|
-
transform: `translateY(${-p0.hue.position}px)`,
|
|
700
|
-
background: p0.hue.color
|
|
701
|
-
}), [
|
|
702
|
-
store
|
|
703
|
-
], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
|
|
704
|
-
}, null, 3, null), 3, null),
|
|
705
|
-
/* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
706
|
-
class: "h-[150px] flex flex-col flex-wrap gap-1 justify-evenly"
|
|
740
|
+
class: "w-[150px] flex flex-wrap gap-1 justify-evenly"
|
|
707
741
|
}, props.colors.map((color, i) => {
|
|
708
742
|
return /* @__PURE__ */ qwik._jsxQ("button", {
|
|
709
743
|
onMouseDown$: /* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
@@ -875,9 +909,6 @@ const NumberInputRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
|
|
|
875
909
|
-moz-appearance: textfield;
|
|
876
910
|
}
|
|
877
911
|
`, "NumberInputRaw_component_useStyles_v5EsWTMt0DU"));
|
|
878
|
-
const store = qwik.useStore({
|
|
879
|
-
value: props.value ?? 0
|
|
880
|
-
});
|
|
881
912
|
return /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
882
913
|
class: qwik._fnSignal((p0) => ({
|
|
883
914
|
"flex text-gray-50": true,
|
|
@@ -892,15 +923,15 @@ const NumberInputRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
|
|
|
892
923
|
},
|
|
893
924
|
"aria-label": "Decrement",
|
|
894
925
|
"data-action": "decrement",
|
|
895
|
-
disabled: props1.min ?
|
|
896
|
-
onClick$: /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
|
|
897
|
-
const [props2
|
|
898
|
-
|
|
899
|
-
|
|
926
|
+
disabled: props1.min ? (props.value ?? 0) <= props1.min : false,
|
|
927
|
+
onClick$: props.input ? /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
|
|
928
|
+
const [props2] = qwik.useLexicalScope();
|
|
929
|
+
const siblingInput = element.nextElementSibling;
|
|
930
|
+
siblingInput.stepDown();
|
|
931
|
+
props2.onDecrement$(event, element, siblingInput);
|
|
900
932
|
}, "NumberInputRaw_component_div_Button_onClick_PgKg57gfX0I", [
|
|
901
|
-
props
|
|
902
|
-
|
|
903
|
-
]),
|
|
933
|
+
props
|
|
934
|
+
]) : props.onDecrement$,
|
|
904
935
|
get class() {
|
|
905
936
|
return {
|
|
906
937
|
"mr-2": props.input
|
|
@@ -924,10 +955,9 @@ const NumberInputRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
|
|
|
924
955
|
color: qwik._fnSignal((p0) => p0.input ? "gray" : "darkgray", [
|
|
925
956
|
props
|
|
926
957
|
], 'p0.input?"gray":"darkgray"'),
|
|
927
|
-
"data-action": qwik._IMMUTABLE
|
|
928
|
-
onClick$: qwik._IMMUTABLE
|
|
958
|
+
"data-action": qwik._IMMUTABLE
|
|
929
959
|
}
|
|
930
|
-
},
|
|
960
|
+
}, 0, "gk_4"),
|
|
931
961
|
props.input && /* @__PURE__ */ qwik._jsxS("input", {
|
|
932
962
|
...props1,
|
|
933
963
|
class: {
|
|
@@ -940,9 +970,9 @@ const NumberInputRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
|
|
|
940
970
|
props
|
|
941
971
|
], "p0.step??1"),
|
|
942
972
|
type: "number",
|
|
943
|
-
value: qwik._fnSignal((p0) => p0.value, [
|
|
944
|
-
|
|
945
|
-
], "p0.value")
|
|
973
|
+
value: qwik._fnSignal((p0) => p0.value ?? 0, [
|
|
974
|
+
props
|
|
975
|
+
], "p0.value??0")
|
|
946
976
|
}, 0, "gk_5"),
|
|
947
977
|
/* @__PURE__ */ qwik._jsxC(Button, {
|
|
948
978
|
get color() {
|
|
@@ -950,15 +980,15 @@ const NumberInputRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
|
|
|
950
980
|
},
|
|
951
981
|
"aria-label": "Increment",
|
|
952
982
|
"data-action": "increment",
|
|
953
|
-
disabled: props1.max ?
|
|
954
|
-
onClick$: /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
|
|
955
|
-
const [props2
|
|
956
|
-
|
|
957
|
-
|
|
983
|
+
disabled: props1.max ? (props.value ?? 0) >= props1.max : false,
|
|
984
|
+
onClick$: props.input ? /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
|
|
985
|
+
const [props2] = qwik.useLexicalScope();
|
|
986
|
+
const siblingInput = element.previousElementSibling;
|
|
987
|
+
siblingInput.stepUp();
|
|
988
|
+
props2.onIncrement$(event, element, siblingInput);
|
|
958
989
|
}, "NumberInputRaw_component_div_Button_onClick_1_UzVlUpg1uGs", [
|
|
959
|
-
props
|
|
960
|
-
|
|
961
|
-
]),
|
|
990
|
+
props
|
|
991
|
+
]) : props.onIncrement$,
|
|
962
992
|
get class() {
|
|
963
993
|
return {
|
|
964
994
|
"ml-2": props.input
|
|
@@ -982,10 +1012,9 @@ const NumberInputRaw = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.in
|
|
|
982
1012
|
color: qwik._fnSignal((p0) => p0.input ? "gray" : "darkgray", [
|
|
983
1013
|
props
|
|
984
1014
|
], 'p0.input?"gray":"darkgray"'),
|
|
985
|
-
"data-action": qwik._IMMUTABLE
|
|
986
|
-
onClick$: qwik._IMMUTABLE
|
|
1015
|
+
"data-action": qwik._IMMUTABLE
|
|
987
1016
|
}
|
|
988
|
-
},
|
|
1017
|
+
}, 0, "gk_7")
|
|
989
1018
|
], 1, "gk_8");
|
|
990
1019
|
}, "NumberInputRaw_component_8sGf0eS1rvo"));
|
|
991
1020
|
const ChevronDown = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, _jsxQ, _fnSignal, _restProps, _jsxS, _jsxC, Slot, _wrapSignal, useStore, useLexicalScope, _IMMUTABLE, _jsxBranch, useStylesQrl } from "@builder.io/qwik";
|
|
1
|
+
import { componentQrl, inlinedQrl, _jsxQ, _fnSignal, _restProps, _jsxS, _jsxC, Slot, _wrapSignal, useStore, useLexicalScope, _IMMUTABLE, _wrapProp, useOn, _jsxBranch, useStylesQrl } 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
|
class: "block h-32 -mt-32",
|
|
@@ -432,6 +432,16 @@ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
432
432
|
}, "ColorInput_component_div_TextInputRaw_onFocus_9bHrhSeTgfI", [
|
|
433
433
|
store
|
|
434
434
|
]),
|
|
435
|
+
onInput$: /* @__PURE__ */ inlinedQrl((e, el) => {
|
|
436
|
+
const [props12, props2] = useLexicalScope();
|
|
437
|
+
const div = document.getElementById(`${props12.id}-picker`);
|
|
438
|
+
const event = new Event("change");
|
|
439
|
+
div.dispatchEvent(event);
|
|
440
|
+
props2.onInput$?.(el.value);
|
|
441
|
+
}, "ColorInput_component_div_TextInputRaw_onInput_nsV3cUv0Sxg", [
|
|
442
|
+
props1,
|
|
443
|
+
props
|
|
444
|
+
]),
|
|
435
445
|
style: (props.preview ?? "left") == "full" ? {
|
|
436
446
|
backgroundColor: `${props.value ?? "#000000"}`,
|
|
437
447
|
color: getBrightness(hexNumberToRgb(hexStringToNumber(props.value ?? "#000000"))) > 0.5 ? "black" : "white"
|
|
@@ -453,6 +463,9 @@ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
453
463
|
}
|
|
454
464
|
}, 0, "0s_1"),
|
|
455
465
|
/* @__PURE__ */ _jsxC(ColorPickerRaw, {
|
|
466
|
+
get id() {
|
|
467
|
+
return props1.id;
|
|
468
|
+
},
|
|
456
469
|
get color() {
|
|
457
470
|
return props.value ?? "#000000";
|
|
458
471
|
},
|
|
@@ -528,13 +541,15 @@ const ColorInput = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
528
541
|
...p0.presetColors ?? []
|
|
529
542
|
], [
|
|
530
543
|
props
|
|
531
|
-
], '["#FAEDCB","#C9E4DE","#C6DEF1","#DBCDF0","#F2C6DE","#FCD05C","#5FE2C5","#4498DB","#9863E7","#E43A96",...p0.presetColors??[]]')
|
|
544
|
+
], '["#FAEDCB","#C9E4DE","#C6DEF1","#DBCDF0","#F2C6DE","#FCD05C","#5FE2C5","#4498DB","#9863E7","#E43A96",...p0.presetColors??[]]'),
|
|
545
|
+
id: _wrapProp(props1, "id")
|
|
532
546
|
}
|
|
533
547
|
}, 3, "0s_2")
|
|
534
548
|
], 1, "0s_3");
|
|
535
549
|
}, "ColorInput_component_jilGo0Bn3Ps"));
|
|
536
550
|
const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
537
551
|
const props1 = _restProps(props, [
|
|
552
|
+
"id",
|
|
538
553
|
"color",
|
|
539
554
|
"colors",
|
|
540
555
|
"onInput$"
|
|
@@ -648,60 +663,79 @@ const ColorPickerRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
|
|
|
648
663
|
}, "ColorPickerRaw_component_sbMouseDown_hRgkP7lymfY", [
|
|
649
664
|
sbChange
|
|
650
665
|
]);
|
|
666
|
+
useOn("change", /* @__PURE__ */ inlinedQrl(() => {
|
|
667
|
+
const [props2, setColor2] = useLexicalScope();
|
|
668
|
+
if (!props2.id)
|
|
669
|
+
return;
|
|
670
|
+
const inputElement = document.getElementById(props2.id);
|
|
671
|
+
if (!inputElement)
|
|
672
|
+
return;
|
|
673
|
+
setColor2(inputElement.value);
|
|
674
|
+
}, "ColorPickerRaw_component_useOn_hsh00WCnzOE", [
|
|
675
|
+
props,
|
|
676
|
+
setColor
|
|
677
|
+
]));
|
|
651
678
|
return /* @__PURE__ */ _jsxQ("div", {
|
|
652
679
|
class: {
|
|
653
|
-
"transition-all p-4
|
|
680
|
+
"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,
|
|
654
681
|
...props1.class
|
|
655
682
|
}
|
|
656
683
|
}, {
|
|
684
|
+
id: _fnSignal((p0) => p0.id ? `${p0.id}-picker` : void 0, [
|
|
685
|
+
props
|
|
686
|
+
], "p0.id?`${p0.id}-picker`:undefined"),
|
|
657
687
|
"preventdefault:mousedown": true,
|
|
658
688
|
"preventdefault:touchstart": true
|
|
659
689
|
}, [
|
|
660
690
|
/* @__PURE__ */ _jsxQ("div", null, {
|
|
661
|
-
class: "
|
|
662
|
-
onMouseDown$: sbMouseDown,
|
|
663
|
-
onTouchStart$: sbMouseDown,
|
|
664
|
-
"preventdefault:mousedown": true,
|
|
665
|
-
"preventdefault:touchstart": true,
|
|
666
|
-
style: _fnSignal((p0) => ({
|
|
667
|
-
background: `linear-gradient(to right, #FFFFFF, ${p0.hue.color})`
|
|
668
|
-
}), [
|
|
669
|
-
store
|
|
670
|
-
], "{background:`linear-gradient(to right, #FFFFFF, ${p0.hue.color})`}")
|
|
691
|
+
class: "flex gap-4"
|
|
671
692
|
}, [
|
|
672
693
|
/* @__PURE__ */ _jsxQ("div", null, {
|
|
673
|
-
class: "w-[125px] h-[150px] border border-gray-700 rounded-md
|
|
674
|
-
|
|
694
|
+
class: "w-[125px] h-[150px] border border-gray-700 rounded-md relative",
|
|
695
|
+
onMouseDown$: sbMouseDown,
|
|
696
|
+
onTouchStart$: sbMouseDown,
|
|
697
|
+
"preventdefault:mousedown": true,
|
|
698
|
+
"preventdefault:touchstart": true,
|
|
699
|
+
style: _fnSignal((p0) => ({
|
|
700
|
+
background: `linear-gradient(to right, #FFFFFF, ${p0.hue.color})`
|
|
701
|
+
}), [
|
|
702
|
+
store
|
|
703
|
+
], "{background:`linear-gradient(to right, #FFFFFF, ${p0.hue.color})`}")
|
|
704
|
+
}, [
|
|
705
|
+
/* @__PURE__ */ _jsxQ("div", null, {
|
|
706
|
+
class: "w-[125px] h-[150px] border border-gray-700 rounded-md bg-gradient-to-b from-transparent to-black"
|
|
707
|
+
}, null, 3, null),
|
|
708
|
+
/* @__PURE__ */ _jsxQ("div", null, {
|
|
709
|
+
class: "absolute -top-2 -left-2 w-4 h-4 border border-white rounded-full bg-white",
|
|
710
|
+
style: _fnSignal((p0) => ({
|
|
711
|
+
background: p0.color,
|
|
712
|
+
transform: `translate(${p0.sPosition}px, ${p0.bPosition}px)`
|
|
713
|
+
}), [
|
|
714
|
+
store
|
|
715
|
+
], "{background:p0.color,transform:`translate(${p0.sPosition}px, ${p0.bPosition}px)`}")
|
|
716
|
+
}, null, 3, null)
|
|
717
|
+
], 3, null),
|
|
675
718
|
/* @__PURE__ */ _jsxQ("div", null, {
|
|
676
|
-
class: "
|
|
719
|
+
class: "h-[150px] relative w-2 border border-gray-700 rounded-md",
|
|
720
|
+
onMouseDown$: hueMouseDown,
|
|
721
|
+
onTouchStart$: hueMouseDown,
|
|
722
|
+
"preventdefault:mousedown": true,
|
|
723
|
+
"preventdefault:touchstart": true,
|
|
724
|
+
style: {
|
|
725
|
+
background: "linear-gradient(to bottom, #ff0000, #ff00ff, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000)"
|
|
726
|
+
}
|
|
727
|
+
}, /* @__PURE__ */ _jsxQ("div", null, {
|
|
728
|
+
class: "absolute -bottom-2 -left-[5px] w-4 h-4 border border-white rounded-full bg-[#ff0000]",
|
|
677
729
|
style: _fnSignal((p0) => ({
|
|
678
|
-
|
|
679
|
-
|
|
730
|
+
transform: `translateY(${-p0.hue.position}px)`,
|
|
731
|
+
background: p0.hue.color
|
|
680
732
|
}), [
|
|
681
733
|
store
|
|
682
|
-
], "{
|
|
683
|
-
}, null, 3, null)
|
|
734
|
+
], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
|
|
735
|
+
}, null, 3, null), 3, null)
|
|
684
736
|
], 3, null),
|
|
685
737
|
/* @__PURE__ */ _jsxQ("div", null, {
|
|
686
|
-
class: "
|
|
687
|
-
onMouseDown$: hueMouseDown,
|
|
688
|
-
onTouchStart$: hueMouseDown,
|
|
689
|
-
"preventdefault:mousedown": true,
|
|
690
|
-
"preventdefault:touchstart": true,
|
|
691
|
-
style: {
|
|
692
|
-
background: "linear-gradient(to bottom, #ff0000, #ff00ff, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000)"
|
|
693
|
-
}
|
|
694
|
-
}, /* @__PURE__ */ _jsxQ("div", null, {
|
|
695
|
-
class: "absolute -bottom-2 -left-[5px] w-4 h-4 border border-white rounded-full bg-[#ff0000]",
|
|
696
|
-
style: _fnSignal((p0) => ({
|
|
697
|
-
transform: `translateY(${-p0.hue.position}px)`,
|
|
698
|
-
background: p0.hue.color
|
|
699
|
-
}), [
|
|
700
|
-
store
|
|
701
|
-
], "{transform:`translateY(${-p0.hue.position}px)`,background:p0.hue.color}")
|
|
702
|
-
}, null, 3, null), 3, null),
|
|
703
|
-
/* @__PURE__ */ _jsxQ("div", null, {
|
|
704
|
-
class: "h-[150px] flex flex-col flex-wrap gap-1 justify-evenly"
|
|
738
|
+
class: "w-[150px] flex flex-wrap gap-1 justify-evenly"
|
|
705
739
|
}, props.colors.map((color, i) => {
|
|
706
740
|
return /* @__PURE__ */ _jsxQ("button", {
|
|
707
741
|
onMouseDown$: /* @__PURE__ */ inlinedQrl(() => {
|
|
@@ -873,9 +907,6 @@ const NumberInputRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
|
|
|
873
907
|
-moz-appearance: textfield;
|
|
874
908
|
}
|
|
875
909
|
`, "NumberInputRaw_component_useStyles_v5EsWTMt0DU"));
|
|
876
|
-
const store = useStore({
|
|
877
|
-
value: props.value ?? 0
|
|
878
|
-
});
|
|
879
910
|
return /* @__PURE__ */ _jsxQ("div", null, {
|
|
880
911
|
class: _fnSignal((p0) => ({
|
|
881
912
|
"flex text-gray-50": true,
|
|
@@ -890,15 +921,15 @@ const NumberInputRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
|
|
|
890
921
|
},
|
|
891
922
|
"aria-label": "Decrement",
|
|
892
923
|
"data-action": "decrement",
|
|
893
|
-
disabled: props1.min ?
|
|
894
|
-
onClick$: /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
895
|
-
const [props2
|
|
896
|
-
|
|
897
|
-
|
|
924
|
+
disabled: props1.min ? (props.value ?? 0) <= props1.min : false,
|
|
925
|
+
onClick$: props.input ? /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
926
|
+
const [props2] = useLexicalScope();
|
|
927
|
+
const siblingInput = element.nextElementSibling;
|
|
928
|
+
siblingInput.stepDown();
|
|
929
|
+
props2.onDecrement$(event, element, siblingInput);
|
|
898
930
|
}, "NumberInputRaw_component_div_Button_onClick_PgKg57gfX0I", [
|
|
899
|
-
props
|
|
900
|
-
|
|
901
|
-
]),
|
|
931
|
+
props
|
|
932
|
+
]) : props.onDecrement$,
|
|
902
933
|
get class() {
|
|
903
934
|
return {
|
|
904
935
|
"mr-2": props.input
|
|
@@ -922,10 +953,9 @@ const NumberInputRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
|
|
|
922
953
|
color: _fnSignal((p0) => p0.input ? "gray" : "darkgray", [
|
|
923
954
|
props
|
|
924
955
|
], 'p0.input?"gray":"darkgray"'),
|
|
925
|
-
"data-action": _IMMUTABLE
|
|
926
|
-
onClick$: _IMMUTABLE
|
|
956
|
+
"data-action": _IMMUTABLE
|
|
927
957
|
}
|
|
928
|
-
},
|
|
958
|
+
}, 0, "gk_4"),
|
|
929
959
|
props.input && /* @__PURE__ */ _jsxS("input", {
|
|
930
960
|
...props1,
|
|
931
961
|
class: {
|
|
@@ -938,9 +968,9 @@ const NumberInputRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
|
|
|
938
968
|
props
|
|
939
969
|
], "p0.step??1"),
|
|
940
970
|
type: "number",
|
|
941
|
-
value: _fnSignal((p0) => p0.value, [
|
|
942
|
-
|
|
943
|
-
], "p0.value")
|
|
971
|
+
value: _fnSignal((p0) => p0.value ?? 0, [
|
|
972
|
+
props
|
|
973
|
+
], "p0.value??0")
|
|
944
974
|
}, 0, "gk_5"),
|
|
945
975
|
/* @__PURE__ */ _jsxC(Button, {
|
|
946
976
|
get color() {
|
|
@@ -948,15 +978,15 @@ const NumberInputRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
|
|
|
948
978
|
},
|
|
949
979
|
"aria-label": "Increment",
|
|
950
980
|
"data-action": "increment",
|
|
951
|
-
disabled: props1.max ?
|
|
952
|
-
onClick$: /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
953
|
-
const [props2
|
|
954
|
-
|
|
955
|
-
|
|
981
|
+
disabled: props1.max ? (props.value ?? 0) >= props1.max : false,
|
|
982
|
+
onClick$: props.input ? /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
983
|
+
const [props2] = useLexicalScope();
|
|
984
|
+
const siblingInput = element.previousElementSibling;
|
|
985
|
+
siblingInput.stepUp();
|
|
986
|
+
props2.onIncrement$(event, element, siblingInput);
|
|
956
987
|
}, "NumberInputRaw_component_div_Button_onClick_1_UzVlUpg1uGs", [
|
|
957
|
-
props
|
|
958
|
-
|
|
959
|
-
]),
|
|
988
|
+
props
|
|
989
|
+
]) : props.onIncrement$,
|
|
960
990
|
get class() {
|
|
961
991
|
return {
|
|
962
992
|
"ml-2": props.input
|
|
@@ -980,10 +1010,9 @@ const NumberInputRaw = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((
|
|
|
980
1010
|
color: _fnSignal((p0) => p0.input ? "gray" : "darkgray", [
|
|
981
1011
|
props
|
|
982
1012
|
], 'p0.input?"gray":"darkgray"'),
|
|
983
|
-
"data-action": _IMMUTABLE
|
|
984
|
-
onClick$: _IMMUTABLE
|
|
1013
|
+
"data-action": _IMMUTABLE
|
|
985
1014
|
}
|
|
986
|
-
},
|
|
1015
|
+
}, 0, "gk_7")
|
|
987
1016
|
], 1, "gk_8");
|
|
988
1017
|
}, "NumberInputRaw_component_8sGf0eS1rvo"));
|
|
989
1018
|
const ChevronDown = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
@@ -2,12 +2,8 @@ import type { PropsOf, QRL } from '@builder.io/qwik';
|
|
|
2
2
|
interface NumberInputRawProps extends Omit<(PropsOf<'input'> & {
|
|
3
3
|
type: 'number';
|
|
4
4
|
}), 'class' | 'type'> {
|
|
5
|
-
onDecrement$: QRL<(event: PointerEvent, element: HTMLButtonElement,
|
|
6
|
-
|
|
7
|
-
}) => void>;
|
|
8
|
-
onIncrement$: QRL<(event: PointerEvent, element: HTMLButtonElement, store: {
|
|
9
|
-
value: number;
|
|
10
|
-
}) => void>;
|
|
5
|
+
onDecrement$: QRL<(event: PointerEvent, element: HTMLButtonElement, inputElement?: HTMLInputElement) => void>;
|
|
6
|
+
onIncrement$: QRL<(event: PointerEvent, element: HTMLButtonElement, inputElement?: HTMLInputElement) => void>;
|
|
11
7
|
input?: boolean;
|
|
12
8
|
class?: {
|
|
13
9
|
[key: string]: boolean;
|
package/package.json
CHANGED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { Color } from './color';
|
|
2
|
-
type ColorPickerOptions = {
|
|
3
|
-
window?: Window;
|
|
4
|
-
el?: HTMLElement | string;
|
|
5
|
-
background?: string | number;
|
|
6
|
-
widthUnits?: string;
|
|
7
|
-
heightUnits?: string;
|
|
8
|
-
width?: number;
|
|
9
|
-
height?: number;
|
|
10
|
-
color?: string | number;
|
|
11
|
-
colors?: string[] | number[];
|
|
12
|
-
};
|
|
13
|
-
export declare class ColorPicker {
|
|
14
|
-
private _window;
|
|
15
|
-
private _document;
|
|
16
|
-
private _widthUnits;
|
|
17
|
-
private _heightUnits;
|
|
18
|
-
private _huePosition;
|
|
19
|
-
private _hueHeight;
|
|
20
|
-
private _maxHue;
|
|
21
|
-
_inputIsNumber: boolean;
|
|
22
|
-
private _saturationWidth;
|
|
23
|
-
private _isChoosing;
|
|
24
|
-
private _callbacks;
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
hue: number;
|
|
28
|
-
position: {
|
|
29
|
-
x: number;
|
|
30
|
-
y: number;
|
|
31
|
-
};
|
|
32
|
-
color: Color;
|
|
33
|
-
backgroundColor: Color;
|
|
34
|
-
hueColor: Color;
|
|
35
|
-
$el: HTMLElement;
|
|
36
|
-
$saturation: HTMLElement;
|
|
37
|
-
$hue: HTMLElement;
|
|
38
|
-
$sbSelector: HTMLElement;
|
|
39
|
-
$hSelector: HTMLElement;
|
|
40
|
-
$colors?: HTMLElement;
|
|
41
|
-
constructor(options?: ColorPickerOptions);
|
|
42
|
-
/**
|
|
43
|
-
* Add the ColorPicker instance to a DOM element.
|
|
44
|
-
* @param {HTMLElement} el
|
|
45
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
46
|
-
*/
|
|
47
|
-
appendTo(el: HTMLElement | string): this;
|
|
48
|
-
/**
|
|
49
|
-
* Removes picker from its parent and kill all listeners.
|
|
50
|
-
* Call this method for proper destroy.
|
|
51
|
-
*/
|
|
52
|
-
remove(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Manually set the current color of the picker. This is the method
|
|
55
|
-
* used on instantiation to convert `color` option to actual color for
|
|
56
|
-
* the picker. Param can be a hexadecimal number or an hex String.
|
|
57
|
-
* @param {String|Number} color hex color desired
|
|
58
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
59
|
-
*/
|
|
60
|
-
setColor(color: string | number): this;
|
|
61
|
-
/**
|
|
62
|
-
* Set size of the color picker for a given width and height. Note that
|
|
63
|
-
* a padding of 5px will be added if you chose to use the background option
|
|
64
|
-
* of the constructor.
|
|
65
|
-
* @param {Number} width
|
|
66
|
-
* @param {Number} height
|
|
67
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
68
|
-
*/
|
|
69
|
-
setSize(width: number, height: number): this;
|
|
70
|
-
/**
|
|
71
|
-
* Set the background color of the picker. It also adds a 5px padding
|
|
72
|
-
* for design purpose.
|
|
73
|
-
* @param {String|Number} color hex color desired for background
|
|
74
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
75
|
-
*/
|
|
76
|
-
setBackgroundColor(color: string | number): this;
|
|
77
|
-
/**
|
|
78
|
-
* Removes background of the picker if previously set. It's no use
|
|
79
|
-
* calling this method if you didn't set the background option on start
|
|
80
|
-
* or if you didn't call setBackgroundColor previously.
|
|
81
|
-
*/
|
|
82
|
-
setNoBackground(): this;
|
|
83
|
-
/**
|
|
84
|
-
* Registers callback to the update event of the picker.
|
|
85
|
-
* picker inherits from [component/emitter](https://github.com/component/emitter)
|
|
86
|
-
* so you could do the same thing by calling `colorPicker.on('update');`
|
|
87
|
-
* @param {Function} callback
|
|
88
|
-
* @return {ColorPicker} Returns itself for chaining purpose
|
|
89
|
-
*/
|
|
90
|
-
onChange(callback: Function): this;
|
|
91
|
-
/**
|
|
92
|
-
* Is true when mouse is down and user is currently choosing a color.
|
|
93
|
-
*/
|
|
94
|
-
get isChoosing(): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Main color getter, will return a formatted color string depending on input
|
|
97
|
-
* or a number depending on the last setColor call.
|
|
98
|
-
* @return {Number|String}
|
|
99
|
-
*/
|
|
100
|
-
getColor(): string | number;
|
|
101
|
-
/**
|
|
102
|
-
* Returns color as css hex string (ex: '#FF0000').
|
|
103
|
-
* @return {String}
|
|
104
|
-
*/
|
|
105
|
-
getHexString(): string;
|
|
106
|
-
/**
|
|
107
|
-
* Returns color as number (ex: 0xFF0000).
|
|
108
|
-
* @return {Number}
|
|
109
|
-
*/
|
|
110
|
-
getHexNumber(): number;
|
|
111
|
-
/**
|
|
112
|
-
* Returns color as {r: 1, g: 0, b: 0} object.
|
|
113
|
-
* @return {Object}
|
|
114
|
-
*/
|
|
115
|
-
getRGB(): import("./color").RGBAColor;
|
|
116
|
-
/**
|
|
117
|
-
* Returns color as {h: 100, s: 1, v: 1} object.
|
|
118
|
-
* @return {Object}
|
|
119
|
-
*/
|
|
120
|
-
getHSV(): import("./color").HSVAColor;
|
|
121
|
-
/**
|
|
122
|
-
* Returns true if color is perceived as dark
|
|
123
|
-
* @return {Boolean}
|
|
124
|
-
*/
|
|
125
|
-
isDark(): boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Returns true if color is perceived as light
|
|
128
|
-
* @return {Boolean}
|
|
129
|
-
*/
|
|
130
|
-
isLight(): boolean;
|
|
131
|
-
private _moveSelectorTo;
|
|
132
|
-
private _updateColorFromPosition;
|
|
133
|
-
private _moveHueTo;
|
|
134
|
-
private _updateHueFromPosition;
|
|
135
|
-
private _updateHue;
|
|
136
|
-
private _updateColor;
|
|
137
|
-
private _triggerChange;
|
|
138
|
-
private _onSaturationMouseDown;
|
|
139
|
-
private _onSaturationMouseMove;
|
|
140
|
-
private _onSaturationMouseUp;
|
|
141
|
-
private _onHueMouseDown;
|
|
142
|
-
private _onHueMouseMove;
|
|
143
|
-
private _onHueMouseUp;
|
|
144
|
-
}
|
|
145
|
-
export {};
|