@patternfly/patternfly-doc-core 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.astro/collections/examples.schema.json +19 -0
  2. package/.astro/collections/textContent.schema.json +19 -0
  3. package/.astro/content-modules.mjs +1 -0
  4. package/dist/client/_astro/{PageContext.D1pNBMhh.js → Button.IBWho7ny.js} +2 -2
  5. package/dist/client/_astro/CSSTable.V4xaGXjj.js +1185 -0
  6. package/dist/client/_astro/Content.Dv9vgAns.js +1 -0
  7. package/dist/client/_astro/DropdownGroup.DmTizX-Q.js +1 -0
  8. package/dist/client/_astro/DropdownList.BUcpBUVP.js +1 -0
  9. package/dist/client/_astro/LiveExample.CiM2pGMB.js +18 -0
  10. package/dist/client/_astro/Navigation.CnvE1VCH.js +1 -0
  11. package/dist/client/_astro/PageContext.ipir86Hm.js +1 -0
  12. package/dist/client/_astro/PageSidebarBody.vGxFk_DU.js +1 -0
  13. package/dist/client/_astro/PageToggle.C6_rp-Bm.js +1 -0
  14. package/dist/client/_astro/PageToggleButton.CagcouJB.js +1 -0
  15. package/dist/client/_astro/SearchInput.BwWsXfyf.js +1 -0
  16. package/dist/client/_astro/SectionGallery.DqD5bUWQ.js +1 -0
  17. package/dist/client/_astro/Toolbar.BmilfRHR.js +1 -0
  18. package/dist/client/_astro/ToolbarContent.Cd-kqxku.js +1 -0
  19. package/dist/client/_astro/_page_.BWicMEzd.css +1 -0
  20. package/dist/client/_astro/_page_.Chv_bGyU.css +1 -0
  21. package/dist/client/_astro/angle-left-icon.C3MzYN3k.js +1 -0
  22. package/dist/client/_astro/{client.CTJTt880.js → client.zs76E0tG.js} +1 -1
  23. package/dist/client/_astro/divider.O4WEhuBq.js +1 -0
  24. package/dist/client/_astro/help-icon.Du6t7nyh.js +8 -0
  25. package/dist/client/_astro/{index.Dhi-S4Ah.js → index.BQFV5hT1.js} +1 -1
  26. package/dist/client/_astro/index.BkswdOFP.js +16 -0
  27. package/dist/client/_astro/index.CAChmxYj.js +1 -0
  28. package/dist/client/_astro/{index.Dkaqzkgy.js → index.eCxJ45ll.js} +2 -2
  29. package/dist/client/_astro/page.BTC3Kf3x.js +1 -0
  30. package/dist/client/components/accordion/index.html +42 -17
  31. package/dist/client/components/accordion/react/index.html +110 -0
  32. package/dist/client/components/all-components/index.html +97 -0
  33. package/dist/client/design-foundations/typography/index.html +36 -9
  34. package/dist/client/design-foundations/usage-and-behavior/index.html +36 -9
  35. package/dist/client/get-started/contribute/index.html +36 -9
  36. package/dist/client/index.html +3 -4
  37. package/dist/server/chunks/Button_DVSwQ8oX.mjs +639 -0
  38. package/dist/server/chunks/CSSTable_CG80uW98.mjs +740 -0
  39. package/dist/server/chunks/CSSTable_Dj2CroFz.mjs +4 -0
  40. package/dist/server/chunks/{PropsTables_IgCNCQTX.mjs → PropsTables_DUo7F9VR.mjs} +36 -47
  41. package/dist/server/chunks/Stack_Xm3fJVbK.mjs +22 -0
  42. package/dist/server/chunks/_astro_data-layer-content_D4Ib_RjR.mjs +1 -0
  43. package/dist/server/chunks/{angle-down-icon_C5YQ7k8s.mjs → angle-down-icon_DtGGiMR5.mjs} +5 -637
  44. package/dist/server/chunks/content-modules_fX1c2JRG.mjs +1 -0
  45. package/dist/server/entry.mjs +3 -2
  46. package/dist/server/{manifest_DoNTQyvZ.mjs → manifest_CXkcH4VT.mjs} +1 -1
  47. package/jest.config.ts +1 -1
  48. package/package.json +1 -1
  49. package/src/components/AutoLinkHeader.tsx +56 -0
  50. package/src/components/CSSSearch.tsx +33 -0
  51. package/src/components/CSSTable.astro +33 -0
  52. package/src/components/CSSTable.tsx +268 -0
  53. package/src/components/NavEntry.tsx +3 -0
  54. package/src/components/Navigation.astro +16 -9
  55. package/src/components/section-gallery/SectionGallery.astro +19 -0
  56. package/src/components/section-gallery/SectionGallery.css +20 -0
  57. package/src/components/section-gallery/SectionGallery.tsx +111 -0
  58. package/src/components/section-gallery/SectionGalleryGridLayout.tsx +97 -0
  59. package/src/components/section-gallery/SectionGalleryListLayout.tsx +108 -0
  60. package/src/components/section-gallery/SectionGalleryToolbar.tsx +93 -0
  61. package/src/content.config.ts +11 -3
  62. package/src/layouts/Main.astro +12 -8
  63. package/src/pages/[section]/[...page].astro +20 -6
  64. package/src/pages/[section]/[page]/[...tab].astro +29 -23
  65. package/src/pages/index.astro +0 -1
  66. package/src/styles/global.scss +47 -1
  67. package/src/utils/index.ts +1 -0
  68. package/src/utils/slugger.ts +14 -0
  69. package/textContent/AllComponents.mdx +16 -0
  70. package/textContent/components-data.js +476 -0
  71. package/textContent/contribute.md +19 -13
  72. package/textContent/examples/Accordion/Accordion.mdx +1 -0
  73. package/dist/client/_astro/LiveExample.Df-EUsee.js +0 -40
  74. package/dist/client/_astro/Navigation.CabjIYg4.js +0 -1
  75. package/dist/client/_astro/PageSidebarBody.Y-7d6zQM.js +0 -1
  76. package/dist/client/_astro/PageToggle.CbfM9bJB.js +0 -1
  77. package/dist/client/_astro/PageToggleButton.CZ3xPbcc.js +0 -1
  78. package/dist/client/_astro/Toolbar.9-YSFh3P.js +0 -1
  79. package/dist/client/_astro/ToolbarContent.BXdFKbs9.js +0 -1
  80. package/dist/client/_astro/_page_.B8cBYNKa.css +0 -1
  81. package/dist/client/_astro/_tab_.YrfmckTJ.css +0 -1
  82. package/dist/client/_astro/divider.DjbDHO_6.js +0 -1
  83. package/dist/client/_astro/page.CDtWFZb5.js +0 -1
  84. /package/dist/client/_astro/{_tab_.DxJDkZPc.css → _page_.DxJDkZPc.css} +0 -0
  85. /package/dist/server/chunks/{Accordion_CGgMUho2.mjs → Accordion_BJka4Qvb.mjs} +0 -0
  86. /package/dist/server/chunks/{Accordion_DlM2LvlF.mjs → Accordion_BQIphkaZ.mjs} +0 -0
  87. /package/dist/server/chunks/{_astro_data-layer-content_Ni7IDnLe.mjs → AllComponents_CRhgTsiT.mjs} +0 -0
  88. /package/dist/server/chunks/{content-modules_BzUEG69n.mjs → AllComponents_CjOtwUH6.mjs} +0 -0
@@ -0,0 +1,639 @@
1
+ import { __rest } from 'tslib';
2
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
+ import { Component, useMemo, forwardRef } from 'react';
4
+ /* empty css */
5
+
6
+ /** Joins args into a className string
7
+ *
8
+ * @param {any} args list of objects, string, or arrays to reduce
9
+ */
10
+ function css(...args) {
11
+ // Adapted from https://github.com/JedWatson/classnames/blob/master/index.js
12
+ const classes = [];
13
+ const hasOwn = {}.hasOwnProperty;
14
+ args.filter(Boolean).forEach((arg) => {
15
+ const argType = typeof arg;
16
+ if (argType === 'string' || argType === 'number') {
17
+ classes.push(arg);
18
+ }
19
+ else if (Array.isArray(arg) && arg.length) {
20
+ const inner = css(...arg);
21
+ if (inner) {
22
+ classes.push(inner);
23
+ }
24
+ }
25
+ else if (argType === 'object') {
26
+ for (const key in arg) {
27
+ if (hasOwn.call(arg, key) && arg[key]) {
28
+ classes.push(key);
29
+ }
30
+ }
31
+ }
32
+ });
33
+ return classes.join(' ');
34
+ }
35
+
36
+ const t_global_breakpoint_sm = {
37
+ "value": "36rem"};
38
+
39
+ const t_global_breakpoint_md = {
40
+ "value": "48rem"};
41
+
42
+ const t_global_breakpoint_lg = {
43
+ "value": "62rem"};
44
+
45
+ const t_global_breakpoint_xl = {
46
+ "value": "75rem"};
47
+
48
+ const t_global_breakpoint_2xl = {
49
+ "value": "90.625rem"};
50
+
51
+ const t_global_breakpoint_height_sm = {
52
+ "value": "0rem"};
53
+
54
+ const t_global_breakpoint_height_md = {
55
+ "value": "40rem"};
56
+
57
+ const t_global_breakpoint_height_lg = {
58
+ "value": "48rem"};
59
+
60
+ const t_global_breakpoint_height_xl = {
61
+ "value": "60rem"};
62
+
63
+ const t_global_breakpoint_height_2xl = {
64
+ "value": "80rem"};
65
+
66
+ let currentId = 0;
67
+ /**
68
+ * Factory to create Icon class components for consumers
69
+ */
70
+ function createIcon({ name, xOffset = 0, yOffset = 0, width, height, svgPath }) {
71
+ var _a;
72
+ return _a = class SVGIcon extends Component {
73
+ constructor() {
74
+ super(...arguments);
75
+ this.id = `icon-title-${currentId++}`;
76
+ }
77
+ render() {
78
+ const _b = this.props, { title, className } = _b, props = __rest(_b, ["title", "className"]);
79
+ const classes = className ? `pf-v6-svg ${className}` : 'pf-v6-svg';
80
+ const hasTitle = Boolean(title);
81
+ const viewBox = [xOffset, yOffset, width, height].join(' ');
82
+ return (jsxs("svg", Object.assign({ className: classes, viewBox: viewBox, fill: "currentColor", "aria-labelledby": hasTitle ? this.id : null, "aria-hidden": hasTitle ? null : true, role: "img", width: "1em", height: "1em" }, props, { children: [hasTitle && jsx("title", { id: this.id, children: title }), jsx("path", { d: svgPath })] })));
83
+ }
84
+ },
85
+ _a.displayName = name,
86
+ _a;
87
+ }
88
+
89
+ const CheckCircleIconConfig = {
90
+ name: 'CheckCircleIcon',
91
+ height: 512,
92
+ width: 512,
93
+ svgPath: 'M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z',
94
+ yOffset: 0,
95
+ xOffset: 0,
96
+ };
97
+
98
+ const CheckCircleIcon = createIcon(CheckCircleIconConfig);
99
+
100
+ const ExclamationCircleIconConfig = {
101
+ name: 'ExclamationCircleIcon',
102
+ height: 512,
103
+ width: 512,
104
+ svgPath: 'M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z',
105
+ yOffset: 0,
106
+ xOffset: 0,
107
+ };
108
+
109
+ const ExclamationCircleIcon = createIcon(ExclamationCircleIconConfig);
110
+
111
+ const ExclamationTriangleIconConfig = {
112
+ name: 'ExclamationTriangleIcon',
113
+ height: 512,
114
+ width: 576,
115
+ svgPath: 'M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z',
116
+ yOffset: 0,
117
+ xOffset: 0,
118
+ };
119
+
120
+ const ExclamationTriangleIcon = createIcon(ExclamationTriangleIconConfig);
121
+
122
+ const InfoCircleIconConfig = {
123
+ name: 'InfoCircleIcon',
124
+ height: 512,
125
+ width: 512,
126
+ svgPath: 'M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z',
127
+ yOffset: 0,
128
+ xOffset: 0,
129
+ };
130
+
131
+ const InfoCircleIcon = createIcon(InfoCircleIconConfig);
132
+
133
+ const BellIconConfig = {
134
+ name: 'BellIcon',
135
+ height: 1024,
136
+ width: 896,
137
+ svgPath: 'M448,0 C465.333333,0 480.333333,6.33333333 493,19 C505.666667,31.6666667 512,46.6666667 512,64 L512,106 L514.23,106.45 C587.89,121.39 648.48,157.24 696,214 C744,271.333333 768,338.666667 768,416 C768,500 780,568.666667 804,622 C818.666667,652.666667 841.333333,684 872,716 C873.773676,718.829136 875.780658,721.505113 878,724 C890,737.333333 896,752.333333 896,769 C896,785.666667 890,800.333333 878,813 C866,825.666667 850.666667,832 832,832 L63.3,832 C44.9533333,831.84 29.8533333,825.506667 18,813 C6,800.333333 0,785.666667 0,769 C0,752.333333 6,737.333333 18,724 L24,716 L25.06,714.9 C55.1933333,683.28 77.5066667,652.313333 92,622 C116,568.666667 128,500 128,416 C128,338.666667 152,271.333333 200,214 C248,156.666667 309.333333,120.666667 384,106 L384,63.31 C384.166667,46.27 390.5,31.5 403,19 C415.666667,6.33333333 430.666667,0 448,0 Z M576,896 L576,897.08 C575.74,932.6 563.073333,962.573333 538,987 C512.666667,1011.66667 482.666667,1024 448,1024 C413.333333,1024 383.333333,1011.66667 358,987 C332.666667,962.333333 320,932 320,896 L576,896 Z',
138
+ yOffset: 0,
139
+ xOffset: 0,
140
+ };
141
+
142
+ const BellIcon = createIcon(BellIconConfig);
143
+
144
+ var ValidatedOptions;
145
+ (function (ValidatedOptions) {
146
+ ValidatedOptions["success"] = "success";
147
+ ValidatedOptions["error"] = "error";
148
+ ValidatedOptions["warning"] = "warning";
149
+ ValidatedOptions["default"] = "default";
150
+ })(ValidatedOptions || (ValidatedOptions = {}));
151
+ const KeyTypes = {
152
+ Space: ' ',
153
+ Escape: 'Escape',
154
+ Enter: 'Enter'};
155
+ const globalWidthBreakpoints = {
156
+ sm: parseInt(t_global_breakpoint_sm.value) * 16,
157
+ md: parseInt(t_global_breakpoint_md.value) * 16,
158
+ lg: parseInt(t_global_breakpoint_lg.value) * 16,
159
+ xl: parseInt(t_global_breakpoint_xl.value) * 16,
160
+ '2xl': parseInt(t_global_breakpoint_2xl.value) * 16
161
+ };
162
+ const globalHeightBreakpoints = {
163
+ sm: parseInt(t_global_breakpoint_height_sm.value) * 16,
164
+ md: parseInt(t_global_breakpoint_height_md.value) * 16,
165
+ lg: parseInt(t_global_breakpoint_height_lg.value) * 16,
166
+ xl: parseInt(t_global_breakpoint_height_xl.value) * 16,
167
+ '2xl': parseInt(t_global_breakpoint_height_2xl.value) * 16
168
+ };
169
+ const statusIcons = {
170
+ success: CheckCircleIcon,
171
+ danger: ExclamationCircleIcon,
172
+ warning: ExclamationTriangleIcon,
173
+ info: InfoCircleIcon,
174
+ custom: BellIcon
175
+ };
176
+
177
+ /**
178
+ * @param {string} prefix - String to prefix ID with
179
+ */
180
+ function getUniqueId(prefix = 'pf') {
181
+ const uid = new Date().getTime() + Math.random().toString(36).slice(2);
182
+ return `${prefix}-${uid}`;
183
+ }
184
+ /**
185
+ * This function is a helper for turning arrays of breakpointMod objects for flex and grid into style object
186
+ *
187
+ * @param {object} mods The modifiers object
188
+ * @param {string} css-variable The appropriate css variable for the component
189
+ */
190
+ const setBreakpointCssVars = (mods, cssVar) => Object.entries(mods || {}).reduce((acc, [breakpoint, value]) => breakpoint === 'default' ? Object.assign(Object.assign({}, acc), { [cssVar]: value }) : Object.assign(Object.assign({}, acc), { [`${cssVar}-on-${breakpoint}`]: value }), {});
191
+ /**
192
+ * This function is a helper for turning arrays of breakpointMod objects for data toolbar and flex into classes
193
+ *
194
+ * @param {object} mods The modifiers object
195
+ * @param {any} styles The appropriate styles object for the component
196
+ */
197
+ const formatBreakpointMods = (mods, styles, stylePrefix = '', breakpoint, vertical) => {
198
+ if (!mods) {
199
+ return '';
200
+ }
201
+ if (breakpoint && !vertical) {
202
+ if (breakpoint in mods) {
203
+ return styles.modifiers[toCamel(`${stylePrefix}${mods[breakpoint]}`)];
204
+ }
205
+ // the current breakpoint is not specified in mods, so we try to find the next nearest
206
+ const breakpointsOrder = ['2xl', 'xl', 'lg', 'md', 'sm', 'default'];
207
+ const breakpointsIndex = breakpointsOrder.indexOf(breakpoint);
208
+ for (let i = breakpointsIndex; i < breakpointsOrder.length; i++) {
209
+ if (breakpointsOrder[i] in mods) {
210
+ return styles.modifiers[toCamel(`${stylePrefix}${mods[breakpointsOrder[i]]}`)];
211
+ }
212
+ }
213
+ return '';
214
+ }
215
+ return Object.entries(mods || {})
216
+ .map(([breakpoint, mod]) => `${stylePrefix}${mod}${breakpoint !== 'default' ? `-on-${breakpoint}` : ''}${vertical && breakpoint !== 'default' ? '-height' : ''}`)
217
+ .map(toCamel)
218
+ .map((mod) => mod.replace(/-?(\dxl)/gi, (_res, group) => `_${group}`))
219
+ .map((modifierKey) => styles.modifiers[modifierKey])
220
+ .filter(Boolean)
221
+ .join(' ');
222
+ };
223
+ /**
224
+ * Return the breakpoint for the given height
225
+ *
226
+ * @param {number | null} height The height to check
227
+ * @returns {'default' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'} The breakpoint
228
+ */
229
+ const getVerticalBreakpoint = (height) => {
230
+ if (height === null) {
231
+ return null;
232
+ }
233
+ if (height >= globalHeightBreakpoints['2xl']) {
234
+ return '2xl';
235
+ }
236
+ if (height >= globalHeightBreakpoints.xl) {
237
+ return 'xl';
238
+ }
239
+ if (height >= globalHeightBreakpoints.lg) {
240
+ return 'lg';
241
+ }
242
+ if (height >= globalHeightBreakpoints.md) {
243
+ return 'md';
244
+ }
245
+ if (height >= globalHeightBreakpoints.sm) {
246
+ return 'sm';
247
+ }
248
+ return 'default';
249
+ };
250
+ /**
251
+ * Return the breakpoint for the given width
252
+ *
253
+ * @param {number | null} width The width to check
254
+ * @returns {'default' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'} The breakpoint
255
+ */
256
+ const getBreakpoint = (width) => {
257
+ if (width === null) {
258
+ return null;
259
+ }
260
+ if (width >= globalWidthBreakpoints['2xl']) {
261
+ return '2xl';
262
+ }
263
+ if (width >= globalWidthBreakpoints.xl) {
264
+ return 'xl';
265
+ }
266
+ if (width >= globalWidthBreakpoints.lg) {
267
+ return 'lg';
268
+ }
269
+ if (width >= globalWidthBreakpoints.md) {
270
+ return 'md';
271
+ }
272
+ if (width >= globalWidthBreakpoints.sm) {
273
+ return 'sm';
274
+ }
275
+ return 'default';
276
+ };
277
+ const camelize = (s) => s.toUpperCase().replace('-', '').replace('_', '');
278
+ /**
279
+ *
280
+ * @param {string} s string to make camelCased
281
+ */
282
+ const toCamel = (s) => s.replace(/([-_][a-z])/gi, camelize);
283
+ /**
284
+ * Copied from exenv
285
+ */
286
+ const canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
287
+ /**
288
+ * Calculate the width of the text
289
+ * Example:
290
+ * getTextWidth('my text', node)
291
+ *
292
+ * @param {string} text The text to calculate the width for
293
+ * @param {HTMLElement} node The HTML element
294
+ */
295
+ const getTextWidth = (text, node) => {
296
+ const computedStyle = getComputedStyle(node);
297
+ // Firefox returns the empty string for .font, so this function creates the .font property manually
298
+ const getFontFromComputedStyle = () => {
299
+ let computedFont = '';
300
+ // Firefox uses percentages for font-stretch, but Canvas does not accept percentages
301
+ // so convert to keywords, as listed at:
302
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/font-stretch
303
+ const fontStretchLookupTable = {
304
+ '50%': 'ultra-condensed',
305
+ '62.5%': 'extra-condensed',
306
+ '75%': 'condensed',
307
+ '87.5%': 'semi-condensed',
308
+ '100%': 'normal',
309
+ '112.5%': 'semi-expanded',
310
+ '125%': 'expanded',
311
+ '150%': 'extra-expanded',
312
+ '200%': 'ultra-expanded'
313
+ };
314
+ // If the retrieved font-stretch percentage isn't found in the lookup table, use
315
+ // 'normal' as a last resort.
316
+ let fontStretch;
317
+ if (computedStyle.fontStretch in fontStretchLookupTable) {
318
+ fontStretch = fontStretchLookupTable[computedStyle.fontStretch];
319
+ }
320
+ else {
321
+ fontStretch = 'normal';
322
+ }
323
+ computedFont =
324
+ computedStyle.fontStyle +
325
+ ' ' +
326
+ computedStyle.fontVariant +
327
+ ' ' +
328
+ computedStyle.fontWeight +
329
+ ' ' +
330
+ fontStretch +
331
+ ' ' +
332
+ computedStyle.fontSize +
333
+ '/' +
334
+ computedStyle.lineHeight +
335
+ ' ' +
336
+ computedStyle.fontFamily;
337
+ return computedFont;
338
+ };
339
+ const canvas = document.createElement('canvas');
340
+ const context = canvas.getContext('2d');
341
+ context.font = computedStyle.font || getFontFromComputedStyle();
342
+ return context.measureText(text).width;
343
+ };
344
+ /**
345
+ * Get the inner dimensions of an element
346
+ *
347
+ * @param {HTMLElement} node HTML element to calculate the inner dimensions for
348
+ */
349
+ const innerDimensions = (node) => {
350
+ const computedStyle = getComputedStyle(node);
351
+ let width = node.clientWidth; // width with padding
352
+ let height = node.clientHeight; // height with padding
353
+ height -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
354
+ width -= parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight);
355
+ return { height, width };
356
+ };
357
+ /**
358
+ * This function is a helper for truncating text content on the left, leaving the right side of the content in view
359
+ *
360
+ * @param {HTMLElement} node HTML element
361
+ * @param {string} value The original text value
362
+ */
363
+ const trimLeft = (node, value) => {
364
+ const availableWidth = innerDimensions(node).width;
365
+ let newValue = value;
366
+ if (getTextWidth(value, node) > availableWidth) {
367
+ // we have text overflow, trim the text to the left and add ... in the front until it fits
368
+ while (getTextWidth(`...${newValue}`, node) > availableWidth) {
369
+ newValue = newValue.substring(1);
370
+ }
371
+ // replace text with our truncated text
372
+ if (node.value) {
373
+ node.value = `...${newValue}`;
374
+ }
375
+ else {
376
+ node.innerText = `...${newValue}`;
377
+ }
378
+ }
379
+ else {
380
+ if (node.value) {
381
+ node.value = value;
382
+ }
383
+ else {
384
+ node.innerText = value;
385
+ }
386
+ }
387
+ };
388
+ /**
389
+ * @param {React.RefObject<any>[]} timeoutRefs - Timeout refs to clear
390
+ */
391
+ const clearTimeouts = (timeoutRefs) => {
392
+ timeoutRefs.forEach((ref) => {
393
+ if (ref.current) {
394
+ clearTimeout(ref.current);
395
+ }
396
+ });
397
+ };
398
+ /**
399
+ * Helper function to get the language direction of a given element, useful for figuring out if left-to-right
400
+ * or right-to-left specific logic should be applied.
401
+ *
402
+ * @param {HTMLElement} targetElement - Element the helper will get the language direction of
403
+ * @param {'ltr' | 'rtl'} defaultDirection - Language direction to assume if one can't be determined, defaults to 'ltr'
404
+ * @returns {'ltr' | 'rtl'} - The language direction of the target element
405
+ */
406
+ const getLanguageDirection = (targetElement, defaultDirection = 'ltr') => {
407
+ if (!targetElement) {
408
+ return defaultDirection;
409
+ }
410
+ const computedDirection = getComputedStyle(targetElement).getPropertyValue('direction');
411
+ if (['ltr', 'rtl'].includes(computedDirection)) {
412
+ return computedDirection;
413
+ }
414
+ return defaultDirection;
415
+ };
416
+
417
+ let uid = 0;
418
+ const ouiaPrefix = 'OUIA-Generated-';
419
+ const ouiaIdByRoute = {};
420
+ /** Get props to conform to OUIA spec
421
+ *
422
+ * For functional components, use the useOUIAProps function instead
423
+ *
424
+ * In class based components, create a state variable ouiaStateId to create a static generated ID:
425
+ * state = {
426
+ * ouiaStateId: getDefaultOUIAId(Chip.displayName)
427
+ * }
428
+ * This generated ID should remain alive as long as the component is not unmounted.
429
+ *
430
+ * Then add the attributes to the component
431
+ * {...getOUIAProps('OverflowChip', this.props.ouiaId !== undefined ? this.props.ouiaId : this.state.ouiaStateId)}
432
+ *
433
+ * @param {string} componentType OUIA component type
434
+ * @param {number|string} id OUIA component id
435
+ * @param {boolean} ouiaSafe false if in animation
436
+ */
437
+ function getOUIAProps(componentType, id, ouiaSafe = true) {
438
+ return {
439
+ 'data-ouia-component-type': `PF6/${componentType}`,
440
+ 'data-ouia-safe': ouiaSafe,
441
+ 'data-ouia-component-id': id
442
+ };
443
+ }
444
+ /**
445
+ * Hooks version of the getOUIAProps function that also memoizes the generated ID
446
+ * Can only be used in functional components
447
+ *
448
+ * @param {string} componentType OUIA component type
449
+ * @param {number|string} id OUIA component id
450
+ * @param {boolean} ouiaSafe false if in animation
451
+ * @param {string} variant Optional variant to add to the generated ID
452
+ */
453
+ const useOUIAProps = (componentType, id, ouiaSafe = true, variant) => ({
454
+ 'data-ouia-component-type': `PF6/${componentType}`,
455
+ 'data-ouia-safe': ouiaSafe,
456
+ 'data-ouia-component-id': useOUIAId(componentType, id, variant)
457
+ });
458
+ /**
459
+ * Returns the ID or the memoized generated ID
460
+ *
461
+ * @param {string} componentType OUIA component type
462
+ * @param {number|string} id OUIA component id
463
+ * @param {string} variant Optional variant to add to the generated ID
464
+ */
465
+ const useOUIAId = (componentType, id, variant) => {
466
+ const defaultOUIAId = useMemo(() => getDefaultOUIAId(componentType, variant), [componentType, variant]);
467
+ return id !== null && id !== void 0 ? id : defaultOUIAId;
468
+ };
469
+ /**
470
+ * Returns a generated id based on the URL location
471
+ *
472
+ * @param {string} componentType OUIA component type
473
+ * @param {string} variant Optional variant to add to the generated ID
474
+ */
475
+ function getDefaultOUIAId(componentType, variant) {
476
+ /*
477
+ ouiaIdByRoute = {
478
+ [route+componentType]: [number]
479
+ }
480
+ */
481
+ try {
482
+ let key;
483
+ if (typeof window !== 'undefined') {
484
+ // browser environments
485
+ key = `${window.location.href}-${componentType}-${variant || ''}`;
486
+ }
487
+ else {
488
+ // node/SSR environments
489
+ key = `${componentType}-${variant || ''}`;
490
+ }
491
+ if (!ouiaIdByRoute[key]) {
492
+ ouiaIdByRoute[key] = 0;
493
+ }
494
+ return `${ouiaPrefix}${componentType}-${variant ? `${variant}-` : ''}${++ouiaIdByRoute[key]}`;
495
+ }
496
+ catch (exception) {
497
+ return `${ouiaPrefix}${componentType}-${variant ? `${variant}-` : ''}${++uid}`;
498
+ }
499
+ }
500
+
501
+ const styles$2 = {
502
+ "button": "pf-v6-c-button",
503
+ "buttonCount": "pf-v6-c-button__count",
504
+ "buttonIcon": "pf-v6-c-button__icon",
505
+ "buttonProgress": "pf-v6-c-button__progress",
506
+ "modifiers": {
507
+ "primary": "pf-m-primary",
508
+ "unread": "pf-m-unread",
509
+ "secondary": "pf-m-secondary",
510
+ "danger": "pf-m-danger",
511
+ "tertiary": "pf-m-tertiary",
512
+ "link": "pf-m-link",
513
+ "inline": "pf-m-inline",
514
+ "displayLg": "pf-m-display-lg",
515
+ "warning": "pf-m-warning",
516
+ "control": "pf-m-control",
517
+ "stateful": "pf-m-stateful",
518
+ "read": "pf-m-read",
519
+ "attention": "pf-m-attention",
520
+ "plain": "pf-m-plain",
521
+ "noPadding": "pf-m-no-padding",
522
+ "block": "pf-m-block",
523
+ "small": "pf-m-small",
524
+ "favorite": "pf-m-favorite",
525
+ "favorited": "pf-m-favorited",
526
+ "clicked": "pf-m-clicked",
527
+ "disabled": "pf-m-disabled",
528
+ "ariaDisabled": "pf-m-aria-disabled",
529
+ "progress": "pf-m-progress",
530
+ "inProgress": "pf-m-in-progress",
531
+ "notify": "pf-m-notify",
532
+ "start": "pf-m-start",
533
+ "end": "pf-m-end"
534
+ }};
535
+
536
+ const styles$1 = {
537
+ "modifiers": {
538
+ "inline": "pf-m-inline",
539
+ "sm": "pf-m-sm",
540
+ "md": "pf-m-md",
541
+ "lg": "pf-m-lg",
542
+ "xl": "pf-m-xl"
543
+ },
544
+ "spinner": "pf-v6-c-spinner",
545
+ "spinnerPath": "pf-v6-c-spinner__path"
546
+ };
547
+
548
+ const c_spinner_diameter = {
549
+ "name": "--pf-v6-c-spinner--diameter"};
550
+
551
+ var spinnerSize;
552
+ (function (spinnerSize) {
553
+ spinnerSize["sm"] = "sm";
554
+ spinnerSize["md"] = "md";
555
+ spinnerSize["lg"] = "lg";
556
+ spinnerSize["xl"] = "xl";
557
+ })(spinnerSize || (spinnerSize = {}));
558
+ const Spinner = (_a) => {
559
+ var { className = '', size = 'xl', 'aria-valuetext': ariaValueText = 'Loading...', diameter, isInline = false, 'aria-label': ariaLabel, 'aria-labelledBy': ariaLabelledBy } = _a, props = __rest(_a, ["className", "size", 'aria-valuetext', "diameter", "isInline", 'aria-label', 'aria-labelledBy']);
560
+ return (jsx("svg", Object.assign({ className: css(styles$1.spinner, isInline ? styles$1.modifiers.inline : styles$1.modifiers[size], className), role: "progressbar", "aria-valuetext": ariaValueText, viewBox: "0 0 100 100" }, (diameter && { style: { [c_spinner_diameter.name]: diameter } }), (ariaLabel && { 'aria-label': ariaLabel }), (ariaLabelledBy && { 'aria-labelledBy': ariaLabelledBy }), (!ariaLabel && !ariaLabelledBy && { 'aria-label': 'Contents' }), props, { children: jsx("circle", { className: styles$1.spinnerPath, cx: "50", cy: "50", r: "45", fill: "none" }) })));
561
+ };
562
+ Spinner.displayName = 'Spinner';
563
+
564
+ const styles = {
565
+ "badge": "pf-v6-c-badge",
566
+ "modifiers": {
567
+ "read": "pf-m-read",
568
+ "unread": "pf-m-unread",
569
+ "disabled": "pf-m-disabled"
570
+ }
571
+ };
572
+
573
+ const Badge = (_a) => {
574
+ var { isRead = false, isDisabled = false, className = '', children = '', screenReaderText } = _a, props = __rest(_a, ["isRead", "isDisabled", "className", "children", "screenReaderText"]);
575
+ return (jsxs("span", Object.assign({}, props, { className: css(styles.badge, (isRead ? styles.modifiers.read : styles.modifiers.unread), isDisabled && styles.modifiers.disabled, className), children: [children, screenReaderText && jsx("span", { className: "pf-v6-screen-reader", children: screenReaderText })] })));
576
+ };
577
+ Badge.displayName = 'Badge';
578
+
579
+ var ButtonVariant;
580
+ (function (ButtonVariant) {
581
+ ButtonVariant["primary"] = "primary";
582
+ ButtonVariant["secondary"] = "secondary";
583
+ ButtonVariant["tertiary"] = "tertiary";
584
+ ButtonVariant["danger"] = "danger";
585
+ ButtonVariant["warning"] = "warning";
586
+ ButtonVariant["link"] = "link";
587
+ ButtonVariant["plain"] = "plain";
588
+ ButtonVariant["control"] = "control";
589
+ ButtonVariant["stateful"] = "stateful";
590
+ })(ButtonVariant || (ButtonVariant = {}));
591
+ var ButtonType;
592
+ (function (ButtonType) {
593
+ ButtonType["button"] = "button";
594
+ ButtonType["submit"] = "submit";
595
+ ButtonType["reset"] = "reset";
596
+ })(ButtonType || (ButtonType = {}));
597
+ var ButtonSize;
598
+ (function (ButtonSize) {
599
+ ButtonSize["default"] = "default";
600
+ ButtonSize["sm"] = "sm";
601
+ ButtonSize["lg"] = "lg";
602
+ })(ButtonSize || (ButtonSize = {}));
603
+ var ButtonState;
604
+ (function (ButtonState) {
605
+ ButtonState["read"] = "read";
606
+ ButtonState["unread"] = "unread";
607
+ ButtonState["attention"] = "attention";
608
+ })(ButtonState || (ButtonState = {}));
609
+ const ButtonBase = (_a) => {
610
+ var { children = null, className = '', component = 'button', isClicked = false, isBlock = false, isDisabled = false, isAriaDisabled = false, isLoading = null, isDanger = false, spinnerAriaValueText, spinnerAriaLabelledBy, spinnerAriaLabel, size = ButtonSize.default, inoperableEvents = ['onClick', 'onKeyPress'], isInline = false, type = ButtonType.button, variant = ButtonVariant.primary, state = ButtonState.unread, hasNoPadding = false, iconPosition = 'start', 'aria-label': ariaLabel = null, icon = null, role, ouiaId, ouiaSafe = true, tabIndex = null, innerRef, countOptions } = _a, props = __rest(_a, ["children", "className", "component", "isClicked", "isBlock", "isDisabled", "isAriaDisabled", "isLoading", "isDanger", "spinnerAriaValueText", "spinnerAriaLabelledBy", "spinnerAriaLabel", "size", "inoperableEvents", "isInline", "type", "variant", "state", "hasNoPadding", "iconPosition", 'aria-label', "icon", "role", "ouiaId", "ouiaSafe", "tabIndex", "innerRef", "countOptions"]);
611
+ const ouiaProps = useOUIAProps(Button.displayName, ouiaId, ouiaSafe, variant);
612
+ const Component = component;
613
+ const isButtonElement = Component === 'button';
614
+ const isInlineSpan = isInline && Component === 'span';
615
+ const isIconAlignedAtEnd = iconPosition === 'end' || iconPosition === 'right';
616
+ const preventedEvents = inoperableEvents.reduce((handlers, eventToPrevent) => (Object.assign(Object.assign({}, handlers), { [eventToPrevent]: (event) => {
617
+ event.preventDefault();
618
+ } })), {});
619
+ const getDefaultTabIdx = () => {
620
+ if (isDisabled) {
621
+ return isButtonElement ? null : -1;
622
+ }
623
+ else if (isAriaDisabled) {
624
+ return null;
625
+ }
626
+ else if (isInlineSpan) {
627
+ return 0;
628
+ }
629
+ };
630
+ const _icon = icon && (jsx("span", { className: css(styles$2.buttonIcon, children && styles$2.modifiers[isIconAlignedAtEnd ? 'end' : 'start']), children: icon }));
631
+ const _children = children && jsx("span", { className: css('pf-v6-c-button__text'), children: children });
632
+ // We only want to render the aria-disabled attribute when true, similar to the disabled attribute natively.
633
+ const shouldRenderAriaDisabled = isAriaDisabled || (!isButtonElement && isDisabled);
634
+ return (jsxs(Component, Object.assign({}, props, (isAriaDisabled ? preventedEvents : null), (shouldRenderAriaDisabled && { 'aria-disabled': true }), { "aria-label": ariaLabel, className: css(styles$2.button, styles$2.modifiers[variant], isBlock && styles$2.modifiers.block, isDisabled && !isButtonElement && styles$2.modifiers.disabled, isAriaDisabled && styles$2.modifiers.ariaDisabled, isClicked && styles$2.modifiers.clicked, isInline && variant === ButtonVariant.link && styles$2.modifiers.inline, isDanger && (variant === ButtonVariant.secondary || variant === ButtonVariant.link) && styles$2.modifiers.danger, isLoading !== null && variant !== ButtonVariant.plain && styles$2.modifiers.progress, isLoading && styles$2.modifiers.inProgress, hasNoPadding && variant === ButtonVariant.plain && styles$2.modifiers.noPadding, variant === ButtonVariant.stateful && styles$2.modifiers[state], size === ButtonSize.sm && styles$2.modifiers.small, size === ButtonSize.lg && styles$2.modifiers.displayLg, className), disabled: isButtonElement ? isDisabled : null, tabIndex: tabIndex !== null ? tabIndex : getDefaultTabIdx(), type: isButtonElement || isInlineSpan ? type : null, role: isInlineSpan ? 'button' : role, ref: innerRef }, ouiaProps, { children: [isLoading && (jsx("span", { className: css(styles$2.buttonProgress), children: jsx(Spinner, { size: spinnerSize.md, isInline: isInline, "aria-valuetext": spinnerAriaValueText, "aria-label": spinnerAriaLabel, "aria-labelledby": spinnerAriaLabelledBy }) })), isIconAlignedAtEnd ? (jsxs(Fragment, { children: [_children, _icon] })) : (jsxs(Fragment, { children: [_icon, _children] })), countOptions && (jsx("span", { className: css(styles$2.buttonCount, countOptions.className), children: jsx(Badge, { isRead: countOptions.isRead, isDisabled: isDisabled, children: countOptions.count }) }))] })));
635
+ };
636
+ const Button = forwardRef((props, ref) => jsx(ButtonBase, Object.assign({ innerRef: ref }, props)));
637
+ Button.displayName = 'Button';
638
+
639
+ export { Button as B, CheckCircleIcon as C, ExclamationTriangleIcon as E, InfoCircleIcon as I, KeyTypes as K, Spinner as S, ValidatedOptions as V, canUseDOM as a, createIcon as b, css as c, ExclamationCircleIcon as d, getOUIAProps as e, statusIcons as f, getDefaultOUIAId as g, ButtonVariant as h, Badge as i, getVerticalBreakpoint as j, getBreakpoint as k, formatBreakpointMods as l, t_global_breakpoint_2xl as m, t_global_breakpoint_xl as n, t_global_breakpoint_lg as o, t_global_breakpoint_md as p, toCamel as q, getUniqueId as r, setBreakpointCssVars as s, trimLeft as t, useOUIAProps as u, BellIcon as v, getLanguageDirection as w, clearTimeouts as x };