@integrigo/integrigo-ui 1.6.15-b → 1.6.16-a

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.
@@ -5,11 +5,13 @@ export interface DropdwonStaticProps {
5
5
  Option: typeof Option;
6
6
  }
7
7
  export interface DropdownProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
8
- validationType: ValidationType;
8
+ validationType?: ValidationType;
9
9
  label?: string;
10
- size: 'xl' | 'l' | 'm' | 's';
10
+ size?: 'xl' | 'l' | 'm' | 's';
11
11
  }
12
- declare const DropdownWithStatic: React.ForwardRefExoticComponent<DropdownProps & React.RefAttributes<HTMLSelectElement>> & {
13
- Option: React.FC<{}>;
12
+ declare const DropdownWithStatic: React.ForwardRefExoticComponent<DropdownProps & {
13
+ children?: React.ReactNode;
14
+ } & React.RefAttributes<HTMLSelectElement>> & {
15
+ Option: React.FC<React.PropsWithChildren<import("./Option").OptionProps>>;
14
16
  };
15
17
  export { DropdownWithStatic as Dropdown };
@@ -1,12 +1,18 @@
1
1
  import React from 'react';
2
2
  import { ComponentStory, ComponentMeta } from '@storybook/react';
3
- declare const _default: ComponentMeta<React.ForwardRefExoticComponent<import("./Dropdown").DropdownProps & React.RefAttributes<HTMLSelectElement>> & {
4
- Option: React.FC<{}>;
3
+ declare const _default: ComponentMeta<React.ForwardRefExoticComponent<import("./Dropdown").DropdownProps & {
4
+ children?: React.ReactNode;
5
+ } & React.RefAttributes<HTMLSelectElement>> & {
6
+ Option: React.FC<React.PropsWithChildren<import("./Option").OptionProps>>;
5
7
  }>;
6
8
  export default _default;
7
- export declare const Basic: ComponentStory<React.ForwardRefExoticComponent<import("./Dropdown").DropdownProps & React.RefAttributes<HTMLSelectElement>> & {
8
- Option: React.FC<{}>;
9
+ export declare const Basic: ComponentStory<React.ForwardRefExoticComponent<import("./Dropdown").DropdownProps & {
10
+ children?: React.ReactNode;
11
+ } & React.RefAttributes<HTMLSelectElement>> & {
12
+ Option: React.FC<React.PropsWithChildren<import("./Option").OptionProps>>;
9
13
  }>;
10
- export declare const WithLabel: ComponentStory<React.ForwardRefExoticComponent<import("./Dropdown").DropdownProps & React.RefAttributes<HTMLSelectElement>> & {
11
- Option: React.FC<{}>;
14
+ export declare const WithLabel: ComponentStory<React.ForwardRefExoticComponent<import("./Dropdown").DropdownProps & {
15
+ children?: React.ReactNode;
16
+ } & React.RefAttributes<HTMLSelectElement>> & {
17
+ Option: React.FC<React.PropsWithChildren<import("./Option").OptionProps>>;
12
18
  }>;
@@ -1,2 +1,5 @@
1
- import React from 'react';
2
- export declare const Option: React.FC;
1
+ import React, { PropsWithChildren } from "react";
2
+ export interface OptionProps {
3
+ value?: string | number;
4
+ }
5
+ export declare const Option: React.FC<PropsWithChildren<OptionProps>>;
@@ -0,0 +1,6 @@
1
+ import React, { PropsWithChildren } from "react";
2
+ export interface ModalProps {
3
+ show: boolean;
4
+ onClose: () => void;
5
+ }
6
+ export declare const Modal: React.FCS<PropsWithChildren<ModalProps>>;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
3
+ declare const _default: ComponentMeta<import("react").FCS<import("react").PropsWithChildren<import("./Modal").ModalProps>>>;
4
+ export default _default;
5
+ export declare const Basic: ComponentStory<import("react").FCS<import("react").PropsWithChildren<import("./Modal").ModalProps>>>;
@@ -0,0 +1 @@
1
+ export { Modal } from './Modal';
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { Dropdown } from "../../molecules";
3
+ interface SelectProps extends React.ComponentProps<typeof Dropdown> {
4
+ options: {
5
+ value: string | number;
6
+ label: React.ReactNode;
7
+ }[];
8
+ }
9
+ export declare const Select: React.FC<SelectProps>;
10
+ export {};
@@ -0,0 +1 @@
1
+ export { Select } from './Select';
@@ -1,2 +1,4 @@
1
1
  export { Menu } from './Menu';
2
2
  export { Setting } from './Setting';
3
+ export { Modal } from './Modal';
4
+ export { Select } from './Select';
@@ -1,4 +1,4 @@
1
1
  export { Alert, Avatar, Card, Divider, Icon, Nav, Pill, Typography, Spinner, Chip, Dot, Gradient, } from "./components/atoms";
2
2
  export { InfoCard, Input, TextArea, Button, Checkbox, Dropdown, Profile, Radio, Tile, } from "./components/molecules";
3
- export { Menu, Setting } from "./components/organisms";
3
+ export { Menu, Setting, Modal, Select } from "./components/organisms";
4
4
  export { GlobalStyles as IntegrigoUI, Color } from "./styles";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://npm.pkg.github.com/integrigo"
5
5
  },
6
- "version": "1.6.15b",
6
+ "version": "1.6.16a",
7
7
  "main": "lib/index.js",
8
8
  "module": "lib/index.esm.js",
9
9
  "types": "lib/index.d.ts",
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { getValidationTypeProps } from '../../../helpers/validation';
4
4
  import { ValidationType } from '../../../types/validation';
@@ -13,12 +13,12 @@ export interface DropdwonStaticProps {
13
13
 
14
14
  export interface DropdownProps
15
15
  extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
16
- validationType: ValidationType;
16
+ validationType?: ValidationType;
17
17
  label?: string;
18
- size: 'xl' | 'l' | 'm' | 's';
18
+ size?: 'xl' | 'l' | 'm' | 's';
19
19
  }
20
20
 
21
- const Dropdown = React.forwardRef<HTMLSelectElement, DropdownProps>(
21
+ const Dropdown = React.forwardRef<HTMLSelectElement, PropsWithChildren<DropdownProps>>(
22
22
  ({ children, label, size = 'm', ...props }, ref) => {
23
23
  return (
24
24
  <FieldWrapper withLabel={Boolean(label)} sizeVariant={size}>
@@ -1,5 +1,12 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from "react";
2
2
 
3
- export const Option: React.FC = ({ children }) => {
4
- return <option>{children}</option>;
3
+ export interface OptionProps {
4
+ value?: string | number;
5
+ }
6
+
7
+ export const Option: React.FC<PropsWithChildren<OptionProps>> = ({
8
+ value,
9
+ children,
10
+ }) => {
11
+ return <option value={value}>{children}</option>;
5
12
  };
@@ -0,0 +1,26 @@
1
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
2
+
3
+ import { Modal } from "./Modal";
4
+
5
+ export default {
6
+ title: "Organisms/Modal",
7
+ component: Modal,
8
+ argTypes: {
9
+ show: {
10
+ control: "boolean",
11
+ defaultValue: true,
12
+ },
13
+ },
14
+ } as ComponentMeta<typeof Modal>;
15
+
16
+ const Template: ComponentStory<typeof Modal> = (args) => (
17
+ <>
18
+ Some other content
19
+ <Modal show={args.show} onClose={() => null}>
20
+ hey
21
+ </Modal>
22
+ </>
23
+ );
24
+
25
+ export const Basic = Template.bind({});
26
+ Basic.args = {};
@@ -0,0 +1,84 @@
1
+ import React, { PropsWithChildren } from "react";
2
+ import styled from "styled-components";
3
+ import { Card, Icon } from "../../atoms";
4
+
5
+ export interface ModalProps {
6
+ show: boolean;
7
+ onClose: () => void;
8
+ }
9
+
10
+ export const Modal: React.FCS<PropsWithChildren<ModalProps>> = ({
11
+ className,
12
+ children,
13
+ show,
14
+ onClose,
15
+ }) => {
16
+ if (!show) {
17
+ return null;
18
+ }
19
+
20
+ return (
21
+ <Root>
22
+ <ModalCard size="s" flat className={className}>
23
+ <CloseModal>
24
+ <CloseIcon onClick={onClose}>
25
+ <Icon type="close" />
26
+ </CloseIcon>
27
+ </CloseModal>
28
+ {children}
29
+ </ModalCard>
30
+ </Root>
31
+ );
32
+ };
33
+
34
+ const Root = styled.div`
35
+ position: fixed;
36
+ left: 0;
37
+ top: 0;
38
+ width: 100%;
39
+ height: 100%;
40
+ z-index: 100;
41
+
42
+ &::after {
43
+ content: "";
44
+ position: absolute;
45
+ left: 0;
46
+ top: 0;
47
+ height: 100%;
48
+ width: 100%;
49
+ backdrop-filter: blur(8px);
50
+ background-color: var(--color-shadow);
51
+ }
52
+ `;
53
+
54
+ const ModalCard = styled(Card)`
55
+ padding: var(--padding-s);
56
+ position: fixed;
57
+ left: 50%;
58
+ top: 50%;
59
+ max-width: 320px;
60
+ width: calc(100vw - 2 * var(--padding-m));
61
+ transform: translate(-50%, -50%);
62
+ z-index: 101;
63
+ `;
64
+
65
+ const CloseModal = styled.div`
66
+ display: flex;
67
+ justify-content: flex-end;
68
+ `;
69
+
70
+ const CloseIcon = styled.button`
71
+ border: none;
72
+ background: transparent;
73
+ padding: 0;
74
+ cursor: pointer;
75
+
76
+ & > svg {
77
+ fill: var(--shades-of-grey-60);
78
+ transition: fill var(--transition-speed);
79
+
80
+ &:hover {
81
+ fill: var(--shades-of-grey-100);
82
+ }
83
+ }
84
+ `;
@@ -0,0 +1 @@
1
+ export { Modal } from './Modal'
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import { Dropdown } from "../../molecules";
3
+
4
+ interface SelectProps extends React.ComponentProps<typeof Dropdown> {
5
+ options: { value: string | number; label: React.ReactNode }[];
6
+ }
7
+
8
+ export const Select: React.FC<SelectProps> = ({ options, ...props }) => (
9
+ <Dropdown {...props}>
10
+ {options.map((option) => (
11
+ <Dropdown.Option key={option.value} value={option.value}>
12
+ {option.label}
13
+ </Dropdown.Option>
14
+ ))}
15
+ </Dropdown>
16
+ );
@@ -0,0 +1 @@
1
+ export { Select } from './Select'
@@ -1,2 +1,4 @@
1
1
  export { Menu } from './Menu';
2
- export { Setting } from './Setting';
2
+ export { Setting } from './Setting';
3
+ export { Modal } from './Modal'
4
+ export { Select } from './Select'
package/src/index.ts CHANGED
@@ -25,6 +25,6 @@ export {
25
25
  Tile,
26
26
  } from "./components/molecules";
27
27
 
28
- export { Menu, Setting } from "./components/organisms";
28
+ export { Menu, Setting, Modal, Select } from "./components/organisms";
29
29
 
30
30
  export { GlobalStyles as IntegrigoUI, Color } from "./styles";
@@ -29,6 +29,7 @@ export const GlobalStyles = createGlobalStyle`
29
29
 
30
30
  --color-orange-80: ${Color.Orange}80;
31
31
  --color-orange-65: ${Color.Orange}65;
32
+ --color-shadow: ${Color.Grey100}10;
32
33
 
33
34
  --gradient-natural-orange: linear-gradient(333.61deg, #E09A33 13.3%, #FFB241 90.98%);
34
35
  --gradient-orange-red: radial-gradient(106.28% 106.28% at 76.05% 89.07%, #E09A33 0%, #CF544B 100%);