@configura/web-ui 2.0.0-alpha.9 → 2.0.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.
Files changed (118) hide show
  1. package/.eslintrc.json +5 -0
  2. package/.postcssrc.json +8 -8
  3. package/LICENSE +201 -201
  4. package/README.md +1 -1
  5. package/dist/components/CanvasWrapper.d.ts +9 -9
  6. package/dist/components/CanvasWrapper.js +8 -8
  7. package/dist/components/CfgPriceView.d.ts +6 -6
  8. package/dist/components/CfgPriceView.js +13 -13
  9. package/dist/components/ConfigurationActionsButtonRow.d.ts +14 -14
  10. package/dist/components/ConfigurationActionsButtonRow.js +16 -16
  11. package/dist/components/Configurator.d.ts +12 -12
  12. package/dist/components/Configurator.js +15 -15
  13. package/dist/components/ConfiguratorWrapper.d.ts +8 -8
  14. package/dist/components/ConfiguratorWrapper.js +5 -5
  15. package/dist/components/CurrencyPrice.d.ts +9 -9
  16. package/dist/components/CurrencyPrice.js +7 -7
  17. package/dist/components/ErrorContext.d.ts +2 -2
  18. package/dist/components/ErrorContext.js +2 -2
  19. package/dist/components/ExpandableHeadingRow.d.ts +15 -15
  20. package/dist/components/ExpandableHeadingRow.js +23 -21
  21. package/dist/components/Loading.d.ts +13 -13
  22. package/dist/components/Loading.js +20 -20
  23. package/dist/components/ProductInformation.d.ts +13 -13
  24. package/dist/components/ProductInformation.js +14 -14
  25. package/dist/components/ResetButton.d.ts +9 -0
  26. package/dist/components/ResetButton.js +7 -0
  27. package/dist/components/ShareView.d.ts +4 -0
  28. package/dist/components/ShareView.js +21 -0
  29. package/dist/components/TaskListView.d.ts +8 -8
  30. package/dist/components/TaskListView.js +69 -69
  31. package/dist/components/TaskStartView.d.ts +12 -12
  32. package/dist/components/TaskStartView.js +29 -29
  33. package/dist/components/icons/Checkmark.d.ts +6 -6
  34. package/dist/components/icons/Checkmark.js +12 -12
  35. package/dist/components/icons/Chevron.d.ts +7 -7
  36. package/dist/components/icons/Chevron.js +18 -18
  37. package/dist/components/icons/CircleXmarkIcon.d.ts +3 -3
  38. package/dist/components/icons/CircleXmarkIcon.js +8 -8
  39. package/dist/components/icons/DownloadIcon.d.ts +3 -3
  40. package/dist/components/icons/DownloadIcon.js +8 -8
  41. package/dist/components/icons/ErrorIcon.d.ts +3 -3
  42. package/dist/components/icons/ErrorIcon.js +8 -8
  43. package/dist/components/productConfiguration/CfgAdditionalProductView.d.ts +3 -3
  44. package/dist/components/productConfiguration/CfgAdditionalProductView.js +46 -42
  45. package/dist/components/productConfiguration/CfgCheckboxView.d.ts +4 -7
  46. package/dist/components/productConfiguration/CfgCheckboxView.js +7 -29
  47. package/dist/components/productConfiguration/CfgCheckboxesView.d.ts +4 -7
  48. package/dist/components/productConfiguration/CfgCheckboxesView.js +20 -18
  49. package/dist/components/productConfiguration/CfgConfigurationCommonView.d.ts +8 -0
  50. package/dist/components/productConfiguration/CfgConfigurationCommonView.js +8 -0
  51. package/dist/components/productConfiguration/CfgDropdownOptionView.d.ts +4 -7
  52. package/dist/components/productConfiguration/CfgDropdownOptionView.js +23 -44
  53. package/dist/components/productConfiguration/CfgDropdownView.d.ts +4 -7
  54. package/dist/components/productConfiguration/CfgDropdownView.js +23 -20
  55. package/dist/components/productConfiguration/CfgFeatureView.d.ts +72 -31
  56. package/dist/components/productConfiguration/CfgFeatureView.js +76 -60
  57. package/dist/components/productConfiguration/CfgGroupView.d.ts +4 -4
  58. package/dist/components/productConfiguration/CfgGroupView.js +7 -7
  59. package/dist/components/productConfiguration/CfgMiscFile.d.ts +5 -0
  60. package/dist/components/productConfiguration/CfgMiscFile.js +9 -0
  61. package/dist/components/productConfiguration/CfgMiscFiles.d.ts +5 -0
  62. package/dist/components/productConfiguration/CfgMiscFiles.js +5 -0
  63. package/dist/components/productConfiguration/CfgNote.d.ts +5 -0
  64. package/dist/components/productConfiguration/CfgNote.js +15 -0
  65. package/dist/components/productConfiguration/CfgNotes.d.ts +5 -0
  66. package/dist/components/productConfiguration/CfgNotes.js +5 -0
  67. package/dist/components/productConfiguration/CfgOptionCommonView.d.ts +7 -0
  68. package/dist/components/productConfiguration/CfgOptionCommonView.js +48 -0
  69. package/dist/components/productConfiguration/CfgOptionNumericView.d.ts +29 -29
  70. package/dist/components/productConfiguration/CfgOptionNumericView.js +132 -132
  71. package/dist/components/productConfiguration/CfgOptionPriceView.d.ts +9 -9
  72. package/dist/components/productConfiguration/CfgOptionPriceView.js +31 -29
  73. package/dist/components/productConfiguration/CfgProductConfigurationView.d.ts +22 -22
  74. package/dist/components/productConfiguration/CfgProductConfigurationView.js +50 -47
  75. package/dist/css/web-ui.css +1 -1
  76. package/dist/css/web-ui.css.map +1 -1
  77. package/dist/index.d.ts +29 -24
  78. package/dist/index.js +29 -24
  79. package/dist/scss/_button.scss +52 -52
  80. package/dist/scss/_configurator.scss +132 -88
  81. package/dist/scss/_expandable.scss +38 -37
  82. package/dist/scss/_feature-item.scss +142 -137
  83. package/dist/scss/_forms.scss +44 -42
  84. package/dist/scss/_hr.scss +16 -16
  85. package/dist/scss/_loading.scss +98 -98
  86. package/dist/scss/_misc-file-and-note.scss +44 -0
  87. package/dist/scss/_mixins.scss +56 -56
  88. package/dist/scss/_option-tree.scss +29 -29
  89. package/dist/scss/_product-information.scss +53 -49
  90. package/dist/scss/_range-view.scss +39 -39
  91. package/dist/scss/_slider.scss +70 -70
  92. package/dist/scss/_tasks.scss +72 -72
  93. package/dist/scss/_themed.scss +156 -149
  94. package/dist/scss/_utilities.scss +21 -21
  95. package/dist/scss/_variables.scss +6 -6
  96. package/dist/scss/icons/_checkmark.scss +46 -46
  97. package/dist/scss/icons/_chevron.scss +62 -62
  98. package/dist/scss/icons/_circle-xmark-icon.scss +24 -24
  99. package/dist/scss/icons/_download-icon.scss +24 -24
  100. package/dist/scss/icons/_error-icon.scss +24 -24
  101. package/dist/scss/web-ui.scss +11 -11
  102. package/dist/useCatParams.d.ts +17 -17
  103. package/dist/useCatParams.js +29 -29
  104. package/dist/useObservable.d.ts +4 -4
  105. package/dist/useObservable.js +18 -18
  106. package/dist/useRerender.d.ts +1 -1
  107. package/dist/useRerender.js +5 -5
  108. package/dist/useResize.d.ts +6 -6
  109. package/dist/useResize.js +47 -47
  110. package/dist/useSelected.d.ts +2 -2
  111. package/dist/useSelected.js +13 -13
  112. package/dist/useUniqueId.d.ts +1 -1
  113. package/dist/useUniqueId.js +3 -7
  114. package/dist/utilities.d.ts +5 -5
  115. package/dist/utilities.js +1 -1
  116. package/package.json +3 -3
  117. package/dist/components/productConfiguration/CfgOptionFeaturesView.d.ts +0 -4
  118. package/dist/components/productConfiguration/CfgOptionFeaturesView.js +0 -13
@@ -1,32 +1,73 @@
1
- import { CfgFeature, CfgOption, CfgProduct } from "@configura/web-api";
2
- import React from "react";
3
- import { CssProps } from "../../utilities.js";
4
- import { PassthroughProps } from "./CfgProductConfigurationView.js";
5
- export declare type CfgFeatureViewProps = CfgProductConfigurationComponentAndPassthroughProps & {
6
- feature: CfgFeature;
7
- };
8
- export declare type CfgOptionViewProps = CfgProductConfigurationComponentAndPassthroughProps & {
9
- option: CfgOption;
10
- };
11
- export declare type CfgAdditionalProductViewProps = CfgProductConfigurationComponentAndPassthroughProps & {
12
- product: CfgProduct;
13
- permanentlyExpandedLevels: number;
14
- };
15
- export declare type CfgProductConfigurationComponent = {
16
- additionalProductComponent: React.ComponentType<CfgAdditionalProductViewProps>;
17
- featureFlattenComponent: React.ComponentType<CfgFeatureViewProps>;
18
- featureGroupComponent: React.ComponentType<CfgFeatureViewProps>;
19
- featureSelectManyComponent: React.ComponentType<CfgFeatureViewProps>;
20
- optionSelectManyComponent: React.ComponentType<CfgOptionViewProps>;
21
- featureSelectOneComponent: React.ComponentType<CfgFeatureViewProps>;
22
- optionSelectOneComponent: React.ComponentType<CfgOptionViewProps>;
23
- };
24
- export declare const completeWithDefaultProductConfigurationComponents: <T>(incomplete: T & Partial<CfgProductConfigurationComponent>) => T & CfgProductConfigurationComponent;
25
- export declare const useCompleteWithDefaultProductConfigurationComponents: (incomplete: Partial<CfgProductConfigurationComponent>) => CfgProductConfigurationComponent;
26
- export declare type CfgProductConfigurationComponentAndPassthroughProps = PassthroughProps & CfgProductConfigurationComponent;
27
- export declare const forwardProps: (props: CfgProductConfigurationComponentAndPassthroughProps) => CfgProductConfigurationComponentAndPassthroughProps;
28
- export declare const CfgFeatureView: React.FC<CfgFeatureViewProps & CssProps>;
29
- export declare const CfgFeatureViewMemo: React.NamedExoticComponent<PassthroughProps & CfgProductConfigurationComponent & {
30
- feature: CfgFeature;
31
- } & CssProps>;
1
+ import { CfgFeature, CfgOption, CfgProduct, DtoMiscFile, DtoNote } from "@configura/web-api";
2
+ import React from "react";
3
+ import { CssProps } from "../../utilities.js";
4
+ import { PassthroughProps } from "./CfgProductConfigurationView.js";
5
+ export declare type CfgFeatureViewProps = CfgProductConfigurationComponentAndPassthroughProps & {
6
+ feature: CfgFeature;
7
+ };
8
+ export declare type CfgOptionViewProps = CfgProductConfigurationComponentAndPassthroughProps & {
9
+ option: CfgOption;
10
+ };
11
+ export declare type CfgAdditionalProductViewProps = CfgProductConfigurationComponentAndPassthroughProps & {
12
+ product: CfgProduct;
13
+ permanentlyExpandedLevels: number;
14
+ };
15
+ export declare type CfgNoteViewProps = CssProps & {
16
+ note: DtoNote;
17
+ };
18
+ declare type CfgNoteComponent = {
19
+ noteComponent: React.ComponentType<CfgNoteViewProps>;
20
+ };
21
+ export declare type CfgNotesViewProps = CssProps & CfgNoteComponent & {
22
+ notes: DtoNote[];
23
+ };
24
+ export declare type CfgMiscFileViewProps = CssProps & {
25
+ miscFile: DtoMiscFile;
26
+ };
27
+ declare type CfgMiscFileComponent = {
28
+ miscFileComponent: React.ComponentType<CfgMiscFileViewProps>;
29
+ };
30
+ export declare type CfgMiscFilesViewProps = CssProps & CfgMiscFileComponent & {
31
+ miscFiles: DtoMiscFile[];
32
+ };
33
+ export declare type CfgProductConfigurationComponent = {
34
+ additionalProductComponent: React.ComponentType<CfgAdditionalProductViewProps>;
35
+ featureFlattenComponent: React.ComponentType<CfgFeatureViewProps>;
36
+ featureGroupComponent: React.ComponentType<CfgFeatureViewProps>;
37
+ featureSelectManyComponent: React.ComponentType<CfgFeatureViewProps>;
38
+ optionSelectManyComponent: React.ComponentType<CfgOptionViewProps>;
39
+ featureSelectOneComponent: React.ComponentType<CfgFeatureViewProps>;
40
+ optionSelectOneComponent: React.ComponentType<CfgOptionViewProps>;
41
+ notesComponent: React.ComponentType<CfgNotesViewProps>;
42
+ miscFilesComponent: React.ComponentType<CfgMiscFilesViewProps>;
43
+ } & CfgMiscFileComponent & CfgNoteComponent;
44
+ export declare const completeWithDefaultProductConfigurationComponents: <T>(incomplete: T & Partial<CfgProductConfigurationComponent>) => T & {
45
+ additionalProductComponent: React.ComponentType<CfgAdditionalProductViewProps>;
46
+ featureFlattenComponent: React.ComponentType<CfgFeatureViewProps>;
47
+ featureGroupComponent: React.ComponentType<CfgFeatureViewProps>;
48
+ featureSelectManyComponent: React.ComponentType<CfgFeatureViewProps>;
49
+ optionSelectManyComponent: React.ComponentType<CfgOptionViewProps>;
50
+ featureSelectOneComponent: React.ComponentType<CfgFeatureViewProps>;
51
+ optionSelectOneComponent: React.ComponentType<CfgOptionViewProps>;
52
+ notesComponent: React.ComponentType<CfgNotesViewProps>;
53
+ miscFilesComponent: React.ComponentType<CfgMiscFilesViewProps>;
54
+ } & CfgMiscFileComponent & CfgNoteComponent;
55
+ export declare const useCompleteWithDefaultProductConfigurationComponents: (incomplete: Partial<CfgProductConfigurationComponent>) => CfgProductConfigurationComponent;
56
+ export declare type CfgProductConfigurationComponentAndPassthroughProps = PassthroughProps & CssProps & CfgProductConfigurationComponent;
57
+ export declare const forwardProps: (props: CfgProductConfigurationComponentAndPassthroughProps) => CfgProductConfigurationComponentAndPassthroughProps;
58
+ export declare const CfgFeatureView: React.FC<CfgFeatureViewProps & CssProps>;
59
+ export declare const CfgFeatureViewMemo: React.NamedExoticComponent<PassthroughProps & CssProps & {
60
+ additionalProductComponent: React.ComponentType<CfgAdditionalProductViewProps>;
61
+ featureFlattenComponent: React.ComponentType<CfgFeatureViewProps>;
62
+ featureGroupComponent: React.ComponentType<CfgFeatureViewProps>;
63
+ featureSelectManyComponent: React.ComponentType<CfgFeatureViewProps>;
64
+ optionSelectManyComponent: React.ComponentType<CfgOptionViewProps>;
65
+ featureSelectOneComponent: React.ComponentType<CfgFeatureViewProps>;
66
+ optionSelectOneComponent: React.ComponentType<CfgOptionViewProps>;
67
+ notesComponent: React.ComponentType<CfgNotesViewProps>;
68
+ miscFilesComponent: React.ComponentType<CfgMiscFilesViewProps>;
69
+ } & CfgMiscFileComponent & CfgNoteComponent & {
70
+ feature: CfgFeature;
71
+ }>;
72
+ export {};
32
73
  //# sourceMappingURL=CfgFeatureView.d.ts.map
@@ -1,60 +1,76 @@
1
- import { SelectionType } from "@configura/web-api";
2
- import React, { useMemo } from "react";
3
- import { CfgAdditionalProductView } from "./CfgAdditionalProductView.js";
4
- import { CfgCheckboxesViewMemo } from "./CfgCheckboxesView.js";
5
- import { CfgCheckboxViewMemo } from "./CfgCheckboxView.js";
6
- import { CfgDropdownOptionViewMemo } from "./CfgDropdownOptionView.js";
7
- import { CfgDropdownViewMemo } from "./CfgDropdownView.js";
8
- import { CfgGroupViewMemo } from "./CfgGroupView.js";
9
- export const completeWithDefaultProductConfigurationComponents = (incomplete) => {
10
- var _a, _b, _c, _d, _e, _f, _g;
11
- return (Object.assign(Object.assign({}, incomplete), { additionalProductComponent: (_a = incomplete.additionalProductComponent) !== null && _a !== void 0 ? _a : CfgAdditionalProductView, featureFlattenComponent: (_b = incomplete.featureFlattenComponent) !== null && _b !== void 0 ? _b : CfgGroupViewMemo, featureGroupComponent: (_c = incomplete.featureGroupComponent) !== null && _c !== void 0 ? _c : CfgGroupViewMemo, featureSelectManyComponent: (_d = incomplete.featureSelectManyComponent) !== null && _d !== void 0 ? _d : CfgCheckboxesViewMemo, optionSelectManyComponent: (_e = incomplete.optionSelectManyComponent) !== null && _e !== void 0 ? _e : CfgCheckboxViewMemo, featureSelectOneComponent: (_f = incomplete.featureSelectOneComponent) !== null && _f !== void 0 ? _f : CfgDropdownViewMemo, optionSelectOneComponent: (_g = incomplete.optionSelectOneComponent) !== null && _g !== void 0 ? _g : CfgDropdownOptionViewMemo }));
12
- };
13
- export const useCompleteWithDefaultProductConfigurationComponents = (incomplete) => {
14
- const { additionalProductComponent, featureFlattenComponent, featureGroupComponent, featureSelectManyComponent, featureSelectOneComponent, optionSelectManyComponent, optionSelectOneComponent, } = incomplete;
15
- return useMemo(() => completeWithDefaultProductConfigurationComponents({
16
- additionalProductComponent,
17
- featureFlattenComponent,
18
- featureGroupComponent,
19
- featureSelectManyComponent,
20
- featureSelectOneComponent,
21
- optionSelectManyComponent,
22
- optionSelectOneComponent,
23
- }), [
24
- additionalProductComponent,
25
- featureFlattenComponent,
26
- featureGroupComponent,
27
- featureSelectManyComponent,
28
- featureSelectOneComponent,
29
- optionSelectManyComponent,
30
- optionSelectOneComponent,
31
- ]);
32
- };
33
- export const forwardProps = (props) => ({
34
- upchargeDisplayMode: props.upchargeDisplayMode,
35
- startOpen: props.startOpen,
36
- additionalProductComponent: props.additionalProductComponent,
37
- featureFlattenComponent: props.featureFlattenComponent,
38
- featureGroupComponent: props.featureGroupComponent,
39
- featureSelectManyComponent: props.featureSelectManyComponent,
40
- optionSelectManyComponent: props.optionSelectManyComponent,
41
- featureSelectOneComponent: props.featureSelectOneComponent,
42
- optionSelectOneComponent: props.optionSelectOneComponent,
43
- });
44
- export const CfgFeatureView = (props) => {
45
- const { feature, featureFlattenComponent: FlattenComponent, featureGroupComponent: GroupComponent, featureSelectManyComponent: SelectManyComponent, featureSelectOneComponent: SelectOneComponent, } = props;
46
- if (!feature.visible) {
47
- return React.createElement(FlattenComponent, Object.assign({}, props));
48
- }
49
- switch (feature.selectionType) {
50
- case SelectionType.Group:
51
- return React.createElement(GroupComponent, Object.assign({}, props));
52
- case SelectionType.SelectMany:
53
- return React.createElement(SelectManyComponent, Object.assign({}, props));
54
- case SelectionType.SelectOne:
55
- return React.createElement(SelectOneComponent, Object.assign({}, props));
56
- default:
57
- throw Error("Unsupported viewType");
58
- }
59
- };
60
- export const CfgFeatureViewMemo = React.memo(CfgFeatureView);
1
+ import { SelectionType, } from "@configura/web-api";
2
+ import React, { useMemo } from "react";
3
+ import { CfgAdditionalProductView } from "./CfgAdditionalProductView.js";
4
+ import { CfgCheckboxesViewMemo } from "./CfgCheckboxesView.js";
5
+ import { CfgCheckboxViewMemo } from "./CfgCheckboxView.js";
6
+ import { CfgDropdownOptionViewMemo } from "./CfgDropdownOptionView.js";
7
+ import { CfgDropdownViewMemo } from "./CfgDropdownView.js";
8
+ import { CfgGroupViewMemo } from "./CfgGroupView.js";
9
+ import { CfgMiscFile } from "./CfgMiscFile.js";
10
+ import { CfgMiscFiles } from "./CfgMiscFiles.js";
11
+ import { CfgNote } from "./CfgNote.js";
12
+ import { CfgNotes } from "./CfgNotes.js";
13
+ export const completeWithDefaultProductConfigurationComponents = (incomplete) => {
14
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
15
+ return (Object.assign(Object.assign({}, incomplete), { additionalProductComponent: (_a = incomplete.additionalProductComponent) !== null && _a !== void 0 ? _a : CfgAdditionalProductView, featureFlattenComponent: (_b = incomplete.featureFlattenComponent) !== null && _b !== void 0 ? _b : CfgGroupViewMemo, featureGroupComponent: (_c = incomplete.featureGroupComponent) !== null && _c !== void 0 ? _c : CfgGroupViewMemo, featureSelectManyComponent: (_d = incomplete.featureSelectManyComponent) !== null && _d !== void 0 ? _d : CfgCheckboxesViewMemo, optionSelectManyComponent: (_e = incomplete.optionSelectManyComponent) !== null && _e !== void 0 ? _e : CfgCheckboxViewMemo, featureSelectOneComponent: (_f = incomplete.featureSelectOneComponent) !== null && _f !== void 0 ? _f : CfgDropdownViewMemo, optionSelectOneComponent: (_g = incomplete.optionSelectOneComponent) !== null && _g !== void 0 ? _g : CfgDropdownOptionViewMemo, noteComponent: (_h = incomplete.noteComponent) !== null && _h !== void 0 ? _h : CfgNote, notesComponent: (_j = incomplete.notesComponent) !== null && _j !== void 0 ? _j : CfgNotes, miscFileComponent: (_k = incomplete.miscFileComponent) !== null && _k !== void 0 ? _k : CfgMiscFile, miscFilesComponent: (_l = incomplete.miscFilesComponent) !== null && _l !== void 0 ? _l : CfgMiscFiles }));
16
+ };
17
+ export const useCompleteWithDefaultProductConfigurationComponents = (incomplete) => {
18
+ const { additionalProductComponent, featureFlattenComponent, featureGroupComponent, featureSelectManyComponent, featureSelectOneComponent, optionSelectManyComponent, optionSelectOneComponent, noteComponent, notesComponent, miscFileComponent, miscFilesComponent, } = incomplete;
19
+ return useMemo(() => completeWithDefaultProductConfigurationComponents({
20
+ additionalProductComponent,
21
+ featureFlattenComponent,
22
+ featureGroupComponent,
23
+ featureSelectManyComponent,
24
+ featureSelectOneComponent,
25
+ optionSelectManyComponent,
26
+ optionSelectOneComponent,
27
+ noteComponent,
28
+ notesComponent,
29
+ miscFileComponent,
30
+ miscFilesComponent,
31
+ }), [
32
+ additionalProductComponent,
33
+ featureFlattenComponent,
34
+ featureGroupComponent,
35
+ featureSelectManyComponent,
36
+ featureSelectOneComponent,
37
+ optionSelectManyComponent,
38
+ optionSelectOneComponent,
39
+ noteComponent,
40
+ notesComponent,
41
+ miscFileComponent,
42
+ miscFilesComponent,
43
+ ]);
44
+ };
45
+ export const forwardProps = (props) => ({
46
+ upchargeDisplayMode: props.upchargeDisplayMode,
47
+ startOpen: props.startOpen,
48
+ additionalProductComponent: props.additionalProductComponent,
49
+ featureFlattenComponent: props.featureFlattenComponent,
50
+ featureGroupComponent: props.featureGroupComponent,
51
+ featureSelectManyComponent: props.featureSelectManyComponent,
52
+ optionSelectManyComponent: props.optionSelectManyComponent,
53
+ featureSelectOneComponent: props.featureSelectOneComponent,
54
+ optionSelectOneComponent: props.optionSelectOneComponent,
55
+ noteComponent: props.noteComponent,
56
+ notesComponent: props.notesComponent,
57
+ miscFileComponent: props.miscFileComponent,
58
+ miscFilesComponent: props.miscFilesComponent,
59
+ });
60
+ export const CfgFeatureView = (props) => {
61
+ const { feature, featureFlattenComponent: FlattenComponent, featureGroupComponent: GroupComponent, featureSelectManyComponent: SelectManyComponent, featureSelectOneComponent: SelectOneComponent, } = props;
62
+ if (!feature.visible) {
63
+ return React.createElement(FlattenComponent, Object.assign({}, props));
64
+ }
65
+ switch (feature.selectionType) {
66
+ case SelectionType.Group:
67
+ return React.createElement(GroupComponent, Object.assign({}, props));
68
+ case SelectionType.SelectMany:
69
+ return React.createElement(SelectManyComponent, Object.assign({}, props));
70
+ case SelectionType.SelectOne:
71
+ return React.createElement(SelectOneComponent, Object.assign({}, props));
72
+ default:
73
+ throw Error("Unsupported viewType");
74
+ }
75
+ };
76
+ export const CfgFeatureViewMemo = React.memo(CfgFeatureView);
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { CfgFeatureViewProps } from "./CfgFeatureView.js";
3
- export declare const CfgGroupView: React.FC<CfgFeatureViewProps>;
4
- export declare const CfgGroupViewMemo: React.NamedExoticComponent<CfgFeatureViewProps>;
1
+ import React from "react";
2
+ import { CfgFeatureViewProps } from "./CfgFeatureView.js";
3
+ export declare const CfgGroupView: React.FC<CfgFeatureViewProps>;
4
+ export declare const CfgGroupViewMemo: React.NamedExoticComponent<CfgFeatureViewProps>;
5
5
  //# sourceMappingURL=CfgGroupView.d.ts.map
@@ -1,7 +1,7 @@
1
- import React from "react";
2
- import { CfgFeatureViewMemo, forwardProps } from "./CfgFeatureView.js";
3
- export const CfgGroupView = (props) => {
4
- const { feature } = props;
5
- return (React.createElement(React.Fragment, null, feature.selectedOptions.map((o) => o.features.map((f) => (React.createElement(CfgFeatureViewMemo, Object.assign({ key: f.key, feature: f }, forwardProps(props))))))));
6
- };
7
- export const CfgGroupViewMemo = React.memo(CfgGroupView);
1
+ import React from "react";
2
+ import { CfgFeatureViewMemo, forwardProps } from "./CfgFeatureView.js";
3
+ export const CfgGroupView = (props) => {
4
+ const { feature } = props;
5
+ return (React.createElement(React.Fragment, null, feature.selectedOptions.map((o) => o.features.map((f) => (React.createElement(CfgFeatureViewMemo, Object.assign({ key: f.key, feature: f }, forwardProps(props))))))));
6
+ };
7
+ export const CfgGroupViewMemo = React.memo(CfgGroupView);
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { CssProps } from "../../utilities";
3
+ import { CfgMiscFileViewProps } from "./CfgFeatureView.js";
4
+ export declare const CfgMiscFile: React.FC<CfgMiscFileViewProps & CssProps>;
5
+ //# sourceMappingURL=CfgMiscFile.d.ts.map
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export const CfgMiscFile = (props) => {
3
+ const { url, preview } = props.miscFile;
4
+ const split = url.lastIndexOf("/");
5
+ const name = split ? decodeURI(url.substring(split + 1)) : url;
6
+ return (React.createElement("li", { className: `cfgMiscFiles__item ${props.className || ""}`, style: props.style },
7
+ preview !== undefined && (React.createElement("img", { className: "cfgMiscFiles__thumbnail cfgThumbnailImage", src: preview, alt: "Preview for file URL." })),
8
+ React.createElement("a", { href: url, className: "cfgMiscFiles__link cfgTextOverflow", target: "_blank", rel: "noopener noreferrer" }, name)));
9
+ };
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { CssProps } from "../../utilities";
3
+ import { CfgMiscFilesViewProps } from "./CfgFeatureView.js";
4
+ export declare const CfgMiscFiles: React.FC<CfgMiscFilesViewProps & CssProps>;
5
+ //# sourceMappingURL=CfgMiscFiles.d.ts.map
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export const CfgMiscFiles = (props) => {
3
+ const { miscFileComponent: MiscFileComponent } = props;
4
+ return (React.createElement("ul", { className: `cfgMiscFiles ${props.className || ""}`, style: props.style }, props.miscFiles.map((f) => (React.createElement(MiscFileComponent, { key: f.key + f.url + f.preview, miscFile: f })))));
5
+ };
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { CssProps } from "../../utilities";
3
+ import { CfgNoteViewProps } from "./CfgFeatureView.js";
4
+ export declare const CfgNote: React.FC<CfgNoteViewProps & CssProps>;
5
+ //# sourceMappingURL=CfgNote.d.ts.map
@@ -0,0 +1,15 @@
1
+ import React, { useState } from "react";
2
+ import { ExpandableHeadingRow } from "../ExpandableHeadingRow.js";
3
+ export const CfgNote = (props) => {
4
+ const { code, body, key, title } = props.note;
5
+ const [open, setOpen] = useState(false);
6
+ const hasNoTitle = !title;
7
+ const hasNoBody = !body;
8
+ if (hasNoBody && hasNoTitle) {
9
+ console.info(`Note has neither title nor body and will not be visible. (${code})`);
10
+ return null;
11
+ }
12
+ return (React.createElement("li", { className: "cfgNotes__item" },
13
+ React.createElement(ExpandableHeadingRow, { heading: title || key || code, open: open, onClick: () => setOpen((prev) => !prev), expandable: !hasNoBody, className: "cfgNotes__title" }),
14
+ open && React.createElement("div", { className: "cfgNotes__body" }, body)));
15
+ };
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { CssProps } from "../../utilities.js";
3
+ import { CfgNotesViewProps } from "./CfgFeatureView.js";
4
+ export declare const CfgNotes: React.FC<CfgNotesViewProps & CssProps>;
5
+ //# sourceMappingURL=CfgNotes.d.ts.map
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export const CfgNotes = (props) => {
3
+ const { noteComponent: NoteComponent } = props;
4
+ return (React.createElement("ul", { className: "cfgNotes", style: props.style }, props.notes.map((n) => (React.createElement(NoteComponent, { note: n, key: n.code })))));
5
+ };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { CfgOptionViewProps } from "./CfgFeatureView.js";
3
+ export declare const CfgOptionCommonView: React.FC<CfgOptionViewProps & {
4
+ labelClassName?: string;
5
+ onClick?: () => void;
6
+ }>;
7
+ //# sourceMappingURL=CfgOptionCommonView.d.ts.map
@@ -0,0 +1,48 @@
1
+ import { SelectionType } from "@configura/web-api";
2
+ import React, { useContext } from "react";
3
+ import { useUuid } from "../../useUniqueId.js";
4
+ import { ErrorContext } from "../ErrorContext.js";
5
+ import { Checkmark } from "../icons/Checkmark.js";
6
+ import { CfgConfigurationCommonView } from "./CfgConfigurationCommonView.js";
7
+ import { CfgFeatureView, forwardProps } from "./CfgFeatureView.js";
8
+ import { CfgOptionNumericView } from "./CfgOptionNumericView.js";
9
+ import { CfgOptionPriceView } from "./CfgOptionPriceView.js";
10
+ export const CfgOptionCommonView = (props) => {
11
+ const { option, upchargeDisplayMode, onClick, labelClassName } = props;
12
+ const { features, thumbnail, description, selected, code, selectedChangeInProgress, miscFiles, notes, } = option;
13
+ const setError = useContext(ErrorContext);
14
+ const uniqueId = useUuid();
15
+ const selectionType = option.parent.selectionType;
16
+ let inputType;
17
+ let typeClassNameFragment;
18
+ switch (selectionType) {
19
+ case SelectionType.SelectMany:
20
+ inputType = "checkbox";
21
+ typeClassNameFragment = "Optional";
22
+ break;
23
+ case SelectionType.SelectOne:
24
+ inputType = "radio";
25
+ typeClassNameFragment = "Option";
26
+ break;
27
+ default:
28
+ throw new Error(`Unsupported selectionType ${selectionType}`);
29
+ }
30
+ return (React.createElement("li", { className: props.className, style: props.style },
31
+ React.createElement("label", { className: `cfgFeatureItem${typeClassNameFragment} ${labelClassName !== null && labelClassName !== void 0 ? labelClassName : ""}`, htmlFor: uniqueId },
32
+ React.createElement("input", { checked: selected, className: "cfgFeatureItem__hiddenInput", id: uniqueId, name: uniqueId, onChange: () => {
33
+ option.setSelected(!selected).catch((e) => {
34
+ setError(e);
35
+ throw e;
36
+ });
37
+ }, onClick: onClick, type: inputType }),
38
+ React.createElement("div", { className: `cfgFeatureItem__${inputType}` }, selected === !selectedChangeInProgress && React.createElement(Checkmark, null)),
39
+ thumbnail && (React.createElement("img", { alt: `Thumbnail for ${description}`, className: "cfgThumbnailImage cfgMl1", src: thumbnail })),
40
+ React.createElement("div", { className: `cfgFeatureItem${typeClassNameFragment}__titleWrapper` },
41
+ React.createElement("div", { className: `cfgFeatureItem${typeClassNameFragment}__title` },
42
+ description || code,
43
+ React.createElement(CfgOptionPriceView, { option: option, upchargeDisplayMode: upchargeDisplayMode })))),
44
+ selected && (React.createElement(React.Fragment, null,
45
+ React.createElement(CfgOptionNumericView, { option: option }),
46
+ React.createElement(CfgConfigurationCommonView, Object.assign({}, forwardProps(props), { notes: notes, miscFiles: miscFiles })),
47
+ features.length !== 0 && (React.createElement("ul", { className: "cfgOptionTree cfgOptionTree--subLevel cfgOptionTree--indent" }, features.map((f) => (React.createElement(CfgFeatureView, Object.assign({}, forwardProps(props), { feature: f, key: f.key }))))))))));
48
+ };
@@ -1,30 +1,30 @@
1
- import { CfgOption, NumericValueDiscrete, NumericValueRangeDefinition } from "@configura/web-api";
2
- import { LengthUnit } from "@configura/web-utilities";
3
- import React from "react";
4
- import { CssProps } from "../../utilities.js";
5
- declare type Props = {
6
- option: CfgOption;
7
- } & CssProps;
8
- export declare const CfgOptionNumericView: React.FC<Props>;
9
- /**
10
- * Displays GUI for selecting in one "range". Please note that the range
11
- * parameter can also be a discrete value.
12
- */
13
- export declare const NumericValueView: React.FC<{
14
- currentValue: number;
15
- unit: LengthUnit;
16
- range: NumericValueRangeDefinition | NumericValueDiscrete;
17
- updateValue: (val: number, commit: boolean) => void;
18
- hasNoSiblings: boolean;
19
- }>;
20
- export declare const RangeView: React.FC<{
21
- currentValue: number;
22
- unit: LengthUnit;
23
- range: NumericValueRangeDefinition;
24
- inputValue: number;
25
- onChange: (val: number, instantUpdate: boolean) => void;
26
- onCommit: () => void;
27
- showRangeError: boolean;
28
- } & CssProps>;
29
- export {};
1
+ import { CfgOption, NumericValueDiscrete, NumericValueRangeDefinition } from "@configura/web-api";
2
+ import { LengthUnit } from "@configura/web-utilities";
3
+ import React from "react";
4
+ import { CssProps } from "../../utilities.js";
5
+ declare type Props = {
6
+ option: CfgOption;
7
+ } & CssProps;
8
+ export declare const CfgOptionNumericView: React.FC<Props>;
9
+ /**
10
+ * Displays GUI for selecting in one "range". Please note that the range
11
+ * parameter can also be a discrete value.
12
+ */
13
+ export declare const NumericValueView: React.FC<{
14
+ currentValue: number;
15
+ unit: LengthUnit;
16
+ range: NumericValueRangeDefinition | NumericValueDiscrete;
17
+ updateValue: (val: number, commit: boolean) => void;
18
+ hasNoSiblings: boolean;
19
+ }>;
20
+ export declare const RangeView: React.FC<{
21
+ currentValue: number;
22
+ unit: LengthUnit;
23
+ range: NumericValueRangeDefinition;
24
+ inputValue: number;
25
+ onChange: (val: number, instantUpdate: boolean) => void;
26
+ onCommit: () => void;
27
+ showRangeError: boolean;
28
+ } & CssProps>;
29
+ export {};
30
30
  //# sourceMappingURL=CfgOptionNumericView.d.ts.map