@nuralyui/button 0.0.10 → 0.0.11
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/demo/{hy-buttons-demo.d.ts → nr-buttons-demo.d.ts} +3 -3
- package/demo/nr-buttons-demo.d.ts.map +1 -0
- package/demo/nr-buttons-demo.js +211 -0
- package/demo/nr-buttons-demo.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/nr-button.component.d.ts +36 -0
- package/nr-button.component.d.ts.map +1 -0
- package/{hy-button.component.js → nr-button.component.js} +45 -19
- package/nr-button.component.js.map +1 -0
- package/nr-button.style.d.ts +19 -0
- package/nr-button.style.d.ts.map +1 -0
- package/{hy-button.style.js → nr-button.style.js} +220 -20
- package/nr-button.style.js.map +1 -0
- package/{hy-button.constants.d.ts → nr-button.types.d.ts} +2 -2
- package/nr-button.types.d.ts.map +1 -0
- package/nr-button.types.js +2 -0
- package/nr-button.types.js.map +1 -0
- package/package.json +11 -3
- package/react.d.ts +2 -2
- package/react.d.ts.map +1 -1
- package/react.js +4 -4
- package/react.js.map +1 -1
- package/test/nr-button_test.d.ts +2 -0
- package/test/nr-button_test.d.ts.map +1 -0
- package/test/{hy-button_test.js → nr-button_test.js} +15 -15
- package/test/nr-button_test.js.map +1 -0
- package/demo/hy-buttons-demo.d.ts.map +0 -1
- package/demo/hy-buttons-demo.js +0 -211
- package/demo/hy-buttons-demo.js.map +0 -1
- package/hy-button.component.d.ts +0 -21
- package/hy-button.component.d.ts.map +0 -1
- package/hy-button.component.js.map +0 -1
- package/hy-button.constants.d.ts.map +0 -1
- package/hy-button.constants.js +0 -2
- package/hy-button.constants.js.map +0 -1
- package/hy-button.style.d.ts +0 -2
- package/hy-button.style.d.ts.map +0 -1
- package/hy-button.style.js.map +0 -1
- package/test/hy-button_test.d.ts +0 -2
- package/test/hy-button_test.d.ts.map +0 -1
- package/test/hy-button_test.js.map +0 -1
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
import { LitElement } from 'lit';
|
|
7
|
-
import '../
|
|
7
|
+
import '../nr-button.component';
|
|
8
8
|
import '../../../helpers/ThemeHandler';
|
|
9
9
|
export declare class ElButtonDemoElement extends LitElement {
|
|
10
10
|
render(): import("lit").TemplateResult<1>;
|
|
11
11
|
}
|
|
12
12
|
declare global {
|
|
13
13
|
interface HTMLElementTagNameMap {
|
|
14
|
-
'
|
|
14
|
+
'nr-buttons-demo': ElButtonDemoElement;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=nr-buttons-demo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nr-buttons-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/button/demo/nr-buttons-demo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAEvC,OAAO,wBAAwB,CAAC;AAChC,OAAO,+BAA+B,CAAC;AACvC,qBACa,mBAAoB,SAAQ,UAAU;IACxC,MAAM;CA6LhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,mBAAmB,CAAC;KACxC;CACF"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
import { LitElement, html } from 'lit';
|
|
13
|
+
import { customElement } from 'lit/decorators.js';
|
|
14
|
+
import '../nr-button.component';
|
|
15
|
+
import '../../../helpers/ThemeHandler';
|
|
16
|
+
let ElButtonDemoElement = class ElButtonDemoElement extends LitElement {
|
|
17
|
+
render() {
|
|
18
|
+
return html `
|
|
19
|
+
<theme-handler>
|
|
20
|
+
<h1>Sizes</h1>
|
|
21
|
+
<br />
|
|
22
|
+
<nr-button> Default Button</nr-button>
|
|
23
|
+
<nr-button size="small">Small Button</nr-button>
|
|
24
|
+
<nr-button size="large">Large Button</nr-button>
|
|
25
|
+
<br /><br />
|
|
26
|
+
<nr-button .icon="${['search']}"> Default Button</nr-button>
|
|
27
|
+
<nr-button .icon="${['search']}" size="small">Small Button</nr-button>
|
|
28
|
+
<nr-button .icon="${['search']}" size="large">Large Button</nr-button>
|
|
29
|
+
|
|
30
|
+
<br /><br />
|
|
31
|
+
<nr-button .icon="${['search']}"></nr-button>
|
|
32
|
+
<nr-button .icon="${['search']}" size="small"></nr-button>
|
|
33
|
+
<nr-button .icon="${['search']}" size="large"></nr-button>
|
|
34
|
+
<br /><br />
|
|
35
|
+
|
|
36
|
+
<h1>Types</h1>
|
|
37
|
+
<br /><br />
|
|
38
|
+
|
|
39
|
+
<table>
|
|
40
|
+
<tbody>
|
|
41
|
+
<tr>
|
|
42
|
+
<td></td>
|
|
43
|
+
<td>Primary</td>
|
|
44
|
+
<td>Secondary</td>
|
|
45
|
+
<td>Ghost</td>
|
|
46
|
+
<td>Danger</td>
|
|
47
|
+
<td>Default</td>
|
|
48
|
+
</tr>
|
|
49
|
+
<tr>
|
|
50
|
+
<td>Default</td>
|
|
51
|
+
<td>
|
|
52
|
+
<nr-button type="primary"><span>Primary Button</span></nr-button>
|
|
53
|
+
</td>
|
|
54
|
+
<td>
|
|
55
|
+
<nr-button type="secondary"><span>Secondary Button </span></nr-button>
|
|
56
|
+
</td>
|
|
57
|
+
<td>
|
|
58
|
+
<nr-button type="ghost"> <span>Ghost button</span></nr-button>
|
|
59
|
+
</td>
|
|
60
|
+
<td>
|
|
61
|
+
<nr-button type="danger"><span>Danger Button </span></nr-button>
|
|
62
|
+
</td>
|
|
63
|
+
<td>
|
|
64
|
+
<nr-button><span>Default Button</span></nr-button>
|
|
65
|
+
</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td>Dashed</td>
|
|
69
|
+
<td>
|
|
70
|
+
<nr-button type="primary" ?dashed=${true}><span>Primary Button text only</span></nr-button>
|
|
71
|
+
</td>
|
|
72
|
+
<td>
|
|
73
|
+
<nr-button type="secondary" ?dashed=${true}><span>Secondary dashed</span></nr-button>
|
|
74
|
+
</td>
|
|
75
|
+
<td>
|
|
76
|
+
<nr-button type="ghost" ?dashed=${true}><span>Ghost dashed</span></nr-button>
|
|
77
|
+
</td>
|
|
78
|
+
<td>
|
|
79
|
+
<nr-button type="danger" ?dashed=${true}><span>Danger dashed</span></nr-button>
|
|
80
|
+
</td>
|
|
81
|
+
<td>
|
|
82
|
+
<nr-button ?dashed=${true}><span>Default dashed</span></nr-button>
|
|
83
|
+
</td>
|
|
84
|
+
</tr>
|
|
85
|
+
<tr>
|
|
86
|
+
<td>Loading</td>
|
|
87
|
+
<td>
|
|
88
|
+
<nr-button type="primary" loading><span>Primary Button loading</span></nr-button>
|
|
89
|
+
</td>
|
|
90
|
+
<td>
|
|
91
|
+
<nr-button type="secondary" loading><span>Secondary button loading </span></nr-button>
|
|
92
|
+
</td>
|
|
93
|
+
<td>
|
|
94
|
+
<nr-button type="ghost" loading><span>Ghost button loading</span></nr-button>
|
|
95
|
+
</td>
|
|
96
|
+
<td>
|
|
97
|
+
<nr-button type="danger" loading><span>Danger button loading</span></nr-button>
|
|
98
|
+
</td>
|
|
99
|
+
<td>
|
|
100
|
+
<nr-button loading><span>Default button loading</span></nr-button>
|
|
101
|
+
</td>
|
|
102
|
+
</tr>
|
|
103
|
+
<tr>
|
|
104
|
+
<td>Disabled</td>
|
|
105
|
+
<td>
|
|
106
|
+
<nr-button type="primary" disabled><span>Primary Button disabled</span></nr-button>
|
|
107
|
+
</td>
|
|
108
|
+
<td>
|
|
109
|
+
<nr-button type="secondary" disabled><span>Secondary Button disabled</span></nr-button>
|
|
110
|
+
</td>
|
|
111
|
+
<td>
|
|
112
|
+
<nr-button type="ghost" disabled> <span>Ghost button disabled</span></nr-button>
|
|
113
|
+
</td>
|
|
114
|
+
<td>
|
|
115
|
+
<nr-button type="danger" disabled><span>Danger Button disabled</span></nr-button>
|
|
116
|
+
</td>
|
|
117
|
+
<td>
|
|
118
|
+
<nr-button disabled><span>Default Button disabled</span></nr-button>
|
|
119
|
+
</td>
|
|
120
|
+
</tr>
|
|
121
|
+
<tr>
|
|
122
|
+
<td>Icon with text default: icon left</td>
|
|
123
|
+
<td>
|
|
124
|
+
<nr-button type="primary" .icon="${['search']}"><span> Primary button icon+text</span></nr-button>
|
|
125
|
+
</td>
|
|
126
|
+
<td>
|
|
127
|
+
<nr-button type="secondary" .icon="${['search']}"><span> Secondary button icon+text</span></nr-button>
|
|
128
|
+
</td>
|
|
129
|
+
<td>
|
|
130
|
+
<nr-button type="ghost" .icon="${['search']}"><span> Ghost button icon+text</span></nr-button>
|
|
131
|
+
</td>
|
|
132
|
+
<td>
|
|
133
|
+
<nr-button type="danger" .icon="${['search']}"><span> Danger button icon+text</span></nr-button>
|
|
134
|
+
</td>
|
|
135
|
+
<td>
|
|
136
|
+
<nr-button .icon="${['search']}"><span> Default button icon+text</span></nr-button>
|
|
137
|
+
</td>
|
|
138
|
+
</tr>
|
|
139
|
+
<tr>
|
|
140
|
+
<td>Icon with text: icon right</td>
|
|
141
|
+
<td>
|
|
142
|
+
<nr-button type="primary" .icon="${['search']}" iconPosition="right"
|
|
143
|
+
><span> Primary button icon+text</span></nr-button
|
|
144
|
+
>
|
|
145
|
+
</td>
|
|
146
|
+
<td>
|
|
147
|
+
<nr-button type="secondary" .icon="${['search']}" iconPosition="right"
|
|
148
|
+
><span> Secondary button icon+text</span></nr-button
|
|
149
|
+
>
|
|
150
|
+
</td>
|
|
151
|
+
<td>
|
|
152
|
+
<nr-button type="ghost" .icon="${['search']}" iconPosition="right"
|
|
153
|
+
><span> Ghost button icon+text</span></nr-button
|
|
154
|
+
>
|
|
155
|
+
</td>
|
|
156
|
+
<td>
|
|
157
|
+
<nr-button type="danger" .icon="${['search']}" iconPosition="right"
|
|
158
|
+
><span> Danger button icon+text</span></nr-button
|
|
159
|
+
>
|
|
160
|
+
</td>
|
|
161
|
+
<td>
|
|
162
|
+
<nr-button .icon="${['search']}" iconPosition="right"><span> Default button icon+text</span></nr-button>
|
|
163
|
+
</td>
|
|
164
|
+
</tr>
|
|
165
|
+
<tr>
|
|
166
|
+
<td>Icon with text: icon both side</td>
|
|
167
|
+
<td>
|
|
168
|
+
<nr-button type="primary" .icon="${['search', 'bomb']}" iconPosition="right"
|
|
169
|
+
><span> Primary button icon+text</span></nr-button
|
|
170
|
+
>
|
|
171
|
+
</td>
|
|
172
|
+
<td>
|
|
173
|
+
<nr-button type="secondary" .icon="${['search', 'bomb']}" iconPosition="right"
|
|
174
|
+
><span> Secondary button icon+text</span></nr-button
|
|
175
|
+
>
|
|
176
|
+
</td>
|
|
177
|
+
<td>
|
|
178
|
+
<nr-button type="ghost" .icon="${['search', 'bomb']}" iconPosition="right"
|
|
179
|
+
><span> Ghost button icon+text</span></nr-button
|
|
180
|
+
>
|
|
181
|
+
</td>
|
|
182
|
+
<td>
|
|
183
|
+
<nr-button type="danger" .icon="${['search', 'bomb']}" iconPosition="right"
|
|
184
|
+
><span> Danger button icon+text</span></nr-button
|
|
185
|
+
>
|
|
186
|
+
</td>
|
|
187
|
+
<td>
|
|
188
|
+
<nr-button .icon="${['search', 'bomb']}" iconPosition="right"
|
|
189
|
+
><span> Default button icon+text</span></nr-button
|
|
190
|
+
>
|
|
191
|
+
</td>
|
|
192
|
+
</tr>
|
|
193
|
+
<tr>
|
|
194
|
+
<td>Icon only</td>
|
|
195
|
+
<td><nr-button type="primary" .icon="${['search']}"></nr-button></td>
|
|
196
|
+
<td><nr-button type="secondary" .icon="${['search']}"></nr-button></td>
|
|
197
|
+
<td><nr-button type="ghost" .icon="${['search']}"></nr-button></td>
|
|
198
|
+
<td><nr-button type="danger" .icon="${['search']}"></nr-button></td>
|
|
199
|
+
<td><nr-button .icon="${['search']}"></nr-button></td>
|
|
200
|
+
</tr>
|
|
201
|
+
</tbody>
|
|
202
|
+
</table>
|
|
203
|
+
</theme-handler>
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
ElButtonDemoElement = __decorate([
|
|
208
|
+
customElement('nr-buttons-demo')
|
|
209
|
+
], ElButtonDemoElement);
|
|
210
|
+
export { ElButtonDemoElement };
|
|
211
|
+
//# sourceMappingURL=nr-buttons-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nr-buttons-demo.js","sourceRoot":"","sources":["../../../../src/components/button/demo/nr-buttons-demo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,wBAAwB,CAAC;AAChC,OAAO,+BAA+B,CAAC;AAEvC,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,UAAU;IACxC,MAAM;QACb,OAAO,IAAI,CAAA;;;;;;;;4BAQa,CAAC,QAAQ,CAAC;4BACV,CAAC,QAAQ,CAAC;4BACV,CAAC,QAAQ,CAAC;;;4BAGV,CAAC,QAAQ,CAAC;4BACV,CAAC,QAAQ,CAAC;4BACV,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAqCc,IAAI;;;sDAGF,IAAI;;;kDAGR,IAAI;;;mDAGH,IAAI;;;qCAGlB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDA0CU,CAAC,QAAQ,CAAC;;;qDAGR,CAAC,QAAQ,CAAC;;;iDAGd,CAAC,QAAQ,CAAC;;;kDAGT,CAAC,QAAQ,CAAC;;;oCAGxB,CAAC,QAAQ,CAAC;;;;;;mDAMK,CAAC,QAAQ,CAAC;;;;;qDAKR,CAAC,QAAQ,CAAC;;;;;iDAKd,CAAC,QAAQ,CAAC;;;;;kDAKT,CAAC,QAAQ,CAAC;;;;;oCAKxB,CAAC,QAAQ,CAAC;;;;;;mDAMK,CAAC,QAAQ,EAAE,MAAM,CAAC;;;;;qDAKhB,CAAC,QAAQ,EAAE,MAAM,CAAC;;;;;iDAKtB,CAAC,QAAQ,EAAE,MAAM,CAAC;;;;;kDAKjB,CAAC,QAAQ,EAAE,MAAM,CAAC;;;;;oCAKhC,CAAC,QAAQ,EAAE,MAAM,CAAC;;;;;;;qDAOD,CAAC,QAAQ,CAAC;uDACR,CAAC,QAAQ,CAAC;mDACd,CAAC,QAAQ,CAAC;oDACT,CAAC,QAAQ,CAAC;sCACxB,CAAC,QAAQ,CAAC;;;;;KAK3C,CAAC;IACJ,CAAC;CACF,CAAA;AA9LY,mBAAmB;IAD/B,aAAa,CAAC,iBAAiB,CAAC;GACpB,mBAAmB,CA8L/B;SA9LY,mBAAmB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport '../nr-button.component';\nimport '../../../helpers/ThemeHandler';\n@customElement('nr-buttons-demo')\nexport class ElButtonDemoElement extends LitElement {\n override render() {\n return html`\n <theme-handler>\n <h1>Sizes</h1>\n <br />\n <nr-button> Default Button</nr-button>\n <nr-button size=\"small\">Small Button</nr-button>\n <nr-button size=\"large\">Large Button</nr-button>\n <br /><br />\n <nr-button .icon=\"${['search']}\"> Default Button</nr-button>\n <nr-button .icon=\"${['search']}\" size=\"small\">Small Button</nr-button>\n <nr-button .icon=\"${['search']}\" size=\"large\">Large Button</nr-button>\n\n <br /><br />\n <nr-button .icon=\"${['search']}\"></nr-button>\n <nr-button .icon=\"${['search']}\" size=\"small\"></nr-button>\n <nr-button .icon=\"${['search']}\" size=\"large\"></nr-button>\n <br /><br />\n\n <h1>Types</h1>\n <br /><br />\n\n <table>\n <tbody>\n <tr>\n <td></td>\n <td>Primary</td>\n <td>Secondary</td>\n <td>Ghost</td>\n <td>Danger</td>\n <td>Default</td>\n </tr>\n <tr>\n <td>Default</td>\n <td>\n <nr-button type=\"primary\"><span>Primary Button</span></nr-button>\n </td>\n <td>\n <nr-button type=\"secondary\"><span>Secondary Button </span></nr-button>\n </td>\n <td>\n <nr-button type=\"ghost\"> <span>Ghost button</span></nr-button>\n </td>\n <td>\n <nr-button type=\"danger\"><span>Danger Button </span></nr-button>\n </td>\n <td>\n <nr-button><span>Default Button</span></nr-button>\n </td>\n </tr>\n <tr>\n <td>Dashed</td>\n <td>\n <nr-button type=\"primary\" ?dashed=${true}><span>Primary Button text only</span></nr-button>\n </td>\n <td>\n <nr-button type=\"secondary\" ?dashed=${true}><span>Secondary dashed</span></nr-button>\n </td>\n <td>\n <nr-button type=\"ghost\" ?dashed=${true}><span>Ghost dashed</span></nr-button>\n </td>\n <td>\n <nr-button type=\"danger\" ?dashed=${true}><span>Danger dashed</span></nr-button>\n </td>\n <td>\n <nr-button ?dashed=${true}><span>Default dashed</span></nr-button>\n </td>\n </tr>\n <tr>\n <td>Loading</td>\n <td>\n <nr-button type=\"primary\" loading><span>Primary Button loading</span></nr-button>\n </td>\n <td>\n <nr-button type=\"secondary\" loading><span>Secondary button loading </span></nr-button>\n </td>\n <td>\n <nr-button type=\"ghost\" loading><span>Ghost button loading</span></nr-button>\n </td>\n <td>\n <nr-button type=\"danger\" loading><span>Danger button loading</span></nr-button>\n </td>\n <td>\n <nr-button loading><span>Default button loading</span></nr-button>\n </td>\n </tr>\n <tr>\n <td>Disabled</td>\n <td>\n <nr-button type=\"primary\" disabled><span>Primary Button disabled</span></nr-button>\n </td>\n <td>\n <nr-button type=\"secondary\" disabled><span>Secondary Button disabled</span></nr-button>\n </td>\n <td>\n <nr-button type=\"ghost\" disabled> <span>Ghost button disabled</span></nr-button>\n </td>\n <td>\n <nr-button type=\"danger\" disabled><span>Danger Button disabled</span></nr-button>\n </td>\n <td>\n <nr-button disabled><span>Default Button disabled</span></nr-button>\n </td>\n </tr>\n <tr>\n <td>Icon with text default: icon left</td>\n <td>\n <nr-button type=\"primary\" .icon=\"${['search']}\"><span> Primary button icon+text</span></nr-button>\n </td>\n <td>\n <nr-button type=\"secondary\" .icon=\"${['search']}\"><span> Secondary button icon+text</span></nr-button>\n </td>\n <td>\n <nr-button type=\"ghost\" .icon=\"${['search']}\"><span> Ghost button icon+text</span></nr-button>\n </td>\n <td>\n <nr-button type=\"danger\" .icon=\"${['search']}\"><span> Danger button icon+text</span></nr-button>\n </td>\n <td>\n <nr-button .icon=\"${['search']}\"><span> Default button icon+text</span></nr-button>\n </td>\n </tr>\n <tr>\n <td>Icon with text: icon right</td>\n <td>\n <nr-button type=\"primary\" .icon=\"${['search']}\" iconPosition=\"right\"\n ><span> Primary button icon+text</span></nr-button\n >\n </td>\n <td>\n <nr-button type=\"secondary\" .icon=\"${['search']}\" iconPosition=\"right\"\n ><span> Secondary button icon+text</span></nr-button\n >\n </td>\n <td>\n <nr-button type=\"ghost\" .icon=\"${['search']}\" iconPosition=\"right\"\n ><span> Ghost button icon+text</span></nr-button\n >\n </td>\n <td>\n <nr-button type=\"danger\" .icon=\"${['search']}\" iconPosition=\"right\"\n ><span> Danger button icon+text</span></nr-button\n >\n </td>\n <td>\n <nr-button .icon=\"${['search']}\" iconPosition=\"right\"><span> Default button icon+text</span></nr-button>\n </td>\n </tr>\n <tr>\n <td>Icon with text: icon both side</td>\n <td>\n <nr-button type=\"primary\" .icon=\"${['search', 'bomb']}\" iconPosition=\"right\"\n ><span> Primary button icon+text</span></nr-button\n >\n </td>\n <td>\n <nr-button type=\"secondary\" .icon=\"${['search', 'bomb']}\" iconPosition=\"right\"\n ><span> Secondary button icon+text</span></nr-button\n >\n </td>\n <td>\n <nr-button type=\"ghost\" .icon=\"${['search', 'bomb']}\" iconPosition=\"right\"\n ><span> Ghost button icon+text</span></nr-button\n >\n </td>\n <td>\n <nr-button type=\"danger\" .icon=\"${['search', 'bomb']}\" iconPosition=\"right\"\n ><span> Danger button icon+text</span></nr-button\n >\n </td>\n <td>\n <nr-button .icon=\"${['search', 'bomb']}\" iconPosition=\"right\"\n ><span> Default button icon+text</span></nr-button\n >\n </td>\n </tr>\n <tr>\n <td>Icon only</td>\n <td><nr-button type=\"primary\" .icon=\"${['search']}\"></nr-button></td>\n <td><nr-button type=\"secondary\" .icon=\"${['search']}\"></nr-button></td>\n <td><nr-button type=\"ghost\" .icon=\"${['search']}\"></nr-button></td>\n <td><nr-button type=\"danger\" .icon=\"${['search']}\"></nr-button></td>\n <td><nr-button .icon=\"${['search']}\"></nr-button></td>\n </tr>\n </tbody>\n </table>\n </theme-handler>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nr-buttons-demo': ElButtonDemoElement;\n }\n}\n"]}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './nr-button.component.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './nr-button.component.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './nr-button.component.js';\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { LitElement } from 'lit';
|
|
7
|
+
import { ButtonType, IconPosition } from './nr-button.types.js';
|
|
8
|
+
declare const NrButtonElement_base: (new (...args: any[]) => import("../../shared/dependency-mixin.js").DependencyAware) & (new (...args: any[]) => import("../../shared/theme-mixin.js").ThemeAware) & typeof LitElement;
|
|
9
|
+
export declare class NrButtonElement extends NrButtonElement_base {
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
size: string;
|
|
13
|
+
type: ButtonType;
|
|
14
|
+
dashed: boolean;
|
|
15
|
+
icon: string[];
|
|
16
|
+
iconPosition: IconPosition;
|
|
17
|
+
/**
|
|
18
|
+
* Required components that must be registered for this component to work properly
|
|
19
|
+
* Can be overridden by parent implementations
|
|
20
|
+
*/
|
|
21
|
+
requiredComponents: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Check for required dependencies when component is connected to DOM
|
|
24
|
+
*/
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Renders an icon if the hy-icon component is available
|
|
28
|
+
* @param iconName - The name of the icon to render
|
|
29
|
+
* @returns TemplateResult or nothing
|
|
30
|
+
*/
|
|
31
|
+
private renderIcon;
|
|
32
|
+
render(): import("lit").TemplateResult<1>;
|
|
33
|
+
static styles: import("lit").CSSResult[];
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=nr-button.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nr-button.component.d.ts","sourceRoot":"","sources":["../../../src/components/button/nr-button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,UAAU,EAAW,MAAM,KAAK,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAgB,YAAY,EAAE,MAAM,sBAAsB,CAAC;;AAI9E,qBACa,eAAgB,SAAQ,oBAA6B;IAEhE,QAAQ,UAAS;IAGjB,OAAO,UAAS;IAGhB,IAAI,SAAgB;IAGpB,IAAI,EAAE,UAAU,CAAsB;IAGtC,MAAM,UAAS;IAGf,IAAI,EAAE,MAAM,EAAE,CAAM;IAGpB,YAAY,eAAqB;IAEjC;;;OAGG;IACM,kBAAkB,WAAe;IAE1C;;OAEG;IACM,iBAAiB;IAK1B;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAWT,MAAM;IAkBf,OAAgB,MAAM,4BAAU;CACjC"}
|
|
@@ -11,10 +11,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
11
11
|
};
|
|
12
12
|
import { html, LitElement, nothing } from 'lit';
|
|
13
13
|
import { customElement, property } from 'lit/decorators.js';
|
|
14
|
-
import { EMPTY_STRING } from './
|
|
15
|
-
import { styles } from './
|
|
16
|
-
import {
|
|
17
|
-
let
|
|
14
|
+
import { EMPTY_STRING } from './nr-button.types.js';
|
|
15
|
+
import { styles } from './nr-button.style.js';
|
|
16
|
+
import { NuralyUIBaseMixin } from '../../shared/base-mixin.js';
|
|
17
|
+
let NrButtonElement = class NrButtonElement extends NuralyUIBaseMixin(LitElement) {
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
20
|
this.disabled = false;
|
|
@@ -22,7 +22,33 @@ let HyButtonElement = class HyButtonElement extends ThemeAwareMixin(LitElement)
|
|
|
22
22
|
this.size = EMPTY_STRING;
|
|
23
23
|
this.type = "default" /* ButtonType.Default */;
|
|
24
24
|
this.dashed = false;
|
|
25
|
+
this.icon = [];
|
|
25
26
|
this.iconPosition = "left" /* IconPosition.Left */;
|
|
27
|
+
/**
|
|
28
|
+
* Required components that must be registered for this component to work properly
|
|
29
|
+
* Can be overridden by parent implementations
|
|
30
|
+
*/
|
|
31
|
+
this.requiredComponents = ['hy-icon'];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Check for required dependencies when component is connected to DOM
|
|
35
|
+
*/
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
this.validateDependencies();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Renders an icon if the hy-icon component is available
|
|
42
|
+
* @param iconName - The name of the icon to render
|
|
43
|
+
* @returns TemplateResult or nothing
|
|
44
|
+
*/
|
|
45
|
+
renderIcon(iconName) {
|
|
46
|
+
if (!this.isComponentAvailable('hy-icon')) {
|
|
47
|
+
console.warn(`hy-icon component not found. Icon "${iconName}" will not be displayed. ` +
|
|
48
|
+
`Please import hy-icon component.`);
|
|
49
|
+
return nothing;
|
|
50
|
+
}
|
|
51
|
+
return html `<hy-icon name=${iconName}></hy-icon>`;
|
|
26
52
|
}
|
|
27
53
|
render() {
|
|
28
54
|
var _a, _b;
|
|
@@ -36,38 +62,38 @@ let HyButtonElement = class HyButtonElement extends ThemeAwareMixin(LitElement)
|
|
|
36
62
|
class="${this.dashed ? 'button-dashed' : ''}"
|
|
37
63
|
>
|
|
38
64
|
<span id="container">
|
|
39
|
-
${((_a = this.icon) === null || _a === void 0 ? void 0 : _a.length) ?
|
|
65
|
+
${((_a = this.icon) === null || _a === void 0 ? void 0 : _a.length) ? this.renderIcon(this.icon[0]) : nothing}
|
|
40
66
|
<slot id="slot"></slot>
|
|
41
|
-
${((_b = this.icon) === null || _b === void 0 ? void 0 : _b.length) == 2 ?
|
|
67
|
+
${((_b = this.icon) === null || _b === void 0 ? void 0 : _b.length) == 2 ? this.renderIcon(this.icon[1]) : nothing}
|
|
42
68
|
</span>
|
|
43
69
|
</button>
|
|
44
70
|
`;
|
|
45
71
|
}
|
|
46
72
|
};
|
|
47
|
-
|
|
73
|
+
NrButtonElement.styles = styles;
|
|
48
74
|
__decorate([
|
|
49
75
|
property({ type: Boolean })
|
|
50
|
-
],
|
|
76
|
+
], NrButtonElement.prototype, "disabled", void 0);
|
|
51
77
|
__decorate([
|
|
52
78
|
property({ type: Boolean })
|
|
53
|
-
],
|
|
79
|
+
], NrButtonElement.prototype, "loading", void 0);
|
|
54
80
|
__decorate([
|
|
55
81
|
property({ type: String })
|
|
56
|
-
],
|
|
82
|
+
], NrButtonElement.prototype, "size", void 0);
|
|
57
83
|
__decorate([
|
|
58
84
|
property({ type: String })
|
|
59
|
-
],
|
|
85
|
+
], NrButtonElement.prototype, "type", void 0);
|
|
60
86
|
__decorate([
|
|
61
87
|
property({ type: Boolean })
|
|
62
|
-
],
|
|
88
|
+
], NrButtonElement.prototype, "dashed", void 0);
|
|
63
89
|
__decorate([
|
|
64
90
|
property({ type: Array })
|
|
65
|
-
],
|
|
91
|
+
], NrButtonElement.prototype, "icon", void 0);
|
|
66
92
|
__decorate([
|
|
67
93
|
property({ reflect: true })
|
|
68
|
-
],
|
|
69
|
-
|
|
70
|
-
customElement('
|
|
71
|
-
],
|
|
72
|
-
export {
|
|
73
|
-
//# sourceMappingURL=
|
|
94
|
+
], NrButtonElement.prototype, "iconPosition", void 0);
|
|
95
|
+
NrButtonElement = __decorate([
|
|
96
|
+
customElement('nr-button')
|
|
97
|
+
], NrButtonElement);
|
|
98
|
+
export { NrButtonElement };
|
|
99
|
+
//# sourceMappingURL=nr-button.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nr-button.component.js","sourceRoot":"","sources":["../../../src/components/button/nr-button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAc,YAAY,EAAgB,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAAlE;;QAEE,aAAQ,GAAG,KAAK,CAAC;QAGjB,YAAO,GAAG,KAAK,CAAC;QAGhB,SAAI,GAAG,YAAY,CAAC;QAGpB,SAAI,sCAAkC;QAGtC,WAAM,GAAG,KAAK,CAAC;QAGf,SAAI,GAAa,EAAE,CAAC;QAGpB,iBAAY,kCAAqB;QAEjC;;;WAGG;QACM,uBAAkB,GAAG,CAAC,SAAS,CAAC,CAAC;IA6C5C,CAAC;IA3CC;;OAEG;IACM,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACK,UAAU,CAAC,QAAgB;QACjC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE;YACzC,OAAO,CAAC,IAAI,CACV,sCAAsC,QAAQ,2BAA2B;gBACzE,kCAAkC,CACnC,CAAC;YACF,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,IAAI,CAAA,iBAAiB,QAAQ,aAAa,CAAC;IACpD,CAAC;IAEQ,MAAM;;QACb,OAAO,IAAI,CAAA;;qBAEM,IAAI,CAAC,QAAQ;qBACb,IAAI,CAAC,IAAI;oBACV,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;sBAC7B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;sBAClC,IAAI,CAAC,YAAY;iBACtB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE;;;YAGvC,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,EAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;;YAE3D,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,KAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;;;KAGvE,CAAC;IACJ,CAAC;CAEF,CAAA;AADiB,sBAAM,GAAG,MAAO,CAAA;AApEhC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDACT;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;gDACV;AAGhB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACL;AAGpB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACa;AAGtC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;+CACX;AAGf;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;6CACJ;AAGpB;IADC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;qDACO;AApBtB,eAAe;IAD3B,aAAa,CAAC,WAAW,CAAC;GACd,eAAe,CAuE3B;SAvEY,eAAe","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ButtonType, EMPTY_STRING, IconPosition } from './nr-button.types.js';\nimport { styles } from './nr-button.style.js';\nimport { NuralyUIBaseMixin } from '../../shared/base-mixin.js';\n\n@customElement('nr-button')\nexport class NrButtonElement extends NuralyUIBaseMixin(LitElement) {\n @property({type: Boolean})\n disabled = false;\n\n @property({type: Boolean})\n loading = false;\n\n @property({type: String})\n size = EMPTY_STRING;\n\n @property({type: String})\n type: ButtonType = ButtonType.Default;\n\n @property({type: Boolean})\n dashed = false;\n\n @property({type: Array})\n icon: string[] = [];\n\n @property({reflect: true})\n iconPosition = IconPosition.Left;\n\n /**\n * Required components that must be registered for this component to work properly\n * Can be overridden by parent implementations\n */\n override requiredComponents = ['hy-icon'];\n\n /**\n * Check for required dependencies when component is connected to DOM\n */\n override connectedCallback() {\n super.connectedCallback();\n this.validateDependencies();\n }\n\n /**\n * Renders an icon if the hy-icon component is available\n * @param iconName - The name of the icon to render\n * @returns TemplateResult or nothing\n */\n private renderIcon(iconName: string) {\n if (!this.isComponentAvailable('hy-icon')) {\n console.warn(\n `hy-icon component not found. Icon \"${iconName}\" will not be displayed. ` +\n `Please import hy-icon component.`\n );\n return nothing;\n }\n return html`<hy-icon name=${iconName}></hy-icon>`;\n }\n\n override render() {\n return html`\n <button\n ?disabled=\"${this.disabled}\"\n data-type=\"${this.type}\"\n data-size=${this.size ? this.size : nothing}\n data-state=\"${this.loading ? 'loading' : nothing}\"\n data-theme=\"${this.currentTheme}\"\n class=\"${this.dashed ? 'button-dashed' : ''}\"\n >\n <span id=\"container\">\n ${this.icon?.length ? this.renderIcon(this.icon[0]) : nothing}\n <slot id=\"slot\"></slot>\n ${this.icon?.length == 2 ? this.renderIcon(this.icon[1]) : nothing}\n </span>\n </button>\n `;\n }\n static override styles = styles;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exported styles for the nr-button component
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* This export provides the complete styling system for the button component,
|
|
6
|
+
* including all variants, states, sizes, and theme support.
|
|
7
|
+
*
|
|
8
|
+
* @usage
|
|
9
|
+
* Import and use in the component's styles property:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { styles } from './nr-button.style.ts';
|
|
12
|
+
*
|
|
13
|
+
* @Component({
|
|
14
|
+
* styles: styles
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const styles: import("lit").CSSResult[];
|
|
19
|
+
//# sourceMappingURL=nr-button.style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nr-button.style.d.ts","sourceRoot":"","sources":["../../../src/components/button/nr-button.style.ts"],"names":[],"mappings":"AA2jBA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM,2BAAiB,CAAC"}
|