@insymetri/styleguide 0.1.15 → 0.1.17

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.
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type {Snippet} from 'svelte'
3
3
  import type {HTMLInputAttributes} from 'svelte/elements'
4
+ import IIIconButton from '../IIIconButton/IIIconButton.svelte'
4
5
  import {cn} from '../utils/cn'
5
6
 
6
7
  type Props = Omit<HTMLInputAttributes, 'prefix'> & {
@@ -33,7 +34,9 @@
33
34
  }: Props = $props()
34
35
 
35
36
  const showError = $derived(error || !!errorMessage)
36
- const hasAddons = $derived(!!prefix || !!suffix)
37
+ const isSearch = $derived(type === 'search')
38
+ const showClear = $derived(isSearch && !!value)
39
+ const hasAddons = $derived(!!prefix || !!suffix || isSearch)
37
40
  let shouldShake = $state(false)
38
41
  let prevShowError = $state(false)
39
42
 
@@ -74,7 +77,7 @@
74
77
  bind:value
75
78
  {type}
76
79
  {disabled}
77
- class="py-5 px-12 text-small font-[family-name:var(--font-family)] text-input-text bg-transparent border-0 outline-none w-full box-border placeholder:text-input-placeholder disabled:text-input-text-disabled disabled:cursor-not-allowed"
80
+ class="py-5 px-12 text-small font-[family-name:var(--font-family)] text-input-text bg-transparent border-0 outline-none w-full box-border placeholder:text-input-placeholder disabled:text-input-text-disabled disabled:cursor-not-allowed [&::-webkit-search-cancel-button]:appearance-none"
78
81
  {...restProps}
79
82
  />
80
83
  {#if suffix}
@@ -82,6 +85,19 @@
82
85
  {@render suffix()}
83
86
  </span>
84
87
  {/if}
88
+ {#if showClear}
89
+ <span class="flex items-center pr-4 shrink-0">
90
+ <IIIconButton
91
+ iconName="x"
92
+ size="sm"
93
+ variant="ghost"
94
+ onclick={() => {
95
+ value = ''
96
+ ref?.focus()
97
+ }}
98
+ />
99
+ </span>
100
+ {/if}
85
101
  </div>
86
102
  {:else}
87
103
  <input
@@ -0,0 +1,45 @@
1
+ <script lang="ts">
2
+ const shadows: Array<{name: string; class: string; desc: string}> = [
3
+ {name: 'shadow-none', class: 'shadow-none', desc: 'No shadow'},
4
+ {name: 'shadow-pill', class: 'shadow-pill', desc: 'Pills, tags, small controls'},
5
+ {name: 'shadow-subtle', class: 'shadow-subtle', desc: 'Switch knobs, active pills'},
6
+ {name: 'shadow-card', class: 'shadow-card', desc: 'Cards at rest'},
7
+ {name: 'shadow-card-hover', class: 'shadow-card-hover', desc: 'Card hover / raised state'},
8
+ {name: 'shadow-dropdown', class: 'shadow-dropdown', desc: 'Dropdown menus, popovers, comboboxes'},
9
+ {name: 'shadow-modal', class: 'shadow-modal', desc: 'Modal dialogs'},
10
+ {name: 'shadow-drawer', class: 'shadow-drawer', desc: 'Side drawers / floating panels'},
11
+ {name: 'shadow-toast', class: 'shadow-toast', desc: 'Toast notifications'},
12
+ {name: 'shadow-focus-ring', class: 'shadow-focus-ring', desc: 'Input/control focus state'},
13
+ {name: 'shadow-selection-ring', class: 'shadow-selection-ring', desc: 'Selected item indicator'},
14
+ {name: 'shadow-comm-hover', class: 'shadow-comm-hover', desc: 'Communication card hover'},
15
+ {name: 'shadow-login-card', class: 'shadow-login-card', desc: 'Login card — deep overlay'},
16
+ {name: 'shadow-dialog-overlay', class: 'shadow-dialog-overlay', desc: 'Dialog overlay — elevated panel'},
17
+ ]
18
+ </script>
19
+
20
+ <!--
21
+ Safelist: ensure Tailwind generates all shadow classes used dynamically above.
22
+ shadow-none shadow-pill shadow-subtle shadow-card shadow-card-hover shadow-dropdown
23
+ shadow-modal shadow-drawer shadow-toast shadow-focus-ring shadow-selection-ring
24
+ shadow-comm-hover shadow-login-card shadow-dialog-overlay
25
+ -->
26
+
27
+ <div class="flex flex-col gap-48 p-24 text-body">
28
+ <section>
29
+ <h2 class="text-h2 mb-16">Box Shadows</h2>
30
+ <div
31
+ style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px;"
32
+ >
33
+ {#each shadows as item (item.name)}
34
+ <div class="flex flex-col gap-8">
35
+ <div
36
+ class="rounded-8 bg-surface-raised {item.class}"
37
+ style="height: 96px;"
38
+ ></div>
39
+ <span class="text-small font-mono text-secondary">{item.name}</span>
40
+ <span class="text-tiny text-tertiary">{item.desc}</span>
41
+ </div>
42
+ {/each}
43
+ </div>
44
+ </section>
45
+ </div>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Shadows: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type Shadows = InstanceType<typeof Shadows>;
18
+ export default Shadows;
@@ -0,0 +1 @@
1
+ export { default as Shadows } from './Shadows.svelte';
@@ -0,0 +1 @@
1
+ export { default as Shadows } from './Shadows.svelte';
@@ -1,5 +1,6 @@
1
1
  export declare const boxShadow: {
2
2
  none: string;
3
+ pill: string;
3
4
  subtle: string;
4
5
  card: string;
5
6
  'card-hover': string;
@@ -1,5 +1,7 @@
1
1
  export const boxShadow = {
2
2
  none: 'none',
3
+ // Pill elevation (pills, tags, small controls)
4
+ pill: '0 3px 6px -2px rgba(0, 0, 0, 0.02), 0 1px 1px 0 rgba(0, 0, 0, 0.04), inset 0 0 0 0.5px rgba(0, 0, 0, 0.08)',
3
5
  // Subtle elevation (switch knobs, active pills)
4
6
  subtle: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
5
7
  // Cards at rest
@@ -19,7 +21,7 @@ export const boxShadow = {
19
21
  // Selection ring — selected item indicator
20
22
  'selection-ring': '0 0 0 2px var(--ii-primary-20)',
21
23
  // Communication card hover
22
- 'comm-hover': '0 2px 8px var(--ii-shadow-subtle)',
24
+ 'comm-hover': '0 2px 8px var(--ii-shadow-subtle-color)',
23
25
  // Login card — deep overlay shadow
24
26
  'login-card': '0 20px 60px var(--ii-overlay), 0 0 1px var(--ii-hover-overlay)',
25
27
  // Dialog overlay — elevated panel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insymetri/styleguide",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Insymetri shared UI component library built with Svelte 5",
5
5
  "type": "module",
6
6
  "scripts": {