@uxf/ui 10.0.0-beta.5 → 10.0.0-beta.7
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/_select-base/_select-base.d.ts +1 -1
- package/chip/chip.d.ts +5 -7
- package/chip/chip.js +20 -7
- package/chip/chip.spec.d.ts +1 -0
- package/chip/chip.spec.js +9 -0
- package/chip/chip.stories.d.ts +1 -1
- package/chip/index.d.ts +3 -1
- package/chip/index.js +3 -15
- package/chip/theme.d.ts +3 -0
- package/multi-combobox/types.d.ts +1 -1
- package/multi-select/types.d.ts +1 -1
- package/package.json +1 -1
- package/utils/storybook-config.d.ts +1 -1
|
@@ -3,7 +3,7 @@ import type { Combobox as HUICombobox, Listbox as HUIListbox } from "@headlessui
|
|
|
3
3
|
import { IconsSet } from "@uxf/ui/icon/theme";
|
|
4
4
|
import { Clearable, FormControlProps } from "@uxf/ui/types";
|
|
5
5
|
import React, { ReactElement, ReactNode, Ref } from "react";
|
|
6
|
-
import { InputGroupSizes, InputGroupVariants } from "
|
|
6
|
+
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
7
7
|
export type SelectBaseValueId = number | string;
|
|
8
8
|
export type SelectBaseValue<ValueId = SelectBaseValueId> = {
|
|
9
9
|
id: ValueId;
|
package/chip/chip.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export type ChipVariant = keyof ChipVariants;
|
|
6
|
-
export interface ChipProps extends HTMLAttributes<HTMLDivElement> {
|
|
1
|
+
import { ChipColor, ChipSize, ChipVariant } from "@uxf/ui/chip/theme";
|
|
2
|
+
import React, { AnchorHTMLAttributes, MouseEventHandler } from "react";
|
|
3
|
+
import { UseAnchorProps } from "@uxf/core/hooks/useAnchorProps";
|
|
4
|
+
export interface ChipProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "color" | "type">, UseAnchorProps {
|
|
7
5
|
color?: ChipColor;
|
|
8
6
|
onClose?: MouseEventHandler;
|
|
9
7
|
size?: ChipSize;
|
|
10
8
|
suppressFocus?: boolean;
|
|
11
9
|
variant?: ChipVariant;
|
|
12
10
|
}
|
|
13
|
-
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<
|
|
11
|
+
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLAnchorElement>>;
|
package/chip/chip.js
CHANGED
|
@@ -26,15 +26,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.Chip = void 0;
|
|
27
27
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
|
+
const useAnchorProps_1 = require("@uxf/core/hooks/useAnchorProps");
|
|
30
|
+
const CloseButton = (props) => {
|
|
31
|
+
const onClose = (e) => {
|
|
32
|
+
var _a;
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
35
|
+
};
|
|
36
|
+
return (react_1.default.createElement("button", { className: "uxf-chip__button", onClick: onClose, tabIndex: props.suppressFocus ? -1 : undefined, type: "button" },
|
|
37
|
+
react_1.default.createElement("span", { className: "uxf-chip__close-button-label" }, "Remove option"),
|
|
38
|
+
react_1.default.createElement("svg", { className: "uxf-chip__close-button-icon", stroke: "currentColor", fill: "none", viewBox: "0 0 8 8" },
|
|
39
|
+
react_1.default.createElement("path", { strokeLinecap: "round", strokeWidth: "1.5", d: "M1 1l6 6m0-6L1 7" }))));
|
|
40
|
+
};
|
|
29
41
|
exports.Chip = (0, react_1.forwardRef)((props, ref) => {
|
|
30
42
|
var _a, _b, _c;
|
|
31
|
-
const { children, className,
|
|
43
|
+
const { children, className, href, onClose, ...restProps } = props;
|
|
32
44
|
const chipClassName = (0, cx_1.cx)("uxf-chip", `uxf-chip--color-${(_a = props.color) !== null && _a !== void 0 ? _a : "default"}`, `uxf-chip--size-${(_b = props.size) !== null && _b !== void 0 ? _b : "default"}`, `uxf-chip--variant-${(_c = props.variant) !== null && _c !== void 0 ? _c : "default"}`, onClose && "has-button", className);
|
|
33
|
-
|
|
45
|
+
const anchorProps = (0, useAnchorProps_1.useAnchorProps)({
|
|
46
|
+
className: (0, cx_1.cx)(chipClassName),
|
|
47
|
+
...restProps,
|
|
48
|
+
});
|
|
49
|
+
return (react_1.default.createElement("a", { href: href, className: chipClassName, ref: ref, ...anchorProps },
|
|
34
50
|
typeof children === "string" ? react_1.default.createElement("span", { className: "uxf-chip__text" }, children) : children,
|
|
35
|
-
onClose &&
|
|
36
|
-
react_1.default.createElement("span", { className: "sr-only" }, "Remove option"),
|
|
37
|
-
react_1.default.createElement("svg", { stroke: "currentColor", fill: "none", viewBox: "0 0 8 8" },
|
|
38
|
-
react_1.default.createElement("path", { strokeLinecap: "round", strokeWidth: "1.5", d: "M1 1l6 6m0-6L1 7" }))))));
|
|
51
|
+
!!onClose && react_1.default.createElement(CloseButton, { onClose: onClose })));
|
|
39
52
|
});
|
|
40
|
-
exports.Chip.displayName = "
|
|
53
|
+
exports.Chip.displayName = "UxfChip";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const snap_test_1 = require("../utils/snap-test");
|
|
8
|
+
const chip_stories_1 = require("./chip.stories");
|
|
9
|
+
(0, snap_test_1.snapTest)("render stories", react_1.default.createElement(chip_stories_1.Default, null));
|
package/chip/chip.stories.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: React.ForwardRefExoticComponent<import("@uxf/ui/chip").ChipProps & React.RefAttributes<
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("@uxf/ui/chip").ChipProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
5
5
|
parameters: {
|
|
6
6
|
docs: {};
|
|
7
7
|
};
|
package/chip/index.d.ts
CHANGED
package/chip/index.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
3
|
+
exports.Chip = void 0;
|
|
4
|
+
var chip_1 = require("./chip");
|
|
5
|
+
Object.defineProperty(exports, "Chip", { enumerable: true, get: function () { return chip_1.Chip; } });
|
package/chip/theme.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ReactNode } from "react";
|
|
|
3
3
|
import { ChipColor } from "../chip";
|
|
4
4
|
import { IconsSet } from "../icon/theme";
|
|
5
5
|
import { FormControlProps } from "../types";
|
|
6
|
-
import { InputGroupSizes, InputGroupVariants } from "
|
|
6
|
+
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
7
7
|
export type MultiComboboxValueId = number | string;
|
|
8
8
|
export type MultiComboboxValue<ValueId = MultiComboboxValueId> = {
|
|
9
9
|
id: ValueId;
|
package/multi-select/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ReactNode } from "react";
|
|
|
3
3
|
import { ChipColor } from "../chip";
|
|
4
4
|
import { IconsSet } from "../icon/theme";
|
|
5
5
|
import { FormControlProps } from "../types";
|
|
6
|
-
import { InputGroupSizes, InputGroupVariants } from "
|
|
6
|
+
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
7
7
|
export type MultiSelectValueId = number | string;
|
|
8
8
|
export type MultiSelectOption<T = MultiSelectValueId> = {
|
|
9
9
|
color?: ChipColor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { ButtonColor, ButtonSize, ButtonVariant } from "@uxf/ui/button";
|
|
3
|
-
import { ChipColor } from "../chip
|
|
3
|
+
import { ChipColor } from "../chip";
|
|
4
4
|
import { InputGroupSizes } from "../input/theme";
|
|
5
5
|
export declare const defaultConfig: StorybookConfig;
|
|
6
6
|
export interface StorybookConfig {
|