@streamline-pulse/formkrafter-wc 0.3.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 (158) 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-render.js +1 -1
  6. package/dist/components/fk-code-editor.js +1 -1
  7. package/dist/components/fk-data-grid.js +1 -1
  8. package/dist/components/fk-drop-area.js +1 -1
  9. package/dist/components/fk-empty-form.js +1 -1
  10. package/dist/components/fk-file-input.js +1 -1
  11. package/dist/components/fk-form-builder.js +1 -1
  12. package/dist/components/fk-form-render.js +1 -1
  13. package/dist/components/fk-property-panel.js +1 -1
  14. package/dist/components/fk-rules-editor.js +1 -1
  15. package/dist/components/fk-select-input.js +1 -1
  16. package/dist/components/fk-signature-input.js +1 -1
  17. package/dist/components/fk-stepper.js +1 -1
  18. package/dist/components/fk-tabs.js +1 -1
  19. package/dist/components/index.js +1 -1
  20. package/dist/components/{p-CKMHMpID.js → p-28GBFlUX.js} +4 -4
  21. package/dist/components/{p-D6n74M9d.js → p-BGxmFcpL.js} +1 -1
  22. package/dist/components/{p-DYchD23x.js → p-BInUBjyw.js} +1 -1
  23. package/dist/{formkrafter-wc/p-C-wnqV3i.js → components/p-BietHxaT.js} +1 -1
  24. package/dist/components/{p-fDJP6whN.js → p-BnzSarwW.js} +1 -1
  25. package/dist/components/p-BpkKcCCr.js +1 -0
  26. package/dist/components/p-C0Y8qh8R.js +1 -0
  27. package/dist/components/p-C5OWoRhO.js +1 -0
  28. package/dist/components/{p-wuC5rVU7.js → p-CKs1CWVz.js} +1 -1
  29. package/dist/components/{p-v7LxwCAc.js → p-CZHykCYD.js} +1 -1
  30. package/dist/components/{p-4COASNrZ.js → p-CehxuHtl.js} +1 -1
  31. package/dist/components/p-CqVSd56Z.js +1 -0
  32. package/dist/components/p-CyZA17qf.js +1 -0
  33. package/dist/components/{p-BGkZP87K.js → p-D4HhZxQ-.js} +1 -1
  34. package/dist/components/p-DC6Wxbnz.js +1 -0
  35. package/dist/components/p-DRNycSdI.js +1 -0
  36. package/dist/components/{p--vL6GR31.js → p-Dh5Z49YD.js} +1 -1
  37. package/dist/components/p-DiOstAi9.js +1 -0
  38. package/dist/components/p-DlqnIm46.js +1 -0
  39. package/dist/components/{p-CIfjRTky.js → p-DshUS8Zm.js} +1 -1
  40. package/dist/components/{p-DMCkrZqi.js → p-RzeBwfwG.js} +1 -1
  41. package/dist/components/{p-BWdm2a6q.js → p-ajy8ZcBX.js} +1 -1
  42. package/dist/components/p-kYG3E0GQ.js +1 -0
  43. package/dist/components/p-tTJg_I4V.js +1 -0
  44. package/dist/formkrafter-wc/formkrafter-wc.css +1 -1
  45. package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -1
  46. package/dist/formkrafter-wc/index.esm.js +1 -1
  47. package/dist/formkrafter-wc/p-3579150a.entry.js +1 -0
  48. package/dist/formkrafter-wc/p-8b0ff66e.entry.js +1 -0
  49. package/dist/formkrafter-wc/p-BHZMDq2e.js +1 -0
  50. package/dist/{components/p-C-wnqV3i.js → formkrafter-wc/p-BietHxaT.js} +1 -1
  51. package/dist/formkrafter-wc/p-C0Y8qh8R.js +1 -0
  52. package/dist/formkrafter-wc/{p-4COASNrZ.js → p-CehxuHtl.js} +1 -1
  53. package/dist/formkrafter-wc/p-DlqnIm46.js +1 -0
  54. package/dist/formkrafter-wc/{p-DMCkrZqi.js → p-RzeBwfwG.js} +1 -1
  55. package/dist/formkrafter-wc/p-WWmY5Z05.js +1 -0
  56. package/dist/formkrafter-wc/p-hcT25XX4.js +12 -0
  57. package/dist/types/components/fk-code-editor/fk-code-editor.d.ts +1 -0
  58. package/dist/types/components/fk-data-grid/fk-data-grid.d.ts +1 -0
  59. package/dist/types/components/fk-drop-area/fk-drop-area.d.ts +1 -0
  60. package/dist/types/components/fk-form-render/fk-form-render.d.ts +7 -1
  61. package/dist/types/components.d.ts +17 -0
  62. package/dist/types/index.d.ts +1 -1
  63. package/dist/types/registry/default-bricks.d.ts +36 -0
  64. package/dist/types/utils/mask.d.ts +1 -0
  65. package/package.json +10 -15
  66. package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -5
  67. package/dist/cjs/fk-brick-actions_18.cjs.entry.js +0 -4224
  68. package/dist/cjs/formkrafter-wc.cjs.js +0 -25
  69. package/dist/cjs/index-Bhy1RJMV.js +0 -3042
  70. package/dist/cjs/index-CImTe9BG.js +0 -2126
  71. package/dist/cjs/index-CdaT3-qx.js +0 -5444
  72. package/dist/cjs/index-CkPPRg03.js +0 -17548
  73. package/dist/cjs/index-DHgK3reD.js +0 -12233
  74. package/dist/cjs/index-Ds0sDbXV.js +0 -4019
  75. package/dist/cjs/index-c9BL7y3N.js +0 -1922
  76. package/dist/cjs/index.cjs.js +0 -48
  77. package/dist/cjs/loader.cjs.js +0 -13
  78. package/dist/collection/collection-manifest.json +0 -30
  79. package/dist/collection/components/fk-brick-actions/fk-brick-actions.css +0 -78
  80. package/dist/collection/components/fk-brick-actions/fk-brick-actions.js +0 -215
  81. package/dist/collection/components/fk-brick-list/fk-brick-list.css +0 -71
  82. package/dist/collection/components/fk-brick-list/fk-brick-list.js +0 -55
  83. package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.css +0 -33
  84. package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.js +0 -73
  85. package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.css +0 -8
  86. package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.js +0 -18
  87. package/dist/collection/components/fk-brick-render/fk-brick-render.js +0 -447
  88. package/dist/collection/components/fk-code-editor/fk-code-editor.css +0 -26
  89. package/dist/collection/components/fk-code-editor/fk-code-editor.js +0 -145
  90. package/dist/collection/components/fk-data-grid/fk-data-grid.css +0 -75
  91. package/dist/collection/components/fk-data-grid/fk-data-grid.js +0 -300
  92. package/dist/collection/components/fk-drop-area/fk-drop-area.css +0 -18
  93. package/dist/collection/components/fk-drop-area/fk-drop-area.js +0 -98
  94. package/dist/collection/components/fk-empty-form/fk-empty-form.css +0 -22
  95. package/dist/collection/components/fk-empty-form/fk-empty-form.js +0 -19
  96. package/dist/collection/components/fk-file-input/fk-file-input.css +0 -95
  97. package/dist/collection/components/fk-file-input/fk-file-input.js +0 -239
  98. package/dist/collection/components/fk-form-builder/fk-form-builder.css +0 -112
  99. package/dist/collection/components/fk-form-builder/fk-form-builder.js +0 -431
  100. package/dist/collection/components/fk-form-render/fk-form-render.css +0 -7
  101. package/dist/collection/components/fk-form-render/fk-form-render.js +0 -352
  102. package/dist/collection/components/fk-property-panel/fk-property-panel.css +0 -153
  103. package/dist/collection/components/fk-property-panel/fk-property-panel.js +0 -388
  104. package/dist/collection/components/fk-rules-editor/fk-rules-editor.css +0 -166
  105. package/dist/collection/components/fk-rules-editor/fk-rules-editor.js +0 -250
  106. package/dist/collection/components/fk-select-input/fk-select-input.css +0 -153
  107. package/dist/collection/components/fk-select-input/fk-select-input.js +0 -454
  108. package/dist/collection/components/fk-signature-input/fk-signature-input.css +0 -42
  109. package/dist/collection/components/fk-signature-input/fk-signature-input.js +0 -158
  110. package/dist/collection/components/fk-stepper/fk-stepper.css +0 -99
  111. package/dist/collection/components/fk-stepper/fk-stepper.js +0 -285
  112. package/dist/collection/components/fk-tabs/fk-tabs.css +0 -38
  113. package/dist/collection/components/fk-tabs/fk-tabs.js +0 -249
  114. package/dist/collection/i18n/i18n.js +0 -265
  115. package/dist/collection/index.js +0 -5
  116. package/dist/collection/registry/create-brick.js +0 -34
  117. package/dist/collection/registry/default-bricks.js +0 -564
  118. package/dist/collection/registry/registry.js +0 -44
  119. package/dist/collection/utils/brick-data.js +0 -16
  120. package/dist/collection/utils/drop.js +0 -14
  121. package/dist/collection/utils/events.js +0 -1
  122. package/dist/collection/utils/options.js +0 -21
  123. package/dist/collection/utils/remote.js +0 -27
  124. package/dist/collection/utils/rule-condition.js +0 -72
  125. package/dist/collection/utils/style.js +0 -11
  126. package/dist/components/p-BOmBVgfJ.js +0 -1
  127. package/dist/components/p-B_-x-GlA.js +0 -1
  128. package/dist/components/p-Br1s4Ujx.js +0 -1
  129. package/dist/components/p-CUF31e-P.js +0 -1
  130. package/dist/components/p-CWQX0sXS.js +0 -1
  131. package/dist/components/p-DFe3zZCI.js +0 -1
  132. package/dist/components/p-DOInQkG6.js +0 -1
  133. package/dist/components/p-PAr7WoWG.js +0 -1
  134. package/dist/components/p-YyGnQmX-.js +0 -1
  135. package/dist/components/p-swxZqinH.js +0 -1
  136. package/dist/esm/app-globals-DQuL1Twl.js +0 -3
  137. package/dist/esm/fk-brick-actions_18.entry.js +0 -4205
  138. package/dist/esm/formkrafter-wc.js +0 -21
  139. package/dist/esm/index-BAcz7b5u.js +0 -5416
  140. package/dist/esm/index-BkRMoLXK.js +0 -3029
  141. package/dist/esm/index-CGMDfZ5m.js +0 -1808
  142. package/dist/esm/index-D7Cta1UB.js +0 -17488
  143. package/dist/esm/index-DtcM1yw5.js +0 -3991
  144. package/dist/esm/index-DuVf3NlP.js +0 -12222
  145. package/dist/esm/index-qLZlXROB.js +0 -2117
  146. package/dist/esm/index.js +0 -2
  147. package/dist/esm/loader.js +0 -11
  148. package/dist/formkrafter-wc/p-6d29555b.entry.js +0 -1
  149. package/dist/formkrafter-wc/p-DOInQkG6.js +0 -1
  150. package/dist/formkrafter-wc/p-Ddu6BquK.js +0 -12
  151. package/dist/index.cjs.js +0 -1
  152. package/dist/index.js +0 -1
  153. package/dist/stencil.config.js +0 -34
  154. package/loader/cdn.js +0 -1
  155. package/loader/index.cjs.js +0 -1
  156. package/loader/index.d.ts +0 -24
  157. package/loader/index.es2017.js +0 -1
  158. package/loader/index.js +0 -2
@@ -1,99 +0,0 @@
1
- :host {
2
- display: block;
3
- }
4
-
5
- .fk-stepper {
6
- display: flex;
7
- flex-direction: column;
8
- gap: var(--fk-spacing);
9
- }
10
-
11
- .fk-stepper__nav {
12
- display: flex;
13
- flex-wrap: wrap;
14
- gap: calc(var(--fk-spacing) * 1.5);
15
- margin: 0;
16
- padding: 0 0 var(--fk-spacing);
17
- list-style: none;
18
- border-bottom: 1px solid var(--fk-color-border);
19
- }
20
-
21
- .fk-stepper__step {
22
- display: flex;
23
- align-items: center;
24
- gap: calc(var(--fk-spacing) / 2);
25
- cursor: pointer;
26
- color: var(--fk-color-muted);
27
- font-size: 0.85rem;
28
- }
29
-
30
- .fk-stepper__index {
31
- display: inline-flex;
32
- align-items: center;
33
- justify-content: center;
34
- width: 22px;
35
- height: 22px;
36
- border-radius: 50%;
37
- border: 1px solid var(--fk-color-border);
38
- font-size: 0.72rem;
39
- font-weight: 700;
40
- }
41
-
42
- .fk-stepper__step--active {
43
- color: var(--fk-color-text);
44
- font-weight: 600;
45
- }
46
-
47
- .fk-stepper__step--active .fk-stepper__index {
48
- border-color: var(--fk-color-primary);
49
- background: var(--fk-color-primary);
50
- color: #ffffff;
51
- }
52
-
53
- .fk-stepper__step--done .fk-stepper__index {
54
- border-color: var(--fk-color-primary);
55
- color: var(--fk-color-primary);
56
- }
57
-
58
- .fk-stepper__actions {
59
- display: flex;
60
- justify-content: space-between;
61
- padding-top: var(--fk-spacing);
62
- border-top: 1px solid var(--fk-color-border);
63
- }
64
-
65
- .fk-stepper__button {
66
- font: inherit;
67
- font-size: 0.85rem;
68
- padding: calc(var(--fk-spacing) / 1.5) calc(var(--fk-spacing) * 1.5);
69
- border: 1px solid var(--fk-color-border);
70
- border-radius: var(--fk-radius);
71
- background: var(--fk-color-surface);
72
- color: var(--fk-color-text);
73
- cursor: pointer;
74
- }
75
-
76
- .fk-stepper__button--primary {
77
- border-color: var(--fk-color-primary);
78
- background: var(--fk-color-primary);
79
- color: #ffffff;
80
- }
81
-
82
- .fk-stepper__button:disabled {
83
- opacity: 0.45;
84
- cursor: not-allowed;
85
- }
86
-
87
- .fk-stepper__step-button {
88
- all: unset;
89
- display: inline-flex;
90
- align-items: center;
91
- gap: inherit;
92
- cursor: pointer;
93
- }
94
-
95
- .fk-stepper__step-button:focus-visible {
96
- outline: 2px solid color-mix(in srgb, var(--fk-color-primary) 55%, transparent);
97
- outline-offset: 2px;
98
- border-radius: calc(var(--fk-radius) / 2);
99
- }
@@ -1,285 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import { iterateSchemaBricks, validateBrickSpecDataDetailed, } from "@streamline-pulse/formkrafter-core";
3
- import { fkT } from "../../i18n/i18n";
4
- export class FkStepper {
5
- constructor() {
6
- this.stepLabels = [];
7
- this.editable = false;
8
- this.active = 0;
9
- this.next = (event) => {
10
- event.preventDefault();
11
- if (this.config('validateSteps', false) && !this.stepValid(this.active)) {
12
- this.stepTouch.emit({ keys: this.stepKeys(this.active) });
13
- return;
14
- }
15
- this.active = Math.min(this.active + 1, this.stepLabels.length - 1);
16
- };
17
- this.back = (event) => {
18
- event.preventDefault();
19
- this.active = Math.max(this.active - 1, 0);
20
- };
21
- this.submit = (event) => {
22
- event.preventDefault();
23
- if (this.config('validateSteps', false) && !this.stepValid(this.active)) {
24
- this.stepTouch.emit({ keys: this.stepKeys(this.active) });
25
- return;
26
- }
27
- this.stepperSubmit.emit();
28
- };
29
- }
30
- clampActive() {
31
- if (this.active > Math.max(this.stepLabels.length - 1, 0)) {
32
- this.active = 0;
33
- }
34
- }
35
- componentDidRender() {
36
- const body = this.host.querySelector('.fk-stepper__body');
37
- if (!body)
38
- return;
39
- Array.from(body.children).forEach((child, index) => {
40
- const element = child;
41
- if (this.editable)
42
- element.style.removeProperty('display');
43
- else
44
- element.style.display = index === this.active ? '' : 'none';
45
- });
46
- }
47
- config(name, fallback) {
48
- var _a, _b;
49
- const raw = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.configs) === null || _b === void 0 ? void 0 : _b[name];
50
- return typeof raw === 'boolean' ? raw : fallback;
51
- }
52
- stepSpec(index) {
53
- var _a, _b, _c;
54
- const child = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[index];
55
- if (!child || !this.spec)
56
- return undefined;
57
- if (((_c = this.stepCache) === null || _c === void 0 ? void 0 : _c.source) !== this.spec) {
58
- this.stepCache = { source: this.spec, specs: [] };
59
- }
60
- if (!this.stepCache.specs[index]) {
61
- this.stepCache.specs[index] = {
62
- type: 'panel',
63
- id: 'step',
64
- name: 'Step',
65
- configs: { key: `step_${index}` },
66
- children: [child],
67
- };
68
- }
69
- return this.stepCache.specs[index];
70
- }
71
- stepKeys(index) {
72
- var _a, _b, _c;
73
- const child = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[index];
74
- if (!child)
75
- return [];
76
- const keys = [];
77
- for (const brick of iterateSchemaBricks(child)) {
78
- if ((_c = brick.configs) === null || _c === void 0 ? void 0 : _c.key)
79
- keys.push(brick.configs.key);
80
- }
81
- return keys;
82
- }
83
- stepValid(index) {
84
- var _a;
85
- const stepSpec = this.stepSpec(index);
86
- if (!stepSpec)
87
- return true;
88
- const present = Object.fromEntries(Object.entries((_a = this.dataMap) !== null && _a !== void 0 ? _a : {}).filter(([, value]) => value !== '' && value !== null && value !== undefined));
89
- return validateBrickSpecDataDetailed(stepSpec, present, this.locale).valid;
90
- }
91
- goToStep(index) {
92
- if (this.editable || index <= this.active) {
93
- this.active = index;
94
- return;
95
- }
96
- if (!this.config('allowStepClick', true))
97
- return;
98
- if (this.config('validateSteps', false)) {
99
- for (let i = this.active; i < index; i++) {
100
- if (!this.stepValid(i)) {
101
- this.active = i;
102
- this.stepTouch.emit({ keys: this.stepKeys(i) });
103
- return;
104
- }
105
- }
106
- }
107
- this.active = index;
108
- }
109
- render() {
110
- const lastStep = Math.max(this.stepLabels.length - 1, 0);
111
- const showSubmit = !this.editable && this.config('showSubmit', false) && this.active === lastStep;
112
- return (h("div", { key: '3a5a9d1aa6e870241cf5a353359fe89a7c4a376a', class: "fk-stepper" }, h("ol", { key: '8d6b154016d12cd00827b8bddbe4d476dc378fab', class: "fk-stepper__nav" }, this.stepLabels.map((label, index) => (h("li", { key: `${index}-${label}`, class: {
113
- 'fk-stepper__step': true,
114
- 'fk-stepper__step--active': index === this.active,
115
- 'fk-stepper__step--done': !this.editable && index < this.active,
116
- } }, h("button", { type: "button", class: "fk-stepper__step-button", "aria-current": index === this.active ? 'step' : undefined, onClick: (event) => {
117
- event.preventDefault();
118
- this.goToStep(index);
119
- } }, h("span", { class: "fk-stepper__index" }, index + 1), h("span", { class: "fk-stepper__label" }, label)))))), h("div", { key: 'cd902a9df2d72a4d7f452e7621287df50a89d3c4', class: "fk-stepper__body" }, h("slot", { key: 'ab689448817eaf7b5ddfc9146e18411fe6b5924c' })), !this.editable && this.stepLabels.length > 1 ? (h("div", { class: "fk-stepper__actions" }, h("button", { type: "button", class: "fk-stepper__button", disabled: this.active === 0, onClick: this.back }, fkT('stepper.back')), this.active < lastStep ? (h("button", { type: "button", class: "fk-stepper__button fk-stepper__button--primary", onClick: this.next }, fkT('stepper.next'))) : null, showSubmit ? (h("button", { type: "button", class: "fk-stepper__button fk-stepper__button--primary", onClick: this.submit }, fkT('stepper.submit'))) : null)) : null));
120
- }
121
- static get is() { return "fk-stepper"; }
122
- static get encapsulation() { return "scoped"; }
123
- static get originalStyleUrls() {
124
- return {
125
- "$": ["fk-stepper.css"]
126
- };
127
- }
128
- static get styleUrls() {
129
- return {
130
- "$": ["fk-stepper.css"]
131
- };
132
- }
133
- static get properties() {
134
- return {
135
- "stepLabels": {
136
- "type": "unknown",
137
- "mutable": false,
138
- "complexType": {
139
- "original": "string[]",
140
- "resolved": "string[]",
141
- "references": {}
142
- },
143
- "required": false,
144
- "optional": false,
145
- "docs": {
146
- "tags": [],
147
- "text": ""
148
- },
149
- "getter": false,
150
- "setter": false,
151
- "defaultValue": "[]"
152
- },
153
- "editable": {
154
- "type": "boolean",
155
- "mutable": false,
156
- "complexType": {
157
- "original": "boolean",
158
- "resolved": "boolean",
159
- "references": {}
160
- },
161
- "required": false,
162
- "optional": false,
163
- "docs": {
164
- "tags": [],
165
- "text": ""
166
- },
167
- "getter": false,
168
- "setter": false,
169
- "reflect": false,
170
- "attribute": "editable",
171
- "defaultValue": "false"
172
- },
173
- "spec": {
174
- "type": "unknown",
175
- "mutable": false,
176
- "complexType": {
177
- "original": "BrickSpec",
178
- "resolved": "BrickSpec",
179
- "references": {
180
- "BrickSpec": {
181
- "location": "import",
182
- "path": "@streamline-pulse/formkrafter-core",
183
- "id": "../core/dist/index.d.ts::BrickSpec",
184
- "referenceLocation": "BrickSpec"
185
- }
186
- }
187
- },
188
- "required": false,
189
- "optional": true,
190
- "docs": {
191
- "tags": [],
192
- "text": ""
193
- },
194
- "getter": false,
195
- "setter": false
196
- },
197
- "dataMap": {
198
- "type": "unknown",
199
- "mutable": false,
200
- "complexType": {
201
- "original": "Record<string, unknown>",
202
- "resolved": "string | unknown",
203
- "references": {
204
- "Record": {
205
- "location": "global",
206
- "id": "global::Record"
207
- }
208
- }
209
- },
210
- "required": false,
211
- "optional": true,
212
- "docs": {
213
- "tags": [],
214
- "text": ""
215
- },
216
- "getter": false,
217
- "setter": false
218
- },
219
- "locale": {
220
- "type": "string",
221
- "mutable": false,
222
- "complexType": {
223
- "original": "string",
224
- "resolved": "string",
225
- "references": {}
226
- },
227
- "required": false,
228
- "optional": true,
229
- "docs": {
230
- "tags": [],
231
- "text": ""
232
- },
233
- "getter": false,
234
- "setter": false,
235
- "reflect": false,
236
- "attribute": "locale"
237
- }
238
- };
239
- }
240
- static get states() {
241
- return {
242
- "active": {}
243
- };
244
- }
245
- static get events() {
246
- return [{
247
- "method": "stepTouch",
248
- "name": "stepTouch",
249
- "bubbles": true,
250
- "cancelable": true,
251
- "composed": true,
252
- "docs": {
253
- "tags": [],
254
- "text": ""
255
- },
256
- "complexType": {
257
- "original": "{ keys: string[] }",
258
- "resolved": "{ keys: string[]; }",
259
- "references": {}
260
- }
261
- }, {
262
- "method": "stepperSubmit",
263
- "name": "stepperSubmit",
264
- "bubbles": true,
265
- "cancelable": true,
266
- "composed": true,
267
- "docs": {
268
- "tags": [],
269
- "text": ""
270
- },
271
- "complexType": {
272
- "original": "void",
273
- "resolved": "void",
274
- "references": {}
275
- }
276
- }];
277
- }
278
- static get elementRef() { return "host"; }
279
- static get watchers() {
280
- return [{
281
- "propName": "stepLabels",
282
- "methodName": "clampActive"
283
- }];
284
- }
285
- }
@@ -1,38 +0,0 @@
1
- :host {
2
- display: block;
3
- }
4
-
5
- .fk-tabs {
6
- display: flex;
7
- flex-direction: column;
8
- gap: var(--fk-spacing);
9
- }
10
-
11
- .fk-tabs__nav {
12
- display: flex;
13
- flex-wrap: wrap;
14
- gap: 2px;
15
- border-bottom: 1px solid var(--fk-color-border);
16
- }
17
-
18
- .fk-tabs__tab {
19
- font: inherit;
20
- font-size: 0.85rem;
21
- font-weight: 500;
22
- padding: calc(var(--fk-spacing) / 1.5) var(--fk-spacing);
23
- border: none;
24
- border-bottom: 2px solid transparent;
25
- background: transparent;
26
- color: var(--fk-color-muted);
27
- cursor: pointer;
28
- }
29
-
30
- .fk-tabs__tab:hover {
31
- color: var(--fk-color-text);
32
- }
33
-
34
- .fk-tabs__tab--active {
35
- color: var(--fk-color-primary);
36
- border-bottom-color: var(--fk-color-primary);
37
- font-weight: 600;
38
- }
@@ -1,249 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import { iterateSchemaBricks, validateBrickSpecDataDetailed, } from "@streamline-pulse/formkrafter-core";
3
- export class FkTabs {
4
- constructor() {
5
- this.tabLabels = [];
6
- this.editable = false;
7
- this.active = 0;
8
- }
9
- clampActive() {
10
- if (this.active > Math.max(this.tabLabels.length - 1, 0)) {
11
- this.active = 0;
12
- }
13
- }
14
- componentDidRender() {
15
- const body = this.host.querySelector('.fk-tabs__body');
16
- if (!body)
17
- return;
18
- Array.from(body.children).forEach((child, index) => {
19
- const element = child;
20
- if (this.editable)
21
- element.style.removeProperty('display');
22
- else
23
- element.style.display = index === this.active ? '' : 'none';
24
- });
25
- }
26
- validateTabs() {
27
- var _a, _b;
28
- return ((_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.configs) === null || _b === void 0 ? void 0 : _b.validateTabs) === true;
29
- }
30
- tabSpec(index) {
31
- var _a, _b, _c;
32
- const child = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[index];
33
- if (!child || !this.spec)
34
- return undefined;
35
- if (((_c = this.tabCache) === null || _c === void 0 ? void 0 : _c.source) !== this.spec) {
36
- this.tabCache = { source: this.spec, specs: [] };
37
- }
38
- if (!this.tabCache.specs[index]) {
39
- this.tabCache.specs[index] = {
40
- type: 'panel',
41
- id: 'tab',
42
- name: 'Tab',
43
- configs: { key: `tab_${index}` },
44
- children: [child],
45
- };
46
- }
47
- return this.tabCache.specs[index];
48
- }
49
- tabKeys(index) {
50
- var _a, _b, _c;
51
- const child = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[index];
52
- if (!child)
53
- return [];
54
- const keys = [];
55
- for (const brick of iterateSchemaBricks(child)) {
56
- if ((_c = brick.configs) === null || _c === void 0 ? void 0 : _c.key)
57
- keys.push(brick.configs.key);
58
- }
59
- return keys;
60
- }
61
- tabValid(index) {
62
- var _a;
63
- const tabSpec = this.tabSpec(index);
64
- if (!tabSpec)
65
- return true;
66
- const present = Object.fromEntries(Object.entries((_a = this.dataMap) !== null && _a !== void 0 ? _a : {}).filter(([, value]) => value !== '' && value !== null && value !== undefined));
67
- return validateBrickSpecDataDetailed(tabSpec, present, this.locale).valid;
68
- }
69
- goToTab(index) {
70
- if (index === this.active)
71
- return;
72
- if (!this.editable && this.validateTabs() && !this.tabValid(this.active)) {
73
- this.stepTouch.emit({ keys: this.tabKeys(this.active) });
74
- return;
75
- }
76
- this.active = index;
77
- }
78
- render() {
79
- return (h("div", { key: 'dc3d42e16d4dd2c948b780326d13afce15bbd908', class: "fk-tabs" }, h("div", { key: 'a5cfd97f5decd63774b9054559f392c5c23447cc', class: "fk-tabs__nav", role: "tablist" }, this.tabLabels.map((label, index) => (h("button", { key: `${index}-${label}`, type: "button", role: "tab", "aria-selected": index === this.active ? 'true' : 'false', tabIndex: index === this.active ? 0 : -1, class: {
80
- 'fk-tabs__tab': true,
81
- 'fk-tabs__tab--active': index === this.active,
82
- }, onKeyDown: (event) => {
83
- const count = this.tabLabels.length;
84
- if (!count)
85
- return;
86
- if (event.key === 'ArrowRight' || event.key === 'ArrowLeft') {
87
- event.preventDefault();
88
- const delta = event.key === 'ArrowRight' ? 1 : -1;
89
- this.goToTab((index + delta + count) % count);
90
- requestAnimationFrame(() => {
91
- var _a;
92
- (_a = this.host.querySelector('.fk-tabs__tab--active')) === null || _a === void 0 ? void 0 : _a.focus();
93
- });
94
- }
95
- }, onClick: (event) => {
96
- event.preventDefault();
97
- this.goToTab(index);
98
- } }, label)))), h("div", { key: 'fe33c5bdfe8a876452850abfd8082b8e4325c355', class: "fk-tabs__body" }, h("slot", { key: 'b3de83a128f36d328c34554cc6df7b1cbeae4761' }))));
99
- }
100
- static get is() { return "fk-tabs"; }
101
- static get encapsulation() { return "scoped"; }
102
- static get originalStyleUrls() {
103
- return {
104
- "$": ["fk-tabs.css"]
105
- };
106
- }
107
- static get styleUrls() {
108
- return {
109
- "$": ["fk-tabs.css"]
110
- };
111
- }
112
- static get properties() {
113
- return {
114
- "tabLabels": {
115
- "type": "unknown",
116
- "mutable": false,
117
- "complexType": {
118
- "original": "string[]",
119
- "resolved": "string[]",
120
- "references": {}
121
- },
122
- "required": false,
123
- "optional": false,
124
- "docs": {
125
- "tags": [],
126
- "text": ""
127
- },
128
- "getter": false,
129
- "setter": false,
130
- "defaultValue": "[]"
131
- },
132
- "editable": {
133
- "type": "boolean",
134
- "mutable": false,
135
- "complexType": {
136
- "original": "boolean",
137
- "resolved": "boolean",
138
- "references": {}
139
- },
140
- "required": false,
141
- "optional": false,
142
- "docs": {
143
- "tags": [],
144
- "text": ""
145
- },
146
- "getter": false,
147
- "setter": false,
148
- "reflect": false,
149
- "attribute": "editable",
150
- "defaultValue": "false"
151
- },
152
- "spec": {
153
- "type": "unknown",
154
- "mutable": false,
155
- "complexType": {
156
- "original": "BrickSpec",
157
- "resolved": "BrickSpec",
158
- "references": {
159
- "BrickSpec": {
160
- "location": "import",
161
- "path": "@streamline-pulse/formkrafter-core",
162
- "id": "../core/dist/index.d.ts::BrickSpec",
163
- "referenceLocation": "BrickSpec"
164
- }
165
- }
166
- },
167
- "required": false,
168
- "optional": true,
169
- "docs": {
170
- "tags": [],
171
- "text": ""
172
- },
173
- "getter": false,
174
- "setter": false
175
- },
176
- "dataMap": {
177
- "type": "unknown",
178
- "mutable": false,
179
- "complexType": {
180
- "original": "Record<string, unknown>",
181
- "resolved": "string | unknown",
182
- "references": {
183
- "Record": {
184
- "location": "global",
185
- "id": "global::Record"
186
- }
187
- }
188
- },
189
- "required": false,
190
- "optional": true,
191
- "docs": {
192
- "tags": [],
193
- "text": ""
194
- },
195
- "getter": false,
196
- "setter": false
197
- },
198
- "locale": {
199
- "type": "string",
200
- "mutable": false,
201
- "complexType": {
202
- "original": "string",
203
- "resolved": "string",
204
- "references": {}
205
- },
206
- "required": false,
207
- "optional": true,
208
- "docs": {
209
- "tags": [],
210
- "text": ""
211
- },
212
- "getter": false,
213
- "setter": false,
214
- "reflect": false,
215
- "attribute": "locale"
216
- }
217
- };
218
- }
219
- static get states() {
220
- return {
221
- "active": {}
222
- };
223
- }
224
- static get events() {
225
- return [{
226
- "method": "stepTouch",
227
- "name": "stepTouch",
228
- "bubbles": true,
229
- "cancelable": true,
230
- "composed": true,
231
- "docs": {
232
- "tags": [],
233
- "text": ""
234
- },
235
- "complexType": {
236
- "original": "{ keys: string[] }",
237
- "resolved": "{ keys: string[]; }",
238
- "references": {}
239
- }
240
- }];
241
- }
242
- static get elementRef() { return "host"; }
243
- static get watchers() {
244
- return [{
245
- "propName": "tabLabels",
246
- "methodName": "clampActive"
247
- }];
248
- }
249
- }