@websolutespa/bom-mixer-ui 1.8.15 → 1.9.0
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 +12 -0
- package/dist/cjs/index.js +131 -29
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/submit/submit.js +11 -0
- package/dist/esm/components/submit/submit.js.map +1 -0
- package/dist/esm/fields/field-accept.js +1 -0
- package/dist/esm/fields/field-accept.js.map +1 -1
- package/dist/esm/fields/field-autocomplete.js +1 -0
- package/dist/esm/fields/field-autocomplete.js.map +1 -1
- package/dist/esm/fields/field-card.js +1 -0
- package/dist/esm/fields/field-card.js.map +1 -1
- package/dist/esm/fields/field-checkbox.js +1 -0
- package/dist/esm/fields/field-checkbox.js.map +1 -1
- package/dist/esm/fields/field-combobox.js +5 -3
- package/dist/esm/fields/field-combobox.js.map +1 -1
- package/dist/esm/fields/field-password.js +1 -0
- package/dist/esm/fields/field-password.js.map +1 -1
- package/dist/esm/fields/field-radio.js +1 -0
- package/dist/esm/fields/field-radio.js.map +1 -1
- package/dist/esm/fields/field-select.js +1 -0
- package/dist/esm/fields/field-select.js.map +1 -1
- package/dist/esm/fields/field-text.js +1 -0
- package/dist/esm/fields/field-text.js.map +1 -1
- package/dist/esm/fields/field-textarea.js +1 -0
- package/dist/esm/fields/field-textarea.js.map +1 -1
- package/dist/esm/forms/combobox/combobox-combobox.js +8 -0
- package/dist/esm/forms/combobox/combobox-combobox.js.map +1 -1
- package/dist/esm/forms/combobox/combobox.js +14 -3
- package/dist/esm/forms/combobox/combobox.js.map +1 -1
- package/dist/esm/forms/fieldset/fieldset.js +54 -0
- package/dist/esm/forms/fieldset/fieldset.js.map +1 -0
- package/dist/esm/forms/form/form.js +25 -5
- package/dist/esm/forms/form/form.js.map +1 -1
- package/dist/esm/forms/form-tester/form-tester.js +28 -20
- package/dist/esm/forms/form-tester/form-tester.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layouts/layout-default/layout-default.js +1 -0
- package/dist/esm/layouts/layout-default/layout-default.js.map +1 -1
- package/dist/esm/layouts/layout-fixed/layout-fixed.js +1 -0
- package/dist/esm/layouts/layout-fixed/layout-fixed.js.map +1 -1
- package/dist/esm/sections/icons/icons.js +1 -0
- package/dist/esm/sections/icons/icons.js.map +1 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/submit/submit.d.ts +3 -0
- package/dist/types/components/submit/submit.d.ts.map +1 -0
- package/dist/types/fields/field-combobox.d.ts.map +1 -1
- package/dist/types/forms/combobox/combobox-combobox.d.ts.map +1 -1
- package/dist/types/forms/combobox/combobox.d.ts.map +1 -1
- package/dist/types/forms/fieldset/fieldset.d.ts +11 -0
- package/dist/types/forms/fieldset/fieldset.d.ts.map +1 -0
- package/dist/types/forms/form/form.d.ts +2 -2
- package/dist/types/forms/form/form.d.ts.map +1 -1
- package/dist/types/forms/form-tester/form-tester.d.ts +5 -4
- package/dist/types/forms/form-tester/form-tester.d.ts.map +1 -1
- package/dist/types/forms/index.d.ts +1 -0
- package/dist/types/forms/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/submit/submit.tsx +5 -0
- package/src/fields/field-combobox.tsx +4 -1
- package/src/forms/combobox/combobox-combobox.tsx +10 -1
- package/src/forms/combobox/combobox.tsx +13 -2
- package/src/forms/fieldset/fieldset.tsx +70 -0
- package/src/forms/form/form.tsx +25 -6
- package/src/forms/form-tester/form-tester.tsx +57 -49
- package/src/forms/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @websolutespa/bom-mixer-ui
|
|
2
2
|
|
|
3
|
+
## 1.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added: Fieldset, Submit
|
|
8
|
+
- Modified: FieldCombobox, FormTester, Form
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @websolutespa/bom-mixer-forms@1.9.0
|
|
14
|
+
|
|
3
15
|
## 1.8.15
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -7559,6 +7559,12 @@ const Skeleton = _a => {
|
|
|
7559
7559
|
}));
|
|
7560
7560
|
};
|
|
7561
7561
|
|
|
7562
|
+
function Submit(props) {
|
|
7563
|
+
return jsxRuntime.jsx(Button, Object.assign({}, props, {
|
|
7564
|
+
type: "submit"
|
|
7565
|
+
}));
|
|
7566
|
+
}
|
|
7567
|
+
|
|
7562
7568
|
const SvgAnimationStrategy = {
|
|
7563
7569
|
Default: 'default',
|
|
7564
7570
|
// autoplay
|
|
@@ -9363,28 +9369,39 @@ function Combobox$1(_a) {
|
|
|
9363
9369
|
const value = outerToInnerSingleValue(outerValue);
|
|
9364
9370
|
const defaultValue = outerToInnerSingleValue(outerDefaultValue) || '';
|
|
9365
9371
|
const [innerValue, setInnerValue] = React.useState(value || defaultValue);
|
|
9366
|
-
|
|
9372
|
+
outerToInnerValue(outerSelectedValue);
|
|
9367
9373
|
const defaultSelectedValue = outerToInnerValue(outerDefaultSelectedValue) || (multiple ? [] : '');
|
|
9368
9374
|
const [innerSelectedValue, setInnerSelectedValue] = React.useState();
|
|
9369
9375
|
// console.log('value', value, 'defaultValue', defaultValue);
|
|
9370
9376
|
React.useEffect(() => {
|
|
9377
|
+
const value = outerToInnerSingleValue(outerValue);
|
|
9371
9378
|
if (innerValue !== value) {
|
|
9372
9379
|
setInnerValue(value);
|
|
9373
9380
|
}
|
|
9374
|
-
}, [innerValue,
|
|
9381
|
+
}, [innerValue, outerValue]);
|
|
9375
9382
|
React.useEffect(() => {
|
|
9383
|
+
const selectedValue = outerToInnerValue(outerSelectedValue);
|
|
9384
|
+
// console.log('Combobox', selectedValue, innerSelectedValue);
|
|
9376
9385
|
if (innerSelectedValue !== selectedValue) {
|
|
9386
|
+
setInnerValue(Array.isArray(selectedValue) ? selectedValue[0] : selectedValue);
|
|
9377
9387
|
setInnerSelectedValue(selectedValue);
|
|
9378
9388
|
}
|
|
9379
|
-
}, [innerSelectedValue,
|
|
9389
|
+
}, [innerSelectedValue, outerSelectedValue]);
|
|
9380
9390
|
const onBlur_ = event => {
|
|
9391
|
+
/*
|
|
9392
|
+
if (selectedValue) {
|
|
9393
|
+
setInnerValue(Array.isArray(selectedValue) ? selectedValue[0] : selectedValue);
|
|
9394
|
+
}
|
|
9395
|
+
*/
|
|
9381
9396
|
onBlur && onBlur(event);
|
|
9382
9397
|
};
|
|
9383
9398
|
const onFocus_ = event => {
|
|
9384
9399
|
// console.log('onFocus_', selectedValue);
|
|
9400
|
+
/*
|
|
9385
9401
|
if (selectedValue) {
|
|
9386
9402
|
setInnerValue('');
|
|
9387
9403
|
}
|
|
9404
|
+
*/
|
|
9388
9405
|
onFocus && onFocus(event);
|
|
9389
9406
|
};
|
|
9390
9407
|
const onSetValue = value => {
|
|
@@ -9518,6 +9535,12 @@ const ComboboxCombobox = /*#__PURE__*/React.forwardRef(function ComboboxCombobox
|
|
|
9518
9535
|
if (!store) {
|
|
9519
9536
|
return;
|
|
9520
9537
|
}
|
|
9538
|
+
const onPointerDown = () => {
|
|
9539
|
+
// store.setValue('');
|
|
9540
|
+
};
|
|
9541
|
+
const onBlur = () => {
|
|
9542
|
+
// store.setValue(Array.isArray(selectedValue) ? selectedValue[0] : selectedValue);
|
|
9543
|
+
};
|
|
9521
9544
|
const classNames = bomCore.getClassNames('combobox__combobox', {
|
|
9522
9545
|
empty: isEmptyValue(selectedValue)
|
|
9523
9546
|
}, className);
|
|
@@ -9528,6 +9551,8 @@ const ComboboxCombobox = /*#__PURE__*/React.forwardRef(function ComboboxCombobox
|
|
|
9528
9551
|
variants: variants || context.variants,
|
|
9529
9552
|
children: jsxRuntime.jsxs("div", {
|
|
9530
9553
|
className: "combobox__input-group",
|
|
9554
|
+
onPointerDown: onPointerDown,
|
|
9555
|
+
onBlur: onBlur,
|
|
9531
9556
|
children: [before, jsxRuntime.jsx(ComboboxInputStyle, Object.assign({
|
|
9532
9557
|
ref: ref,
|
|
9533
9558
|
className: bomCore.getClassNames('combobox__input'),
|
|
@@ -10365,6 +10390,51 @@ const Field = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
10365
10390
|
});
|
|
10366
10391
|
Field.displayName = 'Field';
|
|
10367
10392
|
|
|
10393
|
+
// ${props => getVariantKey('fieldset', props.variant, props.variants)}
|
|
10394
|
+
const StyledFieldset = styled__default.default.fieldset`
|
|
10395
|
+
display: flex;
|
|
10396
|
+
flex-wrap: wrap;
|
|
10397
|
+
gap: 1rem;
|
|
10398
|
+
|
|
10399
|
+
& > * {
|
|
10400
|
+
flex: 1 1 340px;
|
|
10401
|
+
}
|
|
10402
|
+
|
|
10403
|
+
// reset
|
|
10404
|
+
border: 0;
|
|
10405
|
+
padding: 0.001em 0 0 0;
|
|
10406
|
+
margin: 0;
|
|
10407
|
+
min-width: 0;
|
|
10408
|
+
|
|
10409
|
+
legend {
|
|
10410
|
+
padding: 0;
|
|
10411
|
+
display: table;
|
|
10412
|
+
}
|
|
10413
|
+
|
|
10414
|
+
${props => getCssResponsive(props)}
|
|
10415
|
+
`;
|
|
10416
|
+
const Fieldset = /*#__PURE__*/React.forwardRef(function Fieldset(_a, ref) {
|
|
10417
|
+
var {
|
|
10418
|
+
as = 'fieldset',
|
|
10419
|
+
className,
|
|
10420
|
+
before,
|
|
10421
|
+
children,
|
|
10422
|
+
after
|
|
10423
|
+
} = _a,
|
|
10424
|
+
// variant = 'default',
|
|
10425
|
+
// variants,
|
|
10426
|
+
props = __rest(_a, ["as", "className", "before", "children", "after"]);
|
|
10427
|
+
// const globalVariants = useVariants('fieldset', fieldsetVariants);
|
|
10428
|
+
// variants = variants || globalVariants;
|
|
10429
|
+
// const classNames = getClassNames('fieldset', className, variant);
|
|
10430
|
+
const classNames = bomCore.getClassNames('fieldset', className);
|
|
10431
|
+
return jsxRuntime.jsxs(StyledFieldset, Object.assign({
|
|
10432
|
+
className: classNames
|
|
10433
|
+
}, props, {
|
|
10434
|
+
children: [before, children, after]
|
|
10435
|
+
}));
|
|
10436
|
+
});
|
|
10437
|
+
|
|
10368
10438
|
const CssFormErrorDefault = styled.css`
|
|
10369
10439
|
font-size: var(--form-error-font-size, 0.9rem);
|
|
10370
10440
|
font-weight: var(--form-error-font-weight, 500);
|
|
@@ -10446,33 +10516,42 @@ const StyledFormTester = styled__default.default.div`
|
|
|
10446
10516
|
${props => getVariant(props.variant, props.variants)}
|
|
10447
10517
|
${props => getCssResponsive(props)}
|
|
10448
10518
|
`;
|
|
10449
|
-
const FormTester = /*#__PURE__*/React.forwardRef((_a, ref)
|
|
10519
|
+
const FormTester = /*#__PURE__*/React.forwardRef(function FormTester(_a, ref) {
|
|
10450
10520
|
var {
|
|
10451
10521
|
className,
|
|
10452
10522
|
form,
|
|
10453
|
-
|
|
10454
|
-
onTest,
|
|
10523
|
+
test,
|
|
10455
10524
|
variant = 'default',
|
|
10456
10525
|
variants
|
|
10457
10526
|
} = _a,
|
|
10458
|
-
props = __rest(_a, ["className", "form", "
|
|
10527
|
+
props = __rest(_a, ["className", "form", "test", "variant", "variants"]);
|
|
10459
10528
|
const label = bomMixerHooks.useLabel();
|
|
10460
10529
|
const globalVariants = useVariants('formTester', formTesterVariants);
|
|
10461
10530
|
variants = variants || globalVariants;
|
|
10531
|
+
const [json, setJson] = React.useState(form ? JSON.stringify(form.value, null, 2) : null);
|
|
10532
|
+
React.useEffect(() => {
|
|
10533
|
+
const onChange = value => {
|
|
10534
|
+
// console.log('FormTesterComponent.onChange', value);
|
|
10535
|
+
setJson(JSON.stringify(value, null, 2));
|
|
10536
|
+
};
|
|
10537
|
+
form.on('change', onChange);
|
|
10538
|
+
return () => form.off('change', onChange);
|
|
10539
|
+
}, [form]);
|
|
10540
|
+
const onReset = () => {
|
|
10541
|
+
form.reset();
|
|
10542
|
+
props.onReset && props.onReset();
|
|
10543
|
+
};
|
|
10544
|
+
const onTest = () => {
|
|
10545
|
+
form.patch(test);
|
|
10546
|
+
props.onTest && props.onTest();
|
|
10547
|
+
};
|
|
10548
|
+
const classNames = bomCore.getClassNames('input', className, variant);
|
|
10462
10549
|
const {
|
|
10463
10550
|
enabled
|
|
10464
10551
|
} = useFormTester();
|
|
10465
10552
|
if (!enabled) {
|
|
10466
10553
|
return null;
|
|
10467
10554
|
}
|
|
10468
|
-
const onReset_ = event => {
|
|
10469
|
-
onReset && onReset(event);
|
|
10470
|
-
};
|
|
10471
|
-
const onTest_ = event => {
|
|
10472
|
-
onTest && onTest(event);
|
|
10473
|
-
};
|
|
10474
|
-
const json = form ? JSON.stringify(form.value, null, 2) : null;
|
|
10475
|
-
const classNames = bomCore.getClassNames('input', className, variant);
|
|
10476
10555
|
return jsxRuntime.jsx(StyledFormTester, Object.assign({
|
|
10477
10556
|
ref: ref,
|
|
10478
10557
|
className: classNames,
|
|
@@ -10489,25 +10568,25 @@ const FormTester = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
10489
10568
|
}), jsxRuntime.jsx(Text, {
|
|
10490
10569
|
variant: "paragraph30",
|
|
10491
10570
|
lineHeight: "1.3",
|
|
10492
|
-
children: "this component is visible
|
|
10571
|
+
children: "this component is only visible during development."
|
|
10493
10572
|
})]
|
|
10494
10573
|
}), json && jsxRuntime.jsx("code", {
|
|
10495
10574
|
children: json
|
|
10496
|
-
}),
|
|
10575
|
+
}), jsxRuntime.jsxs(Flex.Row, {
|
|
10497
10576
|
className: "actions",
|
|
10498
10577
|
justifyContent: "space-between",
|
|
10499
10578
|
children: [jsxRuntime.jsx(Flex, {
|
|
10500
|
-
children:
|
|
10579
|
+
children: jsxRuntime.jsx(Button, {
|
|
10501
10580
|
variant: "outline",
|
|
10502
10581
|
size: "sm",
|
|
10503
|
-
onClick:
|
|
10582
|
+
onClick: () => onReset(),
|
|
10504
10583
|
children: label('form.reset')
|
|
10505
10584
|
})
|
|
10506
10585
|
}), jsxRuntime.jsx(Flex, {
|
|
10507
|
-
children:
|
|
10586
|
+
children: jsxRuntime.jsx(Button, {
|
|
10508
10587
|
variant: "primary",
|
|
10509
10588
|
size: "sm",
|
|
10510
|
-
onClick:
|
|
10589
|
+
onClick: () => onTest(),
|
|
10511
10590
|
children: label('form.test')
|
|
10512
10591
|
})
|
|
10513
10592
|
})]
|
|
@@ -10515,7 +10594,6 @@ const FormTester = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
10515
10594
|
})
|
|
10516
10595
|
}));
|
|
10517
10596
|
});
|
|
10518
|
-
FormTester.displayName = 'FormTester';
|
|
10519
10597
|
|
|
10520
10598
|
const StyledForm = styled__default.default.div`
|
|
10521
10599
|
${props => getForm(props)}
|
|
@@ -10524,13 +10602,33 @@ const StyledForm = styled__default.default.div`
|
|
|
10524
10602
|
const Form = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
10525
10603
|
var {
|
|
10526
10604
|
className,
|
|
10527
|
-
|
|
10605
|
+
form,
|
|
10528
10606
|
variant
|
|
10529
10607
|
} = _a,
|
|
10530
|
-
props = __rest(_a, ["className", "
|
|
10531
|
-
const
|
|
10608
|
+
props = __rest(_a, ["className", "form", "variant"]);
|
|
10609
|
+
const innerRef = React.useRef(null);
|
|
10610
|
+
React.useImperativeHandle(ref, () => innerRef.current);
|
|
10611
|
+
React.useEffect(() => {
|
|
10612
|
+
if (form) {
|
|
10613
|
+
const onChange = value => {
|
|
10614
|
+
console.log('FormComponent.onChange', form.state);
|
|
10615
|
+
if (innerRef.current !== null) {
|
|
10616
|
+
const formElement = innerRef.current;
|
|
10617
|
+
Object.entries(form.state).forEach(_ref => {
|
|
10618
|
+
let [k, v] = _ref;
|
|
10619
|
+
formElement.classList.toggle(k, v);
|
|
10620
|
+
});
|
|
10621
|
+
}
|
|
10622
|
+
};
|
|
10623
|
+
form.on('change', onChange);
|
|
10624
|
+
return () => form.off('change', onChange);
|
|
10625
|
+
}
|
|
10626
|
+
return;
|
|
10627
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10628
|
+
}, [form]);
|
|
10629
|
+
const classNames = bomCore.getClassNames('form', className, variant);
|
|
10532
10630
|
return jsxRuntime.jsx(StyledForm, Object.assign({
|
|
10533
|
-
ref:
|
|
10631
|
+
ref: innerRef,
|
|
10534
10632
|
className: classNames,
|
|
10535
10633
|
as: "form",
|
|
10536
10634
|
variant: variant
|
|
@@ -12579,6 +12677,7 @@ function FieldCombobox(_ref) {
|
|
|
12579
12677
|
const onChange = option => {
|
|
12580
12678
|
setValue(option);
|
|
12581
12679
|
};
|
|
12680
|
+
console.log('FieldCombobox', control.value);
|
|
12582
12681
|
return state.flags.hidden ? jsxRuntime.jsx("input", {
|
|
12583
12682
|
type: "hidden",
|
|
12584
12683
|
value: bomMixerForms.valueToString(state.value)
|
|
@@ -12595,6 +12694,7 @@ function FieldCombobox(_ref) {
|
|
|
12595
12694
|
children: label(control.label)
|
|
12596
12695
|
}), jsxRuntime.jsx(Combobox.Combobox, {
|
|
12597
12696
|
after: icon || jsxRuntime.jsx(bomMixerIcons.IconChevronDown, {}),
|
|
12697
|
+
autoSelect: true,
|
|
12598
12698
|
placeholder: control.placeholder && label(control.placeholder)
|
|
12599
12699
|
}), jsxRuntime.jsx(Combobox.Popover, {
|
|
12600
12700
|
gutter: 4,
|
|
@@ -12612,10 +12712,10 @@ function FieldCombobox(_ref) {
|
|
|
12612
12712
|
children: label('noResults')
|
|
12613
12713
|
});
|
|
12614
12714
|
}
|
|
12615
|
-
}), jsxRuntime.jsx(FieldError, {
|
|
12616
|
-
state: state
|
|
12617
12715
|
})]
|
|
12618
|
-
}), ((_a = control.customData) === null || _a === void 0 ? void 0 : _a.after) && control.customData.after
|
|
12716
|
+
}), ((_a = control.customData) === null || _a === void 0 ? void 0 : _a.after) && control.customData.after, jsxRuntime.jsx(FieldError, {
|
|
12717
|
+
state: state
|
|
12718
|
+
})]
|
|
12619
12719
|
});
|
|
12620
12720
|
}
|
|
12621
12721
|
|
|
@@ -13768,6 +13868,7 @@ exports.FieldRadio = FieldRadio;
|
|
|
13768
13868
|
exports.FieldSelect = FieldSelect;
|
|
13769
13869
|
exports.FieldText = FieldText;
|
|
13770
13870
|
exports.FieldTextArea = FieldTextArea;
|
|
13871
|
+
exports.Fieldset = Fieldset;
|
|
13771
13872
|
exports.Flex = Flex;
|
|
13772
13873
|
exports.FlexRow = FlexRow;
|
|
13773
13874
|
exports.Footer = Footer;
|
|
@@ -13857,6 +13958,7 @@ exports.SelectSelectCss = SelectSelectCss;
|
|
|
13857
13958
|
exports.SelectValueCss = SelectValueCss;
|
|
13858
13959
|
exports.Skeleton = Skeleton;
|
|
13859
13960
|
exports.StyledContainer = StyledContainer;
|
|
13961
|
+
exports.Submit = Submit;
|
|
13860
13962
|
exports.Svg = Svg;
|
|
13861
13963
|
exports.SvgAnimation = SvgAnimation;
|
|
13862
13964
|
exports.SwiperComponent = SwiperComponent;
|