@omniumretail/component-library 1.1.14 → 1.1.16

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/main.css CHANGED
@@ -1,6 +1,7 @@
1
1
  .lCPh1mJwiXUUOgmbv_mk{padding:12px 24px;border-radius:4px;min-width:170px;display:inline-flex;align-items:center;justify-content:center;align-self:flex-start;text-decoration:none;border:none;font-size:14px;line-height:16.8px;font-weight:700;font-family:"Silka",sans-serif;background-color:var(--button-default-background);color:var(--button-default-text-color)}@media(max-width: 767px){.lCPh1mJwiXUUOgmbv_mk{min-width:0px}}.lCPh1mJwiXUUOgmbv_mk:hover{background-color:var(--button-default-background-hover-color);color:var(--button-default-text-hover-color) !important}.lCPh1mJwiXUUOgmbv_mk:focus,.lCPh1mJwiXUUOgmbv_mk:active,.lCPh1mJwiXUUOgmbv_mk:focus:active{background-color:var(--button-default-background-focus-color);color:var(--button-default-text-focus-color)}.lCPh1mJwiXUUOgmbv_mk:disabled,.lCPh1mJwiXUUOgmbv_mk.vwrGv_jOJcIvImjzKZNv{background-color:var(--button-disabled-background-color);color:var(--button-disabled-default-text-color);pointer-events:none}.PYUelyvKNnKRxaBMgCyk{flex-direction:row-reverse;gap:5px}.edzSVcT9ajLWxd6QfVI1{background-color:var(--button-style-1-background);color:var(--button-style-1-text-color)}.edzSVcT9ajLWxd6QfVI1:hover{background-color:var(--button-style-1-background-hover-color);color:var(--button-style-1-text-hover-color) !important}.edzSVcT9ajLWxd6QfVI1:focus,.edzSVcT9ajLWxd6QfVI1:active,.edzSVcT9ajLWxd6QfVI1:focus:active{background-color:var(--button-style-1-background-focus-color);color:var(--button-style-1-text-focus-color)}.edzSVcT9ajLWxd6QfVI1:disabled,.edzSVcT9ajLWxd6QfVI1.vwrGv_jOJcIvImjzKZNv{background-color:var(--button-disabled-background-color);color:var(--button-disabled-default-text-color);pointer-events:none}
2
2
  .UxfXOleP69PjM5rFOMTD{display:grid !important;grid-template-columns:repeat(3, 1fr) !important;justify-items:center !important;align-items:center !important;height:75px !important;gap:0 24px !important;position:relative !important;padding:0px !important}@media(max-width: 767px){.UxfXOleP69PjM5rFOMTD .UxfXOleP69PjM5rFOMTD{grid-template-columns:1fr}.UxfXOleP69PjM5rFOMTD .UK3esJZjnri5Jb9Jxcca,.UxfXOleP69PjM5rFOMTD .U5tZ7kRlrIHUKsuduD1S{justify-self:center}.UxfXOleP69PjM5rFOMTD .LzcTbjk0fp70tXlKd3eS{text-align:center}.UxfXOleP69PjM5rFOMTD .DhO9jcXNunsWq22jXuJJ{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}.UxfXOleP69PjM5rFOMTD .LzcTbjk0fp70tXlKd3eS{font-size:var(--font-size-body-3);font-weight:var(--font-weight-semibold);text-transform:uppercase}@media(min-width: 768px){.UxfXOleP69PjM5rFOMTD .LzcTbjk0fp70tXlKd3eS{font-size:var(--font-size-body-4)}}.UxfXOleP69PjM5rFOMTD .gn06XRZhFG00HaVjAqNc{align-self:center}@media(max-width: 768px){.UxfXOleP69PjM5rFOMTD .gn06XRZhFG00HaVjAqNc{position:unset !important;top:unset !important;margin:unset !important;left:unset !important;right:unset !important;text-align:unset !important}}.UxfXOleP69PjM5rFOMTD .UK3esJZjnri5Jb9Jxcca{justify-self:start}.UxfXOleP69PjM5rFOMTD .SP4eLTEZBzKjo_LdsNw2{justify-self:end}@media(max-width: 460px){.UxfXOleP69PjM5rFOMTD .SP4eLTEZBzKjo_LdsNw2{width:80px}}@media(max-width: 460px){.UxfXOleP69PjM5rFOMTD .SP4eLTEZBzKjo_LdsNw2 :where(.css-dev-only-do-not-override-fpg3f5).ant-btn.ant-btn-icon-only{padding-inline-start:40px}}.UxfXOleP69PjM5rFOMTD .nt_yaN_SHYobZ6zexnfY{justify-self:end}@media(max-width: 460px){.UxfXOleP69PjM5rFOMTD .nt_yaN_SHYobZ6zexnfY{width:60px}}@media(max-width: 460px){.UxfXOleP69PjM5rFOMTD .nt_yaN_SHYobZ6zexnfY :where(.css-dev-only-do-not-override-fpg3f5).ant-btn.ant-btn-icon-only{padding-inline-start:22px}}
3
3
  .ii1Ag3GTfp8unGCe48A0{display:inline-flex;text-decoration:none;height:auto;color:var(--color-black);font-size:var(--font-size-body-3);line-height:100%;font-weight:300;font-style:var(--font-style-italic)}.L9ncGwaItcjHJBLuwrKb{color:var(--color-orange);font-style:var(--font-style-normal)}.Yrb4eAglcF7FedoEB9AH span:nth-child(2){margin-inline-end:8px;margin-inline-start:0;order:-1}
4
+ .dr2zFJ8bDffg5CjjPq2c{color:var(--color-black)}
4
5
  .GhX1oPovx60SBqLAcIRO{border-color:rgba(var(--color-black-rgb), 0.5);height:50px;font-size:var(--font-size-body-3);line-height:100%;color:var(--color-black);border-radius:5px}
5
6
  ._ox_QPqUHev1INeaUhs7 .ant-select-selector{border-color:rgba(var(--color-black-rgb), 0.5) !important;height:50px !important;display:flex;align-items:center}._ox_QPqUHev1INeaUhs7 .ant-select-arrow{color:var(--color-black)}
6
7
  .bisuiYUGnAaj47TMXXcY{display:flex !important}
@@ -1,4 +1,5 @@
1
1
  import { Meta, Story } from '@storybook/react';
2
+ import { DropdownButtonProps } from '.';
2
3
  declare const _default: Meta<import("@storybook/react").Args>;
3
4
  export default _default;
4
- export declare const BasicDropdown: Story<any>;
5
+ export declare const BasicDropdown: Story<DropdownButtonProps>;
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  import { DropdownProps } from 'antd';
3
- interface DropdownButtonProps extends DropdownProps {
4
- options: string[];
3
+ export interface DropdownButtonProps extends DropdownProps {
4
+ options?: {
5
+ label: string;
6
+ action: () => void;
7
+ }[];
5
8
  buttonText: string;
6
9
  buttonClass?: string;
7
10
  customButton?: React.ReactNode;
8
11
  }
9
12
  export declare const DropdownButton: ({ options, buttonText, buttonClass, customButton, ...props }: DropdownButtonProps) => import("react/jsx-runtime").JSX.Element;
10
- export {};
@@ -7,6 +7,9 @@ export interface NavigationProps {
7
7
  loginOnClickFunction?: () => void;
8
8
  backLinkOnClickFunction?: () => void;
9
9
  homeOnClickFunction?: () => void;
10
- options?: string[];
10
+ options?: {
11
+ label: string;
12
+ action: () => void;
13
+ }[];
11
14
  }
12
15
  export declare const Navigation: (props: NavigationProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -1,15 +1,24 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
- import { DropdownButton } from './index';
3
+ import { DropdownButton, DropdownButtonProps } from '.';
4
4
 
5
5
  export default {
6
6
  title: 'DropdownButton',
7
7
  component: DropdownButton,
8
8
  } as Meta;
9
9
 
10
- const Template: Story<any> = (args) => <DropdownButton {...args} />;
10
+ const onLeft = () => {
11
+ console.log(9);
12
+ };
13
+
14
+ const Template: Story<DropdownButtonProps> = (args) => <DropdownButton {...args} />;
11
15
 
12
16
  export const BasicDropdown = Template.bind({});
13
17
  BasicDropdown.args = {
14
- options: ['Option 1', 'Option 2', 'Option 3'],
18
+ buttonText: 'Dropdown',
19
+ options: [
20
+ { label: 'Option 1', action: () => onLeft() },
21
+ { label: 'Option 2', action: () => alert('Option 2 clicked') },
22
+ { label: 'Option 3', action: () => alert('Option 3 clicked') },
23
+ ],
15
24
  };
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  import { Menu, Dropdown, DropdownProps } from 'antd';
3
3
  import classNames from 'classnames';
4
4
  import { Button } from '../Button';
5
+ import styles from './styles.module.scss';
5
6
 
6
- interface DropdownButtonProps extends DropdownProps {
7
- options: string[];
7
+ export interface DropdownButtonProps extends DropdownProps {
8
+ options?: { label: string, action: () => void }[];
8
9
  buttonText: string;
9
10
  buttonClass?: string;
10
11
  customButton?: React.ReactNode;
@@ -14,14 +15,14 @@ export const DropdownButton = ({ options, buttonText, buttonClass, customButton,
14
15
  const menu = (
15
16
  <Menu>
16
17
  {options && options.map((option, index) => (
17
- <Menu.Item key={index}>{option}</Menu.Item>
18
+ <Menu.Item key={index} onClick={option.action}>{option.label}</Menu.Item>
18
19
  ))}
19
20
  </Menu>
20
21
  );
21
22
 
22
23
  const linkClasses = classNames({
23
24
  [`${buttonClass}`]: buttonClass,
24
- }, []);
25
+ }, [styles.dropdown]);
25
26
 
26
27
  return (
27
28
  <Dropdown overlay={menu} trigger={['click']}>
@@ -0,0 +1,3 @@
1
+ .dropdown {
2
+ color: var(--color-black);
3
+ }
@@ -15,5 +15,8 @@ Primary.args = {
15
15
  title: 'Gestão de Aplicações',
16
16
  loginLink: true,
17
17
  userName: "Diogo Silva Coutinho",
18
- options: ['Option 1', 'Option 2', 'Option 3'],
19
- };
18
+ options: [
19
+ { label: 'Option 1', action: () => alert('Option 1 clicked') },
20
+ { label: 'Option 2', action: () => alert('Option 2 clicked') },
21
+ { label: 'Option 3', action: () => alert('Option 3 clicked') },
22
+ ],};
@@ -14,34 +14,34 @@ export interface NavigationProps {
14
14
  loginOnClickFunction?: () => void;
15
15
  backLinkOnClickFunction?: () => void;
16
16
  homeOnClickFunction?: () => void;
17
- options?: string[];
17
+ options?: { label: string, action: () => void }[];
18
18
  }
19
19
 
20
- const TABLET_MAX_WIDTH = 1000;
20
+ const PHONE_MAX_WIDTH = 768;
21
21
 
22
22
  export const Navigation = (props: NavigationProps) => {
23
23
  const { userName, backLink, title, homeLink, loginOnClickFunction, loginLink, backLinkOnClickFunction, homeOnClickFunction } = props;
24
24
  const { t } = useTranslation();
25
25
 
26
- const [isTablet, setIsTablet] = useState(false);
26
+ const [isPhone, setIsPhone] = useState(false);
27
27
  const [showDropdown, setShowDropdown] = useState(false);
28
28
 
29
29
  const checkMediaQuery = () => {
30
- const isPhoneWidth = window.innerWidth < TABLET_MAX_WIDTH;
31
- setIsTablet(isPhoneWidth);
30
+ const isPhoneWidth = window.innerWidth < PHONE_MAX_WIDTH;
31
+ setIsPhone(isPhoneWidth);
32
32
  }
33
33
 
34
34
  useEffect(() => {
35
35
  checkMediaQuery();
36
36
  window.addEventListener('resize', checkMediaQuery);
37
37
  return () => window.removeEventListener('resize', checkMediaQuery);
38
- }, [isTablet]);
38
+ }, [isPhone]);
39
39
 
40
40
  const getInitials = (name: string) => {
41
41
  const words = name.split(' ');
42
42
  let initials = '';
43
43
 
44
- if (isTablet) {
44
+ if (isPhone) {
45
45
  if (words.length === 1) {
46
46
  initials = words[0].charAt(0);
47
47
  } else if (words.length > 1) {
@@ -55,13 +55,13 @@ export const Navigation = (props: NavigationProps) => {
55
55
  }
56
56
  }
57
57
 
58
- return isTablet ? initials.toUpperCase() : initials;
58
+ return isPhone ? initials.toUpperCase() : initials;
59
59
  };
60
60
 
61
61
  return (
62
62
  <div className={styles.navigation}>
63
63
  <div className={styles.columnLeft}>
64
- {backLink && <Link href="#" icon={<ArrowLeftOutlined />} linkSecondary onClick={backLinkOnClickFunction}> {!isTablet && t('navigation.back')} </Link>}
64
+ {backLink && <Link href="#" icon={<ArrowLeftOutlined />} linkSecondary onClick={backLinkOnClickFunction}> {!isPhone && t('navigation.back')} </Link>}
65
65
  </div>
66
66
  <div className={styles.columnCenter}>
67
67
  <h1 className={`${styles.title} ${styles.titleMobile}`}>{title}</h1>
@@ -83,8 +83,8 @@ export const Navigation = (props: NavigationProps) => {
83
83
  )}
84
84
  />
85
85
  )}
86
- {homeLink && <Link icon={<HomeOutlined />} linkSecondary iconAlignRight onClick={homeOnClickFunction}> {!isTablet && t('navigation.home')} </Link>}
87
- {loginLink && <Link href="#" onClick={loginOnClickFunction} icon={<LogoutOutlined />} linkSecondary iconAlignRight>{!isTablet && t('navigation.logout')}</Link>}
86
+ {homeLink && <Link icon={<HomeOutlined />} linkSecondary iconAlignRight onClick={homeOnClickFunction}> {!isPhone && t('navigation.home')} </Link>}
87
+ {loginLink && <Link href="#" onClick={loginOnClickFunction} icon={<LogoutOutlined />} linkSecondary iconAlignRight>{!isPhone && t('navigation.logout')}</Link>}
88
88
  </div>
89
89
  </div>
90
90
  )