@laerdal/life-react-components 2.3.1-dev.11.full → 2.3.1-dev.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Footer/SiteFooter.cjs +19 -30
- package/dist/Footer/SiteFooter.cjs.map +1 -1
- package/dist/Footer/SiteFooter.d.ts +1 -3
- package/dist/Footer/SiteFooter.js +19 -31
- package/dist/Footer/SiteFooter.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs +2 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js +2 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js +2 -2
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs +66 -5
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.js +66 -5
- package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs +102 -19
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.d.ts +4 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.js +102 -19
- package/dist/GlobalNavigationBar/desktop/SubMenu.js.map +1 -1
- package/dist/Layouts/index.cjs +6 -4
- package/dist/Layouts/index.cjs.map +1 -1
- package/dist/Layouts/index.d.ts +1 -0
- package/dist/Layouts/index.js +4 -3
- package/dist/Layouts/index.js.map +1 -1
- package/dist/NavItem/NestedNavItem.cjs.map +1 -1
- package/dist/NavItem/NestedNavItem.js.map +1 -1
- package/dist/Tabs/TabLink.cjs +3 -4
- package/dist/Tabs/TabLink.cjs.map +1 -1
- package/dist/Tabs/TabLink.d.ts +13 -14
- package/dist/Tabs/TabLink.js +3 -4
- package/dist/Tabs/TabLink.js.map +1 -1
- package/package.json +3 -3
|
@@ -22,7 +22,7 @@ export var SubMenuWrapper = styled.div(_templateObject || (_templateObject = _ta
|
|
|
22
22
|
}, function (props) {
|
|
23
23
|
return !props.visible ? 'display: none;' : '';
|
|
24
24
|
});
|
|
25
|
-
export var SubMenu = function
|
|
25
|
+
export var SubMenu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
26
26
|
var item = _ref.item,
|
|
27
27
|
index = _ref.index,
|
|
28
28
|
topLevel = _ref.topLevel,
|
|
@@ -30,11 +30,33 @@ export var SubMenu = function SubMenu(_ref) {
|
|
|
30
30
|
onSubMenuHidden = _ref.onSubMenuHidden,
|
|
31
31
|
onSubMenuOpened = _ref.onSubMenuOpened,
|
|
32
32
|
onItemStateChanged = _ref.onItemStateChanged,
|
|
33
|
+
focusedItemId = _ref.focusedItemId,
|
|
33
34
|
activeItemId = _ref.activeItemId,
|
|
34
|
-
nestPath = _ref.nestPath
|
|
35
|
+
nestPath = _ref.nestPath,
|
|
36
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
37
|
+
onItemFocused = _ref.onItemFocused;
|
|
35
38
|
var _React$useState = React.useState({}),
|
|
36
39
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
37
40
|
forceUpdate = _React$useState2[1];
|
|
41
|
+
var focusedRef = React.useRef({
|
|
42
|
+
index: -1
|
|
43
|
+
});
|
|
44
|
+
var _React$useState3 = React.useState([]),
|
|
45
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
46
|
+
allRefs = _React$useState4[0],
|
|
47
|
+
setAllRefs = _React$useState4[1];
|
|
48
|
+
var _React$useState5 = React.useState([]),
|
|
49
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
50
|
+
subMenuRefs = _React$useState6[0],
|
|
51
|
+
setAllSubMenuRefs = _React$useState6[1];
|
|
52
|
+
React.useEffect(function () {
|
|
53
|
+
setAllRefs(item.items.map(function (x) {
|
|
54
|
+
return x.type == 'desktopgroup' ? /*#__PURE__*/React.createRef() : /*#__PURE__*/React.createRef();
|
|
55
|
+
}));
|
|
56
|
+
setAllSubMenuRefs(item.items.map(function (x) {
|
|
57
|
+
return x.type == 'desktopgroup' ? /*#__PURE__*/React.createRef() : undefined;
|
|
58
|
+
}));
|
|
59
|
+
}, [item]);
|
|
38
60
|
var existingRef = dropdownMenusOpenedArray.current.find(function (x) {
|
|
39
61
|
return x == item.id;
|
|
40
62
|
});
|
|
@@ -59,30 +81,77 @@ export var SubMenu = function SubMenu(_ref) {
|
|
|
59
81
|
forceUpdate({});
|
|
60
82
|
}
|
|
61
83
|
};
|
|
62
|
-
var _onKeyDown = function onKeyDown(
|
|
63
|
-
if (
|
|
64
|
-
|
|
84
|
+
var _onKeyDown = function onKeyDown(e) {
|
|
85
|
+
if (e.key === 'ArrowUp' || e.key === 'Up') {
|
|
86
|
+
e.stopPropagation();
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
if (focusedRef.current.index > 0) {
|
|
89
|
+
setNewFocusedElement(focusedRef.current.index - 1);
|
|
90
|
+
}
|
|
91
|
+
} else if (e.key === 'ArrowDown' || e.key === 'Down') {
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
if (focusedRef.current.index < allRefs.length - 1) setNewFocusedElement(focusedRef.current.index + 1);
|
|
95
|
+
} else if (e.key == 'Enter' || e.code == 'Space') {
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
if (focusedRef.current.index < 0) return;
|
|
98
|
+
var focusedItem = item.items[focusedRef.current.index];
|
|
99
|
+
if (focusedItem.type == 'desktopgroup') {
|
|
100
|
+
dropdownMenusOpenedArray.current = [].concat(_toConsumableArray(dropdownMenusOpenedArray.current), [focusedItem.id]);
|
|
101
|
+
forceUpdate({});
|
|
102
|
+
} else {
|
|
103
|
+
var _allRefs$focusedRef$c;
|
|
104
|
+
(_allRefs$focusedRef$c = allRefs[focusedRef.current.index].current) === null || _allRefs$focusedRef$c === void 0 ? void 0 : _allRefs$focusedRef$c.click();
|
|
105
|
+
forceUpdate({});
|
|
106
|
+
}
|
|
107
|
+
|
|
65
108
|
//just trigger rerendering
|
|
66
|
-
forceUpdate({});
|
|
67
109
|
}
|
|
68
110
|
};
|
|
111
|
+
|
|
112
|
+
var setNewFocusedElement = function setNewFocusedElement(index) {
|
|
113
|
+
var _oldFocusedElement$cu;
|
|
114
|
+
var newFocusedElement = index >= 0 ? allRefs[index] : null;
|
|
115
|
+
var oldFocusedElement = focusedRef.current.index >= 0 ? allRefs[focusedRef.current.index] : null;
|
|
116
|
+
focusedRef.current.index = index;
|
|
117
|
+
if (oldFocusedElement) oldFocusedElement === null || oldFocusedElement === void 0 ? void 0 : (_oldFocusedElement$cu = oldFocusedElement.current) === null || _oldFocusedElement$cu === void 0 ? void 0 : _oldFocusedElement$cu.classList.remove('dropdown-hover');
|
|
118
|
+
if (newFocusedElement && newFocusedElement !== oldFocusedElement) {
|
|
119
|
+
var _newFocusedElement$cu, _item$items$index$id;
|
|
120
|
+
(_newFocusedElement$cu = newFocusedElement.current) === null || _newFocusedElement$cu === void 0 ? void 0 : _newFocusedElement$cu.classList.add('dropdown-hover');
|
|
121
|
+
console.log(item.items[index].id);
|
|
122
|
+
onItemFocused && onItemFocused((_item$items$index$id = item.items[index].id) !== null && _item$items$index$id !== void 0 ? _item$items$index$id : '');
|
|
123
|
+
} else if (onItemFocused) onItemFocused('');
|
|
124
|
+
};
|
|
69
125
|
var onFocus = function onFocus(event) {
|
|
126
|
+
event.stopPropagation();
|
|
70
127
|
dropdownMenusOpenedArray.current = _toConsumableArray(nestPath !== null && nestPath !== void 0 ? nestPath : []);
|
|
128
|
+
setNewFocusedElement(0);
|
|
71
129
|
forceUpdate({});
|
|
72
130
|
};
|
|
131
|
+
var onBlur = function onBlur(event) {
|
|
132
|
+
event.stopPropagation();
|
|
133
|
+
setNewFocusedElement(-1);
|
|
134
|
+
};
|
|
73
135
|
return /*#__PURE__*/_jsx(SubMenuWrapper, {
|
|
74
136
|
id: item.id,
|
|
75
137
|
className: existingRef ? 'open' : '',
|
|
76
138
|
topLevel: topLevel,
|
|
77
139
|
visible: Boolean(existingRef),
|
|
78
140
|
children: /*#__PURE__*/_jsx(Menu, {
|
|
79
|
-
role: "
|
|
80
|
-
|
|
141
|
+
role: "group",
|
|
142
|
+
ref: ref,
|
|
143
|
+
"aria-labelledby": ariaLabelledBy,
|
|
144
|
+
onBlur: onBlur,
|
|
145
|
+
onFocus: onFocus,
|
|
146
|
+
onKeyDown: function onKeyDown(event) {
|
|
147
|
+
return _onKeyDown(event);
|
|
148
|
+
},
|
|
149
|
+
tabIndex: 0,
|
|
81
150
|
children: /*#__PURE__*/_jsx(MenuSection, {
|
|
82
151
|
children: /*#__PURE__*/_jsx(MenuSectionList, {
|
|
83
152
|
children: /*#__PURE__*/_jsx(Tabs, {
|
|
84
153
|
size: Size.Medium,
|
|
85
|
-
children: item.items.map(function (entry) {
|
|
154
|
+
children: item.items.map(function (entry, index) {
|
|
86
155
|
var _entry$label2;
|
|
87
156
|
var isGroup = entry.type == 'desktopgroup';
|
|
88
157
|
var key = isGroup ? entry.id : entry.type == 'item' ? entry.to : '';
|
|
@@ -90,7 +159,7 @@ export var SubMenu = function SubMenu(_ref) {
|
|
|
90
159
|
return x == entry.id;
|
|
91
160
|
}));
|
|
92
161
|
if (isGroup) {
|
|
93
|
-
var _entry$label;
|
|
162
|
+
var _entry$items$find$id, _entry$items$find, _entry$label;
|
|
94
163
|
return /*#__PURE__*/_jsxs("div", {
|
|
95
164
|
style: {
|
|
96
165
|
position: 'relative'
|
|
@@ -102,12 +171,17 @@ export var SubMenu = function SubMenu(_ref) {
|
|
|
102
171
|
return _onMouseLeave(event, entry.id);
|
|
103
172
|
},
|
|
104
173
|
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return
|
|
109
|
-
},
|
|
110
|
-
|
|
174
|
+
id: entry.id + '_parentOption',
|
|
175
|
+
"aria-expanded": Boolean(SubItemOpened),
|
|
176
|
+
"aria-activedescendant": (_entry$items$find$id = (_entry$items$find = entry.items.find(function (x) {
|
|
177
|
+
return x.id == focusedItemId;
|
|
178
|
+
})) === null || _entry$items$find === void 0 ? void 0 : _entry$items$find.id) !== null && _entry$items$find$id !== void 0 ? _entry$items$find$id : '',
|
|
179
|
+
tabIndex: -1,
|
|
180
|
+
ref: allRefs[index],
|
|
181
|
+
"aria-controls": entry.id,
|
|
182
|
+
role: "group"
|
|
183
|
+
//id={entry.id} removing this can break something
|
|
184
|
+
,
|
|
111
185
|
item: {
|
|
112
186
|
value: (_entry$label = entry.label) !== null && _entry$label !== void 0 ? _entry$label : ''
|
|
113
187
|
},
|
|
@@ -117,6 +191,10 @@ export var SubMenu = function SubMenu(_ref) {
|
|
|
117
191
|
active: SubItemOpened || Boolean(activeItemId) && activeItemId != '' && checkIfContainsItem(entry, activeItemId),
|
|
118
192
|
onClickHandler: function onClickHandler() {}
|
|
119
193
|
}), /*#__PURE__*/_jsx(SubMenu, {
|
|
194
|
+
ariaLabelledBy: entry.id + '_parentOption',
|
|
195
|
+
onItemFocused: onItemFocused,
|
|
196
|
+
focusedItemId: focusedItemId,
|
|
197
|
+
ref: subMenuRefs[index],
|
|
120
198
|
nestPath: [].concat(_toConsumableArray(nestPath !== null && nestPath !== void 0 ? nestPath : []), [entry.id]),
|
|
121
199
|
onItemStateChanged: onItemStateChanged,
|
|
122
200
|
activeItemId: activeItemId,
|
|
@@ -129,8 +207,10 @@ export var SubMenu = function SubMenu(_ref) {
|
|
|
129
207
|
}
|
|
130
208
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
131
209
|
children: /*#__PURE__*/_jsx(TabLink, {
|
|
210
|
+
id: entry.id,
|
|
211
|
+
tabIndex: -1,
|
|
132
212
|
to: isGroup ? '' : key,
|
|
133
|
-
|
|
213
|
+
ref: allRefs[index],
|
|
134
214
|
onActiveStateChanged: function onActiveStateChanged(state) {
|
|
135
215
|
return onItemStateChanged && entry.type == 'item' && onItemStateChanged(entry.to, state);
|
|
136
216
|
},
|
|
@@ -153,14 +233,17 @@ export var SubMenu = function SubMenu(_ref) {
|
|
|
153
233
|
})
|
|
154
234
|
})
|
|
155
235
|
});
|
|
156
|
-
};
|
|
236
|
+
});
|
|
157
237
|
SubMenu.propTypes = {
|
|
158
238
|
index: _pt.number.isRequired,
|
|
159
239
|
topLevel: _pt.bool.isRequired,
|
|
160
240
|
onSubMenuOpened: _pt.func,
|
|
161
241
|
onSubMenuHidden: _pt.func,
|
|
162
242
|
onItemStateChanged: _pt.func,
|
|
243
|
+
onItemFocused: _pt.func,
|
|
244
|
+
focusedItemId: _pt.string,
|
|
163
245
|
activeItemId: _pt.string,
|
|
164
|
-
nestPath: _pt.arrayOf(_pt.string)
|
|
246
|
+
nestPath: _pt.arrayOf(_pt.string),
|
|
247
|
+
ariaLabelledBy: _pt.string
|
|
165
248
|
};
|
|
166
249
|
//# sourceMappingURL=SubMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubMenu.js","names":["React","styled","Menu","MenuSection","MenuSectionList","Size","SystemIcons","checkIfContainsItem","Tabs","TabLink","MenuItem","SubMenuWrapper","div","props","topLevel","visible","SubMenu","item","index","dropdownMenusOpenedArray","onSubMenuHidden","onSubMenuOpened","onItemStateChanged","activeItemId","nestPath","useState","forceUpdate","existingRef","current","find","x","id","onMouseLeave","event","filter","containActiveItem","type","onMouseEnter","existingRefForId","onKeyDown","entryId","key","code","onFocus","Boolean","Medium","items","map","entry","isGroup","to","SubItemOpened","position","value","label","state","disabled"],"sources":["../../../src/GlobalNavigationBar/desktop/SubMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport { Menu, MenuSection, MenuSectionList } from './ExtendedMainMenu';\nimport { MenuNavigationItemTypeDesktopGroup } from '../types';\nimport { Size } from '../../types';\nimport { SystemIcons } from '../../icons';\nimport { checkIfContainsItem } from '../utils';\nimport Tabs from '../../Tabs/Tabs';\nimport TabLink from '../../Tabs/TabLink';\nimport { MenuItem } from '../../MenuItem';\n\nexport type SubMenuProps = {\n item: MenuNavigationItemTypeDesktopGroup;\n index: number;\n topLevel: boolean;\n dropdownMenusOpenedArray: React.MutableRefObject<string[]>;\n onSubMenuOpened?: (item: string) => void;\n onSubMenuHidden?: (item: string) => void;\n onItemStateChanged?: (item: string, state: boolean) => void;\n activeItemId?: string;\n nestPath?: string[];\n};\n\nexport const SubMenuWrapper = styled.div<{ topLevel: boolean, visible: boolean }>`\n ${Menu} {\n top: ${(props) => (props.topLevel ? '100%' : '0px')};\n left: ${(props) => (props.topLevel ? '0px' : 'calc(100% - 12px)')};\n }\n\n ${props => !props.visible ? 'display: none;' : ''}\n\n button {\n padding-left: 0px;\n }\n`;\n\nexport const SubMenu = ({ item, index, topLevel, dropdownMenusOpenedArray, onSubMenuHidden, onSubMenuOpened, onItemStateChanged, activeItemId, nestPath }: SubMenuProps): React.ReactElement<SubMenuProps> => {\n const [, forceUpdate] = React.useState({});\n\n const existingRef = dropdownMenusOpenedArray.current.find((x) => x == item.id);\n const onMouseLeave = (event: any, id: string) => {\n dropdownMenusOpenedArray.current = [...dropdownMenusOpenedArray.current.filter((x) => x != id)];\n //just trigger rerendering\n onSubMenuHidden && onSubMenuHidden(id);\n forceUpdate({});\n };\n let containActiveItem = false;\n if(item.type == 'desktopgroup' && activeItemId)\n containActiveItem = checkIfContainsItem(item, activeItemId);\n\n const onMouseEnter = (event: any, id: string) => {\n const existingRefForId = dropdownMenusOpenedArray.current.find((x) => x == id);\n if (existingRefForId == null) {\n dropdownMenusOpenedArray.current = [...dropdownMenusOpenedArray.current, id];\n //just trigger rerendering\n onSubMenuOpened && onSubMenuOpened(id);\n forceUpdate({});\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, entryId: string) => {\n if(event.key == 'Enter' || event.code == 'Space')\n {\n dropdownMenusOpenedArray.current = [...dropdownMenusOpenedArray.current, entryId];\n //just trigger rerendering\n forceUpdate({});\n }\n };\n\n const onFocus = (event: React.FocusEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n dropdownMenusOpenedArray.current = [...(nestPath ?? [])];\n forceUpdate({});\n }\n\n return <SubMenuWrapper id={item.id} className={existingRef ? 'open' : ''} topLevel={topLevel} visible={Boolean(existingRef)}>\n <Menu role=\"menu\" aria-labelledby=\"UserMenuButton\">\n <MenuSection>\n <MenuSectionList>\n <Tabs size={Size.Medium}>\n {item.items.map((entry) => {\n const isGroup = entry.type == 'desktopgroup';\n const key = isGroup ? entry.id : entry.type == 'item' ? entry.to : '';\n const SubItemOpened = Boolean(dropdownMenusOpenedArray.current.find((x) => x == entry.id));\n if (isGroup) {\n return (\n <div style={{ position: 'relative' }} onMouseEnter={(event) => onMouseEnter(event, entry.id)} onMouseLeave={(event) => onMouseLeave(event, entry.id)}>\n <MenuItem\n tabIndex={0}\n onFocus={onFocus}\n onKeyDown={(event) => onKeyDown(event, entry.id)}\n id={entry.id}\n item={{\n value: entry.label ?? '',\n }}\n iconRight={<SystemIcons.ArrowDropRight size=\"24px\" />}\n active={SubItemOpened || (Boolean(activeItemId) && activeItemId != '' && checkIfContainsItem(entry, activeItemId!))}\n onClickHandler={() => {}}\n />\n <SubMenu nestPath={[...(nestPath ?? []), entry.id]} onItemStateChanged={onItemStateChanged} activeItemId={activeItemId} dropdownMenusOpenedArray={dropdownMenusOpenedArray} item={entry as MenuNavigationItemTypeDesktopGroup} index={index + 1} topLevel={false} />\n </div>\n );\n }\n return (\n <>\n <TabLink\n key={key}\n to={isGroup ? '' : key}\n onFocus={onFocus}\n onActiveStateChanged={(state) => onItemStateChanged && entry.type == 'item' && onItemStateChanged(entry.to, state)}\n forceDeactivate={isGroup}\n requiredLine={entry.label ?? ''}\n optionalLine={''}\n endLineIcon={isGroup ? <SystemIcons.ArrowDropRight size=\"24px\" /> : null}\n OptionalLineIcon={''}\n disabled={entry.disabled}\n showNotificationDot={false}\n size={Size.Medium}\n variant=\"positive\"\n />\n </>\n );\n })}\n </Tabs>\n </MenuSectionList>\n </MenuSection>\n </Menu>\n </SubMenuWrapper>;\n};\n"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,SAASC,IAAI,EAAEC,WAAW,EAAEC,eAAe,QAAQ,oBAAoB;AAEvE,SAASC,IAAI,QAAQ,aAAa;AAClC,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,mBAAmB,QAAQ,UAAU;AAC9C,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,OAAO,MAAM,oBAAoB;AACxC,SAASC,QAAQ,QAAQ,gBAAgB;AAAC;AAAA;AAAA;AAc1C,OAAO,IAAMC,cAAc,GAAGV,MAAM,CAACW,GAAG,6KACpCV,IAAI,EACG,UAACW,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAG,MAAM,GAAG,KAAK;AAAA,CAAC,EAC3C,UAACD,KAAK;EAAA,OAAMA,KAAK,CAACC,QAAQ,GAAG,KAAK,GAAG,mBAAmB;AAAA,CAAC,EAGjE,UAAAD,KAAK;EAAA,OAAI,CAACA,KAAK,CAACE,OAAO,GAAG,gBAAgB,GAAG,EAAE;AAAA,EAKlD;AAED,OAAO,IAAMC,OAAO,GAAG,SAAVA,OAAO,OAA0L;EAAA,IAApLC,IAAI,QAAJA,IAAI;IAAEC,KAAK,QAALA,KAAK;IAAEJ,QAAQ,QAARA,QAAQ;IAAEK,wBAAwB,QAAxBA,wBAAwB;IAAEC,eAAe,QAAfA,eAAe;IAAEC,eAAe,QAAfA,eAAe;IAAEC,kBAAkB,QAAlBA,kBAAkB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,uBACE,KAAC,OAAO;kBAEN,EAAE,EAAE+B,OAAO,GAAG,EAAE,GAAGR,GAAI;kBACvB,OAAO,EAAEE,OAAQ;kBACjB,oBAAoB,EAAE,8BAACY,KAAK;oBAAA,OAAKjC,kBAAkB,IAAI0B,KAAK,CAACZ,IAAI,IAAI,MAAM,IAAId,kBAAkB,CAAC0B,KAAK,CAACE,EAAE,EAAEK,KAAK,CAAC;kBAAA,CAAC;kBACnH,eAAe,EAAEN,OAAQ;kBACzB,YAAY,mBAAED,KAAK,CAACM,KAAK,yDAAI,EAAG;kBAChC,YAAY,EAAE,EAAG;kBACjB,WAAW,EAAEL,OAAO,gBAAG,KAAC,WAAW,CAAC,cAAc;oBAAC,IAAI,EAAC;kBAAM,EAAG,GAAG,IAAK;kBACzE,gBAAgB,EAAE,EAAG;kBACrB,QAAQ,EAAED,KAAK,CAACQ,QAAS;kBACzB,mBAAmB,EAAE,KAAM;kBAC3B,IAAI,EAAEnD,IAAI,CAACwC,MAAO;kBAClB,OAAO,EAAC;gBAAU,GAZbJ,GAAG;cAaR,EACD;YAEP,CAAC;UAAC;QACG;MACS;IACN;EACT,EACQ;AACrB,CAAC;AAAC;EAlHAvB,KAAK;EACLJ,QAAQ;EAERO,eAAe;EACfD,eAAe;EACfE,kBAAkB;EAClBC,YAAY;EACZC,QAAQ;AAAA"}
|
|
1
|
+
{"version":3,"file":"SubMenu.js","names":["React","styled","Menu","MenuSection","MenuSectionList","Size","SystemIcons","checkIfContainsItem","Tabs","TabLink","MenuItem","SubMenuWrapper","div","props","topLevel","visible","SubMenu","forwardRef","ref","item","index","dropdownMenusOpenedArray","onSubMenuHidden","onSubMenuOpened","onItemStateChanged","focusedItemId","activeItemId","nestPath","ariaLabelledBy","onItemFocused","useState","forceUpdate","focusedRef","useRef","allRefs","setAllRefs","subMenuRefs","setAllSubMenuRefs","useEffect","items","map","x","type","createRef","undefined","existingRef","current","find","id","onMouseLeave","event","filter","containActiveItem","onMouseEnter","existingRefForId","onKeyDown","e","key","stopPropagation","preventDefault","setNewFocusedElement","length","code","focusedItem","click","newFocusedElement","oldFocusedElement","classList","remove","add","console","log","onFocus","onBlur","Boolean","Medium","entry","isGroup","to","SubItemOpened","position","value","label","state","disabled"],"sources":["../../../src/GlobalNavigationBar/desktop/SubMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { NavLink, useLocation } from 'react-router-dom';\nimport styled from 'styled-components';\n\nimport { NavItem } from '../../NavItem';\nimport { COLORS, BREAKPOINTS } from '../../styles';\nimport ExtendedMainMenu, { Menu, MenuSection, MenuSectionList } from './ExtendedMainMenu';\nimport { IconButton } from '../../Button';\nimport { defaultOnMouseDownHandler } from '../../common';\nimport { MenuNavigationItemTypeDesktopGroup, MenuNavigationItemTypeItem } from '../types';\nimport { DropdownContent } from '../../Dropdown';\nimport { VerticalTabEntry, VerticalTabs } from '../../Tabs';\nimport { Size } from '../../types';\nimport { SystemIcons } from '../../icons';\nimport { checkIfContainsItem } from '../utils';\nimport Tabs from '../../Tabs/Tabs';\nimport TabLink from '../../Tabs/TabLink';\nimport { MenuItem } from '../../MenuItem';\nimport { NavItemDiv } from '../../NavItem/NavItem';\n\nexport type SubMenuProps = {\n item: MenuNavigationItemTypeDesktopGroup;\n index: number;\n topLevel: boolean;\n dropdownMenusOpenedArray: React.MutableRefObject<string[]>;\n onSubMenuOpened?: (item: string) => void;\n onSubMenuHidden?: (item: string) => void;\n onItemStateChanged?: (item: string, state: boolean) => void;\n onItemFocused?: (item: string) => void;\n focusedItemId?: string;\n activeItemId?: string;\n nestPath?: string[];\n ariaLabelledBy?: string;\n};\n\nexport const SubMenuWrapper = styled.div<{ topLevel: boolean; visible: boolean }>`\n ${Menu} {\n top: ${(props) => (props.topLevel ? '100%' : '0px')};\n left: ${(props) => (props.topLevel ? '0px' : 'calc(100% - 12px)')};\n }\n\n ${(props) => (!props.visible ? 'display: none;' : '')}\n\n button {\n padding-left: 0px;\n }\n`;\n\nexport const SubMenu = React.forwardRef<HTMLUListElement, SubMenuProps>(({\n item,\n index,\n topLevel,\n dropdownMenusOpenedArray,\n onSubMenuHidden,\n onSubMenuOpened,\n onItemStateChanged,\n focusedItemId,\n activeItemId,\n nestPath,\n ariaLabelledBy,\n onItemFocused\n}: SubMenuProps, ref): React.ReactElement<SubMenuProps> => {\n const [, forceUpdate] = React.useState({});\n const focusedRef = React.useRef<{ index: number }>({ index: -1 });\n const [allRefs, setAllRefs] = React.useState<React.RefObject<HTMLButtonElement | HTMLAnchorElement>[]>([]);\n const [subMenuRefs, setAllSubMenuRefs] = React.useState<(React.RefObject<HTMLUListElement> | undefined)[]>([]);\n\n React.useEffect(() => {\n setAllRefs(item.items.map((x) => (x.type == 'desktopgroup' ? React.createRef<HTMLButtonElement>() : React.createRef<HTMLAnchorElement>())));\n setAllSubMenuRefs(item.items.map((x) => (x.type == 'desktopgroup' ? React.createRef<HTMLUListElement>() : undefined)));\n }, [item]);\n\n const existingRef = dropdownMenusOpenedArray.current.find((x) => x == item.id);\n const onMouseLeave = (event: any, id: string) => {\n dropdownMenusOpenedArray.current = [...dropdownMenusOpenedArray.current.filter((x) => x != id)];\n //just trigger rerendering\n onSubMenuHidden && onSubMenuHidden(id);\n forceUpdate({});\n };\n let containActiveItem = false;\n if (item.type == 'desktopgroup' && activeItemId) containActiveItem = checkIfContainsItem(item, activeItemId);\n\n const onMouseEnter = (event: any, id: string) => {\n const existingRefForId = dropdownMenusOpenedArray.current.find((x) => x == id);\n if (existingRefForId == null) {\n dropdownMenusOpenedArray.current = [...dropdownMenusOpenedArray.current, id];\n //just trigger rerendering\n onSubMenuOpened && onSubMenuOpened(id);\n forceUpdate({});\n }\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLUListElement>) => {\n \n if (e.key === 'ArrowUp' || e.key === 'Up') {\n e.stopPropagation();\n e.preventDefault();\n if (focusedRef.current.index > 0) {\n setNewFocusedElement(focusedRef.current.index - 1);\n }\n } else if (e.key === 'ArrowDown' || e.key === 'Down') {\n e.stopPropagation();\n e.preventDefault();\n if(focusedRef.current.index < allRefs.length - 1)\n setNewFocusedElement(focusedRef.current.index + 1);\n } \n else\n if (e.key == 'Enter' || e.code == 'Space') {\n e.stopPropagation();\n if(focusedRef.current.index < 0)\n return;\n \n const focusedItem = item.items[focusedRef.current.index];\n if(focusedItem.type == 'desktopgroup')\n {\n dropdownMenusOpenedArray.current = [...dropdownMenusOpenedArray.current, focusedItem.id];\n forceUpdate({});\n }\n else\n {\n allRefs[focusedRef.current.index].current?.click();\n forceUpdate({});\n }\n\n //just trigger rerendering\n \n }\n };\n\n const setNewFocusedElement = (index: number) => {\n const newFocusedElement = index >= 0 ? allRefs[index] : null;\n const oldFocusedElement = focusedRef.current.index >= 0 ? allRefs[focusedRef.current.index] : null;\n focusedRef.current.index = index;\n\n if(oldFocusedElement)\n oldFocusedElement?.current?.classList.remove('dropdown-hover');\n\n if (newFocusedElement && newFocusedElement !== oldFocusedElement) {\n newFocusedElement.current?.classList.add('dropdown-hover');\n console.log(item.items[index].id);\n onItemFocused && onItemFocused(item.items[index].id ?? '');\n }\n else if(onItemFocused)\n onItemFocused('');\n };\n\n const onFocus = (event: React.FocusEvent<HTMLUListElement>) => {\n event.stopPropagation();\n dropdownMenusOpenedArray.current = [...(nestPath ?? [])];\n setNewFocusedElement(0);\n forceUpdate({});\n \n };\n\n const onBlur = (event: React.FocusEvent<HTMLUListElement>) => {\n event.stopPropagation();\n setNewFocusedElement(-1);\n };\n\n return (\n <SubMenuWrapper id={item.id} className={existingRef ? 'open' : '' } topLevel={topLevel} visible={Boolean(existingRef)}>\n <Menu role=\"group\" ref={ref} aria-labelledby={ariaLabelledBy} onBlur={onBlur} onFocus={onFocus} onKeyDown={(event) => onKeyDown(event)} tabIndex={0}>\n <MenuSection>\n <MenuSectionList>\n <Tabs size={Size.Medium}>\n {item.items.map((entry, index) => {\n const isGroup = entry.type == 'desktopgroup';\n const key = isGroup ? entry.id : entry.type == 'item' ? entry.to : '';\n const SubItemOpened = Boolean(dropdownMenusOpenedArray.current.find((x) => x == entry.id));\n if (isGroup) {\n return (\n <div style={{ position: 'relative' }} onMouseEnter={(event) => onMouseEnter(event, entry.id)} onMouseLeave={(event) => onMouseLeave(event, entry.id)}>\n <MenuItem\n id={entry.id + '_parentOption'}\n aria-expanded={Boolean(SubItemOpened)}\n aria-activedescendant={entry.items.find(x => x.id == focusedItemId)?.id ?? ''}\n tabIndex={-1}\n ref={allRefs[index] as React.Ref<HTMLButtonElement>}\n \n aria-controls={entry.id}\n role=\"group\"\n //id={entry.id} removing this can break something\n item={{\n value: entry.label ?? '',\n }}\n iconRight={<SystemIcons.ArrowDropRight size=\"24px\" />}\n active={SubItemOpened || (Boolean(activeItemId) && activeItemId != '' && checkIfContainsItem(entry, activeItemId!))}\n onClickHandler={() => {}}\n />\n <SubMenu\n ariaLabelledBy={entry.id + '_parentOption'}\n onItemFocused={onItemFocused}\n focusedItemId={focusedItemId}\n ref={subMenuRefs[index]}\n nestPath={[...(nestPath ?? []), entry.id]}\n onItemStateChanged={onItemStateChanged}\n activeItemId={activeItemId}\n dropdownMenusOpenedArray={dropdownMenusOpenedArray}\n item={entry as MenuNavigationItemTypeDesktopGroup}\n index={index + 1}\n topLevel={false}\n />\n </div>\n );\n }\n return (\n <>\n <TabLink\n id={entry.id}\n tabIndex={-1}\n key={key}\n to={isGroup ? '' : key}\n ref={allRefs[index] as React.Ref<HTMLAnchorElement>}\n onActiveStateChanged={(state) => onItemStateChanged && entry.type == 'item' && onItemStateChanged(entry.to, state)}\n forceDeactivate={isGroup}\n requiredLine={entry.label ?? ''}\n optionalLine={''}\n endLineIcon={isGroup ? <SystemIcons.ArrowDropRight size=\"24px\" /> : null}\n OptionalLineIcon={''}\n disabled={entry.disabled}\n showNotificationDot={false}\n size={Size.Medium}\n variant=\"positive\"\n />\n </>\n );\n })}\n </Tabs>\n </MenuSectionList>\n </MenuSection>\n </Menu>\n </SubMenuWrapper>\n );\n});\n"],"mappings":";;;;;AAAA,OAAO,KAAKA,KA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,CAACoD,KAAK,CAACE,EAAE,EAAEK,KAAK,CAAC;kBAAA,CAAC;kBACnH,eAAe,EAAEN,OAAQ;kBACzB,YAAY,mBAAED,KAAK,CAACM,KAAK,yDAAI,EAAG;kBAChC,YAAY,EAAE,EAAG;kBACjB,WAAW,EAAEL,OAAO,gBAAG,KAAC,WAAW,CAAC,cAAc;oBAAC,IAAI,EAAC;kBAAM,EAAG,GAAG,IAAK;kBACzE,gBAAgB,EAAE,EAAG;kBACrB,QAAQ,EAAED,KAAK,CAACQ,QAAS;kBACzB,mBAAmB,EAAE,KAAM;kBAC3B,IAAI,EAAE/E,IAAI,CAACsE,MAAO;kBAClB,OAAO,EAAC;gBAAU,GAZblB,GAAG;cAaR,EACD;YAEP,CAAC;UAAC;QACG;MACS;IACN;EACT,EACQ;AAErB,CAAC,CAAC;AAAC;EAnNDrC,KAAK;EACLN,QAAQ;EAERS,eAAe;EACfD,eAAe;EACfE,kBAAkB;EAClBK,aAAa;EACbJ,aAAa;EACbC,YAAY;EACZC,QAAQ;EACRC,cAAc;AAAA"}
|
package/dist/Layouts/index.cjs
CHANGED
|
@@ -4,11 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.PageWidth = exports.Columns = void 0;
|
|
7
|
+
exports.PageWidth = exports.ContainerMargins = exports.Columns = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
10
|
var _styles = require("../styles");
|
|
11
|
-
var _templateObject, _templateObject2;
|
|
11
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
12
12
|
var GRID = {
|
|
13
13
|
GAP: {
|
|
14
14
|
SMALL: '16px',
|
|
@@ -21,14 +21,14 @@ var GRID = {
|
|
|
21
21
|
LARGE: '32px 64px 128px'
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
var PageWidth = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n margin: ", ";\n ", "\n
|
|
24
|
+
var PageWidth = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n margin: ", ";\n\n ", "\n ", " {\n margin: ", ";\n ", "\n }\n\n ", " {\n margin: ", ";\n ", "\n }\n\n ", " {\n max-width: ", ";\n\n margin: 32px auto 128px;\n ", "\n\n }\n"])), GRID.GUTTER.SMALL, function (props) {
|
|
25
25
|
return props.unsetMargin && 'margin-top: 0; margin-bottom: 0;';
|
|
26
26
|
}, _styles.BREAKPOINTS.MEDIUM, GRID.GUTTER.MEDIUM, function (props) {
|
|
27
27
|
return props.unsetMargin && 'margin-top: 0; margin-bottom: 0;';
|
|
28
28
|
}, _styles.BREAKPOINTS.LARGE, GRID.GUTTER.LARGE, function (props) {
|
|
29
29
|
return props.unsetMargin && 'margin-top: 0; margin-bottom: 0;';
|
|
30
30
|
}, _styles.BREAKPOINTS.LARGE, function (props) {
|
|
31
|
-
return props.useMaxWidth ? props.maxWidth ? 'min(100% - 128px,' + props.maxWidth + 'px)' : 'calc(100% - 128px)' : 'calc(
|
|
31
|
+
return props.useMaxWidth ? props.maxWidth ? 'min(100% - 128px,' + props.maxWidth + 'px)' : 'calc(100% - 128px)' : 'calc(1600 - 128px)';
|
|
32
32
|
}, function (props) {
|
|
33
33
|
return props.unsetMargin && 'margin-top: 0; margin-bottom: 0;';
|
|
34
34
|
});
|
|
@@ -47,4 +47,6 @@ var Columns = _styledComponents.default.section(_templateObject2 || (_templateOb
|
|
|
47
47
|
return props.printColumns || 'none';
|
|
48
48
|
});
|
|
49
49
|
exports.Columns = Columns;
|
|
50
|
+
var ContainerMargins = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n /* X small devices (mobile phones, 320px and up) */\n @media only screen and (min-width: 320px) {\n margin: 16px;\n column-gap: 16px;\n }\n\n /* Medium devices (landscape tablets, 768px and up) */\n @media only screen and (min-width: 768px) {\n margin: 32px;\n column-gap: 32px;\n }\n\n /* X large devices (laptops/desktops, 1200px and up) */\n @media only screen and (min-width: 1200px) {\n margin: 56px;\n column-gap: 40px;\n }\n"])));
|
|
51
|
+
exports.ContainerMargins = ContainerMargins;
|
|
50
52
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["GRID","GAP","SMALL","MEDIUM","LARGE","GUTTER","PageWidth","styled","div","props","unsetMargin","BREAKPOINTS","useMaxWidth","maxWidth","Columns","section","gap","columns","printColumns"],"sources":["../../src/Layouts/index.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport {BREAKPOINTS} from '../styles';\n\nconst GRID = {\n GAP: {\n SMALL: '16px',\n MEDIUM: '24px',\n LARGE: '32px',\n },\n GUTTER: {\n SMALL: '16px 16px 32px',\n MEDIUM: '24px 32px 64px',\n LARGE: '32px 64px 128px',\n },\n};\n\nexport const PageWidth = styled.div<{ useMaxWidth?: boolean; maxWidth?: number; unsetMargin?: boolean; }>`\n display: block;\n margin: ${GRID.GUTTER.SMALL};\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["GRID","GAP","SMALL","MEDIUM","LARGE","GUTTER","PageWidth","styled","div","props","unsetMargin","BREAKPOINTS","useMaxWidth","maxWidth","Columns","section","gap","columns","printColumns","ContainerMargins"],"sources":["../../src/Layouts/index.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport {BREAKPOINTS} from '../styles';\n\nconst GRID = {\n GAP: {\n SMALL: '16px',\n MEDIUM: '24px',\n LARGE: '32px',\n },\n GUTTER: {\n SMALL: '16px 16px 32px',\n MEDIUM: '24px 32px 64px',\n LARGE: '32px 64px 128px',\n },\n};\n\nexport const PageWidth = styled.div<{ useMaxWidth?: boolean; maxWidth?: number; unsetMargin?: boolean; }>`\n display: block;\n margin: ${GRID.GUTTER.SMALL};\n\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n ${BREAKPOINTS.MEDIUM} {\n margin: ${GRID.GUTTER.MEDIUM};\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n }\n\n ${BREAKPOINTS.LARGE} {\n margin: ${GRID.GUTTER.LARGE};\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n }\n\n ${BREAKPOINTS.LARGE} {\n max-width: ${(props) => (\n props.useMaxWidth\n ? (props.maxWidth\n ? 'min(100% - 128px,' + props.maxWidth + 'px)'\n : 'calc(100% - 128px)')\n : 'calc(1600 - 128px)')};\n\n margin: 32px auto 128px;\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n\n }\n`;\n\nexport const Columns = styled.section<{ gap?: string; columns?: string; printColumns?: string }>`\n width: 100%;\n display: grid;\n grid-gap: ${(props) => props.gap || GRID.GAP.SMALL};\n word-break: break-word; /* Prevent long words from breaking the layout – consider making this rule global */\n\n ${BREAKPOINTS.MEDIUM} {\n grid-template-columns: ${(props) => props.columns};\n -ms-grid-columns: ${(props) => props.columns};\n grid-gap: ${(props) => props.gap || GRID.GAP.MEDIUM};\n }\n\n ${BREAKPOINTS.LARGE} {\n grid-gap: ${(props) => props.gap || GRID.GAP.LARGE};\n }\n\n @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {\n display: -ms-grid;\n\n > *:not(:first-child) {\n margin-left: ${GRID.GAP.MEDIUM};\n }\n }\n\n @media print {\n grid-gap: 0;\n grid-template-columns: ${(props) => props.printColumns || 'none'};\n }\n`;\n\nexport const ContainerMargins = styled.div`\n /* X small devices (mobile phones, 320px and up) */\n @media only screen and (min-width: 320px) {\n margin: 16px;\n column-gap: 16px;\n }\n\n /* Medium devices (landscape tablets, 768px and up) */\n @media only screen and (min-width: 768px) {\n margin: 32px;\n column-gap: 32px;\n }\n\n /* X large devices (laptops/desktops, 1200px and up) */\n @media only screen and (min-width: 1200px) {\n margin: 56px;\n column-gap: 40px;\n }\n`;\n"],"mappings":";;;;;;;;AAAA;AAEA;AAAsC;AAEtC,IAAMA,IAAI,GAAG;EACXC,GAAG,EAAE;IACHC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,KAAK,EAAE;EACT,CAAC;EACDC,MAAM,EAAE;IACNH,KAAK,EAAE,gBAAgB;IACvBC,MAAM,EAAE,gBAAgB;IACxBC,KAAK,EAAE;EACT;AACF,CAAC;AAEM,IAAME,SAAS,GAAGC,yBAAM,CAACC,GAAG,iTAEvBR,IAAI,CAACK,MAAM,CAACH,KAAK,EAEzB,UAAAO,KAAK;EAAA,OAAIA,KAAK,CAACC,WAAW,IAAI,kCAAkC;AAAA,GAChEC,mBAAW,CAACR,MAAM,EACRH,IAAI,CAACK,MAAM,CAACF,MAAM,EAC1B,UAAAM,KAAK;EAAA,OAAIA,KAAK,CAACC,WAAW,IAAI,kCAAkC;AAAA,GAGlEC,mBAAW,CAACP,KAAK,EACPJ,IAAI,CAACK,MAAM,CAACD,KAAK,EACzB,UAAAK,KAAK;EAAA,OAAIA,KAAK,CAACC,WAAW,IAAI,kCAAkC;AAAA,GAGlEC,mBAAW,CAACP,KAAK,EACJ,UAACK,KAAK;EAAA,OACXA,KAAK,CAACG,WAAW,GACNH,KAAK,CAACI,QAAQ,GACP,mBAAmB,GAAGJ,KAAK,CAACI,QAAQ,GAAG,KAAK,GAC5C,oBAAoB,GAC5B,oBAAoB;AAAA,CAAC,EAGrC,UAAAJ,KAAK;EAAA,OAAIA,KAAK,CAACC,WAAW,IAAI,kCAAkC;AAAA,EAGrE;AAAC;AAEK,IAAMI,OAAO,GAAGP,yBAAM,CAACQ,OAAO,ooBAGvB,UAACN,KAAK;EAAA,OAAKA,KAAK,CAACO,GAAG,IAAIhB,IAAI,CAACC,GAAG,CAACC,KAAK;AAAA,GAGhDS,mBAAW,CAACR,MAAM,EACO,UAACM,KAAK;EAAA,OAAKA,KAAK,CAACQ,OAAO;AAAA,GAC7B,UAACR,KAAK;EAAA,OAAKA,KAAK,CAACQ,OAAO;AAAA,GAChC,UAACR,KAAK;EAAA,OAAKA,KAAK,CAACO,GAAG,IAAIhB,IAAI,CAACC,GAAG,CAACE,MAAM;AAAA,GAGnDQ,mBAAW,CAACP,KAAK,EACL,UAACK,KAAK;EAAA,OAAKA,KAAK,CAACO,GAAG,IAAIhB,IAAI,CAACC,GAAG,CAACG,KAAK;AAAA,GAOjCJ,IAAI,CAACC,GAAG,CAACE,MAAM,EAMP,UAACM,KAAK;EAAA,OAAKA,KAAK,CAACS,YAAY,IAAI,MAAM;AAAA,EAEnE;AAAC;AAEK,IAAMC,gBAAgB,GAAGZ,yBAAM,CAACC,GAAG,kiBAkBzC;AAAC"}
|
package/dist/Layouts/index.d.ts
CHANGED
package/dist/Layouts/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { BREAKPOINTS } from '../styles';
|
|
5
5
|
var GRID = {
|
|
@@ -14,14 +14,14 @@ var GRID = {
|
|
|
14
14
|
LARGE: '32px 64px 128px'
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
export var PageWidth = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n margin: ", ";\n ", "\n
|
|
17
|
+
export var PageWidth = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n margin: ", ";\n\n ", "\n ", " {\n margin: ", ";\n ", "\n }\n\n ", " {\n margin: ", ";\n ", "\n }\n\n ", " {\n max-width: ", ";\n\n margin: 32px auto 128px;\n ", "\n\n }\n"])), GRID.GUTTER.SMALL, function (props) {
|
|
18
18
|
return props.unsetMargin && 'margin-top: 0; margin-bottom: 0;';
|
|
19
19
|
}, BREAKPOINTS.MEDIUM, GRID.GUTTER.MEDIUM, function (props) {
|
|
20
20
|
return props.unsetMargin && 'margin-top: 0; margin-bottom: 0;';
|
|
21
21
|
}, BREAKPOINTS.LARGE, GRID.GUTTER.LARGE, function (props) {
|
|
22
22
|
return props.unsetMargin && 'margin-top: 0; margin-bottom: 0;';
|
|
23
23
|
}, BREAKPOINTS.LARGE, function (props) {
|
|
24
|
-
return props.useMaxWidth ? props.maxWidth ? 'min(100% - 128px,' + props.maxWidth + 'px)' : 'calc(100% - 128px)' : 'calc(
|
|
24
|
+
return props.useMaxWidth ? props.maxWidth ? 'min(100% - 128px,' + props.maxWidth + 'px)' : 'calc(100% - 128px)' : 'calc(1600 - 128px)';
|
|
25
25
|
}, function (props) {
|
|
26
26
|
return props.unsetMargin && 'margin-top: 0; margin-bottom: 0;';
|
|
27
27
|
});
|
|
@@ -38,4 +38,5 @@ export var Columns = styled.section(_templateObject2 || (_templateObject2 = _tag
|
|
|
38
38
|
}, GRID.GAP.MEDIUM, function (props) {
|
|
39
39
|
return props.printColumns || 'none';
|
|
40
40
|
});
|
|
41
|
+
export var ContainerMargins = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n /* X small devices (mobile phones, 320px and up) */\n @media only screen and (min-width: 320px) {\n margin: 16px;\n column-gap: 16px;\n }\n\n /* Medium devices (landscape tablets, 768px and up) */\n @media only screen and (min-width: 768px) {\n margin: 32px;\n column-gap: 32px;\n }\n\n /* X large devices (laptops/desktops, 1200px and up) */\n @media only screen and (min-width: 1200px) {\n margin: 56px;\n column-gap: 40px;\n }\n"])));
|
|
41
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["styled","BREAKPOINTS","GRID","GAP","SMALL","MEDIUM","LARGE","GUTTER","PageWidth","div","props","unsetMargin","useMaxWidth","maxWidth","Columns","section","gap","columns","printColumns"],"sources":["../../src/Layouts/index.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport {BREAKPOINTS} from '../styles';\n\nconst GRID = {\n GAP: {\n SMALL: '16px',\n MEDIUM: '24px',\n LARGE: '32px',\n },\n GUTTER: {\n SMALL: '16px 16px 32px',\n MEDIUM: '24px 32px 64px',\n LARGE: '32px 64px 128px',\n },\n};\n\nexport const PageWidth = styled.div<{ useMaxWidth?: boolean; maxWidth?: number; unsetMargin?: boolean; }>`\n display: block;\n margin: ${GRID.GUTTER.SMALL};\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["styled","BREAKPOINTS","GRID","GAP","SMALL","MEDIUM","LARGE","GUTTER","PageWidth","div","props","unsetMargin","useMaxWidth","maxWidth","Columns","section","gap","columns","printColumns","ContainerMargins"],"sources":["../../src/Layouts/index.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport {BREAKPOINTS} from '../styles';\n\nconst GRID = {\n GAP: {\n SMALL: '16px',\n MEDIUM: '24px',\n LARGE: '32px',\n },\n GUTTER: {\n SMALL: '16px 16px 32px',\n MEDIUM: '24px 32px 64px',\n LARGE: '32px 64px 128px',\n },\n};\n\nexport const PageWidth = styled.div<{ useMaxWidth?: boolean; maxWidth?: number; unsetMargin?: boolean; }>`\n display: block;\n margin: ${GRID.GUTTER.SMALL};\n\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n ${BREAKPOINTS.MEDIUM} {\n margin: ${GRID.GUTTER.MEDIUM};\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n }\n\n ${BREAKPOINTS.LARGE} {\n margin: ${GRID.GUTTER.LARGE};\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n }\n\n ${BREAKPOINTS.LARGE} {\n max-width: ${(props) => (\n props.useMaxWidth\n ? (props.maxWidth\n ? 'min(100% - 128px,' + props.maxWidth + 'px)'\n : 'calc(100% - 128px)')\n : 'calc(1600 - 128px)')};\n\n margin: 32px auto 128px;\n ${props => props.unsetMargin && 'margin-top: 0; margin-bottom: 0;'}\n\n }\n`;\n\nexport const Columns = styled.section<{ gap?: string; columns?: string; printColumns?: string }>`\n width: 100%;\n display: grid;\n grid-gap: ${(props) => props.gap || GRID.GAP.SMALL};\n word-break: break-word; /* Prevent long words from breaking the layout – consider making this rule global */\n\n ${BREAKPOINTS.MEDIUM} {\n grid-template-columns: ${(props) => props.columns};\n -ms-grid-columns: ${(props) => props.columns};\n grid-gap: ${(props) => props.gap || GRID.GAP.MEDIUM};\n }\n\n ${BREAKPOINTS.LARGE} {\n grid-gap: ${(props) => props.gap || GRID.GAP.LARGE};\n }\n\n @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {\n display: -ms-grid;\n\n > *:not(:first-child) {\n margin-left: ${GRID.GAP.MEDIUM};\n }\n }\n\n @media print {\n grid-gap: 0;\n grid-template-columns: ${(props) => props.printColumns || 'none'};\n }\n`;\n\nexport const ContainerMargins = styled.div`\n /* X small devices (mobile phones, 320px and up) */\n @media only screen and (min-width: 320px) {\n margin: 16px;\n column-gap: 16px;\n }\n\n /* Medium devices (landscape tablets, 768px and up) */\n @media only screen and (min-width: 768px) {\n margin: 32px;\n column-gap: 32px;\n }\n\n /* X large devices (laptops/desktops, 1200px and up) */\n @media only screen and (min-width: 1200px) {\n margin: 56px;\n column-gap: 40px;\n }\n`;\n"],"mappings":";;AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,SAAQC,WAAW,QAAO,WAAW;AAErC,IAAMC,IAAI,GAAG;EACXC,GAAG,EAAE;IACHC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,KAAK,EAAE;EACT,CAAC;EACDC,MAAM,EAAE;IACNH,KAAK,EAAE,gBAAgB;IACvBC,MAAM,EAAE,gBAAgB;IACxBC,KAAK,EAAE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AAG,CAACE,MAAM,EAMP,UAACK,KAAK;EAAA,OAAKA,KAAK,CAACQ,YAAY,IAAI,MAAM;AAAA,EAEnE;AAED,OAAO,IAAMC,gBAAgB,GAAGnB,MAAM,CAACS,GAAG,ohBAkBzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestedNavItem.cjs","names":["NestedNavItem","React","forwardRef","ref","active","item","onClickHandler","size","Size","Medium","className","tabIndex","iconRight","id","rest"],"sources":["../../src/NavItem/NestedNavItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {Size} from '../types';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\n\nexport interface MenuItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'id' | 'disabled' | 'onMouseDown' | 'onClick'> {\n item: DropdownItem;\n onClickHandler: (e: React.MouseEvent) => void;\n active: boolean;\n id: string;\n size?: Size;\n iconRight?: React.ReactElement;\n}\n\n\nconst NestedNavItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n size = Size.Medium,\n className,\n tabIndex,\n iconRight,\n id,\n ...rest\n }: MenuItemProps, ref) => {\n return (\n <></>\n );\n});\n\nexport default NestedNavItem;\n"],"mappings":";;;;;;;;;;AAAA;
|
|
1
|
+
{"version":3,"file":"NestedNavItem.cjs","names":["NestedNavItem","React","forwardRef","ref","active","item","onClickHandler","size","Size","Medium","className","tabIndex","iconRight","id","rest"],"sources":["../../src/NavItem/NestedNavItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle, focusStyles} from '../styles';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport {CommonInteractionStyling, defaultOnMouseDownHandler} from '../common';\n\nexport interface MenuItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'id' | 'disabled' | 'onMouseDown' | 'onClick'> {\n item: DropdownItem;\n onClickHandler: (e: React.MouseEvent) => void;\n active: boolean;\n id: string;\n size?: Size;\n iconRight?: React.ReactElement;\n}\n\n\nconst NestedNavItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n size = Size.Medium,\n className,\n tabIndex,\n iconRight,\n id,\n ...rest\n }: MenuItemProps, ref) => {\n return (\n <></>\n );\n});\n\nexport default NestedNavItem;\n"],"mappings":";;;;;;;;;;AAAA;AAIA;AAAuC;AAAA;AAAA;AAAA;AAevC,IAAMA,aAAa,gBAAGC,KAAK,CAACC,UAAU,CAAmC,gBAUcC,GAAG,EAAK;EAAA,IATxBC,MAAM,QAANA,MAAM;IACNC,IAAI,QAAJA,IAAI;IACJC,cAAc,QAAdA,cAAc;IAAA,iBACdC,IAAI;IAAJA,IAAI,0BAAGC,WAAI,CAACC,MAAM;IAClBC,SAAS,QAATA,SAAS;IACTC,QAAQ,QAARA,QAAQ;IACRC,SAAS,QAATA,SAAS;IACTC,EAAE,QAAFA,EAAE;IACCC,IAAI;EAE5E,oBACC,8CAAK;AAER,CAAC,CAAC;AAAC;EAtBAR,cAAc;EACdF,MAAM;EACNS,EAAE;EAEFD,SAAS;AAAA;AAAA,eAoBGZ,aAAa;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestedNavItem.js","names":["React","Size","NestedNavItem","forwardRef","ref","active","item","onClickHandler","size","Medium","className","tabIndex","iconRight","id","rest"],"sources":["../../src/NavItem/NestedNavItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {Size} from '../types';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\n\nexport interface MenuItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'id' | 'disabled' | 'onMouseDown' | 'onClick'> {\n item: DropdownItem;\n onClickHandler: (e: React.MouseEvent) => void;\n active: boolean;\n id: string;\n size?: Size;\n iconRight?: React.ReactElement;\n}\n\n\nconst NestedNavItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n size = Size.Medium,\n className,\n tabIndex,\n iconRight,\n id,\n ...rest\n }: MenuItemProps, ref) => {\n return (\n <></>\n );\n});\n\nexport default NestedNavItem;\n"],"mappings":";;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;
|
|
1
|
+
{"version":3,"file":"NestedNavItem.js","names":["React","Size","NestedNavItem","forwardRef","ref","active","item","onClickHandler","size","Medium","className","tabIndex","iconRight","id","rest"],"sources":["../../src/NavItem/NestedNavItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle, focusStyles} from '../styles';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport {CommonInteractionStyling, defaultOnMouseDownHandler} from '../common';\n\nexport interface MenuItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'id' | 'disabled' | 'onMouseDown' | 'onClick'> {\n item: DropdownItem;\n onClickHandler: (e: React.MouseEvent) => void;\n active: boolean;\n id: string;\n size?: Size;\n iconRight?: React.ReactElement;\n}\n\n\nconst NestedNavItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n size = Size.Medium,\n className,\n tabIndex,\n iconRight,\n id,\n ...rest\n }: MenuItemProps, ref) => {\n return (\n <></>\n );\n});\n\nexport default NestedNavItem;\n"],"mappings":";;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAI9B,SAAiBC,IAAI,QAAO,UAAU;AAAC;AAAA;AAevC,IAAMC,aAAa,gBAAGF,KAAK,CAACG,UAAU,CAAmC,gBAUcC,GAAG,EAAK;EAAA,IATxBC,MAAM,QAANA,MAAM;IACNC,IAAI,QAAJA,IAAI;IACJC,cAAc,QAAdA,cAAc;IAAA,iBACdC,IAAI;IAAJA,IAAI,0BAAGP,IAAI,CAACQ,MAAM;IAClBC,SAAS,QAATA,SAAS;IACTC,QAAQ,QAARA,QAAQ;IACRC,SAAS,QAATA,SAAS;IACTC,EAAE,QAAFA,EAAE;IACCC,IAAI;EAE5E,oBACC,mBAAK;AAER,CAAC,CAAC;AAAC;EAtBAP,cAAc;EACdF,MAAM;EACNQ,EAAE;EAEFD,SAAS;AAAA;AAoBZ,eAAeV,aAAa"}
|
package/dist/Tabs/TabLink.cjs
CHANGED
|
@@ -32,12 +32,12 @@ var StyledNotification = _styledComponents.default.div(_templateObject4 || (_tem
|
|
|
32
32
|
var EndLineIcon = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 15px 0 0 !important;\n"])));
|
|
33
33
|
var OptionalLineWrapper = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 12px;\n"])));
|
|
34
34
|
//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed
|
|
35
|
-
var Wrapper = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n \n display: flex;\n flex-direction: row;\n align-items: center;\n \n font-size: 16px;\n line-height: 120%;\n color: ", ";\n \n background-color: ", ";\n cursor: ", ";\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n \n &:not(:last-child) {\n margin-bottom: 4px;\n }\n \n &:focus {\n ", "\n }\n \n &.active {\n z-index: ", ";\n background-color: ", ";\n }\n \n &.active:hover {\n background-color: ", ";\n }\n \n &:hover {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n \n &:active {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n \n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ", ";\n \n border-radius: 4px;\n }\n }\n \n &.active:hover {\n &::after {\n background-color: ", ";\n }\n }\n \n &.active:active {\n background-color: ", ";\n \n &::after {\n background-color: ", ";\n }\n }\n \n &.disabled {\n background-color: ", ";\n color: ", ";\n \n span {\n color: ", ";\n }\n \n &::after {\n background-color: ", ";\n }\n }\n }\n"])), _styles.COLORS.neutral_600, function (props) {
|
|
35
|
+
var Wrapper = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n \n display: flex;\n flex-direction: row;\n align-items: center;\n \n font-size: 16px;\n line-height: 120%;\n color: ", ";\n \n background-color: ", ";\n cursor: ", ";\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n \n &:not(:last-child) {\n margin-bottom: 4px;\n }\n \n &:focus {\n ", "\n }\n \n &.active {\n z-index: ", ";\n background-color: ", ";\n }\n \n &.active:hover, &.active.dropdown-hover {\n background-color: ", ";\n }\n \n &:hover, &.dropdown-hover {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n \n &:active {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n \n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ", ";\n \n border-radius: 4px;\n }\n }\n \n &.active:hover, &.active.dropdown-hover {\n &::after {\n background-color: ", ";\n }\n }\n \n &.active:active {\n background-color: ", ";\n \n &::after {\n background-color: ", ";\n }\n }\n \n &.disabled {\n background-color: ", ";\n color: ", ";\n \n span {\n color: ", ";\n }\n \n &::after {\n background-color: ", ";\n }\n }\n }\n"])), _styles.COLORS.neutral_600, function (props) {
|
|
36
36
|
return props.disabled ? _styles.COLORS.neutral_100 : 'transparent';
|
|
37
37
|
}, function (props) {
|
|
38
38
|
return props.disabled ? 'not-allowed' : 'pointer';
|
|
39
39
|
}, _styles.focusStyles, _zIndexes.Z_INDEXES.active, _styles.COLORS.neutral_20, _styles.COLORS.primary_20, _zIndexes.Z_INDEXES.hover, _styles.COLORS.primary_20, _styles.COLORS.primary_600, _zIndexes.Z_INDEXES.active, _styles.COLORS.primary_100, _styles.COLORS.primary_800, _styles.COLORS.primary_500, _styles.COLORS.primary_600, _styles.COLORS.primary_100, _styles.COLORS.primary_800, _styles.COLORS.white, _styles.COLORS.neutral_300, _styles.COLORS.neutral_300, _styles.COLORS.neutral_300);
|
|
40
|
-
var TabLink = function
|
|
40
|
+
var TabLink = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
41
41
|
var to = _ref.to,
|
|
42
42
|
_ref$disabled = _ref.disabled,
|
|
43
43
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
@@ -60,7 +60,6 @@ var TabLink = function TabLink(_ref) {
|
|
|
60
60
|
containerOnMouseLeave = _ref.containerOnMouseLeave,
|
|
61
61
|
className = _ref.className,
|
|
62
62
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
63
|
-
var ref = React.useRef(null);
|
|
64
63
|
var _useState = (0, React.useState)(false),
|
|
65
64
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
66
65
|
activeState = _useState2[0],
|
|
@@ -118,7 +117,7 @@ var TabLink = function TabLink(_ref) {
|
|
|
118
117
|
})]
|
|
119
118
|
})), children]
|
|
120
119
|
});
|
|
121
|
-
};
|
|
120
|
+
});
|
|
122
121
|
var _default = TabLink;
|
|
123
122
|
exports.default = _default;
|
|
124
123
|
//# sourceMappingURL=TabLink.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabLink.cjs","names":["OptionalLineWrapperWithIcon","styled","div","TopWrapper","TextContainer","StyledNotification","EndLineIcon","OptionalLineWrapper","Wrapper","COLORS","neutral_600","props","disabled","neutral_100","focusStyles","Z_INDEXES","active","neutral_20","primary_20","hover","primary_600","primary_100","primary_800","primary_500","white","neutral_300","TabLink","to","requiredLine","optionalLine","OptionalLineIcon","onLinkClick","forceDeactivate","testId","showNotificationDot","size","Size","Small","endLineIcon","onActiveStateChanged","variant","children","containerOnMouseEnter","containerOnMouseLeave","className","rest","ref","React","useRef","useState","activeState","setActiveState","toString","isActive","defaultOnMouseDownHandler","e"],"sources":["../../src/Tabs/TabLink.tsx"],"sourcesContent":["import * as React from 'react';\nimport { NavLink, NavLinkProps } from 'react-router-dom';\nimport styled from 'styled-components';\nimport { NotificationDot } from '../NotificationDot';\nimport { Size } from '../types';\nimport { COLORS, focusStyles } from '../styles';\nimport { Z_INDEXES } from '../styles/z-indexes';\nimport { defaultOnMouseDownHandler } from '../common';\nimport { useState } from 'react';\n\ntype TabLinkProps = {\n disabled?: boolean;\n forceDeactivate?: boolean;\n requiredLine: string;\n optionalLine?: string;\n OptionalLineIcon?: React.ReactNode; //React.FunctionComponent<BaseProps>;\n endLineIcon?: React.ReactNode;\n onLinkClick?: (e: React.MouseEvent) => void;\n testId?: string;\n onActiveStateChanged?: (state: boolean) => void;\n showNotificationDot?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n variant?: 'positive' | 'critical';\n containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n} & NavLinkProps;\n\nconst OptionalLineWrapperWithIcon = styled.div`\n display: flex;\n flex-direction: row;\n\n span {\n margin: 0 0 0 4px !important;\n font-size: 12px;\n line-height: 16px;\n }\n`;\n\nconst TopWrapper = styled.div`\n display: flex;\n flex-direction: row;\n\n span:not(:only-child) {\n width: calc(100% - 32px);\n }\n`;\n\nconst TextContainer = styled.div`\n width: 100%;\n margin: auto 0 auto 16px !important;\n`;\n\nconst StyledNotification = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst EndLineIcon = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst OptionalLineWrapper = styled.div`\n font-size: 12px;\n`;\n//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed\nconst Wrapper = styled.div<{disabled: boolean}>`\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n \n display: flex;\n flex-direction: row;\n align-items: center;\n \n font-size: 16px;\n line-height: 120%;\n color: ${COLORS.neutral_600};\n \n background-color: ${(props) => (props.disabled ? COLORS.neutral_100 : 'transparent')};\n cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n \n &:not(:last-child) {\n margin-bottom: 4px;\n }\n \n &:focus {\n ${focusStyles}\n }\n \n &.active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.neutral_20};\n }\n \n &.active:hover {\n background-color: ${COLORS.primary_20};\n }\n \n &:hover {\n z-index: ${Z_INDEXES.hover};\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_600};\n }\n \n &:active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n \n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ${COLORS.primary_500};\n \n border-radius: 4px;\n }\n }\n \n &.active:hover {\n &::after {\n background-color: ${COLORS.primary_600};\n }\n }\n \n &.active:active {\n background-color: ${COLORS.primary_100};\n \n &::after {\n background-color: ${COLORS.primary_800};\n }\n }\n \n &.disabled {\n background-color: ${COLORS.white};\n color: ${COLORS.neutral_300};\n \n span {\n color: ${COLORS.neutral_300};\n }\n \n &::after {\n background-color: ${COLORS.neutral_300};\n }\n }\n }\n`;\n\nconst TabLink = ({\n to,\n disabled = false,\n requiredLine,\n optionalLine,\n OptionalLineIcon,\n onLinkClick,\n forceDeactivate,\n testId,\n showNotificationDot = false,\n size = Size.Small,\n endLineIcon,\n onActiveStateChanged,\n variant = 'critical',\n children,\n containerOnMouseEnter,\n containerOnMouseLeave,\n className,\n ...rest\n}: TabLinkProps) => {\n const ref = React.useRef<any>(null);\n const [activeState, setActiveState] = useState<boolean>(false);\n\n return (\n <Wrapper disabled={disabled} className={disabled ? 'disabled' : ''} onMouseEnter={containerOnMouseEnter} onMouseLeave={containerOnMouseLeave}>\n <NavLink\n to={forceDeactivate ? 'invalid' : to.toString()}\n //disabled={disabled}\n className={({ isActive }) => {\n onActiveStateChanged && onActiveStateChanged(activeState);\n if(forceDeactivate)\n {\n if(disabled) \n return 'disabled';\n else \n return '';\n }\n\n if(isActive != activeState)\n setActiveState(isActive);\n\n return (isActive ? 'active ' : '') + (disabled ? 'disabled' : '');\n }}\n onMouseDown={defaultOnMouseDownHandler}\n tabIndex={disabled ? -1 : 0}\n role=\"tab\"\n aria-selected={activeState}\n onClick={(e: React.MouseEvent) => !disabled && onLinkClick && onLinkClick(e)}\n ref={ref}\n data-testid={testId}\n {...rest}>\n <TextContainer>\n <TopWrapper>\n <span>{requiredLine}</span>\n </TopWrapper>\n {optionalLine && OptionalLineIcon ? (\n <OptionalLineWrapperWithIcon>\n {OptionalLineIcon}\n {!!optionalLine && <span>{optionalLine}</span>}\n </OptionalLineWrapperWithIcon>\n ) : optionalLine ? (\n <OptionalLineWrapper>\n <span>{optionalLine}</span>\n </OptionalLineWrapper>\n ) : (\n <></>\n )}\n </TextContainer>\n <StyledNotification>{showNotificationDot && <NotificationDot testId=\"NotificationDot\" size={size} variant={variant} />}</StyledNotification>\n {endLineIcon && <EndLineIcon>{endLineIcon}</EndLineIcon>}\n </NavLink>\n {children}\n </Wrapper>\n );\n};\n\nexport default TabLink;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAsD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBtD,IAAMA,2BAA2B,GAAGC,yBAAM,CAACC,GAAG,iOAS7C;AA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E1C,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAE;MAC5B,IAAI,EAAC,KAAK;MACV,iBAAesC,WAAY;MAC3B,OAAO,EAAE,iBAACK,CAAmB;QAAA,OAAK,CAAC3C,QAAQ,IAAImB,WAAW,IAAIA,WAAW,CAACwB,CAAC,CAAC;MAAA,CAAC;MAC7E,GAAG,EAAET,GAAI;MACT,eAAab;IAAO,GAChBY,IAAI;MAAA,wBACR,sBAAC,aAAa;QAAA,wBACZ,qBAAC,UAAU;UAAA,uBACT;YAAA,UAAOjB;UAAY;QAAQ,EAChB,EACZC,YAAY,IAAIC,gBAAgB,gBAC/B,sBAAC,2BAA2B;UAAA,WACzBA,gBAAgB,EAChB,CAAC,CAACD,YAAY,iBAAI;YAAA,UAAOA;UAAY,EAAQ;QAAA,EAClB,GAC5BA,YAAY,gBACd,qBAAC,mBAAmB;UAAA,uBAClB;YAAA,UAAOA;UAAY;QAAQ,EACP,gBAEtB,8CACD;MAAA,EACa,eAChB,qBAAC,kBAAkB;QAAA,UAAEK,mBAAmB,iBAAI,qBAAC,gCAAe;UAAC,MAAM,EAAC,iBAAiB;UAAC,IAAI,EAAEC,IAAK;UAAC,OAAO,EAAEK;QAAQ;MAAG,EAAsB,EAC3IF,WAAW,iBAAI,qBAAC,WAAW;QAAA,UAAEA;MAAW,EAAe;IAAA,GAChD,EACTG,QAAQ;EAAA,EACD;AAEd,CAAC;AAAC,eAEaf,OAAO;AAAA"}
|
|
1
|
+
{"version":3,"file":"TabLink.cjs","names":["OptionalLineWrapperWithIcon","styled","div","TopWrapper","TextContainer","StyledNotification","EndLineIcon","OptionalLineWrapper","Wrapper","COLORS","neutral_600","props","disabled","neutral_100","focusStyles","Z_INDEXES","active","neutral_20","primary_20","hover","primary_600","primary_100","primary_800","primary_500","white","neutral_300","TabLink","React","forwardRef","ref","to","requiredLine","optionalLine","OptionalLineIcon","onLinkClick","forceDeactivate","testId","showNotificationDot","size","Size","Small","endLineIcon","onActiveStateChanged","variant","children","containerOnMouseEnter","containerOnMouseLeave","className","rest","useState","activeState","setActiveState","toString","isActive","defaultOnMouseDownHandler","e"],"sources":["../../src/Tabs/TabLink.tsx"],"sourcesContent":["import * as React from 'react';\nimport { NavLink, NavLinkProps } from 'react-router-dom';\nimport styled from 'styled-components';\nimport { NotificationDot } from '../NotificationDot';\nimport { Size } from '../types';\nimport { COLORS, focusStyles } from '../styles';\nimport { Z_INDEXES } from '../styles/z-indexes';\nimport { defaultOnMouseDownHandler } from '../common';\nimport { useState } from 'react';\n\ntype TabLinkProps = {\n disabled?: boolean;\n forceDeactivate?: boolean;\n requiredLine: string;\n optionalLine?: string;\n OptionalLineIcon?: React.ReactNode; //React.FunctionComponent<BaseProps>;\n endLineIcon?: React.ReactNode;\n onLinkClick?: (e: React.MouseEvent) => void;\n testId?: string;\n onActiveStateChanged?: (state: boolean) => void;\n showNotificationDot?: boolean;\n size?: Size.Small | Size.Medium | Size.Large;\n variant?: 'positive' | 'critical';\n containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n} & NavLinkProps;\n\nconst OptionalLineWrapperWithIcon = styled.div`\n display: flex;\n flex-direction: row;\n\n span {\n margin: 0 0 0 4px !important;\n font-size: 12px;\n line-height: 16px;\n }\n`;\n\nconst TopWrapper = styled.div`\n display: flex;\n flex-direction: row;\n\n span:not(:only-child) {\n width: calc(100% - 32px);\n }\n`;\n\nconst TextContainer = styled.div`\n width: 100%;\n margin: auto 0 auto 16px !important;\n`;\n\nconst StyledNotification = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst EndLineIcon = styled.div`\n margin: 0 15px 0 0 !important;\n`;\n\nconst OptionalLineWrapper = styled.div`\n font-size: 12px;\n`;\n//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed\nconst Wrapper = styled.div<{disabled: boolean}>`\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n \n display: flex;\n flex-direction: row;\n align-items: center;\n \n font-size: 16px;\n line-height: 120%;\n color: ${COLORS.neutral_600};\n \n background-color: ${(props) => (props.disabled ? COLORS.neutral_100 : 'transparent')};\n cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n \n &:not(:last-child) {\n margin-bottom: 4px;\n }\n \n &:focus {\n ${focusStyles}\n }\n \n &.active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.neutral_20};\n }\n \n &.active:hover, &.active.dropdown-hover {\n background-color: ${COLORS.primary_20};\n }\n \n &:hover, &.dropdown-hover {\n z-index: ${Z_INDEXES.hover};\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_600};\n }\n \n &:active {\n z-index: ${Z_INDEXES.active};\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n \n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ${COLORS.primary_500};\n \n border-radius: 4px;\n }\n }\n \n &.active:hover, &.active.dropdown-hover {\n &::after {\n background-color: ${COLORS.primary_600};\n }\n }\n \n &.active:active {\n background-color: ${COLORS.primary_100};\n \n &::after {\n background-color: ${COLORS.primary_800};\n }\n }\n \n &.disabled {\n background-color: ${COLORS.white};\n color: ${COLORS.neutral_300};\n \n span {\n color: ${COLORS.neutral_300};\n }\n \n &::after {\n background-color: ${COLORS.neutral_300};\n }\n }\n }\n`;\n\nconst TabLink = React.forwardRef<HTMLAnchorElement, TabLinkProps>(({\n to,\n disabled = false,\n requiredLine,\n optionalLine,\n OptionalLineIcon,\n onLinkClick,\n forceDeactivate,\n testId,\n showNotificationDot = false,\n size = Size.Small,\n endLineIcon,\n onActiveStateChanged,\n variant = 'critical',\n children,\n containerOnMouseEnter,\n containerOnMouseLeave,\n className,\n ...rest\n}: TabLinkProps, ref) => {\n \n const [activeState, setActiveState] = useState<boolean>(false);\n\n return (\n <Wrapper disabled={disabled} className={disabled ? 'disabled' : ''} onMouseEnter={containerOnMouseEnter} onMouseLeave={containerOnMouseLeave}>\n <NavLink\n to={forceDeactivate ? 'invalid' : to.toString()}\n //disabled={disabled}\n className={({ isActive }) => {\n onActiveStateChanged && onActiveStateChanged(activeState);\n if(forceDeactivate)\n {\n if(disabled) \n return 'disabled';\n else \n return '';\n }\n\n if(isActive != activeState)\n setActiveState(isActive);\n\n return (isActive ? 'active ' : '') + (disabled ? 'disabled' : '');\n }}\n onMouseDown={defaultOnMouseDownHandler}\n tabIndex={disabled ? -1 : 0}\n role=\"tab\"\n aria-selected={activeState}\n onClick={(e: React.MouseEvent) => !disabled && onLinkClick && onLinkClick(e)}\n ref={ref}\n data-testid={testId}\n {...rest}>\n <TextContainer>\n <TopWrapper>\n <span>{requiredLine}</span>\n </TopWrapper>\n {optionalLine && OptionalLineIcon ? (\n <OptionalLineWrapperWithIcon>\n {OptionalLineIcon}\n {!!optionalLine && <span>{optionalLine}</span>}\n </OptionalLineWrapperWithIcon>\n ) : optionalLine ? (\n <OptionalLineWrapper>\n <span>{optionalLine}</span>\n </OptionalLineWrapper>\n ) : (\n <></>\n )}\n </TextContainer>\n <StyledNotification>{showNotificationDot && <NotificationDot testId=\"NotificationDot\" size={size} variant={variant} />}</StyledNotification>\n {endLineIcon && <EndLineIcon>{endLineIcon}</EndLineIcon>}\n </NavLink>\n {children}\n </Wrapper>\n );\n});\n\nexport default TabLink;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAsD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBtD,IAAMA,2BAA2B,GAAGC,yBAAM,CAACC,GAAG,iOAS7C;AAED,IAAMC,UAAU,GAAGF,yBAAM,CAACC,GAAG,kMAO5B;AAED,IAAME,aAAa,GAAGH,yBAAM,CAACC,GAAG,+IAG/B;AAED,IAAMG,kBAAkB,GAAGJ,yBAAM,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WAAW,CAACqB,CAAC,CAAC;MAAA,CAAC;MAC7E,GAAG,EAAE1B,GAAI;MACT,eAAaO;IAAO,GAChBY,IAAI;MAAA,wBACR,sBAAC,aAAa;QAAA,wBACZ,qBAAC,UAAU;UAAA,uBACT;YAAA,UAAOjB;UAAY;QAAQ,EAChB,EACZC,YAAY,IAAIC,gBAAgB,gBAC/B,sBAAC,2BAA2B;UAAA,WACzBA,gBAAgB,EAChB,CAAC,CAACD,YAAY,iBAAI;YAAA,UAAOA;UAAY,EAAQ;QAAA,EAClB,GAC5BA,YAAY,gBACd,qBAAC,mBAAmB;UAAA,uBAClB;YAAA,UAAOA;UAAY;QAAQ,EACP,gBAEtB,8CACD;MAAA,EACa,eAChB,qBAAC,kBAAkB;QAAA,UAAEK,mBAAmB,iBAAI,qBAAC,gCAAe;UAAC,MAAM,EAAC,iBAAiB;UAAC,IAAI,EAAEC,IAAK;UAAC,OAAO,EAAEK;QAAQ;MAAG,EAAsB,EAC3IF,WAAW,iBAAI,qBAAC,WAAW;QAAA,UAAEA;MAAW,EAAe;IAAA,GAChD,EACTG,QAAQ;EAAA,EACD;AAEd,CAAC,CAAC;AAAC,eAEYlB,OAAO;AAAA"}
|
package/dist/Tabs/TabLink.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { NavLinkProps } from 'react-router-dom';
|
|
3
3
|
import { Size } from '../types';
|
|
4
|
-
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
forceDeactivate?: boolean;
|
|
4
|
+
declare const TabLink: React.ForwardRefExoticComponent<{
|
|
5
|
+
disabled?: boolean | undefined;
|
|
6
|
+
forceDeactivate?: boolean | undefined;
|
|
7
7
|
requiredLine: string;
|
|
8
|
-
optionalLine?: string;
|
|
8
|
+
optionalLine?: string | undefined;
|
|
9
9
|
OptionalLineIcon?: React.ReactNode;
|
|
10
10
|
endLineIcon?: React.ReactNode;
|
|
11
|
-
onLinkClick?: (e: React.MouseEvent) => void;
|
|
12
|
-
testId?: string;
|
|
13
|
-
onActiveStateChanged?: (state: boolean) => void;
|
|
14
|
-
showNotificationDot?: boolean;
|
|
15
|
-
size?: Size.Small | Size.Medium | Size.Large;
|
|
16
|
-
variant?:
|
|
17
|
-
containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement
|
|
18
|
-
containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement
|
|
19
|
-
} & NavLinkProps
|
|
20
|
-
declare const TabLink: ({ to, disabled, requiredLine, optionalLine, OptionalLineIcon, onLinkClick, forceDeactivate, testId, showNotificationDot, size, endLineIcon, onActiveStateChanged, variant, children, containerOnMouseEnter, containerOnMouseLeave, className, ...rest }: TabLinkProps) => JSX.Element;
|
|
11
|
+
onLinkClick?: ((e: React.MouseEvent) => void) | undefined;
|
|
12
|
+
testId?: string | undefined;
|
|
13
|
+
onActiveStateChanged?: ((state: boolean) => void) | undefined;
|
|
14
|
+
showNotificationDot?: boolean | undefined;
|
|
15
|
+
size?: Size.Small | Size.Medium | Size.Large | undefined;
|
|
16
|
+
variant?: "positive" | "critical" | undefined;
|
|
17
|
+
containerOnMouseEnter?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
18
|
+
containerOnMouseLeave?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
19
|
+
} & NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
21
20
|
export default TabLink;
|
package/dist/Tabs/TabLink.js
CHANGED
|
@@ -25,12 +25,12 @@ var StyledNotification = styled.div(_templateObject4 || (_templateObject4 = _tag
|
|
|
25
25
|
var EndLineIcon = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0 15px 0 0 !important;\n"])));
|
|
26
26
|
var OptionalLineWrapper = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: 12px;\n"])));
|
|
27
27
|
//replaced styledTabLink because 'className' and 'styled' functions for some reason were not being executed
|
|
28
|
-
var Wrapper = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n \n display: flex;\n flex-direction: row;\n align-items: center;\n \n font-size: 16px;\n line-height: 120%;\n color: ", ";\n \n background-color: ", ";\n cursor: ", ";\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n \n &:not(:last-child) {\n margin-bottom: 4px;\n }\n \n &:focus {\n ", "\n }\n \n &.active {\n z-index: ", ";\n background-color: ", ";\n }\n \n &.active:hover {\n background-color: ", ";\n }\n \n &:hover {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n \n &:active {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n \n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ", ";\n \n border-radius: 4px;\n }\n }\n \n &.active:hover {\n &::after {\n background-color: ", ";\n }\n }\n \n &.active:active {\n background-color: ", ";\n \n &::after {\n background-color: ", ";\n }\n }\n \n &.disabled {\n background-color: ", ";\n color: ", ";\n \n span {\n color: ", ";\n }\n \n &::after {\n background-color: ", ";\n }\n }\n }\n"])), COLORS.neutral_600, function (props) {
|
|
28
|
+
var Wrapper = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n &.disabled {\n cursor: not-allowed;\n\n a {\n pointer-events: none;\n }\n }\n\n a {\n \n display: flex;\n flex-direction: row;\n align-items: center;\n \n font-size: 16px;\n line-height: 120%;\n color: ", ";\n \n background-color: ", ";\n cursor: ", ";\n border-left: 1px solid transparent;\n text-decoration: none;\n position: relative;\n border-radius: 2px;\n \n &:not(:last-child) {\n margin-bottom: 4px;\n }\n \n &:focus {\n ", "\n }\n \n &.active {\n z-index: ", ";\n background-color: ", ";\n }\n \n &.active:hover, &.active.dropdown-hover {\n background-color: ", ";\n }\n \n &:hover, &.dropdown-hover {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n \n &:active {\n z-index: ", ";\n background-color: ", ";\n color: ", ";\n }\n \n &.active {\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 3px;\n background-color: ", ";\n \n border-radius: 4px;\n }\n }\n \n &.active:hover, &.active.dropdown-hover {\n &::after {\n background-color: ", ";\n }\n }\n \n &.active:active {\n background-color: ", ";\n \n &::after {\n background-color: ", ";\n }\n }\n \n &.disabled {\n background-color: ", ";\n color: ", ";\n \n span {\n color: ", ";\n }\n \n &::after {\n background-color: ", ";\n }\n }\n }\n"])), COLORS.neutral_600, function (props) {
|
|
29
29
|
return props.disabled ? COLORS.neutral_100 : 'transparent';
|
|
30
30
|
}, function (props) {
|
|
31
31
|
return props.disabled ? 'not-allowed' : 'pointer';
|
|
32
32
|
}, focusStyles, Z_INDEXES.active, COLORS.neutral_20, COLORS.primary_20, Z_INDEXES.hover, COLORS.primary_20, COLORS.primary_600, Z_INDEXES.active, COLORS.primary_100, COLORS.primary_800, COLORS.primary_500, COLORS.primary_600, COLORS.primary_100, COLORS.primary_800, COLORS.white, COLORS.neutral_300, COLORS.neutral_300, COLORS.neutral_300);
|
|
33
|
-
var TabLink = function
|
|
33
|
+
var TabLink = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
34
34
|
var to = _ref.to,
|
|
35
35
|
_ref$disabled = _ref.disabled,
|
|
36
36
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
@@ -53,7 +53,6 @@ var TabLink = function TabLink(_ref) {
|
|
|
53
53
|
containerOnMouseLeave = _ref.containerOnMouseLeave,
|
|
54
54
|
className = _ref.className,
|
|
55
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
56
|
-
var ref = React.useRef(null);
|
|
57
56
|
var _useState = useState(false),
|
|
58
57
|
_useState2 = _slicedToArray(_useState, 2),
|
|
59
58
|
activeState = _useState2[0],
|
|
@@ -111,6 +110,6 @@ var TabLink = function TabLink(_ref) {
|
|
|
111
110
|
})]
|
|
112
111
|
})), children]
|
|
113
112
|
});
|
|
114
|
-
};
|
|
113
|
+
});
|
|
115
114
|
export default TabLink;
|
|
116
115
|
//# sourceMappingURL=TabLink.js.map
|