@pingux/astro 2.103.0 → 2.104.0-alpha.1
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/lib/cjs/components/Calendar/Calendar.js +11 -6
- package/lib/cjs/components/Calendar/Calendar.styles.d.ts +3 -1
- package/lib/cjs/components/Calendar/Calendar.styles.js +5 -1
- package/lib/cjs/components/DatePicker/DatePicker.stories.js +77 -9
- package/lib/cjs/components/Image/Image.stories.js +1 -1
- package/lib/cjs/utils/designUtils/figmaLinks.d.ts +13 -0
- package/lib/cjs/utils/designUtils/figmaLinks.js +13 -0
- package/lib/cjs/utils/devUtils/constants/images.d.ts +1 -0
- package/lib/cjs/utils/devUtils/constants/images.js +4 -2
- package/lib/components/Calendar/Calendar.js +11 -6
- package/lib/components/Calendar/Calendar.styles.js +5 -1
- package/lib/components/DatePicker/DatePicker.stories.js +75 -6
- package/lib/components/Image/Image.stories.js +2 -2
- package/lib/utils/designUtils/figmaLinks.js +13 -0
- package/lib/utils/devUtils/constants/images.js +2 -1
- package/package.json +1 -1
- package/lib/cjs/components/Calendar/Calendar.stories.d.ts +0 -212
- package/lib/cjs/components/Calendar/Calendar.stories.js +0 -225
- package/lib/components/Calendar/Calendar.stories.js +0 -206
package/package.json
CHANGED
@@ -1,212 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { StoryFn } from '@storybook/react';
|
3
|
-
import { CalendarProps } from '../../types';
|
4
|
-
declare const _default: {
|
5
|
-
title: string;
|
6
|
-
component: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<HTMLDivElement>>;
|
7
|
-
decorators: ((...args: any) => any)[];
|
8
|
-
parameters: {
|
9
|
-
actions: {
|
10
|
-
argTypesRegex: string;
|
11
|
-
};
|
12
|
-
docs: {
|
13
|
-
source: {
|
14
|
-
type: string;
|
15
|
-
};
|
16
|
-
page: () => React.JSX.Element;
|
17
|
-
};
|
18
|
-
};
|
19
|
-
argTypes: {
|
20
|
-
'aria-controls': {
|
21
|
-
control: {
|
22
|
-
type: string;
|
23
|
-
};
|
24
|
-
table: {
|
25
|
-
type: {
|
26
|
-
summary: string;
|
27
|
-
};
|
28
|
-
category: string;
|
29
|
-
};
|
30
|
-
description: string;
|
31
|
-
};
|
32
|
-
'aria-describedby': {
|
33
|
-
control: {
|
34
|
-
type: string;
|
35
|
-
};
|
36
|
-
table: {
|
37
|
-
type: {
|
38
|
-
summary: string;
|
39
|
-
};
|
40
|
-
category: string;
|
41
|
-
};
|
42
|
-
description: string;
|
43
|
-
};
|
44
|
-
'aria-details': {
|
45
|
-
control: {
|
46
|
-
type: string;
|
47
|
-
};
|
48
|
-
table: {
|
49
|
-
type: {
|
50
|
-
summary: string;
|
51
|
-
};
|
52
|
-
category: string;
|
53
|
-
};
|
54
|
-
description: string;
|
55
|
-
};
|
56
|
-
'aria-errormessage': {
|
57
|
-
control: {
|
58
|
-
type: string;
|
59
|
-
};
|
60
|
-
table: {
|
61
|
-
type: {
|
62
|
-
summary: string;
|
63
|
-
};
|
64
|
-
category: string;
|
65
|
-
};
|
66
|
-
description: string;
|
67
|
-
};
|
68
|
-
'aria-label': {
|
69
|
-
control: {
|
70
|
-
type: string;
|
71
|
-
};
|
72
|
-
table: {
|
73
|
-
type: {
|
74
|
-
summary: string;
|
75
|
-
};
|
76
|
-
category: string;
|
77
|
-
};
|
78
|
-
description: string;
|
79
|
-
};
|
80
|
-
'aria-labelledby': {
|
81
|
-
control: {
|
82
|
-
type: string;
|
83
|
-
};
|
84
|
-
table: {
|
85
|
-
type: {
|
86
|
-
summary: string;
|
87
|
-
};
|
88
|
-
category: string;
|
89
|
-
};
|
90
|
-
description: string;
|
91
|
-
};
|
92
|
-
customWeekDays: {
|
93
|
-
control: {
|
94
|
-
type: string;
|
95
|
-
};
|
96
|
-
};
|
97
|
-
value: {
|
98
|
-
control: {
|
99
|
-
type: string;
|
100
|
-
};
|
101
|
-
};
|
102
|
-
defaultValue: {
|
103
|
-
control: {
|
104
|
-
type: string;
|
105
|
-
};
|
106
|
-
};
|
107
|
-
hasAutoFocus: {
|
108
|
-
control: {
|
109
|
-
type: string;
|
110
|
-
};
|
111
|
-
};
|
112
|
-
id: {
|
113
|
-
control: {
|
114
|
-
type: string;
|
115
|
-
};
|
116
|
-
};
|
117
|
-
isDisabled: {
|
118
|
-
control: {
|
119
|
-
type: string;
|
120
|
-
};
|
121
|
-
};
|
122
|
-
isReadOnly: {
|
123
|
-
control: {
|
124
|
-
type: string;
|
125
|
-
};
|
126
|
-
};
|
127
|
-
isRequired: {
|
128
|
-
control: {
|
129
|
-
type: string;
|
130
|
-
};
|
131
|
-
};
|
132
|
-
maxValue: {
|
133
|
-
control: {
|
134
|
-
type: string;
|
135
|
-
};
|
136
|
-
};
|
137
|
-
minValue: {
|
138
|
-
control: {
|
139
|
-
type: string;
|
140
|
-
};
|
141
|
-
};
|
142
|
-
onChange: {
|
143
|
-
control: {
|
144
|
-
type: string;
|
145
|
-
};
|
146
|
-
action: string;
|
147
|
-
};
|
148
|
-
onFocusChange: {
|
149
|
-
control: {
|
150
|
-
type: string;
|
151
|
-
};
|
152
|
-
action: string;
|
153
|
-
};
|
154
|
-
};
|
155
|
-
args: {
|
156
|
-
hasAutoFocus: boolean;
|
157
|
-
isDisabled: boolean;
|
158
|
-
isReadOnly: boolean;
|
159
|
-
isRequired: boolean;
|
160
|
-
onChange: null;
|
161
|
-
onFocusChange: null;
|
162
|
-
defaultFocusedValue: string;
|
163
|
-
};
|
164
|
-
};
|
165
|
-
export default _default;
|
166
|
-
export declare const Default: StoryFn<CalendarProps>;
|
167
|
-
export declare const DefaultValue: {
|
168
|
-
(): React.JSX.Element;
|
169
|
-
parameters: {
|
170
|
-
design: {
|
171
|
-
type: string;
|
172
|
-
url: string;
|
173
|
-
};
|
174
|
-
};
|
175
|
-
};
|
176
|
-
export declare const Disabled: {
|
177
|
-
(args: any): React.JSX.Element;
|
178
|
-
parameters: {
|
179
|
-
design: {
|
180
|
-
type: string;
|
181
|
-
url: string;
|
182
|
-
};
|
183
|
-
};
|
184
|
-
};
|
185
|
-
export declare const UnavailableDates: {
|
186
|
-
(): React.JSX.Element;
|
187
|
-
parameters: {
|
188
|
-
design: {
|
189
|
-
type: string;
|
190
|
-
url: string;
|
191
|
-
};
|
192
|
-
};
|
193
|
-
};
|
194
|
-
export declare const MinimumDate: {
|
195
|
-
(): React.JSX.Element;
|
196
|
-
parameters: {
|
197
|
-
design: {
|
198
|
-
type: string;
|
199
|
-
url: string;
|
200
|
-
};
|
201
|
-
};
|
202
|
-
};
|
203
|
-
export declare const MaximumDate: {
|
204
|
-
(): React.JSX.Element;
|
205
|
-
parameters: {
|
206
|
-
design: {
|
207
|
-
type: string;
|
208
|
-
url: string;
|
209
|
-
};
|
210
|
-
};
|
211
|
-
};
|
212
|
-
export declare const Controlled: (args: any) => React.JSX.Element;
|
@@ -1,225 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
-
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
5
|
-
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
6
|
-
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
7
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
8
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
9
|
-
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
10
|
-
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
11
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
12
|
-
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
13
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
14
|
-
_Object$defineProperty(exports, "__esModule", {
|
15
|
-
value: true
|
16
|
-
});
|
17
|
-
exports["default"] = exports.UnavailableDates = exports.MinimumDate = exports.MaximumDate = exports.Disabled = exports.DefaultValue = exports.Default = exports.Controlled = void 0;
|
18
|
-
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
19
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
20
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
21
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
22
|
-
var _react = _interopRequireWildcard(require("react"));
|
23
|
-
var _date = require("@internationalized/date");
|
24
|
-
var _storybookAddonDesigns = require("storybook-addon-designs");
|
25
|
-
var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
|
26
|
-
var _figmaLinks = require("../../utils/designUtils/figmaLinks");
|
27
|
-
var _ariaAttributes = require("../../utils/docUtils/ariaAttributes");
|
28
|
-
var _Calendar = _interopRequireDefault(require("./Calendar.mdx"));
|
29
|
-
var _ = _interopRequireDefault(require("."));
|
30
|
-
var _react2 = require("@emotion/react");
|
31
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
33
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
34
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
35
|
-
var _default = {
|
36
|
-
title: 'Components/Calendar',
|
37
|
-
component: _["default"],
|
38
|
-
decorators: [_storybookAddonDesigns.withDesign],
|
39
|
-
parameters: {
|
40
|
-
actions: {
|
41
|
-
argTypesRegex: '^on.*'
|
42
|
-
},
|
43
|
-
docs: {
|
44
|
-
source: {
|
45
|
-
type: 'code'
|
46
|
-
},
|
47
|
-
page: function page() {
|
48
|
-
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_Calendar["default"], null), (0, _react2.jsx)(_storybookDocsLayout["default"], null));
|
49
|
-
}
|
50
|
-
}
|
51
|
-
},
|
52
|
-
argTypes: _objectSpread({
|
53
|
-
customWeekDays: {
|
54
|
-
control: {
|
55
|
-
type: 'array'
|
56
|
-
}
|
57
|
-
},
|
58
|
-
value: {
|
59
|
-
control: {
|
60
|
-
type: 'text'
|
61
|
-
}
|
62
|
-
},
|
63
|
-
defaultValue: {
|
64
|
-
control: {
|
65
|
-
type: 'text'
|
66
|
-
}
|
67
|
-
},
|
68
|
-
hasAutoFocus: {
|
69
|
-
control: {
|
70
|
-
type: 'boolean'
|
71
|
-
}
|
72
|
-
},
|
73
|
-
id: {
|
74
|
-
control: {
|
75
|
-
type: 'text'
|
76
|
-
}
|
77
|
-
},
|
78
|
-
isDisabled: {
|
79
|
-
control: {
|
80
|
-
type: 'boolean'
|
81
|
-
}
|
82
|
-
},
|
83
|
-
isReadOnly: {
|
84
|
-
control: {
|
85
|
-
type: 'boolean'
|
86
|
-
}
|
87
|
-
},
|
88
|
-
isRequired: {
|
89
|
-
control: {
|
90
|
-
type: 'boolean'
|
91
|
-
}
|
92
|
-
},
|
93
|
-
maxValue: {
|
94
|
-
control: {
|
95
|
-
type: 'text'
|
96
|
-
}
|
97
|
-
},
|
98
|
-
minValue: {
|
99
|
-
control: {
|
100
|
-
type: 'text'
|
101
|
-
}
|
102
|
-
},
|
103
|
-
onChange: {
|
104
|
-
control: {
|
105
|
-
type: 'func'
|
106
|
-
},
|
107
|
-
action: 'change'
|
108
|
-
},
|
109
|
-
onFocusChange: {
|
110
|
-
control: {
|
111
|
-
type: 'func'
|
112
|
-
},
|
113
|
-
action: 'focus change'
|
114
|
-
}
|
115
|
-
}, _ariaAttributes.ariaAttributeBaseArgTypes),
|
116
|
-
args: {
|
117
|
-
hasAutoFocus: false,
|
118
|
-
isDisabled: false,
|
119
|
-
isReadOnly: false,
|
120
|
-
isRequired: false,
|
121
|
-
onChange: null,
|
122
|
-
onFocusChange: null,
|
123
|
-
defaultFocusedValue: '2030-01-15'
|
124
|
-
}
|
125
|
-
};
|
126
|
-
exports["default"] = _default;
|
127
|
-
var Default = function Default(args) {
|
128
|
-
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, args, {
|
129
|
-
"aria-label": "calendar-default"
|
130
|
-
}));
|
131
|
-
};
|
132
|
-
exports.Default = Default;
|
133
|
-
Default.parameters = {
|
134
|
-
design: {
|
135
|
-
type: 'figma',
|
136
|
-
url: _figmaLinks.FIGMA_LINKS.calendar["default"]
|
137
|
-
}
|
138
|
-
};
|
139
|
-
var DefaultValue = function DefaultValue() {
|
140
|
-
return (0, _react2.jsx)(_["default"], {
|
141
|
-
"aria-label": "calendar-with-default-value",
|
142
|
-
defaultValue: "2030-01-15"
|
143
|
-
});
|
144
|
-
};
|
145
|
-
exports.DefaultValue = DefaultValue;
|
146
|
-
DefaultValue.parameters = {
|
147
|
-
design: {
|
148
|
-
type: 'figma',
|
149
|
-
url: _figmaLinks.FIGMA_LINKS.calendar.defaultValue
|
150
|
-
}
|
151
|
-
};
|
152
|
-
var Disabled = function Disabled(args) {
|
153
|
-
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, args, {
|
154
|
-
"aria-label": "calendar-component-disabled",
|
155
|
-
isDisabled: true
|
156
|
-
}));
|
157
|
-
};
|
158
|
-
exports.Disabled = Disabled;
|
159
|
-
Disabled.parameters = {
|
160
|
-
design: {
|
161
|
-
type: 'figma',
|
162
|
-
url: _figmaLinks.FIGMA_LINKS.calendar.disabled
|
163
|
-
}
|
164
|
-
};
|
165
|
-
var UnavailableDates = function UnavailableDates() {
|
166
|
-
var unavailableRanges = [['2030-07-28', '2030-08-03'], ['2030-08-11', '2030-08-17'], ['2030-08-25', '2030-08-31']];
|
167
|
-
// This function is run against each date in the calendar
|
168
|
-
var isDateUnavailable = function isDateUnavailable(date) {
|
169
|
-
return (0, _some["default"])(unavailableRanges).call(unavailableRanges, function (interval) {
|
170
|
-
return date.compare((0, _date.parseDate)(interval[0])) >= 0 && date.compare((0, _date.parseDate)(interval[1])) <= 0;
|
171
|
-
});
|
172
|
-
};
|
173
|
-
return (0, _react2.jsx)(_["default"], {
|
174
|
-
"aria-label": "calendar-component-unavailable-dates",
|
175
|
-
defaultValue: "2030-08-07",
|
176
|
-
isDateUnavailable: isDateUnavailable
|
177
|
-
});
|
178
|
-
};
|
179
|
-
exports.UnavailableDates = UnavailableDates;
|
180
|
-
UnavailableDates.parameters = {
|
181
|
-
design: {
|
182
|
-
type: 'figma',
|
183
|
-
url: _figmaLinks.FIGMA_LINKS.calendar.unavailableDates
|
184
|
-
}
|
185
|
-
};
|
186
|
-
var MinimumDate = function MinimumDate() {
|
187
|
-
return (0, _react2.jsx)(_["default"], {
|
188
|
-
"aria-label": "calendar-component-min-date",
|
189
|
-
minValue: "2030-01-15",
|
190
|
-
defaultValue: "2030-01-15"
|
191
|
-
});
|
192
|
-
};
|
193
|
-
exports.MinimumDate = MinimumDate;
|
194
|
-
MinimumDate.parameters = {
|
195
|
-
design: {
|
196
|
-
type: 'figma',
|
197
|
-
url: _figmaLinks.FIGMA_LINKS.calendar.minimumDate
|
198
|
-
}
|
199
|
-
};
|
200
|
-
var MaximumDate = function MaximumDate() {
|
201
|
-
return (0, _react2.jsx)(_["default"], {
|
202
|
-
"aria-label": "calendar-component-max-date",
|
203
|
-
maxValue: "2030-01-15",
|
204
|
-
defaultValue: "2030-01-15"
|
205
|
-
});
|
206
|
-
};
|
207
|
-
exports.MaximumDate = MaximumDate;
|
208
|
-
MaximumDate.parameters = {
|
209
|
-
design: {
|
210
|
-
type: 'figma',
|
211
|
-
url: _figmaLinks.FIGMA_LINKS.calendar.maximumDate
|
212
|
-
}
|
213
|
-
};
|
214
|
-
var Controlled = function Controlled(args) {
|
215
|
-
var _useState = (0, _react.useState)(null),
|
216
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
217
|
-
date = _useState2[0],
|
218
|
-
setDate = _useState2[1];
|
219
|
-
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, args, {
|
220
|
-
"aria-label": "calendar-component-controlled",
|
221
|
-
value: date,
|
222
|
-
onChange: setDate
|
223
|
-
}));
|
224
|
-
};
|
225
|
-
exports.Controlled = Controlled;
|
@@ -1,206 +0,0 @@
|
|
1
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
2
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
3
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
|
-
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
5
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
|
-
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
7
|
-
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
8
|
-
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
9
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
10
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
11
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
12
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
|
-
import React, { useState } from 'react';
|
16
|
-
import { parseDate } from '@internationalized/date';
|
17
|
-
import { withDesign } from 'storybook-addon-designs';
|
18
|
-
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
19
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
20
|
-
import { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
21
|
-
import CalendarReadme from './Calendar.mdx';
|
22
|
-
import Calendar from '.';
|
23
|
-
import { jsx as ___EmotionJSX } from "@emotion/react";
|
24
|
-
export default {
|
25
|
-
title: 'Components/Calendar',
|
26
|
-
component: Calendar,
|
27
|
-
decorators: [withDesign],
|
28
|
-
parameters: {
|
29
|
-
actions: {
|
30
|
-
argTypesRegex: '^on.*'
|
31
|
-
},
|
32
|
-
docs: {
|
33
|
-
source: {
|
34
|
-
type: 'code'
|
35
|
-
},
|
36
|
-
page: function page() {
|
37
|
-
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(CalendarReadme, null), ___EmotionJSX(DocsLayout, null));
|
38
|
-
}
|
39
|
-
}
|
40
|
-
},
|
41
|
-
argTypes: _objectSpread({
|
42
|
-
customWeekDays: {
|
43
|
-
control: {
|
44
|
-
type: 'array'
|
45
|
-
}
|
46
|
-
},
|
47
|
-
value: {
|
48
|
-
control: {
|
49
|
-
type: 'text'
|
50
|
-
}
|
51
|
-
},
|
52
|
-
defaultValue: {
|
53
|
-
control: {
|
54
|
-
type: 'text'
|
55
|
-
}
|
56
|
-
},
|
57
|
-
hasAutoFocus: {
|
58
|
-
control: {
|
59
|
-
type: 'boolean'
|
60
|
-
}
|
61
|
-
},
|
62
|
-
id: {
|
63
|
-
control: {
|
64
|
-
type: 'text'
|
65
|
-
}
|
66
|
-
},
|
67
|
-
isDisabled: {
|
68
|
-
control: {
|
69
|
-
type: 'boolean'
|
70
|
-
}
|
71
|
-
},
|
72
|
-
isReadOnly: {
|
73
|
-
control: {
|
74
|
-
type: 'boolean'
|
75
|
-
}
|
76
|
-
},
|
77
|
-
isRequired: {
|
78
|
-
control: {
|
79
|
-
type: 'boolean'
|
80
|
-
}
|
81
|
-
},
|
82
|
-
maxValue: {
|
83
|
-
control: {
|
84
|
-
type: 'text'
|
85
|
-
}
|
86
|
-
},
|
87
|
-
minValue: {
|
88
|
-
control: {
|
89
|
-
type: 'text'
|
90
|
-
}
|
91
|
-
},
|
92
|
-
onChange: {
|
93
|
-
control: {
|
94
|
-
type: 'func'
|
95
|
-
},
|
96
|
-
action: 'change'
|
97
|
-
},
|
98
|
-
onFocusChange: {
|
99
|
-
control: {
|
100
|
-
type: 'func'
|
101
|
-
},
|
102
|
-
action: 'focus change'
|
103
|
-
}
|
104
|
-
}, ariaAttributeBaseArgTypes),
|
105
|
-
args: {
|
106
|
-
hasAutoFocus: false,
|
107
|
-
isDisabled: false,
|
108
|
-
isReadOnly: false,
|
109
|
-
isRequired: false,
|
110
|
-
onChange: null,
|
111
|
-
onFocusChange: null,
|
112
|
-
defaultFocusedValue: '2030-01-15'
|
113
|
-
}
|
114
|
-
};
|
115
|
-
export var Default = function Default(args) {
|
116
|
-
return ___EmotionJSX(Calendar, _extends({}, args, {
|
117
|
-
"aria-label": "calendar-default"
|
118
|
-
}));
|
119
|
-
};
|
120
|
-
Default.parameters = {
|
121
|
-
design: {
|
122
|
-
type: 'figma',
|
123
|
-
url: FIGMA_LINKS.calendar["default"]
|
124
|
-
}
|
125
|
-
};
|
126
|
-
export var DefaultValue = function DefaultValue() {
|
127
|
-
return ___EmotionJSX(Calendar, {
|
128
|
-
"aria-label": "calendar-with-default-value",
|
129
|
-
defaultValue: "2030-01-15"
|
130
|
-
});
|
131
|
-
};
|
132
|
-
DefaultValue.parameters = {
|
133
|
-
design: {
|
134
|
-
type: 'figma',
|
135
|
-
url: FIGMA_LINKS.calendar.defaultValue
|
136
|
-
}
|
137
|
-
};
|
138
|
-
export var Disabled = function Disabled(args) {
|
139
|
-
return ___EmotionJSX(Calendar, _extends({}, args, {
|
140
|
-
"aria-label": "calendar-component-disabled",
|
141
|
-
isDisabled: true
|
142
|
-
}));
|
143
|
-
};
|
144
|
-
Disabled.parameters = {
|
145
|
-
design: {
|
146
|
-
type: 'figma',
|
147
|
-
url: FIGMA_LINKS.calendar.disabled
|
148
|
-
}
|
149
|
-
};
|
150
|
-
export var UnavailableDates = function UnavailableDates() {
|
151
|
-
var unavailableRanges = [['2030-07-28', '2030-08-03'], ['2030-08-11', '2030-08-17'], ['2030-08-25', '2030-08-31']];
|
152
|
-
// This function is run against each date in the calendar
|
153
|
-
var isDateUnavailable = function isDateUnavailable(date) {
|
154
|
-
return _someInstanceProperty(unavailableRanges).call(unavailableRanges, function (interval) {
|
155
|
-
return date.compare(parseDate(interval[0])) >= 0 && date.compare(parseDate(interval[1])) <= 0;
|
156
|
-
});
|
157
|
-
};
|
158
|
-
return ___EmotionJSX(Calendar, {
|
159
|
-
"aria-label": "calendar-component-unavailable-dates",
|
160
|
-
defaultValue: "2030-08-07",
|
161
|
-
isDateUnavailable: isDateUnavailable
|
162
|
-
});
|
163
|
-
};
|
164
|
-
UnavailableDates.parameters = {
|
165
|
-
design: {
|
166
|
-
type: 'figma',
|
167
|
-
url: FIGMA_LINKS.calendar.unavailableDates
|
168
|
-
}
|
169
|
-
};
|
170
|
-
export var MinimumDate = function MinimumDate() {
|
171
|
-
return ___EmotionJSX(Calendar, {
|
172
|
-
"aria-label": "calendar-component-min-date",
|
173
|
-
minValue: "2030-01-15",
|
174
|
-
defaultValue: "2030-01-15"
|
175
|
-
});
|
176
|
-
};
|
177
|
-
MinimumDate.parameters = {
|
178
|
-
design: {
|
179
|
-
type: 'figma',
|
180
|
-
url: FIGMA_LINKS.calendar.minimumDate
|
181
|
-
}
|
182
|
-
};
|
183
|
-
export var MaximumDate = function MaximumDate() {
|
184
|
-
return ___EmotionJSX(Calendar, {
|
185
|
-
"aria-label": "calendar-component-max-date",
|
186
|
-
maxValue: "2030-01-15",
|
187
|
-
defaultValue: "2030-01-15"
|
188
|
-
});
|
189
|
-
};
|
190
|
-
MaximumDate.parameters = {
|
191
|
-
design: {
|
192
|
-
type: 'figma',
|
193
|
-
url: FIGMA_LINKS.calendar.maximumDate
|
194
|
-
}
|
195
|
-
};
|
196
|
-
export var Controlled = function Controlled(args) {
|
197
|
-
var _useState = useState(null),
|
198
|
-
_useState2 = _slicedToArray(_useState, 2),
|
199
|
-
date = _useState2[0],
|
200
|
-
setDate = _useState2[1];
|
201
|
-
return ___EmotionJSX(Calendar, _extends({}, args, {
|
202
|
-
"aria-label": "calendar-component-controlled",
|
203
|
-
value: date,
|
204
|
-
onChange: setDate
|
205
|
-
}));
|
206
|
-
};
|