@spaced-out/ui-design-system 0.1.15 → 0.1.17

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 (102) hide show
  1. package/.cspell/custom-words.txt +3 -0
  2. package/.flowconfig +1 -1
  3. package/CHANGELOG.md +15 -0
  4. package/CONTRIBUTING.md +52 -6
  5. package/README.md +144 -8
  6. package/gulpfile.js +1 -0
  7. package/lib/components/Avatar/Avatar.module.css +8 -2
  8. package/lib/components/AvatarGroup/AvatarGroup.js +25 -14
  9. package/lib/components/AvatarGroup/AvatarGroup.js.flow +118 -103
  10. package/lib/components/Badge/Badge.js +4 -3
  11. package/lib/components/Badge/Badge.js.flow +21 -21
  12. package/lib/components/Badge/index.js +11 -7
  13. package/lib/components/Badge/index.js.flow +1 -2
  14. package/lib/components/Banner/Banner.js +3 -2
  15. package/lib/components/Banner/Banner.js.flow +42 -35
  16. package/lib/components/Button/Button.js +50 -10
  17. package/lib/components/Button/Button.js.flow +87 -23
  18. package/lib/components/Button/Button.module.css +14 -0
  19. package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js +3 -2
  20. package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js.flow +48 -38
  21. package/lib/components/ButtonTabs/ButtonTabs.js +3 -2
  22. package/lib/components/ButtonTabs/ButtonTabs.js.flow +50 -41
  23. package/lib/components/Card/Card.js +16 -7
  24. package/lib/components/Card/Card.js.flow +73 -55
  25. package/lib/components/Checkbox/Checkbox.js +15 -10
  26. package/lib/components/Checkbox/Checkbox.js.flow +121 -100
  27. package/lib/components/Checkbox/Checkbox.module.css +4 -1
  28. package/lib/components/Checkbox/CheckboxGroup.js +4 -3
  29. package/lib/components/Checkbox/CheckboxGroup.js.flow +76 -65
  30. package/lib/components/Chip/Chip.js +3 -2
  31. package/lib/components/Chip/Chip.js.flow +66 -59
  32. package/lib/components/CircularLoader/CircularLoader.js +9 -4
  33. package/lib/components/CircularLoader/CircularLoader.js.flow +38 -24
  34. package/lib/components/CollapsibleCard/CollapsibleCard.js +4 -3
  35. package/lib/components/CollapsibleCard/CollapsibleCard.js.flow +68 -59
  36. package/lib/components/Dropdown/Dropdown.js +4 -3
  37. package/lib/components/Dropdown/Dropdown.js.flow +83 -74
  38. package/lib/components/EmptyState/EmptyState.js +4 -3
  39. package/lib/components/EmptyState/EmptyState.js.flow +53 -44
  40. package/lib/components/ErrorMessage/ErrorMessage.js +4 -3
  41. package/lib/components/ErrorMessage/ErrorMessage.js.flow +58 -49
  42. package/lib/components/InContextAlert/InContextAlert.js +4 -3
  43. package/lib/components/InContextAlert/InContextAlert.js.flow +79 -73
  44. package/lib/components/InlineDropdown/InlineDropdown.js +4 -3
  45. package/lib/components/InlineDropdown/InlineDropdown.js.flow +94 -85
  46. package/lib/components/LinearLoader/LinearLoader.js +4 -3
  47. package/lib/components/LinearLoader/LinearLoader.js.flow +20 -18
  48. package/lib/components/Link/Link.js +8 -1
  49. package/lib/components/Link/Link.js.flow +44 -36
  50. package/lib/components/Notification/Notification.js +8 -6
  51. package/lib/components/Notification/Notification.js.flow +96 -84
  52. package/lib/components/OptionButton/OptionButton.js +7 -4
  53. package/lib/components/OptionButton/OptionButton.js.flow +69 -59
  54. package/lib/components/PageTitle/PageTitle.js +4 -3
  55. package/lib/components/PageTitle/PageTitle.js.flow +46 -44
  56. package/lib/components/Pagination/PaginationItem.js +2 -2
  57. package/lib/components/Pagination/PaginationItem.js.flow +2 -2
  58. package/lib/components/RadioButton/RadioButton.js +15 -9
  59. package/lib/components/RadioButton/RadioButton.js.flow +91 -70
  60. package/lib/components/RadioButton/RadioButton.module.css +4 -1
  61. package/lib/components/RadioButton/RadioGroup.js +4 -3
  62. package/lib/components/RadioButton/RadioGroup.js.flow +56 -47
  63. package/lib/components/SearchInput/SearchInput.js +3 -2
  64. package/lib/components/SearchInput/SearchInput.js.flow +59 -50
  65. package/lib/components/SideMenuLink/SideMenuLink.js +4 -3
  66. package/lib/components/SideMenuLink/SideMenuLink.js.flow +54 -45
  67. package/lib/components/StatusIndicator/StatusIndicator.js +3 -2
  68. package/lib/components/StatusIndicator/StatusIndicator.js.flow +32 -23
  69. package/lib/components/SubMenu/SubMenu.js +4 -3
  70. package/lib/components/SubMenu/SubMenu.js.flow +41 -38
  71. package/lib/components/Table/StaticTable.js +3 -0
  72. package/lib/components/Table/StaticTable.js.flow +3 -0
  73. package/lib/components/Table/Table.js +10 -0
  74. package/lib/components/Table/Table.js.flow +10 -0
  75. package/lib/components/Table/hooks.js +1 -0
  76. package/lib/components/Table/hooks.js.flow +1 -0
  77. package/lib/components/Tabs/TabList/TabList.js +3 -2
  78. package/lib/components/Tabs/TabList/TabList.js.flow +127 -117
  79. package/lib/components/Toast/Toast.js +8 -10
  80. package/lib/components/Toast/Toast.js.flow +19 -27
  81. package/lib/components/Toast/Toast.module.css +8 -0
  82. package/lib/components/Toggle/Toggle.js +11 -7
  83. package/lib/components/Toggle/Toggle.js.flow +16 -12
  84. package/lib/components/Toggle/Toggle.module.css +2 -0
  85. package/lib/components/Toggle/index.js +11 -7
  86. package/lib/components/Toggle/index.js.flow +1 -1
  87. package/lib/components/Tooltip/Tooltip.js.flow +2 -2
  88. package/lib/components/index.js +511 -0
  89. package/lib/components/index.js.flow +48 -0
  90. package/lib/index.js +60 -0
  91. package/lib/index.js.flow +7 -0
  92. package/lib/styles/index.css +15 -0
  93. package/lib/styles/index.js +104 -0
  94. package/lib/styles/index.js.flow +12 -0
  95. package/lib/styles/typography.module.css +0 -1
  96. package/lib/styles/utils.module.css +26 -0
  97. package/lib/types/index.js +38 -0
  98. package/lib/types/index.js.flow +5 -0
  99. package/lib/utils/click-away.js.flow +1 -1
  100. package/lib/utils/index.js +93 -0
  101. package/lib/utils/index.js.flow +10 -0
  102. package/package.json +2 -1
@@ -9,6 +9,7 @@ datetime
9
9
  DEFAULTTEXT
10
10
  dismissable
11
11
  eqeqeq
12
+ fbjs
12
13
  Fennimore
13
14
  flowtype
14
15
  fontawesome
@@ -32,6 +33,7 @@ rgba
32
33
  sbdocs
33
34
  Stapleton
34
35
  superrover
36
+ systemjs
35
37
  testid
36
38
  tnum
37
39
  transclude
@@ -39,4 +41,5 @@ Typeahead
39
41
  typeof
40
42
  Verda
41
43
  xmark
44
+ yourcomponentname
42
45
  yxxx
package/.flowconfig CHANGED
@@ -42,4 +42,4 @@ deprecated-type=warn
42
42
  sketchy-number=error
43
43
  unclear-type=warn
44
44
  unnecessary-invariant=warn
45
- unnecessary-optional-chain=warn
45
+ unnecessary-optional-chain=warn
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.17](https://github.com/spaced-out/ui-design-system/compare/v0.1.16...v0.1.17) (2023-04-24)
6
+
7
+
8
+ ### Features
9
+
10
+ * button loading - focus management - forwardref - simple imports ([#105](https://github.com/spaced-out/ui-design-system/issues/105)) ([29d4b4f](https://github.com/spaced-out/ui-design-system/commit/29d4b4fe3c65ad752b97c59acc947380ad996280))
11
+
12
+ ### [0.1.16](https://github.com/spaced-out/ui-design-system/compare/v0.1.15...v0.1.16) (2023-04-19)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * avatar img aspect ratio and Checkbox ref forwarding ([#101](https://github.com/spaced-out/ui-design-system/issues/101)) ([f756a98](https://github.com/spaced-out/ui-design-system/commit/f756a9812a7327c04a99d056b36f479425662153))
18
+ * typography component removed from children wrap ([#104](https://github.com/spaced-out/ui-design-system/issues/104)) ([24887c8](https://github.com/spaced-out/ui-design-system/commit/24887c8a505917738e161ae1208dea533cecfab5))
19
+
5
20
  ### [0.1.15](https://github.com/spaced-out/ui-design-system/compare/v0.1.14...v0.1.15) (2023-04-18)
6
21
 
7
22
 
package/CONTRIBUTING.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  # Contribution Guidelines
4
4
 
5
+ - [Intro](#intro)
6
+ - [Development](#development)
7
+ - [Environment Setup](#environment-setup)
8
+ - [Generating New Component](#generating-new-component)
9
+ - [Generating New Hook](#generating-new-hook)
10
+ - [Exports](#exports)
11
+ - [Imports](#imports)
12
+ - [Adding Stories](#adding-stories)
13
+ - [Using Design Tokens](#using-design-tokens)
14
+ - [Testing Genesis Design System Locally](#testing-genesis-design-system-locally)
15
+ - [Troubleshooting local development](#troubleshooting-local-development)
16
+ - [Commits](#commits)
17
+ - [Add yourself to the contributor list ✨](#add-yourself-to-the-contributor-list)
18
+
19
+ ## Intro
20
+
5
21
  Genesis Design System is created using:
6
22
 
7
23
  - [Gulp](https://gulpjs.com/)
@@ -16,7 +32,7 @@ It also features:
16
32
 
17
33
  ## Development
18
34
 
19
- <br/>
35
+ Follow the below mentioned steps to setup a dev environment locally:
20
36
 
21
37
  ### Environment Setup
22
38
 
@@ -43,10 +59,10 @@ yarn storybook
43
59
 
44
60
  > The `storybook` server runs on port **6006** and url is opened automatically on successful dev build.
45
61
 
46
- ### Generating New Components
62
+ ### Generating New Component
47
63
 
48
64
  We've included a handy NodeJS util file under `scripts` called `create-component.js`. Instead of copy pasting components to create a new component,
49
- you can instead run this command to generate all the files you need to start building out a new component. To use it:
65
+ you can instead run this command to generate all the files you need to start building out a new component. This also has a story boilerplate to help you kickstart component dev testing. To use it:
50
66
 
51
67
  ```bash
52
68
  yarn generate YourComponentName
@@ -62,13 +78,39 @@ yarn generate YourComponentName
62
78
  YourComponentName.stories.jsx
63
79
  YourComponentName.module.css
64
80
  YourComponentName.stories.module.css
81
+ index.js
65
82
  ```
66
83
 
67
84
  > The default templates for each file can be modified under `scripts/templates`.
68
85
 
86
+ > This script also appends YourComponentName exports in **`src/components/index.js`**.
87
+
88
+ > After component creation your component story would be visible at `/?path=/docs/components-yourcomponentname`.
89
+
90
+ ### Generating New Hook
91
+
92
+ There is also a handy NodeJS util file under `scripts` called `create-hook.js`. This generates a new hook that you need and appends exports in the `index.js`. To use it:
93
+
94
+ ```bash
95
+ yarn generateHook yourHook
96
+ ```
97
+
98
+ > This will generate:
99
+
100
+ ```bash
101
+ /src
102
+ /hooks
103
+ yourHook.js
104
+ ```
105
+
106
+ > This script also appends YourComponentName exports in **`src/hooks/index.js`**.
107
+
69
108
  ### Exports
70
109
 
71
- Export Component as named export and Component Props/Types e.g. export Modal from `./src/components/Modal/index.js`.
110
+ Each component folder should have an index.js which exports all required component(s) | types.
111
+ Export hook | style | util | type as named export and add these exports to the index.js of respective folder root.
112
+
113
+ **Note:** Make sure you have all your exports listed in `src/index.js`. Consumers use this as an entry point to do all imports.
72
114
 
73
115
  ### Imports
74
116
 
@@ -126,6 +168,10 @@ For every change in `ui_design_system` that you want to propagate to `consumer`
126
168
  yarn upgrade @spaced-out/ui-design-system@file:../../ui-design-system
127
169
  ```
128
170
 
171
+ ## Troubleshooting local development
172
+
173
+ - Because we are using react hooks and having react as a peerDependency - if you want to develop locally and encounter issues with "invalid hook call" [See this github thread](https://github.com/facebook/react/issues/13991). The quick fix is in your webpack config file alias react to resolve the node_modules path
174
+
129
175
  ## Commits
130
176
 
131
177
  Each commit should follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines
@@ -144,9 +190,9 @@ Most commonly used commit prefixes:
144
190
 
145
191
  > `build:` Commits, that affect build components like build tool, ci pipeline, dependencies, project version, etc.
146
192
 
147
- ## Add yourself to the maintainer list
193
+ ## Add yourself to the contributor list
148
194
 
149
- To add yourself to the `maintainers` table in the README and INTRODUCTION stories:
195
+ To add yourself to the `contributors` table in the README and INTRODUCTION stories:
150
196
 
151
197
  > Run the following commands from the root of the repo:
152
198
 
package/README.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  # Genesis Design System
4
4
 
5
+ - [Intro](#intro)
6
+ - [Usage](#usage)
7
+ - [Installation](#installation)
8
+ - [Component Usage](#component-usage)
9
+ - [Using Components](#using-components)
10
+ - [Setting Up Component Aliases](#setting-up-component-aliases)
11
+ - [Setting Up Fonts](#setting-up-fonts)
12
+ - [Using Genesis Design Tokens](#using-genesis-design-tokens)
13
+ - [CSS Tokens](#css-tokens)
14
+ - [JS Tokens](#js-tokens)
15
+ - [Setting Up Design Token Aliases](#setting-up-design-token-aliases)
16
+ - [Documentation](#documentation)
17
+ - [Contributions](#contributions)
18
+ - [Changelog](#changelog)
19
+ - [Contributors ✨](#contributors)
20
+
21
+ ## Intro
22
+
5
23
  Genesis design system consists of a set of tools and protocols that unify design and development across surfaces (platforms) to deliver consistent
6
24
  user experiences. The system utilizes workflow automation to streamline the design and development process. It's comprised of a number of React
7
25
  web components that each play a unique role within the product development cycle.
@@ -11,6 +29,10 @@ development lifecycle.
11
29
 
12
30
  ## Usage
13
31
 
32
+ Follow the below mentioned guide for installation and usage instructions
33
+
34
+ ### Installation
35
+
14
36
  To install `@spaced-out/ui-design-system` in your project, you will need to run the
15
37
  following command using [yarn](https://yarnpkg.com/):
16
38
 
@@ -18,25 +40,75 @@ following command using [yarn](https://yarnpkg.com/):
18
40
  yarn add @spaced-out/ui-design-system
19
41
  ```
20
42
 
43
+ ### Component Usage
44
+
21
45
  Usage of the component (after the library installed as a dependency in project) will be:
22
46
 
47
+ #### Using Components
48
+
23
49
  ```js
24
50
  import React from 'react';
51
+
52
+ // There are multiple ways of importing a component
53
+
25
54
  import {Button} from '@spaced-out/ui-design-system/lib/components/Button';
26
55
 
56
+ /** We also export all components | hooks | styles | utils | types from a common
57
+ * index file located at @spaced-out/ui-design-system/lib.
58
+ *
59
+ * For multiple imports this can be used
60
+ */
61
+
62
+ import {
63
+ Button,
64
+ BodyMedium,
65
+ TEXT_COLORS,
66
+ Toast,
67
+ Dropdown,
68
+ } from '@spaced-out/ui-design-system/lib';
69
+
27
70
  const App = () => (
28
- <div className="app-container">
71
+ <div className={css.container}>
29
72
  <Button>Hello world</Button>
73
+ <BodyMedium color={TEXT_COLORS.neutral}>Some text</BodyMedium>
30
74
  </div>
31
75
  );
32
76
 
33
77
  export default App;
34
78
  ```
35
79
 
80
+ #### Setting Up Component Aliases
81
+
82
+ You can also set up aliases in your build tool to further simplify imports if you want.
83
+ eg. This webpack config set up an alias for `@spaced-out/ui-design-system/lib` to `ui-design-system`
84
+
85
+ ```js
86
+ const {MODE, DEVELOPMENT, RESOLVE_MODULES_DIRS} = require('./constants');
87
+
88
+ exports.default = {
89
+ mode: MODE,
90
+
91
+ devtool: DEVELOPMENT ? 'eval-cheap-module-source-map' : 'source-map',
92
+
93
+ resolve: {
94
+ symlinks: false,
95
+ modules: RESOLVE_MODULES_DIRS,
96
+ alias: {
97
+ common: 'src/styles/common.css',
98
+ designSystem2021: 'src/styles/design-system-2021.css',
99
+ sentry: '@sentry/browser',
100
+ 'react-router': '@spaced-out/react-router',
101
+ sculpt: '@spaced-out/sculpt',
102
+ 'ui-design-system': '@spaced-out/ui-design-system/lib',
103
+ },
104
+ },
105
+ };
106
+ ```
107
+
36
108
  For more information about each component, check out
37
109
  [Storybook](https://spaced-out.github.io/ui-design-system).
38
110
 
39
- **&rarr; Fonts**
111
+ #### Setting Up Fonts
40
112
 
41
113
  By default Genesis uses `'Centra No 2'` font. To add this font in your project you need to load this font. The recommended way to do it is by adding the following in your global css.
42
114
 
@@ -72,25 +144,89 @@ By default Genesis uses `'Centra No 2'` font. To add this font in your project y
72
144
  }
73
145
  ```
74
146
 
75
- **&rarr; Using Genesis Design Tokens**
147
+ #### Using Genesis Design Tokens
76
148
 
77
149
  Design tokens are exported as `.css` and `.js`. You can consume them easily by
78
150
 
151
+ ##### CSS Tokens
152
+
79
153
  CSS use:
80
154
 
81
- ```js
155
+ ```css
82
156
  @value (size2) from '@spaced-out/ui-design-system/lib/styles/variables/_size.css';
83
157
 
158
+ /* We also export all style variable(design tokens) and common classes from a common index
159
+ file located at @spaced-out/ui-design-system/lib/styles/index.css */
160
+
161
+ /* For @value from Multiple css files use this */
162
+
163
+ @value (
164
+ colorFillPrimary,
165
+ colorTextSecondary,
166
+ colorTextDisabled,
167
+ spaceXXSmall,
168
+ spaceNone,
169
+ spaceSmall,
170
+ spaceXSmall,
171
+ size34,
172
+ sizeFluid,
173
+ size40
174
+ ) from '@spaced-out/ui-design-system/lib/styles/index.css';
175
+
84
176
  .example-container {
85
- height: size2
177
+ height: size2;
178
+ composes: motionEaseInEaseOut from '@spaced-out/ui-design-system/lib/styles/index.css';
86
179
  }
87
180
  ```
88
181
 
182
+ ##### JS Tokens
183
+
89
184
  JS use:
90
185
 
91
186
  ```js
92
- import {size2} from "@spaced-out/ui-design-system/lib/styles/variables/_size.js";
93
- import * as SIZES from "@spaced-out/ui-design-system/lib/styles/variables/_size.js";
187
+ import {size2} from '@spaced-out/ui-design-system/lib/styles/variables/_size.js';
188
+
189
+ /* We also export all style variable(design tokens) from a common index
190
+ file located at @spaced-out/ui-design-system/lib */
191
+
192
+ /* For multiple design token impoets use this */
193
+
194
+ import {
195
+ sizeFluid,
196
+ size2,
197
+ spaceNone,
198
+ colorTextNeutral,
199
+ borderRadiusSmall,
200
+ } from '@spaced-out/ui-design-system/lib';
201
+ ```
202
+
203
+ #### Setting Up Design Token Aliases
204
+
205
+ You can also set up aliases in your build tool to further simplify imports if you want.
206
+ eg. This webpack config set up an alias for `@spaced-out/ui-design-system/lib/styles/index.css` to `uiDesignSystem`
207
+
208
+ ```js
209
+ const {MODE, DEVELOPMENT, RESOLVE_MODULES_DIRS} = require('./constants');
210
+
211
+ exports.default = {
212
+ mode: MODE,
213
+
214
+ devtool: DEVELOPMENT ? 'eval-cheap-module-source-map' : 'source-map',
215
+
216
+ resolve: {
217
+ symlinks: false,
218
+ modules: RESOLVE_MODULES_DIRS,
219
+ alias: {
220
+ common: 'src/styles/common.css',
221
+ designSystem2021: 'src/styles/design-system-2021.css',
222
+ uiDesignSystem: '@spaced-out/ui-design-system/lib/styles/index.css',
223
+ sentry: '@sentry/browser',
224
+ 'react-router': '@spaced-out/react-router',
225
+ sculpt: '@spaced-out/sculpt',
226
+ 'ui-design-system': '@spaced-out/ui-design-system/lib',
227
+ },
228
+ },
229
+ };
94
230
  ```
95
231
 
96
232
  ## Documentation
@@ -105,7 +241,7 @@ Check out our [**Contribution Guide**](https://spaced-out.github.io/ui-design-sy
105
241
 
106
242
  Check out our [**Changelog here**](https://spaced-out.github.io/ui-design-system/?path=/docs/changelog--page)
107
243
 
108
- ## Maintainers ✨
244
+ ## Contributors
109
245
 
110
246
  <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
111
247
  <!-- prettier-ignore-start -->
package/gulpfile.js CHANGED
@@ -5,6 +5,7 @@ const replace = require('gulp-replace');
5
5
 
6
6
  const babelRc = require('./babel.config');
7
7
 
8
+
8
9
  const doNotBuildThese = [
9
10
  'src/__tests__/**',
10
11
  'src/**/*.test.js',
@@ -13,16 +13,22 @@
13
13
  .container.largeSize {
14
14
  width: size60;
15
15
  height: size60;
16
+ min-width: size60;
17
+ min-height: size60;
16
18
  }
17
19
 
18
20
  .container.mediumSize {
19
21
  width: size42;
20
22
  height: size42;
23
+ min-width: size42;
24
+ min-height: size42;
21
25
  }
22
26
 
23
27
  .container.smallSize {
24
28
  width: size34;
25
29
  height: size34;
30
+ min-width: size34;
31
+ min-height: size34;
26
32
  }
27
33
 
28
34
  .container.baseLargeSize {
@@ -48,8 +54,8 @@
48
54
 
49
55
  .avatar {
50
56
  vertical-align: middle;
51
- width: sizeFluid;
52
- height: sizeFluid;
57
+ max-width: sizeFluid;
58
+ max-height: sizeFluid;
53
59
  border-radius: borderRadiusCircle;
54
60
  display: flex;
55
61
  align-items: center;
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
18
  const COLOR_SEQUENCE = ['blue', 'green', 'orange', 'red', 'gray'];
19
- const AvatarGroup = _ref => {
19
+ const AvatarGroup = /*#__PURE__*/React.forwardRef((_ref, ref) => {
20
20
  let {
21
21
  children,
22
22
  size = 'medium',
@@ -33,17 +33,27 @@ const AvatarGroup = _ref => {
33
33
  large: _space.spaceXSmall
34
34
  };
35
35
  let colorIndex = -1;
36
- const avatarInGroup = (child, index, color) => /*#__PURE__*/React.cloneElement(child, {
37
- size,
38
- classNames: {
39
- wrapper: _AvatarGroupModule.default.avatarInGroup
40
- },
41
- style: {
42
- borderColor,
43
- marginLeft: `-${index !== 0 ? leftOverlap[size] : 0}`
44
- },
45
- color
46
- });
36
+ const avatarInGroup = (child, index, color) => {
37
+ const {
38
+ classNames
39
+ } = child.props;
40
+ const {
41
+ wrapper,
42
+ ...restClassNames
43
+ } = classNames || {};
44
+ return /*#__PURE__*/React.cloneElement(child, {
45
+ size,
46
+ classNames: {
47
+ wrapper: (0, _classify.default)(_AvatarGroupModule.default.avatarInGroup, wrapper),
48
+ ...restClassNames
49
+ },
50
+ style: {
51
+ borderColor,
52
+ marginLeft: `-${index !== 0 ? leftOverlap[size] : 0}`
53
+ },
54
+ color
55
+ });
56
+ };
47
57
  const childrenArray = React.Children.toArray(children);
48
58
  const totalAvatarCount = childrenArray.length;
49
59
  const plusAvatar = () => {
@@ -106,7 +116,8 @@ const AvatarGroup = _ref => {
106
116
  [_AvatarGroupModule.default.largeSize]: size === 'large',
107
117
  [_AvatarGroupModule.default.mediumSize]: size === 'medium',
108
118
  [_AvatarGroupModule.default.smallSize]: size === 'small'
109
- })
119
+ }),
120
+ ref: ref
110
121
  }, childrenWithProps);
111
- };
122
+ });
112
123
  exports.AvatarGroup = AvatarGroup;