@economic/taco 2.7.0 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
24
24
  ...attributes
25
25
  } = props;
26
26
  const internalRef = useMergedRef(ref);
27
- const settingsRef = React__default.useRef(null);
27
+ const containerRef = React__default.useRef(null);
28
28
  const [focused, setFocused] = React__default.useState(false);
29
29
  const {
30
30
  texts
@@ -39,8 +39,8 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
39
39
  }
40
40
  });
41
41
  const handleBlur = event => {
42
- var _settingsRef$current, _attributes$onBlur;
43
- if (settingsRef.current && (settingsRef.current === event.relatedTarget || (_settingsRef$current = settingsRef.current) !== null && _settingsRef$current !== void 0 && _settingsRef$current.contains(event.relatedTarget))) {
42
+ var _containerRef$current, _attributes$onBlur;
43
+ if (containerRef.current && (containerRef.current === event.relatedTarget || (_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.contains(event.relatedTarget))) {
44
44
  return;
45
45
  }
46
46
  setFocused(false);
@@ -131,9 +131,9 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
131
131
  }
132
132
  });
133
133
  }
134
- const className = cn('peer !pl-7', hasFind ? {
135
- '!w-48': !value && !focused,
136
- '!w-72': value || focused
134
+ const className = cn('!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus', hasFind ? {
135
+ '!w-48': !value,
136
+ '!w-72': value
137
137
  } : '!w-48', {
138
138
  '!wcag-blue-100': isActive
139
139
  }, props.className);
@@ -161,26 +161,19 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
161
161
  value: value !== null && value !== void 0 ? value : ''
162
162
  }));
163
163
  if (settingsContent) {
164
- const handleSettingsBlur = event => {
165
- if (event.currentTarget.contains(event.relatedTarget) || event.currentTarget.contains(event.target)) {
166
- return;
167
- }
168
- setFocused(false);
169
- };
164
+ const settingsClassname = cn('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]))]');
170
165
  return /*#__PURE__*/React__default.createElement("div", {
171
- className: cn('relative', {
172
- "[&_[data-taco='input-container']]:z-20": focused
173
- }),
174
- onBlur: handleSettingsBlur,
175
- ref: settingsRef
176
- }, input, focused ? /*#__PURE__*/React__default.createElement("div", {
177
- className: "border-grey-300 absolute left-0 right-0 top-full z-10 flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow",
166
+ className: "group relative z-10 [&_[data-taco='input-container']]:z-10",
167
+ ref: containerRef
168
+ }, input, /*#__PURE__*/React__default.createElement("div", {
169
+ className: settingsClassname,
178
170
  onClickCapture: () => {
179
171
  var _internalRef$current5;
180
172
  return (_internalRef$current5 = internalRef.current) === null || _internalRef$current5 === void 0 ? void 0 : _internalRef$current5.focus();
181
173
  },
174
+ // tab index is important, it lets the element show as a relatedTarget on event handlers
182
175
  tabIndex: -1
183
- }, settingsContent) : null);
176
+ }, settingsContent));
184
177
  }
185
178
  return input;
186
179
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\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 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 onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const settingsRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind = handleClickFindNext && handleClickFindPrevious && findCurrent !== undefined && 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 settingsRef.current &&\n (settingsRef.current === event.relatedTarget || settingsRef.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?.focus());\n handleChange('');\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 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 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 'peer !pl-7',\n hasFind\n ? {\n '!w-48': !value && !focused,\n '!w-72': value || focused,\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 handleSettingsBlur = event => {\n if (event.currentTarget.contains(event.relatedTarget) || event.currentTarget.contains(event.target)) {\n return;\n }\n setFocused(false);\n };\n\n return (\n <div\n className={cn('relative', { \"[&_[data-taco='input-container']]:z-20\": focused })}\n onBlur={handleSettingsBlur}\n ref={settingsRef}>\n {input}\n {focused ? (\n <div\n className=\"border-grey-300 absolute left-0 right-0 top-full z-10 flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow\"\n onClickCapture={() => internalRef.current?.focus()}\n tabIndex={-1}>\n {settingsContent}\n </div>\n ) : null}\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","loading","onChange","handleChange","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","settingsContent","shortcut","value","attributes","internalRef","useMergedRef","settingsRef","useRef","focused","setFocused","useState","texts","useLocalization","isActive","length","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","_internalRef$current","preventDefault","focus","handleBlur","relatedTarget","_settingsRef$current","contains","_attributes$onBlur","onBlur","call","handleClear","requestAnimationFrame","_internalRef$current2","handleFocus","_attributes$onFocus","onFocus","handleKeyDown","_props$onKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","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","handleSettingsBlur","currentTarget","_internalRef$current5"],"mappings":";;;;;;;;;;;MAqCaA,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,eAAe,EAAEC,mBAAmB;IACpCC,mBAAmB,EAAEC,uBAAuB;IAC5CC,eAAe;IACfC,QAAQ;IACRC,KAAK;IACL,GAAGC;GACN,GAAGd,KAAK;EACT,MAAMe,WAAW,GAAGC,YAAY,CAAmBf,GAAG,CAAC;EACvD,MAAMgB,WAAW,GAAGnB,cAAK,CAACoB,MAAM,CAAiB,IAAI,CAAC;EACtD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGtB,cAAK,CAACuB,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,GAAGlB,mBAAmB,IAAIE,uBAAuB,IAAIR,WAAW,KAAKyB,SAAS,IAAIxB,SAAS,KAAKwB,SAAS;EAEtHC,gBAAgB,CAAChB,QAAQ,EAAGiB,KAAoB;IAC5C,IAAIC,QAAQ,CAACC,aAAa,KAAKhB,WAAW,CAACiB,OAAO,EAAE;MAAA,IAAAC,oBAAA;MAChDJ,KAAK,CAACK,cAAc,EAAE;MACtB,CAAAD,oBAAA,G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FsB,MAAM,EAAE6C,kBAAkB;MAC1BrF,GAAG,EAAEgB;OACJ8D,KAAK,EACL5D,OAAO,gBACJrB;MACI+D,SAAS,EAAC,6HAA6H;MACvIW,cAAc,EAAEA;QAAA,IAAAgB,qBAAA;QAAA,QAAAA,qBAAA,GAAMzE,WAAW,CAACiB,OAAO,cAAAwD,qBAAA,uBAAnBA,qBAAA,CAAqBrD,KAAK,EAAE;;MAClD6B,QAAQ,EAAE,CAAC;OACVrD,eAAe,CACd,GACN,IAAI,CACN;;EAId,OAAOoE,KAAK;AAChB,CAAC;;;;"}
1
+ {"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\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 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 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 = handleClickFindNext && handleClickFindPrevious && findCurrent !== undefined && 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?.focus());\n handleChange('');\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 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 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 className=\"group relative z-10 [&_[data-taco='input-container']]:z-10\" ref={containerRef}>\n {input}\n <div\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","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","handleFocus","_attributes$onFocus","onFocus","handleKeyDown","_props$onKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","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","_internalRef$current5"],"mappings":";;;;;;;;;;;MAqCaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAgC;;EACzH,MAAM;IACFC,WAAW;IACXC,SAAS;IACTC,OAAO,GAAG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wB,KAAK,IAAIvB,YAAY,CAACuB,KAAK,CAACsD,MAAM,CAACtE,KAAK,CAAC;IACnDmC,OAAO,EAAEF,WAAW;IACpBK,SAAS,EAAEF,aAAa;IACxBiC,WAAW,GAAAE,qBAAA,GAAEtE,UAAU,CAACoE,WAAW,cAAAE,qBAAA,cAAAA,qBAAA,GAAI9D,KAAK,CAACqC,WAAW,CAACuB,WAAW;IACpEG,MAAM,EAAEvB,IAAI;IACZP,OAAO,EAAEA,OAAO;IAChBtD,GAAG,EAAEc,WAAW;IAChBF,KAAK,EAAEA,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI;KAEvB;EAED,IAAIF,eAAe,EAAE;IACjB,MAAM2E,iBAAiB,GAAGZ,EAAE,CACxB,+NAA+N,CAClO;IAED,oBACI5E;MAAK+D,SAAS,EAAC,4DAA4D;MAAC5D,GAAG,EAAEgB;OAC5E8D,KAAK,eACNjF;MACI+D,SAAS,EAAEyB,iBAAiB;MAC5Bd,cAAc,EAAEA;QAAA,IAAAe,qBAAA;QAAA,QAAAA,qBAAA,GAAMxE,WAAW,CAACiB,OAAO,cAAAuD,qBAAA,uBAAnBA,qBAAA,CAAqBpD,KAAK,EAAE;;;MAElD6B,QAAQ,EAAE,CAAC;OACVrD,eAAe,CACd,CACJ;;EAId,OAAOoE,KAAK;AAChB,CAAC;;;;"}
@@ -103,7 +103,7 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
103
103
  return newTableMeta.currentRow.currentRowIndex === oldTableMeta.currentRow.currentRowIndex && newProps.row.getIsSelected() !== oldProps.row.getIsSelected();
104
104
  });
105
105
  function createRowSelectionColumn(hasDrag, hasExpansion) {
106
- const size = hasDrag && hasExpansion ? 22 : 4;
106
+ const size = hasDrag && hasExpansion ? 22 : 40;
107
107
  return {
108
108
  id: COLUMN_ID,
109
109
  header: Header,
@@ -1 +1 @@
1
- {"version":3,"file":"Selection.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\nimport { getRadioClassnames } from '../../../../RadioGroup/util';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\nexport const COLUMN_ID = '__select';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n if (context.table.options.enableMultiRowSelection) {\n const isAllRowsSelected = context.table.getIsAllRowsSelected();\n const isSomeRowsSelected = context.table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !mt-0\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n onChange={context.table.toggleAllRowsSelected}\n tabIndex={-1}\n />\n </Tooltip>\n </ColumnHeader>\n );\n } else {\n return <ColumnHeader {...context}></ColumnHeader>;\n }\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nconst Cell = React.memo(\n function MemoedCell<TType = unknown>(context: CellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n const isCurrentRow = tableMeta.currentRow.currentRowIndex === rowIndex;\n const isSelected = context.row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (context.table.options.enableMultiRowSelection) {\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(\n tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0,\n rowIndex\n );\n\n context.table\n .getRowModel()\n .rows.slice(fromIndex, toIndex + 1)\n .forEach(row => row.toggleSelected(true));\n } else {\n context.row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n tabIndex={isCurrentRow ? 0 : -1}\n />\n </Tooltip>\n </DisplayCell>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n context.row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <button\n className={className}\n aria-checked={isSelected}\n onClick={handleClick}\n role=\"radio\"\n tabIndex={-1}\n type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n </DisplayCell>\n );\n }\n },\n function arePropsEqual(oldProps: CellContext<unknown, unknown>, newProps: CellContext<unknown, unknown>) {\n const oldTableMeta = oldProps.table.options.meta as TableMeta<unknown>;\n const newTableMeta = newProps.table.options.meta as TableMeta<unknown>;\n\n // we memo because we don't want the row re-rendering and removing focus from the checkbox\n // we can't default to the standard comparison because we need currentRow off the table meta\n // and we don't really care about re-rendering in any other scenario\n return (\n newTableMeta.currentRow.currentRowIndex === oldTableMeta.currentRow.currentRowIndex &&\n newProps.row.getIsSelected() !== oldProps.row.getIsSelected()\n );\n }\n) as <TType = unknown>(context: CellContext<TType, unknown>) => JSX.Element;\n\nexport function createRowSelectionColumn<TType = unknown>(\n hasDrag: boolean,\n hasExpansion: boolean\n): DisplayColumnDef<TType, unknown> {\n const size = hasDrag && hasExpansion ? 22 : 4;\n return {\n id: COLUMN_ID,\n header: Header,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'center',\n className: cn('!pt-[var(--table3-row-padding)] !justify-end !p-0', {\n '!pr-0.5': hasExpansion,\n '!pr-3': !hasExpansion,\n }),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: cn('items-center !justify-end !p-0', { '!pr-0.5': hasExpansion, '!pr-3': !hasExpansion }),\n },\n // options\n enableResizing: false,\n size,\n minSize: size,\n };\n}\n"],"names":["COLUMN_ID","Header","context","texts","useLocalization","table","options","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","React","ColumnHeader","Tooltip","Checkbox","className","key","String","checked","indeterminate","onChange","toggleAllRowsSelected","tabIndex","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","memo","MemoedCell","rowIndex","useContext","RowContext","tableMeta","meta","isCurrentRow","currentRow","currentRowIndex","isSelected","row","getIsSelected","deselect","handleClick","event","stopPropagation","shiftKey","_tableMeta$rowSelecti","rowSelection","lastSelectedRowIndex","current","getRowModel","rows","slice","forEach","toggleSelected","DisplayCell","Shortcut","keys","onClick","cn","getRadioClassnames","role","type","arePropsEqual","oldProps","newProps","oldTableMeta","newTableMeta","createRowSelectionColumn","hasDrag","hasExpansion","size","id","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;MAaaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO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EAAE;AAErE,CAAC,CACsE;SAE3D4B,wBAAwBA,CACpCC,OAAgB,EAChBC,YAAqB;EAErB,MAAMC,IAAI,GAAGF,OAAO,IAAIC,YAAY,GAAG,EAAE,GAAG,CAAC;EAC7C,OAAO;IACHE,EAAE,EAAEhF,SAAS;IACbiF,MAAM,EAAEhF,MAAM;IACdiF,IAAI,EAAE/C,IAAI;IACVgD,MAAM,EAAEC,MAAM;IACd1C,IAAI,EAAE;MACF2C,KAAK,EAAE,QAAQ;MACf/D,SAAS,EAAE6C,EAAE,CAAC,mDAAmD,EAAE;QAC/D,SAAS,EAAEW,YAAY;QACvB,OAAO,EAAE,CAACA;OACb,CAAC;MACFQ,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBP,MAAM,EAAE,EAAE;MACVQ,eAAe,EAAEtB,EAAE,CAAC,gCAAgC,EAAE;QAAE,SAAS,EAAEW,YAAY;QAAE,OAAO,EAAE,CAACA;OAAc;KAC5G;;IAEDY,cAAc,EAAE,KAAK;IACrBX,IAAI;IACJY,OAAO,EAAEZ;GACZ;AACL;;;;"}
1
+ {"version":3,"file":"Selection.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\nimport { getRadioClassnames } from '../../../../RadioGroup/util';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\nexport const COLUMN_ID = '__select';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n if (context.table.options.enableMultiRowSelection) {\n const isAllRowsSelected = context.table.getIsAllRowsSelected();\n const isSomeRowsSelected = context.table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !mt-0\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n onChange={context.table.toggleAllRowsSelected}\n tabIndex={-1}\n />\n </Tooltip>\n </ColumnHeader>\n );\n } else {\n return <ColumnHeader {...context}></ColumnHeader>;\n }\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nconst Cell = React.memo(\n function MemoedCell<TType = unknown>(context: CellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n const isCurrentRow = tableMeta.currentRow.currentRowIndex === rowIndex;\n const isSelected = context.row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (context.table.options.enableMultiRowSelection) {\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(\n tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0,\n rowIndex\n );\n\n context.table\n .getRowModel()\n .rows.slice(fromIndex, toIndex + 1)\n .forEach(row => row.toggleSelected(true));\n } else {\n context.row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n tabIndex={isCurrentRow ? 0 : -1}\n />\n </Tooltip>\n </DisplayCell>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n context.row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <button\n className={className}\n aria-checked={isSelected}\n onClick={handleClick}\n role=\"radio\"\n tabIndex={-1}\n type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n </DisplayCell>\n );\n }\n },\n function arePropsEqual(oldProps: CellContext<unknown, unknown>, newProps: CellContext<unknown, unknown>) {\n const oldTableMeta = oldProps.table.options.meta as TableMeta<unknown>;\n const newTableMeta = newProps.table.options.meta as TableMeta<unknown>;\n\n // we memo because we don't want the row re-rendering and removing focus from the checkbox\n // we can't default to the standard comparison because we need currentRow off the table meta\n // and we don't really care about re-rendering in any other scenario\n return (\n newTableMeta.currentRow.currentRowIndex === oldTableMeta.currentRow.currentRowIndex &&\n newProps.row.getIsSelected() !== oldProps.row.getIsSelected()\n );\n }\n) as <TType = unknown>(context: CellContext<TType, unknown>) => JSX.Element;\n\nexport function createRowSelectionColumn<TType = unknown>(\n hasDrag: boolean,\n hasExpansion: boolean\n): DisplayColumnDef<TType, unknown> {\n const size = hasDrag && hasExpansion ? 22 : 40;\n\n return {\n id: COLUMN_ID,\n header: Header,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'center',\n className: cn('!pt-[var(--table3-row-padding)] !justify-end !p-0', {\n '!pr-0.5': hasExpansion,\n '!pr-3': !hasExpansion,\n }),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: cn('items-center !justify-end !p-0', { '!pr-0.5': hasExpansion, '!pr-3': !hasExpansion }),\n },\n // options\n enableResizing: false,\n size,\n minSize: size,\n };\n}\n"],"names":["COLUMN_ID","Header","context","texts","useLocalization","table","options","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","React","ColumnHeader","Tooltip","Checkbox","className","key","String","checked","indeterminate","onChange","toggleAllRowsSelected","tabIndex","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","memo","MemoedCell","rowIndex","useContext","RowContext","tableMeta","meta","isCurrentRow","currentRow","currentRowIndex","isSelected","row","getIsSelected","deselect","handleClick","event","stopPropagation","shiftKey","_tableMeta$rowSelecti","rowSelection","lastSelectedRowIndex","current","getRowModel","rows","slice","forEach","toggleSelected","DisplayCell","Shortcut","keys","onClick","cn","getRadioClassnames","role","type","arePropsEqual","oldProps","newProps","oldTableMeta","newTableMeta","createRowSelectionColumn","hasDrag","hasExpansion","size","id","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;MAaaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,IAAIF,OAAO,CAACG,KAAK,CAACC,OAAO,CAACC,uBAAuB,EAAE;IAC/C,MAAMC,iBAAiB,GAAGN,OAAO,CAACG,KAAK,CAACI,oBAAoB,EAAE;IAC9D,MAAMC,kBAAkB,GAAGR,OAAO,CAACG,KAAK,CAACM,qBAAqB,EAAE;IAChE,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGL,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGb,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,MAAM,CAACE,SAAS;IAEjH,oBACIC,6BAACC,QAAY,oBAAKjB,OAAO,gBACrBgB,6BAACE,OAAO;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BC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBP,MAAM,EAAE,EAAE;MACVQ,eAAe,EAAEtB,EAAE,CAAC,gCAAgC,EAAE;QAAE,SAAS,EAAEW,YAAY;QAAE,OAAO,EAAE,CAACA;OAAc;KAC5G;;IAEDY,cAAc,EAAE,KAAK;IACrBX,IAAI;IACJY,OAAO,EAAEZ;GACZ;AACL;;;;"}
@@ -7,7 +7,13 @@ function RowHeight(props) {
7
7
  texts
8
8
  } = useLocalization();
9
9
  const meta = props.table.options.meta;
10
- const handleChange = value => meta.rowHeight.setHeight(value);
10
+ const handleChange = value => {
11
+ const height = value;
12
+ meta.rowHeight.setHeight(height);
13
+ if (height === 'short' && meta.fontSize.size === 'large') {
14
+ meta.fontSize.setSize('medium');
15
+ }
16
+ };
11
17
  return /*#__PURE__*/React__default.createElement(Menu.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu.RadioGroup, {
12
18
  onChange: handleChange,
13
19
  value: meta.rowHeight.height
@@ -1 +1 @@
1
- {"version":3,"file":"RowHeight.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/RowHeight.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { Menu } from '../../../Menu/Menu';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Table3RowHeight } from '../../types';\nimport { RadioGroupItemValue } from '../../../..';\n\ntype RowHeightButtonProps<TType = unknown> = {\n table: RTable<TType>;\n};\n\nexport function RowHeight<TType = unknown>(props: RowHeightButtonProps<TType>) {\n const { texts } = useLocalization();\n const meta = props.table.options.meta as TableMeta<unknown>;\n const handleChange = (value: RadioGroupItemValue) => meta.rowHeight.setHeight(value as Table3RowHeight);\n\n return (\n <Menu.SubMenu>\n <Menu.RadioGroup onChange={handleChange} value={meta.rowHeight.height}>\n <Menu.RadioGroup.Item value=\"short\">{texts.table3.rowHeight.sizes.short}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"medium\">{texts.table3.rowHeight.sizes.medium}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"tall\">{texts.table3.rowHeight.sizes.tall}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"extra-tall\">{texts.table3.rowHeight.sizes.extraTall}</Menu.RadioGroup.Item>\n </Menu.RadioGroup>\n </Menu.SubMenu>\n );\n}\n"],"names":["RowHeight","props","texts","useLocalization","meta","table","options","handleChange","value","rowHeight","setHeight","React","Menu","SubMenu","RadioGroup","onChange","height","Item","table3","sizes","short","medium","tall","extraTall"],"mappings":";;;;SAWgBA,SAASA,CAAkBC,KAAkC;EACzE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,IAAI,GAAGH,KAAK,CAACI,KAAK,CAACC,OAAO,CAACF,IAA0B;EAC3D,MAAMG,YAAY,GAAIC,KAA0B,IAAKJ,IAAI,CAACK,SAAS,CAACC,SAAS,CAACF,KAAwB,CAAC;EAEvG,oBACIG,6BAACC,IAAI,CAACC,OAAO,qBACTF,6BAACC,IAAI,CAACE,UAAU;IAACC,QAAQ,EAAER,YAAY;IAAEC,KAAK,EAAEJ,IAAI,CAACK,SAAS,CAACO;kBAC3DL,6BAACC,IAAI,CAACE,UAAU,CAACG,IAAI;IAACT,KAAK,EAAC;KAASN,KAAK,CAACgB,MAAM,CAACT,SAAS,CAACU,KAAK,CAACC,KAAK,CAAwB,eAC/FT,6BAACC,IAAI,CAACE,UAAU,CAACG,IAAI;IAACT,KAAK,EAAC;KAAUN,KAAK,CAACgB,MAAM,CAACT,SAAS,CAACU,KAAK,CAACE,MAAM,CAAwB,eACjGV,6BAACC,IAAI,CAACE,UAAU,CAACG,IAAI;IAACT,KAAK,EAAC;KAAQN,KAAK,CAACgB,MAAM,CAACT,SAAS,CAACU,KAAK,CAACG,IAAI,CAAwB,eAC7FX,6BAACC,IAAI,CAACE,UAAU,CAACG,IAAI;IAACT,KAAK,EAAC;KAAcN,KAAK,CAACgB,MAAM,CAACT,SAAS,CAACU,KAAK,CAACI,SAAS,CAAwB,CAC1F,CACP;AAEvB;;;;"}
1
+ {"version":3,"file":"RowHeight.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/RowHeight.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { Menu } from '../../../Menu/Menu';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Table3RowHeight } from '../../types';\nimport { RadioGroupItemValue } from '../../../..';\n\ntype RowHeightButtonProps<TType = unknown> = {\n table: RTable<TType>;\n};\n\nexport function RowHeight<TType = unknown>(props: RowHeightButtonProps<TType>) {\n const { texts } = useLocalization();\n const meta = props.table.options.meta as TableMeta<unknown>;\n const handleChange = (value: RadioGroupItemValue) => {\n const height = value as Table3RowHeight;\n\n meta.rowHeight.setHeight(height);\n\n if (height === 'short' && meta.fontSize.size === 'large') {\n meta.fontSize.setSize('medium');\n }\n };\n\n return (\n <Menu.SubMenu>\n <Menu.RadioGroup onChange={handleChange} value={meta.rowHeight.height}>\n <Menu.RadioGroup.Item value=\"short\">{texts.table3.rowHeight.sizes.short}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"medium\">{texts.table3.rowHeight.sizes.medium}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"tall\">{texts.table3.rowHeight.sizes.tall}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"extra-tall\">{texts.table3.rowHeight.sizes.extraTall}</Menu.RadioGroup.Item>\n </Menu.RadioGroup>\n </Menu.SubMenu>\n );\n}\n"],"names":["RowHeight","props","texts","useLocalization","meta","table","options","handleChange","value","height","rowHeight","setHeight","fontSize","size","setSize","React","Menu","SubMenu","RadioGroup","onChange","Item","table3","sizes","short","medium","tall","extraTall"],"mappings":";;;;SAWgBA,SAASA,CAAkBC,KAAkC;EACzE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,IAAI,GAAGH,KAAK,CAACI,KAAK,CAACC,OAAO,CAACF,IAA0B;EAC3D,MAAMG,YAAY,GAAIC,KAA0B;IAC5C,MAAMC,MAAM,GAAGD,KAAwB;IAEvCJ,IAAI,CAACM,SAAS,CAACC,SAAS,CAACF,MAAM,CAAC;IAEhC,IAAIA,MAAM,KAAK,OAAO,IAAIL,IAAI,CAACQ,QAAQ,CAACC,IAAI,KAAK,OAAO,EAAE;MACtDT,IAAI,CAACQ,QAAQ,CAACE,OAAO,CAAC,QAAQ,CAAC;;GAEtC;EAED,oBACIC,6BAACC,IAAI,CAACC,OAAO,qBACTF,6BAACC,IAAI,CAACE,UAAU;IAACC,QAAQ,EAAEZ,YAAY;IAAEC,KAAK,EAAEJ,IAAI,CAACM,SAAS,CAACD;kBAC3DM,6BAACC,IAAI,CAACE,UAAU,CAACE,IAAI;IAACZ,KAAK,EAAC;KAASN,KAAK,CAACmB,MAAM,CAACX,SAAS,CAACY,KAAK,CAACC,KAAK,CAAwB,eAC/FR,6BAACC,IAAI,CAACE,UAAU,CAACE,IAAI;IAACZ,KAAK,EAAC;KAAUN,KAAK,CAACmB,MAAM,CAACX,SAAS,CAACY,KAAK,CAACE,MAAM,CAAwB,eACjGT,6BAACC,IAAI,CAACE,UAAU,CAACE,IAAI;IAACZ,KAAK,EAAC;KAAQN,KAAK,CAACmB,MAAM,CAACX,SAAS,CAACY,KAAK,CAACG,IAAI,CAAwB,eAC7FV,6BAACC,IAAI,CAACE,UAAU,CAACE,IAAI;IAACZ,KAAK,EAAC;KAAcN,KAAK,CAACmB,MAAM,CAACX,SAAS,CAACY,KAAK,CAACI,SAAS,CAAwB,CAC1F,CACP;AAEvB;;;;"}
@@ -29,7 +29,7 @@ function Toolbar(props) {
29
29
  }
30
30
  const tableMeta = table.options.meta;
31
31
  return /*#__PURE__*/React__default.createElement("div", {
32
- className: "mb-4 flex flex-shrink flex-grow-0 gap-2",
32
+ className: "mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2",
33
33
  "data-taco": "table3-toolbar"
34
34
  }, left, /*#__PURE__*/React__default.createElement(Group, {
35
35
  className: "ml-auto flex-shrink-0 print:hidden"
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { RowHeight } from './RowHeight';\nimport { Search } from './Search';\nimport { Group } from '../../../Group/Group';\nimport { Filters } from './Filter/filters/Filters';\nimport { ColumnSettings } from './ColumnSettings';\nimport { EditButton } from './EditButton';\nimport { PrintButton } from './PrintButton/PrintButton';\nimport { Table3Props } from '../../types';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { Menu } from '../../../Menu/Menu';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { IconName } from '../../../Icon/Icon';\nimport { FontSize } from './FontSize';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\n\nexport type ToolbarProps<TType = unknown> = {\n left?: JSX.Element;\n right?: JSX.Element;\n scrollToIndex: any;\n table: RTable<TType>;\n tableProps: Table3Props<TType>;\n total: number;\n};\nexport function Toolbar<TType = unknown>(props: ToolbarProps<TType>) {\n const { left, right, scrollToIndex, table, tableProps, total } = props;\n const { texts } = useLocalization();\n\n if (!isToolbarVisible(props)) {\n return null;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n <div className=\"mb-4 flex flex-shrink flex-grow-0 gap-2\" data-taco=\"table3-toolbar\">\n {left}\n <Group className=\"ml-auto flex-shrink-0 print:hidden\">\n {tableMeta.editing.isEnabled ? <EditButton table={table} /> : null}\n {table.options.enableColumnFilters ? <Filters table={table} total={total} /> : null}\n {table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? <ColumnSettings table={table} /> : null}\n {tableMeta.printing.isEnabled ? <PrintButton table={table} tableProps={tableProps} /> : null}\n {right}\n {isMoreVisible(props) ? (\n <Tooltip title={texts.table3.otherOptions.tooltip}>\n <IconButton\n aria-label={texts.table3.otherOptions.tooltip}\n icon=\"more\"\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content align=\"end\">\n {tableMeta.rowHeight.isEnabled ? (\n <Menu.Item\n icon={`height-${tableMeta.rowHeight.height}` as IconName}\n subMenu={() => <RowHeight table={table} />}>\n {texts.table3.rowHeight.tooltip}\n </Menu.Item>\n ) : null}\n {tableMeta.fontSize.isEnabled ? (\n <Menu.Item icon=\"font-size\" subMenu={() => <FontSize table={table} />}>\n {texts.table3.fontSize.tooltip}\n </Menu.Item>\n ) : null}\n </Menu.Content>\n </Menu>\n )}\n />\n </Tooltip>\n ) : null}\n {tableMeta.search.isEnabled ? <Search scrollToIndex={scrollToIndex} table={table} /> : null}\n </Group>\n </div>\n );\n}\n\nfunction isMoreVisible<TType = unknown>(props: ToolbarProps<TType>) {\n const { table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return tableMeta.fontSize.isEnabled || tableMeta.rowHeight.isEnabled;\n}\n\nfunction isToolbarVisible<TType = unknown>(props: ToolbarProps<TType>) {\n const { left, right, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const enableSettingsButton = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n const hasInternalToolbar =\n enableSettingsButton ||\n tableMeta.editing.isEnabled ||\n tableMeta.printing.isEnabled ||\n table.options.enableColumnFilters ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n tableMeta.search.isEnabled;\n\n return hasInternalToolbar || !!left || !!right;\n}\n"],"names":["Toolbar","props","left","right","scrollToIndex","table","tableProps","total","texts","useLocalization","isToolbarVisible","tableMeta","options","meta","React","className","Group","editing","isEnabled","EditButton","enableColumnFilters","Filters","enableHiding","columnOrdering","ColumnSettings","printing","PrintButton","isMoreVisible","Tooltip","title","table3","otherOptions","tooltip","IconButton","icon","menu","menuProps","Menu","Content","align","rowHeight","Item","height","subMenu","RowHeight","fontSize","FontSize","search","Search","enableSettingsButton","hasInternalTool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kB,GACpBD,oBAAoB,IACpBtC,SAAS,CAACM,OAAO,CAACC,SAAS,IAC3BP,SAAS,CAACc,QAAQ,CAACP,SAAS,IAC5Bb,KAAK,CAACO,OAAO,CAACQ,mBAAmB,IACjCT,SAAS,CAACkC,QAAQ,CAAC3B,SAAS,IAC5BP,SAAS,CAAC6B,SAAS,CAACtB,SAAS,IAC7BP,SAAS,CAACoC,MAAM,CAAC7B,SAAS;EAE9B,OAAOgC,kBAAkB,IAAI,CAAC,CAAChD,IAAI,IAAI,CAAC,CAACC,KAAK;AAClD;;;;"}
1
+ {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { RowHeight } from './RowHeight';\nimport { Search } from './Search';\nimport { Group } from '../../../Group/Group';\nimport { Filters } from './Filter/filters/Filters';\nimport { ColumnSettings } from './ColumnSettings';\nimport { EditButton } from './EditButton';\nimport { PrintButton } from './PrintButton/PrintButton';\nimport { Table3Props } from '../../types';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { Menu } from '../../../Menu/Menu';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { IconName } from '../../../Icon/Icon';\nimport { FontSize } from './FontSize';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\n\nexport type ToolbarProps<TType = unknown> = {\n left?: JSX.Element;\n right?: JSX.Element;\n scrollToIndex: any;\n table: RTable<TType>;\n tableProps: Table3Props<TType>;\n total: number;\n};\nexport function Toolbar<TType = unknown>(props: ToolbarProps<TType>) {\n const { left, right, scrollToIndex, table, tableProps, total } = props;\n const { texts } = useLocalization();\n\n if (!isToolbarVisible(props)) {\n return null;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n <div className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2\" data-taco=\"table3-toolbar\">\n {left}\n <Group className=\"ml-auto flex-shrink-0 print:hidden\">\n {tableMeta.editing.isEnabled ? <EditButton table={table} /> : null}\n {table.options.enableColumnFilters ? <Filters table={table} total={total} /> : null}\n {table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? <ColumnSettings table={table} /> : null}\n {tableMeta.printing.isEnabled ? <PrintButton table={table} tableProps={tableProps} /> : null}\n {right}\n {isMoreVisible(props) ? (\n <Tooltip title={texts.table3.otherOptions.tooltip}>\n <IconButton\n aria-label={texts.table3.otherOptions.tooltip}\n icon=\"more\"\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content align=\"end\">\n {tableMeta.rowHeight.isEnabled ? (\n <Menu.Item\n icon={`height-${tableMeta.rowHeight.height}` as IconName}\n subMenu={() => <RowHeight table={table} />}>\n {texts.table3.rowHeight.tooltip}\n </Menu.Item>\n ) : null}\n {tableMeta.fontSize.isEnabled ? (\n <Menu.Item icon=\"font-size\" subMenu={() => <FontSize table={table} />}>\n {texts.table3.fontSize.tooltip}\n </Menu.Item>\n ) : null}\n </Menu.Content>\n </Menu>\n )}\n />\n </Tooltip>\n ) : null}\n {tableMeta.search.isEnabled ? <Search scrollToIndex={scrollToIndex} table={table} /> : null}\n </Group>\n </div>\n );\n}\n\nfunction isMoreVisible<TType = unknown>(props: ToolbarProps<TType>) {\n const { table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return tableMeta.fontSize.isEnabled || tableMeta.rowHeight.isEnabled;\n}\n\nfunction isToolbarVisible<TType = unknown>(props: ToolbarProps<TType>) {\n const { left, right, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const enableSettingsButton = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n const hasInternalToolbar =\n enableSettingsButton ||\n tableMeta.editing.isEnabled ||\n tableMeta.printing.isEnabled ||\n table.options.enableColumnFilters ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n tableMeta.search.isEnabled;\n\n return hasInternalToolbar || !!left || !!right;\n}\n"],"names":["Toolbar","props","left","right","scrollToIndex","table","tableProps","total","texts","useLocalization","isToolbarVisible","tableMeta","options","meta","React","className","Group","editing","isEnabled","EditButton","enableColumnFilters","Filters","enableHiding","columnOrdering","ColumnSettings","printing","PrintButton","isMoreVisible","Tooltip","title","table3","otherOptions","tooltip","IconButton","icon","menu","menuProps","Menu","Content","align","rowHeight","Item","height","subMenu","RowHeight","fontSize","FontSize","search","Search","enableSettingsButton","hasInternalToolbar"],"mappings":";;;;;;;;;;;;;;SAyBgBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC,aAAa;IAAEC,KAAK;IAAEC,UAAU;IAAEC;GAAO,GAAGN,KAAK;EACtE,MAAM;IAAEO;GAAO,GAAGC,eAAe,EAAE;EAEnC,IAAI,CAACC,gBAAgB,CAACT,KAAK,CAAC,EAAE;IAC1B,OAAO,IAAI;;EAGf,MAAMU,SAAS,GAAGN,KAAK,CAACO,OAAO,CAACC,IAAwB;EAExD,oBACIC;IAAKC,SAAS,EAAC,mDAAmD;iBAAW;KACxEb,IAAI,eACLY,6BAACE,KAAK;IAACD,SAAS,EAAC;KACZJ,SAAS,CAACM,OAAO,CAACC,SAAS,gBAAGJ,6BAACK,UAAU;IAACd,KAAK,EAAEA;IAAS,GAAG,IAAI,EACjEA,KAAK,CAACO,OAAO,CAACQ,mBAAmB,gBAAGN,6BAACO,OAAO;IAAChB,KAAK,EAAEA,KAAK;IAAEE,KAAK,EAAEA;IAAS,GAAG,IAAI,EAClFF,KAAK,CAACO,OAAO,CAACU,YAAY,IAAIX,SAAS,CAACY,cAAc,CAACL,SAAS,gBAAGJ,6BAACU,cAAc;IAACnB,KAAK,EAAEA;IAAS,GAAG,IAAI,EAC1GM,SAAS,CAACc,QAAQ,CAACP,SAAS,gBAAGJ,6BAACY,WAAW;IAACrB,KAAK,EAAEA,KAAK;IAAEC,UAAU,EAAEA;IAAc,GAAG,IAAI,EAC3FH,KAAK,EACLwB,aAAa,CAAC1B,KAA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gBA,CAAkBT,KAA0B;EACjE,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEE;GAAO,GAAGJ,KAAK;EACpC,MAAMU,SAAS,GAAGN,KAAK,CAACO,OAAO,CAACC,IAAwB;EAExD,MAAMoC,oBAAoB,GAAG5C,KAAK,CAACO,OAAO,CAACU,YAAY,IAAIX,SAAS,CAACY,cAAc,CAACL,SAAS;EAC7F,MAAMgC,kBAAkB,GACpBD,oBAAoB,IACpBtC,SAAS,CAACM,OAAO,CAACC,SAAS,IAC3BP,SAAS,CAACc,QAAQ,CAACP,SAAS,IAC5Bb,KAAK,CAACO,OAAO,CAACQ,mBAAmB,IACjCT,SAAS,CAACkC,QAAQ,CAAC3B,SAAS,IAC5BP,SAAS,CAAC6B,SAAS,CAACtB,SAAS,IAC7BP,SAAS,CAACoC,MAAM,CAAC7B,SAAS;EAE9B,OAAOgC,kBAAkB,IAAI,CAAC,CAAChD,IAAI,IAAI,CAAC,CAACC,KAAK;AAClD;;;;"}
@@ -8983,7 +8983,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
8983
8983
  ...attributes
8984
8984
  } = props;
8985
8985
  const internalRef = useMergedRef(ref);
8986
- const settingsRef = React__default.useRef(null);
8986
+ const containerRef = React__default.useRef(null);
8987
8987
  const [focused, setFocused] = React__default.useState(false);
8988
8988
  const {
8989
8989
  texts
@@ -8998,8 +8998,8 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
8998
8998
  }
8999
8999
  });
9000
9000
  const handleBlur = event => {
9001
- var _settingsRef$current, _attributes$onBlur;
9002
- if (settingsRef.current && (settingsRef.current === event.relatedTarget || (_settingsRef$current = settingsRef.current) !== null && _settingsRef$current !== void 0 && _settingsRef$current.contains(event.relatedTarget))) {
9001
+ var _containerRef$current, _attributes$onBlur;
9002
+ if (containerRef.current && (containerRef.current === event.relatedTarget || (_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.contains(event.relatedTarget))) {
9003
9003
  return;
9004
9004
  }
9005
9005
  setFocused(false);
@@ -9090,9 +9090,9 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
9090
9090
  }
9091
9091
  });
9092
9092
  }
9093
- const className = cn('peer !pl-7', hasFind ? {
9094
- '!w-48': !value && !focused,
9095
- '!w-72': value || focused
9093
+ const className = cn('!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus', hasFind ? {
9094
+ '!w-48': !value,
9095
+ '!w-72': value
9096
9096
  } : '!w-48', {
9097
9097
  '!wcag-blue-100': isActive
9098
9098
  }, props.className);
@@ -9120,26 +9120,19 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
9120
9120
  value: value !== null && value !== void 0 ? value : ''
9121
9121
  }));
9122
9122
  if (settingsContent) {
9123
- const handleSettingsBlur = event => {
9124
- if (event.currentTarget.contains(event.relatedTarget) || event.currentTarget.contains(event.target)) {
9125
- return;
9126
- }
9127
- setFocused(false);
9128
- };
9123
+ const settingsClassname = cn('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]))]');
9129
9124
  return /*#__PURE__*/React__default.createElement("div", {
9130
- className: cn('relative', {
9131
- "[&_[data-taco='input-container']]:z-20": focused
9132
- }),
9133
- onBlur: handleSettingsBlur,
9134
- ref: settingsRef
9135
- }, input, focused ? /*#__PURE__*/React__default.createElement("div", {
9136
- className: "border-grey-300 absolute left-0 right-0 top-full z-10 flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow",
9125
+ className: "group relative z-10 [&_[data-taco='input-container']]:z-10",
9126
+ ref: containerRef
9127
+ }, input, /*#__PURE__*/React__default.createElement("div", {
9128
+ className: settingsClassname,
9137
9129
  onClickCapture: () => {
9138
9130
  var _internalRef$current5;
9139
9131
  return (_internalRef$current5 = internalRef.current) === null || _internalRef$current5 === void 0 ? void 0 : _internalRef$current5.focus();
9140
9132
  },
9133
+ // tab index is important, it lets the element show as a relatedTarget on event handlers
9141
9134
  tabIndex: -1
9142
- }, settingsContent) : null);
9135
+ }, settingsContent));
9143
9136
  }
9144
9137
  return input;
9145
9138
  });
@@ -18081,7 +18074,7 @@ const Cell$4 = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
18081
18074
  return newTableMeta.currentRow.currentRowIndex === oldTableMeta.currentRow.currentRowIndex && newProps.row.getIsSelected() !== oldProps.row.getIsSelected();
18082
18075
  });
18083
18076
  function createRowSelectionColumn$1(hasDrag, hasExpansion) {
18084
- const size = hasDrag && hasExpansion ? 22 : 4;
18077
+ const size = hasDrag && hasExpansion ? 22 : 40;
18085
18078
  return {
18086
18079
  id: COLUMN_ID$2,
18087
18080
  header: Header$3,
@@ -19158,7 +19151,13 @@ function RowHeight(props) {
19158
19151
  texts
19159
19152
  } = useLocalization();
19160
19153
  const meta = props.table.options.meta;
19161
- const handleChange = value => meta.rowHeight.setHeight(value);
19154
+ const handleChange = value => {
19155
+ const height = value;
19156
+ meta.rowHeight.setHeight(height);
19157
+ if (height === 'short' && meta.fontSize.size === 'large') {
19158
+ meta.fontSize.setSize('medium');
19159
+ }
19160
+ };
19162
19161
  return /*#__PURE__*/React__default.createElement(Menu$1.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup, {
19163
19162
  onChange: handleChange,
19164
19163
  value: meta.rowHeight.height
@@ -20379,7 +20378,7 @@ function Toolbar(props) {
20379
20378
  }
20380
20379
  const tableMeta = table.options.meta;
20381
20380
  return /*#__PURE__*/React__default.createElement("div", {
20382
- className: "mb-4 flex flex-shrink flex-grow-0 gap-2",
20381
+ className: "mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2",
20383
20382
  "data-taco": "table3-toolbar"
20384
20383
  }, left, /*#__PURE__*/React__default.createElement(Group, {
20385
20384
  className: "ml-auto flex-shrink-0 print:hidden"