@acronis-platform/ui-react 0.50.0 → 0.51.0
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/ui/accordion/accordion.js +53 -0
- package/dist/components/ui/accordion/accordion.js.map +1 -0
- package/dist/components/ui/collapsible/collapsible.js +22 -0
- package/dist/components/ui/collapsible/collapsible.js.map +1 -0
- package/dist/components/ui/number-field/number-field.js +61 -0
- package/dist/components/ui/number-field/number-field.js.map +1 -0
- package/dist/components/ui/slider/slider.js +42 -0
- package/dist/components/ui/slider/slider.js.map +1 -0
- package/dist/index.js +309 -292
- package/dist/index.js.map +1 -1
- package/dist/react.js +309 -292
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/accordion/accordion.d.ts +7 -0
- package/dist/src/components/ui/accordion/index.d.ts +1 -0
- package/dist/src/components/ui/collapsible/collapsible.d.ts +5 -0
- package/dist/src/components/ui/collapsible/index.d.ts +1 -0
- package/dist/src/components/ui/number-field/index.d.ts +1 -0
- package/dist/src/components/ui/number-field/number-field.d.ts +7 -0
- package/dist/src/components/ui/slider/index.d.ts +1 -0
- package/dist/src/components/ui/slider/slider.d.ts +7 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/ui-react.css +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { Accordion as n } from "@base-ui/react/accordion";
|
|
4
|
+
import { ChevronDownIcon as d } from "@acronis-platform/icons-react/stroke-mono";
|
|
5
|
+
import { cn as s } from "../../../lib/utils.js";
|
|
6
|
+
const h = n.Root, m = a.forwardRef(({ className: e, ...o }, r) => /* @__PURE__ */ t(
|
|
7
|
+
n.Item,
|
|
8
|
+
{
|
|
9
|
+
ref: r,
|
|
10
|
+
className: s("border-b border-border", e),
|
|
11
|
+
...o
|
|
12
|
+
}
|
|
13
|
+
));
|
|
14
|
+
m.displayName = "AccordionItem";
|
|
15
|
+
const l = a.forwardRef(({ className: e, children: o, ...r }, i) => /* @__PURE__ */ t(n.Header, { className: "flex", children: /* @__PURE__ */ c(
|
|
16
|
+
n.Trigger,
|
|
17
|
+
{
|
|
18
|
+
ref: i,
|
|
19
|
+
className: s(
|
|
20
|
+
"flex flex-1 items-center justify-between py-4 text-sm font-medium outline-none transition-all hover:underline focus-visible:rounded-sm focus-visible:ring-2 focus-visible:ring-[var(--ui-focus-primary)] [&[data-panel-open]>svg]:rotate-180",
|
|
21
|
+
e
|
|
22
|
+
),
|
|
23
|
+
...r,
|
|
24
|
+
children: [
|
|
25
|
+
o,
|
|
26
|
+
/* @__PURE__ */ t(
|
|
27
|
+
d,
|
|
28
|
+
{
|
|
29
|
+
size: 16,
|
|
30
|
+
className: "shrink-0 text-[var(--ui-text-on-surface-secondary)] transition-transform duration-200"
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
) }));
|
|
36
|
+
l.displayName = "AccordionTrigger";
|
|
37
|
+
const f = a.forwardRef(({ className: e, children: o, ...r }, i) => /* @__PURE__ */ t(
|
|
38
|
+
n.Panel,
|
|
39
|
+
{
|
|
40
|
+
ref: i,
|
|
41
|
+
className: "overflow-hidden text-sm transition-[height] duration-200 ease-out data-[ending-style]:h-0 data-[starting-style]:h-0",
|
|
42
|
+
...r,
|
|
43
|
+
children: /* @__PURE__ */ t("div", { className: s("pb-4 pt-0 text-[var(--ui-text-on-surface-secondary)]", e), children: o })
|
|
44
|
+
}
|
|
45
|
+
));
|
|
46
|
+
f.displayName = "AccordionContent";
|
|
47
|
+
export {
|
|
48
|
+
h as Accordion,
|
|
49
|
+
f as AccordionContent,
|
|
50
|
+
m as AccordionItem,
|
|
51
|
+
l as AccordionTrigger
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","sources":["../../../../src/components/ui/accordion/accordion.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Accordion as AccordionPrimitive } from '@base-ui/react/accordion';\nimport { ChevronDownIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `accordion`. A vertical set of\n// disclosure sections built on Base UI's Accordion. Markup-only — the item divider\n// uses the shared border token (bare `border-b` renders transparent in ui-react,\n// so it must name `border-border`); text inherits the foreground.\nconst Accordion = AccordionPrimitive.Root;\n\nconst AccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Item\n ref={ref}\n className={cn('border-b border-border', className)}\n {...props}\n />\n));\nAccordionItem.displayName = 'AccordionItem';\n\nconst AccordionTrigger = React.forwardRef<\n HTMLButtonElement,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n ref={ref as React.Ref<HTMLElement>}\n className={cn(\n 'flex flex-1 items-center justify-between py-4 text-sm font-medium outline-none transition-all hover:underline focus-visible:rounded-sm focus-visible:ring-2 focus-visible:ring-[var(--ui-focus-primary)] [&[data-panel-open]>svg]:rotate-180',\n className\n )}\n {...props}\n >\n {children}\n <ChevronDownIcon\n size={16}\n className=\"shrink-0 text-[var(--ui-text-on-surface-secondary)] transition-transform duration-200\"\n />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n));\nAccordionTrigger.displayName = 'AccordionTrigger';\n\nconst AccordionContent = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Panel>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Panel>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Panel\n ref={ref}\n className=\"overflow-hidden text-sm transition-[height] duration-200 ease-out data-[ending-style]:h-0 data-[starting-style]:h-0\"\n {...props}\n >\n <div className={cn('pb-4 pt-0 text-[var(--ui-text-on-surface-secondary)]', className)}>\n {children}\n </div>\n </AccordionPrimitive.Panel>\n));\nAccordionContent.displayName = 'AccordionContent';\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\n"],"names":["Accordion","AccordionPrimitive","AccordionItem","React","className","props","ref","jsx","cn","AccordionTrigger","children","jsxs","ChevronDownIcon","AccordionContent"],"mappings":";;;;;AAYA,MAAMA,IAAYC,EAAmB,MAE/BC,IAAgBC,EAAM,WAG1B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAmB;AAAA,EAAnB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE,EAAG,0BAA0BJ,CAAS;AAAA,IAChD,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAc,cAAc;AAE5B,MAAMO,IAAmBN,EAAM,WAG7B,CAAC,EAAE,WAAAC,GAAW,UAAAM,GAAU,GAAGL,EAAA,GAASC,MACpC,gBAAAC,EAACN,EAAmB,QAAnB,EAA0B,WAAU,QACnC,UAAA,gBAAAU;AAAA,EAACV,EAAmB;AAAA,EAAnB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,IAEH,UAAA;AAAA,MAAAK;AAAA,MACD,gBAAAH;AAAA,QAACK;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,UACN,WAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ;AAAA,EAAA;AACF,GACF,CACD;AACDH,EAAiB,cAAc;AAE/B,MAAMI,IAAmBV,EAAM,WAG7B,CAAC,EAAE,WAAAC,GAAW,UAAAM,GAAU,GAAGL,KAASC,MACpC,gBAAAC;AAAA,EAACN,EAAmB;AAAA,EAAnB;AAAA,IACC,KAAAK;AAAA,IACA,WAAU;AAAA,IACT,GAAGD;AAAA,IAEJ,4BAAC,OAAA,EAAI,WAAWG,EAAG,wDAAwDJ,CAAS,GACjF,UAAAM,EAAA,CACH;AAAA,EAAA;AACF,CACD;AACDG,EAAiB,cAAc;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { Collapsible as o } from "@base-ui/react/collapsible";
|
|
4
|
+
import { cn as s } from "../../../lib/utils.js";
|
|
5
|
+
const d = o.Root, C = o.Trigger, r = i.forwardRef(({ className: t, ...e }, l) => /* @__PURE__ */ a(
|
|
6
|
+
o.Panel,
|
|
7
|
+
{
|
|
8
|
+
ref: l,
|
|
9
|
+
className: s(
|
|
10
|
+
"overflow-hidden transition-[height] duration-200 ease-out data-[ending-style]:h-0 data-[starting-style]:h-0",
|
|
11
|
+
t
|
|
12
|
+
),
|
|
13
|
+
...e
|
|
14
|
+
}
|
|
15
|
+
));
|
|
16
|
+
r.displayName = "CollapsibleContent";
|
|
17
|
+
export {
|
|
18
|
+
d as Collapsible,
|
|
19
|
+
r as CollapsibleContent,
|
|
20
|
+
C as CollapsibleTrigger
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=collapsible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible.js","sources":["../../../../src/components/ui/collapsible/collapsible.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';\n\nimport { cn } from '@/lib/utils';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `collapsible`. A thin wrapper over\n// Base UI's Collapsible — a disclosure: a trigger toggles a height-animating panel.\n// No colors of its own (it's the primitive behind Accordion and the sidebars).\nconst Collapsible = CollapsiblePrimitive.Root;\n\nconst CollapsibleTrigger = CollapsiblePrimitive.Trigger;\n\nconst CollapsibleContent = React.forwardRef<\n React.ElementRef<typeof CollapsiblePrimitive.Panel>,\n React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Panel>\n>(({ className, ...props }, ref) => (\n <CollapsiblePrimitive.Panel\n ref={ref}\n className={cn(\n 'overflow-hidden transition-[height] duration-200 ease-out data-[ending-style]:h-0 data-[starting-style]:h-0',\n className\n )}\n {...props}\n />\n));\nCollapsibleContent.displayName = 'CollapsibleContent';\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"],"names":["Collapsible","CollapsiblePrimitive","CollapsibleTrigger","CollapsibleContent","React","className","props","ref","jsx","cn"],"mappings":";;;;AAUA,MAAMA,IAAcC,EAAqB,MAEnCC,IAAqBD,EAAqB,SAE1CE,IAAqBC,EAAM,WAG/B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACP,EAAqB;AAAA,EAArB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAmB,cAAc;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { NumberField as t } from "@base-ui/react/number-field";
|
|
4
|
+
import { MinusIcon as n, PlusIcon as u } from "@acronis-platform/icons-react/stroke-mono";
|
|
5
|
+
import { cn as l } from "../../../lib/utils.js";
|
|
6
|
+
const g = t.Root, b = a.forwardRef(({ className: e, ...r }, o) => /* @__PURE__ */ i(
|
|
7
|
+
t.Group,
|
|
8
|
+
{
|
|
9
|
+
ref: o,
|
|
10
|
+
className: l(
|
|
11
|
+
"flex h-[var(--ui-input-text-global-box-height)] w-full min-w-0 items-stretch overflow-hidden rounded-[var(--ui-input-text-global-box-border-radius)] border bg-[var(--ui-input-text-global-box-color-idle)] border-[var(--ui-input-text-normal-box-border-color-idle)] transition-colors",
|
|
12
|
+
"not-has-disabled:hover:border-[var(--ui-input-text-normal-box-border-color-hover)]",
|
|
13
|
+
"has-[input:focus-visible]:border-[var(--ui-input-text-normal-box-border-color-hover)] has-[input:focus-visible]:ring-[3px] has-[input:focus-visible]:ring-[var(--ui-focus-primary)]",
|
|
14
|
+
"has-disabled:cursor-not-allowed has-disabled:border-[var(--ui-input-text-normal-box-border-color-disabled)] has-disabled:bg-[var(--ui-input-text-global-box-color-disabled)]",
|
|
15
|
+
"has-[input[aria-invalid=true]]:border-[var(--ui-input-text-error-msg-box-border-color-idle)] has-[input[aria-invalid=true]:focus-visible]:ring-[var(--ui-focus-error)]",
|
|
16
|
+
e
|
|
17
|
+
),
|
|
18
|
+
...r
|
|
19
|
+
}
|
|
20
|
+
));
|
|
21
|
+
b.displayName = "NumberFieldGroup";
|
|
22
|
+
const c = a.forwardRef(({ className: e, ...r }, o) => /* @__PURE__ */ i(
|
|
23
|
+
t.Input,
|
|
24
|
+
{
|
|
25
|
+
ref: o,
|
|
26
|
+
className: l(
|
|
27
|
+
"min-w-0 flex-1 bg-transparent px-[var(--ui-input-text-global-box-padding-x)] text-center text-sm leading-6 text-[var(--ui-input-text-global-value-color-idle)] outline-none placeholder:text-[var(--ui-input-text-global-placeholder-color-idle)] disabled:cursor-not-allowed disabled:text-[var(--ui-input-text-global-value-color-disabled)]",
|
|
28
|
+
e
|
|
29
|
+
),
|
|
30
|
+
...r
|
|
31
|
+
}
|
|
32
|
+
));
|
|
33
|
+
c.displayName = "NumberFieldInput";
|
|
34
|
+
const s = "flex w-9 shrink-0 cursor-pointer items-center justify-center text-[var(--ui-text-on-surface-secondary)] transition-colors not-disabled:hover:bg-[var(--ui-background-surface-hover)] not-disabled:hover:text-[var(--ui-text-on-surface-primary)] disabled:cursor-not-allowed disabled:text-[var(--ui-text-on-surface-disabled)]", m = a.forwardRef(({ className: e, children: r, ...o }, d) => /* @__PURE__ */ i(
|
|
35
|
+
t.Decrement,
|
|
36
|
+
{
|
|
37
|
+
ref: d,
|
|
38
|
+
className: l(s, e),
|
|
39
|
+
...o,
|
|
40
|
+
children: r ?? /* @__PURE__ */ i(n, { size: 16 })
|
|
41
|
+
}
|
|
42
|
+
));
|
|
43
|
+
m.displayName = "NumberFieldDecrement";
|
|
44
|
+
const p = a.forwardRef(({ className: e, children: r, ...o }, d) => /* @__PURE__ */ i(
|
|
45
|
+
t.Increment,
|
|
46
|
+
{
|
|
47
|
+
ref: d,
|
|
48
|
+
className: l(s, e),
|
|
49
|
+
...o,
|
|
50
|
+
children: r ?? /* @__PURE__ */ i(u, { size: 16 })
|
|
51
|
+
}
|
|
52
|
+
));
|
|
53
|
+
p.displayName = "NumberFieldIncrement";
|
|
54
|
+
export {
|
|
55
|
+
g as NumberField,
|
|
56
|
+
m as NumberFieldDecrement,
|
|
57
|
+
b as NumberFieldGroup,
|
|
58
|
+
p as NumberFieldIncrement,
|
|
59
|
+
c as NumberFieldInput
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=number-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-field.js","sources":["../../../../src/components/ui/number-field/number-field.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';\nimport { MinusIcon, PlusIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\n\n// Ported from `@acronis-platform`'s `number-field`, on Base UI's NumberField\n// (Root / Group / Decrement / Input / Increment). No `--ui-number-field-*` tier —\n// the box reuses the `--ui-input-text-*` tier (already imported) so it matches\n// InputBox / InputText; the steppers use the muted/primary surface + text tokens.\n\nconst NumberField = NumberFieldPrimitive.Root;\n\n// The bordered box wrapping the steppers + input. Mirrors the InputBox field box\n// (height / radius / border / bg / hover / focus-within ring / disabled / invalid).\nconst NumberFieldGroup = React.forwardRef<\n React.ElementRef<typeof NumberFieldPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <NumberFieldPrimitive.Group\n ref={ref}\n className={cn(\n 'flex h-[var(--ui-input-text-global-box-height)] w-full min-w-0 items-stretch overflow-hidden rounded-[var(--ui-input-text-global-box-border-radius)] border bg-[var(--ui-input-text-global-box-color-idle)] border-[var(--ui-input-text-normal-box-border-color-idle)] transition-colors',\n 'not-has-disabled:hover:border-[var(--ui-input-text-normal-box-border-color-hover)]',\n 'has-[input:focus-visible]:border-[var(--ui-input-text-normal-box-border-color-hover)] has-[input:focus-visible]:ring-[3px] has-[input:focus-visible]:ring-[var(--ui-focus-primary)]',\n 'has-disabled:cursor-not-allowed has-disabled:border-[var(--ui-input-text-normal-box-border-color-disabled)] has-disabled:bg-[var(--ui-input-text-global-box-color-disabled)]',\n 'has-[input[aria-invalid=true]]:border-[var(--ui-input-text-error-msg-box-border-color-idle)] has-[input[aria-invalid=true]:focus-visible]:ring-[var(--ui-focus-error)]',\n className\n )}\n {...props}\n />\n));\nNumberFieldGroup.displayName = 'NumberFieldGroup';\n\nconst NumberFieldInput = React.forwardRef<\n React.ElementRef<typeof NumberFieldPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <NumberFieldPrimitive.Input\n ref={ref}\n className={cn(\n 'min-w-0 flex-1 bg-transparent px-[var(--ui-input-text-global-box-padding-x)] text-center text-sm leading-6 text-[var(--ui-input-text-global-value-color-idle)] outline-none placeholder:text-[var(--ui-input-text-global-placeholder-color-idle)] disabled:cursor-not-allowed disabled:text-[var(--ui-input-text-global-value-color-disabled)]',\n className\n )}\n {...props}\n />\n));\nNumberFieldInput.displayName = 'NumberFieldInput';\n\nconst stepperClassName =\n 'flex w-9 shrink-0 cursor-pointer items-center justify-center text-[var(--ui-text-on-surface-secondary)] transition-colors not-disabled:hover:bg-[var(--ui-background-surface-hover)] not-disabled:hover:text-[var(--ui-text-on-surface-primary)] disabled:cursor-not-allowed disabled:text-[var(--ui-text-on-surface-disabled)]';\n\nconst NumberFieldDecrement = React.forwardRef<\n React.ElementRef<typeof NumberFieldPrimitive.Decrement>,\n React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.Decrement>\n>(({ className, children, ...props }, ref) => (\n <NumberFieldPrimitive.Decrement\n ref={ref}\n className={cn(stepperClassName, className)}\n {...props}\n >\n {children ?? <MinusIcon size={16} />}\n </NumberFieldPrimitive.Decrement>\n));\nNumberFieldDecrement.displayName = 'NumberFieldDecrement';\n\nconst NumberFieldIncrement = React.forwardRef<\n React.ElementRef<typeof NumberFieldPrimitive.Increment>,\n React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.Increment>\n>(({ className, children, ...props }, ref) => (\n <NumberFieldPrimitive.Increment\n ref={ref}\n className={cn(stepperClassName, className)}\n {...props}\n >\n {children ?? <PlusIcon size={16} />}\n </NumberFieldPrimitive.Increment>\n));\nNumberFieldIncrement.displayName = 'NumberFieldIncrement';\n\nexport {\n NumberField,\n NumberFieldGroup,\n NumberFieldInput,\n NumberFieldDecrement,\n NumberFieldIncrement,\n};\n"],"names":["NumberField","NumberFieldPrimitive","NumberFieldGroup","React","className","props","ref","jsx","cn","NumberFieldInput","stepperClassName","NumberFieldDecrement","children","MinusIcon","NumberFieldIncrement","PlusIcon"],"mappings":";;;;;AAaA,MAAMA,IAAcC,EAAqB,MAInCC,IAAmBC,EAAM,WAG7B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAqB;AAAA,EAArB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAiB,cAAc;AAE/B,MAAMO,IAAmBN,EAAM,WAG7B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAqB;AAAA,EAArB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDI,EAAiB,cAAc;AAE/B,MAAMC,IACJ,mUAEIC,IAAuBR,EAAM,WAGjC,CAAC,EAAE,WAAAC,GAAW,UAAAQ,GAAU,GAAGP,KAASC,MACpC,gBAAAC;AAAA,EAACN,EAAqB;AAAA,EAArB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE,EAAGE,GAAkBN,CAAS;AAAA,IACxC,GAAGC;AAAA,IAEH,UAAAO,KAAY,gBAAAL,EAACM,GAAA,EAAU,MAAM,GAAA,CAAI;AAAA,EAAA;AACpC,CACD;AACDF,EAAqB,cAAc;AAEnC,MAAMG,IAAuBX,EAAM,WAGjC,CAAC,EAAE,WAAAC,GAAW,UAAAQ,GAAU,GAAGP,KAASC,MACpC,gBAAAC;AAAA,EAACN,EAAqB;AAAA,EAArB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE,EAAGE,GAAkBN,CAAS;AAAA,IACxC,GAAGC;AAAA,IAEH,UAAAO,KAAY,gBAAAL,EAACQ,GAAA,EAAS,MAAM,GAAA,CAAI;AAAA,EAAA;AACnC,CACD;AACDD,EAAqB,cAAc;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as o, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import * as g from "react";
|
|
3
|
+
import { Slider as r } from "@base-ui/react/slider";
|
|
4
|
+
import { cn as s } from "../../../lib/utils.js";
|
|
5
|
+
const m = g.forwardRef(
|
|
6
|
+
({ className: d, defaultValue: a, value: e, ...l }, t) => {
|
|
7
|
+
const n = e != null ? Array.isArray(e) ? e : [e] : void 0, i = a != null ? Array.isArray(a) ? a : [a] : [0], u = (n ?? i).length;
|
|
8
|
+
return /* @__PURE__ */ o(
|
|
9
|
+
r.Root,
|
|
10
|
+
{
|
|
11
|
+
ref: t,
|
|
12
|
+
value: n,
|
|
13
|
+
defaultValue: i,
|
|
14
|
+
className: s(
|
|
15
|
+
"group relative flex w-full touch-none select-none items-center",
|
|
16
|
+
d
|
|
17
|
+
),
|
|
18
|
+
...l,
|
|
19
|
+
children: /* @__PURE__ */ b(r.Control, { className: "relative flex w-full items-center py-2", children: [
|
|
20
|
+
/* @__PURE__ */ o(r.Track, { className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-[var(--ui-border-on-surface-border)]", children: /* @__PURE__ */ o(r.Indicator, { className: "rounded-full bg-[var(--ui-background-brand-secondary)] group-data-[disabled]:bg-[var(--ui-background-status-strong-neutral)]" }) }),
|
|
21
|
+
Array.from({ length: u }, (f, c) => /* @__PURE__ */ o(
|
|
22
|
+
r.Thumb,
|
|
23
|
+
{
|
|
24
|
+
className: s(
|
|
25
|
+
"block size-4 rounded-full border border-[var(--ui-background-brand-secondary)] bg-background shadow-sm transition-colors",
|
|
26
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-focus-primary)]",
|
|
27
|
+
"data-dragging:ring-2 data-dragging:ring-[var(--ui-focus-primary)]",
|
|
28
|
+
"data-disabled:pointer-events-none data-disabled:border-[var(--ui-background-status-strong-neutral)] data-disabled:opacity-50"
|
|
29
|
+
)
|
|
30
|
+
},
|
|
31
|
+
c
|
|
32
|
+
))
|
|
33
|
+
] })
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
m.displayName = "Slider";
|
|
39
|
+
export {
|
|
40
|
+
m as Slider
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.js","sources":["../../../../src/components/ui/slider/slider.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slider as SliderPrimitive } from '@base-ui/react/slider';\n\nimport { cn } from '@/lib/utils';\n\n// Ported from `@acronis-platform`'s `slider`, on Base UI's Slider (Root / Control /\n// Track / Indicator / Thumb). Supports a single value or a range (array value) —\n// the thumb count follows the value/defaultValue length. No `--ui-slider-*` tier,\n// so it uses semantic tokens: the rail is the divider gray\n// (`--ui-border-on-surface-border`); the filled indicator and the thumb border use\n// the action blue (`--ui-background-brand-secondary`) — note legacy's `bg-primary`\n// is the dark navy in ui-react, so the action color is `secondary`.\nexport type SliderProps = React.ComponentPropsWithoutRef<\n typeof SliderPrimitive.Root\n>;\n\nconst Slider = React.forwardRef<HTMLDivElement, SliderProps>(\n ({ className, defaultValue, value, ...props }, ref) => {\n const normalizedValue =\n value != null ? (Array.isArray(value) ? value : [value]) : undefined;\n const normalizedDefaultValue =\n defaultValue != null\n ? Array.isArray(defaultValue)\n ? defaultValue\n : [defaultValue]\n : [0];\n const thumbCount = (normalizedValue ?? normalizedDefaultValue).length;\n\n return (\n <SliderPrimitive.Root\n ref={ref}\n value={normalizedValue}\n defaultValue={normalizedDefaultValue}\n className={cn(\n 'group relative flex w-full touch-none select-none items-center',\n className\n )}\n {...props}\n >\n <SliderPrimitive.Control className=\"relative flex w-full items-center py-2\">\n <SliderPrimitive.Track className=\"relative h-1.5 w-full grow overflow-hidden rounded-full bg-[var(--ui-border-on-surface-border)]\">\n <SliderPrimitive.Indicator className=\"rounded-full bg-[var(--ui-background-brand-secondary)] group-data-[disabled]:bg-[var(--ui-background-status-strong-neutral)]\" />\n </SliderPrimitive.Track>\n {Array.from({ length: thumbCount }, (_, i) => (\n <SliderPrimitive.Thumb\n key={i}\n className={cn(\n 'block size-4 rounded-full border border-[var(--ui-background-brand-secondary)] bg-background shadow-sm transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-focus-primary)]',\n 'data-dragging:ring-2 data-dragging:ring-[var(--ui-focus-primary)]',\n 'data-disabled:pointer-events-none data-disabled:border-[var(--ui-background-status-strong-neutral)] data-disabled:opacity-50'\n )}\n />\n ))}\n </SliderPrimitive.Control>\n </SliderPrimitive.Root>\n );\n }\n);\nSlider.displayName = 'Slider';\n\nexport { Slider };\n"],"names":["Slider","React","className","defaultValue","value","props","ref","normalizedValue","normalizedDefaultValue","thumbCount","jsx","SliderPrimitive","cn","jsxs","_","i"],"mappings":";;;;AAkBA,MAAMA,IAASC,EAAM;AAAA,EACnB,CAAC,EAAE,WAAAC,GAAW,cAAAC,GAAc,OAAAC,GAAO,GAAGC,EAAA,GAASC,MAAQ;AACrD,UAAMC,IACJH,KAAS,OAAQ,MAAM,QAAQA,CAAK,IAAIA,IAAQ,CAACA,CAAK,IAAK,QACvDI,IACJL,KAAgB,OACZ,MAAM,QAAQA,CAAY,IACxBA,IACA,CAACA,CAAY,IACf,CAAC,CAAC,GACFM,KAAcF,KAAmBC,GAAwB;AAE/D,WACE,gBAAAE;AAAA,MAACC,EAAgB;AAAA,MAAhB;AAAA,QACC,KAAAL;AAAA,QACA,OAAOC;AAAA,QACP,cAAcC;AAAA,QACd,WAAWI;AAAA,UACT;AAAA,UACAV;AAAA,QAAA;AAAA,QAED,GAAGG;AAAA,QAEJ,UAAA,gBAAAQ,EAACF,EAAgB,SAAhB,EAAwB,WAAU,0CACjC,UAAA;AAAA,UAAA,gBAAAD,EAACC,EAAgB,OAAhB,EAAsB,WAAU,mGAC/B,UAAA,gBAAAD,EAACC,EAAgB,WAAhB,EAA0B,WAAU,+HAAA,CAA+H,EAAA,CACtK;AAAA,UACC,MAAM,KAAK,EAAE,QAAQF,KAAc,CAACK,GAAGC,MACtC,gBAAAL;AAAA,YAACC,EAAgB;AAAA,YAAhB;AAAA,cAEC,WAAWC;AAAA,gBACT;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,cAAA;AAAA,YACF;AAAA,YANKG;AAAA,UAAA,CAQR;AAAA,QAAA,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACAf,EAAO,cAAc;"}
|