@timeax/form-palette 0.1.35 → 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/{core-B34a6gqM.d.ts → core-Cg8uXa6v.d.ts} +11 -1
- package/dist/{core-Bb5eVTa4.d.mts → core-DQr56obQ.d.mts} +11 -1
- package/dist/extra.d.mts +2 -2
- package/dist/extra.d.ts +2 -2
- package/dist/extra.js +158 -36
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +158 -36
- package/dist/extra.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +158 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2729,7 +2729,7 @@ interface ShadcnToggleVariantProps extends Pick<VariantBaseProps<string | string
|
|
|
2729
2729
|
*/
|
|
2730
2730
|
options: ToggleOptionInput[];
|
|
2731
2731
|
multiple?: boolean;
|
|
2732
|
-
|
|
2732
|
+
design?: "default" | "outline";
|
|
2733
2733
|
layout?: "horizontal" | "vertical" | "grid";
|
|
2734
2734
|
gridCols?: number;
|
|
2735
2735
|
fillWidth?: boolean;
|
|
@@ -2816,6 +2816,8 @@ interface ShadcnToggleVariantProps extends Pick<VariantBaseProps<string | string
|
|
|
2816
2816
|
type ToastToolbarItem = "heading" | "bold" | "italic" | "strike" | "hr" | "quote" | "ul" | "ol" | "task" | "indent" | "outdent" | "table" | "image" | "link" | "code" | "codeblock";
|
|
2817
2817
|
type EditorFormat = "html" | "markdown";
|
|
2818
2818
|
type EditorToolbar = "default" | "none" | ToastToolbarItem[][];
|
|
2819
|
+
type EditorTheme = "auto" | "light" | "dark";
|
|
2820
|
+
type EditorThemeTarget = "nearest" | "document";
|
|
2819
2821
|
interface ShadcnEditorVariantProps extends Pick<VariantBaseProps<string | undefined>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "required" | "size" | "density"> {
|
|
2820
2822
|
placeholder?: string;
|
|
2821
2823
|
height?: string;
|
|
@@ -2833,6 +2835,14 @@ interface ShadcnEditorVariantProps extends Pick<VariantBaseProps<string | undefi
|
|
|
2833
2835
|
toolbar?: EditorToolbar;
|
|
2834
2836
|
/** If true, paste is intercepted and inserted as plain text only */
|
|
2835
2837
|
pastePlainText?: boolean;
|
|
2838
|
+
/** Theme mode for Toast UI */
|
|
2839
|
+
theme?: EditorTheme;
|
|
2840
|
+
/**
|
|
2841
|
+
* In auto mode:
|
|
2842
|
+
* - "nearest": resolve from nearest themed ancestor (default)
|
|
2843
|
+
* - "document": resolve from document root only
|
|
2844
|
+
*/
|
|
2845
|
+
themeTarget?: EditorThemeTarget;
|
|
2836
2846
|
className?: string;
|
|
2837
2847
|
}
|
|
2838
2848
|
|
|
@@ -2729,7 +2729,7 @@ interface ShadcnToggleVariantProps extends Pick<VariantBaseProps<string | string
|
|
|
2729
2729
|
*/
|
|
2730
2730
|
options: ToggleOptionInput[];
|
|
2731
2731
|
multiple?: boolean;
|
|
2732
|
-
|
|
2732
|
+
design?: "default" | "outline";
|
|
2733
2733
|
layout?: "horizontal" | "vertical" | "grid";
|
|
2734
2734
|
gridCols?: number;
|
|
2735
2735
|
fillWidth?: boolean;
|
|
@@ -2816,6 +2816,8 @@ interface ShadcnToggleVariantProps extends Pick<VariantBaseProps<string | string
|
|
|
2816
2816
|
type ToastToolbarItem = "heading" | "bold" | "italic" | "strike" | "hr" | "quote" | "ul" | "ol" | "task" | "indent" | "outdent" | "table" | "image" | "link" | "code" | "codeblock";
|
|
2817
2817
|
type EditorFormat = "html" | "markdown";
|
|
2818
2818
|
type EditorToolbar = "default" | "none" | ToastToolbarItem[][];
|
|
2819
|
+
type EditorTheme = "auto" | "light" | "dark";
|
|
2820
|
+
type EditorThemeTarget = "nearest" | "document";
|
|
2819
2821
|
interface ShadcnEditorVariantProps extends Pick<VariantBaseProps<string | undefined>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "required" | "size" | "density"> {
|
|
2820
2822
|
placeholder?: string;
|
|
2821
2823
|
height?: string;
|
|
@@ -2833,6 +2835,14 @@ interface ShadcnEditorVariantProps extends Pick<VariantBaseProps<string | undefi
|
|
|
2833
2835
|
toolbar?: EditorToolbar;
|
|
2834
2836
|
/** If true, paste is intercepted and inserted as plain text only */
|
|
2835
2837
|
pastePlainText?: boolean;
|
|
2838
|
+
/** Theme mode for Toast UI */
|
|
2839
|
+
theme?: EditorTheme;
|
|
2840
|
+
/**
|
|
2841
|
+
* In auto mode:
|
|
2842
|
+
* - "nearest": resolve from nearest themed ancestor (default)
|
|
2843
|
+
* - "document": resolve from document root only
|
|
2844
|
+
*/
|
|
2845
|
+
themeTarget?: EditorThemeTarget;
|
|
2836
2846
|
className?: string;
|
|
2837
2847
|
}
|
|
2838
2848
|
|
package/dist/extra.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-
|
|
4
|
-
export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-
|
|
3
|
+
import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-DQr56obQ.mjs';
|
|
4
|
+
export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-DQr56obQ.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './adapter-CvjXO9Gi.mjs';
|
|
7
7
|
import '@inertiajs/core';
|
package/dist/extra.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-
|
|
4
|
-
export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-
|
|
3
|
+
import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-Cg8uXa6v.js';
|
|
4
|
+
export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-Cg8uXa6v.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './adapter-CvjXO9Gi.js';
|
|
7
7
|
import '@inertiajs/core';
|
package/dist/extra.js
CHANGED
|
@@ -20,6 +20,7 @@ require('@radix-ui/react-toggle');
|
|
|
20
20
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
21
21
|
var Editor = require('@toast-ui/editor');
|
|
22
22
|
require('@toast-ui/editor/dist/toastui-editor.css');
|
|
23
|
+
require('@toast-ui/editor/dist/theme/toastui-editor-dark.css');
|
|
23
24
|
var Ajv = require('ajv');
|
|
24
25
|
var react = require('@iconify/react');
|
|
25
26
|
var LabelPrimitive = require('@radix-ui/react-label');
|
|
@@ -10778,6 +10779,7 @@ var Input = React74__namespace.forwardRef(
|
|
|
10778
10779
|
"data-size": sizeKey,
|
|
10779
10780
|
"data-density": densityKey,
|
|
10780
10781
|
placeholder,
|
|
10782
|
+
...rest,
|
|
10781
10783
|
value: displayValue,
|
|
10782
10784
|
onChange,
|
|
10783
10785
|
onBlur,
|
|
@@ -10785,8 +10787,7 @@ var Input = React74__namespace.forwardRef(
|
|
|
10785
10787
|
onKeyDown: handleKeyDownWrapped,
|
|
10786
10788
|
onKeyPress: handleKeyPressWrapped,
|
|
10787
10789
|
onBeforeInput: handleBeforeInputWrapped,
|
|
10788
|
-
onPaste: handlePasteWrapped
|
|
10789
|
-
...rest
|
|
10790
|
+
onPaste: handlePasteWrapped
|
|
10790
10791
|
}
|
|
10791
10792
|
)
|
|
10792
10793
|
);
|
|
@@ -11063,6 +11064,12 @@ var Input = React74__namespace.forwardRef(
|
|
|
11063
11064
|
] });
|
|
11064
11065
|
}
|
|
11065
11066
|
);
|
|
11067
|
+
function stripAffixes(value, prefix, suffix) {
|
|
11068
|
+
let out = value != null ? value : "";
|
|
11069
|
+
if (prefix && out.startsWith(prefix)) out = out.slice(prefix.length);
|
|
11070
|
+
if (suffix && out.endsWith(suffix)) out = out.slice(0, -suffix.length);
|
|
11071
|
+
return out;
|
|
11072
|
+
}
|
|
11066
11073
|
var ShadcnTextVariant = React74__namespace.forwardRef(function ShadcnTextVariant2(props, forwardedRef) {
|
|
11067
11074
|
const {
|
|
11068
11075
|
// form-level props
|
|
@@ -11146,7 +11153,12 @@ var ShadcnTextVariant = React74__namespace.forwardRef(function ShadcnTextVariant
|
|
|
11146
11153
|
(e4) => {
|
|
11147
11154
|
var _a, _b, _c;
|
|
11148
11155
|
const maskedValue = (_a = e4.value) != null ? _a : "";
|
|
11149
|
-
const
|
|
11156
|
+
const maskedValueWithoutAffixes = stripAffixes(
|
|
11157
|
+
maskedValue,
|
|
11158
|
+
prefix,
|
|
11159
|
+
suffix
|
|
11160
|
+
);
|
|
11161
|
+
const unmaskedInner = (_c = (_b = maskedValueWithoutAffixes.match(/[0-9A-Za-z]/g)) == null ? void 0 : _b.join("")) != null ? _c : "";
|
|
11150
11162
|
const mode = unmask === true || unmask === "raw" ? "raw" : "masked";
|
|
11151
11163
|
const detail = {
|
|
11152
11164
|
source: "variant",
|
|
@@ -11285,7 +11297,7 @@ function getDecimalSeparator(locale) {
|
|
|
11285
11297
|
const m2 = s3.match(/1(.?)1/);
|
|
11286
11298
|
return (m2 == null ? void 0 : m2[1]) || ".";
|
|
11287
11299
|
}
|
|
11288
|
-
function
|
|
11300
|
+
function stripAffixes2(text, prefix, suffix) {
|
|
11289
11301
|
let t4 = text != null ? text : "";
|
|
11290
11302
|
if (prefix && t4.startsWith(prefix)) t4 = t4.slice(prefix.length);
|
|
11291
11303
|
if (suffix && t4.endsWith(suffix)) t4 = t4.slice(0, -suffix.length);
|
|
@@ -11479,7 +11491,7 @@ var InputNumber = React74__namespace.memo(
|
|
|
11479
11491
|
);
|
|
11480
11492
|
const getModelFromDisplay = React74__namespace.useCallback(
|
|
11481
11493
|
(text) => {
|
|
11482
|
-
const stripped =
|
|
11494
|
+
const stripped = stripAffixes2(text, props.prefix, props.suffix);
|
|
11483
11495
|
const withoutGroup = stripGrouping(stripped, locale);
|
|
11484
11496
|
const candidate = decimalSep !== "." ? withoutGroup.replace(".", decimalSep) : withoutGroup;
|
|
11485
11497
|
const n3 = parseEditable(candidate, locale, decimalSep);
|
|
@@ -11517,7 +11529,7 @@ var InputNumber = React74__namespace.memo(
|
|
|
11517
11529
|
setFocused(true);
|
|
11518
11530
|
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e4);
|
|
11519
11531
|
const model = isFiniteNumber(props.value) ? clampModel(props.value) : getModelFromDisplay(display);
|
|
11520
|
-
const editable = model == null ?
|
|
11532
|
+
const editable = model == null ? stripAffixes2(display, props.prefix, props.suffix) : toEditableFromNumber(model);
|
|
11521
11533
|
const normalized = normalizeEditable(
|
|
11522
11534
|
editable,
|
|
11523
11535
|
locale,
|
|
@@ -11534,7 +11546,7 @@ var InputNumber = React74__namespace.memo(
|
|
|
11534
11546
|
var _a2, _b;
|
|
11535
11547
|
setFocused(false);
|
|
11536
11548
|
const el = e4.currentTarget;
|
|
11537
|
-
const raw =
|
|
11549
|
+
const raw = stripAffixes2(el.value, props.prefix, props.suffix);
|
|
11538
11550
|
const normalized = normalizeEditable(
|
|
11539
11551
|
raw,
|
|
11540
11552
|
locale,
|
|
@@ -11556,7 +11568,7 @@ var InputNumber = React74__namespace.memo(
|
|
|
11556
11568
|
if (props.disabled || props.readOnly) return;
|
|
11557
11569
|
const el = e4.currentTarget;
|
|
11558
11570
|
const caretBefore = (_a2 = el.selectionStart) != null ? _a2 : el.value.length;
|
|
11559
|
-
const stripped =
|
|
11571
|
+
const stripped = stripAffixes2(el.value, props.prefix, props.suffix);
|
|
11560
11572
|
let next = normalizeEditable(
|
|
11561
11573
|
stripped,
|
|
11562
11574
|
locale,
|
|
@@ -12480,14 +12492,18 @@ function applyMask(mask, raw, keepCharPositions) {
|
|
|
12480
12492
|
function digitsOnly(input) {
|
|
12481
12493
|
return (input != null ? input : "").replace(/\D+/g, "");
|
|
12482
12494
|
}
|
|
12495
|
+
function normalizeDial(dial) {
|
|
12496
|
+
return digitsOnly(dial != null ? dial : "");
|
|
12497
|
+
}
|
|
12483
12498
|
function dialPrefixFor(country) {
|
|
12484
|
-
return `+${country.dial} `;
|
|
12499
|
+
return `+${normalizeDial(country.dial)} `;
|
|
12485
12500
|
}
|
|
12486
12501
|
function valueToNationalDigits(value, country) {
|
|
12487
12502
|
const digits = digitsOnly(value);
|
|
12488
12503
|
if (!digits) return "";
|
|
12489
|
-
|
|
12490
|
-
|
|
12504
|
+
const dial = normalizeDial(country.dial);
|
|
12505
|
+
if (dial && digits.startsWith(dial)) {
|
|
12506
|
+
return digits.slice(dial.length);
|
|
12491
12507
|
}
|
|
12492
12508
|
return digits;
|
|
12493
12509
|
}
|
|
@@ -12507,8 +12523,9 @@ function computeDisplayFromValue(value, country, keepCharPositions) {
|
|
|
12507
12523
|
function computeNextFromInput(rawInput, country, mode, keepCharPositions) {
|
|
12508
12524
|
const prefix = dialPrefixFor(country);
|
|
12509
12525
|
let national = digitsOnly(rawInput);
|
|
12510
|
-
|
|
12511
|
-
|
|
12526
|
+
const dial = normalizeDial(country.dial);
|
|
12527
|
+
if (dial && national.startsWith(dial)) {
|
|
12528
|
+
national = national.slice(dial.length);
|
|
12512
12529
|
}
|
|
12513
12530
|
const mask = compileMask(country.mask);
|
|
12514
12531
|
const maskedNational = applyMask(mask, national, keepCharPositions);
|
|
@@ -12519,7 +12536,7 @@ function computeNextFromInput(rawInput, country, mode, keepCharPositions) {
|
|
|
12519
12536
|
} else if (mode === "masked") {
|
|
12520
12537
|
nextValue = display;
|
|
12521
12538
|
} else if (mode === "e164") {
|
|
12522
|
-
nextValue =
|
|
12539
|
+
nextValue = dial + national;
|
|
12523
12540
|
} else {
|
|
12524
12541
|
nextValue = national;
|
|
12525
12542
|
}
|
|
@@ -12532,8 +12549,10 @@ function remapToCountry(value, from, to, mode, keepCharPositions) {
|
|
|
12532
12549
|
}
|
|
12533
12550
|
const digitsAll = digitsOnly(value);
|
|
12534
12551
|
let national = digitsAll;
|
|
12535
|
-
|
|
12536
|
-
|
|
12552
|
+
const fromDial = normalizeDial(from.dial);
|
|
12553
|
+
const toDial = normalizeDial(to.dial);
|
|
12554
|
+
if (fromDial && digitsAll.startsWith(fromDial)) {
|
|
12555
|
+
national = digitsAll.slice(fromDial.length);
|
|
12537
12556
|
}
|
|
12538
12557
|
const prefix = dialPrefixFor(to);
|
|
12539
12558
|
const mask = compileMask(to.mask);
|
|
@@ -12545,7 +12564,7 @@ function remapToCountry(value, from, to, mode, keepCharPositions) {
|
|
|
12545
12564
|
} else if (mode === "masked") {
|
|
12546
12565
|
nextValue = display;
|
|
12547
12566
|
} else if (mode === "e164") {
|
|
12548
|
-
nextValue =
|
|
12567
|
+
nextValue = toDial + national;
|
|
12549
12568
|
} else {
|
|
12550
12569
|
nextValue = national;
|
|
12551
12570
|
}
|
|
@@ -12574,7 +12593,7 @@ var CountrySelect = ({
|
|
|
12574
12593
|
const selected = (_b = (_a = countries.find((c2) => c2.code === value)) != null ? _a : countries[0]) != null ? _b : null;
|
|
12575
12594
|
const triggerLabel = selected ? [
|
|
12576
12595
|
showFlag && selected.flag ? selected.flag : null,
|
|
12577
|
-
showSelectedDial ? `+${selected.dial}` : null,
|
|
12596
|
+
showSelectedDial ? `+${normalizeDial(selected.dial)}` : null,
|
|
12578
12597
|
showSelectedLabel ? selected.label : null
|
|
12579
12598
|
].filter(Boolean).join(" ") : "";
|
|
12580
12599
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: countrySelectClassName, children: /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: (_c = selected == null ? void 0 : selected.code) != null ? _c : "", onValueChange: onChange, children: [
|
|
@@ -12601,7 +12620,7 @@ var CountrySelect = ({
|
|
|
12601
12620
|
parts.push(String(c2.flag));
|
|
12602
12621
|
}
|
|
12603
12622
|
if (showDialInList) {
|
|
12604
|
-
parts.push(
|
|
12623
|
+
parts.push(`+${normalizeDial(c2.dial)}`);
|
|
12605
12624
|
}
|
|
12606
12625
|
parts.push(c2.label);
|
|
12607
12626
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20544,6 +20563,7 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey, optionT
|
|
|
20544
20563
|
});
|
|
20545
20564
|
}
|
|
20546
20565
|
return items.map((item, index) => {
|
|
20566
|
+
var _a;
|
|
20547
20567
|
if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
|
|
20548
20568
|
const v2 = item;
|
|
20549
20569
|
return {
|
|
@@ -20556,12 +20576,19 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey, optionT
|
|
|
20556
20576
|
raw: item
|
|
20557
20577
|
};
|
|
20558
20578
|
}
|
|
20559
|
-
|
|
20579
|
+
const existing = item;
|
|
20580
|
+
return {
|
|
20581
|
+
...existing,
|
|
20582
|
+
raw: (_a = existing.raw) != null ? _a : item
|
|
20583
|
+
};
|
|
20560
20584
|
});
|
|
20561
20585
|
}
|
|
20562
20586
|
function isEqualValue2(a3, b2) {
|
|
20563
20587
|
return Object.is(a3, b2);
|
|
20564
20588
|
}
|
|
20589
|
+
function valueLookupKey(value) {
|
|
20590
|
+
return `${typeof value}:${String(value)}`;
|
|
20591
|
+
}
|
|
20565
20592
|
function asGroupValue(value) {
|
|
20566
20593
|
if (!value) return void 0;
|
|
20567
20594
|
if (Array.isArray(value)) {
|
|
@@ -20575,13 +20602,14 @@ function asGroupValue(value) {
|
|
|
20575
20602
|
state: true
|
|
20576
20603
|
}));
|
|
20577
20604
|
}
|
|
20578
|
-
if (typeof value == "object")
|
|
20579
|
-
return
|
|
20605
|
+
if (typeof value == "object") {
|
|
20606
|
+
return Reflect.ownKeys(value).map(
|
|
20580
20607
|
(key) => ({
|
|
20581
20608
|
value: key,
|
|
20582
20609
|
state: value[key]
|
|
20583
20610
|
})
|
|
20584
20611
|
);
|
|
20612
|
+
}
|
|
20585
20613
|
return void 0;
|
|
20586
20614
|
}
|
|
20587
20615
|
function asSingleValue(value) {
|
|
@@ -20740,7 +20768,32 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
20740
20768
|
}
|
|
20741
20769
|
);
|
|
20742
20770
|
}
|
|
20743
|
-
const
|
|
20771
|
+
const normalizedByValueKey = React74__namespace.useMemo(() => {
|
|
20772
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
20773
|
+
normalized.forEach((item) => {
|
|
20774
|
+
lookup.set(valueLookupKey(item.value), item);
|
|
20775
|
+
});
|
|
20776
|
+
return lookup;
|
|
20777
|
+
}, [normalized]);
|
|
20778
|
+
const groupValue = React74__namespace.useMemo(() => {
|
|
20779
|
+
const source = asGroupValue(value);
|
|
20780
|
+
if (!(source == null ? void 0 : source.length)) return source;
|
|
20781
|
+
return source.map((entry) => {
|
|
20782
|
+
const byExact = normalized.find(
|
|
20783
|
+
(item) => isEqualValue2(item.value, entry.value)
|
|
20784
|
+
);
|
|
20785
|
+
if (byExact) return { ...entry, value: byExact.value };
|
|
20786
|
+
const byKey = normalizedByValueKey.get(valueLookupKey(entry.value));
|
|
20787
|
+
if (byKey) return { ...entry, value: byKey.value };
|
|
20788
|
+
if (typeof entry.value === "string") {
|
|
20789
|
+
const byString = normalized.find(
|
|
20790
|
+
(item) => typeof item.value !== "object" && String(item.value) === entry.value
|
|
20791
|
+
);
|
|
20792
|
+
if (byString) return { ...entry, value: byString.value };
|
|
20793
|
+
}
|
|
20794
|
+
return entry;
|
|
20795
|
+
});
|
|
20796
|
+
}, [value, normalized, normalizedByValueKey]);
|
|
20744
20797
|
const {
|
|
20745
20798
|
groupStyle,
|
|
20746
20799
|
groupClasses,
|
|
@@ -20841,10 +20894,13 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
20841
20894
|
raw: nextList,
|
|
20842
20895
|
selectedOptions: nextList.map(
|
|
20843
20896
|
(entry) => {
|
|
20844
|
-
var _a, _b;
|
|
20845
|
-
|
|
20897
|
+
var _a, _b, _c;
|
|
20898
|
+
const normalizedItem = (_a = normalizedByValueKey.get(
|
|
20899
|
+
valueLookupKey(entry.value)
|
|
20900
|
+
)) != null ? _a : normalized.find(
|
|
20846
20901
|
(item) => isEqualValue2(item.value, entry.value)
|
|
20847
|
-
)
|
|
20902
|
+
);
|
|
20903
|
+
return (_c = (_b = normalizedItem == null ? void 0 : normalizedItem.raw) != null ? _b : normalizedItem) != null ? _c : entry.value;
|
|
20848
20904
|
}
|
|
20849
20905
|
),
|
|
20850
20906
|
nativeEvent: void 0,
|
|
@@ -20860,7 +20916,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
20860
20916
|
}
|
|
20861
20917
|
onValue(nextList.map((item) => item.value), detail);
|
|
20862
20918
|
},
|
|
20863
|
-
[onValue, disabled, groupValue, normalized, hasAnyTristate]
|
|
20919
|
+
[onValue, disabled, groupValue, normalizedByValueKey, normalized, hasAnyTristate]
|
|
20864
20920
|
);
|
|
20865
20921
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20866
20922
|
"div",
|
|
@@ -25806,7 +25862,7 @@ var ShadcnToggleVariant3 = React74__namespace.forwardRef(function ShadcnToggleVa
|
|
|
25806
25862
|
size = "md",
|
|
25807
25863
|
options = [],
|
|
25808
25864
|
multiple = false,
|
|
25809
|
-
|
|
25865
|
+
design = "default",
|
|
25810
25866
|
layout = "horizontal",
|
|
25811
25867
|
gridCols = 2,
|
|
25812
25868
|
fillWidth: fullWidth = false,
|
|
@@ -25910,7 +25966,6 @@ var ShadcnToggleVariant3 = React74__namespace.forwardRef(function ShadcnToggleVa
|
|
|
25910
25966
|
fullWidth && layout === "vertical" && "[&>*]:w-full",
|
|
25911
25967
|
className
|
|
25912
25968
|
);
|
|
25913
|
-
console.log(layoutClasses, fullWidth, autoCap);
|
|
25914
25969
|
const groupStyle = React74__namespace.useMemo(() => {
|
|
25915
25970
|
const style = {};
|
|
25916
25971
|
if (layout === "grid") {
|
|
@@ -25929,7 +25984,7 @@ var ShadcnToggleVariant3 = React74__namespace.forwardRef(function ShadcnToggleVa
|
|
|
25929
25984
|
value: currentValue,
|
|
25930
25985
|
onValueChange: handleChange,
|
|
25931
25986
|
disabled: isDisabled,
|
|
25932
|
-
variant,
|
|
25987
|
+
variant: design,
|
|
25933
25988
|
size: toggleSize,
|
|
25934
25989
|
className: layoutClasses,
|
|
25935
25990
|
style: groupStyle,
|
|
@@ -25971,7 +26026,7 @@ var ShadcnToggleVariant3 = React74__namespace.forwardRef(function ShadcnToggleVa
|
|
|
25971
26026
|
// Error State
|
|
25972
26027
|
error && "border-destructive/50 hover:bg-destructive/10 data-[state=on]:bg-destructive data-[state=on]:text-destructive-foreground",
|
|
25973
26028
|
// Variant: Outline specific tweaks
|
|
25974
|
-
|
|
26029
|
+
design === "outline" && layout === "horizontal" && !fullWidth && "first:rounded-l-md last:rounded-r-md rounded-none border-l-0 first:border-l",
|
|
25975
26030
|
// Layout tweaks
|
|
25976
26031
|
fullWidth && "justify-center",
|
|
25977
26032
|
// Custom Item Class
|
|
@@ -26006,6 +26061,30 @@ var toggleGroupModule = {
|
|
|
26006
26061
|
tags: ["buttons", "toggle"]
|
|
26007
26062
|
}
|
|
26008
26063
|
};
|
|
26064
|
+
function isDarkThemedElement(el) {
|
|
26065
|
+
if (!el) return false;
|
|
26066
|
+
if (el.classList.contains("dark")) return true;
|
|
26067
|
+
const dataTheme = el.getAttribute("data-theme");
|
|
26068
|
+
return dataTheme === "dark";
|
|
26069
|
+
}
|
|
26070
|
+
function resolveAutoDarkFromHost(host, target) {
|
|
26071
|
+
if (typeof document === "undefined") return false;
|
|
26072
|
+
if (target === "document") {
|
|
26073
|
+
return isDarkThemedElement(document.documentElement) || isDarkThemedElement(document.body);
|
|
26074
|
+
}
|
|
26075
|
+
let node = host != null ? host : null;
|
|
26076
|
+
while (node) {
|
|
26077
|
+
const isEditorMarker = node.hasAttribute("data-editor-theme");
|
|
26078
|
+
if (!isEditorMarker) {
|
|
26079
|
+
if (node.classList.contains("dark")) return true;
|
|
26080
|
+
if (node.hasAttribute("data-theme")) {
|
|
26081
|
+
return node.getAttribute("data-theme") === "dark";
|
|
26082
|
+
}
|
|
26083
|
+
}
|
|
26084
|
+
node = node.parentElement;
|
|
26085
|
+
}
|
|
26086
|
+
return isDarkThemedElement(document.documentElement) || isDarkThemedElement(document.body);
|
|
26087
|
+
}
|
|
26009
26088
|
function ShadcnEditorVariant(props) {
|
|
26010
26089
|
const {
|
|
26011
26090
|
value,
|
|
@@ -26024,7 +26103,9 @@ function ShadcnEditorVariant(props) {
|
|
|
26024
26103
|
useCommandShortcut = true,
|
|
26025
26104
|
format: format2 = "html",
|
|
26026
26105
|
toolbar = "default",
|
|
26027
|
-
pastePlainText = false
|
|
26106
|
+
pastePlainText = false,
|
|
26107
|
+
theme = "auto",
|
|
26108
|
+
themeTarget = "nearest"
|
|
26028
26109
|
} = props;
|
|
26029
26110
|
const mountRef = React74__namespace.useRef(null);
|
|
26030
26111
|
const editorRef = React74__namespace.useRef(null);
|
|
@@ -26032,9 +26113,13 @@ function ShadcnEditorVariant(props) {
|
|
|
26032
26113
|
const onValueRef = React74__namespace.useRef(onValue);
|
|
26033
26114
|
const syncingRef = React74__namespace.useRef(false);
|
|
26034
26115
|
const loadedRef = React74__namespace.useRef(false);
|
|
26116
|
+
const lastContentRef = React74__namespace.useRef(value != null ? value : "");
|
|
26117
|
+
const [autoDark, setAutoDark] = React74__namespace.useState(false);
|
|
26035
26118
|
formatRef.current = format2;
|
|
26036
26119
|
onValueRef.current = onValue;
|
|
26120
|
+
if (value !== void 0) lastContentRef.current = value;
|
|
26037
26121
|
const effectiveReadOnly = Boolean(disabled || readOnly);
|
|
26122
|
+
const effectiveTheme = theme === "auto" ? autoDark ? "dark" : "light" : theme;
|
|
26038
26123
|
const readContent = React74__namespace.useCallback((ed) => {
|
|
26039
26124
|
var _a, _b;
|
|
26040
26125
|
return formatRef.current === "markdown" ? (_a = ed.getMarkdown()) != null ? _a : "" : (_b = ed.getHTML()) != null ? _b : "";
|
|
@@ -26046,9 +26131,40 @@ function ShadcnEditorVariant(props) {
|
|
|
26046
26131
|
}, []);
|
|
26047
26132
|
const structuralKey = React74__namespace.useMemo(() => {
|
|
26048
26133
|
const hideModeSwitch = toolbar === "none" || pastePlainText;
|
|
26049
|
-
return JSON.stringify({
|
|
26050
|
-
|
|
26134
|
+
return JSON.stringify({
|
|
26135
|
+
toolbar,
|
|
26136
|
+
useCommandShortcut,
|
|
26137
|
+
hideModeSwitch,
|
|
26138
|
+
effectiveTheme
|
|
26139
|
+
});
|
|
26140
|
+
}, [toolbar, useCommandShortcut, pastePlainText, effectiveTheme]);
|
|
26051
26141
|
React74__namespace.useEffect(() => {
|
|
26142
|
+
if (theme !== "auto") return;
|
|
26143
|
+
if (typeof document === "undefined") return;
|
|
26144
|
+
const host = mountRef.current;
|
|
26145
|
+
const recompute = () => {
|
|
26146
|
+
setAutoDark(resolveAutoDarkFromHost(host, themeTarget));
|
|
26147
|
+
};
|
|
26148
|
+
recompute();
|
|
26149
|
+
const observer = new MutationObserver(() => {
|
|
26150
|
+
recompute();
|
|
26151
|
+
});
|
|
26152
|
+
observer.observe(document.documentElement, {
|
|
26153
|
+
attributes: true,
|
|
26154
|
+
subtree: true,
|
|
26155
|
+
attributeFilter: ["class", "data-theme"]
|
|
26156
|
+
});
|
|
26157
|
+
if (document.body) {
|
|
26158
|
+
observer.observe(document.body, {
|
|
26159
|
+
attributes: true,
|
|
26160
|
+
subtree: true,
|
|
26161
|
+
attributeFilter: ["class", "data-theme"]
|
|
26162
|
+
});
|
|
26163
|
+
}
|
|
26164
|
+
return () => observer.disconnect();
|
|
26165
|
+
}, [theme, themeTarget]);
|
|
26166
|
+
React74__namespace.useEffect(() => {
|
|
26167
|
+
var _a;
|
|
26052
26168
|
const el = mountRef.current;
|
|
26053
26169
|
if (!el) return;
|
|
26054
26170
|
if (editorRef.current) {
|
|
@@ -26072,13 +26188,14 @@ function ShadcnEditorVariant(props) {
|
|
|
26072
26188
|
const options = {
|
|
26073
26189
|
el,
|
|
26074
26190
|
height,
|
|
26075
|
-
initialValue: value != null ? value : "",
|
|
26191
|
+
initialValue: (_a = value != null ? value : lastContentRef.current) != null ? _a : "",
|
|
26076
26192
|
previewStyle,
|
|
26077
26193
|
initialEditType: editType,
|
|
26078
26194
|
useCommandShortcut,
|
|
26079
26195
|
usageStatistics: false,
|
|
26080
26196
|
placeholder,
|
|
26081
26197
|
hideModeSwitch,
|
|
26198
|
+
...effectiveTheme === "dark" ? { theme: "dark" } : {},
|
|
26082
26199
|
...toolbar === "none" ? { toolbarItems: [] } : Array.isArray(toolbar) ? { toolbarItems: toolbar } : {},
|
|
26083
26200
|
events: {
|
|
26084
26201
|
load: () => {
|
|
@@ -26089,7 +26206,9 @@ function ShadcnEditorVariant(props) {
|
|
|
26089
26206
|
const ed = editorRef.current;
|
|
26090
26207
|
if (!ed) return;
|
|
26091
26208
|
if (syncingRef.current) return;
|
|
26092
|
-
|
|
26209
|
+
const next = readContent(ed);
|
|
26210
|
+
lastContentRef.current = next;
|
|
26211
|
+
emit(next);
|
|
26093
26212
|
}
|
|
26094
26213
|
}
|
|
26095
26214
|
};
|
|
@@ -26150,6 +26269,7 @@ function ShadcnEditorVariant(props) {
|
|
|
26150
26269
|
const cur = (_d = (_c = ed.getHTML) == null ? void 0 : _c.call(ed)) != null ? _d : "";
|
|
26151
26270
|
if (cur !== next) ed.setHTML(next, false);
|
|
26152
26271
|
}
|
|
26272
|
+
lastContentRef.current = next;
|
|
26153
26273
|
Promise.resolve().then(() => {
|
|
26154
26274
|
syncingRef.current = false;
|
|
26155
26275
|
});
|
|
@@ -26173,6 +26293,8 @@ function ShadcnEditorVariant(props) {
|
|
|
26173
26293
|
{
|
|
26174
26294
|
"data-size": size,
|
|
26175
26295
|
"data-density": density,
|
|
26296
|
+
"data-theme": effectiveTheme,
|
|
26297
|
+
"data-editor-theme": effectiveTheme,
|
|
26176
26298
|
className: cn(
|
|
26177
26299
|
"rounded-md border border-input bg-background overflow-hidden",
|
|
26178
26300
|
effectiveReadOnly && "opacity-60 pointer-events-none",
|