@proyecto-viviana/solidaria-components 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar.js +2 -11
- package/dist/ActionBar.js.map +1 -1
- package/dist/ActionBar.jsx +2 -11
- package/dist/ActionBar.jsx.map +1 -1
- package/dist/ActionGroup.d.ts.map +1 -1
- package/dist/ActionGroup.js +1 -1
- package/dist/ActionGroup.js.map +1 -1
- package/dist/ActionGroup.jsx +1 -1
- package/dist/ActionGroup.jsx.map +1 -1
- package/dist/Autocomplete.d.ts +2 -2
- package/dist/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete.js +7 -7
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Autocomplete.jsx +7 -7
- package/dist/Autocomplete.jsx.map +1 -1
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +18 -18
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Breadcrumbs.jsx +21 -26
- package/dist/Breadcrumbs.jsx.map +1 -1
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +100 -65
- package/dist/Calendar.js.map +1 -1
- package/dist/Calendar.jsx +10 -1
- package/dist/Calendar.jsx.map +1 -1
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +15 -18
- package/dist/Color.js.map +1 -1
- package/dist/Color.jsx +15 -19
- package/dist/Color.jsx.map +1 -1
- package/dist/ComboBox.d.ts +4 -0
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +21 -13
- package/dist/ComboBox.js.map +1 -1
- package/dist/ComboBox.jsx +23 -13
- package/dist/ComboBox.jsx.map +1 -1
- package/dist/DateField.d.ts +11 -2
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField2.js +237 -234
- package/dist/DateField2.js.map +1 -1
- package/dist/DateField2.jsx +134 -97
- package/dist/DateField2.jsx.map +1 -1
- package/dist/DatePicker.d.ts +42 -3
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +6 -990
- package/dist/DatePicker.jsx +6 -681
- package/dist/DatePicker2.js +1171 -0
- package/dist/DatePicker2.js.map +1 -0
- package/dist/DatePicker2.jsx +820 -0
- package/dist/DatePicker2.jsx.map +1 -0
- package/dist/DateRangePickerContext.d.ts +2 -0
- package/dist/DateRangePickerContext.d.ts.map +1 -1
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +3 -0
- package/dist/Disclosure.js.map +1 -1
- package/dist/Disclosure.jsx +1 -1
- package/dist/Disclosure.jsx.map +1 -1
- package/dist/ElementTag.d.ts +29 -0
- package/dist/ElementTag.d.ts.map +1 -0
- package/dist/ElementTag.js +220 -0
- package/dist/ElementTag.js.map +1 -0
- package/dist/ElementTag.jsx +67 -0
- package/dist/ElementTag.jsx.map +1 -0
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +2 -2
- package/dist/GridList.js.map +1 -1
- package/dist/GridList.jsx +2 -2
- package/dist/GridList.jsx.map +1 -1
- package/dist/Landmark.js +4 -3
- package/dist/Landmark.js.map +1 -1
- package/dist/Landmark.jsx +3 -3
- package/dist/Landmark.jsx.map +1 -1
- package/dist/Link.js +3 -2
- package/dist/Link.js.map +1 -1
- package/dist/Link.jsx +3 -3
- package/dist/Link.jsx.map +1 -1
- package/dist/ListBox.d.ts +2 -2
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +327 -166
- package/dist/ListBox.js.map +1 -1
- package/dist/ListBox.jsx +161 -25
- package/dist/ListBox.jsx.map +1 -1
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +7 -5
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.jsx +5 -5
- package/dist/Modal.jsx.map +1 -1
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +16 -9
- package/dist/Popover.js.map +1 -1
- package/dist/Popover.jsx +25 -4
- package/dist/Popover.jsx.map +1 -1
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +182 -46
- package/dist/RangeCalendar.js.map +1 -1
- package/dist/RangeCalendar.jsx +72 -2
- package/dist/RangeCalendar.jsx.map +1 -1
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +26 -2
- package/dist/SearchField.js.map +1 -1
- package/dist/SearchField.jsx +26 -2
- package/dist/SearchField.jsx.map +1 -1
- package/dist/Select.d.ts +7 -0
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +64 -51
- package/dist/Select.js.map +1 -1
- package/dist/Select.jsx +35 -20
- package/dist/Select.jsx.map +1 -1
- package/dist/Separator.js +3 -2
- package/dist/Separator.js.map +1 -1
- package/dist/Separator.jsx +2 -2
- package/dist/Separator.jsx.map +1 -1
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +35 -33
- package/dist/SharedElementTransition.js.map +1 -1
- package/dist/SharedElementTransition.jsx +35 -33
- package/dist/SharedElementTransition.jsx.map +1 -1
- package/dist/StepList.d.ts.map +1 -1
- package/dist/StepList.js +2 -9
- package/dist/StepList.js.map +1 -1
- package/dist/StepList.jsx +1 -6
- package/dist/StepList.jsx.map +1 -1
- package/dist/Table.d.ts +2 -0
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +10 -3
- package/dist/Table.js.map +1 -1
- package/dist/Table.jsx +10 -3
- package/dist/Table.jsx.map +1 -1
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +3 -0
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.jsx +1 -1
- package/dist/Tabs.jsx.map +1 -1
- package/dist/TagGroup.d.ts +3 -1
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +12 -8
- package/dist/TagGroup.js.map +1 -1
- package/dist/TagGroup.jsx +11 -8
- package/dist/TagGroup.jsx.map +1 -1
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +9 -8
- package/dist/Text.js.map +1 -1
- package/dist/Text.jsx +3 -3
- package/dist/Text.jsx.map +1 -1
- package/dist/TextField.js +4 -1
- package/dist/TextField.js.map +1 -1
- package/dist/TextField.jsx +4 -1
- package/dist/TextField.jsx.map +1 -1
- package/dist/TimeField.d.ts +14 -50
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +111 -205
- package/dist/TimeField.js.map +1 -1
- package/dist/TimeField.jsx +76 -82
- package/dist/TimeField.jsx.map +1 -1
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +3 -3
- package/dist/Tree.js.map +1 -1
- package/dist/Tree.jsx +3 -3
- package/dist/Tree.jsx.map +1 -1
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +3 -11
- package/dist/VisuallyHidden.js.map +1 -1
- package/dist/VisuallyHidden.jsx +3 -4
- package/dist/VisuallyHidden.jsx.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.jsx +6 -6
- package/dist/useDragAndDrop.d.ts +0 -8
- package/dist/useDragAndDrop.d.ts.map +1 -1
- package/dist/useDragAndDrop2.js +6 -2
- package/dist/useDragAndDrop2.js.map +1 -1
- package/dist/useDragAndDrop2.jsx +6 -2
- package/dist/useDragAndDrop2.jsx.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/dist/utils.jsx +2 -2
- package/dist/utils.jsx.map +1 -1
- package/package.json +3 -9
- package/src/ActionBar.tsx +10 -12
- package/src/ActionGroup.tsx +5 -3
- package/src/Autocomplete.tsx +14 -9
- package/src/Breadcrumbs.tsx +57 -42
- package/src/Calendar.tsx +30 -1
- package/src/Color.tsx +42 -27
- package/src/ComboBox.tsx +49 -17
- package/src/DateField.tsx +285 -52
- package/src/DatePicker.tsx +345 -57
- package/src/DateRangePickerContext.tsx +2 -0
- package/src/Disclosure.tsx +4 -0
- package/src/ElementTag.tsx +116 -0
- package/src/GridList.tsx +8 -2
- package/src/Landmark.tsx +4 -4
- package/src/Link.tsx +4 -4
- package/src/ListBox.tsx +323 -21
- package/src/Modal.tsx +21 -5
- package/src/Popover.tsx +28 -7
- package/src/RangeCalendar.tsx +120 -1
- package/src/SearchField.tsx +53 -1
- package/src/Select.tsx +114 -22
- package/src/Separator.tsx +3 -3
- package/src/SharedElementTransition.tsx +92 -36
- package/src/StepList.tsx +0 -7
- package/src/Table.tsx +19 -4
- package/src/Tabs.tsx +1 -0
- package/src/TagGroup.tsx +26 -6
- package/src/Text.tsx +5 -4
- package/src/TextField.tsx +1 -1
- package/src/TimeField.tsx +113 -196
- package/src/Tree.tsx +14 -4
- package/src/VisuallyHidden.tsx +8 -12
- package/src/index.ts +3 -8
- package/src/useDragAndDrop.ts +8 -10
- package/src/utils.tsx +3 -3
- package/dist/DatePicker.js.map +0 -1
- package/dist/DatePicker.jsx.map +0 -1
- package/dist/HiddenTimeInput.d.ts +0 -25
- package/dist/HiddenTimeInput.d.ts.map +0 -1
- package/dist/HiddenTimeInput.js +0 -104
- package/dist/HiddenTimeInput.js.map +0 -1
- package/dist/HiddenTimeInput.jsx +0 -69
- package/dist/HiddenTimeInput.jsx.map +0 -1
- package/src/HiddenTimeInput.tsx +0 -133
package/dist/TextField.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.jsx","names":["mergeProps"],"sources":["../src/TextField.tsx"],"sourcesContent":["/**\n * TextField component for solidaria-components\n *\n * A pre-wired headless text field that combines state + aria hooks.\n * Port of react-aria-components/src/TextField.tsx\n */\n\nimport {\n type JSX,\n type Context,\n createContext,\n useContext,\n createMemo,\n createSignal,\n createEffect,\n onCleanup,\n onMount,\n splitProps,\n untrack,\n} from \"solid-js\";\nimport {\n createTextField,\n createFocusRing,\n createHover,\n mergeProps,\n type AriaTextFieldProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createTextFieldState,\n VALID_VALIDITY_STATE,\n type ValidationResult,\n} from \"@proyecto-viviana/solid-stately\";\nimport { FormContext, type FormProps } from \"./Form\";\nimport { FieldErrorContext, type FieldErrorContextValue } from \"./FieldError\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n Provider,\n} from \"./utils\";\nimport { TextContext } from \"./Text\";\n\nexport interface TextFieldRenderProps {\n /** Whether the text field is disabled. */\n isDisabled: boolean;\n /** Whether the value is invalid. */\n isInvalid: boolean;\n /** Whether the text field is read only. */\n isReadOnly: boolean;\n /** Whether the text field is required. */\n isRequired: boolean;\n /** Whether the text field is currently hovered with a mouse. */\n isHovered: boolean;\n /** Whether the text field is focused, either via a mouse or keyboard. */\n isFocused: boolean;\n /** Whether the text field is keyboard focused. */\n isFocusVisible: boolean;\n}\n\nexport interface TextFieldProps extends Omit<AriaTextFieldProps, \"children\">, SlotProps {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<TextFieldRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TextFieldRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TextFieldRenderProps>;\n /** Custom renderer for the outer text field element. */\n render?: (\n props: JSX.HTMLAttributes<HTMLDivElement>,\n renderProps: TextFieldRenderProps,\n ) => JSX.Element;\n}\n\nexport interface TextFieldContextValue {\n labelProps?: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n inputProps?: JSX.InputHTMLAttributes<HTMLInputElement>;\n descriptionProps?: JSX.HTMLAttributes<HTMLElement>;\n errorMessageProps?: JSX.HTMLAttributes<HTMLElement>;\n isInvalid?: boolean;\n slots?: Record<string, TextFieldProps>;\n inputId?: string;\n setInputId?: (id: string | undefined) => void;\n}\n\nexport const TextFieldContext = createContext<TextFieldContextValue | null>(null);\nexport const LabelContext = TextFieldContext;\nexport const InputContext = TextFieldContext;\nexport const TextAreaContext = TextFieldContext;\nexport const FieldInputContext = TextFieldContext;\n\nfunction withFormValidationBehavior(\n props: TextFieldProps,\n formContext: FormProps | null,\n): TextFieldProps {\n if (!formContext?.validationBehavior) {\n return props;\n }\n\n return new Proxy(props, {\n get(target, property, receiver) {\n const localValue = Reflect.get(target, property, receiver);\n if (property === \"validationBehavior\" && localValue === undefined) {\n return formContext.validationBehavior;\n }\n\n return localValue;\n },\n has(target, property) {\n return (\n Reflect.has(target, property) ||\n (property === \"validationBehavior\" && formContext.validationBehavior !== undefined)\n );\n },\n ownKeys(target) {\n const keys = new Set(Reflect.ownKeys(target));\n if (formContext.validationBehavior !== undefined) {\n keys.add(\"validationBehavior\");\n }\n\n return Array.from(keys);\n },\n getOwnPropertyDescriptor(target, property) {\n const descriptor = Reflect.getOwnPropertyDescriptor(target, property);\n if (descriptor) {\n return descriptor;\n }\n\n if (property === \"validationBehavior\" && formContext.validationBehavior !== undefined) {\n return {\n enumerable: true,\n configurable: true,\n get: () => formContext.validationBehavior,\n };\n }\n\n return undefined;\n },\n });\n}\n\nexport interface LabelProps extends JSX.LabelHTMLAttributes<HTMLLabelElement> {\n children?: JSX.Element;\n}\n\n/**\n * A label element that automatically wires up to the parent TextField context.\n * This enables the proper htmlFor/id relationship between label and input.\n */\nexport function Label(props: LabelProps): JSX.Element {\n const context = useContext(TextFieldContext);\n\n const localDOMProps = () => {\n const result: Record<string, unknown> = {};\n const propsRecord = props as Record<string, unknown>;\n\n for (const key in propsRecord) {\n if (key !== \"children\") {\n result[key] = propsRecord[key];\n }\n }\n return result;\n };\n\n // Merge context labelProps with local props (local props take precedence)\n const mergedProps = () => {\n const localProps = localDOMProps();\n if (context) {\n const { ref: _ref, ...contextLabelProps } = (context.labelProps ?? {}) as Record<\n string,\n unknown\n >;\n const merged = {\n ...contextLabelProps,\n ...(context.inputId ? { for: context.inputId } : {}),\n ...localProps,\n } as Record<string, unknown>;\n if (merged.class == null) {\n merged.class = \"solidaria-Label\";\n }\n return merged;\n }\n return localProps.class == null ? { ...localProps, class: \"solidaria-Label\" } : localProps;\n };\n\n return <label {...mergedProps()}>{props.children}</label>;\n}\n\nexport interface InputProps extends Omit<JSX.InputHTMLAttributes<HTMLInputElement>, \"children\"> {}\n\nfunction eventWithCurrentTarget<T extends HTMLElement>(event: Event, element: T): Event {\n return new Proxy(event, {\n get(target, property, receiver) {\n if (property === \"target\" || property === \"currentTarget\") {\n return element;\n }\n\n const value = Reflect.get(target, property, receiver);\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\nfunction clearDelegatedTextEntryHandlers(element: HTMLElement) {\n const delegatedElement = element as HTMLElement & {\n $$input?: unknown;\n $$change?: unknown;\n };\n delete delegatedElement.$$input;\n delete delegatedElement.$$change;\n}\n\n/**\n * An input element that automatically wires up to the parent TextField context.\n * This enables focus tracking, validation, and accessibility props to flow from\n * the TextField to the actual input element.\n */\nexport function Input(props: InputProps): JSX.Element {\n const context = useContext(TextFieldContext);\n let inputElement: HTMLInputElement | undefined;\n\n createEffect(() => {\n context?.setInputId?.(props.id);\n });\n\n onCleanup(() => {\n context?.setInputId?.(undefined);\n });\n\n // Merge context inputProps with local props (local props take precedence)\n const mergedProps = () => {\n if (context) {\n // Remove ref from context props to avoid conflicts\n const { ref: _ref, ...contextInputProps } = (context.inputProps ?? {}) as Record<\n string,\n unknown\n >;\n const merged = { ...contextInputProps, ...props } as Record<string, unknown>;\n if (merged.class == null) {\n merged.class = \"solidaria-Input\";\n }\n return merged;\n }\n return props.class == null ? { ...props, class: \"solidaria-Input\" } : props;\n };\n\n onMount(() => {\n const element = inputElement;\n if (!element) {\n return;\n }\n\n const inputHandler = (event: Event) => {\n const handler = mergedProps().onInput as\n | JSX.EventHandler<HTMLInputElement, InputEvent>\n | undefined;\n handler?.(\n eventWithCurrentTarget(event, element) as InputEvent & {\n currentTarget: HTMLInputElement;\n target: Element;\n },\n );\n clearDelegatedTextEntryHandlers(element);\n event.stopPropagation();\n };\n const changeHandler = (event: Event) => {\n const handler = mergedProps().onChange as\n | JSX.EventHandler<HTMLInputElement, Event>\n | undefined;\n handler?.(\n eventWithCurrentTarget(event, element) as Event & {\n currentTarget: HTMLInputElement;\n target: Element;\n },\n );\n clearDelegatedTextEntryHandlers(element);\n event.stopPropagation();\n };\n\n element.addEventListener(\"input\", inputHandler);\n element.addEventListener(\"change\", changeHandler);\n clearDelegatedTextEntryHandlers(element);\n onCleanup(() => {\n element.removeEventListener(\"input\", inputHandler);\n element.removeEventListener(\"change\", changeHandler);\n });\n });\n\n return (\n <input\n {...mergedProps()}\n ref={(element) => {\n inputElement = element;\n const ref = props.ref;\n if (typeof ref === \"function\") {\n ref(element);\n }\n }}\n />\n );\n}\n\nexport interface TextAreaProps extends Omit<\n JSX.TextareaHTMLAttributes<HTMLTextAreaElement>,\n \"children\"\n> {}\n\n/**\n * A textarea element that automatically wires up to the parent TextField context.\n * This enables focus tracking, validation, and accessibility props to flow from\n * the TextField to the actual textarea element.\n */\nexport function TextArea(props: TextAreaProps): JSX.Element {\n const context = useContext(TextFieldContext);\n let textAreaElement: HTMLTextAreaElement | undefined;\n\n createEffect(() => {\n context?.setInputId?.(props.id);\n });\n\n onCleanup(() => {\n context?.setInputId?.(undefined);\n });\n\n // Merge context inputProps with local props (local props take precedence)\n // Note: TextArea uses inputProps from context since it's an input variant\n const mergedProps = () => {\n if (context) {\n const {\n ref: _ref,\n type: _type,\n ...contextInputProps\n } = (context.inputProps ?? {}) as Record<string, unknown>;\n const merged = { ...contextInputProps, ...props } as Record<string, unknown>;\n if (merged.class == null) {\n merged.class = \"solidaria-TextArea\";\n }\n return merged;\n }\n return props.class == null ? { ...props, class: \"solidaria-TextArea\" } : props;\n };\n\n onMount(() => {\n const element = textAreaElement;\n if (!element) {\n return;\n }\n\n const inputHandler = (event: Event) => {\n const handler = mergedProps().onInput as\n | JSX.EventHandler<HTMLTextAreaElement, InputEvent>\n | undefined;\n handler?.(\n eventWithCurrentTarget(event, element) as InputEvent & {\n currentTarget: HTMLTextAreaElement;\n target: Element;\n },\n );\n clearDelegatedTextEntryHandlers(element);\n event.stopPropagation();\n };\n const changeHandler = (event: Event) => {\n const handler = mergedProps().onChange as\n | JSX.EventHandler<HTMLTextAreaElement, Event>\n | undefined;\n handler?.(\n eventWithCurrentTarget(event, element) as Event & {\n currentTarget: HTMLTextAreaElement;\n target: Element;\n },\n );\n clearDelegatedTextEntryHandlers(element);\n event.stopPropagation();\n };\n\n element.addEventListener(\"input\", inputHandler);\n element.addEventListener(\"change\", changeHandler);\n clearDelegatedTextEntryHandlers(element);\n onCleanup(() => {\n element.removeEventListener(\"input\", inputHandler);\n element.removeEventListener(\"change\", changeHandler);\n });\n });\n\n return (\n <textarea\n {...mergedProps()}\n ref={(element) => {\n textAreaElement = element;\n const ref = props.ref;\n if (typeof ref === \"function\") {\n ref(element);\n }\n }}\n />\n );\n}\n\n/**\n * A text field allows a user to enter a plain text value with a keyboard.\n *\n * This is a headless component that provides accessibility and state management.\n * Style it using the render props pattern or data attributes.\n *\n * @example\n * ```tsx\n * <TextField>\n * {({ isInvalid }) => (\n * <>\n * <Label>Email</Label>\n * <Input class={isInvalid ? 'border-red-500' : 'border-gray-300'} />\n * </>\n * )}\n * </TextField>\n * ```\n */\nexport function TextField(props: TextFieldProps): JSX.Element {\n const formContext = useContext(FormContext);\n const contextProps = useContext(TextFieldContext);\n const contextSlotProps = contextProps?.slots?.[props.slot ?? \"default\"];\n const contextBaseProps = createMemo<TextFieldProps>(() => {\n if (!contextProps) return {};\n const {\n labelProps: _labelProps,\n inputProps: _inputProps,\n descriptionProps: _descriptionProps,\n errorMessageProps: _errorMessageProps,\n isInvalid: _isInvalid,\n slots: _slots,\n setInputId: _setInputId,\n ...rest\n } = contextProps;\n return rest as TextFieldProps;\n });\n const baseProps = (\n contextProps ? mergeProps(contextBaseProps(), contextSlotProps ?? {}, props) : props\n ) as TextFieldProps;\n const mergedProps = withFormValidationBehavior(baseProps, formContext);\n\n const [local, ariaProps] = splitProps(mergedProps, [\n \"children\",\n \"class\",\n \"style\",\n \"render\",\n \"slot\",\n ]);\n\n // Use getters to ensure props are read lazily inside reactive contexts\n const state = createTextFieldState({\n get value() {\n return ariaProps.value;\n },\n get defaultValue() {\n return ariaProps.defaultValue;\n },\n get onChange() {\n return ariaProps.onChange;\n },\n });\n\n const inputAriaProps = createMemo(() => {\n const clean: Record<string, unknown> = {};\n for (const key in ariaProps as Record<string, unknown>) {\n if (!key.startsWith(\"data-\")) {\n clean[key] = (ariaProps as Record<string, unknown>)[key];\n }\n }\n return clean as typeof ariaProps;\n });\n\n const textFieldAria = createTextField(() => ({\n ...inputAriaProps(),\n value: state.value(),\n onChange: state.setValue,\n }));\n\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return ariaProps.isDisabled;\n },\n });\n const [inputIdOverride, setInputIdOverride] = createSignal<string | undefined>();\n\n const renderValues = createMemo<TextFieldRenderProps>(() => ({\n isDisabled: ariaProps.isDisabled || false,\n isInvalid: textFieldAria.isInvalid,\n isReadOnly: ariaProps.isReadOnly || false,\n isRequired: ariaProps.isRequired || false,\n isHovered: isHovered(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TextField\",\n },\n renderValues,\n );\n const childRenderValues: TextFieldRenderProps = {\n get isDisabled() {\n return ariaProps.isDisabled || false;\n },\n get isInvalid() {\n return textFieldAria.isInvalid;\n },\n get isReadOnly() {\n return ariaProps.isReadOnly || false;\n },\n get isRequired() {\n return ariaProps.isRequired || false;\n },\n get isHovered() {\n return isHovered();\n },\n get isFocused() {\n return isFocused();\n },\n get isFocusVisible() {\n return isFocusVisible();\n },\n };\n\n const domProps = createMemo(() => {\n const filtered = filterDOMProps(ariaProps, { global: true });\n delete (filtered as Record<string, unknown>).id;\n return filtered;\n });\n\n const cleanHoverProps = () => {\n const { ref: _ref, ...rest } = hoverProps as Record<string, unknown>;\n return rest;\n };\n\n // Context value for sub-components.\n // Use property getters so sub-components always read the latest aria/focus state.\n const fieldValidation = createMemo<ValidationResult>(() => {\n const isInvalid = textFieldAria.isInvalid;\n const errorMessage = ariaProps.errorMessage;\n const validationErrors = isInvalid && typeof errorMessage === \"string\" ? [errorMessage] : [];\n\n return {\n isInvalid,\n validationErrors,\n validationDetails: isInvalid\n ? { ...VALID_VALIDITY_STATE, customError: true, valid: false }\n : VALID_VALIDITY_STATE,\n };\n });\n const fieldErrorContext: FieldErrorContextValue = {\n get validation() {\n return fieldValidation();\n },\n get errorMessageProps() {\n return textFieldAria.errorMessageProps as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n const contextValue: TextFieldContextValue = {\n get labelProps() {\n return textFieldAria.labelProps as JSX.LabelHTMLAttributes<HTMLLabelElement>;\n },\n get inputProps() {\n return mergeProps(\n textFieldAria.inputProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n ) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get descriptionProps() {\n return textFieldAria.descriptionProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessageProps() {\n return textFieldAria.errorMessageProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get isInvalid() {\n return textFieldAria.isInvalid;\n },\n // Deterministic at render (createTextField generates it via createUniqueId),\n // so the Label's `for` is stable across SSR + hydration. A signal set from an\n // onMount effect would flip undefined->id post-mount and re-execute the Label\n // template — crashing hydration if the re-run lands mid-hydration (dev).\n get inputId() {\n return inputIdOverride() ?? (textFieldAria.inputProps as { id?: string }).id;\n },\n setInputId(id: string | undefined) {\n setInputIdOverride(id);\n },\n };\n // Resolve the render-prop children ONCE (untracked). Re-invoking it on a\n // reactive update re-clones its templates; if that lands mid-hydration it\n // throws a Hydration Mismatch (worst in dev, where slow unbundled modules widen\n // the hydration window). The children carry their own fine-grained reactivity\n // (render-value getters + <Show>s), so they update without being re-created.\n const FieldChildren = () =>\n untrack(() => {\n const children = local.children;\n return typeof children === \"function\" ? children(childRenderValues) : children;\n });\n // Provide the description / errorMessage props as `TextContext` slots (mirrors\n // react-aria-components' TextField), so a `<Text slot=\"description\">` /\n // `<Text slot=\"errorMessage\">` child picks up the `id` its `aria-describedby`\n // references. Additive: existing consumers reading these off `TextFieldContext`\n // are unaffected.\n const textSlots = {\n slots: {\n get description() {\n return textFieldAria.descriptionProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessage() {\n return textFieldAria.errorMessageProps as JSX.HTMLAttributes<HTMLElement>;\n },\n },\n };\n const FieldChildrenSlotted = () => (\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n <FieldChildren />\n </Provider>\n );\n const rootProps = () =>\n ({\n ...domProps(),\n ...cleanHoverProps(),\n class: renderProps.class(),\n style: renderProps.style(),\n slot: local.slot,\n \"data-disabled\": ariaProps.isDisabled || undefined,\n \"data-invalid\": textFieldAria.isInvalid || undefined,\n \"data-readonly\": ariaProps.isReadOnly || undefined,\n \"data-required\": ariaProps.isRequired || undefined,\n \"data-hovered\": isHovered() || undefined,\n \"data-focused\": isFocused() || undefined,\n \"data-focus-visible\": isFocusVisible() || undefined,\n }) as JSX.HTMLAttributes<HTMLDivElement>;\n const customRootProps = () =>\n ({\n ...rootProps(),\n children: <FieldChildrenSlotted />,\n }) as JSX.HTMLAttributes<HTMLDivElement>;\n\n return (\n <FieldErrorContext.Provider value={fieldErrorContext}>\n <TextFieldContext.Provider value={contextValue}>\n {local.render ? (\n local.render(customRootProps(), renderValues())\n ) : (\n <div {...rootProps()}>\n <FieldChildrenSlotted />\n </div>\n )}\n </TextFieldContext.Provider>\n </FieldErrorContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAuFA,MAAa,mBAAmB,cAA4C,IAAI;AAChF,MAAa,eAAe;AAC5B,MAAa,eAAe;AAC5B,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AAEjC,SAAS,2BACP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A;EAC/B,gBAAgB,UAAU,KAAK,KAAA;EAC/B,sBAAsB,eAAe,KAAK,KAAA;CAC5C;CACF,MAAM,yBACH;EACC,GAAG,UAAU;EACb,UAAU,CAAC;CACb;CAEF,OACE,CAAC,kBAAkB,SAAS,OAAO,mBAAmB;MACpD,CAAC,iBAAiB,SAAS,OAAO,cAAc;SAC7C,MAAM,SACL,MAAM,OAAO,gBAAgB,GAAG,aAAa,CAAC,IAE9C,CAAC,QAAQ,UAAU,GAAG;YACpB,CAAC,uBAAuB;UAC1B,EAAE,KACF;MACJ,EAAE,iBAAiB,SAAS;IAC9B,EAAE,kBAAkB;AAExB"}
|
|
1
|
+
{"version":3,"file":"TextField.jsx","names":["mergeProps"],"sources":["../src/TextField.tsx"],"sourcesContent":["/**\n * TextField component for solidaria-components\n *\n * A pre-wired headless text field that combines state + aria hooks.\n * Port of react-aria-components/src/TextField.tsx\n */\n\nimport {\n type JSX,\n type Context,\n createContext,\n useContext,\n createMemo,\n createSignal,\n createEffect,\n onCleanup,\n onMount,\n splitProps,\n untrack,\n} from \"solid-js\";\nimport {\n createTextField,\n createFocusRing,\n createHover,\n mergeProps,\n type AriaTextFieldProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createTextFieldState,\n VALID_VALIDITY_STATE,\n type ValidationResult,\n} from \"@proyecto-viviana/solid-stately\";\nimport { FormContext, type FormProps } from \"./Form\";\nimport { FieldErrorContext, type FieldErrorContextValue } from \"./FieldError\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n Provider,\n} from \"./utils\";\nimport { TextContext } from \"./Text\";\n\nexport interface TextFieldRenderProps {\n /** Whether the text field is disabled. */\n isDisabled: boolean;\n /** Whether the value is invalid. */\n isInvalid: boolean;\n /** Whether the text field is read only. */\n isReadOnly: boolean;\n /** Whether the text field is required. */\n isRequired: boolean;\n /** Whether the text field is currently hovered with a mouse. */\n isHovered: boolean;\n /** Whether the text field is focused, either via a mouse or keyboard. */\n isFocused: boolean;\n /** Whether the text field is keyboard focused. */\n isFocusVisible: boolean;\n}\n\nexport interface TextFieldProps extends Omit<AriaTextFieldProps, \"children\">, SlotProps {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<TextFieldRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TextFieldRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TextFieldRenderProps>;\n /** Custom renderer for the outer text field element. */\n render?: (\n props: JSX.HTMLAttributes<HTMLDivElement>,\n renderProps: TextFieldRenderProps,\n ) => JSX.Element;\n}\n\nexport interface TextFieldContextValue {\n labelProps?: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n inputProps?: JSX.InputHTMLAttributes<HTMLInputElement>;\n descriptionProps?: JSX.HTMLAttributes<HTMLElement>;\n errorMessageProps?: JSX.HTMLAttributes<HTMLElement>;\n isInvalid?: boolean;\n slots?: Record<string, TextFieldProps>;\n inputId?: string;\n setInputId?: (id: string | undefined) => void;\n}\n\nexport const TextFieldContext = createContext<TextFieldContextValue | null>(null);\nexport const LabelContext = TextFieldContext;\nexport const InputContext = TextFieldContext;\nexport const TextAreaContext = TextFieldContext;\nexport const FieldInputContext = TextFieldContext;\n\nfunction withFormValidationBehavior(\n props: TextFieldProps,\n formContext: FormProps | null,\n): TextFieldProps {\n if (!formContext?.validationBehavior) {\n return props;\n }\n\n return new Proxy(props, {\n get(target, property, receiver) {\n const localValue = Reflect.get(target, property, receiver);\n if (property === \"validationBehavior\" && localValue === undefined) {\n return formContext.validationBehavior;\n }\n\n return localValue;\n },\n has(target, property) {\n return (\n Reflect.has(target, property) ||\n (property === \"validationBehavior\" && formContext.validationBehavior !== undefined)\n );\n },\n ownKeys(target) {\n const keys = new Set(Reflect.ownKeys(target));\n if (formContext.validationBehavior !== undefined) {\n keys.add(\"validationBehavior\");\n }\n\n return Array.from(keys);\n },\n getOwnPropertyDescriptor(target, property) {\n const descriptor = Reflect.getOwnPropertyDescriptor(target, property);\n if (descriptor) {\n return descriptor;\n }\n\n if (property === \"validationBehavior\" && formContext.validationBehavior !== undefined) {\n return {\n enumerable: true,\n configurable: true,\n get: () => formContext.validationBehavior,\n };\n }\n\n return undefined;\n },\n });\n}\n\nexport interface LabelProps extends JSX.LabelHTMLAttributes<HTMLLabelElement> {\n children?: JSX.Element;\n}\n\n/**\n * A label element that automatically wires up to the parent TextField context.\n * This enables the proper htmlFor/id relationship between label and input.\n */\nexport function Label(props: LabelProps): JSX.Element {\n const context = useContext(TextFieldContext);\n\n const localDOMProps = () => {\n const result: Record<string, unknown> = {};\n const propsRecord = props as Record<string, unknown>;\n\n for (const key in propsRecord) {\n if (key !== \"children\") {\n result[key] = propsRecord[key];\n }\n }\n return result;\n };\n\n // Merge context labelProps with local props (local props take precedence)\n const mergedProps = () => {\n const localProps = localDOMProps();\n if (context) {\n const { ref: _ref, ...contextLabelProps } = (context.labelProps ?? {}) as Record<\n string,\n unknown\n >;\n const merged = {\n ...contextLabelProps,\n ...(context.inputId ? { for: context.inputId } : {}),\n ...localProps,\n } as Record<string, unknown>;\n if (merged.class == null) {\n merged.class = \"solidaria-Label\";\n }\n return merged;\n }\n return localProps.class == null ? { ...localProps, class: \"solidaria-Label\" } : localProps;\n };\n\n return <label {...mergedProps()}>{props.children}</label>;\n}\n\nexport interface InputProps extends Omit<JSX.InputHTMLAttributes<HTMLInputElement>, \"children\"> {}\n\nfunction eventWithCurrentTarget<T extends HTMLElement>(event: Event, element: T): Event {\n return new Proxy(event, {\n get(target, property, receiver) {\n if (property === \"target\" || property === \"currentTarget\") {\n return element;\n }\n\n const value = Reflect.get(target, property, receiver);\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\nfunction clearDelegatedTextEntryHandlers(element: HTMLElement) {\n const delegatedElement = element as HTMLElement & {\n $$input?: unknown;\n $$change?: unknown;\n };\n delete delegatedElement.$$input;\n delete delegatedElement.$$change;\n}\n\n/**\n * An input element that automatically wires up to the parent TextField context.\n * This enables focus tracking, validation, and accessibility props to flow from\n * the TextField to the actual input element.\n */\nexport function Input(props: InputProps): JSX.Element {\n const context = useContext(TextFieldContext);\n let inputElement: HTMLInputElement | undefined;\n\n createEffect(() => {\n context?.setInputId?.(props.id);\n });\n\n onCleanup(() => {\n context?.setInputId?.(undefined);\n });\n\n // Merge context inputProps with local props (local props take precedence)\n const mergedProps = () => {\n if (context) {\n // Remove ref from context props to avoid conflicts\n const { ref: _ref, ...contextInputProps } = (context.inputProps ?? {}) as Record<\n string,\n unknown\n >;\n const merged = { ...contextInputProps, ...props } as Record<string, unknown>;\n if (merged.class == null) {\n merged.class = \"solidaria-Input\";\n }\n return merged;\n }\n return props.class == null ? { ...props, class: \"solidaria-Input\" } : props;\n };\n\n onMount(() => {\n const element = inputElement;\n if (!element) {\n return;\n }\n\n const inputHandler = (event: Event) => {\n const handler = mergedProps().onInput as\n | JSX.EventHandler<HTMLInputElement, InputEvent>\n | undefined;\n handler?.(\n eventWithCurrentTarget(event, element) as InputEvent & {\n currentTarget: HTMLInputElement;\n target: Element;\n },\n );\n clearDelegatedTextEntryHandlers(element);\n event.stopPropagation();\n };\n const changeHandler = (event: Event) => {\n const handler = mergedProps().onChange as\n | JSX.EventHandler<HTMLInputElement, Event>\n | undefined;\n handler?.(\n eventWithCurrentTarget(event, element) as Event & {\n currentTarget: HTMLInputElement;\n target: Element;\n },\n );\n clearDelegatedTextEntryHandlers(element);\n event.stopPropagation();\n };\n\n element.addEventListener(\"input\", inputHandler);\n element.addEventListener(\"change\", changeHandler);\n clearDelegatedTextEntryHandlers(element);\n onCleanup(() => {\n element.removeEventListener(\"input\", inputHandler);\n element.removeEventListener(\"change\", changeHandler);\n });\n });\n\n return (\n <input\n {...mergedProps()}\n ref={(element) => {\n inputElement = element;\n const ref = props.ref;\n if (typeof ref === \"function\") {\n ref(element);\n }\n }}\n />\n );\n}\n\nexport interface TextAreaProps extends Omit<\n JSX.TextareaHTMLAttributes<HTMLTextAreaElement>,\n \"children\"\n> {}\n\n/**\n * A textarea element that automatically wires up to the parent TextField context.\n * This enables focus tracking, validation, and accessibility props to flow from\n * the TextField to the actual textarea element.\n */\nexport function TextArea(props: TextAreaProps): JSX.Element {\n const context = useContext(TextFieldContext);\n let textAreaElement: HTMLTextAreaElement | undefined;\n\n createEffect(() => {\n context?.setInputId?.(props.id);\n });\n\n onCleanup(() => {\n context?.setInputId?.(undefined);\n });\n\n // Merge context inputProps with local props (local props take precedence)\n // Note: TextArea uses inputProps from context since it's an input variant\n const mergedProps = () => {\n if (context) {\n const {\n ref: _ref,\n type: _type,\n ...contextInputProps\n } = (context.inputProps ?? {}) as Record<string, unknown>;\n const merged = { ...contextInputProps, ...props } as Record<string, unknown>;\n if (merged.class == null) {\n merged.class = \"solidaria-TextArea\";\n }\n return merged;\n }\n return props.class == null ? { ...props, class: \"solidaria-TextArea\" } : props;\n };\n\n onMount(() => {\n const element = textAreaElement;\n if (!element) {\n return;\n }\n\n const inputHandler = (event: Event) => {\n const handler = mergedProps().onInput as\n | JSX.EventHandler<HTMLTextAreaElement, InputEvent>\n | undefined;\n handler?.(\n eventWithCurrentTarget(event, element) as InputEvent & {\n currentTarget: HTMLTextAreaElement;\n target: Element;\n },\n );\n clearDelegatedTextEntryHandlers(element);\n event.stopPropagation();\n };\n const changeHandler = (event: Event) => {\n const handler = mergedProps().onChange as\n | JSX.EventHandler<HTMLTextAreaElement, Event>\n | undefined;\n handler?.(\n eventWithCurrentTarget(event, element) as Event & {\n currentTarget: HTMLTextAreaElement;\n target: Element;\n },\n );\n clearDelegatedTextEntryHandlers(element);\n event.stopPropagation();\n };\n\n element.addEventListener(\"input\", inputHandler);\n element.addEventListener(\"change\", changeHandler);\n clearDelegatedTextEntryHandlers(element);\n onCleanup(() => {\n element.removeEventListener(\"input\", inputHandler);\n element.removeEventListener(\"change\", changeHandler);\n });\n });\n\n return (\n <textarea\n {...mergedProps()}\n ref={(element) => {\n textAreaElement = element;\n const ref = props.ref;\n if (typeof ref === \"function\") {\n ref(element);\n }\n }}\n />\n );\n}\n\n/**\n * A text field allows a user to enter a plain text value with a keyboard.\n *\n * This is a headless component that provides accessibility and state management.\n * Style it using the render props pattern or data attributes.\n *\n * @example\n * ```tsx\n * <TextField>\n * {({ isInvalid }) => (\n * <>\n * <Label>Email</Label>\n * <Input class={isInvalid ? 'border-red-500' : 'border-gray-300'} />\n * </>\n * )}\n * </TextField>\n * ```\n */\nexport function TextField(props: TextFieldProps): JSX.Element {\n const formContext = useContext(FormContext);\n const contextProps = useContext(TextFieldContext);\n const contextSlotProps = contextProps?.slots?.[props.slot ?? \"default\"];\n const contextBaseProps = createMemo<TextFieldProps>(() => {\n if (!contextProps) return {};\n const {\n labelProps: _labelProps,\n inputProps: _inputProps,\n descriptionProps: _descriptionProps,\n errorMessageProps: _errorMessageProps,\n isInvalid: _isInvalid,\n slots: _slots,\n setInputId: _setInputId,\n ...rest\n } = contextProps;\n return rest as TextFieldProps;\n });\n const baseProps = (\n contextProps ? mergeProps(contextBaseProps(), contextSlotProps ?? {}, props) : props\n ) as TextFieldProps;\n const mergedProps = withFormValidationBehavior(baseProps, formContext);\n\n const [local, ariaProps] = splitProps(mergedProps, [\n \"children\",\n \"class\",\n \"style\",\n \"render\",\n \"slot\",\n ]);\n\n // Use getters to ensure props are read lazily inside reactive contexts\n const state = createTextFieldState({\n get value() {\n return ariaProps.value;\n },\n get defaultValue() {\n return ariaProps.defaultValue;\n },\n get onChange() {\n return ariaProps.onChange;\n },\n });\n\n const inputAriaProps = createMemo(() => {\n const clean: Record<string, unknown> = {};\n for (const key in ariaProps as Record<string, unknown>) {\n if (!key.startsWith(\"data-\")) {\n clean[key] = (ariaProps as Record<string, unknown>)[key];\n }\n }\n return clean as typeof ariaProps;\n });\n\n const textFieldAria = createTextField(() => ({\n ...inputAriaProps(),\n value: state.value(),\n onChange: state.setValue,\n }));\n\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n\n const { isHovered, hoverProps } = createHover({\n get isDisabled() {\n return ariaProps.isDisabled;\n },\n });\n const [inputIdOverride, setInputIdOverride] = createSignal<string | undefined>();\n\n const renderValues = createMemo<TextFieldRenderProps>(() => ({\n isDisabled: ariaProps.isDisabled || false,\n isInvalid: textFieldAria.isInvalid,\n isReadOnly: ariaProps.isReadOnly || false,\n isRequired: ariaProps.isRequired || false,\n isHovered: isHovered(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TextField\",\n },\n renderValues,\n );\n const childRenderValues: TextFieldRenderProps = {\n get isDisabled() {\n return ariaProps.isDisabled || false;\n },\n get isInvalid() {\n return textFieldAria.isInvalid;\n },\n get isReadOnly() {\n return ariaProps.isReadOnly || false;\n },\n get isRequired() {\n return ariaProps.isRequired || false;\n },\n get isHovered() {\n return isHovered();\n },\n get isFocused() {\n return isFocused();\n },\n get isFocusVisible() {\n return isFocusVisible();\n },\n };\n\n const domProps = createMemo(() => {\n const filtered = filterDOMProps(ariaProps, { global: true, events: false });\n delete (filtered as Record<string, unknown>).id;\n return filtered;\n });\n\n const cleanHoverProps = () => {\n const { ref: _ref, ...rest } = hoverProps as Record<string, unknown>;\n return rest;\n };\n\n // Context value for sub-components.\n // Use property getters so sub-components always read the latest aria/focus state.\n const fieldValidation = createMemo<ValidationResult>(() => {\n const isInvalid = textFieldAria.isInvalid;\n const errorMessage = ariaProps.errorMessage;\n const validationErrors = isInvalid && typeof errorMessage === \"string\" ? [errorMessage] : [];\n\n return {\n isInvalid,\n validationErrors,\n validationDetails: isInvalid\n ? { ...VALID_VALIDITY_STATE, customError: true, valid: false }\n : VALID_VALIDITY_STATE,\n };\n });\n const fieldErrorContext: FieldErrorContextValue = {\n get validation() {\n return fieldValidation();\n },\n get errorMessageProps() {\n return textFieldAria.errorMessageProps as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n const contextValue: TextFieldContextValue = {\n get labelProps() {\n return textFieldAria.labelProps as JSX.LabelHTMLAttributes<HTMLLabelElement>;\n },\n get inputProps() {\n return mergeProps(\n textFieldAria.inputProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n ) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get descriptionProps() {\n return textFieldAria.descriptionProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessageProps() {\n return textFieldAria.errorMessageProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get isInvalid() {\n return textFieldAria.isInvalid;\n },\n // Deterministic at render (createTextField generates it via createUniqueId),\n // so the Label's `for` is stable across SSR + hydration. A signal set from an\n // onMount effect would flip undefined->id post-mount and re-execute the Label\n // template — crashing hydration if the re-run lands mid-hydration (dev).\n get inputId() {\n return inputIdOverride() ?? (textFieldAria.inputProps as { id?: string }).id;\n },\n setInputId(id: string | undefined) {\n setInputIdOverride(id);\n },\n };\n // Resolve the render-prop children ONCE (untracked). Re-invoking it on a\n // reactive update re-clones its templates; if that lands mid-hydration it\n // throws a Hydration Mismatch (worst in dev, where slow unbundled modules widen\n // the hydration window). The children carry their own fine-grained reactivity\n // (render-value getters + <Show>s), so they update without being re-created.\n const FieldChildren = () =>\n untrack(() => {\n const children = local.children;\n return typeof children === \"function\" ? children(childRenderValues) : children;\n });\n // Provide the description / errorMessage props as `TextContext` slots (mirrors\n // react-aria-components' TextField), so a `<Text slot=\"description\">` /\n // `<Text slot=\"errorMessage\">` child picks up the `id` its `aria-describedby`\n // references. Additive: existing consumers reading these off `TextFieldContext`\n // are unaffected.\n const textSlots = {\n slots: {\n get description() {\n return textFieldAria.descriptionProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessage() {\n return textFieldAria.errorMessageProps as JSX.HTMLAttributes<HTMLElement>;\n },\n },\n };\n const FieldChildrenSlotted = () => (\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n <FieldChildren />\n </Provider>\n );\n const rootProps = () =>\n ({\n ...domProps(),\n ...cleanHoverProps(),\n class: renderProps.class(),\n style: renderProps.style(),\n slot: local.slot,\n \"data-disabled\": ariaProps.isDisabled || undefined,\n \"data-invalid\": textFieldAria.isInvalid || undefined,\n \"data-readonly\": ariaProps.isReadOnly || undefined,\n \"data-required\": ariaProps.isRequired || undefined,\n \"data-hovered\": isHovered() || undefined,\n \"data-focused\": isFocused() || undefined,\n \"data-focus-visible\": isFocusVisible() || undefined,\n }) as JSX.HTMLAttributes<HTMLDivElement>;\n const customRootProps = () =>\n ({\n ...rootProps(),\n children: <FieldChildrenSlotted />,\n }) as JSX.HTMLAttributes<HTMLDivElement>;\n\n return (\n <FieldErrorContext.Provider value={fieldErrorContext}>\n <TextFieldContext.Provider value={contextValue}>\n {local.render ? (\n local.render(customRootProps(), renderValues())\n ) : (\n <div {...rootProps()}>\n <FieldChildrenSlotted />\n </div>\n )}\n </TextFieldContext.Provider>\n </FieldErrorContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAuFA,MAAa,mBAAmB,cAA4C,IAAI;AAChF,MAAa,eAAe;AAC5B,MAAa,eAAe;AAC5B,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AAEjC,SAAS,2BACP,OACA,aACgB;CAChB,IAAI,CAAC,aAAa,oBAChB,OAAO;CAGT,OAAO,IAAI,MAAM,OAAO;EACtB,IAAI,QAAQ,UAAU,UAAU;GAC9B,MAAM,aAAa,QAAQ,IAAI,QAAQ,UAAU,QAAQ;GACzD,IAAI,aAAa,wBAAwB,eAAe,KAAA,GACtD,OAAO,YAAY;GAGrB,OAAO;EACT;EACA,IAAI,QAAQ,UAAU;GACpB,OACE,QAAQ,IAAI,QAAQ,QAAQ,KAC3B,aAAa,wBAAwB,YAAY,uBAAuB,KAAA;EAE7E;EACA,QAAQ,QAAQ;GACd,MAAM,OAAO,IAAI,IAAI,QAAQ,QAAQ,MAAM,CAAC;GAC5C,IAAI,YAAY,uBAAuB,KAAA,GACrC,KAAK,IAAI,oBAA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|
|
2
2
|
* TimeField component for solidaria-components
|
|
3
3
|
*
|
|
4
|
-
* Pre-wired headless time field
|
|
5
|
-
*
|
|
4
|
+
* Pre-wired headless time field. Faithful port of react-aria-components'
|
|
5
|
+
* TimeField, which does NOT define its own segment primitives — it reuses
|
|
6
|
+
* `DateInput`/`DateSegment` (there is no `TimeInput`/`TimeSegment` upstream).
|
|
7
|
+
* `TimeFieldState` IS a `DateFieldState` (plus `timeValue`), so this component
|
|
8
|
+
* drives the certified DateField segment/group stack directly: it provides the
|
|
9
|
+
* shared `DateFieldContext`/`DateFieldStateContext` that `DateInput`/`DateSegment`
|
|
10
|
+
* read, plus a `TimeFieldContext` for the time-field label/description/error
|
|
11
|
+
* chrome. Unlike DateField, TimeField renders NO root hidden autofill input (RAC
|
|
12
|
+
* TimeField renders none); its native-validation `<input>` is still emitted by
|
|
13
|
+
* the inner DateInput sibling.
|
|
6
14
|
*/
|
|
7
15
|
import { type JSX, type Context } from "solid-js";
|
|
8
16
|
import { type AriaTimeFieldProps } from "@proyecto-viviana/solidaria";
|
|
9
17
|
import { type TimeFieldState, type TimeFieldStateProps, type TimeSegment as TimeSegmentType, type TimeValue } from "@proyecto-viviana/solid-stately";
|
|
10
|
-
import { type
|
|
18
|
+
import { type ClassNameOrFunction, type StyleOrFunction, type SlotProps } from "./utils";
|
|
11
19
|
export interface TimeFieldRenderProps {
|
|
12
20
|
/** Whether the field is disabled. */
|
|
13
21
|
isDisabled: boolean;
|
|
@@ -28,42 +36,6 @@ export interface TimeFieldProps<T extends TimeValue = TimeValue> extends Omit<Ar
|
|
|
28
36
|
/** The locale to use for formatting. */
|
|
29
37
|
locale?: string;
|
|
30
38
|
}
|
|
31
|
-
export interface TimeInputRenderProps {
|
|
32
|
-
/** Whether the input is disabled. */
|
|
33
|
-
isDisabled: boolean;
|
|
34
|
-
/** Whether the input is focused. */
|
|
35
|
-
isFocused: boolean;
|
|
36
|
-
}
|
|
37
|
-
export interface TimeInputProps extends SlotProps {
|
|
38
|
-
/** The children of the component (render function receiving segments). */
|
|
39
|
-
children?: (segment: TimeSegmentType) => JSX.Element;
|
|
40
|
-
/** The CSS className for the element. */
|
|
41
|
-
class?: ClassNameOrFunction<TimeInputRenderProps>;
|
|
42
|
-
/** The inline style for the element. */
|
|
43
|
-
style?: StyleOrFunction<TimeInputRenderProps>;
|
|
44
|
-
}
|
|
45
|
-
export interface TimeSegmentRenderProps {
|
|
46
|
-
/** Whether the segment is focused. */
|
|
47
|
-
isFocused: boolean;
|
|
48
|
-
/** Whether the segment is editable. */
|
|
49
|
-
isEditable: boolean;
|
|
50
|
-
/** Whether the segment is a placeholder. */
|
|
51
|
-
isPlaceholder: boolean;
|
|
52
|
-
/** The segment type. */
|
|
53
|
-
type: TimeSegmentType["type"];
|
|
54
|
-
/** The text to display. */
|
|
55
|
-
text: string;
|
|
56
|
-
}
|
|
57
|
-
export interface TimeSegmentProps extends SlotProps {
|
|
58
|
-
/** The segment data. */
|
|
59
|
-
segment: TimeSegmentType;
|
|
60
|
-
/** The children of the component. A function may be provided to receive render props. */
|
|
61
|
-
children?: RenderChildren<TimeSegmentRenderProps>;
|
|
62
|
-
/** The CSS className for the element. */
|
|
63
|
-
class?: ClassNameOrFunction<TimeSegmentRenderProps>;
|
|
64
|
-
/** The inline style for the element. */
|
|
65
|
-
style?: StyleOrFunction<TimeSegmentRenderProps>;
|
|
66
|
-
}
|
|
67
39
|
export interface TimeFieldContextValue {
|
|
68
40
|
state: TimeFieldState<TimeValue>;
|
|
69
41
|
aria: {
|
|
@@ -83,21 +55,13 @@ export declare function useTimeFieldContext(): TimeFieldState<TimeValue>;
|
|
|
83
55
|
* ```tsx
|
|
84
56
|
* <TimeField label="Time">
|
|
85
57
|
* <Label>Time</Label>
|
|
86
|
-
* <
|
|
87
|
-
* {(segment) => <
|
|
88
|
-
* </
|
|
58
|
+
* <DateInput>
|
|
59
|
+
* {(segment) => <DateSegment segment={segment} />}
|
|
60
|
+
* </DateInput>
|
|
89
61
|
* </TimeField>
|
|
90
62
|
* ```
|
|
91
63
|
*/
|
|
92
64
|
export declare function TimeField<T extends TimeValue = TimeValue>(props: TimeFieldProps<T>): JSX.Element;
|
|
93
|
-
/**
|
|
94
|
-
* The input area containing time segments.
|
|
95
|
-
*/
|
|
96
|
-
export declare function TimeInput(props: TimeInputProps): JSX.Element;
|
|
97
|
-
/**
|
|
98
|
-
* A segment of a time field (hour, minute, second, AM/PM).
|
|
99
|
-
*/
|
|
100
|
-
export declare function TimeSegment(props: TimeSegmentProps): JSX.Element;
|
|
101
65
|
export interface TimeFieldLabelProps {
|
|
102
66
|
children?: JSX.Element;
|
|
103
67
|
class?: string;
|
package/dist/TimeField.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeField.d.ts","sourceRoot":"","sources":["../src/TimeField.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TimeField.d.ts","sourceRoot":"","sources":["../src/TimeField.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EAOb,MAAM,UAAU,CAAC;AAClB,OAAO,EAA+B,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACnG,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,WAAW,IAAI,eAAe,EACnC,KAAK,SAAS,EACf,MAAM,iCAAiC,CAAC;AAMzC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,EAKf,MAAM,SAAS,CAAC;AAIjB,MAAM,WAAW,oBAAoB;IACnC,qCAAqC;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,sCAAsC;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,qCAAqC;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,cAAc,CA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GAAG,CAAC,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAOtE;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,GAAG,CAAC,OAAO,CAOlF;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,GAAG,CAAC,OAAO,CAOpF;AAED,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/TimeField.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { Provider, dataAttr, useIsHydrated, useRenderProps } from "./utils.js";
|
|
2
2
|
import { TextContext } from "./Text.js";
|
|
3
3
|
import { FormContext } from "./Form.js";
|
|
4
|
-
import {
|
|
5
|
-
import { createComponent, getNextElement, insert, mergeProps, runHydrationEvents, spread, template, use } from "solid-js/web";
|
|
6
|
-
import {
|
|
7
|
-
import { createTimeField,
|
|
4
|
+
import { n as DateFieldContext, o as DateFieldStateContext } from "./DateField2.js";
|
|
5
|
+
import { className, createComponent, effect, getNextElement, insert, mergeProps, runHydrationEvents, setAttribute, spread, style, template, use } from "solid-js/web";
|
|
6
|
+
import { Show, createContext, createMemo, createSignal, splitProps, useContext } from "solid-js";
|
|
7
|
+
import { createTimeField, mergeProps as mergeProps$2 } from "@proyecto-viviana/solidaria";
|
|
8
8
|
import { access, createTimeFieldState } from "@proyecto-viviana/solid-stately";
|
|
9
9
|
//#region src/TimeField.tsx
|
|
10
10
|
/**
|
|
11
11
|
* TimeField component for solidaria-components
|
|
12
12
|
*
|
|
13
|
-
* Pre-wired headless time field
|
|
14
|
-
*
|
|
13
|
+
* Pre-wired headless time field. Faithful port of react-aria-components'
|
|
14
|
+
* TimeField, which does NOT define its own segment primitives — it reuses
|
|
15
|
+
* `DateInput`/`DateSegment` (there is no `TimeInput`/`TimeSegment` upstream).
|
|
16
|
+
* `TimeFieldState` IS a `DateFieldState` (plus `timeValue`), so this component
|
|
17
|
+
* drives the certified DateField segment/group stack directly: it provides the
|
|
18
|
+
* shared `DateFieldContext`/`DateFieldStateContext` that `DateInput`/`DateSegment`
|
|
19
|
+
* read, plus a `TimeFieldContext` for the time-field label/description/error
|
|
20
|
+
* chrome. Unlike DateField, TimeField renders NO root hidden autofill input (RAC
|
|
21
|
+
* TimeField renders none); its native-validation `<input>` is still emitted by
|
|
22
|
+
* the inner DateInput sibling.
|
|
15
23
|
*/
|
|
16
|
-
var _tmpl$ = /*#__PURE__*/ template(`<div class="solidaria-TimeField solidaria-TimeField--placeholder"aria-hidden=true>`), _tmpl$2 = /*#__PURE__*/ template(`<div>`), _tmpl$3 = /*#__PURE__*/ template(`<span>`)
|
|
24
|
+
var _tmpl$ = /*#__PURE__*/ template(`<div class="solidaria-TimeField solidaria-TimeField--placeholder"aria-hidden=true>`), _tmpl$2 = /*#__PURE__*/ template(`<div>`), _tmpl$3 = /*#__PURE__*/ template(`<span>`);
|
|
17
25
|
const TimeFieldContext = createContext(null);
|
|
18
26
|
const TimeFieldStateContext = createContext(null);
|
|
19
27
|
function withFormValidationBehavior(props, formContext) {
|
|
@@ -58,9 +66,9 @@ function useTimeFieldContext() {
|
|
|
58
66
|
* ```tsx
|
|
59
67
|
* <TimeField label="Time">
|
|
60
68
|
* <Label>Time</Label>
|
|
61
|
-
* <
|
|
62
|
-
* {(segment) => <
|
|
63
|
-
* </
|
|
69
|
+
* <DateInput>
|
|
70
|
+
* {(segment) => <DateSegment segment={segment} />}
|
|
71
|
+
* </DateInput>
|
|
64
72
|
* </TimeField>
|
|
65
73
|
* ```
|
|
66
74
|
*/
|
|
@@ -83,8 +91,7 @@ function TimeField(props) {
|
|
|
83
91
|
* Internal TimeField component that renders after client mount.
|
|
84
92
|
*/
|
|
85
93
|
function TimeFieldInner(props) {
|
|
86
|
-
const
|
|
87
|
-
const [local, stateProps, rest] = splitProps(withFormValidationBehavior(props, formContext), [
|
|
94
|
+
const [local, stateProps, rest] = splitProps(withFormValidationBehavior(props, props.__formContext ?? useContext(FormContext)), [
|
|
88
95
|
"children",
|
|
89
96
|
"class",
|
|
90
97
|
"style",
|
|
@@ -103,6 +110,7 @@ function TimeFieldInner(props) {
|
|
|
103
110
|
"locale",
|
|
104
111
|
"granularity",
|
|
105
112
|
"hourCycle",
|
|
113
|
+
"hideTimeZone",
|
|
106
114
|
"shouldForceLeadingZeros",
|
|
107
115
|
"validationState",
|
|
108
116
|
"validationBehavior",
|
|
@@ -112,11 +120,17 @@ function TimeFieldInner(props) {
|
|
|
112
120
|
"placeholderValue"
|
|
113
121
|
]);
|
|
114
122
|
const [fieldRef, setFieldRef] = createSignal(null);
|
|
123
|
+
const [validationInputRef, setValidationInputRef] = createSignal(null);
|
|
115
124
|
const state = createTimeFieldState(stateProps);
|
|
116
125
|
const fieldAria = createTimeField(() => ({
|
|
117
126
|
...rest,
|
|
127
|
+
isDisabled: access(stateProps.isDisabled),
|
|
128
|
+
isReadOnly: access(stateProps.isReadOnly),
|
|
129
|
+
isRequired: access(stateProps.isRequired),
|
|
130
|
+
validationBehavior: stateProps.validationBehavior ?? "native",
|
|
118
131
|
description: stateProps.description,
|
|
119
|
-
errorMessage: stateProps.errorMessage
|
|
132
|
+
errorMessage: stateProps.errorMessage,
|
|
133
|
+
inputRef: () => validationInputRef() ?? void 0
|
|
120
134
|
}), state, fieldRef);
|
|
121
135
|
const renderValues = createMemo(() => ({
|
|
122
136
|
isDisabled: state.isDisabled(),
|
|
@@ -129,7 +143,6 @@ function TimeFieldInner(props) {
|
|
|
129
143
|
style: local.style,
|
|
130
144
|
defaultClassName: "solidaria-TimeField"
|
|
131
145
|
}, renderValues);
|
|
132
|
-
const validationBehavior = () => stateProps.validationBehavior ?? formContext?.validationBehavior ?? "native";
|
|
133
146
|
const textSlots = { slots: {
|
|
134
147
|
get description() {
|
|
135
148
|
return fieldAria.descriptionProps;
|
|
@@ -138,235 +151,128 @@ function TimeFieldInner(props) {
|
|
|
138
151
|
return fieldAria.errorMessageProps;
|
|
139
152
|
}
|
|
140
153
|
} };
|
|
154
|
+
const dateFieldContextValue = {
|
|
155
|
+
get state() {
|
|
156
|
+
return state;
|
|
157
|
+
},
|
|
158
|
+
aria: {
|
|
159
|
+
get labelProps() {
|
|
160
|
+
return fieldAria.labelProps;
|
|
161
|
+
},
|
|
162
|
+
get inputProps() {
|
|
163
|
+
return fieldAria.fieldProps;
|
|
164
|
+
},
|
|
165
|
+
get hiddenInputProps() {
|
|
166
|
+
return mergeProps$2(fieldAria.inputProps, { ref: setValidationInputRef });
|
|
167
|
+
},
|
|
168
|
+
get descriptionProps() {
|
|
169
|
+
return fieldAria.descriptionProps;
|
|
170
|
+
},
|
|
171
|
+
get errorMessageProps() {
|
|
172
|
+
return fieldAria.errorMessageProps;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
141
176
|
return createComponent(TimeFieldStateContext.Provider, {
|
|
142
177
|
value: state,
|
|
143
178
|
get children() {
|
|
144
|
-
return createComponent(
|
|
145
|
-
|
|
146
|
-
return {
|
|
147
|
-
state,
|
|
148
|
-
aria: {
|
|
149
|
-
labelProps: fieldAria.labelProps,
|
|
150
|
-
inputProps: fieldAria.inputProps,
|
|
151
|
-
descriptionProps: fieldAria.descriptionProps,
|
|
152
|
-
errorMessageProps: fieldAria.errorMessageProps
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
},
|
|
179
|
+
return createComponent(DateFieldStateContext.Provider, {
|
|
180
|
+
value: state,
|
|
156
181
|
get children() {
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
use(setFieldRef, _el$2);
|
|
160
|
-
spread(_el$2, mergeProps(() => fieldAria.fieldProps, {
|
|
161
|
-
get ["class"]() {
|
|
162
|
-
return renderProps.class();
|
|
163
|
-
},
|
|
164
|
-
get style() {
|
|
165
|
-
return renderProps.style();
|
|
166
|
-
},
|
|
167
|
-
get ["data-disabled"]() {
|
|
168
|
-
return dataAttr(state.isDisabled());
|
|
169
|
-
},
|
|
170
|
-
get ["data-readonly"]() {
|
|
171
|
-
return dataAttr(state.isReadOnly());
|
|
172
|
-
},
|
|
173
|
-
get ["data-required"]() {
|
|
174
|
-
return dataAttr(state.isRequired());
|
|
175
|
-
},
|
|
176
|
-
get ["data-invalid"]() {
|
|
177
|
-
return dataAttr(state.isInvalid());
|
|
178
|
-
}
|
|
179
|
-
}), false, true);
|
|
180
|
-
insert(_el$2, createComponent(Provider, {
|
|
181
|
-
values: [[TextContext, textSlots]],
|
|
182
|
-
get children() {
|
|
183
|
-
return local.children;
|
|
184
|
-
}
|
|
185
|
-
}));
|
|
186
|
-
runHydrationEvents();
|
|
187
|
-
return _el$2;
|
|
188
|
-
})(), createComponent(Show, {
|
|
189
|
-
get when() {
|
|
190
|
-
return rest.name;
|
|
191
|
-
},
|
|
182
|
+
return createComponent(DateFieldContext.Provider, {
|
|
183
|
+
value: dateFieldContextValue,
|
|
192
184
|
get children() {
|
|
193
|
-
return createComponent(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return state.isRequired();
|
|
211
|
-
},
|
|
212
|
-
get validationBehavior() {
|
|
213
|
-
return validationBehavior();
|
|
214
|
-
},
|
|
215
|
-
validationState: state,
|
|
216
|
-
focus: () => {
|
|
217
|
-
fieldRef()?.querySelector("[role=\"spinbutton\"]")?.focus();
|
|
185
|
+
return createComponent(TimeFieldContext.Provider, {
|
|
186
|
+
value: {
|
|
187
|
+
state,
|
|
188
|
+
aria: {
|
|
189
|
+
get labelProps() {
|
|
190
|
+
return fieldAria.labelProps;
|
|
191
|
+
},
|
|
192
|
+
get inputProps() {
|
|
193
|
+
return fieldAria.fieldProps;
|
|
194
|
+
},
|
|
195
|
+
get descriptionProps() {
|
|
196
|
+
return fieldAria.descriptionProps;
|
|
197
|
+
},
|
|
198
|
+
get errorMessageProps() {
|
|
199
|
+
return fieldAria.errorMessageProps;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
218
202
|
},
|
|
219
|
-
get
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
203
|
+
get children() {
|
|
204
|
+
var _el$2 = getNextElement(_tmpl$2);
|
|
205
|
+
use(setFieldRef, _el$2);
|
|
206
|
+
insert(_el$2, createComponent(Provider, {
|
|
207
|
+
values: [[TextContext, textSlots]],
|
|
208
|
+
get children() {
|
|
209
|
+
return local.children;
|
|
210
|
+
}
|
|
211
|
+
}));
|
|
212
|
+
effect((_p$) => {
|
|
213
|
+
var _v$ = renderProps.class(), _v$2 = renderProps.style(), _v$3 = dataAttr(state.isDisabled()), _v$4 = dataAttr(state.isReadOnly()), _v$5 = dataAttr(state.isRequired()), _v$6 = dataAttr(state.isInvalid());
|
|
214
|
+
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
215
|
+
_p$.t = style(_el$2, _v$2, _p$.t);
|
|
216
|
+
_v$3 !== _p$.a && setAttribute(_el$2, "data-disabled", _p$.a = _v$3);
|
|
217
|
+
_v$4 !== _p$.o && setAttribute(_el$2, "data-readonly", _p$.o = _v$4);
|
|
218
|
+
_v$5 !== _p$.i && setAttribute(_el$2, "data-required", _p$.i = _v$5);
|
|
219
|
+
_v$6 !== _p$.n && setAttribute(_el$2, "data-invalid", _p$.n = _v$6);
|
|
220
|
+
return _p$;
|
|
221
|
+
}, {
|
|
222
|
+
e: void 0,
|
|
223
|
+
t: void 0,
|
|
224
|
+
a: void 0,
|
|
225
|
+
o: void 0,
|
|
226
|
+
i: void 0,
|
|
227
|
+
n: void 0
|
|
228
|
+
});
|
|
229
|
+
return _el$2;
|
|
227
230
|
}
|
|
228
231
|
});
|
|
229
232
|
}
|
|
230
|
-
})
|
|
233
|
+
});
|
|
231
234
|
}
|
|
232
235
|
});
|
|
233
236
|
}
|
|
234
237
|
});
|
|
235
238
|
}
|
|
236
|
-
/**
|
|
237
|
-
* The input area containing time segments.
|
|
238
|
-
*/
|
|
239
|
-
function TimeInput(props) {
|
|
240
|
-
const { state, aria } = useTimeFieldContextValue();
|
|
241
|
-
const [isFocused, setIsFocused] = createSignal(false);
|
|
242
|
-
const renderValues = createMemo(() => ({
|
|
243
|
-
isDisabled: state.isDisabled(),
|
|
244
|
-
isFocused: isFocused()
|
|
245
|
-
}));
|
|
246
|
-
const renderProps = useRenderProps({
|
|
247
|
-
class: props.class,
|
|
248
|
-
style: props.style,
|
|
249
|
-
defaultClassName: "solidaria-TimeInput"
|
|
250
|
-
}, renderValues);
|
|
251
|
-
return (() => {
|
|
252
|
-
var _el$3 = getNextElement(_tmpl$2);
|
|
253
|
-
spread(_el$3, mergeProps(() => aria.inputProps, {
|
|
254
|
-
get ["class"]() {
|
|
255
|
-
return renderProps.class();
|
|
256
|
-
},
|
|
257
|
-
get style() {
|
|
258
|
-
return renderProps.style();
|
|
259
|
-
},
|
|
260
|
-
get ["data-disabled"]() {
|
|
261
|
-
return dataAttr(state.isDisabled());
|
|
262
|
-
},
|
|
263
|
-
get ["data-focused"]() {
|
|
264
|
-
return dataAttr(isFocused());
|
|
265
|
-
},
|
|
266
|
-
"onFocusIn": () => setIsFocused(true),
|
|
267
|
-
"onFocusOut": () => setIsFocused(false)
|
|
268
|
-
}), false, true);
|
|
269
|
-
insert(_el$3, createComponent(For, {
|
|
270
|
-
get each() {
|
|
271
|
-
return state.segments();
|
|
272
|
-
},
|
|
273
|
-
children: (segment) => props.children?.(segment)
|
|
274
|
-
}));
|
|
275
|
-
runHydrationEvents();
|
|
276
|
-
return _el$3;
|
|
277
|
-
})();
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* A segment of a time field (hour, minute, second, AM/PM).
|
|
281
|
-
*/
|
|
282
|
-
function TimeSegment(props) {
|
|
283
|
-
const state = useTimeFieldContext();
|
|
284
|
-
const [segmentRef, setSegmentRef] = createSignal(null);
|
|
285
|
-
const segmentAria = createTimeSegment({ segment: props.segment }, state, segmentRef);
|
|
286
|
-
const renderValues = createMemo(() => ({
|
|
287
|
-
isFocused: segmentAria.isFocused,
|
|
288
|
-
isEditable: segmentAria.isEditable,
|
|
289
|
-
isPlaceholder: segmentAria.isPlaceholder,
|
|
290
|
-
type: props.segment.type,
|
|
291
|
-
text: segmentAria.text
|
|
292
|
-
}));
|
|
293
|
-
const renderProps = useRenderProps({
|
|
294
|
-
get children() {
|
|
295
|
-
return props.children;
|
|
296
|
-
},
|
|
297
|
-
class: props.class,
|
|
298
|
-
style: props.style,
|
|
299
|
-
defaultClassName: "solidaria-TimeSegment"
|
|
300
|
-
}, renderValues);
|
|
301
|
-
const getChildren = () => {
|
|
302
|
-
if (typeof props.children === "function") return renderProps.renderChildren();
|
|
303
|
-
return segmentAria.text;
|
|
304
|
-
};
|
|
305
|
-
return (() => {
|
|
306
|
-
var _el$4 = getNextElement(_tmpl$2);
|
|
307
|
-
use(setSegmentRef, _el$4);
|
|
308
|
-
spread(_el$4, mergeProps(() => segmentAria.segmentProps, {
|
|
309
|
-
get ["class"]() {
|
|
310
|
-
return renderProps.class();
|
|
311
|
-
},
|
|
312
|
-
get style() {
|
|
313
|
-
return renderProps.style();
|
|
314
|
-
},
|
|
315
|
-
get ["data-focused"]() {
|
|
316
|
-
return dataAttr(segmentAria.isFocused);
|
|
317
|
-
},
|
|
318
|
-
get ["data-editable"]() {
|
|
319
|
-
return dataAttr(segmentAria.isEditable);
|
|
320
|
-
},
|
|
321
|
-
get ["data-placeholder"]() {
|
|
322
|
-
return dataAttr(segmentAria.isPlaceholder);
|
|
323
|
-
},
|
|
324
|
-
get ["data-type"]() {
|
|
325
|
-
return props.segment.type;
|
|
326
|
-
}
|
|
327
|
-
}), false, true);
|
|
328
|
-
insert(_el$4, getChildren);
|
|
329
|
-
runHydrationEvents();
|
|
330
|
-
return _el$4;
|
|
331
|
-
})();
|
|
332
|
-
}
|
|
333
239
|
function TimeFieldLabel(props) {
|
|
334
240
|
const { aria } = useTimeFieldContextValue();
|
|
335
241
|
return (() => {
|
|
336
|
-
var _el$
|
|
337
|
-
spread(_el$
|
|
242
|
+
var _el$3 = getNextElement(_tmpl$3);
|
|
243
|
+
spread(_el$3, mergeProps(() => aria.labelProps, { get ["class"]() {
|
|
338
244
|
return props.class;
|
|
339
245
|
} }), false, true);
|
|
340
|
-
insert(_el$
|
|
246
|
+
insert(_el$3, () => props.children);
|
|
341
247
|
runHydrationEvents();
|
|
342
|
-
return _el$
|
|
248
|
+
return _el$3;
|
|
343
249
|
})();
|
|
344
250
|
}
|
|
345
251
|
function TimeFieldDescription(props) {
|
|
346
252
|
const { aria } = useTimeFieldContextValue();
|
|
347
253
|
return (() => {
|
|
348
|
-
var _el$
|
|
349
|
-
spread(_el$
|
|
254
|
+
var _el$4 = getNextElement(_tmpl$3);
|
|
255
|
+
spread(_el$4, mergeProps(() => aria.descriptionProps, { get ["class"]() {
|
|
350
256
|
return props.class;
|
|
351
257
|
} }), false, true);
|
|
352
|
-
insert(_el$
|
|
258
|
+
insert(_el$4, () => props.children);
|
|
353
259
|
runHydrationEvents();
|
|
354
|
-
return _el$
|
|
260
|
+
return _el$4;
|
|
355
261
|
})();
|
|
356
262
|
}
|
|
357
263
|
function TimeFieldErrorMessage(props) {
|
|
358
264
|
const { aria } = useTimeFieldContextValue();
|
|
359
265
|
return (() => {
|
|
360
|
-
var _el$
|
|
361
|
-
spread(_el$
|
|
266
|
+
var _el$5 = getNextElement(_tmpl$3);
|
|
267
|
+
spread(_el$5, mergeProps(() => aria.errorMessageProps, { get ["class"]() {
|
|
362
268
|
return props.class;
|
|
363
269
|
} }), false, true);
|
|
364
|
-
insert(_el$
|
|
270
|
+
insert(_el$5, () => props.children);
|
|
365
271
|
runHydrationEvents();
|
|
366
|
-
return _el$
|
|
272
|
+
return _el$5;
|
|
367
273
|
})();
|
|
368
274
|
}
|
|
369
275
|
//#endregion
|
|
370
|
-
export { TimeField, TimeFieldContext, TimeFieldDescription, TimeFieldErrorMessage, TimeFieldLabel, TimeFieldStateContext,
|
|
276
|
+
export { TimeField, TimeFieldContext, TimeFieldDescription, TimeFieldErrorMessage, TimeFieldLabel, TimeFieldStateContext, useTimeFieldContext };
|
|
371
277
|
|
|
372
278
|
//# sourceMappingURL=TimeField.js.map
|