@pathscale/ui 0.0.1 → 0.0.3
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/Accordion-JZGWxBMK.d.ts +27 -0
- package/dist/Autocomplete-gLkjMHrc.d.ts +28 -0
- package/dist/Checkbox-BjaweaOH.d.ts +40 -0
- package/dist/Field-DfUn85_1.d.ts +49 -0
- package/dist/{Input-BQbTzjIO.d.ts → Input-C1bm4HGf.d.ts} +1 -1
- package/dist/Pagination-CJtlFMHy.d.ts +43 -0
- package/dist/Progress-gN0xqhAF.d.ts +64 -0
- package/dist/Select-CWCDBvec.d.ts +44 -0
- package/dist/Steps-1miUeyCD.d.ts +34 -0
- package/dist/Switch-BiKX7HZ2.d.ts +72 -0
- package/dist/Table-CGa6Nop3.d.ts +39 -0
- package/dist/Tabs-BEnRV6GG.d.ts +42 -0
- package/dist/Tag-BPrhn-Ne.d.ts +42 -0
- package/dist/Timeline-Bd4SxHMT.d.ts +14 -0
- package/dist/Tooltip-BfPongoz.d.ts +53 -0
- package/dist/Upload-BrFuZ4JA.d.ts +39 -0
- package/dist/chunk/3IHANYRN.js +98 -0
- package/dist/chunk/3VOILEMN.js +187 -0
- package/dist/chunk/4TWLQ3IA.js +103 -0
- package/dist/chunk/6SBH3KSM.jsx +96 -0
- package/dist/chunk/7ROVLN3J.js +175 -0
- package/dist/chunk/BBDVIXAH.jsx +194 -0
- package/dist/chunk/{4RCWSX7S.jsx → C4745OZS.jsx} +7 -7
- package/dist/chunk/C4YO33NN.jsx +179 -0
- package/dist/chunk/CJZGTNJZ.js +115 -0
- package/dist/chunk/D2BEL4SM.jsx +169 -0
- package/dist/chunk/DBQ7IOPU.js +189 -0
- package/dist/chunk/DNTGSCVF.jsx +100 -0
- package/dist/chunk/DSTUGZW6.jsx +81 -0
- package/dist/chunk/ELRAUORW.jsx +179 -0
- package/dist/chunk/FKSQPGOD.jsx +170 -0
- package/dist/chunk/FPUQ25SO.js +137 -0
- package/dist/chunk/GLEAR2TS.jsx +160 -0
- package/dist/chunk/GMIXRYN3.js +138 -0
- package/dist/chunk/HWAGW5N4.jsx +118 -0
- package/dist/chunk/JWRGKHDO.js +172 -0
- package/dist/chunk/KV6LTJHI.jsx +175 -0
- package/dist/chunk/LAQPAV5I.jsx +187 -0
- package/dist/chunk/LI3HCFL7.jsx +132 -0
- package/dist/chunk/MAX47D6F.js +99 -0
- package/dist/chunk/{2JGZSAW5.js → MI773TMC.js} +6 -6
- package/dist/chunk/MMTAND25.jsx +126 -0
- package/dist/chunk/MXG3MBEN.jsx +148 -0
- package/dist/chunk/MYERRMTM.js +200 -0
- package/dist/chunk/NZKPDBTE.js +118 -0
- package/dist/chunk/OSJ3P7PI.js +189 -0
- package/dist/chunk/P2L6LFLS.js +144 -0
- package/dist/chunk/QLESLIWS.jsx +110 -0
- package/dist/chunk/QONDPQ2I.jsx +105 -0
- package/dist/chunk/QYEMOKUG.js +125 -0
- package/dist/chunk/S3ZDSQSV.js +98 -0
- package/dist/chunk/SCJSBRV2.jsx +39 -0
- package/dist/chunk/STKRVQR6.jsx +130 -0
- package/dist/chunk/{NZZRKP74.js → TFLJI242.js} +1 -25
- package/dist/chunk/TT2JYGLU.js +218 -0
- package/dist/chunk/V6Y5E7BL.js +133 -0
- package/dist/chunk/VN5BKHA2.jsx +97 -0
- package/dist/chunk/WOT36Q7O.js +166 -0
- package/dist/chunk/WUZETUQR.js +92 -0
- package/dist/chunk/XD34JKSU.jsx +201 -0
- package/dist/chunk/{GA2HCFRS.jsx → YAQK2KFY.jsx} +1 -35
- package/dist/chunk/YMO6RPS6.js +26 -0
- package/dist/components/Progress/index.d.ts +4 -39
- package/dist/components/Progress/index.js +1 -278
- package/dist/components/Progress/index.jsx +4 -199
- package/dist/components/accordion/index.d.ts +5 -24
- package/dist/components/accordion/index.js +1 -118
- package/dist/components/accordion/index.jsx +3 -100
- package/dist/components/autocomplete/index.d.ts +8 -0
- package/dist/components/autocomplete/index.js +1 -0
- package/dist/components/autocomplete/index.jsx +7 -0
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.jsx +3 -3
- package/dist/components/breadcrumb/index.d.ts +2 -2
- package/dist/components/breadcrumb/index.js +1 -133
- package/dist/components/breadcrumb/index.jsx +4 -120
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.jsx +2 -1
- package/dist/components/checkbox/index.d.ts +5 -37
- package/dist/components/checkbox/index.js +1 -137
- package/dist/components/checkbox/index.jsx +3 -143
- package/dist/components/dropdown/index.d.ts +43 -0
- package/dist/components/dropdown/index.js +1 -0
- package/dist/components/dropdown/index.jsx +12 -0
- package/dist/components/field/index.d.ts +7 -0
- package/dist/components/field/index.js +1 -0
- package/dist/components/field/index.jsx +7 -0
- package/dist/components/input/index.d.ts +2 -2
- package/dist/components/menu/index.d.ts +66 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/menu/index.jsx +11 -0
- package/dist/components/navbar/index.d.ts +74 -0
- package/dist/components/navbar/index.js +1 -0
- package/dist/components/navbar/index.jsx +11 -0
- package/dist/components/pagination/index.d.ts +5 -40
- package/dist/components/pagination/index.js +1 -189
- package/dist/components/pagination/index.jsx +3 -174
- package/dist/components/select/index.d.ts +5 -41
- package/dist/components/select/index.js +1 -98
- package/dist/components/select/index.jsx +3 -91
- package/dist/components/steps/index.d.ts +8 -0
- package/dist/components/steps/index.js +1 -0
- package/dist/components/steps/index.jsx +7 -0
- package/dist/components/switch/index.d.ts +5 -69
- package/dist/components/switch/index.js +1 -144
- package/dist/components/switch/index.jsx +3 -155
- package/dist/components/table/index.d.ts +8 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/index.jsx +7 -0
- package/dist/components/tabs/index.d.ts +5 -39
- package/dist/components/tabs/index.js +1 -166
- package/dist/components/tabs/index.jsx +3 -170
- package/dist/components/tag/index.d.ts +5 -39
- package/dist/components/tag/index.js +1 -115
- package/dist/components/tag/index.jsx +3 -127
- package/dist/components/timeline/index.d.ts +7 -0
- package/dist/components/timeline/index.js +1 -0
- package/dist/components/timeline/index.jsx +7 -0
- package/dist/components/toast/index.d.ts +24 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toast/index.jsx +11 -0
- package/dist/components/tooltip/index.d.ts +5 -50
- package/dist/components/tooltip/index.js +1 -103
- package/dist/components/tooltip/index.jsx +3 -95
- package/dist/components/upload/index.d.ts +5 -36
- package/dist/components/upload/index.js +1 -98
- package/dist/components/upload/index.jsx +3 -105
- package/dist/index.d.ts +22 -2
- package/dist/index.js +23 -2
- package/dist/index.jsx +108 -8
- package/package.json +1 -1
|
@@ -1,95 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// src/components/select/Select.tsx
|
|
7
|
-
import {
|
|
8
|
-
splitProps,
|
|
9
|
-
Show,
|
|
10
|
-
createMemo,
|
|
11
|
-
untrack
|
|
12
|
-
} from "solid-js";
|
|
13
|
-
|
|
14
|
-
// src/components/select/Select.styles.ts
|
|
15
|
-
var selectVariants = cva(
|
|
16
|
-
[
|
|
17
|
-
"relative inline-flex items-center appearance-none",
|
|
18
|
-
"border outline-none",
|
|
19
|
-
"transition bg-white text-black",
|
|
20
|
-
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
21
|
-
],
|
|
22
|
-
{
|
|
23
|
-
variants: {
|
|
24
|
-
size: {
|
|
25
|
-
sm: "text-sm px-2 py-1",
|
|
26
|
-
md: "text-base px-3 py-2",
|
|
27
|
-
lg: "text-lg px-4 py-2"
|
|
28
|
-
},
|
|
29
|
-
color: {
|
|
30
|
-
primary: "border-gray-300 focus:border-primary",
|
|
31
|
-
info: "border-blue-300 focus:border-blue-500",
|
|
32
|
-
success: "border-green-300 focus:border-green-500",
|
|
33
|
-
warning: "border-yellow-300 focus:border-yellow-500",
|
|
34
|
-
danger: "border-red-300 focus:border-red-500"
|
|
35
|
-
},
|
|
36
|
-
loading: {
|
|
37
|
-
true: "cursor-wait opacity-75",
|
|
38
|
-
false: ""
|
|
39
|
-
},
|
|
40
|
-
expanded: {
|
|
41
|
-
true: "w-full",
|
|
42
|
-
false: "w-fit"
|
|
43
|
-
},
|
|
44
|
-
rounded: {
|
|
45
|
-
true: "rounded",
|
|
46
|
-
false: "rounded-none"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
defaultVariants: {
|
|
50
|
-
size: "md",
|
|
51
|
-
color: "primary",
|
|
52
|
-
loading: false,
|
|
53
|
-
expanded: false,
|
|
54
|
-
rounded: false
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
// src/components/select/Select.tsx
|
|
60
|
-
var Select = (props) => {
|
|
61
|
-
const [localProps, variantProps, otherProps] = splitProps(
|
|
62
|
-
props,
|
|
63
|
-
["placeholder", "value", "nativeSize", "onChange", "onBlur", "onFocus"],
|
|
64
|
-
["class", ...selectVariants.variantKeys]
|
|
65
|
-
);
|
|
66
|
-
const empty = createMemo(
|
|
67
|
-
() => untrack(() => localProps.value === null || localProps.value === void 0)
|
|
68
|
-
);
|
|
69
|
-
const selectClasses = createMemo(
|
|
70
|
-
() => classes(selectVariants(variantProps), variantProps.class)
|
|
71
|
-
);
|
|
72
|
-
return <select
|
|
73
|
-
class={selectClasses()}
|
|
74
|
-
size={localProps.nativeSize}
|
|
75
|
-
value={localProps.value}
|
|
76
|
-
onChange={localProps.onChange}
|
|
77
|
-
onFocus={localProps.onFocus}
|
|
78
|
-
onBlur={localProps.onBlur}
|
|
79
|
-
{...otherProps}
|
|
80
|
-
>
|
|
81
|
-
<Show when={localProps.placeholder && empty()}>
|
|
82
|
-
<option value="" disabled hidden>
|
|
83
|
-
{localProps.placeholder}
|
|
84
|
-
</option>
|
|
85
|
-
</Show>
|
|
86
|
-
{props.children}
|
|
87
|
-
</select>;
|
|
88
|
-
};
|
|
89
|
-
var Select_default = Select;
|
|
90
|
-
|
|
91
|
-
// src/components/select/index.ts
|
|
92
|
-
var select_default = Select_default;
|
|
2
|
+
select_default
|
|
3
|
+
} from "../../chunk/6SBH3KSM.jsx";
|
|
4
|
+
import "../../chunk/P7WPLZNA.jsx";
|
|
93
5
|
export {
|
|
94
6
|
select_default as default
|
|
95
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { steps_default as default } from '../../chunk/TT2JYGLU.js';
|
|
@@ -1,72 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { S as Switch } from '../../Switch-BiKX7HZ2.js';
|
|
2
|
+
export { a as SwitchProps } from '../../Switch-BiKX7HZ2.js';
|
|
3
|
+
import 'solid-js';
|
|
4
|
+
import '../../classes-B_S9K-9I.js';
|
|
3
5
|
|
|
4
|
-
declare const switchVariants: {
|
|
5
|
-
(props?: (ConfigVariants<{
|
|
6
|
-
size: {
|
|
7
|
-
sm: string;
|
|
8
|
-
md: string;
|
|
9
|
-
lg: string;
|
|
10
|
-
};
|
|
11
|
-
disabled: {
|
|
12
|
-
true: string;
|
|
13
|
-
false: string;
|
|
14
|
-
};
|
|
15
|
-
rounded: {
|
|
16
|
-
true: string;
|
|
17
|
-
false: string;
|
|
18
|
-
};
|
|
19
|
-
outlined: {
|
|
20
|
-
true: string;
|
|
21
|
-
false: string;
|
|
22
|
-
};
|
|
23
|
-
}> & ClassProps) | undefined): string;
|
|
24
|
-
variantKeys: ("size" | "disabled" | "rounded" | "outlined")[];
|
|
25
|
-
};
|
|
26
|
-
declare const checkVariants: {
|
|
27
|
-
(props?: (ConfigVariants<{
|
|
28
|
-
size: {
|
|
29
|
-
sm: string;
|
|
30
|
-
md: string;
|
|
31
|
-
lg: string;
|
|
32
|
-
};
|
|
33
|
-
color: {
|
|
34
|
-
blue: string;
|
|
35
|
-
green: string;
|
|
36
|
-
red: string;
|
|
37
|
-
yellow: string;
|
|
38
|
-
gray: string;
|
|
39
|
-
};
|
|
40
|
-
passiveColor: {
|
|
41
|
-
blue: string;
|
|
42
|
-
green: string;
|
|
43
|
-
red: string;
|
|
44
|
-
yellow: string;
|
|
45
|
-
gray: string;
|
|
46
|
-
};
|
|
47
|
-
rounded: {
|
|
48
|
-
true: string;
|
|
49
|
-
false: string;
|
|
50
|
-
};
|
|
51
|
-
outlined: {
|
|
52
|
-
true: string;
|
|
53
|
-
false: string;
|
|
54
|
-
};
|
|
55
|
-
}> & ClassProps) | undefined): string;
|
|
56
|
-
variantKeys: ("size" | "rounded" | "outlined" | "color" | "passiveColor")[];
|
|
57
|
-
};
|
|
58
6
|
|
|
59
|
-
type SwitchProps = {
|
|
60
|
-
children?: JSX.Element;
|
|
61
|
-
checked?: boolean;
|
|
62
|
-
defaultChecked?: boolean;
|
|
63
|
-
onChange?: (checked: boolean) => void;
|
|
64
|
-
name?: string;
|
|
65
|
-
required?: boolean;
|
|
66
|
-
disabled?: boolean;
|
|
67
|
-
"aria-label"?: string;
|
|
68
|
-
"aria-describedby"?: string;
|
|
69
|
-
} & VariantProps<typeof switchVariants> & VariantProps<typeof checkVariants> & Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "onChange">;
|
|
70
|
-
declare const Switch: Component<SwitchProps>;
|
|
71
7
|
|
|
72
|
-
export {
|
|
8
|
+
export { Switch as default };
|
|
@@ -1,144 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { template, spread, mergeProps, insert, effect, className, setAttribute } from 'solid-js/web';
|
|
3
|
-
import { splitProps, createSignal, createMemo, untrack } from 'solid-js';
|
|
4
|
-
|
|
5
|
-
// src/components/switch/Switch.styles.ts
|
|
6
|
-
var switchVariants = cva(
|
|
7
|
-
"switch inline-flex items-center gap-2 select-none",
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
size: {
|
|
11
|
-
sm: "text-sm",
|
|
12
|
-
md: "text-base",
|
|
13
|
-
lg: "text-lg"
|
|
14
|
-
},
|
|
15
|
-
disabled: {
|
|
16
|
-
true: "opacity-50 cursor-not-allowed",
|
|
17
|
-
false: ""
|
|
18
|
-
},
|
|
19
|
-
rounded: {
|
|
20
|
-
true: "",
|
|
21
|
-
false: ""
|
|
22
|
-
},
|
|
23
|
-
outlined: {
|
|
24
|
-
true: "",
|
|
25
|
-
false: ""
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
defaultVariants: {
|
|
29
|
-
size: "md",
|
|
30
|
-
disabled: false,
|
|
31
|
-
rounded: true,
|
|
32
|
-
outlined: false
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
var checkVariants = cva(
|
|
37
|
-
[
|
|
38
|
-
"relative transition-colors duration-200",
|
|
39
|
-
"after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out"
|
|
40
|
-
].join(" "),
|
|
41
|
-
{
|
|
42
|
-
variants: {
|
|
43
|
-
size: {
|
|
44
|
-
sm: "w-8 h-4 after:w-3 after:h-3 after:left-0.5 after:top-0.5 peer-checked:after:translate-x-4",
|
|
45
|
-
md: "w-10 h-6 after:w-4 after:h-4 after:left-1 after:top-1 peer-checked:after:translate-x-4",
|
|
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
|
-
},
|
|
48
|
-
color: {
|
|
49
|
-
blue: "peer-checked:bg-blue-500",
|
|
50
|
-
green: "peer-checked:bg-green-500",
|
|
51
|
-
red: "peer-checked:bg-red-500",
|
|
52
|
-
yellow: "peer-checked:bg-yellow-400",
|
|
53
|
-
gray: "peer-checked:bg-gray-500"
|
|
54
|
-
},
|
|
55
|
-
passiveColor: {
|
|
56
|
-
blue: "bg-blue-200",
|
|
57
|
-
green: "bg-green-200",
|
|
58
|
-
red: "bg-red-200",
|
|
59
|
-
yellow: "bg-yellow-200",
|
|
60
|
-
gray: "bg-gray-300"
|
|
61
|
-
},
|
|
62
|
-
rounded: {
|
|
63
|
-
true: "rounded-full after:rounded-full",
|
|
64
|
-
false: "rounded-md after:rounded-sm"
|
|
65
|
-
},
|
|
66
|
-
outlined: {
|
|
67
|
-
true: "ring-2 ring-inset ring-white",
|
|
68
|
-
false: ""
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
defaultVariants: {
|
|
72
|
-
size: "md",
|
|
73
|
-
color: "blue",
|
|
74
|
-
passiveColor: "gray",
|
|
75
|
-
rounded: true,
|
|
76
|
-
outlined: false
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
// 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 class=control-label>`);
|
|
83
|
-
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"]);
|
|
85
|
-
const isControlled = localProps.checked !== void 0;
|
|
86
|
-
const [internalChecked, setInternalChecked] = createSignal(localProps.defaultChecked ?? false);
|
|
87
|
-
const checkedValue = createMemo(() => untrack(() => isControlled ? localProps.checked : internalChecked()));
|
|
88
|
-
const switchClasses = createMemo(() => switchVariants(variantProps));
|
|
89
|
-
const checkClasses = createMemo(() => checkVariants({
|
|
90
|
-
size: variantProps.size,
|
|
91
|
-
color: variantProps.color,
|
|
92
|
-
passiveColor: variantProps.passiveColor,
|
|
93
|
-
rounded: variantProps.rounded,
|
|
94
|
-
outlined: variantProps.outlined
|
|
95
|
-
}));
|
|
96
|
-
const handleChange = (e) => {
|
|
97
|
-
const next = e.currentTarget.checked;
|
|
98
|
-
untrack(() => {
|
|
99
|
-
if (!isControlled) setInternalChecked(next);
|
|
100
|
-
localProps.onChange?.(next);
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
return (() => {
|
|
104
|
-
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.nextSibling;
|
|
105
|
-
_el$2.addEventListener("change", handleChange);
|
|
106
|
-
spread(_el$2, mergeProps({
|
|
107
|
-
get checked() {
|
|
108
|
-
return checkedValue();
|
|
109
|
-
},
|
|
110
|
-
get name() {
|
|
111
|
-
return localProps.name;
|
|
112
|
-
},
|
|
113
|
-
get required() {
|
|
114
|
-
return localProps.required;
|
|
115
|
-
},
|
|
116
|
-
get disabled() {
|
|
117
|
-
return localProps.disabled;
|
|
118
|
-
}
|
|
119
|
-
}, otherProps), false, false);
|
|
120
|
-
insert(_el$4, () => localProps.children);
|
|
121
|
-
effect((_p$) => {
|
|
122
|
-
var _v$ = switchClasses(), _v$2 = checkedValue(), _v$3 = localProps["aria-label"], _v$4 = localProps["aria-describedby"], _v$5 = checkClasses();
|
|
123
|
-
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
124
|
-
_v$2 !== _p$.t && setAttribute(_el$, "aria-checked", _p$.t = _v$2);
|
|
125
|
-
_v$3 !== _p$.a && setAttribute(_el$, "aria-label", _p$.a = _v$3);
|
|
126
|
-
_v$4 !== _p$.o && setAttribute(_el$, "aria-describedby", _p$.o = _v$4);
|
|
127
|
-
_v$5 !== _p$.i && className(_el$3, _p$.i = _v$5);
|
|
128
|
-
return _p$;
|
|
129
|
-
}, {
|
|
130
|
-
e: void 0,
|
|
131
|
-
t: void 0,
|
|
132
|
-
a: void 0,
|
|
133
|
-
o: void 0,
|
|
134
|
-
i: void 0
|
|
135
|
-
});
|
|
136
|
-
return _el$;
|
|
137
|
-
})();
|
|
138
|
-
};
|
|
139
|
-
var Switch_default = Switch;
|
|
140
|
-
|
|
141
|
-
// src/components/switch/index.ts
|
|
142
|
-
var switch_default = Switch_default;
|
|
143
|
-
|
|
144
|
-
export { switch_default as default };
|
|
1
|
+
export { switch_default as default } from '../../chunk/P2L6LFLS.js';
|
|
@@ -1,159 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk/
|
|
4
|
-
|
|
5
|
-
// src/components/switch/Switch.tsx
|
|
6
|
-
import {
|
|
7
|
-
createSignal,
|
|
8
|
-
splitProps,
|
|
9
|
-
createMemo,
|
|
10
|
-
untrack
|
|
11
|
-
} from "solid-js";
|
|
12
|
-
|
|
13
|
-
// src/components/switch/Switch.styles.ts
|
|
14
|
-
var switchVariants = cva(
|
|
15
|
-
"switch inline-flex items-center gap-2 select-none",
|
|
16
|
-
{
|
|
17
|
-
variants: {
|
|
18
|
-
size: {
|
|
19
|
-
sm: "text-sm",
|
|
20
|
-
md: "text-base",
|
|
21
|
-
lg: "text-lg"
|
|
22
|
-
},
|
|
23
|
-
disabled: {
|
|
24
|
-
true: "opacity-50 cursor-not-allowed",
|
|
25
|
-
false: ""
|
|
26
|
-
},
|
|
27
|
-
rounded: {
|
|
28
|
-
true: "",
|
|
29
|
-
false: ""
|
|
30
|
-
},
|
|
31
|
-
outlined: {
|
|
32
|
-
true: "",
|
|
33
|
-
false: ""
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
defaultVariants: {
|
|
37
|
-
size: "md",
|
|
38
|
-
disabled: false,
|
|
39
|
-
rounded: true,
|
|
40
|
-
outlined: false
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
var checkVariants = cva(
|
|
45
|
-
[
|
|
46
|
-
"relative transition-colors duration-200",
|
|
47
|
-
"after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out"
|
|
48
|
-
].join(" "),
|
|
49
|
-
{
|
|
50
|
-
variants: {
|
|
51
|
-
size: {
|
|
52
|
-
sm: "w-8 h-4 after:w-3 after:h-3 after:left-0.5 after:top-0.5 peer-checked:after:translate-x-4",
|
|
53
|
-
md: "w-10 h-6 after:w-4 after:h-4 after:left-1 after:top-1 peer-checked:after:translate-x-4",
|
|
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
|
-
},
|
|
56
|
-
color: {
|
|
57
|
-
blue: "peer-checked:bg-blue-500",
|
|
58
|
-
green: "peer-checked:bg-green-500",
|
|
59
|
-
red: "peer-checked:bg-red-500",
|
|
60
|
-
yellow: "peer-checked:bg-yellow-400",
|
|
61
|
-
gray: "peer-checked:bg-gray-500"
|
|
62
|
-
},
|
|
63
|
-
passiveColor: {
|
|
64
|
-
blue: "bg-blue-200",
|
|
65
|
-
green: "bg-green-200",
|
|
66
|
-
red: "bg-red-200",
|
|
67
|
-
yellow: "bg-yellow-200",
|
|
68
|
-
gray: "bg-gray-300"
|
|
69
|
-
},
|
|
70
|
-
rounded: {
|
|
71
|
-
true: "rounded-full after:rounded-full",
|
|
72
|
-
false: "rounded-md after:rounded-sm"
|
|
73
|
-
},
|
|
74
|
-
outlined: {
|
|
75
|
-
true: "ring-2 ring-inset ring-white",
|
|
76
|
-
false: ""
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
defaultVariants: {
|
|
80
|
-
size: "md",
|
|
81
|
-
color: "blue",
|
|
82
|
-
passiveColor: "gray",
|
|
83
|
-
rounded: true,
|
|
84
|
-
outlined: false
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
// src/components/switch/Switch.tsx
|
|
90
|
-
var Switch = (props) => {
|
|
91
|
-
const [localProps, variantProps, otherProps] = splitProps(
|
|
92
|
-
props,
|
|
93
|
-
[
|
|
94
|
-
"children",
|
|
95
|
-
"checked",
|
|
96
|
-
"defaultChecked",
|
|
97
|
-
"onChange",
|
|
98
|
-
"name",
|
|
99
|
-
"required",
|
|
100
|
-
"disabled",
|
|
101
|
-
"aria-label",
|
|
102
|
-
"aria-describedby"
|
|
103
|
-
],
|
|
104
|
-
["size", "rounded", "outlined", "color", "passiveColor"]
|
|
105
|
-
);
|
|
106
|
-
const isControlled = localProps.checked !== void 0;
|
|
107
|
-
const [internalChecked, setInternalChecked] = createSignal(
|
|
108
|
-
localProps.defaultChecked ?? false
|
|
109
|
-
);
|
|
110
|
-
const checkedValue = createMemo(
|
|
111
|
-
() => untrack(() => isControlled ? localProps.checked : internalChecked())
|
|
112
|
-
);
|
|
113
|
-
const switchClasses = createMemo(() => switchVariants(variantProps));
|
|
114
|
-
const checkClasses = createMemo(
|
|
115
|
-
() => checkVariants({
|
|
116
|
-
size: variantProps.size,
|
|
117
|
-
color: variantProps.color,
|
|
118
|
-
passiveColor: variantProps.passiveColor,
|
|
119
|
-
rounded: variantProps.rounded,
|
|
120
|
-
outlined: variantProps.outlined
|
|
121
|
-
})
|
|
122
|
-
);
|
|
123
|
-
const handleChange = (e) => {
|
|
124
|
-
const next = e.currentTarget.checked;
|
|
125
|
-
untrack(() => {
|
|
126
|
-
if (!isControlled) setInternalChecked(next);
|
|
127
|
-
localProps.onChange?.(next);
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
return <label
|
|
131
|
-
class={switchClasses()}
|
|
132
|
-
role="switch"
|
|
133
|
-
aria-checked={checkedValue()}
|
|
134
|
-
aria-label={localProps["aria-label"]}
|
|
135
|
-
aria-describedby={localProps["aria-describedby"]}
|
|
136
|
-
>
|
|
137
|
-
<input
|
|
138
|
-
type="checkbox"
|
|
139
|
-
class="sr-only peer"
|
|
140
|
-
checked={checkedValue()}
|
|
141
|
-
onChange={handleChange}
|
|
142
|
-
name={localProps.name}
|
|
143
|
-
required={localProps.required}
|
|
144
|
-
disabled={localProps.disabled}
|
|
145
|
-
aria-hidden="true"
|
|
146
|
-
{...otherProps}
|
|
147
|
-
/>
|
|
148
|
-
|
|
149
|
-
<span class={checkClasses()} />
|
|
150
|
-
<span class="control-label">{localProps.children}</span>
|
|
151
|
-
</label>;
|
|
152
|
-
};
|
|
153
|
-
var Switch_default = Switch;
|
|
154
|
-
|
|
155
|
-
// src/components/switch/index.ts
|
|
156
|
-
var switch_default = Switch_default;
|
|
2
|
+
switch_default
|
|
3
|
+
} from "../../chunk/GLEAR2TS.jsx";
|
|
4
|
+
import "../../chunk/P7WPLZNA.jsx";
|
|
157
5
|
export {
|
|
158
6
|
switch_default as default
|
|
159
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { table_default as default } from '../../chunk/QYEMOKUG.js';
|
|
@@ -1,42 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { T as Tabs } from '../../Tabs-BEnRV6GG.js';
|
|
2
|
+
export { a as TabsProps } from '../../Tabs-BEnRV6GG.js';
|
|
3
|
+
import 'solid-js';
|
|
4
|
+
import '../../classes-B_S9K-9I.js';
|
|
3
5
|
|
|
4
|
-
declare const tabsNavVariants: {
|
|
5
|
-
(props?: (ConfigVariants<{
|
|
6
|
-
type: {
|
|
7
|
-
basic: string;
|
|
8
|
-
boxed: string;
|
|
9
|
-
toggle: string;
|
|
10
|
-
"toggle-rounded": string;
|
|
11
|
-
};
|
|
12
|
-
size: {
|
|
13
|
-
sm: string;
|
|
14
|
-
md: string;
|
|
15
|
-
lg: string;
|
|
16
|
-
};
|
|
17
|
-
alignment: {
|
|
18
|
-
left: string;
|
|
19
|
-
center: string;
|
|
20
|
-
right: string;
|
|
21
|
-
};
|
|
22
|
-
expanded: {
|
|
23
|
-
true: string;
|
|
24
|
-
false: string;
|
|
25
|
-
};
|
|
26
|
-
}> & ClassProps) | undefined): string;
|
|
27
|
-
variantKeys: ("type" | "size" | "alignment" | "expanded")[];
|
|
28
|
-
};
|
|
29
6
|
|
|
30
|
-
type TabItem = {
|
|
31
|
-
label: string;
|
|
32
|
-
content: JSX.Element;
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
};
|
|
35
|
-
type TabsProps = {
|
|
36
|
-
items: TabItem[];
|
|
37
|
-
value?: number;
|
|
38
|
-
onChange?: (index: number) => void;
|
|
39
|
-
} & VariantProps<typeof tabsNavVariants>;
|
|
40
|
-
declare const Tabs: Component<TabsProps>;
|
|
41
7
|
|
|
42
|
-
export {
|
|
8
|
+
export { Tabs as default };
|