@caspeco/casper-ui-library 9.0.0-alpha.2 → 9.0.0-alpha.4
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/README.md +2 -2
- package/dist/components/breadcrumbs/breadcrumb-item.js +1 -1
- package/dist/components/table/table-cell.js +22 -22
- package/dist/components/textarea/textarea-recipe.js +6 -6
- package/dist/components/textarea/textarea.d.ts +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/textarea/textarea.js +11 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@caspeco/casper-ui-library)
|
|
4
4
|
|
|
5
|
-
Caspeco's UI component library, built on top of
|
|
5
|
+
Caspeco's UI component library, built on top of [Chakra UI](https://chakra-ui.com/).
|
|
6
6
|
|
|
7
7
|
👉 **The usage documentation can be found at https://caspeco.github.io/casper-ui-library**
|
|
8
8
|
|
|
@@ -27,7 +27,7 @@ All commands are run from the root of the project, from a terminal.
|
|
|
27
27
|
| `npm run test:visual:update` | Update visual regression baseline screenshots. Run this after intentional UI changes. |
|
|
28
28
|
| `npm run lint` | Run linting with [@caspeco/eslint-config](https://github.com/Caspeco/eslint-config). If you use the recommended [ESLint VSCode extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) you can see your eslint errors directly in your editor without having to run this. |
|
|
29
29
|
| `npm run prettier:fix` | Reformat all files with [@caspeco/prettier-config](https://github.com/Caspeco/prettier-config). If you use the recommended [Prettier VSCode extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) you can have your files automatically formatted on file save. |
|
|
30
|
-
| `npm run chakra
|
|
30
|
+
| `npm run chakra:types` | Generate Chakra UI type definitions for the theme. Happens automatically on `npm install`. |
|
|
31
31
|
|
|
32
32
|
### Preview locally in another project
|
|
33
33
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { Breadcrumb as t } from "@chakra-ui/react";
|
|
3
3
|
function u({ children: r, isCurrentPage: o, ...m }) {
|
|
4
|
-
return /* @__PURE__ */ e(t.Item, { whiteSpace: "nowrap", overflow: "hidden", ...m, children: o ?
|
|
4
|
+
return /* @__PURE__ */ e(t.Item, { whiteSpace: "nowrap", overflow: "hidden", ...m, children: o ? /* @__PURE__ */ e(t.CurrentLink, { asChild: !0, children: r }) : r });
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
7
|
u as BreadcrumbItem
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as n, jsxs as I, Fragment as
|
|
2
|
-
import { TableCell as
|
|
1
|
+
import { jsx as n, jsxs as I, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { TableCell as w, Flex as V, Box as m } from "@chakra-ui/react";
|
|
3
3
|
import { flexRender as j } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
4
|
import { memo as K, useMemo as h, useCallback as P } from "react";
|
|
5
5
|
import { useTableContext as N } from "./table-context.js";
|
|
@@ -18,11 +18,11 @@ const U = ({
|
|
|
18
18
|
visibleCells: T,
|
|
19
19
|
breakingContentState: g,
|
|
20
20
|
localeString: b,
|
|
21
|
-
actionMenu:
|
|
21
|
+
actionMenu: l,
|
|
22
22
|
canSelectRows: r,
|
|
23
23
|
isCheckboxDisabled: D
|
|
24
24
|
}) => {
|
|
25
|
-
const
|
|
25
|
+
const s = N(), { column: i } = a, S = L[b], $ = h(() => {
|
|
26
26
|
const e = {
|
|
27
27
|
width: "100%",
|
|
28
28
|
display: "inline-flex",
|
|
@@ -30,14 +30,14 @@ const U = ({
|
|
|
30
30
|
alignItems: "center"
|
|
31
31
|
};
|
|
32
32
|
return g[i.id] || (e.overflow = "hidden", e.whiteSpace = "nowrap"), e;
|
|
33
|
-
}, [g, i.id]), x = h(() => i.getIndex() === 0, [i]), C = o.getCanExpand(), f = T[0]?.id === a.id, y = C && f, u =
|
|
33
|
+
}, [g, i.id]), x = h(() => i.getIndex() === 0, [i]), C = o.getCanExpand(), f = T[0]?.id === a.id, y = C && f, u = l || x && !!s.getRowActions || r, B = h(() => {
|
|
34
34
|
const e = [];
|
|
35
35
|
for (let t = 0; t < o.depth; t += 1) {
|
|
36
36
|
let d = `${t * 2 + 0.7}rem`;
|
|
37
|
-
u && (d = `calc(${d} + ${
|
|
37
|
+
u && (d = `calc(${d} + ${l && r ? 48 : 24}px)`), e.push(/* @__PURE__ */ n(W, { orientation: "vertical", position: "absolute", top: "0", left: d }, t));
|
|
38
38
|
}
|
|
39
39
|
return e;
|
|
40
|
-
}, [
|
|
40
|
+
}, [l, r, o.depth, u]), R = P(() => {
|
|
41
41
|
const e = i.getIsPinned();
|
|
42
42
|
return {
|
|
43
43
|
position: e ? "sticky" : "relative",
|
|
@@ -48,44 +48,44 @@ const U = ({
|
|
|
48
48
|
maxWidth: i.getSize()
|
|
49
49
|
};
|
|
50
50
|
}, [i]);
|
|
51
|
-
function
|
|
51
|
+
function A() {
|
|
52
52
|
const e = o.depth && f || y ? `${o.depth * 2}rem` : Q.Small;
|
|
53
53
|
if (!u)
|
|
54
54
|
return e;
|
|
55
|
-
const t =
|
|
55
|
+
const t = l && r && o.depth === 0 ? 48 : 24;
|
|
56
56
|
return `calc(${e} + ${t}px)`;
|
|
57
57
|
}
|
|
58
58
|
const E = P(
|
|
59
59
|
({ checked: e }) => {
|
|
60
60
|
const t = (d) => {
|
|
61
|
-
if (
|
|
61
|
+
if (s.disableSelectionCheckbox?.(d))
|
|
62
62
|
return [];
|
|
63
63
|
const c = [d.id];
|
|
64
64
|
return d.subRows?.forEach((p) => {
|
|
65
65
|
c.push(...t(p));
|
|
66
66
|
}), c;
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
s.setSelectedRowIds((d) => {
|
|
69
69
|
const c = t(o), p = new Set(d);
|
|
70
70
|
return c.forEach((v) => {
|
|
71
71
|
e ? p.add(v) : p.delete(v);
|
|
72
72
|
}), Array.from(p);
|
|
73
73
|
});
|
|
74
74
|
},
|
|
75
|
-
[o,
|
|
76
|
-
),
|
|
75
|
+
[o, s]
|
|
76
|
+
), z = h(() => s.selectedRowIds?.includes(o.id) ?? !1, [o.id, s.selectedRowIds]);
|
|
77
77
|
return /* @__PURE__ */ n(
|
|
78
|
-
|
|
78
|
+
w,
|
|
79
79
|
{
|
|
80
80
|
id: a.id,
|
|
81
81
|
textAlign: i.columnDef.meta?.isNumeric ? "end" : void 0,
|
|
82
82
|
style: {
|
|
83
|
-
...
|
|
83
|
+
...R(),
|
|
84
84
|
borderBottom: 0,
|
|
85
|
-
paddingLeft:
|
|
85
|
+
paddingLeft: A()
|
|
86
86
|
},
|
|
87
87
|
children: /* @__PURE__ */ I(V, { w: "100%", h: "100%", align: "center", children: [
|
|
88
|
-
|
|
88
|
+
l && /* @__PURE__ */ n(q, { lazyBehavior: "keepMounted", children: ({ isOpen: e }) => /* @__PURE__ */ I(
|
|
89
89
|
m,
|
|
90
90
|
{
|
|
91
91
|
display: "contents",
|
|
@@ -114,14 +114,14 @@ const U = ({
|
|
|
114
114
|
)
|
|
115
115
|
}
|
|
116
116
|
),
|
|
117
|
-
|
|
117
|
+
l
|
|
118
118
|
]
|
|
119
119
|
}
|
|
120
120
|
) }),
|
|
121
|
-
r && /* @__PURE__ */ n(m, { display: "contents", onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), children: /* @__PURE__ */ n(m, { position: "absolute", left:
|
|
121
|
+
r && /* @__PURE__ */ n(m, { display: "contents", onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), children: /* @__PURE__ */ n(m, { position: "absolute", left: l ? "24px" : "0", children: /* @__PURE__ */ n(
|
|
122
122
|
J,
|
|
123
123
|
{
|
|
124
|
-
isChecked:
|
|
124
|
+
isChecked: z,
|
|
125
125
|
onCheckedChange: E,
|
|
126
126
|
isDisabled: D
|
|
127
127
|
}
|
|
@@ -134,8 +134,8 @@ const U = ({
|
|
|
134
134
|
hidden: !C,
|
|
135
135
|
rowIsExpanded: k
|
|
136
136
|
}
|
|
137
|
-
) : /* @__PURE__ */ n(
|
|
138
|
-
x &&
|
|
137
|
+
) : /* @__PURE__ */ n(F, {}),
|
|
138
|
+
x && B,
|
|
139
139
|
/* @__PURE__ */ n("div", { style: $, children: j(i.columnDef.cell, a.getContext()) })
|
|
140
140
|
] })
|
|
141
141
|
},
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { isTouchScreenDevice as d } from "../../theme/theme-helper.js";
|
|
2
|
-
import { ThemeColorToken as r, ThemeBorderToken as o, ThemeSpaceToken as
|
|
2
|
+
import { ThemeColorToken as r, ThemeBorderToken as o, ThemeSpaceToken as a, ThemeRadiusToken as l, ThemeFontToken as t } from "../../theme/theme-tokens.js";
|
|
3
3
|
import { ThemeColorVariable as e } from "../../theme/theme-types.js";
|
|
4
4
|
import { defineRecipe as i } from "@chakra-ui/react";
|
|
5
|
-
const
|
|
5
|
+
const n = {
|
|
6
6
|
fontFamily: t.Body,
|
|
7
7
|
color: r.OnSurface,
|
|
8
8
|
border: o.XSmall,
|
|
9
9
|
borderColor: r.OnSurfaceBorder,
|
|
10
10
|
background: r.Surface,
|
|
11
11
|
borderRadius: l.Small,
|
|
12
|
-
paddingX:
|
|
13
|
-
paddingY:
|
|
12
|
+
paddingX: a.Small,
|
|
13
|
+
paddingY: a.Small,
|
|
14
14
|
width: "100%",
|
|
15
15
|
minHeight: "5rem",
|
|
16
16
|
lineHeight: "1.375",
|
|
@@ -47,7 +47,7 @@ const a = {
|
|
|
47
47
|
boxShadow: `0 0 0 4px ${e.InfoContainer}`
|
|
48
48
|
}
|
|
49
49
|
}, c = {
|
|
50
|
-
...
|
|
50
|
+
...n,
|
|
51
51
|
border: o.XSmall,
|
|
52
52
|
borderColor: "transparent",
|
|
53
53
|
_hover: void 0,
|
|
@@ -84,7 +84,7 @@ const a = {
|
|
|
84
84
|
}, f = i({
|
|
85
85
|
variants: {
|
|
86
86
|
variant: {
|
|
87
|
-
unstyled:
|
|
87
|
+
unstyled: n,
|
|
88
88
|
ghost: c
|
|
89
89
|
}
|
|
90
90
|
},
|
|
@@ -8,7 +8,7 @@ type CustomProperties = {
|
|
|
8
8
|
isRequired?: boolean;
|
|
9
9
|
};
|
|
10
10
|
type CustomStyleProps = CustomChakraBoxProps & LayoutProps & MarginProps & PaddingProps & CustomProperties;
|
|
11
|
-
type ChakraTextareaProperties = Pick<ChakraTextareaProps, "
|
|
11
|
+
type ChakraTextareaProperties = Pick<ChakraTextareaProps, "id" | "name" | "placeholder" | "rows" | "value" | "defaultValue" | "onChange" | "onBlur" | "onFocus" | "onKeyDown" | "resize" | "autoresize">;
|
|
12
12
|
export type TextareaProps = ChakraTextareaProperties & CustomStyleProps;
|
|
13
13
|
export declare const Textarea: React.ForwardRefExoticComponent<ChakraTextareaProperties & CustomChakraBoxProps & LayoutProps & MarginProps & PaddingProps & CustomProperties & React.RefAttributes<HTMLTextAreaElement>>;
|
|
14
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../lib/components/textarea/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAA8B,KAAK,aAAa,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,gBAAgB,GAAG;IACvB,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAG/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAE3G,KAAK,wBAAwB,GAAG,IAAI,CACnC,mBAAmB,EACjB,IAAI,GACJ,
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../lib/components/textarea/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAA8B,KAAK,aAAa,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,gBAAgB,GAAG;IACvB,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAG/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAE3G,KAAK,wBAAwB,GAAG,IAAI,CACnC,mBAAmB,EACjB,IAAI,GACJ,MAAM,GACN,aAAa,GACb,MAAM,GACN,OAAO,GACP,cAAc,GACd,UAAU,GACV,QAAQ,GACR,SAAS,GACT,WAAW,GACX,QAAQ,GACR,YAAY,CACd,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,wBAAwB,GAAG,gBAAgB,CAAC;AAExE,eAAO,MAAM,QAAQ,2LAanB,CAAC"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Textarea as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const { isDisabled: a, isReadOnly: t, isRequired:
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { Textarea as f } from "@chakra-ui/react";
|
|
3
|
+
import m from "react";
|
|
4
|
+
const p = m.forwardRef((e, r) => {
|
|
5
|
+
const { isDisabled: a, isReadOnly: t, isRequired: i, resize: s, ...o } = e;
|
|
6
|
+
return /* @__PURE__ */ d(
|
|
7
|
+
f,
|
|
8
8
|
{
|
|
9
|
-
resize:
|
|
9
|
+
resize: s,
|
|
10
10
|
ref: r,
|
|
11
11
|
disabled: a,
|
|
12
12
|
readOnly: t,
|
|
13
|
-
required:
|
|
14
|
-
|
|
15
|
-
...d
|
|
13
|
+
required: i,
|
|
14
|
+
...o
|
|
16
15
|
}
|
|
17
16
|
);
|
|
18
17
|
});
|
|
19
18
|
export {
|
|
20
|
-
|
|
19
|
+
p as Textarea
|
|
21
20
|
};
|