@spark-ui/components 17.0.1 → 17.1.1
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/segmented-control/SegmentedControl.d.ts +22 -0
- package/dist/segmented-control/SegmentedControl.styles.d.ts +5 -0
- package/dist/segmented-control/SegmentedControlContext.d.ts +7 -0
- package/dist/segmented-control/SegmentedControlIndicator.d.ts +8 -0
- package/dist/segmented-control/SegmentedControlItem.d.ts +18 -0
- package/dist/segmented-control/index.d.mts +10 -0
- package/dist/segmented-control/index.d.ts +10 -0
- package/dist/segmented-control/index.js +2 -0
- package/dist/segmented-control/index.js.map +1 -0
- package/dist/segmented-control/index.mjs +173 -0
- package/dist/segmented-control/index.mjs.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RadioGroup } from '@base-ui/react/radio-group';
|
|
2
|
+
import { ComponentProps, Ref } from 'react';
|
|
3
|
+
import { SegmentedControlStylesProps } from './SegmentedControl.styles';
|
|
4
|
+
export interface SegmentedControlProps extends Omit<ComponentProps<typeof RadioGroup>, '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) => void;
|
|
17
|
+
ref?: Ref<HTMLDivElement>;
|
|
18
|
+
}
|
|
19
|
+
export declare const SegmentedControl: {
|
|
20
|
+
({ value, defaultValue, onValueChange, className, children, ref, ...rest }: SegmentedControlProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
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?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
4
|
+
export declare const indicatorStyles: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
5
|
+
export type SegmentedControlStylesProps = VariantProps<typeof itemStyles>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export interface SegmentedControlContextInterface {
|
|
3
|
+
checkedValue: string | null;
|
|
4
|
+
containerRef: RefObject<HTMLDivElement | null>;
|
|
5
|
+
}
|
|
6
|
+
export declare const SegmentedControlContext: import('react').Context<SegmentedControlContextInterface>;
|
|
7
|
+
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 { Radio } from '@base-ui/react/radio';
|
|
2
|
+
import { ComponentProps, Ref } from 'react';
|
|
3
|
+
export interface SegmentedControlItemProps extends Omit<ComponentProps<typeof Radio.Root>, '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<HTMLElement>;
|
|
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"),k=require("@base-ui/react/radio-group"),E=require("@spark-ui/components/form-field"),F=require("@spark-ui/hooks/use-merge-refs"),r=require("react"),g=require("class-variance-authority"),z=require("@base-ui/react/radio"),B=g.cva(["default:self-start","group inline-grid grid-flow-col auto-cols-fr","relative items-stretch min-w-max","rounded-xl p-sm","bg-surface border-sm border-outline"]),M=g.cva(["relative z-raised min-h-sz-44 focus-visible:outline-none","flex flex-none items-center justify-center flex-col","default:px-lg default:py-md","rounded-[20px]","cursor-pointer select-none","font-medium","transition-colors duration-150","outline-none","focus-visible:u-outline","data-disabled:cursor-not-allowed data-disabled:opacity-dim-3","data-checked:text-on-support-container","data-checked:font-bold"]),P=g.cva(["absolute z-base","rounded-[20px]","bg-support-container border-md border-support","group-has-focus-visible:border-focus","transition-[left,top,width,height] duration-200 ease-in-out","pointer-events-none"]),v=r.createContext({}),G=()=>{const e=r.useContext(v);if(!e)throw Error("useSegmentedControlContext must be used within a SegmentedControlContext Provider");return e},O=e=>{let t=null;return r.Children.forEach(e,o=>{t===null&&r.isValidElement(o)&&typeof o.props.value=="string"&&(t=o.props.value)}),t},x=({value:e,defaultValue:t,onValueChange:o,className:s,children:i,ref:n,...m})=>{const f=r.useRef(null),d=F.useMergeRefs(f,n),c=O(i),a=e!==void 0,[l,p]=r.useState(()=>t??c),y=a?e??null:l,R=j=>{const b=j;a||p(b),o?.(b)},{labelId:I,description:w,isRequired:V,isInvalid:q,name:N}=E.useFormFieldControl();return u.jsx(v.Provider,{value:{checkedValue:y,containerRef:f},children:u.jsx(k.RadioGroup,{ref:d,value:a?e:void 0,defaultValue:a?void 0:t??c??void 0,onValueChange:R,"data-spark-component":"segmented-control",className:B({className:s}),"aria-labelledby":I,"aria-describedby":w,"aria-required":V||void 0,"aria-invalid":q||void 0,name:N,...m,children:i})})};x.displayName="SegmentedControl";const h=({className:e,ref:t,...o})=>{const{checkedValue:s,containerRef:i}=G(),[n,m]=r.useState(null);if(r.useEffect(()=>{const d=i.current;if(!d)return;const c=s?d.querySelector(`[data-value="${s}"]`):null;if(!c){m(null);return}const a=d.getBoundingClientRect(),l=c.getBoundingClientRect(),p=1;m({left:l.left-a.left-p,top:l.top-a.top-p,width:l.width,height:l.height})},[s,i]),!n)return null;const f={left:n.left,top:n.top,width:n.width,height:n.height};return u.jsx("span",{ref:t,"data-spark-component":"segmented-control-indicator","aria-hidden":!0,className:P({className:e}),style:f,...o})};h.displayName="SegmentedControl.Indicator";const C=({value:e,disabled:t=!1,children:o,className:s,ref:i,...n})=>u.jsxs(z.Radio.Root,{ref:i,"data-spark-component":"segmented-control-item","data-value":e,value:e,disabled:t,className:M({className:s}),...n,children:[o,u.jsx("span",{"aria-hidden":"true",className:"bg-success pointer-events-none h-0 overflow-hidden font-bold content-[attr(data-text)/'']",children:o})]});C.displayName="SegmentedControl.Item";const S=Object.assign(x,{Item:C,Indicator:h});S.displayName="SegmentedControl";C.displayName="SegmentedControl.Item";h.displayName="SegmentedControl.Indicator";exports.SegmentedControl=S;
|
|
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 'default:self-start',\n 'group inline-grid grid-flow-col auto-cols-fr',\n 'relative items-stretch min-w-max',\n 'rounded-xl p-sm',\n 'bg-surface border-sm border-outline',\n])\n\nexport const itemStyles = cva([\n 'relative z-raised min-h-sz-44 focus-visible:outline-none',\n 'flex flex-none items-center justify-center flex-col',\n 'default:px-lg default:py-md',\n 'rounded-[20px]',\n 'cursor-pointer select-none',\n 'font-medium',\n 'transition-colors duration-150',\n 'outline-none',\n 'focus-visible:u-outline',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-dim-3',\n 'data-checked:text-on-support-container',\n 'data-checked:font-bold',\n])\n\nexport const indicatorStyles = cva([\n 'absolute z-base',\n 'rounded-[20px]',\n 'bg-support-container border-md border-support',\n 'group-has-focus-visible:border-focus',\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\nexport interface SegmentedControlContextInterface {\n checkedValue: 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 { RadioGroup } from '@base-ui/react/radio-group'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\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<ComponentProps<typeof RadioGroup>, 'value' | 'defaultValue' | 'onValueChange'>,\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) => 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 className,\n children,\n ref,\n ...rest\n}: SegmentedControlProps) => {\n const containerRef = useRef<HTMLDivElement | null>(null)\n const mergedRef = useMergeRefs(containerRef, ref)\n\n const firstValue = getFirstItemValue(children)\n\n const isControlled = value !== undefined\n const [internalValue, setInternalValue] = useState<string | null>(\n () => defaultValue ?? firstValue\n )\n const checkedValue = isControlled ? (value ?? null) : internalValue\n\n const handleValueChange = (newValue: unknown) => {\n const next = newValue as string\n\n if (!isControlled) {\n setInternalValue(next)\n }\n\n onValueChange?.(next)\n }\n\n const { labelId, description, isRequired, isInvalid, name } = useFormFieldControl()\n\n return (\n <SegmentedControlContext.Provider\n value={{\n checkedValue,\n containerRef,\n }}\n >\n <RadioGroup\n ref={mergedRef}\n value={isControlled ? value : undefined}\n defaultValue={!isControlled ? (defaultValue ?? firstValue ?? undefined) : undefined}\n onValueChange={handleValueChange}\n data-spark-component=\"segmented-control\"\n className={rootStyles({ className })}\n aria-labelledby={labelId}\n aria-describedby={description}\n aria-required={isRequired || undefined}\n aria-invalid={isInvalid || undefined}\n name={name}\n {...rest}\n >\n {children}\n </RadioGroup>\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 { checkedValue, 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 = checkedValue\n ? container.querySelector<HTMLElement>(`[data-value=\"${checkedValue}\"]`)\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 rootBorderWidth = 1\n\n setRect({\n left: itemRect.left - containerRect.left - rootBorderWidth,\n top: itemRect.top - containerRect.top - rootBorderWidth,\n width: itemRect.width,\n height: itemRect.height,\n })\n }, [checkedValue, 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 { Radio } from '@base-ui/react/radio'\nimport { type ComponentProps, Ref } from 'react'\n\nimport { itemStyles } from './SegmentedControl.styles'\n\nexport interface SegmentedControlItemProps\n extends Omit<ComponentProps<typeof Radio.Root>, '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<HTMLElement>\n}\n\nexport const SegmentedControlItem = ({\n value,\n disabled = false,\n children,\n className,\n ref,\n ...rest\n}: SegmentedControlItemProps) => {\n return (\n <Radio.Root\n ref={ref}\n data-spark-component=\"segmented-control-item\"\n data-value={value}\n value={value}\n disabled={disabled}\n className={itemStyles({ 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 </Radio.Root>\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","className","ref","rest","containerRef","useRef","mergedRef","useMergeRefs","isControlled","internalValue","setInternalValue","useState","checkedValue","handleValueChange","newValue","next","labelId","description","isRequired","isInvalid","name","useFormFieldControl","jsx","RadioGroup","SegmentedControlIndicator","rect","setRect","useEffect","container","selectedItem","containerRect","itemRect","rootBorderWidth","style","SegmentedControlItem","disabled","jsxs","Radio","Root","Item","Indicator"],"mappings":"iVAEaA,EAAaC,EAAAA,IAAI,CAC5B,qBACA,+CACA,mCACA,kBACA,qCACF,CAAC,EAEYC,EAAaD,EAAAA,IAAI,CAC5B,2DACA,sDACA,8BACA,iBACA,6BACA,cACA,iCACA,eACA,0BACA,+DACA,yCACA,wBACF,CAAC,EAEYE,EAAkBF,EAAAA,IAAI,CACjC,kBACA,iBACA,gDACA,uCACA,8DACA,qBACF,CAAC,ECzBYG,EAA0BC,EAAAA,cACrC,CAAA,CACF,EAEaC,EAA6B,IAAM,CAC9C,MAAMC,EAAUC,EAAAA,WAAWJ,CAAuB,EAElD,GAAI,CAACG,EACH,MAAM,MAAM,mFAAmF,EAGjG,OAAOA,CACT,ECQME,EAAqBC,GAA6C,CACtE,IAAIC,EAA4B,KAEhCC,OAAAA,EAAAA,SAAS,QAAQF,EAAUG,GAAS,CAC9BF,IAAe,MACfG,EAAAA,eAAeD,CAAK,GAAK,OAAQA,EAAM,MAA6B,OAAU,WAChFF,EAAcE,EAAM,MAA4B,MAEpD,CAAC,EAEMF,CACT,EAEaI,EAAmB,CAAC,CAC/B,MAAAC,EACA,aAAAC,EACA,cAAAC,EACA,UAAAC,EACA,SAAAT,EACA,IAAAU,EACA,GAAGC,CACL,IAA6B,CAC3B,MAAMC,EAAeC,EAAAA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ime";
|
|
2
|
+
import { RadioGroup as E } from "@base-ui/react/radio-group";
|
|
3
|
+
import { useFormFieldControl as q } from "@spark-ui/components/form-field";
|
|
4
|
+
import { useMergeRefs as z } from "@spark-ui/hooks/use-merge-refs";
|
|
5
|
+
import { createContext as B, useContext as F, useRef as P, useState as b, Children as $, isValidElement as G, useEffect as M } from "react";
|
|
6
|
+
import { cva as p } from "class-variance-authority";
|
|
7
|
+
import { Radio as O } from "@base-ui/react/radio";
|
|
8
|
+
const W = p([
|
|
9
|
+
"default:self-start",
|
|
10
|
+
"group inline-grid grid-flow-col auto-cols-fr",
|
|
11
|
+
"relative items-stretch min-w-max",
|
|
12
|
+
"rounded-xl p-sm",
|
|
13
|
+
"bg-surface border-sm border-outline"
|
|
14
|
+
]), A = p([
|
|
15
|
+
"relative z-raised min-h-sz-44 focus-visible:outline-none",
|
|
16
|
+
"flex flex-none items-center justify-center flex-col",
|
|
17
|
+
"default:px-lg default:py-md",
|
|
18
|
+
"rounded-[20px]",
|
|
19
|
+
"cursor-pointer select-none",
|
|
20
|
+
"font-medium",
|
|
21
|
+
"transition-colors duration-150",
|
|
22
|
+
"outline-none",
|
|
23
|
+
"focus-visible:u-outline",
|
|
24
|
+
"data-disabled:cursor-not-allowed data-disabled:opacity-dim-3",
|
|
25
|
+
"data-checked:text-on-support-container",
|
|
26
|
+
"data-checked:font-bold"
|
|
27
|
+
]), D = p([
|
|
28
|
+
"absolute z-base",
|
|
29
|
+
"rounded-[20px]",
|
|
30
|
+
"bg-support-container border-md border-support",
|
|
31
|
+
"group-has-focus-visible:border-focus",
|
|
32
|
+
"transition-[left,top,width,height] duration-200 ease-in-out",
|
|
33
|
+
"pointer-events-none"
|
|
34
|
+
]), v = B(
|
|
35
|
+
{}
|
|
36
|
+
), H = () => {
|
|
37
|
+
const e = F(v);
|
|
38
|
+
if (!e)
|
|
39
|
+
throw Error("useSegmentedControlContext must be used within a SegmentedControlContext Provider");
|
|
40
|
+
return e;
|
|
41
|
+
}, J = (e) => {
|
|
42
|
+
let t = null;
|
|
43
|
+
return $.forEach(e, (o) => {
|
|
44
|
+
t === null && G(o) && typeof o.props.value == "string" && (t = o.props.value);
|
|
45
|
+
}), t;
|
|
46
|
+
}, x = ({
|
|
47
|
+
value: e,
|
|
48
|
+
defaultValue: t,
|
|
49
|
+
onValueChange: o,
|
|
50
|
+
className: r,
|
|
51
|
+
children: i,
|
|
52
|
+
ref: n,
|
|
53
|
+
...c
|
|
54
|
+
}) => {
|
|
55
|
+
const u = P(null), l = z(u, n), d = J(i), s = e !== void 0, [a, m] = b(
|
|
56
|
+
() => t ?? d
|
|
57
|
+
), S = s ? e ?? null : a, y = (k) => {
|
|
58
|
+
const C = k;
|
|
59
|
+
s || m(C), o?.(C);
|
|
60
|
+
}, { labelId: R, description: I, isRequired: w, isInvalid: N, name: V } = q();
|
|
61
|
+
return /* @__PURE__ */ f(
|
|
62
|
+
v.Provider,
|
|
63
|
+
{
|
|
64
|
+
value: {
|
|
65
|
+
checkedValue: S,
|
|
66
|
+
containerRef: u
|
|
67
|
+
},
|
|
68
|
+
children: /* @__PURE__ */ f(
|
|
69
|
+
E,
|
|
70
|
+
{
|
|
71
|
+
ref: l,
|
|
72
|
+
value: s ? e : void 0,
|
|
73
|
+
defaultValue: s ? void 0 : t ?? d ?? void 0,
|
|
74
|
+
onValueChange: y,
|
|
75
|
+
"data-spark-component": "segmented-control",
|
|
76
|
+
className: W({ className: r }),
|
|
77
|
+
"aria-labelledby": R,
|
|
78
|
+
"aria-describedby": I,
|
|
79
|
+
"aria-required": w || void 0,
|
|
80
|
+
"aria-invalid": N || void 0,
|
|
81
|
+
name: V,
|
|
82
|
+
...c,
|
|
83
|
+
children: i
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
x.displayName = "SegmentedControl";
|
|
90
|
+
const g = ({
|
|
91
|
+
className: e,
|
|
92
|
+
ref: t,
|
|
93
|
+
...o
|
|
94
|
+
}) => {
|
|
95
|
+
const { checkedValue: r, containerRef: i } = H(), [n, c] = b(null);
|
|
96
|
+
if (M(() => {
|
|
97
|
+
const l = i.current;
|
|
98
|
+
if (!l)
|
|
99
|
+
return;
|
|
100
|
+
const d = r ? l.querySelector(`[data-value="${r}"]`) : null;
|
|
101
|
+
if (!d) {
|
|
102
|
+
c(null);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const s = l.getBoundingClientRect(), a = d.getBoundingClientRect(), m = 1;
|
|
106
|
+
c({
|
|
107
|
+
left: a.left - s.left - m,
|
|
108
|
+
top: a.top - s.top - m,
|
|
109
|
+
width: a.width,
|
|
110
|
+
height: a.height
|
|
111
|
+
});
|
|
112
|
+
}, [r, i]), !n) return null;
|
|
113
|
+
const u = {
|
|
114
|
+
left: n.left,
|
|
115
|
+
top: n.top,
|
|
116
|
+
width: n.width,
|
|
117
|
+
height: n.height
|
|
118
|
+
};
|
|
119
|
+
return /* @__PURE__ */ f(
|
|
120
|
+
"span",
|
|
121
|
+
{
|
|
122
|
+
ref: t,
|
|
123
|
+
"data-spark-component": "segmented-control-indicator",
|
|
124
|
+
"aria-hidden": !0,
|
|
125
|
+
className: D({ className: e }),
|
|
126
|
+
style: u,
|
|
127
|
+
...o
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
g.displayName = "SegmentedControl.Indicator";
|
|
132
|
+
const h = ({
|
|
133
|
+
value: e,
|
|
134
|
+
disabled: t = !1,
|
|
135
|
+
children: o,
|
|
136
|
+
className: r,
|
|
137
|
+
ref: i,
|
|
138
|
+
...n
|
|
139
|
+
}) => /* @__PURE__ */ j(
|
|
140
|
+
O.Root,
|
|
141
|
+
{
|
|
142
|
+
ref: i,
|
|
143
|
+
"data-spark-component": "segmented-control-item",
|
|
144
|
+
"data-value": e,
|
|
145
|
+
value: e,
|
|
146
|
+
disabled: t,
|
|
147
|
+
className: A({ className: r }),
|
|
148
|
+
...n,
|
|
149
|
+
children: [
|
|
150
|
+
o,
|
|
151
|
+
/* @__PURE__ */ f(
|
|
152
|
+
"span",
|
|
153
|
+
{
|
|
154
|
+
"aria-hidden": "true",
|
|
155
|
+
className: "bg-success pointer-events-none h-0 overflow-hidden font-bold content-[attr(data-text)/'']",
|
|
156
|
+
children: o
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
h.displayName = "SegmentedControl.Item";
|
|
163
|
+
const K = Object.assign(x, {
|
|
164
|
+
Item: h,
|
|
165
|
+
Indicator: g
|
|
166
|
+
});
|
|
167
|
+
K.displayName = "SegmentedControl";
|
|
168
|
+
h.displayName = "SegmentedControl.Item";
|
|
169
|
+
g.displayName = "SegmentedControl.Indicator";
|
|
170
|
+
export {
|
|
171
|
+
K as SegmentedControl
|
|
172
|
+
};
|
|
173
|
+
//# 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 'default:self-start',\n 'group inline-grid grid-flow-col auto-cols-fr',\n 'relative items-stretch min-w-max',\n 'rounded-xl p-sm',\n 'bg-surface border-sm border-outline',\n])\n\nexport const itemStyles = cva([\n 'relative z-raised min-h-sz-44 focus-visible:outline-none',\n 'flex flex-none items-center justify-center flex-col',\n 'default:px-lg default:py-md',\n 'rounded-[20px]',\n 'cursor-pointer select-none',\n 'font-medium',\n 'transition-colors duration-150',\n 'outline-none',\n 'focus-visible:u-outline',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-dim-3',\n 'data-checked:text-on-support-container',\n 'data-checked:font-bold',\n])\n\nexport const indicatorStyles = cva([\n 'absolute z-base',\n 'rounded-[20px]',\n 'bg-support-container border-md border-support',\n 'group-has-focus-visible:border-focus',\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\nexport interface SegmentedControlContextInterface {\n checkedValue: 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 { RadioGroup } from '@base-ui/react/radio-group'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\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<ComponentProps<typeof RadioGroup>, 'value' | 'defaultValue' | 'onValueChange'>,\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) => 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 className,\n children,\n ref,\n ...rest\n}: SegmentedControlProps) => {\n const containerRef = useRef<HTMLDivElement | null>(null)\n const mergedRef = useMergeRefs(containerRef, ref)\n\n const firstValue = getFirstItemValue(children)\n\n const isControlled = value !== undefined\n const [internalValue, setInternalValue] = useState<string | null>(\n () => defaultValue ?? firstValue\n )\n const checkedValue = isControlled ? (value ?? null) : internalValue\n\n const handleValueChange = (newValue: unknown) => {\n const next = newValue as string\n\n if (!isControlled) {\n setInternalValue(next)\n }\n\n onValueChange?.(next)\n }\n\n const { labelId, description, isRequired, isInvalid, name } = useFormFieldControl()\n\n return (\n <SegmentedControlContext.Provider\n value={{\n checkedValue,\n containerRef,\n }}\n >\n <RadioGroup\n ref={mergedRef}\n value={isControlled ? value : undefined}\n defaultValue={!isControlled ? (defaultValue ?? firstValue ?? undefined) : undefined}\n onValueChange={handleValueChange}\n data-spark-component=\"segmented-control\"\n className={rootStyles({ className })}\n aria-labelledby={labelId}\n aria-describedby={description}\n aria-required={isRequired || undefined}\n aria-invalid={isInvalid || undefined}\n name={name}\n {...rest}\n >\n {children}\n </RadioGroup>\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 { checkedValue, 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 = checkedValue\n ? container.querySelector<HTMLElement>(`[data-value=\"${checkedValue}\"]`)\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 rootBorderWidth = 1\n\n setRect({\n left: itemRect.left - containerRect.left - rootBorderWidth,\n top: itemRect.top - containerRect.top - rootBorderWidth,\n width: itemRect.width,\n height: itemRect.height,\n })\n }, [checkedValue, 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 { Radio } from '@base-ui/react/radio'\nimport { type ComponentProps, Ref } from 'react'\n\nimport { itemStyles } from './SegmentedControl.styles'\n\nexport interface SegmentedControlItemProps\n extends Omit<ComponentProps<typeof Radio.Root>, '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<HTMLElement>\n}\n\nexport const SegmentedControlItem = ({\n value,\n disabled = false,\n children,\n className,\n ref,\n ...rest\n}: SegmentedControlItemProps) => {\n return (\n <Radio.Root\n ref={ref}\n data-spark-component=\"segmented-control-item\"\n data-value={value}\n value={value}\n disabled={disabled}\n className={itemStyles({ 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 </Radio.Root>\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","className","ref","rest","containerRef","useRef","mergedRef","useMergeRefs","isControlled","internalValue","setInternalValue","useState","checkedValue","handleValueChange","newValue","next","labelId","description","isRequired","isInvalid","name","useFormFieldControl","jsx","RadioGroup","SegmentedControlIndicator","rect","setRect","useEffect","container","selectedItem","containerRect","itemRect","rootBorderWidth","style","SegmentedControlItem","disabled","jsxs","Radio","Root","Item","Indicator"],"mappings":";;;;;;;AAEO,MAAMA,IAAaC,EAAI;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC,GAEYC,IAAaD,EAAI;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC,GAEYE,IAAkBF,EAAI;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC,GCzBYG,IAA0BC;AAAA,EACrC,CAAA;AACF,GAEaC,IAA6B,MAAM;AAC9C,QAAMC,IAAUC,EAAWJ,CAAuB;AAElD,MAAI,CAACG;AACH,UAAM,MAAM,mFAAmF;AAGjG,SAAOA;AACT,GCQME,IAAoB,CAACC,MAA6C;AACtE,MAAIC,IAA4B;AAEhC,SAAAC,EAAS,QAAQF,GAAU,CAAAG,MAAS;AAClC,IAAIF,MAAe,QACfG,EAAeD,CAAK,KAAK,OAAQA,EAAM,MA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IAAW;AAAA,EACX,UAAA3C;AAAA,EACA,WAAAS;AAAA,EACA,KAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAiC;AAAA,EAACC,EAAM;AAAA,EAAN;AAAA,IACC,KAAAnC;AAAA,IACA,wBAAqB;AAAA,IACrB,cAAYJ;AAAA,IACZ,OAAAA;AAAA,IACA,UAAAqC;AAAA,IACA,WAAWnD,EAAW,EAAE,WAAAiB,GAAW;AAAA,IAClC,GAAGE;AAAA,IAEH,UAAA;AAAA,MAAAX;AAAA,MACD,gBAAA8B;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,eAAY;AAAA,UACZ,WAAU;AAAA,UAET,UAAA9B;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAAA;AAKN0C,EAAqB,cAAc;AC5C5B,MAAMrC,IAGT,OAAO,OAAOyC,GAAM;AAAA,EAAA,MACtBC;AAAAA,EAAA,WACAC;AACF,CAAC;AAED3C,EAAiB,cAAc;AAC/B0C,EAAK,cAAc;AACnBC,EAAU,cAAc;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/components",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.1.1",
|
|
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.
|
|
58
|
-
"@spark-ui/icons": "^17.
|
|
59
|
-
"@spark-ui/internal-utils": "^17.
|
|
57
|
+
"@spark-ui/hooks": "^17.1.1",
|
|
58
|
+
"@spark-ui/icons": "^17.1.1",
|
|
59
|
+
"@spark-ui/internal-utils": "^17.1.1",
|
|
60
60
|
"@zag-js/pagination": "1.30.0",
|
|
61
61
|
"@zag-js/react": "1.30.0",
|
|
62
62
|
"class-variance-authority": "0.7.1",
|