@react-hive/honey-layout 8.1.0 → 9.0.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.
@@ -2,16 +2,16 @@ import { FastOmit } from '@react-hive/honey-style';
2
2
  import { HoneyListGenericProps, HoneyListItem } from './HoneyList.types';
3
3
  import { HoneyStatusContentProps } from '../HoneyStatusContent';
4
4
  import { HoneyListStyledProps } from './HoneyListStyled';
5
- export type HoneyListProps<Item extends HoneyListItem> = FastOmit<HoneyListStyledProps, 'children'> & HoneyListGenericProps<Item> & FastOmit<HoneyStatusContentProps, 'isNoContent'>;
5
+ export type HoneyListProps<Item extends HoneyListItem> = FastOmit<HoneyListStyledProps, 'children'> & HoneyListGenericProps<Item> & FastOmit<HoneyStatusContentProps, 'empty'>;
6
6
  /**
7
7
  * A generic and reusable list component that handles different states such as loading, error, or no content,
8
8
  * and dynamically renders a list of items with custom content for each item.
9
9
  *
10
10
  * This component provides a flexible and accessible way to display lists, with built-in support for
11
- * various states to enhance user experience. It accepts a `ref` to access the underlying HTML element
11
+ * various states to enhance the user experience. It accepts a `ref` to access the underlying HTML element
12
12
  * for greater control and customization.
13
13
  *
14
14
  * @template Item - Represents the type of the items to be rendered in the list. This allows the component
15
15
  * to be used with any item type.
16
16
  */
17
- export declare const HoneyList: <Item extends HoneyListItem>({ ref, children, items, itemKey, isLoading, isLoadingOverContent, loadingContent, isError, errorContent, noContent, ...props }: HoneyListProps<Item>) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const HoneyList: <Item extends HoneyListItem>({ ref, children, items, itemKey, loading, loadingOverContent, loadingContent, error, errorContent, emptyContent, ...props }: HoneyListProps<Item>) => import("react/jsx-runtime").JSX.Element;
@@ -9,45 +9,45 @@ export interface HoneyStatusContentProps {
9
9
  *
10
10
  * @default false
11
11
  */
12
- isLoading?: boolean;
12
+ loading?: boolean;
13
13
  /**
14
- * A flag indicating whether the loading content should appear on top of the content.
14
+ * The content to display when the component is in a loading state.
15
15
  *
16
- * @default false
16
+ * @default null
17
17
  */
18
- isLoadingOverContent?: boolean;
18
+ loadingContent?: ReactNode;
19
19
  /**
20
- * A flag indicating whether the component has encountered an error.
20
+ * A flag indicating whether the loading content should appear on top of the content.
21
21
  *
22
22
  * @default false
23
23
  */
24
- isError?: boolean;
24
+ loadingOverContent?: boolean;
25
25
  /**
26
- * A flag indicating whether the component has no content to display.
26
+ * A flag indicating whether the component has encountered an error.
27
27
  *
28
28
  * @default false
29
29
  */
30
- isNoContent?: boolean;
30
+ error?: boolean;
31
31
  /**
32
- * The content to display when the component is in a loading state.
32
+ * The content to display when the component has encountered an error.
33
33
  *
34
34
  * @default null
35
35
  */
36
- loadingContent?: ReactNode;
36
+ errorContent?: ReactNode;
37
37
  /**
38
- * The content to display when the component has encountered an error.
38
+ * A flag indicating whether the component has no content to display.
39
39
  *
40
- * @default null
40
+ * @default false
41
41
  */
42
- errorContent?: ReactNode;
42
+ empty?: boolean;
43
43
  /**
44
44
  * The content to display when the component has no content to display.
45
45
  *
46
46
  * @default null
47
47
  */
48
- noContent?: ReactNode;
48
+ emptyContent?: ReactNode;
49
49
  }
50
50
  /**
51
51
  * A component that conditionally renders blocks based on specified boolean flags.
52
52
  */
53
- export declare const HoneyStatusContent: ({ children, isLoading, isLoadingOverContent, isError, isNoContent, loadingContent, errorContent, noContent, }: PropsWithChildren<HoneyStatusContentProps>) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
53
+ export declare const HoneyStatusContent: ({ children, loading, loadingOverContent, error, empty, loadingContent, errorContent, emptyContent, }: PropsWithChildren<HoneyStatusContentProps>) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
package/dist/index.js CHANGED
@@ -12,14 +12,17 @@ const cs = [
12
12
  e.forEach((n) => {
13
13
  typeof n == "function" ? n(t) : n && typeof n == "object" && (n.current = t);
14
14
  });
15
- }, us = (e) => e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`), pr = (e) => e.split(" ").filter(Boolean), _n = (e, ...t) => typeof e == "function" ? e(...t) : e, ls = (e, t, n, r) => {
16
- const o = n - e, i = r - t;
17
- return Math.sqrt(o ** 2 + i ** 2);
18
- }, mr = (e, t) => Math.abs(e / t);
15
+ }, us = (e) => {
16
+ const t = e.charAt(0), n = e.slice(1);
17
+ return t.toLowerCase() + n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`);
18
+ }, pr = (e) => e.split(" ").filter(Boolean);
19
19
  function Fn(e, t) {
20
20
  if (!e) throw new Error(t);
21
21
  }
22
- const fs = () => {
22
+ const _n = (e, ...t) => typeof e == "function" ? e(...t) : e, ls = (e, t, n, r) => {
23
+ const o = n - e, i = r - t;
24
+ return Math.sqrt(o ** 2 + i ** 2);
25
+ }, mr = (e, t) => Math.abs(e / t), fs = () => {
23
26
  const e = Date.now().toString(), t = Math.floor(Math.random() * 1e4).toString().padStart(4, "0");
24
27
  return `${e}${t}`;
25
28
  }, ds = (e) => ts.includes(e), gs = (e) => ns.includes(e), io = (e) => e[0] === "$", ps = (e, t, n) => {
@@ -464,13 +467,13 @@ const uo = kn(void 0), lo = lt(Jt)`
464
467
  );
465
468
  }, Ts = (e, t, n) => typeof t == "function" ? t(e) : typeof e == "string" || typeof e == "number" ? e : t ? e[t] : n, Ss = ({
466
469
  children: e,
467
- isLoading: t = !1,
468
- isLoadingOverContent: n = !1,
469
- isError: r = !1,
470
- isNoContent: o = !1,
470
+ loading: t = !1,
471
+ loadingOverContent: n = !1,
472
+ error: r = !1,
473
+ empty: o = !1,
471
474
  loadingContent: i = null,
472
475
  errorContent: s = null,
473
- noContent: u = null
476
+ emptyContent: u = null
474
477
  }) => r ? s : !n && t ? i : /* @__PURE__ */ G.jsxs(G.Fragment, { children: [
475
478
  n && t && i,
476
479
  o ? u : e
@@ -484,12 +487,12 @@ const uo = kn(void 0), lo = lt(Jt)`
484
487
  children: t,
485
488
  items: n,
486
489
  itemKey: r,
487
- isLoading: o,
488
- isLoadingOverContent: i,
490
+ loading: o,
491
+ loadingOverContent: i,
489
492
  loadingContent: s,
490
- isError: u,
493
+ error: u,
491
494
  errorContent: l,
492
- noContent: c,
495
+ emptyContent: c,
493
496
  ...p
494
497
  }) => /* @__PURE__ */ G.jsx(
495
498
  Os,
@@ -502,13 +505,13 @@ const uo = kn(void 0), lo = lt(Jt)`
502
505
  children: /* @__PURE__ */ G.jsx(
503
506
  Ss,
504
507
  {
505
- isLoading: o,
506
- isLoadingOverContent: i,
508
+ loading: o,
509
+ loadingOverContent: i,
507
510
  loadingContent: s,
508
- isError: u,
511
+ error: u,
509
512
  errorContent: l,
510
- isNoContent: n?.length === 0,
511
- noContent: c,
513
+ empty: n?.length === 0,
514
+ emptyContent: c,
512
515
  children: n?.map((f, a, g) => /* @__PURE__ */ G.jsx(ss, { children: t(f, a, g) }, String(Ts(f, r, a))))
513
516
  }
514
517
  )
@@ -4739,7 +4742,7 @@ const uu = ({ children: e, enabled: t = !0, ...n }) => {
4739
4742
  ),
4740
4743
  [e]
4741
4744
  );
4742
- return /* @__PURE__ */ G.jsx(_s, { items: u, itemKey: "id", noContent: "No options", children: (l) => l.options?.length ? /* @__PURE__ */ G.jsx(
4745
+ return /* @__PURE__ */ G.jsx(_s, { items: u, itemKey: "id", emptyContent: "No options", children: (l) => l.options?.length ? /* @__PURE__ */ G.jsx(
4743
4746
  Go,
4744
4747
  {
4745
4748
  context: i,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-hive/honey-layout",
3
- "version": "8.1.0",
3
+ "version": "9.0.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "react",
@@ -41,7 +41,7 @@
41
41
  "@floating-ui/dom": "1.7.2",
42
42
  "@floating-ui/react": "0.27.13",
43
43
  "@mdx-js/react": "3.1.0",
44
- "@react-hive/honey-utils": "1.2.0",
44
+ "@react-hive/honey-utils": "1.7.0",
45
45
  "csstype": "3.1.3",
46
46
  "highlight.js": "11.11.1",
47
47
  "lodash.merge": "4.6.2",