@spark-ui/components 17.2.0 → 17.2.1-beta.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/radio-group/Radio.d.ts +2 -2
- package/dist/radio-group/RadioGroup.d.ts +1 -5
- package/dist/radio-group/RadioIndicator.d.ts +4 -7
- package/dist/radio-group/RadioInput.d.ts +16 -4
- package/dist/radio-group/index.js +1 -1
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +123 -129
- package/dist/radio-group/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/radio-group/RadioLabel.d.ts +0 -20
- package/dist/radio-group/RadioLabel.styles.d.ts +0 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
import { RadioInputProps } from './RadioInput';
|
|
3
3
|
export type RadioProps = RadioInputProps & {
|
|
4
|
-
ref?: Ref<
|
|
4
|
+
ref?: Ref<HTMLElement>;
|
|
5
5
|
};
|
|
6
6
|
export declare const Radio: {
|
|
7
|
-
({ className, children,
|
|
7
|
+
({ className, children, disabled: disabledProp, ref, ...others }: RadioProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
displayName: string;
|
|
9
9
|
};
|
|
@@ -38,10 +38,6 @@ export interface RadioGroupProps extends RadioGroupVariantsProps, Pick<RadioInpu
|
|
|
38
38
|
* The reading direction of the radio group.
|
|
39
39
|
*/
|
|
40
40
|
dir?: 'ltr' | 'rtl';
|
|
41
|
-
/**
|
|
42
|
-
* When true, keyboard navigation will loop from last item to first, and vice versa.
|
|
43
|
-
*/
|
|
44
|
-
loop?: boolean;
|
|
45
41
|
/**
|
|
46
42
|
* When true, the label will be placed on the left side of the Radio
|
|
47
43
|
*/
|
|
@@ -49,6 +45,6 @@ export interface RadioGroupProps extends RadioGroupVariantsProps, Pick<RadioInpu
|
|
|
49
45
|
ref?: Ref<HTMLDivElement>;
|
|
50
46
|
}
|
|
51
47
|
export declare const RadioGroup: {
|
|
52
|
-
({ orientation,
|
|
48
|
+
({ orientation, intent, disabled, className, required: requiredProp, reverse, onValueChange: onValueChangeProp, ref, ...others }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
53
49
|
displayName: string;
|
|
54
50
|
};
|
|
@@ -3,16 +3,13 @@ import { RadioIndicatorStylesProps } from './RadioIndicator.styles';
|
|
|
3
3
|
export interface RadioIndicatorProps extends RadioIndicatorStylesProps {
|
|
4
4
|
className?: string;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Whether to keep the indicator mounted in the DOM when the radio is unchecked.
|
|
7
|
+
* Useful when controlling animation with React animation libraries.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
|
|
11
|
-
*/
|
|
12
|
-
forceMount?: true | undefined;
|
|
9
|
+
keepMounted?: boolean;
|
|
13
10
|
ref?: Ref<HTMLSpanElement>;
|
|
14
11
|
}
|
|
15
12
|
export declare const RadioIndicator: {
|
|
16
|
-
({ intent, className, ref, ...others }: RadioIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
({ intent, className, keepMounted, ref, ...others }: RadioIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
17
14
|
displayName: string;
|
|
18
15
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLAttributes, Ref } from 'react';
|
|
2
2
|
import { RadioInputVariantsProps } from './RadioInput.styles';
|
|
3
|
-
export interface RadioInputProps extends RadioInputVariantsProps, Omit<
|
|
3
|
+
export interface RadioInputProps extends RadioInputVariantsProps, Omit<HTMLAttributes<HTMLElement>, 'value' | 'onChange'> {
|
|
4
4
|
/**
|
|
5
5
|
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
+
* Uses Base UI's render prop internally to merge behaviour into the child element.
|
|
6
7
|
*/
|
|
7
8
|
asChild?: boolean;
|
|
8
9
|
/**
|
|
@@ -17,9 +18,20 @@ export interface RadioInputProps extends RadioInputVariantsProps, Omit<ButtonHTM
|
|
|
17
18
|
* When true, indicates that the user must check the radio item before the owning form can be submitted.
|
|
18
19
|
*/
|
|
19
20
|
required?: boolean;
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Ref forwarded to the hidden `<input type="radio">` rendered by Base UI.
|
|
23
|
+
* Useful for programmatic activation (e.g. clicking from an associated label span).
|
|
24
|
+
*/
|
|
25
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
26
|
+
ref?: Ref<HTMLElement>;
|
|
27
|
+
/**
|
|
28
|
+
* When true, the visual radio input (outer ring and inner dot) is visually hidden but remains
|
|
29
|
+
* accessible in the DOM. Useful for custom radio appearances where only the label matters visually.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
hideInput?: boolean;
|
|
21
33
|
}
|
|
22
34
|
export declare const RadioInput: {
|
|
23
|
-
({ intent: intentProp, className, ref, ...others }: RadioInputProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
({ intent: intentProp, className, asChild, children, inputRef, hideInput, ref, ...others }: RadioInputProps): import("react/jsx-runtime").JSX.Element;
|
|
24
36
|
displayName: string;
|
|
25
37
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),u=require("class-variance-authority"),f=require("react"),F=require("../label/index.js"),v=require("@base-ui/react/radio"),R=require("@spark-ui/components/form-field"),x=require("@spark-ui/internal-utils"),V=require("@base-ui/react/radio-group"),k=f.createContext(null),C=()=>{const e=f.useContext(k);if(!e)throw Error("useRadioGroup must be used within a RadioGroup provider");return e},z=u.cva(["relative block","size-3/5","after:absolute","after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2","after:h-0","after:w-0","after:block","after:rounded-[50%]","after:content-['']","after:transition-all","data-checked:after:size-full"],{variants:{intent:x.makeVariants({main:["after:bg-main"],support:["after:bg-support"],accent:["after:bg-accent"],neutral:["after:bg-neutral"],success:["after:bg-success"],alert:["after:bg-alert"],error:["after:bg-error"],info:["after:bg-info"]})},defaultVariants:{intent:"support"}}),y=({intent:e,className:t,keepMounted:r,ref:n,...o})=>a.jsx(v.Radio.Indicator,{ref:n,keepMounted:r,className:z({intent:e,className:t}),...o});y.displayName="RadioGroup.RadioIndicator";const S=u.cva(["flex shrink-0 items-center justify-center","rounded-full","border-md","outline-hidden","hover:ring-4","focus-visible:u-outline","data-disabled:cursor-not-allowed data-disabled:border-outline/dim-2 data-disabled:hover:ring-transparent","u-shadow-border-transition","size-sz-24"],{variants:{intent:x.makeVariants({main:["border-outline","data-checked:border-main","hover:ring-main-container"],support:["border-outline","data-checked:border-support","hover:ring-support-container"],accent:["border-outline","data-checked:border-accent","hover:ring-accent-container"],neutral:["border-outline","data-checked:border-neutral","hover:ring-neutral-container"],info:["border-info","data-checked:border-info","hover:ring-info-container"],success:["border-success","data-checked:border-success","hover:ring-success-container"],alert:["border-alert","data-checked:border-alert","hover:ring-alert-container"],error:["border-error","data-checked:border-error","hover:ring-error-container"]})},defaultVariants:{intent:"support"}}),G=({intent:e,className:t,asChild:r,children:n,inputRef:o,hideInput:i=!1,ref:s,...c})=>{const{state:l}=R.useFormFieldControl(),d=l??e;return a.jsx(v.Radio.Root,{"data-spark-component":"radio-input",ref:s,inputRef:o,render:r?n:void 0,className:i?"sr-only":S({intent:d,className:t}),...c,children:!r&&!i&&a.jsx(y,{intent:d,keepMounted:!0})})};G.displayName="RadioGroup.RadioInput";const L=":radio",g=({className:e,children:t,disabled:r,ref:n,...o})=>{const i=`${L}-label-${f.useId()}`,{intent:s,disabled:c,reverse:l}=C(),d=r||c,p=t&&a.jsx(F.Label,{"data-spark-component":"radio-label",id:i,className:u.cx("grow",d?"text-neutral/dim-2 cursor-not-allowed":"cursor-pointer"),children:t}),b=a.jsx(G,{ref:n,intent:s,"aria-labelledby":t?i:void 0,...o,disabled:r}),m=l?a.jsxs(a.Fragment,{children:[p,b]}):a.jsxs(a.Fragment,{children:[b,p]});return a.jsx("span",{className:u.cx("gap-md text-body-1 flex items-start",e),children:m})};g.displayName="RadioGroup.Radio";const M=u.cva(["flex"],{variants:{orientation:{vertical:["flex-col","gap-lg"],horizontal:["flex-row","gap-xl"]}}}),$=({intent:e,disabled:t,reverse:r,children:n})=>{const o=f.useMemo(()=>({intent:e,disabled:t,reverse:r}),[e,t,r]);return a.jsx(k.Provider,{value:o,children:n})},j=({orientation:e="vertical",intent:t="support",disabled:r,className:n,required:o,reverse:i=!1,onValueChange:s,ref:c,...l})=>{const{labelId:d,isInvalid:p,isRequired:b,description:m,name:q}=R.useFormFieldControl(),h=o!==void 0?o:b,N=s?w=>s(w):void 0;return a.jsx($,{reverse:i,intent:t,disabled:r,children:a.jsx(V.RadioGroup,{"data-spark-component":"radio-group",className:M({orientation:e,className:n}),name:q,ref:c,disabled:r,required:h,onValueChange:N,"aria-orientation":e,"aria-labelledby":d,"aria-invalid":p,"aria-required":h,"aria-describedby":m,...l})})};j.displayName="RadioGroup";const I=Object.assign(j,{Radio:g});I.displayName="RadioGroup";g.displayName="RadioGroup.Radio";exports.RadioGroup=I;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/radio-group/RadioGroupContext.tsx","../../src/radio-group/RadioIndicator.styles.ts","../../src/radio-group/RadioIndicator.tsx","../../src/radio-group/RadioInput.styles.ts","../../src/radio-group/RadioInput.tsx","../../src/radio-group/RadioLabel.styles.tsx","../../src/radio-group/RadioLabel.tsx","../../src/radio-group/Radio.tsx","../../src/radio-group/RadioGroup.styles.ts","../../src/radio-group/RadioGroupProvider.tsx","../../src/radio-group/RadioGroup.tsx","../../src/radio-group/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport type { RadioInputProps } from './RadioInput'\n\nexport type RadioGroupContextState = Pick<RadioInputProps, 'intent' | 'disabled'> &\n Pick<RadioGroupProps, 'reverse'>\n\nexport const RadioGroupContext = createContext<RadioGroupContextState | null>(null)\n\nexport const useRadioGroup = () => {\n const context = useContext(RadioGroupContext)\n\n if (!context) {\n throw Error('useRadioGroup must be used within a RadioGroup provider')\n }\n\n return context\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioIndicatorStyles = cva(\n [\n 'relative block',\n 'size-3/5',\n 'after:absolute',\n 'after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2',\n 'after:h-0',\n 'after:w-0',\n 'after:block',\n 'after:rounded-[50%]',\n \"after:content-['']\",\n 'after:transition-all',\n 'data-[state=checked]:after:size-full',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['after:bg-main'],\n support: ['after:bg-support'],\n accent: ['after:bg-accent'],\n neutral: ['after:bg-neutral'],\n success: ['after:bg-success'],\n alert: ['after:bg-alert'],\n error: ['after:bg-error'],\n info: ['after:bg-info'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioIndicatorStylesProps = VariantProps<typeof radioIndicatorStyles>\n","import { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { radioIndicatorStyles, RadioIndicatorStylesProps } from './RadioIndicator.styles'\n\nexport interface RadioIndicatorProps extends RadioIndicatorStylesProps {\n className?: string\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.\n */\n forceMount?: true | undefined\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const RadioIndicator = ({ intent, className, ref, ...others }: RadioIndicatorProps) => {\n return (\n <RadixRadioGroup.Indicator\n ref={ref}\n className={radioIndicatorStyles({ intent, className })}\n {...others}\n />\n )\n}\n\nRadioIndicator.displayName = 'RadioGroup.RadioIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioInputVariants = cva(\n [\n 'flex shrink-0 items-center justify-center',\n 'rounded-full',\n 'border-md',\n 'outline-hidden',\n 'hover:ring-4',\n 'focus-visible:u-outline',\n 'disabled:cursor-not-allowed disabled:border-outline/dim-2 disabled:hover:ring-transparent',\n 'u-shadow-border-transition',\n 'size-sz-24',\n ],\n {\n variants: {\n /**\n * Color scheme of the radio input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['border-outline', 'data-[state=checked]:border-main', 'hover:ring-main-container'],\n support: [\n 'border-outline',\n 'data-[state=checked]:border-support',\n 'hover:ring-support-container',\n ],\n accent: [\n 'border-outline',\n 'data-[state=checked]:border-accent',\n 'hover:ring-accent-container',\n ],\n neutral: [\n 'border-outline',\n 'data-[state=checked]:border-neutral',\n 'hover:ring-neutral-container',\n ],\n info: ['border-info', 'data-[state=checked]:border-info', 'hover:ring-info-container'],\n success: [\n 'border-success',\n 'data-[state=checked]:border-success',\n 'hover:ring-success-container',\n ],\n alert: ['border-alert', 'data-[state=checked]:border-alert', 'hover:ring-alert-container'],\n error: ['border-error', 'data-[state=checked]:border-error', 'hover:ring-error-container'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { ButtonHTMLAttributes, Ref } from 'react'\n\nimport { RadioIndicator } from './RadioIndicator'\nimport { radioInputVariants, RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioInputProps\n extends RadioInputVariantsProps,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value given as data when submitted with a name.\n */\n value: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the radio item before the owning form can be submitted.\n */\n required?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const RadioInput = ({ intent: intentProp, className, ref, ...others }: RadioInputProps) => {\n const { state } = useFormFieldControl()\n\n const intent = state ?? intentProp\n\n return (\n <RadixRadioGroup.RadioGroupItem\n data-spark-component=\"radio-input\"\n ref={ref}\n className={radioInputVariants({ intent, className })}\n {...others}\n >\n <RadioIndicator intent={intent} forceMount />\n </RadixRadioGroup.RadioGroupItem>\n )\n}\n\nRadioInput.displayName = 'RadioGroup.RadioInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioLabelStyles = cva('grow', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type RadioLabelStylesProps = VariantProps<typeof radioLabelStyles>\n","import { Label } from 'radix-ui'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\nimport { radioLabelStyles, RadioLabelStylesProps } from './RadioLabel.styles'\n\nexport interface RadioLabelProps\n extends RadioLabelStylesProps,\n PropsWithChildren<HTMLAttributes<HTMLLabelElement>> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The id of the element the label is associated with.\n */\n htmlFor?: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n}\n\nexport const RadioLabel = ({ disabled, ...others }: RadioLabelProps) => {\n return (\n <Label.Root\n data-spark-component=\"radio-label\"\n className={radioLabelStyles({ disabled })}\n {...others}\n />\n )\n}\n\nRadioLabel.displayName = 'RadioGroup.RadioLabel'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useId } from 'react'\n\nimport { useRadioGroup } from './RadioGroupContext'\nimport { RadioInput, RadioInputProps } from './RadioInput'\nimport { RadioLabel } from './RadioLabel'\n\nexport type RadioProps = RadioInputProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nconst ID_PREFIX = ':radio'\n\nexport const Radio = ({\n className,\n children,\n id,\n disabled: disabledProp,\n ref,\n ...others\n}: RadioProps) => {\n const innerId = `${ID_PREFIX}-input-${useId()}`\n const innerLabelId = `${ID_PREFIX}-label-${useId()}`\n\n const { intent, disabled, reverse } = useRadioGroup()\n\n const radioLabel = children && (\n <RadioLabel disabled={disabledProp || disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </RadioLabel>\n )\n\n const radioInput = (\n <RadioInput\n ref={ref}\n id={id || innerId}\n intent={intent}\n aria-labelledby={children ? innerLabelId : undefined}\n {...others}\n disabled={disabledProp}\n />\n )\n\n const content = reverse ? (\n <>\n {radioLabel}\n {radioInput}\n </>\n ) : (\n <>\n {radioInput}\n {radioLabel}\n </>\n )\n\n return <span className={cx('gap-md text-body-1 flex items-start', className)}>{content}</span>\n}\n\nRadio.displayName = 'RadioGroup.Radio'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioGroupStyles = cva(['flex'], {\n variants: {\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['flex-row', 'gap-xl'],\n },\n },\n})\n\nexport type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>\n","import { ReactNode, useMemo } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport { RadioGroupContext } from './RadioGroupContext'\nimport type { RadioInputProps } from './RadioInput'\n\nexport interface RadioGroupProviderProps\n extends Pick<RadioInputProps, 'intent' | 'disabled'>,\n Pick<RadioGroupProps, 'reverse'> {\n children: ReactNode\n}\n\nexport const RadioGroupProvider = ({\n intent,\n disabled,\n reverse,\n children,\n}: RadioGroupProviderProps) => {\n const value = useMemo(() => ({ intent, disabled, reverse }), [intent, disabled, reverse])\n\n return <RadioGroupContext.Provider value={value}>{children}</RadioGroupContext.Provider>\n}\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { HTMLAttributes, Ref } from 'react'\n\nimport { radioGroupStyles, RadioGroupVariantsProps } from './RadioGroup.styles'\nimport { RadioGroupProvider } from './RadioGroupProvider'\nimport { RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioGroupProps\n extends RadioGroupVariantsProps,\n Pick<RadioInputVariantsProps, 'intent'>,\n Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.\n */\n defaultValue?: string\n /**\n * The controlled value of the radio item to check. Should be used in conjunction with onValueChange.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n /**\n * When true, prevents the user from interacting with radio items.\n */\n disabled?: boolean\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * When true, indicates that the user must check a radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The orientation of the component.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The reading direction of the radio group.\n */\n dir?: 'ltr' | 'rtl'\n /**\n * When true, keyboard navigation will loop from last item to first, and vice versa.\n */\n loop?: boolean\n /**\n * When true, the label will be placed on the left side of the Radio\n */\n reverse?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const RadioGroup = ({\n orientation = 'vertical',\n loop = true,\n intent = 'support',\n disabled,\n className,\n required: requiredProp,\n reverse = false,\n ref,\n ...others\n}: RadioGroupProps) => {\n const { labelId, isInvalid, isRequired, description, name } = useFormFieldControl()\n const required = requiredProp !== undefined ? requiredProp : isRequired\n\n return (\n <RadioGroupProvider reverse={reverse} intent={intent} disabled={disabled}>\n <RadixRadioGroup.RadioGroup\n data-spark-component=\"radio-group\"\n className={radioGroupStyles({ orientation, className })}\n name={name}\n ref={ref}\n disabled={disabled}\n orientation={orientation}\n loop={loop}\n required={required}\n aria-labelledby={labelId}\n aria-invalid={isInvalid}\n aria-required={required}\n aria-describedby={description}\n {...others}\n />\n </RadioGroupProvider>\n )\n}\n\nRadioGroup.displayName = 'RadioGroup'\n","import { Radio } from './Radio'\nimport { RadioGroup as Root } from './RadioGroup'\n\nexport const RadioGroup: typeof Root & {\n Radio: typeof Radio\n} = Object.assign(Root, {\n Radio,\n})\n\nRadioGroup.displayName = 'RadioGroup'\nRadio.displayName = 'RadioGroup.Radio'\n\nexport { type RadioGroupProps } from './RadioGroup'\nexport { type RadioProps } from './Radio'\n"],"names":["RadioGroupContext","createContext","useRadioGroup","context","useContext","radioIndicatorStyles","cva","makeVariants","RadioIndicator","intent","className","ref","others","jsx","RadixRadioGroup","radioInputVariants","RadioInput","intentProp","state","useFormFieldControl","radioLabelStyles","RadioLabel","disabled","Label","ID_PREFIX","Radio","children","id","disabledProp","innerId","useId","innerLabelId","reverse","radioLabel","radioInput","content","jsxs","Fragment","cx","radioGroupStyles","RadioGroupProvider","value","useMemo","RadioGroup","orientation","loop","requiredProp","labelId","isInvalid","isRequired","description","name","required","Root"],"mappings":"uRAQaA,EAAoBC,EAAAA,cAA6C,IAAI,EAErEC,EAAgB,IAAM,CACjC,MAAMC,EAAUC,EAAAA,WAAWJ,CAAiB,EAE5C,GAAI,CAACG,EACH,MAAM,MAAM,yDAAyD,EAGvE,OAAOA,CACT,ECfaE,EAAuBC,EAAAA,IAClC,CACE,iBACA,WACA,iBACA,6EACA,YACA,YACA,cACA,sBACA,qBACA,uBACA,sCAAA,EAEF,CACE,SAAU,CACR,OAAQC,EAAAA,aAGN,CACA,KAAM,CAAC,eAAe,EACtB,QAAS,CAAC,kBAAkB,EAC5B,OAAQ,CAAC,iBAAiB,EA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+B,EAAW,YAAc,aC3FlB,MAAMA,EAET,OAAO,OAAOU,EAAM,CACtB,MAAA5B,CACF,CAAC,EAEDkB,EAAW,YAAc,aACzBlB,EAAM,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/radio-group/RadioGroupContext.tsx","../../src/radio-group/RadioIndicator.styles.ts","../../src/radio-group/RadioIndicator.tsx","../../src/radio-group/RadioInput.styles.ts","../../src/radio-group/RadioInput.tsx","../../src/radio-group/Radio.tsx","../../src/radio-group/RadioGroup.styles.ts","../../src/radio-group/RadioGroupProvider.tsx","../../src/radio-group/RadioGroup.tsx","../../src/radio-group/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport type { RadioInputProps } from './RadioInput'\n\nexport type RadioGroupContextState = Pick<RadioInputProps, 'intent' | 'disabled'> &\n Pick<RadioGroupProps, 'reverse'>\n\nexport const RadioGroupContext = createContext<RadioGroupContextState | null>(null)\n\nexport const useRadioGroup = () => {\n const context = useContext(RadioGroupContext)\n\n if (!context) {\n throw Error('useRadioGroup must be used within a RadioGroup provider')\n }\n\n return context\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioIndicatorStyles = cva(\n [\n 'relative block',\n 'size-3/5',\n 'after:absolute',\n 'after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2',\n 'after:h-0',\n 'after:w-0',\n 'after:block',\n 'after:rounded-[50%]',\n \"after:content-['']\",\n 'after:transition-all',\n 'data-checked:after:size-full',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['after:bg-main'],\n support: ['after:bg-support'],\n accent: ['after:bg-accent'],\n neutral: ['after:bg-neutral'],\n success: ['after:bg-success'],\n alert: ['after:bg-alert'],\n error: ['after:bg-error'],\n info: ['after:bg-info'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioIndicatorStylesProps = VariantProps<typeof radioIndicatorStyles>\n","import { Radio } from '@base-ui/react/radio'\nimport { Ref } from 'react'\n\nimport { radioIndicatorStyles, RadioIndicatorStylesProps } from './RadioIndicator.styles'\n\nexport interface RadioIndicatorProps extends RadioIndicatorStylesProps {\n className?: string\n /**\n * Whether to keep the indicator mounted in the DOM when the radio is unchecked.\n * Useful when controlling animation with React animation libraries.\n */\n keepMounted?: boolean\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const RadioIndicator = ({\n intent,\n className,\n keepMounted,\n ref,\n ...others\n}: RadioIndicatorProps) => {\n return (\n <Radio.Indicator\n ref={ref}\n keepMounted={keepMounted}\n className={radioIndicatorStyles({ intent, className })}\n {...others}\n />\n )\n}\n\nRadioIndicator.displayName = 'RadioGroup.RadioIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioInputVariants = cva(\n [\n 'flex shrink-0 items-center justify-center',\n 'rounded-full',\n 'border-md',\n 'outline-hidden',\n 'hover:ring-4',\n 'focus-visible:u-outline',\n 'data-disabled:cursor-not-allowed data-disabled:border-outline/dim-2 data-disabled:hover:ring-transparent',\n 'u-shadow-border-transition',\n 'size-sz-24',\n ],\n {\n variants: {\n /**\n * Color scheme of the radio input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['border-outline', 'data-checked:border-main', 'hover:ring-main-container'],\n support: ['border-outline', 'data-checked:border-support', 'hover:ring-support-container'],\n accent: ['border-outline', 'data-checked:border-accent', 'hover:ring-accent-container'],\n neutral: ['border-outline', 'data-checked:border-neutral', 'hover:ring-neutral-container'],\n info: ['border-info', 'data-checked:border-info', 'hover:ring-info-container'],\n success: ['border-success', 'data-checked:border-success', 'hover:ring-success-container'],\n alert: ['border-alert', 'data-checked:border-alert', 'hover:ring-alert-container'],\n error: ['border-error', 'data-checked:border-error', 'hover:ring-error-container'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>\n","import { Radio } from '@base-ui/react/radio'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { HTMLAttributes, ReactElement, Ref } from 'react'\n\nimport { RadioIndicator } from './RadioIndicator'\nimport { radioInputVariants, RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioInputProps\n extends RadioInputVariantsProps,\n Omit<HTMLAttributes<HTMLElement>, 'value' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Uses Base UI's render prop internally to merge behaviour into the child element.\n */\n asChild?: boolean\n /**\n * The value given as data when submitted with a name.\n */\n value: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * Ref forwarded to the hidden `<input type=\"radio\">` rendered by Base UI.\n * Useful for programmatic activation (e.g. clicking from an associated label span).\n */\n inputRef?: Ref<HTMLInputElement>\n ref?: Ref<HTMLElement>\n /**\n * When true, the visual radio input (outer ring and inner dot) is visually hidden but remains\n * accessible in the DOM. Useful for custom radio appearances where only the label matters visually.\n * @default false\n */\n hideInput?: boolean\n}\n\nexport const RadioInput = ({\n intent: intentProp,\n className,\n asChild,\n children,\n inputRef,\n hideInput = false,\n ref,\n ...others\n}: RadioInputProps) => {\n const { state } = useFormFieldControl()\n\n const intent = state ?? intentProp\n\n return (\n <Radio.Root\n data-spark-component=\"radio-input\"\n ref={ref}\n inputRef={inputRef}\n render={asChild ? (children as ReactElement) : undefined}\n className={hideInput ? 'sr-only' : radioInputVariants({ intent, className })}\n {...others}\n >\n {!asChild && !hideInput && <RadioIndicator intent={intent} keepMounted />}\n </Radio.Root>\n )\n}\n\nRadioInput.displayName = 'RadioGroup.RadioInput'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useId } from 'react'\n\nimport { Label } from '../label'\nimport { useRadioGroup } from './RadioGroupContext'\nimport { RadioInput, RadioInputProps } from './RadioInput'\n\nexport type RadioProps = RadioInputProps & {\n ref?: Ref<HTMLElement>\n}\n\nconst ID_PREFIX = ':radio'\n\nexport const Radio = ({\n className,\n children,\n disabled: disabledProp,\n ref,\n ...others\n}: RadioProps) => {\n const innerLabelId = `${ID_PREFIX}-label-${useId()}`\n\n const { intent, disabled, reverse } = useRadioGroup()\n\n const isDisabled = disabledProp || disabled\n\n const radioLabel = children && (\n <Label\n data-spark-component=\"radio-label\"\n id={innerLabelId}\n className={cx(\n 'grow',\n isDisabled ? 'text-neutral/dim-2 cursor-not-allowed' : 'cursor-pointer'\n )}\n >\n {children}\n </Label>\n )\n\n const radioInput = (\n <RadioInput\n ref={ref}\n intent={intent}\n aria-labelledby={children ? innerLabelId : undefined}\n {...others}\n disabled={disabledProp}\n />\n )\n\n const content = reverse ? (\n <>\n {radioLabel}\n {radioInput}\n </>\n ) : (\n <>\n {radioInput}\n {radioLabel}\n </>\n )\n\n return <span className={cx('gap-md text-body-1 flex items-start', className)}>{content}</span>\n}\n\nRadio.displayName = 'RadioGroup.Radio'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioGroupStyles = cva(['flex'], {\n variants: {\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['flex-row', 'gap-xl'],\n },\n },\n})\n\nexport type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>\n","import { ReactNode, useMemo } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport { RadioGroupContext } from './RadioGroupContext'\nimport type { RadioInputProps } from './RadioInput'\n\nexport interface RadioGroupProviderProps\n extends Pick<RadioInputProps, 'intent' | 'disabled'>,\n Pick<RadioGroupProps, 'reverse'> {\n children: ReactNode\n}\n\nexport const RadioGroupProvider = ({\n intent,\n disabled,\n reverse,\n children,\n}: RadioGroupProviderProps) => {\n const value = useMemo(() => ({ intent, disabled, reverse }), [intent, disabled, reverse])\n\n return <RadioGroupContext.Provider value={value}>{children}</RadioGroupContext.Provider>\n}\n","import { RadioGroup as BaseUIRadioGroup } from '@base-ui/react/radio-group'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { HTMLAttributes, Ref } from 'react'\n\nimport { radioGroupStyles, RadioGroupVariantsProps } from './RadioGroup.styles'\nimport { RadioGroupProvider } from './RadioGroupProvider'\nimport { RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioGroupProps\n extends RadioGroupVariantsProps,\n Pick<RadioInputVariantsProps, 'intent'>,\n Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.\n */\n defaultValue?: string\n /**\n * The controlled value of the radio item to check. Should be used in conjunction with onValueChange.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n /**\n * When true, prevents the user from interacting with radio items.\n */\n disabled?: boolean\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * When true, indicates that the user must check a radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The orientation of the component.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The reading direction of the radio group.\n */\n dir?: 'ltr' | 'rtl'\n /**\n * When true, the label will be placed on the left side of the Radio\n */\n reverse?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const RadioGroup = ({\n orientation = 'vertical',\n intent = 'support',\n disabled,\n className,\n required: requiredProp,\n reverse = false,\n onValueChange: onValueChangeProp,\n ref,\n ...others\n}: RadioGroupProps) => {\n const { labelId, isInvalid, isRequired, description, name } = useFormFieldControl()\n const required = requiredProp !== undefined ? requiredProp : isRequired\n\n const handleValueChange = onValueChangeProp\n ? (value: unknown) => onValueChangeProp(value as string)\n : undefined\n\n return (\n <RadioGroupProvider reverse={reverse} intent={intent} disabled={disabled}>\n <BaseUIRadioGroup\n data-spark-component=\"radio-group\"\n className={radioGroupStyles({ orientation, className })}\n name={name}\n ref={ref}\n disabled={disabled}\n required={required}\n onValueChange={handleValueChange}\n aria-orientation={orientation}\n aria-labelledby={labelId}\n aria-invalid={isInvalid}\n aria-required={required}\n aria-describedby={description}\n {...others}\n />\n </RadioGroupProvider>\n )\n}\n\nRadioGroup.displayName = 'RadioGroup'\n","import { Radio } from './Radio'\nimport { RadioGroup as Root } from './RadioGroup'\n\nexport const RadioGroup: typeof Root & {\n Radio: typeof Radio\n} = Object.assign(Root, {\n Radio,\n})\n\nRadioGroup.displayName = 'RadioGroup'\nRadio.displayName = 'RadioGroup.Radio'\n\nexport { type RadioGroupProps } from './RadioGroup'\nexport { type RadioProps } from './Radio'\n"],"names":["RadioGroupContext","createContext","useRadioGroup","context","useContext","radioIndicatorStyles","cva","makeVariants","RadioIndicator","intent","className","keepMounted","ref","others","jsx","Radio","radioInputVariants","RadioInput","intentProp","asChild","children","inputRef","hideInput","state","useFormFieldControl","ID_PREFIX","disabledProp","innerLabelId","useId","disabled","reverse","isDisabled","radioLabel","Label","cx","radioInput","content","jsxs","Fragment","radioGroupStyles","RadioGroupProvider","value","useMemo","RadioGroup","orientation","requiredProp","onValueChangeProp","labelId","isInvalid","isRequired","description","name","required","handleValueChange","BaseUIRadioGroup","Root"],"mappings":"0WAQaA,EAAoBC,EAAAA,cAA6C,IAAI,EAErEC,EAAgB,IAAM,CACjC,MAAMC,EAAUC,EAAAA,WAAWJ,CAAiB,EAE5C,GAAI,CAACG,EACH,MAAM,MAAM,yDAAyD,EAGvE,OAAOA,CACT,ECfaE,EAAuBC,EAAAA,IAClC,CACE,iBACA,WACA,iBACA,6EACA,YACA,YACA,cACA,sBACA,qBACA,uBACA,8BAAA,EAEF,CACE,SAAU,CACR,OAAQC,EAAAA,aAGN,CACA,KAAM,CAAC,eAAe,EACtB,QAAS,CAAC,kBAA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 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cva as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as n, jsxs as g, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import { cva as f, cx as R } from "class-variance-authority";
|
|
3
|
+
import { createContext as $, useContext as j, useId as F, useMemo as q } from "react";
|
|
4
|
+
import { Label as D } from "../label/index.mjs";
|
|
5
|
+
import { Radio as k } from "@base-ui/react/radio";
|
|
6
|
+
import { useFormFieldControl as x } from "@spark-ui/components/form-field";
|
|
7
|
+
import { makeVariants as G } from "@spark-ui/internal-utils";
|
|
8
|
+
import { RadioGroup as L } from "@base-ui/react/radio-group";
|
|
9
|
+
const y = $(null), E = () => {
|
|
10
|
+
const r = j(y);
|
|
9
11
|
if (!r)
|
|
10
12
|
throw Error("useRadioGroup must be used within a RadioGroup provider");
|
|
11
13
|
return r;
|
|
12
|
-
},
|
|
14
|
+
}, M = f(
|
|
13
15
|
[
|
|
14
16
|
"relative block",
|
|
15
17
|
"size-3/5",
|
|
@@ -21,11 +23,11 @@ const N = V(null), S = () => {
|
|
|
21
23
|
"after:rounded-[50%]",
|
|
22
24
|
"after:content-['']",
|
|
23
25
|
"after:transition-all",
|
|
24
|
-
"data-
|
|
26
|
+
"data-checked:after:size-full"
|
|
25
27
|
],
|
|
26
28
|
{
|
|
27
29
|
variants: {
|
|
28
|
-
intent:
|
|
30
|
+
intent: G({
|
|
29
31
|
main: ["after:bg-main"],
|
|
30
32
|
support: ["after:bg-support"],
|
|
31
33
|
accent: ["after:bg-accent"],
|
|
@@ -40,16 +42,23 @@ const N = V(null), S = () => {
|
|
|
40
42
|
intent: "support"
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
|
-
),
|
|
44
|
-
|
|
45
|
+
), I = ({
|
|
46
|
+
intent: r,
|
|
47
|
+
className: a,
|
|
48
|
+
keepMounted: e,
|
|
49
|
+
ref: t,
|
|
50
|
+
...o
|
|
51
|
+
}) => /* @__PURE__ */ n(
|
|
52
|
+
k.Indicator,
|
|
45
53
|
{
|
|
46
|
-
ref:
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
ref: t,
|
|
55
|
+
keepMounted: e,
|
|
56
|
+
className: M({ intent: r, className: a }),
|
|
57
|
+
...o
|
|
49
58
|
}
|
|
50
59
|
);
|
|
51
|
-
|
|
52
|
-
const
|
|
60
|
+
I.displayName = "RadioGroup.RadioIndicator";
|
|
61
|
+
const S = f(
|
|
53
62
|
[
|
|
54
63
|
"flex shrink-0 items-center justify-center",
|
|
55
64
|
"rounded-full",
|
|
@@ -57,7 +66,7 @@ const M = u(
|
|
|
57
66
|
"outline-hidden",
|
|
58
67
|
"hover:ring-4",
|
|
59
68
|
"focus-visible:u-outline",
|
|
60
|
-
"disabled:cursor-not-allowed disabled:border-outline/dim-2 disabled:hover:ring-transparent",
|
|
69
|
+
"data-disabled:cursor-not-allowed data-disabled:border-outline/dim-2 data-disabled:hover:ring-transparent",
|
|
61
70
|
"u-shadow-border-transition",
|
|
62
71
|
"size-sz-24"
|
|
63
72
|
],
|
|
@@ -66,151 +75,136 @@ const M = u(
|
|
|
66
75
|
/**
|
|
67
76
|
* Color scheme of the radio input.
|
|
68
77
|
*/
|
|
69
|
-
intent:
|
|
70
|
-
main: ["border-outline", "data-
|
|
71
|
-
support: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
],
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"data-[state=checked]:border-accent",
|
|
79
|
-
"hover:ring-accent-container"
|
|
80
|
-
],
|
|
81
|
-
neutral: [
|
|
82
|
-
"border-outline",
|
|
83
|
-
"data-[state=checked]:border-neutral",
|
|
84
|
-
"hover:ring-neutral-container"
|
|
85
|
-
],
|
|
86
|
-
info: ["border-info", "data-[state=checked]:border-info", "hover:ring-info-container"],
|
|
87
|
-
success: [
|
|
88
|
-
"border-success",
|
|
89
|
-
"data-[state=checked]:border-success",
|
|
90
|
-
"hover:ring-success-container"
|
|
91
|
-
],
|
|
92
|
-
alert: ["border-alert", "data-[state=checked]:border-alert", "hover:ring-alert-container"],
|
|
93
|
-
error: ["border-error", "data-[state=checked]:border-error", "hover:ring-error-container"]
|
|
78
|
+
intent: G({
|
|
79
|
+
main: ["border-outline", "data-checked:border-main", "hover:ring-main-container"],
|
|
80
|
+
support: ["border-outline", "data-checked:border-support", "hover:ring-support-container"],
|
|
81
|
+
accent: ["border-outline", "data-checked:border-accent", "hover:ring-accent-container"],
|
|
82
|
+
neutral: ["border-outline", "data-checked:border-neutral", "hover:ring-neutral-container"],
|
|
83
|
+
info: ["border-info", "data-checked:border-info", "hover:ring-info-container"],
|
|
84
|
+
success: ["border-success", "data-checked:border-success", "hover:ring-success-container"],
|
|
85
|
+
alert: ["border-alert", "data-checked:border-alert", "hover:ring-alert-container"],
|
|
86
|
+
error: ["border-error", "data-checked:border-error", "hover:ring-error-container"]
|
|
94
87
|
})
|
|
95
88
|
},
|
|
96
89
|
defaultVariants: {
|
|
97
90
|
intent: "support"
|
|
98
91
|
}
|
|
99
92
|
}
|
|
100
|
-
),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
), N = ({
|
|
94
|
+
intent: r,
|
|
95
|
+
className: a,
|
|
96
|
+
asChild: e,
|
|
97
|
+
children: t,
|
|
98
|
+
inputRef: o,
|
|
99
|
+
hideInput: i = !1,
|
|
100
|
+
ref: d,
|
|
101
|
+
...s
|
|
102
|
+
}) => {
|
|
103
|
+
const { state: c } = x(), l = c ?? r;
|
|
104
|
+
return /* @__PURE__ */ n(
|
|
105
|
+
k.Root,
|
|
104
106
|
{
|
|
105
107
|
"data-spark-component": "radio-input",
|
|
106
|
-
ref:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
ref: d,
|
|
109
|
+
inputRef: o,
|
|
110
|
+
render: e ? t : void 0,
|
|
111
|
+
className: i ? "sr-only" : S({ intent: l, className: a }),
|
|
112
|
+
...s,
|
|
113
|
+
children: !e && !i && /* @__PURE__ */ n(I, { intent: l, keepMounted: !0 })
|
|
110
114
|
}
|
|
111
115
|
);
|
|
112
116
|
};
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
variants: {
|
|
116
|
-
disabled: {
|
|
117
|
-
true: ["text-neutral/dim-2", "cursor-not-allowed"],
|
|
118
|
-
false: ["cursor-pointer"]
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
defaultVariants: {
|
|
122
|
-
disabled: !1
|
|
123
|
-
}
|
|
124
|
-
}), $ = ({ disabled: r, ...e }) => /* @__PURE__ */ o(
|
|
125
|
-
q.Root,
|
|
126
|
-
{
|
|
127
|
-
"data-spark-component": "radio-label",
|
|
128
|
-
className: D({ disabled: r }),
|
|
129
|
-
...e
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
$.displayName = "RadioGroup.RadioLabel";
|
|
133
|
-
const k = ":radio", R = ({
|
|
117
|
+
N.displayName = "RadioGroup.RadioInput";
|
|
118
|
+
const O = ":radio", m = ({
|
|
134
119
|
className: r,
|
|
135
|
-
children:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
...i
|
|
120
|
+
children: a,
|
|
121
|
+
disabled: e,
|
|
122
|
+
ref: t,
|
|
123
|
+
...o
|
|
140
124
|
}) => {
|
|
141
|
-
const
|
|
142
|
-
|
|
125
|
+
const i = `${O}-label-${F()}`, { intent: d, disabled: s, reverse: c } = E(), u = a && /* @__PURE__ */ n(
|
|
126
|
+
D,
|
|
127
|
+
{
|
|
128
|
+
"data-spark-component": "radio-label",
|
|
129
|
+
id: i,
|
|
130
|
+
className: R(
|
|
131
|
+
"grow",
|
|
132
|
+
e || s ? "text-neutral/dim-2 cursor-not-allowed" : "cursor-pointer"
|
|
133
|
+
),
|
|
134
|
+
children: a
|
|
135
|
+
}
|
|
136
|
+
), p = /* @__PURE__ */ n(
|
|
137
|
+
N,
|
|
143
138
|
{
|
|
144
|
-
ref:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
disabled: t
|
|
139
|
+
ref: t,
|
|
140
|
+
intent: d,
|
|
141
|
+
"aria-labelledby": a ? i : void 0,
|
|
142
|
+
...o,
|
|
143
|
+
disabled: e
|
|
150
144
|
}
|
|
151
|
-
),
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
] }) : /* @__PURE__ */ g(
|
|
155
|
-
|
|
156
|
-
|
|
145
|
+
), b = c ? /* @__PURE__ */ g(v, { children: [
|
|
146
|
+
u,
|
|
147
|
+
p
|
|
148
|
+
] }) : /* @__PURE__ */ g(v, { children: [
|
|
149
|
+
p,
|
|
150
|
+
u
|
|
157
151
|
] });
|
|
158
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ n("span", { className: R("gap-md text-body-1 flex items-start", r), children: b });
|
|
159
153
|
};
|
|
160
|
-
|
|
161
|
-
const
|
|
154
|
+
m.displayName = "RadioGroup.Radio";
|
|
155
|
+
const X = f(["flex"], {
|
|
162
156
|
variants: {
|
|
163
157
|
orientation: {
|
|
164
158
|
vertical: ["flex-col", "gap-lg"],
|
|
165
159
|
horizontal: ["flex-row", "gap-xl"]
|
|
166
160
|
}
|
|
167
161
|
}
|
|
168
|
-
}),
|
|
162
|
+
}), _ = ({
|
|
169
163
|
intent: r,
|
|
170
|
-
disabled:
|
|
171
|
-
reverse:
|
|
164
|
+
disabled: a,
|
|
165
|
+
reverse: e,
|
|
172
166
|
children: t
|
|
173
167
|
}) => {
|
|
174
|
-
const
|
|
175
|
-
return /* @__PURE__ */
|
|
176
|
-
},
|
|
168
|
+
const o = q(() => ({ intent: r, disabled: a, reverse: e }), [r, a, e]);
|
|
169
|
+
return /* @__PURE__ */ n(y.Provider, { value: o, children: t });
|
|
170
|
+
}, w = ({
|
|
177
171
|
orientation: r = "vertical",
|
|
178
|
-
loop: e = !0,
|
|
179
172
|
intent: a = "support",
|
|
180
|
-
disabled:
|
|
181
|
-
className:
|
|
182
|
-
required:
|
|
183
|
-
reverse:
|
|
184
|
-
|
|
185
|
-
|
|
173
|
+
disabled: e,
|
|
174
|
+
className: t,
|
|
175
|
+
required: o,
|
|
176
|
+
reverse: i = !1,
|
|
177
|
+
onValueChange: d,
|
|
178
|
+
ref: s,
|
|
179
|
+
...c
|
|
186
180
|
}) => {
|
|
187
|
-
const { labelId:
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
|
|
181
|
+
const { labelId: l, isInvalid: u, isRequired: p, description: b, name: V } = x(), h = o !== void 0 ? o : p, z = d ? (C) => d(C) : void 0;
|
|
182
|
+
return /* @__PURE__ */ n(_, { reverse: i, intent: a, disabled: e, children: /* @__PURE__ */ n(
|
|
183
|
+
L,
|
|
190
184
|
{
|
|
191
185
|
"data-spark-component": "radio-group",
|
|
192
|
-
className:
|
|
193
|
-
name:
|
|
194
|
-
ref:
|
|
195
|
-
disabled:
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
"aria-labelledby":
|
|
200
|
-
"aria-invalid":
|
|
201
|
-
"aria-required":
|
|
202
|
-
"aria-describedby":
|
|
203
|
-
...
|
|
186
|
+
className: X({ orientation: r, className: t }),
|
|
187
|
+
name: V,
|
|
188
|
+
ref: s,
|
|
189
|
+
disabled: e,
|
|
190
|
+
required: h,
|
|
191
|
+
onValueChange: z,
|
|
192
|
+
"aria-orientation": r,
|
|
193
|
+
"aria-labelledby": l,
|
|
194
|
+
"aria-invalid": u,
|
|
195
|
+
"aria-required": h,
|
|
196
|
+
"aria-describedby": b,
|
|
197
|
+
...c
|
|
204
198
|
}
|
|
205
199
|
) });
|
|
206
200
|
};
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
Radio:
|
|
201
|
+
w.displayName = "RadioGroup";
|
|
202
|
+
const A = Object.assign(w, {
|
|
203
|
+
Radio: m
|
|
210
204
|
});
|
|
211
|
-
|
|
212
|
-
|
|
205
|
+
A.displayName = "RadioGroup";
|
|
206
|
+
m.displayName = "RadioGroup.Radio";
|
|
213
207
|
export {
|
|
214
|
-
|
|
208
|
+
A as RadioGroup
|
|
215
209
|
};
|
|
216
210
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/radio-group/RadioGroupContext.tsx","../../src/radio-group/RadioIndicator.styles.ts","../../src/radio-group/RadioIndicator.tsx","../../src/radio-group/RadioInput.styles.ts","../../src/radio-group/RadioInput.tsx","../../src/radio-group/RadioLabel.styles.tsx","../../src/radio-group/RadioLabel.tsx","../../src/radio-group/Radio.tsx","../../src/radio-group/RadioGroup.styles.ts","../../src/radio-group/RadioGroupProvider.tsx","../../src/radio-group/RadioGroup.tsx","../../src/radio-group/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport type { RadioInputProps } from './RadioInput'\n\nexport type RadioGroupContextState = Pick<RadioInputProps, 'intent' | 'disabled'> &\n Pick<RadioGroupProps, 'reverse'>\n\nexport const RadioGroupContext = createContext<RadioGroupContextState | null>(null)\n\nexport const useRadioGroup = () => {\n const context = useContext(RadioGroupContext)\n\n if (!context) {\n throw Error('useRadioGroup must be used within a RadioGroup provider')\n }\n\n return context\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioIndicatorStyles = cva(\n [\n 'relative block',\n 'size-3/5',\n 'after:absolute',\n 'after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2',\n 'after:h-0',\n 'after:w-0',\n 'after:block',\n 'after:rounded-[50%]',\n \"after:content-['']\",\n 'after:transition-all',\n 'data-[state=checked]:after:size-full',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['after:bg-main'],\n support: ['after:bg-support'],\n accent: ['after:bg-accent'],\n neutral: ['after:bg-neutral'],\n success: ['after:bg-success'],\n alert: ['after:bg-alert'],\n error: ['after:bg-error'],\n info: ['after:bg-info'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioIndicatorStylesProps = VariantProps<typeof radioIndicatorStyles>\n","import { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { radioIndicatorStyles, RadioIndicatorStylesProps } from './RadioIndicator.styles'\n\nexport interface RadioIndicatorProps extends RadioIndicatorStylesProps {\n className?: string\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.\n */\n forceMount?: true | undefined\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const RadioIndicator = ({ intent, className, ref, ...others }: RadioIndicatorProps) => {\n return (\n <RadixRadioGroup.Indicator\n ref={ref}\n className={radioIndicatorStyles({ intent, className })}\n {...others}\n />\n )\n}\n\nRadioIndicator.displayName = 'RadioGroup.RadioIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioInputVariants = cva(\n [\n 'flex shrink-0 items-center justify-center',\n 'rounded-full',\n 'border-md',\n 'outline-hidden',\n 'hover:ring-4',\n 'focus-visible:u-outline',\n 'disabled:cursor-not-allowed disabled:border-outline/dim-2 disabled:hover:ring-transparent',\n 'u-shadow-border-transition',\n 'size-sz-24',\n ],\n {\n variants: {\n /**\n * Color scheme of the radio input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['border-outline', 'data-[state=checked]:border-main', 'hover:ring-main-container'],\n support: [\n 'border-outline',\n 'data-[state=checked]:border-support',\n 'hover:ring-support-container',\n ],\n accent: [\n 'border-outline',\n 'data-[state=checked]:border-accent',\n 'hover:ring-accent-container',\n ],\n neutral: [\n 'border-outline',\n 'data-[state=checked]:border-neutral',\n 'hover:ring-neutral-container',\n ],\n info: ['border-info', 'data-[state=checked]:border-info', 'hover:ring-info-container'],\n success: [\n 'border-success',\n 'data-[state=checked]:border-success',\n 'hover:ring-success-container',\n ],\n alert: ['border-alert', 'data-[state=checked]:border-alert', 'hover:ring-alert-container'],\n error: ['border-error', 'data-[state=checked]:border-error', 'hover:ring-error-container'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { ButtonHTMLAttributes, Ref } from 'react'\n\nimport { RadioIndicator } from './RadioIndicator'\nimport { radioInputVariants, RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioInputProps\n extends RadioInputVariantsProps,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value given as data when submitted with a name.\n */\n value: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the radio item before the owning form can be submitted.\n */\n required?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const RadioInput = ({ intent: intentProp, className, ref, ...others }: RadioInputProps) => {\n const { state } = useFormFieldControl()\n\n const intent = state ?? intentProp\n\n return (\n <RadixRadioGroup.RadioGroupItem\n data-spark-component=\"radio-input\"\n ref={ref}\n className={radioInputVariants({ intent, className })}\n {...others}\n >\n <RadioIndicator intent={intent} forceMount />\n </RadixRadioGroup.RadioGroupItem>\n )\n}\n\nRadioInput.displayName = 'RadioGroup.RadioInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioLabelStyles = cva('grow', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type RadioLabelStylesProps = VariantProps<typeof radioLabelStyles>\n","import { Label } from 'radix-ui'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\nimport { radioLabelStyles, RadioLabelStylesProps } from './RadioLabel.styles'\n\nexport interface RadioLabelProps\n extends RadioLabelStylesProps,\n PropsWithChildren<HTMLAttributes<HTMLLabelElement>> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The id of the element the label is associated with.\n */\n htmlFor?: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n}\n\nexport const RadioLabel = ({ disabled, ...others }: RadioLabelProps) => {\n return (\n <Label.Root\n data-spark-component=\"radio-label\"\n className={radioLabelStyles({ disabled })}\n {...others}\n />\n )\n}\n\nRadioLabel.displayName = 'RadioGroup.RadioLabel'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useId } from 'react'\n\nimport { useRadioGroup } from './RadioGroupContext'\nimport { RadioInput, RadioInputProps } from './RadioInput'\nimport { RadioLabel } from './RadioLabel'\n\nexport type RadioProps = RadioInputProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nconst ID_PREFIX = ':radio'\n\nexport const Radio = ({\n className,\n children,\n id,\n disabled: disabledProp,\n ref,\n ...others\n}: RadioProps) => {\n const innerId = `${ID_PREFIX}-input-${useId()}`\n const innerLabelId = `${ID_PREFIX}-label-${useId()}`\n\n const { intent, disabled, reverse } = useRadioGroup()\n\n const radioLabel = children && (\n <RadioLabel disabled={disabledProp || disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </RadioLabel>\n )\n\n const radioInput = (\n <RadioInput\n ref={ref}\n id={id || innerId}\n intent={intent}\n aria-labelledby={children ? innerLabelId : undefined}\n {...others}\n disabled={disabledProp}\n />\n )\n\n const content = reverse ? (\n <>\n {radioLabel}\n {radioInput}\n </>\n ) : (\n <>\n {radioInput}\n {radioLabel}\n </>\n )\n\n return <span className={cx('gap-md text-body-1 flex items-start', className)}>{content}</span>\n}\n\nRadio.displayName = 'RadioGroup.Radio'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioGroupStyles = cva(['flex'], {\n variants: {\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['flex-row', 'gap-xl'],\n },\n },\n})\n\nexport type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>\n","import { ReactNode, useMemo } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport { RadioGroupContext } from './RadioGroupContext'\nimport type { RadioInputProps } from './RadioInput'\n\nexport interface RadioGroupProviderProps\n extends Pick<RadioInputProps, 'intent' | 'disabled'>,\n Pick<RadioGroupProps, 'reverse'> {\n children: ReactNode\n}\n\nexport const RadioGroupProvider = ({\n intent,\n disabled,\n reverse,\n children,\n}: RadioGroupProviderProps) => {\n const value = useMemo(() => ({ intent, disabled, reverse }), [intent, disabled, reverse])\n\n return <RadioGroupContext.Provider value={value}>{children}</RadioGroupContext.Provider>\n}\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { HTMLAttributes, Ref } from 'react'\n\nimport { radioGroupStyles, RadioGroupVariantsProps } from './RadioGroup.styles'\nimport { RadioGroupProvider } from './RadioGroupProvider'\nimport { RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioGroupProps\n extends RadioGroupVariantsProps,\n Pick<RadioInputVariantsProps, 'intent'>,\n Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.\n */\n defaultValue?: string\n /**\n * The controlled value of the radio item to check. Should be used in conjunction with onValueChange.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n /**\n * When true, prevents the user from interacting with radio items.\n */\n disabled?: boolean\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * When true, indicates that the user must check a radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The orientation of the component.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The reading direction of the radio group.\n */\n dir?: 'ltr' | 'rtl'\n /**\n * When true, keyboard navigation will loop from last item to first, and vice versa.\n */\n loop?: boolean\n /**\n * When true, the label will be placed on the left side of the Radio\n */\n reverse?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const RadioGroup = ({\n orientation = 'vertical',\n loop = true,\n intent = 'support',\n disabled,\n className,\n required: requiredProp,\n reverse = false,\n ref,\n ...others\n}: RadioGroupProps) => {\n const { labelId, isInvalid, isRequired, description, name } = useFormFieldControl()\n const required = requiredProp !== undefined ? requiredProp : isRequired\n\n return (\n <RadioGroupProvider reverse={reverse} intent={intent} disabled={disabled}>\n <RadixRadioGroup.RadioGroup\n data-spark-component=\"radio-group\"\n className={radioGroupStyles({ orientation, className })}\n name={name}\n ref={ref}\n disabled={disabled}\n orientation={orientation}\n loop={loop}\n required={required}\n aria-labelledby={labelId}\n aria-invalid={isInvalid}\n aria-required={required}\n aria-describedby={description}\n {...others}\n />\n </RadioGroupProvider>\n )\n}\n\nRadioGroup.displayName = 'RadioGroup'\n","import { Radio } from './Radio'\nimport { RadioGroup as Root } from './RadioGroup'\n\nexport const RadioGroup: typeof Root & {\n Radio: typeof Radio\n} = Object.assign(Root, {\n Radio,\n})\n\nRadioGroup.displayName = 'RadioGroup'\nRadio.displayName = 'RadioGroup.Radio'\n\nexport { type RadioGroupProps } from './RadioGroup'\nexport { type RadioProps } from './Radio'\n"],"names":["RadioGroupContext","createContext","useRadioGroup","context","useContext","radioIndicatorStyles","cva","makeVariants","RadioIndicator","intent","className","ref","others","jsx","RadixRadioGroup","radioInputVariants","RadioInput","intentProp","state","useFormFieldControl","radioLabelStyles","RadioLabel","disabled","Label","ID_PREFIX","Radio","children","id","disabledProp","innerId","useId","innerLabelId","reverse","radioLabel","radioInput","content","jsxs","Fragment","cx","radioGroupStyles","RadioGroupProvider","value","useMemo","RadioGroup","orientation","loop","requiredProp","labelId","isInvalid","isRequired","description","name","required","Root"],"mappings":";;;;;;AAQO,MAAMA,IAAoBC,EAA6C,IAAI,GAErEC,IAAgB,MAAM;AACjC,QAAMC,IAAUC,EAAWJ,CAAiB;AAE5C,MAAI,CAACG;AACH,UAAM,MAAM,yDAAyD;AAGvE,SAAOA;AACT,GCfaE,IAAuBC;AAAA,EAClC;AAAA,IACE;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,MACR,QAAQC,EAGN;AAAA,QACA,MAAM,CAAC,eAAe;AAAA,QACtB,SAAS,CAAC,kBAAkB;AAAA,QAC5B,QAAQ,CAAC,iBAAiB;AAAA,QAC1B,SAAS,CAAC,kBAAkB;AAAA,QAC5B,SAAS,CAAC,kBAAkB;AAAA,QAC5B,OAAO,CAAC,gBAAgB;AAAA,QACxB,OAAO,CAAC,gBAAgB;AAAA,QACxB,MAAM,CAAC,eAAe;AAAA,MAAA,CACvB;AAAA,IAAA;AAAA,IAEH,iBAAiB;AAAA,MACf,QAAQ;AAAA,IAAA;AAAA,EACV;AAEJ,GCnBaC,IAAiB,CAAC,EAAE,QAAAC,GAAQ,WAAAC,GAAW,KAAAC,GAAK,GAAGC,QAExD,gBAAAC;AAAA,EAACC,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAH;AAAA,IACA,WAAWN,EAAqB,EAAE,QAAAI,GAAQ,WAAAC,GAAW;AAAA,IACpD,GAAGE;AAAA,EAAA;AAAA;AAKVJ,EAAe,cAAc;ACzBtB,MAAMO,IAAqBT;AAAA,EAChC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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O;AAAA,MACA,mBAAiBL;AAAA,MACjB,gBAAcC;AAAA,MACd,iBAAeI;AAAA,MACf,oBAAkBF;AAAA,MACjB,GAAGtC;AAAA,IAAA;AAAA,EAAA,GAER;AAEJ;AAEA+B,EAAW,cAAc;AC3FlB,MAAMA,IAET,OAAO,OAAOU,GAAM;AAAA,EACtB,OAAA5B;AACF,CAAC;AAEDkB,EAAW,cAAc;AACzBlB,EAAM,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/radio-group/RadioGroupContext.tsx","../../src/radio-group/RadioIndicator.styles.ts","../../src/radio-group/RadioIndicator.tsx","../../src/radio-group/RadioInput.styles.ts","../../src/radio-group/RadioInput.tsx","../../src/radio-group/Radio.tsx","../../src/radio-group/RadioGroup.styles.ts","../../src/radio-group/RadioGroupProvider.tsx","../../src/radio-group/RadioGroup.tsx","../../src/radio-group/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport type { RadioInputProps } from './RadioInput'\n\nexport type RadioGroupContextState = Pick<RadioInputProps, 'intent' | 'disabled'> &\n Pick<RadioGroupProps, 'reverse'>\n\nexport const RadioGroupContext = createContext<RadioGroupContextState | null>(null)\n\nexport const useRadioGroup = () => {\n const context = useContext(RadioGroupContext)\n\n if (!context) {\n throw Error('useRadioGroup must be used within a RadioGroup provider')\n }\n\n return context\n}\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioIndicatorStyles = cva(\n [\n 'relative block',\n 'size-3/5',\n 'after:absolute',\n 'after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2',\n 'after:h-0',\n 'after:w-0',\n 'after:block',\n 'after:rounded-[50%]',\n \"after:content-['']\",\n 'after:transition-all',\n 'data-checked:after:size-full',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['after:bg-main'],\n support: ['after:bg-support'],\n accent: ['after:bg-accent'],\n neutral: ['after:bg-neutral'],\n success: ['after:bg-success'],\n alert: ['after:bg-alert'],\n error: ['after:bg-error'],\n info: ['after:bg-info'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioIndicatorStylesProps = VariantProps<typeof radioIndicatorStyles>\n","import { Radio } from '@base-ui/react/radio'\nimport { Ref } from 'react'\n\nimport { radioIndicatorStyles, RadioIndicatorStylesProps } from './RadioIndicator.styles'\n\nexport interface RadioIndicatorProps extends RadioIndicatorStylesProps {\n className?: string\n /**\n * Whether to keep the indicator mounted in the DOM when the radio is unchecked.\n * Useful when controlling animation with React animation libraries.\n */\n keepMounted?: boolean\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const RadioIndicator = ({\n intent,\n className,\n keepMounted,\n ref,\n ...others\n}: RadioIndicatorProps) => {\n return (\n <Radio.Indicator\n ref={ref}\n keepMounted={keepMounted}\n className={radioIndicatorStyles({ intent, className })}\n {...others}\n />\n )\n}\n\nRadioIndicator.displayName = 'RadioGroup.RadioIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioInputVariants = cva(\n [\n 'flex shrink-0 items-center justify-center',\n 'rounded-full',\n 'border-md',\n 'outline-hidden',\n 'hover:ring-4',\n 'focus-visible:u-outline',\n 'data-disabled:cursor-not-allowed data-disabled:border-outline/dim-2 data-disabled:hover:ring-transparent',\n 'u-shadow-border-transition',\n 'size-sz-24',\n ],\n {\n variants: {\n /**\n * Color scheme of the radio input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['border-outline', 'data-checked:border-main', 'hover:ring-main-container'],\n support: ['border-outline', 'data-checked:border-support', 'hover:ring-support-container'],\n accent: ['border-outline', 'data-checked:border-accent', 'hover:ring-accent-container'],\n neutral: ['border-outline', 'data-checked:border-neutral', 'hover:ring-neutral-container'],\n info: ['border-info', 'data-checked:border-info', 'hover:ring-info-container'],\n success: ['border-success', 'data-checked:border-success', 'hover:ring-success-container'],\n alert: ['border-alert', 'data-checked:border-alert', 'hover:ring-alert-container'],\n error: ['border-error', 'data-checked:border-error', 'hover:ring-error-container'],\n }),\n },\n defaultVariants: {\n intent: 'support',\n },\n }\n)\n\nexport type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>\n","import { Radio } from '@base-ui/react/radio'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { HTMLAttributes, ReactElement, Ref } from 'react'\n\nimport { RadioIndicator } from './RadioIndicator'\nimport { radioInputVariants, RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioInputProps\n extends RadioInputVariantsProps,\n Omit<HTMLAttributes<HTMLElement>, 'value' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * Uses Base UI's render prop internally to merge behaviour into the child element.\n */\n asChild?: boolean\n /**\n * The value given as data when submitted with a name.\n */\n value: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * Ref forwarded to the hidden `<input type=\"radio\">` rendered by Base UI.\n * Useful for programmatic activation (e.g. clicking from an associated label span).\n */\n inputRef?: Ref<HTMLInputElement>\n ref?: Ref<HTMLElement>\n /**\n * When true, the visual radio input (outer ring and inner dot) is visually hidden but remains\n * accessible in the DOM. Useful for custom radio appearances where only the label matters visually.\n * @default false\n */\n hideInput?: boolean\n}\n\nexport const RadioInput = ({\n intent: intentProp,\n className,\n asChild,\n children,\n inputRef,\n hideInput = false,\n ref,\n ...others\n}: RadioInputProps) => {\n const { state } = useFormFieldControl()\n\n const intent = state ?? intentProp\n\n return (\n <Radio.Root\n data-spark-component=\"radio-input\"\n ref={ref}\n inputRef={inputRef}\n render={asChild ? (children as ReactElement) : undefined}\n className={hideInput ? 'sr-only' : radioInputVariants({ intent, className })}\n {...others}\n >\n {!asChild && !hideInput && <RadioIndicator intent={intent} keepMounted />}\n </Radio.Root>\n )\n}\n\nRadioInput.displayName = 'RadioGroup.RadioInput'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useId } from 'react'\n\nimport { Label } from '../label'\nimport { useRadioGroup } from './RadioGroupContext'\nimport { RadioInput, RadioInputProps } from './RadioInput'\n\nexport type RadioProps = RadioInputProps & {\n ref?: Ref<HTMLElement>\n}\n\nconst ID_PREFIX = ':radio'\n\nexport const Radio = ({\n className,\n children,\n disabled: disabledProp,\n ref,\n ...others\n}: RadioProps) => {\n const innerLabelId = `${ID_PREFIX}-label-${useId()}`\n\n const { intent, disabled, reverse } = useRadioGroup()\n\n const isDisabled = disabledProp || disabled\n\n const radioLabel = children && (\n <Label\n data-spark-component=\"radio-label\"\n id={innerLabelId}\n className={cx(\n 'grow',\n isDisabled ? 'text-neutral/dim-2 cursor-not-allowed' : 'cursor-pointer'\n )}\n >\n {children}\n </Label>\n )\n\n const radioInput = (\n <RadioInput\n ref={ref}\n intent={intent}\n aria-labelledby={children ? innerLabelId : undefined}\n {...others}\n disabled={disabledProp}\n />\n )\n\n const content = reverse ? (\n <>\n {radioLabel}\n {radioInput}\n </>\n ) : (\n <>\n {radioInput}\n {radioLabel}\n </>\n )\n\n return <span className={cx('gap-md text-body-1 flex items-start', className)}>{content}</span>\n}\n\nRadio.displayName = 'RadioGroup.Radio'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioGroupStyles = cva(['flex'], {\n variants: {\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['flex-row', 'gap-xl'],\n },\n },\n})\n\nexport type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>\n","import { ReactNode, useMemo } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport { RadioGroupContext } from './RadioGroupContext'\nimport type { RadioInputProps } from './RadioInput'\n\nexport interface RadioGroupProviderProps\n extends Pick<RadioInputProps, 'intent' | 'disabled'>,\n Pick<RadioGroupProps, 'reverse'> {\n children: ReactNode\n}\n\nexport const RadioGroupProvider = ({\n intent,\n disabled,\n reverse,\n children,\n}: RadioGroupProviderProps) => {\n const value = useMemo(() => ({ intent, disabled, reverse }), [intent, disabled, reverse])\n\n return <RadioGroupContext.Provider value={value}>{children}</RadioGroupContext.Provider>\n}\n","import { RadioGroup as BaseUIRadioGroup } from '@base-ui/react/radio-group'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { HTMLAttributes, Ref } from 'react'\n\nimport { radioGroupStyles, RadioGroupVariantsProps } from './RadioGroup.styles'\nimport { RadioGroupProvider } from './RadioGroupProvider'\nimport { RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioGroupProps\n extends RadioGroupVariantsProps,\n Pick<RadioInputVariantsProps, 'intent'>,\n Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.\n */\n defaultValue?: string\n /**\n * The controlled value of the radio item to check. Should be used in conjunction with onValueChange.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n /**\n * When true, prevents the user from interacting with radio items.\n */\n disabled?: boolean\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * When true, indicates that the user must check a radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The orientation of the component.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The reading direction of the radio group.\n */\n dir?: 'ltr' | 'rtl'\n /**\n * When true, the label will be placed on the left side of the Radio\n */\n reverse?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const RadioGroup = ({\n orientation = 'vertical',\n intent = 'support',\n disabled,\n className,\n required: requiredProp,\n reverse = false,\n onValueChange: onValueChangeProp,\n ref,\n ...others\n}: RadioGroupProps) => {\n const { labelId, isInvalid, isRequired, description, name } = useFormFieldControl()\n const required = requiredProp !== undefined ? requiredProp : isRequired\n\n const handleValueChange = onValueChangeProp\n ? (value: unknown) => onValueChangeProp(value as string)\n : undefined\n\n return (\n <RadioGroupProvider reverse={reverse} intent={intent} disabled={disabled}>\n <BaseUIRadioGroup\n data-spark-component=\"radio-group\"\n className={radioGroupStyles({ orientation, className })}\n name={name}\n ref={ref}\n disabled={disabled}\n required={required}\n onValueChange={handleValueChange}\n aria-orientation={orientation}\n aria-labelledby={labelId}\n aria-invalid={isInvalid}\n aria-required={required}\n aria-describedby={description}\n {...others}\n />\n </RadioGroupProvider>\n )\n}\n\nRadioGroup.displayName = 'RadioGroup'\n","import { Radio } from './Radio'\nimport { RadioGroup as Root } from './RadioGroup'\n\nexport const RadioGroup: typeof Root & {\n Radio: typeof Radio\n} = Object.assign(Root, {\n Radio,\n})\n\nRadioGroup.displayName = 'RadioGroup'\nRadio.displayName = 'RadioGroup.Radio'\n\nexport { type RadioGroupProps } from './RadioGroup'\nexport { type RadioProps } from './Radio'\n"],"names":["RadioGroupContext","createContext","useRadioGroup","context","useContext","radioIndicatorStyles","cva","makeVariants","RadioIndicator","intent","className","keepMounted","ref","others","jsx","Radio","radioInputVariants","RadioInput","intentProp","asChild","children","inputRef","hideInput","state","useFormFieldControl","ID_PREFIX","disabledProp","innerLabelId","useId","disabled","reverse","radioLabel","Label","cx","radioInput","content","jsxs","Fragment","radioGroupStyles","RadioGroupProvider","value","useMemo","RadioGroup","orientation","requiredProp","onValueChangeProp","labelId","isInvalid","isRequired","description","name","required","handleValueChange","BaseUIRadioGroup","Root"],"mappings":";;;;;;;;AAQO,MAAMA,IAAoBC,EAA6C,IAAI,GAErEC,IAAgB,MAAM;AACjC,QAAMC,IAAUC,EAAWJ,CAAiB;AAE5C,MAAI,CAACG;AACH,UAAM,MAAM,yDAAyD;AAGvE,SAAOA;AACT,GCfaE,IAAuBC;AAAA,EAClC;AAAA,IACE;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AA,EACd,QAAAlC,IAAS;AAAA,EACT,UAAAoB;AAAA,EACA,WAAAnB;AAAA,EACA,UAAUkC;AAAA,EACV,SAAAd,IAAU;AAAA,EACV,eAAee;AAAA,EACf,KAAAjC;AAAA,EACA,GAAGC;AACL,MAAuB;AACrB,QAAM,EAAE,SAAAiC,GAAS,WAAAC,GAAW,YAAAC,GAAY,aAAAC,GAAa,MAAAC,EAAA,IAAS1B,EAAA,GACxD2B,IAAWP,MAAiB,SAAYA,IAAeI,GAEvDI,IAAoBP,IACtB,CAACL,MAAmBK,EAAkBL,CAAe,IACrD;AAEJ,SACE,gBAAA1B,EAACyB,GAAA,EAAmB,SAAAT,GAAkB,QAAArB,GAAgB,UAAAoB,GACpD,UAAA,gBAAAf;AAAA,IAACuC;AAAAA,IAAA;AAAA,MACC,wBAAqB;AAAA,MACrB,WAAWf,EAAiB,EAAE,aAAAK,GAAa,WAAAjC,GAAW;AAAA,MACtD,MAAAwC;AAAA,MACA,KAAAtC;AAAA,MACA,UAAAiB;AAAA,MACA,UAAAsB;AAAA,MACA,eAAeC;AAAA,MACf,oBAAkBT;AAAA,MAClB,mBAAiBG;AAAA,MACjB,gBAAcC;AAAA,MACd,iBAAeI;AAAA,MACf,oBAAkBF;AAAA,MACjB,GAAGpC;AAAA,IAAA;AAAA,EAAA,GAER;AAEJ;AAEA6B,EAAW,cAAc;AC3FlB,MAAMA,IAET,OAAO,OAAOY,GAAM;AAAA,EACtB,OAAAvC;AACF,CAAC;AAED2B,EAAW,cAAc;AACzB3B,EAAM,cAAc;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/components",
|
|
3
|
-
"version": "17.2.
|
|
3
|
+
"version": "17.2.1-beta.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.2.
|
|
58
|
-
"@spark-ui/icons": "^17.2.
|
|
59
|
-
"@spark-ui/internal-utils": "^17.2.
|
|
57
|
+
"@spark-ui/hooks": "^17.2.1-beta.1",
|
|
58
|
+
"@spark-ui/icons": "^17.2.1-beta.1",
|
|
59
|
+
"@spark-ui/internal-utils": "^17.2.1-beta.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",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes, PropsWithChildren } from 'react';
|
|
2
|
-
import { RadioLabelStylesProps } from './RadioLabel.styles';
|
|
3
|
-
export interface RadioLabelProps extends RadioLabelStylesProps, PropsWithChildren<HTMLAttributes<HTMLLabelElement>> {
|
|
4
|
-
/**
|
|
5
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
6
|
-
*/
|
|
7
|
-
asChild?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* The id of the element the label is associated with.
|
|
10
|
-
*/
|
|
11
|
-
htmlFor?: string;
|
|
12
|
-
/**
|
|
13
|
-
* When true, prevents the user from interacting with the radio item.
|
|
14
|
-
*/
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare const RadioLabel: {
|
|
18
|
-
({ disabled, ...others }: RadioLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
displayName: string;
|
|
20
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
export declare const radioLabelStyles: (props?: ({
|
|
3
|
-
disabled?: boolean | null | undefined;
|
|
4
|
-
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
5
|
-
export type RadioLabelStylesProps = VariantProps<typeof radioLabelStyles>;
|