@unkn0wndo3s/nova-design-system 0.1.0 → 0.2.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 (143) hide show
  1. package/LICENSE.md +46 -46
  2. package/README.md +159 -165
  3. package/package.json +28 -28
  4. package/src/components/Button/_button.scss +36 -36
  5. package/src/components/Button/button.astro +14 -14
  6. package/src/components/Icons/Arrow2/Arrow2.astro +45 -45
  7. package/src/components/Icons/Arrow2/svgs/arrow2-16-down.svg +3 -3
  8. package/src/components/Icons/Arrow2/svgs/arrow2-16-left.svg +3 -3
  9. package/src/components/Icons/Arrow2/svgs/arrow2-16-right.svg +3 -3
  10. package/src/components/Icons/Arrow2/svgs/arrow2-16-up.svg +3 -3
  11. package/src/components/Icons/Arrow2/svgs/arrow2-24-down.svg +3 -3
  12. package/src/components/Icons/Arrow2/svgs/arrow2-24-left.svg +3 -3
  13. package/src/components/Icons/Arrow2/svgs/arrow2-24-right.svg +3 -3
  14. package/src/components/Icons/Arrow2/svgs/arrow2-24-up.svg +3 -3
  15. package/src/components/Icons/Arrow2/svgs/arrow2-32-down.svg +3 -3
  16. package/src/components/Icons/Arrow2/svgs/arrow2-32-left.svg +3 -3
  17. package/src/components/Icons/Arrow2/svgs/arrow2-32-right.svg +3 -3
  18. package/src/components/Icons/Arrow2/svgs/arrow2-32-up.svg +3 -3
  19. package/src/components/Icons/bin/bin.astro +26 -26
  20. package/src/components/Icons/bin/svgs/bin-16.svg +3 -3
  21. package/src/components/Icons/bin/svgs/bin-24.svg +3 -3
  22. package/src/components/Icons/bin/svgs/bin-32.svg +3 -3
  23. package/src/components/Icons/burger/burger.astro +26 -26
  24. package/src/components/Icons/burger/svgs/burger-16.svg +3 -3
  25. package/src/components/Icons/burger/svgs/burger-24.svg +3 -3
  26. package/src/components/Icons/burger/svgs/burger-32.svg +3 -3
  27. package/src/components/Icons/calendar/calendar.astro +26 -26
  28. package/src/components/Icons/calendar/svgs/calendar-16.svg +3 -3
  29. package/src/components/Icons/calendar/svgs/calendar-24.svg +3 -3
  30. package/src/components/Icons/calendar/svgs/calendar-32.svg +3 -3
  31. package/src/components/Icons/check/check.astro +26 -26
  32. package/src/components/Icons/check/svgs/check-16.svg +3 -3
  33. package/src/components/Icons/check/svgs/check-24.svg +3 -3
  34. package/src/components/Icons/check/svgs/check-32.svg +3 -3
  35. package/src/components/Icons/close/close.astro +27 -27
  36. package/src/components/Icons/close/svgs/close-16.svg +3 -3
  37. package/src/components/Icons/close/svgs/close-24.svg +3 -3
  38. package/src/components/Icons/close/svgs/close-32.svg +3 -3
  39. package/src/components/Icons/code/code.astro +26 -26
  40. package/src/components/Icons/code/svgs/code-16.svg +3 -3
  41. package/src/components/Icons/code/svgs/code-24.svg +3 -3
  42. package/src/components/Icons/code/svgs/code-32.svg +3 -3
  43. package/src/components/Icons/cube/cube.astro +26 -26
  44. package/src/components/Icons/cube/svgs/cube-16.svg +3 -3
  45. package/src/components/Icons/cube/svgs/cube-24.svg +3 -3
  46. package/src/components/Icons/cube/svgs/cube-32.svg +3 -3
  47. package/src/components/Icons/download/download.astro +26 -26
  48. package/src/components/Icons/download/svgs/download-16.svg +5 -5
  49. package/src/components/Icons/download/svgs/download-24.svg +4 -4
  50. package/src/components/Icons/download/svgs/download-32.svg +4 -4
  51. package/src/components/Icons/filter/filter.astro +26 -26
  52. package/src/components/Icons/filter/svgs/filter-16.svg +3 -3
  53. package/src/components/Icons/filter/svgs/filter-24.svg +3 -3
  54. package/src/components/Icons/filter/svgs/filter-32.svg +3 -3
  55. package/src/components/Icons/help/help.astro +26 -26
  56. package/src/components/Icons/help/svgs/help-16.svg +5 -5
  57. package/src/components/Icons/help/svgs/help-24.svg +5 -5
  58. package/src/components/Icons/help/svgs/help-32.svg +3 -3
  59. package/src/components/Icons/home/home.astro +26 -26
  60. package/src/components/Icons/home/svgs/home-16.svg +3 -3
  61. package/src/components/Icons/home/svgs/home-24.svg +3 -3
  62. package/src/components/Icons/home/svgs/home-32.svg +3 -3
  63. package/src/components/Icons/index.ts +25 -25
  64. package/src/components/Icons/link/link.astro +26 -26
  65. package/src/components/Icons/link/svgs/link-16.svg +3 -3
  66. package/src/components/Icons/link/svgs/link-24.svg +3 -3
  67. package/src/components/Icons/link/svgs/link-32.svg +3 -3
  68. package/src/components/Icons/minus/minus.astro +26 -26
  69. package/src/components/Icons/minus/svgs/minus-16.svg +3 -3
  70. package/src/components/Icons/minus/svgs/minus-24.svg +3 -3
  71. package/src/components/Icons/minus/svgs/minus-32.svg +3 -3
  72. package/src/components/Icons/more/more.astro +26 -26
  73. package/src/components/Icons/more/svgs/more-16.svg +3 -3
  74. package/src/components/Icons/more/svgs/more-24.svg +3 -3
  75. package/src/components/Icons/more/svgs/more-32.svg +3 -3
  76. package/src/components/Icons/overview/overview.astro +26 -26
  77. package/src/components/Icons/overview/svgs/overview-16.svg +3 -3
  78. package/src/components/Icons/overview/svgs/overview-24.svg +3 -3
  79. package/src/components/Icons/overview/svgs/overview-32.svg +3 -3
  80. package/src/components/Icons/plus/plus.astro +26 -26
  81. package/src/components/Icons/plus/svgs/plus-16.svg +3 -3
  82. package/src/components/Icons/plus/svgs/plus-24.svg +3 -3
  83. package/src/components/Icons/plus/svgs/plus-32.svg +3 -3
  84. package/src/components/Icons/profile/profile.astro +27 -27
  85. package/src/components/Icons/profile/svgs/profile-16.svg +3 -3
  86. package/src/components/Icons/profile/svgs/profile-24.svg +3 -3
  87. package/src/components/Icons/profile/svgs/profile-32.svg +3 -3
  88. package/src/components/Icons/search/search.astro +27 -27
  89. package/src/components/Icons/search/svgs/search-16.svg +3 -3
  90. package/src/components/Icons/search/svgs/search-24.svg +3 -3
  91. package/src/components/Icons/search/svgs/search-32.svg +3 -3
  92. package/src/components/Icons/settings/settings.astro +26 -26
  93. package/src/components/Icons/settings/svgs/settings-16.svg +3 -3
  94. package/src/components/Icons/settings/svgs/settings-24.svg +3 -3
  95. package/src/components/Icons/settings/svgs/settings-32.svg +3 -3
  96. package/src/components/Icons/share/share.astro +27 -27
  97. package/src/components/Icons/share/svgs/share-16.svg +3 -3
  98. package/src/components/Icons/share/svgs/share-24.svg +3 -3
  99. package/src/components/Icons/share/svgs/share-32.svg +3 -3
  100. package/src/components/Icons/shield/shield.astro +26 -26
  101. package/src/components/Icons/shield/svgs/shield-16.svg +3 -3
  102. package/src/components/Icons/shield/svgs/shield-24.svg +3 -3
  103. package/src/components/Icons/shield/svgs/shield-32.svg +3 -3
  104. package/src/components/Icons/sort/sort.astro +38 -38
  105. package/src/components/Icons/sort/svgs/sort-16-ascend.svg +4 -4
  106. package/src/components/Icons/sort/svgs/sort-16-default.svg +3 -3
  107. package/src/components/Icons/sort/svgs/sort-16-descend.svg +4 -4
  108. package/src/components/Icons/sort/svgs/sort-24-ascend.svg +4 -4
  109. package/src/components/Icons/sort/svgs/sort-24-default.svg +3 -3
  110. package/src/components/Icons/sort/svgs/sort-24-descend.svg +4 -4
  111. package/src/components/Icons/sort/svgs/sort-32-ascend.svg +4 -4
  112. package/src/components/Icons/sort/svgs/sort-32-default.svg +3 -3
  113. package/src/components/Icons/sort/svgs/sort-32-descend.svg +4 -4
  114. package/src/components/Icons/stats/stats.astro +26 -26
  115. package/src/components/Icons/stats/svgs/stats-16.svg +3 -3
  116. package/src/components/Icons/stats/svgs/stats-24.svg +3 -3
  117. package/src/components/Icons/stats/svgs/stats-32.svg +3 -3
  118. package/src/components/Icons/upload/svgs/upload-16.svg +3 -3
  119. package/src/components/Icons/upload/svgs/upload-24.svg +3 -3
  120. package/src/components/Icons/upload/svgs/upload-32.svg +3 -3
  121. package/src/components/Icons/upload/upload.astro +27 -27
  122. package/src/components/Link/_link.scss +29 -29
  123. package/src/components/Link/link.astro +15 -15
  124. package/src/components/ListItem/_listItem.scss +69 -20
  125. package/src/components/ListItem/listItem.astro +14 -14
  126. package/src/components/ListItem/listItemSubtitle.astro +6 -6
  127. package/src/components/ListItem/listItemTitle.astro +6 -6
  128. package/src/components/Notifications/_notification.scss +61 -61
  129. package/src/components/Notifications/notification.astro +22 -22
  130. package/src/components/Tabs/_tab.scss +32 -32
  131. package/src/components/Tabs/tab.astro +53 -53
  132. package/src/components/Tabs/tabContent.astro +20 -20
  133. package/src/components/Tabs/tabItem.astro +40 -40
  134. package/src/components/Toggle/_toggle.scss +33 -33
  135. package/src/components/Toggle/toggle.astro +61 -61
  136. package/src/components/index.ts +13 -10
  137. package/src/index.ts +1 -1
  138. package/src/layouts/Layout.astro +29 -29
  139. package/src/pages/index.astro +338 -338
  140. package/src/styles/index.scss +10 -10
  141. package/src/styles/tokens/_colors.scss +69 -69
  142. package/src/styles/tokens/_spacing.scss +32 -32
  143. package/src/styles/tokens/_typography.scss +50 -50
@@ -1,23 +1,23 @@
1
- ---
2
- import { CloseIcon } from "../Icons";
3
-
4
-
5
- export interface Props {
6
- type: 'info' | 'success' | 'warning' | 'error';
7
- }
8
- const notificationUUID = `notification-${Math.random().toString(36).substr(2, 9)}`;
9
- const { type } = Astro.props;
10
- ---
11
-
12
- <div class={`notification notification__${type}`} role="alert" id={notificationUUID}>
13
- <div class=`notification__${type}__content`>
14
- <slot />
15
- </div>
16
- <button class={`notification__${type}__close`} aria-label="Close notification" onclick={`document.getElementById('${notificationUUID}')?.remove()`}>
17
- <CloseIcon size={16} label="Close notification" />
18
- </button>
19
- </div>
20
-
21
- <style lang="scss">
22
- @use './_notification.scss';
1
+ ---
2
+ import { CloseIcon } from "../Icons";
3
+
4
+
5
+ export interface Props {
6
+ type: 'info' | 'success' | 'warning' | 'error';
7
+ }
8
+ const notificationUUID = `notification-${Math.random().toString(36).substr(2, 9)}`;
9
+ const { type } = Astro.props;
10
+ ---
11
+
12
+ <div class={`notification notification__${type}`} role="alert" id={notificationUUID}>
13
+ <div class=`notification__${type}__content`>
14
+ <slot />
15
+ </div>
16
+ <button class={`notification__${type}__close`} aria-label="Close notification" onclick={`document.getElementById('${notificationUUID}')?.remove()`}>
17
+ <CloseIcon size={16} label="Close notification" />
18
+ </button>
19
+ </div>
20
+
21
+ <style lang="scss">
22
+ @use './_notification.scss';
23
23
  </style>
@@ -1,33 +1,33 @@
1
- @use '../../styles/tokens/typography' as *;
2
-
3
- .tab {
4
- display: flex;
5
- align-items: flex-start;
6
- gap: var(--nds-spacing-xs);
7
- justify-content: center;
8
- width: fit-content;
9
-
10
- &__item {
11
- display: flex;
12
- flex-direction: column;
13
- align-items: center;
14
- justify-content: center;
15
- height: fit-content;
16
- cursor: pointer;
17
- padding: var(--nds-spacing-2xs);
18
- @include text-base;
19
-
20
- &--active {
21
- color: var(--nds-primary);
22
-
23
- &::after {
24
- content: '';
25
- display: block;
26
- width: 120%;
27
- height: 1px;
28
- background-color: var(--nds-primary);
29
- border-radius: var(--nds-radius-sm);
30
- }
31
- }
32
- }
1
+ @use '../../styles/tokens/typography' as *;
2
+
3
+ .tab {
4
+ display: flex;
5
+ align-items: flex-start;
6
+ gap: var(--nds-spacing-xs);
7
+ justify-content: center;
8
+ width: fit-content;
9
+
10
+ &__item {
11
+ display: flex;
12
+ flex-direction: column;
13
+ align-items: center;
14
+ justify-content: center;
15
+ height: fit-content;
16
+ cursor: pointer;
17
+ padding: var(--nds-spacing-2xs);
18
+ @include text-base;
19
+
20
+ &--active {
21
+ color: var(--nds-primary);
22
+
23
+ &::after {
24
+ content: '';
25
+ display: block;
26
+ width: 120%;
27
+ height: 1px;
28
+ background-color: var(--nds-primary);
29
+ border-radius: var(--nds-radius-sm);
30
+ }
31
+ }
32
+ }
33
33
  }
@@ -1,54 +1,54 @@
1
- ---
2
- export interface Props {
3
- id: string;
4
- defaultActive?: string;
5
- }
6
-
7
- const { id, defaultActive } = Astro.props;
8
- ---
9
-
10
- <div class="tab" data-tab-group id={id} data-default-active={defaultActive}>
11
- <slot />
12
- </div>
13
-
14
- <script>
15
- document.querySelectorAll<HTMLElement>('[data-tab-group]').forEach((group) => {
16
- const defaultActive = group.dataset.defaultActive;
17
-
18
- function setActive(itemId: string) {
19
- const groupId = group.id;
20
-
21
- group.querySelectorAll<HTMLElement>('[data-tab-item]').forEach((item) => {
22
- item.classList.toggle('tab__item--active', item.dataset.tabItem === itemId);
23
- item.setAttribute('aria-selected', String(item.dataset.tabItem === itemId));
24
- });
25
-
26
- document.querySelectorAll<HTMLElement>(`[data-tab-content][data-tab-id="${groupId}"]`).forEach((content) => {
27
- content.hidden = content.dataset.tabItemId !== itemId;
28
- });
29
-
30
- group.dispatchEvent(new CustomEvent('tab:change', {
31
- detail: { itemId },
32
- bubbles: true,
33
- }));
34
- }
35
-
36
- const firstItem = group.querySelector<HTMLElement>('[data-tab-item]');
37
- const initialId = defaultActive ?? firstItem?.dataset.tabItem ?? '';
38
- if (initialId) setActive(initialId);
39
-
40
- group.addEventListener('tab-item:click', (e: Event) => {
41
- setActive((e as CustomEvent<{ itemId: string }>).detail.itemId);
42
- });
43
-
44
- group.addEventListener('tab:set', (e: Event) => {
45
- setActive((e as CustomEvent<{ itemId: string }>).detail.itemId);
46
- });
47
-
48
- (group as any).setActiveTab = (itemId: string) => setActive(itemId);
49
- });
50
- </script>
51
-
52
- <style lang="scss">
53
- @use './tab';
1
+ ---
2
+ export interface Props {
3
+ id: string;
4
+ defaultActive?: string;
5
+ }
6
+
7
+ const { id, defaultActive } = Astro.props;
8
+ ---
9
+
10
+ <div class="tab" data-tab-group id={id} data-default-active={defaultActive}>
11
+ <slot />
12
+ </div>
13
+
14
+ <script>
15
+ document.querySelectorAll<HTMLElement>('[data-tab-group]').forEach((group) => {
16
+ const defaultActive = group.dataset.defaultActive;
17
+
18
+ function setActive(itemId: string) {
19
+ const groupId = group.id;
20
+
21
+ group.querySelectorAll<HTMLElement>('[data-tab-item]').forEach((item) => {
22
+ item.classList.toggle('tab__item--active', item.dataset.tabItem === itemId);
23
+ item.setAttribute('aria-selected', String(item.dataset.tabItem === itemId));
24
+ });
25
+
26
+ document.querySelectorAll<HTMLElement>(`[data-tab-content][data-tab-id="${groupId}"]`).forEach((content) => {
27
+ content.hidden = content.dataset.tabItemId !== itemId;
28
+ });
29
+
30
+ group.dispatchEvent(new CustomEvent('tab:change', {
31
+ detail: { itemId },
32
+ bubbles: true,
33
+ }));
34
+ }
35
+
36
+ const firstItem = group.querySelector<HTMLElement>('[data-tab-item]');
37
+ const initialId = defaultActive ?? firstItem?.dataset.tabItem ?? '';
38
+ if (initialId) setActive(initialId);
39
+
40
+ group.addEventListener('tab-item:click', (e: Event) => {
41
+ setActive((e as CustomEvent<{ itemId: string }>).detail.itemId);
42
+ });
43
+
44
+ group.addEventListener('tab:set', (e: Event) => {
45
+ setActive((e as CustomEvent<{ itemId: string }>).detail.itemId);
46
+ });
47
+
48
+ (group as any).setActiveTab = (itemId: string) => setActive(itemId);
49
+ });
50
+ </script>
51
+
52
+ <style lang="scss">
53
+ @use './tab';
54
54
  </style>
@@ -1,21 +1,21 @@
1
- ---
2
- export interface Props {
3
- id: string;
4
- itemId: string;
5
- }
6
-
7
- const { id, itemId } = Astro.props;
8
- ---
9
-
10
- <div
11
- data-tab-content
12
- data-tab-id={id}
13
- data-tab-item-id={itemId}
14
- hidden
15
- >
16
- <slot />
17
- </div>
18
-
19
- <style lang="scss">
20
- @use './tab';
1
+ ---
2
+ export interface Props {
3
+ id: string;
4
+ itemId: string;
5
+ }
6
+
7
+ const { id, itemId } = Astro.props;
8
+ ---
9
+
10
+ <div
11
+ data-tab-content
12
+ data-tab-id={id}
13
+ data-tab-item-id={itemId}
14
+ hidden
15
+ >
16
+ <slot />
17
+ </div>
18
+
19
+ <style lang="scss">
20
+ @use './tab';
21
21
  </style>
@@ -1,41 +1,41 @@
1
- ---
2
- export interface Props {
3
- id: string;
4
- }
5
-
6
- const { id } = Astro.props;
7
- ---
8
-
9
- <div
10
- class="tab__item"
11
- data-tab-item={id}
12
- role="tab"
13
- aria-selected="false"
14
- tabindex="0"
15
- >
16
- <slot />
17
- </div>
18
-
19
- <script>
20
- document.querySelectorAll<HTMLElement>('[data-tab-item]').forEach((item) => {
21
- function notify() {
22
- const group = item.closest('[data-tab-group]');
23
- if (!group) return;
24
- group.dispatchEvent(new CustomEvent('tab-item:click', {
25
- detail: { itemId: item.dataset.tabItem },
26
- }));
27
- }
28
-
29
- item.addEventListener('click', notify);
30
- item.addEventListener('keydown', (e: KeyboardEvent) => {
31
- if (e.key === 'Enter' || e.key === ' ') {
32
- e.preventDefault();
33
- notify();
34
- }
35
- });
36
- });
37
- </script>
38
-
39
- <style lang="scss">
40
- @use './tab';
1
+ ---
2
+ export interface Props {
3
+ id: string;
4
+ }
5
+
6
+ const { id } = Astro.props;
7
+ ---
8
+
9
+ <div
10
+ class="tab__item"
11
+ data-tab-item={id}
12
+ role="tab"
13
+ aria-selected="false"
14
+ tabindex="0"
15
+ >
16
+ <slot />
17
+ </div>
18
+
19
+ <script>
20
+ document.querySelectorAll<HTMLElement>('[data-tab-item]').forEach((item) => {
21
+ function notify() {
22
+ const group = item.closest('[data-tab-group]');
23
+ if (!group) return;
24
+ group.dispatchEvent(new CustomEvent('tab-item:click', {
25
+ detail: { itemId: item.dataset.tabItem },
26
+ }));
27
+ }
28
+
29
+ item.addEventListener('click', notify);
30
+ item.addEventListener('keydown', (e: KeyboardEvent) => {
31
+ if (e.key === 'Enter' || e.key === ' ') {
32
+ e.preventDefault();
33
+ notify();
34
+ }
35
+ });
36
+ });
37
+ </script>
38
+
39
+ <style lang="scss">
40
+ @use './tab';
41
41
  </style>
@@ -1,33 +1,33 @@
1
- .toggle {
2
- background-color: var(--nds-disabled);
3
- border-radius: var(--nds-radius-full);
4
- padding: var(--nds-spacing-2xs);
5
- width: 50px;
6
- height: 25px;
7
- display: flex;
8
- align-items: center;
9
- justify-content: left;
10
- cursor: pointer;
11
- transition: background-color 160ms ease;
12
- position: relative;
13
- &-switch {
14
- color: var(--nds-text);
15
- width: 15px;
16
- height: 15px;
17
- background-color: var(--nds-text);
18
- border-radius: var(--nds-radius-full);
19
- position: absolute;
20
- left: var(--nds-spacing-2xs);
21
- top: 50%;
22
- transform: translateY(-50%);
23
- transition: left 160ms ease, background-color 160ms ease, transform 160ms ease;
24
- }
25
- &-active {
26
- display: flex;
27
- justify-content: right;
28
- background-color: var(--nds-primary);
29
- .toggle-switch {
30
- left: calc(100% - var(--nds-spacing-2xs) - 15px);
31
- }
32
- }
33
- }
1
+ .toggle {
2
+ background-color: var(--nds-disabled);
3
+ border-radius: var(--nds-radius-full);
4
+ padding: var(--nds-spacing-2xs);
5
+ width: 50px;
6
+ height: 25px;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: left;
10
+ cursor: pointer;
11
+ transition: background-color 160ms ease;
12
+ position: relative;
13
+ &-switch {
14
+ color: var(--nds-text);
15
+ width: 15px;
16
+ height: 15px;
17
+ background-color: var(--nds-text);
18
+ border-radius: var(--nds-radius-full);
19
+ position: absolute;
20
+ left: var(--nds-spacing-2xs);
21
+ top: 50%;
22
+ transform: translateY(-50%);
23
+ transition: left 160ms ease, background-color 160ms ease, transform 160ms ease;
24
+ }
25
+ &-active {
26
+ display: flex;
27
+ justify-content: right;
28
+ background-color: var(--nds-primary);
29
+ .toggle-switch {
30
+ left: calc(100% - var(--nds-spacing-2xs) - 15px);
31
+ }
32
+ }
33
+ }
@@ -1,62 +1,62 @@
1
- ---
2
- import { boolean } from 'astro:schema';
3
-
4
- export interface Props {
5
- 'data-checked': boolean;
6
- name?: string;
7
- id: string;
8
- }
9
-
10
- const { 'data-checked': dataChecked = 'false', name = 'toggle', id } = Astro.props;
11
- ---
12
-
13
- <toggle-switch data-checked={dataChecked} data-name={name} id={id}>
14
- <div class="toggle">
15
- <div class="toggle-switch"></div>
16
- </div>
17
- </toggle-switch>
18
-
19
- <script>
20
- class ToggleSwitch extends HTMLElement {
21
- private _checked: boolean = false;
22
-
23
- connectedCallback() {
24
- this._checked = this.dataset.checked === 'true';
25
- this.updateUI();
26
-
27
- this.querySelector('.toggle')?.addEventListener('click', () => {
28
- this.toggle();
29
- });
30
- }
31
-
32
- toggle() {
33
- this._checked = !this._checked;
34
- this.updateUI();
35
-
36
- this.dispatchEvent(new CustomEvent('change', {
37
- detail: { checked: this._checked, name: this.dataset.name },
38
- bubbles: true,
39
- composed: true,
40
- }));
41
- }
42
- set checked(value: boolean) {
43
- this._checked = value;
44
- this.updateUI();
45
- }
46
-
47
- get checked() {
48
- return this._checked;
49
- }
50
-
51
- private updateUI() {
52
- this.dataset.checked = String(this._checked);
53
- this.querySelector('.toggle')?.classList.toggle('toggle-active', this._checked);
54
- }
55
- }
56
-
57
- customElements.define('toggle-switch', ToggleSwitch);
58
- </script>
59
-
60
- <style lang="scss">
61
- @use './_toggle.scss';
1
+ ---
2
+ import { boolean } from 'astro:schema';
3
+
4
+ export interface Props {
5
+ 'data-checked': boolean;
6
+ name?: string;
7
+ id: string;
8
+ }
9
+
10
+ const { 'data-checked': dataChecked = 'false', name = 'toggle', id } = Astro.props;
11
+ ---
12
+
13
+ <toggle-switch data-checked={dataChecked} data-name={name} id={id}>
14
+ <div class="toggle">
15
+ <div class="toggle-switch"></div>
16
+ </div>
17
+ </toggle-switch>
18
+
19
+ <script>
20
+ class ToggleSwitch extends HTMLElement {
21
+ private _checked: boolean = false;
22
+
23
+ connectedCallback() {
24
+ this._checked = this.dataset.checked === 'true';
25
+ this.updateUI();
26
+
27
+ this.querySelector('.toggle')?.addEventListener('click', () => {
28
+ this.toggle();
29
+ });
30
+ }
31
+
32
+ toggle() {
33
+ this._checked = !this._checked;
34
+ this.updateUI();
35
+
36
+ this.dispatchEvent(new CustomEvent('change', {
37
+ detail: { checked: this._checked, name: this.dataset.name },
38
+ bubbles: true,
39
+ composed: true,
40
+ }));
41
+ }
42
+ set checked(value: boolean) {
43
+ this._checked = value;
44
+ this.updateUI();
45
+ }
46
+
47
+ get checked() {
48
+ return this._checked;
49
+ }
50
+
51
+ private updateUI() {
52
+ this.dataset.checked = String(this._checked);
53
+ this.querySelector('.toggle')?.classList.toggle('toggle-active', this._checked);
54
+ }
55
+ }
56
+
57
+ customElements.define('toggle-switch', ToggleSwitch);
58
+ </script>
59
+
60
+ <style lang="scss">
61
+ @use './_toggle.scss';
62
62
  </style>
@@ -1,10 +1,13 @@
1
- // Auto-generated by scripts/generate-barrel.mjs — do not edit manually.
2
-
3
- export * from './Icons/index.ts';
4
- export { default as Notification } from './Notifications/notification.astro';
5
- export { default as Toggle } from './Toggle/toggle.astro';
6
- export { default as Tab } from './Tabs/tab.astro';
7
- export { default as TabItem } from './Tabs/tabItem.astro';
8
- export { default as TabContent } from './Tabs/tabContent.astro';
9
- export { default as Button } from './Button/button.astro';
10
- export { default as Link } from './Link/link.astro';
1
+ // Auto-generated by scripts/generate-barrel.mjs — do not edit manually.
2
+
3
+ export * from './Icons/index.ts';
4
+ export { default as Notification } from './Notifications/notification.astro';
5
+ export { default as Toggle } from './Toggle/toggle.astro';
6
+ export { default as Tab } from './Tabs/tab.astro';
7
+ export { default as TabItem } from './Tabs/tabItem.astro';
8
+ export { default as TabContent } from './Tabs/tabContent.astro';
9
+ export { default as Button } from './Button/button.astro';
10
+ export { default as Link } from './Link/link.astro';
11
+ export { default as ListItem } from './ListItem/listItem.astro';
12
+ export { default as ListItemTitle } from './ListItem/listItemTitle.astro';
13
+ export { default as ListItemSubtitle } from './ListItem/listItemSubtitle.astro';
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './components/index.ts';
1
+ export * from './components/index.ts';
@@ -1,29 +1,29 @@
1
- ---
2
- import '../styles/index.scss';
3
- ---
4
-
5
- <!doctype html>
6
- <html lang="en">
7
- <head>
8
- <meta charset="UTF-8" />
9
- <meta name="viewport" content="width=device-width" />
10
- <link rel="icon" href="/favicon.ico" />
11
- <meta name="generator" content={Astro.generator} />
12
- <title>Nova Design System</title>
13
- </head>
14
- <body>
15
- <slot />
16
- </body>
17
- </html>
18
-
19
- <style>
20
- html,
21
- body {
22
- margin: 0;
23
- width: 100%;
24
- min-height: 100%;
25
- font-family: var(--nds-font-family-base);
26
- background-color: var(--nds-page-low);
27
- color: var(--nds-default);
28
- }
29
- </style>
1
+ ---
2
+ import '../styles/index.scss';
3
+ ---
4
+
5
+ <!doctype html>
6
+ <html lang="en">
7
+ <head>
8
+ <meta charset="UTF-8" />
9
+ <meta name="viewport" content="width=device-width" />
10
+ <link rel="icon" href="/favicon.ico" />
11
+ <meta name="generator" content={Astro.generator} />
12
+ <title>Nova Design System</title>
13
+ </head>
14
+ <body>
15
+ <slot />
16
+ </body>
17
+ </html>
18
+
19
+ <style>
20
+ html,
21
+ body {
22
+ margin: 0;
23
+ width: 100%;
24
+ min-height: 100%;
25
+ font-family: var(--nds-font-family-base);
26
+ background-color: var(--nds-page-low);
27
+ color: var(--nds-default);
28
+ }
29
+ </style>