@alixpartners/ui-components 2.5.3 → 2.5.6

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.
Files changed (63) hide show
  1. package/README.md +97 -97
  2. package/dist/CorusHeader.module-xOp6ZX_M.js +35 -0
  3. package/dist/RichTextEditor-cvtLFe4t.js +443 -0
  4. package/dist/ap-logos-2dYMA1l5.js +4 -0
  5. package/dist/assets/CorusHeader.css +1 -0
  6. package/dist/assets/Input.css +1 -1
  7. package/dist/assets/RichTextEditor.css +1 -1
  8. package/dist/assets/SplitButton.css +1 -1
  9. package/dist/assets/ap-icons-types.d.ts +1 -1
  10. package/dist/assets/ap-icons.d.ts +1 -1
  11. package/dist/assets/ap-logos-types.d.ts +1 -1
  12. package/dist/assets/ap-logos.d.ts +1 -1
  13. package/dist/assets/main.css +1 -1
  14. package/dist/components/Checkbox/Checkbox.js +3 -3
  15. package/dist/components/CorusHeader/CorusHeader.d.ts +3 -0
  16. package/dist/components/CorusHeader/CorusHeader.js +66 -0
  17. package/dist/components/CorusHeader/CorusHeader.types.d.ts +58 -0
  18. package/dist/components/CorusHeader/DropdownItemContent.d.ts +6 -0
  19. package/dist/components/CorusHeader/DropdownItemContent.js +17 -0
  20. package/dist/components/CorusHeader/DropdownMenu.d.ts +6 -0
  21. package/dist/components/CorusHeader/DropdownMenu.js +26 -0
  22. package/dist/components/CorusHeader/MegaMenuContent.d.ts +6 -0
  23. package/dist/components/CorusHeader/MegaMenuContent.js +29 -0
  24. package/dist/components/CorusHeader/UserProfileIcon.d.ts +3 -0
  25. package/dist/components/CorusHeader/UserProfileIcon.js +9 -0
  26. package/dist/components/Creatable/Creatable.js +1 -1
  27. package/dist/components/Datepicker/Datepicker.js +1 -1
  28. package/dist/components/Dialog/Dialog.js +5 -5
  29. package/dist/components/Dropdown/Dropdown.js +1 -1
  30. package/dist/components/Icons/IconsGallery.js +1 -1
  31. package/dist/components/Logo/Logo.d.ts +1 -1
  32. package/dist/components/Logo/Logo.js +12 -6
  33. package/dist/components/Logos/LogosGallery.js +1 -1
  34. package/dist/components/NavBar/NavBar.js +50 -352
  35. package/dist/components/Radio/Radio.js +1 -1
  36. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  37. package/dist/components/RichTextEditor/RichTextEditor.d.ts +3 -3
  38. package/dist/components/RichTextEditor/RichTextEditor.js +2 -2
  39. package/dist/components/RichTextEditor/RichTextEditor.model.d.ts +1 -1
  40. package/dist/components/RichTextEditor/RichTextEditor.test.js +76 -59
  41. package/dist/components/SplitButton/SplitButton.js +3 -3
  42. package/dist/components/TagsFields/TagsFields.js +1 -1
  43. package/dist/components/Toggle/Toggle.js +2 -2
  44. package/dist/components/Tooltip/Tooltip.js +50 -50
  45. package/dist/{index-7CBv-Jx6.js → index-C2s_VtSb.js} +3 -3
  46. package/dist/{index-DEphED6n.js → index-C8H9A55g.js} +2 -2
  47. package/dist/{index-DZ4Gof57.js → index-CCFDXH-J.js} +6 -6
  48. package/dist/{index-CpsmI33B.js → index-CCnm5-ML.js} +4 -4
  49. package/dist/{index-Chv2KjIL.js → index-CFqDEbIR.js} +2 -2
  50. package/dist/{index-BymOxiM6.js → index-CfIcUHKK.js} +1 -1
  51. package/dist/{index-D34Qo5Qx.js → index-ChQc_Cm6.js} +3 -3
  52. package/dist/{index-DrR82jOT.js → index-CmGGeUr0.js} +2 -2
  53. package/dist/index-D_L0ncPJ.js +312 -0
  54. package/dist/{index-DgdVwltD.js → index-Ii4UOx3H.js} +7 -7
  55. package/dist/index-Nyh2Wa71.js +27 -0
  56. package/dist/{index-DM51yNMI.js → index-z_kiwVc3.js} +5 -5
  57. package/dist/main.d.ts +1 -0
  58. package/dist/main.js +24 -22
  59. package/dist/web.config +8 -8
  60. package/package.json +94 -88
  61. package/dist/RichTextEditor-CfINW9Xs.js +0 -412
  62. package/dist/ap-logos-CwA4O8B7.js +0 -4
  63. package/dist/index-CxAtPSMM.js +0 -27
package/package.json CHANGED
@@ -1,88 +1,94 @@
1
- {
2
- "name": "@alixpartners/ui-components",
3
- "version": "2.5.3",
4
- "type": "module",
5
- "files": [
6
- "dist"
7
- ],
8
- "exports": "./dist/main.js",
9
- "module": "./dist/main.js",
10
- "types": "./dist/main.d.ts",
11
- "license": "SEE LICENSE IN LICENSE.md",
12
- "repository": "https://alixpartners-dev.visualstudio.com/_git/AP.UIComponents",
13
- "main": "./dist/umd/index.js",
14
- "scripts": {
15
- "build": "npm run generate-illustrations && tsc -b && vite build",
16
- "lint": "eslint . --ext ts,tsx",
17
- "lint:fix": "eslint . --ext ts,tsx --fix",
18
- "format": "prettier --check .",
19
- "format:fix": "prettier --write .",
20
- "stylelint": "stylelint **/*.css",
21
- "stylelint:fix": "stylelint **/*.css --fix",
22
- "storybook": "storybook dev -p 6006",
23
- "build-storybook": "storybook build",
24
- "test": "vitest",
25
- "test:unit": "vitest --project unit",
26
- "test:storybook": "vitest --project storybook",
27
- "test:ui": "vitest --ui",
28
- "coverage": "vitest run --coverage",
29
- "generate-icons": "node ./src/assets/generateIconsHelperFiles.js",
30
- "generate-illustrations": "node ./src/assets/generateIllustrationsHelperFiles.js"
31
- },
32
- "dependencies": {
33
- "clsx": "^2.1.1"
34
- },
35
- "peerDependencies": {
36
- "react": "^18.3.1",
37
- "react-dom": "^18.3.1",
38
- "radix-ui": "^1.4.2",
39
- "notistack": "^3.0.1"
40
- },
41
- "devDependencies": {
42
- "@chromatic-com/storybook": "^4.0.1",
43
- "@eslint/js": "^9.25.0",
44
- "@storybook/addon-designs": "^10.0.2",
45
- "@storybook/addon-onboarding": "^9.0.18",
46
- "@storybook/react-vite": "^9.0.18",
47
- "@testing-library/react": "^16.3.0",
48
- "@types/node": "^22.15.21",
49
- "@types/react": "^19.1.2",
50
- "@types/react-dom": "^19.1.2",
51
- "@vitejs/plugin-react": "^4.4.1",
52
- "@vitest/browser": "^3.1.4",
53
- "@vitest/coverage-v8": "^3.1.4",
54
- "@vitest/ui": "^3.1.4",
55
- "babel-plugin-react-remove-properties": "^0.3.0",
56
- "eslint": "^9.25.0",
57
- "eslint-config-prettier": "^10.1.5",
58
- "eslint-plugin-react-hooks": "^5.2.0",
59
- "eslint-plugin-react-refresh": "^0.4.19",
60
- "eslint-plugin-storybook": "^9.0.18",
61
- "globals": "^16.0.0",
62
- "happy-dom": "^15.11.6",
63
- "jsdom": "^26.1.0",
64
- "notistack": "^3.0.1",
65
- "playwright": "^1.52.0",
66
- "postcss-scss": "^4.0.9",
67
- "prettier": "^3.5.3",
68
- "sass": "^1.89.0",
69
- "storybook": "^9.0.18",
70
- "stylelint": "^16.19.1",
71
- "stylelint-config-standard": "^38.0.0",
72
- "stylelint-scss": "^6.12.0",
73
- "typescript": "~5.8.3",
74
- "typescript-eslint": "^8.30.1",
75
- "vite": "^6.3.5",
76
- "vite-plugin-dts": "^4.5.4",
77
- "vite-plugin-lib-inject-css": "^2.2.2",
78
- "vitest": "^3.1.4",
79
- "@storybook/addon-vitest": "9.0.18",
80
- "@storybook/addon-docs": "^9.0.18",
81
- "glob": "^11.0.2"
82
- },
83
- "eslintConfig": {
84
- "extends": [
85
- "plugin:storybook/recommended"
86
- ]
87
- }
88
- }
1
+ {
2
+ "name": "@alixpartners/ui-components",
3
+ "version": "2.5.6",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "exports": "./dist/main.js",
9
+ "module": "./dist/main.js",
10
+ "types": "./dist/main.d.ts",
11
+ "license": "SEE LICENSE IN LICENSE.md",
12
+ "repository": "https://alixpartners-dev.visualstudio.com/_git/AP.UIComponents",
13
+ "main": "./dist/umd/index.js",
14
+ "scripts": {
15
+ "build": "npm run generate-illustrations && tsc -b && vite build",
16
+ "lint": "eslint . --ext ts,tsx",
17
+ "lint:fix": "eslint . --ext ts,tsx --fix",
18
+ "format": "prettier --check .",
19
+ "format:fix": "prettier --write .",
20
+ "stylelint": "stylelint **/*.css",
21
+ "stylelint:fix": "stylelint **/*.css --fix",
22
+ "storybook": "storybook dev -p 6006",
23
+ "build-storybook": "storybook build",
24
+ "test": "vitest",
25
+ "test:unit": "vitest --project unit",
26
+ "test:storybook": "vitest --project storybook",
27
+ "test:ui": "vitest --ui",
28
+ "test:playwright": "playwright test",
29
+ "test:playwright:chromium": "playwright test --project=chromium",
30
+ "test:playwright:firefox": "playwright test --project=firefox",
31
+ "test:playwright:webkit": "playwright test --project=webkit",
32
+ "coverage": "vitest run --coverage",
33
+ "generate-icons": "node ./src/assets/generateIconsHelperFiles.js",
34
+ "generate-illustrations": "node ./src/assets/generateIllustrationsHelperFiles.js",
35
+ "generate-e2e-code": "npx playwright codegen"
36
+ },
37
+ "dependencies": {
38
+ "clsx": "^2.1.1"
39
+ },
40
+ "peerDependencies": {
41
+ "notistack": "^3.0.1",
42
+ "radix-ui": "^1.4.2",
43
+ "react": "^18.3.1",
44
+ "react-dom": "^18.3.1"
45
+ },
46
+ "devDependencies": {
47
+ "@chromatic-com/storybook": "^4.0.1",
48
+ "@eslint/js": "^9.25.0",
49
+ "@playwright/test": "^1.60.0",
50
+ "@storybook/addon-designs": "^10.0.2",
51
+ "@storybook/addon-docs": "^9.0.18",
52
+ "@storybook/addon-onboarding": "^9.0.18",
53
+ "@storybook/addon-vitest": "9.0.18",
54
+ "@storybook/react-vite": "^9.0.18",
55
+ "@testing-library/react": "^16.3.0",
56
+ "@types/node": "^22.15.21",
57
+ "@types/react": "^19.1.2",
58
+ "@types/react-dom": "^19.1.2",
59
+ "@vitejs/plugin-react": "^4.4.1",
60
+ "@vitest/browser": "^3.1.4",
61
+ "@vitest/coverage-v8": "^3.1.4",
62
+ "@vitest/ui": "^3.1.4",
63
+ "babel-plugin-react-remove-properties": "^0.3.0",
64
+ "eslint": "^9.25.0",
65
+ "eslint-config-prettier": "^10.1.5",
66
+ "eslint-plugin-react-hooks": "^5.2.0",
67
+ "eslint-plugin-react-refresh": "^0.4.19",
68
+ "eslint-plugin-storybook": "^9.0.18",
69
+ "glob": "^11.0.2",
70
+ "globals": "^16.0.0",
71
+ "happy-dom": "^15.11.6",
72
+ "jsdom": "^26.1.0",
73
+ "notistack": "^3.0.1",
74
+ "playwright": "^1.60.0",
75
+ "postcss-scss": "^4.0.9",
76
+ "prettier": "^3.5.3",
77
+ "sass": "^1.89.0",
78
+ "storybook": "^9.0.18",
79
+ "stylelint": "^16.19.1",
80
+ "stylelint-config-standard": "^38.0.0",
81
+ "stylelint-scss": "^6.12.0",
82
+ "typescript": "~5.8.3",
83
+ "typescript-eslint": "^8.30.1",
84
+ "vite": "^6.3.5",
85
+ "vite-plugin-dts": "^4.5.4",
86
+ "vite-plugin-lib-inject-css": "^2.2.2",
87
+ "vitest": "^3.1.4"
88
+ },
89
+ "eslintConfig": {
90
+ "extends": [
91
+ "plugin:storybook/recommended"
92
+ ]
93
+ }
94
+ }
@@ -1,412 +0,0 @@
1
- import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
- import { c as f } from "./clsx-OuTLNxxd.js";
3
- import { useMemo as be, useId as De, useRef as F, useState as d, useEffect as D } from "react";
4
- import Ae from "./components/Dialog/Dialog.js";
5
- import A from "./components/Icon/Icon.js";
6
- import Te from "./components/Input/Input.js";
7
- import J from "./components/Tooltip/Tooltip.js";
8
- import { R as Be, T as Ie, P as Pe, C as je } from "./index-DZ4Gof57.js";
9
- import './assets/RichTextEditor.css';const Ue = "RichTextEditor-module__container___AplP0", ze = "RichTextEditor-module__label___vjzs-", qe = "RichTextEditor-module__required___7duke", $e = "RichTextEditor-module__frame___7OSyf", We = "RichTextEditor-module__frameFocused___GtJ2x", Ke = "RichTextEditor-module__frameDisabled___LubtU", Ve = "RichTextEditor-module__frameError___sPTiY", Je = "RichTextEditor-module__errorMessage___4VdKj", Ge = "RichTextEditor-module__helpers___cpuz6", Ye = "RichTextEditor-module__helperText___rFoU0", Xe = "RichTextEditor-module__helpLink___7gYcv", Ze = "RichTextEditor-module__containerDisabled___6h9dd", Qe = "RichTextEditor-module__containerFullWidth___pOoeL", et = "RichTextEditor-module__toolbarContent___YXKHD", tt = "RichTextEditor-module__toolbarPanel___OVGHO", nt = "RichTextEditor-module__toolbarRow___f0xJR", ot = "RichTextEditor-module__toolbar___m9-M-", rt = "RichTextEditor-module__toolbarStacked___6rB10", it = "RichTextEditor-module__actions___ZAK9J", at = "RichTextEditor-module__toolButton___IT2Kg", lt = "RichTextEditor-module__toolButtonActive___-HvZQ", ct = "RichTextEditor-module__toolIcon___Wndhd", st = "RichTextEditor-module__formatControl___w4WcA", dt = "RichTextEditor-module__toolbarLinkSlot___Gu-9l", ut = "RichTextEditor-module__selectTrigger___frv3x", mt = "RichTextEditor-module__selectTriggerOpen___tk2Pb", _t = "RichTextEditor-module__selectTriggerLabel___FkEv0", pt = "RichTextEditor-module__selectIcon___aJWUk", ht = "RichTextEditor-module__formatMenu___y-uBL", ft = "RichTextEditor-module__formatMenuOptions___zcdlo", gt = "RichTextEditor-module__formatMenuOption___3ppTs", bt = "RichTextEditor-module__formatMenuOptionSelected___bq9J9", Tt = "RichTextEditor-module__formatMenuOptionParagraph___4BLds", xt = "RichTextEditor-module__formatMenuOptionHeading1___H1cKX", Rt = "RichTextEditor-module__formatMenuOptionHeading2___JdixR", Et = "RichTextEditor-module__formatMenuOptionHeading3___NcwLr", Mt = "RichTextEditor-module__formatMenuOptionHeading4___4mLbG", vt = "RichTextEditor-module__formatMenuOptionPreformatted___cB0Ix", Ct = "RichTextEditor-module__editor___M32R7", kt = "RichTextEditor-module__wordCount___5SSVY", Ot = "RichTextEditor-module__wordCountExceeded___NhqBc", yt = "RichTextEditor-module__linkDialogForm___vOLO1", t = {
10
- container: Ue,
11
- label: ze,
12
- required: qe,
13
- frame: $e,
14
- frameFocused: We,
15
- frameDisabled: Ke,
16
- frameError: Ve,
17
- errorMessage: Je,
18
- helpers: Ge,
19
- helperText: Ye,
20
- helpLink: Xe,
21
- containerDisabled: Ze,
22
- containerFullWidth: Qe,
23
- toolbarContent: et,
24
- toolbarPanel: tt,
25
- toolbarRow: nt,
26
- toolbar: ot,
27
- toolbarStacked: rt,
28
- actions: it,
29
- toolButton: at,
30
- toolButtonActive: lt,
31
- toolIcon: ct,
32
- formatControl: st,
33
- toolbarLinkSlot: dt,
34
- selectTrigger: ut,
35
- selectTriggerOpen: mt,
36
- selectTriggerLabel: _t,
37
- selectIcon: pt,
38
- formatMenu: ht,
39
- formatMenuOptions: ft,
40
- formatMenuOption: gt,
41
- formatMenuOptionSelected: bt,
42
- formatMenuOptionParagraph: Tt,
43
- formatMenuOptionHeading1: xt,
44
- formatMenuOptionHeading2: Rt,
45
- formatMenuOptionHeading3: Et,
46
- formatMenuOptionHeading4: Mt,
47
- formatMenuOptionPreformatted: vt,
48
- editor: Ct,
49
- wordCount: kt,
50
- wordCountExceeded: Ot,
51
- linkDialogForm: yt
52
- }, Lt = {
53
- paragraph: "p",
54
- heading1: "h1",
55
- heading2: "h2",
56
- heading3: "h3",
57
- heading4: "h4",
58
- preformatted: "pre",
59
- "unordered-list": "ul",
60
- "ordered-list": "ol"
61
- };
62
- function Re(r) {
63
- return r.trim().length > 0 ? r : "<br>";
64
- }
65
- function Ht(r) {
66
- switch (r.toLowerCase()) {
67
- case "h1":
68
- return "heading1";
69
- case "h2":
70
- return "heading2";
71
- case "h3":
72
- return "heading3";
73
- case "h4":
74
- return "heading4";
75
- case "pre":
76
- return "preformatted";
77
- case "ul":
78
- return "unordered-list";
79
- case "ol":
80
- return "ordered-list";
81
- case "p":
82
- default:
83
- return "paragraph";
84
- }
85
- }
86
- function G(r) {
87
- if (!r.trim())
88
- return {
89
- blocks: [{
90
- type: "paragraph",
91
- html: "<br>"
92
- }]
93
- };
94
- const m = new DOMParser().parseFromString(r, "text/html"), _ = Array.from(m.body.childNodes), g = [];
95
- return _.forEach((i) => {
96
- var T;
97
- if (i.nodeType === Node.TEXT_NODE) {
98
- const E = (T = i.textContent) == null ? void 0 : T.trim();
99
- E && g.push({
100
- type: "paragraph",
101
- html: E
102
- });
103
- return;
104
- }
105
- if (i.nodeType !== Node.ELEMENT_NODE)
106
- return;
107
- const u = i, b = u.style.textAlign;
108
- g.push({
109
- type: Ht(u.tagName),
110
- html: Re(u.innerHTML),
111
- align: b || void 0
112
- });
113
- }), {
114
- blocks: g.length > 0 ? g : [{
115
- type: "paragraph",
116
- html: "<br>"
117
- }]
118
- };
119
- }
120
- function xe(r) {
121
- return r.blocks.length ? r.blocks.map((l) => {
122
- const m = Lt[l.type], _ = l.align ? ` style="text-align:${l.align}"` : "";
123
- return `<${m}${_}>${Re(l.html)}</${m}>`;
124
- }).join("") : "<p><br></p>";
125
- }
126
- function Nt(r) {
127
- const l = r.blocks.map((m) => m.html.replace(/<[^>]+>/g, " ")).join(" ").replace(/\s+/g, " ").trim();
128
- return l ? l.split(" ").length : 0;
129
- }
130
- const wt = ["bold", "italic", "underline", "align-left", "align-center", "align-right", "bulleted", "link", "format"], St = [{
131
- label: "Paragraph",
132
- value: "paragraph"
133
- }, {
134
- label: "Heading 1",
135
- value: "heading1"
136
- }, {
137
- label: "Heading 2",
138
- value: "heading2"
139
- }, {
140
- label: "Heading 3",
141
- value: "heading3"
142
- }, {
143
- label: "Heading 4",
144
- value: "heading4"
145
- }, {
146
- label: "Preformatted",
147
- value: "preformatted"
148
- }], Ft = {
149
- paragraph: "P",
150
- heading1: "H1",
151
- heading2: "H2",
152
- heading3: "H3",
153
- heading4: "H4",
154
- preformatted: "PRE",
155
- "unordered-list": "UL",
156
- "ordered-list": "OL"
157
- };
158
- function Y() {
159
- return "<p><br></p>";
160
- }
161
- function Dt(r) {
162
- return r.trim().length > 0 ? r : Y();
163
- }
164
- function At() {
165
- const r = document.queryCommandValue("formatBlock");
166
- switch (String(r || "").replace(/[<>]/g, "").toUpperCase()) {
167
- case "H1":
168
- return "heading1";
169
- case "H2":
170
- return "heading2";
171
- case "H3":
172
- return "heading3";
173
- case "H4":
174
- return "heading4";
175
- case "PRE":
176
- return "preformatted";
177
- default:
178
- return "paragraph";
179
- }
180
- }
181
- function Bt(r) {
182
- switch (r) {
183
- case "heading1":
184
- return t.formatMenuOptionHeading1;
185
- case "heading2":
186
- return t.formatMenuOptionHeading2;
187
- case "heading3":
188
- return t.formatMenuOptionHeading3;
189
- case "heading4":
190
- return t.formatMenuOptionHeading4;
191
- case "preformatted":
192
- return t.formatMenuOptionPreformatted;
193
- default:
194
- return t.formatMenuOptionParagraph;
195
- }
196
- }
197
- function Kt({
198
- className: r,
199
- label: l,
200
- required: m = !1,
201
- value: _,
202
- placeholder: g = "Content",
203
- disabled: i = !1,
204
- errorMessage: u,
205
- helpText: b,
206
- helpLink: T,
207
- helpLinkText: E,
208
- toolbarLayout: B = "inline",
209
- showToolbar: I = !0,
210
- showWordCount: Ee = !0,
211
- maxWords: O,
212
- resizable: Me = !0,
213
- rows: ve = 8,
214
- fullWidth: P = !1,
215
- tooltipEnabled: y = !0,
216
- formatOptions: X = St,
217
- toolbarOptions: Z = wt,
218
- onChange: j,
219
- onModelChange: U
220
- }) {
221
- const Ce = be(() => new Set(Z), [Z]), M = (e) => Ce.has(e), Q = De(), s = F(null), ee = F(null), te = F(null), v = F(null), [ke, ne] = d(!1), [z, oe] = d(!1), [Oe, ye] = d(0), [re, ie] = d(null), [Le, ae] = d(!1), [le, ce] = d(""), [se, de] = d(""), [L, ue] = d(() => G(_ || Y())), [me, He] = d("paragraph"), [p, Ne] = d({
222
- bold: !1,
223
- italic: !1,
224
- underline: !1,
225
- justifyLeft: !1,
226
- justifyCenter: !1,
227
- justifyRight: !1,
228
- insertUnorderedList: !1
229
- }), q = be(() => Nt(L), [L]), $ = () => {
230
- if (!s.current) return;
231
- const e = G(s.current.innerHTML);
232
- ue(e), U == null || U(e), j == null || j(xe(e));
233
- }, C = () => {
234
- He(At()), Ne({
235
- bold: document.queryCommandState("bold"),
236
- italic: document.queryCommandState("italic"),
237
- underline: document.queryCommandState("underline"),
238
- justifyLeft: document.queryCommandState("justifyLeft"),
239
- justifyCenter: document.queryCommandState("justifyCenter"),
240
- justifyRight: document.queryCommandState("justifyRight"),
241
- insertUnorderedList: document.queryCommandState("insertUnorderedList")
242
- });
243
- }, W = () => {
244
- var e;
245
- i || (e = s.current) == null || e.focus();
246
- }, _e = (e, o) => {
247
- i || (W(), document.execCommand(e, !1, o), $(), C());
248
- }, we = (e) => {
249
- _e("formatBlock", Ft[e]);
250
- }, pe = () => {
251
- var h, R;
252
- if (i) return;
253
- W();
254
- const e = window.getSelection();
255
- let o = "", a = "";
256
- if (e && e.rangeCount > 0) {
257
- const k = e.getRangeAt(0);
258
- v.current = k.cloneRange(), o = e.toString();
259
- const V = ((h = k.startContainer.parentElement) == null ? void 0 : h.closest("a")) ?? ((R = k.endContainer.parentElement) == null ? void 0 : R.closest("a"));
260
- V instanceof HTMLAnchorElement && (o = V.textContent ?? o, a = V.getAttribute("href") ?? "");
261
- } else
262
- v.current = null;
263
- ce(o), de(a), ae(!0);
264
- }, H = () => {
265
- ae(!1), v.current = null;
266
- }, Se = () => {
267
- const e = se.trim();
268
- if (!e) {
269
- H();
270
- return;
271
- }
272
- const o = le.trim() || e, a = (k) => k.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), h = `<a href="${a(e)}" target="_blank" rel="noopener noreferrer">${a(o)}</a>`;
273
- W();
274
- const R = window.getSelection();
275
- R && v.current && (R.removeAllRanges(), R.addRange(v.current)), document.execCommand("insertHTML", !1, h), $(), C(), H();
276
- }, Fe = (e) => {
277
- if (!e.ctrlKey && !e.metaKey) return;
278
- const o = e.target, a = o == null ? void 0 : o.closest("a");
279
- a instanceof HTMLAnchorElement && a.href && (e.preventDefault(), window.open(a.href, "_blank", "noopener,noreferrer"));
280
- };
281
- D(() => {
282
- const e = Dt(_ || Y()), o = G(e);
283
- ue(o), s.current && s.current.innerHTML !== e && (s.current.innerHTML = e);
284
- }, [_]), D(() => {
285
- s.current && (s.current.innerHTML.trim() || (s.current.innerHTML = xe(L)));
286
- }, [L]), D(() => {
287
- var o;
288
- const e = (o = ee.current) == null ? void 0 : o.getBoundingClientRect().width;
289
- e && ye(e);
290
- }, [z]), D(() => {
291
- if (!I || P) {
292
- ie(null);
293
- return;
294
- }
295
- const e = te.current;
296
- if (!e) return;
297
- const o = () => {
298
- const h = e.getBoundingClientRect().width;
299
- h > 0 && ie(h);
300
- };
301
- o();
302
- const a = new ResizeObserver(() => {
303
- o();
304
- });
305
- return a.observe(e), window.addEventListener("resize", o), () => {
306
- a.disconnect(), window.removeEventListener("resize", o);
307
- };
308
- }, [I, B, i, y, P]);
309
- const x = (e) => /* @__PURE__ */ n(J, { content: e.tooltip, size: "sm", theme: "dark", tipSide: "top", tipAlignment: "center", disabled: !y, children: /* @__PURE__ */ n("button", { type: "button", className: f(t.toolButton, e.active && t.toolButtonActive), onMouseDown: (o) => o.preventDefault(), onClick: () => _e(e.command, e.value), "aria-label": e.tooltip, disabled: i, children: /* @__PURE__ */ n(A, { icon: e.icon, className: t.toolIcon }) }) }, e.id), K = [{
310
- id: "bold",
311
- icon: "ap-icon-bold",
312
- command: "bold",
313
- tooltip: "Bold (CTRL + B)",
314
- active: p.bold
315
- }, {
316
- id: "italic",
317
- icon: "ap-icon-italic",
318
- command: "italic",
319
- tooltip: "Italic (CTRL + I)",
320
- active: p.italic
321
- }, {
322
- id: "underline",
323
- icon: "ap-icon-underline",
324
- command: "underline",
325
- tooltip: "Underline (CTRL + U)",
326
- active: p.underline
327
- }, {
328
- id: "align-left",
329
- icon: "ap-icon-left",
330
- command: "justifyLeft",
331
- tooltip: "Align left",
332
- active: p.justifyLeft
333
- }, {
334
- id: "align-center",
335
- icon: "ap-icon-bar",
336
- command: "justifyCenter",
337
- tooltip: "Align center",
338
- active: p.justifyCenter
339
- }, {
340
- id: "align-right",
341
- icon: "ap-icon-right",
342
- command: "justifyRight",
343
- tooltip: "Align right",
344
- active: p.justifyRight
345
- }, {
346
- id: "bulleted",
347
- icon: "ap-icon-list",
348
- command: "insertUnorderedList",
349
- tooltip: "Bulleted list",
350
- active: p.insertUnorderedList
351
- }], N = K.filter((e) => ["bold", "italic", "underline"].includes(e.id) && M(e.id)), w = K.filter((e) => ["align-left", "align-center", "align-right"].includes(e.id) && M(e.id)), S = K.filter((e) => ["bulleted"].includes(e.id) && M(e.id)), he = M("link"), fe = M("format"), ge = () => {
352
- var e;
353
- return /* @__PURE__ */ n("div", { className: t.formatControl, children: /* @__PURE__ */ c(Be, { open: z, onOpenChange: oe, children: [
354
- /* @__PURE__ */ c(Ie, { ref: ee, disabled: i, className: f(t.selectTrigger, z && t.selectTriggerOpen), children: [
355
- /* @__PURE__ */ n("span", { className: t.selectTriggerLabel, children: ((e = X.find((o) => o.value === me)) == null ? void 0 : e.label) || "Paragraph" }),
356
- /* @__PURE__ */ n(A, { icon: "ap-icon-expand-more", className: t.selectIcon })
357
- ] }),
358
- /* @__PURE__ */ n(Pe, { children: /* @__PURE__ */ n(je, { align: "end", side: "bottom", sideOffset: 6, collisionPadding: 8, className: t.formatMenu, style: {
359
- minWidth: Oe || 180,
360
- zIndex: 9999
361
- }, children: /* @__PURE__ */ n("div", { className: t.formatMenuOptions, children: X.map((o) => /* @__PURE__ */ n("button", { type: "button", className: f(t.formatMenuOption, Bt(o.value), o.value === me && t.formatMenuOptionSelected), onMouseDown: (a) => a.preventDefault(), onClick: () => {
362
- we(o.value), oe(!1);
363
- }, children: o.label }, o.value)) }) }) })
364
- ] }) });
365
- };
366
- return /* @__PURE__ */ c("div", { className: f(t.container, i && t.containerDisabled, P && t.containerFullWidth, r), children: [
367
- l && /* @__PURE__ */ c("label", { className: t.label, htmlFor: Q, children: [
368
- l,
369
- m && /* @__PURE__ */ n("span", { className: t.required, children: "*" })
370
- ] }),
371
- /* @__PURE__ */ c("div", { className: f(t.frame, ke && t.frameFocused, i && t.frameDisabled, u && t.frameError), style: {
372
- width: re ? `${re}px` : void 0
373
- }, children: [
374
- I && /* @__PURE__ */ n("div", { className: f(t.toolbar, B === "stacked" && t.toolbarStacked), children: /* @__PURE__ */ n("div", { ref: te, className: t.toolbarContent, children: B === "stacked" ? /* @__PURE__ */ c("div", { className: t.toolbarPanel, children: [
375
- /* @__PURE__ */ c("div", { className: t.toolbarRow, children: [
376
- N.length > 0 && /* @__PURE__ */ n("div", { className: t.actions, children: N.map(x) }),
377
- w.length > 0 && /* @__PURE__ */ n("div", { className: t.actions, children: w.map(x) })
378
- ] }),
379
- /* @__PURE__ */ c("div", { className: t.toolbarRow, children: [
380
- S.length > 0 && /* @__PURE__ */ n("div", { className: t.actions, children: S.map(x) }),
381
- he && /* @__PURE__ */ n("div", { className: t.toolbarLinkSlot, children: /* @__PURE__ */ n(J, { content: "Insert link", size: "sm", theme: "dark", tipSide: "top", tipAlignment: "center", disabled: !y, children: /* @__PURE__ */ n("button", { type: "button", className: t.toolButton, onMouseDown: (e) => e.preventDefault(), onClick: pe, "aria-label": "Insert link", disabled: i, children: /* @__PURE__ */ n(A, { icon: "ap-icon-link", className: t.toolIcon }) }) }) }),
382
- fe && ge()
383
- ] })
384
- ] }) : /* @__PURE__ */ n("div", { className: t.toolbarPanel, children: /* @__PURE__ */ c("div", { className: t.toolbarRow, children: [
385
- N.length > 0 && /* @__PURE__ */ n("div", { className: t.actions, children: N.map(x) }),
386
- w.length > 0 && /* @__PURE__ */ n("div", { className: t.actions, children: w.map(x) }),
387
- S.length > 0 && /* @__PURE__ */ n("div", { className: t.actions, children: S.map(x) }),
388
- he && /* @__PURE__ */ n("div", { className: t.toolbarLinkSlot, children: /* @__PURE__ */ n(J, { content: "Insert link", size: "sm", theme: "dark", tipSide: "top", tipAlignment: "center", disabled: !y, children: /* @__PURE__ */ n("button", { type: "button", className: t.toolButton, onMouseDown: (e) => e.preventDefault(), onClick: pe, "aria-label": "Insert link", disabled: i, children: /* @__PURE__ */ n(A, { icon: "ap-icon-link", className: t.toolIcon }) }) }) }),
389
- fe && ge()
390
- ] }) }) }) }),
391
- /* @__PURE__ */ n("div", { id: Q, ref: s, className: t.editor, contentEditable: !i, suppressContentEditableWarning: !0, role: "textbox", "aria-multiline": "true", "aria-label": l || "Rich text editor", "data-placeholder": g, onInput: $, onFocus: () => {
392
- ne(!0), C();
393
- }, onBlur: () => ne(!1), onKeyUp: C, onMouseUp: C, onClick: Fe, style: {
394
- minHeight: `${ve * 20}px`,
395
- resize: Me ? "vertical" : "none"
396
- } }),
397
- Ee && /* @__PURE__ */ n("div", { className: f(t.wordCount, O && q > O && t.wordCountExceeded), children: O ? `${q}/${O}` : q })
398
- ] }),
399
- (u || b || T) && /* @__PURE__ */ c("div", { className: t.helpers, children: [
400
- u ? /* @__PURE__ */ n("span", { title: u, className: t.errorMessage, children: u }) : b && /* @__PURE__ */ n("span", { title: b, className: t.helperText, children: b }),
401
- T && E && /* @__PURE__ */ n("a", { href: T, className: t.helpLink, target: "_blank", rel: "noopener noreferrer", children: E })
402
- ] }),
403
- /* @__PURE__ */ n(Ae, { isOpen: Le, onClose: H, title: "Attach link", cancelButtonText: "Cancel", cancelButtonType: "secondary", cancelButtonVariant: "cancel", confirmButtonText: "Attach", confirmButtonType: "primary", onCancel: H, onConfirm: Se, description: /* @__PURE__ */ c("div", { className: t.linkDialogForm, children: [
404
- /* @__PURE__ */ n(Te, { type: "text", label: "Displayed text", value: le, onChange: ce, autofocus: !0 }),
405
- /* @__PURE__ */ n(Te, { type: "text", label: "Link", value: se, placeholder: "https://example.com/", onChange: de })
406
- ] }) })
407
- ] });
408
- }
409
- export {
410
- Kt as R,
411
- t as s
412
- };
@@ -1,4 +0,0 @@
1
- const o = ["ap-icon-logo-alixpartners", "ap-icon-logo-chapter11", "ap-icon-logo-deedi", "ap-icon-logo-elevation", "ap-icon-logo-gto", "ap-icon-logo-radial", "ap-icon-logo-rpms", "ap-icon-logo-smart-factory", "ap-icon-logo-sxr", "ap-icon-logo-working-capital", "ap-icon-logo-vault", "ap-icon-logo-codex"];
2
- export {
3
- o as a
4
- };
@@ -1,27 +0,0 @@
1
- import * as u from "react";
2
- import { i as z } from "./index-DM51yNMI.js";
3
- function n(r) {
4
- const [h, i] = u.useState(void 0);
5
- return z(() => {
6
- if (r) {
7
- i({ width: r.offsetWidth, height: r.offsetHeight });
8
- const f = new ResizeObserver((e) => {
9
- if (!Array.isArray(e) || !e.length)
10
- return;
11
- const b = e[0];
12
- let o, t;
13
- if ("borderBoxSize" in b) {
14
- const s = b.borderBoxSize, d = Array.isArray(s) ? s[0] : s;
15
- o = d.inlineSize, t = d.blockSize;
16
- } else
17
- o = r.offsetWidth, t = r.offsetHeight;
18
- i({ width: o, height: t });
19
- });
20
- return f.observe(r, { box: "border-box" }), () => f.unobserve(r);
21
- } else
22
- i(void 0);
23
- }, [r]), h;
24
- }
25
- export {
26
- n as u
27
- };