@drivenets/design-system 0.8.0 → 0.9.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/CHANGELOG.md +30 -0
- package/dist/index.cjs +1567 -1077
- package/dist/index.d.cts +857 -135
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +857 -135
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1555 -1079
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +19 -17
- package/src/components/ds-autocomplete/ds-autocomplete.module.scss +0 -1
- package/src/components/ds-button/versions/ds-button-new/ds-button-new.module.scss +25 -9
- package/src/components/ds-button/versions/ds-button-new/ds-button-new.tsx +5 -5
- package/src/components/ds-button/versions/ds-button-new/ds-button-new.types.ts +11 -1
- package/src/components/ds-button/versions/ds-button-new/index.ts +4 -1
- package/src/components/ds-button-v3/ds-button-v3.module.scss +391 -0
- package/src/components/ds-button-v3/ds-button-v3.tsx +55 -0
- package/src/components/ds-button-v3/ds-button-v3.types.ts +58 -0
- package/src/components/ds-button-v3/index.ts +6 -0
- package/src/components/ds-comment-card/ds-comment-card.module.scss +2 -2
- package/src/components/ds-comments-drawer/components/comments-filter-modal/comments-filter-modal.tsx +1 -1
- package/src/components/ds-comments-drawer/ds-comments-drawer.tsx +3 -9
- package/src/components/ds-date-picker/ds-date-picker.module.scss +10 -0
- package/src/components/ds-date-picker/ds-date-picker.tsx +4 -2
- package/src/components/ds-date-range-picker/ds-date-range-picker.tsx +2 -2
- package/src/components/ds-drawer/ds-drawer.tsx +6 -9
- package/src/components/ds-drawer/ds-drawer.types.ts +4 -2
- package/src/components/ds-form-control/ds-form-control.tsx +2 -3
- package/src/components/ds-panel/ds-panel.module.scss +4 -1
- package/src/components/ds-panel/ds-panel.tsx +8 -3
- package/src/components/ds-panel/ds-panel.types.ts +8 -1
- package/src/components/ds-panel/index.ts +4 -1
- package/src/components/ds-select/ds-select.module.scss +4 -1
- package/src/components/ds-split-button/ds-split-button.module.scss +99 -0
- package/src/components/ds-split-button/ds-split-button.tsx +49 -0
- package/src/components/ds-split-button/ds-split-button.types.ts +25 -0
- package/src/components/ds-split-button/index.ts +10 -0
- package/src/components/ds-stack/ds-stack.module.scss +4 -0
- package/src/components/ds-stack/ds-stack.tsx +35 -0
- package/src/components/ds-stack/ds-stack.types.ts +19 -0
- package/src/components/ds-stack/index.ts +18 -0
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.tsx +2 -2
- package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.module.scss +5 -8
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.tsx +7 -4
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.types.ts +6 -0
- package/src/components/ds-table/ds-table.module.scss +6 -0
- package/src/components/ds-table/ds-table.tsx +3 -0
- package/src/components/ds-time-picker/ds-time-picker.module.scss +11 -0
- package/src/components/ds-time-picker/ds-time-picker.tsx +32 -12
- package/src/components/ds-time-picker/ds-time-picker.types.ts +6 -0
- package/src/components/ds-tree/ds-tree.types.ts +2 -2
- package/src/index.ts +4 -0
- package/src/styles/_breakpoints.module.scss +5 -0
- package/src/styles/_grid.scss +5 -1
- package/src/styles/_mixin.scss +2 -2
- package/src/styles/_responsive.scss +13 -0
- package/src/styles/_root_updated.scss +20 -20
- package/src/styles/_scrollbars.scss +6 -1
- package/src/styles/_variables.scss +2 -0
- package/src/styles/shared/_button.scss +2 -0
- package/src/styles/shared/_input.scss +3 -40
- package/src/utils/responsive.browser.test.ts +94 -0
- package/src/utils/responsive.ts +79 -0
- package/src/utils/responsive.unit.test.ts +54 -0
- package/src/utils/type-utils.ts +1 -0
- package/src/utils/use-controlled.browser.test.ts +6 -6
- package/src/utils/use-controlled.ts +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { BREAKPOINT_LG, isResponsiveValue, resolveResponsiveValue } from './responsive';
|
|
4
|
+
|
|
5
|
+
describe('BREAKPOINT_LG', () => {
|
|
6
|
+
it('should be sourced from the SCSS variable and equal 1440', () => {
|
|
7
|
+
expect(BREAKPOINT_LG).toBe(1440);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
describe('isResponsiveValue', () => {
|
|
12
|
+
it('should return true for a responsive object', () => {
|
|
13
|
+
expect(isResponsiveValue({ lg: 'large', md: 'small' })).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should return false for a string', () => {
|
|
17
|
+
expect(isResponsiveValue('large')).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should return false for null', () => {
|
|
21
|
+
expect(isResponsiveValue(null as unknown as string)).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should return true for an object with only lg', () => {
|
|
25
|
+
expect(isResponsiveValue({ lg: 'large' })).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should return true for an object with only md', () => {
|
|
29
|
+
expect(isResponsiveValue({ md: 'small' })).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('resolveResponsiveValue', () => {
|
|
34
|
+
it('should return static value unchanged for both breakpoints', () => {
|
|
35
|
+
expect(resolveResponsiveValue('large', 'lg')).toBe('large');
|
|
36
|
+
expect(resolveResponsiveValue('large', 'md')).toBe('large');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should resolve lg value from responsive object', () => {
|
|
40
|
+
expect(resolveResponsiveValue({ lg: 'large', md: 'small' }, 'lg')).toBe('large');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should resolve md value from responsive object', () => {
|
|
44
|
+
expect(resolveResponsiveValue({ lg: 'large', md: 'small' }, 'md')).toBe('small');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should fall back to lg when md is not specified', () => {
|
|
48
|
+
expect(resolveResponsiveValue({ lg: 'large' }, 'md')).toBe('large');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should fall back to md when lg is not specified', () => {
|
|
52
|
+
expect(resolveResponsiveValue({ md: 'small' }, 'lg')).toBe('small');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
@@ -13,8 +13,8 @@ describe('useControlled', () => {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
it('should call the provided setValue', async () => {
|
|
16
|
-
const setValue = vi.fn();
|
|
17
|
-
const { result, act } = await renderHook(() => useControlled
|
|
16
|
+
const setValue = vi.fn(() => {});
|
|
17
|
+
const { result, act } = await renderHook(() => useControlled('hello', setValue, ''));
|
|
18
18
|
|
|
19
19
|
await act(() => {
|
|
20
20
|
result.current[1]('world');
|
|
@@ -33,13 +33,13 @@ describe('useControlled', () => {
|
|
|
33
33
|
|
|
34
34
|
describe('uncontrolled mode', () => {
|
|
35
35
|
it('should use defaultValue as the initial value', async () => {
|
|
36
|
-
const { result } = await renderHook(() => useControlled
|
|
36
|
+
const { result } = await renderHook(() => useControlled(undefined, undefined, 'fallback'));
|
|
37
37
|
|
|
38
38
|
expect(result.current[0]).toBe('fallback');
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it('should update internal state via the setter', async () => {
|
|
42
|
-
const { result, act } = await renderHook(() => useControlled
|
|
42
|
+
const { result, act } = await renderHook(() => useControlled(undefined, undefined, 'fallback'));
|
|
43
43
|
|
|
44
44
|
expect(result.current[0]).toBe('fallback');
|
|
45
45
|
|
|
@@ -63,8 +63,8 @@ describe('useControlled', () => {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('should treat setValue-only (no value) as uncontrolled', async () => {
|
|
66
|
-
const setValue = vi.fn();
|
|
67
|
-
const { result, act } = await renderHook(() => useControlled
|
|
66
|
+
const setValue = vi.fn(() => {});
|
|
67
|
+
const { result, act } = await renderHook(() => useControlled(undefined, setValue, 'default'));
|
|
68
68
|
|
|
69
69
|
expect(result.current[0]).toBe('default');
|
|
70
70
|
|
|
@@ -10,7 +10,7 @@ export const useControlled = <T>(
|
|
|
10
10
|
defaultValue: T,
|
|
11
11
|
) => {
|
|
12
12
|
const isControlled = value !== undefined && setValue !== undefined;
|
|
13
|
-
const [internalValue, setInternalValue] = useState
|
|
13
|
+
const [internalValue, setInternalValue] = useState(value ?? defaultValue);
|
|
14
14
|
const resolvedValue = isControlled ? value : internalValue;
|
|
15
15
|
const resolvedSetValue = isControlled ? setValue : setInternalValue;
|
|
16
16
|
|