@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/DateField2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateField2.js","names":["JSX","createEffect","createSignal","DateValue","FormValidationState","createFormValidation","MaybeAccessor","T","HiddenDateInputProps","name","form","value","autoComplete","isDisabled","isRequired","validationBehavior","validationState","focus","minValue","maxValue","granularity","accessValue","formatDateValue","String","dateValue","year","padStart","month","day","hasHour","hour","hasMinute","minute","second","HiddenDateInput","props","Element","hasValidationBehavior","usesNativeValidation","hasTimeZoneValue","Boolean","inputType","formattedValue","formattedMin","formattedMax","inputRef","setInputRef","HTMLInputElement","val","input","_el$","_$getNextElement","_tmpl$","_$addEventListener","undefined","_$use","el","_$effect","_p$","_v$","_v$2","_v$3","_v$4","_v$5","_v$6","_v$7","_v$8","_v$9","_v$0","position","width","height","padding","margin","overflow","clip","CSSProperties","e","_$setAttribute","t","a","o","i","_$setProperty","n","s","h","r","d","_$style","createContext","useContext","createDateRangePicker","DateFieldState","DateValue","RangeCalendarState","DateRangePickerFieldContextValue","state","aria","labelProps","Record","inputProps","descriptionProps","errorMessageProps","DateRangePickerContextValue","calendarState","startFieldState","endFieldState","startFieldContext","endFieldContext","overlayState","isOpen","open","close","toggle","triggerRef","HTMLElement","setTriggerRef","element","pickerAria","ReturnType","DateRangePickerContext","useDateRangePickerContext","context","Error","JSX","Context","createContext","createEffect","createMemo","createSignal","onCleanup","splitProps","useContext","For","Show","createDateField","createDateSegment","AriaDateFieldProps","createDateFieldState","access","DateFieldState","DateFieldStateProps","DateSegment","DateSegmentType","CalendarDate","DateValue","RenderChildren","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","dataAttr","useIsHydrated","Provider","TextContext","HiddenDateInput","FormContext","FormProps","DateRangePickerContext","DateRangePickerFieldContextValue","DateFieldRenderProps","isDisabled","isReadOnly","isRequired","isInvalid","DateFieldProps","Omit","T","children","Element","segment","class","style","locale","DateInputRenderProps","isFocused","DateInputProps","onPointerDownCapture","EventHandler","HTMLDivElement","PointerEvent","DateSegmentRenderProps","isEditable","isPlaceholder","type","text","DateSegmentProps","DateFieldContextValue","state","aria","labelProps","Record","inputProps","descriptionProps","errorMessageProps","DateFieldContext","DateFieldStateContext","withFormValidationBehavior","props","P","formContext","validationBehavior","Proxy","get","target","property","receiver","localValue","Reflect","undefined","has","ownKeys","keys","Set","add","Array","from","getOwnPropertyDescriptor","descriptor","enumerable","configurable","useDateFieldContext","context","Error","useDateInputContext","slot","dateFieldContext","dateRangePickerContext","startFieldContext","endFieldContext","DateField","isHydrated","_$createComponent","when","fallback","_$getNextElement","_tmpl$","DateFieldInner","_$mergeProps","__formContext","DateFieldInnerProps","mergedProps","local","stateProps","rest","fieldRef","setFieldRef","fieldAria","description","errorMessage","renderValues","renderProps","defaultClassName","textSlots","slots","value","_el$2","_tmpl$2","_$use","_$spread","fieldProps","data-disabled","data-readonly","data-required","data-invalid","_$insert","values","_$runHydrationEvents","name","form","autoComplete","validationState","focus","querySelector","HTMLElement","minValue","maxValue","granularity","DateInput","setIsFocused","inputRef","setInputRef","element","handler","listener","event","addEventListener","capture","removeEventListener","_el$3","data-focused","onFocusIn","onFocusOut","each","segments","segmentRef","setSegmentRef","segmentAria","getChildren","renderChildren","_el$4","_tmpl$3","segmentProps","data-editable","data-placeholder","data-type","DateFieldLabelProps","DateFieldLabel","_el$5","DateFieldDescriptionProps","DateFieldDescription","_el$6","_tmpl$4","DateFieldErrorMessageProps","DateFieldErrorMessage","_el$7"],"sources":["../src/HiddenDateInput.tsx","../src/DateRangePickerContext.tsx","../src/DateField.tsx"],"sourcesContent":["/**\n * HiddenDateInput component for solidaria-components\n *\n * A hidden native date/datetime-local input for form submission.\n * Renders server-side with the initial value for SSR safety.\n */\nimport { type JSX, createEffect, createSignal } from \"solid-js\";\nimport { type DateValue, type FormValidationState } from \"@proyecto-viviana/solid-stately\";\nimport { createFormValidation } from \"@proyecto-viviana/solidaria\";\n\ntype MaybeAccessor<T> = T | (() => T);\n\nexport interface HiddenDateInputProps {\n name?: string;\n form?: string;\n value?: MaybeAccessor<DateValue | null | undefined>;\n autoComplete?: string;\n isDisabled?: boolean;\n isRequired?: boolean;\n validationBehavior?: \"aria\" | \"native\";\n validationState?: FormValidationState;\n focus?: () => void;\n minValue?: MaybeAccessor<DateValue | undefined>;\n maxValue?: MaybeAccessor<DateValue | undefined>;\n granularity?: \"day\" | \"hour\" | \"minute\" | \"second\";\n}\n\nfunction accessValue<T>(value: MaybeAccessor<T> | undefined): T | undefined {\n return typeof value === \"function\" ? (value as () => T)() : value;\n}\n\nfunction formatDateValue(\n value: DateValue | undefined | null,\n granularity: \"day\" | \"hour\" | \"minute\" | \"second\",\n): string {\n if (!value) return \"\";\n\n if (\"timeZone\" in value) {\n return String(value);\n }\n\n const dateValue = value;\n\n const year = String(dateValue.year).padStart(4, \"0\");\n const month = String(dateValue.month).padStart(2, \"0\");\n const day = String(dateValue.day).padStart(2, \"0\");\n\n if (granularity === \"day\") {\n return `${year}-${month}-${day}`;\n }\n\n const hasHour = \"hour\" in dateValue;\n const hour = hasHour ? String((dateValue as { hour: number }).hour).padStart(2, \"0\") : \"00\";\n const hasMinute = hasHour && \"minute\" in dateValue;\n const minute = hasMinute\n ? String((dateValue as { minute: number }).minute).padStart(2, \"0\")\n : \"00\";\n\n if (granularity === \"second\" && hasMinute && \"second\" in dateValue) {\n const second = String((dateValue as { second: number }).second).padStart(2, \"0\");\n return `${year}-${month}-${day}T${hour}:${minute}:${second}`;\n }\n\n return `${year}-${month}-${day}T${hour}:${minute}`;\n}\n\nexport function HiddenDateInput(props: HiddenDateInputProps): JSX.Element {\n const granularity = () => props.granularity ?? \"day\";\n const hasValidationBehavior = () => props.validationBehavior != null;\n const validationBehavior = () => props.validationBehavior;\n const usesNativeValidation = () => validationBehavior() === \"native\";\n const value = () => accessValue(props.value);\n const minValue = () => accessValue(props.minValue);\n const maxValue = () => accessValue(props.maxValue);\n const hasTimeZoneValue = () =>\n Boolean(\n (value() && \"timeZone\" in value()!) ||\n (minValue() && \"timeZone\" in minValue()!) ||\n (maxValue() && \"timeZone\" in maxValue()!),\n );\n const inputType = () =>\n usesNativeValidation()\n ? \"text\"\n : hasValidationBehavior()\n ? \"hidden\"\n : hasTimeZoneValue()\n ? \"hidden\"\n : granularity() === \"day\"\n ? \"date\"\n : \"datetime-local\";\n const formattedValue = () => formatDateValue(value(), granularity());\n const formattedMin = () => formatDateValue(minValue(), granularity());\n const formattedMax = () => formatDateValue(maxValue(), granularity());\n\n const [inputRef, setInputRef] = createSignal<HTMLInputElement>();\n\n if (props.validationState) {\n createFormValidation(\n {\n get validationBehavior() {\n return validationBehavior();\n },\n get focus() {\n return props.focus;\n },\n },\n props.validationState,\n inputRef,\n );\n }\n\n createEffect(() => {\n const val = formattedValue();\n const input = inputRef();\n if (input && input.value !== val) {\n input.value = val;\n }\n });\n\n return (\n <input\n ref={(el) => {\n setInputRef(el);\n }}\n type={inputType()}\n name={props.name}\n form={props.form}\n value={formattedValue()}\n autocomplete={props.autoComplete}\n disabled={props.isDisabled}\n required={usesNativeValidation() && props.isRequired ? true : undefined}\n hidden={usesNativeValidation() || undefined}\n min={hasValidationBehavior() ? undefined : formattedMin() || undefined}\n max={hasValidationBehavior() ? undefined : formattedMax() || undefined}\n onChange={usesNativeValidation() ? () => {} : undefined}\n tabIndex={-1}\n aria-hidden=\"true\"\n style={\n {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n \"white-space\": \"nowrap\",\n \"border-width\": \"0\",\n } as JSX.CSSProperties\n }\n />\n );\n}\n","import { createContext, useContext } from \"solid-js\";\nimport { type createDateRangePicker } from \"@proyecto-viviana/solidaria\";\nimport {\n type DateFieldState,\n type DateValue,\n type RangeCalendarState,\n} from \"@proyecto-viviana/solid-stately\";\n\nexport interface DateRangePickerFieldContextValue {\n state: DateFieldState<DateValue>;\n aria: {\n labelProps: Record<string, unknown>;\n inputProps: Record<string, unknown>;\n descriptionProps: Record<string, unknown>;\n errorMessageProps: Record<string, unknown>;\n };\n}\n\nexport interface DateRangePickerContextValue {\n calendarState: RangeCalendarState<DateValue>;\n startFieldState: DateFieldState<DateValue>;\n endFieldState: DateFieldState<DateValue>;\n startFieldContext: DateRangePickerFieldContextValue;\n endFieldContext: DateRangePickerFieldContextValue;\n overlayState: {\n isOpen: boolean;\n open: () => void;\n close: () => void;\n toggle: () => void;\n };\n triggerRef: () => HTMLElement | null;\n setTriggerRef: (element: HTMLElement | null) => void;\n pickerAria: ReturnType<typeof createDateRangePicker>;\n}\n\nexport const DateRangePickerContext = createContext<DateRangePickerContextValue | null>(null);\n\nexport function useDateRangePickerContext(): DateRangePickerContextValue {\n const context = useContext(DateRangePickerContext);\n if (!context) {\n throw new Error(\"DateRangePicker components must be used within a DateRangePicker\");\n }\n return context;\n}\n","/**\n * DateField component for solidaria-components\n *\n * Pre-wired headless date field component with segment-based editing.\n * Port of react-aria-components/src/DateField.tsx\n */\n\nimport {\n type JSX,\n type Context,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n splitProps,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport {\n createDateField,\n createDateSegment,\n type AriaDateFieldProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createDateFieldState,\n access,\n type DateFieldState,\n type DateFieldStateProps,\n type DateSegment as DateSegmentType,\n type CalendarDate,\n type DateValue,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n dataAttr,\n useIsHydrated,\n Provider,\n} from \"./utils\";\nimport { TextContext } from \"./Text\";\nimport { HiddenDateInput } from \"./HiddenDateInput\";\nimport { FormContext, type FormProps } from \"./Form\";\nimport {\n DateRangePickerContext,\n type DateRangePickerFieldContextValue,\n} from \"./DateRangePickerContext\";\n\nexport interface DateFieldRenderProps {\n /** Whether the field is disabled. */\n isDisabled: boolean;\n /** Whether the field is read-only. */\n isReadOnly: boolean;\n /** Whether the field is required. */\n isRequired: boolean;\n /** Whether the field is invalid. */\n isInvalid: boolean;\n}\n\nexport interface DateFieldProps<T extends DateValue = DateValue>\n extends\n Omit<AriaDateFieldProps, \"id\" | \"isDisabled\" | \"isReadOnly\" | \"isRequired\">,\n Omit<DateFieldStateProps<T>, \"locale\">,\n SlotProps {\n /** The children of the component. */\n children?: JSX.Element | ((segment: DateSegmentType) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<DateFieldRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<DateFieldRenderProps>;\n /** The locale to use for formatting. */\n locale?: string;\n}\n\nexport interface DateInputRenderProps {\n /** Whether the input is disabled. */\n isDisabled: boolean;\n /** Whether the input is focused. */\n isFocused: boolean;\n}\n\nexport interface DateInputProps extends SlotProps {\n /** The children of the component (render function receiving segments). */\n children?: (segment: DateSegmentType) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<DateInputRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<DateInputRenderProps>;\n /** Handler called during the pointer down capture phase. */\n onPointerDownCapture?: JSX.EventHandler<HTMLDivElement, PointerEvent>;\n}\n\nexport interface DateSegmentRenderProps {\n /** Whether the segment is focused. */\n isFocused: boolean;\n /** Whether the segment is editable. */\n isEditable: boolean;\n /** Whether the segment is a placeholder. */\n isPlaceholder: boolean;\n /** The segment type. */\n type: DateSegmentType[\"type\"];\n /** The text to display. */\n text: string;\n}\n\nexport interface DateSegmentProps extends SlotProps {\n /** The segment data. */\n segment: DateSegmentType;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<DateSegmentRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<DateSegmentRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<DateSegmentRenderProps>;\n}\n\nexport interface DateFieldContextValue {\n state: DateFieldState<DateValue>;\n aria: {\n labelProps: Record<string, unknown>;\n inputProps: Record<string, unknown>;\n descriptionProps: Record<string, unknown>;\n errorMessageProps: Record<string, unknown>;\n };\n}\n\nexport const DateFieldContext = createContext<DateFieldContextValue | null>(null);\nexport const DateFieldStateContext = createContext<DateFieldState<DateValue> | null>(null);\n\nfunction withFormValidationBehavior<P extends object>(props: P, formContext: FormProps | null): P {\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 function useDateFieldContext(): DateFieldContextValue {\n const context = useContext(DateFieldContext);\n if (!context) {\n throw new Error(\"DateField components must be used within a DateField\");\n }\n return context;\n}\n\nfunction useDateInputContext(\n slot?: string,\n): DateFieldContextValue | DateRangePickerFieldContextValue {\n const dateFieldContext = useContext(DateFieldContext);\n if (dateFieldContext) {\n return dateFieldContext;\n }\n\n const dateRangePickerContext = useContext(DateRangePickerContext);\n if (dateRangePickerContext && slot === \"start\") {\n return dateRangePickerContext.startFieldContext;\n }\n if (dateRangePickerContext && slot === \"end\") {\n return dateRangePickerContext.endFieldContext;\n }\n\n throw new Error(\"DateInput components must be used within a DateField or DateRangePicker slot\");\n}\n\n/**\n * A date field allows users to enter and edit date values using a keyboard.\n *\n * @example\n * ```tsx\n * <DateField label=\"Date\">\n * <Label>Date</Label>\n * <DateInput>\n * {(segment) => <DateSegment segment={segment} />}\n * </DateInput>\n * </DateField>\n * ```\n */\nexport function DateField<T extends DateValue = CalendarDate>(\n props: DateFieldProps<T>,\n): JSX.Element {\n // Use hydration-safe pattern for client-only rendering\n const isHydrated = useIsHydrated();\n const formContext = useContext(FormContext);\n\n return (\n <Show\n when={isHydrated()}\n fallback={\n <div class=\"solidaria-DateField solidaria-DateField--placeholder\" aria-hidden=\"true\" />\n }\n >\n <DateFieldInner {...props} __formContext={formContext} />\n </Show>\n );\n}\n\ntype DateFieldInnerProps<T extends DateValue = DateValue> = DateFieldProps<T> & {\n __formContext?: FormProps | null;\n};\n\n/**\n * Internal DateField component that renders after client mount.\n */\nfunction DateFieldInner<T extends DateValue = CalendarDate>(\n props: DateFieldInnerProps<T>,\n): JSX.Element {\n const formContext = props.__formContext ?? useContext(FormContext);\n const mergedProps = withFormValidationBehavior(props, formContext);\n const [local, stateProps, rest] = splitProps(\n mergedProps,\n [\"children\", \"class\", \"style\", \"slot\", \"__formContext\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"minValue\",\n \"maxValue\",\n \"isInvalid\",\n \"isDisabled\",\n \"isReadOnly\",\n \"isRequired\",\n \"locale\",\n \"granularity\",\n \"hourCycle\",\n \"hideTimeZone\",\n \"placeholderValue\",\n \"shouldForceLeadingZeros\",\n \"validationState\",\n \"validationBehavior\",\n \"validate\",\n \"description\",\n \"errorMessage\",\n \"isDateUnavailable\",\n ],\n );\n\n const [fieldRef, setFieldRef] = createSignal<HTMLDivElement | null>(null);\n\n const state = createDateFieldState(stateProps);\n\n const fieldAria = createDateField(\n () => ({\n ...(rest as Record<string, unknown>),\n description: stateProps.description,\n errorMessage: stateProps.errorMessage,\n }),\n state as unknown as DateFieldState<DateValue>,\n fieldRef,\n );\n\n const renderValues = createMemo<DateFieldRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isReadOnly: state.isReadOnly(),\n isRequired: state.isRequired(),\n isInvalid: state.isInvalid(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-DateField\",\n },\n renderValues,\n );\n\n const validationBehavior = () =>\n (stateProps as { validationBehavior?: \"aria\" | \"native\" }).validationBehavior ??\n formContext?.validationBehavior ??\n \"native\";\n\n const textSlots = {\n slots: {\n get description() {\n return fieldAria.descriptionProps;\n },\n get errorMessage() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n return (\n <DateFieldStateContext.Provider value={state as unknown as DateFieldState<DateValue>}>\n <DateFieldContext.Provider\n value={{\n state: state as unknown as DateFieldState<DateValue>,\n aria: {\n labelProps: fieldAria.labelProps,\n inputProps: fieldAria.inputProps,\n descriptionProps: fieldAria.descriptionProps,\n errorMessageProps: fieldAria.errorMessageProps,\n },\n }}\n >\n <div\n ref={setFieldRef}\n {...fieldAria.fieldProps}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n <Show when={(rest as Record<string, unknown>).name}>\n <HiddenDateInput\n name={(rest as Record<string, unknown>).name as string | undefined}\n form={(rest as Record<string, unknown>).form as string | undefined}\n value={state.value()}\n autoComplete={(rest as Record<string, unknown>).autoComplete as string | undefined}\n isDisabled={state.isDisabled()}\n isRequired={state.isRequired()}\n validationBehavior={validationBehavior()}\n validationState={state}\n focus={() => {\n fieldRef()?.querySelector<HTMLElement>('[role=\"spinbutton\"]')?.focus();\n }}\n minValue={access(stateProps.minValue) as DateValue | undefined}\n maxValue={access(stateProps.maxValue) as DateValue | undefined}\n granularity={state.granularity}\n />\n </Show>\n </DateFieldContext.Provider>\n </DateFieldStateContext.Provider>\n );\n}\n\n/**\n * The input area containing date segments.\n */\nexport function DateInput(props: DateInputProps): JSX.Element {\n const context = useDateInputContext(props.slot);\n const { state, aria } = context;\n const [isFocused, setIsFocused] = createSignal(false);\n const [inputRef, setInputRef] = createSignal<HTMLDivElement | null>(null);\n\n const renderValues = createMemo<DateInputRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isFocused: isFocused(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: props.class,\n style: props.style,\n defaultClassName: \"solidaria-DateInput\",\n },\n renderValues,\n );\n\n createEffect(() => {\n const element = inputRef();\n const handler = props.onPointerDownCapture;\n if (!element || !handler) return;\n\n const listener = (event: PointerEvent) =>\n (handler as unknown as (event: PointerEvent) => void)(event);\n element.addEventListener(\"pointerdown\", listener, { capture: true });\n onCleanup(() => element.removeEventListener(\"pointerdown\", listener, { capture: true }));\n });\n\n return (\n <DateFieldContext.Provider value={context as DateFieldContextValue}>\n <div\n ref={setInputRef}\n {...aria.inputProps}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-focused={dataAttr(isFocused())}\n onFocusIn={() => setIsFocused(true)}\n onFocusOut={() => setIsFocused(false)}\n >\n <For each={state.segments()}>{(segment) => props.children?.(segment)}</For>\n </div>\n </DateFieldContext.Provider>\n );\n}\n\n/**\n * A segment of a date field (year, month, day, etc.).\n */\nexport function DateSegment(props: DateSegmentProps): JSX.Element {\n const { state } = useDateFieldContext();\n const [segmentRef, setSegmentRef] = createSignal<HTMLElement | null>(null);\n\n const segmentAria = createDateSegment({ segment: props.segment }, state, segmentRef);\n\n const renderValues = createMemo<DateSegmentRenderProps>(() => ({\n isFocused: segmentAria.isFocused,\n isEditable: segmentAria.isEditable,\n isPlaceholder: segmentAria.isPlaceholder,\n type: props.segment.type,\n text: segmentAria.text,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: props.class,\n style: props.style,\n defaultClassName: \"solidaria-DateSegment\",\n },\n renderValues,\n );\n\n // Determine children content - avoid Show for SSR hydration compatibility\n const getChildren = () => {\n if (typeof props.children === \"function\") {\n return renderProps.renderChildren();\n }\n return segmentAria.text;\n };\n\n return (\n <span\n ref={setSegmentRef}\n {...segmentAria.segmentProps}\n class={renderProps.class()}\n style={renderProps.style()}\n data-focused={dataAttr(segmentAria.isFocused)}\n data-editable={dataAttr(segmentAria.isEditable)}\n data-placeholder={dataAttr(segmentAria.isPlaceholder)}\n data-type={props.segment.type}\n >\n {getChildren()}\n </span>\n );\n}\n\nexport interface DateFieldLabelProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function DateFieldLabel(props: DateFieldLabelProps): JSX.Element {\n const { aria } = useDateFieldContext();\n return (\n <span {...aria.labelProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface DateFieldDescriptionProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function DateFieldDescription(props: DateFieldDescriptionProps): JSX.Element {\n const { aria } = useDateFieldContext();\n return (\n <p {...aria.descriptionProps} class={props.class}>\n {props.children}\n </p>\n );\n}\n\nexport interface DateFieldErrorMessageProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function DateFieldErrorMessage(props: DateFieldErrorMessageProps): JSX.Element {\n const { aria } = useDateFieldContext();\n return (\n <p {...aria.errorMessageProps} class={props.class}>\n {props.children}\n </p>\n );\n}\n\nexport type { DateFieldState, DateSegmentType };\n"],"mappings":";;;;;;;;;;;;;;;AA2BA,SAASqB,YAAeV,OAAoD;CAC1E,OAAO,OAAOA,UAAU,aAAcA,MAAkB,IAAIA;AAC9D;AAEA,SAASW,gBACPX,OACAS,aACQ;CACR,IAAI,CAACT,OAAO,OAAO;CAEnB,IAAI,cAAcA,OAChB,OAAOY,OAAOZ,KAAK;CAGrB,MAAMa,YAAYb;CAElB,MAAMc,OAAOF,OAAOC,UAAUC,IAAI,CAAC,CAACC,SAAS,GAAG,GAAG;CACnD,MAAMC,QAAQJ,OAAOC,UAAUG,KAAK,CAAC,CAACD,SAAS,GAAG,GAAG;CACrD,MAAME,MAAML,OAAOC,UAAUI,GAAG,CAAC,CAACF,SAAS,GAAG,GAAG;CAEjD,IAAIN,gBAAgB,OAClB,OAAO,GAAGK,KAAI,GAAIE,MAAK,GAAIC;CAG7B,MAAMC,UAAU,UAAUL;CAC1B,MAAMM,OAAOD,UAAUN,OAAQC,UAA+BM,IAAI,CAAC,CAACJ,SAAS,GAAG,GAAG,IAAI;CACvF,MAAMK,YAAYF,WAAW,YAAYL;CACzC,MAAMQ,SAASD,YACXR,OAAQC,UAAiCQ,MAAM,CAAC,CAACN,SAAS,GAAG,GAAG,IAChE;CAEJ,I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AoD,OAAAzE,iBACSjD,KAAKI,kBAAgB,EAAA,KAAA,WAAA;GAAA,OAASK,MAAM3B;EAAK,EAAA,CAAA,GAAA,OAAA,IAAA;EAAA8F,OAAA8C,aAC7CjH,MAAM9B,QAAQ;EAAAmG,mBAAA;EAAA,OAAA4C;CAAA,EAAA,CAAA;AAGrB;AAOA,SAAgBG,sBAAsBpH,OAAgD;CACpF,MAAM,EAAET,SAASgC,oBAAoB;CACrC,cAAA;EAAA,IAAA8F,QAAAhF,eAAA6E,OAAA;EAAArD,OAAAwD,OAAA7E,iBACSjD,KAAKK,mBAAiB,EAAA,KAAA,WAAA;GAAA,OAASI,MAAM3B;EAAK,EAAA,CAAA,GAAA,OAAA,IAAA;EAAA8F,OAAAkD,aAC9CrH,MAAM9B,QAAQ;EAAAmG,mBAAA;EAAA,OAAAgD;CAAA,EAAA,CAAA;AAGrB"}
|
|
1
|
+
{"version":3,"file":"DateField2.js","names":["createContext","useContext","createDateRangePicker","DateFieldState","DateValue","RangeCalendarState","DateRangePickerFieldContextValue","state","aria","labelProps","Record","inputProps","hiddenInputProps","descriptionProps","errorMessageProps","DateRangePickerContextValue","calendarState","startFieldState","endFieldState","startFieldContext","endFieldContext","overlayState","isOpen","open","close","toggle","triggerRef","HTMLElement","setTriggerRef","element","pickerAria","ReturnType","DateRangePickerContext","useDateRangePickerContext","context","Error","JSX","Context","createContext","createEffect","createMemo","createSignal","onCleanup","splitProps","useContext","Index","Show","createDateField","createDateSegment","createFocusRing","createHover","createVisuallyHidden","mergeProps","AriaDateFieldProps","parseDate","parseDateTime","toCalendarDate","toCalendarDateTime","toLocalTimeZone","createDateFieldState","access","DateFieldState","DateFieldStateProps","DateSegment","DateSegmentType","CalendarDate","DateValue","RenderChildren","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","dataAttr","useIsHydrated","Provider","TextContext","FormContext","FormProps","DateRangePickerContext","DateRangePickerFieldContextValue","DateFieldRenderProps","isDisabled","isReadOnly","isRequired","isInvalid","DateFieldProps","Omit","T","children","Element","segment","class","style","locale","DateInputRenderProps","isFocused","DateInputProps","onPointerDownCapture","EventHandler","HTMLDivElement","PointerEvent","DateSegmentRenderProps","isHovered","isFocusVisible","isPlaceholder","type","text","DateSegmentProps","DateFieldContextValue","state","aria","labelProps","Record","inputProps","hiddenInputProps","descriptionProps","errorMessageProps","DateFieldContext","DateFieldStateContext","withFormValidationBehavior","props","P","formContext","validationBehavior","Proxy","get","target","property","receiver","localValue","Reflect","undefined","has","ownKeys","keys","Set","add","Array","from","getOwnPropertyDescriptor","descriptor","enumerable","configurable","useDateFieldContext","context","Error","useDateInputContext","slot","dateFieldContext","dateRangePickerContext","startFieldContext","endFieldContext","DateField","isHydrated","_$createComponent","when","fallback","_$getNextElement","_tmpl$","DateFieldInner","_$mergeProps","__formContext","DateFieldInnerProps","mergedProps","local","stateProps","rest","fieldRef","setFieldRef","validationInputRef","setValidationInputRef","HTMLInputElement","fieldAria","description","errorMessage","inputRef","renderValues","renderProps","defaultClassName","textSlots","slots","value","fieldProps","ref","_el$2","_tmpl$2","_$use","_$insert","values","_$effect","_p$","_v$","_v$2","_v$3","_v$4","_v$5","_v$6","e","_$className","t","_$style","a","_$setAttribute","o","i","n","RootHiddenDateInput","autoComplete","name","HIDDEN_DATE_SEGMENTS","HIDDEN_TIME_SEGMENTS","HIDDEN_GRANULARITY_MAP","hour","minute","second","RootHiddenDateInputProps","visuallyHiddenProps","position","top","left","granularity","inputStep","g","inputType","dateValue","toString","onChange","Event","event","targetString","currentTarget","targetValue","timeSegments","includes","slice","setSegment","setValue","_el$3","_tmpl$3","_el$4","firstChild","_$spread","addEventListener","_v$7","_v$8","_v$9","_v$0","_v$1","_$setProperty","_$runHydrationEvents","DateInput","setIsFocused","setInputRef","inputDivProps","onFocusIn","onFocusOut","element","handler","listener","capture","removeEventListener","_el$5","data-disabled","data-focused","each","segments","liveSegment","_t","key","PropertyKey","_el$6","_tmpl$4","InputHTMLAttributes","segmentRef","setSegmentRef","HTMLElement","segmentAria","focusProps","hoverProps","getChildren","renderChildren","segmentElementProps","segmentProps","_el$7","_tmpl$5","data-placeholder","data-invalid","data-readonly","data-type","data-hovered","data-focus-visible","DateFieldLabelProps","DateFieldLabel","_el$8","DateFieldDescriptionProps","DateFieldDescription","_el$9","DateFieldErrorMessageProps","DateFieldErrorMessage","_el$0"],"sources":["../src/DateRangePickerContext.tsx","../src/DateField.tsx"],"sourcesContent":["import { createContext, useContext } from \"solid-js\";\nimport { type createDateRangePicker } from \"@proyecto-viviana/solidaria\";\nimport {\n type DateFieldState,\n type DateValue,\n type RangeCalendarState,\n} from \"@proyecto-viviana/solid-stately\";\n\nexport interface DateRangePickerFieldContextValue {\n state: DateFieldState<DateValue>;\n aria: {\n labelProps: Record<string, unknown>;\n inputProps: Record<string, unknown>;\n /** Optional hidden validation <input> props (unused by the range fields). */\n hiddenInputProps?: Record<string, unknown>;\n descriptionProps: Record<string, unknown>;\n errorMessageProps: Record<string, unknown>;\n };\n}\n\nexport interface DateRangePickerContextValue {\n calendarState: RangeCalendarState<DateValue>;\n startFieldState: DateFieldState<DateValue>;\n endFieldState: DateFieldState<DateValue>;\n startFieldContext: DateRangePickerFieldContextValue;\n endFieldContext: DateRangePickerFieldContextValue;\n overlayState: {\n isOpen: boolean;\n open: () => void;\n close: () => void;\n toggle: () => void;\n };\n triggerRef: () => HTMLElement | null;\n setTriggerRef: (element: HTMLElement | null) => void;\n pickerAria: ReturnType<typeof createDateRangePicker>;\n}\n\nexport const DateRangePickerContext = createContext<DateRangePickerContextValue | null>(null);\n\nexport function useDateRangePickerContext(): DateRangePickerContextValue {\n const context = useContext(DateRangePickerContext);\n if (!context) {\n throw new Error(\"DateRangePicker components must be used within a DateRangePicker\");\n }\n return context;\n}\n","/**\n * DateField component for solidaria-components\n *\n * Pre-wired headless date field component with segment-based editing.\n * Port of react-aria-components/src/DateField.tsx\n */\n\nimport {\n type JSX,\n type Context,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n splitProps,\n useContext,\n Index,\n Show,\n} from \"solid-js\";\nimport {\n createDateField,\n createDateSegment,\n createFocusRing,\n createHover,\n createVisuallyHidden,\n mergeProps,\n type AriaDateFieldProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n parseDate,\n parseDateTime,\n toCalendarDate,\n toCalendarDateTime,\n toLocalTimeZone,\n} from \"@internationalized/date\";\nimport {\n createDateFieldState,\n access,\n type DateFieldState,\n type DateFieldStateProps,\n type DateSegment as DateSegmentType,\n type CalendarDate,\n type DateValue,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n dataAttr,\n useIsHydrated,\n Provider,\n} from \"./utils\";\nimport { TextContext } from \"./Text\";\nimport { FormContext, type FormProps } from \"./Form\";\nimport {\n DateRangePickerContext,\n type DateRangePickerFieldContextValue,\n} from \"./DateRangePickerContext\";\n\nexport interface DateFieldRenderProps {\n /** Whether the field is disabled. */\n isDisabled: boolean;\n /** Whether the field is read-only. */\n isReadOnly: boolean;\n /** Whether the field is required. */\n isRequired: boolean;\n /** Whether the field is invalid. */\n isInvalid: boolean;\n}\n\nexport interface DateFieldProps<T extends DateValue = DateValue>\n extends\n Omit<AriaDateFieldProps, \"id\" | \"isDisabled\" | \"isReadOnly\" | \"isRequired\">,\n Omit<DateFieldStateProps<T>, \"locale\">,\n SlotProps {\n /** The children of the component. */\n children?: JSX.Element | ((segment: DateSegmentType) => JSX.Element);\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<DateFieldRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<DateFieldRenderProps>;\n /** The locale to use for formatting. */\n locale?: string;\n}\n\nexport interface DateInputRenderProps {\n /** Whether the input is disabled. */\n isDisabled: boolean;\n /** Whether the input is focused. */\n isFocused: boolean;\n}\n\nexport interface DateInputProps extends SlotProps {\n /** The children of the component (render function receiving segments). */\n children?: (segment: DateSegmentType) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<DateInputRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<DateInputRenderProps>;\n /** Handler called during the pointer down capture phase. */\n onPointerDownCapture?: JSX.EventHandler<HTMLDivElement, PointerEvent>;\n}\n\nexport interface DateSegmentRenderProps {\n /** Whether the segment is hovered. */\n isHovered: boolean;\n /** Whether the segment is focused. */\n isFocused: boolean;\n /** Whether the segment is keyboard focused. */\n isFocusVisible: boolean;\n /** Whether the segment is a placeholder. */\n isPlaceholder: boolean;\n /** Whether the segment is read only. */\n isReadOnly: boolean;\n /** Whether the segment is disabled. */\n isDisabled: boolean;\n /** Whether the segment is invalid. */\n isInvalid: boolean;\n /** The segment type. */\n type: DateSegmentType[\"type\"];\n /** The text to display. */\n text: string;\n}\n\nexport interface DateSegmentProps extends SlotProps {\n /** The segment data. */\n segment: DateSegmentType;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<DateSegmentRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<DateSegmentRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<DateSegmentRenderProps>;\n}\n\nexport interface DateFieldContextValue {\n state: DateFieldState<DateValue>;\n aria: {\n labelProps: Record<string, unknown>;\n inputProps: Record<string, unknown>;\n // The hidden validation <input> props (native type/required/onChange). Only\n // the standalone DateField provides these; DatePicker/DateRangePicker manage\n // their own hidden inputs, so this stays optional and its <input> is gated.\n hiddenInputProps?: Record<string, unknown>;\n descriptionProps: Record<string, unknown>;\n errorMessageProps: Record<string, unknown>;\n };\n}\n\nexport const DateFieldContext = createContext<DateFieldContextValue | null>(null);\nexport const DateFieldStateContext = createContext<DateFieldState<DateValue> | null>(null);\n\nfunction withFormValidationBehavior<P extends object>(props: P, formContext: FormProps | null): P {\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 function useDateFieldContext(): DateFieldContextValue {\n const context = useContext(DateFieldContext);\n if (!context) {\n throw new Error(\"DateField components must be used within a DateField\");\n }\n return context;\n}\n\nfunction useDateInputContext(\n slot?: string,\n): DateFieldContextValue | DateRangePickerFieldContextValue {\n const dateFieldContext = useContext(DateFieldContext);\n if (dateFieldContext) {\n return dateFieldContext;\n }\n\n const dateRangePickerContext = useContext(DateRangePickerContext);\n if (dateRangePickerContext && slot === \"start\") {\n return dateRangePickerContext.startFieldContext;\n }\n if (dateRangePickerContext && slot === \"end\") {\n return dateRangePickerContext.endFieldContext;\n }\n\n throw new Error(\"DateInput components must be used within a DateField or DateRangePicker slot\");\n}\n\n/**\n * A date field allows users to enter and edit date values using a keyboard.\n *\n * @example\n * ```tsx\n * <DateField label=\"Date\">\n * <Label>Date</Label>\n * <DateInput>\n * {(segment) => <DateSegment segment={segment} />}\n * </DateInput>\n * </DateField>\n * ```\n */\nexport function DateField<T extends DateValue = CalendarDate>(\n props: DateFieldProps<T>,\n): JSX.Element {\n // Use hydration-safe pattern for client-only rendering\n const isHydrated = useIsHydrated();\n const formContext = useContext(FormContext);\n\n return (\n <Show\n when={isHydrated()}\n fallback={\n <div class=\"solidaria-DateField solidaria-DateField--placeholder\" aria-hidden=\"true\" />\n }\n >\n <DateFieldInner {...props} __formContext={formContext} />\n </Show>\n );\n}\n\ntype DateFieldInnerProps<T extends DateValue = DateValue> = DateFieldProps<T> & {\n __formContext?: FormProps | null;\n};\n\n/**\n * Internal DateField component that renders after client mount.\n */\nfunction DateFieldInner<T extends DateValue = CalendarDate>(\n props: DateFieldInnerProps<T>,\n): JSX.Element {\n const formContext = props.__formContext ?? useContext(FormContext);\n const mergedProps = withFormValidationBehavior(props, formContext);\n const [local, stateProps, rest] = splitProps(\n mergedProps,\n [\"children\", \"class\", \"style\", \"slot\", \"__formContext\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"minValue\",\n \"maxValue\",\n \"isInvalid\",\n \"isDisabled\",\n \"isReadOnly\",\n \"isRequired\",\n \"locale\",\n \"granularity\",\n \"hourCycle\",\n \"hideTimeZone\",\n \"placeholderValue\",\n \"shouldForceLeadingZeros\",\n \"validationState\",\n \"validationBehavior\",\n \"validate\",\n \"description\",\n \"errorMessage\",\n \"isDateUnavailable\",\n ],\n );\n\n const [fieldRef, setFieldRef] = createSignal<HTMLDivElement | null>(null);\n // Ref to the hidden validation <input> (the DateInput's `<Input>` sibling).\n // RAC's DateField creates this ref, passes it to useDateField, and threads it\n // onto the <Input> via InputContext so useFormReset/useFormValidation target\n // that element. We mirror that: create it here, hand it to createDateField\n // below, and attach it to the same input through the context getter.\n const [validationInputRef, setValidationInputRef] =\n createSignal<HTMLInputElement | null>(null);\n\n const state = createDateFieldState(stateProps);\n\n const fieldAria = createDateField(\n () => ({\n ...(rest as Record<string, unknown>),\n // RAC threads the same props into both useDateFieldState and useDateField;\n // these live in `stateProps` here, so forward them so the field hook can\n // build aria-disabled and the native validation <input> (type/required).\n // access() unwraps the MaybeAccessor state-prop declarations.\n isDisabled: access(stateProps.isDisabled),\n isReadOnly: access(stateProps.isReadOnly),\n isRequired: access(stateProps.isRequired),\n // Mirror RAC DateField: validationBehavior ?? formValidationBehavior ??\n // 'native'. withFormValidationBehavior already folds the form default into\n // stateProps.validationBehavior; the last `?? 'native'` is the standalone\n // default that flips the hidden input to type=\"text\".\n validationBehavior: stateProps.validationBehavior ?? \"native\",\n description: stateProps.description,\n errorMessage: stateProps.errorMessage,\n // Form-reset + native constraint validation are wired onto this input by\n // createDateField (see its createFormReset/createFormValidation calls),\n // exactly as RAC's useDateField wires them onto props.inputRef.\n inputRef: () => validationInputRef() ?? undefined,\n }),\n state as unknown as DateFieldState<DateValue>,\n fieldRef,\n );\n\n const renderValues = createMemo<DateFieldRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isReadOnly: state.isReadOnly(),\n isRequired: state.isRequired(),\n isInvalid: state.isInvalid(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-DateField\",\n },\n renderValues,\n );\n\n const textSlots = {\n slots: {\n get description() {\n return fieldAria.descriptionProps;\n },\n get errorMessage() {\n return fieldAria.errorMessageProps;\n },\n },\n };\n\n return (\n <DateFieldStateContext.Provider value={state as unknown as DateFieldState<DateValue>}>\n <DateFieldContext.Provider\n value={{\n state: state as unknown as DateFieldState<DateValue>,\n // Read through getters so consumers see the LIVE memo values, not a\n // snapshot frozen at first render. `createDescription` appends the\n // value-description id via a deferred effect; the group's\n // aria-describedby only picks it up if the props stay reactive here.\n aria: {\n get labelProps() {\n return fieldAria.labelProps;\n },\n // The segment group props (role=\"group\", aria-labelledby, unicode-bidi\n // isolate style, arrow-key nav, focus-within handlers) are routed to the\n // DateInput element — mirroring RAC, where useDateField.fieldProps is\n // published through GroupContext and consumed by the DateInput <Group>.\n // The outer wrapper stays roleless.\n get inputProps() {\n return fieldAria.fieldProps;\n },\n // The REAL hidden validation input props (type/hidden/required/onChange\n // under native validation). Rendered as the DateInput's <input> sibling.\n // Thread the validation-input ref through here — mirroring RAC's\n // `[InputContext, {...inputProps, ref: inputRef}]` — so createDateField's\n // form-reset/validation wiring resolves to the mounted element.\n get hiddenInputProps() {\n return mergeProps(fieldAria.inputProps, { ref: setValidationInputRef });\n },\n get descriptionProps() {\n return fieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return fieldAria.errorMessageProps;\n },\n },\n }}\n >\n <div\n ref={setFieldRef}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-required={dataAttr(state.isRequired())}\n data-invalid={dataAttr(state.isInvalid())}\n >\n <Provider values={[[TextContext, textSlots]] as Array<[Context<unknown>, unknown]>}>\n {local.children as JSX.Element}\n </Provider>\n </div>\n {/*\n RAC renders <HiddenDateInput> UNCONDITIONALLY at the DateField root\n (react-aria-components DateField.mjs). It is NOT a validation input — it\n is a clipped, aria-hidden, tabIndex={-1} native date input that mirrors\n the value for browser autofill. Its `form=\"\"` detaches it from form\n submission (the DateInput's <Input> above is what submits), so it never\n double-counts in FormData. It renders regardless of `name` — hence no\n <Show> gate — which is why it appears in the focus trail as the trailing\n tabindex=\"-1\" element.\n */}\n <RootHiddenDateInput\n autoComplete={(rest as Record<string, unknown>).autoComplete as string | undefined}\n name={(rest as Record<string, unknown>).name as string | undefined}\n isDisabled={state.isDisabled()}\n state={state as unknown as DateFieldState<DateValue>}\n />\n </DateFieldContext.Provider>\n </DateFieldStateContext.Provider>\n );\n}\n\nconst HIDDEN_DATE_SEGMENTS: readonly string[] = [\"day\", \"month\", \"year\"];\nconst HIDDEN_TIME_SEGMENTS: readonly string[] = [\"hour\", \"minute\", \"second\"];\nconst HIDDEN_GRANULARITY_MAP: Record<string, number> = { hour: 1, minute: 2, second: 3 };\n\ninterface RootHiddenDateInputProps {\n autoComplete?: string;\n name?: string;\n isDisabled?: boolean;\n state: DateFieldState<DateValue>;\n}\n\n/**\n * The always-rendered hidden date input at the DateField root — a faithful port\n * of react-aria-components' HiddenDateInput (private/HiddenDateInput.mjs). It is\n * NOT a validation input: it is a clipped, aria-hidden, tabIndex={-1} native\n * date input that mirrors the current value for browser autofill. `form=\"\"`\n * detaches it from form submission (the DateInput's <Input> submits), so it\n * never double-counts in FormData. RAC renders it unconditionally, which is why\n * it appears as the trailing tabindex=\"-1\" element in the focus trail.\n */\nfunction RootHiddenDateInput(props: RootHiddenDateInputProps): JSX.Element {\n // RAC uses useVisuallyHidden with position:fixed/top:0/left:0 to keep the\n // clipped input from scrolling the page.\n const { visuallyHiddenProps } = createVisuallyHidden(() => ({\n style: { position: \"fixed\", top: \"0\", left: \"0\" },\n }));\n\n const granularity = () => props.state.granularity ?? \"day\";\n const inputStep = () => {\n const g = granularity();\n if (g === \"second\") return 1;\n if (g === \"hour\") return 3600;\n return 60;\n };\n const inputType = () => (granularity() === \"day\" ? \"date\" : \"datetime-local\");\n const dateValue = () => {\n const value = props.state.value();\n if (!value) return \"\";\n if (granularity() === \"day\") return toCalendarDate(value).toString();\n return toCalendarDateTime(\n \"timeZone\" in value ? toLocalTimeZone(value) : value,\n ).toString();\n };\n\n const onChange: JSX.EventHandler<HTMLInputElement, Event> = (event) => {\n const targetString = (event.currentTarget.value ?? \"\").toString();\n if (!targetString) return;\n try {\n const g = granularity();\n const targetValue = (g === \"day\" ? parseDate(targetString) : parseDateTime(targetString)) as\n unknown as Record<string, number>;\n let timeSegments = HIDDEN_TIME_SEGMENTS;\n if (HIDDEN_TIME_SEGMENTS.includes(g)) {\n timeSegments = HIDDEN_TIME_SEGMENTS.slice(0, HIDDEN_GRANULARITY_MAP[g]);\n }\n const state = props.state as unknown as {\n setSegment?: (type: string, value: number) => void;\n setValue: (value: unknown) => void;\n };\n // Only DateFieldState (not DatePickerState) exposes setSegment; validate\n // each parsed segment before committing the new value, mirroring RAC.\n if (typeof state.setSegment === \"function\") {\n for (const type in targetValue) {\n if (HIDDEN_DATE_SEGMENTS.includes(type)) state.setSegment(type, targetValue[type]);\n if (timeSegments.includes(type)) state.setSegment(type, targetValue[type]);\n }\n }\n state.setValue(targetValue);\n } catch {\n // ignore unparseable autofill values\n }\n };\n\n return (\n <div\n {...(visuallyHiddenProps() as unknown as Record<string, unknown>)}\n aria-hidden=\"true\"\n data-testid=\"hidden-dateinput-container\"\n >\n <input\n tabIndex={-1}\n autocomplete={props.autoComplete}\n disabled={props.isDisabled}\n type={inputType()}\n form=\"\"\n name={props.name}\n step={inputStep()}\n value={dateValue()}\n onChange={onChange}\n />\n </div>\n );\n}\n\n/**\n * The input area containing date segments.\n */\nexport function DateInput(props: DateInputProps): JSX.Element {\n const context = useDateInputContext(props.slot);\n const { state, aria } = context;\n const [isFocused, setIsFocused] = createSignal(false);\n const [inputRef, setInputRef] = createSignal<HTMLDivElement | null>(null);\n\n const renderValues = createMemo<DateInputRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isFocused: isFocused(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: props.class,\n style: props.style,\n defaultClassName: \"solidaria-DateInput\",\n },\n renderValues,\n );\n\n // The group props (role=\"group\", aria-labelledby, unicode-bidi:isolate,\n // arrow-key nav, focus-within handlers) carry the field's own `style` and\n // focus handlers. Merge — not clobber — so the group keeps its unicode-bidi\n // isolation and the local isFocused signal chains onto the field's\n // focusWithin handlers. Solid onFocus/onBlur do not bubble, so track focus\n // via onFocusIn/onFocusOut.\n const inputDivProps = createMemo(() =>\n mergeProps(aria.inputProps, {\n onFocusIn: () => setIsFocused(true),\n onFocusOut: () => setIsFocused(false),\n style: renderProps.style(),\n }),\n );\n\n createEffect(() => {\n const element = inputRef();\n const handler = props.onPointerDownCapture;\n if (!element || !handler) return;\n\n const listener = (event: PointerEvent) =>\n (handler as unknown as (event: PointerEvent) => void)(event);\n element.addEventListener(\"pointerdown\", listener, { capture: true });\n onCleanup(() => element.removeEventListener(\"pointerdown\", listener, { capture: true }));\n });\n\n return (\n <DateFieldContext.Provider value={context as DateFieldContextValue}>\n <div\n ref={setInputRef}\n {...inputDivProps()}\n class={renderProps.class()}\n data-disabled={dataAttr(state.isDisabled())}\n data-focused={dataAttr(isFocused())}\n >\n {/*\n <Index> keys by position, not identity, so each DateSegment instance\n stays alive across keystrokes (state.segments() re-mints segment\n objects every edit). A stable Proxy forwards property reads to the\n live per-index accessor so the child stays reactive.\n */}\n <Index each={state.segments()}>\n {(segment) => {\n const liveSegment = new Proxy({} as DateSegmentType, {\n get: (_t, key) => (segment() as unknown as Record<PropertyKey, unknown>)[key],\n has: (_t, key) => key in (segment() as object),\n });\n return props.children?.(liveSegment);\n }}\n </Index>\n </div>\n {/*\n The hidden validation input, sibling of the group — mirrors RAC's\n DateInputInner `<><Group/><Input/></>`. Under native validation\n (default) `useDateField` publishes it as `type=\"text\" hidden required`\n so browser constraint validation fires; under aria validation it stays\n `type=\"hidden\"`. Both carry the ISO value string. Only the standalone\n DateField supplies these props; inside a DatePicker/DateRangePicker the\n field is presentation and its owner renders the hidden input instead.\n */}\n <Show when={aria.hiddenInputProps}>\n {(hiddenInputProps) => (\n <input {...(hiddenInputProps() as JSX.InputHTMLAttributes<HTMLInputElement>)} />\n )}\n </Show>\n </DateFieldContext.Provider>\n );\n}\n\n/**\n * A segment of a date field (year, month, day, etc.).\n */\nexport function DateSegment(props: DateSegmentProps): JSX.Element {\n const { state } = useDateFieldContext();\n const [segmentRef, setSegmentRef] = createSignal<HTMLElement | null>(null);\n\n const segmentAria = createDateSegment(\n {\n get segment() {\n return props.segment;\n },\n },\n state,\n segmentRef,\n );\n\n // Mirror upstream DateSegment: focus/focus-visible come from useFocusRing()\n // and hover from useHover({isDisabled: field disabled || literal segment}).\n // Literals never hover; the field being disabled suppresses hover entirely.\n const { isFocused, isFocusVisible, focusProps } = createFocusRing();\n const { isHovered, hoverProps } = createHover(() => ({\n isDisabled: state.isDisabled() || props.segment.type === \"literal\",\n }));\n\n const renderValues = createMemo<DateSegmentRenderProps>(() => ({\n isHovered: isHovered(),\n isFocused: isFocused(),\n isFocusVisible: isFocusVisible(),\n isPlaceholder: props.segment.isPlaceholder,\n isReadOnly: state.isReadOnly(),\n isDisabled: state.isDisabled(),\n isInvalid: state.isInvalid(),\n type: props.segment.type,\n text: props.segment.text,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: props.class,\n style: props.style,\n defaultClassName: \"solidaria-DateSegment\",\n },\n renderValues,\n );\n\n // Determine children content - avoid Show for SSR hydration compatibility\n const getChildren = () => {\n if (typeof props.children === \"function\") {\n return renderProps.renderChildren();\n }\n return props.segment.text;\n };\n\n // Mirror upstream's `mergeProps(filterDOMProps(otherProps), segmentProps,\n // focusProps, hoverProps)`: the segment's behavior/style props (caretColor +\n // RTL direction) chain with the focus-ring and hover handlers so neither\n // clobbers the other.\n const segmentElementProps = createMemo(() =>\n mergeProps(\n segmentAria.segmentProps,\n focusProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n {\n style: renderProps.style(),\n },\n ),\n );\n\n return (\n <span\n ref={setSegmentRef}\n {...segmentElementProps()}\n class={renderProps.class()}\n data-placeholder={props.segment.isPlaceholder || undefined}\n data-invalid={state.isInvalid() || undefined}\n data-readonly={state.isReadOnly() || undefined}\n data-disabled={state.isDisabled() || undefined}\n data-type={props.segment.type}\n data-hovered={isHovered() || undefined}\n data-focused={isFocused() || undefined}\n data-focus-visible={isFocusVisible() || undefined}\n >\n {getChildren()}\n </span>\n );\n}\n\nexport interface DateFieldLabelProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function DateFieldLabel(props: DateFieldLabelProps): JSX.Element {\n const { aria } = useDateFieldContext();\n return (\n <span {...aria.labelProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface DateFieldDescriptionProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function DateFieldDescription(props: DateFieldDescriptionProps): JSX.Element {\n const { aria } = useDateFieldContext();\n return (\n <span {...aria.descriptionProps} class={props.class}>\n {props.children}\n </span>\n );\n}\n\nexport interface DateFieldErrorMessageProps {\n children?: JSX.Element;\n class?: string;\n}\n\nexport function DateFieldErrorMessage(props: DateFieldErrorMessageProps): JSX.Element {\n const { aria } = useDateFieldContext();\n return (\n <span {...aria.errorMessageProps} class={props.class}>\n {props.children}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A,OAAAkD;CAAA,EAAA,CAAA;AAGrB"}
|
package/dist/DateField2.jsx
CHANGED
|
@@ -1,76 +1,10 @@
|
|
|
1
1
|
import { Provider, dataAttr, useIsHydrated, useRenderProps } from "./utils.jsx";
|
|
2
2
|
import { TextContext } from "./Text.jsx";
|
|
3
3
|
import { FormContext } from "./Form.jsx";
|
|
4
|
-
import {
|
|
5
|
-
import { createDateField, createDateSegment,
|
|
4
|
+
import { Index, Show, createContext, createEffect, createMemo, createSignal, onCleanup, splitProps, useContext } from "solid-js";
|
|
5
|
+
import { createDateField, createDateSegment, createFocusRing, createHover, createVisuallyHidden, mergeProps as mergeProps$1 } from "@proyecto-viviana/solidaria";
|
|
6
6
|
import { access, createDateFieldState } from "@proyecto-viviana/solid-stately";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* HiddenDateInput component for solidaria-components
|
|
10
|
-
*
|
|
11
|
-
* A hidden native date/datetime-local input for form submission.
|
|
12
|
-
* Renders server-side with the initial value for SSR safety.
|
|
13
|
-
*/
|
|
14
|
-
function accessValue(value) {
|
|
15
|
-
return typeof value === "function" ? value() : value;
|
|
16
|
-
}
|
|
17
|
-
function formatDateValue(value, granularity) {
|
|
18
|
-
if (!value) return "";
|
|
19
|
-
if ("timeZone" in value) return String(value);
|
|
20
|
-
const dateValue = value;
|
|
21
|
-
const year = String(dateValue.year).padStart(4, "0");
|
|
22
|
-
const month = String(dateValue.month).padStart(2, "0");
|
|
23
|
-
const day = String(dateValue.day).padStart(2, "0");
|
|
24
|
-
if (granularity === "day") return `${year}-${month}-${day}`;
|
|
25
|
-
const hasHour = "hour" in dateValue;
|
|
26
|
-
const hour = hasHour ? String(dateValue.hour).padStart(2, "0") : "00";
|
|
27
|
-
const hasMinute = hasHour && "minute" in dateValue;
|
|
28
|
-
const minute = hasMinute ? String(dateValue.minute).padStart(2, "0") : "00";
|
|
29
|
-
if (granularity === "second" && hasMinute && "second" in dateValue) return `${year}-${month}-${day}T${hour}:${minute}:${String(dateValue.second).padStart(2, "0")}`;
|
|
30
|
-
return `${year}-${month}-${day}T${hour}:${minute}`;
|
|
31
|
-
}
|
|
32
|
-
function HiddenDateInput(props) {
|
|
33
|
-
const granularity = () => props.granularity ?? "day";
|
|
34
|
-
const hasValidationBehavior = () => props.validationBehavior != null;
|
|
35
|
-
const validationBehavior = () => props.validationBehavior;
|
|
36
|
-
const usesNativeValidation = () => validationBehavior() === "native";
|
|
37
|
-
const value = () => accessValue(props.value);
|
|
38
|
-
const minValue = () => accessValue(props.minValue);
|
|
39
|
-
const maxValue = () => accessValue(props.maxValue);
|
|
40
|
-
const hasTimeZoneValue = () => Boolean(value() && "timeZone" in value() || minValue() && "timeZone" in minValue() || maxValue() && "timeZone" in maxValue());
|
|
41
|
-
const inputType = () => usesNativeValidation() ? "text" : hasValidationBehavior() ? "hidden" : hasTimeZoneValue() ? "hidden" : granularity() === "day" ? "date" : "datetime-local";
|
|
42
|
-
const formattedValue = () => formatDateValue(value(), granularity());
|
|
43
|
-
const formattedMin = () => formatDateValue(minValue(), granularity());
|
|
44
|
-
const formattedMax = () => formatDateValue(maxValue(), granularity());
|
|
45
|
-
const [inputRef, setInputRef] = createSignal();
|
|
46
|
-
if (props.validationState) createFormValidation({
|
|
47
|
-
get validationBehavior() {
|
|
48
|
-
return validationBehavior();
|
|
49
|
-
},
|
|
50
|
-
get focus() {
|
|
51
|
-
return props.focus;
|
|
52
|
-
}
|
|
53
|
-
}, props.validationState, inputRef);
|
|
54
|
-
createEffect(() => {
|
|
55
|
-
const val = formattedValue();
|
|
56
|
-
const input = inputRef();
|
|
57
|
-
if (input && input.value !== val) input.value = val;
|
|
58
|
-
});
|
|
59
|
-
return <input ref={(el) => {
|
|
60
|
-
setInputRef(el);
|
|
61
|
-
}} type={inputType()} name={props.name} form={props.form} value={formattedValue()} autocomplete={props.autoComplete} disabled={props.isDisabled} required={usesNativeValidation() && props.isRequired ? true : void 0} hidden={usesNativeValidation() || void 0} min={hasValidationBehavior() ? void 0 : formattedMin() || void 0} max={hasValidationBehavior() ? void 0 : formattedMax() || void 0} onChange={usesNativeValidation() ? () => {} : void 0} tabIndex={-1} aria-hidden="true" style={{
|
|
62
|
-
position: "absolute",
|
|
63
|
-
width: "1px",
|
|
64
|
-
height: "1px",
|
|
65
|
-
padding: "0",
|
|
66
|
-
margin: "-1px",
|
|
67
|
-
overflow: "hidden",
|
|
68
|
-
clip: "rect(0, 0, 0, 0)",
|
|
69
|
-
"white-space": "nowrap",
|
|
70
|
-
"border-width": "0"
|
|
71
|
-
}} />;
|
|
72
|
-
}
|
|
73
|
-
//#endregion
|
|
7
|
+
import { parseDate, parseDateTime, toCalendarDate, toCalendarDateTime, toLocalTimeZone } from "@internationalized/date";
|
|
74
8
|
//#region src/DateRangePickerContext.tsx
|
|
75
9
|
const DateRangePickerContext = createContext(null);
|
|
76
10
|
function useDateRangePickerContext() {
|
|
@@ -152,8 +86,7 @@ function DateField(props) {
|
|
|
152
86
|
* Internal DateField component that renders after client mount.
|
|
153
87
|
*/
|
|
154
88
|
function DateFieldInner(props) {
|
|
155
|
-
const
|
|
156
|
-
const [local, stateProps, rest] = splitProps(withFormValidationBehavior(props, formContext), [
|
|
89
|
+
const [local, stateProps, rest] = splitProps(withFormValidationBehavior(props, props.__formContext ?? useContext(FormContext)), [
|
|
157
90
|
"children",
|
|
158
91
|
"class",
|
|
159
92
|
"style",
|
|
@@ -183,11 +116,17 @@ function DateFieldInner(props) {
|
|
|
183
116
|
"isDateUnavailable"
|
|
184
117
|
]);
|
|
185
118
|
const [fieldRef, setFieldRef] = createSignal(null);
|
|
119
|
+
const [validationInputRef, setValidationInputRef] = createSignal(null);
|
|
186
120
|
const state = createDateFieldState(stateProps);
|
|
187
121
|
const fieldAria = createDateField(() => ({
|
|
188
122
|
...rest,
|
|
123
|
+
isDisabled: access(stateProps.isDisabled),
|
|
124
|
+
isReadOnly: access(stateProps.isReadOnly),
|
|
125
|
+
isRequired: access(stateProps.isRequired),
|
|
126
|
+
validationBehavior: stateProps.validationBehavior ?? "native",
|
|
189
127
|
description: stateProps.description,
|
|
190
|
-
errorMessage: stateProps.errorMessage
|
|
128
|
+
errorMessage: stateProps.errorMessage,
|
|
129
|
+
inputRef: () => validationInputRef() ?? void 0
|
|
191
130
|
}), state, fieldRef);
|
|
192
131
|
const renderValues = createMemo(() => ({
|
|
193
132
|
isDisabled: state.isDisabled(),
|
|
@@ -200,7 +139,6 @@ function DateFieldInner(props) {
|
|
|
200
139
|
style: local.style,
|
|
201
140
|
defaultClassName: "solidaria-DateField"
|
|
202
141
|
}, renderValues);
|
|
203
|
-
const validationBehavior = () => stateProps.validationBehavior ?? formContext?.validationBehavior ?? "native";
|
|
204
142
|
const textSlots = { slots: {
|
|
205
143
|
get description() {
|
|
206
144
|
return fieldAria.descriptionProps;
|
|
@@ -213,25 +151,97 @@ function DateFieldInner(props) {
|
|
|
213
151
|
<DateFieldContext.Provider value={{
|
|
214
152
|
state,
|
|
215
153
|
aria: {
|
|
216
|
-
labelProps
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
154
|
+
get labelProps() {
|
|
155
|
+
return fieldAria.labelProps;
|
|
156
|
+
},
|
|
157
|
+
get inputProps() {
|
|
158
|
+
return fieldAria.fieldProps;
|
|
159
|
+
},
|
|
160
|
+
get hiddenInputProps() {
|
|
161
|
+
return mergeProps$1(fieldAria.inputProps, { ref: setValidationInputRef });
|
|
162
|
+
},
|
|
163
|
+
get descriptionProps() {
|
|
164
|
+
return fieldAria.descriptionProps;
|
|
165
|
+
},
|
|
166
|
+
get errorMessageProps() {
|
|
167
|
+
return fieldAria.errorMessageProps;
|
|
168
|
+
}
|
|
220
169
|
}
|
|
221
170
|
}}>
|
|
222
|
-
<div ref={setFieldRef}
|
|
171
|
+
<div ref={setFieldRef} class={renderProps.class()} style={renderProps.style()} data-disabled={dataAttr(state.isDisabled())} data-readonly={dataAttr(state.isReadOnly())} data-required={dataAttr(state.isRequired())} data-invalid={dataAttr(state.isInvalid())}>
|
|
223
172
|
<Provider values={[[TextContext, textSlots]]}>
|
|
224
173
|
{local.children}
|
|
225
174
|
</Provider>
|
|
226
175
|
</div>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
fieldRef()?.querySelector("[role=\"spinbutton\"]")?.focus();
|
|
230
|
-
}} minValue={access(stateProps.minValue)} maxValue={access(stateProps.maxValue)} granularity={state.granularity} />
|
|
231
|
-
</Show>
|
|
176
|
+
{}
|
|
177
|
+
<RootHiddenDateInput autoComplete={rest.autoComplete} name={rest.name} isDisabled={state.isDisabled()} state={state} />
|
|
232
178
|
</DateFieldContext.Provider>
|
|
233
179
|
</DateFieldStateContext.Provider>;
|
|
234
180
|
}
|
|
181
|
+
const HIDDEN_DATE_SEGMENTS = [
|
|
182
|
+
"day",
|
|
183
|
+
"month",
|
|
184
|
+
"year"
|
|
185
|
+
];
|
|
186
|
+
const HIDDEN_TIME_SEGMENTS = [
|
|
187
|
+
"hour",
|
|
188
|
+
"minute",
|
|
189
|
+
"second"
|
|
190
|
+
];
|
|
191
|
+
const HIDDEN_GRANULARITY_MAP = {
|
|
192
|
+
hour: 1,
|
|
193
|
+
minute: 2,
|
|
194
|
+
second: 3
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* The always-rendered hidden date input at the DateField root — a faithful port
|
|
198
|
+
* of react-aria-components' HiddenDateInput (private/HiddenDateInput.mjs). It is
|
|
199
|
+
* NOT a validation input: it is a clipped, aria-hidden, tabIndex={-1} native
|
|
200
|
+
* date input that mirrors the current value for browser autofill. `form=""`
|
|
201
|
+
* detaches it from form submission (the DateInput's <Input> submits), so it
|
|
202
|
+
* never double-counts in FormData. RAC renders it unconditionally, which is why
|
|
203
|
+
* it appears as the trailing tabindex="-1" element in the focus trail.
|
|
204
|
+
*/
|
|
205
|
+
function RootHiddenDateInput(props) {
|
|
206
|
+
const { visuallyHiddenProps } = createVisuallyHidden(() => ({ style: {
|
|
207
|
+
position: "fixed",
|
|
208
|
+
top: "0",
|
|
209
|
+
left: "0"
|
|
210
|
+
} }));
|
|
211
|
+
const granularity = () => props.state.granularity ?? "day";
|
|
212
|
+
const inputStep = () => {
|
|
213
|
+
const g = granularity();
|
|
214
|
+
if (g === "second") return 1;
|
|
215
|
+
if (g === "hour") return 3600;
|
|
216
|
+
return 60;
|
|
217
|
+
};
|
|
218
|
+
const inputType = () => granularity() === "day" ? "date" : "datetime-local";
|
|
219
|
+
const dateValue = () => {
|
|
220
|
+
const value = props.state.value();
|
|
221
|
+
if (!value) return "";
|
|
222
|
+
if (granularity() === "day") return toCalendarDate(value).toString();
|
|
223
|
+
return toCalendarDateTime("timeZone" in value ? toLocalTimeZone(value) : value).toString();
|
|
224
|
+
};
|
|
225
|
+
const onChange = (event) => {
|
|
226
|
+
const targetString = (event.currentTarget.value ?? "").toString();
|
|
227
|
+
if (!targetString) return;
|
|
228
|
+
try {
|
|
229
|
+
const g = granularity();
|
|
230
|
+
const targetValue = g === "day" ? parseDate(targetString) : parseDateTime(targetString);
|
|
231
|
+
let timeSegments = HIDDEN_TIME_SEGMENTS;
|
|
232
|
+
if (HIDDEN_TIME_SEGMENTS.includes(g)) timeSegments = HIDDEN_TIME_SEGMENTS.slice(0, HIDDEN_GRANULARITY_MAP[g]);
|
|
233
|
+
const state = props.state;
|
|
234
|
+
if (typeof state.setSegment === "function") for (const type in targetValue) {
|
|
235
|
+
if (HIDDEN_DATE_SEGMENTS.includes(type)) state.setSegment(type, targetValue[type]);
|
|
236
|
+
if (timeSegments.includes(type)) state.setSegment(type, targetValue[type]);
|
|
237
|
+
}
|
|
238
|
+
state.setValue(targetValue);
|
|
239
|
+
} catch {}
|
|
240
|
+
};
|
|
241
|
+
return <div {...visuallyHiddenProps()} aria-hidden="true" data-testid="hidden-dateinput-container">
|
|
242
|
+
<input tabIndex={-1} autocomplete={props.autoComplete} disabled={props.isDisabled} type={inputType()} form="" name={props.name} step={inputStep()} value={dateValue()} onChange={onChange} />
|
|
243
|
+
</div>;
|
|
244
|
+
}
|
|
235
245
|
/**
|
|
236
246
|
* The input area containing date segments.
|
|
237
247
|
*/
|
|
@@ -249,6 +259,11 @@ function DateInput(props) {
|
|
|
249
259
|
style: props.style,
|
|
250
260
|
defaultClassName: "solidaria-DateInput"
|
|
251
261
|
}, renderValues);
|
|
262
|
+
const inputDivProps = createMemo(() => mergeProps$1(aria.inputProps, {
|
|
263
|
+
onFocusIn: () => setIsFocused(true),
|
|
264
|
+
onFocusOut: () => setIsFocused(false),
|
|
265
|
+
style: renderProps.style()
|
|
266
|
+
}));
|
|
252
267
|
createEffect(() => {
|
|
253
268
|
const element = inputRef();
|
|
254
269
|
const handler = props.onPointerDownCapture;
|
|
@@ -258,9 +273,22 @@ function DateInput(props) {
|
|
|
258
273
|
onCleanup(() => element.removeEventListener("pointerdown", listener, { capture: true }));
|
|
259
274
|
});
|
|
260
275
|
return <DateFieldContext.Provider value={context}>
|
|
261
|
-
<div ref={setInputRef} {...
|
|
262
|
-
|
|
276
|
+
<div ref={setInputRef} {...inputDivProps()} class={renderProps.class()} data-disabled={dataAttr(state.isDisabled())} data-focused={dataAttr(isFocused())}>
|
|
277
|
+
{}
|
|
278
|
+
<Index each={state.segments()}>
|
|
279
|
+
{(segment) => {
|
|
280
|
+
const liveSegment = new Proxy({}, {
|
|
281
|
+
get: (_t, key) => segment()[key],
|
|
282
|
+
has: (_t, key) => key in segment()
|
|
283
|
+
});
|
|
284
|
+
return props.children?.(liveSegment);
|
|
285
|
+
}}
|
|
286
|
+
</Index>
|
|
263
287
|
</div>
|
|
288
|
+
{}
|
|
289
|
+
<Show when={aria.hiddenInputProps}>
|
|
290
|
+
{(hiddenInputProps) => <input {...hiddenInputProps()} />}
|
|
291
|
+
</Show>
|
|
264
292
|
</DateFieldContext.Provider>;
|
|
265
293
|
}
|
|
266
294
|
/**
|
|
@@ -269,13 +297,21 @@ function DateInput(props) {
|
|
|
269
297
|
function DateSegment(props) {
|
|
270
298
|
const { state } = useDateFieldContext();
|
|
271
299
|
const [segmentRef, setSegmentRef] = createSignal(null);
|
|
272
|
-
const segmentAria = createDateSegment({
|
|
300
|
+
const segmentAria = createDateSegment({ get segment() {
|
|
301
|
+
return props.segment;
|
|
302
|
+
} }, state, segmentRef);
|
|
303
|
+
const { isFocused, isFocusVisible, focusProps } = createFocusRing();
|
|
304
|
+
const { isHovered, hoverProps } = createHover(() => ({ isDisabled: state.isDisabled() || props.segment.type === "literal" }));
|
|
273
305
|
const renderValues = createMemo(() => ({
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
306
|
+
isHovered: isHovered(),
|
|
307
|
+
isFocused: isFocused(),
|
|
308
|
+
isFocusVisible: isFocusVisible(),
|
|
309
|
+
isPlaceholder: props.segment.isPlaceholder,
|
|
310
|
+
isReadOnly: state.isReadOnly(),
|
|
311
|
+
isDisabled: state.isDisabled(),
|
|
312
|
+
isInvalid: state.isInvalid(),
|
|
277
313
|
type: props.segment.type,
|
|
278
|
-
text:
|
|
314
|
+
text: props.segment.text
|
|
279
315
|
}));
|
|
280
316
|
const renderProps = useRenderProps({
|
|
281
317
|
get children() {
|
|
@@ -287,9 +323,10 @@ function DateSegment(props) {
|
|
|
287
323
|
}, renderValues);
|
|
288
324
|
const getChildren = () => {
|
|
289
325
|
if (typeof props.children === "function") return renderProps.renderChildren();
|
|
290
|
-
return
|
|
326
|
+
return props.segment.text;
|
|
291
327
|
};
|
|
292
|
-
|
|
328
|
+
const segmentElementProps = createMemo(() => mergeProps$1(segmentAria.segmentProps, focusProps, hoverProps, { style: renderProps.style() }));
|
|
329
|
+
return <span ref={setSegmentRef} {...segmentElementProps()} class={renderProps.class()} data-placeholder={props.segment.isPlaceholder || void 0} data-invalid={state.isInvalid() || void 0} data-readonly={state.isReadOnly() || void 0} data-disabled={state.isDisabled() || void 0} data-type={props.segment.type} data-hovered={isHovered() || void 0} data-focused={isFocused() || void 0} data-focus-visible={isFocusVisible() || void 0}>
|
|
293
330
|
{getChildren()}
|
|
294
331
|
</span>;
|
|
295
332
|
}
|
|
@@ -301,17 +338,17 @@ function DateFieldLabel(props) {
|
|
|
301
338
|
}
|
|
302
339
|
function DateFieldDescription(props) {
|
|
303
340
|
const { aria } = useDateFieldContext();
|
|
304
|
-
return <
|
|
341
|
+
return <span {...aria.descriptionProps} class={props.class}>
|
|
305
342
|
{props.children}
|
|
306
|
-
</
|
|
343
|
+
</span>;
|
|
307
344
|
}
|
|
308
345
|
function DateFieldErrorMessage(props) {
|
|
309
346
|
const { aria } = useDateFieldContext();
|
|
310
|
-
return <
|
|
347
|
+
return <span {...aria.errorMessageProps} class={props.class}>
|
|
311
348
|
{props.children}
|
|
312
|
-
</
|
|
349
|
+
</span>;
|
|
313
350
|
}
|
|
314
351
|
//#endregion
|
|
315
|
-
export { DateFieldLabel as a, DateSegment as c, useDateRangePickerContext as d,
|
|
352
|
+
export { DateFieldLabel as a, DateSegment as c, useDateRangePickerContext as d, DateFieldErrorMessage as i, useDateFieldContext as l, DateFieldContext as n, DateFieldStateContext as o, DateFieldDescription as r, DateInput as s, DateField as t, DateRangePickerContext as u };
|
|
316
353
|
|
|
317
354
|
//# sourceMappingURL=DateField2.jsx.map
|