@onesy/ui-react 1.0.79 → 1.0.81
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.
@@ -288,11 +288,12 @@ const CalendarAvailability = react_1.default.forwardRef((props_, ref) => {
|
|
288
288
|
return palette[rangeShade];
|
289
289
|
}, [rangeShade, style_react_1.colors, theme]);
|
290
290
|
const itemToText = react_1.default.useCallback((item) => {
|
291
|
+
var _a, _b;
|
291
292
|
if (item === 'pending')
|
292
|
-
return '
|
293
|
+
return l('Scheduled');
|
293
294
|
if (item === 'not-count-workout-session')
|
294
|
-
return `
|
295
|
-
return item;
|
295
|
+
return l(`Don't count workout session`);
|
296
|
+
return (_b = (_a = optionsStatus === null || optionsStatus === void 0 ? void 0 : optionsStatus.find(itemStatus => itemStatus.value === item)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : l(item);
|
296
297
|
}, []);
|
297
298
|
const viewOptions = react_1.default.useMemo(() => {
|
298
299
|
return viewsProps === null || viewsProps === void 0 ? void 0 : viewsProps.map(item => ({
|
@@ -370,20 +371,12 @@ const CalendarAvailability = react_1.default.forwardRef((props_, ref) => {
|
|
370
371
|
(0, utils_2.staticClassName)('CalendarAvailability', theme) && [
|
371
372
|
'onesy-CalendarAvailability-header'
|
372
373
|
]
|
373
|
-
]) }, { children: [startHeader, (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 2, direction: 'row', wrap: 'wrap', justify: 'space-between', align: 'center', fullWidth: true }, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1.5, direction: 'row', wrap: 'wrap', align: 'center', className: classes.aside }, { children: [startLeft, (0, jsx_runtime_1.jsx)(Button, Object.assign({ color: 'inherit', version: 'outlined', size: 'small', onClick: onToday, selected: now.days === date.days }, { children: l('Today') })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: `${l('Previous')} ${view}` }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onPrevious }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconPrevious, { size: 'regular' }) })) })), (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: `${l('Next')} ${view}` }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onNext }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconNext, { size: 'regular' }) })) }))] })), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'h2', weight: 500, whiteSpace: 'nowrap' }, { children: formattedDate })), endLeft] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1.5, direction: 'row', align: 'center', flexNo: true, className: (0, style_react_1.classNames)([
|
374
|
+
]) }, { children: [startHeader, (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 2, direction: 'row', wrap: 'wrap', justify: 'space-between', align: 'center', fullWidth: true }, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1.5, direction: 'row', wrap: 'wrap', align: 'center', className: classes.aside }, { children: [startLeft, (0, jsx_runtime_1.jsx)(Button, Object.assign({ color: 'inherit', version: 'outlined', size: 'small', onClick: onToday, selected: now.days === date.days }, { children: l('Today') })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: `${l('Previous')} ${l(view)}` }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onPrevious }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconPrevious, { size: 'regular' }) })) })), (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: `${l('Next')} ${l(view)}` }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onNext }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconNext, { size: 'regular' }) })) }))] })), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'h2', weight: 500, whiteSpace: 'nowrap' }, { children: formattedDate })), endLeft] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1.5, direction: 'row', align: 'center', flexNo: true, className: (0, style_react_1.classNames)([
|
374
375
|
classes.aside,
|
375
376
|
classes.overflowX
|
376
377
|
]) }, { children: [startRight, ['week', 'day'].includes(view) && ((0, jsx_runtime_1.jsxs)(Label, Object.assign({ checked: displayTime, onChange: onChangeDisplayTime }, { children: [(0, jsx_runtime_1.jsx)(Switch, {}), l('Display time')] }))), (0, jsx_runtime_1.jsx)(Select, { name: l('View'), value: view, onChange: onChangeView, options: viewOptions, size: 'small', MenuProps: {
|
377
378
|
portal: true,
|
378
379
|
size: 'regular'
|
379
|
-
}, WrapperProps: {
|
380
|
-
style: {
|
381
|
-
width: 170,
|
382
|
-
minWidth: 'unset'
|
383
|
-
}
|
384
|
-
}, style: {
|
385
|
-
width: 170,
|
386
|
-
minWidth: 'unset'
|
387
380
|
} }), endRight] }))] })), endHeader] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ ref: refs.calendar, gap: 2, flex: true, fullWidth: true }, { children: [view === 'simple' && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 1, flex: true, fullWidth: true }, { children: (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 4, fullWidth: true, className: (0, style_react_1.classNames)([
|
388
381
|
(0, utils_2.staticClassName)('CalendarAvailability', theme) && [
|
389
382
|
'onesy-CalendarAvailability-simple'
|
@@ -199,6 +199,17 @@ const CalendarWeek = react_1.default.forwardRef((props_, ref) => {
|
|
199
199
|
return item;
|
200
200
|
});
|
201
201
|
}, [times]);
|
202
|
+
const optionsStatus = react_1.default.useMemo(() => {
|
203
|
+
return [
|
204
|
+
{ name: l('Working'), value: 'working' },
|
205
|
+
{ name: l('Not working'), value: 'not-working' },
|
206
|
+
{ name: l('On a break'), value: 'break' },
|
207
|
+
{ name: l('Scheduled'), value: 'pending' },
|
208
|
+
{ name: l('Rescheduled'), value: 'rescheduled' },
|
209
|
+
{ name: l('Cancelled'), value: 'canceled' },
|
210
|
+
{ name: l('Other'), value: 'other' }
|
211
|
+
];
|
212
|
+
}, []);
|
202
213
|
const getColor = react_1.default.useCallback((item) => {
|
203
214
|
let palette = theme.palette.color.neutral;
|
204
215
|
if ((item === null || item === void 0 ? void 0 : item.status) === 'working')
|
@@ -220,11 +231,12 @@ const CalendarWeek = react_1.default.forwardRef((props_, ref) => {
|
|
220
231
|
return palette[rangeShade];
|
221
232
|
}, [rangeShade, style_react_1.colors, theme]);
|
222
233
|
const itemToText = react_1.default.useCallback((item) => {
|
234
|
+
var _a, _b;
|
223
235
|
if (item === 'pending')
|
224
|
-
return '
|
236
|
+
return l('Scheduled');
|
225
237
|
if (item === 'not-count-workout-session')
|
226
|
-
return `
|
227
|
-
return item;
|
238
|
+
return l(`Don't count workout session`);
|
239
|
+
return (_b = (_a = optionsStatus === null || optionsStatus === void 0 ? void 0 : optionsStatus.find(itemStatus => itemStatus.value === item)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : l(item);
|
228
240
|
}, []);
|
229
241
|
const renderTimes = (day, valuesAll, weekly = true, itemDay) => {
|
230
242
|
if (itemDay !== undefined && !(itemDay === null || itemDay === void 0 ? void 0 : itemDay.active))
|
@@ -324,9 +324,9 @@ const CalendarAvailability = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
324
324
|
return palette[rangeShade];
|
325
325
|
}, [rangeShade, colors, theme]);
|
326
326
|
const itemToText = React.useCallback(item => {
|
327
|
-
if (item === 'pending') return '
|
328
|
-
if (item === 'not-count-workout-session') return `
|
329
|
-
return item;
|
327
|
+
if (item === 'pending') return l('Scheduled');
|
328
|
+
if (item === 'not-count-workout-session') return l(`Don't count workout session`);
|
329
|
+
return optionsStatus?.find(itemStatus => itemStatus.value === item)?.name ?? l(item);
|
330
330
|
}, []);
|
331
331
|
const viewOptions = React.useMemo(() => {
|
332
332
|
return viewsProps?.map(item => ({
|
@@ -531,13 +531,13 @@ const CalendarAvailability = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
531
531
|
direction: "row",
|
532
532
|
align: "center"
|
533
533
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
534
|
-
name: `${l('Previous')} ${view}`
|
534
|
+
name: `${l('Previous')} ${l(view)}`
|
535
535
|
}, /*#__PURE__*/React.createElement(IconButton, _extends({
|
536
536
|
onClick: onPrevious
|
537
537
|
}, IconButtonProps), /*#__PURE__*/React.createElement(IconPrevious, {
|
538
538
|
size: "regular"
|
539
539
|
}))), /*#__PURE__*/React.createElement(Tooltip, {
|
540
|
-
name: `${l('Next')} ${view}`
|
540
|
+
name: `${l('Next')} ${l(view)}`
|
541
541
|
}, /*#__PURE__*/React.createElement(IconButton, _extends({
|
542
542
|
onClick: onNext
|
543
543
|
}, IconButtonProps), /*#__PURE__*/React.createElement(IconNext, {
|
@@ -564,16 +564,6 @@ const CalendarAvailability = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
564
564
|
MenuProps: {
|
565
565
|
portal: true,
|
566
566
|
size: 'regular'
|
567
|
-
},
|
568
|
-
WrapperProps: {
|
569
|
-
style: {
|
570
|
-
width: 170,
|
571
|
-
minWidth: 'unset'
|
572
|
-
}
|
573
|
-
},
|
574
|
-
style: {
|
575
|
-
width: 170,
|
576
|
-
minWidth: 'unset'
|
577
567
|
}
|
578
568
|
}), endRight)), endHeader), /*#__PURE__*/React.createElement(Line, {
|
579
569
|
ref: refs.calendar,
|
@@ -199,6 +199,30 @@ const CalendarWeek = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
199
199
|
return item;
|
200
200
|
});
|
201
201
|
}, [times]);
|
202
|
+
const optionsStatus = React.useMemo(() => {
|
203
|
+
return [{
|
204
|
+
name: l('Working'),
|
205
|
+
value: 'working'
|
206
|
+
}, {
|
207
|
+
name: l('Not working'),
|
208
|
+
value: 'not-working'
|
209
|
+
}, {
|
210
|
+
name: l('On a break'),
|
211
|
+
value: 'break'
|
212
|
+
}, {
|
213
|
+
name: l('Scheduled'),
|
214
|
+
value: 'pending'
|
215
|
+
}, {
|
216
|
+
name: l('Rescheduled'),
|
217
|
+
value: 'rescheduled'
|
218
|
+
}, {
|
219
|
+
name: l('Cancelled'),
|
220
|
+
value: 'canceled'
|
221
|
+
}, {
|
222
|
+
name: l('Other'),
|
223
|
+
value: 'other'
|
224
|
+
}];
|
225
|
+
}, []);
|
202
226
|
const getColor = React.useCallback(item => {
|
203
227
|
let palette = theme.palette.color.neutral;
|
204
228
|
if (item?.status === 'working') palette = theme.palette.color.success;
|
@@ -212,9 +236,9 @@ const CalendarWeek = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
212
236
|
return palette[rangeShade];
|
213
237
|
}, [rangeShade, colors, theme]);
|
214
238
|
const itemToText = React.useCallback(item => {
|
215
|
-
if (item === 'pending') return '
|
216
|
-
if (item === 'not-count-workout-session') return `
|
217
|
-
return item;
|
239
|
+
if (item === 'pending') return l('Scheduled');
|
240
|
+
if (item === 'not-count-workout-session') return l(`Don't count workout session`);
|
241
|
+
return optionsStatus?.find(itemStatus => itemStatus.value === item)?.name ?? l(item);
|
218
242
|
}, []);
|
219
243
|
const renderTimes = function (day, valuesAll) {
|
220
244
|
let weekly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
package/esm/index.js
CHANGED