Initial commit: Crypto trader application

This commit is contained in:
2025-12-25 20:20:40 -05:00
commit 07a04c1bb8
47895 changed files with 2042266 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
export { default } from './useControlled';
export * from './useControlled';

View File

@@ -0,0 +1,13 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _useControlled.default;
}
});
var _useControlled = _interopRequireDefault(require("./useControlled"));

View File

@@ -0,0 +1,6 @@
{
"sideEffects": false,
"module": "../esm/useControlled/index.js",
"main": "./index.js",
"types": "./index.d.ts"
}

View File

@@ -0,0 +1,22 @@
export interface UseControlledProps<T = unknown> {
/**
* Holds the component value when it's controlled.
*/
controlled: T | undefined;
/**
* The default value when uncontrolled.
*/
default: T | undefined;
/**
* The component name displayed in warnings.
*/
name: string;
/**
* The name of the state variable displayed in warnings.
*/
state?: string;
}
export default function useControlled<T = unknown>(
props: UseControlledProps<T>,
): [T, (newValue: T | ((prevValue: T) => T)) => void];

View File

@@ -0,0 +1,45 @@
"use strict";
'use client';
/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useControlled;
var React = _interopRequireWildcard(require("react"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function useControlled({
controlled,
default: defaultProp,
name,
state = 'value'
}) {
// isControlled is ignored in the hook dependency lists as it should never change.
const {
current: isControlled
} = React.useRef(controlled !== undefined);
const [valueState, setValue] = React.useState(defaultProp);
const value = isControlled ? controlled : valueState;
if (process.env.NODE_ENV !== 'production') {
React.useEffect(() => {
if (isControlled !== (controlled !== undefined)) {
console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
}
}, [state, name, controlled]);
const {
current: defaultValue
} = React.useRef(defaultProp);
React.useEffect(() => {
if (!isControlled && !Object.is(defaultValue, defaultProp)) {
console.error([`MUI: A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\n'));
}
}, [JSON.stringify(defaultProp)]);
}
const setValueIfUncontrolled = React.useCallback(newValue => {
if (!isControlled) {
setValue(newValue);
}
}, []);
return [value, setValueIfUncontrolled];
}