@spark-ui/components 17.2.3 → 17.2.4-beta.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/DialogContent.styles-BSxCCi-u.mjs +62 -0
- package/dist/DialogContent.styles-BSxCCi-u.mjs.map +1 -0
- package/dist/DialogContent.styles-CAhJtUud.js +2 -0
- package/dist/DialogContent.styles-CAhJtUud.js.map +1 -0
- package/dist/FormFieldRequiredIndicator-CtgkvPZo.js +2 -0
- package/dist/FormFieldRequiredIndicator-CtgkvPZo.js.map +1 -0
- package/dist/FormFieldRequiredIndicator-DOGQ_HxO.mjs +14 -0
- package/dist/FormFieldRequiredIndicator-DOGQ_HxO.mjs.map +1 -0
- package/dist/accordion/index.js +2 -2
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +99 -161
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/alert-dialog/index.js +2 -2
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs +169 -235
- package/dist/alert-dialog/index.mjs.map +1 -1
- package/dist/avatar/index.js +2 -2
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar/index.mjs +187 -224
- package/dist/avatar/index.mjs.map +1 -1
- package/dist/badge/index.js +2 -2
- package/dist/badge/index.js.map +1 -1
- package/dist/badge/index.mjs +115 -81
- package/dist/badge/index.mjs.map +1 -1
- package/dist/breadcrumb/index.js +2 -2
- package/dist/breadcrumb/index.js.map +1 -1
- package/dist/breadcrumb/index.mjs +73 -106
- package/dist/breadcrumb/index.mjs.map +1 -1
- package/dist/button/index.js +1 -2
- package/dist/button/index.mjs +2 -5
- package/dist/button-BTDRzvpB.js +2 -0
- package/dist/button-BTDRzvpB.js.map +1 -0
- package/dist/button-_YZ_4J42.mjs +643 -0
- package/dist/button-_YZ_4J42.mjs.map +1 -0
- package/dist/card/index.js +2 -2
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs +327 -394
- package/dist/card/index.mjs.map +1 -1
- package/dist/carousel/index.js +2 -2
- package/dist/carousel/index.js.map +1 -1
- package/dist/carousel/index.mjs +515 -618
- package/dist/carousel/index.mjs.map +1 -1
- package/dist/checkbox/index.js +2 -2
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs +213 -246
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/chip/index.js +2 -2
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/index.mjs +601 -652
- package/dist/chip/index.mjs.map +1 -1
- package/dist/chunk-C91j1N6u.js +1 -0
- package/dist/circular-meter/index.js +2 -2
- package/dist/circular-meter/index.js.map +1 -1
- package/dist/circular-meter/index.mjs +354 -309
- package/dist/circular-meter/index.mjs.map +1 -1
- package/dist/collapsible/index.js +2 -2
- package/dist/collapsible/index.js.map +1 -1
- package/dist/collapsible/index.mjs +53 -53
- package/dist/collapsible/index.mjs.map +1 -1
- package/dist/combobox/index.js +2 -2
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +721 -876
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/dialog/index.js +2 -2
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs +181 -206
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/divider/index.js +2 -2
- package/dist/divider/index.js.map +1 -1
- package/dist/divider/index.mjs +178 -183
- package/dist/divider/index.mjs.map +1 -1
- package/dist/drawer/index.js +2 -2
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs +277 -309
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/dropdown/index.js +2 -2
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs +429 -492
- package/dist/dropdown/index.mjs.map +1 -1
- package/dist/file-upload/index.js +2 -2
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/index.mjs +540 -677
- package/dist/file-upload/index.mjs.map +1 -1
- package/dist/form-field/index.js +1 -2
- package/dist/form-field/index.mjs +2 -284
- package/dist/form-field-B8QzM655.mjs +231 -0
- package/dist/form-field-B8QzM655.mjs.map +1 -0
- package/dist/form-field-Bu_0E9tb.js +2 -0
- package/dist/form-field-Bu_0E9tb.js.map +1 -0
- package/dist/icon/index.js +1 -2
- package/dist/icon/index.mjs +2 -5
- package/dist/icon-CRPcdgYp.js +2 -0
- package/dist/icon-CRPcdgYp.js.map +1 -0
- package/dist/icon-D05Uqh8_.mjs +41 -0
- package/dist/icon-D05Uqh8_.mjs.map +1 -0
- package/dist/icon-button/index.js +1 -2
- package/dist/icon-button/index.mjs +2 -5
- package/dist/icon-button-6p3O7NIm.mjs +28 -0
- package/dist/icon-button-6p3O7NIm.mjs.map +1 -0
- package/dist/icon-button-CykysbgJ.js +2 -0
- package/dist/icon-button-CykysbgJ.js.map +1 -0
- package/dist/input/index.js +1 -2
- package/dist/input/index.mjs +2 -455
- package/dist/input-CmYeHYWQ.mjs +355 -0
- package/dist/input-CmYeHYWQ.mjs.map +1 -0
- package/dist/input-DNr40G2Z.js +2 -0
- package/dist/input-DNr40G2Z.js.map +1 -0
- package/dist/input-otp/index.js +2 -2
- package/dist/input-otp/index.js.map +1 -1
- package/dist/input-otp/index.mjs +344 -407
- package/dist/input-otp/index.mjs.map +1 -1
- package/dist/kbd/index.js +2 -2
- package/dist/kbd/index.js.map +1 -1
- package/dist/kbd/index.mjs +12 -17
- package/dist/kbd/index.mjs.map +1 -1
- package/dist/label/index.js +1 -2
- package/dist/label/index.mjs +2 -40
- package/dist/label-BqRlrca0.mjs +31 -0
- package/dist/label-BqRlrca0.mjs.map +1 -0
- package/dist/label-DU0p0d-f.js +2 -0
- package/dist/label-DU0p0d-f.js.map +1 -0
- package/dist/link-box/index.js +2 -2
- package/dist/link-box/index.js.map +1 -1
- package/dist/link-box/index.mjs +36 -34
- package/dist/link-box/index.mjs.map +1 -1
- package/dist/meter/index.js +2 -2
- package/dist/meter/index.js.map +1 -1
- package/dist/meter/index.mjs +149 -171
- package/dist/meter/index.mjs.map +1 -1
- package/dist/pagination/index.js +2 -2
- package/dist/pagination/index.js.map +1 -1
- package/dist/pagination/index.mjs +253 -214
- package/dist/pagination/index.mjs.map +1 -1
- package/dist/popover/index.js +1 -2
- package/dist/popover/index.mjs +2 -239
- package/dist/popover-CxZAQmw6.mjs +211 -0
- package/dist/popover-CxZAQmw6.mjs.map +1 -0
- package/dist/popover-GOovJ27J.js +2 -0
- package/dist/popover-GOovJ27J.js.map +1 -0
- package/dist/portal/index.js +2 -2
- package/dist/portal/index.js.map +1 -1
- package/dist/portal/index.mjs +8 -7
- package/dist/portal/index.mjs.map +1 -1
- package/dist/progress/index.js +1 -2
- package/dist/progress/index.mjs +2 -178
- package/dist/progress-cEf3tFbn.mjs +132 -0
- package/dist/progress-cEf3tFbn.mjs.map +1 -0
- package/dist/progress-rJZcPJsZ.js +2 -0
- package/dist/progress-rJZcPJsZ.js.map +1 -0
- package/dist/progress-tracker/index.js +2 -2
- package/dist/progress-tracker/index.js.map +1 -1
- package/dist/progress-tracker/index.mjs +303 -380
- package/dist/progress-tracker/index.mjs.map +1 -1
- package/dist/radio-group/index.js +2 -2
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +204 -213
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/rating/index.js +2 -2
- package/dist/rating/index.js.map +1 -1
- package/dist/rating/index.mjs +189 -244
- package/dist/rating/index.mjs.map +1 -1
- package/dist/rating-display/index.js +2 -2
- package/dist/rating-display/index.js.map +1 -1
- package/dist/rating-display/index.mjs +165 -166
- package/dist/rating-display/index.mjs.map +1 -1
- package/dist/scrolling-list/index.js +2 -2
- package/dist/scrolling-list/index.js.map +1 -1
- package/dist/scrolling-list/index.mjs +216 -273
- package/dist/scrolling-list/index.mjs.map +1 -1
- package/dist/segmented-control/index.js +2 -2
- package/dist/segmented-control/index.js.map +1 -1
- package/dist/segmented-control/index.mjs +146 -180
- package/dist/segmented-control/index.mjs.map +1 -1
- package/dist/segmented-gauge/index.js +2 -2
- package/dist/segmented-gauge/index.js.map +1 -1
- package/dist/segmented-gauge/index.mjs +146 -195
- package/dist/segmented-gauge/index.mjs.map +1 -1
- package/dist/select/index.js +2 -2
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +279 -327
- package/dist/select/index.mjs.map +1 -1
- package/dist/skeleton/index.js +2 -2
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs +92 -114
- package/dist/skeleton/index.mjs.map +1 -1
- package/dist/slider/index.js +2 -2
- package/dist/slider/index.js.map +1 -1
- package/dist/slider/index.mjs +259 -326
- package/dist/slider/index.mjs.map +1 -1
- package/dist/slot/index.js +2 -2
- package/dist/slot/index.js.map +1 -1
- package/dist/slot/index.mjs +12 -7
- package/dist/slot/index.mjs.map +1 -1
- package/dist/snackbar/index.js +2 -2
- package/dist/snackbar/index.js.map +1 -1
- package/dist/snackbar/index.mjs +404 -529
- package/dist/snackbar/index.mjs.map +1 -1
- package/dist/spinner/index.js +1 -2
- package/dist/spinner/index.mjs +2 -5
- package/dist/spinner-DFUoYvmm.js +2 -0
- package/dist/spinner-DFUoYvmm.js.map +1 -0
- package/dist/spinner-DULLiM6a.mjs +56 -0
- package/dist/spinner-DULLiM6a.mjs.map +1 -0
- package/dist/src/avatar/index.d.mts +2 -2
- package/dist/src/avatar/index.d.ts +2 -2
- package/dist/src/file-upload/index.d.mts +1 -1
- package/dist/src/file-upload/index.d.ts +1 -1
- package/dist/stepper/index.js +2 -2
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +139 -176
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/switch/index.js +2 -2
- package/dist/switch/index.js.map +1 -1
- package/dist/switch/index.mjs +194 -197
- package/dist/switch/index.mjs.map +1 -1
- package/dist/tabs/index.js +2 -2
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +337 -389
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tag/index.js +2 -2
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/index.mjs +192 -211
- package/dist/tag/index.mjs.map +1 -1
- package/dist/text-link/index.js +2 -2
- package/dist/text-link/index.js.map +1 -1
- package/dist/text-link/index.mjs +44 -5
- package/dist/text-link/index.mjs.map +1 -1
- package/dist/textarea/index.js +2 -2
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs +51 -50
- package/dist/textarea/index.mjs.map +1 -1
- package/dist/toast/index.js +2 -2
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/index.mjs +314 -367
- package/dist/toast/index.mjs.map +1 -1
- package/dist/useRenderSlot-DP4fYerF.mjs +11 -0
- package/dist/useRenderSlot-DP4fYerF.mjs.map +1 -0
- package/dist/useRenderSlot-Xxf_s88b.js +2 -0
- package/dist/useRenderSlot-Xxf_s88b.js.map +1 -0
- package/dist/visually-hidden/index.js +2 -2
- package/dist/visually-hidden/index.js.map +1 -1
- package/dist/visually-hidden/index.mjs +25 -5
- package/dist/visually-hidden/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/Button-1M9DcZl0.mjs +0 -704
- package/dist/Button-1M9DcZl0.mjs.map +0 -1
- package/dist/Button-FZceRWG2.js +0 -2
- package/dist/Button-FZceRWG2.js.map +0 -1
- package/dist/DialogContent.styles-CziMQtYr.js +0 -2
- package/dist/DialogContent.styles-CziMQtYr.js.map +0 -1
- package/dist/DialogContent.styles-Du7_Dkde.mjs +0 -60
- package/dist/DialogContent.styles-Du7_Dkde.mjs.map +0 -1
- package/dist/FormFieldRequiredIndicator-CHfcoT2y.js +0 -2
- package/dist/FormFieldRequiredIndicator-CHfcoT2y.js.map +0 -1
- package/dist/FormFieldRequiredIndicator-DTnCGiX2.mjs +0 -13
- package/dist/FormFieldRequiredIndicator-DTnCGiX2.mjs.map +0 -1
- package/dist/Icon-BO327oHU.mjs +0 -57
- package/dist/Icon-BO327oHU.mjs.map +0 -1
- package/dist/Icon-C-cNTnzd.js +0 -2
- package/dist/Icon-C-cNTnzd.js.map +0 -1
- package/dist/IconButton-BR1bJSQA.js +0 -2
- package/dist/IconButton-BR1bJSQA.js.map +0 -1
- package/dist/IconButton-DdB3Pq13.mjs +0 -43
- package/dist/IconButton-DdB3Pq13.mjs.map +0 -1
- package/dist/Slot-DLY1rJrG.mjs +0 -14
- package/dist/Slot-DLY1rJrG.mjs.map +0 -1
- package/dist/Slot-DQ8z2zsy.js +0 -2
- package/dist/Slot-DQ8z2zsy.js.map +0 -1
- package/dist/Spinner-Br4Rp9V2.js +0 -2
- package/dist/Spinner-Br4Rp9V2.js.map +0 -1
- package/dist/Spinner-Co3AjkQV.mjs +0 -68
- package/dist/Spinner-Co3AjkQV.mjs.map +0 -1
- package/dist/TextLink-5MvP0P8D.js +0 -2
- package/dist/TextLink-5MvP0P8D.js.map +0 -1
- package/dist/TextLink-Cc_LeVcx.mjs +0 -57
- package/dist/TextLink-Cc_LeVcx.mjs.map +0 -1
- package/dist/VisuallyHidden-CB6Nx76j.js +0 -2
- package/dist/VisuallyHidden-CB6Nx76j.js.map +0 -1
- package/dist/VisuallyHidden-DjlV0-CW.mjs +0 -28
- package/dist/VisuallyHidden-DjlV0-CW.mjs.map +0 -1
- package/dist/button/index.js.map +0 -1
- package/dist/button/index.mjs.map +0 -1
- package/dist/form-field/index.js.map +0 -1
- package/dist/form-field/index.mjs.map +0 -1
- package/dist/icon/index.js.map +0 -1
- package/dist/icon/index.mjs.map +0 -1
- package/dist/icon-button/index.js.map +0 -1
- package/dist/icon-button/index.mjs.map +0 -1
- package/dist/input/index.js.map +0 -1
- package/dist/input/index.mjs.map +0 -1
- package/dist/label/index.js.map +0 -1
- package/dist/label/index.mjs.map +0 -1
- package/dist/popover/index.js.map +0 -1
- package/dist/popover/index.mjs.map +0 -1
- package/dist/progress/index.js.map +0 -1
- package/dist/progress/index.mjs.map +0 -1
- package/dist/spinner/index.js.map +0 -1
- package/dist/spinner/index.mjs.map +0 -1
- package/dist/useRenderSlot-Bta2kdp4.mjs +0 -10
- package/dist/useRenderSlot-Bta2kdp4.mjs.map +0 -1
- package/dist/useRenderSlot-DATwjgpo.js +0 -2
- package/dist/useRenderSlot-DATwjgpo.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/input-otp/InputOTPContext.tsx","../../src/input-otp/InputOTP.styles.ts","../../src/input-otp/InputOTPSlot.tsx","../../src/input-otp/useInputOTP.ts","../../src/input-otp/InputOTP.tsx","../../src/input-otp/InputOTPGroup.tsx","../../src/input-otp/InputOTPSeparator.tsx","../../src/input-otp/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport interface InputOTPContextValue {\n value: string\n maxLength: number\n slots: {\n char: string\n isActive: boolean\n hasFakeCaret: boolean\n }[]\n activeIndex: number\n intent: 'neutral' | 'success' | 'alert' | 'error'\n disabled: boolean\n readOnly: boolean\n placeholder?: string\n type: 'text' | 'number' | 'password' | 'tel'\n}\n\nexport const InputOTPContext = createContext<InputOTPContextValue | null>(null)\n\nexport const useInputOTPContext = () => {\n const context = useContext(InputOTPContext)\n if (!context) {\n throw new Error('InputOTP components must be used within InputOTP')\n }\n\n return context\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputOTPContainerStyles = cva(['relative', 'inline-flex', 'items-center', 'gap-sm'])\n\nexport const inputOTPSlotStyles = cva(\n [\n // Base slot styles\n 'relative h-[50px] w-sz-40',\n 'border-sm rounded-md',\n 'text-center text-display-3 text-on-surface',\n 'outline-hidden',\n 'transition-colors',\n 'flex items-center justify-center',\n // Slot that receives focus when clicking the group (first empty or last slot)\n // Use data-[focus-target=true]:... for distinct styles\n // Active state (when focused)\n 'data-[active=true]:ring-1',\n 'data-[active=true]:ring-inset',\n 'data-[active=true]:ring-l-2',\n 'data-[active=true]:border-focus',\n 'data-[active=true]:z-raised ring-focus',\n // Disabled state\n 'data-[disabled=true]:cursor-not-allowed',\n 'data-[disabled=true]:border-outline',\n 'data-[disabled=true]:bg-on-surface/dim-5',\n 'data-[disabled=true]:text-on-surface/dim-3',\n // Read-only state (same as disabled but text stays normal)\n 'data-[readonly=true]:cursor-default',\n 'data-[readonly=true]:data-[active=false]:border-outline',\n 'data-[readonly=true]:bg-on-surface/dim-5',\n 'group-hover:data-[focus-target=true]:data-[disabled=false]:border-outline-high',\n ],\n {\n variants: {\n /**\n * Color scheme of the slot\n */\n intent: {\n neutral: ['data-[filled=true]:bg-neutral-container bg-surface border-outline'],\n success: ['border-success bg-success-container text-on-success-container'],\n alert: ['border-alert bg-alert-container text-on-alert-container'],\n error: ['border-error bg-error-container text-on-error-container'],\n },\n },\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputOTPSlotStylesProps = VariantProps<typeof inputOTPSlotStyles>\n\n// Keep for backward compatibility\nexport const inputOTPStyles = inputOTPSlotStyles\nexport type InputOTPStylesProps = InputOTPSlotStylesProps\n","import { ComponentPropsWithoutRef } from 'react'\n\nimport { inputOTPSlotStyles } from './InputOTP.styles'\nimport { useInputOTPContext } from './InputOTPContext'\n\nexport interface InputOTPSlotProps extends ComponentPropsWithoutRef<'div'> {\n /**\n * Index of the slot (0-based).\n * If not provided, will be automatically assigned based on position in children.\n */\n index?: number\n}\n\nexport const InputOTPSlot = ({ index: indexProp, className, ...props }: InputOTPSlotProps) => {\n const context = useInputOTPContext()\n\n // Use provided index or fallback to 0 (should not happen if auto-assignment works)\n const index = indexProp ?? 0\n const slot = context.slots[index]\n\n if (!slot) {\n return null\n }\n\n const { char, isActive, hasFakeCaret } = slot\n const isEmpty = !char\n const isPlaceholder = isEmpty && !hasFakeCaret && context.placeholder\n\n const isFocusTarget = index === context.activeIndex\n\n return (\n <div\n className={inputOTPSlotStyles({\n intent: context.intent,\n className,\n })}\n data-active={isActive}\n data-disabled={context.disabled}\n data-readonly={context.readOnly}\n data-filled={!isEmpty}\n data-focus-target={isFocusTarget}\n data-valid={context.intent !== 'error'}\n {...props}\n >\n <span className={isPlaceholder ? 'text-on-surface/dim-3' : ''}>\n {context.type === 'password' && char\n ? '•'\n : char || (!hasFakeCaret && context.placeholder ? context.placeholder : '')}\n </span>\n {hasFakeCaret && (\n <span\n className=\"pointer-events-none absolute inset-0 flex items-center justify-center\"\n aria-hidden=\"true\"\n >\n <span className=\"bg-on-surface animate-standalone-caret-blink h-sz-24 w-sz-2\" />\n </span>\n )}\n </div>\n )\n}\n\nInputOTPSlot.displayName = 'InputOTP.Slot'\n","/* eslint-disable max-lines-per-function */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport {\n ChangeEventHandler,\n ClipboardEventHandler,\n KeyboardEventHandler,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport type { InputOTPContextValue } from './InputOTPContext'\n\nconst BACKSPACE_KEY = 'Backspace'\nconst LEFT_ARROW_KEY = 'ArrowLeft'\nconst UP_ARROW_KEY = 'ArrowUp'\nconst RIGHT_ARROW_KEY = 'ArrowRight'\nconst DOWN_ARROW_KEY = 'ArrowDown'\nconst E_KEY = 'e'\n\nexport interface UseInputOTPProps {\n maxLength: number\n type: 'text' | 'number' | 'password' | 'tel'\n value?: string\n defaultValue: string\n onValueChange?: (value: string) => void\n isValid: boolean\n disabledProp: boolean\n readOnlyProp: boolean\n autoFocus: boolean\n forceUppercase: boolean\n filterKeys: string[]\n pattern?: string\n placeholder: string\n nameProp?: string\n}\n\nexport interface UseInputOTPReturn {\n uuid: string\n inputRef: React.RefObject<HTMLInputElement | null>\n containerRef: React.RefObject<HTMLDivElement | null>\n name: string | undefined\n disabled: boolean\n readOnly: boolean\n isInvalid: boolean\n isRequired: boolean\n description: string | undefined\n maxLength: number\n intent: 'neutral' | 'success' | 'alert' | 'error'\n currentValue: string\n activeIndex: number\n slots: {\n char: string\n isActive: boolean\n hasFakeCaret: boolean\n }[]\n contextValue: InputOTPContextValue\n handleChange: ChangeEventHandler<HTMLInputElement>\n handleKeyDown: KeyboardEventHandler<HTMLInputElement>\n handleCopy: ClipboardEventHandler<HTMLInputElement>\n handlePaste: ClipboardEventHandler<HTMLInputElement>\n handleFocus: () => void\n handleBlur: () => void\n handleClick: () => void\n labelId: string | undefined\n}\n\nexport const useInputOTP = ({\n maxLength,\n type,\n value: controlledValue,\n defaultValue,\n onValueChange,\n isValid,\n disabledProp,\n readOnlyProp,\n autoFocus,\n forceUppercase,\n filterKeys,\n pattern,\n placeholder,\n nameProp,\n}: UseInputOTPProps): UseInputOTPReturn => {\n const uuid = useId()\n const inputRef = useRef<HTMLInputElement>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n\n // Get FormField context (optional, falls back gracefully if not present)\n const field = useFormFieldControl()\n\n // Use FormField values if available, otherwise fall back to props\n // Use FormField id when available so label htmlFor works correctly\n const id = field.id ?? uuid\n const name = nameProp ?? field.name\n const disabled = field.disabled ?? disabledProp\n const readOnly = field.readOnly ?? readOnlyProp\n const isInvalid = field.isInvalid ?? !isValid\n const isRequired = field.isRequired ?? false\n const labelId = field.labelId\n const description = field.description\n const fieldState = field.state\n\n // Determine intent based on FormField state or isValid prop\n const getIntent = (): 'neutral' | 'success' | 'alert' | 'error' => {\n // FormField state takes priority\n if (['success', 'alert', 'error'].includes(fieldState ?? '')) {\n return fieldState as 'success' | 'alert' | 'error'\n }\n\n // Fallback to isValid prop for backward compatibility\n if (isInvalid) {\n return 'error'\n }\n\n return 'neutral'\n }\n\n const intent = getIntent()\n\n // Initialize value\n const initialValue = controlledValue !== undefined ? controlledValue : defaultValue\n const processedValue = forceUppercase ? initialValue.toUpperCase() : initialValue\n\n const [internalValue, setInternalValue] = useState<string>(processedValue)\n const [isFocused, setIsFocused] = useState<boolean>(false)\n\n // Use controlled value if provided, otherwise use internal state\n const currentValue = controlledValue !== undefined ? controlledValue : internalValue\n\n // Calculate active index: last empty slot, or last slot if all are filled\n const activeIndex = Math.min(currentValue.length, maxLength - 1)\n\n // Sync cursor position with active index\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.setSelectionRange(activeIndex, activeIndex)\n }\n }, [activeIndex, currentValue.length, maxLength])\n\n // Create slots array\n const slots = useMemo(\n () =>\n Array.from({ length: maxLength }, (_, i) => ({\n char: currentValue[i] || '',\n isActive: i === activeIndex && isFocused,\n hasFakeCaret: i === activeIndex && !currentValue[i] && !disabled && !readOnly && isFocused,\n })),\n [maxLength, currentValue, activeIndex, isFocused, disabled, readOnly]\n )\n\n // Sync controlled value with input ref\n useEffect(() => {\n if (inputRef.current && controlledValue !== undefined) {\n inputRef.current.value = controlledValue\n }\n }, [controlledValue])\n\n // Focus management\n useEffect(() => {\n if (autoFocus && inputRef.current) {\n inputRef.current.focus()\n }\n }, [autoFocus])\n\n const processInputValue = (inputValue: string): string => {\n let processed = inputValue\n\n if (forceUppercase) {\n processed = processed.toUpperCase()\n }\n\n if (type === 'number') {\n processed = processed.replace(/[^\\d]/g, '')\n }\n\n // Filter characters using pattern if provided\n if (pattern) {\n try {\n // Convert HTML pattern (string) to RegExp\n // HTML patterns validate the entire string, but we need to test each character\n // We create a regex that tests if a single character matches the pattern\n // For example: [0-9]* becomes ^[0-9]$ to test a single digit\n // We wrap the pattern in ^...$ to ensure it matches a single character\n let regexPattern = pattern\n // If pattern doesn't start with ^, wrap it to test single character\n if (!pattern.startsWith('^')) {\n regexPattern = `^${pattern}$`\n }\n const regex = new RegExp(regexPattern)\n processed = processed\n .split('')\n .filter(currChar => {\n // Test if the character matches the pattern\n return regex.test(currChar)\n })\n .join('')\n } catch (error) {\n // If pattern is invalid, ignore it and continue with other filters\n console.error('Invalid pattern provided to InputOTP:', pattern, error)\n }\n }\n\n return processed\n }\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n const inputValue = e.target.value\n const processedValue = processInputValue(inputValue)\n\n // Limit to maxLength\n const newValue = processedValue.slice(0, maxLength)\n\n // Call onValueChange callback first (before updating state)\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Sync cursor position\n const newActiveIndex = Math.min(newValue.length, maxLength - 1)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n // Allow copy/cut/paste/selectAll shortcuts even when key is in filterKeys\n const isShortcut =\n (e.ctrlKey || e.metaKey) && ['a', 'c', 'v', 'x'].includes(e.key.toLowerCase())\n\n // Filter keys\n if (filterKeys.length > 0 && filterKeys.includes(e.key) && !isShortcut) {\n e.preventDefault()\n\n return\n }\n\n switch (e.key) {\n case BACKSPACE_KEY:\n e.preventDefault()\n const currentLength = currentValue.length\n if (currentLength > 0) {\n const newValue = currentValue.slice(0, currentLength - 1)\n\n // Call onValueChange first\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Sync cursor position\n const newActiveIndex = Math.max(0, newValue.length)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n break\n\n case LEFT_ARROW_KEY:\n case RIGHT_ARROW_KEY:\n // Prevent navigation with arrow keys - focus stays on last empty slot\n e.preventDefault()\n break\n\n case UP_ARROW_KEY:\n case DOWN_ARROW_KEY:\n e.preventDefault()\n break\n\n case E_KEY:\n case 'E':\n // Prevent 'e' or 'E' in number inputs\n if (type === 'number') {\n e.preventDefault()\n }\n break\n\n default:\n break\n }\n }\n\n const handleCopy: ClipboardEventHandler<HTMLInputElement> = e => {\n if (disabled) return\n\n e.preventDefault()\n if (currentValue.length > 0) {\n e.clipboardData.setData('text/plain', currentValue)\n }\n }\n\n const handlePaste: ClipboardEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n e.preventDefault()\n\n const pastedText = e.clipboardData.getData('text')\n\n if (!pastedText) return\n\n const processedText = processInputValue(pastedText)\n const newValue = processedText.slice(0, maxLength)\n\n // Call onValueChange callback first (before updating state)\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Move cursor to end\n const newActiveIndex = Math.min(newValue.length, maxLength - 1)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n\n const handleFocus = () => {\n setIsFocused(true)\n if (inputRef.current) {\n // Focus on last empty slot, or last slot if all are filled\n const cursorPosition = Math.min(currentValue.length, maxLength - 1)\n inputRef.current.setSelectionRange(cursorPosition, cursorPosition)\n }\n }\n\n const handleBlur = () => {\n setIsFocused(false)\n }\n\n const handleClick = () => {\n if (inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n const contextValue: InputOTPContextValue = {\n value: currentValue,\n maxLength,\n slots,\n activeIndex,\n intent,\n disabled,\n readOnly,\n placeholder,\n type,\n }\n\n const returnValue: UseInputOTPReturn = {\n uuid: id,\n inputRef,\n containerRef,\n name,\n disabled,\n readOnly,\n isInvalid,\n isRequired,\n description,\n maxLength,\n intent,\n currentValue,\n activeIndex,\n slots,\n contextValue,\n handleChange,\n handleKeyDown,\n handleCopy,\n handlePaste,\n handleFocus,\n handleBlur,\n handleClick,\n labelId,\n }\n\n return returnValue\n}\n","/* eslint-disable max-lines-per-function */\nimport { cx } from 'class-variance-authority'\nimport {\n Children,\n cloneElement,\n ComponentPropsWithoutRef,\n isValidElement,\n ReactElement,\n ReactNode,\n Ref,\n useMemo,\n} from 'react'\n\nimport { InputOTPContext } from './InputOTPContext'\nimport { InputOTPSlot } from './InputOTPSlot'\nimport { useInputOTP } from './useInputOTP'\n\n/**\n * Counts the number of InputOTPSlot components in the children tree\n */\nconst countSlots = (children: ReactNode): number => {\n let count = 0\n\n Children.forEach(children, child => {\n if (isValidElement(child)) {\n const props = child.props as { children?: ReactNode }\n // Check if it's an InputOTPSlot by checking displayName\n if (\n child.type === InputOTPSlot ||\n (child.type as { displayName?: string })?.displayName === 'InputOTP.Slot'\n ) {\n count++\n } else if (props.children) {\n // Recursively count slots in nested children (e.g., inside InputOTPGroup)\n count += countSlots(props.children)\n }\n }\n })\n\n return count\n}\n\n/**\n * Recursively assigns index to InputOTPSlot components\n * Returns a tuple of [processedChildren, nextIndex]\n */\nconst assignSlotIndexes = (children: ReactNode, startIndex: number = 0): [ReactNode, number] => {\n let currentIndex = startIndex\n\n const processed = Children.map(children, child => {\n if (isValidElement(child)) {\n const props = child.props as { index?: number; children?: ReactNode }\n // Check if it's an InputOTPSlot\n if (\n child.type === InputOTPSlot ||\n (child.type as { displayName?: string })?.displayName === 'InputOTP.Slot'\n ) {\n // Only assign index if not already provided\n const slotIndex = typeof props.index === 'number' ? props.index : currentIndex++\n\n return cloneElement(child as ReactElement<{ index?: number }>, {\n ...props,\n index: slotIndex,\n })\n } else if (props.children) {\n // Recursively process nested children\n const [processedChildren, nextIndex] = assignSlotIndexes(props.children, currentIndex)\n currentIndex = nextIndex\n\n return cloneElement(child, {\n ...(child.props as Record<string, unknown>),\n children: processedChildren,\n } as Parameters<typeof cloneElement>[1])\n }\n }\n\n return child\n })\n\n return [processed, currentIndex]\n}\n\nexport interface InputOTPProps\n extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange' | 'inputMode'> {\n /**\n * Maximum length of the input value.\n * If not provided, will be automatically detected from the number of InputOTP.Slot children.\n */\n maxLength?: number\n /**\n * Type of input\n * @default 'text'\n */\n type?: 'text' | 'number' | 'password' | 'tel'\n /**\n * Current value (controlled mode)\n */\n value?: string\n /**\n * Default value (uncontrolled mode)\n */\n defaultValue?: string\n /**\n * Callback fired when the value changes\n */\n onValueChange?: (value: string) => void\n /**\n * Whether the input is valid\n * @default true\n */\n isValid?: boolean\n /**\n * Whether the input is disabled\n * @default false\n */\n disabled?: boolean\n /**\n * Whether the input is read-only (value visible but not editable)\n * @default false\n */\n readOnly?: boolean\n /**\n * Whether to auto-focus the input\n * @default false\n */\n autoFocus?: boolean\n /**\n * Auto-complete attribute\n * @default 'off'\n */\n autoComplete?: string\n /**\n * Whether to force uppercase\n * @default false\n */\n forceUppercase?: boolean\n /**\n * Array of keys to filter out (using KeyboardEvent.key values)\n * @default ['-', '.']\n */\n filterKeys?: string[]\n /**\n * Pattern attribute for input validation and character filtering.\n * Uses a regular expression to filter allowed characters in real-time.\n * For example: \"[0-9]\" for digits only, \"[a-c]\" for letters a, b, c only.\n */\n pattern?: string\n /**\n * Input mode attribute\n */\n inputMode?: string\n /**\n * Placeholder text\n */\n placeholder?: string\n /**\n * Name attribute for form integration\n */\n name?: string\n /**\n * Children components (InputOTPGroup, InputOTPSlot, InputOTPSeparator)\n */\n children: ReactNode\n /**\n * Ref callback for the container\n */\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputOTP = ({\n maxLength: maxLengthProp,\n type = 'text',\n value: controlledValue,\n defaultValue = '',\n onValueChange,\n isValid = true,\n disabled: disabledProp = false,\n readOnly: readOnlyProp = false,\n autoFocus = false,\n autoComplete = 'off',\n forceUppercase = false,\n filterKeys = ['-', '.'],\n pattern,\n inputMode,\n placeholder = '-',\n name: nameProp,\n className,\n children,\n ...others\n}: InputOTPProps) => {\n // Auto-detect maxLength from children if not provided\n const maxLength = useMemo(() => {\n if (maxLengthProp !== undefined) {\n return maxLengthProp\n }\n\n const detectedLength = countSlots(children)\n const DEFAULT_MAX_LENGTH = 4\n\n return detectedLength > 0 ? detectedLength : DEFAULT_MAX_LENGTH // fallback to 4 if no slots found\n }, [maxLengthProp, children])\n\n // Assign indexes to slots automatically\n const processedChildren = useMemo(() => {\n const [processed] = assignSlotIndexes(children)\n\n return processed\n }, [children])\n\n // Use the hook for all business logic\n const {\n uuid,\n inputRef,\n containerRef,\n name,\n disabled,\n readOnly,\n isInvalid,\n isRequired,\n description,\n currentValue,\n contextValue,\n handleChange,\n handleKeyDown,\n handleCopy,\n handlePaste,\n handleFocus,\n handleBlur,\n handleClick,\n labelId,\n } = useInputOTP({\n maxLength,\n type,\n value: controlledValue,\n defaultValue,\n onValueChange,\n isValid,\n disabledProp,\n readOnlyProp,\n autoFocus,\n forceUppercase,\n filterKeys,\n pattern,\n placeholder,\n nameProp,\n })\n\n // Extract aria-label from others if provided (for cases without FormField)\n const ariaLabel =\n 'aria-label' in others ? (others['aria-label'] as string | undefined) : undefined\n const { 'aria-label': _, ...restOthers } = others\n\n const getAccessibleNameProps = (): Record<string, string | undefined> => {\n if (labelId) {\n return { 'aria-labelledby': labelId }\n }\n\n if (ariaLabel) {\n return { 'aria-label': ariaLabel }\n }\n\n return {}\n }\n\n const accessibleNameProps = getAccessibleNameProps()\n\n return (\n <InputOTPContext.Provider value={contextValue}>\n <div\n ref={containerRef}\n data-spark-component=\"input-otp\"\n role=\"group\"\n {...accessibleNameProps}\n {...(description ? { 'aria-describedby': description } : {})}\n className={cx(\n 'group gap-md relative inline-flex w-fit items-center default:cursor-text',\n {\n 'cursor-not-allowed': disabled,\n 'cursor-default': readOnly,\n },\n className\n )}\n onClick={handleClick}\n {...restOthers}\n >\n {/* Hidden input for form submission with complete value */}\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={currentValue}\n required={isRequired}\n aria-required={isRequired}\n aria-invalid={isInvalid}\n {...accessibleNameProps}\n />\n )}\n {/* Actual input that handles all interactions */}\n <input\n ref={inputRef}\n id={uuid}\n type={type === 'password' ? 'password' : 'text'}\n value={currentValue}\n maxLength={maxLength}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n disabled={disabled}\n readOnly={readOnly}\n pattern={pattern}\n inputMode={inputMode as React.InputHTMLAttributes<HTMLInputElement>['inputMode']}\n {...accessibleNameProps}\n {...(description ? { 'aria-describedby': description } : {})}\n aria-invalid={isInvalid}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onCopy={handleCopy}\n onPaste={handlePaste}\n onFocus={handleFocus}\n onBlur={handleBlur}\n className=\"bg-success z-raised absolute inset-0 m-0 p-0 opacity-0 read-only:cursor-default disabled:cursor-not-allowed\"\n tabIndex={0}\n />\n {/* Children render slots with auto-assigned indexes */}\n {processedChildren}\n </div>\n </InputOTPContext.Provider>\n )\n}\n\nInputOTP.displayName = 'InputOTP'\n","import { ComponentPropsWithoutRef } from 'react'\n\nexport interface InputOTPGroupProps extends ComponentPropsWithoutRef<'div'> {}\n\nexport const InputOTPGroup = ({ children, className, ...props }: InputOTPGroupProps) => {\n return (\n <div className={`gap-md flex ${className}`} {...props}>\n {children}\n </div>\n )\n}\n\nInputOTPGroup.displayName = 'InputOTP.Group'\n","import { ComponentPropsWithoutRef } from 'react'\n\nexport interface InputOTPSeparatorProps extends ComponentPropsWithoutRef<'div'> {}\n\nexport const InputOTPSeparator = ({ className, ...props }: InputOTPSeparatorProps) => {\n return (\n <div\n className={`text-on-surface/dim-3 flex items-center justify-center ${className || ''}`}\n {...props}\n >\n <div className=\"h-sz-4 w-sz-8 bg-outline rounded-full\" />\n </div>\n )\n}\n\nInputOTPSeparator.displayName = 'InputOTP.Separator'\n","import { InputOTP as Root } from './InputOTP'\nimport { InputOTPGroup } from './InputOTPGroup'\nimport { InputOTPSeparator } from './InputOTPSeparator'\nimport { InputOTPSlot } from './InputOTPSlot'\n\nexport const InputOTP: typeof Root & {\n Group: typeof InputOTPGroup\n Slot: typeof InputOTPSlot\n Separator: typeof InputOTPSeparator\n} = Object.assign(Root, {\n Group: InputOTPGroup,\n Slot: InputOTPSlot,\n Separator: InputOTPSeparator,\n})\n\nInputOTP.displayName = 'InputOTP'\nInputOTPGroup.displayName = 'InputOTP.Group'\nInputOTPSlot.displayName = 'InputOTP.Slot'\nInputOTPSeparator.displayName = 'InputOTP.Separator'\n\nexport { type InputOTPProps } from './InputOTP'\nexport { type InputOTPGroupProps } from './InputOTPGroup'\nexport { type InputOTPSlotProps } from './InputOTPSlot'\nexport { type InputOTPSeparatorProps } from './InputOTPSeparator'\nexport {\n inputOTPSlotStyles,\n inputOTPStyles,\n type InputOTPSlotStylesProps,\n type InputOTPStylesProps,\n} from './InputOTP.styles'\n"],"names":["InputOTPContext","createContext","useInputOTPContext","context","useContext","cva","inputOTPSlotStyles","inputOTPStyles","InputOTPSlot","indexProp","className","props","index","slot","char","isActive","hasFakeCaret","isEmpty","isPlaceholder","isFocusTarget","jsxs","jsx","BACKSPACE_KEY","LEFT_ARROW_KEY","UP_ARROW_KEY","RIGHT_ARROW_KEY","DOWN_ARROW_KEY","E_KEY","useInputOTP","maxLength","type","controlledValue","defaultValue","onValueChange","isValid","disabledProp","readOnlyProp","autoFocus","forceUppercase","filterKeys","pattern","placeholder","nameProp","uuid","useId","inputRef","useRef","containerRef","field","useFormFieldControl","id","name","disabled","readOnly","isInvalid","isRequired","labelId","description","fieldState","intent","initialValue","processedValue","internalValue","setInternalValue","useState","isFocused","setIsFocused","currentValue","activeIndex","useEffect","slots","useMemo","_","i","processInputValue","inputValue","processed","regexPattern","regex","currChar","error","e","newValue","newActiveIndex","isShortcut","currentLength","pastedText","cursorPosition","countSlots","children","count","Children","child","isValidElement","assignSlotIndexes","startIndex","currentIndex","slotIndex","cloneElement","processedChildren","nextIndex","InputOTP","maxLengthProp","autoComplete","inputMode","others","detectedLength","contextValue","handleChange","handleKeyDown","handleCopy","handlePaste","handleFocus","handleBlur","handleClick","ariaLabel","restOthers","accessibleNameProps","cx","InputOTPGroup","InputOTPSeparator","Root"],"mappings":";;;;AAkBO,MAAMA,KAAkBC,GAA2C,IAAI,GAEjEC,KAAqB,MAAM;AACtC,QAAMC,IAAUC,GAAWJ,EAAe;AAC1C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,kDAAkD;AAGpE,SAAOA;AACT;ACzBuCE,GAAI,CAAC,YAAY,eAAe,gBAAgB,QAAQ,CAAC;AAEzF,MAAMC,KAAqBD;AAAA,EAChC;AAAA;AAAA,IAEE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAA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","names":[],"sources":["../../src/input-otp/InputOTPContext.tsx","../../src/input-otp/InputOTP.styles.ts","../../src/input-otp/InputOTPSlot.tsx","../../src/input-otp/useInputOTP.ts","../../src/input-otp/InputOTP.tsx","../../src/input-otp/InputOTPGroup.tsx","../../src/input-otp/InputOTPSeparator.tsx","../../src/input-otp/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nexport interface InputOTPContextValue {\n value: string\n maxLength: number\n slots: {\n char: string\n isActive: boolean\n hasFakeCaret: boolean\n }[]\n activeIndex: number\n intent: 'neutral' | 'success' | 'alert' | 'error'\n disabled: boolean\n readOnly: boolean\n placeholder?: string\n type: 'text' | 'number' | 'password' | 'tel'\n}\n\nexport const InputOTPContext = createContext<InputOTPContextValue | null>(null)\n\nexport const useInputOTPContext = () => {\n const context = useContext(InputOTPContext)\n if (!context) {\n throw new Error('InputOTP components must be used within InputOTP')\n }\n\n return context\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputOTPContainerStyles = cva(['relative', 'inline-flex', 'items-center', 'gap-sm'])\n\nexport const inputOTPSlotStyles = cva(\n [\n // Base slot styles\n 'relative h-[50px] w-sz-40',\n 'border-sm rounded-md',\n 'text-center text-display-3 text-on-surface',\n 'outline-hidden',\n 'transition-colors',\n 'flex items-center justify-center',\n // Slot that receives focus when clicking the group (first empty or last slot)\n // Use data-[focus-target=true]:... for distinct styles\n // Active state (when focused)\n 'data-[active=true]:ring-1',\n 'data-[active=true]:ring-inset',\n 'data-[active=true]:ring-l-2',\n 'data-[active=true]:border-focus',\n 'data-[active=true]:z-raised ring-focus',\n // Disabled state\n 'data-[disabled=true]:cursor-not-allowed',\n 'data-[disabled=true]:border-outline',\n 'data-[disabled=true]:bg-on-surface/dim-5',\n 'data-[disabled=true]:text-on-surface/dim-3',\n // Read-only state (same as disabled but text stays normal)\n 'data-[readonly=true]:cursor-default',\n 'data-[readonly=true]:data-[active=false]:border-outline',\n 'data-[readonly=true]:bg-on-surface/dim-5',\n 'group-hover:data-[focus-target=true]:data-[disabled=false]:border-outline-high',\n ],\n {\n variants: {\n /**\n * Color scheme of the slot\n */\n intent: {\n neutral: ['data-[filled=true]:bg-neutral-container bg-surface border-outline'],\n success: ['border-success bg-success-container text-on-success-container'],\n alert: ['border-alert bg-alert-container text-on-alert-container'],\n error: ['border-error bg-error-container text-on-error-container'],\n },\n },\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputOTPSlotStylesProps = VariantProps<typeof inputOTPSlotStyles>\n\n// Keep for backward compatibility\nexport const inputOTPStyles = inputOTPSlotStyles\nexport type InputOTPStylesProps = InputOTPSlotStylesProps\n","import { ComponentPropsWithoutRef } from 'react'\n\nimport { inputOTPSlotStyles } from './InputOTP.styles'\nimport { useInputOTPContext } from './InputOTPContext'\n\nexport interface InputOTPSlotProps extends ComponentPropsWithoutRef<'div'> {\n /**\n * Index of the slot (0-based).\n * If not provided, will be automatically assigned based on position in children.\n */\n index?: number\n}\n\nexport const InputOTPSlot = ({ index: indexProp, className, ...props }: InputOTPSlotProps) => {\n const context = useInputOTPContext()\n\n // Use provided index or fallback to 0 (should not happen if auto-assignment works)\n const index = indexProp ?? 0\n const slot = context.slots[index]\n\n if (!slot) {\n return null\n }\n\n const { char, isActive, hasFakeCaret } = slot\n const isEmpty = !char\n const isPlaceholder = isEmpty && !hasFakeCaret && context.placeholder\n\n const isFocusTarget = index === context.activeIndex\n\n return (\n <div\n className={inputOTPSlotStyles({\n intent: context.intent,\n className,\n })}\n data-active={isActive}\n data-disabled={context.disabled}\n data-readonly={context.readOnly}\n data-filled={!isEmpty}\n data-focus-target={isFocusTarget}\n data-valid={context.intent !== 'error'}\n {...props}\n >\n <span className={isPlaceholder ? 'text-on-surface/dim-3' : ''}>\n {context.type === 'password' && char\n ? '•'\n : char || (!hasFakeCaret && context.placeholder ? context.placeholder : '')}\n </span>\n {hasFakeCaret && (\n <span\n className=\"pointer-events-none absolute inset-0 flex items-center justify-center\"\n aria-hidden=\"true\"\n >\n <span className=\"bg-on-surface animate-standalone-caret-blink h-sz-24 w-sz-2\" />\n </span>\n )}\n </div>\n )\n}\n\nInputOTPSlot.displayName = 'InputOTP.Slot'\n","/* eslint-disable max-lines-per-function */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport {\n ChangeEventHandler,\n ClipboardEventHandler,\n KeyboardEventHandler,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport type { InputOTPContextValue } from './InputOTPContext'\n\nconst BACKSPACE_KEY = 'Backspace'\nconst LEFT_ARROW_KEY = 'ArrowLeft'\nconst UP_ARROW_KEY = 'ArrowUp'\nconst RIGHT_ARROW_KEY = 'ArrowRight'\nconst DOWN_ARROW_KEY = 'ArrowDown'\nconst E_KEY = 'e'\n\nexport interface UseInputOTPProps {\n maxLength: number\n type: 'text' | 'number' | 'password' | 'tel'\n value?: string\n defaultValue: string\n onValueChange?: (value: string) => void\n isValid: boolean\n disabledProp: boolean\n readOnlyProp: boolean\n autoFocus: boolean\n forceUppercase: boolean\n filterKeys: string[]\n pattern?: string\n placeholder: string\n nameProp?: string\n}\n\nexport interface UseInputOTPReturn {\n uuid: string\n inputRef: React.RefObject<HTMLInputElement | null>\n containerRef: React.RefObject<HTMLDivElement | null>\n name: string | undefined\n disabled: boolean\n readOnly: boolean\n isInvalid: boolean\n isRequired: boolean\n description: string | undefined\n maxLength: number\n intent: 'neutral' | 'success' | 'alert' | 'error'\n currentValue: string\n activeIndex: number\n slots: {\n char: string\n isActive: boolean\n hasFakeCaret: boolean\n }[]\n contextValue: InputOTPContextValue\n handleChange: ChangeEventHandler<HTMLInputElement>\n handleKeyDown: KeyboardEventHandler<HTMLInputElement>\n handleCopy: ClipboardEventHandler<HTMLInputElement>\n handlePaste: ClipboardEventHandler<HTMLInputElement>\n handleFocus: () => void\n handleBlur: () => void\n handleClick: () => void\n labelId: string | undefined\n}\n\nexport const useInputOTP = ({\n maxLength,\n type,\n value: controlledValue,\n defaultValue,\n onValueChange,\n isValid,\n disabledProp,\n readOnlyProp,\n autoFocus,\n forceUppercase,\n filterKeys,\n pattern,\n placeholder,\n nameProp,\n}: UseInputOTPProps): UseInputOTPReturn => {\n const uuid = useId()\n const inputRef = useRef<HTMLInputElement>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n\n // Get FormField context (optional, falls back gracefully if not present)\n const field = useFormFieldControl()\n\n // Use FormField values if available, otherwise fall back to props\n // Use FormField id when available so label htmlFor works correctly\n const id = field.id ?? uuid\n const name = nameProp ?? field.name\n const disabled = field.disabled ?? disabledProp\n const readOnly = field.readOnly ?? readOnlyProp\n const isInvalid = field.isInvalid ?? !isValid\n const isRequired = field.isRequired ?? false\n const labelId = field.labelId\n const description = field.description\n const fieldState = field.state\n\n // Determine intent based on FormField state or isValid prop\n const getIntent = (): 'neutral' | 'success' | 'alert' | 'error' => {\n // FormField state takes priority\n if (['success', 'alert', 'error'].includes(fieldState ?? '')) {\n return fieldState as 'success' | 'alert' | 'error'\n }\n\n // Fallback to isValid prop for backward compatibility\n if (isInvalid) {\n return 'error'\n }\n\n return 'neutral'\n }\n\n const intent = getIntent()\n\n // Initialize value\n const initialValue = controlledValue !== undefined ? controlledValue : defaultValue\n const processedValue = forceUppercase ? initialValue.toUpperCase() : initialValue\n\n const [internalValue, setInternalValue] = useState<string>(processedValue)\n const [isFocused, setIsFocused] = useState<boolean>(false)\n\n // Use controlled value if provided, otherwise use internal state\n const currentValue = controlledValue !== undefined ? controlledValue : internalValue\n\n // Calculate active index: last empty slot, or last slot if all are filled\n const activeIndex = Math.min(currentValue.length, maxLength - 1)\n\n // Sync cursor position with active index\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.setSelectionRange(activeIndex, activeIndex)\n }\n }, [activeIndex, currentValue.length, maxLength])\n\n // Create slots array\n const slots = useMemo(\n () =>\n Array.from({ length: maxLength }, (_, i) => ({\n char: currentValue[i] || '',\n isActive: i === activeIndex && isFocused,\n hasFakeCaret: i === activeIndex && !currentValue[i] && !disabled && !readOnly && isFocused,\n })),\n [maxLength, currentValue, activeIndex, isFocused, disabled, readOnly]\n )\n\n // Sync controlled value with input ref\n useEffect(() => {\n if (inputRef.current && controlledValue !== undefined) {\n inputRef.current.value = controlledValue\n }\n }, [controlledValue])\n\n // Focus management\n useEffect(() => {\n if (autoFocus && inputRef.current) {\n inputRef.current.focus()\n }\n }, [autoFocus])\n\n const processInputValue = (inputValue: string): string => {\n let processed = inputValue\n\n if (forceUppercase) {\n processed = processed.toUpperCase()\n }\n\n if (type === 'number') {\n processed = processed.replace(/[^\\d]/g, '')\n }\n\n // Filter characters using pattern if provided\n if (pattern) {\n try {\n // Convert HTML pattern (string) to RegExp\n // HTML patterns validate the entire string, but we need to test each character\n // We create a regex that tests if a single character matches the pattern\n // For example: [0-9]* becomes ^[0-9]$ to test a single digit\n // We wrap the pattern in ^...$ to ensure it matches a single character\n let regexPattern = pattern\n // If pattern doesn't start with ^, wrap it to test single character\n if (!pattern.startsWith('^')) {\n regexPattern = `^${pattern}$`\n }\n const regex = new RegExp(regexPattern)\n processed = processed\n .split('')\n .filter(currChar => {\n // Test if the character matches the pattern\n return regex.test(currChar)\n })\n .join('')\n } catch (error) {\n // If pattern is invalid, ignore it and continue with other filters\n console.error('Invalid pattern provided to InputOTP:', pattern, error)\n }\n }\n\n return processed\n }\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n const inputValue = e.target.value\n const processedValue = processInputValue(inputValue)\n\n // Limit to maxLength\n const newValue = processedValue.slice(0, maxLength)\n\n // Call onValueChange callback first (before updating state)\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Sync cursor position\n const newActiveIndex = Math.min(newValue.length, maxLength - 1)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n // Allow copy/cut/paste/selectAll shortcuts even when key is in filterKeys\n const isShortcut =\n (e.ctrlKey || e.metaKey) && ['a', 'c', 'v', 'x'].includes(e.key.toLowerCase())\n\n // Filter keys\n if (filterKeys.length > 0 && filterKeys.includes(e.key) && !isShortcut) {\n e.preventDefault()\n\n return\n }\n\n switch (e.key) {\n case BACKSPACE_KEY:\n e.preventDefault()\n const currentLength = currentValue.length\n if (currentLength > 0) {\n const newValue = currentValue.slice(0, currentLength - 1)\n\n // Call onValueChange first\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Sync cursor position\n const newActiveIndex = Math.max(0, newValue.length)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n break\n\n case LEFT_ARROW_KEY:\n case RIGHT_ARROW_KEY:\n // Prevent navigation with arrow keys - focus stays on last empty slot\n e.preventDefault()\n break\n\n case UP_ARROW_KEY:\n case DOWN_ARROW_KEY:\n e.preventDefault()\n break\n\n case E_KEY:\n case 'E':\n // Prevent 'e' or 'E' in number inputs\n if (type === 'number') {\n e.preventDefault()\n }\n break\n\n default:\n break\n }\n }\n\n const handleCopy: ClipboardEventHandler<HTMLInputElement> = e => {\n if (disabled) return\n\n e.preventDefault()\n if (currentValue.length > 0) {\n e.clipboardData.setData('text/plain', currentValue)\n }\n }\n\n const handlePaste: ClipboardEventHandler<HTMLInputElement> = e => {\n if (disabled || readOnly) return\n\n e.preventDefault()\n\n const pastedText = e.clipboardData.getData('text')\n\n if (!pastedText) return\n\n const processedText = processInputValue(pastedText)\n const newValue = processedText.slice(0, maxLength)\n\n // Call onValueChange callback first (before updating state)\n if (onValueChange) {\n onValueChange(newValue)\n }\n\n // Update state only in uncontrolled mode\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n // Active index is automatically calculated based on value length\n // Move cursor to end\n const newActiveIndex = Math.min(newValue.length, maxLength - 1)\n if (inputRef.current) {\n inputRef.current.setSelectionRange(newActiveIndex, newActiveIndex)\n }\n }\n\n const handleFocus = () => {\n setIsFocused(true)\n if (inputRef.current) {\n // Focus on last empty slot, or last slot if all are filled\n const cursorPosition = Math.min(currentValue.length, maxLength - 1)\n inputRef.current.setSelectionRange(cursorPosition, cursorPosition)\n }\n }\n\n const handleBlur = () => {\n setIsFocused(false)\n }\n\n const handleClick = () => {\n if (inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n const contextValue: InputOTPContextValue = {\n value: currentValue,\n maxLength,\n slots,\n activeIndex,\n intent,\n disabled,\n readOnly,\n placeholder,\n type,\n }\n\n const returnValue: UseInputOTPReturn = {\n uuid: id,\n inputRef,\n containerRef,\n name,\n disabled,\n readOnly,\n isInvalid,\n isRequired,\n description,\n maxLength,\n intent,\n currentValue,\n activeIndex,\n slots,\n contextValue,\n handleChange,\n handleKeyDown,\n handleCopy,\n handlePaste,\n handleFocus,\n handleBlur,\n handleClick,\n labelId,\n }\n\n return returnValue\n}\n","/* eslint-disable max-lines-per-function */\nimport { cx } from 'class-variance-authority'\nimport {\n Children,\n cloneElement,\n ComponentPropsWithoutRef,\n isValidElement,\n ReactElement,\n ReactNode,\n Ref,\n useMemo,\n} from 'react'\n\nimport { InputOTPContext } from './InputOTPContext'\nimport { InputOTPSlot } from './InputOTPSlot'\nimport { useInputOTP } from './useInputOTP'\n\n/**\n * Counts the number of InputOTPSlot components in the children tree\n */\nconst countSlots = (children: ReactNode): number => {\n let count = 0\n\n Children.forEach(children, child => {\n if (isValidElement(child)) {\n const props = child.props as { children?: ReactNode }\n // Check if it's an InputOTPSlot by checking displayName\n if (\n child.type === InputOTPSlot ||\n (child.type as { displayName?: string })?.displayName === 'InputOTP.Slot'\n ) {\n count++\n } else if (props.children) {\n // Recursively count slots in nested children (e.g., inside InputOTPGroup)\n count += countSlots(props.children)\n }\n }\n })\n\n return count\n}\n\n/**\n * Recursively assigns index to InputOTPSlot components\n * Returns a tuple of [processedChildren, nextIndex]\n */\nconst assignSlotIndexes = (children: ReactNode, startIndex: number = 0): [ReactNode, number] => {\n let currentIndex = startIndex\n\n const processed = Children.map(children, child => {\n if (isValidElement(child)) {\n const props = child.props as { index?: number; children?: ReactNode }\n // Check if it's an InputOTPSlot\n if (\n child.type === InputOTPSlot ||\n (child.type as { displayName?: string })?.displayName === 'InputOTP.Slot'\n ) {\n // Only assign index if not already provided\n const slotIndex = typeof props.index === 'number' ? props.index : currentIndex++\n\n return cloneElement(child as ReactElement<{ index?: number }>, {\n ...props,\n index: slotIndex,\n })\n } else if (props.children) {\n // Recursively process nested children\n const [processedChildren, nextIndex] = assignSlotIndexes(props.children, currentIndex)\n currentIndex = nextIndex\n\n return cloneElement(child, {\n ...(child.props as Record<string, unknown>),\n children: processedChildren,\n } as Parameters<typeof cloneElement>[1])\n }\n }\n\n return child\n })\n\n return [processed, currentIndex]\n}\n\nexport interface InputOTPProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'onChange' | 'inputMode'\n> {\n /**\n * Maximum length of the input value.\n * If not provided, will be automatically detected from the number of InputOTP.Slot children.\n */\n maxLength?: number\n /**\n * Type of input\n * @default 'text'\n */\n type?: 'text' | 'number' | 'password' | 'tel'\n /**\n * Current value (controlled mode)\n */\n value?: string\n /**\n * Default value (uncontrolled mode)\n */\n defaultValue?: string\n /**\n * Callback fired when the value changes\n */\n onValueChange?: (value: string) => void\n /**\n * Whether the input is valid\n * @default true\n */\n isValid?: boolean\n /**\n * Whether the input is disabled\n * @default false\n */\n disabled?: boolean\n /**\n * Whether the input is read-only (value visible but not editable)\n * @default false\n */\n readOnly?: boolean\n /**\n * Whether to auto-focus the input\n * @default false\n */\n autoFocus?: boolean\n /**\n * Auto-complete attribute\n * @default 'off'\n */\n autoComplete?: string\n /**\n * Whether to force uppercase\n * @default false\n */\n forceUppercase?: boolean\n /**\n * Array of keys to filter out (using KeyboardEvent.key values)\n * @default ['-', '.']\n */\n filterKeys?: string[]\n /**\n * Pattern attribute for input validation and character filtering.\n * Uses a regular expression to filter allowed characters in real-time.\n * For example: \"[0-9]\" for digits only, \"[a-c]\" for letters a, b, c only.\n */\n pattern?: string\n /**\n * Input mode attribute\n */\n inputMode?: string\n /**\n * Placeholder text\n */\n placeholder?: string\n /**\n * Name attribute for form integration\n */\n name?: string\n /**\n * Children components (InputOTPGroup, InputOTPSlot, InputOTPSeparator)\n */\n children: ReactNode\n /**\n * Ref callback for the container\n */\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputOTP = ({\n maxLength: maxLengthProp,\n type = 'text',\n value: controlledValue,\n defaultValue = '',\n onValueChange,\n isValid = true,\n disabled: disabledProp = false,\n readOnly: readOnlyProp = false,\n autoFocus = false,\n autoComplete = 'off',\n forceUppercase = false,\n filterKeys = ['-', '.'],\n pattern,\n inputMode,\n placeholder = '-',\n name: nameProp,\n className,\n children,\n ...others\n}: InputOTPProps) => {\n // Auto-detect maxLength from children if not provided\n const maxLength = useMemo(() => {\n if (maxLengthProp !== undefined) {\n return maxLengthProp\n }\n\n const detectedLength = countSlots(children)\n const DEFAULT_MAX_LENGTH = 4\n\n return detectedLength > 0 ? detectedLength : DEFAULT_MAX_LENGTH // fallback to 4 if no slots found\n }, [maxLengthProp, children])\n\n // Assign indexes to slots automatically\n const processedChildren = useMemo(() => {\n const [processed] = assignSlotIndexes(children)\n\n return processed\n }, [children])\n\n // Use the hook for all business logic\n const {\n uuid,\n inputRef,\n containerRef,\n name,\n disabled,\n readOnly,\n isInvalid,\n isRequired,\n description,\n currentValue,\n contextValue,\n handleChange,\n handleKeyDown,\n handleCopy,\n handlePaste,\n handleFocus,\n handleBlur,\n handleClick,\n labelId,\n } = useInputOTP({\n maxLength,\n type,\n value: controlledValue,\n defaultValue,\n onValueChange,\n isValid,\n disabledProp,\n readOnlyProp,\n autoFocus,\n forceUppercase,\n filterKeys,\n pattern,\n placeholder,\n nameProp,\n })\n\n // Extract aria-label from others if provided (for cases without FormField)\n const ariaLabel =\n 'aria-label' in others ? (others['aria-label'] as string | undefined) : undefined\n const { 'aria-label': _, ...restOthers } = others\n\n const getAccessibleNameProps = (): Record<string, string | undefined> => {\n if (labelId) {\n return { 'aria-labelledby': labelId }\n }\n\n if (ariaLabel) {\n return { 'aria-label': ariaLabel }\n }\n\n return {}\n }\n\n const accessibleNameProps = getAccessibleNameProps()\n\n return (\n <InputOTPContext.Provider value={contextValue}>\n <div\n ref={containerRef}\n data-spark-component=\"input-otp\"\n role=\"group\"\n {...accessibleNameProps}\n {...(description ? { 'aria-describedby': description } : {})}\n className={cx(\n 'group gap-md relative inline-flex w-fit items-center default:cursor-text',\n {\n 'cursor-not-allowed': disabled,\n 'cursor-default': readOnly,\n },\n className\n )}\n onClick={handleClick}\n {...restOthers}\n >\n {/* Hidden input for form submission with complete value */}\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={currentValue}\n required={isRequired}\n aria-required={isRequired}\n aria-invalid={isInvalid}\n {...accessibleNameProps}\n />\n )}\n {/* Actual input that handles all interactions */}\n <input\n ref={inputRef}\n id={uuid}\n type={type === 'password' ? 'password' : 'text'}\n value={currentValue}\n maxLength={maxLength}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n disabled={disabled}\n readOnly={readOnly}\n pattern={pattern}\n inputMode={inputMode as React.InputHTMLAttributes<HTMLInputElement>['inputMode']}\n {...accessibleNameProps}\n {...(description ? { 'aria-describedby': description } : {})}\n aria-invalid={isInvalid}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onCopy={handleCopy}\n onPaste={handlePaste}\n onFocus={handleFocus}\n onBlur={handleBlur}\n className=\"bg-success z-raised absolute inset-0 m-0 p-0 opacity-0 read-only:cursor-default disabled:cursor-not-allowed\"\n tabIndex={0}\n />\n {/* Children render slots with auto-assigned indexes */}\n {processedChildren}\n </div>\n </InputOTPContext.Provider>\n )\n}\n\nInputOTP.displayName = 'InputOTP'\n","import { ComponentPropsWithoutRef } from 'react'\n\nexport interface InputOTPGroupProps extends ComponentPropsWithoutRef<'div'> {}\n\nexport const InputOTPGroup = ({ children, className, ...props }: InputOTPGroupProps) => {\n return (\n <div className={`gap-md flex ${className}`} {...props}>\n {children}\n </div>\n )\n}\n\nInputOTPGroup.displayName = 'InputOTP.Group'\n","import { ComponentPropsWithoutRef } from 'react'\n\nexport interface InputOTPSeparatorProps extends ComponentPropsWithoutRef<'div'> {}\n\nexport const InputOTPSeparator = ({ className, ...props }: InputOTPSeparatorProps) => {\n return (\n <div\n className={`text-on-surface/dim-3 flex items-center justify-center ${className || ''}`}\n {...props}\n >\n <div className=\"h-sz-4 w-sz-8 bg-outline rounded-full\" />\n </div>\n )\n}\n\nInputOTPSeparator.displayName = 'InputOTP.Separator'\n","import { InputOTP as Root } from './InputOTP'\nimport { InputOTPGroup } from './InputOTPGroup'\nimport { InputOTPSeparator } from './InputOTPSeparator'\nimport { InputOTPSlot } from './InputOTPSlot'\n\nexport const InputOTP: typeof Root & {\n Group: typeof InputOTPGroup\n Slot: typeof InputOTPSlot\n Separator: typeof InputOTPSeparator\n} = Object.assign(Root, {\n Group: InputOTPGroup,\n Slot: InputOTPSlot,\n Separator: InputOTPSeparator,\n})\n\nInputOTP.displayName = 'InputOTP'\nInputOTPGroup.displayName = 'InputOTP.Group'\nInputOTPSlot.displayName = 'InputOTP.Slot'\nInputOTPSeparator.displayName = 'InputOTP.Separator'\n\nexport { type InputOTPProps } from './InputOTP'\nexport { type InputOTPGroupProps } from './InputOTPGroup'\nexport { type InputOTPSlotProps } from './InputOTPSlot'\nexport { type InputOTPSeparatorProps } from './InputOTPSeparator'\nexport {\n inputOTPSlotStyles,\n inputOTPStyles,\n type InputOTPSlotStylesProps,\n type InputOTPStylesProps,\n} from './InputOTP.styles'\n"],"mappings":";;;;;AAkBA,IAAa,IAAkB,EAA2C,KAAK,EAElE,UAA2B;CACtC,IAAM,IAAU,EAAW,EAAgB;AAC3C,KAAI,CAAC,EACH,OA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AAW,eAAe;CAAa,GAAI;CAC7C;CACG,CAAA;AAIV,EAAc,cAAc;;;ACR5B,IAAa,KAAqB,EAAE,cAAW,GAAG,QAE9C,kBAAC,OAAD;CACE,WAAW,0DAA0D,KAAa;CAClF,GAAI;WAEJ,kBAAC,OAAD,EAAK,WAAU,yCAA0C,CAAA;CACrD,CAAA;AAIV,EAAkB,cAAc;;;ACVhC,IAAa,IAIT,OAAO,OAAO,GAAM;CACtB,OAAO;CACP,MAAM;CACN,WAAW;CACZ,CAAC;AAEF,EAAS,cAAc,YACvB,EAAc,cAAc,kBAC5B,EAAa,cAAc,iBAC3B,EAAkB,cAAc"}
|
package/dist/kbd/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);let e=require(`react/jsx-runtime`);var t=({className:t,ref:n,...r})=>(0,e.jsx)(`kbd`,{"data-spark-component":`kbd`,ref:n,className:[`border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4 font-bold whitespace-nowrap`,t].join(` `),...r});exports.Kbd=t;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/kbd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/kbd/Kbd.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, PropsWithChildren, Ref } from 'react'\n\nexport type KbdProps = ComponentPropsWithoutRef<'div'> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Kbd = ({ className, ref, ...props }: PropsWithChildren<KbdProps>) => {\n return (\n <kbd\n data-spark-component=\"kbd\"\n ref={ref}\n className={[\n 'border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4 font-bold whitespace-nowrap',\n className,\n ].join(' ')}\n {...props}\n />\n )\n}\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/kbd/Kbd.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, PropsWithChildren, Ref } from 'react'\n\nexport type KbdProps = ComponentPropsWithoutRef<'div'> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Kbd = ({ className, ref, ...props }: PropsWithChildren<KbdProps>) => {\n return (\n <kbd\n data-spark-component=\"kbd\"\n ref={ref}\n className={[\n 'border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4 font-bold whitespace-nowrap',\n className,\n ].join(' ')}\n {...props}\n />\n )\n}\n"],"mappings":"sIAMA,IAAa,GAAO,CAAE,YAAW,MAAK,GAAG,MAErC,EAAA,EAAA,KAAC,MAAD,CACE,uBAAqB,MAChB,MACL,UAAW,CACT,gJACA,EACD,CAAC,KAAK,IAAI,CACX,GAAI,EACJ,CAAA"}
|
package/dist/kbd/index.mjs
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
);
|
|
14
|
-
export {
|
|
15
|
-
d as Kbd
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
//#region src/kbd/Kbd.tsx
|
|
3
|
+
var t = ({ className: t, ref: n, ...r }) => /* @__PURE__ */ e("kbd", {
|
|
4
|
+
"data-spark-component": "kbd",
|
|
5
|
+
ref: n,
|
|
6
|
+
className: ["border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4 font-bold whitespace-nowrap", t].join(" "),
|
|
7
|
+
...r
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as Kbd };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/kbd/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/kbd/Kbd.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, PropsWithChildren, Ref } from 'react'\n\nexport type KbdProps = ComponentPropsWithoutRef<'div'> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Kbd = ({ className, ref, ...props }: PropsWithChildren<KbdProps>) => {\n return (\n <kbd\n data-spark-component=\"kbd\"\n ref={ref}\n className={[\n 'border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4 font-bold whitespace-nowrap',\n className,\n ].join(' ')}\n {...props}\n />\n )\n}\n"],"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/kbd/Kbd.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, PropsWithChildren, Ref } from 'react'\n\nexport type KbdProps = ComponentPropsWithoutRef<'div'> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Kbd = ({ className, ref, ...props }: PropsWithChildren<KbdProps>) => {\n return (\n <kbd\n data-spark-component=\"kbd\"\n ref={ref}\n className={[\n 'border-sm border-b-md border-outline bg-neutral-container pe-md ps-md text-caption rounded-sm font-mono leading-4 font-bold whitespace-nowrap',\n className,\n ].join(' ')}\n {...props}\n />\n )\n}\n"],"mappings":";;AAMA,IAAa,KAAO,EAAE,cAAW,QAAK,GAAG,QAErC,kBAAC,OAAD;CACE,wBAAqB;CAChB;CACL,WAAW,CACT,iJACA,EACD,CAAC,KAAK,IAAI;CACX,GAAI;CACJ,CAAA"}
|
package/dist/label/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../label-DU0p0d-f.js`);exports.Label=e.t;
|
package/dist/label/index.mjs
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Label as d } from "radix-ui";
|
|
4
|
-
const l = ({ className: a, ref: e, ...r }) => /* @__PURE__ */ i(
|
|
5
|
-
d.Label,
|
|
6
|
-
{
|
|
7
|
-
ref: e,
|
|
8
|
-
"data-spark-component": "label",
|
|
9
|
-
className: o("text-body-1", a),
|
|
10
|
-
...r
|
|
11
|
-
}
|
|
12
|
-
);
|
|
13
|
-
l.displayName = "Label";
|
|
14
|
-
const t = ({
|
|
15
|
-
className: a,
|
|
16
|
-
children: e = "*",
|
|
17
|
-
ref: r,
|
|
18
|
-
...n
|
|
19
|
-
}) => /* @__PURE__ */ i(
|
|
20
|
-
"span",
|
|
21
|
-
{
|
|
22
|
-
ref: r,
|
|
23
|
-
"data-spark-component": "label-required-indicator",
|
|
24
|
-
role: "presentation",
|
|
25
|
-
"aria-hidden": "true",
|
|
26
|
-
className: o(a, "text-caption text-on-surface/dim-1"),
|
|
27
|
-
...n,
|
|
28
|
-
children: e
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
t.displayName = "Label.RequiredIndicator";
|
|
32
|
-
const s = Object.assign(l, {
|
|
33
|
-
RequiredIndicator: t
|
|
34
|
-
});
|
|
35
|
-
s.displayName = "Label";
|
|
36
|
-
t.displayName = "Label.RequiredIndicator";
|
|
37
|
-
export {
|
|
38
|
-
s as Label
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import { t as e } from "../label-BqRlrca0.mjs";
|
|
2
|
+
export { e as Label };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cx as e } from "class-variance-authority";
|
|
2
|
+
import { Label as t } from "radix-ui";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/label/Label.tsx
|
|
5
|
+
var r = ({ className: r, ref: i, ...a }) => /* @__PURE__ */ n(t.Label, {
|
|
6
|
+
ref: i,
|
|
7
|
+
"data-spark-component": "label",
|
|
8
|
+
className: e("text-body-1", r),
|
|
9
|
+
...a
|
|
10
|
+
});
|
|
11
|
+
r.displayName = "Label";
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/label/LabelRequiredIndicator.tsx
|
|
14
|
+
var i = ({ className: t, children: r = "*", ref: i, ...a }) => /* @__PURE__ */ n("span", {
|
|
15
|
+
ref: i,
|
|
16
|
+
"data-spark-component": "label-required-indicator",
|
|
17
|
+
role: "presentation",
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
className: e(t, "text-caption text-on-surface/dim-1"),
|
|
20
|
+
...a,
|
|
21
|
+
children: r
|
|
22
|
+
});
|
|
23
|
+
i.displayName = "Label.RequiredIndicator";
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/label/index.ts
|
|
26
|
+
var a = Object.assign(r, { RequiredIndicator: i });
|
|
27
|
+
a.displayName = "Label", i.displayName = "Label.RequiredIndicator";
|
|
28
|
+
//#endregion
|
|
29
|
+
export { a as t };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=label-BqRlrca0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-BqRlrca0.mjs","names":[],"sources":["../src/label/Label.tsx","../src/label/LabelRequiredIndicator.tsx","../src/label/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { Label as RadixLabel } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type LabelProps = RadixLabel.LabelProps & {\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const Label = ({ className, ref, ...others }: LabelProps) => {\n return (\n <RadixLabel.Label\n ref={ref}\n data-spark-component=\"label\"\n className={cx('text-body-1', className)}\n {...others}\n />\n )\n}\n\nLabel.displayName = 'Label'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nexport type LabelRequiredIndicatorProps = ComponentPropsWithRef<'span'>\n\nexport const LabelRequiredIndicator = ({\n className,\n children = '*',\n ref,\n ...others\n}: LabelRequiredIndicatorProps) => {\n return (\n <span\n ref={ref}\n data-spark-component=\"label-required-indicator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cx(className, 'text-caption text-on-surface/dim-1')}\n {...others}\n >\n {children}\n </span>\n )\n}\n\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n","import { Label as Root } from './Label'\nimport { LabelRequiredIndicator } from './LabelRequiredIndicator'\n\nexport const Label: typeof Root & {\n RequiredIndicator: typeof LabelRequiredIndicator\n} = Object.assign(Root, {\n RequiredIndicator: LabelRequiredIndicator,\n})\n\nLabel.displayName = 'Label'\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n\nexport type { LabelProps } from './Label'\nexport type { LabelRequiredIndicatorProps } from './LabelRequiredIndicator'\n"],"mappings":";;;;AAQA,IAAa,KAAS,EAAE,cAAW,QAAK,GAAG,QAEvC,kBAAC,EAAW,OAAZ;CACO;CACL,wBAAqB;CACrB,WAAW,EAAG,eAAe,EAAU;CACvC,GAAI;CACJ,CAAA;AAIN,EAAM,cAAc;;;ACdpB,IAAa,KAA0B,EACrC,cACA,cAAW,KACX,QACA,GAAG,QAGD,kBAAC,QAAD;CACO;CACL,wBAAqB;CACrB,MAAK;CACL,eAAY;CACZ,WAAW,EAAG,GAAW,qCAAqC;CAC9D,GAAI;CAEH;CACI,CAAA;AAIX,EAAuB,cAAc;;;ACtBrC,IAAa,IAET,OAAO,OAAO,GAAM,EACtB,mBAAmB,GACpB,CAAC;AAEF,EAAM,cAAc,SACpB,EAAuB,cAAc"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
require(`./chunk-C91j1N6u.js`);let e=require(`class-variance-authority`),t=require(`radix-ui`),n=require(`react/jsx-runtime`);var r=({className:r,ref:i,...a})=>(0,n.jsx)(t.Label.Label,{ref:i,"data-spark-component":`label`,className:(0,e.cx)(`text-body-1`,r),...a});r.displayName=`Label`;var i=({className:t,children:r=`*`,ref:i,...a})=>(0,n.jsx)(`span`,{ref:i,"data-spark-component":`label-required-indicator`,role:`presentation`,"aria-hidden":`true`,className:(0,e.cx)(t,`text-caption text-on-surface/dim-1`),...a,children:r});i.displayName=`Label.RequiredIndicator`;var a=Object.assign(r,{RequiredIndicator:i});a.displayName=`Label`,i.displayName=`Label.RequiredIndicator`,Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
|
|
2
|
+
//# sourceMappingURL=label-DU0p0d-f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-DU0p0d-f.js","names":[],"sources":["../src/label/Label.tsx","../src/label/LabelRequiredIndicator.tsx","../src/label/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { Label as RadixLabel } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type LabelProps = RadixLabel.LabelProps & {\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const Label = ({ className, ref, ...others }: LabelProps) => {\n return (\n <RadixLabel.Label\n ref={ref}\n data-spark-component=\"label\"\n className={cx('text-body-1', className)}\n {...others}\n />\n )\n}\n\nLabel.displayName = 'Label'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nexport type LabelRequiredIndicatorProps = ComponentPropsWithRef<'span'>\n\nexport const LabelRequiredIndicator = ({\n className,\n children = '*',\n ref,\n ...others\n}: LabelRequiredIndicatorProps) => {\n return (\n <span\n ref={ref}\n data-spark-component=\"label-required-indicator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cx(className, 'text-caption text-on-surface/dim-1')}\n {...others}\n >\n {children}\n </span>\n )\n}\n\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n","import { Label as Root } from './Label'\nimport { LabelRequiredIndicator } from './LabelRequiredIndicator'\n\nexport const Label: typeof Root & {\n RequiredIndicator: typeof LabelRequiredIndicator\n} = Object.assign(Root, {\n RequiredIndicator: LabelRequiredIndicator,\n})\n\nLabel.displayName = 'Label'\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n\nexport type { LabelProps } from './Label'\nexport type { LabelRequiredIndicatorProps } from './LabelRequiredIndicator'\n"],"mappings":"8HAQA,IAAa,GAAS,CAAE,YAAW,MAAK,GAAG,MAEvC,EAAA,EAAA,KAAC,EAAA,MAAW,MAAZ,CACO,MACL,uBAAqB,QACrB,WAAA,EAAA,EAAA,IAAc,cAAe,EAAU,CACvC,GAAI,EACJ,CAAA,CAIN,EAAM,YAAc,QCdpB,IAAa,GAA0B,CACrC,YACA,WAAW,IACX,MACA,GAAG,MAGD,EAAA,EAAA,KAAC,OAAD,CACO,MACL,uBAAqB,2BACrB,KAAK,eACL,cAAY,OACZ,WAAA,EAAA,EAAA,IAAc,EAAW,qCAAqC,CAC9D,GAAI,EAEH,WACI,CAAA,CAIX,EAAuB,YAAc,0BCtBrC,IAAa,EAET,OAAO,OAAO,EAAM,CACtB,kBAAmB,EACpB,CAAC,CAEF,EAAM,YAAc,QACpB,EAAuB,YAAc"}
|
package/dist/link-box/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);const e=require(`../slot/index.js`);let t=require(`class-variance-authority`),n=require(`react/jsx-runtime`);var r=({className:r,asChild:i,ref:a,...o})=>(0,n.jsx)(i?e.Slot:`div`,{ref:a,"data-spark-component":`link-box`,className:(0,t.cx)(`default:relative`,r),...o});r.displayName=`LinkBox`;var i=({className:r,asChild:i,ref:a,...o})=>(0,n.jsx)(i?e.Slot:`a`,{ref:a,"data-spark-component":`link-box-link`,className:(0,t.cx)(`before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']`,r),...o});i.displayName=`LinkBox.Link`;var a=({className:r,...i})=>(0,n.jsx)(e.Slot,{className:(0,t.cx)(`default:z-raised default:relative`,r),...i});a.displayName=`LinkBox.Raised`;var o=Object.assign(r,{Link:i,Raised:a});o.displayName=`LinkBox`,o.Link.displayName=`LinkBox.Link`,o.Raised.displayName=`LinkBox.Raised`,exports.LinkBox=o;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/link-box/LinkBox.tsx","../../src/link-box/LinkBoxLink.tsx","../../src/link-box/LinkBoxRaised.tsx","../../src/link-box/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxProps extends ComponentPropsWithRef<'div'> {\n asChild?: boolean\n}\n\nexport const LinkBox = ({ className, asChild, ref, ...props }: LinkBoxProps) => {\n const Component = asChild ? Slot : 'div'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box\"\n className={cx('default:relative', className)}\n {...props}\n />\n )\n}\n\nLinkBox.displayName = 'LinkBox'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxLinkProps extends ComponentPropsWithRef<'a'> {\n asChild?: boolean\n}\n\nexport const LinkBoxLink = ({ className, asChild, ref, ...props }: LinkBoxLinkProps) => {\n const Component = asChild ? Slot : 'a'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box-link\"\n className={cx(\n \"before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']\",\n className\n )}\n {...props}\n />\n )\n}\n\nLinkBoxLink.displayName = 'LinkBox.Link'\n","import { cx } from 'class-variance-authority'\nimport { ReactNode } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxRaisedProps {\n className?: string\n children: ReactNode\n}\n\nexport const LinkBoxRaised = ({ className, ...props }: LinkBoxRaisedProps) => {\n return <Slot className={cx('default:z-raised default:relative', className)} {...props} />\n}\n\nLinkBoxRaised.displayName = 'LinkBox.Raised'\n","import { LinkBox as Root } from './LinkBox'\nimport { LinkBoxLink } from './LinkBoxLink'\nimport { LinkBoxRaised } from './LinkBoxRaised'\n\nexport const LinkBox: typeof Root & {\n Link: typeof LinkBoxLink\n Raised: typeof LinkBoxRaised\n} = Object.assign(Root, { Link: LinkBoxLink, Raised: LinkBoxRaised })\n\nLinkBox.displayName = 'LinkBox'\nLinkBox.Link.displayName = 'LinkBox.Link'\nLinkBox.Raised.displayName = 'LinkBox.Raised'\n\nexport { type LinkBoxProps } from './LinkBox'\nexport { type LinkBoxLinkProps } from './LinkBoxLink'\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/link-box/LinkBox.tsx","../../src/link-box/LinkBoxLink.tsx","../../src/link-box/LinkBoxRaised.tsx","../../src/link-box/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxProps extends ComponentPropsWithRef<'div'> {\n asChild?: boolean\n}\n\nexport const LinkBox = ({ className, asChild, ref, ...props }: LinkBoxProps) => {\n const Component = asChild ? Slot : 'div'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box\"\n className={cx('default:relative', className)}\n {...props}\n />\n )\n}\n\nLinkBox.displayName = 'LinkBox'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxLinkProps extends ComponentPropsWithRef<'a'> {\n asChild?: boolean\n}\n\nexport const LinkBoxLink = ({ className, asChild, ref, ...props }: LinkBoxLinkProps) => {\n const Component = asChild ? Slot : 'a'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box-link\"\n className={cx(\n \"before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']\",\n className\n )}\n {...props}\n />\n )\n}\n\nLinkBoxLink.displayName = 'LinkBox.Link'\n","import { cx } from 'class-variance-authority'\nimport { ReactNode } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxRaisedProps {\n className?: string\n children: ReactNode\n}\n\nexport const LinkBoxRaised = ({ className, ...props }: LinkBoxRaisedProps) => {\n return <Slot className={cx('default:z-raised default:relative', className)} {...props} />\n}\n\nLinkBoxRaised.displayName = 'LinkBox.Raised'\n","import { LinkBox as Root } from './LinkBox'\nimport { LinkBoxLink } from './LinkBoxLink'\nimport { LinkBoxRaised } from './LinkBoxRaised'\n\nexport const LinkBox: typeof Root & {\n Link: typeof LinkBoxLink\n Raised: typeof LinkBoxRaised\n} = Object.assign(Root, { Link: LinkBoxLink, Raised: LinkBoxRaised })\n\nLinkBox.displayName = 'LinkBox'\nLinkBox.Link.displayName = 'LinkBox.Link'\nLinkBox.Raised.displayName = 'LinkBox.Raised'\n\nexport { type LinkBoxProps } from './LinkBox'\nexport { type LinkBoxLinkProps } from './LinkBoxLink'\n"],"mappings":"gNASA,IAAa,GAAW,CAAE,YAAW,UAAS,MAAK,GAAG,MAIlD,EAAA,EAAA,KAHgB,EAAU,EAAA,KAAO,MAGjC,CACO,MACL,uBAAqB,WACrB,WAAA,EAAA,EAAA,IAAc,mBAAoB,EAAU,CAC5C,GAAI,EACJ,CAAA,CAIN,EAAQ,YAAc,UCbtB,IAAa,GAAe,CAAE,YAAW,UAAS,MAAK,GAAG,MAItD,EAAA,EAAA,KAHgB,EAAU,EAAA,KAAO,IAGjC,CACO,MACL,uBAAqB,gBACrB,WAAA,EAAA,EAAA,IACE,oHACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,EAAY,YAAc,eCf1B,IAAa,GAAiB,CAAE,YAAW,GAAG,MACrC,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,WAAA,EAAA,EAAA,IAAc,oCAAqC,EAAU,CAAE,GAAI,EAAS,CAAA,CAG3F,EAAc,YAAc,iBCV5B,IAAa,EAGT,OAAO,OAAO,EAAM,CAAE,KAAM,EAAa,OAAQ,EAAe,CAAC,CAErE,EAAQ,YAAc,UACtB,EAAQ,KAAK,YAAc,eAC3B,EAAQ,OAAO,YAAc"}
|
package/dist/link-box/index.mjs
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Slot as e } from "../slot/index.mjs";
|
|
2
2
|
import { cx as t } from "class-variance-authority";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
);
|
|
13
|
-
l.displayName = "LinkBox";
|
|
14
|
-
const k = ({ className: e, asChild: o, ref: n, ...a }) => /* @__PURE__ */ i(
|
|
15
|
-
o ? s : "a",
|
|
16
|
-
{
|
|
17
|
-
ref: n,
|
|
18
|
-
"data-spark-component": "link-box-link",
|
|
19
|
-
className: t(
|
|
20
|
-
"before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']",
|
|
21
|
-
e
|
|
22
|
-
),
|
|
23
|
-
...a
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
k.displayName = "LinkBox.Link";
|
|
27
|
-
const m = ({ className: e, ...o }) => /* @__PURE__ */ i(s, { className: t("default:z-raised default:relative", e), ...o });
|
|
28
|
-
m.displayName = "LinkBox.Raised";
|
|
29
|
-
const r = Object.assign(l, { Link: k, Raised: m });
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/link-box/LinkBox.tsx
|
|
5
|
+
var r = ({ className: r, asChild: i, ref: a, ...o }) => /* @__PURE__ */ n(i ? e : "div", {
|
|
6
|
+
ref: a,
|
|
7
|
+
"data-spark-component": "link-box",
|
|
8
|
+
className: t("default:relative", r),
|
|
9
|
+
...o
|
|
10
|
+
});
|
|
30
11
|
r.displayName = "LinkBox";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/link-box/LinkBoxLink.tsx
|
|
14
|
+
var i = ({ className: r, asChild: i, ref: a, ...o }) => /* @__PURE__ */ n(i ? e : "a", {
|
|
15
|
+
ref: a,
|
|
16
|
+
"data-spark-component": "link-box-link",
|
|
17
|
+
className: t("before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']", r),
|
|
18
|
+
...o
|
|
19
|
+
});
|
|
20
|
+
i.displayName = "LinkBox.Link";
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/link-box/LinkBoxRaised.tsx
|
|
23
|
+
var a = ({ className: r, ...i }) => /* @__PURE__ */ n(e, {
|
|
24
|
+
className: t("default:z-raised default:relative", r),
|
|
25
|
+
...i
|
|
26
|
+
});
|
|
27
|
+
a.displayName = "LinkBox.Raised";
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/link-box/index.ts
|
|
30
|
+
var o = Object.assign(r, {
|
|
31
|
+
Link: i,
|
|
32
|
+
Raised: a
|
|
33
|
+
});
|
|
34
|
+
o.displayName = "LinkBox", o.Link.displayName = "LinkBox.Link", o.Raised.displayName = "LinkBox.Raised";
|
|
35
|
+
//#endregion
|
|
36
|
+
export { o as LinkBox };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/link-box/LinkBox.tsx","../../src/link-box/LinkBoxLink.tsx","../../src/link-box/LinkBoxRaised.tsx","../../src/link-box/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxProps extends ComponentPropsWithRef<'div'> {\n asChild?: boolean\n}\n\nexport const LinkBox = ({ className, asChild, ref, ...props }: LinkBoxProps) => {\n const Component = asChild ? Slot : 'div'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box\"\n className={cx('default:relative', className)}\n {...props}\n />\n )\n}\n\nLinkBox.displayName = 'LinkBox'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxLinkProps extends ComponentPropsWithRef<'a'> {\n asChild?: boolean\n}\n\nexport const LinkBoxLink = ({ className, asChild, ref, ...props }: LinkBoxLinkProps) => {\n const Component = asChild ? Slot : 'a'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box-link\"\n className={cx(\n \"before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']\",\n className\n )}\n {...props}\n />\n )\n}\n\nLinkBoxLink.displayName = 'LinkBox.Link'\n","import { cx } from 'class-variance-authority'\nimport { ReactNode } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxRaisedProps {\n className?: string\n children: ReactNode\n}\n\nexport const LinkBoxRaised = ({ className, ...props }: LinkBoxRaisedProps) => {\n return <Slot className={cx('default:z-raised default:relative', className)} {...props} />\n}\n\nLinkBoxRaised.displayName = 'LinkBox.Raised'\n","import { LinkBox as Root } from './LinkBox'\nimport { LinkBoxLink } from './LinkBoxLink'\nimport { LinkBoxRaised } from './LinkBoxRaised'\n\nexport const LinkBox: typeof Root & {\n Link: typeof LinkBoxLink\n Raised: typeof LinkBoxRaised\n} = Object.assign(Root, { Link: LinkBoxLink, Raised: LinkBoxRaised })\n\nLinkBox.displayName = 'LinkBox'\nLinkBox.Link.displayName = 'LinkBox.Link'\nLinkBox.Raised.displayName = 'LinkBox.Raised'\n\nexport { type LinkBoxProps } from './LinkBox'\nexport { type LinkBoxLinkProps } from './LinkBoxLink'\n"],"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/link-box/LinkBox.tsx","../../src/link-box/LinkBoxLink.tsx","../../src/link-box/LinkBoxRaised.tsx","../../src/link-box/index.ts"],"sourcesContent":["import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxProps extends ComponentPropsWithRef<'div'> {\n asChild?: boolean\n}\n\nexport const LinkBox = ({ className, asChild, ref, ...props }: LinkBoxProps) => {\n const Component = asChild ? Slot : 'div'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box\"\n className={cx('default:relative', className)}\n {...props}\n />\n )\n}\n\nLinkBox.displayName = 'LinkBox'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxLinkProps extends ComponentPropsWithRef<'a'> {\n asChild?: boolean\n}\n\nexport const LinkBoxLink = ({ className, asChild, ref, ...props }: LinkBoxLinkProps) => {\n const Component = asChild ? Slot : 'a'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"link-box-link\"\n className={cx(\n \"before:z-base static before:absolute before:top-0 before:left-0 before:block before:size-full before:content-['']\",\n className\n )}\n {...props}\n />\n )\n}\n\nLinkBoxLink.displayName = 'LinkBox.Link'\n","import { cx } from 'class-variance-authority'\nimport { ReactNode } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface LinkBoxRaisedProps {\n className?: string\n children: ReactNode\n}\n\nexport const LinkBoxRaised = ({ className, ...props }: LinkBoxRaisedProps) => {\n return <Slot className={cx('default:z-raised default:relative', className)} {...props} />\n}\n\nLinkBoxRaised.displayName = 'LinkBox.Raised'\n","import { LinkBox as Root } from './LinkBox'\nimport { LinkBoxLink } from './LinkBoxLink'\nimport { LinkBoxRaised } from './LinkBoxRaised'\n\nexport const LinkBox: typeof Root & {\n Link: typeof LinkBoxLink\n Raised: typeof LinkBoxRaised\n} = Object.assign(Root, { Link: LinkBoxLink, Raised: LinkBoxRaised })\n\nLinkBox.displayName = 'LinkBox'\nLinkBox.Link.displayName = 'LinkBox.Link'\nLinkBox.Raised.displayName = 'LinkBox.Raised'\n\nexport { type LinkBoxProps } from './LinkBox'\nexport { type LinkBoxLinkProps } from './LinkBoxLink'\n"],"mappings":";;;;AASA,IAAa,KAAW,EAAE,cAAW,YAAS,QAAK,GAAG,QAIlD,kBAHgB,IAAU,IAAO,OAGjC;CACO;CACL,wBAAqB;CACrB,WAAW,EAAG,oBAAoB,EAAU;CAC5C,GAAI;CACJ,CAAA;AAIN,EAAQ,cAAc;;;ACbtB,IAAa,KAAe,EAAE,cAAW,YAAS,QAAK,GAAG,QAItD,kBAHgB,IAAU,IAAO,KAGjC;CACO;CACL,wBAAqB;CACrB,WAAW,EACT,qHACA,EACD;CACD,GAAI;CACJ,CAAA;AAIN,EAAY,cAAc;;;ACf1B,IAAa,KAAiB,EAAE,cAAW,GAAG,QACrC,kBAAC,GAAD;CAAM,WAAW,EAAG,qCAAqC,EAAU;CAAE,GAAI;CAAS,CAAA;AAG3F,EAAc,cAAc;;;ACV5B,IAAa,IAGT,OAAO,OAAO,GAAM;CAAE,MAAM;CAAa,QAAQ;CAAe,CAAC;AAErE,EAAQ,cAAc,WACtB,EAAQ,KAAK,cAAc,gBAC3B,EAAQ,OAAO,cAAc"}
|
package/dist/meter/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);let e=require(`class-variance-authority`),t=require(`react`),n=require(`react/jsx-runtime`),r=require(`@spark-ui/hooks/use-merge-refs`),i=require(`@base-ui/react/meter`);var a=(0,t.createContext)(null),o=`:meter`,s=()=>{let e=(0,t.useContext)(a);if(!e)throw Error(`useMeter must be used within a Meter provider`);return e},c=({className:r,value:o,max:s=100,min:c=0,shape:l=`rounded`,intent:u=`support`,children:d,ref:f,...p})=>{let[m,h]=(0,t.useState)(),g=(0,t.useMemo)(()=>({value:o??0,max:s,min:c,intent:u,shape:l,onLabelId:h}),[s,c,o,u,l,h]);return(0,n.jsx)(a.Provider,{value:g,children:(0,n.jsx)(i.Meter.Root,{"data-spark-component":`meter`,ref:f,className:(0,e.cx)(`gap-y-sm gap-x-md focus-visible:u-outline box-border grid grid-cols-[1fr_auto]`,r),value:o,max:s,min:c,"aria-labelledby":m,...p,children:d})})};c.displayName=`Meter`;var l=({id:e,children:a,ref:c,...l})=>{let u=`${o}-label-${(0,t.useId)()}`,d=e||u,{onLabelId:f}=s(),p=(0,r.useMergeRefs)(c,(0,t.useCallback)(e=>{f(e?d:void 0)},[d,f]));return(0,n.jsx)(i.Meter.Label,{"data-spark-component":`meter-label`,id:d,className:`default:text-body-1 text-on-surface default:font-bold`,ref:p,...l,children:a})};l.displayName=`Meter.Label`;var u=(0,e.cva)([`relative col-span-2`,`h-sz-8 w-full`,`transform-gpu overflow-hidden`,`bg-on-background/dim-4`]),d=(0,e.cva)([`size-full`,`ease-standard transition-[width] duration-700`,`motion-reduce:transition-none`],{variants:{intent:{main:[`bg-main`],support:[`bg-support`],success:[`bg-success`],alert:[`bg-alert`],danger:[`bg-error`],info:[`bg-info`]},shape:{square:[],rounded:[`rounded-sm`]}}});function f(e,n,r={}){let{threshold:i=.1,rootMargin:a}=r,o=(0,t.useRef)(!1),s=(0,t.useRef)(n);return(0,t.useEffect)(()=>{s.current=n},[n]),(0,t.useEffect)(()=>{let t=e.current;if(!t||o.current)return;let n=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&!o.current&&requestAnimationFrame(()=>{o.current||(o.current=!0,s.current(),n.disconnect())})})},{threshold:i,rootMargin:a});return n.observe(t),()=>{n.disconnect()}},[e,i,a]),o.current}var p=({className:r,...a})=>{let{value:o,max:c,min:l,intent:p,shape:m}=s(),h=(o-l)/(c-l)*100,g=(0,t.useRef)(null),[_,v]=(0,t.useState)(!1);return f(g,()=>{v(!0)}),(0,n.jsx)(i.Meter.Track,{ref:g,"data-spark-component":`meter-track`,className:(0,e.cx)(u(),{"rounded-sm":m===`rounded`},r),...a,children:(0,n.jsx)(i.Meter.Indicator,{"data-spark-component":`meter-indicator`,className:d({intent:p,shape:m}),style:{width:_?`${h}%`:`0%`}})})};p.displayName=`Meter.Track`;var m=({className:t,children:r,...a})=>(0,n.jsx)(i.Meter.Value,{"data-spark-component":`meter-value`,className:(0,e.cx)(`default:text-body-1 text-on-surface`,`col-start-2 text-right`,t),...a,children:r});m.displayName=`Meter.Value`;var h=Object.assign(c,{Label:l,Track:p,Value:m});h.displayName=`Meter`,l.displayName=`Meter.Label`,p.displayName=`Meter.Track`,m.displayName=`Meter.Value`,exports.Meter=h;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/meter/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/meter/MeterContext.tsx","../../src/meter/Meter.tsx","../../src/meter/MeterLabel.tsx","../../src/meter/MeterTrack.styles.ts","../../src/meter/useIntersectionAnimation.ts","../../src/meter/MeterTrack.tsx","../../src/meter/MeterValue.tsx","../../src/meter/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterContextValue {\n value: number\n max: number\n min: number\n intent: MeterIndicatorStylesProps['intent']\n shape: 'square' | 'rounded'\n onLabelId: (id?: string) => void\n}\n\nexport const MeterContext = createContext<MeterContextValue | null>(null)\n\nexport const ID_PREFIX = ':meter'\n\nexport const useMeter = () => {\n const context = useContext(MeterContext)\n\n if (!context) {\n throw new Error('useMeter must be used within a Meter provider')\n }\n\n return context\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren, Ref, useMemo, useState } from 'react'\n\nimport { MeterContext } from './MeterContext'\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterProps\n extends Omit<ComponentProps<typeof BaseMeter.Root>, 'render'>,\n Pick<MeterIndicatorStylesProps, 'intent'> {\n /**\n * Shape of the meter track and indicator.\n */\n shape?: 'square' | 'rounded'\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Meter = ({\n className,\n value,\n max = 100,\n min = 0,\n shape = 'rounded',\n intent = 'support',\n children,\n ref,\n ...others\n}: PropsWithChildren<MeterProps>) => {\n const [labelId, setLabelId] = useState<string>()\n\n const contextValue = useMemo(() => {\n return {\n value: value ?? 0,\n max,\n min,\n intent,\n shape,\n onLabelId: setLabelId,\n }\n }, [max, min, value, intent, shape, setLabelId])\n\n return (\n <MeterContext.Provider value={contextValue}>\n <BaseMeter.Root\n data-spark-component=\"meter\"\n ref={ref}\n className={cx(\n 'gap-y-sm gap-x-md focus-visible:u-outline box-border grid grid-cols-[1fr_auto]',\n className\n )}\n value={value}\n max={max}\n min={min}\n aria-labelledby={labelId}\n {...others}\n >\n {children}\n </BaseMeter.Root>\n </MeterContext.Provider>\n )\n}\n\nMeter.displayName = 'Meter'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ComponentProps, useCallback, useId } from 'react'\n\nimport { ID_PREFIX, useMeter } from './MeterContext'\n\nexport type MeterLabelProps = Omit<ComponentProps<typeof BaseMeter.Label>, 'render'>\n\nexport const MeterLabel = ({\n id: idProp,\n children,\n ref: forwardedRef,\n ...others\n}: MeterLabelProps) => {\n const internalID = `${ID_PREFIX}-label-${useId()}`\n const id = idProp || internalID\n\n const { onLabelId } = useMeter()\n const rootRef = useCallback(\n (el: HTMLSpanElement) => {\n onLabelId(el ? id : undefined)\n },\n [id, onLabelId]\n )\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n return (\n <BaseMeter.Label\n data-spark-component=\"meter-label\"\n id={id}\n className=\"default:text-body-1 text-on-surface default:font-bold\"\n ref={ref}\n {...others}\n >\n {children}\n </BaseMeter.Label>\n )\n}\n\nMeterLabel.displayName = 'Meter.Label'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const meterTrackStyles = cva([\n 'relative col-span-2',\n 'h-sz-8 w-full',\n 'transform-gpu overflow-hidden',\n 'bg-on-background/dim-4',\n])\n\nexport type MeterTrackStylesProps = VariantProps<typeof meterTrackStyles>\n\nexport const meterIndicatorStyles = cva(\n ['size-full', 'ease-standard transition-[width] duration-700', 'motion-reduce:transition-none'],\n {\n variants: {\n /**\n * Color scheme of the meter component.\n */\n intent: {\n main: ['bg-main'],\n support: ['bg-support'],\n success: ['bg-success'],\n alert: ['bg-alert'],\n danger: ['bg-error'],\n info: ['bg-info'],\n },\n /**\n * Shape of the meter component.\n */\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n },\n }\n)\n\nexport type MeterIndicatorStylesProps = VariantProps<typeof meterIndicatorStyles>\n","import { RefObject, useEffect, useRef } from 'react'\n\nexport interface UseIntersectionAnimationOptions {\n /**\n * The threshold at which the callback should be triggered.\n * A value of 0 means as soon as any part of the element is visible.\n * A value of 1 means the entire element must be visible.\n * @default 0.1\n */\n threshold?: number\n /**\n * The root margin for the Intersection Observer.\n * This can be used to trigger the animation before the element enters the viewport.\n * @default undefined\n */\n rootMargin?: string\n}\n\n/**\n * Hook to trigger an animation callback when an element enters the viewport.\n * The callback is only triggered once, when the element first becomes visible.\n *\n * @param elementRef - Reference to the element to observe\n * @param onIntersect - Callback to execute when the element enters the viewport\n * @param options - Configuration options for the Intersection Observer\n * @returns Whether the animation has been triggered\n */\nexport function useIntersectionAnimation(\n elementRef: RefObject<Element | null>,\n onIntersect: () => void,\n options: UseIntersectionAnimationOptions = {}\n): boolean {\n const { threshold = 0.1, rootMargin } = options\n const hasTriggeredRef = useRef(false)\n const callbackRef = useRef(onIntersect)\n\n // Keep callback ref up to date\n useEffect(() => {\n callbackRef.current = onIntersect\n }, [onIntersect])\n\n useEffect(() => {\n const element = elementRef.current\n if (!element || hasTriggeredRef.current) return\n\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting && !hasTriggeredRef.current) {\n // Use requestAnimationFrame to ensure the callback runs at the right time\n requestAnimationFrame(() => {\n if (!hasTriggeredRef.current) {\n hasTriggeredRef.current = true\n callbackRef.current()\n // Disconnect observer after callback is triggered (only trigger once)\n observer.disconnect()\n }\n })\n }\n })\n },\n {\n threshold,\n rootMargin,\n }\n )\n\n observer.observe(element)\n\n return () => {\n observer.disconnect()\n }\n }, [elementRef, threshold, rootMargin])\n\n return hasTriggeredRef.current\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, useRef, useState } from 'react'\n\nimport { useMeter } from './MeterContext'\nimport { meterIndicatorStyles, meterTrackStyles } from './MeterTrack.styles'\nimport { useIntersectionAnimation } from './useIntersectionAnimation'\n\nexport type MeterTrackProps = Omit<ComponentProps<typeof BaseMeter.Track>, 'render'>\n\nexport const MeterTrack = ({ className, ...others }: MeterTrackProps) => {\n const { value, max, min, intent, shape } = useMeter()\n const percentage = ((value - min) / (max - min)) * 100\n const trackRef = useRef<HTMLDivElement>(null)\n const [hasAnimated, setHasAnimated] = useState(false)\n\n // Trigger animation when component enters viewport\n useIntersectionAnimation(trackRef, () => {\n setHasAnimated(true)\n })\n\n return (\n <BaseMeter.Track\n ref={trackRef}\n data-spark-component=\"meter-track\"\n className={cx(meterTrackStyles(), { 'rounded-sm': shape === 'rounded' }, className)}\n {...others}\n >\n <BaseMeter.Indicator\n data-spark-component=\"meter-indicator\"\n className={meterIndicatorStyles({ intent, shape })}\n style={{\n width: hasAnimated ? `${percentage}%` : '0%',\n }}\n />\n </BaseMeter.Track>\n )\n}\n\nMeterTrack.displayName = 'Meter.Track'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, ReactNode } from 'react'\n\nexport type MeterValueProps = Omit<\n ComponentProps<typeof BaseMeter.Value>,\n 'render' | 'children'\n> & {\n children?: ((formattedValue: string, value: number) => ReactNode) | null | undefined\n}\n\nexport const MeterValue = ({ className, children, ...others }: MeterValueProps) => {\n return (\n <BaseMeter.Value\n data-spark-component=\"meter-value\"\n className={cx('default:text-body-1 text-on-surface', 'col-start-2 text-right', className)}\n {...others}\n >\n {children}\n </BaseMeter.Value>\n )\n}\n\nMeterValue.displayName = 'Meter.Value'\n","import { Meter as Root } from './Meter'\nimport { MeterLabel } from './MeterLabel'\nimport { MeterTrack } from './MeterTrack'\nimport { MeterValue } from './MeterValue'\n\nexport const Meter: typeof Root & {\n Label: typeof MeterLabel\n Track: typeof MeterTrack\n Value: typeof MeterValue\n} = Object.assign(Root, {\n Label: MeterLabel,\n Track: MeterTrack,\n Value: MeterValue,\n})\n\nMeter.displayName = 'Meter'\nMeterLabel.displayName = 'Meter.Label'\nMeterTrack.displayName = 'Meter.Track'\nMeterValue.displayName = 'Meter.Value'\n\nexport { type MeterProps } from './Meter'\nexport { type MeterLabelProps } from './MeterLabel'\nexport { type MeterTrackProps } from './MeterTrack'\nexport { type MeterValueProps } from './MeterValue'\n"],"names":["MeterContext","createContext","ID_PREFIX","useMeter","context","useContext","Meter","className","value","max","min","shape","intent","children","ref","others","labelId","setLabelId","useState","contextValue","useMemo","jsx","BaseMeter","cx","MeterLabel","idProp","forwardedRef","internalID","useId","id","onLabelId","rootRef","useCallback","el","useMergeRefs","meterTrackStyles","cva","meterIndicatorStyles","useIntersectionAnimation","elementRef","onIntersect","options","threshold","rootMargin","hasTriggeredRef","useRef","callbackRef","useEffect","element","observer","entries","entry","MeterTrack","percentage","trackRef","hasAnimated","setHasAnimated","MeterValue","Root"],"mappings":"4PAaaA,EAAeC,EAAAA,cAAwC,IAAI,EAE3DC,EAAY,SAEZC,EAAW,IAAM,CAC5B,MAAMC,EAAUC,EAAAA,WAAWL,CAAY,EAEvC,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,+CAA+C,EAGjE,OAAOA,CACT,ECJaE,EAAQ,CAAC,CACpB,UAAAC,EACA,MAAAC,EACA,IAAAC,EAAM,IACN,IAAAC,EAAM,EACN,MAAAC,EAAQ,UACR,OAAAC,EAAS,UACT,SAAAC,EACA,IAAAC,EACA,GAAGC,CACL,IAAqC,CACnC,KAAM,CAACC,EAASC,CAAU,EAAIC,WAAA,EAExBC,EAAeC,E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E,EAAe,EAAI,CACrB,CAAC,EAGCnC,EAAAA,IAACC,EAAAA,MAAU,MAAV,CACC,IAAKgC,EACL,uBAAqB,cACrB,UAAW/B,EAAAA,GAAGY,IAAoB,CAAE,aAAcxB,IAAU,SAAA,EAAaJ,CAAS,EACjF,GAAGQ,EAEJ,SAAAM,EAAAA,IAACC,EAAAA,MAAU,UAAV,CACC,uBAAqB,kBACrB,UAAWe,EAAqB,CAAE,OAAAzB,EAAQ,MAAAD,EAAO,EACjD,MAAO,CACL,MAAO4C,EAAc,GAAGF,CAAU,IAAM,IAAA,CAC1C,CAAA,CACF,CAAA,CAGN,EAEAD,EAAW,YAAc,cC5BlB,MAAMK,EAAa,CAAC,CAAE,UAAAlD,EAAW,SAAAM,EAAU,GAAGE,KAEjDM,EAAAA,IAACC,EAAAA,MAAU,MAAV,CACC,uBAAqB,cACrB,UAAWC,EAAAA,GAAG,sCAAuC,yBAA0BhB,CAAS,EACvF,GAAGQ,EAEH,SAAAF,CAAA,CAAA,EAKP4C,EAAW,YAAc,cClBlB,MAAMnD,EAIT,OAAO,OAAOoD,EAAM,CACtB,MAAOlC,EACP,MAAO4B,EACP,MAAOK,CACT,CAAC,EAEDnD,EAAM,YAAc,QACpBkB,EAAW,YAAc,cACzB4B,EAAW,YAAc,cACzBK,EAAW,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/meter/MeterContext.tsx","../../src/meter/Meter.tsx","../../src/meter/MeterLabel.tsx","../../src/meter/MeterTrack.styles.ts","../../src/meter/useIntersectionAnimation.ts","../../src/meter/MeterTrack.tsx","../../src/meter/MeterValue.tsx","../../src/meter/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterContextValue {\n value: number\n max: number\n min: number\n intent: MeterIndicatorStylesProps['intent']\n shape: 'square' | 'rounded'\n onLabelId: (id?: string) => void\n}\n\nexport const MeterContext = createContext<MeterContextValue | null>(null)\n\nexport const ID_PREFIX = ':meter'\n\nexport const useMeter = () => {\n const context = useContext(MeterContext)\n\n if (!context) {\n throw new Error('useMeter must be used within a Meter provider')\n }\n\n return context\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren, Ref, useMemo, useState } from 'react'\n\nimport { MeterContext } from './MeterContext'\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterProps\n extends\n Omit<ComponentProps<typeof BaseMeter.Root>, 'render'>,\n Pick<MeterIndicatorStylesProps, 'intent'> {\n /**\n * Shape of the meter track and indicator.\n */\n shape?: 'square' | 'rounded'\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Meter = ({\n className,\n value,\n max = 100,\n min = 0,\n shape = 'rounded',\n intent = 'support',\n children,\n ref,\n ...others\n}: PropsWithChildren<MeterProps>) => {\n const [labelId, setLabelId] = useState<string>()\n\n const contextValue = useMemo(() => {\n return {\n value: value ?? 0,\n max,\n min,\n intent,\n shape,\n onLabelId: setLabelId,\n }\n }, [max, min, value, intent, shape, setLabelId])\n\n return (\n <MeterContext.Provider value={contextValue}>\n <BaseMeter.Root\n data-spark-component=\"meter\"\n ref={ref}\n className={cx(\n 'gap-y-sm gap-x-md focus-visible:u-outline box-border grid grid-cols-[1fr_auto]',\n className\n )}\n value={value}\n max={max}\n min={min}\n aria-labelledby={labelId}\n {...others}\n >\n {children}\n </BaseMeter.Root>\n </MeterContext.Provider>\n )\n}\n\nMeter.displayName = 'Meter'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ComponentProps, useCallback, useId } from 'react'\n\nimport { ID_PREFIX, useMeter } from './MeterContext'\n\nexport type MeterLabelProps = Omit<ComponentProps<typeof BaseMeter.Label>, 'render'>\n\nexport const MeterLabel = ({\n id: idProp,\n children,\n ref: forwardedRef,\n ...others\n}: MeterLabelProps) => {\n const internalID = `${ID_PREFIX}-label-${useId()}`\n const id = idProp || internalID\n\n const { onLabelId } = useMeter()\n const rootRef = useCallback(\n (el: HTMLSpanElement) => {\n onLabelId(el ? id : undefined)\n },\n [id, onLabelId]\n )\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n return (\n <BaseMeter.Label\n data-spark-component=\"meter-label\"\n id={id}\n className=\"default:text-body-1 text-on-surface default:font-bold\"\n ref={ref}\n {...others}\n >\n {children}\n </BaseMeter.Label>\n )\n}\n\nMeterLabel.displayName = 'Meter.Label'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const meterTrackStyles = cva([\n 'relative col-span-2',\n 'h-sz-8 w-full',\n 'transform-gpu overflow-hidden',\n 'bg-on-background/dim-4',\n])\n\nexport type MeterTrackStylesProps = VariantProps<typeof meterTrackStyles>\n\nexport const meterIndicatorStyles = cva(\n ['size-full', 'ease-standard transition-[width] duration-700', 'motion-reduce:transition-none'],\n {\n variants: {\n /**\n * Color scheme of the meter component.\n */\n intent: {\n main: ['bg-main'],\n support: ['bg-support'],\n success: ['bg-success'],\n alert: ['bg-alert'],\n danger: ['bg-error'],\n info: ['bg-info'],\n },\n /**\n * Shape of the meter component.\n */\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n },\n }\n)\n\nexport type MeterIndicatorStylesProps = VariantProps<typeof meterIndicatorStyles>\n","import { RefObject, useEffect, useRef } from 'react'\n\nexport interface UseIntersectionAnimationOptions {\n /**\n * The threshold at which the callback should be triggered.\n * A value of 0 means as soon as any part of the element is visible.\n * A value of 1 means the entire element must be visible.\n * @default 0.1\n */\n threshold?: number\n /**\n * The root margin for the Intersection Observer.\n * This can be used to trigger the animation before the element enters the viewport.\n * @default undefined\n */\n rootMargin?: string\n}\n\n/**\n * Hook to trigger an animation callback when an element enters the viewport.\n * The callback is only triggered once, when the element first becomes visible.\n *\n * @param elementRef - Reference to the element to observe\n * @param onIntersect - Callback to execute when the element enters the viewport\n * @param options - Configuration options for the Intersection Observer\n * @returns Whether the animation has been triggered\n */\nexport function useIntersectionAnimation(\n elementRef: RefObject<Element | null>,\n onIntersect: () => void,\n options: UseIntersectionAnimationOptions = {}\n): boolean {\n const { threshold = 0.1, rootMargin } = options\n const hasTriggeredRef = useRef(false)\n const callbackRef = useRef(onIntersect)\n\n // Keep callback ref up to date\n useEffect(() => {\n callbackRef.current = onIntersect\n }, [onIntersect])\n\n useEffect(() => {\n const element = elementRef.current\n if (!element || hasTriggeredRef.current) return\n\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting && !hasTriggeredRef.current) {\n // Use requestAnimationFrame to ensure the callback runs at the right time\n requestAnimationFrame(() => {\n if (!hasTriggeredRef.current) {\n hasTriggeredRef.current = true\n callbackRef.current()\n // Disconnect observer after callback is triggered (only trigger once)\n observer.disconnect()\n }\n })\n }\n })\n },\n {\n threshold,\n rootMargin,\n }\n )\n\n observer.observe(element)\n\n return () => {\n observer.disconnect()\n }\n }, [elementRef, threshold, rootMargin])\n\n return hasTriggeredRef.current\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, useRef, useState } from 'react'\n\nimport { useMeter } from './MeterContext'\nimport { meterIndicatorStyles, meterTrackStyles } from './MeterTrack.styles'\nimport { useIntersectionAnimation } from './useIntersectionAnimation'\n\nexport type MeterTrackProps = Omit<ComponentProps<typeof BaseMeter.Track>, 'render'>\n\nexport const MeterTrack = ({ className, ...others }: MeterTrackProps) => {\n const { value, max, min, intent, shape } = useMeter()\n const percentage = ((value - min) / (max - min)) * 100\n const trackRef = useRef<HTMLDivElement>(null)\n const [hasAnimated, setHasAnimated] = useState(false)\n\n // Trigger animation when component enters viewport\n useIntersectionAnimation(trackRef, () => {\n setHasAnimated(true)\n })\n\n return (\n <BaseMeter.Track\n ref={trackRef}\n data-spark-component=\"meter-track\"\n className={cx(meterTrackStyles(), { 'rounded-sm': shape === 'rounded' }, className)}\n {...others}\n >\n <BaseMeter.Indicator\n data-spark-component=\"meter-indicator\"\n className={meterIndicatorStyles({ intent, shape })}\n style={{\n width: hasAnimated ? `${percentage}%` : '0%',\n }}\n />\n </BaseMeter.Track>\n )\n}\n\nMeterTrack.displayName = 'Meter.Track'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, ReactNode } from 'react'\n\nexport type MeterValueProps = Omit<\n ComponentProps<typeof BaseMeter.Value>,\n 'render' | 'children'\n> & {\n children?: ((formattedValue: string, value: number) => ReactNode) | null | undefined\n}\n\nexport const MeterValue = ({ className, children, ...others }: MeterValueProps) => {\n return (\n <BaseMeter.Value\n data-spark-component=\"meter-value\"\n className={cx('default:text-body-1 text-on-surface', 'col-start-2 text-right', className)}\n {...others}\n >\n {children}\n </BaseMeter.Value>\n )\n}\n\nMeterValue.displayName = 'Meter.Value'\n","import { Meter as Root } from './Meter'\nimport { MeterLabel } from './MeterLabel'\nimport { MeterTrack } from './MeterTrack'\nimport { MeterValue } from './MeterValue'\n\nexport const Meter: typeof Root & {\n Label: typeof MeterLabel\n Track: typeof MeterTrack\n Value: typeof MeterValue\n} = Object.assign(Root, {\n Label: MeterLabel,\n Track: MeterTrack,\n Value: MeterValue,\n})\n\nMeter.displayName = 'Meter'\nMeterLabel.displayName = 'Meter.Label'\nMeterTrack.displayName = 'Meter.Track'\nMeterValue.displayName = 'Meter.Value'\n\nexport { type MeterProps } from './Meter'\nexport { type MeterLabelProps } from './MeterLabel'\nexport { type MeterTrackProps } from './MeterTrack'\nexport { type MeterValueProps } from './MeterValue'\n"],"mappings":"6QAaA,IAAa,GAAA,EAAA,EAAA,eAAuD,KAAK,CAE5D,EAAY,SAEZ,MAAiB,CAC5B,IAAM,GAAA,EAAA,EAAA,YAAqB,EAAa,CAExC,GAAI,CAAC,EACH,MAAU,MAAM,gDAAgD,CAGlE,OAAO,GCFI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