@bolttech/ob-atoms-backdrop 1.0.0 → 1.0.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.
- package/index.cjs.js +26 -44
- package/package.json +4 -5
- package/src/index.d.ts +0 -1
- package/src/lib/backdrop.d.ts +0 -2
- package/src/lib/backdrop.interface.d.ts +0 -37
- package/src/lib/backdrop.stories.d.ts +0 -5
package/index.cjs.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
3
|
var classNames = require('classnames');
|
|
5
4
|
var react = require('react');
|
|
6
5
|
var reactDom = require('react-dom');
|
|
7
6
|
var uiUtils = require('@bolttech/ui-utils');
|
|
7
|
+
var jsxDevRuntime = require('react/jsx-dev-runtime');
|
|
8
|
+
|
|
9
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
10
|
+
if (null == r) return {};
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
13
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
14
|
+
t[n] = r[n];
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
8
18
|
|
|
9
19
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
10
20
|
|
|
@@ -46,7 +56,7 @@ var fails$7 = fails$9;
|
|
|
46
56
|
|
|
47
57
|
var functionBindNative = !fails$7(function () {
|
|
48
58
|
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
49
|
-
var test =
|
|
59
|
+
var test = function () { /* empty */ }.bind();
|
|
50
60
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
51
61
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
52
62
|
});
|
|
@@ -324,10 +334,10 @@ var SHARED = '__core-js_shared__';
|
|
|
324
334
|
var store$3 = sharedStore.exports = globalThis$6[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
325
335
|
|
|
326
336
|
(store$3.versions || (store$3.versions = [])).push({
|
|
327
|
-
version: '3.
|
|
337
|
+
version: '3.49.0',
|
|
328
338
|
mode: 'global',
|
|
329
339
|
copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.',
|
|
330
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
340
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE',
|
|
331
341
|
source: 'https://github.com/zloirock/core-js'
|
|
332
342
|
});
|
|
333
343
|
|
|
@@ -1067,56 +1077,24 @@ $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign },
|
|
|
1067
1077
|
assign: assign
|
|
1068
1078
|
});
|
|
1069
1079
|
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
purpose with or without fee is hereby granted.
|
|
1075
|
-
|
|
1076
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1077
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1078
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1079
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1080
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1081
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1082
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
1083
|
-
***************************************************************************** */
|
|
1084
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
function __rest(s, e) {
|
|
1088
|
-
var t = {};
|
|
1089
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1090
|
-
t[p] = s[p];
|
|
1091
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1092
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1093
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1094
|
-
t[p[i]] = s[p[i]];
|
|
1095
|
-
}
|
|
1096
|
-
return t;
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
1100
|
-
var e = new Error(message);
|
|
1101
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1102
|
-
};
|
|
1103
|
-
|
|
1104
|
-
const Backdrop = /*#__PURE__*/react.forwardRef((_a, ref) => {
|
|
1105
|
-
var {
|
|
1080
|
+
const _excluded = ["id", "dataTestId", "onClick", "appendTo", "className", "children"];
|
|
1081
|
+
var _jsxFileName = "/home/silas-silva/Documents/projects/bgs-frontend-ui/libs/ob/atoms/backdrop/src/lib/backdrop.tsx";
|
|
1082
|
+
const Backdrop = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
1083
|
+
let {
|
|
1106
1084
|
id = 'backdrop-id',
|
|
1107
1085
|
dataTestId = 'backdrop-data-testid',
|
|
1108
1086
|
onClick,
|
|
1109
1087
|
appendTo,
|
|
1110
1088
|
className,
|
|
1111
1089
|
children
|
|
1112
|
-
} =
|
|
1113
|
-
props =
|
|
1090
|
+
} = _ref,
|
|
1091
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1114
1092
|
const handleClick = event => {
|
|
1115
1093
|
if (!onClick || event.currentTarget !== event.target) return;
|
|
1116
1094
|
onClick(event);
|
|
1117
1095
|
return;
|
|
1118
1096
|
};
|
|
1119
|
-
const backdrop = react.useMemo(() =>
|
|
1097
|
+
const backdrop = react.useMemo(() => /*#__PURE__*/jsxDevRuntime.jsxDEV("div", Object.assign({
|
|
1120
1098
|
ref: ref,
|
|
1121
1099
|
id: id,
|
|
1122
1100
|
"data-testid": dataTestId,
|
|
@@ -1124,7 +1102,11 @@ const Backdrop = /*#__PURE__*/react.forwardRef((_a, ref) => {
|
|
|
1124
1102
|
className: classNames('w-screen h-screen fixed inset-0 bg-black/30 z-4', className)
|
|
1125
1103
|
}, uiUtils.applyDataAttributes(props), {
|
|
1126
1104
|
children: children
|
|
1127
|
-
})
|
|
1105
|
+
}), void 0, false, {
|
|
1106
|
+
fileName: _jsxFileName,
|
|
1107
|
+
lineNumber: 30,
|
|
1108
|
+
columnNumber: 9
|
|
1109
|
+
}, undefined), [className, children, onClick, id]);
|
|
1128
1110
|
if (!appendTo) return backdrop;
|
|
1129
1111
|
return /*#__PURE__*/reactDom.createPortal(backdrop, appendTo);
|
|
1130
1112
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bolttech/ob-atoms-backdrop",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@bolttech/ui-utils": "0.6.
|
|
6
|
-
"classnames": "^2.5.1",
|
|
5
|
+
"@bolttech/ui-utils": "0.6.7",
|
|
7
6
|
"react": "19.1.2",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
7
|
+
"classnames": "^2.5.1",
|
|
8
|
+
"react-dom": "19.1.2"
|
|
10
9
|
},
|
|
11
10
|
"main": "./index.cjs.js",
|
|
12
11
|
"type": "commonjs",
|
package/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib/backdrop';
|
package/src/lib/backdrop.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { DefaultProps } from '@bolttech/ui-utils';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* @interface IBackdropProps Backdrop component props
|
|
5
|
-
* @property {string | undefined} id - component identification
|
|
6
|
-
* @property {string | undefined} dataTestId - react-testing-library identification
|
|
7
|
-
* @property {HTMLElement | undefined} appendTo - html element reference that the backdrop will be attached to using react portal
|
|
8
|
-
* @property {function | undefined} onClick - function that will run when user clicks on backdrop
|
|
9
|
-
* @property {string | undefined} className - classname for allowing customization
|
|
10
|
-
* @property {string | React.ReactElement | React.ReactElement[] | undefined} children - children component that will render inside the backdrop
|
|
11
|
-
*/
|
|
12
|
-
export interface IBackdropProps extends DefaultProps {
|
|
13
|
-
/** Component identification */
|
|
14
|
-
id?: string;
|
|
15
|
-
/** React-testing-library identification */
|
|
16
|
-
dataTestId?: string;
|
|
17
|
-
/** HTML Element reference that the backdrop will be attached to using react portal */
|
|
18
|
-
appendTo?: HTMLElement;
|
|
19
|
-
/** Function that will run when user clicks on backdrop
|
|
20
|
-
*
|
|
21
|
-
* NOTE: this function will not run when clicking on the content of the children component, only when clicking on the `Backdrop`
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
*<Backdrop onClick={(event) => setIsOpen(false)}>
|
|
27
|
-
<h1>Backdrop content</h1>
|
|
28
|
-
</Backdrop>
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
onClick?: (event: React.MouseEvent) => void;
|
|
33
|
-
/** Classname for allowing customization */
|
|
34
|
-
className?: string;
|
|
35
|
-
/** Children component that will render inside the backdrop */
|
|
36
|
-
children?: ReactNode;
|
|
37
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Meta } from '@storybook/react';
|
|
2
|
-
import { Backdrop } from './backdrop';
|
|
3
|
-
declare const Story: Meta<typeof Backdrop>;
|
|
4
|
-
export default Story;
|
|
5
|
-
export declare const Primary: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./backdrop.interface").IBackdropProps & import("react").RefAttributes<HTMLDivElement>>;
|