@ntbjs/react-components 0.0.1-beta.9 → 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.
@@ -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', "0px 1px 6px -3px rgba(0, 0, 0, 0.7)", "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-800')), "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-800'), props.theme.getColor('gray-400'));
25
- }, function (props) {
26
- return props.theme.themeProp('border-right-color', props.theme.getColor('gray-800'), props.theme.getColor('gray-400'));
27
- }, function (props) {
28
- return props.theme.themeProp('border-bottom-color', props.theme.getColor('gray-800'), props.theme.getColor('gray-400'));
29
- }, function (props) {
30
- return props.theme.themeProp('border-left-color', props.theme.getColor('gray-800'), 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 };
@@ -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-01b3e392.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 };