@teach-in/react 1.0.0 → 1.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/LICENSE +21 -21
- package/README.md +9 -9
- package/dist/{chunk-AMNORHD6.mjs → chunk-2ASQXBDD.mjs} +1 -1
- package/dist/{chunk-3VAZY2QK.mjs → chunk-2CEZXLZR.mjs} +1 -1
- package/dist/chunk-2UHA3DYG.mjs +62 -0
- package/dist/{chunk-LJIVY6GU.mjs → chunk-46SKVFMZ.mjs} +1 -1
- package/dist/{chunk-JDFRAN4S.mjs → chunk-5FFWQB7D.mjs} +12 -2
- package/dist/chunk-C2VWADF5.mjs +34 -0
- package/dist/{chunk-NLHQDWUK.mjs → chunk-CKJ5U5Q4.mjs} +1 -1
- package/dist/chunk-CUEG2BFV.mjs +34 -0
- package/dist/{chunk-CETCW7DS.mjs → chunk-IU2JYI7W.mjs} +1 -1
- package/dist/{chunk-KTUGFQWJ.mjs → chunk-KTWHCUYV.mjs} +1 -1
- package/dist/chunk-M5G6RR4Q.mjs +39 -0
- package/dist/chunk-MCQGBAUS.mjs +73 -0
- package/dist/chunk-NSU66J5E.mjs +59 -0
- package/dist/{chunk-CFG5V7VB.mjs → chunk-QCLLPJMB.mjs} +2 -2
- package/dist/{chunk-R7LDL5CU.mjs → chunk-R46SWVWL.mjs} +1 -1
- package/dist/chunk-SEJXJZSK.mjs +64 -0
- package/dist/chunk-TUIN5YJW.mjs +33 -0
- package/dist/chunk-UQAG7TKJ.mjs +1 -0
- package/dist/chunk-VXYV37IM.mjs +74 -0
- package/dist/index.js +609 -228
- package/dist/index.mjs +106 -86
- package/dist/ui/data/index.mjs +10 -10
- package/dist/ui/feedback/index.mjs +8 -8
- package/dist/ui/form/index.js +447 -106
- package/dist/ui/form/index.mjs +25 -15
- package/dist/ui/form/rhf/fields/autocomplete-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/checkbox-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/date-picker-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/email-field.js +147 -10
- package/dist/ui/form/rhf/fields/email-field.mjs +17 -11
- package/dist/ui/form/rhf/fields/index.d.ts +1 -0
- package/dist/ui/form/rhf/fields/index.js +443 -102
- package/dist/ui/form/rhf/fields/index.mjs +25 -15
- package/dist/ui/form/rhf/fields/input-field.js +153 -6
- package/dist/ui/form/rhf/fields/input-field.mjs +17 -11
- package/dist/ui/form/rhf/fields/radio-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/search-field.d.ts +10 -0
- package/dist/ui/form/rhf/fields/search-field.js +296 -0
- package/dist/ui/form/rhf/fields/search-field.mjs +37 -0
- package/dist/ui/form/rhf/fields/select-field.js +136 -26
- package/dist/ui/form/rhf/fields/select-field.mjs +17 -11
- package/dist/ui/form/rhf/fields/switch-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/text-field.js +147 -10
- package/dist/ui/form/rhf/fields/text-field.mjs +17 -11
- package/dist/ui/form/rhf/fields/textarea-field.mjs +16 -10
- package/dist/ui/form/rhf/index.js +443 -102
- package/dist/ui/form/rhf/index.mjs +25 -15
- package/dist/ui/format/index.d.ts +1 -0
- package/dist/ui/format/index.js +41 -5
- package/dist/ui/format/index.mjs +15 -11
- package/dist/ui/format/uuid.d.ts +12 -0
- package/dist/ui/format/uuid.js +62 -0
- package/dist/ui/format/uuid.mjs +7 -0
- package/dist/ui/index.js +609 -228
- package/dist/ui/index.mjs +106 -86
- package/dist/ui/inputs/clear-button.d.ts +5 -0
- package/dist/ui/inputs/clear-button.js +67 -0
- package/dist/ui/inputs/clear-button.mjs +8 -0
- package/dist/ui/inputs/email/email.js +144 -7
- package/dist/ui/inputs/email/email.mjs +4 -2
- package/dist/ui/inputs/email/index.js +144 -7
- package/dist/ui/inputs/email/index.mjs +4 -2
- package/dist/ui/inputs/index.d.ts +2 -0
- package/dist/ui/inputs/index.js +363 -56
- package/dist/ui/inputs/index.mjs +27 -15
- package/dist/ui/inputs/input/index.js +140 -3
- package/dist/ui/inputs/input/index.mjs +3 -1
- package/dist/ui/inputs/input/input.d.ts +1 -0
- package/dist/ui/inputs/input/input.js +140 -3
- package/dist/ui/inputs/input/input.mjs +3 -1
- package/dist/ui/inputs/input/use-input.d.ts +19 -0
- package/dist/ui/inputs/input/use-input.js +82 -0
- package/dist/ui/inputs/input/use-input.mjs +7 -0
- package/dist/ui/inputs/radio/index.mjs +3 -3
- package/dist/ui/inputs/search/index.d.ts +1 -0
- package/dist/ui/inputs/search/index.js +270 -0
- package/dist/ui/inputs/search/index.mjs +13 -0
- package/dist/ui/inputs/search/search.d.ts +7 -0
- package/dist/ui/inputs/search/search.js +268 -0
- package/dist/ui/inputs/search/search.mjs +12 -0
- package/dist/ui/inputs/search/use-search.d.ts +12 -0
- package/dist/ui/inputs/search/use-search.js +57 -0
- package/dist/ui/inputs/search/use-search.mjs +7 -0
- package/dist/ui/inputs/select/index.js +132 -22
- package/dist/ui/inputs/select/index.mjs +3 -1
- package/dist/ui/inputs/select/select.d.ts +4 -0
- package/dist/ui/inputs/select/select.js +132 -22
- package/dist/ui/inputs/select/select.mjs +3 -1
- package/dist/ui/inputs/select/use-select.d.ts +17 -0
- package/dist/ui/inputs/select/use-select.js +85 -0
- package/dist/ui/inputs/select/use-select.mjs +7 -0
- package/dist/ui/inputs/text/index.js +144 -7
- package/dist/ui/inputs/text/index.mjs +4 -2
- package/dist/ui/inputs/text/text.js +144 -7
- package/dist/ui/inputs/text/text.mjs +4 -2
- package/dist/ui/layout/container/container.mjs +56 -48
- package/dist/ui/layout/container/index.mjs +56 -48
- package/dist/ui/layout/index.mjs +62 -54
- package/dist/ui/layout/page/index.mjs +4 -4
- package/dist/ui/layout/page/page-loading.mjs +4 -4
- package/dist/ui/layout/page/section-loading.mjs +4 -4
- package/dist/ui/navigation/index.mjs +8 -8
- package/dist/ui/overlays/index.mjs +5 -5
- package/dist/ui/provider/index.mjs +4 -4
- package/dist/ui/provider/ui-provider.mjs +4 -4
- package/dist/ui/theme/colors/common.mjs +5 -5
- package/dist/ui/theme/colors/index.mjs +8 -8
- package/dist/ui/theme/colors/semantic.mjs +6 -6
- package/dist/ui/theme/colors.mjs +8 -8
- package/dist/ui/theme/index.mjs +8 -8
- package/dist/ui/theme/theme.mjs +8 -8
- package/package.json +1 -1
- package/dist/chunk-3YOW5DEZ.mjs +0 -45
- package/dist/chunk-V2G5QHZZ.mjs +0 -14
- package/dist/{chunk-5IHVMMCK.mjs → chunk-5N3SIZHF.mjs} +0 -0
- package/dist/{chunk-CZEO3U25.mjs → chunk-5RNCFTW5.mjs} +0 -0
- package/dist/{chunk-STVN4B47.mjs → chunk-IXPMUODA.mjs} +12 -12
- /package/dist/{chunk-Q6JSJOU4.mjs → chunk-PTCNYQVY.mjs} +0 -0
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-FXXWSYJA.mjs";
|
|
3
|
-
import "../../../chunk-
|
|
3
|
+
import "../../../chunk-PTCNYQVY.mjs";
|
|
4
4
|
import {
|
|
5
5
|
InputField
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-5FFWQB7D.mjs";
|
|
7
7
|
import {
|
|
8
8
|
RadioField
|
|
9
9
|
} from "../../../chunk-W2A6C27Y.mjs";
|
|
10
|
+
import {
|
|
11
|
+
SearchField
|
|
12
|
+
} from "../../../chunk-CUEG2BFV.mjs";
|
|
10
13
|
import {
|
|
11
14
|
SelectField
|
|
12
|
-
} from "../../../chunk-
|
|
15
|
+
} from "../../../chunk-CKJ5U5Q4.mjs";
|
|
13
16
|
import {
|
|
14
17
|
SwitchField
|
|
15
18
|
} from "../../../chunk-EC3NSPHR.mjs";
|
|
16
19
|
import {
|
|
17
20
|
TextField
|
|
18
|
-
} from "../../../chunk-
|
|
21
|
+
} from "../../../chunk-IU2JYI7W.mjs";
|
|
19
22
|
import {
|
|
20
23
|
TextareaField
|
|
21
24
|
} from "../../../chunk-V4HKGJYK.mjs";
|
|
@@ -30,31 +33,37 @@ import {
|
|
|
30
33
|
} from "../../../chunk-7GHK5XYK.mjs";
|
|
31
34
|
import {
|
|
32
35
|
EmailField
|
|
33
|
-
} from "../../../chunk-
|
|
34
|
-
import "../../../chunk-
|
|
36
|
+
} from "../../../chunk-R46SWVWL.mjs";
|
|
37
|
+
import "../../../chunk-UQAG7TKJ.mjs";
|
|
35
38
|
import "../../../chunk-DUQFM3QS.mjs";
|
|
36
|
-
import "../../../chunk-
|
|
39
|
+
import "../../../chunk-KTWHCUYV.mjs";
|
|
37
40
|
import "../../../chunk-LLP2PTPK.mjs";
|
|
38
41
|
import "../../../chunk-E5QSNLSR.mjs";
|
|
39
42
|
import "../../../chunk-N3EAW6UO.mjs";
|
|
40
43
|
import "../../../chunk-5HK7HRTR.mjs";
|
|
41
44
|
import "../../../chunk-HJUZTISD.mjs";
|
|
42
45
|
import "../../../chunk-V3KKDSQP.mjs";
|
|
43
|
-
import "../../../chunk-
|
|
44
|
-
import "../../../chunk-ZRHEFEFS.mjs";
|
|
45
|
-
import "../../../chunk-V2G5QHZZ.mjs";
|
|
46
|
+
import "../../../chunk-46SKVFMZ.mjs";
|
|
46
47
|
import "../../../chunk-AQ3ISJKU.mjs";
|
|
47
|
-
import "../../../chunk-
|
|
48
|
+
import "../../../chunk-VXYV37IM.mjs";
|
|
49
|
+
import "../../../chunk-2UHA3DYG.mjs";
|
|
50
|
+
import "../../../chunk-5RNCFTW5.mjs";
|
|
51
|
+
import "../../../chunk-SEJXJZSK.mjs";
|
|
52
|
+
import "../../../chunk-C2VWADF5.mjs";
|
|
53
|
+
import "../../../chunk-UUKS7JYX.mjs";
|
|
54
|
+
import "../../../chunk-V2HNFTTX.mjs";
|
|
55
|
+
import "../../../chunk-IAJ6G633.mjs";
|
|
48
56
|
import "../../../chunk-RRA7GWP2.mjs";
|
|
49
|
-
import "../../../chunk-2SNKT7I4.mjs";
|
|
50
57
|
import "../../../chunk-NOXFF2KJ.mjs";
|
|
58
|
+
import "../../../chunk-2SNKT7I4.mjs";
|
|
59
|
+
import "../../../chunk-ZRHEFEFS.mjs";
|
|
60
|
+
import "../../../chunk-MCQGBAUS.mjs";
|
|
61
|
+
import "../../../chunk-NSU66J5E.mjs";
|
|
51
62
|
import "../../../chunk-WYJW5NNA.mjs";
|
|
52
63
|
import "../../../chunk-C3MURCMZ.mjs";
|
|
53
|
-
import "../../../chunk-V2HNFTTX.mjs";
|
|
54
|
-
import "../../../chunk-IAJ6G633.mjs";
|
|
55
|
-
import "../../../chunk-UUKS7JYX.mjs";
|
|
56
64
|
import "../../../chunk-C4PCTOGM.mjs";
|
|
57
65
|
import "../../../chunk-N3QOXWJI.mjs";
|
|
66
|
+
import "../../../chunk-TUIN5YJW.mjs";
|
|
58
67
|
export {
|
|
59
68
|
AutocompleteField,
|
|
60
69
|
CheckboxField,
|
|
@@ -62,6 +71,7 @@ export {
|
|
|
62
71
|
EmailField,
|
|
63
72
|
InputField,
|
|
64
73
|
RadioField,
|
|
74
|
+
SearchField,
|
|
65
75
|
SelectField,
|
|
66
76
|
SwitchField,
|
|
67
77
|
TextField,
|
package/dist/ui/format/index.js
CHANGED
|
@@ -26,10 +26,11 @@ __export(format_exports, {
|
|
|
26
26
|
FormatDate: () => DateFormat,
|
|
27
27
|
FormatDatetime: () => Datetime,
|
|
28
28
|
FormatDuration: () => Duration,
|
|
29
|
-
FormatNumber: () =>
|
|
29
|
+
FormatNumber: () => Number2,
|
|
30
30
|
FormatPercent: () => Percent,
|
|
31
31
|
FormatPlural: () => Plural,
|
|
32
|
-
FormatTime: () => Time
|
|
32
|
+
FormatTime: () => Time,
|
|
33
|
+
FormatUUID: () => Uuid
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(format_exports);
|
|
35
36
|
|
|
@@ -120,14 +121,14 @@ Currency.displayName = "TeachInUI.FormatCurrency";
|
|
|
120
121
|
|
|
121
122
|
// src/ui/format/number.tsx
|
|
122
123
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
123
|
-
function
|
|
124
|
+
function Number2({ value, decimals, locale = "ru-RU" }) {
|
|
124
125
|
const formatter = new Intl.NumberFormat(locale, {
|
|
125
126
|
minimumFractionDigits: decimals != null ? decimals : 0,
|
|
126
127
|
maximumFractionDigits: decimals != null ? decimals : 2
|
|
127
128
|
});
|
|
128
129
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: formatter.format(value) });
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
+
Number2.displayName = "TeachInUI.FormatNumber";
|
|
131
132
|
|
|
132
133
|
// src/ui/format/percent.tsx
|
|
133
134
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -212,6 +213,40 @@ function Boolean({
|
|
|
212
213
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: value ? trueLabel : falseLabel });
|
|
213
214
|
}
|
|
214
215
|
Boolean.displayName = "TeachInUI.FormatBoolean";
|
|
216
|
+
|
|
217
|
+
// src/ui/format/uuid.tsx
|
|
218
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
219
|
+
var uuidHyphenatedRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;
|
|
220
|
+
function normalizeUuid(value) {
|
|
221
|
+
const trimmed = value.trim();
|
|
222
|
+
if (trimmed.length === 0) return null;
|
|
223
|
+
const withoutPrefix = trimmed.toLowerCase().startsWith("urn:uuid:") ? trimmed.slice("urn:uuid:".length) : trimmed;
|
|
224
|
+
const withoutBraces = withoutPrefix.startsWith("{") && withoutPrefix.endsWith("}") ? withoutPrefix.slice(1, -1) : withoutPrefix;
|
|
225
|
+
if (uuidHyphenatedRegex.test(withoutBraces)) return withoutBraces.toLowerCase();
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
function detectUuidVersion(normalizedUuid) {
|
|
229
|
+
var _a;
|
|
230
|
+
const versionChar = (_a = normalizedUuid.split("-")[2]) == null ? void 0 : _a[0];
|
|
231
|
+
if (!versionChar) return null;
|
|
232
|
+
const parsed = Number.parseInt(versionChar, 16);
|
|
233
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
234
|
+
}
|
|
235
|
+
function Uuid({
|
|
236
|
+
value,
|
|
237
|
+
case: letterCase = "lower",
|
|
238
|
+
showVersion = false,
|
|
239
|
+
invalidFallback = "\u2014"
|
|
240
|
+
}) {
|
|
241
|
+
if (!value) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: invalidFallback });
|
|
242
|
+
const normalized = normalizeUuid(value);
|
|
243
|
+
if (!normalized) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: invalidFallback });
|
|
244
|
+
const formatted = letterCase === "upper" ? normalized.toUpperCase() : normalized;
|
|
245
|
+
if (!showVersion) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: formatted });
|
|
246
|
+
const version = detectUuidVersion(normalized);
|
|
247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: version !== null ? `${formatted} (v${version})` : formatted });
|
|
248
|
+
}
|
|
249
|
+
Uuid.displayName = "TeachInUI.FormatUUID";
|
|
215
250
|
// Annotate the CommonJS export names for ESM import in node:
|
|
216
251
|
0 && (module.exports = {
|
|
217
252
|
FormatBoolean,
|
|
@@ -222,5 +257,6 @@ Boolean.displayName = "TeachInUI.FormatBoolean";
|
|
|
222
257
|
FormatNumber,
|
|
223
258
|
FormatPercent,
|
|
224
259
|
FormatPlural,
|
|
225
|
-
FormatTime
|
|
260
|
+
FormatTime,
|
|
261
|
+
FormatUUID
|
|
226
262
|
});
|
package/dist/ui/format/index.mjs
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../../chunk-
|
|
2
|
+
import "../../chunk-5N3SIZHF.mjs";
|
|
3
|
+
import {
|
|
4
|
+
Percent
|
|
5
|
+
} from "../../chunk-CXAZBWS4.mjs";
|
|
6
|
+
import {
|
|
7
|
+
Plural
|
|
8
|
+
} from "../../chunk-UHLC7GOU.mjs";
|
|
3
9
|
import {
|
|
4
10
|
Time
|
|
5
11
|
} from "../../chunk-3ZTXXJSO.mjs";
|
|
12
|
+
import {
|
|
13
|
+
Uuid
|
|
14
|
+
} from "../../chunk-M5G6RR4Q.mjs";
|
|
15
|
+
import {
|
|
16
|
+
Boolean
|
|
17
|
+
} from "../../chunk-26RHRVH2.mjs";
|
|
6
18
|
import {
|
|
7
19
|
Currency
|
|
8
20
|
} from "../../chunk-LN7WH3OB.mjs";
|
|
@@ -18,15 +30,6 @@ import {
|
|
|
18
30
|
import {
|
|
19
31
|
Number
|
|
20
32
|
} from "../../chunk-NZI5NBXF.mjs";
|
|
21
|
-
import {
|
|
22
|
-
Percent
|
|
23
|
-
} from "../../chunk-CXAZBWS4.mjs";
|
|
24
|
-
import {
|
|
25
|
-
Plural
|
|
26
|
-
} from "../../chunk-UHLC7GOU.mjs";
|
|
27
|
-
import {
|
|
28
|
-
Boolean
|
|
29
|
-
} from "../../chunk-26RHRVH2.mjs";
|
|
30
33
|
export {
|
|
31
34
|
Boolean as FormatBoolean,
|
|
32
35
|
Currency as FormatCurrency,
|
|
@@ -36,5 +39,6 @@ export {
|
|
|
36
39
|
Number as FormatNumber,
|
|
37
40
|
Percent as FormatPercent,
|
|
38
41
|
Plural as FormatPlural,
|
|
39
|
-
Time as FormatTime
|
|
42
|
+
Time as FormatTime,
|
|
43
|
+
Uuid as FormatUUID
|
|
40
44
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
readonly value: string | null | undefined;
|
|
4
|
+
readonly case?: "lower" | "upper";
|
|
5
|
+
readonly showVersion?: boolean;
|
|
6
|
+
readonly invalidFallback?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function Uuid({ value, case: letterCase, showVersion, invalidFallback, }: Props): React.JSX.Element;
|
|
9
|
+
export declare namespace Uuid {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/ui/format/uuid.tsx
|
|
22
|
+
var uuid_exports = {};
|
|
23
|
+
__export(uuid_exports, {
|
|
24
|
+
Uuid: () => Uuid
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(uuid_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var uuidHyphenatedRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;
|
|
29
|
+
function normalizeUuid(value) {
|
|
30
|
+
const trimmed = value.trim();
|
|
31
|
+
if (trimmed.length === 0) return null;
|
|
32
|
+
const withoutPrefix = trimmed.toLowerCase().startsWith("urn:uuid:") ? trimmed.slice("urn:uuid:".length) : trimmed;
|
|
33
|
+
const withoutBraces = withoutPrefix.startsWith("{") && withoutPrefix.endsWith("}") ? withoutPrefix.slice(1, -1) : withoutPrefix;
|
|
34
|
+
if (uuidHyphenatedRegex.test(withoutBraces)) return withoutBraces.toLowerCase();
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function detectUuidVersion(normalizedUuid) {
|
|
38
|
+
var _a;
|
|
39
|
+
const versionChar = (_a = normalizedUuid.split("-")[2]) == null ? void 0 : _a[0];
|
|
40
|
+
if (!versionChar) return null;
|
|
41
|
+
const parsed = Number.parseInt(versionChar, 16);
|
|
42
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
43
|
+
}
|
|
44
|
+
function Uuid({
|
|
45
|
+
value,
|
|
46
|
+
case: letterCase = "lower",
|
|
47
|
+
showVersion = false,
|
|
48
|
+
invalidFallback = "\u2014"
|
|
49
|
+
}) {
|
|
50
|
+
if (!value) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: invalidFallback });
|
|
51
|
+
const normalized = normalizeUuid(value);
|
|
52
|
+
if (!normalized) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: invalidFallback });
|
|
53
|
+
const formatted = letterCase === "upper" ? normalized.toUpperCase() : normalized;
|
|
54
|
+
if (!showVersion) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: formatted });
|
|
55
|
+
const version = detectUuidVersion(normalized);
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: version !== null ? `${formatted} (v${version})` : formatted });
|
|
57
|
+
}
|
|
58
|
+
Uuid.displayName = "TeachInUI.FormatUUID";
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
Uuid
|
|
62
|
+
});
|