@bgord/ui 0.1.1 → 0.2.0
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/hooks/index.d.ts +1 -0
- package/dist/hooks/use-field.d.ts +155 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +154 -490
- package/dist/services/field.d.ts +10 -0
- package/dist/services/form.d.ts +11 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/rhythm.d.ts +69 -0
- package/package.json +22 -11
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { FieldValueAllowedTypes } from "../services/field";
|
|
2
|
+
/** Type for field names */
|
|
3
|
+
type NewFieldNameType = string;
|
|
4
|
+
/** Valid HTML elements that can be used as field inputs */
|
|
5
|
+
export type FieldElementType = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
6
|
+
/**
|
|
7
|
+
* Defines the strategy for field value persistence
|
|
8
|
+
* @enum {string}
|
|
9
|
+
*/
|
|
10
|
+
export declare enum useFieldStrategyEnum {
|
|
11
|
+
/** Store field value in URL parameters */
|
|
12
|
+
params = "params",
|
|
13
|
+
/** Store field value in local state */
|
|
14
|
+
local = "local"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Configuration options for the useField hook
|
|
18
|
+
* @template T - Type of the field value
|
|
19
|
+
*/
|
|
20
|
+
export type useFieldConfigType<T extends FieldValueAllowedTypes> = {
|
|
21
|
+
/** Unique identifier for the field */
|
|
22
|
+
name: NewFieldNameType;
|
|
23
|
+
/** Initial value for the field */
|
|
24
|
+
defaultValue?: T;
|
|
25
|
+
/** Strategy for value persistence */
|
|
26
|
+
strategy?: useFieldStrategyEnum;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Return type for the useField hook
|
|
30
|
+
* @template T - Type of the field value
|
|
31
|
+
*/
|
|
32
|
+
export type useFieldReturnType<T extends FieldValueAllowedTypes> = {
|
|
33
|
+
/** Current persistence strategy */
|
|
34
|
+
strategy: useFieldStrategyEnum;
|
|
35
|
+
/** Initial field value */
|
|
36
|
+
defaultValue: T;
|
|
37
|
+
/** Current field value */
|
|
38
|
+
currentValue: T;
|
|
39
|
+
/** Non-nullable field value, empty string for empty values */
|
|
40
|
+
value: NonNullable<T>;
|
|
41
|
+
/** Function to set field value */
|
|
42
|
+
set: (value: T) => void;
|
|
43
|
+
/** Change event handler for controlled components */
|
|
44
|
+
handleChange: (event: React.ChangeEvent<FieldElementType>) => void;
|
|
45
|
+
/** Reset field to default value */
|
|
46
|
+
clear: () => void;
|
|
47
|
+
/** Props for field label */
|
|
48
|
+
label: {
|
|
49
|
+
props: {
|
|
50
|
+
htmlFor: NewFieldNameType;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/** Props for field input */
|
|
54
|
+
input: {
|
|
55
|
+
props: {
|
|
56
|
+
id: NewFieldNameType;
|
|
57
|
+
name: NewFieldNameType;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/** Whether field value differs from default */
|
|
61
|
+
changed: boolean;
|
|
62
|
+
/** Whether field value equals default */
|
|
63
|
+
unchanged: boolean;
|
|
64
|
+
/** Whether field is empty */
|
|
65
|
+
empty: boolean;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Hook for managing form field state with URL parameters or local state
|
|
69
|
+
*
|
|
70
|
+
* @template T - Type of the field value
|
|
71
|
+
* @param {useFieldConfigType<T>} config - Field configuration
|
|
72
|
+
* @returns {useFieldReturnType<T>} Field state and handlers
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* // Using local strategy
|
|
77
|
+
* function NameField() {
|
|
78
|
+
* const field = useField({
|
|
79
|
+
* name: "username",
|
|
80
|
+
* defaultValue: "",
|
|
81
|
+
* strategy: useFieldStrategyEnum.local
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* return (
|
|
85
|
+
* <div>
|
|
86
|
+
* <label {...field.label.props}>Username:</label>
|
|
87
|
+
* <input
|
|
88
|
+
* {...field.input.props}
|
|
89
|
+
* type="text"
|
|
90
|
+
* value={field.value}
|
|
91
|
+
* onChange={field.handleChange}
|
|
92
|
+
* />
|
|
93
|
+
* </div>
|
|
94
|
+
* );
|
|
95
|
+
* }
|
|
96
|
+
*
|
|
97
|
+
* // Using URL parameters strategy
|
|
98
|
+
* function SearchField() {
|
|
99
|
+
* const field = useField({
|
|
100
|
+
* name: "q",
|
|
101
|
+
* strategy: useFieldStrategyEnum.params
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
* return (
|
|
105
|
+
* <input
|
|
106
|
+
* type="search"
|
|
107
|
+
* {...field.input.props}
|
|
108
|
+
* value={field.value}
|
|
109
|
+
* onChange={field.handleChange}
|
|
110
|
+
* />
|
|
111
|
+
* );
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare function useField<T extends FieldValueAllowedTypes>(config: useFieldConfigType<T>): useFieldReturnType<T>;
|
|
116
|
+
/**
|
|
117
|
+
* Utility class for working with multiple fields
|
|
118
|
+
* @static
|
|
119
|
+
*/
|
|
120
|
+
export declare class Fields {
|
|
121
|
+
/**
|
|
122
|
+
* Check if all fields are unchanged
|
|
123
|
+
* @param {Array<{unchanged: boolean}>} fields - Array of field states
|
|
124
|
+
* @returns {boolean} True if all fields match their default values
|
|
125
|
+
*/
|
|
126
|
+
static allUnchanged(fields: {
|
|
127
|
+
unchanged: boolean;
|
|
128
|
+
}[]): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Check if any field is unchanged
|
|
131
|
+
* @param {Array<{unchanged: boolean}>} fields - Array of field states
|
|
132
|
+
* @returns {boolean} True if any field matches its default value
|
|
133
|
+
*/
|
|
134
|
+
static anyUnchanged(fields: {
|
|
135
|
+
unchanged: boolean;
|
|
136
|
+
}[]): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Check if any field has changed
|
|
139
|
+
* @param {Array<{changed: boolean}>} fields - Array of field states
|
|
140
|
+
* @returns {boolean} True if any field differs from its default value
|
|
141
|
+
*/
|
|
142
|
+
static anyChanged(fields: {
|
|
143
|
+
changed: boolean;
|
|
144
|
+
}[]): boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Utility class for working with local fields
|
|
148
|
+
* @static
|
|
149
|
+
*/
|
|
150
|
+
export declare class LocalFields {
|
|
151
|
+
static clearAll(fields: {
|
|
152
|
+
clear: VoidFunction;
|
|
153
|
+
}[]): () => void;
|
|
154
|
+
}
|
|
155
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export *
|
|
2
|
-
export *
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./hooks";
|
|
3
|
+
export * from "./services";
|
package/dist/index.js
CHANGED
|
@@ -1,495 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
9
|
-
for (let key of __getOwnPropNames(mod))
|
|
10
|
-
if (!__hasOwnProp.call(to, key))
|
|
11
|
-
__defProp(to, key, {
|
|
12
|
-
get: () => mod[key],
|
|
13
|
-
enumerable: true
|
|
14
|
-
});
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
|
-
var __export = (target, all) => {
|
|
19
|
-
for (var name in all)
|
|
20
|
-
__defProp(target, name, {
|
|
21
|
-
get: all[name],
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
set: (newValue) => all[name] = () => newValue
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
28
|
-
|
|
29
|
-
// node_modules/react/cjs/react.production.js
|
|
30
|
-
var exports_react_production = {};
|
|
31
|
-
__export(exports_react_production, {
|
|
32
|
-
version: () => $version,
|
|
33
|
-
useTransition: () => $useTransition,
|
|
34
|
-
useSyncExternalStore: () => $useSyncExternalStore,
|
|
35
|
-
useState: () => $useState,
|
|
36
|
-
useRef: () => $useRef,
|
|
37
|
-
useReducer: () => $useReducer,
|
|
38
|
-
useOptimistic: () => $useOptimistic,
|
|
39
|
-
useMemo: () => $useMemo,
|
|
40
|
-
useLayoutEffect: () => $useLayoutEffect,
|
|
41
|
-
useInsertionEffect: () => $useInsertionEffect,
|
|
42
|
-
useImperativeHandle: () => $useImperativeHandle,
|
|
43
|
-
useId: () => $useId,
|
|
44
|
-
useEffect: () => $useEffect,
|
|
45
|
-
useDeferredValue: () => $useDeferredValue,
|
|
46
|
-
useDebugValue: () => $useDebugValue,
|
|
47
|
-
useContext: () => $useContext,
|
|
48
|
-
useCallback: () => $useCallback,
|
|
49
|
-
useActionState: () => $useActionState,
|
|
50
|
-
use: () => $use,
|
|
51
|
-
unstable_useCacheRefresh: () => $unstable_useCacheRefresh,
|
|
52
|
-
startTransition: () => $startTransition,
|
|
53
|
-
memo: () => $memo,
|
|
54
|
-
lazy: () => $lazy,
|
|
55
|
-
isValidElement: () => $isValidElement,
|
|
56
|
-
forwardRef: () => $forwardRef,
|
|
57
|
-
createRef: () => $createRef,
|
|
58
|
-
createElement: () => $createElement,
|
|
59
|
-
createContext: () => $createContext,
|
|
60
|
-
cloneElement: () => $cloneElement,
|
|
61
|
-
cache: () => $cache,
|
|
62
|
-
__COMPILER_RUNTIME: () => $__COMPILER_RUNTIME,
|
|
63
|
-
__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE: () => $__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
64
|
-
Suspense: () => $Suspense,
|
|
65
|
-
StrictMode: () => $StrictMode,
|
|
66
|
-
PureComponent: () => $PureComponent,
|
|
67
|
-
Profiler: () => $Profiler,
|
|
68
|
-
Fragment: () => $Fragment,
|
|
69
|
-
Component: () => $Component,
|
|
70
|
-
Children: () => $Children
|
|
71
|
-
});
|
|
72
|
-
function getIteratorFn(maybeIterable) {
|
|
73
|
-
if (maybeIterable === null || typeof maybeIterable !== "object")
|
|
74
|
-
return null;
|
|
75
|
-
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
|
|
76
|
-
return typeof maybeIterable === "function" ? maybeIterable : null;
|
|
77
|
-
}
|
|
78
|
-
function Component(props, context, updater) {
|
|
79
|
-
this.props = props;
|
|
80
|
-
this.context = context;
|
|
81
|
-
this.refs = emptyObject;
|
|
82
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
83
|
-
}
|
|
84
|
-
function ComponentDummy() {}
|
|
85
|
-
function PureComponent(props, context, updater) {
|
|
86
|
-
this.props = props;
|
|
87
|
-
this.context = context;
|
|
88
|
-
this.refs = emptyObject;
|
|
89
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
90
|
-
}
|
|
91
|
-
function ReactElement(type, key, self, source, owner, props) {
|
|
92
|
-
self = props.ref;
|
|
93
|
-
return {
|
|
94
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
95
|
-
type,
|
|
96
|
-
key,
|
|
97
|
-
ref: self !== undefined ? self : null,
|
|
98
|
-
props
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
102
|
-
return ReactElement(oldElement.type, newKey, undefined, undefined, undefined, oldElement.props);
|
|
103
|
-
}
|
|
104
|
-
function isValidElement(object) {
|
|
105
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
106
|
-
}
|
|
107
|
-
function escape(key) {
|
|
108
|
-
var escaperLookup = { "=": "=0", ":": "=2" };
|
|
109
|
-
return "$" + key.replace(/[=:]/g, function(match) {
|
|
110
|
-
return escaperLookup[match];
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function getElementKey(element, index) {
|
|
114
|
-
return typeof element === "object" && element !== null && element.key != null ? escape("" + element.key) : index.toString(36);
|
|
1
|
+
// src/components/button.tsx
|
|
2
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
3
|
+
function Button() {
|
|
4
|
+
return /* @__PURE__ */ jsxDEV("button", {
|
|
5
|
+
type: "button",
|
|
6
|
+
children: "Click"
|
|
7
|
+
}, undefined, false, undefined, this);
|
|
115
8
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
thenable.status === "pending" && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
|
|
126
|
-
}, function(error) {
|
|
127
|
-
thenable.status === "pending" && (thenable.status = "rejected", thenable.reason = error);
|
|
128
|
-
})), thenable.status) {
|
|
129
|
-
case "fulfilled":
|
|
130
|
-
return thenable.value;
|
|
131
|
-
case "rejected":
|
|
132
|
-
throw thenable.reason;
|
|
133
|
-
}
|
|
9
|
+
// src/hooks/use-field.ts
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
import { useSearchParams } from "react-router";
|
|
12
|
+
|
|
13
|
+
// src/services/field.ts
|
|
14
|
+
class Field {
|
|
15
|
+
static emptyValue = undefined;
|
|
16
|
+
static isEmpty(value) {
|
|
17
|
+
return value === undefined || value === "" || value === null;
|
|
134
18
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var type = typeof children;
|
|
139
|
-
if (type === "undefined" || type === "boolean")
|
|
140
|
-
children = null;
|
|
141
|
-
var invokeCallback = false;
|
|
142
|
-
if (children === null)
|
|
143
|
-
invokeCallback = true;
|
|
144
|
-
else
|
|
145
|
-
switch (type) {
|
|
146
|
-
case "bigint":
|
|
147
|
-
case "string":
|
|
148
|
-
case "number":
|
|
149
|
-
invokeCallback = true;
|
|
150
|
-
break;
|
|
151
|
-
case "object":
|
|
152
|
-
switch (children.$$typeof) {
|
|
153
|
-
case REACT_ELEMENT_TYPE:
|
|
154
|
-
case REACT_PORTAL_TYPE:
|
|
155
|
-
invokeCallback = true;
|
|
156
|
-
break;
|
|
157
|
-
case REACT_LAZY_TYPE:
|
|
158
|
-
return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
|
|
159
|
-
}
|
|
19
|
+
static compare(one, another) {
|
|
20
|
+
if (Field.isEmpty(one) && Field.isEmpty(another)) {
|
|
21
|
+
return true;
|
|
160
22
|
}
|
|
161
|
-
|
|
162
|
-
return callback = callback(children), invokeCallback = nameSoFar === "" ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", invokeCallback != null && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
|
|
163
|
-
return c;
|
|
164
|
-
})) : callback != null && (isValidElement(callback) && (callback = cloneAndReplaceKey(callback, escapedPrefix + (callback.key == null || children && children.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + invokeCallback)), array.push(callback)), 1;
|
|
165
|
-
invokeCallback = 0;
|
|
166
|
-
var nextNamePrefix = nameSoFar === "" ? "." : nameSoFar + ":";
|
|
167
|
-
if (isArrayImpl(children))
|
|
168
|
-
for (var i = 0;i < children.length; i++)
|
|
169
|
-
nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
|
|
170
|
-
else if (i = getIteratorFn(children), typeof i === "function")
|
|
171
|
-
for (children = i.call(children), i = 0;!(nameSoFar = children.next()).done; )
|
|
172
|
-
nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
|
|
173
|
-
else if (type === "object") {
|
|
174
|
-
if (typeof children.then === "function")
|
|
175
|
-
return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
|
|
176
|
-
array = String(children);
|
|
177
|
-
throw Error("Objects are not valid as a React child (found: " + (array === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead.");
|
|
178
|
-
}
|
|
179
|
-
return invokeCallback;
|
|
180
|
-
}
|
|
181
|
-
function mapChildren(children, func, context) {
|
|
182
|
-
if (children == null)
|
|
183
|
-
return children;
|
|
184
|
-
var result = [], count = 0;
|
|
185
|
-
mapIntoArray(children, result, "", "", function(child) {
|
|
186
|
-
return func.call(context, child, count++);
|
|
187
|
-
});
|
|
188
|
-
return result;
|
|
189
|
-
}
|
|
190
|
-
function lazyInitializer(payload) {
|
|
191
|
-
if (payload._status === -1) {
|
|
192
|
-
var ctor = payload._result;
|
|
193
|
-
ctor = ctor();
|
|
194
|
-
ctor.then(function(moduleObject) {
|
|
195
|
-
if (payload._status === 0 || payload._status === -1)
|
|
196
|
-
payload._status = 1, payload._result = moduleObject;
|
|
197
|
-
}, function(error) {
|
|
198
|
-
if (payload._status === 0 || payload._status === -1)
|
|
199
|
-
payload._status = 2, payload._result = error;
|
|
200
|
-
});
|
|
201
|
-
payload._status === -1 && (payload._status = 0, payload._result = ctor);
|
|
23
|
+
return one === another;
|
|
202
24
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
function noop() {}
|
|
208
|
-
var REACT_ELEMENT_TYPE, REACT_PORTAL_TYPE, REACT_FRAGMENT_TYPE, REACT_STRICT_MODE_TYPE, REACT_PROFILER_TYPE, REACT_CONSUMER_TYPE, REACT_CONTEXT_TYPE, REACT_FORWARD_REF_TYPE, REACT_SUSPENSE_TYPE, REACT_MEMO_TYPE, REACT_LAZY_TYPE, MAYBE_ITERATOR_SYMBOL, ReactNoopUpdateQueue, assign, emptyObject, pureComponentPrototype, isArrayImpl, ReactSharedInternals, hasOwnProperty, userProvidedKeyEscapeRegex, reportGlobalError, $Children, $Component, $Fragment, $Profiler, $PureComponent, $StrictMode, $Suspense, $__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, $__COMPILER_RUNTIME, $cache = function(fn) {
|
|
209
|
-
return function() {
|
|
210
|
-
return fn.apply(null, arguments);
|
|
211
|
-
};
|
|
212
|
-
}, $cloneElement = function(element, config, children) {
|
|
213
|
-
if (element === null || element === undefined)
|
|
214
|
-
throw Error("The argument must be a React element, but you passed " + element + ".");
|
|
215
|
-
var props = assign({}, element.props), key = element.key, owner = undefined;
|
|
216
|
-
if (config != null)
|
|
217
|
-
for (propName in config.ref !== undefined && (owner = undefined), config.key !== undefined && (key = "" + config.key), config)
|
|
218
|
-
!hasOwnProperty.call(config, propName) || propName === "key" || propName === "__self" || propName === "__source" || propName === "ref" && config.ref === undefined || (props[propName] = config[propName]);
|
|
219
|
-
var propName = arguments.length - 2;
|
|
220
|
-
if (propName === 1)
|
|
221
|
-
props.children = children;
|
|
222
|
-
else if (1 < propName) {
|
|
223
|
-
for (var childArray = Array(propName), i = 0;i < propName; i++)
|
|
224
|
-
childArray[i] = arguments[i + 2];
|
|
225
|
-
props.children = childArray;
|
|
25
|
+
value = Field.emptyValue;
|
|
26
|
+
constructor(value) {
|
|
27
|
+
this.value = Field.isEmpty(value) ? Field.emptyValue : value;
|
|
226
28
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
defaultValue = {
|
|
230
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
231
|
-
_currentValue: defaultValue,
|
|
232
|
-
_currentValue2: defaultValue,
|
|
233
|
-
_threadCount: 0,
|
|
234
|
-
Provider: null,
|
|
235
|
-
Consumer: null
|
|
236
|
-
};
|
|
237
|
-
defaultValue.Provider = defaultValue;
|
|
238
|
-
defaultValue.Consumer = {
|
|
239
|
-
$$typeof: REACT_CONSUMER_TYPE,
|
|
240
|
-
_context: defaultValue
|
|
241
|
-
};
|
|
242
|
-
return defaultValue;
|
|
243
|
-
}, $createElement = function(type, config, children) {
|
|
244
|
-
var propName, props = {}, key = null;
|
|
245
|
-
if (config != null)
|
|
246
|
-
for (propName in config.key !== undefined && (key = "" + config.key), config)
|
|
247
|
-
hasOwnProperty.call(config, propName) && propName !== "key" && propName !== "__self" && propName !== "__source" && (props[propName] = config[propName]);
|
|
248
|
-
var childrenLength = arguments.length - 2;
|
|
249
|
-
if (childrenLength === 1)
|
|
250
|
-
props.children = children;
|
|
251
|
-
else if (1 < childrenLength) {
|
|
252
|
-
for (var childArray = Array(childrenLength), i = 0;i < childrenLength; i++)
|
|
253
|
-
childArray[i] = arguments[i + 2];
|
|
254
|
-
props.children = childArray;
|
|
29
|
+
get() {
|
|
30
|
+
return this.value;
|
|
255
31
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
props[propName] === undefined && (props[propName] = childrenLength[propName]);
|
|
259
|
-
return ReactElement(type, key, undefined, undefined, null, props);
|
|
260
|
-
}, $createRef = function() {
|
|
261
|
-
return { current: null };
|
|
262
|
-
}, $forwardRef = function(render) {
|
|
263
|
-
return { $$typeof: REACT_FORWARD_REF_TYPE, render };
|
|
264
|
-
}, $isValidElement, $lazy = function(ctor) {
|
|
265
|
-
return {
|
|
266
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
267
|
-
_payload: { _status: -1, _result: ctor },
|
|
268
|
-
_init: lazyInitializer
|
|
269
|
-
};
|
|
270
|
-
}, $memo = function(type, compare) {
|
|
271
|
-
return {
|
|
272
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
273
|
-
type,
|
|
274
|
-
compare: compare === undefined ? null : compare
|
|
275
|
-
};
|
|
276
|
-
}, $startTransition = function(scope) {
|
|
277
|
-
var prevTransition = ReactSharedInternals.T, currentTransition = {};
|
|
278
|
-
ReactSharedInternals.T = currentTransition;
|
|
279
|
-
try {
|
|
280
|
-
var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
|
|
281
|
-
onStartTransitionFinish !== null && onStartTransitionFinish(currentTransition, returnValue);
|
|
282
|
-
typeof returnValue === "object" && returnValue !== null && typeof returnValue.then === "function" && returnValue.then(noop, reportGlobalError);
|
|
283
|
-
} catch (error) {
|
|
284
|
-
reportGlobalError(error);
|
|
285
|
-
} finally {
|
|
286
|
-
ReactSharedInternals.T = prevTransition;
|
|
32
|
+
isEmpty() {
|
|
33
|
+
return Field.isEmpty(this.value);
|
|
287
34
|
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}, $useId = function() {
|
|
306
|
-
return ReactSharedInternals.H.useId();
|
|
307
|
-
}, $useImperativeHandle = function(ref, create, deps) {
|
|
308
|
-
return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
|
|
309
|
-
}, $useInsertionEffect = function(create, deps) {
|
|
310
|
-
return ReactSharedInternals.H.useInsertionEffect(create, deps);
|
|
311
|
-
}, $useLayoutEffect = function(create, deps) {
|
|
312
|
-
return ReactSharedInternals.H.useLayoutEffect(create, deps);
|
|
313
|
-
}, $useMemo = function(create, deps) {
|
|
314
|
-
return ReactSharedInternals.H.useMemo(create, deps);
|
|
315
|
-
}, $useOptimistic = function(passthrough, reducer) {
|
|
316
|
-
return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
|
|
317
|
-
}, $useReducer = function(reducer, initialArg, init) {
|
|
318
|
-
return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
|
|
319
|
-
}, $useRef = function(initialValue) {
|
|
320
|
-
return ReactSharedInternals.H.useRef(initialValue);
|
|
321
|
-
}, $useState = function(initialState) {
|
|
322
|
-
return ReactSharedInternals.H.useState(initialState);
|
|
323
|
-
}, $useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
|
|
324
|
-
return ReactSharedInternals.H.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
325
|
-
}, $useTransition = function() {
|
|
326
|
-
return ReactSharedInternals.H.useTransition();
|
|
327
|
-
}, $version = "19.1.0";
|
|
328
|
-
var init_react_production = __esm(() => {
|
|
329
|
-
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element");
|
|
330
|
-
REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
331
|
-
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
332
|
-
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
333
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
334
|
-
REACT_CONSUMER_TYPE = Symbol.for("react.consumer");
|
|
335
|
-
REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
336
|
-
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
337
|
-
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
338
|
-
REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
339
|
-
REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
340
|
-
MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
341
|
-
ReactNoopUpdateQueue = {
|
|
342
|
-
isMounted: function() {
|
|
343
|
-
return false;
|
|
344
|
-
},
|
|
345
|
-
enqueueForceUpdate: function() {},
|
|
346
|
-
enqueueReplaceState: function() {},
|
|
347
|
-
enqueueSetState: function() {}
|
|
348
|
-
};
|
|
349
|
-
assign = Object.assign;
|
|
350
|
-
emptyObject = {};
|
|
351
|
-
Component.prototype.isReactComponent = {};
|
|
352
|
-
Component.prototype.setState = function(partialState, callback) {
|
|
353
|
-
if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null)
|
|
354
|
-
throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
|
|
355
|
-
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
356
|
-
};
|
|
357
|
-
Component.prototype.forceUpdate = function(callback) {
|
|
358
|
-
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
359
|
-
};
|
|
360
|
-
ComponentDummy.prototype = Component.prototype;
|
|
361
|
-
pureComponentPrototype = PureComponent.prototype = new ComponentDummy;
|
|
362
|
-
pureComponentPrototype.constructor = PureComponent;
|
|
363
|
-
assign(pureComponentPrototype, Component.prototype);
|
|
364
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
365
|
-
isArrayImpl = Array.isArray;
|
|
366
|
-
ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null };
|
|
367
|
-
hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
368
|
-
userProvidedKeyEscapeRegex = /\/+/g;
|
|
369
|
-
reportGlobalError = typeof reportError === "function" ? reportError : function(error) {
|
|
370
|
-
if (typeof window === "object" && typeof window.ErrorEvent === "function") {
|
|
371
|
-
var event = new window.ErrorEvent("error", {
|
|
372
|
-
bubbles: true,
|
|
373
|
-
cancelable: true,
|
|
374
|
-
message: typeof error === "object" && error !== null && typeof error.message === "string" ? String(error.message) : String(error),
|
|
375
|
-
error
|
|
376
|
-
});
|
|
377
|
-
if (!window.dispatchEvent(event))
|
|
378
|
-
return;
|
|
379
|
-
} else if (typeof process === "object" && typeof process.emit === "function") {
|
|
380
|
-
process.emit("uncaughtException", error);
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
console.error(error);
|
|
384
|
-
};
|
|
385
|
-
$Children = {
|
|
386
|
-
map: mapChildren,
|
|
387
|
-
forEach: function(children, forEachFunc, forEachContext) {
|
|
388
|
-
mapChildren(children, function() {
|
|
389
|
-
forEachFunc.apply(this, arguments);
|
|
390
|
-
}, forEachContext);
|
|
391
|
-
},
|
|
392
|
-
count: function(children) {
|
|
393
|
-
var n = 0;
|
|
394
|
-
mapChildren(children, function() {
|
|
395
|
-
n++;
|
|
396
|
-
});
|
|
397
|
-
return n;
|
|
398
|
-
},
|
|
399
|
-
toArray: function(children) {
|
|
400
|
-
return mapChildren(children, function(child) {
|
|
401
|
-
return child;
|
|
402
|
-
}) || [];
|
|
403
|
-
},
|
|
404
|
-
only: function(children) {
|
|
405
|
-
if (!isValidElement(children))
|
|
406
|
-
throw Error("React.Children.only expected to receive a single React element child.");
|
|
407
|
-
return children;
|
|
408
|
-
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/hooks/use-field.ts
|
|
38
|
+
var useFieldStrategyEnum;
|
|
39
|
+
((useFieldStrategyEnum2) => {
|
|
40
|
+
useFieldStrategyEnum2["params"] = "params";
|
|
41
|
+
useFieldStrategyEnum2["local"] = "local";
|
|
42
|
+
})(useFieldStrategyEnum ||= {});
|
|
43
|
+
function useField(config) {
|
|
44
|
+
const strategy = config.strategy ?? "local" /* local */;
|
|
45
|
+
const [params, setParams] = useSearchParams();
|
|
46
|
+
const givenValue = new Field(params.get(config.name));
|
|
47
|
+
const defaultValue = new Field(config.defaultValue);
|
|
48
|
+
const [currentValue, _setCurrentValue] = useState(givenValue.isEmpty() ? defaultValue.get() : givenValue.get());
|
|
49
|
+
const setCurrentValue = (value) => {
|
|
50
|
+
const candidate = new Field(value);
|
|
51
|
+
_setCurrentValue(candidate.get());
|
|
409
52
|
};
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
return ReactSharedInternals.H.useMemoCache(size);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const current = new Field(currentValue);
|
|
55
|
+
if (strategy === "params" /* params */) {
|
|
56
|
+
if (current.isEmpty()) {
|
|
57
|
+
params.delete(config.name);
|
|
58
|
+
setParams(params);
|
|
59
|
+
} else {
|
|
60
|
+
params.set(config.name, current.get());
|
|
61
|
+
setParams(params);
|
|
62
|
+
}
|
|
421
63
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
// node_modules/react/index.js
|
|
427
|
-
var require_react = __commonJS((exports, module) => {
|
|
428
|
-
init_react_production();
|
|
429
|
-
if (true) {
|
|
430
|
-
module.exports = exports_react_production;
|
|
431
|
-
} else {}
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
// node_modules/react/cjs/react-jsx-runtime.production.js
|
|
435
|
-
var exports_react_jsx_runtime_production = {};
|
|
436
|
-
__export(exports_react_jsx_runtime_production, {
|
|
437
|
-
jsxs: () => $jsxs,
|
|
438
|
-
jsx: () => $jsx,
|
|
439
|
-
Fragment: () => $Fragment2
|
|
440
|
-
});
|
|
441
|
-
function jsxProd(type, config, maybeKey) {
|
|
442
|
-
var key = null;
|
|
443
|
-
maybeKey !== undefined && (key = "" + maybeKey);
|
|
444
|
-
config.key !== undefined && (key = "" + config.key);
|
|
445
|
-
if ("key" in config) {
|
|
446
|
-
maybeKey = {};
|
|
447
|
-
for (var propName in config)
|
|
448
|
-
propName !== "key" && (maybeKey[propName] = config[propName]);
|
|
449
|
-
} else
|
|
450
|
-
maybeKey = config;
|
|
451
|
-
config = maybeKey.ref;
|
|
64
|
+
if (strategy === "local" /* local */) {}
|
|
65
|
+
}, [currentValue, params, setParams, config.name, strategy]);
|
|
452
66
|
return {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
67
|
+
strategy,
|
|
68
|
+
defaultValue: defaultValue.get(),
|
|
69
|
+
currentValue,
|
|
70
|
+
value: Field.isEmpty(currentValue) ? "" : currentValue,
|
|
71
|
+
set: setCurrentValue,
|
|
72
|
+
handleChange: (event) => setCurrentValue(event.currentTarget.value),
|
|
73
|
+
clear: () => setCurrentValue(defaultValue.get()),
|
|
74
|
+
label: { props: { htmlFor: config.name } },
|
|
75
|
+
input: { props: { id: config.name, name: config.name } },
|
|
76
|
+
changed: !Field.compare(currentValue, defaultValue.get()),
|
|
77
|
+
unchanged: Field.compare(currentValue, defaultValue.get()),
|
|
78
|
+
empty: Field.isEmpty(currentValue)
|
|
458
79
|
};
|
|
459
80
|
}
|
|
460
|
-
var REACT_ELEMENT_TYPE2, REACT_FRAGMENT_TYPE2, $Fragment2, $jsx, $jsxs;
|
|
461
|
-
var init_react_jsx_runtime_production = __esm(() => {
|
|
462
|
-
REACT_ELEMENT_TYPE2 = Symbol.for("react.transitional.element");
|
|
463
|
-
REACT_FRAGMENT_TYPE2 = Symbol.for("react.fragment");
|
|
464
|
-
$Fragment2 = REACT_FRAGMENT_TYPE2;
|
|
465
|
-
$jsx = jsxProd;
|
|
466
|
-
$jsxs = jsxProd;
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
// node_modules/react/jsx-runtime.js
|
|
470
|
-
var require_jsx_runtime = __commonJS((exports, module) => {
|
|
471
|
-
init_react_jsx_runtime_production();
|
|
472
|
-
if (true) {
|
|
473
|
-
module.exports = exports_react_jsx_runtime_production;
|
|
474
|
-
} else {}
|
|
475
|
-
});
|
|
476
81
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
82
|
+
class Fields {
|
|
83
|
+
static allUnchanged(fields) {
|
|
84
|
+
return fields.every((field) => field.unchanged);
|
|
85
|
+
}
|
|
86
|
+
static anyUnchanged(fields) {
|
|
87
|
+
return fields.some((field) => field.unchanged);
|
|
88
|
+
}
|
|
89
|
+
static anyChanged(fields) {
|
|
90
|
+
return fields.some((field) => field.changed);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
483
93
|
|
|
94
|
+
class LocalFields {
|
|
95
|
+
static clearAll(fields) {
|
|
96
|
+
return () => fields.forEach((field) => field.clear());
|
|
97
|
+
}
|
|
98
|
+
}
|
|
484
99
|
// src/hooks/use-toggle.ts
|
|
485
|
-
|
|
100
|
+
import { useCallback, useMemo, useState as useState2 } from "react";
|
|
486
101
|
function useToggle({ name, defaultValue = false }) {
|
|
487
|
-
const [on, setIsOn] =
|
|
488
|
-
const enable =
|
|
489
|
-
const disable =
|
|
490
|
-
const toggle =
|
|
491
|
-
const off =
|
|
492
|
-
const props =
|
|
102
|
+
const [on, setIsOn] = useState2(defaultValue);
|
|
103
|
+
const enable = useCallback(() => setIsOn(true), []);
|
|
104
|
+
const disable = useCallback(() => setIsOn(false), []);
|
|
105
|
+
const toggle = useCallback(() => setIsOn((v) => !v), []);
|
|
106
|
+
const off = useMemo(() => !on, [on]);
|
|
107
|
+
const props = useMemo(() => ({
|
|
493
108
|
controller: {
|
|
494
109
|
"aria-expanded": on ? "true" : "false",
|
|
495
110
|
"aria-controls": name,
|
|
@@ -507,20 +122,69 @@ function extractUseToggle(_props) {
|
|
|
507
122
|
rest
|
|
508
123
|
};
|
|
509
124
|
}
|
|
510
|
-
// src/
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
125
|
+
// src/services/form.ts
|
|
126
|
+
class Form {
|
|
127
|
+
static inputPattern(config) {
|
|
128
|
+
const required = config.required ?? true;
|
|
129
|
+
if (config.min && !config.max)
|
|
130
|
+
return { pattern: `.{${config.min}}`, required };
|
|
131
|
+
if (config.min && config.max)
|
|
132
|
+
return { pattern: `.{${config.min},${config.max}}`, required };
|
|
133
|
+
if (!config.min && config.max)
|
|
134
|
+
return { pattern: `.{,${config.max}}`, required };
|
|
135
|
+
return { pattern: undefined, required };
|
|
136
|
+
}
|
|
137
|
+
static textareaPattern(config) {
|
|
138
|
+
const required = config.required ?? true;
|
|
139
|
+
if (config.min && !config.max)
|
|
140
|
+
return { minLength: config.min, required };
|
|
141
|
+
if (config.min && config.max)
|
|
142
|
+
return { minLength: config.min, maxLength: config.max, required };
|
|
143
|
+
if (!config.min && config.max)
|
|
144
|
+
return { maxLength: config.max, required };
|
|
145
|
+
return { required };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// src/services/rhythm.ts
|
|
149
|
+
var DEFAULT_BASE_PX = 12;
|
|
150
|
+
function Rhythm(base = DEFAULT_BASE_PX) {
|
|
151
|
+
return {
|
|
152
|
+
times(times) {
|
|
153
|
+
const result = base * times;
|
|
154
|
+
const dimensions = {
|
|
155
|
+
height: { height: px(result) },
|
|
156
|
+
minHeight: { minHeight: px(result) },
|
|
157
|
+
maxHeight: { maxHeight: px(result) },
|
|
158
|
+
width: { width: px(result) },
|
|
159
|
+
minWidth: { minWidth: px(result) },
|
|
160
|
+
maxWidth: { maxWidth: px(result) },
|
|
161
|
+
square: { height: px(result), width: px(result) }
|
|
162
|
+
};
|
|
163
|
+
const style = {
|
|
164
|
+
height: { style: { height: px(result) } },
|
|
165
|
+
minHeight: { style: { minHeight: px(result) } },
|
|
166
|
+
maxHeight: { style: { maxHeight: px(result) } },
|
|
167
|
+
width: { style: { width: px(result) } },
|
|
168
|
+
minWidth: { style: { minWidth: px(result) } },
|
|
169
|
+
maxWidth: { style: { maxWidth: px(result) } },
|
|
170
|
+
square: { style: { height: px(result), width: px(result) } }
|
|
171
|
+
};
|
|
172
|
+
return { px: px(result), raw: result, style, ...dimensions };
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function px(number) {
|
|
177
|
+
return `${number}px`;
|
|
522
178
|
}
|
|
523
179
|
export {
|
|
524
|
-
|
|
525
|
-
|
|
180
|
+
useToggle,
|
|
181
|
+
useFieldStrategyEnum,
|
|
182
|
+
useField,
|
|
183
|
+
extractUseToggle,
|
|
184
|
+
Rhythm,
|
|
185
|
+
LocalFields,
|
|
186
|
+
Form,
|
|
187
|
+
Fields,
|
|
188
|
+
Field,
|
|
189
|
+
Button
|
|
526
190
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type FieldValueAllowedTypes = string | number | undefined | null;
|
|
2
|
+
export declare class Field<T extends FieldValueAllowedTypes> {
|
|
3
|
+
static readonly emptyValue: undefined;
|
|
4
|
+
static isEmpty(value: FieldValueAllowedTypes): boolean;
|
|
5
|
+
static compare(one: FieldValueAllowedTypes, another: FieldValueAllowedTypes): boolean;
|
|
6
|
+
private readonly value;
|
|
7
|
+
constructor(value: FieldValueAllowedTypes);
|
|
8
|
+
get(): T;
|
|
9
|
+
isEmpty(): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type PatternConfigType = {
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
required?: React.JSX.IntrinsicElements["input"]["required"];
|
|
6
|
+
};
|
|
7
|
+
export declare class Form {
|
|
8
|
+
static inputPattern(config: PatternConfigType): React.ComponentPropsWithoutRef<"input">;
|
|
9
|
+
static textareaPattern(config: PatternConfigType): React.ComponentPropsWithoutRef<"textarea">;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
type RhythmBaseType = number;
|
|
2
|
+
type RhythmTimesType = number;
|
|
3
|
+
export declare function Rhythm(base?: RhythmBaseType): {
|
|
4
|
+
times(times: RhythmTimesType): {
|
|
5
|
+
height: {
|
|
6
|
+
height: string;
|
|
7
|
+
};
|
|
8
|
+
minHeight: {
|
|
9
|
+
minHeight: string;
|
|
10
|
+
};
|
|
11
|
+
maxHeight: {
|
|
12
|
+
maxHeight: string;
|
|
13
|
+
};
|
|
14
|
+
width: {
|
|
15
|
+
width: string;
|
|
16
|
+
};
|
|
17
|
+
minWidth: {
|
|
18
|
+
minWidth: string;
|
|
19
|
+
};
|
|
20
|
+
maxWidth: {
|
|
21
|
+
maxWidth: string;
|
|
22
|
+
};
|
|
23
|
+
square: {
|
|
24
|
+
height: string;
|
|
25
|
+
width: string;
|
|
26
|
+
};
|
|
27
|
+
px: string;
|
|
28
|
+
raw: number;
|
|
29
|
+
style: {
|
|
30
|
+
height: {
|
|
31
|
+
style: {
|
|
32
|
+
height: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
minHeight: {
|
|
36
|
+
style: {
|
|
37
|
+
minHeight: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
maxHeight: {
|
|
41
|
+
style: {
|
|
42
|
+
maxHeight: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
width: {
|
|
46
|
+
style: {
|
|
47
|
+
width: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
minWidth: {
|
|
51
|
+
style: {
|
|
52
|
+
minWidth: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
maxWidth: {
|
|
56
|
+
style: {
|
|
57
|
+
maxWidth: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
square: {
|
|
61
|
+
style: {
|
|
62
|
+
height: string;
|
|
63
|
+
width: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bgord/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./dist/index.cjs",
|
|
6
|
-
"module": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
5
|
"exports": {
|
|
12
6
|
".": {
|
|
13
7
|
"import": "./dist/index.js",
|
|
14
|
-
"require": "./dist/index.cjs",
|
|
15
8
|
"types": "./dist/index.d.ts"
|
|
16
9
|
}
|
|
17
10
|
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
18
14
|
"peerDependencies": {
|
|
19
15
|
"react": "19.1.0",
|
|
20
|
-
"react-dom": "19.1.0"
|
|
16
|
+
"react-dom": "19.1.0",
|
|
17
|
+
"react-router": "7.6.3"
|
|
21
18
|
},
|
|
22
19
|
"scripts": {
|
|
23
|
-
"build:js": "bun build src/index.ts --outdir dist",
|
|
20
|
+
"build:js": "bun build src/index.ts --format esm --outdir dist --packages external --external react --external react-dom --external react/jsx-runtime --external react-router",
|
|
24
21
|
"build:types": "bunx tsc --emitDeclarationOnly",
|
|
25
22
|
"build": "bun run build:js && bun run build:types"
|
|
26
23
|
},
|
|
@@ -28,7 +25,21 @@
|
|
|
28
25
|
"access": "public"
|
|
29
26
|
},
|
|
30
27
|
"devDependencies": {
|
|
28
|
+
"@happy-dom/global-registrator": "18.0.1",
|
|
29
|
+
"@testing-library/dom": "10.4.0",
|
|
30
|
+
"@testing-library/jest-dom": "6.6.3",
|
|
31
|
+
"@testing-library/react": "16.3.0",
|
|
32
|
+
"@testing-library/user-event": "14.6.1",
|
|
33
|
+
"@types/bun": "1.2.18",
|
|
31
34
|
"@types/react": "19.1.8",
|
|
32
|
-
"@types/react-dom": "19.1.6"
|
|
35
|
+
"@types/react-dom": "19.1.6",
|
|
36
|
+
"@biomejs/biome": "2.0.6",
|
|
37
|
+
"@commitlint/cli": "19.8.1",
|
|
38
|
+
"@commitlint/config-conventional": "19.8.1",
|
|
39
|
+
"cspell": "9.1.3",
|
|
40
|
+
"knip": "5.61.3",
|
|
41
|
+
"lefthook": "1.11.16",
|
|
42
|
+
"only-allow": "1.2.1",
|
|
43
|
+
"shellcheck": "3.1.0"
|
|
33
44
|
}
|
|
34
45
|
}
|