uikit-react-public 0.11.24 → 0.14.21
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/dist/components/Badge/Badge.d.ts +6 -0
- package/dist/components/Badge/Badge.stories.d.ts +15 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +2 -1
- package/dist/components/CookieNotice/CookieNotice.d.ts +16 -0
- package/dist/components/CookieNotice/index.d.ts +2 -0
- package/dist/components/Dialog/BaseDialog.d.ts +7 -2
- package/dist/components/FileInput/FileInput.d.ts +8 -0
- package/dist/components/FileInput/FileInput.stories.d.ts +16 -0
- package/dist/components/FileInput/__tests__/FileInput.test.d.ts +1 -0
- package/dist/components/FileInput/index.d.ts +2 -0
- package/dist/components/Header/Header.d.ts +4 -1
- package/dist/components/Heading/Heading.d.ts +1 -1
- package/dist/components/Link/BaseLink.d.ts +10 -0
- package/dist/components/Link/Link.d.ts +5 -10
- package/dist/components/Link/Link.stories.d.ts +1 -1
- package/dist/components/Link/index.d.ts +1 -1
- package/dist/components/Menu/MenuContent.d.ts +1 -1
- package/dist/components/Menu/MenuItem.d.ts +2 -0
- package/dist/components/Menu/MenuSection.d.ts +1 -1
- package/dist/components/Search/Search.d.ts +16 -0
- package/dist/components/Search/Search.stories.d.ts +34 -0
- package/dist/components/Search/__tests__/Search.test.d.ts +1 -0
- package/dist/components/Search/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.stories.d.ts +3 -7
- package/dist/components/Select/Select.types.d.ts +19 -14
- package/dist/components/Select/subcomponents/CustomOption.d.ts +1 -1
- package/dist/components/Select/subcomponents/CustomSelect.d.ts +1 -2
- package/dist/components/Select/subcomponents/Panel.d.ts +1 -1
- package/dist/components/Select/subcomponents/VisibleField.d.ts +4 -4
- package/dist/components/StandaloneLink/StandaloneLink.d.ts +12 -0
- package/dist/components/StandaloneLink/StandaloneLink.stories.d.ts +13 -0
- package/dist/components/StandaloneLink/__tests__/StandaloneLink.test.d.ts +1 -0
- package/dist/components/StandaloneLink/index.d.ts +2 -0
- package/dist/components/Table/Table.d.ts +10 -8
- package/dist/components/Table/Table.stories.d.ts +21 -0
- package/dist/components/Table/Table.types.d.ts +11 -0
- package/dist/components/Table/__tests__/Table.test.d.ts +1 -0
- package/dist/components/Table/index.d.ts +2 -1
- package/dist/components/Table/subcomponents/Body.d.ts +4 -0
- package/dist/components/Table/subcomponents/Cell/Cell.d.ts +12 -0
- package/dist/components/Table/subcomponents/Cell/Cell.stories.d.ts +313 -0
- package/dist/components/Table/subcomponents/Cell/CellContent.d.ts +10 -0
- package/dist/components/Table/subcomponents/Cell/__tests__/Cell.test.d.ts +1 -0
- package/dist/components/Table/subcomponents/Head.d.ts +4 -0
- package/dist/components/Table/subcomponents/HeadCell/HeadCell.d.ts +13 -0
- package/dist/components/Table/subcomponents/HeadCell/HeadCell.stories.d.ts +312 -0
- package/dist/components/Table/subcomponents/HeadCell/HeadCellContent.d.ts +10 -0
- package/dist/components/Table/subcomponents/HeadCell/__tests__/HeadCell.test.d.ts +1 -0
- package/dist/components/Table/subcomponents/Row.d.ts +5 -0
- package/dist/components/Table/subcomponents/SortIcon.d.ts +7 -0
- package/dist/components/Table/subcomponents/index.d.ts +10 -0
- package/dist/components/Tabs/Tab.d.ts +1 -1
- package/dist/components/Tabs/TabContext.d.ts +1 -0
- package/dist/components/Tabs/Tabs.d.ts +3 -1
- package/dist/components/Tabs/Tabs.stories.d.ts +3 -0
- package/dist/components/Timepicker/Timepicker.d.ts +10 -0
- package/dist/components/Timepicker/Timepicker.stories.d.ts +7 -0
- package/dist/components/Timepicker/__tests__/Timepicker.test.d.ts +1 -0
- package/dist/components/Timepicker/index.d.ts +2 -0
- package/dist/components/Timepicker/utils/convertDateToTimeString.d.ts +2 -0
- package/dist/components/Timepicker/utils/convertDateToTimeString.test.d.ts +1 -0
- package/dist/components/Timepicker/utils/index.d.ts +1 -0
- package/dist/components/WeekPicker/WeekPicker.d.ts +3 -0
- package/dist/components/WeekPicker/index.d.ts +1 -0
- package/dist/components/WeekPicker/subcomponents/CustomDatepicker.d.ts +17 -0
- package/dist/components/WeekPicker/subcomponents/DatepickerInput.d.ts +13 -0
- package/dist/components/WeekPicker/subcomponents/VisibleField.d.ts +15 -0
- package/dist/components/WeekPicker/subcomponents/index.d.ts +3 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useFocusTrap.d.ts +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5703 -4448
- package/dist/theme/defaultTheme.d.ts +7 -0
- package/dist/theme/useTheme.d.ts +14 -0
- package/dist/utils/__tests__/capitalise.test.d.ts +1 -0
- package/dist/utils/capitalise.d.ts +2 -0
- package/lib/components/Alert/Alert.tsx +7 -1
- package/lib/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +4 -0
- package/lib/components/Badge/Badge.stories.tsx +19 -0
- package/lib/components/Badge/Badge.tsx +48 -0
- package/lib/components/Badge/index.ts +2 -0
- package/lib/components/Breadcrumbs/__tests__/__snapshots__/Breadcrumbs.test.tsx.snap +4 -4
- package/lib/components/Button/Button.tsx +5 -2
- package/lib/components/Calendar/subcomponents/Grid.tsx +0 -1
- package/lib/components/CookieNotice/CookieNotice.tsx +114 -0
- package/lib/components/CookieNotice/index.ts +2 -0
- package/lib/components/Dialog/BaseDialog.tsx +44 -4
- package/lib/components/Field/__tests__/Field.test.tsx +148 -148
- package/lib/components/FileInput/FileInput.stories.tsx +70 -0
- package/lib/components/FileInput/FileInput.tsx +68 -0
- package/lib/components/FileInput/__tests__/FileInput.test.tsx +99 -0
- package/lib/components/FileInput/__tests__/__snapshots__/FileInput.test.tsx.snap +91 -0
- package/lib/components/FileInput/index.ts +2 -0
- package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +25 -25
- package/lib/components/Header/Header.tsx +19 -2
- package/lib/components/Header/__tests__/__snapshots__/Header.test.tsx.snap +4 -4
- package/lib/components/Heading/Documentation.mdx +1 -1
- package/lib/components/Heading/Heading.tsx +1 -1
- package/lib/components/Heading/__tests__/Heading.test.tsx +7 -19
- package/lib/components/Heading/__tests__/__snapshots__/Heading.test.tsx.snap +7 -7
- package/lib/components/Label/Label.tsx +0 -2
- package/lib/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +7 -7
- package/lib/components/Link/BaseLink.tsx +84 -0
- package/lib/components/Link/Link.tsx +72 -32
- package/lib/components/Link/__tests__/__snapshots__/link.test.tsx.snap +3 -3
- package/lib/components/Link/__tests__/link.test.tsx +6 -13
- package/lib/components/Link/index.ts +1 -1
- package/lib/components/Menu/Menu.context.tsx +3 -1
- package/lib/components/Menu/Menu.tsx +2 -2
- package/lib/components/Menu/MenuContent.tsx +5 -5
- package/lib/components/Menu/MenuItem.tsx +20 -3
- package/lib/components/Menu/MenuSection.tsx +4 -3
- package/lib/components/Pagination/PaginationControls.tsx +1 -3
- package/lib/components/Search/Search.stories.tsx +41 -0
- package/lib/components/Search/Search.tsx +167 -0
- package/lib/components/Search/__tests__/Search.test.tsx +94 -0
- package/lib/components/Search/__tests__/__snapshots__/Search.test.tsx.snap +179 -0
- package/lib/components/Search/index.ts +2 -0
- package/lib/components/Select/Select.stories.tsx +8 -35
- package/lib/components/Select/Select.tsx +2 -2
- package/lib/components/Select/Select.types.ts +20 -15
- package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +3 -3
- package/lib/components/Select/subcomponents/CustomOption.tsx +22 -9
- package/lib/components/Select/subcomponents/CustomSelect.tsx +31 -20
- package/lib/components/Select/subcomponents/Panel.tsx +4 -5
- package/lib/components/Select/subcomponents/VisibleField.tsx +26 -22
- package/lib/components/StandaloneLink/StandaloneLink.stories.tsx +32 -0
- package/lib/components/StandaloneLink/StandaloneLink.tsx +183 -0
- package/lib/components/StandaloneLink/__tests__/StandaloneLink.test.tsx +57 -0
- package/lib/components/StandaloneLink/__tests__/__snapshots__/StandaloneLink.test.tsx.snap +19 -0
- package/lib/components/StandaloneLink/index.ts +2 -0
- package/lib/components/Table/Table.stories.tsx +337 -0
- package/lib/components/Table/Table.tsx +42 -67
- package/lib/components/Table/Table.types.ts +14 -0
- package/lib/components/Table/__tests__/Table.test.tsx +121 -0
- package/lib/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +210 -0
- package/lib/components/Table/index.ts +8 -1
- package/lib/components/Table/subcomponents/Body.tsx +18 -0
- package/lib/components/Table/subcomponents/Cell/Cell.stories.tsx +151 -0
- package/lib/components/Table/subcomponents/Cell/Cell.tsx +72 -0
- package/lib/components/Table/subcomponents/Cell/CellContent.tsx +91 -0
- package/lib/components/Table/subcomponents/Cell/__tests__/Cell.test.tsx +115 -0
- package/lib/components/Table/subcomponents/Cell/__tests__/__snapshots__/Cell.test.tsx.snap +107 -0
- package/lib/components/Table/subcomponents/Head.tsx +34 -0
- package/lib/components/Table/subcomponents/HeadCell/HeadCell.stories.tsx +85 -0
- package/lib/components/Table/subcomponents/HeadCell/HeadCell.tsx +99 -0
- package/lib/components/Table/subcomponents/HeadCell/HeadCellContent.tsx +61 -0
- package/lib/components/Table/subcomponents/HeadCell/__tests__/HeadCell.test.tsx +137 -0
- package/lib/components/Table/subcomponents/HeadCell/__tests__/__snapshots__/HeadCell.test.tsx.snap +110 -0
- package/lib/components/Table/subcomponents/Row.tsx +49 -0
- package/lib/components/Table/subcomponents/SortIcon.tsx +63 -0
- package/lib/components/Table/subcomponents/index.ts +14 -0
- package/lib/components/Tabs/Tab.tsx +3 -3
- package/lib/components/Tabs/TabContext.tsx +1 -0
- package/lib/components/Tabs/Tabs.stories.tsx +9 -3
- package/lib/components/Tabs/Tabs.tsx +10 -32
- package/lib/components/Tabs/__tests__/Tabs.test.tsx +10 -4
- package/lib/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +32 -32
- package/lib/components/Timepicker/Timepicker.stories.tsx +43 -0
- package/lib/components/Timepicker/Timepicker.tsx +96 -0
- package/lib/components/Timepicker/__tests__/Timepicker.test.tsx +55 -0
- package/lib/components/Timepicker/__tests__/__snapshots__/Timepicker.test.tsx.snap +19 -0
- package/lib/components/Timepicker/index.tsx +2 -0
- package/lib/components/Timepicker/utils/convertDateToTimeString.test.ts +54 -0
- package/lib/components/Timepicker/utils/convertDateToTimeString.ts +10 -0
- package/lib/components/Timepicker/utils/index.ts +1 -0
- package/lib/components/WeekPicker/WeekPicker.tsx +26 -0
- package/lib/components/WeekPicker/index.ts +1 -0
- package/lib/components/WeekPicker/subcomponents/CustomDatepicker.tsx +298 -0
- package/lib/components/WeekPicker/subcomponents/DatepickerInput.tsx +111 -0
- package/lib/components/WeekPicker/subcomponents/VisibleField.tsx +126 -0
- package/lib/components/WeekPicker/subcomponents/index.ts +3 -0
- package/lib/components/index.ts +17 -0
- package/lib/hooks/index.ts +2 -0
- package/lib/hooks/useFocusTrap.ts +123 -0
- package/lib/index.ts +1 -0
- package/lib/theme/defaultTheme.ts +7 -0
- package/lib/utils/__tests__/capitalise.test.ts +40 -0
- package/lib/utils/capitalise.ts +4 -0
- package/package.json +1 -1
- package/lib/components/Field/__tests__/__snapshots__/Field.test.tsx.snap +0 -300
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Generated with Claude Sonnet 4
|
|
2
|
+
|
|
3
|
+
import { useEffect, useCallback, useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
// Selector for focusable elements
|
|
6
|
+
const FOCUSABLE_ELEMENTS = [
|
|
7
|
+
'a[href]',
|
|
8
|
+
'button:not([disabled])',
|
|
9
|
+
'textarea:not([disabled])',
|
|
10
|
+
'input:not([disabled])',
|
|
11
|
+
'select:not([disabled])',
|
|
12
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
13
|
+
'[contenteditable="true"]',
|
|
14
|
+
'audio[controls]',
|
|
15
|
+
'video[controls]',
|
|
16
|
+
'details > summary:first-of-type',
|
|
17
|
+
].join(', ');
|
|
18
|
+
|
|
19
|
+
interface UseFocusTrapOptions {
|
|
20
|
+
isActive: boolean;
|
|
21
|
+
containerRef: React.RefObject<HTMLElement | null>;
|
|
22
|
+
initialFocusRef?: React.RefObject<HTMLElement>;
|
|
23
|
+
finalFocusRef?: React.RefObject<HTMLElement>;
|
|
24
|
+
restoreFocus?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const useFocusTrap = ({
|
|
28
|
+
isActive,
|
|
29
|
+
containerRef,
|
|
30
|
+
initialFocusRef,
|
|
31
|
+
finalFocusRef,
|
|
32
|
+
restoreFocus = true,
|
|
33
|
+
}: UseFocusTrapOptions) => {
|
|
34
|
+
const previousActiveElement = useRef<HTMLElement | null>(null);
|
|
35
|
+
|
|
36
|
+
// Get all focusable elements within the container
|
|
37
|
+
const getFocusableElements = useCallback((): HTMLElement[] => {
|
|
38
|
+
if (!containerRef.current) return [];
|
|
39
|
+
|
|
40
|
+
const elements = containerRef.current.querySelectorAll(FOCUSABLE_ELEMENTS);
|
|
41
|
+
return Array.from(elements) as HTMLElement[];
|
|
42
|
+
}, [containerRef]);
|
|
43
|
+
|
|
44
|
+
// Handle tab key navigation
|
|
45
|
+
const handleKeyDown = useCallback(
|
|
46
|
+
(event: KeyboardEvent) => {
|
|
47
|
+
if (!isActive || event.key !== 'Tab') return;
|
|
48
|
+
|
|
49
|
+
const focusableElements = getFocusableElements();
|
|
50
|
+
if (focusableElements.length === 0) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const firstElement = focusableElements[0];
|
|
56
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
57
|
+
const currentFocus = document.activeElement as HTMLElement;
|
|
58
|
+
|
|
59
|
+
if (event.shiftKey) {
|
|
60
|
+
// Shift + Tab (moving backwards)
|
|
61
|
+
if (
|
|
62
|
+
currentFocus === firstElement ||
|
|
63
|
+
!containerRef.current?.contains(currentFocus)
|
|
64
|
+
) {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
lastElement.focus();
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
// Tab (moving forwards)
|
|
70
|
+
if (
|
|
71
|
+
currentFocus === lastElement ||
|
|
72
|
+
!containerRef.current?.contains(currentFocus)
|
|
73
|
+
) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
firstElement.focus();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
[isActive, getFocusableElements, containerRef]
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// Set initial focus when trap becomes active
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!isActive) return;
|
|
85
|
+
|
|
86
|
+
// Store the previously focused element
|
|
87
|
+
previousActiveElement.current = document.activeElement as HTMLElement;
|
|
88
|
+
|
|
89
|
+
// Focus the specified initial element or the first focusable element
|
|
90
|
+
const focusElement = initialFocusRef?.current || getFocusableElements()[0];
|
|
91
|
+
if (focusElement) {
|
|
92
|
+
// Use setTimeout to ensure the element is rendered and focusable
|
|
93
|
+
setTimeout(() => focusElement.focus(), 0);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Add event listener for keyboard navigation
|
|
97
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
98
|
+
|
|
99
|
+
return () => {
|
|
100
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
101
|
+
};
|
|
102
|
+
}, [isActive, initialFocusRef, getFocusableElements, handleKeyDown]);
|
|
103
|
+
|
|
104
|
+
// Restore focus when trap becomes inactive
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (isActive) return; // Only run when becoming inactive
|
|
107
|
+
|
|
108
|
+
if (restoreFocus && previousActiveElement.current) {
|
|
109
|
+
// Use setTimeout to ensure the dialog is fully closed before restoring focus
|
|
110
|
+
const restoreTimeout = setTimeout(() => {
|
|
111
|
+
const elementToFocus =
|
|
112
|
+
finalFocusRef?.current || previousActiveElement.current;
|
|
113
|
+
if (elementToFocus && document.contains(elementToFocus)) {
|
|
114
|
+
elementToFocus.focus();
|
|
115
|
+
}
|
|
116
|
+
// Clear the stored element after restoring focus
|
|
117
|
+
previousActiveElement.current = null;
|
|
118
|
+
}, 100); // Longer delay for native dialog close
|
|
119
|
+
|
|
120
|
+
return () => clearTimeout(restoreTimeout);
|
|
121
|
+
}
|
|
122
|
+
}, [isActive, finalFocusRef, restoreFocus]);
|
|
123
|
+
};
|
package/lib/index.ts
CHANGED
|
@@ -47,6 +47,7 @@ const pink20 = '#DEB8C3'; // UCL vibrant pink
|
|
|
47
47
|
const black100 = '#000000';
|
|
48
48
|
const black90 = '#1A1A1A';
|
|
49
49
|
const black80 = '#333333';
|
|
50
|
+
const black70 = '#4D4D4D';
|
|
50
51
|
const black60 = '#666666';
|
|
51
52
|
const black40 = '#999999';
|
|
52
53
|
const black20 = '#CCCCCC';
|
|
@@ -102,6 +103,7 @@ const baseColour = {
|
|
|
102
103
|
black100,
|
|
103
104
|
black90,
|
|
104
105
|
black80,
|
|
106
|
+
black70,
|
|
105
107
|
black60,
|
|
106
108
|
black40,
|
|
107
109
|
black20,
|
|
@@ -189,7 +191,9 @@ const systemColours = {
|
|
|
189
191
|
|
|
190
192
|
const linkColours = {
|
|
191
193
|
default: baseColour.blue70,
|
|
194
|
+
secondaryDefault: baseColour.black90,
|
|
192
195
|
hover: baseColour.blue100,
|
|
196
|
+
secondaryHover: baseColour.black70,
|
|
193
197
|
visited: baseColour.purple40,
|
|
194
198
|
disabled: baseColour.black20,
|
|
195
199
|
};
|
|
@@ -203,6 +207,7 @@ const neutralColours = {
|
|
|
203
207
|
black: blackAndWhite.black,
|
|
204
208
|
grey90: baseColour.black90,
|
|
205
209
|
grey80: baseColour.black80,
|
|
210
|
+
grey70: baseColour.black70,
|
|
206
211
|
grey60: baseColour.black60,
|
|
207
212
|
grey40: baseColour.black40,
|
|
208
213
|
grey20: baseColour.black20,
|
|
@@ -253,6 +258,7 @@ const baseSizes = {
|
|
|
253
258
|
};
|
|
254
259
|
|
|
255
260
|
const margin = {
|
|
261
|
+
m0: 0,
|
|
256
262
|
m2: baseSizes.s2,
|
|
257
263
|
m4: baseSizes.s4,
|
|
258
264
|
m6: baseSizes.s6,
|
|
@@ -271,6 +277,7 @@ const margin = {
|
|
|
271
277
|
};
|
|
272
278
|
|
|
273
279
|
const padding = {
|
|
280
|
+
p0: 0,
|
|
274
281
|
p2: baseSizes.s2,
|
|
275
282
|
p4: baseSizes.s4,
|
|
276
283
|
p6: baseSizes.s6,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import capitalise from '../capitalise';
|
|
3
|
+
|
|
4
|
+
describe('capitalise', () => {
|
|
5
|
+
it('should capitalize the first letter of a lowercase word', () => {
|
|
6
|
+
expect(capitalise('hello')).toBe('Hello');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('should capitalize the first letter of a sentence', () => {
|
|
10
|
+
expect(capitalise('hello world')).toBe('Hello world');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should handle already capitalized text', () => {
|
|
14
|
+
expect(capitalise('Hello')).toBe('Hello');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should handle single character strings', () => {
|
|
18
|
+
expect(capitalise('a')).toBe('A');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should handle strings that start with uppercase', () => {
|
|
22
|
+
expect(capitalise('HELLO')).toBe('HELLO');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should handle empty strings', () => {
|
|
26
|
+
expect(capitalise('')).toBe('');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should handle strings with numbers at the start', () => {
|
|
30
|
+
expect(capitalise('123abc')).toBe('123abc');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should handle strings with special characters at the start', () => {
|
|
34
|
+
expect(capitalise('!hello')).toBe('!hello');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should preserve the rest of the string as-is', () => {
|
|
38
|
+
expect(capitalise('hELLO')).toBe('HELLO');
|
|
39
|
+
});
|
|
40
|
+
});
|
package/package.json
CHANGED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`Field > Snapshot: Default (no children) 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
class="ucl-uikit-field css-1wirz7t"
|
|
6
|
-
data-testid="ucl-uikit-field"
|
|
7
|
-
/>
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
exports[`Field > Snapshot: Field.ErrorText alone 1`] = `null`;
|
|
11
|
-
|
|
12
|
-
exports[`Field > Snapshot: Field.HelperText alone 1`] = `
|
|
13
|
-
<div
|
|
14
|
-
class="ucl-uikit-field__helper-text css-1m34d18"
|
|
15
|
-
data-testid="ucl-uikit-field__helper-text"
|
|
16
|
-
>
|
|
17
|
-
Helper text
|
|
18
|
-
</div>
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
exports[`Field > Snapshot: With Label, HelperText, ErrorText, Input 1`] = `
|
|
22
|
-
<div
|
|
23
|
-
class="ucl-uikit-field css-1wirz7t"
|
|
24
|
-
data-testid="ucl-uikit-field"
|
|
25
|
-
>
|
|
26
|
-
<label
|
|
27
|
-
class="ucl-uikit-label css-v576g6"
|
|
28
|
-
data-testid="ucl-uikit-label"
|
|
29
|
-
for="«r2»"
|
|
30
|
-
>
|
|
31
|
-
Name
|
|
32
|
-
</label>
|
|
33
|
-
<div
|
|
34
|
-
class="ucl-uikit-field__helper-text css-1m34d18"
|
|
35
|
-
data-testid="ucl-uikit-field__helper-text"
|
|
36
|
-
>
|
|
37
|
-
Helper text
|
|
38
|
-
</div>
|
|
39
|
-
<span
|
|
40
|
-
class="ucl-uikit-input css-1bpb1dw"
|
|
41
|
-
>
|
|
42
|
-
<input
|
|
43
|
-
class="ucl-uikit-input__input css-1nizqet"
|
|
44
|
-
data-testid="ucl-uikit-input"
|
|
45
|
-
id="«r2»"
|
|
46
|
-
/>
|
|
47
|
-
</span>
|
|
48
|
-
</div>
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
exports[`Field > Snapshot: With Label, HelperText, ErrorText, Input, & prop disabled 1`] = `
|
|
52
|
-
<div
|
|
53
|
-
class="ucl-uikit-field css-1wirz7t"
|
|
54
|
-
data-testid="ucl-uikit-field"
|
|
55
|
-
>
|
|
56
|
-
<label
|
|
57
|
-
class="ucl-uikit-label css-2pe9mc"
|
|
58
|
-
data-testid="ucl-uikit-label"
|
|
59
|
-
for="«r3»"
|
|
60
|
-
>
|
|
61
|
-
Name
|
|
62
|
-
</label>
|
|
63
|
-
<div
|
|
64
|
-
class="ucl-uikit-field__helper-text css-k4nfij"
|
|
65
|
-
data-testid="ucl-uikit-field__helper-text"
|
|
66
|
-
>
|
|
67
|
-
Helper text
|
|
68
|
-
</div>
|
|
69
|
-
<span
|
|
70
|
-
class="ucl-uikit-input css-1bpb1dw"
|
|
71
|
-
>
|
|
72
|
-
<input
|
|
73
|
-
class="ucl-uikit-input__input css-mfikdl"
|
|
74
|
-
data-testid="ucl-uikit-input"
|
|
75
|
-
disabled=""
|
|
76
|
-
id="«r3»"
|
|
77
|
-
/>
|
|
78
|
-
</span>
|
|
79
|
-
</div>
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
|
-
exports[`Field > Snapshot: With Label, HelperText, ErrorText, Input, & prop error 1`] = `
|
|
83
|
-
<div
|
|
84
|
-
class="ucl-uikit-field css-ar7o8y"
|
|
85
|
-
data-testid="ucl-uikit-field"
|
|
86
|
-
>
|
|
87
|
-
<label
|
|
88
|
-
class="ucl-uikit-label css-v576g6"
|
|
89
|
-
data-testid="ucl-uikit-label"
|
|
90
|
-
for="«r4»"
|
|
91
|
-
>
|
|
92
|
-
Name
|
|
93
|
-
</label>
|
|
94
|
-
<div
|
|
95
|
-
class="ucl-uikit-field__helper-text css-1m34d18"
|
|
96
|
-
data-testid="ucl-uikit-field__helper-text"
|
|
97
|
-
>
|
|
98
|
-
Helper text
|
|
99
|
-
</div>
|
|
100
|
-
<div
|
|
101
|
-
class="ucl-uikit-field__error-text css-1puiun"
|
|
102
|
-
data-testid="ucl-uikit-field__error-text"
|
|
103
|
-
>
|
|
104
|
-
<svg
|
|
105
|
-
class="ucl-uikit-icon css-q9euyk"
|
|
106
|
-
data-testid="ucl-uikit-icon"
|
|
107
|
-
fill="none"
|
|
108
|
-
height="24"
|
|
109
|
-
stroke="currentColor"
|
|
110
|
-
stroke-linecap="round"
|
|
111
|
-
stroke-linejoin="round"
|
|
112
|
-
stroke-width="2"
|
|
113
|
-
viewBox="0 0 24 24"
|
|
114
|
-
width="24"
|
|
115
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
116
|
-
>
|
|
117
|
-
<circle
|
|
118
|
-
cx="12"
|
|
119
|
-
cy="12"
|
|
120
|
-
r="10"
|
|
121
|
-
/>
|
|
122
|
-
<line
|
|
123
|
-
x1="12"
|
|
124
|
-
x2="12"
|
|
125
|
-
y1="16"
|
|
126
|
-
y2="12"
|
|
127
|
-
/>
|
|
128
|
-
<line
|
|
129
|
-
x1="12"
|
|
130
|
-
x2="12.01"
|
|
131
|
-
y1="8"
|
|
132
|
-
y2="8"
|
|
133
|
-
/>
|
|
134
|
-
</svg>
|
|
135
|
-
Error text
|
|
136
|
-
</div>
|
|
137
|
-
<span
|
|
138
|
-
class="ucl-uikit-input css-1bpb1dw"
|
|
139
|
-
>
|
|
140
|
-
<input
|
|
141
|
-
class="ucl-uikit-input__input css-1nizqet"
|
|
142
|
-
data-testid="ucl-uikit-input"
|
|
143
|
-
id="«r4»"
|
|
144
|
-
/>
|
|
145
|
-
</span>
|
|
146
|
-
</div>
|
|
147
|
-
`;
|
|
148
|
-
|
|
149
|
-
exports[`Field > Snapshot: With Label, HelperText, ErrorText, Input, & prop optional 1`] = `
|
|
150
|
-
<div
|
|
151
|
-
class="ucl-uikit-field css-1wirz7t"
|
|
152
|
-
data-testid="ucl-uikit-field"
|
|
153
|
-
>
|
|
154
|
-
<label
|
|
155
|
-
class="ucl-uikit-label css-v576g6"
|
|
156
|
-
data-testid="ucl-uikit-label"
|
|
157
|
-
for="«r5»"
|
|
158
|
-
>
|
|
159
|
-
Name
|
|
160
|
-
<span
|
|
161
|
-
class="css-1fd72bb"
|
|
162
|
-
>
|
|
163
|
-
(optional)
|
|
164
|
-
</span>
|
|
165
|
-
</label>
|
|
166
|
-
<div
|
|
167
|
-
class="ucl-uikit-field__helper-text css-1m34d18"
|
|
168
|
-
data-testid="ucl-uikit-field__helper-text"
|
|
169
|
-
>
|
|
170
|
-
Helper text
|
|
171
|
-
</div>
|
|
172
|
-
<span
|
|
173
|
-
class="ucl-uikit-input css-1bpb1dw"
|
|
174
|
-
>
|
|
175
|
-
<input
|
|
176
|
-
class="ucl-uikit-input__input css-1nizqet"
|
|
177
|
-
data-testid="ucl-uikit-input"
|
|
178
|
-
id="«r5»"
|
|
179
|
-
/>
|
|
180
|
-
</span>
|
|
181
|
-
</div>
|
|
182
|
-
`;
|
|
183
|
-
|
|
184
|
-
exports[`Field > Snapshot: With Label, HelperText, ErrorText, Textarea 1`] = `
|
|
185
|
-
<div
|
|
186
|
-
class="ucl-uikit-field css-1wirz7t"
|
|
187
|
-
data-testid="ucl-uikit-field"
|
|
188
|
-
>
|
|
189
|
-
<label
|
|
190
|
-
class="ucl-uikit-label css-v576g6"
|
|
191
|
-
data-testid="ucl-uikit-label"
|
|
192
|
-
for="«r7»"
|
|
193
|
-
>
|
|
194
|
-
Name
|
|
195
|
-
</label>
|
|
196
|
-
<div
|
|
197
|
-
class="ucl-uikit-field__helper-text css-1m34d18"
|
|
198
|
-
data-testid="ucl-uikit-field__helper-text"
|
|
199
|
-
>
|
|
200
|
-
Helper text
|
|
201
|
-
</div>
|
|
202
|
-
<textarea
|
|
203
|
-
class="ucl-uikit-textarea css-19nnvor"
|
|
204
|
-
data-testid="ucl-uikit-textarea"
|
|
205
|
-
id="«r7»"
|
|
206
|
-
/>
|
|
207
|
-
</div>
|
|
208
|
-
`;
|
|
209
|
-
|
|
210
|
-
exports[`Field > Snapshot: With Label, HelperText, ErrorText, Textarea, & prop disabled 1`] = `
|
|
211
|
-
<div
|
|
212
|
-
class="ucl-uikit-field css-1wirz7t"
|
|
213
|
-
data-testid="ucl-uikit-field"
|
|
214
|
-
>
|
|
215
|
-
<label
|
|
216
|
-
class="ucl-uikit-label css-2pe9mc"
|
|
217
|
-
data-testid="ucl-uikit-label"
|
|
218
|
-
for="«r8»"
|
|
219
|
-
>
|
|
220
|
-
Name
|
|
221
|
-
</label>
|
|
222
|
-
<div
|
|
223
|
-
class="ucl-uikit-field__helper-text css-k4nfij"
|
|
224
|
-
data-testid="ucl-uikit-field__helper-text"
|
|
225
|
-
>
|
|
226
|
-
Helper text
|
|
227
|
-
</div>
|
|
228
|
-
<textarea
|
|
229
|
-
class="ucl-uikit-textarea css-1o8pbxe"
|
|
230
|
-
data-testid="ucl-uikit-textarea"
|
|
231
|
-
disabled=""
|
|
232
|
-
id="«r8»"
|
|
233
|
-
/>
|
|
234
|
-
</div>
|
|
235
|
-
`;
|
|
236
|
-
|
|
237
|
-
exports[`Field > Snapshot: With Label, Input 1`] = `
|
|
238
|
-
<div
|
|
239
|
-
class="ucl-uikit-field css-1wirz7t"
|
|
240
|
-
data-testid="ucl-uikit-field"
|
|
241
|
-
>
|
|
242
|
-
<label
|
|
243
|
-
class="ucl-uikit-label css-v576g6"
|
|
244
|
-
data-testid="ucl-uikit-label"
|
|
245
|
-
for="«r1»"
|
|
246
|
-
>
|
|
247
|
-
Name
|
|
248
|
-
</label>
|
|
249
|
-
<span
|
|
250
|
-
class="ucl-uikit-input css-1bpb1dw"
|
|
251
|
-
>
|
|
252
|
-
<input
|
|
253
|
-
class="ucl-uikit-input__input css-1nizqet"
|
|
254
|
-
data-testid="ucl-uikit-input"
|
|
255
|
-
id="«r1»"
|
|
256
|
-
/>
|
|
257
|
-
</span>
|
|
258
|
-
</div>
|
|
259
|
-
`;
|
|
260
|
-
|
|
261
|
-
exports[`Field > Snapshot: With Label, Textarea 1`] = `
|
|
262
|
-
<div
|
|
263
|
-
class="ucl-uikit-field css-1wirz7t"
|
|
264
|
-
data-testid="ucl-uikit-field"
|
|
265
|
-
>
|
|
266
|
-
<label
|
|
267
|
-
class="ucl-uikit-label css-v576g6"
|
|
268
|
-
data-testid="ucl-uikit-label"
|
|
269
|
-
for="«r6»"
|
|
270
|
-
>
|
|
271
|
-
Name
|
|
272
|
-
</label>
|
|
273
|
-
<textarea
|
|
274
|
-
class="ucl-uikit-textarea css-19nnvor"
|
|
275
|
-
data-testid="ucl-uikit-textarea"
|
|
276
|
-
id="«r6»"
|
|
277
|
-
/>
|
|
278
|
-
</div>
|
|
279
|
-
`;
|
|
280
|
-
|
|
281
|
-
exports[`Field > Snapshot: With Textarea & prop maxChar 1`] = `
|
|
282
|
-
<div
|
|
283
|
-
class="ucl-uikit-field css-1wirz7t"
|
|
284
|
-
data-testid="ucl-uikit-field"
|
|
285
|
-
>
|
|
286
|
-
<textarea
|
|
287
|
-
class="ucl-uikit-textarea css-19nnvor"
|
|
288
|
-
data-testid="ucl-uikit-textarea"
|
|
289
|
-
id="«r9»"
|
|
290
|
-
/>
|
|
291
|
-
<div
|
|
292
|
-
class="ucl-uikit-field__char-count css-1ma0lts"
|
|
293
|
-
data-testid="ucl-uikit-field__char-count"
|
|
294
|
-
>
|
|
295
|
-
0
|
|
296
|
-
/
|
|
297
|
-
100
|
|
298
|
-
</div>
|
|
299
|
-
</div>
|
|
300
|
-
`;
|