@linzjs/windows 16.1.0 → 16.2.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.
package/README.md CHANGED
@@ -7,6 +7,7 @@
7
7
  > Reusable promise based windowing component for LINZ / Toitū te whenua.
8
8
 
9
9
  React state based modals/windows are painful because they require:
10
+
10
11
  - shared states for open/closed.
11
12
  - callbacks/states for return values.
12
13
  - inline modal/window includes, which prevent you from closing the invoking component before the modal/window has completed.
@@ -15,6 +16,7 @@ This module gives you promise based modals/windows which don't require all the s
15
16
  based boilerplate / inline-components.
16
17
 
17
18
  So you can simply do this in your react-app:
19
+
18
20
  ```
19
21
  const result = await showModal(TestModal, { props... })
20
22
 
@@ -24,22 +26,28 @@ const result = await showModal(TestModal, { props... })
24
26
  ```
25
27
 
26
28
  ## Features
29
+
27
30
  - Async HTML dialog based Modals.
28
31
  - Draggable and resizeable, pop-in/out Panels/Windows.
29
32
 
30
33
  ## Install
34
+
31
35
  ```
32
36
  npm install @linzjs/windows
33
37
  ```
38
+
34
39
  or with Yarn
40
+
35
41
  ```
36
42
  yarn add @linzjs/windows
37
43
  ```
38
44
 
39
45
  ## Debug log
46
+
40
47
  To enable debug logs set:
48
+
41
49
  ```javascript
42
- localStorage.setItem("@linzjs/windows.debugEnabled", "true");
50
+ localStorage.setItem('@linzjs/windows.debugEnabled', 'true');
43
51
  ```
44
52
 
45
53
  ## Demo
@@ -123,11 +131,7 @@ export const TestModalUsage = () => {
123
131
  const { showModal, modalOwnerRef } = useShowAsyncModal();
124
132
 
125
133
  const showModalHandler = async () => {
126
- const result = await showModal(
127
- TestModal,
128
- { text: "I'm generic modal content" },
129
- { showOnAllWindows: true },
130
- );
134
+ const result = await showModal(TestModal, { text: "I'm generic modal content" }, { showOnAllWindows: true });
131
135
 
132
136
  if (!result) return alert('Modal closed');
133
137
  alert(`Modal result is: ${String(result)}`);
@@ -148,12 +152,12 @@ export const TestModalUsage = () => {
148
152
 
149
153
  Pre-built modals for common use cases: `outline`, `info`, `warning`, `error`, `success`, `progress`, and `blocked`.
150
154
 
151
- | Outline | Info | Warning | Error |
152
- |---------|------|---------|-------|
155
+ | Outline | Info | Warning | Error |
156
+ | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
153
157
  | ![Outline modal](https://github.com/matsondawson/windows-doc-images/raw/HEAD/docimages/prefab-modal-outline.png) | ![Info modal](https://github.com/matsondawson/windows-doc-images/raw/HEAD/docimages/prefab-modal-info.png) | ![Warning modal](https://github.com/matsondawson/windows-doc-images/raw/HEAD/docimages/prefab-modal-warning.png) | ![Error modal](https://github.com/matsondawson/windows-doc-images/raw/HEAD/docimages/prefab-modal-error.png) |
154
158
 
155
- | Success | Progress | Blocked | Custom buttons |
156
- |---------|----------|---------|----------------|
159
+ | Success | Progress | Blocked | Custom buttons |
160
+ | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
157
161
  | ![Success modal](https://github.com/matsondawson/windows-doc-images/raw/HEAD/docimages/prefab-modal-success.png) | ![Progress modal](https://github.com/matsondawson/windows-doc-images/raw/HEAD/docimages/prefab-modal-progress.png) | ![Blocked modal](https://github.com/matsondawson/windows-doc-images/raw/HEAD/docimages/prefab-modal-blocked.png) | ![Custom buttons modal](https://github.com/matsondawson/windows-doc-images/raw/HEAD/docimages/prefab-modal-custom.png) |
158
162
 
159
163
  **Setup** — same `LuiModalAsyncContextProvider` as above.
@@ -282,6 +286,7 @@ export const PrefabModalUsage = () => {
282
286
  ```
283
287
 
284
288
  To clear a "don't show again" session key programmatically:
289
+
285
290
  ```tsx
286
291
  import { LuiModalDontShowSessionRemove } from '@linzjs/windows';
287
292
 
@@ -357,14 +362,8 @@ import { Panel, PanelContent, PanelHeader } from '@linzjs/windows';
357
362
 
358
363
  export const ShowPanelComponent = ({ data }: { data: number }) => (
359
364
  <Panel title={`Panel demo ${data}`} size={{ width: 640, height: 'auto' }}>
360
- <PanelHeader
361
- helpUrl={'#help'}
362
- icon={'ic_add_adopt'}
363
- onHelpClick={() => alert('Help!')}
364
- />
365
- <PanelContent>
366
- {/* panel body content */}
367
- </PanelContent>
365
+ <PanelHeader helpUrl={'#help'} icon={'ic_add_adopt'} onHelpClick={() => alert('Help!')} />
366
+ <PanelContent>{/* panel body content */}</PanelContent>
368
367
  </Panel>
369
368
  );
370
369
 
@@ -372,9 +371,7 @@ export const ShowPanelComponent = ({ data }: { data: number }) => (
372
371
  export const ShowPanelModalComponent = ({ data }: { data: number }) => (
373
372
  <Panel title={`Panel demo ${data}`} size={{ width: 640, height: 400 }} modal={true}>
374
373
  <PanelHeader icon={'ic_add_adopt'} disablePopout={true} />
375
- <PanelContent>
376
- {/* panel body content */}
377
- </PanelContent>
374
+ <PanelContent>{/* panel body content */}</PanelContent>
378
375
  </Panel>
379
376
  );
380
377
  ```
@@ -399,10 +396,7 @@ export const TestShowPanel = () => (
399
396
  componentFn={() => <ShowPanelComponent data={2} />}
400
397
  uniqueId="panel2"
401
398
  />
402
- <OpenPanelButton
403
- buttonText={'Panel as a Modal'}
404
- componentFn={() => <ShowPanelModalComponent data={3} />}
405
- />
399
+ <OpenPanelButton buttonText={'Panel as a Modal'} componentFn={() => <ShowPanelModalComponent data={3} />} />
406
400
  {/* Panel with dynamic bounds — recalculated on resize */}
407
401
  <OpenPanelButton
408
402
  buttonText={'Dynamic bounds panel'}
@@ -425,17 +419,17 @@ export const TestShowPanel = () => (
425
419
 
426
420
  **Panel props:**
427
421
 
428
- | Prop | Type | Description |
429
- |------|------|-------------|
430
- | `title` | `string` | Panel title bar text |
431
- | `size` | `{ width: number, height: number \| 'auto' }` | Initial panel size |
432
- | `modal` | `boolean` | Disable dragging and popout, center on screen |
433
- | `resizeable` | `boolean` | Allow user resizing (default `true`) |
434
- | `maxHeight` | `number` | Maximum height in px |
435
- | `maxWidth` | `number` | Maximum width in px |
436
- | `minHeight` | `number` | Minimum height in px |
437
- | `minWidth` | `number` | Minimum width in px |
438
- | `dynamicBounds` | `() => { x, y, width, height }` | Callback to recalculate position/size dynamically |
422
+ | Prop | Type | Description |
423
+ | --------------- | --------------------------------------------- | ------------------------------------------------- |
424
+ | `title` | `string` | Panel title bar text |
425
+ | `size` | `{ width: number, height: number \| 'auto' }` | Initial panel size |
426
+ | `modal` | `boolean` | Disable dragging and popout, center on screen |
427
+ | `resizeable` | `boolean` | Allow user resizing (default `true`) |
428
+ | `maxHeight` | `number` | Maximum height in px |
429
+ | `maxWidth` | `number` | Maximum width in px |
430
+ | `minHeight` | `number` | Minimum height in px |
431
+ | `minWidth` | `number` | Minimum width in px |
432
+ | `dynamicBounds` | `() => { x, y, width, height }` | Callback to recalculate position/size dynamically |
439
433
 
440
434
  **Saving panel state** — pass `panelStateOptions` to `PanelsContextProvider` or `OpenPanelButton`:
441
435
 
@@ -464,9 +458,7 @@ import { useState } from 'react';
464
458
  export const DockablePanel = ({ data }: { data: number }) => (
465
459
  <Panel title={`Panel demo ${data}`} size={{ width: 640, height: 400 }}>
466
460
  <PanelHeader dockTo={'leftSide'} />
467
- <PanelContent>
468
- {/* panel body content */}
469
- </PanelContent>
461
+ <PanelContent>{/* panel body content */}</PanelContent>
470
462
  </Panel>
471
463
  );
472
464
 
@@ -563,12 +555,17 @@ const PanelContents = () => {
563
555
 
564
556
  export const TestShowPanelWithGlobalModal = () => (
565
557
  <>
566
- <OpenPanelButton buttonText={'TestPanel 1'} componentFn={() => (
567
- <Panel title={'Panel demo 1'} size={{ width: 640, height: 400 }}>
568
- <PanelHeader icon={'ic_send'} onHelpClick={() => alert('Help!!!')} />
569
- <PanelContent><PanelContents /></PanelContent>
570
- </Panel>
571
- )} />
558
+ <OpenPanelButton
559
+ buttonText={'TestPanel 1'}
560
+ componentFn={() => (
561
+ <Panel title={'Panel demo 1'} size={{ width: 640, height: 400 }}>
562
+ <PanelHeader icon={'ic_send'} onHelpClick={() => alert('Help!!!')} />
563
+ <PanelContent>
564
+ <PanelContents />
565
+ </PanelContent>
566
+ </Panel>
567
+ )}
568
+ />
572
569
  </>
573
570
  );
574
571
  ```
@@ -586,111 +583,127 @@ A toolbar ribbon with buttons, sliders, menus, and separators. Supports horizont
586
583
 
587
584
  ```tsx
588
585
  import {
589
- RibbonButton,
590
- RibbonButtonLink,
591
- RibbonButtonOpenPanel,
592
- RibbonButtonSlider,
593
- RibbonContainer,
594
- RibbonSeparator,
595
- RibbonMenu,
596
- RibbonMenuOption,
597
- RibbonMenuSeparator,
598
- Panel,
599
- PanelContent,
600
- PanelHeader,
586
+ RibbonButton,
587
+ RibbonButtonLink,
588
+ RibbonButtonOpenPanel,
589
+ RibbonButtonSlider,
590
+ RibbonContainer,
591
+ RibbonSeparator,
592
+ RibbonMenu,
593
+ RibbonMenuOption,
594
+ RibbonMenuSeparator,
595
+ Panel,
596
+ PanelContent,
597
+ PanelHeader,
601
598
  } from '@linzjs/windows';
602
599
  import { useState } from 'react';
603
600
 
604
601
  export const TestRibbonPanel = () => {
605
- const [selectedItem, setSelectedItem] = useState('ic_add_rectangle');
606
- const [loading, setLoading] = useState(false);
607
- const [processing, setProcessing] = useState(false);
608
-
609
- return (
610
- <>
611
- <button onClick={() => setLoading(!loading)}>Toggle loading</button>
612
- <button onClick={() => setProcessing(!processing)}>Toggle processing</button>
613
-
614
- {/* Horizontal ribbon */}
615
- <RibbonContainer style={{ position: 'absolute', left: 220, top: 120 }}>
616
-
617
- {/* Button that opens a panel — disabled state */}
618
- <RibbonButtonOpenPanel
619
- disabled
620
- title={'Marks'}
621
- icon={'ic_marks'}
622
- componentFn={() => <Panel title="Marks" size={{ width: 640, height: 400 }}><PanelHeader /><PanelContent /></Panel>}
623
- loading={loading}
624
- />
625
-
626
- <RibbonSeparator />
627
-
628
- {/* Button that opens a panel — with processing indicator */}
629
- <RibbonButtonOpenPanel
630
- title={'Vectors'}
631
- icon={'ic_line_irregular'}
632
- componentFn={() => <Panel title="Vectors" size={{ width: 640, height: 400 }}><PanelHeader /><PanelContent /></Panel>}
633
- loading={loading}
634
- processing={processing}
635
- processingMessage={'Validating...'}
636
- />
637
-
638
- {/* Slider button — opens a sub-panel of options below */}
639
- <RibbonButtonSlider title={selectedItem} icon={selectedItem} alignment={'down'} loading={loading}>
640
- <RibbonContainer orientation={'vertical'}>
641
- <RibbonButton
642
- title={'Rectangle'}
643
- icon={'ic_add_rectangle'}
644
- selected={selectedItem === 'ic_add_rectangle'}
645
- onClick={() => setSelectedItem('ic_add_rectangle')}
646
- />
647
- <RibbonButton
648
- title={'Other'}
649
- icon={'ic_polygon_selection'}
650
- selected={selectedItem === 'ic_polygon_selection'}
651
- onClick={() => setSelectedItem('ic_polygon_selection')}
652
- />
653
- </RibbonContainer>
654
- </RibbonButtonSlider>
655
-
656
- {/* Slider button — dropdown menu with autoClose */}
657
- <RibbonButtonSlider title={'Other'} icon={'ic_more_vert'} alignment={'down'} autoClose={true} loading={loading}>
658
- <RibbonMenu>
659
- <RibbonMenuOption icon={'ic_define_nonprimary_diagram_circle'}>Circle</RibbonMenuOption>
660
- <RibbonMenuOption icon={'ic_define_nonprimary_diagram_rectangle'} disabled={true}>Rectangle</RibbonMenuOption>
661
- <RibbonMenuSeparator />
662
- <RibbonMenuOption>Item 3</RibbonMenuOption>
663
- <RibbonMenuSeparator />
664
- <RibbonMenuOption icon={'ic_clear'}>Cancel</RibbonMenuOption>
665
- </RibbonMenu>
666
- </RibbonButtonSlider>
667
- </RibbonContainer>
668
-
669
- {/* Vertical ribbon */}
670
- <RibbonContainer orientation={'vertical'} style={{ position: 'absolute', left: 220, top: 180 }}>
671
- <RibbonButtonOpenPanel
672
- title={'Vectors'}
673
- icon={'ic_timeline'}
674
- componentFn={() => <Panel title="Vectors" size={{ width: 640, height: 400 }}><PanelHeader /><PanelContent /></Panel>}
675
- loading={loading}
676
- />
677
- {/* Slider opens to the right */}
678
- <RibbonButtonSlider title={selectedItem} icon={selectedItem} alignment={'right'} loading={loading}>
679
- <RibbonContainer>
680
- <RibbonButton
681
- title={'Rectangle'}
682
- icon={'ic_add_rectangle'}
683
- selected={selectedItem === 'ic_add_rectangle'}
684
- onClick={() => setSelectedItem('ic_add_rectangle')}
685
- />
686
- </RibbonContainer>
687
- </RibbonButtonSlider>
688
- {/* External link button */}
689
- <RibbonButtonLink href={'https://example.com/'} icon={'ic_link'} loading={loading} />
690
- </RibbonContainer>
691
- </>
692
- );
602
+ const [selectedItem, setSelectedItem] = useState('ic_add_rectangle');
603
+ const [loading, setLoading] = useState(false);
604
+ const [processing, setProcessing] = useState(false);
605
+
606
+ return (
607
+ <>
608
+ <button onClick={() => setLoading(!loading)}>Toggle loading</button>
609
+ <button onClick={() => setProcessing(!processing)}>Toggle processing</button>
610
+
611
+ {/* Horizontal ribbon */}
612
+ <RibbonContainer style={{ position: 'absolute', left: 220, top: 120 }}>
613
+ {/* Button that opens a panel — disabled state */}
614
+ <RibbonButtonOpenPanel
615
+ disabled
616
+ title={'Marks'}
617
+ icon={'ic_marks'}
618
+ componentFn={() => (
619
+ <Panel title="Marks" size={{ width: 640, height: 400 }}>
620
+ <PanelHeader />
621
+ <PanelContent />
622
+ </Panel>
623
+ )}
624
+ loading={loading}
625
+ />
626
+
627
+ <RibbonSeparator />
628
+
629
+ {/* Button that opens a panel — with processing indicator */}
630
+ <RibbonButtonOpenPanel
631
+ title={'Vectors'}
632
+ icon={'ic_line_irregular'}
633
+ componentFn={() => (
634
+ <Panel title="Vectors" size={{ width: 640, height: 400 }}>
635
+ <PanelHeader />
636
+ <PanelContent />
637
+ </Panel>
638
+ )}
639
+ loading={loading}
640
+ processing={processing}
641
+ processingMessage={'Validating...'}
642
+ />
643
+
644
+ {/* Slider button — opens a sub-panel of options below */}
645
+ <RibbonButtonSlider title={selectedItem} icon={selectedItem} alignment={'down'} loading={loading}>
646
+ <RibbonContainer orientation={'vertical'}>
647
+ <RibbonButton
648
+ title={'Rectangle'}
649
+ icon={'ic_add_rectangle'}
650
+ selected={selectedItem === 'ic_add_rectangle'}
651
+ onClick={() => setSelectedItem('ic_add_rectangle')}
652
+ />
653
+ <RibbonButton
654
+ title={'Other'}
655
+ icon={'ic_polygon_selection'}
656
+ selected={selectedItem === 'ic_polygon_selection'}
657
+ onClick={() => setSelectedItem('ic_polygon_selection')}
658
+ />
659
+ </RibbonContainer>
660
+ </RibbonButtonSlider>
661
+
662
+ {/* Slider button — dropdown menu with autoClose */}
663
+ <RibbonButtonSlider title={'Other'} icon={'ic_more_vert'} alignment={'down'} autoClose={true} loading={loading}>
664
+ <RibbonMenu>
665
+ <RibbonMenuOption icon={'ic_define_nonprimary_diagram_circle'}>Circle</RibbonMenuOption>
666
+ <RibbonMenuOption icon={'ic_define_nonprimary_diagram_rectangle'} disabled={true}>
667
+ Rectangle
668
+ </RibbonMenuOption>
669
+ <RibbonMenuSeparator />
670
+ <RibbonMenuOption>Item 3</RibbonMenuOption>
671
+ <RibbonMenuSeparator />
672
+ <RibbonMenuOption icon={'ic_clear'}>Cancel</RibbonMenuOption>
673
+ </RibbonMenu>
674
+ </RibbonButtonSlider>
675
+ </RibbonContainer>
676
+
677
+ {/* Vertical ribbon */}
678
+ <RibbonContainer orientation={'vertical'} style={{ position: 'absolute', left: 220, top: 180 }}>
679
+ <RibbonButtonOpenPanel
680
+ title={'Vectors'}
681
+ icon={'ic_timeline'}
682
+ componentFn={() => (
683
+ <Panel title="Vectors" size={{ width: 640, height: 400 }}>
684
+ <PanelHeader />
685
+ <PanelContent />
686
+ </Panel>
687
+ )}
688
+ loading={loading}
689
+ />
690
+ {/* Slider opens to the right */}
691
+ <RibbonButtonSlider title={selectedItem} icon={selectedItem} alignment={'right'} loading={loading}>
692
+ <RibbonContainer>
693
+ <RibbonButton
694
+ title={'Rectangle'}
695
+ icon={'ic_add_rectangle'}
696
+ selected={selectedItem === 'ic_add_rectangle'}
697
+ onClick={() => setSelectedItem('ic_add_rectangle')}
698
+ />
699
+ </RibbonContainer>
700
+ </RibbonButtonSlider>
701
+ {/* External link button */}
702
+ <RibbonButtonLink href={'https://example.com/'} icon={'ic_link'} loading={loading} />
703
+ </RibbonContainer>
704
+ </>
705
+ );
693
706
  };
694
707
  ```
695
708
 
696
- **`RibbonButtonSlider` alignment options:** `'down'` | `'up'` | `'left'` | `'right'` | `'left-up'` | `'right-up'` | `'right-center'`
709
+ **`RibbonButtonSlider` alignment options:** `'down'` | `'up'` | `'left'` | `'right'` | `'left-up'` | `'right-up'` | `'right-center'`
@@ -1,11 +1,12 @@
1
- @use "@linzjs/lui/dist/scss/Foundation/Variables/ColorVars" as colors;
2
- @use "@linzjs/lui/dist/scss/Foundation/Utilities/BoxShadow" as shadow;
3
- @use "@linzjs/lui/dist/scss/Foundation/Variables/SpacingVars" as spacing;
4
- @use "@linzjs/lui/dist/scss/Foundation/Variables/FormVars" as form;
5
- @use "@linzjs/lui/dist/scss/Foundation/Variables/FontVars" as fonts;
6
- @use "@linzjs/lui/dist/scss/Foundation/Utilities/REM" as rem;
7
-
8
- dialog.LuiModalAsync, div.LuiModalAsync {
1
+ @use '@linzjs/lui/dist/scss/Foundation/Variables/ColorVars' as colors;
2
+ @use '@linzjs/lui/dist/scss/Foundation/Utilities/BoxShadow' as shadow;
3
+ @use '@linzjs/lui/dist/scss/Foundation/Variables/SpacingVars' as spacing;
4
+ @use '@linzjs/lui/dist/scss/Foundation/Variables/FormVars' as form;
5
+ @use '@linzjs/lui/dist/scss/Foundation/Variables/FontVars' as fonts;
6
+ @use '@linzjs/lui/dist/scss/Foundation/Utilities/REM' as rem;
7
+
8
+ dialog.LuiModalAsync,
9
+ div.LuiModalAsync {
9
10
  @include fonts.font-regular();
10
11
  font-size: fonts.$base-font-size;
11
12
  line-height: fonts.$base-line-height;
@@ -26,7 +27,8 @@ dialog.LuiModalAsync::backdrop {
26
27
  background: rgb(0 0 0 / 10%);
27
28
  }
28
29
 
29
- dialog.LuiModalAsync, div.LuiModalAsync {
30
+ dialog.LuiModalAsync,
31
+ div.LuiModalAsync {
30
32
  box-sizing: border-box;
31
33
 
32
34
  @include shadow.drop-shadow(sm);
@@ -1,4 +1,4 @@
1
- @use "@linzjs/lui/dist/scss/Foundation/Variables/ColorVars" as lui;
1
+ @use '@linzjs/lui/dist/scss/Foundation/Variables/ColorVars' as lui;
2
2
 
3
3
  .CopyToClipboard {
4
4
  cursor: pointer;
@@ -12,7 +12,9 @@
12
12
 
13
13
  .windows_tooltiptext {
14
14
  opacity: 0;
15
- transition: opacity 0.3s ease, width 0.3s ease;
15
+ transition:
16
+ opacity 0.3s ease,
17
+ width 0.3s ease;
16
18
  pointer-events: none;
17
19
  background-color: white;
18
20
  color: rgb(46 52 56);
@@ -26,11 +28,13 @@
26
28
 
27
29
  left: calc(100% + 8px);
28
30
  transform: translateY(42%);
29
- box-shadow: 0 2px 3px #00000040, 0 0 3px #00000026;
31
+ box-shadow:
32
+ 0 2px 3px #00000040,
33
+ 0 0 3px #00000026;
30
34
  }
31
35
 
32
36
  &:hover .windows_tooltiptext {
33
37
  visibility: visible;
34
38
  opacity: 1;
35
39
  }
36
- }
40
+ }
package/dist/index.js CHANGED
@@ -2253,50 +2253,6 @@ const LuiModalAsyncContextProvider = ({ children }) => {
2253
2253
  );
2254
2254
  };
2255
2255
 
2256
- const NoContext = () => {
2257
- console.error("Missing PanelContext Provider");
2258
- return void 0;
2259
- };
2260
- const PanelsContext = createContext({
2261
- openPanels: /* @__PURE__ */ new Set(),
2262
- hasOpenPanel: () => false,
2263
- openPanel: NoContext,
2264
- closePanel: NoContext,
2265
- hidePanel: NoContext,
2266
- hideAllPanels: NoContext,
2267
- unhidePanel: NoContext,
2268
- unhideAllPanels: NoContext,
2269
- hasHiddenPanel: NoContext,
2270
- bringPanelToFront: NoContext,
2271
- dockElements: {},
2272
- setDockElement: NoContext,
2273
- nextStackPosition: () => ({ x: 0, y: 0 })
2274
- });
2275
-
2276
- const OpenPanelButton = ({
2277
- buttonText,
2278
- testId,
2279
- uniqueId = buttonText,
2280
- ...openPanelOptions
2281
- }) => {
2282
- const { openPanel, closePanel, hidePanel, unhidePanel, hasOpenPanel, hasHiddenPanel } = useContext(PanelsContext);
2283
- const open = hasOpenPanel(uniqueId);
2284
- const hidden = hasHiddenPanel(uniqueId);
2285
- return /* @__PURE__ */ jsxs("div", { children: [
2286
- /* @__PURE__ */ jsxs("b", { children: [
2287
- buttonText,
2288
- " ",
2289
- open ? "(Open)" : ""
2290
- ] }),
2291
- /* @__PURE__ */ jsx("br", {}),
2292
- !open && /* @__PURE__ */ jsx("button", { "data-testid": testId + "Open", onClick: () => openPanel({ uniqueId, ...openPanelOptions }), children: "Open" }),
2293
- open && /* @__PURE__ */ jsxs(Fragment, { children: [
2294
- /* @__PURE__ */ jsx("button", { "data-testid": testId + "Close", onClick: () => closePanel(uniqueId), children: "Close" }),
2295
- hidden ? /* @__PURE__ */ jsx("button", { "data-testid": testId + "Unhide", onClick: () => unhidePanel(uniqueId), children: "Unhide" }) : /* @__PURE__ */ jsx("button", { "data-testid": testId + "Hide", onClick: () => hidePanel(uniqueId), children: "Hide" })
2296
- ] })
2297
- ] });
2298
- };
2299
-
2300
2256
  const NoContextError$1 = () => {
2301
2257
  console.error("Missing PanelInstanceContext Provider");
2302
2258
  };
@@ -2318,6 +2274,26 @@ const PanelInstanceContext = createContext({
2318
2274
  hidden: false
2319
2275
  });
2320
2276
 
2277
+ const NoContext = () => {
2278
+ console.error("Missing PanelContext Provider");
2279
+ return void 0;
2280
+ };
2281
+ const PanelsContext = createContext({
2282
+ openPanels: /* @__PURE__ */ new Set(),
2283
+ hasOpenPanel: () => false,
2284
+ openPanel: NoContext,
2285
+ closePanel: NoContext,
2286
+ hidePanel: NoContext,
2287
+ hideAllPanels: NoContext,
2288
+ unhidePanel: NoContext,
2289
+ unhideAllPanels: NoContext,
2290
+ hasHiddenPanel: NoContext,
2291
+ bringPanelToFront: NoContext,
2292
+ dockElements: {},
2293
+ setDockElement: NoContext,
2294
+ nextStackPosition: () => ({ x: 0, y: 0 })
2295
+ });
2296
+
2321
2297
  function getDefaultExportFromCjs (x) {
2322
2298
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
2323
2299
  }
@@ -8010,5 +7986,5 @@ const focusNextRibbonButton = () => {
8010
7986
  button?.focus();
8011
7987
  };
8012
7988
 
8013
- export { ButtonIconHorizontalGroup, ButtonIconSeparator, ButtonIconVerticalGroup, CopyableText, LuiModalAsync, LuiModalAsyncButtonContinue, LuiModalAsyncButtonDismiss, LuiModalAsyncButtonGroup, LuiModalAsyncContent, LuiModalAsyncContext, LuiModalAsyncContextProvider, LuiModalAsyncHeader, LuiModalAsyncInstanceContext, LuiModalAsyncMain, LuiModalDontShowSessionCheck, LuiModalDontShowSessionRemove, LuiModalDontShowSessionSet, LuiModalPrefab, LuiModalUpload, OpenPanelButton, OpenPanelIcon, Panel, PanelContent, PanelContext, PanelDock, PanelFooter, PanelHeader, PanelHeaderButton, PanelInline, PanelInstanceContext, PanelInstanceContextProvider, PanelsContext, PanelsContextProvider, RibbonButton, RibbonButtonLink, RibbonButtonOpenPanel, RibbonButtonSlider, RibbonButtonSliderContext, RibbonContainer, RibbonMenu, RibbonMenuContext, RibbonMenuOption, RibbonMenuSeparator, RibbonSeparator, getIconForLevel, openModalOnAllWindows, ribbonSliderAlignments, tabToNextSiblingElement, tabToPreviousSiblingElement, tabToSiblingElement, useConstFunction, useLuiModalPrefab, useLuiModalUpload, useShowAsyncModal };
7989
+ export { ButtonIconHorizontalGroup, ButtonIconSeparator, ButtonIconVerticalGroup, CopyableText, LuiModalAsync, LuiModalAsyncButtonContinue, LuiModalAsyncButtonDismiss, LuiModalAsyncButtonGroup, LuiModalAsyncContent, LuiModalAsyncContext, LuiModalAsyncContextProvider, LuiModalAsyncHeader, LuiModalAsyncInstanceContext, LuiModalAsyncMain, LuiModalDontShowSessionCheck, LuiModalDontShowSessionRemove, LuiModalDontShowSessionSet, LuiModalPrefab, LuiModalUpload, OpenPanelIcon, Panel, PanelContent, PanelContext, PanelDock, PanelFooter, PanelHeader, PanelHeaderButton, PanelInline, PanelInstanceContext, PanelInstanceContextProvider, PanelsContext, PanelsContextProvider, RibbonButton, RibbonButtonLink, RibbonButtonOpenPanel, RibbonButtonSlider, RibbonButtonSliderContext, RibbonContainer, RibbonMenu, RibbonMenuContext, RibbonMenuOption, RibbonMenuSeparator, RibbonSeparator, getIconForLevel, openModalOnAllWindows, ribbonSliderAlignments, tabToNextSiblingElement, tabToPreviousSiblingElement, tabToSiblingElement, useConstFunction, useLuiModalPrefab, useLuiModalUpload, useShowAsyncModal };
8014
7990
  //# sourceMappingURL=index.js.map