@synerise/ds-cascader 1.1.26 → 1.1.27

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 (45) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/Cascader.d.ts +2 -2
  3. package/dist/Cascader.js +85 -143
  4. package/dist/Cascader.styles.d.ts +6 -6
  5. package/dist/Cascader.styles.js +19 -17
  6. package/dist/Cascader.types.d.ts +1 -1
  7. package/dist/Cascader.types.js +1 -1
  8. package/dist/Elements/BackAction/BackAction.d.ts +2 -2
  9. package/dist/Elements/BackAction/BackAction.js +18 -16
  10. package/dist/Elements/BackAction/BackAction.styles.d.ts +4 -4
  11. package/dist/Elements/BackAction/BackAction.styles.js +15 -17
  12. package/dist/Elements/BackAction/BackAction.types.d.ts +1 -1
  13. package/dist/Elements/BackAction/BackAction.types.js +1 -1
  14. package/dist/Elements/BottomAction/BottomAction.d.ts +2 -2
  15. package/dist/Elements/BottomAction/BottomAction.js +14 -13
  16. package/dist/Elements/BottomAction/BottomAction.styles.d.ts +3 -3
  17. package/dist/Elements/BottomAction/BottomAction.styles.js +11 -14
  18. package/dist/Elements/BottomAction/BottomAction.types.d.ts +1 -1
  19. package/dist/Elements/BottomAction/BottomAction.types.js +1 -1
  20. package/dist/Elements/Breadcrumb/Breadcrumb.d.ts +2 -2
  21. package/dist/Elements/Breadcrumb/Breadcrumb.js +47 -73
  22. package/dist/Elements/Breadcrumb/Breadcrumb.styles.d.ts +13 -13
  23. package/dist/Elements/Breadcrumb/Breadcrumb.styles.js +36 -46
  24. package/dist/Elements/Breadcrumb/Breadcrumb.types.d.ts +2 -2
  25. package/dist/Elements/Breadcrumb/Breadcrumb.types.js +1 -1
  26. package/dist/Elements/Breadcrumb/utils.d.ts +1 -1
  27. package/dist/Elements/Breadcrumb/utils.js +15 -9
  28. package/dist/Elements/BreadcrumbsList/BreadcrumbsList.d.ts +4 -4
  29. package/dist/Elements/BreadcrumbsList/BreadcrumbsList.js +28 -35
  30. package/dist/Elements/BreadcrumbsList/BreadcrumbsList.types.d.ts +2 -2
  31. package/dist/Elements/BreadcrumbsList/BreadcrumbsList.types.js +1 -1
  32. package/dist/Elements/CategoriesList/CategoriesList.d.ts +2 -2
  33. package/dist/Elements/CategoriesList/CategoriesList.js +26 -49
  34. package/dist/Elements/CategoriesList/CategoriesList.types.d.ts +2 -2
  35. package/dist/Elements/CategoriesList/CategoriesList.types.js +1 -1
  36. package/dist/Elements/Navigation/Navigation.d.ts +2 -2
  37. package/dist/Elements/Navigation/Navigation.js +32 -40
  38. package/dist/Elements/Navigation/Navigation.types.d.ts +1 -1
  39. package/dist/Elements/Navigation/Navigation.types.js +1 -1
  40. package/dist/index.js +6 -2
  41. package/dist/modules.d.js +1 -1
  42. package/dist/modules.d.ts +0 -0
  43. package/dist/utils.d.ts +1 -1
  44. package/dist/utils.js +37 -43
  45. package/package.json +11 -11
@@ -1,43 +1,35 @@
1
- import React from 'react';
2
- import { theme } from '@synerise/ds-core';
3
- import Divider from '@synerise/ds-divider';
4
- import Icon, { HomeM } from '@synerise/ds-icon';
5
- import * as S from '../../Cascader.styles';
6
- import { BackAction } from '../BackAction/BackAction';
7
- import { Breadcrumb } from '../Breadcrumb/Breadcrumb';
8
- export var Navigation = function Navigation(_ref) {
9
- var backActionVisible = _ref.backActionVisible,
10
- onHomeIconClick = _ref.onHomeIconClick,
11
- onPathClick = _ref.onPathClick,
12
- activeCategory = _ref.activeCategory,
13
- previousCategory = _ref.previousCategory,
14
- breadcrumbVisible = _ref.breadcrumbVisible;
15
- var renderBreadcrumbs = function renderBreadcrumbs() {
16
- return breadcrumbVisible && activeCategory ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Breadcrumb, {
17
- isNavigation: true,
18
- path: activeCategory.path,
19
- onPathClick: onPathClick,
20
- gradientOverlap: true,
21
- highlightActivePath: true,
22
- prefixel: /*#__PURE__*/React.createElement(S.BreadcrumbPrefix, {
23
- onClick: onHomeIconClick
24
- }, /*#__PURE__*/React.createElement(Icon, {
25
- component: /*#__PURE__*/React.createElement(HomeM, null),
26
- color: theme.palette['grey-600']
27
- })),
28
- compact: true
29
- }), /*#__PURE__*/React.createElement(S.DividerContainer, null, /*#__PURE__*/React.createElement(Divider, {
30
- dashed: true
31
- }))) : null;
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { theme } from "@synerise/ds-core";
3
+ import Divider from "@synerise/ds-divider";
4
+ import Icon, { HomeM } from "@synerise/ds-icon";
5
+ import { BreadcrumbPrefix, DividerContainer } from "../../Cascader.styles.js";
6
+ import { BackAction } from "../BackAction/BackAction.js";
7
+ import { Breadcrumb } from "../Breadcrumb/Breadcrumb.js";
8
+ const Navigation = ({
9
+ backActionVisible,
10
+ onHomeIconClick,
11
+ onPathClick,
12
+ activeCategory,
13
+ previousCategory,
14
+ breadcrumbVisible
15
+ }) => {
16
+ const renderBreadcrumbs = () => {
17
+ return breadcrumbVisible && activeCategory ? /* @__PURE__ */ jsxs(Fragment, { children: [
18
+ /* @__PURE__ */ jsx(Breadcrumb, { isNavigation: true, path: activeCategory.path, onPathClick, gradientOverlap: true, highlightActivePath: true, prefixel: /* @__PURE__ */ jsx(BreadcrumbPrefix, { onClick: onHomeIconClick, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(HomeM, {}), color: theme.palette["grey-600"] }) }), compact: true }),
19
+ /* @__PURE__ */ jsx(DividerContainer, { children: /* @__PURE__ */ jsx(Divider, { dashed: true }) })
20
+ ] }) : null;
32
21
  };
33
- var renderBackAction = function renderBackAction() {
34
- return backActionVisible && previousCategory ? /*#__PURE__*/React.createElement(BackAction, {
35
- label: previousCategory.name,
36
- onClick: function onClick() {
37
- onPathClick(previousCategory.name);
38
- }
39
- }) : null;
22
+ const renderBackAction = () => {
23
+ return backActionVisible && previousCategory ? /* @__PURE__ */ jsx(BackAction, { label: previousCategory.name, onClick: () => {
24
+ onPathClick(previousCategory.name);
25
+ } }) : null;
40
26
  };
41
- return /*#__PURE__*/React.createElement(React.Fragment, null, renderBreadcrumbs(), renderBackAction());
27
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ renderBreadcrumbs(),
29
+ renderBackAction()
30
+ ] });
31
+ };
32
+ export {
33
+ Navigation,
34
+ Navigation as default
42
35
  };
43
- export default Navigation;
@@ -1,4 +1,4 @@
1
- import type { Category } from '../../Cascader.types';
1
+ import { Category } from '../../Cascader.types';
2
2
  export type NavigationProps = {
3
3
  breadcrumbVisible?: boolean;
4
4
  backActionVisible?: boolean;
@@ -1 +1 @@
1
- export {};
1
+
package/dist/index.js CHANGED
@@ -1,2 +1,6 @@
1
- export { default } from './Cascader';
2
- export { Breadcrumb } from './Elements/Breadcrumb/Breadcrumb';
1
+ import { Cascader } from "./Cascader.js";
2
+ import { Breadcrumb } from "./Elements/Breadcrumb/Breadcrumb.js";
3
+ export {
4
+ Breadcrumb,
5
+ Cascader as default
6
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom';
1
+ import "@testing-library/jest-dom";
File without changes
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type Category, type Path } from './Cascader.types';
1
+ import { Category, Path } from './Cascader.types';
2
2
  export declare const searchCategoryWithId: (category: Category, id: string | number) => Category | undefined;
3
3
  export declare const getAllPaths: (category: Category, resultsArray?: Path[]) => Path[] | undefined;
4
4
  export declare const filterPaths: (paths: Path[], searchQuery: string) => Path[];
package/dist/utils.js CHANGED
@@ -1,23 +1,19 @@
1
- var _searchCategoryWithId = function searchCategoryWithId(category, id) {
2
- if (id === undefined) {
3
- return undefined;
1
+ const searchCategoryWithId = (category, id) => {
2
+ if (id === void 0) {
3
+ return void 0;
4
4
  }
5
5
  if (category.id === id) {
6
6
  return category;
7
7
  }
8
- var result, property;
9
- var keys = Object.keys(category);
10
- for (var i = 0; i < keys.length; i += 1) {
8
+ let result, property;
9
+ const keys = Object.keys(category);
10
+ for (let i = 0; i < keys.length; i += 1) {
11
11
  property = keys[i];
12
- if (Object.prototype.hasOwnProperty.call(category, property) &&
13
- // @ts-expect-error rootCategory is in fact more than what Category type defines
12
+ if (Object.prototype.hasOwnProperty.call(category, property) && // @ts-expect-error rootCategory is in fact more than what Category type defines
14
13
  // apart from id, name and path it can have nested categories with any key
15
14
  // STOR-1904
16
- typeof category[property] === 'object') {
17
- // @ts-expect-error rootCategory is in fact more than what Category type defines
18
- // apart from id, name and path it can have nested categories with any key
19
- // STOR-1904
20
- result = _searchCategoryWithId(category[property], id);
15
+ typeof category[property] === "object") {
16
+ result = searchCategoryWithId(category[property], id);
21
17
  if (result) {
22
18
  return result;
23
19
  }
@@ -25,56 +21,54 @@ var _searchCategoryWithId = function searchCategoryWithId(category, id) {
25
21
  }
26
22
  return result;
27
23
  };
28
- export { _searchCategoryWithId as searchCategoryWithId };
29
- var _getAllPaths = function getAllPaths(category, resultsArray) {
30
- var results = resultsArray || [];
24
+ const getAllPaths = (category, resultsArray) => {
25
+ let results = resultsArray || [];
31
26
  if (category.path && category.path.length > 0) {
32
27
  results.push({
33
28
  path: category.path,
34
29
  id: category.id
35
30
  });
36
31
  }
37
- var property;
38
- var keys = Object.keys(category);
39
- for (var i = 0; i < keys.length; i += 1) {
32
+ let property;
33
+ const keys = Object.keys(category);
34
+ for (let i = 0; i < keys.length; i += 1) {
40
35
  property = keys[i];
41
- if (Object.prototype.hasOwnProperty.call(category, property) &&
42
- // @ts-expect-error rootCategory is in fact more than what Category type defines
36
+ if (Object.prototype.hasOwnProperty.call(category, property) && // @ts-expect-error rootCategory is in fact more than what Category type defines
43
37
  // apart from id, name and path it can have nested categories with any key
44
38
  // STOR-1904
45
- typeof category[property] === 'object') {
46
- // @ts-expect-error rootCategory is in fact more than what Category type defines
47
- // apart from id, name and path it can have nested categories with any key
48
- // STOR-1904
49
- results = _getAllPaths(category[property], results);
39
+ typeof category[property] === "object") {
40
+ results = getAllPaths(category[property], results);
50
41
  }
51
42
  }
52
- return results && results.length > 0 ? results : undefined;
43
+ return results && results.length > 0 ? results : void 0;
53
44
  };
54
- export { _getAllPaths as getAllPaths };
55
- export var filterPaths = function filterPaths(paths, searchQuery) {
56
- var pathsToBeFiltered = [].concat(paths);
57
- var filtered = pathsToBeFiltered.filter(function (p) {
58
- var productPath = p.path;
59
- var lastElementOfPath = productPath[productPath.length - 1];
45
+ const filterPaths = (paths, searchQuery) => {
46
+ const pathsToBeFiltered = [...paths];
47
+ const filtered = pathsToBeFiltered.filter((p) => {
48
+ const productPath = p.path;
49
+ const lastElementOfPath = productPath[productPath.length - 1];
60
50
  return productPath && lastElementOfPath && lastElementOfPath.toLowerCase().includes(searchQuery);
61
51
  });
62
52
  return filtered;
63
53
  };
64
- export var hasNestedCategories = function hasNestedCategories(category) {
65
- var property;
66
- var keys = Object.keys(category);
67
- for (var i = 0; i < keys.length; i += 1) {
54
+ const hasNestedCategories = (category) => {
55
+ let property;
56
+ const keys = Object.keys(category);
57
+ for (let i = 0; i < keys.length; i += 1) {
68
58
  property = keys[i];
69
- if (Object.prototype.hasOwnProperty.call(category, property) &&
70
- // @ts-expect-error rootCategory is in fact more than what Category type defines
59
+ if (Object.prototype.hasOwnProperty.call(category, property) && // @ts-expect-error rootCategory is in fact more than what Category type defines
71
60
  // apart from id, name and path it can have nested categories with any key
72
- typeof category[property] === 'object' &&
73
- // @ts-expect-error rootCategory is in fact more than what Category type defines
61
+ typeof category[property] === "object" && // @ts-expect-error rootCategory is in fact more than what Category type defines
74
62
  // apart from id, name and path it can have nested categories with any key
75
- Object.prototype.toString.call(category[property]) === '[object Object]') {
63
+ Object.prototype.toString.call(category[property]) === "[object Object]") {
76
64
  return true;
77
65
  }
78
66
  }
79
67
  return false;
80
- };
68
+ };
69
+ export {
70
+ filterPaths,
71
+ getAllPaths,
72
+ hasNestedCategories,
73
+ searchCategoryWithId
74
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-cascader",
3
- "version": "1.1.26",
3
+ "version": "1.1.27",
4
4
  "description": "Cascader UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -16,10 +16,10 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm run build:js && pnpm run build:css && pnpm run defs",
19
+ "build": "vite build",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
21
  "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
- "build:watch": "pnpm run build:js -- --watch",
22
+ "build:watch": "vite build --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
25
25
  "prepublish": "pnpm run build",
@@ -35,13 +35,13 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-divider": "^1.3.1",
39
- "@synerise/ds-icon": "^1.15.0",
40
- "@synerise/ds-list-item": "^1.4.9",
41
- "@synerise/ds-scrollbar": "^1.2.16",
42
- "@synerise/ds-search": "^1.5.9",
43
- "@synerise/ds-search-bar": "^1.4.19",
44
- "@synerise/ds-utils": "^1.7.0"
38
+ "@synerise/ds-divider": "^1.3.2",
39
+ "@synerise/ds-icon": "^1.15.1",
40
+ "@synerise/ds-list-item": "^1.4.10",
41
+ "@synerise/ds-scrollbar": "^1.2.17",
42
+ "@synerise/ds-search": "^1.5.10",
43
+ "@synerise/ds-search-bar": "^1.4.20",
44
+ "@synerise/ds-utils": "^1.7.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "vitest": "4"
@@ -51,5 +51,5 @@
51
51
  "react": ">=16.9.0 <= 18.3.1",
52
52
  "styled-components": "^5.3.3"
53
53
  },
54
- "gitHead": "8efc031fa688c0b87c7b3915bae93546bb63bcac"
54
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
55
55
  }