dishui 0.0.79 → 0.0.80

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.
Files changed (42) hide show
  1. package/dist/components/Avatar/index.d.ts +6 -4
  2. package/dist/components/Avatar/index.js +39 -28
  3. package/dist/components/Avatar/index.js.map +1 -1
  4. package/dist/components/Card/index.d.ts +16 -8
  5. package/dist/components/Card/index.js +81 -99
  6. package/dist/components/Card/index.js.map +1 -1
  7. package/dist/components/DateTimeInput/index.js +3 -2
  8. package/dist/components/DateTimeInput/index.js.map +1 -1
  9. package/dist/components/GroupedTable/index.d.ts +2 -1
  10. package/dist/components/GroupedTable/index.js +96 -37
  11. package/dist/components/GroupedTable/index.js.map +1 -1
  12. package/dist/components/Input/index.d.ts +2 -2
  13. package/dist/components/Input/index.js +129 -111
  14. package/dist/components/Input/index.js.map +1 -1
  15. package/dist/components/Label/index.js +1 -1
  16. package/dist/components/Label/index.js.map +1 -1
  17. package/dist/components/NavigationList/index.js +55 -24
  18. package/dist/components/NavigationList/index.js.map +1 -1
  19. package/dist/components/Resizable/index.d.ts +28 -0
  20. package/dist/components/Resizable/index.js +128 -0
  21. package/dist/components/Resizable/index.js.map +1 -0
  22. package/dist/components/Resizable/useResize.d.ts +21 -0
  23. package/dist/components/Resizable/useResize.js +60 -0
  24. package/dist/components/Resizable/useResize.js.map +1 -0
  25. package/dist/components/SidebarToggleButton/index.js +51 -43
  26. package/dist/components/SidebarToggleButton/index.js.map +1 -1
  27. package/dist/components/Slider/index.d.ts +17 -3
  28. package/dist/components/Slider/index.js +131 -28
  29. package/dist/components/Slider/index.js.map +1 -1
  30. package/dist/dishui.css +1 -1
  31. package/dist/index-nostyled.d.ts +2 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +123 -121
  34. package/dist/layouts/Sidebar.js +34 -45
  35. package/dist/layouts/Sidebar.js.map +1 -1
  36. package/dist/lite.d.ts +2 -0
  37. package/dist/lite.js +20 -18
  38. package/dist/utils/i18n.js +145 -75
  39. package/dist/utils/i18n.js.map +1 -1
  40. package/dist/utils/menu.js +85 -8
  41. package/dist/utils/menu.js.map +1 -1
  42. package/package.json +1 -1
@@ -1,8 +1,9 @@
1
1
  import { cn as e } from "../../utils/cn.js";
2
- import { useCallback as t, useState as n } from "react";
3
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
2
+ /* empty css */
3
+ import { useId as t, useRef as n, useState as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
5
  //#region src/components/Slider/index.tsx
5
- var a = {
6
+ var o = {
6
7
  default: "",
7
8
  primary: "range-primary",
8
9
  secondary: "range-secondary",
@@ -11,42 +12,144 @@ var a = {
11
12
  success: "range-success",
12
13
  warning: "range-warning",
13
14
  error: "range-error"
14
- }, o = {
15
+ }, s = {
15
16
  xs: "range-xs",
16
17
  sm: "range-sm",
17
18
  md: "range-md",
18
19
  lg: "range-lg"
19
- }, s = ({ value: s, defaultValue: c, min: l = 0, max: u = 100, step: d = 1, onChange: f, label: p, showValue: m = !1, variant: h = "default", size: g = "sm", disabled: _ = !1, name: v, className: y = "", style: b }) => {
20
- let [x, S] = n(c ?? l), C = s !== void 0, w = C ? s : x, T = t((e) => {
21
- let t = Number(e.target.value);
22
- C || S(t), f?.(t, e);
23
- }, [C, f]);
24
- return /* @__PURE__ */ i("div", {
25
- className: e("w-full", y),
26
- style: b,
27
- children: [(p !== void 0 || m) && /* @__PURE__ */ i("div", {
20
+ }, c = ({ value: c, defaultValue: u, min: d = 0, max: f, step: p, onChange: m, label: h, showValue: g = !1, variant: _ = "default", size: v = "sm", disabled: y = !1, name: b, className: x = "", style: S, mode: C = "linear", orientation: w = "horizontal", shape: T = "star", count: E = 5, allowHalf: D = !1, id: O, "aria-label": k, "aria-labelledby": A, "aria-describedby": j, "aria-valuetext": M }) => {
21
+ let N = t(), P = O ?? N, F = n(null), I = Number.isFinite(E) ? Math.max(1, Math.floor(E)) : 5, L = Math.max(d, f ?? (C === "discrete" ? d + I : 100)), R = C === "discrete" ? (L - d) / I / (D ? 2 : 1) || 1 : p !== void 0 && Number.isFinite(p) && p > 0 ? p : 1, z = (e) => {
22
+ let t = Math.min(Math.round((Math.min(L, Math.max(d, Number.isFinite(e) ? e : d)) - d) / R), Math.floor((L - d) / R + 1e-10));
23
+ return Number((d + t * R).toPrecision(15));
24
+ }, [B, V] = r(u ?? d), H = c !== void 0, U = z(H ? c : B), W = L > d ? (U - d) / (L - d) : 0, G = w === "vertical" && C !== "circular", K = C !== "linear", q = (e) => {
25
+ if (y) return;
26
+ let t = z(Number(e.target.value));
27
+ H || V(t), m?.(t, e);
28
+ }, J = (e) => {
29
+ let t = F.current;
30
+ if (y || !t || L === d) return;
31
+ let n = e.currentTarget.getBoundingClientRect(), r = G ? (n.bottom - e.clientY) / n.height : (e.clientX - n.left) / n.width;
32
+ if (C === "circular") {
33
+ let t = e.clientX - n.left - n.width / 2, i = e.clientY - n.top - n.height / 2;
34
+ if (Math.hypot(t, i) < n.width * .15) return;
35
+ r = (Math.atan2(t, -i) + Math.PI * 2) % (Math.PI * 2) / (Math.PI * 2), Math.abs(r - W) > .5 && e.type === "pointermove" && (r = +(W > .5));
36
+ }
37
+ let i = z(d + Math.min(1, Math.max(0, r)) * (L - d));
38
+ i !== U && (Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(t, String(i)), t.dispatchEvent(new Event("input", { bubbles: !0 })));
39
+ };
40
+ return /* @__PURE__ */ a("div", {
41
+ className: e("w-full dishui-slider", x),
42
+ style: S,
43
+ "data-mode": C,
44
+ "data-orientation": w,
45
+ "data-size": v,
46
+ "data-variant": _,
47
+ "data-disabled": y,
48
+ children: [(h !== void 0 || g) && /* @__PURE__ */ a("div", {
28
49
  className: "mb-1 flex items-center justify-between",
29
- children: [p !== void 0 && /* @__PURE__ */ r("label", {
50
+ children: [h !== void 0 && /* @__PURE__ */ i("label", {
51
+ htmlFor: P,
30
52
  className: "label-text text-sm text-base-content/80",
31
- children: p
32
- }), m && /* @__PURE__ */ r("span", {
53
+ children: h
54
+ }), g && /* @__PURE__ */ i("span", {
33
55
  className: "text-xs font-mono text-base-content/60",
34
- children: w
56
+ children: U
35
57
  })]
36
- }), /* @__PURE__ */ r("input", {
37
- type: "range",
38
- className: e("range", a[h], o[g]),
39
- ...C ? { value: w } : { defaultValue: c ?? l },
40
- min: l,
41
- max: u,
42
- step: d,
43
- disabled: _,
44
- name: v,
45
- onChange: T
58
+ }), /* @__PURE__ */ a("div", {
59
+ className: "dishui-slider-control",
60
+ onPointerDown: K ? (e) => {
61
+ y || e.button !== 0 || (e.preventDefault(), F.current?.focus(), e.currentTarget.setPointerCapture(e.pointerId), J(e));
62
+ } : void 0,
63
+ onPointerMove: K ? (e) => {
64
+ e.currentTarget.hasPointerCapture(e.pointerId) && J(e);
65
+ } : void 0,
66
+ onPointerUp: K ? (e) => {
67
+ e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId);
68
+ } : void 0,
69
+ children: [
70
+ /* @__PURE__ */ i("input", {
71
+ ref: F,
72
+ id: P,
73
+ "aria-label": k,
74
+ "aria-labelledby": A,
75
+ "aria-describedby": j,
76
+ "aria-valuetext": M,
77
+ "aria-orientation": G ? "vertical" : "horizontal",
78
+ type: "range",
79
+ className: e("range", o[_], s[v]),
80
+ value: U,
81
+ min: d,
82
+ max: L,
83
+ step: R,
84
+ disabled: y,
85
+ name: b,
86
+ onChange: q
87
+ }),
88
+ C === "circular" && /* @__PURE__ */ a("svg", {
89
+ className: "dishui-slider-dial",
90
+ viewBox: "0 0 100 100",
91
+ "aria-hidden": "true",
92
+ children: [
93
+ /* @__PURE__ */ i("circle", {
94
+ className: "dishui-slider-ring",
95
+ cx: "50",
96
+ cy: "50",
97
+ r: "40"
98
+ }),
99
+ /* @__PURE__ */ i("circle", {
100
+ className: "dishui-slider-progress",
101
+ cx: "50",
102
+ cy: "50",
103
+ r: "40",
104
+ pathLength: "100",
105
+ strokeDasharray: `${W * 100} 100`,
106
+ transform: "rotate(-90 50 50)"
107
+ }),
108
+ /* @__PURE__ */ i("circle", {
109
+ className: "dishui-slider-thumb",
110
+ cx: 50 + 40 * Math.sin(W * Math.PI * 2),
111
+ cy: 50 - 40 * Math.cos(W * Math.PI * 2),
112
+ r: "5"
113
+ }),
114
+ /* @__PURE__ */ i("text", {
115
+ x: "50",
116
+ y: "50",
117
+ dominantBaseline: "central",
118
+ textAnchor: "middle",
119
+ children: U
120
+ })
121
+ ]
122
+ }),
123
+ C === "discrete" && /* @__PURE__ */ i("div", {
124
+ className: "dishui-slider-items",
125
+ "aria-hidden": "true",
126
+ children: Array.from({ length: I }, (e, t) => {
127
+ let n = Math.max(0, Math.min(1, W * I - t));
128
+ return /* @__PURE__ */ a("span", {
129
+ className: "dishui-slider-item",
130
+ children: [/* @__PURE__ */ i("svg", {
131
+ viewBox: "0 0 24 24",
132
+ children: /* @__PURE__ */ i("path", { d: l[T] })
133
+ }), /* @__PURE__ */ i("span", {
134
+ className: "dishui-slider-item-fill",
135
+ style: { clipPath: G ? `inset(${(1 - n) * 100}% 0 0 0)` : `inset(0 ${(1 - n) * 100}% 0 0)` },
136
+ children: /* @__PURE__ */ i("svg", {
137
+ viewBox: "0 0 24 24",
138
+ children: /* @__PURE__ */ i("path", { d: l[T] })
139
+ })
140
+ })]
141
+ }, t);
142
+ })
143
+ })
144
+ ]
46
145
  })]
47
146
  });
147
+ }, l = {
148
+ square: "M3 3h18v18H3z",
149
+ star: "m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z",
150
+ heart: "M12 21 3.5 12.5C-3 6 6-2 12 5c6-7 15 1 8.5 7.5Z"
48
151
  };
49
152
  //#endregion
50
- export { s as default };
153
+ export { c as default };
51
154
 
52
155
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Slider/index.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type SliderVariant =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'accent'\n | 'info'\n | 'success'\n | 'warning'\n | 'error';\n\nexport type SliderSize = 'xs' | 'sm' | 'md' | 'lg';\n\nexport type SliderProps = {\n /** Controlled value. */\n value?: number;\n /** Uncontrolled initial value. */\n defaultValue?: number;\n /** Minimum value. */\n min?: number;\n /** Maximum value. */\n max?: number;\n /** Step increment. */\n step?: number;\n /** Change handler with the numeric value. */\n onChange?: (value: number, e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Optional label rendered above the track. */\n label?: React.ReactNode;\n /** Show the current value next to the label. */\n showValue?: boolean;\n /** Color variant (daisyUI). */\n variant?: SliderVariant;\n /** Size (daisyUI). */\n size?: SliderSize;\n /** Disabled state. */\n disabled?: boolean;\n /** Native name attribute. */\n name?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n /** Inline styles on the wrapper. */\n style?: React.CSSProperties;\n};\n\nconst VARIANT_CLASS: Record<SliderVariant, string> = {\n default: '',\n primary: 'range-primary',\n secondary: 'range-secondary',\n accent: 'range-accent',\n info: 'range-info',\n success: 'range-success',\n warning: 'range-warning',\n error: 'range-error',\n};\n\nconst SIZE_CLASS: Record<SliderSize, string> = {\n xs: 'range-xs',\n sm: 'range-sm',\n md: 'range-md',\n lg: 'range-lg',\n};\n\n/**\n * Slider —— A2UI 交互组件:滑动选择器(基于原生 range + daisyUI range)。\n * 支持受控 / 非受控、语义色、尺寸与当前值展示。\n */\nconst Slider: React.FC<SliderProps> = ({\n value,\n defaultValue,\n min = 0,\n max = 100,\n step = 1,\n onChange,\n label,\n showValue = false,\n variant = 'default',\n size = 'sm',\n disabled = false,\n name,\n className = '',\n style,\n}) => {\n const [internal, setInternal] = useState<number>(defaultValue ?? min);\n const isControlled = value !== undefined;\n const current = isControlled ? value : internal;\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const next = Number(e.target.value);\n if (!isControlled) setInternal(next);\n onChange?.(next, e);\n },\n [isControlled, onChange],\n );\n\n return (\n <div className={cn('w-full', className)} style={style}>\n {(label !== undefined || showValue) && (\n <div className=\"mb-1 flex items-center justify-between\">\n {label !== undefined && (\n <label className=\"label-text text-sm text-base-content/80\">{label}</label>\n )}\n {showValue && (\n <span className=\"text-xs font-mono text-base-content/60\">{current}</span>\n )}\n </div>\n )}\n <input\n type=\"range\"\n className={cn('range', VARIANT_CLASS[variant], SIZE_CLASS[size])}\n {...(isControlled\n ? { value: current }\n : { defaultValue: defaultValue ?? min })}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n name={name}\n onChange={handleChange}\n />\n </div>\n );\n};\n\nexport default Slider;\n"],"mappings":";;;;AA8CA,IAAM,IAA+C;CACnD,SAAS;CACT,SAAS;CACT,WAAW;CACX,QAAQ;CACR,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAEM,IAAyC;CAC7C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAMM,KAAiC,EACrC,UACA,iBACA,SAAM,GACN,SAAM,KACN,UAAO,GACP,aACA,UACA,eAAY,IACZ,aAAU,WACV,UAAO,MACP,cAAW,IACX,SACA,eAAY,IACZ,eACI;CACJ,IAAM,CAAC,GAAU,KAAe,EAAiB,KAAgB,CAAG,GAC9D,IAAe,MAAU,KAAA,GACzB,IAAU,IAAe,IAAQ,GAEjC,IAAe,GAClB,MAA2C;EAC1C,IAAM,IAAO,OAAO,EAAE,OAAO,KAAK;EAElC,AADK,KAAc,EAAY,CAAI,GACnC,IAAW,GAAM,CAAC;CACpB,GACA,CAAC,GAAc,CAAQ,CACzB;CAEA,OACE,kBAAC,OAAD;EAAK,WAAW,EAAG,UAAU,CAAS;EAAU;EAAhD,UAAA,EACI,MAAU,KAAA,KAAa,MACvB,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,MAAU,KAAA,KACT,kBAAC,SAAD;IAAO,WAAU;IAA2C,UAAA;GAAa,CAAA,GAE1E,KACC,kBAAC,QAAD;IAAM,WAAU;IAA0C,UAAA;GAAc,CAAA,CAEvE;EAEP,CAAA,GAAA,kBAAC,SAAD;GACE,MAAK;GACL,WAAW,EAAG,SAAS,EAAc,IAAU,EAAW,EAAK;GAC/D,GAAK,IACD,EAAE,OAAO,EAAQ,IACjB,EAAE,cAAc,KAAgB,EAAI;GACnC;GACA;GACC;GACI;GACJ;GACN,UAAU;EACX,CAAA,CACE;;AAET"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Slider/index.tsx"],"sourcesContent":["import React, { useId, useRef, useState } from 'react';\nimport './Slider.css';\nimport { cn } from '../../utils/cn';\n\nexport type SliderVariant =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'accent'\n | 'info'\n | 'success'\n | 'warning'\n | 'error';\n\nexport type SliderSize = 'xs' | 'sm' | 'md' | 'lg';\n\nexport type SliderProps = {\n /** Linear remains the default. Circular starts at 12 o'clock, clockwise. */\n mode?: 'linear' | 'circular' | 'discrete';\n /** Applies to linear and discrete sliders. */\n orientation?: 'horizontal' | 'vertical';\n /** Discrete item shape and quantity (positive integer, defaults to 5). */\n shape?: 'square' | 'star' | 'heart';\n count?: number;\n /** Discrete increments: half an item instead of a whole item. */\n allowHalf?: boolean;\n id?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n 'aria-valuetext'?: string;\n /** Controlled value. */\n value?: number;\n /** Uncontrolled initial value. */\n defaultValue?: number;\n /** Minimum value. */\n min?: number;\n /** Maximum value. */\n max?: number;\n /** Step increment for linear/circular modes; discrete derives it from count and allowHalf. */\n step?: number;\n /** Change handler with the numeric value. */\n onChange?: (value: number, e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Optional label rendered above the track. */\n label?: React.ReactNode;\n /** Show the current value next to the label. */\n showValue?: boolean;\n /** Color variant (daisyUI). */\n variant?: SliderVariant;\n /** Size (daisyUI). */\n size?: SliderSize;\n /** Disabled state. */\n disabled?: boolean;\n /** Native name attribute. */\n name?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n /** Inline styles on the wrapper. */\n style?: React.CSSProperties;\n};\n\nconst VARIANT_CLASS: Record<SliderVariant, string> = {\n default: '',\n primary: 'range-primary',\n secondary: 'range-secondary',\n accent: 'range-accent',\n info: 'range-info',\n success: 'range-success',\n warning: 'range-warning',\n error: 'range-error',\n};\n\nconst SIZE_CLASS: Record<SliderSize, string> = {\n xs: 'range-xs',\n sm: 'range-sm',\n md: 'range-md',\n lg: 'range-lg',\n};\n\n/**\n * Slider —— Native range semantics with linear, circular and discrete presentations.\n * Supports controlled/uncontrolled values, keyboard input and semantic colors.\n */\nconst Slider: React.FC<SliderProps> = ({\n value,\n defaultValue,\n min = 0,\n max: maxProp,\n step: stepProp,\n onChange,\n label,\n showValue = false,\n variant = 'default',\n size = 'sm',\n disabled = false,\n name,\n className = '',\n style,\n mode = 'linear',\n orientation = 'horizontal',\n shape = 'star',\n count = 5,\n allowHalf = false,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-valuetext': ariaValueText,\n}) => {\n const generatedId = useId();\n const inputId = id ?? generatedId;\n const inputRef = useRef<HTMLInputElement>(null);\n const itemCount = Number.isFinite(count) ? Math.max(1, Math.floor(count)) : 5;\n const max = Math.max(min, maxProp ?? (mode === 'discrete' ? min + itemCount : 100));\n // Discrete steps are fractions of an item, even for a custom numeric range.\n const step = mode === 'discrete'\n ? (max - min) / itemCount / (allowHalf ? 2 : 1) || 1\n : stepProp !== undefined && Number.isFinite(stepProp) && stepProp > 0 ? stepProp : 1;\n const normalize = (n: number) => {\n const bounded = Math.min(max, Math.max(min, Number.isFinite(n) ? n : min));\n const ticks = Math.min(Math.round((bounded - min) / step), Math.floor((max - min) / step + 1e-10));\n return Number((min + ticks * step).toPrecision(15));\n };\n const [internal, setInternal] = useState<number>(defaultValue ?? min);\n const isControlled = value !== undefined;\n const current = normalize(isControlled ? value : internal);\n const ratio = max > min ? (current - min) / (max - min) : 0;\n const vertical = orientation === 'vertical' && mode !== 'circular';\n const custom = mode !== 'linear';\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n const next = normalize(Number(e.target.value));\n if (!isControlled) setInternal(next);\n onChange?.(next, e);\n };\n const updatePointer = (e: React.PointerEvent<HTMLDivElement>) => {\n const input = inputRef.current;\n if (disabled || !input || max === min) return;\n const rect = e.currentTarget.getBoundingClientRect();\n let fraction = vertical ? (rect.bottom - e.clientY) / rect.height : (e.clientX - rect.left) / rect.width;\n if (mode === 'circular') {\n const dx = e.clientX - rect.left - rect.width / 2;\n const dy = e.clientY - rect.top - rect.height / 2;\n if (Math.hypot(dx, dy) < rect.width * 0.15) return;\n fraction = (Math.atan2(dx, -dy) + Math.PI * 2) % (Math.PI * 2) / (Math.PI * 2);\n // Keep dragging across the seam at the nearest endpoint, not a full-range jump.\n if (Math.abs(fraction - ratio) > 0.5 && e.type === 'pointermove') fraction = ratio > 0.5 ? 1 : 0;\n }\n const next = normalize(min + Math.min(1, Math.max(0, fraction)) * (max - min));\n if (next === current) return;\n // Dispatch through the native input so consumers receive a real React change event.\n Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(input, String(next));\n input.dispatchEvent(new Event('input', { bubbles: true }));\n };\n\n return (\n <div className={cn('w-full dishui-slider', className)} style={style} data-mode={mode} data-orientation={orientation} data-size={size} data-variant={variant} data-disabled={disabled}>\n {(label !== undefined || showValue) && (\n <div className=\"mb-1 flex items-center justify-between\">\n {label !== undefined && (\n <label htmlFor={inputId} className=\"label-text text-sm text-base-content/80\">{label}</label>\n )}\n {showValue && (\n <span className=\"text-xs font-mono text-base-content/60\">{current}</span>\n )}\n </div>\n )}\n <div className=\"dishui-slider-control\"\n onPointerDown={custom ? e => {\n if (disabled || e.button !== 0) return;\n e.preventDefault();\n inputRef.current?.focus();\n e.currentTarget.setPointerCapture(e.pointerId);\n updatePointer(e);\n } : undefined}\n onPointerMove={custom ? e => { if (e.currentTarget.hasPointerCapture(e.pointerId)) updatePointer(e); } : undefined}\n onPointerUp={custom ? e => { if (e.currentTarget.hasPointerCapture(e.pointerId)) e.currentTarget.releasePointerCapture(e.pointerId); } : undefined}\n >\n <input\n ref={inputRef}\n id={inputId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-valuetext={ariaValueText}\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n type=\"range\"\n className={cn('range', VARIANT_CLASS[variant], SIZE_CLASS[size])}\n value={current}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n name={name}\n onChange={handleChange}\n />\n {mode === 'circular' && <svg className=\"dishui-slider-dial\" viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n <circle className=\"dishui-slider-ring\" cx=\"50\" cy=\"50\" r=\"40\" />\n <circle className=\"dishui-slider-progress\" cx=\"50\" cy=\"50\" r=\"40\" pathLength=\"100\" strokeDasharray={`${ratio * 100} 100`} transform=\"rotate(-90 50 50)\" />\n <circle className=\"dishui-slider-thumb\" cx={50 + 40 * Math.sin(ratio * Math.PI * 2)} cy={50 - 40 * Math.cos(ratio * Math.PI * 2)} r=\"5\" />\n <text x=\"50\" y=\"50\" dominantBaseline=\"central\" textAnchor=\"middle\">{current}</text>\n </svg>}\n {mode === 'discrete' && <div className=\"dishui-slider-items\" aria-hidden=\"true\">\n {Array.from({ length: itemCount }, (_, index) => {\n const fill = Math.max(0, Math.min(1, ratio * itemCount - index));\n return <span className=\"dishui-slider-item\" key={index}>\n <svg viewBox=\"0 0 24 24\"><path d={SHAPES[shape]} /></svg>\n <span className=\"dishui-slider-item-fill\" style={{ clipPath: vertical ? `inset(${(1 - fill) * 100}% 0 0 0)` : `inset(0 ${(1 - fill) * 100}% 0 0)` }}>\n <svg viewBox=\"0 0 24 24\"><path d={SHAPES[shape]} /></svg>\n </span>\n </span>;\n })}\n </div>}\n </div>\n </div>\n );\n};\n\nconst SHAPES = {\n square: 'M3 3h18v18H3z',\n star: 'm12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z',\n heart: 'M12 21 3.5 12.5C-3 6 6-2 12 5c6-7 15 1 8.5 7.5Z',\n};\n\nexport default Slider;\n"],"mappings":";;;;;AA6DA,IAAM,IAA+C;CACnD,SAAS;CACT,SAAS;CACT,WAAW;CACX,QAAQ;CACR,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAEM,IAAyC;CAC7C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAMM,KAAiC,EACrC,UACA,iBACA,SAAM,GACN,KAAK,GACL,MAAM,GACN,aACA,UACA,eAAY,IACZ,aAAU,WACV,UAAO,MACP,cAAW,IACX,SACA,eAAY,IACZ,UACA,UAAO,UACP,iBAAc,cACd,WAAQ,QACR,WAAQ,GACR,eAAY,IACZ,OACA,cAAc,GACd,mBAAmB,GACnB,oBAAoB,GACpB,kBAAkB,QACd;CACJ,IAAM,IAAc,EAAM,GACpB,IAAU,KAAM,GAChB,IAAW,EAAyB,IAAI,GACxC,IAAY,OAAO,SAAS,CAAK,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,CAAK,CAAC,IAAI,GACtE,IAAM,KAAK,IAAI,GAAK,MAAY,MAAS,aAAa,IAAM,IAAY,IAAI,GAE5E,IAAO,MAAS,cACjB,IAAM,KAAO,KAAa,IAAY,IAAI,MAAM,IACjD,MAAa,KAAA,KAAa,OAAO,SAAS,CAAQ,KAAK,IAAW,IAAI,IAAW,GAC/E,KAAa,MAAc;EAE/B,IAAM,IAAQ,KAAK,IAAI,KAAK,OADZ,KAAK,IAAI,GAAK,KAAK,IAAI,GAAK,OAAO,SAAS,CAAC,IAAI,IAAI,CAAG,CACrC,IAAU,KAAO,CAAI,GAAG,KAAK,OAAO,IAAM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