@economic/taco 2.45.0-alpha.19 → 2.45.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/components/Combobox/Combobox.d.ts +1 -1
  2. package/dist/components/Hanger/Hanger.d.ts +1 -0
  3. package/dist/components/Select/Select.d.ts +5 -19
  4. package/dist/esm/index.css +27 -6
  5. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js +1 -1
  6. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
  7. package/dist/esm/packages/taco/src/components/Card/Card.js +2 -2
  8. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  9. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +3 -2
  10. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +5 -9
  13. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +9 -1
  15. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +4 -2
  17. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +4 -2
  19. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Select/Select.js +0 -9
  21. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +0 -1
  23. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +1 -1
  25. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +2 -2
  27. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  28. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js +1 -1
  29. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
  30. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js +2 -1
  31. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js.map +1 -1
  32. package/dist/index.css +27 -6
  33. package/dist/taco.cjs.development.js +30 -30
  34. package/dist/taco.cjs.development.js.map +1 -1
  35. package/dist/taco.cjs.production.min.js +1 -1
  36. package/dist/taco.cjs.production.min.js.map +1 -1
  37. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Dialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { DialogContext, useCurrentDialog } from '../Context';\nimport { useLocalization } from '../../Provider/Localization';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { getDialogPositionClassnames, getDialogSizeClassnames } from '../util';\n\nexport type DialogContentDrawerRenderProps = DialogContext['drawer'];\n\nexport type DialogContentRenderProps = {\n close: () => void;\n drawer?: DialogContentDrawerRenderProps;\n};\n\nexport type DialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('text-center', props.className);\n return <DialogPrimitive.Title {...props} className={className} ref={ref} />;\n});\n\nexport type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DialogFooter(props: DialogFooterProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('mt-8 flex justify-end', props.className);\n return (\n <div {...props} className={className} ref={ref}>\n {props.children}\n </div>\n );\n});\n\nexport type DialogCloseProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Close = React.forwardRef(function DialogClose(props: DialogCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const dialog = useCurrentDialog();\n\n return <DialogPrimitive.Close onClick={dialog.onClose} {...props} ref={ref} asChild />;\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the dialog is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogContentRenderProps) => JSX.Element);\n onOpenAutoFocus?: DialogPrimitive.DialogContentProps['onOpenAutoFocus'];\n onCloseAutoFocus?: DialogPrimitive.DialogContentProps['onCloseAutoFocus'];\n};\nexport const Content = React.forwardRef(function DialogContent(props: DialogContentProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n const { position, dragging, handleProps: dragHandleProps } = useDraggable(internalRef);\n const { texts } = useLocalization();\n\n const className = cn(\n 'relative bg-white animate-[fade-in_150ms] rounded',\n getDialogPositionClassnames(),\n getDialogSizeClassnames(dialog.size),\n 'print:w-full print:h-full print:m-0 print:overflow-visible'\n );\n\n const containerClassName = cn(\n 'bg-white p-6 rounded relative z-10 shadow print:p-0',\n 'print:overflow-visible print:h-full print:!transform-none print:!fixed print:!inset-0 print:!m-0',\n {\n 'rounded-b-none': !!dialog.elements.extra,\n },\n props.className\n );\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n if (!dialog.closeOnEscape) {\n event.preventDefault();\n } else if (dialog.onClose) {\n dialog.onClose();\n }\n };\n\n // the chosen behaviour in taco is that outside clicks do not close the dialog\n const handleInteractOutside = (event: any) => event.preventDefault();\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper renderProps={{ drawer: dialog.drawer }}>{props.children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay asChild>\n <Backdrop>\n <DialogPrimitive.Content\n {...props}\n className={className}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={handleInteractOutside}\n ref={internalRef}\n style={{\n ...props.style,\n left: dialog.draggable ? `${position.x}px` : undefined,\n top: dialog.draggable ? `${position.y}px` : undefined,\n }}>\n <div className={containerClassName} data-taco=\"dialog\">\n <>\n {output}\n {dialog.draggable && (\n <div\n {...dragHandleProps}\n role=\"button\"\n draggable\n aria-grabbed={dragging}\n aria-label={texts.dialog.drag}\n className=\"yt-dialog__drag absolute-center-x bg-grey-100 top-1.5 h-3 w-24 cursor-move rounded text-center print:hidden\"\n />\n )}\n {dialog.showCloseButton ? (\n <DialogPrimitive.Close onClick={dialog.onClose} asChild>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.dialog.close}\n className=\"absolute right-0 top-0 mr-2 mt-2 print:hidden\"\n icon=\"close\"\n />\n </DialogPrimitive.Close>\n ) : null}\n </>\n </div>\n {dialog.elements.drawer}\n {dialog.elements.extra}\n </DialogPrimitive.Content>\n </Backdrop>\n </DialogPrimitive.Overlay>\n </DialogPrimitive.Portal>\n );\n});\n"],"names":["Title","React","DialogTitle","props","ref","className","cn","DialogPrimitive","Footer","DialogFooter","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","asChild","RenderPropWrapper","renderProps","close","CustomEvent","Content","DialogContent","internalRef","useMergedRef","position","dragging","handleProps","dragHandleProps","useDraggable","texts","useLocalization","getDialogPositionClassnames","getDialogSizeClassnames","size","containerClassName","elements","extra","handleEscapeKeyDown","event","closeOnEscape","preventDefault","handleInteractOutside","output","drawer","Backdrop","onEscapeKeyDown","onInteractOutside","style","left","draggable","x","undefined","top","y","role","drag","showCloseButton","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;MAmBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASC,WAAWA,CAACC,KAAuB,EAAEC,GAAkC;EAClH,MAAMC,SAAS,GAAGC,EAAE,CAAC,aAAa,EAAEH,KAAK,CAACE,SAAS,CAAC;EACpD,oBAAOJ,cAACM,OAAqB,oBAAKJ,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;KAAO;AAC/E,CAAC;MAGYI,MAAM,gBAAGP,UAAgB,CAAC,SAASQ,YAAYA,CAACN,KAAwB,EAAEC,GAA8B;EACjH,MAAMC,SAAS,GAAGC,EAAE,CAAC,uBAAuB,EAAEH,KAAK,CAACE,SAAS,CAAC;EAC9D,oBACIJ,uCAASE,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;MACtCD,KAAK,CAACO,QAAQ,CACb;AAEd,CAAC;MAIYC,KAAK,gBAAGV,UAAgB,CAAC,SAASW,WAAWA,CAACT,KAAuB,EAAEC,GAAiC;EACjH,MAAMS,MAAM,GAAGC,gBAAgB,EAAE;EAEjC,oBAAOb,cAACM,OAAqB;IAACQ,OAAO,EAAEF,MAAM,CAACG;KAAab,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEa,OAAO;KAAG;AAC1F,CAAC;AAED,MAAMC,iBAAiB,gBAAGjB,UAAgB,CAAC,SAASiB,iBAAiBA,CAAC;EAAER,QAAQ;EAAEK,OAAO;EAAEI;CAAkB,EAAEf,GAAG;EAC9G,MAAMgB,KAAK,GAAGA;IACVL,OAAO,CAAC,IAAIM,WAAW,CAAC,OAAO,CAAC,CAAC;GACpC;EAED,OAAOX,QAAQ,CAAC;IAAEU,KA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ACO,QAAQ;;EAG3B,oBACIT,cAACM,MAAsB,qBACnBN,cAACM,OAAuB;IAACU,OAAO;kBAC5BhB,cAAC6C,QAAQ,qBACL7C,cAACM,SAAuB,oBAChBJ,KAAK;IACTE,SAAS,EAAEA,SAAS;IACpB0C,eAAe,EAAER,mBAAmB;IACpCS,iBAAiB,EAAEL,qBAAqB;IACxCvC,GAAG,EAAEoB,WAAW;IAChByB,KAAK,EAAE;MACH,GAAG9C,KAAK,CAAC8C,KAAK;MACdC,IAAI,EAAErC,MAAM,CAACsC,SAAS,GAAG,GAAGzB,QAAQ,CAAC0B,CAAC,IAAI,GAAGC,SAAS;MACtDC,GAAG,EAAEzC,MAAM,CAACsC,SAAS,GAAG,GAAGzB,QAAQ,CAAC6B,CAAC,IAAI,GAAGF;;mBAEhDpD;IAAKI,SAAS,EAAE+B,kBAAkB;iBAAY;kBAC1CnC,8BACK2C,MAAM,EACN/B,MAAM,CAACsC,SAAS,kBACblD,uCACQ4B,eAAe;IACnB2B,IAAI,EAAC,QAAQ;IACbL,SAAS;oBACKxB,QAAQ;kBACVI,KAAK,CAAClB,MAAM,CAAC4C,IAAI;IAC7BpD,SAAS,EAAC;KACZ,CACL,EACAQ,MAAM,CAAC6C,eAAe,iBACnBzD,cAACM,OAAqB;IAACQ,OAAO,EAAEF,MAAM,CAACG,OAAO;IAAEC,OAAO;kBACnDhB,cAAC0D,UAAU;IACPC,UAAU,EAAC,UAAU;kBACT7B,KAAK,CAAClB,MAAM,CAACO,KAAK;IAC9Bf,SAAS,EAAC,+CAA+C;IACzDwD,IAAI,EAAC;IACP,CACkB,IACxB,IAAI,CACT,CACD,EACLhD,MAAM,CAACwB,QAAQ,CAACQ,MAAM,EACtBhC,MAAM,CAACwB,QAAQ,CAACC,KAAK,CACA,CACnB,CACW,CACL;AAEjC,CAAC;;;;"}
1
+ {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Dialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { DialogContext, useCurrentDialog } from '../Context';\nimport { useLocalization } from '../../Provider/Localization';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { getDialogPositionClassnames, getDialogSizeClassnames } from '../util';\n\nexport type DialogContentDrawerRenderProps = DialogContext['drawer'];\n\nexport type DialogContentRenderProps = {\n close: () => void;\n drawer?: DialogContentDrawerRenderProps;\n};\n\nexport type DialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('text-center', props.className);\n return <DialogPrimitive.Title {...props} className={className} ref={ref} />;\n});\n\nexport type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DialogFooter(props: DialogFooterProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('mt-8 flex justify-end', props.className);\n return (\n <div {...props} className={className} ref={ref}>\n {props.children}\n </div>\n );\n});\n\nexport type DialogCloseProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Close = React.forwardRef(function DialogClose(props: DialogCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const dialog = useCurrentDialog();\n\n return <DialogPrimitive.Close onClick={dialog.onClose} {...props} ref={ref} asChild />;\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the dialog is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogContentRenderProps) => JSX.Element);\n onOpenAutoFocus?: DialogPrimitive.DialogContentProps['onOpenAutoFocus'];\n onCloseAutoFocus?: DialogPrimitive.DialogContentProps['onCloseAutoFocus'];\n};\nexport const Content = React.forwardRef(function DialogContent(props: DialogContentProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n const internalRef = useMergedRef<HTMLDivElement>(ref);\n const { position, dragging, handleProps: dragHandleProps } = useDraggable(internalRef);\n const { texts } = useLocalization();\n\n const className = cn(\n 'relative bg-white animate-[fade-in_150ms] rounded print:!static',\n getDialogPositionClassnames(),\n getDialogSizeClassnames(dialog.size),\n 'print:w-full print:h-max print:m-0 print:overflow-visible'\n );\n\n const containerClassName = cn(\n 'bg-white p-6 rounded relative z-10 shadow print:p-0',\n // The `!fixed` property is crucial to ensure that when a draggable dialog is moved, the printed document still displays its content across the full page.\n 'print:overflow-visible print:h-max print:!transform-none print:!inset-0 print:!m-0',\n {\n 'rounded-b-none': !!dialog.elements.extra,\n },\n props.className\n );\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n if (!dialog.closeOnEscape) {\n event.preventDefault();\n } else if (dialog.onClose) {\n dialog.onClose();\n }\n };\n\n // the chosen behaviour in taco is that outside clicks do not close the dialog\n const handleInteractOutside = (event: any) => event.preventDefault();\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper renderProps={{ drawer: dialog.drawer }}>{props.children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay asChild>\n <Backdrop>\n <DialogPrimitive.Content\n {...props}\n className={className}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={handleInteractOutside}\n ref={internalRef}\n style={{\n ...props.style,\n left: dialog.draggable ? `${position.x}px` : undefined,\n top: dialog.draggable ? `${position.y}px` : undefined,\n }}>\n <div className={containerClassName} data-taco=\"dialog\">\n <>\n {output}\n {dialog.draggable && (\n <div\n {...dragHandleProps}\n role=\"button\"\n draggable\n aria-grabbed={dragging}\n aria-label={texts.dialog.drag}\n className=\"yt-dialog__drag absolute-center-x bg-grey-100 top-1.5 h-3 w-24 cursor-move rounded text-center print:hidden\"\n />\n )}\n {dialog.showCloseButton ? (\n <DialogPrimitive.Close onClick={dialog.onClose} asChild>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.dialog.close}\n className=\"absolute right-0 top-0 mr-2 mt-2 print:hidden\"\n icon=\"close\"\n />\n </DialogPrimitive.Close>\n ) : null}\n </>\n </div>\n {dialog.elements.drawer}\n {dialog.elements.extra}\n </DialogPrimitive.Content>\n </Backdrop>\n </DialogPrimitive.Overlay>\n </DialogPrimitive.Portal>\n );\n});\n"],"names":["Title","React","DialogTitle","props","ref","className","cn","DialogPrimitive","Footer","DialogFooter","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","asChild","RenderPropWrapper","renderProps","close","CustomEvent","Content","DialogContent","internalRef","useMergedRef","position","dragging","handleProps","dragHandleProps","useDraggable","texts","useLocalization","getDialogPositionClassnames","getDialogSizeClassnames","size","containerClassName","elements","extra","handleEscapeKeyDown","event","closeOnEscape","preventDefault","handleInteractOutside","output","drawer","Backdrop","onEscapeKeyDown","onInteractOutside","style","left","draggable","x","undefined","top","y","role","drag","showCloseButton","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;MAmBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASC,WAAWA,CAACC,KAAuB,EAAEC,GAAkC;EAClH,MAAMC,SAAS,GAAGC,EAAE,CAAC,aAAa,EAAEH,KAAK,CAACE,SAAS,CAAC;EACpD,oBAAOJ,cAACM,OAAqB,oBAAKJ,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;KAAO;AAC/E,CAAC;MAGYI,MAAM,gBAAGP,UAAgB,CAAC,SAASQ,YAAYA,CAACN,KAAwB,EAAEC,GAA8B;EACjH,MAAMC,SAAS,GAAGC,EAAE,CAAC,uBAAuB,EAAEH,KAAK,CAACE,SAAS,CAAC;EAC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AAI,EAAC,QAAQ;IACbL,SAAS;oBACKxB,QAAQ;kBACVI,KAAK,CAAClB,MAAM,CAAC4C,IAAI;IAC7BpD,SAAS,EAAC;KACZ,CACL,EACAQ,MAAM,CAAC6C,eAAe,iBACnBzD,cAACM,OAAqB;IAACQ,OAAO,EAAEF,MAAM,CAACG,OAAO;IAAEC,OAAO;kBACnDhB,cAAC0D,UAAU;IACPC,UAAU,EAAC,UAAU;kBACT7B,KAAK,CAAClB,MAAM,CAACO,KAAK;IAC9Bf,SAAS,EAAC,+CAA+C;IACzDwD,IAAI,EAAC;IACP,CACkB,IACxB,IAAI,CACT,CACD,EACLhD,MAAM,CAACwB,QAAQ,CAACQ,MAAM,EACtBhC,MAAM,CAACwB,QAAQ,CAACC,KAAK,CACA,CACnB,CACW,CACL;AAEjC,CAAC;;;;"}
@@ -37,7 +37,8 @@ const Title = /*#__PURE__*/forwardRef(function DialogTitle(props, ref) {
37
37
  });
38
38
  const Content = /*#__PURE__*/forwardRef(function HangerContent(props, ref) {
39
39
  const {
40
- placement: side
40
+ placement: side,
41
+ hideWhenDetached = false
41
42
  } = props;
42
43
  const context = useContext(HangerContext);
43
44
  const {
@@ -53,7 +54,8 @@ const Content = /*#__PURE__*/forwardRef(function HangerContent(props, ref) {
53
54
  onInteractOutside: handleInteractOutside,
54
55
  side: side,
55
56
  sideOffset: 1,
56
- ref: ref
57
+ ref: ref,
58
+ hideWhenDetached: hideWhenDetached
57
59
  }, props.children, /*#__PURE__*/createElement(UnstyledArrow, {
58
60
  className: "text-blue-500"
59
61
  }), /*#__PURE__*/createElement(Close, {
@@ -1 +1 @@
1
- {"version":3,"file":"Hanger.js","sources":["../../../../../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from '../Popover/Primitives';\nimport { useLocalization } from '../Provider/Localization';\nimport './Hanger.css';\nimport { mergeRefs } from '../../utils/mergeRefs';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n props: Record<string, any>;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n onClose: undefined,\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef(function HangerAnchor(props: HangerAnchorProps, externalRef: React.Ref<HTMLDivElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(HangerContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Anchor {...parentProps} {...props} ref={refCallback} asChild>\n {children}\n </PopoverPrimitive.Anchor>\n );\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side } = props;\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n side={side}\n sideOffset={1}\n ref={ref}>\n {props.children}\n <UnstyledArrow className=\"text-blue-500\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute right-0 top-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n </PopoverPrimitive.Close>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const context = React.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n return (\n <HangerContext.Provider value={context}>\n <PopoverPrimitive.Root key={String(open)} defaultOpen={open}>\n {anchor && <Anchor>{anchor}</Anchor>}\n {children}\n </PopoverPrimitive.Root>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["HangerContext","React","onClose","undefined","props","ref","Anchor","HangerAnchor","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","_props$children","type","console","warn","name","PopoverPrimitive","asChild","Title","DialogTitle","className","cn","Content","HangerContent","placement","side","context","texts","useLocalization","handleInteractOutside","event","preventDefault","onInteractOutside","sideOffset","UnstyledArrow","IconButton","appearance","hanger","close","icon","onClick","Hanger","anchor","defaultOpen","otherProps","open","setOpen","Provider","value","key","String"],"mappings":";;;;;;;;AAgBA,MAAMA,aAAa,gBAAGC,aAAmB,CAAqB;EAC1DC,OAAO,EAAEC,SAAS;EAClBC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE;CACR,CAAC;AAQF,MAAMC,MAAM,gBAAGL,UAAgB,CAAC,SAASM,YAAYA,CAACH,KAAwB,EAAEI,WAAsC;;EAClH,MAAM;IAAEH,GAAG,EAAEI,SAAS;IAAEL,KAAK,EAAEM;GAAa,GAAGT,UAAgB,CAACD,aAAa,CAAC;EAC9E,MAAMW,WAAW,GAAGC,SAAS,CAAC,CAACH,SAAS,EAAED,WAAW,CAAC,CAAC;EAEvD,IAAIK,QAAQ,GAAGT,KAAK,CAACS,QAAQ;EAE7B,iBAAIZ,cAAoB,CAACG,KAAK,CAACS,QAAQ,CAAC,IAAI,SAAAC,eAAA,GAAOV,KAAK,CAACS,QAAQ,cAAAC,eAAA,uBAAdA,eAAA,CAAgBC,IAAI,MAAK,UAAU,EAAE;IACpFC,OAAO,CAACC,IAAI,CACR,kHAAkHb,KAAK,CAACS,QAAQ,CAACE,IAAI,CAACG,IAAI,8CAA8Cd,KAAK,CAACS,QAAQ,CAACE,IAAI,CAACG,IAAI,kFAAkF,CACrS;IACDL,QAAQ,gBAAGZ,4BAAOG,KAAK,CAACS,QAAQ,CAAQ;;EAG5C,oBACIZ,cAACkB,QAAuB,oBAAKT,WAAW,EAAMN,KAAK;IAAEC,GAAG,EAAEM,WAAW;IAAES,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AAM,gBAAG3C,UAAgB,CAA2B,SAAS2C,MAAMA,CAACxC,KAAK,EAAEC,GAAG;EACvF,MAAM;IAAEwC,MAAM;IAAEhC,QAAQ;IAAEiC,WAAW,GAAG,IAAI;IAAE5C,OAAO;IAAE,GAAG6C;GAAY,GAAG3C,KAAK;EAC9E,MAAMyB,OAAO,GAAG5B,OAAa,CAAC,OAAO;IAAEC,OAAO;IAAEE,KAAK,EAAE2C,UAAU;IAAE1C;GAAK,CAAC,EAAE,CAACH,OAAO,EAAE6C,UAAU,CAAC,CAAC;;EAGjG,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGhD,QAAc,CAAC,KAAK,CAAC;EAC7CA,SAAe,CAAC;IACZ,IAAI6C,WAAW,EAAE;MACbG,OAAO,CAACH,WAAW,CAAC;;GAE3B,EAAE,EAAE,CAAC;EAEN,oBACI7C,cAACD,aAAa,CAACkD,QAAQ;IAACC,KAAK,EAAEtB;kBAC3B5B,cAACkB,IAAqB;IAACiC,GAAG,EAAEC,MAAM,CAACL,IAAI,CAAC;IAAEF,WAAW,EAAEE;KAClDH,MAAM,iBAAI5C,cAACK,MAAM,QAAEuC,MAAM,CAAU,EACnChC,QAAQ,CACW,CACH;AAEjC,CAAC;AACD+B,MAAM,CAACtC,MAAM,GAAGA,MAAM;AACtBsC,MAAM,CAACnB,OAAO,GAAGA,OAAO;AACxBmB,MAAM,CAACvB,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Hanger.js","sources":["../../../../../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from '../Popover/Primitives';\nimport { useLocalization } from '../Provider/Localization';\nimport './Hanger.css';\nimport { mergeRefs } from '../../utils/mergeRefs';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n props: Record<string, any>;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n onClose: undefined,\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef(function HangerAnchor(props: HangerAnchorProps, externalRef: React.Ref<HTMLDivElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(HangerContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Anchor {...parentProps} {...props} ref={refCallback} asChild>\n {children}\n </PopoverPrimitive.Anchor>\n );\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n hideWhenDetached?: boolean;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side, hideWhenDetached = false } = props;\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n side={side}\n sideOffset={1}\n ref={ref}\n hideWhenDetached={hideWhenDetached}>\n {props.children}\n <UnstyledArrow className=\"text-blue-500\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute right-0 top-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n </PopoverPrimitive.Close>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const context = React.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n return (\n <HangerContext.Provider value={context}>\n <PopoverPrimitive.Root key={String(open)} defaultOpen={open}>\n {anchor && <Anchor>{anchor}</Anchor>}\n {children}\n </PopoverPrimitive.Root>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["HangerContext","React","onClose","undefined","props","ref","Anchor","HangerAnchor","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","_props$children","type","console","warn","name","PopoverPrimitive","asChild","Title","DialogTitle","className","cn","Content","HangerContent","placement","side","hideWhenDetached","context","texts","useLocalization","handleInteractOutside","event","preventDefault","onInteractOutside","sideOffset","UnstyledArrow","IconButton","appearance","hanger","close","icon","onClick","Hanger","anchor","defaultOpen","otherProps","open","setOpen","Provider","value","key","String"],"mappings":";;;;;;;;AAgBA,MAAMA,aAAa,gBAAGC,aAAmB,CAAqB;EAC1DC,OAAO,EAAEC,SAAS;EAClBC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE;CACR,CAAC;AAQF,MAAMC,MAAM,gBAAGL,UAAgB,CAAC,SAASM,YAAYA,CAACH,KAAwB,EAAEI,WAAsC;;EAClH,MAAM;IAAEH,GAAG,EAAEI,SAAS;IAAEL,KAAK,EAAEM;GAAa,GAAGT,UAAgB,CAACD,aAAa,CAAC;EAC9E,MAAMW,WAAW,GAAGC,SAAS,CAAC,CAACH,SAAS,EAAED,WAAW,CAAC,CAAC;EAEvD,IAAIK,QAAQ,GAAGT,KAAK,CAACS,QAAQ;EAE7B,iBAAIZ,cAAoB,CAACG,KAAK,CAACS,QAAQ,CAAC,IAAI,SAAAC,eAAA,GAAOV,KAAK,CAACS,QAAQ,cAAAC,eAAA,uBAAdA,eAAA,CAAgBC,IAAI,MAAK,UAAU,EAAE;IACpFC,OAAO,CAACC,IAAI,CACR,kHAAkHb,KAAK,CAACS,QAAQ,CAACE,IAAI,CAACG,IAAI,8CAA8Cd,KAAK,CAACS,QAAQ,CAACE,IAAI,CAACG,IAAI,kFAAkF,CACrS;IACDL,QAAQ,gBAAGZ,4BAAOG,KAAK,CAACS,QAAQ,CAAQ;;EAG5C,oBACIZ,cAACkB,QAAuB,oBAAKT,WAAW,EAAMN,KAAK;IAAEC,GAAG,EAAEM,WAAW;IAAES,OAAO;MACzEP,QAAQ,CACa;AAElC,CAAC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AAC,CAAC;MAoBW2C,MAAM,gBAAG5C,UAAgB,CAA2B,SAAS4C,MAAMA,CAACzC,KAAK,EAAEC,GAAG;EACvF,MAAM;IAAEyC,MAAM;IAAEjC,QAAQ;IAAEkC,WAAW,GAAG,IAAI;IAAE7C,OAAO;IAAE,GAAG8C;GAAY,GAAG5C,KAAK;EAC9E,MAAM0B,OAAO,GAAG7B,OAAa,CAAC,OAAO;IAAEC,OAAO;IAAEE,KAAK,EAAE4C,UAAU;IAAE3C;GAAK,CAAC,EAAE,CAACH,OAAO,EAAE8C,UAAU,CAAC,CAAC;;EAGjG,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGjD,QAAc,CAAC,KAAK,CAAC;EAC7CA,SAAe,CAAC;IACZ,IAAI8C,WAAW,EAAE;MACbG,OAAO,CAACH,WAAW,CAAC;;GAE3B,EAAE,EAAE,CAAC;EAEN,oBACI9C,cAACD,aAAa,CAACmD,QAAQ;IAACC,KAAK,EAAEtB;kBAC3B7B,cAACkB,IAAqB;IAACkC,GAAG,EAAEC,MAAM,CAACL,IAAI,CAAC;IAAEF,WAAW,EAAEE;KAClDH,MAAM,iBAAI7C,cAACK,MAAM,QAAEwC,MAAM,CAAU,EACnCjC,QAAQ,CACW,CACH;AAEjC,CAAC;AACDgC,MAAM,CAACvC,MAAM,GAAGA,MAAM;AACtBuC,MAAM,CAACpB,OAAO,GAAGA,OAAO;AACxBoB,MAAM,CAACxB,KAAK,GAAGA,KAAK;;;;"}
@@ -5,7 +5,6 @@ import { Badge } from '../Badge/Badge.js';
5
5
  import { Root, Trigger, Portal, Content } from '@radix-ui/react-popover';
6
6
  import { getInputClasses } from '../Input/util.js';
7
7
  import { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener.js';
8
- import { Combobox } from '../Combobox/Combobox.js';
9
8
  import { MultiListbox, Listbox } from '../Listbox/Listbox.js';
10
9
  import { useSelect } from './useSelect.js';
11
10
 
@@ -79,16 +78,8 @@ const BaseSelect = /*#__PURE__*/forwardRef(function BaseSelect(props, ref) {
79
78
  });
80
79
  const Select = /*#__PURE__*/forwardRef(function Select(props, ref) {
81
80
  const {
82
- editable,
83
81
  ...otherProps
84
82
  } = props;
85
- if (editable) {
86
- return /*#__PURE__*/createElement(Combobox, Object.assign({}, otherProps, {
87
- dialog: undefined,
88
- inline: true,
89
- ref: ref
90
- }));
91
- }
92
83
  return /*#__PURE__*/createElement(BaseSelect, Object.assign({}, otherProps, {
93
84
  ref: ref
94
85
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Icon } from '../Icon/Icon';\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { useSelect } from './useSelect';\nimport { Combobox, ComboboxProps } from '../Combobox/Combobox';\nimport { Badge } from '../Badge/Badge';\nimport { getInputClasses } from '../Input/util';\nexport type SelectTexts = {\n /**\n * The text displayed when all options are selected when multiselect mode in on.\n */\n allOptionsSelected: string;\n};\n\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\n Omit<ComboboxProps, 'inline'> & {\n /**\n * Allows to select multiple values.\n * All the selected values will be combined in a comma-seperated string as the value of the input.\n */\n multiselect?: boolean;\n };\n\nexport type SelectProps = BaseSelectProps & {\n /**\n * Creates an editable select.\n * Setting this will render a inline Combobox which will display the provided data on click/focus,\n * even if there is no value in the input.\n * After user starts typing, matching data will be displayed.\n */\n editable?: boolean;\n};\n\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\n const internalRef = React.useRef<HTMLButtonElement>(null);\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\n const inputClassname = cn(getInputClasses(props), 'h-8 text-left !pr-0', {\n 'border-blue-500': popover.open,\n 'select-text': otherProps.readOnly,\n });\n\n React.useEffect(() => {\n if (autoFocus && internalRef.current) {\n internalRef.current.focus();\n }\n }, []);\n\n const renderMultiSelection = (): React.ReactNode => {\n return (\n <>\n <span className=\"flex-grow truncate text-left\">{text}</span>\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\n </>\n );\n };\n\n const commonListboxProps: ListboxProps = {\n ...listbox,\n className: 'w-auto',\n invalid: undefined,\n style: { minWidth: selectDimensions?.width },\n tabIndex: popover.open ? 0 : -1,\n };\n\n return (\n <span className={className} data-taco=\"select\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\n <span className=\"flex h-8 w-8 items-center justify-center\">\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n <input {...input} className=\"hidden\" type=\"text\" />\n </PopoverPrimitive.Root>\n </span>\n );\n});\n\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\n const { editable, ...otherProps } = props;\n\n if (editable) {\n return <Combobox {...otherProps} dialog={undefined} inline ref={ref} />;\n }\n\n return <BaseSelect {...otherProps} ref={ref} />;\n});\n"],"names":["BaseSelect","React","props","ref","autoFocus","className","externalClassName","highlighted","style","otherProps","button","listbox","popover","input","text","more","useSelect","internalRef","selectDimensions","useBoundingClientRectListener","cn","readOnly","inputClassname","getInputClasses","open","current","focus","renderMultiSelection","Badge","commonListboxProps","invalid","undefined","minWidth","width","tabIndex","PopoverPrimitive","multiselect","Icon","name","align","sideOffset","MultiListbox","Listbox","type","Select","editable","Combobox","dialog","inline"],"mappings":";;;;;;;;;;;AAoCA,MAAMA,UAAU,gBAAGC,UAAgB,CAAC,SAASD,UAAUA,CAACE,KAAsB,EAAEC,GAAgC;EAC5G,MAAM;IAAEC,SAAS;IAAEC,SAAS,EAAEC,iBAAiB;IAAEC,WAAW;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGP,KAAK;EAC5F,MAAM;IAAEQ,MAAM;IAAEC,OAAO;IAAEC,OAAO;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI,GAAG;GAAG,GAAGC,SAAS,CAACP,UAAU,EAAEN,GAAG,CAAC;EACtF,MAAMc,WAAW,GAAGhB,MAAY,CAAoB,IAAI,CAAC;EACzD,MAAMiB,gBAAgB,GAAGC,6BAA6B,CAACF,WAAW,CAAC;EACnE,MAAMZ,SAAS,GAAGe,EAAE,CAAC,6BAA6B,EAAE;IAAE,qBAAqB,EAAElB,KAAK,CAACmB;GAAU,EAAEf,iBAAiB,CAAC;EACjH,MAAMgB,cAAc,GAAGF,EAAE,CAACG,eAAe,CAACrB,KAAK,CAAC,EAAE,qBAAqB,EAAE;IACrE,iBAAiB,EAAEU,OAAO,CAACY,IAAI;IAC/B,aAAa,EAAEf,UAAU,CAACY;GAC7B,CAAC;EAEFpB,SAAe,CAAC;IACZ,IAAIG,SAAS,IAAIa,WAAW,CAACQ,OAAO,EAAE;MAClCR,WAAW,CAACQ,OAAO,CAACC,KAAK,EAAE;;GAElC,EAAE,EAAE,CAAC;EAEN,MAAMC,oBAAoB,GAAGA;IACzB,oBACI1B,2CACIA;MAAMI,SAAS,EAAC;OAAgCS,IAAI,CAAQ,EAC3DC,IAAI,GAAG,CAAC,iBAAId,cAAC2B,KAAK;MAACvB,SAAS,EAAC;O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AAGP,KAAK;EAEzC,IAAI2C,QAAQ,EAAE;IACV,oBAAO5C,cAAC6C,QAAQ,oBAAKrC,UAAU;MAAEsC,MAAM,EAAEhB,SAAS;MAAEiB,MAAM;MAAC7C,GAAG,EAAEA;OAAO;;EAG3E,oBAAOF,cAACD,UAAU,oBAAKS,UAAU;IAAEN,GAAG,EAAEA;KAAO;AACnD,CAAC;;;;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Icon } from '../Icon/Icon';\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { useSelect } from './useSelect';\nimport { ComboboxProps } from '../Combobox/Combobox';\nimport { Badge } from '../Badge/Badge';\nimport { getInputClasses } from '../Input/util';\nexport type SelectTexts = {\n /**\n * The text displayed when all options are selected when multiselect mode in on.\n */\n allOptionsSelected: string;\n};\n\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\n Omit<ComboboxProps, 'inline' | 'onChange'> & {\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n\n /**\n * Allows to select multiple values.\n * All the selected values will be combined in a comma-seperated string as the value of the input.\n */\n multiselect?: boolean;\n };\n\nexport type SelectProps = BaseSelectProps;\n\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\n const internalRef = React.useRef<HTMLButtonElement>(null);\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\n const inputClassname = cn(getInputClasses(props), 'h-8 text-left !pr-0', {\n 'border-blue-500': popover.open,\n 'select-text': otherProps.readOnly,\n });\n\n React.useEffect(() => {\n if (autoFocus && internalRef.current) {\n internalRef.current.focus();\n }\n }, []);\n\n const renderMultiSelection = (): React.ReactNode => {\n return (\n <>\n <span className=\"flex-grow truncate text-left\">{text}</span>\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\n </>\n );\n };\n\n const commonListboxProps: ListboxProps = {\n ...listbox,\n className: 'w-auto',\n invalid: undefined,\n style: { minWidth: selectDimensions?.width },\n tabIndex: popover.open ? 0 : -1,\n };\n\n return (\n <span className={className} data-taco=\"select\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\n <span className=\"flex h-8 w-8 items-center justify-center\">\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n <input {...input} className=\"hidden\" type=\"text\" />\n </PopoverPrimitive.Root>\n </span>\n );\n});\n\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\n const { ...otherProps } = props;\n\n return <BaseSelect {...otherProps} ref={ref} />;\n});\n"],"names":["BaseSelect","React","props","ref","autoFocus","className","externalClassName","highlighted","style","otherProps","button","listbox","popover","input","text","more","useSelect","internalRef","selectDimensions","useBoundingClientRectListener","cn","readOnly","inputClassname","getInputClasses","open","current","focus","renderMultiSelection","Badge","commonListboxProps","invalid","undefined","minWidth","width","tabIndex","PopoverPrimitive","multiselect","Icon","name","align","sideOffset","MultiListbox","Listbox","type","Select"],"mappings":";;;;;;;;;;AA8BA,MAAMA,UAAU,gBAAGC,UAAgB,CA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BAAgB,CAAEe;KAAO;IAC5CC,QAAQ,EAAEtB,OAAO,CAACY,IAAI,GAAG,CAAC,GAAG,CAAC;GACjC;EAED,oBACIvB;IAAMI,SAAS,EAAEA,SAAS;iBAAY,QAAQ;IAACG,KAAK,EAAEA;kBAClDP,cAACkC,IAAqB,oBAAKvB,OAAO,gBAC9BX,cAACkC,OAAwB,oBAAKzB,MAAM;IAAEL,SAAS,EAAEiB,cAAc;IAAEnB,GAAG,EAAEc;MACjEf,KAAK,CAACkC,WAAW,GAAGT,oBAAoB,EAAE,gBAAG1B;IAAMI,SAAS,EAAC;KAAgCS,IAAI,CAAQ,eAC1Gb;IAAMI,SAAS,EAAC;kBACZJ,cAACoC,IAAI;IAAChC,SAAS,EAAC,qBAAqB;IAACiC,IAAI,EAAE1B,OAAO,CAACY,IAAI,GAAG,YAAY,GAAG;IAAkB,CACzF,CACgB,eAC3BvB,cAACkC,MAAuB,qBACpBlC,cAACkC,OAAwB;IAACI,KAAK,EAAC,OAAO;IAACC,UAAU,EAAE;KAC/CtC,KAAK,CAACkC,WAAW,gBAAGnC,cAACwC,YAAY,oBAAKZ,kBAAkB,EAAI,gBAAG5B,cAACyC,OAAO,oBAAKb,kBAAkB,EAAI,CAC5E,CACL,eAC1B5B,yCAAWY,KAAK;IAAER,SAAS,EAAC,QAAQ;IAACsC,IAAI,EAAC;KAAS,CAC/B,CACrB;AAEf,CAAC,CAAC;MAEWC,MAAM,gBAAG3C,UAAgB,CAAC,SAAS2C,MAAMA,CAAC1C,KAAkB,EAAEC,GAAgC;EACvG,MAAM;IAAE,GAAGM;GAAY,GAAGP,KAAK;EAE/B,oBAAOD,cAACD,UAAU,oBAAKS,UAAU;IAAEN,GAAG,EAAEA;KAAO;AACnD,CAAC;;;;"}
@@ -23,7 +23,6 @@ function DiscardChangesConfirmationDialog(props) {
23
23
  }, /*#__PURE__*/React__default.createElement(Dialog.Title, null, texts.table3.editing.clearChangesConfirmationDialog.title), /*#__PURE__*/React__default.createElement("p", null, texts.table3.editing.clearChangesConfirmationDialog.description), /*#__PURE__*/React__default.createElement(Dialog.Footer, null, /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button, {
24
24
  tabIndex: 0
25
25
  }, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button, {
26
- autoFocus: true,
27
26
  tabIndex: 0,
28
27
  appearance: "primary",
29
28
  onClick: handleDiscard
@@ -1 +1 @@
1
- {"version":3,"file":"DiscardChangesConfirmationDialog.js","sources":["../../../../../../../../../src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.tsx"],"sourcesContent":["import React from 'react';\nimport { Dialog, DialogProps } from '../../../Dialog/Dialog';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Group } from '../../../Group/Group';\nimport { Button } from '../../../Button/Button';\n\ntype DiscardChangesConfirmationDialogProps = Partial<DialogProps> & {\n onDiscard: () => void;\n};\n\nexport function DiscardChangesConfirmationDialog(props: DiscardChangesConfirmationDialogProps) {\n const { onDiscard: handleDiscard, ...dialogProps } = props;\n const { texts } = useLocalization();\n\n const handleClickInsideDialogContent = (event: React.MouseEvent) => {\n // Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs\n // inside the dialog\n event.stopPropagation();\n };\n\n return (\n <Dialog {...dialogProps}>\n <Dialog.Content\n aria-label={texts.table3.editing.clearChangesConfirmationDialog.title}\n onClick={handleClickInsideDialogContent}>\n <Dialog.Title>{texts.table3.editing.clearChangesConfirmationDialog.title}</Dialog.Title>\n\n <p>{texts.table3.editing.clearChangesConfirmationDialog.description}</p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button tabIndex={0}>{texts.table3.editing.clearChangesConfirmationDialog.cancel}</Button>\n </Dialog.Close>\n <Dialog.Close>\n <Button autoFocus tabIndex={0} appearance=\"primary\" onClick={handleDiscard}>\n {texts.table3.editing.clearChangesConfirmationDialog.confirm}\n </Button>\n </Dialog.Close>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n );\n}\n"],"names":["DiscardChangesConfirmationDialog","props","onDiscard","handleDiscard","dialogProps","texts","useLocalization","handleClickInsideDialogContent","event","stopPropagation","React","Dialog","Content","table3","editing","clearChangesConfirmationDialog","title","onClick","Title","description","Footer","Group","Close","Button","tabIndex","cancel","autoFocus","appearance","confirm"],"mappings":";;;;;;SAUgBA,gCAAgCA,CAACC,KAA4C;EACzF,MAAM;IAAEC,SAAS,EAAEC,aAAa;IAAE,GAAGC;GAAa,GAAGH,KAAK;EAC1D,MAAM;IAAEI;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,8BAA8B,GAAIC,KAAuB;;;IAG3DA,KAAK,CAACC,eAAe,EAAE;GAC1B;EAED,oBACIC,6BAACC,MAAM,oBAAKP,WAAW,gBACnBM,6BAACC,MAAM,CAACC,OAAO;kBACCP,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACC,KAAK;IACrEC,OAAO,EAAEV;kBACTG,6BAACC,MAAM,CAACO,KAAK,QAAEb,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACC,KAAK,CAAgB,eAExFN,wCAAIL,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACI,WAAW,CAAK,eAExET,6BAACC,MAAM,CAACS,MAAM,qBACVV,6BAACW,KAAK,qBACFX,6BAACC,MAAM,CAACW,KAAK,qBACTZ,6BAACa,MAAM;IAACC,QAAQ,EAAE;KAAInB,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACU,MAAM,CAAU,CAC/E,eACff,6BAACC,MAAM,CAACW,KAAK,qBACTZ,6BAACa,MAAM;IAACG,SAAS;IAACF,QAAQ,EAAE,CAAC;IAAEG,UAAU,EAAC,SAAS;IAACV,OAAO,EAAEd;KACxDE,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACa,OAAO,CACvD,CACE,CACX,CACI,CACH,CACZ;AAEjB;;;;"}
1
+ {"version":3,"file":"DiscardChangesConfirmationDialog.js","sources":["../../../../../../../../../src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.tsx"],"sourcesContent":["import React from 'react';\nimport { Dialog, DialogProps } from '../../../Dialog/Dialog';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Group } from '../../../Group/Group';\nimport { Button } from '../../../Button/Button';\n\ntype DiscardChangesConfirmationDialogProps = Partial<DialogProps> & {\n onDiscard: () => void;\n};\n\nexport function DiscardChangesConfirmationDialog(props: DiscardChangesConfirmationDialogProps) {\n const { onDiscard: handleDiscard, ...dialogProps } = props;\n const { texts } = useLocalization();\n\n const handleClickInsideDialogContent = (event: React.MouseEvent) => {\n // Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs\n // inside the dialog\n event.stopPropagation();\n };\n\n return (\n <Dialog {...dialogProps}>\n <Dialog.Content\n aria-label={texts.table3.editing.clearChangesConfirmationDialog.title}\n onClick={handleClickInsideDialogContent}>\n <Dialog.Title>{texts.table3.editing.clearChangesConfirmationDialog.title}</Dialog.Title>\n\n <p>{texts.table3.editing.clearChangesConfirmationDialog.description}</p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button tabIndex={0}>{texts.table3.editing.clearChangesConfirmationDialog.cancel}</Button>\n </Dialog.Close>\n <Dialog.Close>\n <Button tabIndex={0} appearance=\"primary\" onClick={handleDiscard}>\n {texts.table3.editing.clearChangesConfirmationDialog.confirm}\n </Button>\n </Dialog.Close>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n );\n}\n"],"names":["DiscardChangesConfirmationDialog","props","onDiscard","handleDiscard","dialogProps","texts","useLocalization","handleClickInsideDialogContent","event","stopPropagation","React","Dialog","Content","table3","editing","clearChangesConfirmationDialog","title","onClick","Title","description","Footer","Group","Close","Button","tabIndex","cancel","appearance","confirm"],"mappings":";;;;;;SAUgBA,gCAAgCA,CAACC,KAA4C;EACzF,MAAM;IAAEC,SAAS,EAAEC,aAAa;IAAE,GAAGC;GAAa,GAAGH,KAAK;EAC1D,MAAM;IAAEI;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,8BAA8B,GAAIC,KAAuB;;;IAG3DA,KAAK,CAACC,eAAe,EAAE;GAC1B;EAED,oBACIC,6BAACC,MAAM,oBAAKP,WAAW,gBACnBM,6BAACC,MAAM,CAACC,OAAO;kBACCP,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACC,KAAK;IACrEC,OAAO,EAAEV;kBACTG,6BAACC,MAAM,CAACO,KAAK,QAAEb,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACC,KAAK,CAAgB,eAExFN,wCAAIL,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACI,WAAW,CAAK,eAExET,6BAACC,MAAM,CAACS,MAAM,qBACVV,6BAACW,KAAK,qBACFX,6BAACC,MAAM,CAACW,KAAK,qBACTZ,6BAACa,MAAM;IAACC,QAAQ,EAAE;KAAInB,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACU,MAAM,CAAU,CAC/E,eACff,6BAACC,MAAM,CAACW,KAAK,qBACTZ,6BAACa,MAAM;IAACC,QAAQ,EAAE,CAAC;IAAEE,UAAU,EAAC,SAAS;IAACT,OAAO,EAAEd;KAC9CE,KAAK,CAACQ,MAAM,CAACC,OAAO,CAACC,8BAA8B,CAACY,OAAO,CACvD,CACE,CACX,CACI,CACH,CACZ;AAEjB;;;;"}
@@ -44,7 +44,7 @@ function CreateNewRow(props) {
44
44
  keys: shortcut
45
45
  });
46
46
  }
47
- const className = cn('group/row border-grey-300 !sticky z-[21] print:hidden', {
47
+ const className = cn('group/row border-grey-300 !sticky z-[21]', {
48
48
  'bottom-10': tableMeta.footer.isEnabled,
49
49
  'bottom-0': !tableMeta.footer.isEnabled,
50
50
  'border-b': !isScrolled
@@ -1 +1 @@
1
- {"version":3,"file":"CreateNewRow.js","sources":["../../../../../../../../../../src/components/Table3/components/Row/Editing/CreateNewRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport clsx from 'clsx';\nimport { Button } from '../../../../Button/Button';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Table3EditingCreateHandler } from '../../../types';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\ntype CreateNewRowProps<TType = unknown> = {\n buttonRef: React.Ref<HTMLButtonElement>;\n isScrolled: boolean;\n onEditingCreate?: Table3EditingCreateHandler<TType>;\n table: ReactTable<TType>;\n tableMeta: ReactTableMeta<TType>;\n};\n\nexport function CreateNewRow<TType = unknown>(props: CreateNewRowProps<TType>) {\n const { buttonRef, isScrolled, table, tableMeta } = props;\n const { texts } = useLocalization();\n\n const temporaryRows = tableMeta.editing.temporaryRows as TType[];\n const temporaryRowId = temporaryRows[0]?.[tableMeta.rowIdentityAccessor] ?? '';\n\n const isDisabled =\n !!table.getState().globalFilter ||\n !!table.getState().columnFilters?.length ||\n (!!temporaryRowId && !!tableMeta.editing.hasRowErrors(temporaryRowId as unknown as string));\n const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId as unknown as string) === 'saving';\n\n const handleCreate = async () => {\n if (isDisabled) {\n return;\n }\n\n await tableMeta.editing.createRow(table);\n };\n const shortcut = { key: 'Enter', meta: true };\n\n let tooltip;\n\n if (isSaving) {\n tooltip = texts.table3.editing.buttons.create.saving;\n } else if (isDisabled) {\n tooltip = texts.table3.editing.buttons.create.disabled;\n } else {\n tooltip = <Shortcut keys={shortcut} />;\n }\n\n const className = clsx('group/row border-grey-300 !sticky z-[21] print:hidden', {\n 'bottom-10': tableMeta.footer.isEnabled,\n 'bottom-0': !tableMeta.footer.isEnabled,\n 'border-b': !isScrolled,\n });\n\n return (\n <tr data-row-create className={className} tabIndex={-1}>\n <td className=\"!bg-grey-50 col-span-full !border-b-0 !px-1\">\n <Button\n appearance=\"transparent\"\n className=\"group-hover:bg-grey-200 sticky left-[4px]\"\n disabled={isDisabled}\n onClick={handleCreate}\n ref={buttonRef}\n shortcut={shortcut}\n tooltip={tooltip}>\n <Icon name=\"circle-plus\" />\n {texts.table3.editing.buttons.create.label}\n </Button>\n </td>\n </tr>\n );\n}\n"],"names":["CreateNewRow","props","buttonRef","isScrolled","table","tableMeta","texts","useLocalization","temporaryRows","editing","temporaryRowId","_temporaryRows$0$tabl","_temporaryRows$","rowIdentityAccessor","isDisabled","getState","globalFilter","_table$getState$colum","columnFilters","length","hasRowErrors","isSaving","getRowStatus","handleCreate","Promise","resolve","createRow","then","e","reject","shortcut","key","meta","tooltip","table3","buttons","create","saving","disabled","React","Shortcut","keys","className","clsx","footer","isEnabled","tabIndex","Button","appearance","onClick","ref","Icon","name","label"],"mappings":";;;;;;;SAiBgBA,YAAYA,CAAkBC,KAA+B;;EACzE,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,KAAK;IAAEC;GAAW,GAAGJ,KAAK;EACzD,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,aAAa,GAAGH,SAAS,CAACI,OAAO,CAACD,aAAwB;EAChE,MAAME,cAAc,IAAAC,qBAAA,IAAAC,eAAA,GAAGJ,aAAa,CAAC,CAAC,CAAC,cAAAI,eAAA,uBAAhBA,eAAA,CAAmBP,SAAS,CAACQ,mBAAmB,CAAC,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,EAAE;EAE9E,MAAMG,UAAU,GACZ,CAAC,CAACV,KAAK,CAACW,QAAQ,EAAE,CAACC,YAAY,IAC/B,CAAC,GAAAC,qBAAA,GAACb,KAAK,CAACW,QAAQ,EAAE,CAACG,aAAa,cAAAD,qBAAA,eAA9BA,qBAAA,CAAgCE,MAAM,KACvC,CAAC,CAACT,cA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2C;IACrDJ,QAAQ,EAAExB,UAAU;IACpBmC,OAAO,EAAE1B,YAAY;IACrB2B,GAAG,EAAEhD,SAAS;IACd4B,QAAQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;kBACTM,6BAACY,IAAI;IAACC,IAAI,EAAC;IAAgB,EAC1B9C,KAAK,CAAC4B,MAAM,CAACzB,OAAO,CAAC0B,OAAO,CAACC,MAAM,CAACiB,KAAK,CACrC,CACR,CACJ;AAEb;;;;"}
1
+ {"version":3,"file":"CreateNewRow.js","sources":["../../../../../../../../../../src/components/Table3/components/Row/Editing/CreateNewRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport clsx from 'clsx';\nimport { Button } from '../../../../Button/Button';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Table3EditingCreateHandler } from '../../../types';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\ntype CreateNewRowProps<TType = unknown> = {\n buttonRef: React.Ref<HTMLButtonElement>;\n isScrolled: boolean;\n onEditingCreate?: Table3EditingCreateHandler<TType>;\n table: ReactTable<TType>;\n tableMeta: ReactTableMeta<TType>;\n};\n\nexport function CreateNewRow<TType = unknown>(props: CreateNewRowProps<TType>) {\n const { buttonRef, isScrolled, table, tableMeta } = props;\n const { texts } = useLocalization();\n\n const temporaryRows = tableMeta.editing.temporaryRows as TType[];\n const temporaryRowId = temporaryRows[0]?.[tableMeta.rowIdentityAccessor] ?? '';\n\n const isDisabled =\n !!table.getState().globalFilter ||\n !!table.getState().columnFilters?.length ||\n (!!temporaryRowId && !!tableMeta.editing.hasRowErrors(temporaryRowId as unknown as string));\n const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId as unknown as string) === 'saving';\n\n const handleCreate = async () => {\n if (isDisabled) {\n return;\n }\n\n await tableMeta.editing.createRow(table);\n };\n const shortcut = { key: 'Enter', meta: true };\n\n let tooltip;\n\n if (isSaving) {\n tooltip = texts.table3.editing.buttons.create.saving;\n } else if (isDisabled) {\n tooltip = texts.table3.editing.buttons.create.disabled;\n } else {\n tooltip = <Shortcut keys={shortcut} />;\n }\n\n const className = clsx('group/row border-grey-300 !sticky z-[21]', {\n 'bottom-10': tableMeta.footer.isEnabled,\n 'bottom-0': !tableMeta.footer.isEnabled,\n 'border-b': !isScrolled,\n });\n\n return (\n <tr data-row-create className={className} tabIndex={-1}>\n <td className=\"!bg-grey-50 col-span-full !border-b-0 !px-1\">\n <Button\n appearance=\"transparent\"\n className=\"group-hover:bg-grey-200 sticky left-[4px]\"\n disabled={isDisabled}\n onClick={handleCreate}\n ref={buttonRef}\n shortcut={shortcut}\n tooltip={tooltip}>\n <Icon name=\"circle-plus\" />\n {texts.table3.editing.buttons.create.label}\n </Button>\n </td>\n </tr>\n );\n}\n"],"names":["CreateNewRow","props","buttonRef","isScrolled","table","tableMeta","texts","useLocalization","temporaryRows","editing","temporaryRowId","_temporaryRows$0$tabl","_temporaryRows$","rowIdentityAccessor","isDisabled","getState","globalFilter","_table$getState$colum","columnFilters","length","hasRowErrors","isSaving","getRowStatus","handleCreate","Promise","resolve","createRow","then","e","reject","shortcut","key","meta","tooltip","table3","buttons","create","saving","disabled","React","Shortcut","keys","className","clsx","footer","isEnabled","tabIndex","Button","appearance","onClick","ref","Icon","name","label"],"mappings":";;;;;;;SAiBgBA,YAAYA,CAAkBC,KAA+B;;EACzE,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,KAAK;IAAEC;GAAW,GAAGJ,KAAK;EACzD,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,aAAa,GAAGH,SAAS,CAACI,OAAO,CAACD,aAAwB;EAChE,MAAME,cAAc,IAAAC,qBAAA,IAAAC,eAAA,GAAGJ,aAAa,CAAC,CAAC,CAAC,cAAAI,eAAA,uBAAhBA,eAAA,CAAmBP,SAAS,CAACQ,mBAAmB,CAAC,cAAA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AE,CAACxC,SAAS,CAACuC,MAAM,CAACC,SAAS;IACvC,UAAU,EAAE,CAAC1C;GAChB,CAAC;EAEF,oBACIoC;;IAAoBG,SAAS,EAAEA,SAAS;IAAEI,QAAQ,EAAE,CAAC;kBACjDP;IAAIG,SAAS,EAAC;kBACVH,6BAACQ,MAAM;IACHC,UAAU,EAAC,aAAa;IACxBN,SAAS,EAAC,2CAA2C;IACrDJ,QAAQ,EAAExB,UAAU;IACpBmC,OAAO,EAAE1B,YAAY;IACrB2B,GAAG,EAAEhD,SAAS;IACd4B,QAAQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;kBACTM,6BAACY,IAAI;IAACC,IAAI,EAAC;IAAgB,EAC1B9C,KAAK,CAAC4B,MAAM,CAACzB,OAAO,CAAC0B,OAAO,CAACC,MAAM,CAACiB,KAAK,CACrC,CACR,CACJ;AAEb;;;;"}
@@ -25,13 +25,13 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
25
25
  side: placement,
26
26
  sideOffset: 3
27
27
  }), /*#__PURE__*/createElement("div", {
28
- className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white print:hidden",
28
+ className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded bg-blue-900 px-2 py-1 text-xs text-white print:hidden",
29
29
  "data-taco": "tooltip",
30
30
  style: {
31
31
  transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
32
32
  }
33
33
  }, /*#__PURE__*/createElement(Arrow, {
34
- className: "-mt-px fill-blue-900/90 stroke-blue-900/90"
34
+ className: "-mt-px fill-blue-900 stroke-blue-900"
35
35
  }), title))));
36
36
  });
37
37
 
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport cn from 'clsx';\n\nexport type TooltipProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Use this value to hide tooltip conditionally */\n hide?: boolean;\n /** Text displayed in the tooltip */\n title: string | JSX.Element;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, hide = false, ...otherProps } = props;\n const className = cn('break-words', otherProps.className);\n\n if (hide) {\n return children;\n }\n\n return (\n <TooltipPrimitive.Root delayDuration={250}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content {...otherProps} asChild className={className} side={placement} sideOffset={3}>\n <div\n className=\"xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white print:hidden\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"-mt-px fill-blue-900/90 stroke-blue-900/90\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","hide","otherProps","className","cn","TooltipPrimitive","delayDuration","asChild","side","sideOffset","style","transformOrigin"],"mappings":";;;;MAkBaA,OAAO,gBAAGC,UAAgB,CAAC,SAASD,OAAOA,CAACE,KAAmB,EAAEC,GAA2B;EACrG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,IAAI,GAAG,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EACzE,MAAMO,SAAS,GAAGC,EAAE,CAAC,aAAa,EAAEF,UAAU,CAACC,SAAS,CAAC;EAEzD,IAAIF,IAAI,EAAE;IACN,OAAOF,QAAQ;;EAGnB,oBACIJ,cAACU,IAAqB;IAACC,aAAa,EAAE;kBAClCX,cAACU,OAAwB;IAACE,OAAO;IAACV,GAAG,EAAEA;KAClCE,QAAQ,CACc,eAC3BJ,cAACU,MAAuB,qBACpBV,cAACU,OAAwB,oBAAKH,UAAU;IAAEK,OAAO;IAACJ,SAAS,EAAEA,SAAS;IAAEK,IAAI,EAAER,SAAS;IAAES,UAAU,EAAE;mBACjGd;IACIQ,SAAS,EAAC,2JAA2J;iBAC3J,SAAS;IACnBO,KAAK,EAAE;MACHC,eAAe,EAAE;;kBAErBhB,cAACU,KAAsB;IAACF,SAAS,EAAC;IAA+C,EAChFL,KAAK,CACJ,CACiB,CACL,CACN;AAEhC,CAAC;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport cn from 'clsx';\n\nexport type TooltipProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Use this value to hide tooltip conditionally */\n hide?: boolean;\n /** Text displayed in the tooltip */\n title: string | JSX.Element;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, hide = false, ...otherProps } = props;\n const className = cn('break-words', otherProps.className);\n\n if (hide) {\n return children;\n }\n\n return (\n <TooltipPrimitive.Root delayDuration={250}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content {...otherProps} asChild className={className} side={placement} sideOffset={3}>\n <div\n className=\"xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded bg-blue-900 px-2 py-1 text-xs text-white print:hidden\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"-mt-px fill-blue-900 stroke-blue-900\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","hide","otherProps","className","cn","TooltipPrimitive","delayDuration","asChild","side","sideOffset","style","transformOrigin"],"mappings":";;;;MAkBaA,OAAO,gBAAGC,UAAgB,CAAC,SAASD,OAAOA,CAACE,KAAmB,EAAEC,GAA2B;EACrG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,IAAI,GAAG,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EACzE,MAAMO,SAAS,GAAGC,EAAE,CAAC,aAAa,EAAEF,UAAU,CAACC,SAAS,CAAC;EAEzD,IAAIF,IAAI,EAAE;IACN,OAAOF,QAAQ;;EAGnB,oBACIJ,cAACU,IAAqB;IAACC,aAAa,EAAE;kBAClCX,cAACU,OAAwB;IAACE,OAAO;IAACV,GAAG,EAAEA;KAClCE,QAAQ,CACc,eAC3BJ,cAACU,MAAuB,qBACpBV,cAACU,OAAwB,oBAAKH,UAAU;IAAEK,OAAO;IAACJ,SAAS,EAAEA,SAAS;IAAEK,IAAI,EAAER,SAAS;IAAES,UAAU,EAAE;mBACjGd;IACIQ,SAAS,EAAC,8IAA8I;iBAC9I,SAAS;IACnBO,KAAK,EAAE;MACHC,eAAe,EAAE;;kBAErBhB,cAACU,KAAsB;IAACF,SAAS,EAAC;IAAyC,EAC1EL,KAAK,CACJ,CACiB,CACL,CACN;AAEhC,CAAC;;;;"}
@@ -59,7 +59,7 @@ function useTableStyleGrid(tableId, table, fontSize) {
59
59
  // we have to be specific so that nested tables don't inherit the same css
60
60
  const hiddenColumns = printHiddenColumns.map(id => `table[data-taco^='table']#${tableId} > thead > tr > th[data-cell-id='${id}']\n,table[data-taco^='table']#${tableId} > tbody > tr > td[data-cell-id='${id}']\n`).join(',');
61
61
  const stylesheet = `@media print { table[data-taco^='table']#${tableId} { grid-template-columns: repeat(${printGridTemplateColumns}, auto) !important; }
62
- table[data-taco^='table']#${tableId} [data-cell-id^='__']${hiddenColumns ? `, ${hiddenColumns}` : ''} { display: none; }}`;
62
+ table[data-taco^='table']#${tableId} [data-cell-id^='__']${hiddenColumns ? `, ${hiddenColumns}` : ''} { display: none; } table[data-taco^='table']#${tableId} tr { page-break-inside: avoid; break-inside: avoid;}}`;
63
63
  return {
64
64
  style,
65
65
  stylesheet
@@ -1 +1 @@
1
- {"version":3,"file":"useTableStyleGrid.js","sources":["../../../../../../../../../src/primitives/Table/Core/features/useTableStyleGrid.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableFontSize } from '../../types';\nimport { getCellMinWidth, isInternalColumn } from '../../useTableManager/util/columns';\n\nexport function useTableStyleGrid<TType = unknown>(tableId: string, table: ReactTable<TType>, fontSize: TableFontSize) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const allVisibleColumns = table.getVisibleLeafColumns();\n const columnSizing = table.getState().columnSizing;\n const globalMinSize = getCellMinWidth(fontSize);\n\n // header body ?footer\n const gridTemplateRows = table.getRowModel().rows.length ? 'min-content 1fr min-content' : 'min-content 1fr';\n\n return React.useMemo(() => {\n let printGridTemplateColumns = 0;\n const printHiddenColumns: string[] = [];\n\n const gridTemplateColumns = allVisibleColumns.reduce((accum, column, index) => {\n if (table.options.enableGrouping && column.getIsGrouped()) {\n return accum;\n }\n\n const minSize = column.columnDef.minSize ?? globalMinSize;\n const width = columnSizing[column.id] as number | 'grow';\n\n let size;\n\n if (isInternalColumn(column.id)) {\n if (column.id === '__actions') {\n const minWidth = tableMeta.rowActions.rowActionsLength * 32 + 8; /* button margins l+r */\n size = `minmax(${minWidth}px, auto)`;\n } else {\n // getSize method is used instead of columnSizing state because internal columns have defined widths\n size = `${column.getSize()}px`;\n }\n } else if (width !== undefined) {\n const isLastColumn = index === allVisibleColumns.length - 1;\n\n if (width === 'grow' || (Number.isNaN(width) && !isLastColumn)) {\n size = `minmax(max-content, 1fr)`;\n } else {\n const minWidth = width < minSize ? minSize : width;\n\n if (isLastColumn) {\n size = `minmax(${minWidth}px, auto)`;\n } else {\n size = `${minWidth}px`;\n }\n }\n } else {\n size = `minmax(max-content, auto)`;\n }\n\n // printing\n if (column.columnDef.meta?.enablePrinting === false) {\n printHiddenColumns.push(column.id);\n } else {\n printGridTemplateColumns++;\n }\n\n return `${accum} ${size}`.trim();\n }, '');\n\n // normal grid\n const style: React.CSSProperties = {\n gridTemplateColumns,\n gridTemplateRows,\n };\n\n // printing grid\n // we have to be specific so that nested tables don't inherit the same css\n const hiddenColumns = printHiddenColumns\n .map(\n id =>\n `table[data-taco^='table']#${tableId} > thead > tr > th[data-cell-id='${id}']\\n,table[data-taco^='table']#${tableId} > tbody > tr > td[data-cell-id='${id}']\\n`\n )\n .join(',');\n const stylesheet = `@media print { table[data-taco^='table']#${tableId} { grid-template-columns: repeat(${printGridTemplateColumns}, auto) !important; }\n table[data-taco^='table']#${tableId} [data-cell-id^='__']${\n hiddenColumns ? `, ${hiddenColumns}` : ''\n } { display: none; }}`;\n\n return { style, stylesheet };\n }, [allVisibleColumns, columnSizing, globalMinSize, tableMeta.rowActions.rowActionsLength]);\n}\n"],"names":["useTableStyleGrid","tableId","table","fontSize","tableMeta","options","meta","allVisibleColumns","getVisibleLeafColumns","columnSizing","getState","globalMinSize","getCellMinWidth","gridTemplateRows","getRowModel","rows","length","React","useMemo","printGridTemplateColumns","printHiddenColumns","gridTemplateColumns","reduce","accum","column","index","enableGrouping","getIsGrouped","minSize","_column$columnDef$min","columnDef","width","id","size","isInternalColumn","minWidth","rowActions","rowActionsLength","getSize","undefined","isLastColumn","Number","isNaN","_column$columnDef$met","enablePrinting","push","trim","style","hiddenColumns","map","join","stylesheet"],"mappings":";;;SAKgBA,iBAAiBA,CAAkBC,OAAe,EAAEC,KAAwB,EAAEC,QAAuB;EACjH,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,qBAAqB,EAAE;EACvD,MAAMC,YAAY,GAAGP,KAAK,CAACQ,QAAQ,EAAE,CAACD,YAAY;EAClD,MAAME,aAAa,GAAGC,eAAe,CAACT,QAAQ,CAAC;;EAG/C,MAAMU,gBAAgB,GAAGX,KAAK,CAACY,WAAW,EAAE,CAACC,IAAI,CAACC,MAAM,GAAG,6BAA6B,GAAG,iBAAiB;EAE5G,OAAOC,cAAK,CAACC,OAAO,CAAC;IACjB,IAAIC,wBAAwB,GAAG,CAAC;IAChC,MAAMC,kBAAkB,GAAa,EAAE;IAEvC,MAAMC,mBAAmB,GAAGd,iBAAiB,CAACe,MAAM,CAAC,CAACC,KAAK,EAAEC,MAAM,EAAEC,KAAK;;MACtE,IAAIvB,KAAK,CAACG,OAAO,CAACqB,cAAc,IAAIF,MAAM,CAACG,YAAY,EAAE,EAAE;QACvD,OAAOJ,KAAK;;MAGhB,MAAMK,OAAO,IAAAC,qBAAA,GAAGL,MAAM,CAACM,SAAS,CAACF,OAAO,cAAAC,qBAAA,cAAAA,qBAAA,GAAIlB,aAAa;MACzD,MAAMoB,KAAK,GAAGtB,YAAY,CAACe,MAAM,CAACQ,EAAE,CAAoB;MAExD,IAAIC,IAAI;MAER,IAAIC,gBAAgB,CAACV,MAAM,CAACQ,EAAE,CAAC,EAAE;QAC7B,IAAIR,MAAM,CAACQ,EAAE,KAAK,WAAW,EAAE;UAC3B,MAAMG,QAAQ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IACd,MAAMC,UAAU,GAAG,4CAA4ClD,OAAO,oCAAoCkB,wBAAwB;oCACtGlB,OAAO,wBAC/B+C,aAAa,GAAG,KAAKA,aAAa,EAAE,GAAG,EAC3C,sBAAsB;IAEtB,OAAO;MAAED,KAAK;MAAEI;KAAY;GAC/B,EAAE,CAAC5C,iBAAiB,EAAEE,YAAY,EAAEE,aAAa,EAAEP,SAAS,CAACgC,UAAU,CAACC,gBAAgB,CAAC,CAAC;AAC/F;;;;"}
1
+ {"version":3,"file":"useTableStyleGrid.js","sources":["../../../../../../../../../src/primitives/Table/Core/features/useTableStyleGrid.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableFontSize } from '../../types';\nimport { getCellMinWidth, isInternalColumn } from '../../useTableManager/util/columns';\n\nexport function useTableStyleGrid<TType = unknown>(tableId: string, table: ReactTable<TType>, fontSize: TableFontSize) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const allVisibleColumns = table.getVisibleLeafColumns();\n const columnSizing = table.getState().columnSizing;\n const globalMinSize = getCellMinWidth(fontSize);\n\n // header body ?footer\n const gridTemplateRows = table.getRowModel().rows.length ? 'min-content 1fr min-content' : 'min-content 1fr';\n\n return React.useMemo(() => {\n let printGridTemplateColumns = 0;\n const printHiddenColumns: string[] = [];\n\n const gridTemplateColumns = allVisibleColumns.reduce((accum, column, index) => {\n if (table.options.enableGrouping && column.getIsGrouped()) {\n return accum;\n }\n\n const minSize = column.columnDef.minSize ?? globalMinSize;\n const width = columnSizing[column.id] as number | 'grow';\n\n let size;\n\n if (isInternalColumn(column.id)) {\n if (column.id === '__actions') {\n const minWidth = tableMeta.rowActions.rowActionsLength * 32 + 8; /* button margins l+r */\n size = `minmax(${minWidth}px, auto)`;\n } else {\n // getSize method is used instead of columnSizing state because internal columns have defined widths\n size = `${column.getSize()}px`;\n }\n } else if (width !== undefined) {\n const isLastColumn = index === allVisibleColumns.length - 1;\n\n if (width === 'grow' || (Number.isNaN(width) && !isLastColumn)) {\n size = `minmax(max-content, 1fr)`;\n } else {\n const minWidth = width < minSize ? minSize : width;\n\n if (isLastColumn) {\n size = `minmax(${minWidth}px, auto)`;\n } else {\n size = `${minWidth}px`;\n }\n }\n } else {\n size = `minmax(max-content, auto)`;\n }\n\n // printing\n if (column.columnDef.meta?.enablePrinting === false) {\n printHiddenColumns.push(column.id);\n } else {\n printGridTemplateColumns++;\n }\n\n return `${accum} ${size}`.trim();\n }, '');\n\n // normal grid\n const style: React.CSSProperties = {\n gridTemplateColumns,\n gridTemplateRows,\n };\n\n // printing grid\n // we have to be specific so that nested tables don't inherit the same css\n const hiddenColumns = printHiddenColumns\n .map(\n id =>\n `table[data-taco^='table']#${tableId} > thead > tr > th[data-cell-id='${id}']\\n,table[data-taco^='table']#${tableId} > tbody > tr > td[data-cell-id='${id}']\\n`\n )\n .join(',');\n const stylesheet = `@media print { table[data-taco^='table']#${tableId} { grid-template-columns: repeat(${printGridTemplateColumns}, auto) !important; }\n table[data-taco^='table']#${tableId} [data-cell-id^='__']${\n hiddenColumns ? `, ${hiddenColumns}` : ''\n } { display: none; } table[data-taco^='table']#${tableId} tr { page-break-inside: avoid; break-inside: avoid;}}`;\n\n return { style, stylesheet };\n }, [allVisibleColumns, columnSizing, globalMinSize, tableMeta.rowActions.rowActionsLength]);\n}\n"],"names":["useTableStyleGrid","tableId","table","fontSize","tableMeta","options","meta","allVisibleColumns","getVisibleLeafColumns","columnSizing","getState","globalMinSize","getCellMinWidth","gridTemplateRows","getRowModel","rows","length","React","useMemo","printGridTemplateColumns","printHiddenColumns","gridTemplateColumns","reduce","accum","column","index","enableGrouping","getIsGrouped","minSize","_column$columnDef$min","columnDef","width","id","size","isInternalColumn","minWidth","rowActions","rowActionsLength","getSize","undefined","isLastColumn","Number","isNaN","_column$columnDef$met","enablePrinting","push","trim","style","hiddenColumns","map","join","stylesheet"],"mappings":";;;SAKgBA,iBAAiBA,CAAkBC,OAAe,EA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AEE,YAAY,EAAEE,aAAa,EAAEP,SAAS,CAACgC,UAAU,CAACC,gBAAgB,CAAC,CAAC;AAC/F;;;;"}
@@ -111,7 +111,8 @@ function useTableDataLoader2(fetchPage, fetchAll, options = {
111
111
  length.current = response.length;
112
112
  const pages = [];
113
113
  const cache = {};
114
- Array.from(Array(response.length / pageSize).keys()).forEach(index => {
114
+ const pageCount = Math.ceil(response.length / pageSize);
115
+ Array.from(Array(pageCount).keys()).forEach(index => {
115
116
  pages.push(index);
116
117
  const startIndex = index * pageSize;
117
118
  cache[index] = response.data.slice(startIndex, startIndex + pageSize);
@@ -1 +1 @@
1
- {"version":3,"file":"useTableDataLoader2.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader2.ts"],"sourcesContent":["import React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n TableSearchHandler,\n} from './types';\nimport { DEFAULT_PAGE_SIZE, useTableDataLoaderOptions } from './useTableDataLoader';\n\nconst DATASET_SIZE_MULTIPLIER = 15;\n\nexport type useTableDataPageFetcher2<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n hiddenColumns: string[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher2<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n hiddenColumns: string[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderValues2<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSearch: TableSearchHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n pages: number[];\n _experimentalDataLoader2: boolean;\n};\n\ntype Data<TType = unknown> = {\n rows: TType[];\n pages: number[];\n cache: Record<number, TType[]>;\n lastFetchedPage: number | undefined;\n};\ntype Direction = 'forward' | 'backward' | undefined;\n\nexport function useTableDataLoader2<TType = unknown>(\n fetchPage: useTableDataPageFetcher2<TType>,\n fetchAll: useTableDataAllFetcher2<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues2<TType>, () => void] {\n const { pageSize } = options;\n const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number>(0);\n // data will be filled after the first request\n const [data, setData] = React.useState<Data<TType>>({ rows: [], pages: [], cache: {}, lastFetchedPage: undefined });\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef<Record<number, boolean>>({});\n // it's possible to spam updates, e.g. sort, so we don't set state if the last request wasn't the current oen\n const _lastRequestId = React.useRef<string | undefined>();\n // store last used properties\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string | undefined>();\n const _lastUsedHiddenColumns = React.useRef<string[]>([]);\n\n async function loadPage(\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n hiddenColumns: string[],\n search: string | undefined,\n reset = false\n ) {\n // if a request is already pending for this page (and it's not a reset), skip it\n if (_pendingPageRequests.current[pageIndex] && !reset) {\n return;\n }\n\n const hasChangedData =\n JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) ||\n JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current) ||\n search !== _lastUsedSearch.current;\n\n // if the page is already loaded and has actual rows, abort\n if (data.cache[pageIndex] && data.cache[pageIndex][0] && !hasChangedData && !reset) {\n return;\n }\n\n // create an id to track the update\n const requestId = uuid();\n\n // set the page as loading, so that subsequent requests don't retrigger it\n _pendingPageRequests.current[pageIndex] = true;\n\n try {\n _lastRequestId.current = requestId;\n const response = await fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns, search);\n length.current = response.length;\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n // if this request wasn't the last one, just return the current state to prevent weird updates\n if (_lastRequestId.current !== requestId) {\n return currentData;\n }\n\n const direction = getDirection(pageIndex, currentData.pages);\n const nextPages = getPages(pageIndex, currentData.lastFetchedPage, reset ? [] : currentData.pages, direction);\n\n // set values so we can track if they changed between loads\n _lastUsedSorting.current = sorting;\n _lastUsedFilters.current = filters;\n _lastUsedSearch.current = search;\n _lastUsedHiddenColumns.current = hiddenColumns;\n\n // cache data as an object to prevent any duplicates for pages\n let nextCache: Record<number, TType[]>;\n\n if (reset || hasChangedData || !direction) {\n nextCache = nextPages.reduce((acc, p) => ({ ...acc, [p]: Array(pageSize).fill(undefined) }), {});\n } else {\n nextCache = { ...currentData.cache };\n }\n\n nextCache[pageIndex] = response.data;\n\n // cleanup \"unloaded\" pages\n if (direction === 'forward' && currentData.rows.length >= DATASET_SIZE) {\n delete nextCache[currentData.pages[0]];\n } else if (direction === 'backward' && currentData.rows.length >= DATASET_SIZE) {\n delete nextCache[currentData.pages[currentData.pages.length - 1]];\n }\n\n // remap rows from the cached data - do it here and not in render to save some performance\n const rows = Object.values(nextCache).reduce((acc, p) => acc.concat(p), []);\n\n return {\n cache: nextCache,\n pages: nextPages,\n rows: rows,\n lastFetchedPage: pageIndex,\n };\n });\n\n // reset pending requests\n delete _pendingPageRequests.current[pageIndex];\n } catch {\n //\n }\n }\n\n const loadAll = async (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n hiddenColumns: string[],\n search: string | undefined\n ) => {\n // set values so we can track if they changed between loads\n _lastUsedSorting.current = sorting;\n _lastUsedFilters.current = filters;\n _lastUsedSearch.current = search;\n _lastUsedHiddenColumns.current = hiddenColumns;\n\n try {\n const response = await fetchAll(sorting, filters, hiddenColumns, search);\n length.current = response.length;\n\n const pages: number[] = [];\n const cache: Record<number, Array<TType>> = {};\n\n Array.from(Array(response.length / pageSize).keys()).forEach(index => {\n pages.push(index);\n const startIndex = index * pageSize;\n cache[index] = response.data.slice(startIndex, startIndex + pageSize);\n });\n\n setData({\n cache,\n pages,\n rows: response.data,\n lastFetchedPage: undefined,\n });\n } catch {\n //\n } finally {\n // reset pending requests\n _pendingPageRequests.current = {};\n }\n };\n\n const invalidate = async () => {\n // reset stuff\n _pendingPageRequests.current = {};\n\n // load the current page again\n return loadPage(\n getCurrentPage(data.pages),\n _lastUsedSorting.current,\n _lastUsedFilters.current,\n _lastUsedHiddenColumns.current,\n _lastUsedSearch.current,\n true\n );\n };\n\n const handleSort = async (sorting: TableColumnSort[]) => {\n // reset before loading the current page\n _pendingPageRequests.current = {};\n\n return loadPage(\n getCurrentPage(data.pages),\n sorting,\n _lastUsedFilters.current,\n _lastUsedHiddenColumns.current,\n _lastUsedSearch.current,\n true\n );\n };\n const handleFilter = async (filters: TableColumnFilter[], hiddenColumns: string[]) => {\n // reset before loading the current page\n _pendingPageRequests.current = {};\n return loadPage(0, _lastUsedSorting.current, filters, hiddenColumns, _lastUsedSearch.current, true);\n };\n const handleSearch = async (search: string | undefined, hiddenColumns: string[]) => {\n // reset before loading the current page\n _pendingPageRequests.current = {};\n return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, hiddenColumns, search, true);\n };\n\n return [\n {\n data: data.rows,\n pages: data.pages,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSearch: handleSearch,\n onChangeSort: handleSort,\n pageSize,\n _experimentalDataLoader2: true,\n },\n invalidate,\n ];\n}\n\nfunction getCurrentPage(currentPages: number[]): number {\n if (currentPages.length <= 2) {\n return currentPages[0];\n }\n\n // for even page lengths we can't know which is the current visible page - it could even be both\n // so we load one of them and rely on the \"load next/previous page\" functionality in row\n const middle = Math.floor(currentPages.length / 2);\n return currentPages[middle];\n}\n\nfunction getDirection(pageIndex: number, currentPages: number[]): Direction {\n if (currentPages.length) {\n if (pageIndex === currentPages[currentPages.length - 1] + 1) {\n return 'forward';\n } else if (\n pageIndex === currentPages[0] - 1 ||\n (currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0])\n ) {\n return 'backward';\n }\n }\n\n return undefined;\n}\n\nfunction getPages(pageIndex: number, lastUsedPageIndex: number | undefined, currentPages: number[], direction: Direction) {\n if (currentPages.length && (pageIndex === lastUsedPageIndex || currentPages.includes(pageIndex))) {\n return currentPages;\n }\n\n if (direction === 'forward') {\n const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(1) : currentPages;\n return nextPages.concat(pageIndex);\n }\n\n if (direction === 'backward') {\n const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(0, -1) : currentPages;\n return [pageIndex].concat(nextPages);\n }\n\n return [pageIndex];\n}\n"],"names":["DATASET_SIZE_MULTIPLIER","useTableDataLoader2","fetchPage","fetchAll","options","pageSize","DEFAULT_PAGE_SIZE","loadPage","pageIndex","sorting","filters","hiddenColumns","search","reset","_pendingPageRequests","current","Promise","resolve","hasChangedData","JSON","stringify","_lastUsedSorting","_lastUsedFilters","_lastUsedSearch","data","cache","requestId","uuid","_temp2","_catch","_lastRequestId","then","response","length","setData","currentData","direction","getDirection","pages","nextPages","getPages","lastFetchedPage","_lastUsedHiddenColumns","nextCache","reduce","acc","p","Array","fill","undefined","rows","DATASET_SIZE","Object","values","concat","e","reject","React","useRef","useState","loadAll","_temp","_finallyRethrows","from","keys","forEach","index","push","startIndex","slice","_wasThrown","_result","invalidate","getCurrentPage","handleSort","handleFilter","handleSearch","onChangeFilter","onChangeSearch","onChangeSort","_experimentalDataLoader2","currentPages","middle","Math","floor","lastUsedPageIndex","includes"],"mappings":";;;;;AAaA,MAAMA,uBAAuB,GAAG,EAAE;SAuClBC,mBAAmBA,CAC/BC,SAA0C,EAC1CC,QAAwC,EACxCC,UAAqC;EAAEC,QAAQ,EAAEC;CAAmB;QAmBrDC,QAAQ,aACnBC,SAAiB,EACjBC,OAA0B,E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S,KAAK6E,iBAAiB,IAAIJ,YAAY,CAACK,QAAQ,CAAC9E,SAAS,CAAC,CAAC,EAAE;IAC9F,OAAOyE,YAAY;;EAGvB,IAAI7C,SAAS,KAAK,SAAS,EAAE;IACzB,MAAMG,SAAS,GAAG0C,YAAY,CAAChD,MAAM,KAAKjC,uBAAuB,GAAGiF,YAAY,CAACZ,KAAK,CAAC,CAAC,CAAC,GAAGY,YAAY;IACxG,OAAO1C,SAAS,CAACe,MAAM,CAAC9C,SAAS,CAAC;;EAGtC,IAAI4B,SAAS,KAAK,UAAU,EAAE;IAC1B,MAAMG,SAAS,GAAG0C,YAAY,CAAChD,MAAM,KAAKjC,uBAAuB,GAAGiF,YAAY,CAACZ,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAGY,YAAY;IAC5G,OAAO,CAACzE,SAAS,CAAC,CAAC8C,MAAM,CAACf,SAAS,CAAC;;EAGxC,OAAO,CAAC/B,SAAS,CAAC;AACtB;;;;"}
1
+ {"version":3,"file":"useTableDataLoader2.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader2.ts"],"sourcesContent":["import React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n TableSearchHandler,\n} from './types';\nimport { DEFAULT_PAGE_SIZE, useTableDataLoaderOptions } from './useTableDataLoader';\n\nconst DATASET_SIZE_MULTIPLIER = 15;\n\nexport type useTableDataPageFetcher2<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n hiddenColumns: string[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher2<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n hiddenColumns: string[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderValues2<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSearch: TableSearchHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n pages: number[];\n _experimentalDataLoader2: boolean;\n};\n\ntype Data<TType = unknown> = {\n rows: TType[];\n pages: number[];\n cache: Record<number, TType[]>;\n lastFetchedPage: number | undefined;\n};\ntype Direction = 'forward' | 'backward' | undefined;\n\nexport function useTableDataLoader2<TType = unknown>(\n fetchPage: useTableDataPageFetcher2<TType>,\n fetchAll: useTableDataAllFetcher2<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues2<TType>, () => void] {\n const { pageSize } = options;\n const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number>(0);\n // data will be filled after the first request\n const [data, setData] = React.useState<Data<TType>>({ rows: [], pages: [], cache: {}, lastFetchedPage: undefined });\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef<Record<number, boolean>>({});\n // it's possible to spam updates, e.g. sort, so we don't set state if the last request wasn't the current oen\n const _lastRequestId = React.useRef<string | undefined>();\n // store last used properties\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string | undefined>();\n const _lastUsedHiddenColumns = React.useRef<string[]>([]);\n\n async function loadPage(\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n hiddenColumns: string[],\n search: string | undefined,\n reset = false\n ) {\n // if a request is already pending for this page (and it's not a reset), skip it\n if (_pendingPageRequests.current[pageIndex] && !reset) {\n return;\n }\n\n const hasChangedData =\n JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) ||\n JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current) ||\n search !== _lastUsedSearch.current;\n\n // if the page is already loaded and has actual rows, abort\n if (data.cache[pageIndex] && data.cache[pageIndex][0] && !hasChangedData && !reset) {\n return;\n }\n\n // create an id to track the update\n const requestId = uuid();\n\n // set the page as loading, so that subsequent requests don't retrigger it\n _pendingPageRequests.current[pageIndex] = true;\n\n try {\n _lastRequestId.current = requestId;\n const response = await fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns, search);\n length.current = response.length;\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n // if this request wasn't the last one, just return the current state to prevent weird updates\n if (_lastRequestId.current !== requestId) {\n return currentData;\n }\n\n const direction = getDirection(pageIndex, currentData.pages);\n const nextPages = getPages(pageIndex, currentData.lastFetchedPage, reset ? [] : currentData.pages, direction);\n\n // set values so we can track if they changed between loads\n _lastUsedSorting.current = sorting;\n _lastUsedFilters.current = filters;\n _lastUsedSearch.current = search;\n _lastUsedHiddenColumns.current = hiddenColumns;\n\n // cache data as an object to prevent any duplicates for pages\n let nextCache: Record<number, TType[]>;\n\n if (reset || hasChangedData || !direction) {\n nextCache = nextPages.reduce((acc, p) => ({ ...acc, [p]: Array(pageSize).fill(undefined) }), {});\n } else {\n nextCache = { ...currentData.cache };\n }\n\n nextCache[pageIndex] = response.data;\n\n // cleanup \"unloaded\" pages\n if (direction === 'forward' && currentData.rows.length >= DATASET_SIZE) {\n delete nextCache[currentData.pages[0]];\n } else if (direction === 'backward' && currentData.rows.length >= DATASET_SIZE) {\n delete nextCache[currentData.pages[currentData.pages.length - 1]];\n }\n\n // remap rows from the cached data - do it here and not in render to save some performance\n const rows = Object.values(nextCache).reduce((acc, p) => acc.concat(p), []);\n\n return {\n cache: nextCache,\n pages: nextPages,\n rows: rows,\n lastFetchedPage: pageIndex,\n };\n });\n\n // reset pending requests\n delete _pendingPageRequests.current[pageIndex];\n } catch {\n //\n }\n }\n\n const loadAll = async (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n hiddenColumns: string[],\n search: string | undefined\n ) => {\n // set values so we can track if they changed between loads\n _lastUsedSorting.current = sorting;\n _lastUsedFilters.current = filters;\n _lastUsedSearch.current = search;\n _lastUsedHiddenColumns.current = hiddenColumns;\n\n try {\n const response = await fetchAll(sorting, filters, hiddenColumns, search);\n length.current = response.length;\n\n const pages: number[] = [];\n const cache: Record<number, Array<TType>> = {};\n const pageCount = Math.ceil(response.length / pageSize);\n\n Array.from(Array(pageCount).keys()).forEach(index => {\n pages.push(index);\n const startIndex = index * pageSize;\n cache[index] = response.data.slice(startIndex, startIndex + pageSize);\n });\n\n setData({\n cache,\n pages,\n rows: response.data,\n lastFetchedPage: undefined,\n });\n } catch {\n //\n } finally {\n // reset pending requests\n _pendingPageRequests.current = {};\n }\n };\n\n const invalidate = async () => {\n // reset stuff\n _pendingPageRequests.current = {};\n\n // load the current page again\n return loadPage(\n getCurrentPage(data.pages),\n _lastUsedSorting.current,\n _lastUsedFilters.current,\n _lastUsedHiddenColumns.current,\n _lastUsedSearch.current,\n true\n );\n };\n\n const handleSort = async (sorting: TableColumnSort[]) => {\n // reset before loading the current page\n _pendingPageRequests.current = {};\n\n return loadPage(\n getCurrentPage(data.pages),\n sorting,\n _lastUsedFilters.current,\n _lastUsedHiddenColumns.current,\n _lastUsedSearch.current,\n true\n );\n };\n const handleFilter = async (filters: TableColumnFilter[], hiddenColumns: string[]) => {\n // reset before loading the current page\n _pendingPageRequests.current = {};\n return loadPage(0, _lastUsedSorting.current, filters, hiddenColumns, _lastUsedSearch.current, true);\n };\n const handleSearch = async (search: string | undefined, hiddenColumns: string[]) => {\n // reset before loading the current page\n _pendingPageRequests.current = {};\n return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, hiddenColumns, search, true);\n };\n\n return [\n {\n data: data.rows,\n pages: data.pages,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSearch: handleSearch,\n onChangeSort: handleSort,\n pageSize,\n _experimentalDataLoader2: true,\n },\n invalidate,\n ];\n}\n\nfunction getCurrentPage(currentPages: number[]): number {\n if (currentPages.length <= 2) {\n return currentPages[0];\n }\n\n // for even page lengths we can't know which is the current visible page - it could even be both\n // so we load one of them and rely on the \"load next/previous page\" functionality in row\n const middle = Math.floor(currentPages.length / 2);\n return currentPages[middle];\n}\n\nfunction getDirection(pageIndex: number, currentPages: number[]): Direction {\n if (currentPages.length) {\n if (pageIndex === currentPages[currentPages.length - 1] + 1) {\n return 'forward';\n } else if (\n pageIndex === currentPages[0] - 1 ||\n (currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0])\n ) {\n return 'backward';\n }\n }\n\n return undefined;\n}\n\nfunction getPages(pageIndex: number, lastUsedPageIndex: number | undefined, currentPages: number[], direction: Direction) {\n if (currentPages.length && (pageIndex === lastUsedPageIndex || currentPages.includes(pageIndex))) {\n return currentPages;\n }\n\n if (direction === 'forward') {\n const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(1) : currentPages;\n return nextPages.concat(pageIndex);\n }\n\n if (direction === 'backward') {\n const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(0, -1) : currentPages;\n return [pageIndex].concat(nextPages);\n }\n\n return [pageIndex];\n}\n"],"names":["DATASET_SIZE_MULTIPLIER","useTableDataLoader2","fetchPage","fetchAll","options","pageSize","DEFAULT_PAGE_SIZE","loadPage","pageIndex","sorting","filters","hiddenColumns","search","reset","_pendingPageRequests","current","Promise","resolve","hasChangedData","JSON","stringify","_lastUsedSorting","_lastUsedFilters","_lastUsedSearch","data","cache","requestId","uuid","_temp2","_catch","_lastRequestId","then","response","length","setData","currentData","direction","getDirection","pages","nextPages","getPages","lastFetchedPage","_lastUsedHiddenColumns","nextCache","reduce","acc","p","Array","fill","undefined","rows","DATASET_SIZE","Object","values","concat","e","reject","React","useRef","useState","loadAll","_temp","_finallyRethrows","pageCount","Math","ceil","from","keys","forEach","index","push","startIndex","slice","_wasThrown","_result","invalidate","getCurrentPage","handleSort","handleFilter","handleSearch","onChangeFilter","onChangeSearch","onChangeSort","_experimentalDataLoader2","currentPages","middle","floor","lastUsedPageIndex","includes"],"mappings":";;;;;AAaA,MAAMA,uBAAuB,GAAG,EAAE;SAuClBC,mBAAmBA,CAC/BC,SAA0C,EAC1CC,QAAwC,EACxCC,UAAqC;EAAEC,QAAQ,EAAEC;CAAmB;QAmBrDC,QAAQ,aACnBC,SAAiB,EACjBC,OAA0B,EAC1BC,OAA4B,EAC5BC,aAAuB,EACvBC,MAA0B,EAC1BC,KAAK,GAAG,KAAK;IAAA;;MAGb,IAAIC,oBAAoB,CAACC,OAAO,CAACP,SAAS,CAAC,IAAI,CAACK,KAAK,EAAE;QACnD,OAAAG,OAAA,CAAAC,OAAA;;MAGJ,MAAMC,cAAc,GAChBC,IAAI,CAACC,SAAS,CAACX,OAAO,CAAC,KAAKU,IAAI,CAACC,SAAS,CAACC,gBAAgB,CAACN,OAAO,CAAC,IACpEI,IAAI,CAACC,SAAS,CAACV,OAAO,CAAC,KAAKS,IAAI,CAACC,SAAS,CAACE,gBAAgB,CAACP,OAAO,CAAC,IACpEH,MAAM,KAAKW,eAAe,CAACR,OAAO;;MAGtC,IAAIS,IAAI,CAACC,KAAK,CAACjB,SAAS,CAAC,IAAIgB,IAAI,CAACC,KAAK,CAACjB,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAACU,cAAc,IAAI,CAACL,KAAK,EAAE;QAChF,OAAAG,OAAA,CAAAC,OAAA;;;MAIJ,MAAMS,SAAS,GAAGC,EAAI,EAAE;;MAGxBb,oBAAoB,CAACC,OAAO,CAACP,SAAS,CAAC,GAAG,IAAI;MAAC,MAAAoB,MAAA,GAAAC,MAAA,aAE3C;QACAC,cAAc,CAACf,OAAO,GAAGW,SAAS;QAAC,OAAAV,OAAA,CAAAC,OAAA,CACZf,SAAS,CAACM,SAAS,EAAEH,QAAQ,EAAEI,OAAO,EAAEC,OAAO,EAAEC,aAAa,EAAEC,MAAM,CAAC,EAAAmB,IAAA,WAAxF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AC,GAAG,CAAC,IAChCA,YAAY,CAACnD,MAAM,KAAK,CAAC,IAAImD,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI5E,SAAS,KAAK4E,YAAY,CAAC,CAAC,CAAE,EACvF;MACE,OAAO,UAAU;;;EAIzB,OAAOnC,SAAS;AACpB;AAEA,SAAST,QAAQA,CAAChC,SAAiB,EAAE+E,iBAAqC,EAAEH,YAAsB,EAAEhD,SAAoB;EACpH,IAAIgD,YAAY,CAACnD,MAAM,KAAKzB,SAAS,KAAK+E,iBAAiB,IAAIH,YAAY,CAACI,QAAQ,CAAChF,SAAS,CAAC,CAAC,EAAE;IAC9F,OAAO4E,YAAY;;EAGvB,IAAIhD,SAAS,KAAK,SAAS,EAAE;IACzB,MAAMG,SAAS,GAAG6C,YAAY,CAACnD,MAAM,KAAKjC,uBAAuB,GAAGoF,YAAY,CAACZ,KAAK,CAAC,CAAC,CAAC,GAAGY,YAAY;IACxG,OAAO7C,SAAS,CAACe,MAAM,CAAC9C,SAAS,CAAC;;EAGtC,IAAI4B,SAAS,KAAK,UAAU,EAAE;IAC1B,MAAMG,SAAS,GAAG6C,YAAY,CAACnD,MAAM,KAAKjC,uBAAuB,GAAGoF,YAAY,CAACZ,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAGY,YAAY;IAC5G,OAAO,CAAC5E,SAAS,CAAC,CAAC8C,MAAM,CAACf,SAAS,CAAC;;EAGxC,OAAO,CAAC/B,SAAS,CAAC;AACtB;;;;"}
package/dist/index.css CHANGED
@@ -166,6 +166,14 @@
166
166
  @apply invisible;
167
167
  }
168
168
 
169
+ /*
170
+ * While the dialog is open, all elements are aria-hidden except for the dialog content. This ensures that the
171
+ * print document contains only the dialog content.
172
+ */
173
+ [aria-hidden='true'] {
174
+ @apply print:!hidden;
175
+ }
176
+
169
177
  .wcag-transparent {
170
178
  @apply bg-black/[0.08] text-black;
171
179
  }
@@ -580,7 +588,7 @@ table[data-taco^='table'] {
580
588
 
581
589
  table[data-taco^='table'] thead {
582
590
  /* z-indexes & layout */
583
- @apply sticky top-0 isolate z-20;
591
+ @apply sticky top-0 isolate z-20 print:static;
584
592
  /* grid */
585
593
  @apply col-span-full grid auto-rows-min grid-cols-[subgrid];
586
594
  }
@@ -619,7 +627,7 @@ table[data-taco^='table'] thead tr:not(:last-child) th:before {
619
627
 
620
628
  table[data-taco^='table'] tfoot {
621
629
  /* z-indexes & layout */
622
- @apply sticky bottom-0 isolate z-20;
630
+ @apply sticky bottom-0 isolate z-20 print:static;
623
631
  /* grid */
624
632
  @apply col-span-full grid grid-cols-[subgrid];
625
633
  }
@@ -1158,19 +1166,19 @@ table[data-taco^='table'][data-table-pause-hover='true'] > tbody > tr:hover[data
1158
1166
 
1159
1167
  /* row metadata */
1160
1168
  table[data-taco^='table'] tbody tr[data-row-meta-layout='heading']:not([data-row-group='true']) td {
1161
- @apply !border-b-0 border-t font-bold;
1169
+ @apply border-b-0 border-t font-bold;
1162
1170
  }
1163
1171
 
1164
1172
  table[data-taco^='table'] tbody tr[data-row-group='true'] + tr[data-row-meta-layout='heading'] td {
1165
- @apply !border-t-0;
1173
+ @apply border-t-0;
1166
1174
  }
1167
1175
 
1168
1176
  table[data-taco^='table'] tbody tr[data-row-meta-layout='summary']:not([data-row-group='true']) td {
1169
- @apply !border-b-0 font-bold;
1177
+ @apply border-b-0 font-bold;
1170
1178
  }
1171
1179
 
1172
1180
  table[data-taco^='table'] tbody tr[data-row-meta-layout='item']:not([data-row-group='true']) td {
1173
- @apply !border-b-0;
1181
+ @apply border-b-0;
1174
1182
  }
1175
1183
 
1176
1184
  /* rows */
@@ -1333,6 +1341,14 @@ table[data-taco='table3'][data-table-editing-mode] tbody tr[data-row-editing-mov
1333
1341
  @apply border-r-2 border-blue-500 pr-[calc(var(--table-cell-padding-x)_-_2px)];
1334
1342
  }
1335
1343
 
1344
+ table[data-taco^='table3'][data-table-editing-mode] [data-cell-align='center'] > label {
1345
+ @apply flex-row justify-center text-center;
1346
+ }
1347
+
1348
+ table[data-taco^='table3'][data-table-editing-mode] [data-cell-align='right'] > label {
1349
+ @apply flex-row justify-end text-right;
1350
+ }
1351
+
1336
1352
  /* invalid rows */
1337
1353
 
1338
1354
  table[data-taco='table3'] > tbody > tr[data-row-editing-invalid='true'] > td,
@@ -1409,3 +1425,8 @@ table[data-taco^='table'][data-table-row-height='tall'] tr[data-row-create] td,
1409
1425
  table[data-taco^='table'][data-table-row-height='extra-tall'] tr[data-row-create] td {
1410
1426
  @apply !min-h-[41px] !pt-[10px];
1411
1427
  }
1428
+
1429
+ /* Hiding CreateNewRow using CSS to ensure higher specificity for hiding the row */
1430
+ table[data-taco^='table'] tr[data-row-create] {
1431
+ @apply print:hidden;
1432
+ }