@economic/taco 1.25.3 → 1.26.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +5 -0
- package/dist/components/Header/Header.d.ts +1 -1
- package/dist/components/Header/components/Agreement/Avatar.d.ts +7 -0
- package/dist/components/Header/components/Agreement/Badge.d.ts +6 -0
- package/dist/components/Header/components/Agreement/Display.d.ts +9 -0
- package/dist/components/Header/components/Agreement/Item.d.ts +8 -0
- package/dist/components/Header/components/{Agreements/AgreementDetails.d.ts → Agreement/types.d.ts} +0 -7
- package/dist/components/Header/components/AgreementSelector.d.ts +8 -6
- package/dist/esm/packages/taco/src/components/ButtonGroup/ButtonGroup.js +46 -0
- package/dist/esm/packages/taco/src/components/ButtonGroup/ButtonGroup.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +2 -2
- package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js +28 -0
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Badge.js +23 -0
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Badge.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js +36 -0
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +39 -0
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +18 -17
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +4 -3
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useListbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/Menu.js +2 -2
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Link.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +1 -1
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js +48 -0
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -0
- package/dist/esm/packages/taco/src/index.js +7 -5
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/hooks/useIntersectionObserver.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/taco.cjs.development.js +2333 -2217
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +177 -115
- package/dist/esm/packages/taco/src/components/Header/components/Agreements/AgreementDetails.js +0 -73
- package/dist/esm/packages/taco/src/components/Header/components/Agreements/AgreementDetails.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PrimaryNavigation.js","sources":["../../../../../../../../src/components/Header/components/PrimaryNavigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Portal } from '@radix-ui/react-portal';\nimport { getLinkClasses } from './Link';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener';\nimport { Button } from '../../Button/Button';\nimport { Menu } from '../../Menu/Menu';\nimport { useLocalization } from '../../Provider/Localization';\n\ntype ChildrenWidthProps = {\n setWidth: React.Dispatch<React.SetStateAction<number[]>>;\n children: React.ReactNode;\n};\n\nconst getChildWidths = (parent: HTMLDivElement): number[] => {\n const widths: number[] = [];\n\n for (let index = 0; index < parent.children.length; index++) {\n const childRect = parent.children[index].getBoundingClientRect();\n widths.push(childRect.width);\n }\n\n return widths;\n};\n\nconst ChildrenWidth = ({ setWidth, children }: ChildrenWidthProps) => {\n const ref = React.useRef<HTMLDivElement>(null);\n const [show, setShow] = React.useState(true);\n\n React.useEffect(() => {\n // Calculate the width of children, and then hides the portal\n if (ref.current && show) {\n setWidth(getChildWidths(ref.current));\n setShow(false);\n }\n }, [show]);\n\n React.useEffect(() => {\n // If children changes, then we render the children to calculate their width\n if (!show) {\n setShow(true);\n }\n }, [children]);\n\n return show ? (\n <Portal className={cn('invisible absolute z-[-10] flex translate-x-[-1000px]')} ref={ref}>\n {children}\n </Portal>\n ) : null;\n};\n\nconst useBoundaryIndex = (wrapperWidth: number, buttonRef: React.RefObject<HTMLButtonElement>, childWidths: number[]) => {\n // Primary navigation has a gap of gap-1, so we need to take the gap value in account as well\n // left gap + right gap = 8px\n const GAP = 8;\n\n return React.useMemo(() => {\n if (childWidths.length && wrapperWidth && buttonRef.current) {\n const realWidth = wrapperWidth - buttonRef.current.getBoundingClientRect().width - GAP;\n let boundary: number | undefined;\n let total = 0;\n\n childWidths.every((width, index) => {\n const nextWidth = total + width + GAP;\n\n if (nextWidth > realWidth) {\n boundary = index;\n return false;\n }\n\n total = nextWidth;\n return true;\n });\n\n return boundary;\n }\n\n return undefined;\n }, [childWidths, wrapperWidth]);\n};\n\nexport type PrimaryNavigationProps = React.HTMLAttributes<HTMLElement>;\n\nexport const PrimaryNavigation = React.forwardRef<HTMLElement, PrimaryNavigationProps>(function PrimaryNavigation(props, ref) {\n const { texts } = useLocalization();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n const rect = useBoundingClientRectListener(internalRef);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const [childWidths, setChildWidths] = React.useState<number[]>([]);\n const boundaryIndex = useBoundaryIndex(rect?.width ?? 0, buttonRef, childWidths);\n\n const className = cn(\n 'flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative',\n props.className\n );\n\n const moreButtonClassName = cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]');\n\n const [visibleChildren, hiddenChildren] = React.useMemo(() => {\n const visibleChildren: JSX.Element[] = [];\n const hiddenChildren: JSX.Element[] = [];\n\n React.Children.forEach(props.children, (child, index) => {\n if (React.isValidElement(child) && !!child) {\n if (boundaryIndex && index >= boundaryIndex) {\n hiddenChildren.push(child);\n } else {\n visibleChildren.push(child);\n }\n }\n });\n\n return [visibleChildren, hiddenChildren];\n }, [boundaryIndex, props.children]);\n\n return (\n <nav {...props} className={className} ref={internalRef}>\n <ul className=\"mb-0 flex h-full w-full items-center gap-1 overflow-hidden px-1\">\n {visibleChildren}\n <li className={cn({ invisible: boundaryIndex === undefined })}>\n <Button\n className={moreButtonClassName}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content className=\"hidden lg:block\">\n {hiddenChildren.map((child, index) => {\n const href: string | undefined = child.props.to || child.props.href;\n const target = href?.startsWith('http') ? '_blank' : '_self';\n // Removing className prop so that custom styling cannot be applied on Menu.Link\n const { as, className: _, ...otherProps } = child.props;\n\n if (as) {\n return React.cloneElement(child, {\n as: Menu.Link,\n key: index,\n target,\n ...otherProps,\n });\n }\n\n return <Menu.Link key={index} target={target} {...otherProps} />;\n })}\n </Menu.Content>\n </Menu>\n )}\n ref={buttonRef}>\n {texts.header.more}\n </Button>\n </li>\n </ul>\n <ChildrenWidth setWidth={setChildWidths}>{props.children}</ChildrenWidth>\n </nav>\n );\n});\n"],"names":["getChildWidths","parent","widths","index","children","length","childRect","getBoundingClientRect","push","width","ChildrenWidth","setWidth","ref","React","useRef","show","setShow","useState","useEffect","current","Portal","className","cn","useBoundaryIndex","wrapperWidth","buttonRef","childWidths","GAP","useMemo","realWidth","boundary","total","every","nextWidth","undefined","PrimaryNavigation","forwardRef","props","texts","useLocalization","internalRef","useMergedRef","rect","useBoundingClientRectListener","setChildWidths","boundaryIndex","moreButtonClassName","getLinkClasses","visibleChildren","hiddenChildren","Children","forEach","child","isValidElement","invisible","Button","menu","menuProps","Menu","Content","map","href","to","target","startsWith","as","_","otherProps","cloneElement","Link","key","header","more"],"mappings":";;;;;;;;;;AAeA,MAAMA,cAAc,GAAIC,MAAsB;EAC1C,MAAMC,MAAM,GAAa,EAAE;EAE3B,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,MAAM,CAACG,QAAQ,CAACC,MAAM,EAAEF,KAAK,EAAE,EAAE;IACzD,MAAMG,SAAS,GAAGL,MAAM,CAACG,QAAQ,CAACD,KAAK,CAAC,CAACI,qBAAqB,EAAE;IAChEL,MAAM,CAACM,IAAI,CAACF,SAAS,CAACG,KAAK,CAAC;;EAGhC,OAAOP,MAAM;AACjB,CAAC;AAED,MAAMQ,aAAa,GAAG,CAAC;EAAEC,QAAQ;EAAEP;CAA8B;EAC7D,MAAMQ,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAiB,IAAI,CAAC;EAC9C,MAAM,CAACC,IAAI,EAAEC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ACDvD,GAAG,EAAEa;KACJa,KAAK,CAACiC,MAAM,CAACC,IAAI,CACb,CACR,CACJ,eACL3D,6BAACH,aAAa;IAACC,QAAQ,EAAEiC;KAAiBP,KAAK,CAACjC,QAAQ,CAAiB,CACvE;AAEd,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"PrimaryNavigation.js","sources":["../../../../../../../../src/components/Header/components/PrimaryNavigation.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Portal } from '@radix-ui/react-portal';\nimport { getLinkClasses } from './Link';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener';\nimport { Button } from '../../Button/Button';\nimport { Menu } from '../../Menu/Menu';\nimport { useLocalization } from '../../Provider/Localization';\n\ntype ChildrenWidthProps = {\n setWidth: React.Dispatch<React.SetStateAction<number[]>>;\n children: React.ReactNode;\n};\n\nconst getChildWidths = (parent: HTMLDivElement): number[] => {\n const widths: number[] = [];\n\n for (let index = 0; index < parent.children.length; index++) {\n const childRect = parent.children[index].firstElementChild?.getBoundingClientRect();\n widths.push(childRect?.width ?? 0);\n }\n\n return widths;\n};\n\nconst ChildrenWidth = ({ setWidth, children }: ChildrenWidthProps) => {\n const ref = React.useRef<HTMLDivElement>(null);\n const [show, setShow] = React.useState(true);\n\n React.useEffect(() => {\n // Calculate the width of children, and then hides the portal\n if (ref.current && show) {\n setWidth(getChildWidths(ref.current));\n setShow(false);\n }\n }, [show]);\n\n React.useEffect(() => {\n // If children changes, then we render the children to calculate their width\n if (!show) {\n setShow(true);\n }\n }, [children]);\n\n return show ? (\n <Portal className={cn('invisible absolute z-[-10] flex translate-x-[-1000px]')} ref={ref}>\n {children}\n </Portal>\n ) : null;\n};\n\nconst useBoundaryIndex = (wrapperWidth: number, buttonRef: React.RefObject<HTMLButtonElement>, childWidths: number[]) => {\n // Primary navigation has a gap of gap-1, so we need to take the gap value in account as well\n // left gap + right gap = 8px\n const GAP = 8;\n\n return React.useMemo(() => {\n if (childWidths.length && wrapperWidth && buttonRef.current) {\n const realWidth = wrapperWidth - buttonRef.current.getBoundingClientRect().width - GAP;\n let boundary: number | undefined;\n let total = 0;\n\n childWidths.every((width, index) => {\n const nextWidth = total + width + GAP;\n\n if (nextWidth > realWidth) {\n boundary = index;\n return false;\n }\n\n total = nextWidth;\n return true;\n });\n\n return boundary;\n }\n\n return undefined;\n }, [childWidths, wrapperWidth]);\n};\n\nexport type PrimaryNavigationProps = React.HTMLAttributes<HTMLElement>;\n\nexport const PrimaryNavigation = React.forwardRef<HTMLElement, PrimaryNavigationProps>(function PrimaryNavigation(props, ref) {\n const { texts } = useLocalization();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n const rect = useBoundingClientRectListener(internalRef);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const [childWidths, setChildWidths] = React.useState<number[]>([]);\n const boundaryIndex = useBoundaryIndex(rect?.width ?? 0, buttonRef, childWidths);\n\n const className = cn(\n 'flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative',\n props.className\n );\n\n const moreButtonClassName = cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]');\n\n const [visibleChildren, hiddenChildren] = React.useMemo(() => {\n const visibleChildren: JSX.Element[] = [];\n const hiddenChildren: JSX.Element[] = [];\n\n React.Children.forEach(props.children, (child, index) => {\n if (React.isValidElement(child) && !!child) {\n if (boundaryIndex && index >= boundaryIndex) {\n hiddenChildren.push(child);\n } else {\n visibleChildren.push(child);\n }\n }\n });\n\n return [visibleChildren, hiddenChildren];\n }, [boundaryIndex, props.children]);\n\n return (\n <nav {...props} className={className} ref={internalRef}>\n <ul className=\"mb-0 flex h-full w-full items-center gap-1 overflow-hidden px-1\">\n {visibleChildren}\n <li className={cn({ invisible: boundaryIndex === undefined })}>\n <Button\n className={moreButtonClassName}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content className=\"hidden lg:block\">\n {hiddenChildren.map((child, index) => {\n const href: string | undefined = child.props.to || child.props.href;\n const target = href?.startsWith('http') ? '_blank' : '_self';\n // Removing className prop so that custom styling cannot be applied on Menu.Link\n const { as, className: _, ...otherProps } = child.props;\n\n if (as) {\n return React.cloneElement(child, {\n as: Menu.Link,\n key: index,\n target,\n ...otherProps,\n });\n }\n\n return <Menu.Link key={index} target={target} {...otherProps} />;\n })}\n </Menu.Content>\n </Menu>\n )}\n ref={buttonRef}>\n {texts.header.more}\n </Button>\n </li>\n </ul>\n <ChildrenWidth setWidth={setChildWidths}>{props.children}</ChildrenWidth>\n </nav>\n );\n});\n"],"names":["getChildWidths","parent","widths","index","children","length","childRect","firstElementChild","getBoundingClientRect","push","width","ChildrenWidth","setWidth","ref","React","useRef","show","setShow","useState","useEffect","current","Portal","className","cn","useBoundaryIndex","wrapperWidth","buttonRef","childWidths","GAP","useMemo","realWidth","boundary","total","every","nextWidth","undefined","PrimaryNavigation","forwardRef","props","texts","useLocalization","internalRef","useMergedRef","rect","useBoundingClientRectListener","setChildWidths","boundaryIndex","moreButtonClassName","getLinkClasses","visibleChildren","hiddenChildren","Children","forEach","child","isValidElement","invisible","Button","menu","menuProps","Menu","Content","map","href","to","target","startsWith","as","_","otherProps","cloneElement","Link","key","header","more"],"mappings":";;;;;;;;;;AAeA,MAAMA,cAAc,GAAIC,MAAsB;EAC1C,MAAMC,MAAM,GAAa,EAAE;EAE3B,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,MAAM,CAACG,QAAQ,CAACC,MAAM,EAAEF,KAAK,EAAE,EAAE;IAAA;IACzD,MAAMG,SAAS,4BAAGL,MAAM,CAACG,QAAQ,CAACD,KAAK,CAAC,CAACI,iBAAiB,0DAAxC,sBAA0CC,qBAAqB,EAAE;IACnFN,MAAM,CAACO,IAAI,qBAACH,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEI,KAAK,+DAAI,CAAC,CAAC;;EAGtC,OAAOR,MAAM;AACjB,CAAC;AAED,MAAMS,aAAa,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AGN,oBAAOtD,6BAAC6C,IAAI,CAACW,IAAI;QAACC,GAAG,EAAEpE,KAAK;QAAE6D,MAAM,EAAEA;SAAYI,UAAU,EAAI;KACnE,CAAC,CACS,CAEtB;IACDvD,GAAG,EAAEa;KACJa,KAAK,CAACiC,MAAM,CAACC,IAAI,CACb,CACR,CACJ,eACL3D,6BAACH,aAAa;IAACC,QAAQ,EAAEiC;KAAiBP,KAAK,CAAClC,QAAQ,CAAiB,CACvE;AAEd,CAAC;;;;"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { forwardRef, createElement, useRef, memo, cloneElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { Icon } from '../Icon/Icon.js';
|
4
|
+
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
4
5
|
import { getButtonStateClasses, getInputClasses } from './util.js';
|
5
6
|
import { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener.js';
|
6
|
-
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
7
7
|
|
8
8
|
const validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];
|
9
9
|
const InputWithoutDeprecatedFeatures = /*#__PURE__*/forwardRef(function InputWithoutDeprecatedFeatures(props, ref) {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { forwardRef, useMemo, createRef, useEffect, createElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { useLocalization } from '../Provider/Localization.js';
|
4
|
+
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
4
5
|
import { Checkbox } from '../Checkbox/Checkbox.js';
|
5
6
|
import { getInputClasses } from '../Input/util.js';
|
6
|
-
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
7
7
|
import { getNextIndexFromKey } from '../../utils/hooks/useListKeyboardNavigation.js';
|
8
8
|
import { useListScrollTo } from '../../utils/hooks/useListScrollTo.js';
|
9
9
|
import { Spinner } from '../Spinner/Spinner.js';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useMemo, useEffect } from 'react';
|
2
|
-
import { v4 } from 'uuid';
|
3
2
|
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
3
|
+
import { v4 } from 'uuid';
|
4
4
|
import { useFlattenedData, getIndexFromValue, getActiveDescendant, setInputValueByRef, findByValue, sanitizeItem } from './util.js';
|
5
5
|
import { useTypeahead } from './useTypeahead.js';
|
6
6
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useMemo, useState, useEffect } from 'react';
|
2
2
|
import { useLocalization } from '../Provider/Localization.js';
|
3
|
-
import { v4 } from 'uuid';
|
4
3
|
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
4
|
+
import { v4 } from 'uuid';
|
5
5
|
import { getIndexFromValue, getSelectedIndexesFromValue, setInputValueByRef, getActiveDescendant, findByValue } from './util.js';
|
6
6
|
import { useTypeahead } from './useTypeahead.js';
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { forwardRef, useState, useMemo, createElement } from 'react';
|
2
|
-
import { MenuContext } from './Context.js';
|
3
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
4
2
|
import { Root } from '@radix-ui/react-dropdown-menu';
|
3
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
4
|
+
import { MenuContext } from './Context.js';
|
5
5
|
import { Content } from './components/Content.js';
|
6
6
|
import { Item } from './components/Item.js';
|
7
7
|
import { Link } from './components/Link.js';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
4
|
-
import { useCurrentMenu } from '../Context.js';
|
5
4
|
import { Portal, Content as Content$1 } from '@radix-ui/react-dropdown-menu';
|
5
|
+
import { useCurrentMenu } from '../Context.js';
|
6
6
|
|
7
7
|
const Content = /*#__PURE__*/forwardRef(function MenuContent(props, ref) {
|
8
8
|
const internalRef = useMergedRef(ref);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
|
-
import { useCurrentMenu } from '../Context.js';
|
4
3
|
import { Label } from '@radix-ui/react-dropdown-menu';
|
4
|
+
import { useCurrentMenu } from '../Context.js';
|
5
5
|
|
6
6
|
const Header = /*#__PURE__*/forwardRef(function MenuHeader(props, ref) {
|
7
7
|
const menu = useCurrentMenu();
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { forwardRef, createElement, useEffect } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { Icon as Icon$1 } from '../../Icon/Icon.js';
|
4
|
-
import { useCurrentMenu } from '../Context.js';
|
5
4
|
import { Item as Item$1 } from '@radix-ui/react-dropdown-menu';
|
5
|
+
import { useCurrentMenu } from '../Context.js';
|
6
6
|
|
7
7
|
const Icon = ({
|
8
8
|
name
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
|
-
import { useCurrentMenu } from '../Context.js';
|
3
2
|
import { Item } from '@radix-ui/react-dropdown-menu';
|
3
|
+
import { useCurrentMenu } from '../Context.js';
|
4
4
|
import { useItemStyling, Icon } from './Item.js';
|
5
5
|
|
6
6
|
const Link = /*#__PURE__*/forwardRef(function MenuLink(props, ref) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { forwardRef, useEffect, createElement } from 'react';
|
2
2
|
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
3
|
-
import { useCurrentMenu } from '../Context.js';
|
4
3
|
import { Trigger as Trigger$1 } from '@radix-ui/react-dropdown-menu';
|
4
|
+
import { useCurrentMenu } from '../Context.js';
|
5
5
|
|
6
6
|
const Trigger = /*#__PURE__*/forwardRef(function MenuTrigger(props, ref) {
|
7
7
|
const menu = useCurrentMenu();
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { useState, useMemo, useRef, useEffect, createElement, Fragment, cloneElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { useLocalization } from '../Provider/Localization.js';
|
4
|
-
import { v4 } from 'uuid';
|
5
4
|
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
5
|
+
import { v4 } from 'uuid';
|
6
6
|
import { createCustomEvent } from '../../utils/input.js';
|
7
7
|
import { useFlattenedData, findByValue, setInputValueByRef, sanitizeItem } from '../Listbox/util.js';
|
8
8
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { useLocalization } from '../Provider/Localization.js';
|
4
|
+
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
5
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
4
6
|
import { Root, Trigger, Portal, Content } from '@radix-ui/react-popover';
|
5
7
|
import { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener.js';
|
6
|
-
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
7
8
|
import { createCustomKeyboardEvent } from '../../utils/input.js';
|
8
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
9
9
|
import { isAriaDirectionKey } from '../../utils/aria.js';
|
10
10
|
import { Root as Root$1, createListboxValueSetter } from '../../primitives/Listbox2/components/Root.js';
|
11
11
|
import '../../primitives/Listbox2/components/Option.js';
|
@@ -4,11 +4,11 @@ import { AVAILABLE_COLORS, getSubtleColorShadeClasses } from '../../../utils/tai
|
|
4
4
|
import { Icon } from '../../Icon/Icon.js';
|
5
5
|
import { useLocalization } from '../../Provider/Localization.js';
|
6
6
|
import { Button } from '../../Button/Button.js';
|
7
|
+
import { Group } from '../../Group/Group.js';
|
8
|
+
import { Root, Item, Indicator } from '@radix-ui/react-radio-group';
|
7
9
|
import { Input } from '../../Input/Input.js';
|
8
10
|
import { Popover } from '../../Popover/Popover.js';
|
9
|
-
import { Group } from '../../Group/Group.js';
|
10
11
|
import { Field } from '../../Field/Field.js';
|
11
|
-
import { Root, Item, Indicator } from '@radix-ui/react-radio-group';
|
12
12
|
import { useSelect2Context } from './Context.js';
|
13
13
|
import { _catch } from '../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
|
14
14
|
|
@@ -3,8 +3,8 @@ import cn from 'classnames';
|
|
3
3
|
import { Icon } from '../../Icon/Icon.js';
|
4
4
|
import { Badge } from '../../Badge/Badge.js';
|
5
5
|
import { Tooltip } from '../../Tooltip/Tooltip.js';
|
6
|
-
import { getInputClasses } from '../../Input/util.js';
|
7
6
|
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
7
|
+
import { getInputClasses } from '../../Input/util.js';
|
8
8
|
import { ScrollArea } from '../../ScrollArea/ScrollArea.js';
|
9
9
|
import { Tag } from '../../Tag/Tag.js';
|
10
10
|
import { useSelect2Context } from './Context.js';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { useLocalization } from '../../Provider/Localization.js';
|
4
|
-
import { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener.js';
|
5
4
|
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
5
|
+
import { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener.js';
|
6
6
|
import { useTable } from '../hooks/useTable.js';
|
7
7
|
import { Row } from '../util/renderRow.js';
|
8
8
|
import { BaseTable, DefaultEmptyState } from './BaseTable.js';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import { getNextIndexFromKey } from '../../../utils/hooks/useListKeyboardNavigation.js';
|
3
2
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
3
|
+
import { getNextIndexFromKey } from '../../../utils/hooks/useListKeyboardNavigation.js';
|
4
4
|
import { sanitizeRowProps } from '../util.js';
|
5
5
|
|
6
6
|
const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
@@ -3,8 +3,8 @@ import cn from 'classnames';
|
|
3
3
|
import { Icon } from '../../../Icon/Icon.js';
|
4
4
|
import { useLocalization } from '../../../Provider/Localization.js';
|
5
5
|
import { Button } from '../../../Button/Button.js';
|
6
|
-
import { Popover } from '../../../Popover/Popover.js';
|
7
6
|
import { Group } from '../../../Group/Group.js';
|
7
|
+
import { Popover } from '../../../Popover/Popover.js';
|
8
8
|
import { useGlobalKeyboardShortcut } from '../../../../hooks/useGlobalKeyboardShortcut.js';
|
9
9
|
import { Shortcut } from '../../../Shortcut/Shortcut.js';
|
10
10
|
import { isInternalColumn } from '../../utilities/columns.js';
|
@@ -3,8 +3,8 @@ import cn from 'classnames';
|
|
3
3
|
import { Icon } from '../../Icon/Icon.js';
|
4
4
|
import { Tooltip } from '../../Tooltip/Tooltip.js';
|
5
5
|
import { IconButton } from '../../IconButton/IconButton.js';
|
6
|
-
import { Checkbox } from '../../Checkbox/Checkbox.js';
|
7
6
|
import { Menu } from '../../Menu/Menu.js';
|
7
|
+
import { Checkbox } from '../../Checkbox/Checkbox.js';
|
8
8
|
import { Shortcut } from '../../Shortcut/Shortcut.js';
|
9
9
|
import { useRowContext } from '../components/row/Context.js';
|
10
10
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
|
3
|
+
const useIntersectionObserver = (ref, offset) => {
|
4
|
+
const [intersectedIndexes, setIntersectedIndexes] = React__default.useState({});
|
5
|
+
const handleIntersection = (entries, observer) => {
|
6
|
+
if (observer.root) {
|
7
|
+
const children = Array.from(observer.root.children);
|
8
|
+
const map = {};
|
9
|
+
entries.forEach(entry => {
|
10
|
+
// entries only contains the items being intersected not all children of the ref
|
11
|
+
// so use root and the the entry being intersected to find its real index
|
12
|
+
// on first mount this is different - all children are present
|
13
|
+
map[children.indexOf(entry.target)] = entry.isIntersecting;
|
14
|
+
});
|
15
|
+
setIntersectedIndexes(prev => ({
|
16
|
+
...prev,
|
17
|
+
...map
|
18
|
+
}));
|
19
|
+
}
|
20
|
+
};
|
21
|
+
const intersectedChildIndex = React__default.useMemo(() => {
|
22
|
+
const index = Object.values(intersectedIndexes).indexOf(false);
|
23
|
+
return index > -1 ? index : undefined;
|
24
|
+
}, [intersectedIndexes]);
|
25
|
+
const hasRootMargin = intersectedChildIndex !== undefined && offset;
|
26
|
+
React__default.useEffect(() => {
|
27
|
+
const observer = new IntersectionObserver(handleIntersection, {
|
28
|
+
root: ref.current,
|
29
|
+
// offset the button, but only after the first item has been intersected
|
30
|
+
rootMargin: hasRootMargin ? `0px -${offset}px 0px 0px` : undefined,
|
31
|
+
threshold: 1
|
32
|
+
});
|
33
|
+
if (observer.root) {
|
34
|
+
Array.from(observer.root.children).forEach(item => {
|
35
|
+
if (item.getAttribute('data-intersection-observer') !== 'ignore') {
|
36
|
+
observer.observe(item);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
}
|
40
|
+
return () => {
|
41
|
+
observer.disconnect();
|
42
|
+
};
|
43
|
+
}, [hasRootMargin]);
|
44
|
+
return intersectedChildIndex;
|
45
|
+
};
|
46
|
+
|
47
|
+
export { useIntersectionObserver };
|
48
|
+
//# sourceMappingURL=useIntersectionObserver.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useIntersectionObserver.js","sources":["../../../../../../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["import React from 'react';\n\nexport const useIntersectionObserver = (ref: React.RefObject<HTMLElement>, offset?: number) => {\n const [intersectedIndexes, setIntersectedIndexes] = React.useState({});\n\n const handleIntersection = (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n if (observer.root) {\n const children = Array.from((observer.root as Element).children);\n const map = {};\n\n entries.forEach(entry => {\n // entries only contains the items being intersected not all children of the ref\n // so use root and the the entry being intersected to find its real index\n // on first mount this is different - all children are present\n map[children.indexOf(entry.target)] = entry.isIntersecting;\n });\n\n setIntersectedIndexes(prev => ({ ...prev, ...map }));\n }\n };\n\n const intersectedChildIndex = React.useMemo(() => {\n const index = Object.values(intersectedIndexes).indexOf(false);\n return index > -1 ? index : undefined;\n }, [intersectedIndexes]);\n\n const hasRootMargin = intersectedChildIndex !== undefined && offset;\n\n React.useEffect(() => {\n const observer = new IntersectionObserver(handleIntersection, {\n root: ref.current,\n // offset the button, but only after the first item has been intersected\n rootMargin: hasRootMargin ? `0px -${offset}px 0px 0px` : undefined,\n threshold: 1,\n });\n\n if (observer.root) {\n Array.from(observer.root.children).forEach(item => {\n if (item.getAttribute('data-intersection-observer') !== 'ignore') {\n observer.observe(item);\n }\n });\n }\n\n return () => {\n observer.disconnect();\n };\n }, [hasRootMargin]);\n\n return intersectedChildIndex;\n};\n"],"names":["useIntersectionObserver","ref","offset","intersectedIndexes","setIntersectedIndexes","React","useState","handleIntersection","entries","observer","root","children","Array","from","map","forEach","entry","indexOf","target","isIntersecting","prev","intersectedChildIndex","useMemo","index","Object","values","undefined","hasRootMargin","useEffect","IntersectionObserver","current","rootMargin","threshold","item","getAttribute","observe","disconnect"],"mappings":";;MAEaA,uBAAuB,GAAG,CAACC,GAAiC,EAAEC,MAAe;EACtF,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,EAAE,CAAC;EAEtE,MAAMC,kBAAkB,GAAG,CAACC,OAAoC,EAAEC,QAA8B;IAC5F,IAAIA,QAAQ,CAACC,IAAI,EAAE;MACf,MAAMC,QAAQ,GAAGC,KAAK,CAACC,IAAI,CAAEJ,QAAQ,CAACC,IAAgB,CAACC,QAAQ,CAAC;MAChE,MAAMG,GAAG,GAAG,EAAE;MAEdN,OAAO,CAACO,OAAO,CAACC,KAAK;;;;QAIjBF,GAAG,CAACH,QAAQ,CAACM,OAAO,CAACD,KAAK,CAACE,MAAM,CAAC,CAAC,GAAGF,KAAK,CAACG,cAAc;OAC7D,CAAC;MAEFf,qBAAqB,CAACgB,IAAI,KAAK;QAAE,GAAGA,IAAI;QAAE,GAAGN;OAAK,CAAC,CAAC;;GAE3D;EAED,MAAMO,qBAAqB,GAAGhB,cAAK,CAACiB,OAAO,CAAC;IACxC,MAAMC,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACtB,kBAAkB,CAAC,CAACc,OAAO,CAAC,KAAK,CAAC;IAC9D,OAAOM,KAAK,GAAG,CAAC,CAAC,GAAGA,KAAK,GAAGG,SAAS;GACxC,EAAE,CAACvB,kBAAkB,CAAC,CAAC;EAExB,MAAMwB,aAAa,GAAGN,qBAAqB,KAAKK,SAAS,IAAIxB,MAAM;EAEnEG,cAAK,CAACuB,SAAS,CAAC;IACZ,MAAMnB,QAAQ,GAAG,IAAIoB,oBAAoB,CAACtB,kBAAkB,EAAE;MAC1DG,IAAI,EAAET,GAAG,CAAC6B,OAAO;;MAEjBC,UAAU,EAAEJ,aAAa,WAAWzB,kBAAkB,GAAGwB,SAAS;MAClEM,SAAS,EAAE;KACd,CAAC;IAEF,IAAIvB,QAAQ,CAACC,IAAI,EAAE;MACfE,KAAK,CAACC,IAAI,CAACJ,QAAQ,CAACC,IAAI,CAACC,QAAQ,CAAC,CAACI,OAAO,CAACkB,IAAI;QAC3C,IAAIA,IAAI,CAACC,YAAY,CAAC,4BAA4B,CAAC,KAAK,QAAQ,EAAE;UAC9DzB,QAAQ,CAAC0B,OAAO,CAACF,IAAI,CAAC;;OAE7B,CAAC;;IAGN,OAAO;MACHxB,QAAQ,CAAC2B,UAAU,EAAE;KACxB;GACJ,EAAE,CAACT,aAAa,CAAC,CAAC;EAEnB,OAAON,qBAAqB;AAChC;;;;"}
|
@@ -13,11 +13,16 @@ export { Base, IconButton } from './components/IconButton/IconButton.js';
|
|
13
13
|
export { LocalizationContext, LocalizationProvider, defaultLocalisationTexts, useLocalization } from './components/Provider/Localization.js';
|
14
14
|
export { Banner } from './components/Banner/Banner.js';
|
15
15
|
export { Button } from './components/Button/Button.js';
|
16
|
+
export { useMergedRef } from './hooks/useMergedRef.js';
|
17
|
+
export { Group } from './components/Group/Group.js';
|
18
|
+
export { RadioGroup, findByValue, getRadioGroupItemValueAsString, useRadioGroup } from './components/RadioGroup/RadioGroup.js';
|
19
|
+
export { Menu } from './components/Menu/Menu.js';
|
20
|
+
export { useIntersectionObserver } from './hooks/useIntersectionObserver.js';
|
21
|
+
export { ButtonGroup } from './components/ButtonGroup/ButtonGroup.js';
|
16
22
|
export { Calendar } from './components/Calendar/Calendar.js';
|
17
23
|
export { Card } from './components/Card/Card.js';
|
18
24
|
export { Checkbox } from './components/Checkbox/Checkbox.js';
|
19
25
|
export { useBoundingClientRectListener } from './hooks/useBoundingClientRectListener.js';
|
20
|
-
export { useMergedRef } from './hooks/useMergedRef.js';
|
21
26
|
export { Input } from './components/Input/Input.js';
|
22
27
|
export { getNextIndexFromKey, useListKeyboardNavigation } from './utils/hooks/useListKeyboardNavigation.js';
|
23
28
|
export { useListScrollTo } from './utils/hooks/useListScrollTo.js';
|
@@ -27,7 +32,6 @@ export { format, isWeakEqual, parseFromCustomString, parseFromISOString } from '
|
|
27
32
|
export { Popover } from './components/Popover/Popover.js';
|
28
33
|
export { Datepicker } from './components/Datepicker/Datepicker.js';
|
29
34
|
export { Dialog } from './components/Dialog/Dialog.js';
|
30
|
-
export { Group } from './components/Group/Group.js';
|
31
35
|
export { Drawer } from './components/Drawer/Drawer.js';
|
32
36
|
export { Field } from './components/Field/Field.js';
|
33
37
|
export { Form } from './components/Form/Form.js';
|
@@ -35,8 +39,6 @@ export { Hanger, Title } from './components/Hanger/Hanger.js';
|
|
35
39
|
export { HoverCard } from './components/HoverCard/HoverCard.js';
|
36
40
|
export { SearchInput } from './components/SearchInput/SearchInput.js';
|
37
41
|
export { Listbox, MultiListbox } from './components/Listbox/Listbox.js';
|
38
|
-
export { RadioGroup, findByValue, getRadioGroupItemValueAsString, useRadioGroup } from './components/RadioGroup/RadioGroup.js';
|
39
|
-
export { Menu } from './components/Menu/Menu.js';
|
40
42
|
export { Treeview } from './components/Treeview/Treeview.js';
|
41
43
|
export { useDropTarget } from './utils/hooks/useDropTarget.js';
|
42
44
|
export { Navigation } from './components/Navigation/Navigation.js';
|
@@ -62,8 +64,8 @@ export { Table2 } from './components/Table2/Table2.js';
|
|
62
64
|
export { Tabs } from './components/Tabs/Tabs.js';
|
63
65
|
export { Textarea } from './components/Textarea/Textarea.js';
|
64
66
|
export { Tour, TourStep } from './components/Tour/Tour.js';
|
65
|
-
export { Header } from './components/Header/Header.js';
|
66
67
|
export { useMatchMedia } from './hooks/useMatchMedia.js';
|
68
|
+
export { Header } from './components/Header/Header.js';
|
67
69
|
export { useIsLargeScreen } from './hooks/useIsLargeScreen.js';
|
68
70
|
export { Layout } from './components/Layout/Layout.js';
|
69
71
|
export { getNavigationLinkClasses } from './components/Navigation2/components/Link.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
@@ -7,6 +7,7 @@ export * from './components/Badge/Badge';
|
|
7
7
|
export * from './components/BadgeIcon/BadgeIcon';
|
8
8
|
export * from './components/Banner/Banner';
|
9
9
|
export * from './components/Button/Button';
|
10
|
+
export * from './components/ButtonGroup/ButtonGroup';
|
10
11
|
export * from './components/Calendar/Calendar';
|
11
12
|
export * from './components/Card/Card';
|
12
13
|
export * from './components/Checkbox/Checkbox';
|
@@ -55,6 +56,7 @@ export * from './utils/date';
|
|
55
56
|
export * from './utils/mergeRefs';
|
56
57
|
export * from './hooks/useBoundaryOverflowDetection';
|
57
58
|
export * from './hooks/useBoundingClientRectListener';
|
59
|
+
export * from './hooks/useIntersectionObserver';
|
58
60
|
export * from './hooks/useIsLargeScreen';
|
59
61
|
export * from './hooks/useMatchMedia';
|
60
62
|
export * from './hooks/useMergedRef';
|