@economic/taco 2.46.9-alpha.1 → 2.47.0-server-1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. package/dist/components/AlertDialog/AlertDialog.d.ts +1 -2
  2. package/dist/components/AlertDialog/components/Content.d.ts +0 -2
  3. package/dist/components/Dialog/components/Content.d.ts +3 -3
  4. package/dist/components/Menu/components/Content.d.ts +1 -1
  5. package/dist/components/Menu/components/SubMenu.d.ts +1 -1
  6. package/dist/components/Popover/Popover.d.ts +1 -1
  7. package/dist/components/Report/Report.d.ts +1 -1
  8. package/dist/components/SearchInput2/SearchInput2.d.ts +2 -0
  9. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +1 -2
  10. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +1 -0
  11. package/dist/components/Table3/features/useEditingState.d.ts +11 -11
  12. package/dist/components/Table3/features/useTableEditing.d.ts +13 -13
  13. package/dist/components/Table3/util/editing.d.ts +3 -0
  14. package/dist/esm/index.css +2 -2
  15. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +17 -17
  16. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js +1 -2
  18. package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +2 -7
  20. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +1 -2
  22. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +0 -1
  24. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +6 -3
  27. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Select/Select.js +1 -2
  29. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +1 -1
  31. package/dist/esm/packages/taco/src/components/Table3/Table3.js +14 -4
  32. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +1 -1
  34. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +14 -9
  36. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +2 -4
  38. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
  39. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +5 -4
  40. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +32 -51
  42. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +5 -3
  44. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +15 -12
  46. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +9 -1
  48. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  49. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +2 -1
  50. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  51. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +4 -0
  52. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  53. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +7 -4
  54. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  55. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +7 -2
  56. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  57. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js +7 -5
  58. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js.map +1 -1
  59. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +24 -22
  60. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  61. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +41 -4
  62. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
  63. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +3 -1
  64. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  65. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +26 -3
  66. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  67. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js +1 -1
  68. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js.map +1 -1
  69. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +36 -9
  70. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  71. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js +1 -1
  72. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  73. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  74. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +5 -7
  75. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  76. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +1 -1
  77. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  78. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +2 -1
  79. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
  80. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -2
  81. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  82. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +4 -2
  83. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
  84. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js +3 -1
  85. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -1
  86. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +4 -4
  87. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
  88. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +14 -13
  89. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  90. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +7 -3
  91. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
  92. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +4 -4
  93. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  94. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +4 -1
  95. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
  96. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +7 -1
  97. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
  98. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +6 -0
  99. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  100. package/dist/hooks/useLazyDebouncedEffect.d.ts +2 -0
  101. package/dist/index.css +2 -2
  102. package/dist/primitives/Table/Core/Table.d.ts +1 -0
  103. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  104. package/dist/primitives/Table/Core/components/Row/Row.d.ts +2 -0
  105. package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +1 -1
  106. package/dist/primitives/Table/types.d.ts +11 -6
  107. package/dist/primitives/Table/useTableDataLoader2.d.ts +24 -0
  108. package/dist/primitives/Table/useTableManager/features/useTableRowExpansion.d.ts +2 -1
  109. package/dist/primitives/Table/useTableManager/features/useTableSearch.d.ts +4 -2
  110. package/dist/primitives/Table/useTableManager/features/useTableServerLoading.d.ts +3 -1
  111. package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +1 -2
  112. package/dist/primitives/Table/useTableManager/util/columns.d.ts +2 -1
  113. package/dist/taco.cjs.development.js +365 -240
  114. package/dist/taco.cjs.development.js.map +1 -1
  115. package/dist/taco.cjs.production.min.js +1 -1
  116. package/dist/taco.cjs.production.min.js.map +1 -1
  117. package/package.json +16 -17
@@ -3,7 +3,7 @@ import { Root } from '@radix-ui/react-alert-dialog';
3
3
  import { AlertDialogContext } from './Context.js';
4
4
  import { Trigger } from './components/Trigger.js';
5
5
  import { Cancel, Action, Footer } from './components/Footer.js';
6
- import { Content, Description, Title } from './components/Content.js';
6
+ import { Content, Title } from './components/Content.js';
7
7
 
8
8
  const AlertDialog = /*#__PURE__*/forwardRef(function AlertDialog(props, ref) {
9
9
  const {
@@ -28,7 +28,6 @@ const AlertDialog = /*#__PURE__*/forwardRef(function AlertDialog(props, ref) {
28
28
  });
29
29
  AlertDialog.Trigger = Trigger;
30
30
  AlertDialog.Content = Content;
31
- AlertDialog.Description = Description;
32
31
  AlertDialog.Title = Title;
33
32
  AlertDialog.Cancel = Cancel;
34
33
  AlertDialog.Action = Action;
@@ -1 +1 @@
1
- {"version":3,"file":"AlertDialog.js","sources":["../../../../../../../src/components/AlertDialog/AlertDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport { AlertDialogContext } from './Context';\nimport { Trigger, AlertDialogTriggerProps } from './components/Trigger';\nimport {\n Cancel,\n Action,\n Footer,\n AlertDialogCancelProps,\n AlertDialogActionProps,\n AlertDialogFooterProps,\n} from './components/Footer';\nimport {\n Title,\n Content,\n AlertDialogContentProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n Description,\n} from './components/Content';\n\nexport type AlertDialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** Set whether the alert dialog is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Called when the alert dialog opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n /** Control the open state of the dialog from outside the component */\n open?: boolean;\n /** A trigger to be used for the alert dialog, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n /** A state to be used for the alert dialog, which will add appropriate badge icon next to the title */\n variant?: 'warning' | 'error' | 'information';\n};\n\nexport type ForwardedAlertDialogWithStatics = React.ForwardRefExoticComponent<\n AlertDialogProps & React.RefAttributes<HTMLElement>\n> & {\n Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;\n Description: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;\n Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n Footer: React.ForwardRefExoticComponent<AlertDialogFooterProps & React.RefAttributes<HTMLDivElement>>;\n Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;\n Cancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;\n};\n\nexport const AlertDialog = React.forwardRef(function AlertDialog(props: AlertDialogProps, ref: React.Ref<HTMLElement>) {\n const { children: initialChildren, defaultOpen, onChange, open, trigger, ...otherProps } = props;\n\n const context = React.useMemo(\n () => ({\n props: otherProps,\n ref,\n }),\n [open, otherProps]\n );\n\n return (\n <AlertDialogContext.Provider value={context}>\n <AlertDialogPrimitive.Root {...props} defaultOpen={defaultOpen} open={open} onOpenChange={onChange}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {props.children}\n </AlertDialogPrimitive.Root>\n </AlertDialogContext.Provider>\n );\n}) as ForwardedAlertDialogWithStatics;\n\nAlertDialog.Trigger = Trigger;\nAlertDialog.Content = Content;\nAlertDialog.Description = Description;\nAlertDialog.Title = Title;\nAlertDialog.Cancel = Cancel;\nAlertDialog.Action = Action;\nAlertDialog.Footer = Footer;\n"],"names":["AlertDialog","React","props","ref","children","initialChildren","defaultOpen","onChange","open","trigger","otherProps","context","AlertDialogContext","Provider","value","AlertDialogPrimitive","onOpenChange","Trigger","Content","Description","Title","Cancel","Action","Footer"],"mappings":";;;;;;;MA+CaA,WAAW,gBAAGC,UAAgB,CAAC,SAASD,WAAWA,CAACE,KAAuB,EAAEC,GAA2B;EACjH,MAAM;IAAEC,QAAQ,EAAEC,eAAe;IAAEC,WAAW;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAEhG,MAAMS,OAAO,GAAGV,OAAa,CACzB,OAAO;IACHC,KAAK,EAAEQ,UAAU;IACjBP;GACH,CAAC,EACF,CAACK,IAAI,EAAEE,UAAU,CAAC,CACrB;EAED,oBACIT,cAACW,kBAAkB,CAACC,QAAQ;IAACC,KAAK,EAAEH;kBAChCV,cAACc,IAAyB,oBAAKb,KAAK;IAAEI,WAAW,EAAEA,WAAW;IAAEE,IAAI,EAAEA,IAAI;IAAEQ,YAAY,EAAET;MACrFE,OAAO,iBAAIR,cAACgB,OAAO,QAAER,OAAO,CAAW,EACvCP,KAAK,CAACE,QAAQ,CACS,CACF;AAEtC,CAAC;AAEDJ,WAAW,CAACiB,OAAO,GAAGA,OAAO;AAC7BjB,WAAW,CAACkB,OAAO,GAAGA,OAAO;AAC7BlB,WAAW,CAACmB,WAAW,GAAGA,WAAW;AACrCnB,WAAW,CAACoB,KAAK,GAAGA,KAAK;AACzBpB,WAAW,CAACqB,MAAM,GAAGA,MAAM;AAC3BrB,WAAW,CAACsB,MAAM,GAAGA,MAAM;AAC3BtB,WAAW,CAACuB,MAAM,GAAGA,MAAM;;;;"}
1
+ {"version":3,"file":"AlertDialog.js","sources":["../../../../../../../src/components/AlertDialog/AlertDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport { AlertDialogContext } from './Context';\nimport { Trigger, AlertDialogTriggerProps } from './components/Trigger';\nimport {\n Cancel,\n Action,\n Footer,\n AlertDialogCancelProps,\n AlertDialogActionProps,\n AlertDialogFooterProps,\n} from './components/Footer';\nimport { Title, Content, AlertDialogContentProps, AlertDialogTitleProps } from './components/Content';\n\nexport type AlertDialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** Set whether the alert dialog is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Called when the alert dialog opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n /** Control the open state of the dialog from outside the component */\n open?: boolean;\n /** A trigger to be used for the alert dialog, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n /** A state to be used for the alert dialog, which will add appropriate badge icon next to the title */\n variant?: 'warning' | 'error' | 'information';\n};\n\nexport type ForwardedAlertDialogWithStatics = React.ForwardRefExoticComponent<\n AlertDialogProps & React.RefAttributes<HTMLElement>\n> & {\n Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;\n Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n Footer: React.ForwardRefExoticComponent<AlertDialogFooterProps & React.RefAttributes<HTMLDivElement>>;\n Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;\n Cancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;\n};\n\nexport const AlertDialog = React.forwardRef(function AlertDialog(props: AlertDialogProps, ref: React.Ref<HTMLElement>) {\n const { children: initialChildren, defaultOpen, onChange, open, trigger, ...otherProps } = props;\n\n const context = React.useMemo(\n () => ({\n props: otherProps,\n ref,\n }),\n [open, otherProps]\n );\n\n return (\n <AlertDialogContext.Provider value={context}>\n <AlertDialogPrimitive.Root {...props} defaultOpen={defaultOpen} open={open} onOpenChange={onChange}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {props.children}\n </AlertDialogPrimitive.Root>\n </AlertDialogContext.Provider>\n );\n}) as ForwardedAlertDialogWithStatics;\n\nAlertDialog.Trigger = Trigger;\nAlertDialog.Content = Content;\nAlertDialog.Title = Title;\nAlertDialog.Cancel = Cancel;\nAlertDialog.Action = Action;\nAlertDialog.Footer = Footer;\n"],"names":["AlertDialog","React","props","ref","children","initialChildren","defaultOpen","onChange","open","trigger","otherProps","context","AlertDialogContext","Provider","value","AlertDialogPrimitive","onOpenChange","Trigger","Content","Title","Cancel","Action","Footer"],"mappings":";;;;;;;MAuCaA,WAAW,gBAAGC,UAAgB,CAAC,SAASD,WAAWA,CAACE,KAAuB,EAAEC,GAA2B;EACjH,MAAM;IAAEC,QAAQ,EAAEC,eAAe;IAAEC,WAAW;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAEhG,MAAMS,OAAO,GAAGV,OAAa,CACzB,OAAO;IACHC,KAAK,EAAEQ,UAAU;IACjBP;GACH,CAAC,EACF,CAACK,IAAI,EAAEE,UAAU,CAAC,CACrB;EAED,oBACIT,cAACW,kBAAkB,CAACC,QAAQ;IAACC,KAAK,EAAEH;kBAChCV,cAACc,IAAyB,oBAAKb,KAAK;IAAEI,WAAW,EAAEA,WAAW;IAAEE,IAAI,EAAEA,IAAI;IAAEQ,YAAY,EAAET;MACrFE,OAAO,iBAAIR,cAACgB,OAAO,QAAER,OAAO,CAAW,EACvCP,KAAK,CAACE,QAAQ,CACS,CACF;AAEtC,CAAC;AAEDJ,WAAW,CAACiB,OAAO,GAAGA,OAAO;AAC7BjB,WAAW,CAACkB,OAAO,GAAGA,OAAO;AAC7BlB,WAAW,CAACmB,KAAK,GAAGA,KAAK;AACzBnB,WAAW,CAACoB,MAAM,GAAGA,MAAM;AAC3BpB,WAAW,CAACqB,MAAM,GAAGA,MAAM;AAC3BrB,WAAW,CAACsB,MAAM,GAAGA,MAAM;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { forwardRef, createElement } from 'react';
2
2
  import cn from 'clsx';
3
3
  import { BadgeIcon } from '../../BadgeIcon/BadgeIcon.js';
4
- import { Title as Title$1, Description as Description$1, Portal, Overlay, Content as Content$1 } from '@radix-ui/react-alert-dialog';
4
+ import { Title as Title$1, Portal, Overlay, Content as Content$1 } from '@radix-ui/react-alert-dialog';
5
5
  import { useCurrentAlertDialog } from '../Context.js';
6
6
  import { Backdrop } from '../../Backdrop/Backdrop.js';
7
7
  import { getDialogPositionClassnames, getDialogStylingClassnames, getDialogSizeClassnames } from '../../Dialog/util.js';
@@ -39,11 +39,6 @@ const Title = /*#__PURE__*/forwardRef(function AlertDialogTitle(props, ref) {
39
39
  className: "mr-2"
40
40
  })) : undefined, props.children);
41
41
  });
42
- const Description = /*#__PURE__*/forwardRef(function AlertDialogDescription(props, ref) {
43
- return /*#__PURE__*/createElement(Description$1, Object.assign({
44
- ref: ref
45
- }, props));
46
- });
47
42
  const Content = /*#__PURE__*/forwardRef(function AlertDialogContent(props, ref) {
48
43
  const className = cn('p-6', getDialogPositionClassnames(), getDialogStylingClassnames(), getDialogSizeClassnames('dialog'));
49
44
  return /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(Overlay, {
@@ -55,5 +50,5 @@ const Content = /*#__PURE__*/forwardRef(function AlertDialogContent(props, ref)
55
50
  }), props.children))));
56
51
  });
57
52
 
58
- export { Content, Description, Title };
53
+ export { Content, Title };
59
54
  //# sourceMappingURL=Content.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/AlertDialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport cn from 'clsx';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { getDialogPositionClassnames, getDialogSizeClassnames, getDialogStylingClassnames } from '../../Dialog/util';\nimport { useCurrentAlertDialog } from '../Context';\nimport { BadgeIcon } from '../../BadgeIcon/BadgeIcon';\nimport { Color } from '../../../types';\nimport { IconName } from '../../Icon/components';\n\nconst iconPropsByVariant = (variant: 'information' | 'error' | 'warning'): { color: Color; icon: IconName } | undefined => {\n switch (variant) {\n case 'information':\n return {\n color: 'blue',\n icon: 'info',\n };\n case 'error':\n return {\n color: 'red',\n icon: 'close',\n };\n case 'warning':\n return {\n color: 'yellow',\n icon: 'warning',\n };\n default:\n return undefined;\n }\n};\n\nexport type AlertDialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function AlertDialogTitle(\n props: AlertDialogTitleProps,\n ref: React.Ref<HTMLHeadingElement>\n) {\n const { props: parentProps } = useCurrentAlertDialog();\n\n const iconProps = iconPropsByVariant(parentProps.variant);\n return (\n <AlertDialogPrimitive.Title {...props} className={cn('flex items-center', props.className)} ref={ref}>\n {iconProps ? <BadgeIcon {...iconProps} className=\"mr-2\" /> : undefined}\n {props.children}\n </AlertDialogPrimitive.Title>\n );\n});\n\nexport type AlertDialogDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\nexport const Description = React.forwardRef(function AlertDialogDescription(\n props: AlertDialogDescriptionProps,\n ref: React.Ref<HTMLParagraphElement>\n) {\n return <AlertDialogPrimitive.Description ref={ref} {...props} />;\n});\n\nexport type AlertDialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the dialog is opened */\n 'aria-label': string;\n children: React.ReactNode;\n};\nexport const Content = React.forwardRef(function AlertDialogContent(\n props: AlertDialogContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const className = cn('p-6', getDialogPositionClassnames(), getDialogStylingClassnames(), getDialogSizeClassnames('dialog'));\n\n return (\n <AlertDialogPrimitive.Portal>\n <AlertDialogPrimitive.Overlay asChild>\n <Backdrop>\n <AlertDialogPrimitive.Content\n {...props}\n ref={ref}\n className={className}\n onEscapeKeyDown={event => event.preventDefault()}>\n {props.children}\n </AlertDialogPrimitive.Content>\n </Backdrop>\n </AlertDialogPrimitive.Overlay>\n </AlertDialogPrimitive.Portal>\n );\n});\n"],"names":["iconPropsByVariant","variant","color","icon","undefined","Title","React","AlertDialogTitle","props","ref","parentProps","useCurrentAlertDialog","iconProps","AlertDialogPrimitive","className","cn","BadgeIcon","children","Description","AlertDialogDescription","Content","AlertDialogContent","getDialogPositionClassnames","getDialogStylingClassnames","getDialogSizeClassnames","asChild","Backdrop","onEscapeKeyDown","event","pre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A4B;IAACY,OAAO;kBACjCnB,cAACoB,QAAQ,qBACLpB,cAACO,SAA4B,oBACrBL,KAAK;IACTC,GAAG,EAAEA,GAAG;IACRK,SAAS,EAAEA,SAAS;IACpBa,eAAe,EAAEC,KAAK,IAAIA,KAAK,CAACC,cAAc;MAC7CrB,KAAK,CAACS,QAAQ,CACY,CACxB,CACgB,CACL;AAEtC,CAAC;;;;"}
1
+ {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/AlertDialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport cn from 'clsx';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { getDialogPositionClassnames, getDialogSizeClassnames, getDialogStylingClassnames } from '../../Dialog/util';\nimport { useCurrentAlertDialog } from '../Context';\nimport { BadgeIcon } from '../../BadgeIcon/BadgeIcon';\nimport { Color } from '../../../types';\nimport { IconName } from '../../Icon/components';\n\nconst iconPropsByVariant = (variant: 'information' | 'error' | 'warning'): { color: Color; icon: IconName } | undefined => {\n switch (variant) {\n case 'information':\n return {\n color: 'blue',\n icon: 'info',\n };\n case 'error':\n return {\n color: 'red',\n icon: 'close',\n };\n case 'warning':\n return {\n color: 'yellow',\n icon: 'warning',\n };\n default:\n return undefined;\n }\n};\n\nexport type AlertDialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function AlertDialogTitle(\n props: AlertDialogTitleProps,\n ref: React.Ref<HTMLHeadingElement>\n) {\n const { props: parentProps } = useCurrentAlertDialog();\n\n const iconProps = iconPropsByVariant(parentProps.variant);\n return (\n <AlertDialogPrimitive.Title {...props} className={cn('flex items-center', props.className)} ref={ref}>\n {iconProps ? <BadgeIcon {...iconProps} className=\"mr-2\" /> : undefined}\n {props.children}\n </AlertDialogPrimitive.Title>\n );\n});\n\nexport type AlertDialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the dialog is opened */\n 'aria-label': string;\n children: React.ReactNode;\n};\nexport const Content = React.forwardRef(function AlertDialogContent(\n props: AlertDialogContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const className = cn('p-6', getDialogPositionClassnames(), getDialogStylingClassnames(), getDialogSizeClassnames('dialog'));\n\n return (\n <AlertDialogPrimitive.Portal>\n <AlertDialogPrimitive.Overlay asChild>\n <Backdrop>\n <AlertDialogPrimitive.Content\n {...props}\n ref={ref}\n className={className}\n onEscapeKeyDown={event => event.preventDefault()}>\n {props.children}\n </AlertDialogPrimitive.Content>\n </Backdrop>\n </AlertDialogPrimitive.Overlay>\n </AlertDialogPrimitive.Portal>\n );\n});\n"],"names":["iconPropsByVariant","variant","color","icon","undefined","Title","React","AlertDialogTitle","props","ref","parentProps","useCurrentAlertDialog","iconProps","AlertDialogPrimitive","className","cn","BadgeIcon","children","Content","AlertDialogContent","getDialogPositionClassnames","getDialogStylingClassnames","getDialogSizeClassnames","asChild","Backdrop","onEscapeKeyDown","event","preventDefault"],"mappings":";;;;;;;;AAUA,MAAMA,kBAAkB,GAAIC,OAA4C;EACpE,QAAQA,OAAO;IACX,KAAK,aAAa;MACd,OAAO;QACHC,KAAK,EAAE,MAAM;QACbC,IAAI,EAAE;OACT;IACL,KAAK,OAAO;MACR,OAAO;QACHD,KAAK,EAAE,KAAK;QACZC,IAAI,EAAE;OACT;IACL,KAAK,SAAS;MACV,OAAO;QACHD,KAAK,EAAE,QAAQ;QACfC,IAAI,EAAE;OACT;IACL;MACI,OAAOC,SAAS;;AAE5B,CAAC;MAGYC,KAAK,gBAAGC,UAAgB,CAAC,SAASC,gBAAgBA,CAC3DC,KAA4B,EAC5BC,GAAkC;EAElC,MAAM;IAAED,KAAK,EAAEE;GAAa,GAAGC,qBAAqB,EAAE;EAEtD,MAAMC,SAAS,GAAGZ,kBAAkB,CAACU,WAAW,CAACT,OAAO,CAAC;EACzD,oBACIK,cAACO,OAA0B,oBAAKL,KAAK;IAAEM,SAAS,EAAEC,EAAE,CAAC,mBAAmB,EAAEP,KAAK,CAACM,SAAS,CAAC;IAAEL,GAAG,EAAEA;MAC5FG,SAAS,gBAAGN,cAACU,SAAS,oBAAKJ,SAAS;IAAEE,SAAS,EAAC;KAAS,GAAGV,SAAS,EACrEI,KAAK,CAACS,QAAQ,CACU;AAErC,CAAC;MAOYC,OAAO,gBAAGZ,UAAgB,CAAC,SAASa,kBAAkBA,CAC/DX,KAA8B,EAC9BC,GAA8B;EAE9B,MAAMK,SAAS,GAAGC,EAAE,CAAC,KAAK,EAAEK,2BAA2B,EAAE,EAAEC,0BAA0B,EAAE,EAAEC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;EAE3H,oBACIhB,cAACO,MAA2B,qBACxBP,cAACO,OAA4B;IAACU,OAAO;kBACjCjB,cAACkB,QAAQ,qBACLlB,cAACO,SAA4B,oBACrBL,KAAK;IACTC,GAAG,EAAEA,GAAG;IACRK,SAAS,EAAEA,SAAS;IACpBW,eAAe,EAAEC,KAAK,IAAIA,KAAK,CAACC,cAAc;MAC7CnB,KAAK,CAACS,QAAQ,CACY,CACxB,CACgB,CACL;AAEtC,CAAC;;;;"}
@@ -10,7 +10,7 @@ import { useCurrentDialog } from '../Context.js';
10
10
  import { useDraggable } from '../../../utils/hooks/useDraggable.js';
11
11
 
12
12
  const Title = /*#__PURE__*/forwardRef(function DialogTitle(props, ref) {
13
- const className = cn(!props.asChild ? 'text-center' : '', props.className);
13
+ const className = cn('text-center', props.className);
14
14
  return /*#__PURE__*/createElement(Title$1, Object.assign({}, props, {
15
15
  className: className,
16
16
  ref: ref
@@ -83,7 +83,6 @@ const Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
83
83
  return /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(Overlay, {
84
84
  asChild: true
85
85
  }, /*#__PURE__*/createElement(Backdrop, null, /*#__PURE__*/createElement(Content$1, Object.assign({}, props, {
86
- "aria-describedby": undefined,
87
86
  className: className,
88
87
  onEscapeKeyDown: handleEscapeKeyDown,
89
88
  onInteractOutside: handleInteractOutside,
@@ -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.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\n\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn(!props.asChild ? '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 print:overflow-visible print:h-full',\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 => 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 aria-describedby={undefined}\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 {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 </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","asChild","DialogPrimitive","Footer","DialogFooter","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","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","undefined","onEscapeKeyDown","onInteractOutside","style","left","draggable","x","top","y","role","drag","showCloseButton","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;MAoBaA,KAAK,gBAAGC,UAAgB,CAAC,SAASC,WAAWA,CAACC,KAAuB,EAAEC,GAAkC;EAClH,MAAMC,SAAS,GAAGC,EAAE,CAAC,CAACH,KAAK,CAACI,OAAO,GAAG,aAAa,GAAG,EAAE,EAAEJ,KAAK,CAACE,SAAS,CAAC;EAC1E,oBAAOJ,cAACO,OAAqB,oBAAKL,KAAK;IAAEE,SAAS,EAAEA,SAAS;IAAED,GAAG,EAAEA;KAAO;AAC/E,CAAC;MAGYK,MAAM,gBA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C,IAAI,GAAGR;;mBAEhD9C;IAAKI,SAAS,EAAE+B,kBAAkB;iBAAY;KACzCQ,MAAM,EACN9B,MAAM,CAACsC,SAAS,kBACbnD,uCACQ4B,eAAe;IACnB2B,IAAI,EAAC,QAAQ;IACbJ,SAAS;oBACKzB,QAAQ;kBACVI,KAAK,CAACjB,MAAM,CAAC2C,IAAI;IAC7BpD,SAAS,EAAC;KACZ,CACL,EACAS,MAAM,CAAC4C,eAAe,iBACnBzD,cAACO,OAAqB;IAACQ,OAAO,EAAEF,MAAM,CAACG,OAAO;IAAEV,OAAO;kBACnDN,cAAC0D,UAAU;IACPC,UAAU,EAAC,UAAU;kBACT7B,KAAK,CAACjB,MAAM,CAACM,KAAK;IAC9Bf,SAAS,EAAC,+CAA+C;IACzDwD,IAAI,EAAC;IACP,CACkB,IACxB,IAAI,CACN,EACL/C,MAAM,CAACuB,QAAQ,CAACQ,MAAM,EACtB/B,MAAM,CAACuB,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',\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 print:overflow-visible print:h-full',\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 => 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 {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 </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,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AACO,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;KACzCQ,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,CACN,EACLhD,MAAM,CAACwB,QAAQ,CAACQ,MAAM,EACtBhC,MAAM,CAACwB,QAAQ,CAACC,KAAK,CACA,CACnB,CACW,CACL;AAEjC,CAAC;;;;"}
@@ -299,7 +299,6 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
299
299
  return focusTrap ? (/*#__PURE__*/React__default.createElement(Content$1, Object.assign({
300
300
  forceMount: true
301
301
  }, otherProps, {
302
- "aria-describedby": undefined,
303
302
  className: contentClassName,
304
303
  onEscapeKeyDown: handleEscapeKeyDown,
305
304
  onInteractOutside: variant === 'overlay' ? undefined : event => event.preventDefault(),
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Drawer/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Group, GroupProps } from '../../Group/Group';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { useLocalization } from '../../Provider/Localization';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDrawer } from '../Context';\nimport {\n getBackdropClassNames,\n getDrawerContainerClassNames,\n getDrawerContentClassNames,\n getDrawerDragHandlerClassNames,\n} from '../util';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { FocusScope } from '@react-aria/focus';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\n\nconst RESIZE_MIN = 360;\nconst RESIZE_MAX = 1000;\n\nexport type DrawerContentRenderProps = {\n close: () => void;\n};\n\nexport enum DrawerAnimationDefinition {\n Visible = 'visible',\n Hidden = 'hidden',\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 DrawerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DrawerTitle(props: DrawerTitleProps, externalRef: React.Ref<HTMLHeadingElement>) {\n const { className, children, ...otherProps } = props;\n const ref = useMergedRef<HTMLHeadingElement>(externalRef);\n const [style, setStyle] = React.useState({});\n const { texts } = useLocalization();\n const { onClickBack } = useCurrentDrawer();\n\n /**\n * By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,\n * where we might want to hide the grey separator. For this reason separator was rendered with using of classNames,\n * so it can be easily overriden in exceptional scenarios.\n * */\n const cName = cn('grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-grey-300 flex items-start', className);\n\n React.useEffect(() => {\n const drawer = ref?.current?.closest('[data-taco=\"drawer\"]');\n\n // This is the margin amount that we need to deduct from the margins to align with the design\n const marginAdjust = 4;\n\n const closeButton: HTMLButtonElement | null = drawer?.querySelector(`[aria-label=\"${texts.drawer.close}\"]`) ?? null;\n const closeButtonWidth = closeButton?.offsetWidth ?? 0;\n const closeButtonRightMargin = 8;\n\n const actionsWrapper: HTMLSpanElement | null = drawer?.querySelector(`#taco-drawer-actions[data-taco=\"group\"]`) ?? null;\n const actionsWrapperWidth = actionsWrapper?.offsetWidth ?? 0;\n const actionsWrapperRightMargin = 8;\n\n const marginRight =\n closeButtonWidth + actionsWrapperWidth + closeButtonRightMargin + actionsWrapperRightMargin - marginAdjust;\n\n setStyle({ marginRight });\n }, [ref, texts.drawer.close]);\n\n return (\n <DialogPrimitive.Title className={cName} {...otherProps} ref={ref}>\n {onClickBack ? (\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.back}\n className=\"mr-3 text-base\"\n icon=\"chevron-left\"\n onClick={onClickBack}\n />\n ) : null}\n {\n // We need to apply the right margin as an inline style instead of using Tailwind CSS.\n // This is necessary because we are creating styles dynamically at runtime,\n // and Tailwind doesn't support generating runtime styles.\n }\n <span className=\"line-clamp-2 inline-block overflow-y-hidden\" style={style}>\n {children}\n </span>\n </DialogPrimitive.Title>\n );\n});\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DrawerFooter(props: DrawerFooterProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n /**\n * The same scenario as Title, grey separator rendered using classNames to have posibility to override it.\n */\n const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-grey-300', props.className);\n return <div {...otherProps} className={cName} ref={ref} />;\n});\n\nexport const Actions = React.forwardRef(function Actions(props: GroupProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);\n // Id is added to identify the actions wrapper inside a useEffect in Dialog.Title\n return <Group {...otherProps} className={cName} id=\"taco-drawer-actions\" ref={ref} />;\n});\n\nexport type DrawerCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nexport const Close = React.forwardRef(function DrawerClose(props: DrawerCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const { onClose } = useCurrentDrawer();\n\n return <DialogPrimitive.Close {...props} onClick={onClose} ref={ref} asChild />;\n});\n\n/**\n * It is container component, needed to provide default scrolling behaviour and padding, to simplyfy usage, requested by feature devs.\n * It is optional to use InnerContent component, if consumer need to implement custom behaviour or paddings for inner content,\n * then it's simply enough to render children and wrap them in custom implementation.\n */\nexport type DrawerInnerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * Consumer might want to use innerContent component to apply default paddings, but want to implement custom scrolling behaviour,\n * default value - true\n */\n isScrollable?: boolean;\n};\nexport const InnerContent = React.forwardRef(function InnerContent(\n props: DrawerInnerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { className, isScrollable = true, children, ...otherProps } = props;\n const cName = cn(\n 'grow flex flex-col',\n {\n 'overflow-y-hidden': isScrollable,\n 'p-4': !isScrollable,\n },\n className\n );\n return (\n <div {...otherProps} className={cName} ref={ref}>\n {isScrollable ? <ScrollArea className=\"w-full gap-y-0.5 p-4\">{children}</ScrollArea> : children}\n </div>\n );\n});\n\nconst Portal = (props: DialogPrimitive.DialogPortalProps) => {\n const { children, ...otherProps } = props;\n const { open = false, variant, outlet } = useCurrentDrawer();\n\n const backdropClassNames = React.useMemo(() => {\n return getBackdropClassNames(open);\n }, [open]);\n\n if (!outlet) {\n return null;\n }\n\n return (\n <DialogPrimitive.Portal {...otherProps} container={outlet ?? undefined}>\n {variant === 'overlay' ? (\n <DialogPrimitive.Overlay forceMount>\n {/* Animate backdrop appearance for overlay version of Drawer */}\n <Backdrop className={backdropClassNames} />\n </DialogPrimitive.Overlay>\n ) : null}\n {children}\n </DialogPrimitive.Portal>\n );\n};\n\ntype UntrappedFocusDrawerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n onEscape: (event: KeyboardEvent) => void;\n};\nconst UntrappedFocusDrawerContent = React.forwardRef(function EmbeddedDrawerContent(\n props: UntrappedFocusDrawerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { onEscape, children, ...otherProps } = props;\n\n useGlobalKeyDown('Escape', onEscape);\n\n return (\n <div {...otherProps} ref={ref}>\n <FocusScope autoFocus={true} restoreFocus={true}>\n {children}\n </FocusScope>\n </div>\n );\n});\n\nexport type DrawerContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the side drawer is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DrawerContentRenderProps) => JSX.Element);\n};\nexport const DrawerContent = React.forwardRef(function Content(\n props: DrawerContentProps,\n externalRef: React.Ref<HTMLDivElement>\n) {\n const {\n size,\n onClose,\n onResize,\n open = false,\n closeOnEscape,\n variant,\n focusTrap,\n showCloseButton,\n setOpen,\n } = useCurrentDrawer();\n\n const { className, style, children, ...otherProps } = props;\n const { texts } = useLocalization();\n const ref = useMergedRef<HTMLDivElement>(externalRef);\n\n // if the drawer was opened by a menu, we need to close the menu when the drawer closes\n // the menu is still open (and mounted) because it is the trigger for the drawer\n const menu = useCurrentMenu();\n let handleCloseAutoFocus: DialogPrimitive.DialogContentProps['onCloseAutoFocus'];\n\n if (menu) {\n handleCloseAutoFocus = () => {\n menu.close();\n };\n }\n\n const containerClassName: string = React.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);\n\n const { contentClassName, dragHandlerClassName } = React.useMemo(() => {\n const contentClassName = getDrawerContentClassNames(size, variant, open);\n const dragHandlerClassName: string = getDrawerDragHandlerClassNames();\n return { contentClassName, dragHandlerClassName };\n }, [size, variant, open]);\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n const isTargetInsideDrawerContent = ref.current?.contains(event.target as HTMLElement);\n if (isTargetInsideDrawerContent) {\n if (!closeOnEscape) {\n event.preventDefault();\n } else {\n setOpen && setOpen(false);\n if (onClose) {\n onClose();\n }\n }\n }\n };\n\n const [containerWidth, setContainerWidth] = React.useState<number>();\n\n const dragHandlerRef = React.useRef<HTMLDivElement>(null);\n const {\n position,\n dragging,\n handleProps: dragHandleProps,\n resetPosition,\n } = useDraggable(useMergedRef<HTMLDivElement>(dragHandlerRef));\n\n const contentRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (onResize) {\n onResize(position.x);\n }\n }, [position]);\n\n React.useEffect(() => {\n setContainerWidth(contentRef.current?.offsetWidth);\n }, [contentRef, open]);\n\n const resizedWidth = React.useMemo((): number | undefined => {\n if (containerWidth) {\n return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));\n }\n return;\n }, [containerWidth, position]);\n\n React.useEffect(() => {\n if (!dragging && resizedWidth) {\n setContainerWidth(resizedWidth);\n resetPosition();\n }\n }, [dragging]);\n\n let output;\n\n if (typeof children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper>{children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = children;\n }\n\n const content = (\n <div ref={contentRef} data-taco=\"drawer\" className={containerClassName}>\n {output}\n <div className={dragHandlerClassName} {...dragHandleProps} data-testid=\"resize-handler\" ref={dragHandlerRef}>\n {dragging ? <div data-testid=\"resize-hit-area\" className=\"fixed bottom-0 left-0 right-0 top-0\" /> : null}\n </div>\n {showCloseButton ? (\n <Close>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.close}\n className=\"absolute right-0 top-0 mr-2 mt-4\"\n icon=\"close\"\n />\n </Close>\n ) : null}\n </div>\n );\n\n const styleProp = {\n ...style,\n ...{ width: resizedWidth },\n };\n\n return focusTrap ? (\n <DialogPrimitive.Content\n forceMount\n {...otherProps}\n aria-describedby={undefined}\n className={contentClassName}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={variant === 'overlay' ? undefined : event => event.preventDefault()}\n onCloseAutoFocus={handleCloseAutoFocus}\n ref={ref}\n style={styleProp}>\n {content}\n </DialogPrimitive.Content>\n ) : (\n <UntrappedFocusDrawerContent onEscape={handleEscapeKeyDown} className={contentClassName} style={styleProp} ref={ref}>\n {content}\n </UntrappedFocusDrawerContent>\n );\n});\n\nexport const Content = React.forwardRef(function Content(props: DrawerContentProps, externalRef: React.Ref<HTMLDivElement>) {\n const { children } = props;\n\n return (\n <Portal>\n <DrawerContent {...props} ref={externalRef}>\n {children}\n </DrawerContent>\n </Portal>\n );\n});\n"],"names":["RESIZE_MIN","RESIZE_MAX","DrawerAnimationDefinition","RenderPropWrapper","React","forwardRef","children","onClick","renderProps","ref","close","CustomEvent","Title","DrawerTitle","props","externalRef","className","otherProps","useMergedRef","style","setStyle","useState","texts","useLocalization","onClickBack","useCurrentDrawer","cName","cn","useEffect","drawer","_ref$current","current","closest","marginAdjust","closeButton","_drawer$querySelector","querySelector","closeButtonWidth","_closeButton$offsetWi","offsetWidth","closeButtonRightMargin","actionsWrapper","_drawer$querySelector2","actionsWrapperWidth","_actionsWrapper$offse","actionsWrapperRightMargin","marginRight","DialogPrimitive","IconButton","appearance","back","icon","Footer","DrawerFooter","Actions","Group","id","Close","DrawerClose","onClose","asChild","InnerContent","isScrollable","ScrollArea","Portal","open","variant","outlet","backdropClassNames","useMemo","getBackdropClassNames","container","undefined","forceMount","Backdrop","UntrappedFocusDrawerContent","EmbeddedDrawerContent","onEscape","useGlobalKeyDown","FocusScope","autoFocus","restoreFocus","DrawerContent","Content","size","onResize","closeOnEscape","focusTrap","showCloseButton","setOpen","menu","useCurrentMenu","handleCloseAutoFocus","containerClassName","getDrawerContainerClassNames","contentClassName","dragHandlerClassName","getDrawerContentClassNames","getDrawerDragHandlerClassNames","handleEscapeKeyDown","event","isTargetInsideDrawerContent","_ref$current2","contains","target","preventDefault","containerWidth","setContainerWidth","dragHandlerRef","useRef","position","dragging","handleProps","dragHandleProps","resetPosition","useDraggable","contentRef","x","_contentRef$current","resizedWidth","Math","min","max","output","content","styleProp","width","onEscapeKeyDown","onInteractOutside","onCloseAutoFocus"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAMA,UAAU,GAAG,GAAG;AACtB,MAAMC,UAAU,GAAG,IAAI;IAMXC;AAAZ,WAAYA,yBAAyB;EACjCA,gDAAmB;EACnBA,8CAAiB;AACrB,CAAC,EAHWA,yBAAyB,KAAzBA,yBAAyB;AAKrC,MAAMC,iBAAiB,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,iBAAiBA,CAAC;EAAEG,QAAQ;EAAEC,OAAO;EAAEC;CAAkB,EAAEC,GAAG;EAC9G,MAAMC,KAAK,GAAGA;IACVH,OAAO,CAAC,IAAII,WAAW,CAAC,OAAO,CAAC,CAAC;GACpC;EAED,OAAOL,QAAQ,CAAC;IAAEI,KAAK;IAAED,GAAG;IAAE,GAAGD;GAAa,CAAC;AACnD,CAAC,CAAC;MAGWI,KAAK,gBAAGR,cAAK,CAACC,UAAU,CAAC,SAASQ,WAAWA,CAACC,KAAuB,EAAEC,WAA0C;EAC1H,MAAM;IAAEC,SAAS;IAAEV,QAAQ;IAAE,GAAGW;GAAY,GAAGH,KAAK;EACpD,MAAML,GAAG,GAAGS,YAAY,CAAqBH,WAAW,CAAC;EACzD,MAAM,CAACI,KAAK,EAAEC,QAAQ,CAAC,GAAGhB,cAAK,CAACiB,QAAQ,CAAC,EAAE,CAAC;EAC5C,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAa,GAAGC,gBAAgB,EAAE;;;;;;EAO1C,MAAMC,KAAK,GAAGC,EAAE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f;EAED,OAAOhC,SAAS,iBACZnF,6BAAC2C,SAAuB;IACpB0B,UAAU;KACNxD,UAAU;wBACIuD,SAAS;IAC3BxD,SAAS,EAAE+E,gBAAgB;IAC3BgC,eAAe,EAAE5B,mBAAmB;IACpC6B,iBAAiB,EAAE9D,OAAO,KAAK,SAAS,GAAGM,SAAS,GAAG4B,KAAK,IAAIA,KAAK,CAACK,cAAc,EAAE;IACtFwB,gBAAgB,EAAErC,oBAAoB;IACtCnF,GAAG,EAAEA,GAAG;IACRU,KAAK,EAAE0G;MACND,OAAO,CACc,kBAE1BxH,6BAACuE,2BAA2B;IAACE,QAAQ,EAAEsB,mBAAmB;IAAEnF,SAAS,EAAE+E,gBAAgB;IAAE5E,KAAK,EAAE0G,SAAS;IAAEpH,GAAG,EAAEA;KAC3GmH,OAAO,CACkB,CACjC;AACL,CAAC;MAEYzC,OAAO,gBAAG/E,cAAK,CAACC,UAAU,CAAC,SAAS8E,OAAOA,CAACrE,KAAyB,EAAEC,WAAsC;EACtH,MAAM;IAAET;GAAU,GAAGQ,KAAK;EAE1B,oBACIV,6BAAC4D,MAAM,qBACH5D,6BAAC8E,aAAa,oBAAKpE,KAAK;IAAEL,GAAG,EAAEM;MAC1BT,QAAQ,CACG,CACX;AAEjB,CAAC;;;;"}
1
+ {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Drawer/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Group, GroupProps } from '../../Group/Group';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { useLocalization } from '../../Provider/Localization';\nimport { Backdrop } from '../../Backdrop/Backdrop';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDrawer } from '../Context';\nimport {\n getBackdropClassNames,\n getDrawerContainerClassNames,\n getDrawerContentClassNames,\n getDrawerDragHandlerClassNames,\n} from '../util';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { FocusScope } from '@react-aria/focus';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\n\nconst RESIZE_MIN = 360;\nconst RESIZE_MAX = 1000;\n\nexport type DrawerContentRenderProps = {\n close: () => void;\n};\n\nexport enum DrawerAnimationDefinition {\n Visible = 'visible',\n Hidden = 'hidden',\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 DrawerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DrawerTitle(props: DrawerTitleProps, externalRef: React.Ref<HTMLHeadingElement>) {\n const { className, children, ...otherProps } = props;\n const ref = useMergedRef<HTMLHeadingElement>(externalRef);\n const [style, setStyle] = React.useState({});\n const { texts } = useLocalization();\n const { onClickBack } = useCurrentDrawer();\n\n /**\n * By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,\n * where we might want to hide the grey separator. For this reason separator was rendered with using of classNames,\n * so it can be easily overriden in exceptional scenarios.\n * */\n const cName = cn('grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-grey-300 flex items-start', className);\n\n React.useEffect(() => {\n const drawer = ref?.current?.closest('[data-taco=\"drawer\"]');\n\n // This is the margin amount that we need to deduct from the margins to align with the design\n const marginAdjust = 4;\n\n const closeButton: HTMLButtonElement | null = drawer?.querySelector(`[aria-label=\"${texts.drawer.close}\"]`) ?? null;\n const closeButtonWidth = closeButton?.offsetWidth ?? 0;\n const closeButtonRightMargin = 8;\n\n const actionsWrapper: HTMLSpanElement | null = drawer?.querySelector(`#taco-drawer-actions[data-taco=\"group\"]`) ?? null;\n const actionsWrapperWidth = actionsWrapper?.offsetWidth ?? 0;\n const actionsWrapperRightMargin = 8;\n\n const marginRight =\n closeButtonWidth + actionsWrapperWidth + closeButtonRightMargin + actionsWrapperRightMargin - marginAdjust;\n\n setStyle({ marginRight });\n }, [ref, texts.drawer.close]);\n\n return (\n <DialogPrimitive.Title className={cName} {...otherProps} ref={ref}>\n {onClickBack ? (\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.back}\n className=\"mr-3 text-base\"\n icon=\"chevron-left\"\n onClick={onClickBack}\n />\n ) : null}\n {\n // We need to apply the right margin as an inline style instead of using Tailwind CSS.\n // This is necessary because we are creating styles dynamically at runtime,\n // and Tailwind doesn't support generating runtime styles.\n }\n <span className=\"line-clamp-2 inline-block overflow-y-hidden\" style={style}>\n {children}\n </span>\n </DialogPrimitive.Title>\n );\n});\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DrawerFooter(props: DrawerFooterProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n /**\n * The same scenario as Title, grey separator rendered using classNames to have posibility to override it.\n */\n const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-grey-300', props.className);\n return <div {...otherProps} className={cName} ref={ref} />;\n});\n\nexport const Actions = React.forwardRef(function Actions(props: GroupProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);\n // Id is added to identify the actions wrapper inside a useEffect in Dialog.Title\n return <Group {...otherProps} className={cName} id=\"taco-drawer-actions\" ref={ref} />;\n});\n\nexport type DrawerCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nexport const Close = React.forwardRef(function DrawerClose(props: DrawerCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const { onClose } = useCurrentDrawer();\n\n return <DialogPrimitive.Close {...props} onClick={onClose} ref={ref} asChild />;\n});\n\n/**\n * It is container component, needed to provide default scrolling behaviour and padding, to simplyfy usage, requested by feature devs.\n * It is optional to use InnerContent component, if consumer need to implement custom behaviour or paddings for inner content,\n * then it's simply enough to render children and wrap them in custom implementation.\n */\nexport type DrawerInnerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * Consumer might want to use innerContent component to apply default paddings, but want to implement custom scrolling behaviour,\n * default value - true\n */\n isScrollable?: boolean;\n};\nexport const InnerContent = React.forwardRef(function InnerContent(\n props: DrawerInnerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { className, isScrollable = true, children, ...otherProps } = props;\n const cName = cn(\n 'grow flex flex-col',\n {\n 'overflow-y-hidden': isScrollable,\n 'p-4': !isScrollable,\n },\n className\n );\n return (\n <div {...otherProps} className={cName} ref={ref}>\n {isScrollable ? <ScrollArea className=\"w-full gap-y-0.5 p-4\">{children}</ScrollArea> : children}\n </div>\n );\n});\n\nconst Portal = (props: DialogPrimitive.DialogPortalProps) => {\n const { children, ...otherProps } = props;\n const { open = false, variant, outlet } = useCurrentDrawer();\n\n const backdropClassNames = React.useMemo(() => {\n return getBackdropClassNames(open);\n }, [open]);\n\n if (!outlet) {\n return null;\n }\n\n return (\n <DialogPrimitive.Portal {...otherProps} container={outlet ?? undefined}>\n {variant === 'overlay' ? (\n <DialogPrimitive.Overlay forceMount>\n {/* Animate backdrop appearance for overlay version of Drawer */}\n <Backdrop className={backdropClassNames} />\n </DialogPrimitive.Overlay>\n ) : null}\n {children}\n </DialogPrimitive.Portal>\n );\n};\n\ntype UntrappedFocusDrawerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n onEscape: (event: KeyboardEvent) => void;\n};\nconst UntrappedFocusDrawerContent = React.forwardRef(function EmbeddedDrawerContent(\n props: UntrappedFocusDrawerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { onEscape, children, ...otherProps } = props;\n\n useGlobalKeyDown('Escape', onEscape);\n\n return (\n <div {...otherProps} ref={ref}>\n <FocusScope autoFocus={true} restoreFocus={true}>\n {children}\n </FocusScope>\n </div>\n );\n});\n\nexport type DrawerContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the side drawer is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DrawerContentRenderProps) => JSX.Element);\n};\nexport const DrawerContent = React.forwardRef(function Content(\n props: DrawerContentProps,\n externalRef: React.Ref<HTMLDivElement>\n) {\n const {\n size,\n onClose,\n onResize,\n open = false,\n closeOnEscape,\n variant,\n focusTrap,\n showCloseButton,\n setOpen,\n } = useCurrentDrawer();\n const { className, style, children, ...otherProps } = props;\n const { texts } = useLocalization();\n const ref = useMergedRef<HTMLDivElement>(externalRef);\n\n // if the drawer was opened by a menu, we need to close the menu when the drawer closes\n // the menu is still open (and mounted) because it is the trigger for the drawer\n const menu = useCurrentMenu();\n let handleCloseAutoFocus: DialogPrimitive.DialogContentProps['onCloseAutoFocus'];\n\n if (menu) {\n handleCloseAutoFocus = () => {\n menu.close();\n };\n }\n\n const containerClassName: string = React.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);\n\n const { contentClassName, dragHandlerClassName } = React.useMemo(() => {\n const contentClassName = getDrawerContentClassNames(size, variant, open);\n const dragHandlerClassName: string = getDrawerDragHandlerClassNames();\n return { contentClassName, dragHandlerClassName };\n }, [size, variant, open]);\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n const isTargetInsideDrawerContent = ref.current?.contains(event.target as HTMLElement);\n if (isTargetInsideDrawerContent) {\n if (!closeOnEscape) {\n event.preventDefault();\n } else {\n setOpen && setOpen(false);\n if (onClose) {\n onClose();\n }\n }\n }\n };\n\n const [containerWidth, setContainerWidth] = React.useState<number>();\n\n const dragHandlerRef = React.useRef<HTMLDivElement>(null);\n const {\n position,\n dragging,\n handleProps: dragHandleProps,\n resetPosition,\n } = useDraggable(useMergedRef<HTMLDivElement>(dragHandlerRef));\n\n const contentRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (onResize) {\n onResize(position.x);\n }\n }, [position]);\n\n React.useEffect(() => {\n setContainerWidth(contentRef.current?.offsetWidth);\n }, [contentRef, open]);\n\n const resizedWidth = React.useMemo((): number | undefined => {\n if (containerWidth) {\n return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));\n }\n return;\n }, [containerWidth, position]);\n\n React.useEffect(() => {\n if (!dragging && resizedWidth) {\n setContainerWidth(resizedWidth);\n resetPosition();\n }\n }, [dragging]);\n\n let output;\n\n if (typeof children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper>{children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = children;\n }\n\n const content = (\n <div ref={contentRef} data-taco=\"drawer\" className={containerClassName}>\n {output}\n <div className={dragHandlerClassName} {...dragHandleProps} data-testid=\"resize-handler\" ref={dragHandlerRef}>\n {dragging ? <div data-testid=\"resize-hit-area\" className=\"fixed bottom-0 left-0 right-0 top-0\" /> : null}\n </div>\n {showCloseButton ? (\n <Close>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.close}\n className=\"absolute right-0 top-0 mr-2 mt-4\"\n icon=\"close\"\n />\n </Close>\n ) : null}\n </div>\n );\n\n const styleProp = {\n ...style,\n ...{ width: resizedWidth },\n };\n\n return focusTrap ? (\n <DialogPrimitive.Content\n forceMount\n {...otherProps}\n className={contentClassName}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={variant === 'overlay' ? undefined : event => event.preventDefault()}\n onCloseAutoFocus={handleCloseAutoFocus}\n ref={ref}\n style={styleProp}>\n {content}\n </DialogPrimitive.Content>\n ) : (\n <UntrappedFocusDrawerContent onEscape={handleEscapeKeyDown} className={contentClassName} style={styleProp} ref={ref}>\n {content}\n </UntrappedFocusDrawerContent>\n );\n});\n\nexport const Content = React.forwardRef(function Content(props: DrawerContentProps, externalRef: React.Ref<HTMLDivElement>) {\n const { children } = props;\n\n return (\n <Portal>\n <DrawerContent {...props} ref={externalRef}>\n {children}\n </DrawerContent>\n </Portal>\n );\n});\n"],"names":["RESIZE_MIN","RESIZE_MAX","DrawerAnimationDefinition","RenderPropWrapper","React","forwardRef","children","onClick","renderProps","ref","close","CustomEvent","Title","DrawerTitle","props","externalRef","className","otherProps","useMergedRef","style","setStyle","useState","texts","useLocalization","onClickBack","useCurrentDrawer","cName","cn","useEffect","drawer","_ref$current","current","closest","marginAdjust","closeButton","_drawer$querySelector","querySelector","closeButtonWidth","_closeButton$offsetWi","offsetWidth","closeButtonRightMargin","actionsWrapper","_drawer$querySelector2","actionsWrapperWidth","_actionsWrapper$offse","actionsWrapperRightMargin","marginRight","DialogPrimitive","IconButton","appearance","back","icon","Footer","DrawerFooter","Actions","Group","id","Close","DrawerClose","onClose","asChild","InnerContent","isScrollable","ScrollArea","Portal","open","variant","outlet","backdropClassNames","useMemo","getBackdropClassNames","container","undefined","forceMount","Backdrop","UntrappedFocusDrawerContent","EmbeddedDrawerContent","onEscape","useGlobalKeyDown","FocusScope","autoFocus","restoreFocus","DrawerContent","Content","size","onResize","closeOnEscape","focusTrap","showCloseButton","setOpen","menu","useCurrentMenu","handleCloseAutoFocus","containerClassName","getDrawerContainerClassNames","contentClassName","dragHandlerClassName","getDrawerContentClassNames","getDrawerDragHandlerClassNames","handleEscapeKeyDown","event","isTargetInsideDrawerContent","_ref$current2","contains","target","preventDefault","containerWidth","setContainerWidth","dragHandlerRef","useRef","position","dragging","handleProps","dragHandleProps","resetPosition","useDraggable","contentRef","x","_contentRef$current","resizedWidth","Math","min","max","output","content","styleProp","width","onEscapeKeyDown","onInteractOutside","onCloseAutoFocus"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAMA,UAAU,GAAG,GAAG;AACtB,MAAMC,UAAU,GAAG,IAAI;IAMXC;AAAZ,WAAYA,yBAAyB;EACjCA,gDAAmB;EACnBA,8CAAiB;AACrB,CAAC,EAHWA,yBAAyB,KAAzBA,yBAAyB;AAKrC,MAAMC,iBAAiB,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,iBAAiBA,CAAC;EAAEG,QAAQ;EAAEC,OAAO;EAAEC;CAAkB,EAAEC,GAAG;EAC9G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;GAAU,GAAGQ,KAAK;EAE1B,oBACIV,6BAAC4D,MAAM,qBACH5D,6BAAC8E,aAAa,oBAAKpE,KAAK;IAAEL,GAAG,EAAEM;MAC1BT,QAAQ,CACG,CACX;AAEjB,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":["../../../../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from './Primitives';\nimport { mergeRefs } from '../../utils/mergeRefs';\nimport { getPopoverStyleClassnames } from './util';\n\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\n\nconst PopoverContext = React.createContext<PopoverContextValue>({\n props: {},\n ref: null,\n});\n\nexport type PopoverAnchorProps = React.HTMLAttributes<HTMLElement>;\nconst Anchor = React.forwardRef(function PopoverAnchor(props: PopoverAnchorProps, ref: React.Ref<HTMLDivElement>) {\n return <PopoverPrimitive.Anchor {...props} asChild ref={ref} />;\n});\n\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLElement>;\nconst Trigger = React.forwardRef(function PopoverTrigger(props: PopoverTriggerProps, externalRef: React.Ref<HTMLElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(PopoverContext);\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 `Popover.Trigger 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.Trigger {...parentProps} {...props} ref={refCallback} asChild>\n {children}\n </PopoverPrimitive.Trigger>\n );\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('hide'));\n };\n\n return children({ close, ref });\n});\n\nexport type PopoverContentRenderProps = { close: () => void };\nexport type PopoverContentProps = Omit<PopoverPrimitive.PopoverContentProps, 'side'> & {\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function PopoverContent(props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side, ...popoverContentProps } = props;\n const className = cn(getPopoverStyleClassnames(), props.className);\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <PopoverPrimitive.Close asChild>\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\n </PopoverPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n {...popoverContentProps}\n className={className}\n data-taco=\"popover\"\n side={side}\n sideOffset={1}\n ref={ref}>\n {output}\n <UnstyledArrow className=\"text-white\" />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Close = React.forwardRef(\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\n )\n);\n\nexport type PopoverProps = React.PropsWithChildren<{\n anchor?: JSX.Element;\n modal?: boolean;\n /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n /** Set whether the popover is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Control the open state of the popover from outside the component */\n open?: boolean;\n /** Called when the popover opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n}>;\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<PopoverAnchorProps>;\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\n Portal: React.FunctionComponent<PopoverPrimitive.PopoverPortalProps>;\n};\n\nexport const Popover = React.forwardRef<HTMLElement, PopoverProps>(function Popover(props, ref) {\n const { anchor, children, defaultOpen, modal = false, open, onChange, trigger, ...otherProps } = props;\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\n\n return (\n <PopoverContext.Provider value={context}>\n <PopoverPrimitive.Root defaultOpen={defaultOpen} modal={modal} open={open} onOpenChange={onChange}>\n {anchor ? <Anchor>{anchor}</Anchor> : null}\n {trigger && !anchor ? <Trigger>{trigger}</Trigger> : null}\n {children}\n </PopoverPrimitive.Root>\n </PopoverContext.Provider>\n );\n}) as ForwardedPopoverWithStatics;\nPopover.Anchor = Anchor;\nPopover.Trigger = Trigger;\nPopover.Content = Content;\nPopover.Close = Close;\nPopover.Portal = PopoverPrimitive.Portal;\n"],"names":["PopoverContext","React","props","ref","Anchor","PopoverAnchor","PopoverPrimitive","asChild","Trigger","PopoverTrigger","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","_props$children","type","console","warn","name","RenderPropWrapper","onClick","close","CustomEvent","Content","PopoverContent","placement","side","popoverContentProps","className","cn","getPopoverStyleClassnames","output","sideOffset","UnstyledArrow","Close","Popover","anchor","defaultOpen","modal","open","onChange","trigger","otherProps","context","Provider","value","onOpenChange","Portal"],"mappings":";;;;;;;AAUA,MAAMA,cAAc,gBAAGC,aAAmB,CAAsB;EAC5DC,KAAK,EAAE,EAAE;EACTC,GAAG,EAAE;CACR,CAAC;AAGF,MAAMC,MAAM,gBAAGH,UAAgB,CAAC,SAASI,aAAaA,CAACH,KAAyB,EAAEC,GAA8B;EAC5G,oBAAOF,cAACK,QAAuB,oBAAKJ,KAAK;IAAEK,OAAO;IAACJ,GAAG,EAAEA;KAAO;AACnE,CAAC,CAAC;AAGF,MAAMK,OAAO,gBAAGP,UAAgB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EC,KAAK,EAAEA,KAAK;IAAEC,IAAI,EAAEA,IAAI;IAAEO,YAAY,EAAEN;KACpFJ,MAAM,gBAAGrC,cAACG,MAAM,QAAEkC,MAAM,CAAU,GAAG,IAAI,EACzCK,OAAO,IAAI,CAACL,MAAM,gBAAGrC,cAACO,OAAO,QAAEmC,OAAO,CAAW,GAAG,IAAI,EACxD5B,QAAQ,CACW,CACF;AAElC,CAAC;AACDsB,OAAO,CAACjC,MAAM,GAAGA,MAAM;AACvBiC,OAAO,CAAC7B,OAAO,GAAGA,OAAO;AACzB6B,OAAO,CAACZ,OAAO,GAAGA,OAAO;AACzBY,OAAO,CAACD,KAAK,GAAGA,KAAK;AACrBC,OAAO,CAACY,MAAM,GAAG3C,MAAuB;;;;"}
1
+ {"version":3,"file":"Popover.js","sources":["../../../../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from './Primitives';\nimport { mergeRefs } from '../../utils/mergeRefs';\nimport { getPopoverStyleClassnames } from './util';\n\ntype PopoverContextValue = { props: any; ref: React.Ref<HTMLElement> };\n\nconst PopoverContext = React.createContext<PopoverContextValue>({\n props: {},\n ref: null,\n});\n\nexport type PopoverAnchorProps = React.HTMLAttributes<HTMLElement>;\nconst Anchor = React.forwardRef(function PopoverAnchor(props: PopoverAnchorProps, ref: React.Ref<HTMLDivElement>) {\n return <PopoverPrimitive.Anchor {...props} asChild ref={ref} />;\n});\n\nexport type PopoverTriggerProps = React.HTMLAttributes<HTMLElement>;\nconst Trigger = React.forwardRef(function PopoverTrigger(props: PopoverTriggerProps, externalRef: React.Ref<HTMLElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(PopoverContext);\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 `Popover.Trigger 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.Trigger {...parentProps} {...props} ref={refCallback} asChild>\n {children}\n </PopoverPrimitive.Trigger>\n );\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('hide'));\n };\n\n return children({ close, ref });\n});\n\nexport type PopoverContentRenderProps = { close: () => void };\nexport type PopoverContentProps = Omit<PopoverPrimitive.PopoverContentProps, 'side'> & {\n children: React.ReactNode | ((props: PopoverContentRenderProps) => React.ReactNode);\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function PopoverContent(props: PopoverContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side, ...popoverContentProps } = props;\n const className = cn(getPopoverStyleClassnames(), props.className);\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <PopoverPrimitive.Close asChild>\n <RenderPropWrapper>{props.children}</RenderPropWrapper>\n </PopoverPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n {...popoverContentProps}\n className={className}\n data-taco=\"popover\"\n side={side}\n sideOffset={1}\n ref={ref}>\n {output}\n <UnstyledArrow className=\"text-white\" />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type PopoverCloseProps = React.HTMLAttributes<HTMLButtonElement>;\nconst Close = React.forwardRef(\n (props: PopoverCloseProps, ref: React.Ref<HTMLButtonElement>): JSX.Element => (\n <PopoverPrimitive.Close {...props} ref={ref} asChild />\n )\n);\n\nexport type PopoverProps = React.PropsWithChildren<{\n anchor?: JSX.Element;\n modal?: boolean;\n /** A trigger to be used for the popover, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n /** Set whether the popover is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Control the open state of the popover from outside the component */\n open?: boolean;\n /** Called when the popover opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n}>;\nexport type ForwardedPopoverWithStatics = React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<PopoverAnchorProps>;\n Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps>;\n Content: React.ForwardRefExoticComponent<PopoverContentProps>;\n Close: React.ForwardRefExoticComponent<PopoverCloseProps>;\n Portal: React.FunctionComponent<PopoverPrimitive.PortalProps>;\n};\n\nexport const Popover = React.forwardRef<HTMLElement, PopoverProps>(function Popover(props, ref) {\n const { anchor, children, defaultOpen, modal = false, open, onChange, trigger, ...otherProps } = props;\n const context = React.useMemo(() => ({ props: otherProps, ref }), [otherProps]);\n\n return (\n <PopoverContext.Provider value={context}>\n <PopoverPrimitive.Root defaultOpen={defaultOpen} modal={modal} open={open} onOpenChange={onChange}>\n {anchor ? <Anchor>{anchor}</Anchor> : null}\n {trigger && !anchor ? <Trigger>{trigger}</Trigger> : null}\n {children}\n </PopoverPrimitive.Root>\n </PopoverContext.Provider>\n );\n}) as ForwardedPopoverWithStatics;\nPopover.Anchor = Anchor;\nPopover.Trigger = Trigger;\nPopover.Content = Content;\nPopover.Close = Close;\nPopover.Portal = PopoverPrimitive.Portal;\n"],"names":["PopoverContext","React","props","ref","Anchor","PopoverAnchor","PopoverPrimitive","asChild","Trigger","PopoverTrigger","externalRef","parentRef","parentProps","refCallback","mergeRefs","children","_props$children","type","console","warn","name","RenderPropWrapper","onClick","close","CustomEvent","Content","PopoverContent","placement","side","popoverContentProps","className","cn","getPopoverStyleClassnames","output","sideOffset","UnstyledArrow","Close","Popover","anchor","defaultOpen","modal","open","onChange","trigger","otherProps","context","Provider","value","onOpenChange","Portal"],"mappings":";;;;;;;AAUA,MAAMA,cAAc,g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AQ;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAG1C,KAAK;EACtG,MAAM2C,OAAO,GAAG5C,OAAa,CAAC,OAAO;IAAEC,KAAK,EAAE0C,UAAU;IAAEzC;GAAK,CAAC,EAAE,CAACyC,UAAU,CAAC,CAAC;EAE/E,oBACI3C,cAACD,cAAc,CAAC8C,QAAQ;IAACC,KAAK,EAAEF;kBAC5B5C,cAACK,IAAqB;IAACiC,WAAW,EAAEA,WAAW;IAAEC,KAAK,EAAEA,KAAK;IAAEC,IAAI,EAAEA,IAAI;IAAEO,YAAY,EAAEN;KACpFJ,MAAM,gBAAGrC,cAACG,MAAM,QAAEkC,MAAM,CAAU,GAAG,IAAI,EACzCK,OAAO,IAAI,CAACL,MAAM,gBAAGrC,cAACO,OAAO,QAAEmC,OAAO,CAAW,GAAG,IAAI,EACxD5B,QAAQ,CACW,CACF;AAElC,CAAC;AACDsB,OAAO,CAACjC,MAAM,GAAGA,MAAM;AACvBiC,OAAO,CAAC7B,OAAO,GAAGA,OAAO;AACzB6B,OAAO,CAACZ,OAAO,GAAGA,OAAO;AACzBY,OAAO,CAACD,KAAK,GAAGA,KAAK;AACrBC,OAAO,CAACY,MAAM,GAAG3C,MAAuB;;;;"}
@@ -21,6 +21,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
21
21
  onClickFindPrevious: handleClickFindPrevious,
22
22
  settingsContent,
23
23
  shortcut,
24
+ showTotal = true,
24
25
  value,
25
26
  ...attributes
26
27
  } = props;
@@ -99,10 +100,12 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
99
100
  }
100
101
  if (hasFind && isActive) {
101
102
  postfix = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
102
- className: "text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2"
103
- }, loading ? /*#__PURE__*/React__default.createElement(Spinner, {
103
+ className: "text-grey-700 flex h-4 items-center"
104
+ }, loading ? (/*#__PURE__*/React__default.createElement(Spinner, {
104
105
  className: "h-4 w-4"
105
- }) : `${findCurrent !== null && findCurrent !== void 0 ? findCurrent : 0}/${findTotal !== null && findTotal !== void 0 ? findTotal : 0}`), findCurrent ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
106
+ })) : showTotal ? (/*#__PURE__*/React__default.createElement("span", {
107
+ className: "border-r border-black/[0.25] pr-2"
108
+ }, `${findCurrent !== null && findCurrent !== void 0 ? findCurrent : 0}/${findTotal !== null && findTotal !== void 0 ? findTotal : 0}`)) : null), findCurrent ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
106
109
  "aria-label": texts.searchInput.findPrevious,
107
110
  className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
108
111
  icon: "chevron-up",
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n onClear?: () => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClear,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind =\n handleClickFindNext !== undefined &&\n handleClickFindPrevious !== undefined &&\n findCurrent !== undefined &&\n findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n onClear?.();\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n event.stopPropagation();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2\">\n {loading ? <Spinner className=\"h-4 w-4\" /> : `${findCurrent ?? 0}/${findTotal ?? 0}`}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-grey-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component\n onBlur={handleBlur}\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","loading","onChange","handleChange","onClear","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","settingsContent","shortcut","value","attributes","internalRef","useMergedRef","containerRef","useRef","focused","setFocused","useState","texts","useLocalization","isActive","length","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","_internalRef$current","preventDefault","focus","handleBlur","relatedTarget","_containerRef$current","contains","_attributes$onBlur","onBlur","call","handleClear","requestAnimationFrame","_internalRef$current2","blur","handleFocus","_attributes$onFocus","onFocus","handleKeyDown","_props$onKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","stopPropagation","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","Spinner","findPrevious","shift","findNext","onClickCapture","_internalRef$current3","cn","Icon","button","name","_internalRef$current4","input","Input","_attributes$ariaLabe","placeholder","target","_attributes$placehold","prefix","settingsClassname","style","opacity","_internalRef$current5"],"mappings":";;;;;;;;;;;MAsCaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAgC;;EACzH,MAAM;IACFC,WAAW;IACXC,SAAS;IACTC,OAAO,GAAG,KAAK;IACfC,QAAQ,EAAEC,YAAY;IACtBC,OAAO;IACPC,eAAe,EAAEC,mBAAmB;IACpCC,mBAAmB,EAAEC,uBAAuB;IAC5CC,eAAe;IACfC,QAAQ;IACRC,KAAK;IACL,GAAGC;GACN,GAAGf,KAAK;EACT,MAAMgB,WAAW,GAAGC,YAAY,CAAmBhB,GAAG,CAAC;EACvD,MAAMiB,YAAY,GAAGpB,cAAK,CAACqB,MAAM,CAAiB,IAAI,CAAC;EACvD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGvB,cAAK,CAACwB,QAAQ,CAAC,KAAK,CAAC;EACnD,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,QAAQ,GAAGX,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEY,MAAM;EAC9B,MAAMC,OAAO,GACTlB,mBAAmB,KAAKmB,SAAS,IACjCjB,uBAAuB,KAAKiB,SAAS,IACrC1B,WAAW,KAAK0B,SAAS,IACzBzB,SAAS,KAAKyB,SAAS;EAE3BC,gBAAgB,CAAChB,QAAQ,EAAGiB,KAAoB;IAC5C,IAAIC,QAAQ,CAACC,aAAa,KAAKhB,WAAW,C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;;;MAGjBwE,KAAK,EAAE;QAAEC,OAAO,EAAE;;OACjBT,KAAK,eACNpF;;MAEI4C,MAAM,EAAEL,UAAU;MAClB2B,SAAS,EAAEyB,iBAAiB;MAC5Bd,cAAc,EAAEA;QAAA,IAAAiB,qBAAA;QAAA,QAAAA,qBAAA,GAAM5E,WAAW,CAACiB,OAAO,cAAA2D,qBAAA,uBAAnBA,qBAAA,CAAqBxD,KAAK,EAAE;;;MAElD+B,QAAQ,EAAE,CAAC;OACVvD,eAAe,CACd,CACJ;;EAId,OAAOsE,KAAK;AAChB,CAAC;;;;"}
1
+ {"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n onClear?: () => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n showTotal?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n showTotal?: boolean;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClear,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n showTotal = true,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind =\n handleClickFindNext !== undefined &&\n handleClickFindPrevious !== undefined &&\n findCurrent !== undefined &&\n findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n onClear?.();\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n event.stopPropagation();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center\">\n {loading ? (\n <Spinner className=\"h-4 w-4\" />\n ) : showTotal ? (\n <span className=\"border-r border-black/[0.25] pr-2\">{`${findCurrent ?? 0}/${findTotal ?? 0}`}</span>\n ) : null}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-grey-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component\n onBlur={handleBlur}\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","loading","onChange","handleChange","onClear","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","settingsContent","shortcut","showTotal","value","attributes","internalRef","useMergedRef","containerRef","useRef","focused","setFocused","useState","texts","useLocalization","isActive","length","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","_internalRef$current","preventDefault","focus","handleBlur","relatedTarget","_containerRef$current","contains","_attributes$onBlur","onBlur","call","handleClear","requestAnimationFrame","_internalRef$current2","blur","handleFocus","_attributes$onFocus","onFocus","handleKeyDown","_props$onKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","stopPropagation","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","Spinner","findPrevious","shift","findNext","onClickCapture","_internalRef$current3","cn","Icon","button","name","_internalRef$current4","input","Input","_attributes$ariaLabe","placeholder","target","_attributes$placehold","prefix","settingsClassname","style","opacity","_internalRef$current5"],"mappings":";;;;;;;;;;;MAwCaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAgC;;EACzH,MAAM;IACFC,WAAW;IACXC,SAAS;IACTC,OAAO,GAAG,KAAK;IACfC,QAAQ,EAAEC,YAAY;IACtBC,OAAO;IACPC,eAAe,EAAEC,mBAAmB;IACpCC,mBAAmB,EAAEC,uBAAuB;IAC5CC,eAAe;IACfC,QAAQ;IACRC,SAAS,GAAG,IAAI;IAChBC,KAAK;IACL,GAAGC;GACN,GAAGhB,KAAK;EACT,MAAMiB,WAAW,GAAGC,YAAY,CAAmBjB,GAAG,CAAC;EACvD,MAAMkB,YAAY,GAAGrB,cAAK,CAACsB,MAAM,CAAiB,IAAI,CAAC;EACvD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGxB,cAAK,CAACyB,QAAQ,CAAC,KAAK,CAAC;EACnD,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,QAAQ,GAAGX,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEY,MAAM;EAC9B,MAAMC,OAAO,GACTnB,mBAAmB,KAAKoB,SAAS,IACjClB,uBAAuB,KAAKkB,SAAS,IACrC3B,WAAW,KAAK2B,SAAS,IACzB1B,SAAS,KAAK0B,SAAS;EAE3BC,gBAAgB,CAACjB,QAAQ,EAAGkB,KAAoB;IAC5C,IAAIC,QAAQ,CAACC,aAAa,KAAKhB,WAAW,CAACiB,OAAO,EAAE;MAAA,IAAAC,oBAAA;MAChDJ,KAAK,CAACK,cAAc,EAAE;MACtB,CAAAD,oBAAA,GAA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,EAAE;;OACjBT,KAAK,eACNrF;;MAEI6C,MAAM,EAAEL,UAAU;MAClB2B,SAAS,EAAEyB,iBAAiB;MAC5Bd,cAAc,EAAEA;QAAA,IAAAiB,qBAAA;QAAA,QAAAA,qBAAA,GAAM5E,WAAW,CAACiB,OAAO,cAAA2D,qBAAA,uBAAnBA,qBAAA,CAAqBxD,KAAK,EAAE;;;MAElD+B,QAAQ,EAAE,CAAC;OACVxD,eAAe,CACd,CACJ;;EAId,OAAOuE,KAAK;AAChB,CAAC;;;;"}
@@ -71,8 +71,7 @@ const BaseSelect = /*#__PURE__*/forwardRef(function BaseSelect(props, ref) {
71
71
  name: popover.open ? 'chevron-up' : 'chevron-down'
72
72
  }))), /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(Content, {
73
73
  align: "start",
74
- sideOffset: 4,
75
- onEscapeKeyDown: event => event.preventDefault()
74
+ sideOffset: 4
76
75
  }, props.multiselect ? /*#__PURE__*/createElement(MultiListbox, Object.assign({}, commonListboxProps)) : /*#__PURE__*/createElement(Listbox, Object.assign({}, commonListboxProps)))), /*#__PURE__*/createElement("input", Object.assign({}, input, {
77
76
  className: "hidden",
78
77
  type: "text"
@@ -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';\n\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} onEscapeKeyDown={event => event.preventDefault()}>\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","onEscapeKeyDown","event","preventDefault","MultiListbox","Listbox","type","Select","editable","Combobox","dialog","inline"],"mappings":";;;;;;;;;;;AAqCA,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,iBAAi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;IAAkB,CACzF,CACgB,eAC3BvB,cAACkC,MAAuB,qBACpBlC,cAACkC,OAAwB;IAACI,KAAK,EAAC,OAAO;IAACC,UAAU,EAAE,CAAC;IAAEC,eAAe,EAAEC,KAAK,IAAIA,KAAK,CAACC,cAAc;KAChGzC,KAAK,CAACkC,WAAW,gBAAGnC,cAAC2C,YAAY,oBAAKf,kBAAkB,EAAI,gBAAG5B,cAAC4C,OAAO,oBAAKhB,kBAAkB,EAAI,CAC5E,CACL,eAC1B5B,yCAAWY,KAAK;IAAER,SAAS,EAAC,QAAQ;IAACyC,IAAI,EAAC;KAAS,CAC/B,CACrB;AAEf,CAAC,CAAC;MAEWC,MAAM,gBAAG9C,UAAgB,CAAC,SAAS8C,MAAMA,CAAC7C,KAAkB,EAAEC,GAAgC;EACvG,MAAM;IAAE6C,QAAQ;IAAE,GAAGvC;GAAY,GAAGP,KAAK;EAEzC,IAAI8C,QAAQ,EAAE;IACV,oBAAO/C,cAACgD,QAAQ,oBAAKxC,UAAU;MAAEyC,MAAM,EAAEnB,SAAS;MAAEoB,MAAM;MAAChD,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 { Combobox, ComboboxProps } from '../Combobox/Combobox';\nimport { Badge } from '../Badge/Badge';\nimport { getInputClasses } from '../Input/util';\n\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":";;;;;;;;;;;AAqCA,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,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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;IAAE0C,QAAQ;IAAE,GAAGpC;GAAY,GAAGP,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,8 +1,8 @@
1
1
  import React__default from 'react';
2
2
  import { IconButton } from '../../../IconButton/IconButton.js';
3
3
  import { Menu } from '../../../Menu/Menu.js';
4
- import { InView } from 'react-intersection-observer';
5
4
  import { sanitizeRowProps } from '../../util.js';
5
+ import { InView } from 'react-intersection-observer';
6
6
 
7
7
  const actionGroupClassName = '-mt-1 -mb-1 h-8 flex';
8
8
  const hasActions = (inlineEditingUniqueId, handlers, actions) => {
@@ -1,6 +1,7 @@
1
1
  import React__default from 'react';
2
2
  import { fixedForwardRef } from '../../types.js';
3
3
  import { Table } from '../../primitives/Table/Core/Table.js';
4
+ import { isTableScrolled } from './util/editing.js';
4
5
  import { useTable3 } from './useTable3.js';
5
6
  import { Alert } from './components/Editing/Alert.js';
6
7
  import { Editing } from './components/Toolbar/Editing/Editing.js';
@@ -24,6 +25,7 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
24
25
  };
25
26
  const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().length;
26
27
  const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
28
+ const isScrolled = isTableScrolled(table3.ref);
27
29
  return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
28
30
  table: table3
29
31
  }, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
@@ -36,19 +38,27 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
36
38
  tableRef: table3.ref
37
39
  })) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
38
40
  "data-taco": "table3",
41
+ footerRows: hasCreateWorkflow && isScrolled ? (/*#__PURE__*/React__default.createElement(CreateNewRow, {
42
+ buttonRef: table3.meta.editing.createRowButtonRef,
43
+ isScrolled: isScrolled,
44
+ scrollToIndex: table3.renderer.scrollToIndex,
45
+ table: table3.instance,
46
+ tableMeta: table3.meta
47
+ })) : undefined,
39
48
  table: table3
40
49
  }), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TemporaryRow, {
41
50
  createRowButtonRef: table3.meta.editing.createRowButtonRef,
51
+ isScrolled: isScrolled,
42
52
  table: table3.instance,
43
53
  tableMeta: table3.meta,
44
54
  tableRef: table3.ref
45
- }), /*#__PURE__*/React__default.createElement(CreateNewRow, {
55
+ }), !isScrolled ? (/*#__PURE__*/React__default.createElement(CreateNewRow, {
46
56
  buttonRef: table3.meta.editing.createRowButtonRef,
57
+ isScrolled: isScrolled,
47
58
  scrollToIndex: table3.renderer.scrollToIndex,
48
59
  table: table3.instance,
49
- tableMeta: table3.meta,
50
- tableRef: table3.ref
51
- }))) : null));
60
+ tableMeta: table3.meta
61
+ })) : null)) : null));
52
62
  });
53
63
  const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
54
64
  const stringifiedChildren = String(props.children);