@economic/taco 8.1.2-hanger-base-ui.2 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/components/useChartData.cjs +2 -2
- package/dist/charts/components/useChartData.cjs.map +1 -1
- package/dist/charts/components/useChartData.js +2 -2
- package/dist/charts/components/useChartData.js.map +1 -1
- package/dist/components/Backdrop/Backdrop.cjs +1 -1
- package/dist/components/Backdrop/Backdrop.cjs.map +1 -1
- package/dist/components/Backdrop/Backdrop.js +1 -1
- package/dist/components/Backdrop/Backdrop.js.map +1 -1
- package/dist/components/Button/util.cjs +3 -3
- package/dist/components/Button/util.cjs.map +1 -1
- package/dist/components/Button/util.js +3 -3
- package/dist/components/Button/util.js.map +1 -1
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.cjs.map +1 -1
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +2 -2
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +2 -2
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Datepicker/Datepicker.cjs +2 -2
- package/dist/components/Datepicker/Datepicker.cjs.map +1 -1
- package/dist/components/Datepicker/Datepicker.js +2 -2
- package/dist/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/components/Drawer/components/Content.cjs +3 -3
- package/dist/components/Drawer/components/Content.cjs.map +1 -1
- package/dist/components/Drawer/components/Content.js +3 -3
- package/dist/components/Drawer/components/Content.js.map +1 -1
- package/dist/components/Drawer/util.cjs +1 -1
- package/dist/components/Drawer/util.cjs.map +1 -1
- package/dist/components/Drawer/util.js +1 -1
- package/dist/components/Drawer/util.js.map +1 -1
- package/dist/components/Field/Field.cjs +1 -1
- package/dist/components/Field/Field.cjs.map +1 -1
- package/dist/components/Field/Field.js +1 -1
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Hanger/Arrow.cjs +4 -3
- package/dist/components/Hanger/Arrow.cjs.map +1 -1
- package/dist/components/Hanger/Arrow.js +3 -3
- package/dist/components/Hanger/Arrow.js.map +1 -1
- package/dist/components/Hanger/Hanger.cjs +36 -33
- package/dist/components/Hanger/Hanger.cjs.map +1 -1
- package/dist/components/Hanger/Hanger.d.ts +1 -1
- package/dist/components/Hanger/Hanger.js +35 -33
- package/dist/components/Hanger/Hanger.js.map +1 -1
- package/dist/components/Header/Header.cjs +1 -1
- package/dist/components/Header/Header.cjs.map +1 -1
- package/dist/components/Header/Header.js +1 -1
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/Header/components/AgreementSelector.cjs +5 -5
- package/dist/components/Header/components/AgreementSelector.cjs.map +1 -1
- package/dist/components/Header/components/AgreementSelector.js +5 -5
- package/dist/components/Header/components/AgreementSelector.js.map +1 -1
- package/dist/components/Header/components/Button.cjs +1 -1
- package/dist/components/Header/components/Button.cjs.map +1 -1
- package/dist/components/Header/components/Button.js +1 -1
- package/dist/components/Header/components/Button.js.map +1 -1
- package/dist/components/Header/components/Link.cjs +1 -1
- package/dist/components/Header/components/Link.cjs.map +1 -1
- package/dist/components/Header/components/Link.js +1 -1
- package/dist/components/Header/components/Link.js.map +1 -1
- package/dist/components/Header/components/Logo.cjs +1 -1
- package/dist/components/Header/components/Logo.cjs.map +1 -1
- package/dist/components/Header/components/Logo.js +1 -1
- package/dist/components/Header/components/Logo.js.map +1 -1
- package/dist/components/Header/components/MenuButton.cjs +1 -1
- package/dist/components/Header/components/MenuButton.cjs.map +1 -1
- package/dist/components/Header/components/MenuButton.js +1 -1
- package/dist/components/Header/components/MenuButton.js.map +1 -1
- package/dist/components/Header/components/PrimaryNavigation.cjs +1 -1
- package/dist/components/Header/components/PrimaryNavigation.cjs.map +1 -1
- package/dist/components/Header/components/PrimaryNavigation.js +1 -1
- package/dist/components/Header/components/PrimaryNavigation.js.map +1 -1
- package/dist/components/HoverCard/HoverCard.cjs +2 -2
- package/dist/components/HoverCard/HoverCard.cjs.map +1 -1
- package/dist/components/HoverCard/HoverCard.js +2 -2
- package/dist/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/components/Input/util.cjs +7 -7
- package/dist/components/Input/util.cjs.map +1 -1
- package/dist/components/Input/util.js +7 -7
- package/dist/components/Input/util.js.map +1 -1
- package/dist/components/Layout/components/Sidebar.cjs +2 -2
- package/dist/components/Layout/components/Sidebar.cjs.map +1 -1
- package/dist/components/Layout/components/Sidebar.js +2 -2
- package/dist/components/Layout/components/Sidebar.js.map +1 -1
- package/dist/components/Menu/components/Item.cjs +1 -1
- package/dist/components/Menu/components/Item.cjs.map +1 -1
- package/dist/components/Menu/components/Item.js +1 -1
- package/dist/components/Menu/components/Item.js.map +1 -1
- package/dist/components/Navigation2/Navigation2.cjs +1 -1
- package/dist/components/Navigation2/Navigation2.cjs.map +1 -1
- package/dist/components/Navigation2/Navigation2.js +1 -1
- package/dist/components/Navigation2/Navigation2.js.map +1 -1
- package/dist/components/Navigation2/components/Content.cjs +1 -1
- package/dist/components/Navigation2/components/Content.cjs.map +1 -1
- package/dist/components/Navigation2/components/Content.js +1 -1
- package/dist/components/Navigation2/components/Content.js.map +1 -1
- package/dist/components/Navigation2/components/Group.cjs +1 -1
- package/dist/components/Navigation2/components/Group.cjs.map +1 -1
- package/dist/components/Navigation2/components/Group.js +1 -1
- package/dist/components/Navigation2/components/Group.js.map +1 -1
- package/dist/components/Navigation2/components/Link.cjs +1 -1
- package/dist/components/Navigation2/components/Link.cjs.map +1 -1
- package/dist/components/Navigation2/components/Link.js +1 -1
- package/dist/components/Navigation2/components/Link.js.map +1 -1
- package/dist/components/Navigation2/components/Section.cjs +1 -1
- package/dist/components/Navigation2/components/Section.cjs.map +1 -1
- package/dist/components/Navigation2/components/Section.js +1 -1
- package/dist/components/Navigation2/components/Section.js.map +1 -1
- package/dist/components/SearchInput2/SearchInput2.cjs +4 -4
- package/dist/components/SearchInput2/SearchInput2.cjs.map +1 -1
- package/dist/components/SearchInput2/SearchInput2.js +4 -4
- package/dist/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/components/Select/useSelect.cjs.map +1 -1
- package/dist/components/Select/useSelect.d.ts +2 -2
- package/dist/components/Select/useSelect.js.map +1 -1
- package/dist/components/Select2/Select2.cjs +1 -1
- package/dist/components/Select2/Select2.cjs.map +1 -1
- package/dist/components/Select2/Select2.js +1 -1
- package/dist/components/Select2/Select2.js.map +1 -1
- package/dist/components/Select2/components/Option.cjs +1 -1
- package/dist/components/Select2/components/Option.cjs.map +1 -1
- package/dist/components/Select2/components/Option.js +1 -1
- package/dist/components/Select2/components/Option.js.map +1 -1
- package/dist/components/Select2/utilities.cjs +2 -2
- package/dist/components/Select2/utilities.cjs.map +1 -1
- package/dist/components/Select2/utilities.js +2 -2
- package/dist/components/Select2/utilities.js.map +1 -1
- package/dist/components/Shortcut/Shortcut.cjs +1 -1
- package/dist/components/Shortcut/Shortcut.cjs.map +1 -1
- package/dist/components/Shortcut/Shortcut.js +1 -1
- package/dist/components/Shortcut/Shortcut.js.map +1 -1
- package/dist/components/Switch/Switch.cjs +2 -2
- package/dist/components/Switch/Switch.cjs.map +1 -1
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Table/components/BaseTable.cjs +1 -1
- package/dist/components/Table/components/BaseTable.cjs.map +1 -1
- package/dist/components/Table/components/BaseTable.js +1 -1
- package/dist/components/Table/components/BaseTable.js.map +1 -1
- package/dist/components/Table/util/renderRow.cjs +2 -2
- package/dist/components/Table/util/renderRow.cjs.map +1 -1
- package/dist/components/Table/util/renderRow.js +2 -2
- package/dist/components/Table/util/renderRow.js.map +1 -1
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.cjs +1 -1
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.cjs.map +1 -1
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.js +1 -1
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.cjs +1 -1
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.cjs.map +1 -1
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.js +1 -1
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
- package/dist/components/Table3/components/Toolbar/Editing/Editing.cjs +1 -1
- package/dist/components/Table3/components/Toolbar/Editing/Editing.cjs.map +1 -1
- package/dist/components/Table3/components/Toolbar/Editing/Editing.js +1 -1
- package/dist/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
- package/dist/components/Tabs/components/TabList.cjs +1 -1
- package/dist/components/Tabs/components/TabList.cjs.map +1 -1
- package/dist/components/Tabs/components/TabList.js +1 -1
- package/dist/components/Tabs/components/TabList.js.map +1 -1
- package/dist/components/Tabs/components/Trigger.cjs +1 -1
- package/dist/components/Tabs/components/Trigger.cjs.map +1 -1
- package/dist/components/Tabs/components/Trigger.js +1 -1
- package/dist/components/Tabs/components/Trigger.js.map +1 -1
- package/dist/components/Tag/Tag.cjs +1 -1
- package/dist/components/Tag/Tag.cjs.map +1 -1
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Toast/Toast.cjs +4 -4
- package/dist/components/Toast/Toast.cjs.map +1 -1
- package/dist/components/Toast/Toast.js +4 -4
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.cjs +4 -4
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +4 -4
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/taco.css +63 -79
- package/dist/tailwind.colors.cjs +156 -95
- package/dist/tailwind.colors.cjs.map +1 -1
- package/dist/tailwind.colors.js +156 -95
- package/dist/tailwind.colors.js.map +1 -1
- package/dist/utils/tailwind.cjs +26 -26
- package/dist/utils/tailwind.cjs.map +1 -1
- package/dist/utils/tailwind.js +26 -26
- package/dist/utils/tailwind.js.map +1 -1
- package/package.json +6 -5
- package/tailwind.colors.js +206 -95
- package/tailwind.config.js +10 -45
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.cjs","sources":["../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport cn from 'clsx';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { DialogProps } from '../../Dialog/Dialog';\nimport { Shortcut } from '../../Shortcut/Shortcut';\nimport { KeyDownHandlerOptions } from '../../../utils/keyboard';\n\nexport const Icon = ({ name }: { name: IconName }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nexport const useItemStyling = ({\n disabled,\n indented,\n className,\n}: {\n disabled?: boolean;\n indented: boolean;\n className?: string;\n}) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n /* TODO: Why have both hover and data-[highlighted]? */\n /* shadow-none on hover is to prevent the focus style from showing up on hover */\n 'cursor-pointer text-black hover:wcag-gray-
|
|
1
|
+
{"version":3,"file":"Item.cjs","sources":["../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport cn from 'clsx';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { DialogProps } from '../../Dialog/Dialog';\nimport { Shortcut } from '../../Shortcut/Shortcut';\nimport { KeyDownHandlerOptions } from '../../../utils/keyboard';\n\nexport const Icon = ({ name }: { name: IconName }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nexport const useItemStyling = ({\n disabled,\n indented,\n className,\n}: {\n disabled?: boolean;\n indented: boolean;\n className?: string;\n}) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n /* TODO: Why have both hover and data-[highlighted]? */\n /* shadow-none on hover is to prevent the focus style from showing up on hover */\n 'cursor-pointer text-black hover:wcag-gray-100 data-[highlighted]:wcag-gray-100 focus-visible:yt-focus hover:!shadow-none':\n !disabled,\n 'cursor-not-allowed hover:bg-white text-gray-300': disabled,\n },\n className\n );\n};\n\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean;\n icon?: IconName;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n shortcut?: string | KeyDownHandlerOptions;\n subMenu?: any;\n};\n\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\n const { dialog, icon, onClick, shortcut, subMenu, ...otherProps } = props;\n const menu = useCurrentMenu();\n\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const disabled = !!props.disabled || props['aria-disabled'] === true || props['aria-disabled'] === 'true';\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n event.stopPropagation();\n\n // For dialog items, use menu context to manage state (survives menu close)\n if (dialog && menu) {\n menu.openDialog(() =>\n dialog({\n open: true,\n onChange: (open: boolean) => {\n if (!open) menu.closeDialog();\n },\n onClose: () => menu.closeDialog(),\n })\n );\n return;\n }\n\n // Call onClick handler\n if (onClick) {\n onClick(event);\n }\n };\n\n if (subMenu) {\n return (\n <MenuPrimitive.SubmenuRoot>\n <MenuPrimitive.SubmenuTrigger {...otherProps} className={className} ref={ref}>\n {icon ? <Icon name={icon} /> : null}\n {props.children}\n <IconPrimitive className=\"-mr-1.5 ml-auto !h-5 !w-5\" name=\"chevron-right\" />\n </MenuPrimitive.SubmenuTrigger>\n {subMenu()}\n </MenuPrimitive.SubmenuRoot>\n );\n }\n\n const menuItem = (\n <MenuPrimitive.Item\n {...otherProps}\n // Need to set aria-haspopup=\"dialog\" otherwise there is no way to know item opens the dialo (in e2e tests), and we need to know this to be able to test this scenario in e2e tests.\n {...(dialog ? { 'aria-haspopup': 'dialog' } : {})}\n className={className}\n onClick={handleClick}\n ref={ref}\n disabled={disabled}>\n {icon ? <Icon name={icon} /> : null}\n {props.children}\n {shortcut ? (\n <span className=\"ml-auto pl-5\">\n <Shortcut keys={shortcut} className=\"text-gray-700\" />\n </span>\n ) : null}\n </MenuPrimitive.Item>\n );\n\n return menuItem;\n});\n"],"names":["React","IconPrimitive","menu","useCurrentMenu","MenuPrimitive","Shortcut"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUO,MAAM,OAAO,CAAC,EAAE,WAClBA,iCAAA,cAAA,QAAA,EAAK,WAAU,uBAAA,GACXA,iCAAA,cAAAC,OAAA,MAAA,EAAc,WAAU,2BAA0B,MAAY,CACnE;AAGG,MAAM,iBAAiB,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACJ,MAIM;AACF,QAAMC,QAAOC,QAAAA,eAAe;AAE5BH,mBAAM,UAAU,MAAM;AACd,QAAA,YAAY,EAACE,SAAA,gBAAAA,MAAM,WAAU;AAC7B,MAAAA,SAAA,gBAAAA,MAAM;AAAA,IAAoB;AAAA,EAC9B,GACD,CAAC,QAAQ,CAAC;AAEN,SAAA;AAAA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AAK,iBAAgB,CAC9E,GACC,SACL;AAAA,EAAA;AAIR,QAAM,WACFD,iCAAA;AAAA,IAACI,KAAAA,KAAc;AAAA,IAAd;AAAA,MACI,GAAG;AAAA,MAEH,GAAI,SAAS,EAAE,iBAAiB,aAAa,CAAC;AAAA,MAC/C;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IACC,OAAOJ,iCAAA,cAAC,MAAK,EAAA,MAAM,KAAM,CAAA,IAAK;AAAA,IAC9B,MAAM;AAAA,IACN,WACGA,iCAAA,cAAC,QAAK,EAAA,WAAU,kBACZA,iCAAA,cAACK,SAAAA,UAAS,EAAA,MAAM,UAAU,WAAU,gBAAgB,CAAA,CACxD,IACA;AAAA,EACR;AAGG,SAAA;AACX,CAAC;;;;"}
|
|
@@ -23,7 +23,7 @@ const useItemStyling = ({
|
|
|
23
23
|
"pl-1.5": !(menu == null ? void 0 : menu.indented),
|
|
24
24
|
/* TODO: Why have both hover and data-[highlighted]? */
|
|
25
25
|
/* shadow-none on hover is to prevent the focus style from showing up on hover */
|
|
26
|
-
"cursor-pointer text-black hover:wcag-gray-
|
|
26
|
+
"cursor-pointer text-black hover:wcag-gray-100 data-[highlighted]:wcag-gray-100 focus-visible:yt-focus hover:!shadow-none": !disabled,
|
|
27
27
|
"cursor-not-allowed hover:bg-white text-gray-300": disabled
|
|
28
28
|
},
|
|
29
29
|
className
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.js","sources":["../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport cn from 'clsx';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { DialogProps } from '../../Dialog/Dialog';\nimport { Shortcut } from '../../Shortcut/Shortcut';\nimport { KeyDownHandlerOptions } from '../../../utils/keyboard';\n\nexport const Icon = ({ name }: { name: IconName }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nexport const useItemStyling = ({\n disabled,\n indented,\n className,\n}: {\n disabled?: boolean;\n indented: boolean;\n className?: string;\n}) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n /* TODO: Why have both hover and data-[highlighted]? */\n /* shadow-none on hover is to prevent the focus style from showing up on hover */\n 'cursor-pointer text-black hover:wcag-gray-
|
|
1
|
+
{"version":3,"file":"Item.js","sources":["../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport cn from 'clsx';\nimport { IconName } from '../../Icon/Icon';\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\nimport { useCurrentMenu } from '../Context';\nimport { DialogProps } from '../../Dialog/Dialog';\nimport { Shortcut } from '../../Shortcut/Shortcut';\nimport { KeyDownHandlerOptions } from '../../../utils/keyboard';\n\nexport const Icon = ({ name }: { name: IconName }) => (\n <span className=\"absolute left-0 ml-1\">\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\n </span>\n);\n\nexport const useItemStyling = ({\n disabled,\n indented,\n className,\n}: {\n disabled?: boolean;\n indented: boolean;\n className?: string;\n}) => {\n const menu = useCurrentMenu();\n\n React.useEffect(() => {\n if (indented && !menu?.indented) {\n menu?.registerIndentation();\n }\n }, [indented]);\n\n return cn(\n 'flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group',\n {\n 'pl-7': menu?.indented,\n 'pl-1.5': !menu?.indented,\n /* TODO: Why have both hover and data-[highlighted]? */\n /* shadow-none on hover is to prevent the focus style from showing up on hover */\n 'cursor-pointer text-black hover:wcag-gray-100 data-[highlighted]:wcag-gray-100 focus-visible:yt-focus hover:!shadow-none':\n !disabled,\n 'cursor-not-allowed hover:bg-white text-gray-300': disabled,\n },\n className\n );\n};\n\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean;\n icon?: IconName;\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n shortcut?: string | KeyDownHandlerOptions;\n subMenu?: any;\n};\n\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\n const { dialog, icon, onClick, shortcut, subMenu, ...otherProps } = props;\n const menu = useCurrentMenu();\n\n const className = useItemStyling({\n disabled: props.disabled,\n indented: !!icon,\n className: props.className,\n });\n\n const disabled = !!props.disabled || props['aria-disabled'] === true || props['aria-disabled'] === 'true';\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n event.stopPropagation();\n\n // For dialog items, use menu context to manage state (survives menu close)\n if (dialog && menu) {\n menu.openDialog(() =>\n dialog({\n open: true,\n onChange: (open: boolean) => {\n if (!open) menu.closeDialog();\n },\n onClose: () => menu.closeDialog(),\n })\n );\n return;\n }\n\n // Call onClick handler\n if (onClick) {\n onClick(event);\n }\n };\n\n if (subMenu) {\n return (\n <MenuPrimitive.SubmenuRoot>\n <MenuPrimitive.SubmenuTrigger {...otherProps} className={className} ref={ref}>\n {icon ? <Icon name={icon} /> : null}\n {props.children}\n <IconPrimitive className=\"-mr-1.5 ml-auto !h-5 !w-5\" name=\"chevron-right\" />\n </MenuPrimitive.SubmenuTrigger>\n {subMenu()}\n </MenuPrimitive.SubmenuRoot>\n );\n }\n\n const menuItem = (\n <MenuPrimitive.Item\n {...otherProps}\n // Need to set aria-haspopup=\"dialog\" otherwise there is no way to know item opens the dialo (in e2e tests), and we need to know this to be able to test this scenario in e2e tests.\n {...(dialog ? { 'aria-haspopup': 'dialog' } : {})}\n className={className}\n onClick={handleClick}\n ref={ref}\n disabled={disabled}>\n {icon ? <Icon name={icon} /> : null}\n {props.children}\n {shortcut ? (\n <span className=\"ml-auto pl-5\">\n <Shortcut keys={shortcut} className=\"text-gray-700\" />\n </span>\n ) : null}\n </MenuPrimitive.Item>\n );\n\n return menuItem;\n});\n"],"names":["IconPrimitive","MenuPrimitive"],"mappings":";;;;;;AAUO,MAAM,OAAO,CAAC,EAAE,WAClB,sBAAA,cAAA,QAAA,EAAK,WAAU,uBAAA,GACX,sBAAA,cAAAA,QAAA,EAAc,WAAU,2BAA0B,MAAY,CACnE;AAGG,MAAM,iBAAiB,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACJ,MAIM;AACF,QAAM,OAAO,eAAe;AAE5B,QAAM,UAAU,MAAM;AACd,QAAA,YAAY,EAAC,6BAAM,WAAU;AAC7B,mCAAM;AAAA,IAAoB;AAAA,EAC9B,GACD,CAAC,QAAQ,CAAC;AAEN,SAAA;AAAA,IACH;AAAA,IACA;AAAA,MACI,QAAQ,6BAAM;AAAA,MACd,UAAU,EAAC,6BAAM;AAAA;AAAA;AAAA,MAGjB,4HACI,CAAC;AAAA,MACL,mDAAmD;AAAA,IACvD;AAAA,IACA;AAAA,EACJ;AACJ;AAWO,MAAM,OAAO,MAAM,WAAW,SAAS,SAAS,OAAsB,KAAgC;AACnG,QAAA,EAAE,QAAQ,MAAM,SAAS,UAAU,SAAS,GAAG,eAAe;AACpE,QAAM,OAAO,eAAe;AAE5B,QAAM,YAAY,eAAe;AAAA,IAC7B,UAAU,MAAM;AAAA,IAChB,UAAU,CAAC,CAAC;AAAA,IACZ,WAAW,MAAM;AAAA,EAAA,CACpB;AAEK,QAAA,WAAW,CAAC,CAAC,MAAM,YAAY,MAAM,eAAe,MAAM,QAAQ,MAAM,eAAe,MAAM;AAE7F,QAAA,cAAc,CAAC,UAA4C;AAC7D,QAAI,UAAU;AACV,YAAM,eAAe;AACrB;AAAA,IAAA;AAGJ,UAAM,gBAAgB;AAGtB,QAAI,UAAU,MAAM;AACX,WAAA;AAAA,QAAW,MACZ,OAAO;AAAA,UACH,MAAM;AAAA,UACN,UAAU,CAAC,SAAkB;AACrB,gBAAA,CAAC,KAAM,MAAK,YAAY;AAAA,UAChC;AAAA,UACA,SAAS,MAAM,KAAK,YAAY;AAAA,QACnC,CAAA;AAAA,MACL;AACA;AAAA,IAAA;AAIJ,QAAI,SAAS;AACT,cAAQ,KAAK;AAAA,IAAA;AAAA,EAErB;AAEA,MAAI,SAAS;AACT,WACK,sBAAA,cAAAC,KAAc,aAAd,MACI,sBAAA,cAAAA,KAAc,gBAAd,EAA8B,GAAG,YAAY,WAAsB,IAAA,GAC/D,OAAQ,sBAAA,cAAA,MAAA,EAAK,MAAM,MAAM,IAAK,MAC9B,MAAM,UACN,sBAAA,cAAAD,QAAA,EAAc,WAAU,6BAA4B,MAAK,iBAAgB,CAC9E,GACC,SACL;AAAA,EAAA;AAIR,QAAM,WACF,sBAAA;AAAA,IAACC,KAAc;AAAA,IAAd;AAAA,MACI,GAAG;AAAA,MAEH,GAAI,SAAS,EAAE,iBAAiB,aAAa,CAAC;AAAA,MAC/C;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IACC,OAAO,sBAAA,cAAC,MAAK,EAAA,MAAM,KAAM,CAAA,IAAK;AAAA,IAC9B,MAAM;AAAA,IACN,WACG,sBAAA,cAAC,QAAK,EAAA,WAAU,kBACZ,sBAAA,cAAC,UAAS,EAAA,MAAM,UAAU,WAAU,gBAAgB,CAAA,CACxD,IACA;AAAA,EACR;AAGG,SAAA;AACX,CAAC;"}
|
|
@@ -8,7 +8,7 @@ const Section = require("./components/Section.cjs");
|
|
|
8
8
|
const Content = require("./components/Content.cjs");
|
|
9
9
|
const Navigation2 = React.forwardRef(function Navigation22(props, ref) {
|
|
10
10
|
const { children, ...attributes } = props;
|
|
11
|
-
const className = cn("m-0 py-2 flex flex-col gap-y-px overflow-auto h-full w-full bg-
|
|
11
|
+
const className = cn("m-0 py-2 flex flex-col gap-y-px overflow-auto h-full w-full bg-brand-noon", props.className);
|
|
12
12
|
return /* @__PURE__ */ React.createElement("ul", { ...attributes, className, "data-taco": "navigation2", ref, role: "menubar", style: { opacity: 0.999 } }, children);
|
|
13
13
|
});
|
|
14
14
|
Navigation2.Group = Group.Group;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation2.cjs","sources":["../../../src/components/Navigation2/Navigation2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Group } from './components/Group';\nimport { Link } from './components/Link';\nimport { Section } from './components/Section';\nimport { Content } from './components/Content';\n\nexport type Navigation2Props = React.HTMLAttributes<HTMLUListElement>;\n\nexport const Navigation2 = React.forwardRef<HTMLUListElement, Navigation2Props>(function Navigation2(props, ref) {\n const { children, ...attributes } = props;\n const className = cn('m-0 py-2 flex flex-col gap-y-px overflow-auto h-full w-full bg-
|
|
1
|
+
{"version":3,"file":"Navigation2.cjs","sources":["../../../src/components/Navigation2/Navigation2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Group } from './components/Group';\nimport { Link } from './components/Link';\nimport { Section } from './components/Section';\nimport { Content } from './components/Content';\n\nexport type Navigation2Props = React.HTMLAttributes<HTMLUListElement>;\n\nexport const Navigation2 = React.forwardRef<HTMLUListElement, Navigation2Props>(function Navigation2(props, ref) {\n const { children, ...attributes } = props;\n const className = cn('m-0 py-2 flex flex-col gap-y-px overflow-auto h-full w-full bg-brand-noon', props.className);\n\n return (\n <ul {...attributes} className={className} data-taco=\"navigation2\" ref={ref} role=\"menubar\" style={{ opacity: 0.999 }}>\n {children}\n </ul>\n );\n}) as React.ForwardRefExoticComponent<Navigation2Props> & {\n Group: typeof Group;\n Link: typeof Link;\n Section: typeof Section;\n Content: typeof Content;\n};\n\nNavigation2.Group = Group;\nNavigation2.Link = Link;\nNavigation2.Section = Section;\nNavigation2.Content = Content;\n\nexport { getNavigationLinkClasses } from './components/Link';\n\nexport type { Navigation2ContentProps } from './components/Content';\nexport type { Navigation2GroupProps } from './components/Group';\nexport type { Navigation2LinkProps } from './components/Link';\nexport type { Navigation2SectionProps } from './components/Section';\n"],"names":["Navigation2","Group","Link","Section","Content"],"mappings":";;;;;;;;AASO,MAAM,cAAc,MAAM,WAA+C,SAASA,aAAY,OAAO,KAAK;AAC7G,QAAM,EAAE,UAAU,GAAG,WAAA,IAAe;AACpC,QAAM,YAAY,GAAG,6EAA6E,MAAM,SAAS;AAEjH,SACK,sBAAA,cAAA,MAAA,EAAI,GAAG,YAAY,WAAsB,aAAU,eAAc,KAAU,MAAK,WAAU,OAAO,EAAE,SAAS,MAAA,KACxG,QACL;AAER,CAAC;AAOD,YAAY,QAAQC,MAAA;AACpB,YAAY,OAAOC,KAAA;AACnB,YAAY,UAAUC,QAAA;AACtB,YAAY,UAAUC,QAAA;;;"}
|
|
@@ -7,7 +7,7 @@ import { Section } from "./components/Section.js";
|
|
|
7
7
|
import { Content } from "./components/Content.js";
|
|
8
8
|
const Navigation2 = React__default.forwardRef(function Navigation22(props, ref) {
|
|
9
9
|
const { children, ...attributes } = props;
|
|
10
|
-
const className = cn("m-0 py-2 flex flex-col gap-y-px overflow-auto h-full w-full bg-
|
|
10
|
+
const className = cn("m-0 py-2 flex flex-col gap-y-px overflow-auto h-full w-full bg-brand-noon", props.className);
|
|
11
11
|
return /* @__PURE__ */ React__default.createElement("ul", { ...attributes, className, "data-taco": "navigation2", ref, role: "menubar", style: { opacity: 0.999 } }, children);
|
|
12
12
|
});
|
|
13
13
|
Navigation2.Group = Group;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation2.js","sources":["../../../src/components/Navigation2/Navigation2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Group } from './components/Group';\nimport { Link } from './components/Link';\nimport { Section } from './components/Section';\nimport { Content } from './components/Content';\n\nexport type Navigation2Props = React.HTMLAttributes<HTMLUListElement>;\n\nexport const Navigation2 = React.forwardRef<HTMLUListElement, Navigation2Props>(function Navigation2(props, ref) {\n const { children, ...attributes } = props;\n const className = cn('m-0 py-2 flex flex-col gap-y-px overflow-auto h-full w-full bg-
|
|
1
|
+
{"version":3,"file":"Navigation2.js","sources":["../../../src/components/Navigation2/Navigation2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Group } from './components/Group';\nimport { Link } from './components/Link';\nimport { Section } from './components/Section';\nimport { Content } from './components/Content';\n\nexport type Navigation2Props = React.HTMLAttributes<HTMLUListElement>;\n\nexport const Navigation2 = React.forwardRef<HTMLUListElement, Navigation2Props>(function Navigation2(props, ref) {\n const { children, ...attributes } = props;\n const className = cn('m-0 py-2 flex flex-col gap-y-px overflow-auto h-full w-full bg-brand-noon', props.className);\n\n return (\n <ul {...attributes} className={className} data-taco=\"navigation2\" ref={ref} role=\"menubar\" style={{ opacity: 0.999 }}>\n {children}\n </ul>\n );\n}) as React.ForwardRefExoticComponent<Navigation2Props> & {\n Group: typeof Group;\n Link: typeof Link;\n Section: typeof Section;\n Content: typeof Content;\n};\n\nNavigation2.Group = Group;\nNavigation2.Link = Link;\nNavigation2.Section = Section;\nNavigation2.Content = Content;\n\nexport { getNavigationLinkClasses } from './components/Link';\n\nexport type { Navigation2ContentProps } from './components/Content';\nexport type { Navigation2GroupProps } from './components/Group';\nexport type { Navigation2LinkProps } from './components/Link';\nexport type { Navigation2SectionProps } from './components/Section';\n"],"names":["React","Navigation2"],"mappings":";;;;;;;AASO,MAAM,cAAcA,eAAM,WAA+C,SAASC,aAAY,OAAO,KAAK;AAC7G,QAAM,EAAE,UAAU,GAAG,WAAA,IAAe;AACpC,QAAM,YAAY,GAAG,6EAA6E,MAAM,SAAS;AAEjH,SACKD,+BAAA,cAAA,MAAA,EAAI,GAAG,YAAY,WAAsB,aAAU,eAAc,KAAU,MAAK,WAAU,OAAO,EAAE,SAAS,MAAA,KACxG,QACL;AAER,CAAC;AAOD,YAAY,QAAQ;AACpB,YAAY,OAAO;AACnB,YAAY,UAAU;AACtB,YAAY,UAAU;"}
|
|
@@ -6,7 +6,7 @@ const util = require("./util.cjs");
|
|
|
6
6
|
const Content = React.forwardRef(function Navigation2(props, ref) {
|
|
7
7
|
const { children, ...attributes } = props;
|
|
8
8
|
const className = cn(
|
|
9
|
-
"w-full overflow-auto p-3 mt-auto border-gray-200 flex-shrink-0 z-10
|
|
9
|
+
"w-full overflow-auto p-3 mt-auto border-gray-200 flex-shrink-0 z-10 [[role=menubar]>&:last-child]:pb-0",
|
|
10
10
|
util.getAdjacentClasses(),
|
|
11
11
|
props.className
|
|
12
12
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.cjs","sources":["../../../../src/components/Navigation2/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getAdjacentClasses } from './util';\n\nexport type Navigation2ContentProps = React.LiHTMLAttributes<HTMLLIElement>;\n\nexport const Content = React.forwardRef<HTMLLIElement, Navigation2ContentProps>(function Navigation2(props, ref) {\n const { children, ...attributes } = props;\n const className = cn(\n 'w-full overflow-auto p-3 mt-auto border-gray-200 flex-shrink-0 z-10
|
|
1
|
+
{"version":3,"file":"Content.cjs","sources":["../../../../src/components/Navigation2/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getAdjacentClasses } from './util';\n\nexport type Navigation2ContentProps = React.LiHTMLAttributes<HTMLLIElement>;\n\nexport const Content = React.forwardRef<HTMLLIElement, Navigation2ContentProps>(function Navigation2(props, ref) {\n const { children, ...attributes } = props;\n const className = cn(\n 'w-full overflow-auto p-3 mt-auto border-gray-200 flex-shrink-0 z-10 [[role=menubar]>&:last-child]:pb-0',\n getAdjacentClasses(),\n props.className\n );\n\n return (\n <li {...attributes} className={className} data-taco=\"navigation2-content\" ref={ref} role=\"none\">\n {children}\n </li>\n );\n});\n"],"names":["getAdjacentClasses"],"mappings":";;;;;AAMO,MAAM,UAAU,MAAM,WAAmD,SAAS,YAAY,OAAO,KAAK;AAC7G,QAAM,EAAE,UAAU,GAAG,WAAA,IAAe;AACpC,QAAM,YAAY;AAAA,IACd;AAAA,IACAA,wBAAmB;AAAA,IACnB,MAAM;AAAA,EACV;AAGI,SAAA,sBAAA,cAAC,MAAI,EAAA,GAAG,YAAY,WAAsB,aAAU,uBAAsB,KAAU,MAAK,OAAA,GACpF,QACL;AAER,CAAC;;"}
|
|
@@ -4,7 +4,7 @@ import { getAdjacentClasses } from "./util.js";
|
|
|
4
4
|
const Content = React__default.forwardRef(function Navigation2(props, ref) {
|
|
5
5
|
const { children, ...attributes } = props;
|
|
6
6
|
const className = cn(
|
|
7
|
-
"w-full overflow-auto p-3 mt-auto border-gray-200 flex-shrink-0 z-10
|
|
7
|
+
"w-full overflow-auto p-3 mt-auto border-gray-200 flex-shrink-0 z-10 [[role=menubar]>&:last-child]:pb-0",
|
|
8
8
|
getAdjacentClasses(),
|
|
9
9
|
props.className
|
|
10
10
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.js","sources":["../../../../src/components/Navigation2/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getAdjacentClasses } from './util';\n\nexport type Navigation2ContentProps = React.LiHTMLAttributes<HTMLLIElement>;\n\nexport const Content = React.forwardRef<HTMLLIElement, Navigation2ContentProps>(function Navigation2(props, ref) {\n const { children, ...attributes } = props;\n const className = cn(\n 'w-full overflow-auto p-3 mt-auto border-gray-200 flex-shrink-0 z-10
|
|
1
|
+
{"version":3,"file":"Content.js","sources":["../../../../src/components/Navigation2/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getAdjacentClasses } from './util';\n\nexport type Navigation2ContentProps = React.LiHTMLAttributes<HTMLLIElement>;\n\nexport const Content = React.forwardRef<HTMLLIElement, Navigation2ContentProps>(function Navigation2(props, ref) {\n const { children, ...attributes } = props;\n const className = cn(\n 'w-full overflow-auto p-3 mt-auto border-gray-200 flex-shrink-0 z-10 [[role=menubar]>&:last-child]:pb-0',\n getAdjacentClasses(),\n props.className\n );\n\n return (\n <li {...attributes} className={className} data-taco=\"navigation2-content\" ref={ref} role=\"none\">\n {children}\n </li>\n );\n});\n"],"names":["React"],"mappings":";;;AAMO,MAAM,UAAUA,eAAM,WAAmD,SAAS,YAAY,OAAO,KAAK;AAC7G,QAAM,EAAE,UAAU,GAAG,WAAA,IAAe;AACpC,QAAM,YAAY;AAAA,IACd;AAAA,IACA,mBAAmB;AAAA,IACnB,MAAM;AAAA,EACV;AAGI,SAAAA,+BAAA,cAAC,MAAI,EAAA,GAAG,YAAY,WAAsB,aAAU,uBAAsB,KAAU,MAAK,OAAA,GACpF,QACL;AAER,CAAC;"}
|
|
@@ -7,7 +7,7 @@ const Group = React.forwardRef(function Group2(props, ref) {
|
|
|
7
7
|
const { children, defaultExpanded = false, heading, onClick, ...attributes } = props;
|
|
8
8
|
const [expanded, setExpanded] = React.useState(defaultExpanded);
|
|
9
9
|
const className = cn(
|
|
10
|
-
"flex w-full cursor-pointer items-center rounded px-3 font-bold text-left leading-8 hover:bg-black
|
|
10
|
+
"flex w-full cursor-pointer items-center rounded px-3 font-bold text-left leading-8 hover:bg-black-subtle focus-visible:yt-focus-dark",
|
|
11
11
|
attributes.className
|
|
12
12
|
);
|
|
13
13
|
const handleClick = (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Group.cjs","sources":["../../../../src/components/Navigation2/components/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon } from '../../Icon/Icon';\n\nexport type Navigation2GroupProps = Omit<React.LiHTMLAttributes<HTMLLIElement>, 'onClick'> & {\n defaultExpanded?: boolean;\n heading: string | JSX.Element;\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n};\n\nexport const Group = React.forwardRef<HTMLLIElement, Navigation2GroupProps>(function Group(props, ref) {\n const { children, defaultExpanded = false, heading, onClick, ...attributes } = props;\n const [expanded, setExpanded] = React.useState(defaultExpanded);\n const className = cn(\n 'flex w-full cursor-pointer items-center rounded px-3 font-bold text-left leading-8 hover:bg-black
|
|
1
|
+
{"version":3,"file":"Group.cjs","sources":["../../../../src/components/Navigation2/components/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon } from '../../Icon/Icon';\n\nexport type Navigation2GroupProps = Omit<React.LiHTMLAttributes<HTMLLIElement>, 'onClick'> & {\n defaultExpanded?: boolean;\n heading: string | JSX.Element;\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n};\n\nexport const Group = React.forwardRef<HTMLLIElement, Navigation2GroupProps>(function Group(props, ref) {\n const { children, defaultExpanded = false, heading, onClick, ...attributes } = props;\n const [expanded, setExpanded] = React.useState(defaultExpanded);\n const className = cn(\n 'flex w-full cursor-pointer items-center rounded px-3 font-bold text-left leading-8 hover:bg-black-subtle focus-visible:yt-focus-dark',\n attributes.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setExpanded(!expanded);\n\n if (onClick) {\n onClick(event);\n }\n };\n\n return (\n <li {...attributes} role=\"none\" className=\"[[role=menubar]>&]:px-3\" ref={ref}>\n <button\n aria-haspopup=\"true\"\n aria-expanded={expanded}\n data-taco=\"navigation2-group\"\n className={className}\n onClick={handleClick}\n role=\"menuitem\">\n <Icon className=\"-ml-2 !h-5 !w-5\" name={expanded ? 'chevron-down-solid' : 'chevron-right-solid'} />\n <span className=\"flex-grow truncate\">{heading}</span>\n </button>\n <ul className={cn('mb-0 flex flex-col gap-y-px pt-px', { hidden: !expanded })} role=\"menu\">\n {children}\n </ul>\n </li>\n );\n});\n"],"names":["Group","Icon"],"mappings":";;;;;AAUO,MAAM,QAAQ,MAAM,WAAiD,SAASA,OAAM,OAAO,KAAK;AAC7F,QAAA,EAAE,UAAU,kBAAkB,OAAO,SAAS,SAAS,GAAG,eAAe;AAC/E,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAS,eAAe;AAC9D,QAAM,YAAY;AAAA,IACd;AAAA,IACA,WAAW;AAAA,EACf;AAEM,QAAA,cAAc,CAAC,UAA+C;AAChE,gBAAY,CAAC,QAAQ;AAErB,QAAI,SAAS;AACT,cAAQ,KAAK;AAAA,IAAA;AAAA,EAErB;AAGI,SAAA,sBAAA,cAAC,QAAI,GAAG,YAAY,MAAK,QAAO,WAAU,2BAA0B,IAChE,GAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,iBAAc;AAAA,MACd,iBAAe;AAAA,MACf,aAAU;AAAA,MACV;AAAA,MACA,SAAS;AAAA,MACT,MAAK;AAAA,IAAA;AAAA,wCACJC,KAAK,MAAA,EAAA,WAAU,mBAAkB,MAAM,WAAW,uBAAuB,uBAAuB;AAAA,IAChG,sBAAA,cAAA,QAAA,EAAK,WAAU,qBAAA,GAAsB,OAAQ;AAAA,EAAA,GAElD,sBAAA,cAAC,MAAG,EAAA,WAAW,GAAG,qCAAqC,EAAE,QAAQ,CAAC,UAAU,GAAG,MAAK,OAAA,GAC/E,QACL,CACJ;AAER,CAAC;;"}
|
|
@@ -5,7 +5,7 @@ const Group = React__default.forwardRef(function Group2(props, ref) {
|
|
|
5
5
|
const { children, defaultExpanded = false, heading, onClick, ...attributes } = props;
|
|
6
6
|
const [expanded, setExpanded] = React__default.useState(defaultExpanded);
|
|
7
7
|
const className = cn(
|
|
8
|
-
"flex w-full cursor-pointer items-center rounded px-3 font-bold text-left leading-8 hover:bg-black
|
|
8
|
+
"flex w-full cursor-pointer items-center rounded px-3 font-bold text-left leading-8 hover:bg-black-subtle focus-visible:yt-focus-dark",
|
|
9
9
|
attributes.className
|
|
10
10
|
);
|
|
11
11
|
const handleClick = (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Group.js","sources":["../../../../src/components/Navigation2/components/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon } from '../../Icon/Icon';\n\nexport type Navigation2GroupProps = Omit<React.LiHTMLAttributes<HTMLLIElement>, 'onClick'> & {\n defaultExpanded?: boolean;\n heading: string | JSX.Element;\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n};\n\nexport const Group = React.forwardRef<HTMLLIElement, Navigation2GroupProps>(function Group(props, ref) {\n const { children, defaultExpanded = false, heading, onClick, ...attributes } = props;\n const [expanded, setExpanded] = React.useState(defaultExpanded);\n const className = cn(\n 'flex w-full cursor-pointer items-center rounded px-3 font-bold text-left leading-8 hover:bg-black
|
|
1
|
+
{"version":3,"file":"Group.js","sources":["../../../../src/components/Navigation2/components/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon } from '../../Icon/Icon';\n\nexport type Navigation2GroupProps = Omit<React.LiHTMLAttributes<HTMLLIElement>, 'onClick'> & {\n defaultExpanded?: boolean;\n heading: string | JSX.Element;\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n};\n\nexport const Group = React.forwardRef<HTMLLIElement, Navigation2GroupProps>(function Group(props, ref) {\n const { children, defaultExpanded = false, heading, onClick, ...attributes } = props;\n const [expanded, setExpanded] = React.useState(defaultExpanded);\n const className = cn(\n 'flex w-full cursor-pointer items-center rounded px-3 font-bold text-left leading-8 hover:bg-black-subtle focus-visible:yt-focus-dark',\n attributes.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setExpanded(!expanded);\n\n if (onClick) {\n onClick(event);\n }\n };\n\n return (\n <li {...attributes} role=\"none\" className=\"[[role=menubar]>&]:px-3\" ref={ref}>\n <button\n aria-haspopup=\"true\"\n aria-expanded={expanded}\n data-taco=\"navigation2-group\"\n className={className}\n onClick={handleClick}\n role=\"menuitem\">\n <Icon className=\"-ml-2 !h-5 !w-5\" name={expanded ? 'chevron-down-solid' : 'chevron-right-solid'} />\n <span className=\"flex-grow truncate\">{heading}</span>\n </button>\n <ul className={cn('mb-0 flex flex-col gap-y-px pt-px', { hidden: !expanded })} role=\"menu\">\n {children}\n </ul>\n </li>\n );\n});\n"],"names":["React","Group"],"mappings":";;;AAUO,MAAM,QAAQA,eAAM,WAAiD,SAASC,OAAM,OAAO,KAAK;AAC7F,QAAA,EAAE,UAAU,kBAAkB,OAAO,SAAS,SAAS,GAAG,eAAe;AAC/E,QAAM,CAAC,UAAU,WAAW,IAAID,eAAM,SAAS,eAAe;AAC9D,QAAM,YAAY;AAAA,IACd;AAAA,IACA,WAAW;AAAA,EACf;AAEM,QAAA,cAAc,CAAC,UAA+C;AAChE,gBAAY,CAAC,QAAQ;AAErB,QAAI,SAAS;AACT,cAAQ,KAAK;AAAA,IAAA;AAAA,EAErB;AAGI,SAAAA,+BAAA,cAAC,QAAI,GAAG,YAAY,MAAK,QAAO,WAAU,2BAA0B,IAChE,GAAAA,+BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,iBAAc;AAAA,MACd,iBAAe;AAAA,MACf,aAAU;AAAA,MACV;AAAA,MACA,SAAS;AAAA,MACT,MAAK;AAAA,IAAA;AAAA,iDACJ,MAAK,EAAA,WAAU,mBAAkB,MAAM,WAAW,uBAAuB,uBAAuB;AAAA,IAChGA,+BAAA,cAAA,QAAA,EAAK,WAAU,qBAAA,GAAsB,OAAQ;AAAA,EAAA,GAElDA,+BAAA,cAAC,MAAG,EAAA,WAAW,GAAG,qCAAqC,EAAE,QAAQ,CAAC,UAAU,GAAG,MAAK,OAAA,GAC/E,QACL,CACJ;AAER,CAAC;"}
|
|
@@ -16,7 +16,7 @@ const getNavigationLinkClasses = (isDraggedOver = false) => cn(
|
|
|
16
16
|
// override styles to adjust badges included in menu links
|
|
17
17
|
'[&>span_[data-taco="badge"]]:mr-2.5 [[role=menu]>li>&>span_[data-taco="badge"]]:mr-2',
|
|
18
18
|
{
|
|
19
|
-
"hover:bg-black
|
|
19
|
+
"hover:bg-black-subtle aria-current-page:bg-blue-500/[.1]": !isDraggedOver,
|
|
20
20
|
"!bg-blue-500 !text-white [&>*]:!text-white": isDraggedOver
|
|
21
21
|
}
|
|
22
22
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.cjs","sources":["../../../../src/components/Navigation2/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { useDropTarget } from '../../../utils/hooks/useDropTarget';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Badge } from '../../Badge/Badge';\nimport { MenuProps } from '../../Menu/Menu';\nimport { getAdjacentClasses } from './util';\n\nexport const getNavigationLinkClasses = (isDraggedOver = false) =>\n cn(\n 'group relative flex w-full items-center rounded leading-8 !text-black px-2 focus-visible:yt-focus-dark',\n // override styles for links that are children of collapsible menus\n 'font-bold [[role=menu]>li>&]:font-normal [[role=menu]>li>&]:pl-5',\n // override styles to adjust icons included in menu links\n '[&_[data-taco=\"icon\"]]:!h-5 [&_[data-taco=\"icon\"]]:!w-5',\n // override styles to adjust badges included in menu links\n '[&>span_[data-taco=\"badge\"]]:mr-2.5 [[role=menu]>li>&>span_[data-taco=\"badge\"]]:mr-2',\n {\n 'hover:bg-black
|
|
1
|
+
{"version":3,"file":"Link.cjs","sources":["../../../../src/components/Navigation2/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { useDropTarget } from '../../../utils/hooks/useDropTarget';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Badge } from '../../Badge/Badge';\nimport { MenuProps } from '../../Menu/Menu';\nimport { getAdjacentClasses } from './util';\n\nexport const getNavigationLinkClasses = (isDraggedOver = false) =>\n cn(\n 'group relative flex w-full items-center rounded leading-8 !text-black px-2 focus-visible:yt-focus-dark',\n // override styles for links that are children of collapsible menus\n 'font-bold [[role=menu]>li>&]:font-normal [[role=menu]>li>&]:pl-5',\n // override styles to adjust icons included in menu links\n '[&_[data-taco=\"icon\"]]:!h-5 [&_[data-taco=\"icon\"]]:!w-5',\n // override styles to adjust badges included in menu links\n '[&>span_[data-taco=\"badge\"]]:mr-2.5 [[role=menu]>li>&>span_[data-taco=\"badge\"]]:mr-2',\n {\n 'hover:bg-black-subtle aria-current-page:bg-blue-500/[.1]': !isDraggedOver,\n '!bg-blue-500 !text-white [&>*]:!text-white': isDraggedOver,\n }\n );\n\nexport type Navigation2LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n active?: boolean;\n icon?: IconName;\n /** Menu component associated with the button. */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n /** Handler to be used when dropping a dragged element over the Navigation2 link */\n onDrop?: React.DragEventHandler;\n /** Total shown inside a Badge component */\n total?: number;\n};\n\nexport const Link = React.forwardRef<HTMLAnchorElement, Navigation2LinkProps>(function Link(props, ref) {\n const { active, children, icon, menu, onDrop, total, ...attributes } = props;\n const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);\n\n const className = cn(getNavigationLinkClasses(isDraggedOver), attributes.className);\n\n const listClassName = cn('[[role=menubar]>&]:px-3 border-gray-200', getAdjacentClasses(), {\n '[&>*]:pointer-events-none': isDraggedOver,\n });\n\n return (\n <li {...dropTargetProps} className={listClassName} data-taco=\"navigation2-link-item\" role=\"none\">\n <a\n {...attributes}\n aria-current={active ? 'page' : undefined}\n className={className}\n data-taco=\"navigation2-link\"\n ref={ref}\n role=\"menuitem\"\n tabIndex={0}>\n {icon ? <Icon className=\"mr-1.5 [[role=menu]>li>a>&]:-ml-1.5 [[role=menu]>li>a>&]:mr-0.5\" name={icon} /> : null}\n <span className=\"flex flex-grow items-center truncate\">{children}</span>\n {menu ? (\n <IconButton\n appearance=\"discrete\"\n icon=\"more\"\n aria-label=\"More\"\n rounded\n className={cn(\n '-mr-1.5 hidden flex-shrink-0 flex-grow-0 transition-none group-hover:flex aria-expanded:flex',\n {\n 'absolute right-0 !mr-0.5': total !== undefined,\n }\n )}\n menu={menu}\n onClick={event => {\n event.preventDefault();\n event.stopPropagation();\n }}\n />\n ) : null}\n {total === undefined ? null : (\n <Badge\n className={cn('flex-shrink-0 flex-grow-0 !font-normal', {\n 'group-hover:hidden [[aria-expanded=\"true\"]+&]:hidden ': menu,\n })}\n color=\"transparent\">\n {total}\n </Badge>\n )}\n </a>\n </li>\n );\n});\n"],"names":["Link","useDropTarget","getAdjacentClasses","Icon","IconButton","Badge"],"mappings":";;;;;;;;;AASa,MAAA,2BAA2B,CAAC,gBAAgB,UACrD;AAAA,EACI;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,IACI,4DAA4D,CAAC;AAAA,IAC7D,8CAA8C;AAAA,EAAA;AAEtD;AAaG,MAAM,OAAO,MAAM,WAAoD,SAASA,MAAK,OAAO,KAAK;AAC9F,QAAA,EAAE,QAAQ,UAAU,MAAM,MAAM,QAAQ,OAAO,GAAG,WAAA,IAAe;AACvE,QAAM,CAAC,eAAe,eAAe,IAAIC,cAAAA,cAAc,MAAM;AAE7D,QAAM,YAAY,GAAG,yBAAyB,aAAa,GAAG,WAAW,SAAS;AAElF,QAAM,gBAAgB,GAAG,2CAA2CC,KAAA,mBAAA,GAAsB;AAAA,IACtF,6BAA6B;AAAA,EAAA,CAChC;AAGG,SAAA,sBAAA,cAAC,QAAI,GAAG,iBAAiB,WAAW,eAAe,aAAU,yBAAwB,MAAK,OACtF,GAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAG;AAAA,MACJ,gBAAc,SAAS,SAAS;AAAA,MAChC;AAAA,MACA,aAAU;AAAA,MACV;AAAA,MACA,MAAK;AAAA,MACL,UAAU;AAAA,IAAA;AAAA,IACT,OAAQ,sBAAA,cAAAC,WAAA,EAAK,WAAU,mEAAkE,MAAM,KAAM,CAAA,IAAK;AAAA,IAC1G,sBAAA,cAAA,QAAA,EAAK,WAAU,uCAAA,GAAwC,QAAS;AAAA,IAChE,OACG,sBAAA;AAAA,MAACC,WAAA;AAAA,MAAA;AAAA,QACG,YAAW;AAAA,QACX,MAAK;AAAA,QACL,cAAW;AAAA,QACX,SAAO;AAAA,QACP,WAAW;AAAA,UACP;AAAA,UACA;AAAA,YACI,4BAA4B,UAAU;AAAA,UAAA;AAAA,QAE9C;AAAA,QACA;AAAA,QACA,SAAS,CAAS,UAAA;AACd,gBAAM,eAAe;AACrB,gBAAM,gBAAgB;AAAA,QAAA;AAAA,MAC1B;AAAA,IAAA,IAEJ;AAAA,IACH,UAAU,SAAY,OACnB,sBAAA;AAAA,MAACC,MAAA;AAAA,MAAA;AAAA,QACG,WAAW,GAAG,0CAA0C;AAAA,UACpD,yDAAyD;AAAA,QAAA,CAC5D;AAAA,QACD,OAAM;AAAA,MAAA;AAAA,MACL;AAAA,IAAA;AAAA,EACL,CAGZ;AAER,CAAC;;;"}
|
|
@@ -14,7 +14,7 @@ const getNavigationLinkClasses = (isDraggedOver = false) => cn(
|
|
|
14
14
|
// override styles to adjust badges included in menu links
|
|
15
15
|
'[&>span_[data-taco="badge"]]:mr-2.5 [[role=menu]>li>&>span_[data-taco="badge"]]:mr-2',
|
|
16
16
|
{
|
|
17
|
-
"hover:bg-black
|
|
17
|
+
"hover:bg-black-subtle aria-current-page:bg-blue-500/[.1]": !isDraggedOver,
|
|
18
18
|
"!bg-blue-500 !text-white [&>*]:!text-white": isDraggedOver
|
|
19
19
|
}
|
|
20
20
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sources":["../../../../src/components/Navigation2/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { useDropTarget } from '../../../utils/hooks/useDropTarget';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Badge } from '../../Badge/Badge';\nimport { MenuProps } from '../../Menu/Menu';\nimport { getAdjacentClasses } from './util';\n\nexport const getNavigationLinkClasses = (isDraggedOver = false) =>\n cn(\n 'group relative flex w-full items-center rounded leading-8 !text-black px-2 focus-visible:yt-focus-dark',\n // override styles for links that are children of collapsible menus\n 'font-bold [[role=menu]>li>&]:font-normal [[role=menu]>li>&]:pl-5',\n // override styles to adjust icons included in menu links\n '[&_[data-taco=\"icon\"]]:!h-5 [&_[data-taco=\"icon\"]]:!w-5',\n // override styles to adjust badges included in menu links\n '[&>span_[data-taco=\"badge\"]]:mr-2.5 [[role=menu]>li>&>span_[data-taco=\"badge\"]]:mr-2',\n {\n 'hover:bg-black
|
|
1
|
+
{"version":3,"file":"Link.js","sources":["../../../../src/components/Navigation2/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { useDropTarget } from '../../../utils/hooks/useDropTarget';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Badge } from '../../Badge/Badge';\nimport { MenuProps } from '../../Menu/Menu';\nimport { getAdjacentClasses } from './util';\n\nexport const getNavigationLinkClasses = (isDraggedOver = false) =>\n cn(\n 'group relative flex w-full items-center rounded leading-8 !text-black px-2 focus-visible:yt-focus-dark',\n // override styles for links that are children of collapsible menus\n 'font-bold [[role=menu]>li>&]:font-normal [[role=menu]>li>&]:pl-5',\n // override styles to adjust icons included in menu links\n '[&_[data-taco=\"icon\"]]:!h-5 [&_[data-taco=\"icon\"]]:!w-5',\n // override styles to adjust badges included in menu links\n '[&>span_[data-taco=\"badge\"]]:mr-2.5 [[role=menu]>li>&>span_[data-taco=\"badge\"]]:mr-2',\n {\n 'hover:bg-black-subtle aria-current-page:bg-blue-500/[.1]': !isDraggedOver,\n '!bg-blue-500 !text-white [&>*]:!text-white': isDraggedOver,\n }\n );\n\nexport type Navigation2LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n active?: boolean;\n icon?: IconName;\n /** Menu component associated with the button. */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n /** Handler to be used when dropping a dragged element over the Navigation2 link */\n onDrop?: React.DragEventHandler;\n /** Total shown inside a Badge component */\n total?: number;\n};\n\nexport const Link = React.forwardRef<HTMLAnchorElement, Navigation2LinkProps>(function Link(props, ref) {\n const { active, children, icon, menu, onDrop, total, ...attributes } = props;\n const [isDraggedOver, dropTargetProps] = useDropTarget(onDrop);\n\n const className = cn(getNavigationLinkClasses(isDraggedOver), attributes.className);\n\n const listClassName = cn('[[role=menubar]>&]:px-3 border-gray-200', getAdjacentClasses(), {\n '[&>*]:pointer-events-none': isDraggedOver,\n });\n\n return (\n <li {...dropTargetProps} className={listClassName} data-taco=\"navigation2-link-item\" role=\"none\">\n <a\n {...attributes}\n aria-current={active ? 'page' : undefined}\n className={className}\n data-taco=\"navigation2-link\"\n ref={ref}\n role=\"menuitem\"\n tabIndex={0}>\n {icon ? <Icon className=\"mr-1.5 [[role=menu]>li>a>&]:-ml-1.5 [[role=menu]>li>a>&]:mr-0.5\" name={icon} /> : null}\n <span className=\"flex flex-grow items-center truncate\">{children}</span>\n {menu ? (\n <IconButton\n appearance=\"discrete\"\n icon=\"more\"\n aria-label=\"More\"\n rounded\n className={cn(\n '-mr-1.5 hidden flex-shrink-0 flex-grow-0 transition-none group-hover:flex aria-expanded:flex',\n {\n 'absolute right-0 !mr-0.5': total !== undefined,\n }\n )}\n menu={menu}\n onClick={event => {\n event.preventDefault();\n event.stopPropagation();\n }}\n />\n ) : null}\n {total === undefined ? null : (\n <Badge\n className={cn('flex-shrink-0 flex-grow-0 !font-normal', {\n 'group-hover:hidden [[aria-expanded=\"true\"]+&]:hidden ': menu,\n })}\n color=\"transparent\">\n {total}\n </Badge>\n )}\n </a>\n </li>\n );\n});\n"],"names":["React","Link"],"mappings":";;;;;;;AASa,MAAA,2BAA2B,CAAC,gBAAgB,UACrD;AAAA,EACI;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,IACI,4DAA4D,CAAC;AAAA,IAC7D,8CAA8C;AAAA,EAAA;AAEtD;A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AAAA,IAAA;AAAA,EACL,CAGZ;AAER,CAAC;"}
|
|
@@ -6,7 +6,7 @@ const util = require("./util.cjs");
|
|
|
6
6
|
const Section = React.forwardRef(function Navigation2(props, ref) {
|
|
7
7
|
const { children, heading, ...attributes } = props;
|
|
8
8
|
const className = cn(
|
|
9
|
-
"w-full overflow-auto px-3 py-2 flex-grow border-gray-200
|
|
9
|
+
"w-full overflow-auto px-3 py-2 flex-grow border-gray-200 [[role=menubar]>&:first-child]:pt-0",
|
|
10
10
|
util.getAdjacentClasses(),
|
|
11
11
|
props.className
|
|
12
12
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Section.cjs","sources":["../../../../src/components/Navigation2/components/Section.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getAdjacentClasses } from './util';\n\nexport type Navigation2SectionProps = React.LiHTMLAttributes<HTMLLIElement> & {\n heading?: string;\n};\n\nexport const Section = React.forwardRef<HTMLLIElement, Navigation2SectionProps>(function Navigation2(props, ref) {\n const { children, heading, ...attributes } = props;\n const className = cn(\n 'w-full overflow-auto px-3 py-2 flex-grow border-gray-200
|
|
1
|
+
{"version":3,"file":"Section.cjs","sources":["../../../../src/components/Navigation2/components/Section.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getAdjacentClasses } from './util';\n\nexport type Navigation2SectionProps = React.LiHTMLAttributes<HTMLLIElement> & {\n heading?: string;\n};\n\nexport const Section = React.forwardRef<HTMLLIElement, Navigation2SectionProps>(function Navigation2(props, ref) {\n const { children, heading, ...attributes } = props;\n const className = cn(\n 'w-full overflow-auto px-3 py-2 flex-grow border-gray-200 [[role=menubar]>&:first-child]:pt-0',\n getAdjacentClasses(),\n props.className\n );\n\n return (\n <li {...attributes} className={className} data-taco=\"navigation2-section\" ref={ref} role=\"none\">\n {heading ? (\n <span className=\"mb-px truncate pl-5 text-xs font-bold uppercase leading-8 text-gray-500 lg:hidden\">\n {heading}\n </span>\n ) : null}\n <ul className=\"mb-0 flex flex-col gap-y-px\">{children}</ul>\n </li>\n );\n});\n"],"names":["getAdjacentClasses"],"mappings":";;;;;AAQO,MAAM,UAAU,MAAM,WAAmD,SAAS,YAAY,OAAO,KAAK;AAC7G,QAAM,EAAE,UAAU,SAAS,GAAG,WAAe,IAAA;AAC7C,QAAM,YAAY;AAAA,IACd;AAAA,IACAA,wBAAmB;AAAA,IACnB,MAAM;AAAA,EACV;AAGI,SAAA,sBAAA,cAAC,QAAI,GAAG,YAAY,WAAsB,aAAU,uBAAsB,KAAU,MAAK,OACpF,GAAA,8CACI,QAAK,EAAA,WAAU,oFACX,GAAA,OACL,IACA,0CACH,MAAG,EAAA,WAAU,8BAA+B,GAAA,QAAS,CAC1D;AAER,CAAC;;"}
|
|
@@ -4,7 +4,7 @@ import { getAdjacentClasses } from "./util.js";
|
|
|
4
4
|
const Section = React__default.forwardRef(function Navigation2(props, ref) {
|
|
5
5
|
const { children, heading, ...attributes } = props;
|
|
6
6
|
const className = cn(
|
|
7
|
-
"w-full overflow-auto px-3 py-2 flex-grow border-gray-200
|
|
7
|
+
"w-full overflow-auto px-3 py-2 flex-grow border-gray-200 [[role=menubar]>&:first-child]:pt-0",
|
|
8
8
|
getAdjacentClasses(),
|
|
9
9
|
props.className
|
|
10
10
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Section.js","sources":["../../../../src/components/Navigation2/components/Section.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getAdjacentClasses } from './util';\n\nexport type Navigation2SectionProps = React.LiHTMLAttributes<HTMLLIElement> & {\n heading?: string;\n};\n\nexport const Section = React.forwardRef<HTMLLIElement, Navigation2SectionProps>(function Navigation2(props, ref) {\n const { children, heading, ...attributes } = props;\n const className = cn(\n 'w-full overflow-auto px-3 py-2 flex-grow border-gray-200
|
|
1
|
+
{"version":3,"file":"Section.js","sources":["../../../../src/components/Navigation2/components/Section.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { getAdjacentClasses } from './util';\n\nexport type Navigation2SectionProps = React.LiHTMLAttributes<HTMLLIElement> & {\n heading?: string;\n};\n\nexport const Section = React.forwardRef<HTMLLIElement, Navigation2SectionProps>(function Navigation2(props, ref) {\n const { children, heading, ...attributes } = props;\n const className = cn(\n 'w-full overflow-auto px-3 py-2 flex-grow border-gray-200 [[role=menubar]>&:first-child]:pt-0',\n getAdjacentClasses(),\n props.className\n );\n\n return (\n <li {...attributes} className={className} data-taco=\"navigation2-section\" ref={ref} role=\"none\">\n {heading ? (\n <span className=\"mb-px truncate pl-5 text-xs font-bold uppercase leading-8 text-gray-500 lg:hidden\">\n {heading}\n </span>\n ) : null}\n <ul className=\"mb-0 flex flex-col gap-y-px\">{children}</ul>\n </li>\n );\n});\n"],"names":["React"],"mappings":";;;AAQO,MAAM,UAAUA,eAAM,WAAmD,SAAS,YAAY,OAAO,KAAK;AAC7G,QAAM,EAAE,UAAU,SAAS,GAAG,WAAe,IAAA;AAC7C,QAAM,YAAY;AAAA,IACd;AAAA,IACA,mBAAmB;AAAA,IACnB,MAAM;AAAA,EACV;AAGI,SAAAA,+BAAA,cAAC,QAAI,GAAG,YAAY,WAAsB,aAAU,uBAAsB,KAAU,MAAK,OACpF,GAAA,uDACI,QAAK,EAAA,WAAU,oFACX,GAAA,OACL,IACA,mDACH,MAAG,EAAA,WAAU,8BAA+B,GAAA,QAAS,CAC1D;AAER,CAAC;"}
|
|
@@ -89,7 +89,7 @@ const SearchInput2 = React.forwardRef(function SearchInput22(props, ref) {
|
|
|
89
89
|
IconButton.IconButton,
|
|
90
90
|
{
|
|
91
91
|
"aria-label": texts.searchInput.clear,
|
|
92
|
-
className: "scale-75 !bg-transparent
|
|
92
|
+
className: "hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125",
|
|
93
93
|
icon: "close",
|
|
94
94
|
onMouseDown: handleClear,
|
|
95
95
|
tabIndex: -1,
|
|
@@ -98,11 +98,11 @@ const SearchInput2 = React.forwardRef(function SearchInput22(props, ref) {
|
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
if (hasFind && isActive) {
|
|
101
|
-
postfix = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "flex h-4 items-center text-gray-700" }, loading ? /* @__PURE__ */ React.createElement(Spinner.Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React.createElement("span", { className: "border-
|
|
101
|
+
postfix = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "flex h-4 items-center text-gray-700" }, loading ? /* @__PURE__ */ React.createElement(Spinner.Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React.createElement("span", { className: "border-black-subtle border-r pr-2", "data-taco": "search-matches-counter" }, `${findCurrent ?? 0}/${findTotal ?? 0}`) : null), findCurrent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
102
102
|
IconButton.IconButton,
|
|
103
103
|
{
|
|
104
104
|
"aria-label": texts.searchInput.findPrevious,
|
|
105
|
-
className: "scale-75 !bg-transparent
|
|
105
|
+
className: "hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125",
|
|
106
106
|
icon: "chevron-up",
|
|
107
107
|
onMouseDown: handleClickFindPrevious,
|
|
108
108
|
tabIndex: -1,
|
|
@@ -112,7 +112,7 @@ const SearchInput2 = React.forwardRef(function SearchInput22(props, ref) {
|
|
|
112
112
|
IconButton.IconButton,
|
|
113
113
|
{
|
|
114
114
|
"aria-label": texts.searchInput.findNext,
|
|
115
|
-
className: "scale-75 !bg-transparent
|
|
115
|
+
className: "hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125",
|
|
116
116
|
icon: "chevron-down",
|
|
117
117
|
onMouseDown: handleClickFindNext,
|
|
118
118
|
tabIndex: -1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput2.cjs","sources":["../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n onClear?: () => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n showTotal?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n showTotal?: boolean;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClear,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n showTotal = true,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind =\n handleClickFindNext !== undefined &&\n handleClickFindPrevious !== undefined &&\n findCurrent !== undefined &&\n findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n onClear?.();\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n event.stopPropagation();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"flex h-4 items-center text-gray-700\">\n {loading ? (\n <Spinner className=\"h-4 w-4\" />\n ) : showTotal ? (\n <span className=\"border-r border-black/[0.25] pr-2\" data-taco=\"search-matches-counter\">{`${\n findCurrent ?? 0\n }/${findTotal ?? 0}`}</span>\n ) : null}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-gray-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component\n onBlur={handleBlur}\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","useMergedRef","useLocalization","useGlobalKeyDown","IconButton","Shortcut","Spinner","Icon","Input"],"mappings":";;;;;;;;;;;;AAwCO,MAAM,eAAe,MAAM,WAAW,SAASA,cAAa,OAA0B,KAAkC;AACrH,QAAA;AAAA,IACF;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,UAAU;AAAA,IACV;AAAA,IACA,iBAAiB;AAAA,IACjB,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EAAA,IACH;AACE,QAAA,cAAcC,0BAA+B,GAAG;AAChD,QAAA,eAAe,MAAM,OAAuB,IAAI;AACtD,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,KAAK;AAC5C,QAAA,EAAE,MAAM,IAAIC,6BAAgB;AAClC,QAAM,WAAW,+BAAO;AACxB,QAAM,UACF,wBAAwB,UACxB,4BAA4B,UAC5B,gBAAgB,UAChB,cAAc;AAEDC,oCAAA,UAAU,CAAC,UAAyB;;AAC7C,QAAA,SAAS,kBAAkB,YAAY,SAAS;AAChD,YAAM,eAAe;AACrB,wBAAY,YAAZ,mBAAqB;AAAA,IAAM;AAAA,EAC/B,CACH;AAEK,QAAA,aAAa,CAAC,UAA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ent":["import React from 'react';\nimport cn from 'clsx';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n onClear?: () => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n showTotal?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n showTotal?: boolean;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClear,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n showTotal = true,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind =\n handleClickFindNext !== undefined &&\n handleClickFindPrevious !== undefined &&\n findCurrent !== undefined &&\n findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n onClear?.();\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n event.stopPropagation();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"flex h-4 items-center text-gray-700\">\n {loading ? (\n <Spinner className=\"h-4 w-4\" />\n ) : showTotal ? (\n <span className=\"border-black-subtle border-r pr-2\" data-taco=\"search-matches-counter\">{`${\n findCurrent ?? 0\n }/${findTotal ?? 0}`}</span>\n ) : null}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-gray-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component\n onBlur={handleBlur}\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","useMergedRef","useLocalization","useGlobalKeyDown","IconButton","Shortcut","Spinner","Icon","Input"],"mappings":";;;;;;;;;;;;AAwCO,MAAM,eAAe,MAAM,WAAW,SAASA,cAAa,OAA0B,KAAkC;AACrH,QAAA;AAAA,IACF;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,UAAU;AAAA,IACV;AAAA,IACA,iBAAiB;AAAA,IACjB,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EAAA,IACH;AACE,QAAA,cAAcC,0BAA+B,GAAG;AAChD,QAAA,eAAe,MAAM,OAAuB,IAAI;AACtD,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,KAAK;AAC5C,QAAA,EAAE,MAAM,IAAIC,6BAAgB;AAClC,QAAM,WAAW,+BAAO;AACxB,QAAM,UACF,wBAAwB,UACxB,4BAA4B,UAC5B,gBAAgB,UAChB,cAAc;AAEDC,oCAAA,UAAU,CAAC,UAAyB;;AAC7C,QAAA,SAAS,kBAAkB,YAAY,SAAS;AAChD,YAAM,eAAe;AACrB,wBAAY,YAAZ,mBAAqB;AAAA,IAAM;AAAA,EAC/B,CACH;AAEK,QAAA,aAAa,CAAC,UAA8C;;AAE1D,QAAA,aAAa,YACZ,aAAa,YAAY,MAAM,mBA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IACA,MAAM;AAAA,EACV;AAEA,QAAM,OACF,sBAAA;AAAA,IAACE,KAAA;AAAA,IAAA;AAAA,MACG,cAAY,MAAM,YAAY;AAAA,MAC9B,WAAU;AAAA,MACV,MAAK;AAAA,MACL,gBAAgB,MAAA;;AAAM,iCAAY,YAAZ,mBAAqB;AAAA;AAAA,IAAM;AAAA,EACrD;AAGJ,QAAM,QACF,sBAAA;AAAA,IAACC,MAAA;AAAA,IAAA;AAAA,MACI,GAAG;AAAA,MACJ,cAAY,WAAW,YAAY,KAAK,MAAM,YAAY;AAAA,MAC1D;AAAA,MACA,aAAU;AAAA,MACV,QAAQ;AAAA,MACR,UAAU,CAAA,UAAS,aAAa,MAAM,OAAO,KAAK;AAAA,MAClD,SAAS;AAAA,MACT,WAAW;AAAA,MACX,aAAa,WAAW,eAAe,MAAM,YAAY;AAAA,MACzD,QAAQ;AAAA,MACR;AAAA,MACA,KAAK;AAAA,MACL,OAAO,SAAS;AAAA,IAAA;AAAA,EACpB;AAGJ,MAAI,iBAAiB;AACjB,UAAM,oBAAoB;AAAA,MACtB;AAAA,IACJ;AAGI,WAAA,sBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAW,GAAG,kBAAkB,EAAE,6CAA6C,SAAS;AAAA,QACxF,KAAK;AAAA,QAGL,OAAO,EAAE,SAAS,MAAM;AAAA,MAAA;AAAA,MACvB;AAAA,MACD,sBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UAEG,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,gBAAgB,MAAM;;AAAA,qCAAY,YAAZ,mBAAqB;AAAA;AAAA,UAE3C,UAAU;AAAA,QAAA;AAAA,QACT;AAAA,MAAA;AAAA,IAET;AAAA,EAAA;AAID,SAAA;AACX,CAAC;;"}
|
|
@@ -87,7 +87,7 @@ const SearchInput2 = React__default.forwardRef(function SearchInput22(props, ref
|
|
|
87
87
|
IconButton,
|
|
88
88
|
{
|
|
89
89
|
"aria-label": texts.searchInput.clear,
|
|
90
|
-
className: "scale-75 !bg-transparent
|
|
90
|
+
className: "hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125",
|
|
91
91
|
icon: "close",
|
|
92
92
|
onMouseDown: handleClear,
|
|
93
93
|
tabIndex: -1,
|
|
@@ -96,11 +96,11 @@ const SearchInput2 = React__default.forwardRef(function SearchInput22(props, ref
|
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
if (hasFind && isActive) {
|
|
99
|
-
postfix = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", { className: "flex h-4 items-center text-gray-700" }, loading ? /* @__PURE__ */ React__default.createElement(Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React__default.createElement("span", { className: "border-
|
|
99
|
+
postfix = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", { className: "flex h-4 items-center text-gray-700" }, loading ? /* @__PURE__ */ React__default.createElement(Spinner, { className: "h-4 w-4" }) : showTotal ? /* @__PURE__ */ React__default.createElement("span", { className: "border-black-subtle border-r pr-2", "data-taco": "search-matches-counter" }, `${findCurrent ?? 0}/${findTotal ?? 0}`) : null), findCurrent ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
100
100
|
IconButton,
|
|
101
101
|
{
|
|
102
102
|
"aria-label": texts.searchInput.findPrevious,
|
|
103
|
-
className: "scale-75 !bg-transparent
|
|
103
|
+
className: "hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125",
|
|
104
104
|
icon: "chevron-up",
|
|
105
105
|
onMouseDown: handleClickFindPrevious,
|
|
106
106
|
tabIndex: -1,
|
|
@@ -110,7 +110,7 @@ const SearchInput2 = React__default.forwardRef(function SearchInput22(props, ref
|
|
|
110
110
|
IconButton,
|
|
111
111
|
{
|
|
112
112
|
"aria-label": texts.searchInput.findNext,
|
|
113
|
-
className: "scale-75 !bg-transparent
|
|
113
|
+
className: "hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125",
|
|
114
114
|
icon: "chevron-down",
|
|
115
115
|
onMouseDown: handleClickFindNext,
|
|
116
116
|
tabIndex: -1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput2.js","sources":["../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n onClear?: () => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n showTotal?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n showTotal?: boolean;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClear,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n showTotal = true,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind =\n handleClickFindNext !== undefined &&\n handleClickFindPrevious !== undefined &&\n findCurrent !== undefined &&\n findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n onClear?.();\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n event.stopPropagation();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"flex h-4 items-center text-gray-700\">\n {loading ? (\n <Spinner className=\"h-4 w-4\" />\n ) : showTotal ? (\n <span className=\"border-r border-black/[0.25] pr-2\" data-taco=\"search-matches-counter\">{`${\n findCurrent ?? 0\n }/${findTotal ?? 0}`}</span>\n ) : null}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-gray-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component\n onBlur={handleBlur}\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["React","SearchInput2"],"mappings":";;;;;;;;;;AAwCO,MAAM,eAAeA,eAAM,WAAW,SAASC,cAAa,OAA0B,KAAkC;AACrH,QAAA;AAAA,IACF;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,UAAU;AAAA,IACV;AAAA,IACA,iBAAiB;AAAA,IACjB,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EAAA,IACH;AACE,QAAA,cAAc,aAA+B,GAAG;AAChD,QAAA,eAAeD,eAAM,OAAuB,IAAI;AACtD,QAAM,CAAC,SAAS,UAAU,IAAIA,eAAM,SAAS,KAAK;AAC5C,QAAA,EAAE,MAAM,IAAI,gBAAgB;AAClC,QAAM,WAAW,+BAAO;AACxB,QAAM,UACF,wBAAwB,UACxB,4BAA4B,UAC5B,gBAAgB,UAChB,cAAc;AAED,mBAAA,UAAU,CAAC,UAAyB;;AAC7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,SAAA;AACX,CAAC;"}
|
|
1
|
+
{"version":3,"file":"SearchInput2.js","sources":["../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n onClear?: () => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n showTotal?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n showTotal?: boolean;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClear,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n showTotal = true,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind =\n handleClickFindNext !== undefined &&\n handleClickFindPrevious !== undefined &&\n findCurrent !== undefined &&\n findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n onClear?.();\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n event.stopPropagation();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"flex h-4 items-center text-gray-700\">\n {loading ? (\n <Spinner className=\"h-4 w-4\" />\n ) : showTotal ? (\n <span className=\"border-black-subtle border-r pr-2\" data-taco=\"search-matches-counter\">{`${\n findCurrent ?? 0\n }/${findTotal ?? 0}`}</span>\n ) : null}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"hover:!bg-black-subtle scale-75 !bg-transparent [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-gray-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component\n onBlur={handleBlur}\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["React","SearchInput2"],"mappings":";;;;;;;;;;AAwCO,MAAM,eAAeA,eAAM,WAAW,SAASC,cAAa,OAA0B,KAAkC;AACrH,QAAA;AAAA,IACF;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,UAAU;AAAA,IACV;AAAA,IACA,iBAAiB;AAAA,IACjB,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EAAA,IACH;AACE,QAAA,cAAc,aAA+B,GAAG;AAChD,QAAA,eAAeD,eAAM,OAAuB,IAAI;AACtD,QAAM,CAAC,SAAS,UAAU,IAAIA,eAAM,SAAS,KAAK;AAC5C,QAAA,EAAE,MAAM,IAAI,gBAAgB;AAClC,QAAM,WAAW,+BAAO;AACxB,QAAM,UACF,wBAAwB,UACxB,4BAA4B,UAC5B,gBAAgB,UAChB,cAAc;AAED,mBAAA,UAAU,CAAC,UAAyB;;AAC7C,QAAA,SAAS,kBAAkB,YAAY,SAAS;AAChD,YAAM,eAAe;AACrB,wBAAY,YAAZ,mBAAqB;AAAA,IAAM;AAAA,EAC/B,CACH;AAEK,QAAA,aAAa,CAAC,UAA8C;;AAE1D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