@economic/taco 1.17.3 → 1.18.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 (44) hide show
  1. package/dist/components/Icon/components/index.d.ts +1 -1
  2. package/dist/components/Input/Input.d.ts +1 -1
  3. package/dist/components/Menu/components/Item.d.ts +1 -1
  4. package/dist/components/Menu/components/Link.d.ts +1 -1
  5. package/dist/components/Progress/Progress.stories.d.ts +1 -0
  6. package/dist/components/Select2/Select2.stories.d.ts +1 -0
  7. package/dist/components/Select2/components/Edit.d.ts +2 -2
  8. package/dist/components/Select2/components/Option.d.ts +1 -1
  9. package/dist/components/Select2/components/Search.d.ts +1 -1
  10. package/dist/components/Tag/Tag.d.ts +14 -3
  11. package/dist/esm/index.css +3 -3
  12. package/dist/esm/packages/taco/src/components/Button/util.js +3 -3
  13. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +1 -1
  15. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Icon/components/index.js +0 -2
  17. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Input/util.js +1 -1
  19. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +1 -1
  21. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Select2/Select2.js +19 -0
  23. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +3 -3
  25. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +7 -7
  27. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -1
  29. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Tag/Tag.js +13 -3
  31. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  32. package/dist/esm/packages/taco/src/index.js +1 -1
  33. package/dist/index.css +3 -3
  34. package/dist/taco.cjs.development.js +51 -49
  35. package/dist/taco.cjs.development.js.map +1 -1
  36. package/dist/taco.cjs.production.min.js +1 -1
  37. package/dist/taco.cjs.production.min.js.map +1 -1
  38. package/package.json +2 -2
  39. package/types.json +16 -5
  40. package/dist/components/Icon/components/Spinner.d.ts +0 -3
  41. package/dist/esm/packages/taco/src/components/Icon/components/Spinner.js +0 -20
  42. package/dist/esm/packages/taco/src/components/Icon/components/Spinner.js.map +0 -1
  43. package/dist/esm/packages/taco/src/utils/colors.js +0 -14
  44. package/dist/esm/packages/taco/src/utils/colors.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Select2/components/Trigger.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Tag } from '../../Tag/Tag';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Icon } from '../../Icon/Icon';\nimport { Badge } from '../../Badge/Badge';\nimport { getInputClasses } from '../../Input/util';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { getIndexOfFirstChildOverflowingParent } from '../../../utils/dom';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\n\ntype Select2TriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n children: React.ReactElement<Select2OptionProps>[];\n};\n\nexport const Trigger = React.forwardRef<HTMLButtonElement, Select2TriggerProps>(function Select2Trigger(props, ref) {\n const { multiple, value } = useSelect2Context();\n\n if (Array.isArray(value) || multiple) {\n const values = Array.isArray(value) ? value : value !== undefined ? [value] : undefined;\n return <Multiple {...props} ref={ref} values={values} />;\n }\n\n return <Single {...props} ref={ref} value={value} />;\n});\n\ntype ButtonProps = React.HTMLAttributes<HTMLButtonElement> &\n Omit<Select2TriggerProps, 'children' | 'open' | 'setValue' | 'value'>;\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Select2TriggerButton(props, ref) {\n const { children, onClick, tabIndex = 0, ...otherProps } = props;\n const { disabled, highlighted, invalid, open, readOnly } = useSelect2Context();\n\n const className = cn(\n 'cursor-pointer !px-1.5',\n getInputClasses({ ...props, disabled, highlighted, invalid, readOnly }).replace('w-full', ''),\n { 'w-full': !props.className?.includes('w-') },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n event.preventDefault();\n return;\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n return (\n <button\n {...otherProps}\n aria-invalid={invalid ? true : undefined}\n aria-readonly={readOnly ? true : undefined}\n className={className}\n disabled={disabled}\n onClick={handleClick}\n ref={ref}\n role=\"combobox\"\n tabIndex={disabled || readOnly ? -1 : tabIndex}\n type=\"button\">\n {children}\n <Icon name={open ? 'chevron-up' : 'chevron-down'} className=\"pointer-events-none -mr-1 ml-auto\" />\n </button>\n );\n});\n\ntype SingleProps = Omit<Select2TriggerProps, 'value'> & { value?: Select2OptionValue };\n\nconst Single = React.forwardRef<HTMLButtonElement, SingleProps>(function Select2TriggerSingle(props, ref) {\n const { children, value, ...buttonProps } = props;\n const { disabled, readOnly, tags } = useSelect2Context();\n const contentClassName = cn('truncate flex items-center gap-1');\n\n const currentValue = children.find(matchesValue(value));\n\n let output;\n\n if (currentValue) {\n if (tags) {\n output = (\n <Tag\n className=\"truncate\"\n color={currentValue.props.color}\n disabled={disabled}\n icon={currentValue.props.icon}\n readOnly={readOnly}>\n {currentValue.props.children}\n </Tag>\n );\n } else {\n output = (\n <>\n {currentValue.props.icon ? (\n typeof currentValue.props.icon === 'string' ? (\n <Icon name={currentValue.props.icon} />\n ) : (\n currentValue.props.icon\n )\n ) : null}\n {currentValue.props.children}\n </>\n );\n }\n }\n\n return (\n <Button {...buttonProps} ref={ref}>\n <span className={contentClassName}>{output}</span>\n </Button>\n );\n});\n\ntype MultipleProps = Omit<Select2TriggerProps, 'value'> & {\n values?: Select2OptionValue[];\n};\n\nconst Multiple = React.forwardRef<HTMLButtonElement, MultipleProps>(function Select2TriggerMultiple(props, ref) {\n const { children, values = [], ...buttonProps } = props;\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const buttonRef = useMergedRef<HTMLButtonElement>(ref);\n\n const valuesAsChildren = values.map(value =>\n children.find(c => c.props.value === value)\n ) as React.ReactElement<Select2OptionProps>[];\n\n let content;\n let { className } = buttonProps;\n\n if (open) {\n className = cn('absolute z-20', buttonProps.className);\n content = (\n <ScrollArea className=\"my-1 flex max-h-[5.5rem] flex-col\">\n <span className=\"flex flex-wrap gap-1\">\n {valuesAsChildren.map(child => (\n <Tag\n key={child.props.value}\n className=\"truncate\"\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.icon}\n onDelete={event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(child.props.value);\n }\n }}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n ))}\n </span>\n </ScrollArea>\n );\n } else {\n content = <MultipleValue key={String(open)} valuesAsChildren={valuesAsChildren} />;\n }\n\n return (\n <span\n className={cn('relative inline-flex flex-grow', { 'h-8': open })}\n style={{ width: open ? buttonRef.current?.offsetWidth : undefined }}>\n <Button {...buttonProps} className={className} ref={buttonRef}>\n {content}\n </Button>\n </span>\n );\n});\n\nconst MultipleValue = ({ valuesAsChildren }) => {\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const [contentRef, setContentRef] = React.useState<HTMLSpanElement | null>(null);\n const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;\n\n const createClickHandler = tagValue => event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(tagValue);\n }\n };\n\n return (\n <span className=\"relative flex items-center gap-1 overflow-hidden\">\n <span className=\"flex gap-1 truncate\" ref={el => setContentRef(el)}>\n {valuesAsChildren.map((child, index) => {\n const tag = (\n <Tag\n key={child.props.value}\n className={cn('cursor-pointer', {\n truncate: index === boundaryIndex,\n hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false,\n })}\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.icon}\n onDelete={open ? createClickHandler(child.props.value) : undefined}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n );\n\n if (index === boundaryIndex) {\n return (\n <Tooltip key={child.props.value} title={String(child.props.children)}>\n {tag}\n </Tooltip>\n );\n }\n\n return tag;\n })}\n </span>\n {boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (\n <Tooltip\n title={valuesAsChildren\n .slice(boundaryIndex + 1)\n .map(child => (child ? String(child.props.children) : ''))\n .join(', ')}>\n <Badge className=\"flex-shrink-0\">+{valuesAsChildren.length - (boundaryIndex + 1)}</Badge>\n </Tooltip>\n ) : null}\n </span>\n );\n};\n\nconst matchesValue = (value: undefined | any | any[]) => (child: React.ReactElement<any>) => {\n if (Array.isArray(value)) {\n return value.includes(child.props.value);\n }\n\n return child.props.value === value;\n};\n"],"names":["Trigger","React","forwardRef","Select2Trigger","props","ref","multiple","value","useSelect2Context","Array","isArray","values","undefined","Multiple","Single","Button","Select2TriggerButton","children","onClick","tabIndex","otherProps","disabled","highlighted","invalid","open","readOnly","className","cn","getInputClasses","replace","includes","handleClick","event","preventDefault","role","type","Icon","name","Select2TriggerSingle","buttonProps","tags","contentClassName","currentValue","find","matchesValue","output","Tag","color","icon","Select2TriggerMultiple","setValue","buttonRef","useMergedRef","valuesAsChildren","map","c","content","ScrollArea","child","key","onDelete","stopPropagation","MultipleValue","String","style","width","current","offsetWidth","contentRef","setContentRef","useState","boundaryIndex","getIndexOfFirstChildOverflowingParent","createClickHandler","tagValue","el","index","tag","truncate","hidden","Tooltip","title","length","slice","join","Badge"],"mappings":";;;;;;;;;;;;MAkBaA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAyC,SAASC,cAAc,CAACC,KAAK,EAAEC,GAAG;EAC9G,MAAM;IAAEC,QAAQ;IAAEC;GAAO,GAAGC,iBAAiB,EAAE;EAE/C,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAID,QAAQ,EAAE;IAClC,MAAMK,MAAM,GAAGF,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,KAAKK,SAAS,GAAG,CAACL,KAAK,CAAC,GAAGK,SAAS;IACvF,oBAAOX,6BAACY,QAAQ,oBAAKT,KAAK;MAAEC,GAAG,EAAEA,GAAG;MAAEM,MAAM,EAAEA;OAAU;;EAG5D,oBAAOV,6BAACa,MAAM,oBAAKV,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEE,KAAK,EAAEA;KAAS;AACxD,CAAC;AAKD,MAAMQ,MAAM,gBAAGd,cAAK,CAACC,UAAU,CAAiC,SAASc,oBAAoB,CAACZ,KAAK,EAAEC,GAAG;;EACpG,MAAM;IAAEY,QAAQ;IAAEC,OAAO;IAAEC,QAAQ,GAAG,CAAC;IAAE,GAAGC;GAAY,GAAGhB,KAAK;EAChE,MAAM;IAAEiB,QAAQ;IAAEC,WAAW;IAAEC,OAAO;IAAEC,IAAI;IAAEC;GAAU,GAAGjB,iBAAiB,EAAE;EAE9E,MAAMkB,SAAS,GAAGC,EAAE,CAChB,wBAAwB,EACxBC,eAAe,CAAC;IAAE,GAAGxB,KAAK;IAAEiB,QAAQ;IAAEC,WAAW;IAAEC,OAAO;IAAEE;GAAU,CAAC,CAACI,OAAO,CAAC,QAAQ,EAAE,EAAE,CA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AAC,EAAE;IACtB,OAAOA,KAAK,CAACuB,QAAQ,CAAC4B,KAAK,CAACtD,KAAK,CAACG,KAAK,CAAC;;EAG5C,OAAOmD,KAAK,CAACtD,KAAK,CAACG,KAAK,KAAKA,KAAK;AACtC,CAAC;;;;"}
1
+ {"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Select2/components/Trigger.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Tag } from '../../Tag/Tag';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Icon } from '../../Icon/Icon';\nimport { Badge } from '../../Badge/Badge';\nimport { getInputClasses } from '../../Input/util';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { getIndexOfFirstChildOverflowingParent } from '../../../utils/dom';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\n\ntype Select2TriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n children: React.ReactElement<Select2OptionProps>[];\n};\n\nexport const Trigger = React.forwardRef<HTMLButtonElement, Select2TriggerProps>(function Select2Trigger(props, ref) {\n const { multiple, value } = useSelect2Context();\n\n if (Array.isArray(value) || multiple) {\n const values = Array.isArray(value) ? value : value !== undefined ? [value] : undefined;\n return <Multiple {...props} ref={ref} values={values} />;\n }\n\n return <Single {...props} ref={ref} value={value} />;\n});\n\ntype ButtonProps = React.HTMLAttributes<HTMLButtonElement> &\n Omit<Select2TriggerProps, 'children' | 'open' | 'setValue' | 'value'>;\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Select2TriggerButton(props, ref) {\n const { children, onClick, tabIndex = 0, ...otherProps } = props;\n const { disabled, highlighted, invalid, open, readOnly } = useSelect2Context();\n\n const className = cn(\n 'cursor-pointer !px-1.5',\n getInputClasses({ ...props, disabled, highlighted, invalid, readOnly }).replace('w-full', ''),\n { 'w-full': !props.className?.includes('w-') },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n event.preventDefault();\n return;\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n return (\n <button\n {...otherProps}\n aria-invalid={invalid ? true : undefined}\n aria-readonly={readOnly ? true : undefined}\n className={className}\n disabled={disabled}\n onClick={handleClick}\n ref={ref}\n role=\"combobox\"\n tabIndex={disabled || readOnly ? -1 : tabIndex}\n type=\"button\">\n {children}\n <Icon name={open ? 'chevron-up' : 'chevron-down'} className=\"pointer-events-none -mr-1 ml-auto\" />\n </button>\n );\n});\n\ntype SingleProps = Omit<Select2TriggerProps, 'value'> & { value?: Select2OptionValue };\n\nconst Single = React.forwardRef<HTMLButtonElement, SingleProps>(function Select2TriggerSingle(props, ref) {\n const { children, value, ...buttonProps } = props;\n const { disabled, readOnly, tags } = useSelect2Context();\n const contentClassName = cn('truncate items-center gap-1');\n\n const currentValue = children.find(matchesValue(value));\n\n let output;\n\n if (currentValue) {\n if (tags) {\n output = (\n <Tag\n className=\"truncate\"\n color={currentValue.props.color}\n disabled={disabled}\n icon={currentValue.props.icon}\n readOnly={readOnly}>\n {currentValue.props.children}\n </Tag>\n );\n } else {\n output = (\n <>\n {currentValue.props.icon ? (\n typeof currentValue.props.icon === 'string' ? (\n <Icon name={currentValue.props.icon} />\n ) : (\n currentValue.props.icon\n )\n ) : null}\n {currentValue.props.children}\n </>\n );\n }\n }\n\n return (\n <Button {...buttonProps} ref={ref}>\n <div className={contentClassName}>{output}</div>\n </Button>\n );\n});\n\ntype MultipleProps = Omit<Select2TriggerProps, 'value'> & {\n values?: Select2OptionValue[];\n};\n\nconst Multiple = React.forwardRef<HTMLButtonElement, MultipleProps>(function Select2TriggerMultiple(props, ref) {\n const { children, values = [], ...buttonProps } = props;\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const buttonRef = useMergedRef<HTMLButtonElement>(ref);\n\n const valuesAsChildren = values.map(value =>\n children.find(c => c.props.value === value)\n ) as React.ReactElement<Select2OptionProps>[];\n\n let content;\n let { className } = buttonProps;\n\n if (open) {\n className = cn('!absolute z-20', buttonProps.className);\n content = (\n <ScrollArea className=\"my-1 flex max-h-[5.5rem] flex-col\">\n <div className=\"flex flex-wrap gap-1\">\n {valuesAsChildren.map(child => (\n <Tag\n key={child.props.value}\n className=\"truncate\"\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.icon}\n onDelete={event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(child.props.value);\n }\n }}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n ))}\n </div>\n </ScrollArea>\n );\n } else {\n content = <MultipleValue key={String(open)} valuesAsChildren={valuesAsChildren} />;\n }\n\n return (\n <div\n className={cn('relative inline-flex flex-grow', { 'h-8': open })}\n style={{ width: open ? buttonRef.current?.offsetWidth : undefined }}>\n <Button {...buttonProps} className={className} ref={buttonRef}>\n {content}\n </Button>\n </div>\n );\n});\n\nconst MultipleValue = ({ valuesAsChildren }) => {\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const [contentRef, setContentRef] = React.useState<HTMLDivElement | null>(null);\n const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;\n\n const createClickHandler = tagValue => event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(tagValue);\n }\n };\n\n return (\n <div className=\"relative flex items-center gap-1 overflow-hidden\">\n <div className=\"flex gap-1 truncate\" ref={el => setContentRef(el)}>\n {valuesAsChildren.map((child, index) => {\n const tag = (\n <Tag\n key={child.props.value}\n className={cn('cursor-pointer', {\n truncate: index === boundaryIndex,\n hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false,\n })}\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.icon}\n onDelete={open ? createClickHandler(child.props.value) : undefined}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n );\n\n if (index === boundaryIndex) {\n return (\n <Tooltip key={child.props.value} title={String(child.props.children)}>\n {tag}\n </Tooltip>\n );\n }\n\n return tag;\n })}\n </div>\n {boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (\n <Tooltip\n title={valuesAsChildren\n .slice(boundaryIndex + 1)\n .map(child => (child ? String(child.props.children) : ''))\n .join(', ')}>\n <Badge className=\"flex-shrink-0\">+{valuesAsChildren.length - (boundaryIndex + 1)}</Badge>\n </Tooltip>\n ) : null}\n </div>\n );\n};\n\nconst matchesValue = (value: undefined | any | any[]) => (child: React.ReactElement<any>) => {\n if (Array.isArray(value)) {\n return value.includes(child.props.value);\n }\n\n return child.props.value === value;\n};\n"],"names":["Trigger","React","forwardRef","Select2Trigger","props","ref","multiple","value","useSelect2Context","Array","isArray","values","undefined","Multiple","Single","Button","Select2TriggerButton","children","onClick","tabIndex","otherProps","disabled","highlighted","invalid","open","readOnly","className","cn","getInputClasses","replace","includes","handleClick","event","preventDefault","role","type","Icon","name","Select2TriggerSingle","buttonProps","tags","contentClassName","currentValue","find","matchesValue","output","Tag","color","icon","Select2TriggerMultiple","setValue","buttonRef","useMergedRef","valuesAsChildren","map","c","content","ScrollArea","child","key","onDelete","stopPropagation","MultipleValue","String","style","width","current","offsetWidth","contentRef","setContentRef","useState","boundaryIndex","getIndexOfFirstChildOverflowingParent","createClickHandler","tagValue","el","index","tag","truncate","hidden","Tooltip","title","length","slice","join","Badge"],"mappings":";;;;;;;;;;;;MAkBaA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAyC,SAASC,cAAc,CAACC,KAAK,EAAEC,GAAG;EAC9G,MAAM;IAAEC,QAAQ;IAAEC;GAAO,GAAGC,iBAAiB,EAAE;EAE/C,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAID,QAAQ,EAAE;IAClC,MAAMK,MAAM,GAAGF,KAAK,CAAC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AE;MACzB,oBACItE,6BAAC+E,OAAO;QAACrB,GAAG,EAAED,KAAK,CAACtD,KAAK,CAACG,KAAK;QAAE0E,KAAK,EAAElB,MAAM,CAACL,KAAK,CAACtD,KAAK,CAACa,QAAQ;SAC9D4D,GAAG,CACE;;IAIlB,OAAOA,GAAG;GACb,CAAC,CACA,EACLN,aAAa,KAAK3D,SAAS,IAAI2D,aAAa,KAAK,IAAI,IAAIA,aAAa,GAAGlB,gBAAgB,CAAC6B,MAAM,GAAG,CAAC,gBACjGjF,6BAAC+E,OAAO;IACJC,KAAK,EAAE5B,gBAAgB,CAClB8B,KAAK,CAACZ,aAAa,GAAG,CAAC,CAAC,CACxBjB,GAAG,CAACI,KAAK,IAAKA,KAAK,GAAGK,MAAM,CAACL,KAAK,CAACtD,KAAK,CAACa,QAAQ,CAAC,GAAG,EAAG,CAAC,CACzDmE,IAAI,CAAC,IAAI;kBACdnF,6BAACoF,KAAK;IAAC3D,SAAS,EAAC;UAAkB2B,gBAAgB,CAAC6B,MAAM,IAAIX,aAAa,GAAG,CAAC,CAAC,CAAS,CACnF,GACV,IAAI,CACN;AAEd,CAAC;AAED,MAAM3B,YAAY,GAAIrC,KAA8B,IAAMmD,KAA8B;EACpF,IAAIjD,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACuB,QAAQ,CAAC4B,KAAK,CAACtD,KAAK,CAACG,KAAK,CAAC;;EAG5C,OAAOmD,KAAK,CAACtD,KAAK,CAACG,KAAK,KAAKA,KAAK;AACtC,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- const createOptionClassName = () => 'group mb-px flex h-8 w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white hover:bg-grey-100 aria-current:bg-grey-100 aria-disabled:text-black/25 aria-disabled:pointer-events-none';
1
+ const createOptionClassName = () => 'group mb-px flex h-8 w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white hover:wcag-grey-200 aria-current:wcag-grey-200 aria-disabled:text-black/25 aria-disabled:pointer-events-none';
2
2
  const createCollectionClassName = () => 'flex flex-col gap-px';
3
3
 
4
4
  export { createCollectionClassName, createOptionClassName };
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.js","sources":["../../../../../../../src/components/Select2/utilities.ts"],"sourcesContent":["export const createOptionClassName = () =>\n 'group mb-px flex h-8 w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white hover:bg-grey-100 aria-current:bg-grey-100 aria-disabled:text-black/25 aria-disabled:pointer-events-none';\n\nexport const createCollectionClassName = () => 'flex flex-col gap-px';\n"],"names":["createOptionClassName","createCollectionClassName"],"mappings":"MAAaA,qBAAqB,GAAG,MACjC;MAESC,yBAAyB,GAAG,MAAM;;;;"}
1
+ {"version":3,"file":"utilities.js","sources":["../../../../../../../src/components/Select2/utilities.ts"],"sourcesContent":["export const createOptionClassName = () =>\n 'group mb-px flex h-8 w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white hover:wcag-grey-200 aria-current:wcag-grey-200 aria-disabled:text-black/25 aria-disabled:pointer-events-none';\n\nexport const createCollectionClassName = () => 'flex flex-col gap-px';\n"],"names":["createOptionClassName","createCollectionClassName"],"mappings":"MAAaA,qBAAqB,GAAG,MACjC;MAESC,yBAAyB,GAAG,MAAM;;;;"}
@@ -1,8 +1,18 @@
1
1
  import React__default from 'react';
2
2
  import cn from 'classnames';
3
3
  import { Icon } from '../Icon/Icon.js';
4
- import { colors } from '../../utils/colors.js';
5
4
 
5
+ const TAG_COLORS = {
6
+ green: 'wcag-green-100',
7
+ yellow: 'wcag-yellow-100',
8
+ red: 'wcag-red-100',
9
+ blue: 'wcag-blue-100',
10
+ purple: 'wcag-purple-100',
11
+ orange: 'wcag-orange-100',
12
+ brown: 'wcag-brown-100',
13
+ pink: 'wcag-pink-100',
14
+ grey: 'wcag-grey-200'
15
+ };
6
16
  const Tag = /*#__PURE__*/React__default.forwardRef((props, ref) => {
7
17
  const {
8
18
  children,
@@ -19,7 +29,7 @@ const Tag = /*#__PURE__*/React__default.forwardRef((props, ref) => {
19
29
  'hover:bg-opacity-75': !disabled,
20
30
  'cursor-pointer': !!otherProps.onClick,
21
31
  'pointer-events-none': disabled || readOnly
22
- }, color ? colors[color] : colors.grey, props.className);
32
+ }, color ? TAG_COLORS[color] : TAG_COLORS.grey, props.className);
23
33
  return /*#__PURE__*/React__default.createElement("span", Object.assign({}, otherProps, {
24
34
  className: className,
25
35
  ref: ref
@@ -38,5 +48,5 @@ const Tag = /*#__PURE__*/React__default.forwardRef((props, ref) => {
38
48
  }) : null);
39
49
  });
40
50
 
41
- export { Tag };
51
+ export { TAG_COLORS, Tag };
42
52
  //# sourceMappingURL=Tag.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","sources":["../../../../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Color, colors } from '../../utils/colors';\nimport { Icon, IconName, IconProps } from '../Icon/Icon';\n\nexport type TagProps = Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> & {\n children: string;\n color?: Color;\n disabled?: boolean;\n icon?: React.ReactElement<IconProps> | IconName;\n readOnly?: boolean;\n onDelete?: (event: React.MouseEvent<SVGSVGElement>) => void;\n};\n\nexport const Tag = React.forwardRef<HTMLSpanElement, TagProps>((props, ref) => {\n const { children, color, disabled, icon, readOnly, onDelete, ...otherProps } = props;\n const textRef = React.useRef<HTMLDivElement>(null);\n\n const className = cn(\n 'inline-flex items-center rounded h-6 cursor-default',\n {\n 'opacity-50': disabled,\n 'hover:bg-opacity-75': !disabled,\n 'cursor-pointer': !!otherProps.onClick,\n 'pointer-events-none': disabled || readOnly,\n },\n color ? colors[color] : colors.grey,\n props.className\n );\n\n return (\n <span {...otherProps} className={className} ref={ref}>\n <span className=\"truncate px-2\" ref={textRef}>\n {icon ? (\n typeof icon === 'string' ? (\n <Icon name={icon} className=\"mr-1 -ml-1 -mt-0.5 !h-5 !w-5\" />\n ) : (\n React.cloneElement(icon, { className: 'mr-1 -ml-1 -mt-0.5 !h-5 !w-5' })\n )\n ) : null}\n {children}\n </span>\n {onDelete ? (\n <Icon\n name=\"close\"\n onClick={onDelete}\n className=\"-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5\"\n />\n ) : null}\n </span>\n );\n});\n"],"names":["Tag","React","forwardRef","props","ref","children","color","disabled","icon","readOnly","onDelete","otherProps","textRef","useRef","className","cn","onClick","colors","grey","Icon","name","cloneElement"],"mappings":";;;;;MAcaA,GAAG,gBAAGC,cAAK,CAACC,UAAU,CAA4B,CAACC,KAAK,EAAEC,GAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGR,KAAK;EACpF,MAAMS,OAAO,GAAGX,cAAK,CAACY,MAAM,CAAiB,IAAI,CAAC;EAElD,MAAMC,SAAS,GAAGC,EAAE,CAChB,qDAAqD,EACrD;IACI,YAAY,EAAER,QAAQ;IACtB,qBAAqB,EAAE,CAACA,QAAQ;IAChC,gBAAgB,EAAE,CAAC,CAACI,UAAU,CAACK,OAAO;IACtC,qBAAqB,EAAET,QAAQ,IAAIE;GACtC,EACDH,KAAK,GAAGW,MAAM,CAACX,KAAK,CAAC,GAAGW,MAAM,CAACC,IAAI,EACnCf,KAAK,CAACW,SAAS,CAClB;EAED,oBACIb,uDAAUU,UAAU;IAAEG,SAAS,EAAEA,SAAS;IAAEV,GAAG,EAAEA;mBAC7CH;IAAMa,SAAS,EAAC,eAAe;IAACV,GAAG,EAAEQ;KAChCJ,IAAI,GACD,OAAOA,IAAI,KAAK,QAAQ,gBACpBP,6BAACkB,IAAI;IAACC,IAAI,EAAEZ,IAAI;IAAEM,SAAS,EAAC;IAAiC,gBAE7Db,cAAK,CAACoB,YAAY,CAACb,IAAI,EAAE;IAAEM,SAAS,EAAE;GAAgC,CACzE,GACD,IAAI,EACPT,QAAQ,CACN,EACNK,QAAQ,gBACLT,6BAACkB,IAAI;IACDC,IAAI,EAAC,OAAO;IACZJ,OAAO,EAAEN,QAAQ;IACjBI,SAAS,EAAC;IACZ,GACF,IAAI,CACL;AAEf,CAAC;;;;"}
1
+ {"version":3,"file":"Tag.js","sources":["../../../../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName, IconProps } from '../Icon/Icon';\n\nexport const TAG_COLORS = {\n green: 'wcag-green-100',\n yellow: 'wcag-yellow-100',\n red: 'wcag-red-100',\n blue: 'wcag-blue-100',\n purple: 'wcag-purple-100',\n orange: 'wcag-orange-100',\n brown: 'wcag-brown-100',\n pink: 'wcag-pink-100',\n grey: 'wcag-grey-200',\n};\n\nexport type TagColor = keyof typeof TAG_COLORS;\n\nexport type TagProps = Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> & {\n children: string;\n color?: TagColor;\n disabled?: boolean;\n icon?: React.ReactElement<IconProps> | IconName;\n readOnly?: boolean;\n onDelete?: (event: React.MouseEvent<SVGSVGElement>) => void;\n};\n\nexport const Tag = React.forwardRef<HTMLSpanElement, TagProps>((props, ref) => {\n const { children, color, disabled, icon, readOnly, onDelete, ...otherProps } = props;\n const textRef = React.useRef<HTMLDivElement>(null);\n\n const className = cn(\n 'inline-flex items-center rounded h-6 cursor-default',\n {\n 'opacity-50': disabled,\n 'hover:bg-opacity-75': !disabled,\n 'cursor-pointer': !!otherProps.onClick,\n 'pointer-events-none': disabled || readOnly,\n },\n color ? TAG_COLORS[color] : TAG_COLORS.grey,\n props.className\n );\n\n return (\n <span {...otherProps} className={className} ref={ref}>\n <span className=\"truncate px-2\" ref={textRef}>\n {icon ? (\n typeof icon === 'string' ? (\n <Icon name={icon} className=\"mr-1 -ml-1 -mt-0.5 !h-5 !w-5\" />\n ) : (\n React.cloneElement(icon, { className: 'mr-1 -ml-1 -mt-0.5 !h-5 !w-5' })\n )\n ) : null}\n {children}\n </span>\n {onDelete ? (\n <Icon\n name=\"close\"\n onClick={onDelete}\n className=\"-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5\"\n />\n ) : null}\n </span>\n );\n});\n"],"names":["TAG_COLORS","green","yellow","red","blue","purple","orange","brown","pink","grey","Tag","React","forwardRef","props","ref","children","color","disabled","icon","readOnly","onDelete","otherProps","textRef","useRef","className","cn","onClick","Icon","name","cloneElement"],"mappings":";;;;MAIaA,UAAU,GAAG;EACtBC,KAAK,EAAE,gBAAgB;EACvBC,MAAM,EAAE,iBAAiB;EACzBC,GAAG,EAAE,cAAc;EACnBC,IAAI,EAAE,eAAe;EACrBC,MAAM,EAAE,iBAAiB;EACzBC,MAAM,EAAE,iBAAiB;EACzBC,KAAK,EAAE,gBAAgB;EACvBC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE;;MAcGC,GAAG,gBAAGC,cAAK,CAACC,UAAU,CAA4B,CAACC,KAAK,EAAEC,GAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGR,KAAK;EACpF,MAAMS,OAAO,GAAGX,cAAK,CAACY,MAAM,CAAiB,IAAI,CAAC;EAElD,MAAMC,SAAS,GAAGC,EAAE,CAChB,qDAAqD,EACrD;IACI,YAAY,EAAER,QAAQ;IACtB,qBAAqB,EAAE,CAACA,QAAQ;IAChC,gBAAgB,EAAE,CAAC,CAACI,UAAU,CAACK,OAAO;IACtC,qBAAqB,EAAET,QAAQ,IAAIE;GACtC,EACDH,KAAK,GAAGhB,UAAU,CAACgB,KAAK,CAAC,GAAGhB,UAAU,CAACS,IAAI,EAC3CI,KAAK,CAACW,SAAS,CAClB;EAED,oBACIb,uDAAUU,UAAU;IAAEG,SAAS,EAAEA,SAAS;IAAEV,GAAG,EAAEA;mBAC7CH;IAAMa,SAAS,EAAC,eAAe;IAACV,GAAG,EAAEQ;KAChCJ,IAAI,GACD,OAAOA,IAAI,KAAK,QAAQ,gBACpBP,6BAACgB,IAAI;IAACC,IAAI,EAAEV,IAAI;IAAEM,SAAS,EAAC;IAAiC,gBAE7Db,cAAK,CAACkB,YAAY,CAACX,IAAI,EAAE;IAAEM,SAAS,EAAE;GAAgC,CACzE,GACD,IAAI,EACPT,QAAQ,CACN,EACNK,QAAQ,gBACLT,6BAACgB,IAAI;IACDC,IAAI,EAAC,OAAO;IACZF,OAAO,EAAEN,QAAQ;IACjBI,SAAS,EAAC;IACZ,GACF,IAAI,CACL;AAEf,CAAC;;;;"}
@@ -43,7 +43,7 @@ export { Pagination } from './components/Pagination/Pagination.js';
43
43
  export { Progress } from './components/Progress/Progress.js';
44
44
  export { ToastProvider, useToast } from './components/Toast/Toaster.js';
45
45
  export { Provider } from './components/Provider/Provider.js';
46
- export { Tag } from './components/Tag/Tag.js';
46
+ export { TAG_COLORS, Tag } from './components/Tag/Tag.js';
47
47
  export { Select2 } from './components/Select2/Select2.js';
48
48
  export { Table } from './components/Table/components/Table.js';
49
49
  export { PaginatedTable } from './components/Table/components/PaginatedTable.js';
package/dist/index.css CHANGED
@@ -272,7 +272,7 @@
272
272
  .DayPicker-Day:not(.DayPicker-Day--disabled):not(.DayPicker-Day--selected):not(.DayPicker-Day--outside):hover,
273
273
  [data-taco='calendar'] .DayPicker-Day--highlighted,
274
274
  [data-taco='calendar'] .DayPicker-Day--selected {
275
- @apply bg-grey-100 text-black;
275
+ @apply wcag-grey-200;
276
276
  }
277
277
 
278
278
  [data-taco='calendar'] .calendar-caption {
@@ -288,11 +288,11 @@
288
288
  }
289
289
 
290
290
  [data-taco='scrollable-list']:not([readonly]) li:hover {
291
- @apply wcag-blue-300;
291
+ @apply wcag-grey-200;
292
292
  }
293
293
 
294
294
  [data-taco='scrollable-list']:not([readonly]) li:hover [data-taco='icon'] {
295
- @apply wcag-blue-300;
295
+ @apply wcag-grey-200;
296
296
  }
297
297
 
298
298
  [data-taco='scrollable-list'] li:focus,
@@ -2577,22 +2577,6 @@ function IconSortBy(props, svgRef) {
2577
2577
  }
2578
2578
  var SortBy = /*#__PURE__*/React.forwardRef(IconSortBy);
2579
2579
 
2580
- function IconSpinner(props, svgRef) {
2581
- return /*#__PURE__*/React.createElement("svg", Object.assign({
2582
- xmlns: "http://www.w3.org/2000/svg",
2583
- viewBox: "0 0 24 24",
2584
- ref: svgRef
2585
- }, props), /*#__PURE__*/React.createElement("g", {
2586
- fill: "currentColor",
2587
- fillRule: "evenodd"
2588
- }, /*#__PURE__*/React.createElement("path", {
2589
- d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm0 1.5a8.5 8.5 0 110 17 8.5 8.5 0 010-17z"
2590
- }), /*#__PURE__*/React.createElement("path", {
2591
- d: "M12 2a.75.75 0 110 1.5 8.5 8.5 0 108.5 8.5.75.75 0 111.5 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2z"
2592
- })));
2593
- }
2594
- var Spinner = /*#__PURE__*/React.forwardRef(IconSpinner);
2595
-
2596
2580
  function IconStarSolid(props, svgRef) {
2597
2581
  return /*#__PURE__*/React.createElement("svg", Object.assign({
2598
2582
  xmlns: "http://www.w3.org/2000/svg",
@@ -3116,7 +3100,6 @@ const icons = {
3116
3100
  sliders: Sliders,
3117
3101
  smartpay: Smartpay,
3118
3102
  'sort-by': SortBy,
3119
- spinner: Spinner,
3120
3103
  'star-solid': StarSolid,
3121
3104
  star: Star,
3122
3105
  subscriptions: Subscriptions,
@@ -3385,9 +3368,9 @@ const getButtonClasses = () => {
3385
3368
  const getAppearanceClasses = (value, icon = false) => {
3386
3369
  switch (value) {
3387
3370
  case 'primary':
3388
- return `yt-blue-solid focus:bg-blue-500 focus:text-white focus:yt-focus active:bg-blue-700 active:text-white hover:bg-blue-300 hover:text-white hover:focus:bg-blue-300 hover:focus:border-blue-300 hover:focus:text-white disabled:hover:yt-blue-solid disabled:hover:hover:border-blue-500`;
3371
+ return `wcag-blue-500 focus:bg-blue-500 focus:text-white focus:yt-focus active:bg-blue-700 active:text-white hover:bg-blue-300 hover:text-white hover:focus:bg-blue-300 hover:focus:border-blue-300 hover:focus:text-white disabled:hover:wcag-blue-500 disabled:hover:hover:border-blue-500`;
3389
3372
  case 'danger':
3390
- return `yt-red-solid focus:bg-red-500 focus:text-white focus:yt-focus-red active:bg-red-700 active:text-white hover:bg-red-300 hover:text-white hover:focus:bg-red-300 hover:focus:text-white disabled:hover:yt-red-solid`;
3373
+ return `wcag-red-500 focus:bg-red-500 focus:text-white focus:yt-focus-red active:bg-red-700 active:text-white hover:bg-red-300 hover:text-white hover:focus:bg-red-300 hover:focus:text-white disabled:hover:wcag-red-500`;
3391
3374
  case 'ghost':
3392
3375
  return `bg-white shadow-[inset_0_0_0_1px_theme(colors.blue.500)] text-blue-500 focus:bg-transparent focus:text-blue-500 active:bg-blue-100 focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.500),0_0_0_2px_rgba(0,99,255,0.25)] active:text-blue-700 hover:bg-blue-100 hover:shadow-[inset_0_0_0_1px_theme(colors.blue.300)] hover:text-blue-300 hover:focus:bg-blue-100 hover:focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.300),0_0_0_2px_rgba(0,99,255,0.25)] hover:focus:text-blue-300`;
3393
3376
  case 'discrete':
@@ -3398,7 +3381,7 @@ const getAppearanceClasses = (value, icon = false) => {
3398
3381
  return `yt-transparent focus:text-blue-500 focus:yt-focus active:text-blue-700 hover:text-blue-300 hover:focus:text-blue-300 disabled:hover:yt-transparent`;
3399
3382
  }
3400
3383
  default:
3401
- return `yt-grey-solid focus:bg-grey-200 focus:yt-focus active:bg-grey-300 active:text-black hover:bg-grey-100 hover:text-grey-700 hover:focus:bg-grey-100 hover:focus:text-grey-700 disabled:hover:yt-grey-solid`;
3384
+ return `wcag-grey-200 focus:bg-grey-200 focus:yt-focus active:bg-grey-300 active:text-black hover:bg-grey-100 hover:text-grey-700 hover:focus:bg-grey-100 hover:focus:text-grey-700 disabled:hover:wcag-grey-200`;
3402
3385
  }
3403
3386
  };
3404
3387
  const createButtonWithTooltip = (props, className, ref) => {
@@ -3886,7 +3869,7 @@ const getInputClasses = props => {
3886
3869
  const disabled = props.disabled || !!props['aria-disabled'];
3887
3870
  const readOnly = props.readOnly || !!props['aria-readonly'];
3888
3871
  const invalid = props.invalid || !!props['aria-invalid'];
3889
- return cn('peer bg-white text-black text-sm border font-normal not-italic no-underline rounded inline-flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)]', {
3872
+ return cn('peer bg-white text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)]', {
3890
3873
  // default
3891
3874
  'border-grey-300 focus:border-blue-300 focus:yt-focus': !invalid,
3892
3875
  'hover:shadow-[0_0_0.1rem_theme(colors.grey.500)] active:border-blue-700': !invalid && !disabled,
@@ -4143,7 +4126,7 @@ const useListScrollTo = (internalRef, itemRefs) => {
4143
4126
  };
4144
4127
  };
4145
4128
 
4146
- const Spinner$1 = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
4129
+ const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
4147
4130
  const {
4148
4131
  delay = 500,
4149
4132
  label,
@@ -4313,7 +4296,7 @@ const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(pro
4313
4296
  "data-taco": "scrollable-list"
4314
4297
  }), loading ? /*#__PURE__*/React.createElement("li", {
4315
4298
  className: "yt-list__empty"
4316
- }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Spinner$1, {
4299
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Spinner, {
4317
4300
  delay: 0
4318
4301
  })), /*#__PURE__*/React.createElement("span", null, texts.listbox.loading)) : options.length ? options.map(({
4319
4302
  children,
@@ -5109,7 +5092,7 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
5109
5092
  key: shortcut.text
5110
5093
  }, /*#__PURE__*/React.createElement("button", {
5111
5094
  type: "button",
5112
- className: "hover:bg-grey-100 flex w-full items-start px-4 py-1 text-xs",
5095
+ className: "hover:wcag-grey-200 flex w-full items-start px-4 py-1 text-xs",
5113
5096
  onClick: event => {
5114
5097
  event.persist();
5115
5098
  shortcut.onClick(event);
@@ -6122,7 +6105,7 @@ const useItemStyling = ({
6122
6105
  return cn('flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group', {
6123
6106
  'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
6124
6107
  'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented),
6125
- 'cursor-pointer hover:bg-grey-100 text-black hover:text-black': !disabled,
6108
+ 'cursor-pointer hover:wcag-grey-200 text-black': !disabled,
6126
6109
  'cursor-not-allowed hover:bg-white text-grey-300': disabled
6127
6110
  }, className);
6128
6111
  };
@@ -7153,7 +7136,7 @@ const getBadgeIcon = type => {
7153
7136
  className: cn(css, 'yt-blue-solid')
7154
7137
  });
7155
7138
  case 'loading':
7156
- return /*#__PURE__*/React__default.createElement(Spinner$1, {
7139
+ return /*#__PURE__*/React__default.createElement(Spinner, {
7157
7140
  delay: 0,
7158
7141
  className: cn(css, 'h-6 w-6')
7159
7142
  });
@@ -7678,18 +7661,17 @@ const Title$3 = /*#__PURE__*/React__default.forwardRef(function Listbox2Group(pr
7678
7661
  }));
7679
7662
  });
7680
7663
 
7681
- const colors = {
7682
- green: 'bg-green-100 text-green-900',
7683
- yellow: 'bg-yellow-100 text-yellow-900',
7684
- red: 'bg-red-100 text-red-900',
7685
- blue: 'bg-blue-100 text-blue-900',
7686
- purple: 'bg-purple-100 text-purple-900',
7687
- orange: 'bg-orange-100 text-orange-900',
7688
- brown: 'bg-brown-100 text-brown-900',
7689
- pink: 'bg-pink-100 text-pink-900',
7690
- grey: 'bg-grey-200 text-grey-900'
7664
+ const TAG_COLORS = {
7665
+ green: 'wcag-green-100',
7666
+ yellow: 'wcag-yellow-100',
7667
+ red: 'wcag-red-100',
7668
+ blue: 'wcag-blue-100',
7669
+ purple: 'wcag-purple-100',
7670
+ orange: 'wcag-orange-100',
7671
+ brown: 'wcag-brown-100',
7672
+ pink: 'wcag-pink-100',
7673
+ grey: 'wcag-grey-200'
7691
7674
  };
7692
-
7693
7675
  const Tag$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
7694
7676
  const {
7695
7677
  children,
@@ -7706,7 +7688,7 @@ const Tag$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
7706
7688
  'hover:bg-opacity-75': !disabled,
7707
7689
  'cursor-pointer': !!otherProps.onClick,
7708
7690
  'pointer-events-none': disabled || readOnly
7709
- }, color ? colors[color] : colors.grey, props.className);
7691
+ }, color ? TAG_COLORS[color] : TAG_COLORS.grey, props.className);
7710
7692
  return /*#__PURE__*/React__default.createElement("span", Object.assign({}, otherProps, {
7711
7693
  className: className,
7712
7694
  ref: ref
@@ -7725,7 +7707,7 @@ const Tag$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
7725
7707
  }) : null);
7726
7708
  });
7727
7709
 
7728
- const createOptionClassName = () => 'group mb-px flex h-8 w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white hover:bg-grey-100 aria-current:bg-grey-100 aria-disabled:text-black/25 aria-disabled:pointer-events-none';
7710
+ const createOptionClassName = () => 'group mb-px flex h-8 w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white hover:wcag-grey-200 aria-current:wcag-grey-200 aria-disabled:text-black/25 aria-disabled:pointer-events-none';
7729
7711
  const createCollectionClassName = () => 'flex flex-col gap-px';
7730
7712
 
7731
7713
  const Select2Context = /*#__PURE__*/React__default.createContext({});
@@ -7748,7 +7730,7 @@ function _catch(body, recover) {
7748
7730
  return result;
7749
7731
  }
7750
7732
 
7751
- const AVAILABLE_COLORS = /*#__PURE__*/Object.keys(colors);
7733
+ const AVAILABLE_COLORS = /*#__PURE__*/Object.keys(TAG_COLORS);
7752
7734
  const EditPopover = props => {
7753
7735
  const {
7754
7736
  color: initialColor,
@@ -7909,7 +7891,7 @@ const Colours = props => {
7909
7891
  value: color
7910
7892
  }, AVAILABLE_COLORS.map(availableColor => /*#__PURE__*/React__default.createElement(RadioGroupPrimitive.Item, {
7911
7893
  "aria-label": color,
7912
- className: cn('flex h-6 w-6 cursor-pointer items-center justify-center rounded', colors[availableColor]),
7894
+ className: cn('flex h-6 w-6 cursor-pointer items-center justify-center rounded', TAG_COLORS[availableColor]),
7913
7895
  key: availableColor,
7914
7896
  onFocus: () => onChangeColor(availableColor),
7915
7897
  value: availableColor
@@ -8139,7 +8121,7 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
8139
8121
  readOnly,
8140
8122
  tags
8141
8123
  } = useSelect2Context();
8142
- const contentClassName = cn('truncate flex items-center gap-1');
8124
+ const contentClassName = cn('truncate items-center gap-1');
8143
8125
  const currentValue = children.find(matchesValue(value));
8144
8126
  let output;
8145
8127
  if (currentValue) {
@@ -8159,7 +8141,7 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
8159
8141
  }
8160
8142
  return /*#__PURE__*/React__default.createElement(Button$2, Object.assign({}, buttonProps, {
8161
8143
  ref: ref
8162
- }), /*#__PURE__*/React__default.createElement("span", {
8144
+ }), /*#__PURE__*/React__default.createElement("div", {
8163
8145
  className: contentClassName
8164
8146
  }, output));
8165
8147
  });
@@ -8184,10 +8166,10 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
8184
8166
  className
8185
8167
  } = buttonProps;
8186
8168
  if (open) {
8187
- className = cn('absolute z-20', buttonProps.className);
8169
+ className = cn('!absolute z-20', buttonProps.className);
8188
8170
  content = /*#__PURE__*/React__default.createElement(ScrollArea, {
8189
8171
  className: "my-1 flex max-h-[5.5rem] flex-col"
8190
- }, /*#__PURE__*/React__default.createElement("span", {
8172
+ }, /*#__PURE__*/React__default.createElement("div", {
8191
8173
  className: "flex flex-wrap gap-1"
8192
8174
  }, valuesAsChildren.map(child => /*#__PURE__*/React__default.createElement(Tag$1, {
8193
8175
  key: child.props.value,
@@ -8210,7 +8192,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
8210
8192
  valuesAsChildren: valuesAsChildren
8211
8193
  });
8212
8194
  }
8213
- return /*#__PURE__*/React__default.createElement("span", {
8195
+ return /*#__PURE__*/React__default.createElement("div", {
8214
8196
  className: cn('relative inline-flex flex-grow', {
8215
8197
  'h-8': open
8216
8198
  }),
@@ -8241,9 +8223,9 @@ const MultipleValue = ({
8241
8223
  setValue(tagValue);
8242
8224
  }
8243
8225
  };
8244
- return /*#__PURE__*/React__default.createElement("span", {
8226
+ return /*#__PURE__*/React__default.createElement("div", {
8245
8227
  className: "relative flex items-center gap-1 overflow-hidden"
8246
- }, /*#__PURE__*/React__default.createElement("span", {
8228
+ }, /*#__PURE__*/React__default.createElement("div", {
8247
8229
  className: "flex gap-1 truncate",
8248
8230
  ref: el => setContentRef(el)
8249
8231
  }, valuesAsChildren.map((child, index) => {
@@ -8628,6 +8610,24 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
8628
8610
  // the focus should always remain on the input, so we forward events on to the listbox
8629
8611
  (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.dispatchEvent(createCustomKeyboardEvent(event));
8630
8612
  };
8613
+ let handleBlur;
8614
+ if (otherProps.onBlur) {
8615
+ // we might be focusing on an input or something inside the dropdown that was triggered by the select
8616
+ // so see if the element gaining focus is inside a portal and look up its controller
8617
+ // if we don't do this, things like validate on blur occur while simply opening the select
8618
+ handleBlur = event => {
8619
+ var _elementGainingFocus$;
8620
+ const elementGainingFocus = event.relatedTarget;
8621
+ if (elementGainingFocus === undefined) {
8622
+ return;
8623
+ }
8624
+ const portalId = elementGainingFocus === null || elementGainingFocus === void 0 ? void 0 : (_elementGainingFocus$ = elementGainingFocus.closest('[data-radix-popper-content-wrapper] > :first-child')) === null || _elementGainingFocus$ === void 0 ? void 0 : _elementGainingFocus$.id;
8625
+ if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {
8626
+ var _otherProps$onBlur;
8627
+ (_otherProps$onBlur = otherProps.onBlur) === null || _otherProps$onBlur === void 0 ? void 0 : _otherProps$onBlur.call(otherProps, event);
8628
+ }
8629
+ };
8630
+ }
8631
8631
  const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none', createCollectionClassName());
8632
8632
  return /*#__PURE__*/React__default.createElement(Select2Context.Provider, {
8633
8633
  value: context
@@ -8647,6 +8647,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
8647
8647
  "data-taco": "Select2"
8648
8648
  }, /*#__PURE__*/React__default.createElement(Trigger$6, Object.assign({}, otherProps, {
8649
8649
  "aria-haspopup": "listbox",
8650
+ onBlur: handleBlur,
8650
8651
  onKeyDown: handleKeyDown,
8651
8652
  ref: internalRef
8652
8653
  }), allChildren)), /*#__PURE__*/React__default.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React__default.createElement(PopoverPrimitive.Content, {
@@ -10518,8 +10519,9 @@ exports.RadioGroup = RadioGroup;
10518
10519
  exports.SearchInput = SearchInput;
10519
10520
  exports.Select = Select;
10520
10521
  exports.Select2 = Select2;
10521
- exports.Spinner = Spinner$1;
10522
+ exports.Spinner = Spinner;
10522
10523
  exports.Switch = Switch;
10524
+ exports.TAG_COLORS = TAG_COLORS;
10523
10525
  exports.Table = Table;
10524
10526
  exports.Tabs = Tabs;
10525
10527
  exports.Tag = Tag$1;