@drivenets/design-system 0.7.2 → 0.8.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 +31 -0
- package/dist/index.cjs +4489 -3807
- package/dist/index.d.cts +1269 -990
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1269 -990
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4490 -3814
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/package.json +19 -20
- package/src/components/ds-autocomplete/ds-autocomplete.module.scss +1 -1
- 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-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-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 +19 -0
- package/src/components/ds-date-picker/ds-date-picker.tsx +209 -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-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 +5 -0
- 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-status-badge/ds-status-badge.module.scss +1 -1
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.tsx +14 -7
- package/src/components/ds-table/components/ds-table-body-virtualized/ds-table-body-virtualized.types.ts +5 -3
- package/src/components/ds-table/components/ds-table-row/ds-table-row.tsx +5 -3
- package/src/components/ds-table/components/ds-table-row/ds-table-row.types.ts +4 -0
- package/src/components/ds-table/components/ds-table-row-selectable-cell/ds-table-row-selectable-cell.tsx +2 -1
- package/src/components/ds-table/components/ds-table-row-selectable-cell/ds-table-row-selectable-cell.types.ts +1 -0
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.tsx +5 -2
- package/src/components/ds-table/components/ds-table-row-virtualized/ds-table-row-virtualized.types.ts +4 -2
- package/src/components/ds-table/ds-table.tsx +4 -1
- 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.tsx +158 -0
- package/src/components/ds-time-picker/ds-time-picker.types.ts +48 -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 +4 -0
- package/src/styles/_root_updated.scss +593 -0
- package/src/styles/shared/_dropdown.scss +4 -1
- package/src/utils/use-controlled.browser.test.ts +79 -0
- package/src/utils/use-controlled.ts +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drivenets/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.cts",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
52
52
|
"@radix-ui/react-visually-hidden": "^1.2.4",
|
|
53
53
|
"@tanstack/react-table": "^8.21.3",
|
|
54
|
-
"@tanstack/react-virtual": "^3.13.
|
|
55
|
-
"@zag-js/react": "^1.
|
|
56
|
-
"@zag-js/steps": "^1.
|
|
54
|
+
"@tanstack/react-virtual": "^3.13.23",
|
|
55
|
+
"@zag-js/react": "^1.37.0",
|
|
56
|
+
"@zag-js/steps": "^1.37.0",
|
|
57
57
|
"classnames": "^2.5.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
@@ -67,26 +67,25 @@
|
|
|
67
67
|
"@eslint/compat": "^2.0.3",
|
|
68
68
|
"@faker-js/faker": "^10.3.0",
|
|
69
69
|
"@hookform/resolvers": "^5.2.2",
|
|
70
|
-
"@
|
|
71
|
-
"@storybook/addon-a11y": "^10.2.
|
|
72
|
-
"@storybook/addon-docs": "^10.2.
|
|
73
|
-
"@storybook/addon-vitest": "^10.2.
|
|
74
|
-
"@storybook/
|
|
75
|
-
"@storybook/react-vite": "^10.2.16",
|
|
70
|
+
"@rolldown/plugin-babel": "^0.2.1",
|
|
71
|
+
"@storybook/addon-a11y": "^10.2.19",
|
|
72
|
+
"@storybook/addon-docs": "^10.2.19",
|
|
73
|
+
"@storybook/addon-vitest": "^10.2.19",
|
|
74
|
+
"@storybook/react-vite": "^10.2.19",
|
|
76
75
|
"@tanstack/react-query": "^5.90.21",
|
|
77
76
|
"@tanstack/react-router": "^1.166.2",
|
|
78
77
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
79
78
|
"@types/react": "^19.2.14",
|
|
80
79
|
"@types/react-dom": "^19.2.3",
|
|
81
|
-
"@vitejs/plugin-react
|
|
82
|
-
"@vitest/browser-playwright": "^4.0
|
|
83
|
-
"@vitest/coverage-v8": "^4.0
|
|
80
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
81
|
+
"@vitest/browser-playwright": "^4.1.0",
|
|
82
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
84
83
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
85
84
|
"eslint": "^10.0.1",
|
|
86
85
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
87
86
|
"eslint-plugin-react": "^7.37.5",
|
|
88
87
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
89
|
-
"eslint-plugin-storybook": "^10.2.
|
|
88
|
+
"eslint-plugin-storybook": "^10.2.19",
|
|
90
89
|
"mockdate": "^3.0.5",
|
|
91
90
|
"playwright": "^1.58.2",
|
|
92
91
|
"postcss": "^8.5.8",
|
|
@@ -97,17 +96,17 @@
|
|
|
97
96
|
"react-hook-form": "^7.71.2",
|
|
98
97
|
"rollup-plugin-sass": "^1.15.3",
|
|
99
98
|
"sass-embedded": "^1.97.3",
|
|
100
|
-
"storybook": "^10.2.
|
|
99
|
+
"storybook": "^10.2.19",
|
|
101
100
|
"tsdown": "^0.21.0",
|
|
102
101
|
"typed-scss-modules": "^8.1.1",
|
|
103
102
|
"typescript": "^5.9.3",
|
|
104
103
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
105
|
-
"vite": "^
|
|
106
|
-
"vitest": "^4.0
|
|
107
|
-
"vitest-browser-react": "^2.0
|
|
104
|
+
"vite": "^8.0.0",
|
|
105
|
+
"vitest": "^4.1.0",
|
|
106
|
+
"vitest-browser-react": "^2.1.0",
|
|
108
107
|
"zod": "^4.3.6",
|
|
109
|
-
"@drivenets/
|
|
110
|
-
"@drivenets/
|
|
108
|
+
"@drivenets/vite-plugin-design-system": "0.0.6",
|
|
109
|
+
"@drivenets/eslint-plugin-internal": "0.0.0"
|
|
111
110
|
},
|
|
112
111
|
"scripts": {
|
|
113
112
|
"install:playwright": "pnpm exec playwright install chromium --with-deps",
|
|
@@ -45,10 +45,7 @@ export const DsAutocomplete = ({
|
|
|
45
45
|
|
|
46
46
|
const handleValueChange = (details: Combobox.ValueChangeDetails<DsAutocompleteOption>) => {
|
|
47
47
|
const selectedItem = details.items[0];
|
|
48
|
-
|
|
49
|
-
if (selectedItem) {
|
|
50
|
-
onValueChange?.(selectedItem.value);
|
|
51
|
-
}
|
|
48
|
+
onValueChange?.(selectedItem?.value ?? '');
|
|
52
49
|
};
|
|
53
50
|
|
|
54
51
|
const handleOpenChange = (details: Combobox.OpenChangeDetails) => {
|
|
@@ -83,12 +80,20 @@ export const DsAutocomplete = ({
|
|
|
83
80
|
<Combobox.Input className={styles.input} placeholder={placeholder} />
|
|
84
81
|
|
|
85
82
|
<Combobox.Context>
|
|
86
|
-
{(
|
|
83
|
+
{(combobox) => (
|
|
87
84
|
<div className={styles.iconContainer}>
|
|
88
|
-
{
|
|
89
|
-
<
|
|
85
|
+
{combobox.inputValue && !disabled && (
|
|
86
|
+
<button
|
|
87
|
+
type="button"
|
|
88
|
+
className={styles.clearButton}
|
|
89
|
+
aria-label="Clear"
|
|
90
|
+
onClick={() => {
|
|
91
|
+
combobox.setValue([]);
|
|
92
|
+
combobox.setInputValue('');
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
90
95
|
<DsIcon icon="close" size="medium" />
|
|
91
|
-
</
|
|
96
|
+
</button>
|
|
92
97
|
)}
|
|
93
98
|
|
|
94
99
|
{showTrigger && (
|
|
@@ -85,7 +85,8 @@ export interface DsAutocompleteProps {
|
|
|
85
85
|
startAdornment?: React.ReactNode;
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Event handler called when the value changes
|
|
88
|
+
* Event handler called when the value changes.
|
|
89
|
+
* Fires with the selected option's value, or an empty string when cleared.
|
|
89
90
|
*/
|
|
90
91
|
onValueChange?: (value: string) => void;
|
|
91
92
|
/**
|
|
@@ -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"
|
|
@@ -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,19 @@
|
|
|
1
|
+
@use '../../styles/shared/dropdown';
|
|
2
|
+
|
|
3
|
+
.control {
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.positioner {
|
|
8
|
+
@include dropdown.dropdown-viewport;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.content {
|
|
12
|
+
@include dropdown.dropdown-content;
|
|
13
|
+
padding: var(--spacing-standard);
|
|
14
|
+
min-width: fit-content;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.timePickerPopoverContent {
|
|
18
|
+
z-index: dropdown.$dropdown-z-index + 1;
|
|
19
|
+
}
|