@behivetech/molecules.empty-state 0.3.5 → 1.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BEhive Tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs CHANGED
@@ -25,15 +25,31 @@ __export(index_exports, {
25
25
  module.exports = __toCommonJS(index_exports);
26
26
 
27
27
  // empty-state.tsx
28
- var import_get_class_name = require("@behivetech/get-class-name");
28
+ var import_blocks2 = require("@behivetech/blocks.core");
29
29
 
30
- // empty-state.module.scss
31
- var empty_state_module_default = {
32
- "BHT__EmptyState": "BHT__EmptyState",
33
- "BHT__EmptyState__icon": "BHT__EmptyState__icon",
34
- "BHT__EmptyState__description": "BHT__EmptyState__description",
35
- "BHT__EmptyState__action": "BHT__EmptyState__action"
36
- };
30
+ // empty-state.block.ts
31
+ var import_blocks = require("@behivetech/blocks.core");
32
+ var import_tokens = require("@behivetech/blocks.core/tokens");
33
+ var { color, spacing, type } = import_tokens.tokens;
34
+ var emptyState = (0, import_blocks.defineBlock)("BHT__EmptyState", {
35
+ display: "flex",
36
+ flexDirection: "column",
37
+ alignItems: "center",
38
+ justifyContent: "center",
39
+ gap: spacing[4],
40
+ textAlign: "center",
41
+ color: color.onSurfaceVariant,
42
+ fontFamily: type.bodyMedium.font,
43
+ fontSize: type.bodyMedium.size,
44
+ fontWeight: type.bodyMedium.weight,
45
+ lineHeight: type.bodyMedium.lineHeight,
46
+ letterSpacing: type.bodyMedium.tracking,
47
+ children: {
48
+ icon: { fontSize: "2.5rem", opacity: 0.4, web: { lineHeight: "1" } },
49
+ description: { margin: 0 },
50
+ action: { display: "inline-flex" }
51
+ }
52
+ });
37
53
 
38
54
  // empty-state.tsx
39
55
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -42,17 +58,18 @@ var EmptyState = ({
42
58
  icon,
43
59
  description,
44
60
  children,
61
+ styles,
45
62
  ...rest
46
63
  }) => {
47
- const [rootClass, getChildClass] = (0, import_get_class_name.getClassName)({
48
- className,
49
- rootClass: "BHT__EmptyState",
50
- styles: empty_state_module_default
51
- });
52
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...rest, className: rootClass, children: [
53
- icon !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getChildClass("icon"), children: icon }),
54
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: getChildClass("description"), children: description }),
55
- children !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getChildClass("action"), children })
64
+ const [rootProps, childProps] = (0, import_blocks2.useBlock)(
65
+ emptyState,
66
+ {},
67
+ { className, styles }
68
+ );
69
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...rest, ...rootProps, children: [
70
+ icon !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...childProps("icon"), children: icon }),
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { ...childProps("description"), children: description }),
72
+ children !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...childProps("action"), children })
56
73
  ] });
57
74
  };
58
75
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.css CHANGED
@@ -1,26 +1,28 @@
1
- /* esbuild-sass-plugin:css-chunkempty-state.module.scss */
2
- .BHT__EmptyState {
3
- display: flex;
4
- flex-direction: column;
5
- align-items: center;
6
- justify-content: center;
7
- gap: var(--spacing-4);
8
- text-align: center;
9
- color: var(--md-sys-color-on-surface-variant, var(--color-text-muted));
10
- font-family: var(--md-sys-typescale-body-medium-font, var(--font-body));
11
- font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
12
- font-weight: var(--md-sys-typescale-body-medium-weight, 400);
13
- line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
14
- letter-spacing: var(--md-sys-typescale-body-medium-tracking, 0.0179em);
15
- }
16
- .BHT__EmptyState__icon {
17
- font-size: 2.5rem;
18
- line-height: 1;
19
- opacity: 0.4;
20
- }
21
- .BHT__EmptyState__description {
22
- margin: 0;
23
- }
24
- .BHT__EmptyState__action {
25
- display: inline-flex;
1
+ /* empty-state.block.css */
2
+ @layer bht {
3
+ .BHT__EmptyState {
4
+ display: flex;
5
+ flex-direction: column;
6
+ align-items: center;
7
+ justify-content: center;
8
+ gap: var(--spacing-4, 1rem);
9
+ text-align: center;
10
+ color: var(--md-sys-color-on-surface-variant, #474747);
11
+ font-family: var( --md-sys-typescale-body-medium-font, "Inter", system-ui, -apple-system, sans-serif );
12
+ font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
13
+ font-weight: var(--md-sys-typescale-body-medium-weight, 400);
14
+ line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
15
+ letter-spacing: var(--md-sys-typescale-body-medium-tracking, 0.0179em);
16
+ }
17
+ .BHT__EmptyState__icon {
18
+ font-size: 2.5rem;
19
+ opacity: 0.4;
20
+ line-height: 1;
21
+ }
22
+ .BHT__EmptyState__description {
23
+ margin: 0;
24
+ }
25
+ .BHT__EmptyState__action {
26
+ display: inline-flex;
27
+ }
26
28
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,37 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
+ import * as _behivetech_blocks_core from '@behivetech/blocks.core';
4
+ import { StylesFor } from '@behivetech/blocks.core';
5
+
6
+ declare const emptyState: _behivetech_blocks_core.Block<"BHT__EmptyState", {
7
+ readonly display: "flex";
8
+ readonly flexDirection: "column";
9
+ readonly alignItems: "center";
10
+ readonly justifyContent: "center";
11
+ readonly gap: _behivetech_blocks_core.Token<"length">;
12
+ readonly textAlign: "center";
13
+ readonly color: _behivetech_blocks_core.Token<"color">;
14
+ readonly fontFamily: _behivetech_blocks_core.Token<"font">;
15
+ readonly fontSize: _behivetech_blocks_core.Token<"length">;
16
+ readonly fontWeight: _behivetech_blocks_core.Token<"weight">;
17
+ readonly lineHeight: _behivetech_blocks_core.Token<"length">;
18
+ readonly letterSpacing: _behivetech_blocks_core.Token<"tracking">;
19
+ readonly children: {
20
+ readonly icon: {
21
+ readonly fontSize: "2.5rem";
22
+ readonly opacity: 0.4;
23
+ readonly web: {
24
+ readonly lineHeight: "1";
25
+ };
26
+ };
27
+ readonly description: {
28
+ readonly margin: 0;
29
+ };
30
+ readonly action: {
31
+ readonly display: "inline-flex";
32
+ };
33
+ };
34
+ }>;
3
35
 
4
36
  interface EmptyStateProps extends HTMLAttributes<HTMLDivElement> {
5
37
  /** Additional class names to merge with the component root element */
@@ -10,12 +42,14 @@ interface EmptyStateProps extends HTMLAttributes<HTMLDivElement> {
10
42
  description: ReactNode;
11
43
  /** Action content rendered below the description (typically a Button) */
12
44
  children?: ReactNode;
45
+ /** An override block made with `defineBlock`, typed to this component's children and variants; it wins over the block's own styles. */
46
+ styles?: StylesFor<typeof emptyState>;
13
47
  }
14
48
  /**
15
49
  * Generic centered placeholder for empty lists/grids/results: icon, a
16
50
  * description, and an optional action. Modeled on AntD's `Empty` — reusable
17
51
  * anywhere something has nothing to show yet, not tied to any one feature.
18
52
  */
19
- declare const EmptyState: ({ className, icon, description, children, ...rest }: EmptyStateProps) => react.JSX.Element;
53
+ declare const EmptyState: ({ className, icon, description, children, styles, ...rest }: EmptyStateProps) => react.JSX.Element;
20
54
 
21
55
  export { EmptyState, type EmptyStateProps };
package/dist/index.js CHANGED
@@ -1,13 +1,29 @@
1
1
  // empty-state.tsx
2
- import { getClassName } from "@behivetech/get-class-name";
2
+ import { useBlock } from "@behivetech/blocks.core";
3
3
 
4
- // empty-state.module.scss
5
- var empty_state_module_default = {
6
- "BHT__EmptyState": "BHT__EmptyState",
7
- "BHT__EmptyState__icon": "BHT__EmptyState__icon",
8
- "BHT__EmptyState__description": "BHT__EmptyState__description",
9
- "BHT__EmptyState__action": "BHT__EmptyState__action"
10
- };
4
+ // empty-state.block.ts
5
+ import { defineBlock } from "@behivetech/blocks.core";
6
+ import { tokens } from "@behivetech/blocks.core/tokens";
7
+ var { color, spacing, type } = tokens;
8
+ var emptyState = defineBlock("BHT__EmptyState", {
9
+ display: "flex",
10
+ flexDirection: "column",
11
+ alignItems: "center",
12
+ justifyContent: "center",
13
+ gap: spacing[4],
14
+ textAlign: "center",
15
+ color: color.onSurfaceVariant,
16
+ fontFamily: type.bodyMedium.font,
17
+ fontSize: type.bodyMedium.size,
18
+ fontWeight: type.bodyMedium.weight,
19
+ lineHeight: type.bodyMedium.lineHeight,
20
+ letterSpacing: type.bodyMedium.tracking,
21
+ children: {
22
+ icon: { fontSize: "2.5rem", opacity: 0.4, web: { lineHeight: "1" } },
23
+ description: { margin: 0 },
24
+ action: { display: "inline-flex" }
25
+ }
26
+ });
11
27
 
12
28
  // empty-state.tsx
13
29
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -16,17 +32,18 @@ var EmptyState = ({
16
32
  icon,
17
33
  description,
18
34
  children,
35
+ styles,
19
36
  ...rest
20
37
  }) => {
21
- const [rootClass, getChildClass] = getClassName({
22
- className,
23
- rootClass: "BHT__EmptyState",
24
- styles: empty_state_module_default
25
- });
26
- return /* @__PURE__ */ jsxs("div", { ...rest, className: rootClass, children: [
27
- icon !== void 0 && /* @__PURE__ */ jsx("div", { className: getChildClass("icon"), children: icon }),
28
- /* @__PURE__ */ jsx("p", { className: getChildClass("description"), children: description }),
29
- children !== void 0 && /* @__PURE__ */ jsx("div", { className: getChildClass("action"), children })
38
+ const [rootProps, childProps] = useBlock(
39
+ emptyState,
40
+ {},
41
+ { className, styles }
42
+ );
43
+ return /* @__PURE__ */ jsxs("div", { ...rest, ...rootProps, children: [
44
+ icon !== void 0 && /* @__PURE__ */ jsx("div", { ...childProps("icon"), children: icon }),
45
+ /* @__PURE__ */ jsx("p", { ...childProps("description"), children: description }),
46
+ children !== void 0 && /* @__PURE__ */ jsx("div", { ...childProps("action"), children })
30
47
  ] });
31
48
  };
32
49
  export {
@@ -0,0 +1,113 @@
1
+ // empty-state.native.tsx
2
+ import {
3
+ holdsText,
4
+ useBlock
5
+ } from "@behivetech/blocks.core/native";
6
+ import {
7
+ Text,
8
+ View
9
+ } from "react-native";
10
+
11
+ // empty-state.block.native.ts
12
+ import { createNativeBlock as __bhtCreateNativeBlock } from "@behivetech/blocks.core/native";
13
+ import { StyleSheet as __bhtStyleSheet } from "react-native";
14
+ var __bht0_shared = __bhtStyleSheet.create({
15
+ __icon: { fontSize: 40, opacity: 0.4 },
16
+ __description: {
17
+ marginTop: 0,
18
+ marginRight: 0,
19
+ marginBottom: 0,
20
+ marginLeft: 0
21
+ },
22
+ __action: { display: "flex", flexDirection: "row" }
23
+ });
24
+ var __bht0_light = __bhtStyleSheet.create({
25
+ root: {
26
+ display: "flex",
27
+ flexDirection: "column",
28
+ alignItems: "center",
29
+ justifyContent: "center",
30
+ rowGap: 16,
31
+ columnGap: 16,
32
+ textAlign: "center",
33
+ color: "#474747",
34
+ fontFamily: "Inter",
35
+ fontSize: 14,
36
+ fontWeight: "400",
37
+ lineHeight: 20,
38
+ letterSpacing: 0.2506
39
+ },
40
+ "root~text": {
41
+ textAlign: "center",
42
+ color: "#474747",
43
+ fontFamily: "Inter",
44
+ fontSize: 14,
45
+ fontWeight: "400",
46
+ lineHeight: 20,
47
+ letterSpacing: 0.2506
48
+ }
49
+ });
50
+ var __bht0_dark = __bhtStyleSheet.create({
51
+ root: {
52
+ display: "flex",
53
+ flexDirection: "column",
54
+ alignItems: "center",
55
+ justifyContent: "center",
56
+ rowGap: 16,
57
+ columnGap: 16,
58
+ textAlign: "center",
59
+ color: "#c6c6c6",
60
+ fontFamily: "Inter",
61
+ fontSize: 14,
62
+ fontWeight: "400",
63
+ lineHeight: 20,
64
+ letterSpacing: 0.2506
65
+ },
66
+ "root~text": {
67
+ textAlign: "center",
68
+ color: "#c6c6c6",
69
+ fontFamily: "Inter",
70
+ fontSize: 14,
71
+ fontWeight: "400",
72
+ lineHeight: 20,
73
+ letterSpacing: 0.2506
74
+ }
75
+ });
76
+ var emptyState = __bhtCreateNativeBlock("BHT__EmptyState", {
77
+ structure: { children: { icon: {}, description: {}, action: {} } },
78
+ sheets: {
79
+ light: { ...__bht0_shared, ...__bht0_light },
80
+ dark: { ...__bht0_shared, ...__bht0_dark }
81
+ },
82
+ plan: {
83
+ root: [{ key: "root" }],
84
+ children: {
85
+ icon: [{ key: "root~text" }, { key: "__icon" }],
86
+ description: [{ key: "root~text" }, { key: "__description" }],
87
+ action: [{ key: "root~text" }, { key: "__action" }]
88
+ }
89
+ }
90
+ });
91
+
92
+ // empty-state.native.tsx
93
+ import { jsx, jsxs } from "react/jsx-runtime";
94
+ var EmptyState = ({
95
+ style,
96
+ styles,
97
+ icon,
98
+ description,
99
+ children,
100
+ ...rest
101
+ }) => {
102
+ const [rootProps, childProps] = useBlock(emptyState, {}, { style, styles });
103
+ const IconWrapper = holdsText(icon) ? Text : View;
104
+ const ActionWrapper = holdsText(children) ? Text : View;
105
+ return /* @__PURE__ */ jsxs(View, { ...rest, ...rootProps, children: [
106
+ icon !== void 0 && /* @__PURE__ */ jsx(IconWrapper, { ...childProps("icon"), children: icon }),
107
+ /* @__PURE__ */ jsx(Text, { ...childProps("description"), children: description }),
108
+ children !== void 0 && /* @__PURE__ */ jsx(ActionWrapper, { ...childProps("action"), children })
109
+ ] });
110
+ };
111
+ export {
112
+ EmptyState
113
+ };
@@ -0,0 +1,29 @@
1
+ export declare const emptyState: import("@behivetech/blocks.core").Block<"BHT__EmptyState", {
2
+ readonly display: "flex";
3
+ readonly flexDirection: "column";
4
+ readonly alignItems: "center";
5
+ readonly justifyContent: "center";
6
+ readonly gap: import("@behivetech/blocks.core").Token<"length">;
7
+ readonly textAlign: "center";
8
+ readonly color: import("@behivetech/blocks.core").Token<"color">;
9
+ readonly fontFamily: import("@behivetech/blocks.core").Token<"font">;
10
+ readonly fontSize: import("@behivetech/blocks.core").Token<"length">;
11
+ readonly fontWeight: import("@behivetech/blocks.core").Token<"weight">;
12
+ readonly lineHeight: import("@behivetech/blocks.core").Token<"length">;
13
+ readonly letterSpacing: import("@behivetech/blocks.core").Token<"tracking">;
14
+ readonly children: {
15
+ readonly icon: {
16
+ readonly fontSize: "2.5rem";
17
+ readonly opacity: 0.4;
18
+ readonly web: {
19
+ readonly lineHeight: "1";
20
+ };
21
+ };
22
+ readonly description: {
23
+ readonly margin: 0;
24
+ };
25
+ readonly action: {
26
+ readonly display: "inline-flex";
27
+ };
28
+ };
29
+ }>;
@@ -0,0 +1,2 @@
1
+ import type { emptyState as __bht0_source } from "./empty-state.block";
2
+ export declare const emptyState: typeof __bht0_source;
@@ -0,0 +1,22 @@
1
+ import { type StylesFor } from "@behivetech/blocks.core/native";
2
+ import { type ReactNode } from "react";
3
+ import { type StyleProp, type ViewProps, type ViewStyle } from "react-native";
4
+ import { emptyState } from "./empty-state.block.native";
5
+ export interface EmptyStateProps extends Omit<ViewProps, "style"> {
6
+ /** Additional styles, appended after the block's own */
7
+ style?: StyleProp<ViewStyle>;
8
+ /** An override block made with `defineBlock`, typed to this component's children and variants; it wins over the block's own styles. */
9
+ styles?: StylesFor<typeof emptyState>;
10
+ /** Icon or illustration shown above the description */
11
+ icon?: ReactNode;
12
+ /** Message explaining the empty state */
13
+ description: ReactNode;
14
+ /** Action content rendered below the description (typically a Button) */
15
+ children?: ReactNode;
16
+ }
17
+ /**
18
+ * The React Native renderer of EmptyState: the same block as the web one, with the same props. An icon or an
19
+ * action given as text (a string or a number, alone or in a list or a fragment) is wrapped in a `Text`, which
20
+ * takes the block's color and type; any other node is rendered as it is.
21
+ */
22
+ export declare const EmptyState: ({ style, styles, icon, description, children, ...rest }: EmptyStateProps) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { EmptyState } from "./empty-state.native";
2
+ export type { EmptyStateProps } from "./empty-state.native";
package/docs.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://github.com/behivetech/bht-component-registry/docs.schema.json",
3
3
  "version": 2,
4
- "generatedAt": "2026-11-11T04:39:23.300Z",
4
+ "generatedAt": "2026-11-26T18:10:54.321Z",
5
5
  "docs": [
6
6
  {
7
7
  "displayName": "EmptyState",
@@ -35,6 +35,13 @@
35
35
  "required": false,
36
36
  "defaultValue": null,
37
37
  "description": "Icon or illustration shown above the description"
38
+ },
39
+ {
40
+ "name": "styles",
41
+ "type": "StylesFor<Block<\"BHT__EmptyState\", { readonly display: \"flex\"; readonly flexDirection: \"column\"; readonly alignItems: \"center\"; readonly justifyContent: \"center\"; readonly gap: Token<\"length\">; ... 7 more ...; readonly children: { ...; }; }>>",
42
+ "required": false,
43
+ "defaultValue": null,
44
+ "description": "An override block made with `defineBlock`, typed to this component's children and variants; it wins over the block's own styles."
38
45
  }
39
46
  ]
40
47
  }
@@ -0,0 +1,38 @@
1
+ /* GENERATED from empty-state.block.ts by @behivetech/blocks.builder. Do not edit by hand: run `pnpm block:build`. */
2
+
3
+ @layer bht {
4
+ .BHT__EmptyState {
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ justify-content: center;
9
+ gap: var(--spacing-4, 1rem);
10
+ text-align: center;
11
+ color: var(--md-sys-color-on-surface-variant, #474747);
12
+ font-family: var(
13
+ --md-sys-typescale-body-medium-font,
14
+ "Inter",
15
+ system-ui,
16
+ -apple-system,
17
+ sans-serif
18
+ );
19
+ font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
20
+ font-weight: var(--md-sys-typescale-body-medium-weight, 400);
21
+ line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
22
+ letter-spacing: var(--md-sys-typescale-body-medium-tracking, 0.0179em);
23
+ }
24
+
25
+ .BHT__EmptyState__icon {
26
+ font-size: 2.5rem;
27
+ opacity: 0.4;
28
+ line-height: 1;
29
+ }
30
+
31
+ .BHT__EmptyState__description {
32
+ margin: 0;
33
+ }
34
+
35
+ .BHT__EmptyState__action {
36
+ display: inline-flex;
37
+ }
38
+ }
@@ -0,0 +1,85 @@
1
+ // GENERATED from empty-state.block.ts by @behivetech/blocks.builder. Do not edit by hand: run `pnpm block:build`.
2
+ import { createNativeBlock as __bhtCreateNativeBlock } from "@behivetech/blocks.core/native";
3
+ import { StyleSheet as __bhtStyleSheet } from "react-native";
4
+ import type { emptyState as __bht0_source } from "./empty-state.block";
5
+
6
+ // Entries that read no color token are one object in both schemes.
7
+ const __bht0_shared = __bhtStyleSheet.create({
8
+ __icon: { fontSize: 40, opacity: 0.4 },
9
+ __description: {
10
+ marginTop: 0,
11
+ marginRight: 0,
12
+ marginBottom: 0,
13
+ marginLeft: 0,
14
+ },
15
+ __action: { display: "flex", flexDirection: "row" },
16
+ });
17
+ const __bht0_light = __bhtStyleSheet.create({
18
+ root: {
19
+ display: "flex",
20
+ flexDirection: "column",
21
+ alignItems: "center",
22
+ justifyContent: "center",
23
+ rowGap: 16,
24
+ columnGap: 16,
25
+ textAlign: "center",
26
+ color: "#474747",
27
+ fontFamily: "Inter",
28
+ fontSize: 14,
29
+ fontWeight: "400",
30
+ lineHeight: 20,
31
+ letterSpacing: 0.2506,
32
+ },
33
+ "root~text": {
34
+ textAlign: "center",
35
+ color: "#474747",
36
+ fontFamily: "Inter",
37
+ fontSize: 14,
38
+ fontWeight: "400",
39
+ lineHeight: 20,
40
+ letterSpacing: 0.2506,
41
+ },
42
+ });
43
+ const __bht0_dark = __bhtStyleSheet.create({
44
+ root: {
45
+ display: "flex",
46
+ flexDirection: "column",
47
+ alignItems: "center",
48
+ justifyContent: "center",
49
+ rowGap: 16,
50
+ columnGap: 16,
51
+ textAlign: "center",
52
+ color: "#c6c6c6",
53
+ fontFamily: "Inter",
54
+ fontSize: 14,
55
+ fontWeight: "400",
56
+ lineHeight: 20,
57
+ letterSpacing: 0.2506,
58
+ },
59
+ "root~text": {
60
+ textAlign: "center",
61
+ color: "#c6c6c6",
62
+ fontFamily: "Inter",
63
+ fontSize: 14,
64
+ fontWeight: "400",
65
+ lineHeight: 20,
66
+ letterSpacing: 0.2506,
67
+ },
68
+ });
69
+ export const emptyState: typeof __bht0_source = __bhtCreateNativeBlock<
70
+ typeof __bht0_source
71
+ >("BHT__EmptyState", {
72
+ structure: { children: { icon: {}, description: {}, action: {} } },
73
+ sheets: {
74
+ light: { ...__bht0_shared, ...__bht0_light },
75
+ dark: { ...__bht0_shared, ...__bht0_dark },
76
+ },
77
+ plan: {
78
+ root: [{ key: "root" }],
79
+ children: {
80
+ icon: [{ key: "root~text" }, { key: "__icon" }],
81
+ description: [{ key: "root~text" }, { key: "__description" }],
82
+ action: [{ key: "root~text" }, { key: "__action" }],
83
+ },
84
+ },
85
+ });
@@ -0,0 +1,23 @@
1
+ // Converted from empty-state.module.scss by `block convert`; this file is the source from here on.
2
+ import { defineBlock } from "@behivetech/blocks.core";
3
+ import { tokens } from "@behivetech/blocks.core/tokens";
4
+ const { color, spacing, type } = tokens;
5
+ export const emptyState = defineBlock("BHT__EmptyState", {
6
+ display: "flex",
7
+ flexDirection: "column",
8
+ alignItems: "center",
9
+ justifyContent: "center",
10
+ gap: spacing[4],
11
+ textAlign: "center",
12
+ color: color.onSurfaceVariant,
13
+ fontFamily: type.bodyMedium.font,
14
+ fontSize: type.bodyMedium.size,
15
+ fontWeight: type.bodyMedium.weight,
16
+ lineHeight: type.bodyMedium.lineHeight,
17
+ letterSpacing: type.bodyMedium.tracking,
18
+ children: {
19
+ icon: { fontSize: "2.5rem", opacity: 0.4, web: { lineHeight: "1" } },
20
+ description: { margin: 0 },
21
+ action: { display: "inline-flex" },
22
+ },
23
+ });
@@ -0,0 +1,57 @@
1
+ import {
2
+ holdsText,
3
+ useBlock,
4
+ type StylesFor,
5
+ } from "@behivetech/blocks.core/native";
6
+ import { type ReactNode } from "react";
7
+ import {
8
+ Text,
9
+ View,
10
+ type StyleProp,
11
+ type ViewProps,
12
+ type ViewStyle,
13
+ } from "react-native";
14
+ import { emptyState } from "./empty-state.block";
15
+
16
+ export interface EmptyStateProps extends Omit<ViewProps, "style"> {
17
+ /** Additional styles, appended after the block's own */
18
+ style?: StyleProp<ViewStyle>;
19
+ /** An override block made with `defineBlock`, typed to this component's children and variants; it wins over the block's own styles. */
20
+ styles?: StylesFor<typeof emptyState>;
21
+ /** Icon or illustration shown above the description */
22
+ icon?: ReactNode;
23
+ /** Message explaining the empty state */
24
+ description: ReactNode;
25
+ /** Action content rendered below the description (typically a Button) */
26
+ children?: ReactNode;
27
+ }
28
+
29
+ /**
30
+ * The React Native renderer of EmptyState: the same block as the web one, with the same props. An icon or an
31
+ * action given as text (a string or a number, alone or in a list or a fragment) is wrapped in a `Text`, which
32
+ * takes the block's color and type; any other node is rendered as it is.
33
+ */
34
+ export const EmptyState = ({
35
+ style,
36
+ styles,
37
+ icon,
38
+ description,
39
+ children,
40
+ ...rest
41
+ }: EmptyStateProps) => {
42
+ const [rootProps, childProps] = useBlock(emptyState, {}, { style, styles });
43
+ const IconWrapper = holdsText(icon) ? Text : View;
44
+ const ActionWrapper = holdsText(children) ? Text : View;
45
+
46
+ return (
47
+ <View {...rest} {...rootProps}>
48
+ {icon !== undefined && (
49
+ <IconWrapper {...childProps("icon")}>{icon}</IconWrapper>
50
+ )}
51
+ <Text {...childProps("description")}>{description}</Text>
52
+ {children !== undefined && (
53
+ <ActionWrapper {...childProps("action")}>{children}</ActionWrapper>
54
+ )}
55
+ </View>
56
+ );
57
+ };
package/empty-state.tsx CHANGED
@@ -1,6 +1,8 @@
1
1
  import { type HTMLAttributes, type ReactNode } from "react";
2
- import { getClassName } from "@behivetech/get-class-name";
3
- import styles from "./empty-state.module.scss";
2
+
3
+ import "./empty-state.block.css";
4
+ import { useBlock, type StylesFor } from "@behivetech/blocks.core";
5
+ import { emptyState } from "./empty-state.block";
4
6
 
5
7
  export interface EmptyStateProps extends HTMLAttributes<HTMLDivElement> {
6
8
  /** Additional class names to merge with the component root element */
@@ -11,6 +13,9 @@ export interface EmptyStateProps extends HTMLAttributes<HTMLDivElement> {
11
13
  description: ReactNode;
12
14
  /** Action content rendered below the description (typically a Button) */
13
15
  children?: ReactNode;
16
+
17
+ /** An override block made with `defineBlock`, typed to this component's children and variants; it wins over the block's own styles. */
18
+ styles?: StylesFor<typeof emptyState>;
14
19
  }
15
20
 
16
21
  /**
@@ -23,22 +28,21 @@ export const EmptyState = ({
23
28
  icon,
24
29
  description,
25
30
  children,
31
+ styles,
26
32
  ...rest
27
33
  }: EmptyStateProps) => {
28
- const [rootClass, getChildClass] = getClassName({
29
- className,
30
- rootClass: "BHT__EmptyState",
31
- styles,
32
- });
34
+ const [rootProps, childProps] = useBlock(
35
+ emptyState,
36
+ {},
37
+ { className, styles },
38
+ );
33
39
 
34
40
  return (
35
- <div {...rest} className={rootClass}>
36
- {icon !== undefined && (
37
- <div className={getChildClass("icon")}>{icon}</div>
38
- )}
39
- <p className={getChildClass("description")}>{description}</p>
41
+ <div {...rest} {...rootProps}>
42
+ {icon !== undefined && <div {...childProps("icon")}>{icon}</div>}
43
+ <p {...childProps("description")}>{description}</p>
40
44
  {children !== undefined && (
41
- <div className={getChildClass("action")}>{children}</div>
45
+ <div {...childProps("action")}>{children}</div>
42
46
  )}
43
47
  </div>
44
48
  );
package/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { EmptyState } from "./empty-state.js";
2
- export type { EmptyStateProps } from "./empty-state.js";
1
+ export { EmptyState } from "./empty-state";
2
+ export type { EmptyStateProps } from "./empty-state";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behivetech/molecules.empty-state",
3
- "version": "0.3.5",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "description": "A generic centered placeholder for empty lists, grids, or search results: an optional icon, a description, and an optional action. Modeled on AntD's `Empty` — reusable anywhere something has nothing to show yet.",
6
6
  "type": "module",
@@ -10,18 +10,26 @@
10
10
  ],
11
11
  "exports": {
12
12
  ".": {
13
+ "react-native": {
14
+ "types": "./dist/native/index.d.ts",
15
+ "default": "./dist/index.native.js"
16
+ },
13
17
  "types": "./dist/index.d.ts",
14
18
  "import": "./dist/index.js",
15
19
  "require": "./dist/index.cjs"
16
20
  },
17
21
  "./styles.css": "./dist/index.css"
18
22
  },
23
+ "react-native": "./dist/index.native.js",
19
24
  "files": [
20
25
  "dist",
21
26
  "README.md",
22
27
  "index.ts",
23
28
  "empty-state.tsx",
24
- "empty-state.module.scss",
29
+ "empty-state.native.tsx",
30
+ "empty-state.block.ts",
31
+ "empty-state.block.css",
32
+ "empty-state.block.native.ts",
25
33
  "*.example.tsx",
26
34
  "docs.json"
27
35
  ],
@@ -30,17 +38,27 @@
30
38
  "tags": []
31
39
  },
32
40
  "dependencies": {
33
- "@behivetech/get-class-name": "0.1.0"
41
+ "@behivetech/blocks.core": "0.1.0"
34
42
  },
35
43
  "peerDependencies": {
36
44
  "react": "^19.2.7",
37
- "react-dom": "^19.2.7"
45
+ "react-dom": "^19.2.7",
46
+ "react-native": "*"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "react-native": {
50
+ "optional": true
51
+ }
38
52
  },
39
53
  "devDependencies": {
40
- "@bht-component-registry/env": "0.1.0",
54
+ "@behivetech/blocks.builder": "0.1.0",
55
+ "@behivetech/blocks.native-test": "0.0.1",
56
+ "@bht-component-registry/env": "0.3.0",
41
57
  "@types/react": "19.2.17",
42
58
  "@types/react-dom": "19.2.3",
43
59
  "eslint": "^9.39.5",
60
+ "react": "19.2.8",
61
+ "react-dom": "19.2.8",
44
62
  "tsup": "^8.5.1",
45
63
  "typescript": "^6.0.3",
46
64
  "vitest": "^4.1.10"
@@ -48,15 +66,23 @@
48
66
  "repository": {
49
67
  "type": "git",
50
68
  "url": "https://github.com/behivetech/bht-galaxy.git",
51
- "directory": "registry/behivetech/molecules/empty-state"
69
+ "directory": "packages/molecules/empty-state"
52
70
  },
53
71
  "homepage": "https://platform.behivetech.com/behivetech/molecules/empty-state",
54
72
  "publishConfig": {
55
- "registry": "https://npm.pkg.github.com",
73
+ "registry": "https://registry.npmjs.org",
56
74
  "access": "public"
57
75
  },
76
+ "blocks": {
77
+ "a11y": {
78
+ "surface": [
79
+ "background",
80
+ "surface"
81
+ ]
82
+ }
83
+ },
58
84
  "scripts": {
59
- "build": "tsup && bht-registry-docgen",
85
+ "build": "block check && tsup && bht-registry-docgen",
60
86
  "dev": "tsup --watch",
61
87
  "lint": "eslint . --max-warnings 0",
62
88
  "check-types": "tsc --noEmit",
@@ -1,28 +0,0 @@
1
- .BHT__EmptyState {
2
- display: flex;
3
- flex-direction: column;
4
- align-items: center;
5
- justify-content: center;
6
- gap: var(--spacing-4);
7
- text-align: center;
8
- color: var(--md-sys-color-on-surface-variant, var(--color-text-muted));
9
- font-family: var(--md-sys-typescale-body-medium-font, var(--font-body));
10
- font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
11
- font-weight: var(--md-sys-typescale-body-medium-weight, 400);
12
- line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
13
- letter-spacing: var(--md-sys-typescale-body-medium-tracking, 0.0179em);
14
-
15
- &__icon {
16
- font-size: 2.5rem;
17
- line-height: 1;
18
- opacity: 0.4;
19
- }
20
-
21
- &__description {
22
- margin: 0;
23
- }
24
-
25
- &__action {
26
- display: inline-flex;
27
- }
28
- }