@pathscale/ui 1.1.34 → 1.1.35
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/button/Button.css +10 -1
- package/dist/components/button/Button.d.ts +2 -0
- package/dist/components/button/Button.js +31 -6
- package/dist/components/button-group/ButtonGroup.css +117 -0
- package/dist/components/button-group/ButtonGroup.d.ts +23 -0
- package/dist/components/button-group/ButtonGroup.js +91 -0
- package/dist/components/button-group/context.d.ts +8 -0
- package/dist/components/button-group/context.js +3 -0
- package/dist/components/button-group/index.d.ts +1 -0
- package/dist/components/button-group/index.js +6 -0
- package/dist/components/card/Card.css +110 -0
- package/dist/components/card/Card.d.ts +26 -26
- package/dist/components/card/Card.js +131 -70
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +6 -1
- package/dist/components/checkbox/Checkbox.js +18 -4
- package/dist/components/checkbox-group/CheckboxGroup.css +10 -0
- package/dist/components/checkbox-group/CheckboxGroup.d.ts +18 -0
- package/dist/components/checkbox-group/CheckboxGroup.js +97 -0
- package/dist/components/checkbox-group/context.d.ts +11 -0
- package/dist/components/checkbox-group/context.js +3 -0
- package/dist/components/checkbox-group/index.d.ts +4 -0
- package/dist/components/checkbox-group/index.js +4 -0
- package/dist/components/chip/Chip.css +11 -9
- package/dist/components/chip/Chip.d.ts +2 -2
- package/dist/components/chip/Chip.js +38 -30
- package/dist/components/close-button/CloseButton.css +81 -0
- package/dist/components/close-button/CloseButton.d.ts +14 -0
- package/dist/components/close-button/CloseButton.js +76 -0
- package/dist/components/close-button/index.d.ts +1 -0
- package/dist/components/close-button/index.js +3 -0
- package/dist/components/combo-box/ComboBox.css +344 -0
- package/dist/components/combo-box/ComboBox.d.ts +86 -0
- package/dist/components/combo-box/ComboBox.js +708 -0
- package/dist/components/combo-box/index.d.ts +1 -0
- package/dist/components/combo-box/index.js +10 -0
- package/dist/components/date-field/DateField.css +215 -0
- package/dist/components/date-field/DateField.d.ts +64 -0
- package/dist/components/date-field/DateField.js +341 -0
- package/dist/components/date-field/index.d.ts +1 -0
- package/dist/components/date-field/index.js +11 -0
- package/dist/components/description/Description.css +10 -0
- package/dist/components/description/Description.d.ts +11 -0
- package/dist/components/{form/Label.js → description/Description.js} +23 -14
- package/dist/components/description/index.d.ts +1 -0
- package/dist/components/description/index.js +5 -0
- package/dist/components/drawer/Drawer.css +15 -0
- package/dist/components/drawer/Drawer.d.ts +2 -0
- package/dist/components/drawer/Drawer.js +24 -16
- package/dist/components/error-message/ErrorMessage.css +20 -0
- package/dist/components/error-message/ErrorMessage.d.ts +11 -0
- package/dist/components/error-message/ErrorMessage.js +40 -0
- package/dist/components/error-message/index.d.ts +1 -0
- package/dist/components/error-message/index.js +5 -0
- package/dist/components/field-error/FieldError.css +27 -0
- package/dist/components/field-error/FieldError.d.ts +21 -0
- package/dist/components/field-error/FieldError.js +69 -0
- package/dist/components/field-error/index.d.ts +1 -0
- package/dist/components/field-error/index.js +5 -0
- package/dist/components/fieldset/Fieldset.css +30 -0
- package/dist/components/fieldset/Fieldset.d.ts +22 -9
- package/dist/components/fieldset/Fieldset.js +88 -44
- package/dist/components/fieldset/index.d.ts +1 -2
- package/dist/components/fieldset/index.js +7 -2
- package/dist/components/form/Form.css +5 -0
- package/dist/components/form/Form.d.ts +10 -16
- package/dist/components/form/Form.js +33 -16
- package/dist/components/form/index.d.ts +1 -4
- package/dist/components/form/index.js +3 -4
- package/dist/components/header/Header.css +13 -0
- package/dist/components/header/Header.d.ts +9 -0
- package/dist/components/{menu/MenuDetails.js → header/Header.js} +17 -20
- package/dist/components/header/index.d.ts +1 -0
- package/dist/components/header/index.js +5 -0
- package/dist/components/immersive-landing/components/FirefoxPWABanner.js +62 -68
- package/dist/components/immersive-landing/components/PWAInstallPrompt.js +58 -64
- package/dist/components/input/Input.css +3 -2
- package/dist/components/input/Input.d.ts +2 -2
- package/dist/components/input/Input.js +7 -7
- package/dist/components/input-group/InputGroup.css +172 -0
- package/dist/components/input-group/InputGroup.d.ts +44 -0
- package/dist/components/input-group/InputGroup.js +227 -0
- package/dist/components/input-group/index.d.ts +1 -0
- package/dist/components/input-group/index.js +9 -0
- package/dist/components/input-otp/InputOTP.css +170 -0
- package/dist/components/input-otp/InputOTP.d.ts +46 -0
- package/dist/components/input-otp/InputOTP.js +385 -0
- package/dist/components/input-otp/index.d.ts +1 -0
- package/dist/components/input-otp/index.js +11 -0
- package/dist/components/label/Label.css +30 -0
- package/dist/components/label/Label.d.ts +17 -0
- package/dist/components/label/Label.js +64 -0
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/label/index.js +5 -0
- package/dist/components/list-box/ListBox.css +148 -0
- package/dist/components/list-box/ListBox.d.ts +23 -0
- package/dist/components/list-box/ListBox.js +224 -0
- package/dist/components/list-box/ListBoxItem.d.ts +28 -0
- package/dist/components/list-box/ListBoxItem.js +231 -0
- package/dist/components/list-box/ListBoxSection.d.ts +11 -0
- package/dist/components/list-box/ListBoxSection.js +48 -0
- package/dist/components/list-box/context.d.ts +27 -0
- package/dist/components/list-box/context.js +3 -0
- package/dist/components/list-box/index.d.ts +17 -0
- package/dist/components/list-box/index.js +17 -0
- package/dist/components/menu/Menu.css +199 -0
- package/dist/components/menu/Menu.d.ts +32 -20
- package/dist/components/menu/Menu.js +213 -39
- package/dist/components/menu/MenuItem.d.ts +35 -5
- package/dist/components/menu/MenuItem.js +270 -19
- package/dist/components/menu/MenuSection.d.ts +11 -0
- package/dist/components/menu/MenuSection.js +48 -0
- package/dist/components/menu/context.d.ts +26 -0
- package/dist/components/menu/context.js +3 -0
- package/dist/components/menu/index.d.ts +4 -3
- package/dist/components/menu/index.js +11 -2
- package/dist/components/number-field/NumberField.css +198 -0
- package/dist/components/number-field/NumberField.d.ts +48 -0
- package/dist/components/number-field/NumberField.js +350 -0
- package/dist/components/number-field/index.d.ts +1 -0
- package/dist/components/number-field/index.js +9 -0
- package/dist/components/search-field/SearchField.css +183 -0
- package/dist/components/search-field/SearchField.d.ts +53 -0
- package/dist/components/search-field/SearchField.js +303 -0
- package/dist/components/search-field/index.d.ts +1 -0
- package/dist/components/search-field/index.js +9 -0
- package/dist/components/select/Select.css +16 -10
- package/dist/components/select/Select.d.ts +10 -2
- package/dist/components/select/Select.js +119 -33
- package/dist/components/separator/Separator.css +35 -0
- package/dist/components/separator/Separator.d.ts +12 -0
- package/dist/components/separator/Separator.js +57 -0
- package/dist/components/separator/index.d.ts +1 -0
- package/dist/components/separator/index.js +4 -0
- package/dist/components/sidenav/Sidenav.js +2 -2
- package/dist/components/surface/Surface.css +37 -0
- package/dist/components/surface/Surface.d.ts +12 -0
- package/dist/components/surface/Surface.js +41 -0
- package/dist/components/surface/index.d.ts +1 -0
- package/dist/components/surface/index.js +4 -0
- package/dist/components/table/hooks/index.d.ts +1 -9
- package/dist/components/table/hooks/index.js +1 -18
- package/dist/components/tag/Tag.css +121 -0
- package/dist/components/tag/Tag.d.ts +33 -0
- package/dist/components/tag/Tag.js +241 -0
- package/dist/components/tag/index.d.ts +1 -0
- package/dist/components/tag/index.js +6 -0
- package/dist/components/tag-group/TagGroup.css +22 -0
- package/dist/components/tag-group/TagGroup.d.ts +32 -0
- package/dist/components/tag-group/TagGroup.js +177 -0
- package/dist/components/tag-group/context.d.ts +15 -0
- package/dist/components/tag-group/context.js +3 -0
- package/dist/components/tag-group/index.d.ts +2 -0
- package/dist/components/tag-group/index.js +6 -0
- package/dist/components/text/Text.css +66 -0
- package/dist/components/text/Text.d.ts +17 -0
- package/dist/components/text/Text.js +46 -0
- package/dist/components/text/index.d.ts +1 -0
- package/dist/components/text/index.js +5 -0
- package/dist/components/text-area/TextArea.css +95 -0
- package/dist/components/text-area/TextArea.d.ts +19 -0
- package/dist/components/text-area/TextArea.js +64 -0
- package/dist/components/text-area/index.d.ts +1 -0
- package/dist/components/text-area/index.js +5 -0
- package/dist/components/text-field/TextField.css +33 -0
- package/dist/components/text-field/TextField.d.ts +34 -0
- package/dist/components/text-field/TextField.js +85 -0
- package/dist/components/text-field/index.d.ts +1 -0
- package/dist/components/text-field/index.js +7 -0
- package/dist/components/textarea/Textarea.d.ts +8 -13
- package/dist/components/textarea/Textarea.js +14 -45
- package/dist/components/textarea/index.d.ts +2 -1
- package/dist/components/textarea/index.js +4 -1
- package/dist/components/time-field/TimeField.css +215 -0
- package/dist/components/time-field/TimeField.d.ts +64 -0
- package/dist/components/time-field/TimeField.js +341 -0
- package/dist/components/time-field/index.d.ts +1 -0
- package/dist/components/time-field/index.js +11 -0
- package/dist/components/utils.d.ts +2 -2
- package/dist/components/utils.js +3 -17
- package/dist/hooks/form/index.d.ts +5 -0
- package/dist/hooks/form/index.js +12 -0
- package/dist/hooks/form/useField.d.ts +11 -0
- package/dist/hooks/form/useField.js +20 -0
- package/dist/hooks/form/useFieldError.d.ts +3 -0
- package/dist/hooks/form/useFieldError.js +3 -0
- package/dist/hooks/form/useFieldMeta.d.ts +20 -0
- package/dist/hooks/form/useFieldMeta.js +49 -0
- package/dist/hooks/form/useFieldProps.d.ts +10 -0
- package/dist/hooks/form/useFieldProps.js +51 -0
- package/dist/hooks/form/useForm.d.ts +27 -0
- package/dist/hooks/form/useForm.js +54 -0
- package/dist/hooks/form/utils.d.ts +4 -0
- package/dist/hooks/form/utils.js +30 -0
- package/dist/hooks/layout/index.d.ts +1 -0
- package/dist/hooks/layout/index.js +3 -0
- package/dist/hooks/layout/useDesktop.d.ts +1 -0
- package/dist/hooks/layout/useDesktop.js +17 -0
- package/dist/hooks/table/index.d.ts +9 -0
- package/dist/hooks/table/index.js +18 -0
- package/dist/index.d.ts +59 -7
- package/dist/index.js +140 -15
- package/dist/styles/icons/generated-icons.css +1 -1
- package/package.json +1 -1
- package/dist/components/card/CardActions.d.ts +0 -4
- package/dist/components/card/CardActions.js +0 -15
- package/dist/components/card/CardBody.d.ts +0 -4
- package/dist/components/card/CardBody.js +0 -15
- package/dist/components/card/CardImage.d.ts +0 -3
- package/dist/components/card/CardImage.js +0 -10
- package/dist/components/card/CardTitle.d.ts +0 -6
- package/dist/components/card/CardTitle.js +0 -13
- package/dist/components/card/card.css +0 -171
- package/dist/components/form/FormBase.d.ts +0 -8
- package/dist/components/form/FormBase.js +0 -74
- package/dist/components/form/FormDropdown.d.ts +0 -25
- package/dist/components/form/FormDropdown.js +0 -139
- package/dist/components/form/FormField.d.ts +0 -14
- package/dist/components/form/FormField.js +0 -78
- package/dist/components/form/Label.d.ts +0 -7
- package/dist/components/form/NumberField.d.ts +0 -20
- package/dist/components/form/NumberField.js +0 -109
- package/dist/components/form/PasswordField.d.ts +0 -16
- package/dist/components/form/PasswordField.js +0 -113
- package/dist/components/form/ValidatedForm.d.ts +0 -26
- package/dist/components/form/ValidatedForm.js +0 -55
- package/dist/components/menu/MenuDetails.d.ts +0 -8
- package/dist/components/menu/MenuDropdown.d.ts +0 -12
- package/dist/components/menu/MenuDropdown.js +0 -48
- package/dist/components/menu/MenuTitle.d.ts +0 -8
- package/dist/components/menu/MenuTitle.js +0 -22
- package/dist/components/menu/menu.css +0 -364
- package/dist/components/textarea/textarea.css +0 -191
- /package/dist/{components/table/hooks → hooks/table}/helpers.d.ts +0 -0
- /package/dist/{components/table/hooks → hooks/table}/helpers.js +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useAnchoredOverlayPosition.d.ts +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useAnchoredOverlayPosition.js +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableExpansion.d.ts +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableExpansion.js +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableFiltering.d.ts +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableFiltering.js +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableModel.d.ts +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableModel.js +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTablePagination.d.ts +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTablePagination.js +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableSelection.d.ts +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableSelection.js +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableSorting.d.ts +0 -0
- /package/dist/{components/table/hooks → hooks/table}/useTableSorting.js +0 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__ from "solid-js/web";
|
|
2
|
+
import "./InputOTP.css";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__ from "solid-js";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
|
|
5
|
+
var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div><input data-slot=input-otp-input type=text autocomplete=one-time-code>"), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div>"), _tmpl$3 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div class=input-otp__slot-value data-slot=input-otp-slot-value>"), _tmpl$4 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<div class=input-otp__caret data-slot=input-otp-caret>");
|
|
6
|
+
const VARIANT_CLASS_MAP = {
|
|
7
|
+
primary: "input-otp--primary",
|
|
8
|
+
secondary: "input-otp--secondary"
|
|
9
|
+
};
|
|
10
|
+
const REGEXP_ONLY_DIGITS = "^\\d+$";
|
|
11
|
+
const REGEXP_ONLY_CHARS = "^[a-zA-Z]+$";
|
|
12
|
+
const REGEXP_ONLY_DIGITS_AND_CHARS = "^[a-zA-Z0-9]+$";
|
|
13
|
+
const InputOTPContext = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createContext)();
|
|
14
|
+
const clamp = (value, min, max)=>Math.min(max, Math.max(min, value));
|
|
15
|
+
const invokeEventHandler = (handler, event)=>{
|
|
16
|
+
if ("function" == typeof handler) return void handler(event);
|
|
17
|
+
if (Array.isArray(handler) && "function" == typeof handler[0]) handler[0](handler[1], event);
|
|
18
|
+
};
|
|
19
|
+
const InputOTPRoot = (props)=>{
|
|
20
|
+
const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
21
|
+
"children",
|
|
22
|
+
"class",
|
|
23
|
+
"className",
|
|
24
|
+
"dataTheme",
|
|
25
|
+
"style",
|
|
26
|
+
"value",
|
|
27
|
+
"defaultValue",
|
|
28
|
+
"onChange",
|
|
29
|
+
"onComplete",
|
|
30
|
+
"maxLength",
|
|
31
|
+
"variant",
|
|
32
|
+
"pattern",
|
|
33
|
+
"name",
|
|
34
|
+
"autoFocus",
|
|
35
|
+
"isDisabled",
|
|
36
|
+
"disabled",
|
|
37
|
+
"isInvalid",
|
|
38
|
+
"inputClassName",
|
|
39
|
+
"inputMode",
|
|
40
|
+
"onMouseDown",
|
|
41
|
+
"onFocusOut",
|
|
42
|
+
"aria-invalid",
|
|
43
|
+
"ref"
|
|
44
|
+
]);
|
|
45
|
+
let inputRef;
|
|
46
|
+
let rootRef;
|
|
47
|
+
const [internalValue, setInternalValue] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(local.defaultValue ?? "");
|
|
48
|
+
const [activeIndex, setActiveIndexSignal] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(0);
|
|
49
|
+
const [isFocused, setIsFocused] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(false);
|
|
50
|
+
const maxLength = ()=>{
|
|
51
|
+
const parsed = Number(local.maxLength);
|
|
52
|
+
if (!Number.isFinite(parsed)) return 6;
|
|
53
|
+
return Math.max(1, Math.floor(parsed));
|
|
54
|
+
};
|
|
55
|
+
const patternRegex = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
|
|
56
|
+
if (!local.pattern) return;
|
|
57
|
+
try {
|
|
58
|
+
return new RegExp(local.pattern);
|
|
59
|
+
} catch {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const isAllowedCharacter = (char)=>{
|
|
64
|
+
const regex = patternRegex();
|
|
65
|
+
if (!regex) return true;
|
|
66
|
+
return regex.test(char);
|
|
67
|
+
};
|
|
68
|
+
const sanitizeValue = (rawValue)=>{
|
|
69
|
+
if (!rawValue) return "";
|
|
70
|
+
const result = [];
|
|
71
|
+
for (const char of Array.from(rawValue))if (isAllowedCharacter(char)) {
|
|
72
|
+
result.push(char);
|
|
73
|
+
if (result.length >= maxLength()) break;
|
|
74
|
+
}
|
|
75
|
+
return result.join("");
|
|
76
|
+
};
|
|
77
|
+
const normalizedControlledValue = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>sanitizeValue(local.value ?? ""));
|
|
78
|
+
const value = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>void 0 !== local.value ? normalizedControlledValue() : sanitizeValue(internalValue()));
|
|
79
|
+
const chars = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
|
|
80
|
+
const current = value();
|
|
81
|
+
return Array.from({
|
|
82
|
+
length: maxLength()
|
|
83
|
+
}, (_, index)=>current[index] ?? "");
|
|
84
|
+
});
|
|
85
|
+
const variant = ()=>local.variant ?? "primary";
|
|
86
|
+
const isDisabled = ()=>Boolean(local.isDisabled) || Boolean(local.disabled);
|
|
87
|
+
const isInvalid = ()=>Boolean(local.isInvalid) || Boolean(local["aria-invalid"]) || "true" === local["aria-invalid"];
|
|
88
|
+
const setValue = (nextValue)=>{
|
|
89
|
+
const normalized = sanitizeValue(nextValue);
|
|
90
|
+
const current = value();
|
|
91
|
+
if (normalized === current) return;
|
|
92
|
+
if (void 0 === local.value) setInternalValue(normalized);
|
|
93
|
+
local.onChange?.(normalized);
|
|
94
|
+
if (normalized.length === maxLength()) local.onComplete?.(normalized);
|
|
95
|
+
};
|
|
96
|
+
const normalizeIndex = (index)=>{
|
|
97
|
+
const bounded = clamp(index, 0, maxLength());
|
|
98
|
+
return bounded;
|
|
99
|
+
};
|
|
100
|
+
const resolveActiveSlot = (caret)=>{
|
|
101
|
+
const bounded = normalizeIndex(caret);
|
|
102
|
+
if (bounded >= maxLength()) return maxLength() - 1;
|
|
103
|
+
return bounded;
|
|
104
|
+
};
|
|
105
|
+
const syncActiveFromInputCaret = ()=>{
|
|
106
|
+
const caret = inputRef?.selectionStart;
|
|
107
|
+
if (null == caret) {
|
|
108
|
+
const firstEmpty = chars().findIndex((char)=>0 === char.length);
|
|
109
|
+
setActiveIndexSignal(firstEmpty >= 0 ? firstEmpty : maxLength() - 1);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
setActiveIndexSignal(resolveActiveSlot(caret));
|
|
113
|
+
};
|
|
114
|
+
const focusInputAt = (index)=>{
|
|
115
|
+
if (isDisabled()) return;
|
|
116
|
+
const bounded = normalizeIndex(index);
|
|
117
|
+
const input = inputRef;
|
|
118
|
+
if (!input) return;
|
|
119
|
+
input.focus();
|
|
120
|
+
input.setSelectionRange(bounded, bounded);
|
|
121
|
+
setActiveIndexSignal(resolveActiveSlot(bounded));
|
|
122
|
+
};
|
|
123
|
+
const handleRootMouseDown = (event)=>{
|
|
124
|
+
invokeEventHandler(local.onMouseDown, event);
|
|
125
|
+
if (event.defaultPrevented || isDisabled()) return;
|
|
126
|
+
const target = event.target;
|
|
127
|
+
if (target.closest('[data-slot="input-otp-slot"]')) return;
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
focusInputAt(value().length);
|
|
130
|
+
};
|
|
131
|
+
const handleFocusOut = (event)=>{
|
|
132
|
+
invokeEventHandler(local.onFocusOut, event);
|
|
133
|
+
if (event.defaultPrevented) return;
|
|
134
|
+
const nextTarget = event.relatedTarget;
|
|
135
|
+
if (rootRef?.contains(nextTarget)) return;
|
|
136
|
+
setIsFocused(false);
|
|
137
|
+
};
|
|
138
|
+
const handleInput = (event)=>{
|
|
139
|
+
if (isDisabled()) return;
|
|
140
|
+
setValue(event.currentTarget.value);
|
|
141
|
+
queueMicrotask(syncActiveFromInputCaret);
|
|
142
|
+
};
|
|
143
|
+
const handleKeyDown = (event)=>{
|
|
144
|
+
if (event.defaultPrevented || isDisabled()) return;
|
|
145
|
+
if ("ArrowLeft" === event.key || "ArrowRight" === event.key || "Backspace" === event.key || "Delete" === event.key || "Home" === event.key || "End" === event.key) queueMicrotask(syncActiveFromInputCaret);
|
|
146
|
+
};
|
|
147
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
|
|
148
|
+
const current = value();
|
|
149
|
+
if (current.length > maxLength()) setValue(current.slice(0, maxLength()));
|
|
150
|
+
});
|
|
151
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
|
|
152
|
+
if (void 0 !== local.value) return;
|
|
153
|
+
const normalized = sanitizeValue(internalValue());
|
|
154
|
+
if (normalized !== internalValue()) setInternalValue(normalized);
|
|
155
|
+
});
|
|
156
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
|
|
157
|
+
if (!isFocused()) return;
|
|
158
|
+
const active = clamp(activeIndex(), 0, maxLength());
|
|
159
|
+
inputRef?.setSelectionRange(active, active);
|
|
160
|
+
});
|
|
161
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onMount)(()=>{
|
|
162
|
+
if (!local.autoFocus || isDisabled()) return;
|
|
163
|
+
queueMicrotask(()=>{
|
|
164
|
+
focusInputAt(value().length);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(InputOTPContext.Provider, {
|
|
168
|
+
value: {
|
|
169
|
+
value,
|
|
170
|
+
chars,
|
|
171
|
+
maxLength,
|
|
172
|
+
variant,
|
|
173
|
+
isDisabled,
|
|
174
|
+
isInvalid,
|
|
175
|
+
isFocused,
|
|
176
|
+
activeIndex,
|
|
177
|
+
setActiveIndex: (index)=>setActiveIndexSignal(resolveActiveSlot(index)),
|
|
178
|
+
focusInputAt
|
|
179
|
+
},
|
|
180
|
+
get children () {
|
|
181
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild;
|
|
182
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)((node)=>{
|
|
183
|
+
rootRef = node;
|
|
184
|
+
if ("function" == typeof local.ref) local.ref(node);
|
|
185
|
+
}, _el$);
|
|
186
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(others, {
|
|
187
|
+
get ["class"] () {
|
|
188
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("input-otp", VARIANT_CLASS_MAP[variant()], local.class, local.className);
|
|
189
|
+
},
|
|
190
|
+
"data-slot": "input-otp",
|
|
191
|
+
get ["data-disabled"] () {
|
|
192
|
+
return isDisabled() ? "true" : void 0;
|
|
193
|
+
},
|
|
194
|
+
get ["data-invalid"] () {
|
|
195
|
+
return isInvalid() ? "true" : void 0;
|
|
196
|
+
},
|
|
197
|
+
get ["data-theme"] () {
|
|
198
|
+
return local.dataTheme;
|
|
199
|
+
},
|
|
200
|
+
get style () {
|
|
201
|
+
return local.style;
|
|
202
|
+
},
|
|
203
|
+
onMouseDown: handleRootMouseDown,
|
|
204
|
+
onFocusOut: handleFocusOut
|
|
205
|
+
}), false, true);
|
|
206
|
+
_el$2.addEventListener("select", ()=>syncActiveFromInputCaret());
|
|
207
|
+
_el$2.$$keydown = handleKeyDown;
|
|
208
|
+
_el$2.$$input = handleInput;
|
|
209
|
+
_el$2.addEventListener("focus", ()=>{
|
|
210
|
+
setIsFocused(true);
|
|
211
|
+
syncActiveFromInputCaret();
|
|
212
|
+
});
|
|
213
|
+
var _ref$ = inputRef;
|
|
214
|
+
"function" == typeof _ref$ ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)(_ref$, _el$2) : inputRef = _el$2;
|
|
215
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$, ()=>local.children ?? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(InputOTPGroup, {
|
|
216
|
+
get children () {
|
|
217
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
218
|
+
get each () {
|
|
219
|
+
return Array.from({
|
|
220
|
+
length: maxLength()
|
|
221
|
+
}, (_, index)=>index);
|
|
222
|
+
},
|
|
223
|
+
children: (index)=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(InputOTPSlot, {
|
|
224
|
+
index: index
|
|
225
|
+
})
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}), null);
|
|
229
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
|
|
230
|
+
var _v$ = (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("input-otp__input", local.inputClassName), _v$2 = local.inputMode, _v$3 = local.pattern, _v$4 = maxLength(), _v$5 = local.name, _v$6 = isDisabled(), _v$7 = isDisabled() ? "true" : void 0, _v$8 = isInvalid() ? "true" : void 0;
|
|
231
|
+
_v$ !== _p$.e && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$2, _p$.e = _v$);
|
|
232
|
+
_v$2 !== _p$.t && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$2, "inputmode", _p$.t = _v$2);
|
|
233
|
+
_v$3 !== _p$.a && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$2, "pattern", _p$.a = _v$3);
|
|
234
|
+
_v$4 !== _p$.o && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$2, "maxlength", _p$.o = _v$4);
|
|
235
|
+
_v$5 !== _p$.i && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$2, "name", _p$.i = _v$5);
|
|
236
|
+
_v$6 !== _p$.n && (_el$2.disabled = _p$.n = _v$6);
|
|
237
|
+
_v$7 !== _p$.s && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$2, "aria-disabled", _p$.s = _v$7);
|
|
238
|
+
_v$8 !== _p$.h && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$2, "aria-invalid", _p$.h = _v$8);
|
|
239
|
+
return _p$;
|
|
240
|
+
}, {
|
|
241
|
+
e: void 0,
|
|
242
|
+
t: void 0,
|
|
243
|
+
a: void 0,
|
|
244
|
+
o: void 0,
|
|
245
|
+
i: void 0,
|
|
246
|
+
n: void 0,
|
|
247
|
+
s: void 0,
|
|
248
|
+
h: void 0
|
|
249
|
+
});
|
|
250
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)(()=>_el$2.value = value());
|
|
251
|
+
return _el$;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
const InputOTPGroup = (props)=>{
|
|
256
|
+
const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
257
|
+
"children",
|
|
258
|
+
"class",
|
|
259
|
+
"className",
|
|
260
|
+
"dataTheme",
|
|
261
|
+
"style"
|
|
262
|
+
]);
|
|
263
|
+
return (()=>{
|
|
264
|
+
var _el$3 = _tmpl$2();
|
|
265
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$3, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(others, {
|
|
266
|
+
get ["class"] () {
|
|
267
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("input-otp__group", local.class, local.className);
|
|
268
|
+
},
|
|
269
|
+
"data-slot": "input-otp-group",
|
|
270
|
+
get ["data-theme"] () {
|
|
271
|
+
return local.dataTheme;
|
|
272
|
+
},
|
|
273
|
+
get style () {
|
|
274
|
+
return local.style;
|
|
275
|
+
}
|
|
276
|
+
}), false, true);
|
|
277
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$3, ()=>local.children);
|
|
278
|
+
return _el$3;
|
|
279
|
+
})();
|
|
280
|
+
};
|
|
281
|
+
const InputOTPSlot = (props)=>{
|
|
282
|
+
const context = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.useContext)(InputOTPContext);
|
|
283
|
+
const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
284
|
+
"index",
|
|
285
|
+
"class",
|
|
286
|
+
"className",
|
|
287
|
+
"dataTheme",
|
|
288
|
+
"style",
|
|
289
|
+
"onMouseDown"
|
|
290
|
+
]);
|
|
291
|
+
const char = ()=>context?.chars()[local.index] ?? "";
|
|
292
|
+
const isActive = ()=>Boolean(context?.isFocused()) && !Boolean(context?.isDisabled()) && (context?.activeIndex() ?? 0) === local.index;
|
|
293
|
+
const handleMouseDown = (event)=>{
|
|
294
|
+
invokeEventHandler(local.onMouseDown, event);
|
|
295
|
+
if (event.defaultPrevented || context?.isDisabled()) return;
|
|
296
|
+
event.preventDefault();
|
|
297
|
+
context?.setActiveIndex(local.index);
|
|
298
|
+
context?.focusInputAt(local.index);
|
|
299
|
+
};
|
|
300
|
+
return (()=>{
|
|
301
|
+
var _el$4 = _tmpl$2();
|
|
302
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$4, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(others, {
|
|
303
|
+
get ["class"] () {
|
|
304
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("input-otp__slot", local.class, local.className);
|
|
305
|
+
},
|
|
306
|
+
"data-slot": "input-otp-slot",
|
|
307
|
+
get ["data-active"] () {
|
|
308
|
+
return isActive() ? "true" : void 0;
|
|
309
|
+
},
|
|
310
|
+
get ["data-filled"] () {
|
|
311
|
+
return char().length > 0 ? "true" : void 0;
|
|
312
|
+
},
|
|
313
|
+
get ["data-disabled"] () {
|
|
314
|
+
return context?.isDisabled() ? "true" : void 0;
|
|
315
|
+
},
|
|
316
|
+
get ["data-invalid"] () {
|
|
317
|
+
return context?.isInvalid() ? "true" : void 0;
|
|
318
|
+
},
|
|
319
|
+
get ["data-theme"] () {
|
|
320
|
+
return local.dataTheme;
|
|
321
|
+
},
|
|
322
|
+
get style () {
|
|
323
|
+
return local.style;
|
|
324
|
+
},
|
|
325
|
+
onMouseDown: handleMouseDown
|
|
326
|
+
}), false, true);
|
|
327
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$4, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.Show, {
|
|
328
|
+
get when () {
|
|
329
|
+
return char().length > 0;
|
|
330
|
+
},
|
|
331
|
+
get children () {
|
|
332
|
+
var _el$5 = _tmpl$3();
|
|
333
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$5, char);
|
|
334
|
+
return _el$5;
|
|
335
|
+
}
|
|
336
|
+
}), null);
|
|
337
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$4, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.Show, {
|
|
338
|
+
get when () {
|
|
339
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!isActive())() && 0 === char().length;
|
|
340
|
+
},
|
|
341
|
+
get children () {
|
|
342
|
+
return _tmpl$4();
|
|
343
|
+
}
|
|
344
|
+
}), null);
|
|
345
|
+
return _el$4;
|
|
346
|
+
})();
|
|
347
|
+
};
|
|
348
|
+
const InputOTPSeparator = (props)=>{
|
|
349
|
+
const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
350
|
+
"children",
|
|
351
|
+
"class",
|
|
352
|
+
"className",
|
|
353
|
+
"dataTheme",
|
|
354
|
+
"style"
|
|
355
|
+
]);
|
|
356
|
+
return (()=>{
|
|
357
|
+
var _el$7 = _tmpl$2();
|
|
358
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$7, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(others, {
|
|
359
|
+
get ["class"] () {
|
|
360
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("input-otp__separator", local.class, local.className);
|
|
361
|
+
},
|
|
362
|
+
"data-slot": "input-otp-separator",
|
|
363
|
+
get ["data-theme"] () {
|
|
364
|
+
return local.dataTheme;
|
|
365
|
+
},
|
|
366
|
+
get style () {
|
|
367
|
+
return local.style;
|
|
368
|
+
}
|
|
369
|
+
}), false, true);
|
|
370
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$7, ()=>local.children);
|
|
371
|
+
return _el$7;
|
|
372
|
+
})();
|
|
373
|
+
};
|
|
374
|
+
const InputOTP_InputOTP = Object.assign(InputOTPRoot, {
|
|
375
|
+
Root: InputOTPRoot,
|
|
376
|
+
Group: InputOTPGroup,
|
|
377
|
+
Slot: InputOTPSlot,
|
|
378
|
+
Separator: InputOTPSeparator
|
|
379
|
+
});
|
|
380
|
+
const InputOTP = InputOTP_InputOTP;
|
|
381
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
|
|
382
|
+
"input",
|
|
383
|
+
"keydown"
|
|
384
|
+
]);
|
|
385
|
+
export { InputOTP_InputOTP as InputOTP, InputOTPGroup, InputOTPRoot, InputOTPSeparator, InputOTPSlot, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS, InputOTP as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, InputOTP, InputOTPRoot, InputOTPGroup, InputOTPSlot, InputOTPSeparator, REGEXP_ONLY_DIGITS, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS_AND_CHARS, type InputOTPProps, type InputOTPRootProps, type InputOTPGroupProps, type InputOTPSlotProps, type InputOTPSeparatorProps, type InputOTPVariant, } from "./InputOTP";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__ from "./InputOTP.js";
|
|
2
|
+
var __webpack_exports__InputOTP = __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__.InputOTP;
|
|
3
|
+
var __webpack_exports__InputOTPGroup = __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__.InputOTPGroup;
|
|
4
|
+
var __webpack_exports__InputOTPRoot = __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__.InputOTPRoot;
|
|
5
|
+
var __webpack_exports__InputOTPSeparator = __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__.InputOTPSeparator;
|
|
6
|
+
var __webpack_exports__InputOTPSlot = __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__.InputOTPSlot;
|
|
7
|
+
var __webpack_exports__REGEXP_ONLY_CHARS = __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__.REGEXP_ONLY_CHARS;
|
|
8
|
+
var __webpack_exports__REGEXP_ONLY_DIGITS = __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__.REGEXP_ONLY_DIGITS;
|
|
9
|
+
var __webpack_exports__REGEXP_ONLY_DIGITS_AND_CHARS = __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__.REGEXP_ONLY_DIGITS_AND_CHARS;
|
|
10
|
+
var __webpack_exports__default = __WEBPACK_EXTERNAL_MODULE__InputOTP_js_2a735b74__["default"];
|
|
11
|
+
export { __webpack_exports__InputOTP as InputOTP, __webpack_exports__InputOTPGroup as InputOTPGroup, __webpack_exports__InputOTPRoot as InputOTPRoot, __webpack_exports__InputOTPSeparator as InputOTPSeparator, __webpack_exports__InputOTPSlot as InputOTPSlot, __webpack_exports__REGEXP_ONLY_CHARS as REGEXP_ONLY_CHARS, __webpack_exports__REGEXP_ONLY_DIGITS as REGEXP_ONLY_DIGITS, __webpack_exports__REGEXP_ONLY_DIGITS_AND_CHARS as REGEXP_ONLY_DIGITS_AND_CHARS, __webpack_exports__default as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.label {
|
|
3
|
+
font-size: 0.875rem;
|
|
4
|
+
line-height: 1.25rem;
|
|
5
|
+
font-weight: 500;
|
|
6
|
+
color: var(--color-foreground);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.label--required::after,
|
|
10
|
+
[data-required="true"]:not([role="group"]):not([role="radiogroup"]):not([role="checkboxgroup"])
|
|
11
|
+
> .label::after,
|
|
12
|
+
[data-required="true"]:not([data-slot="radio"]):not([data-slot="checkbox"]) > .label::after {
|
|
13
|
+
margin-inline-start: 0.125rem;
|
|
14
|
+
color: var(--color-danger);
|
|
15
|
+
content: "*";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.label--disabled,
|
|
19
|
+
[data-disabled="true"] .label {
|
|
20
|
+
opacity: var(--disabled-opacity, 0.5);
|
|
21
|
+
cursor: var(--cursor-disabled, not-allowed);
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.label--invalid,
|
|
26
|
+
[data-invalid="true"] .label,
|
|
27
|
+
[aria-invalid="true"] .label {
|
|
28
|
+
color: var(--color-danger);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "./Label.css";
|
|
2
|
+
import { type Component, type JSX } from "solid-js";
|
|
3
|
+
import type { IComponentBaseProps } from "../types";
|
|
4
|
+
export type LabelRootProps = Omit<JSX.LabelHTMLAttributes<HTMLLabelElement>, "for"> & IComponentBaseProps & {
|
|
5
|
+
for?: string;
|
|
6
|
+
htmlFor?: string;
|
|
7
|
+
isRequired?: boolean;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
isInvalid?: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare const LabelRoot: Component<LabelRootProps>;
|
|
12
|
+
declare const Label: Component<LabelRootProps> & {
|
|
13
|
+
Root: Component<LabelRootProps>;
|
|
14
|
+
};
|
|
15
|
+
export default Label;
|
|
16
|
+
export { Label, LabelRoot };
|
|
17
|
+
export type { LabelRootProps as LabelProps };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__ from "solid-js/web";
|
|
2
|
+
import "./Label.css";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__ from "solid-js";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
|
|
5
|
+
var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<label>");
|
|
6
|
+
const LABEL_STATE_CLASS_MAP = {
|
|
7
|
+
required: "label--required",
|
|
8
|
+
disabled: "label--disabled",
|
|
9
|
+
invalid: "label--invalid"
|
|
10
|
+
};
|
|
11
|
+
const LabelRoot = (props)=>{
|
|
12
|
+
const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
13
|
+
"children",
|
|
14
|
+
"class",
|
|
15
|
+
"className",
|
|
16
|
+
"dataTheme",
|
|
17
|
+
"style",
|
|
18
|
+
"for",
|
|
19
|
+
"htmlFor",
|
|
20
|
+
"isRequired",
|
|
21
|
+
"isDisabled",
|
|
22
|
+
"isInvalid"
|
|
23
|
+
]);
|
|
24
|
+
return (()=>{
|
|
25
|
+
var _el$ = _tmpl$();
|
|
26
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(others, {
|
|
27
|
+
get ["for"] () {
|
|
28
|
+
return local.for ?? local.htmlFor;
|
|
29
|
+
},
|
|
30
|
+
get ["class"] () {
|
|
31
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("label", local.isRequired && LABEL_STATE_CLASS_MAP.required, local.isDisabled && LABEL_STATE_CLASS_MAP.disabled, local.isInvalid && LABEL_STATE_CLASS_MAP.invalid, local.class, local.className);
|
|
32
|
+
},
|
|
33
|
+
"data-slot": "label",
|
|
34
|
+
get ["data-required"] () {
|
|
35
|
+
return local.isRequired ? "true" : void 0;
|
|
36
|
+
},
|
|
37
|
+
get ["data-disabled"] () {
|
|
38
|
+
return local.isDisabled ? "true" : void 0;
|
|
39
|
+
},
|
|
40
|
+
get ["data-invalid"] () {
|
|
41
|
+
return local.isInvalid ? "true" : void 0;
|
|
42
|
+
},
|
|
43
|
+
get ["data-theme"] () {
|
|
44
|
+
return local.dataTheme;
|
|
45
|
+
},
|
|
46
|
+
get style () {
|
|
47
|
+
return local.style;
|
|
48
|
+
},
|
|
49
|
+
get ["aria-disabled"] () {
|
|
50
|
+
return local.isDisabled ? "true" : void 0;
|
|
51
|
+
},
|
|
52
|
+
get ["aria-invalid"] () {
|
|
53
|
+
return local.isInvalid ? "true" : void 0;
|
|
54
|
+
}
|
|
55
|
+
}), false, true);
|
|
56
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$, ()=>local.children);
|
|
57
|
+
return _el$;
|
|
58
|
+
})();
|
|
59
|
+
};
|
|
60
|
+
const Label = Object.assign(LabelRoot, {
|
|
61
|
+
Root: LabelRoot
|
|
62
|
+
});
|
|
63
|
+
const label_Label = Label;
|
|
64
|
+
export { Label, LabelRoot, label_Label as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, Label, LabelRoot, type LabelProps, type LabelRootProps, } from "./Label";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__Label_js_56960635__ from "./Label.js";
|
|
2
|
+
var __webpack_exports__Label = __WEBPACK_EXTERNAL_MODULE__Label_js_56960635__.Label;
|
|
3
|
+
var __webpack_exports__LabelRoot = __WEBPACK_EXTERNAL_MODULE__Label_js_56960635__.LabelRoot;
|
|
4
|
+
var __webpack_exports__default = __WEBPACK_EXTERNAL_MODULE__Label_js_56960635__["default"];
|
|
5
|
+
export { __webpack_exports__Label as Label, __webpack_exports__LabelRoot as LabelRoot, __webpack_exports__default as default };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.list-box {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 100%;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 0.25rem;
|
|
8
|
+
overflow: clip;
|
|
9
|
+
padding: 0.25rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.list-box [data-slot="separator"][data-orientation="horizontal"] {
|
|
13
|
+
margin-inline-start: 3%;
|
|
14
|
+
width: 94%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.list-box-item {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: flex;
|
|
20
|
+
min-height: 2.25rem;
|
|
21
|
+
width: 100%;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: flex-start;
|
|
24
|
+
gap: 0.75rem;
|
|
25
|
+
border-radius: 1rem;
|
|
26
|
+
padding-inline: 0.5rem;
|
|
27
|
+
padding-block: 0.375rem;
|
|
28
|
+
outline: none;
|
|
29
|
+
user-select: none;
|
|
30
|
+
-webkit-tap-highlight-color: transparent;
|
|
31
|
+
transition:
|
|
32
|
+
transform 250ms var(--ease-out-quart),
|
|
33
|
+
box-shadow 150ms var(--ease-out);
|
|
34
|
+
cursor: var(--cursor-interactive);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@media (prefers-reduced-motion: reduce) {
|
|
38
|
+
.list-box-item {
|
|
39
|
+
transition: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.list-box-item [data-slot="label"] {
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
width: fit-content;
|
|
46
|
+
user-select: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.list-box-item [data-slot="description"] {
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
text-wrap: wrap;
|
|
52
|
+
user-select: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.list-box-item:has(.list-box-item__indicator) {
|
|
56
|
+
padding-inline-end: 1.75rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.list-box-item:focus-visible:not(:focus),
|
|
60
|
+
.list-box-item[data-focus-visible="true"] {
|
|
61
|
+
outline: 2px solid var(--color-accent);
|
|
62
|
+
outline-offset: 2px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.list-box-item:active,
|
|
66
|
+
.list-box-item[data-pressed="true"] {
|
|
67
|
+
transform: scale(0.98);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (hover: hover) {
|
|
71
|
+
.list-box-item:hover,
|
|
72
|
+
.list-box-item[data-hovered="true"] {
|
|
73
|
+
background-color: var(--color-default);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.list-box-item[data-disabled="true"],
|
|
78
|
+
.list-box-item[aria-disabled="true"] {
|
|
79
|
+
opacity: 0.5;
|
|
80
|
+
cursor: not-allowed;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.list-box-item__indicator {
|
|
84
|
+
position: absolute;
|
|
85
|
+
inset-inline-end: 0.5rem;
|
|
86
|
+
top: 50%;
|
|
87
|
+
display: flex;
|
|
88
|
+
width: 1rem;
|
|
89
|
+
height: 1rem;
|
|
90
|
+
flex-shrink: 0;
|
|
91
|
+
transform: translateY(-50%);
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
color: var(--color-default-foreground);
|
|
95
|
+
opacity: 0;
|
|
96
|
+
transition: all 250ms ease;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.list-box-item__indicator[data-visible="true"] {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (prefers-reduced-motion: reduce) {
|
|
104
|
+
.list-box-item__indicator {
|
|
105
|
+
transition: none;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.list-box-item__indicator [data-slot="listbox-item-indicator--checkmark"] {
|
|
110
|
+
width: 0.625rem;
|
|
111
|
+
height: 0.625rem;
|
|
112
|
+
transition: all 300ms ease;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@media (prefers-reduced-motion: reduce) {
|
|
116
|
+
.list-box-item__indicator [data-slot="listbox-item-indicator--checkmark"] {
|
|
117
|
+
transition: none;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.list-box-item[aria-selected="true"] [data-slot="listbox-item-indicator--checkmark"],
|
|
122
|
+
.list-box-item[data-selected="true"] [data-slot="listbox-item-indicator--checkmark"] {
|
|
123
|
+
transition: stroke-dashoffset 250ms linear;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media (prefers-reduced-motion: reduce) {
|
|
127
|
+
.list-box-item[aria-selected="true"] [data-slot="listbox-item-indicator--checkmark"],
|
|
128
|
+
.list-box-item[data-selected="true"] [data-slot="listbox-item-indicator--checkmark"] {
|
|
129
|
+
transition: none;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.list-box-item--danger .list-box-item__indicator,
|
|
134
|
+
.list-box-item--danger [data-slot="label"] {
|
|
135
|
+
color: var(--color-danger);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.list-box-section {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
align-items: flex-start;
|
|
142
|
+
gap: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.list-box-section__title {
|
|
146
|
+
width: 100%;
|
|
147
|
+
}
|
|
148
|
+
}
|