@spark-ui/components 17.0.1 → 17.1.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.
@@ -0,0 +1,22 @@
1
+ import { ToggleGroup } from '@base-ui/react/toggle-group';
2
+ import { ComponentProps, Ref } from 'react';
3
+ import { SegmentedControlStylesProps } from './SegmentedControl.styles';
4
+ export interface SegmentedControlProps extends Omit<ComponentProps<typeof ToggleGroup>, 'multiple' | 'value' | 'defaultValue' | 'onValueChange'>, SegmentedControlStylesProps {
5
+ /**
6
+ * The controlled selected value.
7
+ */
8
+ value?: string;
9
+ /**
10
+ * The uncontrolled default selected value.
11
+ */
12
+ defaultValue?: string;
13
+ /**
14
+ * Callback fired when the selected value changes.
15
+ */
16
+ onValueChange?: (value: string | null) => void;
17
+ ref?: Ref<HTMLDivElement>;
18
+ }
19
+ export declare const SegmentedControl: {
20
+ ({ value, defaultValue, onValueChange, size, className, children, ref, ...rest }: SegmentedControlProps): import("react/jsx-runtime").JSX.Element;
21
+ displayName: string;
22
+ };
@@ -0,0 +1,7 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ export declare const rootStyles: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
3
+ export declare const itemStyles: (props?: ({
4
+ size?: "sm" | "md" | "lg" | null | undefined;
5
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
+ export declare const indicatorStyles: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
7
+ export type SegmentedControlStylesProps = VariantProps<typeof itemStyles>;
@@ -0,0 +1,8 @@
1
+ import { RefObject } from 'react';
2
+ import { SegmentedControlStylesProps } from './SegmentedControl.styles';
3
+ export interface SegmentedControlContextInterface extends Required<Pick<SegmentedControlStylesProps, 'size'>> {
4
+ pressedValue: string | null;
5
+ containerRef: RefObject<HTMLDivElement | null>;
6
+ }
7
+ export declare const SegmentedControlContext: import('react').Context<SegmentedControlContextInterface>;
8
+ export declare const useSegmentedControlContext: () => SegmentedControlContextInterface;
@@ -0,0 +1,8 @@
1
+ import { ComponentProps, Ref } from 'react';
2
+ export interface SegmentedControlIndicatorProps extends ComponentProps<'span'> {
3
+ ref?: Ref<HTMLSpanElement>;
4
+ }
5
+ export declare const SegmentedControlIndicator: {
6
+ ({ className, ref, ...rest }: SegmentedControlIndicatorProps): import("react/jsx-runtime").JSX.Element | null;
7
+ displayName: string;
8
+ };
@@ -0,0 +1,18 @@
1
+ import { Toggle } from '@base-ui/react/toggle';
2
+ import { ComponentProps, Ref } from 'react';
3
+ export interface SegmentedControlItemProps extends Omit<ComponentProps<typeof Toggle>, 'value'> {
4
+ /**
5
+ * A unique value that identifies this item within the segmented control.
6
+ */
7
+ value: string;
8
+ /**
9
+ * When true, prevents the user from interacting with this item.
10
+ * @default false
11
+ */
12
+ disabled?: boolean;
13
+ ref?: Ref<HTMLButtonElement>;
14
+ }
15
+ export declare const SegmentedControlItem: {
16
+ ({ value, disabled, children, className, ref, ...rest }: SegmentedControlItemProps): import("react/jsx-runtime").JSX.Element;
17
+ displayName: string;
18
+ };
@@ -0,0 +1,10 @@
1
+ import { SegmentedControl as Root } from './SegmentedControl';
2
+ import { SegmentedControlIndicator as Indicator } from './SegmentedControlIndicator';
3
+ import { SegmentedControlItem as Item } from './SegmentedControlItem';
4
+ export declare const SegmentedControl: typeof Root & {
5
+ Item: typeof Item;
6
+ Indicator: typeof Indicator;
7
+ };
8
+ export type { SegmentedControlProps } from './SegmentedControl';
9
+ export type { SegmentedControlItemProps } from './SegmentedControlItem';
10
+ export type { SegmentedControlIndicatorProps } from './SegmentedControlIndicator';
@@ -0,0 +1,10 @@
1
+ import { SegmentedControl as Root } from './SegmentedControl';
2
+ import { SegmentedControlIndicator as Indicator } from './SegmentedControlIndicator';
3
+ import { SegmentedControlItem as Item } from './SegmentedControlItem';
4
+ export declare const SegmentedControl: typeof Root & {
5
+ Item: typeof Item;
6
+ Indicator: typeof Indicator;
7
+ };
8
+ export type { SegmentedControlProps } from './SegmentedControl';
9
+ export type { SegmentedControlItemProps } from './SegmentedControlItem';
10
+ export type { SegmentedControlIndicatorProps } from './SegmentedControlIndicator';
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),I=require("@base-ui/react/toggle-group"),N=require("@spark-ui/hooks/use-merge-refs"),s=require("react"),f=require("class-variance-authority"),j=require("@base-ui/react/toggle"),q=f.cva(["group inline-grid grid-flow-col auto-cols-fr","relative items-stretch min-w-max","rounded-xl","bg-surface border-md border-outline","p-sz-2"]),E=f.cva(["relative z-raised min-h-sz-44 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset","flex flex-none items-center justify-center flex-col","px-lg","rounded-xl","cursor-pointer select-none","font-medium","transition-colors duration-150","outline-none","focus-visible:u-outline","disabled:cursor-not-allowed disabled:opacity-dim-3","not-disabled:hover:text-on-surface","aria-pressed:text-on-support-container","aria-pressed:font-bold"],{variants:{size:{sm:["h-sz-32 min-w-sz-32 text-caption"],md:["h-sz-36 min-w-sz-36 text-body-2"],lg:["h-sz-40 min-w-sz-40 text-body-1"]}},defaultVariants:{size:"md"}}),k=f.cva(["absolute z-base","rounded-xl","bg-support-container border-md border-support","transition-[left,top,width,height] duration-200 ease-in-out","pointer-events-none"]),b=s.createContext({}),v=()=>{const e=s.useContext(b);if(!e)throw Error("useSegmentedControlContext must be used within a SegmentedControlContext Provider");return e},M=e=>{let o=null;return s.Children.forEach(e,t=>{o===null&&s.isValidElement(t)&&typeof t.props.value=="string"&&(o=t.props.value)}),o},S=({value:e,defaultValue:o,onValueChange:t,size:r="md",className:l,children:n,ref:a,...p})=>{const d=s.useRef(null),[m,g]=s.useState(()=>o??M(n)),i=e!==void 0,c=i?e??null:m,w=V=>{const C=V[0]??null;i||g(C),t?.(C)},z=N.useMergeRefs(d,a),R=c!=null?[c]:[];return u.jsx(b.Provider,{value:{pressedValue:c,containerRef:d,size:r??"md"},children:u.jsx(I.ToggleGroup,{ref:z,multiple:!1,value:R,onValueChange:w,"data-spark-component":"segmented-control",className:q({className:l}),...p,children:n})})};S.displayName="SegmentedControl";const h=({className:e,ref:o,...t})=>{const{pressedValue:r,containerRef:l}=v(),[n,a]=s.useState(null);if(s.useEffect(()=>{const d=l.current;if(!d)return;const m=r?d.querySelector(`[data-value="${r}"]`):null;if(!m){a(null);return}const g=d.getBoundingClientRect(),i=m.getBoundingClientRect(),c=2;a({left:i.left-g.left-c,top:i.top-g.top-c,width:i.width,height:i.height})},[r,l]),!n)return null;const p={left:n.left,top:n.top,width:n.width,height:n.height};return u.jsx("span",{ref:o,"data-spark-component":"segmented-control-indicator","aria-hidden":!0,className:k({className:e}),style:p,...t})};h.displayName="SegmentedControl.Indicator";const x=({value:e,disabled:o=!1,children:t,className:r,ref:l,...n})=>{const{size:a}=v();return u.jsxs(j.Toggle,{ref:l,"data-spark-component":"segmented-control-item","data-value":e,value:e,disabled:o,className:E({size:a,className:r}),...n,children:[t,u.jsx("span",{"aria-hidden":"true",className:"bg-success pointer-events-none h-0 overflow-hidden font-bold content-[attr(data-text)/'']",children:t})]})};x.displayName="SegmentedControl.Item";const y=Object.assign(S,{Item:x,Indicator:h});y.displayName="SegmentedControl";x.displayName="SegmentedControl.Item";h.displayName="SegmentedControl.Indicator";exports.SegmentedControl=y;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/segmented-control/SegmentedControl.styles.ts","../../src/segmented-control/SegmentedControlContext.tsx","../../src/segmented-control/SegmentedControl.tsx","../../src/segmented-control/SegmentedControlIndicator.tsx","../../src/segmented-control/SegmentedControlItem.tsx","../../src/segmented-control/index.ts"],"sourcesContent":["import { cva, VariantProps } from 'class-variance-authority'\n\nexport const rootStyles = cva([\n 'group inline-grid grid-flow-col auto-cols-fr',\n 'relative items-stretch min-w-max',\n 'rounded-xl',\n 'bg-surface border-md border-outline',\n 'p-sz-2',\n])\n\nexport const itemStyles = cva(\n [\n 'relative z-raised min-h-sz-44 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset',\n 'flex flex-none items-center justify-center flex-col',\n 'px-lg',\n 'rounded-xl',\n 'cursor-pointer select-none',\n 'font-medium',\n 'transition-colors duration-150',\n 'outline-none',\n 'focus-visible:u-outline',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3',\n 'not-disabled:hover:text-on-surface',\n 'aria-pressed:text-on-support-container',\n 'aria-pressed:font-bold',\n ],\n {\n variants: {\n /**\n * Change the size of the segmented control\n * @default md\n */\n size: {\n sm: ['h-sz-32 min-w-sz-32 text-caption'],\n md: ['h-sz-36 min-w-sz-36 text-body-2'],\n lg: ['h-sz-40 min-w-sz-40 text-body-1'],\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n)\n\nexport const indicatorStyles = cva([\n 'absolute z-base',\n 'rounded-xl',\n 'bg-support-container border-md border-support',\n 'transition-[left,top,width,height] duration-200 ease-in-out',\n 'pointer-events-none',\n])\n\nexport type SegmentedControlStylesProps = VariantProps<typeof itemStyles>\n","import { createContext, RefObject, useContext } from 'react'\n\nimport type { SegmentedControlStylesProps } from './SegmentedControl.styles'\n\nexport interface SegmentedControlContextInterface\n extends Required<Pick<SegmentedControlStylesProps, 'size'>> {\n pressedValue: string | null\n containerRef: RefObject<HTMLDivElement | null>\n}\n\nexport const SegmentedControlContext = createContext<SegmentedControlContextInterface>(\n {} as SegmentedControlContextInterface\n)\n\nexport const useSegmentedControlContext = () => {\n const context = useContext(SegmentedControlContext)\n\n if (!context) {\n throw Error('useSegmentedControlContext must be used within a SegmentedControlContext Provider')\n }\n\n return context\n}\n","import { ToggleGroup } from '@base-ui/react/toggle-group'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { Children, type ComponentProps, isValidElement, Ref, useRef, useState } from 'react'\n\nimport type { SegmentedControlStylesProps } from './SegmentedControl.styles'\nimport { rootStyles } from './SegmentedControl.styles'\nimport { SegmentedControlContext } from './SegmentedControlContext'\n\nexport interface SegmentedControlProps\n extends Omit<\n ComponentProps<typeof ToggleGroup>,\n 'multiple' | 'value' | 'defaultValue' | 'onValueChange'\n >,\n SegmentedControlStylesProps {\n /**\n * The controlled selected value.\n */\n value?: string\n /**\n * The uncontrolled default selected value.\n */\n defaultValue?: string\n /**\n * Callback fired when the selected value changes.\n */\n onValueChange?: (value: string | null) => void\n ref?: Ref<HTMLDivElement>\n}\n\nconst getFirstItemValue = (children: React.ReactNode): string | null => {\n let firstValue: string | null = null\n\n Children.forEach(children, child => {\n if (firstValue !== null) return\n if (isValidElement(child) && typeof (child.props as { value?: string }).value === 'string') {\n firstValue = (child.props as { value: string }).value\n }\n })\n\n return firstValue\n}\n\nexport const SegmentedControl = ({\n value,\n defaultValue,\n onValueChange,\n size = 'md',\n className,\n children,\n ref,\n ...rest\n}: SegmentedControlProps) => {\n const containerRef = useRef<HTMLDivElement | null>(null)\n const [internalValue, setInternalValue] = useState<string | null>(\n () => defaultValue ?? getFirstItemValue(children)\n )\n\n const isControlled = value !== undefined\n const pressedValue = isControlled ? (value ?? null) : internalValue\n\n const handleValueChange = (newValues: unknown[]) => {\n const next = (newValues[0] as string) ?? null\n\n if (!isControlled) {\n setInternalValue(next)\n }\n\n onValueChange?.(next)\n }\n\n const mergedRef = useMergeRefs(containerRef, ref)\n const groupValue = pressedValue != null ? [pressedValue] : []\n\n return (\n <SegmentedControlContext.Provider\n value={{\n pressedValue,\n containerRef,\n size: size ?? 'md',\n }}\n >\n <ToggleGroup\n ref={mergedRef}\n multiple={false}\n value={groupValue}\n onValueChange={handleValueChange}\n data-spark-component=\"segmented-control\"\n className={rootStyles({ className })}\n {...rest}\n >\n {children}\n </ToggleGroup>\n </SegmentedControlContext.Provider>\n )\n}\n\nSegmentedControl.displayName = 'SegmentedControl'\n","import { type ComponentProps, type CSSProperties, Ref, useEffect, useState } from 'react'\n\nimport { indicatorStyles } from './SegmentedControl.styles'\nimport { useSegmentedControlContext } from './SegmentedControlContext'\n\ninterface IndicatorRect {\n left: number\n top: number\n width: number\n height: number\n}\n\nexport interface SegmentedControlIndicatorProps extends ComponentProps<'span'> {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const SegmentedControlIndicator = ({\n className,\n ref,\n ...rest\n}: SegmentedControlIndicatorProps) => {\n const { pressedValue, containerRef } = useSegmentedControlContext()\n const [rect, setRect] = useState<IndicatorRect | null>(null)\n\n useEffect(() => {\n const container = containerRef.current\n\n if (!container) {\n return\n }\n\n const selectedItem = pressedValue\n ? container.querySelector<HTMLElement>(`[data-value=\"${pressedValue}\"]`)\n : null\n\n if (!selectedItem) {\n setRect(null)\n\n return\n }\n\n const containerRect = container.getBoundingClientRect()\n const itemRect = selectedItem.getBoundingClientRect()\n\n const borderWidth = 2\n\n setRect({\n left: itemRect.left - containerRect.left - borderWidth,\n top: itemRect.top - containerRect.top - borderWidth,\n width: itemRect.width,\n height: itemRect.height,\n })\n }, [pressedValue, containerRef])\n\n if (!rect) return null\n\n const style: CSSProperties = {\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n }\n\n return (\n <span\n ref={ref}\n data-spark-component=\"segmented-control-indicator\"\n aria-hidden\n className={indicatorStyles({ className })}\n style={style}\n {...rest}\n />\n )\n}\n\nSegmentedControlIndicator.displayName = 'SegmentedControl.Indicator'\n","import { Toggle } from '@base-ui/react/toggle'\nimport { type ComponentProps, Ref } from 'react'\n\nimport { itemStyles } from './SegmentedControl.styles'\nimport { useSegmentedControlContext } from './SegmentedControlContext'\n\nexport interface SegmentedControlItemProps extends Omit<ComponentProps<typeof Toggle>, 'value'> {\n /**\n * A unique value that identifies this item within the segmented control.\n */\n value: string\n /**\n * When true, prevents the user from interacting with this item.\n * @default false\n */\n disabled?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const SegmentedControlItem = ({\n value,\n disabled = false,\n children,\n className,\n ref,\n ...rest\n}: SegmentedControlItemProps) => {\n const { size } = useSegmentedControlContext()\n\n return (\n <Toggle\n ref={ref}\n data-spark-component=\"segmented-control-item\"\n data-value={value}\n value={value}\n disabled={disabled}\n className={itemStyles({ size, className })}\n {...rest}\n >\n {children}\n <span\n aria-hidden=\"true\"\n className=\"bg-success pointer-events-none h-0 overflow-hidden font-bold content-[attr(data-text)/'']\"\n >\n {children}\n </span>\n </Toggle>\n )\n}\n\nSegmentedControlItem.displayName = 'SegmentedControl.Item'\n","import { SegmentedControl as Root } from './SegmentedControl'\nimport { SegmentedControlIndicator as Indicator } from './SegmentedControlIndicator'\nimport { SegmentedControlItem as Item } from './SegmentedControlItem'\n\nexport const SegmentedControl: typeof Root & {\n Item: typeof Item\n Indicator: typeof Indicator\n} = Object.assign(Root, {\n Item,\n Indicator,\n})\n\nSegmentedControl.displayName = 'SegmentedControl'\nItem.displayName = 'SegmentedControl.Item'\nIndicator.displayName = 'SegmentedControl.Indicator'\n\nexport type { SegmentedControlProps } from './SegmentedControl'\nexport type { SegmentedControlItemProps } from './SegmentedControlItem'\nexport type { SegmentedControlIndicatorProps } from './SegmentedControlIndicator'\n"],"names":["rootStyles","cva","itemStyles","indicatorStyles","SegmentedControlContext","createContext","useSegmentedControlContext","context","useContext","getFirstItemValue","children","firstValue","Children","child","isValidElement","SegmentedControl","value","defaultValue","onValueChange","size","className","ref","rest","containerRef","useRef","internalValue","setInternalValue","useState","isControlled","pressedValue","handleValueChange","newValues","next","mergedRef","useMergeRefs","groupValue","jsx","ToggleGroup","SegmentedControlIndicator","rect","setRect","useEffect","container","selectedItem","containerRect","itemRect","borderWidth","style","SegmentedControlItem","disabled","jsxs","Toggle","Root","Item","Indicator"],"mappings":"sSAEaA,EAAaC,EAAAA,IAAI,CAC5B,+CACA,mCACA,aACA,sCACA,QACF,CAAC,EAEYC,EAAaD,EAAAA,IACxB,CACE,kIACA,sDACA,QACA,aACA,6BACA,cACA,iCACA,eACA,0BACA,qDACA,qCACA,yCACA,wBAAA,EAEF,CACE,SAAU,CAKR,KAAM,CACJ,GAAI,CAAC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ACA,SAAAiC,EAAW,GACX,SAAAvC,EACA,UAAAU,EACA,IAAAC,EACA,GAAGC,CACL,IAAiC,CAC/B,KAAM,CAAE,KAAAH,CAAA,EAASb,EAAA,EAEjB,OACE4C,EAAAA,KAACC,EAAAA,OAAA,CACC,IAAA9B,EACA,uBAAqB,yBACrB,aAAYL,EACZ,MAAAA,EACA,SAAAiC,EACA,UAAW/C,EAAW,CAAE,KAAAiB,EAAM,UAAAC,EAAW,EACxC,GAAGE,EAEH,SAAA,CAAAZ,EACD0B,EAAAA,IAAC,OAAA,CACC,cAAY,OACZ,UAAU,4FAET,SAAA1B,CAAA,CAAA,CACH,CAAA,CAAA,CAGN,EAEAsC,EAAqB,YAAc,wBC9C5B,MAAMjC,EAGT,OAAO,OAAOqC,EAAM,CAAA,KACtBC,EAAA,UACAC,CACF,CAAC,EAEDvC,EAAiB,YAAc,mBAC/BsC,EAAK,YAAc,wBACnBC,EAAU,YAAc"}
@@ -0,0 +1,190 @@
1
+ import { jsx as m, jsxs as V } from "react/jsx-runtime";
2
+ import { ToggleGroup as N } from "@base-ui/react/toggle-group";
3
+ import { useMergeRefs as R } from "@spark-ui/hooks/use-merge-refs";
4
+ import { createContext as j, useContext as E, useRef as k, useState as x, Children as B, isValidElement as P, useEffect as T } from "react";
5
+ import { cva as f } from "class-variance-authority";
6
+ import { Toggle as $ } from "@base-ui/react/toggle";
7
+ const q = f([
8
+ "group inline-grid grid-flow-col auto-cols-fr",
9
+ "relative items-stretch min-w-max",
10
+ "rounded-xl",
11
+ "bg-surface border-md border-outline",
12
+ "p-sz-2"
13
+ ]), F = f(
14
+ [
15
+ "relative z-raised min-h-sz-44 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset",
16
+ "flex flex-none items-center justify-center flex-col",
17
+ "px-lg",
18
+ "rounded-xl",
19
+ "cursor-pointer select-none",
20
+ "font-medium",
21
+ "transition-colors duration-150",
22
+ "outline-none",
23
+ "focus-visible:u-outline",
24
+ "disabled:cursor-not-allowed disabled:opacity-dim-3",
25
+ "not-disabled:hover:text-on-surface",
26
+ "aria-pressed:text-on-support-container",
27
+ "aria-pressed:font-bold"
28
+ ],
29
+ {
30
+ variants: {
31
+ /**
32
+ * Change the size of the segmented control
33
+ * @default md
34
+ */
35
+ size: {
36
+ sm: ["h-sz-32 min-w-sz-32 text-caption"],
37
+ md: ["h-sz-36 min-w-sz-36 text-body-2"],
38
+ lg: ["h-sz-40 min-w-sz-40 text-body-1"]
39
+ }
40
+ },
41
+ defaultVariants: {
42
+ size: "md"
43
+ }
44
+ }
45
+ ), G = f([
46
+ "absolute z-base",
47
+ "rounded-xl",
48
+ "bg-support-container border-md border-support",
49
+ "transition-[left,top,width,height] duration-200 ease-in-out",
50
+ "pointer-events-none"
51
+ ]), b = j(
52
+ {}
53
+ ), v = () => {
54
+ const e = E(b);
55
+ if (!e)
56
+ throw Error("useSegmentedControlContext must be used within a SegmentedControlContext Provider");
57
+ return e;
58
+ }, M = (e) => {
59
+ let o = null;
60
+ return B.forEach(e, (t) => {
61
+ o === null && P(t) && typeof t.props.value == "string" && (o = t.props.value);
62
+ }), o;
63
+ }, S = ({
64
+ value: e,
65
+ defaultValue: o,
66
+ onValueChange: t,
67
+ size: r = "md",
68
+ className: i,
69
+ children: n,
70
+ ref: l,
71
+ ...p
72
+ }) => {
73
+ const a = k(null), [c, u] = x(
74
+ () => o ?? M(n)
75
+ ), s = e !== void 0, d = s ? e ?? null : c, y = (I) => {
76
+ const C = I[0] ?? null;
77
+ s || u(C), t?.(C);
78
+ }, w = R(a, l), z = d != null ? [d] : [];
79
+ return /* @__PURE__ */ m(
80
+ b.Provider,
81
+ {
82
+ value: {
83
+ pressedValue: d,
84
+ containerRef: a,
85
+ size: r ?? "md"
86
+ },
87
+ children: /* @__PURE__ */ m(
88
+ N,
89
+ {
90
+ ref: w,
91
+ multiple: !1,
92
+ value: z,
93
+ onValueChange: y,
94
+ "data-spark-component": "segmented-control",
95
+ className: q({ className: i }),
96
+ ...p,
97
+ children: n
98
+ }
99
+ )
100
+ }
101
+ );
102
+ };
103
+ S.displayName = "SegmentedControl";
104
+ const g = ({
105
+ className: e,
106
+ ref: o,
107
+ ...t
108
+ }) => {
109
+ const { pressedValue: r, containerRef: i } = v(), [n, l] = x(null);
110
+ if (T(() => {
111
+ const a = i.current;
112
+ if (!a)
113
+ return;
114
+ const c = r ? a.querySelector(`[data-value="${r}"]`) : null;
115
+ if (!c) {
116
+ l(null);
117
+ return;
118
+ }
119
+ const u = a.getBoundingClientRect(), s = c.getBoundingClientRect(), d = 2;
120
+ l({
121
+ left: s.left - u.left - d,
122
+ top: s.top - u.top - d,
123
+ width: s.width,
124
+ height: s.height
125
+ });
126
+ }, [r, i]), !n) return null;
127
+ const p = {
128
+ left: n.left,
129
+ top: n.top,
130
+ width: n.width,
131
+ height: n.height
132
+ };
133
+ return /* @__PURE__ */ m(
134
+ "span",
135
+ {
136
+ ref: o,
137
+ "data-spark-component": "segmented-control-indicator",
138
+ "aria-hidden": !0,
139
+ className: G({ className: e }),
140
+ style: p,
141
+ ...t
142
+ }
143
+ );
144
+ };
145
+ g.displayName = "SegmentedControl.Indicator";
146
+ const h = ({
147
+ value: e,
148
+ disabled: o = !1,
149
+ children: t,
150
+ className: r,
151
+ ref: i,
152
+ ...n
153
+ }) => {
154
+ const { size: l } = v();
155
+ return /* @__PURE__ */ V(
156
+ $,
157
+ {
158
+ ref: i,
159
+ "data-spark-component": "segmented-control-item",
160
+ "data-value": e,
161
+ value: e,
162
+ disabled: o,
163
+ className: F({ size: l, className: r }),
164
+ ...n,
165
+ children: [
166
+ t,
167
+ /* @__PURE__ */ m(
168
+ "span",
169
+ {
170
+ "aria-hidden": "true",
171
+ className: "bg-success pointer-events-none h-0 overflow-hidden font-bold content-[attr(data-text)/'']",
172
+ children: t
173
+ }
174
+ )
175
+ ]
176
+ }
177
+ );
178
+ };
179
+ h.displayName = "SegmentedControl.Item";
180
+ const O = Object.assign(S, {
181
+ Item: h,
182
+ Indicator: g
183
+ });
184
+ O.displayName = "SegmentedControl";
185
+ h.displayName = "SegmentedControl.Item";
186
+ g.displayName = "SegmentedControl.Indicator";
187
+ export {
188
+ O as SegmentedControl
189
+ };
190
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/segmented-control/SegmentedControl.styles.ts","../../src/segmented-control/SegmentedControlContext.tsx","../../src/segmented-control/SegmentedControl.tsx","../../src/segmented-control/SegmentedControlIndicator.tsx","../../src/segmented-control/SegmentedControlItem.tsx","../../src/segmented-control/index.ts"],"sourcesContent":["import { cva, VariantProps } from 'class-variance-authority'\n\nexport const rootStyles = cva([\n 'group inline-grid grid-flow-col auto-cols-fr',\n 'relative items-stretch min-w-max',\n 'rounded-xl',\n 'bg-surface border-md border-outline',\n 'p-sz-2',\n])\n\nexport const itemStyles = cva(\n [\n 'relative z-raised min-h-sz-44 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset',\n 'flex flex-none items-center justify-center flex-col',\n 'px-lg',\n 'rounded-xl',\n 'cursor-pointer select-none',\n 'font-medium',\n 'transition-colors duration-150',\n 'outline-none',\n 'focus-visible:u-outline',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3',\n 'not-disabled:hover:text-on-surface',\n 'aria-pressed:text-on-support-container',\n 'aria-pressed:font-bold',\n ],\n {\n variants: {\n /**\n * Change the size of the segmented control\n * @default md\n */\n size: {\n sm: ['h-sz-32 min-w-sz-32 text-caption'],\n md: ['h-sz-36 min-w-sz-36 text-body-2'],\n lg: ['h-sz-40 min-w-sz-40 text-body-1'],\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n)\n\nexport const indicatorStyles = cva([\n 'absolute z-base',\n 'rounded-xl',\n 'bg-support-container border-md border-support',\n 'transition-[left,top,width,height] duration-200 ease-in-out',\n 'pointer-events-none',\n])\n\nexport type SegmentedControlStylesProps = VariantProps<typeof itemStyles>\n","import { createContext, RefObject, useContext } from 'react'\n\nimport type { SegmentedControlStylesProps } from './SegmentedControl.styles'\n\nexport interface SegmentedControlContextInterface\n extends Required<Pick<SegmentedControlStylesProps, 'size'>> {\n pressedValue: string | null\n containerRef: RefObject<HTMLDivElement | null>\n}\n\nexport const SegmentedControlContext = createContext<SegmentedControlContextInterface>(\n {} as SegmentedControlContextInterface\n)\n\nexport const useSegmentedControlContext = () => {\n const context = useContext(SegmentedControlContext)\n\n if (!context) {\n throw Error('useSegmentedControlContext must be used within a SegmentedControlContext Provider')\n }\n\n return context\n}\n","import { ToggleGroup } from '@base-ui/react/toggle-group'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { Children, type ComponentProps, isValidElement, Ref, useRef, useState } from 'react'\n\nimport type { SegmentedControlStylesProps } from './SegmentedControl.styles'\nimport { rootStyles } from './SegmentedControl.styles'\nimport { SegmentedControlContext } from './SegmentedControlContext'\n\nexport interface SegmentedControlProps\n extends Omit<\n ComponentProps<typeof ToggleGroup>,\n 'multiple' | 'value' | 'defaultValue' | 'onValueChange'\n >,\n SegmentedControlStylesProps {\n /**\n * The controlled selected value.\n */\n value?: string\n /**\n * The uncontrolled default selected value.\n */\n defaultValue?: string\n /**\n * Callback fired when the selected value changes.\n */\n onValueChange?: (value: string | null) => void\n ref?: Ref<HTMLDivElement>\n}\n\nconst getFirstItemValue = (children: React.ReactNode): string | null => {\n let firstValue: string | null = null\n\n Children.forEach(children, child => {\n if (firstValue !== null) return\n if (isValidElement(child) && typeof (child.props as { value?: string }).value === 'string') {\n firstValue = (child.props as { value: string }).value\n }\n })\n\n return firstValue\n}\n\nexport const SegmentedControl = ({\n value,\n defaultValue,\n onValueChange,\n size = 'md',\n className,\n children,\n ref,\n ...rest\n}: SegmentedControlProps) => {\n const containerRef = useRef<HTMLDivElement | null>(null)\n const [internalValue, setInternalValue] = useState<string | null>(\n () => defaultValue ?? getFirstItemValue(children)\n )\n\n const isControlled = value !== undefined\n const pressedValue = isControlled ? (value ?? null) : internalValue\n\n const handleValueChange = (newValues: unknown[]) => {\n const next = (newValues[0] as string) ?? null\n\n if (!isControlled) {\n setInternalValue(next)\n }\n\n onValueChange?.(next)\n }\n\n const mergedRef = useMergeRefs(containerRef, ref)\n const groupValue = pressedValue != null ? [pressedValue] : []\n\n return (\n <SegmentedControlContext.Provider\n value={{\n pressedValue,\n containerRef,\n size: size ?? 'md',\n }}\n >\n <ToggleGroup\n ref={mergedRef}\n multiple={false}\n value={groupValue}\n onValueChange={handleValueChange}\n data-spark-component=\"segmented-control\"\n className={rootStyles({ className })}\n {...rest}\n >\n {children}\n </ToggleGroup>\n </SegmentedControlContext.Provider>\n )\n}\n\nSegmentedControl.displayName = 'SegmentedControl'\n","import { type ComponentProps, type CSSProperties, Ref, useEffect, useState } from 'react'\n\nimport { indicatorStyles } from './SegmentedControl.styles'\nimport { useSegmentedControlContext } from './SegmentedControlContext'\n\ninterface IndicatorRect {\n left: number\n top: number\n width: number\n height: number\n}\n\nexport interface SegmentedControlIndicatorProps extends ComponentProps<'span'> {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const SegmentedControlIndicator = ({\n className,\n ref,\n ...rest\n}: SegmentedControlIndicatorProps) => {\n const { pressedValue, containerRef } = useSegmentedControlContext()\n const [rect, setRect] = useState<IndicatorRect | null>(null)\n\n useEffect(() => {\n const container = containerRef.current\n\n if (!container) {\n return\n }\n\n const selectedItem = pressedValue\n ? container.querySelector<HTMLElement>(`[data-value=\"${pressedValue}\"]`)\n : null\n\n if (!selectedItem) {\n setRect(null)\n\n return\n }\n\n const containerRect = container.getBoundingClientRect()\n const itemRect = selectedItem.getBoundingClientRect()\n\n const borderWidth = 2\n\n setRect({\n left: itemRect.left - containerRect.left - borderWidth,\n top: itemRect.top - containerRect.top - borderWidth,\n width: itemRect.width,\n height: itemRect.height,\n })\n }, [pressedValue, containerRef])\n\n if (!rect) return null\n\n const style: CSSProperties = {\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n }\n\n return (\n <span\n ref={ref}\n data-spark-component=\"segmented-control-indicator\"\n aria-hidden\n className={indicatorStyles({ className })}\n style={style}\n {...rest}\n />\n )\n}\n\nSegmentedControlIndicator.displayName = 'SegmentedControl.Indicator'\n","import { Toggle } from '@base-ui/react/toggle'\nimport { type ComponentProps, Ref } from 'react'\n\nimport { itemStyles } from './SegmentedControl.styles'\nimport { useSegmentedControlContext } from './SegmentedControlContext'\n\nexport interface SegmentedControlItemProps extends Omit<ComponentProps<typeof Toggle>, 'value'> {\n /**\n * A unique value that identifies this item within the segmented control.\n */\n value: string\n /**\n * When true, prevents the user from interacting with this item.\n * @default false\n */\n disabled?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const SegmentedControlItem = ({\n value,\n disabled = false,\n children,\n className,\n ref,\n ...rest\n}: SegmentedControlItemProps) => {\n const { size } = useSegmentedControlContext()\n\n return (\n <Toggle\n ref={ref}\n data-spark-component=\"segmented-control-item\"\n data-value={value}\n value={value}\n disabled={disabled}\n className={itemStyles({ size, className })}\n {...rest}\n >\n {children}\n <span\n aria-hidden=\"true\"\n className=\"bg-success pointer-events-none h-0 overflow-hidden font-bold content-[attr(data-text)/'']\"\n >\n {children}\n </span>\n </Toggle>\n )\n}\n\nSegmentedControlItem.displayName = 'SegmentedControl.Item'\n","import { SegmentedControl as Root } from './SegmentedControl'\nimport { SegmentedControlIndicator as Indicator } from './SegmentedControlIndicator'\nimport { SegmentedControlItem as Item } from './SegmentedControlItem'\n\nexport const SegmentedControl: typeof Root & {\n Item: typeof Item\n Indicator: typeof Indicator\n} = Object.assign(Root, {\n Item,\n Indicator,\n})\n\nSegmentedControl.displayName = 'SegmentedControl'\nItem.displayName = 'SegmentedControl.Item'\nIndicator.displayName = 'SegmentedControl.Indicator'\n\nexport type { SegmentedControlProps } from './SegmentedControl'\nexport type { SegmentedControlItemProps } from './SegmentedControlItem'\nexport type { SegmentedControlIndicatorProps } from './SegmentedControlIndicator'\n"],"names":["rootStyles","cva","itemStyles","indicatorStyles","SegmentedControlContext","createContext","useSegmentedControlContext","context","useContext","getFirstItemValue","children","firstValue","Children","child","isValidElement","SegmentedControl","value","defaultValue","onValueChange","size","className","ref","rest","containerRef","useRef","internalValue","setInternalValue","useState","isControlled","pressedValue","handleValueChange","newValues","next","mergedRef","useMergeRefs","groupValue","jsx","ToggleGroup","SegmentedControlIndicator","rect","setRect","useEffect","container","selectedItem","containerRect","itemRect","borderWidth","style","SegmentedControlItem","disabled","jsxs","Toggle","Root","Item","Indicator"],"mappings":";;;;;;AAEO,MAAMA,IAAaC,EAAI;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC,GAEYC,IAAaD;AAAA,EACxB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,MAKR,MAAM;AAAA,QACJ,IAAI,CAAC,kCAAkC;AAAA,QACvC,IAAI,CAAC,iCAAiC;AAAA,QACtC,IAAI,CAAC,iCAAiC;AAAA,MAAA;AAAA,IACxC;AAAA,IAEF,iBAAiB;AAAA,MACf,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ,GAEaE,IAAkBF,EAAI;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC,GCxCYG,IAA0BC;AAAA,EACrC,CAAA;AACF,GAEaC,IAA6B,MAAM;AAC9C,QAAMC,IAAUC,EAAWJ,CAAuB;AAElD,MAAI,CAACG;AACH,UAAM,MAAM,mFAAmF;AAGjG,SAAOA;AACT,GCOME,IAAoB,CAACC,MAA6C;AACtE,MAAIC,IAA4B;AAEhC,SAAAC,EAAS,QAAQF,GAAU,CAAAG,MAAS;AAClC,IAAIF,MAAe,QACfG,EAAe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ASb,EAAA;AAEjB,SACE,gBAAA4C;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAA9B;AAAA,MACA,wBAAqB;AAAA,MACrB,cAAYL;AAAA,MACZ,OAAAA;AAAA,MACA,UAAAiC;AAAA,MACA,WAAW/C,EAAW,EAAE,MAAAiB,GAAM,WAAAC,GAAW;AAAA,MACxC,GAAGE;AAAA,MAEH,UAAA;AAAA,QAAAZ;AAAA,QACD,gBAAA0B;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAY;AAAA,YACZ,WAAU;AAAA,YAET,UAAA1B;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAEAsC,EAAqB,cAAc;AC9C5B,MAAMjC,IAGT,OAAO,OAAOqC,GAAM;AAAA,EAAA,MACtBC;AAAAA,EAAA,WACAC;AACF,CAAC;AAEDvC,EAAiB,cAAc;AAC/BsC,EAAK,cAAc;AACnBC,EAAU,cAAc;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/components",
3
- "version": "17.0.1",
3
+ "version": "17.1.0",
4
4
  "license": "MIT",
5
5
  "description": "Spark (Leboncoin design system) components.",
6
6
  "exports": {
@@ -54,9 +54,9 @@
54
54
  "@react-aria/toast": "^3.0.0-beta.18",
55
55
  "@react-stately/numberfield": "3.9.11",
56
56
  "@react-stately/toast": "^3.0.0-beta.7",
57
- "@spark-ui/hooks": "^17.0.1",
58
- "@spark-ui/icons": "^17.0.1",
59
- "@spark-ui/internal-utils": "^17.0.1",
57
+ "@spark-ui/hooks": "^17.1.0",
58
+ "@spark-ui/icons": "^17.1.0",
59
+ "@spark-ui/internal-utils": "^17.1.0",
60
60
  "@zag-js/pagination": "1.30.0",
61
61
  "@zag-js/react": "1.30.0",
62
62
  "class-variance-authority": "0.7.1",