@llui/components 0.0.5 → 0.0.7
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/components/angle-slider.d.ts.map +1 -1
- package/dist/components/angle-slider.js +3 -1
- package/dist/components/carousel.d.ts +6 -6
- package/dist/components/carousel.d.ts.map +1 -1
- package/dist/components/carousel.js +10 -7
- package/dist/components/cascade-select.d.ts +1 -1
- package/dist/components/cascade-select.d.ts.map +1 -1
- package/dist/components/cascade-select.js +4 -1
- package/dist/components/clipboard.d.ts +1 -1
- package/dist/components/clipboard.d.ts.map +1 -1
- package/dist/components/clipboard.js +4 -1
- package/dist/components/color-picker.d.ts +4 -4
- package/dist/components/color-picker.d.ts.map +1 -1
- package/dist/components/color-picker.js +7 -4
- package/dist/components/combobox.d.ts +1 -1
- package/dist/components/combobox.d.ts.map +1 -1
- package/dist/components/combobox.js +4 -2
- package/dist/components/date-input.d.ts +1 -1
- package/dist/components/date-input.d.ts.map +1 -1
- package/dist/components/date-input.js +4 -1
- package/dist/components/date-picker.d.ts +14 -2
- package/dist/components/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker.js +27 -19
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +4 -2
- package/dist/components/drawer.d.ts +1 -1
- package/dist/components/drawer.d.ts.map +1 -1
- package/dist/components/drawer.js +4 -2
- package/dist/components/enter-view.d.ts +73 -0
- package/dist/components/enter-view.d.ts.map +1 -0
- package/dist/components/enter-view.js +51 -0
- package/dist/components/file-upload.d.ts +5 -4
- package/dist/components/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload.js +6 -2
- package/dist/components/floating-panel.d.ts +4 -4
- package/dist/components/floating-panel.d.ts.map +1 -1
- package/dist/components/floating-panel.js +7 -4
- package/dist/components/form.d.ts +115 -0
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +102 -0
- package/dist/components/hover-card.d.ts +0 -1
- package/dist/components/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card.js +0 -1
- package/dist/components/image-cropper.d.ts +1 -1
- package/dist/components/image-cropper.d.ts.map +1 -1
- package/dist/components/image-cropper.js +4 -1
- package/dist/components/in-view.d.ts +69 -0
- package/dist/components/in-view.d.ts.map +1 -0
- package/dist/components/in-view.js +51 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/navigation-menu.d.ts +1 -1
- package/dist/components/navigation-menu.d.ts.map +1 -1
- package/dist/components/navigation-menu.js +4 -1
- package/dist/components/number-input.d.ts +2 -2
- package/dist/components/number-input.d.ts.map +1 -1
- package/dist/components/number-input.js +5 -2
- package/dist/components/pagination.d.ts +3 -3
- package/dist/components/pagination.d.ts.map +1 -1
- package/dist/components/pagination.js +7 -4
- package/dist/components/password-input.d.ts.map +1 -1
- package/dist/components/password-input.js +8 -3
- package/dist/components/pin-input.d.ts.map +1 -1
- package/dist/components/pin-input.js +7 -4
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.d.ts.map +1 -1
- package/dist/components/popover.js +4 -2
- package/dist/components/progress.d.ts.map +1 -1
- package/dist/components/progress.js +2 -1
- package/dist/components/qr-code.d.ts +2 -2
- package/dist/components/qr-code.d.ts.map +1 -1
- package/dist/components/qr-code.js +5 -2
- package/dist/components/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group.js +3 -1
- package/dist/components/rating-group.d.ts.map +1 -1
- package/dist/components/rating-group.js +3 -1
- package/dist/components/scroll-area.d.ts +1 -0
- package/dist/components/scroll-area.d.ts.map +1 -1
- package/dist/components/scroll-area.js +1 -0
- package/dist/components/signature-pad.d.ts +3 -3
- package/dist/components/signature-pad.d.ts.map +1 -1
- package/dist/components/signature-pad.js +6 -3
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +3 -1
- package/dist/components/sortable.d.ts +106 -0
- package/dist/components/sortable.d.ts.map +1 -0
- package/dist/components/sortable.js +97 -0
- package/dist/components/splitter.d.ts.map +1 -1
- package/dist/components/splitter.js +3 -1
- package/dist/components/steps.d.ts +1 -1
- package/dist/components/steps.d.ts.map +1 -1
- package/dist/components/steps.js +4 -1
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +3 -1
- package/dist/components/tags-input.d.ts +3 -4
- package/dist/components/tags-input.d.ts.map +1 -1
- package/dist/components/tags-input.js +16 -11
- package/dist/components/theme-switch.d.ts +89 -0
- package/dist/components/theme-switch.d.ts.map +1 -0
- package/dist/components/theme-switch.js +96 -0
- package/dist/components/time-picker.d.ts +4 -4
- package/dist/components/time-picker.d.ts.map +1 -1
- package/dist/components/time-picker.js +7 -4
- package/dist/components/timer.d.ts +3 -3
- package/dist/components/timer.d.ts.map +1 -1
- package/dist/components/timer.js +6 -3
- package/dist/components/toast.d.ts +3 -3
- package/dist/components/toast.d.ts.map +1 -1
- package/dist/components/toast.js +5 -2
- package/dist/components/toc.d.ts +2 -2
- package/dist/components/toc.d.ts.map +1 -1
- package/dist/components/toc.js +5 -2
- package/dist/components/toggle-group.d.ts +0 -1
- package/dist/components/toggle-group.d.ts.map +1 -1
- package/dist/components/toggle-group.js +3 -2
- package/dist/components/tour.d.ts +1 -1
- package/dist/components/tour.d.ts.map +1 -1
- package/dist/components/tour.js +4 -1
- package/dist/components/tree-view.d.ts.map +1 -1
- package/dist/components/tree-view.js +3 -1
- package/dist/format/cache.d.ts +3 -0
- package/dist/format/cache.d.ts.map +1 -0
- package/dist/format/cache.js +24 -0
- package/dist/format/defaults.d.ts +3 -0
- package/dist/format/defaults.d.ts.map +1 -0
- package/dist/format/defaults.js +4 -0
- package/dist/format/format-date.d.ts +41 -0
- package/dist/format/format-date.d.ts.map +1 -0
- package/dist/format/format-date.js +48 -0
- package/dist/format/format-display-name.d.ts +9 -0
- package/dist/format/format-display-name.d.ts.map +1 -0
- package/dist/format/format-display-name.js +21 -0
- package/dist/format/format-file-size.d.ts +7 -0
- package/dist/format/format-file-size.d.ts.map +1 -0
- package/dist/format/format-file-size.js +27 -0
- package/dist/format/format-list.d.ts +7 -0
- package/dist/format/format-list.d.ts.map +1 -0
- package/dist/format/format-list.js +12 -0
- package/dist/format/format-number.d.ts +19 -0
- package/dist/format/format-number.d.ts.map +1 -0
- package/dist/format/format-number.js +37 -0
- package/dist/format/format-plural.d.ts +16 -0
- package/dist/format/format-plural.d.ts.map +1 -0
- package/dist/format/format-plural.js +30 -0
- package/dist/format/format-relative-time.d.ts +8 -0
- package/dist/format/format-relative-time.d.ts.map +1 -0
- package/dist/format/format-relative-time.js +12 -0
- package/dist/format/index.d.ts +8 -0
- package/dist/format/index.d.ts.map +1 -0
- package/dist/format/index.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/locale.d.ts +127 -0
- package/dist/locale.d.ts.map +1 -0
- package/dist/locale.js +73 -0
- package/dist/styles/theme.css +2 -2
- package/dist/utils/direction.d.ts +11 -0
- package/dist/utils/direction.d.ts.map +1 -0
- package/dist/utils/direction.js +26 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/validators.d.ts +34 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/validators.js +83 -0
- package/package.json +4 -3
package/dist/locale.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/** Per-component locale strings. Only components with user-facing text have entries. */
|
|
2
|
+
export interface Locale {
|
|
3
|
+
carousel: {
|
|
4
|
+
label: string;
|
|
5
|
+
indicators: string;
|
|
6
|
+
next: string;
|
|
7
|
+
prev: string;
|
|
8
|
+
slide: (index: number) => string;
|
|
9
|
+
goToSlide: (index: number) => string;
|
|
10
|
+
};
|
|
11
|
+
cascadeSelect: {
|
|
12
|
+
clear: string;
|
|
13
|
+
};
|
|
14
|
+
clipboard: {
|
|
15
|
+
copy: string;
|
|
16
|
+
};
|
|
17
|
+
colorPicker: {
|
|
18
|
+
hue: string;
|
|
19
|
+
saturation: string;
|
|
20
|
+
lightness: string;
|
|
21
|
+
hex: string;
|
|
22
|
+
};
|
|
23
|
+
combobox: {
|
|
24
|
+
toggle: string;
|
|
25
|
+
};
|
|
26
|
+
dateInput: {
|
|
27
|
+
clear: string;
|
|
28
|
+
};
|
|
29
|
+
datePicker: {
|
|
30
|
+
prev: string;
|
|
31
|
+
next: string;
|
|
32
|
+
monthNames: string[];
|
|
33
|
+
grid: (year: number, month: number) => string;
|
|
34
|
+
};
|
|
35
|
+
dialog: {
|
|
36
|
+
close: string;
|
|
37
|
+
};
|
|
38
|
+
drawer: {
|
|
39
|
+
close: string;
|
|
40
|
+
};
|
|
41
|
+
fileUpload: {
|
|
42
|
+
remove: string;
|
|
43
|
+
clear: string;
|
|
44
|
+
};
|
|
45
|
+
floatingPanel: {
|
|
46
|
+
label: string;
|
|
47
|
+
minimize: string;
|
|
48
|
+
maximize: string;
|
|
49
|
+
close: string;
|
|
50
|
+
};
|
|
51
|
+
imageCropper: {
|
|
52
|
+
reset: string;
|
|
53
|
+
};
|
|
54
|
+
navigationMenu: {
|
|
55
|
+
label: string;
|
|
56
|
+
};
|
|
57
|
+
numberInput: {
|
|
58
|
+
increment: string;
|
|
59
|
+
decrement: string;
|
|
60
|
+
};
|
|
61
|
+
pagination: {
|
|
62
|
+
label: string;
|
|
63
|
+
prev: string;
|
|
64
|
+
next: string;
|
|
65
|
+
page: (n: number) => string;
|
|
66
|
+
};
|
|
67
|
+
passwordInput: {
|
|
68
|
+
show: string;
|
|
69
|
+
hide: string;
|
|
70
|
+
};
|
|
71
|
+
pinInput: {
|
|
72
|
+
input: (index: number) => string;
|
|
73
|
+
};
|
|
74
|
+
popover: {
|
|
75
|
+
close: string;
|
|
76
|
+
};
|
|
77
|
+
progress: {
|
|
78
|
+
loading: string;
|
|
79
|
+
};
|
|
80
|
+
qrCode: {
|
|
81
|
+
label: string;
|
|
82
|
+
download: string;
|
|
83
|
+
};
|
|
84
|
+
signaturePad: {
|
|
85
|
+
label: string;
|
|
86
|
+
clear: string;
|
|
87
|
+
undo: string;
|
|
88
|
+
};
|
|
89
|
+
steps: {
|
|
90
|
+
label: string;
|
|
91
|
+
};
|
|
92
|
+
tagsInput: {
|
|
93
|
+
input: string;
|
|
94
|
+
remove: string;
|
|
95
|
+
clear: string;
|
|
96
|
+
};
|
|
97
|
+
timePicker: {
|
|
98
|
+
label: string;
|
|
99
|
+
hours: string;
|
|
100
|
+
minutes: string;
|
|
101
|
+
period: string;
|
|
102
|
+
};
|
|
103
|
+
timer: {
|
|
104
|
+
start: string;
|
|
105
|
+
pause: string;
|
|
106
|
+
reset: string;
|
|
107
|
+
};
|
|
108
|
+
toast: {
|
|
109
|
+
region: string;
|
|
110
|
+
dismiss: string;
|
|
111
|
+
};
|
|
112
|
+
toc: {
|
|
113
|
+
label: string;
|
|
114
|
+
expand: string;
|
|
115
|
+
};
|
|
116
|
+
tour: {
|
|
117
|
+
close: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** English locale — used as the default when no provider is in the tree. */
|
|
121
|
+
export declare const en: Locale;
|
|
122
|
+
/**
|
|
123
|
+
* Locale context. Components read from this via `useContext(LocaleContext)`.
|
|
124
|
+
* English defaults are provided — apps that don't call `provide()` get English for free.
|
|
125
|
+
*/
|
|
126
|
+
export declare const LocaleContext: import("@llui/dom").Context<Locale>;
|
|
127
|
+
//# sourceMappingURL=locale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../src/locale.ts"],"names":[],"mappings":"AAEA,wFAAwF;AACxF,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;QAClB,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,CA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E;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1C,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IACtC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CACxB;AAiBD,4EAA4E;AAC5E,eAAO,MAAM,EAAE,EAAE,MAmDhB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,qCAA4B,CAAA"}
|
package/dist/locale.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createContext } from '@llui/dom';
|
|
2
|
+
const MONTH_NAMES = [
|
|
3
|
+
'January',
|
|
4
|
+
'February',
|
|
5
|
+
'March',
|
|
6
|
+
'April',
|
|
7
|
+
'May',
|
|
8
|
+
'June',
|
|
9
|
+
'July',
|
|
10
|
+
'August',
|
|
11
|
+
'September',
|
|
12
|
+
'October',
|
|
13
|
+
'November',
|
|
14
|
+
'December',
|
|
15
|
+
];
|
|
16
|
+
/** English locale — used as the default when no provider is in the tree. */
|
|
17
|
+
export const en = {
|
|
18
|
+
carousel: {
|
|
19
|
+
label: 'Carousel',
|
|
20
|
+
indicators: 'Slide indicators',
|
|
21
|
+
next: 'Next slide',
|
|
22
|
+
prev: 'Previous slide',
|
|
23
|
+
slide: (i) => `Slide ${i + 1}`,
|
|
24
|
+
goToSlide: (i) => `Go to slide ${i + 1}`,
|
|
25
|
+
},
|
|
26
|
+
cascadeSelect: { clear: 'Clear selection' },
|
|
27
|
+
clipboard: { copy: 'Copy to clipboard' },
|
|
28
|
+
colorPicker: { hue: 'Hue', saturation: 'Saturation', lightness: 'Lightness', hex: 'Hex color' },
|
|
29
|
+
combobox: { toggle: 'Toggle options' },
|
|
30
|
+
dateInput: { clear: 'Clear date' },
|
|
31
|
+
datePicker: {
|
|
32
|
+
prev: 'Previous month',
|
|
33
|
+
next: 'Next month',
|
|
34
|
+
monthNames: MONTH_NAMES,
|
|
35
|
+
grid: (y, m) => `${MONTH_NAMES[m - 1]} ${y}`,
|
|
36
|
+
},
|
|
37
|
+
dialog: { close: 'Close' },
|
|
38
|
+
drawer: { close: 'Close' },
|
|
39
|
+
fileUpload: { remove: 'Remove file', clear: 'Clear files' },
|
|
40
|
+
floatingPanel: {
|
|
41
|
+
label: 'Floating panel',
|
|
42
|
+
minimize: 'Minimize',
|
|
43
|
+
maximize: 'Maximize',
|
|
44
|
+
close: 'Close',
|
|
45
|
+
},
|
|
46
|
+
imageCropper: { reset: 'Reset crop' },
|
|
47
|
+
navigationMenu: { label: 'Main navigation' },
|
|
48
|
+
numberInput: { increment: 'Increase value', decrement: 'Decrease value' },
|
|
49
|
+
pagination: {
|
|
50
|
+
label: 'Pagination',
|
|
51
|
+
prev: 'Previous page',
|
|
52
|
+
next: 'Next page',
|
|
53
|
+
page: (n) => `Page ${n}`,
|
|
54
|
+
},
|
|
55
|
+
passwordInput: { show: 'Show password', hide: 'Hide password' },
|
|
56
|
+
pinInput: { input: (i) => `Digit ${i + 1}` },
|
|
57
|
+
popover: { close: 'Close' },
|
|
58
|
+
progress: { loading: 'Loading\u2026' },
|
|
59
|
+
qrCode: { label: 'QR code', download: 'Download QR code' },
|
|
60
|
+
signaturePad: { label: 'Signature pad', clear: 'Clear signature', undo: 'Undo last stroke' },
|
|
61
|
+
steps: { label: 'Progress' },
|
|
62
|
+
tagsInput: { input: 'Add tag', remove: 'Remove tag', clear: 'Clear all tags' },
|
|
63
|
+
timePicker: { label: 'Time', hours: 'Hours', minutes: 'Minutes', period: 'Toggle AM/PM' },
|
|
64
|
+
timer: { start: 'Start timer', pause: 'Pause timer', reset: 'Reset timer' },
|
|
65
|
+
toast: { region: 'Notifications', dismiss: 'Dismiss notification' },
|
|
66
|
+
toc: { label: 'Table of contents', expand: 'Toggle section' },
|
|
67
|
+
tour: { close: 'Close tour' },
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Locale context. Components read from this via `useContext(LocaleContext)`.
|
|
71
|
+
* English defaults are provided — apps that don't call `provide()` get English for free.
|
|
72
|
+
*/
|
|
73
|
+
export const LocaleContext = createContext(en);
|
package/dist/styles/theme.css
CHANGED
|
@@ -649,7 +649,7 @@
|
|
|
649
649
|
justify-content: center;
|
|
650
650
|
font-size: 1rem;
|
|
651
651
|
font-weight: 600;
|
|
652
|
-
color: var(--color-text
|
|
652
|
+
color: var(--color-text);
|
|
653
653
|
}
|
|
654
654
|
|
|
655
655
|
/* ─── Pagination ─── */
|
|
@@ -1315,7 +1315,7 @@
|
|
|
1315
1315
|
padding: var(--space-1) var(--space-2);
|
|
1316
1316
|
border: 0;
|
|
1317
1317
|
background: var(--color-surface-hover);
|
|
1318
|
-
color: var(--color-text
|
|
1318
|
+
color: var(--color-text);
|
|
1319
1319
|
font-size: 0.75rem;
|
|
1320
1320
|
font-weight: 600;
|
|
1321
1321
|
cursor: pointer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the text direction for an element by walking up the DOM tree.
|
|
3
|
+
* Returns 'rtl' or 'ltr' (default).
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolveDir(el: Element): 'ltr' | 'rtl';
|
|
6
|
+
/**
|
|
7
|
+
* Map an arrow key to its logical direction, accounting for RTL.
|
|
8
|
+
* In RTL, ArrowLeft and ArrowRight swap; vertical arrows are unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export declare function flipArrow(key: string, el: Element | null): string;
|
|
11
|
+
//# sourceMappingURL=direction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../src/utils/direction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,CAKrD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAMjE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the text direction for an element by walking up the DOM tree.
|
|
3
|
+
* Returns 'rtl' or 'ltr' (default).
|
|
4
|
+
*/
|
|
5
|
+
export function resolveDir(el) {
|
|
6
|
+
const ancestor = el.closest('[dir]');
|
|
7
|
+
if (ancestor)
|
|
8
|
+
return ancestor.getAttribute('dir') === 'rtl' ? 'rtl' : 'ltr';
|
|
9
|
+
if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl')
|
|
10
|
+
return 'rtl';
|
|
11
|
+
return 'ltr';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Map an arrow key to its logical direction, accounting for RTL.
|
|
15
|
+
* In RTL, ArrowLeft and ArrowRight swap; vertical arrows are unchanged.
|
|
16
|
+
*/
|
|
17
|
+
export function flipArrow(key, el) {
|
|
18
|
+
if (key !== 'ArrowLeft' && key !== 'ArrowRight')
|
|
19
|
+
return key;
|
|
20
|
+
if (!el)
|
|
21
|
+
return key;
|
|
22
|
+
const rtl = resolveDir(el) === 'rtl';
|
|
23
|
+
if (!rtl)
|
|
24
|
+
return key;
|
|
25
|
+
return key === 'ArrowLeft' ? 'ArrowRight' : 'ArrowLeft';
|
|
26
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ export type { FloatingOptions, Placement } from './floating';
|
|
|
15
15
|
export { typeaheadAccumulate, typeaheadMatch, typeaheadMatchByItems, isTypeaheadKey, TYPEAHEAD_TIMEOUT_MS, } from './typeahead';
|
|
16
16
|
export { TreeCollection } from './tree-collection';
|
|
17
17
|
export type { TreeNode } from './tree-collection';
|
|
18
|
+
export { resolveDir, flipArrow } from './direction';
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/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,MAAM,oBAAoB,CAAA;AACzD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACzD,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE5D,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,oBAAoB,GACrB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/utils/index.js
CHANGED
|
@@ -8,3 +8,4 @@ export { getFocusables, isFocusable } from './focusables';
|
|
|
8
8
|
export { attachFloating } from './floating';
|
|
9
9
|
export { typeaheadAccumulate, typeaheadMatch, typeaheadMatchByItems, isTypeaheadKey, TYPEAHEAD_TIMEOUT_MS, } from './typeahead';
|
|
10
10
|
export { TreeCollection } from './tree-collection';
|
|
11
|
+
export { resolveDir, flipArrow } from './direction';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable validators returning `string | null` (null = valid).
|
|
3
|
+
*
|
|
4
|
+
* Use `compose(v1, v2, ...)` to run until first failure (short-circuit),
|
|
5
|
+
* or `validateAll(v1, v2, ...)` to collect all errors as `string[]`.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const username = compose(required(), minLength(3), pattern(/^[a-z]+$/i))
|
|
9
|
+
* username('') // 'Required'
|
|
10
|
+
* username('ab') // 'Must be at least 3 characters'
|
|
11
|
+
* username('foo') // null
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export type Validator<T> = (value: T) => string | null;
|
|
15
|
+
export declare function required(message?: string): Validator<unknown>;
|
|
16
|
+
export declare function minLength(n: number, message?: string): Validator<string>;
|
|
17
|
+
export declare function maxLength(n: number, message?: string): Validator<string>;
|
|
18
|
+
export declare function pattern(regex: RegExp, message?: string): Validator<string>;
|
|
19
|
+
export declare function email(message?: string): Validator<string>;
|
|
20
|
+
export declare function url(message?: string): Validator<string>;
|
|
21
|
+
export declare function min(n: number, message?: string): Validator<number>;
|
|
22
|
+
export declare function max(n: number, message?: string): Validator<number>;
|
|
23
|
+
export declare function integer(message?: string): Validator<number>;
|
|
24
|
+
export declare function positive(message?: string): Validator<number>;
|
|
25
|
+
/**
|
|
26
|
+
* Run validators in order, returning the first error (or null if all pass).
|
|
27
|
+
*/
|
|
28
|
+
export declare function compose<T>(...validators: Validator<T>[]): Validator<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Run every validator and collect all errors. Returns empty array when valid.
|
|
31
|
+
* Use when you want to display multiple errors at once (e.g. password rules).
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateAll<T>(...validators: Validator<T>[]): (value: T) => string[];
|
|
34
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,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K,EAAE,CAAC,KAAK,MAAM,EAAE,CASpF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function isEmpty(v) {
|
|
2
|
+
if (v === null || v === undefined)
|
|
3
|
+
return true;
|
|
4
|
+
if (typeof v === 'string' && v.length === 0)
|
|
5
|
+
return true;
|
|
6
|
+
if (Array.isArray(v) && v.length === 0)
|
|
7
|
+
return true;
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
export function required(message = 'Required') {
|
|
11
|
+
return (value) => (isEmpty(value) ? message : null);
|
|
12
|
+
}
|
|
13
|
+
export function minLength(n, message) {
|
|
14
|
+
const msg = message ?? `Must be at least ${n} characters`;
|
|
15
|
+
return (value) => (value.length < n ? msg : null);
|
|
16
|
+
}
|
|
17
|
+
export function maxLength(n, message) {
|
|
18
|
+
const msg = message ?? `Must be at most ${n} characters`;
|
|
19
|
+
return (value) => (value.length > n ? msg : null);
|
|
20
|
+
}
|
|
21
|
+
export function pattern(regex, message = 'Invalid format') {
|
|
22
|
+
return (value) => (regex.test(value) ? null : message);
|
|
23
|
+
}
|
|
24
|
+
// RFC 5322 simplified — accepts most valid emails, rejects obvious garbage
|
|
25
|
+
const EMAIL_RE = /^[^\s@]+@[^\s@.]+(\.[^\s@.]+)+$/;
|
|
26
|
+
export function email(message = 'Invalid email') {
|
|
27
|
+
return (value) => (EMAIL_RE.test(value) ? null : message);
|
|
28
|
+
}
|
|
29
|
+
export function url(message = 'Invalid URL') {
|
|
30
|
+
return (value) => {
|
|
31
|
+
try {
|
|
32
|
+
const u = new URL(value);
|
|
33
|
+
if (u.protocol !== 'http:' && u.protocol !== 'https:')
|
|
34
|
+
return message;
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return message;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function min(n, message) {
|
|
43
|
+
const msg = message ?? `Must be at least ${n}`;
|
|
44
|
+
return (value) => (value < n ? msg : null);
|
|
45
|
+
}
|
|
46
|
+
export function max(n, message) {
|
|
47
|
+
const msg = message ?? `Must be at most ${n}`;
|
|
48
|
+
return (value) => (value > n ? msg : null);
|
|
49
|
+
}
|
|
50
|
+
export function integer(message = 'Must be an integer') {
|
|
51
|
+
return (value) => (Number.isInteger(value) ? null : message);
|
|
52
|
+
}
|
|
53
|
+
export function positive(message = 'Must be positive') {
|
|
54
|
+
return (value) => (value > 0 ? null : message);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Run validators in order, returning the first error (or null if all pass).
|
|
58
|
+
*/
|
|
59
|
+
export function compose(...validators) {
|
|
60
|
+
return (value) => {
|
|
61
|
+
for (const v of validators) {
|
|
62
|
+
const err = v(value);
|
|
63
|
+
if (err !== null)
|
|
64
|
+
return err;
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Run every validator and collect all errors. Returns empty array when valid.
|
|
71
|
+
* Use when you want to display multiple errors at once (e.g. password rules).
|
|
72
|
+
*/
|
|
73
|
+
export function validateAll(...validators) {
|
|
74
|
+
return (value) => {
|
|
75
|
+
const errors = [];
|
|
76
|
+
for (const v of validators) {
|
|
77
|
+
const err = v(value);
|
|
78
|
+
if (err !== null)
|
|
79
|
+
errors.push(err);
|
|
80
|
+
}
|
|
81
|
+
return errors;
|
|
82
|
+
};
|
|
83
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llui/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -463,7 +463,7 @@
|
|
|
463
463
|
"test": "vitest run"
|
|
464
464
|
},
|
|
465
465
|
"peerDependencies": {
|
|
466
|
-
"@llui/dom": "^0.0.
|
|
466
|
+
"@llui/dom": "^0.0.7"
|
|
467
467
|
},
|
|
468
468
|
"devDependencies": {
|
|
469
469
|
"@llui/dom": "workspace:*",
|
|
@@ -475,7 +475,8 @@
|
|
|
475
475
|
"./dist/styles/theme-dark.css"
|
|
476
476
|
],
|
|
477
477
|
"dependencies": {
|
|
478
|
-
"@floating-ui/dom": "^1.7.6"
|
|
478
|
+
"@floating-ui/dom": "^1.7.6",
|
|
479
|
+
"@standard-schema/spec": "^1.0.0"
|
|
479
480
|
},
|
|
480
481
|
"description": "54 headless UI components for LLui — accordion, dialog, tabs, select, tree-view, timer, tour, and more",
|
|
481
482
|
"keywords": [
|