@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/Pill2.js
CHANGED
|
@@ -1,9 +1,405 @@
|
|
|
1
|
-
import {
|
|
2
|
-
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 styled, { css } from 'styled-components';
|
|
5
|
+
import { rn as RedsiftColorNeutralWhite, qI as RedsiftColorGreyL1, ru as RedsiftColorNeutralBlack, rp as RedsiftColorNeutralLightGrey, sg as RedsiftColorPresentationGreenDefault, sn as RedsiftColorPresentationPinkDefault, su as RedsiftColorPresentationAquaDefault, sB as RedsiftColorPresentationBrownDefault, sI as RedsiftColorPresentationRedDefault, sP as RedsiftColorPresentationYellowDefault, sW as RedsiftColorPresentationPurpleDefault, t1 as RedsiftColorPresentationOrangeDefault, t8 as RedsiftColorPresentationBlueDefault, tf as RedsiftColorPresentationGreyDefault, rt as RedsiftColorNeutralXDarkGrey, rs as RedsiftColorNeutralDarkGrey, rr as RedsiftColorNeutralMidGrey, ro as RedsiftColorNeutralXLightGrey, qd as RedsiftColorRedL4, qY as RedsiftColorYellowL4, qP as RedsiftColorGreenL4, qh as RedsiftColorRedN, r0 as RedsiftColorYellowN, qT as RedsiftColorGreenN } from './redsift-design-tokens.js';
|
|
6
|
+
import { i as baseStyling } from './styles4.js';
|
|
7
|
+
import { N as Number } from './Number2.js';
|
|
8
|
+
import { u as useTheme } from './useTheme.js';
|
|
9
|
+
import { f as PresentationColorPalette } from './colors.js';
|
|
10
|
+
import { i as isComponent } from './isComponent.js';
|
|
11
|
+
import { T as Text } from './Text2.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Component size.
|
|
15
|
+
*/
|
|
16
|
+
const PillSize = {
|
|
17
|
+
small: 'small',
|
|
18
|
+
large: 'large',
|
|
19
|
+
xlarge: 'xlarge'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Component props.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const predefinedColorToHex = {
|
|
27
|
+
green: RedsiftColorPresentationGreenDefault,
|
|
28
|
+
pink: RedsiftColorPresentationPinkDefault,
|
|
29
|
+
aqua: RedsiftColorPresentationAquaDefault,
|
|
30
|
+
brown: RedsiftColorPresentationBrownDefault,
|
|
31
|
+
red: RedsiftColorPresentationRedDefault,
|
|
32
|
+
yellow: RedsiftColorPresentationYellowDefault,
|
|
33
|
+
purple: RedsiftColorPresentationPurpleDefault,
|
|
34
|
+
orange: RedsiftColorPresentationOrangeDefault,
|
|
35
|
+
blue: RedsiftColorPresentationBlueDefault,
|
|
36
|
+
grey: RedsiftColorPresentationGreyDefault,
|
|
37
|
+
black: RedsiftColorNeutralBlack,
|
|
38
|
+
'x-dark-grey': RedsiftColorNeutralXDarkGrey,
|
|
39
|
+
'dark-grey': RedsiftColorNeutralDarkGrey,
|
|
40
|
+
'mid-grey': RedsiftColorNeutralMidGrey,
|
|
41
|
+
'light-grey': RedsiftColorNeutralLightGrey,
|
|
42
|
+
'x-light-grey': RedsiftColorNeutralXLightGrey,
|
|
43
|
+
white: RedsiftColorNeutralWhite,
|
|
44
|
+
error: RedsiftColorRedL4,
|
|
45
|
+
warning: RedsiftColorYellowL4,
|
|
46
|
+
success: RedsiftColorGreenL4,
|
|
47
|
+
'error-dark': RedsiftColorRedN,
|
|
48
|
+
'warning-dark': RedsiftColorYellowN,
|
|
49
|
+
'success-dark': RedsiftColorGreenN
|
|
50
|
+
};
|
|
51
|
+
const pickTextColorBasedOnBgColorAdvanced = (bgColor, lightColor, darkColor) => {
|
|
52
|
+
var color = isPredefinedColor(bgColor) ? predefinedColorToHex[bgColor].substring(1, 7) : bgColor.charAt(0) === '#' ? bgColor.substring(1, 7) : bgColor;
|
|
53
|
+
var r = parseInt(color.substring(0, 2), 16); // hexToR
|
|
54
|
+
var g = parseInt(color.substring(2, 4), 16); // hexToG
|
|
55
|
+
var b = parseInt(color.substring(4, 6), 16); // hexToB
|
|
56
|
+
var uicolors = [r / 255, g / 255, b / 255];
|
|
57
|
+
var c = uicolors.map(col => {
|
|
58
|
+
if (col <= 0.03928) {
|
|
59
|
+
return col / 12.92;
|
|
60
|
+
}
|
|
61
|
+
return Math.pow((col + 0.055) / 1.055, 2.4);
|
|
62
|
+
});
|
|
63
|
+
var L = 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2];
|
|
64
|
+
return L > 0.179 ? darkColor : lightColor;
|
|
65
|
+
};
|
|
66
|
+
const pickHoverColorBasedOnBgColorAdvanced = bgColor => {
|
|
67
|
+
var color = bgColor.charAt(0) === '#' ? bgColor.substring(1, 7) : bgColor;
|
|
68
|
+
if (color.toUpperCase() === 'FFFFFF') {
|
|
69
|
+
return RedsiftColorNeutralLightGrey;
|
|
70
|
+
}
|
|
71
|
+
var r = parseInt(color.substring(0, 2), 16); // hexToR
|
|
72
|
+
var g = parseInt(color.substring(2, 4), 16); // hexToG
|
|
73
|
+
var b = parseInt(color.substring(4, 6), 16); // hexToB
|
|
74
|
+
return `rgba(${r}, ${g}, ${b}, 0.75)`;
|
|
75
|
+
};
|
|
76
|
+
const isPredefinedColor = color => Object.keys(predefinedColorToHex).includes(color);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Component style.
|
|
80
|
+
*/
|
|
81
|
+
const StyledPill = styled.div`
|
|
82
|
+
align-items: stretch;
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
height: fit-content;
|
|
85
|
+
width: fit-content;
|
|
86
|
+
${baseStyling}
|
|
87
|
+
|
|
88
|
+
text-align: center;
|
|
89
|
+
|
|
90
|
+
${_ref => {
|
|
91
|
+
let {
|
|
92
|
+
$autoBreak
|
|
93
|
+
} = _ref;
|
|
94
|
+
return !$autoBreak ? css`
|
|
95
|
+
text-wrap: nowrap;
|
|
96
|
+
` : css`
|
|
97
|
+
word-break: break-word;
|
|
98
|
+
`;
|
|
99
|
+
}};
|
|
100
|
+
|
|
101
|
+
${_ref2 => {
|
|
102
|
+
let {
|
|
103
|
+
$size
|
|
104
|
+
} = _ref2;
|
|
105
|
+
return css`
|
|
106
|
+
.redsift-icon-button,
|
|
107
|
+
.redsift-button,
|
|
108
|
+
.redsift-button-link {
|
|
109
|
+
width: unset;
|
|
110
|
+
height: ${$size === PillSize.xlarge ? css`30px` : $size === PillSize.large ? css`24px` : css`22px`};
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
padding: 5px;
|
|
113
|
+
border: none;
|
|
114
|
+
text-transform: none;
|
|
115
|
+
|
|
116
|
+
font-size: ${$size === PillSize.small ? css`14px` : css`15px`};
|
|
117
|
+
|
|
118
|
+
> .redsift-icon:not(.colored) {
|
|
119
|
+
color: inherit;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.redsift-icon-button {
|
|
124
|
+
width: ${$size === PillSize.xlarge ? css`30px` : $size === PillSize.large ? css`24px` : css`22px`};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.redsift-button-link {
|
|
128
|
+
height: ${$size === PillSize.xlarge ? css`18px` : $size === PillSize.large ? css`12px` : css`10px`};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.first.redsift-text,
|
|
132
|
+
.first.redsift-number,
|
|
133
|
+
.middle.redsift-text,
|
|
134
|
+
.middle.redsift-number,
|
|
135
|
+
.last.redsift-text,
|
|
136
|
+
.last.redsift-number {
|
|
137
|
+
padding: 0 8px;
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
140
|
+
}}
|
|
141
|
+
|
|
142
|
+
${_ref3 => {
|
|
143
|
+
let {
|
|
144
|
+
$color,
|
|
145
|
+
$hoverColor,
|
|
146
|
+
$isDisabled,
|
|
147
|
+
$theme
|
|
148
|
+
} = _ref3;
|
|
149
|
+
return isPredefinedColor($color) ? css`
|
|
150
|
+
.first,
|
|
151
|
+
.middle,
|
|
152
|
+
.last {
|
|
153
|
+
background-color: var(
|
|
154
|
+
--redsift-color-${$theme}-components-pills-${$color}-${$isDisabled ? 'disabled' : 'default'}-background
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
& {
|
|
159
|
+
color: var(
|
|
160
|
+
--redsift-color-${$theme}-components-pills-${$color}-${$isDisabled ? 'disabled' : 'default'}-text
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.redsift-icon-button:hover,
|
|
165
|
+
.redsift-button:hover,
|
|
166
|
+
.redsift-button-link:hover {
|
|
167
|
+
background-color: var(
|
|
168
|
+
--redsift-color-${$theme}-components-pills-${$color}-${$isDisabled ? 'disabled' : 'hover'}-background
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
` : css`
|
|
172
|
+
.first,
|
|
173
|
+
.middle,
|
|
174
|
+
.last {
|
|
175
|
+
background-color: ${$color !== null && $color !== void 0 ? $color : RedsiftColorNeutralWhite};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
& {
|
|
179
|
+
color: ${pickTextColorBasedOnBgColorAdvanced($color !== null && $color !== void 0 ? $color : RedsiftColorNeutralWhite, $isDisabled ? RedsiftColorNeutralLightGrey : RedsiftColorNeutralWhite, $isDisabled ? RedsiftColorGreyL1 : RedsiftColorNeutralBlack)};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.redsift-icon-button:hover,
|
|
183
|
+
.redsift-button:hover,
|
|
184
|
+
.redsift-button-link:hover {
|
|
185
|
+
background-color: ${$hoverColor !== null && $hoverColor !== void 0 ? $hoverColor : pickHoverColorBasedOnBgColorAdvanced($color !== null && $color !== void 0 ? $color : RedsiftColorNeutralWhite)};
|
|
186
|
+
}
|
|
187
|
+
`;
|
|
188
|
+
}};
|
|
189
|
+
|
|
190
|
+
${_ref4 => {
|
|
191
|
+
let {
|
|
192
|
+
$color,
|
|
193
|
+
$borderColor,
|
|
194
|
+
$isDisabled,
|
|
195
|
+
$theme
|
|
196
|
+
} = _ref4;
|
|
197
|
+
return css`
|
|
198
|
+
.first:not(.last) {
|
|
199
|
+
border-top-left-radius: 2px;
|
|
200
|
+
border-top-right-radius: 0;
|
|
201
|
+
border-bottom-right-radius: 0;
|
|
202
|
+
border-bottom-left-radius: 2px;
|
|
203
|
+
|
|
204
|
+
${$borderColor ? css`
|
|
205
|
+
border: 1px solid ${$borderColor};
|
|
206
|
+
` : $color === 'white' ? css`
|
|
207
|
+
border: 1px solid
|
|
208
|
+
var(--redsift-color-${$theme}-components-pills-${$color}-${$isDisabled ? 'disabled' : 'default'}-border);
|
|
209
|
+
` : css`
|
|
210
|
+
border: 1px solid transparent;
|
|
211
|
+
border-right: 1px solid white;
|
|
212
|
+
`}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.middle {
|
|
216
|
+
border-top-left-radius: 0;
|
|
217
|
+
border-top-right-radius: 0;
|
|
218
|
+
border-bottom-right-radius: 0;
|
|
219
|
+
border-bottom-left-radius: 0;
|
|
220
|
+
|
|
221
|
+
${$borderColor ? css`
|
|
222
|
+
border: 1px solid ${$borderColor};
|
|
223
|
+
` : $color === 'white' ? css`
|
|
224
|
+
border: 1px solid
|
|
225
|
+
var(--redsift-color-${$theme}-components-pills-${$color}-${$isDisabled ? 'disabled' : 'default'}-border);
|
|
226
|
+
` : css`
|
|
227
|
+
border: 1px solid transparent;
|
|
228
|
+
border-right: 1px solid white;
|
|
229
|
+
`}
|
|
230
|
+
border-left: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.last:not(.first) {
|
|
234
|
+
border-top-left-radius: 0;
|
|
235
|
+
border-top-right-radius: 2px;
|
|
236
|
+
border-bottom-right-radius: 2px;
|
|
237
|
+
border-bottom-left-radius: 0;
|
|
238
|
+
|
|
239
|
+
${$borderColor ? css`
|
|
240
|
+
border: 1px solid ${$borderColor};
|
|
241
|
+
` : $color === 'white' ? css`
|
|
242
|
+
border: 1px solid
|
|
243
|
+
var(--redsift-color-${$theme}-components-pills-${$color}-${$isDisabled ? 'disabled' : 'default'}-border);
|
|
244
|
+
` : css`
|
|
245
|
+
border: 1px solid transparent;
|
|
246
|
+
`}
|
|
247
|
+
border-left: none;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.first.last {
|
|
251
|
+
border-top-left-radius: 2px;
|
|
252
|
+
border-top-right-radius: 2px;
|
|
253
|
+
border-bottom-right-radius: 2px;
|
|
254
|
+
border-bottom-left-radius: 2px;
|
|
255
|
+
|
|
256
|
+
${$borderColor ? css`
|
|
257
|
+
border: 1px solid ${$borderColor};
|
|
258
|
+
` : $color === 'white' ? css`
|
|
259
|
+
border: 1px solid
|
|
260
|
+
var(--redsift-color-${$theme}-components-pills-${$color}-${$isDisabled ? 'disabled' : 'default'}-border);
|
|
261
|
+
` : css`
|
|
262
|
+
border: 1px solid transparent;
|
|
263
|
+
`}
|
|
264
|
+
}
|
|
265
|
+
`;
|
|
266
|
+
}};
|
|
267
|
+
|
|
268
|
+
.redsift-icon {
|
|
269
|
+
font-size: ${_ref5 => {
|
|
270
|
+
let {
|
|
271
|
+
$size
|
|
272
|
+
} = _ref5;
|
|
273
|
+
return $size === PillSize.xlarge ? '15px' : $size === PillSize.large ? '12px' : '12px';
|
|
274
|
+
}};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
&,
|
|
278
|
+
.redsift-text,
|
|
279
|
+
.redsift-number,
|
|
280
|
+
.first,
|
|
281
|
+
.middle,
|
|
282
|
+
.last {
|
|
283
|
+
font-family: var(--redsift-typography-pill-font-family);
|
|
284
|
+
font-size: ${_ref6 => {
|
|
285
|
+
let {
|
|
286
|
+
$size
|
|
287
|
+
} = _ref6;
|
|
288
|
+
return $size === PillSize.xlarge ? '15px' : $size === PillSize.large ? '12px' : '10px';
|
|
289
|
+
}};
|
|
290
|
+
font-weight: var(--redsift-typography-pill-font-weight);
|
|
291
|
+
line-height: ${_ref7 => {
|
|
292
|
+
let {
|
|
293
|
+
$size
|
|
294
|
+
} = _ref7;
|
|
295
|
+
return $size === PillSize.xlarge ? '28px' : $size === PillSize.large ? css`var(--redsift-typography-chip-line-height)` : css`var(--redsift-typography-pill-line-height)`;
|
|
296
|
+
}};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.redsift-icon:not(.colored) {
|
|
300
|
+
color: inherit;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.redsift-icon {
|
|
304
|
+
width: ${_ref8 => {
|
|
305
|
+
let {
|
|
306
|
+
$size
|
|
307
|
+
} = _ref8;
|
|
308
|
+
return $size === PillSize.xlarge ? '17px' : $size === PillSize.large ? '14px' : '12px';
|
|
309
|
+
}};
|
|
310
|
+
height: ${_ref9 => {
|
|
311
|
+
let {
|
|
312
|
+
$size
|
|
313
|
+
} = _ref9;
|
|
314
|
+
return $size === PillSize.xlarge ? '17px' : $size === PillSize.large ? '14px' : '12px';
|
|
315
|
+
}};
|
|
316
|
+
|
|
317
|
+
> svg {
|
|
318
|
+
width: 1em;
|
|
319
|
+
height: 1em;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
`;
|
|
323
|
+
|
|
324
|
+
const _excluded = ["autoBreak", "borderColor", "children", "className", "color", "disabledColor", "hoverColor", "isDisabled", "size", "theme"];
|
|
325
|
+
const COMPONENT_NAME = 'Pill';
|
|
326
|
+
const CLASSNAME = 'redsift-pill';
|
|
3
327
|
|
|
4
328
|
/**
|
|
5
329
|
* The Pill component.
|
|
6
330
|
*/
|
|
7
|
-
|
|
331
|
+
const Pill = /*#__PURE__*/forwardRef((props, ref) => {
|
|
332
|
+
const {
|
|
333
|
+
autoBreak,
|
|
334
|
+
borderColor,
|
|
335
|
+
children,
|
|
336
|
+
className,
|
|
337
|
+
color: propsColor,
|
|
338
|
+
disabledColor,
|
|
339
|
+
hoverColor,
|
|
340
|
+
isDisabled,
|
|
341
|
+
size: propsSize,
|
|
342
|
+
theme: propsTheme
|
|
343
|
+
} = props,
|
|
344
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
345
|
+
const theme = useTheme(propsTheme);
|
|
346
|
+
const color = propsColor || PresentationColorPalette.blue;
|
|
347
|
+
const size = propsSize || PillSize.large;
|
|
348
|
+
const childArray = [];
|
|
349
|
+
React__default.Children.forEach(children, (child, index) => {
|
|
350
|
+
const currentClassName = React__default.Children.count(children) === 1 ? 'first last' : index === 0 ? 'first' : index === React__default.Children.count(children) - 1 ? 'last' : 'middle';
|
|
351
|
+
if (isComponent('MenuButton')(child) || isComponent('Select')(child) || isComponent('Dialog')(child) || isComponent('Popover')(child) || isComponent('Tooltip')(child)) {
|
|
352
|
+
var _child$key;
|
|
353
|
+
childArray.push( /*#__PURE__*/React__default.cloneElement(child, {
|
|
354
|
+
key: (_child$key = child.key) !== null && _child$key !== void 0 ? _child$key : index,
|
|
355
|
+
triggerClassName: currentClassName,
|
|
356
|
+
variant: 'unstyled',
|
|
357
|
+
color: child.props.color ? child.props.color : pickTextColorBasedOnBgColorAdvanced(color, 'white', 'black')
|
|
358
|
+
}));
|
|
359
|
+
} else if (isComponent('IconButton')(child) || isComponent('Button')(child) || isComponent('ButtonLink')(child)) {
|
|
360
|
+
var _key;
|
|
361
|
+
childArray.push( /*#__PURE__*/React__default.cloneElement(child, {
|
|
362
|
+
key: (_key = child.key) !== null && _key !== void 0 ? _key : index,
|
|
363
|
+
className: currentClassName,
|
|
364
|
+
variant: 'unstyled',
|
|
365
|
+
color: child.props.color ? child.props.color : pickTextColorBasedOnBgColorAdvanced(color, 'white', 'black')
|
|
366
|
+
}));
|
|
367
|
+
} else if ( /*#__PURE__*/React__default.isValidElement(child)) {
|
|
368
|
+
var _key2;
|
|
369
|
+
childArray.push( /*#__PURE__*/React__default.cloneElement(child, {
|
|
370
|
+
key: (_key2 = child.key) !== null && _key2 !== void 0 ? _key2 : index,
|
|
371
|
+
className: currentClassName
|
|
372
|
+
}));
|
|
373
|
+
} else if (typeof child === 'string') {
|
|
374
|
+
childArray.push( /*#__PURE__*/React__default.createElement(Text, {
|
|
375
|
+
key: index,
|
|
376
|
+
className: currentClassName
|
|
377
|
+
}, child));
|
|
378
|
+
} else if (typeof child === 'number') {
|
|
379
|
+
childArray.push( /*#__PURE__*/React__default.createElement(Number, {
|
|
380
|
+
key: index,
|
|
381
|
+
className: currentClassName,
|
|
382
|
+
value: child
|
|
383
|
+
}));
|
|
384
|
+
} else {
|
|
385
|
+
childArray.push(child);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
return /*#__PURE__*/React__default.createElement(StyledPill, _extends({}, forwardedProps, {
|
|
389
|
+
$autoBreak: autoBreak,
|
|
390
|
+
$borderColor: borderColor,
|
|
391
|
+
$color: color,
|
|
392
|
+
$disabledColor: disabledColor,
|
|
393
|
+
$hoverColor: hoverColor,
|
|
394
|
+
$isDisabled: isDisabled,
|
|
395
|
+
$size: size,
|
|
396
|
+
$theme: theme,
|
|
397
|
+
className: classNames(Pill.className, className),
|
|
398
|
+
ref: ref
|
|
399
|
+
}), childArray);
|
|
400
|
+
});
|
|
401
|
+
Pill.className = CLASSNAME;
|
|
402
|
+
Pill.displayName = COMPONENT_NAME;
|
|
8
403
|
|
|
9
|
-
export {
|
|
404
|
+
export { PillSize as P, Pill as a };
|
|
405
|
+
//# sourceMappingURL=Pill2.js.map
|
package/_internal/ProgressBar.js
CHANGED
|
@@ -1,26 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
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 styled, { css } from 'styled-components';
|
|
5
|
+
import { u as useTheme } from './useTheme.js';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
|
-
* Component
|
|
8
|
+
* Component style.
|
|
7
9
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
const StyledProgressBar = styled.progress`
|
|
11
|
+
${_ref => {
|
|
12
|
+
let {
|
|
13
|
+
backgroundColor,
|
|
14
|
+
height,
|
|
15
|
+
progressColor,
|
|
16
|
+
width
|
|
17
|
+
} = _ref;
|
|
18
|
+
return css`
|
|
19
|
+
&[value] {
|
|
20
|
+
// Target only state with a value
|
|
21
|
+
-webkit-appearance: none;
|
|
22
|
+
appearance: none;
|
|
23
|
+
height: ${height || '8px'};
|
|
24
|
+
width: ${width || '100%'};
|
|
25
|
+
color: var(--redsift-color-presentation-red-default);
|
|
26
|
+
|
|
27
|
+
&::-webkit-progress-bar {
|
|
28
|
+
background-color: ${backgroundColor || 'var(--redsift-color-neutral-x-light-grey)'};
|
|
29
|
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) inset;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&::-webkit-progress-value {
|
|
33
|
+
background-color: ${progressColor || 'var(--redsift-color-primary-n)'};
|
|
34
|
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) inset;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
}}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const _excluded = ["className", "theme", "value"];
|
|
42
|
+
const COMPONENT_NAME = 'ProgressBar';
|
|
43
|
+
const CLASSNAME = 'redsift-progress-bar';
|
|
20
44
|
|
|
21
45
|
/**
|
|
22
46
|
* The Progress bar component.
|
|
23
47
|
*/
|
|
24
|
-
|
|
48
|
+
const ProgressBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
49
|
+
const {
|
|
50
|
+
className,
|
|
51
|
+
theme: propsTheme,
|
|
52
|
+
value
|
|
53
|
+
} = props,
|
|
54
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
55
|
+
const theme = useTheme(propsTheme);
|
|
56
|
+
return /*#__PURE__*/React__default.createElement(StyledProgressBar, _extends({}, forwardedProps, {
|
|
57
|
+
className: classNames(ProgressBar.className, className),
|
|
58
|
+
ref: ref,
|
|
59
|
+
variant: "determinate",
|
|
60
|
+
max: "100",
|
|
61
|
+
value: value || 0,
|
|
62
|
+
theme: theme
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
ProgressBar.className = CLASSNAME;
|
|
66
|
+
ProgressBar.displayName = COMPONENT_NAME;
|
|
25
67
|
|
|
26
|
-
export {
|
|
68
|
+
export { ProgressBar as P };
|
|
69
|
+
//# sourceMappingURL=ProgressBar.js.map
|