@onesy/ui-react 1.0.58 → 1.0.60
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/AudioPlayer/AudioPlayer.js +6 -23
- package/AudioRecorder/AudioRecorder.js +2 -1
- package/AutoComplete/AutoComplete.js +5 -4
- package/AutoCompleteCountry/AutoCompleteCountry.js +2 -1
- package/AutoCompleteCurrency/AutoCompleteCurrency.js +2 -1
- package/Breadcrumbs/Breadcrumbs.js +3 -2
- package/BubbleChart/BubbleChart.js +3 -2
- package/Calendar/Calendar.js +7 -6
- package/CalendarAvailability/CalendarAvailability.d.ts +4 -1
- package/CalendarAvailability/CalendarAvailability.js +23 -18
- package/CalendarMenu/CalendarMenu.js +6 -5
- package/CalendarMonth/CalendarMonth.js +8 -7
- package/CalendarViews/CalendarViews.d.ts +4 -1
- package/CalendarViews/CalendarViews.js +17 -12
- package/Chart/Chart.js +1 -0
- package/ColorTextField/ColorTextField.js +2 -1
- package/Confirm/Confirm.js +4 -3
- package/CookieBanner/CookieBanner.js +3 -2
- package/Countdown/Countdown.js +5 -4
- package/DatePicker/DatePicker.js +10 -9
- package/DateTimePicker/DateTimePicker.js +5 -4
- package/Drawing/Drawing.js +9 -8
- package/DropZone/DropZone.d.ts +1 -0
- package/DropZone/DropZone.js +3 -2
- package/Emojis/Emojis.js +46 -43
- package/Frame/Frame.js +6 -5
- package/ImageEdit/ImageEdit.js +21 -20
- package/Info/Info.js +2 -1
- package/Links/Links.d.ts +2 -0
- package/Links/Links.js +7 -6
- package/Medias/Medias.js +2 -1
- package/MenuDesktop/MenuDesktop.js +1 -3
- package/NavigationItem/NavigationItem.js +1 -1
- package/NotFound/NotFound.d.ts +1 -0
- package/NotFound/NotFound.js +3 -2
- package/Page/Page.js +2 -1
- package/PieChart/PieChart.js +4 -3
- package/RichTextEditor/RichTextEditor.js +57 -56
- package/ScreenCapture/ScreenCapture.js +2 -1
- package/SectionAction/SectionAction.js +2 -1
- package/SectionBoxes/SectionBoxes.js +2 -1
- package/SectionCards/SectionCards.js +2 -1
- package/SectionCarousel/SectionCarousel.js +2 -1
- package/SectionMedia/SectionMedia.js +2 -1
- package/SectionTextMedia/SectionTextMedia.js +2 -1
- package/Select/Select.js +9 -14
- package/Share/Share.js +15 -14
- package/SmartTextField/SmartTextField.js +13 -12
- package/SpeechToText/SpeechToText.js +3 -2
- package/SpeedDial/SpeedDial.js +1 -1
- package/SpeedDialItem/SpeedDialItem.js +1 -1
- package/TableCell/TableCell.js +2 -1
- package/TablePagination/TablePagination.js +2 -1
- package/TextField/TextField.d.ts +1 -0
- package/TextToSpeech/TextToSpeech.js +4 -3
- package/TimePicker/TimePicker.js +9 -8
- package/Timer/Timer.js +3 -2
- package/VideoPlayer/VideoPlayer.js +5 -4
- package/Widgets/Widgets.js +3 -2
- package/esm/AudioPlayer/AudioPlayer.js +7 -30
- package/esm/AudioRecorder/AudioRecorder.js +8 -7
- package/esm/AutoComplete/AutoComplete.js +5 -4
- package/esm/AutoCompleteCountry/AutoCompleteCountry.js +2 -0
- package/esm/AutoCompleteCurrency/AutoCompleteCurrency.js +2 -1
- package/esm/Breadcrumbs/Breadcrumbs.js +3 -2
- package/esm/BubbleChart/BubbleChart.js +3 -2
- package/esm/Calendar/Calendar.js +9 -8
- package/esm/CalendarAvailability/CalendarAvailability.js +31 -21
- package/esm/CalendarMenu/CalendarMenu.js +7 -6
- package/esm/CalendarMonth/CalendarMonth.js +8 -7
- package/esm/CalendarViews/CalendarViews.js +25 -15
- package/esm/Chart/Chart.js +1 -0
- package/esm/ColorTextField/ColorTextField.js +2 -1
- package/esm/Confirm/Confirm.js +7 -6
- package/esm/CookieBanner/CookieBanner.js +4 -3
- package/esm/Countdown/Countdown.js +10 -9
- package/esm/DatePicker/DatePicker.js +22 -21
- package/esm/DateTimePicker/DateTimePicker.js +11 -10
- package/esm/Drawing/Drawing.js +11 -10
- package/esm/DropZone/DropZone.js +4 -2
- package/esm/Emojis/Emojis.js +37 -34
- package/esm/Frame/Frame.js +6 -5
- package/esm/ImageEdit/ImageEdit.js +25 -24
- package/esm/Info/Info.js +2 -1
- package/esm/Links/Links.js +9 -6
- package/esm/Medias/Medias.js +2 -1
- package/esm/MenuDesktop/MenuDesktop.js +1 -2
- package/esm/NavigationItem/NavigationItem.js +1 -1
- package/esm/NotFound/NotFound.js +5 -3
- package/esm/Page/Page.js +3 -2
- package/esm/PieChart/PieChart.js +4 -4
- package/esm/RichTextEditor/RichTextEditor.js +76 -75
- package/esm/ScreenCapture/ScreenCapture.js +4 -3
- package/esm/SectionAction/SectionAction.js +2 -1
- package/esm/SectionBoxes/SectionBoxes.js +2 -1
- package/esm/SectionCards/SectionCards.js +2 -1
- package/esm/SectionCarousel/SectionCarousel.js +2 -1
- package/esm/SectionMedia/SectionMedia.js +2 -1
- package/esm/SectionTextMedia/SectionTextMedia.js +2 -1
- package/esm/Select/Select.js +11 -7
- package/esm/Share/Share.js +16 -15
- package/esm/SmartTextField/SmartTextField.js +15 -14
- package/esm/SpeechToText/SpeechToText.js +3 -2
- package/esm/SpeedDial/SpeedDial.js +1 -1
- package/esm/SpeedDialItem/SpeedDialItem.js +1 -1
- package/esm/TableCell/TableCell.js +2 -1
- package/esm/TablePagination/TablePagination.js +2 -1
- package/esm/TextToSpeech/TextToSpeech.js +4 -3
- package/esm/TimePicker/TimePicker.js +19 -18
- package/esm/Timer/Timer.js +7 -6
- package/esm/VideoPlayer/VideoPlayer.js +7 -6
- package/esm/Widgets/Widgets.js +3 -2
- package/esm/index.js +1 -1
- package/package.json +2 -2
@@ -123,6 +123,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
123
123
|
const AudioPlayer = react_1.default.forwardRef((props_, ref) => {
|
124
124
|
var _a;
|
125
125
|
const theme = (0, style_react_1.useOnesyTheme)();
|
126
|
+
const l = theme.l;
|
126
127
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyAudioPlayer) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
127
128
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
128
129
|
const Surface = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Surface) || Surface_1.default; }, [theme]);
|
@@ -405,39 +406,21 @@ const AudioPlayer = react_1.default.forwardRef((props_, ref) => {
|
|
405
406
|
};
|
406
407
|
const items = [];
|
407
408
|
if (openMenu) {
|
408
|
-
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ start: ((0, jsx_runtime_1.jsx)(IconBack, { size: 'very small' })), primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: "Back" }))), onClick: () => setOpenMenu(null) }, itemProps), 'back'));
|
409
|
+
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ start: ((0, jsx_runtime_1.jsx)(IconBack, { size: 'very small' })), primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: "l('Back')" }))), onClick: () => setOpenMenu(null) }, itemProps), 'back'));
|
409
410
|
}
|
410
411
|
if (!openMenu) {
|
411
412
|
if (playbackSpeed_)
|
412
|
-
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ start: ((0, jsx_runtime_1.jsx)(IconPlaybackSpeed, { size: 'small' })), primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: "Playback speed" }))), end: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', priority: 'secondary' }, { children: playbackSpeed === 1 ? 'Normal' : playbackSpeed }))), onClick: () => setOpenMenu('playbackSpeed') }, itemProps), 'playbackSpeed'));
|
413
|
+
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ start: ((0, jsx_runtime_1.jsx)(IconPlaybackSpeed, { size: 'small' })), primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: "l('Playback speed')" }))), end: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', priority: 'secondary' }, { children: playbackSpeed === 1 ? 'Normal' : playbackSpeed }))), onClick: () => setOpenMenu('playbackSpeed') }, itemProps), 'playbackSpeed'));
|
413
414
|
if (quality_)
|
414
|
-
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ start: ((0, jsx_runtime_1.jsx)(IconQuality, { size: 'small' })), primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: "Quality" }))), end: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', priority: 'secondary' }, { children: !quality ? 'Original' : `${(_a = quality === null || quality === void 0 ? void 0 : quality.meta) === null || _a === void 0 ? void 0 : _a.resolution}p` }))), onClick: () => setOpenMenu('quality') }, itemProps), 'quality'));
|
415
|
+
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ start: ((0, jsx_runtime_1.jsx)(IconQuality, { size: 'small' })), primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: "l('Quality')" }))), end: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', priority: 'secondary' }, { children: !quality ? l('Original') : `${(_a = quality === null || quality === void 0 ? void 0 : quality.meta) === null || _a === void 0 ? void 0 : _a.resolution}p` }))), onClick: () => setOpenMenu('quality') }, itemProps), 'quality'));
|
415
416
|
}
|
416
417
|
else if (openMenu === 'quality') {
|
417
|
-
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: "Original" }))), onClick: () => quality ? onQuality(null) : undefined, selected: !quality }, itemProps), 'original'));
|
418
|
-
// versions?.forEach((version: any, index: number) => {
|
419
|
-
// const isSelected = quality?.id === version?.id;
|
420
|
-
// items.push(
|
421
|
-
// <ListItem
|
422
|
-
// key={index}
|
423
|
-
// primary={(
|
424
|
-
// <Type
|
425
|
-
// version='b3'
|
426
|
-
// >
|
427
|
-
// {version?.meta?.resolution}p
|
428
|
-
// </Type>
|
429
|
-
// )}
|
430
|
-
// onClick={() => !isSelected ? onQuality(version) : undefined}
|
431
|
-
// selected={isSelected}
|
432
|
-
// {...itemProps}
|
433
|
-
// />
|
434
|
-
// );
|
435
|
-
// });
|
418
|
+
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: "l('Original')" }))), onClick: () => quality ? onQuality(null) : undefined, selected: !quality }, itemProps), 'original'));
|
436
419
|
}
|
437
420
|
else if (openMenu === 'playbackSpeed') {
|
438
421
|
const options = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
439
422
|
options.forEach(option => {
|
440
|
-
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: option === 1 ? 'Normal' : option }))), onClick: () => onPlaybackSpeed(option), selected: playbackSpeed === option }, itemProps), option));
|
423
|
+
items.push((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: option === 1 ? l('Normal') : option }))), onClick: () => onPlaybackSpeed(option), selected: playbackSpeed === option }, itemProps), option));
|
441
424
|
});
|
442
425
|
}
|
443
426
|
return items;
|
@@ -73,6 +73,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
73
73
|
const AudioRecorder = react_1.default.forwardRef((props_, ref) => {
|
74
74
|
var _a;
|
75
75
|
const theme = (0, style_react_1.useOnesyTheme)();
|
76
|
+
const l = theme.l;
|
76
77
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyAudioRecorder) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
77
78
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
78
79
|
const Fade = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Fade) || Fade_1.default; }, [theme]);
|
@@ -260,7 +261,7 @@ const AudioRecorder = react_1.default.forwardRef((props_, ref) => {
|
|
260
261
|
'onesy-AudioRecorder-time'
|
261
262
|
],
|
262
263
|
classes.time
|
263
|
-
]) }, { children: value_ })))] })) }))), status === 'initial' && ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: true, add: true }, { children: (0, jsx_runtime_1.jsx)("span", { children: (0, utils_1.is)('function', renderMain) ? renderMain({ onStart, supported }) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({
|
264
|
+
]) }, { children: value_ })))] })) }))), status === 'initial' && ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: true, add: true }, { children: (0, jsx_runtime_1.jsx)("span", { children: (0, utils_1.is)('function', renderMain) ? renderMain({ onStart, supported }) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Voice record') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onStart, disabled: !supported }, iconButtonProps, { children: (0, jsx_runtime_1.jsx)(Icon_, Object.assign({}, iconProps)) })) })) }) }) }))), status === 'running' && ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: true, add: true }, { children: (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Cancel') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onStop }, iconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconStop, Object.assign({}, iconProps)) })) })), pause && ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Pause') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onPause }, iconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconPause, Object.assign({}, iconProps)) })) }))), (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Confirm') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onConfirm }, iconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconConfirm, Object.assign({}, iconProps)) })) }))] }) }))), status === 'paused' && ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: true, add: true }, { children: (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Cancel') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onStop }, iconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconStop, Object.assign({}, iconProps)) })) })), (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Resume') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onResume }, iconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconStart, Object.assign({}, iconProps)) })) })), (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Confirm') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onConfirm }, iconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconConfirm, Object.assign({}, iconProps)) })) }))] }) })))] })));
|
264
265
|
});
|
265
266
|
AudioRecorder.displayName = 'onesy-AudioRecorder';
|
266
267
|
exports.default = AudioRecorder;
|
@@ -102,6 +102,7 @@ const getValue = (value) => (value === null || value === void 0 ? void 0 : value
|
|
102
102
|
const AutoComplete = react_1.default.forwardRef((props_, ref) => {
|
103
103
|
var _a;
|
104
104
|
const theme = (0, style_react_1.useOnesyTheme)();
|
105
|
+
const l = theme.l;
|
105
106
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyAutoComplete) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
106
107
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
107
108
|
const Menu = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Menu) || Menu_1.default; }, [theme]);
|
@@ -192,14 +193,14 @@ const AutoComplete = react_1.default.forwardRef((props_, ref) => {
|
|
192
193
|
// reset
|
193
194
|
setFree(false);
|
194
195
|
if (loading)
|
195
|
-
optionsValue = [{ label: 'Loading...', version: 'text' }];
|
196
|
+
optionsValue = [{ label: l('Loading...'), version: 'text' }];
|
196
197
|
else if (newOptions)
|
197
198
|
optionsValue = newOptions;
|
198
199
|
else
|
199
200
|
optionsValue = (0, utils_1.is)('function', filter) ? filter(valueInputNew, refs.optionsProps.current) : refs.optionsProps.current.filter(option => isEqualToInput(valueInputNew, option));
|
200
201
|
if (!optionsValue.length) {
|
201
202
|
if (noOptions)
|
202
|
-
optionsValue.push(noOptionsObject !== undefined ? noOptionsObject : { primary: 'No options', version: 'text', noOptions: true });
|
203
|
+
optionsValue.push(noOptionsObject !== undefined ? noOptionsObject : { primary: l('No options'), version: 'text', noOptions: true });
|
203
204
|
else {
|
204
205
|
setOpen(false);
|
205
206
|
setFree(true);
|
@@ -412,7 +413,7 @@ const AutoComplete = react_1.default.forwardRef((props_, ref) => {
|
|
412
413
|
const groups = {};
|
413
414
|
if ((0, utils_1.is)('function', groupBy)) {
|
414
415
|
optionsToUse.forEach(option => {
|
415
|
-
const valueForGroupBy = groupBy(option) || 'Other';
|
416
|
+
const valueForGroupBy = groupBy(option) || l('Other');
|
416
417
|
if (!groups[valueForGroupBy])
|
417
418
|
groups[valueForGroupBy] = [];
|
418
419
|
groups[valueForGroupBy].push(option);
|
@@ -488,7 +489,7 @@ const AutoComplete = react_1.default.forwardRef((props_, ref) => {
|
|
488
489
|
...(loading ? [
|
489
490
|
(0, jsx_runtime_1.jsx)(RoundProgress, { className: classes.roundProgress, size: 'small' }, 1)
|
490
491
|
] : []),
|
491
|
-
...(clear ? [!!(multiple ? value.length : valueInput) && ((0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onClear, size: 'small', fontSize: utils_2.iconFontSize, "aria-label": 'Input clear' }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconClear, Object.assign({}, IconProps)) })))] : []),
|
492
|
+
...(clear ? [!!(multiple ? value.length : valueInput) && ((0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onClear, size: 'small', fontSize: utils_2.iconFontSize, "aria-label": l('Input clear') }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconClear, Object.assign({}, IconProps)) })))] : []),
|
492
493
|
(0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onClickArrowDown, size: 'small', fontSize: utils_2.iconFontSize, "aria-expanded": open, "aria-controls": refs.ids.list, InteractionProps: {
|
493
494
|
clear: !!(multiple ? value.length : valueInput)
|
494
495
|
} }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconDropdown, Object.assign({}, IconProps, { className: (0, style_react_1.classNames)([
|
@@ -27,6 +27,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
27
27
|
}), { name: 'onesy-AutoCompleteCountry' });
|
28
28
|
const AutoCompleteCountry = react_1.default.forwardRef((props_, ref) => {
|
29
29
|
const theme = (0, style_react_1.useOnesyTheme)();
|
30
|
+
const l = theme.l;
|
30
31
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyAutoCompleteCountry) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
31
32
|
const AutoComplete = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.AutoComplete) || AutoComplete_1.default; }, [theme]);
|
32
33
|
const ListItem = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.ListItem) || ListItem_1.default; }, [theme]);
|
@@ -45,7 +46,7 @@ const AutoCompleteCountry = react_1.default.forwardRef((props_, ref) => {
|
|
45
46
|
// tlds: string[];
|
46
47
|
// }
|
47
48
|
const options = react_1.default.useMemo(() => {
|
48
|
-
return utils_1.countries.map(item => (Object.assign(Object.assign({}, item), { value: item['alpha-2'] })));
|
49
|
+
return utils_1.countries.map(item => (Object.assign(Object.assign({}, item), { name: l(item.name), value: item['alpha-2'] })));
|
49
50
|
}, [utils_1.countries]);
|
50
51
|
const valueInputDefault = react_1.default.useMemo(() => {
|
51
52
|
var _a;
|
@@ -24,6 +24,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
24
24
|
}), { name: 'onesy-AutoCompleteCurrency' });
|
25
25
|
const AutoCompleteCurrency = react_1.default.forwardRef((props_, ref) => {
|
26
26
|
const theme = (0, style_react_1.useOnesyTheme)();
|
27
|
+
const l = theme.l;
|
27
28
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyAutoCompleteCurrency) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
28
29
|
const AutoComplete = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.AutoComplete) || AutoComplete_1.default; }, [theme]);
|
29
30
|
const { valueInputDefault: valueInputDefault_, size = 'regular', className, children } = props, other = __rest(props, ["valueInputDefault", "size", "className", "children"]);
|
@@ -39,7 +40,7 @@ const AutoCompleteCurrency = react_1.default.forwardRef((props_, ref) => {
|
|
39
40
|
// }
|
40
41
|
const options = react_1.default.useMemo(() => {
|
41
42
|
return [
|
42
|
-
{ name: 'No currency', value: '' },
|
43
|
+
{ name: l('No currency'), value: '' },
|
43
44
|
...utils_1.currencies.map(item => ({
|
44
45
|
name: `${item.code} ${item.name} (${item.symbol})`,
|
45
46
|
value: item.code
|
@@ -41,6 +41,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
41
41
|
}), { name: 'onesy-Breadcrumbs' });
|
42
42
|
const Breadcrumbs = react_1.default.forwardRef((props_, ref) => {
|
43
43
|
const theme = (0, style_react_1.useOnesyTheme)();
|
44
|
+
const l = theme.l;
|
44
45
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyBreadcrumbs) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
45
46
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
46
47
|
const Type = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Type) || Type_1.default; }, [theme]);
|
@@ -83,7 +84,7 @@ const Breadcrumbs = react_1.default.forwardRef((props_, ref) => {
|
|
83
84
|
}
|
84
85
|
items = [
|
85
86
|
...start,
|
86
|
-
(0, utils_1.is)('function', renderMore) ? renderMore(onExpandMore) : (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ color: 'default', size: 'small', onClick: onExpandMore, "aria-label": 'Expand more path' }, MoreProps, { className: (0, style_react_1.classNames)([
|
87
|
+
(0, utils_1.is)('function', renderMore) ? renderMore(onExpandMore) : (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ color: 'default', size: 'small', onClick: onExpandMore, "aria-label": l('Expand more path') }, MoreProps, { className: (0, style_react_1.classNames)([
|
87
88
|
(0, utils_2.staticClassName)('Breadcrumbs', theme) && [
|
88
89
|
'onesy-Breadcrumbs-expand-more'
|
89
90
|
],
|
@@ -116,7 +117,7 @@ const Breadcrumbs = react_1.default.forwardRef((props_, ref) => {
|
|
116
117
|
ref.current = item;
|
117
118
|
}
|
118
119
|
refs.root.current = item;
|
119
|
-
}, gap: 1, direction: 'row', align: 'center', wrap: 'wrap', "aria-label": 'Breadcrumb', Component: Component }, other, { className: (0, style_react_1.classNames)([
|
120
|
+
}, gap: 1, direction: 'row', align: 'center', wrap: 'wrap', "aria-label": l('Breadcrumb'), Component: Component }, other, { className: (0, style_react_1.classNames)([
|
120
121
|
(0, utils_2.staticClassName)('Breadcrumbs', theme) && [
|
121
122
|
'onesy-Breadcrumbs-root'
|
122
123
|
],
|
@@ -60,6 +60,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
60
60
|
const BubbleChart = react_1.default.forwardRef((props_, ref) => {
|
61
61
|
var _a, _b, _c, _d;
|
62
62
|
const theme = (0, style_react_1.useOnesyTheme)();
|
63
|
+
const l = theme.l;
|
63
64
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyBubbleChart) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
64
65
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
65
66
|
const Chart = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Chart) || Chart_1.default; }, [theme]);
|
@@ -95,13 +96,13 @@ const BubbleChart = react_1.default.forwardRef((props_, ref) => {
|
|
95
96
|
width: '100%'
|
96
97
|
} }, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', style: {
|
97
98
|
fontWeight: 600
|
98
|
-
} }, { children:
|
99
|
+
} }, { children: l('Label') })), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', style: {
|
99
100
|
fontWeight: 600
|
100
101
|
} }, { children: (names === null || names === void 0 ? void 0 : names.y) || 'y' })), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', style: {
|
101
102
|
fontWeight: 600
|
102
103
|
} }, { children: (names === null || names === void 0 ? void 0 : names.x) || 'x' })), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', style: {
|
103
104
|
fontWeight: 600
|
104
|
-
} }, { children: (names === null || names === void 0 ? void 0 : names.size) || 'Size' }))] })), (0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 1, direction: 'column' }, { children: groupsSorted.map((group, index) => {
|
105
|
+
} }, { children: (names === null || names === void 0 ? void 0 : names.size) || l('Size') }))] })), (0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 1, direction: 'column' }, { children: groupsSorted.map((group, index) => {
|
105
106
|
var _a, _b;
|
106
107
|
return ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'column', style: {
|
107
108
|
width: '100%'
|
package/Calendar/Calendar.js
CHANGED
@@ -146,6 +146,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
146
146
|
}), { name: 'onesy-Calendar' });
|
147
147
|
const Calendar = react_1.default.forwardRef((props__, ref) => {
|
148
148
|
const theme = (0, style_react_1.useOnesyTheme)();
|
149
|
+
const l = theme.l;
|
149
150
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyCalendar) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props__)); }, [props__]);
|
150
151
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
151
152
|
const Surface = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Surface) || Surface_1.default; }, [theme]);
|
@@ -354,33 +355,33 @@ const Calendar = react_1.default.forwardRef((props__, ref) => {
|
|
354
355
|
'onesy-Calendar-header'
|
355
356
|
],
|
356
357
|
classes.header
|
357
|
-
]) }, { children: menu === 'month-year' ? (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => move(false), size: size, "aria-label": 'Previous month', disabled: open || (+year <= 1970 && month === 'Jan') }, optionButtonProps, { children: (0, jsx_runtime_1.jsx)(IconPrevious, { size: size }) })) })), (0, jsx_runtime_1.jsx)(Button, Object.assign({ version: 'text', onClick: () => onOpen(), fontSize: utils_2.iconFontSize, size: size, end: ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: open !== 'year' }, { children: (0, jsx_runtime_1.jsx)(IconDropDown, { size: size, className: (0, style_react_1.classNames)([
|
358
|
+
]) }, { children: menu === 'month-year' ? (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => move(false), size: size, "aria-label": l('Previous month'), disabled: open || (+year <= 1970 && month === 'Jan') }, optionButtonProps, { children: (0, jsx_runtime_1.jsx)(IconPrevious, { size: size }) })) })), (0, jsx_runtime_1.jsx)(Button, Object.assign({ version: 'text', onClick: () => onOpen(), fontSize: utils_2.iconFontSize, size: size, end: ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: open !== 'year' }, { children: (0, jsx_runtime_1.jsx)(IconDropDown, { size: size, className: (0, style_react_1.classNames)([
|
358
359
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
359
360
|
'onesy-Calendar-arrow'
|
360
361
|
],
|
361
362
|
classes.arrow,
|
362
363
|
open === 'month' && classes.arrow_open
|
363
|
-
]) }) }))), "aria-label":
|
364
|
+
]) }) }))), "aria-label": `${l('Select month')}, ${l('current')} ${month}` }, optionButtonProps, { className: (0, style_react_1.classNames)([
|
364
365
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
365
366
|
'onesy-Calendar-option'
|
366
367
|
],
|
367
368
|
optionButtonProps === null || optionButtonProps === void 0 ? void 0 : optionButtonProps.className,
|
368
369
|
classes.option,
|
369
370
|
open === 'year' && classes.option_secondary
|
370
|
-
]) }, { children: month })), (0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => move(), size: size, "aria-label": 'Next month', disabled: open || (+year === 2099 && month === 'Dec') }, optionButtonProps, { children: (0, jsx_runtime_1.jsx)(IconNext, { size: size }) })) }))] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => move(false, 'year'), size: size, "aria-label": 'Previous year', disabled: open || +year <= 1970 }, optionButtonProps, { children: (0, jsx_runtime_1.jsx)(IconPrevious, { size: size }) })) })), (0, jsx_runtime_1.jsx)(Button, Object.assign({ version: 'text', onClick: () => onOpen('year'), fontSize: utils_2.iconFontSize, size: size, end: ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: open !== 'month' }, { children: (0, jsx_runtime_1.jsx)(IconDropDown, { size: size, className: (0, style_react_1.classNames)([
|
371
|
+
]) }, { children: month })), (0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => move(), size: size, "aria-label": l('Next month'), disabled: open || (+year === 2099 && month === 'Dec') }, optionButtonProps, { children: (0, jsx_runtime_1.jsx)(IconNext, { size: size }) })) }))] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => move(false, 'year'), size: size, "aria-label": l('Previous year'), disabled: open || +year <= 1970 }, optionButtonProps, { children: (0, jsx_runtime_1.jsx)(IconPrevious, { size: size }) })) })), (0, jsx_runtime_1.jsx)(Button, Object.assign({ version: 'text', onClick: () => onOpen('year'), fontSize: utils_2.iconFontSize, size: size, end: ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: open !== 'month' }, { children: (0, jsx_runtime_1.jsx)(IconDropDown, { size: size, className: (0, style_react_1.classNames)([
|
371
372
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
372
373
|
'onesy-Calendar-arrow'
|
373
374
|
],
|
374
375
|
classes.arrow,
|
375
376
|
open === 'year' && classes.arrow_open
|
376
|
-
]) }) }))), "aria-label":
|
377
|
+
]) }) }))), "aria-label": `${l('Select year')}, ${l('current')} ${year}` }, optionButtonProps, { className: (0, style_react_1.classNames)([
|
377
378
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
378
379
|
'onesy-Calendar-option'
|
379
380
|
],
|
380
381
|
optionButtonProps === null || optionButtonProps === void 0 ? void 0 : optionButtonProps.className,
|
381
382
|
classes.option,
|
382
383
|
open === 'month' && classes.option_secondary
|
383
|
-
]) }, { children: year })), (0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => move(true, 'year'), size: size, "aria-label": 'Next year', disabled: open || +year === 2099 }, optionButtonProps, { children: (0, jsx_runtime_1.jsx)(IconNext, { size: size }) })) }))] }))] }) : (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Button, Object.assign({ tonal: tonal, color: 'inherit', size: size, version: 'text', onClick: () => onOpen('year'), fontSize: utils_2.iconFontSize, end: ((0, jsx_runtime_1.jsx)(IconDropDown, { size: size, className: (0, style_react_1.classNames)([
|
384
|
+
]) }, { children: year })), (0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => move(true, 'year'), size: size, "aria-label": l('Next year'), disabled: open || +year === 2099 }, optionButtonProps, { children: (0, jsx_runtime_1.jsx)(IconNext, { size: size }) })) }))] }))] }) : (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Button, Object.assign({ tonal: tonal, color: 'inherit', size: size, version: 'text', onClick: () => onOpen('year'), fontSize: utils_2.iconFontSize, end: ((0, jsx_runtime_1.jsx)(IconDropDown, { size: size, className: (0, style_react_1.classNames)([
|
384
385
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
385
386
|
'onesy-Calendar-arrow'
|
386
387
|
],
|
@@ -392,7 +393,7 @@ const Calendar = react_1.default.forwardRef((props__, ref) => {
|
|
392
393
|
],
|
393
394
|
optionButtonProps === null || optionButtonProps === void 0 ? void 0 : optionButtonProps.className,
|
394
395
|
classes.option
|
395
|
-
]) }, { children: [(0, date_1.format)(calendar, 'MMMM'), " ", (0, date_1.format)(calendar, 'YYYY')] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ tonal: tonal, color: 'inherit', size: size, onClick: () => move(false, menu_month_previous_unit || 'month'), "aria-label": 'Previous month', disabled: !!(open || (+year === 1970 && month === 'Jan')) }, { children: (0, jsx_runtime_1.jsx)(IconPrevious, { size: size }) })) })), (0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ tonal: tonal, color: 'inherit', size: size, onClick: () => move(true, menu_month_next_unit || 'month'), "aria-label": 'Next month', disabled: !!(open || (+year === 2099 && month === 'Dec')) }, { children: (0, jsx_runtime_1.jsx)(IconNext, { size: size }) })) }))] }))] }) })), !open && ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: true }, { children: main() }))), open && ((0, jsx_runtime_1.jsx)(Divider, { tonal: false, className: (0, style_react_1.classNames)([
|
396
|
+
]) }, { children: [(0, date_1.format)(calendar, 'MMMM'), " ", (0, date_1.format)(calendar, 'YYYY')] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ tonal: tonal, color: 'inherit', size: size, onClick: () => move(false, menu_month_previous_unit || 'month'), "aria-label": l('Previous month'), disabled: !!(open || (+year === 1970 && month === 'Jan')) }, { children: (0, jsx_runtime_1.jsx)(IconPrevious, { size: size }) })) })), (0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: !open }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ tonal: tonal, color: 'inherit', size: size, onClick: () => move(true, menu_month_next_unit || 'month'), "aria-label": l('Next month'), disabled: !!(open || (+year === 2099 && month === 'Dec')) }, { children: (0, jsx_runtime_1.jsx)(IconNext, { size: size }) })) }))] }))] }) })), !open && ((0, jsx_runtime_1.jsx)(Fade, Object.assign({ in: true }, { children: main() }))), open && ((0, jsx_runtime_1.jsx)(Divider, { tonal: false, className: (0, style_react_1.classNames)([
|
396
397
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
397
398
|
'onesy-Calendar-divider'
|
398
399
|
],
|
@@ -18,7 +18,10 @@ export type ICalendarAvailability = ILine & {
|
|
18
18
|
times?: any;
|
19
19
|
events?: ICalendarEvent[];
|
20
20
|
meta?: boolean;
|
21
|
-
views?:
|
21
|
+
views?: {
|
22
|
+
name: string;
|
23
|
+
value: ICalendarViewsView;
|
24
|
+
}[];
|
22
25
|
onUpdate?: (object?: any) => any;
|
23
26
|
onRemove?: (object?: any) => any;
|
24
27
|
onChangeDate?: (value: OnesyDate) => any;
|
@@ -121,6 +121,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
121
121
|
}), { name: 'onesy-CalendarAvailability' });
|
122
122
|
const CalendarAvailability = react_1.default.forwardRef((props_, ref) => {
|
123
123
|
const theme = (0, style_react_1.useOnesyTheme)();
|
124
|
+
const l = theme.l;
|
124
125
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyCalendarAvailability) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
125
126
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
126
127
|
const Type = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Type) || Type_1.default; }, [theme]);
|
@@ -135,7 +136,11 @@ const CalendarAvailability = react_1.default.forwardRef((props_, ref) => {
|
|
135
136
|
const Button = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Button) || Button_1.default; }, [theme]);
|
136
137
|
const Select = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Select) || Select_1.default; }, [theme]);
|
137
138
|
const CalendarWeek = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.CalendarWeek) || CalendarWeek_1.default; }, [theme]);
|
138
|
-
const { name, date: date_, dateDefault, times: timesProps, events, meta, views: viewsProps = [
|
139
|
+
const { name, date: date_, dateDefault, times: timesProps, events, meta, views: viewsProps = [
|
140
|
+
{ name: l('Week'), value: 'week' },
|
141
|
+
{ name: l('Day'), value: 'day' },
|
142
|
+
{ name: l('Simple'), value: 'simple' }
|
143
|
+
], onUpdate, onRemove, onChangeDate: onChangeDateProps, startHeader, endHeader, startLeft, endLeft, startRight, endRight, startLeftModal, endLeftModal, startRightModal, endRightModal, Component = Line, IconEdit = IconMaterialEditW100_1.default, IconPrevious = IconMaterialArrowBackIosNewW100_1.default, IconNext = IconMaterialArrowForwardIosW100_1.default, IconRemove = IconMaterialDeleteW100_1.default, IconClose = IconMaterialKeyboardArrowDownW100_1.default, WeekProps, DayProps, IconProps, IconButtonProps, className, children } = props, other = __rest(props, ["name", "date", "dateDefault", "times", "events", "meta", "views", "onUpdate", "onRemove", "onChangeDate", "startHeader", "endHeader", "startLeft", "endLeft", "startRight", "endRight", "startLeftModal", "endLeftModal", "startRightModal", "endRightModal", "Component", "IconEdit", "IconPrevious", "IconNext", "IconRemove", "IconClose", "WeekProps", "DayProps", "IconProps", "IconButtonProps", "className", "children"]);
|
139
144
|
const { classes } = useStyle();
|
140
145
|
const [now, setNow] = react_1.default.useState(new date_1.OnesyDate());
|
141
146
|
const [date, setDate] = react_1.default.useState(dateDefault || date_ || new date_1.OnesyDate());
|
@@ -200,13 +205,13 @@ const CalendarAvailability = react_1.default.forwardRef((props_, ref) => {
|
|
200
205
|
}, []);
|
201
206
|
const optionsStatus = react_1.default.useMemo(() => {
|
202
207
|
return [
|
203
|
-
{ name: 'Working', value: 'working' },
|
204
|
-
{ name: 'Not working', value: 'not-working' },
|
205
|
-
{ name: 'On a break', value: 'break' },
|
206
|
-
{ name: 'Scheduled', value: 'pending' },
|
207
|
-
{ name: 'Rescheduled', value: 'rescheduled' },
|
208
|
-
{ name: 'Cancelled', value: 'canceled' },
|
209
|
-
{ name: 'Other', value: 'other' }
|
208
|
+
{ name: l('Working'), value: 'working' },
|
209
|
+
{ name: l('Not working'), value: 'not-working' },
|
210
|
+
{ name: l('On a break'), value: 'break' },
|
211
|
+
{ name: l('Scheduled'), value: 'pending' },
|
212
|
+
{ name: l('Rescheduled'), value: 'rescheduled' },
|
213
|
+
{ name: l('Cancelled'), value: 'canceled' },
|
214
|
+
{ name: l('Other'), value: 'other' }
|
210
215
|
];
|
211
216
|
}, []);
|
212
217
|
const onToday = react_1.default.useCallback(() => {
|
@@ -291,8 +296,8 @@ const CalendarAvailability = react_1.default.forwardRef((props_, ref) => {
|
|
291
296
|
}, []);
|
292
297
|
const viewOptions = react_1.default.useMemo(() => {
|
293
298
|
return viewsProps === null || viewsProps === void 0 ? void 0 : viewsProps.map(item => ({
|
294
|
-
name: (0, utils_1.capitalize)(item),
|
295
|
-
value: item
|
299
|
+
name: (0, utils_1.capitalize)(item === null || item === void 0 ? void 0 : item.name),
|
300
|
+
value: item === null || item === void 0 ? void 0 : item.value
|
296
301
|
}));
|
297
302
|
}, [viewsProps]);
|
298
303
|
const days = react_1.default.useMemo(() => {
|
@@ -320,13 +325,13 @@ const CalendarAvailability = react_1.default.forwardRef((props_, ref) => {
|
|
320
325
|
]), dangerouslySetInnerHTML: {
|
321
326
|
__html: (0, utils_1.textToInnerHTML)(itemValue.description)
|
322
327
|
} }))] }), indexItem));
|
323
|
-
}) : ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b2' }, { children:
|
328
|
+
}) : ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b2' }, { children: l('No information for this day') }))) }))] }), index));
|
324
329
|
}) })));
|
325
330
|
};
|
326
331
|
const simpleExceptionsUI = () => {
|
327
332
|
const items = times.flatMap(item => getDatesWeek(item));
|
328
333
|
if (!items.length)
|
329
|
-
return ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b1' }, { children:
|
334
|
+
return ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b1' }, { children: l('No exceptions this week') })));
|
330
335
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: items.map((itemValue, index) => {
|
331
336
|
const day = (0, date_1.set)(index + 1, 'dayWeek');
|
332
337
|
const itemValueFrom = new date_1.OnesyDate(itemValue.from);
|
@@ -365,10 +370,10 @@ const CalendarAvailability = react_1.default.forwardRef((props_, ref) => {
|
|
365
370
|
(0, utils_2.staticClassName)('CalendarAvailability', theme) && [
|
366
371
|
'onesy-CalendarAvailability-header'
|
367
372
|
]
|
368
|
-
]) }, { 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:
|
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)([
|
369
374
|
classes.aside,
|
370
375
|
classes.overflowX
|
371
|
-
]) }, { 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, {}),
|
376
|
+
]) }, { 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: {
|
372
377
|
portal: true,
|
373
378
|
size: 'regular'
|
374
379
|
}, WrapperProps: {
|
@@ -384,15 +389,15 @@ const CalendarAvailability = react_1.default.forwardRef((props_, ref) => {
|
|
384
389
|
'onesy-CalendarAvailability-simple'
|
385
390
|
],
|
386
391
|
classes.calendar
|
387
|
-
]) }, { children: [simpleTimesUI(), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1.5 }, { children: [(0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 't2' }, { children:
|
392
|
+
]) }, { children: [simpleTimesUI(), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1.5 }, { children: [(0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 't2' }, { children: l('Exceptions this week') })), (0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 1 }, { children: simpleExceptionsUI() }))] }))] })) }))), ['week', 'day'].includes(view) && ((0, jsx_runtime_1.jsx)(CalendarWeek, Object.assign({ onOpen: onOpen, date: date, displayTime: displayTime, statuses: statuses, times: times, events: events, day: view === 'day' }, WeekProps))), legend] })), times && ((0, jsx_runtime_1.jsxs)(Modal, Object.assign({ open: !!(modal === null || modal === void 0 ? void 0 : modal.open), onClose: onClose, minWidth: 'lg', TransitionComponent: Slide, size: 'small' }, { children: [(0, jsx_runtime_1.jsxs)(ModalHeader, Object.assign({ gap: 1, direction: 'row', align: 'center', justify: 'space-between', fullWidth: true }, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center' }, { children: [startLeftModal, (0, jsx_runtime_1.jsx)(Line, { className: classes.palettePreview, style: {
|
388
393
|
background: getColor(modal)
|
389
|
-
} }), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b2', weight: 100 }, { children: (0, utils_1.cleanValue)(itemToText(modal === null || modal === void 0 ? void 0 : modal.status), { capitalize: true }) })), endLeftModal] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center' }, { children: [startRightModal, onUpdate && ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: 'Update' }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => {
|
394
|
+
} }), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b2', weight: 100 }, { children: (0, utils_1.cleanValue)(itemToText(modal === null || modal === void 0 ? void 0 : modal.status), { capitalize: true }) })), endLeftModal] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center' }, { children: [startRightModal, onUpdate && ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Update') }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => {
|
390
395
|
onUpdate(modal === null || modal === void 0 ? void 0 : modal.object);
|
391
396
|
onClose();
|
392
|
-
} }, { children: (0, jsx_runtime_1.jsx)(IconEdit, Object.assign({}, IconProps)) })) }))), onRemove && ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: 'Remove' }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => {
|
397
|
+
} }, { children: (0, jsx_runtime_1.jsx)(IconEdit, Object.assign({}, IconProps)) })) }))), onRemove && ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Remove') }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: () => {
|
393
398
|
onRemove(modal === null || modal === void 0 ? void 0 : modal.object);
|
394
399
|
onClose();
|
395
|
-
} }, { children: (0, jsx_runtime_1.jsx)(IconRemove, Object.assign({}, IconProps)) })) }))), (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: 'Close' }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(IconClose, Object.assign({}, IconProps)) })) })), endRightModal] }))] })), (0, jsx_runtime_1.jsx)(ModalMain, Object.assign({ align: 'flex-start', className: classes.modalMain }, { children: (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1.5, fullWidth: true }, { children: [(0, jsx_runtime_1.jsxs)(Type, Object.assign({ version: 'l1', weight: 200 }, { children: [(0, date_1.format)(modal === null || modal === void 0 ? void 0 : modal.day, 'dd'), " ", (0, date_1.format)(new date_1.OnesyDate(modal === null || modal === void 0 ? void 0 : modal.from), (modal === null || modal === void 0 ? void 0 : modal.weekly) ? `hh:mm a` : utils_2.formats.entire), " \u2014 ", (0, date_1.format)(new date_1.OnesyDate(modal === null || modal === void 0 ? void 0 : modal.to), (modal === null || modal === void 0 ? void 0 : modal.weekly) ? `hh:mm a` : utils_2.formats.entire)] })), (modal === null || modal === void 0 ? void 0 : modal.description) && ((0, jsx_runtime_1.jsx)(Type, { version: 'b2', dangerouslySetInnerHTML: {
|
400
|
+
} }, { children: (0, jsx_runtime_1.jsx)(IconRemove, Object.assign({}, IconProps)) })) }))), (0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Close') }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(IconClose, Object.assign({}, IconProps)) })) })), endRightModal] }))] })), (0, jsx_runtime_1.jsx)(ModalMain, Object.assign({ align: 'flex-start', className: classes.modalMain }, { children: (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1.5, fullWidth: true }, { children: [(0, jsx_runtime_1.jsxs)(Type, Object.assign({ version: 'l1', weight: 200 }, { children: [(0, date_1.format)(modal === null || modal === void 0 ? void 0 : modal.day, 'dd'), " ", (0, date_1.format)(new date_1.OnesyDate(modal === null || modal === void 0 ? void 0 : modal.from), (modal === null || modal === void 0 ? void 0 : modal.weekly) ? `hh:mm a` : utils_2.formats.entire), " \u2014 ", (0, date_1.format)(new date_1.OnesyDate(modal === null || modal === void 0 ? void 0 : modal.to), (modal === null || modal === void 0 ? void 0 : modal.weekly) ? `hh:mm a` : utils_2.formats.entire)] })), (modal === null || modal === void 0 ? void 0 : modal.description) && ((0, jsx_runtime_1.jsx)(Type, { version: 'b2', dangerouslySetInnerHTML: {
|
396
401
|
__html: (0, utils_1.textToInnerHTML)(modal.description)
|
397
402
|
} }))] })) }))] })))] })));
|
398
403
|
});
|
@@ -110,6 +110,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
110
110
|
const CalendarMenu = react_1.default.forwardRef((props_, ref) => {
|
111
111
|
var _a;
|
112
112
|
const theme = (0, style_react_1.useOnesyTheme)();
|
113
|
+
const l = theme.l;
|
113
114
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyCalendarAvailability) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
114
115
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
115
116
|
const Menu = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Menu) || Menu_1.default; }, [theme]);
|
@@ -182,10 +183,10 @@ const CalendarMenu = react_1.default.forwardRef((props_, ref) => {
|
|
182
183
|
size: 'regular'
|
183
184
|
};
|
184
185
|
const shortcuts = [
|
185
|
-
{ name: 'Today', onClick: () => onChangeDate(new date_1.OnesyDate()), icon: (0, jsx_runtime_1.jsx)(IconMaterialWbSunnyW100_1.default, Object.assign({}, iconProps)) },
|
186
|
-
{ name: 'Tomorrow', onClick: () => onChangeDate((0, date_1.add)(1, 'day')), icon: (0, jsx_runtime_1.jsx)(IconMaterialWbTwilightW100_1.default, Object.assign({}, iconProps)) },
|
187
|
-
{ name: '7 days', onClick: () => onChangeDate((0, date_1.add)(7, 'day')), icon: (0, jsx_runtime_1.jsx)(IconMaterialCounter7W100_1.default, Object.assign({}, iconProps)) },
|
188
|
-
{ name: '1 month', onClick: () => onChangeDate((0, date_1.add)(1, 'month')), icon: (0, jsx_runtime_1.jsx)(IconMaterialCalendarMonthW100_1.default, Object.assign({}, iconProps)) }
|
186
|
+
{ name: l('Today'), onClick: () => onChangeDate(new date_1.OnesyDate()), icon: (0, jsx_runtime_1.jsx)(IconMaterialWbSunnyW100_1.default, Object.assign({}, iconProps)) },
|
187
|
+
{ name: l('Tomorrow'), onClick: () => onChangeDate((0, date_1.add)(1, 'day')), icon: (0, jsx_runtime_1.jsx)(IconMaterialWbTwilightW100_1.default, Object.assign({}, iconProps)) },
|
188
|
+
{ name: l('7 days'), onClick: () => onChangeDate((0, date_1.add)(7, 'day')), icon: (0, jsx_runtime_1.jsx)(IconMaterialCounter7W100_1.default, Object.assign({}, iconProps)) },
|
189
|
+
{ name: l('1 month'), onClick: () => onChangeDate((0, date_1.add)(1, 'month')), icon: (0, jsx_runtime_1.jsx)(IconMaterialCalendarMonthW100_1.default, Object.assign({}, iconProps)) }
|
189
190
|
];
|
190
191
|
const onClear = react_1.default.useCallback((event) => {
|
191
192
|
onChange(refs.dateProperty.current, null);
|
@@ -277,7 +278,7 @@ const CalendarMenu = react_1.default.forwardRef((props_, ref) => {
|
|
277
278
|
'onesy-time'
|
278
279
|
]), style: {
|
279
280
|
width: (_a = refs.time.current) === null || _a === void 0 ? void 0 : _a.clientWidth
|
280
|
-
} }, { children: (0, jsx_runtime_1.jsx)(ListItem, { ref: refs.time, start: ((0, jsx_runtime_1.jsx)(IconMaterialScheduleW100_1.default, Object.assign({}, iconProps))), primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b2', color: 'inherit' }, { children: (0, date_1.format)(date, 'HH:mm') }))), startAlign: 'center', size: 'small', button: true, Component: 'div', className: classes.item }) }))), endBottom, (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.4, direction: 'row', align: 'center', justify: 'space-between', fullWidth: true, className: classes.menuFooter }, { children: [(0, jsx_runtime_1.jsx)(Button, Object.assign({ onClick: onClear, version: 'text', size: 'small', disabled: !(value === null || value === void 0 ? void 0 : value[dateProperty]) }, { children:
|
281
|
+
} }, { children: (0, jsx_runtime_1.jsx)(ListItem, { ref: refs.time, start: ((0, jsx_runtime_1.jsx)(IconMaterialScheduleW100_1.default, Object.assign({}, iconProps))), primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b2', color: 'inherit' }, { children: (0, date_1.format)(date, 'HH:mm') }))), startAlign: 'center', size: 'small', button: true, Component: 'div', className: classes.item }) }))), endBottom, (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.4, direction: 'row', align: 'center', justify: 'space-between', fullWidth: true, className: classes.menuFooter }, { children: [(0, jsx_runtime_1.jsx)(Button, Object.assign({ onClick: onClear, version: 'text', size: 'small', disabled: !(value === null || value === void 0 ? void 0 : value[dateProperty]) }, { children: l('Clear') })), !noRemove && ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Remove') }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ size: 'small', onClick: onRemove }, { children: (0, jsx_runtime_1.jsx)(IconMaterialDeleteW100_1.default, Object.assign({}, iconProps)) })) })))] }))] }))), CalendarMonthProps: {
|
281
282
|
renderDay: (dayOnesyDate, propsDay, day, outside) => {
|
282
283
|
const repeating = repeats(dayOnesyDate);
|
283
284
|
return ((0, jsx_runtime_1.jsx)(PaginationItem, Object.assign({ tonal: true, color: 'inherit', size: 'small', InteractionProps: {
|
@@ -188,6 +188,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
188
188
|
const CalendarMonth = react_1.default.forwardRef((props__, ref) => {
|
189
189
|
var _a, _b, _c;
|
190
190
|
const theme = (0, style_react_1.useOnesyTheme)();
|
191
|
+
const l = theme.l;
|
191
192
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyCalendarMonth) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props__)); }, [props__]);
|
192
193
|
const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
|
193
194
|
const Surface = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Surface) || Surface_1.default; }, [theme]);
|
@@ -303,13 +304,13 @@ const CalendarMonth = react_1.default.forwardRef((props__, ref) => {
|
|
303
304
|
dayNames.unshift(7);
|
304
305
|
const renderDayNameMethod = (0, utils_1.is)('function', renderDayName) ? renderDayName : (order_) => {
|
305
306
|
const values = {
|
306
|
-
1: dayNamesFull ? 'Monday' : '
|
307
|
-
2: dayNamesFull ? 'Tuesday' : '
|
308
|
-
3: dayNamesFull ? 'Wednesday' : '
|
309
|
-
4: dayNamesFull ? 'Thursday' : '
|
310
|
-
5: dayNamesFull ? 'Friday' : '
|
311
|
-
6: dayNamesFull ? 'Saturday' : '
|
312
|
-
7: dayNamesFull ? 'Sunday' : '
|
307
|
+
1: dayNamesFull ? l('Monday') : l('Mo'),
|
308
|
+
2: dayNamesFull ? l('Tuesday') : l('Tu'),
|
309
|
+
3: dayNamesFull ? l('Wednesday') : l('We'),
|
310
|
+
4: dayNamesFull ? l('Thursday') : l('Th'),
|
311
|
+
5: dayNamesFull ? l('Friday') : l('Fr'),
|
312
|
+
6: dayNamesFull ? l('Saturday') : l('Sa'),
|
313
|
+
7: dayNamesFull ? l('Sunday') : l('Su')
|
313
314
|
};
|
314
315
|
return values[order_];
|
315
316
|
};
|
@@ -8,7 +8,10 @@ export type ICalendarViews = ICalendar & {
|
|
8
8
|
dateDefault?: OnesyDate;
|
9
9
|
times?: any;
|
10
10
|
events?: ICalendarEvent[];
|
11
|
-
views?:
|
11
|
+
views?: {
|
12
|
+
name: string;
|
13
|
+
value: ICalendarViewsView;
|
14
|
+
}[];
|
12
15
|
render?: (date: OnesyDate, view: ICalendarViewsView) => any;
|
13
16
|
onTimeClick?: (date: OnesyDate, view: ICalendarViewsView, event: MouseEvent) => any;
|
14
17
|
onChangeView?: (view: ICalendarViewsView) => any;
|