@pathscale/ui 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/{Checkbox-BjaweaOH.d.ts → Checkbox-CzeDsQLA.d.ts} +3 -11
- package/dist/{Input-BQbTzjIO.d.ts → Input-X4gwIB-F.d.ts} +9 -1
- package/dist/{Switch-3IXS_68H.d.ts → Switch-B6dN2G97.d.ts} +13 -9
- package/dist/chunk/{4TWLQ3IA.js → 5KABSQPM.js} +10 -2
- package/dist/chunk/{GLEAR2TS.jsx → 5R7S7TXL.jsx} +36 -17
- package/dist/chunk/{P2L6LFLS.js → 6B7HOWQD.js} +40 -19
- package/dist/chunk/DGI3XY32.jsx +157 -0
- package/dist/chunk/F33TSIEQ.jsx +181 -0
- package/dist/chunk/FNXIOJJY.js +156 -0
- package/dist/chunk/OMRJVDZV.js +173 -0
- package/dist/chunk/VLJEQN2A.js +130 -0
- package/dist/chunk/{DNTGSCVF.jsx → YM2NLFQE.jsx} +1 -1
- package/dist/chunk/Z5DP7GYE.jsx +155 -0
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.jsx +1 -1
- package/dist/components/input/index.d.ts +7 -5
- package/dist/components/input/index.js +1 -1
- package/dist/components/input/index.jsx +3 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/select/index.jsx +1 -1
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.jsx +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.jsx +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -12
- package/dist/index.jsx +15 -15
- package/package.json +1 -1
- package/dist/chunk/3IHANYRN.js +0 -98
- package/dist/chunk/6SBH3KSM.jsx +0 -96
- package/dist/chunk/FPUQ25SO.js +0 -137
- package/dist/chunk/MXG3MBEN.jsx +0 -148
- package/dist/chunk/N7BXP7EI.jsx +0 -102
- package/dist/chunk/T2DPPLBQ.js +0 -100
- /package/dist/components/{Progress → progress}/index.d.ts +0 -0
- /package/dist/components/{Progress → progress}/index.js +0 -0
- /package/dist/components/{Progress → progress}/index.jsx +0 -0
|
@@ -14,26 +14,18 @@ declare const checkboxVariants: {
|
|
|
14
14
|
warning: string;
|
|
15
15
|
danger: string;
|
|
16
16
|
};
|
|
17
|
-
checked: {
|
|
18
|
-
true: string;
|
|
19
|
-
false: string;
|
|
20
|
-
};
|
|
21
|
-
indeterminate: {
|
|
22
|
-
true: string;
|
|
23
|
-
false: string;
|
|
24
|
-
};
|
|
25
17
|
}> & ClassProps) | undefined): string;
|
|
26
|
-
variantKeys: ("size" | "color"
|
|
18
|
+
variantKeys: ("size" | "color")[];
|
|
27
19
|
};
|
|
28
20
|
|
|
29
21
|
type CheckboxProps = VariantProps<typeof checkboxVariants> & ClassProps & Omit<ComponentProps<"input">, "onChange" | "onFocus" | "onBlur"> & {
|
|
30
22
|
indeterminate?: boolean;
|
|
23
|
+
defaultChecked?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
31
25
|
label?: JSX.Element;
|
|
32
26
|
onChange?: JSX.EventHandlerUnion<HTMLInputElement, Event>;
|
|
33
27
|
onFocus?: JSX.EventHandlerUnion<HTMLInputElement, FocusEvent>;
|
|
34
28
|
onBlur?: JSX.EventHandlerUnion<HTMLInputElement, FocusEvent>;
|
|
35
|
-
"aria-label"?: string;
|
|
36
|
-
"aria-describedby"?: string;
|
|
37
29
|
};
|
|
38
30
|
declare const Checkbox: Component<CheckboxProps>;
|
|
39
31
|
|
|
@@ -20,8 +20,16 @@ declare const inputVariants: {
|
|
|
20
20
|
true: string;
|
|
21
21
|
false: string;
|
|
22
22
|
};
|
|
23
|
+
hasLeftIcon: {
|
|
24
|
+
true: string;
|
|
25
|
+
false: string;
|
|
26
|
+
};
|
|
27
|
+
hasRightIcon: {
|
|
28
|
+
true: string;
|
|
29
|
+
false: string;
|
|
30
|
+
};
|
|
23
31
|
}> & ClassProps) | undefined): string;
|
|
24
|
-
variantKeys: ("rounded" | "loading" | "color" | "expanded")[];
|
|
32
|
+
variantKeys: ("rounded" | "loading" | "color" | "expanded" | "hasLeftIcon" | "hasRightIcon")[];
|
|
25
33
|
};
|
|
26
34
|
|
|
27
35
|
type InputProps = Partial<VariantProps<typeof inputVariants> & ClassProps & ComponentProps<"input">> & {
|
|
@@ -31,17 +31,17 @@ declare const checkVariants: {
|
|
|
31
31
|
lg: string;
|
|
32
32
|
};
|
|
33
33
|
color: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
primary: string;
|
|
35
|
+
success: string;
|
|
36
|
+
danger: string;
|
|
37
|
+
warning: string;
|
|
38
38
|
gray: string;
|
|
39
39
|
};
|
|
40
40
|
passiveColor: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
primary: string;
|
|
42
|
+
success: string;
|
|
43
|
+
danger: string;
|
|
44
|
+
warning: string;
|
|
45
45
|
gray: string;
|
|
46
46
|
};
|
|
47
47
|
rounded: {
|
|
@@ -52,8 +52,12 @@ declare const checkVariants: {
|
|
|
52
52
|
true: string;
|
|
53
53
|
false: string;
|
|
54
54
|
};
|
|
55
|
+
disabled: {
|
|
56
|
+
true: string;
|
|
57
|
+
false: string;
|
|
58
|
+
};
|
|
55
59
|
}> & ClassProps) | undefined): string;
|
|
56
|
-
variantKeys: ("size" | "rounded" | "outlined" | "color" | "passiveColor")[];
|
|
60
|
+
variantKeys: ("size" | "rounded" | "outlined" | "color" | "disabled" | "passiveColor")[];
|
|
57
61
|
};
|
|
58
62
|
|
|
59
63
|
type SwitchProps = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cva } from './HKS7ET6T.js';
|
|
2
|
-
import { template, spread, insert, createComponent, effect, className } from 'solid-js/web';
|
|
2
|
+
import { template, spread, insert, createComponent, memo, effect, className } from 'solid-js/web';
|
|
3
3
|
import { splitProps, Show } from 'solid-js';
|
|
4
4
|
|
|
5
5
|
// src/components/tooltip/Tooltip.styles.ts
|
|
@@ -64,6 +64,7 @@ var tooltipVariants = cva(
|
|
|
64
64
|
// src/components/tooltip/Tooltip.tsx
|
|
65
65
|
var _tmpl$ = /* @__PURE__ */ template(`<span>`);
|
|
66
66
|
var _tmpl$2 = /* @__PURE__ */ template(`<span class="relative inline-block group">`);
|
|
67
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div class=block>`);
|
|
67
68
|
var Tooltip = (props) => {
|
|
68
69
|
const [local, variantProps, otherProps] = splitProps(props, ["label", "delay", "always", "children"], ["type", "size", "position", "rounded", "dashed", "multilined", "animated"]);
|
|
69
70
|
return (() => {
|
|
@@ -77,7 +78,14 @@ var Tooltip = (props) => {
|
|
|
77
78
|
get children() {
|
|
78
79
|
var _el$2 = _tmpl$();
|
|
79
80
|
_el$2.style.setProperty("pointer-events", "none");
|
|
80
|
-
insert(_el$2, () =>
|
|
81
|
+
insert(_el$2, (() => {
|
|
82
|
+
var _c$ = memo(() => !!variantProps.multilined);
|
|
83
|
+
return () => _c$() ? local.label.split("\n").map((line, index) => (() => {
|
|
84
|
+
var _el$3 = _tmpl$3();
|
|
85
|
+
insert(_el$3, line);
|
|
86
|
+
return _el$3;
|
|
87
|
+
})()) : local.label;
|
|
88
|
+
})());
|
|
81
89
|
effect((_p$) => {
|
|
82
90
|
var _v$ = tooltipVariants(variantProps), _v$2 = `${local.delay ?? 0}ms`, _v$3 = local.always ? 1 : void 0;
|
|
83
91
|
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
@@ -21,7 +21,7 @@ var switchVariants = cva(
|
|
|
21
21
|
lg: "text-lg"
|
|
22
22
|
},
|
|
23
23
|
disabled: {
|
|
24
|
-
true: "opacity-50
|
|
24
|
+
true: "opacity-50",
|
|
25
25
|
false: ""
|
|
26
26
|
},
|
|
27
27
|
rounded: {
|
|
@@ -44,7 +44,7 @@ var switchVariants = cva(
|
|
|
44
44
|
var checkVariants = cva(
|
|
45
45
|
[
|
|
46
46
|
"relative transition-colors duration-200",
|
|
47
|
-
"after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out"
|
|
47
|
+
"after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out after:shadow-sm"
|
|
48
48
|
].join(" "),
|
|
49
49
|
{
|
|
50
50
|
variants: {
|
|
@@ -54,37 +54,52 @@ var checkVariants = cva(
|
|
|
54
54
|
lg: "w-12 h-7 after:w-5 after:h-5 after:left-1 after:top-1 peer-checked:after:translate-x-5"
|
|
55
55
|
},
|
|
56
56
|
color: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
gray: "peer-checked:bg-gray-
|
|
57
|
+
primary: "peer-checked:bg-blue-500",
|
|
58
|
+
success: "peer-checked:bg-green-500",
|
|
59
|
+
danger: "peer-checked:bg-red-500",
|
|
60
|
+
warning: "peer-checked:bg-yellow-400",
|
|
61
|
+
gray: "peer-checked:bg-gray-400"
|
|
62
62
|
},
|
|
63
63
|
passiveColor: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
gray: "bg-gray-
|
|
64
|
+
primary: "bg-blue-500",
|
|
65
|
+
success: "bg-green-500",
|
|
66
|
+
danger: "bg-red-500",
|
|
67
|
+
warning: "bg-yellow-400",
|
|
68
|
+
gray: "bg-gray-400"
|
|
69
69
|
},
|
|
70
70
|
rounded: {
|
|
71
71
|
true: "rounded-full after:rounded-full",
|
|
72
72
|
false: "rounded-md after:rounded-sm"
|
|
73
73
|
},
|
|
74
74
|
outlined: {
|
|
75
|
-
true: "
|
|
75
|
+
true: "bg-transparent ring border-current",
|
|
76
|
+
false: ""
|
|
77
|
+
},
|
|
78
|
+
disabled: {
|
|
79
|
+
true: "bg-gray-200 border border-gray-300 after:bg-gray-100",
|
|
76
80
|
false: ""
|
|
77
81
|
}
|
|
78
82
|
},
|
|
79
83
|
defaultVariants: {
|
|
80
84
|
size: "md",
|
|
81
|
-
color: "
|
|
85
|
+
color: "primary",
|
|
82
86
|
passiveColor: "gray",
|
|
83
87
|
rounded: true,
|
|
84
88
|
outlined: false
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
);
|
|
92
|
+
var switchLabelClass = cva("control-label", {
|
|
93
|
+
variants: {
|
|
94
|
+
disabled: {
|
|
95
|
+
true: "text-gray-400 dark:text-gray-500",
|
|
96
|
+
false: "text-gray-800 dark:text-gray-200"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
defaultVariants: {
|
|
100
|
+
disabled: false
|
|
101
|
+
}
|
|
102
|
+
});
|
|
88
103
|
|
|
89
104
|
// src/components/switch/Switch.tsx
|
|
90
105
|
var Switch = (props) => {
|
|
@@ -101,7 +116,7 @@ var Switch = (props) => {
|
|
|
101
116
|
"aria-label",
|
|
102
117
|
"aria-describedby"
|
|
103
118
|
],
|
|
104
|
-
["size", "rounded", "outlined", "color", "passiveColor"]
|
|
119
|
+
["size", "rounded", "outlined", "color", "passiveColor", "disabled"]
|
|
105
120
|
);
|
|
106
121
|
const isControlled = localProps.checked !== void 0;
|
|
107
122
|
const [internalChecked, setInternalChecked] = createSignal(
|
|
@@ -117,10 +132,12 @@ var Switch = (props) => {
|
|
|
117
132
|
color: variantProps.color,
|
|
118
133
|
passiveColor: variantProps.passiveColor,
|
|
119
134
|
rounded: variantProps.rounded,
|
|
120
|
-
outlined: variantProps.outlined
|
|
135
|
+
outlined: variantProps.outlined,
|
|
136
|
+
disabled: localProps.disabled
|
|
121
137
|
})
|
|
122
138
|
);
|
|
123
139
|
const handleChange = (e) => {
|
|
140
|
+
if (localProps.disabled) return;
|
|
124
141
|
const next = e.currentTarget.checked;
|
|
125
142
|
untrack(() => {
|
|
126
143
|
if (!isControlled) setInternalChecked(next);
|
|
@@ -147,7 +164,9 @@ var Switch = (props) => {
|
|
|
147
164
|
/>
|
|
148
165
|
|
|
149
166
|
<span class={checkClasses()} />
|
|
150
|
-
<span class=
|
|
167
|
+
<span class={switchLabelClass({ disabled: localProps.disabled })}>
|
|
168
|
+
{localProps.children}
|
|
169
|
+
</span>
|
|
151
170
|
</label>;
|
|
152
171
|
};
|
|
153
172
|
var Switch_default = Switch;
|
|
@@ -13,7 +13,7 @@ var switchVariants = cva(
|
|
|
13
13
|
lg: "text-lg"
|
|
14
14
|
},
|
|
15
15
|
disabled: {
|
|
16
|
-
true: "opacity-50
|
|
16
|
+
true: "opacity-50",
|
|
17
17
|
false: ""
|
|
18
18
|
},
|
|
19
19
|
rounded: {
|
|
@@ -36,7 +36,7 @@ var switchVariants = cva(
|
|
|
36
36
|
var checkVariants = cva(
|
|
37
37
|
[
|
|
38
38
|
"relative transition-colors duration-200",
|
|
39
|
-
"after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out"
|
|
39
|
+
"after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out after:shadow-sm"
|
|
40
40
|
].join(" "),
|
|
41
41
|
{
|
|
42
42
|
variants: {
|
|
@@ -46,42 +46,57 @@ var checkVariants = cva(
|
|
|
46
46
|
lg: "w-12 h-7 after:w-5 after:h-5 after:left-1 after:top-1 peer-checked:after:translate-x-5"
|
|
47
47
|
},
|
|
48
48
|
color: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
gray: "peer-checked:bg-gray-
|
|
49
|
+
primary: "peer-checked:bg-blue-500",
|
|
50
|
+
success: "peer-checked:bg-green-500",
|
|
51
|
+
danger: "peer-checked:bg-red-500",
|
|
52
|
+
warning: "peer-checked:bg-yellow-400",
|
|
53
|
+
gray: "peer-checked:bg-gray-400"
|
|
54
54
|
},
|
|
55
55
|
passiveColor: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
gray: "bg-gray-
|
|
56
|
+
primary: "bg-blue-500",
|
|
57
|
+
success: "bg-green-500",
|
|
58
|
+
danger: "bg-red-500",
|
|
59
|
+
warning: "bg-yellow-400",
|
|
60
|
+
gray: "bg-gray-400"
|
|
61
61
|
},
|
|
62
62
|
rounded: {
|
|
63
63
|
true: "rounded-full after:rounded-full",
|
|
64
64
|
false: "rounded-md after:rounded-sm"
|
|
65
65
|
},
|
|
66
66
|
outlined: {
|
|
67
|
-
true: "
|
|
67
|
+
true: "bg-transparent ring border-current",
|
|
68
|
+
false: ""
|
|
69
|
+
},
|
|
70
|
+
disabled: {
|
|
71
|
+
true: "bg-gray-200 border border-gray-300 after:bg-gray-100",
|
|
68
72
|
false: ""
|
|
69
73
|
}
|
|
70
74
|
},
|
|
71
75
|
defaultVariants: {
|
|
72
76
|
size: "md",
|
|
73
|
-
color: "
|
|
77
|
+
color: "primary",
|
|
74
78
|
passiveColor: "gray",
|
|
75
79
|
rounded: true,
|
|
76
80
|
outlined: false
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
);
|
|
84
|
+
var switchLabelClass = cva("control-label", {
|
|
85
|
+
variants: {
|
|
86
|
+
disabled: {
|
|
87
|
+
true: "text-gray-400 dark:text-gray-500",
|
|
88
|
+
false: "text-gray-800 dark:text-gray-200"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
defaultVariants: {
|
|
92
|
+
disabled: false
|
|
93
|
+
}
|
|
94
|
+
});
|
|
80
95
|
|
|
81
96
|
// src/components/switch/Switch.tsx
|
|
82
|
-
var _tmpl$ = /* @__PURE__ */ template(`<label role=switch><input type=checkbox class="sr-only peer"aria-hidden=true><span></span><span
|
|
97
|
+
var _tmpl$ = /* @__PURE__ */ template(`<label role=switch><input type=checkbox class="sr-only peer"aria-hidden=true><span></span><span>`);
|
|
83
98
|
var Switch = (props) => {
|
|
84
|
-
const [localProps, variantProps, otherProps] = splitProps(props, ["children", "checked", "defaultChecked", "onChange", "name", "required", "disabled", "aria-label", "aria-describedby"], ["size", "rounded", "outlined", "color", "passiveColor"]);
|
|
99
|
+
const [localProps, variantProps, otherProps] = splitProps(props, ["children", "checked", "defaultChecked", "onChange", "name", "required", "disabled", "aria-label", "aria-describedby"], ["size", "rounded", "outlined", "color", "passiveColor", "disabled"]);
|
|
85
100
|
const isControlled = localProps.checked !== void 0;
|
|
86
101
|
const [internalChecked, setInternalChecked] = createSignal(localProps.defaultChecked ?? false);
|
|
87
102
|
const checkedValue = createMemo(() => untrack(() => isControlled ? localProps.checked : internalChecked()));
|
|
@@ -91,9 +106,11 @@ var Switch = (props) => {
|
|
|
91
106
|
color: variantProps.color,
|
|
92
107
|
passiveColor: variantProps.passiveColor,
|
|
93
108
|
rounded: variantProps.rounded,
|
|
94
|
-
outlined: variantProps.outlined
|
|
109
|
+
outlined: variantProps.outlined,
|
|
110
|
+
disabled: localProps.disabled
|
|
95
111
|
}));
|
|
96
112
|
const handleChange = (e) => {
|
|
113
|
+
if (localProps.disabled) return;
|
|
97
114
|
const next = e.currentTarget.checked;
|
|
98
115
|
untrack(() => {
|
|
99
116
|
if (!isControlled) setInternalChecked(next);
|
|
@@ -119,19 +136,23 @@ var Switch = (props) => {
|
|
|
119
136
|
}, otherProps), false, false);
|
|
120
137
|
insert(_el$4, () => localProps.children);
|
|
121
138
|
effect((_p$) => {
|
|
122
|
-
var _v$ = switchClasses(), _v$2 = checkedValue(), _v$3 = localProps["aria-label"], _v$4 = localProps["aria-describedby"], _v$5 = checkClasses()
|
|
139
|
+
var _v$ = switchClasses(), _v$2 = checkedValue(), _v$3 = localProps["aria-label"], _v$4 = localProps["aria-describedby"], _v$5 = checkClasses(), _v$6 = switchLabelClass({
|
|
140
|
+
disabled: localProps.disabled
|
|
141
|
+
});
|
|
123
142
|
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
124
143
|
_v$2 !== _p$.t && setAttribute(_el$, "aria-checked", _p$.t = _v$2);
|
|
125
144
|
_v$3 !== _p$.a && setAttribute(_el$, "aria-label", _p$.a = _v$3);
|
|
126
145
|
_v$4 !== _p$.o && setAttribute(_el$, "aria-describedby", _p$.o = _v$4);
|
|
127
146
|
_v$5 !== _p$.i && className(_el$3, _p$.i = _v$5);
|
|
147
|
+
_v$6 !== _p$.n && className(_el$4, _p$.n = _v$6);
|
|
128
148
|
return _p$;
|
|
129
149
|
}, {
|
|
130
150
|
e: void 0,
|
|
131
151
|
t: void 0,
|
|
132
152
|
a: void 0,
|
|
133
153
|
o: void 0,
|
|
134
|
-
i: void 0
|
|
154
|
+
i: void 0,
|
|
155
|
+
n: void 0
|
|
135
156
|
});
|
|
136
157
|
return _el$;
|
|
137
158
|
})();
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/input/Input.tsx
|
|
6
|
+
import {
|
|
7
|
+
createSignal,
|
|
8
|
+
mergeProps,
|
|
9
|
+
Show as Show2,
|
|
10
|
+
splitProps
|
|
11
|
+
} from "solid-js";
|
|
12
|
+
|
|
13
|
+
// src/components/input/Input.styles.ts
|
|
14
|
+
var inputWrapperClass = "relative flex items-center";
|
|
15
|
+
var inputVariants = cva(
|
|
16
|
+
[
|
|
17
|
+
"block w-full appearance-none outline-none bg-transparent",
|
|
18
|
+
"border transition-colors duration-200",
|
|
19
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
20
|
+
],
|
|
21
|
+
{
|
|
22
|
+
variants: {
|
|
23
|
+
color: {
|
|
24
|
+
danger: "border-red-500 text-red-600",
|
|
25
|
+
success: "border-green-500 text-green-600",
|
|
26
|
+
warning: "border-orange-500 text-orange-600"
|
|
27
|
+
},
|
|
28
|
+
rounded: {
|
|
29
|
+
true: "rounded-full",
|
|
30
|
+
false: "rounded-md"
|
|
31
|
+
},
|
|
32
|
+
expanded: {
|
|
33
|
+
true: "w-full",
|
|
34
|
+
false: "w-fit"
|
|
35
|
+
},
|
|
36
|
+
loading: {
|
|
37
|
+
true: "opacity-50",
|
|
38
|
+
false: ""
|
|
39
|
+
},
|
|
40
|
+
hasLeftIcon: {
|
|
41
|
+
true: "pl-10",
|
|
42
|
+
false: "pl-4"
|
|
43
|
+
},
|
|
44
|
+
hasRightIcon: {
|
|
45
|
+
true: "pr-10",
|
|
46
|
+
false: "pr-4"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
color: void 0,
|
|
51
|
+
rounded: false,
|
|
52
|
+
expanded: true,
|
|
53
|
+
loading: false,
|
|
54
|
+
hasLeftIcon: false,
|
|
55
|
+
hasRightIcon: false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
var iconLeftClass = "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-gray-400";
|
|
60
|
+
var iconRightClass = "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400";
|
|
61
|
+
var iconButtonClass = "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500";
|
|
62
|
+
|
|
63
|
+
// src/components/input/EyeIcon.tsx
|
|
64
|
+
import { Show } from "solid-js";
|
|
65
|
+
var EyeIcon = (props) => {
|
|
66
|
+
return <Show when={props.invisible} fallback={<EyeOpen />}>
|
|
67
|
+
<EyeInvisible />
|
|
68
|
+
</Show>;
|
|
69
|
+
};
|
|
70
|
+
var EyeInvisible = () => <svg
|
|
71
|
+
viewBox="64 64 896 896"
|
|
72
|
+
tabIndex="-1"
|
|
73
|
+
width="1em"
|
|
74
|
+
height="1em"
|
|
75
|
+
fill="currentColor"
|
|
76
|
+
aria-hidden="true"
|
|
77
|
+
>
|
|
78
|
+
<path d="M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" />
|
|
79
|
+
<path d="M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" />
|
|
80
|
+
</svg>;
|
|
81
|
+
var EyeOpen = () => <svg
|
|
82
|
+
viewBox="64 64 896 896"
|
|
83
|
+
tabIndex="-1"
|
|
84
|
+
width="1em"
|
|
85
|
+
height="1em"
|
|
86
|
+
fill="currentColor"
|
|
87
|
+
aria-hidden="true"
|
|
88
|
+
>
|
|
89
|
+
<path d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" />
|
|
90
|
+
</svg>;
|
|
91
|
+
var EyeIcon_default = EyeIcon;
|
|
92
|
+
|
|
93
|
+
// src/components/input/Input.tsx
|
|
94
|
+
var Input = (props) => {
|
|
95
|
+
const defaultedProps = mergeProps({ type: "text" }, props);
|
|
96
|
+
const [localProps, variantProps, otherProps] = splitProps(
|
|
97
|
+
defaultedProps,
|
|
98
|
+
[
|
|
99
|
+
"type",
|
|
100
|
+
"passwordReveal",
|
|
101
|
+
"leftIcon",
|
|
102
|
+
"rightIcon",
|
|
103
|
+
"class",
|
|
104
|
+
"value",
|
|
105
|
+
"onInput",
|
|
106
|
+
"placeholder",
|
|
107
|
+
"name"
|
|
108
|
+
],
|
|
109
|
+
["color", "rounded", "expanded", "loading", "hasLeftIcon", "hasRightIcon"]
|
|
110
|
+
);
|
|
111
|
+
const [showPassword, setShowPassword] = createSignal(false);
|
|
112
|
+
const resolvedType = () => localProps.passwordReveal && showPassword() ? "text" : localProps.type ?? "text";
|
|
113
|
+
const inputClass = inputVariants({
|
|
114
|
+
...variantProps,
|
|
115
|
+
hasLeftIcon: !!localProps.leftIcon,
|
|
116
|
+
hasRightIcon: !!(localProps.rightIcon || localProps.passwordReveal),
|
|
117
|
+
class: localProps.class
|
|
118
|
+
});
|
|
119
|
+
return <div class={inputWrapperClass}>
|
|
120
|
+
<Show2 when={localProps.leftIcon}>
|
|
121
|
+
<span class={iconLeftClass}>{localProps.leftIcon}</span>
|
|
122
|
+
</Show2>
|
|
123
|
+
|
|
124
|
+
<input
|
|
125
|
+
type={resolvedType()}
|
|
126
|
+
class={inputClass}
|
|
127
|
+
aria-invalid={variantProps.color === "danger" ? "true" : void 0}
|
|
128
|
+
value={localProps.value}
|
|
129
|
+
onInput={localProps.onInput}
|
|
130
|
+
placeholder={localProps.placeholder}
|
|
131
|
+
name={localProps.name}
|
|
132
|
+
/>
|
|
133
|
+
|
|
134
|
+
<Show2 when={localProps.passwordReveal && !localProps.rightIcon}>
|
|
135
|
+
<button
|
|
136
|
+
type="button"
|
|
137
|
+
onClick={() => setShowPassword((p) => !p)}
|
|
138
|
+
class={iconButtonClass}
|
|
139
|
+
>
|
|
140
|
+
<EyeIcon_default invisible={showPassword()} />
|
|
141
|
+
</button>
|
|
142
|
+
</Show2>
|
|
143
|
+
|
|
144
|
+
<Show2 when={localProps.rightIcon && !localProps.passwordReveal}>
|
|
145
|
+
<span class={iconRightClass}>{localProps.rightIcon}</span>
|
|
146
|
+
</Show2>
|
|
147
|
+
</div>;
|
|
148
|
+
};
|
|
149
|
+
var Input_default = Input;
|
|
150
|
+
|
|
151
|
+
// src/components/input/index.ts
|
|
152
|
+
var input_default = Input_default;
|
|
153
|
+
|
|
154
|
+
export {
|
|
155
|
+
EyeIcon_default,
|
|
156
|
+
input_default
|
|
157
|
+
};
|