@ivds/core 0.1.1

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 (154) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +215 -0
  3. package/lib/all.css +6802 -0
  4. package/lib/all.min.css +1 -0
  5. package/lib/base/base.css +215 -0
  6. package/lib/base/base.min.css +1 -0
  7. package/lib/components/_breadcrumb-mixins.scss +173 -0
  8. package/lib/components/_button-mixin.scss +120 -0
  9. package/lib/components/_card-mixin.scss +196 -0
  10. package/lib/components/_checkbox-mixin.scss +208 -0
  11. package/lib/components/_footer-mixin.scss +385 -0
  12. package/lib/components/_header-mixin.scss +275 -0
  13. package/lib/components/_navigation-mixins.scss +270 -0
  14. package/lib/components/_notification-mixin.scss +239 -0
  15. package/lib/components/_pagination-mixins.scss +280 -0
  16. package/lib/components/_radio-button-mixin.scss +207 -0
  17. package/lib/components/_tag-mixin.scss +261 -0
  18. package/lib/components/_text-input-mixin.scss +203 -0
  19. package/lib/components/all.css +3005 -0
  20. package/lib/components/all.min.css +1 -0
  21. package/lib/components/breadcrumb/breadcrumb.css +141 -0
  22. package/lib/components/breadcrumb/breadcrumb.min.css +1 -0
  23. package/lib/components/button/button.css +221 -0
  24. package/lib/components/button/button.min.css +1 -0
  25. package/lib/components/card/card.css +236 -0
  26. package/lib/components/card/card.min.css +1 -0
  27. package/lib/components/checkbox/checkbox.css +305 -0
  28. package/lib/components/checkbox/checkbox.min.css +1 -0
  29. package/lib/components/footer/footer.css +466 -0
  30. package/lib/components/footer/footer.min.css +1 -0
  31. package/lib/components/header/header.css +274 -0
  32. package/lib/components/header/header.min.css +1 -0
  33. package/lib/components/navigation/navigation.css +214 -0
  34. package/lib/components/navigation/navigation.min.css +1 -0
  35. package/lib/components/notification/notification.css +253 -0
  36. package/lib/components/notification/notification.min.css +1 -0
  37. package/lib/components/pagination/pagination.css +221 -0
  38. package/lib/components/pagination/pagination.min.css +1 -0
  39. package/lib/components/radio-button/radio-button.css +326 -0
  40. package/lib/components/radio-button/radio-button.min.css +1 -0
  41. package/lib/components/tag/tag.css +367 -0
  42. package/lib/components/tag/tag.min.css +1 -0
  43. package/lib/components/text-input/text-input.css +243 -0
  44. package/lib/components/text-input/text-input.min.css +1 -0
  45. package/lib/icons/icon-arrow-left.css +139 -0
  46. package/lib/icons/icon-arrow-left.min.css +1 -0
  47. package/lib/icons/icon-arrow-right.css +139 -0
  48. package/lib/icons/icon-arrow-right.min.css +1 -0
  49. package/lib/icons/icon-check.css +139 -0
  50. package/lib/icons/icon-check.min.css +1 -0
  51. package/lib/icons/icon-close.css +140 -0
  52. package/lib/icons/icon-close.min.css +1 -0
  53. package/lib/icons/icon-error.css +140 -0
  54. package/lib/icons/icon-error.min.css +1 -0
  55. package/lib/icons/icon-info.css +140 -0
  56. package/lib/icons/icon-info.min.css +1 -0
  57. package/lib/icons/icon-success.css +139 -0
  58. package/lib/icons/icon-success.min.css +1 -0
  59. package/lib/icons/icon-warning.css +139 -0
  60. package/lib/icons/icon-warning.min.css +1 -0
  61. package/lib/icons/icons.css +1158 -0
  62. package/lib/icons/icons.min.css +1 -0
  63. package/lib/utils/_flex.scss +200 -0
  64. package/lib/utils/_grid.scss +211 -0
  65. package/lib/utils/_layout.scss +253 -0
  66. package/lib/utils/_spacing.scss +260 -0
  67. package/lib/utils/_typography.scss +111 -0
  68. package/lib/utils/utils.css +2434 -0
  69. package/lib/utils/utils.min.css +1 -0
  70. package/lib/utils-only.css +2801 -0
  71. package/lib/utils-only.min.css +1 -0
  72. package/lib/variables/variables.css +2 -0
  73. package/lib/variables/variables.min.css +0 -0
  74. package/package.json +194 -0
  75. package/src/__tests__/example.test.scss +12 -0
  76. package/src/accessibility.stories.js +416 -0
  77. package/src/all.scss +9 -0
  78. package/src/base/_layout.scss +97 -0
  79. package/src/base/_reset.scss +85 -0
  80. package/src/base/_typography.scss +105 -0
  81. package/src/base/base.scss +6 -0
  82. package/src/components/all.scss +22 -0
  83. package/src/components/breadcrumb/_breadcrumb-mixins.scss +173 -0
  84. package/src/components/breadcrumb/breadcrumb.scss +68 -0
  85. package/src/components/breadcrumb/breadcrumb.stories.js +483 -0
  86. package/src/components/button/__tests__/button-mixins.test.scss +35 -0
  87. package/src/components/button/_button-mixin.scss +120 -0
  88. package/src/components/button/button.scss +126 -0
  89. package/src/components/button/button.stories.js +364 -0
  90. package/src/components/card/__tests__/card-mixins.test.scss +36 -0
  91. package/src/components/card/_card-mixin.scss +196 -0
  92. package/src/components/card/card.scss +193 -0
  93. package/src/components/card/card.stories.js +635 -0
  94. package/src/components/checkbox/_checkbox-mixin.scss +208 -0
  95. package/src/components/checkbox/checkbox.scss +141 -0
  96. package/src/components/checkbox/checkbox.stories.js +303 -0
  97. package/src/components/footer/_footer-mixin.scss +385 -0
  98. package/src/components/footer/footer.scss +86 -0
  99. package/src/components/footer/footer.stories.js +740 -0
  100. package/src/components/header/_header-mixin.scss +275 -0
  101. package/src/components/header/header.scss +84 -0
  102. package/src/components/header/header.stories.js +450 -0
  103. package/src/components/navigation/_navigation-mixins.scss +270 -0
  104. package/src/components/navigation/navigation.scss +64 -0
  105. package/src/components/navigation/navigation.stories.js +410 -0
  106. package/src/components/notification/_notification-mixin.scss +239 -0
  107. package/src/components/notification/notification.scss +118 -0
  108. package/src/components/notification/notification.stories.js +378 -0
  109. package/src/components/overview.stories.js +473 -0
  110. package/src/components/pagination/_pagination-mixins.scss +280 -0
  111. package/src/components/pagination/pagination.scss +76 -0
  112. package/src/components/pagination/pagination.stories.js +729 -0
  113. package/src/components/radio-button/_radio-button-mixin.scss +207 -0
  114. package/src/components/radio-button/radio-button.scss +178 -0
  115. package/src/components/radio-button/radio-button.stories.js +379 -0
  116. package/src/components/tag/_tag-mixin.scss +261 -0
  117. package/src/components/tag/tag.scss +244 -0
  118. package/src/components/tag/tag.stories.js +482 -0
  119. package/src/components/text-input/_text-input-mixin.scss +203 -0
  120. package/src/components/text-input/text-input.scss +150 -0
  121. package/src/components/text-input/text-input.stories.js +723 -0
  122. package/src/icons/_icon.scss +121 -0
  123. package/src/icons/icon-arrow-left.scss +23 -0
  124. package/src/icons/icon-arrow-right.scss +23 -0
  125. package/src/icons/icon-check.scss +23 -0
  126. package/src/icons/icon-close.scss +24 -0
  127. package/src/icons/icon-error.scss +24 -0
  128. package/src/icons/icon-info.scss +24 -0
  129. package/src/icons/icon-success.scss +23 -0
  130. package/src/icons/icon-warning.scss +23 -0
  131. package/src/icons/icons.scss +12 -0
  132. package/src/icons/icons.stories.js +249 -0
  133. package/src/icons/svg/arrow-left.svg +3 -0
  134. package/src/icons/svg/arrow-right.svg +3 -0
  135. package/src/icons/svg/check.svg +3 -0
  136. package/src/icons/svg/close.svg +4 -0
  137. package/src/icons/svg/error.svg +5 -0
  138. package/src/icons/svg/info.svg +5 -0
  139. package/src/icons/svg/success.svg +4 -0
  140. package/src/icons/svg/warning.svg +5 -0
  141. package/src/utils/__tests__/utilities.test.scss +37 -0
  142. package/src/utils/_flex.scss +200 -0
  143. package/src/utils/_grid.scss +211 -0
  144. package/src/utils/_layout.scss +253 -0
  145. package/src/utils/_spacing.scss +260 -0
  146. package/src/utils/_typography.scss +111 -0
  147. package/src/utils/utils.scss +8 -0
  148. package/src/variables/_borders.scss +15 -0
  149. package/src/variables/_breakpoints.scss +11 -0
  150. package/src/variables/_colors.scss +97 -0
  151. package/src/variables/_shadows.scss +14 -0
  152. package/src/variables/_spacing.scss +24 -0
  153. package/src/variables/_typography.scss +47 -0
  154. package/src/variables/variables.scss +9 -0
@@ -0,0 +1,208 @@
1
+ // Checkbox component mixins and private styles
2
+ // This file contains mixins for checkbox variants, sizes, states, and internal utilities
3
+
4
+ @use '../../variables/variables' as vars;
5
+
6
+ // Base checkbox mixin with common styles
7
+ @mixin checkbox-base {
8
+ position: relative;
9
+ display: inline-flex;
10
+ align-items: flex-start;
11
+ cursor: pointer;
12
+ user-select: none;
13
+
14
+ &:hover .ivds-checkbox__box {
15
+ border-color: var(--color-brand-primary-400, #fb923c);
16
+ }
17
+ }
18
+
19
+ // Hidden input mixin
20
+ @mixin checkbox-input {
21
+ position: absolute;
22
+ opacity: 0;
23
+ width: 1px;
24
+ height: 1px;
25
+ margin: 0;
26
+ padding: 0;
27
+ border: 0;
28
+ clip: rect(0, 0, 0, 0);
29
+ overflow: hidden;
30
+ }
31
+
32
+ // Checkbox box mixin
33
+ @mixin checkbox-box($size: 18px, $border-radius: var(--borderRadius-sm, 0.125rem)) {
34
+ position: relative;
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ width: $size;
39
+ height: $size;
40
+ min-width: $size;
41
+ border: var(--borderWidth-1, 1px) solid var(--color-semantic-neutral-300, #cbd5e1);
42
+ border-radius: $border-radius;
43
+ background-color: var(--color-semantic-neutral-50, #f8fafc);
44
+ transition: all 0.15s ease-in-out;
45
+
46
+ &::after {
47
+ content: '';
48
+ position: absolute;
49
+ width: 10px;
50
+ height: 6px;
51
+ border: 2px solid transparent;
52
+ border-top: none;
53
+ border-right: none;
54
+ transform: rotate(-45deg) scale(0);
55
+ transition: transform 0.15s ease-in-out;
56
+ }
57
+ }
58
+
59
+ // Checkbox label mixin
60
+ @mixin checkbox-label($font-size: var(--fontSize-base, 1rem), $gap: var(--spacing-3, 0.75rem)) {
61
+ margin-left: $gap;
62
+ font-size: $font-size;
63
+ color: var(--color-semantic-neutral-900, #0f172a);
64
+ line-height: var(--lineHeight-normal, 1.5);
65
+ }
66
+
67
+ // Checkbox checked state mixin
68
+ @mixin checkbox-checked($bg-color: var(--color-brand-primary-500, #f97316), $border-color: var(--color-brand-primary-500, #f97316)) {
69
+ background-color: $bg-color;
70
+ border-color: $border-color;
71
+
72
+ &::after {
73
+ border-color: var(--color-semantic-neutral-50, #f8fafc);
74
+ transform: rotate(-45deg) scale(1);
75
+ }
76
+ }
77
+
78
+ // Checkbox focus state mixin
79
+ @mixin checkbox-focus {
80
+ outline: 2px solid var(--color-brand-primary-500, #f97316);
81
+ outline-offset: 2px;
82
+ }
83
+
84
+ // Checkbox disabled state mixin
85
+ @mixin checkbox-disabled {
86
+ cursor: not-allowed;
87
+ opacity: 0.6;
88
+
89
+ .ivds-checkbox__box {
90
+ background-color: var(--color-semantic-neutral-100, #f1f5f9);
91
+ border-color: var(--color-semantic-neutral-200, #e2e8f0);
92
+ cursor: not-allowed;
93
+ }
94
+
95
+ .ivds-checkbox__label {
96
+ color: var(--color-semantic-neutral-500, #64748b);
97
+ cursor: not-allowed;
98
+ }
99
+ }
100
+
101
+ // Checkbox indeterminate state mixin
102
+ @mixin checkbox-indeterminate($bg-color: var(--color-brand-primary-500, #f97316)) {
103
+ background-color: $bg-color;
104
+ border-color: $bg-color;
105
+
106
+ &::after {
107
+ content: '';
108
+ width: 8px;
109
+ height: 2px;
110
+ border: none;
111
+ background-color: var(--color-semantic-neutral-50, #f8fafc);
112
+ transform: none;
113
+ border-radius: 1px;
114
+ }
115
+ }
116
+
117
+ // Checkbox error state mixin
118
+ @mixin checkbox-error {
119
+ .ivds-checkbox__box {
120
+ border-color: var(--color-semantic-error-500, #ef4444);
121
+ }
122
+
123
+ &:hover .ivds-checkbox__box {
124
+ border-color: var(--color-semantic-error-600, #dc2626);
125
+ }
126
+
127
+ .ivds-checkbox__input:checked + .ivds-checkbox__box {
128
+ background-color: var(--color-semantic-error-500, #ef4444);
129
+ border-color: var(--color-semantic-error-500, #ef4444);
130
+ }
131
+
132
+ .ivds-checkbox__input:focus + .ivds-checkbox__box {
133
+ outline-color: var(--color-semantic-error-500, #ef4444);
134
+ }
135
+ }
136
+
137
+ // Checkbox success state mixin
138
+ @mixin checkbox-success {
139
+ .ivds-checkbox__box {
140
+ border-color: var(--color-semantic-success-500, #10b981);
141
+ }
142
+
143
+ &:hover .ivds-checkbox__box {
144
+ border-color: var(--color-semantic-success-600, #059669);
145
+ }
146
+
147
+ .ivds-checkbox__input:checked + .ivds-checkbox__box {
148
+ background-color: var(--color-semantic-success-500, #10b981);
149
+ border-color: var(--color-semantic-success-500, #10b981);
150
+ }
151
+
152
+ .ivds-checkbox__input:focus + .ivds-checkbox__box {
153
+ outline-color: var(--color-semantic-success-500, #10b981);
154
+ }
155
+ }
156
+
157
+ // Checkbox size variants
158
+ @mixin checkbox-small {
159
+ .ivds-checkbox__box {
160
+ @include checkbox-box(14px);
161
+
162
+ &::after {
163
+ width: 7px;
164
+ height: 4px;
165
+ }
166
+ }
167
+
168
+ .ivds-checkbox__label {
169
+ @include checkbox-label(var(--fontSize-sm, 0.875rem), var(--spacing-2, 0.5rem));
170
+ }
171
+ }
172
+
173
+ @mixin checkbox-large {
174
+ .ivds-checkbox__box {
175
+ @include checkbox-box(22px);
176
+
177
+ &::after {
178
+ width: 12px;
179
+ height: 8px;
180
+ }
181
+ }
182
+
183
+ .ivds-checkbox__label {
184
+ @include checkbox-label(var(--fontSize-lg, 1.125rem), var(--spacing-4, 1rem));
185
+ }
186
+ }
187
+
188
+ // Checkbox group mixin
189
+ @mixin checkbox-group($gap: var(--spacing-3, 0.75rem)) {
190
+ display: flex;
191
+ flex-direction: column;
192
+ gap: $gap;
193
+
194
+ &--horizontal {
195
+ flex-direction: row;
196
+ flex-wrap: wrap;
197
+ gap: var(--spacing-6, 1.5rem);
198
+ }
199
+ }
200
+
201
+ // Checkbox description mixin
202
+ @mixin checkbox-description {
203
+ margin-top: var(--spacing-1, 0.25rem);
204
+ margin-left: calc(18px + var(--spacing-3, 0.75rem));
205
+ font-size: var(--fontSize-sm, 0.875rem);
206
+ color: var(--color-semantic-neutral-600, #4b5563);
207
+ line-height: var(--lineHeight-relaxed, 1.625);
208
+ }
@@ -0,0 +1,141 @@
1
+ // Checkbox component styles
2
+ // Provides styling for the IVDS checkbox component with all variants, sizes, and states
3
+
4
+ @use '_checkbox-mixin' as checkbox;
5
+
6
+
7
+
8
+ // Checkbox Base
9
+ .ivds-checkbox {
10
+ @include checkbox.checkbox-base;
11
+
12
+ // Checkbox box
13
+ &__box {
14
+ @include checkbox.checkbox-box;
15
+ }
16
+
17
+ // Hidden input
18
+ &__input {
19
+ @include checkbox.checkbox-input;
20
+
21
+ // Checked state
22
+ &:checked + .ivds-checkbox__box {
23
+ @include checkbox.checkbox-checked;
24
+ }
25
+
26
+ // Focus state
27
+ &:focus + .ivds-checkbox__box {
28
+ @include checkbox.checkbox-focus;
29
+ }
30
+
31
+ // Indeterminate state
32
+ &:indeterminate + .ivds-checkbox__box {
33
+ @include checkbox.checkbox-indeterminate;
34
+ }
35
+ }
36
+
37
+ // Checkbox label
38
+ &__label {
39
+ @include checkbox.checkbox-label;
40
+ }
41
+
42
+ // Checkbox description
43
+ &__description {
44
+ @include checkbox.checkbox-description;
45
+ }
46
+
47
+ // Disabled state
48
+ &--disabled {
49
+ @include checkbox.checkbox-disabled;
50
+ }
51
+
52
+ // Error state
53
+ &--error {
54
+ @include checkbox.checkbox-error;
55
+ }
56
+
57
+ // Success state
58
+ &--success {
59
+ @include checkbox.checkbox-success;
60
+ }
61
+ }
62
+
63
+ // Checkbox Sizes
64
+ .ivds-checkbox--small {
65
+ @include checkbox.checkbox-small;
66
+ }
67
+
68
+ .ivds-checkbox--large {
69
+ @include checkbox.checkbox-large;
70
+ }
71
+
72
+ // Checkbox Group
73
+ .ivds-checkbox-group {
74
+ @include checkbox.checkbox-group;
75
+
76
+ &--horizontal {
77
+ @include checkbox.checkbox-group;
78
+
79
+ flex-direction: row;
80
+ flex-wrap: wrap;
81
+ gap: var(--spacing-6, 1.5rem);
82
+ }
83
+
84
+ // Group label
85
+ &__label {
86
+ display: block;
87
+ font-size: var(--fontSize-base, 1rem);
88
+ font-weight: var(--fontWeight-medium, 500);
89
+ color: var(--color-semantic-neutral-900, #0f172a);
90
+ margin-bottom: var(--spacing-3, 0.75rem);
91
+
92
+ &--required::after {
93
+ content: ' *';
94
+ color: var(--color-semantic-error-500, #ef4444);
95
+ }
96
+ }
97
+
98
+ // Group description
99
+ &__description {
100
+ font-size: var(--fontSize-sm, 0.875rem);
101
+ color: var(--color-semantic-neutral-600, #4b5563);
102
+ margin-bottom: var(--spacing-3, 0.75rem);
103
+ }
104
+
105
+ // Group error message
106
+ &__error {
107
+ margin-top: var(--spacing-2, 0.5rem);
108
+ font-size: var(--fontSize-sm, 0.875rem);
109
+ color: var(--color-semantic-error-600, #dc2626);
110
+
111
+ &::before {
112
+ content: '⚠ ';
113
+ margin-right: var(--spacing-1, 0.25rem);
114
+ }
115
+ }
116
+ }
117
+
118
+ // Checkbox Card variant (for more prominent selections)
119
+ .ivds-checkbox--card {
120
+ padding: var(--spacing-4, 1rem);
121
+ border: var(--borderWidth-1, 1px) solid var(--color-semantic-neutral-200, #e2e8f0);
122
+ border-radius: var(--borderRadius-md, 0.375rem);
123
+ background-color: var(--color-semantic-neutral-50, #f8fafc);
124
+ transition: all 0.15s ease-in-out;
125
+
126
+ &:hover {
127
+ border-color: var(--color-brand-primary-300, #fdba74);
128
+ background-color: var(--color-brand-primary-50, #fff7ed);
129
+ }
130
+
131
+ .ivds-checkbox__input:checked ~ & {
132
+ border-color: var(--color-brand-primary-500, #f97316);
133
+ background-color: var(--color-brand-primary-50, #fff7ed);
134
+ }
135
+
136
+ .ivds-checkbox__input:focus ~ & {
137
+ outline: 2px solid var(--color-brand-primary-500, #f97316);
138
+ outline-offset: 2px;
139
+ }
140
+ }
141
+
@@ -0,0 +1,303 @@
1
+ // Checkbox component stories for Storybook
2
+ // Showcases all checkbox variants, sizes, states, and features
3
+
4
+ export default {
5
+ title: 'Core/Checkbox',
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: 'CSS-only checkbox component using IVDS design tokens. Provides multiple variants, sizes, states, and features for form selections.'
10
+ }
11
+ },
12
+ a11y: {
13
+ config: {
14
+ rules: [
15
+ {
16
+ id: 'color-contrast',
17
+ enabled: true
18
+ },
19
+ {
20
+ id: 'label-title-only',
21
+ enabled: true
22
+ }
23
+ ]
24
+ }
25
+ }
26
+ }
27
+ };
28
+
29
+ // Basic checkbox
30
+ export const Default = () => `
31
+ <label class="ivds-checkbox">
32
+ <input type="checkbox" class="ivds-checkbox__input" />
33
+ <div class="ivds-checkbox__box"></div>
34
+ <span class="ivds-checkbox__label">Default Checkbox</span>
35
+ </label>
36
+ `;
37
+
38
+ // Checkbox with description
39
+ export const WithDescription = () => `
40
+ <label class="ivds-checkbox">
41
+ <input type="checkbox" class="ivds-checkbox__input" />
42
+ <div class="ivds-checkbox__box"></div>
43
+ <div>
44
+ <span class="ivds-checkbox__label">Email Notifications</span>
45
+ <div class="ivds-checkbox__description">
46
+ Receive email updates about your account activity and important announcements.
47
+ </div>
48
+ </div>
49
+ </label>
50
+ `;
51
+
52
+ // Checkbox sizes
53
+ export const Sizes = () => `
54
+ <div style="display: flex; flex-direction: column; gap: 1.5rem;">
55
+ <label class="ivds-checkbox ivds-checkbox--small">
56
+ <input type="checkbox" class="ivds-checkbox__input" />
57
+ <div class="ivds-checkbox__box"></div>
58
+ <span class="ivds-checkbox__label">Small Checkbox</span>
59
+ </label>
60
+
61
+ <label class="ivds-checkbox">
62
+ <input type="checkbox" class="ivds-checkbox__input" />
63
+ <div class="ivds-checkbox__box"></div>
64
+ <span class="ivds-checkbox__label">Default Checkbox</span>
65
+ </label>
66
+
67
+ <label class="ivds-checkbox ivds-checkbox--large">
68
+ <input type="checkbox" class="ivds-checkbox__input" />
69
+ <div class="ivds-checkbox__box"></div>
70
+ <span class="ivds-checkbox__label">Large Checkbox</span>
71
+ </label>
72
+ </div>
73
+ `;
74
+
75
+ // Checkbox states
76
+ export const States = () => `
77
+ <div style="display: flex; flex-direction: column; gap: 1.5rem;">
78
+ <label class="ivds-checkbox">
79
+ <input type="checkbox" class="ivds-checkbox__input" />
80
+ <div class="ivds-checkbox__box"></div>
81
+ <span class="ivds-checkbox__label">Unchecked</span>
82
+ </label>
83
+
84
+ <label class="ivds-checkbox">
85
+ <input type="checkbox" class="ivds-checkbox__input" checked />
86
+ <div class="ivds-checkbox__box"></div>
87
+ <span class="ivds-checkbox__label">Checked</span>
88
+ </label>
89
+
90
+ <label class="ivds-checkbox">
91
+ <input type="checkbox" class="ivds-checkbox__input" />
92
+ <div class="ivds-checkbox__box"></div>
93
+ <span class="ivds-checkbox__label">Indeterminate</span>
94
+ </label>
95
+
96
+ <script>
97
+ // Set indeterminate state for demo
98
+ document.addEventListener('DOMContentLoaded', function() {
99
+ const indeterminateCheckbox = document.querySelectorAll('.ivds-checkbox__input')[2];
100
+ if (indeterminateCheckbox) {
101
+ indeterminateCheckbox.indeterminate = true;
102
+ }
103
+ });
104
+ </script>
105
+ </div>
106
+ `;
107
+
108
+ // Disabled states
109
+ export const DisabledStates = () => `
110
+ <div style="display: flex; flex-direction: column; gap: 1.5rem;">
111
+ <label class="ivds-checkbox ivds-checkbox--disabled">
112
+ <input type="checkbox" class="ivds-checkbox__input" disabled />
113
+ <div class="ivds-checkbox__box"></div>
114
+ <span class="ivds-checkbox__label">Disabled Unchecked</span>
115
+ </label>
116
+
117
+ <label class="ivds-checkbox ivds-checkbox--disabled">
118
+ <input type="checkbox" class="ivds-checkbox__input" checked disabled />
119
+ <div class="ivds-checkbox__box"></div>
120
+ <span class="ivds-checkbox__label">Disabled Checked</span>
121
+ </label>
122
+ </div>
123
+ `;
124
+
125
+ // Validation states
126
+ export const ValidationStates = () => `
127
+ <div style="display: flex; flex-direction: column; gap: 1.5rem;">
128
+ <label class="ivds-checkbox ivds-checkbox--error">
129
+ <input type="checkbox" class="ivds-checkbox__input" />
130
+ <div class="ivds-checkbox__box"></div>
131
+ <span class="ivds-checkbox__label">Error State</span>
132
+ </label>
133
+
134
+ <label class="ivds-checkbox ivds-checkbox--success">
135
+ <input type="checkbox" class="ivds-checkbox__input" checked />
136
+ <div class="ivds-checkbox__box"></div>
137
+ <span class="ivds-checkbox__label">Success State</span>
138
+ </label>
139
+ </div>
140
+ `;
141
+
142
+ // Checkbox groups
143
+ export const CheckboxGroups = () => `
144
+ <div style="display: flex; flex-direction: column; gap: 2rem;">
145
+ <div class="ivds-checkbox-group">
146
+ <div class="ivds-checkbox-group__label">
147
+ Preferred Contact Methods
148
+ </div>
149
+ <div class="ivds-checkbox-group__description">
150
+ Select all the ways you'd like us to contact you.
151
+ </div>
152
+
153
+ <label class="ivds-checkbox">
154
+ <input type="checkbox" class="ivds-checkbox__input" name="contact" value="email" />
155
+ <div class="ivds-checkbox__box"></div>
156
+ <span class="ivds-checkbox__label">Email</span>
157
+ </label>
158
+
159
+ <label class="ivds-checkbox">
160
+ <input type="checkbox" class="ivds-checkbox__input" name="contact" value="phone" />
161
+ <div class="ivds-checkbox__box"></div>
162
+ <span class="ivds-checkbox__label">Phone</span>
163
+ </label>
164
+
165
+ <label class="ivds-checkbox">
166
+ <input type="checkbox" class="ivds-checkbox__input" name="contact" value="sms" />
167
+ <div class="ivds-checkbox__box"></div>
168
+ <span class="ivds-checkbox__label">SMS</span>
169
+ </label>
170
+ </div>
171
+
172
+ <div class="ivds-checkbox-group ivds-checkbox-group--horizontal">
173
+ <div class="ivds-checkbox-group__label ivds-checkbox-group__label--required">
174
+ Terms and Conditions
175
+ </div>
176
+
177
+ <label class="ivds-checkbox">
178
+ <input type="checkbox" class="ivds-checkbox__input" required />
179
+ <div class="ivds-checkbox__box"></div>
180
+ <span class="ivds-checkbox__label">I agree to the Terms of Service</span>
181
+ </label>
182
+
183
+ <label class="ivds-checkbox">
184
+ <input type="checkbox" class="ivds-checkbox__input" />
185
+ <div class="ivds-checkbox__box"></div>
186
+ <span class="ivds-checkbox__label">I agree to receive marketing emails</span>
187
+ </label>
188
+ </div>
189
+ </div>
190
+ `;
191
+
192
+ // Card variant
193
+ export const CardVariant = () => `
194
+ <div style="display: flex; flex-direction: column; gap: 1rem; max-width: 400px;">
195
+ <label class="ivds-checkbox">
196
+ <input type="checkbox" class="ivds-checkbox__input" />
197
+ <div class="ivds-checkbox__box"></div>
198
+ <div class="ivds-checkbox--card">
199
+ <div class="ivds-checkbox__label" style="font-weight: 500; margin-bottom: 0.25rem;">
200
+ Premium Plan
201
+ </div>
202
+ <div class="ivds-checkbox__description" style="margin-left: 0;">
203
+ Access to all features, priority support, and advanced analytics.
204
+ </div>
205
+ </div>
206
+ </label>
207
+
208
+ <label class="ivds-checkbox">
209
+ <input type="checkbox" class="ivds-checkbox__input" />
210
+ <div class="ivds-checkbox__box"></div>
211
+ <div class="ivds-checkbox--card">
212
+ <div class="ivds-checkbox__label" style="font-weight: 500; margin-bottom: 0.25rem;">
213
+ Basic Plan
214
+ </div>
215
+ <div class="ivds-checkbox__description" style="margin-left: 0;">
216
+ Essential features for getting started.
217
+ </div>
218
+ </div>
219
+ </label>
220
+ </div>
221
+ `;
222
+
223
+
224
+
225
+ // Checkbox group with error
226
+ export const GroupWithError = () => `
227
+ <div class="ivds-checkbox-group">
228
+ <div class="ivds-checkbox-group__label ivds-checkbox-group__label--required">
229
+ Required Selection
230
+ </div>
231
+ <div class="ivds-checkbox-group__description">
232
+ Please select at least one option to continue.
233
+ </div>
234
+
235
+ <label class="ivds-checkbox ivds-checkbox--error">
236
+ <input type="checkbox" class="ivds-checkbox__input" name="required-group" />
237
+ <div class="ivds-checkbox__box"></div>
238
+ <span class="ivds-checkbox__label">Option 1</span>
239
+ </label>
240
+
241
+ <label class="ivds-checkbox ivds-checkbox--error">
242
+ <input type="checkbox" class="ivds-checkbox__input" name="required-group" />
243
+ <div class="ivds-checkbox__box"></div>
244
+ <span class="ivds-checkbox__label">Option 2</span>
245
+ </label>
246
+
247
+ <label class="ivds-checkbox ivds-checkbox--error">
248
+ <input type="checkbox" class="ivds-checkbox__input" name="required-group" />
249
+ <div class="ivds-checkbox__box"></div>
250
+ <span class="ivds-checkbox__label">Option 3</span>
251
+ </label>
252
+
253
+ <div class="ivds-checkbox-group__error">
254
+ Please select at least one option.
255
+ </div>
256
+ </div>
257
+ `;
258
+
259
+ // Accessibility example
260
+ export const AccessibilityFeatures = () => `
261
+ <div style="display: flex; flex-direction: column; gap: 1.5rem; max-width: 500px;">
262
+ <div class="ivds-checkbox-group" role="group" aria-labelledby="preferences-label">
263
+ <div id="preferences-label" class="ivds-checkbox-group__label">
264
+ Privacy Preferences
265
+ </div>
266
+ <div class="ivds-checkbox-group__description">
267
+ Choose your privacy settings. You can change these at any time.
268
+ </div>
269
+
270
+ <label class="ivds-checkbox">
271
+ <input
272
+ type="checkbox"
273
+ class="ivds-checkbox__input"
274
+ id="analytics-checkbox"
275
+ aria-describedby="analytics-description"
276
+ />
277
+ <div class="ivds-checkbox__box"></div>
278
+ <div>
279
+ <span class="ivds-checkbox__label">Allow Analytics</span>
280
+ <div id="analytics-description" class="ivds-checkbox__description">
281
+ Help us improve our service by sharing anonymous usage data.
282
+ </div>
283
+ </div>
284
+ </label>
285
+
286
+ <label class="ivds-checkbox">
287
+ <input
288
+ type="checkbox"
289
+ class="ivds-checkbox__input"
290
+ id="marketing-checkbox"
291
+ aria-describedby="marketing-description"
292
+ />
293
+ <div class="ivds-checkbox__box"></div>
294
+ <div>
295
+ <span class="ivds-checkbox__label">Marketing Communications</span>
296
+ <div id="marketing-description" class="ivds-checkbox__description">
297
+ Receive updates about new features and special offers.
298
+ </div>
299
+ </div>
300
+ </label>
301
+ </div>
302
+ </div>
303
+ `;