@design-edito/tools 0.5.9 → 0.5.11
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/agnostic/colors/index.d.ts +1 -1
- package/agnostic/colors/index.js +1 -1
- package/agnostic/css/index.d.ts +1 -1
- package/agnostic/css/index.js +1 -1
- package/agnostic/errors/index.d.ts +1 -1
- package/agnostic/errors/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +15 -15
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +15 -15
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +3 -3
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +3 -3
- package/agnostic/html/index.d.ts +2 -2
- package/agnostic/html/index.js +2 -2
- package/agnostic/index.d.ts +3 -3
- package/agnostic/index.js +3 -3
- package/agnostic/misc/index.d.ts +3 -3
- package/agnostic/misc/index.js +3 -3
- package/agnostic/misc/logs/index.d.ts +1 -1
- package/agnostic/misc/logs/index.js +1 -1
- package/agnostic/numbers/index.d.ts +1 -1
- package/agnostic/numbers/index.js +1 -1
- package/agnostic/objects/index.d.ts +1 -1
- package/agnostic/objects/index.js +1 -1
- package/agnostic/optim/index.d.ts +1 -1
- package/agnostic/optim/index.js +1 -1
- package/agnostic/strings/index.d.ts +1 -1
- package/agnostic/strings/index.js +1 -1
- package/agnostic/time/index.d.ts +1 -1
- package/agnostic/time/index.js +1 -1
- package/components/Lightbox/index.d.ts +109 -0
- package/components/Lightbox/index.js +193 -0
- package/components/Lightbox/store.d.ts +43 -0
- package/components/Lightbox/store.js +94 -0
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/components/public-classnames.d.ts +1 -1
- package/components/public-classnames.js +1 -1
- package/node/cloud-storage/operations/index.d.ts +1 -1
- package/node/cloud-storage/operations/index.js +1 -1
- package/node/ftps/directory/index.d.ts +1 -1
- package/node/ftps/directory/index.js +1 -1
- package/node/images/transform/operations/index.d.ts +2 -2
- package/node/images/transform/operations/index.js +2 -2
- package/node/index.d.ts +3 -3
- package/node/index.js +3 -3
- package/node/sftp/index.d.ts +1 -1
- package/node/sftp/index.js +1 -1
- package/package.json +8 -8
- package/components/Theatre/index.d.ts +0 -70
- package/components/Theatre/index.js +0 -85
- /package/components/{Theatre → Lightbox}/styles.module.css +0 -0
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState, useRef } from 'react';
|
|
3
|
-
import { clss } from '../../agnostic/css/clss/index.js';
|
|
4
|
-
import { mergeClassNames, useChangeDispatch } from '../utils/index.js';
|
|
5
|
-
import { theatre as publicClassName } from '../public-classnames.js';
|
|
6
|
-
import cssModule from './styles.module.css';
|
|
7
|
-
/**
|
|
8
|
-
* Theatre mode component. Wraps content in a toggleable fullscreen-like "stage"
|
|
9
|
-
* overlay.
|
|
10
|
-
*
|
|
11
|
-
* ### CSS modifiers
|
|
12
|
-
* - `on` — theatre mode is active.
|
|
13
|
-
* - `off` — theatre mode is inactive.
|
|
14
|
-
*
|
|
15
|
-
* ### CSS elements
|
|
16
|
-
* - `stage` — holds the duplicated `children`, mounted only when `isOn`.
|
|
17
|
-
* - `open-btn`
|
|
18
|
-
* - `close-btn`
|
|
19
|
-
*
|
|
20
|
-
* @param props - Component properties.
|
|
21
|
-
* @see {@link Props}
|
|
22
|
-
* @returns A root `<div>` containing the children in their original position,
|
|
23
|
-
* a stage overlay with the duplicated children when active, and both toggles.
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* - In controlled mode (`isOn` defined), the state is fully driven by the
|
|
27
|
-
* parent and internal state is never updated.
|
|
28
|
-
* - The four toggle-source handlers fire in both modes — a controlled parent
|
|
29
|
-
* needs them to know a toggle was requested at all.
|
|
30
|
-
* - `onIsOnChanged` fires in both modes too, and never on mount.
|
|
31
|
-
*/
|
|
32
|
-
export const Theatre = ({ closeBtnContent, openBtnContent, isOn: isOnProp, defaultIsOn = false, exitOnEscape, exitOnBgClick, onOpenButtonClicked, onCloseButtonClicked, onBackgroundClicked, onEscapePressed, onIsOnChanged, children, className }) => {
|
|
33
|
-
// State & refs
|
|
34
|
-
const [internalIsOn, setInternalIsOn] = useState(defaultIsOn);
|
|
35
|
-
const stageRef = useRef(null);
|
|
36
|
-
const isControlled = isOnProp !== undefined;
|
|
37
|
-
const isOn = isOnProp ?? internalIsOn;
|
|
38
|
-
// State dispatch
|
|
39
|
-
useChangeDispatch(isOn, onIsOnChanged);
|
|
40
|
-
// User action handlers
|
|
41
|
-
const requestToggle = (targetIsOn) => {
|
|
42
|
-
if (isControlled)
|
|
43
|
-
return;
|
|
44
|
-
setInternalIsOn(targetIsOn);
|
|
45
|
-
};
|
|
46
|
-
const handleOpenButtonClick = () => {
|
|
47
|
-
onOpenButtonClicked?.(isOn);
|
|
48
|
-
requestToggle(true);
|
|
49
|
-
};
|
|
50
|
-
const handleCloseButtonClick = () => {
|
|
51
|
-
onCloseButtonClicked?.(isOn);
|
|
52
|
-
requestToggle(false);
|
|
53
|
-
};
|
|
54
|
-
const handleStageBgClick = e => {
|
|
55
|
-
if (exitOnBgClick !== true)
|
|
56
|
-
return;
|
|
57
|
-
if (e.target !== stageRef.current)
|
|
58
|
-
return;
|
|
59
|
-
onBackgroundClicked?.(isOn);
|
|
60
|
-
requestToggle(false);
|
|
61
|
-
};
|
|
62
|
-
// Fx. dep. `exitOnEscape`, `isOn` - close the stage on the Escape key
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (exitOnEscape !== true || !isOn)
|
|
65
|
-
return;
|
|
66
|
-
const handleKeyDown = (e) => {
|
|
67
|
-
if (e.key !== 'Escape')
|
|
68
|
-
return;
|
|
69
|
-
onEscapePressed?.(isOn);
|
|
70
|
-
requestToggle(false);
|
|
71
|
-
};
|
|
72
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
73
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
74
|
-
}, [exitOnEscape, isOn, isControlled, onEscapePressed]);
|
|
75
|
-
// Rendering
|
|
76
|
-
const c = clss(publicClassName, { cssModule });
|
|
77
|
-
const rootClss = mergeClassNames(c(null, {
|
|
78
|
-
'on': isOn,
|
|
79
|
-
'off': !isOn
|
|
80
|
-
}), className);
|
|
81
|
-
const stageClss = c('stage');
|
|
82
|
-
const openBtnClss = c('open-btn');
|
|
83
|
-
const closeBtnClss = c('close-btn');
|
|
84
|
-
return _jsxs("div", { className: rootClss, children: [children, _jsx("div", { className: stageClss, onClick: handleStageBgClick, ref: stageRef, children: isOn && children }), _jsx("div", { className: closeBtnClss, onClick: handleCloseButtonClick, children: closeBtnContent }), _jsx("div", { className: openBtnClss, onClick: handleOpenButtonClick, children: openBtnContent })] });
|
|
85
|
-
};
|
|
File without changes
|