@astral/ui 0.6.2 → 0.7.1-test.10

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.
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { SelectProps } from './types';
3
+ export declare const Select: ({ multiple, loading, placeholder, helperText, success, children, label, error, ...props }: SelectProps) => JSX.Element;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.Select = void 0;
29
+ var jsx_runtime_1 = require("react/jsx-runtime");
30
+ var react_1 = __importDefault(require("react"));
31
+ var icons_1 = require("@astral/icons");
32
+ var TextField_1 = require("../TextField");
33
+ var Tag_1 = require("../Tag");
34
+ var CircularProgress_1 = require("../CircularProgress");
35
+ var MenuItem_1 = require("../MenuItem");
36
+ var styled_1 = require("./styled");
37
+ var Select = function (_a) {
38
+ var multiple = _a.multiple, loading = _a.loading, placeholder = _a.placeholder, helperText = _a.helperText, success = _a.success, children = _a.children, label = _a.label, error = _a.error, props = __rest(_a, ["multiple", "loading", "placeholder", "helperText", "success", "children", "label", "error"]);
39
+ // unknown, т.к. ts ругается на несоответствие типов. По-умолчанию в selectedOptions string или string[].
40
+ var renderValue = function (selectedOptions) {
41
+ if (Array.isArray(selectedOptions) && selectedOptions.length) {
42
+ return ((0, jsx_runtime_1.jsx)(styled_1.TagsWrapper, { children: selectedOptions.map(function (option) { return ((0, jsx_runtime_1.jsx)(Tag_1.Tag, { color: "grey", label: option }, option)); }) }, void 0));
43
+ }
44
+ if ((Array.isArray(selectedOptions) || typeof selectedOptions === 'string') &&
45
+ !selectedOptions.length) {
46
+ return placeholder;
47
+ }
48
+ return selectedOptions;
49
+ };
50
+ var isNoData = !Boolean(react_1.default.Children.count(children));
51
+ return ((0, jsx_runtime_1.jsxs)(TextField_1.TextField, __assign({ select: true, label: label, helperText: helperText, error: error, success: success, SelectProps: __assign(__assign({}, props), { multiple: multiple, renderValue: renderValue, displayEmpty: true, IconComponent: icons_1.ChevronDOutlineMd }) }, { children: [(0, jsx_runtime_1.jsx)(styled_1.Placeholder, __assign({ value: "" }, { children: "placeholder" }), void 0), loading && ((0, jsx_runtime_1.jsx)(styled_1.ProgressWrapper, { children: (0, jsx_runtime_1.jsx)(CircularProgress_1.CircularProgress, { color: "primary" }, void 0) }, void 0)), !loading && children, !loading && isNoData && (0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, __assign({ disabled: true }, { children: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" }), void 0)] }), void 0));
52
+ };
53
+ exports.Select = Select;
@@ -0,0 +1,2 @@
1
+ export * from './Select';
2
+ export * from './types';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Select"), exports);
14
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,39 @@
1
+ /// <reference types="react" />
2
+ export declare const TagsWrapper: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const ProgressWrapper: import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: import("react").ElementType<any> | undefined;
9
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
+ export declare const Placeholder: import("@emotion/styled").StyledComponent<{
11
+ autoFocus?: boolean | undefined;
12
+ classes?: Partial<import("@mui/material").MenuItemClasses> | undefined;
13
+ dense?: boolean | undefined;
14
+ disabled?: boolean | undefined;
15
+ disableGutters?: boolean | undefined;
16
+ divider?: boolean | undefined;
17
+ selected?: boolean | undefined;
18
+ sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
19
+ } & Omit<{
20
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
21
+ centerRipple?: boolean | undefined;
22
+ children?: import("react").ReactNode;
23
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
24
+ disabled?: boolean | undefined;
25
+ disableRipple?: boolean | undefined;
26
+ disableTouchRipple?: boolean | undefined;
27
+ focusRipple?: boolean | undefined;
28
+ focusVisibleClassName?: string | undefined;
29
+ LinkComponent?: import("react").ElementType<any> | undefined;
30
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
31
+ sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
32
+ tabIndex?: number | undefined;
33
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
34
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
35
+ }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
36
+ ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
37
+ }, "disabled" | "divider" | "action" | keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "children" | "sx" | "autoFocus" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "dense" | "selected" | "disableGutters"> & {
38
+ theme?: import("@emotion/react").Theme | undefined;
39
+ }, {}, {}>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Placeholder = exports.ProgressWrapper = exports.TagsWrapper = void 0;
8
+ var styles_1 = require("../styles");
9
+ var MenuItem_1 = require("../MenuItem");
10
+ exports.TagsWrapper = styles_1.styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n margin-bottom: -", ";\n\n .MuiChip-root {\n margin-bottom: ", ";\n background-color: ", ";\n }\n\n .MuiChip-root:hover {\n background-color: ", ";\n }\n\n .MuiChip-root:not(:last-of-type) {\n margin-right: ", ";\n }\n"], ["\n display: flex;\n flex-wrap: wrap;\n margin-bottom: -", ";\n\n .MuiChip-root {\n margin-bottom: ", ";\n background-color: ", ";\n }\n\n .MuiChip-root:hover {\n background-color: ", ";\n }\n\n .MuiChip-root:not(:last-of-type) {\n margin-right: ", ";\n }\n"])), function (_a) {
11
+ var theme = _a.theme;
12
+ return theme.spacing(1);
13
+ }, function (_a) {
14
+ var theme = _a.theme;
15
+ return theme.spacing(1);
16
+ }, function (_a) {
17
+ var theme = _a.theme;
18
+ return theme.palette.grey['300'];
19
+ }, function (_a) {
20
+ var theme = _a.theme;
21
+ return theme.palette.grey['300'];
22
+ }, function (_a) {
23
+ var theme = _a.theme;
24
+ return theme.spacing(1);
25
+ });
26
+ exports.ProgressWrapper = styles_1.styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 64px;\n align-items: center;\n\n .MuiCircularProgress-root {\n margin-top: ", ";\n color: ", ";\n }\n"], ["\n display: flex;\n flex-direction: column;\n min-height: 64px;\n align-items: center;\n\n .MuiCircularProgress-root {\n margin-top: ", ";\n color: ", ";\n }\n"])), function (_a) {
27
+ var theme = _a.theme;
28
+ return theme.spacing(5);
29
+ }, function (_a) {
30
+ var theme = _a.theme;
31
+ return theme.palette.grey['900'];
32
+ });
33
+ exports.Placeholder = (0, styles_1.styled)(MenuItem_1.MenuItem)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
34
+ var templateObject_1, templateObject_2, templateObject_3;
@@ -0,0 +1,6 @@
1
+ import { SelectProps as MuiSelectProps } from '@mui/material';
2
+ import { TextFieldProps } from '../TextField';
3
+ export declare type SelectProps = MuiSelectProps & Pick<TextFieldProps, 'error' | 'success' | 'SelectProps' | 'helperText' | 'label'> & {
4
+ loading?: boolean;
5
+ placeholder?: string;
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { SelectProps } from './types';
3
+ export declare const Select: ({ multiple, loading, placeholder, helperText, success, children, label, error, ...props }: SelectProps) => JSX.Element;
@@ -0,0 +1,46 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import React from 'react';
25
+ import { ChevronDOutlineMd } from '@astral/icons';
26
+ import { TextField } from '../TextField';
27
+ import { Tag } from '../Tag';
28
+ import { CircularProgress } from '../CircularProgress';
29
+ import { MenuItem } from '../MenuItem';
30
+ import { Placeholder, ProgressWrapper, TagsWrapper } from './styled';
31
+ export var Select = function (_a) {
32
+ var multiple = _a.multiple, loading = _a.loading, placeholder = _a.placeholder, helperText = _a.helperText, success = _a.success, children = _a.children, label = _a.label, error = _a.error, props = __rest(_a, ["multiple", "loading", "placeholder", "helperText", "success", "children", "label", "error"]);
33
+ // unknown, т.к. ts ругается на несоответствие типов. По-умолчанию в selectedOptions string или string[].
34
+ var renderValue = function (selectedOptions) {
35
+ if (Array.isArray(selectedOptions) && selectedOptions.length) {
36
+ return (_jsx(TagsWrapper, { children: selectedOptions.map(function (option) { return (_jsx(Tag, { color: "grey", label: option }, option)); }) }, void 0));
37
+ }
38
+ if ((Array.isArray(selectedOptions) || typeof selectedOptions === 'string') &&
39
+ !selectedOptions.length) {
40
+ return placeholder;
41
+ }
42
+ return selectedOptions;
43
+ };
44
+ var isNoData = !Boolean(React.Children.count(children));
45
+ return (_jsxs(TextField, __assign({ select: true, label: label, helperText: helperText, error: error, success: success, SelectProps: __assign(__assign({}, props), { multiple: multiple, renderValue: renderValue, displayEmpty: true, IconComponent: ChevronDOutlineMd }) }, { children: [_jsx(Placeholder, __assign({ value: "" }, { children: "placeholder" }), void 0), loading && (_jsx(ProgressWrapper, { children: _jsx(CircularProgress, { color: "primary" }, void 0) }, void 0)), !loading && children, !loading && isNoData && _jsx(MenuItem, __assign({ disabled: true }, { children: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" }), void 0)] }), void 0));
46
+ };
@@ -0,0 +1,2 @@
1
+ export * from './Select';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './Select';
2
+ export * from './types';
@@ -0,0 +1,39 @@
1
+ /// <reference types="react" />
2
+ export declare const TagsWrapper: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const ProgressWrapper: import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: import("react").ElementType<any> | undefined;
9
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
+ export declare const Placeholder: import("@emotion/styled").StyledComponent<{
11
+ autoFocus?: boolean | undefined;
12
+ classes?: Partial<import("@mui/material").MenuItemClasses> | undefined;
13
+ dense?: boolean | undefined;
14
+ disabled?: boolean | undefined;
15
+ disableGutters?: boolean | undefined;
16
+ divider?: boolean | undefined;
17
+ selected?: boolean | undefined;
18
+ sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
19
+ } & Omit<{
20
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
21
+ centerRipple?: boolean | undefined;
22
+ children?: import("react").ReactNode;
23
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
24
+ disabled?: boolean | undefined;
25
+ disableRipple?: boolean | undefined;
26
+ disableTouchRipple?: boolean | undefined;
27
+ focusRipple?: boolean | undefined;
28
+ focusVisibleClassName?: string | undefined;
29
+ LinkComponent?: import("react").ElementType<any> | undefined;
30
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
31
+ sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
32
+ tabIndex?: number | undefined;
33
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
34
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
35
+ }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
36
+ ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
37
+ }, "disabled" | "divider" | "action" | keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "children" | "sx" | "autoFocus" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "dense" | "selected" | "disableGutters"> & {
38
+ theme?: import("@emotion/react").Theme | undefined;
39
+ }, {}, {}>;
@@ -0,0 +1,31 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import { styled } from '../styles';
6
+ import { MenuItem } from '../MenuItem';
7
+ export var TagsWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n margin-bottom: -", ";\n\n .MuiChip-root {\n margin-bottom: ", ";\n background-color: ", ";\n }\n\n .MuiChip-root:hover {\n background-color: ", ";\n }\n\n .MuiChip-root:not(:last-of-type) {\n margin-right: ", ";\n }\n"], ["\n display: flex;\n flex-wrap: wrap;\n margin-bottom: -", ";\n\n .MuiChip-root {\n margin-bottom: ", ";\n background-color: ", ";\n }\n\n .MuiChip-root:hover {\n background-color: ", ";\n }\n\n .MuiChip-root:not(:last-of-type) {\n margin-right: ", ";\n }\n"])), function (_a) {
8
+ var theme = _a.theme;
9
+ return theme.spacing(1);
10
+ }, function (_a) {
11
+ var theme = _a.theme;
12
+ return theme.spacing(1);
13
+ }, function (_a) {
14
+ var theme = _a.theme;
15
+ return theme.palette.grey['300'];
16
+ }, function (_a) {
17
+ var theme = _a.theme;
18
+ return theme.palette.grey['300'];
19
+ }, function (_a) {
20
+ var theme = _a.theme;
21
+ return theme.spacing(1);
22
+ });
23
+ export var ProgressWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 64px;\n align-items: center;\n\n .MuiCircularProgress-root {\n margin-top: ", ";\n color: ", ";\n }\n"], ["\n display: flex;\n flex-direction: column;\n min-height: 64px;\n align-items: center;\n\n .MuiCircularProgress-root {\n margin-top: ", ";\n color: ", ";\n }\n"])), function (_a) {
24
+ var theme = _a.theme;
25
+ return theme.spacing(5);
26
+ }, function (_a) {
27
+ var theme = _a.theme;
28
+ return theme.palette.grey['900'];
29
+ });
30
+ export var Placeholder = styled(MenuItem)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
31
+ var templateObject_1, templateObject_2, templateObject_3;
@@ -0,0 +1,6 @@
1
+ import { SelectProps as MuiSelectProps } from '@mui/material';
2
+ import { TextFieldProps } from '../TextField';
3
+ export declare type SelectProps = MuiSelectProps & Pick<TextFieldProps, 'error' | 'success' | 'SelectProps' | 'helperText' | 'label'> & {
4
+ loading?: boolean;
5
+ placeholder?: string;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
package/esm/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from './Tooltip';
21
21
  export * from './TextArea';
22
22
  export * from './DashboardLayout';
23
23
  export * from './Autocomplete';
24
+ export * from './Select';
package/esm/index.js CHANGED
@@ -21,3 +21,4 @@ export * from './Tooltip';
21
21
  export * from './TextArea';
22
22
  export * from './DashboardLayout';
23
23
  export * from './Autocomplete';
24
+ export * from './Select';
package/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from './Tooltip';
21
21
  export * from './TextArea';
22
22
  export * from './DashboardLayout';
23
23
  export * from './Autocomplete';
24
+ export * from './Select';
package/index.js CHANGED
@@ -33,3 +33,4 @@ __exportStar(require("./Tooltip"), exports);
33
33
  __exportStar(require("./TextArea"), exports);
34
34
  __exportStar(require("./DashboardLayout"), exports);
35
35
  __exportStar(require("./Autocomplete"), exports);
36
+ __exportStar(require("./Select"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "0.6.2",
3
+ "version": "0.7.1-test.10",
4
4
  "browser": "./src/index.ts",
5
5
  "jest": {
6
6
  "moduleNameMapper": {
@@ -8,7 +8,7 @@
8
8
  }
9
9
  },
10
10
  "dependencies": {
11
- "@astral/icons": "^0.5.1",
11
+ "@astral/icons": "^0.6.2",
12
12
  "@emotion/cache": "11.7.1",
13
13
  "@emotion/react": "11.8.1",
14
14
  "@emotion/server": "11.4.0",