@ntbjs/react-components 0.0.1-beta.8 → 1.0.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/ActionButton-90485300.js +43 -0
- package/AssetGallery-2d26f3cf.js +1401 -0
- package/Button-0d728b52.js +156 -0
- package/Checkbox-50f1f3c7.js +136 -0
- package/Popover-d3e2f6c0.js +97 -0
- package/README.md +1 -2
- package/Radio-0b46b2a8.js +83 -0
- package/Switch-aa384260.js +104 -0
- package/TextArea-52cf4c0a.js +173 -0
- package/TextInput-a7c32f5f.js +250 -0
- package/Tooltip-f95a39f4.js +57 -0
- package/data/Popover/index.js +13 -5
- package/data/index.js +17 -6
- package/{defaultTheme-f1063879.js → defaultTheme-870f7df1.js} +15 -3
- package/icons/audio.svg +3 -0
- package/icons/check.svg +3 -0
- package/icons/headset.svg +1 -0
- package/icons/library-add.svg +3 -0
- package/icons/search.svg +3 -0
- package/inputs/ActionButton/index.js +10 -4
- package/inputs/Button/index.js +10 -0
- package/inputs/Checkbox/index.js +12 -0
- package/inputs/Radio/index.js +12 -0
- package/inputs/Switch/index.js +12 -0
- package/inputs/TextArea/index.js +12 -0
- package/inputs/TextInput/index.js +12 -0
- package/inputs/index.js +27 -4
- package/package.json +13 -8
- package/ssr/index.js +14 -0
- package/widgets/AssetGallery/index.js +25 -10
- package/widgets/index.js +27 -10
- package/ActionButton-dfa33fb3.js +0 -36
- package/AssetGallery-493397de.js +0 -970
- package/Popover-ca8883c5.js +0 -80
- package/Tooltip-be5c2611.js +0 -49
package/Popover-ca8883c5.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { s as styleInject, a as applyDefaultTheme, _ as _taggedTemplateLiteral, b as _objectWithoutProperties, c as _extends, P as PropTypes } from './defaultTheme-f1063879.js';
|
|
2
|
-
import React__default, { useMemo } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import TippyTooltip from '@tippyjs/react';
|
|
5
|
-
|
|
6
|
-
var css_248z$1 = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}";
|
|
7
|
-
styleInject(css_248z$1);
|
|
8
|
-
|
|
9
|
-
var css_248z = ".tippy-box[data-animation=shift-away-subtle][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=top]{transform:translateY(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=bottom]{transform:translateY(-5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=left]{transform:translateX(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=right]{transform:translateX(-5px)}";
|
|
10
|
-
styleInject(css_248z);
|
|
11
|
-
|
|
12
|
-
var _templateObject;
|
|
13
|
-
var Popover$1 = styled(TippyTooltip).attrs(applyDefaultTheme)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-family: ", ";\n font-size: 1rem;\n font-weight: 400;\n color: inherit;\n border-radius: 0;\n ", "\n ", "\n line-height: inherit;\n ", "\n\n .tippy-content {\n padding: 0;\n }\n\n .tippy-arrow {\n ", "\n }\n\n && > .tippy-arrow::before {\n position: absolute;\n border-color: transparent;\n border-style: solid;\n }\n\n & > .tippy-arrow::after {\n content: '';\n position: absolute;\n border-color: transparent;\n border-style: solid;\n }\n\n &[data-placement^='top'] {\n & > .tippy-arrow:before {\n bottom: -16px;\n left: -5px;\n border-width: 15px 13px 0;\n ", "\n }\n\n & > .tippy-arrow:after {\n bottom: -15px;\n left: -5px;\n border-width: 15px 13px 0;\n border-top-color: initial;\n transform-origin: center top;\n }\n }\n\n &[data-placement^='right'] {\n & > .tippy-arrow:before {\n bottom: -5px;\n left: -16px;\n border-width: 13px 15px 13px 0;\n ", "\n }\n\n & > .tippy-arrow:after {\n bottom: -5px;\n left: -15px;\n border-width: 13px 15px 13px 0;\n border-right-color: initial;\n transform-origin: center top;\n }\n }\n\n &[data-placement^='bottom'] {\n & > .tippy-arrow:before {\n top: -16px;\n left: -5px;\n border-width: 0 13px 15px 13px;\n ", "\n }\n\n & > .tippy-arrow:after {\n top: -15px;\n left: -5px;\n border-width: 0 13px 15px 13px;\n border-bottom-color: initial;\n transform-origin: center top;\n }\n }\n\n &[data-placement^='left'] {\n & > .tippy-arrow::before {\n bottom: -5px;\n right: -16px;\n border-width: 13px 0 13px 15px;\n ", "\n }\n\n & > .tippy-arrow::after {\n bottom: -5px;\n right: -15px;\n border-width: 13px 0 13px 15px;\n border-left-color: initial;\n transform-origin: center top;\n }\n }\n"])), function (props) {
|
|
14
|
-
return props.theme.primaryFontFamily;
|
|
15
|
-
}, function (props) {
|
|
16
|
-
return props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('white'));
|
|
17
|
-
}, function (props) {
|
|
18
|
-
return props.theme.themeProp('box-shadow', 'none', "0 3px 6px ".concat(props.theme.getColor('gray-300')));
|
|
19
|
-
}, function (props) {
|
|
20
|
-
return props.theme.themeProp('border', "1px solid ".concat(props.theme.getColor('gray-600')), "1px solid ".concat(props.theme.getColor('gray-300')));
|
|
21
|
-
}, function (props) {
|
|
22
|
-
return props.theme.themeProp('color', props.theme.getColor('gray-700'), props.theme.getColor('white'));
|
|
23
|
-
}, function (props) {
|
|
24
|
-
return props.theme.themeProp('border-top-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'));
|
|
25
|
-
}, function (props) {
|
|
26
|
-
return props.theme.themeProp('border-right-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'));
|
|
27
|
-
}, function (props) {
|
|
28
|
-
return props.theme.themeProp('border-bottom-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'));
|
|
29
|
-
}, function (props) {
|
|
30
|
-
return props.theme.themeProp('border-left-color', props.theme.getColor('gray-500'), props.theme.getColor('gray-400'));
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var Popover = React__default.forwardRef(function Popover(_ref, ref) {
|
|
34
|
-
var content = _ref.content,
|
|
35
|
-
interactive = _ref.interactive,
|
|
36
|
-
placement = _ref.placement,
|
|
37
|
-
duration = _ref.duration,
|
|
38
|
-
trigger = _ref.trigger,
|
|
39
|
-
offset = _ref.offset,
|
|
40
|
-
arrow = _ref.arrow,
|
|
41
|
-
children = _ref.children,
|
|
42
|
-
props = _objectWithoutProperties(_ref, ["content", "interactive", "placement", "duration", "trigger", "offset", "arrow", "children"]);
|
|
43
|
-
|
|
44
|
-
var errorOffset = useMemo(function () {
|
|
45
|
-
return arrow ? 15 : 0;
|
|
46
|
-
}, [arrow]);
|
|
47
|
-
return React__default.createElement(Popover$1, _extends({
|
|
48
|
-
ref: ref,
|
|
49
|
-
content: content,
|
|
50
|
-
interactive: interactive,
|
|
51
|
-
placement: placement,
|
|
52
|
-
duration: duration,
|
|
53
|
-
animation: 'shift-away-subtle',
|
|
54
|
-
trigger: trigger,
|
|
55
|
-
offset: [offset[0], offset[1] + errorOffset],
|
|
56
|
-
arrow: arrow
|
|
57
|
-
}, props), children);
|
|
58
|
-
});
|
|
59
|
-
Popover.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
60
|
-
content: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
|
61
|
-
interactive: PropTypes.bool,
|
|
62
|
-
placement: PropTypes.oneOf(['top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'auto', 'auto-start', 'auto-end']),
|
|
63
|
-
duration: PropTypes.number,
|
|
64
|
-
trigger: PropTypes.string,
|
|
65
|
-
offset: PropTypes.arrayOf(PropTypes.number),
|
|
66
|
-
arrow: PropTypes.bool,
|
|
67
|
-
children: PropTypes.node.isRequired
|
|
68
|
-
} : {};
|
|
69
|
-
Popover.defaultProps = {
|
|
70
|
-
content: 'Tooltip',
|
|
71
|
-
interactive: true,
|
|
72
|
-
placement: 'bottom-end',
|
|
73
|
-
duration: 350,
|
|
74
|
-
offset: [0, 8],
|
|
75
|
-
maxWidth: 'none',
|
|
76
|
-
trigger: 'click focus',
|
|
77
|
-
arrow: true
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export { Popover as P };
|
package/Tooltip-be5c2611.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { a as applyDefaultTheme, _ as _taggedTemplateLiteral, b as _objectWithoutProperties, c as _extends, P as PropTypes } from './defaultTheme-f1063879.js';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import TippyTooltip from '@tippyjs/react';
|
|
5
|
-
import './Popover-ca8883c5.js';
|
|
6
|
-
|
|
7
|
-
var _templateObject;
|
|
8
|
-
var Tooltip$1 = styled(TippyTooltip).attrs(applyDefaultTheme)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-family: ", ";\n font-size: 1rem;\n font-weight: 400;\n background: ", ";\n border-radius: 3px;\n\n .tippy-content {\n padding: 9px 12px;\n }\n\n .tippy-arrow {\n color: ", ";\n }\n\n a {\n color: inherit;\n }\n"])), function (props) {
|
|
9
|
-
return props.theme.primaryFontFamily;
|
|
10
|
-
}, function (props) {
|
|
11
|
-
return props.theme.getColor('gray-700');
|
|
12
|
-
}, function (props) {
|
|
13
|
-
return props.theme.getColor('gray-700');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
var Tooltip = React__default.forwardRef(function Tooltip(_ref, ref) {
|
|
17
|
-
var content = _ref.content,
|
|
18
|
-
interactive = _ref.interactive,
|
|
19
|
-
placement = _ref.placement,
|
|
20
|
-
duration = _ref.duration,
|
|
21
|
-
children = _ref.children,
|
|
22
|
-
props = _objectWithoutProperties(_ref, ["content", "interactive", "placement", "duration", "children"]);
|
|
23
|
-
|
|
24
|
-
return React__default.createElement(Tooltip$1, _extends({
|
|
25
|
-
ref: ref,
|
|
26
|
-
content: content,
|
|
27
|
-
interactive: interactive,
|
|
28
|
-
placement: placement,
|
|
29
|
-
duration: duration,
|
|
30
|
-
animation: 'shift-away-subtle'
|
|
31
|
-
}, props), children);
|
|
32
|
-
});
|
|
33
|
-
Tooltip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
34
|
-
content: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
|
35
|
-
interactive: PropTypes.bool,
|
|
36
|
-
placement: PropTypes.oneOf(['top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'auto', 'auto-start', 'auto-end']),
|
|
37
|
-
duration: PropTypes.number,
|
|
38
|
-
trigger: PropTypes.string,
|
|
39
|
-
children: PropTypes.node.isRequired
|
|
40
|
-
} : {};
|
|
41
|
-
Tooltip.defaultProps = {
|
|
42
|
-
content: 'Tooltip',
|
|
43
|
-
interactive: false,
|
|
44
|
-
placement: 'top',
|
|
45
|
-
duration: 350,
|
|
46
|
-
trigger: 'mouseenter focus'
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export { Tooltip as T };
|