@fvc/drawer 1.0.0 → 1.1.1

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.
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- import { ChildWrapperProps } from './Drawer.types';
2
+ import { ChildWrapperProps } from './types';
3
3
  export declare function ChildWrapper({ children, testId, testIdPostfix, }: ChildWrapperProps): React.JSX.Element;
@@ -1,18 +1,19 @@
1
1
  import React from 'react';
2
- import { DrawerProps } from './Drawer.types';
2
+ import { DrawerProps } from './types';
3
+ import './Drawer.scss';
3
4
  export declare const prefixCls = "fvc-drawer";
4
5
  export declare const Drawer: {
5
6
  ({ children, placement, width, height, maskClosable, mask, push, testId, ...props }: DrawerProps): React.JSX.Element;
6
7
  Header: {
7
- (props: import("./Drawer.types").ChildWrapperProps): React.JSX.Element;
8
- displayName: import("./Drawer.types").ChildTypes;
8
+ (props: import("./types").ChildWrapperProps): React.JSX.Element;
9
+ displayName: import("./types").ChildTypes;
9
10
  };
10
11
  Footer: {
11
- (props: import("./Drawer.types").ChildWrapperProps): React.JSX.Element;
12
- displayName: import("./Drawer.types").ChildTypes;
12
+ (props: import("./types").ChildWrapperProps): React.JSX.Element;
13
+ displayName: import("./types").ChildTypes;
13
14
  };
14
15
  Content: {
15
- (props: import("./Drawer.types").ChildWrapperProps): React.JSX.Element;
16
- displayName: import("./Drawer.types").ChildTypes;
16
+ (props: import("./types").ChildWrapperProps): React.JSX.Element;
17
+ displayName: import("./types").ChildTypes;
17
18
  };
18
19
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ChildTypes, ChildWrapperProps } from '../Drawer.types';
2
+ import { ChildTypes, ChildWrapperProps } from '../types';
3
3
  export declare const createChildWrapper: (type: ChildTypes) => {
4
4
  (props: ChildWrapperProps): React.JSX.Element;
5
5
  displayName: ChildTypes;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- import { ChildTypes, ChildWrapperProps } from '../Drawer.types';
2
+ import { ChildTypes, ChildWrapperProps } from '../types';
3
3
  export declare const getChildByType: (children: React.ReactNode, type: ChildTypes) => React.ReactElement<ChildWrapperProps>;
@@ -0,0 +1 @@
1
+ export * from './Drawer.types';
package/dist/lib/index.js CHANGED
@@ -1,6 +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:{}};
1
+ import{Drawer as e}from"antd";import r from"react";function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var n,o={exports:{}};
2
2
  /*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see
5
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};
6
+ */var a,d=(n||(n=1,a=o,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}a.exports?(r.default=r,a.exports=r):window.classNames=r}()),o.exports),i=t(d);function c({children:e,testId:t,testIdPostfix:n}){return r.createElement("div",{"data-testid":t?`${t}-${n}`:void 0},e)}const l=e=>{const t=t=>r.createElement(c,Object.assign({},t,{testIdPostfix:null==e?void 0:e.toLowerCase()}));return t.displayName=e,t},s=(e,t)=>r.Children.toArray(e).find(e=>!!(e=>r.isValidElement(e)&&"function"==typeof e.type&&"displayName"in e.type)(e)&&e.type.displayName===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))}}(".fvc-drawer-content-wrapper > .fvc-drawer-content {\n z-index: 1;\n overflow: auto;\n background-clip: padding-box;\n background: var(--card-bg-color-20);\n border: 0;\n}\n.fvc-drawer-content > .fvc-drawer-footer {\n border-top: none;\n}\n.fvc-drawer-content > .fvc-drawer-body {\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.fvc-drawer-placement-right .fvc-drawer-close {\n left: -50px;\n}\n.fvc-drawer-placement-left .fvc-drawer-close {\n right: -40px;\n}\n.fvc-drawer .fvc-drawer-header {\n padding: 16px 32px;\n border-bottom: none;\n}\n.fvc-drawer .fvc-drawer-header-title {\n margin: 0;\n font-size: 16px;\n font-weight: 500;\n line-height: 22px;\n}\n.fvc-drawer .fvc-drawer-close {\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.fvc-drawer .fvc-drawer-close svg {\n width: 20px;\n height: 20px;\n}\n.fvc-drawer .fvc-drawer-close:focus, .fvc-drawer .fvc-drawer-close:hover {\n color: var(--white-icon-color-0);\n background: transparent;\n}\n.fvc-drawer-header-no-title .fvc-drawer .fvc-drawer-close {\n margin-right: 5px;\n padding-right: 22px;\n}");const p="fvc-drawer",f=t=>{var{children:n,placement:o="right",width:a=256,height:d=256,maskClosable:c=!0,mask:l=!0,push:f={distance:180},testId:u="drawer"}=t,v=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}(t,["children","placement","width","height","maskClosable","mask","push","testId"]);const w=s(n,"Footer"),h=s(n,"Header"),g=s(n,"Content"),m=i(p,{[`${p}-placement-${o}`]:o});return r.createElement(e,Object.assign({"data-testid":u,prefixCls:p,title:h,footer:w,placement:o,width:a,height:d,maskClosable:c,mask:l,push:f,rootClassName:m,styles:{header:null==h?void 0:h.props.style,footer:null==w?void 0:w.props.style,content:null==g?void 0:g.props.style}},v),g)};f.Header=l("Header"),f.Footer=l("Footer"),f.Content=l("Content");export{f as Drawer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fvc/drawer",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "main": "./dist/lib/index.js",
5
5
  "types": "./dist/lib/drawer/src/index.d.ts",
6
6
  "files": [
@@ -16,9 +16,15 @@
16
16
  "./types/*": "./dist/lib/drawer/src/types/*"
17
17
  },
18
18
  "scripts": {
19
- "build": "rm -rf dist && eslint --config ../../eslint.config.js . && bunx tsc --noEmit && rollup -c ./rollup.config.mjs"
19
+ "build": "rollup -c ./rollup.config.mjs",
20
+ "clean": "rm -rf dist && rm -rf .rollup.cache && rm -rf .turbo",
21
+ "lint": "eslint --config ../../eslint.config.js \"src/**/*.{ts,tsx}\"",
22
+ "lint:fix": "eslint --config ../../eslint.config.js \"src/**/*.{ts,tsx}\" --fix",
23
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
24
+ "type-check": "tsc --noEmit",
25
+ "test": "bun test --preload ../../tests/happydom.ts --preload ../../tests/testing-library.tsx"
20
26
  },
21
- "dependencies": {
27
+ "peerDependencies": {
22
28
  "react": "^18.0.0",
23
29
  "antd": "^5.0.0"
24
30
  }