@coorpacademy/components 11.36.10-alpha.4 → 11.36.10-alpha.7
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-menu/style.css +3 -3
- package/es/atom/input-select/index.d.ts.map +1 -1
- package/es/atom/input-select/index.js +2 -9
- package/es/atom/input-select/index.js.map +1 -1
- package/es/atom/input-select/style.css +8 -38
- package/es/molecule/button-menu-action/index.d.ts.map +1 -1
- package/es/molecule/button-menu-action/index.js +2 -7
- package/es/molecule/button-menu-action/index.js.map +1 -1
- package/es/molecule/button-menu-action/style.css +0 -11
- package/es/molecule/button-menu-action/types.d.ts +0 -1
- package/es/molecule/button-menu-action/types.d.ts.map +1 -1
- package/es/molecule/button-menu-action/types.js.map +1 -1
- package/es/organism/header-with-actions/index.d.ts +15 -73
- package/es/organism/header-with-actions/index.d.ts.map +1 -1
- package/es/organism/header-with-actions/index.js +74 -3
- package/es/organism/header-with-actions/index.js.map +1 -1
- package/es/organism/header-with-actions/types.d.ts +36 -79
- package/es/organism/header-with-actions/types.d.ts.map +1 -1
- package/es/organism/header-with-actions/types.js +23 -10
- package/es/organism/header-with-actions/types.js.map +1 -1
- package/es/organism/mooc-header/index.d.ts.map +1 -1
- package/es/organism/mooc-header/index.js +1 -2
- package/es/organism/mooc-header/index.js.map +1 -1
- package/es/organism/mooc-header/style.css +0 -1
- package/es/organism/skill-edition/index.d.ts.map +1 -1
- package/es/organism/skill-edition/index.js +0 -1
- package/es/organism/skill-edition/index.js.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +15 -73
- package/es/template/back-office/brand-update/index.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.js +4 -2
- package/es/template/back-office/brand-update/index.js.map +1 -1
- package/es/template/back-office/brand-update/style.css +4 -1
- package/es/template/back-office/brand-update/utils.d.ts +38 -10
- package/es/template/back-office/brand-update/utils.js +19 -0
- package/es/template/back-office/brand-update/utils.js.map +1 -1
- package/lib/atom/button-menu/style.css +3 -3
- package/lib/atom/input-select/index.d.ts.map +1 -1
- package/lib/atom/input-select/index.js +2 -9
- package/lib/atom/input-select/index.js.map +1 -1
- package/lib/atom/input-select/style.css +8 -38
- package/lib/molecule/button-menu-action/index.d.ts.map +1 -1
- package/lib/molecule/button-menu-action/index.js +2 -7
- package/lib/molecule/button-menu-action/index.js.map +1 -1
- package/lib/molecule/button-menu-action/style.css +0 -11
- package/lib/molecule/button-menu-action/types.d.ts +0 -1
- package/lib/molecule/button-menu-action/types.d.ts.map +1 -1
- package/lib/molecule/button-menu-action/types.js.map +1 -1
- package/lib/organism/header-with-actions/index.d.ts +15 -73
- package/lib/organism/header-with-actions/index.d.ts.map +1 -1
- package/lib/organism/header-with-actions/index.js +74 -3
- package/lib/organism/header-with-actions/index.js.map +1 -1
- package/lib/organism/header-with-actions/types.d.ts +36 -79
- package/lib/organism/header-with-actions/types.d.ts.map +1 -1
- package/lib/organism/header-with-actions/types.js +23 -10
- package/lib/organism/header-with-actions/types.js.map +1 -1
- package/lib/organism/mooc-header/index.d.ts.map +1 -1
- package/lib/organism/mooc-header/index.js +1 -2
- package/lib/organism/mooc-header/index.js.map +1 -1
- package/lib/organism/mooc-header/style.css +0 -1
- package/lib/organism/skill-edition/index.d.ts.map +1 -1
- package/lib/organism/skill-edition/index.js +0 -1
- package/lib/organism/skill-edition/index.js.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +15 -73
- package/lib/template/back-office/brand-update/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.js +4 -2
- package/lib/template/back-office/brand-update/index.js.map +1 -1
- package/lib/template/back-office/brand-update/style.css +4 -1
- package/lib/template/back-office/brand-update/utils.d.ts +38 -10
- package/lib/template/back-office/brand-update/utils.js +19 -0
- package/lib/template/back-office/brand-update/utils.js.map +1 -1
- package/locales/.mtslconfig.json +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAK3D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAK9C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAK3D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAK9C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2G3C,CAAC;AAIF,eAAe,WAAW,CAAC"}
|
|
@@ -59,10 +59,7 @@ const InputSelect = ({
|
|
|
59
59
|
icon: selectedIcon
|
|
60
60
|
})) : null);
|
|
61
61
|
};
|
|
62
|
-
const shouldBeScrollable = options.length > 6;
|
|
63
62
|
return /*#__PURE__*/React.createElement("div", {
|
|
64
|
-
className: style.container
|
|
65
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
66
63
|
className: classnames(style.outerWrapper, {
|
|
67
64
|
[style.open]: open
|
|
68
65
|
})
|
|
@@ -94,15 +91,11 @@ const InputSelect = ({
|
|
|
94
91
|
[style.rotated]: open
|
|
95
92
|
}),
|
|
96
93
|
icon: iconClosed
|
|
97
|
-
})))
|
|
98
|
-
className: classnames(style.menuWrapper, {
|
|
99
|
-
[style.showFade]: shouldBeScrollable
|
|
100
|
-
})
|
|
101
|
-
}, /*#__PURE__*/React.createElement("ul", {
|
|
94
|
+
}))), open ? /*#__PURE__*/React.createElement("ul", {
|
|
102
95
|
id: `${componentId}-listbox`,
|
|
103
96
|
className: style.menu,
|
|
104
97
|
role: "listbox"
|
|
105
|
-
}, options.map(renderOption))
|
|
98
|
+
}, options.map(renderOption)) : null));
|
|
106
99
|
};
|
|
107
100
|
InputSelect.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
108
101
|
export default InputSelect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","useRef","useCallback","classnames","FontAwesomeIcon","style","propTypes","COMPONENT_ID","InputSelect","options","value","onChange","placeholder","className","ariaLabel","iconClosed","selectedIcon","buttonDataTestId","open","setOpen","wrapperRef","componentId","toLowerCase","replace","handleToggle","o","handleOnOptionClick","optionValue","useEffect","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener","selectedOption","find","opt","renderOption","option","handleClick","isSelected","createElement","key","selected","role","onClick","optionIcon","icon","optionLabel","label","checkIcon","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useRef","useCallback","classnames","FontAwesomeIcon","style","propTypes","COMPONENT_ID","InputSelect","options","value","onChange","placeholder","className","ariaLabel","iconClosed","selectedIcon","buttonDataTestId","open","setOpen","wrapperRef","componentId","toLowerCase","replace","handleToggle","o","handleOnOptionClick","optionValue","useEffect","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener","selectedOption","find","opt","renderOption","option","handleClick","isSelected","createElement","key","selected","role","onClick","optionIcon","icon","optionLabel","label","checkIcon","outerWrapper","ref","wrapper","type","display","undefined","id","content","iconWrapper","rotated","menu","map","process","env","NODE_ENV"],"sources":["../../../src/atom/input-select/index.tsx"],"sourcesContent":["import React, {useState, useRef, useCallback} from 'react';\nimport classnames from 'classnames';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {IconName} from '@fortawesome/fontawesome-svg-core';\nimport style from './style.css';\nimport type {InputSelectProps} from './types';\nimport propTypes from './types';\n\nconst COMPONENT_ID = 'input-select';\n\nconst InputSelect: React.FC<InputSelectProps> = ({\n options = [],\n value,\n onChange,\n placeholder,\n className,\n 'aria-label': ariaLabel,\n iconClosed = 'chevron-down',\n selectedIcon = 'circle-check',\n 'button-data-testid': buttonDataTestId = 'select-input'\n}) => {\n const [open, setOpen] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const componentId = `${COMPONENT_ID}-${\n placeholder?.toLowerCase().replace(/\\s+/g, '-') || 'default'\n }`;\n\n const handleToggle = useCallback(() => {\n setOpen(o => !o);\n }, []);\n\n const handleOnOptionClick = useCallback(\n (optionValue: string) => {\n onChange(optionValue);\n setOpen(false);\n },\n [onChange]\n );\n\n React.useEffect(() => {\n if (!open) return;\n const handleClickOutside = (event: MouseEvent) => {\n if (!wrapperRef.current?.contains(event.target as Node)) {\n setOpen(false);\n }\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, [open]);\n\n const selectedOption = options.find(opt => opt.value === value);\n\n const renderOption = (option: InputSelectProps['options'][0]) => {\n function handleClick() {\n handleOnOptionClick(option.value);\n }\n\n const isSelected = option.value === value;\n\n return (\n <li\n key={option.value}\n className={classnames(style.option, isSelected && style.selected)}\n role=\"option\"\n aria-selected={isSelected}\n onClick={handleClick}\n data-testid={`option-${option.value}`}\n data-name={option['data-name']}\n >\n <span className={style.optionIcon}>{option.icon}</span>\n <span className={style.optionLabel}>{option.label}</span>\n {isSelected ? (\n <span className={style.checkIcon}>\n <FontAwesomeIcon icon={selectedIcon as IconName} />\n </span>\n ) : null}\n </li>\n );\n };\n\n return (\n <div\n className={classnames(style.outerWrapper, {\n [style.open]: open\n })}\n >\n <div ref={wrapperRef} className={classnames(style.wrapper, className)} aria-label={ariaLabel}>\n <button\n type=\"button\"\n className={style.display}\n onClick={handleToggle}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? `${componentId}-listbox` : undefined}\n id={componentId}\n data-testid={buttonDataTestId}\n >\n <div className={style.content}>\n <span className={style.label}>{placeholder}</span>\n {selectedOption ? <span className={style.value}>{selectedOption.label}</span> : null}\n </div>\n <span className={classnames(style.iconWrapper, {[style.open]: open})}>\n <FontAwesomeIcon\n className={classnames(style.icon, {[style.rotated]: open})}\n icon={iconClosed as IconName}\n />\n </span>\n </button>\n {open ? (\n <ul id={`${componentId}-listbox`} className={style.menu} role=\"listbox\">\n {options.map(renderOption)}\n </ul>\n ) : null}\n </div>\n </div>\n );\n};\n\nInputSelect.propTypes = propTypes;\n\nexport default InputSelect;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAGC,QAAQ,EAAEC,MAAM,EAAEC,WAAW,QAAO,OAAO;AAC1D,OAAOC,UAAU,MAAM,YAAY;AACnC,SAAQC,eAAe,QAAO,gCAAgC;AAE9D,OAAOC,KAAK,MAAM,aAAa;AAE/B,OAAOC,SAAS,MAAM,SAAS;AAE/B,MAAMC,YAAY,GAAG,cAAc;AAEnC,MAAMC,WAAuC,GAAGA,CAAC;EAC/CC,OAAO,GAAG,EAAE;EACZC,KAAK;EACLC,QAAQ;EACRC,WAAW;EACXC,SAAS;EACT,YAAY,EAAEC,SAAS;EACvBC,UAAU,GAAG,cAAc;EAC3BC,YAAY,GAAG,cAAc;EAC7B,oBAAoB,EAAEC,gBAAgB,GAAG;AAC3C,CAAC,KAAK;EACJ,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGnB,QAAQ,CAAC,KAAK,CAAC;EACvC,MAAMoB,UAAU,GAAGnB,MAAM,CAAiB,IAAI,CAAC;EAE/C,MAAMoB,WAAW,GAAG,GAAGd,YAAY,IACjCK,WAAW,EAAEU,WAAW,CAAC,CAAC,CAACC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,SAAS,EAC5D;EAEF,MAAMC,YAAY,GAAGtB,WAAW,CAAC,MAAM;IACrCiB,OAAO,CAACM,CAAC,IAAI,CAACA,CAAC,CAAC;EAClB,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMC,mBAAmB,GAAGxB,WAAW,CACpCyB,WAAmB,IAAK;IACvBhB,QAAQ,CAACgB,WAAW,CAAC;IACrBR,OAAO,CAAC,KAAK,CAAC;EAChB,CAAC,EACD,CAACR,QAAQ,CACX,CAAC;EAEDZ,KAAK,CAAC6B,SAAS,CAAC,MA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AAA,CAACxC,eAAe;IACdS,SAAS,EAAEV,UAAU,CAACE,KAAK,CAAC6C,IAAI,EAAE;MAAC,CAAC7C,KAAK,CAAC0D,OAAO,GAAG7C;IAAI,CAAC,CAAE;IAC3DgC,IAAI,EAAEnC;EAAuB,CAC9B,CACG,CACA,CAAC,EACRG,IAAI,gBACHnB,KAAA,CAAA6C,aAAA;IAAIgB,EAAE,EAAE,GAAGvC,WAAW,UAAW;IAACR,SAAS,EAAER,KAAK,CAAC2D,IAAK;IAACjB,IAAI,EAAC;EAAS,GACpEtC,OAAO,CAACwD,GAAG,CAACzB,YAAY,CACvB,CAAC,GACH,IACD,CACF,CAAC;AAEV,CAAC;AAEDhC,WAAW,CAACF,SAAS,GAAA4D,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG9D,SAAS;AAEjC,eAAeE,WAAW","ignoreList":[]}
|
|
@@ -12,14 +12,6 @@
|
|
|
12
12
|
@value cm_blue_50 from colors;
|
|
13
13
|
@value cm_grey_150 from colors;
|
|
14
14
|
|
|
15
|
-
.container {
|
|
16
|
-
width: 100%;
|
|
17
|
-
position: relative;
|
|
18
|
-
border-radius: 12px;
|
|
19
|
-
background-color: #fff;
|
|
20
|
-
box-shadow: 0 4px 8px 0px rgba(0,0,0,0.04);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
15
|
.outerWrapper {
|
|
24
16
|
width: 100%;
|
|
25
17
|
border-radius: 12px;
|
|
@@ -103,41 +95,19 @@
|
|
|
103
95
|
transform: rotate(180deg);
|
|
104
96
|
}
|
|
105
97
|
|
|
106
|
-
.
|
|
98
|
+
.menu {
|
|
107
99
|
position: absolute;
|
|
108
|
-
top: 52px;
|
|
109
100
|
left: 0;
|
|
110
|
-
|
|
101
|
+
right: 0;
|
|
102
|
+
margin-top: 8px;
|
|
103
|
+
background: white;
|
|
111
104
|
border-radius: 12px;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.07);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.menu {
|
|
118
|
-
max-height: 322px;
|
|
119
|
-
overflow-y: scroll;
|
|
120
|
-
list-style: none;
|
|
105
|
+
box-shadow: 0 4px 8px 0px rgba(0,0,0,0.04);
|
|
106
|
+
z-index: 10;
|
|
121
107
|
padding: 12px;
|
|
122
|
-
|
|
108
|
+
list-style: none;
|
|
123
109
|
width: 100%;
|
|
124
|
-
border-radius: 12px;
|
|
125
110
|
box-sizing: border-box;
|
|
126
|
-
background: #fff;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.menuWrapper.showFade::after {
|
|
130
|
-
content: "";
|
|
131
|
-
position: absolute;
|
|
132
|
-
bottom: 0;
|
|
133
|
-
left: 0;
|
|
134
|
-
right: 0;
|
|
135
|
-
width: 100%;
|
|
136
|
-
height: 40px;
|
|
137
|
-
background: linear-gradient(to bottom, transparent 0%, #fff 80%);
|
|
138
|
-
border-radius: 12px;
|
|
139
|
-
pointer-events: none;
|
|
140
|
-
z-index: 2;
|
|
141
111
|
}
|
|
142
112
|
|
|
143
113
|
.option {
|
|
@@ -196,4 +166,4 @@
|
|
|
196
166
|
color: brand;
|
|
197
167
|
display: inline-flex;
|
|
198
168
|
align-items: center;
|
|
199
|
-
}
|
|
169
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/button-menu-action/index.tsx"],"names":[],"mappings":";AAOA,OAAkB,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAGzD,QAAA,MAAM,gBAAgB;YAAW,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/button-menu-action/index.tsx"],"names":[],"mappings":";AAOA,OAAkB,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAGzD,QAAA,MAAM,gBAAgB;YAAW,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsFrD,CAAC;AAIF,eAAe,gBAAgB,CAAC"}
|
|
@@ -17,8 +17,7 @@ const ButtonMenuAction = props => {
|
|
|
17
17
|
primaryColor,
|
|
18
18
|
containerCustom,
|
|
19
19
|
closeOnClick = false,
|
|
20
|
-
enableScroll = false
|
|
21
|
-
showFade = false
|
|
20
|
+
enableScroll = false
|
|
22
21
|
} = props;
|
|
23
22
|
const {
|
|
24
23
|
onClick = _noop
|
|
@@ -47,12 +46,8 @@ const ButtonMenuAction = props => {
|
|
|
47
46
|
onClick: () => setVisible(false)
|
|
48
47
|
}), menu.buttons)
|
|
49
48
|
} : menu;
|
|
50
|
-
const menuWrapperClass = classnames(style.menuWrapper, {
|
|
51
|
-
[style.visible]: visible,
|
|
52
|
-
[style.showFade]: showFade && menuWithClose.buttons && menuWithClose.buttons.length > 6
|
|
53
|
-
});
|
|
54
49
|
const _menu = /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className:
|
|
50
|
+
className: classnames(style.menuWrapper, visible && style.visible),
|
|
56
51
|
"data-name": "menu-wrapper",
|
|
57
52
|
"aria-label": menuWrapper?.ariaLabel,
|
|
58
53
|
style: menuWrapper?.customStyle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useState","useRef","classnames","map","FontAwesomeIcon","ButtonLink","ButtonMenu","propTypes","style","ButtonMenuAction","props","button","menu","menuWrapper","type","primaryColor","containerCustom","closeOnClick","enableScroll","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useState","useRef","classnames","map","FontAwesomeIcon","ButtonLink","ButtonMenu","propTypes","style","ButtonMenuAction","props","button","menu","menuWrapper","type","primaryColor","containerCustom","closeOnClick","enableScroll","onClick","_noop","visible","setVisible","containerRef","toggleVisibility","prevState","handleMouseDown","event","current","contains","target","document","addEventListener","removeEventListener","menuWithClose","buttons","btn","_menu","createElement","className","ariaLabel","customStyle","_extends","container","ref","currentOption","color","undefined","label","icon","caret","process","env","NODE_ENV"],"sources":["../../../src/molecule/button-menu-action/index.tsx"],"sourcesContent":["import React, {useCallback, useEffect, useState, useRef} from 'react';\nimport classnames from 'classnames';\nimport {noop} from 'lodash/fp';\nimport map from 'lodash/fp/map';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonMenu from '../../atom/button-menu';\nimport propTypes, {ButtonMenuActionProps} from './types';\nimport style from './style.css';\n\nconst ButtonMenuAction = (props: ButtonMenuActionProps) => {\n const {\n button,\n menu,\n menuWrapper,\n type = 'button',\n primaryColor,\n containerCustom,\n closeOnClick = false,\n enableScroll = false\n } = props;\n const {onClick = noop} = button;\n const [visible, setVisible] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const toggleVisibility = useCallback(() => {\n onClick();\n setVisible(prevState => !prevState);\n }, [onClick]);\n\n useEffect(() => {\n const handleMouseDown = (event: MouseEvent) => {\n if (visible && containerRef.current && !containerRef.current.contains(event.target as Node)) {\n setVisible(false);\n }\n };\n\n document.addEventListener('mousedown', handleMouseDown);\n return () => {\n document.removeEventListener('mousedown', handleMouseDown);\n };\n }, [visible, containerRef]);\n\n const menuWithClose = closeOnClick\n ? {\n ...menu,\n buttons: map(\n btn => ({\n ...btn,\n onClick: () => setVisible(false)\n }),\n menu.buttons\n )\n }\n : menu;\n\n const _menu = (\n <div\n className={classnames(style.menuWrapper, visible && style.visible)}\n data-name=\"menu-wrapper\"\n aria-label={menuWrapper?.ariaLabel}\n style={menuWrapper?.customStyle}\n >\n <ButtonMenu {...menuWithClose} enableScroll={enableScroll} />\n </div>\n );\n\n return (\n <div\n className={style.container}\n data-name=\"button-menu-action-wrapper\"\n style={containerCustom}\n ref={containerRef}\n >\n {type === 'link' ? (\n <div\n className={style.currentOption}\n data-name={button['data-name']}\n onClick={toggleVisibility}\n aria-expanded={visible}\n aria-haspopup=\"true\"\n >\n <span style={{color: visible ? primaryColor : undefined}}>{button.label}</span>\n <FontAwesomeIcon\n icon={visible ? 'chevron-up' : 'chevron-down'}\n className={style.caret}\n style={{color: visible ? primaryColor : undefined}}\n aria-label={button['aria-label']}\n />\n </div>\n ) : (\n <ButtonLink {...button} onClick={toggleVisibility} />\n )}\n {_menu}\n </div>\n );\n};\n\nButtonMenuAction.propTypes = propTypes;\n\nexport default ButtonMenuAction;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,QAAO,OAAO;AACrE,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,GAAG,MAAM,eAAe;AAC/B,SAAQC,eAAe,QAAO,gCAAgC;AAC9D,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,OAAOC,SAAS,MAA+B,SAAS;AACxD,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,gBAAgB,GAAIC,KAA4B,IAAK;EACzD,MAAM;IACJC,MAAM;IACNC,IAAI;IACJC,WAAW;IACXC,IAAI,GAAG,QAAQ;IACfC,YAAY;IACZC,eAAe;IACfC,YAAY,GAAG,KAAK;IACpBC,YAAY,GAAG;EACjB,CAAC,GAAGR,KAAK;EACT,MAAM;IAACS,OAAO,GAAAC;EAAO,CAAC,GAAGT,MAAM;EAC/B,MAAM,CAACU,OAAO,EAAEC,UAAU,CAAC,GAAGtB,QAAQ,CAAC,KAAK,CAAC;EAC7C,MAAMuB,YAAY,GAAGtB,MAAM,CAAiB,IAAI,CAAC;EAEjD,MAAMuB,gBAAgB,GAAG1B,WAAW,CAAC,MAAM;IACzCqB,OAAO,CAAC,CAAC;IACTG,UAAU,CAACG,SAAS,IAAI,CAACA,SAAS,CAAC;E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GAEjBT,IAAI,KAAK,MAAM,gBACdjB,KAAA,CAAAyC,aAAA;IACEC,SAAS,EAAE/B,KAAK,CAACqC,aAAc;IAC/B,aAAWlC,MAAM,CAAC,WAAW,CAAE;IAC/BQ,OAAO,EAAEK,gBAAiB;IAC1B,iBAAeH,OAAQ;IACvB,iBAAc;EAAM,gBAEpBxB,KAAA,CAAAyC,aAAA;IAAM9B,KAAK,EAAE;MAACsC,KAAK,EAAEzB,OAAO,GAAGN,YAAY,GAAGgC;IAAS;EAAE,GAAEpC,MAAM,CAACqC,KAAY,CAAC,eAC/EnD,KAAA,CAAAyC,aAAA,CAAClC,eAAe;IACd6C,IAAI,EAAE5B,OAAO,GAAG,YAAY,GAAG,cAAe;IAC9CkB,SAAS,EAAE/B,KAAK,CAAC0C,KAAM;IACvB1C,KAAK,EAAE;MAACsC,KAAK,EAAEzB,OAAO,GAAGN,YAAY,GAAGgC;IAAS,CAAE;IACnD,cAAYpC,MAAM,CAAC,YAAY;EAAE,CAClC,CACE,CAAC,gBAENd,KAAA,CAAAyC,aAAA,CAACjC,UAAU,EAAAqC,QAAA,KAAK/B,MAAM;IAAEQ,OAAO,EAAEK;EAAiB,EAAE,CACrD,EACAa,KACE,CAAC;AAEV,CAAC;AAED5B,gBAAgB,CAACF,SAAS,GAAA4C,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG9C,SAAS;AAEtC,eAAeE,gBAAgB","ignoreList":[]}
|
|
@@ -27,17 +27,6 @@
|
|
|
27
27
|
overflow: hidden;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.menuWrapper.showFade::after {
|
|
31
|
-
content: "";
|
|
32
|
-
position: absolute;
|
|
33
|
-
bottom: 0;
|
|
34
|
-
left: 0;
|
|
35
|
-
right: 0;
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 30px;
|
|
38
|
-
background: linear-gradient(to bottom, transparent 0%, #fff 80%);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
30
|
.menuWrapper > button {
|
|
42
31
|
cursor: pointer;
|
|
43
32
|
}
|
|
@@ -96,7 +96,6 @@ export declare type ButtonMenuActionProps = {
|
|
|
96
96
|
containerCustom?: Record<string, string | number>;
|
|
97
97
|
closeOnClick?: boolean;
|
|
98
98
|
enableScroll?: boolean;
|
|
99
|
-
showFade?: boolean;
|
|
100
99
|
};
|
|
101
100
|
export declare type ButtonMenuActionPropsFixture = {
|
|
102
101
|
props: ButtonMenuActionProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/button-menu-action/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAA4B,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAClF,OAA4B,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAElF,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa9B,CAAC;AACF,eAAe,yBAAyB,CAAC;AAEzC,oBAAY,qBAAqB,GAAG;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,WAAW,CAAC,EAAE;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;KAC/C,CAAC;IACF,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/button-menu-action/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAA4B,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAClF,OAA4B,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAElF,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa9B,CAAC;AACF,eAAe,yBAAyB,CAAC;AAEzC,oBAAY,qBAAqB,GAAG;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,WAAW,CAAC,EAAE;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;KAC/C,CAAC;IACF,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,oBAAY,4BAA4B,GAAG;IAAC,KAAK,EAAE,qBAAqB,CAAA;CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["PropTypes","ButtonLinkPropTypes","ButtonMenuPropTypes","ButtonMenuActionPropTypes","button","shape","isRequired","menu","menuWrapper","ariaLabel","string","customStyle","objectOf","oneOfType","number","object","type","oneOf","primaryColor","closeOnClick","bool","enableScroll"],"sources":["../../../src/molecule/button-menu-action/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport ButtonLinkPropTypes, {ButtonLinkProps} from '../../atom/button-link/types';\nimport ButtonMenuPropTypes, {ButtonMenuProps} from '../../atom/button-menu/types';\n\nconst ButtonMenuActionPropTypes = {\n button: PropTypes.shape(ButtonLinkPropTypes).isRequired,\n menu: PropTypes.shape(ButtonMenuPropTypes).isRequired,\n menuWrapper: PropTypes.shape({\n ariaLabel: PropTypes.string,\n customStyle: PropTypes.objectOf(\n PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])\n )\n }),\n type: PropTypes.oneOf(['button', 'link']),\n primaryColor: PropTypes.string,\n closeOnClick: PropTypes.bool,\n enableScroll: PropTypes.bool\n};\nexport default ButtonMenuActionPropTypes;\n\nexport type ButtonMenuActionProps = {\n button: ButtonLinkProps;\n menu: ButtonMenuProps;\n menuWrapper?: {\n ariaLabel?: string;\n customStyle?: Record<string, string | number>;\n };\n type?: 'button' | 'link';\n primaryColor?: string;\n containerCustom?: Record<string, string | number>;\n closeOnClick?: boolean;\n enableScroll?: boolean;\n
|
|
1
|
+
{"version":3,"file":"types.js","names":["PropTypes","ButtonLinkPropTypes","ButtonMenuPropTypes","ButtonMenuActionPropTypes","button","shape","isRequired","menu","menuWrapper","ariaLabel","string","customStyle","objectOf","oneOfType","number","object","type","oneOf","primaryColor","closeOnClick","bool","enableScroll"],"sources":["../../../src/molecule/button-menu-action/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport ButtonLinkPropTypes, {ButtonLinkProps} from '../../atom/button-link/types';\nimport ButtonMenuPropTypes, {ButtonMenuProps} from '../../atom/button-menu/types';\n\nconst ButtonMenuActionPropTypes = {\n button: PropTypes.shape(ButtonLinkPropTypes).isRequired,\n menu: PropTypes.shape(ButtonMenuPropTypes).isRequired,\n menuWrapper: PropTypes.shape({\n ariaLabel: PropTypes.string,\n customStyle: PropTypes.objectOf(\n PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])\n )\n }),\n type: PropTypes.oneOf(['button', 'link']),\n primaryColor: PropTypes.string,\n closeOnClick: PropTypes.bool,\n enableScroll: PropTypes.bool\n};\nexport default ButtonMenuActionPropTypes;\n\nexport type ButtonMenuActionProps = {\n button: ButtonLinkProps;\n menu: ButtonMenuProps;\n menuWrapper?: {\n ariaLabel?: string;\n customStyle?: Record<string, string | number>;\n };\n type?: 'button' | 'link';\n primaryColor?: string;\n containerCustom?: Record<string, string | number>;\n closeOnClick?: boolean;\n enableScroll?: boolean;\n};\n\nexport type ButtonMenuActionPropsFixture = {props: ButtonMenuActionProps};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,mBAAmB,MAAyB,8BAA8B;AACjF,OAAOC,mBAAmB,MAAyB,8BAA8B;AAEjF,MAAMC,yBAAyB,GAAG;EAChCC,MAAM,EAAEJ,SAAS,CAACK,KAAK,CAACJ,mBAAmB,CAAC,CAACK,UAAU;EACvDC,IAAI,EAAEP,SAAS,CAACK,KAAK,CAACH,mBAAmB,CAAC,CAACI,UAAU;EACrDE,WAAW,EAAER,SAAS,CAACK,KAAK,CAAC;IAC3BI,SAAS,EAAET,SAAS,CAACU,MAAM;IAC3BC,WAAW,EAAEX,SAAS,CAACY,QAAQ,CAC7BZ,SAAS,CAACa,SAAS,CAAC,CAACb,SAAS,CAACU,MAAM,EAAEV,SAAS,CAACc,MAAM,EAAEd,SAAS,CAACe,MAAM,CAAC,CAC5E;EACF,CAAC,CAAC;EACFC,IAAI,EAAEhB,SAAS,CAACiB,KAAK,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;EACzCC,YAAY,EAAElB,SAAS,CAACU,MAAM;EAC9BS,YAAY,EAAEnB,SAAS,CAACoB,IAAI;EAC5BC,YAAY,EAAErB,SAAS,CAACoB;AAC1B,CAAC;AACD,eAAejB,yBAAyB","ignoreList":[]}
|
|
@@ -4,10 +4,7 @@ declare const HeaderWithActions: {
|
|
|
4
4
|
(props: HeaderWithActionsProps): JSX.Element;
|
|
5
5
|
propTypes: {
|
|
6
6
|
closeButton: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
7
|
-
|
|
8
|
-
icon: import("prop-types").Validator<string>;
|
|
9
|
-
'data-name': import("prop-types").Validator<string>;
|
|
10
|
-
'aria-label': import("prop-types").Validator<string>;
|
|
7
|
+
'aria-label': import("prop-types").Requireable<string>;
|
|
11
8
|
onClick: import("prop-types").Validator<(...args: any[]) => any>;
|
|
12
9
|
}>>;
|
|
13
10
|
title: import("prop-types").Validator<string>;
|
|
@@ -20,80 +17,25 @@ declare const HeaderWithActions: {
|
|
|
20
17
|
display: import("prop-types").Validator<boolean>;
|
|
21
18
|
label: import("prop-types").Requireable<string>;
|
|
22
19
|
}>>>;
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
actionButtons: import("prop-types").Validator<(import("prop-types").InferProps<{
|
|
21
|
+
type: import("prop-types").Requireable<string>;
|
|
22
|
+
label: import("prop-types").Validator<string>;
|
|
23
|
+
onClick: import("prop-types").Validator<(...args: any[]) => any>;
|
|
25
24
|
disabled: import("prop-types").Requireable<boolean>;
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
iconName: import("prop-types").Requireable<string>;
|
|
26
|
+
iconColor: import("prop-types").Requireable<string>;
|
|
27
|
+
}> | null | undefined)[]>;
|
|
28
|
+
bulletPointMenuButtonPropTypes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
28
29
|
buttons: import("prop-types").Validator<(import("prop-types").InferProps<{
|
|
29
|
-
|
|
30
|
-
disabled: import("prop-types").Requireable<boolean>;
|
|
30
|
+
dataName: import("prop-types").Requireable<string>;
|
|
31
31
|
label: import("prop-types").Validator<string>;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
icon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
36
|
-
theme: import("prop-types").Requireable<string>;
|
|
37
|
-
position: import("prop-types").Requireable<string>;
|
|
38
|
-
type: import("prop-types").Requireable<string>;
|
|
39
|
-
faIcon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
40
|
-
name: import("prop-types").Validator<string>;
|
|
41
|
-
color: import("prop-types").Requireable<string>;
|
|
42
|
-
backgroundColor: import("prop-types").Requireable<string>;
|
|
43
|
-
size: import("prop-types").Requireable<number>;
|
|
44
|
-
customStyle: import("prop-types").Requireable<{
|
|
45
|
-
[x: string]: NonNullable<string | number | null | undefined> | null | undefined;
|
|
46
|
-
}>;
|
|
47
|
-
}>>;
|
|
48
|
-
}>>;
|
|
49
|
-
customStyle: import("prop-types").Requireable<{
|
|
50
|
-
[x: string]: NonNullable<string | number | null | undefined> | null | undefined;
|
|
51
|
-
}>;
|
|
52
|
-
customLabelClassName: import("prop-types").Requireable<string>;
|
|
32
|
+
iconName: import("prop-types").Validator<string>;
|
|
33
|
+
iconColor: import("prop-types").Validator<string>;
|
|
34
|
+
onClick: import("prop-types").Validator<(...args: any[]) => any>;
|
|
53
35
|
}> | null | undefined)[]>;
|
|
54
|
-
onClick: import("prop-types").
|
|
55
|
-
|
|
56
|
-
isBulkMenu: import("prop-types").Requireable<boolean>;
|
|
36
|
+
onClick: import("prop-types").Validator<(...args: any[]) => any>;
|
|
37
|
+
buttonAriaLabel: import("prop-types").Requireable<string>;
|
|
57
38
|
}>>;
|
|
58
|
-
actionButtons: import("prop-types").Validator<(import("prop-types").InferProps<{
|
|
59
|
-
type: import("prop-types").Requireable<string>;
|
|
60
|
-
usage: import("prop-types").Requireable<string>;
|
|
61
|
-
label: import("prop-types").Requireable<string>;
|
|
62
|
-
content: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
63
|
-
'aria-label': import("prop-types").Requireable<string>;
|
|
64
|
-
tooltipText: import("prop-types").Requireable<string>;
|
|
65
|
-
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
66
|
-
'data-name': import("prop-types").Requireable<string>;
|
|
67
|
-
'data-testid': import("prop-types").Requireable<string>;
|
|
68
|
-
icon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
69
|
-
position: import("prop-types").Requireable<string>;
|
|
70
|
-
type: import("prop-types").Requireable<string>;
|
|
71
|
-
faIcon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
72
|
-
name: import("prop-types").Validator<string>;
|
|
73
|
-
color: import("prop-types").Requireable<string>;
|
|
74
|
-
backgroundColor: import("prop-types").Requireable<string>;
|
|
75
|
-
size: import("prop-types").Requireable<number>;
|
|
76
|
-
customStyle: import("prop-types").Requireable<{
|
|
77
|
-
[x: string]: NonNullable<string | number | null | undefined> | null | undefined;
|
|
78
|
-
}>;
|
|
79
|
-
}>>;
|
|
80
|
-
}>>;
|
|
81
|
-
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
82
|
-
link: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
83
|
-
href: import("prop-types").Requireable<string>;
|
|
84
|
-
download: import("prop-types").Requireable<boolean>;
|
|
85
|
-
target: import("prop-types").Requireable<string>;
|
|
86
|
-
}>>;
|
|
87
|
-
hoverBackgroundColor: import("prop-types").Requireable<string>;
|
|
88
|
-
hoverColor: import("prop-types").Requireable<string>;
|
|
89
|
-
disabled: import("prop-types").Requireable<boolean>;
|
|
90
|
-
className: import("prop-types").Requireable<string>;
|
|
91
|
-
customStyle: import("prop-types").Requireable<{
|
|
92
|
-
[x: string]: NonNullable<string | number | null | undefined> | null | undefined;
|
|
93
|
-
}>;
|
|
94
|
-
useTitle: import("prop-types").Requireable<boolean>;
|
|
95
|
-
customLabelClassName: import("prop-types").Requireable<string>;
|
|
96
|
-
}> | null | undefined)[]>;
|
|
97
39
|
};
|
|
98
40
|
};
|
|
99
41
|
export default HeaderWithActions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/header-with-actions/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/header-with-actions/index.tsx"],"names":[],"mappings":";AAOA,OAAmC,EACjC,sBAAsB,EAGvB,MAAM,SAAS,CAAC;AAuEjB,QAAA,MAAM,iBAAiB;YAAW,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCvD,CAAC;AAIF,eAAe,iBAAiB,CAAC"}
|
|
@@ -13,6 +13,74 @@ const getDataName = suffix => `header-with-actions-${suffix}`;
|
|
|
13
13
|
const uncappedMap = map.convert({
|
|
14
14
|
cap: false
|
|
15
15
|
});
|
|
16
|
+
const buildCloseButton = ({
|
|
17
|
+
onClick,
|
|
18
|
+
ariaLabel
|
|
19
|
+
}) => {
|
|
20
|
+
return {
|
|
21
|
+
size: 'default',
|
|
22
|
+
icon: 'close',
|
|
23
|
+
'data-name': 'close-button',
|
|
24
|
+
'aria-label': ariaLabel,
|
|
25
|
+
onClick
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const buildButtonMenu = ({
|
|
29
|
+
dataName,
|
|
30
|
+
label,
|
|
31
|
+
iconName,
|
|
32
|
+
iconColor,
|
|
33
|
+
onClick
|
|
34
|
+
}) => {
|
|
35
|
+
return {
|
|
36
|
+
'data-name': dataName,
|
|
37
|
+
label,
|
|
38
|
+
buttonLinkType: 'tertiary',
|
|
39
|
+
icon: {
|
|
40
|
+
position: 'left',
|
|
41
|
+
faIcon: {
|
|
42
|
+
name: iconName,
|
|
43
|
+
color: iconColor,
|
|
44
|
+
size: 14
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
onClick,
|
|
48
|
+
type: iconName === 'trash' ? 'dangerousLeft' : 'defaultLeft'
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const buildActionButton = ({
|
|
52
|
+
type,
|
|
53
|
+
label,
|
|
54
|
+
onClick,
|
|
55
|
+
disabled,
|
|
56
|
+
iconName,
|
|
57
|
+
iconColor
|
|
58
|
+
}) => {
|
|
59
|
+
const base = {
|
|
60
|
+
type,
|
|
61
|
+
label,
|
|
62
|
+
onClick,
|
|
63
|
+
disabled,
|
|
64
|
+
customStyle: {
|
|
65
|
+
fontWeight: '600',
|
|
66
|
+
borderRadius: '12px'
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
if (iconName && iconColor) {
|
|
70
|
+
return {
|
|
71
|
+
...base,
|
|
72
|
+
icon: {
|
|
73
|
+
position: 'left',
|
|
74
|
+
faIcon: {
|
|
75
|
+
name: iconName,
|
|
76
|
+
color: iconColor,
|
|
77
|
+
size: 14
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return base;
|
|
83
|
+
};
|
|
16
84
|
const HeaderWithActions = props => {
|
|
17
85
|
const {
|
|
18
86
|
closeButton,
|
|
@@ -28,7 +96,10 @@ const HeaderWithActions = props => {
|
|
|
28
96
|
}, /*#__PURE__*/React.createElement("div", {
|
|
29
97
|
className: style.titleAndButtonWrapper,
|
|
30
98
|
"data-name": getDataName('title-and-button-wrapper')
|
|
31
|
-
}, /*#__PURE__*/React.createElement(ButtonLinkIcon, _extends({},
|
|
99
|
+
}, /*#__PURE__*/React.createElement(ButtonLinkIcon, _extends({}, buildCloseButton({
|
|
100
|
+
onClick: closeButton.onClick,
|
|
101
|
+
ariaLabel: closeButton['aria-label']
|
|
102
|
+
}), {
|
|
32
103
|
className: style.button
|
|
33
104
|
})), /*#__PURE__*/React.createElement("div", {
|
|
34
105
|
className: style.titleWrapper
|
|
@@ -44,9 +115,9 @@ const HeaderWithActions = props => {
|
|
|
44
115
|
className: style.buttonsWrapper,
|
|
45
116
|
"data-name": getDataName('buttons-wrapper')
|
|
46
117
|
}, bulletPointMenuButton && !isEmpty(bulletPointMenuButton.buttons) ? /*#__PURE__*/React.createElement(BulletPointMenuButton, _extends({}, bulletPointMenuButton, {
|
|
47
|
-
|
|
118
|
+
buttons: uncappedMap(buildButtonMenu, bulletPointMenuButton.buttons)
|
|
48
119
|
})) : null, uncappedMap((action, key) => {
|
|
49
|
-
return /*#__PURE__*/React.createElement(ButtonLink, _extends({}, action, {
|
|
120
|
+
return /*#__PURE__*/React.createElement(ButtonLink, _extends({}, buildActionButton(action), {
|
|
50
121
|
key: key
|
|
51
122
|
}));
|
|
52
123
|
}, actionButtons)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","isEmpty","map","ButtonLink","ButtonLinkIcon","Tag","BulletPointMenuButton","headerWithActionsPropTypes","style","getDataName","suffix","uncappedMap","convert","cap","HeaderWithActions","props","closeButton","title","tag","saveStatus","bulletPointMenuButton","actionButtons","createElement","className","headerWrapper","titleAndButtonWrapper","_extends","button","titleWrapper","statusWrapper","display","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","isEmpty","map","ButtonLink","ButtonLinkIcon","Tag","BulletPointMenuButton","headerWithActionsPropTypes","style","getDataName","suffix","uncappedMap","convert","cap","buildCloseButton","onClick","ariaLabel","size","icon","buildButtonMenu","dataName","label","iconName","iconColor","buttonLinkType","position","faIcon","name","color","type","buildActionButton","disabled","base","customStyle","fontWeight","borderRadius","HeaderWithActions","props","closeButton","title","tag","saveStatus","bulletPointMenuButton","actionButtons","createElement","className","headerWrapper","titleAndButtonWrapper","_extends","button","titleWrapper","statusWrapper","display","buttonsWrapper","buttons","action","key","propTypes","process","env","NODE_ENV"],"sources":["../../../src/organism/header-with-actions/index.tsx"],"sourcesContent":["import React from 'react';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport map from 'lodash/fp/map';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Tag from '../../atom/tag';\nimport BulletPointMenuButton from '../../molecule/bullet-point-menu-button';\nimport headerWithActionsPropTypes, {\n HeaderWithActionsProps,\n ButtonMenuProps,\n ButtonActionProps\n} from './types';\nimport style from './style.css';\n\nconst getDataName = (suffix: string) => `header-with-actions-${suffix}`;\n// @ts-expect-error (need to get the index)\nconst uncappedMap = map.convert({cap: false});\n\nconst buildCloseButton = ({onClick, ariaLabel}: {onClick: () => void; ariaLabel: string}) => {\n return {\n size: 'default',\n icon: 'close',\n 'data-name': 'close-button',\n 'aria-label': ariaLabel,\n onClick\n };\n};\n\nconst buildButtonMenu = ({dataName, label, iconName, iconColor, onClick}: ButtonMenuProps) => {\n return {\n 'data-name': dataName,\n label,\n buttonLinkType: 'tertiary',\n icon: {\n position: 'left' as const,\n faIcon: {\n name: iconName,\n color: iconColor,\n size: 14\n }\n },\n onClick,\n type: iconName === 'trash' ? 'dangerousLeft' : 'defaultLeft'\n };\n};\n\nconst buildActionButton = ({\n type,\n label,\n onClick,\n disabled,\n iconName,\n iconColor\n}: ButtonActionProps) => {\n const base = {\n type,\n label,\n onClick,\n disabled,\n customStyle: {\n fontWeight: '600',\n borderRadius: '12px'\n }\n };\n\n if (iconName && iconColor) {\n return {\n ...base,\n icon: {\n position: 'left' as const,\n faIcon: {\n name: iconName,\n color: iconColor,\n size: 14\n }\n }\n };\n }\n\n return base;\n};\n\nconst HeaderWithActions = (props: HeaderWithActionsProps) => {\n const {closeButton, title, tag, saveStatus, bulletPointMenuButton, actionButtons} = props;\n\n return (\n <div className={style.headerWrapper} data-name={getDataName('wrapper')}>\n <div\n className={style.titleAndButtonWrapper}\n data-name={getDataName('title-and-button-wrapper')}\n >\n <ButtonLinkIcon\n {...buildCloseButton({\n onClick: closeButton.onClick,\n ariaLabel: closeButton['aria-label']\n })}\n className={style.button}\n />\n <div className={style.titleWrapper}>\n <div className={style.statusWrapper}>\n <Tag {...tag} />\n {saveStatus.display && saveStatus.label ? (\n <p className={style.saveStatus}>{saveStatus.label}</p>\n ) : null}\n </div>\n <h3 className={style.title} aria-label={title} data-name={getDataName('title')}>\n {title}\n </h3>\n </div>\n </div>\n <div className={style.buttonsWrapper} data-name={getDataName('buttons-wrapper')}>\n {bulletPointMenuButton && !isEmpty(bulletPointMenuButton.buttons) ? (\n <BulletPointMenuButton\n {...bulletPointMenuButton}\n buttons={uncappedMap(buildButtonMenu, bulletPointMenuButton.buttons)}\n />\n ) : null}\n {uncappedMap((action: ButtonActionProps, key: string) => {\n return <ButtonLink {...buildActionButton(action)} key={key} />;\n }, actionButtons)}\n </div>\n </div>\n );\n};\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