@bigbinary/neeto-commons-frontend 4.13.154 → 4.13.156
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/.ready +1 -1
- package/dist/cjs/react-utils/OnlyInDevelopment/OnlyInDevelopment.js +63 -0
- package/dist/cjs/react-utils/OnlyInDevelopment/OnlyInDevelopment.js.map +1 -0
- package/dist/cjs/react-utils/OnlyInDevelopment/constants.js +31 -0
- package/dist/cjs/react-utils/OnlyInDevelopment/constants.js.map +1 -0
- package/dist/cjs/react-utils/OnlyInDevelopment/index.js +12 -0
- package/dist/cjs/react-utils/OnlyInDevelopment/index.js.map +1 -0
- package/dist/cjs/react-utils/OnlyInDevelopment/utils.js +32 -0
- package/dist/cjs/react-utils/OnlyInDevelopment/utils.js.map +1 -0
- package/dist/cjs/react-utils/index.js +4 -0
- package/dist/cjs/react-utils/index.js.map +1 -1
- package/dist/cjs/v2/react-utils/OnlyInDevelopment/OnlyInDevelopment.js +63 -0
- package/dist/cjs/v2/react-utils/OnlyInDevelopment/OnlyInDevelopment.js.map +1 -0
- package/dist/cjs/v2/react-utils/OnlyInDevelopment/constants.js +31 -0
- package/dist/cjs/v2/react-utils/OnlyInDevelopment/constants.js.map +1 -0
- package/dist/cjs/v2/react-utils/OnlyInDevelopment/index.js +12 -0
- package/dist/cjs/v2/react-utils/OnlyInDevelopment/index.js.map +1 -0
- package/dist/cjs/v2/react-utils/OnlyInDevelopment/utils.js +32 -0
- package/dist/cjs/v2/react-utils/OnlyInDevelopment/utils.js.map +1 -0
- package/dist/cjs/v2/react-utils/index.js +4 -0
- package/dist/cjs/v2/react-utils/index.js.map +1 -1
- package/dist/react-utils/OnlyInDevelopment/OnlyInDevelopment.js +61 -0
- package/dist/react-utils/OnlyInDevelopment/OnlyInDevelopment.js.map +1 -0
- package/dist/react-utils/OnlyInDevelopment/constants.js +27 -0
- package/dist/react-utils/OnlyInDevelopment/constants.js.map +1 -0
- package/dist/react-utils/OnlyInDevelopment/index.js +6 -0
- package/dist/react-utils/OnlyInDevelopment/index.js.map +1 -0
- package/dist/react-utils/OnlyInDevelopment/utils.js +30 -0
- package/dist/react-utils/OnlyInDevelopment/utils.js.map +1 -0
- package/dist/react-utils/index.js +3 -0
- package/dist/react-utils/index.js.map +1 -1
- package/dist/v2/react-utils/OnlyInDevelopment/OnlyInDevelopment.js +61 -0
- package/dist/v2/react-utils/OnlyInDevelopment/OnlyInDevelopment.js.map +1 -0
- package/dist/v2/react-utils/OnlyInDevelopment/constants.js +27 -0
- package/dist/v2/react-utils/OnlyInDevelopment/constants.js.map +1 -0
- package/dist/v2/react-utils/OnlyInDevelopment/index.js +6 -0
- package/dist/v2/react-utils/OnlyInDevelopment/index.js.map +1 -0
- package/dist/v2/react-utils/OnlyInDevelopment/utils.js +30 -0
- package/dist/v2/react-utils/OnlyInDevelopment/utils.js.map +1 -0
- package/dist/v2/react-utils/index.js +3 -0
- package/dist/v2/react-utils/index.js.map +1 -1
- package/package.json +1 -1
- package/react-utils.d.ts +63 -0
package/dist/.ready
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Built at 2026-
|
|
1
|
+
Built at 2026-09-03T12:49:46.029Z
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactUtils_OnlyInDevelopment_constants = require('./constants.js');
|
|
5
|
+
var reactUtils_OnlyInDevelopment_utils = require('./utils.js');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
var OnlyInDevelopment = function OnlyInDevelopment(_ref) {
|
|
9
|
+
var title = _ref.title,
|
|
10
|
+
description = _ref.description,
|
|
11
|
+
children = _ref.children;
|
|
12
|
+
if (!reactUtils_OnlyInDevelopment_utils.isDevelopment()) return null;
|
|
13
|
+
var accent = reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.accent,
|
|
14
|
+
fill = reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.fill,
|
|
15
|
+
heading = reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.heading,
|
|
16
|
+
body = reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.body,
|
|
17
|
+
rule = reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.rule;
|
|
18
|
+
|
|
19
|
+
// `Children.toArray` drops null, undefined and booleans and flattens
|
|
20
|
+
// arrays, so a caller that maps an empty list into the slot gets no rule
|
|
21
|
+
// and no empty gap beneath the copy. (An empty fragment still counts as
|
|
22
|
+
// one child; there is no way to see inside it without rendering.)
|
|
23
|
+
var hasChildren = React.Children.toArray(children).length > 0;
|
|
24
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
25
|
+
className: "flex items-start gap-3 rounded border-2 border-dashed px-5 py-4",
|
|
26
|
+
style: {
|
|
27
|
+
borderColor: accent,
|
|
28
|
+
backgroundColor: fill
|
|
29
|
+
},
|
|
30
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white",
|
|
33
|
+
style: {
|
|
34
|
+
backgroundColor: accent
|
|
35
|
+
},
|
|
36
|
+
children: "!"
|
|
37
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
38
|
+
className: "flex min-w-0 flex-col gap-1.5",
|
|
39
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
40
|
+
className: "text-sm font-bold",
|
|
41
|
+
style: {
|
|
42
|
+
color: heading
|
|
43
|
+
},
|
|
44
|
+
children: title !== null && title !== void 0 ? title : reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_TITLE
|
|
45
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
46
|
+
className: "m-0 max-w-[76ch] text-sm leading-relaxed",
|
|
47
|
+
style: {
|
|
48
|
+
color: body
|
|
49
|
+
},
|
|
50
|
+
children: description !== null && description !== void 0 ? description : reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_DESCRIPTION
|
|
51
|
+
}), hasChildren && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
52
|
+
className: "mt-2 border-t pt-3",
|
|
53
|
+
style: {
|
|
54
|
+
borderColor: rule
|
|
55
|
+
},
|
|
56
|
+
children: children
|
|
57
|
+
})]
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
module.exports = OnlyInDevelopment;
|
|
63
|
+
//# sourceMappingURL=OnlyInDevelopment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnlyInDevelopment.js","sources":["../../../../src/react-utils/OnlyInDevelopment/OnlyInDevelopment.jsx"],"sourcesContent":["import { Children } from \"react\";\n\nimport PropTypes from \"prop-types\";\n\nimport {\n ONLY_IN_DEVELOPMENT_COLORS,\n ONLY_IN_DEVELOPMENT_DESCRIPTION,\n ONLY_IN_DEVELOPMENT_TITLE,\n} from \"./constants\";\nimport { isDevelopment } from \"./utils\";\n\n// Renders nothing at all outside development, so a caller never guards its\n// own usage: wrapping *is* the guard. `children` is the action slot beneath\n// the rule, where the design puts its secondary block.\n//\n// Guarded is not the same as absent: whatever you wrap still ships in the\n// host's bundle, it just never renders. `utils.js` has the details.\n//\n// Pairs with `Rails.env.development?` on the server. Both sides check — see\n// `utils.js` for why one signal is not enough.\nconst OnlyInDevelopment = ({ title, description, children }) => {\n if (!isDevelopment()) return null;\n\n const { accent, fill, heading, body, rule } = ONLY_IN_DEVELOPMENT_COLORS;\n\n // `Children.toArray` drops null, undefined and booleans and flattens\n // arrays, so a caller that maps an empty list into the slot gets no rule\n // and no empty gap beneath the copy. (An empty fragment still counts as\n // one child; there is no way to see inside it without rendering.)\n const hasChildren = Children.toArray(children).length > 0;\n\n return (\n <div\n className=\"flex items-start gap-3 rounded border-2 border-dashed px-5 py-4\"\n style={{ borderColor: accent, backgroundColor: fill }}\n >\n <span\n aria-hidden=\"true\"\n className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white\"\n style={{ backgroundColor: accent }}\n >\n !\n </span>\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n <div className=\"text-sm font-bold\" style={{ color: heading }}>\n {title ?? ONLY_IN_DEVELOPMENT_TITLE}\n </div>\n <p\n className=\"m-0 max-w-[76ch] text-sm leading-relaxed\"\n style={{ color: body }}\n >\n {description ?? ONLY_IN_DEVELOPMENT_DESCRIPTION}\n </p>\n {hasChildren && (\n <div className=\"mt-2 border-t pt-3\" style={{ borderColor: rule }}>\n {children}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nOnlyInDevelopment.propTypes = {\n /**\n * Heading of the banner. Defaults to \"Only in Development (OID).\"\n */\n title: PropTypes.string,\n /**\n * Copy under the heading. Defaults to a short note on why the block exists.\n */\n description: PropTypes.string,\n /**\n * Action slot rendered beneath the rule: typically link buttons that fill\n * in fixtures or trigger a shortcut.\n */\n children: PropTypes.node,\n};\n\nexport default OnlyInDevelopment;\n"],"names":["OnlyInDevelopment","_ref","title","description","children","isDevelopment","accent","ONLY_IN_DEVELOPMENT_COLORS","fill","heading","body","rule","hasChildren","Children","toArray","length","_jsxs","className","style","borderColor","backgroundColor","_jsx","color","ONLY_IN_DEVELOPMENT_TITLE","ONLY_IN_DEVELOPMENT_DESCRIPTION"],"mappings":";;;;;;;AAoBA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAAyC;AAAA,EAAA,IAAnCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IAAEC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;AACvD,EAAA,IAAI,CAACC,gDAAa,EAAE,EAAE,OAAO,IAAI;AAEjC,EAAA,IAAQC,MAAM,GAAgCC,iEAA0B,CAAhED,MAAM;IAAEE,IAAI,GAA0BD,iEAA0B,CAAxDC,IAAI;IAAEC,OAAO,GAAiBF,iEAA0B,CAAlDE,OAAO;IAAEC,IAAI,GAAWH,iEAA0B,CAAzCG,IAAI;IAAEC,IAAI,GAAKJ,iEAA0B,CAAnCI,IAAI;;AAEzC;AACA;AACA;AACA;EACA,IAAMC,WAAW,GAAGC,cAAQ,CAACC,OAAO,CAACV,QAAQ,CAAC,CAACW,MAAM,GAAG,CAAC;AAEzD,EAAA,oBACEC,eAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,SAAS,EAAC,iEAAiE;AAC3EC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,WAAW,EAAEb,MAAM;AAAEc,MAAAA,eAAe,EAAEZ;KAAO;AAAAJ,IAAAA,QAAA,gBAEtDiB,cAAA,CAAA,MAAA,EAAA;AACE,MAAA,aAAA,EAAY,MAAM;AAClBJ,MAAAA,SAAS,EAAC,6FAA6F;AACvGC,MAAAA,KAAK,EAAE;AAAEE,QAAAA,eAAe,EAAEd;OAAS;AAAAF,MAAAA,QAAA,EACpC;KAEK,CAAC,eACPY,eAAA,CAAA,KAAA,EAAA;AAAKC,MAAAA,SAAS,EAAC,+BAA+B;AAAAb,MAAAA,QAAA,gBAC5CiB,cAAA,CAAA,KAAA,EAAA;AAAKJ,QAAAA,SAAS,EAAC,mBAAmB;AAACC,QAAAA,KAAK,EAAE;AAAEI,UAAAA,KAAK,EAAEb;SAAU;AAAAL,QAAAA,QAAA,EAC1DF,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,MAAA,GAALA,KAAK,GAAIqB;OACP,CAAC,eACNF,cAAA,CAAA,GAAA,EAAA;AACEJ,QAAAA,SAAS,EAAC,0CAA0C;AACpDC,QAAAA,KAAK,EAAE;AAAEI,UAAAA,KAAK,EAAEZ;SAAO;AAAAN,QAAAA,QAAA,EAEtBD,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,MAAA,GAAXA,WAAW,GAAIqB;AAA+B,OAC9C,CAAC,EACHZ,WAAW,iBACVS,cAAA,CAAA,KAAA,EAAA;AAAKJ,QAAAA,SAAS,EAAC,oBAAoB;AAACC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,WAAW,EAAER;SAAO;AAAAP,QAAAA,QAAA,EAC9DA;AAAQ,OACN,CACN;AAAA,KACE,CAAC;AAAA,GACH,CAAC;AAEV;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Design: the 1B1C only-in-development banner. The design authored these in
|
|
4
|
+
// oklch; the hexes below are that conversion to sRGB, kept alongside so a
|
|
5
|
+
// later tweak can be checked against the source rather than eyeballed.
|
|
6
|
+
//
|
|
7
|
+
// accent oklch(0.62 0.17 32) fill oklch(0.972 0.032 60)
|
|
8
|
+
// heading oklch(0.40 0.12 35) body oklch(0.45 0.05 45)
|
|
9
|
+
// rule oklch(0.88 0.03 55)
|
|
10
|
+
var ONLY_IN_DEVELOPMENT_COLORS = {
|
|
11
|
+
accent: "#D9553F",
|
|
12
|
+
fill: "#FFF1E1",
|
|
13
|
+
heading: "#7B2813",
|
|
14
|
+
body: "#6D4D3E",
|
|
15
|
+
rule: "#E8D3C5"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// The banner announces the feature by name rather than describing it, so the
|
|
19
|
+
// heading reads as the label the codebase uses everywhere else — folder,
|
|
20
|
+
// component and constants are all `OnlyInDevelopment`.
|
|
21
|
+
//
|
|
22
|
+
// Nothing here is reachable outside a developer's own machine, so the copy is
|
|
23
|
+
// deliberately not translated: it would only add strings for translators to
|
|
24
|
+
// carry.
|
|
25
|
+
var ONLY_IN_DEVELOPMENT_TITLE = "Only in Development (OID).";
|
|
26
|
+
var ONLY_IN_DEVELOPMENT_DESCRIPTION = "Many times in development we have to do repetitive tasks. This helps in " + "expediting the development work. This feature will not be available in " + "non-development environments.";
|
|
27
|
+
|
|
28
|
+
exports.ONLY_IN_DEVELOPMENT_COLORS = ONLY_IN_DEVELOPMENT_COLORS;
|
|
29
|
+
exports.ONLY_IN_DEVELOPMENT_DESCRIPTION = ONLY_IN_DEVELOPMENT_DESCRIPTION;
|
|
30
|
+
exports.ONLY_IN_DEVELOPMENT_TITLE = ONLY_IN_DEVELOPMENT_TITLE;
|
|
31
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/react-utils/OnlyInDevelopment/constants.js"],"sourcesContent":["// Design: the 1B1C only-in-development banner. The design authored these in\n// oklch; the hexes below are that conversion to sRGB, kept alongside so a\n// later tweak can be checked against the source rather than eyeballed.\n//\n// accent oklch(0.62 0.17 32) fill oklch(0.972 0.032 60)\n// heading oklch(0.40 0.12 35) body oklch(0.45 0.05 45)\n// rule oklch(0.88 0.03 55)\nexport const ONLY_IN_DEVELOPMENT_COLORS = {\n accent: \"#D9553F\",\n fill: \"#FFF1E1\",\n heading: \"#7B2813\",\n body: \"#6D4D3E\",\n rule: \"#E8D3C5\",\n};\n\n// The banner announces the feature by name rather than describing it, so the\n// heading reads as the label the codebase uses everywhere else — folder,\n// component and constants are all `OnlyInDevelopment`.\n//\n// Nothing here is reachable outside a developer's own machine, so the copy is\n// deliberately not translated: it would only add strings for translators to\n// carry.\nexport const ONLY_IN_DEVELOPMENT_TITLE = \"Only in Development (OID).\";\n\nexport const ONLY_IN_DEVELOPMENT_DESCRIPTION =\n \"Many times in development we have to do repetitive tasks. This helps in \" +\n \"expediting the development work. This feature will not be available in \" +\n \"non-development environments.\";\n"],"names":["ONLY_IN_DEVELOPMENT_COLORS","accent","fill","heading","body","rule","ONLY_IN_DEVELOPMENT_TITLE","ONLY_IN_DEVELOPMENT_DESCRIPTION"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,0BAA0B,GAAG;AACxCC,EAAAA,MAAM,EAAE,SAAS;AACjBC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,IAAI,EAAE;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,yBAAyB,GAAG;IAE5BC,+BAA+B,GAC1C,0EAA0E,GAC1E,yEAAyE,GACzE;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactUtils_OnlyInDevelopment_OnlyInDevelopment = require('./OnlyInDevelopment.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('./constants.js');
|
|
6
|
+
require('./utils.js');
|
|
7
|
+
require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
module.exports = reactUtils_OnlyInDevelopment_OnlyInDevelopment;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Two independent signals, and both have to say development.
|
|
4
|
+
//
|
|
5
|
+
// `process.env.RAILS_ENV` is the build-time signal. A production build of the
|
|
6
|
+
// host app substitutes it while bundling, so the check compiles to the
|
|
7
|
+
// constant `"production" === "development"`. The host's dev server does not
|
|
8
|
+
// rewrite dependencies; there the expression is left as is and reads the
|
|
9
|
+
// value the dev server exposes at runtime, which is the same `RAILS_ENV`.
|
|
10
|
+
//
|
|
11
|
+
// `globalProps.railsEnv` is the runtime signal: `Rails.env` as the host's
|
|
12
|
+
// server reports it in the shared client props
|
|
13
|
+
// (`NeetoCommonsBackend::ClientPropsHelper#common_props`). It covers what the
|
|
14
|
+
// build-time constant cannot: a development bundle somehow served by a
|
|
15
|
+
// non-development host.
|
|
16
|
+
//
|
|
17
|
+
// Neither is trusted on its own. A server that sends no `rails_env`, or a
|
|
18
|
+
// page that has not initialized `globalProps` yet, reads as "not
|
|
19
|
+
// development".
|
|
20
|
+
//
|
|
21
|
+
// What this does NOT do is keep the wrapped markup out of the host's bundle.
|
|
22
|
+
// Whatever a caller wraps still ships to production — it just never renders.
|
|
23
|
+
// So treat anything placed inside `OnlyInDevelopment` as readable by anyone
|
|
24
|
+
// who opens the bundle: fixtures and shortcuts, never a credential, an
|
|
25
|
+
// internal endpoint, or an unreleased feature's copy.
|
|
26
|
+
var isDevelopment = function isDevelopment() {
|
|
27
|
+
var _window$globalProps;
|
|
28
|
+
return process.env.RAILS_ENV === "development" && ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.railsEnv) === "development";
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.isDevelopment = isDevelopment;
|
|
32
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/react-utils/OnlyInDevelopment/utils.js"],"sourcesContent":["// Two independent signals, and both have to say development.\n//\n// `process.env.RAILS_ENV` is the build-time signal. A production build of the\n// host app substitutes it while bundling, so the check compiles to the\n// constant `\"production\" === \"development\"`. The host's dev server does not\n// rewrite dependencies; there the expression is left as is and reads the\n// value the dev server exposes at runtime, which is the same `RAILS_ENV`.\n//\n// `globalProps.railsEnv` is the runtime signal: `Rails.env` as the host's\n// server reports it in the shared client props\n// (`NeetoCommonsBackend::ClientPropsHelper#common_props`). It covers what the\n// build-time constant cannot: a development bundle somehow served by a\n// non-development host.\n//\n// Neither is trusted on its own. A server that sends no `rails_env`, or a\n// page that has not initialized `globalProps` yet, reads as \"not\n// development\".\n//\n// What this does NOT do is keep the wrapped markup out of the host's bundle.\n// Whatever a caller wraps still ships to production — it just never renders.\n// So treat anything placed inside `OnlyInDevelopment` as readable by anyone\n// who opens the bundle: fixtures and shortcuts, never a credential, an\n// internal endpoint, or an unreleased feature's copy.\nexport const isDevelopment = () =>\n process.env.RAILS_ENV === \"development\" &&\n window.globalProps?.railsEnv === \"development\";\n"],"names":["isDevelopment","_window$globalProps","process","env","RAILS_ENV","window","globalProps","railsEnv"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,GAAA;AAAA,EAAA,IAAAC,mBAAA;EAAA,OACxBC,OAAO,CAACC,GAAG,CAACC,SAAS,KAAK,aAAa,IACvC,CAAA,CAAAH,mBAAA,GAAAI,MAAM,CAACC,WAAW,MAAA,IAAA,IAAAL,mBAAA,uBAAlBA,mBAAA,CAAoBM,QAAQ,MAAK,aAAa;AAAA;;;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var reactUtils_HoneybadgerErrorBoundary_HoneybadgerErrorBoundary = require('./HoneybadgerErrorBoundary/HoneybadgerErrorBoundary.js');
|
|
4
4
|
var reactUtils_PrivateRoute_PrivateRoute = require('./PrivateRoute/PrivateRoute.js');
|
|
5
5
|
var reactUtils_PageTitle_PageTitle = require('./PageTitle/PageTitle.js');
|
|
6
|
+
var reactUtils_OnlyInDevelopment_OnlyInDevelopment = require('./OnlyInDevelopment/OnlyInDevelopment.js');
|
|
6
7
|
var reactUtils_useDebounce_useDebounce = require('./useDebounce/useDebounce.js');
|
|
7
8
|
var reactUtils_useDisplayErrorPage_useDisplayErrorPage = require('./useDisplayErrorPage/useDisplayErrorPage.js');
|
|
8
9
|
var reactUtils_useFetchNeetoApps_useFetchNeetoApps = require('./useFetchNeetoApps/useFetchNeetoApps.js');
|
|
@@ -55,6 +56,8 @@ require('react-router-dom');
|
|
|
55
56
|
require('./PrivateRoute/utils.js');
|
|
56
57
|
require('./PrivateRoute/constants.js');
|
|
57
58
|
require('react-helmet');
|
|
59
|
+
require('./OnlyInDevelopment/constants.js');
|
|
60
|
+
require('./OnlyInDevelopment/utils.js');
|
|
58
61
|
require('../slicedToArray-BcL7fKuL.js');
|
|
59
62
|
require('../unsupportedIterableToArray-BoHMiKNA.js');
|
|
60
63
|
require('zustand');
|
|
@@ -109,6 +112,7 @@ require('react-dom/client');
|
|
|
109
112
|
exports.HoneybadgerErrorBoundary = reactUtils_HoneybadgerErrorBoundary_HoneybadgerErrorBoundary;
|
|
110
113
|
exports.PrivateRoute = reactUtils_PrivateRoute_PrivateRoute;
|
|
111
114
|
exports.PageTitle = reactUtils_PageTitle_PageTitle;
|
|
115
|
+
exports.OnlyInDevelopment = reactUtils_OnlyInDevelopment_OnlyInDevelopment;
|
|
112
116
|
exports.useDebounce = reactUtils_useDebounce_useDebounce;
|
|
113
117
|
exports.useDisplayErrorPage = reactUtils_useDisplayErrorPage_useDisplayErrorPage.default;
|
|
114
118
|
exports.useErrorDisplayStore = reactUtils_useDisplayErrorPage_useDisplayErrorPage.useErrorDisplayStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var v2_reactUtils_OnlyInDevelopment_constants = require('./constants.js');
|
|
5
|
+
var v2_reactUtils_OnlyInDevelopment_utils = require('./utils.js');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
var OnlyInDevelopment = function OnlyInDevelopment(_ref) {
|
|
9
|
+
var title = _ref.title,
|
|
10
|
+
description = _ref.description,
|
|
11
|
+
children = _ref.children;
|
|
12
|
+
if (!v2_reactUtils_OnlyInDevelopment_utils.isDevelopment()) return null;
|
|
13
|
+
var accent = v2_reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.accent,
|
|
14
|
+
fill = v2_reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.fill,
|
|
15
|
+
heading = v2_reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.heading,
|
|
16
|
+
body = v2_reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.body,
|
|
17
|
+
rule = v2_reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_COLORS.rule;
|
|
18
|
+
|
|
19
|
+
// `Children.toArray` drops null, undefined and booleans and flattens
|
|
20
|
+
// arrays, so a caller that maps an empty list into the slot gets no rule
|
|
21
|
+
// and no empty gap beneath the copy. (An empty fragment still counts as
|
|
22
|
+
// one child; there is no way to see inside it without rendering.)
|
|
23
|
+
var hasChildren = React.Children.toArray(children).length > 0;
|
|
24
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
25
|
+
className: "flex items-start gap-3 rounded border-2 border-dashed px-5 py-4",
|
|
26
|
+
style: {
|
|
27
|
+
borderColor: accent,
|
|
28
|
+
backgroundColor: fill
|
|
29
|
+
},
|
|
30
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white",
|
|
33
|
+
style: {
|
|
34
|
+
backgroundColor: accent
|
|
35
|
+
},
|
|
36
|
+
children: "!"
|
|
37
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
38
|
+
className: "flex min-w-0 flex-col gap-1.5",
|
|
39
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
40
|
+
className: "text-sm font-bold",
|
|
41
|
+
style: {
|
|
42
|
+
color: heading
|
|
43
|
+
},
|
|
44
|
+
children: title !== null && title !== void 0 ? title : v2_reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_TITLE
|
|
45
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
46
|
+
className: "m-0 max-w-[76ch] text-sm leading-relaxed",
|
|
47
|
+
style: {
|
|
48
|
+
color: body
|
|
49
|
+
},
|
|
50
|
+
children: description !== null && description !== void 0 ? description : v2_reactUtils_OnlyInDevelopment_constants.ONLY_IN_DEVELOPMENT_DESCRIPTION
|
|
51
|
+
}), hasChildren && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
52
|
+
className: "mt-2 border-t pt-3",
|
|
53
|
+
style: {
|
|
54
|
+
borderColor: rule
|
|
55
|
+
},
|
|
56
|
+
children: children
|
|
57
|
+
})]
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
module.exports = OnlyInDevelopment;
|
|
63
|
+
//# sourceMappingURL=OnlyInDevelopment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnlyInDevelopment.js","sources":["../../../../../src/v2/react-utils/OnlyInDevelopment/OnlyInDevelopment.jsx"],"sourcesContent":["import { Children } from \"react\";\n\nimport PropTypes from \"prop-types\";\n\nimport {\n ONLY_IN_DEVELOPMENT_COLORS,\n ONLY_IN_DEVELOPMENT_DESCRIPTION,\n ONLY_IN_DEVELOPMENT_TITLE,\n} from \"./constants\";\nimport { isDevelopment } from \"./utils\";\n\n// Renders nothing at all outside development, so a caller never guards its\n// own usage: wrapping *is* the guard. `children` is the action slot beneath\n// the rule, where the design puts its secondary block.\n//\n// Guarded is not the same as absent: whatever you wrap still ships in the\n// host's bundle, it just never renders. `utils.js` has the details.\n//\n// Pairs with `Rails.env.development?` on the server. Both sides check — see\n// `utils.js` for why one signal is not enough.\nconst OnlyInDevelopment = ({ title, description, children }) => {\n if (!isDevelopment()) return null;\n\n const { accent, fill, heading, body, rule } = ONLY_IN_DEVELOPMENT_COLORS;\n\n // `Children.toArray` drops null, undefined and booleans and flattens\n // arrays, so a caller that maps an empty list into the slot gets no rule\n // and no empty gap beneath the copy. (An empty fragment still counts as\n // one child; there is no way to see inside it without rendering.)\n const hasChildren = Children.toArray(children).length > 0;\n\n return (\n <div\n className=\"flex items-start gap-3 rounded border-2 border-dashed px-5 py-4\"\n style={{ borderColor: accent, backgroundColor: fill }}\n >\n <span\n aria-hidden=\"true\"\n className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white\"\n style={{ backgroundColor: accent }}\n >\n !\n </span>\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n <div className=\"text-sm font-bold\" style={{ color: heading }}>\n {title ?? ONLY_IN_DEVELOPMENT_TITLE}\n </div>\n <p\n className=\"m-0 max-w-[76ch] text-sm leading-relaxed\"\n style={{ color: body }}\n >\n {description ?? ONLY_IN_DEVELOPMENT_DESCRIPTION}\n </p>\n {hasChildren && (\n <div className=\"mt-2 border-t pt-3\" style={{ borderColor: rule }}>\n {children}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nOnlyInDevelopment.propTypes = {\n /**\n * Heading of the banner. Defaults to \"Only in Development (OID).\"\n */\n title: PropTypes.string,\n /**\n * Copy under the heading. Defaults to a short note on why the block exists.\n */\n description: PropTypes.string,\n /**\n * Action slot rendered beneath the rule: typically link buttons that fill\n * in fixtures or trigger a shortcut.\n */\n children: PropTypes.node,\n};\n\nexport default OnlyInDevelopment;\n"],"names":["OnlyInDevelopment","_ref","title","description","children","isDevelopment","accent","ONLY_IN_DEVELOPMENT_COLORS","fill","heading","body","rule","hasChildren","Children","toArray","length","_jsxs","className","style","borderColor","backgroundColor","_jsx","color","ONLY_IN_DEVELOPMENT_TITLE","ONLY_IN_DEVELOPMENT_DESCRIPTION"],"mappings":";;;;;;;AAoBA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAAyC;AAAA,EAAA,IAAnCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IAAEC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;AACvD,EAAA,IAAI,CAACC,mDAAa,EAAE,EAAE,OAAO,IAAI;AAEjC,EAAA,IAAQC,MAAM,GAAgCC,oEAA0B,CAAhED,MAAM;IAAEE,IAAI,GAA0BD,oEAA0B,CAAxDC,IAAI;IAAEC,OAAO,GAAiBF,oEAA0B,CAAlDE,OAAO;IAAEC,IAAI,GAAWH,oEAA0B,CAAzCG,IAAI;IAAEC,IAAI,GAAKJ,oEAA0B,CAAnCI,IAAI;;AAEzC;AACA;AACA;AACA;EACA,IAAMC,WAAW,GAAGC,cAAQ,CAACC,OAAO,CAACV,QAAQ,CAAC,CAACW,MAAM,GAAG,CAAC;AAEzD,EAAA,oBACEC,eAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,SAAS,EAAC,iEAAiE;AAC3EC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,WAAW,EAAEb,MAAM;AAAEc,MAAAA,eAAe,EAAEZ;KAAO;AAAAJ,IAAAA,QAAA,gBAEtDiB,cAAA,CAAA,MAAA,EAAA;AACE,MAAA,aAAA,EAAY,MAAM;AAClBJ,MAAAA,SAAS,EAAC,6FAA6F;AACvGC,MAAAA,KAAK,EAAE;AAAEE,QAAAA,eAAe,EAAEd;OAAS;AAAAF,MAAAA,QAAA,EACpC;KAEK,CAAC,eACPY,eAAA,CAAA,KAAA,EAAA;AAAKC,MAAAA,SAAS,EAAC,+BAA+B;AAAAb,MAAAA,QAAA,gBAC5CiB,cAAA,CAAA,KAAA,EAAA;AAAKJ,QAAAA,SAAS,EAAC,mBAAmB;AAACC,QAAAA,KAAK,EAAE;AAAEI,UAAAA,KAAK,EAAEb;SAAU;AAAAL,QAAAA,QAAA,EAC1DF,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,MAAA,GAALA,KAAK,GAAIqB;OACP,CAAC,eACNF,cAAA,CAAA,GAAA,EAAA;AACEJ,QAAAA,SAAS,EAAC,0CAA0C;AACpDC,QAAAA,KAAK,EAAE;AAAEI,UAAAA,KAAK,EAAEZ;SAAO;AAAAN,QAAAA,QAAA,EAEtBD,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,MAAA,GAAXA,WAAW,GAAIqB;AAA+B,OAC9C,CAAC,EACHZ,WAAW,iBACVS,cAAA,CAAA,KAAA,EAAA;AAAKJ,QAAAA,SAAS,EAAC,oBAAoB;AAACC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,WAAW,EAAER;SAAO;AAAAP,QAAAA,QAAA,EAC9DA;AAAQ,OACN,CACN;AAAA,KACE,CAAC;AAAA,GACH,CAAC;AAEV;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Design: the 1B1C only-in-development banner. The design authored these in
|
|
4
|
+
// oklch; the hexes below are that conversion to sRGB, kept alongside so a
|
|
5
|
+
// later tweak can be checked against the source rather than eyeballed.
|
|
6
|
+
//
|
|
7
|
+
// accent oklch(0.62 0.17 32) fill oklch(0.972 0.032 60)
|
|
8
|
+
// heading oklch(0.40 0.12 35) body oklch(0.45 0.05 45)
|
|
9
|
+
// rule oklch(0.88 0.03 55)
|
|
10
|
+
var ONLY_IN_DEVELOPMENT_COLORS = {
|
|
11
|
+
accent: "#D9553F",
|
|
12
|
+
fill: "#FFF1E1",
|
|
13
|
+
heading: "#7B2813",
|
|
14
|
+
body: "#6D4D3E",
|
|
15
|
+
rule: "#E8D3C5"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// The banner announces the feature by name rather than describing it, so the
|
|
19
|
+
// heading reads as the label the codebase uses everywhere else — folder,
|
|
20
|
+
// component and constants are all `OnlyInDevelopment`.
|
|
21
|
+
//
|
|
22
|
+
// Nothing here is reachable outside a developer's own machine, so the copy is
|
|
23
|
+
// deliberately not translated: it would only add strings for translators to
|
|
24
|
+
// carry.
|
|
25
|
+
var ONLY_IN_DEVELOPMENT_TITLE = "Only in Development (OID).";
|
|
26
|
+
var ONLY_IN_DEVELOPMENT_DESCRIPTION = "Many times in development we have to do repetitive tasks. This helps in " + "expediting the development work. This feature will not be available in " + "non-development environments.";
|
|
27
|
+
|
|
28
|
+
exports.ONLY_IN_DEVELOPMENT_COLORS = ONLY_IN_DEVELOPMENT_COLORS;
|
|
29
|
+
exports.ONLY_IN_DEVELOPMENT_DESCRIPTION = ONLY_IN_DEVELOPMENT_DESCRIPTION;
|
|
30
|
+
exports.ONLY_IN_DEVELOPMENT_TITLE = ONLY_IN_DEVELOPMENT_TITLE;
|
|
31
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../src/v2/react-utils/OnlyInDevelopment/constants.js"],"sourcesContent":["// Design: the 1B1C only-in-development banner. The design authored these in\n// oklch; the hexes below are that conversion to sRGB, kept alongside so a\n// later tweak can be checked against the source rather than eyeballed.\n//\n// accent oklch(0.62 0.17 32) fill oklch(0.972 0.032 60)\n// heading oklch(0.40 0.12 35) body oklch(0.45 0.05 45)\n// rule oklch(0.88 0.03 55)\nexport const ONLY_IN_DEVELOPMENT_COLORS = {\n accent: \"#D9553F\",\n fill: \"#FFF1E1\",\n heading: \"#7B2813\",\n body: \"#6D4D3E\",\n rule: \"#E8D3C5\",\n};\n\n// The banner announces the feature by name rather than describing it, so the\n// heading reads as the label the codebase uses everywhere else — folder,\n// component and constants are all `OnlyInDevelopment`.\n//\n// Nothing here is reachable outside a developer's own machine, so the copy is\n// deliberately not translated: it would only add strings for translators to\n// carry.\nexport const ONLY_IN_DEVELOPMENT_TITLE = \"Only in Development (OID).\";\n\nexport const ONLY_IN_DEVELOPMENT_DESCRIPTION =\n \"Many times in development we have to do repetitive tasks. This helps in \" +\n \"expediting the development work. This feature will not be available in \" +\n \"non-development environments.\";\n"],"names":["ONLY_IN_DEVELOPMENT_COLORS","accent","fill","heading","body","rule","ONLY_IN_DEVELOPMENT_TITLE","ONLY_IN_DEVELOPMENT_DESCRIPTION"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,0BAA0B,GAAG;AACxCC,EAAAA,MAAM,EAAE,SAAS;AACjBC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,IAAI,EAAE;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,yBAAyB,GAAG;IAE5BC,+BAA+B,GAC1C,0EAA0E,GAC1E,yEAAyE,GACzE;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var v2_reactUtils_OnlyInDevelopment_OnlyInDevelopment = require('./OnlyInDevelopment.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('./constants.js');
|
|
6
|
+
require('./utils.js');
|
|
7
|
+
require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
module.exports = v2_reactUtils_OnlyInDevelopment_OnlyInDevelopment;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Two independent signals, and both have to say development.
|
|
4
|
+
//
|
|
5
|
+
// `process.env.RAILS_ENV` is the build-time signal. A production build of the
|
|
6
|
+
// host app substitutes it while bundling, so the check compiles to the
|
|
7
|
+
// constant `"production" === "development"`. The host's dev server does not
|
|
8
|
+
// rewrite dependencies; there the expression is left as is and reads the
|
|
9
|
+
// value the dev server exposes at runtime, which is the same `RAILS_ENV`.
|
|
10
|
+
//
|
|
11
|
+
// `globalProps.railsEnv` is the runtime signal: `Rails.env` as the host's
|
|
12
|
+
// server reports it in the shared client props
|
|
13
|
+
// (`NeetoCommonsBackend::ClientPropsHelper#common_props`). It covers what the
|
|
14
|
+
// build-time constant cannot: a development bundle somehow served by a
|
|
15
|
+
// non-development host.
|
|
16
|
+
//
|
|
17
|
+
// Neither is trusted on its own. A server that sends no `rails_env`, or a
|
|
18
|
+
// page that has not initialized `globalProps` yet, reads as "not
|
|
19
|
+
// development".
|
|
20
|
+
//
|
|
21
|
+
// What this does NOT do is keep the wrapped markup out of the host's bundle.
|
|
22
|
+
// Whatever a caller wraps still ships to production — it just never renders.
|
|
23
|
+
// So treat anything placed inside `OnlyInDevelopment` as readable by anyone
|
|
24
|
+
// who opens the bundle: fixtures and shortcuts, never a credential, an
|
|
25
|
+
// internal endpoint, or an unreleased feature's copy.
|
|
26
|
+
var isDevelopment = function isDevelopment() {
|
|
27
|
+
var _window$globalProps;
|
|
28
|
+
return process.env.RAILS_ENV === "development" && ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.railsEnv) === "development";
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.isDevelopment = isDevelopment;
|
|
32
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/v2/react-utils/OnlyInDevelopment/utils.js"],"sourcesContent":["// Two independent signals, and both have to say development.\n//\n// `process.env.RAILS_ENV` is the build-time signal. A production build of the\n// host app substitutes it while bundling, so the check compiles to the\n// constant `\"production\" === \"development\"`. The host's dev server does not\n// rewrite dependencies; there the expression is left as is and reads the\n// value the dev server exposes at runtime, which is the same `RAILS_ENV`.\n//\n// `globalProps.railsEnv` is the runtime signal: `Rails.env` as the host's\n// server reports it in the shared client props\n// (`NeetoCommonsBackend::ClientPropsHelper#common_props`). It covers what the\n// build-time constant cannot: a development bundle somehow served by a\n// non-development host.\n//\n// Neither is trusted on its own. A server that sends no `rails_env`, or a\n// page that has not initialized `globalProps` yet, reads as \"not\n// development\".\n//\n// What this does NOT do is keep the wrapped markup out of the host's bundle.\n// Whatever a caller wraps still ships to production — it just never renders.\n// So treat anything placed inside `OnlyInDevelopment` as readable by anyone\n// who opens the bundle: fixtures and shortcuts, never a credential, an\n// internal endpoint, or an unreleased feature's copy.\nexport const isDevelopment = () =>\n process.env.RAILS_ENV === \"development\" &&\n window.globalProps?.railsEnv === \"development\";\n"],"names":["isDevelopment","_window$globalProps","process","env","RAILS_ENV","window","globalProps","railsEnv"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,GAAA;AAAA,EAAA,IAAAC,mBAAA;EAAA,OACxBC,OAAO,CAACC,GAAG,CAACC,SAAS,KAAK,aAAa,IACvC,CAAA,CAAAH,mBAAA,GAAAI,MAAM,CAACC,WAAW,MAAA,IAAA,IAAAL,mBAAA,uBAAlBA,mBAAA,CAAoBM,QAAQ,MAAK,aAAa;AAAA;;;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var v2_reactUtils_HoneybadgerErrorBoundary_HoneybadgerErrorBoundary = require('./HoneybadgerErrorBoundary/HoneybadgerErrorBoundary.js');
|
|
4
4
|
var v2_reactUtils_PrivateRoute_PrivateRoute = require('./PrivateRoute/PrivateRoute.js');
|
|
5
5
|
var v2_reactUtils_PageTitle_PageTitle = require('./PageTitle/PageTitle.js');
|
|
6
|
+
var v2_reactUtils_OnlyInDevelopment_OnlyInDevelopment = require('./OnlyInDevelopment/OnlyInDevelopment.js');
|
|
6
7
|
var v2_reactUtils_useDebounce_useDebounce = require('./useDebounce/useDebounce.js');
|
|
7
8
|
var v2_reactUtils_useDisplayErrorPage_useDisplayErrorPage = require('./useDisplayErrorPage/useDisplayErrorPage.js');
|
|
8
9
|
var v2_reactUtils_useFetchNeetoApps_useFetchNeetoApps = require('./useFetchNeetoApps/useFetchNeetoApps.js');
|
|
@@ -54,6 +55,8 @@ require('react-router-dom');
|
|
|
54
55
|
require('./PrivateRoute/utils.js');
|
|
55
56
|
require('./PrivateRoute/constants.js');
|
|
56
57
|
require('react-helmet');
|
|
58
|
+
require('./OnlyInDevelopment/constants.js');
|
|
59
|
+
require('./OnlyInDevelopment/utils.js');
|
|
57
60
|
require('../../slicedToArray-BcL7fKuL.js');
|
|
58
61
|
require('../../unsupportedIterableToArray-BoHMiKNA.js');
|
|
59
62
|
require('zustand');
|
|
@@ -107,6 +110,7 @@ require('react-dom/client');
|
|
|
107
110
|
exports.HoneybadgerErrorBoundary = v2_reactUtils_HoneybadgerErrorBoundary_HoneybadgerErrorBoundary;
|
|
108
111
|
exports.PrivateRoute = v2_reactUtils_PrivateRoute_PrivateRoute;
|
|
109
112
|
exports.PageTitle = v2_reactUtils_PageTitle_PageTitle;
|
|
113
|
+
exports.OnlyInDevelopment = v2_reactUtils_OnlyInDevelopment_OnlyInDevelopment;
|
|
110
114
|
exports.useDebounce = v2_reactUtils_useDebounce_useDebounce;
|
|
111
115
|
exports.useDisplayErrorPage = v2_reactUtils_useDisplayErrorPage_useDisplayErrorPage.default;
|
|
112
116
|
exports.useErrorDisplayStore = v2_reactUtils_useDisplayErrorPage_useDisplayErrorPage.useErrorDisplayStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Children } from 'react';
|
|
2
|
+
import { ONLY_IN_DEVELOPMENT_COLORS, ONLY_IN_DEVELOPMENT_TITLE, ONLY_IN_DEVELOPMENT_DESCRIPTION } from './constants.js';
|
|
3
|
+
import { isDevelopment } from './utils.js';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var OnlyInDevelopment = function OnlyInDevelopment(_ref) {
|
|
7
|
+
var title = _ref.title,
|
|
8
|
+
description = _ref.description,
|
|
9
|
+
children = _ref.children;
|
|
10
|
+
if (!isDevelopment()) return null;
|
|
11
|
+
var accent = ONLY_IN_DEVELOPMENT_COLORS.accent,
|
|
12
|
+
fill = ONLY_IN_DEVELOPMENT_COLORS.fill,
|
|
13
|
+
heading = ONLY_IN_DEVELOPMENT_COLORS.heading,
|
|
14
|
+
body = ONLY_IN_DEVELOPMENT_COLORS.body,
|
|
15
|
+
rule = ONLY_IN_DEVELOPMENT_COLORS.rule;
|
|
16
|
+
|
|
17
|
+
// `Children.toArray` drops null, undefined and booleans and flattens
|
|
18
|
+
// arrays, so a caller that maps an empty list into the slot gets no rule
|
|
19
|
+
// and no empty gap beneath the copy. (An empty fragment still counts as
|
|
20
|
+
// one child; there is no way to see inside it without rendering.)
|
|
21
|
+
var hasChildren = Children.toArray(children).length > 0;
|
|
22
|
+
return /*#__PURE__*/jsxs("div", {
|
|
23
|
+
className: "flex items-start gap-3 rounded border-2 border-dashed px-5 py-4",
|
|
24
|
+
style: {
|
|
25
|
+
borderColor: accent,
|
|
26
|
+
backgroundColor: fill
|
|
27
|
+
},
|
|
28
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white",
|
|
31
|
+
style: {
|
|
32
|
+
backgroundColor: accent
|
|
33
|
+
},
|
|
34
|
+
children: "!"
|
|
35
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
36
|
+
className: "flex min-w-0 flex-col gap-1.5",
|
|
37
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
38
|
+
className: "text-sm font-bold",
|
|
39
|
+
style: {
|
|
40
|
+
color: heading
|
|
41
|
+
},
|
|
42
|
+
children: title !== null && title !== void 0 ? title : ONLY_IN_DEVELOPMENT_TITLE
|
|
43
|
+
}), /*#__PURE__*/jsx("p", {
|
|
44
|
+
className: "m-0 max-w-[76ch] text-sm leading-relaxed",
|
|
45
|
+
style: {
|
|
46
|
+
color: body
|
|
47
|
+
},
|
|
48
|
+
children: description !== null && description !== void 0 ? description : ONLY_IN_DEVELOPMENT_DESCRIPTION
|
|
49
|
+
}), hasChildren && /*#__PURE__*/jsx("div", {
|
|
50
|
+
className: "mt-2 border-t pt-3",
|
|
51
|
+
style: {
|
|
52
|
+
borderColor: rule
|
|
53
|
+
},
|
|
54
|
+
children: children
|
|
55
|
+
})]
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { OnlyInDevelopment as default };
|
|
61
|
+
//# sourceMappingURL=OnlyInDevelopment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnlyInDevelopment.js","sources":["../../../src/react-utils/OnlyInDevelopment/OnlyInDevelopment.jsx"],"sourcesContent":["import { Children } from \"react\";\n\nimport PropTypes from \"prop-types\";\n\nimport {\n ONLY_IN_DEVELOPMENT_COLORS,\n ONLY_IN_DEVELOPMENT_DESCRIPTION,\n ONLY_IN_DEVELOPMENT_TITLE,\n} from \"./constants\";\nimport { isDevelopment } from \"./utils\";\n\n// Renders nothing at all outside development, so a caller never guards its\n// own usage: wrapping *is* the guard. `children` is the action slot beneath\n// the rule, where the design puts its secondary block.\n//\n// Guarded is not the same as absent: whatever you wrap still ships in the\n// host's bundle, it just never renders. `utils.js` has the details.\n//\n// Pairs with `Rails.env.development?` on the server. Both sides check — see\n// `utils.js` for why one signal is not enough.\nconst OnlyInDevelopment = ({ title, description, children }) => {\n if (!isDevelopment()) return null;\n\n const { accent, fill, heading, body, rule } = ONLY_IN_DEVELOPMENT_COLORS;\n\n // `Children.toArray` drops null, undefined and booleans and flattens\n // arrays, so a caller that maps an empty list into the slot gets no rule\n // and no empty gap beneath the copy. (An empty fragment still counts as\n // one child; there is no way to see inside it without rendering.)\n const hasChildren = Children.toArray(children).length > 0;\n\n return (\n <div\n className=\"flex items-start gap-3 rounded border-2 border-dashed px-5 py-4\"\n style={{ borderColor: accent, backgroundColor: fill }}\n >\n <span\n aria-hidden=\"true\"\n className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white\"\n style={{ backgroundColor: accent }}\n >\n !\n </span>\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n <div className=\"text-sm font-bold\" style={{ color: heading }}>\n {title ?? ONLY_IN_DEVELOPMENT_TITLE}\n </div>\n <p\n className=\"m-0 max-w-[76ch] text-sm leading-relaxed\"\n style={{ color: body }}\n >\n {description ?? ONLY_IN_DEVELOPMENT_DESCRIPTION}\n </p>\n {hasChildren && (\n <div className=\"mt-2 border-t pt-3\" style={{ borderColor: rule }}>\n {children}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nOnlyInDevelopment.propTypes = {\n /**\n * Heading of the banner. Defaults to \"Only in Development (OID).\"\n */\n title: PropTypes.string,\n /**\n * Copy under the heading. Defaults to a short note on why the block exists.\n */\n description: PropTypes.string,\n /**\n * Action slot rendered beneath the rule: typically link buttons that fill\n * in fixtures or trigger a shortcut.\n */\n children: PropTypes.node,\n};\n\nexport default OnlyInDevelopment;\n"],"names":["OnlyInDevelopment","_ref","title","description","children","isDevelopment","accent","ONLY_IN_DEVELOPMENT_COLORS","fill","heading","body","rule","hasChildren","Children","toArray","length","_jsxs","className","style","borderColor","backgroundColor","_jsx","color","ONLY_IN_DEVELOPMENT_TITLE","ONLY_IN_DEVELOPMENT_DESCRIPTION"],"mappings":";;;;;AAoBA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAAyC;AAAA,EAAA,IAAnCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IAAEC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;AACvD,EAAA,IAAI,CAACC,aAAa,EAAE,EAAE,OAAO,IAAI;AAEjC,EAAA,IAAQC,MAAM,GAAgCC,0BAA0B,CAAhED,MAAM;IAAEE,IAAI,GAA0BD,0BAA0B,CAAxDC,IAAI;IAAEC,OAAO,GAAiBF,0BAA0B,CAAlDE,OAAO;IAAEC,IAAI,GAAWH,0BAA0B,CAAzCG,IAAI;IAAEC,IAAI,GAAKJ,0BAA0B,CAAnCI,IAAI;;AAEzC;AACA;AACA;AACA;EACA,IAAMC,WAAW,GAAGC,QAAQ,CAACC,OAAO,CAACV,QAAQ,CAAC,CAACW,MAAM,GAAG,CAAC;AAEzD,EAAA,oBACEC,IAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,SAAS,EAAC,iEAAiE;AAC3EC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,WAAW,EAAEb,MAAM;AAAEc,MAAAA,eAAe,EAAEZ;KAAO;AAAAJ,IAAAA,QAAA,gBAEtDiB,GAAA,CAAA,MAAA,EAAA;AACE,MAAA,aAAA,EAAY,MAAM;AAClBJ,MAAAA,SAAS,EAAC,6FAA6F;AACvGC,MAAAA,KAAK,EAAE;AAAEE,QAAAA,eAAe,EAAEd;OAAS;AAAAF,MAAAA,QAAA,EACpC;KAEK,CAAC,eACPY,IAAA,CAAA,KAAA,EAAA;AAAKC,MAAAA,SAAS,EAAC,+BAA+B;AAAAb,MAAAA,QAAA,gBAC5CiB,GAAA,CAAA,KAAA,EAAA;AAAKJ,QAAAA,SAAS,EAAC,mBAAmB;AAACC,QAAAA,KAAK,EAAE;AAAEI,UAAAA,KAAK,EAAEb;SAAU;AAAAL,QAAAA,QAAA,EAC1DF,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,MAAA,GAALA,KAAK,GAAIqB;OACP,CAAC,eACNF,GAAA,CAAA,GAAA,EAAA;AACEJ,QAAAA,SAAS,EAAC,0CAA0C;AACpDC,QAAAA,KAAK,EAAE;AAAEI,UAAAA,KAAK,EAAEZ;SAAO;AAAAN,QAAAA,QAAA,EAEtBD,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,MAAA,GAAXA,WAAW,GAAIqB;AAA+B,OAC9C,CAAC,EACHZ,WAAW,iBACVS,GAAA,CAAA,KAAA,EAAA;AAAKJ,QAAAA,SAAS,EAAC,oBAAoB;AAACC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,WAAW,EAAER;SAAO;AAAAP,QAAAA,QAAA,EAC9DA;AAAQ,OACN,CACN;AAAA,KACE,CAAC;AAAA,GACH,CAAC;AAEV;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Design: the 1B1C only-in-development banner. The design authored these in
|
|
2
|
+
// oklch; the hexes below are that conversion to sRGB, kept alongside so a
|
|
3
|
+
// later tweak can be checked against the source rather than eyeballed.
|
|
4
|
+
//
|
|
5
|
+
// accent oklch(0.62 0.17 32) fill oklch(0.972 0.032 60)
|
|
6
|
+
// heading oklch(0.40 0.12 35) body oklch(0.45 0.05 45)
|
|
7
|
+
// rule oklch(0.88 0.03 55)
|
|
8
|
+
var ONLY_IN_DEVELOPMENT_COLORS = {
|
|
9
|
+
accent: "#D9553F",
|
|
10
|
+
fill: "#FFF1E1",
|
|
11
|
+
heading: "#7B2813",
|
|
12
|
+
body: "#6D4D3E",
|
|
13
|
+
rule: "#E8D3C5"
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// The banner announces the feature by name rather than describing it, so the
|
|
17
|
+
// heading reads as the label the codebase uses everywhere else — folder,
|
|
18
|
+
// component and constants are all `OnlyInDevelopment`.
|
|
19
|
+
//
|
|
20
|
+
// Nothing here is reachable outside a developer's own machine, so the copy is
|
|
21
|
+
// deliberately not translated: it would only add strings for translators to
|
|
22
|
+
// carry.
|
|
23
|
+
var ONLY_IN_DEVELOPMENT_TITLE = "Only in Development (OID).";
|
|
24
|
+
var ONLY_IN_DEVELOPMENT_DESCRIPTION = "Many times in development we have to do repetitive tasks. This helps in " + "expediting the development work. This feature will not be available in " + "non-development environments.";
|
|
25
|
+
|
|
26
|
+
export { ONLY_IN_DEVELOPMENT_COLORS, ONLY_IN_DEVELOPMENT_DESCRIPTION, ONLY_IN_DEVELOPMENT_TITLE };
|
|
27
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/react-utils/OnlyInDevelopment/constants.js"],"sourcesContent":["// Design: the 1B1C only-in-development banner. The design authored these in\n// oklch; the hexes below are that conversion to sRGB, kept alongside so a\n// later tweak can be checked against the source rather than eyeballed.\n//\n// accent oklch(0.62 0.17 32) fill oklch(0.972 0.032 60)\n// heading oklch(0.40 0.12 35) body oklch(0.45 0.05 45)\n// rule oklch(0.88 0.03 55)\nexport const ONLY_IN_DEVELOPMENT_COLORS = {\n accent: \"#D9553F\",\n fill: \"#FFF1E1\",\n heading: \"#7B2813\",\n body: \"#6D4D3E\",\n rule: \"#E8D3C5\",\n};\n\n// The banner announces the feature by name rather than describing it, so the\n// heading reads as the label the codebase uses everywhere else — folder,\n// component and constants are all `OnlyInDevelopment`.\n//\n// Nothing here is reachable outside a developer's own machine, so the copy is\n// deliberately not translated: it would only add strings for translators to\n// carry.\nexport const ONLY_IN_DEVELOPMENT_TITLE = \"Only in Development (OID).\";\n\nexport const ONLY_IN_DEVELOPMENT_DESCRIPTION =\n \"Many times in development we have to do repetitive tasks. This helps in \" +\n \"expediting the development work. This feature will not be available in \" +\n \"non-development environments.\";\n"],"names":["ONLY_IN_DEVELOPMENT_COLORS","accent","fill","heading","body","rule","ONLY_IN_DEVELOPMENT_TITLE","ONLY_IN_DEVELOPMENT_DESCRIPTION"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,0BAA0B,GAAG;AACxCC,EAAAA,MAAM,EAAE,SAAS;AACjBC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,IAAI,EAAE;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,yBAAyB,GAAG;IAE5BC,+BAA+B,GAC1C,0EAA0E,GAC1E,yEAAyE,GACzE;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Two independent signals, and both have to say development.
|
|
2
|
+
//
|
|
3
|
+
// `process.env.RAILS_ENV` is the build-time signal. A production build of the
|
|
4
|
+
// host app substitutes it while bundling, so the check compiles to the
|
|
5
|
+
// constant `"production" === "development"`. The host's dev server does not
|
|
6
|
+
// rewrite dependencies; there the expression is left as is and reads the
|
|
7
|
+
// value the dev server exposes at runtime, which is the same `RAILS_ENV`.
|
|
8
|
+
//
|
|
9
|
+
// `globalProps.railsEnv` is the runtime signal: `Rails.env` as the host's
|
|
10
|
+
// server reports it in the shared client props
|
|
11
|
+
// (`NeetoCommonsBackend::ClientPropsHelper#common_props`). It covers what the
|
|
12
|
+
// build-time constant cannot: a development bundle somehow served by a
|
|
13
|
+
// non-development host.
|
|
14
|
+
//
|
|
15
|
+
// Neither is trusted on its own. A server that sends no `rails_env`, or a
|
|
16
|
+
// page that has not initialized `globalProps` yet, reads as "not
|
|
17
|
+
// development".
|
|
18
|
+
//
|
|
19
|
+
// What this does NOT do is keep the wrapped markup out of the host's bundle.
|
|
20
|
+
// Whatever a caller wraps still ships to production — it just never renders.
|
|
21
|
+
// So treat anything placed inside `OnlyInDevelopment` as readable by anyone
|
|
22
|
+
// who opens the bundle: fixtures and shortcuts, never a credential, an
|
|
23
|
+
// internal endpoint, or an unreleased feature's copy.
|
|
24
|
+
var isDevelopment = function isDevelopment() {
|
|
25
|
+
var _window$globalProps;
|
|
26
|
+
return process.env.RAILS_ENV === "development" && ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.railsEnv) === "development";
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { isDevelopment };
|
|
30
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/react-utils/OnlyInDevelopment/utils.js"],"sourcesContent":["// Two independent signals, and both have to say development.\n//\n// `process.env.RAILS_ENV` is the build-time signal. A production build of the\n// host app substitutes it while bundling, so the check compiles to the\n// constant `\"production\" === \"development\"`. The host's dev server does not\n// rewrite dependencies; there the expression is left as is and reads the\n// value the dev server exposes at runtime, which is the same `RAILS_ENV`.\n//\n// `globalProps.railsEnv` is the runtime signal: `Rails.env` as the host's\n// server reports it in the shared client props\n// (`NeetoCommonsBackend::ClientPropsHelper#common_props`). It covers what the\n// build-time constant cannot: a development bundle somehow served by a\n// non-development host.\n//\n// Neither is trusted on its own. A server that sends no `rails_env`, or a\n// page that has not initialized `globalProps` yet, reads as \"not\n// development\".\n//\n// What this does NOT do is keep the wrapped markup out of the host's bundle.\n// Whatever a caller wraps still ships to production — it just never renders.\n// So treat anything placed inside `OnlyInDevelopment` as readable by anyone\n// who opens the bundle: fixtures and shortcuts, never a credential, an\n// internal endpoint, or an unreleased feature's copy.\nexport const isDevelopment = () =>\n process.env.RAILS_ENV === \"development\" &&\n window.globalProps?.railsEnv === \"development\";\n"],"names":["isDevelopment","_window$globalProps","process","env","RAILS_ENV","window","globalProps","railsEnv"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,GAAA;AAAA,EAAA,IAAAC,mBAAA;EAAA,OACxBC,OAAO,CAACC,GAAG,CAACC,SAAS,KAAK,aAAa,IACvC,CAAA,CAAAH,mBAAA,GAAAI,MAAM,CAACC,WAAW,MAAA,IAAA,IAAAL,mBAAA,uBAAlBA,mBAAA,CAAoBM,QAAQ,MAAK,aAAa;AAAA;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as HoneybadgerErrorBoundary } from './HoneybadgerErrorBoundary/HoneybadgerErrorBoundary.js';
|
|
2
2
|
export { default as PrivateRoute } from './PrivateRoute/PrivateRoute.js';
|
|
3
3
|
export { default as PageTitle } from './PageTitle/PageTitle.js';
|
|
4
|
+
export { default as OnlyInDevelopment } from './OnlyInDevelopment/OnlyInDevelopment.js';
|
|
4
5
|
export { default as useDebounce } from './useDebounce/useDebounce.js';
|
|
5
6
|
export { default as useDisplayErrorPage, useErrorDisplayStore } from './useDisplayErrorPage/useDisplayErrorPage.js';
|
|
6
7
|
export { default as useFetchNeetoApps } from './useFetchNeetoApps/useFetchNeetoApps.js';
|
|
@@ -53,6 +54,8 @@ import 'react-router-dom';
|
|
|
53
54
|
import './PrivateRoute/utils.js';
|
|
54
55
|
import './PrivateRoute/constants.js';
|
|
55
56
|
import 'react-helmet';
|
|
57
|
+
import './OnlyInDevelopment/constants.js';
|
|
58
|
+
import './OnlyInDevelopment/utils.js';
|
|
56
59
|
import '../slicedToArray-DmsZvA_9.js';
|
|
57
60
|
import '../unsupportedIterableToArray-Dqz8Y8_I.js';
|
|
58
61
|
import 'zustand';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Children } from 'react';
|
|
2
|
+
import { ONLY_IN_DEVELOPMENT_COLORS, ONLY_IN_DEVELOPMENT_TITLE, ONLY_IN_DEVELOPMENT_DESCRIPTION } from './constants.js';
|
|
3
|
+
import { isDevelopment } from './utils.js';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var OnlyInDevelopment = function OnlyInDevelopment(_ref) {
|
|
7
|
+
var title = _ref.title,
|
|
8
|
+
description = _ref.description,
|
|
9
|
+
children = _ref.children;
|
|
10
|
+
if (!isDevelopment()) return null;
|
|
11
|
+
var accent = ONLY_IN_DEVELOPMENT_COLORS.accent,
|
|
12
|
+
fill = ONLY_IN_DEVELOPMENT_COLORS.fill,
|
|
13
|
+
heading = ONLY_IN_DEVELOPMENT_COLORS.heading,
|
|
14
|
+
body = ONLY_IN_DEVELOPMENT_COLORS.body,
|
|
15
|
+
rule = ONLY_IN_DEVELOPMENT_COLORS.rule;
|
|
16
|
+
|
|
17
|
+
// `Children.toArray` drops null, undefined and booleans and flattens
|
|
18
|
+
// arrays, so a caller that maps an empty list into the slot gets no rule
|
|
19
|
+
// and no empty gap beneath the copy. (An empty fragment still counts as
|
|
20
|
+
// one child; there is no way to see inside it without rendering.)
|
|
21
|
+
var hasChildren = Children.toArray(children).length > 0;
|
|
22
|
+
return /*#__PURE__*/jsxs("div", {
|
|
23
|
+
className: "flex items-start gap-3 rounded border-2 border-dashed px-5 py-4",
|
|
24
|
+
style: {
|
|
25
|
+
borderColor: accent,
|
|
26
|
+
backgroundColor: fill
|
|
27
|
+
},
|
|
28
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white",
|
|
31
|
+
style: {
|
|
32
|
+
backgroundColor: accent
|
|
33
|
+
},
|
|
34
|
+
children: "!"
|
|
35
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
36
|
+
className: "flex min-w-0 flex-col gap-1.5",
|
|
37
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
38
|
+
className: "text-sm font-bold",
|
|
39
|
+
style: {
|
|
40
|
+
color: heading
|
|
41
|
+
},
|
|
42
|
+
children: title !== null && title !== void 0 ? title : ONLY_IN_DEVELOPMENT_TITLE
|
|
43
|
+
}), /*#__PURE__*/jsx("p", {
|
|
44
|
+
className: "m-0 max-w-[76ch] text-sm leading-relaxed",
|
|
45
|
+
style: {
|
|
46
|
+
color: body
|
|
47
|
+
},
|
|
48
|
+
children: description !== null && description !== void 0 ? description : ONLY_IN_DEVELOPMENT_DESCRIPTION
|
|
49
|
+
}), hasChildren && /*#__PURE__*/jsx("div", {
|
|
50
|
+
className: "mt-2 border-t pt-3",
|
|
51
|
+
style: {
|
|
52
|
+
borderColor: rule
|
|
53
|
+
},
|
|
54
|
+
children: children
|
|
55
|
+
})]
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { OnlyInDevelopment as default };
|
|
61
|
+
//# sourceMappingURL=OnlyInDevelopment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnlyInDevelopment.js","sources":["../../../../src/v2/react-utils/OnlyInDevelopment/OnlyInDevelopment.jsx"],"sourcesContent":["import { Children } from \"react\";\n\nimport PropTypes from \"prop-types\";\n\nimport {\n ONLY_IN_DEVELOPMENT_COLORS,\n ONLY_IN_DEVELOPMENT_DESCRIPTION,\n ONLY_IN_DEVELOPMENT_TITLE,\n} from \"./constants\";\nimport { isDevelopment } from \"./utils\";\n\n// Renders nothing at all outside development, so a caller never guards its\n// own usage: wrapping *is* the guard. `children` is the action slot beneath\n// the rule, where the design puts its secondary block.\n//\n// Guarded is not the same as absent: whatever you wrap still ships in the\n// host's bundle, it just never renders. `utils.js` has the details.\n//\n// Pairs with `Rails.env.development?` on the server. Both sides check — see\n// `utils.js` for why one signal is not enough.\nconst OnlyInDevelopment = ({ title, description, children }) => {\n if (!isDevelopment()) return null;\n\n const { accent, fill, heading, body, rule } = ONLY_IN_DEVELOPMENT_COLORS;\n\n // `Children.toArray` drops null, undefined and booleans and flattens\n // arrays, so a caller that maps an empty list into the slot gets no rule\n // and no empty gap beneath the copy. (An empty fragment still counts as\n // one child; there is no way to see inside it without rendering.)\n const hasChildren = Children.toArray(children).length > 0;\n\n return (\n <div\n className=\"flex items-start gap-3 rounded border-2 border-dashed px-5 py-4\"\n style={{ borderColor: accent, backgroundColor: fill }}\n >\n <span\n aria-hidden=\"true\"\n className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white\"\n style={{ backgroundColor: accent }}\n >\n !\n </span>\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n <div className=\"text-sm font-bold\" style={{ color: heading }}>\n {title ?? ONLY_IN_DEVELOPMENT_TITLE}\n </div>\n <p\n className=\"m-0 max-w-[76ch] text-sm leading-relaxed\"\n style={{ color: body }}\n >\n {description ?? ONLY_IN_DEVELOPMENT_DESCRIPTION}\n </p>\n {hasChildren && (\n <div className=\"mt-2 border-t pt-3\" style={{ borderColor: rule }}>\n {children}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nOnlyInDevelopment.propTypes = {\n /**\n * Heading of the banner. Defaults to \"Only in Development (OID).\"\n */\n title: PropTypes.string,\n /**\n * Copy under the heading. Defaults to a short note on why the block exists.\n */\n description: PropTypes.string,\n /**\n * Action slot rendered beneath the rule: typically link buttons that fill\n * in fixtures or trigger a shortcut.\n */\n children: PropTypes.node,\n};\n\nexport default OnlyInDevelopment;\n"],"names":["OnlyInDevelopment","_ref","title","description","children","isDevelopment","accent","ONLY_IN_DEVELOPMENT_COLORS","fill","heading","body","rule","hasChildren","Children","toArray","length","_jsxs","className","style","borderColor","backgroundColor","_jsx","color","ONLY_IN_DEVELOPMENT_TITLE","ONLY_IN_DEVELOPMENT_DESCRIPTION"],"mappings":";;;;;AAoBA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAAyC;AAAA,EAAA,IAAnCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IAAEC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;AACvD,EAAA,IAAI,CAACC,aAAa,EAAE,EAAE,OAAO,IAAI;AAEjC,EAAA,IAAQC,MAAM,GAAgCC,0BAA0B,CAAhED,MAAM;IAAEE,IAAI,GAA0BD,0BAA0B,CAAxDC,IAAI;IAAEC,OAAO,GAAiBF,0BAA0B,CAAlDE,OAAO;IAAEC,IAAI,GAAWH,0BAA0B,CAAzCG,IAAI;IAAEC,IAAI,GAAKJ,0BAA0B,CAAnCI,IAAI;;AAEzC;AACA;AACA;AACA;EACA,IAAMC,WAAW,GAAGC,QAAQ,CAACC,OAAO,CAACV,QAAQ,CAAC,CAACW,MAAM,GAAG,CAAC;AAEzD,EAAA,oBACEC,IAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,SAAS,EAAC,iEAAiE;AAC3EC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,WAAW,EAAEb,MAAM;AAAEc,MAAAA,eAAe,EAAEZ;KAAO;AAAAJ,IAAAA,QAAA,gBAEtDiB,GAAA,CAAA,MAAA,EAAA;AACE,MAAA,aAAA,EAAY,MAAM;AAClBJ,MAAAA,SAAS,EAAC,6FAA6F;AACvGC,MAAAA,KAAK,EAAE;AAAEE,QAAAA,eAAe,EAAEd;OAAS;AAAAF,MAAAA,QAAA,EACpC;KAEK,CAAC,eACPY,IAAA,CAAA,KAAA,EAAA;AAAKC,MAAAA,SAAS,EAAC,+BAA+B;AAAAb,MAAAA,QAAA,gBAC5CiB,GAAA,CAAA,KAAA,EAAA;AAAKJ,QAAAA,SAAS,EAAC,mBAAmB;AAACC,QAAAA,KAAK,EAAE;AAAEI,UAAAA,KAAK,EAAEb;SAAU;AAAAL,QAAAA,QAAA,EAC1DF,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,MAAA,GAALA,KAAK,GAAIqB;OACP,CAAC,eACNF,GAAA,CAAA,GAAA,EAAA;AACEJ,QAAAA,SAAS,EAAC,0CAA0C;AACpDC,QAAAA,KAAK,EAAE;AAAEI,UAAAA,KAAK,EAAEZ;SAAO;AAAAN,QAAAA,QAAA,EAEtBD,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,MAAA,GAAXA,WAAW,GAAIqB;AAA+B,OAC9C,CAAC,EACHZ,WAAW,iBACVS,GAAA,CAAA,KAAA,EAAA;AAAKJ,QAAAA,SAAS,EAAC,oBAAoB;AAACC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,WAAW,EAAER;SAAO;AAAAP,QAAAA,QAAA,EAC9DA;AAAQ,OACN,CACN;AAAA,KACE,CAAC;AAAA,GACH,CAAC;AAEV;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Design: the 1B1C only-in-development banner. The design authored these in
|
|
2
|
+
// oklch; the hexes below are that conversion to sRGB, kept alongside so a
|
|
3
|
+
// later tweak can be checked against the source rather than eyeballed.
|
|
4
|
+
//
|
|
5
|
+
// accent oklch(0.62 0.17 32) fill oklch(0.972 0.032 60)
|
|
6
|
+
// heading oklch(0.40 0.12 35) body oklch(0.45 0.05 45)
|
|
7
|
+
// rule oklch(0.88 0.03 55)
|
|
8
|
+
var ONLY_IN_DEVELOPMENT_COLORS = {
|
|
9
|
+
accent: "#D9553F",
|
|
10
|
+
fill: "#FFF1E1",
|
|
11
|
+
heading: "#7B2813",
|
|
12
|
+
body: "#6D4D3E",
|
|
13
|
+
rule: "#E8D3C5"
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// The banner announces the feature by name rather than describing it, so the
|
|
17
|
+
// heading reads as the label the codebase uses everywhere else — folder,
|
|
18
|
+
// component and constants are all `OnlyInDevelopment`.
|
|
19
|
+
//
|
|
20
|
+
// Nothing here is reachable outside a developer's own machine, so the copy is
|
|
21
|
+
// deliberately not translated: it would only add strings for translators to
|
|
22
|
+
// carry.
|
|
23
|
+
var ONLY_IN_DEVELOPMENT_TITLE = "Only in Development (OID).";
|
|
24
|
+
var ONLY_IN_DEVELOPMENT_DESCRIPTION = "Many times in development we have to do repetitive tasks. This helps in " + "expediting the development work. This feature will not be available in " + "non-development environments.";
|
|
25
|
+
|
|
26
|
+
export { ONLY_IN_DEVELOPMENT_COLORS, ONLY_IN_DEVELOPMENT_DESCRIPTION, ONLY_IN_DEVELOPMENT_TITLE };
|
|
27
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/v2/react-utils/OnlyInDevelopment/constants.js"],"sourcesContent":["// Design: the 1B1C only-in-development banner. The design authored these in\n// oklch; the hexes below are that conversion to sRGB, kept alongside so a\n// later tweak can be checked against the source rather than eyeballed.\n//\n// accent oklch(0.62 0.17 32) fill oklch(0.972 0.032 60)\n// heading oklch(0.40 0.12 35) body oklch(0.45 0.05 45)\n// rule oklch(0.88 0.03 55)\nexport const ONLY_IN_DEVELOPMENT_COLORS = {\n accent: \"#D9553F\",\n fill: \"#FFF1E1\",\n heading: \"#7B2813\",\n body: \"#6D4D3E\",\n rule: \"#E8D3C5\",\n};\n\n// The banner announces the feature by name rather than describing it, so the\n// heading reads as the label the codebase uses everywhere else — folder,\n// component and constants are all `OnlyInDevelopment`.\n//\n// Nothing here is reachable outside a developer's own machine, so the copy is\n// deliberately not translated: it would only add strings for translators to\n// carry.\nexport const ONLY_IN_DEVELOPMENT_TITLE = \"Only in Development (OID).\";\n\nexport const ONLY_IN_DEVELOPMENT_DESCRIPTION =\n \"Many times in development we have to do repetitive tasks. This helps in \" +\n \"expediting the development work. This feature will not be available in \" +\n \"non-development environments.\";\n"],"names":["ONLY_IN_DEVELOPMENT_COLORS","accent","fill","heading","body","rule","ONLY_IN_DEVELOPMENT_TITLE","ONLY_IN_DEVELOPMENT_DESCRIPTION"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,0BAA0B,GAAG;AACxCC,EAAAA,MAAM,EAAE,SAAS;AACjBC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,IAAI,EAAE;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,yBAAyB,GAAG;IAE5BC,+BAA+B,GAC1C,0EAA0E,GAC1E,yEAAyE,GACzE;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Two independent signals, and both have to say development.
|
|
2
|
+
//
|
|
3
|
+
// `process.env.RAILS_ENV` is the build-time signal. A production build of the
|
|
4
|
+
// host app substitutes it while bundling, so the check compiles to the
|
|
5
|
+
// constant `"production" === "development"`. The host's dev server does not
|
|
6
|
+
// rewrite dependencies; there the expression is left as is and reads the
|
|
7
|
+
// value the dev server exposes at runtime, which is the same `RAILS_ENV`.
|
|
8
|
+
//
|
|
9
|
+
// `globalProps.railsEnv` is the runtime signal: `Rails.env` as the host's
|
|
10
|
+
// server reports it in the shared client props
|
|
11
|
+
// (`NeetoCommonsBackend::ClientPropsHelper#common_props`). It covers what the
|
|
12
|
+
// build-time constant cannot: a development bundle somehow served by a
|
|
13
|
+
// non-development host.
|
|
14
|
+
//
|
|
15
|
+
// Neither is trusted on its own. A server that sends no `rails_env`, or a
|
|
16
|
+
// page that has not initialized `globalProps` yet, reads as "not
|
|
17
|
+
// development".
|
|
18
|
+
//
|
|
19
|
+
// What this does NOT do is keep the wrapped markup out of the host's bundle.
|
|
20
|
+
// Whatever a caller wraps still ships to production — it just never renders.
|
|
21
|
+
// So treat anything placed inside `OnlyInDevelopment` as readable by anyone
|
|
22
|
+
// who opens the bundle: fixtures and shortcuts, never a credential, an
|
|
23
|
+
// internal endpoint, or an unreleased feature's copy.
|
|
24
|
+
var isDevelopment = function isDevelopment() {
|
|
25
|
+
var _window$globalProps;
|
|
26
|
+
return process.env.RAILS_ENV === "development" && ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.railsEnv) === "development";
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { isDevelopment };
|
|
30
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/v2/react-utils/OnlyInDevelopment/utils.js"],"sourcesContent":["// Two independent signals, and both have to say development.\n//\n// `process.env.RAILS_ENV` is the build-time signal. A production build of the\n// host app substitutes it while bundling, so the check compiles to the\n// constant `\"production\" === \"development\"`. The host's dev server does not\n// rewrite dependencies; there the expression is left as is and reads the\n// value the dev server exposes at runtime, which is the same `RAILS_ENV`.\n//\n// `globalProps.railsEnv` is the runtime signal: `Rails.env` as the host's\n// server reports it in the shared client props\n// (`NeetoCommonsBackend::ClientPropsHelper#common_props`). It covers what the\n// build-time constant cannot: a development bundle somehow served by a\n// non-development host.\n//\n// Neither is trusted on its own. A server that sends no `rails_env`, or a\n// page that has not initialized `globalProps` yet, reads as \"not\n// development\".\n//\n// What this does NOT do is keep the wrapped markup out of the host's bundle.\n// Whatever a caller wraps still ships to production — it just never renders.\n// So treat anything placed inside `OnlyInDevelopment` as readable by anyone\n// who opens the bundle: fixtures and shortcuts, never a credential, an\n// internal endpoint, or an unreleased feature's copy.\nexport const isDevelopment = () =>\n process.env.RAILS_ENV === \"development\" &&\n window.globalProps?.railsEnv === \"development\";\n"],"names":["isDevelopment","_window$globalProps","process","env","RAILS_ENV","window","globalProps","railsEnv"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,GAAA;AAAA,EAAA,IAAAC,mBAAA;EAAA,OACxBC,OAAO,CAACC,GAAG,CAACC,SAAS,KAAK,aAAa,IACvC,CAAA,CAAAH,mBAAA,GAAAI,MAAM,CAACC,WAAW,MAAA,IAAA,IAAAL,mBAAA,uBAAlBA,mBAAA,CAAoBM,QAAQ,MAAK,aAAa;AAAA;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as HoneybadgerErrorBoundary } from './HoneybadgerErrorBoundary/HoneybadgerErrorBoundary.js';
|
|
2
2
|
export { default as PrivateRoute } from './PrivateRoute/PrivateRoute.js';
|
|
3
3
|
export { default as PageTitle } from './PageTitle/PageTitle.js';
|
|
4
|
+
export { default as OnlyInDevelopment } from './OnlyInDevelopment/OnlyInDevelopment.js';
|
|
4
5
|
export { default as useDebounce } from './useDebounce/useDebounce.js';
|
|
5
6
|
export { default as useDisplayErrorPage, useErrorDisplayStore } from './useDisplayErrorPage/useDisplayErrorPage.js';
|
|
6
7
|
export { default as useFetchNeetoApps } from './useFetchNeetoApps/useFetchNeetoApps.js';
|
|
@@ -52,6 +53,8 @@ import 'react-router-dom';
|
|
|
52
53
|
import './PrivateRoute/utils.js';
|
|
53
54
|
import './PrivateRoute/constants.js';
|
|
54
55
|
import 'react-helmet';
|
|
56
|
+
import './OnlyInDevelopment/constants.js';
|
|
57
|
+
import './OnlyInDevelopment/utils.js';
|
|
55
58
|
import '../../slicedToArray-DmsZvA_9.js';
|
|
56
59
|
import '../../unsupportedIterableToArray-Dqz8Y8_I.js';
|
|
57
60
|
import 'zustand';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.156",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
package/react-utils.d.ts
CHANGED
|
@@ -207,6 +207,69 @@ type OptionsType = {
|
|
|
207
207
|
export const PageTitle: React.FC<{
|
|
208
208
|
title?: string;
|
|
209
209
|
}>;
|
|
210
|
+
/**
|
|
211
|
+
*
|
|
212
|
+
* A banner for developer-only affordances such as "fill in sample records"
|
|
213
|
+
*
|
|
214
|
+
* links. It renders its children inside a dashed "Only in Development (OID)."
|
|
215
|
+
*
|
|
216
|
+
* block, and renders nothing at all outside development, so wrapping a block in
|
|
217
|
+
*
|
|
218
|
+
* it is the only guard a caller needs.
|
|
219
|
+
*
|
|
220
|
+
* Development is established by two independent signals, both of which must
|
|
221
|
+
*
|
|
222
|
+
* agree: the build-time RAILS_ENV the host app was bundled with, and the
|
|
223
|
+
*
|
|
224
|
+
* runtime railsEnv the host's server reports in the shared client props
|
|
225
|
+
*
|
|
226
|
+
* (NeetoCommonsBackend::ClientPropsHelper#common_props). A server that sends no
|
|
227
|
+
*
|
|
228
|
+
* environment reads as "not development".
|
|
229
|
+
*
|
|
230
|
+
* Note: This is a render-time guard, not a code-stripping transformation.
|
|
231
|
+
*
|
|
232
|
+
* Whatever is wrapped still ships in the host's production bundle; it just never
|
|
233
|
+
*
|
|
234
|
+
* renders there, and anyone who opens the bundle can read it. Put fixtures and
|
|
235
|
+
*
|
|
236
|
+
* shortcuts inside it, never a credential, an internal endpoint, or an unreleased
|
|
237
|
+
*
|
|
238
|
+
* feature's copy.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
*
|
|
242
|
+
* import { Button } from "@bigbinary/neetoui";
|
|
243
|
+
* import { OnlyInDevelopment } from "@bigbinary/neeto-commons-frontend/react-utils";
|
|
244
|
+
*
|
|
245
|
+
* const AddSigners = ({ setFieldValue }) => (
|
|
246
|
+
* <>
|
|
247
|
+
* <OnlyInDevelopment>
|
|
248
|
+
* <Button
|
|
249
|
+
* label="Add sample records: two signers"
|
|
250
|
+
* style="link"
|
|
251
|
+
* onClick={() => setFieldValue("signers", SAMPLE_SIGNERS)}
|
|
252
|
+
* />
|
|
253
|
+
* </OnlyInDevelopment>
|
|
254
|
+
* <SignerList />
|
|
255
|
+
* </>
|
|
256
|
+
* );
|
|
257
|
+
* @endexample
|
|
258
|
+
* The title and description can be replaced when the default copy does not fit:
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
*
|
|
262
|
+
* <OnlyInDevelopment
|
|
263
|
+
* description="NeetoAuth is not running on port 9000, so client apps cannot be listed."
|
|
264
|
+
* title="Only in Development (OID): NeetoAuth is unreachable."
|
|
265
|
+
* />
|
|
266
|
+
* @endexample
|
|
267
|
+
*/
|
|
268
|
+
export const OnlyInDevelopment: React.FC<{
|
|
269
|
+
title?: string;
|
|
270
|
+
description?: string;
|
|
271
|
+
children?: ReactNode;
|
|
272
|
+
}>;
|
|
210
273
|
/**
|
|
211
274
|
*
|
|
212
275
|
* The useIsElementVisibleInDom hook is a utility that allows you to determine
|