@ceed/ads 0.0.24 → 0.0.26

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.
@@ -109,31 +109,15 @@ function useDataTableRenderer(_a) {
109
109
  var _a, _b;
110
110
  var ref = useRef(null);
111
111
  var style = useMemo(function () {
112
+ var _a;
112
113
  return ({
113
114
  width: column.width,
114
- minWidth: column.minWidth,
115
+ minWidth: (_a = column.minWidth) !== null && _a !== void 0 ? _a : "50px",
115
116
  maxWidth: column.maxWidth,
116
117
  textAlign: column.type === "number" ? "end" : "start",
117
118
  position: stickyHeader ? undefined : "relative",
118
119
  });
119
120
  }, [column, stickyHeader]);
120
- useEffect(function () {
121
- if (column.resizable && ref.current) {
122
- var resizeObserver_1 = new ResizeObserver(function (entries) {
123
- for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
124
- var entry = entries_1[_i];
125
- var width = entry.contentRect.width;
126
- if (width && ref.current) {
127
- ref.current.style.width = "".concat(width, "px");
128
- }
129
- }
130
- });
131
- resizeObserver_1.observe(ref.current);
132
- return function () {
133
- resizeObserver_1.disconnect();
134
- };
135
- }
136
- }, [column.resizable, ref.current]);
137
121
  var resizer = ((_a = column.resizable) !== null && _a !== void 0 ? _a : true) ? (React.createElement(Box, { sx: {
138
122
  position: "absolute",
139
123
  top: 0,
package/framer/index.js CHANGED
@@ -32276,29 +32276,13 @@ function useDataTableRenderer({
32276
32276
  const style4 = useMemo32(
32277
32277
  () => ({
32278
32278
  width: column2.width,
32279
- minWidth: column2.minWidth,
32279
+ minWidth: column2.minWidth ?? "50px",
32280
32280
  maxWidth: column2.maxWidth,
32281
32281
  textAlign: column2.type === "number" ? "end" : "start",
32282
32282
  position: stickyHeader ? void 0 : "relative"
32283
32283
  }),
32284
32284
  [column2, stickyHeader]
32285
32285
  );
32286
- useEffect33(() => {
32287
- if (column2.resizable && ref.current) {
32288
- const resizeObserver = new ResizeObserver((entries) => {
32289
- for (const entry of entries) {
32290
- const { width: width2 } = entry.contentRect;
32291
- if (width2 && ref.current) {
32292
- ref.current.style.width = `${width2}px`;
32293
- }
32294
- }
32295
- });
32296
- resizeObserver.observe(ref.current);
32297
- return () => {
32298
- resizeObserver.disconnect();
32299
- };
32300
- }
32301
- }, [column2.resizable, ref.current]);
32302
32286
  const resizer = column2.resizable ?? true ? /* @__PURE__ */ jsx2(
32303
32287
  Box_default2,
32304
32288
  {
@@ -0,0 +1,115 @@
1
+ import { addPropertyControls, ControlType } from "framer";
2
+ import { ComponentType, useState } from "react";
3
+ import * as ADS from "https://www.unpkg.com/@ceed/ads@latest/framer";
4
+
5
+ export function Accordions(props) {
6
+ const { summaries, details, ...innerProps } = props;
7
+
8
+ return (
9
+ <ADS.ThemeProvider>
10
+ <ADS.Accordions
11
+ {...innerProps}
12
+ items={summaries?.map((summary, i) => ({
13
+ summary,
14
+ details: details[i],
15
+ }))}
16
+ />
17
+ </ADS.ThemeProvider>
18
+ );
19
+ }
20
+
21
+ addPropertyControls(Accordions, ADS.accordionsPropertyControls);
22
+
23
+ /**
24
+ * These annotations control how your component sizes
25
+ * Learn more: https://www.framer.com/docs/guides/auto-sizing
26
+ *
27
+ * @framerSupportedLayoutWidth auto
28
+ * @framerSupportedLayoutHeight auto
29
+ */
30
+ export function Avatar(props) {
31
+ const { text, image, ...innerProps } = props;
32
+ return (
33
+ <ADS.ThemeProvider>
34
+ <ADS.Avatar src={image?.src || image?.srcSet} {...innerProps}>
35
+ {text}
36
+ </ADS.Avatar>
37
+ </ADS.ThemeProvider>
38
+ );
39
+ }
40
+ addPropertyControls(Avatar, ADS.avatarPropertyControls);
41
+
42
+ export function Badge(props) {
43
+ return <ADS.Badge {...props} />;
44
+ }
45
+ addPropertyControls(Badge, ADS.badgePropertyControls);
46
+
47
+ /**
48
+ * These annotations control how your component sizes
49
+ * Learn more: https://www.framer.com/docs/guides/auto-sizing
50
+ *
51
+ */
52
+ export function Button(props) {
53
+ const { text, startDecorator, endDecorator, ...innerProps } = props;
54
+
55
+ return (
56
+ <ADS.ThemeProvider>
57
+ <ADS.Button
58
+ startDecorator={startDecorator[0]}
59
+ endDecorator={endDecorator[0]}
60
+ {...innerProps}
61
+ >
62
+ {text}
63
+ </ADS.Button>
64
+ </ADS.ThemeProvider>
65
+ );
66
+ }
67
+
68
+ addPropertyControls(Button, { ...ADS.buttonPropertyControls });
69
+
70
+ export function withModal(Component): ComponentType {
71
+ return (props) => {
72
+ const { modalContents, ...innerProps } = props;
73
+ const [open, setOpen] = useState(false);
74
+ return (
75
+ <>
76
+ <Component {...innerProps} onClick={() => setOpen(true)} />
77
+ {open && (
78
+ <ADS.Modal
79
+ open={open}
80
+ onClose={() => setOpen(false)}
81
+ // NOTE: Portal로 열면 framer 고유 컴포넌트 스타일이 적용 안됨
82
+ disablePortal
83
+ sx={{
84
+ display: "flex",
85
+ justifyContent: "center",
86
+ alignItems: "center",
87
+ }}
88
+ >
89
+ <div>{modalContents}</div>
90
+ </ADS.Modal>
91
+ )}
92
+ </>
93
+ );
94
+ };
95
+ }
96
+
97
+ export function withDrawer(Component): ComponentType {
98
+ return (props) => {
99
+ const { modalContents, ...innerProps } = props;
100
+ const [open, setOpen] = useState(false);
101
+ return (
102
+ <>
103
+ <Component {...innerProps} onClick={() => setOpen(true)} />
104
+ <ADS.InsetDrawer
105
+ open={open}
106
+ onClose={() => setOpen(false)}
107
+ // NOTE: Portal로 열면 framer 고유 컴포넌트 스타일이 적용 안됨
108
+ disablePortal
109
+ >
110
+ {modalContents}
111
+ </ADS.InsetDrawer>
112
+ </>
113
+ );
114
+ };
115
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ceed/ads",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "description": "UI tool for Ecube Labs front-end developers",
@@ -12,7 +12,8 @@
12
12
  },
13
13
  "files": [
14
14
  "dist",
15
- "framer"
15
+ "framer",
16
+ "framer-components.tsx"
16
17
  ],
17
18
  "author": "Ecube Labs",
18
19
  "sideEffects": false,