@infonomic/uikit 5.3.0 → 5.5.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 (70) hide show
  1. package/dist/astro.d.ts +51 -0
  2. package/dist/astro.js +51 -0
  3. package/dist/components/accordion/accordion.module.css +60 -0
  4. package/dist/components/avatar/avatar.module.css +54 -0
  5. package/dist/components/badge/badge.module.css +61 -0
  6. package/dist/components/button/button-group.module.css +19 -0
  7. package/dist/components/button/button.astro +86 -0
  8. package/dist/components/button/button.module.css +431 -0
  9. package/dist/components/button/control-buttons.module.css +132 -0
  10. package/dist/components/button/copy-button.module.css +56 -0
  11. package/dist/components/button/icon-button.astro +47 -0
  12. package/dist/components/card/card-content.astro +14 -0
  13. package/dist/components/card/card-description.astro +14 -0
  14. package/dist/components/card/card-footer.astro +14 -0
  15. package/dist/components/card/card-header.astro +14 -0
  16. package/dist/components/card/card-title.astro +14 -0
  17. package/dist/components/card/card.astro +41 -0
  18. package/dist/components/card/card.module.css +77 -0
  19. package/dist/components/container/container.astro +13 -0
  20. package/dist/components/container/container.module.css +36 -0
  21. package/dist/components/dropdown/dropdown.module.css +120 -0
  22. package/dist/components/forms/calendar.module.css +269 -0
  23. package/dist/components/forms/checkbox.astro +129 -0
  24. package/dist/components/forms/checkbox.js +1 -1
  25. package/dist/components/forms/checkbox.module.css +211 -0
  26. package/dist/components/forms/error-text.astro +14 -0
  27. package/dist/components/forms/error-text.module.css +9 -0
  28. package/dist/components/forms/help-text.astro +13 -0
  29. package/dist/components/forms/help-text.module.css +9 -0
  30. package/dist/components/forms/input-adornment.astro +26 -0
  31. package/dist/components/forms/input-adornment.module.css +21 -0
  32. package/dist/components/forms/input.astro +99 -0
  33. package/dist/components/forms/input.module.css +278 -0
  34. package/dist/components/forms/label.astro +24 -0
  35. package/dist/components/forms/label.module.css +15 -0
  36. package/dist/components/forms/radio-group.module.css +163 -0
  37. package/dist/components/forms/select.module.css +68 -0
  38. package/dist/components/forms/text-area.astro +77 -0
  39. package/dist/components/forms/text-area.module.css +10 -0
  40. package/dist/components/hamburger/hamburger.astro +30 -0
  41. package/dist/components/notifications/alert.module.css +110 -0
  42. package/dist/components/notifications/toast.module.css +237 -0
  43. package/dist/components/overlay/overlay.module.css +41 -0
  44. package/dist/components/pager/pagination.module.css +149 -0
  45. package/dist/components/scroll-area/scroll-area.module.css +64 -0
  46. package/dist/components/scroll-to-top/scroll-to-top.astro +75 -0
  47. package/dist/components/scroll-to-top/scroll-to-top.module.css +86 -0
  48. package/dist/components/section/section.astro +13 -0
  49. package/dist/components/section/section.module.css +9 -0
  50. package/dist/components/shimmer/shimmer.module.css +53 -0
  51. package/dist/components/table/table.module.css +100 -0
  52. package/dist/components/tabs/tabs.module.css +66 -0
  53. package/dist/components/tooltip/tooltip.module.css +45 -0
  54. package/dist/icons/check-icon.astro +37 -0
  55. package/dist/icons/close-icon.astro +38 -0
  56. package/dist/icons/icon-element.astro +27 -0
  57. package/dist/icons/icons.module.css +155 -0
  58. package/dist/icons/light-icon.astro +36 -0
  59. package/dist/icons/moon-icon.astro +38 -0
  60. package/dist/icons/search-icon.astro +40 -0
  61. package/dist/widgets/datepicker/datepicker.module.css +189 -0
  62. package/dist/widgets/drawer/drawer.module.css +112 -0
  63. package/dist/widgets/modal/modal.module.css +81 -0
  64. package/dist/widgets/timeline/timeline.module.css +87 -0
  65. package/package.json +5 -4
  66. package/src/astro.js +6 -0
  67. package/src/components/forms/checkbox.astro +129 -0
  68. package/src/components/forms/checkbox.tsx +1 -1
  69. package/src/components/forms/text-area.astro +77 -0
  70. package/src/icons/check-icon.astro +37 -0
@@ -0,0 +1,189 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+ .container {
5
+ position: relative;
6
+ }
7
+
8
+ .input,
9
+ .input-wrapper {
10
+ width: 100%;
11
+ }
12
+
13
+ .content {
14
+ width: 100%;
15
+ border-radius: 4px;
16
+ padding-top: var(--spacing-16);
17
+ padding-bottom: var(--spacing-8);
18
+ padding-left: var(--spacing-8);
19
+ padding-right: var(--spacing-4);
20
+ background-color: var(--background);
21
+ border: 1px solid var(--border-color);
22
+ box-shadow: var(--shadow-md);
23
+ animation-duration: 400ms;
24
+ animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
25
+ will-change: transform, opacity;
26
+
27
+ &:focus {
28
+ box-shadow: var(--shadow-md)
29
+ }
30
+
31
+ &[data-state="open"][data-side="top"] {
32
+ animation-name: slideDownAndFade;
33
+ }
34
+
35
+ &[data-state="open"][data-side="right"] {
36
+ animation-name: slideLeftAndFade;
37
+ }
38
+
39
+ &[data-state="open"][data-side="bottom"] {
40
+ animation-name: slideUpAndFade;
41
+ }
42
+
43
+ &[data-state="open"][data-side="left"] {
44
+ animation-name: slideRightAndFade;
45
+ }
46
+ }
47
+
48
+ .content:is(:global(.dark) *) {
49
+ background: var(--canvas-800);
50
+ }
51
+
52
+ .content-components {
53
+ display: flex;
54
+ width: 100%;
55
+ gap: var(--spacing-8);
56
+ }
57
+
58
+
59
+ .status-and-actions {
60
+ display: flex;
61
+ flex-direction: column;
62
+ justify-content: space-between;
63
+ align-items: center;
64
+ width: 100%;
65
+ }
66
+
67
+ .content-status {
68
+ display: flex;
69
+ align-items: center;
70
+ padding-left: var(--spacing-16);
71
+ padding-right: var(--spacing-8);
72
+ font-size: var(--font-size-sm);
73
+ color: var(--foreground);
74
+ width: 100%;
75
+ }
76
+
77
+ .content-actions {
78
+ display: flex;
79
+ flex-direction: row;
80
+ justify-content: space-between;
81
+ margin-top: var(--spacing-12);
82
+ padding-left: var(--spacing-16);
83
+ padding-right: var(--spacing-6);
84
+ gap: var(--spacing-8);
85
+ width: 100%;
86
+ }
87
+
88
+ .content-actions-button {
89
+ /* min-width: 100px; */
90
+ --ring-color: var(--violet-7);
91
+ }
92
+
93
+ .arrow {
94
+ fill: var(--gray-50);
95
+ }
96
+
97
+ .close {
98
+ all: unset;
99
+ font-family: inherit;
100
+ border-radius: 100%;
101
+ height: 25px;
102
+ width: 25px;
103
+ display: inline-flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ color: var(--violet-11);
107
+ position: absolute;
108
+ top: 5px;
109
+ right: 5px;
110
+
111
+ &:hover {
112
+ background-color: var(--primary-400);
113
+ }
114
+
115
+ &:focus {
116
+ box-shadow: 0 0 0 2px var(--primary-600);
117
+ }
118
+ }
119
+
120
+ .time-picker-container {
121
+ width: 80px;
122
+ margin: 0.6rem 0.5rem 1rem 0;
123
+ }
124
+
125
+ .time-picker-scroll-area {
126
+ height: 280px;
127
+ padding-right: var(--spacing-16)
128
+ }
129
+
130
+ .time-picker {
131
+ display: flex;
132
+ padding-left: var(--spacing-4);
133
+ padding-right: var(--spacing-4);
134
+ flex-direction: column;
135
+ gap: 0.5rem;
136
+ }
137
+
138
+ .time-picker-button {
139
+ width: 100%;
140
+ }
141
+
142
+ @keyframes slideUpAndFade {
143
+ from {
144
+ opacity: 0;
145
+ transform: translateY(2px);
146
+ }
147
+
148
+ to {
149
+ opacity: 1;
150
+ transform: translateY(0);
151
+ }
152
+ }
153
+
154
+ @keyframes slideRightAndFade {
155
+ from {
156
+ opacity: 0;
157
+ transform: translateX(-2px);
158
+ }
159
+
160
+ to {
161
+ opacity: 1;
162
+ transform: translateX(0);
163
+ }
164
+ }
165
+
166
+ @keyframes slideDownAndFade {
167
+ from {
168
+ opacity: 0;
169
+ transform: translateY(-2px);
170
+ }
171
+
172
+ to {
173
+ opacity: 1;
174
+ transform: translateY(0);
175
+ }
176
+ }
177
+
178
+ @keyframes slideLeftAndFade {
179
+ from {
180
+ opacity: 0;
181
+ transform: translateX(2px);
182
+ }
183
+
184
+ to {
185
+ opacity: 1;
186
+ transform: translateX(0);
187
+ }
188
+ }
189
+ }
@@ -0,0 +1,112 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+ .drawer-wrapper {
5
+ position: fixed;
6
+ display: flex;
7
+ flex-direction: column;
8
+ justify-content: end;
9
+ top: 0;
10
+ left: 0;
11
+ right: 0;
12
+ bottom: 0;
13
+ z-index: 30;
14
+ opacity: 1;
15
+ }
16
+
17
+
18
+ .drawer-container {
19
+ position: absolute;
20
+ right: 0;
21
+ height: 100%;
22
+ background-color: var(--surface-panel);
23
+ box-shadow: var(--shadow-md);
24
+ z-index: inherit;
25
+ }
26
+
27
+ .drawer-container[aria-hidden="false"] {
28
+ animation: slideIn 150ms cubic-bezier(0.16, 1, 0.3, 1);
29
+ }
30
+
31
+ .drawer-depth-0.drawer-medium .drawer-container,
32
+ .drawer-depth-0.drawer-wide .drawer-container {
33
+ width: 90%;
34
+ }
35
+
36
+ .drawer-depth-1.drawer-medium .drawer-container,
37
+ .drawer-depth-1.drawer-wide .drawer-container {
38
+ width: 88%;
39
+ }
40
+
41
+ .drawer-depth-2.drawer- .drawer-container,
42
+ .drawer-depth-2.drawer-wide .drawer-container {
43
+ width: 86%;
44
+ }
45
+
46
+ @media (min-width: 48rem) {
47
+ .drawer-depth-0.drawer-medium .drawer-container {
48
+ width: 600px;
49
+ }
50
+
51
+ .drawer-depth-1.drawer-medium .drawer-container {
52
+ width: 580px;
53
+ }
54
+
55
+ .drawer-depth-2.drawer- .drawer-container {
56
+ width: 560px;
57
+ }
58
+ }
59
+
60
+ .drawer-narrow .drawer-container {
61
+ width: calc(100% - 32px);
62
+ max-width: 400px
63
+ }
64
+
65
+ .drawer-container[aria-hidden="true"] {
66
+ transform: translateX(100%);
67
+ opacity: 0;
68
+ }
69
+
70
+ .drawer-top-actions {
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: flex-end;
74
+ padding-top: var(--spacing-12);
75
+ padding-left: var(--spacing-12);
76
+ padding-right: var(--spacing-12);
77
+ padding-bottom: 0;
78
+ max-width: 100%;
79
+ }
80
+
81
+ .drawer-header {
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: space-between;
85
+ gap: var(--gap-3);
86
+ padding-top: 0;
87
+ padding-left: var(--spacing-12);
88
+ padding-right: var(--spacing-12);
89
+ max-width: 100%;
90
+ }
91
+
92
+ .drawer-header h2,
93
+ .drawer-header h3 {
94
+ margin: 0;
95
+ }
96
+
97
+ .drawer-content {
98
+ padding: var(--spacing-12);
99
+ }
100
+
101
+ @keyframes slideIn {
102
+ from {
103
+ transform: translateX(100%);
104
+ opacity: 0;
105
+ }
106
+
107
+ to {
108
+ transform: translateX(0);
109
+ opacity: 1;
110
+ }
111
+ }
112
+ }
@@ -0,0 +1,81 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+ .modal-wrapper {
5
+ position: fixed;
6
+ display: flex;
7
+ flex-direction: column;
8
+ justify-content: center;
9
+ align-items: center;
10
+ top: 0;
11
+ left: 0;
12
+ right: 0;
13
+ bottom: 0;
14
+ z-index: 30;
15
+ opacity: 1;
16
+ }
17
+
18
+ .modal-container {
19
+ position: absolute;
20
+ display: flex;
21
+ flex-direction: column;
22
+ box-shadow: var(--shadow-md);
23
+ border-radius: var(--border-radius-md);
24
+ z-index: 20;
25
+ min-height: 300px;
26
+ max-height: 88vh;
27
+ width: 100%;
28
+ bottom: 0;
29
+ background-color: var(--surface-panel);
30
+ border: 1px solid var(--border-color);
31
+ margin-left: var(--spacing-8);
32
+ margin-right: var(--spacing-8);
33
+ }
34
+
35
+ @media screen and (min-width: 40rem) {
36
+ .modal-container {
37
+ max-height: calc(100vh - 24px);
38
+ min-height: auto;
39
+ bottom: auto;
40
+ width: auto;
41
+ }
42
+ }
43
+
44
+ .modal-header {
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: space-between;
48
+ gap: var(--gap-3);
49
+ padding-left: var(--spacing-16);
50
+ padding-right: var(--spacing-16);
51
+ padding-top: var(--spacing-20);
52
+ max-width: 100%;
53
+ }
54
+
55
+ .modal-header h2,
56
+ .modal-header h3 {
57
+ margin: 0;
58
+ }
59
+
60
+ .modal-content {
61
+ display: flex;
62
+ flex: 1;
63
+ flex-direction: column;
64
+ gap: var(--gap-3);
65
+ padding-left: var(--spacing-16);
66
+ padding-right: var(--spacing-16);
67
+ padding-bottom: var(--spacing-12);
68
+ max-width: 100%;
69
+ }
70
+
71
+ .modal-actions {
72
+ display: flex;
73
+ align-items: center;
74
+ justify-content: flex-end;
75
+ gap: var(--gap-3);
76
+ padding-top: var(--spacing-8);
77
+ padding-bottom: var(--spacing-20);
78
+ padding-left: var(--spacing-16);
79
+ padding-right: var(--spacing-16);
80
+ }
81
+ }
@@ -0,0 +1,87 @@
1
+ @layer infonomic-base, infonomic-functional, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+ .timeline {
5
+ margin-left: var(--spacing-8);
6
+ }
7
+
8
+ .timeline-root {
9
+ position: relative;
10
+ list-style: none;
11
+ margin-left: var(--spacing-8);
12
+ padding-left: var(--spacing-8);
13
+ border-left-width: var(--border-width-thin);
14
+ border-left-color: var(--border-color);
15
+ border-left-style: var(--border-style-solid);
16
+ }
17
+
18
+ .timeline-item {
19
+ margin: 0 0 var(--spacing-16) var(--spacing-20);
20
+ }
21
+
22
+ /* 'absolute block flex items-center justify-center w-[36px] h-[36px] rounded-full -mt-[3px] sm:mt-0 -left-[18px] border-[6px] bg-secondary-600 dark:bg-secondary-900 border-gray-50 dark:border-canvas-600', */
23
+ .timeline-icon {
24
+ position: absolute;
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ width: 36px;
29
+ height: 36px;
30
+ border-radius: 50%;
31
+ margin-top: -3px;
32
+ left: -18px;
33
+ border-width: 6px;
34
+ color: white;
35
+ background-color: var(--primary-600);
36
+ border-color: var(--gray-50);
37
+ }
38
+
39
+ .timeline-icon svg {
40
+ display: block;
41
+ width: 60%;
42
+ color: white;
43
+ }
44
+
45
+ /* 'text-[1.5rem] sm:text-[1.57rem] leading-[1.2] !m-0 font-semibold' */
46
+ .timeline-heading {
47
+ font-size: 1.5rem;
48
+ line-height: 1.2;
49
+ margin: 0;
50
+ font-weight: var(--font-weight-semibold);
51
+ }
52
+
53
+ /* 'block mt-2 mb-2 text-[0.9em] font-medium leading-none text-gray-900 dark:text-gray-100' */
54
+ .timeline-date {
55
+ display: block;
56
+ margin-top: var(--spacing-8);
57
+ margin-bottom: var(--spacing-8);
58
+ font-size: 0.9em;
59
+ font-weight: var(--font-weight-medium);
60
+ line-height: 0;
61
+ color: var(--gray-600);
62
+ }
63
+
64
+ /* '[&_p]:m-0 [&_p]:mb-4 [&_p]:sm:m-0 [&_p]:sm:mb-4 text-lg font-normal text-gray-900 dark:text-gray-300' */
65
+ .timeline-content {
66
+ margin: 0;
67
+ margin-bottom: var(--spacing-16);
68
+ font-size: 1.125rem;
69
+ font-weight: var(--font-weight-normal);
70
+
71
+ & p {
72
+ margin: 0;
73
+ margin-bottom: var(--spacing-16);
74
+ }
75
+ }
76
+
77
+ /* 🌙 Dark via `.dark` class. We rely on the
78
+ * consuming application to detect a user's preferred
79
+ * color scheme - either by header or cookie, and set
80
+ * a root html class accordingly
81
+ */
82
+ :global(.dark) {
83
+ .timeline-icon:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
84
+ border-color: var(--canvas-600);
85
+ }
86
+ }
87
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@infonomic/uikit",
3
3
  "private": false,
4
4
  "license": "MIT",
5
- "version": "5.3.0",
5
+ "version": "5.5.0",
6
6
  "type": "module",
7
7
  "description": "Infonomic UI kit is a collection of reusable UI components and utilities for React and Astro.",
8
8
  "keywords": [
@@ -30,9 +30,9 @@
30
30
  ],
31
31
  "exports": {
32
32
  "./astro": {
33
- "types": "./src/astro.d.ts",
34
- "import": "./src/astro.js",
35
- "default": "./src/astro.js"
33
+ "types": "./dist/astro.d.ts",
34
+ "import": "./dist/astro.js",
35
+ "default": "./dist/astro.js"
36
36
  },
37
37
  "./react": {
38
38
  "types": "./dist/react.d.ts",
@@ -114,6 +114,7 @@
114
114
  "build": "run-s build:*",
115
115
  "build:clean": "rimraf dist build",
116
116
  "build:code": "rslib build",
117
+ "build:astro": "node ./scripts/build-astro.js",
117
118
  "build:css": "lightningcss --bundle ./src/styles/styles.css ./src/styles/typography.css --output-dir ./dist/styles",
118
119
  "build:minify": "lightningcss --minify ./dist/styles/styles.css ./dist/styles/typography.css --output-dir ./dist/styles",
119
120
  "build:vanilla-components-css": "node ./scripts/task-merge-vanilla-components-css.js",
package/src/astro.js CHANGED
@@ -8,13 +8,16 @@ import CardHeaderComponent from './components/card/card-header.astro'
8
8
  import CardTitleComponent from './components/card/card-title.astro'
9
9
  import ContainerComponent from './components/container/container.astro'
10
10
  import HamburgerComponent from './components/hamburger/hamburger.astro'
11
+ import CheckboxComponent from './components/forms/checkbox.astro'
11
12
  import ErrorTextComponent from './components/forms/error-text.astro'
12
13
  import HelpTextComponent from './components/forms/help-text.astro'
13
14
  import InputComponent from './components/forms/input.astro'
14
15
  import InputAdornmentComponent from './components/forms/input-adornment.astro'
15
16
  import LabelComponent from './components/forms/label.astro'
17
+ import TextAreaComponent from './components/forms/text-area.astro'
16
18
  import SectionComponent from './components/section/section.astro'
17
19
  import ScrollToTopComponent from './components/scroll-to-top/scroll-to-top.astro'
20
+ import CheckIconComponent from './icons/check-icon.astro'
18
21
  import CloseIconComponent from './icons/close-icon.astro'
19
22
  import IconElementComponent from './icons/icon-element.astro'
20
23
  import LightIconComponent from './icons/light-icon.astro'
@@ -32,15 +35,18 @@ export const CardHeader = CardHeaderComponent
32
35
  export const CardTitle = CardTitleComponent
33
36
  export const Card = CardComponent
34
37
  export const Container = ContainerComponent
38
+ export const Checkbox = CheckboxComponent
35
39
  export const ErrorText = ErrorTextComponent
36
40
  export const HelpText = HelpTextComponent
37
41
  export const InputAdornment = InputAdornmentComponent
38
42
  export const Input = InputComponent
39
43
  export const Label = LabelComponent
44
+ export const TextArea = TextAreaComponent
40
45
  export const Section = SectionComponent
41
46
  export const ScrollToTop = ScrollToTopComponent
42
47
  export const IconElement = IconElementComponent
43
48
  export const LightIcon = LightIconComponent
44
49
  export const MoonIcon = MoonIconComponent
45
50
  export const SearchIcon = SearchIconComponent
51
+ export const CheckIcon = CheckIconComponent
46
52
  export const CloseIcon = CloseIconComponent
@@ -0,0 +1,129 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import type { Intent, Size, Variant } from './@types/checkbox.js'
4
+ import CheckIcon from '../../icons/check-icon.astro'
5
+ import ErrorText from './error-text.astro'
6
+ import HelpText from './help-text.astro'
7
+ import styles from './checkbox.module.css'
8
+
9
+ interface Props extends HTMLAttributes<'input'> {
10
+ id: string
11
+ name: string
12
+ label: string
13
+ variant?: Variant
14
+ size?: Size
15
+ intent?: Intent
16
+ reverse?: boolean
17
+ checked?: boolean
18
+ class?: string
19
+ checkBoxClasses?: string
20
+ containerClasses?: string
21
+ componentClasses?: string
22
+ labelClasses?: string
23
+ error?: boolean
24
+ helpText?: string
25
+ errorText?: string
26
+ }
27
+
28
+ const {
29
+ id,
30
+ name,
31
+ label,
32
+ variant = 'outlined',
33
+ size = 'md',
34
+ intent = 'primary',
35
+ reverse = false,
36
+ checked = false,
37
+ class: className,
38
+ checkBoxClasses,
39
+ containerClasses,
40
+ componentClasses,
41
+ labelClasses,
42
+ error = false,
43
+ helpText = '',
44
+ errorText = '',
45
+ ...rest
46
+ } = Astro.props
47
+ ---
48
+
49
+ <div class:list={['checkbox-container', containerClasses]}>
50
+ <div
51
+ class:list={[
52
+ 'checkbox-component',
53
+ styles.container,
54
+ componentClasses,
55
+ { [styles.reverse]: reverse }
56
+ ]}
57
+ >
58
+ <input type="checkbox" id={id} name={name} checked={checked} class="sr-only peer" {...rest} />
59
+
60
+ <label
61
+ for={id}
62
+ class:list={[
63
+ 'checkbox',
64
+ variant,
65
+ size,
66
+ intent,
67
+ styles.checkbox,
68
+ styles[variant],
69
+ styles[size],
70
+ styles[intent],
71
+ checkBoxClasses,
72
+ className
73
+ ]}
74
+ data-state={checked ? 'checked' : 'unchecked'}
75
+ >
76
+ <span
77
+ class:list={['checkbox-indicator', styles.indicator]}
78
+ data-state={checked ? 'checked' : 'unchecked'}
79
+ >
80
+ <CheckIcon class={styles.icon} />
81
+ </span>
82
+ </label>
83
+
84
+ <label for={id} class:list={[styles.label, labelClasses]}>
85
+ {label}
86
+ </label>
87
+ </div>
88
+ {
89
+ error ? (
90
+ <ErrorText id={`error-for-${id}`} text={errorText ?? helpText} />
91
+ ) : (
92
+ helpText?.length > 0 && <HelpText text={helpText} />
93
+ )
94
+ }
95
+ </div>
96
+
97
+ <script>
98
+ function setupCheckboxes() {
99
+ const inputs = document.querySelectorAll('input[type="checkbox"].peer')
100
+
101
+ inputs.forEach((input) => {
102
+ const checkboxInput = input as HTMLInputElement
103
+ const id = checkboxInput.id
104
+ // Find the visual checkbox label associated with this input
105
+ const visualCheckbox = document.querySelector(`label.checkbox[for="${id}"]`)
106
+ const indicator = visualCheckbox?.querySelector('.checkbox-indicator')
107
+
108
+ if (visualCheckbox && indicator) {
109
+ // Update state on change
110
+ checkboxInput.addEventListener('change', () => {
111
+ const state = checkboxInput.checked ? 'checked' : 'unchecked'
112
+ visualCheckbox.setAttribute('data-state', state)
113
+ indicator.setAttribute('data-state', state)
114
+ })
115
+
116
+ // Ensure initial state is correct
117
+ const state = checkboxInput.checked ? 'checked' : 'unchecked'
118
+ visualCheckbox.setAttribute('data-state', state)
119
+ indicator.setAttribute('data-state', state)
120
+ }
121
+ })
122
+ }
123
+
124
+ // Run on initial load
125
+ setupCheckboxes()
126
+
127
+ // Support Astro View Transitions
128
+ document.addEventListener('astro:page-load', setupCheckboxes)
129
+ </script>
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
 
3
- import { CheckIcon } from '@radix-ui/react-icons'
3
+ import { CheckIcon } from '../../icons/check-icon'
4
4
  import cx from 'classnames'
5
5
  import { Checkbox as CheckboxPrimitive, Label as LabelPrimitive } from 'radix-ui'
6
6
  import type * as React from 'react'