@economic/taco 1.17.0 → 1.17.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.
- package/dist/esm/index.css +4 -4
- package/dist/esm/packages/taco/src/components/Input/Input.js +14 -24
- package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js +2 -2
- package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
- package/dist/index.css +4 -4
- package/dist/taco.cjs.development.js +15 -25
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.css
CHANGED
@@ -513,7 +513,7 @@
|
|
513
513
|
|
514
514
|
/* rows */
|
515
515
|
.yt-table__row {
|
516
|
-
@apply border-grey-
|
516
|
+
@apply border-grey-200 flex border-b;
|
517
517
|
min-height: 2.5rem;
|
518
518
|
}
|
519
519
|
|
@@ -545,12 +545,12 @@
|
|
545
545
|
}
|
546
546
|
|
547
547
|
.yt-table__head .yt-table__head__group .yt-table__cell.yt-table__cell__group {
|
548
|
-
@apply border-grey-
|
548
|
+
@apply border-grey-200 border-b;
|
549
549
|
flex-basis: 100%;
|
550
550
|
}
|
551
551
|
|
552
552
|
.yt-table__head .yt-table__head__group + .yt-table__head__group {
|
553
|
-
@apply border-grey-
|
553
|
+
@apply border-grey-200 border-l;
|
554
554
|
}
|
555
555
|
|
556
556
|
.yt-table__head .yt-table__cell > [data-taco='icon'] {
|
@@ -558,7 +558,7 @@
|
|
558
558
|
}
|
559
559
|
|
560
560
|
.yt-table__head .yt-table__cell.yt-table__cell__group + .yt-table__cell__group {
|
561
|
-
@apply border-grey-
|
561
|
+
@apply border-grey-200 border-l-2;
|
562
562
|
}
|
563
563
|
|
564
564
|
.yt-table.yt-table--windowed.table-with-scrollbar .yt-table__head {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { forwardRef, createElement, useRef, memo,
|
1
|
+
import { forwardRef, createElement, useRef, memo, cloneElement } from 'react';
|
2
2
|
import cn from 'classnames';
|
3
3
|
import { Icon } from '../Icon/Icon.js';
|
4
4
|
import { getButtonStateClasses, getInputClasses } from './util.js';
|
@@ -43,7 +43,11 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/forwardRef(function InputWit
|
|
43
43
|
'pr-8': !!postfix
|
44
44
|
}, attributes.className);
|
45
45
|
return /*#__PURE__*/createElement("div", {
|
46
|
-
className: "relative inline-flex"
|
46
|
+
className: "relative inline-flex w-full",
|
47
|
+
"data-taco": "input-container",
|
48
|
+
style: {
|
49
|
+
opacity: 0.999
|
50
|
+
}
|
47
51
|
}, /*#__PURE__*/createElement("input", Object.assign({}, attributes, {
|
48
52
|
className: className,
|
49
53
|
"data-taco": "input",
|
@@ -72,30 +76,18 @@ const Affix = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Affix(props, r
|
|
72
76
|
disabled,
|
73
77
|
type
|
74
78
|
} = props;
|
75
|
-
let displayName;
|
76
79
|
if (children) {
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
if (displayName === 'Icon') {
|
82
|
-
el = /*#__PURE__*/cloneElement(children, {
|
83
|
-
className: cn('!h-5 !w-5', children.props.className)
|
84
|
-
});
|
85
|
-
}
|
86
|
-
}
|
87
|
-
return /*#__PURE__*/createElement("span", {
|
88
|
-
className: cn('group absolute top-0 flex h-full items-center justify-center', {
|
80
|
+
return /*#__PURE__*/createElement("div", {
|
81
|
+
className: cn('group absolute top-0 flex h-full items-center justify-center px-2',
|
82
|
+
// icon
|
83
|
+
'[&_[data-taco="icon"]]:!h-5 [&_[data-taco="icon"]]:!w-5', {
|
89
84
|
'text-grey-300': disabled,
|
90
85
|
'text-grey-700': !disabled,
|
91
|
-
'left-0': type === 'prefix',
|
92
|
-
'right-0': type === 'postfix'
|
93
|
-
'px-0': displayName === 'IconButton',
|
94
|
-
'px-1.5': displayName === 'Icon',
|
95
|
-
'px-2': displayName !== 'IconButton' && displayName !== 'Icon'
|
86
|
+
'left-0 [&>button]:!-ml-2': type === 'prefix',
|
87
|
+
'right-0 [&>button]:!-mr-2': type === 'postfix'
|
96
88
|
}),
|
97
89
|
ref: ref
|
98
|
-
},
|
90
|
+
}, children);
|
99
91
|
}
|
100
92
|
return null;
|
101
93
|
}));
|
@@ -109,9 +101,7 @@ const Input = /*#__PURE__*/forwardRef(function LegacyInput(props, ref) {
|
|
109
101
|
let postfix;
|
110
102
|
if (button) {
|
111
103
|
const disabled = button.props.disabled || attributes.disabled;
|
112
|
-
const buttonClassName = cn('items-center focus:z-10 flex justify-center
|
113
|
-
[getButtonStateClasses(attributes.invalid)]: !props.disabled
|
114
|
-
}, button.props.className);
|
104
|
+
const buttonClassName = cn('items-center focus:z-10 flex justify-center rounded-l-none rounded-r h-full focus:rounded focus:outline-none', getButtonStateClasses(attributes.invalid), button.props.className);
|
115
105
|
postfix = /*#__PURE__*/cloneElement(button, {
|
116
106
|
className: buttonClassName,
|
117
107
|
disabled
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../../../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Icon, IconName, IconProps } 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 let handleKeyDown = onKeyDown;\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 handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\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 if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n };\n }\n\n const prefixRef = React.useRef<HTMLSpanElement>(null);\n const prefixRect = useBoundingClientRectListener(prefixRef);\n const postfixRef = React.useRef<HTMLSpanElement>(null);\n const postfixRect = useBoundingClientRectListener(postfixRef);\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\">\n <input\n {...attributes}\n className={className}\n data-taco=\"input\"\n onKeyDown={handleKeyDown}\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<HTMLSpanElement>) {\n const { children, disabled, type } = props;\n\n let displayName: string | undefined;\n\n if (children) {\n let el = children;\n\n if (React.isValidElement<IconProps>(children)) {\n displayName = (children?.type as React.FunctionComponent)?.displayName;\n\n if (displayName === 'Icon') {\n el = React.cloneElement(children, {\n className: cn('!h-5 !w-5', children.props.className),\n } as any);\n }\n }\n\n return (\n <span\n className={cn('group absolute top-0 flex h-full items-center justify-center', {\n 'text-grey-300': disabled,\n 'text-grey-700': !disabled,\n 'left-0': type === 'prefix',\n 'right-0': type === 'postfix',\n 'px-0': displayName === 'IconButton',\n 'px-1.5': displayName === 'Icon',\n 'px-2': displayName !== 'IconButton' && displayName !== 'Icon',\n })}\n ref={ref}>\n {el}\n </span>\n );\n }\n\n return null;\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 border rounded-l-none rounded-r h-full focus:rounded focus:outline-none',\n {\n [getButtonStateClasses(attributes.invalid)]: !props.disabled,\n },\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","includes","event","shiftKey","key","preventDefault","position","currentTarget","value","length","setSelectionRange","prefixRef","prefixRect","useBoundingClientRectListener","postfixRef","postfixRect","className","cn","getInputClasses","style","paddingLeft","width","undefined","paddingRight","Affix","children","disabled","displayName","el","Input","LegacyInput","button","icon","buttonClassName","getButtonStateClasses","Icon","name"],"mappings":";;;;;;;AAgBA,MAAMA,2BAA2B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;AAEhF,MAAMC,8BAA8B,gBAAGC,UAAgB,CAAC,SAASD,8BAA8B,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,IAAIU,aAAa,GAAGP,SAAS;;;;;EAM7B,IAAIP,2BAA2B,CAACe,QAAQ,CAACL,IAAI,CAAC,EAAE;IAC5CI,aAAa,GAAIE,KAA4C;MACzD,IAAI,CAACA,KAAK,CAACC,QAAQ,KAAKD,KAAK,CAACE,GAAG,KAAK,MAAM,IAAIF,KAAK,CAACE,GAAG,KAAK,KAAK,CAAC,EAAE;QAClEF,KAAK,CAACG,cAAc,EAAE;QACtB,MAAMC,QAAQ,GAAGJ,KAAK,CAACE,GAAG,KAAK,KAAK,GAAGF,KAAK,CAACK,aAAa,CAACC,KAAK,CAACC,MAAM,GAAG,CAAC;QAC3EP,KAAK,CAACK,aAAa,CAACG,iBAAiB,CAACJ,QAAQ,EAAEA,QAAQ,CAAC;;MAG7D,IAAI,OAAOb,SAAS,KAAK,UAAU,EAAE;QACjCA,SAAS,CAACS,KAAK,CAAC;;KAEvB;;EAGL,MAAMS,SAAS,GAAGvB,MAAY,CAAkB,IAAI,CAAC;EACrD,MAAMwB,UAAU,GAAGC,6BAA6B,CAACF,SAAS,CAAC;EAC3D,MAAMG,UAAU,GAAG1B,MAAY,CAAkB,IAAI,CAAC;EACtD,MAAM2B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AAkB,CAAC2C,MAAM,EAAE;MACjCf,SAAS,EAAEiB,eAAe;MAC1BP;KACH,CAAC;GACL,MAAM,IAAIM,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,yBAAEG,UAAU,CAACH,OAAO,qEAAIA,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 'classnames';\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 let handleKeyDown = onKeyDown;\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 handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\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 if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\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);\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 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 if (children) {\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 ref={ref}>\n {children}\n </div>\n );\n }\n\n return null;\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),\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","includes","event","shiftKey","key","preventDefault","position","currentTarget","value","length","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"],"mappings":";;;;;;;AAgBA,MAAMA,2BAA2B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;AAEhF,MAAMC,8BAA8B,gBAAGC,UAAgB,CAAC,SAASD,8BAA8B,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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MAAM,EAAE;IACR,MAAMH,QAAQ,GAAGG,MAAM,CAACzC,KAAK,CAACsC,QAAQ,IAAI9B,UAAU,CAAC8B,QAAQ;IAC7D,MAAMK,eAAe,GAAGf,EAAE,CACtB,8GAA8G,EAC9GgB,qBAAqB,CAACpC,UAAU,CAACL,OAAO,CAAC,EACzCsC,MAAM,CAACzC,KAAK,CAAC2B,SAAS,CACzB;IACDtB,OAAO,gBAAGN,YAAkB,CAAC0C,MAAM,EAAE;MACjCd,SAAS,EAAEgB,eAAe;MAC1BL;KACH,CAAC;GACL,MAAM,IAAII,IAAI,EAAE;IACbrC,OAAO,GAAG,OAAOqC,IAAI,KAAK,QAAQ,gBAAG3C,cAAC8C,IAAI;MAACC,IAAI,EAAEJ;MAAQ,GAAGA,IAAI;;EAGpE,oBAAO3C,cAACD,8BAA8B,oBAAKU,UAAU;IAAEH,OAAO,yBAAEG,UAAU,CAACH,OAAO,qEAAIA,OAAO;IAAEJ,GAAG,EAAEA;KAAO;AAC/G,CAAC;;;;"}
|
@@ -22,9 +22,9 @@ const getInputClasses = props => {
|
|
22
22
|
};
|
23
23
|
const getButtonStateClasses = invalid => {
|
24
24
|
if (invalid) {
|
25
|
-
return '!border-red-500 group-peer-focus:!border-red-300 focus:yt-focus-red group-focus:group-active:!border-red-300 transition-colors ease-in';
|
25
|
+
return 'border !border-red-500 group-peer-focus:!border-red-300 focus:yt-focus-red group-focus:group-active:!border-red-300 transition-colors ease-in';
|
26
26
|
}
|
27
|
-
return 'border-grey-300 focus:!border-blue-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 transition-colors transition-opacity ease-in';
|
27
|
+
return 'border border-grey-300 focus:!border-blue-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 transition-colors transition-opacity ease-in';
|
28
28
|
};
|
29
29
|
|
30
30
|
export { getButtonStateClasses, getInputClasses };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../../../../src/components/Input/util.ts"],"sourcesContent":["import cn from 'classnames';\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 bg-white text-black text-sm border font-normal not-italic no-underline rounded inline-flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)]',\n {\n // default\n 'border-grey-300 focus:border-blue-300 focus:yt-focus': !invalid,\n 'hover:shadow-[0_0_0.1rem_theme(colors.grey.500)] active:border-blue-700': !invalid && !disabled,\n // disabled\n 'border-grey-200 text-opacity-25 cursor-not-allowed placeholder:text-grey-700': disabled,\n // highlighted\n 'bg-[rgba(255,255,0,0.075)]': props.highlighted && disabled,\n 'bg-[rgba(255,255,0,0.2)]': props.highlighted && !disabled,\n // invalid\n 'border-red focus:border-red-300 focus:yt-focus-red active:border-red-700': invalid,\n 'hover:shadow-[0_0_0.15rem_theme(colors.red.500)]': invalid && !disabled,\n // readOnly\n 'cursor-not-allowed text-black bg-grey-200': readOnly,\n }\n );\n};\n\nexport const getButtonStateClasses = (invalid: boolean | undefined): string => {\n if (invalid) {\n return '!border-red-500 group-peer-focus:!border-red-300 focus:yt-focus-red group-focus:group-active:!border-red-300 transition-colors ease-in';\n }\n\n return 'border-grey-300 focus:!border-blue-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 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,iOAAiO,EACjO;;IAEI,sDAAsD,EAAE,CAACD,OAAO;IAChE,yEAAyE,EAAE,CAACA,OAAO,IAAI,CAACF,QAAQ;;IAEhG,8EAA8E,EAAEA,QAAQ;;IAExF,4BAA4B,EAAED,KAAK,CAACK,WAAW,IAAIJ,QAAQ;IAC3D,0BAA0B,EAAED,KAAK,CAACK,WAAW,IAAI,CAACJ,QAAQ;;IAE1D,0EAA0E,EAAEE,OAAO;IACnF,kDAAkD,EAAEA,OAAO,IAAI,CAACF,QAAQ;;IAExE,2CAA2C,EAAEC;GAChD,CACJ;AACL;MAEaI,qBAAqB,GAAIH,OAA4B;EAC9D,IAAIA,OAAO,EAAE;IACT,OAAO
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../../../../src/components/Input/util.ts"],"sourcesContent":["import cn from 'classnames';\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 bg-white text-black text-sm border font-normal not-italic no-underline rounded inline-flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)]',\n {\n // default\n 'border-grey-300 focus:border-blue-300 focus:yt-focus': !invalid,\n 'hover:shadow-[0_0_0.1rem_theme(colors.grey.500)] active:border-blue-700': !invalid && !disabled,\n // disabled\n 'border-grey-200 text-opacity-25 cursor-not-allowed placeholder:text-grey-700': disabled,\n // highlighted\n 'bg-[rgba(255,255,0,0.075)]': props.highlighted && disabled,\n 'bg-[rgba(255,255,0,0.2)]': props.highlighted && !disabled,\n // invalid\n 'border-red focus:border-red-300 focus:yt-focus-red active:border-red-700': invalid,\n 'hover:shadow-[0_0_0.15rem_theme(colors.red.500)]': invalid && !disabled,\n // readOnly\n 'cursor-not-allowed text-black bg-grey-200': readOnly,\n }\n );\n};\n\nexport const getButtonStateClasses = (invalid: boolean | undefined): string => {\n if (invalid) {\n return 'border !border-red-500 group-peer-focus:!border-red-300 focus:yt-focus-red group-focus:group-active:!border-red-300 transition-colors ease-in';\n }\n\n return 'border border-grey-300 focus:!border-blue-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 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,iOAAiO,EACjO;;IAEI,sDAAsD,EAAE,CAACD,OAAO;IAChE,yEAAyE,EAAE,CAACA,OAAO,IAAI,CAACF,QAAQ;;IAEhG,8EAA8E,EAAEA,QAAQ;;IAExF,4BAA4B,EAAED,KAAK,CAACK,WAAW,IAAIJ,QAAQ;IAC3D,0BAA0B,EAAED,KAAK,CAACK,WAAW,IAAI,CAACJ,QAAQ;;IAE1D,0EAA0E,EAAEE,OAAO;IACnF,kDAAkD,EAAEA,OAAO,IAAI,CAACF,QAAQ;;IAExE,2CAA2C,EAAEC;GAChD,CACJ;AACL;MAEaI,qBAAqB,GAAIH,OAA4B;EAC9D,IAAIA,OAAO,EAAE;IACT,OAAO,+IAA+I;;EAG1J,OAAO,kLAAkL;AAC7L;;;;"}
|
package/dist/index.css
CHANGED
@@ -513,7 +513,7 @@
|
|
513
513
|
|
514
514
|
/* rows */
|
515
515
|
.yt-table__row {
|
516
|
-
@apply border-grey-
|
516
|
+
@apply border-grey-200 flex border-b;
|
517
517
|
min-height: 2.5rem;
|
518
518
|
}
|
519
519
|
|
@@ -545,12 +545,12 @@
|
|
545
545
|
}
|
546
546
|
|
547
547
|
.yt-table__head .yt-table__head__group .yt-table__cell.yt-table__cell__group {
|
548
|
-
@apply border-grey-
|
548
|
+
@apply border-grey-200 border-b;
|
549
549
|
flex-basis: 100%;
|
550
550
|
}
|
551
551
|
|
552
552
|
.yt-table__head .yt-table__head__group + .yt-table__head__group {
|
553
|
-
@apply border-grey-
|
553
|
+
@apply border-grey-200 border-l;
|
554
554
|
}
|
555
555
|
|
556
556
|
.yt-table__head .yt-table__cell > [data-taco='icon'] {
|
@@ -558,7 +558,7 @@
|
|
558
558
|
}
|
559
559
|
|
560
560
|
.yt-table__head .yt-table__cell.yt-table__cell__group + .yt-table__cell__group {
|
561
|
-
@apply border-grey-
|
561
|
+
@apply border-grey-200 border-l-2;
|
562
562
|
}
|
563
563
|
|
564
564
|
.yt-table.yt-table--windowed.table-with-scrollbar .yt-table__head {
|
@@ -3904,9 +3904,9 @@ const getInputClasses = props => {
|
|
3904
3904
|
};
|
3905
3905
|
const getButtonStateClasses = invalid => {
|
3906
3906
|
if (invalid) {
|
3907
|
-
return '!border-red-500 group-peer-focus:!border-red-300 focus:yt-focus-red group-focus:group-active:!border-red-300 transition-colors ease-in';
|
3907
|
+
return 'border !border-red-500 group-peer-focus:!border-red-300 focus:yt-focus-red group-focus:group-active:!border-red-300 transition-colors ease-in';
|
3908
3908
|
}
|
3909
|
-
return 'border-grey-300 focus:!border-blue-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 transition-colors transition-opacity ease-in';
|
3909
|
+
return 'border border-grey-300 focus:!border-blue-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 transition-colors transition-opacity ease-in';
|
3910
3910
|
};
|
3911
3911
|
|
3912
3912
|
const debounce = (fn, delay) => {
|
@@ -4008,7 +4008,11 @@ const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function In
|
|
4008
4008
|
'pr-8': !!postfix
|
4009
4009
|
}, attributes.className);
|
4010
4010
|
return /*#__PURE__*/React.createElement("div", {
|
4011
|
-
className: "relative inline-flex"
|
4011
|
+
className: "relative inline-flex w-full",
|
4012
|
+
"data-taco": "input-container",
|
4013
|
+
style: {
|
4014
|
+
opacity: 0.999
|
4015
|
+
}
|
4012
4016
|
}, /*#__PURE__*/React.createElement("input", Object.assign({}, attributes, {
|
4013
4017
|
className: className,
|
4014
4018
|
"data-taco": "input",
|
@@ -4037,30 +4041,18 @@ const Affix = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Af
|
|
4037
4041
|
disabled,
|
4038
4042
|
type
|
4039
4043
|
} = props;
|
4040
|
-
let displayName;
|
4041
4044
|
if (children) {
|
4042
|
-
|
4043
|
-
|
4044
|
-
|
4045
|
-
|
4046
|
-
if (displayName === 'Icon') {
|
4047
|
-
el = /*#__PURE__*/React.cloneElement(children, {
|
4048
|
-
className: cn('!h-5 !w-5', children.props.className)
|
4049
|
-
});
|
4050
|
-
}
|
4051
|
-
}
|
4052
|
-
return /*#__PURE__*/React.createElement("span", {
|
4053
|
-
className: cn('group absolute top-0 flex h-full items-center justify-center', {
|
4045
|
+
return /*#__PURE__*/React.createElement("div", {
|
4046
|
+
className: cn('group absolute top-0 flex h-full items-center justify-center px-2',
|
4047
|
+
// icon
|
4048
|
+
'[&_[data-taco="icon"]]:!h-5 [&_[data-taco="icon"]]:!w-5', {
|
4054
4049
|
'text-grey-300': disabled,
|
4055
4050
|
'text-grey-700': !disabled,
|
4056
|
-
'left-0': type === 'prefix',
|
4057
|
-
'right-0': type === 'postfix'
|
4058
|
-
'px-0': displayName === 'IconButton',
|
4059
|
-
'px-1.5': displayName === 'Icon',
|
4060
|
-
'px-2': displayName !== 'IconButton' && displayName !== 'Icon'
|
4051
|
+
'left-0 [&>button]:!-ml-2': type === 'prefix',
|
4052
|
+
'right-0 [&>button]:!-mr-2': type === 'postfix'
|
4061
4053
|
}),
|
4062
4054
|
ref: ref
|
4063
|
-
},
|
4055
|
+
}, children);
|
4064
4056
|
}
|
4065
4057
|
return null;
|
4066
4058
|
}));
|
@@ -4074,9 +4066,7 @@ const Input = /*#__PURE__*/React.forwardRef(function LegacyInput(props, ref) {
|
|
4074
4066
|
let postfix;
|
4075
4067
|
if (button) {
|
4076
4068
|
const disabled = button.props.disabled || attributes.disabled;
|
4077
|
-
const buttonClassName = cn('items-center focus:z-10 flex justify-center
|
4078
|
-
[getButtonStateClasses(attributes.invalid)]: !props.disabled
|
4079
|
-
}, button.props.className);
|
4069
|
+
const buttonClassName = cn('items-center focus:z-10 flex justify-center rounded-l-none rounded-r h-full focus:rounded focus:outline-none', getButtonStateClasses(attributes.invalid), button.props.className);
|
4080
4070
|
postfix = /*#__PURE__*/React.cloneElement(button, {
|
4081
4071
|
className: buttonClassName,
|
4082
4072
|
disabled
|