@pathscale/ui 0.0.1 → 0.0.2
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-nwuRbRRw.d.ts +27 -0
- package/dist/Checkbox-BjaweaOH.d.ts +40 -0
- package/dist/Pagination-BlrjElGg.d.ts +43 -0
- package/dist/Progress-a616LgE0.d.ts +5 -0
- package/dist/Select-CP-TUHJv.d.ts +44 -0
- package/dist/Switch-3IXS_68H.d.ts +72 -0
- package/dist/Tabs-BNR3p92D.d.ts +42 -0
- package/dist/Tag-BPrhn-Ne.d.ts +42 -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/4TWLQ3IA.js +103 -0
- package/dist/chunk/6SBH3KSM.jsx +96 -0
- package/dist/chunk/CJZGTNJZ.js +115 -0
- package/dist/chunk/DBQ7IOPU.js +189 -0
- package/dist/chunk/DNTGSCVF.jsx +100 -0
- package/dist/chunk/ELRAUORW.jsx +179 -0
- package/dist/chunk/FPUQ25SO.js +137 -0
- package/dist/chunk/GLEAR2TS.jsx +160 -0
- package/dist/chunk/KV6LTJHI.jsx +175 -0
- package/dist/chunk/LI3HCFL7.jsx +132 -0
- package/dist/chunk/MMTAND25.jsx +126 -0
- package/dist/chunk/MXG3MBEN.jsx +148 -0
- package/dist/chunk/NZKPDBTE.js +118 -0
- package/dist/chunk/P2L6LFLS.js +144 -0
- package/dist/chunk/QLESLIWS.jsx +110 -0
- package/dist/chunk/QNOJ6PCD.js +278 -0
- package/dist/chunk/QONDPQ2I.jsx +105 -0
- package/dist/chunk/S3ZDSQSV.js +98 -0
- package/dist/chunk/V6Y5E7BL.js +133 -0
- package/dist/chunk/WCBMW2TP.jsx +203 -0
- package/dist/chunk/WOT36Q7O.js +166 -0
- package/dist/components/Progress/index.d.ts +2 -3
- package/dist/components/Progress/index.js +1 -278
- package/dist/components/Progress/index.jsx +7 -194
- 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/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/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/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/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/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/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 +11 -0
- package/dist/index.js +12 -1
- package/dist/index.jsx +47 -1
- package/package.json +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { template, spread, mergeProps, insert, createComponent, effect, className, setAttribute, use } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createMemo, createEffect, Show, untrack } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/checkbox/Checkbox.styles.ts
|
|
6
|
+
var checkboxVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"relative inline-flex items-center gap-2 cursor-pointer",
|
|
9
|
+
"select-none",
|
|
10
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
11
|
+
],
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
sm: "text-sm",
|
|
16
|
+
md: "text-base",
|
|
17
|
+
lg: "text-lg"
|
|
18
|
+
},
|
|
19
|
+
color: {
|
|
20
|
+
primary: "text-primary",
|
|
21
|
+
success: "text-green-600",
|
|
22
|
+
warning: "text-yellow-600",
|
|
23
|
+
danger: "text-red-600"
|
|
24
|
+
},
|
|
25
|
+
checked: {
|
|
26
|
+
true: "",
|
|
27
|
+
false: ""
|
|
28
|
+
},
|
|
29
|
+
indeterminate: {
|
|
30
|
+
true: "",
|
|
31
|
+
false: ""
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
size: "md",
|
|
36
|
+
color: "primary",
|
|
37
|
+
checked: false,
|
|
38
|
+
indeterminate: false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// src/components/checkbox/Checkbox.tsx
|
|
44
|
+
var _tmpl$ = /* @__PURE__ */ template(`<span class="absolute top-1/2 left-1/2 w-2 h-0.5 bg-white -translate-x-1/2 -translate-y-1/2"aria-hidden=true>`);
|
|
45
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<span class=ml-2>`);
|
|
46
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<label role=checkbox><input type=checkbox class="peer absolute opacity-0 w-4 h-4"aria-hidden=true><span>`);
|
|
47
|
+
var Checkbox = (props) => {
|
|
48
|
+
const [localProps, variantProps, otherProps] = splitProps(props, ["label", "indeterminate", "type", "onChange", "onFocus", "onBlur", "checked", "disabled", "aria-label", "aria-describedby"], ["class", ...checkboxVariants.variantKeys]);
|
|
49
|
+
let inputRef;
|
|
50
|
+
const checkboxClasses = createMemo(() => checkboxVariants(variantProps));
|
|
51
|
+
const markerClasses = createMemo(() => classes("inline-block w-4 h-4 border border-gray-400 rounded-sm peer-checked:bg-current", localProps.indeterminate ? "bg-gray-400 relative" : ""));
|
|
52
|
+
const handleChange = (e) => {
|
|
53
|
+
untrack(() => {
|
|
54
|
+
if (typeof localProps.onChange === "function") {
|
|
55
|
+
localProps.onChange(e);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const handleFocus = (e) => {
|
|
60
|
+
untrack(() => {
|
|
61
|
+
if (typeof localProps.onFocus === "function") {
|
|
62
|
+
localProps.onFocus(e);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const handleBlur = (e) => {
|
|
67
|
+
untrack(() => {
|
|
68
|
+
if (typeof localProps.onBlur === "function") {
|
|
69
|
+
localProps.onBlur(e);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
createEffect(() => {
|
|
74
|
+
if (inputRef) {
|
|
75
|
+
untrack(() => {
|
|
76
|
+
inputRef.indeterminate = !!localProps.indeterminate;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return (() => {
|
|
81
|
+
var _el$ = _tmpl$3(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
82
|
+
var _ref$ = inputRef;
|
|
83
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : inputRef = _el$2;
|
|
84
|
+
spread(_el$2, mergeProps({
|
|
85
|
+
get checked() {
|
|
86
|
+
return localProps.checked;
|
|
87
|
+
},
|
|
88
|
+
get disabled() {
|
|
89
|
+
return localProps.disabled;
|
|
90
|
+
}
|
|
91
|
+
}, otherProps, {
|
|
92
|
+
"onChange": handleChange,
|
|
93
|
+
"onFocus": handleFocus,
|
|
94
|
+
"onBlur": handleBlur
|
|
95
|
+
}), false, false);
|
|
96
|
+
insert(_el$3, createComponent(Show, {
|
|
97
|
+
get when() {
|
|
98
|
+
return localProps.indeterminate;
|
|
99
|
+
},
|
|
100
|
+
get children() {
|
|
101
|
+
return _tmpl$();
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
insert(_el$, createComponent(Show, {
|
|
105
|
+
get when() {
|
|
106
|
+
return localProps.label;
|
|
107
|
+
},
|
|
108
|
+
get children() {
|
|
109
|
+
var _el$5 = _tmpl$2();
|
|
110
|
+
insert(_el$5, () => localProps.label);
|
|
111
|
+
return _el$5;
|
|
112
|
+
}
|
|
113
|
+
}), null);
|
|
114
|
+
effect((_p$) => {
|
|
115
|
+
var _v$ = checkboxClasses(), _v$2 = localProps.indeterminate ? "mixed" : localProps.checked, _v$3 = localProps["aria-label"], _v$4 = localProps["aria-describedby"], _v$5 = markerClasses();
|
|
116
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
117
|
+
_v$2 !== _p$.t && setAttribute(_el$, "aria-checked", _p$.t = _v$2);
|
|
118
|
+
_v$3 !== _p$.a && setAttribute(_el$, "aria-label", _p$.a = _v$3);
|
|
119
|
+
_v$4 !== _p$.o && setAttribute(_el$, "aria-describedby", _p$.o = _v$4);
|
|
120
|
+
_v$5 !== _p$.i && className(_el$3, _p$.i = _v$5);
|
|
121
|
+
return _p$;
|
|
122
|
+
}, {
|
|
123
|
+
e: void 0,
|
|
124
|
+
t: void 0,
|
|
125
|
+
a: void 0,
|
|
126
|
+
o: void 0,
|
|
127
|
+
i: void 0
|
|
128
|
+
});
|
|
129
|
+
return _el$;
|
|
130
|
+
})();
|
|
131
|
+
};
|
|
132
|
+
var Checkbox_default = Checkbox;
|
|
133
|
+
|
|
134
|
+
// src/components/checkbox/index.ts
|
|
135
|
+
var checkbox_default = Checkbox_default;
|
|
136
|
+
|
|
137
|
+
export { checkbox_default };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
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;
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
switch_default
|
|
160
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/tabs/Tabs.tsx
|
|
6
|
+
import {
|
|
7
|
+
createSignal,
|
|
8
|
+
splitProps,
|
|
9
|
+
For,
|
|
10
|
+
Show,
|
|
11
|
+
createMemo
|
|
12
|
+
} from "solid-js";
|
|
13
|
+
|
|
14
|
+
// src/components/tabs/Tabs.styles.ts
|
|
15
|
+
var tabsNavVariants = cva(
|
|
16
|
+
"flex text-sm font-medium text-gray-600 dark:text-gray-300",
|
|
17
|
+
{
|
|
18
|
+
variants: {
|
|
19
|
+
type: {
|
|
20
|
+
basic: "",
|
|
21
|
+
boxed: "flex gap-2",
|
|
22
|
+
toggle: "inline-flex rounded-md p-1",
|
|
23
|
+
"toggle-rounded": "inline-flex rounded-full p-1"
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
sm: "text-xs gap-1",
|
|
27
|
+
md: "text-sm gap-2",
|
|
28
|
+
lg: "text-base gap-3"
|
|
29
|
+
},
|
|
30
|
+
alignment: {
|
|
31
|
+
left: "justify-start",
|
|
32
|
+
center: "justify-center",
|
|
33
|
+
right: "justify-end"
|
|
34
|
+
},
|
|
35
|
+
expanded: {
|
|
36
|
+
true: "w-full",
|
|
37
|
+
false: ""
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
type: "basic",
|
|
42
|
+
size: "md",
|
|
43
|
+
alignment: "left",
|
|
44
|
+
expanded: false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
var tabTriggerVariants = cva(
|
|
49
|
+
"inline-flex items-center justify-center whitespace-nowrap font-medium text-sm transition-colors",
|
|
50
|
+
{
|
|
51
|
+
variants: {
|
|
52
|
+
size: {
|
|
53
|
+
sm: "text-xs px-2 py-1",
|
|
54
|
+
md: "text-sm px-3 py-2",
|
|
55
|
+
lg: "text-base px-4 py-3"
|
|
56
|
+
},
|
|
57
|
+
type: {
|
|
58
|
+
basic: "border-b-2 transition-colors hover:text-blue-600",
|
|
59
|
+
boxed: "rounded-t px-4 py-2 hover:text-blue-600",
|
|
60
|
+
toggle: "border -ml-px px-4 py-2 transition-colors first:ml-0 first:rounded-l-md last:rounded-r-md",
|
|
61
|
+
"toggle-rounded": "border -ml-px first:ml-0 first:rounded-l-full last:rounded-r-full transition-colors"
|
|
62
|
+
},
|
|
63
|
+
active: {
|
|
64
|
+
true: "",
|
|
65
|
+
false: ""
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
true: "opacity-50 cursor-not-allowed pointer-events-none",
|
|
69
|
+
false: ""
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
compoundVariants: [
|
|
73
|
+
{
|
|
74
|
+
type: "basic",
|
|
75
|
+
active: true,
|
|
76
|
+
class: "border-blue-600 text-blue-600"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "basic",
|
|
80
|
+
active: false,
|
|
81
|
+
class: "border-transparent text-gray-500 dark:text-gray-400"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "boxed",
|
|
85
|
+
active: true,
|
|
86
|
+
class: "border-x border-t border-b-0 border-gray-400 dark:border-gray-600 text-blue-600"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "boxed",
|
|
90
|
+
active: false,
|
|
91
|
+
class: "border-b border-transparent text-gray-500 dark:text-gray-400 hover:text-blue-600"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: "toggle",
|
|
95
|
+
active: true,
|
|
96
|
+
class: "bg-blue-600 text-white border-blue-600"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "toggle",
|
|
100
|
+
active: false,
|
|
101
|
+
class: "bg-transparent text-gray-600 dark:text-gray-300 border-gray-300 dark:border-gray-600"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: "toggle-rounded",
|
|
105
|
+
active: true,
|
|
106
|
+
class: "bg-blue-600 text-white border-blue-600"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: "toggle-rounded",
|
|
110
|
+
active: false,
|
|
111
|
+
class: "bg-transparent text-gray-600 dark:text-gray-300 border-gray-300 dark:border-gray-600"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
defaultVariants: {
|
|
115
|
+
active: false,
|
|
116
|
+
disabled: false
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
// src/components/tabs/Tabs.tsx
|
|
122
|
+
var Tabs = (props) => {
|
|
123
|
+
const [local, variantProps, otherProps] = splitProps(
|
|
124
|
+
props,
|
|
125
|
+
["items", "value", "onChange"],
|
|
126
|
+
["size", "type", "alignment", "expanded"]
|
|
127
|
+
);
|
|
128
|
+
const [internalActive, setInternalActive] = createSignal(local.value ?? 0);
|
|
129
|
+
const isControlled = () => local.value !== void 0;
|
|
130
|
+
const active = createMemo(
|
|
131
|
+
() => isControlled() ? local.value : internalActive()
|
|
132
|
+
);
|
|
133
|
+
const handleChange = (i) => {
|
|
134
|
+
const item = local.items[i];
|
|
135
|
+
if (!item || item.disabled) return;
|
|
136
|
+
if (!isControlled()) {
|
|
137
|
+
setInternalActive(i);
|
|
138
|
+
}
|
|
139
|
+
local.onChange?.(i);
|
|
140
|
+
};
|
|
141
|
+
return <div {...otherProps}>
|
|
142
|
+
<nav class={tabsNavVariants(variantProps)}>
|
|
143
|
+
<ul class="flex gap-0">
|
|
144
|
+
<For each={local.items}>
|
|
145
|
+
{(tab, i) => <li>
|
|
146
|
+
<button
|
|
147
|
+
class={tabTriggerVariants({
|
|
148
|
+
type: variantProps.type ?? "basic",
|
|
149
|
+
size: variantProps.size ?? "md",
|
|
150
|
+
active: i() === active(),
|
|
151
|
+
disabled: tab.disabled
|
|
152
|
+
})}
|
|
153
|
+
onClick={() => handleChange(i())}
|
|
154
|
+
>
|
|
155
|
+
{tab.label}
|
|
156
|
+
</button>
|
|
157
|
+
</li>}
|
|
158
|
+
</For>
|
|
159
|
+
</ul>
|
|
160
|
+
</nav>
|
|
161
|
+
<div class="pt-4">
|
|
162
|
+
<Show when={local.items[active()]}>
|
|
163
|
+
{local.items[active()]?.content}
|
|
164
|
+
</Show>
|
|
165
|
+
</div>
|
|
166
|
+
</div>;
|
|
167
|
+
};
|
|
168
|
+
var Tabs_default = Tabs;
|
|
169
|
+
|
|
170
|
+
// src/components/tabs/index.ts
|
|
171
|
+
var tabs_default = Tabs_default;
|
|
172
|
+
|
|
173
|
+
export {
|
|
174
|
+
tabs_default
|
|
175
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/tag/Tag.tsx
|
|
7
|
+
import {
|
|
8
|
+
splitProps,
|
|
9
|
+
createMemo,
|
|
10
|
+
Show,
|
|
11
|
+
untrack
|
|
12
|
+
} from "solid-js";
|
|
13
|
+
|
|
14
|
+
// src/components/tag/Tag.styles.ts
|
|
15
|
+
var tagVariants = cva(
|
|
16
|
+
[
|
|
17
|
+
"inline-flex items-center gap-2 px-3 py-1 text-sm rounded",
|
|
18
|
+
"transition select-none"
|
|
19
|
+
],
|
|
20
|
+
{
|
|
21
|
+
variants: {
|
|
22
|
+
size: {
|
|
23
|
+
normal: "text-xs px-2 py-0.5",
|
|
24
|
+
medium: "text-sm px-3 py-1",
|
|
25
|
+
large: "text-base px-4 py-2"
|
|
26
|
+
},
|
|
27
|
+
type: {
|
|
28
|
+
primary: "bg-blue-500 text-white",
|
|
29
|
+
info: "bg-sky-500 text-white",
|
|
30
|
+
success: "bg-green-500 text-white",
|
|
31
|
+
warning: "bg-yellow-500 text-black",
|
|
32
|
+
danger: "bg-red-500 text-white",
|
|
33
|
+
dark: "bg-zinc-800 text-white",
|
|
34
|
+
light: "bg-gray-100 text-black"
|
|
35
|
+
},
|
|
36
|
+
rounded: {
|
|
37
|
+
true: "rounded-full",
|
|
38
|
+
false: ""
|
|
39
|
+
},
|
|
40
|
+
closable: {
|
|
41
|
+
true: "pr-1",
|
|
42
|
+
false: ""
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
size: "normal"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
// src/components/tag/Tag.tsx
|
|
52
|
+
var Tag = (props) => {
|
|
53
|
+
const [localProps, variantProps, otherProps] = splitProps(
|
|
54
|
+
props,
|
|
55
|
+
[
|
|
56
|
+
"closable",
|
|
57
|
+
"attached",
|
|
58
|
+
"onClose",
|
|
59
|
+
"ariaCloseLabel",
|
|
60
|
+
"closeIcon",
|
|
61
|
+
"children",
|
|
62
|
+
"type"
|
|
63
|
+
],
|
|
64
|
+
["class", ...tagVariants.variantKeys]
|
|
65
|
+
);
|
|
66
|
+
const isAttachedClosable = createMemo(
|
|
67
|
+
() => untrack(() => localProps.attached && localProps.closable)
|
|
68
|
+
);
|
|
69
|
+
const isClosable = createMemo(
|
|
70
|
+
() => untrack(() => localProps.closable && !localProps.attached)
|
|
71
|
+
);
|
|
72
|
+
const tagClasses = createMemo(
|
|
73
|
+
() => classes(
|
|
74
|
+
tagVariants({
|
|
75
|
+
...variantProps,
|
|
76
|
+
closable: localProps.closable
|
|
77
|
+
}),
|
|
78
|
+
variantProps.class
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
const attachedButtonClasses = createMemo(
|
|
82
|
+
() => tagVariants({
|
|
83
|
+
...variantProps,
|
|
84
|
+
class: "ml-1 text-xs hover:opacity-80"
|
|
85
|
+
})
|
|
86
|
+
);
|
|
87
|
+
const handleClose = (e) => {
|
|
88
|
+
untrack(() => {
|
|
89
|
+
if (typeof localProps.onClose === "function") {
|
|
90
|
+
localProps.onClose(e);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
return <div
|
|
95
|
+
class={isAttachedClosable() ? "tags has-addons" : void 0}
|
|
96
|
+
role="group"
|
|
97
|
+
>
|
|
98
|
+
<span class={tagClasses()} role="status" {...otherProps}>
|
|
99
|
+
<span class="truncate">{localProps.children}</span>
|
|
100
|
+
|
|
101
|
+
<Show when={isClosable()}>
|
|
102
|
+
<button
|
|
103
|
+
type="button"
|
|
104
|
+
aria-label={localProps.ariaCloseLabel ?? "Remove tag"}
|
|
105
|
+
onClick={handleClose}
|
|
106
|
+
class="ml-2 text-xs text-white hover:opacity-80"
|
|
107
|
+
>
|
|
108
|
+
{localProps.closeIcon ?? "\xD7"}
|
|
109
|
+
</button>
|
|
110
|
+
</Show>
|
|
111
|
+
</span>
|
|
112
|
+
|
|
113
|
+
<Show when={isAttachedClosable()}>
|
|
114
|
+
<button
|
|
115
|
+
type="button"
|
|
116
|
+
aria-label={localProps.ariaCloseLabel ?? "Remove tag"}
|
|
117
|
+
onClick={handleClose}
|
|
118
|
+
class={attachedButtonClasses()}
|
|
119
|
+
>
|
|
120
|
+
{localProps.closeIcon ?? "\xD7"}
|
|
121
|
+
</button>
|
|
122
|
+
</Show>
|
|
123
|
+
</div>;
|
|
124
|
+
};
|
|
125
|
+
var Tag_default = Tag;
|
|
126
|
+
|
|
127
|
+
// src/components/tag/index.ts
|
|
128
|
+
var tag_default = Tag_default;
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
tag_default
|
|
132
|
+
};
|