@automattic/vip-design-system 1.2.3 → 1.3.1
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/.eslintignore +2 -1
- package/.prettierignore +1 -0
- package/.storybook/decorators/withBoundingBox.tsx +30 -4
- package/.storybook/decorators/withColorMode.tsx +5 -5
- package/CONTRIBUTING.md +1 -1
- package/build/system/Accordion/Accordion.js +6 -6
- package/build/system/Accordion/Accordion.stories.js +1 -1
- package/build/system/Accordion/Accordion.test.js +7 -5
- package/build/system/Avatar/Avatar.js +3 -2
- package/build/system/Badge/Badge.js +1 -0
- package/build/system/Button/Button.d.ts +11 -0
- package/build/system/Button/Button.js +12 -1
- package/build/system/Button/Button.stories.d.ts +2 -1
- package/build/system/Button/Button.stories.js +1 -2
- package/build/system/Button/Button.test.js +72 -45
- package/build/system/Button/ButtonSubmit.d.ts +17 -1
- package/build/system/Button/ButtonSubmit.js +58 -65
- package/build/system/Button/ButtonSubmit.stories.d.ts +17 -37
- package/build/system/Button/ButtonSubmit.stories.js +52 -0
- package/build/system/Button/ButtonSubmit.test.js +55 -35
- package/build/system/Button/index.d.ts +7 -3
- package/build/system/Button/index.js +8 -7
- package/build/system/Dropdown/DropdownContent.js +1 -1
- package/build/system/Dropdown/DropdownItem.js +1 -1
- package/build/system/Dropdown/DropdownLabel.js +1 -1
- package/build/system/Form/Checkbox.d.ts +9 -9
- package/build/system/Form/Checkbox.js +56 -61
- package/build/system/Form/Checkbox.stories.d.ts +6 -6
- package/build/system/Form/Checkbox.stories.js +71 -0
- package/build/system/Form/Input.d.ts +14 -1
- package/build/system/Form/Input.js +59 -72
- package/build/system/Form/Input.stories.d.ts +6 -4
- package/build/system/Form/Input.stories.js +53 -0
- package/build/system/Form/Input.styles.d.ts +23 -14
- package/build/system/Form/Input.styles.js +40 -28
- package/build/system/Form/InputWithCopyButton.stories.jsx +7 -0
- package/build/system/Form/Label.d.ts +19 -8
- package/build/system/Form/Label.js +39 -43
- package/build/system/Form/Label.stories.d.ts +7 -5
- package/build/system/Form/Label.stories.js +32 -0
- package/build/system/Form/Radio.js +4 -4
- package/build/system/Form/Radio.stories.jsx +1 -1
- package/build/system/Form/RadioBoxGroup.js +1 -1
- package/build/system/Form/RequiredLabel.d.ts +2 -1
- package/build/system/Form/RequiredLabel.js +16 -7
- package/build/system/Form/Toggle.js +2 -2
- package/build/system/Form/Validation.d.ts +8 -13
- package/build/system/Form/Validation.js +39 -35
- package/build/system/Heading/Heading.stories.js +3 -0
- package/build/system/Link/Link.js +1 -1
- package/build/system/NewDialog/DialogClose.js +2 -2
- package/build/system/NewDialog/DialogContent.js +3 -3
- package/build/system/NewDialog/DialogTitle.js +3 -1
- package/build/system/NewDialog/NewDialog.stories.d.ts +0 -1
- package/build/system/NewDialog/NewDialog.stories.jsx +0 -27
- package/build/system/NewForm/Fieldset.d.ts +12 -1
- package/build/system/NewForm/Fieldset.js +38 -40
- package/build/system/NewForm/Form.d.ts +8 -1
- package/build/system/NewForm/Form.js +24 -23
- package/build/system/NewForm/FormAutocomplete.css +0 -11
- package/build/system/NewForm/FormAutocomplete.js +8 -8
- package/build/system/NewForm/FormAutocomplete.stories.jsx +1 -3
- package/build/system/NewForm/FormAutocompleteMultiselect.js +10 -10
- package/build/system/NewForm/FormSelect.js +1 -1
- package/build/system/NewForm/FormSelectArrow.js +1 -1
- package/build/system/NewForm/FormSelectInline.js +1 -1
- package/build/system/NewForm/FormSelectLoading.js +1 -1
- package/build/system/NewForm/FormSelectSearch.js +2 -2
- package/build/system/NewForm/Legend.d.ts +12 -1
- package/build/system/NewForm/Legend.js +32 -34
- package/build/system/NewForm/index.d.ts +1 -1
- package/build/system/OptionRow/OptionRow.js +1 -1
- package/build/system/Progress/Progress.d.ts +9 -2
- package/build/system/Progress/Progress.js +75 -70
- package/build/system/Progress/Progress.stories.d.ts +9 -7
- package/build/system/Progress/Progress.stories.js +34 -0
- package/build/system/Progress/Progress.test.d.ts +1 -0
- package/build/system/Progress/Progress.test.js +65 -0
- package/build/system/Progress/index.d.ts +4 -2
- package/build/system/Progress/index.js +5 -5
- package/build/system/ScreenReaderText/ScreenReaderText.js +1 -2
- package/build/system/Tabs/TabsTrigger.js +0 -1
- package/build/system/Text/Text.js +1 -1
- package/build/system/Text/Text.stories.js +36 -0
- package/build/system/Tooltip/Tooltip.css +6 -2
- package/build/system/Tooltip/Tooltip.stories.js +2 -2
- package/build/system/Wizard/Wizard.d.ts +14 -1
- package/build/system/Wizard/Wizard.js +62 -93
- package/build/system/Wizard/Wizard.stories.d.ts +11 -8
- package/build/system/Wizard/Wizard.stories.js +167 -0
- package/build/system/Wizard/WizardStep.d.ts +24 -1
- package/build/system/Wizard/WizardStep.js +180 -190
- package/build/system/Wizard/index.d.ts +4 -2
- package/build/system/Wizard/index.js +6 -7
- package/build/system/index.d.ts +2 -2
- package/build/system/index.js +2 -1
- package/build/system/theme/generated/valet-theme-dark.json +1219 -476
- package/build/system/theme/generated/valet-theme-light.json +1217 -474
- package/build/system/theme/{getColor.d.ts → getPropValue.d.ts} +2 -1
- package/{src/system/theme/getColor.js → build/system/theme/getPropValue.js} +36 -4
- package/build/system/theme/index.d.ts +20 -65
- package/build/system/theme/index.js +27 -57
- package/package.json +4 -4
- package/src/system/Accordion/Accordion.stories.tsx +1 -1
- package/src/system/Accordion/Accordion.test.tsx +3 -0
- package/src/system/Accordion/Accordion.tsx +6 -6
- package/src/system/Avatar/Avatar.tsx +3 -3
- package/src/system/Badge/Badge.tsx +1 -1
- package/src/system/Button/Button.stories.tsx +2 -3
- package/src/system/Button/{Button.test.js → Button.test.tsx} +2 -2
- package/src/system/Button/Button.tsx +12 -0
- package/src/system/Button/ButtonSubmit.stories.tsx +31 -0
- package/src/system/Button/{ButtonSubmit.test.js → ButtonSubmit.test.tsx} +4 -4
- package/src/system/Button/{ButtonSubmit.js → ButtonSubmit.tsx} +21 -27
- package/src/system/Button/index.ts +8 -0
- package/src/system/Dropdown/DropdownContent.js +1 -1
- package/src/system/Dropdown/DropdownItem.js +1 -1
- package/src/system/Dropdown/DropdownLabel.js +1 -1
- package/src/system/Form/{Checkbox.stories.jsx → Checkbox.stories.tsx} +3 -2
- package/src/system/Form/{Checkbox.js → Checkbox.tsx} +6 -10
- package/src/system/Form/{Input.stories.jsx → Input.stories.tsx} +1 -0
- package/src/system/Form/{Input.styles.js → Input.styles.ts} +14 -5
- package/src/system/Form/{Input.js → Input.tsx} +10 -19
- package/src/system/Form/InputWithCopyButton.stories.jsx +7 -0
- package/src/system/Form/{Label.js → Label.tsx} +8 -13
- package/src/system/Form/Radio.js +4 -4
- package/src/system/Form/Radio.stories.jsx +1 -1
- package/src/system/Form/RadioBoxGroup.js +1 -1
- package/src/system/Form/{RequiredLabel.js → RequiredLabel.tsx} +1 -3
- package/src/system/Form/Toggle.js +2 -2
- package/src/system/Form/{Validation.js → Validation.tsx} +11 -12
- package/src/system/Heading/Heading.stories.tsx +1 -0
- package/src/system/Link/Link.tsx +1 -1
- package/src/system/NewDialog/DialogClose.js +2 -2
- package/src/system/NewDialog/DialogContent.js +3 -3
- package/src/system/NewDialog/DialogTitle.js +3 -1
- package/src/system/NewDialog/NewDialog.stories.jsx +0 -27
- package/src/system/NewForm/Fieldset.tsx +46 -0
- package/src/system/NewForm/Form.tsx +23 -0
- package/src/system/NewForm/FormAutocomplete.css +0 -11
- package/src/system/NewForm/FormAutocomplete.js +8 -8
- package/src/system/NewForm/FormAutocomplete.stories.jsx +1 -3
- package/src/system/NewForm/FormAutocompleteMultiselect.js +10 -10
- package/src/system/NewForm/FormSelect.js +1 -1
- package/src/system/NewForm/FormSelectArrow.js +1 -1
- package/src/system/NewForm/FormSelectInline.js +1 -1
- package/src/system/NewForm/FormSelectLoading.js +1 -1
- package/src/system/NewForm/FormSelectSearch.js +2 -2
- package/src/system/NewForm/Legend.tsx +40 -0
- package/src/system/OptionRow/OptionRow.js +1 -1
- package/src/system/Progress/Progress.test.tsx +33 -0
- package/src/system/Progress/{Progress.js → Progress.tsx} +16 -19
- package/src/system/Progress/index.ts +4 -0
- package/src/system/ScreenReaderText/ScreenReaderText.tsx +0 -2
- package/src/system/Tabs/TabsTrigger.js +0 -1
- package/src/system/Text/Text.stories.tsx +7 -0
- package/src/system/Text/Text.tsx +1 -1
- package/src/system/Tooltip/Tooltip.css +6 -2
- package/src/system/Tooltip/Tooltip.stories.tsx +4 -4
- package/{build/system/Wizard/Wizard.stories.jsx → src/system/Wizard/Wizard.stories.tsx} +18 -23
- package/src/system/Wizard/Wizard.tsx +62 -0
- package/src/system/Wizard/{WizardStep.js → WizardStep.tsx} +38 -41
- package/src/system/Wizard/index.ts +7 -0
- package/src/system/index.js +2 -1
- package/src/system/theme/generated/valet-theme-dark.json +1219 -476
- package/src/system/theme/generated/valet-theme-light.json +1217 -474
- package/{build/system/theme/getColor.js → src/system/theme/getPropValue.js} +36 -4
- package/src/system/theme/index.js +27 -57
- package/tokens/utilities/colors/color output/blue.json +305 -0
- package/tokens/utilities/colors/color output/gold.json +305 -0
- package/tokens/utilities/colors/color output/gray.json +305 -0
- package/tokens/utilities/colors/color output/green.json +305 -0
- package/tokens/utilities/colors/color output/orange.json +305 -0
- package/tokens/utilities/colors/color output/pink.json +305 -0
- package/tokens/utilities/colors/color output/red.json +305 -0
- package/tokens/utilities/colors/color output/salmon.json +305 -0
- package/tokens/utilities/colors/color output/yellow.json +305 -0
- package/tokens/utilities/colors/colorOutput.json +4062 -0
- package/tokens/utilities/colors/color_3d_plot.js +43 -0
- package/tokens/utilities/colors/color_graph.js +31 -0
- package/tokens/utilities/colors/colors.json +1981 -0
- package/tokens/utilities/colors/index.js +118 -0
- package/tokens/utilities/colors/package-lock.json +6749 -0
- package/tokens/utilities/colors/package.json +21 -0
- package/tokens/utilities/figma-type-calculator/responsive-type.js +98 -0
- package/tokens/valet-core/$metadata.json +19 -15
- package/tokens/valet-core/$themes.json +3323 -419
- package/tokens/valet-core/{figma-parsely-expressive-type.json → figma-parsely-web-type.json} +128 -128
- package/tokens/valet-core/{figma-valet-expressive-type.json → figma-valet-web-type.json} +126 -126
- package/tokens/valet-core/figma-wpvip-services-web-type.json +1267 -0
- package/tokens/valet-core/{figma-wpvip-expressive-type.json → figma-wpvip-web-type.json} +162 -162
- package/tokens/valet-core/{parsely-expressive-color.json → parsely-web-color.json} +1 -1
- package/tokens/valet-core/{wpvip-expressive-core.json → parsely-web-core.json} +73 -23
- package/tokens/valet-core/{parsely-expressive-type.json → parsely-web-type.json} +21 -9
- package/tokens/valet-core/valet-core.json +331 -232
- package/tokens/valet-core/{valet-expressive-color.json → valet-web-color.json} +1 -1
- package/tokens/valet-core/{parsely-expressive-core.json → valet-web-core.json} +72 -22
- package/tokens/valet-core/{wpvip-productive-color.json → wpvip-product-core.json} +663 -7
- package/tokens/valet-core/{wpvip-productive-color-dark.json → wpvip-product-dark.json} +332 -10
- package/tokens/valet-core/{wpvip-expressive-color.json → wpvip-services-web-color.json} +1 -1
- package/tokens/valet-core/{valet-expressive-core.json → wpvip-services-web-core.json} +72 -22
- package/tokens/valet-core/wpvip-services-web-type.json +412 -0
- package/tokens/valet-core/{wpvip-expressive-color-dark.json → wpvip-web-color-dark.json} +1 -1
- package/tokens/valet-core/wpvip-web-color.json +730 -0
- package/tokens/valet-core/{wpvip-expressive-type.json → wpvip-web-type.json} +24 -12
- package/tokens/valet-core/wpvip-web.json +1310 -0
- package/tsconfig.json +2 -1
- package/build/system/Button/ButtonSubmit.stories.jsx +0 -40
- package/build/system/Button/variants.d.ts +0 -2
- package/build/system/Button/variants.js +0 -1
- package/build/system/Form/Checkbox.stories.jsx +0 -54
- package/build/system/Form/Input.stories.jsx +0 -38
- package/build/system/Wizard/WizardStepHorizontal.d.ts +0 -2
- package/build/system/Wizard/WizardStepHorizontal.js +0 -55
- package/build/system/theme/textStyles.d.ts +0 -71
- package/build/system/theme/textStyles.js +0 -46
- package/src/system/Button/ButtonSubmit.stories.jsx +0 -40
- package/src/system/Button/index.js +0 -8
- package/src/system/Button/variants.js +0 -1
- package/src/system/Form/Label.stories.jsx +0 -36
- package/src/system/NewForm/Fieldset.js +0 -47
- package/src/system/NewForm/Form.js +0 -26
- package/src/system/NewForm/Legend.js +0 -41
- package/src/system/Progress/Progress.stories.jsx +0 -25
- package/src/system/Progress/index.js +0 -6
- package/src/system/Wizard/Wizard.js +0 -103
- package/src/system/Wizard/Wizard.stories.jsx +0 -145
- package/src/system/Wizard/WizardStepHorizontal.js +0 -55
- package/src/system/Wizard/index.js +0 -8
- package/src/system/theme/textStyles.js +0 -46
- /package/{build/system/Form/Label.stories.jsx → src/system/Form/Label.stories.tsx} +0 -0
- /package/{build/system/Progress/Progress.stories.jsx → src/system/Progress/Progress.stories.tsx} +0 -0
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
/** @jsxImportSource theme-ui */
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* External dependencies
|
|
5
3
|
*/
|
|
6
4
|
import React from 'react';
|
|
7
|
-
import
|
|
8
|
-
import { Button } from './Button';
|
|
5
|
+
import { Button, ButtonProps } from './Button';
|
|
9
6
|
import { Spinner } from '../Spinner';
|
|
10
7
|
import classNames from 'classnames';
|
|
11
|
-
import variants from './variants';
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
interface DefaultSpinnerProps {
|
|
10
|
+
color?: string;
|
|
11
|
+
size: number;
|
|
12
|
+
}
|
|
16
13
|
|
|
17
|
-
DefaultSpinner
|
|
18
|
-
size:
|
|
19
|
-
|
|
20
|
-
};
|
|
14
|
+
function DefaultSpinner( { size, color = 'link' }: DefaultSpinnerProps ) {
|
|
15
|
+
return <Spinner size={ size } sx={ { ml: 2, color } } className="vip-button-submit-spinner" />;
|
|
16
|
+
}
|
|
21
17
|
|
|
22
18
|
DefaultSpinner.displayName = 'DefaultSpinner';
|
|
23
19
|
|
|
24
|
-
export
|
|
20
|
+
export interface ButtonSubmitProps extends ButtonProps {
|
|
21
|
+
label: React.ReactNode;
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
loadingIcon?: ( props: DefaultSpinnerProps ) => JSX.Element;
|
|
24
|
+
loadingIconSize?: number;
|
|
25
|
+
show?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const ButtonSubmit = React.forwardRef< HTMLButtonElement, ButtonSubmitProps >(
|
|
25
29
|
(
|
|
26
30
|
{
|
|
27
31
|
show = true,
|
|
28
|
-
variant =
|
|
32
|
+
variant = 'secondary',
|
|
29
33
|
label,
|
|
30
34
|
loading = false,
|
|
31
35
|
disabled = false,
|
|
32
36
|
loadingIcon = DefaultSpinner,
|
|
33
37
|
loadingIconSize = 20,
|
|
34
38
|
...rest
|
|
35
|
-
},
|
|
36
|
-
|
|
39
|
+
}: ButtonSubmitProps,
|
|
40
|
+
ref: React.Ref< HTMLButtonElement >
|
|
37
41
|
) => {
|
|
38
42
|
if ( ! show ) {
|
|
39
43
|
return null;
|
|
@@ -41,7 +45,7 @@ export const ButtonSubmit = React.forwardRef(
|
|
|
41
45
|
|
|
42
46
|
return (
|
|
43
47
|
<Button
|
|
44
|
-
ref={
|
|
48
|
+
ref={ ref }
|
|
45
49
|
className={ classNames( 'vip-button-submit-component', `vip-button-submit-${ variant }` ) }
|
|
46
50
|
disabled={ disabled || loading }
|
|
47
51
|
variant={ variant }
|
|
@@ -57,13 +61,3 @@ export const ButtonSubmit = React.forwardRef(
|
|
|
57
61
|
);
|
|
58
62
|
|
|
59
63
|
ButtonSubmit.displayName = 'ButtonSubmit';
|
|
60
|
-
|
|
61
|
-
ButtonSubmit.propTypes = {
|
|
62
|
-
label: PropTypes.node.isRequired,
|
|
63
|
-
disabled: PropTypes.bool,
|
|
64
|
-
loading: PropTypes.bool,
|
|
65
|
-
variant: PropTypes.oneOf( variants ),
|
|
66
|
-
show: PropTypes.bool,
|
|
67
|
-
loadingIcon: PropTypes.any,
|
|
68
|
-
loadingIconSize: PropTypes.number,
|
|
69
|
-
};
|
|
@@ -10,6 +10,7 @@ import { Form } from '..';
|
|
|
10
10
|
import { Checkbox } from './Checkbox';
|
|
11
11
|
import { Label } from './Label';
|
|
12
12
|
import { Flex } from '../Flex';
|
|
13
|
+
import { CheckedState } from '@radix-ui/react-checkbox';
|
|
13
14
|
|
|
14
15
|
export default {
|
|
15
16
|
title: 'Form/Checkbox',
|
|
@@ -17,8 +18,8 @@ export default {
|
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
export const Default = () => {
|
|
20
|
-
const [ checked, setChecked ] = useState( true );
|
|
21
|
-
const [ checked2, setChecked2 ] = useState( false );
|
|
21
|
+
const [ checked, setChecked ] = useState< CheckedState >( true );
|
|
22
|
+
const [ checked2, setChecked2 ] = useState< CheckedState >( false );
|
|
22
23
|
|
|
23
24
|
return (
|
|
24
25
|
<Form.Root>
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
6
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
7
|
import { MdDone } from 'react-icons/md';
|
|
9
8
|
import { baseControlBorderStyle, baseControlFocusStyle, inputBaseBackground } from './Input.styles';
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
export interface CheckboxProps extends CheckboxPrimitive.CheckboxProps {
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
const StyledCheckbox = ( props: CheckboxProps ) => (
|
|
12
14
|
<CheckboxPrimitive.Root
|
|
13
15
|
sx={ {
|
|
14
16
|
all: 'unset',
|
|
@@ -33,7 +35,7 @@ const StyledCheckbox = props => (
|
|
|
33
35
|
/>
|
|
34
36
|
);
|
|
35
37
|
|
|
36
|
-
const StyledIndicator = props => (
|
|
38
|
+
const StyledIndicator = ( props: CheckboxPrimitive.CheckboxIndicatorProps ) => (
|
|
37
39
|
<CheckboxPrimitive.Indicator
|
|
38
40
|
sx={ {
|
|
39
41
|
color: 'white',
|
|
@@ -42,7 +44,7 @@ const StyledIndicator = props => (
|
|
|
42
44
|
/>
|
|
43
45
|
);
|
|
44
46
|
|
|
45
|
-
const Checkbox = ( { disabled, ...props } ) => (
|
|
47
|
+
export const Checkbox = ( { disabled, ...props }: CheckboxProps ) => (
|
|
46
48
|
<StyledCheckbox
|
|
47
49
|
sx={ {
|
|
48
50
|
opacity: disabled ? 0.4 : 1,
|
|
@@ -55,9 +57,3 @@ const Checkbox = ( { disabled, ...props } ) => (
|
|
|
55
57
|
</StyledIndicator>
|
|
56
58
|
</StyledCheckbox>
|
|
57
59
|
);
|
|
58
|
-
|
|
59
|
-
Checkbox.propTypes = {
|
|
60
|
-
disabled: PropTypes.bool,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export { Checkbox };
|
|
@@ -34,5 +34,6 @@ export const Default = () => (
|
|
|
34
34
|
|
|
35
35
|
<Form.Label htmlFor="input-with-custom-label">Custom Label outside the Input</Form.Label>
|
|
36
36
|
<Form.Input forLabel="input-with-custom-label" required />
|
|
37
|
+
<Form.Input forLabel="input-readonly" readOnly value="This is a readonly input" />
|
|
37
38
|
</Form.Root>
|
|
38
39
|
);
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
import { Theme } from 'theme-ui';
|
|
2
|
+
|
|
1
3
|
export const baseControlBorderStyle = {
|
|
2
4
|
borderWidth: '1px',
|
|
3
5
|
borderStyle: 'solid',
|
|
4
6
|
borderColor: 'input.border.default',
|
|
5
7
|
};
|
|
8
|
+
// Temporary interface until we add types to the theme definition.
|
|
9
|
+
interface InputTheme extends Theme {
|
|
10
|
+
outline?: Record< string, string >;
|
|
11
|
+
}
|
|
6
12
|
|
|
7
13
|
export const inputBaseText = 'input.text.default';
|
|
8
|
-
export const inputBaseBackground = 'input.background';
|
|
14
|
+
export const inputBaseBackground = 'input.background.default';
|
|
9
15
|
export const baseControlFocusStyle = {
|
|
10
|
-
'&:focus': theme => theme.outline,
|
|
11
|
-
'&:focus-visible': theme => theme.outline,
|
|
12
|
-
'&:focus-within': theme => theme.outline,
|
|
16
|
+
'&:focus': ( theme: InputTheme ) => theme.outline,
|
|
17
|
+
'&:focus-visible': ( theme: InputTheme ) => theme.outline,
|
|
18
|
+
'&:focus-within': ( theme: InputTheme ) => theme.outline,
|
|
13
19
|
};
|
|
14
20
|
|
|
15
21
|
export const baseControlStyle = {
|
|
@@ -24,7 +30,10 @@ export const baseControlStyle = {
|
|
|
24
30
|
'&:disabled': {
|
|
25
31
|
borderColor: 'input.border.disabled',
|
|
26
32
|
},
|
|
27
|
-
|
|
33
|
+
'&:read-only': {
|
|
34
|
+
borderColor: 'input.border.disabled',
|
|
35
|
+
backgroundColor: 'input.background.read-only',
|
|
36
|
+
},
|
|
28
37
|
'&::placeholder': {
|
|
29
38
|
color: 'input.text.placeholder',
|
|
30
39
|
opacity: 1,
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
12
11
|
import { Validation, Label } from '../';
|
|
13
|
-
import { Input as ThemeInput } from 'theme-ui';
|
|
12
|
+
import { Input as ThemeInput, InputProps as ThemeInputProps } from 'theme-ui';
|
|
14
13
|
import { baseControlStyle } from './Input.styles';
|
|
15
14
|
|
|
16
15
|
const inputStyles = {
|
|
@@ -25,11 +24,15 @@ const inputStyles = {
|
|
|
25
24
|
variant: 'inputs.default',
|
|
26
25
|
};
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
interface InputProps extends ThemeInputProps {
|
|
28
|
+
label?: string;
|
|
29
|
+
hasError?: boolean;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
forLabel?: string;
|
|
32
|
+
errorMessage?: string;
|
|
33
|
+
}
|
|
34
|
+
export const Input = React.forwardRef< HTMLInputElement, InputProps >(
|
|
35
|
+
( { label, forLabel, hasError = false, required, sx = {}, errorMessage, ...props }, ref ) => (
|
|
33
36
|
<React.Fragment>
|
|
34
37
|
{ label && (
|
|
35
38
|
<Label required={ required } htmlFor={ forLabel }>
|
|
@@ -58,16 +61,4 @@ const Input = React.forwardRef(
|
|
|
58
61
|
)
|
|
59
62
|
);
|
|
60
63
|
|
|
61
|
-
Input.propTypes = {
|
|
62
|
-
variant: PropTypes.string,
|
|
63
|
-
label: PropTypes.string,
|
|
64
|
-
hasError: PropTypes.bool,
|
|
65
|
-
required: PropTypes.bool,
|
|
66
|
-
forLabel: PropTypes.string,
|
|
67
|
-
errorMessage: PropTypes.string,
|
|
68
|
-
sx: PropTypes.object,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
64
|
Input.displayName = 'Input';
|
|
72
|
-
|
|
73
|
-
export { Input };
|
|
@@ -25,6 +25,13 @@ export const Default = () => {
|
|
|
25
25
|
forLabel="input-simple"
|
|
26
26
|
copyHandler={ value => setCopiedText( value ) }
|
|
27
27
|
/>
|
|
28
|
+
<Form.InputWithCopyButton
|
|
29
|
+
value="Copy me!"
|
|
30
|
+
label="This is a readonly input"
|
|
31
|
+
forLabel="input-simple"
|
|
32
|
+
readOnly
|
|
33
|
+
copyHandler={ value => setCopiedText( value ) }
|
|
34
|
+
/>
|
|
28
35
|
</Form.Root>
|
|
29
36
|
);
|
|
30
37
|
};
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import
|
|
8
|
-
import { Box } from 'theme-ui';
|
|
7
|
+
import { Box, BoxProps } from 'theme-ui';
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
@@ -13,13 +12,18 @@ import { RequiredLabel } from './RequiredLabel';
|
|
|
13
12
|
|
|
14
13
|
export const baseLabelColor = 'input.label.default';
|
|
15
14
|
export const baseLabelStyle = {
|
|
16
|
-
fontWeight:
|
|
15
|
+
fontWeight: 'heading',
|
|
17
16
|
fontSize: 2,
|
|
18
17
|
lineHeight: 1.5,
|
|
19
18
|
color: baseLabelColor,
|
|
20
19
|
};
|
|
20
|
+
interface LabelProps extends BoxProps {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
required?: boolean;
|
|
23
|
+
htmlFor?: string;
|
|
24
|
+
}
|
|
21
25
|
|
|
22
|
-
const Label = React.forwardRef(
|
|
26
|
+
export const Label = React.forwardRef< HTMLLabelElement, LabelProps >(
|
|
23
27
|
( { sx, children, required, as = 'label', ...rest }, forwardRef ) => (
|
|
24
28
|
<Box
|
|
25
29
|
as={ as }
|
|
@@ -39,13 +43,4 @@ const Label = React.forwardRef(
|
|
|
39
43
|
)
|
|
40
44
|
);
|
|
41
45
|
|
|
42
|
-
Label.propTypes = {
|
|
43
|
-
children: PropTypes.any,
|
|
44
|
-
required: PropTypes.bool,
|
|
45
|
-
sx: PropTypes.object,
|
|
46
|
-
as: PropTypes.node,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
46
|
Label.displayName = 'Label';
|
|
50
|
-
|
|
51
|
-
export { Label };
|
package/src/system/Form/Radio.js
CHANGED
|
@@ -20,7 +20,7 @@ const itemStyle = {
|
|
|
20
20
|
my: 2,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const radioPosition = mainTheme.space[
|
|
23
|
+
const radioPosition = mainTheme.space[ 5 ];
|
|
24
24
|
|
|
25
25
|
const inputStyle = {
|
|
26
26
|
...screenReaderTextClass,
|
|
@@ -47,11 +47,11 @@ const labelStyle = {
|
|
|
47
47
|
marginBottom: 0,
|
|
48
48
|
userSelect: 'none',
|
|
49
49
|
color: inputBaseText,
|
|
50
|
-
lineHeight:
|
|
50
|
+
lineHeight: 'body',
|
|
51
51
|
'&:before, &:after': {
|
|
52
|
-
borderRadius: '
|
|
52
|
+
borderRadius: '100%',
|
|
53
53
|
position: 'absolute',
|
|
54
|
-
top:
|
|
54
|
+
top: 1,
|
|
55
55
|
left: `${ -1 * radioPosition }px`,
|
|
56
56
|
transition: 'all .3s ease-out',
|
|
57
57
|
zIndex: 2,
|
|
@@ -23,7 +23,7 @@ export const Toggle = React.forwardRef(
|
|
|
23
23
|
position: 'relative',
|
|
24
24
|
width: 40,
|
|
25
25
|
height: 20,
|
|
26
|
-
borderRadius:
|
|
26
|
+
borderRadius: 5,
|
|
27
27
|
backgroundColor: 'muted',
|
|
28
28
|
backgroundRepeat: 'no-repeat',
|
|
29
29
|
backgroundPosition: 'right 2px top 2px',
|
|
@@ -54,7 +54,7 @@ export const Toggle = React.forwardRef(
|
|
|
54
54
|
width: 16,
|
|
55
55
|
height: 16,
|
|
56
56
|
backgroundColor: 'white',
|
|
57
|
-
borderRadius: '
|
|
57
|
+
borderRadius: '100%',
|
|
58
58
|
boxShadow: 'rgb(0 0 0 / 5%) 0px 1px 5px, rgb(0 0 0 / 15%) 0px 1px 1px',
|
|
59
59
|
transition: 'transform 100ms',
|
|
60
60
|
transform: 'translateX(2px)',
|
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
6
|
import { MdErrorOutline, MdCheckCircle } from 'react-icons/md';
|
|
8
7
|
|
|
9
8
|
const errorColor = 'texts.error';
|
|
10
9
|
const helperColor = 'texts.helper';
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
interface ValidationProps {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
isValid?: boolean;
|
|
14
|
+
describedId?: string;
|
|
15
|
+
}
|
|
14
16
|
|
|
17
|
+
export const Validation = ( { children, isValid, describedId, ...props }: ValidationProps ) => {
|
|
15
18
|
return (
|
|
16
19
|
<p
|
|
17
20
|
sx={ {
|
|
@@ -24,16 +27,12 @@ const Validation = ( { children, isValid, describedId = null, ...props } ) => {
|
|
|
24
27
|
id={ describedId ? `describe-${ describedId }-validation` : undefined }
|
|
25
28
|
{ ...props }
|
|
26
29
|
>
|
|
27
|
-
|
|
30
|
+
{ isValid ? (
|
|
31
|
+
<MdCheckCircle sx={ { mr: 1 } } aria-hidden="true" />
|
|
32
|
+
) : (
|
|
33
|
+
<MdErrorOutline sx={ { mr: 1 } } aria-hidden="true" />
|
|
34
|
+
) }
|
|
28
35
|
{ children }
|
|
29
36
|
</p>
|
|
30
37
|
);
|
|
31
38
|
};
|
|
32
|
-
|
|
33
|
-
Validation.propTypes = {
|
|
34
|
-
children: PropTypes.node,
|
|
35
|
-
isValid: PropTypes.bool,
|
|
36
|
-
describedId: PropTypes.string,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export { Validation };
|
package/src/system/Link/Link.tsx
CHANGED
|
@@ -17,7 +17,7 @@ export const Link = forwardRef< HTMLAnchorElement, LinkProps >(
|
|
|
17
17
|
( { active = false, sx, ...props }: LinkProps, ref: Ref< HTMLAnchorElement > ) => (
|
|
18
18
|
<ThemeLink
|
|
19
19
|
sx={ {
|
|
20
|
-
|
|
20
|
+
textDecorationThickness: '0.1em',
|
|
21
21
|
textUnderlineOffset: '0.1em',
|
|
22
22
|
color: active ? 'links.active' : 'link',
|
|
23
23
|
'&:visited': {
|
|
@@ -39,8 +39,8 @@ export const DialogCloseDefault = React.forwardRef( ( props, forwardedRef ) => (
|
|
|
39
39
|
justifyContent: 'center',
|
|
40
40
|
color: 'icon.primary',
|
|
41
41
|
position: 'absolute',
|
|
42
|
-
top:
|
|
43
|
-
right:
|
|
42
|
+
top: 3,
|
|
43
|
+
right: 3,
|
|
44
44
|
|
|
45
45
|
'&:hover': {
|
|
46
46
|
backgroundColor: 'borders.2',
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
export const contentStyles = {
|
|
4
4
|
background: 'dialog',
|
|
5
5
|
variant: 'dialog.modal',
|
|
6
|
-
borderRadius:
|
|
7
|
-
boxShadow: '
|
|
6
|
+
borderRadius: 2,
|
|
7
|
+
boxShadow: 'medium',
|
|
8
8
|
position: 'fixed',
|
|
9
9
|
top: '50%',
|
|
10
10
|
left: '50%',
|
|
@@ -12,6 +12,6 @@ export const contentStyles = {
|
|
|
12
12
|
width: '90vw',
|
|
13
13
|
maxWidth: '640px',
|
|
14
14
|
maxHeight: '85vh',
|
|
15
|
-
padding:
|
|
15
|
+
padding: 6,
|
|
16
16
|
'> h1, > h2': { marginTop: '0 !important' },
|
|
17
17
|
};
|
|
@@ -19,7 +19,9 @@ export const DialogTitle = ( { title, hidden = false } ) => {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<DialogPrimitive.Title
|
|
22
|
+
<DialogPrimitive.Title
|
|
23
|
+
sx={ { margin: 0, fontSize: 3, fontWeight: 'medium', color: 'heading' } }
|
|
24
|
+
>
|
|
23
25
|
{ titleNode }
|
|
24
26
|
</DialogPrimitive.Title>
|
|
25
27
|
);
|
|
@@ -10,7 +10,6 @@ import { useState } from 'react';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import { Button, Text, Input, Label } from '../../system';
|
|
13
|
-
import ScreenReaderText from '../ScreenReaderText';
|
|
14
13
|
import * as NewDialog from '.';
|
|
15
14
|
|
|
16
15
|
export default {
|
|
@@ -33,31 +32,6 @@ export const Default = () => (
|
|
|
33
32
|
</>
|
|
34
33
|
);
|
|
35
34
|
|
|
36
|
-
export const AutoOpen = () => (
|
|
37
|
-
<>
|
|
38
|
-
<Text sx={ { fontSize: 3, mb: 3 } }>Auto Opens when rendered. Press escape to close it.</Text>
|
|
39
|
-
<NewDialog.Root
|
|
40
|
-
{ ...defaultProps }
|
|
41
|
-
defaultOpen={ true }
|
|
42
|
-
content={
|
|
43
|
-
<div>
|
|
44
|
-
<h3>Test</h3>
|
|
45
|
-
<p>
|
|
46
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
|
|
47
|
-
has been the industry standard dummy text ever since the 1500s, when an unknown printer
|
|
48
|
-
took a galley of type and scrambled it to make a type specimen book. It has survived not
|
|
49
|
-
only five centuries, but also the leap into electronic typesetting, remaining
|
|
50
|
-
essentially unchanged. It was popularised in the 1960s with the release of Letraset
|
|
51
|
-
sheets containing Lorem Ipsum passages, and more recently with desktop publishing
|
|
52
|
-
software like Aldus PageMaker including versions of Lorem Ipsum.
|
|
53
|
-
</p>
|
|
54
|
-
</div>
|
|
55
|
-
}
|
|
56
|
-
trigger={ <ScreenReaderText>hey</ScreenReaderText> }
|
|
57
|
-
/>
|
|
58
|
-
</>
|
|
59
|
-
);
|
|
60
|
-
|
|
61
35
|
export const HiddenHeadings = () => (
|
|
62
36
|
<>
|
|
63
37
|
<Text sx={ { fontSize: 3, mb: 3 } }>
|
|
@@ -96,7 +70,6 @@ export const CustomStyling = () => (
|
|
|
96
70
|
|
|
97
71
|
<NewDialog.Root
|
|
98
72
|
{ ...defaultProps }
|
|
99
|
-
defaultOpen
|
|
100
73
|
trigger={ <Button>Trigger Dialog</Button> }
|
|
101
74
|
title="Custom dialog title"
|
|
102
75
|
style={ {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { baseControlBorderStyle, inputBaseBackground, inputBaseText } from '../Form/Input.styles';
|
|
14
|
+
import { ThemeUIStyleObject } from 'theme-ui';
|
|
15
|
+
|
|
16
|
+
interface FieldsetProps {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
sx?: ThemeUIStyleObject;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export const Fieldset = React.forwardRef< HTMLFieldSetElement, FieldsetProps >(
|
|
22
|
+
( { children, className, sx = {}, ...props }, forwardRef ) => (
|
|
23
|
+
<fieldset
|
|
24
|
+
ref={ forwardRef }
|
|
25
|
+
className={ classNames( 'vip-form-fieldset-component', className ) }
|
|
26
|
+
sx={ {
|
|
27
|
+
all: 'unset',
|
|
28
|
+
...baseControlBorderStyle,
|
|
29
|
+
backgroundColor: inputBaseBackground,
|
|
30
|
+
color: inputBaseText,
|
|
31
|
+
borderRadius: 1,
|
|
32
|
+
display: 'block',
|
|
33
|
+
pt: 1,
|
|
34
|
+
pb: 2,
|
|
35
|
+
px: 3,
|
|
36
|
+
mb: 3,
|
|
37
|
+
...sx,
|
|
38
|
+
} }
|
|
39
|
+
{ ...props }
|
|
40
|
+
>
|
|
41
|
+
{ children }
|
|
42
|
+
</fieldset>
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
Fieldset.displayName = 'Fieldset';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
export interface FormProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export const Form = React.forwardRef< HTMLFormElement, FormProps >(
|
|
11
|
+
( { children, className, ...props }, forwardRef ) => (
|
|
12
|
+
<form
|
|
13
|
+
ref={ forwardRef }
|
|
14
|
+
className={ classNames( 'vip-form-component', className ) }
|
|
15
|
+
noValidate
|
|
16
|
+
{ ...props }
|
|
17
|
+
>
|
|
18
|
+
{ children }
|
|
19
|
+
</form>
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
Form.displayName = 'Form';
|
|
@@ -38,17 +38,6 @@
|
|
|
38
38
|
cursor: pointer;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
/* .autocomplete__dropdown-arrow-down {
|
|
42
|
-
z-index: -1;
|
|
43
|
-
display: inline-block;
|
|
44
|
-
position: absolute;
|
|
45
|
-
right: 8px;
|
|
46
|
-
width: 24px;
|
|
47
|
-
height: 24px;
|
|
48
|
-
top: 10px;
|
|
49
|
-
pointer-events: none;
|
|
50
|
-
} */
|
|
51
|
-
|
|
52
41
|
.autocomplete__menu {
|
|
53
42
|
background-color: #fff;
|
|
54
43
|
border: 2px solid #0b0c0c;
|