@spark-ui/components 16.1.0 → 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Button-C3C0aixy.mjs → Button-DPncfbbM.mjs} +3 -3
- package/dist/{Button-C3C0aixy.mjs.map → Button-DPncfbbM.mjs.map} +1 -1
- package/dist/{Icon-Ck-dhfLd.mjs → Icon-C23-htlD.mjs} +2 -2
- package/dist/{Icon-Ck-dhfLd.mjs.map → Icon-C23-htlD.mjs.map} +1 -1
- package/dist/{IconButton-C62-axzv.mjs → IconButton-Bfd-6BAD.mjs} +2 -2
- package/dist/{IconButton-C62-axzv.mjs.map → IconButton-Bfd-6BAD.mjs.map} +1 -1
- package/dist/{Slot-D2Bbf8Gw.mjs → Slot-DLY1rJrG.mjs} +5 -5
- package/dist/{Slot-D2Bbf8Gw.mjs.map → Slot-DLY1rJrG.mjs.map} +1 -1
- package/dist/{Spinner-jF3-zoh_.mjs → Spinner-aLrtE2JN.mjs} +2 -2
- package/dist/{Spinner-jF3-zoh_.mjs.map → Spinner-aLrtE2JN.mjs.map} +1 -1
- package/dist/{TextLink-BuzFRWO6.mjs → TextLink-D7mOCjY_.mjs} +2 -2
- package/dist/{TextLink-BuzFRWO6.mjs.map → TextLink-D7mOCjY_.mjs.map} +1 -1
- package/dist/{VisuallyHidden-KH1biLx-.mjs → VisuallyHidden-DjlV0-CW.mjs} +7 -7
- package/dist/{VisuallyHidden-KH1biLx-.mjs.map → VisuallyHidden-DjlV0-CW.mjs.map} +1 -1
- package/dist/accordion/index.mjs +5 -5
- package/dist/alert-dialog/index.mjs +6 -6
- package/dist/avatar/index.mjs +4 -4
- package/dist/breadcrumb/index.mjs +3 -3
- package/dist/button/index.mjs +1 -1
- package/dist/card/index.mjs +1 -1
- package/dist/carousel/index.mjs +4 -4
- package/dist/checkbox/index.js +1 -1
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs +31 -31
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/chip/index.mjs +2 -2
- package/dist/collapsible/index.mjs +1 -1
- package/dist/combobox/index.mjs +4 -4
- package/dist/dialog/index.mjs +3 -3
- package/dist/drawer/index.mjs +3 -3
- package/dist/dropdown/index.mjs +2 -2
- package/dist/file-upload/index.mjs +4 -4
- package/dist/form-field/index.mjs +2 -2
- package/dist/icon/index.mjs +1 -1
- package/dist/icon-button/index.mjs +1 -1
- package/dist/input/index.mjs +10 -10
- package/dist/link-box/index.mjs +7 -7
- package/dist/pagination/index.mjs +3 -3
- package/dist/popover/index.mjs +2 -2
- package/dist/progress-tracker/index.mjs +1 -1
- package/dist/radio-group/index.js +1 -1
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +7 -7
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/rating/index.mjs +1 -1
- package/dist/rating-display/index.mjs +2 -2
- package/dist/scrolling-list/index.mjs +6 -6
- package/dist/select/index.mjs +1 -1
- package/dist/skeleton/index.mjs +1 -1
- package/dist/slider/index.mjs +9 -9
- package/dist/slot/index.mjs +1 -1
- package/dist/snackbar/index.mjs +3 -3
- package/dist/spinner/index.mjs +1 -1
- package/dist/stepper/index.mjs +2 -2
- package/dist/switch/index.mjs +1 -1
- package/dist/tabs/index.mjs +3 -3
- package/dist/tag/index.mjs +3 -3
- package/dist/text-link/index.mjs +1 -1
- package/dist/toast/index.mjs +10 -10
- package/dist/{useRenderSlot-LwWj8QbC.mjs → useRenderSlot-Bta2kdp4.mjs} +2 -2
- package/dist/{useRenderSlot-LwWj8QbC.mjs.map → useRenderSlot-Bta2kdp4.mjs.map} +1 -1
- package/dist/visually-hidden/index.mjs +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/checkbox/CheckboxInput.tsx","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroup.styles.ts","../../src/checkbox/CheckboxGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\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 * The value of the checkbox group.\n */\n value?: string[]\n /**\n * A set of ids separated by a space used to describe the input component given by a set of messages.\n */\n description?: string\n /**\n * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n basic: [\n 'text-on-basic',\n 'hover:ring-basic-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-basic data-[state=indeterminate]:bg-basic',\n 'data-[state=checked]:border-basic data-[state=checked]:bg-basic',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-success',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-alert',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-error',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-info',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = 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 LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </div>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked ? [...values, changed] : values.filter(val => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n"],"names":["CheckboxGroupContext","createContext","useCheckboxGroup","useContext","CheckboxIndicatorPrimitive","Checkbox","CheckboxIndicator","props","jsx","checkboxInputStyles","cva","makeVariants","CheckboxPrimitive","CheckboxInput","className","icon","Check","indeterminateIcon","Minus","intent","checked","ref","others","Icon","labelStyles","CheckboxLabel","disabled","Label","ID_PREFIX","idProp","intentProp","checkedProp","value","reverse","onCheckedChange","children","forwardedRef","checkboxId","useId","innerId","innerLabelId","field","useFormFieldControl","group","rootRef","useRef","useMergeRefs","getCheckboxAttributes","fieldState","groupState","checkboxIntent","name","isRequired","state","isInvalid","isFieldEnclosed","id","description","handleCheckedChange","isChecked","rootRefValue","isRequiredAttr","useMemo","checkboxLabel","checkboxInput","content","jsxs","Fragment","cx","checkboxGroupStyles","CheckboxGroup","nameProp","valueProp","defaultValue","orientation","onCheckedChangeProp","setValue","useCombinedState","onCheckedChangeRef","labelId","current","changed","values","modified","val","useEffect"],"mappings":"ggBA2CaA,EAAuBC,EAAAA,cAAkD,EAAE,EAE3EC,GAAmB,IACdC,EAAAA,WAAWH,CAAoB,EC3C3CI,GAA6BC,EAAAA,SAAS,kBAM/BC,EAAqBC,GAChCC,MAACJ,IAA2B,UAAU,6CAA8C,GAAGG,EAAO,EAGhGD,EAAkB,YAAc,oBCVzB,MAAMG,GAAsBC,EAAAA,IACjC,CACE,sFACA,2EACA,0BACA,oCACA,4BAAA,EAEF,CACE,SAAU,CAIR,OAAQC,GAAAA,aAGN,CACA,KAAM,CACJ,eACA,4BACA,wCACA,4EACA,+DAAA,EAEF,QAAS,CACP,kBACA,+BACA,wCACA,kFACA,qEAAA,EAEF,OAAQ,CACN,iBACA,8BACA,wCACA,gFACA,mEAAA,EAEF,MAAO,CACL,gBACA,6BACA,wCACA,8EACA,iEAAA,EAEF,QAAS,CACP,kBACA,+BACA,wCACA,kFACA,qEAAA,EAEF,MAAO,CACL,gBACA,6BACA,sCACA,8EACA,iEAAA,EAEF,MAAO,CACL,gBACA,6BACA,sCACA,8EACA,iEAAA,EAEF,KAAM,CACJ,eACA,4BACA,qCACA,4EACA,+DAAA,EAEF,QAAS,CACP,kBACA,+BACA,wCACA,kFACA,qEAAA,CACF,CACD,CAAA,EAEH,gBAAiB,CACf,OAAQ,OAAA,CACV,CAEJ,EC9EMC,GAAoBP,EAAAA,SAAS,SA4CtBQ,EAAgB,CAAC,CAC5B,UAAAC,EACA,KAAAC,QAAQC,GAAAA,MAAA,EAAM,EACd,kBAAAC,QAAqBC,GAAAA,MAAA,EAAM,EAC3B,OAAAC,EACA,QAAAC,EACA,IAAAC,EACA,GAAGC,CACL,IACEd,EAAAA,IAACI,GAAA,CACC,IAAAS,EACA,UAAWZ,GAAoB,CAAE,OAAAU,EAAQ,UAAAL,EAAW,EACpD,QAAAM,EACC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G,EAAaL,EAAYwB,EAAU3C,CAAO,CAAC,EAE1FoD,OAAAA,EAAAA,UAAU,IAAM,CACdP,EAAmB,QAAUH,CAC/B,EAAG,CAACA,CAAmB,CAAC,EAGtBnE,EAAAA,IAACR,EAAqB,SAArB,CAA8B,MAAOgF,EACpC,SAAAxE,EAAAA,IAAC,MAAA,CACC,IAAAa,EACA,UAAWgD,GAAoB,CAAE,UAAAvD,EAAW,YAAA4D,EAAa,EACzD,KAAK,QACL,kBAAiBK,EACjB,mBAAkBtB,EACjB,GAAGnC,EAEH,SAAAa,CAAA,CAAA,EAEL,CAEJ,EAEAmC,EAAc,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/checkbox/CheckboxInput.tsx","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroup.styles.ts","../../src/checkbox/CheckboxGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\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 * The value of the checkbox group.\n */\n value?: string[]\n /**\n * A set of ids separated by a space used to describe the input component given by a set of messages.\n */\n description?: string\n /**\n * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n basic: [\n 'text-on-basic',\n 'hover:ring-basic-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-basic data-[state=indeterminate]:bg-basic',\n 'data-[state=checked]:border-basic data-[state=checked]:bg-basic',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-success',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-alert',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-error',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-info',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = 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 LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <span\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </span>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked ? [...values, changed] : values.filter(val => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n"],"names":["CheckboxGroupContext","createContext","useCheckboxGroup","useContext","CheckboxIndicatorPrimitive","Checkbox","CheckboxIndicator","props","jsx","checkboxInputStyles","cva","makeVariants","CheckboxPrimitive","CheckboxInput","className","icon","Check","indeterminateIcon","Minus","intent","checked","ref","others","Icon","labelStyles","CheckboxLabel","disabled","Label","ID_PREFIX","idProp","intentProp","checkedProp","value","reverse","onCheckedChange","children","forwardedRef","checkboxId","useId","innerId","innerLabelId","field","useFormFieldControl","group","rootRef","useRef","useMergeRefs","getCheckboxAttributes","fieldState","groupState","checkboxIntent","name","isRequired","state","isInvalid","isFieldEnclosed","id","description","handleCheckedChange","isChecked","rootRefValue","isRequiredAttr","useMemo","checkboxLabel","checkboxInput","content","jsxs","Fragment","cx","checkboxGroupStyles","CheckboxGroup","nameProp","valueProp","defaultValue","orientation","onCheckedChangeProp","setValue","useCombinedState","onCheckedChangeRef","labelId","current","changed","values","modified","val","useEffect"],"mappings":"ggBA2CaA,EAAuBC,EAAAA,cAAkD,EAAE,EAE3EC,GAAmB,IACdC,EAAAA,WAAWH,CAAoB,EC3C3CI,GAA6BC,EAAAA,SAAS,kBAM/BC,EAAqBC,GAChCC,MAACJ,IAA2B,UAAU,6CAA8C,GAAGG,EAAO,EAGhGD,EAAkB,YAAc,oBCVzB,MAAMG,GAAsBC,EAAAA,IACjC,CACE,sFACA,2EACA,0BACA,oCACA,4BAAA,EAEF,CACE,SAAU,CAIR,OAAQC,GAAAA,aAGN,CACA,KAAM,CACJ,eACA,4BACA,wCACA,4EACA,+DAAA,EAEF,QAAS,CACP,kBACA,+BACA,wCACA,kFACA,qEAAA,EAEF,OAAQ,CACN,iBACA,8BACA,wCACA,gFACA,mEAAA,EAEF,MAAO,CACL,gBACA,6BACA,wCACA,8EACA,iEAAA,EAEF,QAAS,CACP,kBACA,+BACA,wCACA,kFACA,qEAAA,EAEF,MAAO,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I,QAAAuB,EAAS,YAAAtB,EAAa,MAAAJ,EAAO,UAAAC,EAAW,WAAAF,GAAeX,EAC7DU,EAAOoB,GAAY9B,EAAM,KAEzBuC,EAAUlB,EAAAA,QAAQ,KAYf,CACL,GAAAN,EACA,KAAAL,EACA,MAAAnB,EACA,OAAAb,EACA,MAAAkC,EACA,UAAAC,EACA,YAAAG,EACA,WAAAL,EACA,QAAAnB,EACA,gBArB0B,CAACb,EAAkB6D,IAAoB,CACjE,MAAMC,EAASlD,GAAS,CAAA,EAClBmD,EAAW/D,EAAU,CAAC,GAAG8D,EAAQD,CAAO,EAAIC,EAAO,OAAOE,GAAOA,IAAQH,CAAO,EAEtFL,EAASO,CAAQ,EAEbL,EAAmB,SACrBA,EAAmB,QAAQK,CAAQ,CAEvC,CAYmB,GAElB,CAAC3B,EAAIL,EAAMnB,EAAOb,EAAQkC,EAAOC,EAAWG,EAAaL,EAAYwB,EAAU3C,CAAO,CAAC,EAE1FoD,OAAAA,EAAAA,UAAU,IAAM,CACdP,EAAmB,QAAUH,CAC/B,EAAG,CAACA,CAAmB,CAAC,EAGtBnE,EAAAA,IAACR,EAAqB,SAArB,CAA8B,MAAOgF,EACpC,SAAAxE,EAAAA,IAAC,MAAA,CACC,IAAAa,EACA,UAAWgD,GAAoB,CAAE,UAAAvD,EAAW,YAAA4D,EAAa,EACzD,KAAK,QACL,kBAAiBK,EACjB,mBAAkBtB,EACjB,GAAGnC,EAEH,SAAAa,CAAA,CAAA,EAEL,CAEJ,EAEAmC,EAAc,YAAc"}
|
package/dist/checkbox/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import { useFormFieldControl as D } from "@spark-ui/components/form-field";
|
|
|
3
3
|
import { useMergeRefs as ae } from "@spark-ui/hooks/use-merge-refs";
|
|
4
4
|
import { cva as V, cx as re } from "class-variance-authority";
|
|
5
5
|
import { createContext as ne, useContext as oe, useId as A, useRef as X, useMemo as _, useEffect as ce } from "react";
|
|
6
|
-
import { Check as
|
|
7
|
-
import { Minus as
|
|
6
|
+
import { Check as se } from "@spark-ui/icons/Check";
|
|
7
|
+
import { Minus as ie } from "@spark-ui/icons/Minus";
|
|
8
8
|
import { Checkbox as B } from "radix-ui";
|
|
9
|
-
import { I as de } from "../Icon-
|
|
9
|
+
import { I as de } from "../Icon-C23-htlD.mjs";
|
|
10
10
|
import { makeVariants as le } from "@spark-ui/internal-utils";
|
|
11
11
|
import { Label as be } from "../label/index.mjs";
|
|
12
12
|
import { useCombinedState as ue } from "@spark-ui/hooks/use-combined-state";
|
|
@@ -95,26 +95,26 @@ const ke = V(
|
|
|
95
95
|
intent: "basic"
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
),
|
|
98
|
+
), pe = B.Checkbox, K = ({
|
|
99
99
|
className: a,
|
|
100
|
-
icon: c = /* @__PURE__ */ e(
|
|
101
|
-
indeterminateIcon: b = /* @__PURE__ */ e(
|
|
100
|
+
icon: c = /* @__PURE__ */ e(se, {}),
|
|
101
|
+
indeterminateIcon: b = /* @__PURE__ */ e(ie, {}),
|
|
102
102
|
intent: u,
|
|
103
103
|
checked: n,
|
|
104
|
-
ref:
|
|
105
|
-
...
|
|
104
|
+
ref: i,
|
|
105
|
+
...s
|
|
106
106
|
}) => /* @__PURE__ */ e(
|
|
107
|
-
|
|
107
|
+
pe,
|
|
108
108
|
{
|
|
109
|
-
ref:
|
|
109
|
+
ref: i,
|
|
110
110
|
className: ke({ intent: u, className: a }),
|
|
111
111
|
checked: n,
|
|
112
|
-
...
|
|
112
|
+
...s,
|
|
113
113
|
children: /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(de, { size: "sm", children: n === "indeterminate" ? b : c }) })
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
116
|
K.displayName = "CheckboxInput";
|
|
117
|
-
const
|
|
117
|
+
const xe = V("grow", {
|
|
118
118
|
variants: {
|
|
119
119
|
disabled: {
|
|
120
120
|
true: ["text-neutral/dim-2", "cursor-not-allowed"],
|
|
@@ -124,7 +124,7 @@ const pe = V("grow", {
|
|
|
124
124
|
defaultVariants: {
|
|
125
125
|
disabled: !1
|
|
126
126
|
}
|
|
127
|
-
}), O = ({ disabled: a, ...c }) => /* @__PURE__ */ e(be, { className:
|
|
127
|
+
}), O = ({ disabled: a, ...c }) => /* @__PURE__ */ e(be, { className: xe({ disabled: a }), ...c });
|
|
128
128
|
O.displayName = "CheckboxLabel";
|
|
129
129
|
const P = ":checkbox", fe = ({
|
|
130
130
|
id: a,
|
|
@@ -132,14 +132,14 @@ const P = ":checkbox", fe = ({
|
|
|
132
132
|
intent: b,
|
|
133
133
|
checked: u,
|
|
134
134
|
value: n,
|
|
135
|
-
disabled:
|
|
136
|
-
reverse:
|
|
135
|
+
disabled: i,
|
|
136
|
+
reverse: s = !1,
|
|
137
137
|
onCheckedChange: g,
|
|
138
138
|
children: h,
|
|
139
139
|
ref: F,
|
|
140
140
|
...z
|
|
141
141
|
}) => {
|
|
142
|
-
const m = `${P}-${A()}`, k = a || m,
|
|
142
|
+
const m = `${P}-${A()}`, k = a || m, p = `${P}-${A()}`, d = D(), t = he(), v = X(null), x = ae(F, v), C = ({
|
|
143
143
|
fieldState: r,
|
|
144
144
|
groupState: o,
|
|
145
145
|
checkboxIntent: T
|
|
@@ -161,24 +161,24 @@ const P = ":checkbox", fe = ({
|
|
|
161
161
|
fieldState: d,
|
|
162
162
|
groupState: t,
|
|
163
163
|
checkboxIntent: b
|
|
164
|
-
}), N = _(() => t ? l ? !t.value?.length : !1 : l, [t, l]), q = h && /* @__PURE__ */ e(O, { disabled:
|
|
164
|
+
}), N = _(() => t ? l ? !t.value?.length : !1 : l, [t, l]), q = h && /* @__PURE__ */ e(O, { disabled: i, htmlFor: f || k, id: p, children: h }), j = /* @__PURE__ */ e(
|
|
165
165
|
K,
|
|
166
166
|
{
|
|
167
|
-
ref:
|
|
167
|
+
ref: x,
|
|
168
168
|
id: f || k,
|
|
169
169
|
name: G,
|
|
170
170
|
value: n,
|
|
171
171
|
intent: R,
|
|
172
172
|
checked: I,
|
|
173
|
-
disabled:
|
|
173
|
+
disabled: i,
|
|
174
174
|
required: N,
|
|
175
175
|
"aria-describedby": L,
|
|
176
176
|
"aria-invalid": $,
|
|
177
177
|
onCheckedChange: y,
|
|
178
|
-
"aria-labelledby": h ?
|
|
178
|
+
"aria-labelledby": h ? p : d.labelId,
|
|
179
179
|
...z
|
|
180
180
|
}
|
|
181
|
-
), Q = t.reverse ||
|
|
181
|
+
), Q = t.reverse || s ? /* @__PURE__ */ E(M, { children: [
|
|
182
182
|
q,
|
|
183
183
|
j
|
|
184
184
|
] }) : /* @__PURE__ */ E(M, { children: [
|
|
@@ -186,7 +186,7 @@ const P = ":checkbox", fe = ({
|
|
|
186
186
|
q
|
|
187
187
|
] });
|
|
188
188
|
return /* @__PURE__ */ e(
|
|
189
|
-
"
|
|
189
|
+
"span",
|
|
190
190
|
{
|
|
191
191
|
"data-spark-component": "checkbox",
|
|
192
192
|
className: re("gap-md text-body-1 relative flex items-start", c),
|
|
@@ -211,38 +211,38 @@ const ge = V(["flex"], {
|
|
|
211
211
|
defaultValue: b,
|
|
212
212
|
className: u,
|
|
213
213
|
intent: n,
|
|
214
|
-
orientation:
|
|
215
|
-
onCheckedChange:
|
|
214
|
+
orientation: i = "vertical",
|
|
215
|
+
onCheckedChange: s,
|
|
216
216
|
reverse: g = !1,
|
|
217
217
|
children: h,
|
|
218
218
|
ref: F,
|
|
219
219
|
...z
|
|
220
220
|
}) => {
|
|
221
|
-
const [m, k] = ue(c, b),
|
|
221
|
+
const [m, k] = ue(c, b), p = D(), d = X(s), { id: t, labelId: v, description: x, state: C, isInvalid: I, isRequired: y } = p, f = a ?? p.name, G = _(() => ({
|
|
222
222
|
id: t,
|
|
223
223
|
name: f,
|
|
224
224
|
value: m,
|
|
225
225
|
intent: n,
|
|
226
226
|
state: C,
|
|
227
227
|
isInvalid: I,
|
|
228
|
-
description:
|
|
228
|
+
description: x,
|
|
229
229
|
isRequired: y,
|
|
230
230
|
reverse: g,
|
|
231
231
|
onCheckedChange: (L, R) => {
|
|
232
232
|
const l = m || [], N = L ? [...l, R] : l.filter((q) => q !== R);
|
|
233
233
|
k(N), d.current && d.current(N);
|
|
234
234
|
}
|
|
235
|
-
}), [t, f, m, n, C, I,
|
|
235
|
+
}), [t, f, m, n, C, I, x, y, k, g]);
|
|
236
236
|
return ce(() => {
|
|
237
|
-
d.current =
|
|
238
|
-
}, [
|
|
237
|
+
d.current = s;
|
|
238
|
+
}, [s]), /* @__PURE__ */ e(H.Provider, { value: G, children: /* @__PURE__ */ e(
|
|
239
239
|
"div",
|
|
240
240
|
{
|
|
241
241
|
ref: F,
|
|
242
|
-
className: ge({ className: u, orientation:
|
|
242
|
+
className: ge({ className: u, orientation: i }),
|
|
243
243
|
role: "group",
|
|
244
244
|
"aria-labelledby": v,
|
|
245
|
-
"aria-describedby":
|
|
245
|
+
"aria-describedby": x,
|
|
246
246
|
...z,
|
|
247
247
|
children: h
|
|
248
248
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/checkbox/CheckboxInput.tsx","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroup.styles.ts","../../src/checkbox/CheckboxGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\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 * The value of the checkbox group.\n */\n value?: string[]\n /**\n * A set of ids separated by a space used to describe the input component given by a set of messages.\n */\n description?: string\n /**\n * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n basic: [\n 'text-on-basic',\n 'hover:ring-basic-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-basic data-[state=indeterminate]:bg-basic',\n 'data-[state=checked]:border-basic data-[state=checked]:bg-basic',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-success',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-alert',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-error',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-info',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = 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 LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </div>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked ? [...values, changed] : values.filter(val => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n"],"names":["CheckboxGroupContext","createContext","useCheckboxGroup","useContext","CheckboxIndicatorPrimitive","Checkbox","CheckboxIndicator","props","jsx","checkboxInputStyles","cva","makeVariants","CheckboxPrimitive","CheckboxInput","className","icon","Check","indeterminateIcon","Minus","intent","checked","ref","others","Icon","labelStyles","CheckboxLabel","disabled","Label","ID_PREFIX","idProp","intentProp","checkedProp","value","reverse","onCheckedChange","children","forwardedRef","checkboxId","useId","innerId","innerLabelId","field","useFormFieldControl","group","rootRef","useRef","useMergeRefs","getCheckboxAttributes","fieldState","groupState","checkboxIntent","name","isRequired","state","isInvalid","isFieldEnclosed","id","description","handleCheckedChange","isChecked","rootRefValue","isRequiredAttr","useMemo","checkboxLabel","checkboxInput","content","jsxs","Fragment","cx","checkboxGroupStyles","CheckboxGroup","nameProp","valueProp","defaultValue","orientation","onCheckedChangeProp","setValue","useCombinedState","onCheckedChangeRef","labelId","current","changed","values","modified","val","useEffect"],"mappings":";;;;;;;;;;;;AA2CO,MAAMA,IAAuBC,GAAkD,EAAE,GAE3EC,KAAmB,MACdC,GAAWH,CAAoB,GC3C3CI,KAA6BC,EAAS,mBAM/BC,IAAoB,CAACC,MAChC,gBAAAC,EAACJ,MAA2B,WAAU,8CAA8C,GAAGG,GAAO;AAGhGD,EAAkB,cAAc;ACVzB,MAAMG,KAAsBC;AAAA,EACjC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,UAAU;A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,MAAeX,GAC7DU,IAAOoB,KAAY9B,EAAM,MAEzBuC,IAAUlB,EAAQ,OAYf;AAAA,IACL,IAAAN;AAAA,IACA,MAAAL;AAAA,IACA,OAAAnB;AAAA,IACA,QAAAb;AAAA,IACA,OAAAkC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAG;AAAA,IACA,YAAAL;AAAA,IACA,SAAAnB;AAAA,IACA,iBArB0B,CAACb,GAAkB6D,MAAoB;AACjE,YAAMC,IAASlD,KAAS,CAAA,GAClBmD,IAAW/D,IAAU,CAAC,GAAG8D,GAAQD,CAAO,IAAIC,EAAO,OAAO,CAAAE,MAAOA,MAAQH,CAAO;AAEtF,MAAAL,EAASO,CAAQ,GAEbL,EAAmB,WACrBA,EAAmB,QAAQK,CAAQ;AAAA,IAEvC;AAAA,EAYmB,IAElB,CAAC3B,GAAIL,GAAMnB,GAAOb,GAAQkC,GAAOC,GAAWG,GAAaL,GAAYwB,GAAU3C,CAAO,CAAC;AAE1F,SAAAoD,GAAU,MAAM;AACd,IAAAP,EAAmB,UAAUH;AAAA,EAC/B,GAAG,CAACA,CAAmB,CAAC,GAGtB,gBAAAnE,EAACR,EAAqB,UAArB,EAA8B,OAAOgF,GACpC,UAAA,gBAAAxE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAa;AAAA,MACA,WAAWgD,GAAoB,EAAE,WAAAvD,GAAW,aAAA4D,GAAa;AAAA,MACzD,MAAK;AAAA,MACL,mBAAiBK;AAAA,MACjB,oBAAkBtB;AAAA,MACjB,GAAGnC;AAAA,MAEH,UAAAa;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAEAmC,GAAc,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/checkbox/CheckboxInput.tsx","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroup.styles.ts","../../src/checkbox/CheckboxGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\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 * The value of the checkbox group.\n */\n value?: string[]\n /**\n * A set of ids separated by a space used to describe the input component given by a set of messages.\n */\n description?: string\n /**\n * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n basic: [\n 'text-on-basic',\n 'hover:ring-basic-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-basic data-[state=indeterminate]:bg-basic',\n 'data-[state=checked]:border-basic data-[state=checked]:bg-basic',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-success',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-alert',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-error',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-info',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = 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 LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <span\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </span>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked ? [...values, changed] : values.filter(val => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n"],"names":["CheckboxGroupContext","createContext","useCheckboxGroup","useContext","CheckboxIndicatorPrimitive","Checkbox","CheckboxIndicator","props","jsx","checkboxInputStyles","cva","makeVariants","CheckboxPrimitive","CheckboxInput","className","icon","Check","indeterminateIcon","Minus","intent","checked","ref","others","Icon","labelStyles","CheckboxLabel","disabled","Label","ID_PREFIX","idProp","intentProp","checkedProp","value","reverse","onCheckedChange","children","forwardedRef","checkboxId","useId","innerId","innerLabelId","field","useFormFieldControl","group","rootRef","useRef","useMergeRefs","getCheckboxAttributes","fieldState","groupState","checkboxIntent","name","isRequired","state","isInvalid","isFieldEnclosed","id","description","handleCheckedChange","isChecked","rootRefValue","isRequiredAttr","useMemo","checkboxLabel","checkboxInput","content","jsxs","Fragment","cx","checkboxGroupStyles","CheckboxGroup","nameProp","valueProp","defaultValue","orientation","onCheckedChangeProp","setValue","useCombinedState","onCheckedChangeRef","labelId","current","changed","values","modified","val","useEffect"],"mappings":";;;;;;;;;;;;AA2CO,MAAMA,IAAuBC,GAAkD,EAAE,GAE3EC,KAAmB,MACdC,GAAWH,CAAoB,GC3C3CI,KAA6BC,EAAS,mBAM/BC,IAAoB,CAACC,MAChC,gBAAAC,EAACJ,MAA2B,WAAU,8CAA8C,GAAGG,GAAO;AAGhGD,EAAkB,cAAc;ACVzB,MAAMG,KAAsBC;AAAA,EACjC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,UAAU;AAAA;AAAA;AAAA;AAAA,MAIR,QAAQC,GAGN;AAAA,QACA,MAAM;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,SAAS;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,QAAQ;AAAA,UACN;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,SAAS;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,MAAM;AAAA,UACJ;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,SAAS;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF,CACD;AAAA,I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WgD,GAAoB,EAAE,WAAAvD,GAAW,aAAA4D,GAAa;AAAA,MACzD,MAAK;AAAA,MACL,mBAAiBK;AAAA,MACjB,oBAAkBtB;AAAA,MACjB,GAAGnC;AAAA,MAEH,UAAAa;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAEAmC,GAAc,cAAc;"}
|
package/dist/chip/index.mjs
CHANGED
|
@@ -4,9 +4,9 @@ import { cva as B, cx as C } from "class-variance-authority";
|
|
|
4
4
|
import { createContext as H, useContext as K, Children as O, isValidElement as W, useCallback as q, cloneElement as G } from "react";
|
|
5
5
|
import { useCombinedState as V } from "@spark-ui/hooks/use-combined-state";
|
|
6
6
|
import { emulateTab as k } from "emulate-tab";
|
|
7
|
-
import {
|
|
7
|
+
import { S as L } from "../Slot-DLY1rJrG.mjs";
|
|
8
8
|
import { Close as J } from "@spark-ui/icons/Close";
|
|
9
|
-
import { I as M } from "../Icon-
|
|
9
|
+
import { I as M } from "../Icon-C23-htlD.mjs";
|
|
10
10
|
const Q = [
|
|
11
11
|
/** Intents **/
|
|
12
12
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { Collapsible as n } from "@base-ui/react/collapsible";
|
|
3
3
|
import { cx as m } from "class-variance-authority";
|
|
4
|
-
import {
|
|
4
|
+
import { S as b } from "../Slot-DLY1rJrG.mjs";
|
|
5
5
|
function r(e, o) {
|
|
6
6
|
const l = e ? b : o;
|
|
7
7
|
return e ? ({ ...t }) => /* @__PURE__ */ a(l, { ...t }) : void 0;
|
package/dist/combobox/index.mjs
CHANGED
|
@@ -6,13 +6,13 @@ import { Children as B, isValidElement as z, createContext as ne, useRef as A, u
|
|
|
6
6
|
import { Popover as K } from "../popover/index.mjs";
|
|
7
7
|
import { DeleteOutline as Ae } from "@spark-ui/icons/DeleteOutline";
|
|
8
8
|
import { cx as f, cva as Me } from "class-variance-authority";
|
|
9
|
-
import { I as $ } from "../Icon-
|
|
9
|
+
import { I as $ } from "../Icon-C23-htlD.mjs";
|
|
10
10
|
import { useMergeRefs as W } from "@spark-ui/hooks/use-merge-refs";
|
|
11
11
|
import { ArrowHorizontalDown as dt } from "@spark-ui/icons/ArrowHorizontalDown";
|
|
12
|
-
import { I as ut } from "../IconButton-
|
|
13
|
-
import { V as mt } from "../VisuallyHidden-
|
|
12
|
+
import { I as ut } from "../IconButton-Bfd-6BAD.mjs";
|
|
13
|
+
import { V as mt } from "../VisuallyHidden-DjlV0-CW.mjs";
|
|
14
14
|
import { Check as pt } from "@spark-ui/icons/Check";
|
|
15
|
-
import { S as bt } from "../Spinner-
|
|
15
|
+
import { S as bt } from "../Spinner-aLrtE2JN.mjs";
|
|
16
16
|
function Fe(e, o) {
|
|
17
17
|
let t = 0;
|
|
18
18
|
for (const [n] of e.entries()) {
|
package/dist/dialog/index.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import { createContext as B, useState as I, useContext as P, useRef as R, useEff
|
|
|
4
4
|
import { useMergeRefs as O } from "@spark-ui/hooks/use-merge-refs";
|
|
5
5
|
import { useScrollOverflow as T } from "@spark-ui/hooks/use-scroll-overflow";
|
|
6
6
|
import { cx as s } from "class-variance-authority";
|
|
7
|
-
import { u as g } from "../useRenderSlot-
|
|
7
|
+
import { u as g } from "../useRenderSlot-Bta2kdp4.mjs";
|
|
8
8
|
import { Close as $ } from "@spark-ui/icons/Close";
|
|
9
|
-
import { I as H } from "../Icon-
|
|
10
|
-
import { I as j } from "../IconButton-
|
|
9
|
+
import { I as H } from "../Icon-C23-htlD.mjs";
|
|
10
|
+
import { I as j } from "../IconButton-Bfd-6BAD.mjs";
|
|
11
11
|
import { d as z } from "../DialogContent.styles-Du7_Dkde.mjs";
|
|
12
12
|
const u = B(null), E = ({
|
|
13
13
|
children: o,
|
package/dist/drawer/index.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import { createContext as B, useContext as T, useRef as P } from "react";
|
|
|
4
4
|
import { useMergeRefs as O } from "@spark-ui/hooks/use-merge-refs";
|
|
5
5
|
import { useScrollOverflow as S } from "@spark-ui/hooks/use-scroll-overflow";
|
|
6
6
|
import { cva as v, cx as i } from "class-variance-authority";
|
|
7
|
-
import { u as z } from "../useRenderSlot-
|
|
7
|
+
import { u as z } from "../useRenderSlot-Bta2kdp4.mjs";
|
|
8
8
|
import { Close as R } from "@spark-ui/icons/Close";
|
|
9
|
-
import { I as F } from "../Icon-
|
|
10
|
-
import { I } from "../IconButton-
|
|
9
|
+
import { I as F } from "../Icon-C23-htlD.mjs";
|
|
10
|
+
import { I } from "../IconButton-Bfd-6BAD.mjs";
|
|
11
11
|
const C = B(null), H = ({
|
|
12
12
|
children: e,
|
|
13
13
|
withFade: a = !1
|
package/dist/dropdown/index.mjs
CHANGED
|
@@ -6,9 +6,9 @@ import { useMultipleSelection as Ce, useSelect as x } from "downshift";
|
|
|
6
6
|
import { cx as w, cva as ie } from "class-variance-authority";
|
|
7
7
|
import { useMergeRefs as G } from "@spark-ui/hooks/use-merge-refs";
|
|
8
8
|
import { Check as Te } from "@spark-ui/icons/Check";
|
|
9
|
-
import { I as R } from "../Icon-
|
|
9
|
+
import { I as R } from "../Icon-C23-htlD.mjs";
|
|
10
10
|
import { ArrowHorizontalDown as Se } from "@spark-ui/icons/ArrowHorizontalDown";
|
|
11
|
-
import { V as Ee } from "../VisuallyHidden-
|
|
11
|
+
import { V as Ee } from "../VisuallyHidden-DjlV0-CW.mjs";
|
|
12
12
|
const ke = ({
|
|
13
13
|
itemsMap: e,
|
|
14
14
|
defaultValue: o,
|
|
@@ -7,13 +7,13 @@ import { FilePdfOutline as Le } from "@spark-ui/icons/FilePdfOutline";
|
|
|
7
7
|
import { ImageOutline as Ne } from "@spark-ui/icons/ImageOutline";
|
|
8
8
|
import { PlayOutline as xe } from "@spark-ui/icons/PlayOutline";
|
|
9
9
|
import { cx as _ } from "class-variance-authority";
|
|
10
|
-
import { I as K } from "../Icon-
|
|
10
|
+
import { I as K } from "../Icon-C23-htlD.mjs";
|
|
11
11
|
import { Progress as Ee } from "../progress/index.mjs";
|
|
12
12
|
import { Close as ce } from "@spark-ui/icons/Close";
|
|
13
|
-
import { I as ue } from "../IconButton-
|
|
13
|
+
import { I as ue } from "../IconButton-Bfd-6BAD.mjs";
|
|
14
14
|
import { WarningOutline as je } from "@spark-ui/icons/WarningOutline";
|
|
15
|
-
import { b as Te, B as De } from "../Button-
|
|
16
|
-
import {
|
|
15
|
+
import { b as Te, B as De } from "../Button-DPncfbbM.mjs";
|
|
16
|
+
import { S as Oe } from "../Slot-DLY1rJrG.mjs";
|
|
17
17
|
const O = {
|
|
18
18
|
/**
|
|
19
19
|
* Exceeds the maxFiles limit
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as r, jsxs as N, Fragment as H } from "react/jsx-runtime";
|
|
2
2
|
import { cx as c } from "class-variance-authority";
|
|
3
3
|
import { createContext as D, useContext as L, useId as I, useState as P, useCallback as q, useMemo as W, useEffect as z } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { S as X, a as _ } from "../Slot-DLY1rJrG.mjs";
|
|
5
5
|
import { AlertOutline as B } from "@spark-ui/icons/AlertOutline";
|
|
6
6
|
import { Check as G } from "@spark-ui/icons/Check";
|
|
7
7
|
import { WarningOutline as J } from "@spark-ui/icons/WarningOutline";
|
|
8
|
-
import { I as M } from "../Icon-
|
|
8
|
+
import { I as M } from "../Icon-C23-htlD.mjs";
|
|
9
9
|
import { Label as K } from "../label/index.mjs";
|
|
10
10
|
import { F as y } from "../FormFieldRequiredIndicator-DTnCGiX2.mjs";
|
|
11
11
|
const C = D(null), x = ":form-field", b = () => {
|
package/dist/icon/index.mjs
CHANGED
package/dist/input/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as l, jsxs as F } from "react/jsx-runtime";
|
|
2
2
|
import { DeleteOutline as le } from "@spark-ui/icons/DeleteOutline";
|
|
3
|
-
import { cx as g, cva as
|
|
4
|
-
import { I as K } from "../Icon-
|
|
3
|
+
import { cx as g, cva as S } from "class-variance-authority";
|
|
4
|
+
import { I as K } from "../Icon-C23-htlD.mjs";
|
|
5
5
|
import { createContext as ie, useContext as de, Children as P, isValidElement as ue, useRef as M, useCallback as ce, useMemo as pe, useEffect as fe, cloneElement as ge } from "react";
|
|
6
6
|
import { useFormFieldControl as H } from "@spark-ui/components/form-field";
|
|
7
7
|
import { useCombinedState as me } from "@spark-ui/hooks/use-combined-state";
|
|
8
8
|
import { useMergeRefs as he } from "@spark-ui/hooks/use-merge-refs";
|
|
9
|
-
import {
|
|
9
|
+
import { S as J } from "../Slot-DLY1rJrG.mjs";
|
|
10
10
|
const Q = ie(null), v = () => de(Q) || { isStandalone: !0 }, U = ({
|
|
11
11
|
className: n,
|
|
12
12
|
tabIndex: e = -1,
|
|
@@ -42,7 +42,7 @@ const Q = ie(null), v = () => de(Q) || { isStandalone: !0 }, U = ({
|
|
|
42
42
|
id: "ClearButton"
|
|
43
43
|
});
|
|
44
44
|
U.displayName = "InputGroup.ClearButton";
|
|
45
|
-
const Ie =
|
|
45
|
+
const Ie = S(["relative inline-flex w-full"], {
|
|
46
46
|
variants: {
|
|
47
47
|
/**
|
|
48
48
|
* When `true`, prevents the user from interacting.
|
|
@@ -145,7 +145,7 @@ const Ie = E(["relative inline-flex w-full"], {
|
|
|
145
145
|
) });
|
|
146
146
|
};
|
|
147
147
|
X.displayName = "InputGroup";
|
|
148
|
-
const be =
|
|
148
|
+
const be = S(
|
|
149
149
|
[
|
|
150
150
|
"overflow-hidden",
|
|
151
151
|
"border-sm",
|
|
@@ -209,7 +209,7 @@ const be = E(
|
|
|
209
209
|
intent: "neutral"
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
),
|
|
212
|
+
), E = ({
|
|
213
213
|
asChild: n,
|
|
214
214
|
className: e,
|
|
215
215
|
children: t,
|
|
@@ -236,11 +236,11 @@ const be = E(
|
|
|
236
236
|
}
|
|
237
237
|
);
|
|
238
238
|
};
|
|
239
|
-
|
|
239
|
+
E.displayName = "InputGroup.Addon";
|
|
240
240
|
const Y = ({ className: n, ref: e, ...t }) => {
|
|
241
241
|
const { disabled: r, readOnly: o } = v();
|
|
242
242
|
return /* @__PURE__ */ l("div", { className: g("rounded-l-lg", r || o ? "bg-on-surface/dim-5" : null), children: /* @__PURE__ */ l(
|
|
243
|
-
|
|
243
|
+
E,
|
|
244
244
|
{
|
|
245
245
|
ref: e,
|
|
246
246
|
className: g(n, "rounded-r-0! mr-[-1px] rounded-l-lg"),
|
|
@@ -276,7 +276,7 @@ R.displayName = "InputGroup.LeadingIcon";
|
|
|
276
276
|
const ee = ({ className: n, ref: e, ...t }) => {
|
|
277
277
|
const { disabled: r, readOnly: o } = v();
|
|
278
278
|
return /* @__PURE__ */ l("div", { className: g("rounded-r-lg", r || o ? "bg-on-surface/dim-5" : null), children: /* @__PURE__ */ l(
|
|
279
|
-
|
|
279
|
+
E,
|
|
280
280
|
{
|
|
281
281
|
ref: e,
|
|
282
282
|
className: g(n, "rounded-l-0! ml-[-1px] rounded-r-lg"),
|
|
@@ -290,7 +290,7 @@ ee.displayName = "InputGroup.TrailingAddon";
|
|
|
290
290
|
const j = ({ className: n, ...e }) => /* @__PURE__ */ l(D, { className: g(n, "right-lg text-body-1"), ...e });
|
|
291
291
|
j.id = "TrailingIcon";
|
|
292
292
|
j.displayName = "InputGroup.TrailingIcon";
|
|
293
|
-
const ye =
|
|
293
|
+
const ye = S(
|
|
294
294
|
[
|
|
295
295
|
"relative",
|
|
296
296
|
"border-sm",
|