@14ch/svelte-ui 0.0.1

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 (109) hide show
  1. package/README.md +359 -0
  2. package/dist/assets/styles/README.md +144 -0
  3. package/dist/assets/styles/core.scss +61 -0
  4. package/dist/assets/styles/import.scss +11 -0
  5. package/dist/assets/styles/optional/fonts.scss +23 -0
  6. package/dist/assets/styles/optional/reset.scss +230 -0
  7. package/dist/assets/styles/variables.scss +805 -0
  8. package/dist/components/Button.svelte +574 -0
  9. package/dist/components/Button.svelte.d.ts +56 -0
  10. package/dist/components/COMPONENT_DESIGN_GUIDELINES.md +127 -0
  11. package/dist/components/Checkbox.svelte +523 -0
  12. package/dist/components/Checkbox.svelte.d.ts +42 -0
  13. package/dist/components/CheckboxGroup.svelte +82 -0
  14. package/dist/components/CheckboxGroup.svelte.d.ts +13 -0
  15. package/dist/components/ColorPicker.svelte +496 -0
  16. package/dist/components/ColorPicker.svelte.d.ts +45 -0
  17. package/dist/components/Combobox.svelte +576 -0
  18. package/dist/components/Combobox.svelte.d.ts +52 -0
  19. package/dist/components/ConfirmDialog.svelte +116 -0
  20. package/dist/components/ConfirmDialog.svelte.d.ts +20 -0
  21. package/dist/components/Datepicker.svelte +578 -0
  22. package/dist/components/Datepicker.svelte.d.ts +72 -0
  23. package/dist/components/DatepickerCalendar.svelte +925 -0
  24. package/dist/components/DatepickerCalendar.svelte.d.ts +31 -0
  25. package/dist/components/Dialog.svelte +245 -0
  26. package/dist/components/Dialog.svelte.d.ts +38 -0
  27. package/dist/components/Drawer.svelte +383 -0
  28. package/dist/components/Drawer.svelte.d.ts +39 -0
  29. package/dist/components/Fab.svelte +486 -0
  30. package/dist/components/Fab.svelte.d.ts +51 -0
  31. package/dist/components/FileUploader.svelte +456 -0
  32. package/dist/components/FileUploader.svelte.d.ts +36 -0
  33. package/dist/components/Icon.svelte +167 -0
  34. package/dist/components/Icon.svelte.d.ts +21 -0
  35. package/dist/components/IconButton.svelte +557 -0
  36. package/dist/components/IconButton.svelte.d.ts +60 -0
  37. package/dist/components/ImageUploader.svelte +516 -0
  38. package/dist/components/ImageUploader.svelte.d.ts +37 -0
  39. package/dist/components/ImageUploaderPreview.svelte +157 -0
  40. package/dist/components/ImageUploaderPreview.svelte.d.ts +13 -0
  41. package/dist/components/Input.svelte +885 -0
  42. package/dist/components/Input.svelte.d.ts +75 -0
  43. package/dist/components/LoadingSpinner.svelte +116 -0
  44. package/dist/components/LoadingSpinner.svelte.d.ts +10 -0
  45. package/dist/components/Modal.svelte +313 -0
  46. package/dist/components/Modal.svelte.d.ts +34 -0
  47. package/dist/components/Pagination.svelte +276 -0
  48. package/dist/components/Pagination.svelte.d.ts +14 -0
  49. package/dist/components/Popup.svelte +676 -0
  50. package/dist/components/Popup.svelte.d.ts +40 -0
  51. package/dist/components/PopupMenu.svelte +421 -0
  52. package/dist/components/PopupMenu.svelte.d.ts +24 -0
  53. package/dist/components/PopupMenuButton.svelte +365 -0
  54. package/dist/components/PopupMenuButton.svelte.d.ts +42 -0
  55. package/dist/components/Radio.svelte +548 -0
  56. package/dist/components/Radio.svelte.d.ts +42 -0
  57. package/dist/components/RadioGroup.svelte +74 -0
  58. package/dist/components/RadioGroup.svelte.d.ts +14 -0
  59. package/dist/components/Select.svelte +479 -0
  60. package/dist/components/Select.svelte.d.ts +47 -0
  61. package/dist/components/Slider.svelte +473 -0
  62. package/dist/components/Slider.svelte.d.ts +46 -0
  63. package/dist/components/Snackbar.svelte +124 -0
  64. package/dist/components/Snackbar.svelte.d.ts +9 -0
  65. package/dist/components/SnackbarItem.svelte +423 -0
  66. package/dist/components/SnackbarItem.svelte.d.ts +21 -0
  67. package/dist/components/Switch.svelte +454 -0
  68. package/dist/components/Switch.svelte.d.ts +40 -0
  69. package/dist/components/Tab.svelte +193 -0
  70. package/dist/components/Tab.svelte.d.ts +14 -0
  71. package/dist/components/TabItem.svelte +140 -0
  72. package/dist/components/TabItem.svelte.d.ts +17 -0
  73. package/dist/components/Textarea.svelte +702 -0
  74. package/dist/components/Textarea.svelte.d.ts +64 -0
  75. package/dist/components/skeleton/Skeleton.svelte +235 -0
  76. package/dist/components/skeleton/Skeleton.svelte.d.ts +13 -0
  77. package/dist/components/skeleton/SkeletonAvatar.svelte +97 -0
  78. package/dist/components/skeleton/SkeletonAvatar.svelte.d.ts +8 -0
  79. package/dist/components/skeleton/SkeletonBox.svelte +105 -0
  80. package/dist/components/skeleton/SkeletonBox.svelte.d.ts +12 -0
  81. package/dist/components/skeleton/SkeletonButton.svelte +71 -0
  82. package/dist/components/skeleton/SkeletonButton.svelte.d.ts +8 -0
  83. package/dist/components/skeleton/SkeletonHeading.svelte +49 -0
  84. package/dist/components/skeleton/SkeletonHeading.svelte.d.ts +8 -0
  85. package/dist/components/skeleton/SkeletonMedia.svelte +115 -0
  86. package/dist/components/skeleton/SkeletonMedia.svelte.d.ts +9 -0
  87. package/dist/components/skeleton/SkeletonText.svelte +75 -0
  88. package/dist/components/skeleton/SkeletonText.svelte.d.ts +8 -0
  89. package/dist/index.d.ts +42 -0
  90. package/dist/index.js +43 -0
  91. package/dist/types/icon.d.ts +4 -0
  92. package/dist/types/icon.js +2 -0
  93. package/dist/types/menuItem.d.ts +8 -0
  94. package/dist/types/menuItem.js +1 -0
  95. package/dist/types/options.d.ts +6 -0
  96. package/dist/types/options.js +4 -0
  97. package/dist/types/skeleton.d.ts +77 -0
  98. package/dist/types/skeleton.js +19 -0
  99. package/dist/utils/accessibility.d.ts +48 -0
  100. package/dist/utils/accessibility.js +87 -0
  101. package/dist/utils/formatText.d.ts +4 -0
  102. package/dist/utils/formatText.js +44 -0
  103. package/dist/utils/mobile.d.ts +9 -0
  104. package/dist/utils/mobile.js +47 -0
  105. package/dist/utils/snackbar.svelte.d.ts +51 -0
  106. package/dist/utils/snackbar.svelte.js +107 -0
  107. package/dist/utils/style.d.ts +17 -0
  108. package/dist/utils/style.js +22 -0
  109. package/package.json +102 -0
@@ -0,0 +1,557 @@
1
+ <!-- IconButton.svelte -->
2
+
3
+ <script lang="ts">
4
+ import Icon from './Icon.svelte';
5
+ import { t } from '../i18n';
6
+ import LoadingSpinner from './LoadingSpinner.svelte';
7
+ import type { Snippet } from 'svelte';
8
+ import type { HTMLButtonAttributes } from 'svelte/elements';
9
+ import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
10
+
11
+ // =========================================================================
12
+ // Props, States & Constants
13
+ // =========================================================================
14
+ let {
15
+ // 基本プロパティ
16
+ children,
17
+
18
+ // HTML属性系
19
+ buttonAttributes,
20
+ type = 'button',
21
+ tabindex = null,
22
+
23
+ // スタイル/レイアウト
24
+ customStyle,
25
+ variant = 'ghost',
26
+ size = 32,
27
+ fontSize = size * 0.75,
28
+ color,
29
+ rounded = true,
30
+
31
+ // アイコン関連
32
+ icon = '',
33
+ iconFilled = false,
34
+ iconWeight = 300,
35
+ iconGrade = 0,
36
+ iconOpticalSize = fontSize,
37
+ iconVariant = 'outlined',
38
+
39
+ // バッジ関連
40
+ hasBadge = false,
41
+ badgeCount = 0,
42
+ badgeVariant = 'count',
43
+ badgeColor,
44
+ badgeMax = 99,
45
+
46
+ // 状態/動作
47
+ disabled = false,
48
+ loading = false,
49
+ pressed = false,
50
+ reducedMotion = false,
51
+
52
+ // ARIA/アクセシビリティ
53
+ ariaLabel,
54
+ ariaDescribedby,
55
+ ariaPressed,
56
+
57
+ // フォーカスイベント
58
+ onfocus = () => {}, // No params for type inference
59
+ onblur = () => {}, // No params for type inference
60
+
61
+ // キーボードイベント
62
+ onkeydown = () => {}, // No params for type inference
63
+ onkeyup = () => {}, // No params for type inference
64
+
65
+ // マウスイベント
66
+ onclick,
67
+ onmousedown = () => {}, // No params for type inference
68
+ onmouseup = () => {}, // No params for type inference
69
+ onmouseenter = () => {}, // No params for type inference
70
+ onmouseleave = () => {}, // No params for type inference
71
+ onmouseover = () => {}, // No params for type inference
72
+ onmouseout = () => {}, // No params for type inference
73
+ oncontextmenu = () => {}, // No params for type inference
74
+ onauxclick = () => {}, // No params for type inference
75
+
76
+ // タッチイベント
77
+ ontouchstart = () => {}, // No params for type inference
78
+ ontouchend = () => {}, // No params for type inference
79
+ ontouchmove = () => {}, // No params for type inference
80
+ ontouchcancel = () => {}, // No params for type inference
81
+
82
+ // ポインターイベント
83
+ onpointerdown = () => {}, // No params for type inference
84
+ onpointerup = () => {}, // No params for type inference
85
+ onpointerenter = () => {}, // No params for type inference
86
+ onpointerleave = () => {}, // No params for type inference
87
+ onpointermove = () => {}, // No params for type inference
88
+ onpointercancel = () => {}, // No params for type inference
89
+
90
+ // その他
91
+ ...restProps
92
+ }: {
93
+ // Snippet
94
+ children: Snippet;
95
+
96
+ // HTML属性系
97
+ buttonAttributes?: HTMLButtonAttributes | undefined;
98
+ type?: 'button' | 'submit' | 'reset' | null | undefined;
99
+ tabindex?: number | null;
100
+
101
+ // スタイル/レイアウト
102
+ customStyle?: HTMLButtonAttributes['style'];
103
+ variant?: 'ghost' | 'filled' | 'outlined' | 'glass';
104
+ size?: number;
105
+ fontSize?: number;
106
+ color?: string;
107
+ rounded?: boolean;
108
+
109
+ // アイコン関連
110
+ icon?: string;
111
+ iconFilled?: boolean;
112
+ iconWeight?: IconWeight;
113
+ iconGrade?: IconGrade;
114
+ iconOpticalSize?: IconOpticalSize;
115
+ iconVariant?: IconVariant;
116
+
117
+ // バッジ関連
118
+ hasBadge?: boolean;
119
+ badgeCount?: number;
120
+ badgeVariant?: 'dot' | 'count';
121
+ badgeColor?: string;
122
+ badgeMax?: number;
123
+
124
+ // 状態/動作
125
+ disabled?: boolean;
126
+ loading?: boolean;
127
+ pressed?: boolean;
128
+ reducedMotion?: boolean;
129
+
130
+ // ARIA/アクセシビリティ
131
+ ariaLabel: string;
132
+ ariaDescribedby?: string;
133
+ ariaPressed?: boolean;
134
+
135
+ // フォーカスイベント
136
+ onfocus?: Function; // No params for type inference
137
+ onblur?: Function; // No params for type inference
138
+
139
+ // キーボードイベント
140
+ onkeydown?: Function; // No params for type inference
141
+ onkeyup?: Function; // No params for type inference
142
+
143
+ // マウスイベント
144
+ onclick?: Function; // No params for type inference
145
+ onmousedown?: Function; // No params for type inference
146
+ onmouseup?: Function; // No params for type inference
147
+ onmouseenter?: Function; // No params for type inference
148
+ onmouseleave?: Function; // No params for type inference
149
+ onmouseover?: Function; // No params for type inference
150
+ onmouseout?: Function; // No params for type inference
151
+ oncontextmenu?: Function; // No params for type inference
152
+ onauxclick?: Function; // No params for type inference
153
+
154
+ // タッチイベント
155
+ ontouchstart?: Function; // No params for type inference
156
+ ontouchend?: Function; // No params for type inference
157
+ ontouchmove?: Function; // No params for type inference
158
+ ontouchcancel?: Function; // No params for type inference
159
+
160
+ // ポインターイベント
161
+ onpointerdown?: Function; // No params for type inference
162
+ onpointerup?: Function; // No params for type inference
163
+ onpointerenter?: Function; // No params for type inference
164
+ onpointerleave?: Function; // No params for type inference
165
+ onpointermove?: Function; // No params for type inference
166
+ onpointercancel?: Function; // No params for type inference
167
+
168
+ // その他
169
+ [key: string]: any;
170
+ } = $props();
171
+
172
+ // =========================================================================
173
+ // Methods
174
+ // =========================================================================
175
+ const handleClick = (event: MouseEvent) => {
176
+ if (isDisabled) return;
177
+ if (onclick) onclick(event);
178
+ };
179
+
180
+ const handleFocus = (event: FocusEvent) => {
181
+ onfocus(event);
182
+ };
183
+
184
+ const handleBlur = (event: FocusEvent) => {
185
+ onblur(event);
186
+ };
187
+
188
+ const handleKeydown = (event: KeyboardEvent) => {
189
+ onkeydown(event);
190
+ };
191
+
192
+ const handleKeyup = (event: KeyboardEvent) => {
193
+ onkeyup(event);
194
+ };
195
+
196
+ // マウスイベント
197
+ const handleMouseDown = (event: MouseEvent) => {
198
+ if (isDisabled) return;
199
+ onmousedown(event);
200
+ };
201
+
202
+ const handleMouseUp = (event: MouseEvent) => {
203
+ if (isDisabled) return;
204
+ onmouseup(event);
205
+ };
206
+
207
+ const handleMouseEnter = (event: MouseEvent) => {
208
+ if (isDisabled) return;
209
+ onmouseenter(event);
210
+ };
211
+
212
+ const handleMouseLeave = (event: MouseEvent) => {
213
+ if (isDisabled) return;
214
+ onmouseleave(event);
215
+ };
216
+
217
+ const handleMouseOver = (event: MouseEvent) => {
218
+ if (isDisabled) return;
219
+ onmouseover(event);
220
+ };
221
+
222
+ const handleMouseOut = (event: MouseEvent) => {
223
+ if (isDisabled) return;
224
+ onmouseout(event);
225
+ };
226
+
227
+ const handleContextMenu = (event: MouseEvent) => {
228
+ if (isDisabled) return;
229
+ oncontextmenu(event);
230
+ };
231
+
232
+ const handleAuxClick = (event: MouseEvent) => {
233
+ if (isDisabled) return;
234
+ onauxclick(event);
235
+ };
236
+
237
+ // タッチイベント
238
+ const handleTouchStart = (event: TouchEvent) => {
239
+ if (isDisabled) return;
240
+ ontouchstart(event);
241
+ };
242
+
243
+ const handleTouchEnd = (event: TouchEvent) => {
244
+ if (isDisabled) return;
245
+ ontouchend(event);
246
+ };
247
+
248
+ const handleTouchMove = (event: TouchEvent) => {
249
+ if (isDisabled) return;
250
+ ontouchmove(event);
251
+ };
252
+
253
+ const handleTouchCancel = (event: TouchEvent) => {
254
+ if (isDisabled) return;
255
+ ontouchcancel(event);
256
+ };
257
+
258
+ // ポインターイベント
259
+ const handlePointerDown = (event: PointerEvent) => {
260
+ if (isDisabled) return;
261
+ onpointerdown(event);
262
+ };
263
+
264
+ const handlePointerUp = (event: PointerEvent) => {
265
+ if (isDisabled) return;
266
+ onpointerup(event);
267
+ };
268
+
269
+ const handlePointerEnter = (event: PointerEvent) => {
270
+ if (isDisabled) return;
271
+ onpointerenter(event);
272
+ };
273
+
274
+ const handlePointerLeave = (event: PointerEvent) => {
275
+ if (isDisabled) return;
276
+ onpointerleave(event);
277
+ };
278
+
279
+ const handlePointerMove = (event: PointerEvent) => {
280
+ if (isDisabled) return;
281
+ onpointermove(event);
282
+ };
283
+
284
+ const handlePointerCancel = (event: PointerEvent) => {
285
+ if (isDisabled) return;
286
+ onpointercancel(event);
287
+ };
288
+
289
+ // =========================================================================
290
+ // $derived
291
+ // =========================================================================
292
+ const isDisabled = $derived(disabled || loading);
293
+
294
+ const backgroundColors = $derived({
295
+ filled: color ?? 'var(--svelte-ui-iconbutton-bg-filled)',
296
+ outlined: 'transparent',
297
+ ghost: 'transparent',
298
+ glass: 'var(--svelte-ui-iconbutton-bg-glass)'
299
+ });
300
+
301
+ const textColors = $derived({
302
+ filled: 'var(--svelte-ui-iconbutton-text-filled)',
303
+ outlined: color ?? 'var(--svelte-ui-iconbutton-text-outlined)',
304
+ ghost: color ?? 'var(--svelte-ui-iconbutton-text-ghost)',
305
+ glass: color ?? 'var(--svelte-ui-iconbutton-text-glass)'
306
+ });
307
+
308
+ const badgeDisplay = $derived(() => {
309
+ if (!hasBadge) return '';
310
+ if (badgeVariant === 'dot') return '';
311
+ if (badgeCount > badgeMax) return `${badgeMax}+`;
312
+ return badgeCount.toString();
313
+ });
314
+
315
+ const buttonClasses = $derived(
316
+ [
317
+ 'icon-button__button',
318
+ `icon-button__button--${variant}`,
319
+ rounded && 'icon-button__button--rounded',
320
+ pressed && 'icon-button__button--pressed',
321
+ loading && 'icon-button__button--loading',
322
+ reducedMotion && 'icon-button__button--no-motion'
323
+ ]
324
+ .filter(Boolean)
325
+ .join(' ')
326
+ );
327
+ </script>
328
+
329
+ <div class="icon-button" data-testid="icon-button">
330
+ <button
331
+ {type}
332
+ disabled={isDisabled}
333
+ class={buttonClasses}
334
+ style="color: {textColors[variant]}; background-color: {backgroundColors[variant]};
335
+ width: {size}px; height: {size}px;
336
+ {customStyle ?? ''};"
337
+ onclick={handleClick}
338
+ onfocus={handleFocus}
339
+ onblur={handleBlur}
340
+ onkeydown={handleKeydown}
341
+ onkeyup={handleKeyup}
342
+ onmousedown={handleMouseDown}
343
+ onmouseup={handleMouseUp}
344
+ onmouseenter={handleMouseEnter}
345
+ onmouseleave={handleMouseLeave}
346
+ onmouseover={handleMouseOver}
347
+ onmouseout={handleMouseOut}
348
+ oncontextmenu={handleContextMenu}
349
+ onauxclick={handleAuxClick}
350
+ ontouchstart={handleTouchStart}
351
+ ontouchend={handleTouchEnd}
352
+ ontouchmove={handleTouchMove}
353
+ ontouchcancel={handleTouchCancel}
354
+ onpointerdown={handlePointerDown}
355
+ onpointerup={handlePointerUp}
356
+ onpointerenter={handlePointerEnter}
357
+ onpointerleave={handlePointerLeave}
358
+ onpointermove={handlePointerMove}
359
+ onpointercancel={handlePointerCancel}
360
+ {tabindex}
361
+ aria-label={ariaLabel}
362
+ aria-describedby={ariaDescribedby}
363
+ aria-pressed={ariaPressed !== undefined ? ariaPressed : pressed ? 'true' : undefined}
364
+ aria-busy={loading ? 'true' : undefined}
365
+ data-testid="icon-button"
366
+ {...buttonAttributes}
367
+ {...restProps}
368
+ >
369
+ {#if loading}
370
+ <div class="icon-button__loading">
371
+ <LoadingSpinner size={size * 0.5} strokeWidth={2} color="currentColor" />
372
+ </div>
373
+ {:else}
374
+ <div class="icon-button__icon" class:icon-button__icon--hidden={loading}>
375
+ <Icon
376
+ filled={true}
377
+ size={fontSize}
378
+ weight={iconWeight}
379
+ grade={iconGrade}
380
+ opticalSize={iconOpticalSize}
381
+ variant={iconVariant}
382
+ >
383
+ {@render children()}
384
+ </Icon>
385
+ </div>
386
+ {/if}
387
+ </button>
388
+
389
+ {#if hasBadge && (badgeVariant === 'dot' || badgeCount > 0)}
390
+ <div
391
+ class="icon-button__badge icon-button__badge--{badgeVariant}"
392
+ style="background-color: {badgeColor || 'var(--svelte-ui-badge-bg)'}"
393
+ aria-label={badgeVariant === 'count' ? `${badgeCount}` : t('iconButton.badgeNew')}
394
+ aria-live="polite"
395
+ >
396
+ {badgeVariant === 'count' ? badgeDisplay() : ''}
397
+ </div>
398
+ {/if}
399
+ </div>
400
+
401
+ <style>
402
+ .icon-button {
403
+ position: relative;
404
+ display: block;
405
+ width: fit-content;
406
+ }
407
+
408
+ .icon-button__button {
409
+ display: flex;
410
+ justify-content: center;
411
+ align-items: center;
412
+ position: relative;
413
+ padding: 0;
414
+ background-color: transparent;
415
+ border: none;
416
+ border-radius: var(--svelte-ui-iconbutton-border-radius);
417
+ line-height: 1;
418
+ overflow: hidden;
419
+ color: inherit;
420
+ cursor: pointer;
421
+ transition-property: background-color, box-shadow, color, opacity, transform;
422
+ transition-duration: var(--svelte-ui-transition-duration);
423
+ }
424
+
425
+ .icon-button__button--rounded {
426
+ border-radius: var(--svelte-ui-iconbutton-border-radius-rounded);
427
+ }
428
+
429
+ .icon-button__button--outlined {
430
+ box-shadow: inset 0 0 0 var(--svelte-ui-border-width) currentColor;
431
+ }
432
+
433
+ .icon-button__button--glass {
434
+ backdrop-filter: var(--svelte-ui-glass-blur);
435
+ -webkit-backdrop-filter: var(--svelte-ui-glass-blur);
436
+ }
437
+
438
+ .icon-button__button:before {
439
+ content: '';
440
+ display: block;
441
+ position: absolute;
442
+ top: 0;
443
+ left: 0;
444
+ width: 100%;
445
+ height: 100%;
446
+ background-color: var(--svelte-ui-iconbutton-hover-overlay);
447
+ opacity: 0;
448
+ transition-property: opacity;
449
+ transition-duration: var(--svelte-ui-transition-duration);
450
+ z-index: 0;
451
+ }
452
+
453
+ @media (hover: hover) {
454
+ .icon-button__button:hover:before {
455
+ opacity: 1;
456
+ }
457
+ }
458
+
459
+ .icon-button__button:focus-visible {
460
+ outline: var(--svelte-ui-focus-outline-outer);
461
+ outline-offset: var(--svelte-ui-focus-outline-offset-outer);
462
+ }
463
+
464
+ .icon-button__button--pressed {
465
+ transform: scale(0.95);
466
+ }
467
+
468
+ .icon-button__button--pressed:before {
469
+ opacity: 0.12;
470
+ }
471
+
472
+ .icon-button__button:disabled {
473
+ opacity: var(--svelte-ui-button-disabled-opacity);
474
+ cursor: not-allowed;
475
+ pointer-events: none;
476
+ }
477
+
478
+ .icon-button__button--loading {
479
+ cursor: wait;
480
+ }
481
+
482
+ .icon-button__button > * {
483
+ z-index: 1;
484
+ }
485
+
486
+ .icon-button__button__icon {
487
+ display: flex;
488
+ align-items: center;
489
+ justify-content: center;
490
+ transition-property: opacity;
491
+ transition-duration: var(--svelte-ui-transition-duration);
492
+ }
493
+
494
+ .icon-button__button__icon--hidden {
495
+ opacity: 0;
496
+ }
497
+
498
+ .icon-button__button__loading {
499
+ position: absolute;
500
+ top: 50%;
501
+ left: 50%;
502
+ transform: translate(-50%, -50%);
503
+ display: flex;
504
+ align-items: center;
505
+ justify-content: center;
506
+ }
507
+
508
+ .icon-button__badge {
509
+ position: absolute;
510
+ top: -2px;
511
+ right: -2px;
512
+ display: flex;
513
+ align-items: center;
514
+ justify-content: center;
515
+ font-size: var(--svelte-ui-badge-font-size);
516
+ color: var(--svelte-ui-badge-text-color);
517
+ line-height: 1;
518
+ text-align: center;
519
+ border-radius: var(--svelte-ui-border-radius-rounded);
520
+ z-index: 2;
521
+ }
522
+
523
+ .icon-button__badge--dot {
524
+ width: 8px;
525
+ height: 8px;
526
+ min-width: unset;
527
+ }
528
+
529
+ .icon-button__badge--count {
530
+ min-width: 16px;
531
+ height: 16px;
532
+ padding: 0 4px;
533
+ border-radius: 8px;
534
+ }
535
+
536
+ .icon-button__button--no-motion,
537
+ .icon-button__button--no-motion:before,
538
+ .icon-button__button--no-motion .icon-button__icon {
539
+ transition-duration: 0.01s;
540
+ }
541
+
542
+ .icon-button__button--no-motion.icon-button__button--pressed {
543
+ transform: none;
544
+ }
545
+
546
+ @media (prefers-reduced-motion: reduce) {
547
+ .icon-button__button,
548
+ .icon-button__button:before,
549
+ .icon-button__icon {
550
+ transition-duration: 0.01s;
551
+ }
552
+
553
+ .icon-button__button--pressed {
554
+ transform: none;
555
+ }
556
+ }
557
+ </style>
@@ -0,0 +1,60 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLButtonAttributes } from 'svelte/elements';
3
+ import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
4
+ type $$ComponentProps = {
5
+ children: Snippet;
6
+ buttonAttributes?: HTMLButtonAttributes | undefined;
7
+ type?: 'button' | 'submit' | 'reset' | null | undefined;
8
+ tabindex?: number | null;
9
+ customStyle?: HTMLButtonAttributes['style'];
10
+ variant?: 'ghost' | 'filled' | 'outlined' | 'glass';
11
+ size?: number;
12
+ fontSize?: number;
13
+ color?: string;
14
+ rounded?: boolean;
15
+ icon?: string;
16
+ iconFilled?: boolean;
17
+ iconWeight?: IconWeight;
18
+ iconGrade?: IconGrade;
19
+ iconOpticalSize?: IconOpticalSize;
20
+ iconVariant?: IconVariant;
21
+ hasBadge?: boolean;
22
+ badgeCount?: number;
23
+ badgeVariant?: 'dot' | 'count';
24
+ badgeColor?: string;
25
+ badgeMax?: number;
26
+ disabled?: boolean;
27
+ loading?: boolean;
28
+ pressed?: boolean;
29
+ reducedMotion?: boolean;
30
+ ariaLabel: string;
31
+ ariaDescribedby?: string;
32
+ ariaPressed?: boolean;
33
+ onfocus?: Function;
34
+ onblur?: Function;
35
+ onkeydown?: Function;
36
+ onkeyup?: Function;
37
+ onclick?: Function;
38
+ onmousedown?: Function;
39
+ onmouseup?: Function;
40
+ onmouseenter?: Function;
41
+ onmouseleave?: Function;
42
+ onmouseover?: Function;
43
+ onmouseout?: Function;
44
+ oncontextmenu?: Function;
45
+ onauxclick?: Function;
46
+ ontouchstart?: Function;
47
+ ontouchend?: Function;
48
+ ontouchmove?: Function;
49
+ ontouchcancel?: Function;
50
+ onpointerdown?: Function;
51
+ onpointerup?: Function;
52
+ onpointerenter?: Function;
53
+ onpointerleave?: Function;
54
+ onpointermove?: Function;
55
+ onpointercancel?: Function;
56
+ [key: string]: any;
57
+ };
58
+ declare const IconButton: import("svelte").Component<$$ComponentProps, {}, "">;
59
+ type IconButton = ReturnType<typeof IconButton>;
60
+ export default IconButton;