@loja-integrada/admin-components 0.10.0 → 0.12.2
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/Components/Button/Button.d.ts +1 -1
- package/dist/Icons/icons-path/ExclamationCircle.d.ts +2 -0
- package/dist/Icons/icons-path/index.d.ts +1 -0
- package/dist/Indicators/Tooltip/Tooltip.d.ts +5 -1
- package/dist/admin-components.cjs.development.js +72 -12
- package/dist/admin-components.cjs.development.js.map +1 -1
- package/dist/admin-components.cjs.production.min.js +1 -1
- package/dist/admin-components.cjs.production.min.js.map +1 -1
- package/dist/admin-components.esm.js +72 -12
- package/dist/admin-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/Components/Button/Button.spec.tsx +3 -0
- package/src/Components/Button/Button.tsx +10 -0
- package/src/Forms/Dropdown/Dropdown.tsx +1 -1
- package/src/Forms/InputMask/utils.ts +2 -2
- package/src/Forms/Toggle/Toggle.tsx +30 -9
- package/src/Icons/icons-path/ExclamationCircle.tsx +9 -0
- package/src/Icons/icons-path/index.ts +2 -0
- package/src/Indicators/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/Indicators/Tooltip/Tooltip.tsx +23 -5
- package/src/Layout/ActionBar/ActionBar.tsx +1 -0
|
@@ -15,7 +15,7 @@ export interface ButtonProps extends ButtonAnchorProps {
|
|
|
15
15
|
/** Button variant
|
|
16
16
|
* @default primary
|
|
17
17
|
* */
|
|
18
|
-
variant?: 'primary' | 'secondary' | 'tertiary' | 'info' | 'warning' | 'danger' | 'outline' | 'onlyText';
|
|
18
|
+
variant?: 'primary' | 'secondary' | 'outlineSecondary' | 'tertiary' | 'info' | 'warning' | 'danger' | 'outline' | 'onlyText';
|
|
19
19
|
/**
|
|
20
20
|
* Button is loading
|
|
21
21
|
* */
|
|
@@ -26,6 +26,7 @@ export declare const icons: {
|
|
|
26
26
|
edit: () => JSX.Element;
|
|
27
27
|
exchange: () => JSX.Element;
|
|
28
28
|
eye: () => JSX.Element;
|
|
29
|
+
exclamationCircle: () => JSX.Element;
|
|
29
30
|
exclamationTriangle: () => JSX.Element;
|
|
30
31
|
externalLink: () => JSX.Element;
|
|
31
32
|
home: () => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TippyProps } from '@tippyjs/react';
|
|
3
|
-
export declare const Tooltip: React.MemoExoticComponent<
|
|
3
|
+
export declare const Tooltip: React.MemoExoticComponent<(props: TooltipProps) => JSX.Element>;
|
|
4
4
|
export interface TooltipProps extends TippyProps {
|
|
5
5
|
/** Tooltip append
|
|
6
6
|
* @default 'parent'
|
|
@@ -30,4 +30,8 @@ export interface TooltipProps extends TippyProps {
|
|
|
30
30
|
* @default false
|
|
31
31
|
* */
|
|
32
32
|
interactive?: TippyProps['interactive'];
|
|
33
|
+
/** Tooltip theme
|
|
34
|
+
* @default dark
|
|
35
|
+
* */
|
|
36
|
+
theme?: 'light' | 'dark';
|
|
33
37
|
}
|
|
@@ -258,6 +258,14 @@ var Eye = function Eye() {
|
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
+
var ExclamationCircle = function ExclamationCircle() {
|
|
262
|
+
return React__default.createElement("path", {
|
|
263
|
+
fillRule: "evenodd",
|
|
264
|
+
d: "M9 10.5A1.25 1.25 0 1 0 9 13a1.25 1.25 0 0 0 0-2.5Zm-.303-1h.605a.5.5 0 0 0 .497-.445l.328-2.945A1 1 0 0 0 9.132 5h-.266a1 1 0 0 0-.993 1.11L8.2 9.055a.5.5 0 0 0 .497.445Zm.303 7c-4.136 0-7.5-3.364-7.5-7.5S4.864 1.5 9 1.5s7.5 3.364 7.5 7.5-3.364 7.5-7.5 7.5ZM9 0a9 9 0 0 0-9 9 9 9 0 0 0 9 9 9 9 0 0 0 9-9 9 9 0 0 0-9-9Z",
|
|
265
|
+
clipRule: "evenodd"
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
|
|
261
269
|
var ExclamationTriangle = function ExclamationTriangle() {
|
|
262
270
|
return React__default.createElement("path", {
|
|
263
271
|
fillRule: "evenodd",
|
|
@@ -532,6 +540,7 @@ var icons = {
|
|
|
532
540
|
edit: Edit,
|
|
533
541
|
exchange: Exchange,
|
|
534
542
|
eye: Eye,
|
|
543
|
+
exclamationCircle: ExclamationCircle,
|
|
535
544
|
exclamationTriangle: ExclamationTriangle,
|
|
536
545
|
externalLink: ExternalLink,
|
|
537
546
|
home: Home,
|
|
@@ -595,6 +604,7 @@ var Icon = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
595
604
|
var listOfStylesHover = {
|
|
596
605
|
primary: "hover:bg-primary-dark",
|
|
597
606
|
secondary: "hover:bg-secondary-dark",
|
|
607
|
+
outlineSecondary: "hover:bg-primary-light",
|
|
598
608
|
tertiary: "hover:bg-tertiary-dark",
|
|
599
609
|
info: "hover:bg-secondary-bold",
|
|
600
610
|
warning: "hover:bg-warning-dark",
|
|
@@ -605,6 +615,7 @@ var listOfStylesHover = {
|
|
|
605
615
|
var listOfStylesActive = {
|
|
606
616
|
primary: "active:bg-primary-bold",
|
|
607
617
|
secondary: "active:shadow-inner",
|
|
618
|
+
outlineSecondary: "active:shadow-inner active:bg-base-1",
|
|
608
619
|
tertiary: "active:bg-tertiary-bold",
|
|
609
620
|
warning: "active:bg-warning-bold",
|
|
610
621
|
danger: "hover:bg-danger-bold",
|
|
@@ -614,6 +625,7 @@ var listOfStylesActive = {
|
|
|
614
625
|
var listOfStylesFocus = {
|
|
615
626
|
primary: "focus:ring-1 focus:ring-primary-dark focus:ring-opacity-50",
|
|
616
627
|
secondary: "focus:ring focus:ring-focus",
|
|
628
|
+
outlineSecondary: "focus:ring-2 focus:ring-focus focus:ring-offset-1",
|
|
617
629
|
danger: "focus:ring-1 focus:ring-danger-dark",
|
|
618
630
|
outline: "focus:ring-2 focus:ring-focus focus:ring-offset-1",
|
|
619
631
|
onlyText: "focus:bg-base-1"
|
|
@@ -621,6 +633,7 @@ var listOfStylesFocus = {
|
|
|
621
633
|
var listOfStyles = {
|
|
622
634
|
primary: "bg-primary text-base-1 " + listOfStylesHover['primary'] + " " + listOfStylesActive['primary'] + " " + listOfStylesFocus['primary'],
|
|
623
635
|
secondary: "bg-secondary text-primary " + listOfStylesHover['secondary'] + " " + listOfStylesActive['secondary'],
|
|
636
|
+
outlineSecondary: "bg-transparent text-primary border border-primary " + listOfStylesHover['outlineSecondary'] + " " + listOfStylesActive['outlineSecondary'] + " " + listOfStylesFocus['outlineSecondary'],
|
|
624
637
|
tertiary: "bg-inverted-2 text-on-primary " + listOfStylesHover['tertiary'] + " " + listOfStylesActive['tertiary'],
|
|
625
638
|
info: "bg-secondary-dark text-base-1 " + listOfStylesHover['info'],
|
|
626
639
|
warning: "bg-warning text-on-base " + listOfStylesHover['warning'] + " " + listOfStylesActive['warning'],
|
|
@@ -632,6 +645,7 @@ var defaultDisabledStyle = "bg-base-3 cursor-default text-on-base-2 shadow-none
|
|
|
632
645
|
var listOfStylesDisabled = {
|
|
633
646
|
primary: defaultDisabledStyle,
|
|
634
647
|
secondary: "bg-base-2 cursor-default text-card-stroke shadow-none ring-0 border-0 ",
|
|
648
|
+
outlineSecondary: "bg-base-2 cursor-default text-card-stroke shadow-none ring-0 border-0 ",
|
|
635
649
|
tertiary: defaultDisabledStyle,
|
|
636
650
|
info: defaultDisabledStyle,
|
|
637
651
|
warning: defaultDisabledStyle,
|
|
@@ -652,6 +666,12 @@ var ButtonType = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
652
666
|
if (as === 'a' || props.href) return React__default.createElement("a", Object.assign({}, props, {
|
|
653
667
|
ref: ref
|
|
654
668
|
}), children);
|
|
669
|
+
|
|
670
|
+
if (!props.type) {
|
|
671
|
+
// Default to button when missing type
|
|
672
|
+
props.type = 'button';
|
|
673
|
+
}
|
|
674
|
+
|
|
655
675
|
return React__default.createElement("button", Object.assign({}, props, {
|
|
656
676
|
ref: ref
|
|
657
677
|
}), children);
|
|
@@ -982,9 +1002,9 @@ var formatValuePatterns = {
|
|
|
982
1002
|
},
|
|
983
1003
|
onlyText: {
|
|
984
1004
|
mask: function mask(rawValue) {
|
|
985
|
-
var onlyText = rawValue.replace(/[^a-zA-ZÀ-ú'
|
|
1005
|
+
var onlyText = rawValue.replace(/[^a-zA-ZÀ-ú'˜0-9\sü]/g, '').split('');
|
|
986
1006
|
return onlyText.map(function () {
|
|
987
|
-
return /[a-zA-ZÀ-ú'
|
|
1007
|
+
return /[a-zA-ZÀ-ú'˜`´^0-9\sü]/g;
|
|
988
1008
|
});
|
|
989
1009
|
}
|
|
990
1010
|
},
|
|
@@ -1340,6 +1360,8 @@ var ToggleComponent = function ToggleComponent(_ref, ref) {
|
|
|
1340
1360
|
isChecked = _React$useState[0],
|
|
1341
1361
|
setIsChecked = _React$useState[1];
|
|
1342
1362
|
|
|
1363
|
+
var toggleStatusText = disabled ? 'disabled' : 'enabled';
|
|
1364
|
+
var toggleCheckText = isChecked ? 'checked' : 'unchecked';
|
|
1343
1365
|
React__default.useEffect(function () {
|
|
1344
1366
|
setIsChecked(!!checked);
|
|
1345
1367
|
}, [checked]);
|
|
@@ -1350,9 +1372,31 @@ var ToggleComponent = function ToggleComponent(_ref, ref) {
|
|
|
1350
1372
|
onChange && onChange(event);
|
|
1351
1373
|
};
|
|
1352
1374
|
|
|
1375
|
+
var toggleClasses = {
|
|
1376
|
+
background: {
|
|
1377
|
+
checked: {
|
|
1378
|
+
enabled: 'bg-primary border-primary',
|
|
1379
|
+
disabled: 'bg-base-3 border-card-stroke'
|
|
1380
|
+
},
|
|
1381
|
+
unchecked: {
|
|
1382
|
+
enabled: 'bg-base-1 border-card-stroke',
|
|
1383
|
+
disabled: 'bg-base-3 border-card-stroke'
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
circle: {
|
|
1387
|
+
checked: {
|
|
1388
|
+
enabled: 'translate-x-full ml-px bg-base-1',
|
|
1389
|
+
disabled: 'translate-x-full ml-px bg-base-1'
|
|
1390
|
+
},
|
|
1391
|
+
unchecked: {
|
|
1392
|
+
enabled: 'translate-x-0 bg-inverted-2',
|
|
1393
|
+
disabled: 'translate-x-0 bg-base-1'
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1353
1397
|
var toggleContainerDisabledClasses = (disabled ? 'pointer-events-none' : '') + " relative";
|
|
1354
|
-
var toggleBackgroundClasses = "block border
|
|
1355
|
-
var toggleCircleClasses = "transform " +
|
|
1398
|
+
var toggleBackgroundClasses = "block border w-[53px] h-8 rounded-full " + toggleClasses.background[toggleCheckText][toggleStatusText] + " transition";
|
|
1399
|
+
var toggleCircleClasses = "transform " + toggleClasses.circle[toggleCheckText][toggleStatusText] + " absolute left-[6px] top-[6px] w-5 h-5 rounded-full transition";
|
|
1356
1400
|
var toggleLabelClasses = "ml-2 text-inverted-1 text-f6 tracking-4 label";
|
|
1357
1401
|
return React__default.createElement("label", {
|
|
1358
1402
|
htmlFor: inputId,
|
|
@@ -1375,8 +1419,8 @@ var ToggleComponent = function ToggleComponent(_ref, ref) {
|
|
|
1375
1419
|
}, label));
|
|
1376
1420
|
};
|
|
1377
1421
|
|
|
1378
|
-
var
|
|
1379
|
-
var Toggle = /*#__PURE__*/React__default.memo(
|
|
1422
|
+
var ToggleWithForwardRef = /*#__PURE__*/React__default.forwardRef(ToggleComponent);
|
|
1423
|
+
var Toggle = /*#__PURE__*/React__default.memo(ToggleWithForwardRef);
|
|
1380
1424
|
|
|
1381
1425
|
var sizeClasses = {
|
|
1382
1426
|
"default": 'h-12',
|
|
@@ -1465,7 +1509,7 @@ var CustomPlaceholder = function CustomPlaceholder(props) {
|
|
|
1465
1509
|
|
|
1466
1510
|
var CustomSingleValue = function CustomSingleValue(props, variant) {
|
|
1467
1511
|
return React__default.createElement(SingleValue, Object.assign({}, props, {
|
|
1468
|
-
className: "text-f6 tracking-4 text-
|
|
1512
|
+
className: "text-f6 tracking-4 text-on-base text-sm truncate " + variantValueClasses[variant]
|
|
1469
1513
|
}));
|
|
1470
1514
|
};
|
|
1471
1515
|
|
|
@@ -2436,19 +2480,34 @@ var TooltipComponent = function TooltipComponent(props) {
|
|
|
2436
2480
|
computedProps.content = mounted ? props.content : '';
|
|
2437
2481
|
}
|
|
2438
2482
|
|
|
2439
|
-
return React__default.createElement(
|
|
2483
|
+
return React__default.createElement(StyledTooltipComponent, Object.assign({}, computedProps, {
|
|
2440
2484
|
appendTo: (props == null ? void 0 : props.appendTo) || 'parent',
|
|
2441
2485
|
hideOnClick: (props == null ? void 0 : props.hideOnClick) || false,
|
|
2442
2486
|
trigger: (props == null ? void 0 : props.trigger) || 'mouseenter',
|
|
2443
2487
|
touch: (props == null ? void 0 : props.touch) || ['hold', 400],
|
|
2444
2488
|
duration: (props == null ? void 0 : props.duration) || 150,
|
|
2445
2489
|
placement: ((_window = window) == null ? void 0 : _window.innerWidth) < 1024 ? 'top' : (props == null ? void 0 : props.placement) || 'top',
|
|
2446
|
-
interactive: (props == null ? void 0 : props.interactive) || false
|
|
2490
|
+
interactive: (props == null ? void 0 : props.interactive) || false,
|
|
2491
|
+
theme: (props == null ? void 0 : props.theme) || 'dark'
|
|
2447
2492
|
}));
|
|
2448
2493
|
};
|
|
2449
2494
|
|
|
2450
|
-
var
|
|
2451
|
-
|
|
2495
|
+
var theme = {
|
|
2496
|
+
light: {
|
|
2497
|
+
background: '#fff',
|
|
2498
|
+
color: '#371E56'
|
|
2499
|
+
},
|
|
2500
|
+
dark: {
|
|
2501
|
+
background: '#371E56',
|
|
2502
|
+
color: '#fff'
|
|
2503
|
+
}
|
|
2504
|
+
};
|
|
2505
|
+
var StyledTooltipComponent = /*#__PURE__*/styled(Tippy)(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n --bg-color: ", ";\n position: relative;\n background-color: var(--bg-color);\n color: ", ";\n border-radius: 3px;\n font-size: 12px;\n letter-spacing: -0.4px;\n line-height: 1.4;\n outline: 0;\n transition-property: transform, visibility, opacity;\n\n &[data-animation='fade'][data-state='hidden'] {\n opacity: 0;\n }\n\n [data-tippy-root] {\n max-width: calc(100vw - 10px);\n }\n\n &[data-placement^='top'] > .tippy-arrow {\n bottom: 0;\n }\n\n &[data-placement^='top'] > .tippy-arrow:before {\n bottom: -7px;\n left: 0;\n border-width: 8px 8px 0;\n border-top-color: initial;\n transform-origin: center top;\n }\n\n &[data-placement^='bottom'] > .tippy-arrow {\n top: 0;\n }\n\n &[data-placement^='bottom'] > .tippy-arrow:before {\n top: -7px;\n left: 0;\n border-width: 0 8px 8px;\n border-bottom-color: initial;\n transform-origin: center bottom;\n }\n\n &[data-placement^='left'] > .tippy-arrow {\n right: 0;\n }\n\n &[data-placement^='left'] > .tippy-arrow:before {\n border-width: 8px 0 8px 8px;\n border-left-color: initial;\n right: -7px;\n transform-origin: center left;\n }\n\n &[data-placement^='right'] > .tippy-arrow {\n left: 0;\n }\n\n &[data-placement^='right'] > .tippy-arrow:before {\n left: -7px;\n border-width: 8px 8px 8px 0;\n border-right-color: initial;\n transform-origin: center right;\n }\n\n &[data-inertia][data-state='visible'] {\n transition-timing-function: cubic-bezier(0.54, 1.5, 0.38, 1.11);\n }\n\n .tippy-arrow {\n width: 15px;\n height: 15px;\n color: var(--bg-color);\n }\n\n .tippy-arrow:before {\n content: '';\n position: absolute;\n border-color: transparent;\n border-style: solid;\n }\n\n .tippy-content {\n position: relative;\n padding: 12px 8px;\n z-index: 1;\n }\n"])), function (props) {
|
|
2506
|
+
return theme[props.theme].background;
|
|
2507
|
+
}, function (props) {
|
|
2508
|
+
return theme[props.theme].color;
|
|
2509
|
+
});
|
|
2510
|
+
var Tooltip = /*#__PURE__*/React__default.memo(TooltipComponent);
|
|
2452
2511
|
|
|
2453
2512
|
var SharedContext = /*#__PURE__*/React__default.createContext({
|
|
2454
2513
|
variant: 'default',
|
|
@@ -2770,7 +2829,8 @@ var ActionBarComponent = function ActionBarComponent(_ref) {
|
|
|
2770
2829
|
if (!props.children) return;
|
|
2771
2830
|
return React__default.createElement("button", {
|
|
2772
2831
|
className: 'px-4 py-1 text-base-1' + (props != null && props.loading ? ' pointer-events-none' : ''),
|
|
2773
|
-
onClick: props == null ? void 0 : props.onClick
|
|
2832
|
+
onClick: props == null ? void 0 : props.onClick,
|
|
2833
|
+
type: (props == null ? void 0 : props.type) || 'button'
|
|
2774
2834
|
}, props != null && props.loading ? React__default.createElement(Icon, {
|
|
2775
2835
|
icon: "loading",
|
|
2776
2836
|
className: "p-px"
|