@ultraviolet/ui 1.10.0 → 1.11.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 +56 -12
- package/dist/src/components/Button/index.js +2 -0
- package/dist/src/components/CheckboxGroup/index.js +129 -0
- package/dist/src/components/Modal/Disclosure.js +2 -1
- package/dist/src/components/Modal/Modal.js +6 -2
- package/dist/src/components/Toggle/index.js +4 -2
- package/dist/src/components/ToggleGroup/index.js +121 -0
- package/dist/src/components/Tooltip/index.js +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/internalComponents/Popup/index.js +8 -6
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1408,6 +1408,10 @@ type ModalState = {
|
|
|
1408
1408
|
toggle: () => void;
|
|
1409
1409
|
visible: boolean;
|
|
1410
1410
|
modalId: string;
|
|
1411
|
+
/**
|
|
1412
|
+
* @deprecated use onClose
|
|
1413
|
+
*/
|
|
1414
|
+
hide: () => void;
|
|
1411
1415
|
};
|
|
1412
1416
|
|
|
1413
1417
|
type ModalProps = {
|
|
@@ -1449,6 +1453,25 @@ type NoticeProps = {
|
|
|
1449
1453
|
};
|
|
1450
1454
|
declare const Notice: ({ children, className, "data-testid": dataTestId, }: NoticeProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1451
1455
|
|
|
1456
|
+
type CheckboxGroupCheckboxProps = Omit<ComponentProps<typeof Checkbox>, 'onChange' | 'checked' | 'required'> & {
|
|
1457
|
+
value: string;
|
|
1458
|
+
};
|
|
1459
|
+
declare const CheckboxGroupCheckbox: ({ onFocus, onBlur, disabled, error, name, value, children, helper, className, autoFocus, "data-testid": dataTestId, }: CheckboxGroupCheckboxProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1460
|
+
type CheckboxGroupProps = {
|
|
1461
|
+
legend: string;
|
|
1462
|
+
value?: string[];
|
|
1463
|
+
className?: string;
|
|
1464
|
+
helper?: ReactNode;
|
|
1465
|
+
error?: ReactNode;
|
|
1466
|
+
direction?: 'row' | 'column';
|
|
1467
|
+
children: ReactNode;
|
|
1468
|
+
required?: boolean;
|
|
1469
|
+
} & Required<Pick<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'name'>> & Pick<InputHTMLAttributes<HTMLInputElement>, 'required'>;
|
|
1470
|
+
declare const CheckboxGroup: {
|
|
1471
|
+
({ legend, value, className, helper, error, direction, children, onChange, name, required, }: CheckboxGroupProps): _emotion_react_jsx_runtime.JSX.Element;
|
|
1472
|
+
Checkbox: ({ onFocus, onBlur, disabled, error, name, value, children, helper, className, autoFocus, "data-testid": dataTestId, }: CheckboxGroupCheckboxProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1473
|
+
};
|
|
1474
|
+
|
|
1452
1475
|
declare const containerSizes: {
|
|
1453
1476
|
large: number;
|
|
1454
1477
|
medium: number;
|
|
@@ -1617,6 +1640,10 @@ type TooltipProps$1 = {
|
|
|
1617
1640
|
*/
|
|
1618
1641
|
text?: ReactNode;
|
|
1619
1642
|
className?: string;
|
|
1643
|
+
/**
|
|
1644
|
+
* It will add `width: 100%` to the tooltip container.
|
|
1645
|
+
*/
|
|
1646
|
+
containerFullWidth?: boolean;
|
|
1620
1647
|
/**
|
|
1621
1648
|
* It will force display tooltip. This can be useful if you need to always display the tooltip without hover needed.
|
|
1622
1649
|
*/
|
|
@@ -2277,27 +2304,44 @@ type ToastContainerProps = {
|
|
|
2277
2304
|
};
|
|
2278
2305
|
declare const ToastContainer: ({ newestOnTop, limit, position, "data-testid": dataTestId, }: ToastContainerProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2279
2306
|
|
|
2280
|
-
|
|
2281
|
-
id?: string;
|
|
2282
|
-
checked?: boolean;
|
|
2307
|
+
declare const Toggle: react.ForwardRefExoticComponent<{
|
|
2308
|
+
id?: string | undefined;
|
|
2309
|
+
checked?: boolean | undefined;
|
|
2283
2310
|
name: string;
|
|
2284
|
-
tooltip?: string;
|
|
2311
|
+
tooltip?: string | undefined;
|
|
2285
2312
|
/**
|
|
2286
2313
|
* If `onChange` is given component will work as a controlled component if not it will work as an uncontrolled component.
|
|
2287
2314
|
*/
|
|
2288
|
-
onChange?: ChangeEventHandler<HTMLInputElement
|
|
2289
|
-
size?:
|
|
2290
|
-
labelPosition?:
|
|
2315
|
+
onChange?: ChangeEventHandler<HTMLInputElement> | undefined;
|
|
2316
|
+
size?: "large" | "small" | undefined;
|
|
2317
|
+
labelPosition?: "left" | "right" | undefined;
|
|
2291
2318
|
label?: ReactNode;
|
|
2292
2319
|
helper?: ReactNode;
|
|
2293
|
-
disabled?: boolean;
|
|
2320
|
+
disabled?: boolean | undefined;
|
|
2321
|
+
className?: string | undefined;
|
|
2322
|
+
required?: boolean | undefined;
|
|
2323
|
+
'data-testid'?: string | undefined;
|
|
2324
|
+
} & Pick<InputHTMLAttributes<HTMLInputElement>, "value"> & react.RefAttributes<HTMLInputElement>>;
|
|
2325
|
+
|
|
2326
|
+
type ToggleGroupToggleProps = Omit<ComponentProps<typeof Toggle>, 'onChange' | 'checked' | 'required'> & {
|
|
2327
|
+
value: string;
|
|
2328
|
+
};
|
|
2329
|
+
type ToggleGroupProps = {
|
|
2330
|
+
legend: string;
|
|
2331
|
+
value?: string[];
|
|
2294
2332
|
className?: string;
|
|
2333
|
+
helper?: ReactNode;
|
|
2334
|
+
error?: ReactNode;
|
|
2335
|
+
direction?: 'row' | 'column';
|
|
2336
|
+
children: ReactNode;
|
|
2295
2337
|
required?: boolean;
|
|
2296
|
-
|
|
2338
|
+
} & Required<Pick<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'name'>> & Pick<InputHTMLAttributes<HTMLInputElement>, 'required'>;
|
|
2339
|
+
declare const ToggleGroup: {
|
|
2340
|
+
({ legend, value, className, helper, error, direction, children, onChange, name, required, }: ToggleGroupProps): _emotion_react_jsx_runtime.JSX.Element;
|
|
2341
|
+
Toggle: ({ disabled, name, value, label, helper, className, "data-testid": dataTestId, }: ToggleGroupToggleProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2297
2342
|
};
|
|
2298
|
-
declare const Toggle: react.ForwardRefExoticComponent<ToggleProps & react.RefAttributes<HTMLInputElement>>;
|
|
2299
2343
|
|
|
2300
|
-
type TooltipProps = Pick<ComponentProps<typeof Popup>, 'id' | 'children' | 'maxWidth' | 'placement' | 'text' | 'className' | 'visible' | 'innerRef' | 'role' | 'data-testid'>;
|
|
2344
|
+
type TooltipProps = Pick<ComponentProps<typeof Popup>, 'id' | 'children' | 'maxWidth' | 'placement' | 'text' | 'className' | 'visible' | 'innerRef' | 'role' | 'data-testid' | 'containerFullWidth'>;
|
|
2301
2345
|
declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
|
|
2302
2346
|
|
|
2303
2347
|
type VerificationCodeProps = {
|
|
@@ -2388,4 +2432,4 @@ declare const down: (size: ScreenSize, rules: string) => string;
|
|
|
2388
2432
|
|
|
2389
2433
|
declare const normalize: () => string;
|
|
2390
2434
|
|
|
2391
|
-
export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CopyButton, DateInput, EmptyState, Expandable, LineChart, Link, List, Loader, Menu, Meter, Modal, Notice, NumberInput, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, ProgressBar, Radio, RadioGroup, Row, SCWUITheme, SelectInput, SelectableCard, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextInput, TimeInput, ToastContainer, Toggle, Tooltip, VerificationCode, bounce, down, extendTheme, fadeIn, fadeOut, flash, getUUID, normalize, ping, pulse, quickScaleDown, scaleBack, scaleDown, scaleForward, scaleUp, sketchIn, sketchOut, slideDownLarge, slideFromBottom, slideFromLeft, slideFromRight, slideFromTop, slideToBottom, slideToLeft, slideToRight, slideToTop, slideUpLarge, toast, unfoldIn, unfoldOut, up, zoomIn, zoomOut };
|
|
2435
|
+
export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CheckboxGroup, CheckboxGroupCheckbox, CopyButton, DateInput, EmptyState, Expandable, LineChart, Link, List, Loader, Menu, Meter, Modal, Notice, NumberInput, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, ProgressBar, Radio, RadioGroup, Row, type SCWUITheme, SelectInput, SelectableCard, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextInput, TimeInput, ToastContainer, Toggle, ToggleGroup, Tooltip, VerificationCode, bounce, down, extendTheme, fadeIn, fadeOut, flash, getUUID, normalize, ping, pulse, quickScaleDown, scaleBack, scaleDown, scaleForward, scaleUp, sketchIn, sketchOut, slideDownLarge, slideFromBottom, slideFromLeft, slideFromRight, slideFromTop, slideToBottom, slideToLeft, slideToRight, slideToTop, slideUpLarge, toast, unfoldIn, unfoldOut, up, zoomIn, zoomOut };
|
|
@@ -260,6 +260,7 @@ const Button = /*#__PURE__*/forwardRef((_ref10, ref) => {
|
|
|
260
260
|
const Component = VARIANTS_COMPONENTS[variant].link;
|
|
261
261
|
return jsx(Tooltip, {
|
|
262
262
|
text: tooltip,
|
|
263
|
+
containerFullWidth: fullWidth,
|
|
263
264
|
children: jsx(Component, {
|
|
264
265
|
role: role,
|
|
265
266
|
className: className,
|
|
@@ -289,6 +290,7 @@ const Button = /*#__PURE__*/forwardRef((_ref10, ref) => {
|
|
|
289
290
|
const Component = VARIANTS_COMPONENTS[variant].button;
|
|
290
291
|
return jsx(Tooltip, {
|
|
291
292
|
text: tooltip,
|
|
293
|
+
containerFullWidth: fullWidth,
|
|
292
294
|
children: jsx(Component, {
|
|
293
295
|
role: role,
|
|
294
296
|
className: className,
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { Icon } from '@ultraviolet/icons';
|
|
3
|
+
import { useContext, useMemo, createContext } from 'react';
|
|
4
|
+
import { Checkbox } from '../Checkbox/index.js';
|
|
5
|
+
import { Stack } from '../Stack/index.js';
|
|
6
|
+
import { Text } from '../Text/index.js';
|
|
7
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10
|
+
const CheckboxGroupContext = /*#__PURE__*/createContext(undefined);
|
|
11
|
+
const CheckboxGroupCheckbox = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
onFocus,
|
|
14
|
+
onBlur,
|
|
15
|
+
disabled,
|
|
16
|
+
error,
|
|
17
|
+
name,
|
|
18
|
+
value,
|
|
19
|
+
children,
|
|
20
|
+
helper,
|
|
21
|
+
className,
|
|
22
|
+
autoFocus,
|
|
23
|
+
'data-testid': dataTestId
|
|
24
|
+
} = _ref;
|
|
25
|
+
const context = useContext(CheckboxGroupContext);
|
|
26
|
+
if (!context) {
|
|
27
|
+
throw new Error('CheckboxGroup.Checkbox can only be used inside a CheckboxGroup');
|
|
28
|
+
}
|
|
29
|
+
const {
|
|
30
|
+
groupName,
|
|
31
|
+
onChange,
|
|
32
|
+
groupValues
|
|
33
|
+
} = context;
|
|
34
|
+
const checkboxName = `${groupName}.${name ?? ''}`;
|
|
35
|
+
const checkboxValue = `${value}`;
|
|
36
|
+
return jsx(Checkbox, {
|
|
37
|
+
onChange: onChange,
|
|
38
|
+
checked: groupValues?.includes(checkboxValue),
|
|
39
|
+
onFocus: onFocus,
|
|
40
|
+
onBlur: onBlur,
|
|
41
|
+
disabled: disabled,
|
|
42
|
+
error: error,
|
|
43
|
+
name: checkboxName,
|
|
44
|
+
value: checkboxValue,
|
|
45
|
+
helper: helper,
|
|
46
|
+
className: className,
|
|
47
|
+
autoFocus: autoFocus,
|
|
48
|
+
"data-testid": dataTestId,
|
|
49
|
+
children: children
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const FieldSet = /*#__PURE__*/_styled("fieldset", {
|
|
53
|
+
target: "e1k5uyng1"
|
|
54
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
55
|
+
name: "7o2an9",
|
|
56
|
+
styles: "border:none;padding:0;margin:0"
|
|
57
|
+
} : {
|
|
58
|
+
name: "7o2an9",
|
|
59
|
+
styles: "border:none;padding:0;margin:0",
|
|
60
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
61
|
+
});
|
|
62
|
+
const StyledRequiredIcon = /*#__PURE__*/_styled(Icon, {
|
|
63
|
+
target: "e1k5uyng0"
|
|
64
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
65
|
+
name: "1nglpc5",
|
|
66
|
+
styles: "vertical-align:super"
|
|
67
|
+
} : {
|
|
68
|
+
name: "1nglpc5",
|
|
69
|
+
styles: "vertical-align:super",
|
|
70
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
71
|
+
});
|
|
72
|
+
const CheckboxGroup = _ref2 => {
|
|
73
|
+
let {
|
|
74
|
+
legend,
|
|
75
|
+
value,
|
|
76
|
+
className,
|
|
77
|
+
helper,
|
|
78
|
+
error,
|
|
79
|
+
direction = 'column',
|
|
80
|
+
children,
|
|
81
|
+
onChange,
|
|
82
|
+
name,
|
|
83
|
+
required = false
|
|
84
|
+
} = _ref2;
|
|
85
|
+
const contextValue = useMemo(() => ({
|
|
86
|
+
groupName: name,
|
|
87
|
+
groupValues: value ?? [],
|
|
88
|
+
onChange
|
|
89
|
+
}), [name, value, onChange]);
|
|
90
|
+
return jsx(CheckboxGroupContext.Provider, {
|
|
91
|
+
value: contextValue,
|
|
92
|
+
children: jsxs(Stack, {
|
|
93
|
+
gap: 1,
|
|
94
|
+
children: [jsx(FieldSet, {
|
|
95
|
+
className: className,
|
|
96
|
+
children: jsxs(Stack, {
|
|
97
|
+
gap: 1.5,
|
|
98
|
+
children: [jsxs(Text, {
|
|
99
|
+
as: "legend",
|
|
100
|
+
variant: "bodyStrong",
|
|
101
|
+
children: [legend, "\xA0", required ? jsx(StyledRequiredIcon, {
|
|
102
|
+
name: "asterisk",
|
|
103
|
+
color: "danger",
|
|
104
|
+
size: 8
|
|
105
|
+
}) : null]
|
|
106
|
+
}), jsx(Stack, {
|
|
107
|
+
gap: direction === 'column' ? 1 : 2,
|
|
108
|
+
direction: direction,
|
|
109
|
+
children: children
|
|
110
|
+
})]
|
|
111
|
+
})
|
|
112
|
+
}), helper ? jsx(Text, {
|
|
113
|
+
as: "p",
|
|
114
|
+
variant: "bodySmall",
|
|
115
|
+
prominence: "weak",
|
|
116
|
+
children: helper
|
|
117
|
+
}) : null, error ? jsx(Text, {
|
|
118
|
+
as: "p",
|
|
119
|
+
variant: "bodySmall",
|
|
120
|
+
sentiment: "danger",
|
|
121
|
+
prominence: "weak",
|
|
122
|
+
children: error
|
|
123
|
+
}) : null]
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
CheckboxGroup.Checkbox = CheckboxGroupCheckbox;
|
|
128
|
+
|
|
129
|
+
export { CheckboxGroup, CheckboxGroupCheckbox };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _styled from '@emotion/styled/base';
|
|
2
|
-
import { useState, useId, useCallback } from 'react';
|
|
2
|
+
import { useState, useId, useCallback, useEffect } from 'react';
|
|
3
3
|
import { Button } from '../Button/index.js';
|
|
4
4
|
import { Dialog } from './Dialog.js';
|
|
5
5
|
import { Disclosure } from './Disclosure.js';
|
|
@@ -61,6 +61,9 @@ const Modal = _ref3 => {
|
|
|
61
61
|
}, []);
|
|
62
62
|
const finalId = id ?? controlId;
|
|
63
63
|
const finalSize = size ?? width;
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
setVisible(opened);
|
|
66
|
+
}, [opened]);
|
|
64
67
|
return jsxs(Fragment, {
|
|
65
68
|
children: [jsx(Disclosure, {
|
|
66
69
|
id: finalId,
|
|
@@ -90,7 +93,8 @@ const Modal = _ref3 => {
|
|
|
90
93
|
onClose: handleClose,
|
|
91
94
|
onOpen: handleOpen,
|
|
92
95
|
toggle: handleToggle,
|
|
93
|
-
modalId: finalId
|
|
96
|
+
modalId: finalId,
|
|
97
|
+
hide: handleClose
|
|
94
98
|
}) : children, jsx(StyledContainer, {
|
|
95
99
|
children: isClosable ? jsx(Button, {
|
|
96
100
|
"data-testid": dataTestId ? `${dataTestId}-close-button` : undefined,
|
|
@@ -167,7 +167,8 @@ const Toggle = /*#__PURE__*/forwardRef((_ref23, ref) => {
|
|
|
167
167
|
helper,
|
|
168
168
|
required,
|
|
169
169
|
className,
|
|
170
|
-
'data-testid': dataTestId
|
|
170
|
+
'data-testid': dataTestId,
|
|
171
|
+
value
|
|
171
172
|
} = _ref23;
|
|
172
173
|
const [state, setState] = useState(checked);
|
|
173
174
|
const uniqueId = useId();
|
|
@@ -212,7 +213,8 @@ const Toggle = /*#__PURE__*/forwardRef((_ref23, ref) => {
|
|
|
212
213
|
name: name,
|
|
213
214
|
onChange: onLocalChange,
|
|
214
215
|
type: "checkbox",
|
|
215
|
-
ref: ref
|
|
216
|
+
ref: ref,
|
|
217
|
+
value: value
|
|
216
218
|
})
|
|
217
219
|
})]
|
|
218
220
|
})
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { Icon } from '@ultraviolet/icons';
|
|
3
|
+
import { useMemo, createContext, useContext } from 'react';
|
|
4
|
+
import { Stack } from '../Stack/index.js';
|
|
5
|
+
import { Text } from '../Text/index.js';
|
|
6
|
+
import { Toggle } from '../Toggle/index.js';
|
|
7
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10
|
+
const ToggleGroupContext = /*#__PURE__*/createContext(undefined);
|
|
11
|
+
const ToggleGroupToggle = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
disabled,
|
|
14
|
+
name,
|
|
15
|
+
value,
|
|
16
|
+
label,
|
|
17
|
+
helper,
|
|
18
|
+
className,
|
|
19
|
+
'data-testid': dataTestId
|
|
20
|
+
} = _ref;
|
|
21
|
+
const context = useContext(ToggleGroupContext);
|
|
22
|
+
if (!context) {
|
|
23
|
+
throw new Error('ToggleGroup.Toggle can only be used inside a ToggleGroup');
|
|
24
|
+
}
|
|
25
|
+
const {
|
|
26
|
+
groupName,
|
|
27
|
+
onChange,
|
|
28
|
+
groupValues
|
|
29
|
+
} = context;
|
|
30
|
+
const ToggleName = `${groupName}.${name}`;
|
|
31
|
+
const ToggleValue = `${value}`;
|
|
32
|
+
return jsx(Toggle, {
|
|
33
|
+
onChange: onChange,
|
|
34
|
+
checked: groupValues?.includes(ToggleValue),
|
|
35
|
+
disabled: disabled,
|
|
36
|
+
name: ToggleName,
|
|
37
|
+
value: ToggleValue,
|
|
38
|
+
helper: helper,
|
|
39
|
+
className: className,
|
|
40
|
+
"data-testid": dataTestId,
|
|
41
|
+
label: label
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const FieldSet = /*#__PURE__*/_styled("fieldset", {
|
|
45
|
+
target: "e1qvneex1"
|
|
46
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
47
|
+
name: "7o2an9",
|
|
48
|
+
styles: "border:none;padding:0;margin:0"
|
|
49
|
+
} : {
|
|
50
|
+
name: "7o2an9",
|
|
51
|
+
styles: "border:none;padding:0;margin:0",
|
|
52
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
53
|
+
});
|
|
54
|
+
const StyledRequiredIcon = /*#__PURE__*/_styled(Icon, {
|
|
55
|
+
target: "e1qvneex0"
|
|
56
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
57
|
+
name: "1nglpc5",
|
|
58
|
+
styles: "vertical-align:super"
|
|
59
|
+
} : {
|
|
60
|
+
name: "1nglpc5",
|
|
61
|
+
styles: "vertical-align:super",
|
|
62
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
63
|
+
});
|
|
64
|
+
const ToggleGroup = _ref2 => {
|
|
65
|
+
let {
|
|
66
|
+
legend,
|
|
67
|
+
value,
|
|
68
|
+
className,
|
|
69
|
+
helper,
|
|
70
|
+
error,
|
|
71
|
+
direction = 'column',
|
|
72
|
+
children,
|
|
73
|
+
onChange,
|
|
74
|
+
name,
|
|
75
|
+
required = false
|
|
76
|
+
} = _ref2;
|
|
77
|
+
const contextValue = useMemo(() => ({
|
|
78
|
+
groupName: name,
|
|
79
|
+
groupValues: value ?? [],
|
|
80
|
+
onChange
|
|
81
|
+
}), [name, value, onChange]);
|
|
82
|
+
return jsx(ToggleGroupContext.Provider, {
|
|
83
|
+
value: contextValue,
|
|
84
|
+
children: jsxs(Stack, {
|
|
85
|
+
gap: 1,
|
|
86
|
+
children: [jsx(FieldSet, {
|
|
87
|
+
className: className,
|
|
88
|
+
children: jsxs(Stack, {
|
|
89
|
+
gap: 1.5,
|
|
90
|
+
children: [jsxs(Text, {
|
|
91
|
+
as: "legend",
|
|
92
|
+
variant: "bodyStrong",
|
|
93
|
+
children: [legend, "\xA0", required ? jsx(StyledRequiredIcon, {
|
|
94
|
+
name: "asterisk",
|
|
95
|
+
color: "danger",
|
|
96
|
+
size: 8
|
|
97
|
+
}) : null]
|
|
98
|
+
}), jsx(Stack, {
|
|
99
|
+
gap: 2,
|
|
100
|
+
direction: direction,
|
|
101
|
+
children: children
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
}), helper ? jsx(Text, {
|
|
105
|
+
as: "p",
|
|
106
|
+
variant: "bodySmall",
|
|
107
|
+
prominence: "weak",
|
|
108
|
+
children: helper
|
|
109
|
+
}) : null, error ? jsx(Text, {
|
|
110
|
+
as: "p",
|
|
111
|
+
variant: "bodySmall",
|
|
112
|
+
sentiment: "danger",
|
|
113
|
+
prominence: "weak",
|
|
114
|
+
children: error
|
|
115
|
+
}) : null]
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
ToggleGroup.Toggle = ToggleGroupToggle;
|
|
120
|
+
|
|
121
|
+
export { ToggleGroup, ToggleGroupToggle };
|
|
@@ -9,6 +9,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref, tooltipRef) => {
|
|
|
9
9
|
placement = 'auto',
|
|
10
10
|
id,
|
|
11
11
|
className,
|
|
12
|
+
containerFullWidth,
|
|
12
13
|
maxWidth = 232,
|
|
13
14
|
visible,
|
|
14
15
|
innerRef,
|
|
@@ -21,6 +22,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref, tooltipRef) => {
|
|
|
21
22
|
role: role,
|
|
22
23
|
"data-testid": dataTestId,
|
|
23
24
|
className: className,
|
|
25
|
+
containerFullWidth: containerFullWidth,
|
|
24
26
|
maxWidth: maxWidth,
|
|
25
27
|
visible: visible,
|
|
26
28
|
placement: placement,
|
package/dist/src/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { Menu } from './components/Menu/index.js';
|
|
|
30
30
|
export { Meter } from './components/Meter/Meter.js';
|
|
31
31
|
export { Modal } from './components/Modal/Modal.js';
|
|
32
32
|
export { Notice } from './components/Notice/index.js';
|
|
33
|
+
export { CheckboxGroup, CheckboxGroupCheckbox } from './components/CheckboxGroup/index.js';
|
|
33
34
|
export { NumberInput } from './components/NumberInput/index.js';
|
|
34
35
|
export { Pagination } from './components/Pagination/index.js';
|
|
35
36
|
export { PasswordCheck } from './components/PasswordCheck/index.js';
|
|
@@ -59,6 +60,7 @@ export { TextInput } from './components/TextInput/index.js';
|
|
|
59
60
|
export { TimeInput } from './components/TimeInput/index.js';
|
|
60
61
|
export { ToastContainer, toast } from './components/Toaster/index.js';
|
|
61
62
|
export { Toggle } from './components/Toggle/index.js';
|
|
63
|
+
export { ToggleGroup } from './components/ToggleGroup/index.js';
|
|
62
64
|
export { Tooltip } from './components/Tooltip/index.js';
|
|
63
65
|
export { VerificationCode } from './components/VerificationCode/index.js';
|
|
64
66
|
export { RadioGroup } from './components/RadioGroup/index.js';
|
|
@@ -57,7 +57,7 @@ const StyledTooltip = /*#__PURE__*/_styled('div', {
|
|
|
57
57
|
maxWidth
|
|
58
58
|
} = _ref5;
|
|
59
59
|
return maxWidth;
|
|
60
|
-
}, "px;font-size:0.8rem;inset:0 auto auto 0;top:0;left:0;transform:", _ref6 => {
|
|
60
|
+
}, "px;word-break:break-all;font-size:0.8rem;inset:0 auto auto 0;top:0;left:0;transform:", _ref6 => {
|
|
61
61
|
let {
|
|
62
62
|
positions
|
|
63
63
|
} = _ref6;
|
|
@@ -97,11 +97,11 @@ const StyledTooltip = /*#__PURE__*/_styled('div', {
|
|
|
97
97
|
const StyledChildrenContainer = /*#__PURE__*/_styled("div", {
|
|
98
98
|
target: "efkq4700"
|
|
99
99
|
})(process.env.NODE_ENV === "production" ? {
|
|
100
|
-
name: "
|
|
101
|
-
styles: "display:inherit"
|
|
100
|
+
name: "jhu4ja",
|
|
101
|
+
styles: "display:inherit;&[data-container-full-width='true']{width:100%;}"
|
|
102
102
|
} : {
|
|
103
|
-
name: "
|
|
104
|
-
styles: "display:inherit",
|
|
103
|
+
name: "jhu4ja",
|
|
104
|
+
styles: "display:inherit;&[data-container-full-width='true']{width:100%;}",
|
|
105
105
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
106
106
|
});
|
|
107
107
|
const Popup = /*#__PURE__*/forwardRef((_ref13, tooltipRef) => {
|
|
@@ -111,6 +111,7 @@ const Popup = /*#__PURE__*/forwardRef((_ref13, tooltipRef) => {
|
|
|
111
111
|
placement = 'auto',
|
|
112
112
|
id,
|
|
113
113
|
className,
|
|
114
|
+
containerFullWidth,
|
|
114
115
|
maxWidth = 232,
|
|
115
116
|
visible,
|
|
116
117
|
innerRef,
|
|
@@ -250,9 +251,10 @@ const Popup = /*#__PURE__*/forwardRef((_ref13, tooltipRef) => {
|
|
|
250
251
|
ref: childrenRef,
|
|
251
252
|
tabIndex: 0,
|
|
252
253
|
onKeyDown: onKeyDown,
|
|
254
|
+
"data-container-full-width": containerFullWidth,
|
|
253
255
|
children: children
|
|
254
256
|
});
|
|
255
|
-
}, [children, generatedId, isControlled, onKeyDown, onPointerEvent]);
|
|
257
|
+
}, [children, containerFullWidth, generatedId, isControlled, onKeyDown, onPointerEvent]);
|
|
256
258
|
if (!text) {
|
|
257
259
|
if (typeof children === 'function') return null;
|
|
258
260
|
return jsx(Fragment, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Ultraviolet UI",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@emotion/babel-plugin": "11.11.0",
|
|
44
44
|
"@emotion/react": "11.11.1",
|
|
45
45
|
"@emotion/styled": "11.11.0",
|
|
46
|
-
"@types/react": "18.2.
|
|
46
|
+
"@types/react": "18.2.14",
|
|
47
47
|
"@types/react-datepicker": "4.15.0",
|
|
48
|
-
"@types/react-dom": "18.2.
|
|
48
|
+
"@types/react-dom": "18.2.6",
|
|
49
49
|
"react": "18.2.0",
|
|
50
50
|
"react-dom": "18.2.0"
|
|
51
51
|
},
|