noph-ui 0.20.0 → 0.21.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.
@@ -81,7 +81,7 @@
81
81
  class={[
82
82
  'np-button',
83
83
  size,
84
- selected ? 'square' : shape,
84
+ selected || loading ? 'square' : shape,
85
85
  toggle ? 'toggle' : '',
86
86
  selected ? 'selected' : '',
87
87
  loading ? 'np-loading' : '',
@@ -346,7 +346,7 @@
346
346
  .outlined {
347
347
  background-color: var(--np-outlined-button-container-color, transparent);
348
348
  outline-style: solid;
349
- outline-color: var(--np-outlined-button-outline-color, var(--np-color-outline));
349
+ outline-color: var(--np-outlined-button-outline-color, var(--np-color-outline-variant));
350
350
  outline-width: 1px;
351
351
  outline-offset: -1px;
352
352
  --np-ripple-hover-color: var(--np-outlined-button-label-text-color, var(--np-color-primary));
@@ -21,6 +21,9 @@
21
21
  selected = $bindable(false),
22
22
  selectedIcon,
23
23
  keepTooltipOnClick,
24
+ width = 'default',
25
+ size = 's',
26
+ shape = 'round',
24
27
  onclick,
25
28
  ...attributes
26
29
  }: IconButtonProps = $props()
@@ -69,9 +72,12 @@
69
72
  }}
70
73
  class={[
71
74
  'np-icon-button',
75
+ size,
76
+ width,
77
+ selected || loading ? 'square' : shape,
72
78
  disabled || loading ? `${variant}-disabled disabled` : `${variant} enabled`,
73
79
  toggle && 'toggle',
74
- (selected || (variant !== 'outlined' && variant !== 'text' && !toggle)) && 'selected',
80
+ selected ? 'selected' : '',
75
81
  attributes.class,
76
82
  ]}
77
83
  >
@@ -85,9 +91,12 @@
85
91
  bind:this={element}
86
92
  class={[
87
93
  'np-icon-button',
94
+ size,
95
+ width,
88
96
  variant,
97
+ selected || loading ? 'square' : shape,
89
98
  'enabled',
90
- (selected || (variant !== 'outlined' && variant !== 'text' && !toggle)) && 'selected',
99
+ selected ? 'selected' : '',
91
100
  attributes.class,
92
101
  ]}
93
102
  >
@@ -114,14 +123,129 @@
114
123
  text-decoration: none;
115
124
  align-items: center;
116
125
  justify-content: center;
126
+ --np-icon-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
127
+ transition:
128
+ background-color 150ms linear,
129
+ border-radius 150ms ease-in-out;
117
130
  }
118
131
 
119
132
  :global(.np-icon-button svg) {
120
- width: var(--_icon-size, 1.5rem);
121
- height: var(--_icon-size, 1.5rem);
122
133
  fill: currentColor;
123
- display: block;
124
134
  }
135
+
136
+ .xs {
137
+ --_icon-size: var(--np-icon-button-icon-size, 1.25rem);
138
+ height: 2rem;
139
+ width: 2rem;
140
+ --np-circular-progress-size: 1.75rem;
141
+ }
142
+ .xs.round {
143
+ border-radius: 1rem;
144
+ }
145
+ .xs.square {
146
+ border-radius: var(--np-icon-button-shape, 0.75rem);
147
+ }
148
+ .xs:active {
149
+ border-radius: 0.5rem;
150
+ }
151
+ .xs.narrow {
152
+ width: 1.75rem;
153
+ }
154
+ .xs.wide {
155
+ width: 2.5rem;
156
+ }
157
+ .s {
158
+ --_icon-size: var(--np-icon-button-icon-size, 1.5rem);
159
+ height: 2.5rem;
160
+ width: 2.5rem;
161
+ --np-circular-progress-size: 2rem;
162
+ }
163
+ .s.round {
164
+ border-radius: 1.25rem;
165
+ }
166
+ .s.square {
167
+ border-radius: var(--np-button-shape, 0.75rem);
168
+ }
169
+ .s.narrow {
170
+ width: 2rem;
171
+ }
172
+ .s.wide {
173
+ width: 3.25rem;
174
+ }
175
+ .s:active {
176
+ border-radius: 0.5rem;
177
+ }
178
+ .m {
179
+ --_icon-size: var(--np-icon-button-icon-size, 1.5rem);
180
+ height: 3.5rem;
181
+ width: 3.5rem;
182
+ --np-circular-progress-size: 3rem;
183
+ }
184
+ .m.round {
185
+ border-radius: 1.75rem;
186
+ }
187
+ .m.square {
188
+ border-radius: var(--np-button-shape, 1rem);
189
+ }
190
+ .m.narrow {
191
+ width: 3rem;
192
+ }
193
+ .m.wide {
194
+ width: 4.5rem;
195
+ }
196
+ .m:active {
197
+ border-radius: 0.75rem;
198
+ }
199
+ .l {
200
+ --_icon-size: var(--np-icon-button-icon-size, 2rem);
201
+ height: 6rem;
202
+ width: 6rem;
203
+ --np-circular-progress-size: 5rem;
204
+ }
205
+ .l.round {
206
+ border-radius: 3rem;
207
+ }
208
+ .l.square {
209
+ border-radius: var(--np-button-shape, 1.75rem);
210
+ }
211
+ .l.narrow {
212
+ width: 4rem;
213
+ }
214
+ .l.wide {
215
+ width: 8rem;
216
+ }
217
+ .l:active {
218
+ border-radius: 1rem;
219
+ }
220
+ .xl {
221
+ --_icon-size: var(--np-icon-button-icon-size, 2.5rem);
222
+ height: 8.5rem;
223
+ width: 8.5rem;
224
+ --np-circular-progress-size: 7rem;
225
+ }
226
+ .xl.round {
227
+ border-radius: 4.25rem;
228
+ }
229
+ .xl.square {
230
+ border-radius: var(--np-button-shape, 1.75rem);
231
+ }
232
+ .xl.narrow {
233
+ width: 6.5rem;
234
+ }
235
+ .xl.wide {
236
+ width: 11.5rem;
237
+ }
238
+ .xl:active {
239
+ border-radius: 1rem;
240
+ }
241
+
242
+ .toggle {
243
+ --np-icon-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
244
+ }
245
+ .selected {
246
+ --np-icon-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
247
+ }
248
+
125
249
  .disabled {
126
250
  pointer-events: none;
127
251
  color: color-mix(in srgb, var(--np-color-on-surface) 38%, transparent);
@@ -130,37 +254,12 @@
130
254
  .tonal-disabled {
131
255
  background-color: color-mix(in srgb, var(--np-color-on-surface) 12%, transparent);
132
256
  }
133
- .text-disabled {
134
- border-radius: var(--np-icon-button-container-shape, var(--np-shape-corner-full));
135
- --_button-height: var(--np-icon-button-container-height, 2.5rem);
136
- --_button-width: var(--np-icon-button-container-width, 2.5rem);
137
- height: var(--_button-height);
138
- width: var(--_button-width);
139
- --_icon-size: var(--np-icon-button-icon-size);
140
- }
141
- .filled-disabled {
142
- border-radius: var(--np-filled-icon-button-container-shape, var(--np-shape-corner-full));
143
- height: var(--np-filled-icon-button-container-height, 2.5rem);
144
- width: var(--np-filled-icon-button-container-width, 2.5rem);
145
- --_icon-size: var(--np-filled-icon-button-icon-size);
146
- }
147
- .tonal-disabled {
148
- border-radius: var(--np-tonal-icon-button-container-shape, var(--np-shape-corner-full));
149
- height: var(--np-tonal-icon-button-container-height, 2.5rem);
150
- width: var(--np-tonal-icon-button-container-width, 2.5rem);
151
- --_icon-size: var(--np-tonal-icon-button-icon-size);
152
- }
153
257
 
154
258
  .outlined-disabled {
155
- border: 1px solid;
156
- border-color: color-mix(in srgb, var(--np-color-on-surface) 12%, transparent);
157
- border-radius: var(--np-outlined-icon-button-container-shape, var(--np-shape-corner-full));
158
- height: var(--np-outlined-icon-button-container-height, 2.5rem);
159
- width: var(--np-outlined-icon-button-container-width, 2.5rem);
160
- --_icon-size: var(--np-outlined-icon-button-icon-size);
161
- }
162
- .enabled {
163
- transition: background-color 0.3s ease;
259
+ outline-style: solid;
260
+ outline-color: color-mix(in srgb, var(--np-color-on-surface) 12%, transparent);
261
+ outline-width: 1px;
262
+ outline-offset: -1px;
164
263
  }
165
264
  .enabled:focus-visible {
166
265
  outline-style: solid;
@@ -184,81 +283,70 @@
184
283
  --np-ripple-hover-color: var(--np-icon-button-icon-color, var(--np-color-on-surface-variant));
185
284
  --np-ripple-pressed-color: var(--np-icon-button-icon-color, var(--np-color-on-surface-variant));
186
285
  color: var(--np-icon-button-icon-color, var(--np-color-on-surface-variant));
187
- border-radius: var(--np-icon-button-container-shape, var(--np-shape-corner-full));
188
- --_button-height: var(--np-icon-button-container-height, 2.5rem);
189
- --_button-width: var(--np-icon-button-container-width, 2.5rem);
190
- height: var(--_button-height);
191
- width: var(--_button-width);
192
- --_icon-size: var(--np-icon-button-icon-size);
193
- }
194
- .text.toggle {
195
- --np-ripple-hover-color: var(--np-color-on-surface-variant);
196
- --np-ripple-pressed-color: var(--np-color-on-surface-variant);
197
- color: var(--np-color-on-surface-variant);
198
286
  }
199
287
  .text.selected {
200
- --np-ripple-hover-color: var(--np-icon-button-icon-color, var(--np-color-primary));
201
- --np-ripple-pressed-color: var(--np-icon-button-icon-color, var(--np-color-primary));
202
- color: var(--np-icon-button-icon-color, var(--np-color-primary));
288
+ --np-ripple-hover-color: var(--np-color-primary);
289
+ --np-ripple-pressed-color: var(--np-color-primary);
290
+ color: var(--np-color-primary);
203
291
  }
204
292
  .filled {
205
- transition: background-color 150ms linear;
206
- --np-ripple-hover-color: var(--np-filled-icon-button-container-color, var(--np-color-primary));
207
- --np-ripple-pressed-color: var(
208
- --np-filled-icon-button-container-color,
209
- var(--np-color-primary)
210
- );
211
- color: var(--np-filled-icon-button-container-color, var(--np-color-primary));
212
- background-color: var(--np-color-surface-container-highest);
213
- border-radius: var(--np-filled-icon-button-container-shape, var(--np-shape-corner-full));
214
- height: var(--np-filled-icon-button-container-height, 2.5rem);
215
- width: var(--np-filled-icon-button-container-width, 2.5rem);
216
- --_icon-size: var(--np-filled-icon-button-icon-size);
217
- }
218
- .filled.selected {
219
- --np-ripple-hover-opacity: 0.12;
220
- --np-ripple-hover-color: var(--np-color-surface);
221
- --np-ripple-pressed-color: var(--np-color-surface);
293
+ --np-ripple-hover-color: var(--np-filled-icon-button-icon-color, var(--np-color-on-primary));
294
+ --np-ripple-pressed-color: var(--np-filled-icon-button-icon-color, var(--np-color-on-primary));
222
295
  color: var(--np-filled-icon-button-icon-color, var(--np-color-on-primary));
223
296
  background-color: var(--np-filled-icon-button-container-color, var(--np-color-primary));
224
297
  }
225
-
226
- .tonal {
227
- transition: background-color 150ms linear;
228
- border-radius: var(--np-tonal-icon-button-container-shape, var(--np-shape-corner-full));
298
+ .filled.toggle {
229
299
  --np-ripple-hover-color: var(--np-color-on-surface-variant);
230
300
  --np-ripple-pressed-color: var(--np-color-on-surface-variant);
231
301
  color: var(--np-color-on-surface-variant);
232
- background-color: var(--np-color-surface-container-highest);
233
- height: var(--np-tonal-icon-button-container-height, 2.5rem);
234
- width: var(--np-tonal-icon-button-container-width, 2.5rem);
235
- --_icon-size: var(--np-tonal-icon-button-icon-size);
302
+ background-color: var(--np-color-surface-container);
236
303
  }
237
- .tonal.selected {
238
- --np-ripple-hover-color: var(--np-tonal-icon-button-icon-color, var(--np-color-primary));
239
- --np-ripple-pressed-color: var(--np-tonal-icon-button-icon-color, var(--np-color-primary));
304
+ .filled.selected {
305
+ --np-ripple-hover-color: var(--np-color-on-primary);
306
+ --np-ripple-pressed-color: var(--np-color-on-primary);
307
+ color: var(--np-color-on-primary);
308
+ background-color: var(--np-color-primary);
309
+ }
310
+
311
+ .tonal {
312
+ --np-ripple-hover-color: var(
313
+ --np-tonal-icon-button-icon-color,
314
+ var(--np-color-on-secondary-container)
315
+ );
316
+ --np-ripple-pressed-color: var(
317
+ --np-tonal-icon-button-icon-color,
318
+ var(--np-color-on-secondary-container)
319
+ );
240
320
  color: var(--np-tonal-icon-button-icon-color, var(--np-color-on-secondary-container));
241
321
  background-color: var(
242
322
  --np-tonal-icon-button-container-color,
243
323
  var(--np-color-secondary-container)
244
324
  );
245
325
  }
326
+ .tonal.toggle {
327
+ --np-ripple-hover-color: var(--np-color-on-secondary-container);
328
+ --np-ripple-pressed-color: var(--np-color-on-secondary-container);
329
+ color: var(--np-color-on-secondary-container);
330
+ background-color: var(--np-color-secondary-container);
331
+ }
332
+ .tonal.selected {
333
+ --np-ripple-hover-color: var(--np-color-on-secondary);
334
+ --np-ripple-pressed-color: var(--np-color-on-secondary);
335
+ color: var(--np-color-on-secondary);
336
+ background-color: var(--np-color-secondary);
337
+ }
246
338
 
247
339
  .outlined {
248
- border: 1px solid;
249
- border-style: solid;
250
- border-width: var(--np-outlined-icon-button-outline-width, 1px);
340
+ outline-style: solid;
341
+ outline-color: var(--np-outlined-icon-button-outline-color, var(--np-color-outline-variant));
342
+ outline-width: 1px;
343
+ outline-offset: -1px;
251
344
  --np-ripple-hover-color: var(--np-color-on-surface-variant);
252
345
  --np-ripple-pressed-color: var(--np-color-on-surface-variant);
253
346
  color: var(--np-color-on-surface-variant);
254
- border-color: var(--np-outlined-icon-button-outline-color, var(--np-color-outline));
255
- border-radius: var(--np-outlined-icon-button-container-shape, var(--np-shape-corner-full));
256
- height: var(--np-outlined-icon-button-container-height, 2.5rem);
257
- width: var(--np-outlined-icon-button-container-width, 2.5rem);
258
- --_icon-size: var(--np-outlined-icon-button-icon-size);
259
347
  }
260
348
  .outlined.selected {
261
- border: none;
349
+ outline-style: none;
262
350
  --np-ripple-hover-color: var(--np-color-on-surface-variant);
263
351
  --np-ripple-pressed-color: var(--np-color-on-surface-variant);
264
352
  color: var(--np-color-inverse-on-surface);
@@ -271,7 +359,6 @@
271
359
  }
272
360
 
273
361
  .circular-progress {
274
- --np-circular-progress-size: calc(var(--button-height) * 0.75);
275
362
  --np-circular-progress-color: color-mix(in srgb, var(--np-color-on-surface) 38%, transparent);
276
363
  position: absolute;
277
364
  }
@@ -37,6 +37,9 @@ interface IconButtonButtonProps extends HTMLButtonAttributes {
37
37
  loadingAriaLabel?: string;
38
38
  keepTooltipOnClick?: boolean;
39
39
  selectedIcon?: Snippet;
40
+ shape?: 'round' | 'square';
41
+ size?: 'xs' | 's' | 'm' | 'l' | 'xl';
42
+ width?: 'narrow' | 'wide' | 'default';
40
43
  }
41
44
  interface IconButtonAnchorProps extends HTMLAnchorAttributes {
42
45
  variant?: 'text' | 'filled' | 'outlined' | 'tonal';
@@ -48,6 +51,9 @@ interface IconButtonAnchorProps extends HTMLAnchorAttributes {
48
51
  selected?: boolean;
49
52
  keepTooltipOnClick?: boolean;
50
53
  selectedIcon?: Snippet;
54
+ shape?: 'round' | 'square';
55
+ size?: 'xs' | 's' | 'm' | 'l' | 'xl';
56
+ width?: 'narrow' | 'wide' | 'default';
51
57
  }
52
58
  export type IconButtonProps = IconButtonButtonProps | IconButtonAnchorProps;
53
59
  export type ButtonProps = ButtonButtonProps | ButtonAnchorProps;
@@ -15,7 +15,7 @@
15
15
  font-family: 'Material Symbols Outlined';
16
16
  font-weight: normal;
17
17
  font-style: normal;
18
- font-size: var(--np-icon-size, 1.5rem);
18
+ font-size: var(--np-icon-size, var(--_icon-size, 1.5rem));
19
19
  line-height: 1;
20
20
  letter-spacing: normal;
21
21
  text-transform: none;
@@ -37,7 +37,6 @@
37
37
  display: inline-flex;
38
38
  fill: currentColor;
39
39
  color: var(--_icon-color);
40
- font-size: var(--np-icon-size, var(--_icon-size));
41
40
  inline-size: var(--np-icon-size, var(--_icon-size));
42
41
  block-size: var(--np-icon-size, var(--_icon-size));
43
42
  flex-shrink: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {