@fvc/drawer 1.0.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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { ChildWrapperProps } from './Drawer.types';
3
+ export declare function ChildWrapper({ children, testId, testIdPostfix, }: ChildWrapperProps): React.JSX.Element;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { DrawerProps } from './Drawer.types';
3
+ export declare const prefixCls = "fvc-drawer";
4
+ export declare const Drawer: {
5
+ ({ children, placement, width, height, maskClosable, mask, push, testId, ...props }: DrawerProps): React.JSX.Element;
6
+ Header: {
7
+ (props: import("./Drawer.types").ChildWrapperProps): React.JSX.Element;
8
+ displayName: import("./Drawer.types").ChildTypes;
9
+ };
10
+ Footer: {
11
+ (props: import("./Drawer.types").ChildWrapperProps): React.JSX.Element;
12
+ displayName: import("./Drawer.types").ChildTypes;
13
+ };
14
+ Content: {
15
+ (props: import("./Drawer.types").ChildWrapperProps): React.JSX.Element;
16
+ displayName: import("./Drawer.types").ChildTypes;
17
+ };
18
+ };
@@ -0,0 +1,8 @@
1
+ import { type DrawerProps as DefaultDrawerProps } from 'antd';
2
+ export type DrawerProps = DefaultDrawerProps & {
3
+ testId?: string;
4
+ };
5
+ export type ChildWrapperProps = Pick<DrawerProps, 'testId' | 'style' | 'children'> & {
6
+ testIdPostfix?: string;
7
+ };
8
+ export type ChildTypes = 'Header' | 'Footer' | 'Content';
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { ChildTypes, ChildWrapperProps } from '../Drawer.types';
3
+ export declare const createChildWrapper: (type: ChildTypes) => {
4
+ (props: ChildWrapperProps): React.JSX.Element;
5
+ displayName: ChildTypes;
6
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { ChildTypes, ChildWrapperProps } from '../Drawer.types';
3
+ export declare const getChildByType: (children: React.ReactNode, type: ChildTypes) => React.ReactElement<ChildWrapperProps>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare const isComponentWithDisplayName: (child: React.ReactNode) => child is React.ReactElement & {
3
+ type: {
4
+ displayName?: string;
5
+ };
6
+ };
@@ -0,0 +1 @@
1
+ export { Drawer } from './Drawer';
@@ -0,0 +1,6 @@
1
+ import e from"react";import{Drawer as r}from"antd";var t=function(){return t=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},t.apply(this,arguments)};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var o,a={exports:{}};
2
+ /*!
3
+ Copyright (c) 2018 Jed Watson.
4
+ Licensed under the MIT License (MIT), see
5
+ http://jedwatson.github.io/classnames
6
+ */var d,c=(o||(o=1,d=a,function(){var e={}.hasOwnProperty;function r(){for(var e="",r=0;r<arguments.length;r++){var o=arguments[r];o&&(e=n(e,t(o)))}return e}function t(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return r.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var o="";for(var a in t)e.call(t,a)&&t[a]&&(o=n(o,a));return o}function n(e,r){return r?e?e+" "+r:e+r:e}d.exports?(r.default=r,d.exports=r):window.classNames=r}()),a.exports),l=n(c);var i={"fvc-drawer-content-wrapper":"Drawer-module_fvc-drawer-content-wrapper__hXqAs","fvc-drawer-content":"Drawer-module_fvc-drawer-content__9uV4d","fvc-drawer-footer":"Drawer-module_fvc-drawer-footer__1gUL4","fvc-drawer-body":"Drawer-module_fvc-drawer-body__yznCc","fvc-drawer-placement-right":"Drawer-module_fvc-drawer-placement-right__VcuTD","fvc-drawer-close":"Drawer-module_fvc-drawer-close__8DHCC","fvc-drawer-placement-left":"Drawer-module_fvc-drawer-placement-left__GPn3P","fvc-drawer":"Drawer-module_fvc-drawer__gxdSz","fvc-drawer-header":"Drawer-module_fvc-drawer-header__v--eo","fvc-drawer-header-title":"Drawer-module_fvc-drawer-header-title__Opu3B","fvc-drawer-header-no-title":"Drawer-module_fvc-drawer-header-no-title__-A04s"};function f(r){var t=r.children,n=r.testId,o=r.testIdPostfix;return e.createElement("div",{"data-testid":n?"".concat(n,"-").concat(o):void 0},t)}!function(e,r){void 0===r&&(r={});var t=r.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".Drawer-module_fvc-drawer-content-wrapper__hXqAs > .Drawer-module_fvc-drawer-content__9uV4d {\n z-index: 1;\n overflow: auto;\n background-clip: padding-box;\n background: var(--card-bg-color-20);\n border: 0;\n}\n.Drawer-module_fvc-drawer-content__9uV4d > .Drawer-module_fvc-drawer-footer__1gUL4 {\n border-top: none;\n}\n.Drawer-module_fvc-drawer-content__9uV4d > .Drawer-module_fvc-drawer-body__yznCc {\n word-wrap: break-word;\n flex-grow: 1;\n padding: 0 16px;\n font-size: 14px;\n line-height: 1.5715;\n overflow: auto;\n}\n.Drawer-module_fvc-drawer-placement-right__VcuTD .Drawer-module_fvc-drawer-close__8DHCC {\n left: -50px;\n}\n.Drawer-module_fvc-drawer-placement-left__GPn3P .Drawer-module_fvc-drawer-close__8DHCC {\n right: -40px;\n}\n.Drawer-module_fvc-drawer__gxdSz .Drawer-module_fvc-drawer-header__v--eo {\n padding: 16px 32px;\n border-bottom: none;\n}\n.Drawer-module_fvc-drawer__gxdSz .Drawer-module_fvc-drawer-header-title__Opu3B {\n margin: 0;\n font-size: 16px;\n font-weight: 500;\n line-height: 22px;\n}\n.Drawer-module_fvc-drawer__gxdSz .Drawer-module_fvc-drawer-close__8DHCC {\n position: absolute;\n display: block;\n top: 0;\n padding: 20px;\n font-weight: 700;\n color: var(--white-icon-color-0);\n background: transparent;\n border: 0;\n outline: 0;\n cursor: pointer;\n}\n.Drawer-module_fvc-drawer__gxdSz .Drawer-module_fvc-drawer-close__8DHCC svg {\n width: 20px;\n height: 20px;\n}\n.Drawer-module_fvc-drawer__gxdSz .Drawer-module_fvc-drawer-close__8DHCC:focus, .Drawer-module_fvc-drawer__gxdSz .Drawer-module_fvc-drawer-close__8DHCC:hover {\n color: var(--white-icon-color-0);\n background: transparent;\n}\n.Drawer-module_fvc-drawer-header-no-title__-A04s .Drawer-module_fvc-drawer__gxdSz .Drawer-module_fvc-drawer-close__8DHCC {\n margin-right: 5px;\n padding-right: 22px;\n}");var u=function(r){var n=function(n){return e.createElement(f,t({},n,{testIdPostfix:null==r?void 0:r.toLowerCase()}))};return n.displayName=r,n},w=function(r,t){return e.Children.toArray(r).find((function(r){return!!function(r){return e.isValidElement(r)&&"function"==typeof r.type&&"displayName"in r.type}(r)&&r.type.displayName===t}))},_="fvc-drawer",p=function(n){var o,a=n.children,d=n.placement,c=void 0===d?"right":d,f=n.width,u=void 0===f?256:f,p=n.height,s=void 0===p?256:p,v=n.maskClosable,m=void 0===v||v,h=n.mask,g=void 0===h||h,y=n.push,D=void 0===y?{distance:180}:y,x=n.testId,b=void 0===x?"drawer":x,C=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}(n,["children","placement","width","height","maskClosable","mask","push","testId"]),S=w(a,"Footer"),O=w(a,"Header"),z=w(a,"Content"),k=l(i[_],((o={})["".concat(_,"-placement-").concat(c)]=c,o));return e.createElement(r,t({"data-testid":b,prefixCls:_,title:O,footer:S,placement:c,width:u,height:s,maskClosable:m,mask:g,push:D,rootClassName:k,styles:{header:null==O?void 0:O.props.style,footer:null==S?void 0:S.props.style,content:null==z?void 0:z.props.style}},C),z)};p.Header=u("Header"),p.Footer=u("Footer"),p.Content=u("Content");export{p as Drawer};
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@fvc/drawer",
3
+ "version": "1.0.0",
4
+ "main": "./dist/lib/index.js",
5
+ "types": "./dist/lib/drawer/src/index.d.ts",
6
+ "files": [
7
+ "dist/lib/index.js",
8
+ "dist/lib/drawer",
9
+ "package.json"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/lib/index.js",
14
+ "types": "./dist/lib/drawer/src/index.d.ts"
15
+ },
16
+ "./types/*": "./dist/lib/drawer/src/types/*"
17
+ },
18
+ "scripts": {
19
+ "build": "rm -rf dist && eslint --config ../../eslint.config.js . && bunx tsc --noEmit && rollup -c ./rollup.config.mjs"
20
+ },
21
+ "dependencies": {
22
+ "react": "^18.0.0",
23
+ "antd": "^5.0.0"
24
+ }
25
+ }