@economic/taco 1.16.2 → 1.17.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 (137) hide show
  1. package/dist/components/AlertDialog/Context.d.ts +1 -1
  2. package/dist/components/Banner/Banner.stories.d.ts +2 -20
  3. package/dist/components/Button/Button.d.ts +2 -2
  4. package/dist/components/Button/Button.stories.d.ts +1 -1
  5. package/dist/components/Combobox/useCombobox.d.ts +2 -1
  6. package/dist/components/Datepicker/Datepicker.d.ts +7 -3
  7. package/dist/components/Datepicker/Datepicker.stories.d.ts +2 -2
  8. package/dist/components/Datepicker/useDatepicker.d.ts +2 -1
  9. package/dist/components/Dialog/Context.d.ts +1 -1
  10. package/dist/components/Dialog/Dialog.d.ts +1 -1
  11. package/dist/components/Icon/Icon.stories.d.ts +4 -20
  12. package/dist/components/IconButton/IconButton.stories.d.ts +11 -48
  13. package/dist/components/Input/Input.d.ts +15 -8
  14. package/dist/components/Input/Input.stories.d.ts +15 -41
  15. package/dist/components/Provider/Localization.d.ts +3 -2
  16. package/dist/components/SearchInput/SearchInput.d.ts +5 -10
  17. package/dist/components/SearchInput/SearchInput.stories.d.ts +3 -6
  18. package/dist/components/Select/Select.d.ts +1 -1
  19. package/dist/components/Select/Select.stories.d.ts +1 -1
  20. package/dist/components/Select2/Select2.d.ts +2 -0
  21. package/dist/components/Select2/Select2.stories.d.ts +0 -1
  22. package/dist/components/Select2/components/Search.d.ts +6 -3
  23. package/dist/components/Select2/hooks/useChildren.d.ts +2 -1
  24. package/dist/components/Tooltip/Tooltip.d.ts +4 -4
  25. package/dist/components/Tooltip/Tooltip.stories.d.ts +2 -2
  26. package/dist/esm/index.css +44 -40
  27. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +2 -2
  28. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/AlertDialog/Context.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js +1 -1
  31. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Button/Button.js +1 -2
  33. package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Button/util.js +7 -7
  35. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +1 -1
  37. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +6 -5
  39. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +2 -2
  41. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +37 -33
  44. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Dialog/Context.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +1 -1
  49. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js +1 -1
  51. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Field/Field.js +3 -3
  53. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +3 -4
  55. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/HoverCard/Primitives.js +1 -1
  57. package/dist/esm/packages/taco/src/components/HoverCard/Primitives.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Input/Input.js +110 -58
  59. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Input/util.js +14 -8
  61. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +2 -2
  63. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
  65. package/dist/esm/packages/taco/src/components/Menu/components/Header.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +3 -3
  67. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js +1 -1
  69. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +7 -7
  71. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/Popover/Popover.js +1 -2
  73. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/Popover/Primitives.js +1 -1
  75. package/dist/esm/packages/taco/src/components/Popover/Primitives.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Popover/util.js +1 -1
  77. package/dist/esm/packages/taco/src/components/Popover/util.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Progress/Progress.js +3 -3
  79. package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -2
  81. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +4 -4
  83. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +1 -1
  85. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +31 -15
  87. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Select/Select.js +2 -2
  89. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Select2/Select2.js +8 -9
  91. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Select2/components/Collection.js +1 -1
  93. package/dist/esm/packages/taco/src/components/Select2/components/Collection.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  95. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +14 -6
  97. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +3 -2
  99. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
  100. package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -1
  101. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  102. package/dist/esm/packages/taco/src/components/Switch/Switch.js +5 -4
  103. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +1 -1
  105. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  106. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +2 -2
  107. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowDraggable.js +1 -1
  109. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  110. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +1 -1
  111. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js +2 -2
  113. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js +1 -1
  115. package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +2 -2
  117. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Toast/Toast.js +5 -5
  119. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +3 -3
  121. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Tour/Tour.js +3 -3
  123. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  124. package/dist/esm/packages/taco/src/index.js +1 -1
  125. package/dist/esm/packages/taco/src/utils/colors.js +9 -9
  126. package/dist/esm/packages/taco/src/utils/colors.js.map +1 -1
  127. package/dist/index.css +44 -40
  128. package/dist/index.d.ts +0 -1
  129. package/dist/primitives/Sortable/components/Item.d.ts +1 -0
  130. package/dist/taco.cjs.development.js +362 -280
  131. package/dist/taco.cjs.development.js.map +1 -1
  132. package/dist/taco.cjs.production.min.js +1 -1
  133. package/dist/taco.cjs.production.min.js.map +1 -1
  134. package/package.json +3 -3
  135. package/plugins/tailwindcss-group-peer.js +12 -0
  136. package/tailwind.config.js +272 -22
  137. package/types.json +87 -43
@@ -8,7 +8,7 @@ const AccordionContext = /*#__PURE__*/React__default.createContext({
8
8
  });
9
9
  const StyledTrigger = /*#__PURE__*/React__default.forwardRef(function AccordionStyledTrigger(props, ref) {
10
10
  const isExpanded = !!props['aria-expanded'];
11
- const className = cn('w-full inline-flex justify-between items-center align-middle', 'focus:rounded-sm focus:border-blue focus:yt-focus', props.className);
11
+ const className = cn('w-full inline-flex justify-between items-center align-middle', 'focus:rounded-sm focus:border-blue-500 focus:yt-focus', props.className);
12
12
  return /*#__PURE__*/React__default.createElement("button", Object.assign({}, props, {
13
13
  ref: ref,
14
14
  className: className
@@ -69,7 +69,7 @@ const Accordion = props => {
69
69
  };
70
70
  }
71
71
  const type = Array.isArray(valueProps.defaultValue) || Array.isArray(valueProps.value) ? 'multiple' : 'single';
72
- const className = cn('divide-y divide-grey', props.className);
72
+ const className = cn('divide-y divide-grey-200', props.className);
73
73
  return /*#__PURE__*/React__default.createElement(AccordionContext.Provider, {
74
74
  value: context
75
75
  }, /*#__PURE__*/React__default.createElement(Root, Object.assign({}, otherProps, valueProps, {
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sources":["../../../../../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { Icon } from '../Icon/Icon';\n\ntype AccordionContext = {\n as: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n};\nconst AccordionContext = React.createContext<AccordionContext>({\n as: 'h2',\n});\n\nexport type AccordionTriggerProps = React.HTMLAttributes<HTMLElement>;\n\nconst StyledTrigger = React.forwardRef(function AccordionStyledTrigger(\n props: AccordionPrimitive.AccordionTriggerProps,\n ref: React.Ref<HTMLButtonElement>\n) {\n const isExpanded = !!props['aria-expanded'];\n\n const className = cn(\n 'w-full inline-flex justify-between items-center align-middle',\n 'focus:rounded-sm focus:border-blue focus:yt-focus',\n props.className\n );\n\n return (\n <button {...props} ref={ref} className={className}>\n {props.children}\n <Icon name={isExpanded ? 'chevron-up' : 'chevron-down'} />\n </button>\n );\n});\n\nconst Trigger = React.forwardRef(function AccordionTrigger(props: AccordionTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const { children } = props;\n const { as: Heading } = React.useContext(AccordionContext);\n\n return (\n <AccordionPrimitive.Header asChild>\n <Heading className=\"my-3\">\n <AccordionPrimitive.Trigger ref={ref} asChild>\n <StyledTrigger>{children}</StyledTrigger>\n </AccordionPrimitive.Trigger>\n </Heading>\n </AccordionPrimitive.Header>\n );\n});\n\nexport type AccordionContentProps = React.HTMLAttributes<HTMLElement>;\nconst Content = React.forwardRef(function AccordionContent(props: AccordionContentProps, ref: React.Ref<HTMLDivElement>) {\n return <AccordionPrimitive.Content {...props} ref={ref} />;\n});\n\nexport type AccordionItemProps = React.HTMLAttributes<HTMLDivElement> & {\n id: string;\n disabled?: boolean;\n};\nconst Item = (props: AccordionItemProps) => {\n const { id, ...otherProps } = props;\n return <AccordionPrimitive.Item {...otherProps} value={id} />;\n};\n\ntype AccordionBaseProps = {\n children: React.ReactNode[];\n\n /** Change what heading element accordion regions will render */\n as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\n /** Additional classes for Accordion root element */\n className?: string;\n};\n\nexport interface AccordionUncontrolledProps extends AccordionBaseProps {\n /** Default expanded accordion(s) */\n defaultId: string | string[];\n\n id?: never;\n onChange?: never;\n}\n\nexport interface AccordionMultipleControlledProps extends AccordionBaseProps {\n /** Expanded accordions */\n id: string[];\n\n /** onChange function to receive ids of expanded accordions */\n onChange: (id: string[]) => void;\n\n defaultId?: never;\n}\nexport interface AccordionSingleControlledProps extends AccordionBaseProps {\n /** Expanded accordion */\n id: string;\n\n /** onChange function to receive id of expanded accordion */\n onChange: (id: string) => void;\n\n defaultId?: never;\n}\n\nexport type AccordionProps = AccordionUncontrolledProps | AccordionMultipleControlledProps | AccordionSingleControlledProps;\n\nexport const Accordion = (props: AccordionProps) => {\n const { id, defaultId, onChange, as = 'h2', ...otherProps } = props;\n const context = React.useMemo(() => ({ as }), [as]);\n\n let valueProps;\n\n if (defaultId) {\n valueProps = {\n defaultValue: defaultId || undefined,\n };\n } else {\n valueProps = {\n onValueChange: onChange,\n value: id || undefined,\n };\n }\n\n const type = Array.isArray(valueProps.defaultValue) || Array.isArray(valueProps.value) ? 'multiple' : 'single';\n const className = cn('divide-y divide-grey', props.className);\n\n return (\n <AccordionContext.Provider value={context}>\n <AccordionPrimitive.Root {...otherProps} {...valueProps} data-taco=\"accordion\" className={className} type={type} />\n </AccordionContext.Provider>\n );\n};\n\nAccordion.Item = Item;\nAccordion.Trigger = Trigger;\nAccordion.Content = Content;\n"],"names":["AccordionContext","React","createContext","as","StyledTrigger","forwardRef","AccordionStyledTrigger","props","ref","isExpanded","className","cn","children","Icon","name","Trigger","AccordionTrigger","Heading","useContext","AccordionPrimitive","asChild","Content","AccordionContent","Item","id","otherProps","value","Accordion","defaultId","onChange","context","useMemo","valueProps","defaultValue","undefined","onValueChange","type","Array","isArray","Provider"],"mappings":";;;;;AAQA,MAAMA,gBAAgB,gBAAGC,cAAK,CAACC,aAAa,CAAmB;EAC3DC,EAAE,EAAE;CACP,CAAC;AAIF,MAAMC,aAAa,gBAAGH,cAAK,CAACI,UAAU,CAAC,SAASC,sBAAsB,CAClEC,KAA+C,EAC/CC,GAAiC;EAEjC,MAAMC,UAAU,GAAG,CAAC,CAACF,KAAK,CAAC,eAAe,CAAC;EAE3C,MAAMG,SAAS,GAAGC,EAAE,CAChB,8DAA8D,EAC9D,mDAAmD,EACnDJ,KAAK,CAACG,SAAS,CAClB;EAED,oBACIT,yDAAYM,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEE,SAAS,EAAEA;MACnCH,KAAK,CAACK,QAAQ,eACfX,6BAACY,IAAI;IAACC,IAAI,EAAEL,UAAU,GAAG,YAAY,GAAG;IAAkB,CACrD;AAEjB,CAAC,CAAC;AAEF,MAAMM,OAAO,gBAAGd,cAAK,CAACI,UAAU,CAAC,SAASW,gBAAgB,CAACT,KAA4B,EAAEC,GAAiC;EACtH,MAAM;IAAEI;GAAU,GAAGL,KAAK;EAC1B,MAAM;IAAEJ,EAAE,EAAEc;GAAS,GAAGhB,cAAK,CAACiB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AQ;EAC9G,MAAMhB,SAAS,GAAGC,EAAE,CAAC,sBAAsB,EAAEJ,KAAK,CAACG,SAAS,CAAC;EAE7D,oBACIT,6BAACD,gBAAgB,CAACuC,QAAQ;IAACb,KAAK,EAAEI;kBAC9B7B,6BAACkB,IAAuB,oBAAKM,UAAU,EAAMO,UAAU;iBAAY,WAAW;IAACtB,SAAS,EAAEA,SAAS;IAAE0B,IAAI,EAAEA;KAAQ,CAC3F;AAEpC;AAEAT,SAAS,CAACJ,IAAI,GAAGA,IAAI;AACrBI,SAAS,CAACZ,OAAO,GAAGA,OAAO;AAC3BY,SAAS,CAACN,OAAO,GAAGA,OAAO;;;;"}
1
+ {"version":3,"file":"Accordion.js","sources":["../../../../../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { Icon } from '../Icon/Icon';\n\ntype AccordionContext = {\n as: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n};\nconst AccordionContext = React.createContext<AccordionContext>({\n as: 'h2',\n});\n\nexport type AccordionTriggerProps = React.HTMLAttributes<HTMLElement>;\n\nconst StyledTrigger = React.forwardRef(function AccordionStyledTrigger(\n props: AccordionPrimitive.AccordionTriggerProps,\n ref: React.Ref<HTMLButtonElement>\n) {\n const isExpanded = !!props['aria-expanded'];\n\n const className = cn(\n 'w-full inline-flex justify-between items-center align-middle',\n 'focus:rounded-sm focus:border-blue-500 focus:yt-focus',\n props.className\n );\n\n return (\n <button {...props} ref={ref} className={className}>\n {props.children}\n <Icon name={isExpanded ? 'chevron-up' : 'chevron-down'} />\n </button>\n );\n});\n\nconst Trigger = React.forwardRef(function AccordionTrigger(props: AccordionTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const { children } = props;\n const { as: Heading } = React.useContext(AccordionContext);\n\n return (\n <AccordionPrimitive.Header asChild>\n <Heading className=\"my-3\">\n <AccordionPrimitive.Trigger ref={ref} asChild>\n <StyledTrigger>{children}</StyledTrigger>\n </AccordionPrimitive.Trigger>\n </Heading>\n </AccordionPrimitive.Header>\n );\n});\n\nexport type AccordionContentProps = React.HTMLAttributes<HTMLElement>;\nconst Content = React.forwardRef(function AccordionContent(props: AccordionContentProps, ref: React.Ref<HTMLDivElement>) {\n return <AccordionPrimitive.Content {...props} ref={ref} />;\n});\n\nexport type AccordionItemProps = React.HTMLAttributes<HTMLDivElement> & {\n id: string;\n disabled?: boolean;\n};\nconst Item = (props: AccordionItemProps) => {\n const { id, ...otherProps } = props;\n return <AccordionPrimitive.Item {...otherProps} value={id} />;\n};\n\ntype AccordionBaseProps = {\n children: React.ReactNode[];\n\n /** Change what heading element accordion regions will render */\n as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\n /** Additional classes for Accordion root element */\n className?: string;\n};\n\nexport interface AccordionUncontrolledProps extends AccordionBaseProps {\n /** Default expanded accordion(s) */\n defaultId: string | string[];\n\n id?: never;\n onChange?: never;\n}\n\nexport interface AccordionMultipleControlledProps extends AccordionBaseProps {\n /** Expanded accordions */\n id: string[];\n\n /** onChange function to receive ids of expanded accordions */\n onChange: (id: string[]) => void;\n\n defaultId?: never;\n}\nexport interface AccordionSingleControlledProps extends AccordionBaseProps {\n /** Expanded accordion */\n id: string;\n\n /** onChange function to receive id of expanded accordion */\n onChange: (id: string) => void;\n\n defaultId?: never;\n}\n\nexport type AccordionProps = AccordionUncontrolledProps | AccordionMultipleControlledProps | AccordionSingleControlledProps;\n\nexport const Accordion = (props: AccordionProps) => {\n const { id, defaultId, onChange, as = 'h2', ...otherProps } = props;\n const context = React.useMemo(() => ({ as }), [as]);\n\n let valueProps;\n\n if (defaultId) {\n valueProps = {\n defaultValue: defaultId || undefined,\n };\n } else {\n valueProps = {\n onValueChange: onChange,\n value: id || undefined,\n };\n }\n\n const type = Array.isArray(valueProps.defaultValue) || Array.isArray(valueProps.value) ? 'multiple' : 'single';\n const className = cn('divide-y divide-grey-200', props.className);\n\n return (\n <AccordionContext.Provider value={context}>\n <AccordionPrimitive.Root {...otherProps} {...valueProps} data-taco=\"accordion\" className={className} type={type} />\n </AccordionContext.Provider>\n );\n};\n\nAccordion.Item = Item;\nAccordion.Trigger = Trigger;\nAccordion.Content = Content;\n"],"names":["AccordionContext","React","createContext","as","StyledTrigger","forwardRef","AccordionStyledTrigger","props","ref","isExpanded","className","cn","children","Icon","name","Trigger","AccordionTrigger","Heading","useContext","AccordionPrimitive","asChild","Content","AccordionContent","Item","id","otherProps","value","Accordion","defaultId","onChange","context","useMemo","valueProps","defaultValue","undefined","onValueChange","type","Array","isArray","Provider"],"mappings":";;;;;AAQA,MAAMA,gBAAgB,gBAAGC,cAAK,CAACC,aAAa,CAAmB;EAC3DC,EAAE,EAAE;CACP,CAAC;AAIF,MAAMC,aAAa,gBAAGH,cAAK,CAACI,UAAU,CAAC,SAASC,sBAAsB,CAClEC,KAA+C,EAC/CC,GAAiC;EAEjC,MAAMC,UAAU,GAAG,CAAC,CAACF,KAAK,CAAC,eAAe,CAAC;EAE3C,MAAMG,SAAS,GAAGC,EAAE,CAChB,8DAA8D,EAC9D,uDAAuD,EACvDJ,KAAK,CAACG,SAAS,CAClB;EAED,oBACIT,yDAAYM,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEE,SAAS,EAAEA;MACnCH,KAAK,CAACK,QAAQ,eACfX,6BAACY,IAAI;IAACC,IAAI,EAAEL,UAAU,GAAG,YAAY,GAAG;IAAkB,CACrD;AAEjB,CAAC,CAAC;AAEF,MAAMM,OAAO,gBAAGd,cAAK,CAACI,UAAU,CAAC,SAASW,gBAAgB,CAACT,KAA4B,EAAEC,GAAiC;EACtH,MAAM;IAAEI;GAAU,GAAGL,KAAK;EAC1B,MAAM;IAAEJ,EAAE,EAAEc;GAAS,GAAGhB,cAAK,CAACiB,UAAU,CAAClB,gBAAgB,CAAC;EAE1D,oBACIC,6BAACkB,MAAyB;IAACC,OAAO;kBAC9BnB,6BAACgB,OAAO;IAACP,SAAS,EAA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AgB,CAACuC,QAAQ;IAACb,KAAK,EAAEI;kBAC9B7B,6BAACkB,IAAuB,oBAAKM,UAAU,EAAMO,UAAU;iBAAY,WAAW;IAACtB,SAAS,EAAEA,SAAS;IAAE0B,IAAI,EAAEA;KAAQ,CAC3F;AAEpC;AAEAT,SAAS,CAACJ,IAAI,GAAGA,IAAI;AACrBI,SAAS,CAACZ,OAAO,GAAGA,OAAO;AAC3BY,SAAS,CAACN,OAAO,GAAGA,OAAO;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","sources":["../../../../../../../src/components/AlertDialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport React from 'react';\n\nexport type AlertDialogContext = {\n props: {};\n ref: React.Ref<HTMLElement>;\n};\n\nexport const AlertDialogContext = React.createContext<AlertDialogContext>({\n props: {},\n ref: null,\n});\n\nexport const useCurrentAlertDialog = () => {\n return React.useContext(AlertDialogContext);\n};\n"],"names":["AlertDialogContext","React","createContext","props","ref","useCurrentAlertDialog","useContext"],"mappings":";;AAAA;MAQaA,kBAAkB,gBAAGC,cAAK,CAACC,aAAa,CAAqB;EACtEC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE;CACR;MAEYC,qBAAqB,GAAG;EACjC,OAAOJ,cAAK,CAACK,UAAU,CAACN,kBAAkB,CAAC;AAC/C;;;;"}
1
+ {"version":3,"file":"Context.js","sources":["../../../../../../../src/components/AlertDialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport React from 'react';\n\nexport type AlertDialogContext = {\n props: Record<string, any>;\n ref: React.Ref<HTMLElement>;\n};\n\nexport const AlertDialogContext = React.createContext<AlertDialogContext>({\n props: {},\n ref: null,\n});\n\nexport const useCurrentAlertDialog = () => {\n return React.useContext(AlertDialogContext);\n};\n"],"names":["AlertDialogContext","React","createContext","props","ref","useCurrentAlertDialog","useContext"],"mappings":";;AAAA;MAQaA,kBAAkB,gBAAGC,cAAK,CAACC,aAAa,CAAqB;EACtEC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE;CACR;MAEYC,qBAAqB,GAAG;EACjC,OAAOJ,cAAK,CAACK,UAAU,CAACN,kBAAkB,CAAC;AAC/C;;;;"}
@@ -2,7 +2,7 @@ import { forwardRef, createElement } from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
4
  const Backdrop = /*#__PURE__*/forwardRef(function Backdrop(props, ref) {
5
- const className = cn('fixed inset-0 cursor-default overflow-y-auto bg-purple-darker/[0.3] aria-hidden:invisible', props.className);
5
+ const className = cn('fixed inset-0 cursor-default overflow-y-auto bg-blue-900/[0.3] aria-hidden:invisible', props.className);
6
6
  return /*#__PURE__*/createElement("div", Object.assign({}, props, {
7
7
  className: className,
8
8
  "data-taco": "backdrop",
@@ -1 +1 @@
1
- {"version":3,"file":"Backdrop.js","sources":["../../../../../../../src/components/Backdrop/Backdrop.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nexport type BackdropProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Backdrop = React.forwardRef<HTMLDivElement, BackdropProps>(function Backdrop(props, ref) {\n const className = cn(\n 'fixed inset-0 cursor-default overflow-y-auto bg-purple-darker/[0.3] aria-hidden:invisible',\n props.className\n );\n\n return <div {...props} className={className} data-taco=\"backdrop\" ref={ref} />;\n});\n"],"names":["Backdrop","React","props","ref","className","cn"],"mappings":";;;MAKaA,QAAQ,gBAAGC,UAAgB,CAAgC,SAASD,QAAQ,CAACE,KAAK,EAAEC,GAAG;EAChG,MAAMC,SAAS,GAAGC,EAAE,CAChB,2FAA2F,EAC3FH,KAAK,CAACE,SAAS,CAClB;EAED,oBAAOH,uCAASC,KAAK;IAAEE,SAAS,EAAEA,SAAS;iBAAY,UAAU;IAACD,GAAG,EAAEA;KAAO;AAClF,CAAC;;;;"}
1
+ {"version":3,"file":"Backdrop.js","sources":["../../../../../../../src/components/Backdrop/Backdrop.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nexport type BackdropProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const Backdrop = React.forwardRef<HTMLDivElement, BackdropProps>(function Backdrop(props, ref) {\n const className = cn('fixed inset-0 cursor-default overflow-y-auto bg-blue-900/[0.3] aria-hidden:invisible', props.className);\n\n return <div {...props} className={className} data-taco=\"backdrop\" ref={ref} />;\n});\n"],"names":["Backdrop","React","props","ref","className","cn"],"mappings":";;;MAKaA,QAAQ,gBAAGC,UAAgB,CAAgC,SAASD,QAAQ,CAACE,KAAK,EAAEC,GAAG;EAChG,MAAMC,SAAS,GAAGC,EAAE,CAAC,sFAAsF,EAAEH,KAAK,CAACE,SAAS,CAAC;EAE7H,oBAAOH,uCAASC,KAAK;IAAEE,SAAS,EAAEA,SAAS;iBAAY,UAAU;IAACD,GAAG,EAAEA;KAAO;AAClF,CAAC;;;;"}
@@ -38,9 +38,8 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
38
38
  })];
39
39
  }
40
40
  const button = /*#__PURE__*/createElement(Base, Object.assign({}, buttonProps, {
41
- children: children,
42
41
  ref: ref
43
- }));
42
+ }), children);
44
43
  return createButtonWithOverlays({
45
44
  dialog,
46
45
  hanger,
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { getAppearanceClasses, getButtonClasses, createButtonWithTooltip, createButtonWithOverlays } from './util';\nimport { HangerProps } from '../Hanger/Hanger';\nimport { MenuProps } from '../Menu/Menu';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { PopoverProps } from '../Popover/Popover';\nimport './Button.css';\nimport { Icon } from '../Icon/Icon';\n\nexport type ButtonProps = ButtonPrimitive.ButtonProps & {\n /** Appearance will change the style of the button */\n appearance?: Appearance;\n /**\n * Dialog component associated with the button, clicking the button will open the dialog.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated dialog when clicked.\n */\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n /** If fluid, button expands to the width of it's container */\n fluid?: boolean;\n /** Hanger component associated with the button. */\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\n /** Menu component associated with the button. */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n /**\n * Popover component associated with the button, clicking the button will open the popover.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated popover when clicked.\n */\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\n /** A tooltip to show when hovering over the button */\n tooltip?: string;\n};\n\nconst Base = React.forwardRef(function ButtonBase(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { fluid, ...otherProps } = props;\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(otherProps.appearance),\n 'rounded px-3',\n {\n 'cursor-not-allowed opacity-50': props.disabled,\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\n 'w-full': fluid,\n },\n props.className\n );\n\n return createButtonWithTooltip({ ...otherProps, 'data-taco': 'button' }, className, ref);\n});\n\nexport const Button = React.forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { dialog, hanger, menu, popover, ...buttonProps } = props;\n\n let children = buttonProps.children;\n\n // add a chevron icon to menu buttons\n if (typeof menu === 'function') {\n children = Array.isArray(children)\n ? [...children, <Icon key=\"chevron-down\" name=\"chevron-down\" />]\n : [children, <Icon key=\"chevron-down\" name=\"chevron-down\" />];\n }\n\n const button = <Base {...buttonProps} children={children} ref={ref} />;\n\n return createButtonWithOverlays({ dialog, hanger, menu, popover }, button);\n});\n"],"names":["Base","React","ButtonBase","props","ref","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","appearance","disabled","createButtonWithTooltip","Button","dialog","hanger","menu","popover","buttonProps","children","Array","isArray","Icon","key","name","button","createButtonWithOverl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EC,MAAM;IAAEC,IAAI;IAAEC;GAAS,EAAEQ,MAAM,CAAC;AAC9E,CAAC;;;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { getAppearanceClasses, getButtonClasses, createButtonWithTooltip, createButtonWithOverlays } from './util';\nimport { HangerProps } from '../Hanger/Hanger';\nimport { MenuProps } from '../Menu/Menu';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { PopoverProps } from '../Popover/Popover';\nimport './Button.css';\nimport { Icon } from '../Icon/Icon';\n\nexport type ButtonProps = ButtonPrimitive.ButtonProps & {\n /** Appearance will change the style of the button */\n appearance?: Appearance;\n /**\n * Dialog component associated with the button, clicking the button will open the dialog.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated dialog when clicked.\n */\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n /** If fluid, button expands to the width of it's container */\n fluid?: boolean;\n /** Hanger component associated with the button. */\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\n /** Menu component associated with the button. */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n /**\n * Popover component associated with the button, clicking the button will open the popover.\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\n * the button should be only to open the associated popover when clicked.\n */\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\n /** A tooltip to show when hovering over the button */\n tooltip?: string | JSX.Element;\n};\n\nconst Base = React.forwardRef(function ButtonBase(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { fluid, ...otherProps } = props;\n const className = cn(\n getButtonClasses(),\n getAppearanceClasses(otherProps.appearance),\n 'rounded px-3',\n {\n 'cursor-not-allowed opacity-50': props.disabled,\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\n 'w-full': fluid,\n },\n props.className\n );\n\n return createButtonWithTooltip({ ...otherProps, 'data-taco': 'button' }, className, ref);\n});\n\nexport const Button = React.forwardRef(function Button(\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) {\n const { dialog, hanger, menu, popover, ...buttonProps } = props;\n\n let children = buttonProps.children;\n\n // add a chevron icon to menu buttons\n if (typeof menu === 'function') {\n children = Array.isArray(children)\n ? [...children, <Icon key=\"chevron-down\" name=\"chevron-down\" />]\n : [children, <Icon key=\"chevron-down\" name=\"chevron-down\" />];\n }\n\n const button = (\n <Base {...buttonProps} ref={ref}>\n {children}\n </Base>\n );\n\n return createButtonWithOverlays({ dialog, hanger, menu, popover }, button);\n});\n"],"names":["Base","React","ButtonBase","props","ref","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","appearance","disabled","createButtonWithTooltip","Button","dialog","hanger","menu","popover","buttonProps","children","Array","isArray","Icon","key","name","button","createButtonWithOverlays"],"mappings":";;;;;AAqCA,MAAMA,IAAI,gBAAGC,UAAgB,CAAC,SAASC,UAAU,CAACC,KAAkB,EAAEC,GAAqD;EACvH,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGH,KAAK;EACtC,MAAMI,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EAAE,EAClBC,oBAAoB,CAACJ,UAAU,CAACK,UAAU,CAAC,EAC3C,cAAc,EACd;IACI,+BAA+B,EAAER,KAAK,CAACS,QAAQ;IAC/C,sCAAsC,EAAE,CAACT,KAAK,CAACS,QAAQ;IACvD,QAAQ,EAAEP;GACb,EACDF,KAAK,CAACI,SAAS,CAClB;EAED,OAAOM,uBAAuB,CAAC;IAAE,GAAGP,UAAU;IAAE,WAAW,EAAE;GAAU,EAAEC,SAAS,EAAEH,GAAG,CAAC;AAC5F,CAAC,CAAC;MAEWU,MAAM,gBAAGb,UAAgB,CAAC,SAASa,MAAM,CAClDX,KAAkB,EAClBC,GAAqD;EAErD,MAAM;IAAEW,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAE,GAAGC;GAAa,GAAGhB,KAAK;EAE/D,IAAIiB,QAAQ,GAAGD,WAAW,CAACC,QAAQ;;EAGnC,IAAI,OAAOH,IAAI,KAAK,UAAU,EAAE;IAC5BG,QAAQ,GAAGC,KAAK,CAACC,OAAO,CAACF,QAAQ,CAAC,GAC5B,CAAC,GAAGA,QAAQ,eAAEnB,cAACsB,IAAI;MAACC,GAAG,EAAC,cAAc;MAACC,IAAI,EAAC;MAAiB,CAAC,GAC9D,CAACL,QAAQ,eAAEnB,cAACsB,IAAI;MAACC,GAAG,EAAC,cAAc;MAACC,IAAI,EAAC;MAAiB,CAAC;;EAGrE,MAAMC,MAAM,gBACRzB,cAACD,IAAI,oBAAKmB,WAAW;IAAEf,GAAG,EAAEA;MACvBgB,QAAQ,CAEhB;EAED,OAAOO,wBAAwB,CAAC;IAAEZ,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;GAAS,EAAEQ,MAAM,CAAC;AAC9E,CAAC;;;;"}
@@ -3,25 +3,25 @@ import { Button } from '../../primitives/Button.js';
3
3
  import { Tooltip } from '../Tooltip/Tooltip.js';
4
4
 
5
5
  const getButtonClasses = () => {
6
- return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center';
6
+ return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center';
7
7
  };
8
8
  const getAppearanceClasses = (value, icon = false) => {
9
9
  switch (value) {
10
10
  case 'primary':
11
- return `yt-blue-solid focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white hover:bg-blue-light hover:text-white hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white disabled:hover:yt-blue-solid disabled:hover:hover:border-blue`;
11
+ 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`;
12
12
  case 'danger':
13
- return `yt-red-solid focus:bg-red focus:text-white focus:yt-focus-red active:bg-red-dark active:text-white hover:bg-red-light hover:text-white hover:focus:bg-red-light hover:focus:text-white disabled:hover:yt-red-solid`;
13
+ 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`;
14
14
  case 'ghost':
15
- return `bg-white shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT)] text-blue focus:bg-transparent focus:text-blue active:bg-blue-lightest focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT),0_0_0_2px_rgba(0,99,255,0.25)] active:text-blue-dark hover:bg-blue-lightest hover:shadow-[inset_0_0_0_1px_theme(colors.blue.light)] hover:text-blue-light hover:focus:bg-blue-lightest hover:focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.light),0_0_0_2px_rgba(0,99,255,0.25)] hover:focus:text-blue-light`;
15
+ 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`;
16
16
  case 'discrete':
17
17
  {
18
18
  if (icon) {
19
- return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-darkest hover:focus:text-grey-darkest disabled:hover:text-black `;
19
+ return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-700 hover:focus:text-grey-700 disabled:hover:text-black `;
20
20
  }
21
- return `yt-transparent focus:text-blue focus:yt-focus active:text-blue-dark hover:text-blue-light hover:focus:text-blue-light disabled:hover:yt-transparent`;
21
+ 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`;
22
22
  }
23
23
  default:
24
- return `yt-grey-solid focus:bg-grey focus:yt-focus active:bg-grey-dark active:text-black hover:bg-grey-light hover:text-grey-darkest hover:focus:bg-grey-light hover:focus:text-grey-darkest disabled:hover:yt-grey-solid`;
24
+ 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`;
25
25
  }
26
26
  };
27
27
  const createButtonWithTooltip = (props, className, ref) => {
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `yt-blue-solid focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white hover:bg-blue-light hover:text-white hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white disabled:hover:yt-blue-solid disabled:hover:hover:border-blue`;\n\n case 'danger':\n return `yt-red-solid focus:bg-red focus:text-white focus:yt-focus-red active:bg-red-dark active:text-white hover:bg-red-light hover:text-white hover:focus:bg-red-light hover:focus:text-white disabled:hover:yt-red-solid`;\n\n case 'ghost':\n return `bg-white shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT)] text-blue focus:bg-transparent focus:text-blue active:bg-blue-lightest focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.DEFAULT),0_0_0_2px_rgba(0,99,255,0.25)] active:text-blue-dark hover:bg-blue-lightest hover:shadow-[inset_0_0_0_1px_theme(colors.blue.light)] hover:text-blue-light hover:focus:bg-blue-lightest hover:focus:!shadow-[inset_0_0_0_1px_theme(colors.blue.light),0_0_0_2px_rgba(0,99,255,0.25)] hover:focus:text-blue-light`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-darkest hover:focus:text-grey-darkest disabled:hover:text-black `;\n }\n\n return `yt-transparent focus:text-blue focus:yt-focus active:text-blue-dark hover:text-blue-light hover:focus:text-blue-light disabled:hover:yt-transparent`;\n }\n\n default:\n return `yt-grey-solid focus:bg-grey focus:yt-focus active:bg-grey-dark active:text-black hover:bg-grey-light hover:text-grey-darkest hover:focus:bg-grey-light hover:focus:text-grey-darkest disabled:hover:yt-grey-solid`;\n }\n};\n\nexport const createButtonWithTooltip = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { tooltip, ...buttonProps } = props;\n const button = <ButtonPrimitive.Button {...buttonProps} className={className} ref={ref} />;\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n\nexport const createButtonWithOverlays = (props: any, buttonBase: JSX.Element) => {\n const { dialog, hanger, menu, popover } = props;\n let button = buttonBase;\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n } else if (typeof menu === 'function') {\n button = menu({ trigger: button });\n } else if (typeof popover === 'function') {\n button = popover({ trigger: button });\n }\n\n if (typeof hanger === 'function') {\n button = hanger({ anchor: button });\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButtonWithTooltip","props","className","ref","tooltip","buttonProps","button","React","ButtonPrimitive","Tooltip","title","createButtonWithOverlays","bu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C;;EAGzC,IAAI,OAAOQ,MAAM,KAAK,UAAU,EAAE;IAC9BR,MAAM,GAAGQ,MAAM,CAAC;MAAEI,MAAM,EAAEZ;KAAQ,CAAC;;EAGvC,OAAOA,MAAM;AACjB;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n 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`;\n\n case 'danger':\n 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`;\n\n case 'ghost':\n 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`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-700 hover:focus:text-grey-700 disabled:hover:text-black `;\n }\n\n 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`;\n }\n\n default:\n 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`;\n }\n};\n\nexport const createButtonWithTooltip = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { tooltip, ...buttonProps } = props;\n const button = <ButtonPrimitive.Button {...buttonProps} className={className} ref={ref} />;\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n\nexport const createButtonWithOverlays = (props: any, buttonBase: JSX.Element) => {\n const { dialog, hanger, menu, popover } = props;\n let button = buttonBase;\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n } else if (typeof menu === 'function') {\n button = menu({ trigger: button });\n } else if (typeof popover === 'function') {\n button = popover({ trigger: button });\n }\n\n if (typeof hanger === 'function') {\n button = hanger({ anchor: button });\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButtonWithTooltip","props","className","ref","tooltip","buttonProps","button","React","ButtonPrimitive","Tooltip","title","createButtonWithOverlays","buttonBase","dialog","hanger","menu","popover","trigger","anchor"],"mappings":";;;;MAKaA,gBAAgB,GAAG;EAC5B,OAAO,+HAA+H;AAC1I;MAEaC,oBAAoB,GAAG,CAACC,KAA6B,EAAEC,IAAI,GAAG,KAAK;EAC5E,QAAQD,KAAK;IACT,KAAK,SAAS;MACV,6RAA6R;IAEjS,KAAK,QAAQ;MACT,0NAA0N;IAE9N,KAAK,OAAO;MACR,8dAA8d;IAEle,KAAK,UAAU;MAAE;QACb,IAAIC,IAAI,EAAE;UACN,gLAAgL;;QAGpL,2JAA2J;;IAG/J;MACI,iNAAiN;;AAE7N;MAEaC,uBAAuB,GAAG,CACnCC,KAAU,EACVC,SAAiB,EACjBC,GAAqD;EAErD,MAAM;IAAEC,OAAO;IAAE,GAAGC;GAAa,GAAGJ,KAAK;EACzC,MAAMK,MAAM,gBAAGC,6BAACC,MAAsB,oBAAKH,WAAW;IAAEH,SAAS,EAAEA,SAAS;IAAEC,GAAG,EAAEA;KAAO;EAE1F,IAAIC,OAAO,EAAE;IACT,oBAAOG,6BAACE,OAAO;MAACC,KAAK,EAAEN;OAAUE,MAAM,CAAW;;EAGtD,OAAOA,MAAM;AACjB;MAEaK,wBAAwB,GAAG,CAACV,KAAU,EAAEW,UAAuB;EACxE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;GAAS,GAAGf,KAAK;EAC/C,IAAIK,MAAM,GAAGM,UAAU;EAEvB,IAAI,OAAOC,MAAM,KAAK,UAAU,EAAE;IAC9BP,MAAM,GAAGO,MAAM,CAAC;MAAEI,OAAO,EAAEX;KAAQ,CAAC;GACvC,MAAM,IAAI,OAAOS,IAAI,KAAK,UAAU,EAAE;IACnCT,MAAM,GAAGS,IAAI,CAAC;MAAEE,OAAO,EAAEX;KAAQ,CAAC;GACrC,MAAM,IAAI,OAAOU,OAAO,KAAK,UAAU,EAAE;IACtCV,MAAM,GAAGU,OAAO,CAAC;MAAEC,OAAO,EAAEX;KAAQ,CAAC;;EAGzC,IAAI,OAAOQ,MAAM,KAAK,UAAU,EAAE;IAC9BR,MAAM,GAAGQ,MAAM,CAAC;MAAEI,MAAM,EAAEZ;KAAQ,CAAC;;EAGvC,OAAOA,MAAM;AACjB;;;;"}
@@ -6,7 +6,7 @@ import ReactDayPicker from 'react-day-picker';
6
6
 
7
7
  const thisYear = /*#__PURE__*/new Date().getFullYear();
8
8
  const years = [];
9
- for (let i = thisYear - 10; i <= thisYear + 10; i += 1) {
9
+ for (let i = thisYear - 50; i <= thisYear + 10; i += 1) {
10
10
  years.push(i);
11
11
  }
12
12
  const Navbar = /*#__PURE__*/memo(({
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.js","sources":["../../../../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport ReactDayPicker, { NavbarElementProps, Modifier } from 'react-day-picker';\nimport { useLocalization } from '../Provider/Localization';\nimport './Calendar.css';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type CalendarTextsActions = {\n /** Aria-label for previous month action button */\n previousMonth: string;\n /** Aria-label for next month action button */\n nextMonth: string;\n /** Aria-label for previous year action button */\n previousYear: string;\n /** Aria-label for next year action button */\n nextYear: string;\n /** Text displayed within today action button */\n today: string;\n};\n\nexport type CalendarTexts = {\n /** Text and aria-label for action buttons in Calendar */\n actions: CalendarTextsActions;\n /** Text abbreviation for months in Calendar's header, starting with January */\n months: string[];\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\n weekdaysShort: string[];\n};\n\n/** @internal */\ntype CustomNavbarElementProps = NavbarElementProps & {\n showYearControls?: boolean;\n onMonthChange: (month: Date) => void;\n value?: Date;\n};\n\nconst thisYear = new Date().getFullYear();\nconst years: number[] = [];\n\nfor (let i = thisYear - 10; i <= thisYear + 10; i += 1) {\n years.push(i);\n}\n\nconst Navbar = React.memo(\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\n const {\n texts: {\n calendar: { actions, months },\n },\n } = useLocalization();\n\n const handleChange = function handleChange(event) {\n const { year, month } = event.target.form;\n onMonthChange(new Date(year.value, month.value));\n };\n\n return (\n <div className=\"mb-2 flex items-center justify-between\">\n <form className=\"inline-flex space-x-1\">\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\n {months.map((month, i) => (\n <option key={month} value={i}>\n {month}\n </option>\n ))}\n </select>\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\n {years.map(year => (\n <option key={year} value={year}>\n {String(year)}\n </option>\n ))}\n </select>\n </form>\n <div>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-left\"\n aria-label={actions.previousMonth}\n onClick={() => onPreviousClick()}\n rounded\n />\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-right\"\n aria-label={actions.nextMonth}\n onClick={() => onNextClick()}\n rounded\n />\n </div>\n </div>\n );\n }\n);\n\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\n /** Handler called when a day is clicked in calendar */\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\n value?: Date;\n disabledDays?: Modifier[];\n};\n\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\n const { onChange: handleChange, value, disabledDays, ...otherProps } = props;\n const { locale, texts } = useLocalization();\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\n\n React.useEffect(() => {\n if (visibleMonth !== value) {\n setVisibleMonth(value ?? new Date());\n }\n }, [value]);\n\n const handleDayClick = (date, modifiers, event) => {\n if (modifiers.outside || modifiers.disabled) {\n return;\n }\n\n handleChange(date, event);\n };\n\n const handleCalendarClickToday = (): void => {\n const today = new Date();\n\n // set to midday to avoid UTC offset causing dates to be mismatched server side\n today.setHours(12);\n today.setMinutes(0);\n today.setSeconds(0);\n\n handleChange(today);\n };\n\n const className = cn('flex bg-white text-xs p-4', otherProps.className);\n\n return (\n <div data-taco=\"calendar\">\n <ReactDayPicker\n {...otherProps}\n className={className}\n month={visibleMonth}\n selectedDays={value}\n locale={locale.substring(0, 2)}\n firstDayOfWeek={1}\n months={texts.calendar.months}\n weekdaysShort={texts.calendar.weekdaysShort}\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\n onDayClick={handleDayClick}\n onMonthChange={setVisibleMonth}\n onTodayButtonClick={handleCalendarClickToday}\n captionElement={() => null}\n todayButton={texts.calendar.actions.today}\n numberOfMonths={1}\n ref={ref}\n disabledDays={disabledDays}\n />\n </div>\n );\n});\n"],"names":["thisYear","Date","getFullYear","years","i","push","Navbar","React","onMonthChange","onNextClick","onPreviousClick","value","texts","calendar","actions","months","useLocalization","handleChange","event","year","month","target","form","className","name","onChange","getMonth","map","key","String","IconButton","appearance","icon","previousMonth","onClick","rounded","nextMonth","Calendar","props","ref","disabledDays","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","modifiers","outside","disabled","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysShort","navbarElement","navProps","onDayClick","onTodayButtonClick","captionElement","todayButton","numberOfMonths"],"mappings":";;;;;;AAoCA,MAAMA,QAAQ,gBAAG,IAAIC,IAAI,EAAE,CAACC,WAAW,EAAE;AACzC,MAAMC,KAAK,GAAa,EAAE;AAE1B,KAAK,IAAIC,CAAC,GAAGJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAIJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAI,CAAC,EAAE;EACpDD,KAAK,CAACE,IAAI,CAACD,CAAC,CAAC;;AAGjB,MAAME,MAAM,gBAAGC,IAAU,CACrB,CAAC;EAAEC,aAAa;EAAEC,WAAW;EAAEC,eAAe;EAAEC,KAAK,GAAG,IAAIV,IAAI;CAA8B;EAC1F,MAAM;IACFW,KAAK,EAAE;MACHC,QAAQ,EAAE;QAAEC,OAAO;QAAEC;;;GAE5B,GAAGC,eAAe,EAAE;EAErB,MAAMC,YAAY,GAAG,SAASA,YAAY,CAACC,KAAK;IAC5C,MAAM;MAAEC,IAAI;MAAEC;KAAO,GAAGF,KAAK,CAACG,MAAM,CAACC,IAAI;IACzCd,aAAa,CAAC,IAAIP,IAAI,CAACkB,IAAI,CAACR,KAAK,EAAES,KAAK,CAACT,KAAK,CAAC,CAAC;GACnD;EAED,oBACIJ;IAAKgB,SAAS,EAAC;kBACXhB;IAAMgB,SAAS,EAAC;kBACZhB;IAAQgB,SAAS,EAAC,UAAU;IAACC,I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AAkB,EAAEd,wBAAwB;IAC5Ce,cAAc,EAAE,MAAM,IAAI;IAC1BC,WAAW,EAAEtD,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACqC,KAAK;IACzCgB,cAAc,EAAE,CAAC;IACjB5B,GAAG,EAAEA,GAAG;IACRC,YAAY,EAAEA;KAChB,CACA;AAEd,CAAC;;;;"}
1
+ {"version":3,"file":"Calendar.js","sources":["../../../../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport ReactDayPicker, { NavbarElementProps, Modifier } from 'react-day-picker';\nimport { useLocalization } from '../Provider/Localization';\nimport './Calendar.css';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type CalendarTextsActions = {\n /** Aria-label for previous month action button */\n previousMonth: string;\n /** Aria-label for next month action button */\n nextMonth: string;\n /** Aria-label for previous year action button */\n previousYear: string;\n /** Aria-label for next year action button */\n nextYear: string;\n /** Text displayed within today action button */\n today: string;\n};\n\nexport type CalendarTexts = {\n /** Text and aria-label for action buttons in Calendar */\n actions: CalendarTextsActions;\n /** Text abbreviation for months in Calendar's header, starting with January */\n months: string[];\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\n weekdaysShort: string[];\n};\n\n/** @internal */\ntype CustomNavbarElementProps = NavbarElementProps & {\n onMonthChange: (month: Date) => void;\n value?: Date;\n};\n\nconst thisYear = new Date().getFullYear();\nconst years: number[] = [];\n\nfor (let i = thisYear - 50; i <= thisYear + 10; i += 1) {\n years.push(i);\n}\n\nconst Navbar = React.memo(\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\n const {\n texts: {\n calendar: { actions, months },\n },\n } = useLocalization();\n\n const handleChange = function handleChange(event) {\n const { year, month } = event.target.form;\n onMonthChange(new Date(year.value, month.value));\n };\n\n return (\n <div className=\"mb-2 flex items-center justify-between\">\n <form className=\"inline-flex space-x-1\">\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\n {months.map((month, i) => (\n <option key={month} value={i}>\n {month}\n </option>\n ))}\n </select>\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\n {years.map(year => (\n <option key={year} value={year}>\n {String(year)}\n </option>\n ))}\n </select>\n </form>\n <div>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-left\"\n aria-label={actions.previousMonth}\n onClick={() => onPreviousClick()}\n rounded\n />\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-right\"\n aria-label={actions.nextMonth}\n onClick={() => onNextClick()}\n rounded\n />\n </div>\n </div>\n );\n }\n);\n\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\n /** Handler called when a day is clicked in calendar */\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\n value?: Date;\n disabledDays?: Modifier[];\n};\n\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\n const { onChange: handleChange, value, disabledDays, ...otherProps } = props;\n const { locale, texts } = useLocalization();\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\n\n React.useEffect(() => {\n if (visibleMonth !== value) {\n setVisibleMonth(value ?? new Date());\n }\n }, [value]);\n\n const handleDayClick = (date, modifiers, event) => {\n if (modifiers.outside || modifiers.disabled) {\n return;\n }\n\n handleChange(date, event);\n };\n\n const handleCalendarClickToday = (): void => {\n const today = new Date();\n\n // set to midday to avoid UTC offset causing dates to be mismatched server side\n today.setHours(12);\n today.setMinutes(0);\n today.setSeconds(0);\n\n handleChange(today);\n };\n\n const className = cn('flex bg-white text-xs p-4', otherProps.className);\n\n return (\n <div data-taco=\"calendar\">\n <ReactDayPicker\n {...otherProps}\n className={className}\n month={visibleMonth}\n selectedDays={value}\n locale={locale.substring(0, 2)}\n firstDayOfWeek={1}\n months={texts.calendar.months}\n weekdaysShort={texts.calendar.weekdaysShort}\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\n onDayClick={handleDayClick}\n onMonthChange={setVisibleMonth}\n onTodayButtonClick={handleCalendarClickToday}\n captionElement={() => null}\n todayButton={texts.calendar.actions.today}\n numberOfMonths={1}\n ref={ref}\n disabledDays={disabledDays}\n />\n </div>\n );\n});\n"],"names":["thisYear","Date","getFullYear","years","i","push","Navbar","React","onMonthChange","onNextClick","onPreviousClick","value","texts","calendar","actions","months","useLocalization","handleChange","event","year","month","target","form","className","name","onChange","getMonth","map","key","String","IconButton","appearance","icon","previousMonth","onClick","rounded","nextMonth","Calendar","props","ref","disabledDays","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","modifiers","outside","disabled","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysShort","navbarElement","navProps","onDayClick","onTodayButtonClick","captionElement","todayButton","numberOfMonths"],"mappings":";;;;;;AAmCA,MAAMA,QAAQ,gBAAG,IAAIC,IAAI,EAAE,CAACC,WAAW,EAAE;AACzC,MAAMC,KAAK,GAAa,EAAE;AAE1B,KAAK,IAAIC,CAAC,GAAGJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAIJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAI,CAAC,EAAE;EACpDD,KAAK,CAACE,IAAI,CAACD,CAAC,CAAC;;AAGjB,MAAME,MAAM,gBAAGC,IAAU,CACrB,CAAC;EAAEC,aAAa;EAAEC,WAAW;EAAEC,eAAe;EAAEC,KAAK,GAAG,IAAIV,IAAI;CAA8B;EAC1F,MAAM;IACFW,KAAK,EAAE;MACHC,QAAQ,EAAE;QAAEC,OAAO;QAAEC;;;GAE5B,GAAGC,eAAe,EAAE;EAErB,MAAMC,YAAY,GAAG,SAASA,YAAY,CAACC,KAAK;IAC5C,MAAM;MAAEC,IAAI;MAAEC;KAAO,GAAGF,KAAK,CAACG,MAAM,CAACC,IAAI;IACzCd,aAAa,CAAC,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Aa,EAAEC,QAAQ,iBAAIvD,cAACD,MAAM,oBAAKwD,QAAQ;MAAEtD,aAAa,EAAEoC,eAAe;MAAEjC,KAAK,EAAEgC;OAAgB;IACxGoB,UAAU,EAAElB,cAAc;IAC1BrC,aAAa,EAAEoC,eAAe;IAC9BoB,kBAAkB,EAAEd,wBAAwB;IAC5Ce,cAAc,EAAE,MAAM,IAAI;IAC1BC,WAAW,EAAEtD,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACqC,KAAK;IACzCgB,cAAc,EAAE,CAAC;IACjB5B,GAAG,EAAEA,GAAG;IACRC,YAAY,EAAEA;KAChB,CACA;AAEd,CAAC;;;;"}
@@ -18,10 +18,10 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
18
18
  const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem] focus:yt-focus',
19
19
  //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]
20
20
  props.className, {
21
- 'border-grey-dark text-blue hover:text-blue-light focus:border-blue focus:hover:border-blue-light': !props.disabled && !invalid,
22
- 'border-grey text-blue-light cursor-not-allowed': props.disabled,
21
+ 'border-grey-300 text-blue-500 hover:text-blue-300 focus:border-blue-500 focus:hover:border-blue-300': !props.disabled && !invalid,
22
+ 'border-grey-200 text-blue-300 cursor-not-allowed': props.disabled,
23
23
  'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
24
- 'border-red text-red hover:text-red-light hover:border-red-light focus:border-red focus:hover:border-red-light': invalid && !props.disabled
24
+ 'border-red-500 text-red-500 hover:text-red-300 hover:border-red-300 focus:border-red-500 focus:hover:border-red-300': invalid && !props.disabled
25
25
  });
26
26
  let handleChange;
27
27
  if (onChange) {
@@ -30,7 +30,7 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
30
30
  let labelledByProps = null;
31
31
  if (label) {
32
32
  labelledByProps = {
33
- ['aria-labelledby']: `${id}-label`,
33
+ 'aria-labelledby': `${id}-label`,
34
34
  id
35
35
  };
36
36
  }
@@ -48,7 +48,7 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
48
48
  })));
49
49
  if (label) {
50
50
  const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {
51
- 'cursor-not-allowed text-grey-dark': props.disabled
51
+ 'cursor-not-allowed text-grey-300': props.disabled
52
52
  }, props.className);
53
53
  return /*#__PURE__*/createElement("span", {
54
54
  className: labelContainerClassName
@@ -59,6 +59,7 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
59
59
  }
60
60
  return element;
61
61
  });
62
+ Checkbox.displayName = 'Checkbox';
62
63
 
63
64
  export { Checkbox };
64
65
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Icon } from '../Icon/Icon';\nimport { useId } from '../../hooks/useId';\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /* Increases visual prominenance of the checkbox */\n highlighted?: boolean;\n /**\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\n */\n indeterminate?: boolean;\n /* Whether the checkbox is in an invalid state */\n invalid?: boolean;\n /** Label for the checkbox */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\n\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\n const { checked, highlighted, indeterminate, invalid, label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem] focus:yt-focus', //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]\n props.className,\n {\n 'border-grey-dark text-blue hover:text-blue-light focus:border-blue focus:hover:border-blue-light':\n !props.disabled && !invalid,\n 'border-grey text-blue-light cursor-not-allowed': props.disabled,\n 'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,\n 'border-red text-red hover:text-red-light hover:border-red-light focus:border-red focus:hover:border-red-light':\n invalid && !props.disabled,\n }\n );\n\n let handleChange: ((checked: CheckedState) => void) | undefined;\n\n if (onChange) {\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\n }\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n ['aria-labelledby']: `${id}-label`,\n id,\n };\n }\n\n const element = (\n <CheckboxPrimitive.Root\n {...otherProps}\n {...labelledByProps}\n data-taco=\"checkbox\"\n checked={indeterminate ? 'indeterminate' : checked}\n className={className}\n onCheckedChange={handleChange}\n ref={ref}>\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn(\n 'flex items-center cursor-pointer gap-2',\n {\n 'cursor-not-allowed text-grey-dark': props.disabled,\n },\n props.className\n );\n\n return (\n <span className={labelContainerClassName}>\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\n"],"names":["Checkbox","React","props","ref","checked","highlighted","indeterminate","invalid","label","onChange","otherProps","id","useId","className","cn","disabled","handleChange","labelledByProps","element","CheckboxPrimitive","onCheckedChange","Icon","name","labelContainerClassName","htmlFor"],"mappings":";;;;;;MAyCaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQ,CAACE,KAAoB,EAAEC,GAAiC;EAC9G,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,aAAa;IAAEC,OAAO;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAC9F,MAAMS,EAAE,GAAGC,KAAK,CAACV,KAAK,CAACS,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,6FAA6F;;EAC7FZ,KAAK,CAACW,SAAS,EACf;IACI,kGAAkG,EAC9F,CAACX,KAAK,CAACa,QAAQ,IAAI,CAACR,OAAO;IAC/B,gDAAgD,EAAEL,KAAK,CAACa,QAAQ;IAChE,8DAA8D,EAAEV,WAAW;IAC3E,+GAA+G,EAC3GE,OAAO,IAAI,CAACL,KAAK,CAACa;GACzB,CACJ;EAED,IAAIC,YAA2D;EAE/D,IAAIP,QAAQ,EAAE;IACVO,YAAY,GAAIZ,OAAqB,IAAKK,QAAQ,CAACL,OAAO,KAAK,eAAe,GAAG,KAAK,GAAGA,OAAO,CAAC;;EAGrG,IAAIa,eAAe,GAAkC,IAAI;EAEzD,IAAIT,KAAK,EAAE;IACPS,eAAe,GAAG;MACd,CAAC,iBAAiB,MAAMN,UAAU;MAClCA;KACH;;EAGL,MAAMO,OAAO,gBACTjB,cAACkB,IAAsB,oBACfT,UAAU,EACVO,eAAe;iBACT,UAAU;IACpBb,OAAO,EAAEE,aAAa,GAAG,eAAe,GAAGF,OAAO;IAClDS,SAAS,EAAEA,SAAS;IACpBO,eAAe,EAAEJ,YAAY;IAC7Bb,GAAG,EAAEA;mBACLF,cAACkB,SAA2B;IAACN,SAAS,EAAC;kBACnCZ,cAACoB,IAAI;IAACC,IAAI,EAAEhB,aAAa,GAAG,MAAM,GAAG,MAAM;IAAEO,SAAS,EAAC;IAAoB,CACjD,CAErC;EAED,IAAIL,KAAK,EAAE;IACP,MAAMe,uBAAuB,GAAGT,EAAE,CAC9B,wCAAwC,EACxC;MACI,mCAAmC,EAAEZ,KAAK,CAACa;KAC9C,EACDb,KAAK,CAACW,SAAS,CAClB;IAED,oBACIZ;MAAMY,SAAS,EAAEU;OACZL,OAAO,eACRjB;MAAOuB,OAAO,EAAEb,EAAE;MAAEA,EAAE,KAAKA;OACtBH,KAAK,CACF,CACL;;EAIf,OAAOU,OAAO;AAClB,CAAC;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Icon } from '../Icon/Icon';\nimport { useId } from '../../hooks/useId';\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /* Increases visual prominenance of the checkbox */\n highlighted?: boolean;\n /**\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\n */\n indeterminate?: boolean;\n /* Whether the checkbox is in an invalid state */\n invalid?: boolean;\n /** Label for the checkbox */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\n\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\n const { checked, highlighted, indeterminate, invalid, label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem] focus:yt-focus', //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]\n props.className,\n {\n 'border-grey-300 text-blue-500 hover:text-blue-300 focus:border-blue-500 focus:hover:border-blue-300':\n !props.disabled && !invalid,\n 'border-grey-200 text-blue-300 cursor-not-allowed': props.disabled,\n 'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,\n 'border-red-500 text-red-500 hover:text-red-300 hover:border-red-300 focus:border-red-500 focus:hover:border-red-300':\n invalid && !props.disabled,\n }\n );\n\n let handleChange: ((checked: CheckedState) => void) | undefined;\n\n if (onChange) {\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\n }\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n 'aria-labelledby': `${id}-label`,\n id,\n };\n }\n\n const element = (\n <CheckboxPrimitive.Root\n {...otherProps}\n {...labelledByProps}\n data-taco=\"checkbox\"\n checked={indeterminate ? 'indeterminate' : checked}\n className={className}\n onCheckedChange={handleChange}\n ref={ref}>\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn(\n 'flex items-center cursor-pointer gap-2',\n {\n 'cursor-not-allowed text-grey-300': props.disabled,\n },\n props.className\n );\n\n return (\n <span className={labelContainerClassName}>\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\nCheckbox.displayName = 'Checkbox';\n"],"names":["Checkbox","React","props","ref","checked","highlighted","indeterminate","invalid","label","onChange","otherProps","id","useId","className","cn","disabled","handleChange","labelledByProps","element","CheckboxPrimitive","onCheckedChange","Icon","name","labelContainerClassName","htmlFor","displayName"],"mappings":";;;;;;MAyCaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQ,CAACE,KAAoB,EAAEC,GAAiC;EAC9G,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,aAAa;IAAEC,OAAO;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAC9F,MAAMS,EAAE,GAAGC,KAAK,CAACV,KAAK,CAACS,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,6FAA6F;;EAC7FZ,KAAK,CAACW,SAAS,EACf;IACI,qGAAqG,EACjG,CAACX,KAAK,CAACa,QAAQ,IAAI,CAACR,OAAO;IAC/B,kDAAkD,EAAEL,KAAK,CAACa,QAAQ;IAClE,8DAA8D,EAAEV,WAAW;IAC3E,qHAAqH,EACjHE,OAAO,IAAI,CAACL,KAAK,CAACa;GACzB,CACJ;EAED,IAAIC,YAA2D;EAE/D,IAAIP,QAAQ,EAAE;IACVO,YAAY,GAAIZ,OAAqB,IAAKK,QAAQ,CAACL,OAAO,KAAK,eAAe,GAAG,KAAK,GAAGA,OAAO,CAAC;;EAGrG,IAAIa,eAAe,GAAkC,IAAI;EAEzD,IAAIT,KAAK,EAAE;IACPS,eAAe,GAAG;MACd,iBAAiB,KAAKN,UAAU;MAChCA;KACH;;EAGL,MAAMO,OAAO,gBACTjB,cAACkB,IAAsB,oBACfT,UAAU,EACVO,eAAe;iBACT,UAAU;IACpBb,OAAO,EAAEE,aAAa,GAAG,eAAe,GAAGF,OAAO;IAClDS,SAAS,EAAEA,SAAS;IACpBO,eAAe,EAAEJ,YAAY;IAC7Bb,GAAG,EAAEA;mBACLF,cAACkB,SAA2B;IAACN,SAAS,EAAC;kBACnCZ,cAACoB,IAAI;IAACC,IAAI,EAAEhB,aAAa,GAAG,MAAM,GAAG,MAAM;IAAEO,SAAS,EAAC;IAAoB,CACjD,CAErC;EAED,IAAIL,KAAK,EAAE;IACP,MAAMe,uBAAuB,GAAGT,EAAE,CAC9B,wCAAwC,EACxC;MACI,kCAAkC,EAAEZ,KAAK,CAACa;KAC7C,EACDb,KAAK,CAACW,SAAS,CAClB;IAED,oBACIZ;MAAMY,SAAS,EAAEU;OACZL,OAAO,eACRjB;MAAOuB,OAAO,EAAEb,EAAE;MAAEA,EAAE,KAAKA;OACtBH,KAAK,CACF,CACL;;EAIf,OAAOU,OAAO;AAClB,CAAC;AACDlB,QAAQ,CAACyB,WAAW,GAAG,UAAU;;;;"}
@@ -3,10 +3,10 @@ import cn from 'classnames';
3
3
  import { IconButton } from '../IconButton/IconButton.js';
4
4
  import { useLocalization } from '../Provider/Localization.js';
5
5
  import { Root, Anchor, Portal, Content } from '@radix-ui/react-popover';
6
+ import { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener.js';
6
7
  import { Input } from '../Input/Input.js';
7
8
  import { ScrollableList } from '../Listbox/ScrollableList.js';
8
9
  import { useCombobox } from './useCombobox.js';
9
- import { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener.js';
10
10
 
11
11
  const Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
12
12
  const {
@@ -78,7 +78,7 @@ const Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
78
78
  },
79
79
  sideOffset: 4
80
80
  }, /*#__PURE__*/createElement(ScrollableList, Object.assign({}, list, {
81
- className: cn('!border-blue max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)]'),
81
+ className: cn('max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)] !border-blue-500'),
82
82
  style: {
83
83
  minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
84
84
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.js","sources":["../../../../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Input, InputProps } from '../Input/Input';\nimport { useCombobox } from './useCombobox';\nimport { ScrollableList, ScrollableListItem, ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { IconButton } from '../IconButton/IconButton';\nimport './Combobox.css';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { useLocalization } from '../Provider/Localization';\n\nexport type ComboboxTexts = {\n /* Tooltip shown for the dialog button */\n tooltip: string;\n};\n\nexport type ComboboxItem = ScrollableListItem;\nexport type ComboboxValue = ScrollableListItemValue;\n\ntype ComboboxBaseProps = Omit<InputProps, 'defaultValue' | 'button' | 'onChange' | 'value'> & {\n /** Array of options in combobox */\n data?: ComboboxItem[];\n /**\n * Initial value of the input in combobox.\n * This is used when combobox is mounted, if no value is provided.\n * *Note* that combobox is a controlled component, setting this will also trigger the `onChange` event\n */\n defaultValue?: ComboboxValue;\n /** Set what value should have an empty option in combobox */\n emptyValue?: ComboboxValue;\n /** Draws attention to the combobox by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Displays loading state in listbox */\n loading?: boolean;\n /**\n * Handler called when user chooses an option from the provided suggestions.\n * Suggestions will be calculated based on the input value.\n * There are two ways to choose an option: either click on it, or navigate using keyboard and press `enter`\n */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Handler called when the user enters a query **/\n onSearch?: (query: string) => void | Promise<void>;\n /** Value of the input in combobox */\n value?: ComboboxValue;\n};\n\ninterface InlineComboboxProps extends ComboboxBaseProps {\n dialog?: never;\n /**\n * Combobox will display its data when input is clicked/focused, even if the input is empty.\n * *Note* that default combobox will display matching data only when user starts typing in input.\n */\n inline: boolean; // Example 3 on https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html\n}\n\ninterface DialogComboboxProps extends ComboboxBaseProps {\n dialog: (props: Partial<DialogProps>) => JSX.Element;\n inline?: never;\n}\n\nexport type ComboboxProps = InlineComboboxProps | DialogComboboxProps;\n\nexport const Combobox = React.forwardRef(function Combobox(props: ComboboxProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, dialog, style, ...otherProps } = props;\n const { combobox, button, input, popover, list } = useCombobox(otherProps, ref);\n const internalRef = React.useRef<HTMLDivElement>(null);\n const { texts } = useLocalization();\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn(\n 'inline-flex relative',\n {\n 'yt-combobox--inline': props.inline,\n },\n externalClassName\n );\n\n return (\n <span className={className} data-taco=\"combobox\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Anchor asChild ref={internalRef}>\n <div {...combobox} className=\"inline w-full\" ref={ref}>\n <Input\n {...input}\n autoComplete=\"off\"\n button={\n props.inline ? (\n <IconButton\n // In case of inline combobox, this icon button acts only as visual chevron representation,\n // so should be taken out of screen reader scope.\n aria-hidden={true}\n appearance=\"discrete\"\n className=\"!border-l-0 focus:!border-none focus:!shadow-none active:!border-none\"\n icon={popover.open ? 'chevron-up' : 'chevron-down'}\n onClick={() => {\n popover.onOpenChange(true);\n input.ref.current?.focus();\n }}\n tabIndex={-1}\n />\n ) : dialog ? (\n <IconButton\n aria-label={texts.combobox.tooltip}\n icon=\"list-search\"\n disabled={props.readOnly || props.disabled}\n dialog={dialog}\n onFocus={(event: React.FocusEvent<HTMLButtonElement>) => {\n // Prevents the default focus behaviour of showing the tooltip, on parent tooltip element\n event.preventDefault();\n input.ref.current?.focus();\n }}\n ref={button.ref}\n tabIndex={-1}\n tooltip={texts.combobox.tooltip}\n />\n ) : undefined\n }\n />\n </div>\n </PopoverPrimitive.Anchor>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n align=\"start\"\n onOpenAutoFocus={event => {\n event.preventDefault();\n }}\n sideOffset={4}>\n <ScrollableList\n {...list}\n className={cn('!border-blue max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)]')}\n style={{ minWidth: selectDimensions?.width }}\n tabIndex={popover.open ? 0 : -1}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </span>\n );\n});\n"],"names":["Combobox","React","props","ref","className","externalClassName","dialog","style","otherProps","combobox","button","input","popover","list","useCombobox","internalRef","texts","useLocalization","selectDimensions","useBoundingClientRectListener","cn","inline","PopoverPrimitive","asChild","Input","autoComplete","IconButton","appearance","icon","open","onClick","onOpenChange","current","focus","tabIndex","tooltip","disabled","readOnly","onFocus","event","preventDefault","undefined","align","onOpenAutoFocus","sideOffset","ScrollableList","minWidth","width"],"mappings":";;;;;;;;;;MA+DaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQ,CAACE,KAAoB,EAAEC,GAAgC;EAC7G,MAAM;IAAEC,SAAS,EAAEC,iBAAiB;IAAEC,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC5E,MAAM;IAAEO,QAAQ;IAAEC,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAM,GAAGC,WAAW,CAACN,UAAU,EAAEL,GAAG,CAAC;EAC/E,MAAMY,WAAW,GAAGd,MAAY,CAAiB,IAAI,CAAC;EACtD,MAAM;IAAEe;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,gBAAgB,GAAGC,6BAA6B,CAACJ,WAAW,CAAC;EACnE,MAAMX,SAAS,GAAGgB,EAAE,CAChB,sBAAsB,EACtB;IACI,qBAAqB,EAAElB,KAAK,CAACmB;GAChC,EACDhB,iBAAiB,CACpB;EAED,oBACIJ;IAAMG,SAAS,EAAEA,SAAS;iBAAY,UAAU;IAACG,KAAK,EAAEA;kBACpDN,cAACqB,IAAqB,oBAAKV,OAAO,gBAC9BX,cAACqB,MAAuB;IAACC,OAAO;IAACpB,GAAG,EAAEY;kBAClCd,uCAASQ,QAAQ;IAAEL,SAAS,EAAC,eA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AE5B,gBAAgB,aAAhBA,gBAAgB,uBAAhBA,gBAAgB,CAAE6B;KAAO;IAC5Cb,QAAQ,EAAEtB,OAAO,CAACiB,IAAI,GAAG,CAAC,GAAG,CAAC;KAChC,CACqB,CACL,CACN,CACrB;AAEf,CAAC;;;;"}
1
+ {"version":3,"file":"Combobox.js","sources":["../../../../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Input, InputProps } from '../Input/Input';\nimport { useCombobox } from './useCombobox';\nimport { ScrollableList, ScrollableListItem, ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { IconButton } from '../IconButton/IconButton';\nimport './Combobox.css';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { useLocalization } from '../Provider/Localization';\n\nexport type ComboboxTexts = {\n /* Tooltip shown for the dialog button */\n tooltip: string;\n};\n\nexport type ComboboxItem = ScrollableListItem;\nexport type ComboboxValue = ScrollableListItemValue;\n\ntype ComboboxBaseProps = Omit<InputProps, 'defaultValue' | 'button' | 'onChange' | 'value'> & {\n /** Array of options in combobox */\n data?: ComboboxItem[];\n /**\n * Initial value of the input in combobox.\n * This is used when combobox is mounted, if no value is provided.\n * *Note* that combobox is a controlled component, setting this will also trigger the `onChange` event\n */\n defaultValue?: ComboboxValue;\n /** Set what value should have an empty option in combobox */\n emptyValue?: ComboboxValue;\n /** Draws attention to the combobox by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Displays loading state in listbox */\n loading?: boolean;\n /**\n * Handler called when user chooses an option from the provided suggestions.\n * Suggestions will be calculated based on the input value.\n * There are two ways to choose an option: either click on it, or navigate using keyboard and press `enter`\n */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Handler called when the user enters a query **/\n onSearch?: (query: string) => void | Promise<void>;\n /** Value of the input in combobox */\n value?: ComboboxValue;\n};\n\ninterface InlineComboboxProps extends ComboboxBaseProps {\n dialog?: never;\n /**\n * Combobox will display its data when input is clicked/focused, even if the input is empty.\n * *Note* that default combobox will display matching data only when user starts typing in input.\n */\n inline: boolean; // Example 3 on https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html\n}\n\ninterface DialogComboboxProps extends ComboboxBaseProps {\n dialog: (props: Partial<DialogProps>) => JSX.Element;\n inline?: never;\n}\n\nexport type ComboboxProps = InlineComboboxProps | DialogComboboxProps;\n\nexport const Combobox = React.forwardRef(function Combobox(props: ComboboxProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, dialog, style, ...otherProps } = props;\n const { combobox, button, input, popover, list } = useCombobox(otherProps, ref);\n const internalRef = React.useRef<HTMLDivElement>(null);\n const { texts } = useLocalization();\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn(\n 'inline-flex relative',\n {\n 'yt-combobox--inline': props.inline,\n },\n externalClassName\n );\n\n return (\n <span className={className} data-taco=\"combobox\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Anchor asChild ref={internalRef}>\n <div {...combobox} className=\"inline w-full\" ref={ref}>\n <Input\n {...input}\n autoComplete=\"off\"\n button={\n props.inline ? (\n <IconButton\n // In case of inline combobox, this icon button acts only as visual chevron representation,\n // so should be taken out of screen reader scope.\n aria-hidden\n appearance=\"discrete\"\n className=\"!border-l-0 focus:!border-none focus:!shadow-none active:!border-none\"\n icon={popover.open ? 'chevron-up' : 'chevron-down'}\n onClick={() => {\n popover.onOpenChange(true);\n input.ref.current?.focus();\n }}\n tabIndex={-1}\n />\n ) : dialog ? (\n <IconButton\n aria-label={texts.combobox.tooltip}\n icon=\"list-search\"\n disabled={props.readOnly || props.disabled}\n dialog={dialog}\n onFocus={(event: React.FocusEvent<HTMLButtonElement>) => {\n // Prevents the default focus behaviour of showing the tooltip, on parent tooltip element\n event.preventDefault();\n input.ref.current?.focus();\n }}\n ref={button.ref}\n tabIndex={-1}\n tooltip={texts.combobox.tooltip}\n />\n ) : undefined\n }\n />\n </div>\n </PopoverPrimitive.Anchor>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n align=\"start\"\n onOpenAutoFocus={event => {\n event.preventDefault();\n }}\n sideOffset={4}>\n <ScrollableList\n {...list}\n className={cn('max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)] !border-blue-500')}\n style={{ minWidth: selectDimensions?.width }}\n tabIndex={popover.open ? 0 : -1}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </span>\n );\n});\n"],"names":["Combobox","React","props","ref","className","externalClassName","dialog","style","otherProps","combobox","button","input","popover","list","useCombobox","internalRef","texts","useLocalization","selectDimensions","useBoundingClientRectListener","cn","inline","PopoverPrimitive","asChild","Input","autoComplete","IconButton","appearance","icon","open","onClick","onOpenChange","current","focus","tabIndex","tooltip","disabled","readOnly","onFocus","event","preventDefault","undefined","align","onOpenAutoFocus","sideOffset","ScrollableList","minWidth","width"],"mappings":";;;;;;;;;;MA+DaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQ,CAACE,KAAoB,EAAEC,GAAgC;EAC7G,MAAM;IAAEC,SAAS,EAAEC,iBAAiB;IAAEC,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC5E,MAAM;IAAEO,QAAQ;IAAEC,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAM,GAAGC,WAAW,CAACN,UAAU,EAAEL,GAAG,CAAC;EAC/E,MAAMY,WAAW,GAAGd,MAAY,CAAiB,IAAI,CAAC;EACtD,MAAM;IAAEe;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,gBAAgB,GAAGC,6BAA6B,CAACJ,WAAW,CAAC;EACnE,MAAMX,SAAS,GAAGgB,EAAE,CAChB,sBAAsB,EACtB;IACI,qBAAqB,EAAElB,KAAK,CAACmB;GAChC,EACDhB,iBAA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AO;IACbC,eAAe,EAAEJ,KAAK;MAClBA,KAAK,CAACC,cAAc,EAAE;KACzB;IACDI,UAAU,EAAE;kBACZ3C,cAAC4C,cAAc,oBACPhC,IAAI;IACRT,SAAS,EAAEgB,EAAE,CAAC,2EAA2E,CAAC;IAC1Fb,KAAK,EAAE;MAAEuC,QAAQ,EAAE5B,gBAAgB,aAAhBA,gBAAgB,uBAAhBA,gBAAgB,CAAE6B;KAAO;IAC5Cb,QAAQ,EAAEtB,OAAO,CAACiB,IAAI,GAAG,CAAC,GAAG,CAAC;KAChC,CACqB,CACL,CACN,CACrB;AAEf,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCombobox.js","sources":["../../../../../../../src/components/Combobox/useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport debounce from 'lodash/debounce';\nimport { ComboboxProps } from './Combobox';\nimport {\n setInputValueByRef,\n getIndexFromValue,\n findByValue,\n useFlattenedData,\n sanitizeItem,\n getOptionParents,\n filterData,\n} from '../Listbox/util';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { getId, ScrollableListItemValue, ScrollableListPropsWithRef } from '../Listbox/ScrollableList';\n\nconst debouncer = debounce(f => f(), 200);\n\nconst convertToInputValue = (value: ScrollableListItemValue | undefined) => String(value ?? '');\n\ntype useCombobox = React.HTMLAttributes<HTMLDivElement> & {\n combobox: React.HTMLAttributes<HTMLSpanElement>;\n input: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue'> & { ref: React.RefObject<HTMLInputElement> };\n list: ScrollableListPropsWithRef;\n button: { ref: any };\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n};\n\nexport const useCombobox = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data: unfilteredData = [],\n defaultValue,\n disabled,\n id: nativeId,\n inline,\n loading: __,\n onChange,\n onClick,\n onKeyDown,\n onSearch,\n readOnly,\n value,\n ...props\n }: Omit<ComboboxProps, 'dialog'>,\n ref: React.Ref<HTMLInputElement>\n): useCombobox => {\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const listRef = React.useRef<HTMLUListElement>(null);\n const [open, setOpen] = React.useState(false);\n const listId = React.useMemo(() => uuid(), []);\n const [inputValue, setInputValue] = React.useState<string>(convertToInputValue(value));\n const shouldFilterData = !onSearch && (!inline || (inline && inputValue !== convertToInputValue(value)));\n const flattenedData = useFlattenedData(unfilteredData);\n const data = React.useMemo(\n () => (shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData),\n [shouldFilterData, inputValue, flattenedData]\n );\n // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state\n const [currentIndex, setCurrentIndex] = React.useState<number | undefined>(\n inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined\n );\n\n const setInputValueByIndex = (index: number | undefined): void => {\n if (index !== undefined) {\n const option = data[index];\n\n if (option && !option.disabled) {\n setInputValueByRef(inputRef.current, option.value, 'focusout');\n }\n }\n };\n\n const setCurrentValue = (index: number | undefined) => {\n if (index === undefined) {\n return;\n }\n\n const option = data[index];\n\n // if the selected option is not already selected, trigger blur event\n if (option.value !== value) {\n setInputValueByIndex(index);\n } else {\n // if the selected option is already selected, refill input with its value\n setInputValue(convertToInputValue(value));\n }\n };\n\n // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set\n React.useEffect(() => {\n if (defaultValue && !value) {\n setInputValueByIndex(getIndexFromValue(data, defaultValue));\n }\n }, [data]);\n\n // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc\n React.useEffect(() => {\n if (value !== undefined && value !== inputValue) {\n setInputValue(convertToInputValue(value));\n }\n }, [value]);\n\n React.useEffect(() => {\n if (onSearch) {\n debouncer(() => {\n onSearch(inputValue);\n });\n }\n }, [inputValue]);\n\n // show listbox based on input value\n React.useEffect(() => {\n // don't show the popover if the internal (input) value already is the current value\n // this prevents the popover showing after selecting a value or pressing escape\n const isCurrentValue = value !== undefined && value !== null && inputValue === String(value);\n\n if (inputValue && data.length && !isCurrentValue) {\n setCurrentIndex(0);\n\n if (!open) {\n setOpen(true);\n }\n } else {\n setOpen(false);\n }\n }, [inputValue, data]);\n\n React.useEffect(() => {\n if (open) {\n setCurrentIndex(getIndexFromValue(data, inputValue) || 0);\n } else {\n setCurrentIndex(undefined);\n }\n }, [open]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (event.relatedTarget === listRef.current) {\n event.preventDefault();\n return;\n }\n\n if (onChange && event.target.value !== value) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const parents = getOptionParents(flattenedData, item?.path);\n\n if (parents !== null && parents.length > 0) {\n (event as any).detail.parents = parents;\n }\n\n onChange(event);\n }\n\n if (props.onBlur) {\n props.onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInputValue(event.target.value);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>): void => {\n if (inline || (!open && inputValue && data.length)) {\n setOpen(true);\n }\n\n if (onClick) {\n event.persist();\n onClick(event);\n }\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n event.persist();\n\n switch (event.key) {\n case 'Backspace': {\n return;\n }\n\n case 'Escape': {\n event.preventDefault();\n setInputValue(convertToInputValue(value));\n setOpen(false);\n return;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n\n setCurrentValue(currentIndex);\n setOpen(false);\n return;\n }\n\n case 'ArrowDown':\n if (open) {\n event.preventDefault();\n } else {\n if (!inline && buttonRef.current) {\n buttonRef.current.click();\n }\n }\n break;\n\n case 'ArrowUp':\n case 'Home':\n case 'End': {\n if (open) {\n event.preventDefault();\n }\n break;\n }\n\n default:\n }\n\n // we aren't focused on the list, so manually forward the keydown event to it\n if (listRef.current) {\n listRef.current.dispatchEvent(createCustomKeyboardEvent(event));\n }\n\n if (inline && !open) {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;\n setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);\n setOpen(true);\n }\n }\n\n if (!event.isDefaultPrevented() && onKeyDown) {\n event.persist();\n onKeyDown(event);\n }\n };\n\n const handleListboxChange = (index: number): void => {\n setCurrentIndex(index);\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>, index: number): void => {\n event.preventDefault();\n setCurrentValue(index);\n setOpen(false);\n };\n\n const combobox = {\n 'aria-expanded': open,\n 'aria-owns': listId,\n 'aria-haspopup': 'listbox' as const,\n role: 'combobox',\n };\n\n const input = {\n ...props,\n 'aria-controls': listId,\n // Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions\n // are related to the string that is present in the textbox\n 'aria-autocomplete': 'list' as const,\n // Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element\n 'aria-activedescendant':\n currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,\n 'aria-labelledby': ariaLabelledBy,\n disabled,\n onBlur: !disabled && !readOnly ? handleInputBlur : undefined,\n onChange: !disabled && !readOnly ? handleInputChange : undefined,\n onClick: !disabled && !readOnly ? handleInputClick : undefined,\n onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,\n readOnly,\n ref: inputRef,\n type: 'text',\n value: inputValue ?? '',\n };\n\n const list: ScrollableListPropsWithRef = {\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n id: listId,\n onChange: handleListboxChange,\n onClick: handleListboxClick,\n ref: listRef,\n scrollOnFocus: false,\n tabIndex: -1,\n value: currentIndex,\n };\n\n const button = {\n ref: buttonRef,\n };\n\n return {\n combobox,\n input,\n list,\n button,\n popover: {\n open,\n onOpenChange: setOpen,\n //visible: !data.length ? false : open,\n },\n };\n};\n"],"names":["debouncer","debounce","f","convertToInputValue","value","String","useCombobox","ariaLabel","ariaLabelledBy","data","unfilteredData","defaultValue","disabled","id","nativeId","inline","loading","__","onChange","onClick","onKeyDown","onSearch","readOnly","props","ref","inputRef","useMergedRef","buttonRef","React","listRef","open","setOpen","listId","uuid","inputValue","setInputValue","shouldFilterData","flattenedData","useFlattenedData","filterData","currentIndex","setCurrentIndex","undefined","getIndexFromValue","setInputValueByIndex","index","option","setInputValueByRef","current","setCurrentValue","isCurrentValue","length","handleInputBlur","event","persist","relatedTarget","preventDefault","target","item","findByValue","detail","sanitizeItem","parents","getOptionParents","path","onBlur","handleInputChange","handleInputClick","handleInputKeyDown","key","click","dispatchEvent","createCustomKeyboardEvent","initialIndex","isDefaultPrevented","handleListboxChange","handleListboxClick","combobox","role","input","getId","type","list","scrollOnFocus","tabIndex","button","popover","onOpenChange"],"mappings":";;;;;;;;AAiBA,MAAMA,SAAS,gBAAGC,QAAQ,CAACC,CAAC,IAAIA,CAAC,EAAE,EAAE,GAAG,CAAC;AAEzC,MAAMC,mBAAmB,GAAIC,KAA0C,IAAKC,MAAM,CAACD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC;MAUlFE,WAAW,GAAG,CACvB;EACI,YAAY,EAAEC,SAAS;EACvB,iBAAiB,EAAEC,cAAc;EACjCC,IAAI,EAAEC,cAAc,GAAG,EAAE;EACzBC,YAAY;EACZC,QAAQ;EACRC,EAAE,EAAEC,QAAQ;EACZC,MAAM;EACNC,OAAO,EAAEC,EAAE;EACXC,QAAQ;EACRC,OAAO;EACPC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRlB,KAAK;EACL,GAAGmB;CACyB,EAChCC,GAAgC;EAEhC,MAAMC,QAAQ,GAAGC,YAAY,CAAmBF,GAAG,CAAC;EACpD,MAAMG,SAAS,GAAGC,MAAY,CAAoB,IAAI,CAAC;EAC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EAAEC,QAAQ;IACbwD,IAAI,EAAE,MAAM;IACZ7E,KAAK,EAAE8B,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI;GACxB;EAED,MAAMgD,IAAI,GAA+B;IACrC,iBAAiB,EAAE1E,cAAc;IACjCC,IAAI;IACJG,QAAQ;IACRC,EAAE,EAAEmB,MAAM;IACVd,QAAQ,EAAEyD,mBAAmB;IAC7BxD,OAAO,EAAEyD,kBAAkB;IAC3BpD,GAAG,EAAEK,OAAO;IACZsD,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,CAAC,CAAC;IACZhF,KAAK,EAAEoC;GACV;EAED,MAAM6C,MAAM,GAAG;IACX7D,GAAG,EAAEG;GACR;EAED,OAAO;IACHkD,QAAQ;IACRE,KAAK;IACLG,IAAI;IACJG,MAAM;IACNC,OAAO,EAAE;MACLxD,IAAI;MACJyD,YAAY,EAAExD;;GAGrB;AACL;;;;"}
1
+ {"version":3,"file":"useCombobox.js","sources":["../../../../../../../src/components/Combobox/useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport debounce from 'lodash/debounce';\nimport { ComboboxProps } from './Combobox';\nimport {\n setInputValueByRef,\n getIndexFromValue,\n findByValue,\n useFlattenedData,\n sanitizeItem,\n getOptionParents,\n filterData,\n} from '../Listbox/util';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { getId, ScrollableListItemValue, ScrollableListPropsWithRef } from '../Listbox/ScrollableList';\nimport { InputProps } from '../Input/Input';\n\nconst debouncer = debounce(f => f(), 200);\n\nconst convertToInputValue = (value: ScrollableListItemValue | undefined) => String(value ?? '');\n\ntype useCombobox = React.HTMLAttributes<HTMLDivElement> & {\n combobox: React.HTMLAttributes<HTMLSpanElement>;\n input: Omit<InputProps, 'defaultValue'> & { ref: React.RefObject<HTMLInputElement> };\n list: ScrollableListPropsWithRef;\n button: { ref: any };\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n};\n\nexport const useCombobox = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data: unfilteredData = [],\n defaultValue,\n disabled,\n id: nativeId,\n inline,\n loading: __,\n onChange,\n onClick,\n onKeyDown,\n onSearch,\n readOnly,\n value,\n ...props\n }: Omit<ComboboxProps, 'dialog'>,\n ref: React.Ref<HTMLInputElement>\n): useCombobox => {\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const listRef = React.useRef<HTMLUListElement>(null);\n const [open, setOpen] = React.useState(false);\n const listId = React.useMemo(() => uuid(), []);\n const [inputValue, setInputValue] = React.useState<string>(convertToInputValue(value));\n const shouldFilterData = !onSearch && (!inline || (inline && inputValue !== convertToInputValue(value)));\n const flattenedData = useFlattenedData(unfilteredData);\n const data = React.useMemo(\n () => (shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData),\n [shouldFilterData, inputValue, flattenedData]\n );\n // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state\n const [currentIndex, setCurrentIndex] = React.useState<number | undefined>(\n inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined\n );\n\n const setInputValueByIndex = (index: number | undefined): void => {\n if (index !== undefined) {\n const option = data[index];\n\n if (option && !option.disabled) {\n setInputValueByRef(inputRef.current, option.value, 'focusout');\n }\n }\n };\n\n const setCurrentValue = (index: number | undefined) => {\n if (index === undefined) {\n return;\n }\n\n const option = data[index];\n\n // if the selected option is not already selected, trigger blur event\n if (option.value !== value) {\n setInputValueByIndex(index);\n } else {\n // if the selected option is already selected, refill input with its value\n setInputValue(convertToInputValue(value));\n }\n };\n\n // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set\n React.useEffect(() => {\n if (defaultValue && !value) {\n setInputValueByIndex(getIndexFromValue(data, defaultValue));\n }\n }, [data]);\n\n // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc\n React.useEffect(() => {\n if (value !== undefined && value !== inputValue) {\n setInputValue(convertToInputValue(value));\n }\n }, [value]);\n\n React.useEffect(() => {\n if (onSearch) {\n debouncer(() => {\n onSearch(inputValue);\n });\n }\n }, [inputValue]);\n\n // show listbox based on input value\n React.useEffect(() => {\n // don't show the popover if the internal (input) value already is the current value\n // this prevents the popover showing after selecting a value or pressing escape\n const isCurrentValue = value !== undefined && value !== null && inputValue === String(value);\n\n if (inputValue && data.length && !isCurrentValue) {\n setCurrentIndex(0);\n\n if (!open) {\n setOpen(true);\n }\n } else {\n setOpen(false);\n }\n }, [inputValue, data]);\n\n React.useEffect(() => {\n if (open) {\n setCurrentIndex(getIndexFromValue(data, inputValue) || 0);\n } else {\n setCurrentIndex(undefined);\n }\n }, [open]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (event.relatedTarget === listRef.current) {\n event.preventDefault();\n return;\n }\n\n if (onChange && event.target.value !== value) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const parents = getOptionParents(flattenedData, item?.path);\n\n if (parents !== null && parents.length > 0) {\n (event as any).detail.parents = parents;\n }\n\n onChange(event);\n }\n\n if (props.onBlur) {\n props.onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInputValue(event.target.value);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>): void => {\n if (inline || (!open && inputValue && data.length)) {\n setOpen(true);\n }\n\n if (onClick) {\n event.persist();\n onClick(event);\n }\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n event.persist();\n\n switch (event.key) {\n case 'Backspace': {\n return;\n }\n\n case 'Escape': {\n event.preventDefault();\n setInputValue(convertToInputValue(value));\n setOpen(false);\n return;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n\n setCurrentValue(currentIndex);\n setOpen(false);\n return;\n }\n\n case 'ArrowDown':\n if (open) {\n event.preventDefault();\n } else {\n if (!inline && buttonRef.current) {\n buttonRef.current.click();\n }\n }\n break;\n\n case 'ArrowUp':\n case 'Home':\n case 'End': {\n if (open) {\n event.preventDefault();\n }\n break;\n }\n\n default:\n }\n\n // we aren't focused on the list, so manually forward the keydown event to it\n if (listRef.current) {\n listRef.current.dispatchEvent(createCustomKeyboardEvent(event));\n }\n\n if (inline && !open) {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;\n setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);\n setOpen(true);\n }\n }\n\n if (!event.isDefaultPrevented() && onKeyDown) {\n event.persist();\n onKeyDown(event);\n }\n };\n\n const handleListboxChange = (index: number): void => {\n setCurrentIndex(index);\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>, index: number): void => {\n event.preventDefault();\n setCurrentValue(index);\n setOpen(false);\n };\n\n const combobox = {\n 'aria-expanded': open,\n 'aria-owns': listId,\n 'aria-haspopup': 'listbox' as const,\n role: 'combobox',\n };\n\n const input = {\n ...props,\n 'aria-controls': listId,\n // Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions\n // are related to the string that is present in the textbox\n 'aria-autocomplete': 'list' as const,\n // Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element\n 'aria-activedescendant':\n currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,\n 'aria-labelledby': ariaLabelledBy,\n disabled,\n onBlur: !disabled && !readOnly ? handleInputBlur : undefined,\n onChange: !disabled && !readOnly ? handleInputChange : undefined,\n onClick: !disabled && !readOnly ? handleInputClick : undefined,\n onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,\n readOnly,\n ref: inputRef,\n type: 'text',\n value: inputValue ?? '',\n };\n\n const list: ScrollableListPropsWithRef = {\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n id: listId,\n onChange: handleListboxChange,\n onClick: handleListboxClick,\n ref: listRef,\n scrollOnFocus: false,\n tabIndex: -1,\n value: currentIndex,\n };\n\n const button = {\n ref: buttonRef,\n };\n\n return {\n combobox,\n input,\n list,\n button,\n popover: {\n open,\n onOpenChange: setOpen,\n //visible: !data.length ? false : open,\n },\n };\n};\n"],"names":["debouncer","debounce","f","convertToInputValue","value","String","useCombobox","ariaLabel","ariaLabelledBy","data","unfilteredData","defaultValue","disabled","id","nativeId","inline","loading","__","onChange","onClick","onKeyDown","onSearch","readOnly","props","ref","inputRef","useMergedRef","buttonRef","React","listRef","open","setOpen","listId","uuid","inputValue","setInputValue","shouldFilterData","flattenedData","useFlattenedData","filterData","currentIndex","setCurrentIndex","undefined","getIndexFromValue","setInputValueByIndex","index","option","setInputValueByRef","current","setCurrentValue","isCurrentValue","length","handleInputBlur","event","persist","relatedTarget","preventDefault","target","item","findByValue","detail","sanitizeItem","parents","getOptionParents","path","onBlur","handleInputChange","handleInputClick","handleInputKeyDown","key","click","dispatchEvent","createCustomKeyboardEvent","initialIndex","isDefaultPrevented","handleListboxChange","handleListboxClick","combobox","role","input","getId","type","list","scrollOnFocus","tabIndex","button","popover","onOpenChange"],"mappings":";;;;;;;;AAkBA,MAAMA,SAAS,gBAAGC,QAAQ,CAACC,CAAC,IAAIA,CAAC,EAAE,EAAE,GAAG,CAAC;AAEzC,MAAMC,mBAAmB,GAAIC,KAA0C,IAAKC,MAAM,CAACD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC;MAUlFE,WAAW,GAAG,CACvB;EACI,YAAY,EAAEC,SAAS;EACvB,iBAAiB,EAAEC,cAAc;EACjCC,IAAI,EAAEC,cAAc,GAAG,EAAE;EACzBC,YAAY;EACZC,QAAQ;EACRC,EAAE,EAAEC,QAAQ;EACZC,MAAM;EACNC,OAAO,EAAEC,EAAE;EACXC,QAAQ;EACRC,OAAO;EACPC,SAAS;EACTC,QAA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P,QAAQ,IAAI,CAACU,QAAQ,GAAG6C,gBAAgB,GAAGzB,SAAS;IAC9DtB,SAAS,EAAE,CAACR,QAAQ,IAAI,CAACU,QAAQ,GAAG8C,kBAAkB,GAAG1B,SAAS;IAClEpB,QAAQ;IACRE,GAAG,EAAEC,QAAQ;IACbwD,IAAI,EAAE,MAAM;IACZ7E,KAAK,EAAE8B,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI;GACxB;EAED,MAAMgD,IAAI,GAA+B;IACrC,iBAAiB,EAAE1E,cAAc;IACjCC,IAAI;IACJG,QAAQ;IACRC,EAAE,EAAEmB,MAAM;IACVd,QAAQ,EAAEyD,mBAAmB;IAC7BxD,OAAO,EAAEyD,kBAAkB;IAC3BpD,GAAG,EAAEK,OAAO;IACZsD,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,CAAC,CAAC;IACZhF,KAAK,EAAEoC;GACV;EAED,MAAM6C,MAAM,GAAG;IACX7D,GAAG,EAAEG;GACR;EAED,OAAO;IACHkD,QAAQ;IACRE,KAAK;IACLG,IAAI;IACJG,MAAM;IACNC,OAAO,EAAE;MACLxD,IAAI;MACJyD,YAAY,EAAExD;;GAGrB;AACL;;;;"}
@@ -29,43 +29,47 @@ const Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
29
29
  "data-taco": "datepicker",
30
30
  style: style
31
31
  }, /*#__PURE__*/createElement(Input, Object.assign({}, input, {
32
- button: /*#__PURE__*/createElement(Popover, null, /*#__PURE__*/createElement(Popover.Trigger, null, /*#__PURE__*/createElement(IconButton, {
32
+ button: /*#__PURE__*/createElement(IconButton, {
33
33
  "aria-label": texts.datepicker.expand,
34
34
  disabled: input.disabled || input.readOnly,
35
- icon: "calendar"
36
- })), /*#__PURE__*/createElement(Popover.Content, null, ({
37
- close
38
- }) => /*#__PURE__*/createElement("div", {
39
- className: "-m-3 flex"
40
- }, /*#__PURE__*/createElement(Calendar, Object.assign({}, calendar, {
41
- onChange: (date, event) => {
42
- calendar.onChange(date, event);
43
- close();
44
- },
45
- tabIndex: -1
46
- })), shortcuts && /*#__PURE__*/createElement("div", {
47
- className: "border-grey-dark flex flex-col border-l"
48
- }, /*#__PURE__*/createElement("span", {
49
- className: "m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold"
50
- }, shortcutsText !== null && shortcutsText !== void 0 ? shortcutsText : texts.datepicker.shortcuts), /*#__PURE__*/createElement("ul", null, shortcuts.map((shortcut, i) => /*#__PURE__*/createElement("li", {
51
- key: i
52
- }, /*#__PURE__*/createElement("button", {
53
- className: "hover:bg-grey-light flex w-full items-start px-4 py-1 text-xs",
54
- onClick: event => {
55
- event.persist();
56
- shortcut.onClick(event);
57
- close();
58
- }
59
- }, shortcut.text)))), handleReset && /*#__PURE__*/createElement("button", {
60
- className: "text-blue hover:text-blue-light my-4 mx-auto mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs",
61
- onClick: event => {
62
- event.persist();
63
- handleReset(event);
64
- close();
65
- }
66
- }, texts.datepicker.clear)))))
35
+ icon: "calendar",
36
+ popover: props => /*#__PURE__*/createElement(Popover, Object.assign({}, props), /*#__PURE__*/createElement(Popover.Content, null, ({
37
+ close
38
+ }) => /*#__PURE__*/createElement("div", {
39
+ className: "-m-3 flex"
40
+ }, /*#__PURE__*/createElement(Calendar, Object.assign({}, calendar, {
41
+ onChange: (date, event) => {
42
+ calendar.onChange(date, event);
43
+ close();
44
+ },
45
+ tabIndex: -1
46
+ })), shortcuts && /*#__PURE__*/createElement("div", {
47
+ className: "border-grey-300 flex flex-col border-l"
48
+ }, /*#__PURE__*/createElement("span", {
49
+ className: "m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold"
50
+ }, shortcutsText !== null && shortcutsText !== void 0 ? shortcutsText : texts.datepicker.shortcuts), /*#__PURE__*/createElement("ul", null, shortcuts.map(shortcut => /*#__PURE__*/createElement("li", {
51
+ key: shortcut.text
52
+ }, /*#__PURE__*/createElement("button", {
53
+ type: "button",
54
+ className: "hover:bg-grey-100 flex w-full items-start px-4 py-1 text-xs",
55
+ onClick: event => {
56
+ event.persist();
57
+ shortcut.onClick(event);
58
+ close();
59
+ }
60
+ }, shortcut.text)))), handleReset && /*#__PURE__*/createElement("button", {
61
+ type: "button",
62
+ className: "my-4 mx-auto mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300",
63
+ onClick: event => {
64
+ event.persist();
65
+ handleReset(event);
66
+ close();
67
+ }
68
+ }, texts.datepicker.clear)))))
69
+ })
67
70
  })));
68
71
  });
72
+ Datepicker.displayName = 'Datepicker';
69
73
 
70
74
  export { Datepicker };
71
75
  //# sourceMappingURL=Datepicker.js.map