@economic/taco 0.0.12-alpha.0 → 0.0.15-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 (43) hide show
  1. package/dist/components/{Label/Label.d.ts → Field/Field.d.ts} +9 -9
  2. package/dist/components/Menu/Menu.d.ts +1 -0
  3. package/dist/esm/components/Backdrop/Backdrop.js +1 -1
  4. package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
  5. package/dist/esm/components/Banner/Banner.js +1 -1
  6. package/dist/esm/components/Banner/Banner.js.map +1 -1
  7. package/dist/esm/components/Button/Button.js +15 -1
  8. package/dist/esm/components/Button/Button.js.map +1 -1
  9. package/dist/esm/components/Button/util.js +7 -7
  10. package/dist/esm/components/Button/util.js.map +1 -1
  11. package/dist/esm/components/Calendar/Calendar.js +3 -1
  12. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  13. package/dist/esm/components/Datepicker/useDatepicker.js +9 -0
  14. package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -1
  15. package/dist/esm/components/Dialog/Dialog.js +4 -2
  16. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  17. package/dist/esm/components/Dialog/components/Content.js +1 -1
  18. package/dist/esm/components/Dialog/components/Content.js.map +1 -1
  19. package/dist/esm/components/{Label/Label.js → Field/Field.js} +3 -3
  20. package/dist/esm/components/Field/Field.js.map +1 -0
  21. package/dist/esm/components/Input/Input.js +19 -2
  22. package/dist/esm/components/Input/Input.js.map +1 -1
  23. package/dist/esm/components/Menu/components/Item.js.map +1 -1
  24. package/dist/esm/components/Provider/Provider.js +1 -1
  25. package/dist/esm/components/Provider/Provider.js.map +1 -1
  26. package/dist/esm/components/SearchInput/SearchInput.js +5 -3
  27. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  28. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +3 -1
  29. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
  30. package/dist/esm/components/Textarea/Textarea.js +21 -3
  31. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  32. package/dist/esm/index.css +8 -9
  33. package/dist/esm/index.js +2 -1
  34. package/dist/esm/index.js.map +1 -1
  35. package/dist/index.css +8 -9
  36. package/dist/index.d.ts +2 -1
  37. package/dist/taco.cjs.development.js +125 -60
  38. package/dist/taco.cjs.development.js.map +1 -1
  39. package/dist/taco.cjs.production.min.js +1 -1
  40. package/dist/taco.cjs.production.min.js.map +1 -1
  41. package/package.json +2 -2
  42. package/types.json +118 -118
  43. package/dist/esm/components/Label/Label.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { State } from '../../types';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { getButtonStateClasses, getInputClasses } from './util';\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** State will change the style of the input **/\n state?: State;\n};\n\nexport const Input = React.forwardRef(function Input(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button, icon, highlighted, state, autoFocus, ...otherProps } = props;\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\n const hasContainer = button || icon;\n const className = cn(\n getInputClasses(props),\n 'min-h-[theme(spacing.8)] pointer-events-all',\n {\n 'pr-8': !!hasContainer,\n },\n !hasContainer && otherProps.className\n );\n\n React.useEffect(() => {\n if (autoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, []);\n\n const input = <input {...otherProps} className={className} data-taco=\"input\" ref={inputRef} />;\n\n if (hasContainer) {\n let extra: any;\n\n if (button) {\n const disabled = button.props.disabled ?? otherProps.disabled;\n const buttonClassName = cn(\n 'items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none',\n {\n [getButtonStateClasses(state)]: !props.disabled,\n },\n button.props.className\n );\n extra = React.cloneElement(button, {\n className: buttonClassName,\n disabled,\n });\n } else if (icon) {\n const iconClassName = cn(\n 'items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2',\n {\n 'text-grey-dark': props.disabled,\n 'text-grey-darkest': !props.disabled,\n }\n );\n extra =\n typeof icon === 'string' ? (\n <Icon className={iconClassName} name={icon} />\n ) : (\n React.cloneElement(icon, { className: cn(iconClassName, icon.props.className) })\n );\n }\n\n const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);\n\n return (\n <div className={containerClassName} data-taco=\"input-container\">\n {input}\n {extra}\n </div>\n );\n }\n\n return input;\n});\n"],"names":["Input","React","props","ref","button","icon","state","autoFocus","otherProps","inputRef","useProxiedRef","hasContainer","className","cn","getInputClasses","current","focus","input","extra","disabled","buttonClassName","getButtonStateClasses","iconClassName","Icon","name","containerClassName"],"mappings":";;;;;;;;IAkBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASD,KAAT,CAAeE,KAAf,EAAkCC,GAAlC;AAClC,MAAQC,MAAR,GAAuEF,KAAvE,CAAQE,MAAR;AAAA,MAAgBC,IAAhB,GAAuEH,KAAvE,CAAgBG,IAAhB;AAAA,MAAmCC,KAAnC,GAAuEJ,KAAvE,CAAmCI,KAAnC;AAAA,MAA0CC,SAA1C,GAAuEL,KAAvE,CAA0CK,SAA1C;AAAA,MAAwDC,UAAxD,iCAAuEN,KAAvE;;AACA,MAAMO,QAAQ,GAAGC,aAAa,CAAmBP,GAAnB,CAA9B;AACA,MAAMQ,YAAY,GAAGP,MAAM,IAAIC,IAA/B;AACA,MAAMO,SAAS,GAAGC,EAAE,CAChBC,eAAe,CAACZ,KAAD,CADC,EAEhB,6CAFgB,EAGhB;AACI,YAAQ,CAAC,CAACS;AADd,GAHgB,E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jB,IAAI,CAACH,KAAL,CAAWU,SAA3B;AAAf,OAAzB,CAJR;AAMH;;AAED,QAAMa,kBAAkB,GAAGZ,EAAE,CAAC,8CAAD,EAAiDL,UAAU,CAACI,SAA5D,CAA7B;AAEA,WACIX,aAAA,MAAA;AAAKW,MAAAA,SAAS,EAAEa;mBAA8B;KAA9C,EACKR,KADL,EAEKC,KAFL,CADJ;AAMH;;AAED,SAAOD,KAAP;AACH,CAhEoB;;;;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { State } from '../../types';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { getButtonStateClasses, getInputClasses } from './util';\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** State will change the style of the input **/\n state?: State;\n};\n\nexport const Input = React.forwardRef(function Input(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button, icon, highlighted, onKeyDown, state, autoFocus, ...otherProps } = props;\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\n const hasContainer = button || icon;\n const className = cn(\n getInputClasses(props),\n 'min-h-[theme(spacing.8)] pointer-events-all',\n {\n 'pr-8': !!hasContainer,\n },\n !hasContainer && otherProps.className\n );\n\n React.useEffect(() => {\n if (autoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, []);\n\n // home and end keys only navigate to the start/end of input value if the input 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<HTMLInputElement>) => {\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 }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n const input = <input {...otherProps} className={className} data-taco=\"input\" onKeyDown={handleKeyDown} ref={inputRef} />;\n\n if (hasContainer) {\n let extra: any;\n\n if (button) {\n const disabled = button.props.disabled ?? otherProps.disabled;\n const buttonClassName = cn(\n 'items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none',\n {\n [getButtonStateClasses(state)]: !props.disabled,\n },\n button.props.className\n );\n extra = React.cloneElement(button, {\n className: buttonClassName,\n disabled,\n });\n } else if (icon) {\n const iconClassName = cn(\n 'items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2',\n {\n 'text-grey-dark': props.disabled,\n 'text-grey-darkest': !props.disabled,\n }\n );\n extra =\n typeof icon === 'string' ? (\n <Icon className={iconClassName} name={icon} />\n ) : (\n React.cloneElement(icon, { className: cn(iconClassName, icon.props.className) })\n );\n }\n\n const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);\n\n return (\n <div className={containerClassName} data-taco=\"input-container\">\n {input}\n {extra}\n </div>\n );\n }\n\n return input;\n});\n"],"names":["Input","React","props","ref","button","icon","onKeyDown","state","autoFocus","otherProps","inputRef","useProxiedRef","hasContainer","className","cn","getInputClasses","current","focus","handleKeyDown","event","key","preventDefault","position","currentTarget","value","length","setSelectionRange","input","extra","disabled","buttonClassName","getButtonStateClasses","iconClassName","Icon","name","containerClassName"],"mappings":";;;;;;;;IAkBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASD,KAAT,CAAeE,KAAf,EAAkCC,GAAlC;AAClC,MAAQC,MAAR,GAAkFF,KAAlF,CAAQE,MAAR;AAAA,MAAgBC,IAAhB,GAAkFH,KAAlF,CAAgBG,IAAhB;AAAA,MAAmCC,SAAnC,GAAkFJ,KAAlF,CAAmCI,SAAnC;AAAA,MAA8CC,KAA9C,GAAkFL,KAAlF,CAA8CK,KAA9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React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { Appearance } from '../../../types';\nimport { DialogProps } from '../../Dialog/Dialog';\n\nexport const Icon = ({ name }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nconst getAppearanceClasses = (appearance: Appearance | undefined) => {\n switch (appearance) {\n case 'primary':\n return 'wcag-blue aria-disabled:text-blue-dark focus:wcag-blue-light';\n\n case 'danger':\n return 'wcag-red aria-disabled:text-red-dark focus:wcag-red-light';\n\n case 'ghost':\n return 'text-blue aria-disabled:text-grey focus:wcag-blue';\n\n case 'discrete':\n return 'text-black aria-disabled:text-grey focus:wcag-blue-lightest';\n\n case 'default':\n default:\n return 'wcag-grey-light aria-disabled:text-grey-darker focus:wcag-grey-dark';\n }\n};\n\nexport const useItemStyling = ({ disabled, indented, className }) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-7 pr-1.5 relative rounded w-full focus:outline-none group',\n getAppearanceClasses(menu?.appearance),\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n 'cursor-pointer': !disabled,\n 'cursor-not-allowed': disabled,\n },\n className\n );\n};\n\nexport const Shortcut = props => {\n const menu = useCurrentMenu();\n let appearance;\n\n switch (menu?.appearance) {\n case 'primary':\n appearance = 'text-blue-lightest group-focus:text-black';\n break;\n\n case 'danger':\n appearance = 'text-red-lightest group-focus:text-white';\n break;\n\n case 'ghost':\n appearance = 'text-blue-light group-focus:text-blue-lightest';\n break;\n\n case 'discrete':\n appearance = 'text-grey-darker group-focus:text-blue-light';\n break;\n\n case 'default':\n default:\n appearance = 'text-grey-darkest';\n break;\n }\n\n const className = cn('ml-auto pl-3', appearance);\n\n return <span {...props} className={className} />;\n};\n\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean;\n icon?: IconName;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n shortcut?: string;\n};\n\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n let disabled = props.disabled ?? props['aria-disabled'];\n\n let handleClick;\n\n // radix has a bug that does not disable clicks when disabled is set on items\n if (disabled) {\n handleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n };\n }\n\n let handleSelect = event => {\n if (onClick) {\n onClick(event);\n }\n\n if (props['aria-haspopup'] || typeof dialog === 'function') {\n event.preventDefault();\n }\n };\n\n let button = (\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\n {icon && <Icon name={icon} />}\n {props.children}\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\n </DropdownMenuPrimitive.Item>\n );\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n }\n\n return button;\n});\n"],"names":["Icon","name","React","className","IconPrimitive","getAppearanceClasses","appearance","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stopPropagation","handleSelect","button","DropdownMenuPrimitive","onSelect","children","trigger"],"mappings":";;;;;;;;IASaA,IAAI,GAAG,SAAPA,IAAO;AAAA,MAAGC,IAAH,QAAGA,IAAH;AAAA,SAChBC,aAAA,OAAA;AAAMC,IAAAA,SAAS,EAAC;GAAhB,EACID,aAAA,CAACE,MAAD;AAAeD,IA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AAH,KAAK;AACpB,QAAIJ,OAAJ,EAAa;AACTA,MAAAA,OAAO,CAACI,KAAD,CAAP;AACH;;AAED,QAAIV,KAAK,CAAC,eAAD,CAAL,IAA0B,OAAOI,MAAP,KAAkB,UAAhD,EAA4D;AACxDM,MAAAA,KAAK,CAACC,cAAN;AACH;AACJ,GARD;;AAUA,MAAIG,MAAM,GACN3B,aAAA,CAAC4B,MAAD,oBAAgCP;AAAYpB,IAAAA,SAAS,EAAEA;AAAWkB,IAAAA,OAAO,EAAEG;AAAaO,IAAAA,QAAQ,EAAEH;AAAcV,IAAAA,GAAG,EAAEA;IAArH,EACKE,IAAI,IAAIlB,aAAA,CAACF,IAAD;AAAMC,IAAAA,IAAI,EAAEmB;GAAZ,CADb,EAEKL,KAAK,CAACiB,QAFX,EAGKV,QAAQ,IAAIpB,aAAA,CAACY,QAAD,MAAA,EAAWQ,QAAX,CAHjB,CADJ;;AAQA,MAAI,OAAOH,MAAP,KAAkB,UAAtB,EAAkC;AAC9BU,IAAAA,MAAM,GAAGV,MAAM,CAAC;AAAEc,MAAAA,OAAO,EAAEJ;AAAX,KAAD,CAAf;AACH;;AAED,SAAOA,MAAP;AACH,CA3CmB;;;;"}
1
+ {"version":3,"file":"Item.js","sources":["../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { Appearance } from '../../../types';\nimport { DialogProps } from '../../Dialog/Dialog';\n\nexport const Icon = ({ name }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nconst getAppearanceClasses = (appearance: Appearance | undefined) => {\n switch (appearance) {\n case 'primary':\n return 'wcag-blue aria-disabled:text-blue-dark focus:wcag-blue-light';\n\n case 'danger':\n return 'wcag-red aria-disabled:text-red-dark focus:wcag-red-light';\n\n case 'ghost':\n return 'text-blue aria-disabled:text-grey focus:wcag-blue';\n\n case 'discrete':\n return 'text-black aria-disabled:text-grey focus:wcag-blue-lightest';\n\n case 'default':\n default:\n return 'wcag-grey-light aria-disabled:text-grey-darker focus:wcag-grey-dark';\n }\n};\n\nexport const useItemStyling = ({ disabled, indented, className }) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-7 pr-1.5 relative rounded w-full focus:outline-none group',\n getAppearanceClasses(menu?.appearance),\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n 'cursor-pointer': !disabled,\n 'cursor-not-allowed': disabled,\n },\n className\n );\n};\n\nexport const Shortcut = props => {\n const menu = useCurrentMenu();\n let appearance;\n\n switch (menu?.appearance) {\n case 'primary':\n appearance = 'text-blue-lightest group-focus:text-black';\n break;\n\n case 'danger':\n appearance = 'text-red-lightest group-focus:text-white';\n break;\n\n case 'ghost':\n appearance = 'text-blue-light group-focus:text-blue-lightest';\n break;\n\n case 'discrete':\n appearance = 'text-grey-darker group-focus:text-blue-light';\n break;\n\n case 'default':\n default:\n appearance = 'text-grey-darkest';\n break;\n }\n\n const className = cn('ml-auto pl-3', appearance);\n\n return <span {...props} className={className} />;\n};\n\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean;\n icon?: IconName;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n shortcut?: string;\n};\n\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const disabled = props.disabled ?? props['aria-disabled'];\n\n let handleClick;\n\n // radix has a bug that does not disable clicks when disabled is set on items\n if (disabled) {\n handleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n };\n }\n\n const handleSelect = event => {\n if (onClick) {\n onClick(event);\n }\n\n if (props['aria-haspopup'] || typeof dialog === 'function') {\n event.preventDefault();\n }\n };\n\n let button = (\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\n {icon && <Icon name={icon} />}\n {props.children}\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\n </DropdownMenuPrimitive.Item>\n );\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n }\n\n return button;\n});\n"],"names":["Icon","name","React","className","IconPrimitive","getAppearanceClasses","appearance","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stopPropagation","handleSelect","button","DropdownMenuPrimitive","onSelect","children","trigger"],"mappings":";;;;;;;;IASaA,IAAI,GAAG,SAAPA,IAAO;AAAA,MAAGC,IAAH,QAAGA,IAAH;AAAA,SAChBC,aAAA,OAAA;AAAMC,IAAAA,SAAS,EAAC;GAAhB,EACID,aAAA,CAACE,MAAD;AAAeD,IAAAA,SAAS,EAAC;AAA0BF,IAAAA,IAAI,EAAEA;GAAzD,CADJ,CADgB;AAAA;;AAMpB,IAAMI,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,UAAD;AACzB,UAAQA,UAAR;AACI,SAAK,SAAL;AACI,aAAO,8DAAP;;AAEJ,SAAK,QAAL;AACI,aAAO,2DAAP;;AAEJ,SAAK,OAAL;AACI,aAAO,mDAAP;;AAEJ,SAAK,UAAL;AACI,aAAO,6DAAP;;AAEJ,SAAK,SAAL;AACA;AACI,aAAO,qEAAP;AAfR;AAiBH,CAlBD;;IAoBaC,cAAc,GAAG,SAAjBA,cAAiB;MAAGC,iBAAAA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ACF,IAAD;AAAMC,IAAAA,IAAI,EAAEmB;GAAZ,CADb,EAEKL,KAAK,CAACiB,QAFX,EAGKV,QAAQ,IAAIpB,aAAA,CAACY,QAAD,MAAA,EAAWQ,QAAX,CAHjB,CADJ;;AAQA,MAAI,OAAOH,MAAP,KAAkB,UAAtB,EAAkC;AAC9BU,IAAAA,MAAM,GAAGV,MAAM,CAAC;AAAEc,MAAAA,OAAO,EAAEJ;AAAX,KAAD,CAAf;AACH;;AAED,SAAOA,MAAP;AACH,CA3CmB;;;;"}
@@ -65,7 +65,7 @@ var defaultLocalisationTexts = {
65
65
  back: 'Back',
66
66
  close: 'Close',
67
67
  skip: 'Close and complete',
68
- last: 'Last',
68
+ last: 'Done',
69
69
  next: 'Next',
70
70
  open: 'Open'
71
71
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.js","sources":["../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Locale } from '../../types';\nimport { CalendarTexts } from '../Calendar/Calendar';\nimport { DialogTexts } from '../Dialog/Dialog';\nimport { PaginationTexts } from '../Pagination/Pagination';\nimport { ListboxTexts } from '../Listbox/Listbox';\nimport { ToastsTexts } from '../Toast/Toast';\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\nimport { HangerTexts } from '../Hanger/Hanger';\nimport { SelectTexts } from '../Select/Select';\nimport { TourTexts } from '../Tour/Tour';\nimport { TableTexts } from '../Table/Table';\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\nimport { ToastProvider } from '../Toast/Toaster';\n\nexport type LocalizationTexts = {\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\n calendar: CalendarTexts;\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\n datepicker: DatepickerTexts;\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\n hanger: HangerTexts;\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\n listbox: ListboxTexts;\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\n dialog: DialogTexts;\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\n pagination: PaginationTexts;\n /** Localized texts and aria-labels for [Table](component:table) component */\n table: TableTexts;\n /** Localized texts and aria-labels for [Select](component:select) component */\n select: SelectTexts;\n /** Localized texts and aria-labels for [Toast](component:toast) component */\n toasts: ToastsTexts;\n /** Localized texts and aria-labels for [Tour](component:tour) component */\n tour: TourTexts;\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\n searchInput: SearchInputTexts;\n};\n\nexport type Localization = {\n /**\n * Provide the language code used in application.\n * Default value is `en-GB`\n */\n locale: Locale;\n /** Provide the texts and aria-labels for components used within the provider */\n texts: LocalizationTexts;\n /** Provide the formatting */\n formatting: {\n /** Default value is `dd.mm.yy` */\n date: string;\n };\n};\nexport type Taco = {\n /** Define localized texts and formatted data in your application */\n localization: Localization;\n};\n\nexport const defaultLocalisationTexts = {\n calendar: {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n actions: {\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n previousYear: 'Previous year',\n nextYear: 'Next year',\n today: 'Today',\n },\n },\n datepicker: {\n calendar: 'Calendar',\n clear: 'Clear',\n expand: 'Show calendar',\n shortcuts: 'Shortcuts',\n },\n hanger: {\n close: 'Close',\n },\n listbox: {\n loading: 'Loading results...',\n empty: 'No results found',\n allOption: 'All',\n },\n dialog: {\n close: 'Close',\n drag: 'Drag',\n },\n pagination: {\n label: 'Pagination',\n pageSize: 'Items per page',\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\n actions: {\n firstPage: 'Goto first page',\n firstPageWithShortcut: 'Goto first page (Home)',\n previousPage: 'Goto previous page',\n previousPageWithShortcut: 'Goto previous page (Page Up)',\n nextPage: 'Goto next page',\n nextPageWithShortcut: 'Goto next page (Page Down)',\n lastPage: 'Goto last page',\n lastPageWithShortcut: 'Goto last page (End)',\n pageX: 'Goto page [X]',\n },\n },\n table: {\n actions: 'Other actions',\n edit: 'Edit (e)',\n copy: 'Copy (c)',\n del: 'Delete (del)',\n newSubRow: 'New row (shift + n)',\n loading: 'Loading...',\n },\n select: {\n allOptionsSelected: 'All',\n },\n toasts: {\n dismiss: 'Dismiss',\n },\n tour: {\n back: 'Back',\n close: 'Close',\n skip: 'Close and complete',\n last: 'Last',\n next: 'Next',\n open: 'Open',\n },\n searchInput: {\n inputLabel: 'Search...',\n },\n};\n\nconst defaultLocalizationContext: Localization = {\n locale: 'en-GB',\n texts: defaultLocalisationTexts,\n formatting: {\n date: 'dd.mm.yy',\n },\n};\n\nconst Context = React.createContext<Taco>({\n localization: defaultLocalizationContext,\n});\n\nexport type ProviderProps = {\n /** Content would be your application */\n children?: any;\n /** Define localized texts and formatted data in your application */\n localization?: Localization;\n};\n\nexport const Provider = (props: ProviderProps): JSX.Element => {\n const { children, localization = defaultLocalizationContext } = props;\n const value = React.useMemo(() => ({ localization }), [localization]);\n\n return (\n <Context.Provider value={value}>\n <ToastProvider>{children}</ToastProvider>\n </Context.Provider>\n );\n};\n\nexport const useTaco = (): Taco => React.useContext(Context);\nexport const useLocalization = (): Localization => useTaco().localization;\n"],"names":["defaultLocalisationTexts","calendar","months","weekdaysShort","actions","previousMonth","nextMonth","previousYear","nextYear","today","datepicker","clear","expand","shortcuts","hanger","close","listbox","loading","empty","allOption","dialog","drag","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","select","allOptionsSelected","toasts","dismiss","tour","back","skip","last","next","open","searchInput","inputLabel","defaultLocalizationContext","locale","texts","formatting","date","Context","React","localization","Provider","props","children","value","ToastProvider","useTaco","useLocalization"],"mappings":";;;IA4DaA,wBAAwB,GAAG;AACpCC,EAA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pB,MAAQC,QAAR,GAAgED,KAAhE,CAAQC,QAAR;AAAA,4BAAgED,KAAhE,CAAkBF,YAAlB;AAAA,MAAkBA,YAAlB,oCAAiCP,0BAAjC;AACA,MAAMW,KAAK,GAAGL,OAAA,CAAc;AAAA,WAAO;AAAEC,MAAAA,YAAY,EAAZA;AAAF,KAAP;AAAA,GAAd,EAAwC,CAACA,YAAD,CAAxC,CAAd;AAEA,SACID,aAAA,CAACD,OAAO,CAACG,QAAT;AAAkBG,IAAAA,KAAK,EAAEA;GAAzB,EACIL,aAAA,CAACM,aAAD,MAAA,EAAgBF,QAAhB,CADJ,CADJ;AAKH;IAEYG,OAAO,GAAG,SAAVA,OAAU;AAAA,SAAYP,UAAA,CAAiBD,OAAjB,CAAZ;AAAA;IACVS,eAAe,GAAG,SAAlBA,eAAkB;AAAA,SAAoBD,OAAO,GAAGN,YAA9B;AAAA;;;;"}
1
+ {"version":3,"file":"Provider.js","sources":["../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Locale } from '../../types';\nimport { CalendarTexts } from '../Calendar/Calendar';\nimport { DialogTexts } from '../Dialog/Dialog';\nimport { PaginationTexts } from '../Pagination/Pagination';\nimport { ListboxTexts } from '../Listbox/Listbox';\nimport { ToastsTexts } from '../Toast/Toast';\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\nimport { HangerTexts } from '../Hanger/Hanger';\nimport { SelectTexts } from '../Select/Select';\nimport { TourTexts } from '../Tour/Tour';\nimport { TableTexts } from '../Table/Table';\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\nimport { ToastProvider } from '../Toast/Toaster';\n\nexport type LocalizationTexts = {\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\n calendar: CalendarTexts;\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\n datepicker: DatepickerTexts;\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\n hanger: HangerTexts;\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\n listbox: ListboxTexts;\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\n dialog: DialogTexts;\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\n pagination: PaginationTexts;\n /** Localized texts and aria-labels for [Table](component:table) component */\n table: TableTexts;\n /** Localized texts and aria-labels for [Select](component:select) component */\n select: SelectTexts;\n /** Localized texts and aria-labels for [Toast](component:toast) component */\n toasts: ToastsTexts;\n /** Localized texts and aria-labels for [Tour](component:tour) component */\n tour: TourTexts;\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\n searchInput: SearchInputTexts;\n};\n\nexport type Localization = {\n /**\n * Provide the language code used in application.\n * Default value is `en-GB`\n */\n locale: Locale;\n /** Provide the texts and aria-labels for components used within the provider */\n texts: LocalizationTexts;\n /** Provide the formatting */\n formatting: {\n /** Default value is `dd.mm.yy` */\n date: string;\n };\n};\nexport type Taco = {\n /** Define localized texts and formatted data in your application */\n localization: Localization;\n};\n\nexport const defaultLocalisationTexts = {\n calendar: {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n actions: {\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n previousYear: 'Previous year',\n nextYear: 'Next year',\n today: 'Today',\n },\n },\n datepicker: {\n calendar: 'Calendar',\n clear: 'Clear',\n expand: 'Show calendar',\n shortcuts: 'Shortcuts',\n },\n hanger: {\n close: 'Close',\n },\n listbox: {\n loading: 'Loading results...',\n empty: 'No results found',\n allOption: 'All',\n },\n dialog: {\n close: 'Close',\n drag: 'Drag',\n },\n pagination: {\n label: 'Pagination',\n pageSize: 'Items per page',\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\n actions: {\n firstPage: 'Goto first page',\n firstPageWithShortcut: 'Goto first page (Home)',\n previousPage: 'Goto previous page',\n previousPageWithShortcut: 'Goto previous page (Page Up)',\n nextPage: 'Goto next page',\n nextPageWithShortcut: 'Goto next page (Page Down)',\n lastPage: 'Goto last page',\n lastPageWithShortcut: 'Goto last page (End)',\n pageX: 'Goto page [X]',\n },\n },\n table: {\n actions: 'Other actions',\n edit: 'Edit (e)',\n copy: 'Copy (c)',\n del: 'Delete (del)',\n newSubRow: 'New row (shift + n)',\n loading: 'Loading...',\n },\n select: {\n allOptionsSelected: 'All',\n },\n toasts: {\n dismiss: 'Dismiss',\n },\n tour: {\n back: 'Back',\n close: 'Close',\n skip: 'Close and complete',\n last: 'Done',\n next: 'Next',\n open: 'Open',\n },\n searchInput: {\n inputLabel: 'Search...',\n },\n};\n\nconst defaultLocalizationContext: Localization = {\n locale: 'en-GB',\n texts: defaultLocalisationTexts,\n formatting: {\n date: 'dd.mm.yy',\n },\n};\n\nconst Context = React.createContext<Taco>({\n localization: defaultLocalizationContext,\n});\n\nexport type ProviderProps = {\n /** Content would be your application */\n children?: any;\n /** Define localized texts and formatted data in your application */\n localization?: Localization;\n};\n\nexport const Provider = (props: ProviderProps): JSX.Element => {\n const { children, localization = defaultLocalizationContext } = props;\n const value = React.useMemo(() => ({ localization }), [localization]);\n\n return (\n <Context.Provider value={value}>\n <ToastProvider>{children}</ToastProvider>\n </Context.Provider>\n );\n};\n\nexport const useTaco = (): Taco => React.useContext(Context);\nexport const useLocalization = (): Localization => useTaco().localization;\n"],"names":["defaultLocalisationTexts","calendar","months","weekdaysShort","actions","previousMonth","nextMonth","previousYear","nextYear","today","datepicker","clear","expand","shortcuts","hanger","close","listbox","loading","empty","allOption","dialog","drag","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","select","allOptionsSelected","toasts","dismiss","tour","back","skip","last","next","open","searchInput","inputLabel","defaultLocalizationContext","locale","texts","formatting","date","Context","React","localization","Provider","props","children","value","ToastProvider","use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CAAhB;IAWaQ,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD;AACpB,MAAQC,QAAR,GAAgED,KAAhE,CAAQC,QAAR;AAAA,4BAAgED,KAAhE,CAAkBF,YAAlB;AAAA,MAAkBA,YAAlB,oCAAiCP,0BAAjC;AACA,MAAMW,KAAK,GAAGL,OAAA,CAAc;AAAA,WAAO;AAAEC,MAAAA,YAAY,EAAZA;AAAF,KAAP;AAAA,GAAd,EAAwC,CAACA,YAAD,CAAxC,CAAd;AAEA,SACID,aAAA,CAACD,OAAO,CAACG,QAAT;AAAkBG,IAAAA,KAAK,EAAEA;GAAzB,EACIL,aAAA,CAACM,aAAD,MAAA,EAAgBF,QAAhB,CADJ,CADJ;AAKH;IAEYG,OAAO,GAAG,SAAVA,OAAU;AAAA,SAAYP,UAAA,CAAiBD,OAAjB,CAAZ;AAAA;IACVS,eAAe,GAAG,SAAlBA,eAAkB;AAAA,SAAoBD,OAAO,GAAGN,YAA9B;AAAA;;;;"}
@@ -19,15 +19,16 @@ import { Input } from '../Input/Input.js';
19
19
  import keycode from 'keycode';
20
20
  import '../../utils/hooks/useListKeyboardNavigation.js';
21
21
  import '../../utils/hooks/useListScrollTo.js';
22
+ import '../../utils/hooks/useBoundingClientRectListener.js';
22
23
  import '../Combobox/Combobox.js';
23
24
  import '../../utils/date.js';
24
25
  import '../Popover/Popover.js';
25
26
  import '../Datepicker/Datepicker.js';
26
27
  import '../Dialog/Dialog.js';
28
+ import '../Field/Field.js';
27
29
  import '../Form/Form.js';
28
30
  import '../Group/Group.js';
29
31
  import '../Hanger/Hanger.js';
30
- import '../Label/Label.js';
31
32
  import '../Listbox/Listbox.js';
32
33
  import '../RadioGroup/RadioGroup.js';
33
34
  import '../Menu/Menu.js';
@@ -75,12 +76,13 @@ var SearchInput = /*#__PURE__*/forwardRef(function SearchInput(_ref, ref) {
75
76
  }, props, {
76
77
  button: createElement(IconButton, {
77
78
  icon: "search",
78
- className: "!bg-transparent !border-transparent",
79
+ className: "!border-transparent !bg-transparent",
79
80
  disabled: props.disabled,
80
81
  onClick: handleClick
81
82
  }),
82
83
  onKeyDown: handleKeyDown,
83
- ref: ref
84
+ ref: ref,
85
+ type: "search"
84
86
  }));
85
87
  });
86
88
 
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\n\nexport type SearchInputTexts = {\n /**\n * aria-label text for input\n */\n inputLabel: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n if (!props.disabled) {\n onSearch?.(props.value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const isEnterKeyPressed = event.keyCode === keycode('enter');\n\n if (isEnterKeyPressed) {\n handleClick();\n }\n };\n\n return (\n <Input\n aria-label={texts.searchInput.inputLabel}\n {...props}\n button={\n <IconButton\n icon=\"search\"\n className=\"!bg-transparent !border-transparent\"\n disabled={props.disabled}\n onClick={handleClick}\n />\n }\n onKeyDown={handleKeyDown}\n ref={ref}\n />\n );\n});\n"],"names":["SearchInput","React","ref","onSearch","props","useLocalization","texts","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","keyCode","keycode","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","onKeyDown"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,OAExCE,GAFwC;MACtCC,gBAAAA;MAAaC;;AAGf,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AAEA,MAAMC,WAAW,GAAG,SAAdA,WAAc;AAChB,QAAI,CAACH,KAAK,CAACI,QAAX,EAAqB;AACjBL,MAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGC,KAAK,CAACK,KAAT,CAAR;AACH;AACJ,GAJD;;AAMA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;AAClB,QAAMC,iBAAiB,GAAGD,KAAK,CAACE,OAAN,KAAkBC,OAAO,CAAC,OAAD,CAAnD;;AAEA,QAAIF,iBAAJ,EAAuB;AACnBL,MAAAA,WAAW;AACd;AACJ,GAND;;AAQA,SACIN,aAAA,CAACc,KAAD;kBACgBT,KAAK,CAACU,WAAN,CAAkBC;KAC1Bb;AACJc,IAAAA,MAAM,EACFjB,aAAA,CAACkB,UAAD;AACIC,MAAAA,IAAI,EAAC;AACLC,MAAAA,SAAS,EAAC;AACVb,MAAAA,QAAQ,EAAEJ,KAAK,CAACI;AAChBc,MAAAA,OAAO,EAAEf;KAJb;AAOJgB,IAAAA,SAAS,EAAEb;AACXR,IAAAA,GAAG,EAAEA;IAZT,CADJ;AAgBH,CApC0B;;;;"}
1
+ {"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\n\nexport type SearchInputTexts = {\n /**\n * aria-label text for input\n */\n inputLabel: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n if (!props.disabled) {\n onSearch?.(props.value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const isEnterKeyPressed = event.keyCode === keycode('enter');\n\n if (isEnterKeyPressed) {\n handleClick();\n }\n };\n\n return (\n <Input\n aria-label={texts.searchInput.inputLabel}\n {...props}\n button={\n <IconButton\n icon=\"search\"\n className=\"!border-transparent !bg-transparent\"\n disabled={props.disabled}\n onClick={handleClick}\n />\n }\n onKeyDown={handleKeyDown}\n ref={ref}\n type=\"search\"\n />\n );\n});\n"],"names":["SearchInput","React","ref","onSearch","props","useLocalization","texts","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","keyCode","keycode","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","onKeyDown","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,OAExCE,GAFwC;MACtCC,gBAAAA;MAAaC;;AAGf,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AAEA,MAAMC,WAAW,GAAG,SAAdA,WAAc;AAChB,QAAI,CAACH,KAAK,CAACI,QAAX,EAAqB;AACjBL,MAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGC,KAAK,CAACK,KAAT,CAAR;AACH;AACJ,GAJD;;AAMA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;AAClB,QAAMC,iBAAiB,GAAGD,KAAK,CAACE,OAAN,KAAkBC,OAAO,CAAC,OAAD,CAAnD;;AAEA,QAAIF,iBAAJ,EAAuB;AACnBL,MAAAA,WAAW;AACd;AACJ,GAND;;AAQA,SACIN,aAAA,CAACc,KAAD;kBACgBT,KAAK,CAACU,WAAN,CAAkBC;KAC1Bb;AACJc,IAAAA,MAAM,EACFjB,aAAA,CAACkB,UAAD;AACIC,MAAAA,IAAI,EAAC;AACLC,MAAAA,SAAS,EAAC;AACVb,MAAAA,QAAQ,EAAEJ,KAAK,CAACI;AAChBc,MAAAA,OAAO,EAAEf;KAJb;AAOJgB,IAAAA,SAAS,EAAEb;AACXR,IAAAA,GAAG,EAAEA;AACLsB,IAAAA,IAAI,EAAC;IAbT,CADJ;AAiBH,CArC0B;;;;"}
@@ -11,9 +11,11 @@ var useTableKeyboardNavigation = function useTableKeyboardNavigation(props, rows
11
11
  setActiveIndex = _React$useState[1];
12
12
 
13
13
  var onKeyDown = function onKeyDown(event) {
14
+ var _document$activeEleme;
15
+
14
16
  var isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;
15
17
 
16
- if (useGlobalKeyboardNavigation && !(document.activeElement === ref.current || document.activeElement === document.body)) {
18
+ if (useGlobalKeyboardNavigation && document.activeElement !== ref.current && ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('type')) !== 'search' && document.activeElement !== document.body) {
17
19
  return;
18
20
  } // abort key handling if other elements inside table are focused and we don't use global keyboard navigation
19
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"useTableKeyboardNavigation.js","sources":["../../../../../src/components/Table/hooks/useTableKeyboardNavigation.ts"],"sourcesContent":["import React from 'react';\nimport keycode from 'keycode';\nimport { getNextIndexFromKeycode } from '../../../utils/hooks/useListKeyboardNavigation';\nimport { sanitizeRowProps } from '../util';\nimport { TableProps } from '../types';\n\nexport const useTableKeyboardNavigation = <T extends {}>(\n props: TableProps<T>,\n rows: any[],\n rowProps: any,\n ref: React.RefObject<HTMLDivElement>\n): [\n number | undefined,\n (index: number) => void,\n (event: React.KeyboardEvent<HTMLElement>) => void,\n (event: React.FocusEvent<HTMLElement>) => void\n] => {\n const useGlobalKeyboardNavigation = props.dangerouslyHijackGlobalKeyboardNavigation;\n const [activeIndex, setActiveIndex] = React.useState<number | undefined>(useGlobalKeyboardNavigation ? 0 : undefined);\n\n const onKeyDown = (event: KeyboardEvent): void => {\n const isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;\n\n if (\n useGlobalKeyboardNavigation &&\n !(document.activeElement === ref.current || document.activeElement === document.body)\n ) {\n return;\n }\n // abort key handling if other elements inside table are focused and we don't use global keyboard navigation\n if (!useGlobalKeyboardNavigation && document.activeElement !== ref.current) {\n return;\n }\n\n if (activeIndex !== undefined) {\n const currentRow = rows[activeIndex];\n\n if (currentRow) {\n const sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);\n\n if (rowProps.onRowClick && event.keyCode === keycode('enter')) {\n event.preventDefault();\n rowProps.onRowClick(sanitizedRow);\n return;\n }\n\n if (currentRow.toggleRowSelected && event.keyCode === keycode('space')) {\n event.preventDefault();\n currentRow.toggleRowSelected();\n return;\n }\n\n if (currentRow.toggleRowExpanded) {\n if (currentRow.isExpanded && event.keyCode === keycode('left')) {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n } else if (!currentRow.isExpanded && event.keyCode === keycode('right')) {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n }\n }\n\n // inline editing\n if (currentRow.toggleRowEditing) {\n if (currentRow.canEdit && !currentRow.isEditing) {\n if (rowProps.onRowCreate && event.shiftKey && event.keyCode === keycode('n')) {\n event.preventDefault();\n\n if (!currentRow.isExpanded) {\n currentRow.toggleRowExpanded();\n }\n\n rowProps.onRowCreate(sanitizedRow, event);\n return;\n }\n\n if (event.keyCode === keycode('e')) {\n event.preventDefault();\n currentRow.toggleRowEditing();\n return;\n }\n }\n }\n\n if (rowProps.onRowEdit && event.keyCode === keycode('e') && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowEdit(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowCopy && event.keyCode === keycode('c') && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowCopy(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowDelete && event.keyCode === keycode('delete') && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowDelete(sanitizedRow, event);\n return;\n }\n }\n }\n\n const nextIndex = getNextIndexFromKeycode(event.keyCode, rows.length, activeIndex);\n\n if (nextIndex !== undefined) {\n event.preventDefault();\n setActiveIndex(nextIndex);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n if (!useGlobalKeyboardNavigation) {\n onKeyDown(event.nativeEvent);\n }\n };\n\n React.useEffect(() => {\n if (useGlobalKeyboardNavigation) {\n window.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n if (useGlobalKeyboardNavigation) {\n window.removeEventListener('keydown', onKeyDown);\n }\n };\n }, [onKeyDown]);\n\n const handleFocus = (): void => {\n if (activeIndex === undefined && rows.length) {\n setActiveIndex(0);\n }\n };\n\n return [activeIndex, setActiveIndex, handleKeyDown, handleFocus];\n};\n"],"names":["useTableKeyboardNavigation","props","rows","rowProps","ref","useGlobalKeyboardNavigation","dangerouslyHijackGlobalKeyboardNavigation","React","useState","undefined","activeIndex","setActiveIndex","onKeyDown","event","isModifierKeyPressed","metaKey","ctrlKey","altKey","shiftKey","document","activeElement","current","body","currentRow","sanitizedRow","sanitizeRowProps","rowExpansionRenderer","onRowClick","keyCode","keycode","preventDefault","toggleRowSelected","toggleRowExpanded","isExpanded","toggleRowEditing","canEdit","isEditing","onRowCreate","onRowEdit","onRowCopy","onRowDelete","nextIndex","getNextIndexFromKeycode","length","handleKeyDown","nativeEvent","useEffect","window","addEventListener","removeEventListener","handleFocus"],"mappings":";;;;;IAMaA,0BAA0B,GAAG,SAA7BA,0BAA6B,CACtCC,KADsC,EAEtCC,IAFsC,EAGtCC,QAHsC,EAItCC,GAJsC;AAWtC,MAAMC,2BAA2B,GAAGJ,KAAK,CAACK,yCAA1C;;AACA,wBAAsCC,cAAK,CAACC,QAAN,CAAmCH,2BAA2B,GAAG,CAAH,GAAOI,SAArE,CAAtC;AAAA,MAAOC,WAAP;AAAA,MAAoBC,cAApB;;AAEA,MAAMC,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iC,aAA9B,EAA6CM,WAA7C,CAAP;AACH;;;;"}
1
+ {"version":3,"file":"useTableKeyboardNavigation.js","sources":["../../../../../src/components/Table/hooks/useTableKeyboardNavigation.ts"],"sourcesContent":["import React from 'react';\nimport keycode from 'keycode';\nimport { getNextIndexFromKeycode } from '../../../utils/hooks/useListKeyboardNavigation';\nimport { sanitizeRowProps } from '../util';\nimport { TableProps } from '../types';\n\nexport const useTableKeyboardNavigation = <T extends {}>(\n props: TableProps<T>,\n rows: any[],\n rowProps: any,\n ref: React.RefObject<HTMLDivElement>\n): [\n number | undefined,\n (index: number) => void,\n (event: React.KeyboardEvent<HTMLElement>) => void,\n (event: React.FocusEvent<HTMLElement>) => void\n] => {\n const useGlobalKeyboardNavigation = props.dangerouslyHijackGlobalKeyboardNavigation;\n const [activeIndex, setActiveIndex] = React.useState<number | undefined>(useGlobalKeyboardNavigation ? 0 : undefined);\n\n const onKeyDown = (event: KeyboardEvent): void => {\n const isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;\n\n if (\n useGlobalKeyboardNavigation &&\n document.activeElement !== ref.current &&\n document.activeElement?.getAttribute('type') !== 'search' &&\n document.activeElement !== document.body\n ) {\n return;\n }\n // abort key handling if other elements inside table are focused and we don't use global keyboard navigation\n if (!useGlobalKeyboardNavigation && document.activeElement !== ref.current) {\n return;\n }\n\n if (activeIndex !== undefined) {\n const currentRow = rows[activeIndex];\n\n if (currentRow) {\n const sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);\n\n if (rowProps.onRowClick && event.keyCode === keycode('enter')) {\n event.preventDefault();\n rowProps.onRowClick(sanitizedRow);\n return;\n }\n\n if (currentRow.toggleRowSelected && event.keyCode === keycode('space')) {\n event.preventDefault();\n currentRow.toggleRowSelected();\n return;\n }\n\n if (currentRow.toggleRowExpanded) {\n if (currentRow.isExpanded && event.keyCode === keycode('left')) {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n } else if (!currentRow.isExpanded && event.keyCode === keycode('right')) {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n }\n }\n\n // inline editing\n if (currentRow.toggleRowEditing) {\n if (currentRow.canEdit && !currentRow.isEditing) {\n if (rowProps.onRowCreate && event.shiftKey && event.keyCode === keycode('n')) {\n event.preventDefault();\n\n if (!currentRow.isExpanded) {\n currentRow.toggleRowExpanded();\n }\n\n rowProps.onRowCreate(sanitizedRow, event);\n return;\n }\n\n if (event.keyCode === keycode('e')) {\n event.preventDefault();\n currentRow.toggleRowEditing();\n return;\n }\n }\n }\n\n if (rowProps.onRowEdit && event.keyCode === keycode('e') && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowEdit(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowCopy && event.keyCode === keycode('c') && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowCopy(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowDelete && event.keyCode === keycode('delete') && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowDelete(sanitizedRow, event);\n return;\n }\n }\n }\n\n const nextIndex = getNextIndexFromKeycode(event.keyCode, rows.length, activeIndex);\n\n if (nextIndex !== undefined) {\n event.preventDefault();\n setActiveIndex(nextIndex);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n if (!useGlobalKeyboardNavigation) {\n onKeyDown(event.nativeEvent);\n }\n };\n\n React.useEffect(() => {\n if (useGlobalKeyboardNavigation) {\n window.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n if (useGlobalKeyboardNavigation) {\n window.removeEventListener('keydown', onKeyDown);\n }\n };\n }, [onKeyDown]);\n\n const handleFocus = (): void => {\n if (activeIndex === undefined && rows.length) {\n setActiveIndex(0);\n }\n };\n\n return [activeIndex, setActiveIndex, handleKeyDown, handleFocus];\n};\n"],"names":["useTableKeyboardNavigation","props","rows","rowProps","ref","useGlobalKeyboardNavigation","dangerouslyHijackGlobalKeyboardNavigation","React","useState","undefined","activeIndex","setActiveIndex","onKeyDown","event","isModifierKeyPressed","metaKey","ctrlKey","altKey","shiftKey","document","activeElement","current","getAttribute","body","currentRow","sanitizedRow","sanitizeRowProps","rowExpansionRenderer","onRowClick","keyCode","keycode","preventDefault","toggleRowSelected","toggleRowExpanded","isExpanded","toggleRowEditing","canEdit","isEditing","onRowCreate","onRowEdit","onRowCopy","onRowDelete","nextIndex","getNextIndexFromKeycode","length","handleKeyDown","nativeEvent","useEffect","window","addEventListener","removeEventListener","handleFocus"],"mappings":";;;;;IAMaA,0BAA0B,GAAG,SAA7BA,0BAA6B,CACtCC,KADsC,EAEtCC,IAFsC,EAGtCC,QAHsC,EAItCC,GAJsC;AAWtC,MAAMC,2BAA2B,GAAGJ,KAAK,CAACK,yCAA1C;;AACA,wBAAsCC,cAAK,CAACC,QAAN,CAAmCH,2BAA2B,GAAG,CAAH,GAAOI,SAArE,CAAtC;AAAA,MAAOC,WAAP;AAAA,MAAoBC,cAApB;;AAEA,MAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;;;AACd,QAAMC,oBAAoB,GAAGD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,OAAvB,IAAkCH,KAAK,CAACI,MAAxC,IAAkDJ,KAAK,CAACK,QAArF;;AAEA,QACIb,2BAA2B,IAC3Bc,QAAQ,CAACC,aAAT,KAA2BhB,GAAG,CAACiB,OAD/B,IAEA,0BAAAF,QAAQ,CAACC,aAAT,gFAAwBE,YAAxB,CAAqC,MAArC,OAAiD,QAFjD,IAGAH,QAAQ,CAACC,aAAT,KAA2BD,QAAQ,CAACI,IAJxC,EAKE;AACE;AACH;;;AAED,QAAI,CAAClB,2BAAD,IAAgCc,QAAQ,CAACC,aAAT,KAA2BhB,GAAG,CAACiB,OAAnE,EAA4E;AACxE;AACH;;AAED,QAAIX,WAAW,KAAKD,SAApB,EAA+B;AAC3B,UAAMe,UAAU,GAAGtB,IAAI,CAACQ,WAAD,CAAvB;;AAEA,UAAIc,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,SAAD,CAAd;AACH;AACJ,GA9FD;;AAgGA,MAAMG,aAAa,GAAG,SAAhBA,aAAgB,CAAChC,KAAD;AAClB,QAAI,CAACR,2BAAL,EAAkC;AAC9BO,MAAAA,SAAS,CAACC,KAAK,CAACiC,WAAP,CAAT;AACH;AACJ,GAJD;;AAMAvC,EAAAA,cAAK,CAACwC,SAAN,CAAgB;AACZ,QAAI1C,2BAAJ,EAAiC;AAC7B2C,MAAAA,MAAM,CAACC,gBAAP,CAAwB,SAAxB,EAAmCrC,SAAnC;AACH;;AAED,WAAO;AACH,UAAIP,2BAAJ,EAAiC;AAC7B2C,QAAAA,MAAM,CAACE,mBAAP,CAA2B,SAA3B,EAAsCtC,SAAtC;AACH;AACJ,KAJD;AAKH,GAVD,EAUG,CAACA,SAAD,CAVH;;AAYA,MAAMuC,WAAW,GAAG,SAAdA,WAAc;AAChB,QAAIzC,WAAW,KAAKD,SAAhB,IAA6BP,IAAI,CAAC0C,MAAtC,EAA8C;AAC1CjC,MAAAA,cAAc,CAAC,CAAD,CAAd;AACH;AACJ,GAJD;;AAMA,SAAO,CAACD,WAAD,EAAcC,cAAd,EAA8BkC,aAA9B,EAA6CM,WAA7C,CAAP;AACH;;;;"}
@@ -3,13 +3,31 @@ 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", "state"];
6
+ var _excluded = ["defaultValue", "highlighted", "onKeyDown", "state"];
7
7
  var Textarea = /*#__PURE__*/forwardRef(function Textarea(props, ref) {
8
- var otherProps = _objectWithoutPropertiesLoose(props, _excluded);
8
+ var onKeyDown = props.onKeyDown,
9
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
10
+
11
+ var classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className); // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll
12
+ // if it has scroll height then the browser reverts to native scrolling behaviour only
13
+ // so we manually override it to ensure _our_ desired behaviour remains intact
14
+
15
+ var handleKeyDown = function handleKeyDown(event) {
16
+ if (event.key === 'Home' || event.key === 'End') {
17
+ event.preventDefault();
18
+ var position = event.key === 'End' ? event.currentTarget.value.length : 0;
19
+ event.currentTarget.setSelectionRange(position, position);
20
+ event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;
21
+ }
22
+
23
+ if (onKeyDown) {
24
+ onKeyDown(event);
25
+ }
26
+ };
9
27
 
10
- var classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);
11
28
  return createElement("textarea", Object.assign({}, otherProps, {
12
29
  className: classNames,
30
+ onKeyDown: handleKeyDown,
13
31
  ref: ref
14
32
  }));
15
33
  });
@@ -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, state, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n return <textarea {...otherProps} className={classNames} ref={ref} />;\n});\n"],"names":["Textarea","React","props","ref","otherProps","classNames","cn","getInputClasses","className"],"mappings":";;;;;;IAcaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;AACrC,MAAgDC,UAAhD,iCAA+DF,KAA/D;;AACA,MAAMG,UAAU,GAAGC,EAAE,CAACC,eAAe,CAACL,KAAD,CAAhB,EAAyB,wCAAzB,EAAmEA,KAAK,CAACM,SAAzE,CAArB;AAEA,SAAOP,aAAA,WAAA,oBAAcG;AAAYI,IAAAA,SAAS,EAAEH;AAAYF,IAAAA,GAAG,EAAEA;IAAtD,CAAP;AACH,CALuB;;;;"}
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} 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;AAAYF,IAAAA,SAAS,EAAEM;AAAeP,IAAAA,GAAG,EAAEA;IAAhF,CAAP;AACH,CArBuB;;;;"}
@@ -129,8 +129,11 @@
129
129
  @apply border-none;
130
130
  }
131
131
 
132
- [data-radix-portal][aria-hidden] {
133
- display: none;
132
+ input[type='search']::-webkit-search-decoration,
133
+ input[type='search']::-webkit-search-cancel-button,
134
+ input[type='search']::-webkit-search-results-button,
135
+ input[type='search']::-webkit-search-results-decoration {
136
+ -webkit-appearance: none;
134
137
  }
135
138
 
136
139
  @keyframes fade-in {
@@ -393,8 +396,9 @@
393
396
  bottom: 3px;
394
397
  }
395
398
 
396
- [data-taco='dialog'] *:last-child {
397
- @apply mb-0;
399
+ /* label inside label is invalid html, but the client is littered with it */
400
+ [data-taco='label'] [data-taco='label'] {
401
+ min-height: 0;
398
402
  }
399
403
 
400
404
  .yt-form > [data-taco='button'] {
@@ -429,11 +433,6 @@
429
433
  @apply mb-0;
430
434
  }
431
435
 
432
- /* label inside label is invalid html, but the client is littered with it */
433
- [data-taco='label'] [data-taco='label'] {
434
- min-height: 0;
435
- }
436
-
437
436
  .yt-navigation__item a,
438
437
  .yt-navigation__item .yt-navigation__item__postfix {
439
438
  @apply text-black;
package/dist/esm/index.js CHANGED
@@ -16,16 +16,17 @@ export { Checkbox } from './components/Checkbox/Checkbox.js';
16
16
  export { Input } from './components/Input/Input.js';
17
17
  export { getNextIndexFromKeycode, useListKeyboardNavigation } from './utils/hooks/useListKeyboardNavigation.js';
18
18
  export { useListScrollTo } from './utils/hooks/useListScrollTo.js';
19
+ export { useBoundingClientRectListener } from './utils/hooks/useBoundingClientRectListener.js';
19
20
  export { Combobox } from './components/Combobox/Combobox.js';
20
21
  export { format, parseFromCustomString, parseFromISOString } from './utils/date.js';
21
22
  export { Popover } from './components/Popover/Popover.js';
22
23
  export { Datepicker } from './components/Datepicker/Datepicker.js';
23
24
  export { Dialog } from './components/Dialog/Dialog.js';
25
+ export { Field } from './components/Field/Field.js';
24
26
  export { Form } from './components/Form/Form.js';
25
27
  export { Group } from './components/Group/Group.js';
26
28
  export { Hanger } from './components/Hanger/Hanger.js';
27
29
  export { SearchInput } from './components/SearchInput/SearchInput.js';
28
- export { Label } from './components/Label/Label.js';
29
30
  export { Listbox, MultiListbox } from './components/Listbox/Listbox.js';
30
31
  export { RadioGroup, findByValue, getRadioGroupItemValueAsString, useRadioGroup } from './components/RadioGroup/RadioGroup.js';
31
32
  export { Menu } from './components/Menu/Menu.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.css CHANGED
@@ -129,8 +129,11 @@
129
129
  @apply border-none;
130
130
  }
131
131
 
132
- [data-radix-portal][aria-hidden] {
133
- display: none;
132
+ input[type='search']::-webkit-search-decoration,
133
+ input[type='search']::-webkit-search-cancel-button,
134
+ input[type='search']::-webkit-search-results-button,
135
+ input[type='search']::-webkit-search-results-decoration {
136
+ -webkit-appearance: none;
134
137
  }
135
138
 
136
139
  @keyframes fade-in {
@@ -393,8 +396,9 @@
393
396
  bottom: 3px;
394
397
  }
395
398
 
396
- [data-taco='dialog'] *:last-child {
397
- @apply mb-0;
399
+ /* label inside label is invalid html, but the client is littered with it */
400
+ [data-taco='label'] [data-taco='label'] {
401
+ min-height: 0;
398
402
  }
399
403
 
400
404
  .yt-form > [data-taco='button'] {
@@ -429,11 +433,6 @@
429
433
  @apply mb-0;
430
434
  }
431
435
 
432
- /* label inside label is invalid html, but the client is littered with it */
433
- [data-taco='label'] [data-taco='label'] {
434
- min-height: 0;
435
- }
436
-
437
436
  .yt-navigation__item a,
438
437
  .yt-navigation__item .yt-navigation__item__postfix {
439
438
  @apply text-black;
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './components/Checkbox/Checkbox';
9
9
  export * from './components/Combobox/Combobox';
10
10
  export * from './components/Datepicker/Datepicker';
11
11
  export * from './components/Dialog/Dialog';
12
+ export * from './components/Field/Field';
12
13
  export * from './components/Form/Form';
13
14
  export * from './components/Group/Group';
14
15
  export * from './components/Hanger/Hanger';
@@ -16,7 +17,6 @@ export * from './components/Icon/Icon';
16
17
  export * from './components/IconButton/IconButton';
17
18
  export * from './components/Input/Input';
18
19
  export * from './components/SearchInput/SearchInput';
19
- export * from './components/Label/Label';
20
20
  export * from './components/Listbox/Listbox';
21
21
  export * from './components/Menu/Menu';
22
22
  export * from './components/Navigation/Navigation';
@@ -37,6 +37,7 @@ export * from './components/Tour/Tour';
37
37
  export * from './components/Treeview/Treeview';
38
38
  export * from './components/VisuallyHidden/VisuallyHidden';
39
39
  export * from './utils/date';
40
+ export * from './utils/hooks/useBoundingClientRectListener';
40
41
  export * from './utils/hooks/useListKeyboardNavigation';
41
42
  export * from './utils/hooks/useOnClickOutside';
42
43
  export * from './utils/hooks/useListScrollTo';