@guardian/stand 0.0.22 → 0.0.23
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/checkbox.cjs +11 -0
- package/dist/checkbox.js +3 -0
- package/dist/components/checkbox/Checkbox.cjs +54 -0
- package/dist/components/checkbox/Checkbox.js +17 -0
- package/dist/components/checkbox/CheckboxGroup.cjs +35 -0
- package/dist/components/checkbox/CheckboxGroup.js +26 -0
- package/dist/components/checkbox/styles.cjs +109 -0
- package/dist/components/checkbox/styles.js +101 -0
- package/dist/components/form/types.cjs +6 -1
- package/dist/components/form/types.js +7 -2
- package/dist/components/inline-message/InlineMessage.cjs +9 -1
- package/dist/components/inline-message/InlineMessage.js +2 -2
- package/dist/components/inline-message/styles.cjs +6 -0
- package/dist/components/inline-message/styles.js +6 -1
- package/dist/components/radio-group/RadioGroup.cjs +65 -0
- package/dist/components/radio-group/RadioGroup.js +31 -0
- package/dist/components/radio-group/styles.cjs +78 -0
- package/dist/components/radio-group/styles.js +73 -0
- package/dist/fonts/MaterialSymbolsOutlined.css +1 -1
- package/dist/fonts/MaterialSymbolsRound.css +1 -1
- package/dist/fonts/MaterialSymbolsSharp.css +1 -1
- package/dist/fonts/material-symbols-types.ts +34 -3
- package/dist/index.cjs +4 -0
- package/dist/index.js +2 -0
- package/dist/radio-group.cjs +10 -0
- package/dist/radio-group.js +2 -0
- package/dist/styleD/build/css/base/typography.css +1 -1
- package/dist/styleD/build/css/component/checkbox.css +57 -0
- package/dist/styleD/build/css/component/inlineMessage.css +1 -0
- package/dist/styleD/build/css/component/radioGroup.css +52 -0
- package/dist/styleD/build/css/semantic/colors.css +3 -1
- package/dist/styleD/build/css/semantic/sizing.css +1 -0
- package/dist/styleD/build/typescript/base/typography.cjs +3 -3
- package/dist/styleD/build/typescript/base/typography.js +3 -3
- package/dist/styleD/build/typescript/component/checkbox.cjs +100 -0
- package/dist/styleD/build/typescript/component/checkbox.js +98 -0
- package/dist/styleD/build/typescript/component/inlineMessage.cjs +2 -1
- package/dist/styleD/build/typescript/component/inlineMessage.js +2 -1
- package/dist/styleD/build/typescript/component/radioGroup.cjs +85 -0
- package/dist/styleD/build/typescript/component/radioGroup.js +83 -0
- package/dist/styleD/build/typescript/semantic/colors.cjs +3 -1
- package/dist/styleD/build/typescript/semantic/colors.js +3 -1
- package/dist/styleD/build/typescript/semantic/sizing.cjs +1 -0
- package/dist/styleD/build/typescript/semantic/sizing.js +1 -0
- package/dist/types/checkbox.d.ts +21 -0
- package/dist/types/components/checkbox/Checkbox.d.ts +2 -0
- package/dist/types/components/checkbox/CheckboxGroup.d.ts +2 -0
- package/dist/types/components/checkbox/CheckboxGroupSandbox.d.ts +5 -0
- package/dist/types/components/checkbox/CheckboxSandbox.d.ts +5 -0
- package/dist/types/components/checkbox/styles.d.ts +10 -0
- package/dist/types/components/checkbox/types.d.ts +11 -0
- package/dist/types/components/form/types.d.ts +1 -1
- package/dist/types/components/inline-message/styles.d.ts +1 -0
- package/dist/types/components/radio-group/RadioGroup.d.ts +3 -0
- package/dist/types/components/radio-group/sandbox.d.ts +5 -0
- package/dist/types/components/radio-group/styles.d.ts +9 -0
- package/dist/types/components/radio-group/types.d.ts +10 -0
- package/dist/types/fonts/material-symbols-types.d.ts +33 -2
- package/dist/types/index.d.ts +4 -0
- package/dist/types/radio-group.d.ts +20 -0
- package/dist/types/styleD/build/typescript/base/typography.d.ts +3 -3
- package/dist/types/styleD/build/typescript/component/checkbox.d.ts +100 -0
- package/dist/types/styleD/build/typescript/component/inlineMessage.d.ts +1 -0
- package/dist/types/styleD/build/typescript/component/radioGroup.d.ts +85 -0
- package/dist/types/styleD/build/typescript/semantic/colors.d.ts +2 -0
- package/dist/types/styleD/build/typescript/semantic/sizing.d.ts +1 -0
- package/package.json +29 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Checkbox = require('./components/checkbox/Checkbox.cjs');
|
|
4
|
+
var CheckboxGroup = require('./components/checkbox/CheckboxGroup.cjs');
|
|
5
|
+
var checkbox = require('./styleD/build/typescript/component/checkbox.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.Checkbox = Checkbox.Checkbox;
|
|
10
|
+
exports.CheckboxGroup = CheckboxGroup.CheckboxGroup;
|
|
11
|
+
exports.componentCheckbox = checkbox.componentCheckbox;
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
4
|
+
var reactAriaComponents = require('react-aria-components');
|
|
5
|
+
var mergeDeep = require('../../util/mergeDeep.cjs');
|
|
6
|
+
var styles = require('./styles.cjs');
|
|
7
|
+
|
|
8
|
+
function Checkbox({
|
|
9
|
+
children,
|
|
10
|
+
size = "md",
|
|
11
|
+
isIndeterminate = false,
|
|
12
|
+
theme = {},
|
|
13
|
+
cssOverrides,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
const mergedTheme = mergeDeep.mergeDeep(styles.defaultCheckboxTheme, theme);
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18
|
+
reactAriaComponents.Checkbox,
|
|
19
|
+
{
|
|
20
|
+
css: [
|
|
21
|
+
styles.checkboxStyles(mergedTheme, {
|
|
22
|
+
size,
|
|
23
|
+
isIndeterminate
|
|
24
|
+
}),
|
|
25
|
+
cssOverrides
|
|
26
|
+
],
|
|
27
|
+
...props,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "checkbox-indicator", children: isIndeterminate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
+
"svg",
|
|
31
|
+
{
|
|
32
|
+
viewBox: "0 0 12 2",
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2H0V0H12V2Z" })
|
|
36
|
+
},
|
|
37
|
+
"indeterminate"
|
|
38
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
+
"svg",
|
|
40
|
+
{
|
|
41
|
+
viewBox: "0 0 20 20",
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7.32923 13.2291L3.85423 9.75414L2.6709 10.9291L7.32923 15.5875L17.3292 5.58748L16.1542 4.41248L7.32923 13.2291Z" })
|
|
45
|
+
},
|
|
46
|
+
"check"
|
|
47
|
+
) }) }),
|
|
48
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { css: styles.checkboxLabelStyles(mergedTheme), children })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
exports.Checkbox = Checkbox;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { Checkbox as Checkbox$1 } from 'react-aria-components';
|
|
3
|
+
import { mergeDeep } from '../../util/mergeDeep.js';
|
|
4
|
+
import { checkboxLabelStyles, checkboxStyles, defaultCheckboxTheme } from './styles.js';
|
|
5
|
+
|
|
6
|
+
function Checkbox({ children, size = "md", isIndeterminate = false, theme = {}, cssOverrides, ...props }) {
|
|
7
|
+
const mergedTheme = mergeDeep(defaultCheckboxTheme, theme);
|
|
8
|
+
return jsxs(Checkbox$1, { css: [
|
|
9
|
+
checkboxStyles(mergedTheme, {
|
|
10
|
+
size,
|
|
11
|
+
isIndeterminate
|
|
12
|
+
}),
|
|
13
|
+
cssOverrides
|
|
14
|
+
], ...props, children: [jsx(Fragment, { children: jsx("div", { className: "checkbox-indicator", children: isIndeterminate ? jsx("svg", { viewBox: "0 0 12 2", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 2H0V0H12V2Z" }) }, "indeterminate") : jsx("svg", { viewBox: "0 0 20 20", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M7.32923 13.2291L3.85423 9.75414L2.6709 10.9291L7.32923 15.5875L17.3292 5.58748L16.1542 4.41248L7.32923 13.2291Z" }) }, "check") }) }), jsx("span", { css: checkboxLabelStyles(mergedTheme), children })] });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Checkbox };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var reactAriaComponents = require('react-aria-components');
|
|
6
|
+
var mergeDeep = require('../../util/mergeDeep.cjs');
|
|
7
|
+
var Form = require('../form/Form.cjs');
|
|
8
|
+
var Checkbox = require('./Checkbox.cjs');
|
|
9
|
+
var styles = require('./styles.cjs');
|
|
10
|
+
|
|
11
|
+
function CheckboxGroup({
|
|
12
|
+
size = "md",
|
|
13
|
+
theme = {},
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
const mergedTheme = mergeDeep.mergeDeep(styles.defaultCheckboxTheme, {
|
|
17
|
+
group: theme
|
|
18
|
+
});
|
|
19
|
+
const checkboxes = [];
|
|
20
|
+
React.Children.forEach(props.children, (child, index) => {
|
|
21
|
+
if (!React.isValidElement(child) || child.type !== Checkbox.Checkbox) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
checkboxes.push(
|
|
25
|
+
React.cloneElement(child, {
|
|
26
|
+
key: child.key ?? index,
|
|
27
|
+
// ensure key is set for each child
|
|
28
|
+
size
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Form.FormInputContainer, { as: reactAriaComponents.CheckboxGroup, size, ...props, children: /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.checkboxGroupStyles(mergedTheme, { size }, props.isInvalid), children: checkboxes }) });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
exports.CheckboxGroup = CheckboxGroup;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CheckboxGroup as CheckboxGroup$1 } from 'react-aria-components';
|
|
4
|
+
import { mergeDeep } from '../../util/mergeDeep.js';
|
|
5
|
+
import { FormInputContainer } from '../form/Form.js';
|
|
6
|
+
import { Checkbox } from './Checkbox.js';
|
|
7
|
+
import { checkboxGroupStyles, defaultCheckboxTheme } from './styles.js';
|
|
8
|
+
|
|
9
|
+
function CheckboxGroup({ size = "md", theme = {}, ...props }) {
|
|
10
|
+
const mergedTheme = mergeDeep(defaultCheckboxTheme, {
|
|
11
|
+
group: theme
|
|
12
|
+
});
|
|
13
|
+
const checkboxes = [];
|
|
14
|
+
React.Children.forEach(props.children, (child, index) => {
|
|
15
|
+
if (!React.isValidElement(child) || child.type !== Checkbox) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
checkboxes.push(React.cloneElement(child, {
|
|
19
|
+
key: child.key ?? index,
|
|
20
|
+
size
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
return jsx(FormInputContainer, { as: CheckboxGroup$1, size, ...props, children: jsx("div", { css: checkboxGroupStyles(mergedTheme, { size }, props.isInvalid), children: checkboxes }) });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { CheckboxGroup };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('@emotion/react');
|
|
4
|
+
var checkbox = require('../../styleD/build/typescript/component/checkbox.cjs');
|
|
5
|
+
var typography = require('../../styleD/utils/semantic/typography.cjs');
|
|
6
|
+
|
|
7
|
+
const defaultCheckboxTheme = checkbox.componentCheckbox;
|
|
8
|
+
const checkboxStyles = (theme, {
|
|
9
|
+
size,
|
|
10
|
+
isIndeterminate
|
|
11
|
+
}) => {
|
|
12
|
+
return react.css`
|
|
13
|
+
display: ${theme.input.shared.display};
|
|
14
|
+
position: ${theme.input.shared.position};
|
|
15
|
+
align-items: ${theme.input.shared["align-items"]};
|
|
16
|
+
gap: ${theme.input.shared.gap};
|
|
17
|
+
cursor: ${theme.input.shared.cursor};
|
|
18
|
+
${typography.convertTypographyToEmotionStringStyle(theme.input[size].typography)}
|
|
19
|
+
color: ${theme.input.shared.color};
|
|
20
|
+
|
|
21
|
+
.checkbox-indicator {
|
|
22
|
+
width: ${theme.input[size].indicator.size};
|
|
23
|
+
height: ${theme.input[size].indicator.size};
|
|
24
|
+
border: ${theme.input.shared.indicator.border};
|
|
25
|
+
border-radius: ${theme.input.shared.indicator["border-radius"]};
|
|
26
|
+
display: ${theme.input.shared.indicator.display};
|
|
27
|
+
align-items: ${theme.input.shared.indicator["align-items"]};
|
|
28
|
+
justify-content: ${theme.input.shared.indicator["justify-content"]};
|
|
29
|
+
flex-shrink: ${theme.input.shared.indicator["flex-shrink"]};
|
|
30
|
+
transition: ${theme.input.shared.indicator.transition};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
svg {
|
|
34
|
+
width: ${isIndeterminate ? theme.input.shared.indicator.indeterminate.width : theme.input.shared.indicator.check.width};
|
|
35
|
+
height: ${isIndeterminate ? theme.input.shared.indicator.indeterminate.height : theme.input.shared.indicator.check.height};
|
|
36
|
+
fill: ${theme.input.shared.indicator.svg.fill};
|
|
37
|
+
transition: ${theme.input.shared.indicator.transition};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&[data-focus-visible] {
|
|
41
|
+
.checkbox-indicator {
|
|
42
|
+
outline: ${theme.input.shared.indicator[":focus-visible"].outline};
|
|
43
|
+
outline-offset: ${theme.input.shared.indicator[":focus-visible"]["outline-offset"]};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&[data-selected],
|
|
48
|
+
&[data-indeterminate] {
|
|
49
|
+
.checkbox-indicator {
|
|
50
|
+
border: ${theme.input.shared.indicator.selected.border};
|
|
51
|
+
background-color: ${theme.input.shared.indicator.selected["background-color"]};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
& svg {
|
|
55
|
+
fill: ${theme.input.shared.indicator.selected.svg.fill};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-disabled] {
|
|
60
|
+
color: ${theme.input.shared.disabled.color};
|
|
61
|
+
cursor: ${theme.input.shared.disabled.cursor};
|
|
62
|
+
|
|
63
|
+
.checkbox-indicator {
|
|
64
|
+
border: ${theme.input.shared.disabled.indicator.border};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&[data-selected],
|
|
68
|
+
&[data-indeterminate] {
|
|
69
|
+
.checkbox-indicator {
|
|
70
|
+
background-color: ${theme.input.shared.disabled.indicator.selected["background-color"]};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&[data-invalid] {
|
|
76
|
+
.checkbox-indicator {
|
|
77
|
+
border: ${theme.input.shared.indicator.error.border};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&[data-invalid][data-selected],
|
|
82
|
+
&[data-invalid][data-indeterminate] {
|
|
83
|
+
.checkbox-indicator {
|
|
84
|
+
background-color: ${theme.input.shared.indicator.error["background-color"]};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
};
|
|
89
|
+
const checkboxLabelStyles = (theme) => {
|
|
90
|
+
return react.css`
|
|
91
|
+
align-self: ${theme.input.shared.label["align-self"]};
|
|
92
|
+
`;
|
|
93
|
+
};
|
|
94
|
+
const checkboxGroupStyles = (theme, { size }, hasError) => {
|
|
95
|
+
return react.css`
|
|
96
|
+
display: ${theme.group.shared.display};
|
|
97
|
+
flex-direction: ${theme.group.shared["flex-direction"]};
|
|
98
|
+
gap: ${theme.group[size].gap};
|
|
99
|
+
margin-top: ${theme.group[size]["margin-top"]};
|
|
100
|
+
${hasError && react.css`
|
|
101
|
+
margin-bottom: ${theme.group[size]["margin-bottom"]};
|
|
102
|
+
`}
|
|
103
|
+
`;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
exports.checkboxGroupStyles = checkboxGroupStyles;
|
|
107
|
+
exports.checkboxLabelStyles = checkboxLabelStyles;
|
|
108
|
+
exports.checkboxStyles = checkboxStyles;
|
|
109
|
+
exports.defaultCheckboxTheme = defaultCheckboxTheme;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { componentCheckbox } from '../../styleD/build/typescript/component/checkbox.js';
|
|
3
|
+
import { convertTypographyToEmotionStringStyle } from '../../styleD/utils/semantic/typography.js';
|
|
4
|
+
|
|
5
|
+
const defaultCheckboxTheme = componentCheckbox;
|
|
6
|
+
const checkboxStyles = (theme, { size, isIndeterminate }) => {
|
|
7
|
+
return css`
|
|
8
|
+
display: ${theme.input.shared.display};
|
|
9
|
+
position: ${theme.input.shared.position};
|
|
10
|
+
align-items: ${theme.input.shared["align-items"]};
|
|
11
|
+
gap: ${theme.input.shared.gap};
|
|
12
|
+
cursor: ${theme.input.shared.cursor};
|
|
13
|
+
${convertTypographyToEmotionStringStyle(theme.input[size].typography)}
|
|
14
|
+
color: ${theme.input.shared.color};
|
|
15
|
+
|
|
16
|
+
.checkbox-indicator {
|
|
17
|
+
width: ${theme.input[size].indicator.size};
|
|
18
|
+
height: ${theme.input[size].indicator.size};
|
|
19
|
+
border: ${theme.input.shared.indicator.border};
|
|
20
|
+
border-radius: ${theme.input.shared.indicator["border-radius"]};
|
|
21
|
+
display: ${theme.input.shared.indicator.display};
|
|
22
|
+
align-items: ${theme.input.shared.indicator["align-items"]};
|
|
23
|
+
justify-content: ${theme.input.shared.indicator["justify-content"]};
|
|
24
|
+
flex-shrink: ${theme.input.shared.indicator["flex-shrink"]};
|
|
25
|
+
transition: ${theme.input.shared.indicator.transition};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
svg {
|
|
29
|
+
width: ${isIndeterminate ? theme.input.shared.indicator.indeterminate.width : theme.input.shared.indicator.check.width};
|
|
30
|
+
height: ${isIndeterminate ? theme.input.shared.indicator.indeterminate.height : theme.input.shared.indicator.check.height};
|
|
31
|
+
fill: ${theme.input.shared.indicator.svg.fill};
|
|
32
|
+
transition: ${theme.input.shared.indicator.transition};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&[data-focus-visible] {
|
|
36
|
+
.checkbox-indicator {
|
|
37
|
+
outline: ${theme.input.shared.indicator[":focus-visible"].outline};
|
|
38
|
+
outline-offset: ${theme.input.shared.indicator[":focus-visible"]["outline-offset"]};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&[data-selected],
|
|
43
|
+
&[data-indeterminate] {
|
|
44
|
+
.checkbox-indicator {
|
|
45
|
+
border: ${theme.input.shared.indicator.selected.border};
|
|
46
|
+
background-color: ${theme.input.shared.indicator.selected["background-color"]};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
& svg {
|
|
50
|
+
fill: ${theme.input.shared.indicator.selected.svg.fill};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&[data-disabled] {
|
|
55
|
+
color: ${theme.input.shared.disabled.color};
|
|
56
|
+
cursor: ${theme.input.shared.disabled.cursor};
|
|
57
|
+
|
|
58
|
+
.checkbox-indicator {
|
|
59
|
+
border: ${theme.input.shared.disabled.indicator.border};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&[data-selected],
|
|
63
|
+
&[data-indeterminate] {
|
|
64
|
+
.checkbox-indicator {
|
|
65
|
+
background-color: ${theme.input.shared.disabled.indicator.selected["background-color"]};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&[data-invalid] {
|
|
71
|
+
.checkbox-indicator {
|
|
72
|
+
border: ${theme.input.shared.indicator.error.border};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&[data-invalid][data-selected],
|
|
77
|
+
&[data-invalid][data-indeterminate] {
|
|
78
|
+
.checkbox-indicator {
|
|
79
|
+
background-color: ${theme.input.shared.indicator.error["background-color"]};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
};
|
|
84
|
+
const checkboxLabelStyles = (theme) => {
|
|
85
|
+
return css`
|
|
86
|
+
align-self: ${theme.input.shared.label["align-self"]};
|
|
87
|
+
`;
|
|
88
|
+
};
|
|
89
|
+
const checkboxGroupStyles = (theme, { size }, hasError) => {
|
|
90
|
+
return css`
|
|
91
|
+
display: ${theme.group.shared.display};
|
|
92
|
+
flex-direction: ${theme.group.shared["flex-direction"]};
|
|
93
|
+
gap: ${theme.group[size].gap};
|
|
94
|
+
margin-top: ${theme.group[size]["margin-top"]};
|
|
95
|
+
${hasError && css`
|
|
96
|
+
margin-bottom: ${theme.group[size]["margin-bottom"]};
|
|
97
|
+
`}
|
|
98
|
+
`;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export { checkboxGroupStyles, checkboxLabelStyles, checkboxStyles, defaultCheckboxTheme };
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var reactAriaComponents = require('react-aria-components');
|
|
4
4
|
|
|
5
|
-
const ALLOWED_FORM_CONTAINERS = [
|
|
5
|
+
const ALLOWED_FORM_CONTAINERS = [
|
|
6
|
+
reactAriaComponents.TextField,
|
|
7
|
+
reactAriaComponents.Select,
|
|
8
|
+
reactAriaComponents.RadioGroup,
|
|
9
|
+
reactAriaComponents.CheckboxGroup
|
|
10
|
+
];
|
|
6
11
|
|
|
7
12
|
exports.ALLOWED_FORM_CONTAINERS = ALLOWED_FORM_CONTAINERS;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { TextField, Select } from 'react-aria-components';
|
|
1
|
+
import { TextField, Select, RadioGroup, CheckboxGroup } from 'react-aria-components';
|
|
2
2
|
|
|
3
|
-
const ALLOWED_FORM_CONTAINERS = [
|
|
3
|
+
const ALLOWED_FORM_CONTAINERS = [
|
|
4
|
+
TextField,
|
|
5
|
+
Select,
|
|
6
|
+
RadioGroup,
|
|
7
|
+
CheckboxGroup
|
|
8
|
+
];
|
|
4
9
|
|
|
5
10
|
export { ALLOWED_FORM_CONTAINERS };
|
|
@@ -39,7 +39,15 @@ function InlineMessage({
|
|
|
39
39
|
className,
|
|
40
40
|
...props,
|
|
41
41
|
children: [
|
|
42
|
-
!hideIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
!hideIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
43
|
+
Icon.Icon,
|
|
44
|
+
{
|
|
45
|
+
fill: mergedTheme[level].color,
|
|
46
|
+
cssOverrides: styles.inlineMessageIconStyles(mergedTheme),
|
|
47
|
+
size: "md",
|
|
48
|
+
children: determinedIcon
|
|
49
|
+
}
|
|
50
|
+
),
|
|
43
51
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
44
52
|
Typography.Typography,
|
|
45
53
|
{
|
|
@@ -3,7 +3,7 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { mergeDeep } from '../../util/mergeDeep.js';
|
|
4
4
|
import { Icon } from '../icon/Icon.js';
|
|
5
5
|
import { Typography } from '../typography/Typography.js';
|
|
6
|
-
import { inlineMessageStyles, defaultInlineMessageTheme } from './styles.js';
|
|
6
|
+
import { inlineMessageIconStyles, inlineMessageStyles, defaultInlineMessageTheme } from './styles.js';
|
|
7
7
|
|
|
8
8
|
function InlineMessage({ children, level, hideIcon = false, icon, theme = {}, cssOverrides, className, ...props }) {
|
|
9
9
|
const mergedTheme = mergeDeep(defaultInlineMessageTheme, theme);
|
|
@@ -21,7 +21,7 @@ function InlineMessage({ children, level, hideIcon = false, icon, theme = {}, cs
|
|
|
21
21
|
return "info";
|
|
22
22
|
}
|
|
23
23
|
}, [icon, level]);
|
|
24
|
-
return jsxs("div", { css: [inlineMessageStyles(mergedTheme, { level }), cssOverrides], className, ...props, children: [!hideIcon && jsx(Icon, { fill: mergedTheme[level].color, size: "md", children: determinedIcon }), jsx(Typography, { variant: "help-text-form-md", theme: { color: mergedTheme[level].color }, children })] });
|
|
24
|
+
return jsxs("div", { css: [inlineMessageStyles(mergedTheme, { level }), cssOverrides], className, ...props, children: [!hideIcon && jsx(Icon, { fill: mergedTheme[level].color, cssOverrides: inlineMessageIconStyles(mergedTheme), size: "md", children: determinedIcon }), jsx(Typography, { variant: "help-text-form-md", theme: { color: mergedTheme[level].color }, children })] });
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export { InlineMessage };
|
|
@@ -12,6 +12,12 @@ const inlineMessageStyles = (theme, { level }) => {
|
|
|
12
12
|
color: ${theme[level].color};
|
|
13
13
|
`;
|
|
14
14
|
};
|
|
15
|
+
const inlineMessageIconStyles = (theme) => {
|
|
16
|
+
return react.css`
|
|
17
|
+
align-self: ${theme.shared.icon["align-self"]};
|
|
18
|
+
`;
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
exports.defaultInlineMessageTheme = defaultInlineMessageTheme;
|
|
22
|
+
exports.inlineMessageIconStyles = inlineMessageIconStyles;
|
|
17
23
|
exports.inlineMessageStyles = inlineMessageStyles;
|
|
@@ -10,5 +10,10 @@ const inlineMessageStyles = (theme, { level }) => {
|
|
|
10
10
|
color: ${theme[level].color};
|
|
11
11
|
`;
|
|
12
12
|
};
|
|
13
|
+
const inlineMessageIconStyles = (theme) => {
|
|
14
|
+
return css`
|
|
15
|
+
align-self: ${theme.shared.icon["align-self"]};
|
|
16
|
+
`;
|
|
17
|
+
};
|
|
13
18
|
|
|
14
|
-
export { defaultInlineMessageTheme, inlineMessageStyles };
|
|
19
|
+
export { defaultInlineMessageTheme, inlineMessageIconStyles, inlineMessageStyles };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var reactAriaComponents = require('react-aria-components');
|
|
6
|
+
var mergeDeep = require('../../util/mergeDeep.cjs');
|
|
7
|
+
var Form = require('../form/Form.cjs');
|
|
8
|
+
var styles = require('./styles.cjs');
|
|
9
|
+
|
|
10
|
+
function RadioGroup({
|
|
11
|
+
size = "md",
|
|
12
|
+
isInvalid = false,
|
|
13
|
+
theme = {},
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const mergedTheme = mergeDeep.mergeDeep(styles.defaultRadioGroupTheme, theme);
|
|
18
|
+
const radios = [];
|
|
19
|
+
React.Children.forEach(children, (child) => {
|
|
20
|
+
if (!React.isValidElement(child) || child.type !== Radio) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
radios.push(
|
|
24
|
+
React.cloneElement(child, {
|
|
25
|
+
theme,
|
|
26
|
+
size,
|
|
27
|
+
isInvalid
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
Form.FormInputContainer,
|
|
33
|
+
{
|
|
34
|
+
as: reactAriaComponents.RadioGroup,
|
|
35
|
+
size,
|
|
36
|
+
isInvalid,
|
|
37
|
+
...props,
|
|
38
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.radioGroupStyles(mergedTheme, { size }), children: radios })
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function Radio({
|
|
43
|
+
theme = {},
|
|
44
|
+
size = "md",
|
|
45
|
+
children,
|
|
46
|
+
isInvalid = false,
|
|
47
|
+
...props
|
|
48
|
+
}) {
|
|
49
|
+
const mergedTheme = mergeDeep.mergeDeep(styles.defaultRadioGroupTheme, theme);
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Radio, { ...props, css: styles.radioStyles(mergedTheme, { size, isInvalid }), children: reactAriaComponents.composeRenderProps(children, (children2) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
css: styles.radioIndicatorStyles(mergedTheme, {
|
|
55
|
+
size,
|
|
56
|
+
isInvalid
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
children2
|
|
61
|
+
] })) });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports.Radio = Radio;
|
|
65
|
+
exports.RadioGroup = RadioGroup;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Radio as Radio$1, composeRenderProps, RadioGroup as RadioGroup$1 } from 'react-aria-components';
|
|
4
|
+
import { mergeDeep } from '../../util/mergeDeep.js';
|
|
5
|
+
import { FormInputContainer } from '../form/Form.js';
|
|
6
|
+
import { radioIndicatorStyles, radioStyles, radioGroupStyles, defaultRadioGroupTheme } from './styles.js';
|
|
7
|
+
|
|
8
|
+
function RadioGroup({ size = "md", isInvalid = false, theme = {}, children, ...props }) {
|
|
9
|
+
const mergedTheme = mergeDeep(defaultRadioGroupTheme, theme);
|
|
10
|
+
const radios = [];
|
|
11
|
+
React.Children.forEach(children, (child) => {
|
|
12
|
+
if (!React.isValidElement(child) || child.type !== Radio) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
radios.push(React.cloneElement(child, {
|
|
16
|
+
theme,
|
|
17
|
+
size,
|
|
18
|
+
isInvalid
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
return jsx(FormInputContainer, { as: RadioGroup$1, size, isInvalid, ...props, children: jsx("div", { css: radioGroupStyles(mergedTheme, { size }), children: radios }) });
|
|
22
|
+
}
|
|
23
|
+
function Radio({ theme = {}, size = "md", children, isInvalid = false, ...props }) {
|
|
24
|
+
const mergedTheme = mergeDeep(defaultRadioGroupTheme, theme);
|
|
25
|
+
return jsx(Radio$1, { ...props, css: radioStyles(mergedTheme, { size, isInvalid }), children: composeRenderProps(children, (children2) => jsxs(Fragment, { children: [jsx("div", { css: radioIndicatorStyles(mergedTheme, {
|
|
26
|
+
size,
|
|
27
|
+
isInvalid
|
|
28
|
+
}) }), children2] })) });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Radio, RadioGroup };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('@emotion/react');
|
|
4
|
+
var radioGroup = require('../../styleD/build/typescript/component/radioGroup.cjs');
|
|
5
|
+
var typography = require('../../styleD/utils/semantic/typography.cjs');
|
|
6
|
+
|
|
7
|
+
const defaultRadioGroupTheme = radioGroup.componentRadioGroup;
|
|
8
|
+
const radioGroupStyles = (theme, { size }) => {
|
|
9
|
+
return react.css`
|
|
10
|
+
display: ${theme.shared.display};
|
|
11
|
+
flex-direction: ${theme.shared.flexDirection};
|
|
12
|
+
gap: ${theme[size].gap};
|
|
13
|
+
margin-top: ${theme.shared.marginTop};
|
|
14
|
+
margin-bottom: ${theme.shared.marginBottom};
|
|
15
|
+
`;
|
|
16
|
+
};
|
|
17
|
+
const radioStyles = (theme, { size, isInvalid }) => {
|
|
18
|
+
return react.css`
|
|
19
|
+
display: ${theme.shared.radio.display};
|
|
20
|
+
align-items: ${theme.shared.radio.alignItems};
|
|
21
|
+
gap: ${theme.shared.radio.gap};
|
|
22
|
+
${typography.convertTypographyToEmotionStringStyle(theme[size].typography)}
|
|
23
|
+
color: ${theme.shared.radio.color};
|
|
24
|
+
|
|
25
|
+
&[data-disabled] {
|
|
26
|
+
color: ${theme.shared.radio.disabled.color};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&[data-disabled] :first-of-type {
|
|
30
|
+
border: ${theme.shared.indicator.disabled.border};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&[data-disabled]&[data-selected] :first-of-type {
|
|
34
|
+
border: ${theme.shared.indicator.selected.disabled.border};
|
|
35
|
+
|
|
36
|
+
::after {
|
|
37
|
+
background-color: ${theme.shared.indicator.selected.disabled.after.backgroundColor};
|
|
38
|
+
scale: ${theme.shared.indicator.selected.after.scale};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&[data-focus-visible] :first-of-type {
|
|
43
|
+
outline: ${theme.shared.indicator.focused.outline};
|
|
44
|
+
outline-offset: ${theme.shared.indicator.focused.outlineOffset};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&[data-selected] :first-of-type {
|
|
48
|
+
border: ${isInvalid ? theme.shared.indicator.selected.invalid.border : theme.shared.indicator.selected.border};
|
|
49
|
+
|
|
50
|
+
::after {
|
|
51
|
+
background-color: ${isInvalid ? theme.shared.indicator.invalid.after.backgroundColor : theme.shared.indicator.selected.after.backgroundColor};
|
|
52
|
+
scale: ${theme.shared.indicator.selected.after.scale};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
};
|
|
57
|
+
const radioIndicatorStyles = (theme, { size, isInvalid }) => {
|
|
58
|
+
return react.css`
|
|
59
|
+
position: ${theme.shared.indicator.position};
|
|
60
|
+
width: ${theme[size].indicator.width};
|
|
61
|
+
height: ${theme[size].indicator.height};
|
|
62
|
+
border-radius: ${theme.shared.indicator.borderRadius};
|
|
63
|
+
border: ${isInvalid ? theme.shared.indicator.invalid.border : theme.shared.indicator.border};
|
|
64
|
+
|
|
65
|
+
&::after {
|
|
66
|
+
content: '';
|
|
67
|
+
position: ${theme.shared.indicator.after.position};
|
|
68
|
+
border-radius: ${theme.shared.indicator.after.borderRadius};
|
|
69
|
+
inset: ${theme.shared.indicator.after.inset};
|
|
70
|
+
scale: ${theme.shared.indicator.after.scale};
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports.defaultRadioGroupTheme = defaultRadioGroupTheme;
|
|
76
|
+
exports.radioGroupStyles = radioGroupStyles;
|
|
77
|
+
exports.radioIndicatorStyles = radioIndicatorStyles;
|
|
78
|
+
exports.radioStyles = radioStyles;
|