@uxf/ui 1.0.0-beta.68 → 1.0.0-beta.69

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.
@@ -1,6 +1,6 @@
1
1
  import React, { CSSProperties } from "react";
2
2
  import { FormControlProps } from "../types";
3
- import { HexCodeString } from "../utils/isLightBackground";
3
+ import { HexCodeString } from "../utils/is-light-background";
4
4
  export declare type ColorRadioGroupOptionValue = HexCodeString;
5
5
  export interface ColorRadioGroupOption {
6
6
  label: string;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { FormControlProps } from "../types";
3
- import { HexCodeString } from "../utils/isLightBackground";
3
+ import { HexCodeString } from "../utils/is-light-background";
4
4
  export interface ColorRadioProps extends FormControlProps<boolean> {
5
5
  color: HexCodeString;
6
6
  colorLabel: string;
@@ -8,7 +8,7 @@ const classes_1 = require("@uxf/core/constants/classes");
8
8
  const cx_1 = require("@uxf/core/utils/cx");
9
9
  const react_1 = __importDefault(require("react"));
10
10
  const forwardRef_1 = require("@uxf/core/utils/forwardRef");
11
- const isLightBackground_1 = require("../utils/isLightBackground");
11
+ const is_light_background_1 = require("../utils/is-light-background");
12
12
  function CheckIcon() {
13
13
  return (react_1.default.createElement("svg", { fill: "none", viewBox: "0 0 16 16" },
14
14
  react_1.default.createElement("path", { d: "M13.333 4 6 11.333 2.667 8", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" })));
@@ -17,6 +17,6 @@ exports.ColorRadio = (0, forwardRef_1.forwardRef)("ColorRadio", (props, ref) =>
17
17
  const colorRadioStyle = { "--bg-color": props.color };
18
18
  return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-color-radio", props.value && classes_1.CLASSES.IS_SELECTED), onClick: () => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, !props.value); }, ref: ref, style: colorRadioStyle },
19
19
  react_1.default.createElement("span", { className: "uxf-color-radio__label" }, props.colorLabel),
20
- react_1.default.createElement("span", { className: `uxf-color-radio__icon ${(0, isLightBackground_1.isLightBackground)(props.color) ? "uxf-color-radio__icon--dark" : ""}` },
20
+ react_1.default.createElement("span", { className: `uxf-color-radio__icon ${(0, is_light_background_1.isLightBackground)(props.color) ? "uxf-color-radio__icon--dark" : ""}` },
21
21
  react_1.default.createElement(CheckIcon, null))));
22
22
  });
package/css/input.css CHANGED
@@ -51,7 +51,7 @@
51
51
  }
52
52
 
53
53
  &__wrapper {
54
- @apply h-12 rounded-lg border px-4;
54
+ @apply rounded-lg border px-4 text-base;
55
55
 
56
56
  :root .light & {
57
57
  @apply border-gray-200;
@@ -62,6 +62,18 @@
62
62
  }
63
63
  }
64
64
 
65
+ &--size-default {
66
+ .uxf-input__wrapper {
67
+ @apply h-12;
68
+ }
69
+ }
70
+
71
+ &--size-large {
72
+ .uxf-input__wrapper {
73
+ @apply h-14 text-lg;
74
+ }
75
+ }
76
+
65
77
  &--has-right-addon {
66
78
  .uxf-input__wrapper {
67
79
  @apply rounded-r-none;
package/css/list-item.css CHANGED
@@ -1,15 +1,19 @@
1
1
  .uxf-list-item {
2
- @apply flex justify-between grow py-4 px-5 min-h-[64px] transition-opacity hover:opacity-75
2
+ @apply flex justify-between grow py-4 px-5 min-h-[64px] space-x-3 transition-opacity hover:opacity-75
3
3
  outline-none relative before:absolute before:inset-0 before:rounded-lg focus-visible:before:border-2;
4
4
 
5
- .uxf-list-item__end-icon {
6
- @apply shrink-0 pl-3;
5
+ &__inner {
6
+ @apply w-full;
7
+ }
8
+
9
+ &__end-elements-wrapper, &__end-icon-wrapper {
10
+ @apply shrink-0;
7
11
  }
8
12
 
9
13
  :root .light & {
10
14
  @apply focus-visible:before:border-primary-500;
11
15
 
12
- .uxf-list-item__end-icon {
16
+ .uxf-list-item__end-icon-wrapper {
13
17
  @apply text-gray-300;
14
18
  }
15
19
  }
@@ -17,7 +21,7 @@
17
21
  :root .dark & {
18
22
  @apply focus-visible:before:border-primary-500;
19
23
 
20
- .uxf-list-item__end-icon {
24
+ .uxf-list-item__end-icon-wrapper {
21
25
  @apply text-gray-600;
22
26
  }
23
27
  }
package/input/input.js CHANGED
@@ -35,6 +35,7 @@ function getChildrenById(children, componentName) {
35
35
  .find((ch) => ch.type.displayName === componentName);
36
36
  }
37
37
  exports.Input = (0, forwardRef_1.forwardRef)("Input", (props, ref) => {
38
+ var _a, _b;
38
39
  const inputWrapperRef = (0, react_1.useRef)(null);
39
40
  const inputRef = (0, react_1.useRef)(null);
40
41
  const [focused, setFocused] = (0, react_1.useState)(false);
@@ -43,7 +44,7 @@ exports.Input = (0, forwardRef_1.forwardRef)("Input", (props, ref) => {
43
44
  const rightAddon = getChildrenById(props.children, "InputRightAddon");
44
45
  const leftElement = getChildrenById(props.children, "InputLeftElement");
45
46
  const rightElement = getChildrenById(props.children, "InputRightElement");
46
- const inputGroupClasses = (0, cx_1.cx)("uxf-input", leftAddon && "uxf-input--has-left-addon", leftElement && "uxf-input--has-left-element", rightElement && "uxf-input--has-right-element", rightAddon && "uxf-input--has-right-addon", focused && classes_1.CLASSES.IS_FOCUSED, (mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isInvalid) && classes_1.CLASSES.IS_INVALID, (mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isDisabled) && classes_1.CLASSES.IS_DISABLED, (mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isReadOnly) && classes_1.CLASSES.IS_READONLY);
47
+ const inputGroupClasses = (0, cx_1.cx)("uxf-input", leftAddon && "uxf-input--has-left-addon", leftElement && "uxf-input--has-left-element", rightElement && "uxf-input--has-right-element", rightAddon && "uxf-input--has-right-addon", focused && classes_1.CLASSES.IS_FOCUSED, (mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isInvalid) && classes_1.CLASSES.IS_INVALID, (mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isDisabled) && classes_1.CLASSES.IS_DISABLED, (mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isReadOnly) && classes_1.CLASSES.IS_READONLY, `uxf-input--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, `uxf-input--variant-${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`);
47
48
  const onFocus = (e) => {
48
49
  var _a, _b;
49
50
  setFocused(true);
@@ -61,7 +61,9 @@ function Default() {
61
61
  react_1.default.createElement(input_1.Input, null,
62
62
  react_1.default.createElement(input_1.Input.Element, { value: value, onChange: (0, action_1.action)("onChange", onChange), placeholder: "Disabled", isInvalid: isInvalid, isDisabled: true })),
63
63
  react_1.default.createElement(input_1.Input, null,
64
- react_1.default.createElement(input_1.Input.Element, { value: value, onChange: (0, action_1.action)("onChange", onChange), placeholder: "Read Only", isInvalid: isInvalid, isReadOnly: true }))));
64
+ react_1.default.createElement(input_1.Input.Element, { value: value, onChange: (0, action_1.action)("onChange", onChange), placeholder: "Read Only", isInvalid: isInvalid, isReadOnly: true })),
65
+ react_1.default.createElement(input_1.Input, { size: "large" },
66
+ react_1.default.createElement(input_1.Input.Element, { value: value, onChange: (0, action_1.action)("onChange", onChange), placeholder: "Size large", isInvalid: isInvalid }))));
65
67
  return (react_1.default.createElement(react_1.default.Fragment, null,
66
68
  react_1.default.createElement("input", { type: "checkbox", checked: isInvalid, onChange: (e) => setInvalid(e.target.checked) }),
67
69
  react_1.default.createElement("div", { className: "light space-y-2 p-20" }, storyInputs),
package/input/theme.d.ts CHANGED
@@ -3,4 +3,5 @@ export interface InputGroupVariants {
3
3
  }
4
4
  export interface InputGroupSizes {
5
5
  default: true;
6
+ large: true;
6
7
  }
@@ -1,7 +1,8 @@
1
1
  import { UseAnchorProps } from "@uxf/core/hooks/useAnchorProps";
2
- import React, { AnchorHTMLAttributes } from "react";
2
+ import React, { AnchorHTMLAttributes, ReactNode } from "react";
3
3
  import { IconName } from "../icon/types";
4
4
  export interface ListItemProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "type">, UseAnchorProps {
5
5
  endIcon?: IconName;
6
+ endElement?: ReactNode;
6
7
  }
7
8
  export declare const ListItem: React.ForwardRefExoticComponent<ListItemProps & React.RefAttributes<HTMLAnchorElement>>;
@@ -11,13 +11,14 @@ const react_1 = __importDefault(require("react"));
11
11
  const icon_1 = require("../icon");
12
12
  exports.ListItem = (0, forwardRef_1.forwardRef)("ListItem", (props, ref) => {
13
13
  // eslint-disable-next-line react/destructuring-assignment
14
- const { className, children, endIcon, ...restProps } = props;
14
+ const { className, children, endElement, endIcon, ...restProps } = props;
15
15
  const anchorProps = (0, useAnchorProps_1.useAnchorProps)({
16
16
  ...restProps,
17
17
  className: (0, cx_1.cx)("uxf-list-item", className),
18
18
  });
19
19
  return (react_1.default.createElement("a", { ref: ref, ...anchorProps },
20
- react_1.default.createElement("span", null, children),
21
- endIcon && (react_1.default.createElement("span", { className: "uxf-list-item__end-icon" },
20
+ react_1.default.createElement("span", { className: "uxf-list-item__inner" }, children),
21
+ endElement && react_1.default.createElement("span", { className: "uxf-list-item__end-element-wrapper" }, endElement),
22
+ endIcon && (react_1.default.createElement("span", { className: "uxf-list-item__end-icon-wrapper" },
22
23
  react_1.default.createElement(icon_1.Icon, { name: endIcon, size: 24 })))));
23
24
  });
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Default = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const index_1 = require("./index");
9
+ const icon_1 = require("../icon");
9
10
  exports.default = {
10
11
  title: "UI/ListItem",
11
12
  component: index_1.ListItem,
@@ -20,7 +21,10 @@ function Default() {
20
21
  react_1.default.createElement("div", null, "Karel Vom\u00E1\u010Dka"),
21
22
  react_1.default.createElement("div", null, "U\u017Eivatel"))),
22
23
  react_1.default.createElement("div", { className: "border-gray500 border-b" }),
23
- react_1.default.createElement(index_1.ListItem, { onClick: () => void null }, "No end icon")));
24
+ react_1.default.createElement(index_1.ListItem, { onClick: () => void null }, "No end icon"),
25
+ react_1.default.createElement("div", { className: "border-gray500 border-b" }),
26
+ react_1.default.createElement(index_1.ListItem, { endElement: react_1.default.createElement(icon_1.Icon, { name: "camera", className: "text-success-500", size: 24 }), onClick: () => void null }, "End element"),
27
+ react_1.default.createElement(index_1.ListItem, { endElement: react_1.default.createElement(icon_1.Icon, { name: "camera", className: "text-success-500", size: 24 }), endIcon: "chevronRight", onClick: () => void null }, "End element and end icon")));
24
28
  return (react_1.default.createElement("div", { className: "flex" },
25
29
  react_1.default.createElement("div", { className: "light grow gap-4 p-4" }, storyListItem),
26
30
  react_1.default.createElement("div", { className: "dark grow gap-4 bg-gray-900 p-4 text-gray-200" }, storyListItem)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/ui",
3
- "version": "1.0.0-beta.68",
3
+ "version": "1.0.0-beta.69",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"