@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.
@@ -38,8 +38,6 @@ var import_vue = require("vue");
38
38
  var import_tinycolor2 = __toESM(require("tinycolor2"));
39
39
  var import_pixel3_utils = require("@mekari/pixel3-utils");
40
40
  var import_recipes = require("@mekari/pixel3-styled-system/recipes");
41
- var import_css = require("@mekari/pixel3-styled-system/css");
42
- var import_tokens = require("@mekari/pixel3-styled-system/tokens");
43
41
  function useColorPicker(props, emit) {
44
42
  const {
45
43
  id,
@@ -48,6 +46,7 @@ function useColorPicker(props, emit) {
48
46
  variant,
49
47
  placement,
50
48
  isShowPopover,
49
+ isDisabled,
51
50
  isInvalid
52
51
  } = (0, import_vue.toRefs)(props);
53
52
  const val = (0, import_vue.ref)(_colorChange(value.value));
@@ -64,20 +63,7 @@ function useColorPicker(props, emit) {
64
63
  }
65
64
  });
66
65
  const hex = (0, import_vue.computed)(() => {
67
- const hex2 = colors.value.hex;
68
- return hex2.replace("#", "");
69
- });
70
- const borderColor = (0, import_vue.computed)(() => {
71
- if (isInvalid.value) {
72
- return "red.400";
73
- }
74
- if (!isInvalid.value && isFocused.value) {
75
- return "blue.400";
76
- }
77
- return "gray.100";
78
- });
79
- const isFocused = (0, import_vue.computed)(() => {
80
- return isPopoverOpen.value;
66
+ return colors.value.hex.replace("#", "");
81
67
  });
82
68
  const rootAttrs = (0, import_vue.computed)(() => {
83
69
  return {
@@ -92,22 +78,18 @@ function useColorPicker(props, emit) {
92
78
  placement: placement.value,
93
79
  defaultIsOpen: isShowPopover.value,
94
80
  initialFocusRef: `#input-${getId}`,
81
+ isManual: isDisabled.value,
82
+ // hack way to disabled Popover
95
83
  onOpen: handleOpenPopover,
96
84
  onClose: handleClosePopover
97
85
  };
98
86
  });
99
87
  const popoverTriggerAttrs = (0, import_vue.computed)(() => {
100
88
  return {
89
+ "data-invalid": isInvalid.value || void 0,
90
+ "data-disabled": isDisabled.value || void 0,
101
91
  tabindex: "0",
102
- class: (0, import_css.cx)((0, import_css.css)({
103
- boxShadow: isPopoverOpen.value && !isInvalid.value ? "outline" : "none",
104
- _hover: {
105
- borderColor: isPopoverOpen.value && !isInvalid.value ? "blue.500 !important" : "gray.400 !important"
106
- }
107
- }), (0, import_recipes.colorPickerSlotRecipe)().popoverTrigger),
108
- style: {
109
- borderColor: (0, import_tokens.token)(`colors.${borderColor.value}`)
110
- }
92
+ class: (0, import_recipes.colorPickerSlotRecipe)().popoverTrigger
111
93
  };
112
94
  });
113
95
  const boxColorAttrs = (0, import_vue.computed)(() => {
@@ -127,6 +109,8 @@ function useColorPicker(props, emit) {
127
109
  maxlength: "6",
128
110
  value: colorInput.value,
129
111
  placeholder: placeholder.value,
112
+ isDisabled: isDisabled.value,
113
+ isInvalid: isInvalid.value,
130
114
  class: (0, import_recipes.colorPickerSlotRecipe)().inputTrigger,
131
115
  onInput: handleInputTrigger
132
116
  };
@@ -324,6 +308,8 @@ function useColorPicker(props, emit) {
324
308
  }
325
309
  __name(handleInputTrigger, "handleInputTrigger");
326
310
  function handleOpenPopover() {
311
+ if (isDisabled.value)
312
+ return;
327
313
  isPopoverOpen.value = true;
328
314
  colorInput.value = hex.value;
329
315
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useColorPicker
3
- } from "../chunk-KHGAEPYZ.mjs";
3
+ } from "../chunk-5VPWEGKC.mjs";
4
4
  import "../chunk-QZ7VFGWC.mjs";
5
5
  export {
6
6
  useColorPicker
@@ -49,6 +49,10 @@ declare const colorPickerProps: {
49
49
  type: PropType<boolean>;
50
50
  default: boolean;
51
51
  };
52
+ isDisabled: {
53
+ type: PropType<boolean>;
54
+ default: boolean;
55
+ };
52
56
  isInvalid: {
53
57
  type: PropType<boolean>;
54
58
  default: boolean;
@@ -49,6 +49,10 @@ declare const colorPickerProps: {
49
49
  type: PropType<boolean>;
50
50
  default: boolean;
51
51
  };
52
+ isDisabled: {
53
+ type: PropType<boolean>;
54
+ default: boolean;
55
+ };
52
56
  isInvalid: {
53
57
  type: PropType<boolean>;
54
58
  default: boolean;
@@ -48,7 +48,7 @@ var colorPickerProps = {
48
48
  },
49
49
  placement: {
50
50
  type: String,
51
- default: "bottom"
51
+ default: "bottom-start"
52
52
  },
53
53
  preset: {
54
54
  type: Array,
@@ -76,6 +76,10 @@ var colorPickerProps = {
76
76
  type: Boolean,
77
77
  default: true
78
78
  },
79
+ isDisabled: {
80
+ type: Boolean,
81
+ default: false
82
+ },
79
83
  isInvalid: {
80
84
  type: Boolean,
81
85
  default: false
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  colorPickerEmit,
3
3
  colorPickerProps
4
- } from "../chunk-L5BRB7ES.mjs";
4
+ } from "../chunk-2ZZBAQKR.mjs";
5
5
  import "../chunk-QZ7VFGWC.mjs";
6
6
  export {
7
7
  colorPickerEmit,
package/dist/preset.js CHANGED
@@ -38,6 +38,7 @@ var import_vue = require("vue");
38
38
  var import_vue2 = require("vue");
39
39
  var import_tinycolor2 = __toESM(require("tinycolor2"));
40
40
  var import_pixel3_icon = require("@mekari/pixel3-icon");
41
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
41
42
  var import_css = require("@mekari/pixel3-styled-system/css");
42
43
  var MpColorPreset = (0, import_vue2.defineComponent)({
43
44
  name: "MpColorPreset",
@@ -54,6 +55,9 @@ var MpColorPreset = (0, import_vue2.defineComponent)({
54
55
  setup(props, {
55
56
  emit
56
57
  }) {
58
+ const {
59
+ isNextTheme
60
+ } = (0, import_pixel3_utils.usePixelTheme)();
57
61
  function handleClick() {
58
62
  emit("click", props.value);
59
63
  }
@@ -69,7 +73,7 @@ var MpColorPreset = (0, import_vue2.defineComponent)({
69
73
  width: "6",
70
74
  height: "6",
71
75
  borderWidth: "1px",
72
- borderColor: "gray.50",
76
+ borderColor: isNextTheme.value ? "border.default" : "gray.50",
73
77
  borderRadius: "sm",
74
78
  cursor: "pointer"
75
79
  }),
package/dist/preset.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MpColorPreset
3
- } from "./chunk-DVRBDVR4.mjs";
3
+ } from "./chunk-5CI43L4Q.mjs";
4
4
  import "./chunk-QZ7VFGWC.mjs";
5
5
  export {
6
6
  MpColorPreset
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mekari/pixel3-color-picker",
3
3
  "description": "Color picker component for mekari pixel 3",
4
- "version": "0.1.1",
4
+ "version": "0.1.2-dev.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "files": [
@@ -11,14 +11,14 @@
11
11
  "clamp": "^1.0.1",
12
12
  "lodash.throttle": "^4.0.0",
13
13
  "tinycolor2": "^1.1.2",
14
- "@mekari/pixel3-button": "0.0.16",
15
- "@mekari/pixel3-divider": "0.0.15",
16
- "@mekari/pixel3-input": "0.0.16",
17
- "@mekari/pixel3-popover": "0.0.16",
18
- "@mekari/pixel3-icon": "0.0.16",
19
- "@mekari/pixel3-text": "0.0.15",
20
- "@mekari/pixel3-utils": "0.0.6",
21
- "@mekari/pixel3-styled-system": "0.1.1"
14
+ "@mekari/pixel3-button": "0.0.17-dev.0",
15
+ "@mekari/pixel3-divider": "0.0.16-dev.0",
16
+ "@mekari/pixel3-icon": "0.0.17-dev.0",
17
+ "@mekari/pixel3-input": "0.0.17-dev.0",
18
+ "@mekari/pixel3-popover": "0.0.17-dev.0",
19
+ "@mekari/pixel3-styled-system": "0.1.2-dev.0",
20
+ "@mekari/pixel3-text": "0.0.16-dev.0",
21
+ "@mekari/pixel3-utils": "0.0.7-dev.0"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "vue": "^3.4.9"