@mekari/pixel3-color-picker 0.1.1 → 0.1.2-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-L5BRB7ES.mjs → chunk-2ZZBAQKR.mjs} +5 -1
- package/dist/{chunk-DVRBDVR4.mjs → chunk-5CI43L4Q.mjs} +5 -1
- package/dist/{chunk-KHGAEPYZ.mjs → chunk-5VPWEGKC.mjs} +11 -25
- package/dist/{chunk-YPFR76KW.mjs → chunk-MILYTHNM.mjs} +0 -1
- package/dist/{chunk-6XOLIDD7.mjs → chunk-WQTXZAWZ.mjs} +18 -9
- package/dist/color-picker.d.mts +13 -4
- package/dist/color-picker.d.ts +13 -4
- package/dist/color-picker.js +53 -51
- package/dist/color-picker.mjs +5 -5
- package/dist/index.js +53 -51
- package/dist/index.mjs +5 -5
- package/dist/input.js +0 -1
- package/dist/input.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/modules/color-picker.hooks.d.mts +5 -3
- package/dist/modules/color-picker.hooks.d.ts +5 -3
- package/dist/modules/color-picker.hooks.js +11 -25
- package/dist/modules/color-picker.hooks.mjs +1 -1
- package/dist/modules/color-picker.props.d.mts +4 -0
- package/dist/modules/color-picker.props.d.ts +4 -0
- package/dist/modules/color-picker.props.js +5 -1
- package/dist/modules/color-picker.props.mjs +1 -1
- package/dist/preset.js +5 -1
- package/dist/preset.mjs +1 -1
- package/package.json +9 -9
|
@@ -23,7 +23,7 @@ var colorPickerProps = {
|
|
|
23
23
|
},
|
|
24
24
|
placement: {
|
|
25
25
|
type: String,
|
|
26
|
-
default: "bottom"
|
|
26
|
+
default: "bottom-start"
|
|
27
27
|
},
|
|
28
28
|
preset: {
|
|
29
29
|
type: Array,
|
|
@@ -51,6 +51,10 @@ var colorPickerProps = {
|
|
|
51
51
|
type: Boolean,
|
|
52
52
|
default: true
|
|
53
53
|
},
|
|
54
|
+
isDisabled: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
54
58
|
isInvalid: {
|
|
55
59
|
type: Boolean,
|
|
56
60
|
default: false
|
|
@@ -7,6 +7,7 @@ import { createVNode as _createVNode } from "vue";
|
|
|
7
7
|
import { defineComponent } from "vue";
|
|
8
8
|
import tinycolor from "tinycolor2";
|
|
9
9
|
import { MpIcon } from "@mekari/pixel3-icon";
|
|
10
|
+
import { usePixelTheme } from "@mekari/pixel3-utils";
|
|
10
11
|
import { css } from "@mekari/pixel3-styled-system/css";
|
|
11
12
|
var MpColorPreset = defineComponent({
|
|
12
13
|
name: "MpColorPreset",
|
|
@@ -23,6 +24,9 @@ var MpColorPreset = defineComponent({
|
|
|
23
24
|
setup(props, {
|
|
24
25
|
emit
|
|
25
26
|
}) {
|
|
27
|
+
const {
|
|
28
|
+
isNextTheme
|
|
29
|
+
} = usePixelTheme();
|
|
26
30
|
function handleClick() {
|
|
27
31
|
emit("click", props.value);
|
|
28
32
|
}
|
|
@@ -38,7 +42,7 @@ var MpColorPreset = defineComponent({
|
|
|
38
42
|
width: "6",
|
|
39
43
|
height: "6",
|
|
40
44
|
borderWidth: "1px",
|
|
41
|
-
borderColor: "gray.50",
|
|
45
|
+
borderColor: isNextTheme.value ? "border.default" : "gray.50",
|
|
42
46
|
borderRadius: "sm",
|
|
43
47
|
cursor: "pointer"
|
|
44
48
|
}),
|
|
@@ -7,8 +7,6 @@ import { computed, watch, ref, toRefs, onMounted } from "vue";
|
|
|
7
7
|
import tinycolor from "tinycolor2";
|
|
8
8
|
import { getUniqueId } from "@mekari/pixel3-utils";
|
|
9
9
|
import { colorPickerSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
|
|
10
|
-
import { css, cx } from "@mekari/pixel3-styled-system/css";
|
|
11
|
-
import { token } from "@mekari/pixel3-styled-system/tokens";
|
|
12
10
|
function useColorPicker(props, emit) {
|
|
13
11
|
const {
|
|
14
12
|
id,
|
|
@@ -17,6 +15,7 @@ function useColorPicker(props, emit) {
|
|
|
17
15
|
variant,
|
|
18
16
|
placement,
|
|
19
17
|
isShowPopover,
|
|
18
|
+
isDisabled,
|
|
20
19
|
isInvalid
|
|
21
20
|
} = toRefs(props);
|
|
22
21
|
const val = ref(_colorChange(value.value));
|
|
@@ -33,20 +32,7 @@ function useColorPicker(props, emit) {
|
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
34
|
const hex = computed(() => {
|
|
36
|
-
|
|
37
|
-
return hex2.replace("#", "");
|
|
38
|
-
});
|
|
39
|
-
const borderColor = computed(() => {
|
|
40
|
-
if (isInvalid.value) {
|
|
41
|
-
return "red.400";
|
|
42
|
-
}
|
|
43
|
-
if (!isInvalid.value && isFocused.value) {
|
|
44
|
-
return "blue.400";
|
|
45
|
-
}
|
|
46
|
-
return "gray.100";
|
|
47
|
-
});
|
|
48
|
-
const isFocused = computed(() => {
|
|
49
|
-
return isPopoverOpen.value;
|
|
35
|
+
return colors.value.hex.replace("#", "");
|
|
50
36
|
});
|
|
51
37
|
const rootAttrs = computed(() => {
|
|
52
38
|
return {
|
|
@@ -61,22 +47,18 @@ function useColorPicker(props, emit) {
|
|
|
61
47
|
placement: placement.value,
|
|
62
48
|
defaultIsOpen: isShowPopover.value,
|
|
63
49
|
initialFocusRef: `#input-${getId}`,
|
|
50
|
+
isManual: isDisabled.value,
|
|
51
|
+
// hack way to disabled Popover
|
|
64
52
|
onOpen: handleOpenPopover,
|
|
65
53
|
onClose: handleClosePopover
|
|
66
54
|
};
|
|
67
55
|
});
|
|
68
56
|
const popoverTriggerAttrs = computed(() => {
|
|
69
57
|
return {
|
|
58
|
+
"data-invalid": isInvalid.value || void 0,
|
|
59
|
+
"data-disabled": isDisabled.value || void 0,
|
|
70
60
|
tabindex: "0",
|
|
71
|
-
class:
|
|
72
|
-
boxShadow: isPopoverOpen.value && !isInvalid.value ? "outline" : "none",
|
|
73
|
-
_hover: {
|
|
74
|
-
borderColor: isPopoverOpen.value && !isInvalid.value ? "blue.500 !important" : "gray.400 !important"
|
|
75
|
-
}
|
|
76
|
-
}), colorPickerSlotRecipe().popoverTrigger),
|
|
77
|
-
style: {
|
|
78
|
-
borderColor: token(`colors.${borderColor.value}`)
|
|
79
|
-
}
|
|
61
|
+
class: colorPickerSlotRecipe().popoverTrigger
|
|
80
62
|
};
|
|
81
63
|
});
|
|
82
64
|
const boxColorAttrs = computed(() => {
|
|
@@ -96,6 +78,8 @@ function useColorPicker(props, emit) {
|
|
|
96
78
|
maxlength: "6",
|
|
97
79
|
value: colorInput.value,
|
|
98
80
|
placeholder: placeholder.value,
|
|
81
|
+
isDisabled: isDisabled.value,
|
|
82
|
+
isInvalid: isInvalid.value,
|
|
99
83
|
class: colorPickerSlotRecipe().inputTrigger,
|
|
100
84
|
onInput: handleInputTrigger
|
|
101
85
|
};
|
|
@@ -293,6 +277,8 @@ function useColorPicker(props, emit) {
|
|
|
293
277
|
}
|
|
294
278
|
__name(handleInputTrigger, "handleInputTrigger");
|
|
295
279
|
function handleOpenPopover() {
|
|
280
|
+
if (isDisabled.value)
|
|
281
|
+
return;
|
|
296
282
|
isPopoverOpen.value = true;
|
|
297
283
|
colorInput.value = hex.value;
|
|
298
284
|
}
|
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
} from "./chunk-PULVLME3.mjs";
|
|
4
4
|
import {
|
|
5
5
|
MpColorInput
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MILYTHNM.mjs";
|
|
7
7
|
import {
|
|
8
8
|
MpColorPreset
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5CI43L4Q.mjs";
|
|
10
10
|
import {
|
|
11
11
|
MpColorSaturation
|
|
12
12
|
} from "./chunk-AEUPCATZ.mjs";
|
|
13
13
|
import {
|
|
14
14
|
useColorPicker
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5VPWEGKC.mjs";
|
|
16
16
|
import {
|
|
17
17
|
colorPickerProps
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-2ZZBAQKR.mjs";
|
|
19
19
|
import {
|
|
20
20
|
__name
|
|
21
21
|
} from "./chunk-QZ7VFGWC.mjs";
|
|
@@ -28,6 +28,7 @@ import { MpPopover, MpPopoverTrigger, MpPopoverContent } from "@mekari/pixel3-po
|
|
|
28
28
|
import { MpInput } from "@mekari/pixel3-input";
|
|
29
29
|
import { MpIcon } from "@mekari/pixel3-icon";
|
|
30
30
|
import { MpDivider } from "@mekari/pixel3-divider";
|
|
31
|
+
import { usePixelTheme } from "@mekari/pixel3-utils";
|
|
31
32
|
import { css } from "@mekari/pixel3-styled-system/css";
|
|
32
33
|
function _isSlot(s) {
|
|
33
34
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !_isVNode(s);
|
|
@@ -41,6 +42,9 @@ var MpColorPicker = defineComponent({
|
|
|
41
42
|
slots,
|
|
42
43
|
emit
|
|
43
44
|
}) {
|
|
45
|
+
const {
|
|
46
|
+
isNextTheme
|
|
47
|
+
} = usePixelTheme();
|
|
44
48
|
const {
|
|
45
49
|
rootAttrs,
|
|
46
50
|
popoverAttrs,
|
|
@@ -69,6 +73,7 @@ var MpColorPicker = defineComponent({
|
|
|
69
73
|
return () => {
|
|
70
74
|
const children = slots.default && slots.default();
|
|
71
75
|
const {
|
|
76
|
+
id,
|
|
72
77
|
variant,
|
|
73
78
|
title,
|
|
74
79
|
isShowSaturation,
|
|
@@ -79,28 +84,32 @@ var MpColorPicker = defineComponent({
|
|
|
79
84
|
return _createVNode("div", rootAttrs.value, [_createVNode(MpPopover, popoverAttrs.value, {
|
|
80
85
|
default: () => [_createVNode(MpPopoverTrigger, null, {
|
|
81
86
|
default: () => [children ? _createVNode("div", null, [children]) : _createVNode("div", popoverTriggerAttrs.value, [_createVNode("div", boxColorAttrs.value, null), variant === "advance" && _createVNode(MpText, {
|
|
82
|
-
"color": "gray.400",
|
|
83
|
-
"
|
|
87
|
+
"color": isNextTheme.value ? "text.disabled" : "gray.400",
|
|
88
|
+
"class": css({
|
|
89
|
+
marginTop: "1px"
|
|
90
|
+
})
|
|
84
91
|
}, {
|
|
85
92
|
default: () => [_createTextVNode("#")]
|
|
86
93
|
}), variant === "advance" && _createVNode(MpInput, inputTriggerAttrs.value, null), _createVNode(MpIcon, iconDropDownAttrs.value, null)])]
|
|
87
94
|
}), _createVNode(MpPopoverContent, popoverContentAttrs.value, {
|
|
88
95
|
default: () => [variant === "advance" && _createVNode("div", wrapperAdvanceAttrs.value, [isShowSaturation && _createVNode("div", wrapperSaturationAttrs.value, [_createVNode(MpColorSaturation, saturationAttrs.value, null)]), isShowHue && _createVNode("div", wrapperHueAttrs.value, [_createVNode(MpColorHue, hueAttrs.value, null)]), isShowInput && _createVNode("div", wrapperInputAttrs.value, [_createVNode(MpColorInput, inputHexAttrs.value, null), _createVNode(MpColorInput, inputRedAttrs.value, null), _createVNode(MpColorInput, inputGreenAttrs.value, null), _createVNode(MpColorInput, inputBlueAttrs.value, null)]), isShowPreset && _createVNode(MpDivider, {
|
|
89
|
-
"id":
|
|
96
|
+
"id": `${id}-divider`,
|
|
90
97
|
"class": css({
|
|
91
98
|
marginTop: "0",
|
|
92
99
|
marginBottom: "0"
|
|
93
100
|
})
|
|
94
101
|
}, null), isShowPreset && _createVNode("div", boxPresetAttrs.value, [_createVNode("div", wrapperPresetAttrs.value, [_createVNode(MpText, {
|
|
95
102
|
"size": "label-small",
|
|
96
|
-
"
|
|
103
|
+
"class": css({
|
|
104
|
+
width: "full"
|
|
105
|
+
})
|
|
97
106
|
}, {
|
|
98
107
|
default: () => [_createTextVNode("Present")]
|
|
99
108
|
}), props.preset.map((item) => {
|
|
100
109
|
return _createVNode(MpColorPreset, presetBoxAttrs(item), null);
|
|
101
110
|
})])])]), variant === "basic" && _createVNode("div", wrapperBasicAttrs.value, [_createVNode(MpText, {
|
|
102
111
|
"size": "body-small",
|
|
103
|
-
"color": "gray.600"
|
|
112
|
+
"color": isNextTheme.value ? "text.secondary" : "gray.600"
|
|
104
113
|
}, _isSlot(title) ? title : {
|
|
105
114
|
default: () => [title]
|
|
106
115
|
}), isShowPreset && _createVNode("div", wrapperBasicPresetAttrs.value, [props.preset.map((item) => {
|
package/dist/color-picker.d.mts
CHANGED
|
@@ -51,6 +51,10 @@ declare const MpColorPicker: vue.DefineComponent<{
|
|
|
51
51
|
type: vue.PropType<boolean>;
|
|
52
52
|
default: boolean;
|
|
53
53
|
};
|
|
54
|
+
isDisabled: {
|
|
55
|
+
type: vue.PropType<boolean>;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
54
58
|
isInvalid: {
|
|
55
59
|
type: vue.PropType<boolean>;
|
|
56
60
|
default: boolean;
|
|
@@ -104,6 +108,10 @@ declare const MpColorPicker: vue.DefineComponent<{
|
|
|
104
108
|
type: vue.PropType<boolean>;
|
|
105
109
|
default: boolean;
|
|
106
110
|
};
|
|
111
|
+
isDisabled: {
|
|
112
|
+
type: vue.PropType<boolean>;
|
|
113
|
+
default: boolean;
|
|
114
|
+
};
|
|
107
115
|
isInvalid: {
|
|
108
116
|
type: vue.PropType<boolean>;
|
|
109
117
|
default: boolean;
|
|
@@ -111,19 +119,20 @@ declare const MpColorPicker: vue.DefineComponent<{
|
|
|
111
119
|
}>> & {
|
|
112
120
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
113
121
|
}, {
|
|
114
|
-
value: string;
|
|
115
|
-
title: string;
|
|
116
122
|
id: string;
|
|
123
|
+
title: string;
|
|
124
|
+
value: string;
|
|
117
125
|
placeholder: string;
|
|
118
|
-
placement: Placement;
|
|
119
126
|
variant: "advance" | "basic";
|
|
120
|
-
|
|
127
|
+
placement: Placement;
|
|
121
128
|
preset: string[];
|
|
122
129
|
isShowPopover: boolean;
|
|
123
130
|
isShowSaturation: boolean;
|
|
124
131
|
isShowHue: boolean;
|
|
125
132
|
isShowInput: boolean;
|
|
126
133
|
isShowPreset: boolean;
|
|
134
|
+
isDisabled: boolean;
|
|
135
|
+
isInvalid: boolean;
|
|
127
136
|
}, {}>;
|
|
128
137
|
|
|
129
138
|
export { MpColorPicker };
|
package/dist/color-picker.d.ts
CHANGED
|
@@ -51,6 +51,10 @@ declare const MpColorPicker: vue.DefineComponent<{
|
|
|
51
51
|
type: vue.PropType<boolean>;
|
|
52
52
|
default: boolean;
|
|
53
53
|
};
|
|
54
|
+
isDisabled: {
|
|
55
|
+
type: vue.PropType<boolean>;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
54
58
|
isInvalid: {
|
|
55
59
|
type: vue.PropType<boolean>;
|
|
56
60
|
default: boolean;
|
|
@@ -104,6 +108,10 @@ declare const MpColorPicker: vue.DefineComponent<{
|
|
|
104
108
|
type: vue.PropType<boolean>;
|
|
105
109
|
default: boolean;
|
|
106
110
|
};
|
|
111
|
+
isDisabled: {
|
|
112
|
+
type: vue.PropType<boolean>;
|
|
113
|
+
default: boolean;
|
|
114
|
+
};
|
|
107
115
|
isInvalid: {
|
|
108
116
|
type: vue.PropType<boolean>;
|
|
109
117
|
default: boolean;
|
|
@@ -111,19 +119,20 @@ declare const MpColorPicker: vue.DefineComponent<{
|
|
|
111
119
|
}>> & {
|
|
112
120
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
113
121
|
}, {
|
|
114
|
-
value: string;
|
|
115
|
-
title: string;
|
|
116
122
|
id: string;
|
|
123
|
+
title: string;
|
|
124
|
+
value: string;
|
|
117
125
|
placeholder: string;
|
|
118
|
-
placement: Placement;
|
|
119
126
|
variant: "advance" | "basic";
|
|
120
|
-
|
|
127
|
+
placement: Placement;
|
|
121
128
|
preset: string[];
|
|
122
129
|
isShowPopover: boolean;
|
|
123
130
|
isShowSaturation: boolean;
|
|
124
131
|
isShowHue: boolean;
|
|
125
132
|
isShowInput: boolean;
|
|
126
133
|
isShowPreset: boolean;
|
|
134
|
+
isDisabled: boolean;
|
|
135
|
+
isInvalid: boolean;
|
|
127
136
|
}, {}>;
|
|
128
137
|
|
|
129
138
|
export { MpColorPicker };
|
package/dist/color-picker.js
CHANGED
|
@@ -41,7 +41,8 @@ var import_pixel3_popover = require("@mekari/pixel3-popover");
|
|
|
41
41
|
var import_pixel3_input2 = require("@mekari/pixel3-input");
|
|
42
42
|
var import_pixel3_icon2 = require("@mekari/pixel3-icon");
|
|
43
43
|
var import_pixel3_divider = require("@mekari/pixel3-divider");
|
|
44
|
-
var
|
|
44
|
+
var import_pixel3_utils3 = require("@mekari/pixel3-utils");
|
|
45
|
+
var import_css5 = require("@mekari/pixel3-styled-system/css");
|
|
45
46
|
|
|
46
47
|
// src/modules/color-picker.props.ts
|
|
47
48
|
var PRESET_DEFAULT = ["#3B82F6", "#14B8A6", "#8B5CF6", "#F59E0B", "#EF4444", "#71717A", "#84CC16", "#EC4899", "#232933", "#60A5FA", "#2DD4BF", "#A78BFA", "#FBBF24", "#F87171", "#A1A1AA", "#A3E635", "#F472B6", "#FFFFFF"];
|
|
@@ -68,7 +69,7 @@ var colorPickerProps = {
|
|
|
68
69
|
},
|
|
69
70
|
placement: {
|
|
70
71
|
type: String,
|
|
71
|
-
default: "bottom"
|
|
72
|
+
default: "bottom-start"
|
|
72
73
|
},
|
|
73
74
|
preset: {
|
|
74
75
|
type: Array,
|
|
@@ -96,6 +97,10 @@ var colorPickerProps = {
|
|
|
96
97
|
type: Boolean,
|
|
97
98
|
default: true
|
|
98
99
|
},
|
|
100
|
+
isDisabled: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: false
|
|
103
|
+
},
|
|
99
104
|
isInvalid: {
|
|
100
105
|
type: Boolean,
|
|
101
106
|
default: false
|
|
@@ -107,8 +112,6 @@ var import_vue = require("vue");
|
|
|
107
112
|
var import_tinycolor2 = __toESM(require("tinycolor2"));
|
|
108
113
|
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
109
114
|
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
110
|
-
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
111
|
-
var import_tokens = require("@mekari/pixel3-styled-system/tokens");
|
|
112
115
|
function useColorPicker(props, emit) {
|
|
113
116
|
const {
|
|
114
117
|
id,
|
|
@@ -117,6 +120,7 @@ function useColorPicker(props, emit) {
|
|
|
117
120
|
variant,
|
|
118
121
|
placement,
|
|
119
122
|
isShowPopover,
|
|
123
|
+
isDisabled,
|
|
120
124
|
isInvalid
|
|
121
125
|
} = (0, import_vue.toRefs)(props);
|
|
122
126
|
const val = (0, import_vue.ref)(_colorChange(value.value));
|
|
@@ -133,20 +137,7 @@ function useColorPicker(props, emit) {
|
|
|
133
137
|
}
|
|
134
138
|
});
|
|
135
139
|
const hex = (0, import_vue.computed)(() => {
|
|
136
|
-
|
|
137
|
-
return hex2.replace("#", "");
|
|
138
|
-
});
|
|
139
|
-
const borderColor = (0, import_vue.computed)(() => {
|
|
140
|
-
if (isInvalid.value) {
|
|
141
|
-
return "red.400";
|
|
142
|
-
}
|
|
143
|
-
if (!isInvalid.value && isFocused.value) {
|
|
144
|
-
return "blue.400";
|
|
145
|
-
}
|
|
146
|
-
return "gray.100";
|
|
147
|
-
});
|
|
148
|
-
const isFocused = (0, import_vue.computed)(() => {
|
|
149
|
-
return isPopoverOpen.value;
|
|
140
|
+
return colors.value.hex.replace("#", "");
|
|
150
141
|
});
|
|
151
142
|
const rootAttrs = (0, import_vue.computed)(() => {
|
|
152
143
|
return {
|
|
@@ -161,22 +152,18 @@ function useColorPicker(props, emit) {
|
|
|
161
152
|
placement: placement.value,
|
|
162
153
|
defaultIsOpen: isShowPopover.value,
|
|
163
154
|
initialFocusRef: `#input-${getId}`,
|
|
155
|
+
isManual: isDisabled.value,
|
|
156
|
+
// hack way to disabled Popover
|
|
164
157
|
onOpen: handleOpenPopover,
|
|
165
158
|
onClose: handleClosePopover
|
|
166
159
|
};
|
|
167
160
|
});
|
|
168
161
|
const popoverTriggerAttrs = (0, import_vue.computed)(() => {
|
|
169
162
|
return {
|
|
163
|
+
"data-invalid": isInvalid.value || void 0,
|
|
164
|
+
"data-disabled": isDisabled.value || void 0,
|
|
170
165
|
tabindex: "0",
|
|
171
|
-
class: (0,
|
|
172
|
-
boxShadow: isPopoverOpen.value && !isInvalid.value ? "outline" : "none",
|
|
173
|
-
_hover: {
|
|
174
|
-
borderColor: isPopoverOpen.value && !isInvalid.value ? "blue.500 !important" : "gray.400 !important"
|
|
175
|
-
}
|
|
176
|
-
}), (0, import_recipes.colorPickerSlotRecipe)().popoverTrigger),
|
|
177
|
-
style: {
|
|
178
|
-
borderColor: (0, import_tokens.token)(`colors.${borderColor.value}`)
|
|
179
|
-
}
|
|
166
|
+
class: (0, import_recipes.colorPickerSlotRecipe)().popoverTrigger
|
|
180
167
|
};
|
|
181
168
|
});
|
|
182
169
|
const boxColorAttrs = (0, import_vue.computed)(() => {
|
|
@@ -196,6 +183,8 @@ function useColorPicker(props, emit) {
|
|
|
196
183
|
maxlength: "6",
|
|
197
184
|
value: colorInput.value,
|
|
198
185
|
placeholder: placeholder.value,
|
|
186
|
+
isDisabled: isDisabled.value,
|
|
187
|
+
isInvalid: isInvalid.value,
|
|
199
188
|
class: (0, import_recipes.colorPickerSlotRecipe)().inputTrigger,
|
|
200
189
|
onInput: handleInputTrigger
|
|
201
190
|
};
|
|
@@ -393,6 +382,8 @@ function useColorPicker(props, emit) {
|
|
|
393
382
|
}
|
|
394
383
|
__name(handleInputTrigger, "handleInputTrigger");
|
|
395
384
|
function handleOpenPopover() {
|
|
385
|
+
if (isDisabled.value)
|
|
386
|
+
return;
|
|
396
387
|
isPopoverOpen.value = true;
|
|
397
388
|
colorInput.value = hex.value;
|
|
398
389
|
}
|
|
@@ -444,7 +435,7 @@ var import_vue2 = require("vue");
|
|
|
444
435
|
var import_vue3 = require("vue");
|
|
445
436
|
var import_clamp = __toESM(require("clamp"));
|
|
446
437
|
var import_lodash = __toESM(require("lodash.throttle"));
|
|
447
|
-
var
|
|
438
|
+
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
448
439
|
var MpColorSaturation = (0, import_vue3.defineComponent)({
|
|
449
440
|
name: "MpColorSaturation",
|
|
450
441
|
props: {
|
|
@@ -529,7 +520,7 @@ var MpColorSaturation = (0, import_vue3.defineComponent)({
|
|
|
529
520
|
"ref": containerNode,
|
|
530
521
|
"data-pixel-component": "MpColorPickerSaturation",
|
|
531
522
|
"id": "saturation-container",
|
|
532
|
-
"class": (0,
|
|
523
|
+
"class": (0, import_css.css)({
|
|
533
524
|
cursor: "pointer",
|
|
534
525
|
position: "absolute",
|
|
535
526
|
top: "0",
|
|
@@ -545,7 +536,7 @@ var MpColorSaturation = (0, import_vue3.defineComponent)({
|
|
|
545
536
|
"onTouchstart": handleChange
|
|
546
537
|
}, [(0, import_vue2.createVNode)("div", {
|
|
547
538
|
"id": "saturation-white",
|
|
548
|
-
"class": (0,
|
|
539
|
+
"class": (0, import_css.css)({
|
|
549
540
|
position: "absolute",
|
|
550
541
|
top: "0",
|
|
551
542
|
right: "0",
|
|
@@ -555,7 +546,7 @@ var MpColorSaturation = (0, import_vue3.defineComponent)({
|
|
|
555
546
|
})
|
|
556
547
|
}, null), (0, import_vue2.createVNode)("div", {
|
|
557
548
|
"id": "saturation-black",
|
|
558
|
-
"class": (0,
|
|
549
|
+
"class": (0, import_css.css)({
|
|
559
550
|
position: "absolute",
|
|
560
551
|
top: "0",
|
|
561
552
|
right: "0",
|
|
@@ -565,7 +556,7 @@ var MpColorSaturation = (0, import_vue3.defineComponent)({
|
|
|
565
556
|
})
|
|
566
557
|
}, null), (0, import_vue2.createVNode)("div", {
|
|
567
558
|
"id": "saturation-pointer",
|
|
568
|
-
"class": (0,
|
|
559
|
+
"class": (0, import_css.css)({
|
|
569
560
|
cursor: "pointer",
|
|
570
561
|
position: "absolute"
|
|
571
562
|
}),
|
|
@@ -575,7 +566,7 @@ var MpColorSaturation = (0, import_vue3.defineComponent)({
|
|
|
575
566
|
}
|
|
576
567
|
}, [(0, import_vue2.createVNode)("div", {
|
|
577
568
|
"id": "saturation-circle",
|
|
578
|
-
"class": (0,
|
|
569
|
+
"class": (0, import_css.css)({
|
|
579
570
|
cursor: "pointer",
|
|
580
571
|
width: "6px",
|
|
581
572
|
height: "6px",
|
|
@@ -591,7 +582,7 @@ var MpColorSaturation = (0, import_vue3.defineComponent)({
|
|
|
591
582
|
// src/hue.tsx
|
|
592
583
|
var import_vue4 = require("vue");
|
|
593
584
|
var import_vue5 = require("vue");
|
|
594
|
-
var
|
|
585
|
+
var import_css2 = require("@mekari/pixel3-styled-system/css");
|
|
595
586
|
var MpColorHue = (0, import_vue5.defineComponent)({
|
|
596
587
|
name: "MpColorHue",
|
|
597
588
|
props: {
|
|
@@ -725,7 +716,7 @@ var MpColorHue = (0, import_vue5.defineComponent)({
|
|
|
725
716
|
var _a;
|
|
726
717
|
return (0, import_vue4.createVNode)("div", {
|
|
727
718
|
"data-pixel-component": "MpColorPickerHue",
|
|
728
|
-
"class": (0,
|
|
719
|
+
"class": (0, import_css2.css)({
|
|
729
720
|
position: "absolute",
|
|
730
721
|
top: "0",
|
|
731
722
|
right: "0",
|
|
@@ -740,7 +731,7 @@ var MpColorHue = (0, import_vue5.defineComponent)({
|
|
|
740
731
|
"aria-valuenow": (_a = colors.value) == null ? void 0 : _a.hsl.h,
|
|
741
732
|
"aria-valuemin": "0",
|
|
742
733
|
"aria-valuemax": "360",
|
|
743
|
-
"class": (0,
|
|
734
|
+
"class": (0, import_css2.css)({
|
|
744
735
|
cursor: "pointer",
|
|
745
736
|
margin: "0 2px",
|
|
746
737
|
position: "relative",
|
|
@@ -752,7 +743,7 @@ var MpColorHue = (0, import_vue5.defineComponent)({
|
|
|
752
743
|
}, [(0, import_vue4.createVNode)("div", {
|
|
753
744
|
"id": "hue-pointer",
|
|
754
745
|
"role": "presentation",
|
|
755
|
-
"class": (0,
|
|
746
|
+
"class": (0, import_css2.css)({
|
|
756
747
|
position: "absolute",
|
|
757
748
|
zIndex: "2"
|
|
758
749
|
}),
|
|
@@ -762,7 +753,7 @@ var MpColorHue = (0, import_vue5.defineComponent)({
|
|
|
762
753
|
}
|
|
763
754
|
}, [(0, import_vue4.createVNode)("div", {
|
|
764
755
|
"id": "hue-picker",
|
|
765
|
-
"class": (0,
|
|
756
|
+
"class": (0, import_css2.css)({
|
|
766
757
|
cursor: "pointer",
|
|
767
758
|
marginTop: "-2px",
|
|
768
759
|
width: "32px",
|
|
@@ -782,7 +773,7 @@ var import_vue6 = require("vue");
|
|
|
782
773
|
var import_vue7 = require("vue");
|
|
783
774
|
var import_pixel3_text = require("@mekari/pixel3-text");
|
|
784
775
|
var import_pixel3_input = require("@mekari/pixel3-input");
|
|
785
|
-
var
|
|
776
|
+
var import_css3 = require("@mekari/pixel3-styled-system/css");
|
|
786
777
|
var MpColorInput = (0, import_vue7.defineComponent)({
|
|
787
778
|
name: "MpColorInput",
|
|
788
779
|
props: {
|
|
@@ -818,7 +809,6 @@ var MpColorInput = (0, import_vue7.defineComponent)({
|
|
|
818
809
|
}
|
|
819
810
|
});
|
|
820
811
|
function handleInput(e) {
|
|
821
|
-
console.log("asdad", e);
|
|
822
812
|
const target = e.target;
|
|
823
813
|
const value = target.value;
|
|
824
814
|
const data = {};
|
|
@@ -833,14 +823,14 @@ var MpColorInput = (0, import_vue7.defineComponent)({
|
|
|
833
823
|
return () => {
|
|
834
824
|
return (0, import_vue6.createVNode)("div", {
|
|
835
825
|
"data-pixel-component": "MpColorPickerInput",
|
|
836
|
-
"class": (0,
|
|
826
|
+
"class": (0, import_css3.css)({
|
|
837
827
|
display: "flex",
|
|
838
828
|
flexDirection: "column",
|
|
839
829
|
gap: "1"
|
|
840
830
|
})
|
|
841
831
|
}, [(0, import_vue6.createVNode)("div", null, [(0, import_vue6.createVNode)(import_pixel3_text.MpText, {
|
|
842
832
|
"size": "label-small",
|
|
843
|
-
"class": (0,
|
|
833
|
+
"class": (0, import_css3.css)({
|
|
844
834
|
textTransform: "capitalize"
|
|
845
835
|
})
|
|
846
836
|
}, {
|
|
@@ -865,7 +855,8 @@ var import_vue8 = require("vue");
|
|
|
865
855
|
var import_vue9 = require("vue");
|
|
866
856
|
var import_tinycolor22 = __toESM(require("tinycolor2"));
|
|
867
857
|
var import_pixel3_icon = require("@mekari/pixel3-icon");
|
|
868
|
-
var
|
|
858
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
859
|
+
var import_css4 = require("@mekari/pixel3-styled-system/css");
|
|
869
860
|
var MpColorPreset = (0, import_vue9.defineComponent)({
|
|
870
861
|
name: "MpColorPreset",
|
|
871
862
|
props: {
|
|
@@ -881,6 +872,9 @@ var MpColorPreset = (0, import_vue9.defineComponent)({
|
|
|
881
872
|
setup(props, {
|
|
882
873
|
emit
|
|
883
874
|
}) {
|
|
875
|
+
const {
|
|
876
|
+
isNextTheme
|
|
877
|
+
} = (0, import_pixel3_utils2.usePixelTheme)();
|
|
884
878
|
function handleClick() {
|
|
885
879
|
emit("click", props.value);
|
|
886
880
|
}
|
|
@@ -888,7 +882,7 @@ var MpColorPreset = (0, import_vue9.defineComponent)({
|
|
|
888
882
|
return () => {
|
|
889
883
|
return (0, import_vue8.createVNode)("div", {
|
|
890
884
|
"data-pixel-component": "MpColorPickerPreset",
|
|
891
|
-
"class": (0,
|
|
885
|
+
"class": (0, import_css4.css)({
|
|
892
886
|
display: "flex",
|
|
893
887
|
alignItems: "center",
|
|
894
888
|
justifyContent: "center",
|
|
@@ -896,7 +890,7 @@ var MpColorPreset = (0, import_vue9.defineComponent)({
|
|
|
896
890
|
width: "6",
|
|
897
891
|
height: "6",
|
|
898
892
|
borderWidth: "1px",
|
|
899
|
-
borderColor: "gray.50",
|
|
893
|
+
borderColor: isNextTheme.value ? "border.default" : "gray.50",
|
|
900
894
|
borderRadius: "sm",
|
|
901
895
|
cursor: "pointer"
|
|
902
896
|
}),
|
|
@@ -929,6 +923,9 @@ var MpColorPicker = (0, import_vue11.defineComponent)({
|
|
|
929
923
|
slots,
|
|
930
924
|
emit
|
|
931
925
|
}) {
|
|
926
|
+
const {
|
|
927
|
+
isNextTheme
|
|
928
|
+
} = (0, import_pixel3_utils3.usePixelTheme)();
|
|
932
929
|
const {
|
|
933
930
|
rootAttrs,
|
|
934
931
|
popoverAttrs,
|
|
@@ -957,6 +954,7 @@ var MpColorPicker = (0, import_vue11.defineComponent)({
|
|
|
957
954
|
return () => {
|
|
958
955
|
const children = slots.default && slots.default();
|
|
959
956
|
const {
|
|
957
|
+
id,
|
|
960
958
|
variant,
|
|
961
959
|
title,
|
|
962
960
|
isShowSaturation,
|
|
@@ -967,28 +965,32 @@ var MpColorPicker = (0, import_vue11.defineComponent)({
|
|
|
967
965
|
return (0, import_vue10.createVNode)("div", rootAttrs.value, [(0, import_vue10.createVNode)(import_pixel3_popover.MpPopover, popoverAttrs.value, {
|
|
968
966
|
default: () => [(0, import_vue10.createVNode)(import_pixel3_popover.MpPopoverTrigger, null, {
|
|
969
967
|
default: () => [children ? (0, import_vue10.createVNode)("div", null, [children]) : (0, import_vue10.createVNode)("div", popoverTriggerAttrs.value, [(0, import_vue10.createVNode)("div", boxColorAttrs.value, null), variant === "advance" && (0, import_vue10.createVNode)(import_pixel3_text2.MpText, {
|
|
970
|
-
"color": "gray.400",
|
|
971
|
-
"
|
|
968
|
+
"color": isNextTheme.value ? "text.disabled" : "gray.400",
|
|
969
|
+
"class": (0, import_css5.css)({
|
|
970
|
+
marginTop: "1px"
|
|
971
|
+
})
|
|
972
972
|
}, {
|
|
973
973
|
default: () => [(0, import_vue10.createTextVNode)("#")]
|
|
974
974
|
}), variant === "advance" && (0, import_vue10.createVNode)(import_pixel3_input2.MpInput, inputTriggerAttrs.value, null), (0, import_vue10.createVNode)(import_pixel3_icon2.MpIcon, iconDropDownAttrs.value, null)])]
|
|
975
975
|
}), (0, import_vue10.createVNode)(import_pixel3_popover.MpPopoverContent, popoverContentAttrs.value, {
|
|
976
976
|
default: () => [variant === "advance" && (0, import_vue10.createVNode)("div", wrapperAdvanceAttrs.value, [isShowSaturation && (0, import_vue10.createVNode)("div", wrapperSaturationAttrs.value, [(0, import_vue10.createVNode)(MpColorSaturation, saturationAttrs.value, null)]), isShowHue && (0, import_vue10.createVNode)("div", wrapperHueAttrs.value, [(0, import_vue10.createVNode)(MpColorHue, hueAttrs.value, null)]), isShowInput && (0, import_vue10.createVNode)("div", wrapperInputAttrs.value, [(0, import_vue10.createVNode)(MpColorInput, inputHexAttrs.value, null), (0, import_vue10.createVNode)(MpColorInput, inputRedAttrs.value, null), (0, import_vue10.createVNode)(MpColorInput, inputGreenAttrs.value, null), (0, import_vue10.createVNode)(MpColorInput, inputBlueAttrs.value, null)]), isShowPreset && (0, import_vue10.createVNode)(import_pixel3_divider.MpDivider, {
|
|
977
|
-
"id":
|
|
978
|
-
"class": (0,
|
|
977
|
+
"id": `${id}-divider`,
|
|
978
|
+
"class": (0, import_css5.css)({
|
|
979
979
|
marginTop: "0",
|
|
980
980
|
marginBottom: "0"
|
|
981
981
|
})
|
|
982
982
|
}, null), isShowPreset && (0, import_vue10.createVNode)("div", boxPresetAttrs.value, [(0, import_vue10.createVNode)("div", wrapperPresetAttrs.value, [(0, import_vue10.createVNode)(import_pixel3_text2.MpText, {
|
|
983
983
|
"size": "label-small",
|
|
984
|
-
"
|
|
984
|
+
"class": (0, import_css5.css)({
|
|
985
|
+
width: "full"
|
|
986
|
+
})
|
|
985
987
|
}, {
|
|
986
988
|
default: () => [(0, import_vue10.createTextVNode)("Present")]
|
|
987
989
|
}), props.preset.map((item) => {
|
|
988
990
|
return (0, import_vue10.createVNode)(MpColorPreset, presetBoxAttrs(item), null);
|
|
989
991
|
})])])]), variant === "basic" && (0, import_vue10.createVNode)("div", wrapperBasicAttrs.value, [(0, import_vue10.createVNode)(import_pixel3_text2.MpText, {
|
|
990
992
|
"size": "body-small",
|
|
991
|
-
"color": "gray.600"
|
|
993
|
+
"color": isNextTheme.value ? "text.secondary" : "gray.600"
|
|
992
994
|
}, _isSlot(title) ? title : {
|
|
993
995
|
default: () => [title]
|
|
994
996
|
}), isShowPreset && (0, import_vue10.createVNode)("div", wrapperBasicPresetAttrs.value, [props.preset.map((item) => {
|
package/dist/color-picker.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MpColorPicker
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WQTXZAWZ.mjs";
|
|
4
4
|
import "./chunk-PULVLME3.mjs";
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-MILYTHNM.mjs";
|
|
6
|
+
import "./chunk-5CI43L4Q.mjs";
|
|
7
7
|
import "./chunk-AEUPCATZ.mjs";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-5VPWEGKC.mjs";
|
|
9
|
+
import "./chunk-2ZZBAQKR.mjs";
|
|
10
10
|
import "./chunk-QZ7VFGWC.mjs";
|
|
11
11
|
export {
|
|
12
12
|
MpColorPicker
|