@elastic/eui 81.3.0 → 82.0.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 (26) hide show
  1. package/dist/eui_charts_theme.js.map +1 -1
  2. package/es/components/form/range/range_track.js +21 -7
  3. package/es/components/header/header_links/header_links.js +25 -1
  4. package/es/components/popover/popover.js +25 -1
  5. package/es/components/popover/popover_panel/_popover_panel.js +0 -10
  6. package/es/components/tour/tour_step.js +25 -1
  7. package/es/global_styling/variables/breakpoint.js +2 -1
  8. package/eui.d.ts +99 -14
  9. package/i18ntokens.json +2 -2
  10. package/lib/components/form/range/range_track.js +21 -7
  11. package/lib/components/header/header_links/header_links.js +25 -1
  12. package/lib/components/page/page_content/page_content.js +4 -4
  13. package/lib/components/page/page_template.js +4 -4
  14. package/lib/components/popover/popover_panel/_popover_panel.js +0 -33
  15. package/lib/global_styling/variables/breakpoint.js +2 -1
  16. package/optimize/es/components/form/range/range_track.js +21 -7
  17. package/optimize/es/global_styling/variables/breakpoint.js +2 -1
  18. package/optimize/lib/components/form/range/range_track.js +21 -7
  19. package/optimize/lib/global_styling/variables/breakpoint.js +2 -1
  20. package/package.json +1 -1
  21. package/test-env/components/form/range/range_track.js +21 -7
  22. package/test-env/components/header/header_links/header_links.js +25 -1
  23. package/test-env/components/page/page_content/page_content.js +4 -4
  24. package/test-env/components/page/page_template.js +4 -4
  25. package/test-env/components/popover/popover_panel/_popover_panel.js +0 -33
  26. package/test-env/global_styling/variables/breakpoint.js +2 -1
@@ -48,6 +48,10 @@ export var EuiRangeTrack = function EuiRangeTrack(_ref) {
48
48
  step: step
49
49
  });
50
50
  }, [value, min, max, step]);
51
+ var _useState = useState(0),
52
+ _useState2 = _slicedToArray(_useState, 2),
53
+ trackWidth = _useState2[0],
54
+ setTrackWidth = _useState2[1];
51
55
  var tickSequence = useMemo(function () {
52
56
  if (showTicks !== true) return;
53
57
  var sequence;
@@ -82,18 +86,14 @@ export var EuiRangeTrack = function EuiRangeTrack(_ref) {
82
86
  }
83
87
 
84
88
  // Error out if there are too many ticks to render
85
- if (sequence.length > 20) {
86
- throw new Error("The number of ticks to render is too high (".concat(sequence.length, "), reduce the interval."));
89
+ if (trackWidth && sequence.length) {
90
+ validateTickRenderCount(trackWidth, sequence.length);
87
91
  }
88
92
  return sequence;
89
- }, [showTicks, ticks, min, max, tickInterval, step]);
93
+ }, [showTicks, ticks, min, max, tickInterval, step, trackWidth]);
90
94
  var euiTheme = useEuiTheme();
91
95
  var styles = euiRangeTrackStyles(euiTheme);
92
96
  var cssStyles = [styles.euiRangeTrack, disabled && styles.disabled, levels && !!levels.length && styles.hasLevels, showTicks && (tickSequence || ticks) && styles.hasTicks];
93
- var _useState = useState(0),
94
- _useState2 = _slicedToArray(_useState, 2),
95
- trackWidth = _useState2[0],
96
- setTrackWidth = _useState2[1];
97
97
  var classes = classNames('euiRangeTrack', className);
98
98
  return ___EmotionJSX("div", _extends({
99
99
  className: classes,
@@ -176,4 +176,18 @@ var validateValueIsInStep = function validateValueIsInStep(value, _ref2) {
176
176
  }
177
177
  // Return the value if nothing fails
178
178
  return value;
179
+ };
180
+ var validateTickRenderCount = function validateTickRenderCount(trackWidth, tickCount) {
181
+ var tickWidth = trackWidth / tickCount;
182
+
183
+ // These widths are guesstimations - it's possible we should use actual label content/widths instead
184
+ var COMFORTABLE_TICK_WIDTH = 20; // Set a warning threshold before throwing
185
+ var MIN_TICK_WIDTH = 5; // If ticks are smaller than this, something's gone seriously wrong and we should throw
186
+
187
+ var message = "The number of ticks to render (".concat(tickCount, ") is too high for the range width. Ensure all ticks are visible on the page at multiple screen widths, or use EUI's breakpoint hook utilities to reduce the tick interval responsively.");
188
+ if (tickWidth <= MIN_TICK_WIDTH) {
189
+ throw new Error(message);
190
+ } else if (tickWidth < COMFORTABLE_TICK_WIDTH) {
191
+ console.warn(message);
192
+ }
179
193
  };
@@ -201,7 +201,31 @@ EuiHeaderLinks.propTypes = {
201
201
  /**
202
202
  * Object of props passed to EuiPanel. See #EuiPopoverPanelProps
203
203
  */
204
- panelProps: PropTypes.any,
204
+ panelProps: PropTypes.shape({
205
+ element: PropTypes.oneOf(["div"]),
206
+ /**
207
+ * Padding for all four sides
208
+ */
209
+ paddingSize: PropTypes.any,
210
+ /**
211
+ * Corner border radius
212
+ */
213
+ borderRadius: PropTypes.any,
214
+ /**
215
+ * When true the panel will grow in height to match `EuiFlexItem`
216
+ */
217
+ grow: PropTypes.bool,
218
+ panelRef: PropTypes.any,
219
+ /**
220
+ * Background color of the panel;
221
+ * Usually a lightened form of the brand colors
222
+ */
223
+ color: PropTypes.any,
224
+ className: PropTypes.string,
225
+ "aria-label": PropTypes.string,
226
+ "data-test-subj": PropTypes.string,
227
+ css: PropTypes.any
228
+ }),
205
229
  panelRef: PropTypes.any,
206
230
  /**
207
231
  * Optional screen reader instructions to announce upon popover open,
@@ -625,7 +625,31 @@ EuiPopover.propTypes = {
625
625
  /**
626
626
  * Object of props passed to EuiPanel. See #EuiPopoverPanelProps
627
627
  */
628
- panelProps: PropTypes.any,
628
+ panelProps: PropTypes.shape({
629
+ element: PropTypes.oneOf(["div"]),
630
+ /**
631
+ * Padding for all four sides
632
+ */
633
+ paddingSize: PropTypes.any,
634
+ /**
635
+ * Corner border radius
636
+ */
637
+ borderRadius: PropTypes.any,
638
+ /**
639
+ * When true the panel will grow in height to match `EuiFlexItem`
640
+ */
641
+ grow: PropTypes.bool,
642
+ panelRef: PropTypes.any,
643
+ /**
644
+ * Background color of the panel;
645
+ * Usually a lightened form of the brand colors
646
+ */
647
+ color: PropTypes.any,
648
+ className: PropTypes.string,
649
+ "aria-label": PropTypes.string,
650
+ "data-test-subj": PropTypes.string,
651
+ css: PropTypes.any
652
+ }),
629
653
  panelRef: PropTypes.any,
630
654
  /**
631
655
  * Optional screen reader instructions to announce upon popover open,
@@ -65,16 +65,6 @@ export var EuiPopoverPanel = function EuiPopoverPanel(_ref) {
65
65
  };
66
66
  EuiPopoverPanel.propTypes = {
67
67
  element: PropTypes.oneOf(["div"]),
68
- /**
69
- * Adds a medium shadow to the panel;
70
- * Only works when `color="plain"`
71
- */
72
- hasShadow: PropTypes.bool,
73
- /**
74
- * Adds a slight 1px border on all edges.
75
- * Only works when `color="plain | transparent"`
76
- */
77
- hasBorder: PropTypes.bool,
78
68
  /**
79
69
  * Padding for all four sides
80
70
  */
@@ -287,7 +287,31 @@ EuiTourStep.propTypes = {
287
287
  /**
288
288
  * Object of props passed to EuiPanel. See #EuiPopoverPanelProps
289
289
  */
290
- panelProps: PropTypes.any,
290
+ panelProps: PropTypes.shape({
291
+ element: PropTypes.oneOf(["div"]),
292
+ /**
293
+ * Padding for all four sides
294
+ */
295
+ paddingSize: PropTypes.any,
296
+ /**
297
+ * Corner border radius
298
+ */
299
+ borderRadius: PropTypes.any,
300
+ /**
301
+ * When true the panel will grow in height to match `EuiFlexItem`
302
+ */
303
+ grow: PropTypes.bool,
304
+ panelRef: PropTypes.any,
305
+ /**
306
+ * Background color of the panel;
307
+ * Usually a lightened form of the brand colors
308
+ */
309
+ color: PropTypes.any,
310
+ className: PropTypes.string,
311
+ "aria-label": PropTypes.string,
312
+ "data-test-subj": PropTypes.string,
313
+ css: PropTypes.any
314
+ }),
291
315
  panelRef: PropTypes.any,
292
316
  /**
293
317
  * Optional screen reader instructions to announce upon popover open,
@@ -10,4 +10,5 @@ export var EuiThemeBreakpoints = ['xs', 's', 'm', 'l', 'xl'];
10
10
 
11
11
  // This type cannot be a string enum / must be a generic string
12
12
  // in case consumers add custom breakpoint sizes, such as xxl or xxs
13
- // Set the minimum window width at which to start to the breakpoint
13
+ // Explicitly list out each key so we can document default values
14
+ // via JSDoc (which is available to devs in IDE via intellisense)
package/eui.d.ts CHANGED
@@ -127,7 +127,18 @@ declare module '@elastic/eui/src/services/alignment' {
127
127
  declare module '@elastic/eui/src/global_styling/variables/breakpoint' {
128
128
  export const EuiThemeBreakpoints: readonly ["xs", "s", "m", "l", "xl"];
129
129
  export type _EuiThemeBreakpoint = string;
130
- export type _EuiThemeBreakpoints = Record<_EuiThemeBreakpoint, number>;
130
+ export type _EuiThemeBreakpoints = Record<_EuiThemeBreakpoint, number> & {
131
+ /** - Default value: 0 */
132
+ xs: number;
133
+ /** - Default value: 575 */
134
+ s: number;
135
+ /** - Default value: 768 */
136
+ m: number;
137
+ /** - Default value: 992 */
138
+ l: number;
139
+ /** - Default value: 1200 */
140
+ xl: number;
141
+ };
131
142
 
132
143
  }
133
144
  declare module '@elastic/eui/src/components/common' {
@@ -260,7 +271,18 @@ declare module '@elastic/eui/src/global_styling/variables/animations' {
260
271
  */
261
272
  export const EuiThemeAnimationSpeeds: readonly ["extraFast", "fast", "normal", "slow", "extraSlow"];
262
273
  export type _EuiThemeAnimationSpeed = (typeof EuiThemeAnimationSpeeds)[number];
263
- export type _EuiThemeAnimationSpeeds = Record<_EuiThemeAnimationSpeed, CSSProperties['animationDuration']>;
274
+ export type _EuiThemeAnimationSpeeds = {
275
+ /** - Default value: 90ms */
276
+ extraFast: CSSProperties['animationDuration'];
277
+ /** - Default value: 150ms */
278
+ fast: CSSProperties['animationDuration'];
279
+ /** - Default value: 250ms */
280
+ normal: CSSProperties['animationDuration'];
281
+ /** - Default value: 350ms */
282
+ slow: CSSProperties['animationDuration'];
283
+ /** - Default value: 500ms */
284
+ extraSlow: CSSProperties['animationDuration'];
285
+ };
264
286
  /**
265
287
  * Easings / Timing functions
266
288
  */
@@ -276,20 +298,24 @@ declare module '@elastic/eui/src/global_styling/variables/borders' {
276
298
  export interface _EuiThemeBorderWidthValues {
277
299
  /**
278
300
  * Thinnest width for border
301
+ * - Default value: 1px
279
302
  */
280
303
  thin: CSSProperties['borderWidth'];
281
304
  /**
282
305
  * Thickest width for border
306
+ * - Default value: 2px
283
307
  */
284
308
  thick: CSSProperties['borderWidth'];
285
309
  }
286
310
  export interface _EuiThemeBorderRadiusValues {
287
311
  /**
288
312
  * Primary corner radius size
313
+ * - Default value: 6px
289
314
  */
290
315
  medium: CSSProperties['borderRadius'];
291
316
  /**
292
317
  * Small corner radius size
318
+ * - Default value: 4px
293
319
  */
294
320
  small: CSSProperties['borderRadius'];
295
321
  }
@@ -312,14 +338,17 @@ declare module '@elastic/eui/src/global_styling/variables/borders' {
312
338
  export interface _EuiThemeBorderTypes {
313
339
  /**
314
340
  * Full `border` property string computed using `border.width.thin` and `border.color`
341
+ * - Default value: 1px solid [colors.lightShade]
315
342
  */
316
343
  thin: CSSProperties['border'];
317
344
  /**
318
345
  * Full `border` property string computed using `border.width.thick` and `border.color`
346
+ * - Default value: 2px solid [colors.lightShade]
319
347
  */
320
348
  thick: CSSProperties['border'];
321
349
  /**
322
350
  * Full editable style `border` property string computed using `border.width.thick` and `border.color`
351
+ * - Default value: 2px dotted [colors.lightShade]
323
352
  */
324
353
  editable: CSSProperties['border'];
325
354
  }
@@ -468,7 +497,28 @@ declare module '@elastic/eui/src/global_styling/variables/size' {
468
497
  export type _EuiThemeBase = number;
469
498
  export const EuiThemeSizes: readonly ["xxs", "xs", "s", "m", "base", "l", "xl", "xxl", "xxxl", "xxxxl"];
470
499
  export type _EuiThemeSize = (typeof EuiThemeSizes)[number];
471
- export type _EuiThemeSizes = Record<_EuiThemeSize, string>;
500
+ export type _EuiThemeSizes = {
501
+ /** - Default value: 2px */
502
+ xxs: string;
503
+ /** - Default value: 4px */
504
+ xs: string;
505
+ /** - Default value: 8px */
506
+ s: string;
507
+ /** - Default value: 12px */
508
+ m: string;
509
+ /** - Default value: 16px */
510
+ base: string;
511
+ /** - Default value: 24px */
512
+ l: string;
513
+ /** - Default value: 32px */
514
+ xl: string;
515
+ /** - Default value: 40px */
516
+ xxl: string;
517
+ /** - Default value: 48px */
518
+ xxxl: string;
519
+ /** - Default value: 64px */
520
+ xxxxl: string;
521
+ };
472
522
 
473
523
  }
474
524
  declare module '@elastic/eui/src/global_styling/variables/typography' {
@@ -511,7 +561,18 @@ declare module '@elastic/eui/src/global_styling/variables/typography' {
511
561
  };
512
562
  export const EuiThemeFontWeights: readonly ["light", "regular", "medium", "semiBold", "bold"];
513
563
  export type _EuiThemeFontWeight = (typeof EuiThemeFontWeights)[number];
514
- export type _EuiThemeFontWeights = Record<_EuiThemeFontWeight, CSSProperties['fontWeight']>;
564
+ export type _EuiThemeFontWeights = {
565
+ /** - Default value: 300 */
566
+ light: CSSProperties['fontWeight'];
567
+ /** - Default value: 400 */
568
+ regular: CSSProperties['fontWeight'];
569
+ /** - Default value: 500 */
570
+ medium: CSSProperties['fontWeight'];
571
+ /** - Default value: 600 */
572
+ semiBold: CSSProperties['fontWeight'];
573
+ /** - Default value: 700 */
574
+ bold: CSSProperties['fontWeight'];
575
+ };
515
576
  /**
516
577
  * Body / Base styles
517
578
  */
@@ -536,6 +597,9 @@ declare module '@elastic/eui/src/global_styling/variables/typography' {
536
597
  }
537
598
  export type _EuiThemeFont = _EuiThemeFontBase & {
538
599
  scale: _EuiThemeFontScales;
600
+ /**
601
+ * @see {@link https://eui.elastic.co/#/theming/typography/values%23font-weight | Reference} for more information
602
+ */
539
603
  weight: _EuiThemeFontWeights;
540
604
  body: _EuiThemeBody;
541
605
  title: _EuiThemeTitle;
@@ -558,10 +622,12 @@ declare module '@elastic/eui/src/global_styling/variables/states' {
558
622
  export interface _EuiThemeFocus {
559
623
  /**
560
624
  * Default color of the focus ring, some components may override this property
625
+ * - Default value: currentColor
561
626
  */
562
627
  color: ColorModeSwitch;
563
628
  /**
564
629
  * Thickness of the outline
630
+ * - Default value: 2px
565
631
  */
566
632
  width: CSSProperties['borderWidth'];
567
633
  }
@@ -586,7 +652,26 @@ declare module '@elastic/eui/src/global_styling/variables/levels' {
586
652
  */
587
653
  export const EuiThemeLevels: readonly ["toast", "modal", "mask", "navigation", "menu", "header", "flyout", "maskBelowHeader", "content"];
588
654
  export type _EuiThemeLevel = (typeof EuiThemeLevels)[number];
589
- export type _EuiThemeLevels = Record<_EuiThemeLevel, NonNullable<CSSProperties['zIndex']>>;
655
+ export type _EuiThemeLevels = {
656
+ /** - Default value: 9000 */
657
+ toast: NonNullable<CSSProperties['zIndex']>;
658
+ /** - Default value: 8000 */
659
+ modal: NonNullable<CSSProperties['zIndex']>;
660
+ /** - Default value: 6000 */
661
+ mask: NonNullable<CSSProperties['zIndex']>;
662
+ /** - Default value: 6000 */
663
+ navigation: NonNullable<CSSProperties['zIndex']>;
664
+ /** - Default value: 2000 */
665
+ menu: NonNullable<CSSProperties['zIndex']>;
666
+ /** - Default value: 1000 */
667
+ header: NonNullable<CSSProperties['zIndex']>;
668
+ /** - Default value: 1000 */
669
+ flyout: NonNullable<CSSProperties['zIndex']>;
670
+ /** - Default value: 1000 */
671
+ maskBelowHeader: NonNullable<CSSProperties['zIndex']>;
672
+ /** - Default value: 0 */
673
+ content: NonNullable<CSSProperties['zIndex']>;
674
+ };
590
675
 
591
676
  }
592
677
  declare module '@elastic/eui/src/services/theme/types' {
@@ -615,7 +700,11 @@ declare module '@elastic/eui/src/services/theme/types' {
615
700
  };
616
701
  export type EuiThemeShape = {
617
702
  colors: _EuiThemeColors;
703
+ /** - Default value: 16 */
618
704
  base: _EuiThemeBase;
705
+ /**
706
+ * @see {@link https://eui.elastic.co/#/theming/sizing | Reference} for more information
707
+ */
619
708
  size: _EuiThemeSizes;
620
709
  font: _EuiThemeFont;
621
710
  border: _EuiThemeBorder;
@@ -4650,7 +4739,7 @@ declare module '@elastic/eui/src/components/popover/popover' {
4650
4739
  /**
4651
4740
  * Object of props passed to EuiPanel. See #EuiPopoverPanelProps
4652
4741
  */
4653
- panelProps?: Omit<EuiPopoverPanelProps, 'style'>;
4742
+ panelProps?: Omit<EuiPopoverPanelProps, 'style' | 'hasShadow' | 'hasBorder'>;
4654
4743
  panelRef?: RefCallback<HTMLElement | null>;
4655
4744
  /**
4656
4745
  * Optional screen reader instructions to announce upon popover open,
@@ -7035,7 +7124,7 @@ declare module '@elastic/eui/src/services/theme/hooks' {
7035
7124
 
7036
7125
  }
7037
7126
  declare module '@elastic/eui/src/global_styling/functions/typography' {
7038
- import { _EuiThemeFontScale, _EuiThemeFontSizeMeasurement } from '@elastic/eui/src/global_styling/variables/typography';
7127
+ import { _EuiThemeFontScale, _EuiThemeFontSizeMeasurement, _EuiThemeFontWeights } from '@elastic/eui/src/global_styling/variables/typography';
7039
7128
  import { UseEuiTheme } from '@elastic/eui/src/services/theme/hooks';
7040
7129
  export interface _FontScaleOptions {
7041
7130
  /**
@@ -7076,7 +7165,7 @@ declare module '@elastic/eui/src/global_styling/functions/typography' {
7076
7165
  * this mixin will ensure that the sizing is dependent on the boldest
7077
7166
  * weight so it doesn't shift sibling content.
7078
7167
  */
7079
- export const euiTextShift: (fontWeight: "bold" | "medium" | "light" | "regular" | "semiBold" | undefined, attribute: string | undefined, euiTheme: UseEuiTheme['euiTheme']) => string;
7168
+ export const euiTextShift: (fontWeight: keyof _EuiThemeFontWeights | undefined, attribute: string | undefined, euiTheme: UseEuiTheme['euiTheme']) => string;
7080
7169
 
7081
7170
  }
7082
7171
  declare module '@elastic/eui/src/global_styling/functions' {
@@ -7155,12 +7244,8 @@ declare module '@elastic/eui/src/services/throttle' {
7155
7244
  }
7156
7245
  declare module '@elastic/eui/src/services/breakpoint/_sorting' {
7157
7246
  import { _EuiThemeBreakpoints } from '@elastic/eui/src/global_styling/variables/breakpoint';
7158
- export const sortMapByLargeToSmallValues: (breakpointsMap: _EuiThemeBreakpoints) => {
7159
- [k: string]: number;
7160
- };
7161
- export const sortMapBySmallToLargeValues: (breakpointsMap: _EuiThemeBreakpoints) => {
7162
- [k: string]: number;
7163
- };
7247
+ export const sortMapByLargeToSmallValues: (breakpointsMap: _EuiThemeBreakpoints) => _EuiThemeBreakpoints;
7248
+ export const sortMapBySmallToLargeValues: (breakpointsMap: _EuiThemeBreakpoints) => _EuiThemeBreakpoints;
7164
7249
 
7165
7250
  }
7166
7251
  declare module '@elastic/eui/src/services/breakpoint/current_breakpoint' {
package/i18ntokens.json CHANGED
@@ -5965,12 +5965,12 @@
5965
5965
  "start": {
5966
5966
  "line": 688,
5967
5967
  "column": 16,
5968
- "index": 20062
5968
+ "index": 20090
5969
5969
  },
5970
5970
  "end": {
5971
5971
  "line": 691,
5972
5972
  "column": 18,
5973
- "index": 20256
5973
+ "index": 20284
5974
5974
  }
5975
5975
  },
5976
5976
  "filepath": "src/components/popover/popover.tsx"
@@ -57,6 +57,10 @@ var EuiRangeTrack = function EuiRangeTrack(_ref) {
57
57
  step: step
58
58
  });
59
59
  }, [value, min, max, step]);
60
+ var _useState = (0, _react.useState)(0),
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ trackWidth = _useState2[0],
63
+ setTrackWidth = _useState2[1];
60
64
  var tickSequence = (0, _react.useMemo)(function () {
61
65
  if (showTicks !== true) return;
62
66
  var sequence;
@@ -91,18 +95,14 @@ var EuiRangeTrack = function EuiRangeTrack(_ref) {
91
95
  }
92
96
 
93
97
  // Error out if there are too many ticks to render
94
- if (sequence.length > 20) {
95
- throw new Error("The number of ticks to render is too high (".concat(sequence.length, "), reduce the interval."));
98
+ if (trackWidth && sequence.length) {
99
+ validateTickRenderCount(trackWidth, sequence.length);
96
100
  }
97
101
  return sequence;
98
- }, [showTicks, ticks, min, max, tickInterval, step]);
102
+ }, [showTicks, ticks, min, max, tickInterval, step, trackWidth]);
99
103
  var euiTheme = (0, _services.useEuiTheme)();
100
104
  var styles = (0, _range_track.euiRangeTrackStyles)(euiTheme);
101
105
  var cssStyles = [styles.euiRangeTrack, disabled && styles.disabled, levels && !!levels.length && styles.hasLevels, showTicks && (tickSequence || ticks) && styles.hasTicks];
102
- var _useState = (0, _react.useState)(0),
103
- _useState2 = _slicedToArray(_useState, 2),
104
- trackWidth = _useState2[0],
105
- setTrackWidth = _useState2[1];
106
106
  var classes = (0, _classnames.default)('euiRangeTrack', className);
107
107
  return (0, _react2.jsx)("div", _extends({
108
108
  className: classes,
@@ -186,4 +186,18 @@ var validateValueIsInStep = function validateValueIsInStep(value, _ref2) {
186
186
  }
187
187
  // Return the value if nothing fails
188
188
  return value;
189
+ };
190
+ var validateTickRenderCount = function validateTickRenderCount(trackWidth, tickCount) {
191
+ var tickWidth = trackWidth / tickCount;
192
+
193
+ // These widths are guesstimations - it's possible we should use actual label content/widths instead
194
+ var COMFORTABLE_TICK_WIDTH = 20; // Set a warning threshold before throwing
195
+ var MIN_TICK_WIDTH = 5; // If ticks are smaller than this, something's gone seriously wrong and we should throw
196
+
197
+ var message = "The number of ticks to render (".concat(tickCount, ") is too high for the range width. Ensure all ticks are visible on the page at multiple screen widths, or use EUI's breakpoint hook utilities to reduce the tick interval responsively.");
198
+ if (tickWidth <= MIN_TICK_WIDTH) {
199
+ throw new Error(message);
200
+ } else if (tickWidth < COMFORTABLE_TICK_WIDTH) {
201
+ console.warn(message);
202
+ }
189
203
  };
@@ -212,7 +212,31 @@ EuiHeaderLinks.propTypes = {
212
212
  /**
213
213
  * Object of props passed to EuiPanel. See #EuiPopoverPanelProps
214
214
  */
215
- panelProps: _propTypes.default.any,
215
+ panelProps: _propTypes.default.shape({
216
+ element: _propTypes.default.oneOf(["div"]),
217
+ /**
218
+ * Padding for all four sides
219
+ */
220
+ paddingSize: _propTypes.default.any,
221
+ /**
222
+ * Corner border radius
223
+ */
224
+ borderRadius: _propTypes.default.any,
225
+ /**
226
+ * When true the panel will grow in height to match `EuiFlexItem`
227
+ */
228
+ grow: _propTypes.default.bool,
229
+ panelRef: _propTypes.default.any,
230
+ /**
231
+ * Background color of the panel;
232
+ * Usually a lightened form of the brand colors
233
+ */
234
+ color: _propTypes.default.any,
235
+ className: _propTypes.default.string,
236
+ "aria-label": _propTypes.default.string,
237
+ "data-test-subj": _propTypes.default.string,
238
+ css: _propTypes.default.any
239
+ }),
216
240
  panelRef: _propTypes.default.any,
217
241
  /**
218
242
  * Optional screen reader instructions to announce upon popover open,
@@ -53,10 +53,10 @@ var EuiPageContent_Deprecated = function EuiPageContent_Deprecated(_ref) {
53
53
  };
54
54
  exports.EuiPageContent_Deprecated = EuiPageContent_Deprecated;
55
55
  EuiPageContent_Deprecated.propTypes = {
56
- className: _propTypes.default.string,
57
- "aria-label": _propTypes.default.string,
58
- "data-test-subj": _propTypes.default.string,
59
- css: _propTypes.default.any,
56
+ className: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]), _propTypes.default.string]),
57
+ "aria-label": _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]), _propTypes.default.string]),
58
+ "data-test-subj": _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]), _propTypes.default.string]),
59
+ css: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.any, _propTypes.default.any]), _propTypes.default.any]),
60
60
  /**
61
61
  * Adds a medium shadow to the panel;
62
62
  * Only works when `color="plain"`
@@ -421,10 +421,10 @@ EuiPageTemplate_Deprecated.propTypes = {
421
421
  * Gets passed along to the #EuiPageContent component
422
422
  */
423
423
  pageContentProps: _propTypes.default.shape({
424
- className: _propTypes.default.string,
425
- "aria-label": _propTypes.default.string,
426
- "data-test-subj": _propTypes.default.string,
427
- css: _propTypes.default.any,
424
+ className: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]), _propTypes.default.string]),
425
+ "aria-label": _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]), _propTypes.default.string]),
426
+ "data-test-subj": _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]), _propTypes.default.string]),
427
+ css: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.any, _propTypes.default.any]), _propTypes.default.any]),
428
428
  /**
429
429
  * Adds a medium shadow to the panel;
430
430
  * Only works when `color="plain"`
@@ -75,39 +75,6 @@ var EuiPopoverPanel = function EuiPopoverPanel(_ref) {
75
75
  };
76
76
  exports.EuiPopoverPanel = EuiPopoverPanel;
77
77
  EuiPopoverPanel.propTypes = {
78
- element: _propTypes.default.oneOf(["div"]),
79
- /**
80
- * Adds a medium shadow to the panel;
81
- * Only works when `color="plain"`
82
- */
83
- hasShadow: _propTypes.default.bool,
84
- /**
85
- * Adds a slight 1px border on all edges.
86
- * Only works when `color="plain | transparent"`
87
- */
88
- hasBorder: _propTypes.default.bool,
89
- /**
90
- * Padding for all four sides
91
- */
92
- paddingSize: _propTypes.default.any,
93
- /**
94
- * Corner border radius
95
- */
96
- borderRadius: _propTypes.default.any,
97
- /**
98
- * When true the panel will grow in height to match `EuiFlexItem`
99
- */
100
- grow: _propTypes.default.bool,
101
- panelRef: _propTypes.default.any,
102
- /**
103
- * Background color of the panel;
104
- * Usually a lightened form of the brand colors
105
- */
106
- color: _propTypes.default.any,
107
- className: _propTypes.default.string,
108
- "aria-label": _propTypes.default.string,
109
- "data-test-subj": _propTypes.default.string,
110
- css: _propTypes.default.any,
111
78
  isOpen: _propTypes.default.bool,
112
79
  isAttached: _propTypes.default.bool,
113
80
  position: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.oneOf([null])]),
@@ -17,5 +17,6 @@ var EuiThemeBreakpoints = ['xs', 's', 'm', 'l', 'xl'];
17
17
  // This type cannot be a string enum / must be a generic string
18
18
  // in case consumers add custom breakpoint sizes, such as xxl or xxs
19
19
 
20
- // Set the minimum window width at which to start to the breakpoint
20
+ // Explicitly list out each key so we can document default values
21
+ // via JSDoc (which is available to devs in IDE via intellisense)
21
22
  exports.EuiThemeBreakpoints = EuiThemeBreakpoints;
@@ -41,6 +41,10 @@ export var EuiRangeTrack = function EuiRangeTrack(_ref) {
41
41
  step: step
42
42
  });
43
43
  }, [value, min, max, step]);
44
+ var _useState = useState(0),
45
+ _useState2 = _slicedToArray(_useState, 2),
46
+ trackWidth = _useState2[0],
47
+ setTrackWidth = _useState2[1];
44
48
  var tickSequence = useMemo(function () {
45
49
  if (showTicks !== true) return;
46
50
  var sequence;
@@ -75,18 +79,14 @@ export var EuiRangeTrack = function EuiRangeTrack(_ref) {
75
79
  }
76
80
 
77
81
  // Error out if there are too many ticks to render
78
- if (sequence.length > 20) {
79
- throw new Error("The number of ticks to render is too high (".concat(sequence.length, "), reduce the interval."));
82
+ if (trackWidth && sequence.length) {
83
+ validateTickRenderCount(trackWidth, sequence.length);
80
84
  }
81
85
  return sequence;
82
- }, [showTicks, ticks, min, max, tickInterval, step]);
86
+ }, [showTicks, ticks, min, max, tickInterval, step, trackWidth]);
83
87
  var euiTheme = useEuiTheme();
84
88
  var styles = euiRangeTrackStyles(euiTheme);
85
89
  var cssStyles = [styles.euiRangeTrack, disabled && styles.disabled, levels && !!levels.length && styles.hasLevels, showTicks && (tickSequence || ticks) && styles.hasTicks];
86
- var _useState = useState(0),
87
- _useState2 = _slicedToArray(_useState, 2),
88
- trackWidth = _useState2[0],
89
- setTrackWidth = _useState2[1];
90
90
  var classes = classNames('euiRangeTrack', className);
91
91
  return ___EmotionJSX("div", _extends({
92
92
  className: classes,
@@ -132,4 +132,18 @@ var validateValueIsInStep = function validateValueIsInStep(value, _ref2) {
132
132
  }
133
133
  // Return the value if nothing fails
134
134
  return value;
135
+ };
136
+ var validateTickRenderCount = function validateTickRenderCount(trackWidth, tickCount) {
137
+ var tickWidth = trackWidth / tickCount;
138
+
139
+ // These widths are guesstimations - it's possible we should use actual label content/widths instead
140
+ var COMFORTABLE_TICK_WIDTH = 20; // Set a warning threshold before throwing
141
+ var MIN_TICK_WIDTH = 5; // If ticks are smaller than this, something's gone seriously wrong and we should throw
142
+
143
+ var message = "The number of ticks to render (".concat(tickCount, ") is too high for the range width. Ensure all ticks are visible on the page at multiple screen widths, or use EUI's breakpoint hook utilities to reduce the tick interval responsively.");
144
+ if (tickWidth <= MIN_TICK_WIDTH) {
145
+ throw new Error(message);
146
+ } else if (tickWidth < COMFORTABLE_TICK_WIDTH) {
147
+ console.warn(message);
148
+ }
135
149
  };
@@ -10,4 +10,5 @@ export var EuiThemeBreakpoints = ['xs', 's', 'm', 'l', 'xl'];
10
10
 
11
11
  // This type cannot be a string enum / must be a generic string
12
12
  // in case consumers add custom breakpoint sizes, such as xxl or xxs
13
- // Set the minimum window width at which to start to the breakpoint
13
+ // Explicitly list out each key so we can document default values
14
+ // via JSDoc (which is available to devs in IDE via intellisense)