@economic/taco 0.0.27-alpha.0 → 0.0.29-alpha.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.
Files changed (53) hide show
  1. package/dist/components/Combobox/Combobox.d.ts +0 -3
  2. package/dist/components/Field/Field.d.ts +2 -5
  3. package/dist/components/Input/Input.d.ts +2 -5
  4. package/dist/components/Input/util.d.ts +1 -3
  5. package/dist/components/Listbox/Listbox.d.ts +3 -7
  6. package/dist/components/Listbox/ScrollableList.d.ts +2 -5
  7. package/dist/components/Listbox/useListbox.d.ts +1 -1
  8. package/dist/components/Menu/Menu.d.ts +3 -0
  9. package/dist/components/Select/Select.d.ts +1 -1
  10. package/dist/components/Textarea/Textarea.d.ts +2 -5
  11. package/dist/esm/components/Button/Button.js +3 -4
  12. package/dist/esm/components/Button/Button.js.map +1 -1
  13. package/dist/esm/components/Button/util.js +3 -2
  14. package/dist/esm/components/Button/util.js.map +1 -1
  15. package/dist/esm/components/Checkbox/Checkbox.js +1 -1
  16. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  17. package/dist/esm/components/Combobox/Combobox.js +10 -5
  18. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  19. package/dist/esm/components/Field/Field.js +6 -8
  20. package/dist/esm/components/Field/Field.js.map +1 -1
  21. package/dist/esm/components/Hanger/Hanger.js +14 -3
  22. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  23. package/dist/esm/components/IconButton/IconButton.js +3 -4
  24. package/dist/esm/components/IconButton/IconButton.js.map +1 -1
  25. package/dist/esm/components/Input/Input.js +3 -3
  26. package/dist/esm/components/Input/Input.js.map +1 -1
  27. package/dist/esm/components/Input/util.js +12 -39
  28. package/dist/esm/components/Input/util.js.map +1 -1
  29. package/dist/esm/components/Listbox/Listbox.js.map +1 -1
  30. package/dist/esm/components/Listbox/ScrollableList.js +12 -1
  31. package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
  32. package/dist/esm/components/Listbox/useListbox.js +3 -1
  33. package/dist/esm/components/Listbox/useListbox.js.map +1 -1
  34. package/dist/esm/components/Menu/Menu.js +4 -3
  35. package/dist/esm/components/Menu/Menu.js.map +1 -1
  36. package/dist/esm/components/SearchInput/SearchInput.js +1 -1
  37. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  38. package/dist/esm/components/Select/Select.js +2 -1
  39. package/dist/esm/components/Select/Select.js.map +1 -1
  40. package/dist/esm/components/Select/useSelect.js +6 -1
  41. package/dist/esm/components/Select/useSelect.js.map +1 -1
  42. package/dist/esm/components/Table/components/BaseTable.js +1 -1
  43. package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
  44. package/dist/esm/components/Textarea/Textarea.js +1 -1
  45. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  46. package/dist/esm/index.css +21 -1
  47. package/dist/index.css +21 -1
  48. package/dist/taco.cjs.development.js +83 -77
  49. package/dist/taco.cjs.development.js.map +1 -1
  50. package/dist/taco.cjs.production.min.js +1 -1
  51. package/dist/taco.cjs.production.min.js.map +1 -1
  52. package/package.json +17 -17
  53. package/types.json +363 -362
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Icon } from '../Icon/Icon';\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\nimport { useBoundingClientRectListener } from '../../utils/hooks/useBoundingClientRectListener';\nimport { useSelect } from './useSelect';\nimport { Combobox, ComboboxProps } from '../Combobox/Combobox';\nimport { Badge } from '../Badge/Badge';\nimport { getInputClasses } from '../Input/util';\n\nexport type SelectTexts = {\n /**\n * The text displayed when all options are selected when multiselect mode in on.\n */\n allOptionsSelected: string;\n};\n\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\n Omit<ComboboxProps, 'inline'> & {\n /**\n * Allows to select multiple values.\n * All the selected values will be combined in a comma-seperated string as the value of the input.\n */\n multiselect?: boolean;\n };\n\nexport type SelectProps = BaseSelectProps & {\n /**\n * Creates an editable select.\n * Setting this will render a inline Combobox which will display the provided data on click/focus,\n * even if there is no value in the input.\n * After user starts typing, matching data will be displayed.\n */\n editable?: boolean;\n};\n\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\n const internalRef = React.useRef<HTMLButtonElement>(null);\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\n const inputClassname = cn(getInputClasses(props), 'text-left pr-0', {\n 'border-blue': popover.open,\n });\n\n React.useEffect(() => {\n if (autoFocus && internalRef.current) {\n internalRef.current.focus();\n }\n }, []);\n\n const renderMultiSelection = (): React.ReactNode => {\n return (\n <>\n <span className=\"flex-grow truncate text-left\">{text}</span>\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\n </>\n );\n };\n\n const commonListboxProps = {\n ...listbox,\n className: 'w-auto',\n style: { minWidth: selectDimensions?.width },\n tabIndex: popover.open ? 0 : -1,\n };\n\n return (\n <span className={className} data-taco=\"select\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\n <span className=\"flex h-8 w-8 items-center justify-center\">\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\n </PopoverPrimitive.Content>\n <input {...input} className=\"hidden\" type=\"text\" />\n </PopoverPrimitive.Root>\n </span>\n );\n});\n\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\n const { editable, ...otherProps } = props;\n\n if (editable) {\n return <Combobox {...otherProps} dialog={undefined} inline ref={ref} />;\n }\n\n return <BaseSelect {...otherProps} ref={ref} />;\n});\n"],"names":["BaseSelect","React","props","ref","autoFocus","externalClassName","className","style","otherProps","useSelect","button","listbox","popover","input","text","more","internalRef","selectDimensions","useBoundingClientRectListener","cn","readOnly","inputClassname","getInputClasses","open","current","focus","renderMultiSelection","Badge","commonListboxProps","minWidth","width","tabIndex","PopoverPrimitive","multiselect","Icon","name","align","sideOffset","MultiListbox","Listbox","type","Select","editable","Combobox","dialog","undefined","inline"],"mappings":";;;;;;;;;;;;;;AAqCA,IAAMA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;AAChC,MAAQC,SAAR,GAAuFF,KAAvF,CAAQE,SAAR;AAAA,MAA8BC,iBAA9B,GAAuFH,KAAvF,CAAmBI,SAAnB;AAAA,MAA8DC,KAA9D,GAAuFL,KAAvF,CAA8DK,KAA9D;AAAA,MAAwEC,UAAxE,iCAAuFN,KAAvF;;AACA,mBAA4DO,SAAS,CAACD,UAAD,EAAaL,GAAb,CAArE;AAAA,MAAQO,MAAR,cAAQA,MAAR;AAAA,MAAgBC,OAAhB,cAAgBA,OAAhB;AAAA,MAAyBC,OAAzB,cAAyBA,OAAzB;AAAA,MAAkCC,KAAlC,cAAkCA,KAAlC;AAAA,MAAyCC,IAAzC,cAAyCA,IAAzC;AAAA,mCAA+CC,IAA/C;AAAA,MAA+CA,IAA/C,gCAAsD,CAAtD;;AACA,MAAMC,WAAW,GAAGf,MAAA,CAAgC,IAAhC,CAApB;AACA,MAAMgB,gBAAgB,GAAGC,6BAA6B,CAACF,WAAD,CAAtD;AACA,MAAMV,SAAS,GAAGa,EAAE,CAAC,6BAAD,EAAgC;AAAE,2BAAuBjB,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A,SAAS,EAAC;GAAhB,EAAgDQ,IAAhD,CADlD,EAEIb,aAAA,OAAA;AAAMK,IAAAA,SAAS,EAAC;GAAhB,EACIL,aAAA,CAACiC,IAAD;AAAM5B,IAAAA,SAAS,EAAC;AAAsB6B,IAAAA,IAAI,EAAEvB,OAAO,CAACW,IAAR,GAAe,YAAf,GAA8B;GAA1E,CADJ,CAFJ,CADJ,EAOItB,aAAA,CAAC+B,OAAD;AAA0BI,IAAAA,KAAK,EAAC;AAAQC,IAAAA,UAAU,EAAE;GAApD,EACKnC,KAAK,CAAC+B,WAAN,GAAoBhC,aAAA,CAACqC,YAAD,oBAAkBV,mBAAlB,CAApB,GAA+D3B,aAAA,CAACsC,OAAD,oBAAaX,mBAAb,CADpE,CAPJ,EAUI3B,aAAA,QAAA,oBAAWY;AAAOP,IAAAA,SAAS,EAAC;AAASkC,IAAAA,IAAI,EAAC;IAA1C,CAVJ,CADJ,CADJ;AAgBH,CAhDkB,CAAnB;IAkDaC,MAAM,gBAAGxC,UAAA,CAAiB,SAASwC,MAAT,CAAgBvC,KAAhB,EAAoCC,GAApC;AACnC,MAAQuC,QAAR,GAAoCxC,KAApC,CAAQwC,QAAR;AAAA,MAAqBlC,UAArB,iCAAoCN,KAApC;;AAEA,MAAIwC,QAAJ,EAAc;AACV,WAAOzC,aAAA,CAAC0C,QAAD,oBAAcnC;AAAYoC,MAAAA,MAAM,EAAEC;AAAWC,MAAAA,MAAM;AAAC3C,MAAAA,GAAG,EAAEA;MAAzD,CAAP;AACH;;AAED,SAAOF,aAAA,CAACD,UAAD,oBAAgBQ;AAAYL,IAAAA,GAAG,EAAEA;IAAjC,CAAP;AACH,CARqB;;;;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Icon } from '../Icon/Icon';\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\nimport { useBoundingClientRectListener } from '../../utils/hooks/useBoundingClientRectListener';\nimport { useSelect } from './useSelect';\nimport { Combobox, ComboboxProps } from '../Combobox/Combobox';\nimport { Badge } from '../Badge/Badge';\nimport { getInputClasses } from '../Input/util';\n\nexport type SelectTexts = {\n /**\n * The text displayed when all options are selected when multiselect mode in on.\n */\n allOptionsSelected: string;\n};\n\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\n Omit<ComboboxProps, 'inline'> & {\n /**\n * Allows to select multiple values.\n * All the selected values will be combined in a comma-seperated string as the value of the input.\n */\n multiselect?: boolean;\n };\n\nexport type SelectProps = BaseSelectProps & {\n /**\n * Creates an editable select.\n * Setting this will render a inline Combobox which will display the provided data on click/focus,\n * even if there is no value in the input.\n * After user starts typing, matching data will be displayed.\n */\n editable?: boolean;\n};\n\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\n const internalRef = React.useRef<HTMLButtonElement>(null);\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\n const inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {\n 'border-blue': popover.open,\n });\n\n React.useEffect(() => {\n if (autoFocus && internalRef.current) {\n internalRef.current.focus();\n }\n }, []);\n\n const renderMultiSelection = (): React.ReactNode => {\n return (\n <>\n <span className=\"flex-grow truncate text-left\">{text}</span>\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\n </>\n );\n };\n\n const commonListboxProps = {\n ...listbox,\n className: 'w-auto',\n invalid: undefined,\n style: { minWidth: selectDimensions?.width },\n tabIndex: popover.open ? 0 : -1,\n };\n\n return (\n <span className={className} data-taco=\"select\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\n <span className=\"flex h-8 w-8 items-center justify-center\">\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\n </PopoverPrimitive.Content>\n <input {...input} className=\"hidden\" type=\"text\" />\n </PopoverPrimitive.Root>\n </span>\n );\n});\n\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\n const { editable, ...otherProps } = props;\n\n if (editable) {\n return <Combobox {...otherProps} dialog={undefined} inline ref={ref} />;\n }\n\n return <BaseSelect {...otherProps} ref={ref} />;\n});\n"],"names":["BaseSelect","React","props","ref","autoFocus","externalClassName","className","style","otherProps","useSelect","button","listbox","popover","input","text","more","internalRef","selectDimensions","useBoundingClientRectListener","cn","readOnly","inputClassname","getInputClasses","open","current","focus","renderMultiSelection","Badge","commonListboxProps","invalid","undefined","minWidth","width","tabIndex","PopoverPrimitive","multiselect","Icon","name","align","sideOffset","MultiListbox","Listbox","type","Select","editable","Combobox","dialog","inline"],"mappings":";;;;;;;;;;;;;;AAqCA,IAAMA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;AAChC,MAAQC,SAAR,GAAuFF,KAAvF,CAAQE,SAAR;AAAA,MAA8BC,iBAA9B,GAAuFH,KAAvF,CAAmBI,SAAnB;AAAA,MAA8DC,KAA9D,GAAuFL,KAAvF,CAA8DK,KAA9D;AAAA,MAAwEC,UAAxE,iCAAuFN,KAAvF;;AACA,mBAA4DO,SAAS,CAACD,UAAD,EAAaL,GAAb,CAArE;AAAA,MAAQO,MAAR,cAAQA,MAAR;AAAA,MAAgBC,OAAhB,cAAgBA,OAAhB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sC,MAAAA,MAAM,EAAEhB;AAAWiB,MAAAA,MAAM;AAAC5C,MAAAA,GAAG,EAAEA;MAAzD,CAAP;AACH;;AAED,SAAOF,aAAA,CAACD,UAAD,oBAAgBQ;AAAYL,IAAAA,GAAG,EAAEA;IAAjC,CAAP;AACH,CARqB;;;;"}
@@ -53,7 +53,12 @@ var useSelect = function useSelect(_ref, ref) {
53
53
  }
54
54
  }, [defaultValue]);
55
55
  useEffect(function () {
56
- if (value !== undefined) {
56
+ // If emptyValue is defined, then set emptyValue
57
+ if (emptyValue !== undefined && value === emptyValue) {
58
+ setInputValueByRef(internalInputRef.current, value);
59
+ } else if (value !== undefined && data.some(function (option) {
60
+ return option.value === value;
61
+ })) {
57
62
  setInputValueByRef(internalInputRef.current, value);
58
63
  } else if (data.length && defaultValue === undefined) {
59
64
  setInputValueByRef(internalInputRef.current, data[0].value);
@@ -1 +1 @@
1
- {"version":3,"file":"useSelect.js","sources":["../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport cn from 'classnames';\nimport { v4 as uuid } from 'uuid';\nimport { useLocalization } from '../Provider/Provider';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: React.ButtonHTMLAttributes<HTMLButtonElement>;\n listbox: ListboxProps;\n input: any;\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onClick,\n onChange,\n readOnly,\n value = emptyValue,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const searchData = useFlattenedData(data);\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const internalInputRef = React.useRef(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (defaultValue !== undefined && value === undefined) {\n setInputValueByRef(internalInputRef.current, defaultValue);\n }\n }, [defaultValue]);\n\n React.useEffect(() => {\n if (value !== undefined) {\n setInputValueByRef(internalInputRef.current, value);\n } else if (data.length && defaultValue === undefined) {\n setInputValueByRef(internalInputRef.current, data[0].value);\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.keyCode) {\n case keycode('escape'): {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(inputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case keycode('tab'):\n case keycode('enter'): {\n if (event.keyCode !== keycode('tab')) {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === searchData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(searchData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(searchData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(searchData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(searchData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const button: React.ButtonHTMLAttributes<HTMLButtonElement> = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n disabled,\n id: buttonId,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n type: 'button',\n };\n\n const listbox = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(internalInputRef.current, event.target?.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: inputRef,\n value,\n multiselect,\n };\n\n const input = {\n onChange: handleInputChange,\n ref: internalInputRef,\n value: value ?? '',\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: setOpen,\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","ref","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","nativeId","id","multiselect","onChange","readOnly","value","otherProps","useLocalization","texts","searchData","useFlattenedData","inputRef","useProxiedRef","React","open","setOpen","uuid","internalInputRef","buttonId","lastValue","setLastValue","undefined","setInputValueByRef","current","length","handleButtonKeyDown","event","keyCode","keycode","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","findByValue","icon","className","cn","props","handleInputChange","persist","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","button","type","listbox","onClick","input","popover","onOpenChange"],"mappings":";;;;;;;;;;IAoBaA,SAAS,GAAG,SAAZA,SAAY,OAgBrBC,GAhBqB;MAEHC,iBAAd;MACmBC,sBAAnB;uBACAC;MAAAA,8BAAO;MACPC,oBAAAA;MACAC,gBAAAA;MACAC,kBAAAA;MACIC,gBAAJC;MACAC,mBAAAA;MAEAC,gBAAAA;MACAC,gBAAAA;wBACAC;MAAAA,gCAAQN;MACLO;;AAIP,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AACA,MAAMC,UAAU,GAAGC,gBAAgB,CAACd,IAAD,CAAnC;AACA,MAAMe,QAAQ,GAAGC,aAAa,CAAmBnB,GAAnB,CAA9B;;AACA,wBAAwBoB,QAAA,CAAe,KAAf,CAAxB;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACA,MAAMd,EAAE,GAAGY,OAAA,CAAc;AAAA,WAAMb,QAAQ,gBAAcgB,EAAI,EAAhC;AAAA,GAAd,EAAoD,CAAChB,QAAD,CAApD,CAAX;AACA,MAAMiB,gBAAgB,GAAGJ,MAAA,CAAa,IAAb,CAAzB;AACA,MAAMK,QAAQ,GAAMjB,EAAN,YAAd;;AAEA,yBAAkCY,QAAA,CAAoDR,KAApD,CAAlC;AAAA,MAAOc,SAAP;AAAA,MAAkBC,YAAlB;;AAEAP,EAAAA,SAAA,CAAgB;AACZO,IAAAA,YAAY,CAACf,KAAD,CAAZ;AACH,GAFD,EAE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B,gBAFK;AAGVZ,IAAAA,KAAK,EAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW;AAHN,GAAd;AAMA,SAAO;AACHwD,IAAAA,MAAM,EAANA,MADG;AAEHE,IAAAA,OAAO,EAAPA,OAFG;AAGHE,IAAAA,KAAK,EAALA,KAHG;AAIHC,IAAAA,OAAO,EAAE;AACLpD,MAAAA,IAAI,EAAJA,IADK;AAELqD,MAAAA,YAAY,EAAEpD;AAFT,KAJN;AAQHkB,IAAAA,IAAI,EAAJA,IARG;AASHC,IAAAA,IAAI,EAAJA;AATG,GAAP;AAWH;;;;"}
1
+ {"version":3,"file":"useSelect.js","sources":["../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport cn from 'classnames';\nimport { v4 as uuid } from 'uuid';\nimport { useLocalization } from '../Provider/Provider';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: React.ButtonHTMLAttributes<HTMLButtonElement>;\n listbox: ListboxProps;\n input: any;\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onClick,\n onChange,\n readOnly,\n value = emptyValue,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const searchData = useFlattenedData(data);\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const internalInputRef = React.useRef(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (defaultValue !== undefined && value === undefined) {\n setInputValueByRef(internalInputRef.current, defaultValue);\n }\n }, [defaultValue]);\n\n React.useEffect(() => {\n // If emptyValue is defined, then set emptyValue\n if (emptyValue !== undefined && value === emptyValue) {\n setInputValueByRef(internalInputRef.current, value);\n } else if (value !== undefined && data.some(option => option.value === value)) {\n setInputValueByRef(internalInputRef.current, value);\n } else if (data.length && defaultValue === undefined) {\n setInputValueByRef(internalInputRef.current, data[0].value);\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.keyCode) {\n case keycode('escape'): {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(inputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case keycode('tab'):\n case keycode('enter'): {\n if (event.keyCode !== keycode('tab')) {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === searchData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(searchData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(searchData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(searchData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(searchData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const button: React.ButtonHTMLAttributes<HTMLButtonElement> = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n disabled,\n id: buttonId,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n type: 'button',\n };\n\n const listbox = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(internalInputRef.current, event.target?.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: inputRef,\n value,\n multiselect,\n };\n\n const input = {\n onChange: handleInputChange,\n ref: internalInputRef,\n value: value ?? '',\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: setOpen,\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","ref","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","nativeId","id","multiselect","onChange","readOnly","value","otherProps","useLocalization","texts","searchData","useFlattenedData","inputRef","useProxiedRef","React","open","setOpen","uuid","internalInputRef","buttonId","lastValue","setLastValue","undefined","setInputValueByRef","current","some","option","length","handleButtonKeyDown","event","keyCode","keycode","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","findByValue","icon","className","cn","props","handleInputChange","persist","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","button","type","listbox","onClick","input","popover","onOpenChange"],"mappings":";;;;;;;;;;IAoBaA,SAAS,GAAG,SAAZA,SAAY,OAgBrBC,GAhBqB;MAEHC,iBAAd;MACmBC,sBAAnB;uBACAC;MAAAA,8BAAO;MACPC,oBAAAA;MACAC,gBAAAA;MACAC,kBAAAA;MACIC,gBAAJC;MACAC,mBAAAA;MAEAC,gBAAAA;MACAC,gBAAAA;wBACAC;MAAAA,gCAAQN;MACLO;;AAIP,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AACA,MAAMC,UAAU,GAAGC,gBAAgB,CAACd,IAAD,CAAnC;AACA,MAAMe,QAAQ,GAAGC,aAAa,CAAmBnB,GAAnB,CAA9B;;AACA,wBAAwBoB,QAAA,CAAe,KAAf,CAAxB;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACA,MAAMd,EAAE,GAAGY,OAAA,CAAc;AAAA,WAAMb,QAAQ,gBAAcgB,EAAI,EAAhC;AAAA,GAAd,EAAoD,CAAChB,QAAD,CAApD,CAAX;AACA,MAAMiB,gBAAgB,GAAGJ,MAAA,CAAa,IAAb,CAAzB;AACA,MAAMK,QAAQ,GAAMjB,EAAN,YAAd;;AAEA,yBAAkCY,QAAA,CAAoDR,KAApD,CAAlC;AAAA,MAAOc,SAAP;AAAA,MAAkBC,YAAlB;;AAEAP,EAAAA,SAAA,CAAgB;AACZO,IAAAA,YAAY,CAACf,KAAD,CAAZ;AACH,GAFD,EAEG,CAACS,IAAD,CAFH;AAIAD,EAAAA,SAAA,CAAgB;AACZ,QAAIhB,YAAY,KA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AED,oBAXF;AAYTvC,IAAAA,GAAG,EAAEkB,QAZI;AAaTN,IAAAA,KAAK,EAALA,KAbS;AAcTH,IAAAA,WAAW,EAAXA;AAdS,IAAb;;AAiBA,MAAMiE,KAAK,GAAG;AACVhE,IAAAA,QAAQ,EAAE8C,iBADA;AAEVxD,IAAAA,GAAG,EAAEwB,gBAFK;AAGVZ,IAAAA,KAAK,EAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW;AAHN,GAAd;AAMA,SAAO;AACH0D,IAAAA,MAAM,EAANA,MADG;AAEHE,IAAAA,OAAO,EAAPA,OAFG;AAGHE,IAAAA,KAAK,EAALA,KAHG;AAIHC,IAAAA,OAAO,EAAE;AACLtD,MAAAA,IAAI,EAAJA,IADK;AAELuD,MAAAA,YAAY,EAAEtD;AAFT,KAJN;AAQHoB,IAAAA,IAAI,EAAJA,IARG;AASHC,IAAAA,IAAI,EAAJA;AATG,GAAP;AAWH;;;;"}
@@ -36,7 +36,7 @@ var BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(props,
36
36
  return React__default.createElement("div", {
37
37
  key: index,
38
38
  role: "row",
39
- className: "border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-b border-t-0 border-b-2 font-bold"
39
+ className: "border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-t-0 border-b-2 font-bold"
40
40
  }, headerGroup.headers.map(function (cell, index) {
41
41
  return React__default.createElement(Column, {
42
42
  key: index,
@@ -1 +1 @@
1
- {"version":3,"file":"BaseTable.js","sources":["../../../../../src/components/Table/components/BaseTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { HeaderGroup } from 'react-table';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { InternalBaseTable } from '../types';\nimport './Table.css';\nimport { Column } from '../util/renderColumn';\n\nexport const DefaultEmptyState = (): React.ReactNode => null;\n\nexport const BaseTable = React.forwardRef(function BaseTable(props: InternalBaseTable, ref: React.Ref<HTMLDivElement>) {\n const tableRef = useProxiedRef<HTMLDivElement>(ref);\n const { autoFocus, children, disableSorting: _, headerGroups, headerRef, bodyRef, ...otherProps } = props;\n\n React.useEffect(() => {\n if (autoFocus && tableRef.current) {\n tableRef.current.focus();\n }\n }, []);\n\n const className = cn('yt-table flex flex-col focus:yt-focus focus:rounded-sm', props.className);\n\n return (\n <div {...otherProps} role=\"table\" className={className} ref={tableRef}>\n <div role=\"rowgroup\" className=\"yt-table__head\" ref={headerRef}>\n {headerGroups?.map((headerGroup: HeaderGroup<object>, index: number) => (\n <div\n key={index}\n role=\"row\"\n className=\"border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-b border-t-0 border-b-2 font-bold\"\n >\n {headerGroup.headers.map((cell: any, index: number) => (\n <Column key={index} index={index} cell={cell} />\n ))}\n </div>\n ))}\n </div>\n\n <div role=\"rowgroup\" className=\"yt-table__body\" ref={bodyRef}>\n {children}\n </div>\n </div>\n );\n});\n"],"names":["DefaultEmptyState","BaseTable","React","forwardRef","props","ref","tableRef","useProxiedRef","autoFocus","children","headerGroups","headerRef","bodyRef","otherProps","useEffect","current","focus","className","cn","role","map","headerGroup","index","key","headers","cell","Column"],"mappings":";;;;;;;IAQaA,iBAAiB,GAAG,SAApBA,iBAAoB;AAAA,SAAuB,IAAvB;AAAA;IAEpBC,SAAS,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,SAAT,CAAmBG,KAAnB,EAA6CC,GAA7C;AACtC,MAAMC,QAAQ,GAAGC,aAAa,CAAiBF,GAAjB,CAA9B;;AACA,MAAQG,SAAR,GAAoGJ,KAApG,CAAQI,SAAR;AAAA,MAAmBC,QAAnB,GAAoGL,KAApG,CAAmBK,QAAnB;AAAA,MAAgDC,YAAhD,GAAoGN,KAApG,CAAgDM,YAAhD;AAAA,MAA8DC,SAA9D,GAAoGP,KAApG,CAA8DO,SAA9D;AAAA,MAAyEC,OAAzE,GAAoGR,KAApG,CAAyEQ,OAAzE;AAAA,MAAqFC,UAArF,iCAAoGT,KAApG;;AAEAF,EAAAA,cAAK,CAACY,SAAN,CAAgB;AACZ,QAAIN,SAAS,IAAIF,QAAQ,CAACS,OAA1B,EAAmC;AAC/BT,MAAAA,QAAQ,CAACS,OAAT,CAAiBC,KAAjB;AACH;AACJ,GAJD,EAIG,EAJH;AAMA,MAAMC,SAAS,GAAGC,EAAE,CAAC,wDAAD,EAA2Dd,KAAK,CAACa,SAAjE,CAApB;AAEA,SACIf,4BAAA,MAAA,oBAASW;AAAYM,IAAAA,IAAI,EAAC;AAAQF,IAAAA,SAAS,EAAEA;AAAWZ,IAAAA,GAAG,EAAEC;IAA7D,EACIJ,4BAAA,MAAA;AAAKiB,IAAAA,IAAI,EAAC;AAAWF,IAAAA,SAAS,EAAC;AAAiBZ,IAAAA,GAAG,EAAEM;GAArD,EACKD,YADL,aACKA,YADL,uBACKA,YAAY,CAAEU,GAAd,CAAkB,UAACC,WAAD,EAAmCC,KAAnC;AAAA,WACfpB,4BAAA,MAAA;AACIqB,MAAAA,GAAG,EAAED;AACLH,MAAAA,IAAI,EAAC;AACLF,MAAAA,SAAS,EAAC;KAHd,EAKKI,WAAW,CAACG,OAAZ,CAAoBJ,GAApB,CAAwB,UAACK,IAAD,EAAYH,KAAZ;AAAA,aACrBpB,4BAAA,CAACwB,MAAD;AAAQH,QAAAA,GAAG,EAAED;AAAOA,QAAAA,KAAK,EAAEA;AAAOG,QAAAA,IAAI,EAAEA;OAAxC,CADqB;AAAA,KAAxB,CALL,CADe;AAAA,GAAlB,CADL,CADJ,EAeIvB,4BAAA,MAAA;AAAKiB,IAAAA,IAAI,EAAC;AAAWF,IAAAA,SAAS,EAAC;AAAiBZ,IAAAA,GAAG,EAAEO;GAArD,EACKH,QADL,CAfJ,CADJ;AAqBH,CAjCwB;;;;"}
1
+ {"version":3,"file":"BaseTable.js","sources":["../../../../../src/components/Table/components/BaseTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { HeaderGroup } from 'react-table';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { InternalBaseTable } from '../types';\nimport './Table.css';\nimport { Column } from '../util/renderColumn';\n\nexport const DefaultEmptyState = (): React.ReactNode => null;\n\nexport const BaseTable = React.forwardRef(function BaseTable(props: InternalBaseTable, ref: React.Ref<HTMLDivElement>) {\n const tableRef = useProxiedRef<HTMLDivElement>(ref);\n const { autoFocus, children, disableSorting: _, headerGroups, headerRef, bodyRef, ...otherProps } = props;\n\n React.useEffect(() => {\n if (autoFocus && tableRef.current) {\n tableRef.current.focus();\n }\n }, []);\n\n const className = cn('yt-table flex flex-col focus:yt-focus focus:rounded-sm', props.className);\n\n return (\n <div {...otherProps} role=\"table\" className={className} ref={tableRef}>\n <div role=\"rowgroup\" className=\"yt-table__head\" ref={headerRef}>\n {headerGroups?.map((headerGroup: HeaderGroup<object>, index: number) => (\n <div\n key={index}\n role=\"row\"\n className=\"border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-t-0 border-b-2 font-bold\"\n >\n {headerGroup.headers.map((cell: any, index: number) => (\n <Column key={index} index={index} cell={cell} />\n ))}\n </div>\n ))}\n </div>\n\n <div role=\"rowgroup\" className=\"yt-table__body\" ref={bodyRef}>\n {children}\n </div>\n </div>\n );\n});\n"],"names":["DefaultEmptyState","BaseTable","React","forwardRef","props","ref","tableRef","useProxiedRef","autoFocus","children","headerGroups","headerRef","bodyRef","otherProps","useEffect","current","focus","className","cn","role","map","headerGroup","index","key","headers","cell","Column"],"mappings":";;;;;;;IAQaA,iBAAiB,GAAG,SAApBA,iBAAoB;AAAA,SAAuB,IAAvB;AAAA;IAEpBC,SAAS,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,SAAT,CAAmBG,KAAnB,EAA6CC,GAA7C;AACtC,MAAMC,QAAQ,GAAGC,aAAa,CAAiBF,GAAjB,CAA9B;;AACA,MAAQG,SAAR,GAAoGJ,KAApG,CAAQI,SAAR;AAAA,MAAmBC,QAAnB,GAAoGL,KAApG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AA,GAAG,EAAEO;GAArD,EACKH,QADL,CAfJ,CADJ;AAqBH,CAjCwB;;;;"}
@@ -3,7 +3,7 @@ import { forwardRef, createElement } from 'react';
3
3
  import cn from 'classnames';
4
4
  import { getInputClasses } from '../Input/util.js';
5
5
 
6
- var _excluded = ["defaultValue", "highlighted", "onKeyDown", "state"];
6
+ var _excluded = ["defaultValue", "highlighted", "invalid", "onKeyDown"];
7
7
  var Textarea = /*#__PURE__*/forwardRef(function Textarea(props, ref) {
8
8
  var onKeyDown = props.onKeyDown,
9
9
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { State } from '../../types';\nimport { getInputClasses } from '../Input/util';\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\n /** Draws attention to the textarea by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** State will change the style of the textarea **/\n state?: State;\n /** Value of the textarea */\n value?: string;\n};\n\nexport const Textarea = React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\n const { defaultValue: _, highlighted, onKeyDown, state, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\n});\n"],"names":["Textarea","React","props","ref","onKeyDown","otherProps","classNames","cn","getInputClasses","className","handleKeyDown","event","key","preventDefault","position","currentTarget","value","length","setSelectionRange","scrollTop","scrollHeight"],"mappings":";;;;;;IAcaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;AACrC,MAAsCC,SAAtC,GAA0EF,KAA1E,CAAsCE,SAAtC;AAAA,MAA2DC,UAA3D,iCAA0EH,KAA1E;;AACA,MAAMI,UAAU,GAAGC,EAAE,CAACC,eAAe,CAACN,KAAD,CAAhB,EAAyB,wCAAzB,EAAmEA,KAAK,CAACO,SAAzE,CAArB;AAGA;AACA;;AACA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;AAClB,QAAIA,KAAK,CAACC,GAAN,KAAc,MAAd,IAAwBD,KAAK,CAACC,GAAN,KAAc,KAA1C,EAAiD;AAC7CD,MAAAA,KAAK,CAACE,cAAN;AACA,UAAMC,QAAQ,GAAGH,KAAK,CAACC,GAAN,KAAc,KAAd,GAAsBD,KAAK,CAACI,aAAN,CAAoBC,KAApB,CAA0BC,MAAhD,GAAyD,CAA1E;AACAN,MAAAA,KAAK,CAACI,aAAN,CAAoBG,iBAApB,CAAsCJ,QAAtC,EAAgDA,QAAhD;AACAH,MAAAA,KAAK,CAACI,aAAN,CAAoBI,SAApB,GAAgCR,KAAK,CAACC,GAAN,KAAc,KAAd,GAAsBD,KAAK,CAACI,aAAN,CAAoBK,YAA1C,GAAyD,CAAzF;AACH;;AAED,QAAIhB,SAAJ,EAAe;AACXA,MAAAA,SAAS,CAACO,KAAD,CAAT;AACH;AACJ,GAXD;;AAaA,SAAOV,aAAA,WAAA,oBAAcI;AAAYI,IAAAA,SAAS,EAAEH;iBAAsB;AAAWF,IAAAA,SAAS,EAAEM;AAAeP,IAAAA,GAAG,EAAEA;IAArG,CAAP;AACH,CArBuB;;;;"}
1
+ {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { getInputClasses } from '../Input/util';\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\n /** Draws attention to the textarea by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /** Value of the textarea */\n value?: string;\n};\n\nexport const Textarea = React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\n const { defaultValue: _, highlighted, invalid, onKeyDown, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\n});\n"],"names":["Textarea","React","props","ref","onKeyDown","otherProps","classNames","cn","getInputClasses","className","handleKeyDown","event","key","preventDefault","position","currentTarget","value","length","setSelectionRange","scrollTop","scrollHeight"],"mappings":";;;;;;IAaaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;AACrC,MAA+CC,SAA/C,GAA4EF,KAA5E,CAA+CE,SAA/C;AAAA,MAA6DC,UAA7D,iCAA4EH,KAA5E;;AACA,MAAMI,UAAU,GAAGC,EAAE,CAACC,eAAe,CAACN,KAAD,CAAhB,EAAyB,wCAAzB,EAAmEA,KAAK,CAACO,SAAzE,CAArB;AAGA;AACA;;AACA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;AAClB,QAAIA,KAAK,CAACC,GAAN,KAAc,MAAd,IAAwBD,KAAK,CAACC,GAAN,KAAc,KAA1C,EAAiD;AAC7CD,MAAAA,KAAK,CAACE,cAAN;AACA,UAAMC,QAAQ,GAAGH,KAAK,CAACC,GAAN,KAAc,KAAd,GAAsBD,KAAK,CAACI,aAAN,CAAoBC,KAApB,CAA0BC,MAAhD,GAAyD,CAA1E;AACAN,MAAAA,KAAK,CAACI,aAAN,CAAoBG,iBAApB,CAAsCJ,QAAtC,EAAgDA,QAAhD;AACAH,MAAAA,KAAK,CAACI,aAAN,CAAoBI,SAApB,GAAgCR,KAAK,CAACC,GAAN,KAAc,KAAd,GAAsBD,KAAK,CAACI,aAAN,CAAoBK,YAA1C,GAAyD,CAAzF;AACH;;AAED,QAAIhB,SAAJ,EAAe;AACXA,MAAAA,SAAS,CAACO,KAAD,CAAT;AACH;AACJ,GAXD;;AAaA,SAAOV,aAAA,WAAA,oBAAcI;AAAYI,IAAAA,SAAS,EAAEH;iBAAsB;AAAWF,IAAAA,SAAS,EAAEM;AAAeP,IAAAA,GAAG,EAAEA;IAArG,CAAP;AACH,CArBuB;;;;"}
@@ -136,7 +136,27 @@
136
136
  -webkit-appearance: none;
137
137
  }
138
138
 
139
- [data-radix-portal][aria-hidden] [data-taco='menu'] {
139
+ table.yt-table {
140
+ @apply focus:yt-focus flex flex-col focus:rounded-sm;
141
+ }
142
+ table.yt-table thead.yt-table__head tr.yt-table__row {
143
+ @apply border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-t-0 border-b-2 font-bold;
144
+ }
145
+
146
+ table.yt-table thead.yt-table__head tr.yt-table__row th.yt-table__cell {
147
+ @apply text-grey-darkest flex flex-1 justify-center truncate p-2 text-center align-middle hover:text-black;
148
+ }
149
+
150
+ table.yt-table tbody.yt-table__body tr.yt-table__row {
151
+ @apply border-grey-light hover:bg-grey-light flex min-h-[2.5rem] border-b;
152
+ }
153
+
154
+ table.yt-table tbody.yt-table__body tr.yt-table__row td.yt-table__cell {
155
+ @apply flex-1 truncate p-2 text-center align-middle;
156
+ }
157
+
158
+ [data-radix-portal][aria-hidden] [data-taco='menu'],
159
+ [data-radix-portal][aria-hidden] [data-taco='hanger'] {
140
160
  display: none;
141
161
  opacity: 0;
142
162
  }
package/dist/index.css CHANGED
@@ -136,7 +136,27 @@
136
136
  -webkit-appearance: none;
137
137
  }
138
138
 
139
- [data-radix-portal][aria-hidden] [data-taco='menu'] {
139
+ table.yt-table {
140
+ @apply focus:yt-focus flex flex-col focus:rounded-sm;
141
+ }
142
+ table.yt-table thead.yt-table__head tr.yt-table__row {
143
+ @apply border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-t-0 border-b-2 font-bold;
144
+ }
145
+
146
+ table.yt-table thead.yt-table__head tr.yt-table__row th.yt-table__cell {
147
+ @apply text-grey-darkest flex flex-1 justify-center truncate p-2 text-center align-middle hover:text-black;
148
+ }
149
+
150
+ table.yt-table tbody.yt-table__body tr.yt-table__row {
151
+ @apply border-grey-light hover:bg-grey-light flex min-h-[2.5rem] border-b;
152
+ }
153
+
154
+ table.yt-table tbody.yt-table__body tr.yt-table__row td.yt-table__cell {
155
+ @apply flex-1 truncate p-2 text-center align-middle;
156
+ }
157
+
158
+ [data-radix-portal][aria-hidden] [data-taco='menu'],
159
+ [data-radix-portal][aria-hidden] [data-taco='hanger'] {
140
160
  display: none;
141
161
  opacity: 0;
142
162
  }
@@ -3387,7 +3387,7 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
3387
3387
 
3388
3388
  var _excluded$5 = ["dialog", "hanger", "menu", "popover", "tooltip"];
3389
3389
  var getButtonClasses = function getButtonClasses() {
3390
- return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] h-max leading-6 inline-flex items-center justify-center transition-all delay-100 ease-in border';
3390
+ return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] h-max leading-6 inline-flex items-center justify-center border';
3391
3391
  };
3392
3392
  var getAppearanceClasses = function getAppearanceClasses(value, icon) {
3393
3393
  if (icon === void 0) {
@@ -3436,7 +3436,8 @@ var createButton = function createButton(props, className, ref) {
3436
3436
  });
3437
3437
  } else if (typeof menu === 'function') {
3438
3438
  button = menu({
3439
- trigger: button
3439
+ trigger: button,
3440
+ appearance: otherProps.appearance
3440
3441
  });
3441
3442
  } else if (typeof popover === 'function') {
3442
3443
  button = popover({
@@ -3459,15 +3460,14 @@ var createButton = function createButton(props, className, ref) {
3459
3460
  return button;
3460
3461
  };
3461
3462
 
3462
- var _excluded$6 = ["appearance", "icon", "rounded"];
3463
+ var _excluded$6 = ["icon", "rounded"];
3463
3464
  var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
3464
- var appearance = props.appearance,
3465
- icon = props.icon,
3465
+ var icon = props.icon,
3466
3466
  _props$rounded = props.rounded,
3467
3467
  rounded = _props$rounded === void 0 ? false : _props$rounded,
3468
3468
  otherProps = _objectWithoutPropertiesLoose(props, _excluded$6);
3469
3469
 
3470
- var className = cn('w-8', getButtonClasses(), getAppearanceClasses(appearance, true), {
3470
+ var className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
3471
3471
  'rounded-full': rounded,
3472
3472
  rounded: !rounded,
3473
3473
  'cursor-not-allowed opacity-50': props.disabled,
@@ -3504,13 +3504,12 @@ var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
3504
3504
  }) : null);
3505
3505
  });
3506
3506
 
3507
- var _excluded$7 = ["appearance", "fluid"];
3507
+ var _excluded$7 = ["fluid"];
3508
3508
  var Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
3509
- var appearance = props.appearance,
3510
- fluid = props.fluid,
3509
+ var fluid = props.fluid,
3511
3510
  otherProps = _objectWithoutPropertiesLoose(props, _excluded$7);
3512
3511
 
3513
- var className = cn(getButtonClasses(), getAppearanceClasses(appearance), 'rounded px-3', {
3512
+ var className = cn(getButtonClasses(), getAppearanceClasses(otherProps.appearance), 'rounded px-3', {
3514
3513
  'cursor-not-allowed opacity-50': props.disabled,
3515
3514
  'focus:yt-focus active:focus:yt-focus': !props.disabled,
3516
3515
  'w-full': fluid
@@ -4187,7 +4186,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
4187
4186
  onChange = props.onChange,
4188
4187
  otherProps = _objectWithoutPropertiesLoose(props, _excluded$c);
4189
4188
 
4190
- var className = cn('h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem]', {
4189
+ var className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem]', {
4191
4190
  'mr-2': !!label,
4192
4191
  'border-grey-dark text-blue focus:border-blue focus:yt-focus': !props.disabled && !invalid,
4193
4192
  'border-grey text-blue-light cursor-not-allowed': props.disabled,
@@ -4242,56 +4241,29 @@ var useProxiedRef = function useProxiedRef(ref) {
4242
4241
  };
4243
4242
 
4244
4243
  var getInputClasses = function getInputClasses(props) {
4245
- var _cn;
4246
-
4247
- return cn('peer bg-white text-black text-sm border font-normal not-italic no-underline rounded inline-flex leading-6 px-2 relative w-full text-ellipsis transition-all delay-100 ease-in flex items-center', (_cn = {
4244
+ return cn('peer bg-white text-black text-sm border font-normal not-italic no-underline rounded inline-flex leading-6 px-2 relative w-full text-ellipsis flex items-center', {
4248
4245
  'cursor-not-allowed text-black bg-grey': props.readOnly,
4249
- 'border-grey text-opacity-25 cursor-not-allowed': props.disabled
4250
- }, _cn[getStateClasses$1(props.state)] = !props.disabled, _cn['bg-[rgba(255,255,0,0.075)]'] = props.highlighted && props.disabled, _cn['bg-[rgba(255,255,0,0.2)]'] = props.highlighted && !props.disabled, _cn));
4246
+ 'border-grey text-opacity-25 cursor-not-allowed': props.disabled,
4247
+ 'bg-[rgba(255,255,0,0.075)]': props.highlighted && props.disabled,
4248
+ 'bg-[rgba(255,255,0,0.2)]': props.highlighted && !props.disabled,
4249
+ 'border-grey-dark hover:shadow-[0_0_0.1rem_theme(colors.grey.darker)] focus:border-blue-light focus:yt-focus active:border-blue-dark': !props.invalid,
4250
+ 'border-red hover:shadow-[0_0_0.15rem_theme(colors.red.DEFAULT)] focus:border-red-light focus:yt-focus-red active:border-red-dark': props.invalid
4251
+ });
4251
4252
  };
4252
- var getStateClasses$1 = function getStateClasses(value) {
4253
- switch (value) {
4254
- case 'success':
4255
- return 'border-green hover:shadow-[0_0_0.15rem_theme(colors.green.DEFAULT)] focus:border-green-light focus:yt-focus-green active:border-green-dark';
4256
-
4257
- case 'error':
4258
- return 'border-red hover:shadow-[0_0_0.15rem_theme(colors.red.DEFAULT)] focus:border-red-light focus:yt-focus-red active:border-red-dark';
4259
-
4260
- case 'warning':
4261
- return 'border-yellow-dark hover:shadow-[0_0_0.15rem_theme(colors.yellow.dark)] focus:yt-focus-yellow active:border-yellow-dark';
4262
-
4263
- case 'information':
4264
- return 'border-blue hover:shadow-[0_0_0.15rem_theme(colors.blue.dark)] focus:border-blue-light focus:yt-focus active:border-blue-dark';
4265
-
4266
- default:
4267
- return 'border-grey-dark hover:shadow-[0_0_0.1rem_theme(colors.grey.darker)] focus:border-blue-light focus:yt-focus active:border-blue-dark';
4253
+ var getButtonStateClasses = function getButtonStateClasses(invalid) {
4254
+ if (invalid) {
4255
+ return '!border-red focus:!border-red-light focus:yt-focus-red peer-focus:!border-red-light peer-focus:peer-active:!border-red-dark';
4268
4256
  }
4269
- };
4270
- var getButtonStateClasses = function getButtonStateClasses(value) {
4271
- switch (value) {
4272
- case 'success':
4273
- return '!border-green focus:!border-green-light focus:yt-focus-green peer-focus:!border-green-light peer-focus:peer-active:!border-green-dark';
4274
-
4275
- case 'error':
4276
- return '!border-red focus:!border-red-light focus:yt-focus-red peer-focus:!border-red-light peer-focus:peer-active:!border-red-dark';
4277
4257
 
4278
- case 'warning':
4279
- return '!border-yellow-dark focus:!border-yellow-dark focus:yt-focus-yellow peer-focus:peer-active:!border-yellow-dark';
4280
-
4281
- case 'information':
4282
- return '!border-blue focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
4283
-
4284
- default:
4285
- return '!border-grey-dark focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
4286
- }
4258
+ return '!border-grey-dark focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
4287
4259
  };
4288
4260
 
4289
- var _excluded$d = ["button", "icon", "highlighted", "onKeyDown", "state", "autoFocus"];
4261
+ var _excluded$d = ["button", "icon", "highlighted", "invalid", "onKeyDown", "autoFocus"];
4290
4262
  var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
4291
4263
  var button = props.button,
4292
4264
  icon = props.icon,
4265
+ invalid = props.invalid,
4293
4266
  onKeyDown = props.onKeyDown,
4294
- state = props.state,
4295
4267
  autoFocus = props.autoFocus,
4296
4268
  otherProps = _objectWithoutPropertiesLoose(props, _excluded$d);
4297
4269
 
@@ -4334,7 +4306,7 @@ var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
4334
4306
  var _button$props$disable, _cn;
4335
4307
 
4336
4308
  var disabled = (_button$props$disable = button.props.disabled) !== null && _button$props$disable !== void 0 ? _button$props$disable : otherProps.disabled;
4337
- var buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', (_cn = {}, _cn[getButtonStateClasses(state)] = !props.disabled, _cn), button.props.className);
4309
+ var buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', (_cn = {}, _cn[getButtonStateClasses(invalid)] = !props.disabled, _cn), button.props.className);
4338
4310
  extra = React.cloneElement(button, {
4339
4311
  className: buttonClassName,
4340
4312
  disabled: disabled
@@ -4451,7 +4423,7 @@ var useListScrollTo = function useListScrollTo(internalRef, itemRefs) {
4451
4423
  };
4452
4424
  };
4453
4425
 
4454
- var _excluded$e = ["data", "disabled", "highlighted", "id", "loading", "onChange", "onClick", "onFocus", "onKeyDown", "readOnly", "scrollOnFocus", "state", "value", "multiselect", "selectedIndexes", "allOptionsSelected"],
4426
+ var _excluded$e = ["data", "disabled", "highlighted", "id", "invalid", "loading", "onChange", "onClick", "onFocus", "onKeyDown", "readOnly", "scrollOnFocus", "value", "multiselect", "selectedIndexes", "allOptionsSelected"],
4455
4427
  _excluded2$1 = ["children", "icon"];
4456
4428
  var getId = function getId(id, value) {
4457
4429
  return id + "_" + value;
@@ -4504,6 +4476,17 @@ var ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(props
4504
4476
  var _useListScrollTo = useListScrollTo(listRef, itemRefs),
4505
4477
  scrollTo = _useListScrollTo.scrollTo;
4506
4478
 
4479
+ React.useEffect(function () {
4480
+ var _itemRefs$currentInde;
4481
+
4482
+ if (currentIndex && (_itemRefs$currentInde = itemRefs[currentIndex]) !== null && _itemRefs$currentInde !== void 0 && _itemRefs$currentInde.current) {
4483
+ var _itemRefs$currentInde2;
4484
+
4485
+ (_itemRefs$currentInde2 = itemRefs[currentIndex].current) === null || _itemRefs$currentInde2 === void 0 ? void 0 : _itemRefs$currentInde2.scrollIntoView({
4486
+ block: 'center'
4487
+ });
4488
+ }
4489
+ }, []);
4507
4490
  React.useEffect(function () {
4508
4491
  scrollTo(currentIndex);
4509
4492
  }, [currentIndex]);
@@ -5231,17 +5214,22 @@ var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5231
5214
  className: "!border-l-0 focus:!border-none focus:!shadow-none active:!border-none",
5232
5215
  icon: popover.open ? 'chevron-up' : 'chevron-down',
5233
5216
  onClick: function onClick() {
5234
- return popover.onOpenChange(true);
5217
+ var _input$ref$current;
5218
+
5219
+ popover.onOpenChange(true);
5220
+ (_input$ref$current = input.ref.current) === null || _input$ref$current === void 0 ? void 0 : _input$ref$current.focus();
5235
5221
  },
5236
5222
  tabIndex: -1
5237
5223
  }) : dialog ? React.createElement(IconButton, {
5238
5224
  icon: "list-search",
5239
5225
  disabled: props.readOnly || props.disabled,
5240
5226
  dialog: dialog,
5241
- onFocus: function onFocus() {
5242
- var _input$ref$current;
5227
+ onFocus: function onFocus(event) {
5228
+ var _input$ref$current2;
5243
5229
 
5244
- (_input$ref$current = input.ref.current) === null || _input$ref$current === void 0 ? void 0 : _input$ref$current.focus();
5230
+ // Prevents the default focus behaviour of showing the tooltip, on parent tooltip element
5231
+ event.preventDefault();
5232
+ (_input$ref$current2 = input.ref.current) === null || _input$ref$current2 === void 0 ? void 0 : _input$ref$current2.focus();
5245
5233
  },
5246
5234
  ref: button.ref,
5247
5235
  tabIndex: -1,
@@ -5254,7 +5242,7 @@ var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5254
5242
  },
5255
5243
  sideOffset: 4
5256
5244
  }, React.createElement(ScrollableList, Object.assign({}, list, {
5257
- className: cn('border-blue max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)]'),
5245
+ className: cn('!border-blue max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)]'),
5258
5246
  style: {
5259
5247
  minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
5260
5248
  },
@@ -5966,23 +5954,21 @@ Dialog.Extra = Extra;
5966
5954
  Dialog.Drawer = Drawer;
5967
5955
  Dialog.Close = Close$2;
5968
5956
 
5969
- var _excluded$n = ["disabled", "children", "message", "state"];
5957
+ var _excluded$n = ["disabled", "children", "invalid", "message"];
5970
5958
  var Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
5971
5959
  var disabled = props.disabled,
5972
5960
  children = props.children,
5961
+ _props$invalid = props.invalid,
5962
+ invalid = _props$invalid === void 0 ? false : _props$invalid,
5973
5963
  message = props.message,
5974
- state = props.state,
5975
5964
  otherProps = _objectWithoutPropertiesLoose(props, _excluded$n);
5976
5965
 
5977
5966
  var className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
5978
5967
  'text-grey-dark': disabled
5979
5968
  }, props.className);
5980
5969
  var messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {
5981
- 'text-grey-darkest': !state || state === 'default',
5982
- 'text-red': state === 'error',
5983
- 'text-green': state === 'success',
5984
- 'text-blue': state === 'information',
5985
- 'text-yellow-dark': state === 'warning',
5970
+ 'text-grey-darkest': !invalid,
5971
+ 'text-red': invalid,
5986
5972
  'opacity-50': disabled
5987
5973
  }, props.className);
5988
5974
  return React.createElement("label", Object.assign({}, otherProps, {
@@ -5991,7 +5977,7 @@ var Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
5991
5977
  ref: ref
5992
5978
  }), children, message && React.createElement("span", {
5993
5979
  className: messageClassName,
5994
- role: state === 'error' ? 'alert' : undefined
5980
+ role: invalid ? 'alert' : undefined
5995
5981
  }, message));
5996
5982
  });
5997
5983
 
@@ -6089,11 +6075,22 @@ var Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
6089
6075
  props: otherProps,
6090
6076
  ref: ref
6091
6077
  };
6092
- }, [otherProps]);
6078
+ }, [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
6079
+
6080
+ var _React$useState = React.useState(false),
6081
+ open = _React$useState[0],
6082
+ setOpen = _React$useState[1];
6083
+
6084
+ React.useEffect(function () {
6085
+ if (defaultOpen) {
6086
+ setOpen(defaultOpen);
6087
+ }
6088
+ }, []);
6093
6089
  return React.createElement(HangerContext.Provider, {
6094
6090
  value: context
6095
6091
  }, React.createElement(PopoverPrimitive.Root, {
6096
- defaultOpen: defaultOpen
6092
+ key: String(open),
6093
+ defaultOpen: open
6097
6094
  }, anchor && React.createElement(Anchor, null, anchor), children));
6098
6095
  });
6099
6096
  Hanger.Anchor = Anchor;
@@ -6126,7 +6123,7 @@ var SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput(_ref, ref)
6126
6123
  }, props, {
6127
6124
  button: React.createElement(IconButton, {
6128
6125
  icon: "search",
6129
- className: "!border-transparent !bg-transparent",
6126
+ className: "!border-transparent !bg-transparent focus:!border-transparent peer-focus:!border-transparent peer-focus:peer-active:!border-transparent",
6130
6127
  disabled: props.disabled,
6131
6128
  onClick: handleClick
6132
6129
  }),
@@ -6157,7 +6154,7 @@ var useTypeahead = function useTypeahead(_ref) {
6157
6154
  };
6158
6155
  };
6159
6156
 
6160
- var _excluded$s = ["data", "defaultValue", "disabled", "emptyValue", "id", "name", "onChange", "onFocus", "onKeyDown", "value"];
6157
+ var _excluded$s = ["data", "defaultValue", "disabled", "emptyValue", "id", "invalid", "name", "onChange", "onFocus", "onKeyDown", "value"];
6161
6158
  var useListbox = function useListbox(_ref, ref) {
6162
6159
  var _ref$data = _ref.data,
6163
6160
  externalData = _ref$data === void 0 ? [] : _ref$data,
@@ -6165,6 +6162,7 @@ var useListbox = function useListbox(_ref, ref) {
6165
6162
  disabled = _ref.disabled,
6166
6163
  emptyValue = _ref.emptyValue,
6167
6164
  nativeId = _ref.id,
6165
+ invalid = _ref.invalid,
6168
6166
  name = _ref.name,
6169
6167
  onChange = _ref.onChange,
6170
6168
  onFocus = _ref.onFocus,
@@ -6279,6 +6277,7 @@ var useListbox = function useListbox(_ref, ref) {
6279
6277
  data: data,
6280
6278
  disabled: disabled,
6281
6279
  id: id,
6280
+ invalid: invalid,
6282
6281
  onChange: handleListboxChange,
6283
6282
  onFocus: handleListboxFocus,
6284
6283
  onKeyDown: handleListboxKeyDown,
@@ -7030,9 +7029,10 @@ var Header = function Header(props) {
7030
7029
  }));
7031
7030
  };
7032
7031
 
7033
- var _excluded$B = ["children", "trigger"];
7032
+ var _excluded$B = ["appearance", "children", "trigger"];
7034
7033
  var Menu = function Menu(externalProps) {
7035
- var children = externalProps.children,
7034
+ var externalAppearance = externalProps.appearance,
7035
+ children = externalProps.children,
7036
7036
  trigger = externalProps.trigger,
7037
7037
  props = _objectWithoutPropertiesLoose(externalProps, _excluded$B);
7038
7038
 
@@ -7040,7 +7040,7 @@ var Menu = function Menu(externalProps) {
7040
7040
  open = _React$useState[0],
7041
7041
  setOpen = _React$useState[1];
7042
7042
 
7043
- var _React$useState2 = React.useState('default'),
7043
+ var _React$useState2 = React.useState(externalAppearance !== null && externalAppearance !== void 0 ? externalAppearance : 'default'),
7044
7044
  appearance = _React$useState2[0],
7045
7045
  _setAppearance = _React$useState2[1];
7046
7046
 
@@ -7421,7 +7421,12 @@ var useSelect = function useSelect(_ref, ref) {
7421
7421
  }
7422
7422
  }, [defaultValue]);
7423
7423
  React.useEffect(function () {
7424
- if (value !== undefined) {
7424
+ // If emptyValue is defined, then set emptyValue
7425
+ if (emptyValue !== undefined && value === emptyValue) {
7426
+ setInputValueByRef$1(internalInputRef.current, value);
7427
+ } else if (value !== undefined && data.some(function (option) {
7428
+ return option.value === value;
7429
+ })) {
7425
7430
  setInputValueByRef$1(internalInputRef.current, value);
7426
7431
  } else if (data.length && defaultValue === undefined) {
7427
7432
  setInputValueByRef$1(internalInputRef.current, data[0].value);
@@ -7598,7 +7603,7 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref) {
7598
7603
  var className = cn('inline-flex relative w-full', {
7599
7604
  'yt-select--readonly': props.readOnly
7600
7605
  }, externalClassName);
7601
- var inputClassname = cn(getInputClasses(props), 'text-left pr-0', {
7606
+ var inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {
7602
7607
  'border-blue': popover.open
7603
7608
  });
7604
7609
  React.useEffect(function () {
@@ -7617,6 +7622,7 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref) {
7617
7622
 
7618
7623
  var commonListboxProps = _extends({}, listbox, {
7619
7624
  className: 'w-auto',
7625
+ invalid: undefined,
7620
7626
  style: {
7621
7627
  minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
7622
7628
  },
@@ -9162,7 +9168,7 @@ var BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(props,
9162
9168
  return React__default.createElement("div", {
9163
9169
  key: index,
9164
9170
  role: "row",
9165
- className: "border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-b border-t-0 border-b-2 font-bold"
9171
+ className: "border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-t-0 border-b-2 font-bold"
9166
9172
  }, headerGroup.headers.map(function (cell, index) {
9167
9173
  return React__default.createElement(Column, {
9168
9174
  key: index,
@@ -9681,7 +9687,7 @@ Tabs.List = TabList;
9681
9687
  Tabs.Trigger = TabTrigger;
9682
9688
  Tabs.Content = TabContent;
9683
9689
 
9684
- var _excluded$Q = ["defaultValue", "highlighted", "onKeyDown", "state"];
9690
+ var _excluded$Q = ["defaultValue", "highlighted", "invalid", "onKeyDown"];
9685
9691
  var Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
9686
9692
  var onKeyDown = props.onKeyDown,
9687
9693
  otherProps = _objectWithoutPropertiesLoose(props, _excluded$Q);