@harnessio/ui 1.8.1 → 1.9.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.d.ts +3 -1
- package/dist/components.js +1 -1
- package/dist/{index-JUGmlItz.js → index-DZKwmBZA.js} +8496 -8490
- package/dist/{index-JUGmlItz.js.map → index-DZKwmBZA.js.map} +1 -1
- package/dist/{index-bXRC0y9I.js → index-XWKhjL6D.js} +48 -47
- package/dist/{index-bXRC0y9I.js.map → index-XWKhjL6D.js.map} +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +2 -2
- package/dist/{textarea-utils-Da1SLvaV.js → textarea-utils-CWb0r4jC.js} +153 -146
- package/dist/textarea-utils-CWb0r4jC.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +31 -30
- package/package.json +2 -2
- package/dist/textarea-utils-Da1SLvaV.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { I as T, Z as w, h as b, e as C, c as _, i as g, d as k, j as A, k as P, l as q, f as
|
|
2
|
-
import { c as v, x, L as F, T as R, k as S, r as j,
|
|
3
|
-
import { u as
|
|
4
|
-
import { s as
|
|
5
|
-
function
|
|
1
|
+
import { I as T, Z as w, h as b, e as C, c as _, i as g, d as k, j as A, k as P, l as q, f as y, g as L, a as D, b as M, m as N, s as O } from "./utils-DypH50vc.js";
|
|
2
|
+
import { c as v, y as x, L as F, T as R, k as S, r as j, z as Z, u as z, A as B, B as H, C as G, s as $, D as U, E as V, w as W, F as X, l as K, v as J, G as Q, n as Y, j as ee, o as ae, i as te, x as se, H as re, I as ne } from "./textarea-utils-CWb0r4jC.js";
|
|
3
|
+
import { u as oe, w as ie, a as le } from "./mergeUtils-3xidlUtV.js";
|
|
4
|
+
import { s as ce } from "./index-DchZrYRY.js";
|
|
5
|
+
function me(e) {
|
|
6
6
|
return v(e, Date.now());
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return x(e,
|
|
8
|
+
function ue(e, a) {
|
|
9
|
+
return x(e, me(e), a);
|
|
10
10
|
}
|
|
11
11
|
const d = /^[a-zA-Z_][0-9a-zA-Z_]*$/, p = /^[a-zA-Z_][0-9a-zA-Z_-]*$/, m = [
|
|
12
12
|
"or",
|
|
@@ -34,7 +34,7 @@ const d = /^[a-zA-Z_][0-9a-zA-Z_]*$/, p = /^[a-zA-Z_][0-9a-zA-Z_-]*$/, m = [
|
|
|
34
34
|
"account",
|
|
35
35
|
"class",
|
|
36
36
|
"shellScriptProvisioner"
|
|
37
|
-
],
|
|
37
|
+
], de = (e) => ce().min(1, e != null && e.requiredErrorMsg ? e == null ? void 0 : e.requiredErrorMsg : "Identifier is required").regex(
|
|
38
38
|
e != null && e.allowHyphen ? p : d,
|
|
39
39
|
e != null && e.regexErrorMsg ? e == null ? void 0 : e.regexErrorMsg : "Identifier can only contain alphanumerics, _ and $"
|
|
40
40
|
).refine((a) => !m.includes(a), {
|
|
@@ -47,7 +47,7 @@ function I(e = "requestAnimationFrame", a) {
|
|
|
47
47
|
if (!c && t.length) {
|
|
48
48
|
c = !0;
|
|
49
49
|
const r = t.splice(0, a), s = r.map((n) => {
|
|
50
|
-
let i =
|
|
50
|
+
let i = pe;
|
|
51
51
|
return new Promise((l) => i = l), { resolve: i };
|
|
52
52
|
});
|
|
53
53
|
r.forEach((n, i) => h(() => {
|
|
@@ -63,7 +63,7 @@ function I(e = "requestAnimationFrame", a) {
|
|
|
63
63
|
s > -1 && t.splice(s, 1);
|
|
64
64
|
} };
|
|
65
65
|
}
|
|
66
|
-
const f = 10,
|
|
66
|
+
const f = 10, pe = () => 0, Ie = (e = f) => I("requestAnimationFrame", e), fe = (e = f) => I("requestIdleCallback", e);
|
|
67
67
|
window.requestIdleCallback = window.requestIdleCallback || function(e) {
|
|
68
68
|
const a = Date.now();
|
|
69
69
|
return setTimeout(function() {
|
|
@@ -78,10 +78,10 @@ window.requestIdleCallback = window.requestIdleCallback || function(e) {
|
|
|
78
78
|
window.cancelIdleCallback = window.cancelIdleCallback || function(e) {
|
|
79
79
|
clearTimeout(e);
|
|
80
80
|
};
|
|
81
|
-
function
|
|
81
|
+
function he(e, a) {
|
|
82
82
|
return e ? a.isLoading || !!a.isFetching : !1;
|
|
83
83
|
}
|
|
84
|
-
const
|
|
84
|
+
const _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
85
85
|
__proto__: null,
|
|
86
86
|
INITIAL_ZOOM_LEVEL: T,
|
|
87
87
|
LOCALE: F,
|
|
@@ -92,57 +92,58 @@ const Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
92
92
|
clamp: C,
|
|
93
93
|
cn: _,
|
|
94
94
|
createPaginationLinks: g,
|
|
95
|
-
createRequestAnimationFrameTaskPool:
|
|
96
|
-
createRequestIdleCallbackTaskPool:
|
|
95
|
+
createRequestAnimationFrameTaskPool: Ie,
|
|
96
|
+
createRequestIdleCallbackTaskPool: fe,
|
|
97
97
|
csvToObject: j,
|
|
98
98
|
decodeURIComponentIfValid: k,
|
|
99
99
|
decodeURIPath: A,
|
|
100
100
|
easyPluralize: Z,
|
|
101
101
|
encodePath: P,
|
|
102
102
|
encodeResourcePath: q,
|
|
103
|
-
filterChildrenByDisplayNames:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
filterChildrenByDisplayNames: y,
|
|
104
|
+
formatBytes: z,
|
|
105
|
+
formatDate: B,
|
|
106
|
+
formatDistanceToNow: ue,
|
|
107
|
+
formatDuration: H,
|
|
108
|
+
formatNumber: G,
|
|
109
|
+
formatRelativeTime: $,
|
|
110
|
+
formatTime: U,
|
|
111
|
+
formatTimestamp: V,
|
|
112
|
+
generateAlphaNumericHash: L,
|
|
113
|
+
getCaretCoordinates: W,
|
|
114
|
+
getCaretPosition: X,
|
|
115
|
+
getComponentDisplayName: K,
|
|
115
116
|
getCssNumber: D,
|
|
116
|
-
getCurrentWord:
|
|
117
|
+
getCurrentWord: J,
|
|
117
118
|
getErrorMessage: M,
|
|
118
|
-
getFormattedDuration:
|
|
119
|
-
getInitials:
|
|
120
|
-
getShadowActiveElement:
|
|
121
|
-
getTrimmedSha:
|
|
119
|
+
getFormattedDuration: Q,
|
|
120
|
+
getInitials: Y,
|
|
121
|
+
getShadowActiveElement: ee,
|
|
122
|
+
getTrimmedSha: ae,
|
|
122
123
|
hyphenRegexIdentifier: p,
|
|
123
|
-
identifierSchema:
|
|
124
|
+
identifierSchema: de,
|
|
124
125
|
illegalIdentifiers: m,
|
|
125
|
-
isAnyTypeOf:
|
|
126
|
+
isAnyTypeOf: te,
|
|
126
127
|
isPromise: N,
|
|
127
|
-
queryLoadingWhileEnabled:
|
|
128
|
+
queryLoadingWhileEnabled: he,
|
|
128
129
|
regexIdentifier: d,
|
|
129
|
-
replaceWord:
|
|
130
|
+
replaceWord: se,
|
|
130
131
|
settingsBackLink: O,
|
|
131
|
-
splitObjectProps:
|
|
132
|
-
timeDistance:
|
|
133
|
-
useMergeRefs:
|
|
134
|
-
wrapConditionalArrayElements:
|
|
135
|
-
wrapConditionalObjectElement:
|
|
132
|
+
splitObjectProps: re,
|
|
133
|
+
timeDistance: ne,
|
|
134
|
+
useMergeRefs: oe,
|
|
135
|
+
wrapConditionalArrayElements: ie,
|
|
136
|
+
wrapConditionalObjectElement: le
|
|
136
137
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
137
138
|
export {
|
|
138
139
|
m as a,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
de as b,
|
|
141
|
+
Ie as c,
|
|
142
|
+
fe as d,
|
|
143
|
+
ue as f,
|
|
143
144
|
p as h,
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
_e as i,
|
|
146
|
+
he as q,
|
|
146
147
|
d as r
|
|
147
148
|
};
|
|
148
|
-
//# sourceMappingURL=index-
|
|
149
|
+
//# sourceMappingURL=index-XWKhjL6D.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-bXRC0y9I.js","sources":["../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/constructNow.mjs","../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/formatDistanceToNow.mjs","../src/utils/schema.ts","../src/utils/task.ts","../src/utils/query-loading.ts"],"sourcesContent":["import { constructFrom } from \"./constructFrom.mjs\";\n\n/**\n * @name constructNow\n * @category Generic Helpers\n * @summary Constructs a new current date using the passed value constructor.\n * @pure false\n *\n * @description\n * The function constructs a new current date using the constructor from\n * the reference date. It helps to build generic functions that accept date\n * extensions and use the current date.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n *\n * @returns Current date initialized using the given date constructor\n *\n * @example\n * import { constructNow, isSameDay } from 'date-fns'\n *\n * function isToday<DateType extends Date>(\n * date: DateType | number | string,\n * ): boolean {\n * // If we were to use `new Date()` directly, the function would behave\n * // differently in different timezones and return false for the same date.\n * return isSameDay(date, constructNow(date));\n * }\n */\nexport function constructNow(date) {\n return constructFrom(date, Date.now());\n}\n\n// Fallback for modularized imports:\nexport default constructNow;\n","import { constructNow } from \"./constructNow.mjs\";\nimport { formatDistance } from \"./formatDistance.mjs\";\n\n/**\n * The {@link formatDistanceToNow} function options.\n */\n\n/**\n * @name formatDistanceToNow\n * @category Common Helpers\n * @summary Return the distance between the given date and now in words.\n * @pure false\n *\n * @description\n * Return the distance between the given date and now in words.\n *\n * | Distance to now | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance to now | Result |\n * |---------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The given date\n * @param options - The object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // If today is 1 January 2015, what is the distance to 2 July 2014?\n * const result = formatDistanceToNow(\n * new Date(2014, 6, 2)\n * )\n * //=> '6 months'\n *\n * @example\n * // If now is 1 January 2015 00:00:00,\n * // what is the distance to 1 January 2015 00:00:15, including seconds?\n * const result = formatDistanceToNow(\n * new Date(2015, 0, 1, 0, 0, 15),\n * {includeSeconds: true}\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 January 2016, with a suffix?\n * const result = formatDistanceToNow(\n * new Date(2016, 0, 1),\n * {addSuffix: true}\n * )\n * //=> 'in about 1 year'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 August 2016 in Esperanto?\n * const eoLocale = require('date-fns/locale/eo')\n * const result = formatDistanceToNow(\n * new Date(2016, 7, 1),\n * {locale: eoLocale}\n * )\n * //=> 'pli ol 1 jaro'\n */\nexport function formatDistanceToNow(date, options) {\n return formatDistance(date, constructNow(date), options);\n}\n\n// Fallback for modularized imports:\nexport default formatDistanceToNow;\n","import { z } from 'zod/v3'\n\n// Assuming these are defined elsewhere by the user\nexport const regexIdentifier = /^[a-zA-Z_][0-9a-zA-Z_]*$/\n\nexport const hyphenRegexIdentifier = /^[a-zA-Z_][0-9a-zA-Z_-]*$/\n\nexport const illegalIdentifiers = [\n 'or',\n 'and',\n 'eq',\n 'ne',\n 'lt',\n 'gt',\n 'le',\n 'ge',\n 'div',\n 'mod',\n 'not',\n 'null',\n 'true',\n 'false',\n 'new',\n 'var',\n 'return',\n 'step',\n 'parallel',\n 'stepGroup',\n 'insert',\n 'org',\n 'account',\n 'class',\n 'shellScriptProvisioner'\n]\n\nexport const identifierSchema = (config?: {\n allowHyphen?: boolean\n regexErrorMsg?: string\n requiredErrorMsg?: string\n}) =>\n z\n .string()\n .min(1, config?.requiredErrorMsg ? config?.requiredErrorMsg : 'Identifier is required')\n .regex(\n config?.allowHyphen ? hyphenRegexIdentifier : regexIdentifier,\n config?.regexErrorMsg ? config?.regexErrorMsg : 'Identifier can only contain alphanumerics, _ and $'\n )\n .refine(val => !illegalIdentifiers.includes(val), {\n message: `Identifier must not be one of the following values: ${illegalIdentifiers.join(', ')}`\n })\n","type Task = () => void\ntype RunnerType = 'requestAnimationFrame' | 'requestIdleCallback' | 'setTimeout'\n\nfunction createTaskPool(type: RunnerType = 'requestAnimationFrame', blockSize: number) {\n const tasks: Array<[Task, number]> = []\n const runner = type === 'requestAnimationFrame' ? requestAnimationFrame : window.requestIdleCallback\n\n let id = 1\n let running = false\n\n const scheduleTask = (task: Task, priority = tasks.length) => {\n id = id + 1 < Number.MAX_SAFE_INTEGER ? id + 1 : 1\n tasks.splice(priority, 0, [task, id])\n run()\n return id\n }\n\n const run = () => {\n if (!running && tasks.length) {\n running = true\n\n const block = tasks.splice(0, blockSize)\n\n const blockTracking = block.map(_ => {\n let resolve: (value: unknown) => void = noop\n new Promise(_resolve => (resolve = _resolve))\n return { resolve }\n })\n\n block.forEach((task, idx) => runner(() => blockTracking[idx].resolve(task[0]?.())))\n\n Promise.all(blockTracking).then(() => {\n running = false\n if (tasks.length) run()\n })\n }\n }\n\n const cancelTask = (taskId: number) => {\n const index = tasks.findIndex(([, _id]) => _id === taskId)\n if (index > -1) tasks.splice(index, 1)\n }\n\n return { scheduleTask, cancelTask }\n}\n\nconst EXECUTION_BLOCK_SIZE = 10\nconst noop = () => 0\n\nexport const createRequestAnimationFrameTaskPool = (blockSize = EXECUTION_BLOCK_SIZE) =>\n createTaskPool('requestAnimationFrame', blockSize)\nexport const createRequestIdleCallbackTaskPool = (blockSize = EXECUTION_BLOCK_SIZE) =>\n createTaskPool('requestIdleCallback', blockSize)\n\n// Polly fill requestIdleCallback/cancelIdleCallback for Safari\nwindow.requestIdleCallback =\n window.requestIdleCallback ||\n function (cb) {\n const start = Date.now()\n return setTimeout(function () {\n cb({\n didTimeout: false,\n timeRemaining: function () {\n return Math.max(0, 50 - (Date.now() - start))\n }\n })\n }, 1)\n }\n\nwindow.cancelIdleCallback =\n window.cancelIdleCallback ||\n function (id) {\n clearTimeout(id)\n }\n","/**\n * React Query v4 reports `isLoading: true` on disabled queries that have not\n * fetched yet. Scope-gated hooks (project/org/account) must ignore loading\n * from queries whose `enabled` flag is false, or aggregate loading stays true\n * forever and pre-select cards show \"Loading…\" indefinitely.\n *\n * @remarks React Query v5: v4's \"no data yet\" signal is `isPending` (`isLoading`\n * is now `isPending && isFetching`). When upgrading, revisit whether callers\n * should pass `isPending` and whether this helper's enabled guard still fits.\n */\nexport function queryLoadingWhileEnabled(\n enabled: boolean,\n query: { isLoading: boolean; isFetching?: boolean }\n): boolean {\n if (!enabled) return false\n return query.isLoading || Boolean(query.isFetching)\n}\n"],"names":["constructNow","date","constructFrom","formatDistanceToNow","options","formatDistance","regexIdentifier","hyphenRegexIdentifier","illegalIdentifiers","identifierSchema","config","z.string","val","createTaskPool","type","blockSize","tasks","runner","id","running","scheduleTask","task","priority","run","block","blockTracking","_","resolve","noop","_resolve","idx","_a","taskId","index","_id","EXECUTION_BLOCK_SIZE","createRequestAnimationFrameTaskPool","createRequestIdleCallbackTaskPool","cb","start","queryLoadingWhileEnabled","enabled","query"],"mappings":";;;;AAgCO,SAASA,GAAaC,GAAM;AACjC,SAAOC,EAAcD,GAAM,KAAK,IAAG,CAAE;AACvC;ACwDO,SAASE,GAAoBF,GAAMG,GAAS;AACjD,SAAOC,EAAeJ,GAAMD,GAAaC,CAAI,GAAGG,CAAO;AACzD;ACzFO,MAAME,IAAkB,4BAElBC,IAAwB,6BAExBC,IAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEaC,KAAmB,CAACC,MAK/BC,GACU,EACP,IAAI,GAAGD,KAAA,QAAAA,EAAQ,mBAAmBA,KAAA,gBAAAA,EAAQ,mBAAmB,wBAAwB,EACrF;AAAA,EACCA,KAAA,QAAAA,EAAQ,cAAcH,IAAwBD;AAAA,EAC9CI,KAAA,QAAAA,EAAQ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AAA,OAAOiB,GAAO,CAAC;AAAA,EACvC,EAEkC;AACpC;AAEA,MAAME,IAAuB,IACvBP,KAAO,MAAM,GAENQ,KAAsC,CAACrB,IAAYoB,MAC9DtB,EAAe,yBAAyBE,CAAS,GACtCsB,KAAoC,CAACtB,IAAYoB,MAC5DtB,EAAe,uBAAuBE,CAAS;AAGjD,OAAO,sBACL,OAAO,uBACP,SAAUuB,GAAI;AACN,QAAAC,IAAQ,KAAK,IAAI;AACvB,SAAO,WAAW,WAAY;AACzB,IAAAD,EAAA;AAAA,MACD,YAAY;AAAA,MACZ,eAAe,WAAY;AACzB,eAAO,KAAK,IAAI,GAAG,MAAM,KAAK,IAAA,IAAQC,EAAM;AAAA,MAAA;AAAA,IAC9C,CACD;AAAA,KACA,CAAC;AACN;AAEF,OAAO,qBACL,OAAO,sBACP,SAAUrB,GAAI;AACZ,eAAaA,CAAE;AACjB;AC/Dc,SAAAsB,GACdC,GACAC,GACS;AACL,SAACD,IACEC,EAAM,aAAa,EAAQA,EAAM,aADnB;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"index-XWKhjL6D.js","sources":["../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/constructNow.mjs","../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/formatDistanceToNow.mjs","../src/utils/schema.ts","../src/utils/task.ts","../src/utils/query-loading.ts"],"sourcesContent":["import { constructFrom } from \"./constructFrom.mjs\";\n\n/**\n * @name constructNow\n * @category Generic Helpers\n * @summary Constructs a new current date using the passed value constructor.\n * @pure false\n *\n * @description\n * The function constructs a new current date using the constructor from\n * the reference date. It helps to build generic functions that accept date\n * extensions and use the current date.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n *\n * @returns Current date initialized using the given date constructor\n *\n * @example\n * import { constructNow, isSameDay } from 'date-fns'\n *\n * function isToday<DateType extends Date>(\n * date: DateType | number | string,\n * ): boolean {\n * // If we were to use `new Date()` directly, the function would behave\n * // differently in different timezones and return false for the same date.\n * return isSameDay(date, constructNow(date));\n * }\n */\nexport function constructNow(date) {\n return constructFrom(date, Date.now());\n}\n\n// Fallback for modularized imports:\nexport default constructNow;\n","import { constructNow } from \"./constructNow.mjs\";\nimport { formatDistance } from \"./formatDistance.mjs\";\n\n/**\n * The {@link formatDistanceToNow} function options.\n */\n\n/**\n * @name formatDistanceToNow\n * @category Common Helpers\n * @summary Return the distance between the given date and now in words.\n * @pure false\n *\n * @description\n * Return the distance between the given date and now in words.\n *\n * | Distance to now | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance to now | Result |\n * |---------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The given date\n * @param options - The object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // If today is 1 January 2015, what is the distance to 2 July 2014?\n * const result = formatDistanceToNow(\n * new Date(2014, 6, 2)\n * )\n * //=> '6 months'\n *\n * @example\n * // If now is 1 January 2015 00:00:00,\n * // what is the distance to 1 January 2015 00:00:15, including seconds?\n * const result = formatDistanceToNow(\n * new Date(2015, 0, 1, 0, 0, 15),\n * {includeSeconds: true}\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 January 2016, with a suffix?\n * const result = formatDistanceToNow(\n * new Date(2016, 0, 1),\n * {addSuffix: true}\n * )\n * //=> 'in about 1 year'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 August 2016 in Esperanto?\n * const eoLocale = require('date-fns/locale/eo')\n * const result = formatDistanceToNow(\n * new Date(2016, 7, 1),\n * {locale: eoLocale}\n * )\n * //=> 'pli ol 1 jaro'\n */\nexport function formatDistanceToNow(date, options) {\n return formatDistance(date, constructNow(date), options);\n}\n\n// Fallback for modularized imports:\nexport default formatDistanceToNow;\n","import { z } from 'zod/v3'\n\n// Assuming these are defined elsewhere by the user\nexport const regexIdentifier = /^[a-zA-Z_][0-9a-zA-Z_]*$/\n\nexport const hyphenRegexIdentifier = /^[a-zA-Z_][0-9a-zA-Z_-]*$/\n\nexport const illegalIdentifiers = [\n 'or',\n 'and',\n 'eq',\n 'ne',\n 'lt',\n 'gt',\n 'le',\n 'ge',\n 'div',\n 'mod',\n 'not',\n 'null',\n 'true',\n 'false',\n 'new',\n 'var',\n 'return',\n 'step',\n 'parallel',\n 'stepGroup',\n 'insert',\n 'org',\n 'account',\n 'class',\n 'shellScriptProvisioner'\n]\n\nexport const identifierSchema = (config?: {\n allowHyphen?: boolean\n regexErrorMsg?: string\n requiredErrorMsg?: string\n}) =>\n z\n .string()\n .min(1, config?.requiredErrorMsg ? config?.requiredErrorMsg : 'Identifier is required')\n .regex(\n config?.allowHyphen ? hyphenRegexIdentifier : regexIdentifier,\n config?.regexErrorMsg ? config?.regexErrorMsg : 'Identifier can only contain alphanumerics, _ and $'\n )\n .refine(val => !illegalIdentifiers.includes(val), {\n message: `Identifier must not be one of the following values: ${illegalIdentifiers.join(', ')}`\n })\n","type Task = () => void\ntype RunnerType = 'requestAnimationFrame' | 'requestIdleCallback' | 'setTimeout'\n\nfunction createTaskPool(type: RunnerType = 'requestAnimationFrame', blockSize: number) {\n const tasks: Array<[Task, number]> = []\n const runner = type === 'requestAnimationFrame' ? requestAnimationFrame : window.requestIdleCallback\n\n let id = 1\n let running = false\n\n const scheduleTask = (task: Task, priority = tasks.length) => {\n id = id + 1 < Number.MAX_SAFE_INTEGER ? id + 1 : 1\n tasks.splice(priority, 0, [task, id])\n run()\n return id\n }\n\n const run = () => {\n if (!running && tasks.length) {\n running = true\n\n const block = tasks.splice(0, blockSize)\n\n const blockTracking = block.map(_ => {\n let resolve: (value: unknown) => void = noop\n new Promise(_resolve => (resolve = _resolve))\n return { resolve }\n })\n\n block.forEach((task, idx) => runner(() => blockTracking[idx].resolve(task[0]?.())))\n\n Promise.all(blockTracking).then(() => {\n running = false\n if (tasks.length) run()\n })\n }\n }\n\n const cancelTask = (taskId: number) => {\n const index = tasks.findIndex(([, _id]) => _id === taskId)\n if (index > -1) tasks.splice(index, 1)\n }\n\n return { scheduleTask, cancelTask }\n}\n\nconst EXECUTION_BLOCK_SIZE = 10\nconst noop = () => 0\n\nexport const createRequestAnimationFrameTaskPool = (blockSize = EXECUTION_BLOCK_SIZE) =>\n createTaskPool('requestAnimationFrame', blockSize)\nexport const createRequestIdleCallbackTaskPool = (blockSize = EXECUTION_BLOCK_SIZE) =>\n createTaskPool('requestIdleCallback', blockSize)\n\n// Polly fill requestIdleCallback/cancelIdleCallback for Safari\nwindow.requestIdleCallback =\n window.requestIdleCallback ||\n function (cb) {\n const start = Date.now()\n return setTimeout(function () {\n cb({\n didTimeout: false,\n timeRemaining: function () {\n return Math.max(0, 50 - (Date.now() - start))\n }\n })\n }, 1)\n }\n\nwindow.cancelIdleCallback =\n window.cancelIdleCallback ||\n function (id) {\n clearTimeout(id)\n }\n","/**\n * React Query v4 reports `isLoading: true` on disabled queries that have not\n * fetched yet. Scope-gated hooks (project/org/account) must ignore loading\n * from queries whose `enabled` flag is false, or aggregate loading stays true\n * forever and pre-select cards show \"Loading…\" indefinitely.\n *\n * @remarks React Query v5: v4's \"no data yet\" signal is `isPending` (`isLoading`\n * is now `isPending && isFetching`). When upgrading, revisit whether callers\n * should pass `isPending` and whether this helper's enabled guard still fits.\n */\nexport function queryLoadingWhileEnabled(\n enabled: boolean,\n query: { isLoading: boolean; isFetching?: boolean }\n): boolean {\n if (!enabled) return false\n return query.isLoading || Boolean(query.isFetching)\n}\n"],"names":["constructNow","date","constructFrom","formatDistanceToNow","options","formatDistance","regexIdentifier","hyphenRegexIdentifier","illegalIdentifiers","identifierSchema","config","z.string","val","createTaskPool","type","blockSize","tasks","runner","id","running","scheduleTask","task","priority","run","block","blockTracking","_","resolve","noop","_resolve","idx","_a","taskId","index","_id","EXECUTION_BLOCK_SIZE","createRequestAnimationFrameTaskPool","createRequestIdleCallbackTaskPool","cb","start","queryLoadingWhileEnabled","enabled","query"],"mappings":";;;;AAgCO,SAASA,GAAaC,GAAM;AACjC,SAAOC,EAAcD,GAAM,KAAK,IAAG,CAAE;AACvC;ACwDO,SAAS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M,aAAa,EAAQA,EAAM,aADnB;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1]}
|
package/dist/index.d.ts
CHANGED
|
@@ -3224,13 +3224,15 @@ declare interface FileToolbarActionsProps {
|
|
|
3224
3224
|
size?: ButtonProps['size'];
|
|
3225
3225
|
}
|
|
3226
3226
|
|
|
3227
|
-
declare function FileUpload({ selectedFile, onFileChange, error, accept }: FileUploadProps): JSX_2.Element;
|
|
3227
|
+
declare function FileUpload({ selectedFile, onFileChange, error, accept, maxSizeBytes }: FileUploadProps): JSX_2.Element;
|
|
3228
3228
|
|
|
3229
3229
|
declare interface FileUploadProps {
|
|
3230
3230
|
selectedFile?: File;
|
|
3231
3231
|
onFileChange: (file?: File) => void;
|
|
3232
3232
|
error?: string;
|
|
3233
3233
|
accept?: string;
|
|
3234
|
+
/** Max size hint in bytes. Defaults to 50 MiB ("Up to 50 MB"). */
|
|
3235
|
+
maxSizeBytes?: number;
|
|
3234
3236
|
}
|
|
3235
3237
|
|
|
3236
3238
|
declare const FileViewerControlBar: FC<FileViewerControlBarProps>;
|
|
@@ -3462,6 +3464,9 @@ declare interface ForkTagProps {
|
|
|
3462
3464
|
hideCopyButton?: boolean;
|
|
3463
3465
|
}
|
|
3464
3466
|
|
|
3467
|
+
/** Binary (1024) units, e.g. 50 * 1024² → "50 MB". */
|
|
3468
|
+
declare function formatBytes(bytes: number): string;
|
|
3469
|
+
|
|
3465
3470
|
/**
|
|
3466
3471
|
* Format a timestamp to a localized date string
|
|
3467
3472
|
* @param timestamp - Unix timestamp in milliseconds or ISO date string
|
|
@@ -9572,6 +9577,7 @@ declare namespace utils {
|
|
|
9572
9577
|
getInitials,
|
|
9573
9578
|
csvToObject,
|
|
9574
9579
|
easyPluralize,
|
|
9580
|
+
formatBytes,
|
|
9575
9581
|
cn,
|
|
9576
9582
|
isAnyTypeOf,
|
|
9577
9583
|
splitObjectProps,
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as s } from "./index-DlSn4SRO.js";
|
|
2
|
-
import { i as e } from "./index-
|
|
2
|
+
import { i as e } from "./index-DZKwmBZA.js";
|
|
3
3
|
import { i as a } from "./index-DvoBYR4x.js";
|
|
4
4
|
import { i as m } from "./index-C4bDY5-3.js";
|
|
5
5
|
import { i as f } from "./index-DchZrYRY.js";
|
|
6
|
-
import { i as l } from "./index-
|
|
6
|
+
import { i as l } from "./index-XWKhjL6D.js";
|
|
7
7
|
export {
|
|
8
8
|
e as components,
|
|
9
9
|
a as context,
|