@onesy/ui-react 1.0.70 → 1.0.72
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/Calendar/Calendar.js +9 -4
- package/Select/Select.d.ts +1 -0
- package/Select/Select.js +3 -3
- package/esm/Calendar/Calendar.js +12 -4
- package/esm/Select/Select.js +3 -2
- package/esm/index.js +1 -1
- package/package.json +1 -1
package/Calendar/Calendar.js
CHANGED
@@ -144,6 +144,11 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
144
144
|
}
|
145
145
|
}
|
146
146
|
}), { name: 'onesy-Calendar' });
|
147
|
+
// [l('millisecond'), l('milliseconds'), l('second'), l('minute'), l('minutes'), l('hour'), l('hours'), l('day'), l('days'), l('week'), l('weeks'), l('month'), l('months'), l('year')];
|
148
|
+
// [l('January'), l('February'), l('March'), l('April'), l('May'), l('June'), l('July'), l('August'), l('September'), l('October'), l('November'), l('December')];
|
149
|
+
// [l('Jan'), l('Feb'), l('Mar'), l('Apr'), l('May'), l('Jun'), l('Jul'), l('Aug'), l('Sep'), l('Oct'), l('Nov'), l('Dec')];
|
150
|
+
// [l('Monday'), l('Tuesday'), l('Wednesday'), l('Thursday'), l('Friday'), l('Saturday'), l('Sunday'];
|
151
|
+
// ['Mon'), l('Tue'), l('Wed'), l('Thu'), l('Fri'), l('Sat'), l('Sun')];
|
147
152
|
const Calendar = react_1.default.forwardRef((props__, ref) => {
|
148
153
|
const theme = (0, style_react_1.useOnesyTheme)();
|
149
154
|
const l = theme.l;
|
@@ -317,7 +322,7 @@ const Calendar = react_1.default.forwardRef((props__, ref) => {
|
|
317
322
|
width: '100%'
|
318
323
|
} }, { children: [calendars > 1 && ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: size === 'large' ? 'l1' : size === 'regular' ? 'l2' : 'l3', style: {
|
319
324
|
paddingInlineStart: '16px'
|
320
|
-
} }, { children: (0, date_1.format)(calendarOnesyDate, 'MMMM') }))), (0, jsx_runtime_1.jsx)(CalendarMonth, Object.assign({ color: 'default', value: value, calendar: calendarOnesyDate, valid: valid, now: now, size: size, range: range, offset: index, min: min, max: max, validate: validate }, calendarMonthProps, { onChange: onCalendarMonthChange, onChangeCalendar: onCalendarMonthChangeCalendar, TransitionProps: {
|
325
|
+
} }, { children: l((0, date_1.format)(calendarOnesyDate, 'MMMM')) }))), (0, jsx_runtime_1.jsx)(CalendarMonth, Object.assign({ color: 'default', value: value, calendar: calendarOnesyDate, valid: valid, now: now, size: size, range: range, offset: index, min: min, max: max, validate: validate }, calendarMonthProps, { onChange: onCalendarMonthChange, onChangeCalendar: onCalendarMonthChangeCalendar, TransitionProps: {
|
321
326
|
onTransition
|
322
327
|
}, className: (0, style_react_1.classNames)([
|
323
328
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
@@ -361,14 +366,14 @@ const Calendar = react_1.default.forwardRef((props__, ref) => {
|
|
361
366
|
],
|
362
367
|
classes.arrow,
|
363
368
|
open === 'month' && classes.arrow_open
|
364
|
-
]) }) }))), "aria-label": `${l('Select month')}, ${l('current')} ${month}` }, optionButtonProps, { className: (0, style_react_1.classNames)([
|
369
|
+
]) }) }))), "aria-label": `${l('Select month')}, ${l('current')} ${l(month)}` }, optionButtonProps, { className: (0, style_react_1.classNames)([
|
365
370
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
366
371
|
'onesy-Calendar-option'
|
367
372
|
],
|
368
373
|
optionButtonProps === null || optionButtonProps === void 0 ? void 0 : optionButtonProps.className,
|
369
374
|
classes.option,
|
370
375
|
open === 'year' && classes.option_secondary
|
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)([
|
376
|
+
]) }, { children: l(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)([
|
372
377
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
373
378
|
'onesy-Calendar-arrow'
|
374
379
|
],
|
@@ -406,7 +411,7 @@ const Calendar = react_1.default.forwardRef((props__, ref) => {
|
|
406
411
|
]) }, { children: getMonths(value, calendar, props).map((item, index) => {
|
407
412
|
const onesyDate = item.value;
|
408
413
|
const selected = calendar.month === onesyDate.month;
|
409
|
-
return ((0, jsx_runtime_1.jsx)(ListItem, { onClick: () => onUpdateCalendarOption(onesyDate), primary: (0, date_1.format)(onesyDate, 'MMMM'), inset: !selected, startAlign: 'center', size: size, start: selected ? ((0, jsx_runtime_1.jsx)(Buttons_1.IconDoneAnimated, { in: true, add: true, simple: true, size: size })) : undefined, disabled: (!valid(onesyDate, 'month')), selected: selected, button: true, PrimaryProps: {
|
414
|
+
return ((0, jsx_runtime_1.jsx)(ListItem, { onClick: () => onUpdateCalendarOption(onesyDate), primary: l((0, date_1.format)(onesyDate, 'MMMM')), inset: !selected, startAlign: 'center', size: size, start: selected ? ((0, jsx_runtime_1.jsx)(Buttons_1.IconDoneAnimated, { in: true, add: true, simple: true, size: size })) : undefined, disabled: (!valid(onesyDate, 'month')), selected: selected, button: true, PrimaryProps: {
|
410
415
|
version: size === 'regular' ? 'b2' : size === 'small' ? 'b3' : 'b1'
|
411
416
|
}, "data-value": index, className: (0, style_react_1.classNames)([
|
412
417
|
(0, utils_2.staticClassName)('Calendar', theme) && [
|
package/Select/Select.d.ts
CHANGED
package/Select/Select.js
CHANGED
@@ -121,13 +121,13 @@ const Select = react_1.default.forwardRef((props_, ref) => {
|
|
121
121
|
const Chips = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Chips) || Chips_1.default; }, [theme]);
|
122
122
|
const TextField = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.TextField) || TextField_1.default; }, [theme]);
|
123
123
|
const IconButton = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.IconButton) || IconButton_1.default; }, [theme]);
|
124
|
-
const { tonal = true, color = 'primary', size = 'regular', version = 'filled', value: value_, valueDefault, onChange: onChange_, options, name, multiple, prefix, sufix, start, end, autoWidth = true, getLabel: getLabel_, fullWidth, chip, clear, readOnly, noSelectText, disabled, renderValues: renderValues_, renderChip, IconClear = IconMaterialCloseW100_1.default, IconDropdown = IconMaterialArrowDropDownW100_1.default, inputProps, InputWrapperProps, WrapperProps, ChipProps, ChiProps, ListProps = {
|
124
|
+
const { tonal = true, color = 'primary', size = 'regular', version = 'filled', value: value_, valueDefault, onChange: onChange_, options, name, multiple, prefix, sufix, start, end, autoWidth = true, getLabel: getLabel_, getOptionName, fullWidth, chip, clear, readOnly, noSelectText, disabled, renderValues: renderValues_, renderChip, IconClear = IconMaterialCloseW100_1.default, IconDropdown = IconMaterialArrowDropDownW100_1.default, inputProps, InputWrapperProps, WrapperProps, ChipProps, ChiProps, ListProps = {
|
125
125
|
style: {
|
126
126
|
maxHeight: 250,
|
127
127
|
overflowY: 'auto',
|
128
128
|
overflowX: 'hidden'
|
129
129
|
}
|
130
|
-
}, MenuProps: MenuPropsProps, ListItemProps, ListItemTypeProps, IconButtonProps, IconProps, className, style, children: children_ } = props, other = __rest(props, ["tonal", "color", "size", "version", "value", "valueDefault", "onChange", "options", "name", "multiple", "prefix", "sufix", "start", "end", "autoWidth", "getLabel", "fullWidth", "chip", "clear", "readOnly", "noSelectText", "disabled", "renderValues", "renderChip", "IconClear", "IconDropdown", "inputProps", "InputWrapperProps", "WrapperProps", "ChipProps", "ChiProps", "ListProps", "MenuProps", "ListItemProps", "ListItemTypeProps", "IconButtonProps", "IconProps", "className", "style", "children"]);
|
130
|
+
}, MenuProps: MenuPropsProps, ListItemProps, ListItemTypeProps, IconButtonProps, IconProps, className, style, children: children_ } = props, other = __rest(props, ["tonal", "color", "size", "version", "value", "valueDefault", "onChange", "options", "name", "multiple", "prefix", "sufix", "start", "end", "autoWidth", "getLabel", "getOptionName", "fullWidth", "chip", "clear", "readOnly", "noSelectText", "disabled", "renderValues", "renderChip", "IconClear", "IconDropdown", "inputProps", "InputWrapperProps", "WrapperProps", "ChipProps", "ChiProps", "ListProps", "MenuProps", "ListItemProps", "ListItemTypeProps", "IconButtonProps", "IconProps", "className", "style", "children"]);
|
131
131
|
const children = react_1.default.Children.toArray(children_);
|
132
132
|
const [value, setValue] = react_1.default.useState(() => {
|
133
133
|
const values = valueDefault !== undefined ? valueDefault : value_;
|
@@ -364,7 +364,7 @@ const Select = react_1.default.forwardRef((props_, ref) => {
|
|
364
364
|
chip && classes.chip,
|
365
365
|
open && classes.open,
|
366
366
|
readOnly && classes.readOnly
|
367
|
-
]), justify: other.align }, { children: renderValues(value) })) })), (!!items.length || children) && ((0, jsx_runtime_1.jsx)(Menu, Object.assign({ ref: refs.menu, open: open, portal: false, onClose: () => onClose(false), anchorElement: refs.root.current, transformOrigin: 'center top', transformOriginSwitch: 'center bottom', maxWidth: 'unset', size: size, menuItems: !!items.length ? (items.map((item, index) => ((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ role: 'option', selected: item.selected !== undefined ? item.selected : multiple ? value.includes(item === null || item === void 0 ? void 0 : item.value) : value === (item === null || item === void 0 ? void 0 : item.value), preselected: item.preselected !== undefined ? item.preselected : !(multiple ? value.includes(item === null || item === void 0 ? void 0 : item.value) : value === (item === null || item === void 0 ? void 0 : item.value)), onMouseUp: onMouseUp, onMouseDown: onMouseDown, primary: ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: sizeListItem === 'large' ? 'b1' : sizeListItem === 'regular' ? 'b2' : 'b3' }, ListItemTypeProps, { children: item.name }))), value: item.value, size: (MenuProps === null || MenuProps === void 0 ? void 0 : MenuProps.size) || size, button: true }, ListItemProps, item.props, { onClick: (event) => {
|
367
|
+
]), justify: other.align }, { children: renderValues(value) })) })), (!!items.length || children) && ((0, jsx_runtime_1.jsx)(Menu, Object.assign({ ref: refs.menu, open: open, portal: false, onClose: () => onClose(false), anchorElement: refs.root.current, transformOrigin: 'center top', transformOriginSwitch: 'center bottom', maxWidth: 'unset', size: size, menuItems: !!items.length ? (items.map((item, index) => ((0, jsx_runtime_1.jsx)(ListItem, Object.assign({ role: 'option', selected: item.selected !== undefined ? item.selected : multiple ? value.includes(item === null || item === void 0 ? void 0 : item.value) : value === (item === null || item === void 0 ? void 0 : item.value), preselected: item.preselected !== undefined ? item.preselected : !(multiple ? value.includes(item === null || item === void 0 ? void 0 : item.value) : value === (item === null || item === void 0 ? void 0 : item.value)), onMouseUp: onMouseUp, onMouseDown: onMouseDown, primary: getOptionName ? getOptionName(item.name, item, index) : ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: sizeListItem === 'large' ? 'b1' : sizeListItem === 'regular' ? 'b2' : 'b3' }, ListItemTypeProps, { children: item.name }))), value: item.value, size: (MenuProps === null || MenuProps === void 0 ? void 0 : MenuProps.size) || size, button: true }, ListItemProps, item.props, { onClick: (event) => {
|
368
368
|
var _a, _b;
|
369
369
|
if (multiple && value.includes(item === null || item === void 0 ? void 0 : item.value))
|
370
370
|
onUnselect(item === null || item === void 0 ? void 0 : item.value);
|
package/esm/Calendar/Calendar.js
CHANGED
@@ -135,6 +135,14 @@ const useStyle = style(theme => ({
|
|
135
135
|
}), {
|
136
136
|
name: 'onesy-Calendar'
|
137
137
|
});
|
138
|
+
// [l('millisecond'), l('milliseconds'), l('second'), l('minute'), l('minutes'), l('hour'), l('hours'), l('day'), l('days'), l('week'), l('weeks'), l('month'), l('months'), l('year')];
|
139
|
+
|
140
|
+
// [l('January'), l('February'), l('March'), l('April'), l('May'), l('June'), l('July'), l('August'), l('September'), l('October'), l('November'), l('December')];
|
141
|
+
// [l('Jan'), l('Feb'), l('Mar'), l('Apr'), l('May'), l('Jun'), l('Jul'), l('Aug'), l('Sep'), l('Oct'), l('Nov'), l('Dec')];
|
142
|
+
|
143
|
+
// [l('Monday'), l('Tuesday'), l('Wednesday'), l('Thursday'), l('Friday'), l('Saturday'), l('Sunday'];
|
144
|
+
// ['Mon'), l('Tue'), l('Wed'), l('Thu'), l('Fri'), l('Sat'), l('Sun')];
|
145
|
+
|
138
146
|
const Calendar = /*#__PURE__*/React.forwardRef((props__, ref) => {
|
139
147
|
const theme = useOnesyTheme();
|
140
148
|
const l = theme.l;
|
@@ -395,7 +403,7 @@ const Calendar = /*#__PURE__*/React.forwardRef((props__, ref) => {
|
|
395
403
|
style: {
|
396
404
|
paddingInlineStart: '16px'
|
397
405
|
}
|
398
|
-
}, format(calendarOnesyDate, 'MMMM')), /*#__PURE__*/React.createElement(CalendarMonth, _extends({
|
406
|
+
}, l(format(calendarOnesyDate, 'MMMM'))), /*#__PURE__*/React.createElement(CalendarMonth, _extends({
|
399
407
|
color: "default",
|
400
408
|
value: value,
|
401
409
|
calendar: calendarOnesyDate,
|
@@ -462,10 +470,10 @@ const Calendar = /*#__PURE__*/React.forwardRef((props__, ref) => {
|
|
462
470
|
size: size,
|
463
471
|
className: classNames([staticClassName('Calendar', theme) && ['onesy-Calendar-arrow'], classes.arrow, open === 'month' && classes.arrow_open])
|
464
472
|
})),
|
465
|
-
"aria-label": `${l('Select month')}, ${l('current')} ${month}`
|
473
|
+
"aria-label": `${l('Select month')}, ${l('current')} ${l(month)}`
|
466
474
|
}, optionButtonProps, {
|
467
475
|
className: classNames([staticClassName('Calendar', theme) && ['onesy-Calendar-option'], optionButtonProps?.className, classes.option, open === 'year' && classes.option_secondary])
|
468
|
-
}), month), /*#__PURE__*/React.createElement(Fade, {
|
476
|
+
}), l(month)), /*#__PURE__*/React.createElement(Fade, {
|
469
477
|
in: !open
|
470
478
|
}, /*#__PURE__*/React.createElement(IconButton, _extends({
|
471
479
|
onClick: () => move(),
|
@@ -568,7 +576,7 @@ const Calendar = /*#__PURE__*/React.forwardRef((props__, ref) => {
|
|
568
576
|
return /*#__PURE__*/React.createElement(ListItem, {
|
569
577
|
key: index,
|
570
578
|
onClick: () => onUpdateCalendarOption(onesyDate),
|
571
|
-
primary: format(onesyDate, 'MMMM'),
|
579
|
+
primary: l(format(onesyDate, 'MMMM')),
|
572
580
|
inset: !selected,
|
573
581
|
startAlign: "center",
|
574
582
|
size: size,
|
package/esm/Select/Select.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
4
|
-
const _excluded = ["tonal", "color", "size", "version", "value", "valueDefault", "onChange", "options", "name", "multiple", "prefix", "sufix", "start", "end", "autoWidth", "getLabel", "fullWidth", "chip", "clear", "readOnly", "noSelectText", "disabled", "renderValues", "renderChip", "IconClear", "IconDropdown", "inputProps", "InputWrapperProps", "WrapperProps", "ChipProps", "ChiProps", "ListProps", "MenuProps", "ListItemProps", "ListItemTypeProps", "IconButtonProps", "IconProps", "className", "style", "children"];
|
4
|
+
const _excluded = ["tonal", "color", "size", "version", "value", "valueDefault", "onChange", "options", "name", "multiple", "prefix", "sufix", "start", "end", "autoWidth", "getLabel", "getOptionName", "fullWidth", "chip", "clear", "readOnly", "noSelectText", "disabled", "renderValues", "renderChip", "IconClear", "IconDropdown", "inputProps", "InputWrapperProps", "WrapperProps", "ChipProps", "ChiProps", "ListProps", "MenuProps", "ListItemProps", "ListItemTypeProps", "IconButtonProps", "IconProps", "className", "style", "children"];
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
7
7
|
import React from 'react';
|
@@ -142,6 +142,7 @@ const Select = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
142
142
|
end,
|
143
143
|
autoWidth = true,
|
144
144
|
getLabel: getLabel_,
|
145
|
+
getOptionName,
|
145
146
|
fullWidth,
|
146
147
|
chip,
|
147
148
|
clear,
|
@@ -430,7 +431,7 @@ const Select = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
430
431
|
preselected: item.preselected !== undefined ? item.preselected : !(multiple ? value.includes(item?.value) : value === item?.value),
|
431
432
|
onMouseUp: onMouseUp,
|
432
433
|
onMouseDown: onMouseDown,
|
433
|
-
primary: /*#__PURE__*/React.createElement(Type, _extends({
|
434
|
+
primary: getOptionName ? getOptionName(item.name, item, index) : /*#__PURE__*/React.createElement(Type, _extends({
|
434
435
|
version: sizeListItem === 'large' ? 'b1' : sizeListItem === 'regular' ? 'b2' : 'b3'
|
435
436
|
}, ListItemTypeProps), item.name),
|
436
437
|
value: item.value,
|
package/esm/index.js
CHANGED