@nswds/app 1.126.13 → 1.126.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -14414,7 +14414,7 @@ function FormatToggle({ format, setFormat }) {
14414
14414
 
14415
14415
  // package.json
14416
14416
  var package_default = {
14417
- version: "1.126.13"};
14417
+ version: "1.126.14"};
14418
14418
  var SluggerContext = React5__default.createContext(null);
14419
14419
  function flattenText(nodes) {
14420
14420
  if (nodes == null || typeof nodes === "boolean") return "";
@@ -29242,12 +29242,39 @@ var BranchPage = ({ className, ...props }) => {
29242
29242
  };
29243
29243
  var useLayoutEffect22 = globalThis?.document ? React5.useLayoutEffect : () => {
29244
29244
  };
29245
+ var __defProp = Object.defineProperty;
29246
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
29247
+ var useReactEffectEvent = React5[" useEffectEvent ".trim().toString()];
29248
+ var useReactInsertionEffect = React5[" useInsertionEffect ".trim().toString()];
29249
+ function useEffectEvent(callback) {
29250
+ if (typeof useReactEffectEvent === "function") {
29251
+ return useReactEffectEvent(callback);
29252
+ }
29253
+ const ref = React5.useRef(() => {
29254
+ throw new Error("Cannot call an event handler while rendering.");
29255
+ });
29256
+ if (typeof useReactInsertionEffect === "function") {
29257
+ useReactInsertionEffect(() => {
29258
+ ref.current = callback;
29259
+ });
29260
+ } else {
29261
+ useLayoutEffect22(() => {
29262
+ ref.current = callback;
29263
+ });
29264
+ }
29265
+ return React5.useMemo(() => ((...args) => ref.current?.(...args)), []);
29266
+ }
29267
+ __name(useEffectEvent, "useEffectEvent");
29268
+
29269
+ // node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
29270
+ var __defProp2 = Object.defineProperty;
29271
+ var __name2 = (target, value) => __defProp2(target, "name", { value, configurable: true });
29245
29272
  var useInsertionEffect3 = React5[" useInsertionEffect ".trim().toString()] || useLayoutEffect22;
29246
29273
  function useControllableState({
29247
29274
  prop,
29248
29275
  defaultProp,
29249
- onChange = () => {
29250
- },
29276
+ onChange = /* @__PURE__ */ __name2(() => {
29277
+ }, "onChange"),
29251
29278
  caller
29252
29279
  }) {
29253
29280
  const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
@@ -29256,20 +29283,6 @@ function useControllableState({
29256
29283
  });
29257
29284
  const isControlled = prop !== void 0;
29258
29285
  const value = isControlled ? prop : uncontrolledProp;
29259
- {
29260
- const isControlledRef = React5.useRef(prop !== void 0);
29261
- React5.useEffect(() => {
29262
- const wasControlled = isControlledRef.current;
29263
- if (wasControlled !== isControlled) {
29264
- const from = wasControlled ? "controlled" : "uncontrolled";
29265
- const to = isControlled ? "controlled" : "uncontrolled";
29266
- console.warn(
29267
- `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
29268
- );
29269
- }
29270
- isControlledRef.current = isControlled;
29271
- }, [isControlled, caller]);
29272
- }
29273
29286
  const setValue = React5.useCallback(
29274
29287
  (nextValue) => {
29275
29288
  if (isControlled) {
@@ -29285,6 +29298,7 @@ function useControllableState({
29285
29298
  );
29286
29299
  return [value, setValue];
29287
29300
  }
29301
+ __name2(useControllableState, "useControllableState");
29288
29302
  function useUncontrolledState({
29289
29303
  defaultProp,
29290
29304
  onChange
@@ -29303,9 +29317,58 @@ function useUncontrolledState({
29303
29317
  }, [value, prevValueRef]);
29304
29318
  return [value, setValue, onChangeRef];
29305
29319
  }
29320
+ __name2(useUncontrolledState, "useUncontrolledState");
29306
29321
  function isFunction(value) {
29307
29322
  return typeof value === "function";
29308
29323
  }
29324
+ __name2(isFunction, "isFunction");
29325
+ var SYNC_STATE = /* @__PURE__ */ Symbol("RADIX:SYNC_STATE");
29326
+ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
29327
+ const { prop: controlledState, defaultProp, onChange: onChangeProp, caller } = userArgs;
29328
+ const isControlled = controlledState !== void 0;
29329
+ const onChange = useEffectEvent(onChangeProp);
29330
+ const args = [{ ...initialArg, state: defaultProp }];
29331
+ if (init) {
29332
+ args.push(init);
29333
+ }
29334
+ const [internalState, dispatch] = React5.useReducer(
29335
+ (state2, action) => {
29336
+ if (action.type === SYNC_STATE) {
29337
+ return { ...state2, state: action.state };
29338
+ }
29339
+ const next = reducer(state2, action);
29340
+ if (isControlled && !Object.is(next.state, state2.state)) {
29341
+ onChange(next.state);
29342
+ }
29343
+ return next;
29344
+ },
29345
+ ...args
29346
+ );
29347
+ const uncontrolledState = internalState.state;
29348
+ const prevValueRef = React5.useRef(uncontrolledState);
29349
+ React5.useEffect(() => {
29350
+ if (prevValueRef.current !== uncontrolledState) {
29351
+ prevValueRef.current = uncontrolledState;
29352
+ if (!isControlled) {
29353
+ onChange(uncontrolledState);
29354
+ }
29355
+ }
29356
+ }, [uncontrolledState, prevValueRef, isControlled]);
29357
+ const state = React5.useMemo(() => {
29358
+ const isControlled2 = controlledState !== void 0;
29359
+ if (isControlled2) {
29360
+ return { ...internalState, state: controlledState };
29361
+ }
29362
+ return internalState;
29363
+ }, [internalState, controlledState]);
29364
+ React5.useEffect(() => {
29365
+ if (isControlled && !Object.is(controlledState, internalState.state)) {
29366
+ dispatch({ type: SYNC_STATE, state: controlledState });
29367
+ }
29368
+ }, [controlledState, internalState.state, isControlled]);
29369
+ return [state, dispatch];
29370
+ }
29371
+ __name2(useControllableStateReducer, "useControllableStateReducer");
29309
29372
  var badgeVariants2 = cva(
29310
29373
  "inline-flex items-center justify-center rounded-sm border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
29311
29374
  {