@homecode/ui 4.18.49 → 4.18.51

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.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/src/components/Icon/icons/index.js +2 -0
  3. package/dist/esm/src/components/Icon/icons/map.svg.js +17 -0
  4. package/dist/esm/src/components/Icon/icons/syncArrows.svg.js +17 -0
  5. package/dist/esm/src/components/Tabs/Tabs.js +5 -4
  6. package/dist/esm/types/src/components/AssistiveText/AssistiveText.d.ts +0 -1
  7. package/dist/esm/types/src/components/Button/Button.d.ts +0 -1
  8. package/dist/esm/types/src/components/Button/Button.test.d.ts +1 -0
  9. package/dist/esm/types/src/components/ButtonGroup/ButtonGroup.d.ts +0 -1
  10. package/dist/esm/types/src/components/Calendar/Calendar.d.ts +0 -1
  11. package/dist/esm/types/src/components/Container/Container.d.ts +0 -1
  12. package/dist/esm/types/src/components/DatePicker/DatePicker.d.ts +0 -1
  13. package/dist/esm/types/src/components/DatePickerInput/DatePickerInput.d.ts +0 -1
  14. package/dist/esm/types/src/components/DateTime/DateTime.d.ts +0 -1
  15. package/dist/esm/types/src/components/Expand/Expand.d.ts +0 -1
  16. package/dist/esm/types/src/components/Gallery/Dots/Dots.d.ts +0 -1
  17. package/dist/esm/types/src/components/Heading/Heading.d.ts +0 -1
  18. package/dist/esm/types/src/components/Icon/Icon.d.ts +22 -4
  19. package/dist/esm/types/src/components/Icon/Icon.example.d.ts +0 -1
  20. package/dist/esm/types/src/components/Icon/icons/index.d.ts +2 -0
  21. package/dist/esm/types/src/components/LightBox/LightBox.d.ts +0 -1
  22. package/dist/esm/types/src/components/Paranja/Paranja.d.ts +0 -1
  23. package/dist/esm/types/src/components/PopupMenu/PopupMenu.d.ts +0 -1
  24. package/dist/esm/types/src/components/Portal/Portal.d.ts +0 -1
  25. package/dist/esm/types/src/components/RequiredStar/RequiredStar.d.ts +0 -1
  26. package/dist/esm/types/src/components/Router/Router.d.ts +0 -1
  27. package/dist/esm/types/src/components/Router/context.d.ts +0 -1
  28. package/dist/esm/types/src/components/Spinner/Spinner.d.ts +0 -1
  29. package/dist/esm/types/src/components/Tabs/Tabs.d.ts +0 -1
  30. package/dist/esm/types/src/components/Tabs/Tabs.types.d.ts +1 -1
  31. package/dist/esm/types/src/components/Text/Text.d.ts +0 -1
  32. package/dist/esm/types/src/components/Theme/Theme.d.ts +0 -1
  33. package/dist/esm/types/src/components/Virtualized/List/ListScroll.d.ts +0 -1
  34. package/dist/esm/types/src/services/i18n.d.ts +0 -1
  35. package/package.json +12 -3
  36. package/tests/mocks/svgMock.js +11 -0
  37. package/dist/esm/node_modules/style-inject/dist/style-inject.es.js +0 -28
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![npm](https://img.shields.io/npm/dm/@foreverido/uilib?style=flat-square)](https://www.npmjs.com/package/@foreverido/uilib)
1
+ [![npm](https://img.shields.io/npm/dm/@homecode/ui?style=flat-square)](https://www.npmjs.com/package/@homecode/ui)
2
2
 
3
3
  # UILIB
4
4
 
@@ -31,6 +31,7 @@ var ICONS = {
31
31
  home: () => import('./home.svg.js'),
32
32
  link: () => import('./link.svg.js'),
33
33
  loader: () => import('./loader.svg.js'),
34
+ map: () => import('./map.svg.js'),
34
35
  menu: () => import('./menu.svg.js'),
35
36
  mic: () => import('./mic.svg.js'),
36
37
  minus: () => import('./minus.svg.js'),
@@ -50,6 +51,7 @@ var ICONS = {
50
51
  settings: () => import('./settings.svg.js'),
51
52
  shoppingBag: () => import('./shoppingBag.svg.js'),
52
53
  sparks: () => import('./sparks.svg.js'),
54
+ syncArrows: () => import('./syncArrows.svg.js'),
53
55
  table: () => import('./table.svg.js'),
54
56
  telegram: () => import('./telegram.svg.js'),
55
57
  };
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ var SvgMap = function SvgMap(props) {
5
+ return /*#__PURE__*/React.createElement("svg", _extends({
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ fill: "currentColor",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ d: "M15.883 23.806 8.05 21.064l-6.072 2.35q-.653.261-1.208-.147t-.555-1.093V3.893q0-.424.245-.75.245-.327.67-.49L8.05.303l7.834 2.741 6.072-2.35q.653-.261 1.208.147t.555 1.093v18.28q0 .425-.245.752-.245.326-.67.49zm-1.305-3.2V5.33L9.355 3.501V18.78Zm2.611 0 3.917-1.305V3.828L17.19 5.329zM2.826 20.28l3.917-1.501V3.5L2.826 4.807ZM17.189 5.33v15.277ZM6.743 3.5v15.28Z",
11
+ style: {
12
+ strokeWidth: 1
13
+ }
14
+ }));
15
+ };
16
+
17
+ export { SvgMap as default };
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ var SvgSyncArrows = function SvgSyncArrows(props) {
5
+ return /*#__PURE__*/React.createElement("svg", _extends({
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ fill: "currentColor",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ d: "M5.99 23.966.003 17.321l5.987-6.645 1.706 1.86-3.113 3.456h18.17v2.658H4.582l3.113 3.455zm11.973-10.632-1.706-1.86 3.113-3.456H1.2V5.36h18.17l-3.113-3.455 1.706-1.86 5.987 6.644Z",
11
+ style: {
12
+ strokeWidth: 0.0315362
13
+ }
14
+ }));
15
+ };
16
+
17
+ export { SvgSyncArrows as default };
@@ -7,7 +7,7 @@ import S from './Tabs.styl.js';
7
7
 
8
8
  const isId = id => ['string', 'number'].includes(typeof id);
9
9
  function Tabs(props) {
10
- const { size = 'm', className, contentClassName, items, hideTabsIfSingle = false, onChange, renderAll, activeId: initialId, children, ...rest } = props;
10
+ const { size = 'm', className, contentClassName, items, hideTabsIfSingle = false, allowEmpty = false, onChange, renderAll, activeId: initialId, children, ...rest } = props;
11
11
  const [activeId, setActiveId] = useState(isId(initialId) ? initialId : items[0].id);
12
12
  useEffect(() => {
13
13
  if (isId(initialId)) {
@@ -20,9 +20,10 @@ function Tabs(props) {
20
20
  e.peventDefault();
21
21
  return;
22
22
  }
23
- setActiveId(id);
24
- onChange?.(id);
25
- }, []);
23
+ const newId = allowEmpty && id === activeId ? null : id;
24
+ setActiveId(newId);
25
+ onChange?.(newId);
26
+ }, [activeId]);
26
27
  const tabsContent = [];
27
28
  const tabsButtons = items.map((params) => {
28
29
  const { id, label, forceRender, content, contentClassName: currContentClassName, ...rest } = params;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './AssistiveText.types';
3
2
  export declare function AssistiveText(props: T.Props): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Button.types';
3
2
  export type ButtonProps = T.Props;
4
3
  export declare function Button(props: T.Props): JSX.Element;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './ButtonGroup.types';
3
2
  export declare function ButtonGroup(props: T.Props): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Calendar.types';
3
2
  export declare function Calendar({ className, value, onDayPointerDown, onDayPointerUp, renderDay, renderWeekDayLabel, renderMonthLabel, renderMonthesLabel, renderYearLabel, startOfWeek, weekendClassName, hideOtherMonthDays, isDayDisabled, size, }: T.Props): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Container.types';
3
2
  export declare function Container(props: T.Props): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './DatePicker.types';
3
2
  export declare function DatePicker(props: T.Props): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './DatePickerInput.types';
3
2
  export declare function DatePickerInput(props: T.Props): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import * as T from './DateTime.types';
3
2
  export declare function formatDate({ value, format, locale }: {
4
3
  value: any;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Expand.types';
3
2
  export declare function Expand(props: T.Props): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export default function Dots({ index, count }: {
3
2
  index: any;
4
3
  count: any;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Heading.types';
3
2
  export declare const Heading: import("react").NamedExoticComponent<T.Props>;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Icon.types';
3
2
  export declare const icons: {
4
3
  avatar: () => Promise<any>;
5
4
  brokenImage: () => Promise<any>;
5
+ camera: () => Promise<any>;
6
6
  check: () => Promise<any>;
7
7
  close: () => Promise<any>;
8
8
  colors: () => Promise<any>;
@@ -14,29 +14,47 @@ export declare const icons: {
14
14
  delete: () => Promise<any>;
15
15
  draft: () => Promise<any>;
16
16
  edit: () => Promise<any>;
17
+ email: () => Promise<any>;
17
18
  externalLink: () => Promise<any>;
19
+ eye: () => Promise<any>;
20
+ forward: () => Promise<any>;
21
+ folder: () => Promise<any>;
22
+ folderOpen: () => Promise<any>;
18
23
  fullscreen: () => Promise<any>;
19
24
  fullscreenExit: () => Promise<any>;
25
+ function: () => Promise<any>;
20
26
  gear: () => Promise<any>;
27
+ geolocation: () => Promise<any>;
28
+ group: () => Promise<any>;
21
29
  history: () => Promise<any>;
30
+ image: () => Promise<any>;
31
+ instagram: () => Promise<any>;
22
32
  home: () => Promise<any>;
33
+ link: () => Promise<any>;
23
34
  loader: () => Promise<any>;
35
+ map: () => Promise<any>;
24
36
  menu: () => Promise<any>;
25
37
  mic: () => Promise<any>;
26
38
  minus: () => Promise<any>;
27
39
  moreVertical: () => Promise<any>;
28
40
  moreHorizontal: () => Promise<any>;
41
+ output: () => Promise<any>;
42
+ pause: () => Promise<any>;
43
+ play: () => Promise<any>;
29
44
  plus: () => Promise<any>;
30
45
  redo: () => Promise<any>;
31
46
  undo: () => Promise<any>;
32
47
  requiredStar: () => Promise<any>;
48
+ rewind: () => Promise<any>;
33
49
  save: () => Promise<any>;
50
+ search: () => Promise<any>;
34
51
  send: () => Promise<any>;
35
52
  settings: () => Promise<any>;
36
53
  shoppingBag: () => Promise<any>;
37
- social_instagram: () => Promise<any>;
38
- social_telegram: () => Promise<any>;
39
- social_email: () => Promise<any>;
54
+ sparks: () => Promise<any>;
55
+ syncArrows: () => Promise<any>;
56
+ table: () => Promise<any>;
57
+ telegram: () => Promise<any>;
40
58
  };
41
59
  export type { IconType } from './Icon.types';
42
60
  export declare function Icon(props: T.Props): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const _default: () => JSX.Element;
3
2
  export default _default;
@@ -31,6 +31,7 @@ declare const _default: {
31
31
  home: () => Promise<any>;
32
32
  link: () => Promise<any>;
33
33
  loader: () => Promise<any>;
34
+ map: () => Promise<any>;
34
35
  menu: () => Promise<any>;
35
36
  mic: () => Promise<any>;
36
37
  minus: () => Promise<any>;
@@ -50,6 +51,7 @@ declare const _default: {
50
51
  settings: () => Promise<any>;
51
52
  shoppingBag: () => Promise<any>;
52
53
  sparks: () => Promise<any>;
54
+ syncArrows: () => Promise<any>;
53
55
  table: () => Promise<any>;
54
56
  telegram: () => Promise<any>;
55
57
  };
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './LightBox.types';
3
2
  export declare function LightBox({ children, className, onClose, blur, ...props }: T.Props): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Paranja.types';
3
2
  export declare const Paranja: ({ className, children, visible, inline, blur, }: T.Props) => JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './PopupMenu.types';
3
2
  export declare function PopupMenu({ items, onClose, ...props }: T.Props): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  selector?: string;
4
3
  children: React.ReactNode;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './RequiredStar.types';
3
2
  export declare function RequiredStar(props: T.Props): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { RouterStore as RouterStoreType } from './store';
3
2
  import * as T from './Router.types';
4
3
  export declare const Router: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type ContextType = {
3
2
  basePath: string;
4
3
  };
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Spinner.types';
3
2
  export declare const Spinner: ({ size, className, ...props }: T.Props) => JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Tabs.types';
3
2
  export declare function Tabs(props: T.Props): string | number | boolean | import("react").ReactFragment | JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Size } from 'uilib/types';
3
2
  import { ButtonProps } from '../Button/Button';
4
3
  type ID = string | number;
@@ -20,6 +19,7 @@ export type Props = {
20
19
  contentClassName?: string;
21
20
  items: Item[];
22
21
  hideTabsIfSingle?: boolean;
22
+ allowEmpty?: boolean;
23
23
  activeId?: ID;
24
24
  onChange: (id: ID) => void;
25
25
  renderAll?: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const H1: (props: any) => JSX.Element;
3
2
  export declare const H2: (props: any) => JSX.Element;
4
3
  export declare const H3: (props: any) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import * as T from './Theme.types';
3
2
  export declare function Theme({ config }: T.Props): JSX.Element;
4
3
  export * as ThemeHelpers from './Theme.helpers';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Props as ScrollProps } from '../../Scroll/Scroll.types';
3
2
  import type { Props as ListProps } from './List';
4
3
  type Props = ListProps & {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type LangLoader = () => Promise<{
3
2
  default: object;
4
3
  }>;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "4.18.49",
3
+ "version": "4.18.51",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1",
6
+ "test": "jest",
7
7
  "ts": "tsc --noUnusedLocals",
8
8
  "dev": "NODE_OPTIONS='--loader ts-node/esm' NODE_ENV=development webpack-dev-server --mode=development --config ./src/docs/config/webpack.config.js --progress",
9
9
  "build": "rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
@@ -43,6 +43,7 @@
43
43
  "@homecode/ui": "^4.17.2",
44
44
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
45
45
  "@rollup/plugin-typescript": "^11.0.0",
46
+ "@svgr/webpack": "^8.1.0",
46
47
  "classnames": "^2.3.2",
47
48
  "compareq": "^1.2.2",
48
49
  "fastest-validator": "^1.16.0",
@@ -77,10 +78,15 @@
77
78
  "@rollup/plugin-json": "^6.0.0",
78
79
  "@rollup/plugin-node-resolve": "^15.0.1",
79
80
  "@svgr/rollup": "^6.5.1",
81
+ "@testing-library/dom": "^10.4.0",
82
+ "@testing-library/jest-dom": "^6.5.0",
83
+ "@testing-library/react": "^16.0.1",
84
+ "@testing-library/user-event": "^14.5.2",
80
85
  "@types/jest": "^29.4.0",
81
86
  "@types/node": "^18.14.0",
82
87
  "@types/react": "^18.0.28",
83
88
  "@types/react-dom": "^18.0.11",
89
+ "babel-jest": "^29.7.0",
84
90
  "babel-loader": "8",
85
91
  "babel-preset-react-app": "^10.0.1",
86
92
  "clean-webpack-plugin": "^4.0.0",
@@ -91,12 +97,14 @@
91
97
  "fs": "^0.0.2",
92
98
  "html-webpack-partials-plugin": "^0.8.0",
93
99
  "html-webpack-plugin": "^5.5.0",
100
+ "identity-obj-proxy": "^3.0.0",
101
+ "jest": "^29.7.0",
102
+ "jest-environment-jsdom": "^29.7.0",
94
103
  "mini-css-extract-plugin": "^2.7.2",
95
104
  "postcss-loader": "^7.0.2",
96
105
  "postcss-preset-env": "^8.0.1",
97
106
  "raw-loader": "^4.0.2",
98
107
  "react-hot-loader": "^4.13.1",
99
- "react-svg-loader": "^3.0.3",
100
108
  "replace": "^1.2.2",
101
109
  "rollup": "^3.17.1",
102
110
  "rollup-plugin-delete": "^2.0.0",
@@ -108,6 +116,7 @@
108
116
  "style-loader": "^3.3.1",
109
117
  "stylus": "^0.59.0",
110
118
  "stylus-loader": "^7.1.0",
119
+ "ts-jest": "^29.2.5",
111
120
  "ts-node": "^10.9.1",
112
121
  "ts-to-json": "^1.22.11",
113
122
  "typescript": "^4.9.5",
@@ -0,0 +1,11 @@
1
+ const React = require('react');
2
+
3
+ module.exports = {
4
+ ReactComponent: function SvgMock(props) {
5
+ return React.createElement('svg', {
6
+ ...props,
7
+ 'data-testid': 'svg-mock'
8
+ });
9
+ },
10
+ default: 'SvgMock'
11
+ };
@@ -1,28 +0,0 @@
1
- function styleInject(css, ref) {
2
- if ( ref === void 0 ) ref = {};
3
- var insertAt = ref.insertAt;
4
-
5
- if (!css || typeof document === 'undefined') { return; }
6
-
7
- var head = document.head || document.getElementsByTagName('head')[0];
8
- var style = document.createElement('style');
9
- style.type = 'text/css';
10
-
11
- if (insertAt === 'top') {
12
- if (head.firstChild) {
13
- head.insertBefore(style, head.firstChild);
14
- } else {
15
- head.appendChild(style);
16
- }
17
- } else {
18
- head.appendChild(style);
19
- }
20
-
21
- if (style.styleSheet) {
22
- style.styleSheet.cssText = css;
23
- } else {
24
- style.appendChild(document.createTextNode(css));
25
- }
26
- }
27
-
28
- export { styleInject as default };