@coorpacademy/components 11.40.0 → 11.40.1-alpha.6
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/es/atom/button-link/index.d.ts.map +1 -1
- package/es/atom/button-link/index.js +7 -5
- package/es/atom/button-link/index.js.map +1 -1
- package/es/atom/button-link/style.css +1 -1
- package/es/atom/button-link/types.d.ts +3 -0
- package/es/atom/button-link/types.d.ts.map +1 -1
- package/es/atom/button-link/types.js.map +1 -1
- package/es/atom/select-icon/index.d.ts.map +1 -1
- package/es/atom/select-icon/index.js +9 -23
- package/es/atom/select-icon/index.js.map +1 -1
- package/es/molecule/icon-picker-modal/index.js +9 -7
- package/es/molecule/icon-picker-modal/index.js.map +1 -1
- package/es/molecule/quick-filters/index.d.ts +68 -0
- package/es/molecule/quick-filters/index.d.ts.map +1 -0
- package/es/molecule/quick-filters/index.js +179 -0
- package/es/molecule/quick-filters/index.js.map +1 -0
- package/es/molecule/quick-filters/style.css +119 -0
- package/es/molecule/quick-filters/types.d.ts +91 -0
- package/es/molecule/quick-filters/types.d.ts.map +1 -0
- package/es/molecule/quick-filters/types.js +25 -0
- package/es/molecule/quick-filters/types.js.map +1 -0
- package/lib/atom/button-link/index.d.ts.map +1 -1
- package/lib/atom/button-link/index.js +7 -5
- package/lib/atom/button-link/index.js.map +1 -1
- package/lib/atom/button-link/style.css +1 -1
- package/lib/atom/button-link/types.d.ts +3 -0
- package/lib/atom/button-link/types.d.ts.map +1 -1
- package/lib/atom/button-link/types.js.map +1 -1
- package/lib/atom/select-icon/index.d.ts.map +1 -1
- package/lib/atom/select-icon/index.js +10 -23
- package/lib/atom/select-icon/index.js.map +1 -1
- package/lib/molecule/icon-picker-modal/index.js +9 -7
- package/lib/molecule/icon-picker-modal/index.js.map +1 -1
- package/lib/molecule/quick-filters/index.d.ts +68 -0
- package/lib/molecule/quick-filters/index.d.ts.map +1 -0
- package/lib/molecule/quick-filters/index.js +187 -0
- package/lib/molecule/quick-filters/index.js.map +1 -0
- package/lib/molecule/quick-filters/style.css +119 -0
- package/lib/molecule/quick-filters/types.d.ts +91 -0
- package/lib/molecule/quick-filters/types.d.ts.map +1 -0
- package/lib/molecule/quick-filters/types.js +30 -0
- package/lib/molecule/quick-filters/types.js.map +1 -0
- package/locales/lt/global.json +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { useCallback, useRef, useEffect } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import FaIcon from '../../atom/icon';
|
|
5
|
+
import { COLORS } from '../../variables/colors';
|
|
6
|
+
import ButtonLink from '../../atom/button-link';
|
|
7
|
+
import style from './style.css';
|
|
8
|
+
import { propTypes } from './types';
|
|
9
|
+
const SCROLL_RIGHT_SIZE = 380;
|
|
10
|
+
const SCROLL_LEFT_SIZE = -380;
|
|
11
|
+
export const handleScroll = (direction, listRef) => {
|
|
12
|
+
if (listRef.current) {
|
|
13
|
+
listRef.current.scrollBy({
|
|
14
|
+
left: direction,
|
|
15
|
+
behavior: 'smooth'
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const getFilterButton = filterButtonProps => {
|
|
20
|
+
if (!filterButtonProps) return null;
|
|
21
|
+
const {
|
|
22
|
+
tag
|
|
23
|
+
} = filterButtonProps;
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: tag ? style.filterButtonWrapper : ''
|
|
26
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: style.filterButton
|
|
28
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, _extends({}, filterButtonProps, {
|
|
29
|
+
icon: {
|
|
30
|
+
position: 'left',
|
|
31
|
+
faIcon: {
|
|
32
|
+
name: 'sliders',
|
|
33
|
+
size: 14,
|
|
34
|
+
color: tag ? COLORS.cm_grey_700 : COLORS.neutral_500
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"data-testid": "open-filters-modal-button",
|
|
38
|
+
customStyle: {
|
|
39
|
+
borderRadius: '12px'
|
|
40
|
+
}
|
|
41
|
+
}))));
|
|
42
|
+
};
|
|
43
|
+
const QuickFilters = ({
|
|
44
|
+
primaryOption,
|
|
45
|
+
filterOptions,
|
|
46
|
+
filterButton,
|
|
47
|
+
nextFilterAriaLabel,
|
|
48
|
+
previousFilterAriaLabel,
|
|
49
|
+
filterOptionsAriaLabel
|
|
50
|
+
}) => {
|
|
51
|
+
const {
|
|
52
|
+
defaultLabel,
|
|
53
|
+
defaultIconName,
|
|
54
|
+
defaultSelected,
|
|
55
|
+
defaultAriaLabel,
|
|
56
|
+
onDefaultClick
|
|
57
|
+
} = primaryOption;
|
|
58
|
+
const filtersListRef = React.useRef(null);
|
|
59
|
+
const rightBtnRef = useRef(null);
|
|
60
|
+
const leftBtnRef = useRef(null);
|
|
61
|
+
const handleScrollRight = useCallback(() => {
|
|
62
|
+
handleScroll(SCROLL_RIGHT_SIZE, filtersListRef);
|
|
63
|
+
}, [filtersListRef]);
|
|
64
|
+
const handleScrollLeft = useCallback(() => {
|
|
65
|
+
handleScroll(SCROLL_LEFT_SIZE, filtersListRef);
|
|
66
|
+
}, [filtersListRef]);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const list = filtersListRef.current;
|
|
69
|
+
const rightButton = rightBtnRef.current;
|
|
70
|
+
const leftButton = leftBtnRef.current;
|
|
71
|
+
/* istanbul ignore next */ // not testable without complex mocking useRef
|
|
72
|
+
if (!list || !leftButton || !rightButton) return;
|
|
73
|
+
const update = () => {
|
|
74
|
+
const rightArrowWidth = rightButton.offsetWidth;
|
|
75
|
+
rightButton.style.visibility = list.scrollLeft + list.clientWidth < list.scrollWidth - rightArrowWidth ? 'visible' : 'hidden';
|
|
76
|
+
leftButton.style.visibility = list.scrollLeft > 0 ? 'visible' : 'hidden';
|
|
77
|
+
leftButton.style.display = list.scrollLeft > 0 ? 'flex' : 'none';
|
|
78
|
+
};
|
|
79
|
+
list.addEventListener('scroll', update);
|
|
80
|
+
window.addEventListener('resize', update);
|
|
81
|
+
update();
|
|
82
|
+
return () => {
|
|
83
|
+
list.removeEventListener('scroll', update);
|
|
84
|
+
window.removeEventListener('resize', update);
|
|
85
|
+
};
|
|
86
|
+
}, [filterOptions]);
|
|
87
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: style.filtersMainContainer
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: style.leftArrowButton,
|
|
91
|
+
ref: leftBtnRef,
|
|
92
|
+
style: {
|
|
93
|
+
visibility: 'hidden'
|
|
94
|
+
}
|
|
95
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, {
|
|
96
|
+
icon: {
|
|
97
|
+
position: 'left',
|
|
98
|
+
faIcon: {
|
|
99
|
+
name: 'arrow-left',
|
|
100
|
+
size: 15
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
onClick: handleScrollLeft,
|
|
104
|
+
customStyle: {
|
|
105
|
+
height: '36px'
|
|
106
|
+
},
|
|
107
|
+
"data-testid": "scroll-left-button",
|
|
108
|
+
"aria-label": previousFilterAriaLabel
|
|
109
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
className: style.filtersList,
|
|
111
|
+
ref: filtersListRef,
|
|
112
|
+
"data-testid": "filters-options-list",
|
|
113
|
+
"aria-label": filterOptionsAriaLabel
|
|
114
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
"data-testid": "all-option",
|
|
116
|
+
className: classNames(style.defaultOption, defaultSelected && style.filterSelected),
|
|
117
|
+
onClick: onDefaultClick
|
|
118
|
+
}, /*#__PURE__*/React.createElement(FaIcon, {
|
|
119
|
+
iconName: defaultIconName,
|
|
120
|
+
size: {
|
|
121
|
+
faSize: 20,
|
|
122
|
+
wrapperSize: 20
|
|
123
|
+
},
|
|
124
|
+
iconColor: defaultSelected ? COLORS.cm_grey_700 : COLORS.neutral_500,
|
|
125
|
+
"aria-label": defaultAriaLabel
|
|
126
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
127
|
+
className: style.filterLabel
|
|
128
|
+
}, defaultLabel)), /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: style.filterSeparator
|
|
130
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: style.filtersContainer
|
|
132
|
+
}, filterOptions.map((filterOption, idx) => {
|
|
133
|
+
const {
|
|
134
|
+
iconName,
|
|
135
|
+
label,
|
|
136
|
+
selected,
|
|
137
|
+
value,
|
|
138
|
+
onClick,
|
|
139
|
+
ariaLabel
|
|
140
|
+
} = filterOption;
|
|
141
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
key: idx,
|
|
143
|
+
className: classNames(style.filterOption, selected && style.filterSelected),
|
|
144
|
+
"data-testid": `filter-${value}-${idx}`,
|
|
145
|
+
onClick: onClick
|
|
146
|
+
}, /*#__PURE__*/React.createElement(FaIcon, {
|
|
147
|
+
iconName: iconName,
|
|
148
|
+
iconColor: selected ? COLORS.cm_grey_700 : COLORS.neutral_500,
|
|
149
|
+
size: {
|
|
150
|
+
faSize: 20,
|
|
151
|
+
wrapperSize: 20
|
|
152
|
+
},
|
|
153
|
+
"aria-label": ariaLabel
|
|
154
|
+
}), /*#__PURE__*/React.createElement("span", null, label));
|
|
155
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
className: style.rightArrowButton,
|
|
157
|
+
ref: rightBtnRef,
|
|
158
|
+
style: {
|
|
159
|
+
visibility: 'hidden'
|
|
160
|
+
}
|
|
161
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, {
|
|
162
|
+
icon: {
|
|
163
|
+
position: 'left',
|
|
164
|
+
faIcon: {
|
|
165
|
+
name: 'arrow-right',
|
|
166
|
+
size: 15
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
onClick: handleScrollRight,
|
|
170
|
+
customStyle: {
|
|
171
|
+
height: '36px'
|
|
172
|
+
},
|
|
173
|
+
"data-testid": "scroll-right-button",
|
|
174
|
+
"aria-label": nextFilterAriaLabel
|
|
175
|
+
})))), getFilterButton(filterButton));
|
|
176
|
+
};
|
|
177
|
+
QuickFilters.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
178
|
+
export default QuickFilters;
|
|
179
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useRef","useEffect","classNames","FaIcon","COLORS","ButtonLink","style","propTypes","SCROLL_RIGHT_SIZE","SCROLL_LEFT_SIZE","handleScroll","direction","listRef","current","scrollBy","left","behavior","getFilterButton","filterButtonProps","tag","createElement","className","filterButtonWrapper","filterButton","_extends","icon","position","faIcon","name","size","color","cm_grey_700","neutral_500","customStyle","borderRadius","QuickFilters","primaryOption","filterOptions","nextFilterAriaLabel","previousFilterAriaLabel","filterOptionsAriaLabel","defaultLabel","defaultIconName","defaultSelected","defaultAriaLabel","onDefaultClick","filtersListRef","rightBtnRef","leftBtnRef","handleScrollRight","handleScrollLeft","list","rightButton","leftButton","update","rightArrowWidth","offsetWidth","visibility","scrollLeft","clientWidth","scrollWidth","display","addEventListener","window","removeEventListener","filtersMainContainer","leftArrowButton","ref","onClick","height","filtersList","defaultOption","filterSelected","iconName","faSize","wrapperSize","iconColor","filterLabel","filterSeparator","filtersContainer","map","filterOption","idx","label","selected","value","ariaLabel","key","rightArrowButton","process","env","NODE_ENV"],"sources":["../../../src/molecule/quick-filters/index.tsx"],"sourcesContent":["import React, {useCallback, useRef, useEffect} from 'react';\nimport classNames from 'classnames';\nimport FaIcon from '../../atom/icon';\nimport {COLORS} from '../../variables/colors';\nimport ButtonLink from '../../atom/button-link';\nimport {ButtonLinkProps} from '../../atom/button-link/types';\nimport style from './style.css';\nimport {QuickFiltersProps, propTypes} from './types';\n\nconst SCROLL_RIGHT_SIZE = 380;\nconst SCROLL_LEFT_SIZE = -380;\nexport const handleScroll = (direction: number, listRef: React.RefObject<HTMLDivElement>) => {\n if (listRef.current) {\n listRef.current.scrollBy({\n left: direction,\n behavior: 'smooth'\n });\n }\n};\n\nconst getFilterButton = (filterButtonProps: ButtonLinkProps | undefined) => {\n if (!filterButtonProps) return null;\n const {tag} = filterButtonProps;\n return (\n <div className={tag ? style.filterButtonWrapper : ''}>\n <div className={style.filterButton}>\n <ButtonLink\n {...filterButtonProps}\n icon={{\n position: 'left',\n faIcon: {\n name: 'sliders',\n size: 14,\n color: tag ? COLORS.cm_grey_700 : COLORS.neutral_500\n }\n }}\n data-testid=\"open-filters-modal-button\"\n customStyle={{borderRadius: '12px'}}\n />\n </div>\n </div>\n );\n};\n\nconst QuickFilters = ({\n primaryOption,\n filterOptions,\n filterButton,\n nextFilterAriaLabel,\n previousFilterAriaLabel,\n filterOptionsAriaLabel\n}: QuickFiltersProps) => {\n const {defaultLabel, defaultIconName, defaultSelected, defaultAriaLabel, onDefaultClick} =\n primaryOption;\n const filtersListRef = React.useRef<HTMLDivElement>(null);\n const rightBtnRef = useRef<HTMLDivElement>(null);\n const leftBtnRef = useRef<HTMLDivElement>(null);\n\n const handleScrollRight = useCallback(() => {\n handleScroll(SCROLL_RIGHT_SIZE, filtersListRef);\n }, [filtersListRef]);\n const handleScrollLeft = useCallback(() => {\n handleScroll(SCROLL_LEFT_SIZE, filtersListRef);\n }, [filtersListRef]);\n useEffect(() => {\n const list = filtersListRef.current;\n const rightButton = rightBtnRef.current;\n const leftButton = leftBtnRef.current;\n /* istanbul ignore next */ // not testable without complex mocking useRef\n if (!list || !leftButton || !rightButton) return;\n\n const update = () => {\n const rightArrowWidth = rightButton.offsetWidth;\n rightButton.style.visibility =\n list.scrollLeft + list.clientWidth < list.scrollWidth - rightArrowWidth\n ? 'visible'\n : 'hidden';\n leftButton.style.visibility = list.scrollLeft > 0 ? 'visible' : 'hidden';\n leftButton.style.display = list.scrollLeft > 0 ? 'flex' : 'none';\n };\n\n list.addEventListener('scroll', update);\n window.addEventListener('resize', update);\n update();\n return () => {\n list.removeEventListener('scroll', update);\n window.removeEventListener('resize', update);\n };\n }, [filterOptions]);\n\n return (\n <div className={style.filtersMainContainer}>\n <div className={style.leftArrowButton} ref={leftBtnRef} style={{visibility: 'hidden'}}>\n <ButtonLink\n icon={{position: 'left', faIcon: {name: 'arrow-left', size: 15}}}\n onClick={handleScrollLeft}\n customStyle={{height: '36px'}}\n data-testid=\"scroll-left-button\"\n aria-label={previousFilterAriaLabel}\n />\n </div>\n <div\n className={style.filtersList}\n ref={filtersListRef}\n data-testid=\"filters-options-list\"\n aria-label={filterOptionsAriaLabel}\n >\n <div\n data-testid=\"all-option\"\n className={classNames(style.defaultOption, defaultSelected && style.filterSelected)}\n onClick={onDefaultClick}\n >\n <FaIcon\n iconName={defaultIconName}\n size={{faSize: 20, wrapperSize: 20}}\n iconColor={defaultSelected ? COLORS.cm_grey_700 : COLORS.neutral_500}\n aria-label={defaultAriaLabel}\n />\n <span className={style.filterLabel}>{defaultLabel}</span>\n </div>\n <div className={style.filterSeparator} />\n <div className={style.filtersContainer}>\n {filterOptions.map((filterOption, idx) => {\n const {iconName, label, selected, value, onClick, ariaLabel} = filterOption;\n return (\n <div\n key={idx}\n className={classNames(style.filterOption, selected && style.filterSelected)}\n data-testid={`filter-${value}-${idx}`}\n onClick={onClick}\n >\n <FaIcon\n iconName={iconName}\n iconColor={selected ? COLORS.cm_grey_700 : COLORS.neutral_500}\n size={{faSize: 20, wrapperSize: 20}}\n aria-label={ariaLabel}\n />\n <span>{label}</span>\n </div>\n );\n })}\n <div className={style.rightArrowButton} ref={rightBtnRef} style={{visibility: 'hidden'}}>\n <ButtonLink\n icon={{\n position: 'left',\n faIcon: {\n name: 'arrow-right',\n size: 15\n }\n }}\n onClick={handleScrollRight}\n customStyle={{height: '36px'}}\n data-testid=\"scroll-right-button\"\n aria-label={nextFilterAriaLabel}\n />\n </div>\n </div>\n </div>\n {getFilterButton(filterButton)}\n </div>\n );\n};\n\nQuickFilters.propTypes = propTypes;\nexport default QuickFilters;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,MAAM,EAAEC,SAAS,QAAO,OAAO;AAC3D,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,OAAOC,UAAU,MAAM,wBAAwB;AAE/C,OAAOC,KAAK,MAAM,aAAa;AAC/B,SAA2BC,SAAS,QAAO,SAAS;AAEpD,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,gBAAgB,GAAG,CAAC,GAAG;AAC7B,OAAO,MAAMC,YAAY,GAAGA,CAACC,SAAiB,EAAEC,OAAwC,KAAK;EAC3F,IAAIA,OAAO,CAACC,OAAO,EAAE;IACnBD,OAAO,CAACC,OAAO,CAACC,QAAQ,CAAC;MACvBC,IAAI,EAAEJ,SAAS;MACfK,QAAQ,EAAE;IACZ,CAAC,CAAC;EACJ;AACF,CAAC;AAED,MAAMC,eAAe,GAAIC,iBAA8C,IAAK;EAC1E,IAAI,CAACA,iBAAiB,EAAE,OAAO,IAAI;EACnC,MAAM;IAACC;EAAG,CAAC,GAAGD,iBAAiB;EAC/B,oBACEpB,KAAA,CAAAsB,aAAA;IAAKC,SAAS,EAAEF,GAAG,GAAGb,KAAK,CAACgB,mBAAmB,GAAG;EAAG,gBACnDxB,KAAA,CAAAsB,aAAA;IAAKC,SAAS,EAAEf,KAAK,CAACiB;EAAa,gBACjCzB,KAAA,CAAAsB,aAAA,CAACf,UAAU,EAAAmB,QAAA,KACLN,iBAAiB;IACrBO,IAAI,EAAE;MACJC,QAAQ,EAAE,MAAM;MAChBC,MAAM,EAAE;QACNC,IAAI,EAAE,SAAS;QACfC,I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,OAAO,EAAEA;IAAQ,gBAEjBtE,KAAA,CAAAsB,aAAA,CAACjB,MAAM;MACLsE,QAAQ,EAAEA,QAAS;MACnBG,SAAS,EAAEQ,QAAQ,GAAGhF,MAAM,CAAC2B,WAAW,GAAG3B,MAAM,CAAC4B,WAAY;MAC9DH,IAAI,EAAE;QAAC6C,MAAM,EAAE,EAAE;QAAEC,WAAW,EAAE;MAAE,CAAE;MACpC,cAAYW;IAAU,CACvB,CAAC,eACFxF,KAAA,CAAAsB,aAAA,eAAO+D,KAAY,CAChB,CAAC;EAEV,CAAC,CAAC,eACFrF,KAAA,CAAAsB,aAAA;IAAKC,SAAS,EAAEf,KAAK,CAACkF,gBAAiB;IAACrB,GAAG,EAAEpB,WAAY;IAACzC,KAAK,EAAE;MAACmD,UAAU,EAAE;IAAQ;EAAE,gBACtF3D,KAAA,CAAAsB,aAAA,CAACf,UAAU;IACToB,IAAI,EAAE;MACJC,QAAQ,EAAE,MAAM;MAChBC,MAAM,EAAE;QACNC,IAAI,EAAE,aAAa;QACnBC,IAAI,EAAE;MACR;IACF,CAAE;IACFuC,OAAO,EAAEnB,iBAAkB;IAC3BhB,WAAW,EAAE;MAACoC,MAAM,EAAE;IAAM,CAAE;IAC9B,eAAY,qBAAqB;IACjC,cAAY/B;EAAoB,CACjC,CACE,CACF,CACF,CAAC,EACLrB,eAAe,CAACM,YAAY,CAC1B,CAAC;AAEV,CAAC;AAEDY,YAAY,CAAC5B,SAAS,GAAAkF,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGpF,SAAS;AAClC,eAAe4B,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
@value colors: "../../variables/colors.css";
|
|
2
|
+
@value breakpoints: "../../variables/breakpoints.css";
|
|
3
|
+
@value mobile from breakpoints;
|
|
4
|
+
@value cm_grey_100 from colors;
|
|
5
|
+
@value cm_grey_500 from colors;
|
|
6
|
+
@value cm_grey_700 from colors;
|
|
7
|
+
@value cm_primary_blue from colors;
|
|
8
|
+
|
|
9
|
+
.textBase {
|
|
10
|
+
font-family: "Gilroy";
|
|
11
|
+
font-style: normal;
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
line-height: 20px;
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.filtersMainContainer {
|
|
18
|
+
composes: textBase;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.filtersContainer {
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: 16px;
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.filtersList {
|
|
30
|
+
overflow-x: auto;
|
|
31
|
+
scrollbar-width: none;
|
|
32
|
+
align-items: center;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex: 1;
|
|
35
|
+
position: relative;
|
|
36
|
+
margin-right: 40px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.filterOption, .defaultOption {
|
|
40
|
+
display: flex;
|
|
41
|
+
color: cm_grey_500;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: 8px;
|
|
44
|
+
padding: 12px;
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
height: 72px;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.filterSelected {
|
|
52
|
+
color: cm_grey_700;
|
|
53
|
+
border-bottom: 2px solid cm_primary_blue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.filterLabel {
|
|
57
|
+
min-width: 70px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.filterSeparator {
|
|
61
|
+
padding: 24px;
|
|
62
|
+
align-items: center;
|
|
63
|
+
display: flex;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
flex-shrink: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.filterSeparator::before {
|
|
69
|
+
content: '';
|
|
70
|
+
width: 1px;
|
|
71
|
+
height: 24px;
|
|
72
|
+
background-color: cm_grey_100;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.filterButton {
|
|
76
|
+
margin-left: auto;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.leftArrowButton, .rightArrowButton {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
width: 36px;
|
|
85
|
+
height: 36px;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
background-color: cm_grey_100;
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
position: sticky;
|
|
90
|
+
z-index: 1;
|
|
91
|
+
transform: translateY(-10%);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.rightArrowButton {
|
|
95
|
+
right: 0;
|
|
96
|
+
box-shadow: -20px 0 40px 40px white, 30px 0 40px 40px white;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.leftArrowButton {
|
|
100
|
+
left: 0;
|
|
101
|
+
box-shadow: 20px 0 40px 40px white;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.filterButtonWrapper {
|
|
105
|
+
padding: 2px;
|
|
106
|
+
border-radius: 16px;
|
|
107
|
+
border: 2px solid cm_primary_blue;
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@media mobile {
|
|
112
|
+
.leftArrowButton, .rightArrowButton, .filterButton, .filterButtonWrapper {
|
|
113
|
+
display: none!important;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.filtersList{
|
|
117
|
+
margin-right: 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { ButtonLinkProps } from '../../atom/button-link/types';
|
|
3
|
+
export declare type QuickFiltersProps = {
|
|
4
|
+
primaryOption: {
|
|
5
|
+
defaultLabel: string;
|
|
6
|
+
defaultValue: string;
|
|
7
|
+
defaultIconName: string;
|
|
8
|
+
defaultSelected: boolean;
|
|
9
|
+
onDefaultClick: () => void;
|
|
10
|
+
defaultAriaLabel: string;
|
|
11
|
+
};
|
|
12
|
+
nextFilterAriaLabel: string;
|
|
13
|
+
previousFilterAriaLabel: string;
|
|
14
|
+
filterOptionsAriaLabel: string;
|
|
15
|
+
filterOptions: FilterOption[];
|
|
16
|
+
filterButton?: ButtonLinkProps;
|
|
17
|
+
};
|
|
18
|
+
export declare type ScrollByOptions = {
|
|
19
|
+
left: number;
|
|
20
|
+
behavior: string;
|
|
21
|
+
};
|
|
22
|
+
declare type FilterOption = {
|
|
23
|
+
iconName: string;
|
|
24
|
+
label: string;
|
|
25
|
+
value: string;
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
selected: boolean;
|
|
28
|
+
ariaLabel: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const propTypes: {
|
|
31
|
+
primaryOption: PropTypes.Requireable<PropTypes.InferProps<{
|
|
32
|
+
defaultLabel: PropTypes.Requireable<string>;
|
|
33
|
+
defaultValue: PropTypes.Requireable<string>;
|
|
34
|
+
defaultIconName: PropTypes.Requireable<string>;
|
|
35
|
+
defaultSelected: PropTypes.Requireable<boolean>;
|
|
36
|
+
defaultAriaLabel: PropTypes.Requireable<string>;
|
|
37
|
+
onDefaultClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
|
+
}>>;
|
|
39
|
+
nextFilterAriaLabel: PropTypes.Requireable<string>;
|
|
40
|
+
previousFilterAriaLabel: PropTypes.Requireable<string>;
|
|
41
|
+
filterOptionsAriaLabel: PropTypes.Requireable<string>;
|
|
42
|
+
filterOptions: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
43
|
+
iconName: PropTypes.Requireable<string>;
|
|
44
|
+
label: PropTypes.Requireable<string>;
|
|
45
|
+
value: PropTypes.Requireable<string>;
|
|
46
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
+
selected: PropTypes.Requireable<boolean>;
|
|
48
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
49
|
+
}> | null | undefined)[]>;
|
|
50
|
+
filterButton: PropTypes.Requireable<PropTypes.InferProps<{
|
|
51
|
+
type: PropTypes.Requireable<string>;
|
|
52
|
+
usage: PropTypes.Requireable<string>;
|
|
53
|
+
label: PropTypes.Requireable<string>;
|
|
54
|
+
content: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
55
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
56
|
+
tooltipText: PropTypes.Requireable<string>;
|
|
57
|
+
tooltipPlacement: PropTypes.Requireable<string>;
|
|
58
|
+
'data-name': PropTypes.Requireable<string>;
|
|
59
|
+
'data-testid': PropTypes.Requireable<string>;
|
|
60
|
+
icon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
61
|
+
position: PropTypes.Requireable<string>;
|
|
62
|
+
type: PropTypes.Requireable<string>;
|
|
63
|
+
faIcon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
64
|
+
name: PropTypes.Validator<string>;
|
|
65
|
+
color: PropTypes.Requireable<string>;
|
|
66
|
+
backgroundColor: PropTypes.Requireable<string>;
|
|
67
|
+
size: PropTypes.Requireable<number>;
|
|
68
|
+
customStyle: PropTypes.Requireable<{
|
|
69
|
+
[x: string]: NonNullable<string | number | null | undefined> | null | undefined;
|
|
70
|
+
}>;
|
|
71
|
+
}>>;
|
|
72
|
+
}>>;
|
|
73
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
74
|
+
link: PropTypes.Requireable<PropTypes.InferProps<{
|
|
75
|
+
href: PropTypes.Requireable<string>;
|
|
76
|
+
download: PropTypes.Requireable<boolean>;
|
|
77
|
+
target: PropTypes.Requireable<string>;
|
|
78
|
+
}>>;
|
|
79
|
+
hoverBackgroundColor: PropTypes.Requireable<string>;
|
|
80
|
+
hoverColor: PropTypes.Requireable<string>;
|
|
81
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
82
|
+
className: PropTypes.Requireable<string>;
|
|
83
|
+
customStyle: PropTypes.Requireable<{
|
|
84
|
+
[x: string]: NonNullable<string | number | null | undefined> | null | undefined;
|
|
85
|
+
}>;
|
|
86
|
+
useTitle: PropTypes.Requireable<boolean>;
|
|
87
|
+
customLabelClassName: PropTypes.Requireable<string>;
|
|
88
|
+
}>>;
|
|
89
|
+
};
|
|
90
|
+
export {};
|
|
91
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/quick-filters/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAG7D,oBAAY,iBAAiB,GAAG;IAC9B,aAAa,EAAE;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,OAAO,CAAC;QACzB,cAAc,EAAE,MAAM,IAAI,CAAC;QAC3B,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,YAAY,CAAC,EAAE,eAAe,CAAC;CAChC,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,aAAK,YAAY,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBrB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import ButtonLink from '../../atom/button-link';
|
|
3
|
+
export const propTypes = {
|
|
4
|
+
primaryOption: PropTypes.shape({
|
|
5
|
+
defaultLabel: PropTypes.string,
|
|
6
|
+
defaultValue: PropTypes.string,
|
|
7
|
+
defaultIconName: PropTypes.string,
|
|
8
|
+
defaultSelected: PropTypes.bool,
|
|
9
|
+
defaultAriaLabel: PropTypes.string,
|
|
10
|
+
onDefaultClick: PropTypes.func
|
|
11
|
+
}),
|
|
12
|
+
nextFilterAriaLabel: PropTypes.string,
|
|
13
|
+
previousFilterAriaLabel: PropTypes.string,
|
|
14
|
+
filterOptionsAriaLabel: PropTypes.string,
|
|
15
|
+
filterOptions: PropTypes.arrayOf(PropTypes.shape({
|
|
16
|
+
iconName: PropTypes.string,
|
|
17
|
+
label: PropTypes.string,
|
|
18
|
+
value: PropTypes.string,
|
|
19
|
+
onClick: PropTypes.func,
|
|
20
|
+
selected: PropTypes.bool,
|
|
21
|
+
ariaLabel: PropTypes.string
|
|
22
|
+
})),
|
|
23
|
+
filterButton: PropTypes.shape(ButtonLink.propTypes)
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["PropTypes","ButtonLink","propTypes","primaryOption","shape","defaultLabel","string","defaultValue","defaultIconName","defaultSelected","bool","defaultAriaLabel","onDefaultClick","func","nextFilterAriaLabel","previousFilterAriaLabel","filterOptionsAriaLabel","filterOptions","arrayOf","iconName","label","value","onClick","selected","ariaLabel","filterButton"],"sources":["../../../src/molecule/quick-filters/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {ButtonLinkProps} from '../../atom/button-link/types';\nimport ButtonLink from '../../atom/button-link';\n\nexport type QuickFiltersProps = {\n primaryOption: {\n defaultLabel: string;\n defaultValue: string;\n defaultIconName: string;\n defaultSelected: boolean;\n onDefaultClick: () => void;\n defaultAriaLabel: string;\n };\n nextFilterAriaLabel: string;\n previousFilterAriaLabel: string;\n filterOptionsAriaLabel: string;\n filterOptions: FilterOption[];\n filterButton?: ButtonLinkProps;\n};\n\nexport type ScrollByOptions = {\n left: number;\n behavior: string;\n};\n\ntype FilterOption = {\n iconName: string;\n label: string;\n value: string;\n onClick: () => void;\n selected: boolean;\n ariaLabel: string;\n};\n\nexport const propTypes = {\n primaryOption: PropTypes.shape({\n defaultLabel: PropTypes.string,\n defaultValue: PropTypes.string,\n defaultIconName: PropTypes.string,\n defaultSelected: PropTypes.bool,\n defaultAriaLabel: PropTypes.string,\n onDefaultClick: PropTypes.func\n }),\n nextFilterAriaLabel: PropTypes.string,\n previousFilterAriaLabel: PropTypes.string,\n filterOptionsAriaLabel: PropTypes.string,\n filterOptions: PropTypes.arrayOf(\n PropTypes.shape({\n iconName: PropTypes.string,\n label: PropTypes.string,\n value: PropTypes.string,\n onClick: PropTypes.func,\n selected: PropTypes.bool,\n ariaLabel: PropTypes.string\n })\n ),\n filterButton: PropTypes.shape(ButtonLink.propTypes)\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAElC,OAAOC,UAAU,MAAM,wBAAwB;AAgC/C,OAAO,MAAMC,SAAS,GAAG;EACvBC,aAAa,EAAEH,SAAS,CAACI,KAAK,CAAC;IAC7BC,YAAY,EAAEL,SAAS,CAACM,MAAM;IAC9BC,YAAY,EAAEP,SAAS,CAACM,MAAM;IAC9BE,eAAe,EAAER,SAAS,CAACM,MAAM;IACjCG,eAAe,EAAET,SAAS,CAACU,IAAI;IAC/BC,gBAAgB,EAAEX,SAAS,CAACM,MAAM;IAClCM,cAAc,EAAEZ,SAAS,CAACa;EAC5B,CAAC,CAAC;EACFC,mBAAmB,EAAEd,SAAS,CAACM,MAAM;EACrCS,uBAAuB,EAAEf,SAAS,CAACM,MAAM;EACzCU,sBAAsB,EAAEhB,SAAS,CAACM,MAAM;EACxCW,aAAa,EAAEjB,SAAS,CAACkB,OAAO,CAC9BlB,SAAS,CAACI,KAAK,CAAC;IACde,QAAQ,EAAEnB,SAAS,CAACM,MAAM;IAC1Bc,KAAK,EAAEpB,SAAS,CAACM,MAAM;IACvBe,KAAK,EAAErB,SAAS,CAACM,MAAM;IACvBgB,OAAO,EAAEtB,SAAS,CAACa,IAAI;IACvBU,QAAQ,EAAEvB,SAAS,CAACU,IAAI;IACxBc,SAAS,EAAExB,SAAS,CAACM;EACvB,CAAC,CACH,CAAC;EACDmB,YAAY,EAAEzB,SAAS,CAACI,KAAK,CAACH,UAAU,CAACC,SAAS;AACpD,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAQA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;AA8D7D,QAAA,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqJzC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -9,13 +9,14 @@ var _link = _interopRequireDefault(require("../link"));
|
|
|
9
9
|
var _icon = _interopRequireWildcard(require("../icon"));
|
|
10
10
|
var _buttonIcons = require("../../util/button-icons");
|
|
11
11
|
var _tooltip = _interopRequireDefault(require("../tooltip"));
|
|
12
|
+
var _tag = _interopRequireDefault(require("../tag"));
|
|
12
13
|
var _types = _interopRequireDefault(require("./types"));
|
|
13
14
|
var _style = _interopRequireDefault(require("./style.css"));
|
|
14
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
|
-
const getButtonContent = (icon, content, hovered, hoverBackgroundColor, hoverColor, customLabelClassName) => {
|
|
19
|
+
const getButtonContent = (icon, content, hovered, hoverBackgroundColor, hoverColor, customLabelClassName, tag) => {
|
|
19
20
|
const {
|
|
20
21
|
type,
|
|
21
22
|
faIcon,
|
|
@@ -57,7 +58,7 @@ const getButtonContent = (icon, content, hovered, hoverBackgroundColor, hoverCol
|
|
|
57
58
|
className: _style.default.buttonContent
|
|
58
59
|
}, position === 'left' ? iconComponent : null, content ? /*#__PURE__*/_react.default.createElement("span", {
|
|
59
60
|
className: _style.default.label
|
|
60
|
-
}, content) : null, position === 'right' ? iconComponent : null);
|
|
61
|
+
}, content) : null, tag ? /*#__PURE__*/_react.default.createElement(_tag.default, tag) : null, position === 'right' ? iconComponent : null);
|
|
61
62
|
};
|
|
62
63
|
const ButtonLink = props => {
|
|
63
64
|
const {
|
|
@@ -80,7 +81,8 @@ const ButtonLink = props => {
|
|
|
80
81
|
className,
|
|
81
82
|
customStyle,
|
|
82
83
|
useTitle = true,
|
|
83
|
-
customLabelClassName
|
|
84
|
+
customLabelClassName,
|
|
85
|
+
tag
|
|
84
86
|
} = props;
|
|
85
87
|
const styleButton = (0, _classnames.default)(link && _style.default.link, className, _style.default.button, !label && _style.default.iconButton, type === 'primary' && _style.default.primary, type === 'secondary' && _style.default.secondary, type === 'tertiary' && _style.default.tertiary, type === 'text' && _style.default.text, type === 'dangerous' && _style.default.dangerous, disabled && _style.default.disabled);
|
|
86
88
|
const [hovered, setHovered] = (0, _react.useState)(false);
|
|
@@ -128,7 +130,7 @@ const ButtonLink = props => {
|
|
|
128
130
|
hoverBackgroundColor: hoverBackgroundColor,
|
|
129
131
|
onMouseEnter: handleMouseOver,
|
|
130
132
|
onMouseLeave: handleMouseLeave
|
|
131
|
-
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor, customLabelClassName), renderToolTip());
|
|
133
|
+
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor, customLabelClassName, tag), renderToolTip());
|
|
132
134
|
}
|
|
133
135
|
return /*#__PURE__*/_react.default.createElement("button", _extends({}, useTitle && {
|
|
134
136
|
title: ariaLabel || label
|
|
@@ -149,7 +151,7 @@ const ButtonLink = props => {
|
|
|
149
151
|
onMouseLeave: handleMouseLeave,
|
|
150
152
|
tabIndex: 0,
|
|
151
153
|
disabled: disabled
|
|
152
|
-
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor), renderToolTip());
|
|
154
|
+
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor, customLabelClassName, tag), renderToolTip());
|
|
153
155
|
};
|
|
154
156
|
ButtonLink.propTypes = process.env.NODE_ENV !== "production" ? _types.default : {};
|
|
155
157
|
var _default = exports.default = ButtonLink;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_link","_icon","_buttonIcons","_tooltip","_types","_style","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","getButtonContent","icon","content","hovered","hoverBackgroundColor","hoverColor","customLabelClassName","type","faIcon","position","Icon","ICONS","createElement","className","style","buttonContent","label","dangerouslySetInnerHTML","__html","iconComponent","iconName","name","iconColor","color","DEFAULT_ICON_COLOR","backgroundColor","size","faSize","wrapperSize","customStyle","theme","ButtonLink","props","usage","disabled","dataName","dataTestId","ariaLabel","tooltipText","tooltipPlacement","link","onClick","_noop2","onKeyDown","useTitle","styleButton","classnames","button","iconButton","primary","secondary","tertiary","text","dangerous","setHovered","useState","handleOnClick","useCallback","event","handleOnKeyDown","handleMouseOver","handleMouseLeave","TooltipContent","tooltipContentWrapper","renderToolTip","closeToolTipInformationTextAriaLabel","fontSize","anchorId","toolTipIsVisible","placement","_customStyle","useMemo","title","onMouseEnter","onMouseLeave","onMouseOver","tabIndex","propTypes","process","env","NODE_ENV","_default","exports"],"sources":["../../../src/atom/button-link/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {noop} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Link from '../link';\nimport FaIcon, {DEFAULT_ICON_COLOR, IconProps} from '../icon';\nimport {ICONS} from '../../util/button-icons';\nimport ToolTip from '../tooltip';\nimport propTypes, {ButtonLinkProps, IconType} from './types';\nimport style from './style.css';\n\nconst getButtonContent = (\n icon?: IconType,\n content?: string | React.ReactNode,\n hovered?: boolean,\n hoverBackgroundColor?: string,\n hoverColor?: string,\n customLabelClassName?: string\n) => {\n const {type, faIcon, position} = icon || {type: '', position: ''};\n const Icon = type && ICONS[type];\n\n if (!Icon && !faIcon) {\n return (\n <div className={(style.buttonContent, customLabelClassName)}>\n {typeof content === 'string' ? (\n <span\n className={(style.label, customLabelClassName)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: content}}\n />\n ) : (\n <span className={(style.label, customLabelClassName)}>{content}</span>\n )}\n </div>\n );\n }\n\n const iconComponent = faIcon ? (\n <FaIcon\n {...({\n iconName: faIcon.name,\n iconColor: hovered && hoverColor ? hoverColor : faIcon.color ?? DEFAULT_ICON_COLOR,\n // eslint-disable-next-line no-nested-ternary\n backgroundColor: !faIcon?.backgroundColor\n ? null\n : hovered && hoverBackgroundColor\n ? hoverBackgroundColor\n : faIcon.backgroundColor,\n size: {\n faSize: faIcon.size,\n wrapperSize: faIcon.size\n },\n customStyle: faIcon.customStyle\n } as IconProps)}\n />\n ) : (\n <Icon className={style.icon} theme=\"coorpmanager\" />\n );\n\n return (\n <div className={style.buttonContent}>\n {position === 'left' ? iconComponent : null}\n {content ? <span className={style.label}>{content}</span> : null}\n {position === 'right' ? iconComponent : null}\n </div>\n );\n};\n\nconst ButtonLink = (props: ButtonLinkProps) => {\n const {\n type,\n usage = 'button',\n label,\n content,\n hoverBackgroundColor,\n hoverColor,\n disabled = false,\n icon,\n 'data-name': dataName,\n 'data-testid': dataTestId = 'button-link',\n 'aria-label': ariaLabel,\n tooltipText,\n tooltipPlacement = 'left',\n link,\n onClick = noop,\n onKeyDown = noop,\n className,\n customStyle,\n useTitle = true,\n customLabelClassName\n } = props;\n const styleButton = classnames(\n link && style.link,\n className,\n style.button,\n !label && style.iconButton,\n type === 'primary' && style.primary,\n type === 'secondary' && style.secondary,\n type === 'tertiary' && style.tertiary,\n type === 'text' && style.text,\n type === 'dangerous' && style.dangerous,\n disabled && style.disabled\n );\n\n const [hovered, setHovered] = useState(false);\n\n const handleOnClick = useCallback(event => onClick(event), [onClick]);\n\n const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);\n\n const handleMouseOver = useCallback(() => {\n setHovered(true);\n }, [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const TooltipContent = useCallback(\n () => <span className={style.tooltipContentWrapper}>{tooltipText || ariaLabel}</span>,\n [tooltipText, ariaLabel]\n );\n\n const renderToolTip = () => {\n const closeToolTipInformationTextAriaLabel = tooltipText || ariaLabel;\n if (!closeToolTipInformationTextAriaLabel) return null;\n return (\n <ToolTip\n fontSize={12}\n anchorId=\"button-icon\"\n toolTipIsVisible={hovered}\n placement={tooltipPlacement}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n />\n );\n };\n\n const _customStyle = useMemo(() => {\n return {\n ...customStyle,\n ...((hoverBackgroundColor || hoverColor) && hovered\n ? {\n backgroundColor: hoverBackgroundColor,\n color: hoverColor\n }\n : null)\n };\n }, [hoverBackgroundColor, hoverColor, hovered, customStyle]);\n\n if (link) {\n return (\n <Link\n {...link}\n {...(useTitle && {\n title: ariaLabel || label\n })}\n className={styleButton}\n style={customStyle}\n data-name={dataName}\n data-testid={dataTestId}\n onClick={handleOnClick}\n aria-label={ariaLabel || label}\n hoverColor={hoverColor}\n hoverBackgroundColor={hoverBackgroundColor}\n onMouseEnter={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {getButtonContent(\n icon,\n content ?? label,\n hovered,\n hoverBackgroundColor,\n hoverColor,\n customLabelClassName\n )}\n {renderToolTip()}\n </Link>\n );\n }\n\n return (\n <button\n {...(useTitle && {\n title: ariaLabel || label\n })}\n {...(ariaLabel && !label\n ? {\n 'data-for': 'button-icon',\n 'data-tip': hovered\n }\n : {})}\n // eslint-disable-next-line react/button-has-type\n type={usage}\n aria-label={ariaLabel || label}\n data-name={dataName}\n data-testid={dataTestId}\n style={_customStyle}\n className={styleButton}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n tabIndex={0}\n disabled={disabled}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n {renderToolTip()}\n </button>\n );\n};\n\nButtonLink.propTypes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,EAAEf,eAAgB;IAC7Bc,YAAY,EAAEb,gBAAiB;IAC/Be,QAAQ,EAAE,CAAE;IACZ1C,QAAQ,EAAEA;EAAS,IAElBlC,gBAAgB,CAACC,IAAI,EAAEC,OAAO,IAAIc,KAAK,EAAEb,OAAO,EAAEC,oBAAoB,EAAEC,UAAU,CAAC,EACnF2D,aAAa,CAAC,CACT,CAAC;AAEb,CAAC;AAEDjC,UAAU,CAAC8C,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGH,cAAS;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAtG,OAAA,GAElBmD,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_link","_icon","_buttonIcons","_tooltip","_tag","_types","_style","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","getButtonContent","icon","content","hovered","hoverBackgroundColor","hoverColor","customLabelClassName","tag","type","faIcon","position","Icon","ICONS","createElement","className","style","buttonContent","label","dangerouslySetInnerHTML","__html","iconComponent","iconName","name","iconColor","color","DEFAULT_ICON_COLOR","backgroundColor","size","faSize","wrapperSize","customStyle","theme","ButtonLink","props","usage","disabled","dataName","dataTestId","ariaLabel","tooltipText","tooltipPlacement","link","onClick","_noop2","onKeyDown","useTitle","styleButton","classnames","button","iconButton","primary","secondary","tertiary","text","dangerous","setHovered","useState","handleOnClick","useCallback","event","handleOnKeyDown","handleMouseOver","handleMouseLeave","TooltipContent","tooltipContentWrapper","renderToolTip","closeToolTipInformationTextAriaLabel","fontSize","anchorId","toolTipIsVisible","placement","_customStyle","useMemo","title","onMouseEnter","onMouseLeave","onMouseOver","tabIndex","propTypes","process","env","NODE_ENV","_default","exports"],"sources":["../../../src/atom/button-link/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {noop} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Link from '../link';\nimport FaIcon, {DEFAULT_ICON_COLOR, IconProps} from '../icon';\nimport {ICONS} from '../../util/button-icons';\nimport ToolTip from '../tooltip';\nimport Tag from '../tag';\nimport propTypes, {ButtonLinkProps, IconType} from './types';\nimport style from './style.css';\n\nconst getButtonContent = (\n icon?: IconType,\n content?: string | React.ReactNode,\n hovered?: boolean,\n hoverBackgroundColor?: string,\n hoverColor?: string,\n customLabelClassName?: string,\n tag?: React.ComponentProps<typeof Tag>\n) => {\n const {type, faIcon, position} = icon || {type: '', position: ''};\n const Icon = type && ICONS[type];\n\n if (!Icon && !faIcon) {\n return (\n <div className={(style.buttonContent, customLabelClassName)}>\n {typeof content === 'string' ? (\n <span\n className={(style.label, customLabelClassName)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: content}}\n />\n ) : (\n <span className={(style.label, customLabelClassName)}>{content}</span>\n )}\n </div>\n );\n }\n\n const iconComponent = faIcon ? (\n <FaIcon\n {...({\n iconName: faIcon.name,\n iconColor: hovered && hoverColor ? hoverColor : faIcon.color ?? DEFAULT_ICON_COLOR,\n // eslint-disable-next-line no-nested-ternary\n backgroundColor: !faIcon?.backgroundColor\n ? null\n : hovered && hoverBackgroundColor\n ? hoverBackgroundColor\n : faIcon.backgroundColor,\n size: {\n faSize: faIcon.size,\n wrapperSize: faIcon.size\n },\n customStyle: faIcon.customStyle\n } as IconProps)}\n />\n ) : (\n <Icon className={style.icon} theme=\"coorpmanager\" />\n );\n return (\n <div className={style.buttonContent}>\n {position === 'left' ? iconComponent : null}\n {content ? <span className={style.label}>{content}</span> : null}\n {tag ? <Tag {...tag} /> : null}\n {position === 'right' ? iconComponent : null}\n </div>\n );\n};\n\nconst ButtonLink = (props: ButtonLinkProps) => {\n const {\n type,\n usage = 'button',\n label,\n content,\n hoverBackgroundColor,\n hoverColor,\n disabled = false,\n icon,\n 'data-name': dataName,\n 'data-testid': dataTestId = 'button-link',\n 'aria-label': ariaLabel,\n tooltipText,\n tooltipPlacement = 'left',\n link,\n onClick = noop,\n onKeyDown = noop,\n className,\n customStyle,\n useTitle = true,\n customLabelClassName,\n tag\n } = props;\n const styleButton = classnames(\n link && style.link,\n className,\n style.button,\n !label && style.iconButton,\n type === 'primary' && style.primary,\n type === 'secondary' && style.secondary,\n type === 'tertiary' && style.tertiary,\n type === 'text' && style.text,\n type === 'dangerous' && style.dangerous,\n disabled && style.disabled\n );\n\n const [hovered, setHovered] = useState(false);\n\n const handleOnClick = useCallback(event => onClick(event), [onClick]);\n\n const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);\n\n const handleMouseOver = useCallback(() => {\n setHovered(true);\n }, [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const TooltipContent = useCallback(\n () => <span className={style.tooltipContentWrapper}>{tooltipText || ariaLabel}</span>,\n [tooltipText, ariaLabel]\n );\n\n const renderToolTip = () => {\n const closeToolTipInformationTextAriaLabel = tooltipText || ariaLabel;\n if (!closeToolTipInformationTextAriaLabel) return null;\n return (\n <ToolTip\n fontSize={12}\n anchorId=\"button-icon\"\n toolTipIsVisible={hovered}\n placement={tooltipPlacement}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n />\n );\n };\n const _customStyle = useMemo(() => {\n return {\n ...customStyle,\n ...((hoverBackgroundColor || hoverColor) && hovered\n ? {\n backgroundColor: hoverBackgroundColor,\n color: hoverColor\n }\n : null)\n };\n }, [hoverBackgroundColor, hoverColor, hovered, customStyle]);\n\n if (link) {\n return (\n <Link\n {...link}\n {...(useTitle && {\n title: ariaLabel || label\n })}\n className={styleButton}\n style={customStyle}\n data-name={dataName}\n data-testid={dataTestId}\n onClick={handleOnClick}\n aria-label={ariaLabel || label}\n hoverColor={hoverColor}\n hoverBackgroundColor={hoverBackgroundColor}\n onMouseEnter={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {getButtonContent(\n icon,\n content ?? label,\n hovered,\n hoverBackgroundColor,\n hoverColor,\n customLabelClassName,\n tag\n )}\n {renderToolTip()}\n </Link>\n );\n }\n\n return (\n <button\n {...(useTitle && {\n title: ariaLabel || label\n })}\n {...(ariaLabel && !label\n ? {\n 'data-for': 'button-icon',\n 'data-tip': hovered\n }\n : {})}\n // eslint-disable-next-line react/button-has-type\n type={usage}\n aria-label={ariaLabel || label}\n data-name={dataName}\n data-testid={dataTestId}\n style={_customStyle}\n className={styleButton}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n tabIndex={0}\n disabled={disabled}\n >\n {getButtonContent(\n icon,\n content ?? label,\n hovered,\n hoverBackgroundColor,\n hoverColor,\n customLabelClassName,\n tag\n )}\n {renderToolTip()}\n </button>\n );\n};\n\nButtonLink.propTypes = propTypes;\n\nexport default ButtonLink;\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,IAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,MAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,MAAA,GAAAP,sBAAA,CAAAF,OAAA;AAAgC,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE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 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import { ICONS } from '../../util/button-icons';
|
|
4
|
+
import Tag from '../tag';
|
|
3
5
|
export declare const iconPropTypes: {
|
|
4
6
|
position: PropTypes.Requireable<string>;
|
|
5
7
|
type: PropTypes.Requireable<string>;
|
|
@@ -89,6 +91,7 @@ export declare type ButtonLinkProps = {
|
|
|
89
91
|
customStyle?: Record<string, string | number>;
|
|
90
92
|
useTitle?: boolean;
|
|
91
93
|
customLabelClassName?: string;
|
|
94
|
+
tag?: React.ComponentProps<typeof Tag>;
|
|
92
95
|
};
|
|
93
96
|
export declare type Fixture = {
|
|
94
97
|
props: ButtonLinkProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/types.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAC;AAC9C,OAAO,GAAG,MAAM,QAAQ,CAAC;AAUzB,eAAO,MAAM,aAAa;;;;;;;;;;;;CAIzB,CAAC;AAEF,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBd,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAC/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