webcoreui 0.0.11 → 0.1.0

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 (141) hide show
  1. package/README.md +42 -11
  2. package/astro.d.ts +4 -0
  3. package/astro.js +4 -0
  4. package/components/Accordion/Accordion.astro +10 -8
  5. package/components/Accordion/Accordion.svelte +8 -8
  6. package/components/Accordion/Accordion.tsx +7 -6
  7. package/components/Accordion/accordion.module.scss +65 -0
  8. package/components/Alert/Alert.astro +11 -7
  9. package/components/Alert/Alert.svelte +9 -7
  10. package/components/Alert/Alert.tsx +11 -7
  11. package/components/Alert/alert.module.scss +51 -0
  12. package/components/Alert/alert.ts +3 -1
  13. package/components/Avatar/Avatar.astro +4 -4
  14. package/components/Avatar/Avatar.svelte +13 -7
  15. package/components/Avatar/Avatar.tsx +11 -9
  16. package/components/Avatar/{avatar.scss → avatar.module.scss} +11 -8
  17. package/components/Badge/Badge.astro +8 -8
  18. package/components/Badge/Badge.svelte +25 -13
  19. package/components/Badge/Badge.tsx +26 -8
  20. package/components/Badge/badge.module.scss +86 -0
  21. package/components/Badge/badge.ts +8 -1
  22. package/components/Button/Button.astro +9 -7
  23. package/components/Button/Button.svelte +13 -11
  24. package/components/Button/Button.tsx +10 -8
  25. package/components/Button/button.module.scss +87 -0
  26. package/components/Button/button.ts +6 -2
  27. package/components/Card/Card.astro +7 -15
  28. package/components/Card/Card.svelte +16 -13
  29. package/components/Card/Card.tsx +15 -11
  30. package/components/Card/card.module.scss +38 -0
  31. package/components/Checkbox/Checkbox.astro +10 -10
  32. package/components/Checkbox/Checkbox.svelte +19 -18
  33. package/components/Checkbox/Checkbox.tsx +12 -11
  34. package/components/Checkbox/checkbox.module.scss +70 -0
  35. package/components/Checkbox/checkbox.ts +5 -1
  36. package/components/ConditionalWrapper/ConditionalWrapper.svelte +1 -1
  37. package/components/Icon/Icon.astro +2 -2
  38. package/components/Icon/Icon.svelte +1 -8
  39. package/components/Icon/Icon.tsx +1 -8
  40. package/components/Icon/map.ts +23 -0
  41. package/components/Input/Input.astro +50 -52
  42. package/components/Input/Input.svelte +52 -52
  43. package/components/Input/Input.tsx +59 -59
  44. package/components/Input/input.module.scss +79 -0
  45. package/components/Input/input.ts +8 -2
  46. package/components/Menu/Menu.astro +107 -0
  47. package/components/Menu/Menu.svelte +88 -0
  48. package/components/Menu/Menu.tsx +107 -0
  49. package/components/Menu/menu.module.scss +141 -0
  50. package/components/Menu/menu.ts +21 -0
  51. package/components/Progress/Progress.astro +42 -40
  52. package/components/Progress/Progress.svelte +40 -38
  53. package/components/Progress/Progress.tsx +48 -47
  54. package/components/Progress/progress.module.scss +70 -0
  55. package/components/Radio/Radio.astro +57 -57
  56. package/components/Radio/Radio.svelte +58 -56
  57. package/components/Radio/Radio.tsx +69 -68
  58. package/components/Radio/radio.module.scss +84 -0
  59. package/components/Radio/radio.ts +4 -0
  60. package/components/Rating/Rating.astro +13 -10
  61. package/components/Rating/Rating.svelte +15 -15
  62. package/components/Rating/Rating.tsx +22 -11
  63. package/components/Rating/rating.module.scss +45 -0
  64. package/components/Rating/rating.ts +1 -1
  65. package/components/Spinner/Spinner.astro +44 -42
  66. package/components/Spinner/Spinner.svelte +40 -38
  67. package/components/Spinner/Spinner.tsx +45 -44
  68. package/components/Spinner/{spinner.scss → spinner.module.scss} +50 -41
  69. package/components/Switch/Switch.astro +13 -11
  70. package/components/Switch/Switch.svelte +26 -24
  71. package/components/Switch/Switch.tsx +14 -12
  72. package/components/Switch/switch.module.scss +82 -0
  73. package/components/Switch/switch.ts +8 -4
  74. package/components/Table/Table.astro +60 -60
  75. package/components/Table/Table.svelte +56 -54
  76. package/components/Table/Table.tsx +64 -63
  77. package/components/Table/{table.scss → table.module.scss} +60 -65
  78. package/components/Tabs/Tabs.astro +76 -76
  79. package/components/Tabs/Tabs.svelte +56 -54
  80. package/components/Tabs/Tabs.tsx +70 -69
  81. package/components/Tabs/tabs.module.scss +125 -0
  82. package/components/ThemeSwitcher/ThemeSwitcher.astro +106 -0
  83. package/components/ThemeSwitcher/ThemeSwitcher.svelte +76 -0
  84. package/components/ThemeSwitcher/ThemeSwitcher.tsx +89 -0
  85. package/components/ThemeSwitcher/themeswitcher.module.scss +76 -0
  86. package/components/ThemeSwitcher/themeswitcher.ts +13 -0
  87. package/components/Timeline/Timeline.astro +36 -34
  88. package/components/Timeline/Timeline.svelte +32 -30
  89. package/components/Timeline/Timeline.tsx +38 -37
  90. package/components/Timeline/{timeline.scss → timeline.module.scss} +76 -71
  91. package/components/TimelineItem/TimelineItem.astro +27 -26
  92. package/components/TimelineItem/TimelineItem.svelte +24 -22
  93. package/components/TimelineItem/TimelineItem.tsx +33 -32
  94. package/components/TimelineItem/timelineitem.module.scss +29 -0
  95. package/components/Toast/Toast.astro +41 -30
  96. package/components/Toast/Toast.svelte +32 -21
  97. package/components/Toast/Toast.tsx +38 -28
  98. package/components/Toast/toast.module.scss +40 -0
  99. package/components/Toast/toast.ts +8 -6
  100. package/icons/moon.svg +3 -0
  101. package/icons/sun.svg +3 -0
  102. package/icons.d.ts +11 -0
  103. package/icons.js +9 -0
  104. package/index.js +3 -0
  105. package/package.json +5 -1
  106. package/react.d.ts +4 -0
  107. package/react.js +4 -0
  108. package/scss/config/color-palette.scss +23 -0
  109. package/scss/config/css-values.scss +44 -0
  110. package/scss/config/layout.scss +41 -0
  111. package/scss/config/mixins.scss +395 -9
  112. package/scss/config/typography.scss +66 -0
  113. package/scss/config.scss +6 -1
  114. package/scss/global/elements.scss +22 -2
  115. package/scss/global/scrollbar.scss +24 -0
  116. package/scss/global/theme.scss +140 -0
  117. package/scss/global/tooltip.scss +47 -39
  118. package/scss/global/utility.scss +33 -4
  119. package/scss/global.scss +2 -1
  120. package/scss/resets.scss +64 -11
  121. package/scss/setup.scss +25 -31
  122. package/svelte.d.ts +16 -12
  123. package/svelte.js +4 -0
  124. package/utils/classNames.ts +4 -0
  125. package/utils/cookies.ts +28 -0
  126. package/utils/event.ts +17 -0
  127. package/utils/toast.ts +15 -11
  128. package/components/Accordion/accordion.scss +0 -63
  129. package/components/Alert/alert.scss +0 -53
  130. package/components/Badge/badge.scss +0 -85
  131. package/components/Button/button.scss +0 -91
  132. package/components/Card/card.scss +0 -37
  133. package/components/Checkbox/checkbox.scss +0 -85
  134. package/components/Input/input.scss +0 -83
  135. package/components/Progress/progress.scss +0 -66
  136. package/components/Radio/radio.scss +0 -92
  137. package/components/Rating/rating.scss +0 -37
  138. package/components/Switch/switch.scss +0 -84
  139. package/components/Tabs/tabs.scss +0 -134
  140. package/components/TimelineItem/timelineitem.scss +0 -31
  141. package/components/Toast/toast.scss +0 -43
@@ -1,54 +1,56 @@
1
- <script lang="ts">
2
- import type { TableProps } from './table'
3
- import './table.scss'
4
-
5
- export let headings: TableProps['headings'] = []
6
- export let footer: TableProps['footer'] = []
7
- export let data: TableProps['data'] = []
8
- export let hover: TableProps['hover'] = false
9
- export let striped: TableProps['striped'] = null
10
- export let offsetStripe: TableProps['offsetStripe'] = false
11
- export let compact: TableProps['compact'] = false
12
- export let className: TableProps['className'] = ''
13
-
14
- const classes = [
15
- 'w-table',
16
- hover && 'hover',
17
- striped && `striped-${striped}s`,
18
- offsetStripe && 'offset',
19
- compact && 'compact',
20
- className
21
- ].filter(Boolean).join(' ')
22
- </script>
23
-
24
- <div class={classes}>
25
- <table>
26
- {#if headings?.length}
27
- <thead>
28
- <tr>
29
- {#each headings as heading}
30
- <th>{heading}</th>
31
- {/each}
32
- </tr>
33
- </thead>
34
- {/if}
35
- <tbody>
36
- {#each data as row}
37
- <tr>
38
- {#each row as column}
39
- <td>{@html column}</td>
40
- {/each}
41
- </tr>
42
- {/each}
43
- </tbody>
44
- {#if footer?.length}
45
- <tfoot>
46
- <tr>
47
- {#each footer as data}
48
- <td>{data}</td>
49
- {/each}
50
- </tr>
51
- </tfoot>
52
- {/if}
53
- </table>
54
- </div>
1
+ <script lang="ts">
2
+ import type { TableProps } from './table'
3
+
4
+ import styles from './table.module.scss'
5
+ import { classNames } from '../../utils/classNames'
6
+
7
+ export let headings: TableProps['headings'] = []
8
+ export let footer: TableProps['footer'] = []
9
+ export let data: TableProps['data'] = []
10
+ export let hover: TableProps['hover'] = false
11
+ export let striped: TableProps['striped'] = null
12
+ export let offsetStripe: TableProps['offsetStripe'] = false
13
+ export let compact: TableProps['compact'] = false
14
+ export let className: TableProps['className'] = ''
15
+
16
+ const classes = classNames([
17
+ styles.table,
18
+ hover && styles.hover,
19
+ striped && styles[`striped-${striped}s`],
20
+ offsetStripe && styles.offset,
21
+ compact && styles.compact,
22
+ className
23
+ ])
24
+ </script>
25
+
26
+ <div class={classes}>
27
+ <table>
28
+ {#if headings?.length}
29
+ <thead>
30
+ <tr>
31
+ {#each headings as heading}
32
+ <th>{heading}</th>
33
+ {/each}
34
+ </tr>
35
+ </thead>
36
+ {/if}
37
+ <tbody>
38
+ {#each data as row}
39
+ <tr>
40
+ {#each row as column}
41
+ <td>{@html column}</td>
42
+ {/each}
43
+ </tr>
44
+ {/each}
45
+ </tbody>
46
+ {#if footer?.length}
47
+ <tfoot>
48
+ <tr>
49
+ {#each footer as data}
50
+ <td>{data}</td>
51
+ {/each}
52
+ </tr>
53
+ </tfoot>
54
+ {/if}
55
+ </table>
56
+ </div>
@@ -1,63 +1,64 @@
1
- import React from 'react'
2
- import type { TableProps } from './table'
3
-
4
- import './table.scss'
5
-
6
- const Table = ({
7
- headings,
8
- footer,
9
- data,
10
- hover,
11
- striped,
12
- offsetStripe,
13
- compact,
14
- className
15
- }: TableProps) => {
16
- const classes = [
17
- 'w-table',
18
- hover && 'hover',
19
- striped && `striped-${striped}s`,
20
- offsetStripe && 'offset',
21
- compact && 'compact',
22
- className
23
- ].filter(Boolean).join(' ')
24
-
25
- return (
26
- <div className={classes}>
27
- <table>
28
- {headings?.length && (
29
- <thead>
30
- <tr>
31
- {headings.map((heading, index) => (
32
- <th key={index}>{heading}</th>
33
- ))}
34
- </tr>
35
- </thead>
36
- )}
37
- <tbody>
38
- {data.map((row, rowIndex) => (
39
- <tr key={rowIndex}>
40
- {row.map((column, columnIndex) => (
41
- <td
42
- key={columnIndex}
43
- dangerouslySetInnerHTML={{ __html: column }}
44
- />
45
- ))}
46
- </tr>
47
- ))}
48
- </tbody>
49
- {footer?.length && (
50
- <tfoot>
51
- <tr>
52
- {footer.map((data, index) => (
53
- <td key={index}>{data}</td>
54
- ))}
55
- </tr>
56
- </tfoot>
57
- )}
58
- </table>
59
- </div>
60
- )
61
- }
62
-
63
- export default Table
1
+ import React from 'react'
2
+ import type { TableProps } from './table'
3
+
4
+ import styles from './table.module.scss'
5
+ import { classNames } from '../../utils/classNames'
6
+
7
+ const Table = ({
8
+ headings,
9
+ footer,
10
+ data,
11
+ hover,
12
+ striped,
13
+ offsetStripe,
14
+ compact,
15
+ className
16
+ }: TableProps) => {
17
+ const classes = classNames([
18
+ styles.table,
19
+ hover && styles.hover,
20
+ striped && styles[`striped-${striped}s`],
21
+ offsetStripe && styles.offset,
22
+ compact && styles.compact,
23
+ className
24
+ ])
25
+
26
+ return (
27
+ <div className={classes}>
28
+ <table>
29
+ {headings?.length && (
30
+ <thead>
31
+ <tr>
32
+ {headings.map((heading, index) => (
33
+ <th key={index}>{heading}</th>
34
+ ))}
35
+ </tr>
36
+ </thead>
37
+ )}
38
+ <tbody>
39
+ {data.map((row, rowIndex) => (
40
+ <tr key={rowIndex}>
41
+ {row.map((column, columnIndex) => (
42
+ <td
43
+ key={columnIndex}
44
+ dangerouslySetInnerHTML={{ __html: column }}
45
+ />
46
+ ))}
47
+ </tr>
48
+ ))}
49
+ </tbody>
50
+ {footer?.length && (
51
+ <tfoot>
52
+ <tr>
53
+ {footer.map((data, index) => (
54
+ <td key={index}>{data}</td>
55
+ ))}
56
+ </tr>
57
+ </tfoot>
58
+ )}
59
+ </table>
60
+ </div>
61
+ )
62
+ }
63
+
64
+ export default Table
@@ -1,65 +1,60 @@
1
- @import '../../scss/config.scss';
2
-
3
- .w-table {
4
- overflow-x: auto;
5
-
6
- table {
7
- width: 100%;
8
- border-collapse: collapse;
9
- text-align: left;
10
- font-size: 16px;
11
- }
12
-
13
- thead,
14
- tfoot {
15
- font-family: Bold;
16
- }
17
-
18
- th,
19
- td {
20
- padding: 5px 10px;
21
- white-space: nowrap;
22
- }
23
-
24
- thead,
25
- tr {
26
- border-bottom: 1px solid #252525;
27
-
28
- &:last-child {
29
- border-bottom: 0;
30
- }
31
- }
32
-
33
- a {
34
- text-decoration: underline;
35
- }
36
-
37
- tfoot,
38
- &.hover tr:hover,
39
- &.striped-rows tbody tr:nth-child(odd),
40
- &.striped-rows.offset tbody tr:nth-child(even),
41
- &.striped-columns td:nth-child(odd),
42
- &.striped-columns.offset td:nth-child(even) {
43
- background: #111;
44
- }
45
-
46
- &.striped-rows tr,
47
- &.striped-rows thead,
48
- &.striped-columns tr,
49
- &.striped-columns thead {
50
- border-bottom: 0;
51
- }
52
-
53
- &.striped-rows.offset tbody tr:nth-child(odd),
54
- &.striped-rows.offset tfoot,
55
- &.striped-columns.offset td:nth-child(odd),
56
- &.striped-columns tfoot {
57
- background: transparent;
58
- }
59
-
60
- &.compact {
61
- th, td {
62
- padding: 3px 10px;
63
- }
64
- }
65
- }
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ .table {
4
+ @include visibility(auto);
5
+
6
+ table {
7
+ @include size('w100%');
8
+ @include typography(md, left);
9
+
10
+ border-collapse: collapse;
11
+ }
12
+
13
+ thead,
14
+ tfoot {
15
+ @include typography(bold);
16
+ }
17
+
18
+ th,
19
+ td {
20
+ @include spacing(py-xs, px-sm);
21
+ }
22
+
23
+ thead,
24
+ tr {
25
+ @include border(bottom, primary-50);
26
+
27
+ &:last-child {
28
+ @include border(bottom, 0);
29
+ }
30
+ }
31
+
32
+ tfoot,
33
+ &.hover tr:hover,
34
+ &.striped-rows tbody tr:nth-child(odd),
35
+ &.striped-rows.offset tbody tr:nth-child(even),
36
+ &.striped-columns td:nth-child(odd),
37
+ &.striped-columns.offset td:nth-child(even),
38
+ &.hover.striped-rows.offset tbody tr:nth-child(odd):hover {
39
+ @include background(primary-60);
40
+ }
41
+
42
+ &.striped-rows tr,
43
+ &.striped-columns tr,
44
+ &.striped-columns thead {
45
+ @include border(bottom, 0);
46
+ }
47
+
48
+ &.striped-rows.offset tbody tr:nth-child(odd),
49
+ &.striped-rows.offset tfoot,
50
+ &.striped-columns.offset td:nth-child(odd),
51
+ &.striped-columns tfoot {
52
+ @include background(transparent);
53
+ }
54
+
55
+ &.compact {
56
+ th, td {
57
+ @include spacing(py-xxs, px-sm);
58
+ }
59
+ }
60
+ }
@@ -1,76 +1,76 @@
1
- ---
2
- import type { TabsProps } from './tabs'
3
- import './tabs.scss'
4
-
5
- interface Props extends TabsProps {}
6
-
7
- const {
8
- items,
9
- theme,
10
- vertical,
11
- even,
12
- className
13
- } = Astro.props
14
-
15
- const classes = [
16
- 'w-tabs',
17
- theme && theme,
18
- vertical && 'vertical',
19
- even && 'even',
20
- className
21
- ]
22
- ---
23
-
24
- <section class:list={classes} data-id="w-tabs">
25
- <div class="tabs-wrapper">
26
- <div class="tabs">
27
- {items.map(item => (
28
- <button
29
- data-value={item.value}
30
- class:list={[item.active && 'active']}
31
- disabled={item.disabled}
32
- >
33
- <Fragment set:html={item.label} />
34
- </button>
35
- ))}
36
- </div>
37
- </div>
38
- <div class="tab-content">
39
- <slot />
40
- </div>
41
- </section>
42
-
43
- <script>
44
- const tabs = document.querySelectorAll('[data-id="w-tabs"]')
45
-
46
- Array.from(tabs).forEach(element => {
47
- element.addEventListener('click', event => {
48
- const target = event.target as HTMLDivElement
49
-
50
- if (target.dataset.value) {
51
- const tabContent = target.parentElement
52
- ?.parentElement
53
- ?.nextElementSibling as HTMLDivElement
54
-
55
- Array.from(tabContent.children)
56
- .forEach((element: any) => {
57
- if (element.dataset.tab === target.dataset.value) {
58
- element.dataset.active = true
59
- } else {
60
- element.dataset.active = false
61
- }
62
- })
63
-
64
- const tabs = target.parentElement?.querySelectorAll('button') as NodeListOf<HTMLButtonElement>
65
-
66
- Array.from(tabs).forEach((tab: any) => {
67
- tab.classList.remove('active')
68
-
69
- if (tab.dataset.value === target.dataset.value) {
70
- tab.classList.add('active')
71
- }
72
- })
73
- }
74
- })
75
- })
76
- </script>
1
+ ---
2
+ import type { TabsProps } from './tabs'
3
+ import styles from './tabs.module.scss'
4
+
5
+ interface Props extends TabsProps {}
6
+
7
+ const {
8
+ items,
9
+ theme,
10
+ vertical,
11
+ even,
12
+ className
13
+ } = Astro.props
14
+
15
+ const classes = [
16
+ styles.tabs,
17
+ theme && styles[theme],
18
+ vertical && styles.vertical,
19
+ even && styles.even,
20
+ className
21
+ ]
22
+ ---
23
+
24
+ <section class:list={classes} data-id="w-tabs">
25
+ <div class={styles.wrapper}>
26
+ <div class={styles.items}>
27
+ {items.map(item => (
28
+ <button
29
+ data-value={item.value}
30
+ data-active={item.active ? 'true' : null}
31
+ disabled={item.disabled}
32
+ >
33
+ <Fragment set:html={item.label} />
34
+ </button>
35
+ ))}
36
+ </div>
37
+ </div>
38
+ <div class={styles.content}>
39
+ <slot />
40
+ </div>
41
+ </section>
42
+
43
+ <script>
44
+ const tabs = document.querySelectorAll('[data-id="w-tabs"]')
45
+
46
+ Array.from(tabs).forEach(element => {
47
+ element.addEventListener('click', event => {
48
+ const target = event.target as HTMLDivElement
49
+
50
+ if (target.dataset.value) {
51
+ const tabContent = target.parentElement
52
+ ?.parentElement
53
+ ?.nextElementSibling as HTMLDivElement
54
+
55
+ Array.from(tabContent.children)
56
+ .forEach((element: any) => {
57
+ if (element.dataset.tab === target.dataset.value) {
58
+ element.dataset.active = true
59
+ } else {
60
+ element.dataset.active = false
61
+ }
62
+ })
63
+
64
+ const tabs = target.parentElement?.querySelectorAll('button') as NodeListOf<HTMLButtonElement>
65
+
66
+ Array.from(tabs).forEach((tab: any) => {
67
+ tab.dataset.active = 'false'
68
+
69
+ if (tab.dataset.value === target.dataset.value) {
70
+ tab.dataset.active = 'true'
71
+ }
72
+ })
73
+ }
74
+ })
75
+ })
76
+ </script>
@@ -1,54 +1,56 @@
1
- <script lang="ts">
2
- import type { TabsProps } from './tabs'
3
- import './tabs.scss'
4
-
5
- export let items: TabsProps['items'] = []
6
- export let theme: TabsProps['theme'] = null
7
- export let vertical: TabsProps['vertical'] = false
8
- export let even: TabsProps['even'] = false
9
- export let className: TabsProps['className'] = ''
10
-
11
- let active = ''
12
- let tabContainer: HTMLDivElement
13
-
14
- const classes = [
15
- 'w-tabs',
16
- theme && theme,
17
- vertical && 'vertical',
18
- even && 'even',
19
- className
20
- ].filter(Boolean).join(' ')
21
-
22
- const setTab = (tab: string) => {
23
- const tabs = tabContainer.querySelectorAll('[data-tab]')
24
-
25
- active = tab
26
-
27
- Array.from(tabs).forEach((item: any) => {
28
- item.dataset.active = false
29
-
30
- if (item.dataset.tab === active) {
31
- item.dataset.active = true
32
- }
33
- })
34
- }
35
- </script>
36
-
37
- <section class={classes}>
38
- <div class="tabs-wrapper">
39
- <div class="tabs">
40
- {#each items as item}
41
- <button
42
- class:active={active ? active === item.value : item.active}
43
- disabled={item.disabled}
44
- on:click={() => setTab(item.value)}
45
- >
46
- {@html item.label}
47
- </button>
48
- {/each}
49
- </div>
50
- </div>
51
- <div class="tab-content" bind:this={tabContainer}>
52
- <slot />
53
- </div>
54
- </section>
1
+ <script lang="ts">
2
+ import type { TabsProps } from './tabs'
3
+
4
+ import styles from './tabs.module.scss'
5
+ import { classNames } from '../../utils/classNames'
6
+
7
+ export let items: TabsProps['items'] = []
8
+ export let theme: TabsProps['theme'] = null
9
+ export let vertical: TabsProps['vertical'] = false
10
+ export let even: TabsProps['even'] = false
11
+ export let className: TabsProps['className'] = ''
12
+
13
+ let active = ''
14
+ let tabContainer: HTMLDivElement
15
+
16
+ const classes = classNames([
17
+ styles.tabs,
18
+ theme && styles[theme],
19
+ vertical && styles.vertical,
20
+ even && styles.even,
21
+ className
22
+ ])
23
+
24
+ const setTab = (tab: string) => {
25
+ const tabs = tabContainer.querySelectorAll('[data-tab]')
26
+
27
+ active = tab
28
+
29
+ Array.from(tabs).forEach((item: any) => {
30
+ item.dataset.active = false
31
+
32
+ if (item.dataset.tab === active) {
33
+ item.dataset.active = true
34
+ }
35
+ })
36
+ }
37
+ </script>
38
+
39
+ <section class={classes}>
40
+ <div class={styles.wrapper}>
41
+ <div class={styles.items}>
42
+ {#each items as item}
43
+ <button
44
+ data-active={active ? active === item.value : item.active}
45
+ disabled={item.disabled}
46
+ on:click={() => setTab(item.value)}
47
+ >
48
+ {@html item.label}
49
+ </button>
50
+ {/each}
51
+ </div>
52
+ </div>
53
+ <div class={styles.content} bind:this={tabContainer}>
54
+ <slot />
55
+ </div>
56
+ </section>