@taiv/ui 1.10.0 → 1.10.2

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.
@@ -7,10 +7,11 @@ export interface FormModalProps {
7
7
  children?: React.ReactNode;
8
8
  size?: string | number;
9
9
  modalVariant?: keyof typeof modalVariants;
10
+ confirmButtonDisabled?: boolean;
10
11
  onCancel?: () => void;
11
12
  onConfirm?: () => void;
12
13
  cancelLabel?: string;
13
14
  confirmLabel?: string;
14
15
  }
15
- export declare const FormModal: ({ opened, onClose, icon, children, size, modalVariant, onCancel, onConfirm, cancelLabel, confirmLabel, }: FormModalProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const FormModal: ({ opened, onClose, icon, children, size, modalVariant, confirmButtonDisabled, onCancel, onConfirm, cancelLabel, confirmLabel, }: FormModalProps) => import("react/jsx-runtime").JSX.Element;
16
17
  //# sourceMappingURL=FormModal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Modals/FormModal/FormModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,SAAS,GAAI,0GAWvB,cAAc,4CA+FhB,CAAC"}
1
+ {"version":3,"file":"FormModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Modals/FormModal/FormModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;IAC1C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,SAAS,GAAI,iIAYvB,cAAc,4CAgGhB,CAAC"}
@@ -7,7 +7,7 @@ import { Center } from "../../../Layout/Center/Center";
7
7
  import { modalVariants } from "../variants";
8
8
  import { Group } from "../../../Layout/Group/Group";
9
9
  import { Button } from "../../../Inputs/Buttons/Button/Button";
10
- export const FormModal = ({ opened, onClose, icon, children, size = "40rem", modalVariant = "info", onCancel, onConfirm, cancelLabel, confirmLabel, }) => {
10
+ export const FormModal = ({ opened, onClose, icon, children, size = "40rem", modalVariant = "info", confirmButtonDisabled = false, onCancel, onConfirm, cancelLabel, confirmLabel, }) => {
11
11
  const selectedVariant = modalVariants[modalVariant];
12
12
  const iconContainer = {
13
13
  width: "4.2rem",
@@ -55,5 +55,5 @@ export const FormModal = ({ opened, onClose, icon, children, size = "40rem", mod
55
55
  body: {
56
56
  padding: "0 3.2rem 1.6rem 3.2rem",
57
57
  },
58
- }, children: _jsx(Center, { h: "100%", w: "100%", children: _jsxs(Stack, { gap: "2rem", h: "100%", w: "100%", align: "center", children: [_jsxs(Stack, { gap: "1.5rem", align: "center", children: [_jsx(Center, { style: iconContainer, children: modalIcon }), children && (_jsx(Stack, { gap: "0.25rem", align: "center", children: children }))] }), _jsx(Center, { h: "100%", w: "100%", children: _jsxs(Group, { gap: "1rem", align: "center", children: [_jsx(Button, { onClick: onCancel, variant: "secondary", children: cancelLabel || selectedVariant.cancelLabel }), _jsx(Button, { onClick: onConfirm, variant: selectedVariant.buttonVariant, children: confirmLabel || selectedVariant.confirmLabel })] }) })] }) }) }));
58
+ }, children: _jsx(Center, { h: "100%", w: "100%", children: _jsxs(Stack, { gap: "2rem", h: "100%", w: "100%", align: "center", children: [_jsxs(Stack, { gap: "1.5rem", align: "center", children: [_jsx(Center, { style: iconContainer, children: modalIcon }), children && (_jsx(Stack, { gap: "0.25rem", align: "center", children: children }))] }), _jsx(Center, { h: "100%", w: "100%", children: _jsxs(Group, { gap: "1rem", align: "center", children: [_jsx(Button, { onClick: onCancel, variant: "secondary", children: cancelLabel || selectedVariant.cancelLabel }), _jsx(Button, { onClick: onConfirm, variant: selectedVariant.buttonVariant, disabled: confirmButtonDisabled, children: confirmLabel || selectedVariant.confirmLabel })] }) })] }) }) }));
59
59
  };
@@ -10,5 +10,6 @@ export declare const WithTextInput: Story;
10
10
  export declare const Variants: Story;
11
11
  export declare const Sizes: Story;
12
12
  export declare const CustomLabels: Story;
13
+ export declare const ConfirmButtonDisabled: Story;
13
14
  export declare const CompleteExample: Story;
14
15
  //# sourceMappingURL=FormModal.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormModal.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Modals/FormModal/FormModal.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,E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AE,KAyCnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAwB1B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAgCnC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAwC7B,CAAC"}
@@ -62,6 +62,13 @@ const meta = {
62
62
  defaultValue: { summary: "'info'" },
63
63
  },
64
64
  },
65
+ confirmButtonDisabled: {
66
+ control: false,
67
+ description: "Whether the modal confirm button is disabled.",
68
+ table: {
69
+ type: { summary: "boolean" },
70
+ },
71
+ },
65
72
  onCancel: {
66
73
  control: false,
67
74
  description: "Handler for the cancel button click.",
@@ -178,6 +185,13 @@ export const CustomLabels = {
178
185
  return (_jsxs(_Fragment, { children: [_jsx(Center, { children: _jsx(Button, { onClick: () => setOpened(true), children: "Open FormModal" }) }), _jsx(FormModal, { opened: opened, onClose: () => setOpened(false), onCancel: () => setOpened(false), onConfirm: () => setOpened(false), cancelLabel: "No, go back", confirmLabel: "Yes, continue", children: _jsx(Title, { variant: "cardSubheader", align: "center", children: "Custom cancel and confirm button labels." }) })] }));
179
186
  },
180
187
  };
188
+ export const ConfirmButtonDisabled = {
189
+ render: () => {
190
+ const [opened, setOpened] = useState(false);
191
+ const [name, setName] = useState("");
192
+ return (_jsxs(_Fragment, { children: [_jsx(Center, { children: _jsx(Button, { onClick: () => setOpened(true), children: "Open FormModal" }) }), _jsx(FormModal, { opened: opened, onClose: () => setOpened(false), onCancel: () => setOpened(false), onConfirm: () => setOpened(false), confirmButtonDisabled: name.trim().length === 0, children: _jsxs(Stack, { gap: "1rem", align: "center", children: [_jsx(Title, { variant: "cardSubheader", align: "center", children: "Enter your name to enable the confirm button." }), _jsx(TextInput, { label: "Name", placeholder: "Enter your name", value: name, onChange: (e) => setName(e.target.value) })] }) })] }));
193
+ },
194
+ };
181
195
  export const CompleteExample = {
182
196
  render: () => {
183
197
  const [opened, setOpened] = useState(false);
@@ -11,7 +11,8 @@ interface TableProps<T> {
11
11
  }>;
12
12
  placeholder?: React.ReactNode;
13
13
  shadow?: boolean;
14
+ divider?: boolean;
14
15
  }
15
- declare const Table: <T>({ columnConfigs, data, ListItem, placeholder, shadow }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
16
+ declare const Table: <T>({ columnConfigs, data, ListItem, placeholder, shadow, divider }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
16
17
  export { Table, type ColumnConfig, type TableProps };
17
18
  //# sourceMappingURL=Table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAqB,MAAM,OAAO,CAAC;AAIhE,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,UAAU,UAAU,CAAC,CAAC;IACpB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,KAAK,GAAI,CAAC,EAAG,wDAAgE,UAAU,CAAC,CAAC,CAAC,4CAsE/F,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAqB,MAAM,OAAO,CAAC;AAIhE,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,UAAU,UAAU,CAAC,CAAC;IACpB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,KAAK,GAAI,CAAC,EAAG,iEAAgF,UAAU,CAAC,CAAC,CAAC,4CA4E/G,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,CAAC"}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef } from 'react';
3
3
  import { Box } from '../Box/Box';
4
4
  import { fontWeight, neutral } from '../../../constants';
5
- const Table = ({ columnConfigs, data, ListItem, placeholder, shadow = false }) => {
5
+ const Table = ({ columnConfigs, data, ListItem, placeholder, shadow = false, divider = true }) => {
6
6
  const tableRef = useRef(null);
7
7
  /**
8
8
  * Apply column styles to the table cells.
@@ -17,7 +17,7 @@ const Table = ({ columnConfigs, data, ListItem, placeholder, shadow = false }) =
17
17
  const rows = tbody.querySelectorAll('tr');
18
18
  if (!rows || !rows.length)
19
19
  return;
20
- rows.forEach((row) => {
20
+ rows.forEach((row, rowIndex) => {
21
21
  const cells = row.querySelectorAll('td');
22
22
  cells.forEach((cell, columnIndex) => {
23
23
  var _a;
@@ -26,8 +26,11 @@ const Table = ({ columnConfigs, data, ListItem, placeholder, shadow = false }) =
26
26
  Object.assign(cell.style, columnStyle);
27
27
  }
28
28
  });
29
+ const showDivider = divider && rowIndex < rows.length - 1;
30
+ const borderStyle = { borderBottom: showDivider ? `1px solid ${neutral[100]}` : 'none' };
31
+ Object.assign(row.style, borderStyle);
29
32
  });
30
- }, [columnConfigs, data]);
33
+ }, [columnConfigs, data, divider]);
31
34
  return (_jsx(Box, { sx: {
32
35
  borderTopLeftRadius: '8px',
33
36
  borderTopRightRadius: '8px',
@@ -35,6 +38,7 @@ const Table = ({ columnConfigs, data, ListItem, placeholder, shadow = false }) =
35
38
  overflow: 'hidden',
36
39
  }, children: _jsxs("table", { ref: tableRef, style: {
37
40
  width: '100%',
41
+ borderCollapse: 'collapse',
38
42
  }, children: [_jsx("thead", { children: _jsx("tr", { children: columnConfigs.map((column, index) => (_jsx("th", { style: {
39
43
  backgroundColor: neutral[50],
40
44
  color: neutral[300],
@@ -10,4 +10,5 @@ export declare const StyledColumns: Story;
10
10
  export declare const TableWithPlaceholder: Story;
11
11
  export declare const TableWithoutPlaceholder: Story;
12
12
  export declare const TableWithShadow: Story;
13
+ export declare const TableWithoutDivider: Story;
13
14
  //# sourceMappingURL=Table.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Table/Table.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAUhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAyB5B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAyPnC,eAAO,MAAM,UAAU,EAAE,KAmBxB,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KAqBvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAoBnC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAmB3B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAsBlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAerC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAa7B,CAAC"}
1
+ {"version":3,"file":"Table.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Table/Table.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAUhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CA6B5B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAyPnC,eAAO,MAAM,UAAU,EAAE,KAmBxB,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KAqBvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAoBnC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAmB3B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAsBlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAerC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAa7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAajC,CAAC"}
@@ -31,6 +31,10 @@ const meta = {
31
31
  control: { type: 'boolean' },
32
32
  description: 'Adds shadow to the table',
33
33
  },
34
+ divider: {
35
+ control: { type: 'boolean' },
36
+ description: 'Adds divider between rows to the table',
37
+ },
34
38
  },
35
39
  };
36
40
  export default meta;
@@ -314,3 +318,17 @@ export const TableWithShadow = {
314
318
  shadow: true,
315
319
  },
316
320
  };
321
+ export const TableWithoutDivider = {
322
+ args: {
323
+ columnConfigs: [
324
+ { heading: 'Name', style: { width: '25%', paddingLeft: '20px', fontWeight: '600' } },
325
+ { heading: 'Email', style: { width: '30%', textAlign: 'left' } },
326
+ { heading: 'Role', style: { width: '20%', textAlign: 'center' } },
327
+ { heading: 'Status', style: { width: '15%', textAlign: 'center' } },
328
+ { heading: 'Last Login', style: { width: '10%', textAlign: 'right', paddingRight: '20px' } },
329
+ ],
330
+ data: userData,
331
+ ListItem: UserListItem,
332
+ divider: false,
333
+ },
334
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiv/ui",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "author": "Taiv",
5
5
  "description": "Taiv's web UI Toolkit built on Mantine v6",
6
6
  "main": "dist/index.js",