@insymetri/styleguide 0.1.70 → 0.1.72

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.
@@ -39,7 +39,8 @@
39
39
  >
40
40
  <IIIcon
41
41
  iconName="caret-right"
42
- class={cn('w-14 h-14 text-secondary shrink-0 transition-transform duration-fast', expanded && 'rotate-90')}
42
+ variant="secondary"
43
+ class={cn('transition-transform duration-fast', expanded && 'rotate-90')}
43
44
  />
44
45
  <div class="flex-1 min-w-0">
45
46
  {@render trigger({expanded})}
@@ -36,7 +36,7 @@
36
36
 
37
37
  {#if !dismissed}
38
38
  <div class={cn('flex gap-12 p-12 rounded-8 border', config.bg, config.border, className)} role="alert">
39
- <IIIcon iconName={config.icon} class={cn('size-20 shrink-0 mt-1', config.text)} />
39
+ <IIIcon iconName={config.icon} size="lg" class={cn('mt-1', config.text)} />
40
40
  <div class="flex-auto min-w-0">
41
41
  {#if title}
42
42
  <p class={cn('text-small-emphasis m-0', config.text)}>{title}</p>
@@ -52,7 +52,7 @@
52
52
  onclick={handleDismiss}
53
53
  aria-label="Dismiss"
54
54
  >
55
- <IIIcon iconName="x" class="size-16" />
55
+ <IIIcon iconName="x" size="md" />
56
56
  </button>
57
57
  {/if}
58
58
  </div>
@@ -113,7 +113,7 @@
113
113
  <div class="flex justify-between items-start mb-4">
114
114
  <div class="flex gap-8 items-start">
115
115
  <span class="text-secondary flex">
116
- <IIIcon {iconName} class="w-20 h-20" />
116
+ <IIIcon {iconName} size="lg" />
117
117
  </span>
118
118
  <div class="flex-1">
119
119
  <div class="text-small-emphasis text-body mb-4">{event.description}</div>
@@ -107,7 +107,7 @@
107
107
 
108
108
  {#snippet iconContent()}
109
109
  {#if iconName}
110
- <IIIcon {iconName} class={cn(iconSizeClasses[size], isLoading && 'invisible')} />
110
+ <IIIcon {iconName} size="inherit" class={cn(iconSizeClasses[size], isLoading && 'invisible')} />
111
111
  {/if}
112
112
  {#if isLoading && children}
113
113
  <span class="invisible">{@render children()}</span>
@@ -52,7 +52,7 @@
52
52
  )}
53
53
  >
54
54
  {#if checked}
55
- <IIIcon iconName="check" class={size === 'sm' ? 'w-14 h-14 text-white' : 'w-16 h-16 text-white'} />
55
+ <IIIcon iconName="check" size={size === 'sm' ? 'sm' : 'md'} variant="inverse" />
56
56
  {/if}
57
57
  </div>
58
58
  </Checkbox.Root>
@@ -163,12 +163,12 @@
163
163
  {:else if isSimpleItem(item)}
164
164
  <span class="flex-1">{item.label}</span>
165
165
  {#if selected}
166
- <IIIcon iconName="check" class="w-18 h-18 shrink-0 ml-auto" />
166
+ <IIIcon iconName="check" size="inherit" class="size-18 ml-auto" />
167
167
  {/if}
168
168
  {:else}
169
169
  <span class="flex-1">{getItemValue(item)}</span>
170
170
  {#if selected}
171
- <IIIcon iconName="check" class="w-18 h-18 shrink-0 ml-auto" />
171
+ <IIIcon iconName="check" size="inherit" class="size-18 ml-auto" />
172
172
  {/if}
173
173
  {/if}
174
174
  {/snippet}
@@ -216,7 +216,7 @@
216
216
  }}
217
217
  >
218
218
  <MenuItemContent icon={entry.icon} label={entry.label} shortcut={entry.shortcut} />
219
- <IIIcon iconName="caret-right" class="w-12 h-12 text-tertiary shrink-0" />
219
+ <IIIcon iconName="caret-right" size="xs" variant="tertiary" />
220
220
  </div>
221
221
  {#if isOpen}
222
222
  {#if entry.searchable}
@@ -263,7 +263,7 @@
263
263
  {:else}
264
264
  <span>{selectedLabel}</span>
265
265
  {/if}
266
- <IIIcon iconName="caret-down" class="w-14 h-14 shrink-0" />
266
+ <IIIcon iconName="caret-down" />
267
267
  </button>
268
268
 
269
269
  {#if open}
@@ -326,7 +326,7 @@
326
326
  {item.label}
327
327
  </span>
328
328
  {#if value === item.value}
329
- <IIIcon iconName="check" class="w-14 h-14 text-accent shrink-0" />
329
+ <IIIcon iconName="check" variant="accent" />
330
330
  {/if}
331
331
  {/if}
332
332
  </div>
@@ -266,7 +266,7 @@
266
266
  }}
267
267
  >
268
268
  <MenuItemContent icon={entry.icon} label={entry.label} shortcut={entry.shortcut} />
269
- <IIIcon iconName="caret-right" class="w-12 h-12 text-tertiary shrink-0" />
269
+ <IIIcon iconName="caret-right" size="xs" variant="tertiary" />
270
270
  </div>
271
271
  {#if isOpen}
272
272
  {#if entry.searchable}
@@ -81,7 +81,7 @@
81
81
  >
82
82
  <span class="flex-1 text-left">{item.label}</span>
83
83
  {#if isSelected}
84
- <IIIcon iconName="check" class="w-11 h-11 text-accent ml-8 shrink-0" />
84
+ <IIIcon iconName="check" size="inherit" variant="accent" class="size-11 ml-8" />
85
85
  {/if}
86
86
  </button>
87
87
  {/each}
@@ -42,6 +42,6 @@
42
42
  onclick={onRemove}
43
43
  aria-label="Remove filter"
44
44
  >
45
- <IIIcon iconName="x" />
45
+ <IIIcon iconName="x" size="inherit" />
46
46
  </button>
47
47
  </span>
@@ -1,13 +1,49 @@
1
1
  <script lang="ts">
2
2
  import {icons, type IconName} from '../icons'
3
+ import {cn} from '../utils/cn'
4
+
5
+ export type IconSize = 'inherit' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
6
+ export type IconVariant =
7
+ | 'inherit'
8
+ | 'secondary'
9
+ | 'tertiary'
10
+ | 'accent'
11
+ | 'success'
12
+ | 'warning'
13
+ | 'error'
14
+ | 'inverse'
3
15
 
4
16
  interface Props {
5
17
  iconName: IconName
18
+ /** Square px size. Use `inherit` to follow the surrounding font-size (1em) for inline-in-text icons. */
19
+ size?: IconSize
20
+ /** Semantic color. `inherit` (default) follows currentColor — the right choice for icons inside colored containers/buttons. */
21
+ variant?: IconVariant
6
22
  class?: string
7
23
  [key: string]: unknown
8
24
  }
9
25
 
10
- let {iconName, class: className = '', ...rest}: Props = $props()
26
+ let {iconName, size = 'sm', variant = 'inherit', class: className = '', ...rest}: Props = $props()
27
+
28
+ const sizeClasses: Record<IconSize, string> = {
29
+ inherit: '',
30
+ xs: 'size-12',
31
+ sm: 'size-14',
32
+ md: 'size-16',
33
+ lg: 'size-20',
34
+ xl: 'size-24',
35
+ }
36
+
37
+ const variantClasses: Record<IconVariant, string> = {
38
+ inherit: '',
39
+ secondary: 'text-secondary',
40
+ tertiary: 'text-tertiary',
41
+ accent: 'text-accent',
42
+ success: 'text-success',
43
+ warning: 'text-warning',
44
+ error: 'text-error',
45
+ inverse: 'text-inverse',
46
+ }
11
47
  </script>
12
48
 
13
49
  <svg
@@ -16,7 +52,7 @@
16
52
  width="1em"
17
53
  height="1em"
18
54
  fill="currentColor"
19
- class={className}
55
+ class={cn('shrink-0', sizeClasses[size], variantClasses[variant], className)}
20
56
  {...rest}
21
57
  >
22
58
  {@html icons[iconName]}
@@ -1,6 +1,12 @@
1
1
  import { type IconName } from '../icons';
2
+ export type IconSize = 'inherit' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
3
+ export type IconVariant = 'inherit' | 'secondary' | 'tertiary' | 'accent' | 'success' | 'warning' | 'error' | 'inverse';
2
4
  interface Props {
3
5
  iconName: IconName;
6
+ /** Square px size. Use `inherit` to follow the surrounding font-size (1em) for inline-in-text icons. */
7
+ size?: IconSize;
8
+ /** Semantic color. `inherit` (default) follows currentColor — the right choice for icons inside colored containers/buttons. */
9
+ variant?: IconVariant;
4
10
  class?: string;
5
11
  [key: string]: unknown;
6
12
  }
@@ -1 +1,2 @@
1
1
  export { default as IIIcon } from './IIIcon.svelte';
2
+ export type { IconSize, IconVariant } from './IIIcon.svelte';
@@ -79,6 +79,6 @@
79
79
  <span class={cn('border-2 border-current border-r-transparent rounded-full animate-spin', iconSizeClasses[size])}
80
80
  ></span>
81
81
  {:else}
82
- <IIIcon {iconName} class={iconSizeClasses[size]} />
82
+ <IIIcon {iconName} size="inherit" class={iconSizeClasses[size]} />
83
83
  {/if}
84
84
  </button>
@@ -103,7 +103,7 @@
103
103
  class="inline-flex items-center justify-center w-12 h-12 rounded-full hover:bg-gray-300 transition-colors duration-fast [&_svg]:w-8 [&_svg]:h-8"
104
104
  onclick={(e) => removeValue(chip.value, e)}
105
105
  >
106
- <IIIcon iconName="x" />
106
+ <IIIcon iconName="x" size="inherit" />
107
107
  </button>
108
108
  </span>
109
109
  {/each}
@@ -112,7 +112,7 @@
112
112
  {/if}
113
113
  {/if}
114
114
  </span>
115
- <IIIcon iconName="caret-down" class="w-14 h-14 shrink-0" />
115
+ <IIIcon iconName="caret-down" />
116
116
  </DropdownMenu.Trigger>
117
117
  <DropdownMenu.Portal>
118
118
  <DropdownMenu.Content
@@ -139,7 +139,7 @@
139
139
  {:else}
140
140
  <span class="flex-1">{item.label}</span>
141
141
  {#if values.includes(item.value)}
142
- <IIIcon iconName="check" class="w-14 h-14 text-accent shrink-0" />
142
+ <IIIcon iconName="check" variant="accent" />
143
143
  {/if}
144
144
  {/if}
145
145
  </DropdownMenu.CheckboxItem>
@@ -69,7 +69,7 @@
69
69
  <DropdownMenu.Trigger
70
70
  class="[all:unset] cursor-default inline-flex items-center justify-center p-4 rounded-4 text-secondary text-h3 transition-all duration-fast hover:bg-background hover:text-body data-[state=open]:bg-background data-[state=open]:text-body motion-reduce:transition-none"
71
71
  >
72
- <IIIcon iconName="dots-three-vertical" />
72
+ <IIIcon iconName="dots-three-vertical" size="inherit" />
73
73
  </DropdownMenu.Trigger>
74
74
  <DropdownMenu.Content
75
75
  class="min-w-100 bg-surface border border-primary rounded-10 shadow-dropdown p-4 z-12"
@@ -13,6 +13,8 @@
13
13
  sideOffset?: number
14
14
  class?: string
15
15
  triggerClass?: string
16
+ /** Strip the default surface (background, border, radius, shadow) — for content that renders its own. */
17
+ unstyled?: boolean
16
18
  }
17
19
 
18
20
  let {
@@ -25,7 +27,12 @@
25
27
  sideOffset = 4,
26
28
  class: className,
27
29
  triggerClass,
30
+ unstyled = false,
28
31
  }: Props = $props()
32
+
33
+ const surfaceClasses = unstyled
34
+ ? ''
35
+ : 'bg-dropdown-bg border border-dropdown-border rounded-10 shadow-dropdown'
29
36
  </script>
30
37
 
31
38
  <Popover.Root bind:open {onOpenChange}>
@@ -38,7 +45,8 @@
38
45
  {align}
39
46
  {sideOffset}
40
47
  class={cn(
41
- 'bg-dropdown-bg border border-dropdown-border rounded-10 shadow-dropdown p-12 z-16 animate-slide-in motion-reduce:animate-none',
48
+ surfaceClasses,
49
+ 'z-16 animate-slide-in motion-reduce:animate-none',
42
50
  className
43
51
  )}
44
52
  >
@@ -9,6 +9,8 @@ type Props = {
9
9
  sideOffset?: number;
10
10
  class?: string;
11
11
  triggerClass?: string;
12
+ /** Strip the default surface (background, border, radius, shadow) — for content that renders its own. */
13
+ unstyled?: boolean;
12
14
  };
13
15
  declare const IIPopover: import("svelte").Component<Props, {}, "open">;
14
16
  type IIPopover = ReturnType<typeof IIPopover>;
@@ -17,7 +17,7 @@
17
17
  <IIButton variant="secondary" size="sm">Open Popover</IIButton>
18
18
  {/snippet}
19
19
  {#snippet content()}
20
- <div class="flex flex-col gap-8 w-200">
20
+ <div class="flex flex-col gap-8 w-200 p-12">
21
21
  <p class="text-small-emphasis text-body">Popover Title</p>
22
22
  <p class="text-small text-secondary">This is a basic popover with some content inside.</p>
23
23
  </div>
@@ -34,7 +34,7 @@
34
34
  <IIButton variant="secondary" size="sm">Top</IIButton>
35
35
  {/snippet}
36
36
  {#snippet content()}
37
- <p class="text-small text-body">Popover on top</p>
37
+ <p class="text-small text-body p-12">Popover on top</p>
38
38
  {/snippet}
39
39
  </IIPopover>
40
40
  <IIPopover side="right">
@@ -42,7 +42,7 @@
42
42
  <IIButton variant="secondary" size="sm">Right</IIButton>
43
43
  {/snippet}
44
44
  {#snippet content()}
45
- <p class="text-small text-body">Popover on right</p>
45
+ <p class="text-small text-body p-12">Popover on right</p>
46
46
  {/snippet}
47
47
  </IIPopover>
48
48
  <IIPopover side="bottom">
@@ -50,7 +50,7 @@
50
50
  <IIButton variant="secondary" size="sm">Bottom</IIButton>
51
51
  {/snippet}
52
52
  {#snippet content()}
53
- <p class="text-small text-body">Popover on bottom</p>
53
+ <p class="text-small text-body p-12">Popover on bottom</p>
54
54
  {/snippet}
55
55
  </IIPopover>
56
56
  <IIPopover side="left">
@@ -58,7 +58,7 @@
58
58
  <IIButton variant="secondary" size="sm">Left</IIButton>
59
59
  {/snippet}
60
60
  {#snippet content()}
61
- <p class="text-small text-body">Popover on left</p>
61
+ <p class="text-small text-body p-12">Popover on left</p>
62
62
  {/snippet}
63
63
  </IIPopover>
64
64
  </div>
@@ -72,7 +72,7 @@
72
72
  <IIIconButton iconName="magnifying-glass" variant="ghost" />
73
73
  {/snippet}
74
74
  {#snippet content()}
75
- <div class="flex flex-col gap-8 w-200">
75
+ <div class="flex flex-col gap-8 w-200 p-12">
76
76
  <p class="text-small-emphasis text-body">Settings</p>
77
77
  <p class="text-small text-secondary">Quick settings panel triggered by an icon button.</p>
78
78
  </div>
@@ -88,7 +88,7 @@
88
88
  <IIButton variant="primary" size="sm">User Info</IIButton>
89
89
  {/snippet}
90
90
  {#snippet content()}
91
- <div class="flex flex-col gap-12 w-240">
91
+ <div class="flex flex-col gap-12 w-240 p-12">
92
92
  <div class="flex items-center gap-8">
93
93
  <div class="w-32 h-32 rounded-full bg-primary flex items-center justify-center text-inverse text-small-emphasis">JD</div>
94
94
  <div>
@@ -55,7 +55,7 @@
55
55
  )}
56
56
  >
57
57
  {#if isCompleted}
58
- <IIIcon iconName="check" class="size-14" />
58
+ <IIIcon iconName="check" />
59
59
  {:else}
60
60
  {i + 1}
61
61
  {/if}
@@ -79,7 +79,7 @@
79
79
  {#snippet child({props})}
80
80
  <IIButton {...props} variant="ghost">
81
81
  {activeLabel}
82
- <IIIcon iconName="caret-down" class="w-14 h-14 shrink-0" />
82
+ <IIIcon iconName="caret-down" />
83
83
  </IIButton>
84
84
  {/snippet}
85
85
  </DropdownMenu.Trigger>
@@ -99,7 +99,7 @@
99
99
  >
100
100
  <span>{tab.label}</span>
101
101
  {#if value === tab.value}
102
- <IIIcon iconName="check" class="w-14 h-14 text-accent shrink-0" />
102
+ <IIIcon iconName="check" variant="accent" />
103
103
  {/if}
104
104
  </DropdownMenu.Item>
105
105
  {/each}
@@ -33,7 +33,7 @@
33
33
  onclick={() => navigator.clipboard.writeText(name)}
34
34
  title="Copy '{name}'"
35
35
  >
36
- <IIIcon iconName={name} class="w-24 h-24 text-body" />
36
+ <IIIcon iconName={name} size="xl" class="text-body" />
37
37
  <span class="text-tiny text-secondary font-mono truncate w-full text-center">{name}</span>
38
38
  </button>
39
39
  {/each}
@@ -103,7 +103,7 @@
103
103
  class="inline-flex items-center justify-center w-20 h-20 rounded-full text-secondary hover:text-body hover:bg-hover-overlay transition-colors duration-fast"
104
104
  aria-label="Pay frequency info"
105
105
  >
106
- <IIIcon iconName="info" class="size-14" />
106
+ <IIIcon iconName="info" />
107
107
  </button>
108
108
  {/snippet}
109
109
  {#snippet content()}
@@ -97,7 +97,7 @@
97
97
  class="bg-transparent border-none cursor-pointer p-0 text-[var(--color-text-light)] flex items-center text-h2 font-normal hover:text-[var(--color-text)]"
98
98
  onclick={() => (showSsn = !showSsn)}
99
99
  >
100
- <IIIcon iconName={showSsn ? 'eye-slash' : 'eye'} />
100
+ <IIIcon iconName={showSsn ? 'eye-slash' : 'eye'} size="inherit" />
101
101
  </button>
102
102
  {/snippet}
103
103
  </IIInput>
package/dist/index.d.ts CHANGED
@@ -45,6 +45,7 @@ export { IIToaster } from './IIToaster';
45
45
  export { IIViewFilterChip } from './IIViewFilterChip';
46
46
  export type { AuditEvent, AuditFilter, Severity } from './IIAuditTrail';
47
47
  export type { BadgeVariant } from './IIBadge';
48
+ export type { IconSize, IconVariant } from './IIIcon';
48
49
  export { toast } from './toast';
49
50
  export { cn } from './utils/cn';
50
51
  export { icons } from './icons';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insymetri/styleguide",
3
- "version": "0.1.70",
3
+ "version": "0.1.72",
4
4
  "description": "Insymetri shared UI component library built with Svelte 5",
5
5
  "type": "module",
6
6
  "scripts": {