@pingux/astro 2.37.0-alpha.2 → 2.37.0-alpha.3
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.
@@ -37,11 +37,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
37
37
|
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; }
|
38
38
|
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; }
|
39
39
|
var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
40
|
-
var
|
40
|
+
var defaultFocusedValue = props.defaultFocusedValue,
|
41
41
|
defaultValue = props.defaultValue,
|
42
|
-
|
42
|
+
hasAutoFocus = props.hasAutoFocus,
|
43
43
|
maxValue = props.maxValue,
|
44
|
-
|
44
|
+
minValue = props.minValue,
|
45
|
+
value = props.value;
|
45
46
|
var _useLocale = (0, _i18n.useLocale)(),
|
46
47
|
locale = _useLocale.locale;
|
47
48
|
var calenderRef = (0, _react.useRef)();
|
@@ -53,6 +54,7 @@ var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
53
54
|
var parsedDates = {
|
54
55
|
value: typeof value === 'string' && (0, _date.parseDate)(value) || value,
|
55
56
|
defaultValue: typeof defaultValue === 'string' && (0, _date.parseDate)(defaultValue) || defaultValue,
|
57
|
+
defaultFocusedValue: typeof defaultFocusedValue === 'string' && (0, _date.parseDate)(defaultFocusedValue) || defaultFocusedValue,
|
56
58
|
maxValue: typeof maxValue === 'string' && (0, _date.parseDate)(maxValue) || maxValue,
|
57
59
|
minValue: typeof minValue === 'string' && (0, _date.parseDate)(minValue) || minValue
|
58
60
|
};
|
@@ -179,6 +181,8 @@ var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
179
181
|
Calendar.propTypes = {
|
180
182
|
/** Prop to provide a custom default date (uncontrolled) */
|
181
183
|
defaultValue: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
184
|
+
/** Prop to provide a custom default focused date (uncontrolled) */
|
185
|
+
defaultFocusedValue: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
182
186
|
/** Prop to provide a default date (controlled) */
|
183
187
|
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
184
188
|
/** custom week days for other calendars */
|
@@ -119,7 +119,8 @@ var _default = {
|
|
119
119
|
isReadOnly: false,
|
120
120
|
isRequired: false,
|
121
121
|
onChange: null,
|
122
|
-
onFocusChange: null
|
122
|
+
onFocusChange: null,
|
123
|
+
defaultFocusedValue: '2023-11-15'
|
123
124
|
}
|
124
125
|
};
|
125
126
|
exports["default"] = _default;
|
@@ -135,11 +136,11 @@ Default.parameters = {
|
|
135
136
|
url: _figmaLinks.FIGMA_LINKS.calendar["default"]
|
136
137
|
}
|
137
138
|
};
|
138
|
-
var DefaultValue = function DefaultValue(
|
139
|
-
return (0, _react2.jsx)(_Calendar["default"],
|
139
|
+
var DefaultValue = function DefaultValue() {
|
140
|
+
return (0, _react2.jsx)(_Calendar["default"], {
|
140
141
|
"aria-label": "calendar-with-default-value",
|
141
142
|
defaultValue: "2022-08-10"
|
142
|
-
})
|
143
|
+
});
|
143
144
|
};
|
144
145
|
exports.DefaultValue = DefaultValue;
|
145
146
|
DefaultValue.parameters = {
|
@@ -161,7 +162,7 @@ Disabled.parameters = {
|
|
161
162
|
url: _figmaLinks.FIGMA_LINKS.calendar.disabled
|
162
163
|
}
|
163
164
|
};
|
164
|
-
var UnavailableDates = function UnavailableDates(
|
165
|
+
var UnavailableDates = function UnavailableDates() {
|
165
166
|
var unavailableRanges = [['2022-07-29', '2022-08-05'], ['2022-08-15', '2022-08-20'], ['2022-08-25', '2022-08-26']];
|
166
167
|
// This function is run against each date in the calendar
|
167
168
|
var isDateUnavailable = function isDateUnavailable(date) {
|
@@ -169,11 +170,11 @@ var UnavailableDates = function UnavailableDates(args) {
|
|
169
170
|
return date.compare((0, _date.parseDate)(interval[0])) >= 0 && date.compare((0, _date.parseDate)(interval[1])) <= 0;
|
170
171
|
});
|
171
172
|
};
|
172
|
-
return (0, _react2.jsx)(_Calendar["default"],
|
173
|
+
return (0, _react2.jsx)(_Calendar["default"], {
|
173
174
|
"aria-label": "calendar-component-unavailable-dates",
|
174
175
|
defaultValue: "2022-08-10",
|
175
176
|
isDateUnavailable: isDateUnavailable
|
176
|
-
})
|
177
|
+
});
|
177
178
|
};
|
178
179
|
exports.UnavailableDates = UnavailableDates;
|
179
180
|
UnavailableDates.parameters = {
|
@@ -182,12 +183,12 @@ UnavailableDates.parameters = {
|
|
182
183
|
url: _figmaLinks.FIGMA_LINKS.calendar.unavailableDates
|
183
184
|
}
|
184
185
|
};
|
185
|
-
var MinimumDate = function MinimumDate(
|
186
|
-
return (0, _react2.jsx)(_Calendar["default"],
|
186
|
+
var MinimumDate = function MinimumDate() {
|
187
|
+
return (0, _react2.jsx)(_Calendar["default"], {
|
187
188
|
"aria-label": "calendar-component-min-date",
|
188
189
|
minValue: "2022-09-10",
|
189
|
-
|
190
|
-
})
|
190
|
+
defaultValue: "2022-09-14"
|
191
|
+
});
|
191
192
|
};
|
192
193
|
exports.MinimumDate = MinimumDate;
|
193
194
|
MinimumDate.parameters = {
|
@@ -196,12 +197,12 @@ MinimumDate.parameters = {
|
|
196
197
|
url: _figmaLinks.FIGMA_LINKS.calendar.minimumDate
|
197
198
|
}
|
198
199
|
};
|
199
|
-
var MaximumDate = function MaximumDate(
|
200
|
-
return (0, _react2.jsx)(_Calendar["default"],
|
200
|
+
var MaximumDate = function MaximumDate() {
|
201
|
+
return (0, _react2.jsx)(_Calendar["default"], {
|
201
202
|
"aria-label": "calendar-component-max-date",
|
202
203
|
maxValue: "2022-10-10",
|
203
204
|
defaultValue: "2022-10-05"
|
204
|
-
})
|
205
|
+
});
|
205
206
|
};
|
206
207
|
exports.MaximumDate = MaximumDate;
|
207
208
|
MaximumDate.parameters = {
|
@@ -26,11 +26,12 @@ import { Box, Button, Icon, IconButton, Text } from '../../index';
|
|
26
26
|
import CalendarGrid from './CalendarGrid';
|
27
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
28
28
|
var Calendar = /*#__PURE__*/forwardRef(function (props, ref) {
|
29
|
-
var
|
29
|
+
var defaultFocusedValue = props.defaultFocusedValue,
|
30
30
|
defaultValue = props.defaultValue,
|
31
|
-
|
31
|
+
hasAutoFocus = props.hasAutoFocus,
|
32
32
|
maxValue = props.maxValue,
|
33
|
-
|
33
|
+
minValue = props.minValue,
|
34
|
+
value = props.value;
|
34
35
|
var _useLocale = useLocale(),
|
35
36
|
locale = _useLocale.locale;
|
36
37
|
var calenderRef = useRef();
|
@@ -42,6 +43,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
42
43
|
var parsedDates = {
|
43
44
|
value: typeof value === 'string' && parseDate(value) || value,
|
44
45
|
defaultValue: typeof defaultValue === 'string' && parseDate(defaultValue) || defaultValue,
|
46
|
+
defaultFocusedValue: typeof defaultFocusedValue === 'string' && parseDate(defaultFocusedValue) || defaultFocusedValue,
|
45
47
|
maxValue: typeof maxValue === 'string' && parseDate(maxValue) || maxValue,
|
46
48
|
minValue: typeof minValue === 'string' && parseDate(minValue) || minValue
|
47
49
|
};
|
@@ -168,6 +170,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
168
170
|
Calendar.propTypes = {
|
169
171
|
/** Prop to provide a custom default date (uncontrolled) */
|
170
172
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
173
|
+
/** Prop to provide a custom default focused date (uncontrolled) */
|
174
|
+
defaultFocusedValue: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
171
175
|
/** Prop to provide a default date (controlled) */
|
172
176
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
173
177
|
/** custom week days for other calendars */
|
@@ -108,7 +108,8 @@ export default {
|
|
108
108
|
isReadOnly: false,
|
109
109
|
isRequired: false,
|
110
110
|
onChange: null,
|
111
|
-
onFocusChange: null
|
111
|
+
onFocusChange: null,
|
112
|
+
defaultFocusedValue: '2023-11-15'
|
112
113
|
}
|
113
114
|
};
|
114
115
|
export var Default = function Default(args) {
|
@@ -122,11 +123,11 @@ Default.parameters = {
|
|
122
123
|
url: FIGMA_LINKS.calendar["default"]
|
123
124
|
}
|
124
125
|
};
|
125
|
-
export var DefaultValue = function DefaultValue(
|
126
|
-
return ___EmotionJSX(Calendar,
|
126
|
+
export var DefaultValue = function DefaultValue() {
|
127
|
+
return ___EmotionJSX(Calendar, {
|
127
128
|
"aria-label": "calendar-with-default-value",
|
128
129
|
defaultValue: "2022-08-10"
|
129
|
-
})
|
130
|
+
});
|
130
131
|
};
|
131
132
|
DefaultValue.parameters = {
|
132
133
|
design: {
|
@@ -146,7 +147,7 @@ Disabled.parameters = {
|
|
146
147
|
url: FIGMA_LINKS.calendar.disabled
|
147
148
|
}
|
148
149
|
};
|
149
|
-
export var UnavailableDates = function UnavailableDates(
|
150
|
+
export var UnavailableDates = function UnavailableDates() {
|
150
151
|
var unavailableRanges = [['2022-07-29', '2022-08-05'], ['2022-08-15', '2022-08-20'], ['2022-08-25', '2022-08-26']];
|
151
152
|
// This function is run against each date in the calendar
|
152
153
|
var isDateUnavailable = function isDateUnavailable(date) {
|
@@ -154,11 +155,11 @@ export var UnavailableDates = function UnavailableDates(args) {
|
|
154
155
|
return date.compare(parseDate(interval[0])) >= 0 && date.compare(parseDate(interval[1])) <= 0;
|
155
156
|
});
|
156
157
|
};
|
157
|
-
return ___EmotionJSX(Calendar,
|
158
|
+
return ___EmotionJSX(Calendar, {
|
158
159
|
"aria-label": "calendar-component-unavailable-dates",
|
159
160
|
defaultValue: "2022-08-10",
|
160
161
|
isDateUnavailable: isDateUnavailable
|
161
|
-
})
|
162
|
+
});
|
162
163
|
};
|
163
164
|
UnavailableDates.parameters = {
|
164
165
|
design: {
|
@@ -166,12 +167,12 @@ UnavailableDates.parameters = {
|
|
166
167
|
url: FIGMA_LINKS.calendar.unavailableDates
|
167
168
|
}
|
168
169
|
};
|
169
|
-
export var MinimumDate = function MinimumDate(
|
170
|
-
return ___EmotionJSX(Calendar,
|
170
|
+
export var MinimumDate = function MinimumDate() {
|
171
|
+
return ___EmotionJSX(Calendar, {
|
171
172
|
"aria-label": "calendar-component-min-date",
|
172
173
|
minValue: "2022-09-10",
|
173
|
-
|
174
|
-
})
|
174
|
+
defaultValue: "2022-09-14"
|
175
|
+
});
|
175
176
|
};
|
176
177
|
MinimumDate.parameters = {
|
177
178
|
design: {
|
@@ -179,12 +180,12 @@ MinimumDate.parameters = {
|
|
179
180
|
url: FIGMA_LINKS.calendar.minimumDate
|
180
181
|
}
|
181
182
|
};
|
182
|
-
export var MaximumDate = function MaximumDate(
|
183
|
-
return ___EmotionJSX(Calendar,
|
183
|
+
export var MaximumDate = function MaximumDate() {
|
184
|
+
return ___EmotionJSX(Calendar, {
|
184
185
|
"aria-label": "calendar-component-max-date",
|
185
186
|
maxValue: "2022-10-10",
|
186
187
|
defaultValue: "2022-10-05"
|
187
|
-
})
|
188
|
+
});
|
188
189
|
};
|
189
190
|
MaximumDate.parameters = {
|
190
191
|
design: {
|