@ember-eui/core 5.8.5 → 5.10.2

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 (72) hide show
  1. package/addon/components/eui-checkbox-group/index.hbs +8 -0
  2. package/addon/components/eui-combo-box/index.hbs +1 -1
  3. package/addon/components/eui-combo-box/options/index.hbs +1 -0
  4. package/addon/components/eui-dual-range/index.ts +2 -2
  5. package/addon/components/eui-field-text/index.hbs +1 -0
  6. package/addon/components/eui-global-toast-list/index.ts +1 -1
  7. package/addon/components/eui-i18n/index.ts +9 -41
  8. package/addon/components/eui-icon/index.ts +2 -2
  9. package/addon/components/eui-markdown-editor/index.ts +2 -2
  10. package/addon/components/eui-portal/index.ts +2 -2
  11. package/addon/components/eui-range/index.ts +2 -2
  12. package/addon/components/eui-super-date-picker/date-popover/absolute-tab.hbs +42 -0
  13. package/addon/components/eui-super-date-picker/date-popover/absolute-tab.ts +79 -0
  14. package/addon/components/eui-super-date-picker/date-popover/datetime-picker.hbs +125 -0
  15. package/addon/components/eui-super-date-picker/date-popover/datetime-picker.ts +258 -0
  16. package/addon/components/eui-super-date-picker/date-popover/eui-date-popover-button.hbs +49 -0
  17. package/addon/components/eui-super-date-picker/date-popover/eui-date-popover-button.ts +49 -0
  18. package/addon/components/eui-super-date-picker/date-popover/eui-date-popover-content.hbs +42 -0
  19. package/addon/components/eui-super-date-picker/date-popover/eui-date-popover-content.ts +73 -0
  20. package/addon/components/eui-super-date-picker/date-popover/now-tab.hbs +45 -0
  21. package/addon/components/eui-super-date-picker/date-popover/relative-tab.hbs +47 -0
  22. package/addon/components/eui-super-date-picker/date-popover/relative-tab.ts +89 -0
  23. package/addon/components/eui-super-date-picker/eui-date-picker-range.hbs +22 -0
  24. package/addon/components/eui-super-date-picker/eui-quick-select-popover/eui-commonly-used-time-ranges.hbs +42 -0
  25. package/addon/components/eui-super-date-picker/eui-quick-select-popover/eui-quick-select.hbs +154 -0
  26. package/addon/components/eui-super-date-picker/eui-quick-select-popover/eui-quick-select.ts +103 -0
  27. package/addon/components/eui-super-date-picker/eui-quick-select-popover/eui-recently-used.hbs +48 -0
  28. package/addon/components/eui-super-date-picker/eui-quick-select-popover/index.hbs +60 -0
  29. package/addon/components/eui-super-date-picker/eui-quick-select-popover/index.ts +34 -0
  30. package/addon/components/eui-super-date-picker/eui-super-update-button.hbs +43 -0
  31. package/addon/components/eui-super-date-picker/index.hbs +123 -0
  32. package/addon/components/eui-super-date-picker/index.ts +220 -0
  33. package/addon/components/eui-super-date-picker/types/global.d.ts +52 -0
  34. package/addon/components/eui-super-date-picker/utils/date-utils.ts +59 -0
  35. package/addon/components/eui-super-date-picker/utils/index.ts +181 -0
  36. package/addon/components/eui-super-date-picker/utils/pretty-duration.ts +131 -0
  37. package/addon/components/eui-super-date-picker/utils/quick-select.ts +75 -0
  38. package/addon/components/eui-super-date-picker/utils/time-options.ts +216 -0
  39. package/addon/components/eui-tool-tip/index.ts +2 -2
  40. package/addon/components/text-block/index.hbs +25 -21
  41. package/addon/{components/eui-i18n → i18n}/util.ts +1 -6
  42. package/addon/modifiers/outside-click-detector.ts +2 -2
  43. package/addon/services/eui-i18n.ts +89 -0
  44. package/addon/utils/markdown/markdown-unified-plugins.d.ts +0 -14
  45. package/app/components/eui-super-date-picker/date-popover/absolute-tab.js +1 -0
  46. package/app/components/eui-super-date-picker/date-popover/datetime-picker.js +1 -0
  47. package/app/components/eui-super-date-picker/date-popover/eui-date-popover-button.js +1 -0
  48. package/app/components/eui-super-date-picker/date-popover/eui-date-popover-content.js +1 -0
  49. package/app/components/eui-super-date-picker/date-popover/now-tab.js +1 -0
  50. package/app/components/eui-super-date-picker/date-popover/relative-tab.js +1 -0
  51. package/app/components/eui-super-date-picker/eui-date-picker-range.js +1 -0
  52. package/app/components/eui-super-date-picker/eui-quick-select-popover/eui-commonly-used-time-ranges.js +1 -0
  53. package/app/components/eui-super-date-picker/eui-quick-select-popover/eui-quick-select.js +1 -0
  54. package/app/components/eui-super-date-picker/eui-quick-select-popover/eui-recently-used.js +1 -0
  55. package/app/components/eui-super-date-picker/eui-quick-select-popover/index.js +1 -0
  56. package/app/components/eui-super-date-picker/eui-super-update-button.js +1 -0
  57. package/app/components/eui-super-date-picker/index.js +1 -0
  58. package/app/services/eui-i18n.js +1 -0
  59. package/docs/forms/super-date-picker/demo/d01-picker.md +90 -0
  60. package/docs/forms/super-date-picker/index.md +16 -0
  61. package/package.json +7 -3
  62. package/tsconfig.json +1 -0
  63. package/addon/helpers/unique-id.ts +0 -23
  64. package/addon/i18n/index.ts +0 -8
  65. package/app/helpers/unique-id.js +0 -1
  66. package/app/i18n/index.js +0 -1
  67. package/docs/templates/super-date-picker/demo/d01-update-button.md +0 -10
  68. package/docs/templates/super-date-picker/demo/d02-quick-select-panels.md +0 -10
  69. package/docs/templates/super-date-picker/demo/d03-sizing.md +0 -10
  70. package/docs/templates/super-date-picker/demo/d04-auto-refresh.md +0 -11
  71. package/docs/templates/super-date-picker/demo/d05-elastic-pattern-with-kql.md +0 -10
  72. package/docs/templates/super-date-picker/index.md +0 -12
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+
9
+ import moment from 'moment';
10
+ import dateMath from '@elastic/datemath';
11
+ import { LAST, NEXT } from './time-options';
12
+ import { DATE_MODES, relativeUnitsFromLargestToSmallest } from '.';
13
+ import { QuickSelect, TimeUnitId } from '../types/global';
14
+
15
+ const isNow = (value: string) => value === DATE_MODES.NOW;
16
+
17
+ /**
18
+ * This function returns time value, time unit and time tense for a given time string.
19
+ *
20
+ * For example: for `now-40m` it will parse output as time value to `40` time unit to `m` and time unit to `last`.
21
+ *
22
+ * If given a datetime string it will return a default value.
23
+ *
24
+ * If the given string is in the format such as `now/d` it will parse the string to moment object and find the time value, time unit and time tense using moment
25
+ *
26
+ * This function accepts two strings start and end time. I the start value is now then it uses the end value to parse.
27
+ */
28
+ export const parseTimeParts = (start: string, end: string): QuickSelect => {
29
+ const results: QuickSelect = {
30
+ timeTense: LAST,
31
+ timeUnits: 'm',
32
+ timeValue: 15
33
+ };
34
+
35
+ const value = isNow(start) ? end : start;
36
+
37
+ const matches =
38
+ typeof value === 'string' &&
39
+ value.match(/now(([-+])(\d+)([smhdwMy])(\/[smhdwMy])?)?/);
40
+
41
+ if (!matches) {
42
+ return results;
43
+ }
44
+
45
+ const operator = matches[2];
46
+ const matchedTimeValue = matches[3];
47
+ const timeUnits = matches[4] as TimeUnitId;
48
+
49
+ if (matchedTimeValue && timeUnits && operator) {
50
+ return {
51
+ timeTense: operator === '+' ? NEXT : LAST,
52
+ timeUnits,
53
+ timeValue: parseInt(matchedTimeValue, 10)
54
+ };
55
+ }
56
+
57
+ const duration = moment.duration(moment().diff(dateMath.parse(value)));
58
+ let unitOp = '';
59
+ for (let i = 0; i < relativeUnitsFromLargestToSmallest.length; i++) {
60
+ // @ts-expect-error this is a string with the accepted time units
61
+ const as = duration.as(relativeUnitsFromLargestToSmallest[i]);
62
+ if (as < 0) {
63
+ unitOp = '+';
64
+ }
65
+ if (Math.abs(as) > 1) {
66
+ return {
67
+ timeValue: Math.round(Math.abs(as)),
68
+ timeUnits: relativeUnitsFromLargestToSmallest[i] as TimeUnitId,
69
+ timeTense: unitOp === '+' ? NEXT : LAST
70
+ };
71
+ }
72
+ }
73
+
74
+ return results;
75
+ };
@@ -0,0 +1,216 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import { EuiSelectOption } from '@elastic/eui';
9
+ import type EuiI18n from '../../../services/eui-i18n';
10
+
11
+ import { TimeUnitId, RelativeOption, DurationRange } from '../types/global';
12
+
13
+ export const LAST = 'last';
14
+ export const NEXT = 'next';
15
+
16
+ export type TimeOptions = {
17
+ timeTenseOptions: EuiSelectOption[];
18
+ timeUnitsOptions: EuiSelectOption[];
19
+ relativeOptions: RelativeOption[];
20
+ relativeRoundingLabels: { [id in TimeUnitId]: string };
21
+ refreshUnitsOptions: EuiSelectOption[];
22
+ commonDurationRanges: DurationRange[];
23
+ };
24
+
25
+ /**
26
+ * i18n'd time options, mostly used in EuiSelects (except for a few cases)
27
+ * used in EuiSuperDatePicker child sub-components
28
+ */
29
+ export const useI18nTimeOptions = (euiI18nService: EuiI18n): TimeOptions => {
30
+ let lookupToken = euiI18nService.lookupToken;
31
+
32
+ /**
33
+ * Quick select panel
34
+ */
35
+ const timeTenseOptions = [
36
+ { value: LAST, text: lookupToken('euiTimeOptions.last', 'Last') },
37
+ { value: NEXT, text: lookupToken('euiTimeOptions.next', 'Next') }
38
+ ];
39
+
40
+ const timeUnitsOptions = [
41
+ { value: 's', text: lookupToken('euiTimeOptions.seconds', 'Seconds') },
42
+ { value: 'm', text: lookupToken('euiTimeOptions.minutes', 'Minutes') },
43
+ { value: 'h', text: lookupToken('euiTimeOptions.hours', 'Hours') },
44
+ { value: 'd', text: lookupToken('euiTimeOptions.days', 'Days') },
45
+ { value: 'w', text: lookupToken('euiTimeOptions.weeks', 'Weeks') },
46
+ { value: 'M', text: lookupToken('euiTimeOptions.months', 'Months') },
47
+ { value: 'y', text: lookupToken('euiTimeOptions.years', 'Years') }
48
+ ];
49
+
50
+ /**
51
+ * Relative tab
52
+ */
53
+ const relativeOptions: RelativeOption[] = [
54
+ {
55
+ text: lookupToken('euiTimeOptions.secondsAgo', 'Seconds ago') as string,
56
+ value: 's'
57
+ },
58
+ {
59
+ text: lookupToken('euiTimeOptions.minutesAgo', 'Minutes ago') as string,
60
+ value: 'm'
61
+ },
62
+ {
63
+ text: lookupToken('euiTimeOptions.hoursAgo', 'Hours ago') as string,
64
+ value: 'h'
65
+ },
66
+ {
67
+ text: lookupToken('euiTimeOptions.daysAgo', 'Days ago') as string,
68
+ value: 'd'
69
+ },
70
+ {
71
+ text: lookupToken('euiTimeOptions.weeksAgo', 'Weeks ago') as string,
72
+ value: 'w'
73
+ },
74
+ {
75
+ text: lookupToken('euiTimeOptions.monthsAgo', 'Months ago') as string,
76
+ value: 'M'
77
+ },
78
+ {
79
+ text: lookupToken('euiTimeOptions.yearsAgo', 'Years ago') as string,
80
+ value: 'y'
81
+ },
82
+ {
83
+ text: lookupToken(
84
+ 'euiTimeOptions.secondsFromNow',
85
+ 'Seconds from now'
86
+ ) as string,
87
+ value: 's+'
88
+ },
89
+ {
90
+ text: lookupToken(
91
+ 'euiTimeOptions.minutesFromNow',
92
+ 'Minutes from now'
93
+ ) as string,
94
+ value: 'm+'
95
+ },
96
+ {
97
+ text: lookupToken(
98
+ 'euiTimeOptions.hoursFromNow',
99
+ 'Hours from now'
100
+ ) as string,
101
+ value: 'h+'
102
+ },
103
+ {
104
+ text: lookupToken(
105
+ 'euiTimeOptions.daysFromNow',
106
+ 'Days from now'
107
+ ) as string,
108
+ value: 'd+'
109
+ },
110
+ {
111
+ text: lookupToken(
112
+ 'euiTimeOptions.weeksFromNow',
113
+ 'Weeks from now'
114
+ ) as string,
115
+ value: 'w+'
116
+ },
117
+ {
118
+ text: lookupToken(
119
+ 'euiTimeOptions.monthsFromNow',
120
+ 'Months from now'
121
+ ) as string,
122
+ value: 'M+'
123
+ },
124
+ {
125
+ text: lookupToken(
126
+ 'euiTimeOptions.yearsFromNow',
127
+ 'Years from now'
128
+ ) as string,
129
+ value: 'y+'
130
+ }
131
+ ];
132
+
133
+ const relativeRoundingLabels = {
134
+ s: lookupToken(
135
+ 'euiTimeOptions.roundToSecond',
136
+ 'Round to the second'
137
+ ) as string,
138
+ m: lookupToken(
139
+ 'euiTimeOptions.roundToMinute',
140
+ 'Round to the minute'
141
+ ) as string,
142
+ h: lookupToken('euiTimeOptions.roundToHour', 'Round to the hour') as string,
143
+ d: lookupToken('euiTimeOptions.roundToDay', 'Round to the day') as string,
144
+ w: lookupToken('euiTimeOptions.roundToWeek', 'Round to the week') as string,
145
+ M: lookupToken(
146
+ 'euiTimeOptions.roundToMonth',
147
+ 'Round to the month'
148
+ ) as string,
149
+ y: lookupToken('euiTimeOptions.roundToYear', 'Round to the year') as string
150
+ };
151
+
152
+ /**
153
+ * Auto Refresh
154
+ */
155
+ const refreshUnitsOptions = timeUnitsOptions.filter(
156
+ ({ value }) => value === 'h' || value === 'm' || value === 's'
157
+ );
158
+
159
+ /**
160
+ * Used by both Quick Select ('Commonly used') and by PrettyDuration
161
+ */
162
+ const commonDurationRanges = [
163
+ {
164
+ start: 'now/d',
165
+ end: 'now/d',
166
+ label: lookupToken('euiTimeOptions.today', 'Today') as string
167
+ },
168
+ {
169
+ start: 'now/w',
170
+ end: 'now/w',
171
+ label: lookupToken('euiTimeOptions.thisWeek', 'This week') as string
172
+ },
173
+ {
174
+ start: 'now/M',
175
+ end: 'now/M',
176
+ label: lookupToken('euiTimeOptions.thisMonth', 'This month') as string
177
+ },
178
+ {
179
+ start: 'now/y',
180
+ end: 'now/y',
181
+ label: lookupToken('euiTimeOptions.thisYear', 'This year') as string
182
+ },
183
+ {
184
+ start: 'now-1d/d',
185
+ end: 'now-1d/d',
186
+ label: lookupToken('euiTimeOptions.yesterday', 'Yesterday') as string
187
+ },
188
+ {
189
+ start: 'now/w',
190
+ end: 'now',
191
+ label: lookupToken('euiTimeOptions.weekToDate', 'Week to date') as string
192
+ },
193
+ {
194
+ start: 'now/M',
195
+ end: 'now',
196
+ label: lookupToken(
197
+ 'euiTimeOptions.monthToDate',
198
+ 'Month to date'
199
+ ) as string
200
+ },
201
+ {
202
+ start: 'now/y',
203
+ end: 'now',
204
+ label: lookupToken('euiTimeOptions.yearToDate', 'Year to date') as string
205
+ }
206
+ ];
207
+
208
+ return {
209
+ timeTenseOptions,
210
+ timeUnitsOptions,
211
+ relativeOptions,
212
+ relativeRoundingLabels,
213
+ refreshUnitsOptions,
214
+ commonDurationRanges
215
+ };
216
+ };
@@ -1,11 +1,11 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
3
  import { argOrDefaultDecorator as argOrDefault } from '../../helpers/arg-or-default';
4
- import { uniqueId } from '../../helpers/unique-id';
5
4
  import { tracked, cached } from '@glimmer/tracking';
6
5
  import { findPopoverPosition } from '../../utils/popover';
7
6
  import { keys } from '../../utils/keys';
8
7
  import { later, cancel, scheduleOnce, next } from '@ember/runloop';
8
+ import { guidFor } from '@ember/object/internals';
9
9
 
10
10
  export type ToolTipPositions = 'top' | 'right' | 'bottom' | 'left';
11
11
 
@@ -104,7 +104,7 @@ export default class EuiToolTip extends Component<EuiTooltipArgs> {
104
104
  @tracked calculatedPosition: ToolTipPositions = this.position;
105
105
  @tracked toolTipStyles: ToolTipStyles = DEFAULT_TOOLTIP_STYLES;
106
106
  @tracked arrowStyles: undefined | { left: string; top: string };
107
- @tracked id: string = this.args.id || uniqueId();
107
+ @tracked id: string = this.args.id || guidFor({});
108
108
  @tracked _attachTo: undefined | HTMLElement | string | null = null;
109
109
 
110
110
  private timeoutId?: ReturnType<typeof later>;
@@ -1,29 +1,33 @@
1
1
  {{#if (eq @tagName "h1")}}
2
- <h1 ...attributes>
3
- {{yield}}
4
- </h1>
2
+ <h1 ...attributes>
3
+ {{yield}}
4
+ </h1>
5
5
  {{else if (eq @tagName "h2")}}
6
- <h2 ...attributes>
7
- {{yield}}
8
- </h2>
6
+ <h2 ...attributes>
7
+ {{yield}}
8
+ </h2>
9
9
  {{else if (eq @tagName "h3")}}
10
- <h3 ...attributes>
11
- {{yield}}
12
- </h3>
10
+ <h3 ...attributes>
11
+ {{yield}}
12
+ </h3>
13
13
  {{else if (eq @tagName "h4")}}
14
- <h4 ...attributes>
15
- {{yield}}
16
- </h4>
14
+ <h4 ...attributes>
15
+ {{yield}}
16
+ </h4>
17
17
  {{else if (eq @tagName "h5")}}
18
- <h5 ...attributes>
19
- {{yield}}
20
- </h5>
18
+ <h5 ...attributes>
19
+ {{yield}}
20
+ </h5>
21
21
  {{else if (eq @tagName "h6")}}
22
- <h6 ...attributes>
23
- {{yield}}
24
- </h6>
22
+ <h6 ...attributes>
23
+ {{yield}}
24
+ </h6>
25
25
  {{else if (eq @tagName "p")}}
26
- <p ...attributes>
27
- {{yield}}
28
- </p>
26
+ <p ...attributes>
27
+ {{yield}}
28
+ </p>
29
+ {{else if (eq @tagName "legend")}}
30
+ <legend ...attributes>
31
+ {{yield}}
32
+ </legend>
29
33
  {{/if}}
@@ -6,12 +6,7 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
 
9
- import {
10
- isBoolean,
11
- isString,
12
- isNumber,
13
- isUndefined
14
- } from '../../utils/predicate';
9
+ import { isBoolean, isString, isNumber, isUndefined } from '../utils/predicate';
15
10
  import { get } from '@ember/object';
16
11
  import { assert } from '@ember/debug';
17
12
 
@@ -1,5 +1,5 @@
1
1
  import Modifier from 'ember-modifier';
2
- import { uniqueId } from '../helpers/unique-id';
2
+ import { guidFor } from '@ember/object/internals';
3
3
  import { action } from '@ember/object';
4
4
 
5
5
  interface OutsideClickDetectorModifierArgs {
@@ -46,7 +46,7 @@ export default class OutsideClickDetector extends Modifier<OutsideClickDetectorM
46
46
  }
47
47
 
48
48
  didInstall(): void {
49
- this.id = uniqueId();
49
+ this.id = guidFor({});
50
50
  document.addEventListener('mouseup', this.onClickOutside);
51
51
  document.addEventListener('touchend', this.onClickOutside);
52
52
  this.addElementEvents();
@@ -0,0 +1,89 @@
1
+ import Service from '@ember/service';
2
+ import { action } from '@ember/object';
3
+ import { processStringToChildren } from '../i18n/util';
4
+
5
+ interface LookupTokenOptions {
6
+ token: string;
7
+ i18nMapping?: Record<string, string>;
8
+ valueDefault: string | ((values: Record<string, unknown>) => string);
9
+ values?: Record<string, unknown>;
10
+ }
11
+
12
+ function flatten(
13
+ acc: Record<string, unknown> = {},
14
+ obj: Record<string, unknown>,
15
+ path = ''
16
+ ) {
17
+ path = path.length > 0 ? path + '.' : path;
18
+
19
+ for (const key in obj) {
20
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
21
+ flatten(acc, obj[key] as Record<string, unknown>, path + key);
22
+ } else {
23
+ acc[path + key] = obj[key];
24
+ }
25
+ }
26
+ return acc;
27
+ }
28
+
29
+ export default class EuiI18n extends Service {
30
+ translations = {};
31
+ @action addTranslations(translations: Record<string, unknown>) {
32
+ // TODO: deep merge?
33
+ this.translations = {
34
+ ...this.translations,
35
+ ...flatten({}, translations)
36
+ };
37
+ }
38
+
39
+ get mapping() {
40
+ return this.translations;
41
+ }
42
+
43
+ @action
44
+ lookupToken(
45
+ token: string,
46
+ valueDefault: string | ((values: Record<string, unknown>) => string),
47
+ values?: Record<string, any>
48
+ ): string | string[] {
49
+ return this._lookupToken({
50
+ token,
51
+ valueDefault,
52
+ values
53
+ });
54
+ }
55
+
56
+ getTokenFromMapping(
57
+ token: LookupTokenOptions['token'],
58
+ valueDefault: LookupTokenOptions['valueDefault'],
59
+ i18nMapping: LookupTokenOptions['i18nMapping']
60
+ ) {
61
+ return (i18nMapping && i18nMapping[token]) || valueDefault;
62
+ }
63
+
64
+ @action
65
+ _lookupToken(options: LookupTokenOptions) {
66
+ const {
67
+ token,
68
+ i18nMapping = this.mapping,
69
+ valueDefault,
70
+ values = {}
71
+ } = options;
72
+
73
+ let renderable = this.getTokenFromMapping(token, valueDefault, i18nMapping);
74
+
75
+ if (typeof renderable === 'function') {
76
+ renderable = renderable(values);
77
+ }
78
+
79
+ const children = processStringToChildren(renderable, values);
80
+
81
+ return children as string;
82
+ }
83
+ }
84
+
85
+ declare module '@ember/service' {
86
+ interface Registry {
87
+ 'eui-i18n': EuiI18n;
88
+ }
89
+ }
@@ -6,22 +6,8 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
 
9
- declare module 'remark-emoji' {
10
- import { Plugin } from 'unified';
11
- const RemarkEmoji: Plugin;
12
- export = RemarkEmoji;
13
- }
14
-
15
9
  declare module 'remark-highlight.js' {
16
10
  import { Plugin } from 'unified';
17
11
  const RemarkHighlight: Plugin;
18
12
  export = RemarkHighlight;
19
13
  }
20
-
21
- declare module 'mdast-util-to-hast/lib/all' {
22
- import { Node } from 'unist';
23
- import { H } from 'mdast-util-to-hast';
24
-
25
- const all: (h: H, node: Node) => Node[];
26
- export = all;
27
- }
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/date-popover/absolute-tab';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/date-popover/datetime-picker';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/date-popover/eui-date-popover-button';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/date-popover/eui-date-popover-content';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/date-popover/now-tab';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/date-popover/relative-tab';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/eui-date-picker-range';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/eui-quick-select-popover/eui-commonly-used-time-ranges';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/eui-quick-select-popover/eui-quick-select';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/eui-quick-select-popover/eui-recently-used';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/eui-quick-select-popover/index';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/eui-super-update-button';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-super-date-picker/index';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/services/eui-i18n';
@@ -0,0 +1,90 @@
1
+ ---
2
+ order: 1
3
+ ---
4
+
5
+ ```hbs template
6
+ <EuiText size="s">
7
+ EuiSuperDatePicker should be resilient to invalid date values. You can try to break it with unexpected values here.
8
+ </EuiText>
9
+
10
+ <EuiSpacer />
11
+
12
+ <EuiFormControlLayoutDelimited>
13
+ <:prepend as |classes|>
14
+ <EuiFormLabel class={{classes}}>Dates</EuiFormLabel>
15
+ </:prepend>
16
+
17
+ <:startControl as |classes|>
18
+ <input
19
+ class={{concat classes " euiFieldText"}}
20
+ type="text"
21
+ placeholder="start"
22
+ value={{this.start}}
23
+ {{on "change" this.onStartInputChange}}
24
+ />
25
+ </:startControl>
26
+
27
+ <:endControl as |classes|>
28
+ <input
29
+ class={{concat classes " euiFieldText"}}
30
+ type="text"
31
+ placeholder="end"
32
+ value={{this.end}}
33
+ {{on "change" this.onEndInputChange}}
34
+ />
35
+ </:endControl>
36
+ </EuiFormControlLayoutDelimited>
37
+
38
+ <EuiSpacer />
39
+
40
+ <EuiSuperDatePicker
41
+ @onTimeChange={{this.onTimeChange}}
42
+ @start={{this.start}}
43
+ @end={{this.end}}
44
+ @isLoading={{this.isLoading}}
45
+ @onRefresh={{this.onRefresh}}
46
+ />
47
+ ```
48
+
49
+ ```javascript component
50
+ import Component from '@glimmer/component';
51
+ import { tracked } from '@glimmer/tracking';
52
+ import { action } from '@ember/object';
53
+
54
+ export default class extends Component {
55
+ @tracked start = 'now-30m';
56
+ @tracked end = 'now';
57
+ @tracked isLoading = false;
58
+
59
+ @action onTimeChange({ start, end }) {
60
+ this.start = start;
61
+ this.end = end;
62
+ this.isLoading = true;
63
+ this.startLoading();
64
+ }
65
+
66
+ @action onRefresh({ start, end, refreshInterval }) {
67
+ return new Promise((resolve) => {
68
+ setTimeout(resolve, 100);
69
+ }).then(() => {
70
+ console.log(start, end, refreshInterval);
71
+ });
72
+ };
73
+
74
+ @action onStartInputChange(e) {
75
+ this.start = e.target.value;
76
+ };
77
+
78
+ @action onEndInputChange(e) {
79
+ this.end = e.target.value;
80
+ };
81
+
82
+ @action startLoading() {
83
+ setTimeout(this.stopLoading, 1000);
84
+ };
85
+
86
+ @action stopLoading() {
87
+ this.isLoading = false;
88
+ };
89
+ }
90
+ ```
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: Super date picker
3
+ ---
4
+
5
+ <EuiSpacer/>
6
+ <EuiPageHeader @pageTitle="Super date picker"/>
7
+
8
+ <EuiSpacer />
9
+
10
+ <EuiText>
11
+ <p>
12
+ <strong>EuiSuperDatePicker</strong> is a complex date picker that supports relative and absolute dates.
13
+ It offers a convenient <EuiIcon type="calendar" color="primary" /> <strong>Quick select menu</strong> which includes
14
+ <strong>Commonly used dates</strong>, <strong>Recently used date ranges</strong> and <strong>Auto refresh</strong> features.
15
+ </p>
16
+ </EuiText>