@caseparts-org/caseblocks 0.0.146 → 0.0.148

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.
@@ -0,0 +1,178 @@
1
+ import { jsxs as K, jsx as s } from "react/jsx-runtime";
2
+ import c from "react";
3
+ import { c as C } from "./clsx-OuTLNxxd.js";
4
+ import { Icon as Y } from "./atoms/Icon/Icon.js";
5
+ import './assets/Table.css';const Z = "_table_14k11_2", $ = "_noPaddingRow_14k11_71", I = "_clickableRow_14k11_82", P = "_clickableCell_14k11_83", ee = "_expandedContentCell_14k11_85", ne = "_expandedContentRow_14k11_94", te = "_expandedRow_14k11_99", le = "_expanded_14k11_85", ae = "_columnContent_14k11_135", oe = "_clickableHeader_14k11_155", n = {
6
+ "table-container": "_table-container_14k11_2",
7
+ table: Z,
8
+ "table-alternating": "_table-alternating_14k11_17",
9
+ "sorted-column": "_sorted-column_14k11_22",
10
+ noPaddingRow: $,
11
+ clickableRow: I,
12
+ clickableCell: P,
13
+ expandedContentCell: ee,
14
+ expandedContentRow: ne,
15
+ expandedRow: te,
16
+ expanded: le,
17
+ columnContent: ae,
18
+ clickableHeader: oe,
19
+ "icon-ascending": "_icon-ascending_14k11_156"
20
+ }, S = ({ children: r }) => null;
21
+ S.displayName = "Table.Columns";
22
+ const V = ({ children: r }) => null;
23
+ V.displayName = "Table.Column";
24
+ const v = ({ children: r }) => null;
25
+ v.displayName = "Table.Body";
26
+ const j = ({ children: r }) => null;
27
+ j.displayName = "Table.Row";
28
+ const M = ({ children: r }) => null;
29
+ M.displayName = "Table.Cell";
30
+ const y = ({ children: r, className: O, alternatingRows: z = !1, isSortable: w = !1, sortField: D, sortFieldKey: q, sortOrder: G = "descending", onSort: F, ...J }) => {
31
+ const A = [];
32
+ let x, R;
33
+ const i = (t, l) => {
34
+ var e;
35
+ return !!t && c.isValidElement(t) && ((e = t.type) == null ? void 0 : e.displayName) === l;
36
+ };
37
+ c.Children.forEach(r, (t) => {
38
+ i(t, "Table.Columns") ? x = t : i(t, "Table.Body") ? R = t : A.push(t);
39
+ });
40
+ const L = (t) => t.flatMap((l) => {
41
+ if (c.isValidElement(l) && l.type === c.Fragment) {
42
+ const e = l.props.children;
43
+ return c.Children.toArray(e);
44
+ }
45
+ return [l];
46
+ }), Q = () => {
47
+ if (!x) return null;
48
+ const t = c.Children.toArray(x.props.children);
49
+ return /* @__PURE__ */ s("thead", { className: n.thead, children: /* @__PURE__ */ s("tr", { children: t.map((l, e) => {
50
+ if (i(l, "Table.Column")) {
51
+ const a = l, {
52
+ children: d,
53
+ align: m,
54
+ colSpan: g,
55
+ width: b,
56
+ style: N,
57
+ sortField: p,
58
+ sortFieldKey: o,
59
+ ...h
60
+ } = a.props, E = {
61
+ textAlign: m ?? "left",
62
+ width: b,
63
+ ...N
64
+ }, u = !!p, f = w && u && (u && D === p) && (o !== void 0 ? q === o : !0), k = w && u && typeof F == "function";
65
+ return /* @__PURE__ */ s(
66
+ "th",
67
+ {
68
+ className: C(n.th, f && n["sorted-column"], k && n.clickableHeader),
69
+ style: E,
70
+ colSpan: g,
71
+ onClick: k ? () => F(p, o) : void 0,
72
+ ...h,
73
+ children: /* @__PURE__ */ K("div", { className: n.columnContent, children: [
74
+ d,
75
+ f && /* @__PURE__ */ s("span", { className: C(G === "ascending" && n["icon-ascending"]), children: /* @__PURE__ */ s(Y, { iconKey: "fa-solid fa-chevron-down", size: "3xs" }) })
76
+ ] })
77
+ },
78
+ e
79
+ );
80
+ }
81
+ return /* @__PURE__ */ s("th", { className: n.th, children: l }, e);
82
+ }) }) });
83
+ }, _ = (t, l, e) => {
84
+ const a = c.Children.toArray(t).map((o, h) => {
85
+ if (i(o, "Table.Cell")) {
86
+ const E = o, {
87
+ children: u,
88
+ align: H,
89
+ colSpan: B,
90
+ width: f,
91
+ style: k,
92
+ ...T
93
+ } = E.props, W = {
94
+ textAlign: H ?? "left",
95
+ width: f,
96
+ ...k
97
+ }, X = !!(T && typeof T.onClick == "function");
98
+ return /* @__PURE__ */ s(
99
+ "td",
100
+ {
101
+ className: C(
102
+ n.cell,
103
+ (e == null ? void 0 : e.isExpanded) && n.expanded,
104
+ (e == null ? void 0 : e.isExpandedContent) && n.expandedContentCell,
105
+ X && n.clickableCell
106
+ ),
107
+ style: W,
108
+ colSpan: B,
109
+ ...T,
110
+ children: u
111
+ },
112
+ h
113
+ );
114
+ }
115
+ return c.isValidElement(o) && typeof o.type == "string" && o.type === "td" ? o : /* @__PURE__ */ s(
116
+ "td",
117
+ {
118
+ className: C(
119
+ n.cell,
120
+ (e == null ? void 0 : e.isExpanded) && n.expanded,
121
+ (e == null ? void 0 : e.isExpandedContent) && n.expandedContentCell
122
+ ),
123
+ children: o
124
+ },
125
+ h
126
+ );
127
+ }), { className: d, style: m, isExpanded: g, isExpandedContent: b, ...N } = e ?? {}, p = !!(e && typeof e.onClick == "function");
128
+ return /* @__PURE__ */ s(
129
+ "tr",
130
+ {
131
+ className: C(
132
+ n.row,
133
+ d,
134
+ g && n.expandedRow,
135
+ b && n.noPaddingRow,
136
+ b && n.expandedContentRow,
137
+ p && n.clickableRow
138
+ ),
139
+ style: m,
140
+ ...N,
141
+ children: a
142
+ },
143
+ l
144
+ );
145
+ }, U = () => {
146
+ if (R) {
147
+ const e = c.Children.toArray(R.props.children).map((a, d) => {
148
+ if (i(a, "Table.Row")) {
149
+ const m = a;
150
+ return _(m.props.children, d, m.props);
151
+ }
152
+ return c.isValidElement(a) && typeof a.type == "string" && a.type === "tr" ? a : _(a, d);
153
+ });
154
+ return /* @__PURE__ */ s("tbody", { className: n.tbody, children: e });
155
+ }
156
+ const l = L(A).map((e, a) => {
157
+ if (i(e, "Table.Row")) {
158
+ const d = e;
159
+ return _(d.props.children, a, d.props);
160
+ }
161
+ return c.isValidElement(e) && typeof e.type == "string" && e.type === "tr" ? e : _(e, a);
162
+ });
163
+ return /* @__PURE__ */ s("tbody", { className: n.tbody, children: l });
164
+ };
165
+ return /* @__PURE__ */ K("table", { className: C(n.table, O, z && n["table-alternating"]), ...J, children: [
166
+ Q(),
167
+ U()
168
+ ] });
169
+ };
170
+ y.Columns = S;
171
+ y.Column = V;
172
+ y.Body = v;
173
+ y.Row = j;
174
+ y.Cell = M;
175
+ export {
176
+ y as T,
177
+ n as s
178
+ };
@@ -32,6 +32,8 @@ export { Modal } from './molecules/Modal/Modal';
32
32
  export type { ModalProps } from './molecules/Modal/Modal';
33
33
  export { ImageViewer } from './molecules/ImageViewer/ImageViewer';
34
34
  export type { ImageViewerProps } from './molecules/ImageViewer/ImageViewer';
35
+ export { Table } from './molecules/Table/Table';
36
+ export type { TableProps, TableAlign, ColumnsProps, ColumnProps, BodyProps, RowProps, CellProps, TableComponent } from './molecules/Table/Table';
35
37
  export { MainNav } from './organisms/MainNav/MainNav';
36
38
  export type { MainNavProps } from './organisms/MainNav/MainNav';
37
39
  export { ChipSelector } from './organisms/ChipSelector/ChipSelector';
@@ -2,18 +2,18 @@ import { Button as e } from "./atoms/Button/Button.js";
2
2
  import { Flex as p } from "./atoms/Flex/Flex.js";
3
3
  import { Column as f, Grid as x } from "./atoms/Grid/Grid.js";
4
4
  import { Head as n } from "./atoms/Root/Head.js";
5
- import { Icon as d } from "./atoms/Icon/Icon.js";
5
+ import { Icon as l } from "./atoms/Icon/Icon.js";
6
6
  import { Root as u } from "./atoms/Root/Root.js";
7
7
  import { Separator as s } from "./atoms/Separator/Separator.js";
8
8
  import { Text as C } from "./atoms/Text/Text.js";
9
9
  import { Input as S } from "./atoms/Input/Input.js";
10
10
  import { Link as P } from "./atoms/Link/Link.js";
11
11
  import { linkClassName as A } from "./atoms/Link/linkClassName.js";
12
- import { configureLink as M, routerOverride as v } from "./atoms/Link/configureLink.js";
13
- import { LinkButton as h } from "./atoms/LinkButton/LinkButton.js";
14
- import { configureImage as y } from "./atoms/Image/configureImage.js";
15
- import { getHideAtStyles as H } from "./atoms/HideAt.js";
16
- import { Logo as V } from "./molecules/Logo/Logo.js";
12
+ import { configureLink as M, routerOverride as T } from "./atoms/Link/configureLink.js";
13
+ import { LinkButton as L } from "./atoms/LinkButton/LinkButton.js";
14
+ import { configureImage as b } from "./atoms/Image/configureImage.js";
15
+ import { getHideAtStyles as F } from "./atoms/HideAt.js";
16
+ import { Logo as N } from "./molecules/Logo/Logo.js";
17
17
  import { SearchBox as z } from "./molecules/SearchBox/SearchBox.js";
18
18
  import { QuantityInput as O } from "./molecules/QuantityInput/QuantityInput.js";
19
19
  import { Pricing as R } from "./molecules/Pricing/Pricing.js";
@@ -36,18 +36,19 @@ import { ToggleView as So } from "./molecules/ToggleView/ToggleView.js";
36
36
  import { CartSlideInPanel as Po } from "./molecules/Cart/CartSlideInPanel.js";
37
37
  import { StatefulButton as Ao } from "./molecules/StatefulButton/StatefulButton.js";
38
38
  import { AnimatedCheckMark as Mo } from "./molecules/StatefulButton/AnimatedCheckmark.js";
39
- import { AddToCart as Lo } from "./molecules/AddToCart/AddToCart.js";
40
- import { Modal as To } from "./molecules/Modal/Modal.js";
41
- import { ImageViewer as Fo } from "./molecules/ImageViewer/ImageViewer.js";
42
- import { MainNav as No } from "./organisms/MainNav/MainNav.js";
43
- import { ChipSelector as bo } from "./organisms/ChipSelector/ChipSelector.js";
44
- import { Product as Go } from "./organisms/Product/Product.js";
45
- import { Carousel as Qo } from "./organisms/Carousel/Carousel.js";
46
- import { Footer as Zo } from "./organisms/Footer/Footer.js";
47
- import { default as qo } from "./organisms/SpinZoomViewer/SpinZoomViewer.js";
39
+ import { AddToCart as vo } from "./molecules/AddToCart/AddToCart.js";
40
+ import { Modal as ho } from "./molecules/Modal/Modal.js";
41
+ import { ImageViewer as yo } from "./molecules/ImageViewer/ImageViewer.js";
42
+ import { T as Ho } from "./Table-DwAM6AAI.js";
43
+ import { MainNav as Vo } from "./organisms/MainNav/MainNav.js";
44
+ import { ChipSelector as Go } from "./organisms/ChipSelector/ChipSelector.js";
45
+ import { Product as Qo } from "./organisms/Product/Product.js";
46
+ import { Carousel as Zo } from "./organisms/Carousel/Carousel.js";
47
+ import { Footer as qo } from "./organisms/Footer/Footer.js";
48
+ import { default as Eo } from "./organisms/SpinZoomViewer/SpinZoomViewer.js";
48
49
  export {
49
50
  so as Account,
50
- Lo as AddToCart,
51
+ vo as AddToCart,
51
52
  Mo as AnimatedCheckMark,
52
53
  j as Availability,
53
54
  D as Avatar,
@@ -55,44 +56,45 @@ export {
55
56
  X as Breadcrumbs,
56
57
  e as Button,
57
58
  U as CardLink,
58
- Qo as Carousel,
59
+ Zo as Carousel,
59
60
  Po as CartSlideInPanel,
60
61
  Co as Chip,
61
- bo as ChipSelector,
62
+ Go as ChipSelector,
62
63
  f as Column,
63
64
  p as Flex,
64
- Zo as Footer,
65
+ qo as Footer,
65
66
  x as Grid,
66
67
  n as Head,
67
68
  oo as HorizontalScroll,
68
- d as Icon,
69
- Fo as ImageViewer,
69
+ l as Icon,
70
+ yo as ImageViewer,
70
71
  S as Input,
71
72
  P as Link,
72
- h as LinkButton,
73
- V as Logo,
74
- No as MainNav,
73
+ L as LinkButton,
74
+ N as Logo,
75
+ Vo as MainNav,
75
76
  po as Markdown,
76
- To as Modal,
77
+ ho as Modal,
77
78
  _ as NotFound,
78
79
  uo as Popover,
79
80
  fo as PreprocessedMarkdown,
80
81
  R as Pricing,
81
- Go as Product,
82
+ Qo as Product,
82
83
  O as QuantityInput,
83
84
  u as Root,
84
85
  z as SearchBox,
85
86
  s as Separator,
86
87
  eo as SlideInPanel,
87
- qo as SpinZoomViewer,
88
+ Eo as SpinZoomViewer,
88
89
  Ao as StatefulButton,
90
+ Ho as Table,
89
91
  C as Text,
90
92
  So as ToggleView,
91
93
  io as Tooltip,
92
- y as configureImage,
94
+ b as configureImage,
93
95
  M as configureLink,
94
- H as getHideAtStyles,
96
+ F as getHideAtStyles,
95
97
  A as linkClassName,
96
- v as routerOverride,
98
+ T as routerOverride,
97
99
  ao as usePreprocessedMarkdown
98
100
  };
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../../clsx-OuTLNxxd.js";
4
- import { T as i, T as e } from "../../Table-rSK2f682.js";
4
+ import { T as i, T as e } from "../../Table-DwAM6AAI.js";
5
5
  import "../../atoms/Icon/Icon.js";
6
6
  export {
7
7
  i as Table,
@@ -1,6 +1,6 @@
1
1
  import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
2
  import { useState as s, useEffect as P } from "react";
3
- import { T as t, s as S } from "../../Table-rSK2f682.js";
3
+ import { T as t, s as S } from "../../Table-DwAM6AAI.js";
4
4
  const v = {
5
5
  title: "Case Parts/Molecules/Table",
6
6
  component: t,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.146",
4
+ "version": "0.0.148",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -1,172 +0,0 @@
1
- import { jsxs as K, jsx as o } from "react/jsx-runtime";
2
- import c from "react";
3
- import { c as m } from "./clsx-OuTLNxxd.js";
4
- import { Icon as X } from "./atoms/Icon/Icon.js";
5
- import './assets/Table.css';const Y = "_table_14k11_2", Z = "_noPaddingRow_14k11_71", $ = "_clickableRow_14k11_82", I = "_clickableCell_14k11_83", P = "_expandedContentCell_14k11_85", ee = "_expandedContentRow_14k11_94", ne = "_expandedRow_14k11_99", le = "_expanded_14k11_85", te = "_columnContent_14k11_135", ae = "_clickableHeader_14k11_155", n = {
6
- "table-container": "_table-container_14k11_2",
7
- table: Y,
8
- "table-alternating": "_table-alternating_14k11_17",
9
- "sorted-column": "_sorted-column_14k11_22",
10
- noPaddingRow: Z,
11
- clickableRow: $,
12
- clickableCell: I,
13
- expandedContentCell: P,
14
- expandedContentRow: ee,
15
- expandedRow: ne,
16
- expanded: le,
17
- columnContent: te,
18
- clickableHeader: ae,
19
- "icon-ascending": "_icon-ascending_14k11_156"
20
- }, S = ({ children: d }) => null;
21
- S.displayName = "Table.Columns";
22
- const v = ({ children: d }) => null;
23
- v.displayName = "Table.Column";
24
- const V = ({ children: d }) => null;
25
- V.displayName = "Table.Body";
26
- const j = ({ children: d }) => null;
27
- j.displayName = "Table.Row";
28
- const z = ({ children: d }) => null;
29
- z.displayName = "Table.Cell";
30
- const u = ({ children: d, className: D, alternatingRows: M = !1, isSortable: w = !1, sortField: q, sortFieldKey: G, sortOrder: J = "descending", onSort: F, ...L }) => {
31
- const H = [];
32
- let k, x;
33
- const i = (t, l) => {
34
- var e;
35
- return !!t && c.isValidElement(t) && ((e = t.type) == null ? void 0 : e.displayName) === l;
36
- };
37
- c.Children.forEach(d, (t) => {
38
- i(t, "Table.Columns") ? k = t : i(t, "Table.Body") ? x = t : H.push(t);
39
- });
40
- const O = () => {
41
- if (!k) return null;
42
- const t = c.Children.toArray(k.props.children);
43
- return /* @__PURE__ */ o("thead", { className: n.thead, children: /* @__PURE__ */ o("tr", { children: t.map((l, e) => {
44
- if (i(l, "Table.Column")) {
45
- const s = l, {
46
- children: r,
47
- align: R,
48
- colSpan: N,
49
- width: _,
50
- style: g,
51
- sortField: C,
52
- sortFieldKey: a,
53
- ...b
54
- } = s.props, T = {
55
- textAlign: R ?? "left",
56
- width: _,
57
- ...g
58
- }, p = !!C, h = w && p && (p && q === C) && (a !== void 0 ? G === a : !0), f = w && p && typeof F == "function";
59
- return /* @__PURE__ */ o(
60
- "th",
61
- {
62
- className: m(n.th, h && n["sorted-column"], f && n.clickableHeader),
63
- style: T,
64
- colSpan: N,
65
- onClick: f ? () => F(C, a) : void 0,
66
- ...b,
67
- children: /* @__PURE__ */ K("div", { className: n.columnContent, children: [
68
- r,
69
- h && /* @__PURE__ */ o("span", { className: m(J === "ascending" && n["icon-ascending"]), children: /* @__PURE__ */ o(X, { iconKey: "fa-solid fa-chevron-down", size: "3xs" }) })
70
- ] })
71
- },
72
- e
73
- );
74
- }
75
- return /* @__PURE__ */ o("th", { className: n.th, children: l }, e);
76
- }) }) });
77
- }, y = (t, l, e) => {
78
- const s = c.Children.toArray(t).map((a, b) => {
79
- if (i(a, "Table.Cell")) {
80
- const T = a, {
81
- children: p,
82
- align: A,
83
- colSpan: B,
84
- width: h,
85
- style: f,
86
- ...E
87
- } = T.props, U = {
88
- textAlign: A ?? "left",
89
- width: h,
90
- ...f
91
- }, W = !!(E && typeof E.onClick == "function");
92
- return /* @__PURE__ */ o(
93
- "td",
94
- {
95
- className: m(
96
- n.cell,
97
- (e == null ? void 0 : e.isExpanded) && n.expanded,
98
- (e == null ? void 0 : e.isExpandedContent) && n.expandedContentCell,
99
- W && n.clickableCell
100
- ),
101
- style: U,
102
- colSpan: B,
103
- ...E,
104
- children: p
105
- },
106
- b
107
- );
108
- }
109
- return c.isValidElement(a) && typeof a.type == "string" && a.type === "td" ? a : /* @__PURE__ */ o(
110
- "td",
111
- {
112
- className: m(
113
- n.cell,
114
- (e == null ? void 0 : e.isExpanded) && n.expanded,
115
- (e == null ? void 0 : e.isExpandedContent) && n.expandedContentCell
116
- ),
117
- children: a
118
- },
119
- b
120
- );
121
- }), { className: r, style: R, isExpanded: N, isExpandedContent: _, ...g } = e ?? {}, C = !!(e && typeof e.onClick == "function");
122
- return /* @__PURE__ */ o(
123
- "tr",
124
- {
125
- className: m(
126
- n.row,
127
- r,
128
- N && n.expandedRow,
129
- _ && n.noPaddingRow,
130
- _ && n.expandedContentRow,
131
- C && n.clickableRow
132
- ),
133
- style: R,
134
- ...g,
135
- children: s
136
- },
137
- l
138
- );
139
- }, Q = () => {
140
- if (x) {
141
- const l = c.Children.toArray(x.props.children).map((e, s) => {
142
- if (i(e, "Table.Row")) {
143
- const r = e;
144
- return y(r.props.children, s, r.props);
145
- }
146
- return c.isValidElement(e) && typeof e.type == "string" && e.type === "tr" ? e : y(e, s);
147
- });
148
- return /* @__PURE__ */ o("tbody", { className: n.tbody, children: l });
149
- }
150
- const t = H.map((l, e) => {
151
- if (i(l, "Table.Row")) {
152
- const s = l;
153
- return y(s.props.children, e, s.props);
154
- }
155
- return c.isValidElement(l) && typeof l.type == "string" && l.type === "tr" ? l : y(l, e);
156
- });
157
- return /* @__PURE__ */ o("tbody", { className: n.tbody, children: t });
158
- };
159
- return /* @__PURE__ */ K("table", { className: m(n.table, D, M && n["table-alternating"]), ...L, children: [
160
- O(),
161
- Q()
162
- ] });
163
- };
164
- u.Columns = S;
165
- u.Column = v;
166
- u.Body = V;
167
- u.Row = j;
168
- u.Cell = z;
169
- export {
170
- u as T,
171
- n as s
172
- };