mainstack-design-system 1.12.0 → 1.12.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.
package/dist/index.d.ts CHANGED
@@ -9417,7 +9417,7 @@ declare interface TableBodyProps extends React.ComponentPropsWithoutRef<"tbody">
9417
9417
  }
9418
9418
 
9419
9419
  export declare const TableCell: {
9420
- ({ isSticky, className, ...props }: TableCellProps): JSX.Element;
9420
+ ({ isSticky, stickySide, className, ...props }: TableCellProps): JSX.Element;
9421
9421
  displayName: string;
9422
9422
  };
9423
9423
 
@@ -9436,6 +9436,7 @@ declare interface TableCellLabelProps extends React_2.HTMLAttributes<HTMLDivElem
9436
9436
 
9437
9437
  declare interface TableCellProps extends React.ComponentPropsWithoutRef<"td"> {
9438
9438
  isSticky?: boolean;
9439
+ stickySide?: "left" | "right";
9439
9440
  }
9440
9441
 
9441
9442
  export declare const TableGroup: {
@@ -9452,7 +9453,7 @@ export declare const TableGroup: {
9452
9453
  displayName: string;
9453
9454
  };
9454
9455
  Cell: {
9455
- ({ isSticky, className, ...props }: TableCellProps): JSX.Element;
9456
+ ({ isSticky, stickySide, className, ...props }: TableCellProps): JSX.Element;
9456
9457
  displayName: string;
9457
9458
  };
9458
9459
  CellLable: ForwardRefExoticComponent<TableCellLabelProps & RefAttributes<HTMLDivElement>>;
@@ -9466,7 +9467,7 @@ export declare const TableGroup: {
9466
9467
  displayName: string;
9467
9468
  };
9468
9469
  Head: {
9469
- ({ isSticky, className, ...props }: TableHeadProps): JSX.Element;
9470
+ ({ isSticky, stickySide, className, ...props }: TableHeadProps): JSX.Element;
9470
9471
  displayName: string;
9471
9472
  };
9472
9473
  Pagination: {
@@ -9476,7 +9477,7 @@ export declare const TableGroup: {
9476
9477
  };
9477
9478
 
9478
9479
  export declare const TableHead: {
9479
- ({ isSticky, className, ...props }: TableHeadProps): JSX.Element;
9480
+ ({ isSticky, stickySide, className, ...props }: TableHeadProps): JSX.Element;
9480
9481
  displayName: string;
9481
9482
  };
9482
9483
 
@@ -9490,6 +9491,7 @@ declare interface TableHeaderProps extends React.ComponentPropsWithoutRef<"thead
9490
9491
 
9491
9492
  declare interface TableHeadProps extends React.ComponentPropsWithoutRef<"th"> {
9492
9493
  isSticky?: boolean;
9494
+ stickySide?: "left" | "right";
9493
9495
  }
9494
9496
 
9495
9497
  export declare const TablePagination: {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),v=require("./utils-sX9NhwD-.cjs"),l=require("react"),R=require("./mainstack-design-system600.cjs"),c=({className:i,...u})=>{const s=l.useRef(null),[a,r]=l.useState(!1),[m,f]=l.useState(!1);return l.useEffect(()=>{const t=s.current;if(!t)return;let e;const o=()=>{r(!0),e&&clearTimeout(e),e=setTimeout(()=>r(!1),150);const{scrollTop:d,scrollHeight:T,clientHeight:b}=t;f(d+b>=T-1)};return t.addEventListener("scroll",o),o(),()=>{t.removeEventListener("scroll",o),e&&clearTimeout(e)}},[]),n.jsx(R.TableContext.Provider,{value:{isScrolling:a,atBottom:m},children:n.jsx("div",{ref:s,className:v.cn("mds:w-full mds:mx-auto ",i),...u})})};c.displayName="TableRoot";exports.TableRoot=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),w=require("./utils-sX9NhwD-.cjs"),e=require("react"),E=require("./mainstack-design-system600.cjs"),a=({className:c,...u})=>{const[t,l]=e.useState(null),[d,r]=e.useState(!1),[m,f]=e.useState(!1),[v,S]=e.useState(!0),[T,b]=e.useState(!1);return e.useEffect(()=>{if(!t)return;let s;const o=()=>{r(!0),s&&clearTimeout(s),s=setTimeout(()=>r(!1),150);const{scrollTop:g,scrollHeight:h,clientHeight:L,scrollLeft:n,scrollWidth:R,clientWidth:x}=t;f(g+L>=h-1),S(n<=2),b(n+x>=R-2)};return t.addEventListener("scroll",o),window.addEventListener("resize",o),o(),()=>{t.removeEventListener("scroll",o),window.removeEventListener("resize",o),s&&clearTimeout(s)}},[t]),i.jsx(E.TableContext.Provider,{value:{isScrolling:d,atBottom:m,atLeft:v,atRight:T,setScrollContainer:l},children:i.jsx("div",{ref:l,className:w.cn("mds:w-full mds:mx-auto mds:relative",c),...u})})};a.displayName="TableRoot";exports.TableRoot=a;
@@ -1,31 +1,45 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { c as T } from "./utils-BuJ7DVbu.js";
3
- import { useRef as v, useState as c, useEffect as g } from "react";
4
- import { TableContext as h } from "./mainstack-design-system600.js";
5
- const x = ({ className: i, ...n }) => {
6
- const l = v(null), [m, r] = c(!1), [a, f] = c(!1);
7
- return g(() => {
8
- const t = l.current;
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { c as S } from "./utils-BuJ7DVbu.js";
3
+ import { useState as r, useEffect as x } from "react";
4
+ import { TableContext as R } from "./mainstack-design-system600.js";
5
+ const b = ({ className: c, ...a }) => {
6
+ const [t, l] = r(
7
+ null
8
+ ), [m, s] = r(!1), [f, d] = r(!1), [u, v] = r(!0), [h, p] = r(!1);
9
+ return x(() => {
9
10
  if (!t) return;
10
11
  let e;
11
12
  const o = () => {
12
- r(!0), e && clearTimeout(e), e = setTimeout(() => r(!1), 150);
13
- const { scrollTop: u, scrollHeight: d, clientHeight: p } = t;
14
- f(u + p >= d - 1);
13
+ s(!0), e && clearTimeout(e), e = setTimeout(() => s(!1), 150);
14
+ const {
15
+ scrollTop: L,
16
+ scrollHeight: T,
17
+ clientHeight: g,
18
+ scrollLeft: i,
19
+ scrollWidth: w,
20
+ clientWidth: E
21
+ } = t;
22
+ d(L + g >= T - 1), v(i <= 2), p(i + E >= w - 2);
15
23
  };
16
- return t.addEventListener("scroll", o), o(), () => {
17
- t.removeEventListener("scroll", o), e && clearTimeout(e);
24
+ return t.addEventListener("scroll", o), window.addEventListener("resize", o), o(), () => {
25
+ t.removeEventListener("scroll", o), window.removeEventListener("resize", o), e && clearTimeout(e);
18
26
  };
19
- }, []), /* @__PURE__ */ s(h.Provider, { value: { isScrolling: m, atBottom: a }, children: /* @__PURE__ */ s(
20
- "div",
27
+ }, [t]), /* @__PURE__ */ n(
28
+ R.Provider,
21
29
  {
22
- ref: l,
23
- className: T("mds:w-full mds:mx-auto ", i),
24
- ...n
30
+ value: { isScrolling: m, atBottom: f, atLeft: u, atRight: h, setScrollContainer: l },
31
+ children: /* @__PURE__ */ n(
32
+ "div",
33
+ {
34
+ ref: l,
35
+ className: S("mds:w-full mds:mx-auto mds:relative", c),
36
+ ...a
37
+ }
38
+ )
25
39
  }
26
- ) });
40
+ );
27
41
  };
28
- x.displayName = "TableRoot";
42
+ b.displayName = "TableRoot";
29
43
  export {
30
- x as TableRoot
44
+ b as TableRoot
31
45
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./utils-sX9NhwD-.cjs"),t=({className:s,...r})=>e.jsx("div",{"data-slot":"table-container",className:a.cn("mds:overflow-auto mds:md:border mds:md:border-border-interactive-neutral mds:rounded-20 mds:sm:justify-center",s),children:e.jsx("table",{"data-slot":"table",className:"mds:text-left mds:w-full",...r})});t.displayName="Table";exports.Table=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./utils-sX9NhwD-.cjs"),o=require("./mainstack-design-system600.cjs"),t=({className:s,...l})=>{const{setScrollContainer:r}=o.useTableScroll();return e.jsx("div",{"data-slot":"table-container",ref:r,className:a.cn("mds:overflow-auto mds:md:border mds:md:border-border-interactive-neutral mds:rounded-20 mds:sm:justify-center",s),children:e.jsx("table",{"data-slot":"table",className:"mds:text-left mds:w-full",...l})})};t.displayName="Table";exports.Table=t;
@@ -1,24 +1,29 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { c as r } from "./utils-BuJ7DVbu.js";
3
- const d = ({ className: t, ...a }) => /* @__PURE__ */ e(
4
- "div",
5
- {
6
- "data-slot": "table-container",
7
- className: r(
8
- "mds:overflow-auto mds:md:border mds:md:border-border-interactive-neutral mds:rounded-20 mds:sm:justify-center",
9
- t
10
- ),
11
- children: /* @__PURE__ */ e(
12
- "table",
13
- {
14
- "data-slot": "table",
15
- className: "mds:text-left mds:w-full",
16
- ...a
17
- }
18
- )
19
- }
20
- );
21
- d.displayName = "Table";
2
+ import { c as o } from "./utils-BuJ7DVbu.js";
3
+ import { useTableScroll as s } from "./mainstack-design-system600.js";
4
+ const l = ({ className: r, ...t }) => {
5
+ const { setScrollContainer: a } = s();
6
+ return /* @__PURE__ */ e(
7
+ "div",
8
+ {
9
+ "data-slot": "table-container",
10
+ ref: a,
11
+ className: o(
12
+ "mds:overflow-auto mds:md:border mds:md:border-border-interactive-neutral mds:rounded-20 mds:sm:justify-center",
13
+ r
14
+ ),
15
+ children: /* @__PURE__ */ e(
16
+ "table",
17
+ {
18
+ "data-slot": "table",
19
+ className: "mds:text-left mds:w-full",
20
+ ...t
21
+ }
22
+ )
23
+ }
24
+ );
25
+ };
26
+ l.displayName = "Table";
22
27
  export {
23
- d as Table
28
+ l as Table
24
29
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),d=require("./utils-sX9NhwD-.cjs"),l=({isSticky:e,className:s,...t})=>a.jsx("td",{role:"cell","data-slot":"table-cell","data-sticky-cell":e,className:d.cn("mds:p-12 mds:body-extrasmall-regular",e?"mds:md:sticky mds:md:left-0 mds:md:bg-surface-neutral-l1 mds:md:z-10":"",s),...t});l.displayName="TableCell";exports.TableCell=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),r=require("./utils-sX9NhwD-.cjs"),n=require("./mainstack-design-system600.cjs"),t=({isSticky:e,stickySide:l="left",className:a,...s})=>{const{atLeft:d,atRight:o}=n.useTableScroll();return m.jsx("td",{role:"cell","data-slot":"table-cell","data-sticky-cell":e,className:r.cn("mds:p-12 mds:body-extrasmall-regular mds:transition-shadow mds:duration-200",e&&"mds:md:sticky mds:md:bg-surface-neutral-l1 mds:md:z-10",e&&l==="left"&&"mds:md:left-0",e&&l==="right"&&"mds:md:right-0",e&&l==="left"&&(d?"mds:shadow-none":"mds:shadow-100"),e&&l==="right"&&(o?"mds:shadow-none":"mds:shadow-100"),a),...s})};t.displayName="TableCell";exports.TableCell=t;
@@ -1,24 +1,33 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { c as s } from "./utils-BuJ7DVbu.js";
3
- const d = ({
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { c as t } from "./utils-BuJ7DVbu.js";
3
+ import { useTableScroll as r } from "./mainstack-design-system600.js";
4
+ const n = ({
4
5
  isSticky: l,
5
- className: e,
6
- ...a
7
- }) => /* @__PURE__ */ m(
8
- "td",
9
- {
10
- role: "cell",
11
- "data-slot": "table-cell",
12
- "data-sticky-cell": l,
13
- className: s(
14
- "mds:p-12 mds:body-extrasmall-regular",
15
- l ? "mds:md:sticky mds:md:left-0 mds:md:bg-surface-neutral-l1 mds:md:z-10" : "",
16
- e
17
- ),
18
- ...a
19
- }
20
- );
21
- d.displayName = "TableCell";
6
+ stickySide: a = "left",
7
+ className: m,
8
+ ...d
9
+ }) => {
10
+ const { atLeft: s, atRight: e } = r();
11
+ return /* @__PURE__ */ o(
12
+ "td",
13
+ {
14
+ role: "cell",
15
+ "data-slot": "table-cell",
16
+ "data-sticky-cell": l,
17
+ className: t(
18
+ "mds:p-12 mds:body-extrasmall-regular mds:transition-shadow mds:duration-200",
19
+ l && "mds:md:sticky mds:md:bg-surface-neutral-l1 mds:md:z-10",
20
+ l && a === "left" && "mds:md:left-0",
21
+ l && a === "right" && "mds:md:right-0",
22
+ l && a === "left" && (s ? "mds:shadow-none" : "mds:shadow-100"),
23
+ l && a === "right" && (e ? "mds:shadow-none" : "mds:shadow-100"),
24
+ m
25
+ ),
26
+ ...d
27
+ }
28
+ );
29
+ };
30
+ n.displayName = "TableCell";
22
31
  export {
23
- d as TableCell
32
+ n as TableCell
24
33
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),l=require("./utils-sX9NhwD-.cjs"),e=({isSticky:s,className:d,...t})=>a.jsx("th",{role:"columnheader","data-slot":"table-head",className:l.cn(s?"mds:sticky mds:left-0 mds:bg-surface-neutral-l3 mds:z-10":"","mds:text-secondary mds:px-12 mds:py-16 mds:text-left mds:align-middle mds:body-small-medium mds:whitespace-nowrap",d),...t});e.displayName="TableHead";exports.TableHead=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("./utils-sX9NhwD-.cjs"),r=require("./mainstack-design-system600.cjs"),a=({isSticky:e,stickySide:s="left",className:t,...d})=>{const{atLeft:l,atRight:m}=r.useTableScroll();return o.jsx("th",{role:"columnheader","data-slot":"table-head",className:n.cn(e&&"mds:sticky mds:bg-surface-neutral-l3 mds:z-10",e&&s==="left"&&"mds:left-0",e&&s==="right"&&"mds:right-0",e&&s==="left"&&(l?"mds:shadow-none":"mds:shadow-100"),e&&s==="right"&&(m?"mds:shadow-none":"mds:shadow-100"),"mds:text-secondary mds:px-12 mds:py-16 mds:text-left mds:align-middle mds:body-small-medium mds:whitespace-nowrap mds:transition-shadow mds:duration-200",t),...d})};a.displayName="TableHead";exports.TableHead=a;
@@ -1,23 +1,32 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { c as a } from "./utils-BuJ7DVbu.js";
3
- const t = ({
4
- isSticky: e,
5
- className: s,
6
- ...d
7
- }) => /* @__PURE__ */ m(
8
- "th",
9
- {
10
- role: "columnheader",
11
- "data-slot": "table-head",
12
- className: a(
13
- e ? "mds:sticky mds:left-0 mds:bg-surface-neutral-l3 mds:z-10" : "",
14
- "mds:text-secondary mds:px-12 mds:py-16 mds:text-left mds:align-middle mds:body-small-medium mds:whitespace-nowrap",
15
- s
16
- ),
17
- ...d
18
- }
19
- );
20
- t.displayName = "TableHead";
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { c as l } from "./utils-BuJ7DVbu.js";
3
+ import { useTableScroll as r } from "./mainstack-design-system600.js";
4
+ const n = ({
5
+ isSticky: d,
6
+ stickySide: a = "left",
7
+ className: m,
8
+ ...s
9
+ }) => {
10
+ const { atLeft: e, atRight: t } = r();
11
+ return /* @__PURE__ */ o(
12
+ "th",
13
+ {
14
+ role: "columnheader",
15
+ "data-slot": "table-head",
16
+ className: l(
17
+ d && "mds:sticky mds:bg-surface-neutral-l3 mds:z-10",
18
+ d && a === "left" && "mds:left-0",
19
+ d && a === "right" && "mds:right-0",
20
+ d && a === "left" && (e ? "mds:shadow-none" : "mds:shadow-100"),
21
+ d && a === "right" && (t ? "mds:shadow-none" : "mds:shadow-100"),
22
+ "mds:text-secondary mds:px-12 mds:py-16 mds:text-left mds:align-middle mds:body-small-medium mds:whitespace-nowrap mds:transition-shadow mds:duration-200",
23
+ m
24
+ ),
25
+ ...s
26
+ }
27
+ );
28
+ };
29
+ n.displayName = "TableHead";
21
30
  export {
22
- t as TableHead
31
+ n as TableHead
23
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mainstack-design-system",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "type": "module",
5
5
  "main": "./dist/mainstack-design-system.cjs",
6
6
  "module": "./dist/mainstack-design-system.js",