@teamturing/react-kit 2.2.0 → 2.3.1

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.
@@ -0,0 +1,6 @@
1
+ import { ChipGroupView as ChipGroupViewType } from '../../types';
2
+ type Props = {
3
+ view: ChipGroupViewType;
4
+ };
5
+ declare const ChipGroupView: ({ view: { size, gapX, gapY, chips } }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export default ChipGroupView;
@@ -1,2 +1,3 @@
1
1
  export { default as ImageView } from './ImageView';
2
2
  export { default as TextView } from './TextView';
3
+ export { default as ChipGroupViewType } from './ChipGroupView';
@@ -1,8 +1,4 @@
1
- /**
2
- * Default Types
3
- */
4
- type TextProps = any;
5
- type SpaceProps = any;
1
+ import { ChipProps, StackProps, TextProps, SpaceProps } from '../..';
6
2
  /**
7
3
  * View Related Model
8
4
  */
@@ -16,8 +12,17 @@ export type ImageView = {
16
12
  width: number;
17
13
  height: number;
18
14
  };
19
- export type View = TextView | ImageView;
20
- export type ViewComponentType = 'TextView' | 'ImageView';
15
+ export type ChipGroupView = {
16
+ size: ChipProps['size'];
17
+ gapX: StackProps['gapX'];
18
+ gapY: StackProps['gapY'];
19
+ chips: Array<{
20
+ text: string;
21
+ variant: ChipProps['variant'];
22
+ }>;
23
+ };
24
+ export type View = TextView | ImageView | ChipGroupView;
25
+ export type ViewComponentType = 'TextView' | 'ImageView' | 'ChipGroupView';
21
26
  export interface IViewContainer {
22
27
  id: string;
23
28
  viewComponentType: ViewComponentType;
@@ -52,4 +57,3 @@ export interface ISection {
52
57
  views: IViewContainer[];
53
58
  responsiveLayout: IResponsiveLayoutContainer;
54
59
  }
55
- export {};
package/dist/index.js CHANGED
@@ -3616,7 +3616,7 @@ const Unit = ({
3616
3616
  children: children
3617
3617
  });
3618
3618
  };
3619
- var index$1 = Object.assign(Grid, {
3619
+ var index = Object.assign(Grid, {
3620
3620
  Unit
3621
3621
  });
3622
3622
 
@@ -3991,7 +3991,7 @@ const Item = ({
3991
3991
  ...props,
3992
3992
  children: children
3993
3993
  });
3994
- var index = Object.assign(Stack, {
3994
+ var Stack$1 = Object.assign(Stack, {
3995
3995
  Item
3996
3996
  });
3997
3997
 
@@ -4121,6 +4121,35 @@ const TextView = ({
4121
4121
  children: text
4122
4122
  });
4123
4123
 
4124
+ const ChipGroupView = ({
4125
+ view: {
4126
+ size = 'm',
4127
+ gapX = 1,
4128
+ gapY = 1,
4129
+ chips = []
4130
+ }
4131
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(Stack$1, {
4132
+ gapX: gapX,
4133
+ gapY: gapY,
4134
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(ItemList, {
4135
+ items: chips,
4136
+ renderItem: ({
4137
+ text,
4138
+ variant
4139
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(Chip, {
4140
+ size: size,
4141
+ variant: variant,
4142
+ children: text
4143
+ }),
4144
+ renderItemWrapper: (children, {
4145
+ text,
4146
+ variant
4147
+ }, i) => /*#__PURE__*/jsxRuntimeExports.jsx(Stack$1.Item, {
4148
+ children: children
4149
+ }, `${text}-${variant}-${i}`)
4150
+ })
4151
+ });
4152
+
4124
4153
  const EnigmaUI = ({
4125
4154
  section: {
4126
4155
  views,
@@ -4155,7 +4184,8 @@ const getLayoutComponent = layoutContainer => {
4155
4184
  const getViewComponent = viewContainer => {
4156
4185
  const renderableViewComponent = {
4157
4186
  TextView: TextView,
4158
- ImageView: ImageView
4187
+ ImageView: ImageView,
4188
+ ChipGroupView: ChipGroupView
4159
4189
  };
4160
4190
  const ViewComponent = renderableViewComponent[viewContainer.viewComponentType];
4161
4191
  return ViewComponent;
@@ -4667,14 +4697,14 @@ exports.Button = Button;
4667
4697
  exports.Chip = Chip;
4668
4698
  exports.EnigmaUI = EnigmaUI;
4669
4699
  exports.GradientText = GradientText;
4670
- exports.Grid = index$1;
4700
+ exports.Grid = index;
4671
4701
  exports.IconButton = IconButton;
4672
4702
  exports.IconToggleButton = IconToggleButton;
4673
4703
  exports.Image = Image;
4674
4704
  exports.ItemList = ItemList;
4675
4705
  exports.Space = Space;
4676
4706
  exports.Spinner = Spinner;
4677
- exports.Stack = index;
4707
+ exports.Stack = Stack$1;
4678
4708
  exports.StyledIcon = StyledIcon;
4679
4709
  exports.Text = Text;
4680
4710
  exports.ThemeProvider = ThemeProvider;
@@ -56,8 +56,8 @@ const Item = ({
56
56
  ...props,
57
57
  children: children
58
58
  });
59
- var index = Object.assign(Stack, {
59
+ var Stack$1 = Object.assign(Stack, {
60
60
  Item
61
61
  });
62
62
 
63
- export { index as default };
63
+ export { Stack$1 as default };
@@ -4,6 +4,7 @@ import useMediaQuery from '../../hook/useMediaQuery.js';
4
4
  import SingleColumnLayout from '../Layout/SingleColumnLayout/index.js';
5
5
  import ImageView from '../View/ImageView/index.js';
6
6
  import TextView from '../View/TextView/index.js';
7
+ import ChipGroupView from '../View/ChipGroupView/index.js';
7
8
  import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
8
9
 
9
10
  const EnigmaUI = ({
@@ -40,7 +41,8 @@ const getLayoutComponent = layoutContainer => {
40
41
  const getViewComponent = viewContainer => {
41
42
  const renderableViewComponent = {
42
43
  TextView: TextView,
43
- ImageView: ImageView
44
+ ImageView: ImageView,
45
+ ChipGroupView: ChipGroupView
44
46
  };
45
47
  const ViewComponent = renderableViewComponent[viewContainer.viewComponentType];
46
48
  return ViewComponent;
@@ -0,0 +1,35 @@
1
+ import Chip from '../../../core/Chip/index.js';
2
+ import ItemList from '../../../core/ItemList/index.js';
3
+ import Stack from '../../../core/Stack/index.js';
4
+ import { j as jsxRuntimeExports } from '../../../node_modules/react/jsx-runtime.js';
5
+
6
+ const ChipGroupView = ({
7
+ view: {
8
+ size = 'm',
9
+ gapX = 1,
10
+ gapY = 1,
11
+ chips = []
12
+ }
13
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(Stack, {
14
+ gapX: gapX,
15
+ gapY: gapY,
16
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(ItemList, {
17
+ items: chips,
18
+ renderItem: ({
19
+ text,
20
+ variant
21
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(Chip, {
22
+ size: size,
23
+ variant: variant,
24
+ children: text
25
+ }),
26
+ renderItemWrapper: (children, {
27
+ text,
28
+ variant
29
+ }, i) => /*#__PURE__*/jsxRuntimeExports.jsx(Stack.Item, {
30
+ children: children
31
+ }, `${text}-${variant}-${i}`)
32
+ })
33
+ });
34
+
35
+ export { ChipGroupView as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "React components, hooks for create teamturing web application",
5
5
  "author": "Sungchang Park <psch300@gmail.com> (https://github.com/psch300)",
6
6
  "homepage": "https://github.com/weareteamturing/bombe#readme",
@@ -55,5 +55,5 @@
55
55
  "lodash.throttle": "^4.1.1",
56
56
  "styled-system": "^5.1.5"
57
57
  },
58
- "gitHead": "5d7caae033e9b2f4b37ffbf8bd380cff3517cea2"
58
+ "gitHead": "6c7aea0a477e3b90efb31fe26d24731ac07241be"
59
59
  }