@superdispatch/dates 0.21.13 → 0.21.16
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/LICENSE +21 -0
- package/{pkg/dist-node → dist-node}/index.js +3 -3
- package/{pkg/dist-node → dist-node}/index.js.map +1 -1
- package/{pkg/dist-src → dist-src}/date-time-utils/DateTimeUtils.js +3 -3
- package/{pkg/dist-web → dist-web}/index.js +3 -3
- package/{pkg/dist-web → dist-web}/index.js.map +1 -1
- package/package.json +13 -39
- package/.babelrc.js +0 -5
- package/.turbo/turbo-version.log +0 -26
- package/pkg/README.md +0 -10
- package/pkg/package.json +0 -32
- package/playroom.ts +0 -10
- package/src/__tests__/index.spec.ts +0 -48
- package/src/base-date-picker/BaseDatePicker.tsx +0 -145
- package/src/calendar/Calendar.playroom.tsx +0 -28
- package/src/calendar/Calendar.spec.tsx +0 -531
- package/src/calendar/Calendar.stories.tsx +0 -50
- package/src/calendar/Calendar.tsx +0 -534
- package/src/calendar/CalendarQuickSelection.tsx +0 -34
- package/src/calendar/InternalCalendarComponents.tsx +0 -79
- package/src/date-config/DateConfig.spec.tsx +0 -23
- package/src/date-config/DateConfig.tsx +0 -60
- package/src/date-field/DateField.playroom.tsx +0 -21
- package/src/date-field/DateField.spec.tsx +0 -350
- package/src/date-field/DateField.stories.tsx +0 -47
- package/src/date-field/DateField.tsx +0 -155
- package/src/date-range-field/DateRangeField.playroom.tsx +0 -24
- package/src/date-range-field/DateRangeField.spec.tsx +0 -318
- package/src/date-range-field/DateRangeField.stories.tsx +0 -51
- package/src/date-range-field/DateRangeField.tsx +0 -277
- package/src/date-time-utils/DateTimeUtils.spec.ts +0 -652
- package/src/date-time-utils/DateTimeUtils.ts +0 -339
- package/src/date-utils/DateUtils.spec.ts +0 -234
- package/src/date-utils/DateUtils.ts +0 -333
- package/src/formatted-date/FormattedDate.spec.tsx +0 -103
- package/src/formatted-date/FormattedDate.ts +0 -42
- package/src/formatted-relative-time/FormattedRelativeTime.spec.tsx +0 -93
- package/src/formatted-relative-time/FormattedRelativeTime.ts +0 -60
- package/src/index.ts +0 -12
- package/src/time-field/TimeField.playroom.tsx +0 -21
- package/src/time-field/TimeField.stories.tsx +0 -35
- package/src/time-field/TimeField.tsx +0 -221
- package/src/use-date-time/useDateTime.spec.ts +0 -45
- package/src/use-date-time/useDateTime.ts +0 -31
- package/src/use-date-time-range/useDateTimeRange.spec.ts +0 -53
- package/src/use-date-time-range/useDateTimeRange.ts +0 -24
- package/tsconfig.json +0 -19
- /package/{pkg/dist-src → dist-src}/base-date-picker/BaseDatePicker.js +0 -0
- /package/{pkg/dist-src → dist-src}/calendar/Calendar.js +0 -0
- /package/{pkg/dist-src → dist-src}/calendar/CalendarQuickSelection.js +0 -0
- /package/{pkg/dist-src → dist-src}/calendar/InternalCalendarComponents.js +0 -0
- /package/{pkg/dist-src → dist-src}/date-config/DateConfig.js +0 -0
- /package/{pkg/dist-src → dist-src}/date-field/DateField.js +0 -0
- /package/{pkg/dist-src → dist-src}/date-range-field/DateRangeField.js +0 -0
- /package/{pkg/dist-src → dist-src}/date-utils/DateUtils.js +0 -0
- /package/{pkg/dist-src → dist-src}/formatted-date/FormattedDate.js +0 -0
- /package/{pkg/dist-src → dist-src}/formatted-relative-time/FormattedRelativeTime.js +0 -0
- /package/{pkg/dist-src → dist-src}/index.js +0 -0
- /package/{pkg/dist-src → dist-src}/time-field/TimeField.js +0 -0
- /package/{pkg/dist-src → dist-src}/use-date-time/useDateTime.js +0 -0
- /package/{pkg/dist-src → dist-src}/use-date-time-range/useDateTimeRange.js +0 -0
- /package/{pkg/dist-types → dist-types}/index.d.ts +0 -0
package/.babelrc.js
DELETED
package/.turbo/turbo-version.log
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
[32m@superdispatch/dates:version[0m: cache hit, replaying output [2mde27c48a07670426[0m
|
|
2
|
-
[32m@superdispatch/dates:version: [0m$ pika build
|
|
3
|
-
[32m@superdispatch/dates:version: [0m@pika/pack v0.5.0
|
|
4
|
-
[32m@superdispatch/dates:version: [0m[1/8] Validating source...
|
|
5
|
-
[32m@superdispatch/dates:version: [0m[2/8] Preparing pipeline...
|
|
6
|
-
[32m@superdispatch/dates:version: [0m ❇️ pkg/
|
|
7
|
-
[32m@superdispatch/dates:version: [0m[3/8] Running @pika/plugin-standard-pkg...
|
|
8
|
-
[32m@superdispatch/dates:version: [0mBrowserslist: caniuse-lite is outdated. Please run:
|
|
9
|
-
[32m@superdispatch/dates:version: [0m npx browserslist@latest --update-db
|
|
10
|
-
[32m@superdispatch/dates:version: [0m Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
|
|
11
|
-
[32m@superdispatch/dates:version: [0m 📝 pkg/dist-src/index.js [esnext]
|
|
12
|
-
[32m@superdispatch/dates:version: [0m » Linting with standard-pkg...
|
|
13
|
-
[32m@superdispatch/dates:version: [0m[4/8] Running @pika/plugin-build-web...
|
|
14
|
-
[32m@superdispatch/dates:version: [0m 📝 pkg/dist-web/index.js [module]
|
|
15
|
-
[32m@superdispatch/dates:version: [0m[5/8] Running @pika/plugin-build-node...
|
|
16
|
-
[32m@superdispatch/dates:version: [0m 📝 pkg/dist-node/index.js [main]
|
|
17
|
-
[32m@superdispatch/dates:version: [0m[6/8] Running @pika/plugin-build-types...
|
|
18
|
-
[32m@superdispatch/dates:version: [0m » no manual type definitions found, auto-generating...
|
|
19
|
-
[32m@superdispatch/dates:version: [0m 📝 pkg/dist-types/index.d.ts [types]
|
|
20
|
-
[32m@superdispatch/dates:version: [0m[7/8] Running @pika/plugin-bundle-types...
|
|
21
|
-
[32m@superdispatch/dates:version: [0m 📝 pkg/dist-types/index.d.ts
|
|
22
|
-
[32m@superdispatch/dates:version: [0m[8/8] Finalizing package...
|
|
23
|
-
[32m@superdispatch/dates:version: [0m » copying README.md...
|
|
24
|
-
[32m@superdispatch/dates:version: [0m 📝 pkg/package.json
|
|
25
|
-
[32m@superdispatch/dates:version: [0m 📦 pkg/
|
|
26
|
-
[32m@superdispatch/dates:version: [0mDone in 9.35s.
|
package/pkg/README.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
### `@superdispatch/dates`
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@superdispatch/dates)
|
|
4
|
-
[](https://bundlephobia.com/result?p=@superdispatch/dates)
|
|
5
|
-
|
|
6
|
-
#### Installation
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
yarn add @superdispatch/dates @material-ui/core @material-ui/lab
|
|
10
|
-
```
|
package/pkg/package.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@superdispatch/dates",
|
|
3
|
-
"version": "0.21.8",
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"files": [
|
|
6
|
-
"dist-*/",
|
|
7
|
-
"bin/"
|
|
8
|
-
],
|
|
9
|
-
"pika": true,
|
|
10
|
-
"sideEffects": false,
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "https://github.com/superdispatch/ui.git"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@superdispatch/ui": "^0.21.8",
|
|
17
|
-
"luxon": "^1.27.0",
|
|
18
|
-
"react-day-picker": "7.4.10"
|
|
19
|
-
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"@babel/runtime": "^7.0.0",
|
|
22
|
-
"@material-ui/lab": "^4.0.0-alpha.40"
|
|
23
|
-
},
|
|
24
|
-
"publishConfig": {
|
|
25
|
-
"access": "public",
|
|
26
|
-
"directory": "pkg"
|
|
27
|
-
},
|
|
28
|
-
"esnext": "dist-src/index.js",
|
|
29
|
-
"module": "dist-web/index.js",
|
|
30
|
-
"main": "dist-node/index.js",
|
|
31
|
-
"types": "dist-types/index.d.ts"
|
|
32
|
-
}
|
package/playroom.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as api from '..';
|
|
2
|
-
|
|
3
|
-
it('exposes public api', () => {
|
|
4
|
-
expect(api).toMatchInlineSnapshot(`
|
|
5
|
-
Object {
|
|
6
|
-
"Calendar": React.forwardRef(Calendar),
|
|
7
|
-
"CalendarQuickSelection": React.forwardRef(CalendarQuickSelection),
|
|
8
|
-
"CalendarQuickSelectionItem": React.forwardRef(CalendarQuickSelectionItem),
|
|
9
|
-
"DateConfigProvider": [Function],
|
|
10
|
-
"DateField": React.forwardRef(DateField),
|
|
11
|
-
"DateRangeField": React.forwardRef(DateRangeField),
|
|
12
|
-
"DateUtils": [Function],
|
|
13
|
-
"FormattedDate": [Function],
|
|
14
|
-
"FormattedRelativeTime": [Function],
|
|
15
|
-
"TimeField": React.forwardRef(TimeField),
|
|
16
|
-
"defaultDateConfig": Object {
|
|
17
|
-
"format": "DateTimeISO",
|
|
18
|
-
},
|
|
19
|
-
"formatDate": [Function],
|
|
20
|
-
"formatDateRange": [Function],
|
|
21
|
-
"formatRelativeTime": [Function],
|
|
22
|
-
"isDate": [Function],
|
|
23
|
-
"isDateLike": [Function],
|
|
24
|
-
"isDateRange": [Function],
|
|
25
|
-
"isDateRangeLike": [Function],
|
|
26
|
-
"isValidDate": [Function],
|
|
27
|
-
"isValidDateRange": [Function],
|
|
28
|
-
"parseDate": [Function],
|
|
29
|
-
"parseDateRange": [Function],
|
|
30
|
-
"setDefaultTimeZone": [Function],
|
|
31
|
-
"stringifyDate": [Function],
|
|
32
|
-
"stringifyDateRange": [Function],
|
|
33
|
-
"toDate": [Function],
|
|
34
|
-
"toDatePayload": [Function],
|
|
35
|
-
"toDateRange": [Function],
|
|
36
|
-
"toDateRangePayload": [Function],
|
|
37
|
-
"toPrimitiveDateInput": [Function],
|
|
38
|
-
"toPrimitiveDateRangeInput": [Function],
|
|
39
|
-
"useDateConfig": [Function],
|
|
40
|
-
"useDateTime": [Function],
|
|
41
|
-
"useDateTimeRange": [Function],
|
|
42
|
-
"useDateUtils": [Function],
|
|
43
|
-
"useDefaultTimeZone": [Function],
|
|
44
|
-
"useFormattedDate": [Function],
|
|
45
|
-
"useFormattedRelativeTime": [Function],
|
|
46
|
-
}
|
|
47
|
-
`);
|
|
48
|
-
});
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseTextFieldProps,
|
|
3
|
-
IconButton,
|
|
4
|
-
InputAdornment,
|
|
5
|
-
InputProps,
|
|
6
|
-
Popover,
|
|
7
|
-
SvgIcon,
|
|
8
|
-
TextField,
|
|
9
|
-
} from '@material-ui/core';
|
|
10
|
-
import { Clear } from '@material-ui/icons';
|
|
11
|
-
import { mdiCalendarMonth } from '@mdi/js';
|
|
12
|
-
import { useValueObserver } from '@superdispatch/hooks';
|
|
13
|
-
import { mergeRefs, useUID } from '@superdispatch/ui';
|
|
14
|
-
import { forwardRef, Ref, useImperativeHandle, useRef, useState } from 'react';
|
|
15
|
-
|
|
16
|
-
export interface InternalBaseDateFieldAPI {
|
|
17
|
-
close: () => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface BaseDatePickerProps
|
|
21
|
-
extends Omit<BaseTextFieldProps, 'variant'> {
|
|
22
|
-
api?: Ref<InternalBaseDateFieldAPI>;
|
|
23
|
-
onClear?: () => void;
|
|
24
|
-
onClose?: () => void;
|
|
25
|
-
enableClearable?: boolean;
|
|
26
|
-
InputProps?: InputProps;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const BaseDatePicker = forwardRef<HTMLDivElement, BaseDatePickerProps>(
|
|
30
|
-
(
|
|
31
|
-
{
|
|
32
|
-
id,
|
|
33
|
-
api,
|
|
34
|
-
onClear,
|
|
35
|
-
onClick,
|
|
36
|
-
onClose,
|
|
37
|
-
onKeyDown,
|
|
38
|
-
|
|
39
|
-
disabled,
|
|
40
|
-
children,
|
|
41
|
-
enableClearable,
|
|
42
|
-
|
|
43
|
-
inputRef: inputRefProp,
|
|
44
|
-
InputProps: inputProps,
|
|
45
|
-
|
|
46
|
-
...textFieldProps
|
|
47
|
-
},
|
|
48
|
-
ref,
|
|
49
|
-
) => {
|
|
50
|
-
const uid = useUID(id);
|
|
51
|
-
const labelID = `${uid}-label`;
|
|
52
|
-
const clearIconID = `${uid}-clear-icon`;
|
|
53
|
-
|
|
54
|
-
const inputRef = useRef<HTMLInputElement>(null);
|
|
55
|
-
const textFieldRef = useRef<HTMLDivElement>(null);
|
|
56
|
-
const [popoverAnchor, setPopoverAnchor] = useState<null | HTMLElement>(
|
|
57
|
-
null,
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
function handleOpen(): void {
|
|
61
|
-
if (!disabled && textFieldRef.current) {
|
|
62
|
-
setPopoverAnchor(textFieldRef.current);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function handleClose(): void {
|
|
67
|
-
setPopoverAnchor(null);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
useImperativeHandle(api, () => ({ close: handleClose }));
|
|
71
|
-
|
|
72
|
-
// We want to trigger close event only when UI will be ready after updates.
|
|
73
|
-
useValueObserver(popoverAnchor, () => {
|
|
74
|
-
if (!popoverAnchor) {
|
|
75
|
-
onClose?.();
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<>
|
|
81
|
-
<Popover
|
|
82
|
-
open={!!popoverAnchor}
|
|
83
|
-
onClose={handleClose}
|
|
84
|
-
anchorEl={popoverAnchor}
|
|
85
|
-
anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
|
|
86
|
-
transformOrigin={{ vertical: 'top', horizontal: 'left' }}
|
|
87
|
-
>
|
|
88
|
-
{children}
|
|
89
|
-
</Popover>
|
|
90
|
-
|
|
91
|
-
<TextField
|
|
92
|
-
{...textFieldProps}
|
|
93
|
-
id={uid}
|
|
94
|
-
ref={mergeRefs(ref, textFieldRef)}
|
|
95
|
-
disabled={disabled}
|
|
96
|
-
inputRef={mergeRefs(inputRef, inputRefProp)}
|
|
97
|
-
onClick={(event) => {
|
|
98
|
-
onClick?.(event);
|
|
99
|
-
if (!event.defaultPrevented) {
|
|
100
|
-
handleOpen();
|
|
101
|
-
}
|
|
102
|
-
}}
|
|
103
|
-
onKeyDown={(event) => {
|
|
104
|
-
onKeyDown?.(event);
|
|
105
|
-
|
|
106
|
-
if (
|
|
107
|
-
!event.defaultPrevented &&
|
|
108
|
-
(event.key === ' ' || event.key === 'Enter')
|
|
109
|
-
) {
|
|
110
|
-
handleOpen();
|
|
111
|
-
}
|
|
112
|
-
}}
|
|
113
|
-
inputProps={{ readOnly: true }}
|
|
114
|
-
InputProps={{
|
|
115
|
-
...inputProps,
|
|
116
|
-
endAdornment: (
|
|
117
|
-
<InputAdornment position="end">
|
|
118
|
-
{enableClearable ? (
|
|
119
|
-
<IconButton
|
|
120
|
-
disabled={disabled}
|
|
121
|
-
aria-labelledby={`${clearIconID} ${labelID}`}
|
|
122
|
-
onClick={(event) => {
|
|
123
|
-
// Do not bubble up clicks.
|
|
124
|
-
event.stopPropagation();
|
|
125
|
-
|
|
126
|
-
onClear?.();
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
129
|
-
<Clear id={clearIconID} aria-label="clear" />
|
|
130
|
-
</IconButton>
|
|
131
|
-
) : (
|
|
132
|
-
<IconButton disabled={disabled}>
|
|
133
|
-
<SvgIcon>
|
|
134
|
-
<path d={mdiCalendarMonth} />
|
|
135
|
-
</SvgIcon>
|
|
136
|
-
</IconButton>
|
|
137
|
-
)}
|
|
138
|
-
</InputAdornment>
|
|
139
|
-
),
|
|
140
|
-
}}
|
|
141
|
-
/>
|
|
142
|
-
</>
|
|
143
|
-
);
|
|
144
|
-
},
|
|
145
|
-
);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { forwardRef, useState } from 'react';
|
|
2
|
-
import { NullableDateInput } from '../date-time-utils/DateTimeUtils';
|
|
3
|
-
import { Calendar as SDCalendar, CalendarProps } from './Calendar';
|
|
4
|
-
|
|
5
|
-
export const Calendar = forwardRef<HTMLDivElement, CalendarProps>(
|
|
6
|
-
({ onDayClick, selectedDays, ...props }, ref) => {
|
|
7
|
-
const [value, setValue] = useState<NullableDateInput>();
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<SDCalendar
|
|
11
|
-
{...props}
|
|
12
|
-
ref={ref}
|
|
13
|
-
selectedDays={selectedDays || ((event) => value === event.stringValue)}
|
|
14
|
-
onDayClick={(event) => {
|
|
15
|
-
onDayClick?.(event);
|
|
16
|
-
|
|
17
|
-
if (!event.disabled) {
|
|
18
|
-
if (!event.selected) {
|
|
19
|
-
setValue(event.stringValue);
|
|
20
|
-
} else {
|
|
21
|
-
setValue(undefined);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
},
|
|
28
|
-
);
|