@makolabs/ripple 0.0.1-dev.3 → 0.0.1-dev.31
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/README.md +571 -98
- package/dist/button/Button.svelte +48 -0
- package/dist/button/Button.svelte.d.ts +4 -0
- package/dist/button/button.d.ts +113 -0
- package/dist/button/button.js +168 -0
- package/dist/charts/Chart.svelte +543 -0
- package/dist/charts/Chart.svelte.d.ts +4 -0
- package/dist/drawer/Drawer.svelte +224 -0
- package/dist/drawer/Drawer.svelte.d.ts +4 -0
- package/dist/drawer/drawer.d.ts +160 -0
- package/dist/drawer/drawer.js +80 -0
- package/dist/elements/alert/Alert.svelte +57 -0
- package/dist/elements/alert/Alert.svelte.d.ts +4 -0
- package/dist/elements/badge/Badge.svelte +43 -0
- package/dist/elements/badge/Badge.svelte.d.ts +4 -0
- package/dist/elements/badge/badge.d.ts +181 -0
- package/dist/elements/badge/badge.js +65 -0
- package/dist/elements/dropdown/Dropdown.svelte +267 -0
- package/dist/elements/dropdown/Dropdown.svelte.d.ts +4 -0
- package/dist/elements/dropdown/Select.svelte +314 -0
- package/dist/elements/dropdown/Select.svelte.d.ts +4 -0
- package/dist/elements/dropdown/dropdown.d.ts +251 -0
- package/dist/elements/dropdown/dropdown.js +95 -0
- package/dist/elements/dropdown/select.d.ts +200 -0
- package/dist/elements/dropdown/select.js +82 -0
- package/dist/elements/file-upload/FileUpload.svelte +130 -0
- package/dist/elements/file-upload/FileUpload.svelte.d.ts +4 -0
- package/dist/elements/file-upload/FilesPreview.svelte +93 -0
- package/dist/elements/file-upload/FilesPreview.svelte.d.ts +4 -0
- package/dist/elements/progress/Progress.svelte +145 -0
- package/dist/elements/progress/Progress.svelte.d.ts +4 -0
- package/dist/elements/timeline/Timeline.svelte +92 -0
- package/dist/elements/timeline/Timeline.svelte.d.ts +7 -0
- package/dist/forms/Checkbox.svelte +54 -0
- package/dist/forms/Checkbox.svelte.d.ts +4 -0
- package/dist/forms/DateRange.svelte +493 -0
- package/dist/forms/DateRange.svelte.d.ts +4 -0
- package/dist/forms/Form.svelte +39 -0
- package/dist/forms/Form.svelte.d.ts +4 -0
- package/dist/forms/Input.svelte +86 -0
- package/dist/forms/Input.svelte.d.ts +4 -0
- package/dist/forms/NumberInput.svelte +159 -0
- package/dist/forms/NumberInput.svelte.d.ts +4 -0
- package/dist/forms/RadioInputs.svelte +64 -0
- package/dist/forms/RadioInputs.svelte.d.ts +4 -0
- package/dist/forms/RadioPill.svelte +66 -0
- package/dist/forms/RadioPill.svelte.d.ts +4 -0
- package/dist/forms/Slider.svelte +342 -0
- package/dist/forms/Slider.svelte.d.ts +4 -0
- package/dist/forms/Tags.svelte +181 -0
- package/dist/forms/Tags.svelte.d.ts +4 -0
- package/dist/forms/Toggle.svelte +132 -0
- package/dist/forms/Toggle.svelte.d.ts +4 -0
- package/dist/forms/slider.d.ts +143 -0
- package/dist/forms/slider.js +62 -0
- package/dist/header/Breadcrumbs.svelte +73 -0
- package/dist/header/Breadcrumbs.svelte.d.ts +4 -0
- package/dist/header/PageHeader.svelte +30 -0
- package/dist/header/PageHeader.svelte.d.ts +4 -0
- package/dist/header/breadcrumbs.d.ts +226 -0
- package/dist/header/breadcrumbs.js +87 -0
- package/dist/helper/cls.d.ts +1 -0
- package/dist/helper/cls.js +4 -0
- package/dist/helper/date.d.ts +7 -0
- package/dist/helper/date.js +15 -0
- package/dist/helper/nav.svelte.d.ts +6 -0
- package/dist/helper/nav.svelte.js +23 -0
- package/dist/index.d.ts +731 -1
- package/dist/index.js +70 -1
- package/dist/layout/card/Card.svelte +41 -0
- package/dist/layout/card/Card.svelte.d.ts +4 -0
- package/dist/layout/card/StatsCard.svelte +266 -0
- package/dist/layout/card/StatsCard.svelte.d.ts +4 -0
- package/dist/layout/card/card.d.ts +128 -0
- package/dist/layout/card/card.js +51 -0
- package/dist/layout/card/stats-card.d.ts +191 -0
- package/dist/layout/card/stats-card.js +73 -0
- package/dist/layout/navbar/Navbar.svelte +206 -0
- package/dist/layout/navbar/Navbar.svelte.d.ts +4 -0
- package/dist/layout/navbar/navbar.d.ts +205 -0
- package/dist/layout/navbar/navbar.js +98 -0
- package/dist/layout/sidebar/NavGroup.svelte +97 -0
- package/dist/layout/sidebar/NavGroup.svelte.d.ts +4 -0
- package/dist/layout/sidebar/NavItem.svelte +29 -0
- package/dist/layout/sidebar/NavItem.svelte.d.ts +4 -0
- package/dist/layout/sidebar/Sidebar.svelte +139 -0
- package/dist/layout/sidebar/Sidebar.svelte.d.ts +4 -0
- package/dist/layout/table/Cells.svelte +111 -0
- package/dist/layout/table/Cells.svelte.d.ts +27 -0
- package/dist/layout/table/Table.svelte +413 -0
- package/dist/layout/table/Table.svelte.d.ts +4 -0
- package/dist/layout/table/table.d.ts +284 -0
- package/dist/layout/table/table.js +141 -0
- package/dist/layout/tabs/Tab.svelte +57 -0
- package/dist/layout/tabs/Tab.svelte.d.ts +4 -0
- package/dist/layout/tabs/TabContent.svelte +31 -0
- package/dist/layout/tabs/TabContent.svelte.d.ts +4 -0
- package/dist/layout/tabs/TabGroup.svelte +57 -0
- package/dist/layout/tabs/TabGroup.svelte.d.ts +4 -0
- package/dist/layout/tabs/tabs.d.ts +155 -0
- package/dist/layout/tabs/tabs.js +156 -0
- package/dist/modal/Modal.svelte +207 -0
- package/dist/modal/Modal.svelte.d.ts +4 -0
- package/dist/modal/modal.d.ts +211 -0
- package/dist/modal/modal.js +81 -0
- package/dist/sonner/sonner.svelte +13 -0
- package/dist/sonner/sonner.svelte.d.ts +4 -0
- package/dist/types/variants.d.ts +1 -0
- package/dist/types/variants.js +1 -0
- package/dist/variants.d.ts +30 -0
- package/dist/variants.js +36 -0
- package/package.json +104 -102
- package/dist/layout/Card.svelte +0 -179
- package/dist/layout/Card.svelte.d.ts +0 -208
- package/dist/layout/index.d.ts +0 -1
- package/dist/layout/index.js +0 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../helper/cls.js';
|
|
3
|
+
import { Size } from '../variants.js';
|
|
4
|
+
import type { InputProps } from '../index.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
name,
|
|
8
|
+
id = name,
|
|
9
|
+
type = 'text',
|
|
10
|
+
label,
|
|
11
|
+
placeholder,
|
|
12
|
+
disabled = false,
|
|
13
|
+
class: className = '',
|
|
14
|
+
size = Size.BASE,
|
|
15
|
+
value = $bindable(),
|
|
16
|
+
errors = [],
|
|
17
|
+
...restProps
|
|
18
|
+
}: InputProps = $props();
|
|
19
|
+
|
|
20
|
+
const BASIC_TYPES = ['text', 'email', 'password', 'number', 'tel', 'url', 'date', 'textarea'];
|
|
21
|
+
const inputClasses = $derived(
|
|
22
|
+
cn(
|
|
23
|
+
'transition-colors',
|
|
24
|
+
{
|
|
25
|
+
'border rounded-lg shadow-sm w-full bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2':
|
|
26
|
+
BASIC_TYPES.includes(type),
|
|
27
|
+
'w-full bg-white px-3 py-2 text-sm resize-y min-h-[100px]': type === 'textarea',
|
|
28
|
+
'border-red-300 focus:border-red-500 focus:ring-red-500': errors.length,
|
|
29
|
+
'opacity-50 cursor-not-allowed': disabled,
|
|
30
|
+
...(BASIC_TYPES.includes(type)
|
|
31
|
+
? {
|
|
32
|
+
'h-8 text-sm': size === Size.SM,
|
|
33
|
+
'h-10 text-base': size === Size.BASE,
|
|
34
|
+
'h-12 text-lg': size === Size.LG
|
|
35
|
+
}
|
|
36
|
+
: {}),
|
|
37
|
+
'border-default-300 focus:border-primary-500 focus:ring-primary-500': !errors.length
|
|
38
|
+
},
|
|
39
|
+
className
|
|
40
|
+
)
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const inputCommonProps = $derived({
|
|
44
|
+
id,
|
|
45
|
+
name,
|
|
46
|
+
type,
|
|
47
|
+
placeholder,
|
|
48
|
+
disabled,
|
|
49
|
+
class: inputClasses,
|
|
50
|
+
'aria-invalid': !!errors.length,
|
|
51
|
+
'aria-describedby': errors.length ? `${name}-errors` : undefined,
|
|
52
|
+
...restProps
|
|
53
|
+
});
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<div class="w-full">
|
|
57
|
+
{@render Label('mb-2')}
|
|
58
|
+
{#if type === 'textarea'}
|
|
59
|
+
<textarea {...inputCommonProps} bind:value></textarea>
|
|
60
|
+
{:else}
|
|
61
|
+
<input {...inputCommonProps} bind:value />
|
|
62
|
+
{/if}
|
|
63
|
+
{#if errors.length}
|
|
64
|
+
{#each errors as error (error)}
|
|
65
|
+
<p id="{name}-errors" class="mt-1 text-sm text-red-600" role="alert">
|
|
66
|
+
{error}
|
|
67
|
+
</p>
|
|
68
|
+
{/each}
|
|
69
|
+
{/if}
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
{#snippet Label(extraClass = '')}
|
|
73
|
+
{#if label}
|
|
74
|
+
<label
|
|
75
|
+
for={id}
|
|
76
|
+
class={cn(
|
|
77
|
+
'block w-full text-sm font-medium',
|
|
78
|
+
{
|
|
79
|
+
'text-default-700': !errors.length,
|
|
80
|
+
'text-red-600': errors.length
|
|
81
|
+
},
|
|
82
|
+
extraClass
|
|
83
|
+
)}>{label}</label
|
|
84
|
+
>
|
|
85
|
+
{/if}
|
|
86
|
+
{/snippet}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../helper/cls.js';
|
|
3
|
+
import { Size } from '../variants.js';
|
|
4
|
+
import type { NumberInputProps } from '../index.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
value = $bindable(0),
|
|
8
|
+
unit = $bindable('USD'),
|
|
9
|
+
name,
|
|
10
|
+
label,
|
|
11
|
+
placeholder = 'Enter a number',
|
|
12
|
+
size = Size.BASE,
|
|
13
|
+
class: className = '',
|
|
14
|
+
units = [],
|
|
15
|
+
errors,
|
|
16
|
+
disabled = false,
|
|
17
|
+
dropdownicon: DropdownIcon,
|
|
18
|
+
onunitchange: onUnitChange,
|
|
19
|
+
...restProps
|
|
20
|
+
}: NumberInputProps = $props();
|
|
21
|
+
|
|
22
|
+
let showUnitDropdown = $state(false);
|
|
23
|
+
let containerRef = $state<HTMLDivElement | null>(null);
|
|
24
|
+
|
|
25
|
+
const selectedOption = $derived(units.find((u) => u.value === unit));
|
|
26
|
+
|
|
27
|
+
const containerClass = $derived(
|
|
28
|
+
cn(
|
|
29
|
+
'relative flex items-center gap-1 rounded-lg border bg-white shadow-sm',
|
|
30
|
+
{
|
|
31
|
+
'border-danger-300': errors?.length,
|
|
32
|
+
'cursor-not-allowed opacity-50': disabled
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
'h-8': size === Size.SM,
|
|
36
|
+
'h-10': size === Size.BASE,
|
|
37
|
+
'h-12': size === Size.LG
|
|
38
|
+
},
|
|
39
|
+
'border-default-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500 focus-within:ring-offset-2',
|
|
40
|
+
className
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const inputClass = $derived(
|
|
45
|
+
cn('w-full bg-transparent outline-none disabled:cursor-not-allowed px-3', {
|
|
46
|
+
'text-sm': size === Size.SM,
|
|
47
|
+
'text-base': size === Size.BASE,
|
|
48
|
+
'text-lg': size === Size.LG
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const dropdownClass = cn(
|
|
53
|
+
'absolute right-0 top-full z-50 mt-1 max-h-[200px] w-[100px] overflow-auto rounded-md border bg-white shadow-lg'
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const iconClass = $derived(
|
|
57
|
+
cn('h-4 w-4 transition-transform', { 'rotate-180': showUnitDropdown })
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
function handleUnitSelect(selectedUnit: string) {
|
|
61
|
+
onUnitChange?.(unit, selectedUnit);
|
|
62
|
+
unit = selectedUnit;
|
|
63
|
+
showUnitDropdown = false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function handleClickOutside(event: MouseEvent) {
|
|
67
|
+
const target = event.target as Node;
|
|
68
|
+
if (containerRef && !containerRef.contains(target)) {
|
|
69
|
+
showUnitDropdown = false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function handleUnitToggle() {
|
|
74
|
+
showUnitDropdown = !showUnitDropdown;
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<svelte:window onclick={handleClickOutside} />
|
|
79
|
+
|
|
80
|
+
<div class="space-y-1">
|
|
81
|
+
{#if label}
|
|
82
|
+
<label for={name} class="block text-sm font-medium text-default-700">{label}</label>
|
|
83
|
+
{/if}
|
|
84
|
+
<div class={containerClass} bind:this={containerRef}>
|
|
85
|
+
<svg
|
|
86
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
87
|
+
width="24"
|
|
88
|
+
height="24"
|
|
89
|
+
viewBox="0 0 24 24"
|
|
90
|
+
class="text-default-500 ml-3 size-4 flex-shrink-0"
|
|
91
|
+
>
|
|
92
|
+
<path
|
|
93
|
+
fill="none"
|
|
94
|
+
stroke="currentColor"
|
|
95
|
+
stroke-linecap="round"
|
|
96
|
+
stroke-linejoin="round"
|
|
97
|
+
stroke-width="2"
|
|
98
|
+
d="M17 9V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2m2 4h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2m7-5a2 2 0 1 1-4 0a2 2 0 0 1 4 0"
|
|
99
|
+
/>
|
|
100
|
+
</svg>
|
|
101
|
+
<input
|
|
102
|
+
{name}
|
|
103
|
+
id={name}
|
|
104
|
+
bind:value
|
|
105
|
+
type="number"
|
|
106
|
+
{placeholder}
|
|
107
|
+
{disabled}
|
|
108
|
+
class={inputClass}
|
|
109
|
+
{...restProps}
|
|
110
|
+
/>
|
|
111
|
+
|
|
112
|
+
<button
|
|
113
|
+
type="button"
|
|
114
|
+
class="hover:bg-default-100 flex items-center gap-1 rounded px-1"
|
|
115
|
+
onclick={handleUnitToggle}
|
|
116
|
+
{disabled}
|
|
117
|
+
>
|
|
118
|
+
{#if selectedOption?.icon}
|
|
119
|
+
{@const Icon = selectedOption.icon}
|
|
120
|
+
<Icon />
|
|
121
|
+
{/if}
|
|
122
|
+
<span class="text-sm">{unit}</span>
|
|
123
|
+
{#if DropdownIcon}
|
|
124
|
+
<DropdownIcon class={iconClass} />
|
|
125
|
+
{:else}
|
|
126
|
+
<svg class={iconClass} fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
127
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />
|
|
128
|
+
</svg>
|
|
129
|
+
{/if}
|
|
130
|
+
</button>
|
|
131
|
+
|
|
132
|
+
{#if showUnitDropdown}
|
|
133
|
+
<div class={dropdownClass}>
|
|
134
|
+
{#each units as unitOption}
|
|
135
|
+
<button
|
|
136
|
+
type="button"
|
|
137
|
+
class="hover:bg-default-100 w-full px-3 py-1.5 text-left text-sm"
|
|
138
|
+
class:bg-default-50={unit === unitOption.value}
|
|
139
|
+
onclick={() => handleUnitSelect(unitOption.value)}
|
|
140
|
+
>
|
|
141
|
+
<div class="flex items-center gap-2">
|
|
142
|
+
{#if unitOption.icon}
|
|
143
|
+
{@const Icon = unitOption.icon}
|
|
144
|
+
<Icon />
|
|
145
|
+
{/if}
|
|
146
|
+
{unitOption.value}
|
|
147
|
+
</div>
|
|
148
|
+
</button>
|
|
149
|
+
{/each}
|
|
150
|
+
</div>
|
|
151
|
+
{/if}
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
{#if errors?.length}
|
|
155
|
+
{#each errors as error}
|
|
156
|
+
<p class="text-danger-600 text-sm">{error}</p>
|
|
157
|
+
{/each}
|
|
158
|
+
{/if}
|
|
159
|
+
</div>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../helper/cls.js';
|
|
3
|
+
import type { RadioInputsProps } from '../index.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
name,
|
|
7
|
+
label,
|
|
8
|
+
options,
|
|
9
|
+
value = $bindable(),
|
|
10
|
+
disabled = false,
|
|
11
|
+
class: className = '',
|
|
12
|
+
errors = [],
|
|
13
|
+
required = false
|
|
14
|
+
}: RadioInputsProps = $props();
|
|
15
|
+
|
|
16
|
+
const containerClass = $derived(cn('space-y-2', className));
|
|
17
|
+
|
|
18
|
+
const radioClass = $derived(
|
|
19
|
+
cn('w-4 h-4 text-primary-600 border-default-300 focus:ring-primary-500', {
|
|
20
|
+
'opacity-50 cursor-not-allowed': disabled,
|
|
21
|
+
'border-red-300 focus:ring-red-500': errors.length
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const labelClass = $derived(
|
|
26
|
+
cn('block text-sm font-medium', {
|
|
27
|
+
'text-default-700': !errors.length,
|
|
28
|
+
'text-red-600': errors.length
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div class={containerClass}>
|
|
34
|
+
{#if label}
|
|
35
|
+
<label class={labelClass} for={`${name}-${value || options[0].value}`}>{label}</label>
|
|
36
|
+
{/if}
|
|
37
|
+
<div class="space-y-2">
|
|
38
|
+
{#each options as option}
|
|
39
|
+
<div class="flex items-center gap-2">
|
|
40
|
+
<input
|
|
41
|
+
type="radio"
|
|
42
|
+
{name}
|
|
43
|
+
id={`${name}-${option.value}`}
|
|
44
|
+
value={option.value}
|
|
45
|
+
bind:group={value}
|
|
46
|
+
class={radioClass}
|
|
47
|
+
{disabled}
|
|
48
|
+
{required}
|
|
49
|
+
aria-describedby={errors.length ? `${name}-errors` : undefined}
|
|
50
|
+
/>
|
|
51
|
+
<label for={`${name}-${option.value}`} class="text-sm text-default-700">
|
|
52
|
+
{option.label}
|
|
53
|
+
</label>
|
|
54
|
+
</div>
|
|
55
|
+
{/each}
|
|
56
|
+
</div>
|
|
57
|
+
{#if errors.length}
|
|
58
|
+
{#each errors as error (error)}
|
|
59
|
+
<p id={`${name}-errors`} class="mt-1 text-sm text-red-600" role="alert">
|
|
60
|
+
{error}
|
|
61
|
+
</p>
|
|
62
|
+
{/each}
|
|
63
|
+
{/if}
|
|
64
|
+
</div>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../helper/cls.js';
|
|
3
|
+
import type { RadioPillProps } from '../index.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
options = [],
|
|
7
|
+
value = $bindable(options.length > 0 ? options[0].value : ''),
|
|
8
|
+
name = '',
|
|
9
|
+
class: className = '',
|
|
10
|
+
errors = [],
|
|
11
|
+
onchange = undefined,
|
|
12
|
+
label = ''
|
|
13
|
+
}: RadioPillProps = $props();
|
|
14
|
+
|
|
15
|
+
function handleSelect(optionValue: string) {
|
|
16
|
+
value = optionValue;
|
|
17
|
+
if (onchange) onchange(optionValue);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let pillDivRef: HTMLDivElement;
|
|
21
|
+
const hasError = $derived(errors && errors.length > 0);
|
|
22
|
+
|
|
23
|
+
$effect(() => {
|
|
24
|
+
if (errors.length) {
|
|
25
|
+
pillDivRef.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<div class={cn('flex flex-col space-y-2', className)} bind:this={pillDivRef}>
|
|
31
|
+
{#if hasError}
|
|
32
|
+
<div class="text-danger-500 text-sm">{errors[0]}</div>
|
|
33
|
+
{/if}
|
|
34
|
+
{#if label}
|
|
35
|
+
<label
|
|
36
|
+
class={cn('text-sm font-medium', hasError ? 'text-danger-500' : 'text-default-700')}
|
|
37
|
+
for={value}>{label}</label
|
|
38
|
+
>
|
|
39
|
+
{/if}
|
|
40
|
+
<div class="inline-flex flex-wrap gap-2">
|
|
41
|
+
{#each options as option}
|
|
42
|
+
<button
|
|
43
|
+
id={option.value}
|
|
44
|
+
type="button"
|
|
45
|
+
onclick={() => handleSelect(option.value)}
|
|
46
|
+
class={cn(
|
|
47
|
+
'border-default-200 cursor-pointer rounded-lg border px-4 py-2 text-sm font-medium transition-all',
|
|
48
|
+
{
|
|
49
|
+
'border-info-600 bg-info-600 text-white': value === option.value && !hasError,
|
|
50
|
+
'border-danger-500 bg-danger-500 text-white': value === option.value && hasError,
|
|
51
|
+
'text-default-800 hover:border-default-300 bg-white':
|
|
52
|
+
value !== option.value && !hasError,
|
|
53
|
+
'border-danger-500 text-danger-500 hover:bg-danger-50':
|
|
54
|
+
value !== option.value && hasError,
|
|
55
|
+
'text-default-400': value !== option.value && option.value === '128' && !hasError
|
|
56
|
+
}
|
|
57
|
+
)}
|
|
58
|
+
aria-pressed={value === option.value}
|
|
59
|
+
>
|
|
60
|
+
{option.label}
|
|
61
|
+
</button>
|
|
62
|
+
{/each}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<input type="hidden" {name} {value} />
|