@streamline-pulse/formkrafter-wc 0.2.0 → 0.4.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 (161) hide show
  1. package/README.md +10 -8
  2. package/dist/components/fk-brick-actions.js +1 -1
  3. package/dist/components/fk-brick-list.js +1 -1
  4. package/dist/components/fk-brick-mold-item.js +1 -1
  5. package/dist/components/fk-brick-not-found.js +1 -1
  6. package/dist/components/fk-brick-render.js +1 -1
  7. package/dist/components/fk-code-editor.js +1 -1
  8. package/dist/components/fk-data-grid.js +1 -1
  9. package/dist/components/fk-drop-area.js +1 -1
  10. package/dist/components/fk-empty-form.js +1 -1
  11. package/dist/components/fk-file-input.js +1 -1
  12. package/dist/components/fk-form-builder.js +1 -1
  13. package/dist/components/fk-form-render.js +1 -1
  14. package/dist/components/fk-property-panel.js +1 -1
  15. package/dist/components/fk-rules-editor.js +1 -1
  16. package/dist/components/fk-select-input.js +1 -1
  17. package/dist/components/fk-signature-input.js +1 -1
  18. package/dist/components/fk-stepper.js +1 -1
  19. package/dist/components/fk-tabs.js +1 -1
  20. package/dist/components/index.js +1 -1
  21. package/dist/components/{p-LXnm2ogM.js → p-28GBFlUX.js} +4 -4
  22. package/dist/components/p-BB4Llg42.js +1 -0
  23. package/dist/components/p-BGxmFcpL.js +1 -0
  24. package/dist/components/{p-BVBfbMl_.js → p-BInUBjyw.js} +1 -1
  25. package/dist/components/p-BietHxaT.js +1 -0
  26. package/dist/components/{p-C85zhhpr.js → p-BnzSarwW.js} +1 -1
  27. package/dist/components/p-BpkKcCCr.js +1 -0
  28. package/dist/components/p-C0Y8qh8R.js +1 -0
  29. package/dist/components/p-C5OWoRhO.js +1 -0
  30. package/dist/components/p-CKs1CWVz.js +1 -0
  31. package/dist/components/{p-BSPTuA1p.js → p-CZHykCYD.js} +1 -1
  32. package/dist/components/p-CehxuHtl.js +1 -0
  33. package/dist/components/p-CqVSd56Z.js +1 -0
  34. package/dist/components/p-CyZA17qf.js +1 -0
  35. package/dist/components/p-D4HhZxQ-.js +1 -0
  36. package/dist/components/p-DC6Wxbnz.js +1 -0
  37. package/dist/components/p-DRNycSdI.js +1 -0
  38. package/dist/components/{p-B0YjIsVn.js → p-Dh5Z49YD.js} +1 -1
  39. package/dist/components/p-DiOstAi9.js +1 -0
  40. package/dist/components/p-DlqnIm46.js +1 -0
  41. package/dist/components/{p-BDvqHJih.js → p-DshUS8Zm.js} +1 -1
  42. package/dist/components/p-DtcM1yw5.js +1 -0
  43. package/dist/components/p-NDbmiiYk.js +1 -0
  44. package/dist/components/p-RzeBwfwG.js +1 -0
  45. package/dist/components/p-ajy8ZcBX.js +1 -0
  46. package/dist/components/p-kYG3E0GQ.js +1 -0
  47. package/dist/components/p-tTJg_I4V.js +1 -0
  48. package/dist/formkrafter-wc/formkrafter-wc.css +1 -1
  49. package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -1
  50. package/dist/formkrafter-wc/index.esm.js +1 -1
  51. package/dist/formkrafter-wc/p-3579150a.entry.js +1 -0
  52. package/dist/formkrafter-wc/p-8b0ff66e.entry.js +1 -0
  53. package/dist/formkrafter-wc/p-BHZMDq2e.js +1 -0
  54. package/dist/formkrafter-wc/p-BietHxaT.js +1 -0
  55. package/dist/formkrafter-wc/p-C0Y8qh8R.js +1 -0
  56. package/dist/formkrafter-wc/p-CehxuHtl.js +1 -0
  57. package/dist/formkrafter-wc/p-DlqnIm46.js +1 -0
  58. package/dist/formkrafter-wc/p-DtcM1yw5.js +1 -0
  59. package/dist/formkrafter-wc/p-RzeBwfwG.js +1 -0
  60. package/dist/formkrafter-wc/p-WWmY5Z05.js +1 -0
  61. package/dist/formkrafter-wc/p-hcT25XX4.js +12 -0
  62. package/dist/formkrafter-wc/p-qLZlXROB.js +2 -0
  63. package/dist/types/components/fk-code-editor/fk-code-editor.d.ts +3 -1
  64. package/dist/types/components/fk-data-grid/fk-data-grid.d.ts +1 -0
  65. package/dist/types/components/fk-drop-area/fk-drop-area.d.ts +1 -0
  66. package/dist/types/components/fk-file-input/fk-file-input.d.ts +7 -3
  67. package/dist/types/components/fk-form-render/fk-form-render.d.ts +7 -1
  68. package/dist/types/components/fk-select-input/fk-select-input.d.ts +9 -0
  69. package/dist/types/components.d.ts +39 -4
  70. package/dist/types/index.d.ts +1 -1
  71. package/dist/types/registry/default-bricks.d.ts +36 -0
  72. package/dist/types/utils/mask.d.ts +1 -0
  73. package/package.json +10 -15
  74. package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -5
  75. package/dist/cjs/fk-brick-actions_18.cjs.entry.js +0 -26443
  76. package/dist/cjs/formkrafter-wc.cjs.js +0 -25
  77. package/dist/cjs/index-Can2MpG5.js +0 -17538
  78. package/dist/cjs/index-CbyFxLc_.js +0 -2114
  79. package/dist/cjs/index.cjs.js +0 -48
  80. package/dist/cjs/loader.cjs.js +0 -13
  81. package/dist/collection/collection-manifest.json +0 -30
  82. package/dist/collection/components/fk-brick-actions/fk-brick-actions.css +0 -78
  83. package/dist/collection/components/fk-brick-actions/fk-brick-actions.js +0 -215
  84. package/dist/collection/components/fk-brick-list/fk-brick-list.css +0 -71
  85. package/dist/collection/components/fk-brick-list/fk-brick-list.js +0 -55
  86. package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.css +0 -33
  87. package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.js +0 -73
  88. package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.css +0 -8
  89. package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.js +0 -18
  90. package/dist/collection/components/fk-brick-render/fk-brick-render.js +0 -447
  91. package/dist/collection/components/fk-code-editor/fk-code-editor.css +0 -26
  92. package/dist/collection/components/fk-code-editor/fk-code-editor.js +0 -136
  93. package/dist/collection/components/fk-data-grid/fk-data-grid.css +0 -75
  94. package/dist/collection/components/fk-data-grid/fk-data-grid.js +0 -300
  95. package/dist/collection/components/fk-drop-area/fk-drop-area.css +0 -18
  96. package/dist/collection/components/fk-drop-area/fk-drop-area.js +0 -98
  97. package/dist/collection/components/fk-empty-form/fk-empty-form.css +0 -22
  98. package/dist/collection/components/fk-empty-form/fk-empty-form.js +0 -19
  99. package/dist/collection/components/fk-file-input/fk-file-input.css +0 -95
  100. package/dist/collection/components/fk-file-input/fk-file-input.js +0 -196
  101. package/dist/collection/components/fk-form-builder/fk-form-builder.css +0 -112
  102. package/dist/collection/components/fk-form-builder/fk-form-builder.js +0 -431
  103. package/dist/collection/components/fk-form-render/fk-form-render.css +0 -7
  104. package/dist/collection/components/fk-form-render/fk-form-render.js +0 -352
  105. package/dist/collection/components/fk-property-panel/fk-property-panel.css +0 -153
  106. package/dist/collection/components/fk-property-panel/fk-property-panel.js +0 -384
  107. package/dist/collection/components/fk-rules-editor/fk-rules-editor.css +0 -166
  108. package/dist/collection/components/fk-rules-editor/fk-rules-editor.js +0 -250
  109. package/dist/collection/components/fk-select-input/fk-select-input.css +0 -144
  110. package/dist/collection/components/fk-select-input/fk-select-input.js +0 -356
  111. package/dist/collection/components/fk-signature-input/fk-signature-input.css +0 -42
  112. package/dist/collection/components/fk-signature-input/fk-signature-input.js +0 -158
  113. package/dist/collection/components/fk-stepper/fk-stepper.css +0 -85
  114. package/dist/collection/components/fk-stepper/fk-stepper.js +0 -282
  115. package/dist/collection/components/fk-tabs/fk-tabs.css +0 -38
  116. package/dist/collection/components/fk-tabs/fk-tabs.js +0 -236
  117. package/dist/collection/i18n/i18n.js +0 -257
  118. package/dist/collection/index.js +0 -5
  119. package/dist/collection/registry/create-brick.js +0 -34
  120. package/dist/collection/registry/default-bricks.js +0 -562
  121. package/dist/collection/registry/registry.js +0 -44
  122. package/dist/collection/utils/brick-data.js +0 -16
  123. package/dist/collection/utils/drop.js +0 -14
  124. package/dist/collection/utils/events.js +0 -1
  125. package/dist/collection/utils/options.js +0 -21
  126. package/dist/collection/utils/remote.js +0 -27
  127. package/dist/collection/utils/rule-condition.js +0 -72
  128. package/dist/collection/utils/style.js +0 -11
  129. package/dist/components/p-B1t0M_hN.js +0 -1
  130. package/dist/components/p-B21cOFRx.js +0 -1
  131. package/dist/components/p-B7ED8qMb.js +0 -1
  132. package/dist/components/p-BrOXMyOG.js +0 -1
  133. package/dist/components/p-CMQ_4Zfv.js +0 -1
  134. package/dist/components/p-CWQX0sXS.js +0 -1
  135. package/dist/components/p-CXEvsomA.js +0 -1
  136. package/dist/components/p-Cq9HSEn8.js +0 -1
  137. package/dist/components/p-D7bf2ztq.js +0 -1
  138. package/dist/components/p-DIPoAaGe.js +0 -1
  139. package/dist/components/p-DYBirEew.js +0 -1
  140. package/dist/components/p-DluDp8V5.js +0 -1
  141. package/dist/components/p-Do6-yRva.js +0 -1
  142. package/dist/components/p-GjmAhT2E.js +0 -1
  143. package/dist/components/p-y0xDvzJR.js +0 -1
  144. package/dist/esm/app-globals-DQuL1Twl.js +0 -3
  145. package/dist/esm/fk-brick-actions_18.entry.js +0 -26424
  146. package/dist/esm/formkrafter-wc.js +0 -21
  147. package/dist/esm/index-BB2OOj__.js +0 -17478
  148. package/dist/esm/index-DMDO6w5-.js +0 -2105
  149. package/dist/esm/index.js +0 -2
  150. package/dist/esm/loader.js +0 -11
  151. package/dist/formkrafter-wc/p-0de7cbe1.entry.js +0 -1
  152. package/dist/formkrafter-wc/p-Bp_A8oL5.js +0 -12
  153. package/dist/formkrafter-wc/p-DMDO6w5-.js +0 -2
  154. package/dist/index.cjs.js +0 -1
  155. package/dist/index.js +0 -1
  156. package/dist/stencil.config.js +0 -34
  157. package/loader/cdn.js +0 -1
  158. package/loader/index.cjs.js +0 -1
  159. package/loader/index.d.ts +0 -24
  160. package/loader/index.es2017.js +0 -1
  161. package/loader/index.js +0 -2
@@ -1,384 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import { isLocalizedObject } from "@streamline-pulse/formkrafter-core";
3
- import { fkT, fkTOr } from "../../i18n/i18n";
4
- export class FkPropertyPanel {
5
- constructor() {
6
- this.fields = [];
7
- this.locales = [];
8
- this.activeTab = 'config';
9
- this.newStyleKey = '';
10
- }
11
- onBrickChange() {
12
- if (!this.availableTabs().some((tab) => tab.id === this.activeTab)) {
13
- this.activeTab = 'config';
14
- }
15
- }
16
- availableTabs() {
17
- const tabs = [
18
- { id: 'config', label: fkT('panel.tab.config') },
19
- ];
20
- if (this.brick.type === 'input') {
21
- tabs.push({ id: 'validation', label: fkT('panel.tab.validation') });
22
- }
23
- tabs.push({ id: 'styles', label: fkT('panel.tab.styles') }, { id: 'rules', label: fkT('panel.tab.rules') });
24
- return tabs;
25
- }
26
- localized(current, value) {
27
- var _a;
28
- if (this.locales.length <= 1)
29
- return value || undefined;
30
- const map = isLocalizedObject(current)
31
- ? Object.assign({}, current) : {};
32
- if (typeof current === 'string' && current && !isLocalizedObject(current)) {
33
- map[this.locales[0]] = current;
34
- }
35
- map[(_a = this.editLocale) !== null && _a !== void 0 ? _a : this.locales[0]] = value;
36
- return map;
37
- }
38
- readLocalized(current) {
39
- var _a, _b, _c;
40
- if (isLocalizedObject(current)) {
41
- return (_b = current[(_a = this.editLocale) !== null && _a !== void 0 ? _a : this.locales[0]]) !== null && _b !== void 0 ? _b : '';
42
- }
43
- return (_c = current) !== null && _c !== void 0 ? _c : '';
44
- }
45
- writeTextConfig(key, value) {
46
- var _a;
47
- this.emitConfigs({ [key]: this.localized((_a = this.brick.configs) === null || _a === void 0 ? void 0 : _a[key], value) });
48
- }
49
- emitConfigs(patch) {
50
- var _a;
51
- const uid = (_a = this.brick.configs) === null || _a === void 0 ? void 0 : _a.uid;
52
- if (!uid)
53
- return;
54
- this.brickConfigsChange.emit({ configs: patch, uid });
55
- }
56
- emitValidations(validations) {
57
- var _a;
58
- const uid = (_a = this.brick.configs) === null || _a === void 0 ? void 0 : _a.uid;
59
- if (!uid)
60
- return;
61
- this.brickValidationsChange.emit({ validations, uid });
62
- }
63
- emitStyles(patch) {
64
- var _a;
65
- const uid = (_a = this.brick.configs) === null || _a === void 0 ? void 0 : _a.uid;
66
- if (!uid)
67
- return;
68
- this.brickStylesChange.emit({ styles: patch, uid });
69
- }
70
- validationOf(validator) {
71
- var _a;
72
- return (_a = this.brick.validations) === null || _a === void 0 ? void 0 : _a.find((validation) => validation.validator === validator);
73
- }
74
- setValidation(validator, active, patch = {}) {
75
- var _a;
76
- const current = this.validationOf(validator);
77
- const others = ((_a = this.brick.validations) !== null && _a !== void 0 ? _a : []).filter((validation) => validation.validator !== validator);
78
- this.emitValidations(active ? [...others, Object.assign(Object.assign(Object.assign({}, current), { validator }), patch)] : others);
79
- }
80
- addStyle(value) {
81
- const key = this.newStyleKey.trim();
82
- if (!key)
83
- return;
84
- this.emitStyles({ [key]: value });
85
- this.newStyleKey = '';
86
- }
87
- textField(label, value, onCommit) {
88
- var _a;
89
- return (h("label", { class: "fk-props__field" }, h("span", { class: "fk-props__label" }, label), h("input", { class: "fk-props__input", type: "text", value: (_a = value) !== null && _a !== void 0 ? _a : '', onChange: (event) => onCommit(event.target.value) })));
90
- }
91
- optionsFields() {
92
- var _a, _b, _c;
93
- const configs = this.brick.configs;
94
- if (!configs || !('options' in configs || 'optionsSource' in configs)) {
95
- return [];
96
- }
97
- const supportsSources = 'optionsSource' in configs;
98
- const source = supportsSources
99
- ? ((_a = configs.optionsSource) !== null && _a !== void 0 ? _a : 'static')
100
- : 'static';
101
- const nodes = supportsSources
102
- ? [
103
- h("label", { class: "fk-props__field" }, h("span", { class: "fk-props__label" }, fkT('panel.optionsSource')), h("select", { class: "fk-props__input", onChange: (event) => this.emitConfigs({
104
- optionsSource: event.target.value,
105
- }) }, ['static', 'dataMap', 'remote', 'js'].map((candidate) => (h("option", { value: candidate, selected: candidate === source }, candidate))))),
106
- ]
107
- : [];
108
- if (source === 'static') {
109
- nodes.push(h("label", { class: "fk-props__field" }, h("span", { class: "fk-props__label" }, fkT('panel.options')), h("textarea", { class: "fk-props__input fk-props__input--textarea", onChange: (event) => this.writeTextConfig('options', event.target.value) }, this.readLocalized(configs.options))));
110
- }
111
- if (source === 'dataMap') {
112
- nodes.push(this.textField(fkT('panel.dataKey'), configs.optionsPath, (value) => this.emitConfigs({ optionsPath: value })));
113
- }
114
- if (source === 'remote') {
115
- nodes.push(this.textField(fkT('panel.url'), configs.optionsUrl, (value) => this.emitConfigs({ optionsUrl: value })), h("label", { class: "fk-props__field" }, h("span", { class: "fk-props__label" }, fkT('panel.headers')), h("textarea", { class: "fk-props__input fk-props__input--textarea", placeholder: 'Authorization: Bearer {token}', onChange: (event) => this.emitConfigs({
116
- optionsHeaders: event.target.value || undefined,
117
- }) }, (_b = configs.optionsHeaders) !== null && _b !== void 0 ? _b : '')), this.textField(fkT('panel.searchParam'), configs.searchParam, (value) => this.emitConfigs({ searchParam: value || undefined })));
118
- }
119
- if (source === 'js') {
120
- nodes.push(h("label", { class: "fk-props__field" }, h("span", { class: "fk-props__label" }, "Code"), h("fk-code-editor", { value: (_c = configs.optionsCode) !== null && _c !== void 0 ? _c : '', placeholder: "return dataMap.country === 'BJ' ? ['Cotonou'] : ['Paris'];", onCodeChange: (event) => this.emitConfigs({ optionsCode: event.detail }) })));
121
- }
122
- if (source === 'remote' || source === 'js') {
123
- nodes.push(this.textField(fkT('panel.labelKey'), configs.labelKey, (value) => this.emitConfigs({ labelKey: value })), this.textField(fkT('panel.valueKey'), configs.valueKey, (value) => this.emitConfigs({ valueKey: value })));
124
- }
125
- return nodes;
126
- }
127
- renderConfigTab() {
128
- const configs = this.brick.configs;
129
- const isInput = this.brick.type === 'input';
130
- return (h("section", { class: "fk-props__section" }, this.textField(fkT('panel.key'), configs === null || configs === void 0 ? void 0 : configs.key, (value) => this.emitConfigs({ key: value })), this.textField(fkT('panel.label'), this.readLocalized(configs === null || configs === void 0 ? void 0 : configs.label), (value) => this.writeTextConfig('label', value)), isInput
131
- ? [
132
- this.textField(fkT('panel.placeholder'), this.readLocalized(configs === null || configs === void 0 ? void 0 : configs.placeholder), (value) => this.writeTextConfig('placeholder', value)),
133
- this.textField(fkT('panel.prefix'), configs === null || configs === void 0 ? void 0 : configs.prefix, (value) => this.emitConfigs({ prefix: value || undefined })),
134
- this.textField(fkT('panel.suffix'), configs === null || configs === void 0 ? void 0 : configs.suffix, (value) => this.emitConfigs({ suffix: value || undefined })),
135
- ]
136
- : null, this.optionsFields(), Object.entries(configs !== null && configs !== void 0 ? configs : {})
137
- .filter(([, value]) => typeof value === 'boolean')
138
- .map(([key, value]) => (h("label", { class: "fk-props__field fk-props__field--inline", key: key }, h("input", { type: "checkbox", checked: value === true, onChange: (event) => this.emitConfigs({
139
- [key]: event.target.checked,
140
- }) }), h("span", { class: "fk-props__label" }, fkTOr(`panel.cfg.${key}`, key))))), configs && 'content' in configs ? (h("label", { class: "fk-props__field" }, h("span", { class: "fk-props__label" }, fkT('panel.content')), h("textarea", { class: "fk-props__input fk-props__input--textarea", onChange: (event) => this.writeTextConfig('content', event.target.value) }, this.readLocalized(configs.content)))) : null));
141
- }
142
- validationRow(validator, label, valueType) {
143
- const rule = this.validationOf(validator);
144
- return (h("div", { class: "fk-props__vrule" }, h("label", { class: "fk-props__field fk-props__field--inline" }, h("input", { type: "checkbox", checked: !!rule, onChange: (event) => this.setValidation(validator, event.target.checked) }), h("span", { class: "fk-props__label" }, label)), rule && valueType ? (h("input", { class: "fk-props__input", type: valueType, placeholder: valueType === 'number' ? 'value' : 'regex', value: rule.value == null ? '' : String(rule.value), onChange: (event) => {
145
- const raw = event.target.value;
146
- this.setValidation(validator, true, {
147
- value: valueType === 'number'
148
- ? raw === ''
149
- ? undefined
150
- : Number(raw)
151
- : raw || undefined,
152
- });
153
- } })) : null, rule
154
- ? this.textField(fkT('panel.errorMessage'), this.readLocalized(rule.message), (value) => this.setValidation(validator, true, {
155
- message: this.localized(rule.message, value),
156
- }))
157
- : null));
158
- }
159
- renderValidationTab() {
160
- var _a;
161
- const dataType = this.brick.dataType;
162
- const custom = this.validationOf('custom');
163
- return (h("section", { class: "fk-props__section" }, this.validationRow('required', fkT('panel.required')), dataType === 'string'
164
- ? [
165
- this.validationRow('minLength', fkT('panel.minLength'), 'number'),
166
- this.validationRow('maxLength', fkT('panel.maxLength'), 'number'),
167
- this.validationRow('pattern', fkT('panel.pattern'), 'text'),
168
- this.validationRow('email', fkT('panel.emailFormat')),
169
- this.validationRow('url', fkT('panel.urlFormat')),
170
- ]
171
- : null, dataType === 'number'
172
- ? [
173
- this.validationRow('min', fkT('panel.min'), 'number'),
174
- this.validationRow('max', fkT('panel.max'), 'number'),
175
- ]
176
- : null, dataType === 'array'
177
- ? [
178
- this.validationRow('minItems', fkT('panel.minItems'), 'number'),
179
- this.validationRow('maxItems', fkT('panel.maxItems'), 'number'),
180
- ]
181
- : null, h("div", { class: "fk-props__vrule" }, h("label", { class: "fk-props__field fk-props__field--inline" }, h("input", { type: "checkbox", checked: !!custom, onChange: (event) => {
182
- var _a;
183
- return this.setValidation('custom', event.target.checked, { customValidator: (_a = custom === null || custom === void 0 ? void 0 : custom.customValidator) !== null && _a !== void 0 ? _a : 'return true;' });
184
- } }), h("span", { class: "fk-props__label" }, fkT('panel.custom'))), custom ? (h("fk-code-editor", { value: (_a = custom.customValidator) !== null && _a !== void 0 ? _a : '', placeholder: 'return value?.startsWith("BJ-") ? true : "Must start with BJ-";', onCodeChange: (event) => this.setValidation('custom', true, {
185
- customValidator: event.detail,
186
- }) })) : null, custom
187
- ? this.textField(fkT('panel.fallbackMessage'), this.readLocalized(custom.message), (value) => this.setValidation('custom', true, {
188
- message: this.localized(custom.message, value),
189
- }))
190
- : null)));
191
- }
192
- renderStylesTab() {
193
- var _a;
194
- return (h("section", { class: "fk-props__section" }, Object.entries((_a = this.brick.styles) !== null && _a !== void 0 ? _a : {}).map(([key, value]) => (h("div", { class: "fk-props__style-row", key: key }, h("span", { class: "fk-props__style-key" }, key), h("input", { class: "fk-props__input fk-props__input--grow", type: "text", value: String(value !== null && value !== void 0 ? value : ''), onChange: (event) => this.emitStyles({
195
- [key]: event.target.value,
196
- }) }), h("button", { type: "button", class: "fk-props__remove", title: "Remove style", onClick: () => this.emitStyles({ [key]: undefined }) }, "\u2715")))), h("div", { class: "fk-props__style-row" }, h("input", { class: "fk-props__input", type: "text", placeholder: fkT('panel.styleProperty'), value: this.newStyleKey, onInput: (event) => (this.newStyleKey = event.target.value) }), h("input", { class: "fk-props__input fk-props__input--grow", type: "text", placeholder: fkT('panel.styleValue'), onChange: (event) => {
197
- const target = event.target;
198
- this.addStyle(target.value);
199
- target.value = '';
200
- } }))));
201
- }
202
- render() {
203
- return (h("div", { key: 'a935dd3bf883d81cc16b9a14786b8a663dbb33be', class: "fk-props" }, h("header", { key: '021592872aed2d7c41644f492fb0b48847e0e12d', class: "fk-props__header" }, h("span", { key: '56b02e18fc6b87976aa45ab13bc643630220f3d3', class: "fk-props__type" }, this.brick.type), h("h4", { key: '78f0a39ee6db58a1d60b0587792424e6bb0efd20', class: "fk-props__title" }, fkTOr(`brick.${this.brick.id}.name`, this.brick.name))), h("div", { key: 'bce6485ecc449b0db6e3c7db1b5fde98196d1ae7', class: "fk-props__tabs" }, this.availableTabs().map((tab) => (h("button", { key: tab.id, type: "button", class: {
204
- 'fk-props__tab': true,
205
- 'fk-props__tab--active': this.activeTab === tab.id,
206
- }, onClick: () => (this.activeTab = tab.id) }, tab.label)))), this.activeTab === 'config' ? this.renderConfigTab() : null, this.activeTab === 'validation' ? this.renderValidationTab() : null, this.activeTab === 'styles' ? this.renderStylesTab() : null, this.activeTab === 'rules' ? (h("section", { class: "fk-props__section" }, h("fk-rules-editor", { brick: this.brick, fields: this.fields }))) : null));
207
- }
208
- static get is() { return "fk-property-panel"; }
209
- static get encapsulation() { return "scoped"; }
210
- static get originalStyleUrls() {
211
- return {
212
- "$": ["fk-property-panel.css"]
213
- };
214
- }
215
- static get styleUrls() {
216
- return {
217
- "$": ["fk-property-panel.css"]
218
- };
219
- }
220
- static get properties() {
221
- return {
222
- "brick": {
223
- "type": "unknown",
224
- "mutable": false,
225
- "complexType": {
226
- "original": "BrickSpec",
227
- "resolved": "BrickSpec",
228
- "references": {
229
- "BrickSpec": {
230
- "location": "import",
231
- "path": "@streamline-pulse/formkrafter-core",
232
- "id": "../core/dist/index.d.ts::BrickSpec",
233
- "referenceLocation": "BrickSpec"
234
- }
235
- }
236
- },
237
- "required": true,
238
- "optional": false,
239
- "docs": {
240
- "tags": [],
241
- "text": ""
242
- },
243
- "getter": false,
244
- "setter": false
245
- },
246
- "fields": {
247
- "type": "unknown",
248
- "mutable": false,
249
- "complexType": {
250
- "original": "string[]",
251
- "resolved": "string[]",
252
- "references": {}
253
- },
254
- "required": false,
255
- "optional": false,
256
- "docs": {
257
- "tags": [],
258
- "text": ""
259
- },
260
- "getter": false,
261
- "setter": false,
262
- "defaultValue": "[]"
263
- },
264
- "locales": {
265
- "type": "unknown",
266
- "mutable": false,
267
- "complexType": {
268
- "original": "string[]",
269
- "resolved": "string[]",
270
- "references": {}
271
- },
272
- "required": false,
273
- "optional": false,
274
- "docs": {
275
- "tags": [],
276
- "text": ""
277
- },
278
- "getter": false,
279
- "setter": false,
280
- "defaultValue": "[]"
281
- },
282
- "editLocale": {
283
- "type": "string",
284
- "mutable": false,
285
- "complexType": {
286
- "original": "string",
287
- "resolved": "string",
288
- "references": {}
289
- },
290
- "required": false,
291
- "optional": true,
292
- "docs": {
293
- "tags": [],
294
- "text": ""
295
- },
296
- "getter": false,
297
- "setter": false,
298
- "reflect": false,
299
- "attribute": "edit-locale"
300
- }
301
- };
302
- }
303
- static get states() {
304
- return {
305
- "activeTab": {},
306
- "newStyleKey": {}
307
- };
308
- }
309
- static get events() {
310
- return [{
311
- "method": "brickConfigsChange",
312
- "name": "brickConfigsChange",
313
- "bubbles": true,
314
- "cancelable": true,
315
- "composed": true,
316
- "docs": {
317
- "tags": [],
318
- "text": ""
319
- },
320
- "complexType": {
321
- "original": "BrickConfigsChangeDetail",
322
- "resolved": "BrickConfigsChangeDetail",
323
- "references": {
324
- "BrickConfigsChangeDetail": {
325
- "location": "import",
326
- "path": "../../utils/events",
327
- "id": "src/utils/events.ts::BrickConfigsChangeDetail",
328
- "referenceLocation": "BrickConfigsChangeDetail"
329
- }
330
- }
331
- }
332
- }, {
333
- "method": "brickValidationsChange",
334
- "name": "brickValidationsChange",
335
- "bubbles": true,
336
- "cancelable": true,
337
- "composed": true,
338
- "docs": {
339
- "tags": [],
340
- "text": ""
341
- },
342
- "complexType": {
343
- "original": "BrickValidationsChangeDetail",
344
- "resolved": "BrickValidationsChangeDetail",
345
- "references": {
346
- "BrickValidationsChangeDetail": {
347
- "location": "import",
348
- "path": "../../utils/events",
349
- "id": "src/utils/events.ts::BrickValidationsChangeDetail",
350
- "referenceLocation": "BrickValidationsChangeDetail"
351
- }
352
- }
353
- }
354
- }, {
355
- "method": "brickStylesChange",
356
- "name": "brickStylesChange",
357
- "bubbles": true,
358
- "cancelable": true,
359
- "composed": true,
360
- "docs": {
361
- "tags": [],
362
- "text": ""
363
- },
364
- "complexType": {
365
- "original": "BrickStylesChangeDetail",
366
- "resolved": "BrickStylesChangeDetail",
367
- "references": {
368
- "BrickStylesChangeDetail": {
369
- "location": "import",
370
- "path": "../../utils/events",
371
- "id": "src/utils/events.ts::BrickStylesChangeDetail",
372
- "referenceLocation": "BrickStylesChangeDetail"
373
- }
374
- }
375
- }
376
- }];
377
- }
378
- static get watchers() {
379
- return [{
380
- "propName": "brick",
381
- "methodName": "onBrickChange"
382
- }];
383
- }
384
- }
@@ -1,166 +0,0 @@
1
- :host {
2
- display: block;
3
- }
4
-
5
- .fk-rules {
6
- display: flex;
7
- flex-direction: column;
8
- gap: var(--fk-spacing);
9
- }
10
-
11
- .fk-rule {
12
- display: flex;
13
- flex-direction: column;
14
- gap: calc(var(--fk-spacing) / 1.5);
15
- padding: var(--fk-spacing);
16
- border: 1px solid var(--fk-color-border);
17
- border-radius: calc(var(--fk-radius) / 1.5);
18
- background: color-mix(in srgb, var(--fk-color-surface) 60%, transparent);
19
- }
20
-
21
- .fk-rule__header {
22
- display: flex;
23
- align-items: center;
24
- gap: 6px;
25
- }
26
-
27
- .fk-rule__name {
28
- flex: 1;
29
- min-width: 0;
30
- font: inherit;
31
- font-size: 0.8rem;
32
- font-weight: 600;
33
- padding: 4px 6px;
34
- border: 1px solid transparent;
35
- border-radius: calc(var(--fk-radius) / 2);
36
- background: transparent;
37
- color: var(--fk-color-text);
38
- }
39
-
40
- .fk-rule__name:hover,
41
- .fk-rule__name:focus {
42
- border-color: var(--fk-color-border);
43
- background: var(--fk-color-surface);
44
- outline: none;
45
- }
46
-
47
- .fk-rule__modes {
48
- display: flex;
49
- gap: 4px;
50
- }
51
-
52
- .fk-rule__mode {
53
- font: inherit;
54
- font-size: 0.65rem;
55
- font-weight: 600;
56
- text-transform: uppercase;
57
- letter-spacing: 0.05em;
58
- padding: 3px 8px;
59
- border: 1px solid var(--fk-color-border);
60
- border-radius: 999px;
61
- background: transparent;
62
- color: var(--fk-color-muted);
63
- cursor: pointer;
64
- }
65
-
66
- .fk-rule__mode--active {
67
- border-color: var(--fk-color-primary);
68
- background: color-mix(in srgb, var(--fk-color-primary) 12%, transparent);
69
- color: var(--fk-color-primary);
70
- }
71
-
72
- .fk-rule__condition,
73
- .fk-rule__effect {
74
- display: flex;
75
- flex-wrap: wrap;
76
- align-items: center;
77
- gap: 4px;
78
- }
79
-
80
- .fk-rule__keyword {
81
- font-size: 0.65rem;
82
- font-weight: 700;
83
- text-transform: uppercase;
84
- letter-spacing: 0.08em;
85
- color: var(--fk-color-muted);
86
- }
87
-
88
- .fk-rule__control {
89
- font: inherit;
90
- font-size: 0.78rem;
91
- padding: 4px 6px;
92
- max-width: 100%;
93
- min-width: 0;
94
- border: 1px solid var(--fk-color-border);
95
- border-radius: calc(var(--fk-radius) / 2);
96
- background: var(--fk-color-surface);
97
- color: var(--fk-color-text);
98
- }
99
-
100
- .fk-rule__control:focus {
101
- outline: none;
102
- border-color: var(--fk-color-primary);
103
- }
104
-
105
- .fk-rule__advanced {
106
- display: flex;
107
- flex-direction: column;
108
- gap: 4px;
109
- }
110
-
111
- .fk-rule__code {
112
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
113
- font-size: 0.75rem;
114
- min-height: 72px;
115
- padding: 6px 8px;
116
- border: 1px solid var(--fk-color-border);
117
- border-radius: calc(var(--fk-radius) / 2);
118
- background: var(--fk-color-surface);
119
- color: var(--fk-color-text);
120
- resize: vertical;
121
- }
122
-
123
- .fk-rule__error {
124
- margin: 0;
125
- font-size: 0.72rem;
126
- color: var(--fk-color-danger);
127
- }
128
-
129
- .fk-rule__effects {
130
- display: flex;
131
- flex-direction: column;
132
- gap: 6px;
133
- }
134
-
135
- .fk-rule__remove {
136
- border: none;
137
- background: transparent;
138
- color: var(--fk-color-muted);
139
- font-size: 0.75rem;
140
- cursor: pointer;
141
- padding: 2px 4px;
142
- border-radius: calc(var(--fk-radius) / 2);
143
- }
144
-
145
- .fk-rule__remove:hover {
146
- color: var(--fk-color-danger);
147
- background: color-mix(in srgb, var(--fk-color-danger) 10%, transparent);
148
- }
149
-
150
- .fk-rule__add {
151
- align-self: flex-start;
152
- font: inherit;
153
- font-size: 0.75rem;
154
- font-weight: 600;
155
- padding: 4px 10px;
156
- border: 1px dashed var(--fk-color-border);
157
- border-radius: calc(var(--fk-radius) / 2);
158
- background: transparent;
159
- color: var(--fk-color-muted);
160
- cursor: pointer;
161
- }
162
-
163
- .fk-rule__add:hover {
164
- border-color: var(--fk-color-primary);
165
- color: var(--fk-color-primary);
166
- }