@loja-integrada/admin-components 0.15.5 → 0.16.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.
Files changed (32) hide show
  1. package/dist/Components/SidebarFixed/SidebarFixed.d.ts +26 -0
  2. package/dist/Components/SidebarFixed/SidebarFixed.spec.d.ts +1 -0
  3. package/dist/Components/SidebarFixed/SidebarFixed.stories.d.ts +4 -0
  4. package/dist/Components/SidebarFixed/index.d.ts +1 -0
  5. package/dist/Components/index.d.ts +1 -0
  6. package/dist/Icons/icons-path/Adjust.d.ts +2 -0
  7. package/dist/Icons/icons-path/index.d.ts +1 -0
  8. package/dist/Indicators/Tag/Tag.d.ts +32 -0
  9. package/dist/Indicators/Tag/Tag.spec.d.ts +1 -0
  10. package/dist/Indicators/Tag/Tag.stories.d.ts +5 -0
  11. package/dist/Indicators/Tag/index.d.ts +1 -0
  12. package/dist/Indicators/index.d.ts +1 -0
  13. package/dist/admin-components.cjs.development.js +101 -1
  14. package/dist/admin-components.cjs.development.js.map +1 -1
  15. package/dist/admin-components.cjs.production.min.js +1 -1
  16. package/dist/admin-components.cjs.production.min.js.map +1 -1
  17. package/dist/admin-components.esm.js +99 -2
  18. package/dist/admin-components.esm.js.map +1 -1
  19. package/package.json +14 -12
  20. package/src/Components/SidebarFixed/SidebarFixed.spec.tsx +35 -0
  21. package/src/Components/SidebarFixed/SidebarFixed.stories.tsx +39 -0
  22. package/src/Components/SidebarFixed/SidebarFixed.tsx +107 -0
  23. package/src/Components/SidebarFixed/index.tsx +1 -0
  24. package/src/Components/index.ts +1 -0
  25. package/src/Forms/Checkbox/Checkbox.tsx +2 -1
  26. package/src/Icons/icons-path/Adjust.tsx +16 -0
  27. package/src/Icons/icons-path/index.ts +2 -0
  28. package/src/Indicators/Tag/Tag.spec.tsx +38 -0
  29. package/src/Indicators/Tag/Tag.stories.tsx +33 -0
  30. package/src/Indicators/Tag/Tag.tsx +55 -0
  31. package/src/Indicators/Tag/index.tsx +1 -0
  32. package/src/Indicators/index.ts +1 -0
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ export declare const SidebarFixedComponent: React.FC<SidebarFixedProps>;
3
+ export declare const SidebarFixed: React.NamedExoticComponent<SidebarFixedProps>;
4
+ export interface SidebarFixedProps {
5
+ /**
6
+ * React children
7
+ * Also support render prop
8
+ */
9
+ children?: React.ReactNode | ((props: SidebarFixedProps) => React.ReactNode);
10
+ /**
11
+ * Bottom actions
12
+ */
13
+ footerActions?: React.ReactNode;
14
+ /** Sidebar is open
15
+ * @default false
16
+ */
17
+ isOpen?: boolean;
18
+ /**
19
+ * Call when sidebar is closed
20
+ * */
21
+ onClose?: Function;
22
+ /**
23
+ * Help external link
24
+ */
25
+ helpLink?: string;
26
+ }
@@ -0,0 +1,4 @@
1
+ import { SidebarFixedProps } from '.';
2
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/types-6-0").ReactFramework, import("@storybook/react/types-6-0").Args>;
3
+ export default _default;
4
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react/types-6-0").ReactFramework, SidebarFixedProps>;
@@ -0,0 +1 @@
1
+ export * from './SidebarFixed';
@@ -5,3 +5,4 @@ export * from './TableList';
5
5
  export * from './Tabs';
6
6
  export * from './Timeline';
7
7
  export * from './Modal';
8
+ export * from './SidebarFixed';
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const Adjust: () => JSX.Element;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare const icons: {
3
+ adjust: () => JSX.Element;
3
4
  angleLeft: () => JSX.Element;
4
5
  angleRight: () => JSX.Element;
5
6
  angleDiagonal: () => JSX.Element;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ declare const TagTypes: {
3
+ neutral: string;
4
+ primary: string;
5
+ danger: string;
6
+ success: string;
7
+ warning: string;
8
+ };
9
+ export declare const Tag: React.MemoExoticComponent<({ type, content, fullWidth, className, action, }: TagProps) => JSX.Element>;
10
+ export interface TagProps {
11
+ /** Tag color
12
+ * @default neutral
13
+ * */
14
+ type?: keyof typeof TagTypes;
15
+ /**
16
+ * Tag content
17
+ * */
18
+ content: string | React.ReactNode;
19
+ /**
20
+ * Enlarge width of the Tag
21
+ * */
22
+ fullWidth?: boolean;
23
+ /** Adittional classes for Tag
24
+ * @default ''
25
+ * */
26
+ className?: string;
27
+ /**
28
+ * Action for the tag, like an button or icon
29
+ * */
30
+ action: React.ReactNode;
31
+ }
32
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { TagProps } from './Tag';
2
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react").ReactFramework, import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, TagProps>;
5
+ export declare const WithAction: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, TagProps>;
@@ -0,0 +1 @@
1
+ export * from './Tag';
@@ -1,5 +1,6 @@
1
1
  export * from './Alert';
2
2
  export * from './Status';
3
+ export * from './Tag';
3
4
  export * from './Toast';
4
5
  export * from './Badge';
5
6
  export * from './Tooltip';
@@ -74,6 +74,18 @@ function _taggedTemplateLiteralLoose(strings, raw) {
74
74
  return strings;
75
75
  }
76
76
 
77
+ var Adjust = function Adjust() {
78
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement("path", {
79
+ fillRule: "evenodd",
80
+ clipRule: "evenodd",
81
+ d: "M2.25 5c0-.9665.7835-1.75 1.75-1.75h2c.9665 0 1.75.7835 1.75 1.75v2c0 .9665-.7835 1.75-1.75 1.75H4c-.9665 0-1.75-.7835-1.75-1.75V5ZM4 4.75c-.13807 0-.25.11193-.25.25v2c0 .13807.11193.25.25.25h2c.13807 0 .25-.11193.25-.25V5c0-.13807-.11193-.25-.25-.25H4ZM10.25 11c0-.9665.7835-1.75 1.75-1.75h2c.9665 0 1.75.7835 1.75 1.75v2c0 .9665-.7835 1.75-1.75 1.75h-2c-.9665 0-1.75-.7835-1.75-1.75v-2Zm1.75-.25c-.1381 0-.25.1119-.25.25v2c0 .1381.1119.25.25.25h2c.1381 0 .25-.1119.25-.25v-2c0-.1381-.1119-.25-.25-.25h-2Z"
82
+ }), React__default.createElement("path", {
83
+ fillRule: "evenodd",
84
+ clipRule: "evenodd",
85
+ d: "M5.74951 4V.5h-1.5V4h1.5Zm0 4h-1.5v9.5h1.5V8ZM13.7495 10V.5h-1.5V10h1.5Zm0 4h-1.5v3.5h1.5V14Z"
86
+ }));
87
+ };
88
+
77
89
  var AngleLeft = function AngleLeft() {
78
90
  return React__default.createElement("path", {
79
91
  fillRule: "evenodd",
@@ -554,6 +566,7 @@ var User = function User() {
554
566
  };
555
567
 
556
568
  var icons = {
569
+ adjust: Adjust,
557
570
  angleLeft: AngleLeft,
558
571
  angleRight: AngleRight,
559
572
  angleDiagonal: AngleDiagonal,
@@ -1776,11 +1789,12 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1776
1789
  htmlFor: inputId,
1777
1790
  className: "inline-flex " + alignOptions[boxAlign] + " cursor-pointer"
1778
1791
  }, React__default.createElement("span", {
1779
- className: "rounded z-50 flex items-center justify-center focus-within:ring-2 ring-focus"
1792
+ className: "relative rounded z-50 flex items-center justify-center focus-within:ring-2 ring-focus"
1780
1793
  }, React__default.createElement("input", Object.assign({
1781
1794
  ref: ref || inputRef,
1782
1795
  type: "checkbox",
1783
1796
  id: inputId,
1797
+ name: name,
1784
1798
  className: "opacity-0 absolute h-4 w-4 z-50 cursor-pointer",
1785
1799
  checked: isChecked,
1786
1800
  onChange: handleChange,
@@ -2477,6 +2491,61 @@ var ModalComponent = function ModalComponent(_ref) {
2477
2491
 
2478
2492
  var Modal = /*#__PURE__*/React__default.memo(ModalComponent);
2479
2493
 
2494
+ var backgroundShadowEffect = ['[background:linear-gradient(#FFFFFF_33%,rgba(255,255,255,0)),linear-gradient(rgba(255,255,255,0),#FFFFFF_66%)_0_100%,radial-gradient(farthest-side_at_50%_0,rgba(156,156,156,0.5),rgba(0,0,0,0)),radial-gradient(farthest-side_at_50%_100%,_rgba(156,156,156,0.5),rgba(0,0,0,0))_0_100%]', '[background-size:100%_15px,100%_15px,100%_5px,100%_5px]', '[background-attachment:local,local,scroll,scroll]', '[background-repeat:no-repeat]', '[background-color:#FFFFFF]', '[&_.form-group_.bg-base-1]:bg-transparent'];
2495
+ var SidebarFixedComponent = function SidebarFixedComponent(_ref) {
2496
+ var children = _ref.children,
2497
+ footerActions = _ref.footerActions,
2498
+ _ref$isOpen = _ref.isOpen,
2499
+ isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
2500
+ onClose = _ref.onClose,
2501
+ helpLink = _ref.helpLink;
2502
+
2503
+ var _useState = React.useState(false),
2504
+ sidebarIsOpen = _useState[0],
2505
+ setSidebarIsOpen = _useState[1];
2506
+
2507
+ React.useEffect(function () {
2508
+ setSidebarIsOpen(isOpen);
2509
+ }, [isOpen]);
2510
+
2511
+ var handleRequestCloseFunc = function handleRequestCloseFunc() {
2512
+ setSidebarIsOpen(false);
2513
+ onClose == null ? void 0 : onClose();
2514
+ };
2515
+
2516
+ return React__default.createElement("div", {
2517
+ className: "sidebar-fixed fixed z-40 lg:z-20 right-0 bottom-0 w-full h-full transition-all overflow-x-hidden " + (sidebarIsOpen ? 'pointer-events-auto opacity-100' : 'opacity-0 pointer-events-none')
2518
+ }, React__default.createElement("div", {
2519
+ className: "sidebar-fixed-backdrop fixed inset-0 h-full w-full bg-black-alpha -z-1",
2520
+ onClick: handleRequestCloseFunc
2521
+ }), React__default.createElement("div", {
2522
+ className: "sidebar-fixed-inner mt-10 sm:mt-0 top-0 bottom-0 right-0 absolute flex flex-col justify-between bg-base-1 transform transition-transform shadow h-auto w-full sm:max-w-[410px] sm:ml-16 rounded-t-lg sm:rounded-none " + (sidebarIsOpen ? 'translate-x-0' : 'translate-x-10')
2523
+ }, React__default.createElement("div", {
2524
+ className: "sidebar-fixed-header flex justify-between items-center p-3 lg:px-5 text-inverted-2"
2525
+ }, React__default.createElement("button", {
2526
+ className: "sidebar-fixed-close p-2 hover:text-primary transition-colors",
2527
+ onClick: handleRequestCloseFunc
2528
+ }, React__default.createElement(Icon, {
2529
+ icon: "close",
2530
+ block: true,
2531
+ size: 4
2532
+ })), helpLink && React__default.createElement("a", {
2533
+ className: "sidebar-fixed-help p-2 hover:text-primary transition-colors",
2534
+ href: helpLink,
2535
+ target: "_blank",
2536
+ rel: "noreferrer"
2537
+ }, React__default.createElement(Icon, {
2538
+ icon: "questionCircle",
2539
+ block: true,
2540
+ size: 4
2541
+ }))), React__default.createElement("div", {
2542
+ className: "sidebar-fixed-content flex-1 flex-grow w-full overflow-auto overscroll-none px-5 lg:px-7 break-words " + backgroundShadowEffect.join(' ')
2543
+ }, children), footerActions && React__default.createElement("div", {
2544
+ className: "sidebar-fixed-footer flex justify-between items-center p-5 lg:p-7 lg:pt-6"
2545
+ }, footerActions)));
2546
+ };
2547
+ var SidebarFixed = /*#__PURE__*/React__default.memo(SidebarFixedComponent);
2548
+
2480
2549
  var alertTypes = {
2481
2550
  success: {
2482
2551
  "class": 'bg-success-light border-success',
@@ -2606,6 +2675,34 @@ var StatusComponent = function StatusComponent(_ref2) {
2606
2675
 
2607
2676
  var Status = /*#__PURE__*/React__default.memo(StatusComponent);
2608
2677
 
2678
+ var TagTypes = {
2679
+ neutral: 'bg-base-1 border-inverted-2',
2680
+ primary: 'bg-primary-light border-primary',
2681
+ danger: 'bg-danger-light border-danger',
2682
+ success: 'bg-success-light border-success',
2683
+ warning: 'bg-warning-light border-warning'
2684
+ };
2685
+
2686
+ var TagComponent = function TagComponent(_ref) {
2687
+ var _ref$type = _ref.type,
2688
+ type = _ref$type === void 0 ? 'neutral' : _ref$type,
2689
+ content = _ref.content,
2690
+ _ref$fullWidth = _ref.fullWidth,
2691
+ fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
2692
+ _ref$className = _ref.className,
2693
+ className = _ref$className === void 0 ? '' : _ref$className,
2694
+ action = _ref.action;
2695
+ return React__default.createElement("div", {
2696
+ className: "tag " + (fullWidth ? 'flex' : 'inline-flex') + " items-center justify-between border rounded px-4 py-2 tracking-4 leading-6 text-f6 text-primary-bold " + TagTypes[type] + " " + className
2697
+ }, React__default.createElement("div", {
2698
+ className: "min-w-0 break-words -my-px"
2699
+ }, content), action && React__default.createElement("div", {
2700
+ className: "-my-px ml-3"
2701
+ }, action));
2702
+ };
2703
+
2704
+ var Tag = /*#__PURE__*/React__default.memo(TagComponent);
2705
+
2609
2706
  var contextClass = {
2610
2707
  success: 'bg-primary-light border-primary-dark',
2611
2708
  error: 'bg-danger-light border-danger-dark',
@@ -3390,6 +3487,8 @@ exports.Pagination = Pagination;
3390
3487
  exports.Select = Select;
3391
3488
  exports.SelectComponent = SelectComponent;
3392
3489
  exports.Sidebar = Sidebar;
3490
+ exports.SidebarFixed = SidebarFixed;
3491
+ exports.SidebarFixedComponent = SidebarFixedComponent;
3393
3492
  exports.SidebarItem = SidebarItem;
3394
3493
  exports.SidebarSubItem = SidebarSubItem;
3395
3494
  exports.Status = Status;
@@ -3398,6 +3497,7 @@ exports.TableList = TableList;
3398
3497
  exports.TableListItem = TableListItem;
3399
3498
  exports.TableListItemLoading = TableListItemLoading;
3400
3499
  exports.Tabs = Tabs;
3500
+ exports.Tag = Tag;
3401
3501
  exports.Timeline = Timeline;
3402
3502
  exports.Toast = Toast;
3403
3503
  exports.Toggle = Toggle;