@equinor/cpl-feature-flag-react 2.0.9 → 2.1.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/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as react from 'react';
2
2
  import { PropsWithChildren } from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
3
 
5
4
  type BaseConfig<Key extends string, Env extends string> = Record<Key, Record<Env, boolean>>;
6
5
  type inferFeatureFlagKey<T extends BaseConfig<string, string>> = keyof T;
@@ -19,10 +18,10 @@ interface Props<Key extends string, Env extends string> {
19
18
  useCurrentEnvironment: () => string | undefined;
20
19
  }
21
20
  declare function buildFeatureFlagModule<Env extends string, Key extends string>({ config, storage, storageKey, environments, useCurrentEnvironment, }: Props<Key, Env>): {
22
- FeatureFlagProvider: ({ children }: PropsWithChildren) => react_jsx_runtime.JSX.Element;
21
+ FeatureFlagProvider: ({ children }: PropsWithChildren) => react.JSX.Element;
23
22
  useFeatureFlagValue: (featureFlagKey: Key) => boolean;
24
23
  useSetFeatureFlag: (featureFlagKey: Key) => (newValue: boolean) => void;
25
- DevPanel: () => react_jsx_runtime.JSX.Element;
24
+ DevPanel: () => react.JSX.Element;
26
25
  FeatureFlag: ({ featureFlagKey, showWhen, children, }: PropsWithChildren<{
27
26
  showWhen: "enabled" | "disabled";
28
27
  featureFlagKey: Key;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as react from 'react';
2
2
  import { PropsWithChildren } from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
3
 
5
4
  type BaseConfig<Key extends string, Env extends string> = Record<Key, Record<Env, boolean>>;
6
5
  type inferFeatureFlagKey<T extends BaseConfig<string, string>> = keyof T;
@@ -19,10 +18,10 @@ interface Props<Key extends string, Env extends string> {
19
18
  useCurrentEnvironment: () => string | undefined;
20
19
  }
21
20
  declare function buildFeatureFlagModule<Env extends string, Key extends string>({ config, storage, storageKey, environments, useCurrentEnvironment, }: Props<Key, Env>): {
22
- FeatureFlagProvider: ({ children }: PropsWithChildren) => react_jsx_runtime.JSX.Element;
21
+ FeatureFlagProvider: ({ children }: PropsWithChildren) => react.JSX.Element;
23
22
  useFeatureFlagValue: (featureFlagKey: Key) => boolean;
24
23
  useSetFeatureFlag: (featureFlagKey: Key) => (newValue: boolean) => void;
25
- DevPanel: () => react_jsx_runtime.JSX.Element;
24
+ DevPanel: () => react.JSX.Element;
26
25
  FeatureFlag: ({ featureFlagKey, showWhen, children, }: PropsWithChildren<{
27
26
  showWhen: "enabled" | "disabled";
28
27
  featureFlagKey: Key;
package/dist/index.js CHANGED
@@ -193,7 +193,7 @@ function DevPanelPure({
193
193
  return Object.keys(featureFlagConfig);
194
194
  }, [featureFlagConfig]);
195
195
  const currentEnvironment = useCurrentEnvironment();
196
- if (!currentEnvironment || currentEnvironment !== "dev") {
196
+ if (!currentEnvironment || !["dev", "local"].includes(currentEnvironment)) {
197
197
  return null;
198
198
  }
199
199
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_eds_core_react2.EdsProvider, { density: "compact", children: [
@@ -211,30 +211,41 @@ function DevPanelPure({
211
211
  ]
212
212
  }
213
213
  ),
214
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_eds_core_react2.Popover, { open: isOpen, anchorEl: buttonRef.current, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(StyledPopoverContent, { children: [
215
- featureFlagKeys.map((featureFlagKey) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
216
- FeatureFlagItem,
217
- {
218
- featureFlagKey,
219
- useFeatureFlagValue,
220
- useSetFeatureFlag
221
- },
222
- `feature-flag-item-${featureFlagKey}`
223
- )),
224
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
225
- import_eds_core_react2.Button,
226
- {
227
- variant: "ghost",
228
- color: "danger",
229
- onClick: () => {
230
- localStorage.clear();
231
- sessionStorage.clear();
232
- window.location.reload();
233
- },
234
- children: "Delete cache and reload"
235
- }
236
- )
237
- ] }) })
214
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
215
+ import_eds_core_react2.Popover,
216
+ {
217
+ open: isOpen,
218
+ anchorEl: (
219
+ // eslint-disable-next-line react-hooks/refs -- current EDS implementation
220
+ buttonRef.current
221
+ ),
222
+ onClose: handleClose,
223
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(StyledPopoverContent, { children: [
224
+ featureFlagKeys.map((featureFlagKey) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
225
+ FeatureFlagItem,
226
+ {
227
+ featureFlagKey,
228
+ useFeatureFlagValue,
229
+ useSetFeatureFlag
230
+ },
231
+ `feature-flag-item-${featureFlagKey}`
232
+ )),
233
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
234
+ import_eds_core_react2.Button,
235
+ {
236
+ variant: "ghost",
237
+ color: "danger",
238
+ onClick: () => {
239
+ localStorage.clear();
240
+ sessionStorage.clear();
241
+ window.location.reload();
242
+ },
243
+ children: "Delete cache and reload"
244
+ }
245
+ )
246
+ ] })
247
+ }
248
+ )
238
249
  ] }) });
239
250
  }
240
251
  var StyledButton = (0, import_styled_components2.default)(import_eds_core_react2.Button)`
package/dist/index.mjs CHANGED
@@ -157,7 +157,7 @@ function DevPanelPure({
157
157
  return Object.keys(featureFlagConfig);
158
158
  }, [featureFlagConfig]);
159
159
  const currentEnvironment = useCurrentEnvironment();
160
- if (!currentEnvironment || currentEnvironment !== "dev") {
160
+ if (!currentEnvironment || !["dev", "local"].includes(currentEnvironment)) {
161
161
  return null;
162
162
  }
163
163
  return /* @__PURE__ */ jsx3(Fragment, { children: /* @__PURE__ */ jsxs(EdsProvider, { density: "compact", children: [
@@ -175,30 +175,41 @@ function DevPanelPure({
175
175
  ]
176
176
  }
177
177
  ),
178
- /* @__PURE__ */ jsx3(Popover, { open: isOpen, anchorEl: buttonRef.current, onClose: handleClose, children: /* @__PURE__ */ jsxs(StyledPopoverContent, { children: [
179
- featureFlagKeys.map((featureFlagKey) => /* @__PURE__ */ jsx3(
180
- FeatureFlagItem,
181
- {
182
- featureFlagKey,
183
- useFeatureFlagValue,
184
- useSetFeatureFlag
185
- },
186
- `feature-flag-item-${featureFlagKey}`
187
- )),
188
- /* @__PURE__ */ jsx3(
189
- Button,
190
- {
191
- variant: "ghost",
192
- color: "danger",
193
- onClick: () => {
194
- localStorage.clear();
195
- sessionStorage.clear();
196
- window.location.reload();
197
- },
198
- children: "Delete cache and reload"
199
- }
200
- )
201
- ] }) })
178
+ /* @__PURE__ */ jsx3(
179
+ Popover,
180
+ {
181
+ open: isOpen,
182
+ anchorEl: (
183
+ // eslint-disable-next-line react-hooks/refs -- current EDS implementation
184
+ buttonRef.current
185
+ ),
186
+ onClose: handleClose,
187
+ children: /* @__PURE__ */ jsxs(StyledPopoverContent, { children: [
188
+ featureFlagKeys.map((featureFlagKey) => /* @__PURE__ */ jsx3(
189
+ FeatureFlagItem,
190
+ {
191
+ featureFlagKey,
192
+ useFeatureFlagValue,
193
+ useSetFeatureFlag
194
+ },
195
+ `feature-flag-item-${featureFlagKey}`
196
+ )),
197
+ /* @__PURE__ */ jsx3(
198
+ Button,
199
+ {
200
+ variant: "ghost",
201
+ color: "danger",
202
+ onClick: () => {
203
+ localStorage.clear();
204
+ sessionStorage.clear();
205
+ window.location.reload();
206
+ },
207
+ children: "Delete cache and reload"
208
+ }
209
+ )
210
+ ] })
211
+ }
212
+ )
202
213
  ] }) });
203
214
  }
204
215
  var StyledButton = styled2(Button)`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/cpl-feature-flag-react",
3
- "version": "2.0.9",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -16,17 +16,17 @@
16
16
  "dist/**"
17
17
  ],
18
18
  "devDependencies": {
19
- "@equinor/eds-core-react": "2.3.5",
20
- "@storybook/react-vite": "10.2.10",
21
- "@types/react": "19.2.14",
19
+ "@equinor/eds-core-react": "2.6.1",
20
+ "@storybook/react-vite": "10.4.3",
21
+ "@types/react": "19.2.17",
22
22
  "@types/react-dom": "19.2.3",
23
23
  "@types/styled-components": "5.1.36",
24
- "eslint": "10.0.0",
25
- "react": "19.2.4",
26
- "react-dom": "19.2.4",
27
- "styled-components": "6.4.1",
24
+ "eslint": "10.4.1",
25
+ "react": "19.2.7",
26
+ "react-dom": "19.2.7",
27
+ "styled-components": "6.4.2",
28
28
  "tsup": "8.5.1",
29
- "@equinor/cpl-eslint-config": "1.0.10",
29
+ "@equinor/cpl-eslint-config": "1.0.11",
30
30
  "@equinor/cpl-typescript-config": "0.0.8"
31
31
  },
32
32
  "peerDependencies": {
@@ -39,8 +39,8 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@equinor/eds-icons": "1.2.2",
43
- "@equinor/eds-tokens": "2.2.0"
42
+ "@equinor/eds-icons": "1.5.0",
43
+ "@equinor/eds-tokens": "2.3.0"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsup src/index.ts --format esm,cjs --dts --external react",