@uxf/ui 1.0.0-beta.128 → 1.0.0-beta.129

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/css/combobox.css CHANGED
@@ -92,16 +92,23 @@
92
92
  &,
93
93
  &:hover,
94
94
  &:focus {
95
- margin: 1px 0;
95
+ -webkit-appearance: none;
96
+ -moz-appearance: none;
97
+ appearance: none;
98
+ transition: background-color 5000s ease-in-out 0s !important;
96
99
 
97
100
  :root .dark & {
101
+ -webkit-text-fill-color: theme("colors.gray.300");
98
102
  -webkit-box-shadow: inset 0 0 0 1000px theme("colors.gray.800");
103
+ box-shadow: inset 0 0 0 1000px theme("colors.gray.800");
104
+ background-color: theme("colors.gray.800");
99
105
  caret-color: white;
100
- -webkit-text-fill-color: theme("colors.gray.300");
101
106
  }
102
107
 
103
108
  :root .light & {
104
- -webkit-box-shadow: inset 0 0 0 1000px theme("colors.gray.100");
109
+ -webkit-box-shadow: inset 0 0 0 1000px theme("colors.white");
110
+ box-shadow: inset 0 0 0 1000px theme("colors.white");
111
+ background-color: theme("colors.white");
105
112
  }
106
113
  }
107
114
  }
@@ -71,6 +71,10 @@
71
71
  &__file-name {
72
72
  @apply truncate;
73
73
  }
74
+
75
+ &__file-name-link {
76
+ @apply truncate hover:underline hover:underline-offset-2;
77
+ }
74
78
  }
75
79
  }
76
80
  }
package/css/input.css CHANGED
@@ -217,16 +217,23 @@
217
217
  &,
218
218
  &:hover,
219
219
  &:focus {
220
- margin: 1px 0;
220
+ -webkit-appearance: none;
221
+ -moz-appearance: none;
222
+ appearance: none;
223
+ transition: background-color 5000s ease-in-out 0s !important;
221
224
 
222
225
  :root .dark & {
226
+ -webkit-text-fill-color: theme("colors.gray.300");
223
227
  -webkit-box-shadow: inset 0 0 0 1000px theme("colors.gray.800");
228
+ box-shadow: inset 0 0 0 1000px theme("colors.gray.800");
229
+ background-color: theme("colors.gray.800");
224
230
  caret-color: white;
225
- -webkit-text-fill-color: theme("colors.gray.300");
226
231
  }
227
232
 
228
233
  :root .light & {
229
234
  -webkit-box-shadow: inset 0 0 0 1000px theme("colors.white");
235
+ box-shadow: inset 0 0 0 1000px theme("colors.white");
236
+ background-color: theme("colors.white");
230
237
  }
231
238
  }
232
239
  }
package/css/textarea.css CHANGED
@@ -101,16 +101,23 @@
101
101
  &,
102
102
  &:hover,
103
103
  &:focus {
104
- margin: 1px 0;
104
+ -webkit-appearance: none;
105
+ -moz-appearance: none;
106
+ appearance: none;
107
+ transition: background-color 5000s ease-in-out 0s !important;
105
108
 
106
109
  :root .dark & {
110
+ -webkit-text-fill-color: theme("colors.gray.300");
107
111
  -webkit-box-shadow: inset 0 0 0 1000px theme("colors.gray.800");
112
+ box-shadow: inset 0 0 0 1000px theme("colors.gray.800");
113
+ background-color: theme("colors.gray.800");
108
114
  caret-color: white;
109
- -webkit-text-fill-color: theme("colors.gray.300");
110
115
  }
111
116
 
112
117
  :root .light & {
113
- -webkit-box-shadow: inset 0 0 0 1000px theme("colors.gray.100");
118
+ -webkit-box-shadow: inset 0 0 0 1000px theme("colors.white");
119
+ box-shadow: inset 0 0 0 1000px theme("colors.white");
120
+ background-color: theme("colors.white");
114
121
  }
115
122
  }
116
123
  }
@@ -1,5 +1,5 @@
1
+ import { FormControlProps } from "@uxf/ui/types";
1
2
  import { FC, ReactNode } from "react";
2
- import { FormControlProps } from "../types";
3
3
  import { DropzoneFile } from "./types";
4
4
  export interface DropzoneListProps extends FormControlProps<DropzoneFile[]> {
5
5
  errorText?: string;
@@ -26,10 +26,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.DropzoneList = void 0;
27
27
  const classes_1 = require("@uxf/core/constants/classes");
28
28
  const cx_1 = require("@uxf/core/utils/cx");
29
+ const context_1 = require("@uxf/ui/context");
30
+ const icon_1 = require("@uxf/ui/icon");
31
+ const loader_1 = require("@uxf/ui/loader/loader");
32
+ const get_file_url_1 = require("@uxf/ui/utils/files/get-file-url");
29
33
  const react_1 = __importStar(require("react"));
30
- const context_1 = require("../context");
31
- const icon_1 = require("../icon");
32
- const loader_1 = require("../loader/loader");
33
34
  function formatBytes(bytes, decimals = 2) {
34
35
  const k = 1024;
35
36
  const dm = decimals < 0 ? 0 : decimals;
@@ -52,9 +53,6 @@ function getIconName(extension) {
52
53
  return "file";
53
54
  }
54
55
  }
55
- function getFileUrl(domain, file) {
56
- return `${domain}/upload/${file.namespace || "default"}/${file.uuid[0]}/${file.uuid[1]}/${file.uuid}.${file.extension}`;
57
- }
58
56
  const DropzoneList = (props) => {
59
57
  const context = (0, react_1.useContext)(context_1.UiContext);
60
58
  const onRemove = (file, isUploading) => () => {
@@ -80,7 +78,7 @@ const DropzoneList = (props) => {
80
78
  react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-dropzone-list__item", !!file.error && classes_1.CLASSES.IS_INVALID) },
81
79
  react_1.default.createElement("div", { className: "uxf-dropzone-list__item__block" },
82
80
  react_1.default.createElement(icon_1.Icon, { className: "uxf-dropzone-list__item__block__icon", name: getIconName(file.extension) }),
83
- (context === null || context === void 0 ? void 0 : context.domain) && file.id > 0 ? (react_1.default.createElement("a", { className: "uxf-dropzone-list__item__block__file-name-link", href: getFileUrl(context.domain, file), target: "_blank", rel: "noreferrer noopenner" }, file.name)) : (react_1.default.createElement("span", { className: "uxf-dropzone-list__item__block__file-name" }, file.name))),
81
+ (context === null || context === void 0 ? void 0 : context.domain) && file.id > 0 ? (react_1.default.createElement("a", { className: "uxf-dropzone-list__item__block__file-name-link", href: (0, get_file_url_1.getFileUrl)(context.domain, file), target: "_blank", rel: "noreferrer noopenner" }, file.name)) : (react_1.default.createElement("span", { className: "uxf-dropzone-list__item__block__file-name" }, file.name))),
84
82
  react_1.default.createElement("div", { className: "uxf-dropzone-list__item__block" },
85
83
  isUploading ? (react_1.default.createElement(loader_1.Loader, { size: "sm" })) : (!file.error &&
86
84
  ((_c = file.originalFile) === null || _c === void 0 ? void 0 : _c.size) && (react_1.default.createElement("span", { className: "uxf-dropzone-list__item__block__file-size" }, formatBytes(file.originalFile.size)))),
@@ -28,20 +28,24 @@ const classes_1 = require("@uxf/core/constants/classes");
28
28
  const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
29
29
  const cx_1 = require("@uxf/core/utils/cx");
30
30
  const forwardRef_1 = require("@uxf/core/utils/forwardRef");
31
+ const context_1 = require("@uxf/ui/context");
31
32
  const form_control_1 = require("@uxf/ui/form-control");
32
33
  const input_1 = require("@uxf/ui/input");
33
34
  const loader_1 = require("@uxf/ui/loader/loader");
35
+ const get_file_url_1 = require("@uxf/ui/utils/files/get-file-url");
34
36
  const react_1 = __importStar(require("react"));
35
37
  const file_input_base_1 = require("./file-input-base");
36
38
  // eslint-disable-next-line complexity
37
39
  exports.FileInput = (0, forwardRef_1.forwardRef)("FileInput", (props, ref) => {
38
40
  var _a, _b;
41
+ const context = (0, react_1.useContext)(context_1.UiContext);
39
42
  const [isUploading, setIsUploading] = (0, react_1.useState)(false);
40
43
  const generatedId = (0, react_1.useId)();
41
44
  const id = props.id || generatedId;
42
45
  const innerRef = (0, react_1.useRef)(null);
43
46
  const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
44
47
  const errorId = props.isInvalid && props.id ? `${props.id}--errormessage` : undefined;
48
+ const fileName = props.value ? `${props.value.name}` : props.placeholder || "No file has been selected yet";
45
49
  const onChange = async (_, e) => {
46
50
  var _a, _b, _c;
47
51
  const file = (_a = e === null || e === void 0 ? void 0 : e.target.files) === null || _a === void 0 ? void 0 : _a[0];
@@ -66,6 +70,6 @@ exports.FileInput = (0, forwardRef_1.forwardRef)("FileInput", (props, ref) => {
66
70
  react_1.default.createElement("label", { className: (0, cx_1.cx)("uxf-input", "uxf-file-input__label", input.focused && classes_1.CLASSES.IS_FOCUSED, (props.isDisabled || props.isReadOnly) && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, isUploading && classes_1.CLASSES.IS_LOADING, isUploading && "uxf-file-input__label--has-right-addon", `uxf-input--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, `uxf-input--variant-${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`), htmlFor: id },
67
71
  react_1.default.createElement("div", { className: "uxf-input__left-addon uxf-file-input__label__button" }, !isUploading ? ("Vyberte soubor") : (react_1.default.createElement(loader_1.Loader, { className: "uxf-file-input__label__loader", size: "sm" }))),
68
72
  react_1.default.createElement("div", { className: "uxf-file-input__label__wrapper" },
69
- react_1.default.createElement("span", { className: "uxf-file-input__label__wrapper__file-name" }, props.value ? `${props.value.name}` : props.placeholder || "No file has been selected yet"),
73
+ (context === null || context === void 0 ? void 0 : context.domain) && props.value ? (react_1.default.createElement("a", { className: "uxf-file-input__label__wrapper__file-name-link", href: (0, get_file_url_1.getFileUrl)(context.domain, props.value), target: "_blank", rel: "noreferrer noopenner" }, fileName)) : (react_1.default.createElement("span", { className: "uxf-file-input__label__wrapper__file-name" }, fileName)),
70
74
  props.value && !props.isDisabled && !props.isReadOnly && props.isClearable && (react_1.default.createElement(input_1.Input.RemoveButton, { onChange: props.onChange })))))));
71
75
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/ui",
3
- "version": "1.0.0-beta.128",
3
+ "version": "1.0.0-beta.129",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -0,0 +1,2 @@
1
+ import { FileResponse } from "@uxf/ui/types";
2
+ export declare function getFileUrl(domain: string, file: FileResponse): string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFileUrl = void 0;
4
+ function getFileUrl(domain, file) {
5
+ return `${domain}/upload/${file.namespace || "default"}/${file.uuid[0]}/${file.uuid[1]}/${file.uuid}.${file.extension}`;
6
+ }
7
+ exports.getFileUrl = getFileUrl;