superdesk-ui-framework 4.0.42 → 4.0.44
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/app-typescript/components/DatePicker.tsx +51 -26
- package/app-typescript/components/DurationInput.tsx +1 -1
- package/app-typescript/index.ts +1 -1
- package/app-typescript/localization.tsx +17 -0
- package/dist/examples.bundle.js +78790 -57384
- package/dist/superdesk-ui.bundle.js +76325 -55999
- package/dist/vendor.bundle.js +20 -20
- package/package.json +7 -5
- package/react/components/Alert.js +17 -7
- package/react/components/Autocomplete.js +18 -9
- package/react/components/Badge.js +17 -7
- package/react/components/Button.js +17 -7
- package/react/components/ButtonGroup.js +17 -7
- package/react/components/Card.js +17 -7
- package/react/components/Carousel.js +17 -7
- package/react/components/CheckButtonGroup.js +17 -7
- package/react/components/CheckGroup.js +17 -7
- package/react/components/Checkbox.js +17 -7
- package/react/components/CheckboxButton.js +17 -7
- package/react/components/ContentDivider.js +17 -7
- package/react/components/CreateButton.js +17 -7
- package/react/components/DatePicker.d.ts +7 -2
- package/react/components/DatePicker.js +61 -11
- package/react/components/DateTimePicker.js +17 -7
- package/react/components/Divider.js +17 -7
- package/react/components/DonutChart.js +17 -7
- package/react/components/DragHandle.js +17 -7
- package/react/components/DragHandleDots.js +17 -7
- package/react/components/DropZone.js +17 -7
- package/react/components/Dropdown.js +17 -7
- package/react/components/DropdownFirst.js +17 -7
- package/react/components/DurationInput.js +20 -10
- package/react/components/EmptyState.js +17 -7
- package/react/components/Form/FormGroup.js +17 -7
- package/react/components/Form/FormItem.js +17 -7
- package/react/components/Form/FormLabel.js +17 -7
- package/react/components/Form/FormRow.js +17 -7
- package/react/components/Form/FormRowNew.js +17 -7
- package/react/components/Form/FormText.js +17 -7
- package/react/components/Form/InputBase.js +18 -9
- package/react/components/Form/InputNew.js +18 -9
- package/react/components/Form/InputWrapper.js +18 -9
- package/react/components/FormLabel.js +17 -7
- package/react/components/GridItem.js +17 -7
- package/react/components/GridList.js +17 -7
- package/react/components/HeadingText.js +17 -7
- package/react/components/HelloWorld.js +17 -7
- package/react/components/Icon.js +17 -7
- package/react/components/IconButton.js +17 -7
- package/react/components/IconLabel.js +17 -7
- package/react/components/IconPicker.js +17 -7
- package/react/components/IllustrationButton.js +17 -7
- package/react/components/Input.js +17 -7
- package/react/components/Label.js +17 -7
- package/react/components/Layouts/AuthorinInnerSideBar.js +17 -7
- package/react/components/Layouts/AuthoringContainer.js +17 -7
- package/react/components/Layouts/AuthoringFrame.js +17 -7
- package/react/components/Layouts/AuthoringFrameContainer.js +17 -7
- package/react/components/Layouts/AuthoringFrameLeftBar.js +17 -7
- package/react/components/Layouts/AuthoringFrameMain.js +17 -7
- package/react/components/Layouts/AuthoringFrameNavBar.js +17 -7
- package/react/components/Layouts/AuthoringFrameOverlay.js +17 -7
- package/react/components/Layouts/AuthoringFrameRightBar.js +17 -7
- package/react/components/Layouts/AuthoringFrameSidePanel.js +17 -7
- package/react/components/Layouts/AuthoringFrameSidePanelOverlay.js +17 -7
- package/react/components/Layouts/AuthoringInnerBody.js +17 -7
- package/react/components/Layouts/AuthoringInnerHeader.js +17 -7
- package/react/components/Layouts/AuthoringMain.js +17 -7
- package/react/components/Layouts/AuthoringMainContainer.js +17 -7
- package/react/components/Layouts/AuthoringMainContent.js +17 -7
- package/react/components/Layouts/AuthoringMainToolBar.js +17 -7
- package/react/components/Layouts/BottomBarAction.js +17 -7
- package/react/components/Layouts/Container.js +17 -7
- package/react/components/Layouts/ContentSplitter.js +17 -7
- package/react/components/Layouts/CoreLayout.js +17 -7
- package/react/components/Layouts/CoreLayoutContainer.js +17 -7
- package/react/components/Layouts/CoreLayoutFooter.js +17 -7
- package/react/components/Layouts/CoreLayoutMain.js +17 -7
- package/react/components/Layouts/CoreLayoutOverlay.js +17 -7
- package/react/components/Layouts/CoreLayoutSlideInMenu.js +17 -7
- package/react/components/Layouts/CoreLayoutTopMenu.js +17 -7
- package/react/components/Layouts/HamburgerButton.js +17 -7
- package/react/components/Layouts/HeaderPanel.js +17 -7
- package/react/components/Layouts/Layout.js +17 -7
- package/react/components/Layouts/LayoutContainer.js +17 -7
- package/react/components/Layouts/LeftPanel.js +17 -7
- package/react/components/Layouts/MainMenu.js +17 -7
- package/react/components/Layouts/MainPanel.js +17 -7
- package/react/components/Layouts/NotificationPanel.js +17 -7
- package/react/components/Layouts/OverlayPanel.js +17 -7
- package/react/components/Layouts/PageLayout.js +17 -7
- package/react/components/Layouts/Panel.js +17 -7
- package/react/components/Layouts/RightPanel.js +17 -7
- package/react/components/LeftMenu.js +17 -7
- package/react/components/ListItemLoader.js +17 -7
- package/react/components/Lists/BoxedList.js +17 -7
- package/react/components/Lists/CalendarWeekDayItem.js +17 -7
- package/react/components/Lists/ContentList.js +17 -7
- package/react/components/Lists/SimpleList.js +17 -7
- package/react/components/Lists/TableList.js +17 -7
- package/react/components/Loader.js +17 -7
- package/react/components/Menu.js +17 -7
- package/react/components/Modal.js +17 -7
- package/react/components/MultiSelect.js +17 -7
- package/react/components/NavButton.js +17 -7
- package/react/components/Navigation/BottomNav.js +17 -7
- package/react/components/Navigation/QuickNavBar.js +17 -7
- package/react/components/Navigation/SideBarMenu.js +17 -7
- package/react/components/Navigation/SideBarTabs.js +17 -7
- package/react/components/Popover.js +17 -7
- package/react/components/PropsList.js +17 -7
- package/react/components/RadioButtonGroup.js +17 -7
- package/react/components/RadioGroup.js +17 -7
- package/react/components/ResizablePanels.js +17 -7
- package/react/components/Rotate.js +17 -7
- package/react/components/SearchBar.js +17 -7
- package/react/components/Select.js +17 -7
- package/react/components/SelectGrid.js +17 -7
- package/react/components/SelectPreview.js +17 -7
- package/react/components/SelectWithTemplate.js +17 -7
- package/react/components/ShowPopup.js +19 -9
- package/react/components/SingleAndDoubleClickFunction.d.ts +0 -1
- package/react/components/SingleAndDoubleClickFunction.js +1 -2
- package/react/components/Skeleton.js +17 -7
- package/react/components/SlidingToolbar.js +17 -7
- package/react/components/Spinner.js +17 -7
- package/react/components/StrechBar.js +17 -7
- package/react/components/SubNav.js +17 -7
- package/react/components/SvgIconIllustration.js +17 -7
- package/react/components/Switch.js +17 -7
- package/react/components/SwitchGroup.js +17 -7
- package/react/components/TabCustom.js +17 -7
- package/react/components/TabList.js +17 -7
- package/react/components/Tag.js +17 -7
- package/react/components/TagInput.js +17 -7
- package/react/components/Text/Heading.js +17 -7
- package/react/components/Text/Text.js +17 -7
- package/react/components/Text/Time.js +17 -7
- package/react/components/ThemeSelector.js +17 -7
- package/react/components/TimePicker.js +17 -7
- package/react/components/TimePickerV2.js +17 -7
- package/react/components/Toast.js +17 -7
- package/react/components/ToastMessage.js +17 -7
- package/react/components/ToastText.js +17 -7
- package/react/components/ToastWrapper.js +17 -7
- package/react/components/ToggleBox/CustomHeaderToggleBox.js +18 -9
- package/react/components/ToggleBox/SimpleToggleBox.js +18 -9
- package/react/components/ToggleBox/index.js +17 -7
- package/react/components/Tooltip.js +17 -7
- package/react/components/TreeMenu.js +17 -7
- package/react/components/TreeSelect/TreeSelect.js +17 -7
- package/react/components/TreeSelect/TreeSelectItem.js +19 -9
- package/react/components/TreeSelect/TreeSelectPill.js +17 -7
- package/react/components/WithPagination.js +19 -9
- package/react/components/WithPopover.js +17 -7
- package/react/components/WithPortal.js +19 -9
- package/react/components/WithSizeObserver.js +17 -7
- package/react/components/_Positioner.js +17 -7
- package/react/components/avatar/avatar-action-add.js +17 -7
- package/react/components/avatar/avatar-group.js +17 -7
- package/react/components/avatar/avatar-image.js +17 -7
- package/react/components/avatar/avatar-number.js +17 -7
- package/react/components/avatar/avatar-placeholder.js +17 -7
- package/react/components/avatar/avatar-text.js +17 -7
- package/react/components/avatar/avatar-wrapper.js +17 -7
- package/react/components/avatar/avatar.js +17 -7
- package/react/helpers.js +3 -4
- package/react/index.d.ts +1 -1
- package/react/index.js +3 -1
- package/react/localization.d.ts +9 -0
- package/react/localization.js +13 -0
- package/react/zIndex.js +2 -2
@@ -8,8 +8,10 @@ import nextId from "react-id-generator";
|
|
8
8
|
import { InputWrapper } from './Form';
|
9
9
|
import { IInputWrapper } from './Form/InputWrapper';
|
10
10
|
import {Button} from './Button';
|
11
|
-
|
12
|
-
|
11
|
+
import {getWeekStartByLocale} from 'weekstart';
|
12
|
+
import {getMonthNames, getWeekdayNames} from '@sourcefabric/common';
|
13
|
+
import {localization} from '../localization';
|
14
|
+
import {assertNever} from '../helpers';
|
13
15
|
|
14
16
|
interface IDatePickerBase extends IInputWrapper {
|
15
17
|
dateFormat: string; // a combination of YYYY, MM, and DD with a custom separator e.g. 'MM/DD/YYYY'
|
@@ -18,21 +20,7 @@ interface IDatePickerBase extends IInputWrapper {
|
|
18
20
|
// for example [{label: 'tomorrow', days: 1}, {label: 'yesterday', days: -1}]
|
19
21
|
headerButtonBar?: Array<{days: number, label: string}>;
|
20
22
|
|
21
|
-
|
22
|
-
/*
|
23
|
-
locale={{
|
24
|
-
firstDayOfWeek: 1,
|
25
|
-
dayNames: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"],
|
26
|
-
dayNamesShort: ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"],
|
27
|
-
dayNamesMin: ["D", "L", "M", "X", "J", "V", "S"],
|
28
|
-
monthNames: [
|
29
|
-
"enero", "febrero", "marzo", "abril", "mayo", "junio",
|
30
|
-
"julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"
|
31
|
-
],
|
32
|
-
monthNamesShort: ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"],
|
33
|
-
}}
|
34
|
-
*/
|
35
|
-
locale?: DatePickerLocaleSettings;
|
23
|
+
locale?: {type: 'code-only', code: string} | {type: 'full', payload: Omit<LocaleSettings, 'today' | 'clear'>};
|
36
24
|
|
37
25
|
hideClearButton?: boolean;
|
38
26
|
}
|
@@ -81,6 +69,36 @@ function parseToPrimeReactCalendarFormat(value: IDatePicker['value']): CalendarP
|
|
81
69
|
return value === null ? undefined : value;
|
82
70
|
}
|
83
71
|
|
72
|
+
function getDatePickerLocale(code?: string): LocaleSettings {
|
73
|
+
const localeCode = code ?? 'en-US';
|
74
|
+
const firstDayOfWeek = getWeekStartByLocale(localeCode);
|
75
|
+
|
76
|
+
const dayNames: {long: Array<string>; short: Array<string>; narrow: Array<string>} = {
|
77
|
+
long: [],
|
78
|
+
short: [],
|
79
|
+
narrow: [],
|
80
|
+
};
|
81
|
+
|
82
|
+
for (const weekday of getWeekdayNames(0, localeCode)) {
|
83
|
+
dayNames.long.push(weekday.nameLong);
|
84
|
+
dayNames.short.push(weekday.nameShort);
|
85
|
+
dayNames.narrow.push(weekday.nameNarrow);
|
86
|
+
}
|
87
|
+
|
88
|
+
const locale: LocaleSettings = {
|
89
|
+
firstDayOfWeek: firstDayOfWeek,
|
90
|
+
dayNames: dayNames.long,
|
91
|
+
dayNamesShort: dayNames.short,
|
92
|
+
dayNamesMin: dayNames.short, // using short instead of narrow on purpose
|
93
|
+
monthNames: getMonthNames(localeCode, 'long'),
|
94
|
+
monthNamesShort: getMonthNames(localeCode, 'short'),
|
95
|
+
today: localization.translations.today,
|
96
|
+
clear: localization.translations.clear,
|
97
|
+
};
|
98
|
+
|
99
|
+
return locale;
|
100
|
+
}
|
101
|
+
|
84
102
|
export class DatePicker extends React.PureComponent<IDatePicker, IState> {
|
85
103
|
private instance: IPrivatePrimeReactCalendarApi | undefined;
|
86
104
|
hidePopupOnScroll: () => void;
|
@@ -128,15 +146,6 @@ export class DatePicker extends React.PureComponent<IDatePicker, IState> {
|
|
128
146
|
}
|
129
147
|
|
130
148
|
render() {
|
131
|
-
let locale: LocaleSettings | undefined;
|
132
|
-
if (this.props.locale != null) {
|
133
|
-
locale = {
|
134
|
-
...this.props.locale,
|
135
|
-
today: 'today',
|
136
|
-
clear: 'clear',
|
137
|
-
};
|
138
|
-
}
|
139
|
-
|
140
149
|
if (this.props.preview) {
|
141
150
|
return (
|
142
151
|
// We have to do type assertion here because we wrap primereact's component using
|
@@ -148,6 +157,22 @@ export class DatePicker extends React.PureComponent<IDatePicker, IState> {
|
|
148
157
|
);
|
149
158
|
}
|
150
159
|
|
160
|
+
const locale: LocaleSettings | undefined = (() => {
|
161
|
+
if (this.props.locale == null) {
|
162
|
+
return undefined;
|
163
|
+
} else if (this.props.locale.type === 'code-only') {
|
164
|
+
return getDatePickerLocale(this.props.locale.code);
|
165
|
+
} else if (this.props.locale.type === 'full') {
|
166
|
+
return {
|
167
|
+
...this.props.locale.payload,
|
168
|
+
today: localization.translations.today,
|
169
|
+
clear: localization.translations.clear,
|
170
|
+
} satisfies LocaleSettings;
|
171
|
+
} else {
|
172
|
+
return assertNever(this.props.locale);
|
173
|
+
}
|
174
|
+
})();
|
175
|
+
|
151
176
|
const showClearButton = this.props.required === true
|
152
177
|
? false
|
153
178
|
: this.props.hideClearButton !== true;
|
@@ -85,7 +85,7 @@ export class DurationInput extends React.PureComponent<IProps, IState> {
|
|
85
85
|
}
|
86
86
|
if (Number(this.minuteRef.current.value) < 0) {
|
87
87
|
this.setState({
|
88
|
-
hours: this.zeroPad(Number(this.state.hours)) > 0
|
88
|
+
hours: parseInt(`${this.zeroPad(Number(this.state.hours))}`, 10) > 0
|
89
89
|
? this.zeroPad(Number(this.state.hours) - 1)
|
90
90
|
: this.zeroPad(Number(this.state.hours)),
|
91
91
|
minutes: 59,
|
package/app-typescript/index.ts
CHANGED
@@ -27,7 +27,6 @@ export { getDurationString } from './components/DurationInput';
|
|
27
27
|
export { DatePicker } from './components/DatePicker';
|
28
28
|
export { DateTimePicker } from './components/DateTimePicker';
|
29
29
|
export { DatePickerISO } from './components/DatePicker';
|
30
|
-
export { DatePickerLocaleSettings } from './components/DatePicker';
|
31
30
|
export { TimePicker } from './components/TimePicker';
|
32
31
|
export { TimePickerV2 } from './components/TimePickerV2';
|
33
32
|
export { FormLabel } from './components/FormLabel';
|
@@ -109,6 +108,7 @@ export { DragHandleDots } from './components/DragHandleDots';
|
|
109
108
|
export { DragHandle } from './components/DragHandle';
|
110
109
|
export {CalendarWeekDayItem, WeeklyCalendarGrid, WeeklyCalendarGridItem} from './components/Lists/CalendarWeekDayItem';
|
111
110
|
export { getTextColor } from './helpers';
|
111
|
+
export { setupLocalization } from './localization';
|
112
112
|
|
113
113
|
// declare non-typescript exports to prevent errors
|
114
114
|
export declare const ToggleBoxNext: any;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
interface ILocalization {
|
2
|
+
translations: {
|
3
|
+
today: string;
|
4
|
+
clear: string;
|
5
|
+
};
|
6
|
+
}
|
7
|
+
|
8
|
+
export let localization: ILocalization = {
|
9
|
+
translations: {
|
10
|
+
today: 'today',
|
11
|
+
clear: 'clear',
|
12
|
+
},
|
13
|
+
};
|
14
|
+
|
15
|
+
export function setupLocalization(val: ILocalization) {
|
16
|
+
localization = val;
|
17
|
+
}
|