@websolutespa/bom-mixer-ui 1.9.3 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @websolutespa/bom-mixer-ui
2
2
 
3
+ ## 1.9.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixing: Select, FieldSelect
8
+
9
+ ## 1.9.4
10
+
11
+ ### Patch Changes
12
+
13
+ - Added: Text.Html
14
+ - Updated dependencies
15
+ - Updated dependencies
16
+ - @websolutespa/bom-mixer-store@1.8.4
17
+ - @websolutespa/bom-core@1.8.11
18
+
3
19
  ## 1.9.3
4
20
 
5
21
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -4079,36 +4079,6 @@ function hasBackground(props) {
4079
4079
  return hasChildOfType(props.children, Background);
4080
4080
  }
4081
4081
 
4082
- styled.css`
4083
- h1, h2, h3, h4, h5, h6 {
4084
- // color: var(--color-neutral-500);
4085
- margin-bottom: 3rem;
4086
- }
4087
- h4 {
4088
- font-size: 1.2em;
4089
- }
4090
- `;
4091
- styled.css`
4092
- a[href] {
4093
- ${CssDefault}
4094
- ${CssButtonNavInverted}
4095
- }
4096
- `;
4097
- styled.css`
4098
- p:not(:last-child) {
4099
- margin-bottom: 1.25em;
4100
- }
4101
- `;
4102
- styled.css`
4103
- ul {
4104
- list-style: initial;
4105
- margin: 0 0 2em 1.1em;
4106
-
4107
- &>li {
4108
- padding: 0.3em 0;
4109
- }
4110
- }
4111
- `;
4112
4082
  const StyledText$1 = styled__default.default.div`
4113
4083
  ${props => getFontVariantResponsive(props, (variant, font) => styled.css`
4114
4084
  ${font.family ? styled.css`font-family: var(--font-${variant}-family, var(--base-font-family));` : ''}
@@ -4125,13 +4095,7 @@ const StyledText$1 = styled__default.default.div`
4125
4095
  ` : ''}
4126
4096
  ${props => getCssResponsive(props)}
4127
4097
  `;
4128
- /*
4129
- ${CssH}
4130
- ${CssA}
4131
- ${CssP}
4132
- ${CssUl}
4133
- */
4134
- const TextBase = /*#__PURE__*/React.forwardRef((_a, ref) => {
4098
+ const TextBase = /*#__PURE__*/React.forwardRef(function Text(_a, ref) {
4135
4099
  var {
4136
4100
  children,
4137
4101
  className,
@@ -4147,7 +4111,24 @@ const TextBase = /*#__PURE__*/React.forwardRef((_a, ref) => {
4147
4111
  children: children
4148
4112
  }));
4149
4113
  });
4150
- TextBase.displayName = 'Text';
4114
+ const TextHtml = /*#__PURE__*/React.forwardRef(function TextHtml(_a, ref) {
4115
+ var {
4116
+ children,
4117
+ className,
4118
+ as = 'div'
4119
+ } = _a,
4120
+ props = __rest(_a, ["children", "className", "as"]);
4121
+ const classNames = bomCore.getClassNames('text', 'wysiwyg', className, props.variant);
4122
+ return jsxRuntime.jsx(StyledText$1, Object.assign({
4123
+ className: classNames,
4124
+ ref: ref,
4125
+ as: as
4126
+ }, props, {
4127
+ dangerouslySetInnerHTML: {
4128
+ __html: children
4129
+ }
4130
+ }));
4131
+ });
4151
4132
  const TextSROnly = styled__default.default.div`
4152
4133
  position: absolute;
4153
4134
  width: 1px;
@@ -4160,6 +4141,7 @@ const TextSROnly = styled__default.default.div`
4160
4141
  border-width: 0;
4161
4142
  `;
4162
4143
  const Text = bomCore.withSchema(TextBase, {
4144
+ Html: TextHtml,
4163
4145
  SROnly: TextSROnly
4164
4146
  });
4165
4147
 
@@ -8249,6 +8231,30 @@ function isEmptyValue(value) {
8249
8231
  }
8250
8232
  return Boolean(value) === false;
8251
8233
  }
8234
+ function outerToInnerSelectValue(value) {
8235
+ if (Array.isArray(value)) {
8236
+ return value.map(x => outerToInnerSelectValue(x));
8237
+ }
8238
+ if (bomCore.isObject(value)) {
8239
+ return String(value.id);
8240
+ }
8241
+ if (value == null) {
8242
+ return undefined;
8243
+ }
8244
+ return value;
8245
+ }
8246
+ function innerToOuterSelectValue(value, options) {
8247
+ if (Array.isArray(value)) {
8248
+ return value.map(x => innerToOuterSelectValue(x, options));
8249
+ }
8250
+ if (value == null) {
8251
+ return null;
8252
+ }
8253
+ if (Array.isArray(options)) {
8254
+ return options.find(x => String(x.id) === value) || null;
8255
+ }
8256
+ return value;
8257
+ }
8252
8258
  function outerToInnerValue(value) {
8253
8259
  if (Array.isArray(value)) {
8254
8260
  return value.map(x => outerToInnerValue(x));
@@ -11841,8 +11847,8 @@ function Select$1(_a) {
11841
11847
  children
11842
11848
  } = _a,
11843
11849
  props = __rest(_a, ["name", "value", "label", "defaultValue", "options", "multiple", "placeholder", "variant", "variants", "onBlur", "onFocus", "onChange", "children"]);
11844
- const value = outerToInnerValue(outerValue);
11845
- const defaultValue = outerToInnerValue(outerDefaultValue) || (multiple ? [] : '');
11850
+ const value = outerToInnerSelectValue(outerValue);
11851
+ const defaultValue = outerToInnerSelectValue(outerDefaultValue) || (multiple ? [] : '');
11846
11852
  const [innerValue, setInnerValue] = React.useState(value || defaultValue);
11847
11853
  // console.log('value', value, 'defaultValue', defaultValue);
11848
11854
  React.useEffect(() => {
@@ -11859,7 +11865,8 @@ function Select$1(_a) {
11859
11865
  const onChange_ = value => {
11860
11866
  if (innerValue !== value) {
11861
11867
  setInnerValue(value);
11862
- const outerValue = innerToOuterValue(value, options);
11868
+ const outerValue = innerToOuterSelectValue(value, options);
11869
+ console.log('setInnerValue', value, outerValue);
11863
11870
  onChange && onChange(outerValue);
11864
11871
  }
11865
11872
  };
@@ -13846,6 +13853,7 @@ exports.TextArea = TextArea;
13846
13853
  exports.TextBase = TextBase;
13847
13854
  exports.TextDescription = TextDescription;
13848
13855
  exports.TextHighlight = TextHighlight;
13856
+ exports.TextHtml = TextHtml;
13849
13857
  exports.Tooltip = Tooltip;
13850
13858
  exports.Transition = Transition;
13851
13859
  exports.Typography = Typography;
@@ -13880,6 +13888,7 @@ exports.getVariantResponsive = getVariantResponsive;
13880
13888
  exports.hasChild = hasChild;
13881
13889
  exports.hasChildOfType = hasChildOfType;
13882
13890
  exports.highligthText = highligthText;
13891
+ exports.innerToOuterSelectValue = innerToOuterSelectValue;
13883
13892
  exports.innerToOuterSingleValue = innerToOuterSingleValue;
13884
13893
  exports.innerToOuterValue = innerToOuterValue;
13885
13894
  exports.inputVariants = inputVariants;
@@ -13903,6 +13912,7 @@ exports.mediaMin = mediaMin;
13903
13912
  exports.mediaOnly = mediaOnly;
13904
13913
  exports.mediaUp = mediaUp;
13905
13914
  exports.modalVariants = modalVariants;
13915
+ exports.outerToInnerSelectValue = outerToInnerSelectValue;
13906
13916
  exports.outerToInnerSingleValue = outerToInnerSingleValue;
13907
13917
  exports.outerToInnerValue = outerToInnerValue;
13908
13918
  exports.pickChild = pickChild;