@nypl/design-system-react-components 0.25.11 → 0.25.12
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/CHANGELOG.md +31 -0
- package/README.md +4 -16
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
- package/dist/components/Icons/IconTypes.d.ts +9 -7
- package/dist/components/Logo/LogoSvgs.d.ts +6 -0
- package/dist/components/Logo/LogoTypes.d.ts +6 -0
- package/dist/components/Pagination/Pagination.d.ts +6 -2
- package/dist/components/SearchBar/SearchBar.d.ts +1 -1
- package/dist/components/Template/Template.d.ts +1 -1
- package/dist/design-system-react-components.cjs.development.js +947 -438
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +948 -439
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme/components/breadcrumb.d.ts +3 -0
- package/dist/theme/components/checkbox.d.ts +0 -2
- package/dist/theme/components/fieldset.d.ts +2 -0
- package/dist/theme/components/global.d.ts +15 -14
- package/dist/theme/components/globalMixins.d.ts +8 -8
- package/dist/theme/components/list.d.ts +6 -0
- package/dist/theme/components/notification.d.ts +3 -0
- package/dist/theme/components/radio.d.ts +3 -2
- package/dist/theme/components/select.d.ts +2 -9
- package/dist/theme/components/slider.d.ts +8 -4
- package/dist/theme/components/textInput.d.ts +8 -12
- package/dist/theme/components/toggle.d.ts +6 -2
- package/dist/theme/foundations/global.d.ts +31 -3
- package/dist/utils/utils.d.ts +10 -0
- package/package.json +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +18 -1
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +10 -0
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +99 -0
- package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -0
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +6 -6
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +18 -18
- package/src/components/Fieldset/Fieldset.stories.mdx +1 -1
- package/src/components/Icons/Icon.stories.mdx +1 -1
- package/src/components/Icons/IconTypes.tsx +8 -6
- package/src/components/List/List.stories.mdx +1 -1
- package/src/components/Logo/Logo.stories.mdx +1 -1
- package/src/components/Logo/LogoSvgs.tsx +12 -0
- package/src/components/Logo/LogoTypes.tsx +6 -0
- package/src/components/Notification/Notification.stories.mdx +6 -1
- package/src/components/Notification/Notification.test.tsx +20 -9
- package/src/components/Notification/Notification.tsx +6 -4
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +103 -8
- package/src/components/Pagination/Pagination.stories.mdx +54 -12
- package/src/components/Pagination/Pagination.test.tsx +63 -5
- package/src/components/Pagination/Pagination.tsx +45 -23
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +3 -3
- package/src/components/Radio/Radio.stories.mdx +1 -1
- package/src/components/Radio/Radio.tsx +1 -0
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +5 -5
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +18 -18
- package/src/components/SearchBar/SearchBar.Test.tsx +20 -2
- package/src/components/SearchBar/SearchBar.stories.mdx +4 -4
- package/src/components/SearchBar/SearchBar.tsx +3 -2
- package/src/components/Select/Select.stories.mdx +1 -1
- package/src/components/Slider/Slider.stories.mdx +1 -1
- package/src/components/Slider/Slider.tsx +4 -1
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +4 -4
- package/src/components/StyleGuide/Colors.stories.mdx +33 -18
- package/src/components/Template/Template.stories.mdx +1 -1
- package/src/components/Template/Template.tsx +2 -6
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +2 -2
- package/src/components/Toggle/Toggle.stories.mdx +1 -1
- package/src/components/Toggle/Toggle.tsx +2 -1
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +4 -4
- package/src/docs/Chakra.stories.mdx +1 -1
- package/src/styles/base/_place-holder.scss +2 -0
- package/src/styles.scss +0 -2
- package/src/theme/components/breadcrumb.ts +4 -0
- package/src/theme/components/checkbox.ts +3 -7
- package/src/theme/components/fieldset.ts +2 -0
- package/src/theme/components/global.ts +18 -15
- package/src/theme/components/globalMixins.ts +8 -8
- package/src/theme/components/list.ts +4 -0
- package/src/theme/components/notification.ts +3 -0
- package/src/theme/components/radio.ts +3 -6
- package/src/theme/components/select.ts +3 -3
- package/src/theme/components/slider.ts +12 -9
- package/src/theme/components/textInput.ts +2 -2
- package/src/theme/components/toggle.ts +41 -37
- package/src/theme/foundations/colors.ts +19 -12
- package/src/theme/foundations/global.ts +17 -5
- package/src/theme/foundations/typography.ts +1 -1
- package/src/utils/componentCategories.ts +1 -1
- package/src/utils/utils.ts +28 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -13
- package/src/components/Pagination/Pagination.stories.tsx +0 -54
- package/src/styles/base/_03-base.scss +0 -25
- package/src/styles/base/_04-focus.scss +0 -22
|
@@ -10,31 +10,35 @@ import DSProvider from "../../theme/provider";
|
|
|
10
10
|
|
|
11
11
|
export const cssVars = {
|
|
12
12
|
brand: ["--nypl-colors-brand-primary", "--nypl-colors-brand-secondary"],
|
|
13
|
-
|
|
14
|
-
"--nypl-colors-section-
|
|
15
|
-
"--nypl-colors-section-
|
|
13
|
+
blogs: [
|
|
14
|
+
"--nypl-colors-section-blogs-primary",
|
|
15
|
+
"--nypl-colors-section-blogs-secondary",
|
|
16
16
|
],
|
|
17
17
|
booksAndMore: [
|
|
18
18
|
"--nypl-colors-section-books-and-more-primary",
|
|
19
19
|
"--nypl-colors-section-books-and-more-secondary",
|
|
20
20
|
],
|
|
21
|
-
|
|
22
|
-
"--nypl-colors-section-
|
|
23
|
-
"--nypl-colors-section-
|
|
21
|
+
education: [
|
|
22
|
+
"--nypl-colors-section-education-primary",
|
|
23
|
+
"--nypl-colors-section-education-secondary",
|
|
24
24
|
],
|
|
25
25
|
locations: [
|
|
26
26
|
"--nypl-colors-section-locations-primary",
|
|
27
27
|
"--nypl-colors-section-locations-secondary",
|
|
28
28
|
],
|
|
29
|
-
|
|
30
|
-
"--nypl-colors-section-
|
|
31
|
-
"--nypl-colors-section-
|
|
29
|
+
research: [
|
|
30
|
+
"--nypl-colors-section-research-primary",
|
|
31
|
+
"--nypl-colors-section-research-secondary",
|
|
32
32
|
],
|
|
33
33
|
researchLibraries: [
|
|
34
34
|
"--nypl-colors-section-research-library-lpa",
|
|
35
35
|
"--nypl-colors-section-research-library-schomburg",
|
|
36
36
|
"--nypl-colors-section-research-library-schwartzman",
|
|
37
37
|
],
|
|
38
|
+
whatsOn: [
|
|
39
|
+
"--nypl-colors-section-whats-on-primary",
|
|
40
|
+
"--nypl-colors-section-whats-on-secondary",
|
|
41
|
+
],
|
|
38
42
|
ui: [
|
|
39
43
|
"--nypl-colors-ui-black",
|
|
40
44
|
"--nypl-colors-ui-white",
|
|
@@ -112,9 +116,9 @@ Section colors are branding colors only in use at NYPL.
|
|
|
112
116
|
|
|
113
117
|
<Canvas>
|
|
114
118
|
<DSProvider>
|
|
115
|
-
<Heading level={HeadingLevels.Two}>
|
|
116
|
-
<p>
|
|
117
|
-
<SimpleGrid columns={1}>{getColorCards("
|
|
119
|
+
<Heading level={HeadingLevels.Two}>Blogs</Heading>
|
|
120
|
+
<p>Blogs is used for the Blogs section.</p>
|
|
121
|
+
<SimpleGrid columns={1}>{getColorCards("blogs")}</SimpleGrid>
|
|
118
122
|
</DSProvider>
|
|
119
123
|
</Canvas>
|
|
120
124
|
|
|
@@ -131,9 +135,12 @@ Section colors are branding colors only in use at NYPL.
|
|
|
131
135
|
|
|
132
136
|
<Canvas>
|
|
133
137
|
<DSProvider>
|
|
134
|
-
<Heading level={HeadingLevels.Two}>
|
|
135
|
-
<p>
|
|
136
|
-
|
|
138
|
+
<Heading level={HeadingLevels.Two}>Education</Heading>
|
|
139
|
+
<p>
|
|
140
|
+
Education is used for the Education section front and all associated
|
|
141
|
+
sub-sections.
|
|
142
|
+
</p>
|
|
143
|
+
<SimpleGrid columns={1}>{getColorCards("education")}</SimpleGrid>
|
|
137
144
|
</DSProvider>
|
|
138
145
|
</Canvas>
|
|
139
146
|
|
|
@@ -150,9 +157,9 @@ Section colors are branding colors only in use at NYPL.
|
|
|
150
157
|
|
|
151
158
|
<Canvas>
|
|
152
159
|
<DSProvider>
|
|
153
|
-
<Heading level={HeadingLevels.Two}>
|
|
154
|
-
<p>
|
|
155
|
-
<SimpleGrid columns={1}>{getColorCards("
|
|
160
|
+
<Heading level={HeadingLevels.Two}>Research</Heading>
|
|
161
|
+
<p>Research is used for the Research Catalog and SCC.</p>
|
|
162
|
+
<SimpleGrid columns={1}>{getColorCards("research")}</SimpleGrid>
|
|
156
163
|
</DSProvider>
|
|
157
164
|
</Canvas>
|
|
158
165
|
|
|
@@ -164,6 +171,14 @@ Section colors are branding colors only in use at NYPL.
|
|
|
164
171
|
</DSProvider>
|
|
165
172
|
</Canvas>
|
|
166
173
|
|
|
174
|
+
<Canvas>
|
|
175
|
+
<DSProvider>
|
|
176
|
+
<Heading level={HeadingLevels.Two}>What's On</Heading>
|
|
177
|
+
<p>What's On is used for Events, Exhibitions & Audio Guides.</p>
|
|
178
|
+
<SimpleGrid columns={1}>{getColorCards("whatsOn")}</SimpleGrid>
|
|
179
|
+
</DSProvider>
|
|
180
|
+
</Canvas>
|
|
181
|
+
|
|
167
182
|
## Utility Colors
|
|
168
183
|
|
|
169
184
|
<Canvas>
|
|
@@ -39,15 +39,11 @@ export interface TemplateAppContainerProps
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* The main top-level parent component that wraps all template-related
|
|
42
|
-
* components.
|
|
42
|
+
* components.
|
|
43
43
|
*/
|
|
44
44
|
const Template = (props: React.PropsWithChildren<TemplateProps>) => {
|
|
45
45
|
const styles = useStyleConfig("Template", {});
|
|
46
|
-
return
|
|
47
|
-
<Box __css={styles} className="nypl-ds">
|
|
48
|
-
{props.children}
|
|
49
|
-
</Box>
|
|
50
|
-
);
|
|
46
|
+
return <Box __css={styles}>{props.children}</Box>;
|
|
51
47
|
};
|
|
52
48
|
|
|
53
49
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Template components Renders the UI snapshot correctly 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
className="
|
|
5
|
+
className="css-0"
|
|
6
6
|
>
|
|
7
7
|
<div
|
|
8
8
|
className="css-0"
|
|
@@ -86,7 +86,7 @@ exports[`Template components Renders the UI snapshot correctly 1`] = `
|
|
|
86
86
|
|
|
87
87
|
exports[`Template components Renders the UI snapshot correctly 2`] = `
|
|
88
88
|
<div
|
|
89
|
-
className="
|
|
89
|
+
className="css-0"
|
|
90
90
|
>
|
|
91
91
|
<div
|
|
92
92
|
className="css-0"
|
|
@@ -77,7 +77,7 @@ const Toggle = React.forwardRef<HTMLInputElement, ToggleProps>(
|
|
|
77
77
|
const footnote: HelperErrorTextType = isInvalid ? invalidText : helperText;
|
|
78
78
|
const ariaAttributes = {};
|
|
79
79
|
const styles = useMultiStyleConfig("Toggle", {});
|
|
80
|
-
const switchStyles = useStyleConfig("Switch");
|
|
80
|
+
const switchStyles = useStyleConfig("Switch", { size });
|
|
81
81
|
ariaAttributes["aria-label"] =
|
|
82
82
|
labelText && footnote ? `${labelText} - ${footnote}` : labelText;
|
|
83
83
|
|
|
@@ -92,6 +92,7 @@ const Toggle = React.forwardRef<HTMLInputElement, ToggleProps>(
|
|
|
92
92
|
isRequired={isRequired}
|
|
93
93
|
ref={ref}
|
|
94
94
|
size={size === ToggleSizes.Large ? "lg" : "sm"}
|
|
95
|
+
lineHeight="1.5"
|
|
95
96
|
{...(isChecked !== undefined
|
|
96
97
|
? {
|
|
97
98
|
isChecked,
|
|
@@ -5,7 +5,7 @@ exports[`Toggle Renders the UI snapshot correctly 1`] = `
|
|
|
5
5
|
className="css-0"
|
|
6
6
|
>
|
|
7
7
|
<label
|
|
8
|
-
className="chakra-switch css-
|
|
8
|
+
className="chakra-switch css-18x0has"
|
|
9
9
|
onClick={[Function]}
|
|
10
10
|
>
|
|
11
11
|
<input
|
|
@@ -66,7 +66,7 @@ exports[`Toggle Renders the UI snapshot correctly 2`] = `
|
|
|
66
66
|
className="css-0"
|
|
67
67
|
>
|
|
68
68
|
<label
|
|
69
|
-
className="chakra-switch css-
|
|
69
|
+
className="chakra-switch css-18x0has"
|
|
70
70
|
data-checked=""
|
|
71
71
|
onClick={[Function]}
|
|
72
72
|
>
|
|
@@ -131,7 +131,7 @@ exports[`Toggle Renders the UI snapshot correctly 3`] = `
|
|
|
131
131
|
className="css-0"
|
|
132
132
|
>
|
|
133
133
|
<label
|
|
134
|
-
className="chakra-switch css-
|
|
134
|
+
className="chakra-switch css-18x0has"
|
|
135
135
|
data-invalid=""
|
|
136
136
|
onClick={[Function]}
|
|
137
137
|
>
|
|
@@ -195,7 +195,7 @@ exports[`Toggle Renders the UI snapshot correctly 4`] = `
|
|
|
195
195
|
className="css-0"
|
|
196
196
|
>
|
|
197
197
|
<label
|
|
198
|
-
className="chakra-switch css-
|
|
198
|
+
className="chakra-switch css-18x0has"
|
|
199
199
|
data-disabled=""
|
|
200
200
|
onClick={[Function]}
|
|
201
201
|
>
|
package/src/styles.scss
CHANGED
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
// Order important
|
|
14
14
|
@import "./styles/base/_01-breakpoints";
|
|
15
15
|
@import "./styles/base/_02-mixins";
|
|
16
|
-
@import "./styles/base/_03-base";
|
|
17
|
-
@import "./styles/base/_04-focus";
|
|
18
16
|
@import "./styles/base/_place-holder";
|
|
19
17
|
@import "./styles/space/_space-inline";
|
|
20
18
|
@import "./styles/space/_space-inset";
|
|
@@ -11,6 +11,9 @@ const blogs = {
|
|
|
11
11
|
const booksAndMore = {
|
|
12
12
|
bg: "section.books-and-more.secondary",
|
|
13
13
|
};
|
|
14
|
+
const education = {
|
|
15
|
+
bg: "section.education.secondary",
|
|
16
|
+
};
|
|
14
17
|
const locations = {
|
|
15
18
|
bg: "section.locations.primary",
|
|
16
19
|
};
|
|
@@ -78,6 +81,7 @@ const Breadcrumb = {
|
|
|
78
81
|
variants: {
|
|
79
82
|
blogs,
|
|
80
83
|
booksAndMore,
|
|
84
|
+
education,
|
|
81
85
|
locations,
|
|
82
86
|
research,
|
|
83
87
|
whatsOn,
|
|
@@ -69,14 +69,10 @@ const baseStyleControl = {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
// Style object for the Checkbox's label
|
|
72
|
-
const baseStyleLabel =
|
|
73
|
-
...checkboxRadioLabelStyles,
|
|
74
|
-
};
|
|
72
|
+
const baseStyleLabel = checkboxRadioLabelStyles;
|
|
75
73
|
|
|
76
74
|
// Style object for the Checkbox's helper text
|
|
77
|
-
const baseStyleHelper =
|
|
78
|
-
...checkboxRadioHelperStyle,
|
|
79
|
-
};
|
|
75
|
+
const baseStyleHelper = checkboxRadioHelperStyle;
|
|
80
76
|
|
|
81
77
|
const baseStyle = {
|
|
82
78
|
icon: baseStyleIcon,
|
|
@@ -94,7 +90,7 @@ const sizes = {
|
|
|
94
90
|
borderRadius: "sm",
|
|
95
91
|
},
|
|
96
92
|
// Controls the font-size of the label only.
|
|
97
|
-
label: { fontSize: "
|
|
93
|
+
label: { fontSize: "label.default" },
|
|
98
94
|
},
|
|
99
95
|
};
|
|
100
96
|
|
|
@@ -4,13 +4,12 @@ export { wrapperStyles } from "./globalMixins";
|
|
|
4
4
|
/** Reusable component styles. */
|
|
5
5
|
|
|
6
6
|
// Used in `Select` and `TextInput`.
|
|
7
|
-
const activeFocus = {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const activeFocus = (darkMode = false) => ({
|
|
8
|
+
outline: "2px solid",
|
|
9
|
+
outlineOffset: "2px",
|
|
10
|
+
outlineColor: darkMode ? "ui.white" : "ui.focus",
|
|
10
11
|
zIndex: "9999",
|
|
11
|
-
|
|
12
|
-
outlineColor: "ui.focus",
|
|
13
|
-
};
|
|
12
|
+
});
|
|
14
13
|
// Used in `Select` and `TextInput`.
|
|
15
14
|
const helperTextMargin = {
|
|
16
15
|
marginTop: "xxs",
|
|
@@ -19,11 +18,9 @@ const helperTextMargin = {
|
|
|
19
18
|
// Used in `Checkbox` and `Radio`.
|
|
20
19
|
const checkboxRadioLabelStyles = {
|
|
21
20
|
userSelect: "none",
|
|
22
|
-
fontSize: "text.default",
|
|
23
21
|
fontWeight: "text.default",
|
|
24
22
|
marginBottom: "0",
|
|
25
23
|
marginLeft: "xs",
|
|
26
|
-
verticalAlign: "middle",
|
|
27
24
|
_disabled: {
|
|
28
25
|
color: "ui.gray.dark",
|
|
29
26
|
opacity: 1,
|
|
@@ -47,6 +44,14 @@ const checkboxRadioHelperStyle = {
|
|
|
47
44
|
fontStyle: "italic",
|
|
48
45
|
},
|
|
49
46
|
};
|
|
47
|
+
const checkboxRadioGroupStyles = {
|
|
48
|
+
helper: {
|
|
49
|
+
marginTop: "s",
|
|
50
|
+
},
|
|
51
|
+
stack: {
|
|
52
|
+
width: "fit-content",
|
|
53
|
+
},
|
|
54
|
+
};
|
|
50
55
|
// Used in `Label` and `Fieldset`.
|
|
51
56
|
const labelLegendText = {
|
|
52
57
|
alignItems: "baseline",
|
|
@@ -62,13 +67,10 @@ const labelLegendText = {
|
|
|
62
67
|
fontWeight: "helper.default",
|
|
63
68
|
},
|
|
64
69
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
stack: {
|
|
70
|
-
width: "fit-content",
|
|
71
|
-
},
|
|
70
|
+
// Used for p, ul, and ol
|
|
71
|
+
const textMargin = {
|
|
72
|
+
margin: "0",
|
|
73
|
+
marginBottom: "s",
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
export {
|
|
@@ -79,4 +81,5 @@ export {
|
|
|
79
81
|
checkboxRadioLabelStyles,
|
|
80
82
|
helperTextMargin,
|
|
81
83
|
labelLegendText,
|
|
84
|
+
textMargin,
|
|
82
85
|
};
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
* These objects are also SCSS mixins but are now JS objects in the
|
|
3
3
|
* context of css-in-js and the custom NYPL-theme.
|
|
4
4
|
*/
|
|
5
|
+
const screenreaderOnly = {
|
|
6
|
+
clip: "rect(1px, 1px, 1px, 1px)",
|
|
7
|
+
height: "1px",
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
position: "absolute !important",
|
|
10
|
+
width: "1px",
|
|
11
|
+
wordWrap: "normal",
|
|
12
|
+
};
|
|
5
13
|
const wrapperStyles = {
|
|
6
14
|
marginY: "0",
|
|
7
15
|
marginX: "auto",
|
|
@@ -12,13 +20,5 @@ const wrapperStyles = {
|
|
|
12
20
|
paddingLeft: "0",
|
|
13
21
|
width: "100%",
|
|
14
22
|
};
|
|
15
|
-
const screenreaderOnly = {
|
|
16
|
-
clip: "rect(1px, 1px, 1px, 1px)",
|
|
17
|
-
height: "1px",
|
|
18
|
-
overflow: "hidden",
|
|
19
|
-
position: "absolute !important",
|
|
20
|
-
width: "1px",
|
|
21
|
-
wordWrap: "normal",
|
|
22
|
-
};
|
|
23
23
|
|
|
24
24
|
export { screenreaderOnly, wrapperStyles };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { textMargin } from "./global";
|
|
2
|
+
|
|
1
3
|
const List = {
|
|
2
4
|
baseStyle: ({ inline, noStyling }) => ({
|
|
3
5
|
// Browser automatically applies margin, so by default we unset it.
|
|
@@ -17,6 +19,7 @@ const List = {
|
|
|
17
19
|
}),
|
|
18
20
|
variants: {
|
|
19
21
|
ul: ({ noStyling }) => ({
|
|
22
|
+
...textMargin,
|
|
20
23
|
listStyle: "none",
|
|
21
24
|
li: {
|
|
22
25
|
_before: {
|
|
@@ -33,6 +36,7 @@ const List = {
|
|
|
33
36
|
},
|
|
34
37
|
},
|
|
35
38
|
}),
|
|
39
|
+
ol: textMargin,
|
|
36
40
|
dl: {
|
|
37
41
|
borderBottom: "1px solid",
|
|
38
42
|
borderColor: "ui.gray.light-cool",
|
|
@@ -67,14 +67,10 @@ const baseStyleControl = {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
// Style object for the Radio's label
|
|
70
|
-
const baseStyleLabel =
|
|
71
|
-
...checkboxRadioLabelStyles,
|
|
72
|
-
};
|
|
70
|
+
const baseStyleLabel = checkboxRadioLabelStyles;
|
|
73
71
|
|
|
74
72
|
// Style object for the Radio's helper text
|
|
75
|
-
const baseStyleHelper =
|
|
76
|
-
...checkboxRadioHelperStyle,
|
|
77
|
-
};
|
|
73
|
+
const baseStyleHelper = checkboxRadioHelperStyle;
|
|
78
74
|
|
|
79
75
|
const baseStyle = {
|
|
80
76
|
// Chakra-inserted elements in the Chakra Radio component
|
|
@@ -90,6 +86,7 @@ const sizes = {
|
|
|
90
86
|
control: {
|
|
91
87
|
...checkboxRadioControlSize,
|
|
92
88
|
},
|
|
89
|
+
label: { fontSize: "label.default" },
|
|
93
90
|
},
|
|
94
91
|
};
|
|
95
92
|
|
|
@@ -4,15 +4,15 @@ const select = {
|
|
|
4
4
|
backgroundColor: "ui.white",
|
|
5
5
|
borderRadius: "sm",
|
|
6
6
|
borderColor: "ui.gray.medium",
|
|
7
|
+
fontSize: "text.caption",
|
|
7
8
|
paddingTop: "xs",
|
|
8
9
|
paddingRight: "xl",
|
|
9
10
|
paddingBottom: "xs",
|
|
10
11
|
paddingLeft: "s",
|
|
11
12
|
_hover: {
|
|
12
|
-
borderColor: "ui.gray.
|
|
13
|
+
borderColor: "ui.gray.dark",
|
|
13
14
|
},
|
|
14
|
-
_active: activeFocus,
|
|
15
|
-
_focus: activeFocus,
|
|
15
|
+
_active: activeFocus(),
|
|
16
16
|
_disabled: {
|
|
17
17
|
color: "ui.gray.xdark",
|
|
18
18
|
bg: "ui.gray.xx-light-cool",
|
|
@@ -3,7 +3,7 @@ const staticValues = {
|
|
|
3
3
|
marginTop: "xs",
|
|
4
4
|
marginBottom: "xs",
|
|
5
5
|
marginRight: "s",
|
|
6
|
-
marginLeft: "
|
|
6
|
+
marginLeft: "0",
|
|
7
7
|
};
|
|
8
8
|
const CustomSlider = {
|
|
9
9
|
parts: [
|
|
@@ -12,11 +12,12 @@ const CustomSlider = {
|
|
|
12
12
|
"leftValue",
|
|
13
13
|
"rightValue",
|
|
14
14
|
"textInput",
|
|
15
|
+
"sliderContainer",
|
|
15
16
|
"filledTrack",
|
|
16
17
|
"track",
|
|
17
18
|
"thumb",
|
|
18
19
|
],
|
|
19
|
-
baseStyle: ({ isDisabled, isInvalid,
|
|
20
|
+
baseStyle: ({ isDisabled, isInvalid, showBoxes, showValues }) => {
|
|
20
21
|
let baseColor = "ui.link.primary";
|
|
21
22
|
if (isInvalid) {
|
|
22
23
|
baseColor = "ui.error.primary";
|
|
@@ -32,15 +33,10 @@ const CustomSlider = {
|
|
|
32
33
|
helper: {
|
|
33
34
|
marginTop: "xs",
|
|
34
35
|
},
|
|
35
|
-
leftValue:
|
|
36
|
-
...staticValues,
|
|
37
|
-
// If the text input boxes are shown, then there already is a
|
|
38
|
-
// margin, so we can set this static value to "0". But for the
|
|
39
|
-
// single Slider, we *do* need the margin set.
|
|
40
|
-
marginLeft: showBoxes && isRangeSlider ? "0" : "s",
|
|
41
|
-
},
|
|
36
|
+
leftValue: staticValues,
|
|
42
37
|
rightValue: {
|
|
43
38
|
...staticValues,
|
|
39
|
+
marginLeft: "s",
|
|
44
40
|
// If the text input boxes are shown, then there already is
|
|
45
41
|
// a margin, so we can set this static value to "0".
|
|
46
42
|
marginRight: showBoxes ? "0" : "s",
|
|
@@ -51,6 +47,13 @@ const CustomSlider = {
|
|
|
51
47
|
minWidth: "65px",
|
|
52
48
|
color: isInvalid ? "ui.error.primary" : "ui.black",
|
|
53
49
|
},
|
|
50
|
+
// This is added to the container so that the slider thumbs don't
|
|
51
|
+
// overflow past the container when the value boxes or min/max values
|
|
52
|
+
// are not shown.
|
|
53
|
+
sliderContainer: {
|
|
54
|
+
marginLeft: !showValues ? "xs" : null,
|
|
55
|
+
marginRight: !showBoxes && !showValues ? "xs" : null,
|
|
56
|
+
},
|
|
54
57
|
// Filled track doesn't have a _disabled or _invalid state...
|
|
55
58
|
// so we manually do it through the props.
|
|
56
59
|
filledTrack: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { helperTextMargin } from "./global";
|
|
2
2
|
|
|
3
3
|
const baseStyle = {
|
|
4
|
-
label: {
|
|
4
|
+
label: { alignItems: "start", display: "flex", width: "fit-content" },
|
|
5
5
|
helper: {
|
|
6
6
|
...helperTextMargin,
|
|
7
7
|
marginLeft: "xxs",
|
|
@@ -9,48 +9,52 @@ const baseStyle = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const Switch = {
|
|
12
|
-
baseStyle: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
_checked: {
|
|
19
|
-
bg: "ui.link.primary",
|
|
20
|
-
borderColor: "ui.link.primary",
|
|
21
|
-
opacity: 1,
|
|
22
|
-
},
|
|
23
|
-
_invalid: {
|
|
24
|
-
bg: "inherit",
|
|
25
|
-
borderColor: "ui.error.primary",
|
|
26
|
-
"> span": {
|
|
27
|
-
bg: "ui.error.primary",
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
_disabled: {
|
|
31
|
-
bg: "ui.gray.medium",
|
|
12
|
+
baseStyle: ({ size }) => {
|
|
13
|
+
return {
|
|
14
|
+
alignItems: "start",
|
|
15
|
+
opacity: 0.4,
|
|
16
|
+
track: {
|
|
17
|
+
border: "1px solid",
|
|
32
18
|
borderColor: "ui.gray.medium",
|
|
19
|
+
p: "4px",
|
|
33
20
|
_checked: {
|
|
34
|
-
|
|
21
|
+
bg: "ui.link.primary",
|
|
22
|
+
borderColor: "ui.link.primary",
|
|
23
|
+
opacity: 1,
|
|
24
|
+
},
|
|
25
|
+
_invalid: {
|
|
26
|
+
bg: "inherit",
|
|
27
|
+
borderColor: "ui.error.primary",
|
|
28
|
+
"> span": {
|
|
29
|
+
bg: "ui.error.primary",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
_disabled: {
|
|
33
|
+
bg: "ui.gray.medium",
|
|
34
|
+
borderColor: "ui.gray.medium",
|
|
35
|
+
_checked: {
|
|
36
|
+
opacity: 0.4,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
_focus: {
|
|
40
|
+
outline: "2px solid",
|
|
41
|
+
outlineColor: "ui.focus",
|
|
42
|
+
outlineOffset: "2px",
|
|
43
|
+
zIndex: "9999",
|
|
35
44
|
},
|
|
36
45
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
label: {
|
|
47
|
+
fontSize: "label.default",
|
|
48
|
+
marginLeft: "xs",
|
|
49
|
+
marginTop: size === "lg" ? "6px" : null,
|
|
50
|
+
_disabled: { fontStyle: "italic" },
|
|
42
51
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_disabled: { fontStyle: "italic" },
|
|
48
|
-
},
|
|
49
|
-
thumb: {
|
|
50
|
-
_disabled: {
|
|
51
|
-
bg: "ui.error.primary",
|
|
52
|
+
thumb: {
|
|
53
|
+
_disabled: {
|
|
54
|
+
bg: "ui.error.primary",
|
|
55
|
+
},
|
|
52
56
|
},
|
|
53
|
-
}
|
|
57
|
+
};
|
|
54
58
|
},
|
|
55
59
|
defaultProps: {
|
|
56
60
|
colorScheme: "white",
|