@silas-test/ob-molecules-side-panel 0.1.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.
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@silas-test/ob-molecules-side-panel",
3
+ "version": "0.1.0",
4
+ "dependencies": {
5
+ "@silas-test/ui-utils": "0.6.5"
6
+ },
7
+ "main": "./index.cjs.js",
8
+ "type": "commonjs",
9
+ "types": "./index.d.ts"
10
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/side-panel';
@@ -0,0 +1,5 @@
1
+ import './side-panel.css';
2
+ import React from 'react';
3
+ import { ISidePanelProps } from './side-panel.interface';
4
+ export declare const SidePanel: React.ForwardRefExoticComponent<ISidePanelProps & React.RefAttributes<HTMLDivElement>>;
5
+ export default SidePanel;
@@ -0,0 +1,44 @@
1
+ import { DefaultProps } from '@silas-test/ui-utils';
2
+ /**
3
+ * @typedef {SidePanelAlign} - property that defined on what side off the screen the panel will stick to
4
+ */ export type SidePanelAlign = 'left' | 'right';
5
+ /**
6
+ *
7
+ * @property {string | undefined} id - component identification
8
+ * @property {string | undefined} dataTestId - react-testing-library identification
9
+ * @property {HTMLElement | undefined} align - property that defined on what side off the screen the panel will stick to. Can be 'left' or 'right'
10
+ * @property {function | undefined} isOpen - boolean that defines if the SidePanel is open or closed
11
+ * @property {string | undefined} closeOnBackdropClick - boolean that defines if the SidePanel should close when clicking on the backdrop
12
+ * @property {function} onClose - function that runs when closing the SidePanel. If closeOnBackdropBlick is true, it will run when clicking on backdrop too
13
+ * @property {string | React.ReactElement | React.ReactElement[] | undefined} children - children component that will render inside the SidePanel
14
+ */
15
+ export interface ISidePanelProps extends DefaultProps {
16
+ /** Component identification */
17
+ id?: string;
18
+ /** React-testing-library identification */
19
+ dataTestId?: string;
20
+ /** Property that defined on what side off the screen the panel will stick to. Can be 'left' or 'right' */
21
+ align: SidePanelAlign;
22
+ /** Boolean representing if the SidePanel is open or closed */
23
+ isOpen: boolean;
24
+ /** Boolean that defines if the SidePanel should close when clicking on the backdrop.
25
+ *
26
+ * The default value is `true`
27
+ */
28
+ closeOnBackdropClick?: boolean;
29
+ /** Function that runs when closing the SidePanel.
30
+ *
31
+ * NOTE: If closeOnBackdropBlick is true, it will run when clicking on backdrop too
32
+ *
33
+ * @example
34
+ * ```
35
+ * <SidePanel align='left' isOpen={isOpen} onClose={() => setIsOpen(false)}>
36
+ * <p>welcome to side panel</p>
37
+ * </SidePanel>
38
+ * ```
39
+ *
40
+ * */
41
+ onClose: () => void;
42
+ /** Children component that will render inside the SidePanel */
43
+ children?: string | React.ReactElement | React.ReactElement[];
44
+ }
@@ -0,0 +1,6 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import { SidePanel } from './side-panel';
3
+ declare const Story: Meta<typeof SidePanel>;
4
+ export default Story;
5
+ export declare const Left: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./side-panel.interface").ISidePanelProps & import("react").RefAttributes<HTMLDivElement>>;
6
+ export declare const Right: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./side-panel.interface").ISidePanelProps & import("react").RefAttributes<HTMLDivElement>>;