@proyecto-viviana/solidaria-components 0.4.0 → 0.4.1
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 +15 -16
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Breadcrumbs.jsx +19 -24
- 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/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/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 +62 -49
- package/dist/Select.js.map +1 -1
- package/dist/Select.jsx +33 -18
- package/dist/Select.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/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/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.jsx +5 -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 +55 -38
- 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/GridList.tsx +8 -2
- 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 +101 -20
- 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/TextField.tsx +1 -1
- package/src/TimeField.tsx +113 -196
- package/src/Tree.tsx +14 -4
- package/src/index.ts +1 -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/TagGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagGroup.js","names":["JSX","createContext","createMemo","createSignal","splitProps","useContext","For","Show","createTagGroup","createTag","AriaTagGroupProps","createListState","ListState","Key","SelectionMode","SelectionBehavior","RenderChildren","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","filterDOMProps","dataAttr","SharedElementTransition","SelectionIndicatorContext","SelectionIndicatorContextValue","TagGroupRenderProps","isDisabled","isEmpty","TagGroupProps","Omit","HTMLAttributes","HTMLDivElement","children","Element","class","style","TagListRenderProps","isFocused","TagListProps","items","T","item","renderEmptyState","selectionMode","selectionBehavior","selectedKeys","Iterable","defaultSelectedKeys","onSelectionChange","keys","Set","disabledKeys","getKey","label","onRemove","TagRenderProps","isSelected","isPressed","allowsRemoving","removeButtonProps","Record","TagProps","id","textValue","onAction","key","TagGroupContextValue","state","TagContextValue","TagGroupContext","TagListStateContext","TagContext","useTagGroupContext","TagGroup","props","local","domProps","_el$","_$getNextElement","_tmpl$","_$spread","_$mergeProps","_$memo","undefined","slot","_$insert","_$runHydrationEvents","TagList","gridRef","setGridRef","String","tagGroupAria","aria-label","aria-labelledby","aria-describedby","setIsFocused","renderValues","length","renderProps","defaultClassName","contextValue","_$createComponent","Provider","value","_el$2","_$use","gridProps","onFocus","setFocused","e","nextTarget","relatedTarget","Node","currentTarget","contains","data-empty","data-focused","when","fallback","each","Tag","rest","groupContext","tagRef","setTagRef","tagAria","role","normalizedRemoveButtonProps","raw","rawHandler","onPress","selectionIndicatorContext","global","_el$3","_tmpl$2","_el$4","firstChild","rowProps","event","rowClick","onClick","EventHandler","MouseEvent","target","closest","data-selected","data-disabled","data-pressed","data-allows-removing","gridCellProps","display","renderChildren","TagRemoveButtonProps","CSSProperties","buttonProps","TagRemoveButton","tagContext","getRemoveButtonProps","getIsDisabled","Boolean","rawId","rawAriaLabel","rawAriaLabelledBy","buttonId","ariaLabel","ariaLabelledBy","handleClick","HTMLButtonElement","stopPropagation","handler","stopRowPress","PointerEvent","_el$5","_tmpl$3","$$click","$$pointerdown","_$setAttribute","_$effect","_p$","_v$","_v$2","_v$3","_v$4","_$className","t","_$style","a","_$setProperty","o","_$delegateEvents"],"sources":["../src/TagGroup.tsx"],"sourcesContent":["/**\n * TagGroup component for solidaria-components\n *\n * Pre-wired headless tag group component that combines aria hooks.\n * Port of react-aria-components/src/TagGroup.tsx\n *\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n */\n\nimport {\n type JSX,\n createContext,\n createMemo,\n createSignal,\n splitProps,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport { createTagGroup, createTag, type AriaTagGroupProps } from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n type SelectionBehavior,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n} from \"./utils\";\nimport { SharedElementTransition } from \"./SharedElementTransition\";\nimport {\n SelectionIndicatorContext,\n type SelectionIndicatorContextValue,\n} from \"./SelectionIndicator\";\n\nexport interface TagGroupRenderProps {\n /** Whether the tag group is disabled. */\n isDisabled: boolean;\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n}\n\nexport interface TagGroupProps\n extends\n Omit<AriaTagGroupProps, \"id\">,\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\"> {\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagGroupRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagGroupRenderProps>;\n}\n\nexport interface TagListRenderProps {\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n /** Whether the tag list is focused. */\n isFocused: boolean;\n}\n\nexport interface TagListProps<T>\n extends\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\" | \"onSelectionChange\"> {\n /** The items to display in the tag list. */\n items: T[];\n /** Function to render each item. */\n children: (item: T) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagListRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagListRenderProps>;\n /** Content to render when the list is empty. */\n renderEmptyState?: () => JSX.Element;\n /** The selection mode for the tag list. */\n selectionMode?: SelectionMode;\n /** How selection behaves in the collection. */\n selectionBehavior?: SelectionBehavior;\n /** The currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** The default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Keys that are disabled. */\n disabledKeys?: Iterable<Key>;\n /** Function to get a unique key from an item. */\n getKey?: (item: T) => Key;\n /** Accessibility label. */\n label?: string;\n /** Custom aria-label. */\n \"aria-label\"?: string;\n /** Reference to external label element. */\n \"aria-labelledby\"?: string;\n /** Reference to description element. */\n \"aria-describedby\"?: string;\n /** Whether the tag list is disabled. */\n isDisabled?: boolean;\n /** Handler called when tags are removed. */\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport interface TagRenderProps {\n /** Whether the tag is selected. */\n isSelected: boolean;\n /** Whether the tag is disabled. */\n isDisabled: boolean;\n /** Whether the tag is focused. */\n isFocused: boolean;\n /** Whether the tag is pressed. */\n isPressed: boolean;\n /** Whether the tag allows removal. */\n allowsRemoving: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n /** Props for the remove button when removal is allowed. */\n removeButtonProps: Record<string, unknown>;\n}\n\nexport interface TagProps extends SlotProps {\n /** A unique key for this tag. */\n id: Key;\n /** Whether the tag is disabled. */\n isDisabled?: boolean;\n /** A text value for accessibility. */\n textValue?: string;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<TagRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagRenderProps>;\n /** Handler called when the tag is activated. */\n onAction?: (key: Key) => void;\n}\n\ninterface TagGroupContextValue {\n state: ListState;\n onRemove?: (keys: Set<Key>) => void;\n isDisabled?: boolean;\n}\n\ninterface TagContextValue {\n removeButtonProps: Record<string, unknown>;\n allowsRemoving: boolean;\n}\n\nexport const TagGroupContext = createContext<TagGroupContextValue | null>(null);\nexport const TagListStateContext = createContext<ListState | null>(null);\nexport const TagContext = createContext<TagContextValue | null>(null);\n\nexport function useTagGroupContext(): TagGroupContextValue | null {\n return useContext(TagGroupContext);\n}\n\n/**\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n *\n * @example\n * ```tsx\n * <TagGroup label=\"Categories\" onRemove={(keys) => removeItems(keys)}>\n * <TagList items={items}>\n * {(item) => <Tag id={item.id}>{item.name}</Tag>}\n * </TagList>\n * </TagGroup>\n * ```\n */\nexport function TagGroup(props: TagGroupProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"children\"]);\n\n // We need TagList to provide the state, so TagGroup just provides context\n return (\n <div\n {...domProps}\n class={typeof local.class === \"string\" ? local.class : \"solidaria-TagGroup\"}\n style={typeof local.style === \"object\" ? local.style : undefined}\n slot={local.slot}\n >\n {props.children}\n </div>\n );\n}\n\n/**\n * TagList contains the list of tags within a TagGroup.\n */\nexport function TagList<T extends { id?: Key; key?: Key }>(props: TagListProps<T>): JSX.Element {\n const [local, domProps] = splitProps(props, [\n \"items\",\n \"class\",\n \"style\",\n \"slot\",\n \"renderEmptyState\",\n \"children\",\n \"selectionMode\",\n \"selectionBehavior\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"disabledKeys\",\n \"getKey\",\n \"label\",\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"isDisabled\",\n \"onRemove\",\n ]);\n\n // Create a ref for the grid\n const [gridRef, setGridRef] = createSignal<HTMLDivElement | null>(null);\n\n // Default getKey function\n const getKey = (item: T): Key => {\n if (local.getKey) return local.getKey(item);\n if (item.id !== undefined) return item.id;\n if (item.key !== undefined) return item.key;\n return String(item);\n };\n\n const state = createListState({\n get items() {\n return local.items;\n },\n getKey,\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectionBehavior() {\n return local.selectionBehavior ?? \"toggle\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n });\n\n // Create tag group accessibility props\n const tagGroupAria = createTagGroup(\n {\n get \"aria-label\"() {\n return local[\"aria-label\"] ?? (!local[\"aria-labelledby\"] ? local.label : undefined);\n },\n get \"aria-labelledby\"() {\n return local[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return local[\"aria-describedby\"];\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get onRemove() {\n return local.onRemove;\n },\n },\n state,\n gridRef,\n );\n\n const [isFocused, setIsFocused] = createSignal(false);\n\n const renderValues = createMemo<TagListRenderProps>(() => ({\n isEmpty: local.items.length === 0,\n isFocused: isFocused(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TagList\",\n },\n renderValues,\n );\n\n const contextValue: TagGroupContextValue = {\n state,\n get onRemove() {\n return local.onRemove;\n },\n get isDisabled() {\n return local.isDisabled;\n },\n };\n\n return (\n <TagGroupContext.Provider value={contextValue}>\n <TagListStateContext.Provider value={state}>\n <div\n ref={setGridRef}\n {...domProps}\n {...tagGroupAria.gridProps}\n class={renderProps.class()}\n style={renderProps.style()}\n onFocus={() => {\n setIsFocused(true);\n state.setFocused(true);\n }}\n onBlur={(e) => {\n const nextTarget = e.relatedTarget as Node | null;\n if (nextTarget && e.currentTarget.contains(nextTarget)) {\n return;\n }\n\n setIsFocused(false);\n state.setFocused(false);\n }}\n data-empty={dataAttr(local.items.length === 0)}\n data-focused={dataAttr(isFocused())}\n >\n <SharedElementTransition>\n <Show when={local.items.length > 0} fallback={local.renderEmptyState?.()}>\n <For each={local.items}>{(item) => props.children(item)}</For>\n </Show>\n </SharedElementTransition>\n </div>\n </TagListStateContext.Provider>\n </TagGroupContext.Provider>\n );\n}\n\n/**\n * A Tag is an individual item within a TagList.\n */\nexport function Tag(props: TagProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"id\",\n \"class\",\n \"style\",\n \"slot\",\n \"isDisabled\",\n \"textValue\",\n \"onAction\",\n ]);\n\n const state = useContext(TagListStateContext);\n const groupContext = useContext(TagGroupContext);\n\n // Create a ref for the tag\n const [tagRef, setTagRef] = createSignal<HTMLDivElement | null>(null);\n\n // Create tag accessibility props\n const tagAria = createTag(\n {\n get key() {\n return local.id;\n },\n role: \"row\",\n get isDisabled() {\n return local.isDisabled || groupContext?.isDisabled;\n },\n get textValue() {\n return local.textValue;\n },\n },\n state!,\n tagRef,\n );\n\n const normalizedRemoveButtonProps = createMemo<Record<string, unknown>>(() => {\n const raw = tagAria.removeButtonProps;\n const rawHandler = typeof raw.onPress === \"function\" ? (raw.onPress as () => void) : undefined;\n return {\n ...raw,\n onPress: () => {\n if (!tagAria.isDisabled && groupContext?.onRemove) {\n groupContext.onRemove(new Set([local.id]));\n return;\n }\n rawHandler?.();\n },\n };\n });\n\n const renderValues = createMemo<TagRenderProps>(() => ({\n isSelected: tagAria.isSelected,\n isDisabled: tagAria.isDisabled,\n isFocused: tagAria.isFocused,\n isPressed: tagAria.isPressed,\n allowsRemoving: tagAria.allowsRemoving,\n selectionMode: state?.selectionMode() ?? \"none\",\n removeButtonProps: normalizedRemoveButtonProps(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Tag\",\n },\n renderValues,\n );\n\n const selectionIndicatorContext = createMemo<SelectionIndicatorContextValue>(() => ({\n isSelected: () => tagAria.isSelected,\n }));\n\n const domProps = createMemo(() => filterDOMProps(rest, { global: true }));\n\n return (\n <SelectionIndicatorContext.Provider value={selectionIndicatorContext()}>\n <TagContext.Provider\n value={{\n get removeButtonProps() {\n return normalizedRemoveButtonProps();\n },\n get allowsRemoving() {\n return tagAria.allowsRemoving;\n },\n }}\n >\n <div\n ref={setTagRef}\n {...domProps()}\n {...tagAria.rowProps}\n class={renderProps.class()}\n style={renderProps.style()}\n onClick={(event) => {\n const rowClick = tagAria.rowProps.onClick;\n if (typeof rowClick === \"function\") {\n (rowClick as JSX.EventHandler<HTMLDivElement, MouseEvent>)(event);\n }\n\n if (!tagAria.isDisabled && !(event.target as Element | null)?.closest(\"button\")) {\n local.onAction?.(local.id);\n }\n }}\n data-selected={dataAttr(tagAria.isSelected)}\n data-disabled={dataAttr(tagAria.isDisabled)}\n data-focused={dataAttr(tagAria.isFocused)}\n data-pressed={dataAttr(tagAria.isPressed)}\n data-allows-removing={dataAttr(tagAria.allowsRemoving)}\n >\n <div {...tagAria.gridCellProps} style={{ display: \"contents\" }}>\n {renderProps.renderChildren()}\n </div>\n </div>\n </TagContext.Provider>\n </SelectionIndicatorContext.Provider>\n );\n}\n\nexport interface TagRemoveButtonProps {\n /** The children of the button (usually an X icon). */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n /** Explicit button props from Tag render props. */\n buttonProps?: Record<string, unknown>;\n}\n\n/**\n * TagRemoveButton is the button used to remove a tag.\n * It should be placed inside a Tag component.\n */\nexport function TagRemoveButton(props: TagRemoveButtonProps): JSX.Element {\n const tagContext = useContext(TagContext);\n const getRemoveButtonProps = () => props.buttonProps ?? tagContext?.removeButtonProps ?? {};\n const getIsDisabled = () => Boolean(getRemoveButtonProps().isDisabled);\n const rawId = getRemoveButtonProps().id;\n const rawAriaLabel = getRemoveButtonProps()[\"aria-label\"];\n const rawAriaLabelledBy = getRemoveButtonProps()[\"aria-labelledby\"];\n const buttonId: string | undefined = typeof rawId === \"string\" ? rawId : undefined;\n const ariaLabel: string = typeof rawAriaLabel === \"string\" ? rawAriaLabel : \"Remove\";\n const ariaLabelledBy: string | undefined =\n typeof rawAriaLabelledBy === \"string\" ? rawAriaLabelledBy : undefined;\n\n const handleClick: JSX.EventHandler<HTMLButtonElement, MouseEvent> = (event) => {\n event.stopPropagation();\n const handler = getRemoveButtonProps().onPress;\n if (typeof handler === \"function\" && !getIsDisabled()) {\n (handler as () => void)();\n }\n };\n const stopRowPress: JSX.EventHandler<HTMLButtonElement, PointerEvent> = (event) => {\n event.stopPropagation();\n };\n\n return (\n <button\n type=\"button\"\n class={props.class ?? \"solidaria-TagRemoveButton\"}\n style={props.style}\n id={buttonId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n disabled={getIsDisabled()}\n data-allows-removing={dataAttr(tagContext?.allowsRemoving ?? false)}\n onPointerDown={stopRowPress}\n onClick={handleClick}\n >\n {props.children ?? \"×\"}\n </button>\n );\n}\n\nexport type { Key, SelectionMode, SelectionBehavior };\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6JA,MAAasE,kBAAkBrE,cAA2C,IAAI;AAC9E,MAAasE,sBAAsBtE,cAAgC,IAAI;AACvE,MAAauE,aAAavE,cAAsC,IAAI;AAEpE,SAAgBwE,qBAAkD;CAChE,OAAOpE,WAAWiE,eAAe;AACnC;;;;;;;;;;;;;;AAeA,SAAgBI,SAASC,OAAmC;CAC1D,MAAM,CAACC,OAAOC,YAAYzE,WAAWuE,OAAO;EAAC;EAAS;EAAS;EAAQ;CAAU,CAAC;CAGlF,cAAA;EAAA,IAAAG,OAAAC,eAAAC,MAAA;EAAAC,OAAAH,MAAAI,WAEQL,UAAQ;GAAA,KAAA,WAAA;IAAA,OACLM,WAAA,OAAOP,MAAMzC,UAAU,QAAQ,CAAA,CAAA,IAAG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A;AAOzE;AAEsDiB,eAAA,CAAA,eAAA,OAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"TagGroup.js","names":["JSX","createContext","createMemo","createSignal","splitProps","useContext","For","Show","createTagGroup","createTag","useLocale","AriaTagGroupProps","createListState","ListState","Key","SelectionMode","SelectionBehavior","RenderChildren","ClassNameOrFunction","StyleOrFunction","SlotProps","RefLike","useRenderProps","filterDOMProps","dataAttr","mergeRefs","SharedElementTransition","SelectionIndicatorContext","SelectionIndicatorContextValue","TagGroupRenderProps","isDisabled","isEmpty","TagGroupProps","Omit","HTMLAttributes","HTMLDivElement","children","Element","class","style","TagListRenderProps","isFocused","TagListProps","items","T","item","renderEmptyState","selectionMode","selectionBehavior","selectedKeys","Iterable","defaultSelectedKeys","onSelectionChange","keys","Set","disabledKeys","getKey","label","onRemove","TagRenderProps","isSelected","isPressed","allowsRemoving","removeButtonProps","Record","TagProps","id","textValue","ref","onAction","key","TagGroupContextValue","state","TagContextValue","TagGroupContext","TagListStateContext","TagContext","useTagGroupContext","TagGroup","props","local","domProps","_el$","_$getNextElement","_tmpl$","_$spread","_$mergeProps","_$memo","undefined","slot","_$insert","_$runHydrationEvents","TagList","gridRef","setGridRef","String","locale","tagGroupAria","aria-label","aria-labelledby","aria-describedby","direction","setIsFocused","renderValues","length","renderProps","defaultClassName","contextValue","_$createComponent","Provider","value","_el$2","_$use","gridProps","onFocusIn","e","nextTarget","relatedTarget","Node","currentTarget","contains","data-empty","data-focused","when","fallback","each","Tag","rest","groupContext","tagRef","setTagRef","tagAria","role","normalizedRemoveButtonProps","raw","rawHandler","onPress","selectionIndicatorContext","global","_el$3","_tmpl$2","_el$4","firstChild","_ref$","rowProps","event","rowClick","onClick","EventHandler","MouseEvent","target","closest","data-selected","data-disabled","data-pressed","data-allows-removing","gridCellProps","display","renderChildren","TagRemoveButtonProps","CSSProperties","buttonProps","TagRemoveButton","tagContext","getRemoveButtonProps","getIsDisabled","Boolean","rawId","rawAriaLabel","rawAriaLabelledBy","buttonId","ariaLabel","ariaLabelledBy","handleClick","HTMLButtonElement","stopPropagation","handler","stopRowPress","PointerEvent","_el$5","_tmpl$3","$$click","$$pointerdown","_$setAttribute","_$effect","_p$","_v$","_v$2","_v$3","_v$4","_$className","t","_$style","a","_$setProperty","o","_$delegateEvents"],"sources":["../src/TagGroup.tsx"],"sourcesContent":["/**\n * TagGroup component for solidaria-components\n *\n * Pre-wired headless tag group component that combines aria hooks.\n * Port of react-aria-components/src/TagGroup.tsx\n *\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n */\n\nimport {\n type JSX,\n createContext,\n createMemo,\n createSignal,\n splitProps,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport {\n createTagGroup,\n createTag,\n useLocale,\n type AriaTagGroupProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n type SelectionBehavior,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n type RefLike,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n mergeRefs,\n} from \"./utils\";\nimport { SharedElementTransition } from \"./SharedElementTransition\";\nimport {\n SelectionIndicatorContext,\n type SelectionIndicatorContextValue,\n} from \"./SelectionIndicator\";\n\nexport interface TagGroupRenderProps {\n /** Whether the tag group is disabled. */\n isDisabled: boolean;\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n}\n\nexport interface TagGroupProps\n extends\n Omit<AriaTagGroupProps, \"id\">,\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\"> {\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagGroupRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagGroupRenderProps>;\n}\n\nexport interface TagListRenderProps {\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n /** Whether the tag list is focused. */\n isFocused: boolean;\n}\n\nexport interface TagListProps<T>\n extends\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\" | \"onSelectionChange\"> {\n /** The items to display in the tag list. */\n items: T[];\n /** Function to render each item. */\n children: (item: T) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagListRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagListRenderProps>;\n /** Content to render when the list is empty. */\n renderEmptyState?: () => JSX.Element;\n /** The selection mode for the tag list. */\n selectionMode?: SelectionMode;\n /** How selection behaves in the collection. */\n selectionBehavior?: SelectionBehavior;\n /** The currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** The default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Keys that are disabled. */\n disabledKeys?: Iterable<Key>;\n /** Function to get a unique key from an item. */\n getKey?: (item: T) => Key;\n /** Accessibility label. */\n label?: string;\n /** Custom aria-label. */\n \"aria-label\"?: string;\n /** Reference to external label element. */\n \"aria-labelledby\"?: string;\n /** Reference to description element. */\n \"aria-describedby\"?: string;\n /** Whether the tag list is disabled. */\n isDisabled?: boolean;\n /** Handler called when tags are removed. */\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport interface TagRenderProps {\n /** Whether the tag is selected. */\n isSelected: boolean;\n /** Whether the tag is disabled. */\n isDisabled: boolean;\n /** Whether the tag is focused. */\n isFocused: boolean;\n /** Whether the tag is pressed. */\n isPressed: boolean;\n /** Whether the tag allows removal. */\n allowsRemoving: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n /** Props for the remove button when removal is allowed. */\n removeButtonProps: Record<string, unknown>;\n}\n\nexport interface TagProps extends SlotProps {\n /** A unique key for this tag. */\n id: Key;\n /** Whether the tag is disabled. */\n isDisabled?: boolean;\n /** A text value for accessibility. */\n textValue?: string;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<TagRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagRenderProps>;\n /** A ref to the tag's DOM element (merged with the internal collection ref). */\n ref?: RefLike<HTMLDivElement>;\n /** Handler called when the tag is activated. */\n onAction?: (key: Key) => void;\n}\n\ninterface TagGroupContextValue {\n state: ListState;\n onRemove?: (keys: Set<Key>) => void;\n isDisabled?: boolean;\n}\n\ninterface TagContextValue {\n removeButtonProps: Record<string, unknown>;\n allowsRemoving: boolean;\n}\n\nexport const TagGroupContext = createContext<TagGroupContextValue | null>(null);\nexport const TagListStateContext = createContext<ListState | null>(null);\nexport const TagContext = createContext<TagContextValue | null>(null);\n\nexport function useTagGroupContext(): TagGroupContextValue | null {\n return useContext(TagGroupContext);\n}\n\n/**\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n *\n * @example\n * ```tsx\n * <TagGroup label=\"Categories\" onRemove={(keys) => removeItems(keys)}>\n * <TagList items={items}>\n * {(item) => <Tag id={item.id}>{item.name}</Tag>}\n * </TagList>\n * </TagGroup>\n * ```\n */\nexport function TagGroup(props: TagGroupProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"children\"]);\n\n // We need TagList to provide the state, so TagGroup just provides context\n return (\n <div\n {...domProps}\n class={typeof local.class === \"string\" ? local.class : \"solidaria-TagGroup\"}\n style={typeof local.style === \"object\" ? local.style : undefined}\n slot={local.slot}\n >\n {props.children}\n </div>\n );\n}\n\n/**\n * TagList contains the list of tags within a TagGroup.\n */\nexport function TagList<T extends { id?: Key; key?: Key }>(props: TagListProps<T>): JSX.Element {\n const [local, domProps] = splitProps(props, [\n \"items\",\n \"class\",\n \"style\",\n \"slot\",\n \"renderEmptyState\",\n \"children\",\n \"selectionMode\",\n \"selectionBehavior\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"disabledKeys\",\n \"getKey\",\n \"label\",\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"isDisabled\",\n \"onRemove\",\n ]);\n\n // Create a ref for the grid\n const [gridRef, setGridRef] = createSignal<HTMLDivElement | null>(null);\n\n // Default getKey function\n const getKey = (item: T): Key => {\n if (local.getKey) return local.getKey(item);\n if (item.id !== undefined) return item.id;\n if (item.key !== undefined) return item.key;\n return String(item);\n };\n\n const state = createListState({\n get items() {\n return local.items;\n },\n getKey,\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectionBehavior() {\n return local.selectionBehavior ?? \"toggle\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n });\n\n // The tag group navigates on the inline axis, so ArrowLeft/ArrowRight flip\n // under RTL. Thread the resolved layout direction into the hook (mirrors\n // ListBox, and useTagGroup passing `direction` to the ListKeyboardDelegate).\n const locale = useLocale();\n\n // Create tag group accessibility props\n const tagGroupAria = createTagGroup(\n {\n get \"aria-label\"() {\n return local[\"aria-label\"] ?? (!local[\"aria-labelledby\"] ? local.label : undefined);\n },\n get \"aria-labelledby\"() {\n return local[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return local[\"aria-describedby\"];\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get onRemove() {\n return local.onRemove;\n },\n get direction() {\n return locale().direction;\n },\n },\n state,\n gridRef,\n );\n\n const [isFocused, setIsFocused] = createSignal(false);\n\n const renderValues = createMemo<TagListRenderProps>(() => ({\n isEmpty: local.items.length === 0,\n isFocused: isFocused(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TagList\",\n },\n renderValues,\n );\n\n const contextValue: TagGroupContextValue = {\n state,\n get onRemove() {\n return local.onRemove;\n },\n get isDisabled() {\n return local.isDisabled;\n },\n };\n\n return (\n <TagGroupContext.Provider value={contextValue}>\n <TagListStateContext.Provider value={state}>\n <div\n ref={setGridRef}\n {...domProps}\n {...tagGroupAria.gridProps}\n class={renderProps.class()}\n style={renderProps.style()}\n // Track focus-within via the BUBBLING focusin/focusout pair (not the\n // non-bubbling focus/blur the hook's trampoline uses) so this render-prop\n // signal never clobbers `gridProps.onFocus` — the container focus\n // trampoline that marshals entry onto the first/last row.\n onFocusIn={() => {\n setIsFocused(true);\n }}\n onFocusOut={(e) => {\n const nextTarget = e.relatedTarget as Node | null;\n if (nextTarget && e.currentTarget.contains(nextTarget)) {\n return;\n }\n\n setIsFocused(false);\n }}\n data-empty={dataAttr(local.items.length === 0)}\n data-focused={dataAttr(isFocused())}\n >\n <SharedElementTransition>\n <Show when={local.items.length > 0} fallback={local.renderEmptyState?.()}>\n <For each={local.items}>{(item) => props.children(item)}</For>\n </Show>\n </SharedElementTransition>\n </div>\n </TagListStateContext.Provider>\n </TagGroupContext.Provider>\n );\n}\n\n/**\n * A Tag is an individual item within a TagList.\n */\nexport function Tag(props: TagProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"id\",\n \"class\",\n \"style\",\n \"slot\",\n \"isDisabled\",\n \"textValue\",\n \"onAction\",\n \"ref\",\n ]);\n\n const state = useContext(TagListStateContext);\n const groupContext = useContext(TagGroupContext);\n\n // Create a ref for the tag\n const [tagRef, setTagRef] = createSignal<HTMLDivElement | null>(null);\n\n // Create tag accessibility props\n const tagAria = createTag(\n {\n get key() {\n return local.id;\n },\n role: \"row\",\n get isDisabled() {\n return local.isDisabled || groupContext?.isDisabled;\n },\n get textValue() {\n return local.textValue;\n },\n },\n state!,\n tagRef,\n );\n\n const normalizedRemoveButtonProps = createMemo<Record<string, unknown>>(() => {\n const raw = tagAria.removeButtonProps;\n const rawHandler = typeof raw.onPress === \"function\" ? (raw.onPress as () => void) : undefined;\n return {\n ...raw,\n onPress: () => {\n if (!tagAria.isDisabled && groupContext?.onRemove) {\n groupContext.onRemove(new Set([local.id]));\n return;\n }\n rawHandler?.();\n },\n };\n });\n\n const renderValues = createMemo<TagRenderProps>(() => ({\n isSelected: tagAria.isSelected,\n isDisabled: tagAria.isDisabled,\n isFocused: tagAria.isFocused,\n isPressed: tagAria.isPressed,\n allowsRemoving: tagAria.allowsRemoving,\n selectionMode: state?.selectionMode() ?? \"none\",\n removeButtonProps: normalizedRemoveButtonProps(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Tag\",\n },\n renderValues,\n );\n\n const selectionIndicatorContext = createMemo<SelectionIndicatorContextValue>(() => ({\n isSelected: () => tagAria.isSelected,\n }));\n\n const domProps = createMemo(() => filterDOMProps(rest, { global: true }));\n\n return (\n <SelectionIndicatorContext.Provider value={selectionIndicatorContext()}>\n <TagContext.Provider\n value={{\n get removeButtonProps() {\n return normalizedRemoveButtonProps();\n },\n get allowsRemoving() {\n return tagAria.allowsRemoving;\n },\n }}\n >\n <div\n ref={mergeRefs(setTagRef, local.ref)}\n {...domProps()}\n {...tagAria.rowProps}\n class={renderProps.class()}\n style={renderProps.style()}\n onClick={(event) => {\n const rowClick = tagAria.rowProps.onClick;\n if (typeof rowClick === \"function\") {\n (rowClick as JSX.EventHandler<HTMLDivElement, MouseEvent>)(event);\n }\n\n if (!tagAria.isDisabled && !(event.target as Element | null)?.closest(\"button\")) {\n local.onAction?.(local.id);\n }\n }}\n data-selected={dataAttr(tagAria.isSelected)}\n data-disabled={dataAttr(tagAria.isDisabled)}\n data-focused={dataAttr(tagAria.isFocused)}\n data-pressed={dataAttr(tagAria.isPressed)}\n data-allows-removing={dataAttr(tagAria.allowsRemoving)}\n >\n <div {...tagAria.gridCellProps} style={{ display: \"contents\" }}>\n {renderProps.renderChildren()}\n </div>\n </div>\n </TagContext.Provider>\n </SelectionIndicatorContext.Provider>\n );\n}\n\nexport interface TagRemoveButtonProps {\n /** The children of the button (usually an X icon). */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n /** Explicit button props from Tag render props. */\n buttonProps?: Record<string, unknown>;\n}\n\n/**\n * TagRemoveButton is the button used to remove a tag.\n * It should be placed inside a Tag component.\n */\nexport function TagRemoveButton(props: TagRemoveButtonProps): JSX.Element {\n const tagContext = useContext(TagContext);\n const getRemoveButtonProps = () => props.buttonProps ?? tagContext?.removeButtonProps ?? {};\n const getIsDisabled = () => Boolean(getRemoveButtonProps().isDisabled);\n const rawId = getRemoveButtonProps().id;\n const rawAriaLabel = getRemoveButtonProps()[\"aria-label\"];\n const rawAriaLabelledBy = getRemoveButtonProps()[\"aria-labelledby\"];\n const buttonId: string | undefined = typeof rawId === \"string\" ? rawId : undefined;\n const ariaLabel: string = typeof rawAriaLabel === \"string\" ? rawAriaLabel : \"Remove\";\n const ariaLabelledBy: string | undefined =\n typeof rawAriaLabelledBy === \"string\" ? rawAriaLabelledBy : undefined;\n\n const handleClick: JSX.EventHandler<HTMLButtonElement, MouseEvent> = (event) => {\n event.stopPropagation();\n const handler = getRemoveButtonProps().onPress;\n if (typeof handler === \"function\" && !getIsDisabled()) {\n (handler as () => void)();\n }\n };\n const stopRowPress: JSX.EventHandler<HTMLButtonElement, PointerEvent> = (event) => {\n event.stopPropagation();\n };\n\n return (\n <button\n type=\"button\"\n class={props.class ?? \"solidaria-TagRemoveButton\"}\n style={props.style}\n id={buttonId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n disabled={getIsDisabled()}\n data-allows-removing={dataAttr(tagContext?.allowsRemoving ?? false)}\n onPointerDown={stopRowPress}\n onClick={handleClick}\n >\n {props.children ?? \"×\"}\n </button>\n );\n}\n\nexport type { Key, SelectionMode, SelectionBehavior };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsKA,MAAa0E,kBAAkBzE,cAA2C,IAAI;AAC9E,MAAa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C5G,MAAMxC,OAAKqJ,OAIRvB,cAAc,GAACwB,OACHrK,SAAS2I,YAAYrG,kBAAkB,KAAK;GAAC4H,QAAAD,IAAAtE,KAAA2E,UAAAX,OAAAM,IAAAtE,IAAAuE,GAAA;GAAAD,IAAAM,IAAAC,MAAAb,OAAAQ,MAAAF,IAAAM,CAAA;GAAAH,SAAAH,IAAAQ,KAAAC,YAAAf,OAAA,YAAAM,IAAAQ,IAAAL,IAAA;GAAAC,SAAAJ,IAAAU,KAAAZ,aAAAJ,OAAA,wBAAAM,IAAAU,IAAAN,IAAA;GAAA,OAAAJ;EAAA,GAAA;GAAAtE,GAAA3B,KAAAA;GAAAuG,GAAAvG,KAAAA;GAAAyG,GAAAzG,KAAAA;GAAA2G,GAAA3G,KAAAA;EAAA,CAAA;EAAAG,mBAAA;EAAA,OAAAwF;CAAA,EAAA,CAAA;AAOzE;AAEsDiB,eAAA,CAAA,eAAA,OAAA,CAAA"}
|
package/dist/TagGroup.jsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { dataAttr, filterDOMProps, useRenderProps } from "./utils.jsx";
|
|
1
|
+
import { dataAttr, filterDOMProps, mergeRefs, useRenderProps } from "./utils.jsx";
|
|
2
2
|
import { SharedElementTransition } from "./SharedElementTransition.jsx";
|
|
3
3
|
import { SelectionIndicatorContext } from "./SelectionIndicator.jsx";
|
|
4
4
|
import { For, Show, createContext, createMemo, createSignal, splitProps, useContext } from "solid-js";
|
|
5
|
-
import { createTag, createTagGroup } from "@proyecto-viviana/solidaria";
|
|
5
|
+
import { createTag, createTagGroup, useLocale } from "@proyecto-viviana/solidaria";
|
|
6
6
|
import { createListState } from "@proyecto-viviana/solid-stately";
|
|
7
7
|
//#region src/TagGroup.tsx
|
|
8
8
|
/**
|
|
@@ -100,6 +100,7 @@ function TagList(props) {
|
|
|
100
100
|
return local.disabledKeys;
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
+
const locale = useLocale();
|
|
103
104
|
const tagGroupAria = createTagGroup({
|
|
104
105
|
get "aria-label"() {
|
|
105
106
|
return local["aria-label"] ?? (!local["aria-labelledby"] ? local.label : void 0);
|
|
@@ -115,6 +116,9 @@ function TagList(props) {
|
|
|
115
116
|
},
|
|
116
117
|
get onRemove() {
|
|
117
118
|
return local.onRemove;
|
|
119
|
+
},
|
|
120
|
+
get direction() {
|
|
121
|
+
return locale().direction;
|
|
118
122
|
}
|
|
119
123
|
}, state, gridRef);
|
|
120
124
|
const [isFocused, setIsFocused] = createSignal(false);
|
|
@@ -138,14 +142,12 @@ function TagList(props) {
|
|
|
138
142
|
};
|
|
139
143
|
return <TagGroupContext.Provider value={contextValue}>
|
|
140
144
|
<TagListStateContext.Provider value={state}>
|
|
141
|
-
<div ref={setGridRef} {...domProps} {...tagGroupAria.gridProps} class={renderProps.class()} style={renderProps.style()}
|
|
145
|
+
<div ref={setGridRef} {...domProps} {...tagGroupAria.gridProps} class={renderProps.class()} style={renderProps.style()} onFocusIn={() => {
|
|
142
146
|
setIsFocused(true);
|
|
143
|
-
|
|
144
|
-
}} onBlur={(e) => {
|
|
147
|
+
}} onFocusOut={(e) => {
|
|
145
148
|
const nextTarget = e.relatedTarget;
|
|
146
149
|
if (nextTarget && e.currentTarget.contains(nextTarget)) return;
|
|
147
150
|
setIsFocused(false);
|
|
148
|
-
state.setFocused(false);
|
|
149
151
|
}} data-empty={dataAttr(local.items.length === 0)} data-focused={dataAttr(isFocused())}>
|
|
150
152
|
<SharedElementTransition>
|
|
151
153
|
<Show when={local.items.length > 0} fallback={local.renderEmptyState?.()}>
|
|
@@ -167,7 +169,8 @@ function Tag(props) {
|
|
|
167
169
|
"slot",
|
|
168
170
|
"isDisabled",
|
|
169
171
|
"textValue",
|
|
170
|
-
"onAction"
|
|
172
|
+
"onAction",
|
|
173
|
+
"ref"
|
|
171
174
|
]);
|
|
172
175
|
const state = useContext(TagListStateContext);
|
|
173
176
|
const groupContext = useContext(TagGroupContext);
|
|
@@ -226,7 +229,7 @@ function Tag(props) {
|
|
|
226
229
|
return tagAria.allowsRemoving;
|
|
227
230
|
}
|
|
228
231
|
}}>
|
|
229
|
-
<div ref={setTagRef} {...domProps()} {...tagAria.rowProps} class={renderProps.class()} style={renderProps.style()} onClick={(event) => {
|
|
232
|
+
<div ref={mergeRefs(setTagRef, local.ref)} {...domProps()} {...tagAria.rowProps} class={renderProps.class()} style={renderProps.style()} onClick={(event) => {
|
|
230
233
|
const rowClick = tagAria.rowProps.onClick;
|
|
231
234
|
if (typeof rowClick === "function") rowClick(event);
|
|
232
235
|
if (!tagAria.isDisabled && !event.target?.closest("button")) local.onAction?.(local.id);
|
package/dist/TagGroup.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagGroup.jsx","names":[],"sources":["../src/TagGroup.tsx"],"sourcesContent":["/**\n * TagGroup component for solidaria-components\n *\n * Pre-wired headless tag group component that combines aria hooks.\n * Port of react-aria-components/src/TagGroup.tsx\n *\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n */\n\nimport {\n type JSX,\n createContext,\n createMemo,\n createSignal,\n splitProps,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport { createTagGroup, createTag, type AriaTagGroupProps } from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n type SelectionBehavior,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n} from \"./utils\";\nimport { SharedElementTransition } from \"./SharedElementTransition\";\nimport {\n SelectionIndicatorContext,\n type SelectionIndicatorContextValue,\n} from \"./SelectionIndicator\";\n\nexport interface TagGroupRenderProps {\n /** Whether the tag group is disabled. */\n isDisabled: boolean;\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n}\n\nexport interface TagGroupProps\n extends\n Omit<AriaTagGroupProps, \"id\">,\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\"> {\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagGroupRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagGroupRenderProps>;\n}\n\nexport interface TagListRenderProps {\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n /** Whether the tag list is focused. */\n isFocused: boolean;\n}\n\nexport interface TagListProps<T>\n extends\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\" | \"onSelectionChange\"> {\n /** The items to display in the tag list. */\n items: T[];\n /** Function to render each item. */\n children: (item: T) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagListRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagListRenderProps>;\n /** Content to render when the list is empty. */\n renderEmptyState?: () => JSX.Element;\n /** The selection mode for the tag list. */\n selectionMode?: SelectionMode;\n /** How selection behaves in the collection. */\n selectionBehavior?: SelectionBehavior;\n /** The currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** The default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Keys that are disabled. */\n disabledKeys?: Iterable<Key>;\n /** Function to get a unique key from an item. */\n getKey?: (item: T) => Key;\n /** Accessibility label. */\n label?: string;\n /** Custom aria-label. */\n \"aria-label\"?: string;\n /** Reference to external label element. */\n \"aria-labelledby\"?: string;\n /** Reference to description element. */\n \"aria-describedby\"?: string;\n /** Whether the tag list is disabled. */\n isDisabled?: boolean;\n /** Handler called when tags are removed. */\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport interface TagRenderProps {\n /** Whether the tag is selected. */\n isSelected: boolean;\n /** Whether the tag is disabled. */\n isDisabled: boolean;\n /** Whether the tag is focused. */\n isFocused: boolean;\n /** Whether the tag is pressed. */\n isPressed: boolean;\n /** Whether the tag allows removal. */\n allowsRemoving: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n /** Props for the remove button when removal is allowed. */\n removeButtonProps: Record<string, unknown>;\n}\n\nexport interface TagProps extends SlotProps {\n /** A unique key for this tag. */\n id: Key;\n /** Whether the tag is disabled. */\n isDisabled?: boolean;\n /** A text value for accessibility. */\n textValue?: string;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<TagRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagRenderProps>;\n /** Handler called when the tag is activated. */\n onAction?: (key: Key) => void;\n}\n\ninterface TagGroupContextValue {\n state: ListState;\n onRemove?: (keys: Set<Key>) => void;\n isDisabled?: boolean;\n}\n\ninterface TagContextValue {\n removeButtonProps: Record<string, unknown>;\n allowsRemoving: boolean;\n}\n\nexport const TagGroupContext = createContext<TagGroupContextValue | null>(null);\nexport const TagListStateContext = createContext<ListState | null>(null);\nexport const TagContext = createContext<TagContextValue | null>(null);\n\nexport function useTagGroupContext(): TagGroupContextValue | null {\n return useContext(TagGroupContext);\n}\n\n/**\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n *\n * @example\n * ```tsx\n * <TagGroup label=\"Categories\" onRemove={(keys) => removeItems(keys)}>\n * <TagList items={items}>\n * {(item) => <Tag id={item.id}>{item.name}</Tag>}\n * </TagList>\n * </TagGroup>\n * ```\n */\nexport function TagGroup(props: TagGroupProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"children\"]);\n\n // We need TagList to provide the state, so TagGroup just provides context\n return (\n <div\n {...domProps}\n class={typeof local.class === \"string\" ? local.class : \"solidaria-TagGroup\"}\n style={typeof local.style === \"object\" ? local.style : undefined}\n slot={local.slot}\n >\n {props.children}\n </div>\n );\n}\n\n/**\n * TagList contains the list of tags within a TagGroup.\n */\nexport function TagList<T extends { id?: Key; key?: Key }>(props: TagListProps<T>): JSX.Element {\n const [local, domProps] = splitProps(props, [\n \"items\",\n \"class\",\n \"style\",\n \"slot\",\n \"renderEmptyState\",\n \"children\",\n \"selectionMode\",\n \"selectionBehavior\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"disabledKeys\",\n \"getKey\",\n \"label\",\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"isDisabled\",\n \"onRemove\",\n ]);\n\n // Create a ref for the grid\n const [gridRef, setGridRef] = createSignal<HTMLDivElement | null>(null);\n\n // Default getKey function\n const getKey = (item: T): Key => {\n if (local.getKey) return local.getKey(item);\n if (item.id !== undefined) return item.id;\n if (item.key !== undefined) return item.key;\n return String(item);\n };\n\n const state = createListState({\n get items() {\n return local.items;\n },\n getKey,\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectionBehavior() {\n return local.selectionBehavior ?? \"toggle\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n });\n\n // Create tag group accessibility props\n const tagGroupAria = createTagGroup(\n {\n get \"aria-label\"() {\n return local[\"aria-label\"] ?? (!local[\"aria-labelledby\"] ? local.label : undefined);\n },\n get \"aria-labelledby\"() {\n return local[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return local[\"aria-describedby\"];\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get onRemove() {\n return local.onRemove;\n },\n },\n state,\n gridRef,\n );\n\n const [isFocused, setIsFocused] = createSignal(false);\n\n const renderValues = createMemo<TagListRenderProps>(() => ({\n isEmpty: local.items.length === 0,\n isFocused: isFocused(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TagList\",\n },\n renderValues,\n );\n\n const contextValue: TagGroupContextValue = {\n state,\n get onRemove() {\n return local.onRemove;\n },\n get isDisabled() {\n return local.isDisabled;\n },\n };\n\n return (\n <TagGroupContext.Provider value={contextValue}>\n <TagListStateContext.Provider value={state}>\n <div\n ref={setGridRef}\n {...domProps}\n {...tagGroupAria.gridProps}\n class={renderProps.class()}\n style={renderProps.style()}\n onFocus={() => {\n setIsFocused(true);\n state.setFocused(true);\n }}\n onBlur={(e) => {\n const nextTarget = e.relatedTarget as Node | null;\n if (nextTarget && e.currentTarget.contains(nextTarget)) {\n return;\n }\n\n setIsFocused(false);\n state.setFocused(false);\n }}\n data-empty={dataAttr(local.items.length === 0)}\n data-focused={dataAttr(isFocused())}\n >\n <SharedElementTransition>\n <Show when={local.items.length > 0} fallback={local.renderEmptyState?.()}>\n <For each={local.items}>{(item) => props.children(item)}</For>\n </Show>\n </SharedElementTransition>\n </div>\n </TagListStateContext.Provider>\n </TagGroupContext.Provider>\n );\n}\n\n/**\n * A Tag is an individual item within a TagList.\n */\nexport function Tag(props: TagProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"id\",\n \"class\",\n \"style\",\n \"slot\",\n \"isDisabled\",\n \"textValue\",\n \"onAction\",\n ]);\n\n const state = useContext(TagListStateContext);\n const groupContext = useContext(TagGroupContext);\n\n // Create a ref for the tag\n const [tagRef, setTagRef] = createSignal<HTMLDivElement | null>(null);\n\n // Create tag accessibility props\n const tagAria = createTag(\n {\n get key() {\n return local.id;\n },\n role: \"row\",\n get isDisabled() {\n return local.isDisabled || groupContext?.isDisabled;\n },\n get textValue() {\n return local.textValue;\n },\n },\n state!,\n tagRef,\n );\n\n const normalizedRemoveButtonProps = createMemo<Record<string, unknown>>(() => {\n const raw = tagAria.removeButtonProps;\n const rawHandler = typeof raw.onPress === \"function\" ? (raw.onPress as () => void) : undefined;\n return {\n ...raw,\n onPress: () => {\n if (!tagAria.isDisabled && groupContext?.onRemove) {\n groupContext.onRemove(new Set([local.id]));\n return;\n }\n rawHandler?.();\n },\n };\n });\n\n const renderValues = createMemo<TagRenderProps>(() => ({\n isSelected: tagAria.isSelected,\n isDisabled: tagAria.isDisabled,\n isFocused: tagAria.isFocused,\n isPressed: tagAria.isPressed,\n allowsRemoving: tagAria.allowsRemoving,\n selectionMode: state?.selectionMode() ?? \"none\",\n removeButtonProps: normalizedRemoveButtonProps(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Tag\",\n },\n renderValues,\n );\n\n const selectionIndicatorContext = createMemo<SelectionIndicatorContextValue>(() => ({\n isSelected: () => tagAria.isSelected,\n }));\n\n const domProps = createMemo(() => filterDOMProps(rest, { global: true }));\n\n return (\n <SelectionIndicatorContext.Provider value={selectionIndicatorContext()}>\n <TagContext.Provider\n value={{\n get removeButtonProps() {\n return normalizedRemoveButtonProps();\n },\n get allowsRemoving() {\n return tagAria.allowsRemoving;\n },\n }}\n >\n <div\n ref={setTagRef}\n {...domProps()}\n {...tagAria.rowProps}\n class={renderProps.class()}\n style={renderProps.style()}\n onClick={(event) => {\n const rowClick = tagAria.rowProps.onClick;\n if (typeof rowClick === \"function\") {\n (rowClick as JSX.EventHandler<HTMLDivElement, MouseEvent>)(event);\n }\n\n if (!tagAria.isDisabled && !(event.target as Element | null)?.closest(\"button\")) {\n local.onAction?.(local.id);\n }\n }}\n data-selected={dataAttr(tagAria.isSelected)}\n data-disabled={dataAttr(tagAria.isDisabled)}\n data-focused={dataAttr(tagAria.isFocused)}\n data-pressed={dataAttr(tagAria.isPressed)}\n data-allows-removing={dataAttr(tagAria.allowsRemoving)}\n >\n <div {...tagAria.gridCellProps} style={{ display: \"contents\" }}>\n {renderProps.renderChildren()}\n </div>\n </div>\n </TagContext.Provider>\n </SelectionIndicatorContext.Provider>\n );\n}\n\nexport interface TagRemoveButtonProps {\n /** The children of the button (usually an X icon). */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n /** Explicit button props from Tag render props. */\n buttonProps?: Record<string, unknown>;\n}\n\n/**\n * TagRemoveButton is the button used to remove a tag.\n * It should be placed inside a Tag component.\n */\nexport function TagRemoveButton(props: TagRemoveButtonProps): JSX.Element {\n const tagContext = useContext(TagContext);\n const getRemoveButtonProps = () => props.buttonProps ?? tagContext?.removeButtonProps ?? {};\n const getIsDisabled = () => Boolean(getRemoveButtonProps().isDisabled);\n const rawId = getRemoveButtonProps().id;\n const rawAriaLabel = getRemoveButtonProps()[\"aria-label\"];\n const rawAriaLabelledBy = getRemoveButtonProps()[\"aria-labelledby\"];\n const buttonId: string | undefined = typeof rawId === \"string\" ? rawId : undefined;\n const ariaLabel: string = typeof rawAriaLabel === \"string\" ? rawAriaLabel : \"Remove\";\n const ariaLabelledBy: string | undefined =\n typeof rawAriaLabelledBy === \"string\" ? rawAriaLabelledBy : undefined;\n\n const handleClick: JSX.EventHandler<HTMLButtonElement, MouseEvent> = (event) => {\n event.stopPropagation();\n const handler = getRemoveButtonProps().onPress;\n if (typeof handler === \"function\" && !getIsDisabled()) {\n (handler as () => void)();\n }\n };\n const stopRowPress: JSX.EventHandler<HTMLButtonElement, PointerEvent> = (event) => {\n event.stopPropagation();\n };\n\n return (\n <button\n type=\"button\"\n class={props.class ?? \"solidaria-TagRemoveButton\"}\n style={props.style}\n id={buttonId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n disabled={getIsDisabled()}\n data-allows-removing={dataAttr(tagContext?.allowsRemoving ?? false)}\n onPointerDown={stopRowPress}\n onClick={handleClick}\n >\n {props.children ?? \"×\"}\n </button>\n );\n}\n\nexport type { Key, SelectionMode, SelectionBehavior };\n"],"mappings":";;;;;;;;;;;;;;;;AA6JA,MAAa,kBAAkB,cAA2C,IAAI;AAC9E,MAAa,sBAAsB,cAAgC,IAAI;AACvE,MAAa,aAAa,cAAsC,IAAI;AAEpE,SAAgB,qBAAkD;CAChE,OAAO,WAAW,eAAe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CAAC,CAAC;EACvC,IAAI,OAAO,YAAY,cAAc,CAAC,cAAc,GAClD,QAAwB;CAE5B;CACA,MAAM,gBAAmE,UAAU;EACjF,MAAM,gBAAgB;CACxB;CAEA,OACE,CAAC,OACC,cACA,OAAO,MAAM,SAAS,6BACtB,OAAO,MAAM,OACb,IAAI,UACJ,YAAY,WACZ,iBAAiB,gBACjB,UAAU,cAAc,GACxB,sBAAsB,SAAS,YAAY,kBAAkB,KAAK,GAClE,eAAe,cACf,SAAS,aACV;OACE,MAAM,YAAY,IAAI;IACzB,EAAE;AAEN"}
|
|
1
|
+
{"version":3,"file":"TagGroup.jsx","names":[],"sources":["../src/TagGroup.tsx"],"sourcesContent":["/**\n * TagGroup component for solidaria-components\n *\n * Pre-wired headless tag group component that combines aria hooks.\n * Port of react-aria-components/src/TagGroup.tsx\n *\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n */\n\nimport {\n type JSX,\n createContext,\n createMemo,\n createSignal,\n splitProps,\n useContext,\n For,\n Show,\n} from \"solid-js\";\nimport {\n createTagGroup,\n createTag,\n useLocale,\n type AriaTagGroupProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createListState,\n type ListState,\n type Key,\n type SelectionMode,\n type SelectionBehavior,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n type RefLike,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n mergeRefs,\n} from \"./utils\";\nimport { SharedElementTransition } from \"./SharedElementTransition\";\nimport {\n SelectionIndicatorContext,\n type SelectionIndicatorContextValue,\n} from \"./SelectionIndicator\";\n\nexport interface TagGroupRenderProps {\n /** Whether the tag group is disabled. */\n isDisabled: boolean;\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n}\n\nexport interface TagGroupProps\n extends\n Omit<AriaTagGroupProps, \"id\">,\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\"> {\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagGroupRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagGroupRenderProps>;\n}\n\nexport interface TagListRenderProps {\n /** Whether the tag list is empty. */\n isEmpty: boolean;\n /** Whether the tag list is focused. */\n isFocused: boolean;\n}\n\nexport interface TagListProps<T>\n extends\n SlotProps,\n Omit<JSX.HTMLAttributes<HTMLDivElement>, \"class\" | \"style\" | \"children\" | \"onSelectionChange\"> {\n /** The items to display in the tag list. */\n items: T[];\n /** Function to render each item. */\n children: (item: T) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagListRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagListRenderProps>;\n /** Content to render when the list is empty. */\n renderEmptyState?: () => JSX.Element;\n /** The selection mode for the tag list. */\n selectionMode?: SelectionMode;\n /** How selection behaves in the collection. */\n selectionBehavior?: SelectionBehavior;\n /** The currently selected keys (controlled). */\n selectedKeys?: Iterable<Key>;\n /** The default selected keys (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler called when selection changes. */\n onSelectionChange?: (keys: \"all\" | Set<Key>) => void;\n /** Keys that are disabled. */\n disabledKeys?: Iterable<Key>;\n /** Function to get a unique key from an item. */\n getKey?: (item: T) => Key;\n /** Accessibility label. */\n label?: string;\n /** Custom aria-label. */\n \"aria-label\"?: string;\n /** Reference to external label element. */\n \"aria-labelledby\"?: string;\n /** Reference to description element. */\n \"aria-describedby\"?: string;\n /** Whether the tag list is disabled. */\n isDisabled?: boolean;\n /** Handler called when tags are removed. */\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport interface TagRenderProps {\n /** Whether the tag is selected. */\n isSelected: boolean;\n /** Whether the tag is disabled. */\n isDisabled: boolean;\n /** Whether the tag is focused. */\n isFocused: boolean;\n /** Whether the tag is pressed. */\n isPressed: boolean;\n /** Whether the tag allows removal. */\n allowsRemoving: boolean;\n /** The selection mode. */\n selectionMode: SelectionMode;\n /** Props for the remove button when removal is allowed. */\n removeButtonProps: Record<string, unknown>;\n}\n\nexport interface TagProps extends SlotProps {\n /** A unique key for this tag. */\n id: Key;\n /** Whether the tag is disabled. */\n isDisabled?: boolean;\n /** A text value for accessibility. */\n textValue?: string;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<TagRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<TagRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<TagRenderProps>;\n /** A ref to the tag's DOM element (merged with the internal collection ref). */\n ref?: RefLike<HTMLDivElement>;\n /** Handler called when the tag is activated. */\n onAction?: (key: Key) => void;\n}\n\ninterface TagGroupContextValue {\n state: ListState;\n onRemove?: (keys: Set<Key>) => void;\n isDisabled?: boolean;\n}\n\ninterface TagContextValue {\n removeButtonProps: Record<string, unknown>;\n allowsRemoving: boolean;\n}\n\nexport const TagGroupContext = createContext<TagGroupContextValue | null>(null);\nexport const TagListStateContext = createContext<ListState | null>(null);\nexport const TagContext = createContext<TagContextValue | null>(null);\n\nexport function useTagGroupContext(): TagGroupContextValue | null {\n return useContext(TagGroupContext);\n}\n\n/**\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n *\n * @example\n * ```tsx\n * <TagGroup label=\"Categories\" onRemove={(keys) => removeItems(keys)}>\n * <TagList items={items}>\n * {(item) => <Tag id={item.id}>{item.name}</Tag>}\n * </TagList>\n * </TagGroup>\n * ```\n */\nexport function TagGroup(props: TagGroupProps): JSX.Element {\n const [local, domProps] = splitProps(props, [\"class\", \"style\", \"slot\", \"children\"]);\n\n // We need TagList to provide the state, so TagGroup just provides context\n return (\n <div\n {...domProps}\n class={typeof local.class === \"string\" ? local.class : \"solidaria-TagGroup\"}\n style={typeof local.style === \"object\" ? local.style : undefined}\n slot={local.slot}\n >\n {props.children}\n </div>\n );\n}\n\n/**\n * TagList contains the list of tags within a TagGroup.\n */\nexport function TagList<T extends { id?: Key; key?: Key }>(props: TagListProps<T>): JSX.Element {\n const [local, domProps] = splitProps(props, [\n \"items\",\n \"class\",\n \"style\",\n \"slot\",\n \"renderEmptyState\",\n \"children\",\n \"selectionMode\",\n \"selectionBehavior\",\n \"selectedKeys\",\n \"defaultSelectedKeys\",\n \"onSelectionChange\",\n \"disabledKeys\",\n \"getKey\",\n \"label\",\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-describedby\",\n \"isDisabled\",\n \"onRemove\",\n ]);\n\n // Create a ref for the grid\n const [gridRef, setGridRef] = createSignal<HTMLDivElement | null>(null);\n\n // Default getKey function\n const getKey = (item: T): Key => {\n if (local.getKey) return local.getKey(item);\n if (item.id !== undefined) return item.id;\n if (item.key !== undefined) return item.key;\n return String(item);\n };\n\n const state = createListState({\n get items() {\n return local.items;\n },\n getKey,\n get selectionMode() {\n return local.selectionMode ?? \"none\";\n },\n get selectionBehavior() {\n return local.selectionBehavior ?? \"toggle\";\n },\n get selectedKeys() {\n return local.selectedKeys;\n },\n get defaultSelectedKeys() {\n return local.defaultSelectedKeys;\n },\n get onSelectionChange() {\n return local.onSelectionChange;\n },\n get disabledKeys() {\n return local.disabledKeys;\n },\n });\n\n // The tag group navigates on the inline axis, so ArrowLeft/ArrowRight flip\n // under RTL. Thread the resolved layout direction into the hook (mirrors\n // ListBox, and useTagGroup passing `direction` to the ListKeyboardDelegate).\n const locale = useLocale();\n\n // Create tag group accessibility props\n const tagGroupAria = createTagGroup(\n {\n get \"aria-label\"() {\n return local[\"aria-label\"] ?? (!local[\"aria-labelledby\"] ? local.label : undefined);\n },\n get \"aria-labelledby\"() {\n return local[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return local[\"aria-describedby\"];\n },\n get isDisabled() {\n return local.isDisabled;\n },\n get onRemove() {\n return local.onRemove;\n },\n get direction() {\n return locale().direction;\n },\n },\n state,\n gridRef,\n );\n\n const [isFocused, setIsFocused] = createSignal(false);\n\n const renderValues = createMemo<TagListRenderProps>(() => ({\n isEmpty: local.items.length === 0,\n isFocused: isFocused(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-TagList\",\n },\n renderValues,\n );\n\n const contextValue: TagGroupContextValue = {\n state,\n get onRemove() {\n return local.onRemove;\n },\n get isDisabled() {\n return local.isDisabled;\n },\n };\n\n return (\n <TagGroupContext.Provider value={contextValue}>\n <TagListStateContext.Provider value={state}>\n <div\n ref={setGridRef}\n {...domProps}\n {...tagGroupAria.gridProps}\n class={renderProps.class()}\n style={renderProps.style()}\n // Track focus-within via the BUBBLING focusin/focusout pair (not the\n // non-bubbling focus/blur the hook's trampoline uses) so this render-prop\n // signal never clobbers `gridProps.onFocus` — the container focus\n // trampoline that marshals entry onto the first/last row.\n onFocusIn={() => {\n setIsFocused(true);\n }}\n onFocusOut={(e) => {\n const nextTarget = e.relatedTarget as Node | null;\n if (nextTarget && e.currentTarget.contains(nextTarget)) {\n return;\n }\n\n setIsFocused(false);\n }}\n data-empty={dataAttr(local.items.length === 0)}\n data-focused={dataAttr(isFocused())}\n >\n <SharedElementTransition>\n <Show when={local.items.length > 0} fallback={local.renderEmptyState?.()}>\n <For each={local.items}>{(item) => props.children(item)}</For>\n </Show>\n </SharedElementTransition>\n </div>\n </TagListStateContext.Provider>\n </TagGroupContext.Provider>\n );\n}\n\n/**\n * A Tag is an individual item within a TagList.\n */\nexport function Tag(props: TagProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"id\",\n \"class\",\n \"style\",\n \"slot\",\n \"isDisabled\",\n \"textValue\",\n \"onAction\",\n \"ref\",\n ]);\n\n const state = useContext(TagListStateContext);\n const groupContext = useContext(TagGroupContext);\n\n // Create a ref for the tag\n const [tagRef, setTagRef] = createSignal<HTMLDivElement | null>(null);\n\n // Create tag accessibility props\n const tagAria = createTag(\n {\n get key() {\n return local.id;\n },\n role: \"row\",\n get isDisabled() {\n return local.isDisabled || groupContext?.isDisabled;\n },\n get textValue() {\n return local.textValue;\n },\n },\n state!,\n tagRef,\n );\n\n const normalizedRemoveButtonProps = createMemo<Record<string, unknown>>(() => {\n const raw = tagAria.removeButtonProps;\n const rawHandler = typeof raw.onPress === \"function\" ? (raw.onPress as () => void) : undefined;\n return {\n ...raw,\n onPress: () => {\n if (!tagAria.isDisabled && groupContext?.onRemove) {\n groupContext.onRemove(new Set([local.id]));\n return;\n }\n rawHandler?.();\n },\n };\n });\n\n const renderValues = createMemo<TagRenderProps>(() => ({\n isSelected: tagAria.isSelected,\n isDisabled: tagAria.isDisabled,\n isFocused: tagAria.isFocused,\n isPressed: tagAria.isPressed,\n allowsRemoving: tagAria.allowsRemoving,\n selectionMode: state?.selectionMode() ?? \"none\",\n removeButtonProps: normalizedRemoveButtonProps(),\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Tag\",\n },\n renderValues,\n );\n\n const selectionIndicatorContext = createMemo<SelectionIndicatorContextValue>(() => ({\n isSelected: () => tagAria.isSelected,\n }));\n\n const domProps = createMemo(() => filterDOMProps(rest, { global: true }));\n\n return (\n <SelectionIndicatorContext.Provider value={selectionIndicatorContext()}>\n <TagContext.Provider\n value={{\n get removeButtonProps() {\n return normalizedRemoveButtonProps();\n },\n get allowsRemoving() {\n return tagAria.allowsRemoving;\n },\n }}\n >\n <div\n ref={mergeRefs(setTagRef, local.ref)}\n {...domProps()}\n {...tagAria.rowProps}\n class={renderProps.class()}\n style={renderProps.style()}\n onClick={(event) => {\n const rowClick = tagAria.rowProps.onClick;\n if (typeof rowClick === \"function\") {\n (rowClick as JSX.EventHandler<HTMLDivElement, MouseEvent>)(event);\n }\n\n if (!tagAria.isDisabled && !(event.target as Element | null)?.closest(\"button\")) {\n local.onAction?.(local.id);\n }\n }}\n data-selected={dataAttr(tagAria.isSelected)}\n data-disabled={dataAttr(tagAria.isDisabled)}\n data-focused={dataAttr(tagAria.isFocused)}\n data-pressed={dataAttr(tagAria.isPressed)}\n data-allows-removing={dataAttr(tagAria.allowsRemoving)}\n >\n <div {...tagAria.gridCellProps} style={{ display: \"contents\" }}>\n {renderProps.renderChildren()}\n </div>\n </div>\n </TagContext.Provider>\n </SelectionIndicatorContext.Provider>\n );\n}\n\nexport interface TagRemoveButtonProps {\n /** The children of the button (usually an X icon). */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n /** Explicit button props from Tag render props. */\n buttonProps?: Record<string, unknown>;\n}\n\n/**\n * TagRemoveButton is the button used to remove a tag.\n * It should be placed inside a Tag component.\n */\nexport function TagRemoveButton(props: TagRemoveButtonProps): JSX.Element {\n const tagContext = useContext(TagContext);\n const getRemoveButtonProps = () => props.buttonProps ?? tagContext?.removeButtonProps ?? {};\n const getIsDisabled = () => Boolean(getRemoveButtonProps().isDisabled);\n const rawId = getRemoveButtonProps().id;\n const rawAriaLabel = getRemoveButtonProps()[\"aria-label\"];\n const rawAriaLabelledBy = getRemoveButtonProps()[\"aria-labelledby\"];\n const buttonId: string | undefined = typeof rawId === \"string\" ? rawId : undefined;\n const ariaLabel: string = typeof rawAriaLabel === \"string\" ? rawAriaLabel : \"Remove\";\n const ariaLabelledBy: string | undefined =\n typeof rawAriaLabelledBy === \"string\" ? rawAriaLabelledBy : undefined;\n\n const handleClick: JSX.EventHandler<HTMLButtonElement, MouseEvent> = (event) => {\n event.stopPropagation();\n const handler = getRemoveButtonProps().onPress;\n if (typeof handler === \"function\" && !getIsDisabled()) {\n (handler as () => void)();\n }\n };\n const stopRowPress: JSX.EventHandler<HTMLButtonElement, PointerEvent> = (event) => {\n event.stopPropagation();\n };\n\n return (\n <button\n type=\"button\"\n class={props.class ?? \"solidaria-TagRemoveButton\"}\n style={props.style}\n id={buttonId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n disabled={getIsDisabled()}\n data-allows-removing={dataAttr(tagContext?.allowsRemoving ?? false)}\n onPointerDown={stopRowPress}\n onClick={handleClick}\n >\n {props.children ?? \"×\"}\n </button>\n );\n}\n\nexport type { Key, SelectionMode, SelectionBehavior };\n"],"mappings":";;;;;;;;;;;;;;;;AAsKA,MAAa,kBAAkB,cAA2C,IAAI;AAC9E,MAAa,sBAAsB,cAAgC,IAAI;AACvE,MAAa,aAAa,cAAsC,IAAI;AAEpE,SAAgB,qBAAkD;CAChE,OAAO,WAAW,eAAe;AACnC;;;;;;;;;;;;;;AAeA,SAAgB,SAAS,OAAmC;CAC1D,MAAM,CAAC,OAAO,YAAY,WAAW,OAAO;EAAC;EAAS;EAAS;EAAQ;CAAU,CAAC;CAGlF,OACE,CAAC,QACK,UACJ,OAAO,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ,sBACvD,OAAO,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ,KAAA,GACvD,MAAM,MAAM,MACb;OACE,MAAM,SAAS;IAClB,EAAE;AAEN;;;;AAKA,SAAgB,QAA2C,OAAqC;CAC9F,MAAM,CAAC,OAAO,YAAY,WAAW,OAAO;EAC1C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAGD,MAAM,CAAC,SAAS,cAAc,aAAoC,IAAI;CAGtE,MAAM,UAAU,SAAiB;EAC/B,IAAI,MAAM,QAAQ,OAAO,MAAM,OAAO,IAAI;EAC1C,IAAI,KAAK,OAAO,KAAA,GAAW,OAAO,KAAK;EACvC,IAAI,KAAK,QAAQ,KAAA,GAAW,OAAO,KAAK;EACxC,OAAO,OAAO,IAAI;CACpB;CAEA,MAAM,QAAQ,gBAAgB;EAC5B,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;EACA;EACA,IAAI,gBAAgB;GAClB,OAAO,MAAM,iBAAiB;EAChC;EACA,IAAI,oBAAoB;GACtB,OAAO,MAAM,qBAAqB;EACpC;EACA,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AqB,CAAC,CAAC,UAAU;CACrE,MAAM,QAAQ,qBAAqB,CAAC,CAAC;CACrC,MAAM,eAAe,qBAAqB,CAAC,CAAC;CAC5C,MAAM,oBAAoB,qBAAqB,CAAC,CAAC;CACjD,MAAM,WAA+B,OAAO,UAAU,WAAW,QAAQ,KAAA;CACzE,MAAM,YAAoB,OAAO,iBAAiB,WAAW,eAAe;CAC5E,MAAM,iBACJ,OAAO,sBAAsB,WAAW,oBAAoB,KAAA;CAE9D,MAAM,eAAgE,UAAU;EAC9E,MAAM,gBAAgB;EACtB,MAAM,UAAU,qBAAqB,CAAC,CAAC;EACvC,IAAI,OAAO,YAAY,cAAc,CAAC,cAAc,GAClD,QAAwB;CAE5B;CACA,MAAM,gBAAmE,UAAU;EACjF,MAAM,gBAAgB;CACxB;CAEA,OACE,CAAC,OACC,cACA,OAAO,MAAM,SAAS,6BACtB,OAAO,MAAM,OACb,IAAI,UACJ,YAAY,WACZ,iBAAiB,gBACjB,UAAU,cAAc,GACxB,sBAAsB,SAAS,YAAY,kBAAkB,KAAK,GAClE,eAAe,cACf,SAAS,aACV;OACE,MAAM,YAAY,IAAI;IACzB,EAAE;AAEN"}
|
package/dist/TextField.js
CHANGED
|
@@ -324,7 +324,10 @@ function TextField(props) {
|
|
|
324
324
|
}
|
|
325
325
|
};
|
|
326
326
|
const domProps = createMemo(() => {
|
|
327
|
-
const filtered = filterDOMProps(ariaProps, {
|
|
327
|
+
const filtered = filterDOMProps(ariaProps, {
|
|
328
|
+
global: true,
|
|
329
|
+
events: false
|
|
330
|
+
});
|
|
328
331
|
delete filtered.id;
|
|
329
332
|
return filtered;
|
|
330
333
|
});
|
package/dist/TextField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","names":["JSX","Context","createContext","useContext","createMemo","createSignal","createEffect","onCleanup","onMount","splitProps","untrack","createTextField","createFocusRing","createHover","mergeProps","AriaTextFieldProps","createTextFieldState","VALID_VALIDITY_STATE","ValidationResult","FormContext","FormProps","FieldErrorContext","FieldErrorContextValue","RenderChildren","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","filterDOMProps","Provider","TextContext","TextFieldRenderProps","isDisabled","isInvalid","isReadOnly","isRequired","isHovered","isFocused","isFocusVisible","TextFieldProps","Omit","children","class","style","render","props","HTMLAttributes","HTMLDivElement","renderProps","Element","TextFieldContextValue","labelProps","LabelHTMLAttributes","HTMLLabelElement","inputProps","InputHTMLAttributes","HTMLInputElement","descriptionProps","HTMLElement","errorMessageProps","slots","Record","inputId","setInputId","id","TextFieldContext","LabelContext","InputContext","TextAreaContext","FieldInputContext","withFormValidationBehavior","formContext","validationBehavior","Proxy","get","target","property","receiver","localValue","Reflect","undefined","has","ownKeys","keys","Set","add","Array","from","getOwnPropertyDescriptor","descriptor","enumerable","configurable","LabelProps","Label","context","localDOMProps","result","propsRecord","key","mergedProps","localProps","ref","_ref","contextLabelProps","merged","for","_el$","_$getNextElement","_tmpl$","_$spread","_$mergeProps","_$insert","_$runHydrationEvents","InputProps","eventWithCurrentTarget","event","Event","element","T","value","bind","clearDelegatedTextEntryHandlers","delegatedElement","$$input","$$change","Input","inputElement","contextInputProps","inputHandler","handler","onInput","EventHandler","InputEvent","currentTarget","stopPropagation","changeHandler","onChange","addEventListener","removeEventListener","_el$2","_tmpl$2","_$use","TextAreaProps","TextareaHTMLAttributes","HTMLTextAreaElement","TextArea","textAreaElement","type","_type","_el$3","_tmpl$3","TextField","contextProps","contextSlotProps","slot","contextBaseProps","_labelProps","_inputProps","_descriptionProps","_errorMessageProps","_isInvalid","_slots","_setInputId","rest","baseProps","local","ariaProps","state","defaultValue","inputAriaProps","clean","startsWith","textFieldAria","setValue","focusProps","hoverProps","inputIdOverride","setInputIdOverride","renderValues","defaultClassName","childRenderValues","domProps","filtered","global","cleanHoverProps","fieldValidation","errorMessage","validationErrors","validationDetails","customError","valid","fieldErrorContext","validation","contextValue","FieldChildren","textSlots","description","FieldChildrenSlotted","_$createComponent","values","rootProps","customRootProps","_$memo","_el$4","_tmpl$4"],"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,MAAaiE,mBAAmB/D,cAA4C,IAAI;AAChF,MAAagE,eAAeD;AAC5B,MAAaE,eAAeF;AAC5B,MAAaG,kBAAkBH;AAC/B,MAAaI,oBAAoBJ;AAEjC,SAASK,2BACPzB,OACA0B,aACgB;CAChB,IAAI,CAACA,aAAaC,oBAChB,OAAO3B;CAGT,OAAO,IAAI4B,MAAM5B,OAAO;EACtB6B,IAAIC,QAAQC,UAAUC,UAAU;GAC9B,MAAMC,aAAaC,QAAQL,IAAIC,QAAQC,UAAUC,QAAQ;GACzD,IAAID,aAAa,wBAAwBE,eAAeE,KAAAA,GACtD,OAAOT,YAAYC;GAGrB,OAAOM;EACT;EACAG,IAAIN,QAAQC,UAAU;GACpB,OACEG,QAAQE,IAAIN,QAAQC,QAAQ,KAC3BA,aAAa,wBAAwBL,YAAYC,uBAAuBQ,KAAAA;EAE7E;EACAE,QAAQP,QAAQ;GACd,MAAMQ,OAAO,IAAIC,IAAIL,QAAQG,QAAQP,MAAM,CAAC;GAC5C,IAAIJ,YAAYC,uBAAuBQ,KAAAA,GACrCG,KAAKE,IAAI,oBAAoB;GAG/B,OAAOC,MAAMC,KAAKJ,IAAI;EACxB;EACAK,yBAAyBb,QAAQC,UAAU;GACzC,MAAMa,aAAaV,QAAQS,yBAAyBb,QAAQC,QAAQ;GACpE,IAAIa,YACF,OAAOA;GAGT,IAAIb,aAAa,wBAAwBL,YAAYC,uBAAuBQ,KAAAA,GAC1E,OAAO;IACLU,YAAY;IACZC,cAAc;IACdjB,WAAWH,YAAYC;GACzB;EAIJ;CACF,CAAC;AACH;;;;;AAUA,SAAgBqB,MAAMhD,OAAgC;CACpD,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CAAA;MAAArF,mBAAA;MAAA,OAAA2F;KAAA,EAAA,CAAA;IAExB;GAAA,CAAA;EAAA;CAAA,CAAA;AAIT"}
|
|
1
|
+
{"version":3,"file":"TextField.js","names":["JSX","Context","createContext","useContext","createMemo","createSignal","createEffect","onCleanup","onMount","splitProps","untrack","createTextField","createFocusRing","createHover","mergeProps","AriaTextFieldProps","createTextFieldState","VALID_VALIDITY_STATE","ValidationResult","FormContext","FormProps","FieldErrorContext","FieldErrorContextValue","RenderChildren","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","filterDOMProps","Provider","TextContext","TextFieldRenderProps","isDisabled","isInvalid","isReadOnly","isRequired","isHovered","isFocused","isFocusVisible","TextFieldProps","Omit","children","class","style","render","props","HTMLAttributes","HTMLDivElement","renderProps","Element","TextFieldContextValue","labelProps","LabelHTMLAttributes","HTMLLabelElement","inputProps","InputHTMLAttributes","HTMLInputElement","descriptionProps","HTMLElement","errorMessageProps","slots","Record","inputId","setInputId","id","TextFieldContext","LabelContext","InputContext","TextAreaContext","FieldInputContext","withFormValidationBehavior","formContext","validationBehavior","Proxy","get","target","property","receiver","localValue","Reflect","undefined","has","ownKeys","keys","Set","add","Array","from","getOwnPropertyDescriptor","descriptor","enumerable","configurable","LabelProps","Label","context","localDOMProps","result","propsRecord","key","mergedProps","localProps","ref","_ref","contextLabelProps","merged","for","_el$","_$getNextElement","_tmpl$","_$spread","_$mergeProps","_$insert","_$runHydrationEvents","InputProps","eventWithCurrentTarget","event","Event","element","T","value","bind","clearDelegatedTextEntryHandlers","delegatedElement","$$input","$$change","Input","inputElement","contextInputProps","inputHandler","handler","onInput","EventHandler","InputEvent","currentTarget","stopPropagation","changeHandler","onChange","addEventListener","removeEventListener","_el$2","_tmpl$2","_$use","TextAreaProps","TextareaHTMLAttributes","HTMLTextAreaElement","TextArea","textAreaElement","type","_type","_el$3","_tmpl$3","TextField","contextProps","contextSlotProps","slot","contextBaseProps","_labelProps","_inputProps","_descriptionProps","_errorMessageProps","_isInvalid","_slots","_setInputId","rest","baseProps","local","ariaProps","state","defaultValue","inputAriaProps","clean","startsWith","textFieldAria","setValue","focusProps","hoverProps","inputIdOverride","setInputIdOverride","renderValues","defaultClassName","childRenderValues","domProps","filtered","global","events","cleanHoverProps","fieldValidation","errorMessage","validationErrors","validationDetails","customError","valid","fieldErrorContext","validation","contextValue","FieldChildren","textSlots","description","FieldChildrenSlotted","_$createComponent","values","rootProps","customRootProps","_$memo","_el$4","_tmpl$4"],"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,MAAaiE,mBAAmB/D,cAA4C,IAAI;AAChF,MAAagE,eAAeD;AAC5B,MAAaE,eAAeF;AAC5B,MAAaG,kBAAkBH;AAC/B,MAAaI,oBAAoBJ;AAEjC,SAASK,2BACPzB,OACA0B,aACgB;CAChB,IAAI,CAACA,aAAaC,oBAChB,OAAO3B;CAGT,OAAO,IAAI4B,MAAM5B,OAAO;EACtB6B,IAAIC,QAAQC,UAAUC,UAAU;GAC9B,MAAMC,aAAaC,QAAQL,IAAIC,QAAQC,UAAUC,QAAQ;GACzD,IAAID,aAAa,wBAAwBE,eAAeE,KAAAA,GACtD,OAAOT,YAAYC;GAGrB,OAAOM;EACT;EACAG,IAAIN,QAAQC,UAAU;GACpB,OACEG,QAAQE,IAAIN,QAAQC,QAAQ,KAC3BA,aAAa,wBAAwBL,YAAYC,uBAAuBQ,KAAAA;EAE7E;EACAE,QAAQP,QAAQ;GACd,MAAMQ,OAAO,IAAIC,IAAIL,QAAQG,QAAQP,MAAM,CAAC;GAC5C,IAAIJ,YAAYC,uBAAuBQ,KAAAA,GACrCG,KAAKE,IAAI,oBAAoB;GAG/B,OAAOC,MAAMC,KAAKJ,IAAI;EACxB;EACAK,yBAAyBb,QAAQC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AzJ,WAAA;KAAA,OAC3CkK,WAAA,CAAA,CAAAtC,MAAMzH,MAAM,CAAA,CAAA,IACXyH,MAAMzH,OAAO8J,gBAAgB,GAAGxB,aAAa,CAAC,WAAC;MAAA,IAAA0B,QAAAjG,eAAAkG,OAAA;MAAAhG,OAAA+F,OAAA9F,WAEtC2F,SAAS,GAAA,OAAA,IAAA;MAAA1F,OAAA6F,OAAAL,gBACfD,sBAAoB,CAAA,CAAA,CAAA;MAAAtF,mBAAA;MAAA,OAAA4F;KAAA,EAAA,CAAA;IAExB;GAAA,CAAA;EAAA;CAAA,CAAA;AAIT"}
|
package/dist/TextField.jsx
CHANGED
|
@@ -304,7 +304,10 @@ function TextField(props) {
|
|
|
304
304
|
}
|
|
305
305
|
};
|
|
306
306
|
const domProps = createMemo(() => {
|
|
307
|
-
const filtered = filterDOMProps(ariaProps, {
|
|
307
|
+
const filtered = filterDOMProps(ariaProps, {
|
|
308
|
+
global: true,
|
|
309
|
+
events: false
|
|
310
|
+
});
|
|
308
311
|
delete filtered.id;
|
|
309
312
|
return filtered;
|
|
310
313
|
});
|