@guardian/stand 0.0.47 → 0.0.49
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/components/Form/Form.cjs +2 -2
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/styles.cjs +4 -1
- package/dist/components/Form/styles.js +4 -1
- package/dist/components/Form/types.d.cts +4 -0
- package/dist/components/Form/types.d.ts +4 -0
- package/dist/components/Select/Select.cjs +19 -6
- package/dist/components/Select/Select.d.cts +3 -1
- package/dist/components/Select/Select.d.ts +3 -1
- package/dist/components/Select/Select.js +19 -6
- package/dist/components/Select/styles.cjs +3 -2
- package/dist/components/Select/styles.js +3 -2
- package/dist/components/Select/types.d.cts +1 -1
- package/dist/components/Select/types.d.ts +1 -1
- package/dist/styleD/build/css/component/form.css +1 -0
- package/dist/styleD/build/css/component/intendedAudienceSignifier.css +0 -2
- package/dist/styleD/build/css/component/select.css +2 -0
- package/dist/styleD/build/css/semantic/colors.css +4 -0
- package/dist/styleD/build/css/semantic/sizing.css +1 -0
- package/dist/styleD/build/typescript/component/form.cjs +2 -1
- package/dist/styleD/build/typescript/component/form.d.cts +1 -0
- package/dist/styleD/build/typescript/component/form.d.ts +1 -0
- package/dist/styleD/build/typescript/component/form.js +2 -1
- package/dist/styleD/build/typescript/component/select.cjs +2 -0
- package/dist/styleD/build/typescript/component/select.d.cts +2 -0
- package/dist/styleD/build/typescript/component/select.d.ts +2 -0
- package/dist/styleD/build/typescript/component/select.js +2 -0
- package/dist/styleD/build/typescript/semantic/colors.cjs +5 -1
- package/dist/styleD/build/typescript/semantic/colors.d.cts +4 -0
- package/dist/styleD/build/typescript/semantic/colors.d.ts +4 -0
- package/dist/styleD/build/typescript/semantic/colors.js +5 -1
- package/dist/styleD/build/typescript/semantic/sizing.cjs +2 -1
- package/dist/styleD/build/typescript/semantic/sizing.d.cts +3 -0
- package/dist/styleD/build/typescript/semantic/sizing.d.ts +3 -0
- package/dist/styleD/build/typescript/semantic/sizing.js +2 -1
- package/package.json +1 -1
|
@@ -5,11 +5,11 @@ const require_types = require("./types.cjs");
|
|
|
5
5
|
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
6
6
|
let react_aria_components = require("react-aria-components");
|
|
7
7
|
//#region src/components/Form/Form.tsx
|
|
8
|
-
function FormInputContainer({ as: Component, size = "md", label, renderLabel, description, error, isDisabled = false, theme = {}, formInputContainerTheme, cssOverrides, children, ...props }) {
|
|
8
|
+
function FormInputContainer({ as: Component, size = "md", fluid = false, label, renderLabel, description, error, isDisabled = false, theme = {}, formInputContainerTheme, cssOverrides, children, ...props }) {
|
|
9
9
|
if (!require_types.ALLOWED_FORM_CONTAINERS.includes(Component)) return null;
|
|
10
10
|
const mergedTheme = require_mergeDeep.mergeDeep(require_mergeDeep.mergeDeep(require_styles.defaultFormInputContainerTheme, theme), formInputContainerTheme ?? {});
|
|
11
11
|
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(Component, {
|
|
12
|
-
css: [require_styles.formInputContainerStyles(mergedTheme), cssOverrides],
|
|
12
|
+
css: [require_styles.formInputContainerStyles(mergedTheme, { fluid }), cssOverrides],
|
|
13
13
|
isDisabled,
|
|
14
14
|
...props,
|
|
15
15
|
children: [
|
|
@@ -5,11 +5,11 @@ import { ALLOWED_FORM_CONTAINERS } from "./types.js";
|
|
|
5
5
|
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
6
6
|
import { FieldError, Label } from "react-aria-components";
|
|
7
7
|
//#region src/components/Form/Form.tsx
|
|
8
|
-
function FormInputContainer({ as: Component, size = "md", label, renderLabel, description, error, isDisabled = false, theme = {}, formInputContainerTheme, cssOverrides, children, ...props }) {
|
|
8
|
+
function FormInputContainer({ as: Component, size = "md", fluid = false, label, renderLabel, description, error, isDisabled = false, theme = {}, formInputContainerTheme, cssOverrides, children, ...props }) {
|
|
9
9
|
if (!ALLOWED_FORM_CONTAINERS.includes(Component)) return null;
|
|
10
10
|
const mergedTheme = mergeDeep(mergeDeep(defaultFormInputContainerTheme, theme), formInputContainerTheme ?? {});
|
|
11
11
|
return /* @__PURE__ */ jsxs(Component, {
|
|
12
|
-
css: [formInputContainerStyles(mergedTheme), cssOverrides],
|
|
12
|
+
css: [formInputContainerStyles(mergedTheme, { fluid }), cssOverrides],
|
|
13
13
|
isDisabled,
|
|
14
14
|
...props,
|
|
15
15
|
children: [
|
|
@@ -3,12 +3,15 @@ const require_form = require("../../styleD/build/typescript/component/form.cjs")
|
|
|
3
3
|
let _emotion_react = require("@emotion/react");
|
|
4
4
|
//#region src/components/Form/styles.ts
|
|
5
5
|
const defaultFormInputContainerTheme = require_form.componentForm.input;
|
|
6
|
-
const formInputContainerStyles = (theme) => {
|
|
6
|
+
const formInputContainerStyles = (theme, { fluid }) => {
|
|
7
7
|
return _emotion_react.css`
|
|
8
8
|
display: ${theme.shared.container.display};
|
|
9
9
|
flex-direction: ${theme.shared.container.flexDirection};
|
|
10
10
|
gap: ${theme.shared.container.gap};
|
|
11
11
|
width: ${theme.shared.container.width};
|
|
12
|
+
${!fluid && _emotion_react.css`
|
|
13
|
+
max-width: ${theme.shared.container.maxWidth};
|
|
14
|
+
`}
|
|
12
15
|
`;
|
|
13
16
|
};
|
|
14
17
|
const formInputLabelStyles = (theme, { isDisabled, size }) => {
|
|
@@ -3,12 +3,15 @@ import { componentForm } from "../../styleD/build/typescript/component/form.js";
|
|
|
3
3
|
import { css } from "@emotion/react";
|
|
4
4
|
//#region src/components/Form/styles.ts
|
|
5
5
|
const defaultFormInputContainerTheme = componentForm.input;
|
|
6
|
-
const formInputContainerStyles = (theme) => {
|
|
6
|
+
const formInputContainerStyles = (theme, { fluid }) => {
|
|
7
7
|
return css`
|
|
8
8
|
display: ${theme.shared.container.display};
|
|
9
9
|
flex-direction: ${theme.shared.container.flexDirection};
|
|
10
10
|
gap: ${theme.shared.container.gap};
|
|
11
11
|
width: ${theme.shared.container.width};
|
|
12
|
+
${!fluid && css`
|
|
13
|
+
max-width: ${theme.shared.container.maxWidth};
|
|
14
|
+
`}
|
|
12
15
|
`;
|
|
13
16
|
};
|
|
14
17
|
const formInputLabelStyles = (theme, { isDisabled, size }) => {
|
|
@@ -10,6 +10,10 @@ type FormInputContainerDefaultProps<ReactAriaInput extends {
|
|
|
10
10
|
* The size of the form input, 'md' (default) or 'sm'.
|
|
11
11
|
*/
|
|
12
12
|
size?: keyof Omit<ComponentTheme, 'shared'>;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the form input should take up the full width of its container. Defaults to false, which applies a max-width to the input for better readability.
|
|
15
|
+
*/
|
|
16
|
+
fluid?: boolean;
|
|
13
17
|
/**
|
|
14
18
|
* The label text for the form field.
|
|
15
19
|
*/
|
|
@@ -10,6 +10,10 @@ type FormInputContainerDefaultProps<ReactAriaInput extends {
|
|
|
10
10
|
* The size of the form input, 'md' (default) or 'sm'.
|
|
11
11
|
*/
|
|
12
12
|
size?: keyof Omit<ComponentTheme, 'shared'>;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the form input should take up the full width of its container. Defaults to false, which applies a max-width to the input for better readability.
|
|
15
|
+
*/
|
|
16
|
+
fluid?: boolean;
|
|
13
17
|
/**
|
|
14
18
|
* The label text for the form field.
|
|
15
19
|
*/
|
|
@@ -8,18 +8,26 @@ react = require_runtime.__toESM(react);
|
|
|
8
8
|
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
9
9
|
let react_aria_components = require("react-aria-components");
|
|
10
10
|
//#region src/components/Select/Select.tsx
|
|
11
|
-
function Option({ children, theme = {} }) {
|
|
11
|
+
function Option({ children, theme = {}, id, ...props }) {
|
|
12
|
+
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultSelectTheme, theme);
|
|
13
|
+
const resolvedId = id ?? children;
|
|
12
14
|
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.ListBoxItem, {
|
|
13
|
-
css: require_styles.listBoxItemStyles(
|
|
15
|
+
css: require_styles.listBoxItemStyles(mergedTheme),
|
|
16
|
+
id: resolvedId,
|
|
17
|
+
...props,
|
|
14
18
|
children
|
|
15
19
|
});
|
|
16
20
|
}
|
|
17
21
|
function ListBox({ children, theme = {} }) {
|
|
18
22
|
const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultSelectTheme, theme);
|
|
19
23
|
const items = [];
|
|
20
|
-
react.default.Children.forEach(children, (child,
|
|
24
|
+
react.default.Children.forEach(children, (child, index) => {
|
|
21
25
|
if (!react.default.isValidElement(child)) return;
|
|
22
|
-
if (child.type === Option)
|
|
26
|
+
if (child.type === Option) {
|
|
27
|
+
const optionChild = child;
|
|
28
|
+
const key = `${optionChild.props.id ?? optionChild.props.children}-${index}`;
|
|
29
|
+
items.push(react.default.cloneElement(optionChild, { key }));
|
|
30
|
+
}
|
|
23
31
|
});
|
|
24
32
|
return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.ListBox, {
|
|
25
33
|
css: require_styles.listBoxStyles(mergedTheme),
|
|
@@ -40,8 +48,13 @@ function Select({ isInvalid, theme = {}, children, ...props }) {
|
|
|
40
48
|
size: "lg"
|
|
41
49
|
})]
|
|
42
50
|
}), /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react_aria_components.Popover, {
|
|
43
|
-
css: require_styles.popoverStyles(
|
|
44
|
-
|
|
51
|
+
css: require_styles.popoverStyles(),
|
|
52
|
+
offset: mergedTheme.shared.offset,
|
|
53
|
+
containerPadding: mergedTheme.shared.containerPadding,
|
|
54
|
+
children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(ListBox, {
|
|
55
|
+
theme: mergedTheme,
|
|
56
|
+
children
|
|
57
|
+
})
|
|
45
58
|
})]
|
|
46
59
|
});
|
|
47
60
|
}
|
|
@@ -3,7 +3,9 @@ import { OptionProps, SelectProps } from "./types.cjs";
|
|
|
3
3
|
//#region src/components/Select/Select.d.ts
|
|
4
4
|
declare function Option({
|
|
5
5
|
children,
|
|
6
|
-
theme
|
|
6
|
+
theme,
|
|
7
|
+
id,
|
|
8
|
+
...props
|
|
7
9
|
}: OptionProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
10
|
declare function Select({
|
|
9
11
|
isInvalid,
|
|
@@ -3,7 +3,9 @@ import { OptionProps, SelectProps } from "./types.js";
|
|
|
3
3
|
//#region src/components/Select/Select.d.ts
|
|
4
4
|
declare function Option({
|
|
5
5
|
children,
|
|
6
|
-
theme
|
|
6
|
+
theme,
|
|
7
|
+
id,
|
|
8
|
+
...props
|
|
7
9
|
}: OptionProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
10
|
declare function Select({
|
|
9
11
|
isInvalid,
|
|
@@ -6,18 +6,26 @@ import React from "react";
|
|
|
6
6
|
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
7
7
|
import { Button, ListBox, ListBoxItem, Popover, Select, SelectValue } from "react-aria-components";
|
|
8
8
|
//#region src/components/Select/Select.tsx
|
|
9
|
-
function Option({ children, theme = {} }) {
|
|
9
|
+
function Option({ children, theme = {}, id, ...props }) {
|
|
10
|
+
const mergedTheme = mergeDeep(defaultSelectTheme, theme);
|
|
11
|
+
const resolvedId = id ?? children;
|
|
10
12
|
return /* @__PURE__ */ jsx(ListBoxItem, {
|
|
11
|
-
css: listBoxItemStyles(
|
|
13
|
+
css: listBoxItemStyles(mergedTheme),
|
|
14
|
+
id: resolvedId,
|
|
15
|
+
...props,
|
|
12
16
|
children
|
|
13
17
|
});
|
|
14
18
|
}
|
|
15
19
|
function ListBox$1({ children, theme = {} }) {
|
|
16
20
|
const mergedTheme = mergeDeep(defaultSelectTheme, theme);
|
|
17
21
|
const items = [];
|
|
18
|
-
React.Children.forEach(children, (child,
|
|
22
|
+
React.Children.forEach(children, (child, index) => {
|
|
19
23
|
if (!React.isValidElement(child)) return;
|
|
20
|
-
if (child.type === Option)
|
|
24
|
+
if (child.type === Option) {
|
|
25
|
+
const optionChild = child;
|
|
26
|
+
const key = `${optionChild.props.id ?? optionChild.props.children}-${index}`;
|
|
27
|
+
items.push(React.cloneElement(optionChild, { key }));
|
|
28
|
+
}
|
|
21
29
|
});
|
|
22
30
|
return /* @__PURE__ */ jsx(ListBox, {
|
|
23
31
|
css: listBoxStyles(mergedTheme),
|
|
@@ -38,8 +46,13 @@ function Select$1({ isInvalid, theme = {}, children, ...props }) {
|
|
|
38
46
|
size: "lg"
|
|
39
47
|
})]
|
|
40
48
|
}), /* @__PURE__ */ jsx(Popover, {
|
|
41
|
-
css: popoverStyles(
|
|
42
|
-
|
|
49
|
+
css: popoverStyles(),
|
|
50
|
+
offset: mergedTheme.shared.offset,
|
|
51
|
+
containerPadding: mergedTheme.shared.containerPadding,
|
|
52
|
+
children: /* @__PURE__ */ jsx(ListBox$1, {
|
|
53
|
+
theme: mergedTheme,
|
|
54
|
+
children
|
|
55
|
+
})
|
|
43
56
|
})]
|
|
44
57
|
});
|
|
45
58
|
}
|
|
@@ -3,9 +3,10 @@ const require_select = require("../../styleD/build/typescript/component/select.c
|
|
|
3
3
|
let _emotion_react = require("@emotion/react");
|
|
4
4
|
//#region src/components/Select/styles.ts
|
|
5
5
|
const defaultSelectTheme = require_select.componentSelect;
|
|
6
|
-
const popoverStyles = (
|
|
6
|
+
const popoverStyles = () => {
|
|
7
7
|
return _emotion_react.css`
|
|
8
|
-
width
|
|
8
|
+
/* width must be determined by the react-aria popover --trigger-width variable */
|
|
9
|
+
width: var(--trigger-width);
|
|
9
10
|
`;
|
|
10
11
|
};
|
|
11
12
|
const listBoxItemStyles = (theme) => {
|
|
@@ -3,9 +3,10 @@ import { componentSelect } from "../../styleD/build/typescript/component/select.
|
|
|
3
3
|
import { css } from "@emotion/react";
|
|
4
4
|
//#region src/components/Select/styles.ts
|
|
5
5
|
const defaultSelectTheme = componentSelect;
|
|
6
|
-
const popoverStyles = (
|
|
6
|
+
const popoverStyles = () => {
|
|
7
7
|
return css`
|
|
8
|
-
width
|
|
8
|
+
/* width must be determined by the react-aria popover --trigger-width variable */
|
|
9
|
+
width: var(--trigger-width);
|
|
9
10
|
`;
|
|
10
11
|
};
|
|
11
12
|
const listBoxItemStyles = (theme) => {
|
|
@@ -4,7 +4,7 @@ import { SelectTheme } from "./styles.cjs";
|
|
|
4
4
|
import { ListBoxItemProps, SelectProps } from "react-aria-components";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Select/types.d.ts
|
|
7
|
-
interface OptionProps extends DefaultPropsWithChildren<SelectTheme, ListBoxItemProps['className']>, Omit<ListBoxItemProps, 'children'> {}
|
|
7
|
+
interface OptionProps extends DefaultPropsWithChildren<SelectTheme, ListBoxItemProps['className'], string>, Omit<ListBoxItemProps, 'children'> {}
|
|
8
8
|
type SelectProps$1 = FormInputContainerDefaultProps<SelectProps<object, 'single' | 'multiple'>, SelectTheme>;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { OptionProps, SelectProps$1 as SelectProps };
|
|
@@ -4,7 +4,7 @@ import { SelectTheme } from "./styles.js";
|
|
|
4
4
|
import { ListBoxItemProps, SelectProps } from "react-aria-components";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Select/types.d.ts
|
|
7
|
-
interface OptionProps extends DefaultPropsWithChildren<SelectTheme, ListBoxItemProps['className']>, Omit<ListBoxItemProps, 'children'> {}
|
|
7
|
+
interface OptionProps extends DefaultPropsWithChildren<SelectTheme, ListBoxItemProps['className'], string>, Omit<ListBoxItemProps, 'children'> {}
|
|
8
8
|
type SelectProps$1 = FormInputContainerDefaultProps<SelectProps<object, 'single' | 'multiple'>, SelectTheme>;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { OptionProps, SelectProps$1 as SelectProps };
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
--component-form-input-shared-container-flex-direction: column;
|
|
8
8
|
--component-form-input-shared-container-gap: 0.25rem;
|
|
9
9
|
--component-form-input-shared-container-width: 100%;
|
|
10
|
+
--component-form-input-shared-container-max-width: 450px;
|
|
10
11
|
--component-form-input-shared-label-color: #000000;
|
|
11
12
|
--component-form-input-shared-label-disabled-color: #999999;
|
|
12
13
|
--component-form-input-shared-description-color: #545454;
|
|
@@ -21,7 +21,5 @@
|
|
|
21
21
|
--component-intended-audience-signifier-chevron-fill: #545454;
|
|
22
22
|
--component-intended-audience-signifier-chevron-size: 10px;
|
|
23
23
|
--component-intended-audience-signifier-color: #545454;
|
|
24
|
-
--component-intended-audience-signifier-typography-font: normal 460
|
|
25
|
-
0.75rem/1.3 'Open Sans';
|
|
26
24
|
--component-intended-audience-signifier-typography-line-height: 1;
|
|
27
25
|
}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
:root {
|
|
6
6
|
--component-select-shared-width: 100%;
|
|
7
|
+
--component-select-shared-offset: 8;
|
|
8
|
+
--component-select-shared-container-padding: 0;
|
|
7
9
|
--component-select-shared-hover-background-color: #f6f6f6;
|
|
8
10
|
--component-select-shared-hover-outline: none; /** Override outline focus styles on hover */
|
|
9
11
|
--component-select-shared-pressed-background-color: #ededed;
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
--semantic-colors-bg-raised-level1: #f6f6f6;
|
|
29
29
|
--semantic-colors-bg-raised-level2: #ededed;
|
|
30
30
|
--semantic-colors-bg-raised-level3: #e6e6e6;
|
|
31
|
+
--semantic-colors-bg-base-inverse: #000000;
|
|
32
|
+
--semantic-colors-bg-raised-level1-inverse: #333333;
|
|
33
|
+
--semantic-colors-bg-raised-level2-inverse: #545454;
|
|
34
|
+
--semantic-colors-bg-raised-level3-inverse: #666666;
|
|
31
35
|
--semantic-colors-border-stronger: #545454;
|
|
32
36
|
--semantic-colors-border-strong: #8d8d8d;
|
|
33
37
|
--semantic-colors-border-weak: #cccccc;
|
|
@@ -30,7 +30,11 @@ const semanticColors = {
|
|
|
30
30
|
base: "#ffffff",
|
|
31
31
|
raisedLevel1: "#f6f6f6",
|
|
32
32
|
raisedLevel2: "#ededed",
|
|
33
|
-
raisedLevel3: "#e6e6e6"
|
|
33
|
+
raisedLevel3: "#e6e6e6",
|
|
34
|
+
baseInverse: "#000000",
|
|
35
|
+
raisedLevel1Inverse: "#333333",
|
|
36
|
+
raisedLevel2Inverse: "#545454",
|
|
37
|
+
raisedLevel3Inverse: "#666666"
|
|
34
38
|
},
|
|
35
39
|
border: {
|
|
36
40
|
stronger: "#545454",
|
|
@@ -31,6 +31,10 @@ declare const semanticColors: {
|
|
|
31
31
|
raisedLevel1: string;
|
|
32
32
|
raisedLevel2: string;
|
|
33
33
|
raisedLevel3: string;
|
|
34
|
+
baseInverse: string;
|
|
35
|
+
raisedLevel1Inverse: string;
|
|
36
|
+
raisedLevel2Inverse: string;
|
|
37
|
+
raisedLevel3Inverse: string;
|
|
34
38
|
};
|
|
35
39
|
border: {
|
|
36
40
|
stronger: string;
|
|
@@ -31,6 +31,10 @@ declare const semanticColors: {
|
|
|
31
31
|
raisedLevel1: string;
|
|
32
32
|
raisedLevel2: string;
|
|
33
33
|
raisedLevel3: string;
|
|
34
|
+
baseInverse: string;
|
|
35
|
+
raisedLevel1Inverse: string;
|
|
36
|
+
raisedLevel2Inverse: string;
|
|
37
|
+
raisedLevel3Inverse: string;
|
|
34
38
|
};
|
|
35
39
|
border: {
|
|
36
40
|
stronger: string;
|
|
@@ -30,7 +30,11 @@ const semanticColors = {
|
|
|
30
30
|
base: "#ffffff",
|
|
31
31
|
raisedLevel1: "#f6f6f6",
|
|
32
32
|
raisedLevel2: "#ededed",
|
|
33
|
-
raisedLevel3: "#e6e6e6"
|
|
33
|
+
raisedLevel3: "#e6e6e6",
|
|
34
|
+
baseInverse: "#000000",
|
|
35
|
+
raisedLevel1Inverse: "#333333",
|
|
36
|
+
raisedLevel2Inverse: "#545454",
|
|
37
|
+
raisedLevel3Inverse: "#666666"
|
|
34
38
|
},
|
|
35
39
|
border: {
|
|
36
40
|
stronger: "#545454",
|