@itcase/forms 1.0.19 → 1.0.21

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.
@@ -12,7 +12,7 @@
12
12
  }
13
13
  &_focus {
14
14
  & .checkbox__state {
15
- background: var(--color-surface-primary);
15
+ /* border: solid 1px var(--color-error-border-primary); */
16
16
  }
17
17
  }
18
18
  }
@@ -30,7 +30,7 @@
30
30
  align-self: flex-start;
31
31
  grid-row: 1;
32
32
  &-inner {
33
- padding: 4px 0 0 0;
33
+ padding: 2px 0 0 0;
34
34
  }
35
35
  }
36
36
  ^&__message {
@@ -1,14 +1,26 @@
1
- .form-textarea {
2
- position: relative;
3
- &&_state {
4
- &_success {
5
- border: solid 1px var(--color-success-border-primary);
6
- }
7
- &_error {
8
- border: solid 1px var(--color-error-border-primary);
9
- }
10
- &_focus {
11
- background: var(--color-surface-primary);
1
+ .form {
2
+ &__group {
3
+ width: 100%;
4
+ margin: 0;
5
+ &-wrapper {
6
+ display: flex;
7
+ flex-flow: column nowrap;
8
+ ^&-label {
9
+ }
10
+ ^&-items {
11
+ }
12
+ ^&-message {
13
+ &_type_error {
14
+ color: var(--color-error-text-primary);
15
+ }
16
+ &_type_require {
17
+ color: var(--color-require-text-primary);
18
+ }
19
+ &_type_success {
20
+ color: var(--color-success-text-primary);
21
+ }
22
+ }
12
23
  }
13
24
  }
25
+
14
26
  }
@@ -1,12 +1,16 @@
1
1
  .form-segmented {
2
- &_state_success {
2
+ &_state_error {
3
3
  & .segmented {
4
- border: solid 1px var(--color-success-border-primary);
4
+ &__item-label-text {
5
+ color: var(--color-error-text-primary);
6
+ }
5
7
  }
6
8
  }
7
- &_state_error {
9
+ &_state_required {
8
10
  & .segmented {
9
- border: solid 1px var(--color-error-border-primary);
11
+ &__item-label-text {
12
+ color: var(--color-active-text-primary);
13
+ }
10
14
  }
11
15
  }
12
16
  }
@@ -7,20 +7,6 @@
7
7
  }
8
8
  }
9
9
  }
10
- .form {
11
- &__group {
12
- width: 100%;
13
- margin: 0;
14
- &-wrapper {
15
- display: flex;
16
- flex-flow: column nowrap;
17
- ^&-label {
18
- }
19
- ^&-items {
20
- }
21
- }
22
- }
23
- }
24
10
  .form {
25
11
  &__header {
26
12
  width: 100%;
@@ -217,6 +203,9 @@
217
203
  top: 20px;
218
204
  left: 0;
219
205
  }
206
+ &_global {
207
+ margin: 0 0 16px 0;
208
+ }
220
209
  }
221
210
  &__item {
222
211
  text-align: center;
@@ -6,6 +6,9 @@
6
6
  top: 20px;
7
7
  left: 0;
8
8
  }
9
+ &_global {
10
+ margin: 0 0 16px 0;
11
+ }
9
12
  }
10
13
  &__item {
11
14
  text-align: center;
@@ -56,9 +56,10 @@ var emailValidation = function emailValidation(value, context) {
56
56
  var addRequiredFieldsParamToSchema = function addRequiredFieldsParamToSchema(schema) {
57
57
  var fields = Object.entries(schema.fields);
58
58
  schema.requiredFields = fields.reduce(function (list, _ref) {
59
+ var _validationProps$excl;
59
60
  var fieldName = _ref[0],
60
61
  validationProps = _ref[1];
61
- if (validationProps.exclusiveTests.required) {
62
+ if ((_validationProps$excl = validationProps.exclusiveTests) != null && _validationProps$excl.required) {
62
63
  list.push(fieldName);
63
64
  }
64
65
  return list;
@@ -1627,22 +1628,18 @@ var Group = /*#__PURE__*/React__default.default.memo(function Group(props) {
1627
1628
  textWeight: labelTextWeight
1628
1629
  }, label)), /*#__PURE__*/React__default.default.createElement("div", {
1629
1630
  className: "form__group-items"
1630
- }, children), after), Boolean(showError) && /*#__PURE__*/React__default.default.createElement("div", {
1631
- className: "form-field__message"
1632
- }, /*#__PURE__*/React__default.default.createElement(Text.Text, {
1633
- className: "form-field__message-item form-field__message-item_type-error",
1631
+ }, children), after), Boolean(showError) && /*#__PURE__*/React__default.default.createElement(Text.Text, {
1632
+ className: "form__group-message form__group-message_type-error",
1634
1633
  size: errorMessageTextSize,
1635
1634
  textWeight: errorMessageTextWeight,
1636
1635
  textColor: errorMessageTextColor,
1637
1636
  id: name + "-error"
1638
- }, error)), Boolean(message) && !showError && /*#__PURE__*/React__default.default.createElement("div", {
1639
- className: "form-field__message"
1640
- }, /*#__PURE__*/React__default.default.createElement(Text.Text, {
1641
- className: "form-field__message-item form-field__message-item_type_message",
1637
+ }, error), Boolean(message) && !showError && /*#__PURE__*/React__default.default.createElement(Text.Text, {
1638
+ className: "form__group-message",
1642
1639
  size: messageTextSize,
1643
1640
  textWeight: messageTextWeight,
1644
1641
  textColor: messageTextColor
1645
- }, message)));
1642
+ }, message));
1646
1643
  });
1647
1644
  });
1648
1645
  Group.defaultProps = {
@@ -1650,7 +1647,9 @@ Group.defaultProps = {
1650
1647
  fieldProps: {},
1651
1648
  type: 'normal',
1652
1649
  errorMessageTextSize: 's',
1653
- errorMessageTextColor: 'errorTextSecondary'
1650
+ errorMessageTextColor: 'errorTextPrimary',
1651
+ messageTextSize: 's',
1652
+ messageTextColor: 'surfaceTextTertiary'
1654
1653
  };
1655
1654
  Group.propTypes = {
1656
1655
  name: PropTypes__default.default.string.isRequired,
@@ -2575,10 +2574,12 @@ var FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalFor
2575
2574
  textColor: descriptionTextColor,
2576
2575
  textWeight: descriptionTextWeight
2577
2576
  }, description), submitError && !modifiedSinceLastSubmit && /*#__PURE__*/React__default.default.createElement("div", {
2578
- className: clsx__default.default('notification', 'form-notification', notificationType && "form-notification_type_" + notificationType)
2577
+ className: clsx__default.default('notification', 'form-notification', notificationType ? "form-notification_type_" + notificationType : 'form-notification_type_global')
2579
2578
  }, /*#__PURE__*/React__default.default.createElement(Notification.NotificationItem, {
2580
2579
  className: "form-notification__item",
2581
- text: form.getState().submitError,
2580
+ titleTextSize: "h6",
2581
+ title: form.getState().submitError,
2582
+ set: "form",
2582
2583
  status: "error"
2583
2584
  })), onChangeFormValues && /*#__PURE__*/React__default.default.createElement(reactFinalForm.FormSpy, {
2584
2585
  subscription: {
@@ -46,9 +46,10 @@ var emailValidation = function emailValidation(value, context) {
46
46
  var addRequiredFieldsParamToSchema = function addRequiredFieldsParamToSchema(schema) {
47
47
  var fields = Object.entries(schema.fields);
48
48
  schema.requiredFields = fields.reduce(function (list, _ref) {
49
+ var _validationProps$excl;
49
50
  var fieldName = _ref[0],
50
51
  validationProps = _ref[1];
51
- if (validationProps.exclusiveTests.required) {
52
+ if ((_validationProps$excl = validationProps.exclusiveTests) != null && _validationProps$excl.required) {
52
53
  list.push(fieldName);
53
54
  }
54
55
  return list;
@@ -1617,22 +1618,18 @@ var Group = /*#__PURE__*/React.memo(function Group(props) {
1617
1618
  textWeight: labelTextWeight
1618
1619
  }, label)), /*#__PURE__*/React.createElement("div", {
1619
1620
  className: "form__group-items"
1620
- }, children), after), Boolean(showError) && /*#__PURE__*/React.createElement("div", {
1621
- className: "form-field__message"
1622
- }, /*#__PURE__*/React.createElement(Text, {
1623
- className: "form-field__message-item form-field__message-item_type-error",
1621
+ }, children), after), Boolean(showError) && /*#__PURE__*/React.createElement(Text, {
1622
+ className: "form__group-message form__group-message_type-error",
1624
1623
  size: errorMessageTextSize,
1625
1624
  textWeight: errorMessageTextWeight,
1626
1625
  textColor: errorMessageTextColor,
1627
1626
  id: name + "-error"
1628
- }, error)), Boolean(message) && !showError && /*#__PURE__*/React.createElement("div", {
1629
- className: "form-field__message"
1630
- }, /*#__PURE__*/React.createElement(Text, {
1631
- className: "form-field__message-item form-field__message-item_type_message",
1627
+ }, error), Boolean(message) && !showError && /*#__PURE__*/React.createElement(Text, {
1628
+ className: "form__group-message",
1632
1629
  size: messageTextSize,
1633
1630
  textWeight: messageTextWeight,
1634
1631
  textColor: messageTextColor
1635
- }, message)));
1632
+ }, message));
1636
1633
  });
1637
1634
  });
1638
1635
  Group.defaultProps = {
@@ -1640,7 +1637,9 @@ Group.defaultProps = {
1640
1637
  fieldProps: {},
1641
1638
  type: 'normal',
1642
1639
  errorMessageTextSize: 's',
1643
- errorMessageTextColor: 'errorTextSecondary'
1640
+ errorMessageTextColor: 'errorTextPrimary',
1641
+ messageTextSize: 's',
1642
+ messageTextColor: 'surfaceTextTertiary'
1644
1643
  };
1645
1644
  Group.propTypes = {
1646
1645
  name: PropTypes.string.isRequired,
@@ -2565,10 +2564,12 @@ var FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2565
2564
  textColor: descriptionTextColor,
2566
2565
  textWeight: descriptionTextWeight
2567
2566
  }, description), submitError && !modifiedSinceLastSubmit && /*#__PURE__*/React.createElement("div", {
2568
- className: clsx('notification', 'form-notification', notificationType && "form-notification_type_" + notificationType)
2567
+ className: clsx('notification', 'form-notification', notificationType ? "form-notification_type_" + notificationType : 'form-notification_type_global')
2569
2568
  }, /*#__PURE__*/React.createElement(NotificationItem, {
2570
2569
  className: "form-notification__item",
2571
- text: form.getState().submitError,
2570
+ titleTextSize: "h6",
2571
+ title: form.getState().submitError,
2572
+ set: "form",
2572
2573
  status: "error"
2573
2574
  })), onChangeFormValues && /*#__PURE__*/React.createElement(FormSpy, {
2574
2575
  subscription: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/forms",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "Forms fields, inputs, etc.",
5
5
  "keywords": [
6
6
  "forms",
@@ -1,14 +0,0 @@
1
- .form {
2
- &__group {
3
- width: 100%;
4
- margin: 0;
5
- &-wrapper {
6
- display: flex;
7
- flex-flow: column nowrap;
8
- ^&-label {
9
- }
10
- ^&-items {
11
- }
12
- }
13
- }
14
- }