@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,73 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
);
|
|
60
|
-
|
|
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
|
-
Input.displayName = 'Input';
|
|
72
|
-
|
|
73
|
-
export { Input };
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Input = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _ = require("../");
|
|
7
|
+
var _themeUi = require("theme-ui");
|
|
8
|
+
var _Input = require("./Input.styles");
|
|
9
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
|
+
var _excluded = ["label", "forLabel", "hasError", "required", "sx", "errorMessage"];
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
13
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /** @jsxImportSource theme-ui */ /**
|
|
14
|
+
* External dependencies
|
|
15
|
+
*/ /**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
var inputStyles = _extends({
|
|
19
|
+
unset: 'all'
|
|
20
|
+
}, _Input.baseControlStyle, {
|
|
21
|
+
lineHeight: 'inherit',
|
|
22
|
+
minHeight: '36px',
|
|
23
|
+
px: 3,
|
|
24
|
+
py: 2,
|
|
25
|
+
fontSize: 2,
|
|
26
|
+
mb: 2,
|
|
27
|
+
variant: 'inputs.default'
|
|
28
|
+
});
|
|
29
|
+
var Input = exports.Input = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
30
|
+
var label = _ref.label,
|
|
31
|
+
forLabel = _ref.forLabel,
|
|
32
|
+
_ref$hasError = _ref.hasError,
|
|
33
|
+
hasError = _ref$hasError === void 0 ? false : _ref$hasError,
|
|
34
|
+
required = _ref.required,
|
|
35
|
+
_ref$sx = _ref.sx,
|
|
36
|
+
sx = _ref$sx === void 0 ? {} : _ref$sx,
|
|
37
|
+
errorMessage = _ref.errorMessage,
|
|
38
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
39
|
+
return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
40
|
+
children: [label && (0, _jsxRuntime.jsx)(_.Label, {
|
|
41
|
+
required: required,
|
|
42
|
+
htmlFor: forLabel,
|
|
43
|
+
children: label
|
|
44
|
+
}), (0, _jsxRuntime.jsx)(_themeUi.Input, _extends({
|
|
45
|
+
ref: ref,
|
|
46
|
+
id: forLabel,
|
|
47
|
+
required: required,
|
|
48
|
+
"aria-required": required,
|
|
49
|
+
"aria-describedby": hasError ? "describe-" + forLabel + "-validation" : undefined,
|
|
50
|
+
sx: _extends({}, inputStyles, sx, hasError ? {
|
|
51
|
+
borderColor: 'input.border.error'
|
|
52
|
+
} : {})
|
|
53
|
+
}, props)), hasError && errorMessage && (0, _jsxRuntime.jsx)(_.Validation, {
|
|
54
|
+
isValid: false,
|
|
55
|
+
describedId: forLabel,
|
|
56
|
+
children: errorMessage
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
Input.displayName = 'Input';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
};
|
|
4
6
|
export default _default;
|
|
5
|
-
export
|
|
7
|
+
export declare const Default: () => import("react").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Default = void 0;
|
|
5
|
+
var _ = require("..");
|
|
6
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
|
+
/** @jsxImportSource theme-ui */
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
var _default = exports["default"] = {
|
|
12
|
+
title: 'Form/Input'
|
|
13
|
+
};
|
|
14
|
+
var Default = exports.Default = function Default() {
|
|
15
|
+
return (0, _jsxRuntime.jsxs)(_.Form.Root, {
|
|
16
|
+
children: [(0, _jsxRuntime.jsx)(_.Form.Input, {
|
|
17
|
+
placeholder: "Your input here...",
|
|
18
|
+
label: "Always add a label to inputs",
|
|
19
|
+
forLabel: "input-simple"
|
|
20
|
+
}), (0, _jsxRuntime.jsx)("hr", {
|
|
21
|
+
sx: {
|
|
22
|
+
my: 4
|
|
23
|
+
}
|
|
24
|
+
}), (0, _jsxRuntime.jsx)(_.Form.Input, {
|
|
25
|
+
forLabel: "input-with-error",
|
|
26
|
+
label: "Error Input",
|
|
27
|
+
errorMessage: "Please type numeric characters only",
|
|
28
|
+
hasError: true
|
|
29
|
+
}), (0, _jsxRuntime.jsx)("hr", {
|
|
30
|
+
sx: {
|
|
31
|
+
my: 4
|
|
32
|
+
}
|
|
33
|
+
}), (0, _jsxRuntime.jsx)(_.Form.Input, {
|
|
34
|
+
forLabel: "input-with-required",
|
|
35
|
+
label: "Required",
|
|
36
|
+
required: true
|
|
37
|
+
}), (0, _jsxRuntime.jsx)("hr", {
|
|
38
|
+
sx: {
|
|
39
|
+
my: 4
|
|
40
|
+
}
|
|
41
|
+
}), (0, _jsxRuntime.jsx)(_.Form.Label, {
|
|
42
|
+
htmlFor: "input-with-custom-label",
|
|
43
|
+
children: "Custom Label outside the Input"
|
|
44
|
+
}), (0, _jsxRuntime.jsx)(_.Form.Input, {
|
|
45
|
+
forLabel: "input-with-custom-label",
|
|
46
|
+
required: true
|
|
47
|
+
}), (0, _jsxRuntime.jsx)(_.Form.Input, {
|
|
48
|
+
forLabel: "input-readonly",
|
|
49
|
+
readOnly: true,
|
|
50
|
+
value: "This is a readonly input"
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
};
|
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Theme } from 'theme-ui';
|
|
2
|
+
export declare const baseControlBorderStyle: {
|
|
3
|
+
borderWidth: string;
|
|
4
|
+
borderStyle: string;
|
|
5
|
+
borderColor: string;
|
|
6
|
+
};
|
|
7
|
+
interface InputTheme extends Theme {
|
|
8
|
+
outline?: Record<string, string>;
|
|
5
9
|
}
|
|
6
|
-
export const inputBaseText
|
|
7
|
-
export const inputBaseBackground
|
|
8
|
-
export const baseControlFocusStyle: {
|
|
9
|
-
'&:focus': (theme:
|
|
10
|
-
'&:focus-visible': (theme:
|
|
11
|
-
'&:focus-within': (theme:
|
|
10
|
+
export declare const inputBaseText = "input.text.default";
|
|
11
|
+
export declare const inputBaseBackground = "input.background.default";
|
|
12
|
+
export declare const baseControlFocusStyle: {
|
|
13
|
+
'&:focus': (theme: InputTheme) => Record<string, string> | undefined;
|
|
14
|
+
'&:focus-visible': (theme: InputTheme) => Record<string, string> | undefined;
|
|
15
|
+
'&:focus-within': (theme: InputTheme) => Record<string, string> | undefined;
|
|
12
16
|
};
|
|
13
|
-
export const baseControlStyle: {
|
|
17
|
+
export declare const baseControlStyle: {
|
|
14
18
|
'&:disabled': {
|
|
15
19
|
borderColor: string;
|
|
16
20
|
};
|
|
21
|
+
'&:read-only': {
|
|
22
|
+
borderColor: string;
|
|
23
|
+
backgroundColor: string;
|
|
24
|
+
};
|
|
17
25
|
'&::placeholder': {
|
|
18
26
|
color: string;
|
|
19
27
|
opacity: number;
|
|
20
28
|
};
|
|
21
|
-
'&:focus': (theme:
|
|
22
|
-
'&:focus-visible': (theme:
|
|
23
|
-
'&:focus-within': (theme:
|
|
29
|
+
'&:focus': (theme: InputTheme) => Record<string, string> | undefined;
|
|
30
|
+
'&:focus-visible': (theme: InputTheme) => Record<string, string> | undefined;
|
|
31
|
+
'&:focus-within': (theme: InputTheme) => Record<string, string> | undefined;
|
|
24
32
|
backgroundColor: string;
|
|
25
33
|
color: string;
|
|
26
34
|
borderRadius: number;
|
|
@@ -30,3 +38,4 @@ export const baseControlStyle: {
|
|
|
30
38
|
borderStyle: string;
|
|
31
39
|
borderColor: string;
|
|
32
40
|
};
|
|
41
|
+
export {};
|
|
@@ -1,32 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
borderWidth: '1px',
|
|
3
|
-
borderStyle: 'solid',
|
|
4
|
-
borderColor: 'input.border.default',
|
|
5
|
-
};
|
|
1
|
+
"use strict";
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.inputBaseText = exports.inputBaseBackground = exports.baseControlStyle = exports.baseControlFocusStyle = exports.baseControlBorderStyle = void 0;
|
|
5
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
|
+
var baseControlBorderStyle = exports.baseControlBorderStyle = {
|
|
7
|
+
borderWidth: '1px',
|
|
8
|
+
borderStyle: 'solid',
|
|
9
|
+
borderColor: 'input.border.default'
|
|
13
10
|
};
|
|
11
|
+
// Temporary interface until we add types to the theme definition.
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'&::placeholder': {
|
|
29
|
-
color: 'input.text.placeholder',
|
|
30
|
-
opacity: 1,
|
|
31
|
-
},
|
|
13
|
+
var inputBaseText = exports.inputBaseText = 'input.text.default';
|
|
14
|
+
var inputBaseBackground = exports.inputBaseBackground = 'input.background.default';
|
|
15
|
+
var baseControlFocusStyle = exports.baseControlFocusStyle = {
|
|
16
|
+
'&:focus': function focus(theme) {
|
|
17
|
+
return theme.outline;
|
|
18
|
+
},
|
|
19
|
+
'&:focus-visible': function focusVisible(theme) {
|
|
20
|
+
return theme.outline;
|
|
21
|
+
},
|
|
22
|
+
'&:focus-within': function focusWithin(theme) {
|
|
23
|
+
return theme.outline;
|
|
24
|
+
}
|
|
32
25
|
};
|
|
26
|
+
var baseControlStyle = exports.baseControlStyle = _extends({}, baseControlBorderStyle, {
|
|
27
|
+
backgroundColor: inputBaseBackground,
|
|
28
|
+
color: inputBaseText,
|
|
29
|
+
borderRadius: 1,
|
|
30
|
+
display: 'block',
|
|
31
|
+
width: '100%'
|
|
32
|
+
}, baseControlFocusStyle, {
|
|
33
|
+
'&:disabled': {
|
|
34
|
+
borderColor: 'input.border.disabled'
|
|
35
|
+
},
|
|
36
|
+
'&:read-only': {
|
|
37
|
+
borderColor: 'input.border.disabled',
|
|
38
|
+
backgroundColor: 'input.background.read-only'
|
|
39
|
+
},
|
|
40
|
+
'&::placeholder': {
|
|
41
|
+
color: 'input.text.placeholder',
|
|
42
|
+
opacity: 1
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -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
|
};
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export let lineHeight: number;
|
|
6
|
-
export { baseLabelColor as color };
|
|
7
|
-
}
|
|
8
|
-
export const Label: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
9
5
|
import React from 'react';
|
|
6
|
+
import { BoxProps } from 'theme-ui';
|
|
7
|
+
export declare const baseLabelColor = "input.label.default";
|
|
8
|
+
export declare const baseLabelStyle: {
|
|
9
|
+
fontWeight: string;
|
|
10
|
+
fontSize: number;
|
|
11
|
+
lineHeight: number;
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
interface LabelProps extends BoxProps {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
htmlFor?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
20
|
+
export {};
|
|
@@ -1,51 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.baseLabelStyle = exports.baseLabelColor = exports.Label = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _themeUi = require("theme-ui");
|
|
7
|
+
var _RequiredLabel = require("./RequiredLabel");
|
|
8
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
+
var _excluded = ["sx", "children", "required", "as"];
|
|
10
|
+
/** @jsxImportSource theme-ui */
|
|
3
11
|
/**
|
|
4
12
|
* External dependencies
|
|
5
13
|
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import { Box } from 'theme-ui';
|
|
9
14
|
/**
|
|
10
15
|
* Internal dependencies
|
|
11
16
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const Label = React.forwardRef(
|
|
23
|
-
( { sx, children, required, as = 'label', ...rest }, forwardRef ) => (
|
|
24
|
-
<Box
|
|
25
|
-
as={ as }
|
|
26
|
-
sx={ {
|
|
27
|
-
all: 'unset',
|
|
28
|
-
...baseLabelStyle,
|
|
29
|
-
display: 'block',
|
|
30
|
-
mb: 2,
|
|
31
|
-
...sx,
|
|
32
|
-
} }
|
|
33
|
-
ref={ forwardRef }
|
|
34
|
-
{ ...rest }
|
|
35
|
-
>
|
|
36
|
-
{ children }
|
|
37
|
-
{ required && <RequiredLabel /> }
|
|
38
|
-
</Box>
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
Label.propTypes = {
|
|
43
|
-
children: PropTypes.any,
|
|
44
|
-
required: PropTypes.bool,
|
|
45
|
-
sx: PropTypes.object,
|
|
46
|
-
as: PropTypes.node,
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
+
var baseLabelColor = exports.baseLabelColor = 'input.label.default';
|
|
21
|
+
var baseLabelStyle = exports.baseLabelStyle = {
|
|
22
|
+
fontWeight: 'heading',
|
|
23
|
+
fontSize: 2,
|
|
24
|
+
lineHeight: 1.5,
|
|
25
|
+
color: baseLabelColor
|
|
47
26
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
27
|
+
var Label = exports.Label = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
28
|
+
var sx = _ref.sx,
|
|
29
|
+
children = _ref.children,
|
|
30
|
+
required = _ref.required,
|
|
31
|
+
_ref$as = _ref.as,
|
|
32
|
+
as = _ref$as === void 0 ? 'label' : _ref$as,
|
|
33
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
34
|
+
return (0, _jsxRuntime.jsxs)(_themeUi.Box, _extends({
|
|
35
|
+
as: as,
|
|
36
|
+
sx: _extends({
|
|
37
|
+
all: 'unset'
|
|
38
|
+
}, baseLabelStyle, {
|
|
39
|
+
display: 'block',
|
|
40
|
+
mb: 2
|
|
41
|
+
}, sx),
|
|
42
|
+
ref: forwardRef
|
|
43
|
+
}, rest, {
|
|
44
|
+
children: [children, required && (0, _jsxRuntime.jsx)(_RequiredLabel.RequiredLabel, {})]
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
Label.displayName = 'Label';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
};
|
|
4
6
|
export default _default;
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
+
export declare const Default: () => import("react").JSX.Element;
|
|
8
|
+
export declare const Required: () => import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Required = exports.Default = void 0;
|
|
5
|
+
var _ = require("..");
|
|
6
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /** @jsxImportSource theme-ui */ /**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
var _default = exports["default"] = {
|
|
11
|
+
title: 'Form/Label'
|
|
12
|
+
};
|
|
13
|
+
var DefaultComponent = function DefaultComponent(props) {
|
|
14
|
+
return (0, _jsxRuntime.jsx)(_.Form.Root, {
|
|
15
|
+
children: (0, _jsxRuntime.jsx)(_.Label, _extends({}, props, {
|
|
16
|
+
children: "Label"
|
|
17
|
+
}))
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var Default = exports.Default = function Default() {
|
|
21
|
+
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
22
|
+
children: (0, _jsxRuntime.jsx)(DefaultComponent, {})
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var Required = exports.Required = function Required() {
|
|
26
|
+
var args = {
|
|
27
|
+
required: true
|
|
28
|
+
};
|
|
29
|
+
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
30
|
+
children: (0, _jsxRuntime.jsx)(DefaultComponent, _extends({}, args))
|
|
31
|
+
});
|
|
32
|
+
};
|
|
@@ -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,
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.RequiredLabel = void 0;
|
|
5
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
1
6
|
/** @jsxImportSource theme-ui */
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
* External dependencies
|
|
5
10
|
*/
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
var RequiredLabel = exports.RequiredLabel = function RequiredLabel() {
|
|
13
|
+
return (0, _jsxRuntime.jsx)("span", {
|
|
14
|
+
sx: {
|
|
15
|
+
color: 'texts.helper',
|
|
16
|
+
display: 'inline-block',
|
|
17
|
+
ml: 2,
|
|
18
|
+
fontSize: 1
|
|
19
|
+
},
|
|
20
|
+
children: "(Required)"
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -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)',
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export namespace Validation {
|
|
8
|
-
namespace propTypes {
|
|
9
|
-
let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
10
|
-
let isValid: PropTypes.Requireable<boolean>;
|
|
11
|
-
let describedId: PropTypes.Requireable<string>;
|
|
12
|
-
}
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
interface ValidationProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
isValid?: boolean;
|
|
6
|
+
describedId?: string;
|
|
13
7
|
}
|
|
14
|
-
|
|
8
|
+
export declare const Validation: ({ children, isValid, describedId, ...props }: ValidationProps) => import("react").JSX.Element;
|
|
9
|
+
export {};
|