@veracity/vui 1.5.0-beta.1 → 1.5.0
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/dist/cjs/accordion/accordion.d.ts.map +1 -1
- package/dist/cjs/accordion/accordion.js +32 -6
- package/dist/cjs/accordion/accordionItem.d.ts.map +1 -1
- package/dist/cjs/accordion/accordionItem.js +4 -2
- package/dist/cjs/accordion/context.d.ts +5 -0
- package/dist/cjs/accordion/context.d.ts.map +1 -0
- package/dist/cjs/accordion/context.js +7 -0
- package/dist/cjs/accordion/theme.d.ts +23 -2
- package/dist/cjs/accordion/theme.d.ts.map +1 -1
- package/dist/cjs/accordion/theme.js +23 -2
- package/dist/cjs/buttonGroup/buttonGroup.d.ts.map +1 -1
- package/dist/cjs/buttonGroup/buttonGroup.js +4 -0
- package/dist/cjs/input/consts.d.ts +3 -0
- package/dist/cjs/input/consts.d.ts.map +1 -1
- package/dist/cjs/input/consts.js +4 -1
- package/dist/cjs/input/helpText.d.ts +5 -0
- package/dist/cjs/input/helpText.d.ts.map +1 -0
- package/dist/cjs/input/helpText.js +36 -0
- package/dist/cjs/input/input.d.ts +2 -0
- package/dist/cjs/input/input.d.ts.map +1 -1
- package/dist/cjs/input/input.js +8 -4
- package/dist/cjs/input/input.types.d.ts +9 -1
- package/dist/cjs/input/input.types.d.ts.map +1 -1
- package/dist/cjs/list/listText.d.ts.map +1 -1
- package/dist/cjs/list/listText.js +1 -1
- package/dist/cjs/select/select.d.ts.map +1 -1
- package/dist/cjs/select/select.js +1 -1
- package/dist/cjs/select/select.types.d.ts +2 -0
- package/dist/cjs/select/select.types.d.ts.map +1 -1
- package/dist/cjs/select/selectButton.d.ts.map +1 -1
- package/dist/cjs/select/selectButton.js +1 -1
- package/dist/cjs/select/selectOption.d.ts.map +1 -1
- package/dist/cjs/select/selectOption.js +2 -2
- package/dist/cjs/theme/components.d.ts +23 -2
- package/dist/cjs/theme/components.d.ts.map +1 -1
- package/dist/cjs/theme/defaultTheme.d.ts +23 -2
- package/dist/cjs/theme/defaultTheme.d.ts.map +1 -1
- package/dist/cjs/utils/styles.d.ts +7 -0
- package/dist/cjs/utils/styles.d.ts.map +1 -1
- package/dist/cjs/utils/styles.js +10 -11
- package/dist/esm/accordion/accordion.d.ts.map +1 -1
- package/dist/esm/accordion/accordion.js +10 -7
- package/dist/esm/accordion/accordionItem.d.ts.map +1 -1
- package/dist/esm/accordion/accordionItem.js +5 -3
- package/dist/esm/accordion/context.d.ts +5 -0
- package/dist/esm/accordion/context.d.ts.map +1 -0
- package/dist/esm/accordion/context.js +3 -0
- package/dist/esm/accordion/theme.d.ts +23 -2
- package/dist/esm/accordion/theme.d.ts.map +1 -1
- package/dist/esm/accordion/theme.js +23 -2
- package/dist/esm/buttonGroup/buttonGroup.d.ts.map +1 -1
- package/dist/esm/buttonGroup/buttonGroup.js +4 -0
- package/dist/esm/input/consts.d.ts +3 -0
- package/dist/esm/input/consts.d.ts.map +1 -1
- package/dist/esm/input/consts.js +3 -0
- package/dist/esm/input/helpText.d.ts +5 -0
- package/dist/esm/input/helpText.d.ts.map +1 -0
- package/dist/esm/input/helpText.js +19 -0
- package/dist/esm/input/input.d.ts +2 -0
- package/dist/esm/input/input.d.ts.map +1 -1
- package/dist/esm/input/input.js +9 -5
- package/dist/esm/input/input.types.d.ts +9 -1
- package/dist/esm/input/input.types.d.ts.map +1 -1
- package/dist/esm/list/listText.d.ts.map +1 -1
- package/dist/esm/list/listText.js +2 -2
- package/dist/esm/select/select.d.ts.map +1 -1
- package/dist/esm/select/select.js +2 -1
- package/dist/esm/select/select.types.d.ts +2 -0
- package/dist/esm/select/select.types.d.ts.map +1 -1
- package/dist/esm/select/selectButton.d.ts.map +1 -1
- package/dist/esm/select/selectButton.js +2 -2
- package/dist/esm/select/selectOption.d.ts.map +1 -1
- package/dist/esm/select/selectOption.js +3 -3
- package/dist/esm/theme/components.d.ts +23 -2
- package/dist/esm/theme/components.d.ts.map +1 -1
- package/dist/esm/theme/defaultTheme.d.ts +23 -2
- package/dist/esm/theme/defaultTheme.d.ts.map +1 -1
- package/dist/esm/utils/styles.d.ts +7 -0
- package/dist/esm/utils/styles.d.ts.map +1 -1
- package/dist/esm/utils/styles.js +9 -10
- package/package.json +1 -1
- package/src/accordion/accordion.tsx +15 -10
- package/src/accordion/accordionItem.tsx +6 -8
- package/src/accordion/context.ts +5 -0
- package/src/accordion/theme.ts +23 -2
- package/src/buttonGroup/buttonGroup.tsx +4 -0
- package/src/input/consts.ts +4 -0
- package/src/input/helpText.tsx +36 -0
- package/src/input/input.tsx +18 -9
- package/src/input/input.types.ts +11 -0
- package/src/list/listText.tsx +11 -2
- package/src/select/select.tsx +2 -1
- package/src/select/select.types.ts +2 -0
- package/src/select/selectButton.tsx +6 -2
- package/src/select/selectOption.tsx +4 -2
- package/src/utils/styles.ts +12 -10
package/dist/cjs/utils/styles.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hexToRGBA = exports.cs = void 0;
|
|
3
|
+
exports.ellipsisOverflow = exports.hexToRGBA = exports.cs = void 0;
|
|
4
4
|
/** Concatenates individual className arguments and returns a single string. */
|
|
5
5
|
function cs(...classNames) {
|
|
6
6
|
return classNames.filter(Boolean).join(' ');
|
|
@@ -9,23 +9,22 @@ exports.cs = cs;
|
|
|
9
9
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
10
10
|
function hexToRGBA(hex, alpha) {
|
|
11
11
|
let hexStr = hex;
|
|
12
|
-
if (hexStr.charAt(0) === '#')
|
|
12
|
+
if (hexStr.charAt(0) === '#')
|
|
13
13
|
hexStr = hexStr.slice(1);
|
|
14
|
-
|
|
15
|
-
if (hexStr.length < 4) {
|
|
14
|
+
if (hexStr.length < 4)
|
|
16
15
|
hexStr = hexStr
|
|
17
16
|
.split('')
|
|
18
17
|
.map(char => char + char)
|
|
19
18
|
.join('');
|
|
20
|
-
}
|
|
21
19
|
const r = parseInt(hexStr.slice(0, 2), 16);
|
|
22
20
|
const g = parseInt(hexStr.slice(2, 4), 16);
|
|
23
21
|
const b = parseInt(hexStr.slice(4, 6), 16);
|
|
24
|
-
|
|
25
|
-
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
return `rgb(${r}, ${g}, ${b})`;
|
|
29
|
-
}
|
|
22
|
+
return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
|
|
30
23
|
}
|
|
31
24
|
exports.hexToRGBA = hexToRGBA;
|
|
25
|
+
/** Styling to add ellipsis for long texts. */
|
|
26
|
+
exports.ellipsisOverflow = {
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
textOverflow: 'ellipsis',
|
|
29
|
+
whiteSpace: 'nowrap'
|
|
30
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/accordion/accordion.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAsB,cAAc,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../src/accordion/accordion.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAsB,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAItE,eAAO,MAAM,aAAa,+HAIzB,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,SAAS,uDAmBpB,CAAA;AAEF,eAAe,SAAS,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { styled, useStyleConfig, vui } from '../core';
|
|
3
3
|
import List from '../list';
|
|
4
4
|
import { cs, filterUndefined } from '../utils';
|
|
5
5
|
import AccordionItem from './accordionItem';
|
|
6
|
+
import { AccordionProvider } from './context';
|
|
6
7
|
export const AccordionBase = styled.divBox `
|
|
7
8
|
display: flex;
|
|
8
9
|
min-width: 0;
|
|
@@ -10,12 +11,14 @@ export const AccordionBase = styled.divBox `
|
|
|
10
11
|
`;
|
|
11
12
|
/** [BETA] Allows to show and hide sections of related content on a page. */
|
|
12
13
|
export const Accordion = vui((props, ref) => {
|
|
13
|
-
const {
|
|
14
|
+
const { children, className, items, size, ...rest } = props;
|
|
14
15
|
const styles = useStyleConfig('Accordion', props);
|
|
16
|
+
const context = useMemo(() => filterUndefined({ size }), [size]);
|
|
15
17
|
const aliasedProps = filterUndefined({});
|
|
16
|
-
return (React.createElement(
|
|
17
|
-
React.createElement(
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
return (React.createElement(AccordionProvider, { value: context },
|
|
19
|
+
React.createElement(AccordionBase, { className: cs('vui-accordion', className), ref: ref, ...styles, ...aliasedProps, ...rest },
|
|
20
|
+
React.createElement(List, { w: "100%" }, items
|
|
21
|
+
? items?.map?.((item, key) => React.createElement(AccordionItem, { key: key, ...item }))
|
|
22
|
+
: children))));
|
|
20
23
|
});
|
|
21
24
|
export default Accordion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordionItem.d.ts","sourceRoot":"","sources":["../../../src/accordion/accordionItem.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"accordionItem.d.ts","sourceRoot":"","sources":["../../../src/accordion/accordionItem.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAItD,yBAAyB;AACzB,eAAO,MAAM,aAAa,UAAW,kBAAkB,gBA2CtD,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Box } from '../box';
|
|
3
|
-
import { omitThemingProps } from '../core';
|
|
3
|
+
import { omitThemingProps, useStyleConfig } from '../core';
|
|
4
4
|
import { ListItem } from '../list';
|
|
5
5
|
import { cs } from '../utils';
|
|
6
6
|
import AccordionItemArrow from './accordionItemArrow';
|
|
7
|
+
import { useAccordionContext } from './context';
|
|
7
8
|
/** An accordion item. */
|
|
8
9
|
export const AccordionItem = (props) => {
|
|
9
10
|
const { className, children, id, content, disabled, title, collapsed, onToggle, ...rest } = omitThemingProps(props);
|
|
10
11
|
const [collapsedInternal, setIsCollapsedInternal] = useState(false);
|
|
12
|
+
const styles = useStyleConfig('Accordion', useAccordionContext());
|
|
11
13
|
useEffect(() => {
|
|
12
14
|
setIsCollapsedInternal(!!collapsed);
|
|
13
15
|
}, [collapsed]);
|
|
@@ -17,8 +19,8 @@ export const AccordionItem = (props) => {
|
|
|
17
19
|
setIsCollapsedInternal(!collapsedInternal);
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
|
-
return (React.createElement(ListItem, { borderBottom: "1px solid grey.40", className: cs('vui-accordion-item', className), disabled: disabled, flexDirection: "column", h: "auto", hoverBg: "blue.10", id: `${id}`, w: "100%", ...rest },
|
|
21
|
-
React.createElement(Box, { cursor: disabled ? 'not-allowed' : 'pointer', justifyContent: "space-between", onClick: toggle,
|
|
22
|
+
return (React.createElement(ListItem, { borderBottom: "1px solid grey.40", className: cs('vui-accordion-item', className), disabled: disabled, flexDirection: "column", h: "auto", hoverBg: "blue.10", id: `${id}`, w: "100%", ...styles.item, ...rest },
|
|
23
|
+
React.createElement(Box, { cursor: disabled ? 'not-allowed' : 'pointer', justifyContent: "space-between", onClick: toggle, w: "100%" },
|
|
22
24
|
React.createElement(Box, { fontWeight: typeof title === 'string' ? '500' : 'inherit' }, title),
|
|
23
25
|
React.createElement(Box, null,
|
|
24
26
|
React.createElement(AccordionItemArrow, { collapsed: collapsedInternal }))),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/accordion/context.ts"],"names":[],"mappings":";AAAA,OAAO,EAAiB,IAAI,EAAE,MAAM,UAAU,CAAA;AAE9C,QAAA,MAAO,iBAAiB,uCAAE,mBAAmB,iBAA6C,CAAA;AAE1F,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
baseStyle: {};
|
|
3
|
-
defaultProps: {
|
|
4
|
-
|
|
3
|
+
defaultProps: {
|
|
4
|
+
size: string;
|
|
5
|
+
};
|
|
6
|
+
sizes: {
|
|
7
|
+
sm: {
|
|
8
|
+
item: {
|
|
9
|
+
minH: string;
|
|
10
|
+
pt: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
md: {
|
|
14
|
+
item: {
|
|
15
|
+
minH: string;
|
|
16
|
+
pt: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
lg: {
|
|
20
|
+
item: {
|
|
21
|
+
minH: string;
|
|
22
|
+
pt: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
5
26
|
variants: {};
|
|
6
27
|
};
|
|
7
28
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/accordion/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/accordion/theme.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,wBAKC"}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
const baseStyle = {};
|
|
2
|
-
const defaultProps = {
|
|
3
|
-
|
|
2
|
+
const defaultProps = {
|
|
3
|
+
size: 'md'
|
|
4
|
+
};
|
|
5
|
+
const sizes = {
|
|
6
|
+
sm: {
|
|
7
|
+
item: {
|
|
8
|
+
minH: '32px',
|
|
9
|
+
pt: '8px'
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
md: {
|
|
13
|
+
item: {
|
|
14
|
+
minH: '40px',
|
|
15
|
+
pt: '12px'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
lg: {
|
|
19
|
+
item: {
|
|
20
|
+
minH: '48px',
|
|
21
|
+
pt: '14px'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
4
25
|
const variants = {};
|
|
5
26
|
export default {
|
|
6
27
|
baseStyle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttonGroup.d.ts","sourceRoot":"","sources":["../../../src/buttonGroup/buttonGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAItD,eAAO,MAAM,eAAe;;sBAA2D,MAAM;
|
|
1
|
+
{"version":3,"file":"buttonGroup.d.ts","sourceRoot":"","sources":["../../../src/buttonGroup/buttonGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAItD,eAAO,MAAM,eAAe;;sBAA2D,MAAM;SA2C5F,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,yDAiBtB,CAAA;AAEF,eAAe,WAAW,CAAA"}
|
|
@@ -38,6 +38,10 @@ export const ButtonGroupBase = styled.divBox `
|
|
|
38
38
|
border-color: ${p => th.color(p.innerBorderColor)};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
> *:disabled {
|
|
42
|
+
border-color: disabled.border;
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
//
|
|
42
46
|
> .${activeClassName} {
|
|
43
47
|
background-color: ${p => th.color(`${p.colorScheme}.${activeItemShade}`)};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { InputStateMapping } from './input.types';
|
|
2
|
+
export declare const greyLightColor = "grey.10";
|
|
3
|
+
export declare const greyColor = "grey.80";
|
|
4
|
+
export declare const redColor = "red.80";
|
|
2
5
|
export declare const inputStateMapping: InputStateMapping;
|
|
3
6
|
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/input/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,eAAO,MAAM,iBAAiB,EAAE,iBAuB/B,CAAA"}
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/input/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,eAAO,MAAM,cAAc,YAAY,CAAA;AACvC,eAAO,MAAM,SAAS,YAAY,CAAA;AAClC,eAAO,MAAM,QAAQ,WAAW,CAAA;AAEhC,eAAO,MAAM,iBAAiB,EAAE,iBAuB/B,CAAA"}
|
package/dist/esm/input/consts.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpText.d.ts","sourceRoot":"","sources":["../../../src/input/helpText.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE7C,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,sDAsBnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useStyleConfig, vui } from '../core';
|
|
3
|
+
import Icon from '../icon';
|
|
4
|
+
import P from '../p';
|
|
5
|
+
import { cs } from '../utils';
|
|
6
|
+
import { greyColor, redColor } from './consts';
|
|
7
|
+
import { useInputContext } from './context';
|
|
8
|
+
/** Displaying help text bellow an input.. */
|
|
9
|
+
export const HelpText = vui((props, ref) => {
|
|
10
|
+
const { className, children, isError, ...rest } = props;
|
|
11
|
+
const inputProps = useInputContext();
|
|
12
|
+
const mergedProps = { ...inputProps, ...props };
|
|
13
|
+
const styles = useStyleConfig('Input', mergedProps);
|
|
14
|
+
const color = isError ? redColor : greyColor;
|
|
15
|
+
return (React.createElement(P, { className: cs('vui-inputHelpText', className), color: color, display: "flex", py: 1, ref: ref, ...styles.helpText, ...rest },
|
|
16
|
+
isError && React.createElement(Icon, { mr: 1, name: "falExclamationTriangle", pathFill: redColor, size: "sm" }),
|
|
17
|
+
children));
|
|
18
|
+
});
|
|
19
|
+
export default HelpText;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VuiComponent } from '../core';
|
|
2
|
+
import HelpText from './helpText';
|
|
2
3
|
import { InputProps } from './input.types';
|
|
3
4
|
import InputIcon from './inputIcon';
|
|
4
5
|
import InputInput from './inputInput';
|
|
@@ -11,6 +12,7 @@ export declare const InputBase: import("styled-components").StyledComponent<"div
|
|
|
11
12
|
export declare const Input: VuiComponent<"div", InputProps> & {
|
|
12
13
|
Icon: typeof InputIcon;
|
|
13
14
|
Input: typeof InputInput;
|
|
15
|
+
HelpText: typeof HelpText;
|
|
14
16
|
};
|
|
15
17
|
export default Input;
|
|
16
18
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+HAiBrB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK;
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+HAiBrB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK;UAwHV,gBAAgB;WACf,iBAAiB;cACd,eAAe;CAC1B,CAAA;AAMD,eAAe,KAAK,CAAA"}
|
package/dist/esm/input/input.js
CHANGED
|
@@ -2,9 +2,10 @@ import React, { useMemo, useState } from 'react';
|
|
|
2
2
|
import { styled, useStyleConfig, vui } from '../core';
|
|
3
3
|
import { T } from '../t';
|
|
4
4
|
import { cs, filterUndefined, isString } from '../utils';
|
|
5
|
-
import { inputStateMapping } from './consts';
|
|
5
|
+
import { greyColor, greyLightColor, inputStateMapping } from './consts';
|
|
6
6
|
import { InputProvider } from './context';
|
|
7
7
|
import { getInitialCount } from './helpers';
|
|
8
|
+
import HelpText from './helpText';
|
|
8
9
|
import InputIcon from './inputIcon';
|
|
9
10
|
import InputInput from './inputInput';
|
|
10
11
|
export const InputBase = styled.divBox `
|
|
@@ -32,7 +33,7 @@ export const InputBase = styled.divBox `
|
|
|
32
33
|
*/
|
|
33
34
|
export const Input = vui((props, ref) => {
|
|
34
35
|
const [count, setCount] = useState(getInitialCount(props));
|
|
35
|
-
const { autoComplete, autoFocus, children, className, colorScheme, defaultValue, disabled, iconLeft, iconRight, id, input, inputProps, inputRef, isInvalid, itemLeft, itemRight, max, maxLength, min, name, onBlur, onChange: onChangeProp, onFocus, pattern, placeholder, readOnly, required, showCount, size, state = '', stateMapping, step, type = 'text', value, variant, ...rest } = props;
|
|
36
|
+
const { autoComplete, autoFocus, children, className, colorScheme, defaultValue, disabled, errorText, iconLeft, iconRight, id, input, inputProps, inputRef, isInvalid, itemLeft, itemRight, helpText, max, maxLength, min, name, onBlur, onChange: onChangeProp, onFocus, pattern, placeholder, readOnly, required, showCount, size, state = '', stateMapping, step, type = 'text', value, variant, ...rest } = props;
|
|
36
37
|
const states = { ...inputStateMapping, ...stateMapping };
|
|
37
38
|
const computedColorScheme = filterUndefined({
|
|
38
39
|
colorScheme: colorScheme ?? (isInvalid ? 'red' : undefined) ?? states[state]?.colorScheme
|
|
@@ -45,7 +46,7 @@ export const Input = vui((props, ref) => {
|
|
|
45
46
|
}
|
|
46
47
|
const aliasedProps = filterUndefined({
|
|
47
48
|
'aria-disabled': disabled,
|
|
48
|
-
bg: readOnly ?
|
|
49
|
+
bg: readOnly ? greyLightColor : undefined,
|
|
49
50
|
focusWithinBorderColor: !readOnly ? 'transparent' : undefined,
|
|
50
51
|
focusWithinRingColor: readOnly ? 'transparent' : undefined
|
|
51
52
|
});
|
|
@@ -77,11 +78,14 @@ export const Input = vui((props, ref) => {
|
|
|
77
78
|
isString(iconRight) ? React.createElement(InputIcon, { mr: 1, name: iconRight }) : iconRight,
|
|
78
79
|
itemRight,
|
|
79
80
|
state && React.createElement(InputIcon, { mr: 1, ...states[state]?.iconProps }),
|
|
80
|
-
showCount && (React.createElement(T, { className: "vui-inputCount", color:
|
|
81
|
+
showCount && (React.createElement(T, { className: "vui-inputCount", color: greyColor, position: "absolute", right: 0, size: "sm", top: "calc(100% + 1px)" },
|
|
81
82
|
count,
|
|
82
83
|
" / ",
|
|
83
|
-
maxLength)))
|
|
84
|
+
maxLength))),
|
|
85
|
+
!!helpText && React.createElement(HelpText, null, helpText),
|
|
86
|
+
!!errorText && React.createElement(HelpText, { isError: true }, errorText)));
|
|
84
87
|
});
|
|
85
88
|
Input.Icon = InputIcon;
|
|
86
89
|
Input.Input = InputInput;
|
|
90
|
+
Input.HelpText = HelpText;
|
|
87
91
|
export default Input;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IconProp, IconProps } from '../icon';
|
|
3
|
+
import { PProps } from '../p';
|
|
3
4
|
import { SystemProps } from '../system';
|
|
4
5
|
import { ThemingProps } from '../theme';
|
|
5
6
|
import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../utils';
|
|
@@ -15,6 +16,8 @@ export declare type InputProps = SystemProps & ThemingProps<'Input'> & {
|
|
|
15
16
|
defaultValue?: number | string;
|
|
16
17
|
/** Passed to the inner input. */
|
|
17
18
|
disabled?: boolean;
|
|
19
|
+
/** Socket displaying error text bellow an input. */
|
|
20
|
+
errorText?: string | React.ReactNode;
|
|
18
21
|
/** Socket displaying an icon on the left. */
|
|
19
22
|
iconLeft?: IconProp | JSX.Element;
|
|
20
23
|
/** Socket displaying an icon on the right. */
|
|
@@ -31,6 +34,8 @@ export declare type InputProps = SystemProps & ThemingProps<'Input'> & {
|
|
|
31
34
|
itemLeft?: React.ReactNode;
|
|
32
35
|
/** Socket displaying a custom element on the right. */
|
|
33
36
|
itemRight?: React.ReactNode;
|
|
37
|
+
/** Socket displaying help text bellow an input. */
|
|
38
|
+
helpText?: React.ReactNode | string;
|
|
34
39
|
/** Passed to the inner input. */
|
|
35
40
|
max?: number | string;
|
|
36
41
|
/** Passed to the inner input. */
|
|
@@ -66,6 +71,9 @@ export declare type InputProps = SystemProps & ThemingProps<'Input'> & {
|
|
|
66
71
|
/** Passed to the inner input. */
|
|
67
72
|
value?: number | string;
|
|
68
73
|
};
|
|
74
|
+
export declare type HelpTextProps = PProps & {
|
|
75
|
+
isError?: boolean;
|
|
76
|
+
};
|
|
69
77
|
export declare type InputState = 'default' | 'error' | 'loading' | 'success';
|
|
70
78
|
export declare type InputStateMapping = Record<string, {
|
|
71
79
|
colorScheme?: InputProps['colorScheme'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.types.d.ts","sourceRoot":"","sources":["../../../src/input/input.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.types.d.ts","sourceRoot":"","sources":["../../../src/input/input.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA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EpE,oBAAY,iBAAiB,GAAG,MAAM,CACpC,MAAM,EACN;IACE,WAAW,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACvC,SAAS,EAAE,SAAS,CAAA;CACrB,CACF,CAAA;AAED,oBAAY,SAAS,GACjB,MAAM,GACN,gBAAgB,GAChB,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listText.d.ts","sourceRoot":"","sources":["../../../src/list/listText.tsx"],"names":[],"mappings":"AAGA,OAAU,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIhC,yCAAyC;AACzC,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"listText.d.ts","sourceRoot":"","sources":["../../../src/list/listText.tsx"],"names":[],"mappings":"AAGA,OAAU,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIhC,yCAAyC;AACzC,eAAO,MAAM,QAAQ,gDAcnB,CAAA;AAEF,eAAe,QAAQ,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useStyleConfig, vui } from '../core';
|
|
3
3
|
import T from '../t';
|
|
4
|
-
import { cs } from '../utils';
|
|
4
|
+
import { cs, ellipsisOverflow } from '../utils';
|
|
5
5
|
import { useListContext } from './context';
|
|
6
6
|
/** Displays text within the ListItem. */
|
|
7
7
|
export const ListText = vui((props, ref) => {
|
|
8
8
|
const { className, ...rest } = props;
|
|
9
9
|
const styles = useStyleConfig('List', useListContext());
|
|
10
|
-
return React.createElement(T, { className: cs('vui-listText', className), fontSize: "inherit", ref: ref, ...styles.text, ...rest });
|
|
10
|
+
return (React.createElement(T, { className: cs('vui-listText', className), fontSize: "inherit", ref: ref, ...ellipsisOverflow, ...styles.text, ...rest }));
|
|
11
11
|
});
|
|
12
12
|
export default ListText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/select/select.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/select/select.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,eAqDxC;yBArDe,MAAM;;;;;;;;;AA4DtB,eAAe,MAAM,CAAA"}
|
|
@@ -35,7 +35,8 @@ export function Select(props) {
|
|
|
35
35
|
React.createElement(React.Fragment, null,
|
|
36
36
|
selectButton ?? React.createElement(SelectButton, null),
|
|
37
37
|
React.createElement(SelectContent, null,
|
|
38
|
-
React.createElement(SelectGroup, null, children ??
|
|
38
|
+
React.createElement(SelectGroup, null, children ??
|
|
39
|
+
options?.map?.(option => React.createElement(SelectOption, { key: option.value, title: option.text, ...option }))))))));
|
|
39
40
|
}
|
|
40
41
|
Select.Button = SelectButton;
|
|
41
42
|
Select.Content = SelectContent;
|
|
@@ -36,6 +36,8 @@ export declare type SelectOptionData = {
|
|
|
36
36
|
export declare type SelectOptionProps = ListItemProps & {
|
|
37
37
|
/** Currently selected value. Can be a string/number or array of those when using 'isMultiple'. */
|
|
38
38
|
value?: SelectValue;
|
|
39
|
+
/** Hover title text. */
|
|
40
|
+
title?: string;
|
|
39
41
|
};
|
|
40
42
|
export declare type SelectValue = number | string;
|
|
41
43
|
//# sourceMappingURL=select.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.types.d.ts","sourceRoot":"","sources":["../../../src/select/select.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS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CAAC,EAAE,MAAM,CAAA;IACpB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iCAAiC;IACjC,YAAY,CAAC,EAAE,SAAS,CAAA;CACzB,CAAA;AAEH,oBAAY,gBAAgB,GAAG;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,+BAA+B;IAC/B,KAAK,EAAE,WAAW,CAAA;CACnB,CAAA;AAED,oBAAY,iBAAiB,GAAG,aAAa,GAAG;IAC9C,mGAAmG;IACnG,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,oBAAY,WAAW,GAAG,MAAM,GAAG,MAAM,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectButton.d.ts","sourceRoot":"","sources":["../../../src/select/selectButton.tsx"],"names":[],"mappings":"AASA;;;;GAIG;AACH,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"selectButton.d.ts","sourceRoot":"","sources":["../../../src/select/selectButton.tsx"],"names":[],"mappings":"AASA;;;;GAIG;AACH,eAAO,MAAM,YAAY,2EAoDvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import Button, { LineButton } from '../button';
|
|
3
3
|
import { useStyleConfig, vui } from '../core';
|
|
4
4
|
import { PopoverTrigger } from '../popover';
|
|
5
|
-
import { cs } from '../utils';
|
|
5
|
+
import { cs, ellipsisOverflow } from '../utils';
|
|
6
6
|
import { useSelectContext } from './context';
|
|
7
7
|
/**
|
|
8
8
|
* Displays a custom button component, which opens a popover on click.
|
|
@@ -32,6 +32,6 @@ export const SelectButton = vui((props, ref) => {
|
|
|
32
32
|
hoverBorderColor: 'red.80'
|
|
33
33
|
}
|
|
34
34
|
: {};
|
|
35
|
-
return (React.createElement(PopoverTrigger, { as: LineButton, bg: "white", className: cs('vui-selectButton', className), colorScheme: "prussian", disabled: disabled, focusRing: 2, fontWeight: "regular", iconRight: React.createElement(Button.Icon, { color: iconColor, ml: "auto", name: "falAngleDown" }), isFullWidth: true, px: 1, ref: ref, text: React.createElement(Button.Text, { color: textColor }, text), userSelect: "text", ...styles.button, ...readOnlyProps, ...isInvalidProps, ...rest }));
|
|
35
|
+
return (React.createElement(PopoverTrigger, { as: LineButton, bg: "white", className: cs('vui-selectButton', className), colorScheme: "prussian", disabled: disabled, focusRing: 2, fontWeight: "regular", iconRight: React.createElement(Button.Icon, { color: iconColor, ml: "auto", name: "falAngleDown" }), isFullWidth: true, px: 1, ref: ref, text: React.createElement(Button.Text, { color: textColor, ...ellipsisOverflow }, text), userSelect: "text", ...styles.button, ...readOnlyProps, ...isInvalidProps, ...rest }));
|
|
36
36
|
});
|
|
37
37
|
export default SelectButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectOption.d.ts","sourceRoot":"","sources":["../../../src/select/selectOption.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"selectOption.d.ts","sourceRoot":"","sources":["../../../src/select/selectOption.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,YAAY,yDA+CvB,CAAA;AAEF,eAAe,YAAY,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { Checkbox } from '../checkbox';
|
|
|
3
3
|
import { useStyleConfig, vui } from '../core';
|
|
4
4
|
import { List, ListItem } from '../list';
|
|
5
5
|
import { usePopoverContext } from '../popover';
|
|
6
|
-
import { cs, useCallbackRef } from '../utils';
|
|
6
|
+
import { cs, ellipsisOverflow, useCallbackRef } from '../utils';
|
|
7
7
|
import { useSelectContext } from './context';
|
|
8
8
|
/**
|
|
9
9
|
* Displays a select option as a list item. By default, closes popover when option is selected.
|
|
@@ -11,7 +11,7 @@ import { useSelectContext } from './context';
|
|
|
11
11
|
* 'onChange' is triggered with a modified click event, which adds 'value' and 'name' properties.
|
|
12
12
|
*/
|
|
13
13
|
export const SelectOption = vui((props, ref) => {
|
|
14
|
-
const { children, className, disabled, onClick: onClickProp, value: valueProp, ...rest } = props;
|
|
14
|
+
const { children, className, disabled, title, onClick: onClickProp, value: valueProp, ...rest } = props;
|
|
15
15
|
const { instance } = usePopoverContext() ?? {};
|
|
16
16
|
const { isMultiple, name, onChange, value } = useSelectContext() ?? {};
|
|
17
17
|
const styles = useStyleConfig('Select', useSelectContext());
|
|
@@ -29,7 +29,7 @@ export const SelectOption = vui((props, ref) => {
|
|
|
29
29
|
onChange?.(clonedEvent);
|
|
30
30
|
!isMultiple && instance?.hide();
|
|
31
31
|
});
|
|
32
|
-
return (React.createElement(ListItem, { className: cs('vui-selectOption', className), disabled: disabled, isInteractive: true, isSelected: isSelected, onClick: onClick, ref: ref, value: valueProp, ...styles.item, ...rest }, children ??
|
|
32
|
+
return (React.createElement(ListItem, { className: cs('vui-selectOption', className), disabled: disabled, isInteractive: true, isSelected: isSelected, onClick: onClick, ref: ref, title: title, value: valueProp, ...styles.item, ...rest, ...ellipsisOverflow }, children ??
|
|
33
33
|
(isMultiple && (React.createElement(React.Fragment, null,
|
|
34
34
|
React.createElement(Checkbox, { checked: isSelected, disabled: disabled, mr: 1 }),
|
|
35
35
|
React.createElement(List.Text, null, props.text))))));
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
Accordion: {
|
|
3
3
|
baseStyle: {};
|
|
4
|
-
defaultProps: {
|
|
5
|
-
|
|
4
|
+
defaultProps: {
|
|
5
|
+
size: string;
|
|
6
|
+
};
|
|
7
|
+
sizes: {
|
|
8
|
+
sm: {
|
|
9
|
+
item: {
|
|
10
|
+
minH: string;
|
|
11
|
+
pt: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
md: {
|
|
15
|
+
item: {
|
|
16
|
+
minH: string;
|
|
17
|
+
pt: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
lg: {
|
|
21
|
+
item: {
|
|
22
|
+
minH: string;
|
|
23
|
+
pt: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
6
27
|
variants: {};
|
|
7
28
|
};
|
|
8
29
|
Avatar: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/theme/components.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/theme/components.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,wBAqCC"}
|
|
@@ -197,8 +197,29 @@ declare const defaultTheme: {
|
|
|
197
197
|
components: {
|
|
198
198
|
Accordion: {
|
|
199
199
|
baseStyle: {};
|
|
200
|
-
defaultProps: {
|
|
201
|
-
|
|
200
|
+
defaultProps: {
|
|
201
|
+
size: string;
|
|
202
|
+
};
|
|
203
|
+
sizes: {
|
|
204
|
+
sm: {
|
|
205
|
+
item: {
|
|
206
|
+
minH: string;
|
|
207
|
+
pt: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
md: {
|
|
211
|
+
item: {
|
|
212
|
+
minH: string;
|
|
213
|
+
pt: string;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
lg: {
|
|
217
|
+
item: {
|
|
218
|
+
minH: string;
|
|
219
|
+
pt: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
202
223
|
variants: {};
|
|
203
224
|
};
|
|
204
225
|
Avatar: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGjB,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { Property } from 'csstype';
|
|
1
2
|
/** Concatenates individual className arguments and returns a single string. */
|
|
2
3
|
export declare function cs(...classNames: any[]): string;
|
|
3
4
|
/** Converts hex color value to rgb with optional alpha property. */
|
|
4
5
|
export declare function hexToRGBA(hex: string, alpha?: number): string;
|
|
6
|
+
/** Styling to add ellipsis for long texts. */
|
|
7
|
+
export declare const ellipsisOverflow: {
|
|
8
|
+
overflow: string;
|
|
9
|
+
textOverflow: string;
|
|
10
|
+
whiteSpace: Property.WhiteSpace;
|
|
11
|
+
};
|
|
5
12
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAgBpD;AAED,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA"}
|