@economic/taco 1.0.0 → 1.0.3
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/components/HoverCard/HoverCard.d.ts +16 -0
- package/dist/esm/components/Button/util.js +4 -4
- package/dist/esm/components/Button/util.js.map +1 -1
- package/dist/esm/components/HoverCard/HoverCard.js +33 -0
- package/dist/esm/components/HoverCard/HoverCard.js.map +1 -0
- package/dist/esm/components/SearchInput/SearchInput.js +5 -0
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Table/hooks/plugins/useRowSelect.js +3 -4
- package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
- package/dist/esm/components/Table/util/renderColumn.js +2 -1
- package/dist/esm/components/Table/util/renderColumn.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/taco.cjs.development.js +102 -70
- 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 +3 -2
- package/types.json +405 -379
@@ -0,0 +1,16 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { Placement } from '../..';
|
3
|
+
export declare type HoverCardTriggerProps = React.HTMLAttributes<HTMLAnchorElement>;
|
4
|
+
export declare type HoverCardContentProps = React.HTMLAttributes<HTMLDivElement> & {
|
5
|
+
/** Set the position of the HoverCard relative to its trigger. Default value is `bottom` */
|
6
|
+
placement?: Placement;
|
7
|
+
};
|
8
|
+
export declare type HoverCardProps = React.PropsWithChildren<{}>;
|
9
|
+
export declare const HoverCard: {
|
10
|
+
(props: HoverCardProps): JSX.Element;
|
11
|
+
Trigger: React.ForwardRefExoticComponent<HoverCardTriggerProps & React.RefAttributes<HTMLAnchorElement>>;
|
12
|
+
Content: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
13
|
+
/** Set the position of the HoverCard relative to its trigger. Default value is `bottom` */
|
14
|
+
placement?: "right" | "left" | "top" | "bottom" | undefined;
|
15
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
16
|
+
};
|
@@ -14,18 +14,18 @@ var getAppearanceClasses = function getAppearanceClasses(value, icon) {
|
|
14
14
|
|
15
15
|
switch (value) {
|
16
16
|
case 'primary':
|
17
|
-
return "yt-blue-solid border-blue focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white
|
17
|
+
return "yt-blue-solid border-blue focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white hover:bg-blue-light hover:border-blue-light hover:text-white hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white disabled:hover:yt-blue-solid disabled:hover:hover:border-blue";
|
18
18
|
|
19
19
|
case 'danger':
|
20
|
-
return "yt-red-solid border-red focus:bg-red focus:text-white focus:yt-focus-red active:bg-red-dark active:text-white
|
20
|
+
return "yt-red-solid border-red focus:bg-red focus:text-white focus:yt-focus-red active:bg-red-dark active:text-white hover:bg-red-light hover:text-white hover:focus:bg-red-light hover:focus:text-white disabled:hover:yt-red-solid";
|
21
21
|
|
22
22
|
case 'ghost':
|
23
|
-
return "yt-blue-inverted focus:bg-transparent focus:text-blue focus:yt-focus active:bg-blue-lightest active:border-blue active:text-blue-dark
|
23
|
+
return "yt-blue-inverted focus:bg-transparent focus:text-blue focus:yt-focus active:bg-blue-lightest active:border-blue active:text-blue-dark hover:bg-blue-lightest hover:border-blue-light hover:text-blue-light hover:focus:bg-blue-lightest hover:focus:border-blue-light hover:focus:text-blue-light disabled:hover:yt-blue-inverted";
|
24
24
|
|
25
25
|
case 'discrete':
|
26
26
|
{
|
27
27
|
if (icon) {
|
28
|
-
return "bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-darkest hover:focus:text-grey-darkest disabled:hover:
|
28
|
+
return "bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-darkest hover:focus:text-grey-darkest disabled:hover:text-black ";
|
29
29
|
}
|
30
30
|
|
31
31
|
return "yt-transparent border-transparent focus:text-blue focus:yt-focus active:text-blue-dark hover:text-blue-light hover:focus:text-blue-light disabled:hover:yt-transparent";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center border';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `yt-blue-solid border-blue focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center border';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `yt-blue-solid border-blue focus:bg-blue focus:text-white focus:yt-focus active:bg-blue-dark active:text-white hover:bg-blue-light hover:border-blue-light hover:text-white hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white disabled:hover:yt-blue-solid disabled:hover:hover:border-blue`;\n\n case 'danger':\n return `yt-red-solid border-red focus:bg-red focus:text-white focus:yt-focus-red active:bg-red-dark active:text-white hover:bg-red-light hover:text-white hover:focus:bg-red-light hover:focus:text-white disabled:hover:yt-red-solid`;\n\n case 'ghost':\n return `yt-blue-inverted focus:bg-transparent focus:text-blue focus:yt-focus active:bg-blue-lightest active:border-blue active:text-blue-dark hover:bg-blue-lightest hover:border-blue-light hover:text-blue-light hover:focus:bg-blue-lightest hover:focus:border-blue-light hover:focus:text-blue-light disabled:hover:yt-blue-inverted`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black border-transparent focus:text-black focus:yt-focus active:text-black hover:text-grey-darkest hover:focus:text-grey-darkest disabled:hover:text-black `;\n }\n\n return `yt-transparent border-transparent focus:text-blue focus:yt-focus active:text-blue-dark hover:text-blue-light hover:focus:text-blue-light disabled:hover:yt-transparent`;\n }\n\n default:\n return `yt-grey-solid border-grey focus:bg-grey focus:yt-focus active:bg-grey-dark active:text-black hover:bg-grey-light hover:text-grey-darkest hover:focus:bg-grey-light hover:focus:text-grey-darkest disabled:hover:yt-grey-solid`;\n }\n};\n\nexport const createButton = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { dialog, hanger, menu, popover, tooltip, ...otherProps } = props;\n\n let button = <ButtonPrimitive.Button {...otherProps} className={className} ref={ref} />;\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n } else if (typeof menu === 'function') {\n button = menu({ trigger: button, appearance: otherProps.appearance });\n } else if (typeof popover === 'function') {\n button = popover({ trigger: button });\n }\n\n if (typeof hanger === 'function') {\n button = hanger({ anchor: button });\n }\n\n if (tooltip) {\n button = <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButton","props","className","ref","dialog","hanger","menu","popover","tooltip","otherProps","button","React","ButtonPrimitive","trigger","appearance","anchor","Tooltip","title"],"mappings":";;;;;;IAKaA,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAO,wHAAP;AACH;IAEYC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,KAAD,EAAgCC,IAAhC;MAAgCA;AAAAA,IAAAA,OAAO;;;AACvE,UAAQD,KAAR;AACI,SAAK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MAAAA,MAAM,EAAEL;AAAV,KAAD,CAAf;AACH;;AAED,MAAIF,OAAJ,EAAa;AACTE,IAAAA,MAAM,GAAGC,4BAAA,CAACK,OAAD;AAASC,MAAAA,KAAK,EAAET;KAAhB,EAA0BE,MAA1B,CAAT;AACH;;AAED,SAAOA,MAAP;AACH;;;;"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import { createElement, forwardRef } from 'react';
|
3
|
+
import cn from 'classnames';
|
4
|
+
import { Root, Trigger as Trigger$1, Content as Content$1 } from '@radix-ui/react-hover-card';
|
5
|
+
|
6
|
+
var _excluded = ["placement"];
|
7
|
+
var Trigger = /*#__PURE__*/forwardRef(function HoverCardTrigger(props, ref) {
|
8
|
+
return createElement(Trigger$1, Object.assign({}, props, {
|
9
|
+
asChild: true,
|
10
|
+
ref: ref
|
11
|
+
}));
|
12
|
+
});
|
13
|
+
var Content = /*#__PURE__*/forwardRef(function HoverCardContent(externalProps, ref) {
|
14
|
+
var placement = externalProps.placement,
|
15
|
+
props = _objectWithoutPropertiesLoose(externalProps, _excluded);
|
16
|
+
|
17
|
+
var className = cn('bg-white rounded p-3 yt-shadow', props.className);
|
18
|
+
return createElement(Content$1, Object.assign({}, props, {
|
19
|
+
className: className,
|
20
|
+
ref: ref,
|
21
|
+
side: placement
|
22
|
+
}));
|
23
|
+
});
|
24
|
+
var HoverCard = function HoverCard(props) {
|
25
|
+
return createElement(Root, Object.assign({}, props, {
|
26
|
+
openDelay: 300
|
27
|
+
}));
|
28
|
+
};
|
29
|
+
HoverCard.Trigger = Trigger;
|
30
|
+
HoverCard.Content = Content;
|
31
|
+
|
32
|
+
export { HoverCard };
|
33
|
+
//# sourceMappingURL=HoverCard.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"HoverCard.js","sources":["../../../../src/components/HoverCard/HoverCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as HoverCardPrimitive from '@radix-ui/react-hover-card';\nimport { Placement } from '../..';\n\nexport type HoverCardTriggerProps = React.HTMLAttributes<HTMLAnchorElement>;\nconst Trigger = React.forwardRef(function HoverCardTrigger(props: HoverCardTriggerProps, ref: React.Ref<HTMLAnchorElement>) {\n return <HoverCardPrimitive.Trigger {...props} asChild ref={ref} />;\n});\n\nexport type HoverCardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the HoverCard relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function HoverCardContent(externalProps: HoverCardContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement, ...props } = externalProps;\n const className = cn('bg-white rounded p-3 yt-shadow', props.className);\n\n return <HoverCardPrimitive.Content {...props} className={className} ref={ref} side={placement} />;\n});\n\nexport type HoverCardProps = React.PropsWithChildren<{}>;\n\nexport const HoverCard = (props: HoverCardProps) => {\n return <HoverCardPrimitive.Root {...props} openDelay={300} />;\n};\nHoverCard.Trigger = Trigger;\nHoverCard.Content = Content;\n"],"names":["Trigger","React","HoverCardTrigger","props","ref","HoverCardPrimitive","asChild","Content","HoverCardContent","externalProps","placement","className","cn","side","HoverCard","openDelay"],"mappings":";;;;;;AAMA,IAAMA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,gBAAT,CAA0BC,KAA1B,EAAwDC,GAAxD;AAC7B,SAAOH,aAAA,CAACI,SAAD,oBAAgCF;AAAOG,IAAAA,OAAO;AAACF,IAAAA,GAAG,EAAEA;IAApD,CAAP;AACH,CAFe,CAAhB;AAQA,IAAMG,OAAO,gBAAGN,UAAA,CAAiB,SAASO,gBAAT,CAA0BC,aAA1B,EAAgEL,GAAhE;AAC7B,MAAQM,SAAR,GAAgCD,aAAhC,CAAQC,SAAR;AAAA,MAAsBP,KAAtB,iCAAgCM,aAAhC;;AACA,MAAME,SAAS,GAAGC,EAAE,CAAC,gCAAD,EAAmCT,KAAK,CAACQ,SAAzC,CAApB;AAEA,SAAOV,aAAA,CAACI,SAAD,oBAAgCF;AAAOQ,IAAAA,SAAS,EAAEA;AAAWP,IAAAA,GAAG,EAAEA;AAAKS,IAAAA,IAAI,EAAEH;IAA7E,CAAP;AACH,CALe,CAAhB;IASaI,SAAS,GAAG,SAAZA,SAAY,CAACX,KAAD;AACrB,SAAOF,aAAA,CAACI,IAAD,oBAA6BF;AAAOY,IAAAA,SAAS,EAAE;IAA/C,CAAP;AACH;AACDD,SAAS,CAACd,OAAV,GAAoBA,OAApB;AACAc,SAAS,CAACP,OAAV,GAAoBA,OAApB;;;;"}
|
@@ -29,6 +29,7 @@ import '../Field/Field.js';
|
|
29
29
|
import '../Form/Form.js';
|
30
30
|
import '../Group/Group.js';
|
31
31
|
import '../Hanger/Hanger.js';
|
32
|
+
import '../HoverCard/HoverCard.js';
|
32
33
|
import '../Listbox/Listbox.js';
|
33
34
|
import '../RadioGroup/RadioGroup.js';
|
34
35
|
import '../Menu/Menu.js';
|
@@ -64,11 +65,15 @@ var SearchInput = /*#__PURE__*/forwardRef(function SearchInput(_ref, ref) {
|
|
64
65
|
};
|
65
66
|
|
66
67
|
var handleKeyDown = function handleKeyDown(event) {
|
68
|
+
var _props$onKeyDown;
|
69
|
+
|
67
70
|
var isEnterKeyPressed = event.keyCode === keycode('enter');
|
68
71
|
|
69
72
|
if (isEnterKeyPressed) {
|
70
73
|
handleClick();
|
71
74
|
}
|
75
|
+
|
76
|
+
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
72
77
|
};
|
73
78
|
|
74
79
|
return createElement(Input, Object.assign({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\n\nexport type SearchInputTexts = {\n /**\n * aria-label text for input\n */\n inputLabel: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n if (!props.disabled) {\n onSearch?.(props.value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const isEnterKeyPressed = event.keyCode === keycode('enter');\n\n if (isEnterKeyPressed) {\n handleClick();\n }\n };\n\n return (\n <Input\n aria-label={texts.searchInput.inputLabel}\n {...props}\n button={\n <IconButton\n icon=\"search\"\n className=\"!border-transparent !bg-transparent focus:!border-transparent peer-focus:!border-transparent peer-focus:peer-active:!border-transparent\"\n disabled={props.disabled}\n onClick={handleClick}\n />\n }\n onKeyDown={handleKeyDown}\n ref={ref}\n type=\"search\"\n />\n );\n});\n"],"names":["SearchInput","React","ref","onSearch","props","useLocalization","texts","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","keyCode","keycode","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","
|
1
|
+
{"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\n\nexport type SearchInputTexts = {\n /**\n * aria-label text for input\n */\n inputLabel: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n if (!props.disabled) {\n onSearch?.(props.value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const isEnterKeyPressed = event.keyCode === keycode('enter');\n\n if (isEnterKeyPressed) {\n handleClick();\n }\n\n props.onKeyDown?.(event);\n };\n\n return (\n <Input\n aria-label={texts.searchInput.inputLabel}\n {...props}\n button={\n <IconButton\n icon=\"search\"\n className=\"!border-transparent !bg-transparent focus:!border-transparent peer-focus:!border-transparent peer-focus:peer-active:!border-transparent\"\n disabled={props.disabled}\n onClick={handleClick}\n />\n }\n onKeyDown={handleKeyDown}\n ref={ref}\n type=\"search\"\n />\n );\n});\n"],"names":["SearchInput","React","ref","onSearch","props","useLocalization","texts","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","keyCode","keycode","onKeyDown","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,OAExCE,GAFwC;MACtCC,gBAAAA;MAAaC;;AAGf,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AAEA,MAAMC,WAAW,GAAG,SAAdA,WAAc;AAChB,QAAI,CAACH,KAAK,CAACI,QAAX,EAAqB;AACjBL,MAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGC,KAAK,CAACK,KAAT,CAAR;AACH;AACJ,GAJD;;AAMA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;;;AAClB,QAAMC,iBAAiB,GAAGD,KAAK,CAACE,OAAN,KAAkBC,OAAO,CAAC,OAAD,CAAnD;;AAEA,QAAIF,iBAAJ,EAAuB;AACnBL,MAAAA,WAAW;AACd;;AAED,wBAAAH,KAAK,CAACW,SAAN,2EAAAX,KAAK,EAAaO,KAAb,CAAL;AACH,GARD;;AAUA,SACIV,aAAA,CAACe,KAAD;kBACgBV,KAAK,CAACW,WAAN,CAAkBC;KAC1Bd;AACJe,IAAAA,MAAM,EACFlB,aAAA,CAACmB,UAAD;AACIC,MAAAA,IAAI,EAAC;AACLC,MAAAA,SAAS,EAAC;AACVd,MAAAA,QAAQ,EAAEJ,KAAK,CAACI;AAChBe,MAAAA,OAAO,EAAEhB;KAJb;AAOJQ,IAAAA,SAAS,EAAEL;AACXR,IAAAA,GAAG,EAAEA;AACLsB,IAAAA,IAAI,EAAC;IAbT,CADJ;AAiBH,CAvC0B;;;;"}
|
@@ -63,8 +63,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
|
|
63
63
|
};
|
64
64
|
|
65
65
|
return React__default.createElement(Checkbox, Object.assign({}, props, {
|
66
|
-
onChange: onChange
|
67
|
-
className: "mt-px"
|
66
|
+
onChange: onChange
|
68
67
|
}));
|
69
68
|
},
|
70
69
|
Cell: function Cell(_ref2) {
|
@@ -96,7 +95,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
|
|
96
95
|
};
|
97
96
|
|
98
97
|
return React__default.createElement(Checkbox, Object.assign({}, props, {
|
99
|
-
className: "mt-
|
98
|
+
className: "mt-2.5",
|
100
99
|
onClick: onClick,
|
101
100
|
// this is necessary to remove console spam from eslint
|
102
101
|
onChange: function onChange() {
|
@@ -105,7 +104,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
|
|
105
104
|
}));
|
106
105
|
},
|
107
106
|
flex: '0 0 36px',
|
108
|
-
className: 'flex-col justify-start !
|
107
|
+
className: 'flex-col justify-start !py-0'
|
109
108
|
}].concat(columns);
|
110
109
|
});
|
111
110
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useRowSelect.js","sources":["../../../../../../src/components/Table/hooks/plugins/useRowSelect.tsx"],"sourcesContent":["// this wraps react-table's internal useRowSelect hook\nimport React from 'react';\nimport { useRowSelect as useBaseRowSelect, Row, PluginHook } from 'react-table';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { SelectedRowsHandler } from '../../types';\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\n// react-table calls \"index paths\" row ids. we named them indexPaths to reduce confusion with natural ids\n// the selection hook usess react-table's row selection, so this hok references row.id - it is the index path\n\nexport const useRowSelect = (onSelectedRows: SelectedRowsHandler | undefined): PluginHook<{}> => {\n const plugin = (hooks: any): void => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useBaseRowSelect(hooks);\n\n if (onSelectedRows) {\n const toggleRowSelected = (indexPath: string, checked: boolean): void =>\n onSelectedRows(state => {\n const nextState = { ...state };\n\n if (checked) {\n nextState[indexPath] = true;\n } else {\n delete nextState[indexPath];\n }\n\n return nextState;\n });\n\n const prepareRow = (row: any) => {\n row.toggleRowSelected = () => toggleRowSelected(row.id, !row.isSelected);\n };\n\n hooks.prepareRow.push(prepareRow);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const lastSelectedSortedIndex = React.useRef();\n\n hooks.visibleColumns.push((columns: any) => [\n {\n id: 'selection',\n Header: ({ getToggleAllRowsSelectedProps, rows }: any) => {\n const { onChange: _, ...props } = getToggleAllRowsSelectedProps();\n\n const onChange = (checked): void => {\n if (checked) {\n // this intentionally only selects top level rows - sub rows add too much complexity\n onSelectedRows(Object.assign({}, Array(rows.length).fill(true)));\n } else {\n onSelectedRows({});\n }\n };\n\n return <Checkbox {...props} onChange={onChange}
|
1
|
+
{"version":3,"file":"useRowSelect.js","sources":["../../../../../../src/components/Table/hooks/plugins/useRowSelect.tsx"],"sourcesContent":["// this wraps react-table's internal useRowSelect hook\nimport React from 'react';\nimport { useRowSelect as useBaseRowSelect, Row, PluginHook } from 'react-table';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { SelectedRowsHandler } from '../../types';\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\n// react-table calls \"index paths\" row ids. we named them indexPaths to reduce confusion with natural ids\n// the selection hook usess react-table's row selection, so this hok references row.id - it is the index path\n\nexport const useRowSelect = (onSelectedRows: SelectedRowsHandler | undefined): PluginHook<{}> => {\n const plugin = (hooks: any): void => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useBaseRowSelect(hooks);\n\n if (onSelectedRows) {\n const toggleRowSelected = (indexPath: string, checked: boolean): void =>\n onSelectedRows(state => {\n const nextState = { ...state };\n\n if (checked) {\n nextState[indexPath] = true;\n } else {\n delete nextState[indexPath];\n }\n\n return nextState;\n });\n\n const prepareRow = (row: any) => {\n row.toggleRowSelected = () => toggleRowSelected(row.id, !row.isSelected);\n };\n\n hooks.prepareRow.push(prepareRow);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const lastSelectedSortedIndex = React.useRef();\n\n hooks.visibleColumns.push((columns: any) => [\n {\n id: 'selection',\n Header: ({ getToggleAllRowsSelectedProps, rows }: any) => {\n const { onChange: _, ...props } = getToggleAllRowsSelectedProps();\n\n const onChange = (checked): void => {\n if (checked) {\n // this intentionally only selects top level rows - sub rows add too much complexity\n onSelectedRows(Object.assign({}, Array(rows.length).fill(true)));\n } else {\n onSelectedRows({});\n }\n };\n\n return <Checkbox {...props} onChange={onChange} />;\n },\n Cell: ({ row, rows }: any) => {\n const { onChange: _, ...props } = row.getToggleRowSelectedProps();\n // row.index refers to the index in the original data, not the current index\n const sortedIndex = rows.findIndex((r: Row) => r.index === row.index);\n\n const onClick = (event: React.MouseEvent): void => {\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(lastSelectedSortedIndex.current || 0, sortedIndex);\n\n for (let i = fromIndex; i <= toIndex; i++) {\n toggleRowSelected(rows[i].id, true);\n }\n } else {\n toggleRowSelected(row.id, !props.checked);\n }\n\n lastSelectedSortedIndex.current = sortedIndex;\n };\n\n return (\n <Checkbox\n {...props}\n className=\"mt-2.5\"\n onClick={onClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n );\n },\n flex: '0 0 36px',\n className: 'flex-col justify-start !py-0',\n },\n ...columns,\n ]);\n }\n };\n plugin.pluginName = 'useRowSelect';\n return plugin;\n};\n"],"names":["toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","useRowSelect","onSelectedRows","plugin","hooks","useBaseRowSelect","toggleRowSelected","indexPath","checked","state","nextState","prepareRow","row","id","isSelected","push","lastSelectedSortedIndex","React","useRef","visibleColumns","columns","Header","getToggleAllRowsSelectedProps","rows","props","onChange","Object","assign","Array","length","fill","Checkbox","Cell","getToggleRowSelectedProps","sortedIndex","findIndex","r","index","onClick","event","shiftKey","current","i","className","flex","pluginName"],"mappings":";;;;;;;;AAMA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,YAAD,EAAuBC,UAAvB;AAClB,MAAMC,SAAS,GAAGD,UAAU,GAAGD,YAAb,GAA4BC,UAA5B,GAAyCD,YAA3D;AACA,MAAMG,OAAO,GAAGF,UAAU,GAAGD,YAAb,GAA4BC,UAA5B,GAAyCD,YAAzD;AAEA,SAAO,CAACE,SAAD,EAAYC,OAAZ,CAAP;AACH,CALD;AAQA;;;IAEaC,YAAY,GAAG,SAAfA,YAAe,CAACC,cAAD;AACxB,MAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AACX;AACAC,IAAAA,cAAgB,CAACD,KAAD,CAAhB;;AAEA,QAAIF,cAAJ,EAAoB;AAChB,UAAMI,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,SAAD,EAAoBC,OAApB;AAAA,eACtBN,cAAc,CAAC,UAAAO,KAAK;AAChB,cAAMC,SAAS,gBAAQD,KAAR,CAAf;;AAEA,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), React__default.createElement("span", {
|
32
32
|
className: "truncate"
|
33
33
|
}, cell.render('Header')), cell.isSorted ? React__default.createElement(Icon, {
|
34
|
-
name: cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'
|
34
|
+
name: cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid',
|
35
|
+
className: "-mt-0.5"
|
35
36
|
}) : null);
|
36
37
|
};
|
37
38
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"renderColumn.js","sources":["../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon } from '../../Icon/Icon';\n\nexport const Column = ({ cell }: any): any => {\n const props = {\n ...cell.getHeaderProps(),\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\n className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-darkest hover:text-black', cell.className, {\n 'yt-table__cell__group': !!cell.columns,\n 'cursor-pointer': !cell.disableSorting,\n 'justify-start text-left': cell.align === 'left',\n 'justify-end text-right': cell.align === 'right',\n 'justify-center text-center': cell.align === 'center' || !cell.align,\n }),\n style: { ...cell.style, flex: cell.flex },\n };\n\n if (cell.isSorted) {\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\n }\n\n return (\n <div {...props} key={cell.id} data-taco=\"table-column\">\n <span className=\"truncate\">{cell.render('Header')}</span>\n {cell.isSorted ? <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'}
|
1
|
+
{"version":3,"file":"renderColumn.js","sources":["../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon } from '../../Icon/Icon';\n\nexport const Column = ({ cell }: any): any => {\n const props = {\n ...cell.getHeaderProps(),\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\n className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-darkest hover:text-black', cell.className, {\n 'yt-table__cell__group': !!cell.columns,\n 'cursor-pointer': !cell.disableSorting,\n 'justify-start text-left': cell.align === 'left',\n 'justify-end text-right': cell.align === 'right',\n 'justify-center text-center': cell.align === 'center' || !cell.align,\n }),\n style: { ...cell.style, flex: cell.flex },\n };\n\n if (cell.isSorted) {\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\n }\n\n return (\n <div {...props} key={cell.id} data-taco=\"table-column\">\n <span className=\"truncate\">{cell.render('Header')}</span>\n {cell.isSorted ? (\n <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'} className=\"-mt-0.5\" />\n ) : null}\n </div>\n );\n};\n"],"names":["Column","cell","props","getHeaderProps","getSortByToggleProps","title","undefined","className","cn","columns","disableSorting","align","style","flex","isSorted","isSortedDesc","React","key","id","render","Icon","name"],"mappings":";;;;;IAIaA,MAAM,GAAG,SAATA,MAAS;MAAGC,YAAAA;;AACrB,MAAMC,KAAK,gBACJD,IAAI,CAACE,cAAL,EADI,EAEHF,IAAI,CAACG,oBAAL,IAA6BH,IAAI,CAACG,oBAAL,CAA0B;AAAEC,IAAAA,KAAK,EAAEC;AAAT,GAA1B,CAF1B;AAGPC,IAAAA,SAAS,EAAEC,EAAE,CAAC,yFAAD,EAA4FP,IAAI,CAACM,SAAjG,EAA4G;AACrH,+BAAyB,CAAC,CAACN,IAAI,CAACQ,OADqF;AAErH,wBAAkB,CAACR,IAAI,CAACS,cAF6F;AAGrH,iCAA2BT,IAAI,CAACU,KAAL,KAAe,MAH2E;AAIrH,gCAA0BV,IAAI,CAACU,KAAL,KAAe,OAJ4E;AAKrH,oCAA8BV,IAAI,CAACU,KAAL,KAAe,QAAf,IAA2B,CAACV,IAAI,CAACU;AALsD,KAA5G,CAHN;AAUPC,IAAAA,KAAK,eAAOX,IAAI,CAACW,KAAZ;AAAmBC,MAAAA,IAAI,EAAEZ,IAAI,CAACY;AAA9B;AAVE,IAAX;;AAaA,MAAIZ,IAAI,CAACa,QAAT,EAAmB;AACfZ,IAAAA,KAAK,CAAC,WAAD,CAAL,GAAqBD,IAAI,CAACc,YAAL,GAAoB,YAApB,GAAmC,WAAxD;AACH;;AAED,SACIC,4BAAA,MAAA,oBAASd;AAAOe,IAAAA,GAAG,EAAEhB,IAAI,CAACiB;iBAAc;IAAxC,EACIF,4BAAA,OAAA;AAAMT,IAAAA,SAAS,EAAC;GAAhB,EAA4BN,IAAI,CAACkB,MAAL,CAAY,QAAZ,CAA5B,CADJ,EAEKlB,IAAI,CAACa,QAAL,GACGE,4BAAA,CAACI,IAAD;AAAMC,IAAAA,IAAI,EAAEpB,IAAI,CAACc,YAAL,GAAoB,oBAApB,GAA2C;AAAoBR,IAAAA,SAAS,EAAC;GAArF,CADH,GAEG,IAJR,CADJ;AAQH;;;;"}
|
package/dist/esm/index.js
CHANGED
@@ -26,6 +26,7 @@ export { Field } from './components/Field/Field.js';
|
|
26
26
|
export { Form } from './components/Form/Form.js';
|
27
27
|
export { Group } from './components/Group/Group.js';
|
28
28
|
export { Hanger, Title } from './components/Hanger/Hanger.js';
|
29
|
+
export { HoverCard } from './components/HoverCard/HoverCard.js';
|
29
30
|
export { SearchInput } from './components/SearchInput/SearchInput.js';
|
30
31
|
export { Listbox, MultiListbox } from './components/Listbox/Listbox.js';
|
31
32
|
export { RadioGroup, findByValue, getRadioGroupItemValueAsString, useRadioGroup } from './components/RadioGroup/RadioGroup.js';
|
package/dist/esm/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
@@ -13,6 +13,7 @@ export * from './components/Field/Field';
|
|
13
13
|
export * from './components/Form/Form';
|
14
14
|
export * from './components/Group/Group';
|
15
15
|
export * from './components/Hanger/Hanger';
|
16
|
+
export * from './components/HoverCard/HoverCard';
|
16
17
|
export * from './components/Icon/Icon';
|
17
18
|
export * from './components/IconButton/IconButton';
|
18
19
|
export * from './components/Input/Input';
|