@shoplflow/templates 0.0.2 → 0.0.3

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.
package/dist/index.cjs CHANGED
@@ -2,9 +2,92 @@
2
2
 
3
3
  var base = require('@shoplflow/base');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
+ var styled = require('@emotion/styled');
6
+ var shoplAssets = require('@shoplflow/shopl-assets');
5
7
 
6
- // src/components/Example/Example.tsx
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var styled__default = /*#__PURE__*/_interopDefault(styled);
11
+
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
16
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
+ var __spreadValues = (a, b) => {
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ if (__getOwnPropSymbols)
22
+ for (var prop of __getOwnPropSymbols(b)) {
23
+ if (__propIsEnum.call(b, prop))
24
+ __defNormalProp(a, prop, b[prop]);
25
+ }
26
+ return a;
27
+ };
7
28
  var Example = ({ text }) => {
8
29
  return /* @__PURE__ */ jsxRuntime.jsx(base.Stack.Horizontal, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: text }) });
9
30
  };
10
31
  exports.Example = Example;
32
+ var getTypographyAndColor = (depth) => {
33
+ switch (depth) {
34
+ case 1:
35
+ return { typography: "title2_700", color: "neutral700" };
36
+ case 2:
37
+ default:
38
+ return { typography: "body1_700", color: "neutral700" };
39
+ case 3:
40
+ return { typography: "body1_700", color: "neutral500" };
41
+ }
42
+ };
43
+ var StyledRequired = styled__default.default.div`
44
+ color: ${base.colorTokens.red300};
45
+ font-weight: 700;
46
+ font-size: 14px;
47
+ line-height: 18px;
48
+ padding-top: 1px;
49
+ `;
50
+ var TitleGroupHelpIcon = ({
51
+ tooltipPlacement,
52
+ tooltipOffsetValue,
53
+ tooltipMessage,
54
+ onClick
55
+ }) => {
56
+ return /* @__PURE__ */ jsxRuntime.jsx(
57
+ base.Tooltip,
58
+ {
59
+ placement: tooltipPlacement,
60
+ offset: tooltipOffsetValue,
61
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(base.IconButton, { styleVar: "GHOST", sizeVar: "XS", onClick, children: /* @__PURE__ */ jsxRuntime.jsx(base.Icon, { iconSource: shoplAssets.HelpLineIcon, color: "neutral400" }) }),
62
+ popper: tooltipMessage && /* @__PURE__ */ jsxRuntime.jsx(base.Tooltip.Content, { content: tooltipMessage })
63
+ }
64
+ );
65
+ };
66
+ var Actions = ({ children }) => {
67
+ return /* @__PURE__ */ jsxRuntime.jsx(base.Stack.Horizontal, { align: "center", children });
68
+ };
69
+ var HeaderBox = ({ children }) => {
70
+ return /* @__PURE__ */ jsxRuntime.jsx(base.StackContainer.Horizontal, { align: "center", width: "100%", minHeight: "40px", height: "auto", justify: "space-between", children });
71
+ };
72
+ var Header = ({ depth, title, isRequired, count, helpIconProps }) => {
73
+ const { color, typography } = getTypographyAndColor(depth);
74
+ return /* @__PURE__ */ jsxRuntime.jsxs(base.Stack.Horizontal, { align: "center", children: [
75
+ /* @__PURE__ */ jsxRuntime.jsxs(base.Stack.Horizontal, { spacing: "spacing04", align: "center", justify: "center", children: [
76
+ /* @__PURE__ */ jsxRuntime.jsx(base.Text, { color, typography, wordBreak: "break-all", children: title }),
77
+ isRequired && /* @__PURE__ */ jsxRuntime.jsx(StyledRequired, { children: "*" }),
78
+ Boolean(count) && /* @__PURE__ */ jsxRuntime.jsx(base.Text, { typography: "body1_700", color: "primary300", children: count })
79
+ ] }),
80
+ helpIconProps && /* @__PURE__ */ jsxRuntime.jsx(TitleGroupHelpIcon, __spreadValues({}, helpIconProps))
81
+ ] });
82
+ };
83
+ var Description = ({ description }) => {
84
+ return /* @__PURE__ */ jsxRuntime.jsx(base.StackContainer, { minHeight: "30px", height: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(base.Text, { typography: "paragraph1", color: "neutral500", wordBreak: "break-all", children: description }) });
85
+ };
86
+ var TitleGroup = ({ children }) => {
87
+ return /* @__PURE__ */ jsxRuntime.jsx(base.Stack.Vertical, { width: "100%", "data-shoplflow": "Title", children });
88
+ };
89
+ TitleGroup.HeaderBox = HeaderBox;
90
+ TitleGroup.Header = Header;
91
+ TitleGroup.Actions = Actions;
92
+ TitleGroup.Description = Description;
93
+ exports.Title = TitleGroup;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { TooltipProps } from '@shoplflow/base';
3
+ import { ChildrenProps } from '@shoplflow/base/src/utils/type/ComponentProps';
4
+ import { ReactNode } from 'react';
2
5
 
3
6
  declare type ExampleProps = {
4
7
  text: string;
@@ -6,4 +9,66 @@ declare type ExampleProps = {
6
9
 
7
10
  declare const Example: ({ text }: ExampleProps) => react_jsx_runtime.JSX.Element;
8
11
 
9
- export { Example, ExampleProps };
12
+ declare type ActionsProps = {
13
+ children: ReactNode;
14
+ };
15
+ declare type DescriptionProps = {
16
+ description: string;
17
+ };
18
+ declare type TitleGroupHelpIconProps = {
19
+ /**
20
+ * 툴팁 내용, 없을 경우 Tooltip 미노출
21
+ */
22
+ tooltipMessage?: string;
23
+ /**
24
+ * 툴팁 오프셋 값
25
+ */
26
+ tooltipOffsetValue?: number;
27
+ /**
28
+ * 툴팁 최대 너비
29
+ */
30
+ tooltipMaxWidth?: number;
31
+ /**
32
+ * 툴팁 위치
33
+ */
34
+ tooltipPlacement?: TooltipProps['placement'];
35
+ /**
36
+ * 아이콘 버튼 클릭 이벤트
37
+ */
38
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
39
+ };
40
+ declare type TitleGroupHeaderProps = {
41
+ /**
42
+ * 제목
43
+ */
44
+ title: string;
45
+ /**
46
+ * 제목의 타이포그래피 스타일
47
+ */
48
+ depth: 1 | 2 | 3;
49
+ /**
50
+ * 아이템의 총 갯수
51
+ */
52
+ count?: string;
53
+ /**
54
+ * 설명
55
+ */
56
+ description?: string;
57
+ /**
58
+ * 필수 여부 표시
59
+ */
60
+ isRequired?: boolean;
61
+ helpIconProps?: TitleGroupHelpIconProps;
62
+ };
63
+ interface TitleGroupProps extends ChildrenProps {
64
+ }
65
+
66
+ declare const TitleGroup: {
67
+ ({ children }: TitleGroupProps): react_jsx_runtime.JSX.Element;
68
+ HeaderBox: ({ children }: ChildrenProps) => react_jsx_runtime.JSX.Element;
69
+ Header: ({ depth, title, isRequired, count, helpIconProps }: TitleGroupHeaderProps) => react_jsx_runtime.JSX.Element;
70
+ Actions: ({ children }: ActionsProps) => react_jsx_runtime.JSX.Element;
71
+ Description: ({ description }: DescriptionProps) => react_jsx_runtime.JSX.Element;
72
+ };
73
+
74
+ export { ActionsProps, DescriptionProps, Example, ExampleProps, TitleGroup as Title, TitleGroupHeaderProps, TitleGroupHelpIconProps, TitleGroupProps };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { TooltipProps } from '@shoplflow/base';
3
+ import { ChildrenProps } from '@shoplflow/base/src/utils/type/ComponentProps';
4
+ import { ReactNode } from 'react';
2
5
 
3
6
  declare type ExampleProps = {
4
7
  text: string;
@@ -6,4 +9,66 @@ declare type ExampleProps = {
6
9
 
7
10
  declare const Example: ({ text }: ExampleProps) => react_jsx_runtime.JSX.Element;
8
11
 
9
- export { Example, ExampleProps };
12
+ declare type ActionsProps = {
13
+ children: ReactNode;
14
+ };
15
+ declare type DescriptionProps = {
16
+ description: string;
17
+ };
18
+ declare type TitleGroupHelpIconProps = {
19
+ /**
20
+ * 툴팁 내용, 없을 경우 Tooltip 미노출
21
+ */
22
+ tooltipMessage?: string;
23
+ /**
24
+ * 툴팁 오프셋 값
25
+ */
26
+ tooltipOffsetValue?: number;
27
+ /**
28
+ * 툴팁 최대 너비
29
+ */
30
+ tooltipMaxWidth?: number;
31
+ /**
32
+ * 툴팁 위치
33
+ */
34
+ tooltipPlacement?: TooltipProps['placement'];
35
+ /**
36
+ * 아이콘 버튼 클릭 이벤트
37
+ */
38
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
39
+ };
40
+ declare type TitleGroupHeaderProps = {
41
+ /**
42
+ * 제목
43
+ */
44
+ title: string;
45
+ /**
46
+ * 제목의 타이포그래피 스타일
47
+ */
48
+ depth: 1 | 2 | 3;
49
+ /**
50
+ * 아이템의 총 갯수
51
+ */
52
+ count?: string;
53
+ /**
54
+ * 설명
55
+ */
56
+ description?: string;
57
+ /**
58
+ * 필수 여부 표시
59
+ */
60
+ isRequired?: boolean;
61
+ helpIconProps?: TitleGroupHelpIconProps;
62
+ };
63
+ interface TitleGroupProps extends ChildrenProps {
64
+ }
65
+
66
+ declare const TitleGroup: {
67
+ ({ children }: TitleGroupProps): react_jsx_runtime.JSX.Element;
68
+ HeaderBox: ({ children }: ChildrenProps) => react_jsx_runtime.JSX.Element;
69
+ Header: ({ depth, title, isRequired, count, helpIconProps }: TitleGroupHeaderProps) => react_jsx_runtime.JSX.Element;
70
+ Actions: ({ children }: ActionsProps) => react_jsx_runtime.JSX.Element;
71
+ Description: ({ description }: DescriptionProps) => react_jsx_runtime.JSX.Element;
72
+ };
73
+
74
+ export { ActionsProps, DescriptionProps, Example, ExampleProps, TitleGroup as Title, TitleGroupHeaderProps, TitleGroupHelpIconProps, TitleGroupProps };
package/dist/index.js CHANGED
@@ -1,10 +1,89 @@
1
- import { Stack } from '@shoplflow/base';
2
- import { jsx } from 'react/jsx-runtime';
1
+ import { colorTokens, Stack, StackContainer, Text, Tooltip, IconButton, Icon } from '@shoplflow/base';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import styled from '@emotion/styled';
4
+ import { HelpLineIcon } from '@shoplflow/shopl-assets';
3
5
 
4
- // src/components/Example/Example.tsx
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
5
22
  var Example = ({ text }) => {
6
23
  return /* @__PURE__ */ jsx(Stack.Horizontal, { children: /* @__PURE__ */ jsx("div", { children: text }) });
7
24
  };
8
25
  var Example_default = Example;
26
+ var getTypographyAndColor = (depth) => {
27
+ switch (depth) {
28
+ case 1:
29
+ return { typography: "title2_700", color: "neutral700" };
30
+ case 2:
31
+ default:
32
+ return { typography: "body1_700", color: "neutral700" };
33
+ case 3:
34
+ return { typography: "body1_700", color: "neutral500" };
35
+ }
36
+ };
37
+ var StyledRequired = styled.div`
38
+ color: ${colorTokens.red300};
39
+ font-weight: 700;
40
+ font-size: 14px;
41
+ line-height: 18px;
42
+ padding-top: 1px;
43
+ `;
44
+ var TitleGroupHelpIcon = ({
45
+ tooltipPlacement,
46
+ tooltipOffsetValue,
47
+ tooltipMessage,
48
+ onClick
49
+ }) => {
50
+ return /* @__PURE__ */ jsx(
51
+ Tooltip,
52
+ {
53
+ placement: tooltipPlacement,
54
+ offset: tooltipOffsetValue,
55
+ trigger: /* @__PURE__ */ jsx(IconButton, { styleVar: "GHOST", sizeVar: "XS", onClick, children: /* @__PURE__ */ jsx(Icon, { iconSource: HelpLineIcon, color: "neutral400" }) }),
56
+ popper: tooltipMessage && /* @__PURE__ */ jsx(Tooltip.Content, { content: tooltipMessage })
57
+ }
58
+ );
59
+ };
60
+ var Actions = ({ children }) => {
61
+ return /* @__PURE__ */ jsx(Stack.Horizontal, { align: "center", children });
62
+ };
63
+ var HeaderBox = ({ children }) => {
64
+ return /* @__PURE__ */ jsx(StackContainer.Horizontal, { align: "center", width: "100%", minHeight: "40px", height: "auto", justify: "space-between", children });
65
+ };
66
+ var Header = ({ depth, title, isRequired, count, helpIconProps }) => {
67
+ const { color, typography } = getTypographyAndColor(depth);
68
+ return /* @__PURE__ */ jsxs(Stack.Horizontal, { align: "center", children: [
69
+ /* @__PURE__ */ jsxs(Stack.Horizontal, { spacing: "spacing04", align: "center", justify: "center", children: [
70
+ /* @__PURE__ */ jsx(Text, { color, typography, wordBreak: "break-all", children: title }),
71
+ isRequired && /* @__PURE__ */ jsx(StyledRequired, { children: "*" }),
72
+ Boolean(count) && /* @__PURE__ */ jsx(Text, { typography: "body1_700", color: "primary300", children: count })
73
+ ] }),
74
+ helpIconProps && /* @__PURE__ */ jsx(TitleGroupHelpIcon, __spreadValues({}, helpIconProps))
75
+ ] });
76
+ };
77
+ var Description = ({ description }) => {
78
+ return /* @__PURE__ */ jsx(StackContainer, { minHeight: "30px", height: "auto", children: /* @__PURE__ */ jsx(Text, { typography: "paragraph1", color: "neutral500", wordBreak: "break-all", children: description }) });
79
+ };
80
+ var TitleGroup = ({ children }) => {
81
+ return /* @__PURE__ */ jsx(Stack.Vertical, { width: "100%", "data-shoplflow": "Title", children });
82
+ };
83
+ TitleGroup.HeaderBox = HeaderBox;
84
+ TitleGroup.Header = Header;
85
+ TitleGroup.Actions = Actions;
86
+ TitleGroup.Description = Description;
87
+ var TitleGroup_default = TitleGroup;
9
88
 
10
- export { Example_default as Example };
89
+ export { Example_default as Example, TitleGroup_default as Title };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shoplflow/templates",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -40,6 +40,7 @@
40
40
  "@emotion/styled": "11.10.8",
41
41
  "@rollup/plugin-commonjs": "^25.0.7",
42
42
  "@rollup/plugin-node-resolve": "^15.2.3",
43
+ "@storybook/addon-designs": "^8.0.3",
43
44
  "@storybook/addon-a11y": "^8.4.7",
44
45
  "@storybook/addon-actions": "^8.4.7",
45
46
  "@storybook/addon-backgrounds": "^8.4.7",
@@ -86,14 +87,15 @@
86
87
  "react-datepicker": "^7.3.0",
87
88
  "react-dom": "^18.2.0",
88
89
  "simplebar-react": "^3.2.6",
89
- "@shoplflow/base": "^0.32.22",
90
+ "@shoplflow/base": "^0.32.23",
90
91
  "@shoplflow/shopl-assets": "^0.10.4",
91
- "@shoplflow/hada-assets": "^0.1.3",
92
- "@shoplflow/utils": "^0.6.5"
92
+ "@shoplflow/utils": "^0.6.5",
93
+ "@shoplflow/hada-assets": "^0.1.3"
93
94
  },
94
95
  "scripts": {
95
96
  "type-check": "tsc --noEmit",
96
97
  "build:package": "rm -rf dist/ && tsup",
98
+ "generate:component": "scripts/generate-component.sh",
97
99
  "build:storybook": "storybook build",
98
100
  "build": "pnpm run build:package && pnpm run build:storybook",
99
101
  "dev:stories": "storybook dev -p 6008",