@fuf-stack/uniform 2.0.0-next.3 → 2.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Checkboxes/index.d.mts +58 -58
- package/dist/Checkboxes/index.d.mts.map +1 -1
- package/dist/Checkboxes/index.mjs +10 -8
- package/dist/Checkboxes/index.mjs.map +1 -1
- package/dist/DatePicker/index.d.mts +46 -109
- package/dist/DatePicker/index.d.mts.map +1 -1
- package/dist/DatePicker/index.mjs +15 -23
- package/dist/DatePicker/index.mjs.map +1 -1
- package/dist/FieldArray/index.mjs +9 -7
- package/dist/FieldArray/index.mjs.map +1 -1
- package/dist/FieldCard/index.mjs +5 -8
- package/dist/FieldCard/index.mjs.map +1 -1
- package/dist/FieldHelper-B1DWl7eu.mjs +38 -0
- package/dist/FieldHelper-B1DWl7eu.mjs.map +1 -0
- package/dist/FieldLabel-DMTqq0Jj.mjs +29 -0
- package/dist/FieldLabel-DMTqq0Jj.mjs.map +1 -0
- package/dist/{FieldLayout-DcvQU0zN.mjs → FieldLayout-C9MEBZAC.mjs} +10 -17
- package/dist/FieldLayout-C9MEBZAC.mjs.map +1 -0
- package/dist/{FieldValidationError-iAayfTEw.mjs → FieldValidationError-BuLvuRyi.mjs} +3 -3
- package/dist/FieldValidationError-BuLvuRyi.mjs.map +1 -0
- package/dist/Input/index.d.mts +596 -431
- package/dist/Input/index.d.mts.map +1 -1
- package/dist/Input/index.mjs +7 -10
- package/dist/Input/index.mjs.map +1 -1
- package/dist/RadioBoxes/index.d.mts +79 -63
- package/dist/RadioBoxes/index.d.mts.map +1 -1
- package/dist/RadioBoxes/index.mjs +5 -13
- package/dist/RadioBoxes/index.mjs.map +1 -1
- package/dist/RadioTabs/index.d.mts +572 -317
- package/dist/RadioTabs/index.d.mts.map +1 -1
- package/dist/RadioTabs/index.mjs +11 -11
- package/dist/RadioTabs/index.mjs.map +1 -1
- package/dist/Radios/index.d.mts +44 -41
- package/dist/Radios/index.d.mts.map +1 -1
- package/dist/Radios/index.mjs +5 -13
- package/dist/Radios/index.mjs.map +1 -1
- package/dist/Select/index.d.mts +791 -599
- package/dist/Select/index.d.mts.map +1 -1
- package/dist/Select/index.mjs +7 -8
- package/dist/Select/index.mjs.map +1 -1
- package/dist/Slider/index.d.mts +664 -354
- package/dist/Slider/index.d.mts.map +1 -1
- package/dist/Slider/index.mjs +18 -26
- package/dist/Slider/index.mjs.map +1 -1
- package/dist/Switch/index.d.mts +1 -1
- package/dist/Switch/index.mjs +12 -17
- package/dist/Switch/index.mjs.map +1 -1
- package/dist/Switch-aBYStBoY.d.mts +990 -0
- package/dist/{Switch-Db2dpGz7.d.mts.map → Switch-aBYStBoY.d.mts.map} +1 -1
- package/dist/SwitchBox/index.d.mts +593 -231
- package/dist/SwitchBox/index.d.mts.map +1 -1
- package/dist/SwitchBox/index.mjs +14 -18
- package/dist/SwitchBox/index.mjs.map +1 -1
- package/dist/TextArea/index.d.mts +553 -216
- package/dist/TextArea/index.d.mts.map +1 -1
- package/dist/TextArea/index.mjs +7 -10
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/Time/index.d.mts +45 -45
- package/dist/Time/index.d.mts.map +1 -1
- package/dist/Time/index.mjs +17 -22
- package/dist/Time/index.mjs.map +1 -1
- package/dist/fieldHelperVariants-ClP8taiS.mjs +20 -0
- package/dist/fieldHelperVariants-ClP8taiS.mjs.map +1 -0
- package/dist/fieldLabelVariants-C4ZqECec.mjs +13 -0
- package/dist/fieldLabelVariants-C4ZqECec.mjs.map +1 -0
- package/dist/{FieldDescription-X_0s1Lhu.mjs → fieldProps-DWfz2jSO.mjs} +2 -13
- package/dist/fieldProps-DWfz2jSO.mjs.map +1 -0
- package/dist/{Switch-Db2dpGz7.d.mts → partials/FieldHelper/index.d.mts} +309 -408
- package/dist/partials/FieldHelper/index.d.mts.map +1 -0
- package/dist/partials/FieldHelper/index.mjs +7 -0
- package/dist/partials/FieldHelper/index.mjs.map +1 -0
- package/dist/partials/FieldLabel/index.d.mts +160 -0
- package/dist/partials/FieldLabel/index.d.mts.map +1 -0
- package/dist/partials/FieldLabel/index.mjs +7 -0
- package/dist/partials/FieldLabel/index.mjs.map +1 -0
- package/dist/partials/FieldValidationError/index.d.mts +2 -2
- package/dist/partials/FieldValidationError/index.mjs +1 -1
- package/dist/{radioControlVariants-BYRfaD6y.mjs → radioControlVariants-CbtG5U4_.mjs} +10 -6
- package/dist/radioControlVariants-CbtG5U4_.mjs.map +1 -0
- package/dist/{switchVariants-D16b2VaT.mjs → switchVariants-0Xa7TQYg.mjs} +5 -8
- package/dist/switchVariants-0Xa7TQYg.mjs.map +1 -0
- package/dist/{timeVariants-CtXyNKmW.mjs → timeVariants-Bkt4iwXx.mjs} +12 -10
- package/dist/timeVariants-Bkt4iwXx.mjs.map +1 -0
- package/dist/{FieldLabel-DrNWJIVh.mjs → useUniformField-TTNPTsVn.mjs} +3 -28
- package/dist/useUniformField-TTNPTsVn.mjs.map +1 -0
- package/package.json +4 -2
- package/dist/FieldDescription-X_0s1Lhu.mjs.map +0 -1
- package/dist/FieldLabel-DrNWJIVh.mjs.map +0 -1
- package/dist/FieldLayout-DcvQU0zN.mjs.map +0 -1
- package/dist/FieldValidationError-iAayfTEw.mjs.map +0 -1
- package/dist/radioControlVariants-BYRfaD6y.mjs.map +0 -1
- package/dist/switchVariants-D16b2VaT.mjs.map +0 -1
- package/dist/timeVariants-CtXyNKmW.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radioControlVariants-BYRfaD6y.mjs","names":[],"sources":["../src/partials/RadioGroupField/RadioGroupDescriptionContext.ts","../src/partials/RadioGroupField/RadioGroupField.tsx","../src/partials/RadioGroupField/radioGroupFieldVariants.ts","../src/Radios/subcomponents/RadioControl.tsx","../src/Radios/subcomponents/radioControlVariants.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/** Supporting message IDs inherited by each option */\nconst RadioGroupDescriptionContext = createContext<string | undefined>(\n undefined,\n);\n\nexport default RadioGroupDescriptionContext;\n","import type { ReactNode } from 'react';\nimport type { RadioGroupProps } from 'react-aria-components';\nimport type { FieldControlProps } from '../types';\n\nimport { useRef } from 'react';\nimport { RadioGroup } from 'react-aria-components';\n\nimport RadioGroupDescriptionContext from './RadioGroupDescriptionContext';\n\ninterface RadioGroupFieldProps {\n /** Group content, including its label and options */\n children: ReactNode;\n /** CSS class name */\n className?: string;\n /** Control ID, explicit accessible name and supporting message IDs */\n controlProps: Pick<\n FieldControlProps,\n 'id' | 'aria-label' | 'aria-describedby'\n >;\n /** Identifies the public component owning the radio group */\n dataComponent?: string;\n /** Disables every option */\n disabled?: boolean;\n /** Arranges options horizontally */\n inline: boolean;\n /** Connects form focus requests to the selected or first enabled option */\n inputRef: (control: Pick<HTMLElement, 'focus'> | null) => void;\n /** Marks visible validation failure */\n invalid: boolean;\n /** Field name */\n name: string;\n /** Callback when focus leaves the group */\n onBlur: () => void;\n /** Callback with the selected option's string value */\n onChange: (value: string) => void;\n /** Prevents selection changes while options stay focusable */\n readOnly?: boolean;\n /** Marks the group as required */\n required: boolean;\n /** HTML data-testid attribute */\n testId: string;\n /** Selected value, nullish values become an empty selection */\n value: unknown;\n}\n\n/**\n * React Aria radio-group engine with option focus routing and shared descriptions\n *\n * Receives bound values and callbacks, without registering a form field.\n * Its children own the field layout and option presentation.\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nconst RadioGroupField = ({\n children,\n className = undefined,\n controlProps,\n dataComponent = undefined,\n disabled = undefined,\n inputRef,\n invalid,\n inline,\n name,\n onBlur,\n onChange,\n readOnly = undefined,\n required,\n testId,\n value,\n}: RadioGroupFieldProps) => {\n const groupRef = useRef<HTMLDivElement>(null);\n\n // focus the selected enabled option, otherwise the first enabled option\n const handleFocus = () => {\n const input =\n groupRef.current?.querySelector<HTMLInputElement>(\n 'input:checked:not(:disabled)',\n ) ??\n groupRef.current?.querySelector<HTMLInputElement>('input:not(:disabled)');\n input?.focus();\n };\n\n // expose option focus through the binding ref\n const setControlRef = (node: HTMLDivElement | null) => {\n groupRef.current = node;\n inputRef(node ? { focus: handleFocus } : null);\n };\n\n // preserve the group's existing state selectors on the actual root\n const renderGroup: NonNullable<RadioGroupProps['render']> = (props) => {\n return (\n <div {...props} data-invalid={invalid} data-required={required}>\n {props.children}\n </div>\n );\n };\n\n return (\n <RadioGroup\n ref={setControlRef}\n aria-describedby={controlProps['aria-describedby']}\n aria-label={controlProps['aria-label']}\n className={className}\n data-component={dataComponent}\n data-invalid={invalid}\n data-required={required}\n data-slot=\"base\"\n data-testid={testId}\n id={controlProps.id}\n isDisabled={disabled}\n isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n orientation={inline ? 'horizontal' : 'vertical'}\n render={renderGroup}\n validationBehavior=\"aria\"\n value={value != null ? String(value) : ''}\n >\n <RadioGroupDescriptionContext.Provider\n value={controlProps['aria-describedby']}\n >\n {children}\n </RadioGroupDescriptionContext.Provider>\n </RadioGroup>\n );\n};\n\nexport default RadioGroupField;\n","import { tv } from '@fuf-stack/pixel-utils';\n\nconst radioGroupFieldVariants = tv({\n slots: {\n /** Container grouping the label, options and hints */\n base: 'relative',\n /** Supporting text below the options */\n description: 'text-foreground-400 text-tiny',\n /** Container for validation messages */\n errorMessage: '',\n /** Label above the options */\n label: 'relative',\n /** Container around the selectable options */\n wrapper: '',\n },\n variants: {\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n },\n },\n },\n});\n\nexport default radioGroupFieldVariants;\n","import type { ReactNode } from 'react';\nimport type { RadioButtonProps } from 'react-aria-components';\nimport type { RadioControlClassNames } from './radioControlVariants';\n\nimport { useContext, useId } from 'react';\nimport { RadioButton, RadioField } from 'react-aria-components';\n\nimport RadioGroupDescriptionContext from '../../partials/RadioGroupField/RadioGroupDescriptionContext';\n\ninterface RadioControlProps {\n /** Option label */\n children: ReactNode;\n /** CSS class name */\n className: RadioControlClassNames;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Decorative option icon */\n icon?: ReactNode;\n /** Marks visible validation failure */\n invalid: boolean;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** String value managed by the containing group */\n value: string;\n}\n\n/**\n * React Aria radio option with an indicator, label and optional supporting text\n *\n * Inherits selection and disabled state from its RadioGroup, and supporting\n * message IDs from RadioGroupField when composed inside that engine.\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nconst RadioControl = ({\n children,\n className: classNames,\n description = undefined,\n disabled = undefined,\n icon = undefined,\n invalid,\n testId = undefined,\n value,\n}: RadioControlProps) => {\n const id = useId();\n const groupDescription = useContext(RadioGroupDescriptionContext);\n\n const describedBy =\n [groupDescription, description ? `${id}-description` : undefined]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const control = (\n <span aria-hidden className={classNames.wrapper} data-slot=\"wrapper\">\n <span className={classNames.control} data-slot=\"control\" />\n </span>\n );\n\n // preserve option state selectors on the visible label\n const renderOption: NonNullable<RadioButtonProps['render']> = (\n props,\n state,\n ) => {\n return (\n <label\n {...props}\n data-focus={state.isFocused || undefined}\n data-hover={state.isHovered || undefined}\n data-hover-unselected={\n (state.isHovered && !state.isSelected) || undefined\n }\n htmlFor={`${id}-control`}\n >\n {props.children}\n </label>\n );\n };\n\n return (\n <RadioField\n aria-describedby={describedBy}\n aria-labelledby={`${id}-label`}\n className={classNames.field}\n id={`${id}-control`}\n isDisabled={disabled}\n value={value}\n >\n <RadioButton\n className={classNames.base}\n data-invalid={invalid}\n data-slot=\"base\"\n data-testid={testId}\n render={renderOption}\n >\n {!icon ? control : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n <div className={classNames.labelWrapper} data-slot=\"label-wrapper\">\n <span\n className={classNames.label}\n data-slot=\"label\"\n id={`${id}-label`}\n >\n {children}\n </span>\n {description ? (\n <div\n className={classNames.description}\n data-slot=\"description\"\n id={`${id}-description`}\n >\n {description}\n </div>\n ) : null}\n </div>\n {icon ? control : null}\n </RadioButton>\n </RadioField>\n );\n};\n\nexport default RadioControl;\n","import type { TVClassName } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nconst radioControlVariants = tv({\n slots: {\n /** Clickable option containing the indicator and label */\n base: [\n // option layout and pointer behavior\n 'group relative -m-2 inline-flex max-w-fit cursor-pointer select-none items-center justify-start p-2 tap-highlight-transparent',\n // disabled cursor and opacity, the native input covers the option\n 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled data-[disabled=true]:**:cursor-not-allowed',\n ],\n /** Dot marking the selected option */\n control: [\n // selection dot appearance and animation\n 'z-10 h-2 w-2 origin-center scale-0 rounded-full bg-primary text-primary-foreground opacity-0 transition-transform-opacity',\n // selection and validation states\n 'group-data-[selected=true]:scale-100 group-data-[invalid=true]:bg-danger group-data-[invalid=true]:text-danger-foreground group-data-[selected=true]:opacity-100',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Supporting text below the option label */\n description:\n 'relative text-foreground-400 transition-colors text-small motion-reduce:transition-none',\n /** Option state boundary without an additional layout box */\n field: 'contents',\n /** Container for a decorative option icon */\n icon: '',\n /** Primary option text */\n label:\n 'relative select-none text-foreground transition-colors text-medium motion-reduce:transition-none',\n /** Container grouping the option label and description */\n labelWrapper: 'ml-1 ms-2 flex flex-col',\n /** Circular outline around the selection indicator */\n wrapper: [\n // indicator dimensions and layout\n 'relative box-border inline-flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden',\n // circular border and transitions\n 'rounded-full border-2 border-solid border-default transition-transform-colors',\n // pressed, selected and invalid states\n 'group-data-[pressed=true]:scale-95 group-data-[invalid=true]:border-danger group-data-[invalid=true]:group-data-[selected=true]:border-danger group-data-[selected=true]:border-primary group-data-[hover-unselected=true]:bg-default-100',\n // keyboard focus ring\n 'group-data-[focus-visible=true]:ring-2 group-data-[focus-visible=true]:ring-focus group-data-[focus-visible=true]:ring-offset-2 group-data-[focus-visible=true]:ring-offset-background',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n },\n variants: {\n invalid: {\n true: {\n control: 'bg-danger text-danger-foreground',\n description: 'text-danger-300',\n label: 'text-danger',\n wrapper: 'border-danger group-data-[selected=true]:border-danger',\n },\n },\n },\n});\n\nexport type RadioControlClassNames = Partial<\n Record<keyof ReturnType<typeof radioControlVariants>, string>\n>;\n\nexport type ClassName = TVClassName<typeof radioControlVariants>;\n\nexport default radioControlVariants;\n"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switchVariants-D16b2VaT.mjs","names":[],"sources":["../src/Switch/switchVariants.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nexport const switchVariants = tv({\n slots: {\n /** Container for the field control and supporting text */\n base: 'group relative inline-flex max-w-fit cursor-pointer touch-none select-none items-center justify-start tap-highlight-transparent',\n /** Supporting text for the field */\n description: 'text-foreground-500 text-tiny',\n /** Content at the end of the control */\n endContent: [\n // end icon position and fade transition\n 'absolute end-1.5 z-0 text-default-600 opacity-100 transition-transform-opacity text-small',\n // move and hide the selected end icon\n 'group-data-[selected=true]:translate-x-3 group-data-[selected=true]:opacity-0',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Container for validation messages */\n errorMessage: 'text-danger text-tiny',\n /** Container for help text and validation messages */\n helperWrapper: 'relative ml-0 block p-0',\n /** Visible field label */\n label:\n 'group-data-[invalid=true]:text-danger! relative ms-2 select-none text-sm text-foreground subpixel-antialiased',\n /** Container grouping the toggle and field messages */\n outerWrapper: 'place-content-center',\n /** Content at the start of the control */\n startContent: [\n // start icon position and fade transition\n 'absolute start-1.5 z-0 scale-50 text-current opacity-0 transition-transform-opacity text-small',\n // reveal the selected start icon\n 'group-data-[selected=true]:scale-100 group-data-[selected=true]:opacity-100',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Movable indicator showing the current value */\n thumb: [\n // thumb layout and surface\n 'pointer-events-none z-10 flex h-5 w-5 origin-right items-center justify-center rounded-full bg-white shadow-small transition-all text-small',\n // selected position and pressed width\n 'group-data-[selected=true]:group-data-[pressed=true]:ms-4 group-data-[selected=true]:ms-5 group-data-[pressed=true]:w-6',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Content inside the toggle thumb */\n thumbIcon: 'text-black',\n /** Container arranging the selectable content */\n wrapper: [\n // switch track layout and surface\n 'relative inline-flex h-7 w-12 shrink-0 items-center justify-start overflow-hidden rounded-full bg-default-200 px-1 transition-background',\n // selected track colors\n 'group-data-[selected=true]:bg-primary group-data-[selected=true]:text-primary-foreground',\n // keyboard focus ring\n 'group-data-[focus-visible=true]:ring-2 group-data-[focus-visible=true]:ring-focus group-data-[focus-visible=true]:ring-offset-2 group-data-[focus-visible=true]:ring-offset-background',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n },\n variants: {\n size: {\n lg: {\n endContent: 'text-medium',\n startContent: 'text-medium',\n thumb:\n 'h-6 w-6 text-medium group-data-[selected=true]:group-data-[pressed=true]:ms-5 group-data-[selected=true]:ms-6 group-data-[pressed=true]:w-7',\n wrapper: 'h-8 w-14',\n },\n md: {},\n sm: {\n endContent: 'text-tiny',\n startContent: 'text-tiny',\n thumb:\n 'h-4 w-4 text-tiny group-data-[selected=true]:group-data-[pressed=true]:ms-3 group-data-[selected=true]:ms-4 group-data-[pressed=true]:w-5',\n wrapper: 'h-6 w-10',\n },\n },\n disabled: { true: { base: 'pointer-events-none opacity-disabled' } },\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof switchVariants>;\n\nexport type ClassName = TVClassName<typeof switchVariants>;\n"],"mappings":";;AAIA,MAAa,iBAAiB,GAAG;CAC/B,OAAO;;EAEL,MAAM;;EAEN,aAAa;;EAEb,YAAY;GAEV;GAEA;GAEA;EACF;;EAEA,cAAc;;EAEd,eAAe;;EAEf,OACE;;EAEF,cAAc;;EAEd,cAAc;GAEZ;GAEA;GAEA;EACF;;EAEA,OAAO;GAEL;GAEA;GAEA;EACF;;EAEA,WAAW;;EAEX,SAAS;GAEP;GAEA;GAEA;GAEA;EACF;CACF;CACA,UAAU;EACR,MAAM;GACJ,IAAI;IACF,YAAY;IACZ,cAAc;IACd,OACE;IACF,SAAS;GACX;GACA,IAAI,CAAC;GACL,IAAI;IACF,YAAY;IACZ,cAAc;IACd,OACE;IACF,SAAS;GACX;EACF;EACA,UAAU,EAAE,MAAM,EAAE,MAAM,uCAAuC,EAAE;EACnE,UAAU,EACR,MAAM,EAEJ,MAAM,4DACR,EACF;CACF;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timeVariants-CtXyNKmW.mjs","names":[],"sources":["../src/Time/timeVariants.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\n/** Shared segmented input defaults, also extended by DatePicker */\nexport const segmentedInputVariants = tv({\n slots: {\n /** Field container with space for supporting text */\n base: 'group flex w-full flex-col gap-y-1.5 pb-5',\n /** Field description text */\n description: 'text-foreground-500 text-tiny',\n /** Validation message text */\n errorMessage: 'text-danger text-tiny',\n /** Supporting text below the input surface */\n helperWrapper: [\n 'absolute start-0 top-[calc(100%_+_2px)] flex flex-col gap-1.5',\n 'p-0',\n ],\n /** Row containing segments and optional controls */\n innerWrapper: 'flex h-6 w-full items-center gap-x-2 text-default-400',\n /** Editable date or time segment group */\n input: 'flex h-full w-full gap-x-0.5 font-normal text-small',\n /** Bordered surface around the editable segments */\n inputWrapper: [\n // segmented control frame and layout\n 'shadow-xs relative inline-flex h-10 min-h-10 w-full cursor-text flex-row items-center gap-3',\n // border and padding\n 'rounded-small border-2 border-default-200 px-3',\n // color transitions\n 'transition-colors duration-150',\n // hover and focus borders\n 'hover:border-default-400 focus-within:hover:border-default-foreground',\n // reduced motion\n 'motion-reduce:transition-none',\n // surface color and focused border\n 'bg-content1 focus-within:border-focus',\n ],\n /** Label above the segmented input */\n label: [\n 'block w-full text-foreground subpixel-antialiased text-small',\n 'cursor-default',\n ],\n /** Individual editable value or separator */\n segment: [\n // segment focus outline and shadow\n 'outline-solid focus:shadow-xs',\n // segment spacing and typography\n 'group my-auto box-content inline-block rounded-md px-0.5 text-start tabular-nums text-foreground-500 outline-transparent',\n // color transition\n 'transition-colors',\n // first segment alignment and focus background\n 'first:-ml-0.5 focus:bg-default-400/50',\n // editable values and empty placeholders\n 'data-[editable=true]:data-[placeholder=true]:text-foreground-500 data-[editable=true]:text-foreground data-[editable=true]:focus:text-default-foreground',\n // reduced motion\n 'motion-reduce:transition-none',\n // spacing between subsequent segments\n '[&:not(:first-child)]:-ml-1',\n ],\n },\n});\n\nexport const timeVariants = tv({\n extend: segmentedInputVariants,\n variants: {\n disabled: { true: { base: 'pointer-events-none opacity-disabled' } },\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n },\n },\n invalid: {\n true: {\n innerWrapper: 'text-danger',\n inputWrapper:\n 'border-danger focus-within:border-danger hover:border-danger focus-within:hover:border-danger',\n label: 'text-danger',\n segment: [\n // invalid text and focus background\n 'text-danger-300 focus:bg-danger-400/50',\n // editable values and empty placeholders\n 'data-[editable=true]:data-[placeholder=true]:text-danger data-[editable=true]:text-danger data-[editable=true]:focus:text-danger',\n // dark theme focus background\n 'dark:focus:bg-danger-400/20',\n ],\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof timeVariants>;\n\nexport type ClassName = TVClassName<typeof timeVariants>;\n\n/** Resolved class names for the segmented time slots */\nexport type TimeClassNames = Record<\n keyof ReturnType<typeof timeVariants>,\n string\n>;\n"],"mappings":";;;AAKA,MAAa,yBAAyB,GAAG,EACvC,OAAO;;CAEL,MAAM;;CAEN,aAAa;;CAEb,cAAc;;CAEd,eAAe,CACb,iEACA,KACF;;CAEA,cAAc;;CAEd,OAAO;;CAEP,cAAc;EAEZ;EAEA;EAEA;EAEA;EAEA;EAEA;CACF;;CAEA,OAAO,CACL,gEACA,gBACF;;CAEA,SAAS;EAEP;EAEA;EAEA;EAEA;EAEA;EAEA;EAEA;CACF;AACF,EACF,CAAC;AAED,MAAa,eAAe,GAAG;CAC7B,QAAQ;CACR,UAAU;EACR,UAAU,EAAE,MAAM,EAAE,MAAM,uCAAuC,EAAE;EACnE,UAAU,EACR,MAAM,EAEJ,MAAM,4DACR,EACF;EACA,SAAS,EACP,MAAM;GACJ,cAAc;GACd,cACE;GACF,OAAO;GACP,SAAS;IAEP;IAEA;IAEA;GACF;EACF,EACF;CACF;AACF,CAAC"}
|