@mortenbrudvik/waveui 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +758 -152
- package/dist/components/button/Toolbar.cjs +1 -1
- package/dist/components/button/Toolbar.cjs.map +1 -1
- package/dist/components/button/Toolbar.mjs +25 -30
- package/dist/components/button/Toolbar.mjs.map +1 -1
- package/dist/components/button/Toolbar.navigation.cjs +2 -0
- package/dist/components/button/Toolbar.navigation.cjs.map +1 -0
- package/dist/components/button/Toolbar.navigation.mjs +17 -0
- package/dist/components/button/Toolbar.navigation.mjs.map +1 -0
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.context.cjs +2 -0
- package/dist/components/data-display/Avatar.context.cjs.map +1 -0
- package/dist/components/data-display/Avatar.context.mjs +9 -0
- package/dist/components/data-display/Avatar.context.mjs.map +1 -0
- package/dist/components/data-display/Avatar.mjs +66 -61
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/InteractionTag.cjs +2 -0
- package/dist/components/data-display/InteractionTag.cjs.map +1 -0
- package/dist/components/data-display/InteractionTag.mjs +234 -0
- package/dist/components/data-display/InteractionTag.mjs.map +1 -0
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +222 -90
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/data-display/TagGroup.cjs +2 -0
- package/dist/components/data-display/TagGroup.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.cjs +2 -0
- package/dist/components/data-display/TagGroup.context.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.mjs +113 -0
- package/dist/components/data-display/TagGroup.context.mjs.map +1 -0
- package/dist/components/data-display/TagGroup.mjs +149 -0
- package/dist/components/data-display/TagGroup.mjs.map +1 -0
- package/dist/components/data-display/tagStyles.cjs +2 -0
- package/dist/components/data-display/tagStyles.cjs.map +1 -0
- package/dist/components/data-display/tagStyles.mjs +108 -0
- package/dist/components/data-display/tagStyles.mjs.map +1 -0
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +213 -181
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/input/Calendar.cjs +2 -0
- package/dist/components/input/Calendar.cjs.map +1 -0
- package/dist/components/input/Calendar.mjs +352 -0
- package/dist/components/input/Calendar.mjs.map +1 -0
- package/dist/components/input/Calendar.views.cjs +2 -0
- package/dist/components/input/Calendar.views.cjs.map +1 -0
- package/dist/components/input/Calendar.views.mjs +194 -0
- package/dist/components/input/Calendar.views.mjs.map +1 -0
- package/dist/components/input/ColorArea.cjs +1 -1
- package/dist/components/input/ColorArea.cjs.map +1 -1
- package/dist/components/input/ColorArea.mjs +18 -18
- package/dist/components/input/ColorArea.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +7 -7
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +232 -156
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Combobox.text.cjs +2 -0
- package/dist/components/input/Combobox.text.cjs.map +1 -0
- package/dist/components/input/Combobox.text.mjs +24 -0
- package/dist/components/input/Combobox.text.mjs.map +1 -0
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +203 -288
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +135 -109
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +2 -0
- package/dist/components/input/Listbox.cjs.map +1 -0
- package/dist/components/input/Listbox.mjs +134 -0
- package/dist/components/input/Listbox.mjs.map +1 -0
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +163 -97
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.cjs +2 -0
- package/dist/components/input/SwatchPicker.context.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.context.mjs +35 -0
- package/dist/components/input/SwatchPicker.context.mjs.map +1 -0
- package/dist/components/input/SwatchPicker.mjs +131 -103
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.swatches.cjs +2 -0
- package/dist/components/input/SwatchPicker.swatches.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.swatches.mjs +207 -0
- package/dist/components/input/SwatchPicker.swatches.mjs.map +1 -0
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.context.cjs +2 -0
- package/dist/components/input/TagPicker.context.cjs.map +1 -0
- package/dist/components/input/TagPicker.context.mjs +20 -0
- package/dist/components/input/TagPicker.context.mjs.map +1 -0
- package/dist/components/input/TagPicker.create.cjs +2 -0
- package/dist/components/input/TagPicker.create.cjs.map +1 -0
- package/dist/components/input/TagPicker.create.mjs +24 -0
- package/dist/components/input/TagPicker.create.mjs.map +1 -0
- package/dist/components/input/TagPicker.mjs +13 -274
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/TagPicker.option.cjs +2 -0
- package/dist/components/input/TagPicker.option.cjs.map +1 -0
- package/dist/components/input/TagPicker.option.mjs +45 -0
- package/dist/components/input/TagPicker.option.mjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.cjs +2 -0
- package/dist/components/input/TagPicker.overflow.cjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.mjs +153 -0
- package/dist/components/input/TagPicker.overflow.mjs.map +1 -0
- package/dist/components/input/TagPicker.parts.cjs +2 -0
- package/dist/components/input/TagPicker.parts.cjs.map +1 -0
- package/dist/components/input/TagPicker.parts.mjs +425 -0
- package/dist/components/input/TagPicker.parts.mjs.map +1 -0
- package/dist/components/input/TagPicker.root.cjs +2 -0
- package/dist/components/input/TagPicker.root.cjs.map +1 -0
- package/dist/components/input/TagPicker.root.mjs +416 -0
- package/dist/components/input/TagPicker.root.mjs.map +1 -0
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +77 -77
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/input/dateUtils.cjs +1 -1
- package/dist/components/input/dateUtils.cjs.map +1 -1
- package/dist/components/input/dateUtils.mjs +114 -96
- package/dist/components/input/dateUtils.mjs.map +1 -1
- package/dist/components/input/pickerLabels.cjs +2 -0
- package/dist/components/input/pickerLabels.cjs.map +1 -0
- package/dist/components/input/pickerLabels.mjs +16 -0
- package/dist/components/input/pickerLabels.mjs.map +1 -0
- package/dist/components/input/pickerValues.cjs +2 -0
- package/dist/components/input/pickerValues.cjs.map +1 -0
- package/dist/components/input/pickerValues.mjs +24 -0
- package/dist/components/input/pickerValues.mjs.map +1 -0
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/navigation/Hamburger.cjs +2 -0
- package/dist/components/navigation/Hamburger.cjs.map +1 -0
- package/dist/components/navigation/Hamburger.mjs +54 -0
- package/dist/components/navigation/Hamburger.mjs.map +1 -0
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.context.cjs +2 -0
- package/dist/components/navigation/Nav.context.cjs.map +1 -0
- package/dist/components/navigation/Nav.context.mjs +137 -0
- package/dist/components/navigation/Nav.context.mjs.map +1 -0
- package/dist/components/navigation/Nav.mjs +151 -258
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/Nav.parts.cjs +2 -0
- package/dist/components/navigation/Nav.parts.cjs.map +1 -0
- package/dist/components/navigation/Nav.parts.mjs +77 -0
- package/dist/components/navigation/Nav.parts.mjs.map +1 -0
- package/dist/components/navigation/Nav.root.cjs +2 -0
- package/dist/components/navigation/Nav.root.cjs.map +1 -0
- package/dist/components/navigation/Nav.root.mjs +78 -0
- package/dist/components/navigation/Nav.root.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.cjs +2 -0
- package/dist/components/navigation/NavDrawer.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.cjs +2 -0
- package/dist/components/navigation/NavDrawer.context.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.mjs +11 -0
- package/dist/components/navigation/NavDrawer.context.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.mjs +179 -0
- package/dist/components/navigation/NavDrawer.mjs.map +1 -0
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +190 -125
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.cjs +1 -1
- package/dist/components/overlays/Dialog.shared.cjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.mjs +157 -81
- package/dist/components/overlays/Dialog.shared.mjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.cjs +2 -0
- package/dist/components/overlays/Dialog.slots.cjs.map +1 -0
- package/dist/components/overlays/Dialog.slots.mjs +129 -0
- package/dist/components/overlays/Dialog.slots.mjs.map +1 -0
- package/dist/components/overlays/Drawer.cjs +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.context.cjs +2 -0
- package/dist/components/overlays/Drawer.context.cjs.map +1 -0
- package/dist/components/overlays/Drawer.context.mjs +29 -0
- package/dist/components/overlays/Drawer.context.mjs.map +1 -0
- package/dist/components/overlays/Drawer.mjs +12 -187
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +2 -0
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -0
- package/dist/components/overlays/Drawer.panel.mjs +159 -0
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.cjs +2 -0
- package/dist/components/overlays/Drawer.parts.cjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.mjs +152 -0
- package/dist/components/overlays/Drawer.parts.mjs.map +1 -0
- package/dist/components/overlays/Drawer.root.cjs +2 -0
- package/dist/components/overlays/Drawer.root.cjs.map +1 -0
- package/dist/components/overlays/Drawer.root.mjs +207 -0
- package/dist/components/overlays/Drawer.root.mjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.cjs +2 -0
- package/dist/components/overlays/Drawer.scroll.cjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.mjs +42 -0
- package/dist/components/overlays/Drawer.scroll.mjs.map +1 -0
- package/dist/components/table/useGridNavigation.cjs +1 -1
- package/dist/components/table/useGridNavigation.cjs.map +1 -1
- package/dist/components/table/useGridNavigation.mjs +67 -70
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/hooks/useActiveDescendant.cjs +2 -0
- package/dist/hooks/useActiveDescendant.cjs.map +1 -0
- package/dist/hooks/useActiveDescendant.mjs +56 -0
- package/dist/hooks/useActiveDescendant.mjs.map +1 -0
- package/dist/hooks/useDismiss.cjs.map +1 -1
- package/dist/hooks/useDismiss.mjs.map +1 -1
- package/dist/hooks/useFocusTrap.cjs +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs +115 -98
- package/dist/hooks/useFocusTrap.mjs.map +1 -1
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +250 -210
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +35 -22
- package/dist/hooks/useModalLayer.mjs.map +1 -1
- package/dist/hooks/useRestoreFocus.cjs +1 -1
- package/dist/hooks/useRestoreFocus.cjs.map +1 -1
- package/dist/hooks/useRestoreFocus.mjs +91 -78
- package/dist/hooks/useRestoreFocus.mjs.map +1 -1
- package/dist/hooks/useRovingGrid.cjs +2 -0
- package/dist/hooks/useRovingGrid.cjs.map +1 -0
- package/dist/hooks/useRovingGrid.mjs +69 -0
- package/dist/hooks/useRovingGrid.mjs.map +1 -0
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +102 -78
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4391 -394
- package/dist/index.d.ts +4391 -394
- package/dist/index.mjs +115 -101
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +170 -74
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/date.cjs +2 -0
- package/dist/lib/date.cjs.map +1 -0
- package/dist/lib/date.mjs +44 -0
- package/dist/lib/date.mjs.map +1 -0
- package/dist/lib/focus.cjs +1 -1
- package/dist/lib/focus.cjs.map +1 -1
- package/dist/lib/focus.mjs +5 -2
- package/dist/lib/focus.mjs.map +1 -1
- package/dist/lib/icons.cjs +1 -1
- package/dist/lib/icons.cjs.map +1 -1
- package/dist/lib/icons.mjs +13 -6
- package/dist/lib/icons.mjs.map +1 -1
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +53 -47
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +25 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagPicker.root.cjs","names":["flattenChildren","isElementOfType","TagPickerList","useFieldContext","useFieldControl","isInvalidLook","useInputLook","useControllable","EMPTY_VALUES","React","useIsClient","useId","collectOptionLabels","createOptionText","useListbox","useListboxPopup","useMergedRefs","sameValues","useFocusWithin","useTagOverflow","useEventCallback","findExactMatch","tagListControls","_Fragment","TagPickerControl","cn","tagPickerClassNames","TagPickerContext","HiddenInput","require_runtime","require_cn","require_children","require_dev","require_classNames","require_useEventCallback","require_useControllable","require_useId","require_useMergedRefs","require_useIsClient","require_useFieldControl","require_useAnnounce","require_useListbox","require_inputLook","require_Input","require_useFormReset","require_HiddenInput","require_Option","require_pickerLabels","require_pickerValues","require_TagPicker_context","require_TagPicker_create","require_TagPicker_overflow","require_TagPicker_parts","react","react_jsx_runtime","TAG_PICKER_SIZES","EMPTY_OPTIONS","EMPTY_LABELS","TAG_SIZE","defaultRemoveLabel","label","defaultSummaryLabel","labels","defaultCreateLabel","text","defaultOverflowCountLabel","count","matchesText","item","triggerMessage","ALLOW_CREATE_BUTTON_MESSAGE","LIST_PLACEMENT_MESSAGE","findList","children","node","TagPickerRoot","valueProp","openProp","queryProp","sizeProp","appearanceProp","overflowProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onChange","overflow","field","validates","required","readOnly","triggerId","triggerLabel","triggerLabelledBy","triggerDescribedBy","triggerInvalid","triggerRequired","invalidLook","coreSize","size","tagSize","tagAppearance","appearance","selected","setSelected","defaultValue","list","next","onValueChange","selectedSet","interactive","disabled","openState","setOpen","defaultOpen","onOpenChange","isClient","open","triggersRef","triggerKind","setTriggerKind","registerTrigger","token","triggers","firstKind","kind","listCountRef","registerList","isButtonTrigger","queryState","setQuery","defaultQuery","onQueryChange","query","lock","setLock","lockedOpen","rootRef","triggerRef","controlElementRef","groupRef","chipRef","summaryId","createValue","allowCreate","listElement","listChildren","registration","collected","optionByValue","map","option","options","resolvedLabels","offersCreate","dataCreateText","items","available","listFilter","matches","filter","addTag","value","commitCreate","onOptionCreate","listbox","details","getItem","labelOf","createText","listed","showCreate","expanded","noMatchesText","surfaceOpen","noMatches","rootMergedRef","ref","initial","current","form","trackFocus","trackBlur","collapsed","focusWithin","tagLabels","hiddenValues","focusTrigger","toggleOpen","removeTag","v","clear","editText","candidates","focusLastTagControl","group","last","setOpenStable","entryOf","triggerProps","tabIndex","autoFocus","inputProps","autoComplete","autoCapitalize","autoCorrect","maxLength","inputMode","spellCheck","enterKeyHint","onFocus","onBlur","onKeyDown","onKeyUp","controlRef","listLabelledBy","listLabel","hasSummary","context","placeholder","layerId","surfaceRef","floatingProps","setReference","expandIcon","clearable","parts","className"],"sources":["../../../src/components/input/TagPicker.root.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { tagPickerClassNames } from '../../lib/classNames';\nimport { warnDeprecated, warnOnce } from '../../lib/dev';\nimport type { Slot } from '../../lib/slot';\nimport type { CoreSize, InputAppearance, Size, TagAppearance, TagSize } from '../../lib/types';\nimport { useAnnounce } from '../../hooks/useAnnounce';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { collectOptionLabels, useListbox, type ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { useInputLook } from './inputLook';\nimport { isInvalidLook } from './Input';\nimport { useListboxPopup } from './Option';\nimport { announceToggle } from './pickerLabels';\nimport { EMPTY_VALUES, sameValues } from './pickerValues';\nimport type { RoutedHandlers } from './routedHandlers';\nimport { TagPickerContext } from './TagPicker.context';\nimport type {\n ResolvedTagPickerLabels,\n TagPickerContextValue,\n TagPickerInputOnlyProps,\n TagPickerTriggerKind,\n TagPickerTriggerProps,\n} from './TagPicker.context';\nimport { createOptionText, findExactMatch } from './TagPicker.create';\nimport type { ExactMatchCandidate } from './TagPicker.create';\nimport type { TagPickerOption } from './TagPicker.option';\nimport { useFocusWithin, useTagOverflow } from './TagPicker.overflow';\nimport { TagPickerControl, TagPickerList, tagListControls } from './TagPicker.parts';\n\n/**\n * The TagPicker's built-in names, descriptions and announcements, for localization. Each member is\n * optional and falls back to its English default.\n */\nexport interface TagPickerLabels {\n /** Name of a tag's remove button.\n * @default (label) => `Remove ${label}`\n */\n remove?: (label: string) => string;\n /** Name of the list of selected tags.\n * @default 'Selected'\n */\n selected?: string;\n /** Description of the input that sums up the selected tags (their labels, in order).\n * @default (labels) => `Selected: ${labels.join(', ')}`\n */\n summary?: (labels: string[]) => string;\n /** Announcement when a tag is added; `count` is the number of tags after the change.\n * @default (label, count) => `${label} added, ${count} selected`\n */\n added?: (label: string, count: number) => string;\n /** Announcement when a tag is removed; `count` is the number of tags after the change.\n * @default (label, count) => `${label} removed, ${count} selected`\n */\n removed?: (label: string, count: number) => string;\n /** Status text (announced, and shown in the popup) when the typed text matches no option.\n * @default 'No matches'\n */\n noMatches?: string;\n /**\n * Text and name of the create option (`allowCreate`), from the trimmed typed text.\n * @default (text) => `Create \"${text}\"`\n */\n create?: (text: string) => string;\n /** Name of the clear button (`clearable`). @default 'Clear selection' */\n clear?: string;\n /** Name of the expand button at the end of the field. @default 'Show options' */\n expand?: string;\n /**\n * The \"+N\" text of the single-line layout (`overflow=\"count\"`); hidden from assistive\n * technology, which hears the input's summary of every tag.\n * @default (count) => `+${count}`\n */\n overflowCount?: (count: number) => string;\n}\n\n/** Sizes of TagPicker (Fluent's): medium (the 0.7 look), large and extra-large. */\nexport type TagPickerSize = Extract<Size, 'medium' | 'large' | 'extra-large'>;\n\n/** Properties for the TagPicker component. */\nexport interface TagPickerProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | RoutedHandlers\n> {\n /**\n * The options, the array form (`{ value, label, media?, secondaryContent? }`). With parts whose\n * `TagPicker.List` has children it only names values (tags, announcements). Changed in 0.11:\n * optional.\n */\n options?: readonly TagPickerOption[];\n /**\n * The parts: `TagPicker.Control` and `TagPicker.List`, directly inside TagPicker (a Fragment is\n * fine). Without children TagPicker renders both with their defaults; without a\n * `TagPicker.List` it renders the default list after the children.\n */\n children?: React.ReactNode;\n /**\n * Controlled array of selected option values (`[]` for none). Fluent's `selectedOptions`.\n */\n value?: readonly string[];\n /**\n * Initial selected values for uncontrolled usage; a form reset restores them.\n * @default []\n */\n defaultValue?: readonly string[];\n /**\n * Called with the new selection when it changes: a tag is added (an option, or a created tag)\n * or removed, or a form reset restores different tags. Fluent's `onOptionSelect`.\n */\n onValueChange?: (value: string[]) => void;\n /**\n * Called with the new selection when it changes: a tag is added or removed, or a form reset\n * restores different tags.\n * @deprecated Use `onValueChange`.\n */\n onChange?: (value: string[]) => void;\n /**\n * Controlled open state of the option list. The list renders only in the browser: an open\n * picker is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state for uncontrolled usage. A picker that starts disabled or read-only starts\n * closed. The list renders only in the browser: it is closed in the server HTML and opens once\n * the picker has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the option list opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Shown by TagPicker.Input or TagPicker.Button while no tag is selected; the part's own\n * `placeholder` wins.\n * @default 'Select...'\n */\n placeholder?: string;\n /**\n * Whether an option matches the typed text (the query). Called with every listed option, also\n * the options of `TagPicker.List`'s children (its `value`, `label` and `textValue`), and the\n * text whenever the text is not empty, never with a selected option or the create option; an\n * option it returns `false` for is filtered out. It may keep options that do not contain the\n * text: `filter={() => true}` with `query` and `onQueryChange` leaves the matching to you (a\n * server-side search that replaces `options`); for a create entry, use `allowCreate`. With a\n * server-side search, keep the selected options in `options` (they are never listed): a\n * selected value without an option shows its raw value as the tag label, with a development\n * warning (the \"Async search\" story does this).\n * @default a case-insensitive substring match on the option's `textValue ?? label`\n */\n filter?: (option: ListboxItem, query: string) => boolean;\n /**\n * Controlled query: the text typed since the last tag was added, which filters the options and\n * shows in the input (hidden while `disabled` or `readOnly`). Not used with TagPicker.Button.\n */\n query?: string;\n /**\n * Initial query for uncontrolled usage. A TagPicker that starts disabled or read-only starts\n * without it (as it starts closed). Not used with TagPicker.Button.\n * @default ''\n */\n defaultQuery?: string;\n /**\n * Called with the new query when it changes: as the user types, and with `''` when it resets (a\n * tag added or created, Escape on the closed list, the clear button, a form reset, or `disabled`\n * or `readOnly` turned on while text is typed). A blur or a close keeps the text. A TagPicker\n * that mounts disabled or read-only reports nothing: it keeps a controlled query, which shows\n * once it unlocks. Not used with TagPicker.Button.\n */\n onQueryChange?: (query: string) => void;\n /**\n * Whether the tag picker is disabled: nothing can be added or removed, the remove buttons leave\n * the tab order, and the expand and clear buttons are disabled. The field dims once.\n * @default false\n */\n disabled?: boolean;\n /**\n * Size of the tags and the field: `medium` (the 0.7 look), `large` or `extra-large` (Fluent's\n * union; TagPicker has no `small`). Default: the surrounding Field's `size`, else `WaveProvider\n * inputDefaults.size`, else `'medium'`; a Field or provider `small` gives `'medium'` too. Its\n * tags are one Tag size smaller: medium → extra-small, large → small, extra-large → medium. The\n * option list keeps its size.\n */\n size?: TagPickerSize;\n /**\n * Look of the field: `outline` (a full border), `underline` (a bottom stroke only),\n * `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible\n * label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`. The tags are\n * filled, outlined on `filled-darker`.\n */\n appearance?: InputAppearance;\n /** Name of the values in form submissions (one hidden input per value). */\n name?: string;\n /** Id of the form the values belong to, when the TagPicker is outside it. */\n form?: string;\n /**\n * At least one tag is required to submit the form (native constraint validation). Like a native\n * readonly input, a `readOnly` TagPicker does not block submission.\n */\n required?: boolean;\n /**\n * The `autocomplete` attribute of TagPicker.Input's `<input role=\"combobox\">`. Browser autofill\n * is off unless you set it (for example `'on'`). With TagPicker.Button, not used.\n * @default 'off'\n */\n autoComplete?: string;\n /**\n * The maximum length of the typed text (`maxlength` of TagPicker.Input's `<input>`). With\n * TagPicker.Button, not used.\n */\n maxLength?: number;\n /**\n * The selection cannot be changed: the trigger is read-only, the tags have no remove buttons,\n * the expand button is disabled and the clear button hidden, and the option list neither opens\n * (click, keyboard, a controlled `open`) nor adds tags; Escape is left to the page. Turning it\n * (or `disabled`) on while the list is open closes it (`onOpenChange(false)`); a focused remove\n * button hands focus to the trigger.\n */\n readOnly?: boolean;\n /**\n * Lets the user add a tag of their own text: while the trimmed text matches no option label\n * and no selected value (ignoring case) and no option value, the list ends with a create option\n * (`labels.create`); Enter on it or a click adds the text as a tag, calls `onOptionCreate`, and\n * clears the text. Needs `TagPicker.Input` (not `TagPicker.Button`). WaveUI-only: Fluent's\n * TagPicker has no free tagging.\n * @default false\n */\n allowCreate?: boolean;\n /**\n * Called with the trimmed text when the user creates a tag, before `onValueChange` reports the\n * new value. Add an option for it if you keep options: until then the tag shows the raw text.\n * WaveUI-only (see `allowCreate`).\n */\n onOptionCreate?: (text: string) => void;\n /**\n * Shows a clear button at the end of the field while a tag is selected (not while `readOnly`;\n * disabled while `disabled`): it removes every tag (`onValueChange([])`), clears the typed\n * text, closes the list and focuses the trigger (the input, or `TagPicker.Button`). A Tab stop\n * after the trigger. The name of Fluent's Combobox and Dropdown prop.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the field (default: a chevron). The button\n * opens and closes the list, keeps focus on the trigger and is not a Tab stop. `null` or\n * `undefined` keep the chevron; `false`, or a value that renders nothing, hides the button.\n * Decorative: a `<button>` passed here is unwrapped. `TagPicker.Control`'s `expandIcon` wins.\n */\n expandIcon?: Slot<'span'>;\n /**\n * `'wrap'`: the tags wrap onto more lines. `'count'`: while focus is outside the picker and its\n * list is closed, the tags stay on one line and the ones that do not fit give way to \"+N\"\n * (`labels.overflowCount`); focusing the picker shows them all. The tags are measured by\n * position: your own Tags in `TagPicker.Group` render in `value` order. WaveUI-only: Fluent's\n * single-line layout is a story, not a prop.\n * @default 'wrap'\n */\n overflow?: 'wrap' | 'count';\n /**\n * Names of the remove buttons and the tag list, the summary that describes the trigger, the\n * announcements, the \"No matches\" text, the create option, the clear and expand buttons and the\n * \"+N\" count, for localization. Unset members keep their English defaults.\n */\n labels?: TagPickerLabels;\n /**\n * Called when TagPicker.Input's `<input role=\"combobox\">` receives focus (the root keeps other\n * handlers). With TagPicker.Button, pass it (and `ref`) on the Button.\n */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Called when TagPicker.Input's `<input>` loses focus. With TagPicker.Button, pass it on the Button. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /**\n * Called on a key press in TagPicker.Input's `<input>`, after the Input's own `onKeyDown` and\n * before the built-in listbox and tag keys; `event.preventDefault()` skips them. With\n * TagPicker.Button, pass it on the Button.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Called when a key is released in TagPicker.Input's `<input>`. With TagPicker.Button, pass it on the Button. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /**\n * Ref to TagPicker.Input's `<input role=\"combobox\">` (the focusable element). With\n * TagPicker.Button, pass `ref` on the Button.\n */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * How the picker came to be locked (`disabled` or `readOnly`): not at all, by a change while\n * mounted, or since it mounted.\n */\ntype LockState = 'unlocked' | 'locked' | 'mounted-locked';\n\nconst TAG_PICKER_SIZES: readonly TagPickerSize[] = ['medium', 'large', 'extra-large'];\nconst EMPTY_OPTIONS: readonly TagPickerOption[] = [];\nconst EMPTY_LABELS: ReadonlyMap<string, string> = new Map();\n\n/** The tag size of each picker size (Fluent's mapping, D54). */\nconst TAG_SIZE: Readonly<Record<TagPickerSize, TagSize>> = {\n medium: 'extra-small',\n large: 'small',\n 'extra-large': 'medium',\n};\n\nconst defaultRemoveLabel = (label: string) => `Remove ${label}`;\nconst defaultSummaryLabel = (labels: string[]) => `Selected: ${labels.join(', ')}`;\nconst defaultCreateLabel = (text: string) => `Create \"${text}\"`;\nconst defaultOverflowCountLabel = (count: number) => `+${count}`;\n\n/** The default `filter` (Phase 5 D13): a case-insensitive substring of `textValue ?? label`. */\nfunction matchesText(item: ListboxItem, text: string): boolean {\n return (item.textValue ?? item.label).toLowerCase().includes(text.toLowerCase());\n}\n\nfunction triggerMessage(count: number): string {\n return `TagPicker: render exactly one trigger, \\`TagPicker.Input\\` or \\`TagPicker.Button\\`, inside \\`TagPicker.Control\\` (found ${count}).`;\n}\n\nconst ALLOW_CREATE_BUTTON_MESSAGE =\n 'TagPicker: `allowCreate` needs `TagPicker.Input`: `TagPicker.Button` has no text to create a tag from, so no create option is offered.';\n\nconst LIST_PLACEMENT_MESSAGE =\n 'TagPicker.List: render one TagPicker.List, directly inside TagPicker (a Fragment is fine). A second list, or one inside a component of your own, splits the options over two lists.';\n\n/** The `TagPicker.List` among the direct children and Fragments, if any (D50). */\nfunction findList(\n children: React.ReactNode,\n): React.ReactElement<{ children?: React.ReactNode }> | undefined {\n if (children === null || children === undefined) return undefined;\n for (const { node } of flattenChildren(children)) {\n if (isElementOfType<{ children?: React.ReactNode }>(node, TagPickerList)) return node;\n }\n return undefined;\n}\n\nexport const TagPickerRoot = (props: TagPickerProps) => {\n const {\n options = EMPTY_OPTIONS,\n children,\n value: valueProp,\n defaultValue,\n onValueChange,\n onChange,\n open: openProp,\n defaultOpen,\n onOpenChange,\n placeholder = 'Select...',\n filter,\n query: queryProp,\n defaultQuery,\n onQueryChange,\n disabled = false,\n size: sizeProp,\n appearance: appearanceProp,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n readOnly = false,\n allowCreate = false,\n onOptionCreate,\n clearable = false,\n expandIcon,\n overflow: overflowProp = 'wrap',\n labels,\n inputMode,\n spellCheck,\n enterKeyHint,\n autoFocus,\n tabIndex,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n ref,\n ...rest\n } = props;\n\n if (onChange !== undefined) warnDeprecated('TagPicker', 'onChange', 'onValueChange');\n const overflow = overflowProp === 'count' ? 'count' : 'wrap';\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n // Like a native readonly input, a read-only TagPicker is barred from constraint validation (the\n // user could not fix it); its values are still submitted.\n const validates = isRequired && !readOnly;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n const {\n id: triggerId,\n 'aria-label': triggerLabel,\n 'aria-labelledby': triggerLabelledBy,\n 'aria-describedby': triggerDescribedBy,\n 'aria-invalid': triggerInvalid,\n 'aria-required': triggerRequired,\n } = fieldProps;\n // The error look follows the resolved state: the consumer's `aria-invalid` or the Field's.\n const invalidLook = isInvalidLook(false, triggerInvalid);\n const { size, appearance } = useInputLook(sizeProp, appearanceProp, {\n sizes: TAG_PICKER_SIZES,\n defaultSize: 'medium',\n });\n const coreSize: CoreSize = size === 'medium' ? 'medium' : 'large';\n const tagSize = TAG_SIZE[size];\n // A muted tag would barely show on the darker fill: outlined there (D54).\n const tagAppearance: TagAppearance = appearance === 'filled-darker' ? 'outline' : 'filled';\n\n const [selected, setSelected] = useControllable<readonly string[]>(\n valueProp,\n defaultValue ?? EMPTY_VALUES,\n (next) => {\n // The props are read only; the callbacks receive an array of their own.\n const list = [...next];\n onValueChange?.(list);\n onChange?.(list);\n },\n );\n const selectedSet = React.useMemo(() => new Set(selected), [selected]);\n const interactive = !disabled && !readOnly;\n // A picker that starts disabled or read-only never shows its list, so it starts closed (no close\n // to report later).\n const [openState, setOpen] = useControllable(\n openProp,\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n // The open list lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the picker shows the closed inline list and reports it closed, so\n // aria-controls and aria-activedescendant never name a missing element.\n const isClient = useIsClient();\n const open = openState && interactive && isClient;\n // The trigger parts (D63): their kind decides the listbox mode; the server HTML and the first\n // render use the editable mode of `TagPicker.Input`.\n const triggersRef = React.useRef(new Map<object, TagPickerTriggerKind>());\n const [triggerKind, setTriggerKind] = React.useState<TagPickerTriggerKind>('input');\n const registerTrigger = React.useCallback((kind: TagPickerTriggerKind) => {\n const token = {};\n const triggers = triggersRef.current;\n const firstKind = () => triggers.values().next().value ?? 'input';\n triggers.set(token, kind);\n setTriggerKind(firstKind());\n return () => {\n triggers.delete(token);\n setTriggerKind(firstKind());\n };\n }, []);\n const listCountRef = React.useRef(0);\n const registerList = React.useCallback(() => {\n listCountRef.current += 1;\n return () => {\n listCountRef.current -= 1;\n };\n }, []);\n // After every commit (every part's layout effect has run): exactly one trigger and one List.\n React.useEffect(() => {\n const triggers = triggersRef.current.size;\n if (triggers !== 1) warnOnce('TagPicker:trigger', triggerMessage(triggers));\n if (listCountRef.current > 1) warnOnce('TagPicker.List:placement', LIST_PLACEMENT_MESSAGE);\n });\n const isButtonTrigger = triggerKind === 'button';\n\n // The query (D12): the text typed since the last tag was added, which filters the options. A\n // picker that starts locked starts without a query, as it starts closed.\n const [queryState, setQuery] = useControllable(\n queryProp,\n interactive ? (defaultQuery ?? '') : '',\n onQueryChange,\n );\n // Locking the control (readOnly/disabled) while typing drops the typed text: hidden during\n // render here, and the reset reported from an effect, since `onQueryChange` never runs during\n // render (D12). `lock` is how the picker came to be locked (previous-value pattern, C-HOOKS):\n // `'locked'` by a change while mounted, whose reset is reported once, or `'mounted-locked'`\n // since it mounted, which reports nothing and keeps a controlled query, hidden until the picker\n // unlocks (R20).\n // `TagPicker.Button` has no text entry, so no query filters its list (D63).\n const query = interactive && !isButtonTrigger ? queryState : '';\n const [lock, setLock] = React.useState<LockState>(interactive ? 'unlocked' : 'mounted-locked');\n if (interactive && lock !== 'unlocked') setLock('unlocked');\n else if (!interactive && lock === 'unlocked') setLock('locked');\n React.useEffect(() => {\n if (lock === 'locked') setQuery('');\n }, [lock, setQuery]);\n // Locking also closes the list itself, not only the derived `open`, so unlocking does not reopen\n // it without a user action. The close is reported through onOpenChange (a consumer callback from\n // an effect, C-HOOKS); a controlled `open` that stays true is still not shown while locked.\n const lockedOpen = !interactive && openState;\n React.useEffect(() => {\n if (lockedOpen) setOpen(false);\n }, [lockedOpen, setOpen]);\n // Keeps the shared live regions alive while mounted: every addition and removal is announced\n // (`announceToggle`).\n useAnnounce();\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const triggerRef = React.useRef<HTMLElement | null>(null);\n const controlElementRef = React.useRef<HTMLDivElement | null>(null);\n const groupRef = React.useRef<HTMLDivElement | null>(null);\n const chipRef = React.useRef<HTMLSpanElement | null>(null);\n const summaryId = useId('tagpicker-summary');\n const createValue = useId('tagpicker-create');\n\n React.useEffect(() => {\n if (allowCreate && isButtonTrigger) {\n warnOnce('TagPicker:allowCreate-button', ALLOW_CREATE_BUTTON_MESSAGE);\n }\n }, [allowCreate, isButtonTrigger]);\n\n // The parts form (D50): a List among the direct children with children of its own switches the\n // listbox to registration mode; `options` then only names values.\n const listElement = findList(children);\n const listChildren = listElement?.props.children;\n const registration = listChildren !== undefined && listChildren !== null;\n const collected = React.useMemo(\n () => (registration ? collectOptionLabels(listChildren) : EMPTY_LABELS),\n [registration, listChildren],\n );\n\n const optionByValue = React.useMemo(() => {\n const map = new Map<string, TagPickerOption>();\n for (const option of options) if (!map.has(option.value)) map.set(option.value, option);\n return map;\n }, [options]);\n\n const resolvedLabels = React.useMemo<ResolvedTagPickerLabels>(\n () => ({\n remove: labels?.remove ?? defaultRemoveLabel,\n selected: labels?.selected ?? 'Selected',\n create: labels?.create ?? defaultCreateLabel,\n clear: labels?.clear ?? 'Clear selection',\n expand: labels?.expand ?? 'Show options',\n overflowCount: labels?.overflowCount ?? defaultOverflowCountLabel,\n noMatches: labels?.noMatches ?? 'No matches',\n }),\n [labels],\n );\n\n // The create option (D59) needs the text input, an interactive picker and an open list.\n const offersCreate =\n allowCreate && interactive && !isButtonTrigger && open && query.trim() !== '';\n // Data mode: the duplicate check reads every `options` entry, before the listbox, since the\n // create item is one of its items.\n const dataCreateText =\n offersCreate && !registration\n ? createOptionText(query, {\n labels: options.map((option) => option.label),\n values: options.map((option) => option.value),\n selected,\n })\n : null;\n\n const items = React.useMemo<ListboxItem[] | undefined>(() => {\n if (registration) return undefined;\n const available: ListboxItem[] = options\n .filter((option) => !selectedSet.has(option.value))\n .map((option) => ({ value: option.value, label: option.label }));\n if (dataCreateText !== null) {\n available.push({ value: createValue, label: resolvedLabels.create(dataCreateText) });\n }\n return available;\n }, [registration, options, selectedSet, dataCreateText, createValue, resolvedLabels]);\n\n // useListbox's navigability predicate (D58): the create option always, never a selected option,\n // and `filter` (else the default) bound to the typed text while there is any.\n const listFilter = React.useMemo(() => {\n if (!registration && !query) return undefined;\n const matches = filter ?? matchesText;\n return (item: ListboxItem) =>\n item.value === createValue ||\n (!selectedSet.has(item.value) && (query === '' || matches(item, query)));\n }, [registration, query, filter, selectedSet, createValue]);\n\n // Adds a listed option (`label`: the committed item's).\n const addTag = (value: string, label: string) => {\n if (!interactive || selected.includes(value)) return;\n const next = [...selected, value];\n setSelected(next);\n setQuery('');\n announceToggle(labels, label, true, next.length);\n };\n\n // Creates a tag of the trimmed text (D59): the create option was offered for it.\n const commitCreate = () => {\n const text = query.trim();\n if (!interactive || text === '') return;\n onOptionCreate?.(text);\n const next = [...selected, text];\n setSelected(next);\n setQuery('');\n announceToggle(labels, text, true, next.length);\n };\n\n const listbox = useListbox({\n open,\n onOpenChange: (next) => setOpen(next),\n mode: isButtonTrigger ? 'select-only' : 'editable',\n multiselect: true,\n selectedValues: selected,\n onSelect: (value, details) => {\n if (value === createValue) commitCreate();\n else addTag(value, details?.item.label ?? value);\n },\n items,\n filter: listFilter,\n // Typing a filter makes its first match active (as in Combobox), so Enter adds what the list\n // shows instead of submitting the form. Nothing is active on open or with the text cleared.\n // The Button trigger starts on the first listed option, as Dropdown does.\n autoHighlight: isButtonTrigger ? 'selected' : query ? 'first' : false,\n idPrefix: 'tagpicker-listbox',\n onClearDraft: query && !isButtonTrigger ? () => setQuery('') : undefined,\n });\n\n // A value's label (D58): its registered option's, else the List children's (the server and the\n // first render), else the `options` entry's, else the raw value.\n const getItem = listbox.getItem;\n const labelOf = React.useCallback(\n (value: string): string =>\n (registration ? getItem(value)?.label : undefined) ??\n collected.get(value) ??\n optionByValue.get(value)?.label ??\n value,\n [registration, getItem, collected, optionByValue],\n );\n\n // Registration mode: the create option is a rendered Option, so the duplicate check runs after\n // the listbox, over the labels it lists in this render and those of the selected values.\n let createText: string | null = dataCreateText;\n if (offersCreate && registration) {\n const listed = listbox.items.filter((item) => item.value !== createValue);\n createText = createOptionText(query, {\n labels: [\n ...options.map((option) => option.label),\n ...collected.values(),\n ...listed.map((item) => item.label),\n ...selected.map(labelOf),\n ],\n values: [\n ...options.map((option) => option.value),\n ...collected.keys(),\n ...listed.map((item) => item.value),\n ],\n selected,\n });\n }\n const showCreate = createText !== null;\n\n // aria-expanded only while a listbox with options (or the create option) is shown\n // (input-pickers#21).\n const expanded = open && (listbox.items.length > 0 || showCreate);\n const noMatchesText = resolvedLabels.noMatches;\n // The popup shows the options, or \"No matches\" for a query.\n const surfaceOpen = open && (expanded || query !== '');\n const noMatches = surfaceOpen && !expanded && !showCreate;\n const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n open,\n surfaceOpen,\n onDismiss: () => setOpen(false),\n rootRef,\n anchorRef: triggerRef,\n });\n\n const rootMergedRef = useMergedRefs<HTMLDivElement>(rootRef, ref);\n\n useFormReset(\n rootRef,\n () => {\n // Compared by content (C-FORMS): an inline default is a new array on every render, and a\n // reset that keeps the same tags reports nothing.\n const initial = defaultValue ?? EMPTY_VALUES;\n setSelected((current) => (sameValues(current, initial) ? current : [...initial]));\n setQuery('');\n },\n form,\n );\n\n // The single-line layout (D62): collapsed while focus is outside the root and the list closed.\n const {\n focusWithin,\n onFocus: trackFocus,\n onBlur: trackBlur,\n } = useFocusWithin(overflow === 'count');\n const collapsed = overflow === 'count' && !focusWithin && !open;\n const tagLabels = React.useMemo(() => selected.map(labelOf), [selected, labelOf]);\n const hiddenValues = useTagOverflow({\n active: collapsed,\n values: selected,\n labels: tagLabels,\n control: controlElementRef,\n group: groupRef,\n chip: chipRef,\n trigger: triggerRef,\n });\n\n const focusTrigger = useEventCallback(() => {\n triggerRef.current?.focus();\n });\n const toggleOpen = useEventCallback(() => {\n if (interactive) setOpen(!open);\n });\n const removeTag = useEventCallback((value: string) => {\n if (!interactive || !selected.includes(value)) return;\n const next = selected.filter((v) => v !== value);\n setSelected(next);\n announceToggle(labels, labelOf(value), false, next.length);\n });\n const clear = useEventCallback(() => {\n focusTrigger();\n if (!interactive) return;\n if (selected.length > 0) setSelected([]);\n setQuery('');\n setOpen(false);\n });\n const editText = useEventCallback((text: string) => {\n if (!interactive) return;\n setQuery(text);\n if (!open) setOpen(true);\n // The option whose label equals the typed text becomes active (D60); a user edit only.\n const candidates: Iterable<ExactMatchCandidate> = registration\n ? Array.from(collected, ([value, label]) => ({ value, label }))\n : options;\n listbox.setActiveValue(findExactMatch(text, candidates, selectedSet));\n });\n const focusLastTagControl = useEventCallback(() => {\n const group = groupRef.current;\n const last = group ? tagListControls(group).at(-1) : undefined;\n last?.focus();\n return last !== undefined;\n });\n const setOpenStable = useEventCallback((next: boolean) => setOpen(next));\n const entryOf = React.useCallback((value: string) => optionByValue.get(value), [optionByValue]);\n\n const triggerProps = React.useMemo<TagPickerTriggerProps>(\n () => ({\n id: triggerId,\n 'aria-label': triggerLabel,\n 'aria-labelledby': triggerLabelledBy,\n 'aria-describedby': triggerDescribedBy,\n 'aria-invalid': triggerInvalid,\n 'aria-required': triggerRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n tabIndex,\n autoFocus,\n }),\n [\n triggerId,\n triggerLabel,\n triggerLabelledBy,\n triggerDescribedBy,\n triggerInvalid,\n triggerRequired,\n ariaErrorMessage,\n ariaDetails,\n tabIndex,\n autoFocus,\n ],\n );\n const inputProps = React.useMemo<TagPickerInputOnlyProps>(\n () => ({\n autoComplete,\n autoCapitalize,\n autoCorrect,\n maxLength,\n inputMode,\n spellCheck,\n enterKeyHint,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n }),\n [\n autoComplete,\n autoCapitalize,\n autoCorrect,\n maxLength,\n inputMode,\n spellCheck,\n enterKeyHint,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n ],\n );\n const listLabelledBy =\n triggerLabel === undefined ? (triggerLabelledBy ?? field?.labelId) : triggerLabelledBy;\n const listLabel = React.useMemo(\n () => ({ 'aria-label': triggerLabel, 'aria-labelledby': listLabelledBy }),\n [triggerLabel, listLabelledBy],\n );\n\n const hasSummary = selected.length > 0;\n const context = React.useMemo<TagPickerContextValue>(\n () => ({\n size,\n appearance,\n coreSize,\n tagSize,\n tagAppearance,\n disabled,\n readOnly,\n interactive,\n invalidLook,\n selected,\n labelOf,\n entryOf,\n labels: resolvedLabels,\n placeholder,\n options,\n warnsUnknownValues: !registration && !allowCreate,\n dataMode: !registration,\n listbox,\n open,\n expanded,\n query,\n surfaceOpen,\n showCreate,\n createText: createText ?? '',\n createValue,\n emptyContent: query !== '' && !showCreate,\n layerId,\n surfaceRef,\n floatingProps,\n listLabel,\n triggerProps,\n inputProps,\n summaryId: hasSummary ? summaryId : undefined,\n triggerRef,\n setReference,\n controlRef: controlElementRef,\n groupRef,\n chipRef,\n registerTrigger,\n registerList,\n triggerKind,\n setOpen: setOpenStable,\n toggleOpen,\n focusTrigger,\n removeTag,\n clear,\n editText,\n focusLastTagControl,\n expandIcon,\n clearable,\n overflow,\n collapsed,\n hiddenValues,\n }),\n [\n size,\n appearance,\n coreSize,\n tagSize,\n tagAppearance,\n disabled,\n readOnly,\n interactive,\n invalidLook,\n selected,\n labelOf,\n entryOf,\n resolvedLabels,\n placeholder,\n options,\n registration,\n allowCreate,\n listbox,\n open,\n expanded,\n query,\n surfaceOpen,\n showCreate,\n createText,\n createValue,\n layerId,\n surfaceRef,\n floatingProps,\n listLabel,\n triggerProps,\n inputProps,\n hasSummary,\n summaryId,\n setReference,\n registerTrigger,\n registerList,\n triggerKind,\n setOpenStable,\n toggleOpen,\n focusTrigger,\n removeTag,\n clear,\n editText,\n focusLastTagControl,\n expandIcon,\n clearable,\n overflow,\n collapsed,\n hiddenValues,\n ],\n );\n\n const parts =\n children === undefined || children === null ? (\n <>\n <TagPickerControl />\n <TagPickerList />\n </>\n ) : (\n <>\n {children}\n {/* A parts form without a List still has its listbox, so aria-controls never dangles. */}\n {listElement === undefined && <TagPickerList />}\n </>\n );\n\n return (\n <div\n data-size={size}\n data-appearance={appearance}\n data-overflow={overflow}\n data-collapsed={collapsed ? '' : undefined}\n {...rest}\n ref={rootMergedRef}\n className={cn(tagPickerClassNames.root, 'relative', className)}\n // Focus inside the root (DOM containment) expands the single-line layout.\n onFocus={trackFocus}\n onBlur={trackBlur}\n >\n <TagPickerContext.Provider value={context}>{parts}</TagPickerContext.Provider>\n {hasSummary && (\n // Describes the trigger. The list itself would read every \"Remove …\" button name too.\n <span id={summaryId} hidden>\n {(labels?.summary ?? defaultSummaryLabel)(selected.map(labelOf))}\n </span>\n )}\n {/* Mounted before its text: a live region added together with its text is not announced by\n every screen reader. The row in the popup is the visible copy. */}\n <span role=\"status\" className=\"sr-only\">\n {noMatches && noMatchesText}\n </span>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={selected}\n type=\"text\"\n required={validates}\n onInvalid={focusTrigger}\n />\n </div>\n );\n};\nTagPickerRoot.displayName = 'TagPicker';\n"],"mappings":"0+BA2SA,IAAMuD,GAA6C,CAAC,SAAU,QAAS,aAAa,EAC9EC,GAA4C,CAAC,EAC7CC,GAA4C,IAAI,IAGhDC,GAAqD,CACzD,OAAQ,cACR,MAAO,QACP,cAAe,QACjB,EAEMC,GAAsB,GAAkB,UAAUC,IAClDC,GAAuB,GAAqB,aAAaC,EAAO,KAAK,IAAI,IACzEC,GAAsB,GAAiB,WAAWC,EAAK,GACvDC,GAA6B,GAAkB,IAAIC,IAGzD,SAASC,GAAY,EAAmB,EAAuB,CAC7D,OAAQC,EAAK,WAAaA,EAAK,MAAA,CAAO,YAAY,CAAC,CAAC,SAASJ,EAAK,YAAY,CAAC,CACjF,CAEA,SAASK,GAAe,EAAuB,CAC7C,MAAO,2HAA2HH,EAAM,GAC1I,CAEA,IAAMI,GACJ,yIAEIC,GACJ,sLAGF,SAASC,GACP,EACgE,CAChE,GAAIC,GAAa,KACjB,KAAK,GAAM,CAAE,UAAUzE,EAAAA,gBAAgByE,CAAQ,EAC7C,GAAIxE,EAAAA,gBAAgDyE,EAAMxE,EAAAA,aAAa,EAAG,OAAOwE,CAAA,CAGrF,CAEA,IAAaC,EAAiB,GAA0B,CACtD,GAAM,CACJ,UAAUnB,GACV,WACA,MAAOoB,GACP,gBACA,iBACA,YACA,KAAMC,GACN,eACA,gBACA,eAAc,YACd,UACA,MAAOC,GACP,gBACA,iBACA,WAAW,GACX,KAAMC,GACN,WAAYC,GACZ,QACA,QACA,YACA,gBAAe,MACf,kBACA,eACA,aACA,WAAW,GACX,cAAc,GACd,k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,EACjE2H,GAAYrN,EAAM,aACf,CAAE,aAAcyF,EAAc,kBAAmB2H,EAAe,GACvE,CAAC3H,EAAc2H,EAAc,CAC/B,EAEME,GAAalH,EAAS,OAAS,EAC/BmH,GAAUvN,EAAM,aACb,CACL,OACA,aACA,YACA,WACA,iBACA,WACA,WACA,cACA,eACA,WACA,UACA,WACA,OAAQsJ,EACR,eACA,UACA,mBAAoB,CAACN,GAAgB,CAACH,EACtC,SAAU,CAACG,EACX,UACA,OACA,WACA,QACA,cACA,aACA,WAAYsB,GAAc,GAC1B,cACA,aAAcpC,IAAU,IAAM,CAACsC,EAC/B,WACA,cACA,iBACA,aACA,gBACA,cACA,UAAW8C,GAAa3E,EAAY,IAAA,GACpC,aACA,gBACA,WAAYH,GACZ,WACA,WACA,mBACA,gBACA,cACA,QAAS0D,GACT,cACA,eACA,aACA,SACA,YACA,uBACA,cACA,aACA,WACA,YACA,eACF,GACA,CACElG,EACAG,EACAJ,GACAE,GACAC,GACAU,EACArB,EACAoB,EACAb,GACAM,EACAiE,EACA8B,GACA7C,EACAkE,GACAnE,EACAL,EACAH,EACAqB,EACAhD,EACAuD,EACAvC,EACAyC,EACAH,EACAF,EACA1B,EACA6E,GACAC,GACAC,GACAN,GACAjB,GACAG,GACAe,GACA3E,EACAiF,GACAtG,GACAM,GACAR,EACA8E,GACAT,GACAD,EACAE,GACAE,GACAC,GACAE,GACA8B,GACAC,GACA3I,EACAiG,EACAG,EACF,CACF,EAEMwC,GACJ/J,GAAuC,MACrC,EAAAnB,EAAA,KAAA,CAAA/B,EAAAA,SAAA,CAAA,SAAA,EACE,EAAA+B,EAAA,IAAA,CAAC9B,EAAAA,iBAAD,CAAmB,CAAA,GACnB,EAAA8B,EAAA,IAAA,CAACpD,EAAAA,cAAD,CAAgB,CAAA,CAChB,CAAA,CAAA,GAEF,EAAAoD,EAAA,KAAA,CAAA/B,EAAAA,SAAA,CAAA,SAAA,CACGkD,EAEA8E,KAAgB,IAAA,KAAa,EAAAjG,EAAA,IAAA,CAACpD,EAAAA,cAAD,CAAgB,CAAA,CAC9C,CAAA,CAAA,EAGN,OACE,EAAAoD,EAAA,KAAA,CAAC,MAAD,CACE,YAAWmD,EACX,kBAAiBG,EACjB,gBAAehB,EACf,iBAAgBiG,EAAY,GAAK,IAAA,GACjC,GAAIpG,GACJ,IAAK6F,GACL,UAAW7J,EAAAA,GAAGC,GAAAA,oBAAoB,KAAM,WAAY+M,EAAS,EAE7D,QAAS9C,GACT,OAAQC,GAVV,SAAA,EAYE,EAAAtI,EAAA,IAAA,CAAC3B,GAAAA,iBAAiB,SAAlB,CAA2B,MAAOqM,GAAU,SAAAQ,EAAiC,CAAA,EAC5ET,KAEC,EAAAzK,EAAA,IAAA,CAAC,OAAD,CAAM,GAAI8F,EAAW,OAAA,GACjB,UAAAtF,GAAQ,SAAWD,GAAA,CAAqBgD,EAAS,IAAIiE,CAAO,CAAC,CAC3D,CAAA,GAIR,EAAAxH,EAAA,IAAA,CAAC,OAAD,CAAM,KAAK,SAAS,UAAU,UAC3B,SAAA+H,IAAaF,EACV,CAAA,GACN,EAAA7H,EAAA,IAAA,CAAC1B,GAAAA,YAAD,CACQ,QACA,QACI,WACV,MAAOiF,EACP,KAAK,OACL,SAAUf,GACV,UAAWmG,CACZ,CAAA,CACE,GAET,EACA,EAAc,YAAc"}
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/cn.mjs";
|
|
3
|
+
import { flattenChildren as t, isElementOfType as n } from "../../lib/children.mjs";
|
|
4
|
+
import { warnDeprecated as r, warnOnce as i } from "../../lib/dev.mjs";
|
|
5
|
+
import { tagPickerClassNames as ee } from "../../lib/classNames.mjs";
|
|
6
|
+
import { useEventCallback as a } from "../../hooks/useEventCallback.mjs";
|
|
7
|
+
import { useControllable as o } from "../../hooks/useControllable.mjs";
|
|
8
|
+
import { useId as te } from "../../hooks/useId.mjs";
|
|
9
|
+
import { useMergedRefs as ne } from "../../hooks/useMergedRefs.mjs";
|
|
10
|
+
import { useIsClient as re } from "../../hooks/useIsClient.mjs";
|
|
11
|
+
import { useFieldContext as ie, useFieldControl as ae } from "../../hooks/useFieldControl.mjs";
|
|
12
|
+
import { useAnnounce as oe } from "../../hooks/useAnnounce.mjs";
|
|
13
|
+
import { collectOptionLabels as se, useListbox as ce } from "../../hooks/useListbox.mjs";
|
|
14
|
+
import { useInputLook as le } from "./inputLook.mjs";
|
|
15
|
+
import { isInvalidLook as ue } from "./Input.mjs";
|
|
16
|
+
import { useFormReset as de } from "../../hooks/useFormReset.mjs";
|
|
17
|
+
import { HiddenInput as fe } from "../internal/HiddenInput.mjs";
|
|
18
|
+
import { useListboxPopup as pe } from "./Option.mjs";
|
|
19
|
+
import { announceToggle as s } from "./pickerLabels.mjs";
|
|
20
|
+
import { EMPTY_VALUES as me, sameValues as he } from "./pickerValues.mjs";
|
|
21
|
+
import { TagPickerContext as ge } from "./TagPicker.context.mjs";
|
|
22
|
+
import { createOptionText as _e, findExactMatch as ve } from "./TagPicker.create.mjs";
|
|
23
|
+
import { useFocusWithin as ye, useTagOverflow as be } from "./TagPicker.overflow.mjs";
|
|
24
|
+
import { TagPickerControl as xe, TagPickerList as c, tagListControls as Se } from "./TagPicker.parts.mjs";
|
|
25
|
+
import * as l from "react";
|
|
26
|
+
import { Fragment as Ce, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
27
|
+
//#region src/components/input/TagPicker.root.tsx
|
|
28
|
+
var we = [
|
|
29
|
+
"medium",
|
|
30
|
+
"large",
|
|
31
|
+
"extra-large"
|
|
32
|
+
], Te = [], Ee = /* @__PURE__ */ new Map(), De = {
|
|
33
|
+
medium: "extra-small",
|
|
34
|
+
large: "small",
|
|
35
|
+
"extra-large": "medium"
|
|
36
|
+
}, Oe = (e) => `Remove ${e}`, ke = (e) => `Selected: ${e.join(", ")}`, Ae = (e) => `Create "${e}"`, je = (e) => `+${e}`;
|
|
37
|
+
function Me(e, t) {
|
|
38
|
+
return (e.textValue ?? e.label).toLowerCase().includes(t.toLowerCase());
|
|
39
|
+
}
|
|
40
|
+
function Ne(e) {
|
|
41
|
+
return `TagPicker: render exactly one trigger, \`TagPicker.Input\` or \`TagPicker.Button\`, inside \`TagPicker.Control\` (found ${e}).`;
|
|
42
|
+
}
|
|
43
|
+
var Pe = "TagPicker: `allowCreate` needs `TagPicker.Input`: `TagPicker.Button` has no text to create a tag from, so no create option is offered.", Fe = "TagPicker.List: render one TagPicker.List, directly inside TagPicker (a Fragment is fine). A second list, or one inside a component of your own, splits the options over two lists.";
|
|
44
|
+
function Ie(e) {
|
|
45
|
+
if (e != null) {
|
|
46
|
+
for (let { node: r } of t(e)) if (n(r, c)) return r;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
var f = (t) => {
|
|
50
|
+
let { options: n = Te, children: f, value: Le, defaultValue: Re, onValueChange: ze, onChange: Be, open: Ve, defaultOpen: He, onOpenChange: Ue, placeholder: We = "Select...", filter: Ge, query: Ke, defaultQuery: qe, onQueryChange: Je, disabled: p = !1, size: Ye, appearance: Xe, name: Ze, form: Qe, required: $e, autoComplete: et = "off", autoCapitalize: tt, autoCorrect: nt, maxLength: rt, readOnly: m = !1, allowCreate: h = !1, onOptionCreate: it, clearable: at = !1, expandIcon: ot, overflow: st = "wrap", labels: g, inputMode: ct, spellCheck: lt, enterKeyHint: ut, autoFocus: dt, tabIndex: ft, id: pt, "aria-label": mt, "aria-labelledby": ht, "aria-describedby": gt, "aria-invalid": _t, "aria-required": vt, "aria-errormessage": yt, "aria-details": bt, onFocus: xt, onBlur: St, onKeyDown: Ct, onKeyUp: wt, controlRef: Tt, className: Et, ref: Dt, ...Ot } = t;
|
|
51
|
+
Be !== void 0 && r("TagPicker", "onChange", "onValueChange");
|
|
52
|
+
let _ = st === "count" ? "count" : "wrap", kt = ie(), At = ($e ?? kt?.required ?? !1) && !m, { id: jt, "aria-label": v, "aria-labelledby": y, "aria-describedby": Mt, "aria-invalid": b, "aria-required": Nt } = ae({
|
|
53
|
+
id: pt,
|
|
54
|
+
"aria-label": mt,
|
|
55
|
+
"aria-labelledby": ht,
|
|
56
|
+
"aria-describedby": gt,
|
|
57
|
+
"aria-invalid": _t,
|
|
58
|
+
"aria-required": vt ?? $e
|
|
59
|
+
}), Pt = ue(!1, b), { size: x, appearance: S } = le(Ye, Xe, {
|
|
60
|
+
sizes: we,
|
|
61
|
+
defaultSize: "medium"
|
|
62
|
+
}), Ft = x === "medium" ? "medium" : "large", It = De[x], Lt = S === "filled-darker" ? "outline" : "filled", [C, w] = o(Le, Re ?? me, (e) => {
|
|
63
|
+
let t = [...e];
|
|
64
|
+
ze?.(t), Be?.(t);
|
|
65
|
+
}), T = l.useMemo(() => new Set(C), [C]), E = !p && !m, [Rt, D] = o(Ve, (He ?? !1) && E, Ue), zt = re(), O = Rt && E && zt, Bt = l.useRef(/* @__PURE__ */ new Map()), [k, Vt] = l.useState("input"), Ht = l.useCallback((e) => {
|
|
66
|
+
let t = {}, n = Bt.current, r = () => n.values().next().value ?? "input";
|
|
67
|
+
return n.set(t, e), Vt(r()), () => {
|
|
68
|
+
n.delete(t), Vt(r());
|
|
69
|
+
};
|
|
70
|
+
}, []), A = l.useRef(0), Ut = l.useCallback(() => (A.current += 1, () => {
|
|
71
|
+
--A.current;
|
|
72
|
+
}), []);
|
|
73
|
+
l.useEffect(() => {
|
|
74
|
+
let e = Bt.current.size;
|
|
75
|
+
e !== 1 && i("TagPicker:trigger", Ne(e)), A.current > 1 && i("TagPicker.List:placement", Fe);
|
|
76
|
+
});
|
|
77
|
+
let j = k === "button", [Wt, M] = o(Ke, E ? qe ?? "" : "", Je), N = E && !j ? Wt : "", [P, Gt] = l.useState(E ? "unlocked" : "mounted-locked");
|
|
78
|
+
E && P !== "unlocked" ? Gt("unlocked") : !E && P === "unlocked" && Gt("locked"), l.useEffect(() => {
|
|
79
|
+
P === "locked" && M("");
|
|
80
|
+
}, [P, M]);
|
|
81
|
+
let Kt = !E && Rt;
|
|
82
|
+
l.useEffect(() => {
|
|
83
|
+
Kt && D(!1);
|
|
84
|
+
}, [Kt, D]), oe();
|
|
85
|
+
let F = l.useRef(null), I = l.useRef(null), qt = l.useRef(null), L = l.useRef(null), Jt = l.useRef(null), R = te("tagpicker-summary"), z = te("tagpicker-create");
|
|
86
|
+
l.useEffect(() => {
|
|
87
|
+
h && j && i("TagPicker:allowCreate-button", Pe);
|
|
88
|
+
}, [h, j]);
|
|
89
|
+
let Yt = Ie(f), B = Yt?.props.children, V = B != null, H = l.useMemo(() => V ? se(B) : Ee, [V, B]), U = l.useMemo(() => {
|
|
90
|
+
let e = /* @__PURE__ */ new Map();
|
|
91
|
+
for (let t of n) e.has(t.value) || e.set(t.value, t);
|
|
92
|
+
return e;
|
|
93
|
+
}, [n]), W = l.useMemo(() => ({
|
|
94
|
+
remove: g?.remove ?? Oe,
|
|
95
|
+
selected: g?.selected ?? "Selected",
|
|
96
|
+
create: g?.create ?? Ae,
|
|
97
|
+
clear: g?.clear ?? "Clear selection",
|
|
98
|
+
expand: g?.expand ?? "Show options",
|
|
99
|
+
overflowCount: g?.overflowCount ?? je,
|
|
100
|
+
noMatches: g?.noMatches ?? "No matches"
|
|
101
|
+
}), [g]), Xt = h && E && !j && O && N.trim() !== "", G = Xt && !V ? _e(N, {
|
|
102
|
+
labels: n.map((e) => e.label),
|
|
103
|
+
values: n.map((e) => e.value),
|
|
104
|
+
selected: C
|
|
105
|
+
}) : null, Zt = l.useMemo(() => {
|
|
106
|
+
if (V) return;
|
|
107
|
+
let e = n.filter((e) => !T.has(e.value)).map((e) => ({
|
|
108
|
+
value: e.value,
|
|
109
|
+
label: e.label
|
|
110
|
+
}));
|
|
111
|
+
return G !== null && e.push({
|
|
112
|
+
value: z,
|
|
113
|
+
label: W.create(G)
|
|
114
|
+
}), e;
|
|
115
|
+
}, [
|
|
116
|
+
V,
|
|
117
|
+
n,
|
|
118
|
+
T,
|
|
119
|
+
G,
|
|
120
|
+
z,
|
|
121
|
+
W
|
|
122
|
+
]), Qt = l.useMemo(() => {
|
|
123
|
+
if (!V && !N) return;
|
|
124
|
+
let e = Ge ?? Me;
|
|
125
|
+
return (t) => t.value === z || !T.has(t.value) && (N === "" || e(t, N));
|
|
126
|
+
}, [
|
|
127
|
+
V,
|
|
128
|
+
N,
|
|
129
|
+
Ge,
|
|
130
|
+
T,
|
|
131
|
+
z
|
|
132
|
+
]), $t = (e, t) => {
|
|
133
|
+
if (!E || C.includes(e)) return;
|
|
134
|
+
let n = [...C, e];
|
|
135
|
+
w(n), M(""), s(g, t, !0, n.length);
|
|
136
|
+
}, en = () => {
|
|
137
|
+
let e = N.trim();
|
|
138
|
+
if (!E || e === "") return;
|
|
139
|
+
it?.(e);
|
|
140
|
+
let t = [...C, e];
|
|
141
|
+
w(t), M(""), s(g, e, !0, t.length);
|
|
142
|
+
}, K = ce({
|
|
143
|
+
open: O,
|
|
144
|
+
onOpenChange: (e) => D(e),
|
|
145
|
+
mode: j ? "select-only" : "editable",
|
|
146
|
+
multiselect: !0,
|
|
147
|
+
selectedValues: C,
|
|
148
|
+
onSelect: (e, t) => {
|
|
149
|
+
e === z ? en() : $t(e, t?.item.label ?? e);
|
|
150
|
+
},
|
|
151
|
+
items: Zt,
|
|
152
|
+
filter: Qt,
|
|
153
|
+
autoHighlight: j ? "selected" : N ? "first" : !1,
|
|
154
|
+
idPrefix: "tagpicker-listbox",
|
|
155
|
+
onClearDraft: N && !j ? () => M("") : void 0
|
|
156
|
+
}), tn = K.getItem, q = l.useCallback((e) => (V ? tn(e)?.label : void 0) ?? H.get(e) ?? U.get(e)?.label ?? e, [
|
|
157
|
+
V,
|
|
158
|
+
tn,
|
|
159
|
+
H,
|
|
160
|
+
U
|
|
161
|
+
]), J = G;
|
|
162
|
+
if (Xt && V) {
|
|
163
|
+
let e = K.items.filter((e) => e.value !== z);
|
|
164
|
+
J = _e(N, {
|
|
165
|
+
labels: [
|
|
166
|
+
...n.map((e) => e.label),
|
|
167
|
+
...H.values(),
|
|
168
|
+
...e.map((e) => e.label),
|
|
169
|
+
...C.map(q)
|
|
170
|
+
],
|
|
171
|
+
values: [
|
|
172
|
+
...n.map((e) => e.value),
|
|
173
|
+
...H.keys(),
|
|
174
|
+
...e.map((e) => e.value)
|
|
175
|
+
],
|
|
176
|
+
selected: C
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
let Y = J !== null, X = O && (K.items.length > 0 || Y), nn = W.noMatches, Z = O && (X || N !== ""), rn = Z && !X && !Y, { layerId: an, setReference: on, surfaceRef: sn, floatingProps: cn } = pe({
|
|
180
|
+
open: O,
|
|
181
|
+
surfaceOpen: Z,
|
|
182
|
+
onDismiss: () => D(!1),
|
|
183
|
+
rootRef: F,
|
|
184
|
+
anchorRef: I
|
|
185
|
+
}), ln = ne(F, Dt);
|
|
186
|
+
de(F, () => {
|
|
187
|
+
let e = Re ?? me;
|
|
188
|
+
w((t) => he(t, e) ? t : [...e]), M("");
|
|
189
|
+
}, Qe);
|
|
190
|
+
let { focusWithin: un, onFocus: dn, onBlur: fn } = ye(_ === "count"), Q = _ === "count" && !un && !O, pn = l.useMemo(() => C.map(q), [C, q]), mn = be({
|
|
191
|
+
active: Q,
|
|
192
|
+
values: C,
|
|
193
|
+
labels: pn,
|
|
194
|
+
control: qt,
|
|
195
|
+
group: L,
|
|
196
|
+
chip: Jt,
|
|
197
|
+
trigger: I
|
|
198
|
+
}), $ = a(() => {
|
|
199
|
+
I.current?.focus();
|
|
200
|
+
}), hn = a(() => {
|
|
201
|
+
E && D(!O);
|
|
202
|
+
}), gn = a((e) => {
|
|
203
|
+
if (!E || !C.includes(e)) return;
|
|
204
|
+
let t = C.filter((t) => t !== e);
|
|
205
|
+
w(t), s(g, q(e), !1, t.length);
|
|
206
|
+
}), _n = a(() => {
|
|
207
|
+
$(), E && (C.length > 0 && w([]), M(""), D(!1));
|
|
208
|
+
}), vn = a((e) => {
|
|
209
|
+
if (!E) return;
|
|
210
|
+
M(e), O || D(!0);
|
|
211
|
+
let t = V ? Array.from(H, ([e, t]) => ({
|
|
212
|
+
value: e,
|
|
213
|
+
label: t
|
|
214
|
+
})) : n;
|
|
215
|
+
K.setActiveValue(ve(e, t, T));
|
|
216
|
+
}), yn = a(() => {
|
|
217
|
+
let e = L.current, t = e ? Se(e).at(-1) : void 0;
|
|
218
|
+
return t?.focus(), t !== void 0;
|
|
219
|
+
}), bn = a((e) => D(e)), xn = l.useCallback((e) => U.get(e), [U]), Sn = l.useMemo(() => ({
|
|
220
|
+
id: jt,
|
|
221
|
+
"aria-label": v,
|
|
222
|
+
"aria-labelledby": y,
|
|
223
|
+
"aria-describedby": Mt,
|
|
224
|
+
"aria-invalid": b,
|
|
225
|
+
"aria-required": Nt,
|
|
226
|
+
"aria-errormessage": yt,
|
|
227
|
+
"aria-details": bt,
|
|
228
|
+
tabIndex: ft,
|
|
229
|
+
autoFocus: dt
|
|
230
|
+
}), [
|
|
231
|
+
jt,
|
|
232
|
+
v,
|
|
233
|
+
y,
|
|
234
|
+
Mt,
|
|
235
|
+
b,
|
|
236
|
+
Nt,
|
|
237
|
+
yt,
|
|
238
|
+
bt,
|
|
239
|
+
ft,
|
|
240
|
+
dt
|
|
241
|
+
]), Cn = l.useMemo(() => ({
|
|
242
|
+
autoComplete: et,
|
|
243
|
+
autoCapitalize: tt,
|
|
244
|
+
autoCorrect: nt,
|
|
245
|
+
maxLength: rt,
|
|
246
|
+
inputMode: ct,
|
|
247
|
+
spellCheck: lt,
|
|
248
|
+
enterKeyHint: ut,
|
|
249
|
+
onFocus: xt,
|
|
250
|
+
onBlur: St,
|
|
251
|
+
onKeyDown: Ct,
|
|
252
|
+
onKeyUp: wt,
|
|
253
|
+
controlRef: Tt
|
|
254
|
+
}), [
|
|
255
|
+
et,
|
|
256
|
+
tt,
|
|
257
|
+
nt,
|
|
258
|
+
rt,
|
|
259
|
+
ct,
|
|
260
|
+
lt,
|
|
261
|
+
ut,
|
|
262
|
+
xt,
|
|
263
|
+
St,
|
|
264
|
+
Ct,
|
|
265
|
+
wt,
|
|
266
|
+
Tt
|
|
267
|
+
]), wn = v === void 0 ? y ?? kt?.labelId : y, Tn = l.useMemo(() => ({
|
|
268
|
+
"aria-label": v,
|
|
269
|
+
"aria-labelledby": wn
|
|
270
|
+
}), [v, wn]), En = C.length > 0, Dn = l.useMemo(() => ({
|
|
271
|
+
size: x,
|
|
272
|
+
appearance: S,
|
|
273
|
+
coreSize: Ft,
|
|
274
|
+
tagSize: It,
|
|
275
|
+
tagAppearance: Lt,
|
|
276
|
+
disabled: p,
|
|
277
|
+
readOnly: m,
|
|
278
|
+
interactive: E,
|
|
279
|
+
invalidLook: Pt,
|
|
280
|
+
selected: C,
|
|
281
|
+
labelOf: q,
|
|
282
|
+
entryOf: xn,
|
|
283
|
+
labels: W,
|
|
284
|
+
placeholder: We,
|
|
285
|
+
options: n,
|
|
286
|
+
warnsUnknownValues: !V && !h,
|
|
287
|
+
dataMode: !V,
|
|
288
|
+
listbox: K,
|
|
289
|
+
open: O,
|
|
290
|
+
expanded: X,
|
|
291
|
+
query: N,
|
|
292
|
+
surfaceOpen: Z,
|
|
293
|
+
showCreate: Y,
|
|
294
|
+
createText: J ?? "",
|
|
295
|
+
createValue: z,
|
|
296
|
+
emptyContent: N !== "" && !Y,
|
|
297
|
+
layerId: an,
|
|
298
|
+
surfaceRef: sn,
|
|
299
|
+
floatingProps: cn,
|
|
300
|
+
listLabel: Tn,
|
|
301
|
+
triggerProps: Sn,
|
|
302
|
+
inputProps: Cn,
|
|
303
|
+
summaryId: En ? R : void 0,
|
|
304
|
+
triggerRef: I,
|
|
305
|
+
setReference: on,
|
|
306
|
+
controlRef: qt,
|
|
307
|
+
groupRef: L,
|
|
308
|
+
chipRef: Jt,
|
|
309
|
+
registerTrigger: Ht,
|
|
310
|
+
registerList: Ut,
|
|
311
|
+
triggerKind: k,
|
|
312
|
+
setOpen: bn,
|
|
313
|
+
toggleOpen: hn,
|
|
314
|
+
focusTrigger: $,
|
|
315
|
+
removeTag: gn,
|
|
316
|
+
clear: _n,
|
|
317
|
+
editText: vn,
|
|
318
|
+
focusLastTagControl: yn,
|
|
319
|
+
expandIcon: ot,
|
|
320
|
+
clearable: at,
|
|
321
|
+
overflow: _,
|
|
322
|
+
collapsed: Q,
|
|
323
|
+
hiddenValues: mn
|
|
324
|
+
}), [
|
|
325
|
+
x,
|
|
326
|
+
S,
|
|
327
|
+
Ft,
|
|
328
|
+
It,
|
|
329
|
+
Lt,
|
|
330
|
+
p,
|
|
331
|
+
m,
|
|
332
|
+
E,
|
|
333
|
+
Pt,
|
|
334
|
+
C,
|
|
335
|
+
q,
|
|
336
|
+
xn,
|
|
337
|
+
W,
|
|
338
|
+
We,
|
|
339
|
+
n,
|
|
340
|
+
V,
|
|
341
|
+
h,
|
|
342
|
+
K,
|
|
343
|
+
O,
|
|
344
|
+
X,
|
|
345
|
+
N,
|
|
346
|
+
Z,
|
|
347
|
+
Y,
|
|
348
|
+
J,
|
|
349
|
+
z,
|
|
350
|
+
an,
|
|
351
|
+
sn,
|
|
352
|
+
cn,
|
|
353
|
+
Tn,
|
|
354
|
+
Sn,
|
|
355
|
+
Cn,
|
|
356
|
+
En,
|
|
357
|
+
R,
|
|
358
|
+
on,
|
|
359
|
+
Ht,
|
|
360
|
+
Ut,
|
|
361
|
+
k,
|
|
362
|
+
bn,
|
|
363
|
+
hn,
|
|
364
|
+
$,
|
|
365
|
+
gn,
|
|
366
|
+
_n,
|
|
367
|
+
vn,
|
|
368
|
+
yn,
|
|
369
|
+
ot,
|
|
370
|
+
at,
|
|
371
|
+
_,
|
|
372
|
+
Q,
|
|
373
|
+
mn
|
|
374
|
+
]), On = f == null ? /* @__PURE__ */ d(Ce, { children: [/* @__PURE__ */ u(xe, {}), /* @__PURE__ */ u(c, {})] }) : /* @__PURE__ */ d(Ce, { children: [f, Yt === void 0 && /* @__PURE__ */ u(c, {})] });
|
|
375
|
+
return /* @__PURE__ */ d("div", {
|
|
376
|
+
"data-size": x,
|
|
377
|
+
"data-appearance": S,
|
|
378
|
+
"data-overflow": _,
|
|
379
|
+
"data-collapsed": Q ? "" : void 0,
|
|
380
|
+
...Ot,
|
|
381
|
+
ref: ln,
|
|
382
|
+
className: e(ee.root, "relative", Et),
|
|
383
|
+
onFocus: dn,
|
|
384
|
+
onBlur: fn,
|
|
385
|
+
children: [
|
|
386
|
+
/* @__PURE__ */ u(ge.Provider, {
|
|
387
|
+
value: Dn,
|
|
388
|
+
children: On
|
|
389
|
+
}),
|
|
390
|
+
En && /* @__PURE__ */ u("span", {
|
|
391
|
+
id: R,
|
|
392
|
+
hidden: !0,
|
|
393
|
+
children: (g?.summary ?? ke)(C.map(q))
|
|
394
|
+
}),
|
|
395
|
+
/* @__PURE__ */ u("span", {
|
|
396
|
+
role: "status",
|
|
397
|
+
className: "sr-only",
|
|
398
|
+
children: rn && nn
|
|
399
|
+
}),
|
|
400
|
+
/* @__PURE__ */ u(fe, {
|
|
401
|
+
name: Ze,
|
|
402
|
+
form: Qe,
|
|
403
|
+
disabled: p,
|
|
404
|
+
value: C,
|
|
405
|
+
type: "text",
|
|
406
|
+
required: At,
|
|
407
|
+
onInvalid: $
|
|
408
|
+
})
|
|
409
|
+
]
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
f.displayName = "TagPicker";
|
|
413
|
+
//#endregion
|
|
414
|
+
export { f as TagPickerRoot };
|
|
415
|
+
|
|
416
|
+
//# sourceMappingURL=TagPicker.root.mjs.map
|