@drivenets/design-system 0.6.1 → 0.7.0
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 +27 -0
- package/dist/index.cjs +12394 -8354
- package/dist/index.d.cts +806 -118
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +806 -118
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12376 -8357
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +25 -23
- package/src/components/ds-autocomplete/ds-autocomplete.module.scss +2 -1
- package/src/components/ds-autocomplete/ds-autocomplete.tsx +47 -40
- package/src/components/ds-autocomplete/ds-autocomplete.types.tsx +37 -14
- package/src/components/ds-button/versions/ds-button-new/ds-button-new.module.scss +3 -7
- package/src/components/ds-comment-bubble/components/ds-comment-thread/ds-comment-thread.module.scss +62 -0
- package/src/components/ds-comment-bubble/components/ds-comment-thread/ds-comment-thread.tsx +83 -0
- package/src/components/ds-comment-bubble/components/ds-comment-thread/ds-comment-thread.types.ts +12 -0
- package/src/components/ds-comment-bubble/components/ds-comment-thread/index.ts +2 -0
- package/src/components/ds-comment-bubble/components/ds-thread-item/ds-thread-item.module.scss +149 -0
- package/src/components/ds-comment-bubble/components/ds-thread-item/ds-thread-item.tsx +147 -0
- package/src/components/ds-comment-bubble/components/ds-thread-item/ds-thread-item.types.ts +15 -0
- package/src/components/ds-comment-bubble/components/ds-thread-item/index.ts +2 -0
- package/src/components/ds-comment-bubble/ds-comment-bubble.module.scss +298 -0
- package/src/components/ds-comment-bubble/ds-comment-bubble.tsx +241 -0
- package/src/components/ds-comment-bubble/ds-comment-bubble.types.ts +27 -0
- package/src/components/ds-comment-bubble/hooks/index.ts +3 -0
- package/src/components/ds-comment-bubble/hooks/use-auto-resize.ts +17 -0
- package/src/components/ds-comment-bubble/hooks/use-click-outside.ts +22 -0
- package/src/components/ds-comment-bubble/hooks/use-scroll-overflow.ts +27 -0
- package/src/components/ds-comment-bubble/index.ts +6 -0
- package/src/components/ds-comment-card/ds-comment-card.module.scss +162 -0
- package/src/components/ds-comment-card/ds-comment-card.tsx +171 -0
- package/src/components/ds-comment-card/ds-comment-card.types.ts +45 -0
- package/src/components/ds-comment-card/index.ts +2 -0
- package/src/components/ds-comment-indicator/ds-comment-indicator.module.scss +65 -0
- package/src/components/ds-comment-indicator/ds-comment-indicator.tsx +48 -0
- package/src/components/ds-comment-indicator/ds-comment-indicator.types.ts +13 -0
- package/src/components/ds-comment-indicator/index.ts +2 -0
- package/src/components/ds-comments-drawer/comments-filters.test.ts +483 -0
- package/src/components/ds-comments-drawer/comments-filters.ts +134 -0
- package/src/components/ds-comments-drawer/comments-filters.types.ts +14 -0
- package/src/components/ds-comments-drawer/components/comments-filter-modal/comments-filter-modal.module.scss +92 -0
- package/src/components/ds-comments-drawer/components/comments-filter-modal/comments-filter-modal.tsx +219 -0
- package/src/components/ds-comments-drawer/components/comments-filter-modal/comments-filter-modal.types.ts +12 -0
- package/src/components/ds-comments-drawer/components/comments-filter-modal/index.ts +2 -0
- package/src/components/ds-comments-drawer/ds-comments-drawer.module.scss +67 -0
- package/src/components/ds-comments-drawer/ds-comments-drawer.tsx +215 -0
- package/src/components/ds-comments-drawer/ds-comments-drawer.types.ts +23 -0
- package/src/components/ds-comments-drawer/index.ts +3 -0
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.tsx +2 -0
- package/src/components/ds-expandable-text-input/ds-expandable-text-input.tsx +8 -4
- package/src/components/ds-file-upload/types/accept-types.ts +0 -1
- package/src/components/ds-filter-status-icon/ds-filter-status-icon.module.scss +19 -0
- package/src/components/ds-filter-status-icon/ds-filter-status-icon.tsx +35 -0
- package/src/components/ds-filter-status-icon/ds-filter-status-icon.types.ts +31 -0
- package/src/components/ds-filter-status-icon/index.ts +3 -0
- package/src/components/ds-icon/custom-icons/index.ts +10 -0
- package/src/components/ds-icon/custom-icons/special-failed.tsx +16 -0
- package/src/components/ds-icon/custom-icons/special-paused.tsx +16 -0
- package/src/components/ds-icon/custom-icons/special-running.tsx +16 -0
- package/src/components/ds-icon/custom-icons/special-warning.tsx +16 -0
- package/src/components/ds-panel/ds-panel.module.scss +3 -3
- package/src/components/ds-progress-arc/ds-progress-arc.module.scss +57 -0
- package/src/components/ds-progress-arc/ds-progress-arc.tsx +111 -0
- package/src/components/ds-progress-arc/ds-progress-arc.types.ts +34 -0
- package/src/components/ds-progress-arc/index.ts +3 -0
- package/src/components/ds-progress-arc/utils.test.ts +79 -0
- package/src/components/ds-progress-arc/utils.ts +61 -0
- package/src/components/ds-progress-donut/ds-progress-donut.module.scss +67 -0
- package/src/components/ds-progress-donut/ds-progress-donut.tsx +83 -0
- package/src/components/ds-progress-donut/ds-progress-donut.types.ts +38 -0
- package/src/components/ds-progress-donut/index.ts +2 -0
- package/src/components/ds-progress-donut/utils.ts +1 -0
- package/src/components/ds-progress-linear/ds-progress-linear.module.scss +100 -0
- package/src/components/ds-progress-linear/ds-progress-linear.tsx +107 -0
- package/src/components/ds-progress-linear/ds-progress-linear.types.ts +72 -0
- package/src/components/ds-progress-linear/index.ts +2 -0
- package/src/components/ds-progress-linear/utils.test.ts +70 -0
- package/src/components/ds-progress-linear/utils.ts +7 -0
- package/src/components/ds-radio-group/ds-radio-group.tsx +2 -0
- package/src/components/ds-select/ds-select.tsx +2 -1
- package/src/components/ds-select/ds-select.types.tsx +7 -0
- package/src/components/ds-stepper/components/ds-step.tsx +1 -1
- package/src/components/ds-stepper/ds-stepper.module.scss +16 -2
- package/src/components/ds-stepper/ds-stepper.tsx +3 -1
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.module.scss +9 -0
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.tsx +137 -0
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.types.ts +22 -0
- package/src/components/ds-table/components/ds-table-body-virtualized/index.ts +2 -0
- package/src/components/ds-table/components/ds-table-cell/ds-table-cell.module.scss +3 -1
- package/src/components/ds-table/components/ds-table-header/ds-table-header.module.scss +7 -10
- package/src/components/ds-table/components/ds-table-header/ds-table-header.tsx +3 -4
- package/src/components/ds-table/components/ds-table-row/ds-table-row.module.scss +13 -53
- package/src/components/ds-table/components/ds-table-row/ds-table-row.tsx +32 -85
- package/src/components/ds-table/components/ds-table-row/ds-table-row.types.ts +0 -6
- package/src/components/ds-table/components/ds-table-row-expandable-cell/ds-table-row-expandable-cell.module.scss +10 -0
- package/src/components/ds-table/components/ds-table-row-expandable-cell/ds-table-row-expandable-cell.tsx +45 -0
- package/src/components/ds-table/components/ds-table-row-expandable-cell/ds-table-row-expandable-cell.types.ts +7 -0
- package/src/components/ds-table/components/ds-table-row-expandable-cell/index.ts +2 -0
- package/src/components/ds-table/components/ds-table-row-selectable-cell/ds-table-row-selectable-cell.module.scss +6 -0
- package/src/components/ds-table/components/ds-table-row-selectable-cell/ds-table-row-selectable-cell.tsx +30 -0
- package/src/components/ds-table/components/ds-table-row-selectable-cell/ds-table-row-selectable-cell.types.ts +6 -0
- package/src/components/ds-table/components/ds-table-row-selectable-cell/index.ts +2 -0
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.module.scss +80 -0
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.tsx +95 -0
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.types.ts +11 -0
- package/src/components/ds-table/components/ds-table-row-virtualized/index.ts +2 -0
- package/src/components/ds-table/context/ds-table-context.tsx +0 -9
- package/src/components/ds-table/ds-table.module.scss +4 -17
- package/src/components/ds-table/ds-table.tsx +44 -77
- package/src/components/ds-table/ds-table.types.ts +57 -12
- package/src/components/ds-table/index.ts +1 -0
- package/src/components/ds-table/styles/_mixins.scss +15 -0
- package/src/components/ds-table/styles/_variables.scss +2 -2
- package/src/components/ds-table/utils/{column-styling.ts → column-size.ts} +4 -14
- package/src/components/ds-table/utils/constants.ts +4 -0
- package/src/components/ds-tag/index.tsx +1 -0
- package/src/components/ds-tag-filter/ds-tag-filter.module.scss +13 -15
- package/src/components/ds-tag-filter/ds-tag-filter.tsx +38 -72
- package/src/components/ds-tag-filter/ds-tag-filter.types.ts +2 -3
- package/src/components/ds-tag-filter/hooks/use-tag-overflow-calculation.ts +12 -62
- package/src/components/ds-tag-filter/utils.test.ts +2 -108
- package/src/components/ds-tag-filter/utils.ts +2 -12
- package/src/components/ds-tree/ds-tree.module.scss +283 -0
- package/src/components/ds-tree/ds-tree.tsx +172 -0
- package/src/components/ds-tree/ds-tree.types.ts +83 -0
- package/src/components/ds-tree/ds-tree.utils.ts +11 -0
- package/src/components/ds-tree/index.ts +3 -0
- package/src/index.ts +9 -0
- package/src/utils/format-relative-time.test.ts +74 -0
- package/src/utils/format-relative-time.ts +52 -0
- package/src/utils/numbers.test.ts +24 -0
- package/src/utils/numbers.ts +1 -0
- package/src/components/ds-table/utils/create-columns-grid-template.ts +0 -23
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const SECONDS_PER_MINUTE = 60;
|
|
2
|
+
const MINUTES_PER_HOUR = 60;
|
|
3
|
+
const HOURS_PER_DAY = 24;
|
|
4
|
+
const DAYS_PER_WEEK = 7;
|
|
5
|
+
const DAYS_PER_MONTH = 30;
|
|
6
|
+
const MONTHS_PER_YEAR = 12;
|
|
7
|
+
const MS_PER_SECOND = 1000;
|
|
8
|
+
|
|
9
|
+
const JUST_NOW_THRESHOLD_SECONDS = 60;
|
|
10
|
+
|
|
11
|
+
export const formatRelativeTime = (date: Date): string => {
|
|
12
|
+
const now = new Date();
|
|
13
|
+
const diffMs = now.getTime() - date.getTime();
|
|
14
|
+
|
|
15
|
+
if (diffMs < 0) {
|
|
16
|
+
return 'Just now';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const diffSeconds = Math.floor(diffMs / MS_PER_SECOND);
|
|
20
|
+
const diffMinutes = Math.floor(diffSeconds / SECONDS_PER_MINUTE);
|
|
21
|
+
const diffHours = Math.floor(diffMinutes / MINUTES_PER_HOUR);
|
|
22
|
+
const diffDays = Math.floor(diffHours / HOURS_PER_DAY);
|
|
23
|
+
const diffWeeks = Math.floor(diffDays / DAYS_PER_WEEK);
|
|
24
|
+
const diffMonths = Math.floor(diffDays / DAYS_PER_MONTH);
|
|
25
|
+
const diffYears = Math.floor(diffMonths / MONTHS_PER_YEAR);
|
|
26
|
+
|
|
27
|
+
if (diffSeconds < JUST_NOW_THRESHOLD_SECONDS) {
|
|
28
|
+
return 'Just now';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (diffMinutes < MINUTES_PER_HOUR) {
|
|
32
|
+
return `${String(diffMinutes)}m ago`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (diffHours < HOURS_PER_DAY) {
|
|
36
|
+
return `${String(diffHours)}h ago`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (diffDays < DAYS_PER_WEEK) {
|
|
40
|
+
return `${String(diffDays)}d ago`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (diffWeeks < 4) {
|
|
44
|
+
return `${String(diffWeeks)}w ago`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (diffYears >= 1) {
|
|
48
|
+
return `${String(diffYears)}y ago`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return `${String(diffMonths)}mo ago`;
|
|
52
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { clampValue } from './numbers';
|
|
4
|
+
|
|
5
|
+
describe('progress-utils', () => {
|
|
6
|
+
describe('clampValue', () => {
|
|
7
|
+
it('should return value within 0-100 unchanged', () => {
|
|
8
|
+
expect(clampValue(50)).toBe(50);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should clamp value below 0 to 0', () => {
|
|
12
|
+
expect(clampValue(-10)).toBe(0);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should clamp value above 100 to 100', () => {
|
|
16
|
+
expect(clampValue(150)).toBe(100);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should handle boundary values', () => {
|
|
20
|
+
expect(clampValue(0)).toBe(0);
|
|
21
|
+
expect(clampValue(100)).toBe(100);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const clampValue = (value: number): number => Math.min(100, Math.max(0, value));
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ColumnDef } from '@tanstack/react-table';
|
|
2
|
-
|
|
3
|
-
type Args = {
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
-
columns: ColumnDef<any, any>[];
|
|
6
|
-
selectable?: boolean;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// In virtualized tables, the rows should all be positioned at the top with a `translateY` offset.
|
|
10
|
-
// We're using a Grid for this rather than `position: absolute` to ensure that each cell aligns with
|
|
11
|
-
// other cells in the same column (mimicking the native table behavior).
|
|
12
|
-
export function createColumnsGridTemplate({ columns, selectable }: Args): string {
|
|
13
|
-
return columns
|
|
14
|
-
.reduce<string[]>(
|
|
15
|
-
(acc, col) => {
|
|
16
|
-
acc.push(col.size ? `${String(col.size)}px` : 'auto');
|
|
17
|
-
|
|
18
|
-
return acc;
|
|
19
|
-
},
|
|
20
|
-
selectable ? ['max-content'] : [],
|
|
21
|
-
)
|
|
22
|
-
.join(' ');
|
|
23
|
-
}
|