se-design 1.0.87-dev.2 → 1.0.88-dev
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/assets/style.css +1 -1
- package/dist/components/Icon/index.d.ts +0 -5
- package/dist/components/InputWithTags/index.d.ts +1 -3
- package/dist/components/SidebarOverlay/index.d.ts +41 -0
- package/dist/components/Tooltip/index.d.ts +1 -5
- package/dist/index112.js +1 -1
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +2 -2
- package/dist/index113.js.map +1 -1
- package/dist/index114.js +1 -1
- package/dist/index114.js.map +1 -1
- package/dist/index115.js +2 -2
- package/dist/index115.js.map +1 -1
- package/dist/index116.js +1 -1
- package/dist/index116.js.map +1 -1
- package/dist/index117.js +1 -1
- package/dist/index117.js.map +1 -1
- package/dist/index118.js +2 -2
- package/dist/index118.js.map +1 -1
- package/dist/index119.js +1 -1
- package/dist/index119.js.map +1 -1
- package/dist/index120.js +2 -2
- package/dist/index120.js.map +1 -1
- package/dist/index121.js +1 -1
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +1 -1
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +1 -1
- package/dist/index123.js.map +1 -1
- package/dist/index124.js +1 -1
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +2 -2
- package/dist/index125.js.map +1 -1
- package/dist/index126.js +1 -1
- package/dist/index126.js.map +1 -1
- package/dist/index127.js +2 -2
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +2 -2
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +1 -1
- package/dist/index129.js.map +1 -1
- package/dist/index130.js +2 -2
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +2 -2
- package/dist/index131.js.map +1 -1
- package/dist/index132.js +1 -1
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +1 -1
- package/dist/index133.js.map +1 -1
- package/dist/index134.js +1 -1
- package/dist/index134.js.map +1 -1
- package/dist/index135.js +2 -2
- package/dist/index135.js.map +1 -1
- package/dist/index136.js +2 -2
- package/dist/index136.js.map +1 -1
- package/dist/index137.js +2 -2
- package/dist/index137.js.map +1 -1
- package/dist/index138.js +1 -1
- package/dist/index138.js.map +1 -1
- package/dist/index139.js +1 -1
- package/dist/index139.js.map +1 -1
- package/dist/index140.js +1 -1
- package/dist/index140.js.map +1 -1
- package/dist/index141.js +1 -1
- package/dist/index141.js.map +1 -1
- package/dist/index142.js +1 -1
- package/dist/index142.js.map +1 -1
- package/dist/index143.js +1 -1
- package/dist/index143.js.map +1 -1
- package/dist/index144.js +1 -1
- package/dist/index144.js.map +1 -1
- package/dist/index145.js +1 -1
- package/dist/index145.js.map +1 -1
- package/dist/index146.js +2 -2
- package/dist/index146.js.map +1 -1
- package/dist/index147.js +2 -2
- package/dist/index147.js.map +1 -1
- package/dist/index148.js +1 -1
- package/dist/index148.js.map +1 -1
- package/dist/index149.js +1 -1
- package/dist/index149.js.map +1 -1
- package/dist/index150.js +1 -1
- package/dist/index150.js.map +1 -1
- package/dist/index151.js +1 -1
- package/dist/index151.js.map +1 -1
- package/dist/index152.js +1 -1
- package/dist/index152.js.map +1 -1
- package/dist/index153.js +1 -1
- package/dist/index153.js.map +1 -1
- package/dist/index154.js +1 -1
- package/dist/index154.js.map +1 -1
- package/dist/index155.js +2 -2
- package/dist/index155.js.map +1 -1
- package/dist/index156.js +1 -1
- package/dist/index156.js.map +1 -1
- package/dist/index157.js +2 -2
- package/dist/index157.js.map +1 -1
- package/dist/index158.js +2 -2
- package/dist/index158.js.map +1 -1
- package/dist/index159.js +2 -2
- package/dist/index159.js.map +1 -1
- package/dist/index16.js +107 -111
- package/dist/index16.js.map +1 -1
- package/dist/index160.js +2 -2
- package/dist/index160.js.map +1 -1
- package/dist/index161.js +1 -1
- package/dist/index161.js.map +1 -1
- package/dist/index162.js +1 -1
- package/dist/index162.js.map +1 -1
- package/dist/index163.js +1 -1
- package/dist/index163.js.map +1 -1
- package/dist/index164.js +1 -1
- package/dist/index164.js.map +1 -1
- package/dist/index165.js +1 -1
- package/dist/index165.js.map +1 -1
- package/dist/index166.js +1 -1
- package/dist/index166.js.map +1 -1
- package/dist/index167.js +1 -1
- package/dist/index167.js.map +1 -1
- package/dist/index168.js +1 -1
- package/dist/index168.js.map +1 -1
- package/dist/index169.js +1 -1
- package/dist/index169.js.map +1 -1
- package/dist/index170.js +1 -1
- package/dist/index170.js.map +1 -1
- package/dist/index171.js +1 -1
- package/dist/index171.js.map +1 -1
- package/dist/index172.js +1 -1
- package/dist/index172.js.map +1 -1
- package/dist/index173.js +1 -1
- package/dist/index173.js.map +1 -1
- package/dist/index174.js +1 -1
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +1 -1
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +1 -1
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +1 -1
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +1 -1
- package/dist/index178.js.map +1 -1
- package/dist/index179.js +1 -1
- package/dist/index179.js.map +1 -1
- package/dist/index180.js +1 -1
- package/dist/index180.js.map +1 -1
- package/dist/index181.js +1 -1
- package/dist/index181.js.map +1 -1
- package/dist/index182.js +1 -1
- package/dist/index182.js.map +1 -1
- package/dist/index183.js +1 -1
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +1 -1
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +2 -2
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +2 -2
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +1 -1
- package/dist/index187.js.map +1 -1
- package/dist/index188.js +1 -1
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +2 -2
- package/dist/index189.js.map +1 -1
- package/dist/index190.js +2 -2
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +1 -1
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +1 -1
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +1 -1
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +1 -1
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +1 -1
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +1 -1
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +1 -1
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +1 -1
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +1 -1
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +2 -2
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +2 -2
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +2 -2
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +149 -2
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +9 -149
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +5 -8
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +4 -5
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +1 -1
- package/dist/index208.js +3 -3
- package/dist/index208.js.map +1 -1
- package/dist/{index225.js → index224.js} +1 -1
- package/dist/{index225.js.map → index224.js.map} +1 -1
- package/dist/index23.js +16 -16
- package/dist/index23.js.map +1 -1
- package/dist/{index233.js → index232.js} +1 -1
- package/dist/{index233.js.map → index232.js.map} +1 -1
- package/dist/{index236.js → index235.js} +1 -1
- package/dist/{index236.js.map → index235.js.map} +1 -1
- package/dist/index244.js +173 -0
- package/dist/index244.js.map +1 -0
- package/dist/index245.js +3 -169
- package/dist/index245.js.map +1 -1
- package/dist/index247.js +22 -0
- package/dist/index247.js.map +1 -0
- package/dist/index248.js +9 -18
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +9 -9
- package/dist/index249.js.map +1 -1
- package/dist/index25.js +1 -2
- package/dist/index25.js.map +1 -1
- package/dist/index250.js +4 -9
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +170 -5
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +11 -170
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +6 -11
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +5 -5
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +37 -5
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +2 -38
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +8 -2
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +326 -7
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +47 -324
- package/dist/index259.js.map +1 -1
- package/dist/index260.js +2 -50
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +76 -2
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +82 -65
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +48 -89
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +7 -51
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +4 -7
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +51 -4
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +2 -52
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +2 -2
- package/dist/index28.js +149 -88
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +1 -1
- package/dist/index30.js +1 -1
- package/dist/index32.js +10 -11
- package/dist/index33.js +1 -1
- package/dist/index35.js +1 -1
- package/dist/index36.js +1 -1
- package/dist/index37.js +36 -55
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +162 -163
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +51 -55
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +61 -66
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +1 -1
- package/dist/index42.js +7 -8
- package/dist/index43.js +1 -2
- package/dist/index45.js +38 -39
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +51 -52
- package/dist/index46.js.map +1 -1
- package/dist/index49.js +1 -1
- package/dist/index51.js +1 -1
- package/dist/index52.js +1 -1
- package/dist/index53.js +1 -1
- package/dist/index55.js +16 -17
- package/dist/index57.js +1 -1
- package/dist/index6.js +299 -305
- package/dist/index6.js.map +1 -1
- package/dist/index61.js +1 -1
- package/dist/index63.js +1 -1
- package/dist/index65.js +2 -3
- package/dist/index7.js +8 -9
- package/dist/index79.js +1 -1
- package/dist/index81.js +7 -9
- package/dist/index81.js.map +1 -1
- package/dist/index9.js +20 -20
- package/dist/index9.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/icons/cloud-check.svg +0 -4
- package/dist/index223.js +0 -8
- package/dist/index223.js.map +0 -1
- package/dist/index246.js +0 -7
- package/dist/index246.js.map +0 -1
- package/dist/index269.js +0 -5
- package/dist/index269.js.map +0 -1
package/dist/index38.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index38.js","sources":["../src/components/DropdownWithInputTags/index.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, forwardRef, ForwardedRef, useImperativeHandle, KeyboardEvent, useCallback } from 'react';\nimport { Popover, PopoverHandle } from '../Popover';\nimport { Icon } from '../Icon';\nimport { Checkbox } from '../Checkbox';\nimport { Button } from '../Button';\nimport { useCombobox, getA11yNameAttributes } from '../../utils/a11y';\nimport { announce } from '../../utils/a11y/liveAnnouncer/LiveAnnouncer';\nimport { useStableId } from '../../utils/useStableId';\nimport './styles.scss';\n\nexport interface DropdownOption {\n id: string | number;\n label: string;\n value: string;\n [key: string]: any; // Allow additional properties\n}\n\nexport interface DropdownWithInputTagsHandle {\n toggleDropdown: () => void;\n}\n\nexport interface DropdownWithInputTagsProps {\n value: string[];\n onChange?: (tags: string[]) => void;\n placeholder?: string;\n className?: string;\n options?: DropdownOption[];\n renderOption?: (\n option: DropdownOption,\n props: {\n id: string;\n role: 'option';\n 'aria-selected'?: boolean;\n 'aria-disabled'?: true;\n onMouseEnter: () => void;\n className: string;\n },\n onSelect: (option: DropdownOption) => void\n ) => React.ReactNode;\n label?: string;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n automationId?: string;\n noOptionsMessage?: string;\n allowCustomTags?: boolean;\n disabled?: boolean;\n type?: 'select' | 'multi-select' |'multi-select-without-cta';\n showInput?: boolean;\n displayTagBy?: 'label' | 'value';\n isWithPortal?: boolean;\n}\n\nexport const DropdownWithInputTags = forwardRef<DropdownWithInputTagsHandle, DropdownWithInputTagsProps>(\n (\n {\n value,\n onChange,\n placeholder = \"Type to search or add custom tags...\",\n className = '',\n options = [],\n renderOption,\n label,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n automationId = '',\n noOptionsMessage = \"No options found\",\n allowCustomTags = true,\n disabled = false,\n type = 'select',\n showInput = true,\n displayTagBy = 'label',\n isWithPortal = false\n },\n ref: ForwardedRef<DropdownWithInputTagsHandle>\n ) => {\n // Define initValues at the top, right after props\n const initValues = (values: string[]) => {\n return values.map(val => {\n const found = options.find(opt => opt.value === val);\n return found ? { label: found.label, value: found.value } : { label: val, value: val };\n });\n };\n\n // Now use it in useState\n const [tags, setTags] = useState<{ label: string; value: string }[]>(() => {\n return initValues(value || []);\n });\n const [inputValue, setInputValue] = useState('');\n const [filteredOptions, setFilteredOptions] = useState<DropdownOption[]>(options);\n const [isDropdownOpen, setIsDropdownOpen] = useState(false);\n const popoverRef = useRef<PopoverHandle>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const applyClickedRef = useRef<boolean>(false);\n \n const isMultiSelectWithoutCTA = type === 'multi-select-without-cta';\n const isMultiSelect = type === 'multi-select' ||isMultiSelectWithoutCTA;\n\n // Generate stable ID for listbox\n const listboxId = useStableId(automationId, 'dropdown-input-tags-listbox');\n const labelId = useStableId(automationId ? `${automationId}-label` : undefined, 'dropdown-input-tags-label');\n\n const handleSelectOption = useCallback(\n (option: DropdownOption) => {\n if (disabled) return;\n\n const newTags = [...tags];\n if (!newTags.some((tag) => tag.value === option.value)) {\n newTags.push({ label: option.label, value: option.value });\n setTags(newTags);\n onChange?.(newTags.map((tag) => tag.value));\n }\n setInputValue('');\n setIsDropdownOpen(false);\n },\n [disabled, tags, onChange]\n );\n\n const handleMultiSelectDropdownOptionClick = useCallback(\n (isSelected: boolean, option: DropdownOption) => {\n let newSelectedTags: { label: string; value: string }[] = [];\n if (isSelected) {\n newSelectedTags = [...tags, { label: option.label, value: option.value }];\n } else {\n newSelectedTags = tags.filter((tag) => tag.value !== option.value);\n }\n setTags(newSelectedTags);\n setInputValue('');\n if (isMultiSelectWithoutCTA) {\n applyClickedRef.current = true;\n onChange?.(newSelectedTags.map((tag) => tag.value));\n }\n },\n [tags, isMultiSelectWithoutCTA, onChange]\n );\n\n const ADD_CUSTOM_TAG_VALUE = '__add_custom_tag__';\n const NO_RESULTS_VALUE = '__no_results__';\n const NO_RESULTS_SENTINEL: DropdownOption = { id: NO_RESULTS_VALUE, label: noOptionsMessage, value: NO_RESULTS_VALUE, __noResults: true };\n const isNoResultsSentinel = (item: DropdownOption) => !!item?.__noResults;\n\n const handleSelectFromDropdown = useCallback((option: DropdownOption) => {\n if (disabled) return;\n\n if (option.value === ADD_CUSTOM_TAG_VALUE) {\n const trimmed = inputValue.trim();\n if (!trimmed) return;\n const newTags = [...tags];\n if (!newTags.some((tag) => tag.value === trimmed)) {\n newTags.push({ label: trimmed, value: trimmed });\n setTags(newTags);\n onChange?.(newTags.map((tag) => tag.value));\n }\n setInputValue('');\n setIsDropdownOpen(false);\n return;\n }\n\n if (isMultiSelect) {\n const isSelected = tags.some(tag => tag.value === option.value);\n handleMultiSelectDropdownOptionClick(!isSelected, option);\n } else {\n handleSelectOption(option);\n }\n }, [disabled, isMultiSelect, tags, inputValue, onChange, handleMultiSelectDropdownOptionClick, handleSelectOption]);\n\n const effectiveItems: DropdownOption[] =\n filteredOptions.length > 0\n ? filteredOptions\n : allowCustomTags && inputValue.trim()\n ? [{ id: ADD_CUSTOM_TAG_VALUE, label: `Add \"${inputValue.trim()}\"`, value: ADD_CUSTOM_TAG_VALUE }]\n : [];\n\n // Inject sentinel so arrow keys can reach \"No options found\" when the list is truly empty\n const showEmptyState = effectiveItems.length === 0 && isDropdownOpen;\n const comboboxItems: DropdownOption[] = showEmptyState ? [NO_RESULTS_SENTINEL] : effectiveItems;\n\n // Combobox hook for keyboard navigation and ARIA\n const {\n containerProps,\n inputProps: comboboxInputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex,\n isKeyboardFocused\n } = useCombobox({\n items: comboboxItems,\n isOpen: isDropdownOpen,\n onOpenChange: setIsDropdownOpen,\n onSelect: handleSelectFromDropdown,\n listboxId,\n hasItems: comboboxItems.length > 0,\n keepHighlightOnSelect: isMultiSelect,\n closeOnTab: type !== 'multi-select',\n isItemDisabled: isNoResultsSentinel\n });\n\n const getHighlightClass = (isHighlighted: boolean) =>\n isHighlighted ? `highlighted${isKeyboardFocused ? ' keyboard-highlight' : ''}` : '';\n\n useEffect(() => {\n if (applyClickedRef.current) {\n applyClickedRef.current = false;\n return;\n }\n setTags(initValues(value || []));\n }, [value, options, isDropdownOpen]);\n\n\n useEffect(() => {\n // const isInputEmpty = !inputValue.trim();\n const filtered = options.filter(option =>\n option.label.toLowerCase().includes(inputValue.toLowerCase()) ||\n option.value.toLowerCase().includes(inputValue.toLowerCase())\n );\n setFilteredOptions(filtered);\n }, [inputValue, options]);\n\n // Announce empty state for screen readers — only when arrow keys haven't reached it yet.\n // Once highlighted (aria-activedescendant), the screen reader reads it directly.\n useEffect(() => {\n if (isDropdownOpen && effectiveItems.length === 0 && inputValue.trim() && highlightedIndex === -1) {\n announce(noOptionsMessage, { assertiveness: 'polite', batchId: 'dropdown-input-tags-empty-state', delay: 300 });\n }\n }, [effectiveItems.length, isDropdownOpen, inputValue, highlightedIndex]);\n\n const handleRemoveTag = (indexToRemove: number) => {\n if (disabled) return;\n \n const newTags = tags.filter((_, index) => index !== indexToRemove);\n setTags(newTags);\n \n //in multiselect if tag removed while dorpdownopen, do not call onchange\n if(!isMultiSelect || isMultiSelectWithoutCTA ||(isMultiSelect && !isDropdownOpen)) {\n onChange?.(newTags.map(tag => tag.value));\n }\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n \n // Handle Backspace to remove last tag (preserve existing behavior)\n if (e.key === 'Backspace' && inputValue === \"\" && tags.length > 0) {\n e.preventDefault();\n const newTags = tags.slice(0, -1);\n setTags(newTags);\n onChange?.(newTags.map(tag => tag.value));\n return;\n }\n\n // Handle Enter for custom tags when no options match\n if (e.key === 'Enter' && inputValue.trim() && filteredOptions.length === 0 && allowCustomTags) {\n e.preventDefault();\n const newTags = [...tags];\n if (!newTags.some(tag => tag.value === inputValue.trim())) {\n newTags.push({ label: inputValue.trim(), value: inputValue.trim() });\n setTags(newTags);\n onChange?.(newTags.map(tag => tag.value));\n }\n setInputValue('');\n setHighlightedIndex(-1);\n setIsDropdownOpen(false);\n return;\n }\n\n // Let combobox hook handle all other keyboard events (Arrow keys, Enter, Escape, etc.)\n comboboxInputProps.onKeyDown(e);\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n \n const newValue = e.target.value;\n setInputValue(newValue);\n setHighlightedIndex(-1); // Reset highlighted index when user types\n \n if (newValue.trim() && !isDropdownOpen) {\n setIsDropdownOpen(true);\n }\n };\n\n const handleInputFocus = () => {\n if (disabled) return;\n\n if (inputValue.trim() || options.length > 0) {\n setIsDropdownOpen(true);\n }\n };\n\n const handleInputContainerClick = (e: React.MouseEvent) => {\n if (disabled) return;\n\n e.stopPropagation();\n inputRef.current?.focus();\n if (!isDropdownOpen && (inputValue.trim() || options.length > 0)) {\n setIsDropdownOpen(true);\n }\n };\n\n const handlePopoverWrapperClick = (e: React.MouseEvent) => {\n if (disabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n \n const target = e.target as HTMLElement;\n const isInputArea = target.closest('.input-with-tags-container');\n if (isInputArea) {\n e.stopPropagation();\n }\n };\n\n const toggleDropdown = () => {\n if (disabled) return;\n setIsDropdownOpen(!isDropdownOpen);\n };\n\n useImperativeHandle(ref, () => ({ toggleDropdown }), []);\n\n const defaultRenderOption = (\n option: DropdownOption,\n index: number,\n onSelect: (option: DropdownOption) => void,\n disabled: boolean\n ) => {\n const isSelected = tags.some((tag) => tag.value === option.value);\n const isHighlighted = highlightedIndex === index;\n const optionProps = getOptionProps(index, isSelected);\n \n return (\n <div\n key={option.id}\n {...optionProps}\n className={`dropdown-with-input-tags-option ${getHighlightClass(isHighlighted)}`}\n onClick={() => !disabled && onSelect(option)}\n onMouseEnter={() => setHighlightedIndex(index)}\n data-automation-id={`${automationId}-option-${option.id}`}\n >\n <span className=\"option-label\">{option.label}</span>\n {option.value !== option.label && <span className=\"option-value\">{option.value}</span>}\n </div>\n );\n };\n const handleApplySelectedDropDownValues = () => {\n applyClickedRef.current = true;\n const newTagValues = tags.map(tag => tag.value);\n onChange?.(newTagValues);\n setIsDropdownOpen(false);\n };\n\n const clearSelectedDropDownValues = () => {\n setTags([]);\n };\n const multiSelectRenderOption = (option: DropdownOption, index: number) => {\n const isOptionSelected = tags.some(tag => tag.value === option.value);\n const isHighlighted = highlightedIndex === index;\n const optionProps = getOptionProps(index, isOptionSelected);\n \n return (\n <div\n key={option.id}\n {...optionProps}\n className={`dropdown-with-input-tags-option dropdown-with-input-tags-multi-select-option ${getHighlightClass(isHighlighted)}`}\n aria-checked={isOptionSelected}\n onClick={() => {\n if (disabled) return;\n handleMultiSelectDropdownOptionClick(!isOptionSelected, option);\n inputRef.current?.focus();\n }}\n onMouseEnter={() => setHighlightedIndex(index)}\n data-automation-id={`${automationId}-option-${option.id}`}\n >\n <Checkbox\n automationId=\"checkbox\"\n className=\"checkbox\"\n checked={isOptionSelected}\n onChange={() => {}}\n label={option.label}\n tabIndex={-1}\n />\n </div>\n );\n };\n\n const multiSelectRenderCTAs = () => {\n return (\n <div\n className=\"dropdown-with-input-tags-ctas-container\"\n onKeyDown={(e) => {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n e.stopPropagation();\n }\n }}\n >\n <Button label=\"Clear\" type=\"link\" size=\"sm\" onClick={clearSelectedDropDownValues} automationId={`${automationId}-clear-button`} />\n <Button label=\"Apply\" type=\"primary\" size=\"sm\" onClick={handleApplySelectedDropDownValues} automationId={`${automationId}-apply-button`} />\n </div>\n );\n };\n\n \n\n return (\n <div\n className={`dropdown-with-input-tags-wrapper ${className} ${disabled ? 'disabled-wrapper' : ''}`}\n data-automation-id={automationId}\n {...containerProps}\n >\n {label && <label id={labelId} className=\"dropdown-with-input-tags-label\">{label}</label>}\n\n <div onClick={handlePopoverWrapperClick}>\n <Popover\n ref={popoverRef}\n className=\"dropdown-with-input-tags-popover\"\n contentWidth=\"full\"\n position=\"bottom-left\"\n isPopoverOpen={!disabled && isDropdownOpen}\n onPopoverToggle={disabled ? () => {} : setIsDropdownOpen}\n disableClickToggle={true}\n isWithPortal={isWithPortal}\n renderPopoverContents={({ closePopoverCb }) => (\n <>\n <div\n {...listboxProps}\n className=\"dropdown-with-input-tags-content\"\n {...(isMultiSelect && { 'aria-multiselectable': 'true' })}\n >\n {effectiveItems.length > 0 ? (\n effectiveItems.map((option, index) => {\n if (option.value === ADD_CUSTOM_TAG_VALUE) {\n const isHighlighted = highlightedIndex === index;\n const optionProps = getOptionProps(index, false);\n return (\n <div\n key={option.id}\n {...optionProps}\n className={`dropdown-with-input-tags-option dropdown-with-input-tags-custom-option ${getHighlightClass(isHighlighted)}`}\n onClick={() => {\n if (disabled) return;\n handleSelectFromDropdown(option);\n closePopoverCb();\n }}\n onMouseEnter={() => setHighlightedIndex(index)}\n >\n Add \"{inputValue.trim()}\"\n </div>\n );\n }\n if (isMultiSelect) {\n return multiSelectRenderOption(option, index);\n }\n \n const isSelected = tags.some((tag) => tag.value === option.value);\n const isHighlighted = highlightedIndex === index;\n const optionProps = getOptionProps(index, isSelected);\n const optionPropsWithHandlers = {\n ...optionProps,\n onMouseEnter: () => setHighlightedIndex(index),\n className: `dropdown-with-input-tags-option ${getHighlightClass(isHighlighted)}`\n };\n \n return renderOption\n ? renderOption(option, optionPropsWithHandlers, handleSelectOption)\n : defaultRenderOption(option, index, handleSelectOption, disabled);\n })\n ) : (\n <div\n {...getOptionProps(0, false)}\n className={`dropdown-with-input-tags-no-options ${getHighlightClass(highlightedIndex === 0)}`}\n >\n <div className=\"dropdown-with-input-tags-no-options-text\">\n {noOptionsMessage}\n </div>\n </div>\n )}\n </div>\n {isMultiSelect && !isMultiSelectWithoutCTA && multiSelectRenderCTAs()}\n </>\n )}\n renderPopoverSrcElement={() => (\n <div className=\"dropdown-with-input-tags-input-container\">\n <div\n className={`input-with-tags-container ${disabled ? 'disabled-input-with-tags-container' : ''} ${isKeyboardFocused ? 'keyboard-focused' : ''}`}\n onClick={handleInputContainerClick}\n onKeyDown={(e) => {\n if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {\n inputRef.current?.focus();\n }\n }}\n >\n {tags.map((tag, index) => (\n <span key={index} className=\"tag-in-inputwithtags\">\n {tag[displayTagBy]}\n {!disabled && (\n <Icon\n name=\"close\"\n className=\"close-icon-in-inputwithtags\"\n ariaLabel={`Remove tag ${tag[displayTagBy]}`}\n onClick={() => handleRemoveTag(index)}\n shouldStopPropagation\n />\n )}\n </span>\n ))}\n {(showInput || !tags.length || isMultiSelect) && (\n <input\n ref={inputRef}\n {...comboboxInputProps}\n type=\"text\"\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onFocus={handleInputFocus}\n placeholder={tags.length === 0 ? placeholder : ''}\n className={`input-with-tags-input${!showInput && tags.length > 0 && !inputValue ? ' sr-only' : ''}`}\n disabled={disabled}\n {...getA11yNameAttributes({\n ariaLabel: ariaLabel || (!label ? 'Search and select options' : undefined),\n ariaLabelledBy,\n internalLabelId: label ? labelId : undefined,\n ariaDescribedBy\n })}\n />\n )}\n </div>\n </div>\n )}\n automationId={automationId}\n popoverContentAutomationId={`${automationId}-content`}\n />\n </div>\n </div>\n );\n }\n); "],"names":["DropdownWithInputTags","value","onChange","placeholder","className","options","renderOption","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","automationId","noOptionsMessage","allowCustomTags","disabled","type","showInput","displayTagBy","isWithPortal","ref","initValues","values","map","val","found","find","opt","tags","setTags","useState","inputValue","setInputValue","filteredOptions","setFilteredOptions","isDropdownOpen","setIsDropdownOpen","popoverRef","useRef","inputRef","applyClickedRef","isMultiSelectWithoutCTA","isMultiSelect","listboxId","useStableId","labelId","undefined","handleSelectOption","useCallback","option","newTags","some","tag","push","handleMultiSelectDropdownOptionClick","isSelected","newSelectedTags","filter","current","ADD_CUSTOM_TAG_VALUE","NO_RESULTS_VALUE","NO_RESULTS_SENTINEL","id","__noResults","isNoResultsSentinel","item","handleSelectFromDropdown","trimmed","trim","effectiveItems","length","comboboxItems","containerProps","inputProps","comboboxInputProps","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","isKeyboardFocused","useCombobox","items","isOpen","onOpenChange","onSelect","hasItems","keepHighlightOnSelect","closeOnTab","isItemDisabled","getHighlightClass","isHighlighted","useEffect","filtered","toLowerCase","includes","announce","assertiveness","batchId","delay","handleRemoveTag","indexToRemove","_","index","handleKeyDown","e","key","preventDefault","slice","onKeyDown","handleInputChange","newValue","target","handleInputFocus","handleInputContainerClick","stopPropagation","focus","handlePopoverWrapperClick","closest","toggleDropdown","useImperativeHandle","defaultRenderOption","optionProps","React","createElement","_extends","onClick","onMouseEnter","handleApplySelectedDropDownValues","newTagValues","clearSelectedDropDownValues","multiSelectRenderOption","isOptionSelected","Checkbox","checked","tabIndex","multiSelectRenderCTAs","Button","size","Popover","contentWidth","position","isPopoverOpen","onPopoverToggle","disableClickToggle","renderPopoverContents","closePopoverCb","Fragment","optionPropsWithHandlers","renderPopoverSrcElement","ctrlKey","metaKey","altKey","Icon","name","shouldStopPropagation","onFocus","getA11yNameAttributes","internalLabelId","popoverContentAutomationId"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqDO,MAAMA,wBACX,CACE;AAAA,EACEC,OAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,aAAAA,IAAc;AAAA,EACdC,WAAAA,IAAY;AAAA,EACZC,SAAAA,IAAU,CAAA;AAAA,EACVC,cAAAA;AAAAA,E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,EAAK0C,SAAS,KAAK,CAACvC,IAAa,aAAa,EAAE;AAAA,MACjGhB,UAAAA;AAAAA,IAAAA,GACI6I,GAAsB;AAAA,MACxBnJ,WAAWA,OAAeD,IAAsCsC,SAA9B;AAAA,MAClCpC,gBAAAA;AAAAA,MACAmJ,iBAAiBrJ,IAAQqC,IAAUC;AAAAA,MACnCnC,iBAAAA;AAAAA,IAAAA,CACD,CAAC,CACH,CAEA,CACF;AAAA,IAEPC,cAAAA;AAAAA,IACAkJ,4BAA4B,GAAGlJ,CAAY;AAAA,EAAA,CAC5C,CACE,CACF;AAET,CACF;"}
|
|
1
|
+
{"version":3,"file":"index38.js","sources":["../src/components/DropdownWithInputTags/index.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, forwardRef, ForwardedRef, useImperativeHandle, KeyboardEvent, useCallback } from 'react';\nimport { Popover, PopoverHandle } from '../Popover';\nimport { Icon } from '../Icon';\nimport { Checkbox } from '../Checkbox';\nimport { Button } from '../Button';\nimport { useCombobox, getA11yNameAttributes } from '../../utils/a11y';\nimport { announce } from '../../utils/a11y/liveAnnouncer/LiveAnnouncer';\nimport { useStableId } from '../../utils/useStableId';\nimport './styles.scss';\n\nexport interface DropdownOption {\n id: string | number;\n label: string;\n value: string;\n [key: string]: any; // Allow additional properties\n}\n\nexport interface DropdownWithInputTagsHandle {\n toggleDropdown: () => void;\n}\n\nexport interface DropdownWithInputTagsProps {\n value: string[];\n onChange?: (tags: string[]) => void;\n placeholder?: string;\n className?: string;\n options?: DropdownOption[];\n renderOption?: (\n option: DropdownOption,\n props: {\n id: string;\n role: 'option';\n 'aria-selected'?: boolean;\n 'aria-disabled'?: true;\n onMouseEnter: () => void;\n className: string;\n },\n onSelect: (option: DropdownOption) => void\n ) => React.ReactNode;\n label?: string;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n automationId?: string;\n noOptionsMessage?: string;\n allowCustomTags?: boolean;\n disabled?: boolean;\n type?: 'select' | 'multi-select' |'multi-select-without-cta';\n showInput?: boolean;\n displayTagBy?: 'label' | 'value';\n isWithPortal?: boolean;\n}\n\nexport const DropdownWithInputTags = forwardRef<DropdownWithInputTagsHandle, DropdownWithInputTagsProps>(\n (\n {\n value,\n onChange,\n placeholder = \"Type to search or add custom tags...\",\n className = '',\n options = [],\n renderOption,\n label,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n automationId = '',\n noOptionsMessage = \"No options found\",\n allowCustomTags = true,\n disabled = false,\n type = 'select',\n showInput = true,\n displayTagBy = 'label',\n isWithPortal = false\n },\n ref: ForwardedRef<DropdownWithInputTagsHandle>\n ) => {\n // Define initValues at the top, right after props\n const initValues = (values: string[]) => {\n return values.map(val => {\n const found = options.find(opt => opt.value === val);\n return found ? { label: found.label, value: found.value } : { label: val, value: val };\n });\n };\n\n // Now use it in useState\n const [tags, setTags] = useState<{ label: string; value: string }[]>(() => {\n return initValues(value || []);\n });\n const [inputValue, setInputValue] = useState('');\n const [filteredOptions, setFilteredOptions] = useState<DropdownOption[]>(options);\n const [isDropdownOpen, setIsDropdownOpen] = useState(false);\n const popoverRef = useRef<PopoverHandle>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const applyClickedRef = useRef<boolean>(false);\n \n const isMultiSelectWithoutCTA = type === 'multi-select-without-cta';\n const isMultiSelect = type === 'multi-select' ||isMultiSelectWithoutCTA;\n\n // Generate stable ID for listbox\n const listboxId = useStableId(automationId, 'dropdown-input-tags-listbox');\n\n const handleSelectOption = useCallback(\n (option: DropdownOption) => {\n if (disabled) return;\n\n const newTags = [...tags];\n if (!newTags.some((tag) => tag.value === option.value)) {\n newTags.push({ label: option.label, value: option.value });\n setTags(newTags);\n onChange?.(newTags.map((tag) => tag.value));\n }\n setInputValue('');\n setIsDropdownOpen(false);\n },\n [disabled, tags, onChange]\n );\n\n const handleMultiSelectDropdownOptionClick = useCallback(\n (isSelected: boolean, option: DropdownOption) => {\n let newSelectedTags: { label: string; value: string }[] = [];\n if (isSelected) {\n newSelectedTags = [...tags, { label: option.label, value: option.value }];\n } else {\n newSelectedTags = tags.filter((tag) => tag.value !== option.value);\n }\n setTags(newSelectedTags);\n setInputValue('');\n if (isMultiSelectWithoutCTA) {\n applyClickedRef.current = true;\n onChange?.(newSelectedTags.map((tag) => tag.value));\n }\n },\n [tags, isMultiSelectWithoutCTA, onChange]\n );\n\n const ADD_CUSTOM_TAG_VALUE = '__add_custom_tag__';\n const NO_RESULTS_VALUE = '__no_results__';\n const NO_RESULTS_SENTINEL: DropdownOption = { id: NO_RESULTS_VALUE, label: noOptionsMessage, value: NO_RESULTS_VALUE, __noResults: true };\n const isNoResultsSentinel = (item: DropdownOption) => !!item?.__noResults;\n\n const handleSelectFromDropdown = useCallback((option: DropdownOption) => {\n if (disabled) return;\n\n if (option.value === ADD_CUSTOM_TAG_VALUE) {\n const trimmed = inputValue.trim();\n if (!trimmed) return;\n const newTags = [...tags];\n if (!newTags.some((tag) => tag.value === trimmed)) {\n newTags.push({ label: trimmed, value: trimmed });\n setTags(newTags);\n onChange?.(newTags.map((tag) => tag.value));\n }\n setInputValue('');\n setIsDropdownOpen(false);\n return;\n }\n\n if (isMultiSelect) {\n const isSelected = tags.some(tag => tag.value === option.value);\n handleMultiSelectDropdownOptionClick(!isSelected, option);\n } else {\n handleSelectOption(option);\n }\n }, [disabled, isMultiSelect, tags, inputValue, onChange, handleMultiSelectDropdownOptionClick, handleSelectOption]);\n\n const effectiveItems: DropdownOption[] =\n filteredOptions.length > 0\n ? filteredOptions\n : allowCustomTags && inputValue.trim()\n ? [{ id: ADD_CUSTOM_TAG_VALUE, label: `Add \"${inputValue.trim()}\"`, value: ADD_CUSTOM_TAG_VALUE }]\n : [];\n\n // Inject sentinel so arrow keys can reach \"No options found\" when the list is truly empty\n const showEmptyState = effectiveItems.length === 0 && isDropdownOpen;\n const comboboxItems: DropdownOption[] = showEmptyState ? [NO_RESULTS_SENTINEL] : effectiveItems;\n\n // Combobox hook for keyboard navigation and ARIA\n const {\n containerProps,\n inputProps: comboboxInputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex,\n isKeyboardFocused\n } = useCombobox({\n items: comboboxItems,\n isOpen: isDropdownOpen,\n onOpenChange: setIsDropdownOpen,\n onSelect: handleSelectFromDropdown,\n listboxId,\n hasItems: comboboxItems.length > 0,\n keepHighlightOnSelect: isMultiSelect,\n closeOnTab: type !== 'multi-select',\n isItemDisabled: isNoResultsSentinel\n });\n\n const getHighlightClass = (isHighlighted: boolean) =>\n isHighlighted ? `highlighted${isKeyboardFocused ? ' keyboard-highlight' : ''}` : '';\n\n useEffect(() => {\n if (applyClickedRef.current) {\n applyClickedRef.current = false;\n return;\n }\n setTags(initValues(value || []));\n }, [value, options, isDropdownOpen]);\n\n\n useEffect(() => {\n // const isInputEmpty = !inputValue.trim();\n const filtered = options.filter(option =>\n option.label.toLowerCase().includes(inputValue.toLowerCase()) ||\n option.value.toLowerCase().includes(inputValue.toLowerCase())\n );\n setFilteredOptions(filtered);\n }, [inputValue, options]);\n\n // Announce empty state for screen readers — only when arrow keys haven't reached it yet.\n // Once highlighted (aria-activedescendant), the screen reader reads it directly.\n useEffect(() => {\n if (isDropdownOpen && effectiveItems.length === 0 && inputValue.trim() && highlightedIndex === -1) {\n announce(noOptionsMessage, { assertiveness: 'polite', batchId: 'dropdown-input-tags-empty-state', delay: 300 });\n }\n }, [effectiveItems.length, isDropdownOpen, inputValue, highlightedIndex]);\n\n const handleRemoveTag = (indexToRemove: number) => {\n if (disabled) return;\n \n const newTags = tags.filter((_, index) => index !== indexToRemove);\n setTags(newTags);\n \n //in multiselect if tag removed while dorpdownopen, do not call onchange\n if(!isMultiSelect || isMultiSelectWithoutCTA ||(isMultiSelect && !isDropdownOpen)) {\n onChange?.(newTags.map(tag => tag.value));\n }\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n \n // Handle Backspace to remove last tag (preserve existing behavior)\n if (e.key === 'Backspace' && inputValue === \"\" && tags.length > 0) {\n e.preventDefault();\n const newTags = tags.slice(0, -1);\n setTags(newTags);\n onChange?.(newTags.map(tag => tag.value));\n return;\n }\n\n // Handle Enter for custom tags when no options match\n if (e.key === 'Enter' && inputValue.trim() && filteredOptions.length === 0 && allowCustomTags) {\n e.preventDefault();\n const newTags = [...tags];\n if (!newTags.some(tag => tag.value === inputValue.trim())) {\n newTags.push({ label: inputValue.trim(), value: inputValue.trim() });\n setTags(newTags);\n onChange?.(newTags.map(tag => tag.value));\n }\n setInputValue('');\n setHighlightedIndex(-1);\n setIsDropdownOpen(false);\n return;\n }\n\n // Let combobox hook handle all other keyboard events (Arrow keys, Enter, Escape, etc.)\n comboboxInputProps.onKeyDown(e);\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n \n const newValue = e.target.value;\n setInputValue(newValue);\n setHighlightedIndex(-1); // Reset highlighted index when user types\n \n if (newValue.trim() && !isDropdownOpen) {\n setIsDropdownOpen(true);\n }\n };\n\n const handleInputFocus = () => {\n if (disabled) return;\n\n if (inputValue.trim() || options.length > 0) {\n setIsDropdownOpen(true);\n }\n };\n\n const handleInputContainerClick = (e: React.MouseEvent) => {\n if (disabled) return;\n\n e.stopPropagation();\n inputRef.current?.focus();\n if (!isDropdownOpen && (inputValue.trim() || options.length > 0)) {\n setIsDropdownOpen(true);\n }\n };\n\n const handlePopoverWrapperClick = (e: React.MouseEvent) => {\n if (disabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n \n const target = e.target as HTMLElement;\n const isInputArea = target.closest('.input-with-tags-container');\n if (isInputArea) {\n e.stopPropagation();\n }\n };\n\n const toggleDropdown = () => {\n if (disabled) return;\n setIsDropdownOpen(!isDropdownOpen);\n };\n\n useImperativeHandle(ref, () => ({ toggleDropdown }), []);\n\n const defaultRenderOption = (\n option: DropdownOption,\n index: number,\n onSelect: (option: DropdownOption) => void,\n disabled: boolean\n ) => {\n const isSelected = tags.some((tag) => tag.value === option.value);\n const isHighlighted = highlightedIndex === index;\n const optionProps = getOptionProps(index, isSelected);\n \n return (\n <div\n key={option.id}\n {...optionProps}\n className={`dropdown-with-input-tags-option ${getHighlightClass(isHighlighted)}`}\n onClick={() => !disabled && onSelect(option)}\n onMouseEnter={() => setHighlightedIndex(index)}\n data-automation-id={`${automationId}-option-${option.id}`}\n >\n <span className=\"option-label\">{option.label}</span>\n {option.value !== option.label && <span className=\"option-value\">{option.value}</span>}\n </div>\n );\n };\n const handleApplySelectedDropDownValues = () => {\n applyClickedRef.current = true;\n const newTagValues = tags.map(tag => tag.value);\n onChange?.(newTagValues);\n setIsDropdownOpen(false);\n };\n\n const clearSelectedDropDownValues = () => {\n setTags([]);\n };\n const multiSelectRenderOption = (option: DropdownOption, index: number) => {\n const isOptionSelected = tags.some(tag => tag.value === option.value);\n const isHighlighted = highlightedIndex === index;\n const optionProps = getOptionProps(index, isOptionSelected);\n \n return (\n <div\n key={option.id}\n {...optionProps}\n className={`dropdown-with-input-tags-option dropdown-with-input-tags-multi-select-option ${getHighlightClass(isHighlighted)}`}\n aria-checked={isOptionSelected}\n onClick={() => {\n if (disabled) return;\n handleMultiSelectDropdownOptionClick(!isOptionSelected, option);\n inputRef.current?.focus();\n }}\n onMouseEnter={() => setHighlightedIndex(index)}\n data-automation-id={`${automationId}-option-${option.id}`}\n >\n <Checkbox\n automationId=\"checkbox\"\n className=\"checkbox\"\n checked={isOptionSelected}\n onChange={() => {}}\n label={option.label}\n tabIndex={-1}\n />\n </div>\n );\n };\n\n const multiSelectRenderCTAs = () => {\n return (\n <div\n className=\"dropdown-with-input-tags-ctas-container\"\n onKeyDown={(e) => {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n e.stopPropagation();\n }\n }}\n >\n <Button label=\"Clear\" type=\"link\" size=\"sm\" onClick={clearSelectedDropDownValues} automationId={`${automationId}-clear-button`} />\n <Button label=\"Apply\" type=\"primary\" size=\"sm\" onClick={handleApplySelectedDropDownValues} automationId={`${automationId}-apply-button`} />\n </div>\n );\n };\n\n \n\n return (\n <div\n className={`dropdown-with-input-tags-wrapper ${className} ${disabled ? 'disabled-wrapper' : ''}`}\n data-automation-id={automationId}\n {...containerProps}\n >\n {label && <label id={`${automationId}-label`} className=\"dropdown-with-input-tags-label\">{label}</label>}\n\n <div onClick={handlePopoverWrapperClick}>\n <Popover\n ref={popoverRef}\n className=\"dropdown-with-input-tags-popover\"\n contentWidth=\"full\"\n position=\"bottom-left\"\n isPopoverOpen={!disabled && isDropdownOpen}\n onPopoverToggle={disabled ? () => {} : setIsDropdownOpen}\n disableClickToggle={true}\n isWithPortal={isWithPortal}\n renderPopoverContents={({ closePopoverCb }) => (\n <>\n <div\n {...listboxProps}\n className=\"dropdown-with-input-tags-content\"\n {...(isMultiSelect && { 'aria-multiselectable': 'true' })}\n >\n {effectiveItems.length > 0 ? (\n effectiveItems.map((option, index) => {\n if (option.value === ADD_CUSTOM_TAG_VALUE) {\n const isHighlighted = highlightedIndex === index;\n const optionProps = getOptionProps(index, false);\n return (\n <div\n key={option.id}\n {...optionProps}\n className={`dropdown-with-input-tags-option dropdown-with-input-tags-custom-option ${getHighlightClass(isHighlighted)}`}\n onClick={() => {\n if (disabled) return;\n handleSelectFromDropdown(option);\n closePopoverCb();\n }}\n onMouseEnter={() => setHighlightedIndex(index)}\n >\n Add \"{inputValue.trim()}\"\n </div>\n );\n }\n if (isMultiSelect) {\n return multiSelectRenderOption(option, index);\n }\n \n const isSelected = tags.some((tag) => tag.value === option.value);\n const isHighlighted = highlightedIndex === index;\n const optionProps = getOptionProps(index, isSelected);\n const optionPropsWithHandlers = {\n ...optionProps,\n onMouseEnter: () => setHighlightedIndex(index),\n className: `dropdown-with-input-tags-option ${getHighlightClass(isHighlighted)}`\n };\n \n return renderOption\n ? renderOption(option, optionPropsWithHandlers, handleSelectOption)\n : defaultRenderOption(option, index, handleSelectOption, disabled);\n })\n ) : (\n <div\n {...getOptionProps(0, false)}\n className={`dropdown-with-input-tags-no-options ${getHighlightClass(highlightedIndex === 0)}`}\n >\n <div className=\"dropdown-with-input-tags-no-options-text\">\n {noOptionsMessage}\n </div>\n </div>\n )}\n </div>\n {isMultiSelect && !isMultiSelectWithoutCTA && multiSelectRenderCTAs()}\n </>\n )}\n renderPopoverSrcElement={() => (\n <div className=\"dropdown-with-input-tags-input-container\">\n <div\n className={`input-with-tags-container ${disabled ? 'disabled-input-with-tags-container' : ''} ${isKeyboardFocused ? 'keyboard-focused' : ''}`}\n onClick={handleInputContainerClick}\n onKeyDown={(e) => {\n if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {\n inputRef.current?.focus();\n }\n }}\n >\n {tags.map((tag, index) => (\n <span key={index} className=\"tag-in-inputwithtags\">\n {tag[displayTagBy]}\n {!disabled && (\n <Icon\n name=\"close\"\n className=\"close-icon-in-inputwithtags\"\n ariaLabel={`Remove tag ${tag[displayTagBy]}`}\n onClick={() => handleRemoveTag(index)}\n shouldStopPropagation\n />\n )}\n </span>\n ))}\n {(showInput || !tags.length || isMultiSelect) && (\n <input\n ref={inputRef}\n {...comboboxInputProps}\n type=\"text\"\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onFocus={handleInputFocus}\n placeholder={tags.length === 0 ? placeholder : ''}\n className={`input-with-tags-input${!showInput && tags.length > 0 && !inputValue ? ' sr-only' : ''}`}\n disabled={disabled}\n {...getA11yNameAttributes({\n ariaLabel: ariaLabel || label || 'Search and select options',\n ariaLabelledBy,\n ariaDescribedBy\n })}\n />\n )}\n </div>\n </div>\n )}\n automationId={automationId}\n popoverContentAutomationId={`${automationId}-content`}\n />\n </div>\n </div>\n );\n }\n); "],"names":["DropdownWithInputTags","value","onChange","placeholder","className","options","renderOption","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","automationId","noOptionsMessage","allowCustomTags","disabled","type","showInput","displayTagBy","isWithPortal","ref","initValues","values","map","val","found","find","opt","tags","setTags","useState","inputValue","setInputValue","filteredOptions","setFilteredOptions","isDropdownOpen","setIsDropdownOpen","popoverRef","useRef","inputRef","applyClickedRef","isMultiSelectWithoutCTA","isMultiSelect","listboxId","useStableId","handleSelectOption","useCallback","option","newTags","some","tag","push","handleMultiSelectDropdownOptionClick","isSelected","newSelectedTags","filter","current","ADD_CUSTOM_TAG_VALUE","NO_RESULTS_VALUE","NO_RESULTS_SENTINEL","id","__noResults","isNoResultsSentinel","item","handleSelectFromDropdown","trimmed","trim","effectiveItems","length","comboboxItems","containerProps","inputProps","comboboxInputProps","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","isKeyboardFocused","useCombobox","items","isOpen","onOpenChange","onSelect","hasItems","keepHighlightOnSelect","closeOnTab","isItemDisabled","getHighlightClass","isHighlighted","useEffect","filtered","toLowerCase","includes","announce","assertiveness","batchId","delay","handleRemoveTag","indexToRemove","_","index","handleKeyDown","e","key","preventDefault","slice","onKeyDown","handleInputChange","newValue","target","handleInputFocus","handleInputContainerClick","stopPropagation","focus","handlePopoverWrapperClick","closest","toggleDropdown","useImperativeHandle","defaultRenderOption","optionProps","React","createElement","_extends","onClick","onMouseEnter","handleApplySelectedDropDownValues","newTagValues","clearSelectedDropDownValues","multiSelectRenderOption","isOptionSelected","Checkbox","checked","tabIndex","multiSelectRenderCTAs","Button","size","Popover","contentWidth","position","isPopoverOpen","onPopoverToggle","disableClickToggle","renderPopoverContents","closePopoverCb","Fragment","optionPropsWithHandlers","renderPopoverSrcElement","ctrlKey","metaKey","altKey","Icon","name","shouldStopPropagation","onFocus","getA11yNameAttributes","popoverContentAutomationId"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqDO,MAAMA,wBACX,CACE;AAAA,EACEC,OAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,aAAAA,IAAc;AAAA,EACdC,WAAAA,IAAY;AAAA,EACZC,SAAAA,IAAU,CAAA;AAAA,EACVC,cAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,WAAAA;AAAA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,MACxBjJ,WAAWA,MAAaD,KAAS;AAAA,MACjCE,gBAAAA;AAAAA,MACAC,iBAAAA;AAAAA,IAAAA,CACD,CAAC,CACH,CAEA,CACF;AAAA,IAEPC,cAAAA;AAAAA,IACA+I,4BAA4B,GAAG/I,CAAY;AAAA,EAAA,CAC5C,CACE,CACF;AAET,CACF;"}
|
package/dist/index39.js
CHANGED
|
@@ -1,80 +1,76 @@
|
|
|
1
1
|
import e from "react";
|
|
2
|
-
import { useStableId as
|
|
3
|
-
import { mergeIds as
|
|
4
|
-
import { getA11yNameAttributes as
|
|
2
|
+
import { useStableId as A } from "./index205.js";
|
|
3
|
+
import { mergeIds as P } from "./index206.js";
|
|
4
|
+
import { getA11yNameAttributes as _ } from "./index81.js";
|
|
5
5
|
import "./index72.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
function
|
|
8
|
-
value:
|
|
9
|
-
onChange:
|
|
10
|
-
onBlur:
|
|
11
|
-
onFocus:
|
|
12
|
-
disabled:
|
|
13
|
-
maxLength:
|
|
14
|
-
tag:
|
|
7
|
+
function G({
|
|
8
|
+
value: l,
|
|
9
|
+
onChange: m,
|
|
10
|
+
onBlur: u,
|
|
11
|
+
onFocus: p,
|
|
12
|
+
disabled: n,
|
|
13
|
+
maxLength: a,
|
|
14
|
+
tag: v,
|
|
15
15
|
error: t,
|
|
16
|
-
errorMessage:
|
|
17
|
-
label:
|
|
18
|
-
placeholder:
|
|
16
|
+
errorMessage: i,
|
|
17
|
+
label: r,
|
|
18
|
+
placeholder: E,
|
|
19
19
|
style: N,
|
|
20
|
-
inputStyle:
|
|
20
|
+
inputStyle: b,
|
|
21
21
|
automationId: f = "",
|
|
22
|
-
id:
|
|
23
|
-
ariaLabel:
|
|
24
|
-
ariaLabelledBy:
|
|
25
|
-
ariaDescribedBy:
|
|
26
|
-
...
|
|
22
|
+
id: $,
|
|
23
|
+
ariaLabel: h,
|
|
24
|
+
ariaLabelledBy: I,
|
|
25
|
+
ariaDescribedBy: y,
|
|
26
|
+
...F
|
|
27
27
|
}) {
|
|
28
|
-
const
|
|
29
|
-
ariaLabel:
|
|
30
|
-
ariaLabelledBy:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
onChange: (l) => {
|
|
40
|
-
const B = l.target.value;
|
|
41
|
-
p(B);
|
|
28
|
+
const w = v || "input", o = A($, "se-input"), s = `${o}-error`, d = `${o}-count`, B = P(t && i ? s : void 0, a ? d : void 0, y), C = _({
|
|
29
|
+
ariaLabel: h,
|
|
30
|
+
ariaLabelledBy: I,
|
|
31
|
+
ariaDescribedBy: B
|
|
32
|
+
}), g = {
|
|
33
|
+
...F,
|
|
34
|
+
id: o,
|
|
35
|
+
value: l,
|
|
36
|
+
onChange: (c) => {
|
|
37
|
+
const x = c.target.value;
|
|
38
|
+
m(x);
|
|
42
39
|
},
|
|
43
|
-
onBlur:
|
|
44
|
-
onFocus: (
|
|
45
|
-
|
|
40
|
+
onBlur: u,
|
|
41
|
+
onFocus: (c) => {
|
|
42
|
+
p?.(c);
|
|
46
43
|
},
|
|
47
|
-
disabled:
|
|
48
|
-
className: `${t ? "input-container-error" : "input-container-default"} ${
|
|
49
|
-
maxLength:
|
|
50
|
-
placeholder:
|
|
51
|
-
style:
|
|
44
|
+
disabled: n,
|
|
45
|
+
className: `${t ? "input-container-error" : "input-container-default"} ${n ? "input-container-disabled" : ""}`,
|
|
46
|
+
maxLength: a ?? void 0,
|
|
47
|
+
placeholder: E,
|
|
48
|
+
style: b,
|
|
52
49
|
"aria-invalid": t ? "true" : void 0,
|
|
53
|
-
...
|
|
50
|
+
...C
|
|
54
51
|
};
|
|
55
52
|
return /* @__PURE__ */ e.createElement("div", {
|
|
56
53
|
className: "input-main-container",
|
|
57
54
|
style: N,
|
|
58
55
|
"data-automation-id": f
|
|
59
|
-
},
|
|
56
|
+
}, r && /* @__PURE__ */ e.createElement("label", {
|
|
57
|
+
className: `label-container ${n ? "label-container-disabled" : ""}`,
|
|
58
|
+
htmlFor: o
|
|
59
|
+
}, r), /* @__PURE__ */ e.createElement(w, g), (t || a) && /* @__PURE__ */ e.createElement("div", {
|
|
60
|
+
className: `${t ? "error-and-max-word" : "max-word-container"} ${n ? "disabled" : ""}`
|
|
61
|
+
}, t && i && /* @__PURE__ */ e.createElement("div", {
|
|
62
|
+
key: i,
|
|
60
63
|
id: s,
|
|
61
|
-
className: `label-container ${i ? "label-container-disabled" : ""}`,
|
|
62
|
-
htmlFor: a
|
|
63
|
-
}, c), /* @__PURE__ */ e.createElement(C, A), (t || n) && /* @__PURE__ */ e.createElement("div", {
|
|
64
|
-
className: `${t ? "error-and-max-word" : "max-word-container"} ${i ? "disabled" : ""}`
|
|
65
|
-
}, t && o && /* @__PURE__ */ e.createElement("div", {
|
|
66
|
-
key: o,
|
|
67
|
-
id: m,
|
|
68
64
|
className: "error-message",
|
|
69
65
|
role: "alert"
|
|
70
|
-
},
|
|
71
|
-
id:
|
|
66
|
+
}, i), a && /* @__PURE__ */ e.createElement("div", {
|
|
67
|
+
id: d,
|
|
72
68
|
className: "max-word",
|
|
73
69
|
"aria-live": "polite",
|
|
74
70
|
"aria-atomic": "true"
|
|
75
|
-
}, /* @__PURE__ */ e.createElement("span", null,
|
|
71
|
+
}, /* @__PURE__ */ e.createElement("span", null, l?.length + "/" + a))));
|
|
76
72
|
}
|
|
77
73
|
export {
|
|
78
|
-
|
|
74
|
+
G as Input
|
|
79
75
|
};
|
|
80
76
|
//# sourceMappingURL=index39.js.map
|
package/dist/index39.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index39.js","sources":["../src/components/Input/index.tsx"],"sourcesContent":["import React from 'react';\nimport { useStableId } from '../../utils/useStableId';\nimport { mergeIds } from '../../utils/mergeIds';\nimport { getA11yNameAttributes } from '../../utils/a11y';\nimport './style.scss';\n\ntype InputTag = 'input' | 'textarea';\n\ntype NativeInputProps = Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'value'\n | 'onChange'\n | 'disabled'\n | 'maxLength'\n | 'id'\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'children'\n>;\ntype NativeTextareaProps = Omit<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n | 'value'\n | 'onChange'\n | 'disabled'\n | 'maxLength'\n | 'id'\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'children'\n>;\n\ntype CommonInputProps = {\n value: string;\n disabled?: boolean;\n maxLength?: number;\n onChange: (value: string) => void;\n onBlur?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;\n onFocus?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;\n tag?: InputTag;\n error?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n style?: React.CSSProperties;\n inputStyle?: React.CSSProperties;\n automationId?: string;\n id?: string;\n /**\n * Accessible name when no visible label exists (icon-only / placeholder-only inputs).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of visible element(s) that label this input.\n * Useful for external labels outside the Input component.\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this input (hints, helper text, etc.).\n * Will be merged with internal error/counter IDs.\n */\n ariaDescribedBy?: string;\n};\n\n/**\n * Input component with built-in label, error, and counter support.\n * \n * Native HTML input/textarea attributes are passed through, including:\n * - `required`, `readOnly`, `autoFocus`, `name`, `type`\n * - `autoComplete`, `inputMode`, `enterKeyHint`, `pattern`\n * - Note: accessible name/description is provided via ariaLabel/ariaLabelledBy/ariaDescribedBy props.\n * - `min`, `max`, `step` (for number inputs)\n * - `onKeyDown`, `onPaste`, and other event handlers\n */\nexport type InputProps = CommonInputProps & (NativeInputProps | NativeTextareaProps);\n\nexport function Input({\n value,\n onChange,\n onBlur,\n onFocus,\n disabled,\n maxLength,\n tag,\n error,\n errorMessage,\n label,\n placeholder,\n style,\n inputStyle,\n automationId = '',\n id,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ...nativeProps\n}: InputProps) {\n const Element: InputTag = tag || 'input';\n\n const inputId = useStableId(id, 'se-input');\n const
|
|
1
|
+
{"version":3,"file":"index39.js","sources":["../src/components/Input/index.tsx"],"sourcesContent":["import React from 'react';\nimport { useStableId } from '../../utils/useStableId';\nimport { mergeIds } from '../../utils/mergeIds';\nimport { getA11yNameAttributes } from '../../utils/a11y';\nimport './style.scss';\n\ntype InputTag = 'input' | 'textarea';\n\ntype NativeInputProps = Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'value'\n | 'onChange'\n | 'disabled'\n | 'maxLength'\n | 'id'\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'children'\n>;\ntype NativeTextareaProps = Omit<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n | 'value'\n | 'onChange'\n | 'disabled'\n | 'maxLength'\n | 'id'\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'children'\n>;\n\ntype CommonInputProps = {\n value: string;\n disabled?: boolean;\n maxLength?: number;\n onChange: (value: string) => void;\n onBlur?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;\n onFocus?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;\n tag?: InputTag;\n error?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n style?: React.CSSProperties;\n inputStyle?: React.CSSProperties;\n automationId?: string;\n id?: string;\n /**\n * Accessible name when no visible label exists (icon-only / placeholder-only inputs).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of visible element(s) that label this input.\n * Useful for external labels outside the Input component.\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this input (hints, helper text, etc.).\n * Will be merged with internal error/counter IDs.\n */\n ariaDescribedBy?: string;\n};\n\n/**\n * Input component with built-in label, error, and counter support.\n * \n * Native HTML input/textarea attributes are passed through, including:\n * - `required`, `readOnly`, `autoFocus`, `name`, `type`\n * - `autoComplete`, `inputMode`, `enterKeyHint`, `pattern`\n * - Note: accessible name/description is provided via ariaLabel/ariaLabelledBy/ariaDescribedBy props.\n * - `min`, `max`, `step` (for number inputs)\n * - `onKeyDown`, `onPaste`, and other event handlers\n */\nexport type InputProps = CommonInputProps & (NativeInputProps | NativeTextareaProps);\n\nexport function Input({\n value,\n onChange,\n onBlur,\n onFocus,\n disabled,\n maxLength,\n tag,\n error,\n errorMessage,\n label,\n placeholder,\n style,\n inputStyle,\n automationId = '',\n id,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ...nativeProps\n}: InputProps) {\n const Element: InputTag = tag || 'input';\n\n const inputId = useStableId(id, 'se-input');\n const errorId = `${inputId}-error`;\n const countId = `${inputId}-count`;\n\n const describedBy = mergeIds(\n error && errorMessage ? errorId : undefined,\n maxLength ? countId : undefined,\n ariaDescribedBy\n );\n\n const accessibleNameProps = getA11yNameAttributes({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy: describedBy\n });\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n onFocus?.(e);\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n const nextValue = e.target.value;\n onChange(nextValue);\n };\n\n const inputPropsBase = {\n ...(nativeProps as Record<string, unknown>),\n id: inputId,\n value,\n onChange: handleChange,\n onBlur,\n onFocus: handleFocus,\n disabled,\n className: `${error ? 'input-container-error' : 'input-container-default'} ${\n disabled ? 'input-container-disabled' : ''\n }`,\n maxLength: maxLength ?? undefined,\n placeholder: placeholder,\n style: inputStyle,\n 'aria-invalid': error ? 'true' : undefined,\n ...accessibleNameProps\n };\n\n return (\n <div className=\"input-main-container\" style={style} data-automation-id={automationId}>\n {label && (\n <label\n className={`label-container ${disabled ? 'label-container-disabled' : ''}`}\n htmlFor={inputId}\n >\n {label}\n </label>\n )}\n {React.createElement(Element, inputPropsBase)}\n {(error || maxLength) &&\n <div className={`${error ? 'error-and-max-word' : 'max-word-container'} ${disabled ? 'disabled' : ''}`}>\n {error && errorMessage && (\n <div key={errorMessage} id={errorId} className=\"error-message\" role=\"alert\">\n {errorMessage}\n </div>\n )}\n {maxLength && (\n <div id={countId} className=\"max-word\" aria-live=\"polite\" aria-atomic=\"true\">\n <span>{value?.length + '/' + maxLength}</span>\n </div>\n )}\n </div>\n }\n </div>\n );\n}\n"],"names":["React__default","useStableId","mergeIds","getA11yNameAttributes","Input","value","onChange","onBlur","onFocus","disabled","maxLength","tag","error","errorMessage","label","placeholder","style","inputStyle","automationId","id","ariaLabel","ariaLabelledBy","ariaDescribedBy","nativeProps","Element","inputId","errorId","countId","describedBy","undefined","accessibleNameProps","inputPropsBase","handleChange","e","nextValue","target","handleFocus","className","React","createElement","htmlFor","key","role","length"],"mappings":"AA8EO,OAAAA,OAAA;AAAA,SAAA,eAAAC,SAAA;AAAA,SAAA,YAAAC,SAAA;AAAA,SAAA,yBAAAC,SAAA;AAAA,OAAA;AAAA,OAAA;AAAA,SAASC,EAAM;AAAA,EACpBC,OAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,QAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,KAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,YAAAA;AAAAA,EACAC,cAAAA,IAAe;AAAA,EACfC,IAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACA,GAAGC;AACO,GAAG;AACb,QAAMC,IAAoBb,KAAO,SAE3Bc,IAAUxB,EAAYkB,GAAI,UAAU,GACpCO,IAAU,GAAGD,CAAO,UACpBE,IAAU,GAAGF,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AAK5B;AAAAA,IAAcM,IAAIO;AAAAA,IAASW,WAAU;AAAA,IAAgBK,MAAK;AAAA,EAAA,GACjE7B,CACE,GAENH,KACC4B,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKpB,IAAIQ;AAAAA,IAASU,WAAU;AAAA,IAAW,aAAU;AAAA,IAAS,eAAY;AAAA,EAAA,GACpEC,gBAAAA,EAAAC,cAAA,QAAA,MAAOlC,GAAOsC,SAAS,MAAMjC,CAAgB,CAC1C,CAEJ,CAEJ;AAET;"}
|
package/dist/index4.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import o, { forwardRef as
|
|
2
|
-
import { getA11yNameAttributes as
|
|
3
|
-
import { useAccessiblePress as
|
|
1
|
+
import o, { forwardRef as F, useRef as G, useEffect as H } from "react";
|
|
2
|
+
import { getA11yNameAttributes as J } from "./index81.js";
|
|
3
|
+
import { useAccessiblePress as K } from "./index67.js";
|
|
4
4
|
import "./index72.js";
|
|
5
|
-
import { announce as
|
|
6
|
-
import { Icon as
|
|
5
|
+
import { announce as L } from "./index75.js";
|
|
6
|
+
import { Icon as y } from "./index6.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function u() {
|
|
9
|
+
return u = Object.assign ? Object.assign.bind() : function(n) {
|
|
10
10
|
for (var s = 1; s < arguments.length; s++) {
|
|
11
11
|
var r = arguments[s];
|
|
12
12
|
for (var t in r) ({}).hasOwnProperty.call(r, t) && (n[t] = r[t]);
|
|
13
13
|
}
|
|
14
14
|
return n;
|
|
15
|
-
},
|
|
15
|
+
}, u.apply(null, arguments);
|
|
16
16
|
}
|
|
17
|
-
const a = "focus-outline",
|
|
17
|
+
const a = "focus-outline", M = {
|
|
18
18
|
primary: "primary-btn disabled-btn pointer-events-none cursor-not-allowed",
|
|
19
19
|
secondary: "secondary-btn disabled-btn pointer-events-none cursor-not-allowed",
|
|
20
20
|
ghost: "ghost-btn disabled-btn pointer-events-none cursor-not-allowed",
|
|
@@ -26,7 +26,7 @@ const a = "focus-outline", Q = {
|
|
|
26
26
|
// padding: 8px, 12px
|
|
27
27
|
lg: "py-3 px-4 large"
|
|
28
28
|
// padding: 12px, 16px
|
|
29
|
-
},
|
|
29
|
+
}, h = {
|
|
30
30
|
primary: `primary-btn ${a}`,
|
|
31
31
|
secondary: `secondary-btn ${a}`,
|
|
32
32
|
ghost: `ghost-btn ${a}`,
|
|
@@ -38,88 +38,83 @@ const a = "focus-outline", Q = {
|
|
|
38
38
|
// padding: 8px, 12px
|
|
39
39
|
lg: "py-3 px-4 large"
|
|
40
40
|
// padding: 12px, 16px
|
|
41
|
-
},
|
|
41
|
+
}, Q = {
|
|
42
42
|
blue: "theme-blue",
|
|
43
43
|
red: "theme-red",
|
|
44
44
|
yellow: "theme-yellow",
|
|
45
45
|
green: "theme-green",
|
|
46
46
|
ai: "theme-ai",
|
|
47
47
|
white: "theme-white"
|
|
48
|
-
},
|
|
48
|
+
}, S = /* @__PURE__ */ F(({
|
|
49
49
|
type: n = "primary",
|
|
50
50
|
theme: s = "blue",
|
|
51
51
|
size: r = "md",
|
|
52
52
|
label: t = "",
|
|
53
|
-
iconPosition:
|
|
54
|
-
disabled:
|
|
53
|
+
iconPosition: p = "left",
|
|
54
|
+
disabled: w = !1,
|
|
55
55
|
loading: e = !1,
|
|
56
56
|
loadingLabel: l,
|
|
57
|
-
className:
|
|
58
|
-
iconProps:
|
|
57
|
+
className: g = "",
|
|
58
|
+
iconProps: m = {
|
|
59
59
|
name: ""
|
|
60
60
|
},
|
|
61
|
-
automationId:
|
|
62
|
-
autoFocus:
|
|
63
|
-
ariaLabel:
|
|
64
|
-
ariaLabelledBy:
|
|
65
|
-
ariaDescribedBy:
|
|
66
|
-
isPressed:
|
|
67
|
-
onClick:
|
|
68
|
-
onKeyboardActivate:
|
|
69
|
-
onPointerDown:
|
|
70
|
-
onMouseDown:
|
|
71
|
-
onTouchStart:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
e && !v.current && M(l || (t ? `${t}, loading` : "Loading"), {
|
|
61
|
+
automationId: v = "",
|
|
62
|
+
autoFocus: N = !1,
|
|
63
|
+
ariaLabel: x,
|
|
64
|
+
ariaLabelledBy: k,
|
|
65
|
+
ariaDescribedBy: C,
|
|
66
|
+
isPressed: E,
|
|
67
|
+
onClick: $,
|
|
68
|
+
onKeyboardActivate: P,
|
|
69
|
+
onPointerDown: R,
|
|
70
|
+
onMouseDown: j,
|
|
71
|
+
onTouchStart: A,
|
|
72
|
+
...B
|
|
73
|
+
}, O) => {
|
|
74
|
+
const c = n === "unstyled", b = e && l ? l : t, f = G(e);
|
|
75
|
+
H(() => {
|
|
76
|
+
e && !f.current && L(l || (t ? `${t}, loading` : "Loading"), {
|
|
78
77
|
delay: 300
|
|
79
|
-
}),
|
|
78
|
+
}), f.current = e;
|
|
80
79
|
}, [e, t, l]);
|
|
81
80
|
const {
|
|
82
|
-
pressProps:
|
|
83
|
-
isDisabled:
|
|
84
|
-
} =
|
|
85
|
-
disabled:
|
|
81
|
+
pressProps: _,
|
|
82
|
+
isDisabled: d
|
|
83
|
+
} = K({
|
|
84
|
+
disabled: w,
|
|
86
85
|
loading: e,
|
|
87
86
|
isNative: !0,
|
|
88
87
|
// native <button> => hook does NOT add Enter/Space onKeyDown
|
|
89
|
-
pressed:
|
|
90
|
-
onClick:
|
|
91
|
-
onKeyboardActivate:
|
|
92
|
-
onPointerDown:
|
|
93
|
-
onMouseDown:
|
|
94
|
-
onTouchStart:
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
ariaLabel: E,
|
|
103
|
-
ariaLabelledBy: $,
|
|
104
|
-
ariaDescribedBy: P
|
|
88
|
+
pressed: E,
|
|
89
|
+
onClick: $,
|
|
90
|
+
onKeyboardActivate: P,
|
|
91
|
+
onPointerDown: R,
|
|
92
|
+
onMouseDown: j,
|
|
93
|
+
onTouchStart: A
|
|
94
|
+
}), I = !c && n !== "link" ? h[r] : "", z = c ? "" : Q[s], D = d ? M[n] : h[n], i = m?.name ? {
|
|
95
|
+
...m,
|
|
96
|
+
stroke: d ? "var(--color-gray-600)" : m.stroke
|
|
97
|
+
} : void 0, U = ["se-design-button", z, I, D, g, c ? "" : "rounded-[6px] inline-flex gap-1 items-center min-w-fit"].filter(Boolean).join(" "), q = J({
|
|
98
|
+
ariaLabel: x,
|
|
99
|
+
ariaLabelledBy: k,
|
|
100
|
+
ariaDescribedBy: C
|
|
105
101
|
});
|
|
106
|
-
return /* @__PURE__ */ o.createElement("button",
|
|
107
|
-
ref:
|
|
102
|
+
return /* @__PURE__ */ o.createElement("button", u({
|
|
103
|
+
ref: O,
|
|
108
104
|
type: "button",
|
|
109
|
-
className:
|
|
110
|
-
disabled:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}, I, D, F), e && /* @__PURE__ */ o.createElement("div", {
|
|
105
|
+
className: U,
|
|
106
|
+
disabled: d,
|
|
107
|
+
autoFocus: N,
|
|
108
|
+
"data-automation-id": v
|
|
109
|
+
}, B, _, q), e && /* @__PURE__ */ o.createElement("div", {
|
|
115
110
|
"aria-hidden": "true",
|
|
116
111
|
className: "animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full"
|
|
117
|
-
}), !e &&
|
|
112
|
+
}), !e && i?.name && p === "left" && /* @__PURE__ */ o.createElement(y, i), b && /* @__PURE__ */ o.createElement("span", {
|
|
118
113
|
className: "button-label [font-weight:inherit]"
|
|
119
|
-
},
|
|
114
|
+
}, b), !e && i?.name && p === "right" && /* @__PURE__ */ o.createElement(y, i));
|
|
120
115
|
});
|
|
121
|
-
|
|
116
|
+
S.displayName = "Button";
|
|
122
117
|
export {
|
|
123
|
-
|
|
118
|
+
S as Button
|
|
124
119
|
};
|
|
125
120
|
//# sourceMappingURL=index4.js.map
|
package/dist/index4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.js","sources":["../src/components/Button/index.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { announce } from '../../utils/a11y/liveAnnouncer';\nimport { Icon, IconProps } from '../Icon';\nimport './style.scss';\n\n/**\n * Allows native button attributes (aria-*, data-*, etc.) to be passed through,\n * but keeps our own onClick/disabled/type typing AND aria-label/aria-labelledby/aria-describedby.\n * Note: We omit 'type' because we use it for button variant, not HTML type attribute.\n * The HTML type is always set to 'button' internally.\n */\ntype NativeButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'disabled' | 'type' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-pressed'\n>;\n\nexport interface ButtonProps extends NativeButtonProps {\n /**\n * Type of the button. \n */\n type?: 'primary' | 'secondary' | 'ghost' | 'link' | 'unstyled';\n /**\n * Color pallet of the button\n */\n theme?: 'blue' | 'red' | 'yellow' | 'green' | 'ai' | 'white';\n /**\n * Size of the button\n */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Button contents\n */\n label: string | '';\n /**\n * Icon props\n */\n iconProps?: IconProps;\n /**\n * Icon position\n */\n iconPosition?: 'left' | 'right';\n /**\n * Disabled state\n */\n disabled?: boolean;\n /**\n * Loading state - will disable button and show spinner\n */\n loading?: boolean;\n /**\n * Custom label shown (both visually and announced to screen readers) when loading is true.\n * When omitted, the original label remains visible and SR announcement is \"${label}, loading\".\n */\n loadingLabel?: string;\n /**\n * Optional click handler (called for pointer/mouse activations)\n */\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Optional keyboard activation handler\n * Called when button is activated via keyboard (Enter/Space) or assistive technology virtual activation.\n * Use when you want to have different behavior for keyboard and pointer activations.\n * If not provided, onClick will be called for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Automation ID for testing\n */\n automationId?: string;\n /**\n * If true, button will be focused on mount.\n * For programmatic focus control, use ref with .focus() instead.\n */\n autoFocus?: boolean;\n /**\n * Accessible name for the button. Use when there's no visible label (e.g., icon-only buttons).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this button.\n * Preferred over ariaLabel when a visible label exists (keeps SR and visual text in sync).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this button.\n * Provides additional context announced after the accessible name.\n */\n ariaDescribedBy?: string;\n /**\n * When true, sets aria-pressed for toggle/pressed state \n */\n isPressed?: boolean;\n}\n\nconst focusClass = 'focus-outline';\nconst disabledClassNames: Map = {\n primary: 'primary-btn disabled-btn pointer-events-none cursor-not-allowed',\n secondary: 'secondary-btn disabled-btn pointer-events-none cursor-not-allowed',\n ghost: 'ghost-btn disabled-btn pointer-events-none cursor-not-allowed',\n link: 'link-btn w-fit disabled-btn pointer-events-none cursor-not-allowed',\n unstyled: 'unstyled-btn disabled-btn pointer-events-none cursor-not-allowed',\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\nconst classNames: Map = {\n primary: `primary-btn ${focusClass}`,\n secondary: `secondary-btn ${focusClass}`,\n ghost: `ghost-btn ${focusClass}`,\n link: `link-btn w-fit ${focusClass}`,\n unstyled: `unstyled-btn ${focusClass}`,\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\n\nconst colorPalletClassNames: Map = {\n blue: 'theme-blue',\n red: 'theme-red',\n yellow: 'theme-yellow',\n green: 'theme-green',\n ai: 'theme-ai',\n white: 'theme-white'\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n type = 'primary',\n theme = 'blue',\n size = 'md',\n label = '',\n iconPosition = 'left',\n disabled = false,\n loading = false,\n loadingLabel,\n className = '',\n iconProps = { name: '' },\n automationId = '',\n autoFocus = false,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n isPressed,\n onClick,\n onKeyboardActivate,\n onPointerDown,\n onMouseDown,\n onTouchStart,\n tabIndex,\n ...props\n },\n ref\n ) => {\n const isUnstyled = type === 'unstyled';\n const hasTabIndex = tabIndex !== undefined;\n const visibleLabel = loading && loadingLabel ? loadingLabel : label;\n const prevLoadingRef = useRef(loading);\n\n useEffect(() => {\n if (loading && !prevLoadingRef.current) {\n announce(loadingLabel || (label ? `${label}, loading` : 'Loading'), { delay: 300 });\n }\n prevLoadingRef.current = loading;\n }, [loading, label, loadingLabel]);\n\n // Use shared hook for activation handling (pointer vs keyboard/virtual click routing)\n const { pressProps, isDisabled } = useAccessiblePress({\n disabled,\n loading,\n isNative: true, // native <button> => hook does NOT add Enter/Space onKeyDown\n pressed: isPressed,\n onClick: onClick as (e: React.MouseEvent<HTMLElement>) => void,\n onKeyboardActivate: onKeyboardActivate as (e: React.MouseEvent<HTMLElement>) => void,\n onPointerDown: onPointerDown as (e: React.PointerEvent<HTMLElement>) => void,\n onMouseDown: onMouseDown as (e: React.MouseEvent<HTMLElement>) => void,\n onTouchStart: onTouchStart as (e: React.TouchEvent<HTMLElement>) => void\n });\n\n // Skip size/color classes for unstyled variant\n const sizeClassName = !isUnstyled && type !== 'link' ? classNames[size] : '';\n const colorPalletClassName = !isUnstyled ? colorPalletClassNames[theme] : '';\n let typeClassName = isDisabled ? disabledClassNames[type] : classNames[type];\n if (isDisabled && hasTabIndex) {\n typeClassName = typeClassName.replace('pointer-events-none ', '');\n }\n\n // Avoid mutating incoming iconProps\n const computedIconProps: IconProps | undefined = iconProps?.name\n ? {\n ...iconProps,\n stroke: isDisabled ? 'var(--color-gray-600)' : iconProps.stroke\n }\n : undefined;\n\n const buttonClassName = [\n 'se-design-button',\n colorPalletClassName,\n sizeClassName,\n typeClassName,\n className,\n !isUnstyled ? 'rounded-[6px] inline-flex gap-1 items-center min-w-fit' : ''\n ]\n .filter(Boolean)\n .join(' ');\n\n // Compute accessible name/description props with correct precedence\n const accessibleNameProps = getA11yNameAttributes({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy\n });\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={buttonClassName}\n disabled={isDisabled && !hasTabIndex}\n tabIndex={tabIndex}\n autoFocus={autoFocus}\n data-automation-id={automationId}\n {...props}\n {...(pressProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n {...accessibleNameProps}\n >\n {loading && (\n <div\n aria-hidden=\"true\"\n className=\"animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full\"\n />\n )}\n {!loading && computedIconProps?.name && iconPosition === 'left' && (\n <Icon {...computedIconProps} />\n )}\n {visibleLabel && (\n <span className=\"button-label [font-weight:inherit]\">{visibleLabel}</span>\n )}\n {!loading && computedIconProps?.name && iconPosition === 'right' && (\n <Icon {...computedIconProps} />\n )}\n </button>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"names":["focusClass","disabledClassNames","primary","secondary","ghost","link","unstyled","sm","md","lg","classNames","colorPalletClassNames","blue","red","yellow","green","ai","white","Button","type","theme","size","label","iconPosition","disabled","loading","loadingLabel","className","iconProps","name","automationId","autoFocus","ariaLabel","ariaLabelledBy","ariaDescribedBy","isPressed","onClick","onKeyboardActivate","onPointerDown","onMouseDown","onTouchStart","tabIndex","props","ref","isUnstyled","hasTabIndex","undefined","visibleLabel","prevLoadingRef","useRef","useEffect","current","announce","delay","pressProps","isDisabled","useAccessiblePress","isNative","pressed","sizeClassName","colorPalletClassName","typeClassName","replace","computedIconProps","stroke","buttonClassName","filter","Boolean","join","accessibleNameProps","getA11yNameAttributes","React","createElement","_extends","Icon","displayName"],"mappings":";;;;;;;;;;;;;;;;AAqGA,MAAMA,IAAa,iBACb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IACE9B,KAAAA;AAAAA,IACAxB,MAAK;AAAA,IACLQ,WAAWsC;AAAAA,IACXzC,UAAU+B,KAAc,CAACV;AAAAA,IACzBJ,UAAAA;AAAAA,IACAV,WAAAA;AAAAA,IACA,sBAAoBD;AAAAA,EAAAA,GAChBY,GACCY,GACDe,CAAmB,GAEtB5C,KACC8C,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACE,eAAY;AAAA,IACZ7C,WAAU;AAAA,EAAA,CACX,GAEF,CAACF,KAAWsC,GAAmBlC,QAAQN,MAAiB,UACvDgD,gBAAAA,EAAAC,cAACE,GAASX,CAAoB,GAE/BhB,KACCwB,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IAAM7C,WAAU;AAAA,EAAA,GAAsCoB,CAAmB,GAE1E,CAACtB,KAAWsC,GAAmBlC,QAAQN,MAAiB,WACvDgD,gBAAAA,EAAAC,cAACE,GAASX,CAAoB,CAE1B;AAEV,CACF;AAEA7C,EAAOyD,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index4.js","sources":["../src/components/Button/index.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { announce } from '../../utils/a11y/liveAnnouncer';\nimport { Icon, IconProps } from '../Icon';\nimport './style.scss';\n\n/**\n * Allows native button attributes (aria-*, data-*, etc.) to be passed through,\n * but keeps our own onClick/disabled/type typing AND aria-label/aria-labelledby/aria-describedby.\n * Note: We omit 'type' because we use it for button variant, not HTML type attribute.\n * The HTML type is always set to 'button' internally.\n */\ntype NativeButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'disabled' | 'type' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-pressed'\n>;\n\nexport interface ButtonProps extends NativeButtonProps {\n /**\n * Type of the button. \n */\n type?: 'primary' | 'secondary' | 'ghost' | 'link' | 'unstyled';\n /**\n * Color pallet of the button\n */\n theme?: 'blue' | 'red' | 'yellow' | 'green' | 'ai' | 'white';\n /**\n * Size of the button\n */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Button contents\n */\n label: string | '';\n /**\n * Icon props\n */\n iconProps?: IconProps;\n /**\n * Icon position\n */\n iconPosition?: 'left' | 'right';\n /**\n * Disabled state\n */\n disabled?: boolean;\n /**\n * Loading state - will disable button and show spinner\n */\n loading?: boolean;\n /**\n * Custom label shown (both visually and announced to screen readers) when loading is true.\n * When omitted, the original label remains visible and SR announcement is \"${label}, loading\".\n */\n loadingLabel?: string;\n /**\n * Optional click handler (called for pointer/mouse activations)\n */\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Optional keyboard activation handler\n * Called when button is activated via keyboard (Enter/Space) or assistive technology virtual activation.\n * Use when you want to have different behavior for keyboard and pointer activations.\n * If not provided, onClick will be called for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Automation ID for testing\n */\n automationId?: string;\n /**\n * If true, button will be focused on mount.\n * For programmatic focus control, use ref with .focus() instead.\n */\n autoFocus?: boolean;\n /**\n * Accessible name for the button. Use when there's no visible label (e.g., icon-only buttons).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this button.\n * Preferred over ariaLabel when a visible label exists (keeps SR and visual text in sync).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this button.\n * Provides additional context announced after the accessible name.\n */\n ariaDescribedBy?: string;\n /**\n * When true, sets aria-pressed for toggle/pressed state \n */\n isPressed?: boolean;\n}\n\nconst focusClass = 'focus-outline';\nconst disabledClassNames: Map = {\n primary: 'primary-btn disabled-btn pointer-events-none cursor-not-allowed',\n secondary: 'secondary-btn disabled-btn pointer-events-none cursor-not-allowed',\n ghost: 'ghost-btn disabled-btn pointer-events-none cursor-not-allowed',\n link: 'link-btn w-fit disabled-btn pointer-events-none cursor-not-allowed',\n unstyled: 'unstyled-btn disabled-btn pointer-events-none cursor-not-allowed',\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\nconst classNames: Map = {\n primary: `primary-btn ${focusClass}`,\n secondary: `secondary-btn ${focusClass}`,\n ghost: `ghost-btn ${focusClass}`,\n link: `link-btn w-fit ${focusClass}`,\n unstyled: `unstyled-btn ${focusClass}`,\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\n\nconst colorPalletClassNames: Map = {\n blue: 'theme-blue',\n red: 'theme-red',\n yellow: 'theme-yellow',\n green: 'theme-green',\n ai: 'theme-ai',\n white: 'theme-white'\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n type = 'primary',\n theme = 'blue',\n size = 'md',\n label = '',\n iconPosition = 'left',\n disabled = false,\n loading = false,\n loadingLabel,\n className = '',\n iconProps = { name: '' },\n automationId = '',\n autoFocus = false,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n isPressed,\n onClick,\n onKeyboardActivate,\n onPointerDown,\n onMouseDown,\n onTouchStart,\n ...props\n },\n ref\n ) => {\n const isUnstyled = type === 'unstyled';\n const visibleLabel = loading && loadingLabel ? loadingLabel : label;\n const prevLoadingRef = useRef(loading);\n\n useEffect(() => {\n if (loading && !prevLoadingRef.current) {\n announce(loadingLabel || (label ? `${label}, loading` : 'Loading'), { delay: 300 });\n }\n prevLoadingRef.current = loading;\n }, [loading, label, loadingLabel]);\n\n // Use shared hook for activation handling (pointer vs keyboard/virtual click routing)\n const { pressProps, isDisabled } = useAccessiblePress({\n disabled,\n loading,\n isNative: true, // native <button> => hook does NOT add Enter/Space onKeyDown\n pressed: isPressed,\n onClick: onClick as (e: React.MouseEvent<HTMLElement>) => void,\n onKeyboardActivate: onKeyboardActivate as (e: React.MouseEvent<HTMLElement>) => void,\n onPointerDown: onPointerDown as (e: React.PointerEvent<HTMLElement>) => void,\n onMouseDown: onMouseDown as (e: React.MouseEvent<HTMLElement>) => void,\n onTouchStart: onTouchStart as (e: React.TouchEvent<HTMLElement>) => void\n });\n\n // Skip size/color classes for unstyled variant\n const sizeClassName = !isUnstyled && type !== 'link' ? classNames[size] : '';\n const colorPalletClassName = !isUnstyled ? colorPalletClassNames[theme] : '';\n const typeClassName = isDisabled ? disabledClassNames[type] : classNames[type];\n\n // Avoid mutating incoming iconProps\n const computedIconProps: IconProps | undefined = iconProps?.name\n ? {\n ...iconProps,\n stroke: isDisabled ? 'var(--color-gray-600)' : iconProps.stroke\n }\n : undefined;\n\n const buttonClassName = [\n 'se-design-button',\n colorPalletClassName,\n sizeClassName,\n typeClassName,\n className,\n !isUnstyled ? 'rounded-[6px] inline-flex gap-1 items-center min-w-fit' : ''\n ]\n .filter(Boolean)\n .join(' ');\n\n // Compute accessible name/description props with correct precedence\n const accessibleNameProps = getA11yNameAttributes({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy\n });\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={buttonClassName}\n disabled={isDisabled}\n autoFocus={autoFocus}\n data-automation-id={automationId}\n {...props}\n {...(pressProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n {...accessibleNameProps}\n >\n {loading && (\n <div\n aria-hidden=\"true\"\n className=\"animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full\"\n />\n )}\n {!loading && computedIconProps?.name && iconPosition === 'left' && (\n <Icon {...computedIconProps} />\n )}\n {visibleLabel && (\n <span className=\"button-label [font-weight:inherit]\">{visibleLabel}</span>\n )}\n {!loading && computedIconProps?.name && iconPosition === 'right' && (\n <Icon {...computedIconProps} />\n )}\n </button>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"names":["focusClass","disabledClassNames","primary","secondary","ghost","link","unstyled","sm","md","lg","classNames","colorPalletClassNames","blue","red","yellow","green","ai","white","Button","type","theme","size","label","iconPosition","disabled","loading","loadingLabel","className","iconProps","name","automationId","autoFocus","ariaLabel","ariaLabelledBy","ariaDescribedBy","isPressed","onClick","onKeyboardActivate","onPointerDown","onMouseDown","onTouchStart","props","ref","isUnstyled","visibleLabel","prevLoadingRef","useRef","useEffect","current","announce","delay","pressProps","isDisabled","useAccessiblePress","isNative","pressed","sizeClassName","colorPalletClassName","typeClassName","computedIconProps","stroke","undefined","buttonClassName","filter","Boolean","join","accessibleNameProps","getA11yNameAttributes","React","createElement","_extends","Icon","displayName"],"mappings":";;;;;;;;;;;;;;;;AAqGA,MAAMA,IAAa,iBACbC,IAA0B;AAAA,EAC9BC,SAAS;AAAA,EACTC,WAAW;AAAA,EACXC,OAAO;AAAA,EACPC,MAAM;AAAA,EACNC,UAAU;AAAA,EACVC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GACMC,IAAkB;AAAA,EACtBR,SAAS,eAAeF,CAAU;AAAA,EAClCG,WAAW,iBAAiBH,CAAU;AAAA,EACtCI,OAAO,aAAaJ,CAAU;AAAA,EAC9BK,MAAM,kBAAkBL,CAAU;AAAA,EAClCM,UAAU,gBAAgBN,CAAU;AAAA,EACpCO,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GAEME,IAA6B;AAAA,EACjCC,MAAM;AAAA,EACNC,KAAK;AAAA,EACLC,QAAQ;AAAA,EACRC,OAAO;AAAA,EACPC,IAAI;AAAA,EACJC,OAAO;AACT,GAEaC,sBACX,CACE;AAAA,EACEC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,cAAAA,IAAe;AAAA,EACfC,UAAAA,IAAW;AAAA,EACXC,SAAAA,IAAU;AAAA,EACVC,cAAAA;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0BxB,EAAUgC;AAAAA,EAAAA,IAE3DC,QAEEC,IAAkB,CACtB,oBACAL,GACAD,GACAE,GACA/B,GACCgB,IAAwE,KAA3D,wDAA6D,EAE1EoB,OAAOC,OAAO,EACdC,KAAK,GAAG,GAGLC,IAAsBC,EAAsB;AAAA,IAChDnC,WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,iBAAAA;AAAAA,EAAAA,CACD;AAED,SACEkC,gBAAAA,EAAAC,cAAA,UAAAC,EAAA;AAAA,IACE5B,KAAAA;AAAAA,IACAvB,MAAK;AAAA,IACLQ,WAAWmC;AAAAA,IACXtC,UAAU4B;AAAAA,IACVrB,WAAAA;AAAAA,IACA,sBAAoBD;AAAAA,EAAAA,GAChBW,GACCU,GACDe,CAAmB,GAEtBzC,KACC2C,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACE,eAAY;AAAA,IACZ1C,WAAU;AAAA,EAAA,CACX,GAEF,CAACF,KAAWkC,GAAmB9B,QAAQN,MAAiB,UACvD6C,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,GAE/Bf,KACCwB,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IAAM1C,WAAU;AAAA,EAAA,GAAsCiB,CAAmB,GAE1E,CAACnB,KAAWkC,GAAmB9B,QAAQN,MAAiB,WACvD6C,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,CAE1B;AAEV,CACF;AAEAzC,EAAOsD,cAAc;"}
|
package/dist/index40.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import a, { useState as d, useRef as $, useEffect as r, useMemo as D } from "react";
|
|
2
2
|
import { Icon as g } from "./index6.js";
|
|
3
3
|
import { LabelChip as F } from "./index11.js";
|
|
4
|
-
import { debounce as L } from "./
|
|
4
|
+
import { debounce as L } from "./index224.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
function z(p) {
|
|
7
7
|
const {
|