jaci-ui 0.9.3 → 1.0.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/CHANGELOG.md +19 -0
- package/README.md +11 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/components/accordion/accordion.cjs.map +1 -1
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert/alert.cjs.map +1 -1
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.cjs.map +1 -1
- package/dist/components/avatar/avatar.cjs.map +1 -1
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.cjs.map +1 -1
- package/dist/components/button/button.cjs +1 -0
- package/dist/components/button/button.cjs.map +1 -1
- package/dist/components/button/button.d.cts +2 -1
- package/dist/components/button/button.d.ts +2 -1
- package/dist/components/button/button.js +1 -0
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button-group/button-group.cjs.map +1 -1
- package/dist/components/calendar/calendar.cjs +4 -6
- package/dist/components/calendar/calendar.cjs.map +1 -1
- package/dist/components/calendar/calendar.js +4 -6
- package/dist/components/calendar/calendar.js.map +1 -1
- package/dist/components/card/card.cjs.map +1 -1
- package/dist/components/carousel/carousel.cjs.map +1 -1
- package/dist/components/carousel/carousel.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.cjs +7 -3
- package/dist/components/checkbox-group/checkbox-group.cjs.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.js +7 -3
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/code/code.cjs.map +1 -1
- package/dist/components/code/code.js.map +1 -1
- package/dist/components/collapsible/collapsible.cjs.map +1 -1
- package/dist/components/collapsible/collapsible.js.map +1 -1
- package/dist/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/components/color-picker/color-picker.js.map +1 -1
- package/dist/components/color-swatch/color-swatch.cjs.map +1 -1
- package/dist/components/combobox/combobox.cjs +2 -1
- package/dist/components/combobox/combobox.cjs.map +1 -1
- package/dist/components/combobox/combobox.js +2 -1
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/command/command.cjs.map +1 -1
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/context-menu/context-menu.cjs.map +1 -1
- package/dist/components/controls/checkbox.cjs.map +1 -1
- package/dist/components/controls/checkbox.js.map +1 -1
- package/dist/components/controls/input.cjs.map +1 -1
- package/dist/components/controls/input.js.map +1 -1
- package/dist/components/controls/radio.cjs.map +1 -1
- package/dist/components/controls/switch.cjs.map +1 -1
- package/dist/components/controls/switch.js.map +1 -1
- package/dist/components/controls/textarea.cjs.map +1 -1
- package/dist/components/controls/textarea.js.map +1 -1
- package/dist/components/copyable/copyable.cjs.map +1 -1
- package/dist/components/copyable/copyable.js.map +1 -1
- package/dist/components/data-toolbar/data-toolbar.cjs.map +1 -1
- package/dist/components/data-toolbar/data-toolbar.js.map +1 -1
- package/dist/components/data-view/data-view.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.cjs +4 -7
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.js +4 -7
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.cjs +4 -6
- package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +4 -6
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/dialog/dialog.cjs.map +1 -1
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/download-trigger/download-trigger.cjs.map +1 -1
- package/dist/components/drawer/drawer.cjs.map +1 -1
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/empty-state/empty-state.cjs.map +1 -1
- package/dist/components/feedback/badge.cjs.map +1 -1
- package/dist/components/feedback/badge.d.cts +2 -1
- package/dist/components/feedback/badge.d.ts +2 -1
- package/dist/components/feedback/badge.js.map +1 -1
- package/dist/components/field/field.cjs.map +1 -1
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/fieldset/fieldset.cjs.map +1 -1
- package/dist/components/figure/figure.cjs.map +1 -1
- package/dist/components/figure/figure.js.map +1 -1
- package/dist/components/form/form.cjs.map +1 -1
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/icon-button/icon-button.cjs.map +1 -1
- package/dist/components/icon-button/icon-button.js.map +1 -1
- package/dist/components/image/image.cjs.map +1 -1
- package/dist/components/image/image.js.map +1 -1
- package/dist/components/input-group/input-group.cjs.map +1 -1
- package/dist/components/kbd/kbd.cjs.map +1 -1
- package/dist/components/layout/index.cjs.map +1 -1
- package/dist/components/list/list.cjs.map +1 -1
- package/dist/components/menu/menu.cjs.map +1 -1
- package/dist/components/menubar/menubar.cjs.map +1 -1
- package/dist/components/menubar/menubar.js.map +1 -1
- package/dist/components/meter/meter.cjs.map +1 -1
- package/dist/components/meter/meter.js.map +1 -1
- package/dist/components/navigation/navigation.cjs.map +1 -1
- package/dist/components/navigation/navigation.js.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.cjs.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/number-field/number-field.cjs +2 -1
- package/dist/components/number-field/number-field.cjs.map +1 -1
- package/dist/components/number-field/number-field.js +2 -1
- package/dist/components/number-field/number-field.js.map +1 -1
- package/dist/components/option-selector/option-selector.cjs.map +1 -1
- package/dist/components/option-selector/option-selector.js.map +1 -1
- package/dist/components/pagination/pagination.cjs.map +1 -1
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/pin-input/pin-input.cjs.map +1 -1
- package/dist/components/pin-input/pin-input.js.map +1 -1
- package/dist/components/popover/popover.cjs.map +1 -1
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/progress/progress.cjs.map +1 -1
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/qr-code/qr-code.cjs.map +1 -1
- package/dist/components/qr-code/qr-code.js.map +1 -1
- package/dist/components/quote/quote.cjs.map +1 -1
- package/dist/components/quote/quote.js.map +1 -1
- package/dist/components/radio-group/radio-group.cjs +7 -3
- package/dist/components/radio-group/radio-group.cjs.map +1 -1
- package/dist/components/radio-group/radio-group.js +7 -3
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/range-slider/range-slider.cjs.map +1 -1
- package/dist/components/range-slider/range-slider.js.map +1 -1
- package/dist/components/scroll-area/scroll-area.cjs.map +1 -1
- package/dist/components/select/select.cjs.map +1 -1
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/skeleton/skeleton.cjs.map +1 -1
- package/dist/components/slider/slider.cjs.map +1 -1
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/spacer/spacer.cjs.map +1 -1
- package/dist/components/stat/stat.cjs.map +1 -1
- package/dist/components/stat/stat.js.map +1 -1
- package/dist/components/stepper/stepper.cjs +2 -1
- package/dist/components/stepper/stepper.cjs.map +1 -1
- package/dist/components/stepper/stepper.js +2 -1
- package/dist/components/stepper/stepper.js.map +1 -1
- package/dist/components/table/table.cjs.map +1 -1
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.cjs.map +1 -1
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/tags-input/tags-input.cjs.map +1 -1
- package/dist/components/tags-input/tags-input.js.map +1 -1
- package/dist/components/toast/toast.cjs.map +1 -1
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toggle/toggle.cjs.map +1 -1
- package/dist/components/toggle-group/toggle-group.cjs.map +1 -1
- package/dist/components/toolbar/toolbar.cjs.map +1 -1
- package/dist/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/components/tree-view/tree-view.cjs.map +1 -1
- package/dist/components/tree-view/tree-view.js.map +1 -1
- package/dist/components/typography/heading.cjs.map +1 -1
- package/dist/components/typography/link.cjs.map +1 -1
- package/dist/components/typography/paragraph.cjs.map +1 -1
- package/dist/components/typography/text.cjs.map +1 -1
- package/dist/components/upload/upload.cjs +2 -2
- package/dist/components/upload/upload.cjs.map +1 -1
- package/dist/components/upload/upload.js +2 -2
- package/dist/components/upload/upload.js.map +1 -1
- package/dist/components/visually-hidden/visually-hidden.cjs.map +1 -1
- package/dist/panda-preset.cjs.map +1 -1
- package/dist/styled-system/recipes/badge.cjs +4 -1
- package/dist/styled-system/recipes/badge.cjs.map +1 -1
- package/dist/styled-system/recipes/badge.js +4 -1
- package/dist/styled-system/recipes/badge.js.map +1 -1
- package/dist/styles/theme.cjs +88 -68
- package/dist/styles/theme.cjs.map +1 -1
- package/dist/styles/theme.js +88 -68
- package/dist/styles/theme.js.map +1 -1
- package/dist/styles.css +5 -19
- package/dist/theme/theme-provider.cjs.map +1 -1
- package/dist/theme/theme-provider.js.map +1 -1
- package/dist/theme/theme-scope.cjs.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.cjs","names":["JaciFormContext","field","BaseField","cx"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n controlId: string | undefined;\n descriptionId: string | undefined;\n dirty: boolean;\n errorId: string | undefined;\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n labelId: string | undefined;\n name: string | undefined;\n pending: boolean;\n touched: boolean;\n valid: boolean | null;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n controlId: undefined,\n descriptionId: undefined,\n dirty: false,\n errorId: undefined,\n errors: [],\n insideField: false,\n invalid: false,\n labelId: undefined,\n name: undefined,\n pending: false,\n touched: false,\n valid: null,\n});\n\nfunction normalizeErrors(errors: ReactNode | ReactNode[] | undefined): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Marks the field as awaiting asynchronous validation. */\n pending?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor?: string;\n}\n\nconst FieldRoot = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n pending: pendingProp = false,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const descriptionId = `${generatedId}-description`;\n const errorId = `${generatedId}-error`;\n const [pendingValidation, setPendingValidation] = useState(false);\n const [validationErrors, setValidationErrors] = useState<ReactNode[]>([]);\n const [validationValid, setValidationValid] = useState<boolean | null>(null);\n const validationSequence = useRef(0);\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const externalErrors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const errors =\n directErrors !== undefined || formError !== undefined ? externalErrors : validationErrors;\n const invalid = invalidProp || errors.length > 0;\n const pending = pendingProp || pendingValidation;\n const wrappedValidate = useCallback<NonNullable<BaseFieldRoot.Props[\"validate\"]>>(\n (value, formValues) => {\n const sequence = ++validationSequence.current;\n if (!validate) return null;\n const result = validate(value, formValues);\n if (!result || typeof result !== \"object\" || !(\"then\" in result)) {\n const resultErrors = normalizeErrors(result);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n setPendingValidation(false);\n return result;\n }\n setValidationErrors([]);\n setValidationValid(null);\n setPendingValidation(true);\n return Promise.resolve(result)\n .then((validationResult) => {\n if (sequence !== validationSequence.current) return null;\n const resultErrors = normalizeErrors(validationResult);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n return validationResult;\n })\n .finally(() => {\n if (sequence === validationSequence.current) setPendingValidation(false);\n });\n },\n [validate],\n );\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider\n value={{\n controlId,\n descriptionId,\n dirty: dirty ?? false,\n errorId,\n errors,\n insideField: true,\n invalid,\n labelId,\n name,\n pending,\n touched: touched ?? false,\n valid: invalid ? false : validationValid,\n }}\n >\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n aria-busy={pending || undefined}\n data-dirty={dirty || undefined}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-pending={pending || undefined}\n data-slot=\"field\"\n data-touched={touched || undefined}\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n {...(validate ? { validate: wrappedValidate } : {})}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport interface FieldControlProps extends ComponentPropsWithoutRef<typeof BaseField.Control> {}\n\nexport const FieldControl = forwardRef<HTMLElement, FieldControlProps>(function FieldControl(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n \"aria-invalid\": ariaInvalid,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n id,\n ...props\n },\n ref,\n) {\n const { controlId, descriptionId, errorId, invalid, labelId, pending, insideField } =\n useContext(FieldContext);\n const describedBy =\n [ariaDescribedBy, descriptionId, invalid ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n const labelledBy = [ariaLabelledBy, labelId].filter(Boolean).join(\" \") || undefined;\n const controlProps = {\n ...props,\n \"aria-busy\": pending || undefined,\n \"aria-describedby\": describedBy,\n \"aria-errormessage\": ariaErrorMessage ?? (invalid ? errorId : undefined),\n \"aria-invalid\": ariaInvalid ?? (invalid || undefined),\n \"aria-labelledby\": labelledBy,\n className,\n \"data-pending\": pending || undefined,\n id: id ?? controlId,\n };\n if (!insideField) return <BaseField.Control {...controlProps} ref={ref} />;\n return <BaseField.Control {...controlProps} ref={ref} />;\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { controlId, insideField, invalid, labelId } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor: htmlFor ?? controlId,\n id: props.id ?? labelId,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor ?? controlId}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { descriptionId, insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n id: props.id ?? descriptionId,\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errorId, errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n\nexport const Field = Object.assign(FieldRoot, {\n Root: FieldRoot,\n Control: FieldControl,\n Label: FieldLabel,\n Description: FieldDescription,\n Error: FieldError,\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,gBAAA,GAAA,MAAA,cAAA,CAAgD;CACpD,WAAW,KAAA;CACX,eAAe,KAAA;CACf,OAAO;CACP,S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,EAAE,SAAS,QAAQ,aAAa,aAAA,GAAA,MAAA,WAAA,CAAuB,YAAY;CACzE,MAAM,UAAU,YAAY,aAAa,MAAM;CAE/C,IAAI,CAAC,aAAa;EAChB,IAAI,YAAY,KAAA,KAAa,YAAY,QAAQ,YAAY,OAC3D,OAAO;EAGT,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;GACE,GAAI;GACC;GACL,WAAWC,WAAAA,GAAGF,cAAAA,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;GACjD,aAAU;GACV,IAAI,MAAM,MAAM;GAChB,MAAK;aAEJ;EACA,CAAA;CAEP;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,MAAU,OAAX;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGF,cAAAA,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;EACjD,aAAU;EACV,IAAI,MAAM,MAAM;EAChB,OAAO,UAAU,UAAU,OAAO,KAAA;EAClC,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD,CAAI,CAAA;EACZ,MAAK;YAEJ;CACc,CAAA;AAErB,CAAC;AAED,SAAgB,gBAAgB;CAC9B,QAAA,GAAA,MAAA,WAAA,CAAkB,YAAY;AAChC;AAEA,MAAa,QAAQ,OAAO,OAAO,WAAW;CAC5C,MAAM;CACN,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;AACT,CAAC"}
|
|
1
|
+
{"version":3,"file":"field.cjs","names":["createContext","forwardRef","useId","useState","useRef","useContext","JaciFormContext","useCallback","field","BaseField","cx"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n controlId: string | undefined;\n descriptionId: string | undefined;\n dirty: boolean;\n errorId: string | undefined;\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n labelId: string | undefined;\n name: string | undefined;\n pending: boolean;\n touched: boolean;\n valid: boolean | null;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n controlId: undefined,\n descriptionId: undefined,\n dirty: false,\n errorId: undefined,\n errors: [],\n insideField: false,\n invalid: false,\n labelId: undefined,\n name: undefined,\n pending: false,\n touched: false,\n valid: null,\n});\n\nfunction normalizeErrors(errors: ReactNode | ReactNode[] | undefined): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Marks the field as awaiting asynchronous validation. */\n pending?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor?: string;\n}\n\nconst FieldRoot = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n pending: pendingProp = false,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const descriptionId = `${generatedId}-description`;\n const errorId = `${generatedId}-error`;\n const [pendingValidation, setPendingValidation] = useState(false);\n const [validationErrors, setValidationErrors] = useState<ReactNode[]>([]);\n const [validationValid, setValidationValid] = useState<boolean | null>(null);\n const validationSequence = useRef(0);\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const externalErrors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const errors =\n directErrors !== undefined || formError !== undefined ? externalErrors : validationErrors;\n const invalid = invalidProp || errors.length > 0;\n const pending = pendingProp || pendingValidation;\n const wrappedValidate = useCallback<NonNullable<BaseFieldRoot.Props[\"validate\"]>>(\n (value, formValues) => {\n const sequence = ++validationSequence.current;\n if (!validate) return null;\n const result = validate(value, formValues);\n if (!result || typeof result !== \"object\" || !(\"then\" in result)) {\n const resultErrors = normalizeErrors(result);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n setPendingValidation(false);\n return result;\n }\n setValidationErrors([]);\n setValidationValid(null);\n setPendingValidation(true);\n return Promise.resolve(result)\n .then((validationResult) => {\n if (sequence !== validationSequence.current) return null;\n const resultErrors = normalizeErrors(validationResult);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n return validationResult;\n })\n .finally(() => {\n if (sequence === validationSequence.current) setPendingValidation(false);\n });\n },\n [validate],\n );\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider\n value={{\n controlId,\n descriptionId,\n dirty: dirty ?? false,\n errorId,\n errors,\n insideField: true,\n invalid,\n labelId,\n name,\n pending,\n touched: touched ?? false,\n valid: invalid ? false : validationValid,\n }}\n >\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n aria-busy={pending || undefined}\n data-dirty={dirty || undefined}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-pending={pending || undefined}\n data-slot=\"field\"\n data-touched={touched || undefined}\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n {...(validate ? { validate: wrappedValidate } : {})}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport interface FieldControlProps extends ComponentPropsWithoutRef<typeof BaseField.Control> {}\n\nexport const FieldControl = forwardRef<HTMLElement, FieldControlProps>(function FieldControl(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n \"aria-invalid\": ariaInvalid,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n id,\n ...props\n },\n ref,\n) {\n const { controlId, descriptionId, errorId, invalid, labelId, pending, insideField } =\n useContext(FieldContext);\n const describedBy =\n [ariaDescribedBy, descriptionId, invalid ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n const labelledBy = [ariaLabelledBy, labelId].filter(Boolean).join(\" \") || undefined;\n const controlProps = {\n ...props,\n \"aria-busy\": pending || undefined,\n \"aria-describedby\": describedBy,\n \"aria-errormessage\": ariaErrorMessage ?? (invalid ? errorId : undefined),\n \"aria-invalid\": ariaInvalid ?? (invalid || undefined),\n \"aria-labelledby\": labelledBy,\n className,\n \"data-pending\": pending || undefined,\n id: id ?? controlId,\n };\n if (!insideField) return <BaseField.Control {...controlProps} ref={ref} />;\n return <BaseField.Control {...controlProps} ref={ref} />;\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { controlId, insideField, invalid, labelId } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor: htmlFor ?? controlId,\n id: props.id ?? labelId,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor ?? controlId}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { descriptionId, insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n id: props.id ?? descriptionId,\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errorId, errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n\nexport const Field = Object.assign(FieldRoot, {\n Root: FieldRoot,\n Control: FieldControl,\n Label: FieldLabel,\n Description: FieldDescription,\n Error: FieldError,\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,gBAAA,GAAeA,MAAAA,cAAAA,CAAiC;CACpD,WAAW,KAAA;CACX,eAAe,KAAA;CACf,OAAO;CACP,SAAS,KAAA;CACT,QAAQ,CAAC;CACT,aAAa;CACb,SAAS;CACT,SAAS,KAAA;CACT,MAAM,KAAA;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,CAAC;AAED,SAAS,gBAAgB,QAA0D;CACjF,IAAI,WAAW,KAAA,KAAa,WAAW,QAAQ,WAAW,OACxD,OAAO,CAAC;CAGV,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AACjD;AAEA,SAAS,aAAa,QAAqB;CACzC,IAAI,OAAO,UAAU,GACnB,OAAO,OAAO;CAGhB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAA,UACG,OAAO,KAAK,OAAO,UAClB,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAA,UAAqD,MAAU,GAAtD,OAAO,UAAU,WAAW,QAAQ,KAAkB,CAChE,EACC,CAAA;AAER;AA+BA,MAAM,aAAA,GAAYC,MAAAA,WAAAA,CAAuC,SAAS,MAChE,EACE,YACA,UACA,WACA,OACA,WAAW,OACX,QAAQ,cACR,SAAS,cAAc,OACvB,MACA,SAAS,cAAc,OACvB,SACA,UACA,wBACA,gBACA,GAAG,SAEL,KACA;CACA,MAAM,eAAA,GAAcC,MAAAA,MAAAA,CAAM;CAC1B,MAAM,YAAY,GAAG,YAAY;CACjC,MAAM,UAAU,GAAG,YAAY;CAC/B,MAAM,gBAAgB,GAAG,YAAY;CACrC,MAAM,UAAU,GAAG,YAAY;CAC/B,MAAM,CAAC,mBAAmB,yBAAA,GA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CACN,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;AACT,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":["FieldRoot","Field","BaseField"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n controlId: string | undefined;\n descriptionId: string | undefined;\n dirty: boolean;\n errorId: string | undefined;\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n labelId: string | undefined;\n name: string | undefined;\n pending: boolean;\n touched: boolean;\n valid: boolean | null;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n controlId: undefined,\n descriptionId: undefined,\n dirty: false,\n errorId: undefined,\n errors: [],\n insideField: false,\n invalid: false,\n labelId: undefined,\n name: undefined,\n pending: false,\n touched: false,\n valid: null,\n});\n\nfunction normalizeErrors(errors: ReactNode | ReactNode[] | undefined): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Marks the field as awaiting asynchronous validation. */\n pending?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor?: string;\n}\n\nconst FieldRoot = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n pending: pendingProp = false,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const descriptionId = `${generatedId}-description`;\n const errorId = `${generatedId}-error`;\n const [pendingValidation, setPendingValidation] = useState(false);\n const [validationErrors, setValidationErrors] = useState<ReactNode[]>([]);\n const [validationValid, setValidationValid] = useState<boolean | null>(null);\n const validationSequence = useRef(0);\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const externalErrors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const errors =\n directErrors !== undefined || formError !== undefined ? externalErrors : validationErrors;\n const invalid = invalidProp || errors.length > 0;\n const pending = pendingProp || pendingValidation;\n const wrappedValidate = useCallback<NonNullable<BaseFieldRoot.Props[\"validate\"]>>(\n (value, formValues) => {\n const sequence = ++validationSequence.current;\n if (!validate) return null;\n const result = validate(value, formValues);\n if (!result || typeof result !== \"object\" || !(\"then\" in result)) {\n const resultErrors = normalizeErrors(result);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n setPendingValidation(false);\n return result;\n }\n setValidationErrors([]);\n setValidationValid(null);\n setPendingValidation(true);\n return Promise.resolve(result)\n .then((validationResult) => {\n if (sequence !== validationSequence.current) return null;\n const resultErrors = normalizeErrors(validationResult);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n return validationResult;\n })\n .finally(() => {\n if (sequence === validationSequence.current) setPendingValidation(false);\n });\n },\n [validate],\n );\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider\n value={{\n controlId,\n descriptionId,\n dirty: dirty ?? false,\n errorId,\n errors,\n insideField: true,\n invalid,\n labelId,\n name,\n pending,\n touched: touched ?? false,\n valid: invalid ? false : validationValid,\n }}\n >\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n aria-busy={pending || undefined}\n data-dirty={dirty || undefined}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-pending={pending || undefined}\n data-slot=\"field\"\n data-touched={touched || undefined}\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n {...(validate ? { validate: wrappedValidate } : {})}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport interface FieldControlProps extends ComponentPropsWithoutRef<typeof BaseField.Control> {}\n\nexport const FieldControl = forwardRef<HTMLElement, FieldControlProps>(function FieldControl(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n \"aria-invalid\": ariaInvalid,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n id,\n ...props\n },\n ref,\n) {\n const { controlId, descriptionId, errorId, invalid, labelId, pending, insideField } =\n useContext(FieldContext);\n const describedBy =\n [ariaDescribedBy, descriptionId, invalid ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n const labelledBy = [ariaLabelledBy, labelId].filter(Boolean).join(\" \") || undefined;\n const controlProps = {\n ...props,\n \"aria-busy\": pending || undefined,\n \"aria-describedby\": describedBy,\n \"aria-errormessage\": ariaErrorMessage ?? (invalid ? errorId : undefined),\n \"aria-invalid\": ariaInvalid ?? (invalid || undefined),\n \"aria-labelledby\": labelledBy,\n className,\n \"data-pending\": pending || undefined,\n id: id ?? controlId,\n };\n if (!insideField) return <BaseField.Control {...controlProps} ref={ref} />;\n return <BaseField.Control {...controlProps} ref={ref} />;\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { controlId, insideField, invalid, labelId } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor: htmlFor ?? controlId,\n id: props.id ?? labelId,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor ?? controlId}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { descriptionId, insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n id: props.id ?? descriptionId,\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errorId, errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n\nexport const Field = Object.assign(FieldRoot, {\n Root: FieldRoot,\n Control: FieldControl,\n Label: FieldLabel,\n Description: FieldDescription,\n Error: FieldError,\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,eAAe,cAAiC;CACpD,WAAW,KAAA;CACX,eAAe,KAAA;CACf,OAAO;CACP,SAAS,KAAA;CACT,QAAQ,CAAC;CACT,aAAa;CACb,SAAS;CACT,SAAS,KAAA;CACT,MAAM,KAAA;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,CAAC;AAED,SAAS,gBAAgB,QAA0D;CACjF,IAAI,WAAW,KAAA,KAAa,WAAW,QAAQ,WAAW,OACxD,OAAO,CAAC;CAGV,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AACjD;AAEA,SAAS,aAAa,QAAqB;CACzC,IAAI,OAAO,UAAU,GACnB,OAAO,OAAO;CAGhB,OACE,oBAAC,MAAD,EAAA,UACG,OAAO,KAAK,OAAO,UAClB,oBAAC,MAAD,EAAA,UAAqD,MAAU,GAAtD,OAAO,UAAU,WAAW,QAAQ,KAAkB,CAChE,EACC,CAAA;AAER;AA+BA,MAAMA,cAAY,WAAuC,SAASC,QAChE,EACE,YACA,UACA,WACA,OACA,WAAW,OACX,QAAQ,cACR,SAAS,cAAc,OACvB,MACA,SAAS,cAAc,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AAQ,aAAa,YAAY,WAAW,YAAY;CACzE,MAAM,UAAU,YAAY,aAAa,MAAM;CAE/C,IAAI,CAAC,aAAa;EAChB,IAAI,YAAY,KAAA,KAAa,YAAY,QAAQ,YAAY,OAC3D,OAAO;EAGT,OACE,oBAAC,KAAD;GACE,GAAI;GACC;GACL,WAAW,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;GACjD,aAAU;GACV,IAAI,MAAM,MAAM;GAChB,MAAK;aAEJ;EACA,CAAA;CAEP;CAEA,OACE,oBAACA,MAAU,OAAX;EACE,GAAI;EACC;EACL,WAAW,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;EACjD,aAAU;EACV,IAAI,MAAM,MAAM;EAChB,OAAO,UAAU,UAAU,OAAO,KAAA;EAClC,QAAQ,oBAAC,KAAD,CAAI,CAAA;EACZ,MAAK;YAEJ;CACc,CAAA;AAErB,CAAC;AAED,SAAgB,gBAAgB;CAC9B,OAAO,WAAW,YAAY;AAChC;AAEA,MAAaD,UAAQ,OAAO,OAAOD,aAAW;CAC5C,MAAMA;CACN,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;AACT,CAAC"}
|
|
1
|
+
{"version":3,"file":"field.js","names":["FieldRoot","Field","BaseField"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n controlId: string | undefined;\n descriptionId: string | undefined;\n dirty: boolean;\n errorId: string | undefined;\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n labelId: string | undefined;\n name: string | undefined;\n pending: boolean;\n touched: boolean;\n valid: boolean | null;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n controlId: undefined,\n descriptionId: undefined,\n dirty: false,\n errorId: undefined,\n errors: [],\n insideField: false,\n invalid: false,\n labelId: undefined,\n name: undefined,\n pending: false,\n touched: false,\n valid: null,\n});\n\nfunction normalizeErrors(errors: ReactNode | ReactNode[] | undefined): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Marks the field as awaiting asynchronous validation. */\n pending?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor?: string;\n}\n\nconst FieldRoot = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n pending: pendingProp = false,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const descriptionId = `${generatedId}-description`;\n const errorId = `${generatedId}-error`;\n const [pendingValidation, setPendingValidation] = useState(false);\n const [validationErrors, setValidationErrors] = useState<ReactNode[]>([]);\n const [validationValid, setValidationValid] = useState<boolean | null>(null);\n const validationSequence = useRef(0);\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const externalErrors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const errors =\n directErrors !== undefined || formError !== undefined ? externalErrors : validationErrors;\n const invalid = invalidProp || errors.length > 0;\n const pending = pendingProp || pendingValidation;\n const wrappedValidate = useCallback<NonNullable<BaseFieldRoot.Props[\"validate\"]>>(\n (value, formValues) => {\n const sequence = ++validationSequence.current;\n if (!validate) return null;\n const result = validate(value, formValues);\n if (!result || typeof result !== \"object\" || !(\"then\" in result)) {\n const resultErrors = normalizeErrors(result);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n setPendingValidation(false);\n return result;\n }\n setValidationErrors([]);\n setValidationValid(null);\n setPendingValidation(true);\n return Promise.resolve(result)\n .then((validationResult) => {\n if (sequence !== validationSequence.current) return null;\n const resultErrors = normalizeErrors(validationResult);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n return validationResult;\n })\n .finally(() => {\n if (sequence === validationSequence.current) setPendingValidation(false);\n });\n },\n [validate],\n );\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider\n value={{\n controlId,\n descriptionId,\n dirty: dirty ?? false,\n errorId,\n errors,\n insideField: true,\n invalid,\n labelId,\n name,\n pending,\n touched: touched ?? false,\n valid: invalid ? false : validationValid,\n }}\n >\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n aria-busy={pending || undefined}\n data-dirty={dirty || undefined}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-pending={pending || undefined}\n data-slot=\"field\"\n data-touched={touched || undefined}\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n {...(validate ? { validate: wrappedValidate } : {})}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport interface FieldControlProps extends ComponentPropsWithoutRef<typeof BaseField.Control> {}\n\nexport const FieldControl = forwardRef<HTMLElement, FieldControlProps>(function FieldControl(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n \"aria-invalid\": ariaInvalid,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n id,\n ...props\n },\n ref,\n) {\n const { controlId, descriptionId, errorId, invalid, labelId, pending, insideField } =\n useContext(FieldContext);\n const describedBy =\n [ariaDescribedBy, descriptionId, invalid ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n const labelledBy = [ariaLabelledBy, labelId].filter(Boolean).join(\" \") || undefined;\n const controlProps = {\n ...props,\n \"aria-busy\": pending || undefined,\n \"aria-describedby\": describedBy,\n \"aria-errormessage\": ariaErrorMessage ?? (invalid ? errorId : undefined),\n \"aria-invalid\": ariaInvalid ?? (invalid || undefined),\n \"aria-labelledby\": labelledBy,\n className,\n \"data-pending\": pending || undefined,\n id: id ?? controlId,\n };\n if (!insideField) return <BaseField.Control {...controlProps} ref={ref} />;\n return <BaseField.Control {...controlProps} ref={ref} />;\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { controlId, insideField, invalid, labelId } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor: htmlFor ?? controlId,\n id: props.id ?? labelId,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor ?? controlId}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { descriptionId, insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n id: props.id ?? descriptionId,\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errorId, errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n\nexport const Field = Object.assign(FieldRoot, {\n Root: FieldRoot,\n Control: FieldControl,\n Label: FieldLabel,\n Description: FieldDescription,\n Error: FieldError,\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,eAAe,cAAiC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AAI,CAAA;EACZ,MAAK;EAEJ,UAAA;CACc,CAAA;AAErB,CAAC;AAED,SAAgB,gBAAgB;CAC9B,OAAO,WAAW,YAAY;AAChC;AAEA,MAAaD,UAAQ,OAAO,OAAOD,aAAW;CAC5C,MAAMA;CACN,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;AACT,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldset.cjs","names":["fieldset","BaseFieldset","cx"],"sources":["../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fieldset as BaseFieldset } from \"@base-ui/react/fieldset\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { fieldset } from \"../../styled-system/recipes\";\n\nexport interface FieldsetRootProps extends ComponentPropsWithoutRef<\"fieldset\"> {\n children?: ReactNode;\n}\n\nexport const FieldsetRoot = forwardRef<HTMLFieldSetElement, FieldsetRootProps>(\n function FieldsetRoot({ children, className, disabled = false, ...props }, ref) {\n const styles = fieldset({ disabled });\n\n return (\n <BaseFieldset.Root\n {...props}\n ref={ref as Ref<HTMLElement>}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"fieldset\"\n data-slot=\"fieldset\"\n disabled={disabled}\n >\n {children}\n </BaseFieldset.Root>\n );\n },\n);\n\nexport type FieldsetLegendProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const FieldsetLegend = forwardRef<HTMLDivElement, FieldsetLegendProps>(\n function FieldsetLegend({ className, ...props }, ref) {\n return (\n <BaseFieldset.Legend\n {...props}\n ref={ref}\n className={cx(fieldset().legend, className)}\n data-slot=\"fieldset-legend\"\n />\n );\n },\n);\n\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldsetDescription({ className, ...props }, ref) {\n return (\n <p\n {...props}\n ref={ref}\n className={cx(fieldset().description, className)}\n data-slot=\"fieldset-description\"\n />\n );\n },\n);\n\nexport const Fieldset = {\n Root: FieldsetRoot,\n Legend: FieldsetLegend,\n Description: FieldsetDescription,\n};\n"],"mappings":";;;;;;;AAaA,MAAa,gBAAA,
|
|
1
|
+
{"version":3,"file":"fieldset.cjs","names":["forwardRef","fieldset","BaseFieldset","cx"],"sources":["../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fieldset as BaseFieldset } from \"@base-ui/react/fieldset\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { fieldset } from \"../../styled-system/recipes\";\n\nexport interface FieldsetRootProps extends ComponentPropsWithoutRef<\"fieldset\"> {\n children?: ReactNode;\n}\n\nexport const FieldsetRoot = forwardRef<HTMLFieldSetElement, FieldsetRootProps>(\n function FieldsetRoot({ children, className, disabled = false, ...props }, ref) {\n const styles = fieldset({ disabled });\n\n return (\n <BaseFieldset.Root\n {...props}\n ref={ref as Ref<HTMLElement>}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"fieldset\"\n data-slot=\"fieldset\"\n disabled={disabled}\n >\n {children}\n </BaseFieldset.Root>\n );\n },\n);\n\nexport type FieldsetLegendProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const FieldsetLegend = forwardRef<HTMLDivElement, FieldsetLegendProps>(\n function FieldsetLegend({ className, ...props }, ref) {\n return (\n <BaseFieldset.Legend\n {...props}\n ref={ref}\n className={cx(fieldset().legend, className)}\n data-slot=\"fieldset-legend\"\n />\n );\n },\n);\n\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldsetDescription({ className, ...props }, ref) {\n return (\n <p\n {...props}\n ref={ref}\n className={cx(fieldset().description, className)}\n data-slot=\"fieldset-description\"\n />\n );\n },\n);\n\nexport const Fieldset = {\n Root: FieldsetRoot,\n Legend: FieldsetLegend,\n Description: FieldsetDescription,\n};\n"],"mappings":";;;;;;;AAaA,MAAa,gBAAA,GAAeA,MAAAA,WAAAA,CAC1B,SAAS,aAAa,EAAE,UAAU,WAAW,WAAW,OAAO,GAAG,SAAS,KAAK;CAC9E,MAAM,SAASC,iBAAAA,SAAS,EAAE,SAAS,CAAC;CAEpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,SAAa,MAAd;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,iBAAe,YAAY,KAAA;EAC3B,uBAAoB;EACpB,aAAU;EACA;EAET;CACgB,CAAA;AAEvB,CACF;AAIA,MAAa,kBAAA,GAAiBH,MAAAA,WAAAA,CAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,wBAAAA,SAAa,QAAd;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGF,iBAAAA,SAAS,CAAC,CAAC,QAAQ,SAAS;EAC1C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,uBAAA,GAAsBD,MAAAA,WAAAA,CACjC,SAAS,oBAAoB,EAAE,WAAW,GAAG,SAAS,KAAK;CACzD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EACE,GAAI;EACC;EACL,WAAWG,WAAAA,GAAGF,iBAAAA,SAAS,CAAC,CAAC,aAAa,SAAS;EAC/C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,WAAW;CACtB,MAAM;CACN,QAAQ;CACR,aAAa;AACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figure.cjs","names":["Image","cx","BaseDialog","Children","figureStyles","useThemePortalProps"],"sources":["../../../src/components/figure/figure.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { Children, createContext, forwardRef, isValidElement, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { figure as figureStyles } from \"../../styled-system/recipes\";\nimport { Image } from \"../image\";\nimport type { ImageProps } from \"../image\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\ninterface FigureContextValue {\n lightbox: boolean;\n styles: ReturnType<typeof figureStyles>;\n}\n\nconst FigureContext = createContext<FigureContextValue | null>(null);\n\nfunction useFigureContext() {\n const value = useContext(FigureContext);\n if (!value) {\n throw new Error(\"Figure parts must be rendered inside Figure.Root.\");\n }\n return value;\n}\n\nexport type FigureImageProps = ImageProps;\n\nexport const FigureImage = forwardRef<HTMLImageElement, FigureImageProps>(function FigureImage(\n { className, lightbox: _lightbox, ...props },\n ref,\n) {\n const { lightbox, styles } = useFigureContext();\n const content = (\n <Image\n {...props}\n ref={ref}\n className={cx(styles.image, className)}\n data-slot=\"figure-image\"\n lightbox={false}\n />\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Trigger\n aria-label=\"Open image\"\n className={styles.trigger}\n data-jaci-component=\"figure-trigger\"\n data-slot=\"figure-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n );\n});\n\nexport type FigureCaptionProps = ComponentPropsWithoutRef<\"figcaption\">;\n\nexport const FigureCaption = forwardRef<HTMLElement, FigureCaptionProps>(function FigureCaption(\n { className, ...props },\n ref,\n) {\n const { styles } = useFigureContext();\n return (\n <figcaption\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"figure-caption\"\n />\n );\n});\n\nexport interface FigureRootProps extends ComponentPropsWithoutRef<\"figure\"> {\n lightbox?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n closeLabel?: string;\n}\n\nfunction findChild<T>(children: ReactNode, component: ElementType): ReactElement<T> | null {\n const child = Children.toArray(children).find(\n (item) => isValidElement(item) && item.type === component,\n );\n return (child as ReactElement<T> | undefined) ?? null;\n}\n\nexport const FigureRoot = forwardRef<HTMLElement, FigureRootProps>(function FigureRoot(\n {\n children,\n className,\n closeLabel = \"Close image\",\n defaultOpen,\n lightbox = false,\n onOpenChange,\n open,\n ...props\n },\n ref,\n) {\n const styles = figureStyles();\n const media = findChild<FigureImageProps>(children, FigureImage);\n const caption = findChild<FigureCaptionProps>(children, FigureCaption);\n const canOpen = Boolean(lightbox && media?.props.src);\n const content = (\n <figure\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"figure\"\n data-lightbox={canOpen || undefined}\n data-slot=\"figure\"\n >\n {children}\n </figure>\n );\n\n const value = { lightbox: canOpen, styles };\n const scopedPortalProps = useThemePortalProps({});\n\n if (!canOpen || !media) {\n return <FigureContext.Provider value={value}>{content}</FigureContext.Provider>;\n }\n\n const alt = media.props.alt;\n const src = media.props.src;\n\n return (\n <FigureContext.Provider value={value}>\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n {content}\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"figure-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"figure-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || \"Image preview\"}\n className={styles.popup}\n data-jaci-component=\"figure-lightbox\"\n data-slot=\"figure-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || \"Image preview\"}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"figure-lightbox-close-row\">\n <BaseDialog.Close\n aria-label={closeLabel}\n className={styles.close}\n data-slot=\"figure-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"figure-lightbox-image\"\n src={src}\n />\n {caption ? (\n <figcaption className={styles.lightboxCaption} data-slot=\"figure-lightbox-caption\">\n {caption.props.children}\n </figcaption>\n ) : null}\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n </FigureContext.Provider>\n );\n});\n\nexport const Figure = {\n Root: FigureRoot,\n Image: FigureImage,\n Caption: FigureCaption,\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAM,iBAAA,
|
|
1
|
+
{"version":3,"file":"figure.cjs","names":["createContext","useContext","forwardRef","Image","cx","BaseDialog","Children","isValidElement","figureStyles","useThemePortalProps"],"sources":["../../../src/components/figure/figure.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { Children, createContext, forwardRef, isValidElement, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { figure as figureStyles } from \"../../styled-system/recipes\";\nimport { Image } from \"../image\";\nimport type { ImageProps } from \"../image\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\ninterface FigureContextValue {\n lightbox: boolean;\n styles: ReturnType<typeof figureStyles>;\n}\n\nconst FigureContext = createContext<FigureContextValue | null>(null);\n\nfunction useFigureContext() {\n const value = useContext(FigureContext);\n if (!value) {\n throw new Error(\"Figure parts must be rendered inside Figure.Root.\");\n }\n return value;\n}\n\nexport type FigureImageProps = ImageProps;\n\nexport const FigureImage = forwardRef<HTMLImageElement, FigureImageProps>(function FigureImage(\n { className, lightbox: _lightbox, ...props },\n ref,\n) {\n const { lightbox, styles } = useFigureContext();\n const content = (\n <Image\n {...props}\n ref={ref}\n className={cx(styles.image, className)}\n data-slot=\"figure-image\"\n lightbox={false}\n />\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Trigger\n aria-label=\"Open image\"\n className={styles.trigger}\n data-jaci-component=\"figure-trigger\"\n data-slot=\"figure-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n );\n});\n\nexport type FigureCaptionProps = ComponentPropsWithoutRef<\"figcaption\">;\n\nexport const FigureCaption = forwardRef<HTMLElement, FigureCaptionProps>(function FigureCaption(\n { className, ...props },\n ref,\n) {\n const { styles } = useFigureContext();\n return (\n <figcaption\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"figure-caption\"\n />\n );\n});\n\nexport interface FigureRootProps extends ComponentPropsWithoutRef<\"figure\"> {\n lightbox?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n closeLabel?: string;\n}\n\nfunction findChild<T>(children: ReactNode, component: ElementType): ReactElement<T> | null {\n const child = Children.toArray(children).find(\n (item) => isValidElement(item) && item.type === component,\n );\n return (child as ReactElement<T> | undefined) ?? null;\n}\n\nexport const FigureRoot = forwardRef<HTMLElement, FigureRootProps>(function FigureRoot(\n {\n children,\n className,\n closeLabel = \"Close image\",\n defaultOpen,\n lightbox = false,\n onOpenChange,\n open,\n ...props\n },\n ref,\n) {\n const styles = figureStyles();\n const media = findChild<FigureImageProps>(children, FigureImage);\n const caption = findChild<FigureCaptionProps>(children, FigureCaption);\n const canOpen = Boolean(lightbox && media?.props.src);\n const content = (\n <figure\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"figure\"\n data-lightbox={canOpen || undefined}\n data-slot=\"figure\"\n >\n {children}\n </figure>\n );\n\n const value = { lightbox: canOpen, styles };\n const scopedPortalProps = useThemePortalProps({});\n\n if (!canOpen || !media) {\n return <FigureContext.Provider value={value}>{content}</FigureContext.Provider>;\n }\n\n const alt = media.props.alt;\n const src = media.props.src;\n\n return (\n <FigureContext.Provider value={value}>\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n {content}\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"figure-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"figure-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || \"Image preview\"}\n className={styles.popup}\n data-jaci-component=\"figure-lightbox\"\n data-slot=\"figure-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || \"Image preview\"}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"figure-lightbox-close-row\">\n <BaseDialog.Close\n aria-label={closeLabel}\n className={styles.close}\n data-slot=\"figure-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"figure-lightbox-image\"\n src={src}\n />\n {caption ? (\n <figcaption className={styles.lightboxCaption} data-slot=\"figure-lightbox-caption\">\n {caption.props.children}\n </figcaption>\n ) : null}\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n </FigureContext.Provider>\n );\n});\n\nexport const Figure = {\n Root: FigureRoot,\n Image: FigureImage,\n Caption: FigureCaption,\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAM,iBAAA,GAAgBA,MAAAA,cAAAA,CAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,SAAA,GAAQC,MAAAA,WAAAA,CAAW,aAAa;CACtC,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT;AAIA,MAAa,eAAA,GAAcC,MAAAA,WAAAA,CAA+C,SAAS,YACjF,EAAE,WAAW,UAAU,WAAW,GAAG,SACrC,KACA;CACA,MAAM,EAAE,UAAU,WAAW,iBAAiB;CAC9C,MAAM,UACJ,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,OAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,OAAO,SAAS;EACrC,aAAU;EACV,UAAU;CACX,CAAA;CAGH,IAAI,CAAC,UACH,OAAO;CAGT,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,OAAW,SAAZ;EACE,cAAW;EACX,WAAW,OA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AAED,MAAa,SAAS;CACpB,MAAM;CACN,OAAO;CACP,SAAS;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figure.js","names":["BaseDialog","figureStyles"],"sources":["../../../src/components/figure/figure.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { Children, createContext, forwardRef, isValidElement, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { figure as figureStyles } from \"../../styled-system/recipes\";\nimport { Image } from \"../image\";\nimport type { ImageProps } from \"../image\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\ninterface FigureContextValue {\n lightbox: boolean;\n styles: ReturnType<typeof figureStyles>;\n}\n\nconst FigureContext = createContext<FigureContextValue | null>(null);\n\nfunction useFigureContext() {\n const value = useContext(FigureContext);\n if (!value) {\n throw new Error(\"Figure parts must be rendered inside Figure.Root.\");\n }\n return value;\n}\n\nexport type FigureImageProps = ImageProps;\n\nexport const FigureImage = forwardRef<HTMLImageElement, FigureImageProps>(function FigureImage(\n { className, lightbox: _lightbox, ...props },\n ref,\n) {\n const { lightbox, styles } = useFigureContext();\n const content = (\n <Image\n {...props}\n ref={ref}\n className={cx(styles.image, className)}\n data-slot=\"figure-image\"\n lightbox={false}\n />\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Trigger\n aria-label=\"Open image\"\n className={styles.trigger}\n data-jaci-component=\"figure-trigger\"\n data-slot=\"figure-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n );\n});\n\nexport type FigureCaptionProps = ComponentPropsWithoutRef<\"figcaption\">;\n\nexport const FigureCaption = forwardRef<HTMLElement, FigureCaptionProps>(function FigureCaption(\n { className, ...props },\n ref,\n) {\n const { styles } = useFigureContext();\n return (\n <figcaption\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"figure-caption\"\n />\n );\n});\n\nexport interface FigureRootProps extends ComponentPropsWithoutRef<\"figure\"> {\n lightbox?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n closeLabel?: string;\n}\n\nfunction findChild<T>(children: ReactNode, component: ElementType): ReactElement<T> | null {\n const child = Children.toArray(children).find(\n (item) => isValidElement(item) && item.type === component,\n );\n return (child as ReactElement<T> | undefined) ?? null;\n}\n\nexport const FigureRoot = forwardRef<HTMLElement, FigureRootProps>(function FigureRoot(\n {\n children,\n className,\n closeLabel = \"Close image\",\n defaultOpen,\n lightbox = false,\n onOpenChange,\n open,\n ...props\n },\n ref,\n) {\n const styles = figureStyles();\n const media = findChild<FigureImageProps>(children, FigureImage);\n const caption = findChild<FigureCaptionProps>(children, FigureCaption);\n const canOpen = Boolean(lightbox && media?.props.src);\n const content = (\n <figure\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"figure\"\n data-lightbox={canOpen || undefined}\n data-slot=\"figure\"\n >\n {children}\n </figure>\n );\n\n const value = { lightbox: canOpen, styles };\n const scopedPortalProps = useThemePortalProps({});\n\n if (!canOpen || !media) {\n return <FigureContext.Provider value={value}>{content}</FigureContext.Provider>;\n }\n\n const alt = media.props.alt;\n const src = media.props.src;\n\n return (\n <FigureContext.Provider value={value}>\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n {content}\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"figure-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"figure-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || \"Image preview\"}\n className={styles.popup}\n data-jaci-component=\"figure-lightbox\"\n data-slot=\"figure-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || \"Image preview\"}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"figure-lightbox-close-row\">\n <BaseDialog.Close\n aria-label={closeLabel}\n className={styles.close}\n data-slot=\"figure-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"figure-lightbox-image\"\n src={src}\n />\n {caption ? (\n <figcaption className={styles.lightboxCaption} data-slot=\"figure-lightbox-caption\">\n {caption.props.children}\n </figcaption>\n ) : null}\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n </FigureContext.Provider>\n );\n});\n\nexport const Figure = {\n Root: FigureRoot,\n Image: FigureImage,\n Caption: FigureCaption,\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,QAAQ,WAAW,aAAa;CACtC,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT;AAIA,MAAa,cAAc,WAA+C,SAAS,YACjF,EAAE,WAAW,UAAU,WAAW,GAAG,SACrC,KACA;CACA,MAAM,EAAE,UAAU,WAAW,iBAAiB;CAC9C,MAAM,UACJ,oBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,OAAO,OAAO,SAAS;EACrC,aAAU;EACV,UAAU;CACX,CAAA;CAGH,IAAI,CAAC,UACH,OAAO;CAGT,OACE,oBAACA,OAAW,SAAZ;EACE,cAAW;EACX,WAAW,OAAO;EAClB,uBAAoB;EACpB,aAAU;
|
|
1
|
+
{"version":3,"file":"figure.js","names":["BaseDialog","figureStyles"],"sources":["../../../src/components/figure/figure.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { Children, createContext, forwardRef, isValidElement, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { figure as figureStyles } from \"../../styled-system/recipes\";\nimport { Image } from \"../image\";\nimport type { ImageProps } from \"../image\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\ninterface FigureContextValue {\n lightbox: boolean;\n styles: ReturnType<typeof figureStyles>;\n}\n\nconst FigureContext = createContext<FigureContextValue | null>(null);\n\nfunction useFigureContext() {\n const value = useContext(FigureContext);\n if (!value) {\n throw new Error(\"Figure parts must be rendered inside Figure.Root.\");\n }\n return value;\n}\n\nexport type FigureImageProps = ImageProps;\n\nexport const FigureImage = forwardRef<HTMLImageElement, FigureImageProps>(function FigureImage(\n { className, lightbox: _lightbox, ...props },\n ref,\n) {\n const { lightbox, styles } = useFigureContext();\n const content = (\n <Image\n {...props}\n ref={ref}\n className={cx(styles.image, className)}\n data-slot=\"figure-image\"\n lightbox={false}\n />\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Trigger\n aria-label=\"Open image\"\n className={styles.trigger}\n data-jaci-component=\"figure-trigger\"\n data-slot=\"figure-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n );\n});\n\nexport type FigureCaptionProps = ComponentPropsWithoutRef<\"figcaption\">;\n\nexport const FigureCaption = forwardRef<HTMLElement, FigureCaptionProps>(function FigureCaption(\n { className, ...props },\n ref,\n) {\n const { styles } = useFigureContext();\n return (\n <figcaption\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"figure-caption\"\n />\n );\n});\n\nexport interface FigureRootProps extends ComponentPropsWithoutRef<\"figure\"> {\n lightbox?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n closeLabel?: string;\n}\n\nfunction findChild<T>(children: ReactNode, component: ElementType): ReactElement<T> | null {\n const child = Children.toArray(children).find(\n (item) => isValidElement(item) && item.type === component,\n );\n return (child as ReactElement<T> | undefined) ?? null;\n}\n\nexport const FigureRoot = forwardRef<HTMLElement, FigureRootProps>(function FigureRoot(\n {\n children,\n className,\n closeLabel = \"Close image\",\n defaultOpen,\n lightbox = false,\n onOpenChange,\n open,\n ...props\n },\n ref,\n) {\n const styles = figureStyles();\n const media = findChild<FigureImageProps>(children, FigureImage);\n const caption = findChild<FigureCaptionProps>(children, FigureCaption);\n const canOpen = Boolean(lightbox && media?.props.src);\n const content = (\n <figure\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"figure\"\n data-lightbox={canOpen || undefined}\n data-slot=\"figure\"\n >\n {children}\n </figure>\n );\n\n const value = { lightbox: canOpen, styles };\n const scopedPortalProps = useThemePortalProps({});\n\n if (!canOpen || !media) {\n return <FigureContext.Provider value={value}>{content}</FigureContext.Provider>;\n }\n\n const alt = media.props.alt;\n const src = media.props.src;\n\n return (\n <FigureContext.Provider value={value}>\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n {content}\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"figure-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"figure-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || \"Image preview\"}\n className={styles.popup}\n data-jaci-component=\"figure-lightbox\"\n data-slot=\"figure-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || \"Image preview\"}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"figure-lightbox-close-row\">\n <BaseDialog.Close\n aria-label={closeLabel}\n className={styles.close}\n data-slot=\"figure-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"figure-lightbox-image\"\n src={src}\n />\n {caption ? (\n <figcaption className={styles.lightboxCaption} data-slot=\"figure-lightbox-caption\">\n {caption.props.children}\n </figcaption>\n ) : null}\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n </FigureContext.Provider>\n );\n});\n\nexport const Figure = {\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AAA;AAE5B,CAAC;AAED,MAAa,SAAS;CACpB,MAAM;CACN,OAAO;CACP,SAAS;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.cjs","names":["BaseForm","cx","form"],"sources":["../../../src/components/form/form.tsx"],"sourcesContent":["\"use client\";\n\nimport { Form as BaseForm } from \"@base-ui/react/form\";\nimport { createContext, forwardRef } from \"react\";\nimport type { ReactElement, ReactNode, RefAttributes } from \"react\";\nimport type { FormProps as BaseFormProps } from \"@base-ui/react/form\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { form } from \"../../styled-system/recipes\";\n\nexport type FormErrors = Record<string, string | string[]>;\n\ninterface JaciFormContextValue {\n errors: FormErrors;\n}\n\nexport const JaciFormContext = createContext<JaciFormContextValue>({ errors: {} });\n\nexport interface FormProps<FormValues extends Record<string, unknown> = Record<string, unknown>>\n extends Omit<BaseFormProps<FormValues>, \"children\" | \"errors\" | \"className\"> {\n className?: string;\n /** External errors keyed by each field's `name`. */\n errors?: FormErrors;\n children?: ReactNode;\n}\n\nconst FormRoot = forwardRef<HTMLFormElement, FormProps>(function Form(\n { children, className, errors, ...props },\n ref,\n) {\n return (\n <JaciFormContext.Provider value={{ errors: errors ?? {} }}>\n <BaseForm\n {...props}\n ref={ref}\n className={cx(form(), className)}\n data-jaci-component=\"form\"\n data-slot=\"form\"\n errors={errors}\n >\n {children}\n </BaseForm>\n </JaciFormContext.Provider>\n );\n});\n\nexport const Form = FormRoot as <\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n>(\n props: FormProps<FormValues> & RefAttributes<HTMLFormElement>,\n) => ReactElement | null;\n"],"mappings":";;;;;;;AAgBA,MAAa,mBAAA,
|
|
1
|
+
{"version":3,"file":"form.cjs","names":["createContext","forwardRef","BaseForm","cx","form"],"sources":["../../../src/components/form/form.tsx"],"sourcesContent":["\"use client\";\n\nimport { Form as BaseForm } from \"@base-ui/react/form\";\nimport { createContext, forwardRef } from \"react\";\nimport type { ReactElement, ReactNode, RefAttributes } from \"react\";\nimport type { FormProps as BaseFormProps } from \"@base-ui/react/form\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { form } from \"../../styled-system/recipes\";\n\nexport type FormErrors = Record<string, string | string[]>;\n\ninterface JaciFormContextValue {\n errors: FormErrors;\n}\n\nexport const JaciFormContext = createContext<JaciFormContextValue>({ errors: {} });\n\nexport interface FormProps<FormValues extends Record<string, unknown> = Record<string, unknown>>\n extends Omit<BaseFormProps<FormValues>, \"children\" | \"errors\" | \"className\"> {\n className?: string;\n /** External errors keyed by each field's `name`. */\n errors?: FormErrors;\n children?: ReactNode;\n}\n\nconst FormRoot = forwardRef<HTMLFormElement, FormProps>(function Form(\n { children, className, errors, ...props },\n ref,\n) {\n return (\n <JaciFormContext.Provider value={{ errors: errors ?? {} }}>\n <BaseForm\n {...props}\n ref={ref}\n className={cx(form(), className)}\n data-jaci-component=\"form\"\n data-slot=\"form\"\n errors={errors}\n >\n {children}\n </BaseForm>\n </JaciFormContext.Provider>\n );\n});\n\nexport const Form = FormRoot as <\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n>(\n props: FormProps<FormValues> & RefAttributes<HTMLFormElement>,\n) => ReactElement | null;\n"],"mappings":";;;;;;;AAgBA,MAAa,mBAAA,GAAkBA,MAAAA,cAAAA,CAAoC,EAAE,QAAQ,CAAC,EAAE,CAAC;AA8BjF,MAAa,QApBP,GAAWC,MAAAA,WAAAA,CAAuC,SAAS,KAC/D,EAAE,UAAU,WAAW,QAAQ,GAAG,SAClC,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAgB,UAAjB;EAA0B,OAAO,EAAE,QAAQ,UAAU,CAAC,EAAE;EACtD,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,MAAD;GACE,GAAI;GACC;GACL,WAAWC,WAAAA,GAAGC,aAAAA,KAAK,GAAG,SAAS;GAC/B,uBAAoB;GACpB,aAAU;GACF;GAEP;EACO,CAAA;CACc,CAAA;AAE9B,CAEoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","names":["Form","BaseForm"],"sources":["../../../src/components/form/form.tsx"],"sourcesContent":["\"use client\";\n\nimport { Form as BaseForm } from \"@base-ui/react/form\";\nimport { createContext, forwardRef } from \"react\";\nimport type { ReactElement, ReactNode, RefAttributes } from \"react\";\nimport type { FormProps as BaseFormProps } from \"@base-ui/react/form\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { form } from \"../../styled-system/recipes\";\n\nexport type FormErrors = Record<string, string | string[]>;\n\ninterface JaciFormContextValue {\n errors: FormErrors;\n}\n\nexport const JaciFormContext = createContext<JaciFormContextValue>({ errors: {} });\n\nexport interface FormProps<FormValues extends Record<string, unknown> = Record<string, unknown>>\n extends Omit<BaseFormProps<FormValues>, \"children\" | \"errors\" | \"className\"> {\n className?: string;\n /** External errors keyed by each field's `name`. */\n errors?: FormErrors;\n children?: ReactNode;\n}\n\nconst FormRoot = forwardRef<HTMLFormElement, FormProps>(function Form(\n { children, className, errors, ...props },\n ref,\n) {\n return (\n <JaciFormContext.Provider value={{ errors: errors ?? {} }}>\n <BaseForm\n {...props}\n ref={ref}\n className={cx(form(), className)}\n data-jaci-component=\"form\"\n data-slot=\"form\"\n errors={errors}\n >\n {children}\n </BaseForm>\n </JaciFormContext.Provider>\n );\n});\n\nexport const Form = FormRoot as <\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n>(\n props: FormProps<FormValues> & RefAttributes<HTMLFormElement>,\n) => ReactElement | null;\n"],"mappings":";;;;;;;AAgBA,MAAa,kBAAkB,cAAoC,EAAE,QAAQ,CAAC,EAAE,CAAC;AA8BjF,MAAaA,SApBI,WAAuC,SAASA,OAC/D,EAAE,UAAU,WAAW,QAAQ,GAAG,SAClC,KACA;CACA,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO,EAAE,QAAQ,UAAU,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"form.js","names":["Form","BaseForm"],"sources":["../../../src/components/form/form.tsx"],"sourcesContent":["\"use client\";\n\nimport { Form as BaseForm } from \"@base-ui/react/form\";\nimport { createContext, forwardRef } from \"react\";\nimport type { ReactElement, ReactNode, RefAttributes } from \"react\";\nimport type { FormProps as BaseFormProps } from \"@base-ui/react/form\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { form } from \"../../styled-system/recipes\";\n\nexport type FormErrors = Record<string, string | string[]>;\n\ninterface JaciFormContextValue {\n errors: FormErrors;\n}\n\nexport const JaciFormContext = createContext<JaciFormContextValue>({ errors: {} });\n\nexport interface FormProps<FormValues extends Record<string, unknown> = Record<string, unknown>>\n extends Omit<BaseFormProps<FormValues>, \"children\" | \"errors\" | \"className\"> {\n className?: string;\n /** External errors keyed by each field's `name`. */\n errors?: FormErrors;\n children?: ReactNode;\n}\n\nconst FormRoot = forwardRef<HTMLFormElement, FormProps>(function Form(\n { children, className, errors, ...props },\n ref,\n) {\n return (\n <JaciFormContext.Provider value={{ errors: errors ?? {} }}>\n <BaseForm\n {...props}\n ref={ref}\n className={cx(form(), className)}\n data-jaci-component=\"form\"\n data-slot=\"form\"\n errors={errors}\n >\n {children}\n </BaseForm>\n </JaciFormContext.Provider>\n );\n});\n\nexport const Form = FormRoot as <\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n>(\n props: FormProps<FormValues> & RefAttributes<HTMLFormElement>,\n) => ReactElement | null;\n"],"mappings":";;;;;;;AAgBA,MAAa,kBAAkB,cAAoC,EAAE,QAAQ,CAAC,EAAE,CAAC;AA8BjF,MAAaA,SApBI,WAAuC,SAASA,OAC/D,EAAE,UAAU,WAAW,QAAQ,GAAG,SAClC,KACA;CACA,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO,EAAE,QAAQ,UAAU,CAAC,EAAE;EACtD,UAAA,oBAACC,MAAD;GACE,GAAI;GACC;GACL,WAAW,GAAG,KAAK,GAAG,SAAS;GAC/B,uBAAoB;GACpB,aAAU;GACF;GAEP;EACO,CAAA;CACc,CAAA;AAE9B,CAEoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.cjs","names":["Children","cx","iconButton","Spinner"],"sources":["../../../src/components/icon-button/icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, forwardRef, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { iconButton } from \"../../styled-system/recipes\";\nimport { Spinner } from \"../layout\";\n\nexport interface IconButtonProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"children\" | \"color\"> {\n children?: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"danger\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n}\n\nfunction hasTextualContent(children: ReactNode): boolean {\n if (typeof children === \"string\" || typeof children === \"number\") {\n return String(children).trim().length > 0;\n }\n\n return Children.toArray(children).some((child) => {\n if (!isValidElement(child)) return false;\n return hasTextualContent((child.props as { children?: ReactNode }).children);\n });\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, className, disabled, loading = false, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n if (!hasTextualContent(children) && !props[\"aria-label\"] && !props[\"aria-labelledby\"]) {\n throw new Error(\"IconButton requires an aria-label when it has no textual content.\");\n }\n\n return (\n <button\n {...props}\n ref={ref}\n aria-busy={loading || undefined}\n className={cx(iconButton({ size, variant }), className)}\n data-jaci-component=\"icon-button\"\n data-loading={loading || undefined}\n data-slot=\"icon-button\"\n disabled={disabled || loading}\n type={props.type ?? \"button\"}\n >\n {loading ? <Spinner aria-hidden=\"true\" label=\"\" size=\"sm\" /> : children}\n </button>\n );\n});\n"],"mappings":";;;;;;;AAiBA,SAAS,kBAAkB,UAA8B;CACvD,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;CAG1C,OAAOA,MAAAA,SAAS,QAAQ,QAAQ,CAAC,CAAC,MAAM,UAAU;EAChD,IAAI,EAAA,
|
|
1
|
+
{"version":3,"file":"icon-button.cjs","names":["Children","isValidElement","forwardRef","cx","iconButton","Spinner"],"sources":["../../../src/components/icon-button/icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, forwardRef, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { iconButton } from \"../../styled-system/recipes\";\nimport { Spinner } from \"../layout\";\n\nexport interface IconButtonProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"children\" | \"color\"> {\n children?: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"danger\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n}\n\nfunction hasTextualContent(children: ReactNode): boolean {\n if (typeof children === \"string\" || typeof children === \"number\") {\n return String(children).trim().length > 0;\n }\n\n return Children.toArray(children).some((child) => {\n if (!isValidElement(child)) return false;\n return hasTextualContent((child.props as { children?: ReactNode }).children);\n });\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, className, disabled, loading = false, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n if (!hasTextualContent(children) && !props[\"aria-label\"] && !props[\"aria-labelledby\"]) {\n throw new Error(\"IconButton requires an aria-label when it has no textual content.\");\n }\n\n return (\n <button\n {...props}\n ref={ref}\n aria-busy={loading || undefined}\n className={cx(iconButton({ size, variant }), className)}\n data-jaci-component=\"icon-button\"\n data-loading={loading || undefined}\n data-slot=\"icon-button\"\n disabled={disabled || loading}\n type={props.type ?? \"button\"}\n >\n {loading ? <Spinner aria-hidden=\"true\" label=\"\" size=\"sm\" /> : children}\n </button>\n );\n});\n"],"mappings":";;;;;;;AAiBA,SAAS,kBAAkB,UAA8B;CACvD,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;CAG1C,OAAOA,MAAAA,SAAS,QAAQ,QAAQ,CAAC,CAAC,MAAM,UAAU;EAChD,IAAI,EAAA,GAACC,MAAAA,eAAAA,CAAe,KAAK,GAAG,OAAO;EACnC,OAAO,kBAAmB,MAAM,MAAmC,QAAQ;CAC7E,CAAC;AACH;AAEA,MAAa,cAAA,GAAaC,MAAAA,WAAAA,CAA+C,SAAS,WAChF,EAAE,UAAU,WAAW,UAAU,UAAU,OAAO,OAAO,MAAM,UAAU,WAAW,GAAG,SACvF,KACA;CACA,IAAI,CAAC,kBAAkB,QAAQ,KAAK,CAAC,MAAM,iBAAiB,CAAC,MAAM,oBACjE,MAAM,IAAI,MAAM,mEAAmE;CAGrF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EACE,GAAI;EACC;EACL,aAAW,WAAW,KAAA;EACtB,WAAWC,WAAAA,GAAGC,oBAAAA,WAAW;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACtD,uBAAoB;EACpB,gBAAc,WAAW,KAAA;EACzB,aAAU;EACV,UAAU,YAAY;EACtB,MAAM,MAAM,QAAQ;EAEnB,UAAA,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,SAAD;GAAS,eAAY;GAAO,OAAM;GAAG,MAAK;EAAM,CAAA,IAAI;CACzD,CAAA;AAEZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.js","names":[],"sources":["../../../src/components/icon-button/icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, forwardRef, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { iconButton } from \"../../styled-system/recipes\";\nimport { Spinner } from \"../layout\";\n\nexport interface IconButtonProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"children\" | \"color\"> {\n children?: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"danger\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n}\n\nfunction hasTextualContent(children: ReactNode): boolean {\n if (typeof children === \"string\" || typeof children === \"number\") {\n return String(children).trim().length > 0;\n }\n\n return Children.toArray(children).some((child) => {\n if (!isValidElement(child)) return false;\n return hasTextualContent((child.props as { children?: ReactNode }).children);\n });\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, className, disabled, loading = false, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n if (!hasTextualContent(children) && !props[\"aria-label\"] && !props[\"aria-labelledby\"]) {\n throw new Error(\"IconButton requires an aria-label when it has no textual content.\");\n }\n\n return (\n <button\n {...props}\n ref={ref}\n aria-busy={loading || undefined}\n className={cx(iconButton({ size, variant }), className)}\n data-jaci-component=\"icon-button\"\n data-loading={loading || undefined}\n data-slot=\"icon-button\"\n disabled={disabled || loading}\n type={props.type ?? \"button\"}\n >\n {loading ? <Spinner aria-hidden=\"true\" label=\"\" size=\"sm\" /> : children}\n </button>\n );\n});\n"],"mappings":";;;;;;;AAiBA,SAAS,kBAAkB,UAA8B;CACvD,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;CAG1C,OAAO,SAAS,QAAQ,QAAQ,CAAC,CAAC,MAAM,UAAU;EAChD,IAAI,CAAC,eAAe,KAAK,GAAG,OAAO;EACnC,OAAO,kBAAmB,MAAM,MAAmC,QAAQ;CAC7E,CAAC;AACH;AAEA,MAAa,aAAa,WAA+C,SAAS,WAChF,EAAE,UAAU,WAAW,UAAU,UAAU,OAAO,OAAO,MAAM,UAAU,WAAW,GAAG,SACvF,KACA;CACA,IAAI,CAAC,kBAAkB,QAAQ,KAAK,CAAC,MAAM,iBAAiB,CAAC,MAAM,oBACjE,MAAM,IAAI,MAAM,mEAAmE;CAGrF,OACE,oBAAC,UAAD;EACE,GAAI;EACC;EACL,aAAW,WAAW,KAAA;EACtB,WAAW,GAAG,WAAW;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACtD,uBAAoB;EACpB,gBAAc,WAAW,KAAA;EACzB,aAAU;EACV,UAAU,YAAY;EACtB,MAAM,MAAM,QAAQ;
|
|
1
|
+
{"version":3,"file":"icon-button.js","names":[],"sources":["../../../src/components/icon-button/icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, forwardRef, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { iconButton } from \"../../styled-system/recipes\";\nimport { Spinner } from \"../layout\";\n\nexport interface IconButtonProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"children\" | \"color\"> {\n children?: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"danger\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n}\n\nfunction hasTextualContent(children: ReactNode): boolean {\n if (typeof children === \"string\" || typeof children === \"number\") {\n return String(children).trim().length > 0;\n }\n\n return Children.toArray(children).some((child) => {\n if (!isValidElement(child)) return false;\n return hasTextualContent((child.props as { children?: ReactNode }).children);\n });\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, className, disabled, loading = false, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n if (!hasTextualContent(children) && !props[\"aria-label\"] && !props[\"aria-labelledby\"]) {\n throw new Error(\"IconButton requires an aria-label when it has no textual content.\");\n }\n\n return (\n <button\n {...props}\n ref={ref}\n aria-busy={loading || undefined}\n className={cx(iconButton({ size, variant }), className)}\n data-jaci-component=\"icon-button\"\n data-loading={loading || undefined}\n data-slot=\"icon-button\"\n disabled={disabled || loading}\n type={props.type ?? \"button\"}\n >\n {loading ? <Spinner aria-hidden=\"true\" label=\"\" size=\"sm\" /> : children}\n </button>\n );\n});\n"],"mappings":";;;;;;;AAiBA,SAAS,kBAAkB,UAA8B;CACvD,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;CAG1C,OAAO,SAAS,QAAQ,QAAQ,CAAC,CAAC,MAAM,UAAU;EAChD,IAAI,CAAC,eAAe,KAAK,GAAG,OAAO;EACnC,OAAO,kBAAmB,MAAM,MAAmC,QAAQ;CAC7E,CAAC;AACH;AAEA,MAAa,aAAa,WAA+C,SAAS,WAChF,EAAE,UAAU,WAAW,UAAU,UAAU,OAAO,OAAO,MAAM,UAAU,WAAW,GAAG,SACvF,KACA;CACA,IAAI,CAAC,kBAAkB,QAAQ,KAAK,CAAC,MAAM,iBAAiB,CAAC,MAAM,oBACjE,MAAM,IAAI,MAAM,mEAAmE;CAGrF,OACE,oBAAC,UAAD;EACE,GAAI;EACC;EACL,aAAW,WAAW,KAAA;EACtB,WAAW,GAAG,WAAW;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACtD,uBAAoB;EACpB,gBAAc,WAAW,KAAA;EACzB,aAAU;EACV,UAAU,YAAY;EACtB,MAAM,MAAM,QAAQ;EAEnB,UAAA,UAAU,oBAAC,SAAD;GAAS,eAAY;GAAO,OAAM;GAAG,MAAK;EAAM,CAAA,IAAI;CACzD,CAAA;AAEZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.cjs","names":["image","useThemePortalProps","cx","BaseDialog"],"sources":["../../../src/components/image/image.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { image } from \"../../styled-system/recipes\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ImageFit = \"contain\" | \"cover\" | \"fill\" | \"none\";\nexport type ImageStatus = \"loading\" | \"loaded\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithoutRef<\"img\">, \"children\"> {\n alt: string;\n aspectRatio?: number;\n defaultOpen?: boolean;\n fallback?: ReactNode;\n fit?: ImageFit;\n lightbox?: boolean;\n lightboxLabel?: string;\n onOpenChange?: (open: boolean) => void;\n onStatusChange?: (status: ImageStatus) => void;\n open?: boolean;\n position?: string;\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n alt,\n aspectRatio,\n className,\n defaultOpen,\n fallback,\n fit = \"cover\",\n lightbox = false,\n lightboxLabel = \"Open image\",\n onError,\n onLoad,\n onOpenChange,\n onStatusChange,\n open,\n position,\n src,\n style,\n ...props\n },\n ref,\n) {\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n // The source is intentionally the reset key for the native image lifecycle.\n // biome-ignore lint/correctness/useExhaustiveDependencies: changing src starts a new lifecycle.\n useEffect(() => {\n setStatus(\"loading\");\n }, [src]);\n\n useEffect(() => {\n onStatusChange?.(status);\n }, [onStatusChange, status]);\n\n const styles = image({ fit, status });\n const scopedPortalProps = useThemePortalProps({});\n const rootStyle = {\n ...(aspectRatio && Number.isFinite(aspectRatio) && aspectRatio > 0\n ? { aspectRatio }\n : undefined),\n ...style,\n };\n\n const content = (\n <span\n aria-busy={status === \"loading\" || undefined}\n className={styles.root}\n data-fit={fit}\n data-jaci-component=\"image\"\n data-slot=\"image\"\n data-status={status}\n style={rootStyle}\n >\n <img\n {...props}\n ref={ref}\n alt={alt}\n className={cx(styles.image, className)}\n data-slot=\"image-content\"\n onError={(event) => {\n setStatus(\"error\");\n onError?.(event);\n }}\n onLoad={(event) => {\n setStatus(\"loaded\");\n onLoad?.(event);\n }}\n src={src}\n style={{ objectPosition: position }}\n />\n {status === \"error\" && fallback ? (\n <span aria-live=\"polite\" className={styles.fallback} data-slot=\"image-fallback\">\n {fallback}\n </span>\n ) : null}\n </span>\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n <BaseDialog.Trigger\n aria-label={lightboxLabel}\n className={styles.trigger}\n data-jaci-component=\"image-trigger\"\n data-slot=\"image-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"image-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"image-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || lightboxLabel}\n className={styles.popup}\n data-jaci-component=\"image-lightbox\"\n data-slot=\"image-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || lightboxLabel}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"image-lightbox-close-row\">\n <BaseDialog.Close\n aria-label=\"Close image\"\n className={styles.close}\n data-slot=\"image-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"image-lightbox-content\"\n src={src}\n style={{ objectPosition: position }}\n />\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n );\n});\n"],"mappings":";;;;;;;;AA2BA,MAAa,SAAA,
|
|
1
|
+
{"version":3,"file":"image.cjs","names":["forwardRef","useState","image","useThemePortalProps","cx","BaseDialog"],"sources":["../../../src/components/image/image.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { image } from \"../../styled-system/recipes\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ImageFit = \"contain\" | \"cover\" | \"fill\" | \"none\";\nexport type ImageStatus = \"loading\" | \"loaded\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithoutRef<\"img\">, \"children\"> {\n alt: string;\n aspectRatio?: number;\n defaultOpen?: boolean;\n fallback?: ReactNode;\n fit?: ImageFit;\n lightbox?: boolean;\n lightboxLabel?: string;\n onOpenChange?: (open: boolean) => void;\n onStatusChange?: (status: ImageStatus) => void;\n open?: boolean;\n position?: string;\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n alt,\n aspectRatio,\n className,\n defaultOpen,\n fallback,\n fit = \"cover\",\n lightbox = false,\n lightboxLabel = \"Open image\",\n onError,\n onLoad,\n onOpenChange,\n onStatusChange,\n open,\n position,\n src,\n style,\n ...props\n },\n ref,\n) {\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n // The source is intentionally the reset key for the native image lifecycle.\n // biome-ignore lint/correctness/useExhaustiveDependencies: changing src starts a new lifecycle.\n useEffect(() => {\n setStatus(\"loading\");\n }, [src]);\n\n useEffect(() => {\n onStatusChange?.(status);\n }, [onStatusChange, status]);\n\n const styles = image({ fit, status });\n const scopedPortalProps = useThemePortalProps({});\n const rootStyle = {\n ...(aspectRatio && Number.isFinite(aspectRatio) && aspectRatio > 0\n ? { aspectRatio }\n : undefined),\n ...style,\n };\n\n const content = (\n <span\n aria-busy={status === \"loading\" || undefined}\n className={styles.root}\n data-fit={fit}\n data-jaci-component=\"image\"\n data-slot=\"image\"\n data-status={status}\n style={rootStyle}\n >\n <img\n {...props}\n ref={ref}\n alt={alt}\n className={cx(styles.image, className)}\n data-slot=\"image-content\"\n onError={(event) => {\n setStatus(\"error\");\n onError?.(event);\n }}\n onLoad={(event) => {\n setStatus(\"loaded\");\n onLoad?.(event);\n }}\n src={src}\n style={{ objectPosition: position }}\n />\n {status === \"error\" && fallback ? (\n <span aria-live=\"polite\" className={styles.fallback} data-slot=\"image-fallback\">\n {fallback}\n </span>\n ) : null}\n </span>\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n <BaseDialog.Trigger\n aria-label={lightboxLabel}\n className={styles.trigger}\n data-jaci-component=\"image-trigger\"\n data-slot=\"image-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"image-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"image-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || lightboxLabel}\n className={styles.popup}\n data-jaci-component=\"image-lightbox\"\n data-slot=\"image-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || lightboxLabel}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"image-lightbox-close-row\">\n <BaseDialog.Close\n aria-label=\"Close image\"\n className={styles.close}\n data-slot=\"image-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"image-lightbox-content\"\n src={src}\n style={{ objectPosition: position }}\n />\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n );\n});\n"],"mappings":";;;;;;;;AA2BA,MAAa,SAAA,GAAQA,MAAAA,WAAAA,CAAyC,SAAS,MACrE,EACE,KACA,aACA,WACA,aACA,UACA,MAAM,SACN,WAAW,OACX,gBAAgB,cAChB,SACA,QACA,cACA,gBACA,MACA,UACA,KACA,OACA,GAAG,SAEL,KACA;CACA,MAAM,CAAC,QAAQ,cAAA,GAAaC,MAAAA,SAAAA,CAAsB,SAAS;CAI3D,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,UAAU,SAAS;CACrB,GAAG,CAAC,GAAG,CAAC;CAER,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,iBAAiB,MAAM;CACzB,GAAG,CAAC,gBAAgB,MAAM,CAAC;CAE3B,MAA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W,UAAZ;IAAqB,WAAW,OAAO;IAAU,aAAU;GAA2B,CAAA,GACtF,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,OAAW,UAAZ;IAAqB,WAAW,OAAO;IAAU,aAAU;IACzD,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAACA,sBAAAA,OAAW,OAAZ;KACE,cAAY,OAAO;KACnB,WAAW,OAAO;KAClB,uBAAoB;KACpB,aAAU;KAJZ,UAAA;MAME,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,OAAW,OAAZ;OAAkB,WAAW,OAAO;OAAQ,UAAA,OAAO;MAAgC,CAAA;MACnF,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;OAAK,WAAW,OAAO;OAAU,aAAU;OACzC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,OAAW,OAAZ;QACE,cAAW;QACX,WAAW,OAAO;QAClB,aAAU;QACX,UAAA;OAEiB,CAAA;MACf,CAAA;MACL,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;OACO;OACL,WAAW,OAAO;OAClB,aAAU;OACL;OACL,OAAO,EAAE,gBAAgB,SAAS;MACnC,CAAA;KACe;;GACC,CAAA,CACJ;EACJ,CAAA,CAAA;;AAErB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","names":["BaseDialog"],"sources":["../../../src/components/image/image.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { image } from \"../../styled-system/recipes\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ImageFit = \"contain\" | \"cover\" | \"fill\" | \"none\";\nexport type ImageStatus = \"loading\" | \"loaded\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithoutRef<\"img\">, \"children\"> {\n alt: string;\n aspectRatio?: number;\n defaultOpen?: boolean;\n fallback?: ReactNode;\n fit?: ImageFit;\n lightbox?: boolean;\n lightboxLabel?: string;\n onOpenChange?: (open: boolean) => void;\n onStatusChange?: (status: ImageStatus) => void;\n open?: boolean;\n position?: string;\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n alt,\n aspectRatio,\n className,\n defaultOpen,\n fallback,\n fit = \"cover\",\n lightbox = false,\n lightboxLabel = \"Open image\",\n onError,\n onLoad,\n onOpenChange,\n onStatusChange,\n open,\n position,\n src,\n style,\n ...props\n },\n ref,\n) {\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n // The source is intentionally the reset key for the native image lifecycle.\n // biome-ignore lint/correctness/useExhaustiveDependencies: changing src starts a new lifecycle.\n useEffect(() => {\n setStatus(\"loading\");\n }, [src]);\n\n useEffect(() => {\n onStatusChange?.(status);\n }, [onStatusChange, status]);\n\n const styles = image({ fit, status });\n const scopedPortalProps = useThemePortalProps({});\n const rootStyle = {\n ...(aspectRatio && Number.isFinite(aspectRatio) && aspectRatio > 0\n ? { aspectRatio }\n : undefined),\n ...style,\n };\n\n const content = (\n <span\n aria-busy={status === \"loading\" || undefined}\n className={styles.root}\n data-fit={fit}\n data-jaci-component=\"image\"\n data-slot=\"image\"\n data-status={status}\n style={rootStyle}\n >\n <img\n {...props}\n ref={ref}\n alt={alt}\n className={cx(styles.image, className)}\n data-slot=\"image-content\"\n onError={(event) => {\n setStatus(\"error\");\n onError?.(event);\n }}\n onLoad={(event) => {\n setStatus(\"loaded\");\n onLoad?.(event);\n }}\n src={src}\n style={{ objectPosition: position }}\n />\n {status === \"error\" && fallback ? (\n <span aria-live=\"polite\" className={styles.fallback} data-slot=\"image-fallback\">\n {fallback}\n </span>\n ) : null}\n </span>\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n <BaseDialog.Trigger\n aria-label={lightboxLabel}\n className={styles.trigger}\n data-jaci-component=\"image-trigger\"\n data-slot=\"image-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"image-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"image-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || lightboxLabel}\n className={styles.popup}\n data-jaci-component=\"image-lightbox\"\n data-slot=\"image-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || lightboxLabel}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"image-lightbox-close-row\">\n <BaseDialog.Close\n aria-label=\"Close image\"\n className={styles.close}\n data-slot=\"image-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"image-lightbox-content\"\n src={src}\n style={{ objectPosition: position }}\n />\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n );\n});\n"],"mappings":";;;;;;;;AA2BA,MAAa,QAAQ,WAAyC,SAAS,MACrE,EACE,KACA,aACA,WACA,aACA,UACA,MAAM,SACN,WAAW,OACX,gBAAgB,cAChB,SACA,QACA,cACA,gBACA,MACA,UACA,KACA,OACA,GAAG,SAEL,KACA;CACA,MAAM,CAAC,QAAQ,aAAa,SAAsB,SAAS;CAI3D,gBAAgB;EACd,UAAU,SAAS;CACrB,GAAG,CAAC,GAAG,CAAC;CAER,gBAAgB;EACd,iBAAiB,MAAM;CACzB,GAAG,CAAC,gBAAgB,MAAM,CAAC;CAE3B,MAAM,SAAS,MAAM;EAAE;EAAK;CAAO,CAAC;CACpC,MAAM,oBAAoB,oBAAoB,CAAC,CAAC;CAChD,MAAM,YAAY;EAChB,GAAI,eAAe,OAAO,SAAS,WAAW,KAAK,cAAc,IAC7D,EAAE,YAAY,IACd,KAAA;EACJ,GAAG;CACL;CAEA,MAAM,UACJ,qBAAC,QAAD;EACE,aAAW,WAAW,aAAa,KAAA;EACnC,WAAW,OAAO;EAClB,YAAU;EACV,uBAAoB;EACpB,aAAU;EACV,eAAa;EACb,OAAO;
|
|
1
|
+
{"version":3,"file":"image.js","names":["BaseDialog"],"sources":["../../../src/components/image/image.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { image } from \"../../styled-system/recipes\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ImageFit = \"contain\" | \"cover\" | \"fill\" | \"none\";\nexport type ImageStatus = \"loading\" | \"loaded\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithoutRef<\"img\">, \"children\"> {\n alt: string;\n aspectRatio?: number;\n defaultOpen?: boolean;\n fallback?: ReactNode;\n fit?: ImageFit;\n lightbox?: boolean;\n lightboxLabel?: string;\n onOpenChange?: (open: boolean) => void;\n onStatusChange?: (status: ImageStatus) => void;\n open?: boolean;\n position?: string;\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n alt,\n aspectRatio,\n className,\n defaultOpen,\n fallback,\n fit = \"cover\",\n lightbox = false,\n lightboxLabel = \"Open image\",\n onError,\n onLoad,\n onOpenChange,\n onStatusChange,\n open,\n position,\n src,\n style,\n ...props\n },\n ref,\n) {\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n // The source is intentionally the reset key for the native image lifecycle.\n // biome-ignore lint/correctness/useExhaustiveDependencies: changing src starts a new lifecycle.\n useEffect(() => {\n setStatus(\"loading\");\n }, [src]);\n\n useEffect(() => {\n onStatusChange?.(status);\n }, [onStatusChange, status]);\n\n const styles = image({ fit, status });\n const scopedPortalProps = useThemePortalProps({});\n const rootStyle = {\n ...(aspectRatio && Number.isFinite(aspectRatio) && aspectRatio > 0\n ? { aspectRatio }\n : undefined),\n ...style,\n };\n\n const content = (\n <span\n aria-busy={status === \"loading\" || undefined}\n className={styles.root}\n data-fit={fit}\n data-jaci-component=\"image\"\n data-slot=\"image\"\n data-status={status}\n style={rootStyle}\n >\n <img\n {...props}\n ref={ref}\n alt={alt}\n className={cx(styles.image, className)}\n data-slot=\"image-content\"\n onError={(event) => {\n setStatus(\"error\");\n onError?.(event);\n }}\n onLoad={(event) => {\n setStatus(\"loaded\");\n onLoad?.(event);\n }}\n src={src}\n style={{ objectPosition: position }}\n />\n {status === \"error\" && fallback ? (\n <span aria-live=\"polite\" className={styles.fallback} data-slot=\"image-fallback\">\n {fallback}\n </span>\n ) : null}\n </span>\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n <BaseDialog.Trigger\n aria-label={lightboxLabel}\n className={styles.trigger}\n data-jaci-component=\"image-trigger\"\n data-slot=\"image-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"image-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"image-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || lightboxLabel}\n className={styles.popup}\n data-jaci-component=\"image-lightbox\"\n data-slot=\"image-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || lightboxLabel}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"image-lightbox-close-row\">\n <BaseDialog.Close\n aria-label=\"Close image\"\n className={styles.close}\n data-slot=\"image-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"image-lightbox-content\"\n src={src}\n style={{ objectPosition: position }}\n />\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n );\n});\n"],"mappings":";;;;;;;;AA2BA,MAAa,QAAQ,WAAyC,SAAS,MACrE,EACE,KACA,aACA,WACA,aACA,UACA,MAAM,SACN,WAAW,OACX,gBAAgB,cAChB,SACA,QACA,cACA,gBACA,MACA,UACA,KACA,OACA,GAAG,SAEL,KACA;CACA,MAAM,CAAC,QAAQ,aAAa,SAAsB,SAAS;CAI3D,gBAAgB;EACd,UAAU,SAAS;CACrB,GAAG,CAAC,GAAG,CAAC;CAER,gBAAgB;EACd,iBAAiB,MAAM;CACzB,GAAG,CAAC,gBAAgB,MAAM,CAAC;CAE3B,MAAM,SAAS,MAAM;EAAE;EAAK;CAAO,CAAC;CACpC,MAAM,oBAAoB,oBAAoB,CAAC,CAAC;CAChD,MAAM,YAAY;EAChB,GAAI,eAAe,OAAO,SAAS,WAAW,KAAK,cAAc,IAC7D,EAAE,YAAY,IACd,KAAA;EACJ,GAAG;CACL;CAEA,MAAM,UACJ,qBAAC,QAAD;EACE,aAAW,WAAW,aAAa,KAAA;EACnC,WAAW,OAAO;EAClB,YAAU;EACV,uBAAoB;EACpB,aAAU;EACV,eAAa;EACb,OAAO;EAPT,UAAA,CASE,oBAAC,OAAD;GACE,GAAI;GACC;GACA;GACL,WAAW,GAAG,OAAO,OAAO,SAAS;GACrC,aAAU;GACV,UAAU,UAAU;IAClB,UAAU,OAAO;IACjB,UAAU,KAAK;GACjB;GACA,SAAS,UAAU;IACjB,UAAU,QAAQ;IAClB,SAAS,KAAK;GAChB;GACK;GACL,OAAO,EAAE,gBAAgB,SAAS;EACnC,CAAA,GACA,WAAW,WAAW,WACrB,oBAAC,QAAD;GAAM,aAAU;GAAS,WAAW,OAAO;GAAU,aAAU;GAC5D,UAAA;EACG,CAAA,IACJ,IACA;;CAGR,IAAI,CAAC,UACH,OAAO;CAGT,OACE,qBAACA,OAAW,MAAZ;EACe;EACb,eAAe,aAAa,eAAe,QAAQ;EAC7C;EAHR,UAAA,CAKE,oBAACA,OAAW,SAAZ;GACE,cAAY;GACZ,WAAW,OAAO;GAClB,uBAAoB;GACpB,aAAU;GAET,UAAA;EACiB,CAAA,GACpB,qBAACA,OAAW,QAAZ;GAAmB,GAAI;GAAvB,UAAA,CACE,oBAACA,OAAW,UAAZ;IAAqB,WAAW,OAAO;IAAU,aAAU;GAA2B,CAAA,GACtF,oBAACA,OAAW,UAAZ;IAAqB,WAAW,OAAO;IAAU,aAAU;IACzD,UAAA,qBAACA,OAAW,OAAZ;KACE,cAAY,OAAO;KACnB,WAAW,OAAO;KAClB,uBAAoB;KACpB,aAAU;KAJZ,UAAA;MAME,oBAACA,OAAW,OAAZ;OAAkB,WAAW,OAAO;OAAQ,UAAA,OAAO;MAAgC,CAAA;MACnF,oBAAC,OAAD;OAAK,WAAW,OAAO;OAAU,aAAU;OACzC,UAAA,oBAACA,OAAW,OAAZ;QACE,cAAW;QACX,WAAW,OAAO;QAClB,aAAU;QACX,UAAA;OAEiB,CAAA;MACf,CAAA;MACL,oBAAC,OAAD;OACO;OACL,WAAW,OAAO;OAClB,aAAU;OACL;OACL,OAAO,EAAE,gBAAgB,SAAS;MACnC,CAAA;KACe;;GACC,CAAA,CACJ;EACJ,CAAA,CAAA;;AAErB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-group.cjs","names":["cx","inputGroup"],"sources":["../../../src/components/input-group/input-group.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { inputGroup } from \"../../styled-system/recipes\";\n\nexport interface InputGroupRootProps extends ComponentPropsWithoutRef<\"div\"> {\n children?: ReactNode;\n}\n\nexport const InputGroupRoot = forwardRef<HTMLDivElement, InputGroupRootProps>(\n function InputGroupRoot({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(inputGroup().root, className)}\n data-jaci-component=\"input-group\"\n data-slot=\"input-group\"\n />\n );\n },\n);\n\nexport type InputGroupAddonProps = ComponentPropsWithoutRef<\"span\">;\nexport const InputGroupAddon = forwardRef<HTMLSpanElement, InputGroupAddonProps>(\n function InputGroupAddon({ className, ...props }, ref) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(inputGroup().addon, className)}\n data-slot=\"input-group-addon\"\n />\n );\n },\n);\n\nexport const InputGroup = Object.assign(InputGroupRoot, {\n Root: InputGroupRoot,\n Addon: InputGroupAddon,\n});\n"],"mappings":";;;;;AAUA,MAAa,kBAAA,
|
|
1
|
+
{"version":3,"file":"input-group.cjs","names":["forwardRef","cx","inputGroup"],"sources":["../../../src/components/input-group/input-group.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { inputGroup } from \"../../styled-system/recipes\";\n\nexport interface InputGroupRootProps extends ComponentPropsWithoutRef<\"div\"> {\n children?: ReactNode;\n}\n\nexport const InputGroupRoot = forwardRef<HTMLDivElement, InputGroupRootProps>(\n function InputGroupRoot({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(inputGroup().root, className)}\n data-jaci-component=\"input-group\"\n data-slot=\"input-group\"\n />\n );\n },\n);\n\nexport type InputGroupAddonProps = ComponentPropsWithoutRef<\"span\">;\nexport const InputGroupAddon = forwardRef<HTMLSpanElement, InputGroupAddonProps>(\n function InputGroupAddon({ className, ...props }, ref) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(inputGroup().addon, className)}\n data-slot=\"input-group-addon\"\n />\n );\n },\n);\n\nexport const InputGroup = Object.assign(InputGroupRoot, {\n Root: InputGroupRoot,\n Addon: InputGroupAddon,\n});\n"],"mappings":";;;;;AAUA,MAAa,kBAAA,GAAiBA,MAAAA,WAAAA,CAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGC,oBAAAA,WAAW,CAAC,CAAC,MAAM,SAAS;EAC1C,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CACF;AAGA,MAAa,mBAAA,GAAkBF,MAAAA,WAAAA,CAC7B,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAS,KAAK;CACrD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGC,oBAAAA,WAAW,CAAC,CAAC,OAAO,SAAS;EAC3C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,aAAa,OAAO,OAAO,gBAAgB;CACtD,MAAM;CACN,OAAO;AACT,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kbd.cjs","names":["cx","kbd"],"sources":["../../../src/components/kbd/kbd.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { kbd } from \"../../styled-system/recipes\";\n\nexport type KbdSize = \"sm\" | \"md\" | \"lg\";\nexport type KbdVariant = \"solid\" | \"outline\" | \"subtle\";\n\nexport interface KbdProps extends ComponentPropsWithoutRef<\"kbd\"> {\n size?: KbdSize;\n variant?: KbdVariant;\n}\n\nexport const Kbd = forwardRef<HTMLElement, KbdProps>(function Kbd(\n { className, size = \"md\", variant = \"subtle\", ...props },\n ref,\n) {\n return (\n <kbd\n {...props}\n ref={ref}\n className={cx(kbd({ size, variant }), className)}\n data-jaci-component=\"kbd\"\n data-size={size}\n data-slot=\"kbd\"\n data-variant={variant}\n />\n );\n});\n"],"mappings":";;;;;AAcA,MAAa,OAAA,
|
|
1
|
+
{"version":3,"file":"kbd.cjs","names":["forwardRef","cx","kbd"],"sources":["../../../src/components/kbd/kbd.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { kbd } from \"../../styled-system/recipes\";\n\nexport type KbdSize = \"sm\" | \"md\" | \"lg\";\nexport type KbdVariant = \"solid\" | \"outline\" | \"subtle\";\n\nexport interface KbdProps extends ComponentPropsWithoutRef<\"kbd\"> {\n size?: KbdSize;\n variant?: KbdVariant;\n}\n\nexport const Kbd = forwardRef<HTMLElement, KbdProps>(function Kbd(\n { className, size = \"md\", variant = \"subtle\", ...props },\n ref,\n) {\n return (\n <kbd\n {...props}\n ref={ref}\n className={cx(kbd({ size, variant }), className)}\n data-jaci-component=\"kbd\"\n data-size={size}\n data-slot=\"kbd\"\n data-variant={variant}\n />\n );\n});\n"],"mappings":";;;;;AAcA,MAAa,OAAA,GAAMA,MAAAA,WAAAA,CAAkC,SAAS,IAC5D,EAAE,WAAW,OAAO,MAAM,UAAU,UAAU,GAAG,SACjD,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGC,YAAAA,IAAI;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EAC/C,uBAAoB;EACpB,aAAW;EACX,aAAU;EACV,gBAAc;CACf,CAAA;AAEL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["cx","layoutStack","layoutGrid","separator","spinner"],"sources":["../../../src/components/layout/index.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { layoutGrid, layoutStack, separator, spinner } from \"../../styled-system/recipes\";\n\nexport type LayoutGap = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type LayoutAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type LayoutJustify = \"start\" | \"center\" | \"end\" | \"between\";\nexport type LayoutWrap = \"wrap\" | \"nowrap\";\n\nexport interface StackProps extends ComponentPropsWithoutRef<\"div\"> {\n direction?: \"vertical\" | \"horizontal\";\n gap?: LayoutGap;\n align?: LayoutAlign;\n justify?: LayoutJustify;\n wrap?: LayoutWrap;\n}\n\nexport const Stack = forwardRef<HTMLDivElement, StackProps>(function Stack(\n {\n className,\n direction = \"vertical\",\n gap = \"md\",\n align = \"stretch\",\n justify = \"start\",\n wrap = \"nowrap\",\n ...props\n },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(layoutStack({ direction, gap, align, justify, wrap }), className)}\n data-jaci-component=\"stack\"\n data-slot=\"stack\"\n />\n );\n});\n\nexport interface FlexProps extends Omit<StackProps, \"direction\"> {\n direction?: \"horizontal\" | \"vertical\";\n}\n\nexport const Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(\n { direction = \"horizontal\", wrap = \"wrap\", ...props },\n ref,\n) {\n return (\n <Stack {...props} ref={ref} direction={direction} data-jaci-component=\"flex\" wrap={wrap} />\n );\n});\n\nexport interface GridProps extends ComponentPropsWithoutRef<\"div\"> {\n columns?: 1 | 2 | 3 | 4;\n gap?: LayoutGap;\n}\n\nexport const Grid = forwardRef<HTMLDivElement, GridProps>(function Grid(\n { className, columns = 3, gap = \"md\", ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(\n layoutGrid({ columns: String(columns) as \"1\" | \"2\" | \"3\" | \"4\", gap }),\n className,\n )}\n data-jaci-component=\"grid\"\n data-slot=\"grid\"\n />\n );\n});\n\nexport interface SeparatorProps extends Omit<ComponentPropsWithoutRef<\"hr\">, \"orientation\"> {\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nexport const Separator = forwardRef<HTMLHRElement, SeparatorProps>(function Separator(\n { className, orientation = \"horizontal\", ...props },\n ref,\n) {\n return (\n <hr\n {...props}\n aria-orientation={orientation}\n ref={ref}\n className={cx(separator({ orientation }), className)}\n data-jaci-component=\"separator\"\n data-slot=\"separator\"\n />\n );\n});\n\nexport interface SpinnerProps extends Omit<ComponentPropsWithoutRef<\"span\">, \"children\"> {\n label?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n}\n\nexport const Spinner = forwardRef<HTMLSpanElement, SpinnerProps>(function Spinner(\n { className, label = \"Loading\", size = \"md\", ...props },\n ref,\n) {\n return (\n <span\n {...props}\n aria-label={label}\n className={cx(spinner({ size }), className)}\n data-jaci-component=\"spinner\"\n data-slot=\"spinner\"\n ref={ref}\n role=\"status\"\n />\n );\n});\n"],"mappings":";;;;;;;;AAmBA,MAAa,SAAA,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","cx","layoutStack","layoutGrid","separator","spinner"],"sources":["../../../src/components/layout/index.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { layoutGrid, layoutStack, separator, spinner } from \"../../styled-system/recipes\";\n\nexport type LayoutGap = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type LayoutAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type LayoutJustify = \"start\" | \"center\" | \"end\" | \"between\";\nexport type LayoutWrap = \"wrap\" | \"nowrap\";\n\nexport interface StackProps extends ComponentPropsWithoutRef<\"div\"> {\n direction?: \"vertical\" | \"horizontal\";\n gap?: LayoutGap;\n align?: LayoutAlign;\n justify?: LayoutJustify;\n wrap?: LayoutWrap;\n}\n\nexport const Stack = forwardRef<HTMLDivElement, StackProps>(function Stack(\n {\n className,\n direction = \"vertical\",\n gap = \"md\",\n align = \"stretch\",\n justify = \"start\",\n wrap = \"nowrap\",\n ...props\n },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(layoutStack({ direction, gap, align, justify, wrap }), className)}\n data-jaci-component=\"stack\"\n data-slot=\"stack\"\n />\n );\n});\n\nexport interface FlexProps extends Omit<StackProps, \"direction\"> {\n direction?: \"horizontal\" | \"vertical\";\n}\n\nexport const Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(\n { direction = \"horizontal\", wrap = \"wrap\", ...props },\n ref,\n) {\n return (\n <Stack {...props} ref={ref} direction={direction} data-jaci-component=\"flex\" wrap={wrap} />\n );\n});\n\nexport interface GridProps extends ComponentPropsWithoutRef<\"div\"> {\n columns?: 1 | 2 | 3 | 4;\n gap?: LayoutGap;\n}\n\nexport const Grid = forwardRef<HTMLDivElement, GridProps>(function Grid(\n { className, columns = 3, gap = \"md\", ...props },\n ref,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(\n layoutGrid({ columns: String(columns) as \"1\" | \"2\" | \"3\" | \"4\", gap }),\n className,\n )}\n data-jaci-component=\"grid\"\n data-slot=\"grid\"\n />\n );\n});\n\nexport interface SeparatorProps extends Omit<ComponentPropsWithoutRef<\"hr\">, \"orientation\"> {\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nexport const Separator = forwardRef<HTMLHRElement, SeparatorProps>(function Separator(\n { className, orientation = \"horizontal\", ...props },\n ref,\n) {\n return (\n <hr\n {...props}\n aria-orientation={orientation}\n ref={ref}\n className={cx(separator({ orientation }), className)}\n data-jaci-component=\"separator\"\n data-slot=\"separator\"\n />\n );\n});\n\nexport interface SpinnerProps extends Omit<ComponentPropsWithoutRef<\"span\">, \"children\"> {\n label?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n}\n\nexport const Spinner = forwardRef<HTMLSpanElement, SpinnerProps>(function Spinner(\n { className, label = \"Loading\", size = \"md\", ...props },\n ref,\n) {\n return (\n <span\n {...props}\n aria-label={label}\n className={cx(spinner({ size }), className)}\n data-jaci-component=\"spinner\"\n data-slot=\"spinner\"\n ref={ref}\n role=\"status\"\n />\n );\n});\n"],"mappings":";;;;;;;;AAmBA,MAAa,SAAA,GAAQA,MAAAA,WAAAA,CAAuC,SAAS,MACnE,EACE,WACA,YAAY,YACZ,MAAM,MACN,QAAQ,WACR,UAAU,SACV,OAAO,UACP,GAAG,SAEL,KACA;CACA,OAC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;EACZ,WAAWC,WAAAA,GAAGI,gBAAAA,QAAQ,EAAE,KAAK,CAAC,GAAG,SAAS;EAC1C,uBAAoB;EACpB,aAAU;EACL;EACL,MAAK;CACN,CAAA;AAEL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.cjs","names":["list","cx"],"sources":["../../../src/components/list/list.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { list } from \"../../styled-system/recipes\";\n\nexport type ListVariant = \"plain\" | \"divided\" | \"card\";\nexport type ListGap = \"none\" | \"sm\" | \"md\" | \"lg\";\nexport type ListDensity = \"compact\" | \"comfortable\";\n\nexport interface ListRootProps extends Omit<ComponentPropsWithoutRef<\"ul\">, \"children\"> {\n children?: ReactNode;\n density?: ListDensity;\n gap?: ListGap;\n ordered?: boolean;\n variant?: ListVariant;\n}\n\nexport const ListRoot = forwardRef<HTMLElement, ListRootProps>(function ListRoot(\n {\n children,\n className,\n density = \"comfortable\",\n gap = \"md\",\n ordered = false,\n variant = \"plain\",\n ...props\n },\n ref,\n) {\n const styles = list({ density, gap, variant });\n const Component = ordered ? \"ol\" : \"ul\";\n\n return (\n <Component\n {...props}\n ref={ref as never}\n className={cx(styles.root, className)}\n data-gap={gap}\n data-density={density}\n data-jaci-component=\"list\"\n data-ordered={ordered || undefined}\n data-slot=\"list\"\n data-variant={variant}\n >\n {children}\n </Component>\n );\n});\n\nexport interface ListItemProps extends Omit<ComponentPropsWithoutRef<\"li\">, \"children\"> {\n children?: ReactNode;\n disabled?: boolean;\n interactive?: boolean;\n selected?: boolean;\n}\n\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(function ListItem(\n { children, className, disabled = false, interactive = false, selected = false, ...props },\n ref,\n) {\n const styles = list();\n\n return (\n <li\n {...props}\n ref={ref}\n aria-disabled={disabled || undefined}\n className={cx(styles.item, className)}\n data-disabled={disabled || undefined}\n data-interactive={interactive || undefined}\n data-selected={selected || undefined}\n data-slot=\"list-item\"\n >\n {children}\n </li>\n );\n});\n\nexport type ListItemContentProps = ComponentPropsWithoutRef<\"div\">;\nexport const ListItemContent = forwardRef<HTMLDivElement, ListItemContentProps>(\n function ListItemContent({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(list().content, className)}\n data-slot=\"list-item-content\"\n />\n );\n },\n);\n\nexport type ListItemTitleProps = ComponentPropsWithoutRef<\"span\">;\nexport const ListItemTitle = forwardRef<HTMLSpanElement, ListItemTitleProps>(function ListItemTitle(\n { className, ...props },\n ref,\n) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(list().title, className)}\n data-slot=\"list-item-title\"\n />\n );\n});\n\nexport type ListItemDescriptionProps = ComponentPropsWithoutRef<\"span\">;\nexport const ListItemDescription = forwardRef<HTMLSpanElement, ListItemDescriptionProps>(\n function ListItemDescription({ className, ...props }, ref) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(list().description, className)}\n data-slot=\"list-item-description\"\n />\n );\n },\n);\n\nexport type ListItemActionProps = ComponentPropsWithoutRef<\"div\">;\nexport const ListItemAction = forwardRef<HTMLDivElement, ListItemActionProps>(\n function ListItemAction({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(list().action, className)}\n data-slot=\"list-item-action\"\n />\n );\n },\n);\n\nexport const List = {\n Root: ListRoot,\n Item: ListItem,\n ItemContent: ListItemContent,\n ItemTitle: ListItemTitle,\n ItemDescription: ListItemDescription,\n ItemAction: ListItemAction,\n};\n"],"mappings":";;;;;AAkBA,MAAa,YAAA,
|
|
1
|
+
{"version":3,"file":"list.cjs","names":["forwardRef","list","cx"],"sources":["../../../src/components/list/list.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { list } from \"../../styled-system/recipes\";\n\nexport type ListVariant = \"plain\" | \"divided\" | \"card\";\nexport type ListGap = \"none\" | \"sm\" | \"md\" | \"lg\";\nexport type ListDensity = \"compact\" | \"comfortable\";\n\nexport interface ListRootProps extends Omit<ComponentPropsWithoutRef<\"ul\">, \"children\"> {\n children?: ReactNode;\n density?: ListDensity;\n gap?: ListGap;\n ordered?: boolean;\n variant?: ListVariant;\n}\n\nexport const ListRoot = forwardRef<HTMLElement, ListRootProps>(function ListRoot(\n {\n children,\n className,\n density = \"comfortable\",\n gap = \"md\",\n ordered = false,\n variant = \"plain\",\n ...props\n },\n ref,\n) {\n const styles = list({ density, gap, variant });\n const Component = ordered ? \"ol\" : \"ul\";\n\n return (\n <Component\n {...props}\n ref={ref as never}\n className={cx(styles.root, className)}\n data-gap={gap}\n data-density={density}\n data-jaci-component=\"list\"\n data-ordered={ordered || undefined}\n data-slot=\"list\"\n data-variant={variant}\n >\n {children}\n </Component>\n );\n});\n\nexport interface ListItemProps extends Omit<ComponentPropsWithoutRef<\"li\">, \"children\"> {\n children?: ReactNode;\n disabled?: boolean;\n interactive?: boolean;\n selected?: boolean;\n}\n\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(function ListItem(\n { children, className, disabled = false, interactive = false, selected = false, ...props },\n ref,\n) {\n const styles = list();\n\n return (\n <li\n {...props}\n ref={ref}\n aria-disabled={disabled || undefined}\n className={cx(styles.item, className)}\n data-disabled={disabled || undefined}\n data-interactive={interactive || undefined}\n data-selected={selected || undefined}\n data-slot=\"list-item\"\n >\n {children}\n </li>\n );\n});\n\nexport type ListItemContentProps = ComponentPropsWithoutRef<\"div\">;\nexport const ListItemContent = forwardRef<HTMLDivElement, ListItemContentProps>(\n function ListItemContent({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(list().content, className)}\n data-slot=\"list-item-content\"\n />\n );\n },\n);\n\nexport type ListItemTitleProps = ComponentPropsWithoutRef<\"span\">;\nexport const ListItemTitle = forwardRef<HTMLSpanElement, ListItemTitleProps>(function ListItemTitle(\n { className, ...props },\n ref,\n) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(list().title, className)}\n data-slot=\"list-item-title\"\n />\n );\n});\n\nexport type ListItemDescriptionProps = ComponentPropsWithoutRef<\"span\">;\nexport const ListItemDescription = forwardRef<HTMLSpanElement, ListItemDescriptionProps>(\n function ListItemDescription({ className, ...props }, ref) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(list().description, className)}\n data-slot=\"list-item-description\"\n />\n );\n },\n);\n\nexport type ListItemActionProps = ComponentPropsWithoutRef<\"div\">;\nexport const ListItemAction = forwardRef<HTMLDivElement, ListItemActionProps>(\n function ListItemAction({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(list().action, className)}\n data-slot=\"list-item-action\"\n />\n );\n },\n);\n\nexport const List = {\n Root: ListRoot,\n Item: ListItem,\n ItemContent: ListItemContent,\n ItemTitle: ListItemTitle,\n ItemDescription: ListItemDescription,\n ItemAction: ListItemAction,\n};\n"],"mappings":";;;;;AAkBA,MAAa,YAAA,GAAWA,MAAAA,WAAAA,CAAuC,SAAS,SACtE,EACE,UACA,WACA,UAAU,eACV,MAAM,MACN,UAAU,OACV,UAAU,SACV,GAAG,SAEL,KACA;CACA,MAAM,SAASC,aAAAA,KAAK;EAAE;EAAS;EAAK;CAAQ,CAAC;CAG7C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAHgB,UAAU,OAAO,MAGjC;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,YAAU;EACV,gBAAc;EACd,uBAAoB;EACpB,gBAAc,WAAW,KAAA;EACzB,aAAU;EACV,gBAAc;EAEb;CACQ,CAAA;AAEf,CAAC;AASD,MAAa,YAAA,GAAWF,MAAAA,WAAAA,CAAyC,SAAS,SACxE,EAAE,UAAU,WAAW,WAAW,OAAO,cAAc,OAAO,WAAW,OAAO,GAAG,SACnF,KACA;CACA,MAAM,SAASC,aAAAA,KAAK;CAEpB,O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EACtC,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,OAAO;CAClB,MAAM;CACN,MAAM;CACN,aAAa;CACb,WAAW;CACX,iBAAiB;CACjB,YAAY;AACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.cjs","names":["BaseMenu","withRecipeClassName","menu","useThemePortalProps"],"sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { MenuRoot as BaseMenuRoot, MenuTrigger as BaseMenuTrigger } from \"@base-ui/react/menu\";\n\nimport { menu } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\n/**\n * Groups the menu parts. It keeps Base UI's controlled `open`/\n * `onOpenChange` API and uncontrolled `defaultOpen` API intact.\n */\nexport type MenuRootProps<Payload = unknown> = BaseMenuRoot.Props<Payload>;\n\nexport function MenuRoot<Payload = unknown>(props: MenuRootProps<Payload>) {\n return <BaseMenu.Root {...props} />;\n}\n\nexport type MenuTriggerProps<Payload = unknown> = BaseMenuTrigger.Props<Payload>;\n\nexport const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().trigger, className)}\n data-jaci-component=\"menu\"\n data-slot=\"menu-trigger\"\n />\n );\n});\n\n/** Preserves Base UI's portal and optional container APIs. */\nexport function MenuPortal(props: ComponentPropsWithoutRef<typeof BaseMenu.Portal>) {\n return <BaseMenu.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type MenuPositionerProps = ComponentPropsWithoutRef<typeof BaseMenu.Positioner>;\n\nexport const MenuPositioner = forwardRef<HTMLDivElement, MenuPositionerProps>(\n function MenuPositioner({ className, ...props }, ref) {\n return (\n <BaseMenu.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().positioner, className)}\n data-slot=\"menu-positioner\"\n />\n );\n },\n);\n\nexport type MenuPopupProps = ComponentPropsWithoutRef<typeof BaseMenu.Popup>;\n\nexport const MenuPopup = forwardRef<HTMLDivElement, MenuPopupProps>(function MenuPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().popup, className)}\n data-slot=\"menu-popup\"\n />\n );\n});\n\nexport type MenuItemProps = ComponentPropsWithoutRef<typeof BaseMenu.Item>;\n\nexport const MenuItem = forwardRef<HTMLElement, MenuItemProps>(function MenuItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-item\"\n />\n );\n});\n\nexport type MenuLinkItemProps = ComponentPropsWithoutRef<typeof BaseMenu.LinkItem>;\n\n/**\n * A navigational item. It retains Base UI's keyboard navigation.\n */\nexport const MenuLinkItem = forwardRef<Element, MenuLinkItemProps>(function MenuLinkItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.LinkItem\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-link-item\"\n />\n );\n});\n\nexport type MenuSeparatorProps = ComponentPropsWithoutRef<typeof BaseMenu.Separator>;\n\nexport const MenuSeparator = forwardRef<HTMLDivElement, MenuSeparatorProps>(function MenuSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Separator\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().separator, className)}\n data-slot=\"menu-separator\"\n />\n );\n});\n\nexport type MenuGroupProps = ComponentPropsWithoutRef<typeof BaseMenu.Group>;\n\nexport const MenuGroup = forwardRef<HTMLDivElement, MenuGroupProps>(function MenuGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().group, className)}\n data-slot=\"menu-group\"\n />\n );\n});\n\nexport type MenuGroupLabelProps = ComponentPropsWithoutRef<typeof BaseMenu.GroupLabel>;\n\nexport const MenuGroupLabel = forwardRef<HTMLDivElement, MenuGroupLabelProps>(\n function MenuGroupLabel({ className, ...props }, ref) {\n return (\n <BaseMenu.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().groupLabel, className)}\n data-slot=\"menu-group-label\"\n />\n );\n },\n);\n\nexport const Menu = {\n Root: MenuRoot,\n Trigger: MenuTrigger,\n Portal: MenuPortal,\n Positioner: MenuPositioner,\n Popup: MenuPopup,\n Item: MenuItem,\n LinkItem: MenuLinkItem,\n Separator: MenuSeparator,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n createHandle: BaseMenu.createHandle,\n};\n"],"mappings":";;;;;;;;AAiBA,SAAgB,SAA4B,OAA+B;CACzE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,KAAS,MAAV,EAAe,GAAI,MAAQ,CAAA;AACpC;AAIA,MAAa,eAAA,
|
|
1
|
+
{"version":3,"file":"menu.cjs","names":["BaseMenu","forwardRef","withRecipeClassName","menu","useThemePortalProps"],"sources":["../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { MenuRoot as BaseMenuRoot, MenuTrigger as BaseMenuTrigger } from \"@base-ui/react/menu\";\n\nimport { menu } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\n/**\n * Groups the menu parts. It keeps Base UI's controlled `open`/\n * `onOpenChange` API and uncontrolled `defaultOpen` API intact.\n */\nexport type MenuRootProps<Payload = unknown> = BaseMenuRoot.Props<Payload>;\n\nexport function MenuRoot<Payload = unknown>(props: MenuRootProps<Payload>) {\n return <BaseMenu.Root {...props} />;\n}\n\nexport type MenuTriggerProps<Payload = unknown> = BaseMenuTrigger.Props<Payload>;\n\nexport const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().trigger, className)}\n data-jaci-component=\"menu\"\n data-slot=\"menu-trigger\"\n />\n );\n});\n\n/** Preserves Base UI's portal and optional container APIs. */\nexport function MenuPortal(props: ComponentPropsWithoutRef<typeof BaseMenu.Portal>) {\n return <BaseMenu.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type MenuPositionerProps = ComponentPropsWithoutRef<typeof BaseMenu.Positioner>;\n\nexport const MenuPositioner = forwardRef<HTMLDivElement, MenuPositionerProps>(\n function MenuPositioner({ className, ...props }, ref) {\n return (\n <BaseMenu.Positioner\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().positioner, className)}\n data-slot=\"menu-positioner\"\n />\n );\n },\n);\n\nexport type MenuPopupProps = ComponentPropsWithoutRef<typeof BaseMenu.Popup>;\n\nexport const MenuPopup = forwardRef<HTMLDivElement, MenuPopupProps>(function MenuPopup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Popup\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().popup, className)}\n data-slot=\"menu-popup\"\n />\n );\n});\n\nexport type MenuItemProps = ComponentPropsWithoutRef<typeof BaseMenu.Item>;\n\nexport const MenuItem = forwardRef<HTMLElement, MenuItemProps>(function MenuItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Item\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-item\"\n />\n );\n});\n\nexport type MenuLinkItemProps = ComponentPropsWithoutRef<typeof BaseMenu.LinkItem>;\n\n/**\n * A navigational item. It retains Base UI's keyboard navigation.\n */\nexport const MenuLinkItem = forwardRef<Element, MenuLinkItemProps>(function MenuLinkItem(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.LinkItem\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().item, className)}\n data-slot=\"menu-link-item\"\n />\n );\n});\n\nexport type MenuSeparatorProps = ComponentPropsWithoutRef<typeof BaseMenu.Separator>;\n\nexport const MenuSeparator = forwardRef<HTMLDivElement, MenuSeparatorProps>(function MenuSeparator(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Separator\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().separator, className)}\n data-slot=\"menu-separator\"\n />\n );\n});\n\nexport type MenuGroupProps = ComponentPropsWithoutRef<typeof BaseMenu.Group>;\n\nexport const MenuGroup = forwardRef<HTMLDivElement, MenuGroupProps>(function MenuGroup(\n { className, ...props },\n ref,\n) {\n return (\n <BaseMenu.Group\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().group, className)}\n data-slot=\"menu-group\"\n />\n );\n});\n\nexport type MenuGroupLabelProps = ComponentPropsWithoutRef<typeof BaseMenu.GroupLabel>;\n\nexport const MenuGroupLabel = forwardRef<HTMLDivElement, MenuGroupLabelProps>(\n function MenuGroupLabel({ className, ...props }, ref) {\n return (\n <BaseMenu.GroupLabel\n {...props}\n ref={ref}\n className={withRecipeClassName(menu().groupLabel, className)}\n data-slot=\"menu-group-label\"\n />\n );\n },\n);\n\nexport const Menu = {\n Root: MenuRoot,\n Trigger: MenuTrigger,\n Portal: MenuPortal,\n Positioner: MenuPositioner,\n Popup: MenuPopup,\n Item: MenuItem,\n LinkItem: MenuLinkItem,\n Separator: MenuSeparator,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n createHandle: BaseMenu.createHandle,\n};\n"],"mappings":";;;;;;;;AAiBA,SAAgB,SAA4B,OAA+B;CACzE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,KAAS,MAAV,EAAe,GAAI,MAAQ,CAAA;AACpC;AAIA,MAAa,eAAA,GAAcC,MAAAA,WAAAA,CAAgD,SAAS,YAClF,EA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