@synerise/ds-core 1.5.0 → 1.5.2
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/CHANGELOG.md +19 -0
- package/README.md +181 -0
- package/dist/i18n/es.json +350 -24
- package/dist/i18n/index.d.ts +425 -23
- package/dist/i18n/pt.json +87 -11
- package/dist/js/DSProvider/DSProvider.d.ts +2 -2
- package/dist/js/DSProvider/DSProvider.js +2 -2
- package/dist/js/DSProvider/LocaleProvider/LocaleProvider.utils.d.ts +740 -0
- package/dist/js/DSProvider/ThemeProvider/breakpoints.d.ts +5 -1
- package/dist/js/data-format/components/FormattedDate.d.ts +9 -0
- package/dist/js/data-format/components/FormattedDate.js +9 -0
- package/dist/js/data-format/components/FormattedDateTime.d.ts +9 -0
- package/dist/js/data-format/components/FormattedDateTime.js +13 -0
- package/dist/js/data-format/components/FormattedNumber.d.ts +7 -0
- package/dist/js/data-format/components/FormattedNumber.js +9 -0
- package/dist/js/data-format/components/FormattedRelativeDateTime.d.ts +10 -0
- package/dist/js/data-format/components/FormattedRelativeDateTime.js +24 -0
- package/dist/js/data-format/components/FormattedTime.d.ts +9 -0
- package/dist/js/data-format/components/FormattedTime.js +13 -0
- package/dist/js/data-format/components/index.d.ts +5 -0
- package/dist/js/data-format/components/index.js +5 -0
- package/dist/js/data-format/constants/dataFormat.constants.d.ts +36 -0
- package/dist/js/data-format/constants/dataFormat.constants.js +52 -0
- package/dist/js/data-format/constants/dataFormatConfig.constants.d.ts +7 -0
- package/dist/js/data-format/constants/dataFormatConfig.constants.js +14 -0
- package/dist/js/data-format/constants/dateTimeParts.constants.d.ts +5 -0
- package/dist/js/data-format/constants/dateTimeParts.constants.js +4 -0
- package/dist/js/data-format/constants/index.d.ts +3 -0
- package/dist/js/data-format/constants/index.js +3 -0
- package/dist/js/data-format/contexts/DataFormatConfigContext.d.ts +2 -0
- package/dist/js/data-format/contexts/DataFormatConfigContext.js +3 -0
- package/dist/js/data-format/contexts/DataFormatIntlsContext.d.ts +2 -0
- package/dist/js/data-format/contexts/DataFormatIntlsContext.js +7 -0
- package/dist/js/data-format/contexts/index.d.ts +2 -0
- package/dist/js/data-format/contexts/index.js +2 -0
- package/dist/js/data-format/hocs/withDataFormat.d.ts +4 -0
- package/dist/js/data-format/hocs/withDataFormat.js +10 -0
- package/dist/js/data-format/hooks/index.d.ts +5 -0
- package/dist/js/data-format/hooks/index.js +5 -0
- package/dist/js/data-format/hooks/useDataFormat.d.ts +12 -0
- package/dist/js/data-format/hooks/useDataFormat.js +96 -0
- package/dist/js/data-format/hooks/useDataFormatConfig.d.ts +2 -0
- package/dist/js/data-format/hooks/useDataFormatConfig.js +5 -0
- package/dist/js/data-format/hooks/useDataFormatIntls.d.ts +2 -0
- package/dist/js/data-format/hooks/useDataFormatIntls.js +5 -0
- package/dist/js/data-format/hooks/useDataFormatUtils.d.ts +16 -0
- package/dist/js/data-format/hooks/useDataFormatUtils.js +113 -0
- package/dist/js/data-format/hooks/useSingleIntl.d.ts +4 -0
- package/dist/js/data-format/hooks/useSingleIntl.js +12 -0
- package/dist/js/data-format/index.d.ts +8 -0
- package/dist/js/data-format/index.js +7 -0
- package/dist/js/data-format/providers/DataFormatConfigProvider.d.ts +7 -0
- package/dist/js/data-format/providers/DataFormatConfigProvider.js +26 -0
- package/dist/js/data-format/types/dataFormat.types.d.ts +42 -0
- package/dist/js/data-format/types/dataFormat.types.js +5 -0
- package/dist/js/data-format/types/dataFormatConfig.types.d.ts +16 -0
- package/dist/js/data-format/types/dataFormatConfig.types.js +2 -0
- package/dist/js/data-format/types/dateTimeParts.types.d.ts +3 -0
- package/dist/js/data-format/types/dateTimeParts.types.js +2 -0
- package/dist/js/data-format/types/index.d.ts +3 -0
- package/dist/js/data-format/types/index.js +1 -0
- package/dist/js/data-format/utils/dataFormat.utils.d.ts +16 -0
- package/dist/js/data-format/utils/dataFormat.utils.js +119 -0
- package/dist/js/data-format/utils/dataFormatConfig.utils.d.ts +2 -0
- package/dist/js/data-format/utils/dataFormatConfig.utils.js +8 -0
- package/dist/js/data-format/utils/date.utils.d.ts +8 -0
- package/dist/js/data-format/utils/date.utils.js +50 -0
- package/dist/js/data-format/utils/dateTimeParts.utils.d.ts +14 -0
- package/dist/js/data-format/utils/dateTimeParts.utils.js +86 -0
- package/dist/js/data-format/utils/index.d.ts +5 -0
- package/dist/js/data-format/utils/index.js +5 -0
- package/dist/js/data-format/utils/timeZone.utils.d.ts +16 -0
- package/dist/js/data-format/utils/timeZone.utils.js +94 -0
- package/dist/js/index.d.ts +3 -0
- package/dist/js/index.js +4 -1
- package/dist/js/mediaQuery/mediaQuery.d.ts +1 -5
- package/dist/js/testing/index.d.ts +2 -0
- package/dist/js/testing/index.js +2 -0
- package/dist/js/testing/renderWithProvider/renderWithProvider.d.ts +10 -0
- package/dist/js/testing/renderWithProvider/renderWithProvider.js +28 -0
- package/dist/js/testing/renderWithProvider/renderWithProvider.spec.d.ts +1 -0
- package/dist/js/testing/sleep.d.ts +1 -0
- package/dist/js/testing/sleep.js +8 -0
- package/dist/js/toaster/Toaster.d.ts +2 -0
- package/dist/js/toaster/Toaster.js +8 -0
- package/dist/js/toaster/Toaster.types.d.ts +1 -0
- package/dist/js/toaster/Toaster.types.js +1 -0
- package/dist/js/toaster/constants.d.ts +2 -0
- package/dist/js/toaster/constants.js +8 -0
- package/dist/js/toaster/contexts/ToasterContext.d.ts +6 -0
- package/dist/js/toaster/contexts/ToasterContext.js +6 -0
- package/dist/js/toaster/hooks/useToaster.d.ts +1 -0
- package/dist/js/toaster/hooks/useToaster.js +5 -0
- package/dist/js/toaster/index.d.ts +6 -0
- package/dist/js/toaster/index.js +5 -0
- package/dist/js/toaster/providers/ToasterProvider.d.ts +6 -0
- package/dist/js/toaster/providers/ToasterProvider.js +17 -0
- package/package.json +14 -7
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type RenderOptions, type RenderResult } from '@testing-library/react';
|
|
3
|
+
import { type DSProviderProps } from '../../DSProvider/DSProvider';
|
|
4
|
+
import { type DataFormatNotationType } from '../../data-format';
|
|
5
|
+
type Options = Omit<RenderOptions, 'queries'>;
|
|
6
|
+
declare const renderWithProvider: (node: ReactNode, options?: Options, props?: Partial<Omit<DSProviderProps, "onErrorIntl" | "dataFormatConfig">> & {
|
|
7
|
+
notation?: DataFormatNotationType;
|
|
8
|
+
applyTimeZoneOffset?: boolean;
|
|
9
|
+
}) => RenderResult;
|
|
10
|
+
export default renderWithProvider;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var _excluded = ["notation", "applyTimeZoneOffset"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { render } from '@testing-library/react';
|
|
6
|
+
import DSProvider from '../../DSProvider/DSProvider';
|
|
7
|
+
import { getDataFormatConfigFromNotation } from '../../data-format';
|
|
8
|
+
var _renderWithProvider = function renderWithProvider(node, options, props) {
|
|
9
|
+
var _ref = props || {},
|
|
10
|
+
notation = _ref.notation,
|
|
11
|
+
applyTimeZoneOffset = _ref.applyTimeZoneOffset,
|
|
12
|
+
providerProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
13
|
+
var dataFormatConfigProps = applyTimeZoneOffset !== undefined || notation ? _extends({}, notation ? getDataFormatConfigFromNotation(notation) : {}, {
|
|
14
|
+
applyTimeZoneOffset: applyTimeZoneOffset
|
|
15
|
+
}) : {};
|
|
16
|
+
var rendered = render(/*#__PURE__*/React.createElement(DSProvider, _extends({
|
|
17
|
+
onErrorIntl: function onErrorIntl() {},
|
|
18
|
+
dataFormatConfig: dataFormatConfigProps
|
|
19
|
+
}, providerProps), node), options);
|
|
20
|
+
return _extends({}, rendered, {
|
|
21
|
+
rerender: function rerender(ui, opt) {
|
|
22
|
+
return _renderWithProvider(ui, _extends({
|
|
23
|
+
container: rendered.container
|
|
24
|
+
}, opt));
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export default _renderWithProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sleep: (duration?: number) => Promise<unknown>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Toaster as BaseToaster } from 'react-hot-toast';
|
|
3
|
+
import { useToaster } from './hooks/useToaster';
|
|
4
|
+
export var Toaster = function Toaster() {
|
|
5
|
+
var _useToaster = useToaster(),
|
|
6
|
+
options = _useToaster.options;
|
|
7
|
+
return /*#__PURE__*/React.createElement(BaseToaster, options);
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ToasterProps } from 'react-hot-toast';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useToaster: () => import("../contexts/ToasterContext").ToastContextType;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Toaster as default } from './Toaster';
|
|
2
|
+
export { TOASTER_DEFAULTS } from './constants';
|
|
3
|
+
export { ToasterContext, type ToastContextType, } from './contexts/ToasterContext';
|
|
4
|
+
export { useToaster } from './hooks/useToaster';
|
|
5
|
+
export { ToasterProvider } from './providers/ToasterProvider';
|
|
6
|
+
export type { ToasterProps } from './Toaster.types';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Toaster as default } from './Toaster';
|
|
2
|
+
export { TOASTER_DEFAULTS } from './constants';
|
|
3
|
+
export { ToasterContext } from './contexts/ToasterContext';
|
|
4
|
+
export { useToaster } from './hooks/useToaster';
|
|
5
|
+
export { ToasterProvider } from './providers/ToasterProvider';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { TOASTER_DEFAULTS } from '../constants';
|
|
3
|
+
import { ToasterContext } from '../contexts/ToasterContext';
|
|
4
|
+
export var ToasterProvider = function ToasterProvider(_ref) {
|
|
5
|
+
var children = _ref.children,
|
|
6
|
+
_ref$toasterProps = _ref.toasterProps,
|
|
7
|
+
toasterProps = _ref$toasterProps === void 0 ? TOASTER_DEFAULTS : _ref$toasterProps;
|
|
8
|
+
var _useState = useState(toasterProps),
|
|
9
|
+
options = _useState[0],
|
|
10
|
+
setOptions = _useState[1];
|
|
11
|
+
return /*#__PURE__*/React.createElement(ToasterContext.Provider, {
|
|
12
|
+
value: {
|
|
13
|
+
options: options,
|
|
14
|
+
setOptions: setOptions
|
|
15
|
+
}
|
|
16
|
+
}, children);
|
|
17
|
+
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Core Components for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
7
7
|
"main": "dist/js/index.js",
|
|
8
|
+
"types": "dist/js/index.d.ts",
|
|
8
9
|
"files": [
|
|
9
10
|
"/dist",
|
|
10
11
|
"CHANGELOG.md",
|
|
@@ -24,18 +25,24 @@
|
|
|
24
25
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
25
26
|
"pack:ci": "npm pack --pack-destination ../../storybook/storybook-static/static",
|
|
26
27
|
"prepublish": "npm run build",
|
|
27
|
-
"test": "jest",
|
|
28
|
+
"test": "jest && yarn test:timezones",
|
|
29
|
+
"test:timezone-ny": "TZ=America/New_York jest -t TimezoneTesting",
|
|
30
|
+
"test:timezone-utc": "TZ=UTC jest -t TimezoneTesting",
|
|
31
|
+
"test:timezone-waw": "TZ=Europe/Warsaw jest -t TimezoneTesting",
|
|
32
|
+
"test:timezones": "yarn test:timezone-utc && yarn test:timezone-ny && yarn test:timezone-waw",
|
|
28
33
|
"test:watch": "npm run test -- --watchAll",
|
|
29
34
|
"types": "tsc --noEmit",
|
|
35
|
+
"check:circular-dependencies": "madge --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json src/ --exclude '/dist/'",
|
|
30
36
|
"upgrade:ds": "ncu -f \"@synerise/ds-*\" -u",
|
|
31
37
|
"vars": "node ./build/vars.js"
|
|
32
38
|
},
|
|
33
|
-
"types": "dist/js/index.js",
|
|
34
39
|
"dependencies": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
40
|
+
"date-fns-tz": "^1.1.4",
|
|
41
|
+
"dayjs": "^1.8.36",
|
|
37
42
|
"deepmerge": "^4.2.2",
|
|
38
|
-
"flat": "^5.0.2"
|
|
43
|
+
"flat": "^5.0.2",
|
|
44
|
+
"moment": "^2.30.1",
|
|
45
|
+
"react-hot-toast": "^2.5.2"
|
|
39
46
|
},
|
|
40
47
|
"peerDependencies": {
|
|
41
48
|
"antd": "4.24.16",
|
|
@@ -49,5 +56,5 @@
|
|
|
49
56
|
"hex-rgb": "^5.0.0",
|
|
50
57
|
"less-vars-to-js": "^1.3.0"
|
|
51
58
|
},
|
|
52
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "5beb6ab5f2d77b9e98e04caab7dff20b8436078b"
|
|
53
60
|
}
|