@govtechsg/sgds-web-component 3.19.0 → 3.20.0-rc.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 (89) hide show
  1. package/base/select-element.d.ts +2 -0
  2. package/base/select-element.js +12 -0
  3. package/base/select-element.js.map +1 -1
  4. package/components/Alert/alert.js +1 -1
  5. package/components/Alert/index.umd.min.js +1 -1
  6. package/components/Alert/index.umd.min.js.map +1 -1
  7. package/components/ComboBox/index.umd.min.js +4 -4
  8. package/components/ComboBox/index.umd.min.js.map +1 -1
  9. package/components/ComboBox/sgds-combo-box.d.ts +4 -0
  10. package/components/ComboBox/sgds-combo-box.js +9 -0
  11. package/components/ComboBox/sgds-combo-box.js.map +1 -1
  12. package/components/Select/index.umd.min.js +15 -15
  13. package/components/Select/index.umd.min.js.map +1 -1
  14. package/components/Stepper/index.d.ts +2 -0
  15. package/components/Stepper/index.js +2 -0
  16. package/components/Stepper/index.js.map +1 -1
  17. package/components/Stepper/index.umd.min.js +61 -39
  18. package/components/Stepper/index.umd.min.js.map +1 -1
  19. package/components/Stepper/sgds-step.d.ts +42 -0
  20. package/components/Stepper/sgds-step.js +123 -0
  21. package/components/Stepper/sgds-step.js.map +1 -0
  22. package/components/Stepper/sgds-stepper.d.ts +33 -2
  23. package/components/Stepper/sgds-stepper.js +132 -36
  24. package/components/Stepper/sgds-stepper.js.map +1 -1
  25. package/components/Stepper/step.js +6 -0
  26. package/components/Stepper/step.js.map +1 -0
  27. package/components/Stepper/stepper.js +1 -1
  28. package/components/Stepper/types.d.ts +1 -0
  29. package/components/Textarea/index.umd.min.js.map +1 -1
  30. package/components/Textarea/sgds-textarea.d.ts +2 -0
  31. package/components/Textarea/sgds-textarea.js +2 -0
  32. package/components/Textarea/sgds-textarea.js.map +1 -1
  33. package/components/index.d.ts +1 -0
  34. package/components/index.js +1 -0
  35. package/components/index.js.map +1 -1
  36. package/components/index.umd.min.js +90 -68
  37. package/components/index.umd.min.js.map +1 -1
  38. package/css/fouc.css +1 -0
  39. package/custom-elements.json +301 -5
  40. package/index.umd.min.js +187 -165
  41. package/index.umd.min.js.map +1 -1
  42. package/package.json +1 -1
  43. package/react/base/select-element.cjs.js +12 -0
  44. package/react/base/select-element.cjs.js.map +1 -1
  45. package/react/base/select-element.js +12 -0
  46. package/react/base/select-element.js.map +1 -1
  47. package/react/combo-box/index.cjs.js +2 -0
  48. package/react/combo-box/index.cjs.js.map +1 -1
  49. package/react/combo-box/index.js +2 -0
  50. package/react/combo-box/index.js.map +1 -1
  51. package/react/components/Alert/alert.cjs.js +1 -1
  52. package/react/components/Alert/alert.js +1 -1
  53. package/react/components/ComboBox/sgds-combo-box.cjs.js +9 -0
  54. package/react/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
  55. package/react/components/ComboBox/sgds-combo-box.js +9 -0
  56. package/react/components/ComboBox/sgds-combo-box.js.map +1 -1
  57. package/react/components/Stepper/sgds-step.cjs.js +129 -0
  58. package/react/components/Stepper/sgds-step.cjs.js.map +1 -0
  59. package/react/components/Stepper/sgds-step.js +124 -0
  60. package/react/components/Stepper/sgds-step.js.map +1 -0
  61. package/react/components/Stepper/sgds-stepper.cjs.js +130 -34
  62. package/react/components/Stepper/sgds-stepper.cjs.js.map +1 -1
  63. package/react/components/Stepper/sgds-stepper.js +132 -36
  64. package/react/components/Stepper/sgds-stepper.js.map +1 -1
  65. package/react/components/Stepper/step.cjs.js +11 -0
  66. package/react/components/Stepper/step.cjs.js.map +1 -0
  67. package/react/components/Stepper/step.js +7 -0
  68. package/react/components/Stepper/step.js.map +1 -0
  69. package/react/components/Stepper/stepper.cjs.js +1 -1
  70. package/react/components/Stepper/stepper.js +1 -1
  71. package/react/components/Textarea/sgds-textarea.cjs.js +2 -0
  72. package/react/components/Textarea/sgds-textarea.cjs.js.map +1 -1
  73. package/react/components/Textarea/sgds-textarea.js +2 -0
  74. package/react/components/Textarea/sgds-textarea.js.map +1 -1
  75. package/react/index.cjs.js +40 -38
  76. package/react/index.cjs.js.map +1 -1
  77. package/react/index.d.ts +1 -0
  78. package/react/index.js +1 -0
  79. package/react/index.js.map +1 -1
  80. package/react/step/index.cjs.js +40 -0
  81. package/react/step/index.cjs.js.map +1 -0
  82. package/react/step/index.d.ts +4 -0
  83. package/react/step/index.js +16 -0
  84. package/react/step/index.js.map +1 -0
  85. package/react/textarea/index.cjs.js +3 -1
  86. package/react/textarea/index.cjs.js.map +1 -1
  87. package/react/textarea/index.js +3 -1
  88. package/react/textarea/index.js.map +1 -1
  89. package/types/react.d.ts +23 -2
@@ -12,6 +12,7 @@ var defaultvalue = require('../../utils/defaultvalue.cjs.js');
12
12
  var watch = require('../../utils/watch.cjs.js');
13
13
  var stepper = require('./stepper.cjs.js');
14
14
  var sgdsIcon = require('../Icon/sgds-icon.cjs.js');
15
+ var slot = require('../../utils/slot.cjs.js');
15
16
 
16
17
  /**
17
18
  * @summary Steppers are used to inform users which step they are at in a form or a process
@@ -22,13 +23,14 @@ var sgdsIcon = require('../Icon/sgds-icon.cjs.js');
22
23
  * @event sgds-first-step - Emitted on hide after animation has completed. Event is fired when firstStep method is called.
23
24
  * @event sgds-arrived - Emitted right after the activeStep has updated its state, when upcoming step has arrived. Call `getMethod()` on this event to get the current step's component.
24
25
  * @event sgds-reset - Emitted right before the step is reset to its defaultActiveStep. Event is fired when reset method is called.
26
+ * @slot default - slot for sgds-step children
25
27
  *
26
28
  */
27
29
  class SgdsStepper extends sgdsElement["default"] {
28
30
  constructor() {
29
31
  super(...arguments);
30
- /** The metadata of stepper, type `IStepMetaData`, that consist of `stepHeader: string`, `component:unknown`, `iconName:string`. `stepHeader` is the name of the step and `component` is the content that should appear at the each step. `component` is set to `unknown` to allow users to pass in their desired component based on the framework of choice. e.g. pass in your own react/angular/vue component or it can also be a text content.
31
- * It is required to populate this array to properly render the stepper. By default, stepper markers will render numbers. For icon stepper markers, pass the name of sgds icon via `iconName` key. `iconName` is optional.
32
+ /** The metadata of stepper, type `IStepMetaData`. Deprecated: use sgds-step child components instead.
33
+ * @deprecated Use sgds-step child components instead of the steps property
32
34
  */
33
35
  this.steps = [];
34
36
  /** The current state of active step. Defaults to 0 */
@@ -37,32 +39,93 @@ class SgdsStepper extends sgdsElement["default"] {
37
39
  this.orientation = "horizontal";
38
40
  /** When true, the stepper's steps will be clickable */
39
41
  this.clickable = false;
42
+ /** When true, the stepper's steps can only be clicked in a linear manner */
43
+ this.linear = false;
40
44
  /** @internal Gets or sets the default activeStep used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
41
45
  this.defaultActiveStep = 0;
46
+ /** @internal */
47
+ this._items = [];
48
+ this._totalSteps = 0;
49
+ /** @internal Bound i-sgds-click handler for proper event listener removal */
50
+ this._boundHandleItemClick = this._handleStepClick.bind(this);
51
+ /**
52
+ * Indicates the presence of the default slot.
53
+ * Used for server-side rendering to determine table structure.
54
+ * @type {boolean}
55
+ * @internal
56
+ * @default false
57
+ */
58
+ this.hasDefaultSlot = false;
59
+ this.hasSlotController = new slot.HasSlotController(this, "[default]");
60
+ }
61
+ connectedCallback() {
62
+ super.connectedCallback();
63
+ this._totalSteps = this.steps.length;
64
+ this.addEventListener("i-sgds-click", this._boundHandleItemClick);
65
+ }
66
+ /** @internal */
67
+ _handleSlotChange() {
68
+ this._items = this._slotNodes;
69
+ this._totalSteps = this._items.length;
70
+ this._updateStepItems();
71
+ }
72
+ updated() {
73
+ if (!this.hasDefaultSlot)
74
+ this.hasDefaultSlot = this.hasSlotController.test("[default]");
75
+ }
76
+ /** @internal Updates step item properties based on active step and clickable state */
77
+ _updateStepItems() {
78
+ if (this._items && this._items.length > 0) {
79
+ this._items.forEach((item, index) => {
80
+ item.stepIndex = index;
81
+ item.active = this.activeStep === index;
82
+ item._isCompleted = item.completed || this.activeStep > index;
83
+ item.isClickable = this.linear
84
+ ? !item.disabled && this.clickable && (this.activeStep - 1 == index || this.activeStep + 1 == index)
85
+ : !item.disabled && this.clickable;
86
+ item.orientation = this.orientation;
87
+ if (this._items.length > 1) {
88
+ item.isFirstOfType = index === 0;
89
+ item.classList.toggle("last", index === this._items.length - 1);
90
+ }
91
+ });
92
+ }
42
93
  }
43
94
  /** By default, it returns the corresponding component of the current activeStep as defined in the steps metadata. To get other components, pass in your desired step number as the parameter*/
44
95
  getComponent(step = this.activeStep) {
45
- return this.steps[step].component;
96
+ var _a, _b;
97
+ const items = this.hasDefaultSlot ? this._items : this.steps;
98
+ console.log(step, this._items);
99
+ if (items && items.length > 0) {
100
+ return (_a = items[step]) === null || _a === void 0 ? void 0 : _a.component;
101
+ }
102
+ return (_b = this.steps[step]) === null || _b === void 0 ? void 0 : _b.component;
46
103
  }
47
104
  /** Moves the active step forward one step */
48
105
  nextStep() {
106
+ var _a;
49
107
  this.emit("sgds-next-step");
50
- if (this.activeStep < this.steps.length - 1) {
51
- this.activeStep++;
108
+ if (this.activeStep < this._totalSteps - 1) {
109
+ if (!((_a = this._slotNodes[this.activeStep + 1]) === null || _a === void 0 ? void 0 : _a.disabled)) {
110
+ this.activeStep++;
111
+ }
52
112
  }
53
113
  }
54
114
  /** Moves the active step back one step */
55
115
  previousStep() {
116
+ var _a;
56
117
  this.emit("sgds-previous-step");
57
118
  if (this.activeStep > 0) {
58
- this.activeStep--;
119
+ if (!((_a = this._slotNodes[this.activeStep - 1]) === null || _a === void 0 ? void 0 : _a.disabled)) {
120
+ this.activeStep--;
121
+ }
59
122
  }
60
123
  }
61
124
  /** Changes the active step to the last step */
62
125
  lastStep() {
63
126
  this.emit("sgds-last-step");
64
- if (this.activeStep !== this.steps.length - 1) {
65
- this.activeStep = this.steps.length - 1;
127
+ if (this.activeStep !== this._totalSteps - 1) {
128
+ this.activeStep = this._totalSteps - 1;
66
129
  }
67
130
  }
68
131
  /** Changes active step to the first step */
@@ -79,21 +142,35 @@ class SgdsStepper extends sgdsElement["default"] {
79
142
  }
80
143
  /**@internal */
81
144
  _onStepperItemClick(index) {
82
- //emit an event before moving to next step
83
- if (this.activeStep > index) {
84
- this.activeStep = index;
85
- }
145
+ this.activeStep = index;
86
146
  }
87
147
  /**@internal */
88
148
  _handleActiveStepChange() {
149
+ this._updateStepItems();
89
150
  this.emit("sgds-arrived");
90
151
  }
91
152
  /**@internal */
153
+ _handleClickableChange() {
154
+ this._updateStepItems();
155
+ }
156
+ /**@internal */
157
+ _handleOrientationChange() {
158
+ this._updateStepItems();
159
+ }
160
+ /**@internal */
92
161
  _handleKeyDown(event, index) {
93
162
  if (event.key === "Enter") {
94
163
  this._onStepperItemClick(index);
95
164
  }
96
165
  }
166
+ /**@internal */
167
+ _handleStepClick(e) {
168
+ var _a;
169
+ const event = e;
170
+ e.stopPropagation();
171
+ const stepIndex = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.stepIndex;
172
+ this._onStepperItemClick(stepIndex);
173
+ }
97
174
  render() {
98
175
  return lit.html `
99
176
  <div
@@ -102,29 +179,33 @@ class SgdsStepper extends sgdsElement["default"] {
102
179
  clickable: this.clickable
103
180
  })}"
104
181
  >
105
- ${this.steps.map(({ stepHeader: step, iconName }, index) => {
106
- return lit.html `
107
- <div class="stepper-item-container">
108
- <div
109
- class="stepper-item ${classMap_js.classMap({
110
- "is-active": this.activeStep === index,
111
- "is-completed": this.activeStep > index,
112
- "is-clickable": this.clickable && this.activeStep > index
113
- })}"
114
- tabindex=${this.clickable && this.activeStep > index ? "0" : "-1"}
115
- aria-current=${this.activeStep === index ? "step" : "false"}
116
- aria-disabled=${this.activeStep <= index ? "true" : "false"}
117
- @click="${this.clickable ? () => this._onStepperItemClick(index) : null}"
118
- @keydown=${this.clickable ? (e) => this._handleKeyDown(e, index) : null}
119
- >
120
- <div class="stepper-marker">
121
- ${iconName ? lit.html `<sgds-icon name=${iconName} size="md"></sgds-icon>` : index + 1}
182
+ <slot @slotchange=${this._handleSlotChange}></slot>
183
+
184
+ ${!this.hasDefaultSlot
185
+ ? this.steps.map(({ stepHeader: step, iconName }, index) => {
186
+ return lit.html `
187
+ <div class="stepper-item-container">
188
+ <div
189
+ class="stepper-item ${classMap_js.classMap({
190
+ "is-active": this.activeStep === index,
191
+ "is-completed": this.activeStep > index,
192
+ "is-clickable": this.clickable && this.activeStep > index
193
+ })}"
194
+ tabindex=${this.clickable && this.activeStep > index ? "0" : "-1"}
195
+ aria-current=${this.activeStep === index ? "step" : "false"}
196
+ aria-disabled=${this.activeStep <= index ? "true" : "false"}
197
+ @click="${this.clickable ? () => this._onStepperItemClick(index) : null}"
198
+ @keydown=${this.clickable ? (e) => this._handleKeyDown(e, index) : null}
199
+ >
200
+ <div class="stepper-marker">
201
+ ${iconName ? lit.html `<sgds-icon name=${iconName} size="md"></sgds-icon>` : index + 1}
202
+ </div>
203
+ <div class="stepper-detail">${step}</div>
204
+ </div>
122
205
  </div>
123
- <div class="stepper-detail">${step}</div>
124
- </div>
125
- </div>
126
- `;
127
- })}
206
+ `;
207
+ })
208
+ : lit.nothing}
128
209
  </div>
129
210
  `;
130
211
  }
@@ -144,12 +225,27 @@ tslib.__decorate([
144
225
  tslib.__decorate([
145
226
  decorators_js.property({ type: Boolean, reflect: true })
146
227
  ], SgdsStepper.prototype, "clickable", void 0);
228
+ tslib.__decorate([
229
+ decorators_js.property({ type: Boolean, reflect: true })
230
+ ], SgdsStepper.prototype, "linear", void 0);
147
231
  tslib.__decorate([
148
232
  defaultvalue.defaultValue("activeStep")
149
233
  ], SgdsStepper.prototype, "defaultActiveStep", void 0);
234
+ tslib.__decorate([
235
+ decorators_js.queryAssignedElements()
236
+ ], SgdsStepper.prototype, "_slotNodes", void 0);
237
+ tslib.__decorate([
238
+ decorators_js.property({ type: Boolean })
239
+ ], SgdsStepper.prototype, "hasDefaultSlot", void 0);
150
240
  tslib.__decorate([
151
241
  watch.watch("activeStep", { waitUntilFirstUpdate: true })
152
242
  ], SgdsStepper.prototype, "_handleActiveStepChange", null);
243
+ tslib.__decorate([
244
+ watch.watch("clickable", { waitUntilFirstUpdate: true })
245
+ ], SgdsStepper.prototype, "_handleClickableChange", null);
246
+ tslib.__decorate([
247
+ watch.watch("orientation", { waitUntilFirstUpdate: true })
248
+ ], SgdsStepper.prototype, "_handleOrientationChange", null);
153
249
 
154
250
  exports.SgdsStepper = SgdsStepper;
155
251
  exports["default"] = SgdsStepper;
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-stepper.cjs.js","sources":["../../../../src/components/Stepper/sgds-stepper.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { watch } from \"../../utils/watch\";\nimport stepperStyle from \"./stepper.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport { IStepMetaData } from \"./types\";\nexport type { IStepMetaData };\n/**\n * @summary Steppers are used to inform users which step they are at in a form or a process\n *\n * @event sgds-next-step - Emitted right before the next step is reached. Event is fired when nextStep method is called.\n * @event sgds-previous-step - Emitted right before the previous step is reached. Event is fired when previousStep method is called.\n * @event sgds-last-step - Emitted right before the last step is reached. Event is fired when lastStep method is called.\n * @event sgds-first-step - Emitted on hide after animation has completed. Event is fired when firstStep method is called.\n * @event sgds-arrived - Emitted right after the activeStep has updated its state, when upcoming step has arrived. Call `getMethod()` on this event to get the current step's component.\n * @event sgds-reset - Emitted right before the step is reset to its defaultActiveStep. Event is fired when reset method is called.\n *\n */\nexport class SgdsStepper extends SgdsElement {\n static styles = [...SgdsElement.styles, stepperStyle];\n /** @internal */\n static dependencies = { \"sgds-icon\": SgdsIcon };\n /** The metadata of stepper, type `IStepMetaData`, that consist of `stepHeader: string`, `component:unknown`, `iconName:string`. `stepHeader` is the name of the step and `component` is the content that should appear at the each step. `component` is set to `unknown` to allow users to pass in their desired component based on the framework of choice. e.g. pass in your own react/angular/vue component or it can also be a text content.\n * It is required to populate this array to properly render the stepper. By default, stepper markers will render numbers. For icon stepper markers, pass the name of sgds icon via `iconName` key. `iconName` is optional.\n */\n @property({ type: Array })\n steps: IStepMetaData[] = [];\n\n /** The current state of active step. Defaults to 0 */\n @property({ type: Number, reflect: true })\n activeStep = 0;\n\n /** The orientation of stepper. By default, the stepper is of horizontal orientation */\n @property({ type: String, reflect: true }) orientation: StepperOrientation = \"horizontal\";\n\n /** When true, the stepper's steps will be clickable */\n @property({ type: Boolean, reflect: true }) clickable = false;\n\n /** @internal Gets or sets the default activeStep used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue(\"activeStep\")\n defaultActiveStep = 0;\n\n /** By default, it returns the corresponding component of the current activeStep as defined in the steps metadata. To get other components, pass in your desired step number as the parameter*/\n public getComponent(step: number = this.activeStep) {\n return this.steps[step].component;\n }\n /** Moves the active step forward one step */\n public nextStep() {\n this.emit(\"sgds-next-step\");\n if (this.activeStep < this.steps.length - 1) {\n this.activeStep++;\n }\n }\n\n /** Moves the active step back one step */\n public previousStep() {\n this.emit(\"sgds-previous-step\");\n\n if (this.activeStep > 0) {\n this.activeStep--;\n }\n }\n\n /** Changes the active step to the last step */\n public lastStep() {\n this.emit(\"sgds-last-step\");\n if (this.activeStep !== this.steps.length - 1) {\n this.activeStep = this.steps.length - 1;\n }\n }\n\n /** Changes active step to the first step */\n public firstStep() {\n this.emit(\"sgds-first-step\");\n if (this.activeStep > 0) {\n this.activeStep = 0;\n }\n }\n\n /** Resets the Stepper to its initial active step state */\n public reset() {\n this.emit(\"sgds-reset\");\n this.activeStep = this.defaultActiveStep;\n }\n\n /**@internal */\n _onStepperItemClick(index: number) {\n //emit an event before moving to next step\n if (this.activeStep > index) {\n this.activeStep = index;\n }\n }\n\n /**@internal */\n @watch(\"activeStep\", { waitUntilFirstUpdate: true })\n _handleActiveStepChange() {\n this.emit(\"sgds-arrived\");\n }\n\n /**@internal */\n _handleKeyDown(event: KeyboardEvent, index: number) {\n if (event.key === \"Enter\") {\n this._onStepperItemClick(index);\n }\n }\n\n render() {\n return html`\n <div\n class=\"stepper ${classMap({\n [`${this.orientation}`]: this.orientation,\n clickable: this.clickable\n })}\"\n >\n ${this.steps.map(({ stepHeader: step, iconName }, index) => {\n return html`\n <div class=\"stepper-item-container\">\n <div\n class=\"stepper-item ${classMap({\n \"is-active\": this.activeStep === index,\n \"is-completed\": this.activeStep > index,\n \"is-clickable\": this.clickable && this.activeStep > index\n })}\"\n tabindex=${this.clickable && this.activeStep > index ? \"0\" : \"-1\"}\n aria-current=${this.activeStep === index ? \"step\" : \"false\"}\n aria-disabled=${this.activeStep <= index ? \"true\" : \"false\"}\n @click=\"${this.clickable ? () => this._onStepperItemClick(index) : null}\"\n @keydown=${this.clickable ? (e: KeyboardEvent) => this._handleKeyDown(e, index) : null}\n >\n <div class=\"stepper-marker\">\n ${iconName ? html`<sgds-icon name=${iconName} size=\"md\"></sgds-icon>` : index + 1}\n </div>\n <div class=\"stepper-detail\">${step}</div>\n </div>\n </div>\n `;\n })}\n </div>\n `;\n }\n}\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\n\nexport default SgdsStepper;\n"],"names":["SgdsElement","html","classMap","stepperStyle","SgdsIcon","__decorate","property","defaultValue","watch"],"mappings":";;;;;;;;;;;;;;;AAUA;;;;;;;;;;AAUG;AACG,MAAO,WAAY,SAAQA,sBAAW,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAIE;;AAEG;QAEH,IAAK,CAAA,KAAA,GAAoB,EAAE,CAAC;;QAI5B,IAAU,CAAA,UAAA,GAAG,CAAC,CAAC;;QAG4B,IAAW,CAAA,WAAA,GAAuB,YAAY,CAAC;;QAG9C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAI9D,IAAiB,CAAA,iBAAA,GAAG,CAAC,CAAC;KAoGvB;;AAjGQ,IAAA,YAAY,CAAC,IAAA,GAAe,IAAI,CAAC,UAAU,EAAA;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;KACnC;;IAEM,QAAQ,GAAA;AACb,QAAA,IAAI,CAAC,IAAI,CAAC,gBAA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E,IAAI,EAAE,CAAC;AAGnD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,yBAAA,EAAA,IAAA,CAAA;;;;;"}
1
+ {"version":3,"file":"sgds-stepper.cjs.js","sources":["../../../../src/components/Stepper/sgds-stepper.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property, queryAssignedElements } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { watch } from \"../../utils/watch\";\nimport stepperStyle from \"./stepper.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport { IStepMetaData } from \"./types\";\nimport type SgdsStep from \"./sgds-step\";\nimport { HasSlotController } from \"../../utils/slot\";\nexport type { IStepMetaData };\n\n/**\n * @summary Steppers are used to inform users which step they are at in a form or a process\n *\n * @event sgds-next-step - Emitted right before the next step is reached. Event is fired when nextStep method is called.\n * @event sgds-previous-step - Emitted right before the previous step is reached. Event is fired when previousStep method is called.\n * @event sgds-last-step - Emitted right before the last step is reached. Event is fired when lastStep method is called.\n * @event sgds-first-step - Emitted on hide after animation has completed. Event is fired when firstStep method is called.\n * @event sgds-arrived - Emitted right after the activeStep has updated its state, when upcoming step has arrived. Call `getMethod()` on this event to get the current step's component.\n * @event sgds-reset - Emitted right before the step is reset to its defaultActiveStep. Event is fired when reset method is called.\n * @slot default - slot for sgds-step children\n *\n */\nexport class SgdsStepper extends SgdsElement {\n static styles = [...SgdsElement.styles, stepperStyle];\n /** @internal */\n static dependencies = { \"sgds-icon\": SgdsIcon };\n /** The metadata of stepper, type `IStepMetaData`. Deprecated: use sgds-step child components instead.\n * @deprecated Use sgds-step child components instead of the steps property\n */\n @property({ type: Array })\n steps: IStepMetaData[] = [];\n\n /** The current state of active step. Defaults to 0 */\n @property({ type: Number, reflect: true })\n activeStep = 0;\n\n /** The orientation of stepper. By default, the stepper is of horizontal orientation */\n @property({ type: String, reflect: true }) orientation: StepperOrientation = \"horizontal\";\n\n /** When true, the stepper's steps will be clickable */\n @property({ type: Boolean, reflect: true }) clickable = false;\n\n /** When true, the stepper's steps can only be clicked in a linear manner */\n @property({ type: Boolean, reflect: true }) linear = false;\n\n /** @internal Gets or sets the default activeStep used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue(\"activeStep\")\n defaultActiveStep = 0;\n\n /** @internal */\n @queryAssignedElements() private _slotNodes!: SgdsStep[];\n\n /** @internal */\n private _items: SgdsStep[] = [];\n private _totalSteps = 0;\n\n /** @internal Bound i-sgds-click handler for proper event listener removal */\n private _boundHandleItemClick = this._handleStepClick.bind(this);\n\n /**\n * Indicates the presence of the default slot.\n * Used for server-side rendering to determine table structure.\n * @type {boolean}\n * @internal\n * @default false\n */\n @property({ type: Boolean }) hasDefaultSlot = false;\n private readonly hasSlotController = new HasSlotController(this, \"[default]\");\n\n connectedCallback() {\n super.connectedCallback();\n\n this._totalSteps = this.steps.length;\n this.addEventListener(\"i-sgds-click\", this._boundHandleItemClick);\n }\n\n /** @internal */\n private _handleSlotChange() {\n this._items = this._slotNodes;\n this._totalSteps = this._items.length;\n\n this._updateStepItems();\n }\n\n updated() {\n if (!this.hasDefaultSlot) this.hasDefaultSlot = this.hasSlotController.test(\"[default]\");\n }\n\n /** @internal Updates step item properties based on active step and clickable state */\n private _updateStepItems() {\n if (this._items && this._items.length > 0) {\n this._items.forEach((item, index) => {\n item.stepIndex = index;\n item.active = this.activeStep === index;\n item._isCompleted = item.completed || this.activeStep > index;\n item.isClickable = this.linear\n ? !item.disabled && this.clickable && (this.activeStep - 1 == index || this.activeStep + 1 == index)\n : !item.disabled && this.clickable;\n item.orientation = this.orientation;\n\n if (this._items.length > 1) {\n item.isFirstOfType = index === 0;\n item.classList.toggle(\"last\", index === this._items.length - 1);\n }\n });\n }\n }\n\n /** By default, it returns the corresponding component of the current activeStep as defined in the steps metadata. To get other components, pass in your desired step number as the parameter*/\n public getComponent(step: number = this.activeStep) {\n const items = this.hasDefaultSlot ? this._items : this.steps;\n console.log(step, this._items);\n\n if (items && items.length > 0) {\n return items[step]?.component;\n }\n return this.steps[step]?.component;\n }\n\n /** Moves the active step forward one step */\n public nextStep() {\n this.emit(\"sgds-next-step\");\n if (this.activeStep < this._totalSteps - 1) {\n if (!this._slotNodes[this.activeStep + 1]?.disabled) {\n this.activeStep++;\n }\n }\n }\n\n /** Moves the active step back one step */\n public previousStep() {\n this.emit(\"sgds-previous-step\");\n\n if (this.activeStep > 0) {\n if (!this._slotNodes[this.activeStep - 1]?.disabled) {\n this.activeStep--;\n }\n }\n }\n\n /** Changes the active step to the last step */\n public lastStep() {\n this.emit(\"sgds-last-step\");\n if (this.activeStep !== this._totalSteps - 1) {\n this.activeStep = this._totalSteps - 1;\n }\n }\n\n /** Changes active step to the first step */\n public firstStep() {\n this.emit(\"sgds-first-step\");\n if (this.activeStep > 0) {\n this.activeStep = 0;\n }\n }\n\n /** Resets the Stepper to its initial active step state */\n public reset() {\n this.emit(\"sgds-reset\");\n this.activeStep = this.defaultActiveStep;\n }\n\n /**@internal */\n _onStepperItemClick(index: number) {\n this.activeStep = index;\n }\n\n /**@internal */\n @watch(\"activeStep\", { waitUntilFirstUpdate: true })\n _handleActiveStepChange() {\n this._updateStepItems();\n this.emit(\"sgds-arrived\");\n }\n\n /**@internal */\n @watch(\"clickable\", { waitUntilFirstUpdate: true })\n _handleClickableChange() {\n this._updateStepItems();\n }\n\n /**@internal */\n @watch(\"orientation\", { waitUntilFirstUpdate: true })\n _handleOrientationChange() {\n this._updateStepItems();\n }\n\n /**@internal */\n _handleKeyDown(event: KeyboardEvent, index: number) {\n if (event.key === \"Enter\") {\n this._onStepperItemClick(index);\n }\n }\n\n /**@internal */\n _handleStepClick(e: Event) {\n const event = e as CustomEvent;\n e.stopPropagation();\n\n const stepIndex = event.detail?.stepIndex;\n this._onStepperItemClick(stepIndex);\n }\n\n render() {\n return html`\n <div\n class=\"stepper ${classMap({\n [`${this.orientation}`]: this.orientation,\n clickable: this.clickable\n })}\"\n >\n <slot @slotchange=${this._handleSlotChange}></slot>\n\n ${!this.hasDefaultSlot\n ? this.steps.map(({ stepHeader: step, iconName }, index) => {\n return html`\n <div class=\"stepper-item-container\">\n <div\n class=\"stepper-item ${classMap({\n \"is-active\": this.activeStep === index,\n \"is-completed\": this.activeStep > index,\n \"is-clickable\": this.clickable && this.activeStep > index\n })}\"\n tabindex=${this.clickable && this.activeStep > index ? \"0\" : \"-1\"}\n aria-current=${this.activeStep === index ? \"step\" : \"false\"}\n aria-disabled=${this.activeStep <= index ? \"true\" : \"false\"}\n @click=\"${this.clickable ? () => this._onStepperItemClick(index) : null}\"\n @keydown=${this.clickable ? (e: KeyboardEvent) => this._handleKeyDown(e, index) : null}\n >\n <div class=\"stepper-marker\">\n ${iconName ? html`<sgds-icon name=${iconName} size=\"md\"></sgds-icon>` : index + 1}\n </div>\n <div class=\"stepper-detail\">${step}</div>\n </div>\n </div>\n `;\n })\n : nothing}\n </div>\n `;\n }\n}\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\n\nexport default SgdsStepper;\n"],"names":["SgdsElement","HasSlotController","html","classMap","nothing","stepperStyle","SgdsIcon","__decorate","property","defaultValue","queryAssignedElements","watch"],"mappings":";;;;;;;;;;;;;;;;AAaA;;;;;;;;;;;AAWG;AACG,MAAO,WAAY,SAAQA,sBAAW,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAIE;;AAEG;QAEH,IAAK,CAAA,KAAA,GAAoB,EAAE,CAAC;;QAI5B,IAAU,CAAA,UAAA,GAAG,CAAC,CAAC;;QAG4B,IAAW,CAAA,WAAA,GAAuB,YAAY,CAAC;;QAG9C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGlB,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;;QAI3D,IAAiB,CAAA,iBAAA,GAAG,CAAC,CAAC;;QAMd,IAAM,CAAA,MAAA,GAAe,EAAE,CAAC;QACxB,IAAW,CAAA,WA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gBAAA,CAAA;IADCI,WAAK,CAAC,YAAY,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAInD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,yBAAA,EAAA,IAAA,CAAA,CAAA;AAIDJ,gBAAA,CAAA;IADCI,WAAK,CAAC,WAAW,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAGlD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,wBAAA,EAAA,IAAA,CAAA,CAAA;AAIDJ,gBAAA,CAAA;IADCI,WAAK,CAAC,aAAa,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAGpD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,0BAAA,EAAA,IAAA,CAAA;;;;;"}
@@ -1,13 +1,14 @@
1
1
  'use client';
2
2
  import { __decorate } from 'tslib';
3
- import { html } from 'lit';
4
- import { property } from 'lit/decorators.js';
3
+ import { html, nothing } from 'lit';
4
+ import { property, queryAssignedElements } from 'lit/decorators.js';
5
5
  import { classMap } from 'lit/directives/class-map.js';
6
6
  import SgdsElement from '../../base/sgds-element.js';
7
7
  import { defaultValue } from '../../utils/defaultvalue.js';
8
8
  import { watch } from '../../utils/watch.js';
9
9
  import css_248z from './stepper.js';
10
10
  import { SgdsIcon } from '../Icon/sgds-icon.js';
11
+ import { HasSlotController } from '../../utils/slot.js';
11
12
 
12
13
  /**
13
14
  * @summary Steppers are used to inform users which step they are at in a form or a process
@@ -18,13 +19,14 @@ import { SgdsIcon } from '../Icon/sgds-icon.js';
18
19
  * @event sgds-first-step - Emitted on hide after animation has completed. Event is fired when firstStep method is called.
19
20
  * @event sgds-arrived - Emitted right after the activeStep has updated its state, when upcoming step has arrived. Call `getMethod()` on this event to get the current step's component.
20
21
  * @event sgds-reset - Emitted right before the step is reset to its defaultActiveStep. Event is fired when reset method is called.
22
+ * @slot default - slot for sgds-step children
21
23
  *
22
24
  */
23
25
  class SgdsStepper extends SgdsElement {
24
26
  constructor() {
25
27
  super(...arguments);
26
- /** The metadata of stepper, type `IStepMetaData`, that consist of `stepHeader: string`, `component:unknown`, `iconName:string`. `stepHeader` is the name of the step and `component` is the content that should appear at the each step. `component` is set to `unknown` to allow users to pass in their desired component based on the framework of choice. e.g. pass in your own react/angular/vue component or it can also be a text content.
27
- * It is required to populate this array to properly render the stepper. By default, stepper markers will render numbers. For icon stepper markers, pass the name of sgds icon via `iconName` key. `iconName` is optional.
28
+ /** The metadata of stepper, type `IStepMetaData`. Deprecated: use sgds-step child components instead.
29
+ * @deprecated Use sgds-step child components instead of the steps property
28
30
  */
29
31
  this.steps = [];
30
32
  /** The current state of active step. Defaults to 0 */
@@ -33,32 +35,93 @@ class SgdsStepper extends SgdsElement {
33
35
  this.orientation = "horizontal";
34
36
  /** When true, the stepper's steps will be clickable */
35
37
  this.clickable = false;
38
+ /** When true, the stepper's steps can only be clicked in a linear manner */
39
+ this.linear = false;
36
40
  /** @internal Gets or sets the default activeStep used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
37
41
  this.defaultActiveStep = 0;
42
+ /** @internal */
43
+ this._items = [];
44
+ this._totalSteps = 0;
45
+ /** @internal Bound i-sgds-click handler for proper event listener removal */
46
+ this._boundHandleItemClick = this._handleStepClick.bind(this);
47
+ /**
48
+ * Indicates the presence of the default slot.
49
+ * Used for server-side rendering to determine table structure.
50
+ * @type {boolean}
51
+ * @internal
52
+ * @default false
53
+ */
54
+ this.hasDefaultSlot = false;
55
+ this.hasSlotController = new HasSlotController(this, "[default]");
56
+ }
57
+ connectedCallback() {
58
+ super.connectedCallback();
59
+ this._totalSteps = this.steps.length;
60
+ this.addEventListener("i-sgds-click", this._boundHandleItemClick);
61
+ }
62
+ /** @internal */
63
+ _handleSlotChange() {
64
+ this._items = this._slotNodes;
65
+ this._totalSteps = this._items.length;
66
+ this._updateStepItems();
67
+ }
68
+ updated() {
69
+ if (!this.hasDefaultSlot)
70
+ this.hasDefaultSlot = this.hasSlotController.test("[default]");
71
+ }
72
+ /** @internal Updates step item properties based on active step and clickable state */
73
+ _updateStepItems() {
74
+ if (this._items && this._items.length > 0) {
75
+ this._items.forEach((item, index) => {
76
+ item.stepIndex = index;
77
+ item.active = this.activeStep === index;
78
+ item._isCompleted = item.completed || this.activeStep > index;
79
+ item.isClickable = this.linear
80
+ ? !item.disabled && this.clickable && (this.activeStep - 1 == index || this.activeStep + 1 == index)
81
+ : !item.disabled && this.clickable;
82
+ item.orientation = this.orientation;
83
+ if (this._items.length > 1) {
84
+ item.isFirstOfType = index === 0;
85
+ item.classList.toggle("last", index === this._items.length - 1);
86
+ }
87
+ });
88
+ }
38
89
  }
39
90
  /** By default, it returns the corresponding component of the current activeStep as defined in the steps metadata. To get other components, pass in your desired step number as the parameter*/
40
91
  getComponent(step = this.activeStep) {
41
- return this.steps[step].component;
92
+ var _a, _b;
93
+ const items = this.hasDefaultSlot ? this._items : this.steps;
94
+ console.log(step, this._items);
95
+ if (items && items.length > 0) {
96
+ return (_a = items[step]) === null || _a === void 0 ? void 0 : _a.component;
97
+ }
98
+ return (_b = this.steps[step]) === null || _b === void 0 ? void 0 : _b.component;
42
99
  }
43
100
  /** Moves the active step forward one step */
44
101
  nextStep() {
102
+ var _a;
45
103
  this.emit("sgds-next-step");
46
- if (this.activeStep < this.steps.length - 1) {
47
- this.activeStep++;
104
+ if (this.activeStep < this._totalSteps - 1) {
105
+ if (!((_a = this._slotNodes[this.activeStep + 1]) === null || _a === void 0 ? void 0 : _a.disabled)) {
106
+ this.activeStep++;
107
+ }
48
108
  }
49
109
  }
50
110
  /** Moves the active step back one step */
51
111
  previousStep() {
112
+ var _a;
52
113
  this.emit("sgds-previous-step");
53
114
  if (this.activeStep > 0) {
54
- this.activeStep--;
115
+ if (!((_a = this._slotNodes[this.activeStep - 1]) === null || _a === void 0 ? void 0 : _a.disabled)) {
116
+ this.activeStep--;
117
+ }
55
118
  }
56
119
  }
57
120
  /** Changes the active step to the last step */
58
121
  lastStep() {
59
122
  this.emit("sgds-last-step");
60
- if (this.activeStep !== this.steps.length - 1) {
61
- this.activeStep = this.steps.length - 1;
123
+ if (this.activeStep !== this._totalSteps - 1) {
124
+ this.activeStep = this._totalSteps - 1;
62
125
  }
63
126
  }
64
127
  /** Changes active step to the first step */
@@ -75,21 +138,35 @@ class SgdsStepper extends SgdsElement {
75
138
  }
76
139
  /**@internal */
77
140
  _onStepperItemClick(index) {
78
- //emit an event before moving to next step
79
- if (this.activeStep > index) {
80
- this.activeStep = index;
81
- }
141
+ this.activeStep = index;
82
142
  }
83
143
  /**@internal */
84
144
  _handleActiveStepChange() {
145
+ this._updateStepItems();
85
146
  this.emit("sgds-arrived");
86
147
  }
87
148
  /**@internal */
149
+ _handleClickableChange() {
150
+ this._updateStepItems();
151
+ }
152
+ /**@internal */
153
+ _handleOrientationChange() {
154
+ this._updateStepItems();
155
+ }
156
+ /**@internal */
88
157
  _handleKeyDown(event, index) {
89
158
  if (event.key === "Enter") {
90
159
  this._onStepperItemClick(index);
91
160
  }
92
161
  }
162
+ /**@internal */
163
+ _handleStepClick(e) {
164
+ var _a;
165
+ const event = e;
166
+ e.stopPropagation();
167
+ const stepIndex = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.stepIndex;
168
+ this._onStepperItemClick(stepIndex);
169
+ }
93
170
  render() {
94
171
  return html `
95
172
  <div
@@ -98,29 +175,33 @@ class SgdsStepper extends SgdsElement {
98
175
  clickable: this.clickable
99
176
  })}"
100
177
  >
101
- ${this.steps.map(({ stepHeader: step, iconName }, index) => {
102
- return html `
103
- <div class="stepper-item-container">
104
- <div
105
- class="stepper-item ${classMap({
106
- "is-active": this.activeStep === index,
107
- "is-completed": this.activeStep > index,
108
- "is-clickable": this.clickable && this.activeStep > index
109
- })}"
110
- tabindex=${this.clickable && this.activeStep > index ? "0" : "-1"}
111
- aria-current=${this.activeStep === index ? "step" : "false"}
112
- aria-disabled=${this.activeStep <= index ? "true" : "false"}
113
- @click="${this.clickable ? () => this._onStepperItemClick(index) : null}"
114
- @keydown=${this.clickable ? (e) => this._handleKeyDown(e, index) : null}
115
- >
116
- <div class="stepper-marker">
117
- ${iconName ? html `<sgds-icon name=${iconName} size="md"></sgds-icon>` : index + 1}
178
+ <slot @slotchange=${this._handleSlotChange}></slot>
179
+
180
+ ${!this.hasDefaultSlot
181
+ ? this.steps.map(({ stepHeader: step, iconName }, index) => {
182
+ return html `
183
+ <div class="stepper-item-container">
184
+ <div
185
+ class="stepper-item ${classMap({
186
+ "is-active": this.activeStep === index,
187
+ "is-completed": this.activeStep > index,
188
+ "is-clickable": this.clickable && this.activeStep > index
189
+ })}"
190
+ tabindex=${this.clickable && this.activeStep > index ? "0" : "-1"}
191
+ aria-current=${this.activeStep === index ? "step" : "false"}
192
+ aria-disabled=${this.activeStep <= index ? "true" : "false"}
193
+ @click="${this.clickable ? () => this._onStepperItemClick(index) : null}"
194
+ @keydown=${this.clickable ? (e) => this._handleKeyDown(e, index) : null}
195
+ >
196
+ <div class="stepper-marker">
197
+ ${iconName ? html `<sgds-icon name=${iconName} size="md"></sgds-icon>` : index + 1}
198
+ </div>
199
+ <div class="stepper-detail">${step}</div>
200
+ </div>
118
201
  </div>
119
- <div class="stepper-detail">${step}</div>
120
- </div>
121
- </div>
122
- `;
123
- })}
202
+ `;
203
+ })
204
+ : nothing}
124
205
  </div>
125
206
  `;
126
207
  }
@@ -140,12 +221,27 @@ __decorate([
140
221
  __decorate([
141
222
  property({ type: Boolean, reflect: true })
142
223
  ], SgdsStepper.prototype, "clickable", void 0);
224
+ __decorate([
225
+ property({ type: Boolean, reflect: true })
226
+ ], SgdsStepper.prototype, "linear", void 0);
143
227
  __decorate([
144
228
  defaultValue("activeStep")
145
229
  ], SgdsStepper.prototype, "defaultActiveStep", void 0);
230
+ __decorate([
231
+ queryAssignedElements()
232
+ ], SgdsStepper.prototype, "_slotNodes", void 0);
233
+ __decorate([
234
+ property({ type: Boolean })
235
+ ], SgdsStepper.prototype, "hasDefaultSlot", void 0);
146
236
  __decorate([
147
237
  watch("activeStep", { waitUntilFirstUpdate: true })
148
238
  ], SgdsStepper.prototype, "_handleActiveStepChange", null);
239
+ __decorate([
240
+ watch("clickable", { waitUntilFirstUpdate: true })
241
+ ], SgdsStepper.prototype, "_handleClickableChange", null);
242
+ __decorate([
243
+ watch("orientation", { waitUntilFirstUpdate: true })
244
+ ], SgdsStepper.prototype, "_handleOrientationChange", null);
149
245
 
150
246
  export { SgdsStepper, SgdsStepper as default };
151
247
  //# sourceMappingURL=sgds-stepper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-stepper.js","sources":["../../../../src/components/Stepper/sgds-stepper.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { watch } from \"../../utils/watch\";\nimport stepperStyle from \"./stepper.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport { IStepMetaData } from \"./types\";\nexport type { IStepMetaData };\n/**\n * @summary Steppers are used to inform users which step they are at in a form or a process\n *\n * @event sgds-next-step - Emitted right before the next step is reached. Event is fired when nextStep method is called.\n * @event sgds-previous-step - Emitted right before the previous step is reached. Event is fired when previousStep method is called.\n * @event sgds-last-step - Emitted right before the last step is reached. Event is fired when lastStep method is called.\n * @event sgds-first-step - Emitted on hide after animation has completed. Event is fired when firstStep method is called.\n * @event sgds-arrived - Emitted right after the activeStep has updated its state, when upcoming step has arrived. Call `getMethod()` on this event to get the current step's component.\n * @event sgds-reset - Emitted right before the step is reset to its defaultActiveStep. Event is fired when reset method is called.\n *\n */\nexport class SgdsStepper extends SgdsElement {\n static styles = [...SgdsElement.styles, stepperStyle];\n /** @internal */\n static dependencies = { \"sgds-icon\": SgdsIcon };\n /** The metadata of stepper, type `IStepMetaData`, that consist of `stepHeader: string`, `component:unknown`, `iconName:string`. `stepHeader` is the name of the step and `component` is the content that should appear at the each step. `component` is set to `unknown` to allow users to pass in their desired component based on the framework of choice. e.g. pass in your own react/angular/vue component or it can also be a text content.\n * It is required to populate this array to properly render the stepper. By default, stepper markers will render numbers. For icon stepper markers, pass the name of sgds icon via `iconName` key. `iconName` is optional.\n */\n @property({ type: Array })\n steps: IStepMetaData[] = [];\n\n /** The current state of active step. Defaults to 0 */\n @property({ type: Number, reflect: true })\n activeStep = 0;\n\n /** The orientation of stepper. By default, the stepper is of horizontal orientation */\n @property({ type: String, reflect: true }) orientation: StepperOrientation = \"horizontal\";\n\n /** When true, the stepper's steps will be clickable */\n @property({ type: Boolean, reflect: true }) clickable = false;\n\n /** @internal Gets or sets the default activeStep used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue(\"activeStep\")\n defaultActiveStep = 0;\n\n /** By default, it returns the corresponding component of the current activeStep as defined in the steps metadata. To get other components, pass in your desired step number as the parameter*/\n public getComponent(step: number = this.activeStep) {\n return this.steps[step].component;\n }\n /** Moves the active step forward one step */\n public nextStep() {\n this.emit(\"sgds-next-step\");\n if (this.activeStep < this.steps.length - 1) {\n this.activeStep++;\n }\n }\n\n /** Moves the active step back one step */\n public previousStep() {\n this.emit(\"sgds-previous-step\");\n\n if (this.activeStep > 0) {\n this.activeStep--;\n }\n }\n\n /** Changes the active step to the last step */\n public lastStep() {\n this.emit(\"sgds-last-step\");\n if (this.activeStep !== this.steps.length - 1) {\n this.activeStep = this.steps.length - 1;\n }\n }\n\n /** Changes active step to the first step */\n public firstStep() {\n this.emit(\"sgds-first-step\");\n if (this.activeStep > 0) {\n this.activeStep = 0;\n }\n }\n\n /** Resets the Stepper to its initial active step state */\n public reset() {\n this.emit(\"sgds-reset\");\n this.activeStep = this.defaultActiveStep;\n }\n\n /**@internal */\n _onStepperItemClick(index: number) {\n //emit an event before moving to next step\n if (this.activeStep > index) {\n this.activeStep = index;\n }\n }\n\n /**@internal */\n @watch(\"activeStep\", { waitUntilFirstUpdate: true })\n _handleActiveStepChange() {\n this.emit(\"sgds-arrived\");\n }\n\n /**@internal */\n _handleKeyDown(event: KeyboardEvent, index: number) {\n if (event.key === \"Enter\") {\n this._onStepperItemClick(index);\n }\n }\n\n render() {\n return html`\n <div\n class=\"stepper ${classMap({\n [`${this.orientation}`]: this.orientation,\n clickable: this.clickable\n })}\"\n >\n ${this.steps.map(({ stepHeader: step, iconName }, index) => {\n return html`\n <div class=\"stepper-item-container\">\n <div\n class=\"stepper-item ${classMap({\n \"is-active\": this.activeStep === index,\n \"is-completed\": this.activeStep > index,\n \"is-clickable\": this.clickable && this.activeStep > index\n })}\"\n tabindex=${this.clickable && this.activeStep > index ? \"0\" : \"-1\"}\n aria-current=${this.activeStep === index ? \"step\" : \"false\"}\n aria-disabled=${this.activeStep <= index ? \"true\" : \"false\"}\n @click=\"${this.clickable ? () => this._onStepperItemClick(index) : null}\"\n @keydown=${this.clickable ? (e: KeyboardEvent) => this._handleKeyDown(e, index) : null}\n >\n <div class=\"stepper-marker\">\n ${iconName ? html`<sgds-icon name=${iconName} size=\"md\"></sgds-icon>` : index + 1}\n </div>\n <div class=\"stepper-detail\">${step}</div>\n </div>\n </div>\n `;\n })}\n </div>\n `;\n }\n}\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\n\nexport default SgdsStepper;\n"],"names":["stepperStyle"],"mappings":";;;;;;;;;;;AAUA;;;;;;;;;;AAUG;AACG,MAAO,WAAY,SAAQ,WAAW,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAIE;;AAEG;QAEH,IAAK,CAAA,KAAA,GAAoB,EAAE,CAAC;;QAI5B,IAAU,CAAA,UAAA,GAAG,CAAC,CAAC;;QAG4B,IAAW,CAAA,WAAA,GAAuB,YAAY,CAAC;;QAG9C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAI9D,IAAiB,CAAA,iBAAA,GAAG,CAAC,CAAC;KAoGvB;;AAjGQ,IAAA,YAAY,CAAC,IAAA,GAAe,IAAI,CAAC,UAAU,EAAA;QAChD,OAA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,CAAA,CAAA;AAuDtB,UAAA,CAAA;IADC,KAAK,CAAC,YAAY,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAGnD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,yBAAA,EAAA,IAAA,CAAA;;;;"}
1
+ {"version":3,"file":"sgds-stepper.js","sources":["../../../../src/components/Stepper/sgds-stepper.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property, queryAssignedElements } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { watch } from \"../../utils/watch\";\nimport stepperStyle from \"./stepper.css\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport { IStepMetaData } from \"./types\";\nimport type SgdsStep from \"./sgds-step\";\nimport { HasSlotController } from \"../../utils/slot\";\nexport type { IStepMetaData };\n\n/**\n * @summary Steppers are used to inform users which step they are at in a form or a process\n *\n * @event sgds-next-step - Emitted right before the next step is reached. Event is fired when nextStep method is called.\n * @event sgds-previous-step - Emitted right before the previous step is reached. Event is fired when previousStep method is called.\n * @event sgds-last-step - Emitted right before the last step is reached. Event is fired when lastStep method is called.\n * @event sgds-first-step - Emitted on hide after animation has completed. Event is fired when firstStep method is called.\n * @event sgds-arrived - Emitted right after the activeStep has updated its state, when upcoming step has arrived. Call `getMethod()` on this event to get the current step's component.\n * @event sgds-reset - Emitted right before the step is reset to its defaultActiveStep. Event is fired when reset method is called.\n * @slot default - slot for sgds-step children\n *\n */\nexport class SgdsStepper extends SgdsElement {\n static styles = [...SgdsElement.styles, stepperStyle];\n /** @internal */\n static dependencies = { \"sgds-icon\": SgdsIcon };\n /** The metadata of stepper, type `IStepMetaData`. Deprecated: use sgds-step child components instead.\n * @deprecated Use sgds-step child components instead of the steps property\n */\n @property({ type: Array })\n steps: IStepMetaData[] = [];\n\n /** The current state of active step. Defaults to 0 */\n @property({ type: Number, reflect: true })\n activeStep = 0;\n\n /** The orientation of stepper. By default, the stepper is of horizontal orientation */\n @property({ type: String, reflect: true }) orientation: StepperOrientation = \"horizontal\";\n\n /** When true, the stepper's steps will be clickable */\n @property({ type: Boolean, reflect: true }) clickable = false;\n\n /** When true, the stepper's steps can only be clicked in a linear manner */\n @property({ type: Boolean, reflect: true }) linear = false;\n\n /** @internal Gets or sets the default activeStep used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue(\"activeStep\")\n defaultActiveStep = 0;\n\n /** @internal */\n @queryAssignedElements() private _slotNodes!: SgdsStep[];\n\n /** @internal */\n private _items: SgdsStep[] = [];\n private _totalSteps = 0;\n\n /** @internal Bound i-sgds-click handler for proper event listener removal */\n private _boundHandleItemClick = this._handleStepClick.bind(this);\n\n /**\n * Indicates the presence of the default slot.\n * Used for server-side rendering to determine table structure.\n * @type {boolean}\n * @internal\n * @default false\n */\n @property({ type: Boolean }) hasDefaultSlot = false;\n private readonly hasSlotController = new HasSlotController(this, \"[default]\");\n\n connectedCallback() {\n super.connectedCallback();\n\n this._totalSteps = this.steps.length;\n this.addEventListener(\"i-sgds-click\", this._boundHandleItemClick);\n }\n\n /** @internal */\n private _handleSlotChange() {\n this._items = this._slotNodes;\n this._totalSteps = this._items.length;\n\n this._updateStepItems();\n }\n\n updated() {\n if (!this.hasDefaultSlot) this.hasDefaultSlot = this.hasSlotController.test(\"[default]\");\n }\n\n /** @internal Updates step item properties based on active step and clickable state */\n private _updateStepItems() {\n if (this._items && this._items.length > 0) {\n this._items.forEach((item, index) => {\n item.stepIndex = index;\n item.active = this.activeStep === index;\n item._isCompleted = item.completed || this.activeStep > index;\n item.isClickable = this.linear\n ? !item.disabled && this.clickable && (this.activeStep - 1 == index || this.activeStep + 1 == index)\n : !item.disabled && this.clickable;\n item.orientation = this.orientation;\n\n if (this._items.length > 1) {\n item.isFirstOfType = index === 0;\n item.classList.toggle(\"last\", index === this._items.length - 1);\n }\n });\n }\n }\n\n /** By default, it returns the corresponding component of the current activeStep as defined in the steps metadata. To get other components, pass in your desired step number as the parameter*/\n public getComponent(step: number = this.activeStep) {\n const items = this.hasDefaultSlot ? this._items : this.steps;\n console.log(step, this._items);\n\n if (items && items.length > 0) {\n return items[step]?.component;\n }\n return this.steps[step]?.component;\n }\n\n /** Moves the active step forward one step */\n public nextStep() {\n this.emit(\"sgds-next-step\");\n if (this.activeStep < this._totalSteps - 1) {\n if (!this._slotNodes[this.activeStep + 1]?.disabled) {\n this.activeStep++;\n }\n }\n }\n\n /** Moves the active step back one step */\n public previousStep() {\n this.emit(\"sgds-previous-step\");\n\n if (this.activeStep > 0) {\n if (!this._slotNodes[this.activeStep - 1]?.disabled) {\n this.activeStep--;\n }\n }\n }\n\n /** Changes the active step to the last step */\n public lastStep() {\n this.emit(\"sgds-last-step\");\n if (this.activeStep !== this._totalSteps - 1) {\n this.activeStep = this._totalSteps - 1;\n }\n }\n\n /** Changes active step to the first step */\n public firstStep() {\n this.emit(\"sgds-first-step\");\n if (this.activeStep > 0) {\n this.activeStep = 0;\n }\n }\n\n /** Resets the Stepper to its initial active step state */\n public reset() {\n this.emit(\"sgds-reset\");\n this.activeStep = this.defaultActiveStep;\n }\n\n /**@internal */\n _onStepperItemClick(index: number) {\n this.activeStep = index;\n }\n\n /**@internal */\n @watch(\"activeStep\", { waitUntilFirstUpdate: true })\n _handleActiveStepChange() {\n this._updateStepItems();\n this.emit(\"sgds-arrived\");\n }\n\n /**@internal */\n @watch(\"clickable\", { waitUntilFirstUpdate: true })\n _handleClickableChange() {\n this._updateStepItems();\n }\n\n /**@internal */\n @watch(\"orientation\", { waitUntilFirstUpdate: true })\n _handleOrientationChange() {\n this._updateStepItems();\n }\n\n /**@internal */\n _handleKeyDown(event: KeyboardEvent, index: number) {\n if (event.key === \"Enter\") {\n this._onStepperItemClick(index);\n }\n }\n\n /**@internal */\n _handleStepClick(e: Event) {\n const event = e as CustomEvent;\n e.stopPropagation();\n\n const stepIndex = event.detail?.stepIndex;\n this._onStepperItemClick(stepIndex);\n }\n\n render() {\n return html`\n <div\n class=\"stepper ${classMap({\n [`${this.orientation}`]: this.orientation,\n clickable: this.clickable\n })}\"\n >\n <slot @slotchange=${this._handleSlotChange}></slot>\n\n ${!this.hasDefaultSlot\n ? this.steps.map(({ stepHeader: step, iconName }, index) => {\n return html`\n <div class=\"stepper-item-container\">\n <div\n class=\"stepper-item ${classMap({\n \"is-active\": this.activeStep === index,\n \"is-completed\": this.activeStep > index,\n \"is-clickable\": this.clickable && this.activeStep > index\n })}\"\n tabindex=${this.clickable && this.activeStep > index ? \"0\" : \"-1\"}\n aria-current=${this.activeStep === index ? \"step\" : \"false\"}\n aria-disabled=${this.activeStep <= index ? \"true\" : \"false\"}\n @click=\"${this.clickable ? () => this._onStepperItemClick(index) : null}\"\n @keydown=${this.clickable ? (e: KeyboardEvent) => this._handleKeyDown(e, index) : null}\n >\n <div class=\"stepper-marker\">\n ${iconName ? html`<sgds-icon name=${iconName} size=\"md\"></sgds-icon>` : index + 1}\n </div>\n <div class=\"stepper-detail\">${step}</div>\n </div>\n </div>\n `;\n })\n : nothing}\n </div>\n `;\n }\n}\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\n\nexport default SgdsStepper;\n"],"names":["stepperStyle"],"mappings":";;;;;;;;;;;;AAaA;;;;;;;;;;;AAWG;AACG,MAAO,WAAY,SAAQ,WAAW,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAIE;;AAEG;QAEH,IAAK,CAAA,KAAA,GAAoB,EAAE,CAAC;;QAI5B,IAAU,CAAA,UAAA,GAAG,CAAC,CAAC;;QAG4B,IAAW,CAAA,WAAA,GAAuB,YAAY,CAAC;;QAG9C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGlB,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;;QAI3D,IAAiB,CAAA,iBAAA,GAAG,CAAC,CAAC;;QAMd,IAAM,CAAA,MAAA,GAAe,EAAE,CAAC;QACxB,IAAW,CAAA,WA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