@fibery/ui-kit 8.0.0 → 9.0.1

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.
@@ -9,18 +9,23 @@ import { UnitButtonGroup } from "./unit-button-group.js";
9
9
  import { UnitContent } from "./unit-content.js";
10
10
  /* empty css */
11
11
  import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { forwardRef } from "react";
12
13
  import cx from "classnames";
13
14
  //#region src/unit/primitive.tsx
14
15
  var unitDescriptionClassName = "uha1rmp-unitDescription";
15
16
  var resetButtonStylesClassName = "rlbybtz-resetButtonStyles";
16
- var ButtonComponent = (props) => {
17
+ var ButtonComponent = forwardRef((props, ref) => {
17
18
  return /* @__PURE__ */ jsx("button", {
19
+ ref,
18
20
  type: "button",
19
21
  ...props,
20
22
  className: cx(props.className, resetButtonStylesClassName)
21
23
  });
22
- };
23
- var DivComponent = (props) => /* @__PURE__ */ jsx("div", { ...props });
24
+ });
25
+ var DivComponent = forwardRef((props, ref) => /* @__PURE__ */ jsx("div", {
26
+ ref,
27
+ ...props
28
+ }));
24
29
  var UnitPrimitive = ({ overflow = true, inline = true, button = false, multiline = false, children, title, fieldIcon, description = null, hint = null, icons, navButton, big = false, pill = false, tooltip = true, withLabel = false, border = true, color = themeVars.textColor, bgColor = themeVars.transparent, fontWeight, shrinkable = true, clickable = false, setMinWidth = true, setMinHeight = true, onClick, onKeyDown, invalid }) => {
25
30
  const { truncated, setNode } = useTruncated();
26
31
  const truncate = !multiline && overflow;
@@ -31,33 +36,36 @@ var UnitPrimitive = ({ overflow = true, inline = true, button = false, multiline
31
36
  };
32
37
  const unitWrapperClassName = cx(basicUnitClassName, big ? bigSizeUnitClassName : regularSizeUnitClassName, setMinWidth && (big ? "b1v5rpy3-bigSizeUnitMinWidth" : "rpdarf0-regularSizeUnitMinWidth"), setMinHeight && "ubaz4qk-unitMinHeight", border && "b4mqgwc-border", pill && "p1ebg4ic-pillRadius", invalid && "i14l2yxo-invalidUnit", clickable && "c18mqj2f-clickable");
33
38
  const UnitContentComponent = button ? ButtonComponent : DivComponent;
34
- const content = /* @__PURE__ */ jsx(UnitButtonGroup, {
35
- big,
36
- inline,
37
- style: unitWrapperStyle,
38
- className: unitWrapperClassName,
39
- unit: jsx(UnitContentComponent, {
40
- onKeyDown,
41
- onClick,
42
- children: /* @__PURE__ */ jsx(UnitContent, {
43
- big,
44
- icons,
45
- shrinkable,
46
- truncate,
47
- setNode,
48
- children
49
- })
50
- }),
51
- navButton
52
- });
53
- const labeledContent = withLabel ? /* @__PURE__ */ jsx(LabeledUnit, {
54
- label: title,
55
- children: content
56
- }) : content;
57
- if (!tooltip) return /* @__PURE__ */ jsx("div", {
58
- className: positionUnitClass,
59
- children: labeledContent
39
+ const unitBody = /* @__PURE__ */ jsx(UnitContentComponent, {
40
+ onKeyDown,
41
+ onClick,
42
+ children: jsx(UnitContent, {
43
+ big,
44
+ icons,
45
+ shrinkable,
46
+ truncate,
47
+ setNode,
48
+ children
49
+ })
60
50
  });
51
+ const renderUnit = (unit) => {
52
+ const content = /* @__PURE__ */ jsx(UnitButtonGroup, {
53
+ big,
54
+ inline,
55
+ style: unitWrapperStyle,
56
+ className: unitWrapperClassName,
57
+ unit,
58
+ navButton
59
+ });
60
+ return /* @__PURE__ */ jsx("div", {
61
+ className: positionUnitClass,
62
+ children: withLabel ? /* @__PURE__ */ jsx(LabeledUnit, {
63
+ label: title,
64
+ children: content
65
+ }) : content
66
+ });
67
+ };
68
+ if (!tooltip) return renderUnit(unitBody);
61
69
  const tooltipTitle = /* @__PURE__ */ jsxs("div", {
62
70
  className: "c1lb5dtf",
63
71
  children: [fieldIcon && /* @__PURE__ */ jsx(FieldIcon, {
@@ -80,24 +88,21 @@ var UnitPrimitive = ({ overflow = true, inline = true, button = false, multiline
80
88
  }) })
81
89
  })
82
90
  });
83
- return /* @__PURE__ */ jsx("div", {
84
- className: positionUnitClass,
85
- children: jsx(Tooltip, {
86
- side: "bottom",
87
- align: "start",
88
- openOnFocus: false,
89
- title: tooltipTitle,
90
- description: (description || tooltipContent || hint) && /* @__PURE__ */ jsxs("div", { children: [
91
- description && /* @__PURE__ */ jsx("div", {
92
- className: unitDescriptionClassName,
93
- children: description
94
- }),
95
- tooltipContent,
96
- hint
97
- ] }),
98
- children: /* @__PURE__ */ jsx("div", { children: labeledContent })
99
- })
100
- });
91
+ return renderUnit(/* @__PURE__ */ jsx(Tooltip, {
92
+ side: "bottom",
93
+ align: "start",
94
+ openOnFocus: false,
95
+ title: tooltipTitle,
96
+ description: (description || tooltipContent || hint) && /* @__PURE__ */ jsxs("div", { children: [
97
+ description && /* @__PURE__ */ jsx("div", {
98
+ className: unitDescriptionClassName,
99
+ children: description
100
+ }),
101
+ tooltipContent,
102
+ hint
103
+ ] }),
104
+ children: unitBody
105
+ }));
101
106
  };
102
107
  //#endregion
103
108
  export { UnitPrimitive };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/ui-kit",
3
- "version": "8.0.0",
3
+ "version": "9.0.1",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "lib"
@@ -72,6 +72,23 @@
72
72
  "./src/icons/svg/*.svg": {
73
73
  "default": null
74
74
  },
75
+ "./src/embed": {
76
+ "types": "./lib/embed.d.ts",
77
+ "default": "./lib/embed.js"
78
+ },
79
+ "./src/theme": {
80
+ "types": "./lib/theme.d.ts",
81
+ "default": "./lib/theme.js"
82
+ },
83
+ "./src/theme-provider": {
84
+ "default": null
85
+ },
86
+ "./src/root-theme-provider": {
87
+ "default": null
88
+ },
89
+ "./src/layout-variables": {
90
+ "default": null
91
+ },
75
92
  "./src/*": {
76
93
  "types": "./lib/*.d.ts",
77
94
  "default": "./lib/*.js"