@itguy614/clean-ui 1.2.0 → 1.2.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/README.md +31 -1
- package/dist/components/CuiPopover.vue.d.ts.map +1 -1
- package/dist/components/CuiPopover.vue.js +63 -63
- package/dist/components/CuiTimePicker.vue.d.ts.map +1 -1
- package/dist/components/CuiTimePicker.vue.js +52 -49
- package/dist/composables/useTheme.d.ts.map +1 -1
- package/dist/composables/useTheme.js +25 -21
- package/dist/version.js +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ and overridable at every level via CSS custom properties.
|
|
|
17
17
|
- **Accessible first** — WCAG AA contrast targets, ARIA attributes, keyboard navigation, focus management.
|
|
18
18
|
- **TypeScript** — full type definitions; shared `CuiColor` / `CuiSize` / `CuiRounded` prop types across components.
|
|
19
19
|
- **Tailwind CSS v4 compatible** — color scales registered via `@theme` so Tailwind utilities work alongside the components.
|
|
20
|
-
- **Tree-shakeable ESM**
|
|
20
|
+
- **Tree-shakeable, per-module ESM** — Vue is the only peer dependency. (ESM-only as of 1.0.)
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
@@ -107,6 +107,36 @@ Every color, radius, and typography value is a `--cui-*` custom property. Overri
|
|
|
107
107
|
}
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
+
## Markdown editor
|
|
111
|
+
|
|
112
|
+
Need a markdown editor? The companion package
|
|
113
|
+
[**`@itguy614/clean-ui-editor`**](https://www.npmjs.com/package/@itguy614/clean-ui-editor)
|
|
114
|
+
is a CodeMirror 6 editor themed with clean-ui's tokens — WYSIWYG (hidden syntax markers) and
|
|
115
|
+
source modes, a declarative plugin API, and an optional safe HTML renderer. It has a heavier
|
|
116
|
+
dependency graph, so it ships as a separate, lazily-loadable package rather than in the core:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
npm install @itguy614/clean-ui-editor
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```vue
|
|
123
|
+
<script setup lang="ts">
|
|
124
|
+
import { ref, defineAsyncComponent } from "vue";
|
|
125
|
+
import "@itguy614/clean-ui-editor/styles";
|
|
126
|
+
|
|
127
|
+
const CuiMarkdownEditor = defineAsyncComponent(() =>
|
|
128
|
+
import("@itguy614/clean-ui-editor").then((m) => m.CuiMarkdownEditor),
|
|
129
|
+
);
|
|
130
|
+
const content = ref("# Hello");
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<template>
|
|
134
|
+
<CuiMarkdownEditor v-model="content" />
|
|
135
|
+
</template>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
See the [editor README](../clean-ui-editor/README.md) for modes, plugins, and rendering.
|
|
139
|
+
|
|
110
140
|
## Documentation
|
|
111
141
|
|
|
112
142
|
Full component reference, props, and live examples: **https://itguy614.github.io/clean-ui/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CuiPopover.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiPopover.vue"],"names":[],"mappings":"AAsRA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG9E,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGnF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,CAAC;AAEzE,MAAM,WAAW,eAAgB,SAAQ,aAAa,EAAE,gBAAgB;IACtE,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,mCAAmC;IACnC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,OAAO,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,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { usePopover as
|
|
3
|
-
import { useClickOutside as
|
|
1
|
+
import { defineComponent as U, useSlots as q, ref as S, watch as M, computed as l, onUnmounted as G, withDirectives as J, openBlock as a, createElementBlock as s, createElementVNode as p, renderSlot as f, createBlock as Q, Teleport as X, normalizeStyle as g, unref as v, toDisplayString as Y, withModifiers as Z, createVNode as ee, createCommentVNode as u, vShow as te } from "vue";
|
|
2
|
+
import { usePopover as oe } from "../composables/usePopover.js";
|
|
3
|
+
import { useClickOutside as ie } from "../composables/useClickOutside.js";
|
|
4
4
|
import re from "./CuiIcon.vue.js";
|
|
5
|
-
import { useMessages as
|
|
6
|
-
const
|
|
5
|
+
import { useMessages as le } from "../composables/useMessages.js";
|
|
6
|
+
const ae = ["aria-labelledby"], ne = {
|
|
7
7
|
key: 0,
|
|
8
8
|
style: {
|
|
9
9
|
display: "flex",
|
|
@@ -12,12 +12,12 @@ const le = ["aria-labelledby"], ae = {
|
|
|
12
12
|
gap: "calc(0.5rem * var(--cui-density-scale, 1))",
|
|
13
13
|
padding: "calc(0.75rem * var(--cui-density-scale, 1)) calc(0.875rem * var(--cui-density-scale, 1)) calc(0.25rem * var(--cui-density-scale, 1))"
|
|
14
14
|
}
|
|
15
|
-
},
|
|
15
|
+
}, se = ["id"], ce = ["aria-label"], ue = {
|
|
16
16
|
key: 1,
|
|
17
17
|
style: {
|
|
18
18
|
padding: "0 calc(0.875rem * var(--cui-density-scale, 1)) calc(0.75rem * var(--cui-density-scale, 1))"
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, ge = /* @__PURE__ */ U({
|
|
21
21
|
__name: "CuiPopover",
|
|
22
22
|
props: {
|
|
23
23
|
title: {},
|
|
@@ -42,68 +42,68 @@ const le = ["aria-labelledby"], ae = {
|
|
|
42
42
|
md: "var(--cui-button-radius, 0.375rem)",
|
|
43
43
|
lg: "0.5rem",
|
|
44
44
|
full: "9999px"
|
|
45
|
-
}, d = R, h =
|
|
46
|
-
let n = null,
|
|
45
|
+
}, d = R, h = q(), o = S(!1);
|
|
46
|
+
let n = null, i = null;
|
|
47
47
|
M(
|
|
48
48
|
() => e.visible,
|
|
49
49
|
(t) => {
|
|
50
50
|
t !== void 0 && (o.value = t);
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
const { referenceRef: C, floatingRef: b, arrowRef: E, floatingStyles: D, arrowStyle: B, currentSide: _ } =
|
|
53
|
+
const { referenceRef: C, floatingRef: b, arrowRef: E, floatingStyles: D, arrowStyle: B, currentSide: _, isPositioned: P } = oe({
|
|
54
54
|
placement: l(() => e.placement),
|
|
55
55
|
offsetDistance: l(() => e.offset ?? 10),
|
|
56
56
|
arrow: !e.noArrow
|
|
57
57
|
}), w = S(null);
|
|
58
|
-
|
|
58
|
+
ie(
|
|
59
59
|
() => [w.value, b.value],
|
|
60
60
|
() => {
|
|
61
|
-
o.value && e.trigger === "click" &&
|
|
61
|
+
o.value && e.trigger === "click" && r();
|
|
62
62
|
}
|
|
63
63
|
), M(o, (t) => {
|
|
64
|
-
typeof document > "u" || (t ? document.addEventListener("keydown",
|
|
64
|
+
typeof document > "u" || (t ? document.addEventListener("keydown", y) : document.removeEventListener("keydown", y));
|
|
65
65
|
});
|
|
66
|
-
function
|
|
67
|
-
e.disabled || (
|
|
66
|
+
function m() {
|
|
67
|
+
e.disabled || (i && (clearTimeout(i), i = null), e.showDelay > 0 ? n = setTimeout(() => {
|
|
68
68
|
o.value = !0, d("update:visible", !0);
|
|
69
69
|
}, e.showDelay) : (o.value = !0, d("update:visible", !0)));
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
n && (clearTimeout(n), n = null), e.hideDelay > 0 ?
|
|
71
|
+
function r() {
|
|
72
|
+
n && (clearTimeout(n), n = null), e.hideDelay > 0 ? i = setTimeout(() => {
|
|
73
73
|
o.value = !1, d("update:visible", !1);
|
|
74
74
|
}, e.hideDelay) : (o.value = !1, d("update:visible", !1));
|
|
75
75
|
}
|
|
76
76
|
function I() {
|
|
77
|
-
o.value ?
|
|
78
|
-
}
|
|
79
|
-
function P() {
|
|
80
|
-
(e.trigger === "hover" || e.trigger === "hover-focus") && v();
|
|
77
|
+
o.value ? r() : m();
|
|
81
78
|
}
|
|
82
79
|
function z() {
|
|
83
|
-
(e.trigger === "hover" || e.trigger === "hover-focus") &&
|
|
80
|
+
(e.trigger === "hover" || e.trigger === "hover-focus") && m();
|
|
84
81
|
}
|
|
85
82
|
function F() {
|
|
86
|
-
(e.trigger === "
|
|
83
|
+
(e.trigger === "hover" || e.trigger === "hover-focus") && r();
|
|
87
84
|
}
|
|
88
85
|
function L() {
|
|
89
|
-
(e.trigger === "focus" || e.trigger === "hover-focus") &&
|
|
86
|
+
(e.trigger === "focus" || e.trigger === "hover-focus") && m();
|
|
90
87
|
}
|
|
91
88
|
function V() {
|
|
92
|
-
e.trigger === "
|
|
93
|
-
}
|
|
94
|
-
function m(t) {
|
|
95
|
-
t.key === "Escape" && o.value && i();
|
|
89
|
+
(e.trigger === "focus" || e.trigger === "hover-focus") && r();
|
|
96
90
|
}
|
|
97
91
|
function $() {
|
|
98
|
-
|
|
92
|
+
e.trigger === "click" && I();
|
|
93
|
+
}
|
|
94
|
+
function y(t) {
|
|
95
|
+
t.key === "Escape" && o.value && r();
|
|
99
96
|
}
|
|
100
97
|
function A() {
|
|
101
|
-
(e.trigger === "hover" || e.trigger === "hover-focus") && i();
|
|
98
|
+
(e.trigger === "hover" || e.trigger === "hover-focus") && i && (clearTimeout(i), i = null);
|
|
99
|
+
}
|
|
100
|
+
function H() {
|
|
101
|
+
(e.trigger === "hover" || e.trigger === "hover-focus") && r();
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
n && clearTimeout(n),
|
|
103
|
+
G(() => {
|
|
104
|
+
n && clearTimeout(n), i && clearTimeout(i), typeof document < "u" && document.removeEventListener("keydown", y);
|
|
105
105
|
});
|
|
106
|
-
const k = l(() => e.title || h.header),
|
|
106
|
+
const k = l(() => e.title || h.header), N = l(() => !!h.footer), x = l(() => e.title ? "cui-popover-title" : void 0), W = l(() => {
|
|
107
107
|
const t = {
|
|
108
108
|
zIndex: "9998",
|
|
109
109
|
background: "var(--cui-surface-base)",
|
|
@@ -117,7 +117,7 @@ const le = ["aria-labelledby"], ae = {
|
|
|
117
117
|
overflow: "hidden"
|
|
118
118
|
};
|
|
119
119
|
return e.width && (t.width = e.width), t;
|
|
120
|
-
}),
|
|
120
|
+
}), j = l(() => ({
|
|
121
121
|
width: "8px",
|
|
122
122
|
height: "8px",
|
|
123
123
|
background: "var(--cui-surface-base)",
|
|
@@ -125,46 +125,46 @@ const le = ["aria-labelledby"], ae = {
|
|
|
125
125
|
transform: "rotate(45deg)",
|
|
126
126
|
position: "absolute",
|
|
127
127
|
...B.value
|
|
128
|
-
})),
|
|
128
|
+
})), O = {
|
|
129
129
|
top: "polygon(0% 0%, 100% 0%, 100% 100%)",
|
|
130
130
|
bottom: "polygon(0% 0%, 0% 100%, 100% 100%)",
|
|
131
131
|
left: "polygon(0% 0%, 100% 0%, 100% 100%)",
|
|
132
132
|
right: "polygon(0% 0%, 0% 100%, 100% 100%)"
|
|
133
|
-
},
|
|
134
|
-
return (t,
|
|
133
|
+
}, K = le();
|
|
134
|
+
return (t, de) => J((a(), s("div", {
|
|
135
135
|
ref_key: "wrapperRef",
|
|
136
136
|
ref: w,
|
|
137
137
|
style: { display: "inline-flex" },
|
|
138
|
-
onMouseenter:
|
|
139
|
-
onMouseleave:
|
|
140
|
-
onFocusin:
|
|
141
|
-
onFocusout:
|
|
142
|
-
onClick:
|
|
138
|
+
onMouseenter: z,
|
|
139
|
+
onMouseleave: F,
|
|
140
|
+
onFocusin: L,
|
|
141
|
+
onFocusout: V,
|
|
142
|
+
onClick: $
|
|
143
143
|
}, [
|
|
144
|
-
|
|
144
|
+
p("div", {
|
|
145
145
|
ref_key: "referenceRef",
|
|
146
146
|
ref: C,
|
|
147
147
|
style: { display: "inline-flex" }
|
|
148
148
|
}, [
|
|
149
149
|
f(t.$slots, "default")
|
|
150
150
|
], 512),
|
|
151
|
-
(a(),
|
|
151
|
+
(a(), Q(X, { to: "body" }, [
|
|
152
152
|
o.value ? (a(), s("div", {
|
|
153
153
|
key: 0,
|
|
154
154
|
ref_key: "floatingRef",
|
|
155
155
|
ref: b,
|
|
156
|
-
style:
|
|
156
|
+
style: g({ ...v(D), ...W.value, visibility: v(P) ? "visible" : "hidden" }),
|
|
157
157
|
role: "dialog",
|
|
158
158
|
"aria-labelledby": x.value,
|
|
159
|
-
onMouseenter:
|
|
160
|
-
onMouseleave:
|
|
159
|
+
onMouseenter: A,
|
|
160
|
+
onMouseleave: H
|
|
161
161
|
}, [
|
|
162
|
-
k.value ? (a(), s("div",
|
|
162
|
+
k.value ? (a(), s("div", ne, [
|
|
163
163
|
f(t.$slots, "header", {}, () => [
|
|
164
|
-
|
|
164
|
+
p("span", {
|
|
165
165
|
id: x.value,
|
|
166
166
|
style: { fontSize: "0.875rem", fontWeight: "600", color: "var(--cui-text-body)" }
|
|
167
|
-
},
|
|
167
|
+
}, Y(c.title), 9, se)
|
|
168
168
|
]),
|
|
169
169
|
c.closable ? (a(), s("button", {
|
|
170
170
|
key: 0,
|
|
@@ -184,17 +184,17 @@ const le = ["aria-labelledby"], ae = {
|
|
|
184
184
|
marginTop: "calc(-0.0625rem * var(--cui-density-scale, 1))",
|
|
185
185
|
marginRight: "calc(-0.125rem * var(--cui-density-scale, 1))"
|
|
186
186
|
},
|
|
187
|
-
"aria-label":
|
|
188
|
-
onClick:
|
|
187
|
+
"aria-label": v(K).close,
|
|
188
|
+
onClick: Z(r, ["stop"])
|
|
189
189
|
}, [
|
|
190
|
-
|
|
190
|
+
ee(re, {
|
|
191
191
|
name: "x",
|
|
192
192
|
size: "0.8125rem"
|
|
193
193
|
})
|
|
194
|
-
], 8,
|
|
194
|
+
], 8, ce)) : u("", !0)
|
|
195
195
|
])) : u("", !0),
|
|
196
|
-
|
|
197
|
-
style:
|
|
196
|
+
p("div", {
|
|
197
|
+
style: g({
|
|
198
198
|
padding: k.value ? "calc(0.25rem * var(--cui-density-scale, 1)) calc(0.875rem * var(--cui-density-scale, 1)) calc(0.75rem * var(--cui-density-scale, 1))" : "calc(0.75rem * var(--cui-density-scale, 1)) calc(0.875rem * var(--cui-density-scale, 1))",
|
|
199
199
|
fontSize: "0.875rem",
|
|
200
200
|
lineHeight: "1.55",
|
|
@@ -203,25 +203,25 @@ const le = ["aria-labelledby"], ae = {
|
|
|
203
203
|
}, [
|
|
204
204
|
f(t.$slots, "content")
|
|
205
205
|
], 4),
|
|
206
|
-
|
|
206
|
+
N.value ? (a(), s("div", ue, [
|
|
207
207
|
f(t.$slots, "footer")
|
|
208
208
|
])) : u("", !0),
|
|
209
209
|
c.noArrow ? u("", !0) : (a(), s("div", {
|
|
210
210
|
key: 2,
|
|
211
211
|
ref_key: "arrowRef",
|
|
212
212
|
ref: E,
|
|
213
|
-
style:
|
|
214
|
-
...
|
|
215
|
-
clipPath:
|
|
213
|
+
style: g({
|
|
214
|
+
...j.value,
|
|
215
|
+
clipPath: O[v(_)] || void 0
|
|
216
216
|
})
|
|
217
217
|
}, null, 4))
|
|
218
|
-
], 44,
|
|
218
|
+
], 44, ae)) : u("", !0)
|
|
219
219
|
]))
|
|
220
220
|
], 544)), [
|
|
221
|
-
[
|
|
221
|
+
[te, !c.hidden]
|
|
222
222
|
]);
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
export {
|
|
226
|
-
|
|
226
|
+
ge as default
|
|
227
227
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CuiTimePicker.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiTimePicker.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CuiTimePicker.vue.d.ts","sourceRoot":"","sources":["../../src/components/CuiTimePicker.vue"],"names":[],"mappings":"AAyRA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,kBAAmB,SAAQ,aAAa,EAAE,gBAAgB;IACzE,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW;IACX,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA8HD,iBAAS,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY,QAEjC;AAED,iBAAS,IAAI,SAEZ;;;;;;;;;;;UAvIQ,IAAI,GAAG,IAAI,GAAG,IAAI;;gBAZZ,MAAM;YAEV,gBAAgB;gBAEZ,MAAM;;AAoarB,wBASG"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as L, computed as u, ref as v, watch as V, onMounted as O, useTemplateRef as Z, withDirectives as j, openBlock as h, createElementBlock as S, toDisplayString as k, createCommentVNode as z, createVNode as s, withCtx as f, createElementVNode as p, normalizeStyle as x, createTextVNode as A, vShow as q } from "vue";
|
|
2
2
|
import F from "./CuiPopover.vue.js";
|
|
3
3
|
import C from "./CuiInputStepper.vue.js";
|
|
4
|
-
import
|
|
4
|
+
import P from "./CuiButton.vue.js";
|
|
5
5
|
import G from "./CuiIcon.vue.js";
|
|
6
|
-
|
|
6
|
+
import { INPUT_SIZE_SCALE as J } from "../utils/sizing.js";
|
|
7
|
+
const K = {
|
|
7
8
|
key: 0,
|
|
8
9
|
style: {
|
|
9
10
|
display: "block",
|
|
@@ -12,10 +13,10 @@ const J = {
|
|
|
12
13
|
fontWeight: "500",
|
|
13
14
|
color: "var(--cui-text-secondary)"
|
|
14
15
|
}
|
|
15
|
-
},
|
|
16
|
+
}, Q = { style: { display: "flex", alignItems: "center", gap: "calc(0.5rem * var(--cui-density-scale, 1))", padding: "calc(0.5rem * var(--cui-density-scale, 1))" } }, X = {
|
|
16
17
|
key: 0,
|
|
17
18
|
style: { display: "flex", flexDirection: "column", gap: "calc(0.125rem * var(--cui-density-scale, 1))", marginLeft: "calc(0.25rem * var(--cui-density-scale, 1))" }
|
|
18
|
-
},
|
|
19
|
+
}, ie = /* @__PURE__ */ L({
|
|
19
20
|
__name: "CuiTimePicker",
|
|
20
21
|
props: {
|
|
21
22
|
modelValue: { default: "" },
|
|
@@ -30,69 +31,69 @@ const J = {
|
|
|
30
31
|
disabled: { type: Boolean, default: !1 }
|
|
31
32
|
},
|
|
32
33
|
emits: ["update:modelValue"],
|
|
33
|
-
setup(
|
|
34
|
-
const a =
|
|
34
|
+
setup(i, { expose: w, emit: I }) {
|
|
35
|
+
const a = i, y = u(() => J[a.size]), T = I, l = v(12), o = v(0), r = v("AM"), g = v(!1);
|
|
35
36
|
function b(t) {
|
|
36
37
|
if (!t) return;
|
|
37
38
|
const e = t.match(/^(\d{1,2}):(\d{2})$/);
|
|
38
39
|
if (e) {
|
|
39
|
-
const
|
|
40
|
-
a.format === "12" ? (r.value =
|
|
40
|
+
const d = parseInt(e[1]), H = parseInt(e[2]);
|
|
41
|
+
a.format === "12" ? (r.value = d >= 12 ? "PM" : "AM", l.value = d === 0 ? 12 : d > 12 ? d - 12 : d) : l.value = d, o.value = H;
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
const n = t.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);
|
|
44
|
-
n && (
|
|
45
|
+
n && (l.value = parseInt(n[1]), o.value = parseInt(n[2]), r.value = n[3].toUpperCase());
|
|
45
46
|
}
|
|
46
|
-
V(() => a.modelValue, b),
|
|
47
|
-
function
|
|
48
|
-
return a.format === "24" ? `${String(
|
|
47
|
+
V(() => a.modelValue, b), O(() => b(a.modelValue));
|
|
48
|
+
function M() {
|
|
49
|
+
return a.format === "24" ? `${String(l.value).padStart(2, "0")}:${String(o.value).padStart(2, "0")}` : `${String(l.value).padStart(2, "0")}:${String(o.value).padStart(2, "0")} ${r.value}`;
|
|
49
50
|
}
|
|
50
51
|
function m() {
|
|
51
|
-
|
|
52
|
+
T("update:modelValue", M());
|
|
52
53
|
}
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const
|
|
54
|
+
const $ = u(() => a.modelValue ? M() : "");
|
|
55
|
+
u(() => a.format === "24" ? "##:##" : "##:## AA");
|
|
56
|
+
const E = u(
|
|
56
57
|
() => a.placeholder ?? (a.format === "24" ? "hh:mm" : "hh:mm AM")
|
|
57
58
|
);
|
|
58
|
-
|
|
59
|
-
const W =
|
|
60
|
-
function E(t) {
|
|
61
|
-
i.value = t, m();
|
|
62
|
-
}
|
|
59
|
+
u(() => a.modelValue ? a.format === "24" ? `${String(l.value).padStart(2, "0")}${String(o.value).padStart(2, "0")}` : `${String(l.value).padStart(2, "0")}${String(o.value).padStart(2, "0")}${r.value}` : "");
|
|
60
|
+
const W = u(() => a.format === "12" ? 1 : 0), B = u(() => a.format === "12" ? 12 : 23);
|
|
63
61
|
function N(t) {
|
|
62
|
+
l.value = t, m();
|
|
63
|
+
}
|
|
64
|
+
function U(t) {
|
|
64
65
|
o.value = t, m();
|
|
65
66
|
}
|
|
66
|
-
V(
|
|
67
|
+
V(g, (t) => {
|
|
67
68
|
t && b(a.modelValue);
|
|
68
69
|
});
|
|
69
|
-
const c =
|
|
70
|
-
function
|
|
70
|
+
const c = Z("rootEl");
|
|
71
|
+
function D(t) {
|
|
71
72
|
var e;
|
|
72
73
|
(e = c.value) == null || e.focus(t);
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
+
function R() {
|
|
75
76
|
var t;
|
|
76
77
|
(t = c.value) == null || t.blur();
|
|
77
78
|
}
|
|
78
|
-
return w({ el: c, focus:
|
|
79
|
+
return w({ el: c, focus: D, blur: R }), (t, e) => j((h(), S("div", {
|
|
79
80
|
ref_key: "rootEl",
|
|
80
81
|
ref: c
|
|
81
82
|
}, [
|
|
82
|
-
|
|
83
|
+
i.label ? (h(), S("label", K, k(i.label), 1)) : z("", !0),
|
|
83
84
|
s(F, {
|
|
84
|
-
visible:
|
|
85
|
-
"onUpdate:visible": e[2] || (e[2] = (n) =>
|
|
85
|
+
visible: g.value,
|
|
86
|
+
"onUpdate:visible": e[2] || (e[2] = (n) => g.value = n),
|
|
86
87
|
placement: "bottom",
|
|
87
88
|
closable: !1,
|
|
88
89
|
"no-arrow": "",
|
|
89
90
|
width: "auto",
|
|
90
|
-
disabled:
|
|
91
|
+
disabled: i.disabled
|
|
91
92
|
}, {
|
|
92
93
|
content: f(() => [
|
|
93
|
-
p("div",
|
|
94
|
+
p("div", Q, [
|
|
94
95
|
s(C, {
|
|
95
|
-
"model-value":
|
|
96
|
+
"model-value": l.value,
|
|
96
97
|
min: W.value,
|
|
97
98
|
max: B.value,
|
|
98
99
|
step: 1,
|
|
@@ -100,22 +101,22 @@ const J = {
|
|
|
100
101
|
size: "sm",
|
|
101
102
|
pad: 2,
|
|
102
103
|
wrap: "",
|
|
103
|
-
"onUpdate:modelValue":
|
|
104
|
+
"onUpdate:modelValue": N
|
|
104
105
|
}, null, 8, ["model-value", "min", "max"]),
|
|
105
106
|
e[5] || (e[5] = p("span", { style: { fontSize: "1.25rem", fontWeight: "700", color: "var(--cui-text-body)", lineHeight: "1" } }, ":", -1)),
|
|
106
107
|
s(C, {
|
|
107
108
|
"model-value": o.value,
|
|
108
109
|
min: 0,
|
|
109
110
|
max: 59,
|
|
110
|
-
step:
|
|
111
|
+
step: i.minuteStep,
|
|
111
112
|
orientation: "vertical",
|
|
112
113
|
size: "sm",
|
|
113
114
|
pad: 2,
|
|
114
115
|
wrap: "",
|
|
115
|
-
"onUpdate:modelValue":
|
|
116
|
+
"onUpdate:modelValue": U
|
|
116
117
|
}, null, 8, ["model-value", "step"]),
|
|
117
|
-
|
|
118
|
-
s(
|
|
118
|
+
i.format === "12" ? (h(), S("div", X, [
|
|
119
|
+
s(P, {
|
|
119
120
|
variant: "ghost",
|
|
120
121
|
size: "xs",
|
|
121
122
|
style: x({
|
|
@@ -134,7 +135,7 @@ const J = {
|
|
|
134
135
|
])]),
|
|
135
136
|
_: 1
|
|
136
137
|
}, 8, ["style"]),
|
|
137
|
-
s(
|
|
138
|
+
s(P, {
|
|
138
139
|
variant: "ghost",
|
|
139
140
|
size: "xs",
|
|
140
141
|
style: x({
|
|
@@ -153,24 +154,26 @@ const J = {
|
|
|
153
154
|
])]),
|
|
154
155
|
_: 1
|
|
155
156
|
}, 8, ["style"])
|
|
156
|
-
])) :
|
|
157
|
+
])) : z("", !0)
|
|
157
158
|
])
|
|
158
159
|
]),
|
|
159
160
|
default: f(() => [
|
|
160
161
|
p("div", {
|
|
162
|
+
class: "cui-time-picker__trigger",
|
|
161
163
|
style: x({
|
|
162
164
|
display: "inline-flex",
|
|
163
165
|
alignItems: "center",
|
|
164
166
|
gap: "calc(0.5rem * var(--cui-density-scale, 1))",
|
|
165
|
-
|
|
167
|
+
height: y.value.height,
|
|
168
|
+
padding: `0 ${y.value.px}`,
|
|
166
169
|
border: "1px solid var(--cui-border-strong, var(--cui-border))",
|
|
167
170
|
borderRadius: "var(--cui-button-radius, 0.375rem)",
|
|
168
171
|
background: "var(--cui-surface-base, white)",
|
|
169
|
-
cursor:
|
|
170
|
-
opacity:
|
|
171
|
-
fontSize:
|
|
172
|
-
color:
|
|
173
|
-
minWidth:
|
|
172
|
+
cursor: i.disabled ? "default" : "pointer",
|
|
173
|
+
opacity: i.disabled ? "0.5" : "1",
|
|
174
|
+
fontSize: y.value.fontSize,
|
|
175
|
+
color: $.value ? "var(--cui-text-body)" : "var(--cui-text-tertiary)",
|
|
176
|
+
minWidth: i.format === "24" ? "6rem" : "8rem"
|
|
174
177
|
})
|
|
175
178
|
}, [
|
|
176
179
|
s(G, {
|
|
@@ -178,16 +181,16 @@ const J = {
|
|
|
178
181
|
size: "0.875rem",
|
|
179
182
|
style: { color: "var(--cui-text-tertiary)", flexShrink: "0" }
|
|
180
183
|
}),
|
|
181
|
-
p("span", null,
|
|
184
|
+
p("span", null, k($.value || E.value), 1)
|
|
182
185
|
], 4)
|
|
183
186
|
]),
|
|
184
187
|
_: 1
|
|
185
188
|
}, 8, ["visible", "disabled"])
|
|
186
189
|
], 512)), [
|
|
187
|
-
[q, !
|
|
190
|
+
[q, !i.hidden]
|
|
188
191
|
]);
|
|
189
192
|
}
|
|
190
193
|
});
|
|
191
194
|
export {
|
|
192
|
-
|
|
195
|
+
ie as default
|
|
193
196
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/composables/useTheme.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,EAAE,WAAW,EAStC,CAAC;
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/composables/useTheme.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,EAAE,WAAW,EAStC,CAAC;AAuDF;;;GAGG;AACH,wBAAgB,QAAQ;IAYpB,kCAAkC;;IAElC,sCAAsC;;IAEtC,iCAAiC;wBAbR,MAAM;IAe/B,+BAA+B;oBAXZ,MAAM;EAc5B"}
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { safeGetItem as
|
|
3
|
-
const
|
|
4
|
-
{ id: "mono", label: "Mono", description: "Monochrome
|
|
5
|
-
{ id: "default", label: "Navy", description: "Navy blue" },
|
|
1
|
+
import { ref as u, watch as d } from "vue";
|
|
2
|
+
import { safeGetItem as n, safeSetItem as m } from "../utils/storage.js";
|
|
3
|
+
const a = [
|
|
4
|
+
{ id: "mono", label: "Mono", description: "Monochrome" },
|
|
5
|
+
{ id: "default", label: "Navy", description: "Navy blue (base scale)" },
|
|
6
6
|
{ id: "forest", label: "Forest", description: "Natural green" },
|
|
7
7
|
{ id: "amber", label: "Amber", description: "Warm orange with warm grays" },
|
|
8
8
|
{ id: "azure", label: "Azure", description: "Vibrant blue" },
|
|
9
9
|
{ id: "teal", label: "Teal", description: "Cool teal" },
|
|
10
10
|
{ id: "violet", label: "Violet", description: "Rich purple" },
|
|
11
11
|
{ id: "ruby", label: "Ruby", description: "Bold red" }
|
|
12
|
-
],
|
|
13
|
-
function
|
|
14
|
-
return
|
|
12
|
+
], i = "cui-theme", s = "cui-theme-", f = new Set(a.map((e) => `${s}${e.id}`));
|
|
13
|
+
function p() {
|
|
14
|
+
return n(i) ?? "default";
|
|
15
15
|
}
|
|
16
|
-
const o =
|
|
17
|
-
function
|
|
16
|
+
const o = u(p());
|
|
17
|
+
function c(e) {
|
|
18
18
|
if (typeof document > "u") return;
|
|
19
19
|
const t = document.documentElement;
|
|
20
|
-
for (const
|
|
21
|
-
|
|
22
|
-
e !== "default" && t.classList.add(`${
|
|
20
|
+
for (const r of Array.from(t.classList))
|
|
21
|
+
f.has(r) && t.classList.remove(r);
|
|
22
|
+
e !== "default" && t.classList.add(`${s}${e}`);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
l(e), u(a, e);
|
|
24
|
+
d(o, (e) => {
|
|
25
|
+
c(e), m(i, e);
|
|
27
26
|
});
|
|
27
|
+
let l = !1;
|
|
28
28
|
function b() {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
l || (l = !0, n(i) != null && c(o.value));
|
|
30
|
+
}
|
|
31
|
+
function E() {
|
|
32
|
+
b();
|
|
33
|
+
function e(r) {
|
|
34
|
+
o.value = r;
|
|
31
35
|
}
|
|
32
36
|
function t() {
|
|
33
37
|
return o.value;
|
|
@@ -36,7 +40,7 @@ function b() {
|
|
|
36
40
|
/** Current theme ID (reactive) */
|
|
37
41
|
theme: o,
|
|
38
42
|
/** List of available theme presets */
|
|
39
|
-
presets:
|
|
43
|
+
presets: a,
|
|
40
44
|
/** Set the active theme by ID */
|
|
41
45
|
setTheme: e,
|
|
42
46
|
/** Get the current theme ID */
|
|
@@ -44,6 +48,6 @@ function b() {
|
|
|
44
48
|
};
|
|
45
49
|
}
|
|
46
50
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
a as THEME_PRESETS,
|
|
52
|
+
E as useTheme
|
|
49
53
|
};
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itguy614/clean-ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
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",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"./dist/icons/lazy.js",
|
|
52
52
|
"./dist/duplicate-guard.js",
|
|
53
53
|
"./src/duplicate-guard.ts",
|
|
54
|
-
"./dist/composables/useTheme.js",
|
|
55
54
|
"./dist/composables/useDensity.js"
|
|
56
55
|
],
|
|
57
56
|
"scripts": {
|