@coorpacademy/components 11.39.5-alpha.9 → 11.40.1-alpha.10
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 +3 -9
- package/es/atom/select-icon/index.js.map +1 -1
- package/es/molecule/icon-picker-modal/index.d.ts.map +1 -1
- package/es/molecule/icon-picker-modal/index.js +32 -26
- 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/es/molecule/translation-modal/index.d.ts.map +1 -1
- package/es/molecule/translation-modal/index.js +1 -1
- package/es/molecule/translation-modal/index.js.map +1 -1
- 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 +3 -9
- package/lib/atom/select-icon/index.js.map +1 -1
- package/lib/molecule/icon-picker-modal/index.d.ts.map +1 -1
- package/lib/molecule/icon-picker-modal/index.js +32 -26
- 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/lib/molecule/translation-modal/index.d.ts.map +1 -1
- package/lib/molecule/translation-modal/index.js +1 -1
- package/lib/molecule/translation-modal/index.js.map +1 -1
- package/locales/lt/global.json +12 -12
- 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,GAA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pF,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/molecule/translation-modal/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/translation-modal/index.js"],"names":[],"mappings":";AAmBA,gFA4EC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","useCallback","PropTypes","BaseModal","Provider","COLORS","InputText","TextArea","style","renderInputGroup","title","inputProps","textAreaProps","readOnly","disabled","createElement","className","inputGroup","_extends","TranslationModal","props","context","isOpen","onCancel","onConfirm","onClose","source","inputText","sourceInputText","textArea","sourceTextArea","inputLanguage","target","targetInputText","targetTextArea","language","outputLanguage","translate","detectScrollbar","handleCancel","handleClose","footer","cancelButton","label","confirmButton","undefined","iconName","color","cm_primary_blue","description","headerIcon","name","backgroundColor","translationModal","horizontalSection","separator","contextTypes","childContextTypes","propTypes","process","env","NODE_ENV","bool","func","shape","theme","string"],"sources":["../../../src/molecule/translation-modal/index.js"],"sourcesContent":["import React, {useMemo, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport BaseModal from '../base-modal';\nimport Provider from '../../atom/provider';\nimport {COLORS} from '../../variables/colors';\nimport InputText from '../../atom/input-text';\nimport TextArea from '../../atom/input-textarea';\nimport style from './style.css';\n\nconst renderInputGroup = ({title, inputProps, textAreaProps, readOnly, disabled}) => {\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","useCallback","PropTypes","BaseModal","Provider","COLORS","InputText","TextArea","style","renderInputGroup","title","inputProps","textAreaProps","readOnly","disabled","createElement","className","inputGroup","_extends","TranslationModal","props","context","isOpen","onCancel","onConfirm","onClose","source","inputText","sourceInputText","textArea","sourceTextArea","inputLanguage","target","targetInputText","targetTextArea","language","outputLanguage","translate","detectScrollbar","handleCancel","handleClose","footer","cancelButton","label","confirmButton","undefined","iconName","color","cm_primary_blue","description","headerIcon","name","backgroundColor","translationModal","horizontalSection","separator","contextTypes","childContextTypes","propTypes","process","env","NODE_ENV","bool","func","shape","theme","string"],"sources":["../../../src/molecule/translation-modal/index.js"],"sourcesContent":["import React, {useMemo, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport BaseModal from '../base-modal';\nimport Provider from '../../atom/provider';\nimport {COLORS} from '../../variables/colors';\nimport InputText from '../../atom/input-text';\nimport TextArea from '../../atom/input-textarea';\nimport style from './style.css';\n\nconst renderInputGroup = ({title, inputProps, textAreaProps, readOnly, disabled}) => {\n return (\n <div className={style.inputGroup}>\n <div className={style.title}>{title}</div>\n <InputText {...inputProps} readOnly={readOnly} disabled={disabled} />\n <TextArea {...textAreaProps} readOnly={readOnly} disabled={disabled} />\n </div>\n );\n};\n\nconst TranslationModal = (props, context) => {\n const {\n isOpen,\n onCancel,\n onConfirm,\n onClose,\n disabled = false,\n source: {inputText: sourceInputText, textArea: sourceTextArea, inputLanguage},\n target: {inputText: targetInputText, textArea: targetTextArea, language: outputLanguage},\n readOnly = false\n } = props;\n const {translate} = context;\n\n const detectScrollbar = true;\n\n const handleCancel = useCallback(() => {\n onCancel();\n }, [onCancel]);\n\n const handleClose = useCallback(() => {\n onClose();\n }, [onClose]);\n\n const footer = useMemo(() => {\n const cancelButton = {\n onCancel: handleCancel,\n label: translate(readOnly ? 'close' : 'cancel')\n };\n return {\n cancelButton,\n confirmButton: {\n onConfirm: readOnly ? undefined : onConfirm,\n label: translate('confirm'),\n iconName: 'check',\n disabled: disabled || readOnly,\n color: COLORS.cm_primary_blue\n }\n };\n }, [handleCancel, onConfirm, translate, readOnly, disabled]);\n\n if (!isOpen) return null;\n\n return (\n <BaseModal\n title={translate('translation_title')}\n description={translate('translation_description')}\n isOpen={isOpen}\n onClose={handleClose}\n footer={footer}\n headerIcon={{\n name: 'language',\n backgroundColor: '#D6E6FF'\n }}\n detectScrollbar={detectScrollbar}\n >\n <div className={style.translationModal}>\n <div className={style.horizontalSection}>\n {renderInputGroup({\n title: inputLanguage,\n inputProps: sourceInputText,\n textAreaProps: sourceTextArea,\n readOnly: true\n })}\n\n <div className={style.separator} />\n\n {renderInputGroup({\n title: outputLanguage,\n inputProps: targetInputText,\n textAreaProps: targetTextArea,\n readOnly\n })}\n </div>\n </div>\n </BaseModal>\n );\n};\n\nTranslationModal.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nTranslationModal.propTypes = {\n isOpen: PropTypes.bool,\n onCancel: PropTypes.func,\n onConfirm: PropTypes.func,\n onClose: PropTypes.func,\n disabled: PropTypes.bool,\n source: PropTypes.shape({\n inputText: PropTypes.shape({\n ...InputText.propTypes,\n theme: PropTypes.string\n }),\n textArea: PropTypes.shape({\n ...TextArea.propTypes,\n theme: PropTypes.string\n }),\n inputLanguage: PropTypes.string\n }),\n target: PropTypes.shape({\n inputText: PropTypes.shape({\n ...InputText.propTypes,\n theme: PropTypes.string\n }),\n textArea: PropTypes.shape({\n ...TextArea.propTypes,\n theme: PropTypes.string\n }),\n language: PropTypes.string\n }),\n readOnly: PropTypes.bool\n};\n\nexport default TranslationModal;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAGC,OAAO,EAAEC,WAAW,QAAO,OAAO;AACjD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,OAAOC,SAAS,MAAM,uBAAuB;AAC7C,OAAOC,QAAQ,MAAM,2BAA2B;AAChD,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,gBAAgB,GAAGA,CAAC;EAACC,KAAK;EAAEC,UAAU;EAAEC,aAAa;EAAEC,QAAQ;EAAEC;AAAQ,CAAC,KAAK;EACnF,oBACEf,KAAA,CAAAgB,aAAA;IAAKC,SAAS,EAAER,KAAK,CAACS;EAAW,gBAC/BlB,KAAA,CAAAgB,aAAA;IAAKC,SAAS,EAAER,KAAK,CAACE;EAAM,GAAEA,KAAW,CAAC,eAC1CX,KAAA,CAAAgB,aAAA,CAACT,SAAS,EAAAY,QAAA,KAAKP,UAAU;IAAEE,QAAQ,EAAEA,QAAS;IAACC,QAAQ,EAAEA;EAAS,EAAE,CAAC,eACrEf,KAAA,CAAAgB,aAAA,CAACR,QAAQ,EAAAW,QAAA,KAAKN,aAAa;IAAEC,QAAQ,EAAEA,QAAS;IAACC,QAAQ,EAAEA;EAAS,EAAE,CACnE,CAAC;AAEV,CAAC;AAED,MAAMK,gBAAgB,GAAGA,CAACC,KAAK,EAAEC,OAAO,KAAK;EAC3C,MAAM;IACJC,M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4D,IAAI;EACxBpC,MAAM,EAAExB,SAAS,CAAC8D,KAAK,CAAC;IACtBrC,SAAS,EAAEzB,SAAS,CAAC8D,KAAK,CAAC;MACzB,GAAG1D,SAAS,CAACoD,SAAS;MACtBO,KAAK,EAAE/D,SAAS,CAACgE;IACnB,CAAC,CAAC;IACFrC,QAAQ,EAAE3B,SAAS,CAAC8D,KAAK,CAAC;MACxB,GAAGzD,QAAQ,CAACmD,SAAS;MACrBO,KAAK,EAAE/D,SAAS,CAACgE;IACnB,CAAC,CAAC;IACFnC,aAAa,EAAE7B,SAAS,CAACgE;EAC3B,CAAC,CAAC;EACFlC,MAAM,EAAE9B,SAAS,CAAC8D,KAAK,CAAC;IACtBrC,SAAS,EAAEzB,SAAS,CAAC8D,KAAK,CAAC;MACzB,GAAG1D,SAAS,CAACoD,SAAS;MACtBO,KAAK,EAAE/D,SAAS,CAACgE;IACnB,CAAC,CAAC;IACFrC,QAAQ,EAAE3B,SAAS,CAAC8D,KAAK,CAAC;MACxB,GAAGzD,QAAQ,CAACmD,SAAS;MACrBO,KAAK,EAAE/D,SAAS,CAACgE;IACnB,CAAC,CAAC;IACF/B,QAAQ,EAAEjC,SAAS,CAACgE;EACtB,CAAC,CAAC;EACFrD,QAAQ,EAAEX,SAAS,CAAC4D;AACtB,CAAC;AAED,eAAe3C,gBAAgB","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;
|