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