@superdispatch/dates 0.21.13 → 0.21.14

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.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +13 -39
  3. package/.babelrc.js +0 -5
  4. package/.turbo/turbo-version.log +0 -26
  5. package/pkg/README.md +0 -10
  6. package/pkg/package.json +0 -32
  7. package/playroom.ts +0 -10
  8. package/src/__tests__/index.spec.ts +0 -48
  9. package/src/base-date-picker/BaseDatePicker.tsx +0 -145
  10. package/src/calendar/Calendar.playroom.tsx +0 -28
  11. package/src/calendar/Calendar.spec.tsx +0 -531
  12. package/src/calendar/Calendar.stories.tsx +0 -50
  13. package/src/calendar/Calendar.tsx +0 -534
  14. package/src/calendar/CalendarQuickSelection.tsx +0 -34
  15. package/src/calendar/InternalCalendarComponents.tsx +0 -79
  16. package/src/date-config/DateConfig.spec.tsx +0 -23
  17. package/src/date-config/DateConfig.tsx +0 -60
  18. package/src/date-field/DateField.playroom.tsx +0 -21
  19. package/src/date-field/DateField.spec.tsx +0 -350
  20. package/src/date-field/DateField.stories.tsx +0 -47
  21. package/src/date-field/DateField.tsx +0 -155
  22. package/src/date-range-field/DateRangeField.playroom.tsx +0 -24
  23. package/src/date-range-field/DateRangeField.spec.tsx +0 -318
  24. package/src/date-range-field/DateRangeField.stories.tsx +0 -51
  25. package/src/date-range-field/DateRangeField.tsx +0 -277
  26. package/src/date-time-utils/DateTimeUtils.spec.ts +0 -652
  27. package/src/date-time-utils/DateTimeUtils.ts +0 -339
  28. package/src/date-utils/DateUtils.spec.ts +0 -234
  29. package/src/date-utils/DateUtils.ts +0 -333
  30. package/src/formatted-date/FormattedDate.spec.tsx +0 -103
  31. package/src/formatted-date/FormattedDate.ts +0 -42
  32. package/src/formatted-relative-time/FormattedRelativeTime.spec.tsx +0 -93
  33. package/src/formatted-relative-time/FormattedRelativeTime.ts +0 -60
  34. package/src/index.ts +0 -12
  35. package/src/time-field/TimeField.playroom.tsx +0 -21
  36. package/src/time-field/TimeField.stories.tsx +0 -35
  37. package/src/time-field/TimeField.tsx +0 -221
  38. package/src/use-date-time/useDateTime.spec.ts +0 -45
  39. package/src/use-date-time/useDateTime.ts +0 -31
  40. package/src/use-date-time-range/useDateTimeRange.spec.ts +0 -53
  41. package/src/use-date-time-range/useDateTimeRange.ts +0 -24
  42. package/tsconfig.json +0 -19
  43. /package/{pkg/dist-node → dist-node}/index.js +0 -0
  44. /package/{pkg/dist-node → dist-node}/index.js.map +0 -0
  45. /package/{pkg/dist-src → dist-src}/base-date-picker/BaseDatePicker.js +0 -0
  46. /package/{pkg/dist-src → dist-src}/calendar/Calendar.js +0 -0
  47. /package/{pkg/dist-src → dist-src}/calendar/CalendarQuickSelection.js +0 -0
  48. /package/{pkg/dist-src → dist-src}/calendar/InternalCalendarComponents.js +0 -0
  49. /package/{pkg/dist-src → dist-src}/date-config/DateConfig.js +0 -0
  50. /package/{pkg/dist-src → dist-src}/date-field/DateField.js +0 -0
  51. /package/{pkg/dist-src → dist-src}/date-range-field/DateRangeField.js +0 -0
  52. /package/{pkg/dist-src → dist-src}/date-time-utils/DateTimeUtils.js +0 -0
  53. /package/{pkg/dist-src → dist-src}/date-utils/DateUtils.js +0 -0
  54. /package/{pkg/dist-src → dist-src}/formatted-date/FormattedDate.js +0 -0
  55. /package/{pkg/dist-src → dist-src}/formatted-relative-time/FormattedRelativeTime.js +0 -0
  56. /package/{pkg/dist-src → dist-src}/index.js +0 -0
  57. /package/{pkg/dist-src → dist-src}/time-field/TimeField.js +0 -0
  58. /package/{pkg/dist-src → dist-src}/use-date-time/useDateTime.js +0 -0
  59. /package/{pkg/dist-src → dist-src}/use-date-time-range/useDateTimeRange.js +0 -0
  60. /package/{pkg/dist-types → dist-types}/index.d.ts +0 -0
  61. /package/{pkg/dist-web → dist-web}/index.js +0 -0
  62. /package/{pkg/dist-web → dist-web}/index.js.map +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Super Dispatch
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,20 +1,19 @@
1
1
  {
2
2
  "name": "@superdispatch/dates",
3
- "version": "0.21.13",
3
+ "version": "0.21.14",
4
+ "license": "MIT",
5
+ "files": [
6
+ "dist-*/",
7
+ "bin/"
8
+ ],
9
+ "pika": true,
10
+ "sideEffects": false,
4
11
  "repository": {
5
12
  "type": "git",
6
13
  "url": "https://github.com/superdispatch/ui.git"
7
14
  },
8
- "license": "MIT",
9
- "main": "src/index.ts",
10
- "module": "src/index.ts",
11
- "browser": "pkg/dist-web/index.js",
12
- "types": "src/index.ts",
13
- "scripts": {
14
- "version": "pika build"
15
- },
16
15
  "dependencies": {
17
- "@superdispatch/ui": "^0.21.13",
16
+ "@superdispatch/ui": "^0.21.14",
18
17
  "luxon": "^1.27.0",
19
18
  "react-day-picker": "7.4.10"
20
19
  },
@@ -26,33 +25,8 @@
26
25
  "access": "public",
27
26
  "directory": "pkg"
28
27
  },
29
- "@pika/pack": {
30
- "pipeline": [
31
- [
32
- "@pika/plugin-standard-pkg",
33
- {
34
- "exclude": [
35
- "**/*.spec.*",
36
- "**/*.stories.*",
37
- "**/*.playroom.*",
38
- "**/__tests__/**",
39
- "**/__testutils__/**"
40
- ]
41
- }
42
- ],
43
- [
44
- "@pika/plugin-build-web"
45
- ],
46
- [
47
- "@pika/plugin-build-node"
48
- ],
49
- [
50
- "@pika/plugin-build-types"
51
- ],
52
- [
53
- "@pika/plugin-bundle-types"
54
- ]
55
- ]
56
- },
57
- "gitHead": "5ff0a851a8c24bab48a6fdb37e353eae62bd4a35"
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"
58
32
  }
package/.babelrc.js DELETED
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- const createBabelConfig = require('../../config/createBabelConfig');
4
-
5
- module.exports = createBabelConfig();
@@ -1,26 +0,0 @@
1
- @superdispatch/dates:version: cache hit, replaying output de27c48a07670426
2
- @superdispatch/dates:version: $ pika build
3
- @superdispatch/dates:version: @pika/pack v0.5.0
4
- @superdispatch/dates:version: [1/8] Validating source...
5
- @superdispatch/dates:version: [2/8] Preparing pipeline...
6
- @superdispatch/dates:version:  ❇️ pkg/
7
- @superdispatch/dates:version: [3/8] Running @pika/plugin-standard-pkg...
8
- @superdispatch/dates:version: Browserslist: caniuse-lite is outdated. Please run:
9
- @superdispatch/dates:version:  npx browserslist@latest --update-db
10
- @superdispatch/dates:version:  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
11
- @superdispatch/dates:version:  📝 pkg/dist-src/index.js [esnext]
12
- @superdispatch/dates:version:  » Linting with standard-pkg...
13
- @superdispatch/dates:version: [4/8] Running @pika/plugin-build-web...
14
- @superdispatch/dates:version:  📝 pkg/dist-web/index.js [module]
15
- @superdispatch/dates:version: [5/8] Running @pika/plugin-build-node...
16
- @superdispatch/dates:version:  📝 pkg/dist-node/index.js [main]
17
- @superdispatch/dates:version: [6/8] Running @pika/plugin-build-types...
18
- @superdispatch/dates:version:  » no manual type definitions found, auto-generating...
19
- @superdispatch/dates:version:  📝 pkg/dist-types/index.d.ts [types]
20
- @superdispatch/dates:version: [7/8] Running @pika/plugin-bundle-types...
21
- @superdispatch/dates:version:  📝 pkg/dist-types/index.d.ts
22
- @superdispatch/dates:version: [8/8] Finalizing package...
23
- @superdispatch/dates:version:  » copying README.md...
24
- @superdispatch/dates:version:  📝 pkg/package.json
25
- @superdispatch/dates:version:  📦 pkg/
26
- @superdispatch/dates:version: Done in 9.35s.
package/pkg/README.md DELETED
@@ -1,10 +0,0 @@
1
- ### `@superdispatch/dates`
2
-
3
- [![npm](https://img.shields.io/npm/v/@superdispatch/dates)](https://www.npmjs.com/package/@superdispatch/dates)
4
- [![npm minzipped size](https://img.shields.io/bundlephobia/minzip/@superdispatch/dates.svg)](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,10 +0,0 @@
1
- export {
2
- Calendar,
3
- CalendarQuickSelection,
4
- CalendarQuickSelectionItem,
5
- DateField,
6
- DateRangeField,
7
- FormattedDate,
8
- FormattedRelativeTime,
9
- TimeField,
10
- } from './src';
@@ -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
- );