@itguy614/clean-ui 1.0.0 → 1.0.1

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent as S, ref as _, computed as n, useTemplateRef as E, withDirectives as I, openBlock as i, createElementBlock as u, createElementVNode as m, normalizeStyle as M, normalizeClass as N, renderSlot as d, createCommentVNode as a, unref as v, createVNode as P, createBlock as h, toDisplayString as R, vShow as T } from "vue";
1
+ import { defineComponent as S, ref as _, computed as n, useTemplateRef as E, withDirectives as I, openBlock as u, createElementBlock as o, createElementVNode as m, normalizeStyle as M, normalizeClass as N, renderSlot as d, createCommentVNode as a, unref as v, createVNode as P, createBlock as h, toDisplayString as R, vShow as T } from "vue";
2
2
  import b from "./CuiIcon.vue.js";
3
3
  import { INPUT_SIZE_SCALE as D } from "../utils/sizing.js";
4
4
  import { useMessages as A } from "../composables/useMessages.js";
@@ -41,7 +41,9 @@ const L = { class: "cui-input-wrapper" }, U = {
41
41
  md: "var(--cui-button-radius, 0.375rem)",
42
42
  lg: "0.5rem",
43
43
  full: "9999px"
44
- }, o = t, c = g, l = _(!1), y = n(() => o.type === "password"), $ = n(() => y.value && l.value ? "text" : o.type), w = n(() => o.clearable && o.modelValue && !o.disabled && !o.readonly);
44
+ }, i = t, c = g, l = _(!1), y = n(() => i.type === "password"), $ = n(() => y.value && l.value ? "text" : i.type), w = n(
45
+ () => i.clearable && i.modelValue !== "" && i.modelValue != null && !i.disabled && !i.readonly
46
+ );
45
47
  function V() {
46
48
  var e;
47
49
  c("update:modelValue", ""), c("clear"), (e = r.value) == null || e.focus();
@@ -59,8 +61,8 @@ const L = { class: "cui-input-wrapper" }, U = {
59
61
  (e = r.value) == null || e.blur();
60
62
  }
61
63
  x({ el: r, focus: C, blur: B });
62
- const f = n(() => D[o.size]), p = A();
63
- return (e, s) => I((i(), u("div", L, [
64
+ const f = n(() => D[i.size]), p = A();
65
+ return (e, s) => I((u(), o("div", L, [
64
66
  m("div", {
65
67
  class: N(["cui-input", {
66
68
  "cui-input--error": t.error,
@@ -80,11 +82,11 @@ const L = { class: "cui-input-wrapper" }, U = {
80
82
  "--_input-focus-border": t.error ? "var(--cui-error)" : `var(--cui-${t.color})`
81
83
  })
82
84
  }, [
83
- e.$slots["prefix-button"] ? (i(), u("div", U, [
85
+ e.$slots["prefix-button"] ? (u(), o("div", U, [
84
86
  d(e.$slots, "prefix-button", {}, void 0, !0)
85
87
  ])) : a("", !0),
86
88
  m("div", Z, [
87
- e.$slots.prefix ? (i(), u("span", j, [
89
+ e.$slots.prefix ? (u(), o("span", j, [
88
90
  d(e.$slots, "prefix", {}, void 0, !0)
89
91
  ])) : a("", !0),
90
92
  m("input", {
@@ -98,7 +100,7 @@ const L = { class: "cui-input-wrapper" }, U = {
98
100
  class: "cui-input__native",
99
101
  onInput: z
100
102
  }, null, 40, q),
101
- w.value ? (i(), u("button", {
103
+ w.value ? (u(), o("button", {
102
104
  key: 1,
103
105
  type: "button",
104
106
  class: "cui-input__clear",
@@ -111,7 +113,7 @@ const L = { class: "cui-input-wrapper" }, U = {
111
113
  size: "0.75rem"
112
114
  })
113
115
  ], 8, F)) : a("", !0),
114
- y.value ? (i(), u("button", {
116
+ y.value ? (u(), o("button", {
115
117
  key: 2,
116
118
  type: "button",
117
119
  class: "cui-input__password-toggle",
@@ -119,25 +121,25 @@ const L = { class: "cui-input-wrapper" }, U = {
119
121
  "aria-label": l.value ? v(p).input.hidePassword : v(p).input.showPassword,
120
122
  onClick: s[0] || (s[0] = (O) => l.value = !l.value)
121
123
  }, [
122
- l.value ? (i(), h(b, {
124
+ l.value ? (u(), h(b, {
123
125
  key: 1,
124
126
  name: "eye-slash",
125
127
  size: "1rem"
126
- })) : (i(), h(b, {
128
+ })) : (u(), h(b, {
127
129
  key: 0,
128
130
  name: "eye",
129
131
  size: "1rem"
130
132
  }))
131
133
  ], 8, G)) : a("", !0),
132
- e.$slots.suffix ? (i(), u("span", H, [
134
+ e.$slots.suffix ? (u(), o("span", H, [
133
135
  d(e.$slots, "suffix", {}, void 0, !0)
134
136
  ])) : a("", !0)
135
137
  ]),
136
- e.$slots["suffix-button"] ? (i(), u("div", J, [
138
+ e.$slots["suffix-button"] ? (u(), o("div", J, [
137
139
  d(e.$slots, "suffix-button", {}, void 0, !0)
138
140
  ])) : a("", !0)
139
141
  ], 6),
140
- t.error && t.errorMessage ? (i(), u("div", K, R(t.errorMessage), 1)) : a("", !0)
142
+ t.error && t.errorMessage ? (u(), o("div", K, R(t.errorMessage), 1)) : a("", !0)
141
143
  ], 512)), [
142
144
  [T, !t.hidden]
143
145
  ]);
@@ -38,7 +38,7 @@ declare const __VLS_component: import("vue").DefineComponent<CuiMaskedInputProps
38
38
  $: import("vue").ComponentInternalInstance;
39
39
  $data: {};
40
40
  $props: {
41
- readonly modelValue?: string | undefined;
41
+ readonly modelValue?: string | number | undefined;
42
42
  readonly type?: import("./CuiInput.vue").InputType | undefined;
43
43
  readonly placeholder?: string | undefined;
44
44
  readonly clearable?: boolean | undefined;
@@ -51,7 +51,7 @@ declare const __VLS_component: import("vue").DefineComponent<CuiMaskedInputProps
51
51
  readonly size?: CuiSize | undefined;
52
52
  readonly disabled?: boolean | undefined;
53
53
  readonly onClear?: (() => any) | undefined;
54
- readonly "onUpdate:modelValue"?: ((value: string) => any) | undefined;
54
+ readonly "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
55
55
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
56
56
  $attrs: import("vue").Attrs;
57
57
  $refs: {
@@ -63,18 +63,18 @@ declare const __VLS_component: import("vue").DefineComponent<CuiMaskedInputProps
63
63
  $root: import("vue").ComponentPublicInstance | null;
64
64
  $parent: import("vue").ComponentPublicInstance | null;
65
65
  $host: Element | null;
66
- $emit: ((event: "clear") => void) & ((event: "update:modelValue", value: string) => void);
66
+ $emit: ((event: "clear") => void) & ((event: "update:modelValue", value: string | number) => void);
67
67
  $el: any;
68
68
  $options: import("vue").ComponentOptionsBase<Readonly<import("./CuiInput.vue").CuiInputProps> & Readonly<{
69
69
  onClear?: (() => any) | undefined;
70
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
70
+ "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
71
71
  }>, {
72
72
  el: Readonly<import("vue").ShallowRef<HTMLInputElement | null>>;
73
73
  focus: (opts?: FocusOptions) => void;
74
74
  blur: () => void;
75
75
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
76
76
  clear: () => any;
77
- "update:modelValue": (value: string) => any;
77
+ "update:modelValue": (value: string | number) => any;
78
78
  }, string, {
79
79
  error: boolean;
80
80
  readonly: boolean;
@@ -84,7 +84,7 @@ declare const __VLS_component: import("vue").DefineComponent<CuiMaskedInputProps
84
84
  type: import("./CuiInput.vue").InputType;
85
85
  rounded: import("../index.js").CuiRounded;
86
86
  disabled: boolean;
87
- modelValue: string;
87
+ modelValue: string | number;
88
88
  clearable: boolean;
89
89
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
90
90
  beforeCreate?: (() => void) | (() => void)[];
@@ -115,11 +115,11 @@ declare const __VLS_component: import("vue").DefineComponent<CuiMaskedInputProps
115
115
  type: import("./CuiInput.vue").InputType;
116
116
  rounded: import("../index.js").CuiRounded;
117
117
  disabled: boolean;
118
- modelValue: string;
118
+ modelValue: string | number;
119
119
  clearable: boolean;
120
120
  }> & Omit<Readonly<import("./CuiInput.vue").CuiInputProps> & Readonly<{
121
121
  onClear?: (() => any) | undefined;
122
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
122
+ "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
123
123
  }>, "el" | "focus" | "blur" | ("error" | "readonly" | "hidden" | "size" | "color" | "type" | "rounded" | "disabled" | "modelValue" | "clearable")> & {
124
124
  el: HTMLInputElement | null;
125
125
  focus: (opts?: FocusOptions) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"CuiTable.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiTable.vue"],"names":[],"mappings":"AAgPA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIpE,MAAM,WAAW,aAAc,SAAQ,aAAa,EAAE,aAAa;IACjE,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAuHD,QAAA,IAAI,OAAO,IAAU,EAAE,OAAO,IAAW,CAAE;AAC3C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AA4B/C,QAAA,MAAM,eAAe;;;;;aAzKT,OAAO;eAEL,OAAO;cAER,OAAO;kBAEH,OAAO;iBAER,OAAO;6EAyKrB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAa1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"CuiTable.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiTable.vue"],"names":[],"mappings":"AAyPA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIpE,MAAM,WAAW,aAAc,SAAQ,aAAa,EAAE,aAAa;IACjE,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAuHD,QAAA,IAAI,OAAO,IAAU,EAAE,OAAO,IAAW,CAAE;AAC3C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AA4B/C,QAAA,MAAM,eAAe;;;;;aAzKT,OAAO;eAEL,OAAO;cAER,OAAO;kBAEH,OAAO;iBAER,OAAO;6EAyKrB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAa1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useOverlay.d.ts","sourceRoot":"","sources":["../../src/composables/useOverlay.ts"],"names":[],"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AoC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,2BAA2B;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB;;;;;;;mBAuE7B,aAAa;EAyDpC"}
@@ -1,6 +1,6 @@
1
- import { ref as d, watch as x, onMounted as A, onUnmounted as E, nextTick as z } from "vue";
1
+ import { ref as d, watch as x, onMounted as A, onUnmounted as E, nextTick as q } from "vue";
2
2
  const t = /* @__PURE__ */ new Set();
3
- function D(m) {
3
+ function C(y) {
4
4
  const {
5
5
  open: v,
6
6
  dialogRef: l,
@@ -9,17 +9,19 @@ function D(m) {
9
9
  animationDuration: g = 200,
10
10
  onUpdateOpen: w,
11
11
  onClose: O
12
- } = m, s = Symbol("overlay"), i = d(!1), a = d(!1), y = d(null);
12
+ } = y, i = Symbol("overlay"), s = d(!1), a = d(!1), m = d(null);
13
13
  function u() {
14
- !b() && t.size > 0 && t.clear(), t.add(s), y.value = document.activeElement, i.value = !0, document.body.style.overflow = "hidden", z(() => {
15
- var e;
16
- a.value = !0, (e = l.value) == null || e.focus();
14
+ !b() && t.size > 0 && t.clear(), t.add(i), m.value = document.activeElement, s.value = !0, document.body.style.overflow = "hidden", q(() => {
15
+ requestAnimationFrame(() => {
16
+ var e;
17
+ a.value = !0, (e = l.value) == null || e.focus();
18
+ });
17
19
  });
18
20
  }
19
21
  function c() {
20
- a.value = !1, t.delete(s), setTimeout(() => {
22
+ a.value = !1, t.delete(i), setTimeout(() => {
21
23
  var e;
22
- i.value = !1, w(!1), O(), t.size === 0 && (document.body.style.overflow = ""), (e = y.value) == null || e.focus();
24
+ s.value = !1, w(!1), O(), t.size === 0 && (document.body.style.overflow = ""), (e = m.value) == null || e.focus();
23
25
  }, g);
24
26
  }
25
27
  function f() {
@@ -41,9 +43,9 @@ function D(m) {
41
43
  }), A(() => {
42
44
  v() && u();
43
45
  }), E(() => {
44
- t.delete(s), t.size === 0 && (document.body.style.overflow = "");
46
+ t.delete(i), t.size === 0 && (document.body.style.overflow = "");
45
47
  }), {
46
- isVisible: i,
48
+ isVisible: s,
47
49
  isAnimating: a,
48
50
  openOverlay: u,
49
51
  closeOverlay: c,
@@ -53,5 +55,5 @@ function D(m) {
53
55
  };
54
56
  }
55
57
  export {
56
- D as useOverlay
58
+ C as useOverlay
57
59
  };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Sanity-check the two most-confused props. `color` sets the semantic role;
3
+ * `variant` sets the structural style — passing a role name to `variant`
4
+ * (e.g. `variant="info"`) is the common mistake, so we detect it and point at
5
+ * the right prop. Only warns on invalid values; valid usage is silent.
6
+ *
7
+ * @param component Display name, e.g. "CuiBadge".
8
+ * @param variant The value passed to `variant` + that component's allowed set.
9
+ * @param color The value passed to `color` (validated against the roles).
10
+ */
11
+ export declare function warnVariantColor(component: string, variant: {
12
+ value: string | undefined;
13
+ allowed: readonly string[];
14
+ }, color: string | undefined): void;
15
+ //# sourceMappingURL=devWarn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devWarn.d.ts","sourceRoot":"","sources":["../../src/utils/devWarn.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAClE,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,IAAI,CAmBN"}
@@ -0,0 +1,20 @@
1
+ import { isColorRole as i } from "./color.js";
2
+ const s = "primary, secondary, success, error, warning, info, surface, surface-light, surface-dark", l = /* @__PURE__ */ new Set();
3
+ function c(o) {
4
+ l.has(o) || (l.add(o), console.warn(o));
5
+ }
6
+ function d(o, e, r) {
7
+ const n = e.value;
8
+ if (n != null && !e.allowed.includes(n)) {
9
+ const a = i(n) ? ` "${n}" is a color role — did you mean color="${n}"?` : "";
10
+ c(
11
+ `[clean-ui] ${o}: variant="${n}" is not valid. Expected one of: ${e.allowed.join(", ")}.${a}`
12
+ );
13
+ }
14
+ r != null && !i(r) && c(
15
+ `[clean-ui] ${o}: color="${r}" is not a valid role. Expected one of: ${s}.${r === "danger" ? ' Use color="error".' : ""}`
16
+ );
17
+ }
18
+ export {
19
+ d as warnVariantColor
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itguy614/clean-ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "description": "A clean, dark-mode-ready Vue 3 component library — 100+ token-driven, themeable, accessible components.",
6
6
  "license": "MIT",