@lax-wp/design-system 0.13.33 → 0.13.35
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/button/Button.cjs.js +5 -5
- package/dist/components/button/Button.cjs.js.map +1 -1
- package/dist/components/button/Button.es.js +18 -18
- package/dist/components/button/Button.es.js.map +1 -1
- package/dist/components/button/IconButton.cjs.js +1 -1
- package/dist/components/button/IconButton.cjs.js.map +1 -1
- package/dist/components/button/IconButton.es.js +8 -8
- package/dist/components/button/IconButton.es.js.map +1 -1
- package/dist/components/buttons/option-button/OptionButton.cjs.js +1 -1
- package/dist/components/buttons/option-button/OptionButton.cjs.js.map +1 -1
- package/dist/components/buttons/option-button/OptionButton.es.js +1 -1
- package/dist/components/buttons/option-button/OptionButton.es.js.map +1 -1
- package/dist/components/data-display/comparison/components/Header.cjs.js +1 -1
- package/dist/components/data-display/comparison/components/Header.cjs.js.map +1 -1
- package/dist/components/data-display/comparison/components/Header.es.js +13 -13
- package/dist/components/data-display/comparison/components/Header.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/CheckboxCell.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/body/cell/CheckboxCell.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/CheckboxCell.es.js +23 -23
- package/dist/components/data-display/infinite-table/body/cell/CheckboxCell.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js +1 -1
- package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/rows/index.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/body/rows/index.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/rows/index.es.js +104 -101
- package/dist/components/data-display/infinite-table/body/rows/index.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/constants.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/constants.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/constants.d.ts +6 -0
- package/dist/components/data-display/infinite-table/constants.es.js +17 -16
- package/dist/components/data-display/infinite-table/constants.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/head/CheckAll.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/head/CheckAll.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/head/CheckAll.es.js +4 -4
- package/dist/components/data-display/infinite-table/head/CheckAll.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/head/index.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/head/index.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/head/index.es.js +5 -5
- package/dist/components/data-display/infinite-table/head/index.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.es.js +188 -187
- package/dist/components/data-display/infinite-table/index.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/useRowHeight.cjs.js +2 -0
- package/dist/components/data-display/infinite-table/useRowHeight.cjs.js.map +1 -0
- package/dist/components/data-display/infinite-table/useRowHeight.d.ts +15 -0
- package/dist/components/data-display/infinite-table/useRowHeight.es.js +24 -0
- package/dist/components/data-display/infinite-table/useRowHeight.es.js.map +1 -0
- package/dist/components/data-display/tag/Tag.cjs.js +1 -1
- package/dist/components/data-display/tag/Tag.cjs.js.map +1 -1
- package/dist/components/data-display/tag/Tag.es.js +11 -9
- package/dist/components/data-display/tag/Tag.es.js.map +1 -1
- package/dist/components/floating-bar/FloatingBar.cjs.js +1 -1
- package/dist/components/floating-bar/FloatingBar.cjs.js.map +1 -1
- package/dist/components/floating-bar/FloatingBar.es.js +9 -9
- package/dist/components/floating-bar/FloatingBar.es.js.map +1 -1
- package/dist/components/forms/base-input-field/BaseInputField.cjs.js +2 -2
- package/dist/components/forms/base-input-field/BaseInputField.cjs.js.map +1 -1
- package/dist/components/forms/base-input-field/BaseInputField.es.js +40 -42
- package/dist/components/forms/base-input-field/BaseInputField.es.js.map +1 -1
- package/dist/components/forms/creatable-select/CreatableSelect.cjs.js +1 -1
- package/dist/components/forms/creatable-select/CreatableSelect.cjs.js.map +1 -1
- package/dist/components/forms/creatable-select/CreatableSelect.es.js +14 -15
- package/dist/components/forms/creatable-select/CreatableSelect.es.js.map +1 -1
- package/dist/components/forms/currency-input/CurrencyInputField.cjs.js +1 -1
- package/dist/components/forms/currency-input/CurrencyInputField.cjs.js.map +1 -1
- package/dist/components/forms/currency-input/CurrencyInputField.es.js +57 -65
- package/dist/components/forms/currency-input/CurrencyInputField.es.js.map +1 -1
- package/dist/components/forms/date-time-field/DateTimeField.cjs.js +1 -1
- package/dist/components/forms/date-time-field/DateTimeField.cjs.js.map +1 -1
- package/dist/components/forms/date-time-field/DateTimeField.es.js +33 -33
- package/dist/components/forms/date-time-field/DateTimeField.es.js.map +1 -1
- package/dist/components/forms/debounce-input/DebounceInputField.cjs.js +1 -1
- package/dist/components/forms/debounce-input/DebounceInputField.cjs.js.map +1 -1
- package/dist/components/forms/debounce-input/DebounceInputField.es.js +2 -2
- package/dist/components/forms/debounce-input/DebounceInputField.es.js.map +1 -1
- package/dist/components/forms/dynamic-data-input/DynamicDataInput.cjs.js +1 -1
- package/dist/components/forms/dynamic-data-input/DynamicDataInput.cjs.js.map +1 -1
- package/dist/components/forms/dynamic-data-input/DynamicDataInput.es.js +7 -7
- package/dist/components/forms/dynamic-data-input/DynamicDataInput.es.js.map +1 -1
- package/dist/components/forms/dynamic-data-input/DynamicDataInputField.cjs.js +1 -1
- package/dist/components/forms/dynamic-data-input/DynamicDataInputField.cjs.js.map +1 -1
- package/dist/components/forms/dynamic-data-input/DynamicDataInputField.es.js +17 -19
- package/dist/components/forms/dynamic-data-input/DynamicDataInputField.es.js.map +1 -1
- package/dist/components/forms/field-options/Item.cjs.js +1 -1
- package/dist/components/forms/field-options/Item.cjs.js.map +1 -1
- package/dist/components/forms/field-options/Item.es.js +5 -5
- package/dist/components/forms/field-options/Item.es.js.map +1 -1
- package/dist/components/forms/formula-input/FormulaInput.cjs.js +1 -1
- package/dist/components/forms/formula-input/FormulaInput.cjs.js.map +1 -1
- package/dist/components/forms/formula-input/FormulaInput.es.js +10 -10
- package/dist/components/forms/formula-input/FormulaInput.es.js.map +1 -1
- package/dist/components/forms/icon-picker/IconPicker.cjs.js +1 -1
- package/dist/components/forms/icon-picker/IconPicker.cjs.js.map +1 -1
- package/dist/components/forms/icon-picker/IconPicker.es.js +42 -57
- package/dist/components/forms/icon-picker/IconPicker.es.js.map +1 -1
- package/dist/components/forms/input-field/InputField.cjs.js.map +1 -1
- package/dist/components/forms/input-field/InputField.es.js.map +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js.map +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.es.js +54 -60
- package/dist/components/forms/master-data-input/MasterDataInputField.es.js.map +1 -1
- package/dist/components/forms/md-input/RichMarkdownInput.cjs.js +3 -3
- package/dist/components/forms/md-input/RichMarkdownInput.cjs.js.map +1 -1
- package/dist/components/forms/md-input/RichMarkdownInput.es.js +63 -63
- package/dist/components/forms/md-input/RichMarkdownInput.es.js.map +1 -1
- package/dist/components/forms/number-input-field/NumberInputField.cjs.js +1 -1
- package/dist/components/forms/number-input-field/NumberInputField.cjs.js.map +1 -1
- package/dist/components/forms/number-input-field/NumberInputField.es.js +5 -5
- package/dist/components/forms/number-input-field/NumberInputField.es.js.map +1 -1
- package/dist/components/forms/percentage-input/PercentageInputField.cjs.js +2 -2
- package/dist/components/forms/percentage-input/PercentageInputField.cjs.js.map +1 -1
- package/dist/components/forms/percentage-input/PercentageInputField.es.js +20 -20
- package/dist/components/forms/percentage-input/PercentageInputField.es.js.map +1 -1
- package/dist/components/forms/search-bar/SearchBar.cjs.js +1 -1
- package/dist/components/forms/search-bar/SearchBar.cjs.js.map +1 -1
- package/dist/components/forms/search-bar/SearchBar.es.js +16 -16
- package/dist/components/forms/search-bar/SearchBar.es.js.map +1 -1
- package/dist/components/forms/select-field/SelectField.cjs.js +2 -2
- package/dist/components/forms/select-field/SelectField.cjs.js.map +1 -1
- package/dist/components/forms/select-field/SelectField.d.ts +4 -0
- package/dist/components/forms/select-field/SelectField.es.js +202 -203
- package/dist/components/forms/select-field/SelectField.es.js.map +1 -1
- package/dist/components/forms/text-area-field/TextAreaField.cjs.js +1 -1
- package/dist/components/forms/text-area-field/TextAreaField.cjs.js.map +1 -1
- package/dist/components/forms/text-area-field/TextAreaField.es.js +14 -14
- package/dist/components/forms/text-area-field/TextAreaField.es.js.map +1 -1
- package/dist/components/forms/toggle/Toggle.cjs.js +1 -1
- package/dist/components/forms/toggle/Toggle.cjs.js.map +1 -1
- package/dist/components/forms/toggle/Toggle.es.js +65 -59
- package/dist/components/forms/toggle/Toggle.es.js.map +1 -1
- package/dist/components/navigation/accordion/Accordion.cjs.js +1 -1
- package/dist/components/navigation/accordion/Accordion.cjs.js.map +1 -1
- package/dist/components/navigation/accordion/Accordion.es.js +5 -5
- package/dist/components/navigation/accordion/Accordion.es.js.map +1 -1
- package/dist/components/navigation/stepper/Stepper.cjs.js +1 -1
- package/dist/components/navigation/stepper/Stepper.cjs.js.map +1 -1
- package/dist/components/navigation/stepper/Stepper.es.js +1 -1
- package/dist/components/navigation/stepper/Stepper.es.js.map +1 -1
- package/dist/components/navigation/tabs/TabOptions.cjs.js +1 -1
- package/dist/components/navigation/tabs/TabOptions.cjs.js.map +1 -1
- package/dist/components/navigation/tabs/TabOptions.es.js +15 -15
- package/dist/components/navigation/tabs/TabOptions.es.js.map +1 -1
- package/dist/components/navigation/tabs/TabSwitch.cjs.js +1 -1
- package/dist/components/navigation/tabs/TabSwitch.cjs.js.map +1 -1
- package/dist/components/navigation/tabs/TabSwitch.es.js +7 -7
- package/dist/components/navigation/tabs/TabSwitch.es.js.map +1 -1
- package/dist/components/navigation/tabs/Tabs.cjs.js +1 -1
- package/dist/components/navigation/tabs/Tabs.cjs.js.map +1 -1
- package/dist/components/navigation/tabs/Tabs.es.js +1 -1
- package/dist/components/navigation/tabs/Tabs.es.js.map +1 -1
- package/dist/components/tooltip/Tooltip.cjs.js +1 -1
- package/dist/components/tooltip/Tooltip.cjs.js.map +1 -1
- package/dist/components/tooltip/Tooltip.es.js +19 -19
- package/dist/components/tooltip/Tooltip.es.js.map +1 -1
- package/dist/components/user-avatar/UserAvatar.cjs.js +1 -1
- package/dist/components/user-avatar/UserAvatar.cjs.js.map +1 -1
- package/dist/components/user-avatar/UserAvatar.d.ts +1 -1
- package/dist/components/user-avatar/UserAvatar.es.js +40 -38
- package/dist/components/user-avatar/UserAvatar.es.js.map +1 -1
- package/dist/components/user-avatar/constants.cjs.js +1 -1
- package/dist/components/user-avatar/constants.cjs.js.map +1 -1
- package/dist/components/user-avatar/constants.d.ts +1 -0
- package/dist/components/user-avatar/constants.es.js +10 -9
- package/dist/components/user-avatar/constants.es.js.map +1 -1
- package/dist/design-system.css +1 -1
- package/package.json +2 -3
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import r from "../../../_virtual/index.es.js";
|
|
3
3
|
import { forwardRef as ie, useState as oe } from "react";
|
|
4
4
|
import { AnimatePresence as ne, motion as se } from "framer-motion";
|
|
5
5
|
import { Tooltip as ce } from "antd";
|
|
6
6
|
import { useTranslation as de } from "react-i18next";
|
|
7
7
|
import { Typography as p } from "../../data-display/typography/Typography.es.js";
|
|
8
|
-
import { TOGGLE_LABEL_DIRECTION as
|
|
8
|
+
import { TOGGLE_LABEL_DIRECTION as x } from "../../../constants/toggle.es.js";
|
|
9
9
|
import { BoltOutlined as me, NoteAddOutlined as fe } from "@mui/icons-material";
|
|
10
10
|
import { AIExtractedIndicator as pe } from "../../icons/AIExtractedIndicator.es.js";
|
|
11
11
|
import { AIStarIcon as ue } from "../../icons/AIStarIcon.es.js";
|
|
12
12
|
import { Label as ge } from "../../data-display/label/Label.es.js";
|
|
13
13
|
import L from "../../tooltip/Tooltip.es.js";
|
|
14
|
-
import { HelpIcon as
|
|
15
|
-
import { InputLabel as
|
|
16
|
-
import { shouldShowConfidenceScore as O, getConfidenceScoreBadgeFill as
|
|
17
|
-
const we = (
|
|
14
|
+
import { HelpIcon as he } from "../../icons/HelpIcon.es.js";
|
|
15
|
+
import { InputLabel as be } from "../shared/InputLabel.es.js";
|
|
16
|
+
import { shouldShowConfidenceScore as O, getConfidenceScoreBadgeFill as xe, getConfidenceScoreBadgeColor as ve, getConfidenceScoreBadgeTextColor as ke, getConfidenceScoreBadgeClass as ye } from "../../../utils/confidenceScoreUtils.es.js";
|
|
17
|
+
const we = (a, t, o, u = "medium") => {
|
|
18
18
|
const n = {
|
|
19
19
|
small: "w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5",
|
|
20
|
-
medium: "w-
|
|
20
|
+
medium: "w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5",
|
|
21
21
|
large: "w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5"
|
|
22
22
|
}, g = {
|
|
23
23
|
small: "peer-checked:after:translate-x-3",
|
|
24
24
|
medium: "peer-checked:after:translate-x-full",
|
|
25
25
|
large: "peer-checked:after:translate-x-5"
|
|
26
26
|
};
|
|
27
|
-
return
|
|
27
|
+
return r(
|
|
28
28
|
"p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]",
|
|
29
29
|
n[u],
|
|
30
30
|
g[u],
|
|
31
31
|
{
|
|
32
|
-
"peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500":
|
|
33
|
-
"after:bg-white dark:after:bg-black-500": !
|
|
34
|
-
"text-white dark:text-black-900":
|
|
32
|
+
"peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500": a,
|
|
33
|
+
"after:bg-white dark:after:bg-black-500": !a,
|
|
34
|
+
"text-white dark:text-black-900": t,
|
|
35
35
|
"cursor-not-allowed opacity-70": o
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
|
-
}, Ne = ({ size:
|
|
38
|
+
}, Ne = ({ size: a = 18, fill: t = "#016DCF" }) => /* @__PURE__ */ e("svg", { width: a, height: a, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ e(
|
|
39
39
|
"path",
|
|
40
40
|
{
|
|
41
41
|
d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",
|
|
42
|
-
fill:
|
|
42
|
+
fill: t
|
|
43
43
|
}
|
|
44
|
-
) }),
|
|
44
|
+
) }), Ce = ({ size: a = 18, fill: t = "#101828" }) => /* @__PURE__ */ e("svg", { width: a, height: a, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ e(
|
|
45
45
|
"path",
|
|
46
46
|
{
|
|
47
47
|
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z",
|
|
48
|
-
fill:
|
|
48
|
+
fill: t
|
|
49
49
|
}
|
|
50
|
-
) }),
|
|
50
|
+
) }), Fe = ie(
|
|
51
51
|
({
|
|
52
|
-
isGTN:
|
|
53
|
-
isChecked:
|
|
52
|
+
isGTN: a = !1,
|
|
53
|
+
isChecked: t,
|
|
54
54
|
id: o,
|
|
55
55
|
onChange: u,
|
|
56
56
|
label: n,
|
|
57
57
|
required: g,
|
|
58
58
|
isRequiredConditional: z = !1,
|
|
59
59
|
hideStatus: R = !1,
|
|
60
|
-
labelDirection: v =
|
|
60
|
+
labelDirection: v = x.TOP,
|
|
61
61
|
statusText: k,
|
|
62
62
|
withIcon: S = !1,
|
|
63
63
|
tags: j,
|
|
@@ -71,7 +71,7 @@ const we = (t, r, o, u = "medium") => {
|
|
|
71
71
|
className: V = "",
|
|
72
72
|
disabled: W,
|
|
73
73
|
isDisabled: Y = !1,
|
|
74
|
-
icon:
|
|
74
|
+
icon: h,
|
|
75
75
|
stopClickPropagation: G = !0,
|
|
76
76
|
gtnName: J,
|
|
77
77
|
variant: Ie = "primary",
|
|
@@ -85,20 +85,20 @@ const we = (t, r, o, u = "medium") => {
|
|
|
85
85
|
size: i = "medium",
|
|
86
86
|
renderGTNAddButton: B,
|
|
87
87
|
onAddGTNToDocument: D,
|
|
88
|
-
inputEmphasis:
|
|
88
|
+
inputEmphasis: C = "default"
|
|
89
89
|
}, U) => {
|
|
90
|
-
const { t: X } = de(), Z =
|
|
90
|
+
const { t: X } = de(), Z = C === "modified", ee = C === "deleted", re = C === "success", F = W ?? Y, b = !!F, E = typeof F == "string" ? F : void 0, ae = v === x.TOP, te = v === x.LEFT, A = v === x.RIGHT, [I, P] = oe(!1), M = () => {
|
|
91
91
|
D && D({
|
|
92
92
|
key: J,
|
|
93
|
-
value:
|
|
93
|
+
value: t ? "Yes" : "No"
|
|
94
94
|
});
|
|
95
95
|
}, le = () => m === "error" ? "text-red-500 dark:text-red-400" : m === "success" ? "text-green-500 dark:text-green-400" : m === "info" ? "text-primary-500 dark:text-primary-400" : "text-neutral-500 dark:text-neutral-400";
|
|
96
96
|
return /* @__PURE__ */ l(
|
|
97
97
|
"div",
|
|
98
98
|
{
|
|
99
|
-
className:
|
|
99
|
+
className: r(
|
|
100
100
|
"flex gap-0.5",
|
|
101
|
-
I &&
|
|
101
|
+
I && a ? "border rounded-lg border-primary-100 bg-primary-50 p-1" : "",
|
|
102
102
|
Q
|
|
103
103
|
),
|
|
104
104
|
onMouseEnter: () => P(!0),
|
|
@@ -107,8 +107,8 @@ const we = (t, r, o, u = "medium") => {
|
|
|
107
107
|
G && s.stopPropagation();
|
|
108
108
|
},
|
|
109
109
|
children: [
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */ l("div", { className:
|
|
110
|
+
a && !I ? /* @__PURE__ */ e("div", { className: "w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5" }) : null,
|
|
111
|
+
/* @__PURE__ */ l("div", { className: r(
|
|
112
112
|
"w-full flex flex-col",
|
|
113
113
|
Z && "rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5",
|
|
114
114
|
ee && "rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5",
|
|
@@ -118,16 +118,16 @@ const we = (t, r, o, u = "medium") => {
|
|
|
118
118
|
/* @__PURE__ */ l(
|
|
119
119
|
"h1",
|
|
120
120
|
{
|
|
121
|
-
className:
|
|
121
|
+
className: r(
|
|
122
122
|
"mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap",
|
|
123
123
|
N
|
|
124
124
|
),
|
|
125
125
|
children: [
|
|
126
|
-
/* @__PURE__ */ e(
|
|
126
|
+
/* @__PURE__ */ e(be, { label: n || "", required: g || !1, isRequiredConditional: z || !1 }),
|
|
127
127
|
K && /* @__PURE__ */ e(me, { sx: { fontSize: 16, color: "var(--color-primary-600)", rotate: "15deg" } }),
|
|
128
128
|
H && !O(y) && /* @__PURE__ */ e(pe, {}),
|
|
129
129
|
/* @__PURE__ */ e(ge, { labels: j || [] }),
|
|
130
|
-
_ && /* @__PURE__ */ e(L, { placement: "top", title: _, children: /* @__PURE__ */ e("div", { className: "cursor-pointer", children: /* @__PURE__ */ e(
|
|
130
|
+
_ && /* @__PURE__ */ e(L, { placement: "top", title: _, children: /* @__PURE__ */ e("div", { className: "cursor-pointer", children: /* @__PURE__ */ e(he, { className: "w-icon-sm h-icon-sm" }) }) }),
|
|
131
131
|
T
|
|
132
132
|
]
|
|
133
133
|
}
|
|
@@ -143,7 +143,7 @@ const we = (t, r, o, u = "medium") => {
|
|
|
143
143
|
children: /* @__PURE__ */ l(
|
|
144
144
|
"div",
|
|
145
145
|
{
|
|
146
|
-
className:
|
|
146
|
+
className: r(
|
|
147
147
|
"inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",
|
|
148
148
|
ye(c)
|
|
149
149
|
),
|
|
@@ -154,10 +154,10 @@ const we = (t, r, o, u = "medium") => {
|
|
|
154
154
|
{
|
|
155
155
|
size: 12,
|
|
156
156
|
fill: ve(c),
|
|
157
|
-
fillSecondary:
|
|
157
|
+
fillSecondary: xe(c)
|
|
158
158
|
}
|
|
159
159
|
),
|
|
160
|
-
/* @__PURE__ */ l("span", { className:
|
|
160
|
+
/* @__PURE__ */ l("span", { className: r("text-xs font-medium leading-4", ke(c)), children: [
|
|
161
161
|
y,
|
|
162
162
|
"%"
|
|
163
163
|
] })
|
|
@@ -166,7 +166,7 @@ const we = (t, r, o, u = "medium") => {
|
|
|
166
166
|
)
|
|
167
167
|
}
|
|
168
168
|
) : null,
|
|
169
|
-
|
|
169
|
+
a && I ? B ? B(M) : /* @__PURE__ */ e(
|
|
170
170
|
"button",
|
|
171
171
|
{
|
|
172
172
|
id: "btn-toggle-add-to-document",
|
|
@@ -194,7 +194,7 @@ const we = (t, r, o, u = "medium") => {
|
|
|
194
194
|
{
|
|
195
195
|
size: "small",
|
|
196
196
|
variant: "medium",
|
|
197
|
-
className:
|
|
197
|
+
className: r("mr-2 text-neutral-700 dark:text-black-200", N),
|
|
198
198
|
appearance: "custom",
|
|
199
199
|
children: n
|
|
200
200
|
}
|
|
@@ -202,10 +202,10 @@ const we = (t, r, o, u = "medium") => {
|
|
|
202
202
|
/* @__PURE__ */ l(
|
|
203
203
|
"label",
|
|
204
204
|
{
|
|
205
|
-
className:
|
|
205
|
+
className: r(
|
|
206
206
|
"relative inline-flex items-center",
|
|
207
207
|
A || k ? "" : "w-min",
|
|
208
|
-
|
|
208
|
+
b ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
209
209
|
),
|
|
210
210
|
onClick: (s) => s.stopPropagation(),
|
|
211
211
|
children: [
|
|
@@ -215,29 +215,35 @@ const we = (t, r, o, u = "medium") => {
|
|
|
215
215
|
ref: U,
|
|
216
216
|
type: "checkbox",
|
|
217
217
|
id: o,
|
|
218
|
-
onChange: (s) => !
|
|
218
|
+
onChange: (s) => !b && u(s.target.checked),
|
|
219
219
|
value: "",
|
|
220
|
-
disabled:
|
|
221
|
-
checked:
|
|
222
|
-
className:
|
|
220
|
+
disabled: b,
|
|
221
|
+
checked: t,
|
|
222
|
+
className: r("sr-only peer w-full", V),
|
|
223
223
|
"aria-required": g,
|
|
224
224
|
"aria-invalid": d && m === "error" ? "true" : "false",
|
|
225
225
|
"aria-describedby": d || f ? `${o}-description` : void 0
|
|
226
226
|
}
|
|
227
227
|
),
|
|
228
|
-
/* @__PURE__ */ e("div", { className: we(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
228
|
+
/* @__PURE__ */ e("div", { className: we(t, S, b, i), children: S ? (
|
|
229
|
+
// Overlay the icon on the sliding knob using the knob's exact
|
|
230
|
+
// geometry (same top/left, same size, same full-width slide) so
|
|
231
|
+
// it stays perfectly centered in the circle for every size/state.
|
|
232
|
+
/* @__PURE__ */ e(
|
|
233
|
+
"div",
|
|
234
|
+
{
|
|
235
|
+
className: r(
|
|
236
|
+
"pointer-events-none absolute top-0.5 left-0.5 z-10 flex items-center justify-center transition-transform",
|
|
237
|
+
i === "small" && "h-3 w-3",
|
|
238
|
+
i === "medium" && "h-[1.125rem] w-[1.125rem]",
|
|
239
|
+
i === "large" && "h-5 w-5",
|
|
240
|
+
t && "translate-x-full"
|
|
241
|
+
),
|
|
242
|
+
children: t ? h?.checkedIcon ? h.checkedIcon : /* @__PURE__ */ e(Ne, { size: 18, fill: "#016DCF" }) : h?.uncheckedIcon ? h.uncheckedIcon : /* @__PURE__ */ e(Ce, { size: 18, fill: "#101828" })
|
|
243
|
+
}
|
|
244
|
+
)
|
|
245
|
+
) : null }),
|
|
246
|
+
E && /* @__PURE__ */ e(L, { placement: "top", title: E, className: "-ml-2", children: /* @__PURE__ */ e("span", { className: r(
|
|
241
247
|
"absolute inset-y-0 left-0",
|
|
242
248
|
i === "small" && "w-7",
|
|
243
249
|
i === "medium" && "w-9",
|
|
@@ -248,7 +254,7 @@ const we = (t, r, o, u = "medium") => {
|
|
|
248
254
|
{
|
|
249
255
|
size: "small",
|
|
250
256
|
variant: "medium",
|
|
251
|
-
className:
|
|
257
|
+
className: r("ml-2 text-neutral-700 dark:text-black-300", N),
|
|
252
258
|
appearance: "custom",
|
|
253
259
|
children: n
|
|
254
260
|
}
|
|
@@ -260,7 +266,7 @@ const we = (t, r, o, u = "medium") => {
|
|
|
260
266
|
variant: "medium",
|
|
261
267
|
className: "ml-2 text-neutral-900 dark:text-black-100",
|
|
262
268
|
appearance: "custom",
|
|
263
|
-
children: k || (
|
|
269
|
+
children: k || (t ? "Yes" : "No")
|
|
264
270
|
}
|
|
265
271
|
)
|
|
266
272
|
]
|
|
@@ -279,7 +285,7 @@ const we = (t, r, o, u = "medium") => {
|
|
|
279
285
|
children: /* @__PURE__ */ e(
|
|
280
286
|
p,
|
|
281
287
|
{
|
|
282
|
-
className:
|
|
288
|
+
className: r("mt-1", le()),
|
|
283
289
|
appearance: "custom",
|
|
284
290
|
size: "extra-small",
|
|
285
291
|
variant: "medium",
|
|
@@ -295,8 +301,8 @@ const we = (t, r, o, u = "medium") => {
|
|
|
295
301
|
);
|
|
296
302
|
}
|
|
297
303
|
);
|
|
298
|
-
|
|
304
|
+
Fe.displayName = "Toggle";
|
|
299
305
|
export {
|
|
300
|
-
|
|
306
|
+
Fe as Toggle
|
|
301
307
|
};
|
|
302
308
|
//# sourceMappingURL=Toggle.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.es.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5\",\n medium: \"w-9 h-5 after:h-4 after:w-4 after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500':\n isChecked,\n 'after:bg-white dark:after:bg-black-500': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement='top-end'\n title={confidenceTooltip ?? ''}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className='cursor-pointer'\n >\n <div\n className={cn(\n 'inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5',\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn('text-xs font-medium leading-4', getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div\n className={cn(\n \"z-10 transition-all transform\",\n size === \"small\" &&\n (isChecked\n ? \"translate-x-2\"\n : \"translate-x-[-6px]\"),\n size === \"medium\" &&\n (isChecked\n ? \"translate-x-[8.5px]\"\n : \"translate-x-[-8px]\"),\n size === \"large\" &&\n (isChecked\n ? \"translate-x-2.5\"\n : \"translate-x-[-10px]\")\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],"mappings":";;;;;;;;;;;;;;;;AA+IA,MAAMA,KAAsB,CAC1BC,GACAC,GACAC,GACAC,IAAqC,aAC1B;AACX,QAAMC,IAAc;AAAA,IAClB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA,GAGHC,IAAmB;AAAA,IACvB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA;AAGT,SAAOC;AAAA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gB,UAAU,UAAU;AAAA,gBAE1C,UAAA,gBAAA/B;AAAA,kBAACuE;AAAA,kBAAA;AAAA,oBACC,WAAW1E,EAAG,QAAQyD,IAA2B;AAAA,oBACjD,YAAW;AAAA,oBACX,MAAK;AAAA,oBACL,SAAQ;AAAA,oBAEP,UAAAxB;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACH;AAAA,YAAA,GAGN;AAAA,YAGCG,KAAY,CAACH,KACZ,gBAAA9B,EAAC,OAAA,EAAI,IAAI,GAAGK,CAAE,gBAAgB,WAAU,WACrC,UAAA4B,EAAA,CACH;AAAA,UAAA,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA/B,GAAO,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Toggle.es.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5\",\n medium: \"w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500':\n isChecked,\n 'after:bg-white dark:after:bg-black-500': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement='top-end'\n title={confidenceTooltip ?? ''}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className='cursor-pointer'\n >\n <div\n className={cn(\n 'inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5',\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn('text-xs font-medium leading-4', getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n // Overlay the icon on the sliding knob using the knob's exact\n // geometry (same top/left, same size, same full-width slide) so\n // it stays perfectly centered in the circle for every size/state.\n <div\n className={cn(\n \"pointer-events-none absolute top-0.5 left-0.5 z-10 flex items-center justify-center transition-transform\",\n size === \"small\" && \"h-3 w-3\",\n size === \"medium\" && \"h-[1.125rem] w-[1.125rem]\",\n size === \"large\" && \"h-5 w-5\",\n isChecked && \"translate-x-full\"\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],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AAP;AAAA,gBACC,SAAS,EAAE,SAAS,GAAG,GAAG,IAAA;AAAA,gBAC1B,SAAS,EAAE,SAAS,GAAG,GAAG,EAAA;AAAA,gBAC1B,MAAM,EAAE,SAAS,GAAG,GAAG,IAAA;AAAA,gBACvB,YAAY,EAAE,UAAU,IAAA;AAAA,gBACxB,IAAI,GAAGpE,CAAE;AAAA,gBACT,MAAM0B,MAAgB,UAAU,UAAU;AAAA,gBAE1C,UAAA,gBAAA/B;AAAA,kBAACuE;AAAA,kBAAA;AAAA,oBACC,WAAW1E,EAAG,QAAQyD,IAA2B;AAAA,oBACjD,YAAW;AAAA,oBACX,MAAK;AAAA,oBACL,SAAQ;AAAA,oBAEP,UAAAxB;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACH;AAAA,YAAA,GAGN;AAAA,YAGCG,KAAY,CAACH,KACZ,gBAAA9B,EAAC,OAAA,EAAI,IAAI,GAAGK,CAAE,gBAAgB,WAAU,WACrC,UAAA4B,EAAA,CACH;AAAA,UAAA,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA/B,GAAO,cAAc;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("@mui/icons-material"),s=require("../../../_virtual/index.cjs.js"),T=require("framer-motion");require("react");const h=require("../../data-display/typography/Typography.cjs.js"),E=require("../../button/IconButton.cjs.js"),M=require("../../button/Radio.cjs.js"),j=require("../../icon/icons.generated.cjs.js"),p=({children:n,title:f,toggle:N,isOpen:t,hoveringIndex:v,index:y,viewOnly:i,onTitleClick:l,isChecked:b,onSelect:o,subTitle:g,noSpace:c,isDraggable:d,sortableConfig:a,headerClass:q,icon:k,additionalHeader:w,mainClass:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("@mui/icons-material"),s=require("../../../_virtual/index.cjs.js"),T=require("framer-motion");require("react");const h=require("../../data-display/typography/Typography.cjs.js"),E=require("../../button/IconButton.cjs.js"),M=require("../../button/Radio.cjs.js"),j=require("../../icon/icons.generated.cjs.js"),p=({children:n,title:f,toggle:N,isOpen:t,hoveringIndex:v,index:y,viewOnly:i,onTitleClick:l,isChecked:b,onSelect:o,subTitle:g,noSpace:c,isDraggable:d,sortableConfig:a,headerClass:q,icon:k,additionalHeader:w,mainClass:I,id:z,childrenClass:$,withAnimation:u=!1,...m})=>{const x=s(!c&&"p-4",$);return e.jsxs("div",{id:z,className:`${!c&&"mb-4"} ${t?"pb-1":""} ${I||""}`,style:a?.style,...m,children:[e.jsxs("div",{className:s("flex items-center justify-between cursor-pointer border border-neutral-200 dark:border-none bg-neutral-100 dark:bg-black-600 px-3 py-1 rounded-lg",q),onClick:N,...m,children:[e.jsxs("div",{onClick:r=>l?l(r):null,className:`${d&&"flex"} w-full`,children:[d&&!i&&e.jsx("button",{id:"btn-accordion-outline-drag-indicator",className:"flex items-center justify-center w-icon h-icon hover:transform hover:scale-125 transition-all duration-200 ease-in-out",...a?.attributes,...a?.listeners,children:e.jsx(j.DragIndicatorIcon,{size:16,className:"text-neutral-400 dark:text-neutral-400"})}),e.jsxs("div",{className:"flex items-center gap-1 w-full",children:[o&&e.jsx(M,{isChecked:b,onSelect:r=>{r.stopPropagation(),o()},className:"h-4 w-4 accent-[#366FE3]"}),e.jsxs("div",{className:"flex gap-2 items-center",children:[k,e.jsx(h.Typography,{size:"small",appearance:"body",variant:"medium",className:"whitespace-nowrap",children:f})]}),e.jsx(h.Typography,{size:"extra-small",appearance:"title",variant:"medium",className:"ml-1",children:g}),w,e.jsx("span",{children:v===y&&!i&&e.jsx(E,{variant:"ghost",children:e.jsx(j.EditIcon,{className:"ml-2 h-4 w-4 text-neutral-400 dark:text-neutral-400"})})})]})]}),e.jsx(A.ChevronLeft,{sx:{fontSize:18},className:s("text-neutral-600 dark:text-neutral-400",t?"rotate-90":"-rotate-90",u&&"transition-transform duration-300 ease-in-out")})]}),u?e.jsx(T.motion.div,{initial:!1,animate:{height:t?"auto":0},transition:{duration:.3,ease:[.4,0,.2,1]},style:{overflow:"hidden"},children:e.jsx("div",{className:x,children:n})}):t?e.jsx("div",{className:x,children:n}):null]})};p.displayName="Accordion";exports.Accordion=p;
|
|
2
2
|
//# sourceMappingURL=Accordion.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.cjs.js","sources":["../../../../src/components/navigation/accordion/Accordion.tsx"],"sourcesContent":["import { ChevronLeft } from '@mui/icons-material';\nimport cn from 'classnames';\nimport { motion } from 'framer-motion';\nimport { type FC, type HTMLAttributes } from 'react';\n\nimport { Typography } from '../../data-display/typography/Typography';\nimport IconButton from '../../button/IconButton';\nimport Radio from '../../button/Radio';\nimport { DragIndicatorIcon, EditIcon } from '../../icon';\n\nexport type AccordionProps = HTMLAttributes<HTMLDivElement> & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n title: any;\n toggle: () => void;\n isOpen: boolean;\n hoveringIndex?: number | null;\n index?: number;\n viewOnly?: boolean;\n onTitleClick?: (e: React.MouseEvent) => void;\n onSelect?: () => void;\n isChecked?: boolean;\n subTitle?: string;\n noSpace?: boolean;\n isDraggable?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n sortableConfig?: Record<string, any>;\n headerClass?: string;\n icon?: JSX.Element;\n additionalHeader?: JSX.Element;\n id: string;\n isEditMode?: boolean;\n mainClass?: string;\n childrenClass?: string;\n /** When true, expands and collapses the panel with a smooth height animation. Default false. */\n withAnimation?: boolean;\n};\n\n/**\n * Accordion component for collapsible content sections\n *\n * @example\n * ```tsx\n * <Accordion\n * id=\"my-accordion\"\n * title=\"Section Title\"\n * isOpen={isOpen}\n * toggle={() => setIsOpen(!isOpen)}\n * >\n * <div>Accordion content</div>\n * </Accordion>\n * ```\n */\nexport const Accordion: FC<AccordionProps> = ({\n children,\n title,\n toggle,\n isOpen,\n hoveringIndex,\n index,\n viewOnly,\n onTitleClick,\n isChecked,\n onSelect,\n subTitle,\n noSpace,\n isDraggable,\n sortableConfig,\n headerClass,\n icon,\n additionalHeader,\n mainClass,\n id,\n childrenClass,\n withAnimation = false,\n ...props\n}) => {\n const contentClassName = cn(!noSpace && 'p-4', childrenClass);\n\n return (\n <div id={id} className={`${!noSpace && 'mb-4'} ${isOpen ? 'pb-1' : ''} ${mainClass || ''}`} style={sortableConfig?.style} {...props}>\n <div\n className={cn(\n 'flex items-center justify-between cursor-pointer border border-neutral-200 dark:border-none bg-neutral-100 dark:bg-black-600 px-3 py-1 rounded-lg',\n headerClass,\n )}\n onClick={toggle}\n {...props}\n >\n <div onClick={(e) => (onTitleClick ? onTitleClick(e) : null)} className={`${isDraggable && 'flex'} w-full`}>\n {isDraggable && !viewOnly && (\n <button\n id={`btn-accordion-outline-drag-indicator`}\n className='flex items-center justify-center w-icon h-icon hover:transform hover:scale-125 transition-all duration-200 ease-in-out'\n {...sortableConfig?.attributes}\n {...sortableConfig?.listeners}\n >\n <DragIndicatorIcon size={16} className='text-neutral-400 dark:text-neutral-400' />\n </button>\n )}\n\n <div className={`flex items-center gap-1 w-full`}>\n {onSelect && (\n <Radio\n isChecked={isChecked}\n onSelect={(e) => {\n e.stopPropagation();\n onSelect();\n }}\n className='h-4 w-4 accent-[#366FE3]'\n />\n )}\n <div className='flex gap-2 items-center'>\n {icon}\n\n <Typography size='small' appearance='body' variant='medium' className='whitespace-nowrap'>\n {title}\n </Typography>\n </div>\n <Typography size='extra-small' appearance='title' variant='medium' className={`ml-1`}>\n {subTitle}\n </Typography>\n {additionalHeader}\n <span>\n {hoveringIndex === index && !viewOnly && (\n <IconButton variant='ghost'>\n <EditIcon
|
|
1
|
+
{"version":3,"file":"Accordion.cjs.js","sources":["../../../../src/components/navigation/accordion/Accordion.tsx"],"sourcesContent":["import { ChevronLeft } from '@mui/icons-material';\nimport cn from 'classnames';\nimport { motion } from 'framer-motion';\nimport { type FC, type HTMLAttributes } from 'react';\n\nimport { Typography } from '../../data-display/typography/Typography';\nimport IconButton from '../../button/IconButton';\nimport Radio from '../../button/Radio';\nimport { DragIndicatorIcon, EditIcon } from '../../icon';\n\nexport type AccordionProps = HTMLAttributes<HTMLDivElement> & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n title: any;\n toggle: () => void;\n isOpen: boolean;\n hoveringIndex?: number | null;\n index?: number;\n viewOnly?: boolean;\n onTitleClick?: (e: React.MouseEvent) => void;\n onSelect?: () => void;\n isChecked?: boolean;\n subTitle?: string;\n noSpace?: boolean;\n isDraggable?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n sortableConfig?: Record<string, any>;\n headerClass?: string;\n icon?: JSX.Element;\n additionalHeader?: JSX.Element;\n id: string;\n isEditMode?: boolean;\n mainClass?: string;\n childrenClass?: string;\n /** When true, expands and collapses the panel with a smooth height animation. Default false. */\n withAnimation?: boolean;\n};\n\n/**\n * Accordion component for collapsible content sections\n *\n * @example\n * ```tsx\n * <Accordion\n * id=\"my-accordion\"\n * title=\"Section Title\"\n * isOpen={isOpen}\n * toggle={() => setIsOpen(!isOpen)}\n * >\n * <div>Accordion content</div>\n * </Accordion>\n * ```\n */\nexport const Accordion: FC<AccordionProps> = ({\n children,\n title,\n toggle,\n isOpen,\n hoveringIndex,\n index,\n viewOnly,\n onTitleClick,\n isChecked,\n onSelect,\n subTitle,\n noSpace,\n isDraggable,\n sortableConfig,\n headerClass,\n icon,\n additionalHeader,\n mainClass,\n id,\n childrenClass,\n withAnimation = false,\n ...props\n}) => {\n const contentClassName = cn(!noSpace && 'p-4', childrenClass);\n\n return (\n <div id={id} className={`${!noSpace && 'mb-4'} ${isOpen ? 'pb-1' : ''} ${mainClass || ''}`} style={sortableConfig?.style} {...props}>\n <div\n className={cn(\n 'flex items-center justify-between cursor-pointer border border-neutral-200 dark:border-none bg-neutral-100 dark:bg-black-600 px-3 py-1 rounded-lg',\n headerClass,\n )}\n onClick={toggle}\n {...props}\n >\n <div onClick={(e) => (onTitleClick ? onTitleClick(e) : null)} className={`${isDraggable && 'flex'} w-full`}>\n {isDraggable && !viewOnly && (\n <button\n id={`btn-accordion-outline-drag-indicator`}\n className='flex items-center justify-center w-icon h-icon hover:transform hover:scale-125 transition-all duration-200 ease-in-out'\n {...sortableConfig?.attributes}\n {...sortableConfig?.listeners}\n >\n <DragIndicatorIcon size={16} className='text-neutral-400 dark:text-neutral-400' />\n </button>\n )}\n\n <div className={`flex items-center gap-1 w-full`}>\n {onSelect && (\n <Radio\n isChecked={isChecked}\n onSelect={(e) => {\n e.stopPropagation();\n onSelect();\n }}\n className='h-4 w-4 accent-[#366FE3]'\n />\n )}\n <div className='flex gap-2 items-center'>\n {icon}\n\n <Typography size='small' appearance='body' variant='medium' className='whitespace-nowrap'>\n {title}\n </Typography>\n </div>\n <Typography size='extra-small' appearance='title' variant='medium' className={`ml-1`}>\n {subTitle}\n </Typography>\n {additionalHeader}\n <span>\n {hoveringIndex === index && !viewOnly && (\n <IconButton variant='ghost'>\n <EditIcon className='ml-2 h-4 w-4 text-neutral-400 dark:text-neutral-400' />\n </IconButton>\n )}\n </span>\n </div>\n </div>\n <ChevronLeft\n sx={{ fontSize: 18 }}\n className={cn(\n 'text-neutral-600 dark:text-neutral-400',\n isOpen ? 'rotate-90' : '-rotate-90',\n withAnimation && 'transition-transform duration-300 ease-in-out',\n )}\n />\n </div>\n {withAnimation ? (\n <motion.div\n initial={false}\n animate={{\n height: isOpen ? 'auto' : 0,\n }}\n transition={{\n duration: 0.3,\n ease: [0.4, 0, 0.2, 1],\n }}\n style={{ overflow: 'hidden' }}\n >\n <div className={contentClassName}>{children}</div>\n </motion.div>\n ) : isOpen ? (\n <div className={contentClassName}>{children}</div>\n ) : null}\n </div>\n );\n};\n\nAccordion.displayName = 'Accordion';\n\n\n\n"],"names":["Accordion","children","title","toggle","isOpen","hoveringIndex","index","viewOnly","onTitleClick","isChecked","onSelect","subTitle","noSpace","isDraggable","sortableConfig","headerClass","icon","additionalHeader","mainClass","id","childrenClass","withAnimation","props","contentClassName","cn","jsxs","e","jsx","DragIndicatorIcon","Radio","Typography","IconButton","EditIcon","ChevronLeft","motion"],"mappings":"mbAoDaA,EAAgC,CAAC,CAC5C,SAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,cAAAC,EAAA,MACAC,EACA,SAAAC,EACA,aAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,QAAAC,EACA,YAAAC,EACA,eAAAC,EACA,YAAAC,EACA,KAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,GAAAC,EACA,cAAAC,EACA,cAAAC,EAAgB,GAChB,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAmBC,EAAG,CAACZ,GAAW,MAAOQ,CAAa,EAE5D,OACEK,EAAAA,KAAC,OAAI,GAAAN,EAAQ,UAAW,GAAG,CAACP,GAAW,MAAM,KAAKR,EAAS,OAAS,EAAE,IAAIc,GAAa,EAAE,GAAI,MAAOJ,GAAgB,MAAQ,GAAGQ,EAC7H,SAAA,CAAAG,EAAAA,KAAC,MAAA,CACC,UAAWD,EACT,oJACAT,CAAA,EAEF,QAASZ,EACR,GAAGmB,EAEJ,SAAA,CAAAG,EAAAA,KAAC,MAAA,CAAI,QAAUC,GAAOlB,EAAeA,EAAakB,CAAC,EAAI,KAAO,UAAW,GAAGb,GAAe,MAAM,UAC9F,SAAA,CAAAA,GAAe,CAACN,GACfoB,EAAAA,IAAC,SAAA,CACC,GAAI,uCACJ,UAAU,yHACT,GAAGb,GAAgB,WACnB,GAAGA,GAAgB,UAEpB,SAAAa,EAAAA,IAACC,oBAAA,CAAkB,KAAM,GAAI,UAAU,wCAAA,CAAyC,CAAA,CAAA,EAIpFH,EAAAA,KAAC,MAAA,CAAI,UAAW,iCACb,SAAA,CAAAf,GACCiB,EAAAA,IAACE,EAAA,CACC,UAAApB,EACA,SAAWiB,GAAM,CACfA,EAAE,gBAAA,EACFh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+
additionalHeader: j,
|
|
28
|
+
mainClass: z,
|
|
29
29
|
id: I,
|
|
30
30
|
childrenClass: $,
|
|
31
31
|
withAnimation: u = !1,
|
|
32
32
|
...p
|
|
33
33
|
}) => {
|
|
34
34
|
const f = i(!m && "p-4", $);
|
|
35
|
-
return /* @__PURE__ */ t("div", { id: I, className: `${!m && "mb-4"} ${a ? "pb-1" : ""} ${
|
|
35
|
+
return /* @__PURE__ */ t("div", { id: I, className: `${!m && "mb-4"} ${a ? "pb-1" : ""} ${z || ""}`, style: r?.style, ...p, children: [
|
|
36
36
|
/* @__PURE__ */ t(
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
@@ -70,8 +70,8 @@ const P = ({
|
|
|
70
70
|
/* @__PURE__ */ e(h, { size: "small", appearance: "body", variant: "medium", className: "whitespace-nowrap", children: x })
|
|
71
71
|
] }),
|
|
72
72
|
/* @__PURE__ */ e(h, { size: "extra-small", appearance: "title", variant: "medium", className: "ml-1", children: g }),
|
|
73
|
-
|
|
74
|
-
/* @__PURE__ */ e("span", { children: v === b && !l && /* @__PURE__ */ e(B, { variant: "ghost", children: /* @__PURE__ */ e(L, {
|
|
73
|
+
j,
|
|
74
|
+
/* @__PURE__ */ e("span", { children: v === b && !l && /* @__PURE__ */ e(B, { variant: "ghost", children: /* @__PURE__ */ e(L, { className: "ml-2 h-4 w-4 text-neutral-400 dark:text-neutral-400" }) }) })
|
|
75
75
|
] })
|
|
76
76
|
] }),
|
|
77
77
|
/* @__PURE__ */ e(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.es.js","sources":["../../../../src/components/navigation/accordion/Accordion.tsx"],"sourcesContent":["import { ChevronLeft } from '@mui/icons-material';\nimport cn from 'classnames';\nimport { motion } from 'framer-motion';\nimport { type FC, type HTMLAttributes } from 'react';\n\nimport { Typography } from '../../data-display/typography/Typography';\nimport IconButton from '../../button/IconButton';\nimport Radio from '../../button/Radio';\nimport { DragIndicatorIcon, EditIcon } from '../../icon';\n\nexport type AccordionProps = HTMLAttributes<HTMLDivElement> & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n title: any;\n toggle: () => void;\n isOpen: boolean;\n hoveringIndex?: number | null;\n index?: number;\n viewOnly?: boolean;\n onTitleClick?: (e: React.MouseEvent) => void;\n onSelect?: () => void;\n isChecked?: boolean;\n subTitle?: string;\n noSpace?: boolean;\n isDraggable?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n sortableConfig?: Record<string, any>;\n headerClass?: string;\n icon?: JSX.Element;\n additionalHeader?: JSX.Element;\n id: string;\n isEditMode?: boolean;\n mainClass?: string;\n childrenClass?: string;\n /** When true, expands and collapses the panel with a smooth height animation. Default false. */\n withAnimation?: boolean;\n};\n\n/**\n * Accordion component for collapsible content sections\n *\n * @example\n * ```tsx\n * <Accordion\n * id=\"my-accordion\"\n * title=\"Section Title\"\n * isOpen={isOpen}\n * toggle={() => setIsOpen(!isOpen)}\n * >\n * <div>Accordion content</div>\n * </Accordion>\n * ```\n */\nexport const Accordion: FC<AccordionProps> = ({\n children,\n title,\n toggle,\n isOpen,\n hoveringIndex,\n index,\n viewOnly,\n onTitleClick,\n isChecked,\n onSelect,\n subTitle,\n noSpace,\n isDraggable,\n sortableConfig,\n headerClass,\n icon,\n additionalHeader,\n mainClass,\n id,\n childrenClass,\n withAnimation = false,\n ...props\n}) => {\n const contentClassName = cn(!noSpace && 'p-4', childrenClass);\n\n return (\n <div id={id} className={`${!noSpace && 'mb-4'} ${isOpen ? 'pb-1' : ''} ${mainClass || ''}`} style={sortableConfig?.style} {...props}>\n <div\n className={cn(\n 'flex items-center justify-between cursor-pointer border border-neutral-200 dark:border-none bg-neutral-100 dark:bg-black-600 px-3 py-1 rounded-lg',\n headerClass,\n )}\n onClick={toggle}\n {...props}\n >\n <div onClick={(e) => (onTitleClick ? onTitleClick(e) : null)} className={`${isDraggable && 'flex'} w-full`}>\n {isDraggable && !viewOnly && (\n <button\n id={`btn-accordion-outline-drag-indicator`}\n className='flex items-center justify-center w-icon h-icon hover:transform hover:scale-125 transition-all duration-200 ease-in-out'\n {...sortableConfig?.attributes}\n {...sortableConfig?.listeners}\n >\n <DragIndicatorIcon size={16} className='text-neutral-400 dark:text-neutral-400' />\n </button>\n )}\n\n <div className={`flex items-center gap-1 w-full`}>\n {onSelect && (\n <Radio\n isChecked={isChecked}\n onSelect={(e) => {\n e.stopPropagation();\n onSelect();\n }}\n className='h-4 w-4 accent-[#366FE3]'\n />\n )}\n <div className='flex gap-2 items-center'>\n {icon}\n\n <Typography size='small' appearance='body' variant='medium' className='whitespace-nowrap'>\n {title}\n </Typography>\n </div>\n <Typography size='extra-small' appearance='title' variant='medium' className={`ml-1`}>\n {subTitle}\n </Typography>\n {additionalHeader}\n <span>\n {hoveringIndex === index && !viewOnly && (\n <IconButton variant='ghost'>\n <EditIcon
|
|
1
|
+
{"version":3,"file":"Accordion.es.js","sources":["../../../../src/components/navigation/accordion/Accordion.tsx"],"sourcesContent":["import { ChevronLeft } from '@mui/icons-material';\nimport cn from 'classnames';\nimport { motion } from 'framer-motion';\nimport { type FC, type HTMLAttributes } from 'react';\n\nimport { Typography } from '../../data-display/typography/Typography';\nimport IconButton from '../../button/IconButton';\nimport Radio from '../../button/Radio';\nimport { DragIndicatorIcon, EditIcon } from '../../icon';\n\nexport type AccordionProps = HTMLAttributes<HTMLDivElement> & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n title: any;\n toggle: () => void;\n isOpen: boolean;\n hoveringIndex?: number | null;\n index?: number;\n viewOnly?: boolean;\n onTitleClick?: (e: React.MouseEvent) => void;\n onSelect?: () => void;\n isChecked?: boolean;\n subTitle?: string;\n noSpace?: boolean;\n isDraggable?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n sortableConfig?: Record<string, any>;\n headerClass?: string;\n icon?: JSX.Element;\n additionalHeader?: JSX.Element;\n id: string;\n isEditMode?: boolean;\n mainClass?: string;\n childrenClass?: string;\n /** When true, expands and collapses the panel with a smooth height animation. Default false. */\n withAnimation?: boolean;\n};\n\n/**\n * Accordion component for collapsible content sections\n *\n * @example\n * ```tsx\n * <Accordion\n * id=\"my-accordion\"\n * title=\"Section Title\"\n * isOpen={isOpen}\n * toggle={() => setIsOpen(!isOpen)}\n * >\n * <div>Accordion content</div>\n * </Accordion>\n * ```\n */\nexport const Accordion: FC<AccordionProps> = ({\n children,\n title,\n toggle,\n isOpen,\n hoveringIndex,\n index,\n viewOnly,\n onTitleClick,\n isChecked,\n onSelect,\n subTitle,\n noSpace,\n isDraggable,\n sortableConfig,\n headerClass,\n icon,\n additionalHeader,\n mainClass,\n id,\n childrenClass,\n withAnimation = false,\n ...props\n}) => {\n const contentClassName = cn(!noSpace && 'p-4', childrenClass);\n\n return (\n <div id={id} className={`${!noSpace && 'mb-4'} ${isOpen ? 'pb-1' : ''} ${mainClass || ''}`} style={sortableConfig?.style} {...props}>\n <div\n className={cn(\n 'flex items-center justify-between cursor-pointer border border-neutral-200 dark:border-none bg-neutral-100 dark:bg-black-600 px-3 py-1 rounded-lg',\n headerClass,\n )}\n onClick={toggle}\n {...props}\n >\n <div onClick={(e) => (onTitleClick ? onTitleClick(e) : null)} className={`${isDraggable && 'flex'} w-full`}>\n {isDraggable && !viewOnly && (\n <button\n id={`btn-accordion-outline-drag-indicator`}\n className='flex items-center justify-center w-icon h-icon hover:transform hover:scale-125 transition-all duration-200 ease-in-out'\n {...sortableConfig?.attributes}\n {...sortableConfig?.listeners}\n >\n <DragIndicatorIcon size={16} className='text-neutral-400 dark:text-neutral-400' />\n </button>\n )}\n\n <div className={`flex items-center gap-1 w-full`}>\n {onSelect && (\n <Radio\n isChecked={isChecked}\n onSelect={(e) => {\n e.stopPropagation();\n onSelect();\n }}\n className='h-4 w-4 accent-[#366FE3]'\n />\n )}\n <div className='flex gap-2 items-center'>\n {icon}\n\n <Typography size='small' appearance='body' variant='medium' className='whitespace-nowrap'>\n {title}\n </Typography>\n </div>\n <Typography size='extra-small' appearance='title' variant='medium' className={`ml-1`}>\n {subTitle}\n </Typography>\n {additionalHeader}\n <span>\n {hoveringIndex === index && !viewOnly && (\n <IconButton variant='ghost'>\n <EditIcon className='ml-2 h-4 w-4 text-neutral-400 dark:text-neutral-400' />\n </IconButton>\n )}\n </span>\n </div>\n </div>\n <ChevronLeft\n sx={{ fontSize: 18 }}\n className={cn(\n 'text-neutral-600 dark:text-neutral-400',\n isOpen ? 'rotate-90' : '-rotate-90',\n withAnimation && 'transition-transform duration-300 ease-in-out',\n )}\n />\n </div>\n {withAnimation ? (\n <motion.div\n initial={false}\n animate={{\n height: isOpen ? 'auto' : 0,\n }}\n transition={{\n duration: 0.3,\n ease: [0.4, 0, 0.2, 1],\n }}\n style={{ overflow: 'hidden' }}\n >\n <div className={contentClassName}>{children}</div>\n </motion.div>\n ) : isOpen ? (\n <div className={contentClassName}>{children}</div>\n ) : null}\n </div>\n );\n};\n\nAccordion.displayName = 'Accordion';\n\n\n\n"],"names":["Accordion","children","title","toggle","isOpen","hoveringIndex","index","viewOnly","onTitleClick","isChecked","onSelect","subTitle","noSpace","isDraggable","sortableConfig","headerClass","icon","additionalHeader","mainClass","id","childrenClass","withAnimation","props","contentClassName","cn","jsxs","e","jsx","DragIndicatorIcon","Radio","Typography","IconButton","EditIcon","ChevronLeft","motion"],"mappings":";;;;;;;;;AAoDO,MAAMA,IAAgC,CAAC;AAAA,EAC5C,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eA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