@pathscale/ui 0.0.1
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/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/Avatar-CzIirpVq.d.ts +33 -0
- package/dist/Button-B50OLXuV.d.ts +63 -0
- package/dist/Input-BQbTzjIO.d.ts +34 -0
- package/dist/Textarea-Cpdk7m6S.d.ts +37 -0
- package/dist/chunk/2JGZSAW5.js +107 -0
- package/dist/chunk/4RCWSX7S.jsx +101 -0
- package/dist/chunk/EB7KXR65.js +102 -0
- package/dist/chunk/G6RG4LR7.js +87 -0
- package/dist/chunk/GA2HCFRS.jsx +228 -0
- package/dist/chunk/HKS7ET6T.js +56 -0
- package/dist/chunk/KACNXPUM.jsx +103 -0
- package/dist/chunk/N7BXP7EI.jsx +102 -0
- package/dist/chunk/NZZRKP74.js +214 -0
- package/dist/chunk/P7WPLZNA.jsx +59 -0
- package/dist/chunk/T2DPPLBQ.js +100 -0
- package/dist/chunk/WB6NEEQV.jsx +107 -0
- package/dist/classes-B_S9K-9I.d.ts +13 -0
- package/dist/components/Progress/index.d.ts +42 -0
- package/dist/components/Progress/index.js +278 -0
- package/dist/components/Progress/index.jsx +202 -0
- package/dist/components/accordion/index.d.ts +27 -0
- package/dist/components/accordion/index.js +118 -0
- package/dist/components/accordion/index.jsx +104 -0
- package/dist/components/avatar/index.d.ts +8 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/avatar/index.jsx +7 -0
- package/dist/components/breadcrumb/index.d.ts +47 -0
- package/dist/components/breadcrumb/index.js +133 -0
- package/dist/components/breadcrumb/index.jsx +125 -0
- package/dist/components/button/index.d.ts +9 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button/index.jsx +8 -0
- package/dist/components/checkbox/index.d.ts +40 -0
- package/dist/components/checkbox/index.js +137 -0
- package/dist/components/checkbox/index.jsx +147 -0
- package/dist/components/input/index.d.ts +8 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/index.jsx +7 -0
- package/dist/components/pagination/index.d.ts +43 -0
- package/dist/components/pagination/index.js +189 -0
- package/dist/components/pagination/index.jsx +178 -0
- package/dist/components/polymorphic/index.d.ts +35 -0
- package/dist/components/polymorphic/index.js +1 -0
- package/dist/components/polymorphic/index.jsx +8 -0
- package/dist/components/select/index.d.ts +44 -0
- package/dist/components/select/index.js +98 -0
- package/dist/components/select/index.jsx +95 -0
- package/dist/components/switch/index.d.ts +72 -0
- package/dist/components/switch/index.js +144 -0
- package/dist/components/switch/index.jsx +159 -0
- package/dist/components/tabs/index.d.ts +42 -0
- package/dist/components/tabs/index.js +166 -0
- package/dist/components/tabs/index.jsx +174 -0
- package/dist/components/tag/index.d.ts +42 -0
- package/dist/components/tag/index.js +115 -0
- package/dist/components/tag/index.jsx +131 -0
- package/dist/components/textarea/index.d.ts +8 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/textarea/index.jsx +7 -0
- package/dist/components/tooltip/index.d.ts +53 -0
- package/dist/components/tooltip/index.js +103 -0
- package/dist/components/tooltip/index.jsx +99 -0
- package/dist/components/upload/index.d.ts +39 -0
- package/dist/components/upload/index.js +98 -0
- package/dist/components/upload/index.jsx +109 -0
- package/dist/index.css +73 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -0
- package/dist/index.jsx +20 -0
- package/package.json +67 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/lib/style/classes.ts
|
|
2
|
+
function classes(...args) {
|
|
3
|
+
return args.flat().filter(Boolean).join(" ");
|
|
4
|
+
}
|
|
5
|
+
function falsyToString(value) {
|
|
6
|
+
return typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
7
|
+
}
|
|
8
|
+
function cva(base, config) {
|
|
9
|
+
const fn = (props) => {
|
|
10
|
+
if (config?.variants == null) return classes(base, props?.class);
|
|
11
|
+
const { variants, defaultVariants } = config;
|
|
12
|
+
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
13
|
+
const variantProp = props?.[variant];
|
|
14
|
+
const defaultVariantProp = defaultVariants?.[variant];
|
|
15
|
+
if (variantProp === null) return null;
|
|
16
|
+
const variantKey = falsyToString(variantProp) || falsyToString(
|
|
17
|
+
defaultVariantProp
|
|
18
|
+
);
|
|
19
|
+
return variants[variant]?.[variantKey];
|
|
20
|
+
});
|
|
21
|
+
const propsWithoutUndefined = Object.entries(props || {}).reduce(
|
|
22
|
+
(acc, [key, value]) => {
|
|
23
|
+
if (value !== void 0) {
|
|
24
|
+
acc[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return acc;
|
|
27
|
+
},
|
|
28
|
+
{}
|
|
29
|
+
);
|
|
30
|
+
const getCompoundVariantClassNames = config?.compoundVariants?.reduce(
|
|
31
|
+
(acc, { class: cvClass, ...compoundVariantOptions }) => {
|
|
32
|
+
const isMatch = Object.entries(compoundVariantOptions).every(
|
|
33
|
+
([key, value]) => {
|
|
34
|
+
const currentValue = {
|
|
35
|
+
...defaultVariants,
|
|
36
|
+
...propsWithoutUndefined
|
|
37
|
+
}[key];
|
|
38
|
+
return Array.isArray(value) ? value.includes(currentValue) : currentValue === value;
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
return isMatch ? [...acc, cvClass] : acc;
|
|
42
|
+
},
|
|
43
|
+
[]
|
|
44
|
+
);
|
|
45
|
+
return classes(
|
|
46
|
+
base,
|
|
47
|
+
getVariantClassNames,
|
|
48
|
+
getCompoundVariantClassNames,
|
|
49
|
+
props?.class
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
fn.variantKeys = config?.variants ? Object.keys(config.variants) : [];
|
|
53
|
+
return fn;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
classes,
|
|
58
|
+
cva
|
|
59
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { cva } from './HKS7ET6T.js';
|
|
2
|
+
import { delegateEvents, template, insert, createComponent, spread, mergeProps as mergeProps$1, effect, setAttribute } from 'solid-js/web';
|
|
3
|
+
import { mergeProps, splitProps, createSignal, createMemo, untrack, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/input/Input.styles.ts
|
|
6
|
+
var inputVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"block w-full appearance-none outline-none bg-transparent",
|
|
9
|
+
"border transition-colors duration-200",
|
|
10
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
11
|
+
],
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
color: {
|
|
15
|
+
danger: "border-red-500 text-red-600",
|
|
16
|
+
success: "border-green-500 text-green-600",
|
|
17
|
+
warning: "border-orange-500 text-orange-600"
|
|
18
|
+
},
|
|
19
|
+
rounded: {
|
|
20
|
+
true: "rounded-full",
|
|
21
|
+
false: "rounded-md"
|
|
22
|
+
},
|
|
23
|
+
expanded: {
|
|
24
|
+
true: "w-full",
|
|
25
|
+
false: "w-fit"
|
|
26
|
+
},
|
|
27
|
+
loading: {
|
|
28
|
+
true: "opacity-50",
|
|
29
|
+
false: ""
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
color: void 0,
|
|
34
|
+
rounded: false,
|
|
35
|
+
expanded: true,
|
|
36
|
+
loading: false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// src/components/input/Input.tsx
|
|
42
|
+
var _tmpl$ = /* @__PURE__ */ template(`<span class="absolute left-3 top-1/2 -translate-y-1/2">`);
|
|
43
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<button type=button class="absolute right-3 top-1/2 -translate-y-1/2 outline-none">`);
|
|
44
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div class="relative flex items-center"><input>`);
|
|
45
|
+
var Input = (props) => {
|
|
46
|
+
const defaultedProps = mergeProps({
|
|
47
|
+
type: "text"
|
|
48
|
+
}, props);
|
|
49
|
+
const [localProps, variantProps, otherProps] = splitProps(defaultedProps, ["type", "passwordReveal", "leftIcon", "rightIcon"], ["class", ...inputVariants.variantKeys]);
|
|
50
|
+
const [showPassword, setShowPassword] = createSignal(false);
|
|
51
|
+
const computedType = createMemo(() => untrack(() => localProps.passwordReveal && showPassword() ? "text" : defaultedProps.type));
|
|
52
|
+
const classes = createMemo(() => inputVariants(variantProps));
|
|
53
|
+
const handlePasswordToggle = () => {
|
|
54
|
+
untrack(() => setShowPassword((prev) => !prev));
|
|
55
|
+
};
|
|
56
|
+
return (() => {
|
|
57
|
+
var _el$ = _tmpl$3(), _el$3 = _el$.firstChild;
|
|
58
|
+
insert(_el$, createComponent(Show, {
|
|
59
|
+
get when() {
|
|
60
|
+
return localProps.leftIcon;
|
|
61
|
+
},
|
|
62
|
+
get children() {
|
|
63
|
+
var _el$2 = _tmpl$();
|
|
64
|
+
insert(_el$2, () => localProps.leftIcon);
|
|
65
|
+
return _el$2;
|
|
66
|
+
}
|
|
67
|
+
}), _el$3);
|
|
68
|
+
spread(_el$3, mergeProps$1({
|
|
69
|
+
get ["class"]() {
|
|
70
|
+
return classes();
|
|
71
|
+
},
|
|
72
|
+
get type() {
|
|
73
|
+
return computedType();
|
|
74
|
+
},
|
|
75
|
+
get ["aria-invalid"]() {
|
|
76
|
+
return variantProps.color === "danger" ? "true" : void 0;
|
|
77
|
+
}
|
|
78
|
+
}, otherProps), false, false);
|
|
79
|
+
insert(_el$, createComponent(Show, {
|
|
80
|
+
get when() {
|
|
81
|
+
return localProps.passwordReveal && localProps.rightIcon;
|
|
82
|
+
},
|
|
83
|
+
get children() {
|
|
84
|
+
var _el$4 = _tmpl$2();
|
|
85
|
+
_el$4.$$click = handlePasswordToggle;
|
|
86
|
+
insert(_el$4, () => localProps.rightIcon);
|
|
87
|
+
effect(() => setAttribute(_el$4, "aria-label", showPassword() ? "Hide password" : "Show password"));
|
|
88
|
+
return _el$4;
|
|
89
|
+
}
|
|
90
|
+
}), null);
|
|
91
|
+
return _el$;
|
|
92
|
+
})();
|
|
93
|
+
};
|
|
94
|
+
var Input_default = Input;
|
|
95
|
+
delegateEvents(["click"]);
|
|
96
|
+
|
|
97
|
+
// src/components/input/index.ts
|
|
98
|
+
var input_default = Input_default;
|
|
99
|
+
|
|
100
|
+
export { input_default };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/textarea/Textarea.tsx
|
|
7
|
+
import {
|
|
8
|
+
createMemo,
|
|
9
|
+
createSignal,
|
|
10
|
+
splitProps,
|
|
11
|
+
Show
|
|
12
|
+
} from "solid-js";
|
|
13
|
+
|
|
14
|
+
// src/components/textarea/Textarea.styles.ts
|
|
15
|
+
var textareaVariants = cva(
|
|
16
|
+
[
|
|
17
|
+
"block w-full rounded-md border bg-white px-3 py-2 text-sm",
|
|
18
|
+
"text-gray-900 placeholder-gray-400",
|
|
19
|
+
"focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent",
|
|
20
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
21
|
+
],
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
size: {
|
|
25
|
+
sm: "text-sm py-1.5",
|
|
26
|
+
md: "text-base py-2",
|
|
27
|
+
lg: "text-lg py-3"
|
|
28
|
+
},
|
|
29
|
+
color: {
|
|
30
|
+
primary: "border-blue-500",
|
|
31
|
+
info: "border-cyan-500",
|
|
32
|
+
success: "border-green-500",
|
|
33
|
+
warning: "border-yellow-500",
|
|
34
|
+
danger: "border-red-500"
|
|
35
|
+
},
|
|
36
|
+
loading: {
|
|
37
|
+
true: "opacity-50 cursor-wait",
|
|
38
|
+
false: ""
|
|
39
|
+
},
|
|
40
|
+
resize: {
|
|
41
|
+
none: "resize-none",
|
|
42
|
+
both: "resize",
|
|
43
|
+
x: "resize-x",
|
|
44
|
+
y: "resize-y"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
size: "md",
|
|
49
|
+
color: "primary",
|
|
50
|
+
loading: false,
|
|
51
|
+
resize: "y"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// src/components/textarea/Textarea.tsx
|
|
57
|
+
var Textarea = (props) => {
|
|
58
|
+
const [localProps, variantProps, otherProps] = splitProps(
|
|
59
|
+
props,
|
|
60
|
+
["hasCounter", "value", "onInput", "onFocus", "onBlur", "maxLength"],
|
|
61
|
+
["class", ...textareaVariants.variantKeys]
|
|
62
|
+
);
|
|
63
|
+
const [isFocused, setFocused] = createSignal(false);
|
|
64
|
+
const valueLength = createMemo(
|
|
65
|
+
() => typeof localProps.value === "string" ? localProps.value.length : 0
|
|
66
|
+
);
|
|
67
|
+
const showCounter = createMemo(
|
|
68
|
+
() => localProps.maxLength && localProps.hasCounter
|
|
69
|
+
);
|
|
70
|
+
return <div class="relative w-full">
|
|
71
|
+
<textarea
|
|
72
|
+
class={textareaVariants(variantProps)}
|
|
73
|
+
value={localProps.value}
|
|
74
|
+
maxLength={localProps.maxLength}
|
|
75
|
+
onInput={localProps.onInput}
|
|
76
|
+
onFocus={(e) => {
|
|
77
|
+
setFocused(true);
|
|
78
|
+
typeof localProps.onFocus === "function" && localProps.onFocus(e);
|
|
79
|
+
}}
|
|
80
|
+
onBlur={(e) => {
|
|
81
|
+
setFocused(false);
|
|
82
|
+
typeof localProps.onBlur === "function" && localProps.onBlur(e);
|
|
83
|
+
}}
|
|
84
|
+
aria-invalid={variantProps.color === "danger" ? "true" : void 0}
|
|
85
|
+
{...otherProps}
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<Show when={showCounter()}>
|
|
89
|
+
<small
|
|
90
|
+
class={classes(
|
|
91
|
+
"absolute bottom-1 right-2 text-xs text-gray-500 transition-opacity",
|
|
92
|
+
isFocused() ? "opacity-100" : "opacity-0"
|
|
93
|
+
)}
|
|
94
|
+
>
|
|
95
|
+
{valueLength()} / {localProps.maxLength}
|
|
96
|
+
</small>
|
|
97
|
+
</Show>
|
|
98
|
+
</div>;
|
|
99
|
+
};
|
|
100
|
+
var Textarea_default = Textarea;
|
|
101
|
+
|
|
102
|
+
// src/components/textarea/index.ts
|
|
103
|
+
var textarea_default = Textarea_default;
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
textarea_default
|
|
107
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type ClassArgs = string | number | boolean | null | undefined | ClassArgs[];
|
|
2
|
+
type ClassProps = {
|
|
3
|
+
class?: ClassArgs;
|
|
4
|
+
};
|
|
5
|
+
type OmitUndefined<T> = T extends undefined ? never : T;
|
|
6
|
+
type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
|
|
7
|
+
type ConfigSchema = Record<string, Record<string, ClassArgs>>;
|
|
8
|
+
type ConfigVariants<T extends ConfigSchema> = {
|
|
9
|
+
[Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined;
|
|
10
|
+
};
|
|
11
|
+
type VariantProps<Component extends (...args: []) => unknown> = Omit<OmitUndefined<Parameters<Component>[0]>, "class">;
|
|
12
|
+
|
|
13
|
+
export type { ConfigVariants as C, VariantProps as V, ClassProps as a };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Component } from 'solid-js';
|
|
2
|
+
|
|
3
|
+
declare const Progress$3: Component;
|
|
4
|
+
|
|
5
|
+
interface ProgressValueProps {
|
|
6
|
+
value: number;
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
shape?: "circle" | "rounded";
|
|
9
|
+
variant?: "filled" | "outlined" | "ghost";
|
|
10
|
+
}
|
|
11
|
+
declare const ProgressValue: Component<ProgressValueProps>;
|
|
12
|
+
|
|
13
|
+
interface ProgressProps$2 {
|
|
14
|
+
value: number;
|
|
15
|
+
size?: "sm" | "md" | "lg";
|
|
16
|
+
shape?: "circle" | "rounded";
|
|
17
|
+
variant?: "filled" | "outlined" | "ghost";
|
|
18
|
+
}
|
|
19
|
+
declare const Progress$2: Component<ProgressProps$2>;
|
|
20
|
+
|
|
21
|
+
interface ProgressProps$1 {
|
|
22
|
+
value: number;
|
|
23
|
+
size?: "sm" | "md" | "lg";
|
|
24
|
+
shape?: "circle" | "rounded";
|
|
25
|
+
variant?: "filled" | "outlined" | "ghost";
|
|
26
|
+
showValue?: boolean;
|
|
27
|
+
format?: "percent" | "raw";
|
|
28
|
+
}
|
|
29
|
+
declare const Progress$1: Component<ProgressProps$1>;
|
|
30
|
+
|
|
31
|
+
interface ProgressProps {
|
|
32
|
+
value: number | null;
|
|
33
|
+
size?: "sm" | "md" | "lg";
|
|
34
|
+
shape?: "circle" | "rounded";
|
|
35
|
+
variant?: "filled" | "outlined" | "ghost";
|
|
36
|
+
showValue?: boolean;
|
|
37
|
+
format?: "percent" | "raw";
|
|
38
|
+
color?: "danger" | "success" | "info" | "warning" | "default";
|
|
39
|
+
}
|
|
40
|
+
declare const Progress: Component<ProgressProps>;
|
|
41
|
+
|
|
42
|
+
export { Progress as ProgressColors, type ProgressProps as ProgressColorsProps, Progress$1 as ProgressPercent, type ProgressProps$1 as ProgressPercentProps, Progress$2 as ProgressSizes, type ProgressProps$2 as ProgressSizesProps, ProgressValue, type ProgressValueProps, Progress$3 as default };
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { cva } from '../../chunk/HKS7ET6T.js';
|
|
2
|
+
import { template, insert, effect, className, createComponent } from 'solid-js/web';
|
|
3
|
+
import { Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/Progress/ProgressValue.styles.ts
|
|
6
|
+
var progressWrapper = cva("mt-4 w-full max-w-md");
|
|
7
|
+
var progressBar = cva("w-full h-5 relative overflow-hidden rounded-lg bg-gray-200");
|
|
8
|
+
var progressFill = cva("h-full transition-all duration-300", {
|
|
9
|
+
variants: {
|
|
10
|
+
color: {
|
|
11
|
+
danger: "bg-red-500",
|
|
12
|
+
success: "bg-green-500",
|
|
13
|
+
info: "bg-blue-500",
|
|
14
|
+
warning: "bg-yellow-500",
|
|
15
|
+
default: "bg-gray-500"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
color: "default"
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var progressLabel = cva("mt-2 text-right text-sm text-gray-700");
|
|
23
|
+
var progressVariants = cva(
|
|
24
|
+
[
|
|
25
|
+
"flex items-center justify-center mx-1",
|
|
26
|
+
"font-medium outline-none select-none transition active:transition-none",
|
|
27
|
+
"not-disabled:cursor-pointer",
|
|
28
|
+
"disabled:cursor-not-allowed disabled:opacity-25",
|
|
29
|
+
"aria-busy:cursor-wait"
|
|
30
|
+
],
|
|
31
|
+
{
|
|
32
|
+
variants: {
|
|
33
|
+
size: {
|
|
34
|
+
sm: "size-8 text-sm",
|
|
35
|
+
md: "size-16 text-base",
|
|
36
|
+
lg: "size-24 text-lg"
|
|
37
|
+
},
|
|
38
|
+
shape: {
|
|
39
|
+
circle: "rounded-full overflow-hidden",
|
|
40
|
+
rounded: "rounded-lg overflow-hidden"
|
|
41
|
+
},
|
|
42
|
+
variant: {
|
|
43
|
+
filled: "text-gray-800",
|
|
44
|
+
outlined: "border-2 border-gray-300 text-gray-800",
|
|
45
|
+
ghost: "text-gray-800"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
size: "md",
|
|
50
|
+
shape: "rounded",
|
|
51
|
+
variant: "filled"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// src/components/Progress/ProgressValue.tsx
|
|
57
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div><div><div></div></div><div>%`);
|
|
58
|
+
var ProgressValue = (props) => {
|
|
59
|
+
return (() => {
|
|
60
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling, _el$5 = _el$4.firstChild;
|
|
61
|
+
insert(_el$4, () => props.value, _el$5);
|
|
62
|
+
effect((_p$) => {
|
|
63
|
+
var _v$ = `${progressWrapper()} ${progressVariants({
|
|
64
|
+
size: props.size,
|
|
65
|
+
shape: props.shape,
|
|
66
|
+
variant: props.variant
|
|
67
|
+
})}`, _v$2 = progressBar(), _v$3 = progressFill(), _v$4 = `${props.value}%`, _v$5 = progressLabel();
|
|
68
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
69
|
+
_v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
|
|
70
|
+
_v$3 !== _p$.a && className(_el$3, _p$.a = _v$3);
|
|
71
|
+
_v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$3.style.setProperty("width", _v$4) : _el$3.style.removeProperty("width"));
|
|
72
|
+
_v$5 !== _p$.i && className(_el$4, _p$.i = _v$5);
|
|
73
|
+
return _p$;
|
|
74
|
+
}, {
|
|
75
|
+
e: void 0,
|
|
76
|
+
t: void 0,
|
|
77
|
+
a: void 0,
|
|
78
|
+
o: void 0,
|
|
79
|
+
i: void 0
|
|
80
|
+
});
|
|
81
|
+
return _el$;
|
|
82
|
+
})();
|
|
83
|
+
};
|
|
84
|
+
var ProgressValue_default = ProgressValue;
|
|
85
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div><div><div></div></div><div>%`);
|
|
86
|
+
var Progress = ({
|
|
87
|
+
value,
|
|
88
|
+
size = "md",
|
|
89
|
+
shape = "rounded",
|
|
90
|
+
variant = "filled"
|
|
91
|
+
}) => {
|
|
92
|
+
return (() => {
|
|
93
|
+
var _el$ = _tmpl$2(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling, _el$5 = _el$4.firstChild;
|
|
94
|
+
`${value}%` != null ? _el$3.style.setProperty("width", `${value}%`) : _el$3.style.removeProperty("width");
|
|
95
|
+
insert(_el$4, value, _el$5);
|
|
96
|
+
effect((_p$) => {
|
|
97
|
+
var _v$ = `${progressWrapper()} ${progressVariants({
|
|
98
|
+
size,
|
|
99
|
+
shape,
|
|
100
|
+
variant
|
|
101
|
+
})}`, _v$2 = progressBar(), _v$3 = progressFill(), _v$4 = progressLabel();
|
|
102
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
103
|
+
_v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
|
|
104
|
+
_v$3 !== _p$.a && className(_el$3, _p$.a = _v$3);
|
|
105
|
+
_v$4 !== _p$.o && className(_el$4, _p$.o = _v$4);
|
|
106
|
+
return _p$;
|
|
107
|
+
}, {
|
|
108
|
+
e: void 0,
|
|
109
|
+
t: void 0,
|
|
110
|
+
a: void 0,
|
|
111
|
+
o: void 0
|
|
112
|
+
});
|
|
113
|
+
return _el$;
|
|
114
|
+
})();
|
|
115
|
+
};
|
|
116
|
+
var ProgressSizes_default = Progress;
|
|
117
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div><div><div>`);
|
|
118
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<div>`);
|
|
119
|
+
var Progress2 = ({
|
|
120
|
+
value,
|
|
121
|
+
size = "md",
|
|
122
|
+
shape = "rounded",
|
|
123
|
+
variant = "filled",
|
|
124
|
+
showValue = false,
|
|
125
|
+
format = "raw"
|
|
126
|
+
}) => {
|
|
127
|
+
const displayValue = () => {
|
|
128
|
+
return format === "percent" ? `${value}%` : value;
|
|
129
|
+
};
|
|
130
|
+
return (() => {
|
|
131
|
+
var _el$ = _tmpl$3(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
132
|
+
`${value}%` != null ? _el$3.style.setProperty("width", `${value}%`) : _el$3.style.removeProperty("width");
|
|
133
|
+
insert(_el$, showValue && (() => {
|
|
134
|
+
var _el$4 = _tmpl$22();
|
|
135
|
+
insert(_el$4, displayValue);
|
|
136
|
+
effect(() => className(_el$4, progressLabel()));
|
|
137
|
+
return _el$4;
|
|
138
|
+
})(), null);
|
|
139
|
+
effect((_p$) => {
|
|
140
|
+
var _v$ = `${progressWrapper()} ${progressVariants({
|
|
141
|
+
size,
|
|
142
|
+
shape,
|
|
143
|
+
variant
|
|
144
|
+
})}`, _v$2 = progressBar(), _v$3 = progressFill();
|
|
145
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
146
|
+
_v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
|
|
147
|
+
_v$3 !== _p$.a && className(_el$3, _p$.a = _v$3);
|
|
148
|
+
return _p$;
|
|
149
|
+
}, {
|
|
150
|
+
e: void 0,
|
|
151
|
+
t: void 0,
|
|
152
|
+
a: void 0
|
|
153
|
+
});
|
|
154
|
+
return _el$;
|
|
155
|
+
})();
|
|
156
|
+
};
|
|
157
|
+
var ProgressPercent_default = Progress2;
|
|
158
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<div>`);
|
|
159
|
+
var _tmpl$23 = /* @__PURE__ */ template(`<div><div>`);
|
|
160
|
+
var Progress3 = ({
|
|
161
|
+
value,
|
|
162
|
+
size = "md",
|
|
163
|
+
shape = "rounded",
|
|
164
|
+
variant = "filled",
|
|
165
|
+
showValue = false,
|
|
166
|
+
format = "raw",
|
|
167
|
+
color = "default"
|
|
168
|
+
}) => {
|
|
169
|
+
const displayValue = () => format === "percent" && value != null ? `${value}%` : value;
|
|
170
|
+
return (() => {
|
|
171
|
+
var _el$ = _tmpl$23(), _el$2 = _el$.firstChild;
|
|
172
|
+
insert(_el$2, createComponent(Show, {
|
|
173
|
+
when: value != null,
|
|
174
|
+
get fallback() {
|
|
175
|
+
return (() => {
|
|
176
|
+
var _el$4 = _tmpl$4();
|
|
177
|
+
_el$4.style.setProperty("width", "100%");
|
|
178
|
+
effect(() => className(_el$4, `${progressFill({
|
|
179
|
+
color
|
|
180
|
+
})} animate-pulse`));
|
|
181
|
+
return _el$4;
|
|
182
|
+
})();
|
|
183
|
+
},
|
|
184
|
+
get children() {
|
|
185
|
+
var _el$3 = _tmpl$4();
|
|
186
|
+
`${value}%` != null ? _el$3.style.setProperty("width", `${value}%`) : _el$3.style.removeProperty("width");
|
|
187
|
+
effect(() => className(_el$3, progressFill({
|
|
188
|
+
color
|
|
189
|
+
})));
|
|
190
|
+
return _el$3;
|
|
191
|
+
}
|
|
192
|
+
}));
|
|
193
|
+
insert(_el$, showValue && value != null && (() => {
|
|
194
|
+
var _el$5 = _tmpl$4();
|
|
195
|
+
insert(_el$5, displayValue);
|
|
196
|
+
effect(() => className(_el$5, progressLabel()));
|
|
197
|
+
return _el$5;
|
|
198
|
+
})(), null);
|
|
199
|
+
effect((_p$) => {
|
|
200
|
+
var _v$ = `${progressWrapper()} ${progressVariants({
|
|
201
|
+
size,
|
|
202
|
+
shape,
|
|
203
|
+
variant
|
|
204
|
+
})}`, _v$2 = progressBar();
|
|
205
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
206
|
+
_v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
|
|
207
|
+
return _p$;
|
|
208
|
+
}, {
|
|
209
|
+
e: void 0,
|
|
210
|
+
t: void 0
|
|
211
|
+
});
|
|
212
|
+
return _el$;
|
|
213
|
+
})();
|
|
214
|
+
};
|
|
215
|
+
var ProgressColors_default = Progress3;
|
|
216
|
+
|
|
217
|
+
// src/components/Progress/Progress.tsx
|
|
218
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<section><div class=p-4><h1 class="text-2xl font-semibold mb-4">Progress Component Demo</h1></div><div class="mt-4 flex flex-col gap-4"></div><div class=mt-4></div><div class="mt-4 flex flex-col gap-4">`);
|
|
219
|
+
var Progress4 = () => {
|
|
220
|
+
return (() => {
|
|
221
|
+
var _el$ = _tmpl$5(), _el$2 = _el$.firstChild, _el$4 = _el$2.nextSibling, _el$5 = _el$4.nextSibling, _el$6 = _el$5.nextSibling;
|
|
222
|
+
insert(_el$2, createComponent(ProgressValue_default, {
|
|
223
|
+
value: 40,
|
|
224
|
+
size: "sm",
|
|
225
|
+
shape: "circle",
|
|
226
|
+
variant: "filled"
|
|
227
|
+
}), null);
|
|
228
|
+
insert(_el$2, createComponent(ProgressValue_default, {
|
|
229
|
+
value: 70,
|
|
230
|
+
size: "md",
|
|
231
|
+
shape: "rounded",
|
|
232
|
+
variant: "outlined"
|
|
233
|
+
}), null);
|
|
234
|
+
insert(_el$2, createComponent(ProgressValue_default, {
|
|
235
|
+
value: 90,
|
|
236
|
+
size: "lg",
|
|
237
|
+
shape: "circle",
|
|
238
|
+
variant: "ghost"
|
|
239
|
+
}), null);
|
|
240
|
+
insert(_el$4, createComponent(ProgressSizes_default, {
|
|
241
|
+
value: 20,
|
|
242
|
+
size: "sm"
|
|
243
|
+
}), null);
|
|
244
|
+
insert(_el$4, createComponent(ProgressSizes_default, {
|
|
245
|
+
value: 30,
|
|
246
|
+
size: "md"
|
|
247
|
+
}), null);
|
|
248
|
+
insert(_el$4, createComponent(ProgressSizes_default, {
|
|
249
|
+
value: 50,
|
|
250
|
+
size: "lg"
|
|
251
|
+
}), null);
|
|
252
|
+
insert(_el$5, createComponent(ProgressPercent_default, {
|
|
253
|
+
value: 80,
|
|
254
|
+
showValue: true,
|
|
255
|
+
format: "percent"
|
|
256
|
+
}));
|
|
257
|
+
insert(_el$6, createComponent(ProgressColors_default, {
|
|
258
|
+
value: 40,
|
|
259
|
+
color: "danger"
|
|
260
|
+
}), null);
|
|
261
|
+
insert(_el$6, createComponent(ProgressColors_default, {
|
|
262
|
+
value: 60,
|
|
263
|
+
color: "success"
|
|
264
|
+
}), null);
|
|
265
|
+
insert(_el$6, createComponent(ProgressColors_default, {
|
|
266
|
+
value: 80,
|
|
267
|
+
color: "info"
|
|
268
|
+
}), null);
|
|
269
|
+
insert(_el$6, createComponent(ProgressColors_default, {
|
|
270
|
+
value: 100,
|
|
271
|
+
color: "warning"
|
|
272
|
+
}), null);
|
|
273
|
+
return _el$;
|
|
274
|
+
})();
|
|
275
|
+
};
|
|
276
|
+
var Progress_default = Progress4;
|
|
277
|
+
|
|
278
|
+
export { ProgressColors_default as ProgressColors, ProgressPercent_default as ProgressPercent, ProgressSizes_default as ProgressSizes, ProgressValue_default as ProgressValue, Progress_default as default };
|