react-super-switch 1.0.6 → 1.0.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
|
@@ -131,9 +131,10 @@ The parent component that evaluates all `<Option />` children and decides which
|
|
|
131
131
|
<SuperSwitch mode="fcfs | priority">{options}</SuperSwitch>
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
| Prop
|
|
135
|
-
|
|
|
136
|
-
| `mode`
|
|
134
|
+
| Prop | Type | Default | Description |
|
|
135
|
+
| ---------- | ------------------------ | -------- | --------------------------------------------------------------------------- |
|
|
136
|
+
| `mode` | `"fcfs"` or `"priority"` | `"fcfs"` | Determines how options are evaluated |
|
|
137
|
+
| `optional` | `boolean` | `false` | Allows the switch to render nothing when all `Option` conditions are falsy. |
|
|
137
138
|
|
|
138
139
|
### `<Option />`
|
|
139
140
|
|
|
@@ -4,7 +4,8 @@ import type { OptionChild } from "./types";
|
|
|
4
4
|
export type SuperSwitchProps = {
|
|
5
5
|
children: ReactElement<OptionProps> | ReactElement<OptionProps>[];
|
|
6
6
|
mode?: "priority" | "fcfs";
|
|
7
|
+
optional?: boolean;
|
|
7
8
|
};
|
|
8
|
-
declare const SuperSwitch: ({ children, mode }: SuperSwitchProps) => OptionChild | null;
|
|
9
|
+
declare const SuperSwitch: ({ children, mode, optional }: SuperSwitchProps) => OptionChild | null;
|
|
9
10
|
export default SuperSwitch;
|
|
10
11
|
//# sourceMappingURL=SuperSwitch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperSwitch.d.ts","sourceRoot":"","sources":["../../../src/components/SuperSwitch/SuperSwitch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,YAAY,CAAC,WAAW,CAAC,GAAG,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;IAClE,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"SuperSwitch.d.ts","sourceRoot":"","sources":["../../../src/components/SuperSwitch/SuperSwitch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,YAAY,CAAC,WAAW,CAAC,GAAG,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;IAClE,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,WAAW,GAAI,8BAA+C,gBAAgB,uBA6CnF,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react");var T={exports:{}},_={};var M;function ne(){if(M)return _;M=1;var i=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function c(l,n,s){var d=null;if(s!==void 0&&(d=""+s),n.key!==void 0&&(d=""+n.key),"key"in n){s={};for(var p in n)p!=="key"&&(s[p]=n[p])}else s=n;return n=s.ref,{$$typeof:i,type:l,key:d,ref:n!==void 0?n:null,props:s}}return _.Fragment=f,_.jsx=c,_.jsxs=c,_}var m={};var F;function oe(){return F||(F=1,process.env.NODE_ENV!=="production"&&(function(){function i(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case J:return"Profiler";case G:return"StrictMode";case X:return"Suspense";case Z:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case q:return"Portal";case B:return e.displayName||"Context";case z:return(e._context.displayName||"Context")+".Consumer";case H:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Q:return r=e.displayName||null,r!==null?r:i(e.type)||"Memo";case S:r=e._payload,e=e._init;try{return i(e(r))}catch{}}return null}function f(e){return""+e}function c(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,o=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),f(e)}}function l(e){if(e===O)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===S)return"<...>";try{var r=i(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function n(){var e=y.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function d(e){if(x.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function p(e,r){function t(){C||(C=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function u(){var e=i(this.type);return Y[e]||(Y[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function N(e,r,t,o,v,w){var a=t.ref;return e={$$typeof:j,type:e,key:r,props:t,_owner:o},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:u}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:v}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:w}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function A(e,r,t,o,v,w){var a=r.children;if(a!==void 0)if(o)if(re(a)){for(o=0;o<a.length;o++)I(a[o]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else I(a);if(x.call(r,"key")){a=i(e);var E=Object.keys(r).filter(function(te){return te!=="key"});o=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",$[a+o]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,o,a,E,a),$[a+o]=!0)}if(a=null,t!==void 0&&(
|
|
6
|
+
<%s key={someKey} {...props} />`,o,a,E,a),$[a+o]=!0)}if(a=null,t!==void 0&&(c(t),a=""+t),d(r)&&(c(r.key),a=""+r.key),"key"in r){t={};for(var h in r)h!=="key"&&(t[h]=r[h])}else t=r;return a&&p(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),N(e,a,t,n(),v,w)}function I(e){g(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===S&&(e._payload.status==="fulfilled"?g(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function g(e){return typeof e=="object"&&e!==null&&e.$$typeof===j}var R=k,j=Symbol.for("react.transitional.element"),q=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),B=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),ee=Symbol.for("react.client.reference"),y=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,x=Object.prototype.hasOwnProperty,re=Array.isArray,P=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(e){return e()}};var C,Y={},D=R.react_stack_bottom_frame.bind(R,s)(),L=P(l(s)),$={};m.Fragment=O,m.jsx=function(e,r,t){var o=1e4>y.recentlyCreatedOwnerStacks++;return A(e,r,t,!1,o?Error("react-stack-top-frame"):D,o?P(l(e)):L)},m.jsxs=function(e,r,t){var o=1e4>y.recentlyCreatedOwnerStacks++;return A(e,r,t,!0,o?Error("react-stack-top-frame"):D,o?P(l(e)):L)}})()),m}var V;function ae(){return V||(V=1,process.env.NODE_ENV==="production"?T.exports=ne():T.exports=oe()),T.exports}var W=ae();const U=({children:i})=>W.jsx(W.Fragment,{children:i}),b={INVALID_CHILDREN_TYPE:"SuperSwitch only accepts <Option /> as children. Received an invalid child instead.",MISSING_PRIORITIES:'SuperSwitch is running in "priority" mode, but not all <Option /> elements define a priority. When using priority mode, every <Option /> must specify a numeric "priority" prop.',NO_OPTION_TO_RENDER:"SuperSwitch could not determine which option to render. No <Option /> had a truthy condition, and no default option was provided.",INVALID_OPTION_PROPS:'Invalid <Option />: "default" and "condition" cannot be used together. Use "default" for the fallback option, or "condition" for conditional options.'},ie=i=>i.sort((f,c)=>{const l=f.props?.priority,n=c.props?.priority;return l===void 0&&n===void 0?0:l===void 0?1:n===void 0||l<n?-1:l>n?1:0}),se=({children:i,mode:f="fcfs",optional:c=!1})=>k.useMemo(()=>{const n=[];let s=!0;k.Children.forEach(i,u=>{if(!(u?.type===U))throw new Error(b.INVALID_CHILDREN_TYPE);if(u.props.default&&"condition"in u.props)throw new Error(b.INVALID_OPTION_PROPS);n.push(u),u.props.priority===void 0&&(s=!1)});let d=n;if(f==="priority"){if(!s)throw new Error(b.MISSING_PRIORITIES);d=ie([...n])}const p=d.find(u=>!!u.props.condition&&!u.props.default)??d.find(u=>!!u.props.default);if(!p){if(c)return null;throw new Error(b.NO_OPTION_TO_RENDER)}return p},[i,f,c]);exports.Option=U;exports.SuperSwitch=se;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import re, {
|
|
1
|
+
import re, { useMemo as te, Children as ne } from "react";
|
|
2
2
|
var T = { exports: {} }, _ = {};
|
|
3
3
|
var $;
|
|
4
|
-
function
|
|
4
|
+
function oe() {
|
|
5
5
|
if ($) return _;
|
|
6
6
|
$ = 1;
|
|
7
|
-
var i = /* @__PURE__ */ Symbol.for("react.transitional.element"),
|
|
8
|
-
function
|
|
7
|
+
var i = /* @__PURE__ */ Symbol.for("react.transitional.element"), f = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
8
|
+
function c(l, n, s) {
|
|
9
9
|
var d = null;
|
|
10
10
|
if (s !== void 0 && (d = "" + s), n.key !== void 0 && (d = "" + n.key), "key" in n) {
|
|
11
11
|
s = {};
|
|
@@ -20,11 +20,11 @@ function ae() {
|
|
|
20
20
|
props: s
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
return _.Fragment =
|
|
23
|
+
return _.Fragment = f, _.jsx = c, _.jsxs = c, _;
|
|
24
24
|
}
|
|
25
|
-
var
|
|
25
|
+
var m = {};
|
|
26
26
|
var F;
|
|
27
|
-
function
|
|
27
|
+
function ae() {
|
|
28
28
|
return F || (F = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
29
29
|
function i(e) {
|
|
30
30
|
if (e == null) return null;
|
|
@@ -69,12 +69,12 @@ function ie() {
|
|
|
69
69
|
}
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function f(e) {
|
|
73
73
|
return "" + e;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function c(e) {
|
|
76
76
|
try {
|
|
77
|
-
|
|
77
|
+
f(e);
|
|
78
78
|
var r = !1;
|
|
79
79
|
} catch {
|
|
80
80
|
r = !0;
|
|
@@ -86,7 +86,7 @@ function ie() {
|
|
|
86
86
|
r,
|
|
87
87
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
88
88
|
o
|
|
89
|
-
),
|
|
89
|
+
), f(e);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
function l(e) {
|
|
@@ -132,7 +132,7 @@ function ie() {
|
|
|
132
132
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
133
133
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
134
134
|
}
|
|
135
|
-
function k(e, r, t, o, v,
|
|
135
|
+
function k(e, r, t, o, v, w) {
|
|
136
136
|
var a = t.ref;
|
|
137
137
|
return e = {
|
|
138
138
|
$$typeof: g,
|
|
@@ -162,10 +162,10 @@ function ie() {
|
|
|
162
162
|
configurable: !1,
|
|
163
163
|
enumerable: !1,
|
|
164
164
|
writable: !0,
|
|
165
|
-
value:
|
|
165
|
+
value: w
|
|
166
166
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
167
167
|
}
|
|
168
|
-
function N(e, r, t, o, v,
|
|
168
|
+
function N(e, r, t, o, v, w) {
|
|
169
169
|
var a = r.children;
|
|
170
170
|
if (a !== void 0)
|
|
171
171
|
if (o)
|
|
@@ -196,10 +196,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
196
196
|
a
|
|
197
197
|
), L[a + o] = !0);
|
|
198
198
|
}
|
|
199
|
-
if (a = null, t !== void 0 && (
|
|
199
|
+
if (a = null, t !== void 0 && (c(t), a = "" + t), d(r) && (c(r.key), a = "" + r.key), "key" in r) {
|
|
200
200
|
t = {};
|
|
201
|
-
for (var
|
|
202
|
-
|
|
201
|
+
for (var h in r)
|
|
202
|
+
h !== "key" && (t[h] = r[h]);
|
|
203
203
|
} else t = r;
|
|
204
204
|
return a && p(
|
|
205
205
|
t,
|
|
@@ -210,7 +210,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
210
210
|
t,
|
|
211
211
|
n(),
|
|
212
212
|
v,
|
|
213
|
-
|
|
213
|
+
w
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
216
|
function A(e) {
|
|
@@ -219,19 +219,19 @@ React keys must be passed directly to JSX without using spread:
|
|
|
219
219
|
function I(e) {
|
|
220
220
|
return typeof e == "object" && e !== null && e.$$typeof === g;
|
|
221
221
|
}
|
|
222
|
-
var
|
|
222
|
+
var R = re, g = /* @__PURE__ */ Symbol.for("react.transitional.element"), W = /* @__PURE__ */ Symbol.for("react.portal"), O = /* @__PURE__ */ Symbol.for("react.fragment"), U = /* @__PURE__ */ Symbol.for("react.strict_mode"), G = /* @__PURE__ */ Symbol.for("react.profiler"), q = /* @__PURE__ */ Symbol.for("react.consumer"), J = /* @__PURE__ */ Symbol.for("react.context"), z = /* @__PURE__ */ Symbol.for("react.forward_ref"), B = /* @__PURE__ */ Symbol.for("react.suspense"), H = /* @__PURE__ */ Symbol.for("react.suspense_list"), X = /* @__PURE__ */ Symbol.for("react.memo"), S = /* @__PURE__ */ Symbol.for("react.lazy"), Z = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), y = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, x = Object.prototype.hasOwnProperty, K = Array.isArray, P = console.createTask ? console.createTask : function() {
|
|
223
223
|
return null;
|
|
224
224
|
};
|
|
225
|
-
|
|
225
|
+
R = {
|
|
226
226
|
react_stack_bottom_frame: function(e) {
|
|
227
227
|
return e();
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
|
-
var j, C = {}, Y =
|
|
231
|
-
|
|
230
|
+
var j, C = {}, Y = R.react_stack_bottom_frame.bind(
|
|
231
|
+
R,
|
|
232
232
|
s
|
|
233
233
|
)(), D = P(l(s)), L = {};
|
|
234
|
-
|
|
234
|
+
m.Fragment = O, m.jsx = function(e, r, t) {
|
|
235
235
|
var o = 1e4 > y.recentlyCreatedOwnerStacks++;
|
|
236
236
|
return N(
|
|
237
237
|
e,
|
|
@@ -241,7 +241,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
241
241
|
o ? Error("react-stack-top-frame") : Y,
|
|
242
242
|
o ? P(l(e)) : D
|
|
243
243
|
);
|
|
244
|
-
},
|
|
244
|
+
}, m.jsxs = function(e, r, t) {
|
|
245
245
|
var o = 1e4 > y.recentlyCreatedOwnerStacks++;
|
|
246
246
|
return N(
|
|
247
247
|
e,
|
|
@@ -252,46 +252,45 @@ React keys must be passed directly to JSX without using spread:
|
|
|
252
252
|
o ? P(l(e)) : D
|
|
253
253
|
);
|
|
254
254
|
};
|
|
255
|
-
})()),
|
|
255
|
+
})()), m;
|
|
256
256
|
}
|
|
257
257
|
var M;
|
|
258
|
-
function
|
|
259
|
-
return M || (M = 1, process.env.NODE_ENV === "production" ? T.exports =
|
|
258
|
+
function ie() {
|
|
259
|
+
return M || (M = 1, process.env.NODE_ENV === "production" ? T.exports = oe() : T.exports = ae()), T.exports;
|
|
260
260
|
}
|
|
261
|
-
var V =
|
|
262
|
-
const
|
|
261
|
+
var V = ie();
|
|
262
|
+
const se = ({ children: i }) => /* @__PURE__ */ V.jsx(V.Fragment, { children: i }), b = {
|
|
263
263
|
INVALID_CHILDREN_TYPE: "SuperSwitch only accepts <Option /> as children. Received an invalid child instead.",
|
|
264
264
|
MISSING_PRIORITIES: 'SuperSwitch is running in "priority" mode, but not all <Option /> elements define a priority. When using priority mode, every <Option /> must specify a numeric "priority" prop.',
|
|
265
265
|
NO_OPTION_TO_RENDER: "SuperSwitch could not determine which option to render. No <Option /> had a truthy condition, and no default option was provided.",
|
|
266
266
|
INVALID_OPTION_PROPS: 'Invalid <Option />: "default" and "condition" cannot be used together. Use "default" for the fallback option, or "condition" for conditional options.'
|
|
267
|
-
}, ue = (i) => i.sort((
|
|
268
|
-
const l =
|
|
267
|
+
}, ue = (i) => i.sort((f, c) => {
|
|
268
|
+
const l = f.props?.priority, n = c.props?.priority;
|
|
269
269
|
return l === void 0 && n === void 0 ? 0 : l === void 0 ? 1 : n === void 0 || l < n ? -1 : l > n ? 1 : 0;
|
|
270
|
-
}),
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
};
|
|
270
|
+
}), ce = ({ children: i, mode: f = "fcfs", optional: c = !1 }) => te(() => {
|
|
271
|
+
const n = [];
|
|
272
|
+
let s = !0;
|
|
273
|
+
ne.forEach(i, (u) => {
|
|
274
|
+
if (!(u?.type === se))
|
|
275
|
+
throw new Error(b.INVALID_CHILDREN_TYPE);
|
|
276
|
+
if (u.props.default && "condition" in u.props)
|
|
277
|
+
throw new Error(b.INVALID_OPTION_PROPS);
|
|
278
|
+
n.push(u), u.props.priority === void 0 && (s = !1);
|
|
279
|
+
});
|
|
280
|
+
let d = n;
|
|
281
|
+
if (f === "priority") {
|
|
282
|
+
if (!s)
|
|
283
|
+
throw new Error(b.MISSING_PRIORITIES);
|
|
284
|
+
d = ue([...n]);
|
|
285
|
+
}
|
|
286
|
+
const p = d.find((u) => !!u.props.condition && !u.props.default) ?? d.find((u) => !!u.props.default);
|
|
287
|
+
if (!p) {
|
|
288
|
+
if (c) return null;
|
|
289
|
+
throw new Error(b.NO_OPTION_TO_RENDER);
|
|
290
|
+
}
|
|
291
|
+
return p;
|
|
292
|
+
}, [i, f, c]);
|
|
294
293
|
export {
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
se as Option,
|
|
295
|
+
ce as SuperSwitch
|
|
297
296
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-super-switch",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deterministic conditional rendering for React. Render exactly one option from multiple independent conditions, with explicit priority and fail-fast guarantees.",
|
|
6
6
|
"author": {
|