@equinor/cpl-feature-flag-react 2.0.5 → 2.0.7
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.js +20 -3
- package/dist/index.mjs +20 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -140,6 +140,7 @@ function buildReducer(storage, storageKey) {
|
|
|
140
140
|
// src/components/buildDevPanel.tsx
|
|
141
141
|
var import_eds_core_react2 = require("@equinor/eds-core-react");
|
|
142
142
|
var import_eds_icons = require("@equinor/eds-icons");
|
|
143
|
+
var import_eds_tokens2 = require("@equinor/eds-tokens");
|
|
143
144
|
var import_react3 = require("react");
|
|
144
145
|
var import_styled_components2 = __toESM(require("styled-components"));
|
|
145
146
|
|
|
@@ -197,14 +198,13 @@ function DevPanelPure({
|
|
|
197
198
|
}
|
|
198
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: [
|
|
199
200
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
200
|
-
|
|
201
|
+
StyledButton,
|
|
201
202
|
{
|
|
202
203
|
"aria-haspopup": true,
|
|
203
204
|
variant: "ghost",
|
|
204
205
|
"aria-expanded": isOpen,
|
|
205
206
|
ref: buttonRef,
|
|
206
207
|
onClick: handleToggle,
|
|
207
|
-
style: { color: "#3d3d3d" },
|
|
208
208
|
children: [
|
|
209
209
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_eds_core_react2.Icon, { data: import_eds_icons.arrow_drop_down }),
|
|
210
210
|
"DEV PANEL"
|
|
@@ -237,6 +237,17 @@ function DevPanelPure({
|
|
|
237
237
|
] }) })
|
|
238
238
|
] }) });
|
|
239
239
|
}
|
|
240
|
+
var StyledButton = (0, import_styled_components2.default)(import_eds_core_react2.Button)`
|
|
241
|
+
color: ${import_eds_tokens2.tokens.colors.text.static_icons__default.rgba};
|
|
242
|
+
font-size: 12px;
|
|
243
|
+
margin: -8px 0;
|
|
244
|
+
padding-left: 4px;
|
|
245
|
+
padding-right: 8px;
|
|
246
|
+
|
|
247
|
+
& > span {
|
|
248
|
+
gap: 0;
|
|
249
|
+
}
|
|
250
|
+
`;
|
|
240
251
|
var StyledPopoverContent = (0, import_styled_components2.default)(import_eds_core_react2.Popover.Content)`
|
|
241
252
|
background-color: var(--cpl-ui-background-temporary-nav);
|
|
242
253
|
display: flex;
|
|
@@ -261,10 +272,16 @@ function buildFeatureFlagModule({
|
|
|
261
272
|
const useFeatureFlagValue = (featureFlagKey) => {
|
|
262
273
|
const currentEnvironment = useCurrentEnvironment();
|
|
263
274
|
const featureFlagConfig = useFeatureFlagConfig();
|
|
275
|
+
const configOverridesFromLocalStorage = getFeatureFlagConfigFromSessionStorage(
|
|
276
|
+
storage,
|
|
277
|
+
storageKey
|
|
278
|
+
);
|
|
264
279
|
if (!isValidEnvironment(environments, currentEnvironment)) {
|
|
265
280
|
return false;
|
|
266
281
|
}
|
|
267
|
-
return Boolean(
|
|
282
|
+
return Boolean(
|
|
283
|
+
configOverridesFromLocalStorage?.[featureFlagKey] ?? featureFlagConfig[featureFlagKey][currentEnvironment]
|
|
284
|
+
);
|
|
268
285
|
};
|
|
269
286
|
function FeatureFlag({
|
|
270
287
|
featureFlagKey,
|
package/dist/index.mjs
CHANGED
|
@@ -104,6 +104,7 @@ function buildReducer(storage, storageKey) {
|
|
|
104
104
|
// src/components/buildDevPanel.tsx
|
|
105
105
|
import { Button, EdsProvider, Icon, Popover } from "@equinor/eds-core-react";
|
|
106
106
|
import { arrow_drop_down } from "@equinor/eds-icons";
|
|
107
|
+
import { tokens as tokens2 } from "@equinor/eds-tokens";
|
|
107
108
|
import { useCallback as useCallback2, useMemo, useRef, useState } from "react";
|
|
108
109
|
import styled2 from "styled-components";
|
|
109
110
|
|
|
@@ -161,14 +162,13 @@ function DevPanelPure({
|
|
|
161
162
|
}
|
|
162
163
|
return /* @__PURE__ */ jsx3(Fragment, { children: /* @__PURE__ */ jsxs(EdsProvider, { density: "compact", children: [
|
|
163
164
|
/* @__PURE__ */ jsxs(
|
|
164
|
-
|
|
165
|
+
StyledButton,
|
|
165
166
|
{
|
|
166
167
|
"aria-haspopup": true,
|
|
167
168
|
variant: "ghost",
|
|
168
169
|
"aria-expanded": isOpen,
|
|
169
170
|
ref: buttonRef,
|
|
170
171
|
onClick: handleToggle,
|
|
171
|
-
style: { color: "#3d3d3d" },
|
|
172
172
|
children: [
|
|
173
173
|
/* @__PURE__ */ jsx3(Icon, { data: arrow_drop_down }),
|
|
174
174
|
"DEV PANEL"
|
|
@@ -201,6 +201,17 @@ function DevPanelPure({
|
|
|
201
201
|
] }) })
|
|
202
202
|
] }) });
|
|
203
203
|
}
|
|
204
|
+
var StyledButton = styled2(Button)`
|
|
205
|
+
color: ${tokens2.colors.text.static_icons__default.rgba};
|
|
206
|
+
font-size: 12px;
|
|
207
|
+
margin: -8px 0;
|
|
208
|
+
padding-left: 4px;
|
|
209
|
+
padding-right: 8px;
|
|
210
|
+
|
|
211
|
+
& > span {
|
|
212
|
+
gap: 0;
|
|
213
|
+
}
|
|
214
|
+
`;
|
|
204
215
|
var StyledPopoverContent = styled2(Popover.Content)`
|
|
205
216
|
background-color: var(--cpl-ui-background-temporary-nav);
|
|
206
217
|
display: flex;
|
|
@@ -225,10 +236,16 @@ function buildFeatureFlagModule({
|
|
|
225
236
|
const useFeatureFlagValue = (featureFlagKey) => {
|
|
226
237
|
const currentEnvironment = useCurrentEnvironment();
|
|
227
238
|
const featureFlagConfig = useFeatureFlagConfig();
|
|
239
|
+
const configOverridesFromLocalStorage = getFeatureFlagConfigFromSessionStorage(
|
|
240
|
+
storage,
|
|
241
|
+
storageKey
|
|
242
|
+
);
|
|
228
243
|
if (!isValidEnvironment(environments, currentEnvironment)) {
|
|
229
244
|
return false;
|
|
230
245
|
}
|
|
231
|
-
return Boolean(
|
|
246
|
+
return Boolean(
|
|
247
|
+
configOverridesFromLocalStorage?.[featureFlagKey] ?? featureFlagConfig[featureFlagKey][currentEnvironment]
|
|
248
|
+
);
|
|
232
249
|
};
|
|
233
250
|
function FeatureFlag({
|
|
234
251
|
featureFlagKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/cpl-feature-flag-react",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@equinor/eds-core-react": "2.3.5",
|
|
20
|
-
"@storybook/react-vite": "10.2.
|
|
20
|
+
"@storybook/react-vite": "10.2.10",
|
|
21
21
|
"@types/react": "19.2.14",
|
|
22
22
|
"@types/react-dom": "19.2.3",
|
|
23
23
|
"@types/styled-components": "5.1.36",
|