@ttoss/geovis-workspace 0.2.6 → 0.2.8

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
@@ -96,10 +96,17 @@ its own group. Read the current selection anywhere inside the workspace with
96
96
 
97
97
  ### `GeovisWorkspaceConfig`
98
98
 
99
- | Property | Type | Description |
100
- | -------------- | ---------------------------------- | -------------------------------------- |
101
- | `leftSidebar` | `{ menus: GeovisWorkspaceMenu[] }` | Left sidebar config. Omit to hide it. |
102
- | `rightSidebar` | `GeovisWorkspaceRightSidebar` | Right sidebar config. Omit to hide it. |
99
+ | Property | Type | Description |
100
+ | -------------- | ----------------------------- | -------------------------------------- |
101
+ | `leftSidebar` | `GeovisWorkspaceLeftSidebar` | Left sidebar config. Omit to hide it. |
102
+ | `rightSidebar` | `GeovisWorkspaceRightSidebar` | Right sidebar config. Omit to hide it. |
103
+
104
+ ### `GeovisWorkspaceLeftSidebar`
105
+
106
+ | Property | Type | Description |
107
+ | -------------- | ----------------------- | -------------------------------------------------------- |
108
+ | `menus` | `GeovisWorkspaceMenu[]` | Menu groups rendered in the sidebar. |
109
+ | `initialState` | `'open' \| 'closed'` | Whether the sidebar starts open. Defaults to `'closed'`. |
103
110
 
104
111
  ### `GeovisWorkspaceMenu`
105
112
 
@@ -112,10 +119,11 @@ its own group. Read the current selection anywhere inside the workspace with
112
119
 
113
120
  ### `GeovisWorkspaceRightSidebar`
114
121
 
115
- | Property | Type | Description |
116
- | ----------------- | -------------------------------- | -------------------------------------- |
117
- | `title` | `string` | Title shown at the top of the sidebar. |
118
- | `legendWithColor` | `GeovisWorkspaceLegendWithColor` | Color-legend panel. Omit to hide it. |
122
+ | Property | Type | Description |
123
+ | ----------------- | -------------------------------- | -------------------------------------------------------- |
124
+ | `title` | `string` | Title shown at the top of the sidebar. |
125
+ | `legendWithColor` | `GeovisWorkspaceLegendWithColor` | Color-legend panel. Omit to hide it. |
126
+ | `initialState` | `'open' \| 'closed'` | Whether the sidebar starts open. Defaults to `'closed'`. |
119
127
 
120
128
  ### `GeovisWorkspaceLegendWithColor`
121
129
 
package/dist/index.cjs CHANGED
@@ -598,8 +598,12 @@ var GeovisWorkspaceProvider = ({
598
598
  });
599
599
  });
600
600
  const currentSelection = isControlled ? selection : internalSelection;
601
- const [isLeftSidebarOpen, setIsLeftSidebarOpen] = react.useState(false);
602
- const [isRightSidebarOpen, setIsRightSidebarOpen] = react.useState(false);
601
+ const [isLeftSidebarOpen, setIsLeftSidebarOpen] = react.useState(() => {
602
+ return config.leftSidebar?.initialState === "open";
603
+ });
604
+ const [isRightSidebarOpen, setIsRightSidebarOpen] = react.useState(() => {
605
+ return config.rightSidebar?.initialState === "open";
606
+ });
603
607
  const setSelection = react.useCallback(({
604
608
  menuId,
605
609
  value
package/dist/index.d.cts CHANGED
@@ -22,6 +22,8 @@ interface GeovisWorkspaceMenu {
22
22
  interface GeovisWorkspaceLeftSidebar {
23
23
  /** Menu groups rendered in the left sidebar. */
24
24
  menus: GeovisWorkspaceMenu[];
25
+ /** Whether the sidebar starts open or closed. Defaults to `'closed'`. */
26
+ initialState?: 'open' | 'closed';
25
27
  }
26
28
  interface GeovisWorkspaceLegendItem {
27
29
  /** Swatch fill color (any CSS color string or theme color token). */
@@ -60,6 +62,8 @@ interface GeovisWorkspaceRightSidebar {
60
62
  title?: string;
61
63
  /** Color legend panel: description, class swatches and data sources. */
62
64
  legendWithColor?: GeovisWorkspaceLegendWithColor;
65
+ /** Whether the sidebar starts open or closed. Defaults to `'closed'`. */
66
+ initialState?: 'open' | 'closed';
63
67
  }
64
68
  interface GeovisWorkspaceConfig {
65
69
  /** Configuration for the left sidebar. Omit to hide it entirely. */
package/dist/index.d.mts CHANGED
@@ -22,6 +22,8 @@ interface GeovisWorkspaceMenu {
22
22
  interface GeovisWorkspaceLeftSidebar {
23
23
  /** Menu groups rendered in the left sidebar. */
24
24
  menus: GeovisWorkspaceMenu[];
25
+ /** Whether the sidebar starts open or closed. Defaults to `'closed'`. */
26
+ initialState?: 'open' | 'closed';
25
27
  }
26
28
  interface GeovisWorkspaceLegendItem {
27
29
  /** Swatch fill color (any CSS color string or theme color token). */
@@ -60,6 +62,8 @@ interface GeovisWorkspaceRightSidebar {
60
62
  title?: string;
61
63
  /** Color legend panel: description, class swatches and data sources. */
62
64
  legendWithColor?: GeovisWorkspaceLegendWithColor;
65
+ /** Whether the sidebar starts open or closed. Defaults to `'closed'`. */
66
+ initialState?: 'open' | 'closed';
63
67
  }
64
68
  interface GeovisWorkspaceConfig {
65
69
  /** Configuration for the left sidebar. Omit to hide it entirely. */
package/dist/index.mjs CHANGED
@@ -584,8 +584,12 @@ var GeovisWorkspaceProvider = ({
584
584
  });
585
585
  });
586
586
  const currentSelection = isControlled ? selection : internalSelection;
587
- const [isLeftSidebarOpen, setIsLeftSidebarOpen] = React.useState(false);
588
- const [isRightSidebarOpen, setIsRightSidebarOpen] = React.useState(false);
587
+ const [isLeftSidebarOpen, setIsLeftSidebarOpen] = React.useState(() => {
588
+ return config.leftSidebar?.initialState === "open";
589
+ });
590
+ const [isRightSidebarOpen, setIsRightSidebarOpen] = React.useState(() => {
591
+ return config.rightSidebar?.initialState === "open";
592
+ });
589
593
  const setSelection = React.useCallback(({
590
594
  menuId,
591
595
  value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/geovis-workspace",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "React component that combines a menu and canvas map interactions.",
5
5
  "keywords": [
6
6
  "react",
@@ -38,17 +38,17 @@
38
38
  "react": "^19.2.6",
39
39
  "tsdown": "^0.22.2",
40
40
  "@ttoss/config": "^1.37.17",
41
- "@ttoss/test-utils": "^4.2.18",
42
- "@ttoss/geovis": "^0.8.0",
43
41
  "@ttoss/i18n-cli": "^0.8.17",
42
+ "@ttoss/geovis": "^0.8.2",
43
+ "@ttoss/test-utils": "^4.2.18",
44
44
  "@ttoss/react-i18n": "^2.3.0",
45
45
  "@ttoss/ui": "^6.9.28"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "react": ">=16.8.0",
49
- "@ttoss/geovis": "^0.8.0",
50
- "@ttoss/react-i18n": "^2.3.0",
51
- "@ttoss/ui": "^6.9.28"
49
+ "@ttoss/geovis": "^0.8.2",
50
+ "@ttoss/ui": "^6.9.28",
51
+ "@ttoss/react-i18n": "^2.3.0"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public",