@drivenets/design-system 0.7.3 → 0.9.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 +47 -0
- package/dist/index.cjs +5730 -4569
- package/dist/index.d.cts +1768 -1065
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1768 -1065
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5718 -4577
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +14 -14
- package/src/components/ds-autocomplete/ds-autocomplete.module.scss +1 -2
- package/src/components/ds-autocomplete/ds-autocomplete.tsx +13 -8
- package/src/components/ds-autocomplete/ds-autocomplete.types.ts +2 -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 +49 -0
- package/src/components/ds-button-v3/index.ts +2 -0
- package/src/components/ds-comment-bubble/ds-comment-bubble.module.scss +6 -2
- package/src/components/ds-comment-bubble/ds-comment-bubble.tsx +22 -15
- package/src/components/ds-comment-bubble/ds-comment-bubble.types.ts +1 -0
- 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-input/ds-date-input.tsx +3 -4
- package/src/components/ds-date-input/ds-date-input.types.ts +3 -1
- package/src/components/ds-date-input/index.ts +10 -0
- package/src/components/ds-date-picker/components/calendar-table.module.scss +93 -0
- package/src/components/ds-date-picker/components/calendar-view-control/calendar-view-control.module.scss +48 -0
- package/src/components/ds-date-picker/components/calendar-view-control/calendar-view-control.tsx +20 -0
- package/src/components/ds-date-picker/components/calendar-view-control/index.ts +1 -0
- package/src/components/ds-date-picker/components/day-view/day-view.module.scss +12 -0
- package/src/components/ds-date-picker/components/day-view/day-view.tsx +45 -0
- package/src/components/ds-date-picker/components/day-view/index.ts +1 -0
- package/src/components/ds-date-picker/components/month-view/index.ts +1 -0
- package/src/components/ds-date-picker/components/month-view/month-view.module.scss +4 -0
- package/src/components/ds-date-picker/components/month-view/month-view.tsx +35 -0
- package/src/components/ds-date-picker/components/year-view/index.ts +1 -0
- package/src/components/ds-date-picker/components/year-view/year-view.module.scss +4 -0
- package/src/components/ds-date-picker/components/year-view/year-view.tsx +35 -0
- package/src/components/ds-date-picker/ds-date-picker.module.scss +29 -0
- package/src/components/ds-date-picker/ds-date-picker.tsx +211 -0
- package/src/components/ds-date-picker/ds-date-picker.types.ts +94 -0
- package/src/components/ds-date-picker/ds-date-picker.utils.ts +87 -0
- package/src/components/ds-date-picker/ds-date-picker.utils.unit.test.ts +226 -0
- package/src/components/ds-date-picker/index.ts +2 -0
- package/src/components/ds-date-range-picker/ds-date-range-picker.module.scss +20 -0
- package/src/components/ds-date-range-picker/ds-date-range-picker.tsx +101 -0
- package/src/components/ds-date-range-picker/ds-date-range-picker.types.ts +95 -0
- package/src/components/ds-date-range-picker/ds-date-range-picker.utils.ts +19 -0
- package/src/components/ds-date-range-picker/ds-date-range-picker.utils.unit.test.ts +48 -0
- package/src/components/ds-date-range-picker/index.ts +9 -0
- 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-file-upload/ds-file-upload-api.types.ts +1 -0
- package/src/components/ds-file-upload/hooks/use-file-upload.ts +1 -1
- package/src/components/ds-file-upload/index.ts +6 -1
- package/src/components/ds-file-upload/utils/file-factory.ts +1 -0
- package/src/components/ds-file-upload/utils/file-factory.unit.test.ts +37 -0
- package/src/components/ds-form-control/ds-form-control.tsx +7 -3
- package/src/components/ds-key-value-pair/ds-key-value-pair.module.scss +72 -0
- package/src/components/ds-key-value-pair/ds-key-value-pair.tsx +47 -0
- package/src/components/ds-key-value-pair/ds-key-value-pair.types.ts +24 -0
- package/src/components/ds-key-value-pair/index.ts +3 -0
- package/src/components/ds-loader/ds-loader.tsx +1 -1
- 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-status-badge/ds-status-badge.module.scss +1 -1
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.tsx +6 -4
- package/src/components/ds-table/components/ds-table-bulk-actions/ds-table-bulk-actions.module.scss +5 -8
- 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/components/time-item/index.ts +1 -0
- package/src/components/ds-time-picker/components/time-item/time-item.module.scss +37 -0
- package/src/components/ds-time-picker/components/time-item/time-item.tsx +26 -0
- package/src/components/ds-time-picker/components/time-item/time-item.types.ts +10 -0
- package/src/components/ds-time-picker/components/time-scroller/index.ts +2 -0
- package/src/components/ds-time-picker/components/time-scroller/time-scroller.module.scss +25 -0
- package/src/components/ds-time-picker/components/time-scroller/time-scroller.tsx +61 -0
- package/src/components/ds-time-picker/components/time-scroller/time-scroller.types.ts +17 -0
- package/src/components/ds-time-picker/components/time-scroller/time-scroller.utils.ts +44 -0
- package/src/components/ds-time-picker/ds-time-picker.module.scss +11 -0
- package/src/components/ds-time-picker/ds-time-picker.tsx +178 -0
- package/src/components/ds-time-picker/ds-time-picker.types.ts +54 -0
- package/src/components/ds-time-picker/ds-time-picker.utils.ts +176 -0
- package/src/components/ds-time-picker/ds-time-picker.utils.unit.test.ts +316 -0
- package/src/components/ds-time-picker/index.ts +3 -0
- package/src/components/ds-tooltip/ds-tooltip.module.scss +1 -7
- package/src/components/ds-tooltip/ds-tooltip.tsx +9 -9
- package/src/components/ds-tooltip/ds-tooltip.types.ts +7 -1
- package/src/index.ts +8 -0
- package/src/styles/_breakpoints.module.scss +5 -0
- package/src/styles/_responsive.scss +13 -0
- package/src/styles/_root_updated.scss +593 -0
- package/src/styles/_variables.scss +2 -0
- package/src/styles/shared/_button.scss +2 -0
- package/src/styles/shared/_dropdown.scss +4 -1
- 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 +79 -0
- package/src/utils/use-controlled.ts +18 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { DsIcon, type IconSize } from '../ds-icon';
|
|
3
|
+
import { DsSpinner } from '../ds-spinner';
|
|
4
|
+
import styles from './ds-button-v3.module.scss';
|
|
5
|
+
import type { ButtonV3Size, DsButtonV3Props } from './ds-button-v3.types.ts';
|
|
6
|
+
|
|
7
|
+
const iconSizeMap: Record<ButtonV3Size, IconSize> = Object.freeze({
|
|
8
|
+
large: 'small',
|
|
9
|
+
medium: 'tiny',
|
|
10
|
+
small: 'tiny',
|
|
11
|
+
tiny: 'tiny',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const DsButtonV3 = ({
|
|
15
|
+
ref,
|
|
16
|
+
className,
|
|
17
|
+
style,
|
|
18
|
+
children,
|
|
19
|
+
icon,
|
|
20
|
+
disabled,
|
|
21
|
+
loading = false,
|
|
22
|
+
color = 'default',
|
|
23
|
+
variant = 'primary',
|
|
24
|
+
size = 'medium',
|
|
25
|
+
selected = false,
|
|
26
|
+
type = 'button',
|
|
27
|
+
...rest
|
|
28
|
+
}: DsButtonV3Props) => {
|
|
29
|
+
const isIconOnly = icon !== undefined && !children;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<button
|
|
33
|
+
ref={ref}
|
|
34
|
+
// eslint-disable-next-line react/button-has-type -- Dynamic by nature of this component
|
|
35
|
+
type={type}
|
|
36
|
+
disabled={disabled || loading}
|
|
37
|
+
aria-busy={loading || undefined}
|
|
38
|
+
aria-pressed={selected}
|
|
39
|
+
className={classNames(styles.root, className)}
|
|
40
|
+
style={style}
|
|
41
|
+
data-color={color}
|
|
42
|
+
data-variant={variant}
|
|
43
|
+
data-size={size}
|
|
44
|
+
data-selected={selected ? 'true' : undefined}
|
|
45
|
+
data-icon-only={isIconOnly || undefined}
|
|
46
|
+
data-loading={loading && !disabled ? '' : undefined}
|
|
47
|
+
{...rest}
|
|
48
|
+
>
|
|
49
|
+
{loading ? <DsSpinner /> : icon && <DsIcon icon={icon} size={iconSizeMap[size]} aria-hidden />}
|
|
50
|
+
{children}
|
|
51
|
+
</button>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default DsButtonV3;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, Ref } from 'react';
|
|
2
|
+
import type { IconType } from '../ds-icon';
|
|
3
|
+
|
|
4
|
+
export const buttonV3Variants = ['primary', 'secondary', 'tertiary'] as const;
|
|
5
|
+
export type ButtonV3Variant = (typeof buttonV3Variants)[number];
|
|
6
|
+
|
|
7
|
+
export const buttonV3Colors = ['default', 'negative', 'light'] as const;
|
|
8
|
+
export type ButtonV3Color = (typeof buttonV3Colors)[number];
|
|
9
|
+
|
|
10
|
+
export const buttonV3Sizes = ['large', 'medium', 'small', 'tiny'] as const;
|
|
11
|
+
export type ButtonV3Size = (typeof buttonV3Sizes)[number];
|
|
12
|
+
|
|
13
|
+
export interface DsButtonV3Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
14
|
+
ref?: Ref<HTMLButtonElement>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* - `default` — standard light-UI palette
|
|
18
|
+
* - `negative` — destructive / danger palette (red tones)
|
|
19
|
+
* - `light` — palette for dark-background surfaces (Figma **Type** onDark)
|
|
20
|
+
* @default 'default'
|
|
21
|
+
*/
|
|
22
|
+
color?: ButtonV3Color;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @default 'primary'
|
|
26
|
+
*/
|
|
27
|
+
variant?: ButtonV3Variant;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @default 'medium'
|
|
31
|
+
*/
|
|
32
|
+
size?: ButtonV3Size;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
selected?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Leading icon. When set without children, renders as icon-only (square) layout.
|
|
41
|
+
*/
|
|
42
|
+
icon?: IconType;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Shows a spinner as the leading element and disables interaction.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
}
|
|
@@ -62,7 +62,7 @@ $transition-duration: 0.2s;
|
|
|
62
62
|
resize: none;
|
|
63
63
|
|
|
64
64
|
&::placeholder {
|
|
65
|
-
color: var(--color-font-
|
|
65
|
+
color: var(--color-font-disabled);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -199,7 +199,7 @@ $transition-duration: 0.2s;
|
|
|
199
199
|
overflow-y: auto;
|
|
200
200
|
|
|
201
201
|
&::placeholder {
|
|
202
|
-
color: var(--color-font-
|
|
202
|
+
color: var(--color-font-disabled);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
&:focus {
|
|
@@ -225,6 +225,10 @@ $transition-duration: 0.2s;
|
|
|
225
225
|
align-items: center;
|
|
226
226
|
justify-content: space-between;
|
|
227
227
|
padding: var(--spacing-xs) 0;
|
|
228
|
+
|
|
229
|
+
> :last-child {
|
|
230
|
+
margin-left: auto;
|
|
231
|
+
}
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
.sendButton {
|
|
@@ -15,6 +15,7 @@ export const DsCommentBubble = ({
|
|
|
15
15
|
ref,
|
|
16
16
|
comment,
|
|
17
17
|
currentUser,
|
|
18
|
+
hideActionRequired = false,
|
|
18
19
|
actionRequired = false,
|
|
19
20
|
onActionRequiredChange,
|
|
20
21
|
value = '',
|
|
@@ -96,7 +97,7 @@ export const DsCommentBubble = ({
|
|
|
96
97
|
className={classNames(
|
|
97
98
|
styles.bubble,
|
|
98
99
|
{
|
|
99
|
-
[styles.actionRequired]: actionRequired,
|
|
100
|
+
[styles.actionRequired]: !hideActionRequired && actionRequired,
|
|
100
101
|
[styles.initial]: isInitialMode,
|
|
101
102
|
[styles.typing]: isTypingMode,
|
|
102
103
|
[styles.thread]: hasThread,
|
|
@@ -117,7 +118,9 @@ export const DsCommentBubble = ({
|
|
|
117
118
|
<div className={styles.headerInfo}>
|
|
118
119
|
<span className={styles.commentId}>#{comment.numericId}</span>
|
|
119
120
|
{renderReferenceTag()}
|
|
120
|
-
{
|
|
121
|
+
{!hideActionRequired && actionRequired && (
|
|
122
|
+
<span className={styles.actionRequiredBadge}>Action required</span>
|
|
123
|
+
)}
|
|
121
124
|
</div>
|
|
122
125
|
</div>
|
|
123
126
|
|
|
@@ -130,9 +133,11 @@ export const DsCommentBubble = ({
|
|
|
130
133
|
</DsButton>
|
|
131
134
|
</DsDropdownMenu.Trigger>
|
|
132
135
|
<DsDropdownMenu.Content className={styles.dropdownContent}>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
{!hideActionRequired && (
|
|
137
|
+
<DsDropdownMenu.Item value="toggle-action" onClick={onToggleActionRequired}>
|
|
138
|
+
{actionRequired ? 'Remove action requirement' : 'Require action'}
|
|
139
|
+
</DsDropdownMenu.Item>
|
|
140
|
+
)}
|
|
136
141
|
<DsDropdownMenu.Item value="forward" onClick={onForward}>
|
|
137
142
|
Forward
|
|
138
143
|
</DsDropdownMenu.Item>
|
|
@@ -205,8 +210,8 @@ export const DsCommentBubble = ({
|
|
|
205
210
|
{(isInitialMode || hasThread) && (
|
|
206
211
|
<DsButton
|
|
207
212
|
design="v1.2"
|
|
208
|
-
buttonType="
|
|
209
|
-
size="
|
|
213
|
+
buttonType="primary"
|
|
214
|
+
size="small"
|
|
210
215
|
disabled={!hasContent}
|
|
211
216
|
onClick={handleSend}
|
|
212
217
|
aria-label="Send"
|
|
@@ -218,17 +223,19 @@ export const DsCommentBubble = ({
|
|
|
218
223
|
|
|
219
224
|
{showFooter && (
|
|
220
225
|
<div className={styles.footer}>
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
{!hideActionRequired && (
|
|
227
|
+
<DsCheckbox
|
|
228
|
+
variant="warning"
|
|
229
|
+
label="Action required"
|
|
230
|
+
checked={actionRequired}
|
|
231
|
+
onCheckedChange={(checked) => onActionRequiredChange?.(checked === true)}
|
|
232
|
+
/>
|
|
233
|
+
)}
|
|
227
234
|
|
|
228
235
|
<DsButton
|
|
229
236
|
design="v1.2"
|
|
230
|
-
buttonType="
|
|
231
|
-
size="
|
|
237
|
+
buttonType="primary"
|
|
238
|
+
size="small"
|
|
232
239
|
disabled={!hasContent}
|
|
233
240
|
onClick={handleSend}
|
|
234
241
|
aria-label="Send"
|
package/src/components/ds-comments-drawer/components/comments-filter-modal/comments-filter-modal.tsx
CHANGED
|
@@ -19,7 +19,7 @@ export const CommentsFilterModal = ({
|
|
|
19
19
|
availableAuthors,
|
|
20
20
|
availableLabels,
|
|
21
21
|
}: CommentsFilterModalProps) => {
|
|
22
|
-
const [selectedTab, setSelectedTab] = useState
|
|
22
|
+
const [selectedTab, setSelectedTab] = useState('statuses');
|
|
23
23
|
|
|
24
24
|
const handleStatusToggle = (status: 'unresolved' | 'resolved' | 'action-required', checked: boolean) => {
|
|
25
25
|
onFiltersChange({
|
|
@@ -7,13 +7,7 @@ import { DsButton } from '../ds-button';
|
|
|
7
7
|
import { DsIcon } from '../ds-icon';
|
|
8
8
|
import { DsTextInput } from '../ds-text-input';
|
|
9
9
|
import { DsTagFilter, type TagFilterItem } from '../ds-tag-filter';
|
|
10
|
-
import {
|
|
11
|
-
type CommentsFilterState,
|
|
12
|
-
initialFilterState,
|
|
13
|
-
applyFilters,
|
|
14
|
-
filtersToTags,
|
|
15
|
-
removeTag,
|
|
16
|
-
} from './comments-filters';
|
|
10
|
+
import { initialFilterState, applyFilters, filtersToTags, removeTag } from './comments-filters';
|
|
17
11
|
import { CommentsFilterModal } from './components/comments-filter-modal';
|
|
18
12
|
|
|
19
13
|
export const DsCommentsDrawer = ({
|
|
@@ -36,8 +30,8 @@ export const DsCommentsDrawer = ({
|
|
|
36
30
|
style,
|
|
37
31
|
}: DsCommentsDrawerProps) => {
|
|
38
32
|
const [isFilterModalOpen, setIsFilterModalOpen] = useState(false);
|
|
39
|
-
const [pendingFilters, setPendingFilters] = useState
|
|
40
|
-
const [appliedFilters, setAppliedFilters] = useState
|
|
33
|
+
const [pendingFilters, setPendingFilters] = useState(initialFilterState);
|
|
34
|
+
const [appliedFilters, setAppliedFilters] = useState(initialFilterState);
|
|
41
35
|
|
|
42
36
|
const authorsMap = new Map<string, string>();
|
|
43
37
|
const labelsSet = new Set<string>();
|
|
@@ -16,10 +16,9 @@ import { DsTypography } from '../ds-typography';
|
|
|
16
16
|
import styles from './ds-date-input.module.scss';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* Features built-in validation, manual text entry, and calendar selection.
|
|
19
|
+
* @deprecated DsDateInput is deprecated. Use DsDatePicker or DsDateRangePicker instead.
|
|
20
|
+
* @see {@link ../ds-date-picker} for single date selection.
|
|
21
|
+
* @see {@link ../ds-date-range-picker} for date range selection.
|
|
23
22
|
*/
|
|
24
23
|
const DsDateInput = ({
|
|
25
24
|
range = false,
|
|
@@ -105,6 +105,8 @@ type DsDateInputBaseProps = Pick<
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* @deprecated DsDateInput is deprecated. Use DsDatePicker or DsDateRangePicker instead.
|
|
109
|
+
* @see {@link ../ds-date-picker} for single date selection.
|
|
110
|
+
* @see {@link ../ds-date-range-picker} for date range selection.
|
|
109
111
|
*/
|
|
110
112
|
export type DsDateInputProps = DsDateInputBaseProps & DsDateInputRangeProps;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated DsDateInput is deprecated. Use DsDatePicker or DsDateRangePicker instead.
|
|
3
|
+
* @see {@link ../ds-date-picker} for single date selection.
|
|
4
|
+
* @see {@link ../ds-date-range-picker} for date range selection.
|
|
5
|
+
*/
|
|
1
6
|
export { default as DsDateInput } from './ds-date-input';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated These types are deprecated. Use DsDatePicker or DsDateRangePicker types instead.
|
|
9
|
+
* @see {@link ../ds-date-picker} for single date selection.
|
|
10
|
+
* @see {@link ../ds-date-range-picker} for date range selection.
|
|
11
|
+
*/
|
|
2
12
|
export type { DsDateInputProps } from './ds-date-input.types';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
.table {
|
|
2
|
+
width: 100%;
|
|
3
|
+
border-collapse: collapse;
|
|
4
|
+
|
|
5
|
+
.tableBody .tableRow .tableCellTrigger:focus-visible {
|
|
6
|
+
.tableCellTrigger {
|
|
7
|
+
outline: 2px solid var(--color-background-action-hover);
|
|
8
|
+
border-radius: var(--spacing-2xs);
|
|
9
|
+
border-width: 0;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tableHeader {
|
|
15
|
+
text-align: center;
|
|
16
|
+
padding: var(--spacing-2xs);
|
|
17
|
+
color: var(--color-font-secondary);
|
|
18
|
+
font-weight: var(--font-weight-medium);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.tableRow {
|
|
22
|
+
&:first-child {
|
|
23
|
+
.tableCellTrigger {
|
|
24
|
+
margin-top: var(--spacing-xs);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tableCellTrigger {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
user-select: none;
|
|
35
|
+
-webkit-tap-highlight-color: transparent;
|
|
36
|
+
outline: none;
|
|
37
|
+
border-radius: var(--spacing-xs);
|
|
38
|
+
color: var(--color-font-main);
|
|
39
|
+
margin: var(--spacing-3xs);
|
|
40
|
+
|
|
41
|
+
&:hover:not([data-disabled], [data-selected]) {
|
|
42
|
+
outline: 1px solid var(--color-border);
|
|
43
|
+
background: var(--color-background-action-hover-weak);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&[data-outside-range] {
|
|
47
|
+
color: var(--color-font-disabled);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&[data-selected] {
|
|
51
|
+
background: var(--color-background-selected);
|
|
52
|
+
color: var(--color-font-on-action);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&[data-today]:not([data-selected]):hover {
|
|
56
|
+
border-radius: var(--spacing-xs);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-today]:not([data-selected]) {
|
|
60
|
+
position: relative;
|
|
61
|
+
|
|
62
|
+
&::after {
|
|
63
|
+
content: '';
|
|
64
|
+
position: absolute;
|
|
65
|
+
width: 75%;
|
|
66
|
+
bottom: 4px;
|
|
67
|
+
border-bottom: 1px solid var(--color-background-brand);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&[data-today][data-selected] {
|
|
72
|
+
position: relative;
|
|
73
|
+
|
|
74
|
+
&::after {
|
|
75
|
+
content: '';
|
|
76
|
+
position: absolute;
|
|
77
|
+
width: 75%;
|
|
78
|
+
bottom: 4px;
|
|
79
|
+
border-bottom: 1px solid var(--color-background);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&[data-disabled] {
|
|
84
|
+
color: var(--color-font-disabled);
|
|
85
|
+
cursor: not-allowed;
|
|
86
|
+
opacity: 0.5;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&[data-unavailable] {
|
|
90
|
+
text-decoration: line-through;
|
|
91
|
+
opacity: 0.4;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.viewControl {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
align-items: center;
|
|
5
|
+
margin-bottom: var(--spacing-sm);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.viewTrigger {
|
|
9
|
+
flex: 1;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
background: transparent;
|
|
14
|
+
border: none;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
padding: var(--spacing-2xs) var(--spacing-xs);
|
|
17
|
+
border-radius: var(--spacing-2xs);
|
|
18
|
+
color: var(--color-font-main);
|
|
19
|
+
transition: background-color 0.2s;
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
background: var(--color-background-hover);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.prevTrigger,
|
|
27
|
+
.nextTrigger {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
background: transparent;
|
|
32
|
+
border: none;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
padding: var(--spacing-2xs);
|
|
35
|
+
border-radius: var(--spacing-2xs);
|
|
36
|
+
color: var(--color-font-secondary);
|
|
37
|
+
transition: all 0.2s;
|
|
38
|
+
|
|
39
|
+
&:hover {
|
|
40
|
+
background: var(--color-background-hover);
|
|
41
|
+
color: var(--color-font-main);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:disabled {
|
|
45
|
+
cursor: not-allowed;
|
|
46
|
+
opacity: 0.5;
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/components/ds-date-picker/components/calendar-view-control/calendar-view-control.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DatePicker } from '@ark-ui/react/date-picker';
|
|
2
|
+
import { DsIcon } from '../../../ds-icon';
|
|
3
|
+
import { DsTypography } from '../../../ds-typography';
|
|
4
|
+
import styles from './calendar-view-control.module.scss';
|
|
5
|
+
|
|
6
|
+
export const CalendarViewControl = () => (
|
|
7
|
+
<DatePicker.ViewControl className={styles.viewControl}>
|
|
8
|
+
<DatePicker.PrevTrigger className={styles.prevTrigger}>
|
|
9
|
+
<DsIcon icon="chevron_left" size="small" />
|
|
10
|
+
</DatePicker.PrevTrigger>
|
|
11
|
+
<DatePicker.ViewTrigger className={styles.viewTrigger}>
|
|
12
|
+
<DsTypography variant="body-md-md" asChild>
|
|
13
|
+
<DatePicker.RangeText />
|
|
14
|
+
</DsTypography>
|
|
15
|
+
</DatePicker.ViewTrigger>
|
|
16
|
+
<DatePicker.NextTrigger className={styles.nextTrigger}>
|
|
17
|
+
<DsIcon icon="chevron_right" size="small" />
|
|
18
|
+
</DatePicker.NextTrigger>
|
|
19
|
+
</DatePicker.ViewControl>
|
|
20
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calendar-view-control';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { DatePicker } from '@ark-ui/react/date-picker';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { DsTypography } from '../../../ds-typography';
|
|
4
|
+
import styles from './day-view.module.scss';
|
|
5
|
+
import tableStyles from '../calendar-table.module.scss';
|
|
6
|
+
import { CalendarViewControl } from '../calendar-view-control';
|
|
7
|
+
|
|
8
|
+
export const DayView = ({ children }: { children?: React.ReactNode }) => (
|
|
9
|
+
<DatePicker.View view="day">
|
|
10
|
+
<DatePicker.Context>
|
|
11
|
+
{(datePicker) => (
|
|
12
|
+
<div className={styles.dayView}>
|
|
13
|
+
<CalendarViewControl />
|
|
14
|
+
<DatePicker.Table className={tableStyles.table}>
|
|
15
|
+
<DatePicker.TableHead>
|
|
16
|
+
<DatePicker.TableRow className={tableStyles.tableRow}>
|
|
17
|
+
{datePicker.weekDays.map((weekDay, idx) => (
|
|
18
|
+
<DatePicker.TableHeader key={idx} className={tableStyles.tableHeader}>
|
|
19
|
+
<DsTypography variant="body-md-md">{weekDay.narrow}</DsTypography>
|
|
20
|
+
</DatePicker.TableHeader>
|
|
21
|
+
))}
|
|
22
|
+
</DatePicker.TableRow>
|
|
23
|
+
</DatePicker.TableHead>
|
|
24
|
+
<DatePicker.TableBody className={tableStyles.tableBody}>
|
|
25
|
+
{datePicker.weeks.map((week, weekIdx) => (
|
|
26
|
+
<DatePicker.TableRow key={weekIdx} className={tableStyles.tableRow}>
|
|
27
|
+
{week.map((day, dayIdx) => (
|
|
28
|
+
<DatePicker.TableCell key={dayIdx} value={day}>
|
|
29
|
+
<DatePicker.TableCellTrigger
|
|
30
|
+
className={classNames(tableStyles.tableCellTrigger, styles.trigger)}
|
|
31
|
+
>
|
|
32
|
+
<DsTypography variant="body-md-md">{day.day}</DsTypography>
|
|
33
|
+
</DatePicker.TableCellTrigger>
|
|
34
|
+
</DatePicker.TableCell>
|
|
35
|
+
))}
|
|
36
|
+
</DatePicker.TableRow>
|
|
37
|
+
))}
|
|
38
|
+
</DatePicker.TableBody>
|
|
39
|
+
</DatePicker.Table>
|
|
40
|
+
{children}
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
</DatePicker.Context>
|
|
44
|
+
</DatePicker.View>
|
|
45
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './day-view';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MonthView } from './month-view';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DatePicker } from '@ark-ui/react/date-picker';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { DsTypography } from '../../../ds-typography';
|
|
4
|
+
import styles from './month-view.module.scss';
|
|
5
|
+
import tableStyles from '../calendar-table.module.scss';
|
|
6
|
+
import { CalendarViewControl } from '../calendar-view-control';
|
|
7
|
+
|
|
8
|
+
export const MonthView = () => (
|
|
9
|
+
<DatePicker.View view="month">
|
|
10
|
+
<DatePicker.Context>
|
|
11
|
+
{(datePicker) => (
|
|
12
|
+
<>
|
|
13
|
+
<CalendarViewControl />
|
|
14
|
+
<DatePicker.Table className={tableStyles.table}>
|
|
15
|
+
<DatePicker.TableBody className={tableStyles.tableBody}>
|
|
16
|
+
{datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, rowIdx) => (
|
|
17
|
+
<DatePicker.TableRow key={rowIdx} className={tableStyles.tableRow}>
|
|
18
|
+
{months.map((month, monthIdx) => (
|
|
19
|
+
<DatePicker.TableCell key={monthIdx} value={month.value}>
|
|
20
|
+
<DatePicker.TableCellTrigger
|
|
21
|
+
className={classNames(tableStyles.tableCellTrigger, styles.trigger)}
|
|
22
|
+
>
|
|
23
|
+
<DsTypography variant="body-md-md">{month.label}</DsTypography>
|
|
24
|
+
</DatePicker.TableCellTrigger>
|
|
25
|
+
</DatePicker.TableCell>
|
|
26
|
+
))}
|
|
27
|
+
</DatePicker.TableRow>
|
|
28
|
+
))}
|
|
29
|
+
</DatePicker.TableBody>
|
|
30
|
+
</DatePicker.Table>
|
|
31
|
+
</>
|
|
32
|
+
)}
|
|
33
|
+
</DatePicker.Context>
|
|
34
|
+
</DatePicker.View>
|
|
35
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { YearView } from './year-view';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DatePicker } from '@ark-ui/react/date-picker';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { DsTypography } from '../../../ds-typography';
|
|
4
|
+
import styles from './year-view.module.scss';
|
|
5
|
+
import tableStyles from '../calendar-table.module.scss';
|
|
6
|
+
import { CalendarViewControl } from '../calendar-view-control';
|
|
7
|
+
|
|
8
|
+
export const YearView = () => (
|
|
9
|
+
<DatePicker.View view="year">
|
|
10
|
+
<DatePicker.Context>
|
|
11
|
+
{(datePicker) => (
|
|
12
|
+
<>
|
|
13
|
+
<CalendarViewControl />
|
|
14
|
+
<DatePicker.Table className={tableStyles.table}>
|
|
15
|
+
<DatePicker.TableBody className={tableStyles.tableBody}>
|
|
16
|
+
{datePicker.getYearsGrid({ columns: 4 }).map((years, rowIdx) => (
|
|
17
|
+
<DatePicker.TableRow key={rowIdx} className={tableStyles.tableRow}>
|
|
18
|
+
{years.map((year, yearIdx) => (
|
|
19
|
+
<DatePicker.TableCell key={yearIdx} value={year.value}>
|
|
20
|
+
<DatePicker.TableCellTrigger
|
|
21
|
+
className={classNames(tableStyles.tableCellTrigger, styles.trigger)}
|
|
22
|
+
>
|
|
23
|
+
<DsTypography variant="body-md-md">{year.label}</DsTypography>
|
|
24
|
+
</DatePicker.TableCellTrigger>
|
|
25
|
+
</DatePicker.TableCell>
|
|
26
|
+
))}
|
|
27
|
+
</DatePicker.TableRow>
|
|
28
|
+
))}
|
|
29
|
+
</DatePicker.TableBody>
|
|
30
|
+
</DatePicker.Table>
|
|
31
|
+
</>
|
|
32
|
+
)}
|
|
33
|
+
</DatePicker.Context>
|
|
34
|
+
</DatePicker.View>
|
|
35
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@use '../../styles/shared/dropdown';
|
|
2
|
+
|
|
3
|
+
.control {
|
|
4
|
+
display: flex;
|
|
5
|
+
|
|
6
|
+
&:not([data-disabled]):where(:hover, :focus-within) {
|
|
7
|
+
.clearTrigger {
|
|
8
|
+
visibility: visible;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.clearTrigger {
|
|
14
|
+
visibility: hidden;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.positioner {
|
|
18
|
+
@include dropdown.dropdown-viewport;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.content {
|
|
22
|
+
@include dropdown.dropdown-content;
|
|
23
|
+
padding: var(--spacing-standard);
|
|
24
|
+
min-width: fit-content;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.timePickerPopoverContent {
|
|
28
|
+
z-index: dropdown.$dropdown-z-index + 1;
|
|
29
|
+
}
|