@neut/ui 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/card/Card/Card.styles.d.ts +1 -1
- package/dist/components/card/Card/Card.styles.js +1 -1
- package/dist/components/card/Card/Card.styles.js.map +1 -1
- package/dist/components/card/CardContent/CardContent.styles.d.ts +1 -1
- package/dist/components/card/CardContent/CardContent.styles.js +1 -1
- package/dist/components/card/CardContent/CardContent.styles.js.map +1 -1
- package/dist/components/progress/Progress/Progress.context.d.ts +6 -0
- package/dist/components/progress/Progress/Progress.context.js +11 -0
- package/dist/components/progress/Progress/Progress.context.js.map +1 -0
- package/dist/components/progress/Progress/Progress.d.ts +2 -0
- package/dist/components/progress/Progress/Progress.js +44 -0
- package/dist/components/progress/Progress/Progress.js.map +1 -0
- package/dist/components/progress/Progress/Progress.styles.d.ts +1 -0
- package/dist/components/progress/Progress/Progress.styles.js +6 -0
- package/dist/components/progress/Progress/Progress.styles.js.map +1 -0
- package/dist/components/progress/Progress/Progress.types.d.ts +4 -0
- package/dist/components/progress/Progress/index.d.ts +2 -0
- package/dist/components/progress/ProgressIndicator/ProgressIndicator.d.ts +2 -0
- package/dist/components/progress/ProgressIndicator/ProgressIndicator.js +27 -0
- package/dist/components/progress/ProgressIndicator/ProgressIndicator.js.map +1 -0
- package/dist/components/progress/ProgressIndicator/ProgressIndicator.styles.d.ts +1 -0
- package/dist/components/progress/ProgressIndicator/ProgressIndicator.styles.js +6 -0
- package/dist/components/progress/ProgressIndicator/ProgressIndicator.styles.js.map +1 -0
- package/dist/components/progress/ProgressIndicator/ProgressIndicator.types.d.ts +2 -0
- package/dist/components/progress/ProgressIndicator/index.d.ts +1 -0
- package/dist/components/progress/ProgressLabel/ProgressLabel.d.ts +2 -0
- package/dist/components/progress/ProgressLabel/ProgressLabel.js +18 -0
- package/dist/components/progress/ProgressLabel/ProgressLabel.js.map +1 -0
- package/dist/components/progress/ProgressLabel/ProgressLabel.styles.d.ts +1 -0
- package/dist/components/progress/ProgressLabel/ProgressLabel.styles.js +6 -0
- package/dist/components/progress/ProgressLabel/ProgressLabel.styles.js.map +1 -0
- package/dist/components/progress/ProgressLabel/ProgressLabel.types.d.ts +2 -0
- package/dist/components/progress/ProgressLabel/index.d.ts +1 -0
- package/dist/components/progress/ProgressTrack/ProgressTrack.d.ts +2 -0
- package/dist/components/progress/ProgressTrack/ProgressTrack.js +24 -0
- package/dist/components/progress/ProgressTrack/ProgressTrack.js.map +1 -0
- package/dist/components/progress/ProgressTrack/ProgressTrack.styles.d.ts +1 -0
- package/dist/components/progress/ProgressTrack/ProgressTrack.styles.js +6 -0
- package/dist/components/progress/ProgressTrack/ProgressTrack.styles.js.map +1 -0
- package/dist/components/progress/ProgressTrack/ProgressTrack.types.d.ts +2 -0
- package/dist/components/progress/ProgressTrack/index.d.ts +1 -0
- package/dist/components/progress/ProgressValue/ProgressValue.d.ts +2 -0
- package/dist/components/progress/ProgressValue/ProgressValue.js +19 -0
- package/dist/components/progress/ProgressValue/ProgressValue.js.map +1 -0
- package/dist/components/progress/ProgressValue/ProgressValue.styles.d.ts +1 -0
- package/dist/components/progress/ProgressValue/ProgressValue.styles.js +6 -0
- package/dist/components/progress/ProgressValue/ProgressValue.styles.js.map +1 -0
- package/dist/components/progress/ProgressValue/ProgressValue.types.d.ts +2 -0
- package/dist/components/progress/ProgressValue/index.d.ts +1 -0
- package/dist/components/progress/index.d.ts +3 -0
- package/dist/components/progress/index.js +4 -0
- package/dist/components/slider/Slider/Slider.context.d.ts +17 -0
- package/dist/components/slider/Slider/Slider.context.js +11 -0
- package/dist/components/slider/Slider/Slider.context.js.map +1 -0
- package/dist/components/slider/Slider/Slider.d.ts +2 -0
- package/dist/components/slider/Slider/Slider.js +62 -0
- package/dist/components/slider/Slider/Slider.js.map +1 -0
- package/dist/components/slider/Slider/Slider.styles.d.ts +1 -0
- package/dist/components/slider/Slider/Slider.styles.js +6 -0
- package/dist/components/slider/Slider/Slider.styles.js.map +1 -0
- package/dist/components/slider/Slider/Slider.types.d.ts +13 -0
- package/dist/components/slider/Slider/index.d.ts +2 -0
- package/dist/components/slider/Slider/useSlider.d.ts +19 -0
- package/dist/components/slider/Slider/useSlider.js +33 -0
- package/dist/components/slider/Slider/useSlider.js.map +1 -0
- package/dist/components/slider/SliderControl/SliderControl.d.ts +2 -0
- package/dist/components/slider/SliderControl/SliderControl.js +33 -0
- package/dist/components/slider/SliderControl/SliderControl.js.map +1 -0
- package/dist/components/slider/SliderControl/SliderControl.styles.d.ts +1 -0
- package/dist/components/slider/SliderControl/SliderControl.styles.js +6 -0
- package/dist/components/slider/SliderControl/SliderControl.styles.js.map +1 -0
- package/dist/components/slider/SliderControl/SliderControl.types.d.ts +2 -0
- package/dist/components/slider/SliderControl/index.d.ts +1 -0
- package/dist/components/slider/SliderControl/useSliderControl.d.ts +5 -0
- package/dist/components/slider/SliderControl/useSliderControl.js +36 -0
- package/dist/components/slider/SliderControl/useSliderControl.js.map +1 -0
- package/dist/components/slider/SliderIndicator/SliderIndicator.d.ts +2 -0
- package/dist/components/slider/SliderIndicator/SliderIndicator.js +28 -0
- package/dist/components/slider/SliderIndicator/SliderIndicator.js.map +1 -0
- package/dist/components/slider/SliderIndicator/SliderIndicator.styles.d.ts +1 -0
- package/dist/components/slider/SliderIndicator/SliderIndicator.styles.js +7 -0
- package/dist/components/slider/SliderIndicator/SliderIndicator.styles.js.map +1 -0
- package/dist/components/slider/SliderIndicator/SliderIndicator.types.d.ts +2 -0
- package/dist/components/slider/SliderIndicator/index.d.ts +1 -0
- package/dist/components/slider/SliderIndicator/useSliderIndicator.d.ts +6 -0
- package/dist/components/slider/SliderIndicator/useSliderIndicator.js +20 -0
- package/dist/components/slider/SliderIndicator/useSliderIndicator.js.map +1 -0
- package/dist/components/slider/SliderThumb/SliderThumb.d.ts +2 -0
- package/dist/components/slider/SliderThumb/SliderThumb.js +45 -0
- package/dist/components/slider/SliderThumb/SliderThumb.js.map +1 -0
- package/dist/components/slider/SliderThumb/SliderThumb.styles.d.ts +1 -0
- package/dist/components/slider/SliderThumb/SliderThumb.styles.js +7 -0
- package/dist/components/slider/SliderThumb/SliderThumb.styles.js.map +1 -0
- package/dist/components/slider/SliderThumb/SliderThumb.types.d.ts +6 -0
- package/dist/components/slider/SliderThumb/index.d.ts +1 -0
- package/dist/components/slider/SliderThumb/useSliderThumb.d.ts +6 -0
- package/dist/components/slider/SliderThumb/useSliderThumb.js +18 -0
- package/dist/components/slider/SliderThumb/useSliderThumb.js.map +1 -0
- package/dist/components/slider/SliderTrack/SliderTrack.d.ts +2 -0
- package/dist/components/slider/SliderTrack/SliderTrack.js +24 -0
- package/dist/components/slider/SliderTrack/SliderTrack.js.map +1 -0
- package/dist/components/slider/SliderTrack/SliderTrack.styles.d.ts +1 -0
- package/dist/components/slider/SliderTrack/SliderTrack.styles.js +6 -0
- package/dist/components/slider/SliderTrack/SliderTrack.styles.js.map +1 -0
- package/dist/components/slider/SliderTrack/SliderTrack.types.d.ts +2 -0
- package/dist/components/slider/SliderTrack/index.d.ts +1 -0
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/slider/index.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +42 -37
- package/dist/types/props.types.d.ts +3 -0
- package/dist/ui.css +1 -1
- package/package.json +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const classes = "flex flex-col gap-4 overflow-hidden rounded-xl bg-white dark:bg-neutral-900 py-4 text-sm text-neutral-950 dark:text-neutral-50 dark:ring-neutral-50/10";
|
|
1
|
+
export declare const classes = "group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-white dark:bg-neutral-900 py-4 text-sm text-neutral-950 dark:text-neutral-50 ring-1 ring-neutral-950/10 dark:ring-neutral-50/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/components/card/Card/Card.styles.ts
|
|
2
|
-
var e = "flex flex-col gap-4 overflow-hidden rounded-xl bg-white dark:bg-neutral-900 py-4 text-sm text-neutral-950 dark:text-neutral-50 dark:ring-neutral-50/10";
|
|
2
|
+
var e = "group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-white dark:bg-neutral-900 py-4 text-sm text-neutral-950 dark:text-neutral-50 ring-1 ring-neutral-950/10 dark:ring-neutral-50/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as classes };
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.styles.js","names":[],"sources":["../../../../src/components/card/Card/Card.styles.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Card.styles.js","names":[],"sources":["../../../../src/components/card/Card/Card.styles.ts"],"sourcesContent":["export const classes =\n \"group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-white dark:bg-neutral-900 py-4 text-sm text-neutral-950 dark:text-neutral-50 ring-1 ring-neutral-950/10 dark:ring-neutral-50/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl\";\n"],"mappings":";AAAA,IAAa,IACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const classes = "px-4";
|
|
1
|
+
export declare const classes = "px-4 group-data-[size=sm]/card:px-3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.styles.js","names":[],"sources":["../../../../src/components/card/CardContent/CardContent.styles.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"CardContent.styles.js","names":[],"sources":["../../../../src/components/card/CardContent/CardContent.styles.ts"],"sourcesContent":["export const classes = \"px-4 group-data-[size=sm]/card:px-3\";\n"],"mappings":";AAAA,IAAa,IAAU"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "solid-js";
|
|
2
|
+
//#region src/components/progress/Progress/Progress.context.ts
|
|
3
|
+
var n = e(), r = () => {
|
|
4
|
+
let e = t(n);
|
|
5
|
+
if (!e) throw Error("useProgressContext must be used within a ProgressProvider");
|
|
6
|
+
return e;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as ProgressContext, r as useProgressContext };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=Progress.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.context.js","names":[],"sources":["../../../../src/components/progress/Progress/Progress.context.ts"],"sourcesContent":["import { createContext, useContext } from \"solid-js\";\n\ninterface ProgressContextValue {\n value: () => number;\n}\n\nexport const ProgressContext = createContext<ProgressContextValue>();\n\nexport const useProgressContext = () => {\n const context = useContext(ProgressContext);\n if (!context) {\n throw new Error(\n \"useProgressContext must be used within a ProgressProvider\",\n );\n }\n return context;\n};\n"],"mappings":";;AAMA,IAAa,IAAkB,GAAqC,EAEvD,UAA2B;CACtC,IAAM,IAAU,EAAW,EAAgB;AAC3C,KAAI,CAAC,EACH,OAAU,MACR,4DACD;AAEH,QAAO"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { clsx as e } from "../../../utils/clsx.js";
|
|
2
|
+
import { classes as t } from "./Progress.styles.js";
|
|
3
|
+
import { ProgressTrack as n } from "../ProgressTrack/ProgressTrack.js";
|
|
4
|
+
import { ProgressIndicator as r } from "../ProgressIndicator/ProgressIndicator.js";
|
|
5
|
+
import { ProgressContext as i } from "./Progress.context.js";
|
|
6
|
+
import { createComponent as a, insert as o, memo as s, mergeProps as c, spread as l, template as u } from "solid-js/web";
|
|
7
|
+
import { splitProps as d } from "solid-js";
|
|
8
|
+
//#region src/components/progress/Progress/Progress.tsx
|
|
9
|
+
var f = /* @__PURE__ */ u("<div data-slot=progress aria-valuemax=100 aria-valuemin=0 role=progressbar><span role=presentation class=\"[clip-path:inset(50%)] overflow-hidden whitespace-nowrap border-0 p-0 size-px -m-px fixed top-0 left-0\">x"), p = (u) => {
|
|
10
|
+
let [p, m] = d(u, [
|
|
11
|
+
"value",
|
|
12
|
+
"class",
|
|
13
|
+
"classList",
|
|
14
|
+
"children"
|
|
15
|
+
]), h = () => p.value;
|
|
16
|
+
return (() => {
|
|
17
|
+
var u = f(), d = u.firstChild;
|
|
18
|
+
return l(u, c({
|
|
19
|
+
get "aria-valuenow"() {
|
|
20
|
+
return p.value;
|
|
21
|
+
},
|
|
22
|
+
get "aria-valuetext"() {
|
|
23
|
+
return `${p.value}%`;
|
|
24
|
+
},
|
|
25
|
+
get "data-progressing"() {
|
|
26
|
+
return s(() => p.value > 0)() && p.value < 100;
|
|
27
|
+
},
|
|
28
|
+
get class() {
|
|
29
|
+
return e(t, p.class);
|
|
30
|
+
}
|
|
31
|
+
}, m), !1, !0), o(u, a(i.Provider, {
|
|
32
|
+
value: { value: h },
|
|
33
|
+
get children() {
|
|
34
|
+
return [s(() => p.children), a(n, { get children() {
|
|
35
|
+
return a(r, {});
|
|
36
|
+
} })];
|
|
37
|
+
}
|
|
38
|
+
}), d), u;
|
|
39
|
+
})();
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { p as Progress };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=Progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.js","names":["splitProps","ProgressProps","clsx","classes","ProgressTrack","ProgressIndicator","ProgressContext","Progress","props","local","others","value","_el$","_tmpl$","_el$2","firstChild","_$spread","_$mergeProps","aria-valuenow","aria-valuetext","data-progressing","_$memo","class","_$insert","_$createComponent","Provider","children"],"sources":["../../../../src/components/progress/Progress/Progress.tsx"],"sourcesContent":["import { splitProps } from \"solid-js\";\nimport type { ProgressProps } from \"./Progress.types\";\nimport { clsx } from \"~/utils\";\nimport { classes } from \"./Progress.styles\";\nimport { ProgressTrack } from \"../ProgressTrack\";\nimport { ProgressIndicator } from \"../ProgressIndicator\";\nimport { ProgressContext } from \"./Progress.context\";\n\nexport const Progress = (props: ProgressProps) => {\n const [local, others] = splitProps(props, [\n \"value\",\n \"class\",\n \"classList\",\n \"children\",\n ]);\n\n const value = () => local.value;\n\n return (\n <div\n data-slot=\"progress\"\n aria-valuemax=\"100\"\n aria-valuemin=\"0\"\n aria-valuenow={local.value}\n aria-valuetext={`${local.value}%`}\n role=\"progressbar\"\n data-progressing={local.value > 0 && local.value < 100}\n class={clsx(classes, local.class)}\n {...others}\n >\n <ProgressContext.Provider\n value={{\n value,\n }}\n >\n {local.children}\n <ProgressTrack>\n <ProgressIndicator />\n </ProgressTrack>\n </ProgressContext.Provider>\n <span\n role=\"presentation\"\n class=\"[clip-path:inset(50%)] overflow-hidden whitespace-nowrap border-0 p-0 size-px -m-px fixed top-0 left-0\"\n >\n x\n </span>\n </div>\n );\n};\n"],"mappings":";;;;;;;;oPAQaO,KAAYC,MAAyB;CAChD,IAAM,CAACC,GAAOC,KAAUV,EAAWQ,GAAO;EACxC;EACA;EACA;EACA;EACD,CAAC,EAEIG,UAAcF,EAAME;AAE1B,eAAA;EAAA,IAAAC,IAAAC,GAAA,EAAAC,IAAAF,EAAAG;AAmB0B,SAnB1BC,EAAAJ,GAAAK,EAAA;GAAA,IAAA,kBAAA;AAAA,WAKmBR,EAAME;;GAAK,IAAA,mBAAA;AAAA,WACV,GAAGF,EAAME,MAAK;;GAAG,IAAA,qBAAA;AAAA,WAEfU,QAAAZ,EAAME,QAAQ,EAAC,EAAA,IAAIF,EAAME,QAAQ;;GAAG,IAAA,QAAA;AAAA,WAC/CT,EAAKC,GAASM,EAAMa,MAAM;;GAAA,EAC7BZ,EAAM,EAAA,IAAA,GAAA,EAAAa,EAAAX,GAAAY,EAETlB,EAAgBmB,UAAQ;GACvBd,OAAO,EACLA,UACD;GAAA,IAAAe,WAAA;AAAA,WAAA,CAAAL,QAEAZ,EAAMiB,SAAQ,EAAAF,EACdpB,GAAa,EAAA,IAAAsB,WAAA;AAAA,YAAAF,EACXnB,GAAiB,EAAA,CAAA;OAAA,CAAA,CAAA;;GAAA,CAAA,EAAAS,EAAA,EAAAF;KAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const classes = "flex flex-wrap gap-3";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.styles.js","names":[],"sources":["../../../../src/components/progress/Progress/Progress.styles.ts"],"sourcesContent":["export const classes = \"flex flex-wrap gap-3\";\n"],"mappings":";AAAA,IAAa,IAAU"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { clsx as e } from "../../../utils/clsx.js";
|
|
2
|
+
import { classes as t } from "./ProgressIndicator.styles.js";
|
|
3
|
+
import { useProgressContext as n } from "../Progress/Progress.context.js";
|
|
4
|
+
import { memo as r, mergeProps as i, spread as a, template as o } from "solid-js/web";
|
|
5
|
+
import { splitProps as s } from "solid-js";
|
|
6
|
+
//#region src/components/progress/ProgressIndicator/ProgressIndicator.tsx
|
|
7
|
+
var c = /* @__PURE__ */ o("<div data-slot=progress-indicator>"), l = (o) => {
|
|
8
|
+
let { value: l } = n(), [u, d] = s(o, ["class", "classList"]);
|
|
9
|
+
return (() => {
|
|
10
|
+
var n = c();
|
|
11
|
+
return a(n, i({
|
|
12
|
+
get class() {
|
|
13
|
+
return e(t, "inset-s-0 h-[inherit]", u.class);
|
|
14
|
+
},
|
|
15
|
+
get "data-progressing"() {
|
|
16
|
+
return r(() => l() > 0)() && l() < 100;
|
|
17
|
+
},
|
|
18
|
+
get style() {
|
|
19
|
+
return { width: `${l()}%` };
|
|
20
|
+
}
|
|
21
|
+
}, d), !1, !1), n;
|
|
22
|
+
})();
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { l as ProgressIndicator };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=ProgressIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressIndicator.js","names":["splitProps","ProgressIndicatorProps","clsx","classes","useProgressContext","ProgressIndicator","props","value","local","others","_el$","_tmpl$","_$spread","_$mergeProps","class","data-progressing","_$memo","style","width"],"sources":["../../../../src/components/progress/ProgressIndicator/ProgressIndicator.tsx"],"sourcesContent":["import { splitProps } from \"solid-js\";\nimport type { ProgressIndicatorProps } from \"./ProgressIndicator.types\";\nimport { clsx } from \"~/utils\";\nimport { classes } from \"./ProgressIndicator.styles\";\nimport { useProgressContext } from \"../Progress\";\n\nexport const ProgressIndicator = (props: ProgressIndicatorProps) => {\n const { value } = useProgressContext();\n\n const [local, others] = splitProps(props, [\"class\", \"classList\"]);\n\n return (\n <div\n data-slot=\"progress-indicator\"\n class={clsx(classes, \"inset-s-0 h-[inherit]\", local.class)}\n data-progressing={value() > 0 && value() < 100}\n style={{ width: `${value()}%` }}\n {...others}\n />\n );\n};\n"],"mappings":";;;;;;iEAMaK,KAAqBC,MAAkC;CAClE,IAAM,EAAEC,aAAUH,GAAoB,EAEhC,CAACI,GAAOC,KAAUT,EAAWM,GAAO,CAAC,SAAS,YAAY,CAAC;AAEjE,eAAA;EAAA,IAAAI,IAAAC,GAAA;AAMc,SANdC,EAAAF,GAAAG,EAAA;GAAA,IAAA,QAAA;AAAA,WAGWX,EAAKC,GAAS,yBAAyBK,EAAMM,MAAM;;GAAA,IAAA,qBAAA;AAAA,WACxCE,QAAAT,GAAO,GAAG,EAAC,EAAA,IAAIA,GAAO,GAAG;;GAAG,IAC9CU,QAAK;AAAA,WAAE,EAAEC,OAAO,GAAGX,GAAO,CAAA,IAAK;;GAAA,EAC3BE,EAAM,EAAA,IAAA,GAAA,EAAAC;KAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const classes = "h-full bg-neutral-900 dark:bg-neutral-200 transition-all";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressIndicator.styles.js","names":[],"sources":["../../../../src/components/progress/ProgressIndicator/ProgressIndicator.styles.ts"],"sourcesContent":["export const classes =\n \"h-full bg-neutral-900 dark:bg-neutral-200 transition-all\";\n"],"mappings":";AAAA,IAAa,IACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressIndicator } from './ProgressIndicator';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { clsx as e } from "../../../utils/clsx.js";
|
|
2
|
+
import { classes as t } from "./ProgressLabel.styles.js";
|
|
3
|
+
import { mergeProps as n, spread as r, template as i } from "solid-js/web";
|
|
4
|
+
import { splitProps as a } from "solid-js";
|
|
5
|
+
//#region src/components/progress/ProgressLabel/ProgressLabel.tsx
|
|
6
|
+
var o = /* @__PURE__ */ i("<span data-slot=progress-label>"), s = (i) => {
|
|
7
|
+
let [s, c] = a(i, ["class", "classList"]);
|
|
8
|
+
return (() => {
|
|
9
|
+
var i = o();
|
|
10
|
+
return r(i, n({ get class() {
|
|
11
|
+
return e(t, s.class);
|
|
12
|
+
} }, c), !1, !1), i;
|
|
13
|
+
})();
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { s as ProgressLabel };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=ProgressLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressLabel.js","names":["splitProps","ProgressLabelProps","clsx","classes","ProgressLabel","props","local","others","_el$","_tmpl$","_$spread","_$mergeProps","class"],"sources":["../../../../src/components/progress/ProgressLabel/ProgressLabel.tsx"],"sourcesContent":["import { splitProps } from \"solid-js\";\nimport type { ProgressLabelProps } from \"./ProgressLabel.types\";\nimport { clsx } from \"~/utils\";\nimport { classes } from \"./ProgressLabel.styles\";\n\nexport const ProgressLabel = (props: ProgressLabelProps) => {\n const [local, others] = splitProps(props, [\"class\", \"classList\"]);\n\n return (\n <span\n data-slot=\"progress-label\"\n class={clsx(classes, local.class)}\n {...others}\n />\n );\n};\n"],"mappings":";;;;;8DAKaI,KAAiBC,MAA8B;CAC1D,IAAM,CAACC,GAAOC,KAAUP,EAAWK,GAAO,CAAC,SAAS,YAAY,CAAC;AAEjE,eAAA;EAAA,IAAAG,IAAAC,GAAA;AAIc,SAJdC,EAAAF,GAAAG,EAAA,EAAA,IAAA,QAAA;AAAA,UAGWT,EAAKC,GAASG,EAAMM,MAAM;KAAA,EAC7BL,EAAM,EAAA,IAAA,GAAA,EAAAC;KAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const classes = "text-sm font-medium";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressLabel.styles.js","names":[],"sources":["../../../../src/components/progress/ProgressLabel/ProgressLabel.styles.ts"],"sourcesContent":["export const classes = \"text-sm font-medium\";\n"],"mappings":";AAAA,IAAa,IAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressLabel } from './ProgressLabel';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { clsx as e } from "../../../utils/clsx.js";
|
|
2
|
+
import { classes as t } from "./ProgressTrack.styles.js";
|
|
3
|
+
import { useProgressContext as n } from "../Progress/Progress.context.js";
|
|
4
|
+
import { memo as r, mergeProps as i, spread as a, template as o } from "solid-js/web";
|
|
5
|
+
import { splitProps as s } from "solid-js";
|
|
6
|
+
//#region src/components/progress/ProgressTrack/ProgressTrack.tsx
|
|
7
|
+
var c = /* @__PURE__ */ o("<div data-slot=progress-track>"), l = (o) => {
|
|
8
|
+
let { value: l } = n(), [u, d] = s(o, ["class", "classList"]);
|
|
9
|
+
return (() => {
|
|
10
|
+
var n = c();
|
|
11
|
+
return a(n, i({
|
|
12
|
+
get "data-progressing"() {
|
|
13
|
+
return r(() => l() > 0)() && l() < 100;
|
|
14
|
+
},
|
|
15
|
+
get class() {
|
|
16
|
+
return e(t, u.class);
|
|
17
|
+
}
|
|
18
|
+
}, d), !1, !1), n;
|
|
19
|
+
})();
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { l as ProgressTrack };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=ProgressTrack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressTrack.js","names":["splitProps","ProgressTrackProps","clsx","classes","useProgressContext","ProgressTrack","props","value","local","others","_el$","_tmpl$","_$spread","_$mergeProps","data-progressing","_$memo","class"],"sources":["../../../../src/components/progress/ProgressTrack/ProgressTrack.tsx"],"sourcesContent":["import { splitProps } from \"solid-js\";\nimport type { ProgressTrackProps } from \"./ProgressTrack.types\";\nimport { clsx } from \"~/utils\";\nimport { classes } from \"./ProgressTrack.styles\";\nimport { useProgressContext } from \"../Progress\";\n\nexport const ProgressTrack = (props: ProgressTrackProps) => {\n const { value } = useProgressContext();\n\n const [local, others] = splitProps(props, [\"class\", \"classList\"]);\n\n return (\n <div\n data-slot=\"progress-track\"\n data-progressing={value() > 0 && value() < 100}\n class={clsx(classes, local.class)}\n {...others}\n />\n );\n};\n"],"mappings":";;;;;;6DAMaK,KAAiBC,MAA8B;CAC1D,IAAM,EAAEC,aAAUH,GAAoB,EAEhC,CAACI,GAAOC,KAAUT,EAAWM,GAAO,CAAC,SAAS,YAAY,CAAC;AAEjE,eAAA;EAAA,IAAAI,IAAAC,GAAA;AAKc,SALdC,EAAAF,GAAAG,EAAA;GAAA,IAAA,qBAAA;AAAA,WAGsBE,QAAAR,GAAO,GAAG,EAAC,EAAA,IAAIA,GAAO,GAAG;;GAAG,IAAA,QAAA;AAAA,WACvCL,EAAKC,GAASK,EAAMQ,MAAM;;GAAA,EAC7BP,EAAM,EAAA,IAAA,GAAA,EAAAC;KAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const classes = "relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-neutral-100 dark:bg-neutral-800";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/components/progress/ProgressTrack/ProgressTrack.styles.ts
|
|
2
|
+
var e = "relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-neutral-100 dark:bg-neutral-800";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as classes };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=ProgressTrack.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressTrack.styles.js","names":[],"sources":["../../../../src/components/progress/ProgressTrack/ProgressTrack.styles.ts"],"sourcesContent":["export const classes =\n \"relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-neutral-100 dark:bg-neutral-800\";\n"],"mappings":";AAAA,IAAa,IACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressTrack } from './ProgressTrack';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { clsx as e } from "../../../utils/clsx.js";
|
|
2
|
+
import { useProgressContext as t } from "../Progress/Progress.context.js";
|
|
3
|
+
import { classes as n } from "./ProgressValue.styles.js";
|
|
4
|
+
import { insert as r, mergeProps as i, spread as a, template as o } from "solid-js/web";
|
|
5
|
+
import { splitProps as s } from "solid-js";
|
|
6
|
+
//#region src/components/progress/ProgressValue/ProgressValue.tsx
|
|
7
|
+
var c = /* @__PURE__ */ o("<span data-slot=progress-value>%"), l = (o) => {
|
|
8
|
+
let { value: l } = t(), [u, d] = s(o, ["class", "classList"]);
|
|
9
|
+
return (() => {
|
|
10
|
+
var t = c(), o = t.firstChild;
|
|
11
|
+
return a(t, i({ get class() {
|
|
12
|
+
return e(n, u.class);
|
|
13
|
+
} }, d), !1, !0), r(t, l, o), t;
|
|
14
|
+
})();
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { l as ProgressValue };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=ProgressValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressValue.js","names":["splitProps","ProgressValueProps","clsx","classes","useProgressContext","ProgressValue","props","value","local","others","_el$","_tmpl$","_el$2","firstChild","_$spread","_$mergeProps","class","_$insert"],"sources":["../../../../src/components/progress/ProgressValue/ProgressValue.tsx"],"sourcesContent":["import { splitProps } from \"solid-js\";\nimport type { ProgressValueProps } from \"./ProgressValue.types\";\nimport { clsx } from \"~/utils\";\nimport { classes } from \"./ProgressValue.styles\";\nimport { useProgressContext } from \"../Progress\";\n\nexport const ProgressValue = (props: ProgressValueProps) => {\n const { value } = useProgressContext();\n\n const [local, others] = splitProps(props, [\"class\", \"classList\"]);\n\n return (\n <span\n data-slot=\"progress-value\"\n class={clsx(classes, local.class)}\n {...others}\n >\n {value()}%\n </span>\n );\n};\n"],"mappings":";;;;;;+DAMaK,KAAiBC,MAA8B;CAC1D,IAAM,EAAEC,aAAUH,GAAoB,EAEhC,CAACI,GAAOC,KAAUT,EAAWM,GAAO,CAAC,SAAS,YAAY,CAAC;AAEjE,eAAA;EAAA,IAAAI,IAAAC,GAAA,EAAAC,IAAAF,EAAAG;AAMU,SANVC,EAAAJ,GAAAK,EAAA,EAAA,IAAA,QAAA;AAAA,UAGWb,EAAKC,GAASK,EAAMQ,MAAM;KAAA,EAC7BP,EAAM,EAAA,IAAA,GAAA,EAAAQ,EAAAP,GAETH,GAAKK,EAAA,EAAAF;KAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const classes = "ml-auto text-sm text-neutral-500 dark:text-neutral-400 tabular-nums";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressValue.styles.js","names":[],"sources":["../../../../src/components/progress/ProgressValue/ProgressValue.styles.ts"],"sourcesContent":["export const classes =\n \"ml-auto text-sm text-neutral-500 dark:text-neutral-400 tabular-nums\";\n"],"mappings":";AAAA,IAAa,IACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressValue } from './ProgressValue';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
interface SliderContextValue {
|
|
3
|
+
values: Accessor<number[]>;
|
|
4
|
+
min: Accessor<number>;
|
|
5
|
+
max: Accessor<number>;
|
|
6
|
+
step: Accessor<number>;
|
|
7
|
+
orientation: Accessor<"horizontal" | "vertical">;
|
|
8
|
+
disabled: Accessor<boolean>;
|
|
9
|
+
activeThumbIndex: Accessor<number>;
|
|
10
|
+
setActiveThumbIndex: (index: number) => void;
|
|
11
|
+
updateValue: (index: number, value: number) => void;
|
|
12
|
+
trackRef: Accessor<HTMLDivElement | undefined>;
|
|
13
|
+
setTrackRef: (el: HTMLDivElement) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const SliderContext: import('solid-js').Context<SliderContextValue | undefined>;
|
|
16
|
+
export declare const useSliderContext: () => SliderContextValue;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "solid-js";
|
|
2
|
+
//#region src/components/slider/Slider/Slider.context.ts
|
|
3
|
+
var n = e(), r = () => {
|
|
4
|
+
let e = t(n);
|
|
5
|
+
if (!e) throw Error("useSliderContext must be used within a SliderProvider");
|
|
6
|
+
return e;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as SliderContext, r as useSliderContext };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=Slider.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.context.js","names":[],"sources":["../../../../src/components/slider/Slider/Slider.context.ts"],"sourcesContent":["import { type Accessor, createContext, useContext } from \"solid-js\";\n\ninterface SliderContextValue {\n values: Accessor<number[]>;\n min: Accessor<number>;\n max: Accessor<number>;\n step: Accessor<number>;\n orientation: Accessor<\"horizontal\" | \"vertical\">;\n disabled: Accessor<boolean>;\n activeThumbIndex: Accessor<number>;\n setActiveThumbIndex: (index: number) => void;\n updateValue: (index: number, value: number) => void;\n trackRef: Accessor<HTMLDivElement | undefined>;\n setTrackRef: (el: HTMLDivElement) => void;\n}\n\nexport const SliderContext = createContext<SliderContextValue>();\n\nexport const useSliderContext = () => {\n const ctx = useContext(SliderContext);\n if (!ctx) {\n throw new Error(\"useSliderContext must be used within a SliderProvider\");\n }\n\n return ctx;\n};\n"],"mappings":";;AAgBA,IAAa,IAAgB,GAAmC,EAEnD,UAAyB;CACpC,IAAM,IAAM,EAAW,EAAc;AACrC,KAAI,CAAC,EACH,OAAU,MAAM,wDAAwD;AAG1E,QAAO"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { clsx as e } from "../../../utils/clsx.js";
|
|
2
|
+
import { classes as t } from "./Slider.styles.js";
|
|
3
|
+
import { SliderControl as n } from "../SliderControl/SliderControl.js";
|
|
4
|
+
import { SliderTrack as r } from "../SliderTrack/SliderTrack.js";
|
|
5
|
+
import { SliderIndicator as i } from "../SliderIndicator/SliderIndicator.js";
|
|
6
|
+
import { SliderThumb as a } from "../SliderThumb/SliderThumb.js";
|
|
7
|
+
import { useSlider as o } from "./useSlider.js";
|
|
8
|
+
import { SliderContext as s } from "./Slider.context.js";
|
|
9
|
+
import { createComponent as c, insert as l, mergeProps as u, spread as d, template as f } from "solid-js/web";
|
|
10
|
+
import { For as p, mergeProps as m, splitProps as h } from "solid-js";
|
|
11
|
+
//#region src/components/slider/Slider/Slider.tsx
|
|
12
|
+
var g = /* @__PURE__ */ f("<div data-slot=slider>"), _ = (f) => {
|
|
13
|
+
let [_, v] = h(m({
|
|
14
|
+
orientation: "horizontal",
|
|
15
|
+
max: 100,
|
|
16
|
+
min: 0,
|
|
17
|
+
step: 1,
|
|
18
|
+
disabled: !1
|
|
19
|
+
}, f), [
|
|
20
|
+
"defaultValue",
|
|
21
|
+
"value",
|
|
22
|
+
"max",
|
|
23
|
+
"min",
|
|
24
|
+
"step",
|
|
25
|
+
"orientation",
|
|
26
|
+
"onValueChange",
|
|
27
|
+
"disabled",
|
|
28
|
+
"class",
|
|
29
|
+
"classList"
|
|
30
|
+
]), { context: y } = o({ get local() {
|
|
31
|
+
return _;
|
|
32
|
+
} });
|
|
33
|
+
return c(s.Provider, {
|
|
34
|
+
value: y,
|
|
35
|
+
get children() {
|
|
36
|
+
var o = g();
|
|
37
|
+
return d(o, u({
|
|
38
|
+
get "data-orientation"() {
|
|
39
|
+
return _.orientation;
|
|
40
|
+
},
|
|
41
|
+
get class() {
|
|
42
|
+
return e(t, _.class);
|
|
43
|
+
}
|
|
44
|
+
}, v), !1, !0), l(o, c(n, { get children() {
|
|
45
|
+
return [c(r, { get children() {
|
|
46
|
+
return c(i, {});
|
|
47
|
+
} }), c(p, {
|
|
48
|
+
get each() {
|
|
49
|
+
return Array.from({ length: y.values().length });
|
|
50
|
+
},
|
|
51
|
+
children: (e, t) => c(a, { get index() {
|
|
52
|
+
return t();
|
|
53
|
+
} })
|
|
54
|
+
})];
|
|
55
|
+
} })), o;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { _ as Slider };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=Slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.js","names":["For","mergeProps","splitProps","SliderProps","clsx","classes","SliderControl","SliderTrack","SliderIndicator","SliderThumb","useSlider","SliderContext","Slider","props","T","merged","orientation","max","min","step","disabled","const","local","others","context","_$createComponent","Provider","value","children","_el$","_tmpl$","_$spread","_$mergeProps","data-orientation","class","_$insert","each","Array","from","length","values","_","idx","index"],"sources":["../../../../src/components/slider/Slider/Slider.tsx"],"sourcesContent":["import { For, mergeProps, splitProps } from \"solid-js\";\nimport type { SliderProps } from \"./Slider.types\";\nimport { clsx } from \"~/utils\";\nimport { classes } from \"./Slider.styles\";\nimport { SliderControl } from \"../SliderControl\";\nimport { SliderTrack } from \"../SliderTrack\";\nimport { SliderIndicator } from \"../SliderIndicator\";\nimport { SliderThumb } from \"../SliderThumb\";\nimport { useSlider } from \"./useSlider\";\nimport { SliderContext } from \"./Slider.context\";\n\nexport const Slider = <T extends number | number[]>(props: SliderProps<T>) => {\n const merged = mergeProps(\n {\n orientation: \"horizontal\",\n max: 100,\n min: 0,\n step: 1,\n disabled: false,\n } as const,\n props,\n );\n\n const [local, others] = splitProps(merged, [\n \"defaultValue\",\n \"value\",\n \"max\",\n \"min\",\n \"step\",\n \"orientation\",\n \"onValueChange\",\n \"disabled\",\n \"class\",\n \"classList\",\n ]);\n\n const { context } = useSlider({\n get local() {\n return local;\n },\n });\n\n return (\n <SliderContext.Provider value={context}>\n <div\n data-slot=\"slider\"\n data-orientation={local.orientation}\n class={clsx(classes, local.class)}\n {...others}\n >\n <SliderControl>\n <SliderTrack>\n <SliderIndicator />\n </SliderTrack>\n\n <For each={Array.from({ length: context.values().length })}>\n {(_, idx) => <SliderThumb index={idx()} />}\n </For>\n </SliderControl>\n </div>\n </SliderContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;qDAWaY,KAAuCC,MAA0B;CAY5E,IAAM,CAACS,GAAOC,KAAUrB,EAXTD,EACb;EACEe,aAAa;EACbC,KAAK;EACLC,KAAK;EACLC,MAAM;EACNC,UAAU;EACX,EACDP,EACD,EAE0C;EACzC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,EAEI,EAAEW,eAAYd,EAAU,EAC5B,IAAIY,QAAQ;AACV,SAAOA;IAEV,CAAC;AAEF,QAAAG,EACGd,EAAce,UAAQ;EAACC,OAAOH;EAAO,IAAAI,WAAA;GAAA,IAAAC,IAAAC,GAAA;AAaY,UAbZC,EAAAF,GAAAG,EAAA;IAAA,IAAA,qBAAA;AAAA,YAGhBV,EAAMN;;IAAW,IAAA,QAAA;AAAA,YAC5BZ,EAAKC,GAASiB,EAAMY,MAAM;;IAAA,EAC7BX,EAAM,EAAA,IAAA,GAAA,EAAAY,EAAAN,GAAAJ,EAETnB,GAAa,EAAA,IAAAsB,WAAA;AAAA,WAAA,CAAAH,EACXlB,GAAW,EAAA,IAAAqB,WAAA;AAAA,YAAAH,EACTjB,GAAe,EAAA,CAAA;OAAA,CAAA,EAAAiB,EAGjBzB,GAAG;KAAA,IAACoC,OAAI;AAAA,aAAEC,MAAMC,KAAK,EAAEC,QAAQf,EAAQgB,QAAQ,CAACD,QAAQ,CAAC;;KAAAX,WACtDa,GAAGC,MAAGjB,EAAMhB,GAAW,EAAA,IAACkC,QAAK;AAAA,aAAED,GAAK;QAAA,CAAA;KAAI,CAAA,CAAA;MAAA,CAAA,CAAA,EAAAb;;EAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const classes = "data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.styles.js","names":[],"sources":["../../../../src/components/slider/Slider/Slider.styles.ts"],"sourcesContent":["export const classes =\n \"data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full\";\n"],"mappings":";AAAA,IAAa,IACX"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseProps, PolymorphicProps } from '../../../types';
|
|
2
|
+
interface BaseSliderProps<T> {
|
|
3
|
+
defaultValue?: T;
|
|
4
|
+
value?: T;
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
orientation?: "horizontal" | "vertical";
|
|
9
|
+
onValueChange?: (value: T) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type SliderProps<T extends number | number[]> = PolymorphicProps<"div", BaseProps & BaseSliderProps<T>, false>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SliderProps } from './Slider.types';
|
|
2
|
+
import { NonNullableProps } from '../../../types';
|
|
3
|
+
export declare const useSlider: <T extends number | number[]>({ local, }: {
|
|
4
|
+
local: NonNullableProps<Pick<SliderProps<T>, "defaultValue" | "value" | "max" | "min" | "step" | "orientation" | "onValueChange" | "disabled">, "max" | "min" | "step" | "orientation" | "disabled">;
|
|
5
|
+
}) => {
|
|
6
|
+
context: {
|
|
7
|
+
values: import('solid-js').Accessor<number[]>;
|
|
8
|
+
min: () => number;
|
|
9
|
+
max: () => number;
|
|
10
|
+
step: () => number;
|
|
11
|
+
orientation: () => "horizontal" | "vertical";
|
|
12
|
+
disabled: () => boolean;
|
|
13
|
+
activeThumbIndex: import('solid-js').Accessor<number>;
|
|
14
|
+
setActiveThumbIndex: import('solid-js').Setter<number>;
|
|
15
|
+
updateValue: (index: number, rawValue: number) => void;
|
|
16
|
+
trackRef: () => HTMLDivElement | undefined;
|
|
17
|
+
setTrackRef: (el: HTMLDivElement) => void;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createMemo as e, createSignal as t } from "solid-js";
|
|
2
|
+
//#region src/components/slider/Slider/useSlider.ts
|
|
3
|
+
var n = ({ local: n }) => {
|
|
4
|
+
let r = Array.isArray(n.value ?? n.defaultValue), i = (e) => e === void 0 ? [n.min] : Array.isArray(e) ? e : [e], a = () => n.value !== void 0, [o, s] = t(i(n.defaultValue)), c = e(() => a() ? i(n.value) : o()), l = (e) => r ? e : e[0], [u, d] = t(0), f, p = () => f, m = (e) => {
|
|
5
|
+
f = e;
|
|
6
|
+
}, h = e(() => {
|
|
7
|
+
let e = n.step.toString(), t = e.indexOf(".");
|
|
8
|
+
return t === -1 ? 0 : e.length - t - 1;
|
|
9
|
+
}), g = (e) => {
|
|
10
|
+
let { min: t, max: r, step: i } = n, a = Math.round((e - t) / i) * i + t, o = parseFloat(a.toFixed(h()));
|
|
11
|
+
return Math.min(r, Math.max(t, o));
|
|
12
|
+
};
|
|
13
|
+
return { context: {
|
|
14
|
+
values: c,
|
|
15
|
+
min: () => n.min,
|
|
16
|
+
max: () => n.max,
|
|
17
|
+
step: () => n.step,
|
|
18
|
+
orientation: () => n.orientation,
|
|
19
|
+
disabled: () => n.disabled,
|
|
20
|
+
activeThumbIndex: u,
|
|
21
|
+
setActiveThumbIndex: d,
|
|
22
|
+
updateValue: (e, t) => {
|
|
23
|
+
let r = c().slice(), i = g(t);
|
|
24
|
+
e > 0 && i <= r[e - 1] && (i = g(r[e - 1] + n.step)), e < r.length - 1 && i >= r[e + 1] && (i = g(r[e + 1] - n.step)), r[e] = i, a() || s(r), n.onValueChange?.(l(r));
|
|
25
|
+
},
|
|
26
|
+
trackRef: p,
|
|
27
|
+
setTrackRef: m
|
|
28
|
+
} };
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { n as useSlider };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=useSlider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSlider.js","names":[],"sources":["../../../../src/components/slider/Slider/useSlider.ts"],"sourcesContent":["import { createMemo, createSignal } from \"solid-js\";\nimport type { SliderProps } from \"./Slider.types\";\nimport type { NonNullableProps } from \"~/types\";\n\nexport const useSlider = <T extends number | number[]>({\n local,\n}: {\n local: NonNullableProps<\n Pick<\n SliderProps<T>,\n | \"defaultValue\"\n | \"value\"\n | \"max\"\n | \"min\"\n | \"step\"\n | \"orientation\"\n | \"onValueChange\"\n | \"disabled\"\n >,\n \"max\" | \"min\" | \"step\" | \"orientation\" | \"disabled\"\n >;\n}) => {\n // 由初始传入的类型一次性决定,运行时不再改变\n const isArray = Array.isArray(local.value ?? local.defaultValue);\n\n // 将外部的 T 统一转为内部 number[]\n const toArray = (v: T | undefined): number[] => {\n if (v === undefined) return [local.min];\n return Array.isArray(v) ? v : [v as number];\n };\n\n // 受控 / 非受控模式\n const isControlled = () => local.value !== undefined;\n\n const [internalValues, setInternalValues] = createSignal<number[]>(\n toArray(local.defaultValue),\n );\n\n const values = createMemo<number[]>(() =>\n isControlled() ? toArray(local.value) : internalValues(),\n );\n\n // 将内部 number[] 还原为外部类型 T\n const toExternal = (arr: number[]): T => (isArray ? arr : arr[0]) as T;\n\n // 当前被拖拽的 thumb 索引\n const [activeThumbIndex, setActiveThumbIndex] = createSignal(0);\n\n // track DOM 引用(由 SliderTrack 注入)\n let trackEl: HTMLDivElement | undefined;\n const trackRef = () => trackEl;\n const setTrackRef = (el: HTMLDivElement) => {\n trackEl = el;\n };\n\n /** 从 step 推导需要保留的小数位数,例如 step=0.05 → 2 位 */\n const stepDecimals = createMemo(() => {\n const s = local.step.toString();\n const dot = s.indexOf(\".\");\n return dot === -1 ? 0 : s.length - dot - 1;\n });\n\n /** 将原始数值 snap 到 step 并 clamp 到 [min, max] */\n const snapValue = (raw: number) => {\n const { min, max, step } = local;\n const snapped = Math.round((raw - min) / step) * step + min;\n const fixed = parseFloat(snapped.toFixed(stepDecimals()));\n return Math.min(max, Math.max(min, fixed));\n };\n\n const updateValue = (index: number, rawValue: number) => {\n const next = values().slice();\n let snapped = snapValue(rawValue);\n\n // 防止 thumbs 交叉(多 thumb 场景)\n if (index > 0 && snapped <= next[index - 1]) {\n snapped = snapValue(next[index - 1] + local.step);\n }\n if (index < next.length - 1 && snapped >= next[index + 1]) {\n snapped = snapValue(next[index + 1] - local.step);\n }\n\n next[index] = snapped;\n\n if (!isControlled()) setInternalValues(next);\n local.onValueChange?.(toExternal(next));\n };\n\n const context = {\n values,\n min: () => local.min,\n max: () => local.max,\n step: () => local.step,\n orientation: () => local.orientation,\n disabled: () => local.disabled,\n activeThumbIndex,\n setActiveThumbIndex,\n updateValue,\n trackRef,\n setTrackRef,\n };\n\n return { context };\n};\n"],"mappings":";;AAIA,IAAa,KAA0C,EACrD,eAgBI;CAEJ,IAAM,IAAU,MAAM,QAAQ,EAAM,SAAS,EAAM,aAAa,EAG1D,KAAW,MACX,MAAM,KAAA,IAAkB,CAAC,EAAM,IAAI,GAChC,MAAM,QAAQ,EAAE,GAAG,IAAI,CAAC,EAAY,EAIvC,UAAqB,EAAM,UAAU,KAAA,GAErC,CAAC,GAAgB,KAAqB,EAC1C,EAAQ,EAAM,aAAa,CAC5B,EAEK,IAAS,QACb,GAAc,GAAG,EAAQ,EAAM,MAAM,GAAG,GAAgB,CACzD,EAGK,KAAc,MAAsB,IAAU,IAAM,EAAI,IAGxD,CAAC,GAAkB,KAAuB,EAAa,EAAE,EAG3D,GACE,UAAiB,GACjB,KAAe,MAAuB;AAC1C,MAAU;IAIN,IAAe,QAAiB;EACpC,IAAM,IAAI,EAAM,KAAK,UAAU,EACzB,IAAM,EAAE,QAAQ,IAAI;AAC1B,SAAO,MAAQ,KAAK,IAAI,EAAE,SAAS,IAAM;GACzC,EAGI,KAAa,MAAgB;EACjC,IAAM,EAAE,QAAK,QAAK,YAAS,GACrB,IAAU,KAAK,OAAO,IAAM,KAAO,EAAK,GAAG,IAAO,GAClD,IAAQ,WAAW,EAAQ,QAAQ,GAAc,CAAC,CAAC;AACzD,SAAO,KAAK,IAAI,GAAK,KAAK,IAAI,GAAK,EAAM,CAAC;;AAmC5C,QAAO,EAAE,SAdO;EACd;EACA,WAAW,EAAM;EACjB,WAAW,EAAM;EACjB,YAAY,EAAM;EAClB,mBAAmB,EAAM;EACzB,gBAAgB,EAAM;EACtB;EACA;EACA,cA3BmB,GAAe,MAAqB;GACvD,IAAM,IAAO,GAAQ,CAAC,OAAO,EACzB,IAAU,EAAU,EAAS;AAajC,GAVI,IAAQ,KAAK,KAAW,EAAK,IAAQ,OACvC,IAAU,EAAU,EAAK,IAAQ,KAAK,EAAM,KAAK,GAE/C,IAAQ,EAAK,SAAS,KAAK,KAAW,EAAK,IAAQ,OACrD,IAAU,EAAU,EAAK,IAAQ,KAAK,EAAM,KAAK,GAGnD,EAAK,KAAS,GAET,GAAc,IAAE,EAAkB,EAAK,EAC5C,EAAM,gBAAgB,EAAW,EAAK,CAAC;;EAavC;EACA;EACD,EAEiB"}
|