@design-edito/tools 0.5.8 → 0.5.10
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/arrays/index.d.ts +3 -3
- package/agnostic/arrays/index.js +3 -3
- package/agnostic/colors/index.d.ts +5 -5
- package/agnostic/colors/index.js +5 -5
- package/agnostic/css/index.d.ts +1 -1
- package/agnostic/css/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +11 -11
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +11 -11
- 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 +4 -4
- package/agnostic/index.js +4 -4
- package/agnostic/misc/index.d.ts +3 -3
- package/agnostic/misc/index.js +3 -3
- package/agnostic/numbers/index.d.ts +1 -1
- package/agnostic/numbers/index.js +1 -1
- package/agnostic/objects/index.d.ts +3 -3
- package/agnostic/objects/index.js +3 -3
- package/agnostic/strings/index.d.ts +1 -1
- package/agnostic/strings/index.js +1 -1
- package/agnostic/subtitles/index.d.ts +1 -1
- package/agnostic/subtitles/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 +106 -0
- package/components/Lightbox/index.js +191 -0
- package/components/Lightbox/store.d.ts +43 -0
- package/components/Lightbox/store.js +94 -0
- package/components/Paginator/index.d.ts +7 -2
- package/components/Paginator/index.js +43 -6
- package/components/Video/index.controlled.d.ts +7 -2
- package/components/Video/index.controlled.js +22 -6
- package/components/Video/index.d.ts +5 -3
- package/components/Video/index.js +14 -4
- package/components/Video/utils.d.ts +11 -0
- package/components/Video/utils.js +14 -5
- package/components/index.d.ts +6 -6
- package/components/index.js +6 -6
- package/components/public-classnames.d.ts +1 -1
- package/components/public-classnames.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/node/@aws-s3/storage/file/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/index.js +1 -1
- package/node/@google-cloud/storage/directory/index.d.ts +2 -2
- package/node/@google-cloud/storage/directory/index.js +2 -2
- package/node/@google-cloud/storage/file/index.d.ts +2 -2
- package/node/@google-cloud/storage/file/index.js +2 -2
- package/node/@google-cloud/storage/index.d.ts +1 -1
- package/node/@google-cloud/storage/index.js +1 -1
- package/node/cloud-storage/operations/index.d.ts +1 -1
- package/node/cloud-storage/operations/index.js +1 -1
- package/node/images/index.d.ts +2 -2
- package/node/images/index.js +2 -2
- package/node/images/transform/operations/index.d.ts +6 -6
- package/node/images/transform/operations/index.js +6 -6
- package/node/sftp/directory/index.d.ts +1 -1
- package/node/sftp/directory/index.js +1 -1
- package/node/sftp/file/index.d.ts +1 -1
- package/node/sftp/file/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
package/components/index.d.ts
CHANGED
|
@@ -10,18 +10,18 @@ export * as image from './Image/index.js'
|
|
|
10
10
|
export * as input from './Input/index.js'
|
|
11
11
|
export * as intersectionObserver from './IntersectionObserver/index.js'
|
|
12
12
|
export * as jsonEditor from './JsonEditor/index.js'
|
|
13
|
-
export * as
|
|
13
|
+
export * as lightbox from './Lightbox/index.js'
|
|
14
14
|
export * as listLoader from './ListLoader/index.js'
|
|
15
|
-
export * as
|
|
15
|
+
export * as overlayer from './Overlayer/index.js'
|
|
16
16
|
export * as paginator from './Paginator/index.js'
|
|
17
|
-
export * as
|
|
18
|
-
export * as select from './Select/index.js'
|
|
17
|
+
export * as resizeObserver from './ResizeObserver/index.js'
|
|
19
18
|
export * as scrllgngn from './Scrllgngn/index.js'
|
|
19
|
+
export * as scrollListener from './ScrollListener/index.js'
|
|
20
|
+
export * as select from './Select/index.js'
|
|
21
|
+
export * as sequencer from './Sequencer/index.js'
|
|
20
22
|
export * as shadowRoot from './ShadowRoot/index.js'
|
|
21
23
|
export * as subtitles from './Subtitles/index.js'
|
|
22
|
-
export * as resizeObserver from './ResizeObserver/index.js'
|
|
23
24
|
export * as textarea from './Textarea/index.js'
|
|
24
|
-
export * as theatre from './Theatre/index.js'
|
|
25
25
|
export * as uiModule from './UIModule/index.js'
|
|
26
26
|
export * as video from './Video/index.js'
|
|
27
27
|
export * as wipAudioQuote from './_WIP_AudioQuote/index.js'
|
package/components/index.js
CHANGED
|
@@ -10,18 +10,18 @@ export * as image from './Image/index.js'
|
|
|
10
10
|
export * as input from './Input/index.js'
|
|
11
11
|
export * as intersectionObserver from './IntersectionObserver/index.js'
|
|
12
12
|
export * as jsonEditor from './JsonEditor/index.js'
|
|
13
|
-
export * as
|
|
13
|
+
export * as lightbox from './Lightbox/index.js'
|
|
14
14
|
export * as listLoader from './ListLoader/index.js'
|
|
15
|
-
export * as
|
|
15
|
+
export * as overlayer from './Overlayer/index.js'
|
|
16
16
|
export * as paginator from './Paginator/index.js'
|
|
17
|
-
export * as
|
|
18
|
-
export * as select from './Select/index.js'
|
|
17
|
+
export * as resizeObserver from './ResizeObserver/index.js'
|
|
19
18
|
export * as scrllgngn from './Scrllgngn/index.js'
|
|
19
|
+
export * as scrollListener from './ScrollListener/index.js'
|
|
20
|
+
export * as select from './Select/index.js'
|
|
21
|
+
export * as sequencer from './Sequencer/index.js'
|
|
20
22
|
export * as shadowRoot from './ShadowRoot/index.js'
|
|
21
23
|
export * as subtitles from './Subtitles/index.js'
|
|
22
|
-
export * as resizeObserver from './ResizeObserver/index.js'
|
|
23
24
|
export * as textarea from './Textarea/index.js'
|
|
24
|
-
export * as theatre from './Theatre/index.js'
|
|
25
25
|
export * as uiModule from './UIModule/index.js'
|
|
26
26
|
export * as video from './Video/index.js'
|
|
27
27
|
export * as wipAudioQuote from './_WIP_AudioQuote/index.js'
|
|
@@ -10,6 +10,7 @@ export declare const image = "lm-image";
|
|
|
10
10
|
export declare const input = "lm-input";
|
|
11
11
|
export declare const intersectionObserver = "lm-intersection-observer";
|
|
12
12
|
export declare const jsonEditor = "lm-json-editor";
|
|
13
|
+
export declare const lightbox = "lm-lightbox";
|
|
13
14
|
export declare const listLoader = "lm-list-loader";
|
|
14
15
|
export declare const overlayer = "lm-overlayer";
|
|
15
16
|
export declare const paginator = "lm-paginator";
|
|
@@ -21,7 +22,6 @@ export declare const sequencer = "lm-sequencer";
|
|
|
21
22
|
export declare const shadowRoot = "lm-shadow-root";
|
|
22
23
|
export declare const subtitles = "lm-subtitles";
|
|
23
24
|
export declare const textarea = "lm-textarea";
|
|
24
|
-
export declare const theatre = "lm-theatre";
|
|
25
25
|
export declare const uiModule = "lm-ui-module";
|
|
26
26
|
export declare const video = "lm-video";
|
|
27
27
|
export declare const videoWrapper = "lm-video-wrapper";
|
|
@@ -10,6 +10,7 @@ export const image = 'lm-image';
|
|
|
10
10
|
export const input = 'lm-input';
|
|
11
11
|
export const intersectionObserver = 'lm-intersection-observer';
|
|
12
12
|
export const jsonEditor = 'lm-json-editor';
|
|
13
|
+
export const lightbox = 'lm-lightbox';
|
|
13
14
|
export const listLoader = 'lm-list-loader';
|
|
14
15
|
export const overlayer = 'lm-overlayer';
|
|
15
16
|
export const paginator = 'lm-paginator';
|
|
@@ -21,7 +22,6 @@ export const sequencer = 'lm-sequencer';
|
|
|
21
22
|
export const shadowRoot = 'lm-shadow-root';
|
|
22
23
|
export const subtitles = 'lm-subtitles';
|
|
23
24
|
export const textarea = 'lm-textarea';
|
|
24
|
-
export const theatre = 'lm-theatre';
|
|
25
25
|
export const uiModule = 'lm-ui-module';
|
|
26
26
|
export const video = 'lm-video';
|
|
27
27
|
export const videoWrapper = 'lm-video-wrapper';
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as copy from './copy/index.js'
|
|
2
2
|
export * as download from './download/index.js'
|
|
3
3
|
export * as exists from './exists/index.js'
|
|
4
|
+
export * as move from './move/index.js'
|
|
4
5
|
export * as remove from './remove/index.js'
|
|
5
6
|
export * as stat from './stat/index.js'
|
|
6
|
-
export * as move from './move/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as copy from './copy/index.js'
|
|
2
2
|
export * as download from './download/index.js'
|
|
3
3
|
export * as exists from './exists/index.js'
|
|
4
|
+
export * as move from './move/index.js'
|
|
4
5
|
export * as remove from './remove/index.js'
|
|
5
6
|
export * as stat from './stat/index.js'
|
|
6
|
-
export * as move from './move/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as list from './list/index.js'
|
|
2
1
|
export * as copyDir from './copy-dir/index.js'
|
|
3
|
-
export * as moveDir from './move-dir/index.js'
|
|
4
2
|
export * as removeDir from './remove-dir/index.js'
|
|
3
|
+
export * as list from './list/index.js'
|
|
4
|
+
export * as moveDir from './move-dir/index.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as list from './list/index.js'
|
|
2
1
|
export * as copyDir from './copy-dir/index.js'
|
|
3
|
-
export * as moveDir from './move-dir/index.js'
|
|
4
2
|
export * as removeDir from './remove-dir/index.js'
|
|
3
|
+
export * as list from './list/index.js'
|
|
4
|
+
export * as moveDir from './move-dir/index.js'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * as copy from './copy/index.js'
|
|
2
|
-
export * as exists from './exists/index.js'
|
|
3
2
|
export * as generateSignedUrl from './generate-signed-url/index.js'
|
|
3
|
+
export * as download from './download/index.js'
|
|
4
4
|
export * as getMetadata from './get-metadata/index.js'
|
|
5
5
|
export * as getPermissions from './get-permissions/index.js'
|
|
6
6
|
export * as move from './move/index.js'
|
|
7
|
-
export * as download from './download/index.js'
|
|
8
7
|
export * as remove from './remove/index.js'
|
|
9
8
|
export * as stat from './stat/index.js'
|
|
10
9
|
export * as revokeSignedUrls from './revoke-signed-urls/index.js'
|
|
10
|
+
export * as exists from './exists/index.js'
|
|
11
11
|
export * as updateMetadata from './update-metadata/index.js'
|
|
12
12
|
export * as upload from './upload/index.js'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * as copy from './copy/index.js'
|
|
2
|
-
export * as exists from './exists/index.js'
|
|
3
2
|
export * as generateSignedUrl from './generate-signed-url/index.js'
|
|
3
|
+
export * as download from './download/index.js'
|
|
4
4
|
export * as getMetadata from './get-metadata/index.js'
|
|
5
5
|
export * as getPermissions from './get-permissions/index.js'
|
|
6
6
|
export * as move from './move/index.js'
|
|
7
|
-
export * as download from './download/index.js'
|
|
8
7
|
export * as remove from './remove/index.js'
|
|
9
8
|
export * as stat from './stat/index.js'
|
|
10
9
|
export * as revokeSignedUrls from './revoke-signed-urls/index.js'
|
|
10
|
+
export * as exists from './exists/index.js'
|
|
11
11
|
export * as updateMetadata from './update-metadata/index.js'
|
|
12
12
|
export * as upload from './upload/index.js'
|
|
@@ -3,8 +3,8 @@ export * as copyFile from './copy-file/index.js'
|
|
|
3
3
|
export * as downloadFile from './download-file/index.js'
|
|
4
4
|
export * as existsFile from './exists-file/index.js'
|
|
5
5
|
export * as listDir from './list-dir/index.js'
|
|
6
|
-
export * as moveFile from './move-file/index.js'
|
|
7
6
|
export * as moveDir from './move-dir/index.js'
|
|
7
|
+
export * as moveFile from './move-file/index.js'
|
|
8
8
|
export * as removeDir from './remove-dir/index.js'
|
|
9
9
|
export * as removeFile from './remove-file/index.js'
|
|
10
10
|
export * as statFile from './stat-file/index.js'
|
|
@@ -3,8 +3,8 @@ export * as copyFile from './copy-file/index.js'
|
|
|
3
3
|
export * as downloadFile from './download-file/index.js'
|
|
4
4
|
export * as existsFile from './exists-file/index.js'
|
|
5
5
|
export * as listDir from './list-dir/index.js'
|
|
6
|
-
export * as moveFile from './move-file/index.js'
|
|
7
6
|
export * as moveDir from './move-dir/index.js'
|
|
7
|
+
export * as moveFile from './move-file/index.js'
|
|
8
8
|
export * as removeDir from './remove-dir/index.js'
|
|
9
9
|
export * as removeFile from './remove-file/index.js'
|
|
10
10
|
export * as statFile from './stat-file/index.js'
|
package/node/images/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export * as create from './create/index.js'
|
|
1
2
|
export * as format from './format/index.js'
|
|
2
|
-
export * as metadata from './metadata/index.js'
|
|
3
3
|
export * as transform from './transform/index.js'
|
|
4
|
+
export * as metadata from './metadata/index.js'
|
|
4
5
|
export * as utils from './utils/index.js'
|
|
5
|
-
export * as create from './create/index.js'
|
package/node/images/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export * as create from './create/index.js'
|
|
1
2
|
export * as format from './format/index.js'
|
|
2
|
-
export * as metadata from './metadata/index.js'
|
|
3
3
|
export * as transform from './transform/index.js'
|
|
4
|
+
export * as metadata from './metadata/index.js'
|
|
4
5
|
export * as utils from './utils/index.js'
|
|
5
|
-
export * as create from './create/index.js'
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export * as brighten from './brighten/index.js'
|
|
2
1
|
export * as blur from './blur/index.js'
|
|
2
|
+
export * as brighten from './brighten/index.js'
|
|
3
3
|
export * as extend from './extend/index.js'
|
|
4
|
-
export * as flatten from './flatten/index.js'
|
|
5
4
|
export * as extract from './extract/index.js'
|
|
5
|
+
export * as flatten from './flatten/index.js'
|
|
6
6
|
export * as flip from './flip/index.js'
|
|
7
|
-
export * as flop from './flop/index.js'
|
|
8
|
-
export * as level from './level/index.js'
|
|
9
7
|
export * as hue from './hue/index.js'
|
|
10
|
-
export * as
|
|
8
|
+
export * as level from './level/index.js'
|
|
11
9
|
export * as lighten from './lighten/index.js'
|
|
10
|
+
export * as normalize from './normalize/index.js'
|
|
12
11
|
export * as overlay from './overlay/index.js'
|
|
13
12
|
export * as resize from './resize/index.js'
|
|
14
|
-
export * as
|
|
13
|
+
export * as flop from './flop/index.js'
|
|
15
14
|
export * as rotate from './rotate/index.js'
|
|
15
|
+
export * as saturate from './saturate/index.js'
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export * as brighten from './brighten/index.js'
|
|
2
1
|
export * as blur from './blur/index.js'
|
|
2
|
+
export * as brighten from './brighten/index.js'
|
|
3
3
|
export * as extend from './extend/index.js'
|
|
4
|
-
export * as flatten from './flatten/index.js'
|
|
5
4
|
export * as extract from './extract/index.js'
|
|
5
|
+
export * as flatten from './flatten/index.js'
|
|
6
6
|
export * as flip from './flip/index.js'
|
|
7
|
-
export * as flop from './flop/index.js'
|
|
8
|
-
export * as level from './level/index.js'
|
|
9
7
|
export * as hue from './hue/index.js'
|
|
10
|
-
export * as
|
|
8
|
+
export * as level from './level/index.js'
|
|
11
9
|
export * as lighten from './lighten/index.js'
|
|
10
|
+
export * as normalize from './normalize/index.js'
|
|
12
11
|
export * as overlay from './overlay/index.js'
|
|
13
12
|
export * as resize from './resize/index.js'
|
|
14
|
-
export * as
|
|
13
|
+
export * as flop from './flop/index.js'
|
|
15
14
|
export * as rotate from './rotate/index.js'
|
|
15
|
+
export * as saturate from './saturate/index.js'
|
|
@@ -2,6 +2,6 @@ export * as copy from './copy/index.js'
|
|
|
2
2
|
export * as download from './download/index.js'
|
|
3
3
|
export * as exists from './exists/index.js'
|
|
4
4
|
export * as move from './move/index.js'
|
|
5
|
-
export * as remove from './remove/index.js'
|
|
6
5
|
export * as stat from './stat/index.js'
|
|
6
|
+
export * as remove from './remove/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
package/node/sftp/file/index.js
CHANGED
|
@@ -2,6 +2,6 @@ export * as copy from './copy/index.js'
|
|
|
2
2
|
export * as download from './download/index.js'
|
|
3
3
|
export * as exists from './exists/index.js'
|
|
4
4
|
export * as move from './move/index.js'
|
|
5
|
-
export * as remove from './remove/index.js'
|
|
6
5
|
export * as stat from './stat/index.js'
|
|
6
|
+
export * as remove from './remove/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design-edito/tools",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -1495,6 +1495,13 @@
|
|
|
1495
1495
|
"import": "./components/JsonEditor/types.js",
|
|
1496
1496
|
"types": "./components/JsonEditor/types.d.ts"
|
|
1497
1497
|
},
|
|
1498
|
+
"./components/Lightbox": {
|
|
1499
|
+
"import": "./components/Lightbox/index.js",
|
|
1500
|
+
"types": "./components/Lightbox/index.d.ts"
|
|
1501
|
+
},
|
|
1502
|
+
"./components/Lightbox/index.js": {
|
|
1503
|
+
"import": "./components/Lightbox/index.js"
|
|
1504
|
+
},
|
|
1498
1505
|
"./components/ListLoader": {
|
|
1499
1506
|
"import": "./components/ListLoader/index.js",
|
|
1500
1507
|
"types": "./components/ListLoader/index.d.ts"
|
|
@@ -1572,13 +1579,6 @@
|
|
|
1572
1579
|
"./components/Textarea/index.js": {
|
|
1573
1580
|
"import": "./components/Textarea/index.js"
|
|
1574
1581
|
},
|
|
1575
|
-
"./components/Theatre": {
|
|
1576
|
-
"import": "./components/Theatre/index.js",
|
|
1577
|
-
"types": "./components/Theatre/index.d.ts"
|
|
1578
|
-
},
|
|
1579
|
-
"./components/Theatre/index.js": {
|
|
1580
|
-
"import": "./components/Theatre/index.js"
|
|
1581
|
-
},
|
|
1582
1582
|
"./components/UIModule": {
|
|
1583
1583
|
"import": "./components/UIModule/index.js",
|
|
1584
1584
|
"types": "./components/UIModule/index.d.ts"
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { type FunctionComponent, type PropsWithChildren, type ReactNode } from 'react';
|
|
2
|
-
import type { WithClassName } from '../utils/types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Props for the {@link Theatre} component.
|
|
5
|
-
*
|
|
6
|
-
* @property closeBtnContent - Content rendered inside the close/exit button.
|
|
7
|
-
* @property openBtnContent - Content rendered inside the open/enter button.
|
|
8
|
-
* @property isOn - Controlled theatre mode state. When defined, the component
|
|
9
|
-
* behaves as a controlled component and internal state is never updated.
|
|
10
|
-
* @property defaultIsOn - Initial theatre mode state in uncontrolled mode.
|
|
11
|
-
* Ignored when `isOn` is provided. Defaults to `false`.
|
|
12
|
-
* @property exitOnEscape - When `true`, pressing `Escape` while the stage is
|
|
13
|
-
* open counts as a toggle.
|
|
14
|
-
* @property exitOnBgClick - When `true`, clicking the stage background — and
|
|
15
|
-
* not its content — counts as a toggle.
|
|
16
|
-
* @property onOpenButtonClicked - Called when the open button is clicked, before
|
|
17
|
-
* the theatre reacts, with the state as it was.
|
|
18
|
-
* @property onCloseButtonClicked - Called when the close button is clicked,
|
|
19
|
-
* before the theatre reacts, with the state as it was.
|
|
20
|
-
* @property onBackgroundClicked - Called when the stage background is clicked
|
|
21
|
-
* (only while `exitOnBgClick` is `true`), before the theatre reacts, with the
|
|
22
|
-
* state as it was.
|
|
23
|
-
* @property onEscapePressed - Called when `Escape` is pressed while the stage is
|
|
24
|
-
* open (only while `exitOnEscape` is `true`), before the theatre reacts, with
|
|
25
|
-
* the state as it was.
|
|
26
|
-
* @property onIsOnChanged - Called after the theatre mode changed, with the new
|
|
27
|
-
* value.
|
|
28
|
-
* @property className - Optional additional class name(s) applied to the root element.
|
|
29
|
-
* @property children - Content rendered both in the default slot and, when
|
|
30
|
-
* theatre mode is active, duplicated inside the stage element.
|
|
31
|
-
*/
|
|
32
|
-
export type Props = PropsWithChildren<WithClassName<{
|
|
33
|
-
closeBtnContent?: ReactNode;
|
|
34
|
-
openBtnContent?: ReactNode;
|
|
35
|
-
isOn?: boolean;
|
|
36
|
-
defaultIsOn?: boolean;
|
|
37
|
-
exitOnEscape?: boolean;
|
|
38
|
-
exitOnBgClick?: boolean;
|
|
39
|
-
onOpenButtonClicked?: (isOn: boolean) => void;
|
|
40
|
-
onCloseButtonClicked?: (isOn: boolean) => void;
|
|
41
|
-
onBackgroundClicked?: (isOn: boolean) => void;
|
|
42
|
-
onEscapePressed?: (isOn: boolean) => void;
|
|
43
|
-
onIsOnChanged?: (isOn: boolean) => void;
|
|
44
|
-
}>>;
|
|
45
|
-
/**
|
|
46
|
-
* Theatre mode component. Wraps content in a toggleable fullscreen-like "stage"
|
|
47
|
-
* overlay.
|
|
48
|
-
*
|
|
49
|
-
* ### CSS modifiers
|
|
50
|
-
* - `on` — theatre mode is active.
|
|
51
|
-
* - `off` — theatre mode is inactive.
|
|
52
|
-
*
|
|
53
|
-
* ### CSS elements
|
|
54
|
-
* - `stage` — holds the duplicated `children`, mounted only when `isOn`.
|
|
55
|
-
* - `open-btn`
|
|
56
|
-
* - `close-btn`
|
|
57
|
-
*
|
|
58
|
-
* @param props - Component properties.
|
|
59
|
-
* @see {@link Props}
|
|
60
|
-
* @returns A root `<div>` containing the children in their original position,
|
|
61
|
-
* a stage overlay with the duplicated children when active, and both toggles.
|
|
62
|
-
*
|
|
63
|
-
* @remarks
|
|
64
|
-
* - In controlled mode (`isOn` defined), the state is fully driven by the
|
|
65
|
-
* parent and internal state is never updated.
|
|
66
|
-
* - The four toggle-source handlers fire in both modes — a controlled parent
|
|
67
|
-
* needs them to know a toggle was requested at all.
|
|
68
|
-
* - `onIsOnChanged` fires in both modes too, and never on mount.
|
|
69
|
-
*/
|
|
70
|
-
export declare const Theatre: FunctionComponent<Props>;
|
|
@@ -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
|