@abstraks-dev/ui-library 1.0.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.
- package/LICENSE +21 -0
- package/README.md +708 -0
- package/dist/__tests__/Anchor.test.js +145 -0
- package/dist/__tests__/ArrowRight.test.js +91 -0
- package/dist/__tests__/Avatar.test.js +123 -0
- package/dist/__tests__/Button.test.js +82 -0
- package/dist/__tests__/Card.test.js +198 -0
- package/dist/__tests__/CheckCircle.test.js +98 -0
- package/dist/__tests__/Checkbox.test.js +161 -0
- package/dist/__tests__/ChevronDown.test.js +73 -0
- package/dist/__tests__/Close.test.js +98 -0
- package/dist/__tests__/EditSquare.test.js +99 -0
- package/dist/__tests__/Error.test.js +74 -0
- package/dist/__tests__/Footer.test.js +66 -0
- package/dist/__tests__/Heading.test.js +227 -0
- package/dist/__tests__/Hero.test.js +74 -0
- package/dist/__tests__/Label.test.js +123 -0
- package/dist/__tests__/Loader.test.js +115 -0
- package/dist/__tests__/MenuHover.test.js +137 -0
- package/dist/__tests__/Paragraph.test.js +93 -0
- package/dist/__tests__/PlusCircle.test.js +99 -0
- package/dist/__tests__/Radio.test.js +153 -0
- package/dist/__tests__/Select.test.js +187 -0
- package/dist/__tests__/Tabs.test.js +162 -0
- package/dist/__tests__/TextArea.test.js +127 -0
- package/dist/__tests__/TextInput.test.js +181 -0
- package/dist/__tests__/Toggle.test.js +120 -0
- package/dist/__tests__/TrashX.test.js +99 -0
- package/dist/__tests__/useHeadingAccessibility.test.js +144 -0
- package/dist/components/Anchor.js +131 -0
- package/dist/components/Animation.js +129 -0
- package/dist/components/AnimationGroup.js +207 -0
- package/dist/components/AnimationToggle.js +216 -0
- package/dist/components/Avatar.js +153 -0
- package/dist/components/Button.js +218 -0
- package/dist/components/Card.js +222 -0
- package/dist/components/Checkbox.js +305 -0
- package/dist/components/Crud.js +564 -0
- package/dist/components/DragAndDrop.js +337 -0
- package/dist/components/Error.js +206 -0
- package/dist/components/Footer.js +99 -0
- package/dist/components/Form.js +412 -0
- package/dist/components/Header.js +372 -0
- package/dist/components/Heading.js +134 -0
- package/dist/components/Hero.js +181 -0
- package/dist/components/Label.js +256 -0
- package/dist/components/Loader.js +302 -0
- package/dist/components/MenuHover.js +114 -0
- package/dist/components/Paragraph.js +128 -0
- package/dist/components/Prompt.js +61 -0
- package/dist/components/Radio.js +254 -0
- package/dist/components/Select.js +422 -0
- package/dist/components/SideMenu.js +313 -0
- package/dist/components/Tabs.js +297 -0
- package/dist/components/TextArea.js +370 -0
- package/dist/components/TextInput.js +286 -0
- package/dist/components/Toggle.js +186 -0
- package/dist/components/crudFiles/CrudEditBase.js +150 -0
- package/dist/components/crudFiles/CrudViewBase.js +39 -0
- package/dist/components/crudFiles/crudDevelopment.js +118 -0
- package/dist/components/crudFiles/crudEditHandlers.js +50 -0
- package/dist/constants/animation.js +30 -0
- package/dist/icons/ArrowIcon.js +32 -0
- package/dist/icons/ArrowRight.js +33 -0
- package/dist/icons/CheckCircle.js +33 -0
- package/dist/icons/ChevronDown.js +28 -0
- package/dist/icons/Close.js +33 -0
- package/dist/icons/EditSquare.js +33 -0
- package/dist/icons/Ellipses.js +34 -0
- package/dist/icons/Hamburger.js +39 -0
- package/dist/icons/LoadingSpinner.js +42 -0
- package/dist/icons/PlusCircle.js +33 -0
- package/dist/icons/SaveIcon.js +32 -0
- package/dist/icons/TrashX.js +33 -0
- package/dist/icons/__tests__/CheckCircle.test.js +9 -0
- package/dist/icons/__tests__/ChevronDown.test.js +9 -0
- package/dist/icons/__tests__/Close.test.js +9 -0
- package/dist/icons/__tests__/EditSquare.test.js +9 -0
- package/dist/icons/__tests__/PlusCircle.test.js +9 -0
- package/dist/icons/__tests__/TrashX.test.js +9 -0
- package/dist/icons/index.js +89 -0
- package/dist/index.js +332 -0
- package/dist/setupTests.js +3 -0
- package/dist/styles/_variables.scss +286 -0
- package/dist/styles/anchor.scss +40 -0
- package/dist/styles/animation-accessibility.scss +96 -0
- package/dist/styles/animation-toggle.scss +233 -0
- package/dist/styles/animation.scss +3781 -0
- package/dist/styles/avatar.scss +285 -0
- package/dist/styles/button.scss +430 -0
- package/dist/styles/card.scss +210 -0
- package/dist/styles/checkbox.scss +160 -0
- package/dist/styles/crud.scss +474 -0
- package/dist/styles/dragAndDrop.scss +312 -0
- package/dist/styles/error.scss +232 -0
- package/dist/styles/footer.scss +58 -0
- package/dist/styles/form.scss +420 -0
- package/dist/styles/grid.scss +29 -0
- package/dist/styles/header.scss +276 -0
- package/dist/styles/heading.scss +118 -0
- package/dist/styles/hero.scss +185 -0
- package/dist/styles/htmlElements.scss +20 -0
- package/dist/styles/image.scss +9 -0
- package/dist/styles/label.scss +340 -0
- package/dist/styles/list-item.scss +5 -0
- package/dist/styles/loader.scss +354 -0
- package/dist/styles/logo.scss +19 -0
- package/dist/styles/main.css +9056 -0
- package/dist/styles/main.css.map +1 -0
- package/dist/styles/main.scss +0 -0
- package/dist/styles/menu-hover.scss +30 -0
- package/dist/styles/paragraph.scss +88 -0
- package/dist/styles/prompt.scss +51 -0
- package/dist/styles/radio.scss +202 -0
- package/dist/styles/select.scss +363 -0
- package/dist/styles/side-menu.scss +334 -0
- package/dist/styles/tabs.scss +540 -0
- package/dist/styles/text-area.scss +388 -0
- package/dist/styles/text-input.scss +171 -0
- package/dist/styles/toggle.scss +0 -0
- package/dist/styles/unordered-list.scss +8 -0
- package/dist/utils/ScrollHandler.js +30 -0
- package/dist/utils/accessibility.js +128 -0
- package/dist/utils/heroUtils.js +316 -0
- package/dist/utils/index.js +104 -0
- package/dist/utils/inputValidation.js +29 -0
- package/dist/utils/keyboardNavigation.js +536 -0
- package/dist/utils/labelUtils.js +708 -0
- package/dist/utils/loaderUtils.js +387 -0
- package/dist/utils/menuUtils.js +575 -0
- package/dist/utils/useHeadingAccessibility.js +298 -0
- package/dist/utils/useRadioGroup.js +260 -0
- package/dist/utils/useSelectAccessibility.js +426 -0
- package/dist/utils/useTabsAccessibility.js +278 -0
- package/dist/utils/useTextAreaAccessibility.js +255 -0
- package/dist/utils/useTextInputAccessibility.js +295 -0
- package/dist/utils/useTypographyAccessibility.js +168 -0
- package/dist/utils/useWindowSize.js +32 -0
- package/dist/utils/utils/ScrollHandler.js +26 -0
- package/dist/utils/utils/accessibility.js +133 -0
- package/dist/utils/utils/heroUtils.js +348 -0
- package/dist/utils/utils/index.js +9 -0
- package/dist/utils/utils/inputValidation.js +22 -0
- package/dist/utils/utils/keyboardNavigation.js +664 -0
- package/dist/utils/utils/labelUtils.js +772 -0
- package/dist/utils/utils/loaderUtils.js +436 -0
- package/dist/utils/utils/menuUtils.js +651 -0
- package/dist/utils/utils/useHeadingAccessibility.js +334 -0
- package/dist/utils/utils/useRadioGroup.js +311 -0
- package/dist/utils/utils/useSelectAccessibility.js +498 -0
- package/dist/utils/utils/useTabsAccessibility.js +316 -0
- package/dist/utils/utils/useTextAreaAccessibility.js +303 -0
- package/dist/utils/utils/useTextInputAccessibility.js +338 -0
- package/dist/utils/utils/useTypographyAccessibility.js +180 -0
- package/dist/utils/utils/useWindowSize.js +26 -0
- package/dist/utils/utils/validation.js +131 -0
- package/dist/utils/validation.js +139 -0
- package/package.json +90 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* Animation Accessibility Utilities */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Utility class for testing reduced motion preferences
|
|
5
|
+
* Add this class to test how animations behave with motion reduction
|
|
6
|
+
*/
|
|
7
|
+
.motion-reduced {
|
|
8
|
+
animation: none !important;
|
|
9
|
+
transition: none !important;
|
|
10
|
+
transform: none !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* High contrast mode support for animations
|
|
15
|
+
* Ensures animations remain visible in high contrast themes
|
|
16
|
+
*/
|
|
17
|
+
@media (prefers-contrast: high) {
|
|
18
|
+
.animate__animated {
|
|
19
|
+
/* Enhance visibility in high contrast mode */
|
|
20
|
+
border: 1px solid;
|
|
21
|
+
|
|
22
|
+
/* Reduce complex animations that may be hard to see */
|
|
23
|
+
&.animate__flip,
|
|
24
|
+
&.animate__flipInX,
|
|
25
|
+
&.animate__flipInY,
|
|
26
|
+
&.animate__flipOutX,
|
|
27
|
+
&.animate__flipOutY {
|
|
28
|
+
animation-duration: 0.3s;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* Utility for focus-visible animations
|
|
35
|
+
* Use for keyboard navigation and screen reader users
|
|
36
|
+
*/
|
|
37
|
+
.animate__animated:focus-visible {
|
|
38
|
+
outline: 3px solid #0066cc;
|
|
39
|
+
outline-offset: 2px;
|
|
40
|
+
animation-play-state: paused;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* Safe animation defaults for accessibility
|
|
45
|
+
* These provide gentle alternatives to intense animations
|
|
46
|
+
*/
|
|
47
|
+
.animate__gentle-fade {
|
|
48
|
+
animation-name: gentleFadeIn;
|
|
49
|
+
animation-duration: 0.3s;
|
|
50
|
+
animation-timing-function: ease-out;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.animate__gentle-slide {
|
|
54
|
+
animation-name: gentleSlideIn;
|
|
55
|
+
animation-duration: 0.4s;
|
|
56
|
+
animation-timing-function: ease-out;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Gentle animation keyframes */
|
|
60
|
+
@keyframes gentleFadeIn {
|
|
61
|
+
from {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
}
|
|
64
|
+
to {
|
|
65
|
+
opacity: 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@keyframes gentleSlideIn {
|
|
70
|
+
from {
|
|
71
|
+
transform: translateY(10px);
|
|
72
|
+
opacity: 0;
|
|
73
|
+
}
|
|
74
|
+
to {
|
|
75
|
+
transform: translateY(0);
|
|
76
|
+
opacity: 1;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
* Animation guidelines for developers
|
|
82
|
+
* Use these comments as reference for accessible animations:
|
|
83
|
+
*
|
|
84
|
+
* ✅ DO:
|
|
85
|
+
* - Keep animations under 3 seconds
|
|
86
|
+
* - Provide pause/stop controls for infinite animations
|
|
87
|
+
* - Use subtle movements (under 100px displacement)
|
|
88
|
+
* - Test with prefers-reduced-motion enabled
|
|
89
|
+
* - Ensure keyboard focus is visible during animations
|
|
90
|
+
*
|
|
91
|
+
* ❌ DON'T:
|
|
92
|
+
* - Use rapid flashing (more than 3 flashes per second)
|
|
93
|
+
* - Create animations that move continuously without user control
|
|
94
|
+
* - Use animations that cover important content
|
|
95
|
+
* - Ignore focus management during animated state changes
|
|
96
|
+
*/
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/* Animation Toggle Component Styles */
|
|
2
|
+
/* Accessible and high contrast mode compatible */
|
|
3
|
+
|
|
4
|
+
.animation-toggle-wrapper {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
|
|
8
|
+
&.disabled {
|
|
9
|
+
opacity: 0.6;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* Trigger Button Styles */
|
|
15
|
+
.animation-toggle-trigger {
|
|
16
|
+
background: var(--button-bg, #007bff);
|
|
17
|
+
color: var(--button-text, #ffffff);
|
|
18
|
+
border: 2px solid var(--button-border, transparent);
|
|
19
|
+
border-radius: var(--button-radius, 4px);
|
|
20
|
+
padding: var(--button-padding, 8px 16px);
|
|
21
|
+
font-size: var(--button-font-size, 14px);
|
|
22
|
+
font-weight: var(--button-font-weight, 500);
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
transition: all 0.2s ease-in-out;
|
|
25
|
+
position: relative;
|
|
26
|
+
min-height: 44px; /* Touch target size */
|
|
27
|
+
min-width: 44px; /* Touch target size */
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.animation-toggle-trigger:hover {
|
|
34
|
+
background: var(--button-bg-hover, #0056b3);
|
|
35
|
+
transform: translateY(-1px);
|
|
36
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.animation-toggle-trigger:focus {
|
|
40
|
+
outline: 3px solid var(--focus-color, #4d90fe);
|
|
41
|
+
outline-offset: 2px;
|
|
42
|
+
background: var(--button-bg-focus, #0056b3);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.animation-toggle-trigger:active {
|
|
46
|
+
transform: translateY(0);
|
|
47
|
+
background: var(--button-bg-active, #004085);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.animation-toggle-trigger:disabled {
|
|
51
|
+
background: var(--button-bg-disabled, #6c757d);
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
transform: none;
|
|
54
|
+
box-shadow: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Content Container */
|
|
58
|
+
.animation-toggle-content {
|
|
59
|
+
background: var(--content-bg, #ffffff);
|
|
60
|
+
border: 2px solid var(--content-border, #dee2e6);
|
|
61
|
+
border-radius: var(--content-radius, 8px);
|
|
62
|
+
padding: var(--content-padding, 16px);
|
|
63
|
+
margin-top: var(--content-margin-top, 8px);
|
|
64
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
65
|
+
position: relative;
|
|
66
|
+
max-width: 400px;
|
|
67
|
+
min-width: 200px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.animation-toggle-content-body {
|
|
71
|
+
margin-bottom: 12px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Close Button */
|
|
75
|
+
.animation-toggle-close {
|
|
76
|
+
background: var(--close-bg, #dc3545);
|
|
77
|
+
color: var(--close-text, #ffffff);
|
|
78
|
+
border: 2px solid var(--close-border, transparent);
|
|
79
|
+
border-radius: var(--close-radius, 4px);
|
|
80
|
+
padding: var(--close-padding, 6px 12px);
|
|
81
|
+
font-size: var(--close-font-size, 12px);
|
|
82
|
+
font-weight: var(--close-font-weight, 500);
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
transition: all 0.2s ease-in-out;
|
|
85
|
+
min-height: 32px;
|
|
86
|
+
min-width: 60px;
|
|
87
|
+
display: inline-flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.animation-toggle-close:hover {
|
|
93
|
+
background: var(--close-bg-hover, #c82333);
|
|
94
|
+
transform: translateY(-1px);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.animation-toggle-close:focus {
|
|
98
|
+
outline: 3px solid var(--focus-color, #4d90fe);
|
|
99
|
+
outline-offset: 2px;
|
|
100
|
+
background: var(--close-bg-focus, #c82333);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.animation-toggle-close:active {
|
|
104
|
+
transform: translateY(0);
|
|
105
|
+
background: var(--close-bg-active, #bd2130);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Animation Classes */
|
|
109
|
+
.animation-toggle-enter {
|
|
110
|
+
opacity: 0;
|
|
111
|
+
transform: scale(0.95) translateY(-10px);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.animation-toggle-enter-active {
|
|
115
|
+
opacity: 1;
|
|
116
|
+
transform: scale(1) translateY(0);
|
|
117
|
+
transition: opacity 300ms ease-out, transform 300ms ease-out;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.animation-toggle-exit {
|
|
121
|
+
opacity: 1;
|
|
122
|
+
transform: scale(1) translateY(0);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.animation-toggle-exit-active {
|
|
126
|
+
opacity: 0;
|
|
127
|
+
transform: scale(0.95) translateY(-10px);
|
|
128
|
+
transition: opacity 300ms ease-in, transform 300ms ease-in;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Screen Reader Only Content */
|
|
132
|
+
.sr-only {
|
|
133
|
+
position: absolute !important;
|
|
134
|
+
width: 1px !important;
|
|
135
|
+
height: 1px !important;
|
|
136
|
+
padding: 0 !important;
|
|
137
|
+
margin: -1px !important;
|
|
138
|
+
overflow: hidden !important;
|
|
139
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
140
|
+
white-space: nowrap !important;
|
|
141
|
+
border: 0 !important;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* High Contrast Mode Support */
|
|
145
|
+
@media (forced-colors: active) {
|
|
146
|
+
.animation-toggle-trigger,
|
|
147
|
+
.animation-toggle-close {
|
|
148
|
+
border: 2px solid ButtonText;
|
|
149
|
+
background: ButtonFace;
|
|
150
|
+
color: ButtonText;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.animation-toggle-trigger:focus,
|
|
154
|
+
.animation-toggle-close:focus {
|
|
155
|
+
outline: 3px solid Highlight;
|
|
156
|
+
outline-offset: 2px;
|
|
157
|
+
background: Highlight;
|
|
158
|
+
color: HighlightText;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.animation-toggle-trigger:hover,
|
|
162
|
+
.animation-toggle-close:hover {
|
|
163
|
+
background: Highlight;
|
|
164
|
+
color: HighlightText;
|
|
165
|
+
border-color: HighlightText;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.animation-toggle-content {
|
|
169
|
+
border: 2px solid WindowText;
|
|
170
|
+
background: Window;
|
|
171
|
+
color: WindowText;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.animation-toggle-trigger:disabled {
|
|
175
|
+
border-color: GrayText;
|
|
176
|
+
background: Canvas;
|
|
177
|
+
color: GrayText;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Reduced Motion Support */
|
|
182
|
+
@media (prefers-reduced-motion: reduce) {
|
|
183
|
+
.animation-toggle-trigger,
|
|
184
|
+
.animation-toggle-close {
|
|
185
|
+
transition: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.animation-toggle-enter-active,
|
|
189
|
+
.animation-toggle-exit-active {
|
|
190
|
+
transition: none;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.animation-toggle-enter {
|
|
194
|
+
opacity: 1;
|
|
195
|
+
transform: none;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.animation-toggle-exit {
|
|
199
|
+
opacity: 0;
|
|
200
|
+
transform: none;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* Dark Mode Support */
|
|
205
|
+
@media (prefers-color-scheme: dark) {
|
|
206
|
+
.animation-toggle-wrapper {
|
|
207
|
+
--button-bg: #0d6efd;
|
|
208
|
+
--button-bg-hover: #0b5ed7;
|
|
209
|
+
--button-bg-focus: #0b5ed7;
|
|
210
|
+
--button-bg-active: #0a58ca;
|
|
211
|
+
--button-text: #ffffff;
|
|
212
|
+
--content-bg: #212529;
|
|
213
|
+
--content-border: #495057;
|
|
214
|
+
--close-bg: #dc3545;
|
|
215
|
+
--close-bg-hover: #bb2d3b;
|
|
216
|
+
--close-bg-focus: #bb2d3b;
|
|
217
|
+
--close-bg-active: #b02a37;
|
|
218
|
+
--close-text: #ffffff;
|
|
219
|
+
--focus-color: #86b7fe;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* Focus Visible Support */
|
|
224
|
+
.animation-toggle-trigger:focus:not(:focus-visible),
|
|
225
|
+
.animation-toggle-close:focus:not(:focus-visible) {
|
|
226
|
+
outline: none;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.animation-toggle-trigger:focus-visible,
|
|
230
|
+
.animation-toggle-close:focus-visible {
|
|
231
|
+
outline: 3px solid var(--focus-color, #4d90fe);
|
|
232
|
+
outline-offset: 2px;
|
|
233
|
+
}
|