@redsift/design-system 11.6.0-muiv5-alpha.5 → 11.6.0-muiv5-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/_internal/Alert2.js +182 -39
- package/_internal/AppBar.js +240 -29
- package/_internal/AppContainer.js +132 -86
- package/_internal/AppContent.js +84 -17
- package/_internal/Badge2.js +137 -4
- package/_internal/BreadcrumbItem.js +85 -3
- package/_internal/Breadcrumbs2.js +86 -21
- package/_internal/Button2.js +81 -20
- package/_internal/ButtonGroup.js +165 -25
- package/_internal/ButtonLink.js +74 -18
- package/_internal/Card2.js +151 -29
- package/_internal/CardActions.js +38 -3
- package/_internal/CardBody.js +36 -3
- package/_internal/CardHeader.js +77 -3
- package/_internal/Checkbox2.js +234 -58
- package/_internal/CheckboxGroup.js +182 -4
- package/_internal/ConditionalWrapper.js +11 -12
- package/_internal/DetailedCard.js +6912 -48
- package/_internal/DetailedCardCollapsibleSectionItems.js +58 -3
- package/_internal/DetailedCardHeader.js +61 -3
- package/_internal/DetailedCardSection.js +166 -3
- package/_internal/DetailedCardSectionItem.js +88 -3
- package/_internal/Flexbox2.js +85 -22
- package/_internal/Grid2.js +87 -24
- package/_internal/GridItem.js +34 -3
- package/_internal/Heading2.js +107 -3
- package/_internal/Icon2.js +206 -5
- package/_internal/IconButton.js +71 -3
- package/_internal/IconButtonLink.js +65 -18
- package/_internal/Item2.js +390 -73
- package/_internal/Link2.js +56 -15
- package/_internal/LinkButton.js +56 -13
- package/_internal/Number2.js +103 -61
- package/_internal/NumberField.js +3959 -65
- package/_internal/Pill2.js +400 -4
- package/_internal/ProgressBar.js +61 -18
- package/_internal/Radio2.js +227 -56
- package/_internal/RadioGroup.js +170 -4
- package/_internal/Shield2.js +220 -4
- package/_internal/SideNavigationMenu.js +586 -4
- package/_internal/SideNavigationMenuItem.js +299 -4
- package/_internal/Skeleton2.js +36 -9
- package/_internal/SkeletonCircle.js +52 -3
- package/_internal/SkeletonText.js +71 -3
- package/_internal/Spinner2.js +319 -29
- package/_internal/Switch2.js +310 -56
- package/_internal/SwitchGroup.js +182 -4
- package/_internal/Text2.js +45 -3
- package/_internal/TextArea.js +430 -20
- package/_internal/TextField.js +463 -19
- package/_internal/alert.js +2 -5
- package/_internal/app-bar.js +2 -8
- package/_internal/app-container.js +3 -9
- package/_internal/app-content.js +2 -5
- package/_internal/app-side-panel.js +3 -11
- package/_internal/badge.js +2 -6
- package/_internal/breadcrumb-item.js +1 -4
- package/_internal/breadcrumbs.js +2 -6
- package/_internal/button-group.js +2 -5
- package/_internal/button-link.js +2 -8
- package/_internal/button.js +3 -8
- package/_internal/card-actions.js +1 -4
- package/_internal/card-body.js +1 -4
- package/_internal/card-header.js +1 -8
- package/_internal/card.js +2 -11
- package/_internal/checkbox-group.js +2 -6
- package/_internal/checkbox.js +2 -6
- package/_internal/colors.js +87 -91
- package/_internal/conditional-wrapper.js +2 -2
- package/_internal/detailed-card-collapsible-section-items.js +1 -3
- package/_internal/detailed-card-header.js +1 -7
- package/_internal/detailed-card-section-item.js +1 -10
- package/_internal/detailed-card-section.js +1 -6
- package/_internal/detailed-card.js +2 -16
- package/_internal/flexbox.js +2 -5
- package/_internal/focus-within-group.js +3 -3
- package/_internal/fonts.js +4 -6
- package/_internal/gradient-border.js +35 -16
- package/_internal/grid-item.js +1 -4
- package/_internal/grid.js +2 -6
- package/_internal/heading.js +2 -6
- package/_internal/icon-button-link.js +2 -8
- package/_internal/icon-button.js +2 -6
- package/_internal/icon.js +2 -6
- package/_internal/item.js +2 -8
- package/_internal/link-button.js +2 -8
- package/_internal/link.js +3 -8
- package/_internal/listbox.js +3 -6
- package/_internal/number-field.js +2 -9
- package/_internal/number.js +2 -7
- package/_internal/pill.js +2 -6
- package/_internal/progress-bar.js +2 -5
- package/_internal/radio-group.js +2 -6
- package/_internal/radio.js +2 -6
- package/_internal/shared.js +2 -5
- package/_internal/shield.js +2 -6
- package/_internal/side-navigation-menu-bar.js +3 -9
- package/_internal/side-navigation-menu-item.js +2 -8
- package/_internal/side-navigation-menu.js +2 -8
- package/_internal/skeleton-circle.js +1 -6
- package/_internal/skeleton-text.js +2 -6
- package/_internal/skeleton.js +1 -7
- package/_internal/spinner.js +2 -5
- package/_internal/styles.js +235 -17
- package/_internal/styles2.js +44 -280
- package/_internal/switch-group.js +2 -6
- package/_internal/switch.js +2 -6
- package/_internal/text-area.js +2 -9
- package/_internal/text-field.js +2 -10
- package/_internal/text.js +2 -6
- package/_internal/theme.js +1 -3
- package/_internal/types.js +7 -31
- package/_internal/types2.js +18 -29
- package/_internal/types3.js +15 -18
- package/_internal/useAppSidePanel.js +331 -6
- package/_internal/useFocusOnList.js +502 -44
- package/_internal/useListboxItem.js +120 -23
- package/_internal/useSideNavigationMenuBar.js +371 -7
- package/_internal/useTheme.js +10 -8
- package/index.d.ts +4667 -0
- package/index.js +523 -1674
- package/package.json +2 -2
- package/_internal/SideNavigationMenuBar.js +0 -9
- package/_internal/helpers.js +0 -23
- package/_internal/types10.js +0 -20
- package/_internal/types11.js +0 -27
- package/_internal/types12.js +0 -35
- package/_internal/types13.js +0 -143
- package/_internal/types14.js +0 -11
- package/_internal/types15.js +0 -62
- package/_internal/types16.js +0 -56
- package/_internal/types17.js +0 -57
- package/_internal/types18.js +0 -40
- package/_internal/types19.js +0 -101
- package/_internal/types20.js +0 -47
- package/_internal/types21.js +0 -68
- package/_internal/types22.js +0 -52
- package/_internal/types23.js +0 -174
- package/_internal/types24.js +0 -18
- package/_internal/types25.js +0 -12
- package/_internal/types26.js +0 -36
- package/_internal/types27.js +0 -72
- package/_internal/types28.js +0 -73
- package/_internal/types29.js +0 -99
- package/_internal/types4.js +0 -67
- package/_internal/types5.js +0 -11
- package/_internal/types6.js +0 -11
- package/_internal/types7.js +0 -28
- package/_internal/types8.js +0 -72
- package/_internal/types9.js +0 -16
package/_internal/Item2.js
CHANGED
|
@@ -1,82 +1,399 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { useCallback, useEffect, forwardRef, useRef, useContext } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
5
|
+
import { j as baseContainer } from './styles4.js';
|
|
6
|
+
import { u as useListboxItem } from './useListboxItem.js';
|
|
7
|
+
import { c as useFocusOnListItem, b as FocusWithinGroupContext } from './useFocusOnListItem.js';
|
|
8
|
+
import { mdiCheckboxMarked, mdiCheckboxBlankOutline } from '@redsift/icons';
|
|
9
|
+
import { StyledGradientBorder } from './gradient-border.js';
|
|
10
|
+
import { u as useTheme } from './useTheme.js';
|
|
11
|
+
import { B as ButtonsColorPalette } from './colors.js';
|
|
12
|
+
import { C as ConditionalWrapper } from './ConditionalWrapper.js';
|
|
13
|
+
import { F as Flexbox } from './Flexbox2.js';
|
|
14
|
+
import { a as Icon } from './Icon2.js';
|
|
15
|
+
import { T as Text } from './Text2.js';
|
|
16
|
+
import { u as useId } from './useId.js';
|
|
17
|
+
import { i as isComponent } from './isComponent.js';
|
|
7
18
|
|
|
8
19
|
/**
|
|
9
|
-
* Component
|
|
10
|
-
*/
|
|
11
|
-
type ItemColor = ButtonsColorPalette;
|
|
12
|
-
/**
|
|
13
|
-
* Component props.
|
|
20
|
+
* Component style.
|
|
14
21
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
22
|
+
const StyledItem = styled.div`
|
|
23
|
+
min-height: 36px;
|
|
24
|
+
position: relative;
|
|
25
|
+
width: 100%;
|
|
26
|
+
padding: 8px 16px;
|
|
27
|
+
|
|
28
|
+
${baseContainer}
|
|
29
|
+
|
|
30
|
+
align-items: center;
|
|
31
|
+
background: none;
|
|
32
|
+
border: none;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
|
|
36
|
+
> a {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
text-decoration: none;
|
|
40
|
+
color: inherit;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${_ref => {
|
|
44
|
+
let {
|
|
45
|
+
$color,
|
|
46
|
+
$isActive,
|
|
47
|
+
$isDisabled,
|
|
48
|
+
$isGradient,
|
|
49
|
+
$isHovered,
|
|
50
|
+
$hasBorder,
|
|
51
|
+
$theme
|
|
52
|
+
} = _ref;
|
|
53
|
+
return css`
|
|
54
|
+
${!$isGradient ? css`
|
|
55
|
+
background-color: var(
|
|
56
|
+
--redsift-color-${$theme}-components-buttons-secondary-button-${$isDisabled ? 'grey' : $color}-background-${$isActive ? 'active' : $isHovered || $isDisabled ? 'hover' : 'default'}
|
|
57
|
+
);
|
|
58
|
+
` : css`
|
|
59
|
+
background: var(
|
|
60
|
+
--redsift-color-${$theme}-components-buttons-secondary-button-${$isDisabled ? 'grey' : $color}-background-${$isActive ? 'active' : $isHovered || $isDisabled ? 'hover' : 'default'}
|
|
61
|
+
);
|
|
62
|
+
`}
|
|
63
|
+
|
|
64
|
+
${$hasBorder ? css`
|
|
65
|
+
border: 1px solid
|
|
66
|
+
var(
|
|
67
|
+
--redsift-color-${$theme}-components-buttons-secondary-button-${$isDisabled ? 'grey' : $color}-text-${$isActive ? 'active' : $isHovered || $isDisabled ? 'hover' : 'default'}
|
|
68
|
+
);
|
|
69
|
+
` : ''}
|
|
70
|
+
`;
|
|
71
|
+
}}
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
outline: none;
|
|
75
|
+
|
|
76
|
+
${_ref2 => {
|
|
77
|
+
let {
|
|
78
|
+
$color,
|
|
79
|
+
$isDisabled,
|
|
80
|
+
$isGradient,
|
|
81
|
+
$hasBorder,
|
|
82
|
+
$theme
|
|
83
|
+
} = _ref2;
|
|
84
|
+
return css`
|
|
85
|
+
cursor: ${$isDisabled ? 'default' : 'pointer'};
|
|
86
|
+
|
|
87
|
+
${!$isDisabled ? css`
|
|
88
|
+
${!$isGradient ? css`
|
|
89
|
+
background-color: var(
|
|
90
|
+
--redsift-color-${$theme}-components-buttons-secondary-button-${$color}-background-hover
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
${$hasBorder ? css`
|
|
94
|
+
border: 1px solid
|
|
95
|
+
var(--redsift-color-${$theme}-components-buttons-secondary-button-${$color}-text-hover);
|
|
96
|
+
` : ''}
|
|
97
|
+
` : css`
|
|
98
|
+
background: var(
|
|
99
|
+
--redsift-color-${$theme}-components-buttons-secondary-button-${$color}-background-hover
|
|
100
|
+
);
|
|
101
|
+
`}
|
|
102
|
+
` : ''}
|
|
103
|
+
`;
|
|
104
|
+
}};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:active {
|
|
108
|
+
outline: none;
|
|
109
|
+
|
|
110
|
+
${_ref3 => {
|
|
111
|
+
let {
|
|
112
|
+
$color,
|
|
113
|
+
$hasBorder,
|
|
114
|
+
$isHovered,
|
|
115
|
+
$isDisabled,
|
|
116
|
+
$isGradient,
|
|
117
|
+
$theme
|
|
118
|
+
} = _ref3;
|
|
119
|
+
return css`
|
|
120
|
+
${!$isDisabled ? css`
|
|
121
|
+
${!$isGradient ? css`
|
|
122
|
+
background-color: var(
|
|
123
|
+
--redsift-color-${$theme}-components-buttons-secondary-button-${$isDisabled ? 'grey' : $color}-background-${$isHovered ? 'hover' : 'active'}
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
${$hasBorder ? css`
|
|
127
|
+
border: 1px solid
|
|
128
|
+
var(
|
|
129
|
+
--redsift-color-${$theme}-components-buttons-secondary-button-${$isDisabled ? 'grey' : $color}-text-${$isHovered ? 'hover' : 'active'}
|
|
130
|
+
);
|
|
131
|
+
` : ''}
|
|
132
|
+
` : css`
|
|
133
|
+
background: var(
|
|
134
|
+
--redsift-color-${$theme}-components-buttons-secondary-button-${$isDisabled ? 'grey' : $color}-background-${$isHovered ? 'hover' : 'active'}
|
|
135
|
+
);
|
|
136
|
+
`}
|
|
137
|
+
` : ''}
|
|
138
|
+
`;
|
|
139
|
+
}};
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
|
|
143
|
+
function useMenuItem(props) {
|
|
144
|
+
const {
|
|
145
|
+
domElementRef,
|
|
146
|
+
id,
|
|
147
|
+
isDisabled,
|
|
148
|
+
onClick,
|
|
149
|
+
isLinkMenuItem,
|
|
150
|
+
linkRef
|
|
151
|
+
} = props;
|
|
152
|
+
const {
|
|
153
|
+
tabIndex,
|
|
154
|
+
isFocused,
|
|
155
|
+
handleKeyDown: handleFocusKeyDown,
|
|
156
|
+
handleClick: handleFocusClick
|
|
157
|
+
} = useFocusOnListItem({
|
|
158
|
+
domElementRef,
|
|
159
|
+
isDisabled: isDisabled,
|
|
160
|
+
id
|
|
161
|
+
});
|
|
162
|
+
const handleKeyDown = useCallback(event => {
|
|
163
|
+
const code = event.code;
|
|
164
|
+
if (code === 'Enter' || code === 'Space') {
|
|
165
|
+
if (isLinkMenuItem) {
|
|
166
|
+
var _linkRef$current;
|
|
167
|
+
linkRef === null || linkRef === void 0 ? void 0 : (_linkRef$current = linkRef.current) === null || _linkRef$current === void 0 ? void 0 : _linkRef$current.click();
|
|
168
|
+
} else {
|
|
169
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
handleFocusKeyDown(event);
|
|
173
|
+
}, []);
|
|
174
|
+
const handleClick = useCallback(() => {
|
|
175
|
+
handleFocusClick();
|
|
176
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
177
|
+
}, []);
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (isFocused && domElementRef.current) {
|
|
180
|
+
var _current;
|
|
181
|
+
(_current = domElementRef.current) === null || _current === void 0 ? void 0 : _current.focus();
|
|
182
|
+
}
|
|
183
|
+
}, [isFocused]);
|
|
184
|
+
return {
|
|
185
|
+
tabIndex,
|
|
186
|
+
isFocused,
|
|
187
|
+
isDisabled,
|
|
188
|
+
handleKeyDown,
|
|
189
|
+
handleClick
|
|
190
|
+
};
|
|
48
191
|
}
|
|
49
|
-
type StyledItemProps = Omit<ItemProps, 'color' | 'onClick' | 'value'> & {
|
|
50
|
-
$borderRadius: ItemProps['borderRadius'];
|
|
51
|
-
$color: ItemProps['color'];
|
|
52
|
-
$hasBorder: ItemProps['hasBorder'];
|
|
53
|
-
$hasCheckbox: ItemProps['hasCheckbox'];
|
|
54
|
-
$isActive: ItemProps['isActive'];
|
|
55
|
-
$isDisabled: ItemProps['isDisabled'];
|
|
56
|
-
$isGradient: boolean;
|
|
57
|
-
$isHovered: ItemProps['isHovered'];
|
|
58
|
-
$theme: ItemProps['theme'];
|
|
59
|
-
};
|
|
60
192
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
193
|
+
const _excluded = ["borderRadius", "children", "className", "color", "defaultSelected", "id", "isActive", "isDisabled", "isHovered", "isSelected", "hasBorder", "hasCheckbox", "theme", "value"],
|
|
194
|
+
_excluded2 = ["borderRadius", "children", "className", "color", "hasBorder", "id", "isActive", "isDisabled", "isHovered", "theme", "onClick"];
|
|
195
|
+
const COMPONENT_NAME = 'Item';
|
|
196
|
+
const CLASSNAME = 'redsift-item';
|
|
197
|
+
const RenderedListboxItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
198
|
+
const {
|
|
199
|
+
borderRadius = '0',
|
|
200
|
+
children,
|
|
201
|
+
className,
|
|
202
|
+
color: propsColor,
|
|
203
|
+
defaultSelected,
|
|
204
|
+
id: propsId,
|
|
205
|
+
isActive,
|
|
206
|
+
isDisabled: propsIsDisabled,
|
|
207
|
+
isHovered,
|
|
208
|
+
isSelected: propsIsSelected,
|
|
209
|
+
hasBorder,
|
|
210
|
+
hasCheckbox,
|
|
211
|
+
theme: propsTheme,
|
|
212
|
+
value
|
|
213
|
+
} = props,
|
|
214
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
215
|
+
const id = propsId !== null && propsId !== void 0 ? propsId : value;
|
|
216
|
+
const _ref = useRef();
|
|
217
|
+
const divRef = ref !== null && ref !== void 0 ? ref : _ref;
|
|
218
|
+
const {
|
|
219
|
+
tabIndex,
|
|
220
|
+
isFocused,
|
|
221
|
+
isSelected,
|
|
222
|
+
isDisabled,
|
|
223
|
+
handleKeyDown,
|
|
224
|
+
handleClick
|
|
225
|
+
} = useListboxItem({
|
|
226
|
+
domElementRef: divRef,
|
|
227
|
+
value,
|
|
228
|
+
id,
|
|
229
|
+
isDisabled: propsIsDisabled,
|
|
230
|
+
propsIsSelected: propsIsSelected !== null && propsIsSelected !== void 0 ? propsIsSelected : defaultSelected
|
|
231
|
+
});
|
|
232
|
+
const theme = useTheme(propsTheme);
|
|
233
|
+
const color = Object.values(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
|
|
234
|
+
const isGradient = color === ButtonsColorPalette.radar;
|
|
235
|
+
return /*#__PURE__*/React__default.createElement(ConditionalWrapper, {
|
|
236
|
+
condition: isGradient,
|
|
237
|
+
wrapper: children => /*#__PURE__*/React__default.createElement(StyledGradientBorder, {
|
|
238
|
+
$borderRadius: borderRadius,
|
|
239
|
+
$color: color,
|
|
240
|
+
$isActive: isActive,
|
|
241
|
+
$isDisabled: isDisabled,
|
|
242
|
+
$isHovered: isHovered,
|
|
243
|
+
$theme: theme,
|
|
244
|
+
width: "auto"
|
|
245
|
+
}, children)
|
|
246
|
+
}, /*#__PURE__*/React__default.createElement(StyledItem, _extends({
|
|
247
|
+
role: "option"
|
|
248
|
+
}, forwardedProps, {
|
|
249
|
+
id: id,
|
|
250
|
+
$borderRadius: borderRadius,
|
|
251
|
+
$color: color,
|
|
252
|
+
$hasBorder: hasBorder,
|
|
253
|
+
$hasCheckbox: hasCheckbox,
|
|
254
|
+
$isActive: isActive || isSelected,
|
|
255
|
+
$isDisabled: isDisabled,
|
|
256
|
+
$isGradient: isGradient,
|
|
257
|
+
$isHovered: isHovered || isFocused,
|
|
258
|
+
$theme: theme,
|
|
259
|
+
"aria-selected": isSelected,
|
|
260
|
+
"aria-disabled": isDisabled,
|
|
261
|
+
className: classNames(Item.className, className),
|
|
262
|
+
onClick: isDisabled ? undefined : handleClick,
|
|
263
|
+
ref: divRef,
|
|
264
|
+
onKeyDown: handleKeyDown,
|
|
265
|
+
tabIndex: tabIndex
|
|
266
|
+
}), hasCheckbox ? /*#__PURE__*/React__default.createElement(Flexbox, null, isSelected ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
267
|
+
color: isDisabled ? 'grey' : color,
|
|
268
|
+
icon: mdiCheckboxMarked
|
|
269
|
+
}) : /*#__PURE__*/React__default.createElement(Icon, {
|
|
270
|
+
color: "question",
|
|
271
|
+
icon: mdiCheckboxBlankOutline
|
|
272
|
+
}), children ? children : /*#__PURE__*/React__default.createElement(Text, null, value)) : children !== null && children !== void 0 ? children : value));
|
|
273
|
+
});
|
|
274
|
+
const RenderedMenuItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
275
|
+
const {
|
|
276
|
+
borderRadius = '0',
|
|
277
|
+
children,
|
|
278
|
+
className,
|
|
279
|
+
color: propsColor,
|
|
280
|
+
hasBorder,
|
|
281
|
+
id: propsId,
|
|
282
|
+
isActive,
|
|
283
|
+
isDisabled: propsIsDisabled,
|
|
284
|
+
isHovered,
|
|
285
|
+
theme: propsTheme,
|
|
286
|
+
onClick
|
|
287
|
+
} = props,
|
|
288
|
+
forwardedProps = _objectWithoutProperties(props, _excluded2);
|
|
289
|
+
const [_id] = useId();
|
|
290
|
+
const id = propsId !== null && propsId !== void 0 ? propsId : _id;
|
|
291
|
+
const _ref = useRef();
|
|
292
|
+
const divRef = ref !== null && ref !== void 0 ? ref : _ref;
|
|
293
|
+
const linkRef = useRef(null);
|
|
294
|
+
const isLinkMenuItem = isComponent('Link')(children);
|
|
295
|
+
const {
|
|
296
|
+
tabIndex,
|
|
297
|
+
isFocused,
|
|
298
|
+
isDisabled,
|
|
299
|
+
handleKeyDown,
|
|
300
|
+
handleClick
|
|
301
|
+
} = useMenuItem({
|
|
302
|
+
domElementRef: divRef,
|
|
303
|
+
id,
|
|
304
|
+
isDisabled: propsIsDisabled,
|
|
305
|
+
onClick: onClick,
|
|
306
|
+
isLinkMenuItem,
|
|
307
|
+
linkRef
|
|
308
|
+
});
|
|
309
|
+
const theme = useTheme(propsTheme);
|
|
310
|
+
const color = Object.values(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
|
|
311
|
+
const isGradient = color === ButtonsColorPalette.radar;
|
|
312
|
+
return /*#__PURE__*/React__default.createElement(ConditionalWrapper, {
|
|
313
|
+
condition: isGradient,
|
|
314
|
+
wrapper: children => /*#__PURE__*/React__default.createElement(StyledGradientBorder, {
|
|
315
|
+
$borderRadius: borderRadius,
|
|
316
|
+
$color: color,
|
|
317
|
+
$isActive: isActive,
|
|
318
|
+
$isDisabled: isDisabled,
|
|
319
|
+
$isHovered: isHovered,
|
|
320
|
+
$theme: theme,
|
|
321
|
+
width: "auto"
|
|
322
|
+
}, children)
|
|
323
|
+
}, /*#__PURE__*/React__default.createElement(StyledItem, _extends({
|
|
324
|
+
as: "li",
|
|
325
|
+
role: isLinkMenuItem ? 'none' : 'menuitem'
|
|
326
|
+
}, forwardedProps, {
|
|
327
|
+
id: id,
|
|
328
|
+
$borderRadius: borderRadius,
|
|
329
|
+
$color: color,
|
|
330
|
+
$hasBorder: hasBorder,
|
|
331
|
+
$hasCheckbox: false,
|
|
332
|
+
$isActive: isActive,
|
|
333
|
+
$isDisabled: isDisabled,
|
|
334
|
+
$isGradient: isGradient,
|
|
335
|
+
$isHovered: isHovered || isFocused,
|
|
336
|
+
$theme: theme,
|
|
337
|
+
"aria-disabled": isDisabled,
|
|
338
|
+
className: classNames(Item.className, className),
|
|
339
|
+
onClick: isDisabled ? undefined : handleClick,
|
|
340
|
+
ref: divRef,
|
|
341
|
+
onKeyDown: handleKeyDown,
|
|
342
|
+
tabIndex: tabIndex
|
|
343
|
+
}), isLinkMenuItem ? /*#__PURE__*/React__default.cloneElement(children, {
|
|
344
|
+
role: 'menuitem',
|
|
345
|
+
ref: linkRef
|
|
346
|
+
}) : children));
|
|
347
|
+
});
|
|
348
|
+
|
|
77
349
|
/**
|
|
78
350
|
* The Item component.
|
|
79
351
|
*/
|
|
80
|
-
|
|
352
|
+
const Item = /*#__PURE__*/forwardRef((props, ref) => {
|
|
353
|
+
const {
|
|
354
|
+
value
|
|
355
|
+
} = props;
|
|
356
|
+
const focusContext = useContext(FocusWithinGroupContext);
|
|
357
|
+
const isListbox = focusContext.state.listRole === 'listbox';
|
|
358
|
+
if (!focusContext.state.filter) {
|
|
359
|
+
return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends({}, props, {
|
|
360
|
+
value: props.value,
|
|
361
|
+
ref: ref
|
|
362
|
+
})) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends({}, props, {
|
|
363
|
+
ref: ref
|
|
364
|
+
}));
|
|
365
|
+
}
|
|
366
|
+
const {
|
|
367
|
+
value: filterValue,
|
|
368
|
+
type,
|
|
369
|
+
caseSensitive
|
|
370
|
+
} = focusContext.state.filter;
|
|
371
|
+
if (!filterValue) {
|
|
372
|
+
return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends({}, props, {
|
|
373
|
+
value: props.value,
|
|
374
|
+
ref: ref
|
|
375
|
+
})) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends({}, props, {
|
|
376
|
+
ref: ref
|
|
377
|
+
}));
|
|
378
|
+
} else if (caseSensitive && (type === 'startsWith' && value.startsWith(filterValue) || type === 'contains' && value.includes(filterValue) || type === 'endsWith' && value.endsWith(filterValue))) {
|
|
379
|
+
return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends({}, props, {
|
|
380
|
+
value: props.value,
|
|
381
|
+
ref: ref
|
|
382
|
+
})) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends({}, props, {
|
|
383
|
+
ref: ref
|
|
384
|
+
}));
|
|
385
|
+
} else if (!caseSensitive && (type === 'startsWith' && value.toLowerCase().startsWith(filterValue.toLowerCase()) || type === 'contains' && value.toLowerCase().includes(filterValue.toLowerCase()) || type === 'endsWith' && value.toLowerCase().endsWith(filterValue.toLowerCase()))) {
|
|
386
|
+
return isListbox ? /*#__PURE__*/React__default.createElement(RenderedListboxItem, _extends({}, props, {
|
|
387
|
+
value: props.value,
|
|
388
|
+
ref: ref
|
|
389
|
+
})) : /*#__PURE__*/React__default.createElement(RenderedMenuItem, _extends({}, props, {
|
|
390
|
+
ref: ref
|
|
391
|
+
}));
|
|
392
|
+
}
|
|
393
|
+
return null;
|
|
394
|
+
});
|
|
395
|
+
Item.className = CLASSNAME;
|
|
396
|
+
Item.displayName = COMPONENT_NAME;
|
|
81
397
|
|
|
82
|
-
export {
|
|
398
|
+
export { Item as I, RenderedListboxItem as R, StyledItem as S };
|
|
399
|
+
//# sourceMappingURL=Item2.js.map
|
package/_internal/Link2.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { S as StyledLink } from './styles3.js';
|
|
5
|
+
import { u as useTheme } from './useTheme.js';
|
|
6
|
+
import { a as Icon } from './Icon2.js';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
declare const StyledLink: styled_components.StyledComponent<"a", any, Omit<LinkProps, "isDisabled"> & {
|
|
10
|
-
$isDisabled: boolean | undefined;
|
|
11
|
-
$color: (string & {}) | "radar" | NotificationsColorPalette | NeutralColorPalette | undefined;
|
|
12
|
-
$theme: Theme | undefined;
|
|
13
|
-
$hasIcons: boolean;
|
|
14
|
-
}, never>;
|
|
8
|
+
const _excluded = ["as", "children", "className", "color", "href", "isDisabled", "leftIcon", "leftIconProps", "rightIcon", "rightIconProps", "theme"];
|
|
9
|
+
const COMPONENT_NAME = 'Link';
|
|
10
|
+
const CLASSNAME = 'redsift-link';
|
|
15
11
|
|
|
16
12
|
/**
|
|
17
13
|
* The Link is a semantic link that looks like a link.
|
|
@@ -21,6 +17,51 @@ declare const StyledLink: styled_components.StyledComponent<"a", any, Omit<LinkP
|
|
|
21
17
|
* For a semantic button that looks like a button, please use the Button component.
|
|
22
18
|
* For a semantic button that looks like a link, please use the LinkButton component.
|
|
23
19
|
*/
|
|
24
|
-
|
|
20
|
+
const Link = /*#__PURE__*/forwardRef((props, ref) => {
|
|
21
|
+
const {
|
|
22
|
+
as,
|
|
23
|
+
children,
|
|
24
|
+
className,
|
|
25
|
+
color = 'primary',
|
|
26
|
+
href,
|
|
27
|
+
isDisabled,
|
|
28
|
+
leftIcon,
|
|
29
|
+
leftIconProps,
|
|
30
|
+
rightIcon,
|
|
31
|
+
rightIconProps,
|
|
32
|
+
theme: propsTheme
|
|
33
|
+
} = props,
|
|
34
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
35
|
+
const theme = useTheme(propsTheme);
|
|
36
|
+
return /*#__PURE__*/React__default.createElement(StyledLink, _extends({
|
|
37
|
+
as: as,
|
|
38
|
+
"aria-disabled": isDisabled,
|
|
39
|
+
role: "link",
|
|
40
|
+
tabIndex: !isDisabled ? 0 : undefined
|
|
41
|
+
}, forwardedProps, {
|
|
42
|
+
$color: color,
|
|
43
|
+
$isDisabled: isDisabled,
|
|
44
|
+
$theme: theme,
|
|
45
|
+
$hasIcons: leftIcon || rightIcon,
|
|
46
|
+
className: classNames(Link.className, className),
|
|
47
|
+
href: !isDisabled ? href : undefined,
|
|
48
|
+
ref: ref
|
|
49
|
+
}), leftIcon || rightIcon ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, leftIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends({
|
|
50
|
+
icon: leftIcon,
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
className: "left",
|
|
53
|
+
size: "xsmall"
|
|
54
|
+
}, leftIconProps)) : null, /*#__PURE__*/React__default.createElement("span", {
|
|
55
|
+
className: "text"
|
|
56
|
+
}, children), rightIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends({
|
|
57
|
+
icon: rightIcon,
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
className: "right",
|
|
60
|
+
size: "xsmall"
|
|
61
|
+
}, rightIconProps)) : null) : children);
|
|
62
|
+
});
|
|
63
|
+
Link.className = CLASSNAME;
|
|
64
|
+
Link.displayName = COMPONENT_NAME;
|
|
25
65
|
|
|
26
|
-
export { Link as L
|
|
66
|
+
export { Link as L };
|
|
67
|
+
//# sourceMappingURL=Link2.js.map
|
package/_internal/LinkButton.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { forwardRef, useRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { S as StyledLink } from './styles3.js';
|
|
5
|
+
import { u as useTheme } from './useTheme.js';
|
|
6
|
+
import { a as Icon } from './Icon2.js';
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
interface LinkButtonProps extends Pick<LinkProps, 'color' | 'leftIcon' | 'leftIconProps' | 'rightIconProps' | 'rightIcon'>, Omit<ButtonProps, 'color' | 'fullWidth' | 'leftIcon' | 'leftIconProps' | 'rightIconProps' | 'rightIcon' | 'size' | 'variant'> {
|
|
9
|
-
}
|
|
10
|
-
type StyledLinkButtonProps = Omit<LinkButtonProps, 'isDisabled'> & {
|
|
11
|
-
$isDisabled: LinkButtonProps['isDisabled'];
|
|
12
|
-
};
|
|
8
|
+
const _excluded = ["children", "className", "color", "disabled", "isDisabled", "leftIcon", "leftIconProps", "rightIcon", "rightIconProps", "theme"];
|
|
9
|
+
const COMPONENT_NAME = 'LinkButton';
|
|
10
|
+
const CLASSNAME = 'redsift-link-button';
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* The LinkButton is a semantic button that looks like a link.
|
|
@@ -18,6 +16,51 @@ type StyledLinkButtonProps = Omit<LinkButtonProps, 'isDisabled'> & {
|
|
|
18
16
|
* For a semantic link that looks like a link, please use the Link component.
|
|
19
17
|
* For a semantic link that looks like a button, please use the ButtonLink component.
|
|
20
18
|
*/
|
|
21
|
-
|
|
19
|
+
const LinkButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
20
|
+
const buttonRef = ref || useRef();
|
|
21
|
+
const {
|
|
22
|
+
children,
|
|
23
|
+
className,
|
|
24
|
+
color = 'primary',
|
|
25
|
+
disabled,
|
|
26
|
+
isDisabled: propsIsDisabled,
|
|
27
|
+
leftIcon,
|
|
28
|
+
leftIconProps,
|
|
29
|
+
rightIcon,
|
|
30
|
+
rightIconProps,
|
|
31
|
+
theme: propsTheme
|
|
32
|
+
} = props,
|
|
33
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
34
|
+
const isDisabled = propsIsDisabled || disabled;
|
|
35
|
+
const theme = useTheme(propsTheme);
|
|
36
|
+
return /*#__PURE__*/React__default.createElement(StyledLink, _extends({
|
|
37
|
+
as: "button"
|
|
38
|
+
}, forwardedProps, {
|
|
39
|
+
$color: color,
|
|
40
|
+
$isDisabled: isDisabled || disabled,
|
|
41
|
+
$theme: theme,
|
|
42
|
+
"aria-disabled": isDisabled || disabled,
|
|
43
|
+
className: classNames(LinkButton.className, className),
|
|
44
|
+
disabled: isDisabled || disabled
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
,
|
|
47
|
+
ref: buttonRef
|
|
48
|
+
}), leftIcon || rightIcon ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, leftIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends({
|
|
49
|
+
icon: leftIcon,
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
className: "left",
|
|
52
|
+
size: "xsmall"
|
|
53
|
+
}, leftIconProps)) : null, /*#__PURE__*/React__default.createElement("span", {
|
|
54
|
+
className: "text"
|
|
55
|
+
}, children), rightIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends({
|
|
56
|
+
icon: rightIcon,
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
className: "right",
|
|
59
|
+
size: "xsmall"
|
|
60
|
+
}, rightIconProps)) : null) : children);
|
|
61
|
+
});
|
|
62
|
+
LinkButton.className = CLASSNAME;
|
|
63
|
+
LinkButton.displayName = COMPONENT_NAME;
|
|
22
64
|
|
|
23
|
-
export {
|
|
65
|
+
export { LinkButton as L };
|
|
66
|
+
//# sourceMappingURL=LinkButton.js.map
|