@digigov/ui 2.0.0-cbc56209 → 2.0.0-fec6f1f7

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 (79) hide show
  1. package/cjs/content/SafeHTML/index.js +5 -8
  2. package/cjs/form/AutoComplete/AutoComplete.stories/index.js +44 -8
  3. package/cjs/form/AutoComplete/AutoComplete.stories.playwright.json +33 -0
  4. package/cjs/form/AutoComplete/Status/index.js +12 -5
  5. package/cjs/form/AutoComplete/__stories__/Multiple/index.js +24 -0
  6. package/cjs/form/AutoComplete/__stories__/{WithInLine → MultipleShowingTwoSelected}/index.js +7 -6
  7. package/cjs/form/AutoComplete/__stories__/MultipleWithDefaultValues/index.js +23 -0
  8. package/cjs/form/AutoComplete/__stories__/MultipleWithMinLength/index.js +26 -0
  9. package/cjs/form/AutoComplete/__stories__/WithShowAllValues/index.js +0 -1
  10. package/cjs/form/AutoComplete/index.js +312 -202
  11. package/cjs/form/AutoComplete/index.mdx +0 -8
  12. package/cjs/form/AutoComplete/utils/index.js +2 -1
  13. package/cjs/govgr/Footer/index.mdx +0 -2
  14. package/cjs/i18n/locales/el/index.js +2 -2
  15. package/cjs/i18n/locales/en/index.js +2 -2
  16. package/cjs/lazy/index.js +26 -8
  17. package/cjs/navigation/Dropdown/Dropdown.stories/index.js +12 -0
  18. package/cjs/navigation/Dropdown/Dropdown.stories.playwright.json +16 -0
  19. package/cjs/navigation/Dropdown/__stories__/ScrollableContent/index.js +68 -0
  20. package/content/SafeHTML/index.d.ts +1 -1
  21. package/content/SafeHTML/index.js +5 -8
  22. package/form/AutoComplete/AutoComplete.stories/index.js +4 -1
  23. package/form/AutoComplete/AutoComplete.stories.d.ts +4 -1
  24. package/form/AutoComplete/AutoComplete.stories.playwright.json +33 -0
  25. package/form/AutoComplete/Status/index.d.ts +4 -2
  26. package/form/AutoComplete/Status/index.js +11 -4
  27. package/form/AutoComplete/__stories__/Multiple/index.js +17 -0
  28. package/form/AutoComplete/__stories__/{WithInLine → Multiple}/package.json +1 -1
  29. package/form/AutoComplete/__stories__/Multiple.d.ts +3 -0
  30. package/form/AutoComplete/__stories__/{WithInLine → MultipleShowingTwoSelected}/index.js +6 -5
  31. package/form/AutoComplete/__stories__/MultipleShowingTwoSelected/package.json +6 -0
  32. package/form/AutoComplete/__stories__/MultipleShowingTwoSelected.d.ts +3 -0
  33. package/form/AutoComplete/__stories__/MultipleWithDefaultValues/index.js +16 -0
  34. package/form/AutoComplete/__stories__/MultipleWithDefaultValues/package.json +6 -0
  35. package/form/AutoComplete/__stories__/MultipleWithDefaultValues.d.ts +3 -0
  36. package/form/AutoComplete/__stories__/MultipleWithMinLength/index.js +19 -0
  37. package/form/AutoComplete/__stories__/MultipleWithMinLength/package.json +6 -0
  38. package/form/AutoComplete/__stories__/MultipleWithMinLength.d.ts +3 -0
  39. package/form/AutoComplete/__stories__/WithShowAllValues/index.js +0 -1
  40. package/form/AutoComplete/index.d.ts +12 -18
  41. package/form/AutoComplete/index.js +295 -197
  42. package/form/AutoComplete/index.mdx +0 -8
  43. package/form/AutoComplete/utils/index.js +2 -1
  44. package/form/AutoComplete/utils.d.ts +1 -0
  45. package/govgr/Footer/index.mdx +0 -2
  46. package/i18n/locales/el/index.js +2 -2
  47. package/i18n/locales/en/index.js +2 -2
  48. package/index.js +1 -1
  49. package/lazy/index.js +22 -8
  50. package/lazy.d.ts +8 -6
  51. package/navigation/Dropdown/Dropdown.stories/index.js +1 -0
  52. package/navigation/Dropdown/Dropdown.stories.d.ts +1 -0
  53. package/navigation/Dropdown/Dropdown.stories.playwright.json +16 -0
  54. package/navigation/Dropdown/__stories__/ScrollableContent/index.js +61 -0
  55. package/navigation/Dropdown/__stories__/ScrollableContent/package.json +6 -0
  56. package/navigation/Dropdown/__stories__/ScrollableContent.d.ts +3 -0
  57. package/navigation/NavList/types.d.ts +1 -2
  58. package/package.json +4 -6
  59. package/src/content/SafeHTML/index.tsx +3 -4
  60. package/src/form/AutoComplete/AutoComplete.stories.js +4 -1
  61. package/src/form/AutoComplete/AutoComplete.stories.playwright.json +33 -0
  62. package/src/form/AutoComplete/Status/index.tsx +10 -6
  63. package/src/form/AutoComplete/__stories__/Multiple.tsx +18 -0
  64. package/src/form/AutoComplete/__stories__/{WithInLine.tsx → MultipleShowingTwoSelected.tsx} +3 -8
  65. package/src/form/AutoComplete/__stories__/MultipleWithDefaultValues.tsx +16 -0
  66. package/src/form/AutoComplete/__stories__/MultipleWithMinLength.tsx +29 -0
  67. package/src/form/AutoComplete/__stories__/WithShowAllValues.tsx +0 -1
  68. package/src/form/AutoComplete/index.mdx +0 -8
  69. package/src/form/AutoComplete/index.tsx +351 -213
  70. package/src/form/AutoComplete/utils.ts +3 -2
  71. package/src/govgr/Footer/index.mdx +0 -2
  72. package/src/i18n/locales/el.ts +2 -2
  73. package/src/i18n/locales/en.ts +2 -2
  74. package/src/lazy.js +4 -2
  75. package/src/navigation/Dropdown/Dropdown.stories.js +1 -0
  76. package/src/navigation/Dropdown/Dropdown.stories.playwright.json +16 -0
  77. package/src/navigation/Dropdown/__stories__/ScrollableContent.tsx +82 -0
  78. package/src/navigation/NavList/types.tsx +1 -2
  79. package/form/AutoComplete/__stories__/WithInLine.d.ts +0 -3
@@ -64,6 +64,22 @@
64
64
  "title": "Open dropdown action"
65
65
  }
66
66
  ]
67
+ },
68
+ "digigov-ui-navigation-dropdown--scrollable-content": {
69
+ "actionSets": [
70
+ {
71
+ "actions": [
72
+ {
73
+ "name": "click",
74
+ "args": {
75
+ "selector": "html>body>div:nth-child(5)>details>summary"
76
+ }
77
+ }
78
+ ],
79
+ "id": "rZUYM--IzpfW",
80
+ "title": "open content"
81
+ }
82
+ ]
67
83
  }
68
84
  }
69
85
  }
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import { Dropdown, DropdownButton, DropdownContent } from '@digigov/ui/navigation/Dropdown';
3
+ import { NavListItemAction, NavList } from '@digigov/ui/navigation/NavList';
4
+ var data = [{
5
+ name: 'Item 1',
6
+ href: '#'
7
+ }, {
8
+ name: 'Item 2',
9
+ href: '#'
10
+ }, {
11
+ name: 'Item 3',
12
+ href: '#'
13
+ }, {
14
+ name: 'Item 4',
15
+ href: '#'
16
+ }, {
17
+ name: 'Item 5',
18
+ href: '#'
19
+ }, {
20
+ name: 'Item 6',
21
+ href: '#'
22
+ }, {
23
+ name: 'Item 7',
24
+ href: '#'
25
+ }, {
26
+ name: 'Item 8',
27
+ href: '#'
28
+ }, {
29
+ name: 'Item 9',
30
+ href: '#'
31
+ }, {
32
+ name: 'Item 10',
33
+ href: '#'
34
+ }, {
35
+ name: 'Item 11',
36
+ href: '#'
37
+ }, {
38
+ name: 'Item 12',
39
+ href: '#'
40
+ }];
41
+ var _ref = /*#__PURE__*/React.createElement(DropdownButton, {
42
+ role: "button",
43
+ "aria-haspopup": "true",
44
+ "aria-controls": "menu2",
45
+ arrow: true
46
+ }, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2");
47
+ export var ScrollableContent = function ScrollableContent() {
48
+ return /*#__PURE__*/React.createElement(Dropdown, null, _ref, /*#__PURE__*/React.createElement(DropdownContent, {
49
+ role: "menu",
50
+ id: "menu2",
51
+ scrollable: true
52
+ }, /*#__PURE__*/React.createElement(NavList, {
53
+ layout: "vertical"
54
+ }, data.map(function (item) {
55
+ return /*#__PURE__*/React.createElement(NavListItemAction, {
56
+ role: "menuitem",
57
+ href: item.href
58
+ }, item.name);
59
+ }))));
60
+ };
61
+ export default ScrollableContent;
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "types": "./index.d.ts",
5
+ "main": "../../../../cjs/navigation/Dropdown/__stories__/ScrollableContent/index.js"
6
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const ScrollableContent: () => JSX.Element;
3
+ export default ScrollableContent;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { BaseCSSProperties } from '@material-ui/core/styles/withStyles';
3
2
  import { NavProps } from '@digigov/ui/navigation/NavList';
4
3
  export type NavListLayout = 'horizontal' | 'vertical';
5
4
  interface NavListItemMenuInterface {
@@ -25,7 +24,7 @@ export interface NavListAutoProps extends NavProps {
25
24
  floating?: boolean;
26
25
  subMenu?: boolean;
27
26
  links?: NavLinkInterface[];
28
- style?: BaseCSSProperties;
27
+ style?: React.CSSProperties;
29
28
  }
30
29
  export interface NavListHeaderItemType {
31
30
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/ui",
3
- "version": "2.0.0-cbc56209",
3
+ "version": "2.0.0-fec6f1f7",
4
4
  "description": "@digigov reusable components toolkit",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -8,18 +8,16 @@
8
8
  "@uides/react-qr-reader": "3.0.0",
9
9
  "yup": "0.32.11",
10
10
  "publint": "0.1.8",
11
- "@digigov/react-icons": "2.0.0-cbc56209",
11
+ "@digigov/react-icons": "2.0.0-fec6f1f7",
12
12
  "dompurify": "3.0.6"
13
13
  },
14
14
  "peerDependencies": {
15
15
  "react-query": "2.26.4",
16
- "@material-ui/core": "4.11.3",
17
- "@material-ui/icons": "4.11.2",
18
16
  "clsx": "1.1.1",
19
17
  "react": "^16.8.0 || ^17.0.0",
20
18
  "react-dom": "^16.8.0 || ^17.0.0",
21
- "@digigov/react-core": "2.0.0-cbc56209",
22
- "@digigov/css": "2.0.0-cbc56209"
19
+ "@digigov/react-core": "2.0.0-fec6f1f7",
20
+ "@digigov/css": "2.0.0-fec6f1f7"
23
21
  },
24
22
  "gitHead": "c903a46306f77f55ad7fc4d2e274006f39a6c871",
25
23
  "private": false,
@@ -26,7 +26,7 @@ const elementClassNameMapping = {
26
26
  };
27
27
 
28
28
  if (typeof window !== 'undefined') {
29
- DomPurify.addHook('afterSanitizeAttributes', function (node) {
29
+ DomPurify.addHook('afterSanitizeAttributes', function(node) {
30
30
  if (node.tagName.toLowerCase() in elementClassNameMapping) {
31
31
  node.setAttribute(
32
32
  'class',
@@ -73,7 +73,7 @@ export const SafeHTML = ({
73
73
  content,
74
74
  tags,
75
75
  Tag = 'span',
76
- style = {},
76
+ ...props
77
77
  }: SafeHTMLProps) => {
78
78
  if (tags) {
79
79
  tags.push(...defaultTags);
@@ -89,11 +89,10 @@ export const SafeHTML = ({
89
89
  return (
90
90
  <Tag
91
91
  // @ts-ignore
92
- style={{ whiteSpace: 'break-spaces', ...style }}
93
- className="ds-body"
94
92
  dangerouslySetInnerHTML={{
95
93
  __html: parsedHTML,
96
94
  }}
95
+ {...props}
97
96
  />
98
97
  );
99
98
  };
@@ -5,8 +5,11 @@ export default {
5
5
  displayName: 'AutoComplete',
6
6
  };
7
7
  export * from '@digigov/ui/form/AutoComplete/__stories__/Default';
8
+ export * from '@digigov/ui/form/AutoComplete/__stories__/Multiple';
9
+ export * from '@digigov/ui/form/AutoComplete/__stories__/MultipleWithDefaultValues';
10
+ export * from '@digigov/ui/form/AutoComplete/__stories__/MultipleShowingTwoSelected';
11
+ export * from '@digigov/ui/form/AutoComplete/__stories__/MultipleWithMinLength';
8
12
  export * from '@digigov/ui/form/AutoComplete/__stories__/WithAutoSelect';
9
- export * from '@digigov/ui/form/AutoComplete/__stories__/WithInLine';
10
13
  export * from '@digigov/ui/form/AutoComplete/__stories__/WithDefaultValue';
11
14
  export * from '@digigov/ui/form/AutoComplete/__stories__/WithPlaceHolder';
12
15
  export * from '@digigov/ui/form/AutoComplete/__stories__/WithShowAllValues';
@@ -0,0 +1,33 @@
1
+ {
2
+ "version": "4",
3
+ "stories": {
4
+ "digigov-ui-form-autocomplete--multiple": {
5
+ "actionSets": [
6
+ {
7
+ "actions": [
8
+ {
9
+ "name": "click",
10
+ "args": {
11
+ "selector": "html>body>div:nth-child(5)>div>div>fieldset>div>div:nth-child(2)>button"
12
+ }
13
+ },
14
+ {
15
+ "name": "click",
16
+ "args": {
17
+ "selector": "html>body>div:nth-child(5)>div>div>fieldset>div>div:nth-child(2)>ul:nth-child(4)>div>li:nth-child(3)"
18
+ }
19
+ },
20
+ {
21
+ "name": "click",
22
+ "args": {
23
+ "selector": "html>body>div:nth-child(5)>div>div>fieldset>div>div:nth-child(2)>button"
24
+ }
25
+ }
26
+ ],
27
+ "id": "SP0dXbHKOZl7",
28
+ "title": "show chip"
29
+ }
30
+ ]
31
+ }
32
+ }
33
+ }
@@ -1,6 +1,6 @@
1
1
  import React, { Component } from 'react';
2
2
  import AutoCompleteStatus from '@digigov/react-core/AutoCompleteStatus';
3
- import AutoCompleteStatusWrapper from '@digigov/react-core/AutoCompleteStatusWrapper';
3
+ import AutoCompleteStatusContainer from '@digigov/react-core/AutoCompleteStatusContainer';
4
4
 
5
5
  const debounce = function (
6
6
  func: () => void,
@@ -21,6 +21,7 @@ const debounce = function (
21
21
  clearTimeout(timeout);
22
22
  timeout = setTimeout(later, wait);
23
23
  if (callNow) func.apply(context, args);
24
+ return timeout;
24
25
  };
25
26
  };
26
27
  const statusDebounceMillis = 1400;
@@ -72,7 +73,10 @@ export default class Status extends Component<StatusProps, StateProps> {
72
73
  silenced: false,
73
74
  };
74
75
  debounceStatusUpdate: () => void;
75
-
76
+ lastDebounceCall: any;
77
+ componentWillUnmount(): void {
78
+ clearTimeout(this.lastDebounceCall);
79
+ }
76
80
  UNSAFE_componentWillMount() {
77
81
  // eslint-disable-next-line @typescript-eslint/no-this-alias
78
82
  const that = this;
@@ -124,19 +128,19 @@ export default class Status extends Component<StatusProps, StateProps> {
124
128
  content = tResults?.(length, contentSelectedOption);
125
129
  }
126
130
 
127
- this.debounceStatusUpdate();
131
+ this.lastDebounceCall = this.debounceStatusUpdate();
128
132
 
129
133
  return (
130
- <AutoCompleteStatusWrapper>
134
+ <AutoCompleteStatusContainer>
131
135
  <AutoCompleteStatus id={id + '__status--A'}>
132
136
  {!silenced && debounced && bump ? content : ' '}
133
137
  </AutoCompleteStatus>
134
138
  <AutoCompleteStatus id={id + '__status--B'}>
135
139
  {!silenced && debounced && !bump ? content : ' '}
136
140
  </AutoCompleteStatus>
137
- </AutoCompleteStatusWrapper>
141
+ </AutoCompleteStatusContainer>
138
142
  );
139
143
  }
140
144
  }
141
145
 
142
- export { AutoCompleteStatusWrapper, AutoCompleteStatus };
146
+ export { AutoCompleteStatusContainer, AutoCompleteStatus };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { AutoComplete } from '@digigov/ui/form/AutoComplete';
3
+ import { suggest } from '@digigov/ui/form/AutoComplete/utils';
4
+ import { Button } from '@digigov/ui/form/Button';
5
+ import { FieldContainer, Fieldset } from '@digigov/ui/form/FieldContainer';
6
+
7
+ export const Multiple = () => (
8
+ <div>
9
+ <FieldContainer>
10
+ <Fieldset marginBottom={4}>
11
+ <AutoComplete source={suggest} multiple width="50%" id="multiple-select-default" />
12
+ </Fieldset>
13
+ </FieldContainer>
14
+ <Button>Υποβολή</Button>
15
+ </div>
16
+ );
17
+
18
+ export default Multiple;
@@ -4,18 +4,13 @@ import { suggest } from '@digigov/ui/form/AutoComplete/utils';
4
4
  import { Button } from '@digigov/ui/form/Button';
5
5
  import { FieldContainer } from '@digigov/ui/form/FieldContainer';
6
6
 
7
- export const WithInLine = () => (
7
+ export const MultipleShowingTwoSelected = () => (
8
8
  <div>
9
9
  <FieldContainer>
10
- <AutoComplete
11
- source={suggest}
12
- autoselect={true}
13
- displayMenu="inline"
14
- id="govgr"
15
- />
10
+ <AutoComplete source={suggest} multiple width='75%' id="multiple-showing-two-selected" numberOfSelected={2} />
16
11
  </FieldContainer>
17
12
  <Button>Υποβολή</Button>
18
13
  </div>
19
14
  );
20
15
 
21
- export default WithInLine;
16
+ export default MultipleShowingTwoSelected;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { AutoComplete } from '@digigov/ui/form/AutoComplete';
3
+ import { suggest } from '@digigov/ui/form/AutoComplete/utils';
4
+ import { Button } from '@digigov/ui/form/Button';
5
+ import { FieldContainer } from '@digigov/ui/form/FieldContainer';
6
+
7
+ export const MultipleWithDefaultValues = () => (
8
+ <div>
9
+ <FieldContainer>
10
+ <AutoComplete source={suggest} multiple defaultValue={['Ελλάδα', 'Ιταλία']} width="50%" id="govgr" />
11
+ </FieldContainer>
12
+ <Button>Υποβολή</Button>
13
+ </div>
14
+ );
15
+
16
+ export default MultipleWithDefaultValues;
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { AutoComplete } from '@digigov/ui/form/AutoComplete';
3
+ import { suggest } from '@digigov/ui/form/AutoComplete/utils';
4
+ import { Button } from '@digigov/ui/form/Button';
5
+ import { FieldContainer, Fieldset } from '@digigov/ui/form/FieldContainer';
6
+ import Paragraph from '@digigov/ui/typography/Paragraph';
7
+
8
+ export const MultipleWithMinLength = () => (
9
+ <div>
10
+ <Paragraph>
11
+ Εδώ, ο ελάχιστος αριθμός χαρακτήρων που πρέπει να
12
+ εισαχθεί ώστε να αρχίσει να φιλτράρεται η αναζήτηση είναι 2.
13
+ </Paragraph>
14
+ <FieldContainer>
15
+ <Fieldset marginBottom={4}>
16
+ <AutoComplete
17
+ source={suggest}
18
+ multiple
19
+ minLength={2}
20
+ width="50%"
21
+ id="multiple-select-default"
22
+ />
23
+ </Fieldset>
24
+ </FieldContainer>
25
+ <Button>Υποβολή</Button>
26
+ </div>
27
+ );
28
+
29
+ export default MultipleWithMinLength;
@@ -10,7 +10,6 @@ export const WithShowAllValues = () => (
10
10
  <AutoComplete
11
11
  source={suggest}
12
12
  autoselect={true}
13
- showAllValues
14
13
  id="govgr"
15
14
  />
16
15
  </FieldContainer>
@@ -20,14 +20,6 @@ through, select from large collections of options and help services get more con
20
20
  story="WithAutoSelect.tsx"
21
21
  />
22
22
 
23
- ### AutoComplete with inline style
24
-
25
- <Story
26
- packageName="@digigov/ui"
27
- component="form/AutoComplete"
28
- story="WithInLine.tsx"
29
- />
30
-
31
23
  ### AutoComplete with default value
32
24
 
33
25
  <Story