@dubai-design-system/components-js 3.12.4 → 3.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dda-attach-file.cjs.entry.js +5 -2
- package/dist/cjs/dda-attach-file.cjs.entry.js.map +1 -1
- package/dist/cjs/dda-header.cjs.entry.js +8 -5
- package/dist/cjs/dda-header.cjs.entry.js.map +1 -1
- package/dist/cjs/dda-horizontal-stepper.cjs.entry.js +1 -1
- package/dist/cjs/dda-segmented-tabs.cjs.entry.js +1 -1
- package/dist/cjs/dda-select.cjs.entry.js +9 -2
- package/dist/cjs/dda-select.cjs.entry.js.map +1 -1
- package/dist/cjs/dda-split-button.cjs.entry.js +104 -0
- package/dist/cjs/dda-split-button.cjs.entry.js.map +1 -0
- package/dist/cjs/dda-sticky-footer.cjs.entry.js +1 -1
- package/dist/cjs/dda-tabs.cjs.entry.js +1 -1
- package/dist/cjs/dda-textarea.cjs.entry.js +1 -1
- package/dist/cjs/dda-toggle.cjs.entry.js +2 -2
- package/dist/cjs/dda-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/dda-vertical-stepper.cjs.entry.js +1 -1
- package/dist/cjs/dda.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/dda-attach-file/dda-attach-file.js +24 -2
- package/dist/collection/components/dda-attach-file/dda-attach-file.js.map +1 -1
- package/dist/collection/components/dda-attach-file/dda-attach-file.stories.js +3 -0
- package/dist/collection/components/dda-attach-file/dda-attach-file.stories.js.map +1 -1
- package/dist/collection/components/dda-header/dda-header.js +8 -5
- package/dist/collection/components/dda-header/dda-header.js.map +1 -1
- package/dist/collection/components/dda-header/dda-header.stories.js +7 -0
- package/dist/collection/components/dda-header/dda-header.stories.js.map +1 -1
- package/dist/collection/components/dda-select/dda-select.js +12 -2
- package/dist/collection/components/dda-select/dda-select.js.map +1 -1
- package/dist/collection/components/dda-select/dda-select.stories.js +4 -3
- package/dist/collection/components/dda-select/dda-select.stories.js.map +1 -1
- package/dist/collection/components/dda-split-button/dda-split-button.js +442 -0
- package/dist/collection/components/dda-split-button/dda-split-button.js.map +1 -0
- package/dist/collection/components/dda-split-button/dda-split-button.stories.js +144 -0
- package/dist/collection/components/dda-split-button/dda-split-button.stories.js.map +1 -0
- package/dist/collection/components/dda-sticky-footer/dda-sticky-footer.js +1 -1
- package/dist/collection/components/dda-tabs/dda-tabs.js +1 -1
- package/dist/collection/components/dda-textarea/dda-textarea.js +1 -1
- package/dist/collection/components/dda-toggle/dda-toggle.js +2 -2
- package/dist/collection/components/dda-tooltip/dda-tooltip.js +1 -1
- package/dist/collection/components/segmented-groups/dda-segmented-tabs/dda-segmented-tabs.js +1 -1
- package/dist/collection/components/stepper/dda-horizontal-stepper/dda-horizontal-stepper.js +1 -1
- package/dist/collection/components/stepper/dda-vertical-stepper/dda-vertical-stepper.js +1 -1
- package/dist/collection/global/global.css +2988 -0
- package/dist/collection/global/input.css +674 -0
- package/dist/components/dda-attach-file.js +6 -2
- package/dist/components/dda-attach-file.js.map +1 -1
- package/dist/components/dda-header.js +9 -6
- package/dist/components/dda-header.js.map +1 -1
- package/dist/components/dda-horizontal-stepper.js +1 -1
- package/dist/components/dda-segmented-tabs.js +1 -1
- package/dist/components/dda-select.js +9 -2
- package/dist/components/dda-select.js.map +1 -1
- package/dist/components/dda-split-button.d.ts +11 -0
- package/dist/components/dda-split-button.js +136 -0
- package/dist/components/dda-split-button.js.map +1 -0
- package/dist/components/dda-sticky-footer.js +2 -2
- package/dist/components/dda-tabs.js +1 -1
- package/dist/components/dda-textarea.js +1 -1
- package/dist/components/dda-toggle.js +2 -2
- package/dist/components/dda-tooltip.js +1 -1
- package/dist/components/dda-vertical-stepper.js +1 -1
- package/dist/components/{p-e5df7bea.js → p-ba13ee0a.js} +2 -2
- package/dist/components/{p-e5df7bea.js.map → p-ba13ee0a.js.map} +1 -1
- package/dist/dda/dda.css +1 -1
- package/dist/dda/dda.esm.js +1 -1
- package/dist/dda/dda.esm.js.map +1 -1
- package/dist/dda/{p-e5783b18.entry.js → p-207203ae.entry.js} +2 -2
- package/dist/dda/p-3d1bd318.entry.js +2 -0
- package/dist/dda/p-3d1bd318.entry.js.map +1 -0
- package/dist/dda/{p-6907700e.entry.js → p-3fef96a8.entry.js} +2 -2
- package/dist/dda/{p-bdaee99c.entry.js → p-5bf0d4fe.entry.js} +2 -2
- package/dist/dda/{p-448d72f4.entry.js → p-5c5aeda7.entry.js} +2 -2
- package/dist/dda/p-5c5aeda7.entry.js.map +1 -0
- package/dist/dda/{p-3e36c414.entry.js → p-5d47716e.entry.js} +2 -2
- package/dist/dda/{p-a42f8db6.entry.js → p-60d855a6.entry.js} +2 -2
- package/dist/dda/{p-90c3c3b3.entry.js → p-6fd79768.entry.js} +2 -2
- package/{www/build/p-1cf47f82.entry.js → dist/dda/p-9636f669.entry.js} +2 -2
- package/dist/dda/{p-cd518bfb.entry.js → p-9c090bc6.entry.js} +2 -2
- package/dist/dda/p-9c090bc6.entry.js.map +1 -0
- package/dist/dda/{p-f60d6c1f.entry.js → p-b48e061c.entry.js} +2 -2
- package/dist/dda/p-dca57f55.entry.js +2 -0
- package/dist/dda/p-dca57f55.entry.js.map +1 -0
- package/dist/esm/dda-attach-file.entry.js +5 -2
- package/dist/esm/dda-attach-file.entry.js.map +1 -1
- package/dist/esm/dda-header.entry.js +8 -5
- package/dist/esm/dda-header.entry.js.map +1 -1
- package/dist/esm/dda-horizontal-stepper.entry.js +1 -1
- package/dist/esm/dda-segmented-tabs.entry.js +1 -1
- package/dist/esm/dda-select.entry.js +9 -2
- package/dist/esm/dda-select.entry.js.map +1 -1
- package/dist/esm/dda-split-button.entry.js +100 -0
- package/dist/esm/dda-split-button.entry.js.map +1 -0
- package/dist/esm/dda-sticky-footer.entry.js +1 -1
- package/dist/esm/dda-tabs.entry.js +1 -1
- package/dist/esm/dda-textarea.entry.js +1 -1
- package/dist/esm/dda-toggle.entry.js +2 -2
- package/dist/esm/dda-tooltip.entry.js +1 -1
- package/dist/esm/dda-vertical-stepper.entry.js +1 -1
- package/dist/esm/dda.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/dda-attach-file/dda-attach-file.d.ts +1 -0
- package/dist/types/components/dda-attach-file/dda-attach-file.stories.d.ts +4 -0
- package/dist/types/components/dda-split-button/dda-split-button.d.ts +36 -0
- package/dist/types/components/dda-split-button/dda-split-button.stories.d.ts +79 -0
- package/dist/types/components.d.ts +63 -0
- package/package.json +2 -2
- package/readme.md +11 -0
- package/www/build/dda.css +1 -1
- package/www/build/dda.esm.js +1 -1
- package/www/build/dda.esm.js.map +1 -1
- package/www/build/{p-e5783b18.entry.js → p-207203ae.entry.js} +2 -2
- package/www/build/p-3d1bd318.entry.js +2 -0
- package/www/build/p-3d1bd318.entry.js.map +1 -0
- package/www/build/{p-6907700e.entry.js → p-3fef96a8.entry.js} +2 -2
- package/www/build/{p-44246d95.css → p-46ac0422.css} +1 -1
- package/www/build/{p-bdaee99c.entry.js → p-5bf0d4fe.entry.js} +2 -2
- package/www/build/{p-448d72f4.entry.js → p-5c5aeda7.entry.js} +2 -2
- package/www/build/p-5c5aeda7.entry.js.map +1 -0
- package/www/build/{p-3e36c414.entry.js → p-5d47716e.entry.js} +2 -2
- package/www/build/{p-a42f8db6.entry.js → p-60d855a6.entry.js} +2 -2
- package/www/build/{p-90c3c3b3.entry.js → p-6fd79768.entry.js} +2 -2
- package/{dist/dda/p-1cf47f82.entry.js → www/build/p-9636f669.entry.js} +2 -2
- package/www/build/{p-cd518bfb.entry.js → p-9c090bc6.entry.js} +2 -2
- package/www/build/p-9c090bc6.entry.js.map +1 -0
- package/www/build/{p-f60d6c1f.entry.js → p-b48e061c.entry.js} +2 -2
- package/www/build/p-dca57f55.entry.js +2 -0
- package/www/build/p-dca57f55.entry.js.map +1 -0
- package/dist/dda/p-210d62fb.entry.js +0 -2
- package/dist/dda/p-210d62fb.entry.js.map +0 -1
- package/dist/dda/p-448d72f4.entry.js.map +0 -1
- package/dist/dda/p-cd518bfb.entry.js.map +0 -1
- package/www/build/p-210d62fb.entry.js +0 -2
- package/www/build/p-210d62fb.entry.js.map +0 -1
- package/www/build/p-448d72f4.entry.js.map +0 -1
- package/www/build/p-cd518bfb.entry.js.map +0 -1
- /package/dist/dda/{p-e5783b18.entry.js.map → p-207203ae.entry.js.map} +0 -0
- /package/dist/dda/{p-6907700e.entry.js.map → p-3fef96a8.entry.js.map} +0 -0
- /package/dist/dda/{p-bdaee99c.entry.js.map → p-5bf0d4fe.entry.js.map} +0 -0
- /package/dist/dda/{p-3e36c414.entry.js.map → p-5d47716e.entry.js.map} +0 -0
- /package/dist/dda/{p-a42f8db6.entry.js.map → p-60d855a6.entry.js.map} +0 -0
- /package/dist/dda/{p-90c3c3b3.entry.js.map → p-6fd79768.entry.js.map} +0 -0
- /package/dist/dda/{p-1cf47f82.entry.js.map → p-9636f669.entry.js.map} +0 -0
- /package/dist/dda/{p-f60d6c1f.entry.js.map → p-b48e061c.entry.js.map} +0 -0
- /package/www/build/{p-e5783b18.entry.js.map → p-207203ae.entry.js.map} +0 -0
- /package/www/build/{p-6907700e.entry.js.map → p-3fef96a8.entry.js.map} +0 -0
- /package/www/build/{p-bdaee99c.entry.js.map → p-5bf0d4fe.entry.js.map} +0 -0
- /package/www/build/{p-3e36c414.entry.js.map → p-5d47716e.entry.js.map} +0 -0
- /package/www/build/{p-a42f8db6.entry.js.map → p-60d855a6.entry.js.map} +0 -0
- /package/www/build/{p-90c3c3b3.entry.js.map → p-6fd79768.entry.js.map} +0 -0
- /package/www/build/{p-1cf47f82.entry.js.map → p-9636f669.entry.js.map} +0 -0
- /package/www/build/{p-f60d6c1f.entry.js.map → p-b48e061c.entry.js.map} +0 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
export class DdaSplitButton {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.text_button_type = 'button';
|
|
5
|
+
this.disabled = false;
|
|
6
|
+
this.start_icon_family = '';
|
|
7
|
+
this.start_icon = '';
|
|
8
|
+
this.button_text = '';
|
|
9
|
+
this.aria_label = '';
|
|
10
|
+
this.button_color = 'primary';
|
|
11
|
+
this.button_shape = '';
|
|
12
|
+
this.toggle_button_shape = '';
|
|
13
|
+
this.custom_class = '';
|
|
14
|
+
this.text_button_name = '';
|
|
15
|
+
this.is_open = false;
|
|
16
|
+
this.handleClick = (event) => {
|
|
17
|
+
if (this.disabled)
|
|
18
|
+
return;
|
|
19
|
+
this.buttonClick.emit({
|
|
20
|
+
event,
|
|
21
|
+
id: this.text_button_id,
|
|
22
|
+
value: this.value,
|
|
23
|
+
name: this.text_button_name,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
this.handleClickOutside = (event) => {
|
|
27
|
+
if (this.is_open && !this.el.contains(event.target)) {
|
|
28
|
+
this.is_open = false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
toggleSelect() {
|
|
33
|
+
if (!this.disabled) {
|
|
34
|
+
this.is_open = !this.is_open;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
document.addEventListener('click', this.handleClickOutside);
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
document.removeEventListener('click', this.handleClickOutside);
|
|
42
|
+
}
|
|
43
|
+
componentDidLoad() {
|
|
44
|
+
// after first render, move slotted menu inside container
|
|
45
|
+
this.moveMenuToContainer();
|
|
46
|
+
}
|
|
47
|
+
componentDidRender() {
|
|
48
|
+
// ensure menu stays inside container after re-renders (defensive)
|
|
49
|
+
this.moveMenuToContainer();
|
|
50
|
+
}
|
|
51
|
+
moveMenuToContainer() {
|
|
52
|
+
// find the visible container inside this component
|
|
53
|
+
const container = this.el.querySelector('.split-btn-list');
|
|
54
|
+
if (!container)
|
|
55
|
+
return;
|
|
56
|
+
// Only consider direct children of host that carry slot="menu".
|
|
57
|
+
const hostChildren = Array.from(this.el.children);
|
|
58
|
+
const slotted = hostChildren.filter((c) => c.getAttribute && c.getAttribute('slot') === 'menu');
|
|
59
|
+
slotted.forEach((node) => {
|
|
60
|
+
// if it's already inside container, skip
|
|
61
|
+
if (node.parentElement !== container) {
|
|
62
|
+
container.appendChild(node);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
const textButtonClass = [
|
|
68
|
+
'dda-split-btn', // unique for main button
|
|
69
|
+
`btn-color-${this.button_color}`,
|
|
70
|
+
this.size ? `btn-size-${this.size}` : '',
|
|
71
|
+
this.button_shape ? `split-btn-main-shape-${this.button_shape}` : '',
|
|
72
|
+
this.gap ? `dda-gap-${this.gap}` : '',
|
|
73
|
+
this.custom_class,
|
|
74
|
+
this.component_mode,
|
|
75
|
+
]
|
|
76
|
+
.filter(Boolean)
|
|
77
|
+
.join(' ');
|
|
78
|
+
const toggleButtonClass = [
|
|
79
|
+
'dda-split-btn dda-split-btn-toggle', // unique for toggle button
|
|
80
|
+
`btn-color-${this.button_color}`,
|
|
81
|
+
this.size ? `btn-size-${this.size}` : '',
|
|
82
|
+
this.button_shape ? `split-icon-btn-shape-${this.button_shape}` : '',
|
|
83
|
+
this.gap ? `dda-gap-${this.gap}` : '',
|
|
84
|
+
this.custom_class,
|
|
85
|
+
this.component_mode,
|
|
86
|
+
]
|
|
87
|
+
.filter(Boolean)
|
|
88
|
+
.join(' ');
|
|
89
|
+
const listClass = `split-btn-list ${this.is_open ? 'open' : 'closed'}`;
|
|
90
|
+
return (h(Host, { key: '557dd738ecda2ea9b887f26a649545d636739162' }, h("div", { key: '8cf1af27d4518266bcfa3ad973e5caf747752e4a', class: "split-btn-container" }, h("button", { key: '7d37f0b271365ad447a605f87f4933ade5c51bba', id: this.text_button_id, type: this.text_button_type, class: textButtonClass, disabled: this.disabled, "aria-label": this.aria_label || this.button_text, name: this.text_button_name, value: this.value, onClick: this.handleClick }, this.start_icon && (h("i", { key: 'f6244bede898854205902c83febd164f2a8c7772', class: "material-icons material-symbols-outlined", "aria-hidden": "true" }, this.start_icon)), h("span", { key: '5785f0550374e9b71225111c1473bc3a40808490' }, this.button_text)), h("button", { key: 'a8158ad76834a12c564771a91237a452ae917323', type: "button", class: toggleButtonClass, disabled: this.disabled, onClick: () => this.toggleSelect() }, h("i", { key: '632d4c992c4da668770292d9b2b0881d0d85a557', class: "material-icons", "aria-hidden": "true" }, this.is_open ? 'keyboard_arrow_up' : 'keyboard_arrow_down')), h("div", { key: '88988abe9f2a3173f34356a030fdd03055c94139', class: listClass, "aria-hidden": !this.is_open, role: "menu" }, h("slot", { key: 'b7c9e16e3c36b64d6aa185ced7da41ff1f02cc76', name: "menu" })))));
|
|
91
|
+
}
|
|
92
|
+
static get is() { return "dda-split-button"; }
|
|
93
|
+
static get properties() {
|
|
94
|
+
return {
|
|
95
|
+
"text_button_type": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"mutable": false,
|
|
98
|
+
"complexType": {
|
|
99
|
+
"original": "string",
|
|
100
|
+
"resolved": "string",
|
|
101
|
+
"references": {}
|
|
102
|
+
},
|
|
103
|
+
"required": false,
|
|
104
|
+
"optional": false,
|
|
105
|
+
"docs": {
|
|
106
|
+
"tags": [],
|
|
107
|
+
"text": ""
|
|
108
|
+
},
|
|
109
|
+
"getter": false,
|
|
110
|
+
"setter": false,
|
|
111
|
+
"attribute": "text_button_type",
|
|
112
|
+
"reflect": false,
|
|
113
|
+
"defaultValue": "'button'"
|
|
114
|
+
},
|
|
115
|
+
"disabled": {
|
|
116
|
+
"type": "boolean",
|
|
117
|
+
"mutable": false,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "boolean",
|
|
120
|
+
"resolved": "boolean",
|
|
121
|
+
"references": {}
|
|
122
|
+
},
|
|
123
|
+
"required": false,
|
|
124
|
+
"optional": false,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": ""
|
|
128
|
+
},
|
|
129
|
+
"getter": false,
|
|
130
|
+
"setter": false,
|
|
131
|
+
"attribute": "disabled",
|
|
132
|
+
"reflect": false,
|
|
133
|
+
"defaultValue": "false"
|
|
134
|
+
},
|
|
135
|
+
"start_icon_family": {
|
|
136
|
+
"type": "string",
|
|
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
|
+
"attribute": "start_icon_family",
|
|
152
|
+
"reflect": false,
|
|
153
|
+
"defaultValue": "''"
|
|
154
|
+
},
|
|
155
|
+
"start_icon": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"mutable": false,
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "string",
|
|
160
|
+
"resolved": "string",
|
|
161
|
+
"references": {}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
164
|
+
"optional": false,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": ""
|
|
168
|
+
},
|
|
169
|
+
"getter": false,
|
|
170
|
+
"setter": false,
|
|
171
|
+
"attribute": "start_icon",
|
|
172
|
+
"reflect": false,
|
|
173
|
+
"defaultValue": "''"
|
|
174
|
+
},
|
|
175
|
+
"button_text": {
|
|
176
|
+
"type": "string",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "string",
|
|
180
|
+
"resolved": "string",
|
|
181
|
+
"references": {}
|
|
182
|
+
},
|
|
183
|
+
"required": false,
|
|
184
|
+
"optional": false,
|
|
185
|
+
"docs": {
|
|
186
|
+
"tags": [],
|
|
187
|
+
"text": ""
|
|
188
|
+
},
|
|
189
|
+
"getter": false,
|
|
190
|
+
"setter": false,
|
|
191
|
+
"attribute": "button_text",
|
|
192
|
+
"reflect": false,
|
|
193
|
+
"defaultValue": "''"
|
|
194
|
+
},
|
|
195
|
+
"aria_label": {
|
|
196
|
+
"type": "string",
|
|
197
|
+
"mutable": false,
|
|
198
|
+
"complexType": {
|
|
199
|
+
"original": "string",
|
|
200
|
+
"resolved": "string",
|
|
201
|
+
"references": {}
|
|
202
|
+
},
|
|
203
|
+
"required": false,
|
|
204
|
+
"optional": true,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": ""
|
|
208
|
+
},
|
|
209
|
+
"getter": false,
|
|
210
|
+
"setter": false,
|
|
211
|
+
"attribute": "aria_label",
|
|
212
|
+
"reflect": false,
|
|
213
|
+
"defaultValue": "''"
|
|
214
|
+
},
|
|
215
|
+
"button_color": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"mutable": false,
|
|
218
|
+
"complexType": {
|
|
219
|
+
"original": "string",
|
|
220
|
+
"resolved": "string",
|
|
221
|
+
"references": {}
|
|
222
|
+
},
|
|
223
|
+
"required": false,
|
|
224
|
+
"optional": false,
|
|
225
|
+
"docs": {
|
|
226
|
+
"tags": [],
|
|
227
|
+
"text": ""
|
|
228
|
+
},
|
|
229
|
+
"getter": false,
|
|
230
|
+
"setter": false,
|
|
231
|
+
"attribute": "button_color",
|
|
232
|
+
"reflect": false,
|
|
233
|
+
"defaultValue": "'primary'"
|
|
234
|
+
},
|
|
235
|
+
"size": {
|
|
236
|
+
"type": "string",
|
|
237
|
+
"mutable": false,
|
|
238
|
+
"complexType": {
|
|
239
|
+
"original": "string",
|
|
240
|
+
"resolved": "string",
|
|
241
|
+
"references": {}
|
|
242
|
+
},
|
|
243
|
+
"required": false,
|
|
244
|
+
"optional": true,
|
|
245
|
+
"docs": {
|
|
246
|
+
"tags": [],
|
|
247
|
+
"text": ""
|
|
248
|
+
},
|
|
249
|
+
"getter": false,
|
|
250
|
+
"setter": false,
|
|
251
|
+
"attribute": "size",
|
|
252
|
+
"reflect": false
|
|
253
|
+
},
|
|
254
|
+
"button_shape": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"mutable": false,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "string",
|
|
259
|
+
"resolved": "string",
|
|
260
|
+
"references": {}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": true,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": ""
|
|
267
|
+
},
|
|
268
|
+
"getter": false,
|
|
269
|
+
"setter": false,
|
|
270
|
+
"attribute": "button_shape",
|
|
271
|
+
"reflect": false,
|
|
272
|
+
"defaultValue": "''"
|
|
273
|
+
},
|
|
274
|
+
"toggle_button_shape": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"mutable": false,
|
|
277
|
+
"complexType": {
|
|
278
|
+
"original": "string",
|
|
279
|
+
"resolved": "string",
|
|
280
|
+
"references": {}
|
|
281
|
+
},
|
|
282
|
+
"required": false,
|
|
283
|
+
"optional": true,
|
|
284
|
+
"docs": {
|
|
285
|
+
"tags": [],
|
|
286
|
+
"text": ""
|
|
287
|
+
},
|
|
288
|
+
"getter": false,
|
|
289
|
+
"setter": false,
|
|
290
|
+
"attribute": "toggle_button_shape",
|
|
291
|
+
"reflect": false,
|
|
292
|
+
"defaultValue": "''"
|
|
293
|
+
},
|
|
294
|
+
"gap": {
|
|
295
|
+
"type": "number",
|
|
296
|
+
"mutable": false,
|
|
297
|
+
"complexType": {
|
|
298
|
+
"original": "number",
|
|
299
|
+
"resolved": "number",
|
|
300
|
+
"references": {}
|
|
301
|
+
},
|
|
302
|
+
"required": false,
|
|
303
|
+
"optional": true,
|
|
304
|
+
"docs": {
|
|
305
|
+
"tags": [],
|
|
306
|
+
"text": ""
|
|
307
|
+
},
|
|
308
|
+
"getter": false,
|
|
309
|
+
"setter": false,
|
|
310
|
+
"attribute": "gap",
|
|
311
|
+
"reflect": false
|
|
312
|
+
},
|
|
313
|
+
"custom_class": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"mutable": false,
|
|
316
|
+
"complexType": {
|
|
317
|
+
"original": "string",
|
|
318
|
+
"resolved": "string",
|
|
319
|
+
"references": {}
|
|
320
|
+
},
|
|
321
|
+
"required": false,
|
|
322
|
+
"optional": true,
|
|
323
|
+
"docs": {
|
|
324
|
+
"tags": [],
|
|
325
|
+
"text": ""
|
|
326
|
+
},
|
|
327
|
+
"getter": false,
|
|
328
|
+
"setter": false,
|
|
329
|
+
"attribute": "custom_class",
|
|
330
|
+
"reflect": false,
|
|
331
|
+
"defaultValue": "''"
|
|
332
|
+
},
|
|
333
|
+
"component_mode": {
|
|
334
|
+
"type": "string",
|
|
335
|
+
"mutable": false,
|
|
336
|
+
"complexType": {
|
|
337
|
+
"original": "string",
|
|
338
|
+
"resolved": "string",
|
|
339
|
+
"references": {}
|
|
340
|
+
},
|
|
341
|
+
"required": false,
|
|
342
|
+
"optional": true,
|
|
343
|
+
"docs": {
|
|
344
|
+
"tags": [],
|
|
345
|
+
"text": ""
|
|
346
|
+
},
|
|
347
|
+
"getter": false,
|
|
348
|
+
"setter": false,
|
|
349
|
+
"attribute": "component_mode",
|
|
350
|
+
"reflect": false
|
|
351
|
+
},
|
|
352
|
+
"text_button_id": {
|
|
353
|
+
"type": "string",
|
|
354
|
+
"mutable": false,
|
|
355
|
+
"complexType": {
|
|
356
|
+
"original": "string",
|
|
357
|
+
"resolved": "string",
|
|
358
|
+
"references": {}
|
|
359
|
+
},
|
|
360
|
+
"required": false,
|
|
361
|
+
"optional": false,
|
|
362
|
+
"docs": {
|
|
363
|
+
"tags": [],
|
|
364
|
+
"text": ""
|
|
365
|
+
},
|
|
366
|
+
"getter": false,
|
|
367
|
+
"setter": false,
|
|
368
|
+
"attribute": "text_button_id",
|
|
369
|
+
"reflect": false
|
|
370
|
+
},
|
|
371
|
+
"text_button_name": {
|
|
372
|
+
"type": "string",
|
|
373
|
+
"mutable": false,
|
|
374
|
+
"complexType": {
|
|
375
|
+
"original": "string",
|
|
376
|
+
"resolved": "string",
|
|
377
|
+
"references": {}
|
|
378
|
+
},
|
|
379
|
+
"required": false,
|
|
380
|
+
"optional": true,
|
|
381
|
+
"docs": {
|
|
382
|
+
"tags": [],
|
|
383
|
+
"text": ""
|
|
384
|
+
},
|
|
385
|
+
"getter": false,
|
|
386
|
+
"setter": false,
|
|
387
|
+
"attribute": "text_button_name",
|
|
388
|
+
"reflect": false,
|
|
389
|
+
"defaultValue": "''"
|
|
390
|
+
},
|
|
391
|
+
"value": {
|
|
392
|
+
"type": "string",
|
|
393
|
+
"mutable": false,
|
|
394
|
+
"complexType": {
|
|
395
|
+
"original": "string",
|
|
396
|
+
"resolved": "string",
|
|
397
|
+
"references": {}
|
|
398
|
+
},
|
|
399
|
+
"required": false,
|
|
400
|
+
"optional": true,
|
|
401
|
+
"docs": {
|
|
402
|
+
"tags": [],
|
|
403
|
+
"text": ""
|
|
404
|
+
},
|
|
405
|
+
"getter": false,
|
|
406
|
+
"setter": false,
|
|
407
|
+
"attribute": "value",
|
|
408
|
+
"reflect": false
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
static get states() {
|
|
413
|
+
return {
|
|
414
|
+
"is_open": {}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
static get events() {
|
|
418
|
+
return [{
|
|
419
|
+
"method": "buttonClick",
|
|
420
|
+
"name": "buttonClick",
|
|
421
|
+
"bubbles": true,
|
|
422
|
+
"cancelable": true,
|
|
423
|
+
"composed": true,
|
|
424
|
+
"docs": {
|
|
425
|
+
"tags": [],
|
|
426
|
+
"text": ""
|
|
427
|
+
},
|
|
428
|
+
"complexType": {
|
|
429
|
+
"original": "{ event: MouseEvent, id: string, value: string, name: string }",
|
|
430
|
+
"resolved": "{ event: MouseEvent; id: string; value: string; name: string; }",
|
|
431
|
+
"references": {
|
|
432
|
+
"MouseEvent": {
|
|
433
|
+
"location": "global",
|
|
434
|
+
"id": "global::MouseEvent"
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}];
|
|
439
|
+
}
|
|
440
|
+
static get elementRef() { return "el"; }
|
|
441
|
+
}
|
|
442
|
+
//# sourceMappingURL=dda-split-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dda-split-button.js","sourceRoot":"","sources":["../../../src/components/dda-split-button/dda-split-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAgB,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAO9F,MAAM,OAAO,cAAc;IAL3B;QAMU,qBAAgB,GAAW,QAAQ,CAAC;QACpC,aAAQ,GAAY,KAAK,CAAC;QAC1B,sBAAiB,GAAW,EAAE,CAAC;QAC/B,eAAU,GAAW,EAAE,CAAC;QACxB,gBAAW,GAAW,EAAE,CAAC;QACzB,eAAU,GAAY,EAAE,CAAC;QACzB,iBAAY,GAAW,SAAS,CAAC;QAEjC,iBAAY,GAAY,EAAE,CAAC;QAC3B,wBAAmB,GAAY,EAAE,CAAC;QAElC,iBAAY,GAAY,EAAE,CAAC;QAG3B,qBAAgB,GAAY,EAAE,CAAC;QAO9B,YAAO,GAAY,KAAK,CAAC;QAE1B,gBAAW,GAAG,CAAC,KAAiB,EAAE,EAAE;YAC1C,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAE1B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;gBACpB,KAAK;gBACL,EAAE,EAAE,IAAI,CAAC,cAAc;gBACvB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,IAAI,EAAE,IAAI,CAAC,gBAAgB;aAC5B,CAAC,CAAC;QACL,CAAC,CAAC;QAOF,uBAAkB,GAAG,CAAC,KAAiB,EAAE,EAAE;YACzC,IAAI,IAAI,CAAC,O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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACA","sourcesContent":["import { Host, Component, Prop, h, Event, EventEmitter, State, Element } from '@stencil/core';\r\n\r\n@Component({\r\n tag: 'dda-split-button',\r\n // styleUrls: ['dda-split-button.css'],\r\n shadow: false,\r\n})\r\nexport class DdaSplitButton {\r\n @Prop() text_button_type: string = 'button';\r\n @Prop() disabled: boolean = false;\r\n @Prop() start_icon_family: string = '';\r\n @Prop() start_icon: string = '';\r\n @Prop() button_text: string = '';\r\n @Prop() aria_label?: string = '';\r\n @Prop() button_color: string = 'primary';\r\n @Prop() size?: string;\r\n @Prop() button_shape?: string = '';\r\n @Prop() toggle_button_shape?: string = '';\r\n @Prop() gap?: number;\r\n @Prop() custom_class?: string = '';\r\n @Prop() component_mode?: string;\r\n @Prop() text_button_id: string;\r\n @Prop() text_button_name?: string = '';\r\n @Prop() value?: string;\r\n\r\n @Event() buttonClick: EventEmitter<{ event: MouseEvent, id: string, value: string, name: string }>;\r\n\r\n /*toogle Button*/\r\n @Element() el: HTMLElement;\r\n @State() is_open: boolean = false;\r\n\r\n private handleClick = (event: MouseEvent) => {\r\n if (this.disabled) return;\r\n\r\n this.buttonClick.emit({\r\n event,\r\n id: this.text_button_id,\r\n value: this.value,\r\n name: this.text_button_name,\r\n });\r\n };\r\n \r\n toggleSelect() {\r\n if (!this.disabled) {\r\n this.is_open = !this.is_open;\r\n }\r\n }\r\n handleClickOutside = (event: MouseEvent) => {\r\n if (this.is_open && !this.el.contains(event.target as Node)) {\r\n this.is_open = false;\r\n }\r\n };\r\n\r\n connectedCallback() {\r\n document.addEventListener('click', this.handleClickOutside);\r\n }\r\n\r\n disconnectedCallback() {\r\n document.removeEventListener('click', this.handleClickOutside);\r\n }\r\n\r\n componentDidLoad() {\r\n // after first render, move slotted menu inside container\r\n this.moveMenuToContainer();\r\n }\r\n\r\n componentDidRender() {\r\n // ensure menu stays inside container after re-renders (defensive)\r\n this.moveMenuToContainer();\r\n }\r\n\r\n private moveMenuToContainer() {\r\n // find the visible container inside this component\r\n const container = this.el.querySelector('.split-btn-list') as HTMLElement | null;\r\n if (!container) return;\r\n\r\n // Only consider direct children of host that carry slot=\"menu\".\r\n const hostChildren = Array.from(this.el.children) as Element[];\r\n const slotted = hostChildren.filter((c) => c.getAttribute && c.getAttribute('slot') === 'menu');\r\n\r\n slotted.forEach((node) => {\r\n // if it's already inside container, skip\r\n if (node.parentElement !== container) {\r\n container.appendChild(node);\r\n }\r\n });\r\n }\r\n\r\n\r\n\r\n render() {\r\n const textButtonClass = [\r\n 'dda-split-btn', // unique for main button\r\n `btn-color-${this.button_color}`,\r\n this.size ? `btn-size-${this.size}` : '',\r\n this.button_shape ? `split-btn-main-shape-${this.button_shape}` : '',\r\n this.gap ? `dda-gap-${this.gap}` : '',\r\n this.custom_class,\r\n this.component_mode,\r\n ]\r\n .filter(Boolean)\r\n .join(' ');\r\n\r\n const toggleButtonClass = [\r\n 'dda-split-btn dda-split-btn-toggle', // unique for toggle button\r\n `btn-color-${this.button_color}`,\r\n this.size ? `btn-size-${this.size}` : '',\r\n this.button_shape ? `split-icon-btn-shape-${this.button_shape}` : '',\r\n this.gap ? `dda-gap-${this.gap}` : '',\r\n this.custom_class,\r\n this.component_mode,\r\n ]\r\n .filter(Boolean)\r\n .join(' ');\r\n\r\n const listClass = `split-btn-list ${this.is_open ? 'open' : 'closed'}`;\r\n\r\n return (\r\n <Host>\r\n <div class=\"split-btn-container\">\r\n {/* Main action button */}\r\n <button\r\n id={this.text_button_id}\r\n type={this.text_button_type}\r\n class={textButtonClass}\r\n disabled={this.disabled}\r\n aria-label={this.aria_label || this.button_text}\r\n name={this.text_button_name}\r\n value={this.value}\r\n onClick={this.handleClick}\r\n >\r\n {this.start_icon && (\r\n <i class=\"material-icons material-symbols-outlined\" aria-hidden=\"true\">\r\n {this.start_icon}\r\n </i>\r\n )}\r\n <span>{this.button_text}</span>\r\n </button>\r\n\r\n {/* Dropdown toggle button */}\r\n <button \r\n type=\"button\"\r\n class={toggleButtonClass}\r\n disabled={this.disabled}\r\n onClick={() => this.toggleSelect()}\r\n >\r\n <i class=\"material-icons\" aria-hidden=\"true\">\r\n {this.is_open ? 'keyboard_arrow_up' : 'keyboard_arrow_down'}\r\n </i>\r\n </button>\r\n\r\n <div class={listClass} aria-hidden={!this.is_open} role=\"menu\">\r\n <slot name=\"menu\"></slot>\r\n </div>\r\n\r\n\r\n {/* {this.is_open && (\r\n <div class=\"split-btn-list\">\r\n <slot name=\"menu\"></slot>\r\n </div>\r\n )} */}\r\n </div>\r\n </Host>\r\n );\r\n}\r\n}\r\n"]}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'Components/DDA Split Button/DDA Split Button',
|
|
3
|
+
tags: ['autodocs'],
|
|
4
|
+
parameters: {
|
|
5
|
+
docs: {
|
|
6
|
+
description: {
|
|
7
|
+
component: `
|
|
8
|
+
To use the \`<dda-split-button>\` component, pass the following props:
|
|
9
|
+
|
|
10
|
+
\`\`\`html
|
|
11
|
+
<dda-split-button
|
|
12
|
+
button_color="default-primary"
|
|
13
|
+
start_icon="sentiment_satisfied"
|
|
14
|
+
button_text: "Button"
|
|
15
|
+
end_icon="arrow_forward"
|
|
16
|
+
custom_class=""
|
|
17
|
+
component_mode=""
|
|
18
|
+
text_button_id="button"
|
|
19
|
+
aria_label="button"
|
|
20
|
+
text_button_name="button"
|
|
21
|
+
value="my-value"
|
|
22
|
+
>
|
|
23
|
+
</dda-split-button>
|
|
24
|
+
\`\`\`
|
|
25
|
+
|
|
26
|
+
To listen for click events:
|
|
27
|
+
|
|
28
|
+
\`\`\`javascript
|
|
29
|
+
document.querySelector('dda-split-button').addEventListener('buttonClick', (e) => {
|
|
30
|
+
const { event, id, value, name } = e.detail;
|
|
31
|
+
console.log('Button clicked:', { id, value, name });
|
|
32
|
+
});
|
|
33
|
+
\`\`\`
|
|
34
|
+
`,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
argTypes: {
|
|
39
|
+
button_color: {
|
|
40
|
+
control: { type: 'select' },
|
|
41
|
+
options: [
|
|
42
|
+
'default-primary', 'default-secondary', 'default-tertiary', 'default-link',
|
|
43
|
+
'error-primary', 'error-secondary', 'error-tertiary', 'error-link',
|
|
44
|
+
'onsurface-primary', 'onsurface-secondary', 'onsurface-tertiary', 'onsurface-link',
|
|
45
|
+
'secondary', 'success', 'warning', 'surface', 'surface-variant', 'disabled',
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
text_button_type: { control: 'select', options: ['button', 'submit', 'reset'] },
|
|
49
|
+
size: { control: 'select', options: ['sm', 'md', 'lg', 'xl'] },
|
|
50
|
+
button_shape: { control: 'select', options: ['default', 'circle'] },
|
|
51
|
+
toggle_button_shape: { control: 'select', options: ['default', 'circle'] },
|
|
52
|
+
gap: { control: 'select', options: [1, 2] },
|
|
53
|
+
button_text: { control: 'text' },
|
|
54
|
+
custom_class: { control: 'text' },
|
|
55
|
+
component_mode: {
|
|
56
|
+
control: { type: 'select' },
|
|
57
|
+
options: ['dark-mode', 'light-mode'],
|
|
58
|
+
description: 'Mode of the button component',
|
|
59
|
+
},
|
|
60
|
+
text_button_id: { control: 'text', description: 'ID of the button' },
|
|
61
|
+
aria_label: { control: 'text', description: 'Aria label for the button' },
|
|
62
|
+
text_button_name: { control: 'text', description: 'Name of the button' },
|
|
63
|
+
value: { control: 'text', description: 'Value of the button' },
|
|
64
|
+
disabled: { control: 'boolean', description: 'Disable the button' },
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
const Template = (args) => {
|
|
68
|
+
const attributes = Object.entries(args)
|
|
69
|
+
.filter(([key, value]) => value !== undefined && key !== 'text')
|
|
70
|
+
.map(([key, value]) => {
|
|
71
|
+
if (key === 'onClick') {
|
|
72
|
+
return `onclick="${value}"`; // inject raw JS string
|
|
73
|
+
}
|
|
74
|
+
return `${key}="${value}"`;
|
|
75
|
+
})
|
|
76
|
+
.join(' ');
|
|
77
|
+
// Manually add the onclick attribute with a placeholder JS snippet or text
|
|
78
|
+
const onclickAttr = 'onclick="console.log(\'native click\')"';
|
|
79
|
+
// Create the button element HTML string including onclick
|
|
80
|
+
const buttonHtml = `<dda-split-button ${attributes} ${onclickAttr}></dda-split-button>`;
|
|
81
|
+
// Add event listener after the element is created (unchanged)
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
const button = document.querySelector(`dda-split-button[button_id="${args.text_button_id}"]`);
|
|
84
|
+
if (button) {
|
|
85
|
+
button.removeEventListener('buttonClick', handleButtonClick);
|
|
86
|
+
button.addEventListener('buttonClick', handleButtonClick);
|
|
87
|
+
}
|
|
88
|
+
}, 0);
|
|
89
|
+
return buttonHtml;
|
|
90
|
+
};
|
|
91
|
+
const handleButtonClick = (e) => {
|
|
92
|
+
const { event, id, value, name } = e.detail;
|
|
93
|
+
console.log('Button clicked:', { id, value, name });
|
|
94
|
+
console.log('Mouse event:', event);
|
|
95
|
+
if (id === 'error-button') {
|
|
96
|
+
alert('Hello! I am an alert box!!');
|
|
97
|
+
}
|
|
98
|
+
else if (id === 'console-button') {
|
|
99
|
+
console.log('Button clicked via custom event');
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
export const DefaultPrimary = Template.bind({});
|
|
103
|
+
DefaultPrimary.args = {
|
|
104
|
+
text_button_type: "button",
|
|
105
|
+
button_color: 'default-primary',
|
|
106
|
+
start_icon: 'sentiment_satisfied',
|
|
107
|
+
button_text: 'Button',
|
|
108
|
+
text_button_id: 'default-primary-btn',
|
|
109
|
+
aria_label: 'default primary button',
|
|
110
|
+
text_button_name: 'defaultPrimaryButton',
|
|
111
|
+
value: 'default-primary-value',
|
|
112
|
+
button_shape: 'default',
|
|
113
|
+
size: 'md',
|
|
114
|
+
gap: 1,
|
|
115
|
+
disabled: false,
|
|
116
|
+
custom_class: '',
|
|
117
|
+
component_mode: '',
|
|
118
|
+
onclick: "console.log('native click')"
|
|
119
|
+
};
|
|
120
|
+
export const ErrorPrimary = Template.bind({});
|
|
121
|
+
ErrorPrimary.args = Object.assign(Object.assign({}, DefaultPrimary.args), { button_color: 'error-primary', start_icon: 'sentiment_satisfied', button_text: 'Button', text_button_id: 'default-primary-btn', aria_label: 'default primary button', text_button_name: 'defaultPrimaryButton', value: 'default-primary-value', button_shape: 'default', size: 'md', gap: '1', disabled: false, custom_class: '', component_mode: '', onclick: "console.log('native click')" });
|
|
122
|
+
export const SurfacePrimary = Template.bind({});
|
|
123
|
+
SurfacePrimary.args = Object.assign(Object.assign({}, DefaultPrimary.args), { button_color: 'onsurface-primary', start_icon: 'sentiment_satisfied', button_text: 'Button', text_button_id: 'default-primary-btn', aria_label: 'default primary button', text_button_name: 'defaultPrimaryButton', value: 'default-primary-value', button_shape: 'default', size: 'md', gap: '1', disabled: false, custom_class: '', component_mode: '', onclick: "console.log('native click')" });
|
|
124
|
+
export const Disabled = Template.bind({});
|
|
125
|
+
Disabled.args = Object.assign(Object.assign({}, DefaultPrimary.args), { button_color: 'disabled', text_button_id: 'disabled-button', disabled: true, custom_class: '', component_mode: '', onclick: "console.log('native click')" });
|
|
126
|
+
export const IconButton = Template.bind({});
|
|
127
|
+
IconButton.args = {
|
|
128
|
+
text_button_type: "button",
|
|
129
|
+
button_color: 'default-primary',
|
|
130
|
+
start_icon: 'sentiment_satisfied',
|
|
131
|
+
text_button_id: 'icon-button',
|
|
132
|
+
aria_label: 'icon button',
|
|
133
|
+
text_button_name: 'iconButton',
|
|
134
|
+
value: 'icon-value',
|
|
135
|
+
toggle_button_shape: "default",
|
|
136
|
+
size: 'md',
|
|
137
|
+
disabled: false,
|
|
138
|
+
custom_class: '',
|
|
139
|
+
component_mode: '',
|
|
140
|
+
onclick: "console.log('native click')"
|
|
141
|
+
};
|
|
142
|
+
export const IconButtonDisabled = Template.bind({});
|
|
143
|
+
IconButtonDisabled.args = Object.assign(Object.assign({}, IconButton.args), { button_color: 'disabled', text_button_id: 'icon-button-disabled', disabled: true, custom_class: '', component_mode: '', onclick: "console.log('native click')" });
|
|
144
|
+
//# sourceMappingURL=dda-split-button.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dda-split-button.stories.js","sourceRoot":"","sources":["../../../src/components/dda-split-button/dda-split-button.stories.tsx"],"names":[],"mappings":"AAAA,eAAe;IACb,KAAK,EAAE,8CAA8C;IACrD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;SA2BV;aACF;SACF;KACF;IACD,QAAQ,EAAE;QACR,YAAY,EAAE;YACZ,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE;gBACP,iBAAiB,EAAC,mBAAmB,EAAC,kBAAkB,EAAC,cAAc;gBACvE,eAAe,EAAC,iBAAiB,EAAC,gBAAgB,EAAC,YAAY;gBAC/D,mBAAmB,EAAC,qBAAqB,EAAC,oBAAoB,EAAC,gBAAgB;gBAC/E,WAAW,EAAC,SAAS,EAAC,SAAS,EAAC,SAAS,EAAC,iBAAiB,EAAC,UAAU;aACvE;SACF;QACD,gBAAgB,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE;QAC/E,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QAC9D,YAAY,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE;QACnE,mBAAmB,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE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Split Button',\r\n tags: ['autodocs'],\r\n parameters: {\r\n docs: {\r\n description: {\r\n component: `\r\nTo use the \\`<dda-split-button>\\` component, pass the following props:\r\n\r\n\\`\\`\\`html\r\n<dda-split-button\r\n button_color=\"default-primary\"\r\n start_icon=\"sentiment_satisfied\"\r\n button_text: \"Button\"\r\n end_icon=\"arrow_forward\"\r\n custom_class=\"\"\r\n component_mode=\"\"\r\n text_button_id=\"button\"\r\n aria_label=\"button\"\r\n text_button_name=\"button\"\r\n value=\"my-value\"\r\n >\r\n</dda-split-button>\r\n\\`\\`\\`\r\n\r\nTo listen for click events:\r\n\r\n\\`\\`\\`javascript\r\ndocument.querySelector('dda-split-button').addEventListener('buttonClick', (e) => {\r\n const { event, id, value, name } = e.detail;\r\n console.log('Button clicked:', { id, value, name });\r\n});\r\n\\`\\`\\`\r\n `,\r\n },\r\n },\r\n },\r\n argTypes: {\r\n button_color: {\r\n control: { type: 'select' },\r\n options: [\r\n 'default-primary','default-secondary','default-tertiary','default-link',\r\n 'error-primary','error-secondary','error-tertiary','error-link',\r\n 'onsurface-primary','onsurface-secondary','onsurface-tertiary','onsurface-link',\r\n 'secondary','success','warning','surface','surface-variant','disabled',\r\n ],\r\n },\r\n text_button_type: { control: 'select', options: ['button', 'submit', 'reset'] },\r\n size: { control: 'select', options: ['sm', 'md', 'lg', 'xl'] },\r\n button_shape: { control: 'select', options: ['default', 'circle'] },\r\n toggle_button_shape: { control: 'select', options: ['default', 'circle'] },\r\n gap: { control: 'select', options: [1, 2] },\r\n button_text: { control: 'text' },\r\n custom_class: { control: 'text' },\r\n component_mode: {\r\n control: { type: 'select' },\r\n options: ['dark-mode', 'light-mode'],\r\n description: 'Mode of the button component',\r\n },\r\n text_button_id: { control: 'text', description: 'ID of the button' },\r\n aria_label: { control: 'text', description: 'Aria label for the button' },\r\n text_button_name: { control: 'text', description: 'Name of the button' },\r\n value: { control: 'text', description: 'Value of the button' },\r\n disabled: { control: 'boolean', description: 'Disable the button' },\r\n },\r\n};\r\n\r\n\r\n\r\nconst Template = (args) => {\r\n const attributes = Object.entries(args)\r\n .filter(([key, value]) => value !== undefined && key !== 'text')\r\n .map(([key, value]) => {\r\n if (key === 'onClick') {\r\n return `onclick=\"${value}\"`; // inject raw JS string\r\n }\r\n return `${key}=\"${value}\"`;\r\n })\r\n .join(' ');\r\n\r\n // Manually add the onclick attribute with a placeholder JS snippet or text\r\n const onclickAttr = 'onclick=\"console.log(\\'native click\\')\"';\r\n\r\n // Create the button element HTML string including onclick\r\n const buttonHtml = `<dda-split-button ${attributes} ${onclickAttr}></dda-split-button>`;\r\n \r\n // Add event listener after the element is created (unchanged)\r\n setTimeout(() => {\r\n const button = document.querySelector(`dda-split-button[button_id=\"${args.text_button_id}\"]`);\r\n if (button) {\r\n button.removeEventListener('buttonClick', handleButtonClick);\r\n button.addEventListener('buttonClick', handleButtonClick);\r\n }\r\n }, 0);\r\n\r\n return buttonHtml;\r\n};\r\n\r\nconst handleButtonClick = (e) => {\r\n const { event, id, value, name } = e.detail;\r\n console.log('Button clicked:', { id, value, name });\r\n console.log('Mouse event:', event);\r\n\r\n if (id === 'error-button') {\r\n alert('Hello! I am an alert box!!');\r\n } else if (id === 'console-button') {\r\n console.log('Button clicked via custom event');\r\n }\r\n};\r\n\r\nexport const DefaultPrimary = Template.bind({});\r\nDefaultPrimary.args = {\r\n text_button_type: \"button\",\r\n button_color: 'default-primary',\r\n start_icon: 'sentiment_satisfied',\r\n button_text: 'Button',\r\n text_button_id: 'default-primary-btn',\r\n aria_label: 'default primary button',\r\n text_button_name: 'defaultPrimaryButton',\r\n value: 'default-primary-value',\r\n button_shape: 'default',\r\n size: 'md',\r\n gap: 1,\r\n disabled: false,\r\n custom_class: '',\r\n component_mode: '',\r\n onclick: \"console.log('native click')\"\r\n};\r\n\r\nexport const ErrorPrimary = Template.bind({});\r\nErrorPrimary.args = {\r\n ...DefaultPrimary.args,\r\n button_color: 'error-primary',\r\n start_icon: 'sentiment_satisfied',\r\n button_text: 'Button',\r\n text_button_id: 'default-primary-btn',\r\n aria_label: 'default primary button',\r\n text_button_name: 'defaultPrimaryButton',\r\n value: 'default-primary-value',\r\n button_shape: 'default',\r\n size: 'md',\r\n gap: '1',\r\n disabled: false,\r\n custom_class: '',\r\n component_mode: '',\r\n onclick: \"console.log('native click')\"\r\n};\r\n\r\nexport const SurfacePrimary = Template.bind({});\r\nSurfacePrimary.args = {\r\n ...DefaultPrimary.args,\r\n button_color: 'onsurface-primary',\r\n start_icon: 'sentiment_satisfied',\r\n button_text: 'Button',\r\n text_button_id: 'default-primary-btn',\r\n aria_label: 'default primary button',\r\n text_button_name: 'defaultPrimaryButton',\r\n value: 'default-primary-value',\r\n button_shape: 'default',\r\n size: 'md',\r\n gap: '1',\r\n disabled: false,\r\n custom_class: '',\r\n component_mode: '',\r\n onclick: \"console.log('native click')\"\r\n};\r\n\r\nexport const Disabled = Template.bind({});\r\nDisabled.args = {\r\n ...DefaultPrimary.args,\r\n button_color: 'disabled',\r\n text_button_id: 'disabled-button',\r\n disabled: true,\r\n custom_class: '',\r\n component_mode: '',\r\n onclick: \"console.log('native click')\"\r\n};\r\n\r\nexport const IconButton = Template.bind({});\r\nIconButton.args = {\r\n text_button_type: \"button\",\r\n button_color: 'default-primary',\r\n start_icon: 'sentiment_satisfied',\r\n text_button_id: 'icon-button',\r\n aria_label: 'icon button',\r\n text_button_name: 'iconButton',\r\n value: 'icon-value',\r\n toggle_button_shape: \"default\",\r\n size: 'md',\r\n disabled: false,\r\n custom_class: '',\r\n component_mode: '',\r\n onclick: \"console.log('native click')\"\r\n};\r\n\r\nexport const IconButtonDisabled = Template.bind({});\r\nIconButtonDisabled.args = {\r\n ...IconButton.args,\r\n button_color: 'disabled',\r\n text_button_id: 'icon-button-disabled',\r\n disabled: true,\r\n custom_class: '',\r\n component_mode: '',\r\n onclick: \"console.log('native click')\"\r\n};\r\n"]}
|