@vacano/ui 1.0.0 → 1.2.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.
package/dist/lib.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./media-OVL6YjWb.cjs"),t=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.mediaBetween=e.mediaBetween;exports.mediaDown=e.mediaDown;exports.mediaUp=e.mediaUp;exports.toHEX=e.toHEX;exports.useKeyBinding=e.useKeyBinding;exports.newClassNameGetter=t.newClassNameGetter;
2
+ //# sourceMappingURL=lib.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/lib.d.ts ADDED
@@ -0,0 +1,161 @@
1
+ import { Ref } from 'react';
2
+
3
+ export declare const alpha: (hexColor: string, percentage: number) => string;
4
+
5
+ declare type Breakpoint = keyof typeof BREAKPOINTS;
6
+
7
+ export declare const BREAKPOINTS: {
8
+ readonly sm: 640;
9
+ readonly md: 768;
10
+ readonly lg: 1024;
11
+ readonly xl: 1280;
12
+ readonly '2xl': 1536;
13
+ };
14
+
15
+ export declare type Browser = 'chrome' | 'firefox' | 'safari' | 'edge' | 'opera' | 'unknown';
16
+
17
+ export declare const COLORS: {
18
+ readonly black: "#212529";
19
+ readonly white: "#ffffff";
20
+ readonly red: "#C1121F";
21
+ readonly green: "#16a34a";
22
+ readonly yellow: "#ffb703";
23
+ readonly gray: "#e5e7eb";
24
+ readonly 'steel-blue': "#0582ca";
25
+ readonly 'iron-grey': "#495057";
26
+ readonly 'baltic-blue': "#1e6091";
27
+ };
28
+
29
+ export declare const getBrowser: () => Browser;
30
+
31
+ export declare const getKeySymbols: (keys?: KeyboardEventKey[]) => string[];
32
+
33
+ export declare const getOperatingSystem: () => OperatingSystem;
34
+
35
+ export declare const isValid: (hexColor: string) => boolean;
36
+
37
+ export declare const KEY_SYMBOLS: Partial<Record<KeyboardEventKey, {
38
+ mac: string;
39
+ other: string;
40
+ }>>;
41
+
42
+ /**
43
+ * Keyboard key values based on KeyboardEvent.key
44
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
45
+ */
46
+ export declare type KeyboardEventKey = 'Meta' | 'Control' | 'Alt' | 'Shift' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'F1' | 'F2' | 'F3' | 'F4' | 'F5' | 'F6' | 'F7' | 'F8' | 'F9' | 'F10' | 'F11' | 'F12' | 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'Home' | 'End' | 'PageUp' | 'PageDown' | ' ' | 'Enter' | 'Tab' | 'Backspace' | 'Delete' | 'Insert' | 'Escape' | '`' | '-' | '=' | '[' | ']' | '\\' | ';' | "'" | ',' | '.' | '/' | 'NumLock' | 'NumpadEnter' | 'NumpadAdd' | 'NumpadSubtract' | 'NumpadMultiply' | 'NumpadDivide' | 'NumpadDecimal' | 'Numpad0' | 'Numpad1' | 'Numpad2' | 'Numpad3' | 'Numpad4' | 'Numpad5' | 'Numpad6' | 'Numpad7' | 'Numpad8' | 'Numpad9' | 'CapsLock' | 'ScrollLock' | 'Pause' | 'PrintScreen' | 'ContextMenu';
47
+
48
+ export declare const KEYFRAMES: {
49
+ rotate: {
50
+ name: string;
51
+ styles: string;
52
+ anim: 1;
53
+ toString: () => string;
54
+ } & string;
55
+ fadeIn: {
56
+ name: string;
57
+ styles: string;
58
+ anim: 1;
59
+ toString: () => string;
60
+ } & string;
61
+ fadeOut: {
62
+ name: string;
63
+ styles: string;
64
+ anim: 1;
65
+ toString: () => string;
66
+ } & string;
67
+ slideInLeft: {
68
+ name: string;
69
+ styles: string;
70
+ anim: 1;
71
+ toString: () => string;
72
+ } & string;
73
+ slideOutLeft: {
74
+ name: string;
75
+ styles: string;
76
+ anim: 1;
77
+ toString: () => string;
78
+ } & string;
79
+ slideInRight: {
80
+ name: string;
81
+ styles: string;
82
+ anim: 1;
83
+ toString: () => string;
84
+ } & string;
85
+ slideOutRight: {
86
+ name: string;
87
+ styles: string;
88
+ anim: 1;
89
+ toString: () => string;
90
+ } & string;
91
+ slideInTop: {
92
+ name: string;
93
+ styles: string;
94
+ anim: 1;
95
+ toString: () => string;
96
+ } & string;
97
+ slideOutTop: {
98
+ name: string;
99
+ styles: string;
100
+ anim: 1;
101
+ toString: () => string;
102
+ } & string;
103
+ slideInBottom: {
104
+ name: string;
105
+ styles: string;
106
+ anim: 1;
107
+ toString: () => string;
108
+ } & string;
109
+ slideOutBottom: {
110
+ name: string;
111
+ styles: string;
112
+ anim: 1;
113
+ toString: () => string;
114
+ } & string;
115
+ scaleIn: {
116
+ name: string;
117
+ styles: string;
118
+ anim: 1;
119
+ toString: () => string;
120
+ } & string;
121
+ };
122
+
123
+ export declare const mediaBetween: (min: Breakpoint, max: Breakpoint) => string;
124
+
125
+ export declare const mediaDown: (bp: Breakpoint) => string;
126
+
127
+ export declare const mediaUp: (bp: Breakpoint) => string;
128
+
129
+ export declare const newClassNameGetter: (name: string) => (element: string, ...classNames: Array<string | undefined>) => string;
130
+
131
+ export declare type OperatingSystem = 'windows' | 'macos' | 'linux' | 'ios' | 'android' | 'unknown';
132
+
133
+ export declare const toHEX: (n: number) => string;
134
+
135
+ export declare const useKeyBinding: (keys: KeyboardEventKey[], cb?: () => void) => void;
136
+
137
+ export declare type VacanoComponentClassNames<T> = T;
138
+
139
+ export declare type VacanoComponentProps<E extends HTMLElement | null, T extends Record<string, string> = Record<string, never>> = {
140
+ 'data-test-id'?: string;
141
+ className?: string;
142
+ classnames?: VacanoComponentClassNames<T>;
143
+ ref?: Ref<E>;
144
+ };
145
+
146
+ export declare type VacanoComponentSize = 'compact' | 'default';
147
+
148
+ export declare type VacanoInteractiveElementState = {
149
+ active?: string;
150
+ disabled?: string;
151
+ hover?: string;
152
+ static?: string;
153
+ };
154
+
155
+ export declare type VacanoValueItem = {
156
+ value: string;
157
+ label: string;
158
+ disabled?: boolean;
159
+ };
160
+
161
+ export { }
package/dist/lib.js ADDED
@@ -0,0 +1,20 @@
1
+ import { B as s, C as t, K as i, f as m, a as o, e as r, g as n, d as S, i as d, c as g, b as B, m as K, t as p, u as E } from "./media-BR6nutcO.js";
2
+ import { n as l } from "./tooling-YDHxmiMT.js";
3
+ export {
4
+ s as BREAKPOINTS,
5
+ t as COLORS,
6
+ i as KEYFRAMES,
7
+ m as KEY_SYMBOLS,
8
+ o as alpha,
9
+ r as getBrowser,
10
+ n as getKeySymbols,
11
+ S as getOperatingSystem,
12
+ d as isValid,
13
+ g as mediaBetween,
14
+ B as mediaDown,
15
+ K as mediaUp,
16
+ l as newClassNameGetter,
17
+ p as toHEX,
18
+ E as useKeyBinding
19
+ };
20
+ //# sourceMappingURL=lib.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,162 @@
1
+ import { useRef as l, useEffect as p } from "react";
2
+ import { keyframes as e } from "@emotion/react";
3
+ const d = (t) => t.length === 1 && /[a-z]/i.test(t) ? t.toUpperCase() : t, L = (t, n) => {
4
+ const r = l(/* @__PURE__ */ new Set()), a = l(n);
5
+ a.current = n, p(() => {
6
+ const c = new Set(t), h = () => {
7
+ if (c.size !== r.current.size)
8
+ return !1;
9
+ for (const o of c)
10
+ if (!r.current.has(o))
11
+ return !1;
12
+ return !0;
13
+ }, f = (o) => {
14
+ const i = d(o.key);
15
+ r.current.add(i), h() && a.current && (o.preventDefault(), a.current());
16
+ }, m = (o) => {
17
+ const i = d(o.key);
18
+ r.current.delete(i);
19
+ }, u = () => {
20
+ r.current.clear();
21
+ };
22
+ return window.addEventListener("keydown", f), window.addEventListener("keyup", m), window.addEventListener("blur", u), () => {
23
+ window.removeEventListener("keydown", f), window.removeEventListener("keyup", m), window.removeEventListener("blur", u);
24
+ };
25
+ }, [t]);
26
+ }, w = (t) => {
27
+ const n = Math.max(0, Math.min(100, t));
28
+ return Math.round(n / 100 * 255).toString(16).padStart(2, "0");
29
+ }, g = (t) => /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t), k = (t, n) => {
30
+ if (!g(t))
31
+ return "#000000FF";
32
+ const r = t.replace("#", "").slice(0, 6), a = w(n);
33
+ return `#${r}${a}`;
34
+ }, y = () => {
35
+ if (typeof navigator > "u")
36
+ return "unknown";
37
+ const t = navigator.userAgent.toLowerCase();
38
+ return /iphone|ipad|ipod/.test(t) ? "ios" : /android/.test(t) ? "android" : /mac/.test(t) ? "macos" : /win/.test(t) ? "windows" : /linux/.test(t) ? "linux" : "unknown";
39
+ }, S = () => {
40
+ if (typeof navigator > "u")
41
+ return "unknown";
42
+ const t = navigator.userAgent.toLowerCase();
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
+ }, s = {
45
+ sm: 640,
46
+ md: 768,
47
+ lg: 1024,
48
+ xl: 1280,
49
+ "2xl": 1536
50
+ }, b = {
51
+ black: "#212529",
52
+ white: "#ffffff",
53
+ red: "#C1121F",
54
+ green: "#16a34a",
55
+ yellow: "#ffb703",
56
+ gray: "#e5e7eb",
57
+ "steel-blue": "#0582ca",
58
+ "iron-grey": "#495057",
59
+ "baltic-blue": "#1e6091"
60
+ }, Y = {
61
+ rotate: e`
62
+ to {
63
+ transform: rotate(1turn);
64
+ }
65
+ `,
66
+ fadeIn: e`
67
+ from { opacity: 0; }
68
+ to { opacity: 1; }
69
+ `,
70
+ fadeOut: e`
71
+ from { opacity: 1; }
72
+ to { opacity: 0; }
73
+ `,
74
+ slideInLeft: e`
75
+ from { transform: translateX(-100%); }
76
+ to { transform: translateX(0); }
77
+ `,
78
+ slideOutLeft: e`
79
+ from { transform: translateX(0); }
80
+ to { transform: translateX(-100%); }
81
+ `,
82
+ slideInRight: e`
83
+ from { transform: translateX(100%); }
84
+ to { transform: translateX(0); }
85
+ `,
86
+ slideOutRight: e`
87
+ from { transform: translateX(0); }
88
+ to { transform: translateX(100%); }
89
+ `,
90
+ slideInTop: e`
91
+ from { transform: translateY(-100%); }
92
+ to { transform: translateY(0); }
93
+ `,
94
+ slideOutTop: e`
95
+ from { transform: translateY(0); }
96
+ to { transform: translateY(-100%); }
97
+ `,
98
+ slideInBottom: e`
99
+ from { transform: translateY(100%); }
100
+ to { transform: translateY(0); }
101
+ `,
102
+ slideOutBottom: e`
103
+ from { transform: translateY(0); }
104
+ to { transform: translateY(100%); }
105
+ `,
106
+ scaleIn: e`
107
+ from { opacity: 0; transform: scale(0.95); }
108
+ to { opacity: 1; transform: scale(1); }
109
+ `
110
+ }, E = {
111
+ // Modifiers
112
+ Meta: { mac: "⌘", other: "Win" },
113
+ Control: { mac: "⌃", other: "Ctrl" },
114
+ Alt: { mac: "⌥", other: "Alt" },
115
+ Shift: { mac: "⇧", other: "⇧" },
116
+ // Navigation
117
+ ArrowUp: { mac: "↑", other: "↑" },
118
+ ArrowDown: { mac: "↓", other: "↓" },
119
+ ArrowLeft: { mac: "←", other: "←" },
120
+ ArrowRight: { mac: "→", other: "→" },
121
+ Home: { mac: "↖", other: "↖" },
122
+ End: { mac: "↘", other: "↘" },
123
+ PageUp: { mac: "⇞", other: "⇞" },
124
+ PageDown: { mac: "⇟", other: "⇟" },
125
+ // Whitespace & Enter
126
+ " ": { mac: "␣", other: "␣" },
127
+ Enter: { mac: "Enter", other: "Enter" },
128
+ Tab: { mac: "⇥", other: "⇥" },
129
+ // Editing
130
+ Backspace: { mac: "⌫", other: "⌫" },
131
+ Delete: { mac: "⌦", other: "⌦" },
132
+ Escape: { mac: "Esc", other: "Esc" },
133
+ Insert: { mac: "Ins", other: "Ins" },
134
+ // System
135
+ CapsLock: { mac: "⇪", other: "⇪" },
136
+ NumLock: { mac: "⇭", other: "⇭" }
137
+ }, A = (t) => {
138
+ if (!t)
139
+ return [];
140
+ const n = y();
141
+ return t.map((r) => {
142
+ const a = E[r];
143
+ return a ? n === "macos" ? a.mac : a.other : r;
144
+ });
145
+ }, B = (t) => `@media (min-width: ${s[t]}px)`, I = (t) => `@media (max-width: ${s[t] - 1}px)`, K = (t, n) => `@media (min-width: ${s[t]}px) and (max-width: ${s[n] - 1}px)`;
146
+ export {
147
+ s as B,
148
+ b as C,
149
+ Y as K,
150
+ k as a,
151
+ I as b,
152
+ K as c,
153
+ y as d,
154
+ S as e,
155
+ E as f,
156
+ A as g,
157
+ g as i,
158
+ B as m,
159
+ w as t,
160
+ L as u
161
+ };
162
+ //# sourceMappingURL=media-BR6nutcO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-BR6nutcO.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","../src/lib/utils/media.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}\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","import { BREAKPOINTS } from '../constants'\n\ntype Breakpoint = keyof typeof BREAKPOINTS\n\nexport const mediaUp = (bp: Breakpoint) => {\n return `@media (min-width: ${BREAKPOINTS[bp]}px)`\n}\n\nexport const mediaDown = (bp: Breakpoint) => {\n return `@media (max-width: ${BREAKPOINTS[bp] - 1}px)`\n}\n\nexport const mediaBetween = (min: Breakpoint, max: Breakpoint) => {\n return `@media (min-width: ${BREAKPOINTS[min]}px) and (max-width: ${BREAKPOINTS[max] - 1}px)`\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","mediaUp","bp","mediaDown","mediaBetween","min","max"],"mappings":";;AAIA,MAAMA,IAAe,CAACC,MAChBA,EAAI,WAAW,KAAK,SAAS,KAAKA,CAAG,IAChCA,EAAI,YAAA,IAENA,GAGIC,IAAgB,CAACC,GAA0BC,MAAoB;AAC1E,QAAMC,IAAcC,EAAoB,oBAAI,KAAK,GAC3CC,IAAQD,EAAOF,CAAE;AAEvB,EAAAG,EAAM,UAAUH,GAEhBI,EAAU,MAAM;AACd,UAAMC,IAAU,IAAI,IAAIN,CAAI,GAEtBO,IAAa,MAAM;AACvB,UAAID,EAAQ,SAASJ,EAAY,QAAQ;AACvC,eAAO;AAGT,iBAAWJ,KAAOQ;AAChB,YAAI,CAACJ,EAAY,QAAQ,IAAIJ,CAAG;AAC9B,iBAAO;AAIX,aAAO;AAAA,IACT,GAEMU,IAAgB,CAACC,MAAqB;AAC1C,YAAMX,IAAMD,EAAaY,EAAE,GAAG;AAC9B,MAAAP,EAAY,QAAQ,IAAIJ,CAAG,GAEvBS,EAAA,KAAgBH,EAAM,YACxBK,EAAE,eAAA,GACFL,EAAM,QAAA;AAAA,IAEV,GAEMM,IAAc,CAACD,MAAqB;AACxC,YAAMX,IAAMD,EAAaY,EAAE,GAAG;AAC9B,MAAAP,EAAY,QAAQ,OAAOJ,CAAG;AAAA,IAChC,GAEMa,IAAa,MAAM;AACvB,MAAAT,EAAY,QAAQ,MAAA;AAAA,IACtB;AAEA,kBAAO,iBAAiB,WAAWM,CAAa,GAChD,OAAO,iBAAiB,SAASE,CAAW,GAC5C,OAAO,i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AO,IAAA;AAAA,EACxB,QAAQ,EAAE,KAAK,KAAK,OAAO,IAAA;AAAA,EAC3B,UAAU,EAAE,KAAK,KAAK,OAAO,IAAA;AAAA;AAAA,EAG7B,KAAK,EAAE,KAAK,KAAK,OAAO,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,GCvGaC,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,GChBakC,IAAU,CAACC,MACf,sBAAsBT,EAAYS,CAAE,CAAC,OAGjCC,IAAY,CAACD,MACjB,sBAAsBT,EAAYS,CAAE,IAAI,CAAC,OAGrCE,IAAe,CAACC,GAAiBC,MACrC,sBAAsBb,EAAYY,CAAG,CAAC,uBAAuBZ,EAAYa,CAAG,IAAI,CAAC;"}
@@ -0,0 +1,39 @@
1
+ "use strict";const m=require("react"),t=require("@emotion/react"),d=e=>e.length===1&&/[a-z]/i.test(e)?e.toUpperCase():e,k=(e,n)=>{const r=m.useRef(new Set),a=m.useRef(n);a.current=n,m.useEffect(()=>{const c=new Set(e),g=()=>{if(c.size!==r.current.size)return!1;for(const o of c)if(!r.current.has(o))return!1;return!0},f=o=>{const i=d(o.key);r.current.add(i),g()&&a.current&&(o.preventDefault(),a.current())},u=o=>{const i=d(o.key);r.current.delete(i)},l=()=>{r.current.clear()};return window.addEventListener("keydown",f),window.addEventListener("keyup",u),window.addEventListener("blur",l),()=>{window.removeEventListener("keydown",f),window.removeEventListener("keyup",u),window.removeEventListener("blur",l)}},[e])},h=e=>{const n=Math.max(0,Math.min(100,e));return Math.round(n/100*255).toString(16).padStart(2,"0")},w=e=>/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e),E=(e,n)=>{if(!w(e))return"#000000FF";const r=e.replace("#","").slice(0,6),a=h(n);return`#${r}${a}`},p=()=>{if(typeof navigator>"u")return"unknown";const e=navigator.userAgent.toLowerCase();return/iphone|ipad|ipod/.test(e)?"ios":/android/.test(e)?"android":/mac/.test(e)?"macos":/win/.test(e)?"windows":/linux/.test(e)?"linux":"unknown"},S=()=>{if(typeof navigator>"u")return"unknown";const e=navigator.userAgent.toLowerCase();return/edg/.test(e)?"edge":/opr|opera/.test(e)?"opera":/chrome/.test(e)?"chrome":/safari/.test(e)?"safari":/firefox/.test(e)?"firefox":"unknown"},s={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},L={black:"#212529",white:"#ffffff",red:"#C1121F",green:"#16a34a",yellow:"#ffb703",gray:"#e5e7eb","steel-blue":"#0582ca","iron-grey":"#495057","baltic-blue":"#1e6091"},v={rotate:t.keyframes`
2
+ to {
3
+ transform: rotate(1turn);
4
+ }
5
+ `,fadeIn:t.keyframes`
6
+ from { opacity: 0; }
7
+ to { opacity: 1; }
8
+ `,fadeOut:t.keyframes`
9
+ from { opacity: 1; }
10
+ to { opacity: 0; }
11
+ `,slideInLeft:t.keyframes`
12
+ from { transform: translateX(-100%); }
13
+ to { transform: translateX(0); }
14
+ `,slideOutLeft:t.keyframes`
15
+ from { transform: translateX(0); }
16
+ to { transform: translateX(-100%); }
17
+ `,slideInRight:t.keyframes`
18
+ from { transform: translateX(100%); }
19
+ to { transform: translateX(0); }
20
+ `,slideOutRight:t.keyframes`
21
+ from { transform: translateX(0); }
22
+ to { transform: translateX(100%); }
23
+ `,slideInTop:t.keyframes`
24
+ from { transform: translateY(-100%); }
25
+ to { transform: translateY(0); }
26
+ `,slideOutTop:t.keyframes`
27
+ from { transform: translateY(0); }
28
+ to { transform: translateY(-100%); }
29
+ `,slideInBottom:t.keyframes`
30
+ from { transform: translateY(100%); }
31
+ to { transform: translateY(0); }
32
+ `,slideOutBottom:t.keyframes`
33
+ from { transform: translateY(0); }
34
+ to { transform: translateY(100%); }
35
+ `,scaleIn:t.keyframes`
36
+ from { opacity: 0; transform: scale(0.95); }
37
+ to { opacity: 1; transform: scale(1); }
38
+ `},y={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=e=>{if(!e)return[];const n=p();return e.map(r=>{const a=y[r];return a?n==="macos"?a.mac:a.other:r})},x=e=>`@media (min-width: ${s[e]}px)`,B=e=>`@media (max-width: ${s[e]-1}px)`,K=(e,n)=>`@media (min-width: ${s[e]}px) and (max-width: ${s[n]-1}px)`;exports.BREAKPOINTS=s;exports.COLORS=L;exports.KEYFRAMES=v;exports.KEY_SYMBOLS=y;exports.alpha=E;exports.getBrowser=S;exports.getKeySymbols=O;exports.getOperatingSystem=p;exports.isValid=w;exports.mediaBetween=K;exports.mediaDown=B;exports.mediaUp=x;exports.toHEX=h;exports.useKeyBinding=k;
39
+ //# sourceMappingURL=media-OVL6YjWb.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-OVL6YjWb.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","../src/lib/utils/media.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}\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","import { BREAKPOINTS } from '../constants'\n\ntype Breakpoint = keyof typeof BREAKPOINTS\n\nexport const mediaUp = (bp: Breakpoint) => {\n return `@media (min-width: ${BREAKPOINTS[bp]}px)`\n}\n\nexport const mediaDown = (bp: Breakpoint) => {\n return `@media (max-width: ${BREAKPOINTS[bp] - 1}px)`\n}\n\nexport const mediaBetween = (min: Breakpoint, max: Breakpoint) => {\n return `@media (min-width: ${BREAKPOINTS[min]}px) and (max-width: ${BREAKPOINTS[max] - 1}px)`\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","mediaUp","bp","mediaDown","mediaBetween","min","max"],"mappings":"kEAIMA,EAAgBC,GAChBA,EAAI,SAAW,GAAK,SAAS,KAAKA,CAAG,EAChCA,EAAI,YAAA,EAENA,EAGIC,EAAgB,CAACC,EAA0BC,IAAoB,CAC1E,MAAMC,EAAcC,EAAAA,OAAoB,IAAI,GAAK,EAC3CC,EAAQD,EAAAA,OAAOF,CAAE,EAEvBG,EAAM,QAAUH,EAEhBI,EAAAA,UAAU,IAAM,CACd,MAA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C,GACf,sBAAsBT,EAAYS,CAAE,CAAC,MAGjCC,EAAaD,GACjB,sBAAsBT,EAAYS,CAAE,EAAI,CAAC,MAGrCE,EAAe,CAACC,EAAiBC,IACrC,sBAAsBb,EAAYY,CAAG,CAAC,uBAAuBZ,EAAYa,CAAG,EAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";function a(r){var e,n,t="";if(typeof r=="string"||typeof r=="number")t+=r;else if(typeof r=="object")if(Array.isArray(r)){var s=r.length;for(e=0;e<s;e++)r[e]&&(n=a(r[e]))&&(t&&(t+=" "),t+=n)}else for(n in r)r[n]&&(t&&(t+=" "),t+=n);return t}function o(){for(var r,e,n=0,t="",s=arguments.length;n<s;n++)(r=arguments[n])&&(e=a(r))&&(t&&(t+=" "),t+=e);return t}const f="vacano",i=r=>(e,...n)=>o(`${f}_${r}_${e}`,...n);exports.newClassNameGetter=i;
2
+ //# sourceMappingURL=tooling-Dflq0Y98.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooling-Dflq0Y98.cjs","sources":["../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../src/lib/utils/tooling.ts"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import clsx from 'clsx'\n\nconst COMPONENTS_PREFIX = 'vacano'\n\nexport const newClassNameGetter =\n (name: string) =>\n (element: string, ...classNames: Array<string | undefined>) => {\n return clsx(`${COMPONENTS_PREFIX}_${name}_${element}`, ...classNames)\n }\n"],"names":["r","e","t","f","n","o","clsx","COMPONENTS_PREFIX","newClassNameGetter","name","element","classNames"],"mappings":"aAAA,SAASA,EAAEC,EAAE,CAAC,IAAIC,EAAEC,EAAEC,EAAE,GAAG,GAAa,OAAOH,GAAjB,UAA8B,OAAOA,GAAjB,SAAmBG,GAAGH,UAAoB,OAAOA,GAAjB,SAAmB,GAAG,MAAM,QAAQA,CAAC,EAAE,CAAC,IAAII,EAAEJ,EAAE,OAAO,IAAIC,EAAE,EAAEA,EAAEG,EAAEH,IAAID,EAAEC,CAAC,IAAIC,EAAEH,EAAEC,EAAEC,CAAC,CAAC,KAAKE,IAAIA,GAAG,KAAKA,GAAGD,EAAE,KAAM,KAAIA,KAAKF,EAAEA,EAAEE,CAAC,IAAIC,IAAIA,GAAG,KAAKA,GAAGD,GAAG,OAAOC,CAAC,CAAQ,SAASE,GAAM,CAAC,QAAQL,EAAEC,EAAEC,EAAE,EAAEC,EAAE,GAAGC,EAAE,UAAU,OAAOF,EAAEE,EAAEF,KAAKF,EAAE,UAAUE,CAAC,KAAKD,EAAEF,EAAEC,CAAC,KAAKG,IAAIA,GAAG,KAAKA,GAAGF,GAAG,OAAOE,CAAC,CCE/W,MAAMG,EAAoB,SAEbC,EACVC,GACD,CAACC,KAAoBC,IACZL,EAAK,GAAGC,CAAiB,IAAIE,CAAI,IAAIC,CAAO,GAAI,GAAGC,CAAU","x_google_ignoreList":[0]}
@@ -0,0 +1,18 @@
1
+ function s(r) {
2
+ var o, n, t = "";
3
+ if (typeof r == "string" || typeof r == "number") t += r;
4
+ else if (typeof r == "object") if (Array.isArray(r)) {
5
+ var a = r.length;
6
+ for (o = 0; o < a; o++) r[o] && (n = s(r[o])) && (t && (t += " "), t += n);
7
+ } else for (n in r) r[n] && (t && (t += " "), t += n);
8
+ return t;
9
+ }
10
+ function e() {
11
+ for (var r, o, n = 0, t = "", a = arguments.length; n < a; n++) (r = arguments[n]) && (o = s(r)) && (t && (t += " "), t += o);
12
+ return t;
13
+ }
14
+ const f = "vacano", i = (r) => (o, ...n) => e(`${f}_${r}_${o}`, ...n);
15
+ export {
16
+ i as n
17
+ };
18
+ //# sourceMappingURL=tooling-YDHxmiMT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooling-YDHxmiMT.js","sources":["../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../src/lib/utils/tooling.ts"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import clsx from 'clsx'\n\nconst COMPONENTS_PREFIX = 'vacano'\n\nexport const newClassNameGetter =\n (name: string) =>\n (element: string, ...classNames: Array<string | undefined>) => {\n return clsx(`${COMPONENTS_PREFIX}_${name}_${element}`, ...classNames)\n }\n"],"names":["r","e","t","f","n","o","clsx","COMPONENTS_PREFIX","newClassNameGetter","name","element","classNames"],"mappings":"AAAA,SAASA,EAAEC,GAAE;AAAC,MAAIC,GAAEC,GAAEC,IAAE;AAAG,MAAa,OAAOH,KAAjB,YAA8B,OAAOA,KAAjB,SAAmB,CAAAG,KAAGH;AAAA,WAAoB,OAAOA,KAAjB,SAAmB,KAAG,MAAM,QAAQA,CAAC,GAAE;AAAC,QAAII,IAAEJ,EAAE;AAAO,SAAIC,IAAE,GAAEA,IAAEG,GAAEH,IAAI,CAAAD,EAAEC,CAAC,MAAIC,IAAEH,EAAEC,EAAEC,CAAC,CAAC,OAAKE,MAAIA,KAAG,MAAKA,KAAGD;AAAA,EAAE,MAAM,MAAIA,KAAKF,EAAE,CAAAA,EAAEE,CAAC,MAAIC,MAAIA,KAAG,MAAKA,KAAGD;AAAG,SAAOC;AAAC;AAAQ,SAASE,IAAM;AAAC,WAAQL,GAAEC,GAAEC,IAAE,GAAEC,IAAE,IAAGC,IAAE,UAAU,QAAOF,IAAEE,GAAEF,IAAI,EAACF,IAAE,UAAUE,CAAC,OAAKD,IAAEF,EAAEC,CAAC,OAAKG,MAAIA,KAAG,MAAKA,KAAGF;AAAG,SAAOE;AAAC;ACE/W,MAAMG,IAAoB,UAEbC,IACX,CAACC,MACD,CAACC,MAAoBC,MACZL,EAAK,GAAGC,CAAiB,IAAIE,CAAI,IAAIC,CAAO,IAAI,GAAGC,CAAU;","x_google_ignoreList":[0]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacano/ui",
3
- "version": "1.0.0",
3
+ "version": "1.2.1",
4
4
  "description": "Vacano React components library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -26,63 +26,22 @@
26
26
  "types": "./dist/icons.d.cts",
27
27
  "default": "./dist/icons.cjs"
28
28
  }
29
+ },
30
+ "./lib": {
31
+ "import": {
32
+ "types": "./dist/lib.d.ts",
33
+ "default": "./dist/lib.js"
34
+ },
35
+ "require": {
36
+ "types": "./dist/lib.d.cts",
37
+ "default": "./dist/lib.cjs"
38
+ }
29
39
  }
30
40
  },
31
41
  "files": [
32
42
  "dist"
33
43
  ],
34
44
  "sideEffects": false,
35
- "peerDependencies": {
36
- "@emotion/react": "^11.0.0",
37
- "react": "^19.0.0",
38
- "react-dom": "^19.0.0"
39
- },
40
- "dependencies": {
41
- "@emotion/styled": "^11.14.1",
42
- "@floating-ui/react": "^0.27.16",
43
- "@lordicon/react": "^1.11.0",
44
- "@tanstack/react-virtual": "^3.13.13",
45
- "clsx": "^2.1.1",
46
- "lottie-web": "^5.13.0"
47
- },
48
- "devDependencies": {
49
- "@chromatic-com/storybook": "^4.1.3",
50
- "@emotion/react": "^11.14.0",
51
- "@eslint/js": "^9.39.2",
52
- "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
53
- "@storybook/addon-a11y": "^10.1.10",
54
- "@storybook/addon-docs": "^10.1.10",
55
- "@storybook/addon-onboarding": "^10.1.10",
56
- "@storybook/addon-vitest": "^10.1.10",
57
- "@storybook/react-vite": "^10.1.10",
58
- "@testing-library/jest-dom": "^6.9.1",
59
- "@testing-library/react": "^16.3.1",
60
- "@testing-library/user-event": "^14.6.1",
61
- "@types/node": "^22.10.2",
62
- "@types/react": "^19.0.2",
63
- "@types/react-dom": "^19.0.2",
64
- "@vitejs/plugin-react": "^4.3.4",
65
- "@vitest/browser": "^3.0.0",
66
- "@vitest/coverage-v8": "^3.0.0",
67
- "eslint": "^9.39.2",
68
- "eslint-plugin-react": "^7.37.5",
69
- "eslint-plugin-react-hooks": "^5.2.0",
70
- "eslint-plugin-storybook": "^10.1.10",
71
- "husky": "^9.1.7",
72
- "jsdom": "^25.0.1",
73
- "lint-staged": "^15.2.11",
74
- "playwright": "^1.57.0",
75
- "prettier": "^3.4.2",
76
- "react": "^19.0.0",
77
- "react-dom": "^19.0.0",
78
- "storybook": "^10.1.10",
79
- "typescript": "^5.7.2",
80
- "typescript-eslint": "^8.50.1",
81
- "vite": "^6.0.6",
82
- "vite-plugin-dts": "^4.4.0",
83
- "vitepress": "^1.5.0",
84
- "vitest": "^3.0.0"
85
- },
86
45
  "engines": {
87
46
  "node": ">=22.0.0",
88
47
  "pnpm": ">=9.0.0"
@@ -117,7 +76,11 @@
117
76
  "",
118
77
  "<THIRD_PARTY_MODULES>",
119
78
  "",
120
- "^[./]"
79
+ "^\\./",
80
+ "^\\.\\./(?!\\.)",
81
+ "^\\.\\./\\.\\./(?!\\.)",
82
+ "^\\.\\./\\.\\./\\.\\./(?!\\.)",
83
+ "^\\.\\./\\.\\./\\.\\./\\.\\./"
121
84
  ]
122
85
  },
123
86
  "lint-staged": {
@@ -126,20 +89,61 @@
126
89
  "prettier --write"
127
90
  ]
128
91
  },
92
+ "peerDependencies": {
93
+ "@emotion/react": "^11.0.0",
94
+ "react": "^19.0.0",
95
+ "react-dom": "^19.0.0"
96
+ },
97
+ "dependencies": {
98
+ "@emotion/styled": "^11.14.1",
99
+ "@tanstack/react-virtual": "^3.13.13",
100
+ "clsx": "^2.1.1",
101
+ "hq-cropper": "^4.0.0"
102
+ },
103
+ "devDependencies": {
104
+ "@chromatic-com/storybook": "^4.1.3",
105
+ "@emotion/react": "^11.14.0",
106
+ "@eslint/js": "^9.39.2",
107
+ "@fontsource/inter": "^5.2.8",
108
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
109
+ "@storybook/addon-a11y": "^10.1.10",
110
+ "@storybook/addon-docs": "^10.1.10",
111
+ "@storybook/addon-onboarding": "^10.1.10",
112
+ "@storybook/react-vite": "^10.1.10",
113
+ "@types/node": "^22.10.2",
114
+ "@types/react": "^19.0.2",
115
+ "@types/react-dom": "^19.0.2",
116
+ "@vitejs/plugin-react": "^4.3.4",
117
+ "eslint": "^9.39.2",
118
+ "eslint-plugin-react": "^7.37.5",
119
+ "eslint-plugin-react-hooks": "^5.2.0",
120
+ "eslint-plugin-storybook": "^10.1.10",
121
+ "husky": "^9.1.7",
122
+ "lint-staged": "^15.2.11",
123
+ "prettier": "^3.4.2",
124
+ "react": "^19.0.0",
125
+ "react-dom": "^19.0.0",
126
+ "storybook": "^10.1.10",
127
+ "typescript": "^5.7.2",
128
+ "typescript-eslint": "^8.50.1",
129
+ "vite": "^6.0.6",
130
+ "vite-plugin-dts": "^4.4.0",
131
+ "vitepress": "^1.5.0",
132
+ "vitest": "^4.0.16"
133
+ },
129
134
  "scripts": {
130
135
  "build": "vite build",
131
136
  "docs:dev": "vitepress dev docs",
132
137
  "docs:build": "vitepress build docs",
133
138
  "docs:preview": "vitepress preview docs",
134
139
  "storybook": "storybook dev -p 6006",
135
- "build-storybook": "storybook build",
136
- "test": "vitest",
137
- "test:run": "vitest run",
138
- "test:coverage": "vitest run --coverage",
140
+ "build-storybook": "STORYBOOK_BASE=/storybook/ storybook build -o docs/public/storybook",
139
141
  "lint": "eslint src",
140
142
  "lint:fix": "eslint src --fix",
141
143
  "format": "prettier --write \"src/**/*.{ts,tsx}\"",
142
144
  "format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
143
- "typecheck": "tsc --noEmit"
145
+ "typecheck": "tsc --noEmit",
146
+ "test": "vitest",
147
+ "test:run": "vitest run"
144
148
  }
145
149
  }