@svelte-atoms/core 1.0.0-alpha.29 → 1.0.0-alpha.30
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 +852 -852
- package/dist/attachments/clickout.svelte.d.ts +1 -1
- package/dist/attachments/clickout.svelte.js +2 -2
- package/dist/components/accordion/accordion-root.svelte +61 -61
- package/dist/components/accordion/accordion-root.svelte.d.ts +1 -1
- package/dist/components/accordion/accordion.stories.svelte +145 -134
- package/dist/components/alert/alert.stories.svelte +400 -401
- package/dist/components/atom/html-atom.svelte +71 -17
- package/dist/components/avatar/avatar.stories.svelte +22 -27
- package/dist/components/badge/badge.stories.svelte +12 -17
- package/dist/components/badge/badge.svelte +19 -19
- package/dist/components/breadcrumb/breadcrumb.stories.svelte +16 -21
- package/dist/components/button/button.stories.svelte +27 -60
- package/dist/components/calendar/calendar-day.svelte +96 -96
- package/dist/components/calendar/calendar-header.svelte +29 -29
- package/dist/components/calendar/calendar-root.svelte +206 -206
- package/dist/components/calendar/calendar.stories.svelte +10 -15
- package/dist/components/card/card-body.svelte +39 -39
- package/dist/components/card/card-footer.svelte +41 -41
- package/dist/components/card/card-root.svelte +91 -91
- package/dist/components/card/card.stories.svelte +133 -145
- package/dist/components/checkbox/checkbox.stories.svelte +22 -27
- package/dist/components/checkbox/checkbox.svelte +155 -157
- package/dist/components/collapsible/collapsible.stories.svelte +172 -173
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/combobox/compobox.stories.svelte +51 -54
- package/dist/components/container/container.stories.svelte +20 -23
- package/dist/components/datagrid/datagrid-root.svelte +59 -59
- package/dist/components/datagrid/datagrid.css +5 -5
- package/dist/components/datagrid/datagrid.stories.svelte +72 -75
- package/dist/components/date-picker/date-picker-calendar.svelte +67 -67
- package/dist/components/date-picker/date-picker-header.svelte +100 -100
- package/dist/components/date-picker/date-picker-months.svelte +142 -142
- package/dist/components/date-picker/date-picker-root.svelte +1 -1
- package/dist/components/date-picker/date-picker-years.svelte +205 -205
- package/dist/components/date-picker/date-picker.stories.svelte +11 -18
- package/dist/components/dialog/dialog-content.svelte +62 -62
- package/dist/components/dialog/dialog.stories.svelte +64 -67
- package/dist/components/drawer/attachments.svelte.js +8 -9
- package/dist/components/drawer/drawer-content.svelte +57 -42
- package/dist/components/drawer/drawer.stories.svelte +212 -224
- package/dist/components/dropdown/dropdown-root.svelte +59 -59
- package/dist/components/dropdown/dropdown.stories.svelte +80 -83
- package/dist/components/form/form.stories.svelte +96 -99
- package/dist/components/image/image.stories.svelte +20 -23
- package/dist/components/input/input.stories.svelte +35 -38
- package/dist/components/label/label.stories.svelte +15 -26
- package/dist/components/label/label.stories.svelte.d.ts +24 -4
- package/dist/components/lazy/lazy.stories.svelte +9 -16
- package/dist/components/lazy/lazy.svelte +28 -28
- package/dist/components/link/link.stories.svelte +15 -26
- package/dist/components/link/link.stories.svelte.d.ts +24 -4
- package/dist/components/menu/menu-list.svelte +40 -40
- package/dist/components/menu/menu.stories.svelte +33 -36
- package/dist/components/popover/bond.svelte.js +31 -25
- package/dist/components/popover/popover-arrow.svelte +111 -111
- package/dist/components/popover/popover-content.svelte +175 -178
- package/dist/components/popover/popover-indicator.svelte +44 -43
- package/dist/components/popover/popover-root.svelte +48 -48
- package/dist/components/popover/popover.stories.svelte +49 -52
- package/dist/components/qr-code/qr-code.stories.svelte +4 -13
- package/dist/components/qr-code/qr-code.svelte +75 -75
- package/dist/components/radio/radio-group.stories.svelte +41 -50
- package/dist/components/radio/radio.stories.svelte +17 -26
- package/dist/components/radio/radio.svelte +109 -109
- package/dist/components/root/root.svelte +121 -121
- package/dist/components/root/root.svelte.d.ts +1 -1
- package/dist/components/scrollable/scrollable.stories.svelte +116 -126
- package/dist/components/sidebar/sidebar-content.svelte +13 -2
- package/dist/components/sidebar/sidebar-root.svelte +10 -12
- package/dist/components/sidebar/sidebar.stories.svelte +8 -19
- package/dist/components/sidebar/types.d.ts +1 -0
- package/dist/components/tabs/tab/bond.svelte.d.ts +4 -1
- package/dist/components/tabs/tab/bond.svelte.js +4 -1
- package/dist/components/tabs/tabs.stories.svelte +56 -59
- package/dist/components/tooltip/tooltip-trigger.svelte +39 -37
- package/dist/components/tooltip/tooltip.stories.svelte +32 -35
- package/dist/components/tree/tree.stories.svelte +142 -134
- package/dist/context/preset.svelte.d.ts +3 -3
- package/dist/utils/function.d.ts +2 -0
- package/dist/utils/function.js +6 -0
- package/package.json +6 -9
- package/dist/actions/animation.svelte.d.ts +0 -6
- package/dist/actions/animation.svelte.js +0 -14
- package/dist/actions/clickout.svelte.d.ts +0 -2
- package/dist/actions/clickout.svelte.js +0 -15
- package/dist/actions/popover.svelte.d.ts +0 -19
- package/dist/actions/popover.svelte.js +0 -81
- package/dist/actions/portal.svelte.d.ts +0 -8
- package/dist/actions/portal.svelte.js +0 -32
- package/dist/attachments/gsap.svelte.d.ts +0 -2
- package/dist/attachments/gsap.svelte.js +0 -26
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
<script lang="ts" generics="D">
|
|
2
|
-
import type { ComboboxRootProps } from './types';
|
|
3
|
-
import { defineProperty, defineState } from '../../utils';
|
|
4
|
-
import { ComboboxBond, ComboboxBondState, type ComboboxBondProps } from './bond.svelte';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
open = $bindable(false),
|
|
8
|
-
value = $bindable(),
|
|
9
|
-
values = $bindable(),
|
|
10
|
-
query = $bindable(),
|
|
11
|
-
text = $bindable(),
|
|
12
|
-
multiple = false,
|
|
13
|
-
disabled = false,
|
|
14
|
-
placements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
|
|
15
|
-
placement = 'bottom-start',
|
|
16
|
-
offset =
|
|
17
|
-
factory = _factory,
|
|
18
|
-
children = undefined,
|
|
19
|
-
...restProps
|
|
20
|
-
}: ComboboxRootProps = $props();
|
|
21
|
-
|
|
22
|
-
const bondProps = defineState<ComboboxBondProps>(
|
|
23
|
-
[
|
|
24
|
-
defineProperty(
|
|
25
|
-
'open',
|
|
26
|
-
() => open,
|
|
27
|
-
(v) => {
|
|
28
|
-
open = v;
|
|
29
|
-
}
|
|
30
|
-
),
|
|
31
|
-
defineProperty(
|
|
32
|
-
'values',
|
|
33
|
-
() => (multiple ? values : [value]),
|
|
34
|
-
(v) => {
|
|
35
|
-
values = v;
|
|
36
|
-
value = v[0];
|
|
37
|
-
}
|
|
38
|
-
),
|
|
39
|
-
defineProperty(
|
|
40
|
-
'query',
|
|
41
|
-
() => query,
|
|
42
|
-
(v) => (query = v)
|
|
43
|
-
),
|
|
44
|
-
defineProperty(
|
|
45
|
-
'text',
|
|
46
|
-
() => text,
|
|
47
|
-
(v) => (text = v)
|
|
48
|
-
)
|
|
49
|
-
],
|
|
50
|
-
() => ({ disabled, multiple, placements, offset, placement: 'bottom-start', ...restProps })
|
|
51
|
-
);
|
|
52
|
-
const bond = factory(bondProps).share();
|
|
53
|
-
|
|
54
|
-
function _factory(props: typeof bondProps) {
|
|
55
|
-
const bondState = new ComboboxBondState<D>(() => props);
|
|
56
|
-
|
|
57
|
-
return new ComboboxBond(bondState).share();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function getBond() {
|
|
61
|
-
return bond;
|
|
62
|
-
}
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
{@render children?.({ combobox: bond })}
|
|
1
|
+
<script lang="ts" generics="D">
|
|
2
|
+
import type { ComboboxRootProps } from './types';
|
|
3
|
+
import { defineProperty, defineState } from '../../utils';
|
|
4
|
+
import { ComboboxBond, ComboboxBondState, type ComboboxBondProps } from './bond.svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
open = $bindable(false),
|
|
8
|
+
value = $bindable(),
|
|
9
|
+
values = $bindable(),
|
|
10
|
+
query = $bindable(),
|
|
11
|
+
text = $bindable(),
|
|
12
|
+
multiple = false,
|
|
13
|
+
disabled = false,
|
|
14
|
+
placements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
|
|
15
|
+
placement = 'bottom-start',
|
|
16
|
+
offset = 1,
|
|
17
|
+
factory = _factory,
|
|
18
|
+
children = undefined,
|
|
19
|
+
...restProps
|
|
20
|
+
}: ComboboxRootProps = $props();
|
|
21
|
+
|
|
22
|
+
const bondProps = defineState<ComboboxBondProps>(
|
|
23
|
+
[
|
|
24
|
+
defineProperty(
|
|
25
|
+
'open',
|
|
26
|
+
() => open,
|
|
27
|
+
(v) => {
|
|
28
|
+
open = v;
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
defineProperty(
|
|
32
|
+
'values',
|
|
33
|
+
() => (multiple ? values : [value]),
|
|
34
|
+
(v) => {
|
|
35
|
+
values = v;
|
|
36
|
+
value = v[0];
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
defineProperty(
|
|
40
|
+
'query',
|
|
41
|
+
() => query,
|
|
42
|
+
(v) => (query = v)
|
|
43
|
+
),
|
|
44
|
+
defineProperty(
|
|
45
|
+
'text',
|
|
46
|
+
() => text,
|
|
47
|
+
(v) => (text = v)
|
|
48
|
+
)
|
|
49
|
+
],
|
|
50
|
+
() => ({ disabled, multiple, placements, offset, placement: 'bottom-start', ...restProps })
|
|
51
|
+
);
|
|
52
|
+
const bond = factory(bondProps).share();
|
|
53
|
+
|
|
54
|
+
function _factory(props: typeof bondProps) {
|
|
55
|
+
const bondState = new ComboboxBondState<D>(() => props);
|
|
56
|
+
|
|
57
|
+
return new ComboboxBond(bondState).share();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function getBond() {
|
|
61
|
+
return bond;
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
{@render children?.({ combobox: bond })}
|
|
@@ -1,54 +1,51 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Combobox as ACombobox } from '.';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
{ value: '
|
|
26
|
-
{ value: '
|
|
27
|
-
{ value: '
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
</ACombobox.Root>
|
|
53
|
-
</Root>
|
|
54
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Combobox as ACombobox } from '.';
|
|
4
|
+
import { Input } from '../input';
|
|
5
|
+
import { Divider } from '../divider';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'Atoms/Combobox',
|
|
10
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
11
|
+
|
|
12
|
+
parameters: {
|
|
13
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
+
layout: 'fullscreen'
|
|
15
|
+
},
|
|
16
|
+
args: {}
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
let open = $state(false);
|
|
22
|
+
let value = $state<string | undefined>('ar');
|
|
23
|
+
let array = $state([
|
|
24
|
+
{ value: 'ar', label: 'Arabic' },
|
|
25
|
+
{ value: 'en', label: 'English' },
|
|
26
|
+
{ value: 'sp', label: 'Spanish' },
|
|
27
|
+
{ value: 'it', label: 'Italian' }
|
|
28
|
+
]);
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Story name="Combobox" args={{}}>
|
|
32
|
+
<ACombobox.Root bind:open bind:value>
|
|
33
|
+
{#snippet children({ combobox })}
|
|
34
|
+
<ACombobox.Trigger
|
|
35
|
+
base={Input.Root}
|
|
36
|
+
class="h-10 min-w-sm items-center gap-0 rounded-sm p-1 transition-colors duration-200"
|
|
37
|
+
>
|
|
38
|
+
<Input.Icon class="text-foreground/50">$</Input.Icon>
|
|
39
|
+
<Divider class="mx-1" vertical />
|
|
40
|
+
<ACombobox.Input class="px-1" placeholder="Select a language" />
|
|
41
|
+
</ACombobox.Trigger>
|
|
42
|
+
<ACombobox.List>
|
|
43
|
+
{#each array.filter((item) => !combobox.state.query || item.label
|
|
44
|
+
.toLowerCase()
|
|
45
|
+
.includes(combobox.state.query)) as item (item.value)}
|
|
46
|
+
<ACombobox.Item value={item.value}>{item.label}</ACombobox.Item>
|
|
47
|
+
{/each}
|
|
48
|
+
</ACombobox.List>
|
|
49
|
+
{/snippet}
|
|
50
|
+
</ACombobox.Root>
|
|
51
|
+
</Story>
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</ContainerCmp>
|
|
22
|
-
</Root>
|
|
23
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import ContainerCmp from './container.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'ATOMS/Container'
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Story name="Container">
|
|
11
|
+
<ContainerCmp class="flex w-full flex-col items-center gap-4">
|
|
12
|
+
<div class="flex w-full gap-4">
|
|
13
|
+
{#each { length: 5 } as _, i (i)}
|
|
14
|
+
<div class="bg-foreground h-80 flex-1 rounded-lg"></div>
|
|
15
|
+
{/each}
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="bg-foreground h-80 w-[50cqw] rounded-lg"></div>
|
|
19
|
+
</ContainerCmp>
|
|
20
|
+
</Story>
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap, B extends Base = Base">
|
|
2
|
-
import { defineProperty, defineState } from '../../utils';
|
|
3
|
-
import { HtmlAtom, type Base } from '../atom';
|
|
4
|
-
import { DataGridBond, DataGridBondState, type DataGridStateProps } from './bond.svelte';
|
|
5
|
-
import type { DatagridRootProps } from './types';
|
|
6
|
-
|
|
7
|
-
import './datagrid.css';
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
class: klass = '',
|
|
11
|
-
values = $bindable([]),
|
|
12
|
-
template = undefined,
|
|
13
|
-
fallbackTemplate = 'auto',
|
|
14
|
-
factory = _factory,
|
|
15
|
-
children = undefined,
|
|
16
|
-
onmount = undefined,
|
|
17
|
-
ondestroy = undefined,
|
|
18
|
-
animate = undefined,
|
|
19
|
-
enter = undefined,
|
|
20
|
-
exit = undefined,
|
|
21
|
-
initial = undefined,
|
|
22
|
-
...restProps
|
|
23
|
-
}: DatagridRootProps<T> = $props();
|
|
24
|
-
|
|
25
|
-
const bondProps = defineState<DataGridStateProps<T>>([
|
|
26
|
-
defineProperty('template', () => template),
|
|
27
|
-
defineProperty(
|
|
28
|
-
'values',
|
|
29
|
-
() => values,
|
|
30
|
-
(v) => (values = v)
|
|
31
|
-
)
|
|
32
|
-
]);
|
|
33
|
-
const bond = factory(bondProps).share();
|
|
34
|
-
|
|
35
|
-
function _factory(props: typeof bondProps) {
|
|
36
|
-
const dataGridState = new DataGridBondState(() => props);
|
|
37
|
-
return new DataGridBond(dataGridState);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function getBond() {
|
|
41
|
-
return bond;
|
|
42
|
-
}
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<HtmlAtom
|
|
46
|
-
{bond}
|
|
47
|
-
preset="datagrid"
|
|
48
|
-
class={['border-border', 'datagrid-root w-full gap-x-0 gap-y-0', '$preset', klass]}
|
|
49
|
-
style="--template-columns:{bond.state.template ?? fallbackTemplate}"
|
|
50
|
-
enter={enter?.bind(bond.state)}
|
|
51
|
-
exit={exit?.bind(bond.state)}
|
|
52
|
-
initial={initial?.bind(bond.state)}
|
|
53
|
-
animate={animate?.bind(bond.state)}
|
|
54
|
-
onmount={onmount?.bind(bond.state)}
|
|
55
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
56
|
-
{...restProps}
|
|
57
|
-
>
|
|
58
|
-
{@render children?.({ datagrid: bond })}
|
|
59
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap, B extends Base = Base">
|
|
2
|
+
import { defineProperty, defineState } from '../../utils';
|
|
3
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
4
|
+
import { DataGridBond, DataGridBondState, type DataGridStateProps } from './bond.svelte';
|
|
5
|
+
import type { DatagridRootProps } from './types';
|
|
6
|
+
|
|
7
|
+
import './datagrid.css';
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
class: klass = '',
|
|
11
|
+
values = $bindable([]),
|
|
12
|
+
template = undefined,
|
|
13
|
+
fallbackTemplate = 'auto',
|
|
14
|
+
factory = _factory,
|
|
15
|
+
children = undefined,
|
|
16
|
+
onmount = undefined,
|
|
17
|
+
ondestroy = undefined,
|
|
18
|
+
animate = undefined,
|
|
19
|
+
enter = undefined,
|
|
20
|
+
exit = undefined,
|
|
21
|
+
initial = undefined,
|
|
22
|
+
...restProps
|
|
23
|
+
}: DatagridRootProps<T> = $props();
|
|
24
|
+
|
|
25
|
+
const bondProps = defineState<DataGridStateProps<T>>([
|
|
26
|
+
defineProperty('template', () => template),
|
|
27
|
+
defineProperty(
|
|
28
|
+
'values',
|
|
29
|
+
() => values,
|
|
30
|
+
(v) => (values = v)
|
|
31
|
+
)
|
|
32
|
+
]);
|
|
33
|
+
const bond = factory(bondProps).share();
|
|
34
|
+
|
|
35
|
+
function _factory(props: typeof bondProps) {
|
|
36
|
+
const dataGridState = new DataGridBondState(() => props);
|
|
37
|
+
return new DataGridBond(dataGridState);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function getBond() {
|
|
41
|
+
return bond;
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<HtmlAtom
|
|
46
|
+
{bond}
|
|
47
|
+
preset="datagrid"
|
|
48
|
+
class={['border-border', 'datagrid-root w-full gap-x-0 gap-y-0', '$preset', klass]}
|
|
49
|
+
style="--template-columns:{bond.state.template ?? fallbackTemplate}"
|
|
50
|
+
enter={enter?.bind(bond.state)}
|
|
51
|
+
exit={exit?.bind(bond.state)}
|
|
52
|
+
initial={initial?.bind(bond.state)}
|
|
53
|
+
animate={animate?.bind(bond.state)}
|
|
54
|
+
onmount={onmount?.bind(bond.state)}
|
|
55
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
56
|
+
{...restProps}
|
|
57
|
+
>
|
|
58
|
+
{@render children?.({ datagrid: bond })}
|
|
59
|
+
</HtmlAtom>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
.datagrid-root {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-auto-flow: row;
|
|
4
|
-
grid-template-columns: var(--template-columns, auto);
|
|
5
|
-
}
|
|
1
|
+
.datagrid-root {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-auto-flow: row;
|
|
4
|
+
grid-template-columns: var(--template-columns, auto);
|
|
5
|
+
}
|
|
@@ -1,75 +1,72 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
width
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</Dropdown.
|
|
60
|
-
<Dropdown.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{/snippet}
|
|
74
|
-
</Root>
|
|
75
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { DataGrid as DataGridCmp } from '.';
|
|
4
|
+
import { Dropdown } from '../dropdown';
|
|
5
|
+
import MoreVerticalIcon from '../../icons/icon-more-vert.svelte';
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
|
+
import { container } from '../../runes/container.svelte';
|
|
8
|
+
|
|
9
|
+
const { Story } = defineMeta({
|
|
10
|
+
title: 'Atoms/DataGrid'
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
let values = $state([]);
|
|
16
|
+
|
|
17
|
+
const datagridContainer = container();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Story name="DataGrid">
|
|
21
|
+
{#snippet children({ args })}
|
|
22
|
+
<DataGridCmp.Root class="" {@attach datagridContainer.attach}>
|
|
23
|
+
<DataGridCmp.Header>
|
|
24
|
+
<DataGridCmp.Tr header>
|
|
25
|
+
<DataGridCmp.Th width="auto">
|
|
26
|
+
<DataGridCmp.Checkbox />
|
|
27
|
+
</DataGridCmp.Th>
|
|
28
|
+
<DataGridCmp.Th
|
|
29
|
+
class="resize-x overflow-x-auto"
|
|
30
|
+
width="auto"
|
|
31
|
+
hidden={datagridContainer.current?.width
|
|
32
|
+
? datagridContainer.current.width < 1024
|
|
33
|
+
: false}>ID</DataGridCmp.Th
|
|
34
|
+
>
|
|
35
|
+
<DataGridCmp.Th>Name</DataGridCmp.Th>
|
|
36
|
+
<DataGridCmp.Th width="auto">Job</DataGridCmp.Th>
|
|
37
|
+
<DataGridCmp.Th width="auto">Contact</DataGridCmp.Th>
|
|
38
|
+
<DataGridCmp.Th width="auto"></DataGridCmp.Th>
|
|
39
|
+
</DataGridCmp.Tr>
|
|
40
|
+
</DataGridCmp.Header>
|
|
41
|
+
|
|
42
|
+
<DataGridCmp.Body>
|
|
43
|
+
{#each { length: 10 } as _, i (i)}
|
|
44
|
+
<DataGridCmp.Tr>
|
|
45
|
+
<DataGridCmp.Td>
|
|
46
|
+
<DataGridCmp.Checkbox />
|
|
47
|
+
</DataGridCmp.Td>
|
|
48
|
+
|
|
49
|
+
<DataGridCmp.Td>{crypto.randomUUID()}</DataGridCmp.Td>
|
|
50
|
+
<DataGridCmp.Td>John Doe</DataGridCmp.Td>
|
|
51
|
+
<DataGridCmp.Td>Software Engineer</DataGridCmp.Td>
|
|
52
|
+
<DataGridCmp.Td>+213659009944</DataGridCmp.Td>
|
|
53
|
+
|
|
54
|
+
<DataGridCmp.Td base={Dropdown.Root} placement="bottom-end" offset={0}>
|
|
55
|
+
<Dropdown.Trigger class="flex aspect-square items-center justify-center p-0">
|
|
56
|
+
<Icon src={MoreVerticalIcon} />
|
|
57
|
+
</Dropdown.Trigger>
|
|
58
|
+
<Dropdown.List>
|
|
59
|
+
<Dropdown.Item value="ar">Arabic</Dropdown.Item>
|
|
60
|
+
<Dropdown.Item value="en">English</Dropdown.Item>
|
|
61
|
+
<Dropdown.Item value="sp">Spanish</Dropdown.Item>
|
|
62
|
+
<Dropdown.Item value="fr">Frensh</Dropdown.Item>
|
|
63
|
+
</Dropdown.List>
|
|
64
|
+
</DataGridCmp.Td>
|
|
65
|
+
</DataGridCmp.Tr>
|
|
66
|
+
{/each}
|
|
67
|
+
</DataGridCmp.Body>
|
|
68
|
+
|
|
69
|
+
<DataGridCmp.Footer></DataGridCmp.Footer>
|
|
70
|
+
</DataGridCmp.Root>
|
|
71
|
+
{/snippet}
|
|
72
|
+
</Story>
|