@ceed/ads 0.0.7 → 0.0.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.
@@ -1,8 +1,60 @@
1
1
  import React from "react";
2
2
  import { TableProps } from "@mui/joy";
3
- import { MotionProps } from "framer-motion";
4
3
  declare const Table: {
5
- (props: TableProps & MotionProps): React.JSX.Element;
4
+ (props: TableProps): React.JSX.Element;
6
5
  displayName: string;
7
6
  };
8
7
  export { Table };
8
+ interface HeadCell {
9
+ label: string;
10
+ numeric?: boolean;
11
+ width?: string;
12
+ }
13
+ declare function TableHead<D extends Record<string, unknown>>(props: {
14
+ headCells: HeadCell[];
15
+ /**
16
+ * Show Checkbox to select all rows
17
+ */
18
+ showCheckbox?: boolean;
19
+ onCheckboxChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
20
+ /**
21
+ * Inject custom component
22
+ */
23
+ slots?: {
24
+ checkbox?: React.ElementType;
25
+ };
26
+ slotProps?: {
27
+ checkbox?: Partial<{
28
+ checked: boolean;
29
+ indeterminate: boolean;
30
+ [key: string]: any;
31
+ }>;
32
+ };
33
+ }): React.JSX.Element;
34
+ declare namespace TableHead {
35
+ var displayName: string;
36
+ }
37
+ export { TableHead };
38
+ interface TableBodyProps<D extends Record<string, unknown>> {
39
+ rows: D[];
40
+ cellOrder: (keyof D)[];
41
+ rowOptions?: Partial<Record<keyof D, {
42
+ numeric?: boolean;
43
+ }>>;
44
+ showCheckbox?: boolean;
45
+ onCheckboxChange?: (event: React.ChangeEvent<HTMLInputElement>, rowIndex: number) => void;
46
+ slots?: {
47
+ checkbox?: React.ElementType;
48
+ };
49
+ slotProps?: {
50
+ checkbox?: Partial<{
51
+ checked: boolean;
52
+ [key: string]: any;
53
+ }>;
54
+ };
55
+ }
56
+ declare function TableBody<D extends Record<string, unknown>>(props: TableBodyProps<D>): React.JSX.Element;
57
+ declare namespace TableBody {
58
+ var displayName: string;
59
+ }
60
+ export { TableBody };
@@ -9,12 +9,23 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import React from "react";
13
24
  import { Table as JoyTable } from "@mui/joy";
14
- import { motion } from "framer-motion";
15
- var MotionTable = motion(JoyTable);
25
+ import Checkbox from "../Checkbox";
16
26
  var Table = function (props) {
17
27
  // prop destruction
28
+ var children = props.children, inheritProps = __rest(props, ["children"]);
18
29
  // lib hooks
19
30
  // state, ref, querystring hooks
20
31
  // form hooks
@@ -22,7 +33,55 @@ var Table = function (props) {
22
33
  // calculated values
23
34
  // effects
24
35
  // handlers
25
- return React.createElement(MotionTable, __assign({}, props));
36
+ return React.createElement(JoyTable, __assign({}, inheritProps), children);
26
37
  };
27
38
  export { Table };
28
39
  Table.displayName = "Table";
40
+ function TableHead(props) {
41
+ // prop destruction
42
+ var headCells = props.headCells, showCheckbox = props.showCheckbox, onCheckboxChange = props.onCheckboxChange, _a = props.slots, _b = _a === void 0 ? {} : _a, _c = _b.checkbox, RenderCheckbox = _c === void 0 ? Checkbox : _c, _d = props.slotProps, _e = _d === void 0 ? {} : _d, _f = _e.checkbox, checkboxProps = _f === void 0 ? {} : _f;
43
+ // lib hooks
44
+ // state, ref, querystring hooks
45
+ // form hooks
46
+ // query hooks
47
+ // calculated values
48
+ // effects
49
+ // handlers
50
+ return (React.createElement("thead", null,
51
+ React.createElement("tr", null,
52
+ showCheckbox && (React.createElement("th", { style: {
53
+ width: "40px",
54
+ textAlign: "center",
55
+ } },
56
+ React.createElement(RenderCheckbox, __assign({ onChange: onCheckboxChange }, checkboxProps)))),
57
+ headCells.map(function (headCell) { return (React.createElement("th", { key: headCell.label, style: {
58
+ width: headCell.width,
59
+ textAlign: headCell.numeric ? "right" : "left",
60
+ } }, headCell.label)); }))));
61
+ }
62
+ TableHead.displayName = "TableHead";
63
+ export { TableHead };
64
+ function TableBody(props) {
65
+ // prop destruction
66
+ var rows = props.rows, cellOrder = props.cellOrder, rowOptions = props.rowOptions, showCheckbox = props.showCheckbox, onCheckboxChange = props.onCheckboxChange, _a = props.slots, _b = _a === void 0 ? {} : _a, _c = _b.checkbox, RenderCheckbox = _c === void 0 ? Checkbox : _c, _d = props.slotProps, _e = _d === void 0 ? {} : _d, _f = _e.checkbox, checkboxProps = _f === void 0 ? {} : _f;
67
+ // lib hooks
68
+ // state, ref, querystring hooks
69
+ // form hooks
70
+ // query hooks
71
+ // calculated values
72
+ // effects
73
+ // handlers
74
+ return (React.createElement("tbody", null, rows.map(function (row, rowIndex) { return (React.createElement("tr", { key: rowIndex },
75
+ showCheckbox && (React.createElement("td", { style: {
76
+ textAlign: "center",
77
+ } },
78
+ React.createElement(RenderCheckbox, __assign({ onChange: function (event) { return onCheckboxChange === null || onCheckboxChange === void 0 ? void 0 : onCheckboxChange(event, rowIndex); } }, checkboxProps)))),
79
+ cellOrder.map(function (cellKey) {
80
+ var _a;
81
+ return (React.createElement("td", { key: cellKey, style: {
82
+ textAlign: ((_a = rowOptions === null || rowOptions === void 0 ? void 0 : rowOptions[cellKey]) === null || _a === void 0 ? void 0 : _a.numeric) ? "right" : "left",
83
+ } }, row[cellKey]));
84
+ }))); })));
85
+ }
86
+ TableBody.displayName = "TableBody";
87
+ export { TableBody };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  declare function ThemeProvider(props: {
3
3
  children?: React.ReactNode;
4
4
  }): React.JSX.Element;
@@ -1,7 +1,27 @@
1
- import React from 'react';
2
- import { CssBaseline, CssVarsProvider, extendTheme } from '@mui/joy';
1
+ import React from "react";
2
+ import { CssBaseline, CssVarsProvider, checkboxClasses, extendTheme, } from "@mui/joy";
3
3
  var defaultTheme = extendTheme({
4
- cssVarPrefix: 'ceed',
4
+ cssVarPrefix: "ceed",
5
+ components: {
6
+ JoyTable: {
7
+ defaultProps: {
8
+ size: "sm",
9
+ borderAxis: "bothBetween",
10
+ },
11
+ styleOverrides: {
12
+ root: function (_a) {
13
+ var _b;
14
+ var theme = _a.theme;
15
+ return (_b = {},
16
+ // "--TableRow-hoverBackground": theme.palette.primary.outlinedHoverBg,
17
+ _b["& .".concat(checkboxClasses.root)] = {
18
+ verticalAlign: "middle",
19
+ },
20
+ _b);
21
+ },
22
+ },
23
+ },
24
+ },
5
25
  });
6
26
  function ThemeProvider(props) {
7
27
  return (React.createElement(React.Fragment, null,
@@ -10,4 +30,4 @@ function ThemeProvider(props) {
10
30
  props.children)));
11
31
  }
12
32
  export { ThemeProvider };
13
- ThemeProvider.displayName = 'ThemeProvider';
33
+ ThemeProvider.displayName = "ThemeProvider";
@@ -19,7 +19,7 @@ export { Select, Option } from "./Select";
19
19
  export { Sheet } from "./Sheet";
20
20
  export { Stack } from "./Stack";
21
21
  export { Switch } from "./Switch";
22
- export { Table } from "./Table";
22
+ export { Table, TableHead, TableBody } from "./Table";
23
23
  export { Textarea } from "./Textarea";
24
24
  export { ThemeProvider } from "./ThemeProvider";
25
25
  export { Tooltip } from "./Tooltip";
@@ -19,7 +19,7 @@ export { Select, Option } from "./Select";
19
19
  export { Sheet } from "./Sheet";
20
20
  export { Stack } from "./Stack";
21
21
  export { Switch } from "./Switch";
22
- export { Table } from "./Table";
22
+ export { Table, TableHead, TableBody } from "./Table";
23
23
  export { Textarea } from "./Textarea";
24
24
  export { ThemeProvider } from "./ThemeProvider";
25
25
  export { Tooltip } from "./Tooltip";
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { boxClasses, buttonClasses, checkboxClasses, dividerClasses, iconButtonClasses, inputClasses, menuClasses, menuButtonClasses, menuItemClasses, optionClasses, radioClasses, radioGroupClasses, selectClasses, switchClasses, tableClasses, textareaClasses, typographyClasses, formControlClasses, formLabelClasses, formHelperTextClasses, gridClasses, stackClasses, sheetClasses, modalClasses, modalCloseClasses, modalDialogClasses, modalOverflowClasses, dialogTitleClasses, dialogContentClasses, dialogActionsClasses, tooltipClasses, Avatar, avatarClasses, AvatarGroup, avatarGroupClasses, Chip, chipClasses, } from "@mui/joy";
2
- export { Box, Button, Checkbox, DialogActions, DialogContent, DialogTitle, Divider, Dropdown, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Menu, Modal, ModalClose, ModalDialog, ModalOverflow, Radio, RadioGroup, Select, Option, Sheet, Stack, Switch, Table, Textarea, ThemeProvider, Tooltip, Typography, } from "./components";
2
+ export { Box, Button, Checkbox, DialogActions, DialogContent, DialogTitle, Divider, Dropdown, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Menu, Modal, ModalClose, ModalDialog, ModalOverflow, Radio, RadioGroup, Select, Option, Sheet, Stack, Switch, Table, TableHead, TableBody, Textarea, ThemeProvider, Tooltip, Typography, } from "./components";
package/dist/index.js CHANGED
@@ -3,4 +3,4 @@ export {
3
3
  boxClasses, buttonClasses, checkboxClasses, dividerClasses, iconButtonClasses, inputClasses, menuClasses, menuButtonClasses, menuItemClasses, optionClasses, radioClasses, radioGroupClasses, selectClasses, switchClasses, tableClasses, textareaClasses, typographyClasses, formControlClasses, formLabelClasses, formHelperTextClasses, gridClasses, stackClasses, sheetClasses, modalClasses, modalCloseClasses, modalDialogClasses, modalOverflowClasses, dialogTitleClasses, dialogContentClasses, dialogActionsClasses, tooltipClasses,
4
4
  // Pure JoyUI
5
5
  Avatar, avatarClasses, AvatarGroup, avatarGroupClasses, Chip, chipClasses, } from "@mui/joy";
6
- export { Box, Button, Checkbox, DialogActions, DialogContent, DialogTitle, Divider, Dropdown, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Menu, Modal, ModalClose, ModalDialog, ModalOverflow, Radio, RadioGroup, Select, Option, Sheet, Stack, Switch, Table, Textarea, ThemeProvider, Tooltip, Typography, } from "./components";
6
+ export { Box, Button, Checkbox, DialogActions, DialogContent, DialogTitle, Divider, Dropdown, FormControl, FormHelperText, FormLabel, Grid, IconButton, Input, Menu, Modal, ModalClose, ModalDialog, ModalOverflow, Radio, RadioGroup, Select, Option, Sheet, Stack, Switch, Table, TableHead, TableBody, Textarea, ThemeProvider, Tooltip, Typography, } from "./components";
package/framer/index.js CHANGED
@@ -24372,6 +24372,9 @@ var Checkbox3 = (props) => {
24372
24372
  };
24373
24373
  Checkbox3.displayName = "Checkbox";
24374
24374
 
24375
+ // src/components/Checkbox/index.ts
24376
+ var Checkbox_default2 = Checkbox3;
24377
+
24375
24378
  // src/components/DialogActions/DialogActions.tsx
24376
24379
  import { motion as motion4 } from "framer-motion";
24377
24380
  var MotionDialogActions = motion4(DialogActions_default);
@@ -24549,16 +24552,87 @@ var Switch3 = (props) => {
24549
24552
  Switch3.displayName = "Switch";
24550
24553
 
24551
24554
  // src/components/Table/Table.tsx
24552
- import { motion as motion22 } from "framer-motion";
24553
- var MotionTable = motion22(Table_default);
24554
24555
  var Table3 = (props) => {
24555
- return /* @__PURE__ */ jsx2(MotionTable, { ...props });
24556
+ const { children, ...inheritProps } = props;
24557
+ return /* @__PURE__ */ jsx2(Table_default, { ...inheritProps, children });
24556
24558
  };
24557
24559
  Table3.displayName = "Table";
24560
+ function TableHead(props) {
24561
+ const {
24562
+ headCells,
24563
+ showCheckbox,
24564
+ onCheckboxChange,
24565
+ slots: { checkbox: RenderCheckbox = Checkbox_default2 } = {},
24566
+ slotProps: { checkbox: checkboxProps = {} } = {}
24567
+ } = props;
24568
+ return /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsxs2("tr", { children: [
24569
+ showCheckbox && /* @__PURE__ */ jsx2(
24570
+ "th",
24571
+ {
24572
+ style: {
24573
+ width: "40px",
24574
+ textAlign: "center"
24575
+ },
24576
+ children: /* @__PURE__ */ jsx2(RenderCheckbox, { onChange: onCheckboxChange, ...checkboxProps })
24577
+ }
24578
+ ),
24579
+ headCells.map((headCell) => /* @__PURE__ */ jsx2(
24580
+ "th",
24581
+ {
24582
+ style: {
24583
+ width: headCell.width,
24584
+ textAlign: headCell.numeric ? "right" : "left"
24585
+ },
24586
+ children: headCell.label
24587
+ },
24588
+ headCell.label
24589
+ ))
24590
+ ] }) });
24591
+ }
24592
+ TableHead.displayName = "TableHead";
24593
+ function TableBody(props) {
24594
+ const {
24595
+ rows,
24596
+ cellOrder,
24597
+ rowOptions,
24598
+ showCheckbox,
24599
+ onCheckboxChange,
24600
+ slots: { checkbox: RenderCheckbox = Checkbox_default2 } = {},
24601
+ slotProps: { checkbox: checkboxProps = {} } = {}
24602
+ } = props;
24603
+ return /* @__PURE__ */ jsx2("tbody", { children: rows.map((row, rowIndex) => /* @__PURE__ */ jsxs2("tr", { children: [
24604
+ showCheckbox && /* @__PURE__ */ jsx2(
24605
+ "td",
24606
+ {
24607
+ style: {
24608
+ textAlign: "center"
24609
+ },
24610
+ children: /* @__PURE__ */ jsx2(
24611
+ RenderCheckbox,
24612
+ {
24613
+ onChange: (event) => onCheckboxChange?.(event, rowIndex),
24614
+ ...checkboxProps
24615
+ }
24616
+ )
24617
+ }
24618
+ ),
24619
+ cellOrder.map((cellKey) => /* @__PURE__ */ jsx2(
24620
+ "td",
24621
+ {
24622
+ style: {
24623
+ textAlign: rowOptions?.[cellKey]?.numeric ? "right" : "left"
24624
+ },
24625
+ children: row[cellKey]
24626
+ },
24627
+ cellKey
24628
+ ))
24629
+ ] }, rowIndex)) });
24630
+ }
24631
+ TableBody.displayName = "TableBody";
24558
24632
 
24559
24633
  // src/components/Textarea/Textarea.tsx
24560
- import { motion as motion23 } from "framer-motion";
24561
- var MotionTextarea = motion23(Textarea_default);
24634
+ import { motion as motion22 } from "framer-motion";
24635
+ var MotionTextarea = motion22(Textarea_default);
24562
24636
  var Textarea3 = (props) => {
24563
24637
  return /* @__PURE__ */ jsx2(MotionTextarea, { ...props });
24564
24638
  };
@@ -24566,7 +24640,23 @@ Textarea3.displayName = "Textarea";
24566
24640
 
24567
24641
  // src/components/ThemeProvider/ThemeProvider.tsx
24568
24642
  var defaultTheme4 = extendTheme({
24569
- cssVarPrefix: "ceed"
24643
+ cssVarPrefix: "ceed",
24644
+ components: {
24645
+ JoyTable: {
24646
+ defaultProps: {
24647
+ size: "sm",
24648
+ borderAxis: "bothBetween"
24649
+ },
24650
+ styleOverrides: {
24651
+ root: ({ theme }) => ({
24652
+ // "--TableRow-hoverBackground": theme.palette.primary.outlinedHoverBg,
24653
+ [`& .${checkboxClasses_default.root}`]: {
24654
+ verticalAlign: "middle"
24655
+ }
24656
+ })
24657
+ }
24658
+ }
24659
+ }
24570
24660
  });
24571
24661
  function ThemeProvider4(props) {
24572
24662
  return /* @__PURE__ */ jsx2(Fragment12, { children: /* @__PURE__ */ jsxs2(CssVarsProvider, { theme: defaultTheme4, children: [
@@ -24577,16 +24667,16 @@ function ThemeProvider4(props) {
24577
24667
  ThemeProvider4.displayName = "ThemeProvider";
24578
24668
 
24579
24669
  // src/components/Tooltip/Tooltip.tsx
24580
- import { motion as motion24 } from "framer-motion";
24581
- var MotionTooltip = motion24(Tooltip_default);
24670
+ import { motion as motion23 } from "framer-motion";
24671
+ var MotionTooltip = motion23(Tooltip_default);
24582
24672
  var Tooltip3 = (props) => {
24583
24673
  return /* @__PURE__ */ jsx2(MotionTooltip, { ...props });
24584
24674
  };
24585
24675
  Tooltip3.displayName = "Tooltip";
24586
24676
 
24587
24677
  // src/components/Typography/Typography.tsx
24588
- import { motion as motion25 } from "framer-motion";
24589
- var MotionTypography = motion25(Typography_default);
24678
+ import { motion as motion24 } from "framer-motion";
24679
+ var MotionTypography = motion24(Typography_default);
24590
24680
  var Typography3 = (props) => {
24591
24681
  return /* @__PURE__ */ jsx2(MotionTypography, { ...props });
24592
24682
  };
@@ -24622,6 +24712,8 @@ export {
24622
24712
  Stack2 as Stack,
24623
24713
  Switch3 as Switch,
24624
24714
  Table3 as Table,
24715
+ TableBody,
24716
+ TableHead,
24625
24717
  Textarea3 as Textarea,
24626
24718
  ThemeProvider4 as ThemeProvider,
24627
24719
  Tooltip3 as Tooltip,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ceed/ads",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "description": "UI tool for Ecube Labs front-end developers",
@@ -42,14 +42,10 @@
42
42
  "@storybook/react-webpack5": "^7.6.13",
43
43
  "@storybook/test": "^7.6.13",
44
44
  "@storybook/theming": "^7.6.13",
45
- "@types/tmp": "^0",
46
45
  "esbuild": "^0.20.1",
47
- "postcss": "^8.4.35",
48
- "postcss-modules": "^6.0.0",
49
46
  "react": "^18.2.0",
50
47
  "react-dom": "^18.2.0",
51
48
  "storybook": "^7.6.13",
52
- "tmp": "^0.2.1",
53
49
  "typescript": "^5.3.3"
54
50
  },
55
51
  "repository": {