@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,207 @@
1
+ // Radio button component mixins and private styles
2
+ // This file contains mixins for radio button variants, sizes, states, and internal utilities
3
+
4
+ @use '../../variables/variables' as vars;
5
+
6
+ // Base radio button mixin with common styles
7
+ @mixin radio-button-base {
8
+ position: relative;
9
+ display: inline-flex;
10
+ align-items: flex-start;
11
+ cursor: pointer;
12
+ user-select: none;
13
+
14
+ &:hover .ivds-radio-button__circle {
15
+ border-color: var(--color-brand-primary-400, #38bdf8);
16
+ }
17
+ }
18
+
19
+ // Hidden input mixin
20
+ @mixin radio-button-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
+ // Radio button circle mixin
33
+ @mixin radio-button-circle($size: 18px) {
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: 50%;
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: calc($size * 0.5);
50
+ height: calc($size * 0.5);
51
+ border-radius: 50%;
52
+ background-color: transparent;
53
+ transform: scale(0);
54
+ transition: transform 0.15s ease-in-out, background-color 0.15s ease-in-out;
55
+ }
56
+ }
57
+
58
+ // Radio button label mixin
59
+ @mixin radio-button-label($font-size: var(--fontSize-base, 1rem), $gap: var(--spacing-3, 0.75rem)) {
60
+ margin-left: $gap;
61
+ font-size: $font-size;
62
+ color: var(--color-semantic-neutral-900, #0f172a);
63
+ line-height: var(--lineHeight-normal, 1.5);
64
+ }
65
+
66
+ // Radio button checked state mixin
67
+ @mixin radio-button-checked($bg-color: var(--color-brand-primary-500, #0ea5e9), $border-color: var(--color-brand-primary-500, #0ea5e9)) {
68
+ background-color: $bg-color;
69
+ border-color: $border-color;
70
+
71
+ &::after {
72
+ background-color: var(--color-semantic-neutral-50, #f8fafc);
73
+ transform: scale(1);
74
+ }
75
+ }
76
+
77
+ // Radio button focus state mixin
78
+ @mixin radio-button-focus {
79
+ outline: 2px solid var(--color-brand-primary-500, #0ea5e9);
80
+ outline-offset: 2px;
81
+ }
82
+
83
+ // Radio button disabled state mixin
84
+ @mixin radio-button-disabled {
85
+ cursor: not-allowed;
86
+ opacity: 0.6;
87
+
88
+ .ivds-radio-button__circle {
89
+ background-color: var(--color-semantic-neutral-100, #f1f5f9);
90
+ border-color: var(--color-semantic-neutral-200, #e2e8f0);
91
+ cursor: not-allowed;
92
+ }
93
+
94
+ .ivds-radio-button__label {
95
+ color: var(--color-semantic-neutral-500, #64748b);
96
+ cursor: not-allowed;
97
+ }
98
+ }
99
+
100
+ // Radio button error state mixin
101
+ @mixin radio-button-error {
102
+ .ivds-radio-button__circle {
103
+ border-color: var(--color-semantic-error-500, #ef4444);
104
+ }
105
+
106
+ &:hover .ivds-radio-button__circle {
107
+ border-color: var(--color-semantic-error-600, #dc2626);
108
+ }
109
+
110
+ .ivds-radio-button__input:checked + .ivds-radio-button__circle {
111
+ background-color: var(--color-semantic-error-500, #ef4444);
112
+ border-color: var(--color-semantic-error-500, #ef4444);
113
+ }
114
+
115
+ .ivds-radio-button__input:focus + .ivds-radio-button__circle {
116
+ outline-color: var(--color-semantic-error-500, #ef4444);
117
+ }
118
+ }
119
+
120
+ // Radio button success state mixin
121
+ @mixin radio-button-success {
122
+ .ivds-radio-button__circle {
123
+ border-color: var(--color-semantic-success-500, #10b981);
124
+ }
125
+
126
+ &:hover .ivds-radio-button__circle {
127
+ border-color: var(--color-semantic-success-600, #059669);
128
+ }
129
+
130
+ .ivds-radio-button__input:checked + .ivds-radio-button__circle {
131
+ background-color: var(--color-semantic-success-500, #10b981);
132
+ border-color: var(--color-semantic-success-500, #10b981);
133
+ }
134
+
135
+ .ivds-radio-button__input:focus + .ivds-radio-button__circle {
136
+ outline-color: var(--color-semantic-success-500, #10b981);
137
+ }
138
+ }
139
+
140
+ // Radio button size variants
141
+ @mixin radio-button-small {
142
+ .ivds-radio-button__circle {
143
+ @include radio-button-circle(14px);
144
+ }
145
+
146
+ .ivds-radio-button__label {
147
+ @include radio-button-label(var(--fontSize-sm, 0.875rem), var(--spacing-2, 0.5rem));
148
+ }
149
+ }
150
+
151
+ @mixin radio-button-large {
152
+ .ivds-radio-button__circle {
153
+ @include radio-button-circle(22px);
154
+ }
155
+
156
+ .ivds-radio-button__label {
157
+ @include radio-button-label(var(--fontSize-lg, 1.125rem), var(--spacing-4, 1rem));
158
+ }
159
+ }
160
+
161
+ // Radio button group mixin
162
+ @mixin radio-button-group($gap: var(--spacing-3, 0.75rem)) {
163
+ display: flex;
164
+ flex-direction: column;
165
+ gap: $gap;
166
+
167
+ &--horizontal {
168
+ flex-direction: row;
169
+ flex-wrap: wrap;
170
+ gap: var(--spacing-6, 1.5rem);
171
+ }
172
+ }
173
+
174
+ // Radio button description mixin
175
+ @mixin radio-button-description {
176
+ margin-top: var(--spacing-1, 0.25rem);
177
+ margin-left: calc(18px + var(--spacing-3, 0.75rem));
178
+ font-size: var(--fontSize-sm, 0.875rem);
179
+ color: var(--color-semantic-neutral-600, #4b5563);
180
+ line-height: var(--lineHeight-relaxed, 1.625);
181
+ }
182
+
183
+ // Radio button card variant mixin
184
+ @mixin radio-button-card {
185
+ padding: var(--spacing-4, 1rem);
186
+ border: var(--borderWidth-1, 1px) solid var(--color-semantic-neutral-200, #e2e8f0);
187
+ border-radius: var(--borderRadius-md, 0.375rem);
188
+ background-color: var(--color-semantic-neutral-50, #f8fafc);
189
+ transition: all 0.15s ease-in-out;
190
+
191
+ &:hover {
192
+ border-color: var(--color-brand-primary-300, #7dd3fc);
193
+ background-color: var(--color-brand-primary-50, #eff6ff);
194
+ }
195
+ }
196
+
197
+ // Radio button card checked state mixin
198
+ @mixin radio-button-card-checked {
199
+ border-color: var(--color-brand-primary-500, #0ea5e9);
200
+ background-color: var(--color-brand-primary-50, #eff6ff);
201
+ }
202
+
203
+ // Radio button card focus state mixin
204
+ @mixin radio-button-card-focus {
205
+ outline: 2px solid var(--color-brand-primary-500, #0ea5e9);
206
+ outline-offset: 2px;
207
+ }
@@ -0,0 +1,178 @@
1
+ // Radio button component styles
2
+ // Provides styling for the IVDS radio button component with all variants, sizes, and states
3
+
4
+ @use '_radio-button-mixin' as radio;
5
+
6
+ // Radio Button Base
7
+ .ivds-radio-button {
8
+ @include radio.radio-button-base;
9
+
10
+ // Radio button circle
11
+ &__circle {
12
+ @include radio.radio-button-circle;
13
+ }
14
+
15
+ // Hidden input
16
+ &__input {
17
+ @include radio.radio-button-input;
18
+
19
+ // Checked state
20
+ &:checked + .ivds-radio-button__circle {
21
+ @include radio.radio-button-checked;
22
+ }
23
+
24
+ // Focus state
25
+ &:focus + .ivds-radio-button__circle {
26
+ @include radio.radio-button-focus;
27
+ }
28
+ }
29
+
30
+ // Radio button label
31
+ &__label {
32
+ @include radio.radio-button-label;
33
+ }
34
+
35
+ // Radio button description
36
+ &__description {
37
+ @include radio.radio-button-description;
38
+ }
39
+
40
+ // Disabled state
41
+ &--disabled {
42
+ @include radio.radio-button-disabled;
43
+ }
44
+
45
+ // Error state
46
+ &--error {
47
+ @include radio.radio-button-error;
48
+ }
49
+
50
+ // Success state
51
+ &--success {
52
+ @include radio.radio-button-success;
53
+ }
54
+ }
55
+
56
+ // Radio Button Sizes
57
+ .ivds-radio-button--small {
58
+ @include radio.radio-button-small;
59
+ }
60
+
61
+ .ivds-radio-button--large {
62
+ @include radio.radio-button-large;
63
+ }
64
+
65
+ // Radio Button Group
66
+ .ivds-radio-button-group {
67
+ @include radio.radio-button-group;
68
+
69
+ &--horizontal {
70
+ @include radio.radio-button-group;
71
+
72
+ flex-direction: row;
73
+ flex-wrap: wrap;
74
+ gap: var(--spacing-6, 1.5rem);
75
+ }
76
+
77
+ // Group label
78
+ &__label {
79
+ display: block;
80
+ font-size: var(--fontSize-base, 1rem);
81
+ font-weight: var(--fontWeight-medium, 500);
82
+ color: var(--color-semantic-neutral-900, #0f172a);
83
+ margin-bottom: var(--spacing-3, 0.75rem);
84
+
85
+ &--required::after {
86
+ content: ' *';
87
+ color: var(--color-semantic-error-500, #ef4444);
88
+ }
89
+ }
90
+
91
+ // Group description
92
+ &__description {
93
+ font-size: var(--fontSize-sm, 0.875rem);
94
+ color: var(--color-semantic-neutral-600, #4b5563);
95
+ margin-bottom: var(--spacing-3, 0.75rem);
96
+ }
97
+
98
+ // Group error message
99
+ &__error {
100
+ margin-top: var(--spacing-2, 0.5rem);
101
+ font-size: var(--fontSize-sm, 0.875rem);
102
+ color: var(--color-semantic-error-600, #dc2626);
103
+
104
+ &::before {
105
+ content: '⚠ ';
106
+ margin-right: var(--spacing-1, 0.25rem);
107
+ }
108
+ }
109
+ }
110
+
111
+ // Radio Button Card variant (for more prominent selections)
112
+ .ivds-radio-button--card {
113
+ @include radio.radio-button-card;
114
+
115
+ .ivds-radio-button__input:checked ~ & {
116
+ @include radio.radio-button-card-checked;
117
+ }
118
+
119
+ .ivds-radio-button__input:focus ~ & {
120
+ @include radio.radio-button-card-focus;
121
+ }
122
+ }
123
+
124
+ // Legacy support for existing .ivds-radio class
125
+ .ivds-radio {
126
+ position: relative;
127
+ display: inline-flex;
128
+ align-items: center;
129
+ cursor: pointer;
130
+
131
+ &__input {
132
+ position: absolute;
133
+ opacity: 0;
134
+ width: 1px;
135
+ height: 1px;
136
+ }
137
+
138
+ &__button {
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ width: 1rem;
143
+ height: 1rem;
144
+ border: var(--borderWidth-1, 1px) solid var(--color-semantic-neutral-300, #cbd5e1);
145
+ border-radius: 50%;
146
+ background-color: var(--color-semantic-neutral-25, #fcfcfd);
147
+ transition: all 0.2s ease-in-out;
148
+ }
149
+
150
+ &__label {
151
+ margin-left: var(--spacing-2, 0.5rem);
152
+ font-size: var(--fontSize-base, 1rem);
153
+ color: var(--color-semantic-neutral-900, #0f172a);
154
+ }
155
+
156
+ &__input:checked + &__button {
157
+ border-color: var(--color-brand-primary-500, #0ea5e9);
158
+
159
+ &::after {
160
+ content: '';
161
+ width: 0.5rem;
162
+ height: 0.5rem;
163
+ border-radius: 50%;
164
+ background-color: var(--color-brand-primary-500, #0ea5e9);
165
+ }
166
+ }
167
+
168
+ &__input:focus + &__button {
169
+ outline: 2px solid var(--color-brand-primary-500, #0ea5e9);
170
+ outline-offset: 2px;
171
+ }
172
+
173
+ &__input:disabled + &__button {
174
+ background-color: var(--color-semantic-neutral-100, #f1f5f9);
175
+ border-color: var(--color-semantic-neutral-200, #e2e8f0);
176
+ cursor: not-allowed;
177
+ }
178
+ }