@vacano/ui 1.12.1 → 1.13.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/README.md +6 -5
- package/dist/ToggleGroup-DCWH4ngK.cjs +1283 -0
- package/dist/ToggleGroup-DCWH4ngK.cjs.map +1 -0
- package/dist/ToggleGroup-DYePk1bM.js +3935 -0
- package/dist/ToggleGroup-DYePk1bM.js.map +1 -0
- package/dist/{X-BIgkmQPR.cjs → X-CI1qRJDP.cjs} +4 -4
- package/dist/X-CI1qRJDP.cjs.map +1 -0
- package/dist/{X-Dyq6IJZW.js → X-Cm-i8Bh7.js} +195 -219
- package/dist/X-Cm-i8Bh7.js.map +1 -0
- package/dist/form.cjs +2 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.ts +540 -0
- package/dist/form.js +428 -0
- package/dist/form.js.map +1 -0
- package/dist/icons.cjs +1 -1
- package/dist/icons.cjs.map +1 -1
- package/dist/icons.js +1253 -1230
- package/dist/icons.js.map +1 -1
- package/dist/index-Abn5L42P.js +42 -0
- package/dist/index-Abn5L42P.js.map +1 -0
- package/dist/index-GSZAZ6Cz.cjs +2 -0
- package/dist/index-GSZAZ6Cz.cjs.map +1 -0
- package/dist/index.cjs +235 -1393
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +126 -43
- package/dist/index.js +1324 -4875
- package/dist/index.js.map +1 -1
- package/dist/{media-CWK1OED-.js → keyboard-D00e_brg.js} +63 -66
- package/dist/keyboard-D00e_brg.js.map +1 -0
- package/dist/{media-BuwIclXE.cjs → keyboard-D8zOi0jU.cjs} +3 -3
- package/dist/keyboard-D8zOi0jU.cjs.map +1 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.ts +38 -0
- package/dist/lib.js +15 -13
- package/dist/lib.js.map +1 -1
- package/package.json +25 -3
- package/dist/X-BIgkmQPR.cjs.map +0 -1
- package/dist/X-Dyq6IJZW.js.map +0 -1
- package/dist/media-BuwIclXE.cjs.map +0 -1
- package/dist/media-CWK1OED-.js.map +0 -1
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { keyframes as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const c = new Set(t),
|
|
7
|
-
if (c.size !==
|
|
1
|
+
import { useRef as l, useEffect as p } from "react";
|
|
2
|
+
import { keyframes as r } from "@emotion/react";
|
|
3
|
+
const u = (t) => t.length === 1 && /[a-z]/i.test(t) ? t.toUpperCase() : t, v = (t, o) => {
|
|
4
|
+
const e = l(/* @__PURE__ */ new Set()), a = l(o);
|
|
5
|
+
a.current = o, p(() => {
|
|
6
|
+
const c = new Set(t), d = () => {
|
|
7
|
+
if (c.size !== e.current.size)
|
|
8
8
|
return !1;
|
|
9
|
-
for (const
|
|
10
|
-
if (!
|
|
9
|
+
for (const n of c)
|
|
10
|
+
if (!e.current.has(n))
|
|
11
11
|
return !1;
|
|
12
12
|
return !0;
|
|
13
|
-
},
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
13
|
+
}, f = (n) => {
|
|
14
|
+
const s = u(n.key);
|
|
15
|
+
e.current.add(s), d() && a.current && (n.preventDefault(), a.current());
|
|
16
|
+
}, i = (n) => {
|
|
17
|
+
const s = u(n.key);
|
|
18
|
+
e.current.delete(s);
|
|
19
|
+
}, m = () => {
|
|
20
|
+
e.current.clear();
|
|
21
21
|
};
|
|
22
|
-
return window.addEventListener("keydown",
|
|
23
|
-
window.removeEventListener("keydown",
|
|
22
|
+
return window.addEventListener("keydown", f), window.addEventListener("keyup", i), window.addEventListener("blur", m), () => {
|
|
23
|
+
window.removeEventListener("keydown", f), window.removeEventListener("keyup", i), window.removeEventListener("blur", m);
|
|
24
24
|
};
|
|
25
25
|
}, [t]);
|
|
26
|
-
},
|
|
27
|
-
const
|
|
28
|
-
return Math.round(
|
|
29
|
-
},
|
|
30
|
-
if (!
|
|
26
|
+
}, h = (t) => {
|
|
27
|
+
const o = Math.max(0, Math.min(100, t));
|
|
28
|
+
return Math.round(o / 100 * 255).toString(16).padStart(2, "0");
|
|
29
|
+
}, w = (t) => /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t), L = (t, o) => {
|
|
30
|
+
if (!w(t))
|
|
31
31
|
return "#000000FF";
|
|
32
|
-
const
|
|
33
|
-
return `#${
|
|
34
|
-
},
|
|
32
|
+
const e = t.replace("#", "").slice(0, 6), a = h(o);
|
|
33
|
+
return `#${e}${a}`;
|
|
34
|
+
}, y = () => {
|
|
35
35
|
if (typeof navigator > "u")
|
|
36
36
|
return "unknown";
|
|
37
37
|
const t = navigator.userAgent.toLowerCase();
|
|
@@ -41,13 +41,13 @@ const d = (t) => t.length === 1 && /[a-z]/i.test(t) ? t.toUpperCase() : t, x = (
|
|
|
41
41
|
return "unknown";
|
|
42
42
|
const t = navigator.userAgent.toLowerCase();
|
|
43
43
|
return /edg/.test(t) ? "edge" : /opr|opera/.test(t) ? "opera" : /chrome/.test(t) ? "chrome" : /safari/.test(t) ? "safari" : /firefox/.test(t) ? "firefox" : "unknown";
|
|
44
|
-
},
|
|
44
|
+
}, S = {
|
|
45
45
|
sm: 640,
|
|
46
46
|
md: 768,
|
|
47
47
|
lg: 1024,
|
|
48
48
|
xl: 1280,
|
|
49
49
|
"2xl": 1536
|
|
50
|
-
},
|
|
50
|
+
}, b = {
|
|
51
51
|
black: "#212529",
|
|
52
52
|
white: "#ffffff",
|
|
53
53
|
red: "#C1121F",
|
|
@@ -57,73 +57,73 @@ const d = (t) => t.length === 1 && /[a-z]/i.test(t) ? t.toUpperCase() : t, x = (
|
|
|
57
57
|
"steel-blue": "#0582ca",
|
|
58
58
|
"iron-grey": "#495057",
|
|
59
59
|
"baltic-blue": "#1e6091"
|
|
60
|
-
},
|
|
61
|
-
rotate:
|
|
60
|
+
}, I = {
|
|
61
|
+
rotate: r`
|
|
62
62
|
to {
|
|
63
63
|
transform: rotate(1turn);
|
|
64
64
|
}
|
|
65
65
|
`,
|
|
66
|
-
fadeIn:
|
|
66
|
+
fadeIn: r`
|
|
67
67
|
from { opacity: 0; }
|
|
68
68
|
to { opacity: 1; }
|
|
69
69
|
`,
|
|
70
|
-
fadeOut:
|
|
70
|
+
fadeOut: r`
|
|
71
71
|
from { opacity: 1; }
|
|
72
72
|
to { opacity: 0; }
|
|
73
73
|
`,
|
|
74
|
-
slideInLeft:
|
|
74
|
+
slideInLeft: r`
|
|
75
75
|
from { transform: translateX(-100%); }
|
|
76
76
|
to { transform: translateX(0); }
|
|
77
77
|
`,
|
|
78
|
-
slideOutLeft:
|
|
78
|
+
slideOutLeft: r`
|
|
79
79
|
from { transform: translateX(0); }
|
|
80
80
|
to { transform: translateX(-100%); }
|
|
81
81
|
`,
|
|
82
|
-
slideInRight:
|
|
82
|
+
slideInRight: r`
|
|
83
83
|
from { transform: translateX(100%); }
|
|
84
84
|
to { transform: translateX(0); }
|
|
85
85
|
`,
|
|
86
|
-
slideOutRight:
|
|
86
|
+
slideOutRight: r`
|
|
87
87
|
from { transform: translateX(0); }
|
|
88
88
|
to { transform: translateX(100%); }
|
|
89
89
|
`,
|
|
90
|
-
slideInTop:
|
|
90
|
+
slideInTop: r`
|
|
91
91
|
from { transform: translateY(-100%); }
|
|
92
92
|
to { transform: translateY(0); }
|
|
93
93
|
`,
|
|
94
|
-
slideOutTop:
|
|
94
|
+
slideOutTop: r`
|
|
95
95
|
from { transform: translateY(0); }
|
|
96
96
|
to { transform: translateY(-100%); }
|
|
97
97
|
`,
|
|
98
|
-
slideInBottom:
|
|
98
|
+
slideInBottom: r`
|
|
99
99
|
from { transform: translateY(100%); }
|
|
100
100
|
to { transform: translateY(0); }
|
|
101
101
|
`,
|
|
102
|
-
slideOutBottom:
|
|
102
|
+
slideOutBottom: r`
|
|
103
103
|
from { transform: translateY(0); }
|
|
104
104
|
to { transform: translateY(100%); }
|
|
105
105
|
`,
|
|
106
|
-
scaleIn:
|
|
106
|
+
scaleIn: r`
|
|
107
107
|
from { opacity: 0; transform: scale(0.95); }
|
|
108
108
|
to { opacity: 1; transform: scale(1); }
|
|
109
109
|
`,
|
|
110
|
-
slideInTopFade:
|
|
110
|
+
slideInTopFade: r`
|
|
111
111
|
from { opacity: 0; transform: translateY(-100%); }
|
|
112
112
|
to { opacity: 1; transform: translateY(0); }
|
|
113
113
|
`,
|
|
114
|
-
slideOutTopFade:
|
|
114
|
+
slideOutTopFade: r`
|
|
115
115
|
from { opacity: 1; transform: translateY(0); }
|
|
116
116
|
to { opacity: 0; transform: translateY(-100%); }
|
|
117
117
|
`,
|
|
118
|
-
slideInBottomFade:
|
|
118
|
+
slideInBottomFade: r`
|
|
119
119
|
from { opacity: 0; transform: translateY(100%); }
|
|
120
120
|
to { opacity: 1; transform: translateY(0); }
|
|
121
121
|
`,
|
|
122
|
-
slideOutBottomFade:
|
|
122
|
+
slideOutBottomFade: r`
|
|
123
123
|
from { opacity: 1; transform: translateY(0); }
|
|
124
124
|
to { opacity: 0; transform: translateY(100%); }
|
|
125
125
|
`
|
|
126
|
-
},
|
|
126
|
+
}, g = {
|
|
127
127
|
// Modifiers
|
|
128
128
|
Meta: { mac: "⌘", other: "Win" },
|
|
129
129
|
Control: { mac: "⌃", other: "Ctrl" },
|
|
@@ -150,29 +150,26 @@ const d = (t) => t.length === 1 && /[a-z]/i.test(t) ? t.toUpperCase() : t, x = (
|
|
|
150
150
|
// System
|
|
151
151
|
CapsLock: { mac: "⇪", other: "⇪" },
|
|
152
152
|
NumLock: { mac: "⇭", other: "⇭" }
|
|
153
|
-
},
|
|
153
|
+
}, O = (t) => {
|
|
154
154
|
if (!t)
|
|
155
155
|
return [];
|
|
156
|
-
const
|
|
157
|
-
return t.map((
|
|
158
|
-
const
|
|
159
|
-
return
|
|
156
|
+
const o = y();
|
|
157
|
+
return t.map((e) => {
|
|
158
|
+
const a = g[e];
|
|
159
|
+
return a ? o === "macos" ? a.mac : a.other : e;
|
|
160
160
|
});
|
|
161
|
-
}
|
|
161
|
+
};
|
|
162
162
|
export {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
S as B,
|
|
164
|
+
b as C,
|
|
165
|
+
I as K,
|
|
166
166
|
L as a,
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
y as b,
|
|
168
|
+
k as c,
|
|
169
169
|
g as d,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
I as m,
|
|
175
|
-
w as t,
|
|
176
|
-
x as u
|
|
170
|
+
O as g,
|
|
171
|
+
w as i,
|
|
172
|
+
h as t,
|
|
173
|
+
v as u
|
|
177
174
|
};
|
|
178
|
-
//# sourceMappingURL=
|
|
175
|
+
//# sourceMappingURL=keyboard-D00e_brg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard-D00e_brg.js","sources":["../src/lib/hooks/useKeyBinding.ts","../src/lib/utils/colors.ts","../src/lib/utils/platform.ts","../src/lib/constants.ts","../src/lib/utils/keyboard.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nimport { KeyboardEventKey } from '../types'\n\nconst normalizeKey = (key: string): string => {\n if (key.length === 1 && /[a-z]/i.test(key)) {\n return key.toUpperCase()\n }\n return key\n}\n\nexport const useKeyBinding = (keys: KeyboardEventKey[], cb?: () => void) => {\n const pressedKeys = useRef<Set<string>>(new Set())\n const cbRef = useRef(cb)\n\n cbRef.current = cb\n\n useEffect(() => {\n const keysSet = new Set(keys)\n\n const checkMatch = () => {\n if (keysSet.size !== pressedKeys.current.size) {\n return false\n }\n\n for (const key of keysSet) {\n if (!pressedKeys.current.has(key)) {\n return false\n }\n }\n\n return true\n }\n\n const handleKeyDown = (e: KeyboardEvent) => {\n const key = normalizeKey(e.key)\n pressedKeys.current.add(key)\n\n if (checkMatch() && cbRef.current) {\n e.preventDefault()\n cbRef.current()\n }\n }\n\n const handleKeyUp = (e: KeyboardEvent) => {\n const key = normalizeKey(e.key)\n pressedKeys.current.delete(key)\n }\n\n const handleBlur = () => {\n pressedKeys.current.clear()\n }\n\n window.addEventListener('keydown', handleKeyDown)\n window.addEventListener('keyup', handleKeyUp)\n window.addEventListener('blur', handleBlur)\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown)\n window.removeEventListener('keyup', handleKeyUp)\n window.removeEventListener('blur', handleBlur)\n }\n }, [keys])\n}\n","export const toHEX = (n: number): string => {\n const clamped = Math.max(0, Math.min(100, n))\n const value = Math.round((clamped / 100) * 255)\n\n return value.toString(16).padStart(2, '0')\n}\n\nexport const isValid = (hexColor: string): boolean => {\n return /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(hexColor)\n}\n\nexport const alpha = (hexColor: string, percentage: number): string => {\n if (!isValid(hexColor)) {\n return '#000000FF'\n }\n\n const hex = hexColor.replace('#', '').slice(0, 6)\n const alphaHex = toHEX(percentage)\n\n return `#${hex}${alphaHex}`\n}\n","import { Browser, OperatingSystem } from '../types'\n\nexport const getOperatingSystem = (): OperatingSystem => {\n if (typeof navigator === 'undefined') {\n return 'unknown'\n }\n\n const ua = navigator.userAgent.toLowerCase()\n\n if (/iphone|ipad|ipod/.test(ua)) return 'ios'\n if (/android/.test(ua)) return 'android'\n if (/mac/.test(ua)) return 'macos'\n if (/win/.test(ua)) return 'windows'\n if (/linux/.test(ua)) return 'linux'\n\n return 'unknown'\n}\n\nexport const getBrowser = (): Browser => {\n if (typeof navigator === 'undefined') {\n return 'unknown'\n }\n\n const ua = navigator.userAgent.toLowerCase()\n\n if (/edg/.test(ua)) return 'edge'\n if (/opr|opera/.test(ua)) return 'opera'\n if (/chrome/.test(ua)) return 'chrome'\n if (/safari/.test(ua)) return 'safari'\n if (/firefox/.test(ua)) return 'firefox'\n\n return 'unknown'\n}\n","import { keyframes } from '@emotion/react'\n\nimport { KeyboardEventKey } from './types'\n\nexport const BREAKPOINTS = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n} as const\n\nexport const COLORS = {\n black: '#212529',\n white: '#ffffff',\n red: '#C1121F',\n green: '#16a34a',\n yellow: '#ffb703',\n gray: '#e5e7eb',\n 'steel-blue': '#0582ca',\n 'iron-grey': '#495057',\n 'baltic-blue': '#1e6091',\n} as const\n\nexport const KEYFRAMES = {\n rotate: keyframes`\n to {\n transform: rotate(1turn);\n }\n `,\n fadeIn: keyframes`\n from { opacity: 0; }\n to { opacity: 1; }\n `,\n fadeOut: keyframes`\n from { opacity: 1; }\n to { opacity: 0; }\n `,\n slideInLeft: keyframes`\n from { transform: translateX(-100%); }\n to { transform: translateX(0); }\n `,\n slideOutLeft: keyframes`\n from { transform: translateX(0); }\n to { transform: translateX(-100%); }\n `,\n slideInRight: keyframes`\n from { transform: translateX(100%); }\n to { transform: translateX(0); }\n `,\n slideOutRight: keyframes`\n from { transform: translateX(0); }\n to { transform: translateX(100%); }\n `,\n slideInTop: keyframes`\n from { transform: translateY(-100%); }\n to { transform: translateY(0); }\n `,\n slideOutTop: keyframes`\n from { transform: translateY(0); }\n to { transform: translateY(-100%); }\n `,\n slideInBottom: keyframes`\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n `,\n slideOutBottom: keyframes`\n from { transform: translateY(0); }\n to { transform: translateY(100%); }\n `,\n scaleIn: keyframes`\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n `,\n slideInTopFade: keyframes`\n from { opacity: 0; transform: translateY(-100%); }\n to { opacity: 1; transform: translateY(0); }\n `,\n slideOutTopFade: keyframes`\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(-100%); }\n `,\n slideInBottomFade: keyframes`\n from { opacity: 0; transform: translateY(100%); }\n to { opacity: 1; transform: translateY(0); }\n `,\n slideOutBottomFade: keyframes`\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(100%); }\n `,\n}\n\nexport const KEY_SYMBOLS: Partial<Record<KeyboardEventKey, { mac: string; other: string }>> = {\n // Modifiers\n Meta: { mac: '⌘', other: 'Win' },\n Control: { mac: '⌃', other: 'Ctrl' },\n Alt: { mac: '⌥', other: 'Alt' },\n Shift: { mac: '⇧', other: '⇧' },\n\n // Navigation\n ArrowUp: { mac: '↑', other: '↑' },\n ArrowDown: { mac: '↓', other: '↓' },\n ArrowLeft: { mac: '←', other: '←' },\n ArrowRight: { mac: '→', other: '→' },\n Home: { mac: '↖', other: '↖' },\n End: { mac: '↘', other: '↘' },\n PageUp: { mac: '⇞', other: '⇞' },\n PageDown: { mac: '⇟', other: '⇟' },\n\n // Whitespace & Enter\n ' ': { mac: '␣', other: '␣' },\n Enter: { mac: 'Enter', other: 'Enter' },\n Tab: { mac: '⇥', other: '⇥' },\n\n // Editing\n Backspace: { mac: '⌫', other: '⌫' },\n Delete: { mac: '⌦', other: '⌦' },\n Escape: { mac: 'Esc', other: 'Esc' },\n Insert: { mac: 'Ins', other: 'Ins' },\n\n // System\n CapsLock: { mac: '⇪', other: '⇪' },\n NumLock: { mac: '⇭', other: '⇭' },\n}\n","import { getOperatingSystem } from './platform'\nimport { KEY_SYMBOLS } from '../constants'\nimport { KeyboardEventKey } from '../types'\n\nexport const getKeySymbols = (keys?: KeyboardEventKey[]): string[] => {\n if (!keys) {\n return []\n }\n\n const os = getOperatingSystem()\n\n return keys.map((key) => {\n const symbol = KEY_SYMBOLS[key]\n\n if (!symbol) {\n return key\n }\n\n return os === 'macos' ? symbol.mac : symbol.other\n })\n}\n"],"names":["normalizeKey","key","useKeyBinding","keys","cb","pressedKeys","useRef","cbRef","useEffect","keysSet","checkMatch","handleKeyDown","e","handleKeyUp","handleBlur","toHEX","n","clamped","isValid","hexColor","alpha","percentage","hex","alphaHex","getOperatingSystem","ua","getBrowser","BREAKPOINTS","COLORS","KEYFRAMES","keyframes","KEY_SYMBOLS","getKeySymbols","os","symbol"],"mappings":";;AAIA,MAA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IAAA;AAAA,EACxB,OAAO,EAAE,KAAK,SAAS,OAAO,QAAA;AAAA,EAC9B,KAAK,EAAE,KAAK,KAAK,OAAO,IAAA;AAAA;AAAA,EAGxB,WAAW,EAAE,KAAK,KAAK,OAAO,IAAA;AAAA,EAC9B,QAAQ,EAAE,KAAK,KAAK,OAAO,IAAA;AAAA,EAC3B,QAAQ,EAAE,KAAK,OAAO,OAAO,MAAA;AAAA,EAC7B,QAAQ,EAAE,KAAK,OAAO,OAAO,MAAA;AAAA;AAAA,EAG7B,UAAU,EAAE,KAAK,KAAK,OAAO,IAAA;AAAA,EAC7B,SAAS,EAAE,KAAK,KAAK,OAAO,IAAA;AAC9B,GCvHaC,IAAgB,CAAC7B,MAAwC;AACpE,MAAI,CAACA;AACH,WAAO,CAAA;AAGT,QAAM8B,IAAKT,EAAA;AAEX,SAAOrB,EAAK,IAAI,CAACF,MAAQ;AACvB,UAAMiC,IAASH,EAAY9B,CAAG;AAE9B,WAAKiC,IAIED,MAAO,UAAUC,EAAO,MAAMA,EAAO,QAHnCjC;AAAA,EAIX,CAAC;AACH;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const f=require("react"),e=require("@emotion/react"),u=t=>t.length===1&&/[a-z]/i.test(t)?t.toUpperCase():t,g=(t,n)=>{const r=f.useRef(new Set),a=f.useRef(n);a.current=n,f.useEffect(()=>{const i=new Set(t),w=()=>{if(i.size!==r.current.size)return!1;for(const o of i)if(!r.current.has(o))return!1;return!0},m=o=>{const s=u(o.key);r.current.add(s),w()&&a.current&&(o.preventDefault(),a.current())},c=o=>{const s=u(o.key);r.current.delete(s)},l=()=>{r.current.clear()};return window.addEventListener("keydown",m),window.addEventListener("keyup",c),window.addEventListener("blur",l),()=>{window.removeEventListener("keydown",m),window.removeEventListener("keyup",c),window.removeEventListener("blur",l)}},[t])},d=t=>{const n=Math.max(0,Math.min(100,t));return Math.round(n/100*255).toString(16).padStart(2,"0")},y=t=>/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t),k=(t,n)=>{if(!y(t))return"#000000FF";const r=t.replace("#","").slice(0,6),a=d(n);return`#${r}${a}`},p=()=>{if(typeof navigator>"u")return"unknown";const t=navigator.userAgent.toLowerCase();return/iphone|ipad|ipod/.test(t)?"ios":/android/.test(t)?"android":/mac/.test(t)?"macos":/win/.test(t)?"windows":/linux/.test(t)?"linux":"unknown"},E=()=>{if(typeof navigator>"u")return"unknown";const t=navigator.userAgent.toLowerCase();return/edg/.test(t)?"edge":/opr|opera/.test(t)?"opera":/chrome/.test(t)?"chrome":/safari/.test(t)?"safari":/firefox/.test(t)?"firefox":"unknown"},Y={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},S={black:"#212529",white:"#ffffff",red:"#C1121F",green:"#16a34a",yellow:"#ffb703",gray:"#e5e7eb","steel-blue":"#0582ca","iron-grey":"#495057","baltic-blue":"#1e6091"},L={rotate:e.keyframes`
|
|
2
2
|
to {
|
|
3
3
|
transform: rotate(1turn);
|
|
4
4
|
}
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
`,slideOutBottomFade:e.keyframes`
|
|
48
48
|
from { opacity: 1; transform: translateY(0); }
|
|
49
49
|
to { opacity: 0; transform: translateY(100%); }
|
|
50
|
-
`},
|
|
51
|
-
//# sourceMappingURL=
|
|
50
|
+
`},h={Meta:{mac:"⌘",other:"Win"},Control:{mac:"⌃",other:"Ctrl"},Alt:{mac:"⌥",other:"Alt"},Shift:{mac:"⇧",other:"⇧"},ArrowUp:{mac:"↑",other:"↑"},ArrowDown:{mac:"↓",other:"↓"},ArrowLeft:{mac:"←",other:"←"},ArrowRight:{mac:"→",other:"→"},Home:{mac:"↖",other:"↖"},End:{mac:"↘",other:"↘"},PageUp:{mac:"⇞",other:"⇞"},PageDown:{mac:"⇟",other:"⇟"}," ":{mac:"␣",other:"␣"},Enter:{mac:"Enter",other:"Enter"},Tab:{mac:"⇥",other:"⇥"},Backspace:{mac:"⌫",other:"⌫"},Delete:{mac:"⌦",other:"⌦"},Escape:{mac:"Esc",other:"Esc"},Insert:{mac:"Ins",other:"Ins"},CapsLock:{mac:"⇪",other:"⇪"},NumLock:{mac:"⇭",other:"⇭"}},O=t=>{if(!t)return[];const n=p();return t.map(r=>{const a=h[r];return a?n==="macos"?a.mac:a.other:r})};exports.BREAKPOINTS=Y;exports.COLORS=S;exports.KEYFRAMES=L;exports.KEY_SYMBOLS=h;exports.alpha=k;exports.getBrowser=E;exports.getKeySymbols=O;exports.getOperatingSystem=p;exports.isValid=y;exports.toHEX=d;exports.useKeyBinding=g;
|
|
51
|
+
//# sourceMappingURL=keyboard-D8zOi0jU.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard-D8zOi0jU.cjs","sources":["../src/lib/hooks/useKeyBinding.ts","../src/lib/utils/colors.ts","../src/lib/utils/platform.ts","../src/lib/constants.ts","../src/lib/utils/keyboard.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nimport { KeyboardEventKey } from '../types'\n\nconst normalizeKey = (key: string): string => {\n if (key.length === 1 && /[a-z]/i.test(key)) {\n return key.toUpperCase()\n }\n return key\n}\n\nexport const useKeyBinding = (keys: KeyboardEventKey[], cb?: () => void) => {\n const pressedKeys = useRef<Set<string>>(new Set())\n const cbRef = useRef(cb)\n\n cbRef.current = cb\n\n useEffect(() => {\n const keysSet = new Set(keys)\n\n const checkMatch = () => {\n if (keysSet.size !== pressedKeys.current.size) {\n return false\n }\n\n for (const key of keysSet) {\n if (!pressedKeys.current.has(key)) {\n return false\n }\n }\n\n return true\n }\n\n const handleKeyDown = (e: KeyboardEvent) => {\n const key = normalizeKey(e.key)\n pressedKeys.current.add(key)\n\n if (checkMatch() && cbRef.current) {\n e.preventDefault()\n cbRef.current()\n }\n }\n\n const handleKeyUp = (e: KeyboardEvent) => {\n const key = normalizeKey(e.key)\n pressedKeys.current.delete(key)\n }\n\n const handleBlur = () => {\n pressedKeys.current.clear()\n }\n\n window.addEventListener('keydown', handleKeyDown)\n window.addEventListener('keyup', handleKeyUp)\n window.addEventListener('blur', handleBlur)\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown)\n window.removeEventListener('keyup', handleKeyUp)\n window.removeEventListener('blur', handleBlur)\n }\n }, [keys])\n}\n","export const toHEX = (n: number): string => {\n const clamped = Math.max(0, Math.min(100, n))\n const value = Math.round((clamped / 100) * 255)\n\n return value.toString(16).padStart(2, '0')\n}\n\nexport const isValid = (hexColor: string): boolean => {\n return /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(hexColor)\n}\n\nexport const alpha = (hexColor: string, percentage: number): string => {\n if (!isValid(hexColor)) {\n return '#000000FF'\n }\n\n const hex = hexColor.replace('#', '').slice(0, 6)\n const alphaHex = toHEX(percentage)\n\n return `#${hex}${alphaHex}`\n}\n","import { Browser, OperatingSystem } from '../types'\n\nexport const getOperatingSystem = (): OperatingSystem => {\n if (typeof navigator === 'undefined') {\n return 'unknown'\n }\n\n const ua = navigator.userAgent.toLowerCase()\n\n if (/iphone|ipad|ipod/.test(ua)) return 'ios'\n if (/android/.test(ua)) return 'android'\n if (/mac/.test(ua)) return 'macos'\n if (/win/.test(ua)) return 'windows'\n if (/linux/.test(ua)) return 'linux'\n\n return 'unknown'\n}\n\nexport const getBrowser = (): Browser => {\n if (typeof navigator === 'undefined') {\n return 'unknown'\n }\n\n const ua = navigator.userAgent.toLowerCase()\n\n if (/edg/.test(ua)) return 'edge'\n if (/opr|opera/.test(ua)) return 'opera'\n if (/chrome/.test(ua)) return 'chrome'\n if (/safari/.test(ua)) return 'safari'\n if (/firefox/.test(ua)) return 'firefox'\n\n return 'unknown'\n}\n","import { keyframes } from '@emotion/react'\n\nimport { KeyboardEventKey } from './types'\n\nexport const BREAKPOINTS = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n} as const\n\nexport const COLORS = {\n black: '#212529',\n white: '#ffffff',\n red: '#C1121F',\n green: '#16a34a',\n yellow: '#ffb703',\n gray: '#e5e7eb',\n 'steel-blue': '#0582ca',\n 'iron-grey': '#495057',\n 'baltic-blue': '#1e6091',\n} as const\n\nexport const KEYFRAMES = {\n rotate: keyframes`\n to {\n transform: rotate(1turn);\n }\n `,\n fadeIn: keyframes`\n from { opacity: 0; }\n to { opacity: 1; }\n `,\n fadeOut: keyframes`\n from { opacity: 1; }\n to { opacity: 0; }\n `,\n slideInLeft: keyframes`\n from { transform: translateX(-100%); }\n to { transform: translateX(0); }\n `,\n slideOutLeft: keyframes`\n from { transform: translateX(0); }\n to { transform: translateX(-100%); }\n `,\n slideInRight: keyframes`\n from { transform: translateX(100%); }\n to { transform: translateX(0); }\n `,\n slideOutRight: keyframes`\n from { transform: translateX(0); }\n to { transform: translateX(100%); }\n `,\n slideInTop: keyframes`\n from { transform: translateY(-100%); }\n to { transform: translateY(0); }\n `,\n slideOutTop: keyframes`\n from { transform: translateY(0); }\n to { transform: translateY(-100%); }\n `,\n slideInBottom: keyframes`\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n `,\n slideOutBottom: keyframes`\n from { transform: translateY(0); }\n to { transform: translateY(100%); }\n `,\n scaleIn: keyframes`\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n `,\n slideInTopFade: keyframes`\n from { opacity: 0; transform: translateY(-100%); }\n to { opacity: 1; transform: translateY(0); }\n `,\n slideOutTopFade: keyframes`\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(-100%); }\n `,\n slideInBottomFade: keyframes`\n from { opacity: 0; transform: translateY(100%); }\n to { opacity: 1; transform: translateY(0); }\n `,\n slideOutBottomFade: keyframes`\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(100%); }\n `,\n}\n\nexport const KEY_SYMBOLS: Partial<Record<KeyboardEventKey, { mac: string; other: string }>> = {\n // Modifiers\n Meta: { mac: '⌘', other: 'Win' },\n Control: { mac: '⌃', other: 'Ctrl' },\n Alt: { mac: '⌥', other: 'Alt' },\n Shift: { mac: '⇧', other: '⇧' },\n\n // Navigation\n ArrowUp: { mac: '↑', other: '↑' },\n ArrowDown: { mac: '↓', other: '↓' },\n ArrowLeft: { mac: '←', other: '←' },\n ArrowRight: { mac: '→', other: '→' },\n Home: { mac: '↖', other: '↖' },\n End: { mac: '↘', other: '↘' },\n PageUp: { mac: '⇞', other: '⇞' },\n PageDown: { mac: '⇟', other: '⇟' },\n\n // Whitespace & Enter\n ' ': { mac: '␣', other: '␣' },\n Enter: { mac: 'Enter', other: 'Enter' },\n Tab: { mac: '⇥', other: '⇥' },\n\n // Editing\n Backspace: { mac: '⌫', other: '⌫' },\n Delete: { mac: '⌦', other: '⌦' },\n Escape: { mac: 'Esc', other: 'Esc' },\n Insert: { mac: 'Ins', other: 'Ins' },\n\n // System\n CapsLock: { mac: '⇪', other: '⇪' },\n NumLock: { mac: '⇭', other: '⇭' },\n}\n","import { getOperatingSystem } from './platform'\nimport { KEY_SYMBOLS } from '../constants'\nimport { KeyboardEventKey } from '../types'\n\nexport const getKeySymbols = (keys?: KeyboardEventKey[]): string[] => {\n if (!keys) {\n return []\n }\n\n const os = getOperatingSystem()\n\n return keys.map((key) => {\n const symbol = KEY_SYMBOLS[key]\n\n if (!symbol) {\n return key\n }\n\n return os === 'macos' ? symbol.mac : symbol.other\n })\n}\n"],"names":["normalizeKey","key","useKeyBinding","keys","cb","pressedKeys","useRef","cbRef","useEffect","keysSet","checkMatch","handleKeyDown","e","handleKeyUp","handleBlur","toHEX","n","clamped","isValid","hexColor","alpha","percentage","hex","alphaHex","getOperatingSystem","ua","getBrowser","BREAKPOINTS","COLORS","KEYFRAMES","keyframes","KEY_SYMBOLS","getKeySymbols","os","symbol"],"mappings":"kEAIMA,EAAgBC,GAChBA,EAAI,SAAW,GAAK,SAAS,KAAKA,CAAG,EAChCA,EAAI,YAAA,EAENA,EAGI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O,KAAA,EAG7B,SAAU,CAAE,IAAK,IAAK,MAAO,GAAA,EAC7B,QAAS,CAAE,IAAK,IAAK,MAAO,GAAA,CAC9B,ECvHaC,EAAiB7B,GAAwC,CACpE,GAAI,CAACA,EACH,MAAO,CAAA,EAGT,MAAM8B,EAAKT,EAAA,EAEX,OAAOrB,EAAK,IAAKF,GAAQ,CACvB,MAAMiC,EAASH,EAAY9B,CAAG,EAE9B,OAAKiC,EAIED,IAAO,QAAUC,EAAO,IAAMA,EAAO,MAHnCjC,CAIX,CAAC,CACH"}
|
package/dist/lib.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./keyboard-D8zOi0jU.cjs"),t=require("./index-GSZAZ6Cz.cjs"),i=require("./tooling-Dflq0Y98.cjs");exports.BREAKPOINTS=e.BREAKPOINTS;exports.COLORS=e.COLORS;exports.KEYFRAMES=e.KEYFRAMES;exports.KEY_SYMBOLS=e.KEY_SYMBOLS;exports.alpha=e.alpha;exports.getBrowser=e.getBrowser;exports.getKeySymbols=e.getKeySymbols;exports.getOperatingSystem=e.getOperatingSystem;exports.isValid=e.isValid;exports.toHEX=e.toHEX;exports.useKeyBinding=e.useKeyBinding;exports.mediaBetween=t.mediaBetween;exports.mediaDown=t.mediaDown;exports.mediaUp=t.mediaUp;exports.validation=t.index;exports.newClassNameGetter=i.newClassNameGetter;
|
|
2
2
|
//# sourceMappingURL=lib.cjs.map
|
package/dist/lib.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { AnyObject } from 'yup';
|
|
2
|
+
import { DateSchema } from 'yup';
|
|
1
3
|
import { Ref } from 'react';
|
|
4
|
+
import { StringSchema } from 'yup';
|
|
2
5
|
|
|
3
6
|
export declare const alpha: (hexColor: string, percentage: number) => string;
|
|
4
7
|
|
|
@@ -26,12 +29,20 @@ export declare const COLORS: {
|
|
|
26
29
|
readonly 'baltic-blue': "#1e6091";
|
|
27
30
|
};
|
|
28
31
|
|
|
32
|
+
declare const creditCard: (message?: string) => StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
33
|
+
|
|
34
|
+
declare const email: (options?: string) => StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
35
|
+
|
|
29
36
|
export declare const getBrowser: () => Browser;
|
|
30
37
|
|
|
31
38
|
export declare const getKeySymbols: (keys?: KeyboardEventKey[]) => string[];
|
|
32
39
|
|
|
33
40
|
export declare const getOperatingSystem: () => OperatingSystem;
|
|
34
41
|
|
|
42
|
+
declare const hexColor: (message?: string) => StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
43
|
+
|
|
44
|
+
declare const ipv4: (message?: string) => StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
45
|
+
|
|
35
46
|
export declare const isValid: (hexColor: string) => boolean;
|
|
36
47
|
|
|
37
48
|
export declare const KEY_SYMBOLS: Partial<Record<KeyboardEventKey, {
|
|
@@ -150,12 +161,24 @@ export declare const mediaDown: (bp: Breakpoint) => string;
|
|
|
150
161
|
|
|
151
162
|
export declare const mediaUp: (bp: Breakpoint) => string;
|
|
152
163
|
|
|
164
|
+
declare const minAge: (years: number, message?: string) => DateSchema<Date | undefined, AnyObject, undefined, "">;
|
|
165
|
+
|
|
153
166
|
export declare const newClassNameGetter: (name: string) => (element: string, ...classNames: Array<string | undefined>) => string;
|
|
154
167
|
|
|
168
|
+
declare const noSpaces: (message?: string) => StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
169
|
+
|
|
155
170
|
export declare type OperatingSystem = 'windows' | 'macos' | 'linux' | 'ios' | 'android' | 'unknown';
|
|
156
171
|
|
|
172
|
+
declare const password: (message?: string) => StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
173
|
+
|
|
174
|
+
declare const phone: (message?: string) => StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
175
|
+
|
|
176
|
+
declare const slug: (message?: string) => StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
177
|
+
|
|
157
178
|
export declare const toHEX: (n: number) => string;
|
|
158
179
|
|
|
180
|
+
declare const url: (message?: string) => StringSchema<string | undefined, AnyObject, undefined, "">;
|
|
181
|
+
|
|
159
182
|
export declare const useKeyBinding: (keys: KeyboardEventKey[], cb?: () => void) => void;
|
|
160
183
|
|
|
161
184
|
export declare type VacanoComponentClassNames<T> = T;
|
|
@@ -182,4 +205,19 @@ export declare type VacanoValueItem = {
|
|
|
182
205
|
disabled?: boolean;
|
|
183
206
|
};
|
|
184
207
|
|
|
208
|
+
export declare namespace validation {
|
|
209
|
+
export {
|
|
210
|
+
creditCard,
|
|
211
|
+
email,
|
|
212
|
+
hexColor,
|
|
213
|
+
ipv4,
|
|
214
|
+
minAge,
|
|
215
|
+
noSpaces,
|
|
216
|
+
password,
|
|
217
|
+
phone,
|
|
218
|
+
slug,
|
|
219
|
+
url
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
185
223
|
export { }
|
package/dist/lib.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import {
|
|
1
|
+
import { B as e, C as t, K as i, d as o, a as m, c as r, g as n, b as d, i as S, t as g, u as p } from "./keyboard-D00e_brg.js";
|
|
2
|
+
import { b as K, a as l, m as E, i as O } from "./index-Abn5L42P.js";
|
|
3
|
+
import { n as y } from "./tooling-YDHxmiMT.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
e as BREAKPOINTS,
|
|
5
6
|
t as COLORS,
|
|
6
7
|
i as KEYFRAMES,
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
o as KEY_SYMBOLS,
|
|
9
|
+
m as alpha,
|
|
9
10
|
r as getBrowser,
|
|
10
11
|
n as getKeySymbols,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
d as getOperatingSystem,
|
|
13
|
+
S as isValid,
|
|
14
|
+
K as mediaBetween,
|
|
15
|
+
l as mediaDown,
|
|
16
|
+
E as mediaUp,
|
|
17
|
+
y as newClassNameGetter,
|
|
18
|
+
g as toHEX,
|
|
19
|
+
p as useKeyBinding,
|
|
20
|
+
O as validation
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=lib.js.map
|
package/dist/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vacano/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Vacano React components library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -36,6 +36,16 @@
|
|
|
36
36
|
"types": "./dist/lib.d.cts",
|
|
37
37
|
"default": "./dist/lib.cjs"
|
|
38
38
|
}
|
|
39
|
+
},
|
|
40
|
+
"./form": {
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/form.d.ts",
|
|
43
|
+
"default": "./dist/form.js"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/form.d.cts",
|
|
47
|
+
"default": "./dist/form.cjs"
|
|
48
|
+
}
|
|
39
49
|
}
|
|
40
50
|
},
|
|
41
51
|
"files": [
|
|
@@ -92,7 +102,17 @@
|
|
|
92
102
|
"peerDependencies": {
|
|
93
103
|
"@emotion/react": "^11.0.0",
|
|
94
104
|
"react": "^19.0.0",
|
|
95
|
-
"react-dom": "^19.0.0"
|
|
105
|
+
"react-dom": "^19.0.0",
|
|
106
|
+
"react-hook-form": "^7.0.0",
|
|
107
|
+
"yup": "^1.0.0"
|
|
108
|
+
},
|
|
109
|
+
"peerDependenciesMeta": {
|
|
110
|
+
"react-hook-form": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"yup": {
|
|
114
|
+
"optional": true
|
|
115
|
+
}
|
|
96
116
|
},
|
|
97
117
|
"dependencies": {
|
|
98
118
|
"@emotion/styled": "^11.14.1",
|
|
@@ -104,6 +124,7 @@
|
|
|
104
124
|
"@chromatic-com/storybook": "^5.0.1",
|
|
105
125
|
"@emotion/react": "^11.14.0",
|
|
106
126
|
"@eslint/js": "^9.39.2",
|
|
127
|
+
"@hookform/resolvers": "^5.2.2",
|
|
107
128
|
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
|
|
108
129
|
"@storybook/addon-a11y": "^10.2.10",
|
|
109
130
|
"@storybook/addon-docs": "^10.2.10",
|
|
@@ -128,7 +149,8 @@
|
|
|
128
149
|
"vite": "^6.0.6",
|
|
129
150
|
"vite-plugin-dts": "^4.4.0",
|
|
130
151
|
"vitepress": "^1.5.0",
|
|
131
|
-
"vitest": "^4.0.16"
|
|
152
|
+
"vitest": "^4.0.16",
|
|
153
|
+
"yup": "^1.7.1"
|
|
132
154
|
},
|
|
133
155
|
"scripts": {
|
|
134
156
|
"build": "vite build",
|