@insymetri/styleguide 0.1.46 → 0.1.48
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.
- package/dist/IIDateInput/IIDateInput.svelte +7 -5
- package/dist/IIDropdownInput/IIDropdownInput.svelte +19 -3
- package/dist/IIDropdownInput/IIDropdownInput.svelte.d.ts +3 -0
- package/dist/IIInput/IIInput.svelte +12 -23
- package/dist/IIModal/IIModal.svelte +21 -0
- package/dist/{IITabs/IITabs.svelte → IITabBar/IITabBar.svelte} +45 -87
- package/dist/IITabBar/IITabBar.svelte.d.ts +16 -0
- package/dist/IITabBar/index.d.ts +1 -0
- package/dist/IITabBar/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/style/colors.css +1 -1
- package/dist/utils/menu/menu-styles.d.ts +2 -2
- package/dist/utils/menu/menu-styles.js +2 -2
- package/package.json +4 -4
- package/dist/IITabs/IITabs.svelte.d.ts +0 -19
- package/dist/IITabs/index.d.ts +0 -1
- package/dist/IITabs/index.js +0 -1
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
</script>
|
|
70
70
|
|
|
71
|
-
<div class={cn('flex flex-col gap-4', className)}>
|
|
71
|
+
<div class={cn('relative flex flex-col gap-4 pb-20', className)}>
|
|
72
72
|
<DatePicker.Root value={internalValue} bind:placeholder onValueChange={handleValueChange} {disabled}>
|
|
73
73
|
{#if label}
|
|
74
74
|
<DatePicker.Label class="text-small-emphasis text-secondary">{label}</DatePicker.Label>
|
|
@@ -76,9 +76,11 @@
|
|
|
76
76
|
<DatePicker.Input
|
|
77
77
|
bind:ref={inputEl}
|
|
78
78
|
class={cn(
|
|
79
|
-
'flex items-center gap-4 px-12 border bg-input-bg border-input-border transition-all duration-fast
|
|
79
|
+
'flex items-center gap-4 px-12 border bg-input-bg border-input-border transition-all duration-fast [&:has(:focus)]:ring-3 motion-reduce:transition-none',
|
|
80
80
|
densityClasses[density.value],
|
|
81
|
-
showError
|
|
81
|
+
showError
|
|
82
|
+
? 'border-input-border-error hover:border-input-border-error [&:has(:focus)]:border-input-border-error [&:has(:focus)]:ring-error'
|
|
83
|
+
: 'hover:[&:not(:has(:focus))]:border-input-border-hover [&:has(:focus)]:border-accent [&:has(:focus)]:ring-primary',
|
|
82
84
|
disabled && 'bg-input-bg-disabled cursor-not-allowed'
|
|
83
85
|
)}
|
|
84
86
|
>
|
|
@@ -107,8 +109,8 @@
|
|
|
107
109
|
</DatePicker.Content>
|
|
108
110
|
</DatePicker.Root>
|
|
109
111
|
{#if showError && errorMessage}
|
|
110
|
-
<span class="text-tiny text-error">{errorMessage}</span>
|
|
112
|
+
<span class="absolute bottom-0 left-0 text-tiny text-error" data-field-error>{errorMessage}</span>
|
|
111
113
|
{:else if helperText}
|
|
112
|
-
<span class="text-tiny text-secondary">{helperText}</span>
|
|
114
|
+
<span class="absolute bottom-0 left-0 text-tiny text-secondary">{helperText}</span>
|
|
113
115
|
{/if}
|
|
114
116
|
</div>
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
placeholder?: string
|
|
16
16
|
label?: string
|
|
17
17
|
disabled?: boolean
|
|
18
|
+
error?: boolean
|
|
19
|
+
errorMessage?: string
|
|
18
20
|
onSelect?: (value: string) => void
|
|
21
|
+
onblur?: () => void
|
|
19
22
|
matchTriggerWidth?: boolean
|
|
20
23
|
renderItem?: Snippet<[item: MenuItem, selected: boolean]>
|
|
21
24
|
renderSelected?: Snippet<[item: MenuItem]>
|
|
@@ -30,7 +33,10 @@
|
|
|
30
33
|
placeholder = 'Select...',
|
|
31
34
|
label,
|
|
32
35
|
disabled = false,
|
|
36
|
+
error = false,
|
|
37
|
+
errorMessage,
|
|
33
38
|
onSelect,
|
|
39
|
+
onblur,
|
|
34
40
|
matchTriggerWidth = false,
|
|
35
41
|
renderItem,
|
|
36
42
|
renderSelected,
|
|
@@ -39,6 +45,8 @@
|
|
|
39
45
|
class: className,
|
|
40
46
|
}: Props = $props()
|
|
41
47
|
|
|
48
|
+
const showError = $derived(error || !!errorMessage)
|
|
49
|
+
|
|
42
50
|
const density = useDensity()
|
|
43
51
|
|
|
44
52
|
const densityClasses = {
|
|
@@ -79,6 +87,7 @@
|
|
|
79
87
|
value = item.value
|
|
80
88
|
open = false
|
|
81
89
|
onSelect?.(item.value)
|
|
90
|
+
onblur?.()
|
|
82
91
|
triggerEl?.focus()
|
|
83
92
|
}
|
|
84
93
|
|
|
@@ -144,6 +153,7 @@
|
|
|
144
153
|
function close() {
|
|
145
154
|
open = false
|
|
146
155
|
triggerEl?.focus()
|
|
156
|
+
onblur?.()
|
|
147
157
|
}
|
|
148
158
|
|
|
149
159
|
$effect(() => {
|
|
@@ -214,7 +224,7 @@
|
|
|
214
224
|
}
|
|
215
225
|
</script>
|
|
216
226
|
|
|
217
|
-
<div class="flex flex-col">
|
|
227
|
+
<div class="relative flex flex-col pb-20">
|
|
218
228
|
{#if label}
|
|
219
229
|
<span class="text-small-emphasis text-secondary mb-4">{label}</span>
|
|
220
230
|
{/if}
|
|
@@ -226,9 +236,12 @@
|
|
|
226
236
|
aria-expanded={open}
|
|
227
237
|
{disabled}
|
|
228
238
|
class={cn(
|
|
229
|
-
'flex items-center justify-between gap-4 py-5 pl-12 pr-8 border bg-input-bg cursor-default text-button-secondary box-border appearance-none font-inherit outline-none transition-colors duration-base ease-in-out hover:text-button-secondary-hover
|
|
239
|
+
'flex items-center justify-between gap-4 py-5 pl-12 pr-8 border bg-input-bg cursor-default text-button-secondary box-border appearance-none font-inherit outline-none transition-colors duration-base ease-in-out hover:text-button-secondary-hover focus-visible:ring-3 disabled:opacity-50 disabled:cursor-not-allowed',
|
|
230
240
|
densityClasses[density.value],
|
|
231
|
-
|
|
241
|
+
showError
|
|
242
|
+
? 'border-input-border-error hover:border-input-border-error focus-visible:border-input-border-error focus-visible:ring-error'
|
|
243
|
+
: cn('hover:not-focus-visible:border-button-secondary-hover focus-visible:border-accent focus-visible:ring-primary', open ? 'border-button-secondary-hover' : 'border-button-secondary'),
|
|
244
|
+
|
|
232
245
|
className
|
|
233
246
|
)}
|
|
234
247
|
onclick={toggle}
|
|
@@ -304,4 +317,7 @@
|
|
|
304
317
|
</div>
|
|
305
318
|
</div>
|
|
306
319
|
{/if}
|
|
320
|
+
{#if showError && errorMessage}
|
|
321
|
+
<span class="absolute bottom-0 left-0 text-tiny text-error" data-field-error>{errorMessage}</span>
|
|
322
|
+
{/if}
|
|
307
323
|
</div>
|
|
@@ -6,7 +6,10 @@ type Props = {
|
|
|
6
6
|
placeholder?: string;
|
|
7
7
|
label?: string;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
error?: boolean;
|
|
10
|
+
errorMessage?: string;
|
|
9
11
|
onSelect?: (value: string) => void;
|
|
12
|
+
onblur?: () => void;
|
|
10
13
|
matchTriggerWidth?: boolean;
|
|
11
14
|
renderItem?: Snippet<[item: MenuItem, selected: boolean]>;
|
|
12
15
|
renderSelected?: Snippet<[item: MenuItem]>;
|
|
@@ -47,22 +47,9 @@
|
|
|
47
47
|
const isSearch = $derived(type === 'search')
|
|
48
48
|
const showClear = $derived(isSearch && !!value)
|
|
49
49
|
const hasAddons = $derived(!!prefix || !!suffix || isSearch)
|
|
50
|
-
let shouldShake = $state(false)
|
|
51
|
-
let prevShowError = $state(false)
|
|
52
|
-
|
|
53
|
-
$effect(() => {
|
|
54
|
-
if (showError && !prevShowError) {
|
|
55
|
-
shouldShake = true
|
|
56
|
-
const timer = setTimeout(() => {
|
|
57
|
-
shouldShake = false
|
|
58
|
-
}, 400)
|
|
59
|
-
return () => clearTimeout(timer)
|
|
60
|
-
}
|
|
61
|
-
prevShowError = showError
|
|
62
|
-
})
|
|
63
50
|
</script>
|
|
64
51
|
|
|
65
|
-
<div class={cn('flex flex-col', className)}>
|
|
52
|
+
<div class={cn('relative flex flex-col pb-20', className)}>
|
|
66
53
|
{#if label}
|
|
67
54
|
<label for={restProps.id} class="text-small-emphasis text-secondary mb-4">
|
|
68
55
|
{label}
|
|
@@ -71,11 +58,12 @@
|
|
|
71
58
|
{#if hasAddons}
|
|
72
59
|
<div
|
|
73
60
|
class={cn(
|
|
74
|
-
'flex items-center bg-input-bg border border-button-secondary transition-all duration-fast
|
|
61
|
+
'flex items-center bg-input-bg border border-button-secondary transition-all duration-fast focus-within:ring-3 motion-reduce:transition-none',
|
|
75
62
|
densityClasses[density.value],
|
|
76
|
-
showError
|
|
77
|
-
|
|
78
|
-
|
|
63
|
+
showError
|
|
64
|
+
? 'border-input-border-error hover:border-input-border-error focus-within:border-input-border-error focus-within:ring-error'
|
|
65
|
+
: 'hover:not-focus-within:border-button-secondary-hover focus-within:border-accent focus-within:ring-primary',
|
|
66
|
+
disabled && 'bg-input-bg-disabled cursor-not-allowed'
|
|
79
67
|
)}
|
|
80
68
|
>
|
|
81
69
|
{#if prefix}
|
|
@@ -117,17 +105,18 @@
|
|
|
117
105
|
{type}
|
|
118
106
|
{disabled}
|
|
119
107
|
class={cn(
|
|
120
|
-
'py-5 px-12 font-[family-name:var(--font-family)] text-input-text bg-input-bg border border-button-secondary transition-all duration-fast outline-none w-full box-border placeholder:text-input-placeholder
|
|
108
|
+
'py-5 px-12 font-[family-name:var(--font-family)] text-input-text bg-input-bg border border-button-secondary transition-all duration-fast outline-none w-full box-border placeholder:text-input-placeholder focus:ring-3 disabled:bg-input-bg-disabled disabled:text-input-text-disabled disabled:cursor-not-allowed motion-reduce:transition-none motion-reduce:animate-none',
|
|
121
109
|
densityClasses[density.value],
|
|
122
|
-
showError
|
|
123
|
-
|
|
110
|
+
showError
|
|
111
|
+
? 'border-input-border-error hover:border-input-border-error focus:border-input-border-error focus:ring-error'
|
|
112
|
+
: 'hover:not-focus:border-button-secondary-hover focus:border-accent focus:ring-primary'
|
|
124
113
|
)}
|
|
125
114
|
{...restProps}
|
|
126
115
|
/>
|
|
127
116
|
{/if}
|
|
128
117
|
{#if showError && errorMessage}
|
|
129
|
-
<span class="text-tiny text-error
|
|
118
|
+
<span class="absolute bottom-0 left-0 text-tiny text-error" data-field-error>{errorMessage}</span>
|
|
130
119
|
{:else if helperText}
|
|
131
|
-
<span class="text-tiny text-secondary
|
|
120
|
+
<span class="absolute bottom-0 left-0 text-tiny text-secondary">{helperText}</span>
|
|
132
121
|
{/if}
|
|
133
122
|
</div>
|
|
@@ -36,6 +36,19 @@
|
|
|
36
36
|
open = newOpen
|
|
37
37
|
onOpenChange?.(newOpen)
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
// Portaled menu/listbox content (IIDropdownMenu, bits-ui DropdownMenu/Popover/Select, etc.)
|
|
41
|
+
// lives in document.body outside Dialog.Content, so bits-ui's DismissibleLayer would treat
|
|
42
|
+
// interactions with them as "outside" the modal and close it. Preserve those events.
|
|
43
|
+
function isInsidePortaledMenu(target: Element | null): boolean {
|
|
44
|
+
if (!target) return false
|
|
45
|
+
return !!(
|
|
46
|
+
target.closest('[data-menu-content]') ||
|
|
47
|
+
target.closest('[data-popper-content-wrapper]') ||
|
|
48
|
+
target.closest('[role="menu"]') ||
|
|
49
|
+
target.closest('[role="listbox"]')
|
|
50
|
+
)
|
|
51
|
+
}
|
|
39
52
|
</script>
|
|
40
53
|
|
|
41
54
|
<Dialog.Root {open} onOpenChange={handleOpenChange}>
|
|
@@ -50,6 +63,14 @@
|
|
|
50
63
|
/>
|
|
51
64
|
<Dialog.Content
|
|
52
65
|
onOpenAutoFocus={e => e.preventDefault()}
|
|
66
|
+
onInteractOutside={e => {
|
|
67
|
+
const target = e.target as Element | null
|
|
68
|
+
if (isInsidePortaledMenu(target)) e.preventDefault()
|
|
69
|
+
}}
|
|
70
|
+
onFocusOutside={e => {
|
|
71
|
+
const target = e.target as Element | null
|
|
72
|
+
if (isInsidePortaledMenu(target)) e.preventDefault()
|
|
73
|
+
}}
|
|
53
74
|
class={cn(
|
|
54
75
|
'fixed top-[30%] left-1/2 -translate-x-1/2 -translate-y-1/2 bg-surface rounded-12 w-[calc(100%-20px)] max-h-[90vh] flex flex-col z-15 data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out motion-reduce:animate-none focus:outline-none',
|
|
55
76
|
overlay === 'none' ? 'shadow-floating' : 'shadow-modal',
|
|
@@ -1,94 +1,90 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type {Snippet} from 'svelte'
|
|
3
|
-
import {DropdownMenu, Tabs
|
|
3
|
+
import {DropdownMenu, Tabs} from 'bits-ui'
|
|
4
4
|
import {IIIcon} from '../IIIcon'
|
|
5
|
+
import IIButton from '../IIButton/IIButton.svelte'
|
|
5
6
|
import {cn} from '../utils/cn'
|
|
6
|
-
import {useDensity} from '../density'
|
|
7
7
|
|
|
8
8
|
type Tab = {
|
|
9
9
|
value: string
|
|
10
10
|
label: string
|
|
11
11
|
icon?: Snippet
|
|
12
12
|
disabled?: boolean
|
|
13
|
-
trigger?: Snippet
|
|
14
|
-
content: Snippet
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
type Props =
|
|
15
|
+
type Props = {
|
|
18
16
|
tabs: Tab[]
|
|
17
|
+
value: string
|
|
18
|
+
onChange: (value: string) => void
|
|
19
19
|
class?: string
|
|
20
|
-
listClass?: string
|
|
21
|
-
contentClass?: string
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
let {
|
|
25
|
-
value = $bindable(),
|
|
26
|
-
tabs,
|
|
27
|
-
class: className,
|
|
28
|
-
listClass,
|
|
29
|
-
contentClass,
|
|
30
|
-
onValueChange,
|
|
31
|
-
...restProps
|
|
32
|
-
}: Props = $props()
|
|
22
|
+
let {tabs, value, onChange, class: className}: Props = $props()
|
|
33
23
|
|
|
34
|
-
let internalRef = $state(null)
|
|
35
24
|
let listEl = $state<HTMLElement | null>(null)
|
|
36
25
|
let overflowing = $state(false)
|
|
37
26
|
let dropdownOpen = $state(false)
|
|
38
27
|
|
|
39
|
-
const density = useDensity()
|
|
40
|
-
|
|
41
|
-
const densityRadius = {
|
|
42
|
-
compact: 'rounded-control',
|
|
43
|
-
default: 'rounded-control',
|
|
44
|
-
comfortable: 'rounded-control',
|
|
45
|
-
mobile: 'rounded-control',
|
|
46
|
-
} as const
|
|
47
|
-
|
|
48
28
|
const activeLabel = $derived(tabs.find(t => t.value === value)?.label ?? '')
|
|
49
29
|
|
|
50
30
|
$effect(() => {
|
|
51
31
|
if (!listEl) return
|
|
52
|
-
|
|
53
32
|
function check() {
|
|
54
33
|
if (!listEl) return
|
|
55
34
|
overflowing = listEl.scrollWidth > listEl.clientWidth + 1
|
|
56
35
|
}
|
|
57
|
-
|
|
58
36
|
check()
|
|
59
37
|
const observer = new ResizeObserver(check)
|
|
60
38
|
observer.observe(listEl)
|
|
61
39
|
return () => observer.disconnect()
|
|
62
40
|
})
|
|
63
41
|
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
onValueChange?.(tab.value)
|
|
42
|
+
function handleSelect(tab: Tab) {
|
|
43
|
+
onChange(tab.value)
|
|
67
44
|
dropdownOpen = false
|
|
68
45
|
}
|
|
69
46
|
</script>
|
|
70
47
|
|
|
71
|
-
<Tabs.Root
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
48
|
+
<Tabs.Root {value} onValueChange={onChange} class={cn('relative w-full h-full', className)}>
|
|
49
|
+
<Tabs.List
|
|
50
|
+
bind:ref={listEl}
|
|
51
|
+
class={cn(
|
|
52
|
+
'flex gap-16 pl-24 overflow-hidden h-full w-full',
|
|
53
|
+
overflowing && 'invisible pointer-events-none'
|
|
54
|
+
)}
|
|
55
|
+
>
|
|
56
|
+
{#each tabs as tab (tab.value)}
|
|
57
|
+
<Tabs.Trigger
|
|
58
|
+
value={tab.value}
|
|
59
|
+
disabled={tab.disabled}
|
|
60
|
+
class="appearance-none border-none bg-transparent outline-none inline-flex items-center gap-8 p-0 h-full text-small font-normal text-tertiary cursor-default -mb-px whitespace-nowrap relative shrink-0 hover:text-secondary data-[state=active]:text-body data-[disabled]:text-tertiary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 motion-reduce:[transition:none] [transition:color_0.15s_ease] after:content-[''] after:absolute after:bottom-0 after:left-1/2 after:w-0 after:-translate-x-1/2 after:[height:1.5px] after:[transition:width_0.15s_ease,background-color_0.15s_ease] data-[state=active]:after:w-full data-[state=active]:after:bg-dark [&:hover:not([data-disabled]):not([data-state=active])]:after:w-3/5 [&:hover:not([data-disabled]):not([data-state=active])]:after:bg-dark-secondary"
|
|
61
|
+
>
|
|
62
|
+
{#if tab.icon}
|
|
63
|
+
<div class="w-[1.25em] h-[1.25em] flex items-center justify-center">
|
|
64
|
+
{@render tab.icon()}
|
|
65
|
+
</div>
|
|
66
|
+
{/if}
|
|
67
|
+
{tab.label}
|
|
68
|
+
</Tabs.Trigger>
|
|
69
|
+
{/each}
|
|
70
|
+
</Tabs.List>
|
|
71
|
+
|
|
78
72
|
{#if overflowing}
|
|
79
|
-
<div
|
|
73
|
+
<div
|
|
74
|
+
class="absolute inset-0 flex items-center"
|
|
75
|
+
style="padding-left: calc(2.4rem - 1.2rem - 1px)"
|
|
76
|
+
>
|
|
80
77
|
<DropdownMenu.Root bind:open={dropdownOpen}>
|
|
81
|
-
<DropdownMenu.Trigger
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<IIIcon iconName="caret-down" class="w-14 h-14 text-secondary shrink-0" />
|
|
78
|
+
<DropdownMenu.Trigger>
|
|
79
|
+
{#snippet child({props})}
|
|
80
|
+
<IIButton {...props} variant="ghost">
|
|
81
|
+
{activeLabel}
|
|
82
|
+
<IIIcon iconName="caret-down" class="w-14 h-14 shrink-0" />
|
|
83
|
+
</IIButton>
|
|
84
|
+
{/snippet}
|
|
89
85
|
</DropdownMenu.Trigger>
|
|
90
86
|
<DropdownMenu.Content
|
|
91
|
-
class="min-w-100 bg-surface border border-primary rounded-10 shadow-dropdown p-4 z-12"
|
|
87
|
+
class="min-w-100 bg-surface border border-primary rounded-10 shadow-dropdown p-4 z-12 pointer-events-auto"
|
|
92
88
|
side="bottom"
|
|
93
89
|
align="start"
|
|
94
90
|
>
|
|
@@ -99,7 +95,7 @@
|
|
|
99
95
|
'flex items-center justify-between gap-12 px-12 py-8 rounded-4 text-small-emphasis text-secondary cursor-default outline-none transition-all duration-fast hover:bg-background hover:text-body data-[highlighted]:bg-background data-[highlighted]:text-body data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none motion-reduce:transition-none',
|
|
100
96
|
value === tab.value && 'text-body'
|
|
101
97
|
)}
|
|
102
|
-
onSelect={() =>
|
|
98
|
+
onSelect={() => handleSelect(tab)}
|
|
103
99
|
>
|
|
104
100
|
<span>{tab.label}</span>
|
|
105
101
|
{#if value === tab.value}
|
|
@@ -111,42 +107,4 @@
|
|
|
111
107
|
</DropdownMenu.Root>
|
|
112
108
|
</div>
|
|
113
109
|
{/if}
|
|
114
|
-
<Tabs.List
|
|
115
|
-
bind:ref={listEl}
|
|
116
|
-
class={cn(
|
|
117
|
-
'flex border-b border-primary gap-16 pl-24 overflow-hidden',
|
|
118
|
-
overflowing && '!h-0 invisible border-b-0 py-0',
|
|
119
|
-
listClass
|
|
120
|
-
)}
|
|
121
|
-
>
|
|
122
|
-
{#each tabs as tab (tab.value)}
|
|
123
|
-
<Tabs.Trigger
|
|
124
|
-
value={tab.value}
|
|
125
|
-
disabled={tab.disabled}
|
|
126
|
-
class="appearance-none border-none bg-transparent outline-none inline-flex items-center gap-8 p-0 h-full text-small font-normal text-tertiary cursor-default -mb-px whitespace-nowrap relative shrink-0 hover:text-secondary data-[state=active]:text-body data-[disabled]:text-tertiary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 motion-reduce:[transition:none] [transition:color_0.15s_ease] after:content-[''] after:absolute after:bottom-0 after:left-1/2 after:w-0 after:-translate-x-1/2 after:[height:1.5px] after:[transition:width_0.15s_ease,background-color_0.15s_ease] data-[state=active]:after:w-full data-[state=active]:after:bg-dark [&:hover:not([data-disabled]):not([data-state=active])]:after:w-3/5 [&:hover:not([data-disabled]):not([data-state=active])]:after:bg-dark-secondary"
|
|
127
|
-
>
|
|
128
|
-
{#if tab.trigger}
|
|
129
|
-
{@render tab.trigger()}
|
|
130
|
-
{:else}
|
|
131
|
-
{#if tab.icon}
|
|
132
|
-
<div class="w-[1.25em] h-[1.25em] flex items-center justify-center">
|
|
133
|
-
{@render tab.icon()}
|
|
134
|
-
</div>
|
|
135
|
-
{/if}
|
|
136
|
-
{tab.label}
|
|
137
|
-
{/if}
|
|
138
|
-
</Tabs.Trigger>
|
|
139
|
-
{/each}
|
|
140
|
-
</Tabs.List>
|
|
141
|
-
{#each tabs as tab (tab.value)}
|
|
142
|
-
<Tabs.Content
|
|
143
|
-
value={tab.value}
|
|
144
|
-
class={cn(
|
|
145
|
-
'flex-1 min-h-0 outline-none focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2 focus-visible:rounded-4',
|
|
146
|
-
contentClass
|
|
147
|
-
)}
|
|
148
|
-
>
|
|
149
|
-
{@render tab.content()}
|
|
150
|
-
</Tabs.Content>
|
|
151
|
-
{/each}
|
|
152
110
|
</Tabs.Root>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type Tab = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: Snippet;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type Props = {
|
|
9
|
+
tabs: Tab[];
|
|
10
|
+
value: string;
|
|
11
|
+
onChange: (value: string) => void;
|
|
12
|
+
class?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const IITabBar: import("svelte").Component<Props, {}, "">;
|
|
15
|
+
type IITabBar = ReturnType<typeof IITabBar>;
|
|
16
|
+
export default IITabBar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as IITabBar } from './IITabBar.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as IITabBar } from './IITabBar.svelte';
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export { IIStepper } from './IIStepper';
|
|
|
37
37
|
export { IISwitch } from './IISwitch';
|
|
38
38
|
export { IITable } from './IITable';
|
|
39
39
|
export { IITableSkeleton } from './IITableSkeleton';
|
|
40
|
-
export {
|
|
40
|
+
export { IITabBar } from './IITabBar';
|
|
41
41
|
export { IITaskCardSkeleton } from './IITaskCardSkeleton';
|
|
42
42
|
export { IITextarea } from './IITextarea';
|
|
43
43
|
export { IIToggle } from './IIToggle';
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export { IIStepper } from './IIStepper';
|
|
|
41
41
|
export { IISwitch } from './IISwitch';
|
|
42
42
|
export { IITable } from './IITable';
|
|
43
43
|
export { IITableSkeleton } from './IITableSkeleton';
|
|
44
|
-
export {
|
|
44
|
+
export { IITabBar } from './IITabBar';
|
|
45
45
|
export { IITaskCardSkeleton } from './IITaskCardSkeleton';
|
|
46
46
|
export { IITextarea } from './IITextarea';
|
|
47
47
|
export { IIToggle } from './IIToggle';
|
package/dist/style/colors.css
CHANGED
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
--color-input-border: #d1d5db;
|
|
70
70
|
--color-input-border-hover: #9ca3af;
|
|
71
71
|
--color-input-border-active: #111827;
|
|
72
|
-
--color-input-border-error: var(--ii-error);
|
|
72
|
+
--color-input-border-error: var(--ii-error-text);
|
|
73
73
|
--color-input-text: var(--ii-text-primary);
|
|
74
74
|
--color-input-text-disabled: var(--ii-text-secondary);
|
|
75
75
|
--color-input-placeholder: var(--ii-text-tertiary);
|
|
@@ -2,9 +2,9 @@ export declare const menuStyles: {
|
|
|
2
2
|
readonly item: "flex items-center gap-8 px-12 py-8 rounded-4 text-small cursor-default select-none outline-none data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none motion-reduce:transition-none";
|
|
3
3
|
readonly itemDefault: "text-dropdown-item hover:bg-dropdown-item-hover focus:bg-dropdown-item-hover data-[highlighted]:bg-dropdown-item-hover data-[highlighted]:outline-none data-[state=open]:bg-dropdown-item-hover";
|
|
4
4
|
readonly itemDestructive: "text-error hover:bg-error-bg focus:bg-error-bg data-[highlighted]:bg-error-bg data-[highlighted]:outline-none";
|
|
5
|
-
readonly content: "min-w-48 max-h-300 overflow-y-auto bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-dropdown p-4 z-12 outline-none origin-top-left animate-scale-in motion-reduce:animate-none";
|
|
5
|
+
readonly content: "min-w-48 max-h-300 overflow-y-auto bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-dropdown p-4 z-12 pointer-events-auto outline-none origin-top-left animate-scale-in motion-reduce:animate-none";
|
|
6
6
|
readonly subContent: "min-w-48 max-h-300 overflow-y-auto bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-submenu p-4 z-12 outline-none origin-top-left animate-scale-in motion-reduce:animate-none";
|
|
7
|
-
readonly searchableSubContent: "min-w-48 bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-submenu p-4 z-12 outline-none overflow-hidden origin-top-left animate-scale-in motion-reduce:animate-none";
|
|
7
|
+
readonly searchableSubContent: "min-w-48 bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-submenu p-4 z-12 pointer-events-auto outline-none overflow-hidden origin-top-left animate-scale-in motion-reduce:animate-none";
|
|
8
8
|
readonly scrollableItems: "max-h-250 overflow-y-auto overflow-x-hidden";
|
|
9
9
|
readonly separator: "h-1 bg-muted -mx-4 my-4";
|
|
10
10
|
readonly groupHeading: "text-tiny-emphasis text-secondary px-12 py-4 uppercase select-none";
|
|
@@ -3,9 +3,9 @@ export const menuStyles = {
|
|
|
3
3
|
item: 'flex items-center gap-8 px-12 py-8 rounded-4 text-small cursor-default select-none outline-none data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none motion-reduce:transition-none',
|
|
4
4
|
itemDefault: 'text-dropdown-item hover:bg-dropdown-item-hover focus:bg-dropdown-item-hover data-[highlighted]:bg-dropdown-item-hover data-[highlighted]:outline-none data-[state=open]:bg-dropdown-item-hover',
|
|
5
5
|
itemDestructive: 'text-error hover:bg-error-bg focus:bg-error-bg data-[highlighted]:bg-error-bg data-[highlighted]:outline-none',
|
|
6
|
-
content: 'min-w-48 max-h-300 overflow-y-auto bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-dropdown p-4 z-12 outline-none origin-top-left animate-scale-in motion-reduce:animate-none',
|
|
6
|
+
content: 'min-w-48 max-h-300 overflow-y-auto bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-dropdown p-4 z-12 pointer-events-auto outline-none origin-top-left animate-scale-in motion-reduce:animate-none',
|
|
7
7
|
subContent: 'min-w-48 max-h-300 overflow-y-auto bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-submenu p-4 z-12 outline-none origin-top-left animate-scale-in motion-reduce:animate-none',
|
|
8
|
-
searchableSubContent: 'min-w-48 bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-submenu p-4 z-12 outline-none overflow-hidden origin-top-left animate-scale-in motion-reduce:animate-none',
|
|
8
|
+
searchableSubContent: 'min-w-48 bg-dropdown-bg border-[0.5px] border-dropdown-border rounded-10 shadow-submenu p-4 z-12 pointer-events-auto outline-none overflow-hidden origin-top-left animate-scale-in motion-reduce:animate-none',
|
|
9
9
|
scrollableItems: 'max-h-250 overflow-y-auto overflow-x-hidden',
|
|
10
10
|
separator: 'h-1 bg-muted -mx-4 my-4',
|
|
11
11
|
groupHeading: 'text-tiny-emphasis text-secondary px-12 py-4 uppercase select-none',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@insymetri/styleguide",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
4
4
|
"description": "Insymetri shared UI component library built with Svelte 5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -54,6 +54,9 @@
|
|
|
54
54
|
"bits-ui": "^2.11.4",
|
|
55
55
|
"svelte-sonner": "^1.0.6"
|
|
56
56
|
},
|
|
57
|
+
"overrides": {
|
|
58
|
+
"esbuild": "0.27.4"
|
|
59
|
+
},
|
|
57
60
|
"devDependencies": {
|
|
58
61
|
"@storybook/addon-docs": "^10.2.10",
|
|
59
62
|
"@storybook/svelte-vite": "^10.2.10",
|
|
@@ -73,9 +76,6 @@
|
|
|
73
76
|
"type": "git",
|
|
74
77
|
"url": ""
|
|
75
78
|
},
|
|
76
|
-
"overrides": {
|
|
77
|
-
"esbuild": "0.27.4"
|
|
78
|
-
},
|
|
79
79
|
"optionalDependencies": {
|
|
80
80
|
"@rollup/rollup-darwin-arm64": "^4.60.1"
|
|
81
81
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import { Tabs, type WithoutChildrenOrChild } from 'bits-ui';
|
|
3
|
-
type Tab = {
|
|
4
|
-
value: string;
|
|
5
|
-
label: string;
|
|
6
|
-
icon?: Snippet;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
trigger?: Snippet;
|
|
9
|
-
content: Snippet;
|
|
10
|
-
};
|
|
11
|
-
type Props = WithoutChildrenOrChild<Tabs.RootProps> & {
|
|
12
|
-
tabs: Tab[];
|
|
13
|
-
class?: string;
|
|
14
|
-
listClass?: string;
|
|
15
|
-
contentClass?: string;
|
|
16
|
-
};
|
|
17
|
-
declare const IITabs: import("svelte").Component<Props, {}, "value">;
|
|
18
|
-
type IITabs = ReturnType<typeof IITabs>;
|
|
19
|
-
export default IITabs;
|
package/dist/IITabs/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as IITabs } from './IITabs.svelte';
|
package/dist/IITabs/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as IITabs } from './IITabs.svelte';
|