@ember-eui/core 5.11.3 → 5.12.1

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.
@@ -1,10 +1,25 @@
1
- {{#if (and @href (not (or @isLoading @isDisabled)))}}
2
- <a
1
+ {{#let
2
+ (arg-or-default @baseClassName "euiButton")
3
+ (if
4
+ @element
5
+ (element @element)
6
+ (if
7
+ (and @href (not (or @isLoading @isDisabled)))
8
+ (element "a")
9
+ (element "button")
10
+ )
11
+ )
12
+ as |baseClassName Element|
13
+ }}
14
+ <Element
3
15
  class={{class-names
4
- (if @fill "euiButton--fill")
5
- (if @fullWidth "euiButton--fullWidth")
6
- (if (or @isLoading @isDisabled @disabled) "euiButton-isDisabled")
7
- componentName="EuiButton"
16
+ (if @fill (concat baseClassName "--fill"))
17
+ (if @fullWidth (concat baseClassName "--fullWidth"))
18
+ (if
19
+ (or @isLoading @isDisabled @disabled)
20
+ (concat baseClassName "-isDisabled")
21
+ )
22
+ componentName=(classify baseClassName)
8
23
  color=(arg-or-default @color "primary")
9
24
  size=@size
10
25
  }}
@@ -18,6 +33,7 @@
18
33
  class="euiButton__content {{@contentClasses}}"
19
34
  @isLoading={{@isLoading}}
20
35
  @iconType={{@iconType}}
36
+ @iconSize={{@iconSize}}
21
37
  @iconSide={{@iconSide}}
22
38
  @iconClasses={{@iconClasses}}
23
39
  @useSvg={{@useSvg}}
@@ -26,33 +42,5 @@
26
42
  >
27
43
  {{yield}}
28
44
  </EuiButtonContent>
29
- </a>
30
- {{else}}
31
- <button
32
- class={{class-names
33
- (if @fill "euiButton--fill")
34
- (if @fullWidth "euiButton--fullWidth")
35
- (if (or @isLoading @isDisabled @disabled) "euiButton-isDisabled")
36
- componentName="EuiButton"
37
- color=(arg-or-default @color "primary")
38
- size=@size
39
- }}
40
- disabled={{or @isLoading @isDisabled @disabled}}
41
- type={{if @type @type "button"}}
42
- aria-pressed={{if @isSelected "true" null}}
43
- ...attributes
44
- >
45
- <EuiButtonContent
46
- class="euiButton__content {{@contentClasses}}"
47
- @isLoading={{@isLoading}}
48
- @iconType={{@iconType}}
49
- @iconSide={{@iconSide}}
50
- @iconClasses={{@iconClasses}}
51
- @useSvg={{@useSvg}}
52
- @useComponent={{@useComponent}}
53
- @textClasses={{class-names "euiButton__text" @textClasses}}
54
- >
55
- {{yield}}
56
- </EuiButtonContent>
57
- </button>
58
- {{/if}}
45
+ </Element>
46
+ {{/let}}
@@ -0,0 +1,66 @@
1
+ {{#let
2
+ (arg-or-default @buttonSize "s")
3
+ (arg-or-default @color "text")
4
+ (arg-or-default @isFullWidth false)
5
+ (arg-or-default @isDisabled false)
6
+ (arg-or-default @type "single")
7
+ as |buttonSize color isFullWidth isDisabled type|
8
+ }}
9
+ {{#let
10
+ (if (and (eq buttonSize "compressed") (eq color "ghost")) "text" color)
11
+ (eq type "single")
12
+ as |resolvedColor typeIsSingle|
13
+ }}
14
+
15
+ <fieldset
16
+ class={{class-names
17
+ "euiButtonGroup"
18
+ (if isFullWidth "euiButtonGroup--fullWidth")
19
+ (if isDisabled "euiButtonGroup--fullWidth")
20
+ @className
21
+ componentName="EuiButtonGroup"
22
+ size=(arg-or-default buttonSize "s")
23
+ color=resolvedColor
24
+ }}
25
+ disabled={{isDisabled}}
26
+ ...attributes
27
+ >
28
+ <legend {{screen-reader-only}}>{{@legend}}</legend>
29
+ <div class="euiButtonGroup__buttons">
30
+ {{#each @options as |option|}}
31
+ <EuiButtonGroupButton
32
+ @name={{if @name @name (unique-id)}}
33
+ @isDisabled={{if
34
+ (not-eq option.isDisabled undefined)
35
+ option.isDisabled
36
+ isDisabled
37
+ }}
38
+ @element={{if typeIsSingle "label" "button"}}
39
+ @isSelected={{if
40
+ typeIsSingle
41
+ (eq option.id @idSelected)
42
+ (get @idToSelectedMap option.id)
43
+ }}
44
+ @color={{resolvedColor}}
45
+ @size={{buttonSize}}
46
+ @isIconOnly={{@isIconOnly}}
47
+ @onChange={{@onChange}}
48
+ @iconType={{option.iconType}}
49
+ @value={{option.value}}
50
+ @label={{option.label}}
51
+ @id={{option.id}}
52
+ @isLoading={{option.isLoading}}
53
+ @iconSide={{option.iconSide}}
54
+ @iconSize={{option.iconSize}}
55
+ @textClasses={{option.textClasses}}
56
+ @contentClasses={{option.contentClasses}}
57
+ @iconClasses={{option.iconClasses}}
58
+ @type={{option.type}}
59
+ class={{option.className}}
60
+ aria-label={{option.aria-label}}
61
+ />
62
+ {{/each}}
63
+ </div>
64
+ </fieldset>
65
+ {{/let}}
66
+ {{/let}}
@@ -0,0 +1,57 @@
1
+ {{#let
2
+ (if @isDisabled "button" @element)
3
+ (unique-id)
4
+ (class-names
5
+ (if @isSelected "euiButtonGroupButton-isSelected")
6
+ (if @isIconOnly "euiButtonGroupButton-isIconOnly")
7
+ )
8
+ as |element newId classes|
9
+ }}
10
+ {{#let (not-eq @element "label") as |isNotLabel|}}
11
+ <EuiInnerText as |setInnerTextRef innerText|>
12
+ <EuiButton
13
+ @baseClassName="euiButtonGroupButton"
14
+ class={{classes}}
15
+ @element={{element}}
16
+ @fill={{and (not-eq @size "compressed") @isSelected}}
17
+ @isDisabled={{@isDisabled}}
18
+ @size={{if (eq @size "compressed") "s" @size}}
19
+ @color={{@color}}
20
+ @contentClasses={{@contentClasses}}
21
+ @iconSide={{@iconSide}}
22
+ @iconType={{@iconType}}
23
+ @iconSize={{@iconSize}}
24
+ @iconClasses={{@iconClasses}}
25
+ @isLoading={{@isLoading}}
26
+ @textClasses={{class-names
27
+ @textClasses
28
+ (if
29
+ @isIconOnly "euiScreenReaderOnly" "euiButtonGroupButton__textShift"
30
+ )
31
+ }}
32
+ @isSelected={{if isNotLabel @isSelected}}
33
+ type={{if isNotLabel @type}}
34
+ htmlFor={{if (eq element "label") newId}}
35
+ id={{if isNotLabel newId}}
36
+ title={{innerText}}
37
+ {{on "click" (if isNotLabel (fn @onChange @id) (noop))}}
38
+ {{did-insert setInnerTextRef}}
39
+ ...attributes
40
+ >
41
+ {{#if (eq element "label")}}
42
+ <input
43
+ id={{newId}}
44
+ class="euiScreenReaderOnly"
45
+ name={{@name}}
46
+ checked={{@isSelected}}
47
+ disabled={{@isDisabled}}
48
+ value={{@value}}
49
+ type="radio"
50
+ {{on "change" (fn @onChange @id @value)}}
51
+ />
52
+ {{/if}}
53
+ {{@label}}
54
+ </EuiButton>
55
+ </EuiInnerText>
56
+ {{/let}}
57
+ {{/let}}
@@ -2,7 +2,6 @@ import EmberPowerSelectOptions from 'ember-power-select/components/power-select/
2
2
  import { emberPowerSelectIsGroup } from 'ember-power-select/helpers/ember-power-select-is-group';
3
3
  import config from 'ember-get-config';
4
4
 
5
- const rowHeight = config['@ember-eui/core']?.euiComboBoxOptionsHeight || 29;
6
5
  export default class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions {
7
6
  _optionsCache = [];
8
7
 
@@ -30,7 +29,11 @@ export default class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions
30
29
  return option;
31
30
  }
32
31
 
32
+ get configRowHeight() {
33
+ return config?.['@ember-eui/core']?.euiComboBoxOptionsHeight || 29;
34
+ }
35
+
33
36
  get rowHeight() {
34
- return this.args.rowHeight ?? rowHeight;
37
+ return this.args.rowHeight ?? this.configRowHeight;
35
38
  }
36
39
  }
@@ -8,7 +8,7 @@ import {
8
8
  } from '../../utils/css-mappings/eui-icon';
9
9
  import { guidFor } from '@ember/object/internals';
10
10
  import { htmlSafe } from '@ember/template';
11
- import { getOwner } from '@ember/application';
11
+ import config from 'ember-get-config';
12
12
 
13
13
  export const TYPES = keysOf(typeToPathMap);
14
14
 
@@ -88,11 +88,9 @@ export default class EuiIcon extends Component<EuiIconArgs> {
88
88
  }
89
89
 
90
90
  get useSvg(): boolean {
91
- //@ts-ignore
92
- const config = getOwner(this).resolveRegistration('config:environment');
93
91
  return (
94
92
  this.args.useSvg ??
95
- config?.['@ember-eui/core']?.['eui-icon']?.useSvg ??
93
+ config?.['@ember-eui/core']?.['euiIcon']?.useSvg ??
96
94
  false
97
95
  );
98
96
  }
@@ -1,6 +1,5 @@
1
1
  import { helper } from '@ember/component/helper';
2
2
  import { assert } from '@ember/debug';
3
- //@ts-ignore
4
3
  import config from 'ember-get-config';
5
4
  import { get } from '@ember/object';
6
5
 
@@ -0,0 +1,27 @@
1
+ export const baseClass = 'euiButtonGroupButton';
2
+ import { colors } from './eui-button';
3
+
4
+ const sizeMapping = {
5
+ s: `${baseClass}--small`,
6
+ m: ''
7
+ };
8
+
9
+ const colorMapping = {
10
+ primary: `${baseClass}${colors.primary}`,
11
+ accent: `${baseClass}${colors.accent}`,
12
+ success: `${baseClass}${colors.success}`,
13
+ warning: `${baseClass}${colors.warning}`,
14
+ danger: `${baseClass}${colors.danger}`,
15
+ ghost: `${baseClass}${colors.ghost}`,
16
+ text: `${baseClass}${colors.text}`
17
+ };
18
+
19
+ const mapping: ComponentMapping = {
20
+ base: baseClass,
21
+ properties: {
22
+ color: colorMapping,
23
+ size: sizeMapping
24
+ }
25
+ };
26
+
27
+ export default mapping;
@@ -0,0 +1,28 @@
1
+ export const baseClass = 'euiButtonGroup';
2
+ import { colors } from './eui-button';
3
+
4
+ const sizeMapping = {
5
+ s: `${baseClass}--small`,
6
+ m: `${baseClass}--medium`,
7
+ compressed: `${baseClass}--compressed`
8
+ };
9
+
10
+ const colorMapping = {
11
+ primary: `${baseClass}${colors.primary}`,
12
+ accent: `${baseClass}${colors.accent}`,
13
+ success: `${baseClass}${colors.success}`,
14
+ warning: `${baseClass}${colors.warning}`,
15
+ danger: `${baseClass}${colors.danger}`,
16
+ ghost: `${baseClass}${colors.ghost}`,
17
+ text: `${baseClass}${colors.text}`
18
+ };
19
+
20
+ const mapping: ComponentMapping = {
21
+ base: baseClass,
22
+ properties: {
23
+ color: colorMapping,
24
+ size: sizeMapping
25
+ }
26
+ };
27
+
28
+ export default mapping;
@@ -1,17 +1,28 @@
1
1
  export const baseClass = 'euiButton';
2
2
 
3
3
  const sizeMapping = {
4
- s: `${baseClass}--small`
4
+ s: `${baseClass}--small`,
5
+ m: ''
6
+ };
7
+
8
+ export const colors = {
9
+ primary: `--primary`,
10
+ accent: `--accent`,
11
+ success: `--success`,
12
+ warning: `--warning`,
13
+ danger: `--danger`,
14
+ ghost: `--ghost`,
15
+ text: `--text`
5
16
  };
6
17
 
7
18
  const colorMapping = {
8
- primary: `${baseClass}--primary`,
9
- accent: `${baseClass}--accent`,
10
- success: `${baseClass}--success`,
11
- warning: `${baseClass}--warning`,
12
- danger: `${baseClass}--danger`,
13
- ghost: `${baseClass}--ghost`,
14
- text: `${baseClass}--text`
19
+ primary: `${baseClass}${colors.primary}`,
20
+ accent: `${baseClass}${colors.accent}`,
21
+ success: `${baseClass}${colors.success}`,
22
+ warning: `${baseClass}${colors.warning}`,
23
+ danger: `${baseClass}${colors.danger}`,
24
+ ghost: `${baseClass}${colors.ghost}`,
25
+ text: `${baseClass}${colors.text}`
15
26
  };
16
27
 
17
28
  const mapping: ComponentMapping = {
@@ -7,6 +7,8 @@ import EuiBottomBar from './eui-bottom-bar';
7
7
  import EuiButton from './eui-button';
8
8
  import EuiButtonEmpty from './eui-button-empty';
9
9
  import EuiButtonIcon from './eui-button-icon';
10
+ import EuiButtonGroup from './eui-button-group';
11
+ import EuiButtonGroupButton from './eui-button-group-button';
10
12
  import EuiCallOut from './eui-call-out';
11
13
  import EuiCard from './eui-card';
12
14
  import EuiCardSelect from './eui-card-select';
@@ -77,6 +79,8 @@ const mapping: Mapping = {
77
79
  EuiButton,
78
80
  EuiButtonEmpty,
79
81
  EuiButtonIcon,
82
+ EuiButtonGroup,
83
+ EuiButtonGroupButton,
80
84
  EuiCallOut,
81
85
  EuiCard,
82
86
  EuiCardSelect,
@@ -135,7 +139,7 @@ const mapping: Mapping = {
135
139
  EuiTextColor,
136
140
  EuiTitle,
137
141
  EuiToast,
138
- EuiToolTip,
142
+ EuiToolTip
139
143
  };
140
144
 
141
145
  export default mapping;
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-button-group';
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-button-group-button';
@@ -4,40 +4,19 @@ order: 8
4
4
 
5
5
  # Split buttons
6
6
 
7
+ <EuiText>
8
+ <p>EUI split buttons specifically. Instead, we recommend using separate buttons for the main and overflow actions. You can achieve this by simply using the <EuiCode>display</EuiCode> and <EuiCode>size</EuiCode> args <strong>EuiButtonIcon</strong> to match that of the primary action button.</p>
9
+ </EuiText>
7
10
 
8
11
  ```hbs template
9
- <TodoText/>
10
- <!-- <EuiFlexGroup @responsive={{false}} @gutterSize="xs" @alignItems="center">
12
+ <EuiFlexGroup @responsive={{false}} @gutterSize='xs' @alignItems='center'>
11
13
  <EuiFlexItem @grow={{false}}>
12
- <EuiButton @size="s" @iconType="calendar">
14
+ <EuiButton @size='s' @iconType='calendar'>
13
15
  Last 15 min
14
16
  </EuiButton>
15
17
  </EuiFlexItem>
16
18
  <EuiFlexItem @grow={{false}}>
17
-
18
- <EuiPopover
19
- @ownFocus={{true}}
20
- @isOpen={{this.popover}}
21
- @anchorPosition='downCenter'
22
- @closePopover={{set this 'popover' false}}
23
- >
24
- <:button>
25
- <EuiButton
26
- @iconType='arrowDown'
27
- @iconSide='right'
28
- {{on 'click' (set this 'popover' true)}}
29
- >
30
- Show Popover
31
- </EuiButton>
32
- </:button>
33
- <:content>
34
- <EuiText @size="m" style="width: 300px;">
35
- <p>
36
- Popover content that’s wider than the default width
37
- </p>
38
- </EuiText>
39
- </:content>
40
- </EuiPopover>
19
+ <EuiButtonIcon @iconType='boxesVertical' @display='base' @size='s' />
41
20
  </EuiFlexItem>
42
- </EuiFlexGroup> -->
43
- ```
21
+ </EuiFlexGroup>
22
+ ```
@@ -4,7 +4,49 @@ order: 9
4
4
 
5
5
  # Toggle buttons
6
6
 
7
+ <EuiText>
8
+ <p>You can create a toggle button with any button type like the standard <strong>EuiButton</strong>, <strong>EuiButtonEmpty</strong>, or <strong>EuiButtonIcon</strong>. Use state management to handle the visual differences for on and off. Though there are two <strong>exclusive</strong> situations to consider.</p>
9
+ <ol>
10
+ <li>If your button changes its readable <strong>text</strong>, via children or <EuiCode>aria-label</EuiCode>, then there is no additional accessibility concern.</li>
11
+ <li>If your button only changes the <strong>visual</strong> appearance, you must add <EuiCode>aria-pressed</EuiCode> passing a boolean for the on and off states. All EUI button types provide a helper prop for this called <EuiCode>isSelected</EuiCode>.</li>
12
+ </ol>
13
+
14
+ </EuiText>
7
15
 
8
16
  ```hbs template
9
- <TodoText/>
10
- ```
17
+ {{#let
18
+ (use-state false)
19
+ (use-state false)
20
+ (use-state true)
21
+ (use-state false)
22
+ as |toggle0 toggle1 toggle2 toggle3|
23
+ }}
24
+ <EuiButton {{on 'click' (fn toggle0.setState (not toggle0.value))}}>
25
+ {{if toggle0.value 'Hey there good lookin' 'Toggle me'}}
26
+ </EuiButton>
27
+ <EuiButtonIcon
28
+ @iconType={{if toggle1.value 'play' 'pause'}}
29
+ title={{if toggle1.value 'Play' 'Pause'}}
30
+ aria-label={{if toggle1.value 'Play' 'Pause'}}
31
+ {{on 'click' (fn toggle1.setState (not toggle1.value))}}
32
+ />
33
+ <EuiButton
34
+ @isSelected={{toggle2.value}}
35
+ @fill={{toggle2.value}}
36
+ @iconType={{if toggle2.value 'starFilledSpace' 'starPlusEmpty'}}
37
+ {{on 'click' (fn toggle2.setState (not toggle2.value))}}
38
+ >
39
+ Toggle me
40
+ </EuiButton>
41
+ <EuiButtonIcon
42
+ @display={{if toggle3.value 'base' 'empty'}}
43
+ @size='m'
44
+ aria-label='Autosave'
45
+ title='Autosave'
46
+ @iconType='save'
47
+ aria-pressed={{toggle3.value}}
48
+ @color={{toggle3.value 'primary' 'text'}}
49
+ {{on 'click' (fn toggle3.setState (not toggle3.value))}}
50
+ />
51
+ {{/let}}
52
+ ```
@@ -4,7 +4,110 @@ order: 10
4
4
 
5
5
  # Button groups
6
6
 
7
-
8
7
  ```hbs template
9
- <TodoText/>
10
- ```
8
+ <EuiButtonGroup
9
+ @legend='This is a basic group'
10
+ @options={{this.toggleButtons}}
11
+ @idSelected={{this.toggleIdSelected}}
12
+ @onChange={{set this 'toggleIdSelected'}}
13
+ />
14
+ <EuiSpacer @size='m' />
15
+ <EuiTitle @size='xxs' @tagName='h3'>
16
+ Primary &amp; multi select
17
+ </EuiTitle>
18
+ <EuiSpacer @size='s' />
19
+ <EuiButtonGroup
20
+ @legend='This is a primary group'
21
+ @options={{this.toggleButtonsMulti}}
22
+ @idToSelectedMap={{this.toggleIdToSelectedMap}}
23
+ @onChange={{this.onChangeMulti}}
24
+ @color='primary'
25
+ @type='multi'
26
+ />
27
+ <EuiSpacer @size='m' />
28
+ <EuiTitle @size='xxs' @tagName='h3'>
29
+ Disabled &amp; full width
30
+ </EuiTitle>
31
+ <EuiSpacer @size='s' />
32
+ <EuiButtonGroup
33
+ @legend='This is a disabled group'
34
+ @options={{this.toggleButtonsDisabled}}
35
+ @idSelected={{this.toggleIdDisabled}}
36
+ @onChange={{set this 'toggleIdDisabled'}}
37
+ @buttonSize='m'
38
+ @isDisabled={{true}}
39
+ @isFullWidth={{true}}
40
+ />
41
+ ```
42
+
43
+ ```js component
44
+ import Component from '@glimmer/component';
45
+ import { guidFor } from '@ember/object/internals';
46
+ import { tracked } from '@glimmer/tracking';
47
+
48
+ const basicButtonGroupPrefix = guidFor({});
49
+ const multiSelectButtonGroupPrefix = guidFor({});
50
+ const disabledButtonGroupPrefix = guidFor({});
51
+ export default class extends Component {
52
+ @tracked toggleIdSelected = `${basicButtonGroupPrefix}__1`;
53
+ @tracked toggleIdDisabled = `${disabledButtonGroupPrefix}__1`;
54
+ @tracked toggleIdToSelectedMap = {
55
+ [`${multiSelectButtonGroupPrefix}__1`]: true
56
+ };
57
+
58
+ toggleButtons = [
59
+ {
60
+ id: `${basicButtonGroupPrefix}__0`,
61
+ label: 'Option one'
62
+ },
63
+ {
64
+ id: `${basicButtonGroupPrefix}__1`,
65
+ label: 'Option two is selected by default'
66
+ },
67
+ {
68
+ id: `${basicButtonGroupPrefix}__2`,
69
+ label: 'Option three'
70
+ }
71
+ ];
72
+
73
+ toggleButtonsDisabled = [
74
+ {
75
+ id: `${disabledButtonGroupPrefix}__0`,
76
+ label: 'Option one'
77
+ },
78
+ {
79
+ id: `${disabledButtonGroupPrefix}__1`,
80
+ label: 'Option two is selected by default'
81
+ },
82
+ {
83
+ id: `${disabledButtonGroupPrefix}__2`,
84
+ label: 'Option three'
85
+ }
86
+ ];
87
+
88
+ toggleButtonsMulti = [
89
+ {
90
+ id: `${multiSelectButtonGroupPrefix}__0`,
91
+ label: 'Option one'
92
+ },
93
+ {
94
+ id: `${multiSelectButtonGroupPrefix}__1`,
95
+ label: 'Option two is selected by default'
96
+ },
97
+ {
98
+ id: `${multiSelectButtonGroupPrefix}__2`,
99
+ label: 'Option three'
100
+ }
101
+ ];
102
+
103
+ onChangeMulti = (optionId) => {
104
+ const newToggleIdToSelectedMap = {
105
+ ...this.toggleIdToSelectedMap,
106
+ ...{
107
+ [optionId]: !this.toggleIdToSelectedMap[optionId]
108
+ }
109
+ };
110
+ this.toggleIdToSelectedMap = newToggleIdToSelectedMap;
111
+ };
112
+ }
113
+ ```
@@ -0,0 +1,92 @@
1
+ ---
2
+ order: 11
3
+ ---
4
+
5
+ # Icon only button groups
6
+
7
+ ```hbs template
8
+ <EuiButtonGroup
9
+ @legend='Text align'
10
+ @options={{this.toggleButtonsIcons}}
11
+ @idSelected={{this.toggleIconIdSelected}}
12
+ @onChange={{set this 'toggleIconIdSelected'}}
13
+ @isIconOnly={{true}}
14
+ />
15
+ <EuiButtonGroup
16
+ @legend='Text style'
17
+ @options={{this.toggleButtonsIconsMulti}}
18
+ @idToSelectedMap={{this.toggleIdToSelectedMap}}
19
+ @onChange={{this.onChangeMulti}}
20
+ @type='multi'
21
+ @isIconOnly={{true}}
22
+ />
23
+ ```
24
+
25
+ ```js component
26
+ import Component from '@glimmer/component';
27
+ import { guidFor } from '@ember/object/internals';
28
+ import { tracked } from '@glimmer/tracking';
29
+
30
+ const idPrefix3 = guidFor({});
31
+ export default class extends Component {
32
+ @tracked toggleIconIdSelected = `${idPrefix3}1`;
33
+ @tracked toggleIdToSelectedMap = {};
34
+
35
+ toggleButtonsIcons = [
36
+ {
37
+ id: `${idPrefix3}0`,
38
+ label: 'Align left',
39
+ iconType: 'editorAlignLeft'
40
+ },
41
+ {
42
+ id: `${idPrefix3}1`,
43
+ label: 'Align center',
44
+ iconType: 'editorAlignCenter'
45
+ },
46
+ {
47
+ id: `${idPrefix3}2`,
48
+ label: 'Align right',
49
+ iconType: 'editorAlignRight',
50
+ isDisabled: true
51
+ }
52
+ ];
53
+
54
+ toggleButtonsIconsMulti = [
55
+ {
56
+ id: `${idPrefix3}3`,
57
+ label: 'Bold',
58
+ name: 'bold',
59
+ iconType: 'editorBold'
60
+ },
61
+ {
62
+ id: `${idPrefix3}4`,
63
+ label: 'Italic',
64
+ name: 'italic',
65
+ iconType: 'editorItalic',
66
+ isDisabled: true
67
+ },
68
+ {
69
+ id: `${idPrefix3}5`,
70
+ label: 'Underline',
71
+ name: 'underline',
72
+ iconType: 'editorUnderline'
73
+ },
74
+ {
75
+ id: `${idPrefix3}6`,
76
+ label: 'Strikethrough',
77
+ name: 'strikethrough',
78
+ iconType: 'editorStrike'
79
+ }
80
+ ];
81
+
82
+ onChangeMulti = (optionId) => {
83
+ const newToggleIdToSelectedMap = {
84
+ ...this.toggleIdToSelectedMap,
85
+ ...{
86
+ [optionId]: !this.toggleIdToSelectedMap[optionId]
87
+ }
88
+ };
89
+ this.toggleIdToSelectedMap = newToggleIdToSelectedMap;
90
+ };
91
+ }
92
+ ```
@@ -0,0 +1,101 @@
1
+ ---
2
+ order: 12
3
+ ---
4
+
5
+ # Button groups in forms
6
+
7
+ <EuiText>
8
+ <p>When using button groups within compressed forms, match the form elements by adding <EuiCode>buttonSize="compressed"</EuiCode>. Compressed groups should always be <EuiCode>fullWidth</EuiCode> so they line up nicely in their small container <strong>unless</strong> they are icon only.
9
+ </p>
10
+
11
+ </EuiText>
12
+
13
+ ```hbs template
14
+ <EuiPanel @hasBorder={{true}} style='max-width: 300px'>
15
+ <EuiButtonGroup
16
+ @name='coarsness'
17
+ @legend='This is a basic group'
18
+ @options={{this.toggleButtonsCompressed}}
19
+ @idSelected={{this.toggleCompressedIdSelected}}
20
+ @onChange={{set this 'toggleCompressedIdSelected'}}
21
+ @buttonSize='compressed'
22
+ @isFullWidth={{true}}
23
+ />
24
+ <EuiSpacer />
25
+ <EuiButtonGroup
26
+ @legend='Text style'
27
+ class='eui-displayInlineBlock'
28
+ @options={{this.toggleButtonsIconsMulti}}
29
+ @idToSelectedMap={{this.toggleIconIdToSelectedMapIcon}}
30
+ @onChange={{this.onChangeMulti}}
31
+ @type='multi'
32
+ @buttonSize='compressed'
33
+ @isIconOnly={{true}}
34
+ />
35
+ </EuiPanel>
36
+ ```
37
+
38
+ ```js component
39
+ import Component from '@glimmer/component';
40
+ import { guidFor } from '@ember/object/internals';
41
+ import { tracked } from '@glimmer/tracking';
42
+
43
+ const idPrefix3 = guidFor({});
44
+ export default class extends Component {
45
+ @tracked toggleCompressedIdSelected = `${idPrefix3}__1`;
46
+ @tracked toggleIconIdToSelectedMapIcon = {};
47
+
48
+ toggleButtonsCompressed = [
49
+ {
50
+ id: `${idPrefix3}__0`,
51
+ label: 'fine'
52
+ },
53
+ {
54
+ id: `${idPrefix3}__1`,
55
+ label: 'rough'
56
+ },
57
+ {
58
+ id: `${idPrefix3}__2`,
59
+ label: 'coarse'
60
+ }
61
+ ];
62
+
63
+ toggleButtonsIconsMulti = [
64
+ {
65
+ id: `${idPrefix3}__multi__0`,
66
+ label: 'Bold',
67
+ name: 'bold',
68
+ iconType: 'editorBold'
69
+ },
70
+ {
71
+ id: `${idPrefix3}__multi__1`,
72
+ label: 'Italic',
73
+ name: 'italic',
74
+ iconType: 'editorItalic',
75
+ isDisabled: true
76
+ },
77
+ {
78
+ id: `${idPrefix3}__multi__2`,
79
+ label: 'Underline',
80
+ name: 'underline',
81
+ iconType: 'editorUnderline'
82
+ },
83
+ {
84
+ id: `${idPrefix3}__multi__3`,
85
+ label: 'Strikethrough',
86
+ name: 'strikethrough',
87
+ iconType: 'editorStrike'
88
+ }
89
+ ];
90
+
91
+ onChangeMulti = (optionId) => {
92
+ const newtoggleIconIdToSelectedMapIcon = {
93
+ ...this.toggleIconIdToSelectedMapIcon,
94
+ ...{
95
+ [optionId]: !this.toggleIconIdToSelectedMapIcon[optionId]
96
+ }
97
+ };
98
+ this.toggleIconIdToSelectedMapIcon = newtoggleIconIdToSelectedMapIcon;
99
+ };
100
+ }
101
+ ```
@@ -1,5 +1,5 @@
1
1
  ---
2
- order: 11
2
+ order: 13
3
3
  ---
4
4
 
5
5
  # Ghost
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-eui/core",
3
- "version": "5.11.3",
3
+ "version": "5.12.1",
4
4
  "description": "Ember Components for Elastic UI",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -143,7 +143,7 @@
143
143
  "ember-disable-prototype-extensions": "^1.1.3",
144
144
  "ember-export-application-global": "^2.0.1",
145
145
  "ember-focus-trap": "^1.0.1",
146
- "ember-get-config": "~1.0.2",
146
+ "ember-get-config": "^2.1.1",
147
147
  "ember-load-initializers": "^2.1.2",
148
148
  "ember-page-title": "^7.0.0",
149
149
  "ember-qunit": "^5.1.5",
@@ -186,5 +186,5 @@
186
186
  "volta": {
187
187
  "extends": "../../package.json"
188
188
  },
189
- "gitHead": "e71ace0a99d5ed541a4e9d7aa372e32514b34c66"
189
+ "gitHead": "70d429facc95d24a14b0ee86a3997ee76182116c"
190
190
  }
@@ -1,12 +0,0 @@
1
- //@ts-ignore
2
- import { registerLibrary } from '@ember-eui/core/version';
3
- // import 'ember-basic-dropdown/vendor/ember-basic-dropdown.css';
4
- // import '@elastic/eui/dist/eui_theme_amsterdam_light.css';
5
-
6
- export function initialize(): void {
7
- registerLibrary();
8
- }
9
-
10
- export default {
11
- initialize
12
- };
package/addon/version.ts DELETED
@@ -1,6 +0,0 @@
1
- // import config from 'ember-get-config';
2
- // import Ember from 'ember';
3
-
4
- export function registerLibrary() {
5
- // Ember.libraries.register('@ember-eui/core', config.version);
6
- }
@@ -1 +0,0 @@
1
- export { default, initialize } from '@ember-eui/core/initializers/eui-config';