@economic/taco 2.21.0 → 2.21.1

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.
@@ -2,6 +2,7 @@ import { forwardRef, createElement, useRef, memo, cloneElement } from 'react';
2
2
  import cn from 'clsx';
3
3
  import { Icon } from '../Icon/Icon.js';
4
4
  import { useMergedRef } from '../../hooks/useMergedRef.js';
5
+ import { isPressingMetaKey } from '../../utils/keyboard.js';
5
6
  import { getButtonStateClasses, getInputClasses } from './util.js';
6
7
  import { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener.js';
7
8
 
@@ -19,7 +20,7 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/forwardRef(function InputWit
19
20
  const internalRef = useMergedRef(ref);
20
21
  const handleKeyDown = event => {
21
22
  // prevent any external keyboard shortcuts from executing while typing single characters in input
22
- if (event.key.length === 1) {
23
+ if (event.key.length === 1 && !isPressingMetaKey(event)) {
23
24
  event.stopPropagation();
24
25
  }
25
26
  // home and end keys only navigate to the start/end of input value if the input container does not scroll
@@ -45,13 +46,22 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/forwardRef(function InputWit
45
46
  'pl-8': !!prefix,
46
47
  'pr-8': !!postfix
47
48
  }, attributes.className);
49
+ const typeAttributes = {
50
+ type
51
+ };
52
+ // https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/
53
+ if (type === 'number') {
54
+ typeAttributes.type = 'text';
55
+ typeAttributes.inputMode = 'numeric';
56
+ typeAttributes.pattern = '[0-9]*';
57
+ }
48
58
  return /*#__PURE__*/createElement("div", {
49
59
  className: "relative inline-flex w-full",
50
60
  "data-taco": "input-container",
51
61
  style: {
52
62
  opacity: 0.999
53
63
  }
54
- }, /*#__PURE__*/createElement("input", Object.assign({}, attributes, {
64
+ }, /*#__PURE__*/createElement("input", Object.assign({}, attributes, typeAttributes, {
55
65
  className: className,
56
66
  "data-taco": "input",
57
67
  onKeyDown: handleKeyDown,
@@ -61,8 +71,7 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/forwardRef(function InputWit
61
71
  style: {
62
72
  paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,
63
73
  paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined
64
- },
65
- type: type
74
+ }
66
75
  })), prefix ? /*#__PURE__*/createElement(Affix, {
67
76
  type: "prefix",
68
77
  children: prefix,
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getButtonStateClasses, getInputClasses } from './util';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { useMergedRef } from '../../hooks/useMergedRef';\n\nexport type InputWithoutDeprecatedFeaturesProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix'> & {\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n postfix?: string | JSX.Element;\n prefix?: string | JSX.Element;\n};\n\nconst validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];\n\nconst InputWithoutDeprecatedFeatures = React.forwardRef(function InputWithoutDeprecatedFeatures(\n props: InputWithoutDeprecatedFeaturesProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { highlighted, invalid, onKeyDown, postfix, prefix, type = 'text', ...attributes } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // prevent any external keyboard shortcuts from executing while typing single characters in input\n if (event.key.length === 1) {\n event.stopPropagation();\n }\n\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n // only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange\n if (validSetSelectionRangeTypes.includes(type)) {\n if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n }\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n };\n\n const prefixRef = React.useRef<HTMLDivElement>(null);\n const prefixRect = useBoundingClientRectListener(prefixRef);\n const postfixRef = React.useRef<HTMLDivElement>(null);\n const postfixRect = useBoundingClientRectListener(postfixRef, [postfix]);\n\n const className = cn(\n getInputClasses(props),\n {\n 'pl-8': !!prefix,\n 'pr-8': !!postfix,\n },\n attributes.className\n );\n\n return (\n <div className=\"relative inline-flex w-full\" data-taco=\"input-container\" style={{ opacity: 0.999 }}>\n <input\n {...attributes}\n className={className}\n data-taco=\"input\"\n onKeyDown={handleKeyDown}\n aria-invalid={invalid}\n data-highlighted={highlighted}\n ref={internalRef}\n style={{\n paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,\n paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined,\n }}\n type={type}\n />\n {prefix ? <Affix type=\"prefix\" children={prefix} disabled={attributes.disabled} ref={prefixRef} /> : null}\n {postfix ? <Affix type=\"postfix\" children={postfix} disabled={attributes.disabled} ref={postfixRef} /> : null}\n </div>\n );\n});\n\ntype AffixProps = {\n children: string | JSX.Element;\n disabled?: boolean;\n type: 'prefix' | 'postfix';\n};\nconst Affix = React.memo(\n React.forwardRef(function Affix(props: AffixProps, ref: React.Ref<HTMLDivElement>) {\n const { children, disabled, type } = props;\n\n return (\n <div\n className={cn(\n 'group absolute top-0 flex h-full items-center justify-center px-2',\n // icon\n '[&_[data-taco=\"icon\"]]:!h-5 [&_[data-taco=\"icon\"]]:!w-5',\n {\n 'text-grey-300': disabled,\n 'text-grey-700': !disabled,\n 'left-0 [&>button]:!-ml-2': type === 'prefix',\n 'right-0 [&>button]:!-mr-2': type === 'postfix',\n }\n )}\n data-affix-type={type}\n ref={ref}>\n {children}\n </div>\n );\n })\n);\n\nexport type InputProps = InputWithoutDeprecatedFeaturesProps & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n};\n\nexport const Input = React.forwardRef(function LegacyInput(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button, icon, ...attributes } = props;\n\n let postfix;\n\n if (button) {\n const disabled = button.props.disabled || attributes.disabled;\n const buttonClassName = cn(\n 'items-center focus:z-10 flex justify-center rounded-l-none rounded-r h-full focus:rounded focus:outline-none',\n getButtonStateClasses(attributes.invalid, disabled),\n button.props.className\n );\n postfix = React.cloneElement(button, {\n className: buttonClassName,\n disabled,\n });\n } else if (icon) {\n postfix = typeof icon === 'string' ? <Icon name={icon} /> : icon;\n }\n\n return <InputWithoutDeprecatedFeatures {...attributes} postfix={attributes.postfix ?? postfix} ref={ref} />;\n});\n"],"names":["validSetSelectionRangeTypes","InputWithoutDeprecatedFeatures","React","props","ref","highlighted","invalid","onKeyDown","postfix","prefix","type","attributes","internalRef","useMergedRef","handleKeyDown","event","key","length","stopPropagation","includes","shiftKey","preventDefault","position","currentTarget","value","setSelectionRange","prefixRef","prefixRect","useBoundingClientRectListener","postfixRef","postfixRect","className","cn","getInputClasses","style","opacity","paddingLeft","width","undefined","paddingRight","Affix","children","disabled","Input","LegacyInput","button","icon","buttonClassName","getButtonStateClasses","Icon","name","_attributes$postfix"],"mappings":";;;;;;;AAgBA,MAAMA,2BAA2B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;AAEhF,MAAMC,8BAA8B,gBAAGC,UAAgB,CAAC,SAASD,8BAA8BA,CAC3FE,KAA0C,EAC1CC,GAAgC;EAEhC,MAAM;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAEC,OAAO;IAAEC,MAAM;IAAEC,IAAI,GAAG,MAAM;IAAE,GAAGC;GAAY,GA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AiB,EAAEC,GAAgC;;EAC1G,MAAM;IAAEyC,MAAM;IAAEC,IAAI;IAAE,GAAGnC;GAAY,GAAGR,KAAK;EAE7C,IAAIK,OAAO;EAEX,IAAIqC,MAAM,EAAE;IACR,MAAMH,QAAQ,GAAGG,MAAM,CAAC1C,KAAK,CAACuC,QAAQ,IAAI/B,UAAU,CAAC+B,QAAQ;IAC7D,MAAMK,eAAe,GAAGf,EAAE,CACtB,8GAA8G,EAC9GgB,qBAAqB,CAACrC,UAAU,CAACL,OAAO,EAAEoC,QAAQ,CAAC,EACnDG,MAAM,CAAC1C,KAAK,CAAC4B,SAAS,CACzB;IACDvB,OAAO,gBAAGN,YAAkB,CAAC2C,MAAM,EAAE;MACjCd,SAAS,EAAEgB,eAAe;MAC1BL;KACH,CAAC;GACL,MAAM,IAAII,IAAI,EAAE;IACbtC,OAAO,GAAG,OAAOsC,IAAI,KAAK,QAAQ,gBAAG5C,cAAC+C,IAAI;MAACC,IAAI,EAAEJ;MAAQ,GAAGA,IAAI;;EAGpE,oBAAO5C,cAACD,8BAA8B,oBAAKU,UAAU;IAAEH,OAAO,GAAA2C,mBAAA,GAAExC,UAAU,CAACH,OAAO,cAAA2C,mBAAA,cAAAA,mBAAA,GAAI3C,OAAO;IAAEJ,GAAG,EAAEA;KAAO;AAC/G,CAAC;;;;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../Icon/Icon';\nimport { getButtonStateClasses, getInputClasses } from './util';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { isPressingMetaKey } from '../../utils/keyboard';\n\nexport type InputWithoutDeprecatedFeaturesProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix'> & {\n /** Draws attention to the input by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n postfix?: string | JSX.Element;\n prefix?: string | JSX.Element;\n};\n\nconst validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];\n\nconst InputWithoutDeprecatedFeatures = React.forwardRef(function InputWithoutDeprecatedFeatures(\n props: InputWithoutDeprecatedFeaturesProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { highlighted, invalid, onKeyDown, postfix, prefix, type = 'text', ...attributes } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // prevent any external keyboard shortcuts from executing while typing single characters in input\n if (event.key.length === 1 && !isPressingMetaKey(event)) {\n event.stopPropagation();\n }\n\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n // only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange\n if (validSetSelectionRangeTypes.includes(type)) {\n if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n }\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n };\n\n const prefixRef = React.useRef<HTMLDivElement>(null);\n const prefixRect = useBoundingClientRectListener(prefixRef);\n const postfixRef = React.useRef<HTMLDivElement>(null);\n const postfixRect = useBoundingClientRectListener(postfixRef, [postfix]);\n\n const className = cn(\n getInputClasses(props),\n {\n 'pl-8': !!prefix,\n 'pr-8': !!postfix,\n },\n attributes.className\n );\n\n const typeAttributes: Partial<React.InputHTMLAttributes<HTMLInputElement>> = {\n type,\n };\n\n // https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/\n if (type === 'number') {\n typeAttributes.type = 'text';\n typeAttributes.inputMode = 'numeric';\n typeAttributes.pattern = '[0-9]*';\n }\n\n return (\n <div className=\"relative inline-flex w-full\" data-taco=\"input-container\" style={{ opacity: 0.999 }}>\n <input\n {...attributes}\n {...typeAttributes}\n className={className}\n data-taco=\"input\"\n onKeyDown={handleKeyDown}\n aria-invalid={invalid}\n data-highlighted={highlighted}\n ref={internalRef}\n style={{\n paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,\n paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined,\n }}\n />\n {prefix ? <Affix type=\"prefix\" children={prefix} disabled={attributes.disabled} ref={prefixRef} /> : null}\n {postfix ? <Affix type=\"postfix\" children={postfix} disabled={attributes.disabled} ref={postfixRef} /> : null}\n </div>\n );\n});\n\ntype AffixProps = {\n children: string | JSX.Element;\n disabled?: boolean;\n type: 'prefix' | 'postfix';\n};\nconst Affix = React.memo(\n React.forwardRef(function Affix(props: AffixProps, ref: React.Ref<HTMLDivElement>) {\n const { children, disabled, type } = props;\n\n return (\n <div\n className={cn(\n 'group absolute top-0 flex h-full items-center justify-center px-2',\n // icon\n '[&_[data-taco=\"icon\"]]:!h-5 [&_[data-taco=\"icon\"]]:!w-5',\n {\n 'text-grey-300': disabled,\n 'text-grey-700': !disabled,\n 'left-0 [&>button]:!-ml-2': type === 'prefix',\n 'right-0 [&>button]:!-mr-2': type === 'postfix',\n }\n )}\n data-affix-type={type}\n ref={ref}>\n {children}\n </div>\n );\n })\n);\n\nexport type InputProps = InputWithoutDeprecatedFeaturesProps & {\n /** Shows a button within the input field */\n button?: React.ReactElement;\n /** Shows an icon within the input field */\n icon?: IconName | JSX.Element;\n};\n\nexport const Input = React.forwardRef(function LegacyInput(props: InputProps, ref: React.Ref<HTMLInputElement>) {\n const { button, icon, ...attributes } = props;\n\n let postfix;\n\n if (button) {\n const disabled = button.props.disabled || attributes.disabled;\n const buttonClassName = cn(\n 'items-center focus:z-10 flex justify-center rounded-l-none rounded-r h-full focus:rounded focus:outline-none',\n getButtonStateClasses(attributes.invalid, disabled),\n button.props.className\n );\n postfix = React.cloneElement(button, {\n className: buttonClassName,\n disabled,\n });\n } else if (icon) {\n postfix = typeof icon === 'string' ? <Icon name={icon} /> : icon;\n }\n\n return <InputWithoutDeprecatedFeatures {...attributes} postfix={attributes.postfix ?? postfix} ref={ref} />;\n});\n"],"names":["validSetSelectionRangeTypes","InputWithoutDeprecatedFeatures","React","props","ref","highlighted","invalid","onKeyDown","postfix","prefix","type","attributes","internalRef","useMergedRef","handleKeyDown","event","key","length","isPressingMetaKey","stopPropagation","includes","shiftKey","preventDefault","position","currentTarget","value","setSelectionRange","prefixRef","prefixRect","useBoundingClientRectListener","postfixRef","postfixRect","className","cn","getInputClasses","typeAttributes","inputMode","pattern","style","opacity","paddingLeft","width","undefined","paddingRight","Affix","children","disabled","Input","LegacyInput","button","icon","buttonClassName","getButtonStateClasses","Icon","name","_attributes$postfix"],"mappings":";;;;;;;;AAiBA,MAAMA,2BAA2B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;AAEhF,MAAMC,8BAA8B,gBAAGC,UAAgB,CAAC,SAASD,8BAA8BA,CAC3FE,KAA0C,EAC1CC,GAAgC;EAEhC,MAAM;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAEC,OAAO;IAAEC,MAAM;IAAEC,IAAI,GAAG,MAAM;IAAE,GAAGC;GAAY,GAAGR,KAAK;EAChG,MAAMS,WAAW,GAAGC,YAAY,CAAmBT,GAAG,CAAC;EAEvD,MAAMU,aAAa,GAAIC,KAA4C;;IAE/D,IAAIA,KAAK,CAACC,GAAG,CAACC,MAAM,KAAK,CAAC,IAAI,CAACC,iBAAiB,CAACH,KAAK,CAAC,EAAE;MACrDA,KAAK,CAACI,eAAe,EAAE;;;;;;IAO3B,IAAInB,2BAA2B,CAACoB,QAAQ,CAACV,IAAI,CAAC,EAAE;MAC5C,IAAI,CAACK,KAAK,CAACM,QAAQ,KAAKN,KAAK,CAACC,GAAG,KAAK,MAAM,IAAID,KAAK,CAACC,GAAG,KA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AC9C,KAAK,CAAC2C,QAAQ,IAAInC,UAAU,CAACmC,QAAQ;IAC7D,MAAMK,eAAe,GAAGlB,EAAE,CACtB,8GAA8G,EAC9GmB,qBAAqB,CAACzC,UAAU,CAACL,OAAO,EAAEwC,QAAQ,CAAC,EACnDG,MAAM,CAAC9C,KAAK,CAAC6B,SAAS,CACzB;IACDxB,OAAO,gBAAGN,YAAkB,CAAC+C,MAAM,EAAE;MACjCjB,SAAS,EAAEmB,eAAe;MAC1BL;KACH,CAAC;GACL,MAAM,IAAII,IAAI,EAAE;IACb1C,OAAO,GAAG,OAAO0C,IAAI,KAAK,QAAQ,gBAAGhD,cAACmD,IAAI;MAACC,IAAI,EAAEJ;MAAQ,GAAGA,IAAI;;EAGpE,oBAAOhD,cAACD,8BAA8B,oBAAKU,UAAU;IAAEH,OAAO,GAAA+C,mBAAA,GAAE5C,UAAU,CAACH,OAAO,cAAA+C,mBAAA,cAAAA,mBAAA,GAAI/C,OAAO;IAAEJ,GAAG,EAAEA;KAAO;AAC/G,CAAC;;;;"}
@@ -4,7 +4,7 @@ const getInputClasses = props => {
4
4
  const disabled = props.disabled || !!props['aria-disabled'];
5
5
  const readOnly = props.readOnly || !!props['aria-readonly'];
6
6
  const invalid = props.invalid || !!props['aria-invalid'];
7
- return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus-visible:yt-focus', {
7
+ return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full [text-align:inherit] text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus-visible:yt-focus', {
8
8
  'bg-white': !props.highlighted && !readOnly,
9
9
  // default
10
10
  'border-grey-300 enabled:hover:border-grey-500 disabled:border-grey-200': !invalid,
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Input/util.ts"],"sourcesContent":["import cn from 'clsx';\n\nexport const getInputClasses = props => {\n const disabled = props.disabled || !!props['aria-disabled'];\n const readOnly = props.readOnly || !!props['aria-readonly'];\n const invalid = props.invalid || !!props['aria-invalid'];\n\n return cn(\n 'peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus-visible:yt-focus',\n {\n 'bg-white': !props.highlighted && !readOnly,\n // default\n 'border-grey-300 enabled:hover:border-grey-500 disabled:border-grey-200': !invalid,\n // disabled\n 'text-opacity-25 cursor-not-allowed placeholder:text-grey-700': disabled,\n // highlighted\n 'bg-yellow-100/50': props.highlighted && disabled,\n 'bg-yellow-100': props.highlighted && !disabled,\n // invalid\n 'border-red-500 enabled:hover:border-red-700 disabled:border-red-500/50': invalid,\n // readOnly\n 'cursor-not-allowed text-black bg-grey-200': readOnly,\n }\n );\n};\n\nexport const getButtonStateClasses = (invalid: boolean | undefined, disabled = false): string => {\n if (invalid) {\n return cn('border border-red-500 group-peer-hover:enabled:border-red-700 transition-colors ease-in', {\n 'border-red-500/30': disabled,\n });\n }\n\n return 'border border-grey-300 group-peer-hover:enabled:border-grey-500 transition-colors transition-opacity ease-in';\n};\n"],"names":["getInputClasses","props","disabled","readOnly","invalid","cn","highlighted","getButtonStateClasses"],"mappings":";;MAEaA,eAAe,GAAGC,KAAK;EAChC,MAAMC,QAAQ,GAAGD,KAAK,CAACC,QAAQ,IAAI,CAAC,CAACD,KAAK,CAAC,eAAe,CAAC;EAC3D,MAAME,QAAQ,GAAGF,KAAK,CAACE,QAAQ,IAAI,CAAC,CAACF,KAAK,CAAC,eAAe,CAAC;EAC3D,MAAMG,OAAO,GAAGH,KAAK,CAACG,OAAO,IAAI,CAAC,CAACH,KAAK,CAAC,cAAc,CAAC;EAExD,OAAOI,EAAE,CACL,wOAAwO,EACxO;IACI,UAAU,EAAE,CAACJ,KAAK,CAACK,WAAW,IAAI,CAACH,QAAQ;;IAE3C,wEAAwE,EAAE,CAACC,OAAO;;IAElF,8DAA8D,EAAEF,QAAQ;;IAExE,kBAAkB,EAAED,KAAK,CAACK,WAAW,IAAIJ,QAAQ;IACjD,eAAe,EAAED,KAAK,CAACK,WAAW,IAAI,CAACJ,QAAQ;;IAE/C,wEAAwE,EAAEE,OAAO;;IAEjF,2CAA2C,EAAED;GAChD,CACJ;AACL;MAEaI,qBAAqB,GAAGA,CAACH,OAA4B,EAAEF,QAAQ,GAAG,KAAK;EAChF,IAAIE,OAAO,EAAE;IACT,OAAOC,EAAE,CAAC,yFAAyF,EAAE;MACjG,mBAAmB,EAAEH;KACxB,CAAC;;EAGN,OAAO,8GAA8G;AACzH;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Input/util.ts"],"sourcesContent":["import cn from 'clsx';\n\nexport const getInputClasses = props => {\n const disabled = props.disabled || !!props['aria-disabled'];\n const readOnly = props.readOnly || !!props['aria-readonly'];\n const invalid = props.invalid || !!props['aria-invalid'];\n\n return cn(\n 'peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full [text-align:inherit] text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus-visible:yt-focus',\n {\n 'bg-white': !props.highlighted && !readOnly,\n // default\n 'border-grey-300 enabled:hover:border-grey-500 disabled:border-grey-200': !invalid,\n // disabled\n 'text-opacity-25 cursor-not-allowed placeholder:text-grey-700': disabled,\n // highlighted\n 'bg-yellow-100/50': props.highlighted && disabled,\n 'bg-yellow-100': props.highlighted && !disabled,\n // invalid\n 'border-red-500 enabled:hover:border-red-700 disabled:border-red-500/50': invalid,\n // readOnly\n 'cursor-not-allowed text-black bg-grey-200': readOnly,\n }\n );\n};\n\nexport const getButtonStateClasses = (invalid: boolean | undefined, disabled = false): string => {\n if (invalid) {\n return cn('border border-red-500 group-peer-hover:enabled:border-red-700 transition-colors ease-in', {\n 'border-red-500/30': disabled,\n });\n }\n\n return 'border border-grey-300 group-peer-hover:enabled:border-grey-500 transition-colors transition-opacity ease-in';\n};\n"],"names":["getInputClasses","props","disabled","readOnly","invalid","cn","highlighted","getButtonStateClasses"],"mappings":";;MAEaA,eAAe,GAAGC,KAAK;EAChC,MAAMC,QAAQ,GAAGD,KAAK,CAACC,QAAQ,IAAI,CAAC,CAACD,KAAK,CAAC,eAAe,CAAC;EAC3D,MAAME,QAAQ,GAAGF,KAAK,CAACE,QAAQ,IAAI,CAAC,CAACF,KAAK,CAAC,eAAe,CAAC;EAC3D,MAAMG,OAAO,GAAGH,KAAK,CAACG,OAAO,IAAI,CAAC,CAACH,KAAK,CAAC,cAAc,CAAC;EAExD,OAAOI,EAAE,CACL,6PAA6P,EAC7P;IACI,UAAU,EAAE,CAACJ,KAAK,CAACK,WAAW,IAAI,CAACH,QAAQ;;IAE3C,wEAAwE,EAAE,CAACC,OAAO;;IAElF,8DAA8D,EAAEF,QAAQ;;IAExE,kBAAkB,EAAED,KAAK,CAACK,WAAW,IAAIJ,QAAQ;IACjD,eAAe,EAAED,KAAK,CAACK,WAAW,IAAI,CAACJ,QAAQ;;IAE/C,wEAAwE,EAAEE,OAAO;;IAEjF,2CAA2C,EAAED;GAChD,CACJ;AACL;MAEaI,qBAAqB,GAAGA,CAACH,OAA4B,EAAEF,QAAQ,GAAG,KAAK;EAChF,IAAIE,OAAO,EAAE;IACT,OAAOC,EAAE,CAAC,yFAAyF,EAAE;MACjG,mBAAmB,EAAEH;KACxB,CAAC;;EAGN,OAAO,8GAA8G;AACzH;;;;"}
@@ -39,7 +39,7 @@ const MemoedGroup = /*#__PURE__*/React__default.memo(function MemoedGroup(props)
39
39
  meta,
40
40
  table
41
41
  } = props;
42
- const containerClassName = cn('px-2 z-10 hover:z-20', colSpan > 1 ? `col-span-${colSpan}` : '', {
42
+ const containerClassName = cn('px-2 z-10 hover:z-20', {
43
43
  sticky: !isPrinting
44
44
  });
45
45
  const innerClassName = cn('font-bold box-content group/column relative', 'px-[var(--table3-cell-padding-x)]', {
@@ -52,6 +52,9 @@ const MemoedGroup = /*#__PURE__*/React__default.memo(function MemoedGroup(props)
52
52
  }
53
53
  return /*#__PURE__*/React__default.createElement("div", {
54
54
  className: containerClassName,
55
+ style: colSpan > 1 ? {
56
+ gridColumn: `span ${colSpan} / span ${colSpan}`
57
+ } : undefined,
55
58
  "data-taco": "table3-column-group",
56
59
  "data-align": align,
57
60
  role: "columnheader"
@@ -1 +1 @@
1
- {"version":3,"file":"Group.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\n\nimport { HeaderProps, HeaderSeparator } from './Header';\nimport { ColumnMeta, TableMeta } from '@tanstack/react-table';\nimport { Table3ColumnAlignment } from '../../../types';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport function Group<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, table, hasSeparator } = props;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const memoedProps = {\n align: 'center' as Table3ColumnAlignment,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasSeparator,\n id: header.id,\n index: header.index,\n isPrinting: tableMeta.printing.isPrinting,\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n table,\n };\n\n return <MemoedGroup<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedGroupProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header' | 'scrollToIndex'> & {\n align?: Table3ColumnAlignment;\n colSpan: number;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isPrinting: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n};\n\nconst MemoedGroup = React.memo(function MemoedGroup<TType = unknown>(props: MemoedGroupProps<TType>) {\n const { align, children, colSpan, hasSeparator, id, isPrinting, meta, table } = props;\n\n const containerClassName = cn('px-2 z-10 hover:z-20', colSpan > 1 ? `col-span-${colSpan}` : '', { sticky: !isPrinting });\n\n const innerClassName = cn(\n 'font-bold box-content group/column relative',\n 'px-[var(--table3-cell-padding-x)]',\n {\n 'h-10 items-center': !isPrinting,\n 'pb-2': isPrinting,\n 'border-b-2': !!children,\n },\n meta.headerClassName\n );\n\n if (table.options.debugAll) {\n console.log('header group render', id);\n }\n\n return (\n <div className={containerClassName} data-taco=\"table3-column-group\" data-align={align} role=\"columnheader\">\n <div className={innerClassName}>\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n {hasSeparator ? <HeaderSeparator /> : null}\n </div>\n </div>\n );\n}) as <TType = unknown>(props: MemoedGroupProps<TType>) => JSX.Element;\n"],"names":["Group","props","children","column","header","table","hasSeparator","columnMeta","React","useMemo","columnDef","meta","tableMeta","options","memoedProps","align","colSpan","id","index","isPrinting","printing","length","getRowModel","rows","MemoedGroup","memo","containerClassName","cn","sticky","innerClassName","headerClassName","debugAll","console","log","className","role","Tooltip","title","String","_meta$tooltip","tooltip","placement","truncate","HeaderSeparator"],"mappings":";;;;;SAQgBA,KAAKA,CAAkBC,KAAyB;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC;GAAc,GAAGL,KAAK;EAC/D,MAAMM,UAAU,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAMN,MAAM,CAACO,SAAS,CAACC,IAAI,EAAE,EAAE,CAA+B;EAC/F,MAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAACF,IAAwB;EAExD,MAAMG,WAAW,GAAG;IAChBC,KAAK,EAAE,QAAiC;IACxCb,QAAQ,EAAEA,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIK,UAAU,CAACH,MAAM;IACvCY,OAAO,EAAEZ,MAAM,CAACY,OAAO;IACvBV,YAAY;IACZW,EAAE,EAAEb,MAAM,CAACa,EAAE;IACbC,KAAK,EAAEd,MAAM,CAACc,KAAK;IACnBC,U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AAC;MAAEe,QAAQ,EAAE,CAACvB;KAAY;KAAIjB,QAAQ,CAAQ,CAC3D,EACTI,YAAY,gBAAGE,6BAACmC,eAAe,OAAG,GAAG,IAAI,CACxC,CACJ;AAEd,CAAC,CAAqE;;;;"}
1
+ {"version":3,"file":"Group.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Group.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\n\nimport { HeaderProps, HeaderSeparator } from './Header';\nimport { ColumnMeta, TableMeta } from '@tanstack/react-table';\nimport { Table3ColumnAlignment } from '../../../types';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport function Group<TType = unknown>(props: HeaderProps<TType>) {\n const { children, column, header, table, hasSeparator } = props;\n const columnMeta = React.useMemo(() => column.columnDef.meta, []) as ColumnMeta<TType, unknown>;\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const memoedProps = {\n align: 'center' as Table3ColumnAlignment,\n children: children ?? columnMeta.header,\n colSpan: header.colSpan,\n hasSeparator,\n id: header.id,\n index: header.index,\n isPrinting: tableMeta.printing.isPrinting,\n length: table.getRowModel().rows.length,\n meta: columnMeta,\n table,\n };\n\n return <MemoedGroup<TType> {...memoedProps} />;\n}\n\n// Memoization\nexport type MemoedGroupProps<TType = unknown> = Omit<HeaderProps<TType>, 'column' | 'header' | 'scrollToIndex'> & {\n align?: Table3ColumnAlignment;\n colSpan: number;\n hasSeparator?: boolean;\n id: string;\n index: number;\n isPrinting: boolean;\n length: number;\n meta: ColumnMeta<TType, unknown>;\n};\n\nconst MemoedGroup = React.memo(function MemoedGroup<TType = unknown>(props: MemoedGroupProps<TType>) {\n const { align, children, colSpan, hasSeparator, id, isPrinting, meta, table } = props;\n\n const containerClassName = cn('px-2 z-10 hover:z-20', { sticky: !isPrinting });\n\n const innerClassName = cn(\n 'font-bold box-content group/column relative',\n 'px-[var(--table3-cell-padding-x)]',\n {\n 'h-10 items-center': !isPrinting,\n 'pb-2': isPrinting,\n 'border-b-2': !!children,\n },\n meta.headerClassName\n );\n\n if (table.options.debugAll) {\n console.log('header group render', id);\n }\n\n return (\n <div\n className={containerClassName}\n style={colSpan > 1 ? { gridColumn: `span ${colSpan} / span ${colSpan}` } : undefined}\n data-taco=\"table3-column-group\"\n data-align={align}\n role=\"columnheader\">\n <div className={innerClassName}>\n <Tooltip title={String(meta?.tooltip ?? children)} placement=\"top\">\n <span className={cn({ truncate: !isPrinting })}>{children}</span>\n </Tooltip>\n {hasSeparator ? <HeaderSeparator /> : null}\n </div>\n </div>\n );\n}) as <TType = unknown>(props: MemoedGroupProps<TType>) => JSX.Element;\n"],"names":["Group","props","children","column","header","table","hasSeparator","columnMeta","React","useMemo","columnDef","meta","tableMeta","options","memoedProps","align","colSpan","id","index","isPrinting","printing","length","getRowModel","rows","MemoedGroup","memo","containerClassName","cn","sticky","innerClassName","headerClassName","debugAll","console","log","className","style","gridColumn","undefined","role","Tooltip","title","String","_meta$tooltip","tooltip","placement","truncate","HeaderSeparator"],"mappings":";;;;;SAQgBA,KAAKA,CAAkBC,KAAyB;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC;GAAc,GAAGL,KAAK;EAC/D,MAAMM,UAAU,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAMN,MAAM,CAACO,SAAS,CAACC,IAAI,EAAE,EAAE,CAA+B;EAC/F,MAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAACF,IAAwB;EAExD,MAAMG,WAAW,GAAG;IAChBC,KAAK,EAAE,QAAiC;IACxCb,QAAQ,EAAEA,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIK,UAAU,CAACH,MAAM;IACvCY,OAAO,EAAEZ,MAAM,CAACY,OAAO;IACvBV,YAAY;IACZW,EAAE,EAAEb,MAAM,CAACa,EAAE;IACbC,KAAK,EAAEd,MAAM,CAACc,KAAK;IACnBC,UAAU,EAAEP,SAAS,CAACQ,QAAQ,CAACD,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AEP,EAAE,CAAC;MAAEkB,QAAQ,EAAE,CAAC1B;KAAY;KAAIjB,QAAQ,CAAQ,CAC3D,EACTI,YAAY,gBAAGE,6BAACsC,eAAe,OAAG,GAAG,IAAI,CACxC,CACJ;AAEd,CAAC,CAAqE;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { forwardRef, createElement } from 'react';
2
2
  import cn from 'clsx';
3
+ import { isPressingMetaKey } from '../../utils/keyboard.js';
3
4
  import { getInputClasses } from '../Input/util.js';
4
5
 
5
6
  const Textarea = /*#__PURE__*/forwardRef(function Textarea(props, ref) {
@@ -16,7 +17,7 @@ const Textarea = /*#__PURE__*/forwardRef(function Textarea(props, ref) {
16
17
  // so we manually override it to ensure _our_ desired behaviour remains intact
17
18
  const handleKeyDown = event => {
18
19
  // prevent any external keyboard shortcuts from executing while typing single characters in textarea
19
- if (event.key.length === 1) {
20
+ if (event.key.length === 1 && !isPressingMetaKey(event)) {
20
21
  event.stopPropagation();
21
22
  }
22
23
  if (event.key === 'Home' || event.key === 'End') {
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../../../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { getInputClasses } from '../Input/util';\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\n /** Draws attention to the textarea by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /** Value of the textarea */\n value?: string;\n};\n\nexport const Textarea = React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\n const { defaultValue: _, highlighted, invalid, onKeyDown, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // prevent any external keyboard shortcuts from executing while typing single characters in textarea\n if (event.key.length === 1) {\n event.stopPropagation();\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\n});\n"],"names":["Textarea","React","props","ref","defaultValue","_","highlighted","invalid","onKeyDown","otherProps","classNames","cn","getInputClasses","className","handleKeyDown","event","key","length","stopPropagation","preventDefault","position","currentTarget","value","setSelectionRange","scrollTop","scrollHeight"],"mappings":";;;;MAaaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQA,CAACE,KAAoB,EAAEC,GAAmC;EAChH,MAAM;IAAEC,YAAY,EAAEC,CAAC;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAE,GAAGC;GAAY,GAAGP,KAAK;EACjF,MAAMQ,UAAU,GAAGC,EAAE,CAACC,eAAe,CAACV,KAAK,CAAC,EAAE,wCAAwC,EAAEA,KAAK,CAACW,SAAS,CAAC;;;;EAKxG,MAAMC,aAAa,GAAIC,KAA+C;;IAElE,IAAIA,KAAK,CAACC,GAAG,CAACC,MAAM,KAAK,CAAC,EAAE;MACxBF,KAAK,CAACG,eAAe,EAAE;;IAG3B,IAAIH,KAAK,CAACC,GAAG,KAAK,MAAM,IAAID,KAAK,CAACC,GAAG,KAAK,KAAK,EAAE;MAC7CD,KAAK,CAACI,cAAc,EAAE;MACtB,MAAMC,QAAQ,GAAGL,KAAK,CAACC,GAAG,KAAK,KAAK,GAAGD,KAAK,CAACM,aAAa,CAACC,KAAK,CAACL,MAAM,GAAG,CAAC;MAC3EF,KAAK,CAACM,aAAa,CAACE,iBAAiB,CAACH,QAAQ,EAAEA,QAAQ,CAAC;MACzDL,KAAK,CAACM,aAAa,CAACG,SAAS,GAAGT,KAAK,CAACC,GAAG,KAAK,KAAK,GAAGD,KAAK,CAACM,aAAa,CAACI,YAAY,GAAG,CAAC;;IAG9F,IAAIjB,SAAS,EAAE;MACXA,SAAS,CAACO,KAAK,CAAC;;GAEvB;EAED,oBAAOd,4CAAcQ,UAAU;IAAEI,SAAS,EAAEH,UAAU;iBAAY,UAAU;IAACF,SAAS,EAAEM,aAAa;IAAEX,GAAG,EAAEA;KAAO;AACvH,CAAC;;;;"}
1
+ {"version":3,"file":"Textarea.js","sources":["../../../../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { getInputClasses } from '../Input/util';\nimport { isPressingMetaKey } from '../../utils/keyboard';\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\n /** Draws attention to the textarea by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /** Value of the textarea */\n value?: string;\n};\n\nexport const Textarea = React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\n const { defaultValue: _, highlighted, invalid, onKeyDown, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // prevent any external keyboard shortcuts from executing while typing single characters in textarea\n if (event.key.length === 1 && !isPressingMetaKey(event)) {\n event.stopPropagation();\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\n});\n"],"names":["Textarea","React","props","ref","defaultValue","_","highlighted","invalid","onKeyDown","otherProps","classNames","cn","getInputClasses","className","handleKeyDown","event","key","length","isPressingMetaKey","stopPropagation","preventDefault","position","currentTarget","value","setSelectionRange","scrollTop","scrollHeight"],"mappings":";;;;;MAcaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQA,CAACE,KAAoB,EAAEC,GAAmC;EAChH,MAAM;IAAEC,YAAY,EAAEC,CAAC;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAE,GAAGC;GAAY,GAAGP,KAAK;EACjF,MAAMQ,UAAU,GAAGC,EAAE,CAACC,eAAe,CAACV,KAAK,CAAC,EAAE,wCAAwC,EAAEA,KAAK,CAACW,SAAS,CAAC;;;;EAKxG,MAAMC,aAAa,GAAIC,KAA+C;;IAElE,IAAIA,KAAK,CAACC,GAAG,CAACC,MAAM,KAAK,CAAC,IAAI,CAACC,iBAAiB,CAACH,KAAK,CAAC,EAAE;MACrDA,KAAK,CAACI,eAAe,EAAE;;IAG3B,IAAIJ,KAAK,CAACC,GAAG,KAAK,MAAM,IAAID,KAAK,CAACC,GAAG,KAAK,KAAK,EAAE;MAC7CD,KAAK,CAACK,cAAc,EAAE;MACtB,MAAMC,QAAQ,GAAGN,KAAK,CAACC,GAAG,KAAK,KAAK,GAAGD,KAAK,CAACO,aAAa,CAACC,KAAK,CAACN,MAAM,GAAG,CAAC;MAC3EF,KAAK,CAACO,aAAa,CAACE,iBAAiB,CAACH,QAAQ,EAAEA,QAAQ,CAAC;MACzDN,KAAK,CAACO,aAAa,CAACG,SAAS,GAAGV,KAAK,CAACC,GAAG,KAAK,KAAK,GAAGD,KAAK,CAACO,aAAa,CAACI,YAAY,GAAG,CAAC;;IAG9F,IAAIlB,SAAS,EAAE;MACXA,SAAS,CAACO,KAAK,CAAC;;GAEvB;EAED,oBAAOd,4CAAcQ,UAAU;IAAEI,SAAS,EAAEH,UAAU;iBAAY,UAAU;IAACF,SAAS,EAAEM,aAAa;IAAEX,GAAG,EAAEA;KAAO;AACvH,CAAC;;;;"}
@@ -9,7 +9,7 @@ export { Accordion } from './components/Accordion/Accordion.js';
9
9
  export { VisuallyHidden } from './components/VisuallyHidden/VisuallyHidden.js';
10
10
  export { Badge } from './components/Badge/Badge.js';
11
11
  export { useMergedRef } from './hooks/useMergedRef.js';
12
- export { createShortcutKeyDownHandler, isEventTriggeredOnInteractiveElement, isMacOs, shouldTriggerShortcut } from './utils/keyboard.js';
12
+ export { createShortcutKeyDownHandler, isEventTriggeredOnInteractiveElement, isMacOs, isPressingMetaKey, shouldTriggerShortcut } from './utils/keyboard.js';
13
13
  export { Tooltip } from './components/Tooltip/Tooltip.js';
14
14
  export { Base, IconButton } from './components/IconButton/IconButton.js';
15
15
  export { LocalizationContext, LocalizationProvider, defaultLocalisationTexts, defaultLocalizationContext, useLocalization } from './components/Provider/Localization.js';
@@ -2,6 +2,9 @@ function isEventTriggeredOnInteractiveElement(eventTarget) {
2
2
  const element = eventTarget;
3
3
  return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
4
4
  }
5
+ function isPressingMetaKey(event) {
6
+ return isMacOs() ? event.metaKey : event.ctrlKey;
7
+ }
5
8
  function shouldTriggerShortcut(event, key) {
6
9
  const keyOptions = typeof key === 'string' ? {
7
10
  key,
@@ -18,7 +21,7 @@ function shouldTriggerShortcut(event, key) {
18
21
  }
19
22
  function createShortcutKeyDownHandler(key, handler, stopPropagation = true) {
20
23
  return function (event) {
21
- if (event.target !== event.currentTarget && isEventTriggeredOnInteractiveElement(event.target)) {
24
+ if (event.target !== event.currentTarget && isEventTriggeredOnInteractiveElement(event.target) && !isPressingMetaKey(event)) {
22
25
  return;
23
26
  }
24
27
  const condition = shouldTriggerShortcut(event, key);
@@ -39,5 +42,5 @@ const isMacOs = () => {
39
42
  return (_window = window) === null || _window === void 0 ? void 0 : _window.navigator.userAgent.includes('Mac');
40
43
  };
41
44
 
42
- export { createShortcutKeyDownHandler, isEventTriggeredOnInteractiveElement, isMacOs, shouldTriggerShortcut };
45
+ export { createShortcutKeyDownHandler, isEventTriggeredOnInteractiveElement, isMacOs, isPressingMetaKey, shouldTriggerShortcut };
43
46
  //# sourceMappingURL=keyboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard.js","sources":["../../../../../../src/utils/keyboard.ts"],"sourcesContent":["import React from 'react';\n\nexport type KeyDownHandlerOptions = { key: string; meta?: boolean; shift?: boolean };\n\nexport function isEventTriggeredOnInteractiveElement(eventTarget: EventTarget | null) {\n const element = eventTarget as HTMLElement;\n\n return (\n ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName) &&\n !element.hidden &&\n !(element as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement).disabled &&\n !(element as HTMLInputElement | HTMLTextAreaElement).readOnly\n );\n}\n\nexport function shouldTriggerShortcut<T = Element>(\n event: KeyboardEvent | React.KeyboardEvent<T>,\n key: string | KeyDownHandlerOptions\n) {\n const keyOptions: KeyDownHandlerOptions = typeof key === 'string' ? { key, meta: false, shift: false } : key;\n\n if (\n (keyOptions.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey)) ||\n (!keyOptions.meta && (isMacOs() ? event.metaKey : event.ctrlKey))\n ) {\n return false;\n }\n\n if ((keyOptions.shift && !event.shiftKey) || (keyOptions.shift === false && event.shiftKey)) {\n return false;\n }\n\n return event.key.toLowerCase() === keyOptions.key.toLowerCase();\n}\n\nexport function createShortcutKeyDownHandler<T = Element>(\n key: string | KeyDownHandlerOptions,\n handler: (event: KeyboardEvent | React.KeyboardEvent<T>) => void,\n stopPropagation = true\n) {\n return function (event: KeyboardEvent | React.KeyboardEvent<T>) {\n if (event.target !== event.currentTarget && isEventTriggeredOnInteractiveElement(event.target as HTMLElement)) {\n return;\n }\n\n const condition = shouldTriggerShortcut(event, key);\n\n if (condition) {\n if (stopPropagation) {\n // stops react handlers bubbling up to global\n event.stopPropagation();\n // stops global handlers bubbling up to other global\n (event as KeyboardEvent).stopImmediatePropagation?.();\n }\n\n handler(event);\n }\n };\n}\n\nexport const isMacOs = () => window?.navigator.userAgent.includes('Mac');\n"],"names":["isEventTriggeredOnInteractiveElement","eventTarget","element","includes","tagName","hidden","disabled","readOnly","shouldTriggerShortcut","event","key","keyOptions","meta","shift","isMacOs","metaKey","ctrlKey","shiftKey","toLowerCase","createShortcutKeyDownHandler","handler","stopPropagation","target","currentTarget","condition","_event$stopImmediateP","stopImmediatePropagation","call","_window","window","navigator","userAgent"],"mappings":"SAIgBA,oCAAoCA,CAACC,WAA+B;EAChF,MAAMC,OAAO,GAAGD,WAA0B;EAE1C,OACI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAACE,QAAQ,CAACD,OAAO,CAACE,OAAO,CAAC,IACxE,CAACF,OAAO,CAACG,MAAM,IACf,CAAEH,OAA0F,CAACI,QAAQ,IACrG,CAAEJ,OAAkD,CAACK,QAAQ;AAErE;SAEgBC,qBAAqBA,CACjCC,KAA6C,EAC7CC,GAAmC;EAEnC,MAAMC,UAAU,GAA0B,OAAOD,GAAG,KAAK,QAAQ,GAAG;IAAEA,GAAG;IAAEE,IAAI,EAAE,KAAK;IAAEC,KAAK,EAAE;GAAO,GAAGH,GAAG;EAE5G,IACKC,UAAU,CAACC,IAAI,KAAKE,OAAO,EAAE,GAAG,CAACL,KAAK,CAACM,OAAO,GAAG,CAACN,KAAK,CAACO,OAAO,CAAC,IAChE,CAACL,UAAU,CAACC,IAAI,KAAKE,OAAO,EAAE,GAAGL,KAAK,CAACM,OAAO,GAAGN,KAAK,CAACO,OAAO,CAAE,EACnE;IACE,OAAO,KAAK;;EAGhB,IAAKL,UAAU,CAACE,KAAK,IAAI,CAACJ,KAAK,CAACQ,QAAQ,IAAMN,UAAU,CAACE,KAAK,KAAK,KAAK,IAAIJ,KAAK,CAACQ,QAAS,EAAE;IACzF,OAAO,KAAK;;EAGhB,OAAOR,KAAK,CAACC,GAAG,CAACQ,WAAW,EAAE,KAAKP,UAAU,CAACD,GAAG,CAACQ,WAAW,EAAE;AACnE;SAEgBC,4BAA4BA,CACxCT,GAAmC,EACnCU,OAAgE,EAChEC,eAAe,GAAG,IAAI;EAEtB,OAAO,UAAUZ,KAA6C;IAC1D,IAAIA,KAAK,CAACa,MAAM,KAAKb,KAAK,CAACc,aAAa,IAAIvB,oCAAoC,CAACS,KAAK,CAACa,MAAqB,CAAC,EAAE;MAC3G;;IAGJ,MAAME,SAAS,GAAGhB,qBAAqB,CAACC,KAAK,EAAEC,GAAG,CAAC;IAEnD,IAAIc,SAAS,EAAE;MACX,IAAIH,eAAe,EAAE;QAAA,IAAAI,qBAAA;;QAEjBhB,KAAK,CAACY,eAAe,EAAE;;QAEtB,CAAAI,qBAAA,GAAAhB,KAAuB,CAACiB,wBAAwB,cAAAD,qBAAA,uBAAhDA,qBAAA,CAAAE,IAAA,CAAAlB,MAAoD;;MAGzDW,OAAO,CAACX,KAAK,CAAC;;GAErB;AACL;MAEaK,OAAO,GAAGA;EAAA,IAAAc,OAAA;EAAA,QAAAA,OAAA,GAAMC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQE,SAAS,CAACC,SAAS,CAAC5B,QAAQ,CAAC,KAAK,CAAC;AAAA;;;;"}
1
+ {"version":3,"file":"keyboard.js","sources":["../../../../../../src/utils/keyboard.ts"],"sourcesContent":["import React from 'react';\n\nexport type KeyDownHandlerOptions = { key: string; meta?: boolean; shift?: boolean };\n\nexport function isEventTriggeredOnInteractiveElement(eventTarget: EventTarget | null) {\n const element = eventTarget as HTMLElement;\n\n return (\n ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName) &&\n !element.hidden &&\n !(element as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement).disabled &&\n !(element as HTMLInputElement | HTMLTextAreaElement).readOnly\n );\n}\n\nexport function isPressingMetaKey<T = Element>(event: KeyboardEvent | React.KeyboardEvent<T>) {\n return isMacOs() ? event.metaKey : event.ctrlKey;\n}\n\nexport function shouldTriggerShortcut<T = Element>(\n event: KeyboardEvent | React.KeyboardEvent<T>,\n key: string | KeyDownHandlerOptions\n) {\n const keyOptions: KeyDownHandlerOptions = typeof key === 'string' ? { key, meta: false, shift: false } : key;\n\n if (\n (keyOptions.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey)) ||\n (!keyOptions.meta && (isMacOs() ? event.metaKey : event.ctrlKey))\n ) {\n return false;\n }\n\n if ((keyOptions.shift && !event.shiftKey) || (keyOptions.shift === false && event.shiftKey)) {\n return false;\n }\n\n return event.key.toLowerCase() === keyOptions.key.toLowerCase();\n}\n\nexport function createShortcutKeyDownHandler<T = Element>(\n key: string | KeyDownHandlerOptions,\n handler: (event: KeyboardEvent | React.KeyboardEvent<T>) => void,\n stopPropagation = true\n) {\n return function (event: KeyboardEvent | React.KeyboardEvent<T>) {\n if (\n event.target !== event.currentTarget &&\n isEventTriggeredOnInteractiveElement(event.target as HTMLElement) &&\n !isPressingMetaKey(event)\n ) {\n return;\n }\n\n const condition = shouldTriggerShortcut(event, key);\n\n if (condition) {\n if (stopPropagation) {\n // stops react handlers bubbling up to global\n event.stopPropagation();\n // stops global handlers bubbling up to other global\n (event as KeyboardEvent).stopImmediatePropagation?.();\n }\n\n handler(event);\n }\n };\n}\n\nexport const isMacOs = () => window?.navigator.userAgent.includes('Mac');\n"],"names":["isEventTriggeredOnInteractiveElement","eventTarget","element","includes","tagName","hidden","disabled","readOnly","isPressingMetaKey","event","isMacOs","metaKey","ctrlKey","shouldTriggerShortcut","key","keyOptions","meta","shift","shiftKey","toLowerCase","createShortcutKeyDownHandler","handler","stopPropagation","target","currentTarget","condition","_event$stopImmediateP","stopImmediatePropagation","call","_window","window","navigator","userAgent"],"mappings":"SAIgBA,oCAAoCA,CAACC,WAA+B;EAChF,MAAMC,OAAO,GAAGD,WAA0B;EAE1C,OACI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAACE,QAAQ,CAACD,OAAO,CAACE,OAAO,CAAC,IACxE,CAACF,OAAO,CAACG,MAAM,IACf,CAAEH,OAA0F,CAACI,QAAQ,IACrG,CAAEJ,OAAkD,CAACK,QAAQ;AAErE;SAEgBC,iBAAiBA,CAAcC,KAA6C;EACxF,OAAOC,OAAO,EAAE,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACG,OAAO;AACpD;SAEgBC,qBAAqBA,CACjCJ,KAA6C,EAC7CK,GAAmC;EAEnC,MAAMC,UAAU,GAA0B,OAAOD,GAAG,KAAK,QAAQ,GAAG;IAAEA,GAAG;IAAEE,IAAI,EAAE,KAAK;IAAEC,KAAK,EAAE;GAAO,GAAGH,GAAG;EAE5G,IACKC,UAAU,CAACC,IAAI,KAAKN,OAAO,EAAE,GAAG,CAACD,KAAK,CAACE,OAAO,GAAG,CAACF,KAAK,CAACG,OAAO,CAAC,IAChE,CAACG,UAAU,CAACC,IAAI,KAAKN,OAAO,EAAE,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACG,OAAO,CAAE,EACnE;IACE,OAAO,KAAK;;EAGhB,IAAKG,UAAU,CAACE,KAAK,IAAI,CAACR,KAAK,CAACS,QAAQ,IAAMH,UAAU,CAACE,KAAK,KAAK,KAAK,IAAIR,KAAK,CAACS,QAAS,EAAE;IACzF,OAAO,KAAK;;EAGhB,OAAOT,KAAK,CAACK,GAAG,CAACK,WAAW,EAAE,KAAKJ,UAAU,CAACD,GAAG,CAACK,WAAW,EAAE;AACnE;SAEgBC,4BAA4BA,CACxCN,GAAmC,EACnCO,OAAgE,EAChEC,eAAe,GAAG,IAAI;EAEtB,OAAO,UAAUb,KAA6C;IAC1D,IACIA,KAAK,CAACc,MAAM,KAAKd,KAAK,CAACe,aAAa,IACpCxB,oCAAoC,CAACS,KAAK,CAACc,MAAqB,CAAC,IACjE,CAACf,iBAAiB,CAACC,KAAK,CAAC,EAC3B;MACE;;IAGJ,MAAMgB,SAAS,GAAGZ,qBAAqB,CAACJ,KAAK,EAAEK,GAAG,CAAC;IAEnD,IAAIW,SAAS,EAAE;MACX,IAAIH,eAAe,EAAE;QAAA,IAAAI,qBAAA;;QAEjBjB,KAAK,CAACa,eAAe,EAAE;;QAEtB,CAAAI,qBAAA,GAAAjB,KAAuB,CAACkB,wBAAwB,cAAAD,qBAAA,uBAAhDA,qBAAA,CAAAE,IAAA,CAAAnB,MAAoD;;MAGzDY,OAAO,CAACZ,KAAK,CAAC;;GAErB;AACL;MAEaC,OAAO,GAAGA;EAAA,IAAAmB,OAAA;EAAA,QAAAA,OAAA,GAAMC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQE,SAAS,CAACC,SAAS,CAAC7B,QAAQ,CAAC,KAAK,CAAC;AAAA;;;;"}
@@ -4018,6 +4018,9 @@ function isEventTriggeredOnInteractiveElement(eventTarget) {
4018
4018
  const element = eventTarget;
4019
4019
  return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
4020
4020
  }
4021
+ function isPressingMetaKey(event) {
4022
+ return isMacOs() ? event.metaKey : event.ctrlKey;
4023
+ }
4021
4024
  function shouldTriggerShortcut(event, key) {
4022
4025
  const keyOptions = typeof key === 'string' ? {
4023
4026
  key,
@@ -4034,7 +4037,7 @@ function shouldTriggerShortcut(event, key) {
4034
4037
  }
4035
4038
  function createShortcutKeyDownHandler(key, handler, stopPropagation = true) {
4036
4039
  return function (event) {
4037
- if (event.target !== event.currentTarget && isEventTriggeredOnInteractiveElement(event.target)) {
4040
+ if (event.target !== event.currentTarget && isEventTriggeredOnInteractiveElement(event.target) && !isPressingMetaKey(event)) {
4038
4041
  return;
4039
4042
  }
4040
4043
  const condition = shouldTriggerShortcut(event, key);
@@ -4879,7 +4882,7 @@ const getInputClasses = props => {
4879
4882
  const disabled = props.disabled || !!props['aria-disabled'];
4880
4883
  const readOnly = props.readOnly || !!props['aria-readonly'];
4881
4884
  const invalid = props.invalid || !!props['aria-invalid'];
4882
- return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus-visible:yt-focus', {
4885
+ return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full [text-align:inherit] text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus-visible:yt-focus', {
4883
4886
  'bg-white': !props.highlighted && !readOnly,
4884
4887
  // default
4885
4888
  'border-grey-300 enabled:hover:border-grey-500 disabled:border-grey-200': !invalid,
@@ -4963,7 +4966,7 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function In
4963
4966
  const internalRef = useMergedRef(ref);
4964
4967
  const handleKeyDown = event => {
4965
4968
  // prevent any external keyboard shortcuts from executing while typing single characters in input
4966
- if (event.key.length === 1) {
4969
+ if (event.key.length === 1 && !isPressingMetaKey(event)) {
4967
4970
  event.stopPropagation();
4968
4971
  }
4969
4972
  // home and end keys only navigate to the start/end of input value if the input container does not scroll
@@ -4989,13 +4992,22 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function In
4989
4992
  'pl-8': !!prefix,
4990
4993
  'pr-8': !!postfix
4991
4994
  }, attributes.className);
4995
+ const typeAttributes = {
4996
+ type
4997
+ };
4998
+ // https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/
4999
+ if (type === 'number') {
5000
+ typeAttributes.type = 'text';
5001
+ typeAttributes.inputMode = 'numeric';
5002
+ typeAttributes.pattern = '[0-9]*';
5003
+ }
4992
5004
  return /*#__PURE__*/React.createElement("div", {
4993
5005
  className: "relative inline-flex w-full",
4994
5006
  "data-taco": "input-container",
4995
5007
  style: {
4996
5008
  opacity: 0.999
4997
5009
  }
4998
- }, /*#__PURE__*/React.createElement("input", Object.assign({}, attributes, {
5010
+ }, /*#__PURE__*/React.createElement("input", Object.assign({}, attributes, typeAttributes, {
4999
5011
  className: className,
5000
5012
  "data-taco": "input",
5001
5013
  onKeyDown: handleKeyDown,
@@ -5005,8 +5017,7 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function In
5005
5017
  style: {
5006
5018
  paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,
5007
5019
  paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined
5008
- },
5009
- type: type
5020
+ }
5010
5021
  })), prefix ? /*#__PURE__*/React.createElement(Affix, {
5011
5022
  type: "prefix",
5012
5023
  children: prefix,
@@ -14930,7 +14941,7 @@ const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
14930
14941
  // so we manually override it to ensure _our_ desired behaviour remains intact
14931
14942
  const handleKeyDown = event => {
14932
14943
  // prevent any external keyboard shortcuts from executing while typing single characters in textarea
14933
- if (event.key.length === 1) {
14944
+ if (event.key.length === 1 && !isPressingMetaKey(event)) {
14934
14945
  event.stopPropagation();
14935
14946
  }
14936
14947
  if (event.key === 'Home' || event.key === 'End') {
@@ -15851,7 +15862,7 @@ const MemoedGroup = /*#__PURE__*/React__default.memo(function MemoedGroup(props)
15851
15862
  meta,
15852
15863
  table
15853
15864
  } = props;
15854
- const containerClassName = cn('px-2 z-10 hover:z-20', colSpan > 1 ? `col-span-${colSpan}` : '', {
15865
+ const containerClassName = cn('px-2 z-10 hover:z-20', {
15855
15866
  sticky: !isPrinting
15856
15867
  });
15857
15868
  const innerClassName = cn('font-bold box-content group/column relative', 'px-[var(--table3-cell-padding-x)]', {
@@ -15864,6 +15875,9 @@ const MemoedGroup = /*#__PURE__*/React__default.memo(function MemoedGroup(props)
15864
15875
  }
15865
15876
  return /*#__PURE__*/React__default.createElement("div", {
15866
15877
  className: containerClassName,
15878
+ style: colSpan > 1 ? {
15879
+ gridColumn: `span ${colSpan} / span ${colSpan}`
15880
+ } : undefined,
15867
15881
  "data-taco": "table3-column-group",
15868
15882
  "data-align": align,
15869
15883
  role: "columnheader"
@@ -20061,6 +20075,7 @@ exports.icons = icons;
20061
20075
  exports.insertChildTableRow = insertChildTableRow;
20062
20076
  exports.isEventTriggeredOnInteractiveElement = isEventTriggeredOnInteractiveElement;
20063
20077
  exports.isMacOs = isMacOs;
20078
+ exports.isPressingMetaKey = isPressingMetaKey;
20064
20079
  exports.isWeakEqual = isWeakEqual;
20065
20080
  exports.mergeRefs = mergeRefs;
20066
20081
  exports.parseFromCustomString = parseFromCustomString;