@mieweb/ui 0.11.0-dev.2 → 0.11.0-dev.4
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/{chunk-7UTBDFFL.cjs → chunk-2S76TRBJ.cjs} +4 -4
- package/dist/{chunk-7UTBDFFL.cjs.map → chunk-2S76TRBJ.cjs.map} +1 -1
- package/dist/{chunk-PJ6CC53R.cjs → chunk-AKMTPCLC.cjs} +13 -8
- package/dist/chunk-AKMTPCLC.cjs.map +1 -0
- package/dist/{chunk-VVDE4CHU.js → chunk-C4GEPUE7.js} +13 -8
- package/dist/chunk-C4GEPUE7.js.map +1 -0
- package/dist/{chunk-NUB5HRKS.js → chunk-DT3X3RBM.js} +3 -3
- package/dist/{chunk-NUB5HRKS.js.map → chunk-DT3X3RBM.js.map} +1 -1
- package/dist/{chunk-MYAU2ZUC.cjs → chunk-GDKOYVX3.cjs} +14 -10
- package/dist/chunk-GDKOYVX3.cjs.map +1 -0
- package/dist/{chunk-S2JZL4JC.js → chunk-JM4YFLO4.js} +22 -15
- package/dist/chunk-JM4YFLO4.js.map +1 -0
- package/dist/{chunk-QX6AAVDE.cjs → chunk-L4APW65W.cjs} +15 -6
- package/dist/chunk-L4APW65W.cjs.map +1 -0
- package/dist/{chunk-RM2HPQIC.js → chunk-MQ5WJ3NO.js} +4 -4
- package/dist/chunk-MQ5WJ3NO.js.map +1 -0
- package/dist/{chunk-XRVMYT5G.cjs → chunk-QKW2QCGI.cjs} +5 -5
- package/dist/chunk-QKW2QCGI.cjs.map +1 -0
- package/dist/{chunk-O6XDA3SI.js → chunk-UY2EZYIC.js} +15 -6
- package/dist/chunk-UY2EZYIC.js.map +1 -0
- package/dist/{chunk-2BPIVWAK.js → chunk-V5VPECJI.js} +14 -10
- package/dist/chunk-V5VPECJI.js.map +1 -0
- package/dist/{chunk-O6BJMVGT.cjs → chunk-XZNHS7YQ.cjs} +24 -17
- package/dist/chunk-XZNHS7YQ.cjs.map +1 -0
- package/dist/components/AudioPlayer/index.cjs +7 -6
- package/dist/components/AudioPlayer/index.js +2 -1
- package/dist/components/CollabStatus/index.cjs +5 -4
- package/dist/components/CollabStatus/index.js +2 -1
- package/dist/components/MediaEditor/index.cjs +8 -7
- package/dist/components/MediaEditor/index.js +3 -2
- package/dist/components/Slider/index.cjs +6 -5
- package/dist/components/Slider/index.js +2 -1
- package/dist/components/SliderCalculator/index.cjs +5 -4
- package/dist/components/SliderCalculator/index.js +3 -2
- package/dist/components/SuperChat/index.cjs +11 -11
- package/dist/components/SuperChat/index.cjs.map +1 -1
- package/dist/components/SuperChat/index.js +3 -3
- package/dist/components/SuperChat/index.js.map +1 -1
- package/dist/index.cjs +139 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +94 -93
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2BPIVWAK.js.map +0 -1
- package/dist/chunk-MYAU2ZUC.cjs.map +0 -1
- package/dist/chunk-O6BJMVGT.cjs.map +0 -1
- package/dist/chunk-O6XDA3SI.js.map +0 -1
- package/dist/chunk-PJ6CC53R.cjs.map +0 -1
- package/dist/chunk-QX6AAVDE.cjs.map +0 -1
- package/dist/chunk-RM2HPQIC.js.map +0 -1
- package/dist/chunk-S2JZL4JC.js.map +0 -1
- package/dist/chunk-VVDE4CHU.js.map +0 -1
- package/dist/chunk-XRVMYT5G.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SliderCalculator/SliderCalculator.tsx"],"names":[],"mappings":";;;;;;;AA0FA,SAAS,aAAA,CACP,MAAA,EACA,MAAA,EACA,QAAA,EACuB;AACvB,EAAA,IAAI,OAAO,MAAA,KAAW,UAAA,EAAY,OAAO,MAAA;AACzC,EAAA,QAAQ,MAAA;AAAQ,IACd,KAAK,UAAA;AACH,MAAA,OAAO,CAAC,CAAA,KACN,CAAA,CAAE,cAAA,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RKS.js","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport { cn } from '../../utils/cn';\nimport { Slider } from '../Slider';\nimport { usePrefersReducedMotion } from '../../hooks/usePrefersReducedMotion';\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport type CalculatorFormat =\n | 'number'\n | 'currency'\n | 'compactCurrency'\n | 'percent'\n | 'hours'\n | ((value: number) => string);\n\nexport interface CalculatorInput {\n /** Key in the values object passed to `compute`. */\n id: string;\n label: string;\n min: number;\n max: number;\n step?: number;\n /** Starting value. */\n defaultValue: number;\n /** How the current value renders next to the label. Default `number`. */\n format?: CalculatorFormat;\n description?: string;\n}\n\nexport interface CalculatorBreakdown {\n label: string;\n value: number;\n}\n\nexport interface CalculatorMathRow {\n label: string;\n value: string;\n}\n\nexport interface CalculatorResult {\n /** The headline number. */\n total: number;\n /** One-line context under the headline, e.g. \"42% of today's spend · 1,200 hours returned\". */\n summary?: string;\n /** Horizontal bars showing what makes up `total`. */\n breakdown?: CalculatorBreakdown[];\n /** Rows revealed by \"Show the math\". */\n math?: CalculatorMathRow[];\n /** Free-text assumptions listed under the math. */\n assumptions?: string[];\n}\n\nexport interface SliderCalculatorProps {\n inputs: CalculatorInput[];\n /** Pure function from current values to a result. Runs on every change. */\n compute: (values: Record<string, number>) => CalculatorResult;\n /** Copy for the controls column. */\n eyebrow?: string;\n heading?: string;\n description?: string;\n headingLevel?: 'h2' | 'h3';\n /** Label above the headline number. Default \"Estimated annual value\". */\n resultLabel?: string;\n /** Format for the headline. Default `compactCurrency`. */\n resultFormat?: CalculatorFormat;\n /** Format for breakdown values. Default `currency`. */\n breakdownFormat?: CalculatorFormat;\n /** Actions under the result (Buttons, links). */\n actions?: React.ReactNode;\n /** Small print under the actions. */\n footnote?: string;\n /** Labels for the math toggle. */\n mathLabels?: { show?: string; hide?: string };\n /** Currency for the built-in formatters. Default `USD`. */\n currency?: string;\n locale?: string;\n /** Fires with the latest values and result on every change. */\n onChange?: (values: Record<string, number>, result: CalculatorResult) => void;\n className?: string;\n}\n\n// =============================================================================\n// Formatting\n// =============================================================================\n\nfunction makeFormatter(\n format: CalculatorFormat | undefined,\n locale: string,\n currency: string\n): (v: number) => string {\n if (typeof format === 'function') return format;\n switch (format) {\n case 'currency':\n return (v) =>\n v.toLocaleString(locale, {\n style: 'currency',\n currency,\n maximumFractionDigits: 0,\n });\n case 'compactCurrency':\n return (v) =>\n v.toLocaleString(locale, {\n style: 'currency',\n currency,\n notation: 'compact',\n maximumFractionDigits: v >= 1_000_000 ? 2 : 0,\n });\n case 'percent':\n return (v) => `${v.toLocaleString(locale)}%`;\n case 'hours':\n return (v) => `${v.toLocaleString(locale)} hr`;\n default:\n return (v) => v.toLocaleString(locale);\n }\n}\n\n// =============================================================================\n// AnimatedNumber\n// =============================================================================\n\nexport interface AnimatedNumberProps {\n value: number;\n format?: (v: number) => string;\n /** Tween length in ms. Default 480. */\n duration?: number;\n className?: string;\n}\n\n/** Tweens between numeric values with an ease-out; snaps under reduced motion. */\nexport function AnimatedNumber({\n value,\n format = (v) => v.toLocaleString(),\n duration = 480,\n className,\n}: AnimatedNumberProps) {\n const reduced = usePrefersReducedMotion();\n const [shown, setShown] = React.useState(value);\n const shownRef = React.useRef(value);\n\n React.useEffect(() => {\n if (reduced || typeof window === 'undefined') {\n shownRef.current = value;\n setShown(value);\n return;\n }\n const from = shownRef.current;\n const start = performance.now();\n let raf = 0;\n const tick = (t: number) => {\n const p = Math.min(1, (t - start) / duration);\n const eased = 1 - Math.pow(1 - p, 3);\n const v = from + (value - from) * eased;\n shownRef.current = v;\n setShown(v);\n if (p < 1) raf = requestAnimationFrame(tick);\n };\n raf = requestAnimationFrame(tick);\n return () => cancelAnimationFrame(raf);\n }, [value, duration, reduced]);\n\n return (\n <span className={cn('tabular-nums', className)} data-slot=\"animated-number\">\n {format(shown)}\n </span>\n );\n}\n\n// =============================================================================\n// SliderCalculator\n// =============================================================================\n\n/**\n * A two-column interactive calculator: labelled sliders on the left, a live\n * result panel on the right with an animated headline number, a one-line\n * summary, proportional breakdown bars, a \"Show the math\" disclosure and an\n * actions slot. Bring your own `compute` — the component owns only the\n * interaction. Ported from the Enterprise Health ROI calculator.\n *\n * @example\n * ```tsx\n * <SliderCalculator\n * heading=\"What is consolidation worth?\"\n * inputs={[\n * { id: 'people', label: 'People covered', min: 500, max: 60000, step: 500, defaultValue: 8000 },\n * { id: 'cost', label: 'Cost per exam', min: 20, max: 400, step: 5, defaultValue: 120, format: 'currency' },\n * ]}\n * compute={({ people, cost }) => ({ total: people * cost * 0.18 })}\n * actions={<Button effect=\"sheen\">Request a demo</Button>}\n * />\n * ```\n */\nexport function SliderCalculator({\n inputs,\n compute,\n eyebrow,\n heading,\n description,\n headingLevel: Heading = 'h2',\n resultLabel = 'Estimated annual value',\n resultFormat = 'compactCurrency',\n breakdownFormat = 'currency',\n actions,\n footnote,\n mathLabels,\n currency = 'USD',\n locale = 'en-US',\n onChange,\n className,\n}: SliderCalculatorProps) {\n const [values, setValues] = React.useState<Record<string, number>>(() =>\n Object.fromEntries(inputs.map((i) => [i.id, i.defaultValue]))\n );\n const [showMath, setShowMath] = React.useState(false);\n const id = React.useId();\n\n const result = React.useMemo(() => compute(values), [compute, values]);\n\n // Notify from an effect keyed on `values` only. `result` and `onChange` are\n // read through a ref: an inline `compute` or `onChange` prop gets a new\n // identity on every parent render, and depending on either would re-fire the\n // notification (and potentially loop) without any actual slider change.\n const skipInitialNotify = React.useRef(true);\n const notifyRef = React.useRef({ onChange, result });\n notifyRef.current = { onChange, result };\n React.useEffect(() => {\n if (skipInitialNotify.current) {\n skipInitialNotify.current = false;\n return;\n }\n notifyRef.current.onChange?.(values, notifyRef.current.result);\n }, [values]);\n\n const fmtResult = React.useMemo(\n () => makeFormatter(resultFormat, locale, currency),\n [resultFormat, locale, currency]\n );\n const fmtBreakdown = makeFormatter(breakdownFormat, locale, currency);\n\n // Announce only the settled total. The result container previously carried\n // aria-live while `AnimatedNumber` updated every animation frame, so screen\n // readers could queue or repeat intermediate values during a drag.\n const [announced, setAnnounced] = React.useState('');\n const skipInitialAnnounce = React.useRef(true);\n React.useEffect(() => {\n if (skipInitialAnnounce.current) {\n skipInitialAnnounce.current = false;\n return;\n }\n const t = window.setTimeout(\n () => setAnnounced(fmtResult(result.total)),\n 600\n );\n return () => window.clearTimeout(t);\n }, [result.total, fmtResult]);\n\n const labels = {\n show: 'Show the math',\n hide: 'Hide the math',\n ...mathLabels,\n };\n\n const set = (key: string, v: number) => {\n setValues((prev) => ({ ...prev, [key]: v }));\n };\n\n return (\n <div\n data-slot=\"slider-calculator\"\n className={cn(\n 'border-border bg-card text-card-foreground grid overflow-hidden rounded-2xl border shadow-md',\n 'lg:grid-cols-[1.1fr_1fr]',\n className\n )}\n >\n {/* Controls */}\n <div className=\"p-6 sm:p-8\">\n {eyebrow && (\n <p className=\"text-primary-800 dark:text-primary-300 mb-2 text-[11px] font-bold tracking-[0.14em] uppercase\">\n {eyebrow}\n </p>\n )}\n {heading && (\n <Heading className=\"text-foreground text-2xl leading-tight font-semibold sm:text-3xl\">\n {heading}\n </Heading>\n )}\n {description && (\n <p className=\"text-muted-foreground mt-3 text-sm\">{description}</p>\n )}\n\n <div className={cn('space-y-5', (heading || description) && 'mt-7')}>\n {inputs.map((input) => (\n <Slider\n key={input.id}\n id={`${id}-${input.id}`}\n label={input.label}\n description={input.description}\n min={input.min}\n max={input.max}\n step={input.step}\n value={values[input.id]}\n onValueChange={(v) => set(input.id, v)}\n showValue\n formatValue={makeFormatter(input.format, locale, currency)}\n />\n ))}\n </div>\n </div>\n\n {/* Result */}\n <div\n data-slot=\"slider-calculator-result\"\n className=\"bg-primary-950 flex flex-col gap-6 p-6 text-white [background:radial-gradient(120%_120%_at_100%_0%,var(--mieweb-primary-800),var(--mieweb-primary-950)_70%)] sm:p-8\"\n >\n <span aria-live=\"polite\" className=\"sr-only\">\n {announced ? `${resultLabel}: ${announced}` : ''}\n </span>\n <div>\n <p className=\"text-[11px] font-bold tracking-[0.14em] text-white/70 uppercase\">\n {resultLabel}\n </p>\n <p className=\"mt-2 text-5xl leading-none font-semibold tracking-tight sm:text-6xl\">\n <AnimatedNumber value={result.total} format={fmtResult} />\n </p>\n {result.summary && (\n <p className=\"mt-3 text-sm text-white/80\">{result.summary}</p>\n )}\n </div>\n\n {result.breakdown && result.breakdown.length > 0 && (\n <div className=\"space-y-3\">\n {result.breakdown.map((b) => {\n const pct =\n result.total > 0\n ? Math.max(2, Math.min(100, (b.value / result.total) * 100))\n : 0;\n return (\n <div key={b.label}>\n <div className=\"mb-1 flex items-baseline justify-between gap-3 text-sm\">\n <span className=\"text-white/80\">{b.label}</span>\n <b className=\"tabular-nums\">\n <AnimatedNumber\n value={Math.max(b.value, 0)}\n format={fmtBreakdown}\n />\n </b>\n </div>\n <div className=\"h-1.5 overflow-hidden rounded-full bg-white/15\">\n <span\n className=\"block h-full rounded-full transition-[width] duration-500 ease-out [background:linear-gradient(90deg,var(--mieweb-accent,var(--mieweb-primary-300)),var(--mieweb-primary-300))]\"\n style={{ width: `${pct}%` }}\n />\n </div>\n </div>\n );\n })}\n </div>\n )}\n\n {(result.math?.length || result.assumptions?.length) && (\n <div>\n <button\n type=\"button\"\n onClick={() => setShowMath((v) => !v)}\n aria-expanded={showMath}\n aria-controls={`${id}-math`}\n className=\"inline-flex items-center gap-1 text-sm font-semibold text-white/80 underline-offset-4 hover:text-white hover:underline\"\n >\n {showMath ? labels.hide : labels.show}\n {showMath ? (\n <ChevronUp size={14} aria-hidden />\n ) : (\n <ChevronDown size={14} aria-hidden />\n )}\n </button>\n {showMath && (\n <div\n id={`${id}-math`}\n className=\"mt-3 rounded-xl border border-white/15 bg-white/5 p-4 text-sm\"\n >\n {result.math?.map((row) => (\n <div\n key={row.label}\n className=\"flex justify-between gap-4 border-b border-white/10 py-1.5 last:border-0\"\n >\n <span className=\"text-white/75\">{row.label}</span>\n <b className=\"tabular-nums\">{row.value}</b>\n </div>\n ))}\n {result.assumptions && result.assumptions.length > 0 && (\n <ul className=\"mt-3 list-disc space-y-1 ps-5 text-xs text-white/70\">\n {result.assumptions.map((a) => (\n <li key={a}>{a}</li>\n ))}\n </ul>\n )}\n </div>\n )}\n </div>\n )}\n\n {actions && (\n <div className=\"mt-auto flex flex-wrap gap-3\">{actions}</div>\n )}\n {footnote && <p className=\"text-xs text-white/60\">{footnote}</p>}\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/SliderCalculator/SliderCalculator.tsx"],"names":[],"mappings":";;;;;;;AA0FA,SAAS,aAAA,CACP,MAAA,EACA,MAAA,EACA,QAAA,EACuB;AACvB,EAAA,IAAI,OAAO,MAAA,KAAW,UAAA,EAAY,OAAO,MAAA;AACzC,EAAA,QAAQ,MAAA;AAAQ,IACd,KAAK,UAAA;AACH,MAAA,OAAO,CAAC,CAAA,KACN,CAAA,CAAE,cAAA,CAAe,MAAA,EAAQ;AAAA,QACvB,KAAA,EAAO,UAAA;AAAA,QACP,QAAA;AAAA,QACA,qBAAA,EAAuB;AAAA,OACxB,CAAA;AAAA,IACL,KAAK,iBAAA;AACH,MAAA,OAAO,CAAC,CAAA,KACN,CAAA,CAAE,cAAA,CAAe,MAAA,EAAQ;AAAA,QACvB,KAAA,EAAO,UAAA;AAAA,QACP,QAAA;AAAA,QACA,QAAA,EAAU,SAAA;AAAA,QACV,qBAAA,EAAuB,CAAA,IAAK,GAAA,GAAY,CAAA,GAAI;AAAA,OAC7C,CAAA;AAAA,IACL,KAAK,SAAA;AACH,MAAA,OAAO,CAAC,CAAA,KAAM,CAAA,EAAG,CAAA,CAAE,cAAA,CAAe,MAAM,CAAC,CAAA,CAAA,CAAA;AAAA,IAC3C,KAAK,OAAA;AACH,MAAA,OAAO,CAAC,CAAA,KAAM,CAAA,EAAG,CAAA,CAAE,cAAA,CAAe,MAAM,CAAC,CAAA,GAAA,CAAA;AAAA,IAC3C;AACE,MAAA,OAAO,CAAC,CAAA,KAAM,C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AAA,uBAMZ,CAAA;AAAA,sBACA,MAAA,CAAO,eAAe,MAAA,CAAO,WAAA,CAAY,SAAS,CAAA,oBACjD,GAAA,CAAC,QAAG,SAAA,EAAU,qDAAA,EACX,iBAAO,WAAA,CAAY,GAAA,CAAI,CAAC,CAAA,qBACvB,GAAA,CAAC,QAAY,QAAA,EAAA,CAAA,EAAA,EAAJ,CAAM,CAChB,CAAA,EACH;AAAA;AAAA;AAAA;AAEJ,eAAA,EAEJ,CAAA;AAAA,cAGD,OAAA,oBACC,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,gCAAgC,QAAA,EAAA,OAAA,EAAQ,CAAA;AAAA,cAExD,QAAA,oBAAY,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,yBAAyB,QAAA,EAAA,QAAA,EAAS;AAAA;AAAA;AAAA;AAC9D;AAAA;AAAA,GACF;AAEJ","file":"chunk-DT3X3RBM.js","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport { cn } from '../../utils/cn';\nimport { Slider } from '../Slider';\nimport { usePrefersReducedMotion } from '../../hooks/usePrefersReducedMotion';\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport type CalculatorFormat =\n | 'number'\n | 'currency'\n | 'compactCurrency'\n | 'percent'\n | 'hours'\n | ((value: number) => string);\n\nexport interface CalculatorInput {\n /** Key in the values object passed to `compute`. */\n id: string;\n label: string;\n min: number;\n max: number;\n step?: number;\n /** Starting value. */\n defaultValue: number;\n /** How the current value renders next to the label. Default `number`. */\n format?: CalculatorFormat;\n description?: string;\n}\n\nexport interface CalculatorBreakdown {\n label: string;\n value: number;\n}\n\nexport interface CalculatorMathRow {\n label: string;\n value: string;\n}\n\nexport interface CalculatorResult {\n /** The headline number. */\n total: number;\n /** One-line context under the headline, e.g. \"42% of today's spend · 1,200 hours returned\". */\n summary?: string;\n /** Horizontal bars showing what makes up `total`. */\n breakdown?: CalculatorBreakdown[];\n /** Rows revealed by \"Show the math\". */\n math?: CalculatorMathRow[];\n /** Free-text assumptions listed under the math. */\n assumptions?: string[];\n}\n\nexport interface SliderCalculatorProps {\n inputs: CalculatorInput[];\n /** Pure function from current values to a result. Runs on every change. */\n compute: (values: Record<string, number>) => CalculatorResult;\n /** Copy for the controls column. */\n eyebrow?: string;\n heading?: string;\n description?: string;\n headingLevel?: 'h2' | 'h3';\n /** Label above the headline number. Default \"Estimated annual value\". */\n resultLabel?: string;\n /** Format for the headline. Default `compactCurrency`. */\n resultFormat?: CalculatorFormat;\n /** Format for breakdown values. Default `currency`. */\n breakdownFormat?: CalculatorFormat;\n /** Actions under the result (Buttons, links). */\n actions?: React.ReactNode;\n /** Small print under the actions. */\n footnote?: string;\n /** Labels for the math toggle. */\n mathLabels?: { show?: string; hide?: string };\n /** Currency for the built-in formatters. Default `USD`. */\n currency?: string;\n locale?: string;\n /** Fires with the latest values and result on every change. */\n onChange?: (values: Record<string, number>, result: CalculatorResult) => void;\n className?: string;\n}\n\n// =============================================================================\n// Formatting\n// =============================================================================\n\nfunction makeFormatter(\n format: CalculatorFormat | undefined,\n locale: string,\n currency: string\n): (v: number) => string {\n if (typeof format === 'function') return format;\n switch (format) {\n case 'currency':\n return (v) =>\n v.toLocaleString(locale, {\n style: 'currency',\n currency,\n maximumFractionDigits: 0,\n });\n case 'compactCurrency':\n return (v) =>\n v.toLocaleString(locale, {\n style: 'currency',\n currency,\n notation: 'compact',\n maximumFractionDigits: v >= 1_000_000 ? 2 : 0,\n });\n case 'percent':\n return (v) => `${v.toLocaleString(locale)}%`;\n case 'hours':\n return (v) => `${v.toLocaleString(locale)} hr`;\n default:\n return (v) => v.toLocaleString(locale);\n }\n}\n\n// =============================================================================\n// AnimatedNumber\n// =============================================================================\n\nexport interface AnimatedNumberProps {\n value: number;\n format?: (v: number) => string;\n /** Tween length in ms. Default 480. */\n duration?: number;\n className?: string;\n}\n\n/** Tweens between numeric values with an ease-out; snaps under reduced motion. */\nexport function AnimatedNumber({\n value,\n format = (v) => v.toLocaleString(),\n duration = 480,\n className,\n}: AnimatedNumberProps) {\n const reduced = usePrefersReducedMotion();\n const [shown, setShown] = React.useState(value);\n const shownRef = React.useRef(value);\n\n React.useEffect(() => {\n if (reduced || typeof window === 'undefined') {\n shownRef.current = value;\n setShown(value);\n return;\n }\n const from = shownRef.current;\n const start = performance.now();\n let raf = 0;\n const tick = (t: number) => {\n const p = Math.min(1, (t - start) / duration);\n const eased = 1 - Math.pow(1 - p, 3);\n const v = from + (value - from) * eased;\n shownRef.current = v;\n setShown(v);\n if (p < 1) raf = requestAnimationFrame(tick);\n };\n raf = requestAnimationFrame(tick);\n return () => cancelAnimationFrame(raf);\n }, [value, duration, reduced]);\n\n return (\n <span className={cn('tabular-nums', className)} data-slot=\"animated-number\">\n {format(shown)}\n </span>\n );\n}\n\n// =============================================================================\n// SliderCalculator\n// =============================================================================\n\n/**\n * A two-column interactive calculator: labelled sliders on the left, a live\n * result panel on the right with an animated headline number, a one-line\n * summary, proportional breakdown bars, a \"Show the math\" disclosure and an\n * actions slot. Bring your own `compute` — the component owns only the\n * interaction. Ported from the Enterprise Health ROI calculator.\n *\n * @example\n * ```tsx\n * <SliderCalculator\n * heading=\"What is consolidation worth?\"\n * inputs={[\n * { id: 'people', label: 'People covered', min: 500, max: 60000, step: 500, defaultValue: 8000 },\n * { id: 'cost', label: 'Cost per exam', min: 20, max: 400, step: 5, defaultValue: 120, format: 'currency' },\n * ]}\n * compute={({ people, cost }) => ({ total: people * cost * 0.18 })}\n * actions={<Button effect=\"sheen\">Request a demo</Button>}\n * />\n * ```\n */\nexport function SliderCalculator({\n inputs,\n compute,\n eyebrow,\n heading,\n description,\n headingLevel: Heading = 'h2',\n resultLabel = 'Estimated annual value',\n resultFormat = 'compactCurrency',\n breakdownFormat = 'currency',\n actions,\n footnote,\n mathLabels,\n currency = 'USD',\n locale = 'en-US',\n onChange,\n className,\n}: SliderCalculatorProps) {\n const [values, setValues] = React.useState<Record<string, number>>(() =>\n Object.fromEntries(inputs.map((i) => [i.id, i.defaultValue]))\n );\n const [showMath, setShowMath] = React.useState(false);\n const id = React.useId();\n\n const result = React.useMemo(() => compute(values), [compute, values]);\n\n // Notify from an effect keyed on `values` only. `result` and `onChange` are\n // read through a ref: an inline `compute` or `onChange` prop gets a new\n // identity on every parent render, and depending on either would re-fire the\n // notification (and potentially loop) without any actual slider change.\n const skipInitialNotify = React.useRef(true);\n const notifyRef = React.useRef({ onChange, result });\n notifyRef.current = { onChange, result };\n React.useEffect(() => {\n if (skipInitialNotify.current) {\n skipInitialNotify.current = false;\n return;\n }\n notifyRef.current.onChange?.(values, notifyRef.current.result);\n }, [values]);\n\n const fmtResult = React.useMemo(\n () => makeFormatter(resultFormat, locale, currency),\n [resultFormat, locale, currency]\n );\n const fmtBreakdown = makeFormatter(breakdownFormat, locale, currency);\n\n // Announce only the settled total. The result container previously carried\n // aria-live while `AnimatedNumber` updated every animation frame, so screen\n // readers could queue or repeat intermediate values during a drag.\n const [announced, setAnnounced] = React.useState('');\n const skipInitialAnnounce = React.useRef(true);\n React.useEffect(() => {\n if (skipInitialAnnounce.current) {\n skipInitialAnnounce.current = false;\n return;\n }\n const t = window.setTimeout(\n () => setAnnounced(fmtResult(result.total)),\n 600\n );\n return () => window.clearTimeout(t);\n }, [result.total, fmtResult]);\n\n const labels = {\n show: 'Show the math',\n hide: 'Hide the math',\n ...mathLabels,\n };\n\n const set = (key: string, v: number) => {\n setValues((prev) => ({ ...prev, [key]: v }));\n };\n\n return (\n <div\n data-slot=\"slider-calculator\"\n className={cn(\n 'border-border bg-card text-card-foreground grid overflow-hidden rounded-2xl border shadow-md',\n 'lg:grid-cols-[1.1fr_1fr]',\n className\n )}\n >\n {/* Controls */}\n <div className=\"p-6 sm:p-8\">\n {eyebrow && (\n <p className=\"text-primary-800 dark:text-primary-300 mb-2 text-[11px] font-bold tracking-[0.14em] uppercase\">\n {eyebrow}\n </p>\n )}\n {heading && (\n <Heading className=\"text-foreground text-2xl leading-tight font-semibold sm:text-3xl\">\n {heading}\n </Heading>\n )}\n {description && (\n <p className=\"text-muted-foreground mt-3 text-sm\">{description}</p>\n )}\n\n <div className={cn('space-y-5', (heading || description) && 'mt-7')}>\n {inputs.map((input) => (\n <Slider\n key={input.id}\n id={`${id}-${input.id}`}\n label={input.label}\n description={input.description}\n min={input.min}\n max={input.max}\n step={input.step}\n value={values[input.id]}\n onValueChange={(v) => set(input.id, v)}\n showValue\n formatValue={makeFormatter(input.format, locale, currency)}\n />\n ))}\n </div>\n </div>\n\n {/* Result */}\n <div\n data-slot=\"slider-calculator-result\"\n className=\"bg-primary-950 flex flex-col gap-6 p-6 text-white [background:radial-gradient(120%_120%_at_100%_0%,var(--mieweb-primary-800),var(--mieweb-primary-950)_70%)] sm:p-8\"\n >\n <span aria-live=\"polite\" className=\"sr-only\">\n {announced ? `${resultLabel}: ${announced}` : ''}\n </span>\n <div>\n <p className=\"text-[11px] font-bold tracking-[0.14em] text-white/70 uppercase\">\n {resultLabel}\n </p>\n <p className=\"mt-2 text-5xl leading-none font-semibold tracking-tight sm:text-6xl\">\n <AnimatedNumber value={result.total} format={fmtResult} />\n </p>\n {result.summary && (\n <p className=\"mt-3 text-sm text-white/80\">{result.summary}</p>\n )}\n </div>\n\n {result.breakdown && result.breakdown.length > 0 && (\n <div className=\"space-y-3\">\n {result.breakdown.map((b) => {\n const pct =\n result.total > 0\n ? Math.max(2, Math.min(100, (b.value / result.total) * 100))\n : 0;\n return (\n <div key={b.label}>\n <div className=\"mb-1 flex items-baseline justify-between gap-3 text-sm\">\n <span className=\"text-white/80\">{b.label}</span>\n <b className=\"tabular-nums\">\n <AnimatedNumber\n value={Math.max(b.value, 0)}\n format={fmtBreakdown}\n />\n </b>\n </div>\n <div className=\"h-1.5 overflow-hidden rounded-full bg-white/15\">\n <span\n className=\"block h-full rounded-full transition-[width] duration-500 ease-out [background:linear-gradient(90deg,var(--mieweb-accent,var(--mieweb-primary-300)),var(--mieweb-primary-300))]\"\n style={{ width: `${pct}%` }}\n />\n </div>\n </div>\n );\n })}\n </div>\n )}\n\n {(result.math?.length || result.assumptions?.length) && (\n <div>\n <button\n type=\"button\"\n onClick={() => setShowMath((v) => !v)}\n aria-expanded={showMath}\n aria-controls={`${id}-math`}\n className=\"inline-flex items-center gap-1 text-sm font-semibold text-white/80 underline-offset-4 hover:text-white hover:underline\"\n >\n {showMath ? labels.hide : labels.show}\n {showMath ? (\n <ChevronUp size={14} aria-hidden />\n ) : (\n <ChevronDown size={14} aria-hidden />\n )}\n </button>\n {showMath && (\n <div\n id={`${id}-math`}\n className=\"mt-3 rounded-xl border border-white/15 bg-white/5 p-4 text-sm\"\n >\n {result.math?.map((row) => (\n <div\n key={row.label}\n className=\"flex justify-between gap-4 border-b border-white/10 py-1.5 last:border-0\"\n >\n <span className=\"text-white/75\">{row.label}</span>\n <b className=\"tabular-nums\">{row.value}</b>\n </div>\n ))}\n {result.assumptions && result.assumptions.length > 0 && (\n <ul className=\"mt-3 list-disc space-y-1 ps-5 text-xs text-white/70\">\n {result.assumptions.map((a) => (\n <li key={a}>{a}</li>\n ))}\n </ul>\n )}\n </div>\n )}\n </div>\n )}\n\n {actions && (\n <div className=\"mt-auto flex flex-wrap gap-3\">{actions}</div>\n )}\n {footnote && <p className=\"text-xs text-white/60\">{footnote}</p>}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkZ3WMDVMR_cjs = require('./chunk-Z3WMDVMR.cjs');
|
|
3
4
|
var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var classVarianceAuthority = require('class-variance-authority');
|
|
@@ -46,7 +47,7 @@ var sliderTrackVariants = classVarianceAuthority.cva(
|
|
|
46
47
|
}
|
|
47
48
|
);
|
|
48
49
|
var sliderRangeVariants = classVarianceAuthority.cva(
|
|
49
|
-
["absolute h-full rounded-full transition-all duration-75 ease-out"],
|
|
50
|
+
["absolute start-0 h-full rounded-full transition-all duration-75 ease-out"],
|
|
50
51
|
{
|
|
51
52
|
variants: {
|
|
52
53
|
variant: {
|
|
@@ -64,7 +65,7 @@ var sliderRangeVariants = classVarianceAuthority.cva(
|
|
|
64
65
|
);
|
|
65
66
|
var sliderThumbVariants = classVarianceAuthority.cva(
|
|
66
67
|
[
|
|
67
|
-
"absolute top-1/2 -translate-y-1/2 -translate-x-1/2",
|
|
68
|
+
"absolute top-1/2 -translate-y-1/2 -translate-x-1/2 rtl:translate-x-1/2",
|
|
68
69
|
"rounded-full border-2 bg-white",
|
|
69
70
|
"shadow-md transition-shadow duration-150",
|
|
70
71
|
"cursor-grab active:cursor-grabbing",
|
|
@@ -141,10 +142,8 @@ var Slider = React__namespace.forwardRef(
|
|
|
141
142
|
const track = trackRef.current;
|
|
142
143
|
if (!track) return clampedValue;
|
|
143
144
|
const rect = track.getBoundingClientRect();
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
1
|
|
147
|
-
);
|
|
145
|
+
const offset = chunkZ3WMDVMR_cjs.isRtl(track) ? rect.right - clientX : clientX - rect.left;
|
|
146
|
+
const ratio = Math.min(Math.max(offset / rect.width, 0), 1);
|
|
148
147
|
const raw = min + ratio * (max - min);
|
|
149
148
|
const stepped = min + Math.round((raw - min) / safeStep) * safeStep;
|
|
150
149
|
return Math.min(Math.max(stepped, min), max);
|
|
@@ -202,13 +201,18 @@ var Slider = React__namespace.forwardRef(
|
|
|
202
201
|
const handleKeyDown = React__namespace.useCallback(
|
|
203
202
|
(e) => {
|
|
204
203
|
if (disabled) return;
|
|
204
|
+
const rtl = chunkZ3WMDVMR_cjs.isRtl(e.currentTarget);
|
|
205
205
|
let newValue = null;
|
|
206
206
|
switch (e.key) {
|
|
207
207
|
case "ArrowRight":
|
|
208
|
+
case "ArrowLeft": {
|
|
209
|
+
const increase = e.key === "ArrowRight" !== rtl;
|
|
210
|
+
newValue = increase ? Math.min(clampedValue + safeStep, max) : Math.max(clampedValue - safeStep, min);
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
208
213
|
case "ArrowUp":
|
|
209
214
|
newValue = Math.min(clampedValue + safeStep, max);
|
|
210
215
|
break;
|
|
211
|
-
case "ArrowLeft":
|
|
212
216
|
case "ArrowDown":
|
|
213
217
|
newValue = Math.max(clampedValue - safeStep, min);
|
|
214
218
|
break;
|
|
@@ -330,7 +334,7 @@ var Slider = React__namespace.forwardRef(
|
|
|
330
334
|
{
|
|
331
335
|
"data-slot": "slider-thumb",
|
|
332
336
|
className: sliderThumbVariants({ size, variant }),
|
|
333
|
-
style: {
|
|
337
|
+
style: { insetInlineStart: `${percentage}%` },
|
|
334
338
|
"aria-hidden": "true"
|
|
335
339
|
}
|
|
336
340
|
)
|
|
@@ -380,5 +384,5 @@ exports.Slider = Slider;
|
|
|
380
384
|
exports.sliderRangeVariants = sliderRangeVariants;
|
|
381
385
|
exports.sliderThumbVariants = sliderThumbVariants;
|
|
382
386
|
exports.sliderTrackVariants = sliderTrackVariants;
|
|
383
|
-
//# sourceMappingURL=chunk-
|
|
384
|
-
//# sourceMappingURL=chunk-
|
|
387
|
+
//# sourceMappingURL=chunk-GDKOYVX3.cjs.map
|
|
388
|
+
//# sourceMappingURL=chunk-GDKOYVX3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Slider/Slider.tsx"],"names":["cva","React","isRtl","jsxs","cn","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAM,mBAAA,GAAsBA,0BAAA;AAAA,EAC1B;AAAA,IACE,8CAAA;AAAA,IACA,oCAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,KAAA;AAAA,QACJ,EAAA,EAAI,KAAA;AAAA,QACJ,EAAA,EAAI;AAAA;A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;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,WAAA,EAAU,eAAA;AAAA,cACV,SAAA,EAAWC,oBAAA;AAAA,gBACT,yDAAA;AAAA,gBACA,QAAA,IAAY;AAAA,eACd;AAAA,cAEA,QAAA,EAAA;AAAA,gCAAAC,cAAA,CAAC,UAAM,QAAA,EAAA,QAAA,EAAS,CAAA;AAAA,gCAChBA,cAAA,CAAC,UAAM,QAAA,EAAA,QAAA,EAAS;AAAA;AAAA;AAAA;AAClB;AAAA;AAAA,KAEJ;AAAA,EAEJ;AACF;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"chunk-GDKOYVX3.cjs","sourcesContent":["import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { isRtl } from '../../hooks/useDirection';\n\n// ============================================================================\n// Slider Variants\n// ============================================================================\n\nconst sliderTrackVariants = cva(\n [\n 'relative w-full overflow-hidden rounded-full',\n 'bg-neutral-200 dark:bg-neutral-700',\n 'cursor-pointer',\n 'group-data-[disabled=true]:cursor-not-allowed group-data-[disabled=true]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: 'h-1',\n md: 'h-2',\n lg: 'h-3',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n\nconst sliderRangeVariants = cva(\n ['absolute start-0 h-full rounded-full transition-all duration-75 ease-out'],\n {\n variants: {\n variant: {\n default: 'bg-primary-800',\n success: 'bg-green-500',\n warning: 'bg-yellow-500',\n danger: 'bg-red-500',\n neutral: 'bg-neutral-500',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n\nconst sliderThumbVariants = cva(\n [\n 'absolute top-1/2 -translate-y-1/2 -translate-x-1/2 rtl:translate-x-1/2',\n 'rounded-full border-2 bg-white',\n 'shadow-md transition-shadow duration-150',\n 'cursor-grab active:cursor-grabbing',\n 'hover:shadow-lg',\n 'active:shadow-xl active:scale-110',\n 'group-focus-visible:outline-none group-focus-visible:ring-2 group-focus-visible:ring-ring group-focus-visible:ring-offset-2',\n 'group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50',\n ],\n {\n variants: {\n size: {\n sm: 'h-3.5 w-3.5',\n md: 'h-5 w-5',\n lg: 'h-6 w-6',\n },\n variant: {\n default: 'border-primary-500',\n success: 'border-green-500',\n warning: 'border-yellow-500',\n danger: 'border-red-500',\n neutral: 'border-neutral-500',\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'default',\n },\n }\n);\n\n// ============================================================================\n// Slider Component\n// ============================================================================\n\nexport interface SliderProps\n extends\n VariantProps<typeof sliderTrackVariants>,\n VariantProps<typeof sliderRangeVariants> {\n /** Current value (controlled) */\n value?: number;\n /** Default value (uncontrolled) */\n defaultValue?: number;\n /** Minimum value */\n min?: number;\n /** Maximum value */\n max?: number;\n /** Step increment */\n step?: number;\n /** Callback when value changes */\n onValueChange?: (value: number) => void;\n /** Callback when interaction ends (mouseup / touchend) */\n onValueCommit?: (value: number) => void;\n /** Whether the slider is disabled */\n disabled?: boolean;\n /** Label for the slider */\n label?: string;\n /** Show the current value */\n showValue?: boolean;\n /** Format the displayed value */\n formatValue?: (value: number) => string;\n /** Description text below the label */\n description?: string;\n /** Min label displayed below the track (left) */\n minLabel?: string;\n /** Max label displayed below the track (right) */\n maxLabel?: string;\n /** Additional class name for the root container */\n className?: string;\n /** Additional class name for the track */\n trackClassName?: string;\n /** ID for the underlying input */\n id?: string;\n /** Name for form submission */\n name?: string;\n /** Accessible label for the slider */\n 'aria-label'?: string;\n /** ID of the element that labels the slider */\n 'aria-labelledby'?: string;\n}\n\n/**\n * A fully branded, accessible slider/range input component.\n *\n * Uses brand design tokens for colors, border-radius, and sizing.\n * Supports controlled and uncontrolled usage, labels, descriptions,\n * min/max labels, value display, and multiple color variants.\n *\n * @example\n * ```tsx\n * <Slider label=\"Volume\" min={0} max={100} defaultValue={50} />\n * <Slider\n * label=\"Border Radius\"\n * min={0}\n * max={32}\n * value={radius}\n * onValueChange={setRadius}\n * showValue\n * formatValue={(v) => `${v}px`}\n * minLabel=\"Square\"\n * maxLabel=\"Rounded\"\n * />\n * ```\n */\nconst Slider = React.forwardRef<HTMLInputElement, SliderProps>(\n (\n {\n value: controlledValue,\n defaultValue = 0,\n min = 0,\n max = 100,\n step = 1,\n onValueChange,\n onValueCommit,\n disabled = false,\n label,\n showValue = false,\n formatValue,\n description,\n minLabel,\n maxLabel,\n variant,\n size,\n className,\n trackClassName,\n id,\n name,\n 'aria-label': ariaLabelProp,\n 'aria-labelledby': ariaLabelledByProp,\n },\n ref\n ) => {\n const hasExplicitLabel = !!label;\n const labelId = React.useId();\n const descriptionId = React.useId();\n const ariaLabelledBy =\n ariaLabelledByProp ?? (hasExplicitLabel ? labelId : undefined);\n const ariaDescribedBy = description ? descriptionId : undefined;\n const ariaLabel =\n ariaLabelProp ??\n (!hasExplicitLabel && !ariaLabelledByProp ? 'Slider' : undefined);\n const [uncontrolledValue, setUncontrolledValue] =\n React.useState(defaultValue);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : uncontrolledValue;\n\n // Clamp value to min/max\n const clampedValue = Math.min(Math.max(currentValue, min), max);\n\n // Percentage for visual fill\n const percentage =\n max !== min ? ((clampedValue - min) / (max - min)) * 100 : 0;\n\n const generatedId = React.useId();\n const inputId = id ?? generatedId;\n\n const trackRef = React.useRef<HTMLDivElement>(null);\n const latestValueRef = React.useRef(clampedValue);\n latestValueRef.current = clampedValue;\n\n const safeStep = step > 0 ? step : 1;\n\n const computeValueFromPointer = React.useCallback(\n (clientX: number) => {\n const track = trackRef.current;\n if (!track) return clampedValue;\n const rect = track.getBoundingClientRect();\n // Value grows toward the inline-end edge: left→right in LTR,\n // right→left in RTL.\n const offset = isRtl(track)\n ? rect.right - clientX\n : clientX - rect.left;\n const ratio = Math.min(Math.max(offset / rect.width, 0), 1);\n const raw = min + ratio * (max - min);\n // Snap to step relative to min\n const stepped = min + Math.round((raw - min) / safeStep) * safeStep;\n return Math.min(Math.max(stepped, min), max);\n },\n [min, max, safeStep, clampedValue]\n );\n\n const setValue = React.useCallback(\n (newValue: number) => {\n latestValueRef.current = newValue;\n if (!isControlled) {\n setUncontrolledValue(newValue);\n }\n onValueChange?.(newValue);\n },\n [isControlled, onValueChange]\n );\n\n const handlePointerDown = React.useCallback(\n (e: React.PointerEvent) => {\n if (disabled) return;\n e.preventDefault();\n (e.currentTarget as HTMLElement).focus();\n (e.target as HTMLElement).setPointerCapture(e.pointerId);\n const newValue = computeValueFromPointer(e.clientX);\n setValue(newValue);\n },\n [disabled, computeValueFromPointer, setValue]\n );\n\n const handlePointerMove = React.useCallback(\n (e: React.PointerEvent) => {\n if (disabled) return;\n if (!(e.target as HTMLElement).hasPointerCapture(e.pointerId)) return;\n const newValue = computeValueFromPointer(e.clientX);\n setValue(newValue);\n },\n [disabled, computeValueFromPointer, setValue]\n );\n\n const handlePointerUp = React.useCallback(\n (e: React.PointerEvent) => {\n if (disabled) return;\n (e.target as HTMLElement).releasePointerCapture(e.pointerId);\n onValueCommit?.(latestValueRef.current);\n },\n [disabled, onValueCommit]\n );\n\n const handleLostPointerCapture = React.useCallback(() => {\n onValueCommit?.(latestValueRef.current);\n }, [onValueCommit]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = parseFloat(e.target.value);\n if (!isControlled) {\n setUncontrolledValue(newValue);\n }\n onValueChange?.(newValue);\n };\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n // Horizontal arrows follow the visual direction: in RTL the slider\n // fills right→left, so ArrowLeft increases and ArrowRight decreases.\n const rtl = isRtl(e.currentTarget);\n let newValue: number | null = null;\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowLeft': {\n const increase = (e.key === 'ArrowRight') !== rtl;\n newValue = increase\n ? Math.min(clampedValue + safeStep, max)\n : Math.max(clampedValue - safeStep, min);\n break;\n }\n case 'ArrowUp':\n newValue = Math.min(clampedValue + safeStep, max);\n break;\n case 'ArrowDown':\n newValue = Math.max(clampedValue - safeStep, min);\n break;\n case 'Home':\n newValue = min;\n break;\n case 'End':\n newValue = max;\n break;\n default:\n return;\n }\n e.preventDefault();\n setValue(newValue);\n onValueCommit?.(newValue);\n },\n [disabled, clampedValue, safeStep, min, max, setValue, onValueCommit]\n );\n\n const displayValue = formatValue\n ? formatValue(clampedValue)\n : String(clampedValue);\n\n return (\n <div\n data-slot=\"slider\"\n className={cn('relative w-full', className)}\n data-disabled={disabled || undefined}\n >\n {/* Label row */}\n {(label || showValue) && (\n <div\n data-slot=\"slider-label-row\"\n className=\"mb-1.5 flex items-baseline justify-between\"\n >\n {label && (\n <label\n id={labelId}\n htmlFor={inputId}\n data-slot=\"slider-label\"\n className={cn(\n 'text-foreground text-sm font-medium',\n disabled && 'opacity-50'\n )}\n >\n {label}\n {showValue && (\n <span\n data-slot=\"slider-value\"\n className=\"text-muted-foreground ms-1\"\n >\n {displayValue}\n </span>\n )}\n </label>\n )}\n {!label && showValue && (\n <span\n data-slot=\"slider-value\"\n className=\"text-muted-foreground text-sm\"\n >\n {displayValue}\n </span>\n )}\n </div>\n )}\n\n {/* Description */}\n {description && (\n <p\n id={descriptionId}\n data-slot=\"slider-description\"\n className={cn(\n 'text-muted-foreground mb-2 text-xs',\n disabled && 'opacity-50'\n )}\n >\n {description}\n </p>\n )}\n\n {/* Track + Thumb */}\n <div\n ref={trackRef}\n data-slot=\"slider-track-wrapper\"\n className=\"group focus-visible:ring-ring relative rounded py-2 outline-none focus-visible:ring-2 focus-visible:ring-offset-2\"\n style={{ touchAction: disabled ? 'auto' : 'none' }}\n role=\"slider\"\n tabIndex={disabled ? -1 : 0}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={clampedValue}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-disabled={disabled || undefined}\n data-disabled={disabled || undefined}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={handlePointerUp}\n onLostPointerCapture={handleLostPointerCapture}\n onKeyDown={handleKeyDown}\n >\n {/* Visual track background */}\n <div\n data-slot=\"slider-track\"\n className={cn(sliderTrackVariants({ size }), trackClassName)}\n >\n {/* Filled range */}\n <div\n data-slot=\"slider-range\"\n className={sliderRangeVariants({ variant })}\n style={{ width: `${percentage}%` }}\n />\n </div>\n\n {/* Thumb indicator */}\n <div\n data-slot=\"slider-thumb\"\n className={sliderThumbVariants({ size, variant })}\n style={{ insetInlineStart: `${percentage}%` }}\n aria-hidden=\"true\"\n />\n </div>\n\n {/* Native range input — for form submission only, rendered outside role=\"slider\" to avoid nested-interactive */}\n <input\n ref={ref}\n type=\"range\"\n className=\"pointer-events-none absolute inset-0 h-full w-full opacity-0\"\n tabIndex={-1}\n aria-hidden=\"true\"\n id={inputId}\n name={name}\n min={min}\n max={max}\n step={step}\n value={clampedValue}\n onChange={handleChange}\n disabled={disabled}\n />\n\n {/* Min / Max labels */}\n {(minLabel || maxLabel) && (\n <div\n data-slot=\"slider-minmax\"\n className={cn(\n 'text-muted-foreground mt-1 flex justify-between text-xs',\n disabled && 'opacity-50'\n )}\n >\n <span>{minLabel}</span>\n <span>{maxLabel}</span>\n </div>\n )}\n </div>\n );\n }\n);\n\nSlider.displayName = 'Slider';\n\nexport {\n Slider,\n sliderTrackVariants,\n sliderRangeVariants,\n sliderThumbVariants,\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Slider } from './chunk-
|
|
1
|
+
import { Slider } from './chunk-V5VPECJI.js';
|
|
2
2
|
import { MediaPlayer } from './chunk-N54FYWG6.js';
|
|
3
3
|
import { Checkbox } from './chunk-753Z3NXL.js';
|
|
4
4
|
import { useTranscriptEdits, DEFAULT_FILLER_WORDS } from './chunk-UUI7WXI5.js';
|
|
@@ -6,6 +6,7 @@ import { isSilenceType, PLAYBACK_SPEEDS } from './chunk-6CGM5H4J.js';
|
|
|
6
6
|
import { Select } from './chunk-VCI2Y7ST.js';
|
|
7
7
|
import { Modal, ModalHeader, ModalTitle, ModalClose, ModalBody, ModalFooter } from './chunk-TWQSMUE6.js';
|
|
8
8
|
import { Input } from './chunk-3IMM2PM4.js';
|
|
9
|
+
import { isRtl } from './chunk-YVKBXNPK.js';
|
|
9
10
|
import { Button } from './chunk-WFBUBT54.js';
|
|
10
11
|
import * as React6 from 'react';
|
|
11
12
|
import { cva } from 'class-variance-authority';
|
|
@@ -556,7 +557,11 @@ var SpeedMarkerMenu = ({
|
|
|
556
557
|
{
|
|
557
558
|
ref: menuRef,
|
|
558
559
|
className: "border-border bg-card text-card-foreground fixed z-50 min-w-36 overflow-hidden rounded-lg border shadow-lg",
|
|
559
|
-
style: {
|
|
560
|
+
style: {
|
|
561
|
+
// rtl-ignore -- fixed viewport coordinate from the pointer event
|
|
562
|
+
left: position.x,
|
|
563
|
+
top: position.y
|
|
564
|
+
},
|
|
560
565
|
role: "menu",
|
|
561
566
|
"aria-label": "Set speed marker",
|
|
562
567
|
children: [
|
|
@@ -1475,18 +1480,20 @@ var MediaEditor = React6.forwardRef(
|
|
|
1475
1480
|
if (canRedoWords) redo();
|
|
1476
1481
|
else if (canRedo && onRedo) onRedo();
|
|
1477
1482
|
handled = true;
|
|
1478
|
-
} else if (e.key === "ArrowLeft") {
|
|
1479
|
-
|
|
1480
|
-
|
|
1483
|
+
} else if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
1484
|
+
const forward = e.key === "ArrowRight" !== isRtl(e.currentTarget);
|
|
1485
|
+
if (forward) {
|
|
1486
|
+
if (cursorIndex === wordCount - 1 && cursorPosition === "before") {
|
|
1487
|
+
setCursorPosition("after");
|
|
1488
|
+
} else if (cursorPosition !== "after") {
|
|
1489
|
+
newIndex = Math.min(wordCount - 1, cursorIndex + 1);
|
|
1490
|
+
}
|
|
1481
1491
|
} else {
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
setCursorPosition("after");
|
|
1488
|
-
} else if (cursorPosition !== "after") {
|
|
1489
|
-
newIndex = Math.min(wordCount - 1, cursorIndex + 1);
|
|
1492
|
+
if (cursorPosition === "after") {
|
|
1493
|
+
setCursorPosition("before");
|
|
1494
|
+
} else {
|
|
1495
|
+
newIndex = Math.max(0, cursorIndex - 1);
|
|
1496
|
+
}
|
|
1490
1497
|
}
|
|
1491
1498
|
handled = true;
|
|
1492
1499
|
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
@@ -1999,5 +2006,5 @@ var MediaEditor = React6.forwardRef(
|
|
|
1999
2006
|
MediaEditor.displayName = "MediaEditor";
|
|
2000
2007
|
|
|
2001
2008
|
export { FillerWordsModal, MediaEditor, SilenceSettingsModal, SpeedMarkerMenu, WordEditorModal };
|
|
2002
|
-
//# sourceMappingURL=chunk-
|
|
2003
|
-
//# sourceMappingURL=chunk-
|
|
2009
|
+
//# sourceMappingURL=chunk-JM4YFLO4.js.map
|
|
2010
|
+
//# sourceMappingURL=chunk-JM4YFLO4.js.map
|