@ultraviolet/ui 1.6.1 → 1.8.0
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/index.d.ts +16 -10
- package/dist/src/components/Banner/assets/default-image-small.svg.js +5 -0
- package/dist/src/components/Banner/assets/default-image.svg.js +5 -0
- package/dist/src/components/Banner/assets/intro-compact-left-pattern.svg.js +5 -0
- package/dist/src/components/Banner/assets/intro-compact-right-pattern.svg.js +5 -0
- package/dist/src/components/Banner/assets/intro-pattern.svg.js +5 -0
- package/dist/src/components/Banner/assets/promotion-compact-left-pattern.svg.js +5 -0
- package/dist/src/components/Banner/assets/promotion-compact-right-pattern.svg.js +5 -0
- package/dist/src/components/Banner/assets/promotion-pattern.svg.js +5 -0
- package/dist/src/components/Banner/index.js +83 -22
- package/dist/src/components/Popover/index.js +11 -7
- package/dist/src/components/Radio/index.js +104 -143
- package/dist/src/components/SelectableCard/index.js +24 -4
- package/dist/src/components/Text/index.js +5 -1
- package/dist/src/components/Tooltip/index.js +17 -259
- package/dist/src/internalComponents/Popup/index.js +278 -0
- package/package.json +3 -3
- /package/dist/src/{components/Tooltip → internalComponents/Popup}/helpers.js +0 -0
|
@@ -1,180 +1,135 @@
|
|
|
1
1
|
import _styled from '@emotion/styled/base';
|
|
2
2
|
import { forwardRef, useId } from 'react';
|
|
3
|
+
import { Stack } from '../Stack/index.js';
|
|
4
|
+
import { Text } from '../Text/index.js';
|
|
3
5
|
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
4
6
|
|
|
7
|
+
const SIZE = 24;
|
|
5
8
|
const InnerCircleRing = /*#__PURE__*/_styled("circle", {
|
|
6
|
-
target: "
|
|
7
|
-
})(
|
|
8
|
-
let {
|
|
9
|
-
theme
|
|
10
|
-
} = _ref;
|
|
11
|
-
return theme.colors.neutral.borderStrong;
|
|
12
|
-
}, ";");
|
|
9
|
+
target: "ehkrmld5"
|
|
10
|
+
})();
|
|
13
11
|
const RadioMark = /*#__PURE__*/_styled("circle", {
|
|
14
|
-
target: "
|
|
12
|
+
target: "ehkrmld4"
|
|
15
13
|
})();
|
|
16
14
|
const RadioMarkedIcon = () => jsxs("g", {
|
|
17
15
|
children: [jsx("circle", {
|
|
18
16
|
cx: "12",
|
|
19
17
|
cy: "12",
|
|
20
|
-
r: "
|
|
18
|
+
r: "10",
|
|
21
19
|
strokeWidth: "2"
|
|
22
20
|
}), jsx(InnerCircleRing, {
|
|
23
21
|
cx: "12",
|
|
24
22
|
cy: "12",
|
|
25
|
-
r: "
|
|
23
|
+
r: "8"
|
|
26
24
|
}), jsx(RadioMark, {
|
|
27
25
|
cx: "12",
|
|
28
26
|
cy: "12",
|
|
29
|
-
r: "
|
|
27
|
+
r: "5"
|
|
30
28
|
})]
|
|
31
29
|
});
|
|
32
|
-
const
|
|
33
|
-
target: "
|
|
34
|
-
})("height:",
|
|
30
|
+
const Ring = /*#__PURE__*/_styled("svg", {
|
|
31
|
+
target: "ehkrmld3"
|
|
32
|
+
})("height:", SIZE, "px;width:", SIZE, "px;min-width:", SIZE, "px;min-height:", SIZE, "px;border-radius:", _ref => {
|
|
35
33
|
let {
|
|
36
|
-
|
|
34
|
+
theme
|
|
35
|
+
} = _ref;
|
|
36
|
+
return theme.radii.circle;
|
|
37
|
+
}, ";fill:", _ref2 => {
|
|
38
|
+
let {
|
|
39
|
+
theme
|
|
37
40
|
} = _ref2;
|
|
38
|
-
return
|
|
39
|
-
}, "
|
|
41
|
+
return theme.colors.neutral.border;
|
|
42
|
+
}, ";", InnerCircleRing, "{fill:", _ref3 => {
|
|
40
43
|
let {
|
|
41
|
-
|
|
44
|
+
theme
|
|
42
45
|
} = _ref3;
|
|
43
|
-
return
|
|
44
|
-
}, "
|
|
46
|
+
return theme.colors.neutral.background;
|
|
47
|
+
}, ";}");
|
|
48
|
+
const RadioInput = /*#__PURE__*/_styled("input", {
|
|
49
|
+
target: "ehkrmld2"
|
|
50
|
+
})("cursor:pointer;position:absolute;height:", SIZE, "px;width:", SIZE, "px;opacity:0;white-space:nowrap;border-width:0;&+", Ring, "{", RadioMark, "{transform-origin:center;transition:200ms transform ease-in-out;transform:scale(0);}}&:checked+svg{", RadioMark, "{transform:scale(1);}}&:checked[aria-disabled='false'][aria-invalid='false']+", Ring, "{fill:", _ref4 => {
|
|
45
51
|
let {
|
|
46
|
-
|
|
52
|
+
theme
|
|
47
53
|
} = _ref4;
|
|
48
|
-
return
|
|
49
|
-
}, "
|
|
54
|
+
return theme.colors.primary.backgroundStrong;
|
|
55
|
+
}, ";}&[aria-invalid='true']:not([aria-disabled='true'])+", Ring, "{fill:", _ref5 => {
|
|
50
56
|
let {
|
|
51
|
-
|
|
57
|
+
theme
|
|
52
58
|
} = _ref5;
|
|
53
|
-
return
|
|
54
|
-
}, "
|
|
59
|
+
return theme.colors.danger.backgroundStrong;
|
|
60
|
+
}, ";}&[aria-disabled='false']:active+", Ring, "{background-color:#5e127e40;fill:", _ref6 => {
|
|
55
61
|
let {
|
|
56
62
|
theme
|
|
57
63
|
} = _ref6;
|
|
58
|
-
return theme.
|
|
59
|
-
}, ";fill:", _ref7 => {
|
|
64
|
+
return theme.colors.primary.backgroundStrong;
|
|
65
|
+
}, ";", InnerCircleRing, "{fill:", _ref7 => {
|
|
60
66
|
let {
|
|
61
67
|
theme
|
|
62
68
|
} = _ref7;
|
|
63
|
-
return theme.colors.
|
|
64
|
-
}, ";",
|
|
69
|
+
return theme.colors.primary.background;
|
|
70
|
+
}, ";}}&[aria-disabled='false']:focus-visible+", Ring, "{outline:-webkit-focus-ring-color auto 1px;}&[aria-invalid='true']:focus+", Ring, "{background-color:#f91b6c40;fill:", _ref8 => {
|
|
65
71
|
let {
|
|
66
72
|
theme
|
|
67
73
|
} = _ref8;
|
|
68
|
-
return theme.colors.
|
|
69
|
-
}, ";
|
|
70
|
-
const RadioInput = /*#__PURE__*/_styled('input', {
|
|
71
|
-
shouldForwardProp: prop => !['size'].includes(prop),
|
|
72
|
-
target: "ehkrmld1"
|
|
73
|
-
})("cursor:pointer;position:absolute;height:", _ref9 => {
|
|
74
|
+
return theme.colors.danger.backgroundStrong;
|
|
75
|
+
}, ";", InnerCircleRing, "{fill:", _ref9 => {
|
|
74
76
|
let {
|
|
75
|
-
|
|
77
|
+
theme
|
|
76
78
|
} = _ref9;
|
|
77
|
-
return
|
|
78
|
-
}, "
|
|
79
|
+
return theme.colors.danger.background;
|
|
80
|
+
}, ";}}");
|
|
81
|
+
const RadioContainer = /*#__PURE__*/_styled("div", {
|
|
82
|
+
target: "ehkrmld1"
|
|
83
|
+
})("position:relative;display:flex;align-items:flex-start;gap:", _ref10 => {
|
|
79
84
|
let {
|
|
80
|
-
|
|
85
|
+
theme
|
|
81
86
|
} = _ref10;
|
|
82
|
-
return
|
|
83
|
-
}, "
|
|
87
|
+
return theme.space['1'];
|
|
88
|
+
}, ";&[aria-disabled='false'],&[aria-disabled='false']>label{cursor:pointer;}&[aria-disabled='true'][data-checked='false']{color:", _ref11 => {
|
|
84
89
|
let {
|
|
85
90
|
theme
|
|
86
91
|
} = _ref11;
|
|
87
|
-
return theme.colors.
|
|
88
|
-
}, ";}
|
|
92
|
+
return theme.colors.neutral.textDisabled;
|
|
93
|
+
}, ";}:hover[aria-disabled='false']{", RadioInput, "+", Ring, "{fill:", _ref12 => {
|
|
89
94
|
let {
|
|
90
95
|
theme
|
|
91
96
|
} = _ref12;
|
|
92
|
-
return theme.colors.
|
|
93
|
-
}, ";
|
|
97
|
+
return theme.colors.primary.border;
|
|
98
|
+
}, ";", InnerCircleRing, "{fill:", _ref13 => {
|
|
94
99
|
let {
|
|
95
100
|
theme
|
|
96
101
|
} = _ref13;
|
|
97
|
-
return theme.colors.primary.
|
|
98
|
-
}, ";fill:", _ref14 => {
|
|
102
|
+
return theme.colors.primary.backgroundHover;
|
|
103
|
+
}, ";}}", RadioInput, "[aria-invalid='true']+", Ring, "{fill:", _ref14 => {
|
|
99
104
|
let {
|
|
100
105
|
theme
|
|
101
106
|
} = _ref14;
|
|
102
|
-
return theme.colors.
|
|
107
|
+
return theme.colors.danger.border;
|
|
103
108
|
}, ";", InnerCircleRing, "{fill:", _ref15 => {
|
|
104
109
|
let {
|
|
105
110
|
theme
|
|
106
111
|
} = _ref15;
|
|
107
|
-
return theme.colors.
|
|
108
|
-
}, ";}}&[aria-
|
|
112
|
+
return theme.colors.danger.backgroundHover;
|
|
113
|
+
}, ";}}}&[aria-disabled='true']{cursor:not-allowed;&>label,", RadioInput, "{cursor:not-allowed;}", Ring, "{fill:", _ref16 => {
|
|
109
114
|
let {
|
|
110
115
|
theme
|
|
111
116
|
} = _ref16;
|
|
112
|
-
return theme.colors.
|
|
113
|
-
}, ";fill:", _ref17 => {
|
|
117
|
+
return theme.colors.neutral.borderDisabled;
|
|
118
|
+
}, ";cursor:not-allowed;", InnerCircleRing, "{fill:", _ref17 => {
|
|
114
119
|
let {
|
|
115
120
|
theme
|
|
116
121
|
} = _ref17;
|
|
117
|
-
return theme.colors.
|
|
118
|
-
}, ";"
|
|
119
|
-
|
|
120
|
-
theme
|
|
121
|
-
} = _ref18;
|
|
122
|
-
return theme.colors.danger.background;
|
|
123
|
-
}, ";}}");
|
|
124
|
-
const RadioContainer = /*#__PURE__*/_styled("div", {
|
|
122
|
+
return theme.colors.neutral.backgroundDisabled;
|
|
123
|
+
}, ";}}}");
|
|
124
|
+
const MargedText = /*#__PURE__*/_styled(Text, {
|
|
125
125
|
target: "ehkrmld0"
|
|
126
|
-
})("
|
|
127
|
-
let {
|
|
128
|
-
theme
|
|
129
|
-
} = _ref19;
|
|
130
|
-
return theme.space['1'];
|
|
131
|
-
}, ";&[aria-disabled='false'],&[aria-disabled='false']>label{cursor:pointer;}:hover[aria-disabled='false']{", RadioInput, "+", StyledIcon, "{background-color:", _ref20 => {
|
|
132
|
-
let {
|
|
133
|
-
theme
|
|
134
|
-
} = _ref20;
|
|
135
|
-
return theme.colors.primary.background;
|
|
136
|
-
}, ";fill:", _ref21 => {
|
|
126
|
+
})("margin-left:", _ref18 => {
|
|
137
127
|
let {
|
|
138
128
|
theme
|
|
139
|
-
} =
|
|
140
|
-
return theme.
|
|
141
|
-
}, ";"
|
|
142
|
-
|
|
143
|
-
theme
|
|
144
|
-
} = _ref22;
|
|
145
|
-
return theme.colors.primary.background;
|
|
146
|
-
}, ";}}", RadioInput, "[aria-invalid='true']+", StyledIcon, "{background-color:", _ref23 => {
|
|
147
|
-
let {
|
|
148
|
-
theme
|
|
149
|
-
} = _ref23;
|
|
150
|
-
return theme.colors.danger.background;
|
|
151
|
-
}, ";fill:", _ref24 => {
|
|
152
|
-
let {
|
|
153
|
-
theme
|
|
154
|
-
} = _ref24;
|
|
155
|
-
return theme.colors.danger.text;
|
|
156
|
-
}, ";", InnerCircleRing, "{fill:", _ref25 => {
|
|
157
|
-
let {
|
|
158
|
-
theme
|
|
159
|
-
} = _ref25;
|
|
160
|
-
return theme.colors.danger.background;
|
|
161
|
-
}, ";}}}&[aria-disabled='true']{cursor:not-allowed;color:", _ref26 => {
|
|
162
|
-
let {
|
|
163
|
-
theme
|
|
164
|
-
} = _ref26;
|
|
165
|
-
return theme.colors.neutral.textDisabled;
|
|
166
|
-
}, ";&>label{cursor:not-allowed;}", StyledIcon, "{fill:", _ref27 => {
|
|
167
|
-
let {
|
|
168
|
-
theme
|
|
169
|
-
} = _ref27;
|
|
170
|
-
return theme.colors.neutral.borderStrongDisabled;
|
|
171
|
-
}, ";", InnerCircleRing, "{fill:", _ref28 => {
|
|
172
|
-
let {
|
|
173
|
-
theme
|
|
174
|
-
} = _ref28;
|
|
175
|
-
return theme.colors.neutral.backgroundDisabled;
|
|
176
|
-
}, ";}}}");
|
|
177
|
-
const Radio = /*#__PURE__*/forwardRef((_ref29, ref) => {
|
|
129
|
+
} = _ref18;
|
|
130
|
+
return theme.space['4'];
|
|
131
|
+
}, ";");
|
|
132
|
+
const Radio = /*#__PURE__*/forwardRef((_ref19, ref) => {
|
|
178
133
|
let {
|
|
179
134
|
checked = false,
|
|
180
135
|
onChange,
|
|
@@ -184,46 +139,52 @@ const Radio = /*#__PURE__*/forwardRef((_ref29, ref) => {
|
|
|
184
139
|
error,
|
|
185
140
|
name,
|
|
186
141
|
value,
|
|
187
|
-
|
|
188
|
-
|
|
142
|
+
label,
|
|
143
|
+
helper,
|
|
189
144
|
className,
|
|
190
145
|
autoFocus,
|
|
191
146
|
onKeyDown,
|
|
192
147
|
'aria-label': ariaLabel,
|
|
193
148
|
'data-testid': dataTestId
|
|
194
|
-
} =
|
|
149
|
+
} = _ref19;
|
|
195
150
|
const id = useId();
|
|
196
151
|
const computedName = name ?? id;
|
|
197
|
-
return jsxs(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
"data-checked": checked,
|
|
201
|
-
"data-error": error,
|
|
202
|
-
"data-testid": dataTestId,
|
|
203
|
-
children: [jsx(RadioInput, {
|
|
204
|
-
type: "radio",
|
|
205
|
-
"aria-invalid": !!error,
|
|
152
|
+
return jsxs(Stack, {
|
|
153
|
+
gap: 0.5,
|
|
154
|
+
children: [jsxs(RadioContainer, {
|
|
206
155
|
"aria-disabled": disabled,
|
|
207
|
-
|
|
208
|
-
checked: checked,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
156
|
+
className: className,
|
|
157
|
+
"data-checked": checked,
|
|
158
|
+
"data-error": error,
|
|
159
|
+
"data-testid": dataTestId,
|
|
160
|
+
children: [jsx(RadioInput, {
|
|
161
|
+
type: "radio",
|
|
162
|
+
"aria-invalid": !!error,
|
|
163
|
+
"aria-disabled": disabled,
|
|
164
|
+
"aria-label": ariaLabel,
|
|
165
|
+
checked: checked,
|
|
166
|
+
id: `${computedName}-${value}`,
|
|
167
|
+
onChange: onChange,
|
|
168
|
+
onFocus: onFocus,
|
|
169
|
+
onKeyDown: onKeyDown,
|
|
170
|
+
onBlur: onBlur,
|
|
171
|
+
value: value,
|
|
172
|
+
disabled: disabled,
|
|
173
|
+
name: computedName,
|
|
174
|
+
autoFocus: autoFocus,
|
|
175
|
+
ref: ref
|
|
176
|
+
}), jsx(Ring, {
|
|
177
|
+
viewBox: "0 0 24 24",
|
|
178
|
+
children: jsx(RadioMarkedIcon, {})
|
|
179
|
+
}), label ? jsx("label", {
|
|
180
|
+
htmlFor: `${computedName}-${value}`,
|
|
181
|
+
children: label
|
|
182
|
+
}) : null]
|
|
183
|
+
}), helper ? jsx(MargedText, {
|
|
184
|
+
as: "p",
|
|
185
|
+
variant: "bodySmall",
|
|
186
|
+
prominence: "weak",
|
|
187
|
+
children: helper
|
|
227
188
|
}) : null]
|
|
228
189
|
});
|
|
229
190
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _styled from '@emotion/styled/base';
|
|
2
|
-
import { forwardRef,
|
|
2
|
+
import { forwardRef, useRef } from 'react';
|
|
3
3
|
import { Checkbox } from '../Checkbox/index.js';
|
|
4
4
|
import { Radio } from '../Radio/index.js';
|
|
5
5
|
import { Tooltip } from '../Tooltip/index.js';
|
|
@@ -68,7 +68,7 @@ const Container = /*#__PURE__*/_styled("div", {
|
|
|
68
68
|
} = _ref12;
|
|
69
69
|
return theme.shadows.hoverPrimary;
|
|
70
70
|
}, ";}}}");
|
|
71
|
-
const StyledElement =
|
|
71
|
+
const StyledElement = /*#__PURE__*/_styled('div', {
|
|
72
72
|
shouldForwardProp: prop => !['showTick', 'hasLabel'].includes(prop),
|
|
73
73
|
target: "e1s5n3hj0"
|
|
74
74
|
})("display:inline-flex;align-items:start;&[data-checked='true']{color:", _ref13 => {
|
|
@@ -98,6 +98,12 @@ const StyledElement = element => /*#__PURE__*/_styled(element, {
|
|
|
98
98
|
} = _ref17;
|
|
99
99
|
return !showTick && !hasLabel ? `display: none;` : null;
|
|
100
100
|
}, ";}");
|
|
101
|
+
const StyledRadio = /*#__PURE__*/StyledElement.withComponent(Radio, {
|
|
102
|
+
target: "e1s5n3hj2"
|
|
103
|
+
});
|
|
104
|
+
const StyledCheckbox = /*#__PURE__*/StyledElement.withComponent(Checkbox, {
|
|
105
|
+
target: "e1s5n3hj3"
|
|
106
|
+
});
|
|
101
107
|
const SelectableCard = /*#__PURE__*/forwardRef((_ref18, ref) => {
|
|
102
108
|
let {
|
|
103
109
|
name,
|
|
@@ -117,7 +123,6 @@ const SelectableCard = /*#__PURE__*/forwardRef((_ref18, ref) => {
|
|
|
117
123
|
label,
|
|
118
124
|
'data-testid': dataTestId
|
|
119
125
|
} = _ref18;
|
|
120
|
-
const Element = useMemo(() => StyledElement(type === 'radio' ? Radio : Checkbox), [type]);
|
|
121
126
|
const innerRef = useRef(null);
|
|
122
127
|
return jsx(Tooltip, {
|
|
123
128
|
text: tooltip,
|
|
@@ -133,7 +138,22 @@ const SelectableCard = /*#__PURE__*/forwardRef((_ref18, ref) => {
|
|
|
133
138
|
"data-error": isError,
|
|
134
139
|
"data-testid": dataTestId,
|
|
135
140
|
ref: ref,
|
|
136
|
-
children: [jsx(
|
|
141
|
+
children: [type === 'radio' ? jsx(StyledRadio, {
|
|
142
|
+
name: name,
|
|
143
|
+
value: value,
|
|
144
|
+
onChange: onChange,
|
|
145
|
+
showTick: showTick,
|
|
146
|
+
checked: checked,
|
|
147
|
+
disabled: disabled,
|
|
148
|
+
error: isError,
|
|
149
|
+
onFocus: onFocus,
|
|
150
|
+
onBlur: onBlur,
|
|
151
|
+
hasLabel: !!label,
|
|
152
|
+
id: id,
|
|
153
|
+
ref: innerRef,
|
|
154
|
+
"data-error": isError,
|
|
155
|
+
label: label
|
|
156
|
+
}) : jsx(StyledCheckbox, {
|
|
137
157
|
name: name,
|
|
138
158
|
value: value,
|
|
139
159
|
onChange: onChange,
|
|
@@ -17,6 +17,7 @@ const PROMINENCES = {
|
|
|
17
17
|
*/
|
|
18
18
|
const generateStyles = _ref => {
|
|
19
19
|
let {
|
|
20
|
+
placement,
|
|
20
21
|
prominence,
|
|
21
22
|
color,
|
|
22
23
|
variant,
|
|
@@ -40,6 +41,7 @@ const generateStyles = _ref => {
|
|
|
40
41
|
line-height: ${theme.typography[variant].lineHeight};
|
|
41
42
|
text-transform: ${theme.typography[variant].textCase};
|
|
42
43
|
text-decoration: ${theme.typography[variant].textDecoration};
|
|
44
|
+
${placement ? ` text-align: ${placement};` : ''}
|
|
43
45
|
|
|
44
46
|
${oneLine ? `white-space: nowrap;
|
|
45
47
|
text-overflow: ellipsis;
|
|
@@ -49,7 +51,7 @@ const generateStyles = _ref => {
|
|
|
49
51
|
`;
|
|
50
52
|
};
|
|
51
53
|
const StyledText = /*#__PURE__*/_styled('div', {
|
|
52
|
-
shouldForwardProp: prop => !['as', 'variant', 'color', 'prominence', 'oneLine', 'disabled', 'italic', 'underline'].includes(prop),
|
|
54
|
+
shouldForwardProp: prop => !['as', 'placement', 'variant', 'color', 'prominence', 'oneLine', 'disabled', 'italic', 'underline'].includes(prop),
|
|
53
55
|
target: "e13y3mga0"
|
|
54
56
|
})(generateStyles);
|
|
55
57
|
const Text = _ref2 => {
|
|
@@ -59,6 +61,7 @@ const Text = _ref2 => {
|
|
|
59
61
|
as,
|
|
60
62
|
color = 'neutral',
|
|
61
63
|
oneLine = false,
|
|
64
|
+
placement,
|
|
62
65
|
prominence = 'default',
|
|
63
66
|
className,
|
|
64
67
|
disabled = false,
|
|
@@ -86,6 +89,7 @@ const Text = _ref2 => {
|
|
|
86
89
|
children: jsx(StyledText, {
|
|
87
90
|
ref: elementRef,
|
|
88
91
|
as: as,
|
|
92
|
+
placement: placement,
|
|
89
93
|
prominence: prominence,
|
|
90
94
|
color: color,
|
|
91
95
|
variant: variant,
|