@insymetri/styleguide 0.1.17 → 0.1.18

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.
@@ -37,7 +37,7 @@
37
37
  const isDisabled = $derived(disabled || loading)
38
38
 
39
39
  const baseClasses =
40
- 'inline-flex items-center justify-center gap-8 whitespace-nowrap rounded-8 cursor-default transition-colors duration-base ease-in-out no-underline disabled:cursor-not-allowed'
40
+ 'inline-flex items-center justify-center gap-8 whitespace-nowrap rounded-control cursor-default transition-colors duration-base ease-in-out no-underline disabled:cursor-not-allowed'
41
41
 
42
42
  const variantClasses = {
43
43
  primary:
@@ -162,7 +162,7 @@
162
162
  {placeholder}
163
163
  {disabled}
164
164
  oninput={handleInput}
165
- class="w-full box-border py-5 px-12 text-small text-input-text bg-input-bg border border-input-border rounded-8 transition-all duration-fast outline-none placeholder:text-input-placeholder hover:border-input-border-hover focus:border-input-border-hover disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-input-bg-disabled motion-reduce:transition-none"
165
+ class="w-full box-border py-5 px-12 text-small text-input-text bg-input-bg border border-input-border rounded-control transition-all duration-fast outline-none placeholder:text-input-placeholder hover:border-input-border-hover focus:border-input-border-hover disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-input-bg-disabled motion-reduce:transition-none"
166
166
  />
167
167
  <Combobox.Portal>
168
168
  {#if filteredItems.length > 0 || emptyContent || loading}
@@ -87,7 +87,7 @@
87
87
  />
88
88
  </div>
89
89
  <button
90
- class="px-12 py-5 rounded-8 border border-button-secondary text-small text-button-secondary hover:border-button-secondary-hover cursor-default"
90
+ class="px-12 py-5 rounded-control border border-button-secondary text-small text-button-secondary hover:border-button-secondary-hover cursor-default"
91
91
  onclick={simulateLoading}
92
92
  >
93
93
  Simulate Load
@@ -18,7 +18,7 @@
18
18
  {/if}
19
19
  <div class="relative">
20
20
  <DatePicker.Input
21
- class="flex items-center gap-4 py-5 px-12 border border-strong rounded-8 text-small text-gray-800 bg-surface transition-all duration-fast [&:has(:focus)]:border-primary [&:has(:focus)]:ring-3 [&:has(:focus)]:ring-primary"
21
+ class="flex items-center gap-4 py-5 px-12 border border-strong rounded-control text-small text-gray-800 bg-surface transition-all duration-fast [&:has(:focus)]:border-primary [&:has(:focus)]:ring-3 [&:has(:focus)]:ring-primary"
22
22
  >
23
23
  {#snippet children({segments})}
24
24
  {#each segments as { part, value: segValue }, i (`${part}-${i}`)}
@@ -60,7 +60,7 @@
60
60
  bind:ref={triggerEl}
61
61
  {disabled}
62
62
  class={cn(
63
- 'flex items-center justify-between gap-4 py-5 pl-12 pr-8 border rounded-8 bg-button-secondary cursor-default text-small text-button-secondary box-border appearance-none font-inherit outline-none transition-colors duration-base ease-in-out hover:text-button-secondary-hover hover:border-button-secondary-hover focus:border-accent focus:ring-3 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed',
63
+ 'flex items-center justify-between gap-4 py-5 pl-12 pr-8 border rounded-control bg-button-secondary cursor-default text-small text-button-secondary box-border appearance-none font-inherit outline-none transition-colors duration-base ease-in-out hover:text-button-secondary-hover hover:border-button-secondary-hover focus:border-accent focus:ring-3 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed',
64
64
  open ? 'border-button-secondary-hover' : 'border-button-secondary',
65
65
  className
66
66
  )}
@@ -28,7 +28,7 @@
28
28
  const isDisabled = $derived(disabled || loading)
29
29
 
30
30
  const baseClasses =
31
- 'inline-flex items-center justify-center rounded-8 cursor-default transition-colors duration-base ease-in-out disabled:cursor-not-allowed'
31
+ 'inline-flex items-center justify-center rounded-control cursor-default transition-colors duration-base ease-in-out disabled:cursor-not-allowed'
32
32
 
33
33
  const variantClasses = {
34
34
  primary:
@@ -61,7 +61,7 @@
61
61
  {#if hasAddons}
62
62
  <div
63
63
  class={cn(
64
- 'flex items-center bg-input-bg border border-input-border rounded-8 transition-all duration-fast hover:border-input-border-hover focus-within:border-input-border-hover motion-reduce:transition-none',
64
+ 'flex items-center bg-input-bg border border-input-border rounded-control transition-all duration-fast hover:border-input-border-hover focus-within:border-input-border-hover motion-reduce:transition-none',
65
65
  showError && 'border-input-border-error focus-within:border-input-border-error',
66
66
  shouldShake && 'animate-shake',
67
67
  disabled && 'bg-input-bg-disabled cursor-not-allowed'
@@ -106,7 +106,7 @@
106
106
  {type}
107
107
  {disabled}
108
108
  class={cn(
109
- 'py-5 px-12 text-small font-[family-name:var(--font-family)] text-input-text bg-input-bg border border-input-border rounded-8 transition-all duration-fast outline-none w-full box-border placeholder:text-input-placeholder hover:border-input-border-hover focus:border-input-border-hover disabled:bg-input-bg-disabled disabled:text-input-text-disabled disabled:cursor-not-allowed motion-reduce:transition-none motion-reduce:animate-none',
109
+ 'py-5 px-12 text-small font-[family-name:var(--font-family)] text-input-text bg-input-bg border border-input-border rounded-control transition-all duration-fast outline-none w-full box-border placeholder:text-input-placeholder hover:border-input-border-hover focus:border-input-border-hover disabled:bg-input-bg-disabled disabled:text-input-text-disabled disabled:cursor-not-allowed motion-reduce:transition-none motion-reduce:animate-none',
110
110
  showError && 'border-input-border-error focus:border-input-border-error focus:ring-error',
111
111
  shouldShake && 'animate-shake'
112
112
  )}
@@ -75,7 +75,7 @@
75
75
  bind:ref={triggerEl}
76
76
  {disabled}
77
77
  class={cn(
78
- 'flex items-center gap-4 py-5 pl-12 pr-8 border rounded-8 bg-button-secondary cursor-default text-small text-button-secondary box-border appearance-none font-inherit outline-none transition-colors duration-base ease-in-out hover:text-button-secondary-hover hover:border-button-secondary-hover focus:border-accent focus:ring-3 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed',
78
+ 'flex items-center gap-4 py-5 pl-12 pr-8 border rounded-control bg-button-secondary cursor-default text-small text-button-secondary box-border appearance-none font-inherit outline-none transition-colors duration-base ease-in-out hover:text-button-secondary-hover hover:border-button-secondary-hover focus:border-accent focus:ring-3 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed',
79
79
  open ? 'border-button-secondary-hover' : 'border-button-secondary',
80
80
  className
81
81
  )}
@@ -0,0 +1,82 @@
1
+ <script lang="ts">
2
+ import {cn} from '../utils/cn'
3
+ import IIDropdownInput from '../IIDropdownInput/IIDropdownInput.svelte'
4
+
5
+ type Tab = {
6
+ value: string
7
+ label: string
8
+ count?: number
9
+ }
10
+
11
+ type Props = {
12
+ tabs: Tab[]
13
+ value: string
14
+ onchange?: (value: string) => void
15
+ class?: string
16
+ }
17
+
18
+ let {tabs, value = $bindable(), onchange, class: className}: Props = $props()
19
+
20
+ let containerEl = $state<HTMLDivElement | null>(null)
21
+ let measureEl = $state<HTMLDivElement | null>(null)
22
+ let overflow = $state(false)
23
+
24
+ function checkOverflow() {
25
+ if (!containerEl || !measureEl) return
26
+ overflow = measureEl.scrollWidth > containerEl.clientWidth
27
+ }
28
+
29
+ $effect(() => {
30
+ if (!containerEl) return
31
+ const ro = new ResizeObserver(() => checkOverflow())
32
+ ro.observe(containerEl)
33
+ return () => ro.disconnect()
34
+ })
35
+
36
+ $effect(() => {
37
+ tabs
38
+ requestAnimationFrame(() => checkOverflow())
39
+ })
40
+
41
+ function select(v: string) {
42
+ value = v
43
+ onchange?.(v)
44
+ }
45
+ </script>
46
+
47
+ <div bind:this={containerEl} class={cn('min-w-0 relative', className)}>
48
+ <!-- Hidden measure element — always rendered to detect when pills fit again -->
49
+ <div
50
+ bind:this={measureEl}
51
+ class="flex items-center gap-4 w-max"
52
+ aria-hidden={overflow ? 'true' : undefined}
53
+ style={overflow ? 'position: absolute; visibility: hidden; height: 0; overflow: hidden; pointer-events: none;' : ''}
54
+ >
55
+ {#each tabs as tab (tab.value)}
56
+ <button
57
+ class={cn(
58
+ 'flex items-center h-28 px-10 rounded-full border-none outline-none text-small cursor-default whitespace-nowrap',
59
+ value === tab.value
60
+ ? 'bg-gray-100 text-gray-700'
61
+ : 'bg-surface text-secondary shadow-pill hover:bg-gray-100 hover:text-gray-700'
62
+ )}
63
+ style="transition: all var(--transition-fast)"
64
+ onclick={() => select(tab.value)}
65
+ tabindex={overflow ? -1 : 0}
66
+ >
67
+ {tab.label}
68
+ {#if tab.count != null}
69
+ <span class="ml-2 text-tiny opacity-70">({tab.count})</span>
70
+ {/if}
71
+ </button>
72
+ {/each}
73
+ </div>
74
+
75
+ {#if overflow}
76
+ <IIDropdownInput
77
+ items={tabs.map(t => ({label: t.count != null ? `${t.label} (${t.count})` : t.label, value: t.value}))}
78
+ {value}
79
+ onSelect={v => select(v)}
80
+ />
81
+ {/if}
82
+ </div>
@@ -0,0 +1,14 @@
1
+ type Tab = {
2
+ value: string;
3
+ label: string;
4
+ count?: number;
5
+ };
6
+ type Props = {
7
+ tabs: Tab[];
8
+ value: string;
9
+ onchange?: (value: string) => void;
10
+ class?: string;
11
+ };
12
+ declare const IIPillTabs: import("svelte").Component<Props, {}, "value">;
13
+ type IIPillTabs = ReturnType<typeof IIPillTabs>;
14
+ export default IIPillTabs;
@@ -0,0 +1 @@
1
+ export { default as IIPillTabs } from './IIPillTabs.svelte';
@@ -0,0 +1 @@
1
+ export { default as IIPillTabs } from './IIPillTabs.svelte';
@@ -69,7 +69,7 @@
69
69
  <div class="flex items-center border-b border-primary px-24" style="padding-left: calc(2.4rem - 1.2rem - 1px)">
70
70
  <DropdownMenu.Root bind:open={dropdownOpen}>
71
71
  <DropdownMenu.Trigger
72
- class="[all:unset] inline-flex items-center gap-4 py-4 pr-8 pl-12 border border-primary rounded-8 bg-surface cursor-default transition-all duration-fast hover:border-strong motion-reduce:transition-none"
72
+ class="[all:unset] inline-flex items-center gap-4 py-4 pr-8 pl-12 border border-primary rounded-control bg-surface cursor-default transition-all duration-fast hover:border-strong motion-reduce:transition-none"
73
73
  >
74
74
  <span class="text-small-emphasis text-body">{activeLabel}</span>
75
75
  <IIIcon iconName="caret-down" class="w-14 h-14 text-secondary shrink-0" />
@@ -65,7 +65,7 @@
65
65
  {disabled}
66
66
  {rows}
67
67
  class={cn(
68
- 'py-5 px-12 text-small font-[family-name:var(--font-family)] text-body bg-surface border border-strong rounded-8 transition-all duration-fast outline-none w-full box-border resize-none overflow-hidden min-h-16 placeholder:text-tertiary focus:border-primary focus:ring-3 focus:ring-primary disabled:bg-gray-100 disabled:text-secondary disabled:cursor-not-allowed motion-reduce:transition-none',
68
+ 'py-5 px-12 text-small font-[family-name:var(--font-family)] text-body bg-surface border border-strong rounded-control transition-all duration-fast outline-none w-full box-border resize-none overflow-hidden min-h-16 placeholder:text-tertiary focus:border-primary focus:ring-3 focus:ring-primary disabled:bg-gray-100 disabled:text-secondary disabled:cursor-not-allowed motion-reduce:transition-none',
69
69
  showError && 'border-error focus:border-error focus:ring-error'
70
70
  )}
71
71
  oninput={handleInput}
@@ -42,7 +42,7 @@
42
42
  {disabled}
43
43
  aria-label={ariaLabel}
44
44
  class={cn(
45
- 'inline-flex items-center justify-center rounded-8 cursor-default transition-colors duration-base ease-in-out text-secondary hover:bg-button-ghost-hover hover:text-button-ghost-hover data-[state=on]:bg-button-ghost-hover data-[state=on]:text-body disabled:opacity-50 disabled:cursor-not-allowed',
45
+ 'inline-flex items-center justify-center rounded-control cursor-default transition-colors duration-base ease-in-out text-secondary hover:bg-button-ghost-hover hover:text-button-ghost-hover data-[state=on]:bg-button-ghost-hover data-[state=on]:text-body disabled:opacity-50 disabled:cursor-not-allowed',
46
46
  sizeClasses[size],
47
47
  iconSizeClasses[size],
48
48
  className
@@ -47,7 +47,7 @@
47
47
  <section>
48
48
  <h2 class="text-default-emphasis text-primary mb-8">Toolbar Example</h2>
49
49
  <p class="text-small text-secondary mb-12">Multiple toggles used together as a formatting toolbar.</p>
50
- <div class="flex items-center gap-4 p-4 border border-subtle rounded-8 bg-surface inline-flex">
50
+ <div class="flex items-center gap-4 p-4 border border-subtle rounded-control bg-surface inline-flex">
51
51
  <IIToggle bind:pressed={filterPressed} aria-label="Filter">
52
52
  {#snippet children({pressed})}
53
53
  <IIIcon iconName="funnel-fill" />
package/dist/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export { IIInput } from './IIInput';
23
23
  export { IIModal } from './IIModal';
24
24
  export { IIMultiSelect } from './IIMultiSelect';
25
25
  export { IIOverflowActions } from './IIOverflowActions';
26
+ export { IIPillTabs } from './IIPillTabs';
26
27
  export { IIPopover } from './IIPopover';
27
28
  export { IISpinner } from './IISpinner';
28
29
  export { IIStatusBadge } from './IIStatusBadge';
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ export { IIInput } from './IIInput';
25
25
  export { IIModal } from './IIModal';
26
26
  export { IIMultiSelect } from './IIMultiSelect';
27
27
  export { IIOverflowActions } from './IIOverflowActions';
28
+ export { IIPillTabs } from './IIPillTabs';
28
29
  export { IIPopover } from './IIPopover';
29
30
  export { IISpinner } from './IISpinner';
30
31
  export { IIStatusBadge } from './IIStatusBadge';
@@ -211,6 +211,9 @@
211
211
  --ii-inspector-header: #2d2d2d;
212
212
  --ii-inspector-keyword: #569cd6;
213
213
 
214
+ /* Radius */
215
+ --ii-radius-control: 9999px;
216
+
214
217
  /* Misc */
215
218
  --ii-error-dark: #dc2626;
216
219
  --ii-success-dark-alt: #059669;
@@ -1,5 +1,6 @@
1
1
  import { spacing } from './spacing';
2
2
  export const borderRadius = {
3
3
  ...spacing,
4
+ control: 'var(--ii-radius-control)',
4
5
  full: '9999px',
5
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insymetri/styleguide",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Insymetri shared UI component library built with Svelte 5",
5
5
  "type": "module",
6
6
  "scripts": {