@digigov/react-core 2.0.0-rc.6 → 2.0.0-rc.8

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 (61) hide show
  1. package/AdminAside/__snapshots__/index.test.tsx.snap +7 -3
  2. package/AdminAside/index.js +6 -2
  3. package/AdminContainer/__snapshots__/index.test.tsx.snap +35 -7
  4. package/AdminContainer/index.d.ts +8 -1
  5. package/AdminContainer/index.js +6 -7
  6. package/AdminContainer/index.test/index.js +6 -0
  7. package/AdminMain/__snapshots__/index.test.tsx.snap +6 -3
  8. package/AdminMain/index.js +7 -2
  9. package/AutoCompleteInput/__snapshots__/index.test.tsx.snap +14 -50
  10. package/AutoCompleteResultList/__snapshots__/index.test.tsx.snap +2 -38
  11. package/DropdownContent/index.d.ts +9 -1
  12. package/DropdownContent/index.js +6 -5
  13. package/ModalContainer/index.d.ts +8 -1
  14. package/ModalContainer/index.js +8 -6
  15. package/ModalHeading/index.js +1 -2
  16. package/Skeleton/index.d.ts +48 -0
  17. package/Skeleton/index.js +35 -0
  18. package/Skeleton/package.json +6 -0
  19. package/SummaryList/index.d.ts +10 -1
  20. package/SummaryList/index.js +4 -2
  21. package/Unpurge/index.js +1 -1
  22. package/cjs/AdminAside/__snapshots__/index.test.tsx.snap +7 -3
  23. package/cjs/AdminAside/index.js +6 -2
  24. package/cjs/AdminContainer/__snapshots__/index.test.tsx.snap +35 -7
  25. package/cjs/AdminContainer/index.js +6 -7
  26. package/cjs/AdminContainer/index.test/index.js +6 -0
  27. package/cjs/AdminMain/__snapshots__/index.test.tsx.snap +6 -3
  28. package/cjs/AdminMain/index.js +7 -2
  29. package/cjs/AutoCompleteInput/__snapshots__/index.test.tsx.snap +14 -50
  30. package/cjs/AutoCompleteResultList/__snapshots__/index.test.tsx.snap +2 -38
  31. package/cjs/DropdownContent/index.js +6 -5
  32. package/cjs/ModalContainer/index.js +8 -6
  33. package/cjs/ModalHeading/index.js +1 -2
  34. package/cjs/Skeleton/index.js +42 -0
  35. package/cjs/SummaryList/index.js +4 -2
  36. package/cjs/Unpurge/index.js +1 -1
  37. package/cjs/lazy/index.js +39 -12
  38. package/cjs/registry/index.js +2 -0
  39. package/index.js +1 -1
  40. package/lazy/index.js +31 -10
  41. package/lazy.d.ts +9 -6
  42. package/package.json +3 -3
  43. package/registry/index.js +2 -0
  44. package/registry.d.ts +1 -0
  45. package/src/AdminAside/__snapshots__/index.test.tsx.snap +7 -3
  46. package/src/AdminAside/index.tsx +6 -2
  47. package/src/AdminContainer/__snapshots__/index.test.tsx.snap +35 -7
  48. package/src/AdminContainer/index.test.tsx +3 -0
  49. package/src/AdminContainer/index.tsx +12 -11
  50. package/src/AdminMain/__snapshots__/index.test.tsx.snap +6 -3
  51. package/src/AdminMain/index.tsx +5 -2
  52. package/src/AutoCompleteInput/__snapshots__/index.test.tsx.snap +14 -50
  53. package/src/AutoCompleteResultList/__snapshots__/index.test.tsx.snap +2 -38
  54. package/src/DropdownContent/index.tsx +10 -1
  55. package/src/ModalContainer/index.tsx +18 -14
  56. package/src/ModalHeading/index.tsx +2 -2
  57. package/src/Skeleton/index.tsx +99 -0
  58. package/src/SummaryList/index.tsx +12 -1
  59. package/src/Unpurge/index.tsx +9 -0
  60. package/src/lazy.js +5 -2
  61. package/src/registry.js +2 -0
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@digigov/react-core",
3
- "version": "2.0.0-rc.6",
3
+ "version": "2.0.0-rc.8",
4
4
  "description": "@digigov react core components",
5
5
  "author": "GRNET Developers <devs@lists.grnet.gr>",
6
6
  "license": "BSD-2-Clause",
7
7
  "main": "./cjs/index.js",
8
8
  "module": "./index.js",
9
9
  "peerDependencies": {
10
- "@digigov/css": "2.0.0-rc.6",
11
- "@digigov/react-icons": "2.0.0-rc.6",
10
+ "@digigov/css": "2.0.0-rc.8",
11
+ "@digigov/react-icons": "2.0.0-rc.8",
12
12
  "clsx": "1.1.1",
13
13
  "react": "^16.8.0 || ^17.0.0",
14
14
  "react-dom": "^16.8.0 || ^17.0.0"
package/registry/index.js CHANGED
@@ -191,6 +191,7 @@ import * as _digigov_react_core_SelectContainer from '@digigov/react-core/Select
191
191
  import * as _digigov_react_core_SelectOption from '@digigov/react-core/SelectOption';
192
192
  import * as _digigov_react_core_SingleCharacterInput from '@digigov/react-core/SingleCharacterInput';
193
193
  import * as _digigov_react_core_SingleCharacterInputs from '@digigov/react-core/SingleCharacterInputs';
194
+ import * as _digigov_react_core_Skeleton from '@digigov/react-core/Skeleton';
194
195
  import * as _digigov_react_core_SkipLink from '@digigov/react-core/SkipLink';
195
196
  import * as _digigov_react_core_Stack from '@digigov/react-core/Stack';
196
197
  import * as _digigov_react_core_StepNav from '@digigov/react-core/StepNav';
@@ -451,6 +452,7 @@ export default {
451
452
  '@digigov/react-core/SelectOption': lazyImport(_digigov_react_core_SelectOption),
452
453
  '@digigov/react-core/SingleCharacterInput': lazyImport(_digigov_react_core_SingleCharacterInput),
453
454
  '@digigov/react-core/SingleCharacterInputs': lazyImport(_digigov_react_core_SingleCharacterInputs),
455
+ '@digigov/react-core/Skeleton': lazyImport(_digigov_react_core_Skeleton),
454
456
  '@digigov/react-core/SkipLink': lazyImport(_digigov_react_core_SkipLink),
455
457
  '@digigov/react-core/Stack': lazyImport(_digigov_react_core_Stack),
456
458
  '@digigov/react-core/StepNav': lazyImport(_digigov_react_core_StepNav),
package/registry.d.ts CHANGED
@@ -192,6 +192,7 @@ declare const _default: {
192
192
  '@digigov/react-core/SelectOption': {};
193
193
  '@digigov/react-core/SingleCharacterInput': {};
194
194
  '@digigov/react-core/SingleCharacterInputs': {};
195
+ '@digigov/react-core/Skeleton': {};
195
196
  '@digigov/react-core/SkipLink': {};
196
197
  '@digigov/react-core/Stack': {};
197
198
  '@digigov/react-core/StepNav': {};
@@ -4,15 +4,19 @@ exports[`renders the AdminAside with no prop 1`] = `
4
4
  <ForwardRef(AdminAside)>
5
5
  <ForwardRef(Grid)
6
6
  as="aside"
7
- className="ds-admin-side-content"
7
+ className="ds-admin-aside"
8
8
  item={true}
9
+ lg={3}
10
+ md={4}
11
+ spacing={4}
12
+ xs={12}
9
13
  >
10
14
  <ForwardRef(Base)
11
15
  as="aside"
12
- className="ds-admin-side-content"
16
+ className="ds-admin-aside xs:ds-grid__col-span-12 md:ds-grid__col-span-4 lg:ds-grid__col-span-3"
13
17
  >
14
18
  <aside
15
- className="ds-admin-side-content"
19
+ className="ds-admin-aside xs:ds-grid__col-span-12 md:ds-grid__col-span-4 lg:ds-grid__col-span-3"
16
20
  >
17
21
  hello
18
22
  </aside>
@@ -12,10 +12,14 @@ export const AdminAside = React.forwardRef<HTMLElement, AdminAsideProps>(
12
12
  return (
13
13
  <Grid
14
14
  as="aside"
15
- ref={ref}
16
15
  item
16
+ xs={12}
17
+ md={4}
18
+ lg={3}
19
+ spacing={4}
20
+ ref={ref}
17
21
  className={clsx(className, {
18
- 'ds-admin-side-content': true,
22
+ 'ds-admin-aside': true,
19
23
  })}
20
24
  {...props}
21
25
  >
@@ -1,7 +1,9 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`renders the AdminContainer with no props 1`] = `
4
- <ForwardRef(AdminContainer)>
3
+ exports[`renders the AdminContainer with no grid 1`] = `
4
+ <ForwardRef(AdminContainer)
5
+ grid={false}
6
+ >
5
7
  <ForwardRef(Container)
6
8
  fullWidth={true}
7
9
  grid={false}
@@ -17,11 +19,37 @@ exports[`renders the AdminContainer with no props 1`] = `
17
19
  <div
18
20
  className="ds-container--full-width ds-container"
19
21
  >
20
- <div
21
- className="ds-admin-main-wrapper"
22
- >
23
- hello
24
- </div>
22
+ hello
23
+ </div>
24
+ </ForwardRef(Base)>
25
+ </ForwardRef(Grid)>
26
+ </ForwardRef(Container)>
27
+ </ForwardRef(AdminContainer)>
28
+ `;
29
+
30
+ exports[`renders the AdminContainer with no props 1`] = `
31
+ <ForwardRef(AdminContainer)>
32
+ <ForwardRef(Container)
33
+ fullWidth={true}
34
+ grid={true}
35
+ >
36
+ <ForwardRef(Grid)
37
+ className="ds-container--full-width ds-container"
38
+ container={true}
39
+ spacing={
40
+ Object {
41
+ "sm": 12,
42
+ }
43
+ }
44
+ >
45
+ <ForwardRef(Base)
46
+ as="div"
47
+ className="ds-container--full-width ds-container ds-gap-sm-12 ds-grid"
48
+ >
49
+ <div
50
+ className="ds-container--full-width ds-container ds-gap-sm-12 ds-grid"
51
+ >
52
+ hello
25
53
  </div>
26
54
  </ForwardRef(Base)>
27
55
  </ForwardRef(Grid)>
@@ -6,3 +6,6 @@ import AdminContainer from '@digigov/react-core/AdminContainer';
6
6
  it('renders the AdminContainer with no props', () => {
7
7
  expect(mount(<AdminContainer>hello</AdminContainer>)).toMatchSnapshot();
8
8
  });
9
+ it('renders the AdminContainer with no grid', () => {
10
+ expect(mount(<AdminContainer grid={false}>hello</AdminContainer>)).toMatchSnapshot();
11
+ });
@@ -1,8 +1,15 @@
1
1
  import React from 'react';
2
- import clsx from 'clsx';
3
2
  import Container, { ContainerProps } from '@digigov/react-core/Container';
4
3
 
5
- export interface AdminContainerProps extends Omit<ContainerProps, 'grid'> { }
4
+ export interface AdminContainerProps extends Omit<ContainerProps, 'grid'> {
5
+ /**
6
+ * grid is optional. Set to false if you don't need grid layout.
7
+ * @value true
8
+ * @value false
9
+ * @default true
10
+ */
11
+ grid?: boolean;
12
+ }
6
13
  /**
7
14
  * AdminContainer is a wrapper for the content of the page
8
15
  * Use AdminContainer inside AdminLayout component
@@ -10,22 +17,16 @@ export interface AdminContainerProps extends Omit<ContainerProps, 'grid'> { }
10
17
  export const AdminContainer = React.forwardRef<
11
18
  HTMLDivElement,
12
19
  AdminContainerProps
13
- >(function AdminContainer({ className, children, ...props }, ref) {
20
+ >(function AdminContainer({ grid = true, className, children, ...props }, ref) {
14
21
  return (
15
22
  <Container
16
23
  ref={ref}
17
24
  fullWidth={true}
18
- grid={false}
25
+ grid={grid}
19
26
  className={className}
20
27
  {...props}
21
28
  >
22
- <div
23
- className={clsx({
24
- 'ds-admin-main-wrapper': true,
25
- })}
26
- >
27
- {children}
28
- </div>
29
+ {children}
29
30
  </Container>
30
31
  );
31
32
  });
@@ -4,15 +4,18 @@ exports[`renders the AdminMain with no prop 1`] = `
4
4
  <ForwardRef(AdminMain)>
5
5
  <ForwardRef(Grid)
6
6
  as="main"
7
- className="ds-admin-main-content"
7
+ className="ds-admin-main"
8
8
  item={true}
9
+ lg={9}
10
+ md={8}
11
+ xs={12}
9
12
  >
10
13
  <ForwardRef(Base)
11
14
  as="main"
12
- className="ds-admin-main-content"
15
+ className="ds-admin-main xs:ds-grid__col-span-12 md:ds-grid__col-span-8 lg:ds-grid__col-span-9"
13
16
  >
14
17
  <main
15
- className="ds-admin-main-content"
18
+ className="ds-admin-main xs:ds-grid__col-span-12 md:ds-grid__col-span-8 lg:ds-grid__col-span-9"
16
19
  >
17
20
  hello
18
21
  </main>
@@ -7,14 +7,17 @@ export interface AdminMainProps extends GridProps { }
7
7
  * Use this inside AdminContainer component for placing the main content of the page
8
8
  */
9
9
  export const AdminMain = React.forwardRef<HTMLDivElement, AdminMainProps>(
10
- function AdminMain({ className, children, ...props }, ref) {
10
+ function AdminMain({ className, children, id = 'main-content', ...props }, ref) {
11
11
  return (
12
12
  <Grid
13
13
  item
14
14
  as="main"
15
+ xs={12}
16
+ md={8}
17
+ lg={9}
15
18
  ref={ref}
16
19
  className={clsx(className, {
17
- 'ds-admin-main-content': true,
20
+ 'ds-admin-main': true,
18
21
  })}
19
22
  {...props}
20
23
  >
@@ -1,87 +1,51 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`renders the AutoCompleteInput with no props 1`] = `
4
- <ForwardRef(AutoCompleteInput)>
5
- <ForwardRef(Base)
6
- as="input"
7
- className="ds-autocomplete__input--default ds-autocomplete__input"
8
- type="text"
9
- >
10
- <input
11
- className="ds-autocomplete__input--default ds-autocomplete__input"
12
- type="text"
13
- />
14
- </ForwardRef(Base)>
15
- </ForwardRef(AutoCompleteInput)>
16
- `;
17
-
18
- exports[`renders the AutoCompleteInput with showAllValues 1`] = `
19
- <ForwardRef(AutoCompleteInput)
20
- showAllValues={true}
21
- >
22
- <ForwardRef(Base)
23
- as="input"
24
- className="ds-autocomplete__input--show-all-values ds-autocomplete__input"
25
- type="text"
26
- >
27
- <input
28
- className="ds-autocomplete__input--show-all-values ds-autocomplete__input"
29
- type="text"
30
- />
31
- </ForwardRef(Base)>
32
- </ForwardRef(AutoCompleteInput)>
33
- `;
34
-
35
- exports[`renders the AutoCompleteInput with showAllValues 2`] = `
3
+ exports[`renders the AutoCompleteInput with isFocused 1`] = `
36
4
  <ForwardRef(AutoCompleteInput)
37
- showAllValues={true}
5
+ isFocused={true}
38
6
  >
39
7
  <ForwardRef(Base)
40
8
  as="input"
41
- className="ds-autocomplete__input--show-all-values ds-autocomplete__input"
9
+ className="ds-autocomplete__input--focused ds-autocomplete__input"
42
10
  type="text"
43
11
  >
44
12
  <input
45
- className="ds-autocomplete__input--show-all-values ds-autocomplete__input"
13
+ className="ds-autocomplete__input--focused ds-autocomplete__input"
46
14
  type="text"
47
15
  />
48
16
  </ForwardRef(Base)>
49
17
  </ForwardRef(AutoCompleteInput)>
50
18
  `;
51
19
 
52
- exports[`renders the AutoCompleteInput with showAllValues isFocused 1`] = `
20
+ exports[`renders the AutoCompleteInput with isFocused and name props 1`] = `
53
21
  <ForwardRef(AutoCompleteInput)
54
22
  isFocused={true}
55
- showAllValues={true}
23
+ name="some-name"
56
24
  >
57
25
  <ForwardRef(Base)
58
26
  as="input"
59
- className="ds-autocomplete__input--show-all-values ds-autocomplete__input--focused ds-autocomplete__input"
27
+ className="ds-autocomplete__input--focused ds-autocomplete__input"
28
+ name="some-name"
60
29
  type="text"
61
30
  >
62
31
  <input
63
- className="ds-autocomplete__input--show-all-values ds-autocomplete__input--focused ds-autocomplete__input"
32
+ className="ds-autocomplete__input--focused ds-autocomplete__input"
33
+ name="some-name"
64
34
  type="text"
65
35
  />
66
36
  </ForwardRef(Base)>
67
37
  </ForwardRef(AutoCompleteInput)>
68
38
  `;
69
39
 
70
- exports[`renders the AutoCompleteInput with showAllValues isFocused name props 1`] = `
71
- <ForwardRef(AutoCompleteInput)
72
- isFocused={true}
73
- name="some-name"
74
- showAllValues={true}
75
- >
40
+ exports[`renders the AutoCompleteInput with no props 1`] = `
41
+ <ForwardRef(AutoCompleteInput)>
76
42
  <ForwardRef(Base)
77
43
  as="input"
78
- className="ds-autocomplete__input--show-all-values ds-autocomplete__input--focused ds-autocomplete__input"
79
- name="some-name"
44
+ className="ds-autocomplete__input"
80
45
  type="text"
81
46
  >
82
47
  <input
83
- className="ds-autocomplete__input--show-all-values ds-autocomplete__input--focused ds-autocomplete__input"
84
- name="some-name"
48
+ className="ds-autocomplete__input"
85
49
  type="text"
86
50
  />
87
51
  </ForwardRef(Base)>
@@ -1,51 +1,15 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`renders the AutoCompleteResultList with isVisible displayMenu="inline props 1`] = `
4
- <ForwardRef(List)
5
- displayMenu="inline"
6
- isVisible={true}
7
- >
8
- <ForwardRef(Base)
9
- as="ul"
10
- className="ds-autocomplete__menu--inline ds-autocomplete__menu--visible ds-autocomplete__menu"
11
- >
12
- <ul
13
- className="ds-autocomplete__menu--inline ds-autocomplete__menu--visible ds-autocomplete__menu"
14
- >
15
- Hello
16
- </ul>
17
- </ForwardRef(Base)>
18
- </ForwardRef(List)>
19
- `;
20
-
21
- exports[`renders the AutoCompleteResultList with isVisible displayMenu="overlay props 1`] = `
22
- <ForwardRef(List)
23
- displayMenu="overlay"
24
- isVisible={true}
25
- >
26
- <ForwardRef(Base)
27
- as="ul"
28
- className="ds-autocomplete__menu--overlay ds-autocomplete__menu--visible ds-autocomplete__menu"
29
- >
30
- <ul
31
- className="ds-autocomplete__menu--overlay ds-autocomplete__menu--visible ds-autocomplete__menu"
32
- >
33
- Hello
34
- </ul>
35
- </ForwardRef(Base)>
36
- </ForwardRef(List)>
37
- `;
38
-
39
3
  exports[`renders the AutoCompleteResultList with isVisible props 1`] = `
40
4
  <ForwardRef(List)
41
5
  isVisible={true}
42
6
  >
43
7
  <ForwardRef(Base)
44
8
  as="ul"
45
- className="ds-autocomplete__menu--visible ds-autocomplete__menu"
9
+ className="ds-autocomplete__menu"
46
10
  >
47
11
  <ul
48
- className="ds-autocomplete__menu--visible ds-autocomplete__menu"
12
+ className="ds-autocomplete__menu"
49
13
  >
50
14
  Hello
51
15
  </ul>
@@ -11,6 +11,14 @@ export interface DropdownContentProps extends BaseProps<'div'> {
11
11
  * @default true
12
12
  */
13
13
  fullWidth?: boolean;
14
+ /**
15
+ * scrollable prop is optional.
16
+ * If true, the dropdown content will have limited scrollable height.
17
+ * @value true
18
+ * @value false
19
+ * @default false
20
+ */
21
+ scrollable?: boolean;
14
22
  }
15
23
  /**
16
24
  * You should use DropdownContent component inside Dropdown component.
@@ -19,7 +27,7 @@ export const DropdownContent = React.forwardRef<
19
27
  HTMLDivElement,
20
28
  DropdownContentProps
21
29
  >(function DropdownContent(
22
- { className, children, fullWidth = true, ...props },
30
+ {fullWidth = true, scrollable, className, children, ...props },
23
31
  ref
24
32
  ) {
25
33
  return (
@@ -29,6 +37,7 @@ export const DropdownContent = React.forwardRef<
29
37
  className={clsx(className, {
30
38
  'ds-dropdown__content': true,
31
39
  'ds-dropdown__content--full-width': fullWidth,
40
+ 'ds-dropdown__content--scrollable': scrollable,
32
41
  })}
33
42
  {...props}
34
43
  >
@@ -15,6 +15,13 @@ export interface ModalContainerProps extends BaseProps<'div'> {
15
15
  * @default false
16
16
  */
17
17
  dense?: boolean;
18
+ /**
19
+ * gaps is optional.
20
+ * @value false there will be no extra gaps among children components.
21
+ * @value true
22
+ * @default true
23
+ */
24
+ gaps?: boolean;
18
25
  }
19
26
  /**
20
27
  * Modals can be used to open a pop-up dialog box and provide critical information
@@ -25,9 +32,10 @@ export interface ModalContainerProps extends BaseProps<'div'> {
25
32
  export const ModalContainer = React.forwardRef<
26
33
  HTMLDivElement,
27
34
  ModalContainerProps
28
- >(function ModalContainer({ className, children, open, dense, ...props }, ref) {
35
+ >(function ModalContainer({ className, gaps = true, children, open, dense, ...props }, ref) {
29
36
  return (
30
37
  <Base
38
+ ref={ref}
31
39
  as="div"
32
40
  className={clsx(className, {
33
41
  'ds-modal': true,
@@ -36,19 +44,15 @@ export const ModalContainer = React.forwardRef<
36
44
  })}
37
45
  {...props}
38
46
  >
39
- <div
40
- className={clsx({
41
- 'ds-modal__body': true,
42
- })}
43
- >
44
- <div
45
- ref={ref}
46
- className={clsx({
47
- 'ds-modal__container': true,
48
- })}
49
- >
50
- {children}
51
- </div>
47
+ <div className='ds-modal__body'>
48
+ {gaps ?
49
+ <div
50
+ className='ds-modal__container'
51
+ >
52
+ {children}
53
+ </div>
54
+ :
55
+ children}
52
56
  </div>
53
57
  </Base>
54
58
  );
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import Heading, { HeadingProps } from '@digigov/react-core/Heading';
3
3
 
4
- export interface ModalHeadingProps extends HeadingProps {}
4
+ export interface ModalHeadingProps extends HeadingProps { }
5
5
  /**
6
6
  * ModalHeading gives header title to Modal Component
7
7
  * Use ModalHeading inside Modal component as children
@@ -10,7 +10,7 @@ export interface ModalHeadingProps extends HeadingProps {}
10
10
  export const ModalHeading = React.forwardRef<HTMLDivElement, ModalHeadingProps>(
11
11
  function ModalHeading({ children, ...props }, ref) {
12
12
  return (
13
- <Heading ref={ref} size="md" element="h2" marginBottom={0} {...props}>
13
+ <Heading ref={ref} size="md" element="h2" {...props}>
14
14
  {children}
15
15
  </Heading>
16
16
  );
@@ -0,0 +1,99 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ import Base, { BaseProps } from '@digigov/react-core/Base';
4
+
5
+ export interface SkeletonProps extends BaseProps<'span'> {
6
+ /**
7
+ * variant prop determines the style of the skeleton element.
8
+ * @value 'circular', it renders a circular skeleton.
9
+ * @value 'rectangular', it renders a rectangular skeleton.
10
+ * @value 'text', it renders a text skeleton.
11
+ * @value 'button', it renders a button skeleton.
12
+ * @default 'text'
13
+ */
14
+ variant?: 'circular' | 'rectangular' | 'text' | 'button';
15
+
16
+ /**
17
+ * width prop determines the width of the skeleton element.
18
+ * It accepts number in px or string with valid CSS units (e.g. '24px', '1em', '100%').
19
+ * @default undefined
20
+ */
21
+ width?: number | string;
22
+
23
+ /**
24
+ * height prop determines the height of the skeleton element.
25
+ * It accepts number in px or string with valid CSS units (e.g. '24px', '1em', '100%').
26
+ * @default undefined
27
+ */
28
+ height?: number | string;
29
+
30
+ /**
31
+ * fontSize is optional. 'sm' is the default value.
32
+ * Use 'xl' when this Skeleton is for a main page title.
33
+ * The fontSize works only for variant 'text'.
34
+ * You don't need fontSize if you wrap Skeleton in a typography component.
35
+ * @value 'xl'
36
+ * @value 'lg'
37
+ * @value 'md'
38
+ * @value 'sm'
39
+ * @value 'xs'
40
+ * @default 'sm'
41
+ */
42
+ fontSize?: 'xl' | 'lg' | 'md' | 'sm' | 'xs';
43
+ /**
44
+ * animation prop determines if the skeleton should animate or not.
45
+ * @default true
46
+ */
47
+ animation?: boolean;
48
+ }
49
+ /**
50
+ * Use Skeleton component while a page is loading.
51
+ */
52
+ export const Skeleton = React.forwardRef<HTMLSpanElement, SkeletonProps>(
53
+ function Skeleton(
54
+ {
55
+ width,
56
+ height,
57
+ fontSize,
58
+ variant = 'text',
59
+ animation = true,
60
+ className,
61
+ children,
62
+ ...props
63
+ },
64
+ ref
65
+ ) {
66
+ return (
67
+ <Base
68
+ as="span"
69
+ ref={ref}
70
+ className={clsx(className, {
71
+ 'ds-skeleton': true,
72
+ [`ds-skeleton--font-${fontSize}`]: fontSize !== undefined && variant==='text',
73
+ [`ds-skeleton--${variant}`]: !!variant && !children,
74
+ 'ds-skeleton--animate': !!animation,
75
+ 'ds-skeleton--width-fit-content': !!children && !width,
76
+ })}
77
+ {...props}
78
+ style={{
79
+ width: typeof width === 'number' ? `${width}px` : width,
80
+ maxWidth: !!width ? '100%' : undefined,
81
+ height: typeof height === 'number' ? `${height}px` : height,
82
+ }}
83
+ >
84
+ {variant === 'button' && (
85
+ <span
86
+ className={clsx({
87
+ 'ds-skeleton__line': true,
88
+ 'ds-skeleton__line--size-default':
89
+ width === undefined && height === undefined,
90
+ })}
91
+ ></span>
92
+ )}
93
+ {children}
94
+ </Base>
95
+ );
96
+ }
97
+ );
98
+
99
+ export default Skeleton;
@@ -12,13 +12,23 @@ export interface SummaryListProps extends BaseProps<'dl'> {
12
12
  * @default true
13
13
  */
14
14
  border?: boolean;
15
+ /**
16
+ * noLastBorder is optional.
17
+ * By default, SummaryList has borders. You can remove last border by using noLastBorder prop.
18
+ * By default is true
19
+ * @value true
20
+ * @value false
21
+ * @default false
22
+ */
23
+ noLastBorder?: boolean
24
+
15
25
  }
16
26
  /**
17
27
  * SummaryList used as a table with summary informations.
18
28
  * It must contain a list of SummaryListItem components.
19
29
  */
20
30
  export const SummaryList = React.forwardRef<HTMLDListElement, SummaryListProps>(
21
- function SummaryList({ className, border = true, children, ...props }, ref) {
31
+ function SummaryList({ className, noLastBorder = false, border = true, children, ...props }, ref) {
22
32
  return (
23
33
  <Base
24
34
  as="dl"
@@ -26,6 +36,7 @@ export const SummaryList = React.forwardRef<HTMLDListElement, SummaryListProps>(
26
36
  className={clsx(className, {
27
37
  'ds-summary-list': true,
28
38
  'ds-summary-list--no-border': !border,
39
+ 'ds-summary-list--no-last-border': noLastBorder
29
40
  })}
30
41
  {...props}
31
42
  >
@@ -692,6 +692,15 @@ function Unpurge() {
692
692
  ds-autocomplete__multi-input-container--1
693
693
  ds-autocomplete__multi-input-container--2
694
694
  ds-autocomplete__multi-input-container--3
695
+ ds-skeleton--text
696
+ ds-skeleton--circular
697
+ ds-skeleton--rectangular
698
+ ds-skeleton--button
699
+ ds-skeleton--font-xs
700
+ ds-skeleton--font-sm
701
+ ds-skeleton--font-md
702
+ ds-skeleton--font-lg
703
+ ds-skeleton--font-xl
695
704
  `}
696
705
  ></div>
697
706
  );