@stokelp/ui 2.100.0 → 2.101.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/components/avatar/styled.cjs +1 -1
- package/dist/components/avatar/styled.cjs.map +1 -1
- package/dist/components/avatar/styled.js +7 -7
- package/dist/components/date-picker/DatePicker.cjs +1 -1
- package/dist/components/date-picker/DatePicker.js +6 -6
- package/dist/components/radio-button-group/RadioButtonGroup.d.ts +1 -1
- package/dist/components/radio-group/RadioGroup.d.ts +1 -1
- package/dist/node_modules/@zag-js/utils/dist/functions.cjs +2 -0
- package/dist/node_modules/@zag-js/utils/dist/functions.cjs.map +1 -0
- package/dist/node_modules/@zag-js/utils/dist/functions.js +6 -0
- package/dist/node_modules/@zag-js/utils/dist/functions.js.map +1 -0
- package/dist/node_modules/lodash/lodash.cjs +9 -9
- package/dist/node_modules/lodash/lodash.cjs.map +1 -1
- package/dist/node_modules/lodash/lodash.js +1738 -1740
- package/dist/node_modules/lodash/lodash.js.map +1 -1
- package/dist/ui.css +1 -1
- package/package.json +13 -13
- package/dist/node_modules/@zag-js/utils/dist/index.cjs +0 -2
- package/dist/node_modules/@zag-js/utils/dist/index.cjs.map +0 -1
- package/dist/node_modules/@zag-js/utils/dist/index.js +0 -8
- package/dist/node_modules/@zag-js/utils/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stokelp/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.101.0",
|
|
4
4
|
"description": "Stokelp UI React",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -75,27 +75,27 @@
|
|
|
75
75
|
"react-window": "^1.8.11"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@chromatic-com/storybook": "^5.
|
|
78
|
+
"@chromatic-com/storybook": "^5.1.1",
|
|
79
79
|
"@stokelp/styled-system": "workspace:*",
|
|
80
|
-
"@storybook/addon-docs": "^10.
|
|
81
|
-
"@storybook/addon-links": "^10.
|
|
82
|
-
"@storybook/react-vite": "^10.
|
|
83
|
-
"@types/lodash": "^4.17.
|
|
84
|
-
"@types/react": "^19.2.
|
|
80
|
+
"@storybook/addon-docs": "^10.3.5",
|
|
81
|
+
"@storybook/addon-links": "^10.3.5",
|
|
82
|
+
"@storybook/react-vite": "^10.3.5",
|
|
83
|
+
"@types/lodash": "^4.17.24",
|
|
84
|
+
"@types/react": "^19.2.14",
|
|
85
85
|
"@types/react-is": "^19.2.0",
|
|
86
86
|
"@types/react-window": "^1.8.8",
|
|
87
|
-
"@vitejs/plugin-react": "^5.
|
|
87
|
+
"@vitejs/plugin-react": "^5.2.0",
|
|
88
88
|
"deepmerge": "^4.3.1",
|
|
89
89
|
"prop-types": "^15.8.1",
|
|
90
|
-
"storybook": "^10.
|
|
91
|
-
"storybook-addon-data-theme-switcher": "^3.0
|
|
90
|
+
"storybook": "^10.3.5",
|
|
91
|
+
"storybook-addon-data-theme-switcher": "^3.2.0",
|
|
92
92
|
"vite-plugin-dts": "^4.5.4",
|
|
93
|
-
"vite-tsconfig-paths": "^6.
|
|
93
|
+
"vite-tsconfig-paths": "^6.1.1"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
|
-
"@ark-ui/react": "5.
|
|
96
|
+
"@ark-ui/react": "5.35.0",
|
|
97
97
|
"react-is": "19.2.4",
|
|
98
|
-
"react-phone-number-input": "^3.4.
|
|
98
|
+
"react-phone-number-input": "^3.4.16",
|
|
99
99
|
"usehooks-ts": "3.1.1"
|
|
100
100
|
},
|
|
101
101
|
"release": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../../../../node_modules/@zag-js/utils/dist/index.mjs"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __typeError = (msg) => {\n throw TypeError(msg);\n};\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar __accessCheck = (obj, member, msg) => member.has(obj) || __typeError(\"Cannot \" + msg);\nvar __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), member.get(obj));\nvar __privateAdd = (obj, member, value) => member.has(obj) ? __typeError(\"Cannot add the same private member more than once\") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n\n// src/array.ts\nfunction toArray(v) {\n if (v == null) return [];\n return Array.isArray(v) ? v : [v];\n}\nvar fromLength = (length) => Array.from(Array(length).keys());\nvar first = (v) => v[0];\nvar last = (v) => v[v.length - 1];\nvar isEmpty = (v) => v.length === 0;\nvar has = (v, t) => v.indexOf(t) !== -1;\nvar add = (v, ...items) => v.concat(items);\nvar remove = (v, ...items) => v.filter((t) => !items.includes(t));\nvar removeAt = (v, i) => v.filter((_, idx) => idx !== i);\nvar insertAt = (v, i, ...items) => [...v.slice(0, i), ...items, ...v.slice(i)];\nvar uniq = (v) => Array.from(new Set(v));\nvar diff = (a, b) => {\n const set = new Set(b);\n return a.filter((t) => !set.has(t));\n};\nvar addOrRemove = (v, item) => has(v, item) ? remove(v, item) : add(v, item);\nfunction clear(v) {\n while (v.length > 0) v.pop();\n return v;\n}\nfunction nextIndex(v, idx, opts = {}) {\n const { step = 1, loop = true } = opts;\n const next2 = idx + step;\n const len = v.length;\n const last2 = len - 1;\n if (idx === -1) return step > 0 ? 0 : last2;\n if (next2 < 0) return loop ? last2 : 0;\n if (next2 >= len) return loop ? 0 : idx > len ? len : idx;\n return next2;\n}\nfunction next(v, idx, opts = {}) {\n return v[nextIndex(v, idx, opts)];\n}\nfunction prevIndex(v, idx, opts = {}) {\n const { step = 1, loop = true } = opts;\n return nextIndex(v, idx, { step: -step, loop });\n}\nfunction prev(v, index, opts = {}) {\n return v[prevIndex(v, index, opts)];\n}\nfunction chunk(v, size) {\n return v.reduce((rows, value, index) => {\n if (index % size === 0) rows.push([value]);\n else last(rows)?.push(value);\n return rows;\n }, []);\n}\nfunction flatArray(arr) {\n return arr.reduce((flat, item) => {\n if (Array.isArray(item)) {\n return flat.concat(flatArray(item));\n }\n return flat.concat(item);\n }, []);\n}\nfunction partition(arr, fn) {\n return arr.reduce(\n ([pass, fail], value) => {\n if (fn(value)) pass.push(value);\n else fail.push(value);\n return [pass, fail];\n },\n [[], []]\n );\n}\n\n// src/equal.ts\nvar isArrayLike = (value) => value?.constructor.name === \"Array\";\nvar isArrayEqual = (a, b) => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!isEqual(a[i], b[i])) return false;\n }\n return true;\n};\nvar isEqual = (a, b) => {\n if (Object.is(a, b)) return true;\n if (a == null && b != null || a != null && b == null) return false;\n if (typeof a?.isEqual === \"function\" && typeof b?.isEqual === \"function\") {\n return a.isEqual(b);\n }\n if (typeof a === \"function\" && typeof b === \"function\") {\n return a.toString() === b.toString();\n }\n if (isArrayLike(a) && isArrayLike(b)) {\n return isArrayEqual(Array.from(a), Array.from(b));\n }\n if (!(typeof a === \"object\") || !(typeof b === \"object\")) return false;\n const keys = Object.keys(b ?? /* @__PURE__ */ Object.create(null));\n const length = keys.length;\n for (let i = 0; i < length; i++) {\n const hasKey = Reflect.has(a, keys[i]);\n if (!hasKey) return false;\n }\n for (let i = 0; i < length; i++) {\n const key = keys[i];\n if (!isEqual(a[key], b[key])) return false;\n }\n return true;\n};\n\n// src/guard.ts\nvar isDev = () => process.env.NODE_ENV !== \"production\";\nvar isArray = (v) => Array.isArray(v);\nvar isBoolean = (v) => v === true || v === false;\nvar isObjectLike = (v) => v != null && typeof v === \"object\";\nvar isObject = (v) => isObjectLike(v) && !isArray(v);\nvar isNumber = (v) => typeof v === \"number\" && !Number.isNaN(v);\nvar isString = (v) => typeof v === \"string\";\nvar isFunction = (v) => typeof v === \"function\";\nvar isNull = (v) => v == null;\nvar hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nvar baseGetTag = (v) => Object.prototype.toString.call(v);\nvar fnToString = Function.prototype.toString;\nvar objectCtorString = fnToString.call(Object);\nvar isPlainObject = (v) => {\n if (!isObjectLike(v) || baseGetTag(v) != \"[object Object]\" || isFrameworkElement(v)) return false;\n const proto = Object.getPrototypeOf(v);\n if (proto === null) return true;\n const Ctor = hasProp(proto, \"constructor\") && proto.constructor;\n return typeof Ctor == \"function\" && Ctor instanceof Ctor && fnToString.call(Ctor) == objectCtorString;\n};\nvar isReactElement = (x) => typeof x === \"object\" && x !== null && \"$$typeof\" in x && \"props\" in x;\nvar isVueElement = (x) => typeof x === \"object\" && x !== null && \"__v_isVNode\" in x;\nvar isFrameworkElement = (x) => isReactElement(x) || isVueElement(x);\n\n// src/functions.ts\nvar runIfFn = (v, ...a) => {\n const res = typeof v === \"function\" ? v(...a) : v;\n return res ?? void 0;\n};\nvar cast = (v) => v;\nvar identity = (v) => v();\nvar noop = () => {\n};\nvar callAll = (...fns) => (...a) => {\n fns.forEach(function(fn) {\n fn?.(...a);\n });\n};\nvar uuid = /* @__PURE__ */ (() => {\n let id = 0;\n return () => {\n id++;\n return id.toString(36);\n };\n})();\nfunction match(key, record, ...args) {\n if (key in record) {\n const fn = record[key];\n return isFunction(fn) ? fn(...args) : fn;\n }\n const error = new Error(`No matching key: ${JSON.stringify(key)} in ${JSON.stringify(Object.keys(record))}`);\n Error.captureStackTrace?.(error, match);\n throw error;\n}\nvar tryCatch = (fn, fallback) => {\n try {\n return fn();\n } catch (error) {\n if (error instanceof Error) {\n Error.captureStackTrace?.(error, tryCatch);\n }\n return fallback?.();\n }\n};\nfunction throttle(fn, wait = 0) {\n let lastCall = 0;\n let timeout = null;\n return ((...args) => {\n const now = Date.now();\n const timeSinceLastCall = now - lastCall;\n if (timeSinceLastCall >= wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n fn(...args);\n lastCall = now;\n } else if (!timeout) {\n timeout = setTimeout(() => {\n fn(...args);\n lastCall = Date.now();\n timeout = null;\n }, wait - timeSinceLastCall);\n }\n });\n}\nfunction debounce(fn, wait = 0) {\n let timeout = null;\n return ((...args) => {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n timeout = setTimeout(() => {\n fn(...args);\n }, wait);\n });\n}\nvar toChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));\nfunction toName(code) {\n let name = \"\";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i) h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nvar hash = (value) => toName(toPhash(5381, value) >>> 0);\n\n// src/number.ts\nvar { floor, abs, round, min, max, pow, sign } = Math;\nvar isNaN = (v) => Number.isNaN(v);\nvar nan = (v) => isNaN(v) ? 0 : v;\nvar mod = (v, m) => (v % m + m) % m;\nvar wrap = (v, vmax) => (v % vmax + vmax) % vmax;\nvar getMinValueAtIndex = (i, v, vmin) => i === 0 ? vmin : v[i - 1];\nvar getMaxValueAtIndex = (i, v, vmax) => i === v.length - 1 ? vmax : v[i + 1];\nvar isValueAtMax = (v, vmax) => nan(v) >= vmax;\nvar isValueAtMin = (v, vmin) => nan(v) <= vmin;\nvar isValueWithinRange = (v, vmin, vmax) => {\n const value = nan(v);\n const minCheck = vmin == null || value >= vmin;\n const maxCheck = vmax == null || value <= vmax;\n return minCheck && maxCheck;\n};\nvar roundValue = (v, vmin, step) => round((nan(v) - vmin) / step) * step + vmin;\nvar clampValue = (v, vmin, vmax) => min(max(nan(v), vmin), vmax);\nvar clampPercent = (v) => clampValue(v, 0, 1);\nvar getValuePercent = (v, vmin, vmax) => (nan(v) - vmin) / (vmax - vmin);\nvar getPercentValue = (p, vmin, vmax, step) => clampValue(roundValue(p * (vmax - vmin) + vmin, vmin, step), vmin, vmax);\nvar roundToStepPrecision = (v, step) => {\n let rv = v;\n let ss = step.toString();\n let pi = ss.indexOf(\".\");\n let p = pi >= 0 ? ss.length - pi : 0;\n if (p > 0) {\n let pw = pow(10, p);\n rv = round(rv * pw) / pw;\n }\n return rv;\n};\nvar roundToDpr = (v, dpr) => typeof dpr === \"number\" ? floor(v * dpr + 0.5) / dpr : round(v);\nvar snapValueToStep = (v, vmin, vmax, step) => {\n const min2 = vmin != null ? Number(vmin) : 0;\n const max2 = Number(vmax);\n const remainder = (v - min2) % step;\n let snapped = abs(remainder) * 2 >= step ? v + sign(remainder) * (step - abs(remainder)) : v - remainder;\n snapped = roundToStepPrecision(snapped, step);\n if (!isNaN(min2) && snapped < min2) {\n snapped = min2;\n } else if (!isNaN(max2) && snapped > max2) {\n const stepsInRange = floor((max2 - min2) / step);\n const largestValidStep = min2 + stepsInRange * step;\n snapped = stepsInRange <= 0 || largestValidStep < min2 ? max2 : largestValidStep;\n }\n return roundToStepPrecision(snapped, step);\n};\nvar setValueAtIndex = (vs, i, v) => {\n if (vs[i] === v) return vs;\n return [...vs.slice(0, i), v, ...vs.slice(i + 1)];\n};\nfunction getValueSetterAtIndex(index, ctx) {\n const minValueAtIndex = getMinValueAtIndex(index, ctx.values, ctx.min);\n const maxValueAtIndex = getMaxValueAtIndex(index, ctx.values, ctx.max);\n let nextValues = ctx.values.slice();\n return function setValue(value) {\n let nextValue = snapValueToStep(value, minValueAtIndex, maxValueAtIndex, ctx.step);\n nextValues = setValueAtIndex(nextValues, index, value);\n nextValues[index] = nextValue;\n return nextValues;\n };\n}\nfunction getNextStepValue(index, ctx) {\n const nextValue = ctx.values[index] + ctx.step;\n return getValueSetterAtIndex(index, ctx)(nextValue);\n}\nfunction getPreviousStepValue(index, ctx) {\n const nextValue = ctx.values[index] - ctx.step;\n return getValueSetterAtIndex(index, ctx)(nextValue);\n}\nvar getClosestValueIndex = (vs, t) => {\n let i = vs.findIndex((v) => t - v < 0);\n if (i === 0) return i;\n if (i === -1) return vs.length - 1;\n let vLeft = vs[i - 1];\n let vRight = vs[i];\n if (abs(vLeft - t) < abs(vRight - t)) return i - 1;\n return i;\n};\nvar getClosestValue = (vs, t) => vs[getClosestValueIndex(vs, t)];\nvar getValueRanges = (vs, vmin, vmax, gap) => vs.map((v, i) => ({\n min: i === 0 ? vmin : vs[i - 1] + gap,\n max: i === vs.length - 1 ? vmax : vs[i + 1] - gap,\n value: v\n}));\nvar getValueTransformer = (va, vb) => {\n const [a, b] = va;\n const [c, d] = vb;\n return (v) => a === b || c === d ? c : c + (d - c) / (b - a) * (v - a);\n};\nvar toFixedNumber = (v, d = 0, b = 10) => {\n const pow2 = Math.pow(b, d);\n return round(v * pow2) / pow2;\n};\nvar countDecimals = (value) => {\n if (!Number.isFinite(value)) return 0;\n let e = 1, p = 0;\n while (Math.round(value * e) / e !== value) {\n e *= 10;\n p += 1;\n }\n return p;\n};\nvar decimalOp = (a, op, b) => {\n let result = op === \"+\" ? a + b : a - b;\n if (a % 1 !== 0 || b % 1 !== 0) {\n const multiplier = 10 ** Math.max(countDecimals(a), countDecimals(b));\n a = Math.round(a * multiplier);\n b = Math.round(b * multiplier);\n result = op === \"+\" ? a + b : a - b;\n result /= multiplier;\n }\n return result;\n};\nvar incrementValue = (v, s) => decimalOp(nan(v), \"+\", s);\nvar decrementValue = (v, s) => decimalOp(nan(v), \"-\", s);\nvar toPx = (v) => typeof v === \"number\" ? `${v}px` : v;\n\n// src/object.ts\nfunction compact(obj) {\n if (!isPlainObject(obj) || obj === void 0) return obj;\n const keys = Reflect.ownKeys(obj).filter((key) => typeof key === \"string\");\n const filtered = {};\n for (const key of keys) {\n const value = obj[key];\n if (value !== void 0) {\n filtered[key] = compact(value);\n }\n }\n return filtered;\n}\nvar json = (v) => JSON.parse(JSON.stringify(v));\nfunction pick(obj, keys) {\n const filtered = {};\n for (const key of keys) {\n const value = obj[key];\n if (value !== void 0) {\n filtered[key] = value;\n }\n }\n return filtered;\n}\nfunction splitProps(props, keys) {\n const rest = {};\n const result = {};\n const keySet = new Set(keys);\n const ownKeys = Reflect.ownKeys(props);\n for (const key of ownKeys) {\n if (keySet.has(key)) {\n result[key] = props[key];\n } else {\n rest[key] = props[key];\n }\n }\n return [result, rest];\n}\nvar createSplitProps = (keys) => {\n return function split(props) {\n return splitProps(props, keys);\n };\n};\nfunction omit(obj, keys) {\n return createSplitProps(keys)(obj)[1];\n}\n\n// src/store.ts\nfunction createStore(initialState, compare = Object.is) {\n let state = { ...initialState };\n const listeners = /* @__PURE__ */ new Set();\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const publish = () => {\n listeners.forEach((listener) => listener());\n };\n const get = (key) => {\n return state[key];\n };\n const set = (key, value) => {\n if (!compare(state[key], value)) {\n state[key] = value;\n publish();\n }\n };\n const update = (updates) => {\n let hasChanges = false;\n for (const key in updates) {\n const value = updates[key];\n if (value !== void 0 && !compare(state[key], value)) {\n state[key] = value;\n hasChanges = true;\n }\n }\n if (hasChanges) {\n publish();\n }\n };\n const snapshot = () => ({ ...state });\n return {\n subscribe,\n get,\n set,\n update,\n snapshot\n };\n}\n\n// src/timers.ts\nvar currentTime = () => performance.now();\nvar _tick;\nvar Timer = class {\n constructor(onTick) {\n this.onTick = onTick;\n __publicField(this, \"frameId\", null);\n __publicField(this, \"pausedAtMs\", null);\n __publicField(this, \"context\");\n __publicField(this, \"cancelFrame\", () => {\n if (this.frameId === null) return;\n cancelAnimationFrame(this.frameId);\n this.frameId = null;\n });\n __publicField(this, \"setStartMs\", (startMs) => {\n this.context.startMs = startMs;\n });\n __publicField(this, \"start\", () => {\n if (this.frameId !== null) return;\n const now = currentTime();\n if (this.pausedAtMs !== null) {\n this.context.startMs += now - this.pausedAtMs;\n this.pausedAtMs = null;\n } else {\n this.context.startMs = now;\n }\n this.frameId = requestAnimationFrame(__privateGet(this, _tick));\n });\n __publicField(this, \"pause\", () => {\n if (this.frameId === null) return;\n this.cancelFrame();\n this.pausedAtMs = currentTime();\n });\n __publicField(this, \"stop\", () => {\n if (this.frameId === null) return;\n this.cancelFrame();\n this.pausedAtMs = null;\n });\n __privateAdd(this, _tick, (now) => {\n this.context.now = now;\n this.context.deltaMs = now - this.context.startMs;\n const shouldContinue = this.onTick(this.context);\n if (shouldContinue === false) {\n this.stop();\n return;\n }\n this.frameId = requestAnimationFrame(__privateGet(this, _tick));\n });\n this.context = { now: 0, startMs: currentTime(), deltaMs: 0 };\n }\n get elapsedMs() {\n if (this.pausedAtMs !== null) {\n return this.pausedAtMs - this.context.startMs;\n }\n return currentTime() - this.context.startMs;\n }\n};\n_tick = new WeakMap();\nfunction setRafInterval(fn, intervalMs) {\n const timer = new Timer(({ now, deltaMs }) => {\n if (deltaMs >= intervalMs) {\n const startMs = intervalMs > 0 ? now - deltaMs % intervalMs : now;\n timer.setStartMs(startMs);\n fn({ startMs, deltaMs });\n }\n });\n timer.start();\n return () => timer.stop();\n}\nfunction setRafTimeout(fn, delayMs) {\n const timer = new Timer(({ deltaMs }) => {\n if (deltaMs >= delayMs) {\n fn();\n return false;\n }\n });\n timer.start();\n return () => timer.stop();\n}\n\n// src/warning.ts\nfunction warn(...a) {\n const m = a.length === 1 ? a[0] : a[1];\n const c = a.length === 2 ? a[0] : true;\n if (c && process.env.NODE_ENV !== \"production\") {\n console.warn(m);\n }\n}\nfunction invariant(...a) {\n const m = a.length === 1 ? a[0] : a[1];\n const c = a.length === 2 ? a[0] : true;\n if (c && process.env.NODE_ENV !== \"production\") {\n throw new Error(m);\n }\n}\nfunction ensure(c, m) {\n if (c == null) throw new Error(m());\n}\nfunction ensureProps(props, keys, scope) {\n let missingKeys = [];\n for (const key of keys) {\n if (props[key] == null) missingKeys.push(key);\n }\n if (missingKeys.length > 0)\n throw new Error(`[zag-js${scope ? ` > ${scope}` : \"\"}] missing required props: ${missingKeys.join(\", \")}`);\n}\n\nexport { Timer, add, addOrRemove, callAll, cast, chunk, clampPercent, clampValue, clear, compact, createSplitProps, createStore, debounce, decrementValue, diff, ensure, ensureProps, first, flatArray, fromLength, getClosestValue, getClosestValueIndex, getMaxValueAtIndex, getMinValueAtIndex, getNextStepValue, getPercentValue, getPreviousStepValue, getValuePercent, getValueRanges, getValueSetterAtIndex, getValueTransformer, has, hasProp, hash, identity, incrementValue, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNaN, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, isValueAtMax, isValueAtMin, isValueWithinRange, json, last, match, mod, nan, next, nextIndex, noop, omit, partition, pick, prev, prevIndex, remove, removeAt, roundToDpr, roundToStepPrecision, roundValue, runIfFn, setRafInterval, setRafTimeout, setValueAtIndex, snapValueToStep, splitProps, throttle, toArray, toFixedNumber, toPx, tryCatch, uniq, uuid, warn, wrap };\n"],"names":["fnToString","runIfFn","v","a"],"mappings":"6FA+HA,IAAIA,EAAa,SAAS,UAAU,SACbA,EAAW,KAAK,MAAM,EAa1C,IAACC,EAAU,CAACC,KAAMC,KACP,OAAOD,GAAM,WAAaA,EAAE,GAAGC,CAAC,EAAID,IAClC","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../node_modules/@zag-js/utils/dist/index.mjs"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __typeError = (msg) => {\n throw TypeError(msg);\n};\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar __accessCheck = (obj, member, msg) => member.has(obj) || __typeError(\"Cannot \" + msg);\nvar __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), member.get(obj));\nvar __privateAdd = (obj, member, value) => member.has(obj) ? __typeError(\"Cannot add the same private member more than once\") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n\n// src/array.ts\nfunction toArray(v) {\n if (v == null) return [];\n return Array.isArray(v) ? v : [v];\n}\nvar fromLength = (length) => Array.from(Array(length).keys());\nvar first = (v) => v[0];\nvar last = (v) => v[v.length - 1];\nvar isEmpty = (v) => v.length === 0;\nvar has = (v, t) => v.indexOf(t) !== -1;\nvar add = (v, ...items) => v.concat(items);\nvar remove = (v, ...items) => v.filter((t) => !items.includes(t));\nvar removeAt = (v, i) => v.filter((_, idx) => idx !== i);\nvar insertAt = (v, i, ...items) => [...v.slice(0, i), ...items, ...v.slice(i)];\nvar uniq = (v) => Array.from(new Set(v));\nvar diff = (a, b) => {\n const set = new Set(b);\n return a.filter((t) => !set.has(t));\n};\nvar addOrRemove = (v, item) => has(v, item) ? remove(v, item) : add(v, item);\nfunction clear(v) {\n while (v.length > 0) v.pop();\n return v;\n}\nfunction nextIndex(v, idx, opts = {}) {\n const { step = 1, loop = true } = opts;\n const next2 = idx + step;\n const len = v.length;\n const last2 = len - 1;\n if (idx === -1) return step > 0 ? 0 : last2;\n if (next2 < 0) return loop ? last2 : 0;\n if (next2 >= len) return loop ? 0 : idx > len ? len : idx;\n return next2;\n}\nfunction next(v, idx, opts = {}) {\n return v[nextIndex(v, idx, opts)];\n}\nfunction prevIndex(v, idx, opts = {}) {\n const { step = 1, loop = true } = opts;\n return nextIndex(v, idx, { step: -step, loop });\n}\nfunction prev(v, index, opts = {}) {\n return v[prevIndex(v, index, opts)];\n}\nfunction chunk(v, size) {\n return v.reduce((rows, value, index) => {\n if (index % size === 0) rows.push([value]);\n else last(rows)?.push(value);\n return rows;\n }, []);\n}\nfunction flatArray(arr) {\n return arr.reduce((flat, item) => {\n if (Array.isArray(item)) {\n return flat.concat(flatArray(item));\n }\n return flat.concat(item);\n }, []);\n}\nfunction partition(arr, fn) {\n return arr.reduce(\n ([pass, fail], value) => {\n if (fn(value)) pass.push(value);\n else fail.push(value);\n return [pass, fail];\n },\n [[], []]\n );\n}\n\n// src/equal.ts\nvar isArrayLike = (value) => value?.constructor.name === \"Array\";\nvar isArrayEqual = (a, b) => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!isEqual(a[i], b[i])) return false;\n }\n return true;\n};\nvar isEqual = (a, b) => {\n if (Object.is(a, b)) return true;\n if (a == null && b != null || a != null && b == null) return false;\n if (typeof a?.isEqual === \"function\" && typeof b?.isEqual === \"function\") {\n return a.isEqual(b);\n }\n if (typeof a === \"function\" && typeof b === \"function\") {\n return a.toString() === b.toString();\n }\n if (isArrayLike(a) && isArrayLike(b)) {\n return isArrayEqual(Array.from(a), Array.from(b));\n }\n if (!(typeof a === \"object\") || !(typeof b === \"object\")) return false;\n const keys = Object.keys(b ?? /* @__PURE__ */ Object.create(null));\n const length = keys.length;\n for (let i = 0; i < length; i++) {\n const hasKey = Reflect.has(a, keys[i]);\n if (!hasKey) return false;\n }\n for (let i = 0; i < length; i++) {\n const key = keys[i];\n if (!isEqual(a[key], b[key])) return false;\n }\n return true;\n};\n\n// src/guard.ts\nvar isDev = () => process.env.NODE_ENV !== \"production\";\nvar isArray = (v) => Array.isArray(v);\nvar isBoolean = (v) => v === true || v === false;\nvar isObjectLike = (v) => v != null && typeof v === \"object\";\nvar isObject = (v) => isObjectLike(v) && !isArray(v);\nvar isNumber = (v) => typeof v === \"number\" && !Number.isNaN(v);\nvar isString = (v) => typeof v === \"string\";\nvar isFunction = (v) => typeof v === \"function\";\nvar isNull = (v) => v == null;\nvar hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nvar baseGetTag = (v) => Object.prototype.toString.call(v);\nvar fnToString = Function.prototype.toString;\nvar objectCtorString = fnToString.call(Object);\nvar isPlainObject = (v) => {\n if (!isObjectLike(v) || baseGetTag(v) != \"[object Object]\" || isFrameworkElement(v)) return false;\n const proto = Object.getPrototypeOf(v);\n if (proto === null) return true;\n const Ctor = hasProp(proto, \"constructor\") && proto.constructor;\n return typeof Ctor == \"function\" && Ctor instanceof Ctor && fnToString.call(Ctor) == objectCtorString;\n};\nvar isReactElement = (x) => typeof x === \"object\" && x !== null && \"$$typeof\" in x && \"props\" in x;\nvar isVueElement = (x) => typeof x === \"object\" && x !== null && \"__v_isVNode\" in x;\nvar isFrameworkElement = (x) => isReactElement(x) || isVueElement(x);\n\n// src/functions.ts\nvar runIfFn = (v, ...a) => {\n const res = typeof v === \"function\" ? v(...a) : v;\n return res ?? void 0;\n};\nvar cast = (v) => v;\nvar identity = (v) => v();\nvar noop = () => {\n};\nvar callAll = (...fns) => (...a) => {\n fns.forEach(function(fn) {\n fn?.(...a);\n });\n};\nvar uuid = /* @__PURE__ */ (() => {\n let id = 0;\n return () => {\n id++;\n return id.toString(36);\n };\n})();\nfunction match(key, record, ...args) {\n if (key in record) {\n const fn = record[key];\n return isFunction(fn) ? fn(...args) : fn;\n }\n const error = new Error(`No matching key: ${JSON.stringify(key)} in ${JSON.stringify(Object.keys(record))}`);\n Error.captureStackTrace?.(error, match);\n throw error;\n}\nvar tryCatch = (fn, fallback) => {\n try {\n return fn();\n } catch (error) {\n if (error instanceof Error) {\n Error.captureStackTrace?.(error, tryCatch);\n }\n return fallback?.();\n }\n};\nfunction throttle(fn, wait = 0) {\n let lastCall = 0;\n let timeout = null;\n return ((...args) => {\n const now = Date.now();\n const timeSinceLastCall = now - lastCall;\n if (timeSinceLastCall >= wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n fn(...args);\n lastCall = now;\n } else if (!timeout) {\n timeout = setTimeout(() => {\n fn(...args);\n lastCall = Date.now();\n timeout = null;\n }, wait - timeSinceLastCall);\n }\n });\n}\nfunction debounce(fn, wait = 0) {\n let timeout = null;\n return ((...args) => {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n timeout = setTimeout(() => {\n fn(...args);\n }, wait);\n });\n}\nvar toChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));\nfunction toName(code) {\n let name = \"\";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i) h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nvar hash = (value) => toName(toPhash(5381, value) >>> 0);\n\n// src/number.ts\nvar { floor, abs, round, min, max, pow, sign } = Math;\nvar isNaN = (v) => Number.isNaN(v);\nvar nan = (v) => isNaN(v) ? 0 : v;\nvar mod = (v, m) => (v % m + m) % m;\nvar wrap = (v, vmax) => (v % vmax + vmax) % vmax;\nvar getMinValueAtIndex = (i, v, vmin) => i === 0 ? vmin : v[i - 1];\nvar getMaxValueAtIndex = (i, v, vmax) => i === v.length - 1 ? vmax : v[i + 1];\nvar isValueAtMax = (v, vmax) => nan(v) >= vmax;\nvar isValueAtMin = (v, vmin) => nan(v) <= vmin;\nvar isValueWithinRange = (v, vmin, vmax) => {\n const value = nan(v);\n const minCheck = vmin == null || value >= vmin;\n const maxCheck = vmax == null || value <= vmax;\n return minCheck && maxCheck;\n};\nvar roundValue = (v, vmin, step) => round((nan(v) - vmin) / step) * step + vmin;\nvar clampValue = (v, vmin, vmax) => min(max(nan(v), vmin), vmax);\nvar clampPercent = (v) => clampValue(v, 0, 1);\nvar getValuePercent = (v, vmin, vmax) => (nan(v) - vmin) / (vmax - vmin);\nvar getPercentValue = (p, vmin, vmax, step) => clampValue(roundValue(p * (vmax - vmin) + vmin, vmin, step), vmin, vmax);\nvar roundToStepPrecision = (v, step) => {\n let rv = v;\n let ss = step.toString();\n let pi = ss.indexOf(\".\");\n let p = pi >= 0 ? ss.length - pi : 0;\n if (p > 0) {\n let pw = pow(10, p);\n rv = round(rv * pw) / pw;\n }\n return rv;\n};\nvar roundToDpr = (v, dpr) => typeof dpr === \"number\" ? floor(v * dpr + 0.5) / dpr : round(v);\nvar snapValueToStep = (v, vmin, vmax, step) => {\n const min2 = vmin != null ? Number(vmin) : 0;\n const max2 = Number(vmax);\n const remainder = (v - min2) % step;\n let snapped = abs(remainder) * 2 >= step ? v + sign(remainder) * (step - abs(remainder)) : v - remainder;\n snapped = roundToStepPrecision(snapped, step);\n if (!isNaN(min2) && snapped < min2) {\n snapped = min2;\n } else if (!isNaN(max2) && snapped > max2) {\n const stepsInRange = floor((max2 - min2) / step);\n const largestValidStep = min2 + stepsInRange * step;\n snapped = stepsInRange <= 0 || largestValidStep < min2 ? max2 : largestValidStep;\n }\n return roundToStepPrecision(snapped, step);\n};\nvar setValueAtIndex = (vs, i, v) => {\n if (vs[i] === v) return vs;\n return [...vs.slice(0, i), v, ...vs.slice(i + 1)];\n};\nfunction getValueSetterAtIndex(index, ctx) {\n const minValueAtIndex = getMinValueAtIndex(index, ctx.values, ctx.min);\n const maxValueAtIndex = getMaxValueAtIndex(index, ctx.values, ctx.max);\n let nextValues = ctx.values.slice();\n return function setValue(value) {\n let nextValue = snapValueToStep(value, minValueAtIndex, maxValueAtIndex, ctx.step);\n nextValues = setValueAtIndex(nextValues, index, value);\n nextValues[index] = nextValue;\n return nextValues;\n };\n}\nfunction getNextStepValue(index, ctx) {\n const nextValue = ctx.values[index] + ctx.step;\n return getValueSetterAtIndex(index, ctx)(nextValue);\n}\nfunction getPreviousStepValue(index, ctx) {\n const nextValue = ctx.values[index] - ctx.step;\n return getValueSetterAtIndex(index, ctx)(nextValue);\n}\nvar getClosestValueIndex = (vs, t) => {\n let i = vs.findIndex((v) => t - v < 0);\n if (i === 0) return i;\n if (i === -1) return vs.length - 1;\n let vLeft = vs[i - 1];\n let vRight = vs[i];\n if (abs(vLeft - t) < abs(vRight - t)) return i - 1;\n return i;\n};\nvar getClosestValue = (vs, t) => vs[getClosestValueIndex(vs, t)];\nvar getValueRanges = (vs, vmin, vmax, gap) => vs.map((v, i) => ({\n min: i === 0 ? vmin : vs[i - 1] + gap,\n max: i === vs.length - 1 ? vmax : vs[i + 1] - gap,\n value: v\n}));\nvar getValueTransformer = (va, vb) => {\n const [a, b] = va;\n const [c, d] = vb;\n return (v) => a === b || c === d ? c : c + (d - c) / (b - a) * (v - a);\n};\nvar toFixedNumber = (v, d = 0, b = 10) => {\n const pow2 = Math.pow(b, d);\n return round(v * pow2) / pow2;\n};\nvar countDecimals = (value) => {\n if (!Number.isFinite(value)) return 0;\n let e = 1, p = 0;\n while (Math.round(value * e) / e !== value) {\n e *= 10;\n p += 1;\n }\n return p;\n};\nvar decimalOp = (a, op, b) => {\n let result = op === \"+\" ? a + b : a - b;\n if (a % 1 !== 0 || b % 1 !== 0) {\n const multiplier = 10 ** Math.max(countDecimals(a), countDecimals(b));\n a = Math.round(a * multiplier);\n b = Math.round(b * multiplier);\n result = op === \"+\" ? a + b : a - b;\n result /= multiplier;\n }\n return result;\n};\nvar incrementValue = (v, s) => decimalOp(nan(v), \"+\", s);\nvar decrementValue = (v, s) => decimalOp(nan(v), \"-\", s);\nvar toPx = (v) => typeof v === \"number\" ? `${v}px` : v;\n\n// src/object.ts\nfunction compact(obj) {\n if (!isPlainObject(obj) || obj === void 0) return obj;\n const keys = Reflect.ownKeys(obj).filter((key) => typeof key === \"string\");\n const filtered = {};\n for (const key of keys) {\n const value = obj[key];\n if (value !== void 0) {\n filtered[key] = compact(value);\n }\n }\n return filtered;\n}\nvar json = (v) => JSON.parse(JSON.stringify(v));\nfunction pick(obj, keys) {\n const filtered = {};\n for (const key of keys) {\n const value = obj[key];\n if (value !== void 0) {\n filtered[key] = value;\n }\n }\n return filtered;\n}\nfunction splitProps(props, keys) {\n const rest = {};\n const result = {};\n const keySet = new Set(keys);\n const ownKeys = Reflect.ownKeys(props);\n for (const key of ownKeys) {\n if (keySet.has(key)) {\n result[key] = props[key];\n } else {\n rest[key] = props[key];\n }\n }\n return [result, rest];\n}\nvar createSplitProps = (keys) => {\n return function split(props) {\n return splitProps(props, keys);\n };\n};\nfunction omit(obj, keys) {\n return createSplitProps(keys)(obj)[1];\n}\n\n// src/store.ts\nfunction createStore(initialState, compare = Object.is) {\n let state = { ...initialState };\n const listeners = /* @__PURE__ */ new Set();\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const publish = () => {\n listeners.forEach((listener) => listener());\n };\n const get = (key) => {\n return state[key];\n };\n const set = (key, value) => {\n if (!compare(state[key], value)) {\n state[key] = value;\n publish();\n }\n };\n const update = (updates) => {\n let hasChanges = false;\n for (const key in updates) {\n const value = updates[key];\n if (value !== void 0 && !compare(state[key], value)) {\n state[key] = value;\n hasChanges = true;\n }\n }\n if (hasChanges) {\n publish();\n }\n };\n const snapshot = () => ({ ...state });\n return {\n subscribe,\n get,\n set,\n update,\n snapshot\n };\n}\n\n// src/timers.ts\nvar currentTime = () => performance.now();\nvar _tick;\nvar Timer = class {\n constructor(onTick) {\n this.onTick = onTick;\n __publicField(this, \"frameId\", null);\n __publicField(this, \"pausedAtMs\", null);\n __publicField(this, \"context\");\n __publicField(this, \"cancelFrame\", () => {\n if (this.frameId === null) return;\n cancelAnimationFrame(this.frameId);\n this.frameId = null;\n });\n __publicField(this, \"setStartMs\", (startMs) => {\n this.context.startMs = startMs;\n });\n __publicField(this, \"start\", () => {\n if (this.frameId !== null) return;\n const now = currentTime();\n if (this.pausedAtMs !== null) {\n this.context.startMs += now - this.pausedAtMs;\n this.pausedAtMs = null;\n } else {\n this.context.startMs = now;\n }\n this.frameId = requestAnimationFrame(__privateGet(this, _tick));\n });\n __publicField(this, \"pause\", () => {\n if (this.frameId === null) return;\n this.cancelFrame();\n this.pausedAtMs = currentTime();\n });\n __publicField(this, \"stop\", () => {\n if (this.frameId === null) return;\n this.cancelFrame();\n this.pausedAtMs = null;\n });\n __privateAdd(this, _tick, (now) => {\n this.context.now = now;\n this.context.deltaMs = now - this.context.startMs;\n const shouldContinue = this.onTick(this.context);\n if (shouldContinue === false) {\n this.stop();\n return;\n }\n this.frameId = requestAnimationFrame(__privateGet(this, _tick));\n });\n this.context = { now: 0, startMs: currentTime(), deltaMs: 0 };\n }\n get elapsedMs() {\n if (this.pausedAtMs !== null) {\n return this.pausedAtMs - this.context.startMs;\n }\n return currentTime() - this.context.startMs;\n }\n};\n_tick = new WeakMap();\nfunction setRafInterval(fn, intervalMs) {\n const timer = new Timer(({ now, deltaMs }) => {\n if (deltaMs >= intervalMs) {\n const startMs = intervalMs > 0 ? now - deltaMs % intervalMs : now;\n timer.setStartMs(startMs);\n fn({ startMs, deltaMs });\n }\n });\n timer.start();\n return () => timer.stop();\n}\nfunction setRafTimeout(fn, delayMs) {\n const timer = new Timer(({ deltaMs }) => {\n if (deltaMs >= delayMs) {\n fn();\n return false;\n }\n });\n timer.start();\n return () => timer.stop();\n}\n\n// src/warning.ts\nfunction warn(...a) {\n const m = a.length === 1 ? a[0] : a[1];\n const c = a.length === 2 ? a[0] : true;\n if (c && process.env.NODE_ENV !== \"production\") {\n console.warn(m);\n }\n}\nfunction invariant(...a) {\n const m = a.length === 1 ? a[0] : a[1];\n const c = a.length === 2 ? a[0] : true;\n if (c && process.env.NODE_ENV !== \"production\") {\n throw new Error(m);\n }\n}\nfunction ensure(c, m) {\n if (c == null) throw new Error(m());\n}\nfunction ensureProps(props, keys, scope) {\n let missingKeys = [];\n for (const key of keys) {\n if (props[key] == null) missingKeys.push(key);\n }\n if (missingKeys.length > 0)\n throw new Error(`[zag-js${scope ? ` > ${scope}` : \"\"}] missing required props: ${missingKeys.join(\", \")}`);\n}\n\nexport { Timer, add, addOrRemove, callAll, cast, chunk, clampPercent, clampValue, clear, compact, createSplitProps, createStore, debounce, decrementValue, diff, ensure, ensureProps, first, flatArray, fromLength, getClosestValue, getClosestValueIndex, getMaxValueAtIndex, getMinValueAtIndex, getNextStepValue, getPercentValue, getPreviousStepValue, getValuePercent, getValueRanges, getValueSetterAtIndex, getValueTransformer, has, hasProp, hash, identity, incrementValue, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNaN, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, isValueAtMax, isValueAtMin, isValueWithinRange, json, last, match, mod, nan, next, nextIndex, noop, omit, partition, pick, prev, prevIndex, remove, removeAt, roundToDpr, roundToStepPrecision, roundValue, runIfFn, setRafInterval, setRafTimeout, setValueAtIndex, snapValueToStep, splitProps, throttle, toArray, toFixedNumber, toPx, tryCatch, uniq, uuid, warn, wrap };\n"],"names":["fnToString","runIfFn","v","a"],"mappings":";AA+HA,IAAIA,IAAa,SAAS,UAAU;AACbA,EAAW,KAAK,MAAM;AAa1C,IAACC,IAAU,CAACC,MAAMC,OACP,OAAOD,KAAM,aAAaA,EAAE,GAAGC,CAAC,IAAID,MAClC;","x_google_ignoreList":[0]}
|