@bbki.ng/components 1.4.6 → 1.5.0

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
@@ -1,4 +1,4 @@
1
- import React, { EventHandler } from 'react';
1
+ import React, { EventHandler, ReactElement } from 'react';
2
2
  import { LinkProps as LinkProps$1 } from 'react-router-dom';
3
3
 
4
4
  declare type ArticleProps = {
@@ -76,6 +76,13 @@ declare type PanelProps = {
76
76
  };
77
77
  declare const Panel: (props: PanelProps) => JSX.Element;
78
78
 
79
+ declare type PageProps = {
80
+ nav: ReactElement;
81
+ main: ReactElement;
82
+ footer: ReactElement;
83
+ };
84
+ declare const Page: (props: PageProps) => JSX.Element;
85
+
79
86
  declare type PopConfirmProps = {
80
87
  onOk?: EventHandler<React.MouseEvent<HTMLButtonElement>>;
81
88
  onCancel?: EventHandler<React.MouseEvent<HTMLButtonElement>>;
@@ -86,4 +93,20 @@ declare type PopConfirmProps = {
86
93
  };
87
94
  declare const PopConfirm: (props: PopConfirmProps) => JSX.Element;
88
95
 
89
- export { Article, ArticleProps, Breadcrumb, BreadcrumbProps, Button, ButtonProps, ButtonType, Link, LinkColor, LinkProps, Logo, LogoProps, Nav, NavProps, Panel, PanelProps, PathObj, PopConfirm, PopConfirmProps, Tag, TagProps, Tags };
96
+ declare type TableProps = {
97
+ rowCount: number;
98
+ rowRenderer: (index: number) => any;
99
+ headerRenderer?: () => any;
100
+ className?: string;
101
+ };
102
+ declare const Table: {
103
+ (props: TableProps): JSX.Element;
104
+ HCell(props: {
105
+ children: any;
106
+ }): JSX.Element;
107
+ Cell(props: {
108
+ children: any;
109
+ }): JSX.Element;
110
+ };
111
+
112
+ export { Article, ArticleProps, Breadcrumb, BreadcrumbProps, Button, ButtonProps, ButtonType, Link, LinkColor, LinkProps, Logo, LogoProps, Nav, NavProps, Page, Panel, PanelProps, PathObj, PopConfirm, PopConfirmProps, Table, TableProps, Tag, TagProps, Tags };
package/dist/index.js CHANGED
@@ -66,8 +66,10 @@ __export(src_exports, {
66
66
  LinkColor: () => LinkColor,
67
67
  Logo: () => Logo,
68
68
  Nav: () => Nav,
69
+ Page: () => Page,
69
70
  Panel: () => Panel,
70
71
  PopConfirm: () => PopConfirm,
72
+ Table: () => Table,
71
73
  Tag: () => Tag,
72
74
  Tags: () => Tags
73
75
  });
@@ -80,7 +82,7 @@ var Article = (props) => {
80
82
  return /* @__PURE__ */ import_react.default.createElement("div", {
81
83
  className: (0, import_classnames.default)("article", className)
82
84
  }, /* @__PURE__ */ import_react.default.createElement("div", {
83
- className: "text-[2.25rem]"
85
+ className: "text-[2.25rem] leading-none"
84
86
  }, title), /* @__PURE__ */ import_react.default.createElement("hr", {
85
87
  className: "my-64 border-gray-200"
86
88
  }), /* @__PURE__ */ import_react.default.createElement("div", {
@@ -172,6 +174,11 @@ var HOVER_COLOR_MAPPING = {
172
174
  ["red" /* RED */]: "hover:bg-red-100",
173
175
  ["gray" /* GRAY */]: "hover:bg-gray-100"
174
176
  };
177
+ var FOCUS_BG_COLOR_MAPPING = {
178
+ ["blue" /* BLUE */]: "focus:bg-blue-600",
179
+ ["red" /* RED */]: "focus:bg-red-500",
180
+ ["gray" /* GRAY */]: "focus:bg-gray-400"
181
+ };
175
182
  var Link = (props) => {
176
183
  const _a = props, {
177
184
  color = "blue" /* BLUE */,
@@ -184,7 +191,7 @@ var Link = (props) => {
184
191
  "className",
185
192
  "children"
186
193
  ]);
187
- const linkCls = (0, import_classnames2.default)(COLOR_MAPPING[color], className, "rounded", "no-underline", "transition-colors", HOVER_COLOR_MAPPING[color]);
194
+ const linkCls = (0, import_classnames2.default)(className, "rounded", "no-underline", "transition-colors", "focus:text-white", COLOR_MAPPING[color], HOVER_COLOR_MAPPING[color], FOCUS_BG_COLOR_MAPPING[color]);
188
195
  if (external) {
189
196
  return /* @__PURE__ */ import_react3.default.createElement("a", {
190
197
  href: props.to,
@@ -266,25 +273,57 @@ var Panel = (props) => {
266
273
  }, children);
267
274
  };
268
275
 
269
- // src/pop-confirm/PopConfirm.tsx
276
+ // src/page/Page.tsx
270
277
  var import_react8 = __toESM(require("react"));
278
+ var Page = (props) => {
279
+ const { nav, main, footer } = props;
280
+ return /* @__PURE__ */ import_react8.default.createElement("main", {
281
+ className: "flex flex-col h-full"
282
+ }, /* @__PURE__ */ import_react8.default.createElement("div", {
283
+ className: `flx-grow-0 w-full sticky top-0 z-50`
284
+ }, nav), /* @__PURE__ */ import_react8.default.createElement("section", {
285
+ className: "flex-grow flex-shrink-0 px-6"
286
+ }, main), footer && /* @__PURE__ */ import_react8.default.createElement("footer", {
287
+ className: "flex-grow-0 flex-shrink-0 flex items-center justify-center h-64"
288
+ }, footer));
289
+ };
290
+
291
+ // src/pop-confirm/PopConfirm.tsx
292
+ var import_react9 = __toESM(require("react"));
271
293
  var PopConfirm = (props) => {
272
294
  const { onOk, onCancel, children, content, className } = props;
273
- return /* @__PURE__ */ import_react8.default.createElement(Panel, {
295
+ return /* @__PURE__ */ import_react9.default.createElement(Panel, {
274
296
  className
275
- }, /* @__PURE__ */ import_react8.default.createElement("div", {
297
+ }, /* @__PURE__ */ import_react9.default.createElement("div", {
276
298
  className: "mb-32"
277
- }, children || content), /* @__PURE__ */ import_react8.default.createElement("div", {
299
+ }, children || content), /* @__PURE__ */ import_react9.default.createElement("div", {
278
300
  className: "flex justify-end"
279
- }, onCancel && /* @__PURE__ */ import_react8.default.createElement(Button, {
301
+ }, onCancel && /* @__PURE__ */ import_react9.default.createElement(Button, {
280
302
  onClick: onCancel,
281
303
  type: "normal" /* NORMAL */
282
- }, "Cancel"), onOk && /* @__PURE__ */ import_react8.default.createElement(Button, {
304
+ }, "Cancel"), onOk && /* @__PURE__ */ import_react9.default.createElement(Button, {
283
305
  onClick: onOk,
284
306
  className: "ml-16",
285
307
  type: "primary" /* PRIMARY */
286
308
  }, "OK")));
287
309
  };
310
+
311
+ // src/table/Table.tsx
312
+ var import_react10 = __toESM(require("react"));
313
+ var Table = (props) => {
314
+ const { rowCount, rowRenderer, headerRenderer, className } = props;
315
+ const rows = [];
316
+ for (let i = 0; i < rowCount; i++) {
317
+ rows.push(/* @__PURE__ */ import_react10.default.createElement("tr", {
318
+ key: i
319
+ }, rowRenderer(i)));
320
+ }
321
+ return /* @__PURE__ */ import_react10.default.createElement("table", {
322
+ className
323
+ }, headerRenderer && /* @__PURE__ */ import_react10.default.createElement("thead", null, /* @__PURE__ */ import_react10.default.createElement("tr", null, headerRenderer())), /* @__PURE__ */ import_react10.default.createElement("tbody", null, rows));
324
+ };
325
+ Table.HCell = (props) => /* @__PURE__ */ import_react10.default.createElement("th", null, props.children);
326
+ Table.Cell = (props) => /* @__PURE__ */ import_react10.default.createElement("td", null, props.children);
288
327
  module.exports = __toCommonJS(src_exports);
289
328
  // Annotate the CommonJS export names for ESM import in node:
290
329
  0 && (module.exports = {
@@ -296,8 +335,10 @@ module.exports = __toCommonJS(src_exports);
296
335
  LinkColor,
297
336
  Logo,
298
337
  Nav,
338
+ Page,
299
339
  Panel,
300
340
  PopConfirm,
341
+ Table,
301
342
  Tag,
302
343
  Tags
303
344
  });
package/dist/index.mjs CHANGED
@@ -38,7 +38,7 @@ var Article = (props) => {
38
38
  return /* @__PURE__ */ React.createElement("div", {
39
39
  className: classNames("article", className)
40
40
  }, /* @__PURE__ */ React.createElement("div", {
41
- className: "text-[2.25rem]"
41
+ className: "text-[2.25rem] leading-none"
42
42
  }, title), /* @__PURE__ */ React.createElement("hr", {
43
43
  className: "my-64 border-gray-200"
44
44
  }), /* @__PURE__ */ React.createElement("div", {
@@ -130,6 +130,11 @@ var HOVER_COLOR_MAPPING = {
130
130
  ["red" /* RED */]: "hover:bg-red-100",
131
131
  ["gray" /* GRAY */]: "hover:bg-gray-100"
132
132
  };
133
+ var FOCUS_BG_COLOR_MAPPING = {
134
+ ["blue" /* BLUE */]: "focus:bg-blue-600",
135
+ ["red" /* RED */]: "focus:bg-red-500",
136
+ ["gray" /* GRAY */]: "focus:bg-gray-400"
137
+ };
133
138
  var Link = (props) => {
134
139
  const _a = props, {
135
140
  color = "blue" /* BLUE */,
@@ -142,7 +147,7 @@ var Link = (props) => {
142
147
  "className",
143
148
  "children"
144
149
  ]);
145
- const linkCls = classNames2(COLOR_MAPPING[color], className, "rounded", "no-underline", "transition-colors", HOVER_COLOR_MAPPING[color]);
150
+ const linkCls = classNames2(className, "rounded", "no-underline", "transition-colors", "focus:text-white", COLOR_MAPPING[color], HOVER_COLOR_MAPPING[color], FOCUS_BG_COLOR_MAPPING[color]);
146
151
  if (external) {
147
152
  return /* @__PURE__ */ React4.createElement("a", {
148
153
  href: props.to,
@@ -224,25 +229,57 @@ var Panel = (props) => {
224
229
  }, children);
225
230
  };
226
231
 
227
- // src/pop-confirm/PopConfirm.tsx
232
+ // src/page/Page.tsx
228
233
  import React9 from "react";
234
+ var Page = (props) => {
235
+ const { nav, main, footer } = props;
236
+ return /* @__PURE__ */ React9.createElement("main", {
237
+ className: "flex flex-col h-full"
238
+ }, /* @__PURE__ */ React9.createElement("div", {
239
+ className: `flx-grow-0 w-full sticky top-0 z-50`
240
+ }, nav), /* @__PURE__ */ React9.createElement("section", {
241
+ className: "flex-grow flex-shrink-0 px-6"
242
+ }, main), footer && /* @__PURE__ */ React9.createElement("footer", {
243
+ className: "flex-grow-0 flex-shrink-0 flex items-center justify-center h-64"
244
+ }, footer));
245
+ };
246
+
247
+ // src/pop-confirm/PopConfirm.tsx
248
+ import React10 from "react";
229
249
  var PopConfirm = (props) => {
230
250
  const { onOk, onCancel, children, content, className } = props;
231
- return /* @__PURE__ */ React9.createElement(Panel, {
251
+ return /* @__PURE__ */ React10.createElement(Panel, {
232
252
  className
233
- }, /* @__PURE__ */ React9.createElement("div", {
253
+ }, /* @__PURE__ */ React10.createElement("div", {
234
254
  className: "mb-32"
235
- }, children || content), /* @__PURE__ */ React9.createElement("div", {
255
+ }, children || content), /* @__PURE__ */ React10.createElement("div", {
236
256
  className: "flex justify-end"
237
- }, onCancel && /* @__PURE__ */ React9.createElement(Button, {
257
+ }, onCancel && /* @__PURE__ */ React10.createElement(Button, {
238
258
  onClick: onCancel,
239
259
  type: "normal" /* NORMAL */
240
- }, "Cancel"), onOk && /* @__PURE__ */ React9.createElement(Button, {
260
+ }, "Cancel"), onOk && /* @__PURE__ */ React10.createElement(Button, {
241
261
  onClick: onOk,
242
262
  className: "ml-16",
243
263
  type: "primary" /* PRIMARY */
244
264
  }, "OK")));
245
265
  };
266
+
267
+ // src/table/Table.tsx
268
+ import React11 from "react";
269
+ var Table = (props) => {
270
+ const { rowCount, rowRenderer, headerRenderer, className } = props;
271
+ const rows = [];
272
+ for (let i = 0; i < rowCount; i++) {
273
+ rows.push(/* @__PURE__ */ React11.createElement("tr", {
274
+ key: i
275
+ }, rowRenderer(i)));
276
+ }
277
+ return /* @__PURE__ */ React11.createElement("table", {
278
+ className
279
+ }, headerRenderer && /* @__PURE__ */ React11.createElement("thead", null, /* @__PURE__ */ React11.createElement("tr", null, headerRenderer())), /* @__PURE__ */ React11.createElement("tbody", null, rows));
280
+ };
281
+ Table.HCell = (props) => /* @__PURE__ */ React11.createElement("th", null, props.children);
282
+ Table.Cell = (props) => /* @__PURE__ */ React11.createElement("td", null, props.children);
246
283
  export {
247
284
  Article,
248
285
  Breadcrumb,
@@ -252,8 +289,10 @@ export {
252
289
  LinkColor,
253
290
  Logo,
254
291
  Nav,
292
+ Page,
255
293
  Panel,
256
294
  PopConfirm,
295
+ Table,
257
296
  Tag,
258
297
  Tags
259
298
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/components",
3
- "version": "1.4.6",
3
+ "version": "1.5.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -34,6 +34,7 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "classnames": "^2.3.1",
37
- "react-router-dom": "5.3.0"
37
+ "react-router-dom": "5.3.0",
38
+ "@tailwindcss/typography": "^0.5.0"
38
39
  }
39
40
  }