@uxf/ui 11.56.0 → 11.58.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.
package/button/README.md CHANGED
@@ -36,4 +36,16 @@ declare module "@uxf/ui/icon/theme" {
36
36
  inverted: true;
37
37
  }
38
38
  }
39
+ ```
40
+
41
+ ### Loading button
42
+
43
+ Button will be in loading state when promise is returned from `onClick` handler.
44
+
45
+ Example: [here](https://loading-button.fe.uxf.dev/docs/ui/button#example-LoadingButton)
46
+
47
+ ```tsx
48
+ const clickHandler = () => new Promise((resolve) => setTimeout(resolve, 1000));
49
+
50
+ <Button onClick={clickHandler}>Loading button</Button>
39
51
  ```
@@ -1,4 +1,4 @@
1
- import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
1
+ import { UseAnchorProps } from "@uxf/core-react/clickable/use-anchor-props";
2
2
  import { ButtonColors, ButtonSizes, ButtonVariants } from "@uxf/ui/button/theme";
3
3
  import React, { AnchorHTMLAttributes } from "react";
4
4
  import { NextLink } from "../utils/next-link";
package/button/button.js CHANGED
@@ -25,19 +25,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.Button = void 0;
28
- const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
28
+ const use_anchor_props_1 = require("@uxf/core-react/clickable/use-anchor-props");
29
29
  const cx_1 = require("@uxf/core/utils/cx");
30
+ const omit_1 = require("@uxf/core/utils/omit");
30
31
  const react_1 = __importStar(require("react"));
31
32
  exports.Button = (0, react_1.forwardRef)((props, ref) => {
32
- // eslint-disable-next-line react/destructuring-assignment
33
- const { as = "a", color, isIconButton, isFullWidth, size, variant, className, isDisabled, isLoading, ...restProps } = props;
33
+ var _a, _b, _c, _d;
34
+ const as = (_a = props.as) !== null && _a !== void 0 ? _a : "a";
34
35
  const Component = as;
35
- const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
36
- ...restProps,
37
- isDisabled,
38
- isLoading,
39
- className: (0, cx_1.cx)("uxf-button", `uxf-button--color-${color !== null && color !== void 0 ? color : "default"}`, `uxf-button--size-${size !== null && size !== void 0 ? size : "default"}`, `uxf-button--variant-${variant !== null && variant !== void 0 ? variant : "default"}`, isDisabled && "uxf-button--is-disabled", isLoading && "uxf-button--is-loading", isIconButton && "uxf-button--icon-button", isFullWidth && "uxf-button--full-width", className),
40
- });
41
- return (react_1.default.createElement(Component, { ref: ref, ...anchorProps }, typeof props.children === "string" ? (react_1.default.createElement("span", { className: "uxf-button__text" }, props.children)) : (props.children)));
36
+ const anchorProps = (0, use_anchor_props_1.useAnchorProps)(props, { classNamePrefix: "uxf-button" });
37
+ const className = (0, cx_1.cx)(anchorProps.className, "uxf-button", `uxf-button--color-${(_b = props.color) !== null && _b !== void 0 ? _b : "default"}`, `uxf-button--size-${(_c = props.size) !== null && _c !== void 0 ? _c : "default"}`, `uxf-button--variant-${(_d = props.variant) !== null && _d !== void 0 ? _d : "default"}`, props.isIconButton && "uxf-button--icon-button", props.isFullWidth && "uxf-button--full-width");
38
+ const componentProps = (0, omit_1.omit)(anchorProps, [
39
+ "isDisabled",
40
+ "isLoading",
41
+ "variant",
42
+ "color",
43
+ "size",
44
+ "isIconButton",
45
+ "isFullWidth",
46
+ "as",
47
+ ]);
48
+ return (react_1.default.createElement(Component, { ref: ref, ...componentProps, className: className }, typeof props.children === "string" ? (react_1.default.createElement("span", { className: "uxf-button__text" }, props.children)) : (props.children)));
42
49
  });
43
50
  exports.Button.displayName = "UxfUiButton";
@@ -1,3 +1,4 @@
1
1
  import React from "react";
2
2
  export declare function Basic(): React.JSX.Element;
3
3
  export declare function Default(): React.JSX.Element;
4
+ export declare function LoadingButton(): React.JSX.Element;
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Basic = Basic;
27
27
  exports.Default = Default;
28
+ exports.LoadingButton = LoadingButton;
28
29
  const button_1 = require("@uxf/ui/button");
29
30
  const icon_1 = require("@uxf/ui/icon");
30
31
  const storybook_config_1 = require("@uxf/ui/utils/storybook-config");
@@ -86,3 +87,8 @@ function Default() {
86
87
  react_1.default.createElement(button_1.Button, { color: color, isFullWidth: true, onClick: onClick, size: size, variant: variant }, "Full width"),
87
88
  react_1.default.createElement("hr", null))))))))))));
88
89
  }
90
+ function LoadingButton() {
91
+ const clickHandler = () => new Promise((resolve) => setTimeout(resolve, 3000));
92
+ return (react_1.default.createElement("div", { className: "p-4" },
93
+ react_1.default.createElement(button_1.Button, { onClick: clickHandler }, "Loading button")));
94
+ }
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ButtonList = void 0;
27
27
  const react_1 = require("@floating-ui/react");
28
28
  const react_2 = require("@headlessui/react");
29
- const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
29
+ const use_anchor_props_1 = require("@uxf/core-react/clickable/use-anchor-props");
30
30
  const cx_1 = require("@uxf/core/utils/cx");
31
31
  const is_empty_1 = require("@uxf/core/utils/is-empty");
32
32
  const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.Checkbox = void 0;
28
- const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
28
+ const use_clickable_props_1 = require("@uxf/core-react/clickable/use-clickable-props");
29
29
  const classes_1 = require("@uxf/core/constants/classes");
30
30
  const cx_1 = require("@uxf/core/utils/cx");
31
31
  const react_1 = __importStar(require("react"));
package/chip/chip.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
1
+ import { UseAnchorProps } from "@uxf/core-react/clickable/use-anchor-props";
2
2
  import { ChipColor, ChipSize, ChipVariant } from "@uxf/ui/chip/theme";
3
3
  import React, { AnchorHTMLAttributes, MouseEventHandler } from "react";
4
4
  import { NextLink } from "../utils/next-link";
package/chip/chip.js CHANGED
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.Chip = void 0;
28
- const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
28
+ const use_anchor_props_1 = require("@uxf/core-react/clickable/use-anchor-props");
29
29
  const cx_1 = require("@uxf/core/utils/cx");
30
30
  const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
31
31
  const react_1 = __importStar(require("react"));
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.ColorRadio = void 0;
28
- const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
28
+ const use_clickable_props_1 = require("@uxf/core-react/clickable/use-clickable-props");
29
29
  const classes_1 = require("@uxf/core/constants/classes");
30
30
  const cx_1 = require("@uxf/core/utils/cx");
31
31
  const react_1 = __importStar(require("react"));
@@ -1,4 +1,4 @@
1
- import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
1
+ import { UseAnchorProps } from "@uxf/core-react/clickable/use-anchor-props";
2
2
  import React, { AnchorHTMLAttributes, HTMLAttributes } from "react";
3
3
  import { NextLink } from "../utils/next-link";
4
4
  export interface DropdownItemProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "type">, UseAnchorProps {
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.Dropdown = void 0;
28
- const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
28
+ const use_anchor_props_1 = require("@uxf/core-react/clickable/use-anchor-props");
29
29
  const cx_1 = require("@uxf/core/utils/cx");
30
30
  const react_1 = __importStar(require("react"));
31
31
  const Item = (0, react_1.forwardRef)((props, ref) => {
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.FlashMessage = void 0;
28
- const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
28
+ const use_clickable_props_1 = require("@uxf/core-react/clickable/use-clickable-props");
29
29
  const react_1 = __importStar(require("react"));
30
30
  exports.FlashMessage = (0, react_1.forwardRef)((props, ref) => {
31
31
  (0, react_1.useEffect)(() => {
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.FlashMessages = void 0;
27
27
  const react_1 = require("@headlessui/react");
28
- const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
28
+ const use_clickable_props_1 = require("@uxf/core-react/clickable/use-clickable-props");
29
29
  const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
30
30
  const react_2 = __importStar(require("react"));
31
31
  const flash_message_1 = require("./flash-message");
@@ -1,4 +1,4 @@
1
- import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
1
+ import { UseAnchorProps } from "@uxf/core-react/clickable/use-anchor-props";
2
2
  import React, { AnchorHTMLAttributes, ReactNode } from "react";
3
3
  import { IconName } from "../icon/types";
4
4
  import { NextLink } from "../utils/next-link";
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ListItem = void 0;
27
- const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
27
+ const use_anchor_props_1 = require("@uxf/core-react/clickable/use-anchor-props");
28
28
  const cx_1 = require("@uxf/core/utils/cx");
29
29
  const react_1 = __importStar(require("react"));
30
30
  const icon_1 = require("../icon");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/ui",
3
- "version": "11.56.0",
3
+ "version": "11.58.1",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,10 +23,10 @@
23
23
  "dependencies": {
24
24
  "@floating-ui/react": "0.26.28",
25
25
  "@headlessui/react": "1.7.19",
26
- "@uxf/core": "11.54.0",
27
- "@uxf/core-react": "11.54.0",
26
+ "@uxf/core": "11.58.0",
27
+ "@uxf/core-react": "11.58.1",
28
28
  "@uxf/datepicker": "11.50.0",
29
- "@uxf/styles": "11.54.0",
29
+ "@uxf/styles": "11.58.0",
30
30
  "color2k": "2.0.3",
31
31
  "dayjs": "1.11.13",
32
32
  "jump.js": "1.0.2",
package/radio/radio.js CHANGED
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.Radio = void 0;
28
- const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
28
+ const use_clickable_props_1 = require("@uxf/core-react/clickable/use-clickable-props");
29
29
  const classes_1 = require("@uxf/core/constants/classes");
30
30
  const cx_1 = require("@uxf/core/utils/cx");
31
31
  const react_1 = __importStar(require("react"));
@@ -1,4 +1,4 @@
1
- import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
1
+ import { UseAnchorProps } from "@uxf/core-react/clickable/use-anchor-props";
2
2
  import { TextLinkVariants } from "@uxf/ui/text-link/theme";
3
3
  import React, { AnchorHTMLAttributes } from "react";
4
4
  import { NextLink } from "../utils/next-link";
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.TextLink = void 0;
28
- const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
28
+ const use_anchor_props_1 = require("@uxf/core-react/clickable/use-anchor-props");
29
29
  const cx_1 = require("@uxf/core/utils/cx");
30
30
  const react_1 = __importStar(require("react"));
31
31
  exports.TextLink = (0, react_1.forwardRef)((props, ref) => {