@elliemae/ds-form-layout-blocks 2.0.0-alpha.1 → 2.0.0-alpha.13

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.
@@ -3,8 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
- require('react');
6
+ var React = require('react');
7
7
  var reactDesc = require('react-desc');
8
+ var uid = require('uid');
8
9
  var propTypes = require('./propTypes.js');
9
10
  var styles = require('./styles.js');
10
11
 
@@ -17,7 +18,7 @@ const DSFormLayoutBlockItem = props => {
17
18
  label,
18
19
  feedbackMessage,
19
20
  validationMessage,
20
- labelFor,
21
+ inputID,
21
22
  children,
22
23
  hasError,
23
24
  leftLabel,
@@ -25,24 +26,38 @@ const DSFormLayoutBlockItem = props => {
25
26
  optional,
26
27
  hideLabel,
27
28
  fitContent,
28
- withHighlight
29
+ withHighlight,
30
+ isGroup = false
29
31
  } = props;
30
- return /*#__PURE__*/_jsx__default['default'](styles.StyledContainer, {
32
+ const instanceUID = React.useMemo(() => uid.uid(6), []);
33
+ return /*#__PURE__*/_jsx__default["default"](styles.StyledContainer, {
31
34
  leftLabel: leftLabel,
32
35
  fitContent: fitContent,
33
36
  hideLabel: hideLabel,
34
- withHighlight: withHighlight
35
- }, void 0, /*#__PURE__*/_jsx__default['default'](styles.StyledLabel, {
36
- htmlFor: labelFor,
37
+ withHighlight: withHighlight,
38
+ as: isGroup ? 'fieldset' : 'div',
39
+ isGroup: isGroup,
40
+ "aria-describedby": "".concat(inputID || instanceUID, "_feedback_message")
41
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styles.StyledLabel, {
42
+ htmlFor: inputID,
37
43
  leftLabel: leftLabel,
38
- hideLabel: hideLabel
39
- }, void 0, label, (required || optional) && /*#__PURE__*/_jsx__default['default'](styles.StyledMark, {
44
+ hideLabel: hideLabel,
45
+ "aria-hidden": isGroup
46
+ }, void 0, label, (required || optional) && /*#__PURE__*/_jsx__default["default"](styles.StyledMark, {
40
47
  required: required
41
- })), children, (validationMessage || feedbackMessage) && /*#__PURE__*/_jsx__default['default'](styles.StyledMessage, {
48
+ })), isGroup && /*#__PURE__*/_jsx__default["default"](styles.ScreenReaderOnly, {
49
+ as: "legend"
50
+ }, void 0, label), children, feedbackMessage && !hasError && /*#__PURE__*/_jsx__default["default"](styles.StyledMessage, {
51
+ leftLabel: leftLabel,
52
+ hideLabel: hideLabel,
53
+ "aria-hidden": isGroup,
54
+ id: "".concat(inputID || instanceUID, "_feedback_message")
55
+ }, void 0, feedbackMessage), validationMessage && hasError && /*#__PURE__*/_jsx__default["default"](styles.StyledMessage, {
42
56
  hasError: hasError,
43
57
  leftLabel: leftLabel,
44
- hideLabel: hideLabel
45
- }, void 0, hasError ? validationMessage : feedbackMessage));
58
+ hideLabel: hideLabel,
59
+ role: "alert"
60
+ }, void 0, validationMessage));
46
61
  };
47
62
 
48
63
  const DSFormLayoutBlockItemWithSchema = reactDesc.describe(DSFormLayoutBlockItem);
@@ -7,7 +7,7 @@ var reactDesc = require('react-desc');
7
7
  const propTypes = {
8
8
  children: reactDesc.PropTypes.node.isRequired.description('Input component. '),
9
9
  label: reactDesc.PropTypes.string.isRequired.description('Label property for the input component. This property is required for accesibility purposes.'),
10
- labelFor: reactDesc.PropTypes.string.isRequired.description("String that matches the input component's id. This property is required for accesibility purposes."),
10
+ inputID: reactDesc.PropTypes.string.isRequired.description("String that matches the input component's id. This property is required for accesibility purposes."),
11
11
  feedbackMessage: reactDesc.PropTypes.string.description('Feedback message to show below the input component.'),
12
12
  validationMessage: reactDesc.PropTypes.string.description('Validation message to show below the input component. It requires hasError property set to true to be visible.'),
13
13
  hasError: reactDesc.PropTypes.bool.description('Helper boolean property for the validation message.'),
@@ -16,7 +16,8 @@ const propTypes = {
16
16
  fitContent: reactDesc.PropTypes.bool.description('Set the width of the layout to the input component.'),
17
17
  leftLabel: reactDesc.PropTypes.bool.description('Adds the label at the left of the input component.'),
18
18
  hideLabel: reactDesc.PropTypes.bool.description('Hides the input label. It still requires label and labelFor property for accesibility purposes'),
19
- withHighlight: reactDesc.PropTypes.bool.description('Adds highlight extra styling. It requires extra spacing, please check withHighlight explanation tab.')
19
+ withHighlight: reactDesc.PropTypes.bool.description('Adds highlight extra styling. It requires extra spacing, please check withHighlight explanation tab.'),
20
+ isGroup: reactDesc.PropTypes.bool.description('Sets the HTML elements as fieldset and legend. This should be used when you want to group more than one input.')
20
21
  };
21
22
 
22
23
  exports.propTypes = propTypes;
@@ -8,88 +8,84 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
10
10
 
11
- const StyledContainer = /*#__PURE__*/styled__default['default'].div.withConfig({
11
+ const StyledContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
12
12
  componentId: "sc-196zgtg-0"
13
- })(["position:relative;", " display:grid;", " align-items:center;", ""], ({
14
- fitContent
15
- }) => fitContent ? 'width: fit-content;' : undefined, ({
16
- leftLabel,
17
- hideLabel
18
- }) => leftLabel && !hideLabel ? 'grid-template-columns: max-content auto;' : undefined, ({
19
- theme,
20
- withHighlight
21
- }) => withHighlight ? `
22
- &::after {
23
- position: absolute;
24
- content: '';
25
- left: -${theme.space.xxs};
26
- top: -${theme.space.xxxs};
27
- z-index: -1;
28
- width: calc(100% + ${theme.space.xs});
29
- height: calc(100% + ${theme.space.xxs});
30
- background-color: #FEFBEE;
31
- border : 1px solid #8F6326;
32
- border-radius : 4px;
33
- box-shadow: 0 1px 3px 0 rgba(0,0,0,0.35);
34
- }
35
- &:hover,
36
- &:focus-within {
37
- &::after {
38
- position: absolute;
39
- content: '';
40
- left: -${theme.space.xxs};
41
- top: -${theme.space.xxxs};
42
- z-index: -1;
43
- width: calc(100% + ${theme.space.xs});
44
- height: calc(100% + ${theme.space.xxs});
45
- background-color: #FFF9D3;
46
- border : 1px solid #8F6326;
47
- border-radius : 4px;
48
- box-shadow: 0 6px 10px 0 rgba(0,0,0,0.30);
49
- }
50
- }
51
- ` : undefined);
52
- const StyledLabel = /*#__PURE__*/styled__default['default'].label.withConfig({
13
+ })(["position:relative;padding:0;margin:0;display:grid;", " ", ";", " align-items:center;", ""], _ref => {
14
+ let {
15
+ fitContent
16
+ } = _ref;
17
+ return fitContent ? 'width: fit-content;' : undefined;
18
+ }, _ref2 => {
19
+ let {
20
+ isGroup
21
+ } = _ref2;
22
+ return isGroup ? 'border: none' : '';
23
+ }, _ref3 => {
24
+ let {
25
+ leftLabel,
26
+ hideLabel
27
+ } = _ref3;
28
+ return leftLabel && !hideLabel ? 'grid-template-columns: max-content auto;' : undefined;
29
+ }, _ref4 => {
30
+ let {
31
+ theme,
32
+ withHighlight
33
+ } = _ref4;
34
+ return withHighlight ? "\n &::after {\n position: absolute;\n content: '';\n left: -".concat(theme.space.xxs, ";\n top: -").concat(theme.space.xxxs, ";\n z-index: -1;\n width: calc(100% + ").concat(theme.space.xs, ");\n height: calc(100% + ").concat(theme.space.xxs, ");\n background-color: #FEFBEE;\n border : 1px solid #8F6326;\n border-radius : 4px;\n box-shadow: 0 1px 3px 0 rgba(0,0,0,0.35);\n }\n &:hover, \n &:focus-within {\n &::after {\n position: absolute;\n content: '';\n left: -").concat(theme.space.xxs, ";\n top: -").concat(theme.space.xxxs, ";\n z-index: -1;\n width: calc(100% + ").concat(theme.space.xs, ");\n height: calc(100% + ").concat(theme.space.xxs, ");\n background-color: #FFF9D3;\n border : 1px solid #8F6326;\n border-radius : 4px;\n box-shadow: 0 6px 10px 0 rgba(0,0,0,0.30);\n }\n }\n ") : undefined;
35
+ });
36
+ const StyledLabel = /*#__PURE__*/styled__default["default"].label.withConfig({
53
37
  componentId: "sc-196zgtg-1"
54
- })(["display:flex;", " ", ""], ({
55
- theme,
56
- leftLabel
57
- }) => leftLabel ? `padding-right: ${theme.space.xxs};` : undefined, ({
58
- hideLabel
59
- }) => hideLabel ? `position: absolute;
60
- width: 1px;
61
- height: 1px;
62
- padding: 0;
63
- margin: -1px;
64
- overflow: hidden;
65
- clip: rect(0, 0, 0, 0);
66
- white-space: nowrap;
67
- border: 0;
68
- ` : undefined);
69
- const StyledMessage = /*#__PURE__*/styled__default['default'].div.withConfig({
38
+ })(["display:flex;", " ", ""], _ref5 => {
39
+ let {
40
+ theme,
41
+ leftLabel
42
+ } = _ref5;
43
+ return leftLabel ? "padding-right: ".concat(theme.space.xxs, ";") : undefined;
44
+ }, _ref6 => {
45
+ let {
46
+ hideLabel
47
+ } = _ref6;
48
+ return hideLabel ? "position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n " : undefined;
49
+ });
50
+ const StyledMessage = /*#__PURE__*/styled__default["default"].div.withConfig({
70
51
  componentId: "sc-196zgtg-2"
71
- })(["font-size:", ";font-style:italic;text-align:right;line-height:15px;overflow:hidden;text-overflow:ellipsis;color:", ";", ""], ({
72
- theme
73
- }) => theme.fontSizes.microText[200], ({
74
- theme,
75
- hasError
76
- }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[500], ({
77
- leftLabel,
78
- hideLabel
79
- }) => leftLabel && !hideLabel ? 'grid-column: 1/3;' : undefined);
80
- const StyledMark = /*#__PURE__*/styled__default['default'].span.withConfig({
52
+ })(["font-size:", ";font-style:italic;text-align:right;line-height:15px;height:15px;overflow:hidden;text-overflow:ellipsis;color:", ";", ""], _ref7 => {
53
+ let {
54
+ theme
55
+ } = _ref7;
56
+ return theme.fontSizes.microText[200];
57
+ }, _ref8 => {
58
+ let {
59
+ theme,
60
+ hasError
61
+ } = _ref8;
62
+ return hasError ? theme.colors.danger[900] : theme.colors.neutral[500];
63
+ }, _ref9 => {
64
+ let {
65
+ leftLabel,
66
+ hideLabel
67
+ } = _ref9;
68
+ return leftLabel && !hideLabel ? 'grid-column: 1/3;' : undefined;
69
+ });
70
+ const StyledMark = /*#__PURE__*/styled__default["default"].span.withConfig({
81
71
  componentId: "sc-196zgtg-3"
82
- })(["width:6px;height:6px;border-radius:50%;margin-left:", ";", ""], ({
83
- theme
84
- }) => theme.space.xxxs, ({
85
- theme,
86
- required
87
- }) => required ? `
88
- background-color: ${theme.colors.danger[900]};
89
- ` : `
90
- border: 1px solid ${theme.colors.brand[600]};
91
- `);
72
+ })(["width:6px;height:6px;border-radius:50%;margin-left:", ";", ""], _ref10 => {
73
+ let {
74
+ theme
75
+ } = _ref10;
76
+ return theme.space.xxxs;
77
+ }, _ref11 => {
78
+ let {
79
+ theme,
80
+ required
81
+ } = _ref11;
82
+ return required ? "\n background-color: ".concat(theme.colors.danger[900], ";\n ") : "\n border: 1px solid ".concat(theme.colors.brand[600], ";\n ");
83
+ });
84
+ const ScreenReaderOnly = /*#__PURE__*/styled__default["default"].div.withConfig({
85
+ componentId: "sc-196zgtg-4"
86
+ })(["clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;"]);
92
87
 
88
+ exports.ScreenReaderOnly = ScreenReaderOnly;
93
89
  exports.StyledContainer = StyledContainer;
94
90
  exports.StyledLabel = StyledLabel;
95
91
  exports.StyledMark = StyledMark;
@@ -18,7 +18,7 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
18
18
  const DSFormLayoutCheckboxGroup = props => {
19
19
  useValidateProps.useValidateProps(props);
20
20
  const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, defaultProps.defaultProps);
21
- return /*#__PURE__*/_jsx__default['default'](styles.StyledContainer, {
21
+ return /*#__PURE__*/_jsx__default["default"](styles.StyledContainer, {
22
22
  direction: propsWithDefault.direction
23
23
  }, void 0, propsWithDefault.children);
24
24
  };
@@ -16,19 +16,11 @@ const getVariableType = arg => {
16
16
  };
17
17
 
18
18
  const throwCheckboxGroupDirectionError = invalidProp => {
19
- throw new Error(`You are trying to pass a not valid "direction" property value for a checkbox group, please provide a valid type.
20
-
21
- Received: ${invalidProp} (${getVariableType(invalidProp)})
22
- Expected: "horizontal" or "vertical" (string)
23
- `);
19
+ throw new Error("You are trying to pass a not valid \"direction\" property value for a checkbox group, please provide a valid type.\n\n Received: ".concat(invalidProp, " (").concat(getVariableType(invalidProp), ")\n Expected: \"horizontal\" or \"vertical\" (string)\n "));
24
20
  };
25
21
 
26
22
  const throwCheckboxGroupChildrenError = () => {
27
- throw new Error(`You are trying to use a checkbox group without any React children, please provide at least one children to use.
28
-
29
- Received: (null)
30
- Expected: React children
31
- `);
23
+ throw new Error("You are trying to use a checkbox group without any React children, please provide at least one children to use.\n \n Received: (null)\n Expected: React children\n ");
32
24
  };
33
25
 
34
26
  const useValidateProps = props => {
@@ -36,7 +28,7 @@ const useValidateProps = props => {
36
28
  throwCheckboxGroupDirectionError(props.direction);
37
29
  }
38
30
 
39
- if (!React__default['default'].Children.count(props.children)) {
31
+ if (!React__default["default"].Children.count(props.children)) {
40
32
  throwCheckboxGroupChildrenError();
41
33
  }
42
34
  };
@@ -8,21 +8,39 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
10
10
 
11
- const StyledContainer = /*#__PURE__*/styled__default['default'].div.withConfig({
11
+ const StyledContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
12
12
  componentId: "sc-1wopk9q-0"
13
- })(["display:inline-flex;flex-wrap:wrap;flex-direction:", ";margin-left:", ";margin-right:", ";margin-top:", ";& div{padding:0;margin-bottom:", ";}& div:not(:last-child){margin-right:", ";}"], ({
14
- direction
15
- }) => direction === 'horizontal' ? 'row' : 'column', ({
16
- theme
17
- }) => theme.space.xs, ({
18
- theme
19
- }) => theme.space.xs, ({
20
- theme
21
- }) => theme.space.xxs, ({
22
- theme
23
- }) => theme.space.xxs, ({
24
- theme,
25
- direction
26
- }) => direction === 'horizontal' ? theme.space.s : '0');
13
+ })(["display:inline-flex;flex-wrap:wrap;flex-direction:", ";margin-left:", ";margin-right:", ";margin-top:", ";& div{padding:0;margin-bottom:", ";}& div:not(:last-child){margin-right:", ";}"], _ref => {
14
+ let {
15
+ direction
16
+ } = _ref;
17
+ return direction === 'horizontal' ? 'row' : 'column';
18
+ }, _ref2 => {
19
+ let {
20
+ theme
21
+ } = _ref2;
22
+ return theme.space.xs;
23
+ }, _ref3 => {
24
+ let {
25
+ theme
26
+ } = _ref3;
27
+ return theme.space.xs;
28
+ }, _ref4 => {
29
+ let {
30
+ theme
31
+ } = _ref4;
32
+ return theme.space.xxs;
33
+ }, _ref5 => {
34
+ let {
35
+ theme
36
+ } = _ref5;
37
+ return theme.space.xxs;
38
+ }, _ref6 => {
39
+ let {
40
+ theme,
41
+ direction
42
+ } = _ref6;
43
+ return direction === 'horizontal' ? theme.space.s : '0';
44
+ });
27
45
 
28
46
  exports.StyledContainer = StyledContainer;
@@ -1,15 +1,16 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'react';
2
+ import { useMemo } from 'react';
3
3
  import { describe } from 'react-desc';
4
+ import { uid } from 'uid';
4
5
  import { propTypes } from './propTypes.js';
5
- import { StyledContainer, StyledLabel, StyledMark, StyledMessage } from './styles.js';
6
+ import { StyledContainer, StyledLabel, StyledMark, ScreenReaderOnly, StyledMessage } from './styles.js';
6
7
 
7
8
  const DSFormLayoutBlockItem = props => {
8
9
  const {
9
10
  label,
10
11
  feedbackMessage,
11
12
  validationMessage,
12
- labelFor,
13
+ inputID,
13
14
  children,
14
15
  hasError,
15
16
  leftLabel,
@@ -17,24 +18,38 @@ const DSFormLayoutBlockItem = props => {
17
18
  optional,
18
19
  hideLabel,
19
20
  fitContent,
20
- withHighlight
21
+ withHighlight,
22
+ isGroup = false
21
23
  } = props;
24
+ const instanceUID = useMemo(() => uid(6), []);
22
25
  return /*#__PURE__*/_jsx(StyledContainer, {
23
26
  leftLabel: leftLabel,
24
27
  fitContent: fitContent,
25
28
  hideLabel: hideLabel,
26
- withHighlight: withHighlight
29
+ withHighlight: withHighlight,
30
+ as: isGroup ? 'fieldset' : 'div',
31
+ isGroup: isGroup,
32
+ "aria-describedby": "".concat(inputID || instanceUID, "_feedback_message")
27
33
  }, void 0, /*#__PURE__*/_jsx(StyledLabel, {
28
- htmlFor: labelFor,
34
+ htmlFor: inputID,
29
35
  leftLabel: leftLabel,
30
- hideLabel: hideLabel
36
+ hideLabel: hideLabel,
37
+ "aria-hidden": isGroup
31
38
  }, void 0, label, (required || optional) && /*#__PURE__*/_jsx(StyledMark, {
32
39
  required: required
33
- })), children, (validationMessage || feedbackMessage) && /*#__PURE__*/_jsx(StyledMessage, {
40
+ })), isGroup && /*#__PURE__*/_jsx(ScreenReaderOnly, {
41
+ as: "legend"
42
+ }, void 0, label), children, feedbackMessage && !hasError && /*#__PURE__*/_jsx(StyledMessage, {
43
+ leftLabel: leftLabel,
44
+ hideLabel: hideLabel,
45
+ "aria-hidden": isGroup,
46
+ id: "".concat(inputID || instanceUID, "_feedback_message")
47
+ }, void 0, feedbackMessage), validationMessage && hasError && /*#__PURE__*/_jsx(StyledMessage, {
34
48
  hasError: hasError,
35
49
  leftLabel: leftLabel,
36
- hideLabel: hideLabel
37
- }, void 0, hasError ? validationMessage : feedbackMessage));
50
+ hideLabel: hideLabel,
51
+ role: "alert"
52
+ }, void 0, validationMessage));
38
53
  };
39
54
 
40
55
  const DSFormLayoutBlockItemWithSchema = describe(DSFormLayoutBlockItem);
@@ -3,7 +3,7 @@ import { PropTypes } from 'react-desc';
3
3
  const propTypes = {
4
4
  children: PropTypes.node.isRequired.description('Input component. '),
5
5
  label: PropTypes.string.isRequired.description('Label property for the input component. This property is required for accesibility purposes.'),
6
- labelFor: PropTypes.string.isRequired.description("String that matches the input component's id. This property is required for accesibility purposes."),
6
+ inputID: PropTypes.string.isRequired.description("String that matches the input component's id. This property is required for accesibility purposes."),
7
7
  feedbackMessage: PropTypes.string.description('Feedback message to show below the input component.'),
8
8
  validationMessage: PropTypes.string.description('Validation message to show below the input component. It requires hasError property set to true to be visible.'),
9
9
  hasError: PropTypes.bool.description('Helper boolean property for the validation message.'),
@@ -12,7 +12,8 @@ const propTypes = {
12
12
  fitContent: PropTypes.bool.description('Set the width of the layout to the input component.'),
13
13
  leftLabel: PropTypes.bool.description('Adds the label at the left of the input component.'),
14
14
  hideLabel: PropTypes.bool.description('Hides the input label. It still requires label and labelFor property for accesibility purposes'),
15
- withHighlight: PropTypes.bool.description('Adds highlight extra styling. It requires extra spacing, please check withHighlight explanation tab.')
15
+ withHighlight: PropTypes.bool.description('Adds highlight extra styling. It requires extra spacing, please check withHighlight explanation tab.'),
16
+ isGroup: PropTypes.bool.description('Sets the HTML elements as fieldset and legend. This should be used when you want to group more than one input.')
16
17
  };
17
18
 
18
19
  export { propTypes };
@@ -2,84 +2,79 @@ import styled from 'styled-components';
2
2
 
3
3
  const StyledContainer = /*#__PURE__*/styled.div.withConfig({
4
4
  componentId: "sc-196zgtg-0"
5
- })(["position:relative;", " display:grid;", " align-items:center;", ""], ({
6
- fitContent
7
- }) => fitContent ? 'width: fit-content;' : undefined, ({
8
- leftLabel,
9
- hideLabel
10
- }) => leftLabel && !hideLabel ? 'grid-template-columns: max-content auto;' : undefined, ({
11
- theme,
12
- withHighlight
13
- }) => withHighlight ? `
14
- &::after {
15
- position: absolute;
16
- content: '';
17
- left: -${theme.space.xxs};
18
- top: -${theme.space.xxxs};
19
- z-index: -1;
20
- width: calc(100% + ${theme.space.xs});
21
- height: calc(100% + ${theme.space.xxs});
22
- background-color: #FEFBEE;
23
- border : 1px solid #8F6326;
24
- border-radius : 4px;
25
- box-shadow: 0 1px 3px 0 rgba(0,0,0,0.35);
26
- }
27
- &:hover,
28
- &:focus-within {
29
- &::after {
30
- position: absolute;
31
- content: '';
32
- left: -${theme.space.xxs};
33
- top: -${theme.space.xxxs};
34
- z-index: -1;
35
- width: calc(100% + ${theme.space.xs});
36
- height: calc(100% + ${theme.space.xxs});
37
- background-color: #FFF9D3;
38
- border : 1px solid #8F6326;
39
- border-radius : 4px;
40
- box-shadow: 0 6px 10px 0 rgba(0,0,0,0.30);
41
- }
42
- }
43
- ` : undefined);
5
+ })(["position:relative;padding:0;margin:0;display:grid;", " ", ";", " align-items:center;", ""], _ref => {
6
+ let {
7
+ fitContent
8
+ } = _ref;
9
+ return fitContent ? 'width: fit-content;' : undefined;
10
+ }, _ref2 => {
11
+ let {
12
+ isGroup
13
+ } = _ref2;
14
+ return isGroup ? 'border: none' : '';
15
+ }, _ref3 => {
16
+ let {
17
+ leftLabel,
18
+ hideLabel
19
+ } = _ref3;
20
+ return leftLabel && !hideLabel ? 'grid-template-columns: max-content auto;' : undefined;
21
+ }, _ref4 => {
22
+ let {
23
+ theme,
24
+ withHighlight
25
+ } = _ref4;
26
+ return withHighlight ? "\n &::after {\n position: absolute;\n content: '';\n left: -".concat(theme.space.xxs, ";\n top: -").concat(theme.space.xxxs, ";\n z-index: -1;\n width: calc(100% + ").concat(theme.space.xs, ");\n height: calc(100% + ").concat(theme.space.xxs, ");\n background-color: #FEFBEE;\n border : 1px solid #8F6326;\n border-radius : 4px;\n box-shadow: 0 1px 3px 0 rgba(0,0,0,0.35);\n }\n &:hover, \n &:focus-within {\n &::after {\n position: absolute;\n content: '';\n left: -").concat(theme.space.xxs, ";\n top: -").concat(theme.space.xxxs, ";\n z-index: -1;\n width: calc(100% + ").concat(theme.space.xs, ");\n height: calc(100% + ").concat(theme.space.xxs, ");\n background-color: #FFF9D3;\n border : 1px solid #8F6326;\n border-radius : 4px;\n box-shadow: 0 6px 10px 0 rgba(0,0,0,0.30);\n }\n }\n ") : undefined;
27
+ });
44
28
  const StyledLabel = /*#__PURE__*/styled.label.withConfig({
45
29
  componentId: "sc-196zgtg-1"
46
- })(["display:flex;", " ", ""], ({
47
- theme,
48
- leftLabel
49
- }) => leftLabel ? `padding-right: ${theme.space.xxs};` : undefined, ({
50
- hideLabel
51
- }) => hideLabel ? `position: absolute;
52
- width: 1px;
53
- height: 1px;
54
- padding: 0;
55
- margin: -1px;
56
- overflow: hidden;
57
- clip: rect(0, 0, 0, 0);
58
- white-space: nowrap;
59
- border: 0;
60
- ` : undefined);
30
+ })(["display:flex;", " ", ""], _ref5 => {
31
+ let {
32
+ theme,
33
+ leftLabel
34
+ } = _ref5;
35
+ return leftLabel ? "padding-right: ".concat(theme.space.xxs, ";") : undefined;
36
+ }, _ref6 => {
37
+ let {
38
+ hideLabel
39
+ } = _ref6;
40
+ return hideLabel ? "position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n " : undefined;
41
+ });
61
42
  const StyledMessage = /*#__PURE__*/styled.div.withConfig({
62
43
  componentId: "sc-196zgtg-2"
63
- })(["font-size:", ";font-style:italic;text-align:right;line-height:15px;overflow:hidden;text-overflow:ellipsis;color:", ";", ""], ({
64
- theme
65
- }) => theme.fontSizes.microText[200], ({
66
- theme,
67
- hasError
68
- }) => hasError ? theme.colors.danger[900] : theme.colors.neutral[500], ({
69
- leftLabel,
70
- hideLabel
71
- }) => leftLabel && !hideLabel ? 'grid-column: 1/3;' : undefined);
44
+ })(["font-size:", ";font-style:italic;text-align:right;line-height:15px;height:15px;overflow:hidden;text-overflow:ellipsis;color:", ";", ""], _ref7 => {
45
+ let {
46
+ theme
47
+ } = _ref7;
48
+ return theme.fontSizes.microText[200];
49
+ }, _ref8 => {
50
+ let {
51
+ theme,
52
+ hasError
53
+ } = _ref8;
54
+ return hasError ? theme.colors.danger[900] : theme.colors.neutral[500];
55
+ }, _ref9 => {
56
+ let {
57
+ leftLabel,
58
+ hideLabel
59
+ } = _ref9;
60
+ return leftLabel && !hideLabel ? 'grid-column: 1/3;' : undefined;
61
+ });
72
62
  const StyledMark = /*#__PURE__*/styled.span.withConfig({
73
63
  componentId: "sc-196zgtg-3"
74
- })(["width:6px;height:6px;border-radius:50%;margin-left:", ";", ""], ({
75
- theme
76
- }) => theme.space.xxxs, ({
77
- theme,
78
- required
79
- }) => required ? `
80
- background-color: ${theme.colors.danger[900]};
81
- ` : `
82
- border: 1px solid ${theme.colors.brand[600]};
83
- `);
64
+ })(["width:6px;height:6px;border-radius:50%;margin-left:", ";", ""], _ref10 => {
65
+ let {
66
+ theme
67
+ } = _ref10;
68
+ return theme.space.xxxs;
69
+ }, _ref11 => {
70
+ let {
71
+ theme,
72
+ required
73
+ } = _ref11;
74
+ return required ? "\n background-color: ".concat(theme.colors.danger[900], ";\n ") : "\n border: 1px solid ".concat(theme.colors.brand[600], ";\n ");
75
+ });
76
+ const ScreenReaderOnly = /*#__PURE__*/styled.div.withConfig({
77
+ componentId: "sc-196zgtg-4"
78
+ })(["clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;"]);
84
79
 
85
- export { StyledContainer, StyledLabel, StyledMark, StyledMessage };
80
+ export { ScreenReaderOnly, StyledContainer, StyledLabel, StyledMark, StyledMessage };
@@ -8,19 +8,11 @@ const getVariableType = arg => {
8
8
  };
9
9
 
10
10
  const throwCheckboxGroupDirectionError = invalidProp => {
11
- throw new Error(`You are trying to pass a not valid "direction" property value for a checkbox group, please provide a valid type.
12
-
13
- Received: ${invalidProp} (${getVariableType(invalidProp)})
14
- Expected: "horizontal" or "vertical" (string)
15
- `);
11
+ throw new Error("You are trying to pass a not valid \"direction\" property value for a checkbox group, please provide a valid type.\n\n Received: ".concat(invalidProp, " (").concat(getVariableType(invalidProp), ")\n Expected: \"horizontal\" or \"vertical\" (string)\n "));
16
12
  };
17
13
 
18
14
  const throwCheckboxGroupChildrenError = () => {
19
- throw new Error(`You are trying to use a checkbox group without any React children, please provide at least one children to use.
20
-
21
- Received: (null)
22
- Expected: React children
23
- `);
15
+ throw new Error("You are trying to use a checkbox group without any React children, please provide at least one children to use.\n \n Received: (null)\n Expected: React children\n ");
24
16
  };
25
17
 
26
18
  const useValidateProps = props => {
@@ -2,19 +2,37 @@ import styled from 'styled-components';
2
2
 
3
3
  const StyledContainer = /*#__PURE__*/styled.div.withConfig({
4
4
  componentId: "sc-1wopk9q-0"
5
- })(["display:inline-flex;flex-wrap:wrap;flex-direction:", ";margin-left:", ";margin-right:", ";margin-top:", ";& div{padding:0;margin-bottom:", ";}& div:not(:last-child){margin-right:", ";}"], ({
6
- direction
7
- }) => direction === 'horizontal' ? 'row' : 'column', ({
8
- theme
9
- }) => theme.space.xs, ({
10
- theme
11
- }) => theme.space.xs, ({
12
- theme
13
- }) => theme.space.xxs, ({
14
- theme
15
- }) => theme.space.xxs, ({
16
- theme,
17
- direction
18
- }) => direction === 'horizontal' ? theme.space.s : '0');
5
+ })(["display:inline-flex;flex-wrap:wrap;flex-direction:", ";margin-left:", ";margin-right:", ";margin-top:", ";& div{padding:0;margin-bottom:", ";}& div:not(:last-child){margin-right:", ";}"], _ref => {
6
+ let {
7
+ direction
8
+ } = _ref;
9
+ return direction === 'horizontal' ? 'row' : 'column';
10
+ }, _ref2 => {
11
+ let {
12
+ theme
13
+ } = _ref2;
14
+ return theme.space.xs;
15
+ }, _ref3 => {
16
+ let {
17
+ theme
18
+ } = _ref3;
19
+ return theme.space.xs;
20
+ }, _ref4 => {
21
+ let {
22
+ theme
23
+ } = _ref4;
24
+ return theme.space.xxs;
25
+ }, _ref5 => {
26
+ let {
27
+ theme
28
+ } = _ref5;
29
+ return theme.space.xxs;
30
+ }, _ref6 => {
31
+ let {
32
+ theme,
33
+ direction
34
+ } = _ref6;
35
+ return direction === 'horizontal' ? theme.space.s : '0';
36
+ });
19
37
 
20
38
  export { StyledContainer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-form-layout-blocks",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.13",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Form Layout",
6
6
  "module": "./esm/index.js",
@@ -72,16 +72,17 @@
72
72
  "build": "node ../../scripts/build/build.js"
73
73
  },
74
74
  "dependencies": {
75
- "@elliemae/ds-props-helpers": "2.0.0-alpha.1",
76
- "react-desc": "~4.1.3"
75
+ "@elliemae/ds-props-helpers": "2.0.0-alpha.13",
76
+ "react-desc": "~4.1.3",
77
+ "uid": "~2.0.0"
77
78
  },
78
79
  "devDependencies": {
79
- "styled-components": "~5.3.1"
80
+ "styled-components": "~5.3.3"
80
81
  },
81
82
  "peerDependencies": {
82
83
  "react": "~17.0.2",
83
84
  "react-dom": "^17.0.2",
84
- "styled-components": "^5.3.1"
85
+ "styled-components": "^5.3.3"
85
86
  },
86
87
  "publishConfig": {
87
88
  "access": "public",
@@ -1,3 +1,4 @@
1
+ /// <reference path="../../../../../shared/typings/react-desc.d.ts" />
1
2
  /// <reference types="react" />
2
3
  import type { DSFormLayoutBlockItemPropsT as Props } from './index.d';
3
4
  declare const DSFormLayoutBlockItem: {
@@ -5,17 +6,72 @@ declare const DSFormLayoutBlockItem: {
5
6
  propTypes: {
6
7
  children: any;
7
8
  label: any;
8
- labelFor: any;
9
- feedbackMessage: any;
10
- validationMessage: any;
11
- hasError: any;
12
- required: any;
13
- optional: any;
14
- fitContent: any;
15
- leftLabel: any;
16
- hideLabel: any;
17
- withHighlight: any;
9
+ inputID: any;
10
+ feedbackMessage: {
11
+ defaultValue<T = unknown>(arg: T): {
12
+ deprecated: import("react-desc").PropTypesDescValidator;
13
+ };
14
+ isRequired: import("react-desc").PropTypesDescValidator;
15
+ };
16
+ validationMessage: {
17
+ defaultValue<T = unknown>(arg: T): {
18
+ deprecated: import("react-desc").PropTypesDescValidator;
19
+ };
20
+ isRequired: import("react-desc").PropTypesDescValidator;
21
+ };
22
+ hasError: {
23
+ defaultValue<T = unknown>(arg: T): {
24
+ deprecated: import("react-desc").PropTypesDescValidator;
25
+ };
26
+ isRequired: import("react-desc").PropTypesDescValidator;
27
+ };
28
+ required: {
29
+ defaultValue<T = unknown>(arg: T): {
30
+ deprecated: import("react-desc").PropTypesDescValidator;
31
+ };
32
+ isRequired: import("react-desc").PropTypesDescValidator;
33
+ };
34
+ optional: {
35
+ defaultValue<T = unknown>(arg: T): {
36
+ deprecated: import("react-desc").PropTypesDescValidator;
37
+ };
38
+ isRequired: import("react-desc").PropTypesDescValidator;
39
+ };
40
+ fitContent: {
41
+ defaultValue<T = unknown>(arg: T): {
42
+ deprecated: import("react-desc").PropTypesDescValidator;
43
+ };
44
+ isRequired: import("react-desc").PropTypesDescValidator;
45
+ };
46
+ leftLabel: {
47
+ defaultValue<T = unknown>(arg: T): {
48
+ deprecated: import("react-desc").PropTypesDescValidator;
49
+ };
50
+ isRequired: import("react-desc").PropTypesDescValidator;
51
+ };
52
+ hideLabel: {
53
+ defaultValue<T = unknown>(arg: T): {
54
+ deprecated: import("react-desc").PropTypesDescValidator;
55
+ };
56
+ isRequired: import("react-desc").PropTypesDescValidator;
57
+ };
58
+ withHighlight: {
59
+ defaultValue<T = unknown>(arg: T): {
60
+ deprecated: import("react-desc").PropTypesDescValidator;
61
+ };
62
+ isRequired: import("react-desc").PropTypesDescValidator;
63
+ };
64
+ isGroup: {
65
+ defaultValue<T = unknown>(arg: T): {
66
+ deprecated: import("react-desc").PropTypesDescValidator;
67
+ };
68
+ isRequired: import("react-desc").PropTypesDescValidator;
69
+ };
18
70
  };
19
71
  };
20
- declare const DSFormLayoutBlockItemWithSchema: any;
72
+ declare const DSFormLayoutBlockItemWithSchema: {
73
+ (props?: Props | undefined): JSX.Element;
74
+ propTypes: unknown;
75
+ toTypescript: () => import("react-desc").TypescriptSchema;
76
+ };
21
77
  export { DSFormLayoutBlockItem, DSFormLayoutBlockItemWithSchema };
@@ -2,7 +2,7 @@
2
2
  export interface DSFormLayoutBlockItemPropsT {
3
3
  children: JSX.Element;
4
4
  label: string;
5
- labelFor: string;
5
+ inputID: string;
6
6
  validationMessage?: string;
7
7
  feedbackMessage?: string;
8
8
  hasError?: boolean;
@@ -12,6 +12,7 @@ export interface DSFormLayoutBlockItemPropsT {
12
12
  optional?: boolean;
13
13
  hideLabel?: boolean;
14
14
  withHighlight?: boolean;
15
+ isGroup?: boolean;
15
16
  }
16
17
  export interface DSFormLayoutBlockItemStyledMessageT {
17
18
  hasError?: boolean;
@@ -23,6 +24,7 @@ export interface DSFormLayoutBlockItemStyledContainerT {
23
24
  fitContent?: boolean;
24
25
  hideLabel?: boolean;
25
26
  withHighlight?: boolean;
27
+ isGroup?: boolean;
26
28
  }
27
29
  export interface DSFormLayoutBlockItemStyledLabelT {
28
30
  leftLabel?: boolean;
@@ -1,14 +1,66 @@
1
+ /// <reference path="../../../../../shared/typings/react-desc.d.ts" />
1
2
  export declare const propTypes: {
2
3
  children: any;
3
4
  label: any;
4
- labelFor: any;
5
- feedbackMessage: any;
6
- validationMessage: any;
7
- hasError: any;
8
- required: any;
9
- optional: any;
10
- fitContent: any;
11
- leftLabel: any;
12
- hideLabel: any;
13
- withHighlight: any;
5
+ inputID: any;
6
+ feedbackMessage: {
7
+ defaultValue<T = unknown>(arg: T): {
8
+ deprecated: import("react-desc").PropTypesDescValidator;
9
+ };
10
+ isRequired: import("react-desc").PropTypesDescValidator;
11
+ };
12
+ validationMessage: {
13
+ defaultValue<T = unknown>(arg: T): {
14
+ deprecated: import("react-desc").PropTypesDescValidator;
15
+ };
16
+ isRequired: import("react-desc").PropTypesDescValidator;
17
+ };
18
+ hasError: {
19
+ defaultValue<T = unknown>(arg: T): {
20
+ deprecated: import("react-desc").PropTypesDescValidator;
21
+ };
22
+ isRequired: import("react-desc").PropTypesDescValidator;
23
+ };
24
+ required: {
25
+ defaultValue<T = unknown>(arg: T): {
26
+ deprecated: import("react-desc").PropTypesDescValidator;
27
+ };
28
+ isRequired: import("react-desc").PropTypesDescValidator;
29
+ };
30
+ optional: {
31
+ defaultValue<T = unknown>(arg: T): {
32
+ deprecated: import("react-desc").PropTypesDescValidator;
33
+ };
34
+ isRequired: import("react-desc").PropTypesDescValidator;
35
+ };
36
+ fitContent: {
37
+ defaultValue<T = unknown>(arg: T): {
38
+ deprecated: import("react-desc").PropTypesDescValidator;
39
+ };
40
+ isRequired: import("react-desc").PropTypesDescValidator;
41
+ };
42
+ leftLabel: {
43
+ defaultValue<T = unknown>(arg: T): {
44
+ deprecated: import("react-desc").PropTypesDescValidator;
45
+ };
46
+ isRequired: import("react-desc").PropTypesDescValidator;
47
+ };
48
+ hideLabel: {
49
+ defaultValue<T = unknown>(arg: T): {
50
+ deprecated: import("react-desc").PropTypesDescValidator;
51
+ };
52
+ isRequired: import("react-desc").PropTypesDescValidator;
53
+ };
54
+ withHighlight: {
55
+ defaultValue<T = unknown>(arg: T): {
56
+ deprecated: import("react-desc").PropTypesDescValidator;
57
+ };
58
+ isRequired: import("react-desc").PropTypesDescValidator;
59
+ };
60
+ isGroup: {
61
+ defaultValue<T = unknown>(arg: T): {
62
+ deprecated: import("react-desc").PropTypesDescValidator;
63
+ };
64
+ isRequired: import("react-desc").PropTypesDescValidator;
65
+ };
14
66
  };
@@ -1,5 +1,6 @@
1
1
  import type { DSFormLayoutBlockItemStyledContainerT, DSFormLayoutBlockItemStyledLabelT, DSFormLayoutBlockItemStyledMessageT, DSFormLayoutBlockItemStyledMarkT } from './index.d';
2
- export declare const StyledContainer: import("styled-components").StyledComponent<"div", any, DSFormLayoutBlockItemStyledContainerT, never>;
3
- export declare const StyledLabel: import("styled-components").StyledComponent<"label", any, DSFormLayoutBlockItemStyledLabelT, never>;
4
- export declare const StyledMessage: import("styled-components").StyledComponent<"div", any, DSFormLayoutBlockItemStyledMessageT, never>;
5
- export declare const StyledMark: import("styled-components").StyledComponent<"span", any, DSFormLayoutBlockItemStyledMarkT, never>;
2
+ export declare const StyledContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, DSFormLayoutBlockItemStyledContainerT, never>;
3
+ export declare const StyledLabel: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, DSFormLayoutBlockItemStyledLabelT, never>;
4
+ export declare const StyledMessage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, DSFormLayoutBlockItemStyledMessageT, never>;
5
+ export declare const StyledMark: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, DSFormLayoutBlockItemStyledMarkT, never>;
6
+ export declare const ScreenReaderOnly: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -1,10 +1,20 @@
1
+ /// <reference path="../../../../../shared/typings/react-desc.d.ts" />
1
2
  /// <reference types="react" />
2
3
  import type { DSControlledCheckboxGroupT } from './index.d';
3
4
  declare const DSFormLayoutCheckboxGroup: {
4
5
  (props: DSControlledCheckboxGroupT): JSX.Element;
5
6
  propTypes: {
6
- direction: any;
7
+ direction: {
8
+ defaultValue<T = unknown>(arg: T): {
9
+ deprecated: import("react-desc").PropTypesDescValidator;
10
+ };
11
+ isRequired: import("react-desc").PropTypesDescValidator;
12
+ };
7
13
  };
8
14
  };
9
- declare const DSFormLayoutCheckboxGroupWithSchema: any;
15
+ declare const DSFormLayoutCheckboxGroupWithSchema: {
16
+ (props?: DSControlledCheckboxGroupT | undefined): JSX.Element;
17
+ propTypes: unknown;
18
+ toTypescript: () => import("react-desc").TypescriptSchema;
19
+ };
10
20
  export { DSFormLayoutCheckboxGroup, DSFormLayoutCheckboxGroupWithSchema };
@@ -1,3 +1,9 @@
1
+ /// <reference path="../../../../../shared/typings/react-desc.d.ts" />
1
2
  export declare const propTypes: {
2
- direction: any;
3
+ direction: {
4
+ defaultValue<T = unknown>(arg: T): {
5
+ deprecated: import("react-desc").PropTypesDescValidator;
6
+ };
7
+ isRequired: import("react-desc").PropTypesDescValidator;
8
+ };
3
9
  };
@@ -1,2 +1,2 @@
1
1
  import type { DSControlledCheckboxGroupStyledContainerT } from './index.d';
2
- export declare const StyledContainer: import("styled-components").StyledComponent<"div", any, DSControlledCheckboxGroupStyledContainerT, never>;
2
+ export declare const StyledContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, DSControlledCheckboxGroupStyledContainerT, never>;
package/cjs/package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "type": "commonjs",
3
- "sideEffects": [
4
- "*.css",
5
- "*.scss"
6
- ]
7
- }
package/esm/package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "type": "module",
3
- "sideEffects": [
4
- "*.css",
5
- "*.scss"
6
- ]
7
- }