@frontile/overlays 0.15.0 → 0.16.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 (99) hide show
  1. package/addon-main.js +4 -0
  2. package/declarations/components/drawer/body.d.ts +15 -0
  3. package/declarations/components/drawer/body.d.ts.map +1 -0
  4. package/declarations/components/drawer/footer.d.ts +15 -0
  5. package/declarations/components/drawer/footer.d.ts.map +1 -0
  6. package/{components → declarations/components}/drawer/header.d.ts +7 -2
  7. package/declarations/components/drawer/header.d.ts.map +1 -0
  8. package/{components → declarations/components}/drawer/index.d.ts +10 -8
  9. package/declarations/components/drawer/index.d.ts.map +1 -0
  10. package/{components → declarations/components}/modal/body.d.ts +5 -1
  11. package/declarations/components/modal/body.d.ts.map +1 -0
  12. package/{components → declarations/components}/modal/footer.d.ts +5 -1
  13. package/declarations/components/modal/footer.d.ts.map +1 -0
  14. package/{components → declarations/components}/modal/header.d.ts +5 -1
  15. package/declarations/components/modal/header.d.ts.map +1 -0
  16. package/{components → declarations/components}/modal/index.d.ts +10 -8
  17. package/declarations/components/modal/index.d.ts.map +1 -0
  18. package/{components → declarations/components}/overlay.d.ts +5 -1
  19. package/declarations/components/overlay.d.ts.map +1 -0
  20. package/declarations/template-registry.d.ts +9 -0
  21. package/declarations/template-registry.d.ts.map +1 -0
  22. package/dist/_app_/components/drawer/body.js +1 -0
  23. package/dist/_app_/components/drawer/footer.js +1 -0
  24. package/dist/_app_/components/drawer/header.js +1 -0
  25. package/dist/_app_/components/drawer/index.js +1 -0
  26. package/dist/_app_/components/modal/body.js +1 -0
  27. package/dist/_app_/components/modal/footer.js +1 -0
  28. package/dist/_app_/components/modal/header.js +1 -0
  29. package/dist/_app_/components/modal/index.js +1 -0
  30. package/dist/_app_/components/overlay.js +1 -0
  31. package/dist/components/drawer/body.js +17 -0
  32. package/dist/components/drawer/body.js.map +1 -0
  33. package/dist/components/drawer/footer.js +17 -0
  34. package/dist/components/drawer/footer.js.map +1 -0
  35. package/dist/components/drawer/header.js +17 -0
  36. package/dist/components/drawer/header.js.map +1 -0
  37. package/dist/components/drawer/index.js +50 -0
  38. package/dist/components/drawer/index.js.map +1 -0
  39. package/dist/components/modal/body.js +17 -0
  40. package/dist/components/modal/body.js.map +1 -0
  41. package/dist/components/modal/footer.js +17 -0
  42. package/dist/components/modal/footer.js.map +1 -0
  43. package/dist/components/modal/header.js +17 -0
  44. package/dist/components/modal/header.js.map +1 -0
  45. package/dist/components/modal/index.js +45 -0
  46. package/dist/components/modal/index.js.map +1 -0
  47. package/dist/components/overlay.js +182 -0
  48. package/dist/components/overlay.js.map +1 -0
  49. package/dist/template-registry.js +2 -0
  50. package/dist/template-registry.js.map +1 -0
  51. package/package.json +85 -52
  52. package/-private/dom.d.ts +0 -5
  53. package/addon/-private/dom.d.ts +0 -5
  54. package/addon/-private/dom.js +0 -61
  55. package/addon/components/drawer/body.hbs +0 -6
  56. package/addon/components/drawer/body.ts +0 -12
  57. package/addon/components/drawer/demo/composition.md +0 -94
  58. package/addon/components/drawer/demo/placements.md +0 -60
  59. package/addon/components/drawer/demo/sizes.md +0 -60
  60. package/addon/components/drawer/demo/usage.md +0 -73
  61. package/addon/components/drawer/footer.hbs +0 -6
  62. package/addon/components/drawer/footer.ts +0 -12
  63. package/addon/components/drawer/header.hbs +0 -7
  64. package/addon/components/drawer/header.ts +0 -16
  65. package/addon/components/drawer/index.hbs +0 -43
  66. package/addon/components/drawer/index.md +0 -9
  67. package/addon/components/drawer/index.ts +0 -94
  68. package/addon/components/modal/body.hbs +0 -6
  69. package/addon/components/modal/body.ts +0 -11
  70. package/addon/components/modal/demo/sizes.md +0 -61
  71. package/addon/components/modal/demo/usage.md +0 -73
  72. package/addon/components/modal/footer.hbs +0 -6
  73. package/addon/components/modal/footer.ts +0 -11
  74. package/addon/components/modal/header.hbs +0 -7
  75. package/addon/components/modal/header.ts +0 -16
  76. package/addon/components/modal/index.hbs +0 -43
  77. package/addon/components/modal/index.md +0 -9
  78. package/addon/components/modal/index.ts +0 -84
  79. package/addon/components/overlay-demo/usage.md +0 -42
  80. package/addon/components/overlay.hbs +0 -68
  81. package/addon/components/overlay.md +0 -24
  82. package/addon/components/overlay.ts +0 -217
  83. package/app/components/drawer/body.js +0 -1
  84. package/app/components/drawer/footer.js +0 -1
  85. package/app/components/drawer/header.js +0 -1
  86. package/app/components/drawer.js +0 -1
  87. package/app/components/modal/body.js +0 -1
  88. package/app/components/modal/footer.js +0 -1
  89. package/app/components/modal/header.js +0 -1
  90. package/app/components/modal.js +0 -1
  91. package/app/components/overlay.js +0 -1
  92. package/components/drawer/body.d.ts +0 -10
  93. package/components/drawer/footer.d.ts +0 -10
  94. package/config/environment.js +0 -5
  95. package/index.js +0 -5
  96. package/tsconfig.json +0 -23
  97. package/types/dummy/index.d.ts +0 -0
  98. package/types/global.d.ts +0 -6
  99. package/types/index.d.ts +0 -1
@@ -1,60 +0,0 @@
1
- ---
2
- order: 2
3
- ---
4
-
5
- # Sizes
6
-
7
- Use the `size` argument to set the desired Drawer size.
8
-
9
- ```hbs template
10
- {{#each this.sizes as |size|}}
11
- <Button
12
- {{on "click" (fn this.toggle size)}}
13
- >
14
- Open {{size}}
15
- </Button>
16
- {{/each}}
17
-
18
- <Drawer
19
- @isOpen={{this.isOpen}}
20
- @size={{this.size}}
21
- @onClose={{this.toggle}}
22
- as |m|
23
- >
24
- <m.Header>Title</m.Header>
25
- <m.Body>
26
- <p>
27
- Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis.
28
- </p>
29
- <p>
30
- Sunt ad dolore quis aute consequat. Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam.
31
- </p>
32
- </m.Body>
33
- <m.Footer>
34
- <Button
35
- class="mr-4"
36
- {{on "click" this.toggle}}
37
- >
38
- Close
39
- </Button>
40
- </m.Footer>
41
- </Drawer>
42
- ```
43
-
44
- ```js component
45
- import Component from '@glimmer/component';
46
- import { tracked } from '@glimmer/tracking';
47
- import { action } from '@ember/object';
48
-
49
- export default class Demo extends Component {
50
- sizes = ['xs', 'sm', 'md', 'lg', 'xl', 'full'];
51
-
52
- @tracked isOpen = false;
53
- @tracked size;
54
-
55
- @action toggle(size) {
56
- this.isOpen = !this.isOpen;
57
- this.size = size;
58
- }
59
- }
60
- ```
@@ -1,73 +0,0 @@
1
- ---
2
- order: 1
3
- ---
4
-
5
- # Usage
6
-
7
- Basic Drawer usage.
8
-
9
- ```hbs template
10
- <Button
11
- {{on "click" this.toggle}}
12
- >
13
- Open Drawer
14
- </Button>
15
-
16
- <Drawer
17
- @isOpen={{this.isOpen}}
18
- @onClose={{this.toggle}}
19
- as |d|
20
- >
21
- <d.Header>Title</d.Header>
22
- <d.Body>
23
- <p>Some contents...</p>
24
- <p>Some contents...</p>
25
- <p>Some contents...</p>
26
- </d.Body>
27
- <d.Footer>
28
- <Button
29
- @appearance="minimal"
30
- class="mr-4"
31
- {{on "click" this.toggle}}
32
- >
33
- Cancel
34
- </Button>
35
- <Button
36
- @intent="primary"
37
- disabled={{this.isLoading}}
38
- {{on "click" this.save}}
39
- >
40
- {{if this.isLoading "Loading..." "Save"}}
41
- </Button>
42
- </d.Footer>
43
- </Drawer>
44
- ```
45
-
46
- ```js component
47
- import Component from '@glimmer/component';
48
- import { tracked } from '@glimmer/tracking';
49
- import { action } from '@ember/object';
50
- import { later } from '@ember/runloop';
51
-
52
- export default class Demo extends Component {
53
- @tracked isOpen = false;
54
- @tracked isLoading = false;
55
-
56
- @action toggle() {
57
- this.isOpen = !this.isOpen;
58
- }
59
-
60
- @action save() {
61
- this.isLoading = true;
62
-
63
- later(
64
- this,
65
- () => {
66
- this.isLoading = false;
67
- this.isOpen = false;
68
- },
69
- 1000
70
- );
71
- }
72
- }
73
- ```
@@ -1,6 +0,0 @@
1
- <div
2
- class={{use-frontile-class "drawer" @placement @size part="footer"}}
3
- ...attributes
4
- >
5
- {{yield}}
6
- </div>
@@ -1,12 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { DrawerArgs } from '.';
3
-
4
- export interface DrawerFooterArgs
5
- extends Pick<DrawerArgs, 'size' | 'placement'> {}
6
-
7
- export interface DrawerFooterSignature {
8
- Args: DrawerFooterArgs;
9
- Element: HTMLDivElement | null;
10
- }
11
-
12
- export default class DrawerFooter extends Component<DrawerFooterSignature> {}
@@ -1,7 +0,0 @@
1
- <div
2
- id={{@labelledById}}
3
- class={{use-frontile-class "drawer" @placement @size part="header"}}
4
- ...attributes
5
- >
6
- {{yield}}
7
- </div>
@@ -1,16 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { DrawerArgs } from '.';
3
-
4
- export interface DrawerHeaderArgs
5
- extends Pick<DrawerArgs, 'size' | 'placement'> {
6
- /**
7
- * The id used to reference labelledById in Drawer component
8
- */
9
- labelledById: string;
10
- }
11
-
12
- export interface DrawerHeaderSignature {
13
- Args: DrawerHeaderArgs;
14
- Element: HTMLDivElement;
15
- }
16
- export default class DrawerHeader extends Component<DrawerHeaderSignature> {}
@@ -1,43 +0,0 @@
1
- <Overlay
2
- @isOpen={{@isOpen}}
3
- @onClose={{@onClose}}
4
- @onOpen={{@onOpen}}
5
- @didClose={{@didClose}}
6
- @renderInPlace={{@renderInPlace}}
7
- @destinationElementId={{@destinationElementId}}
8
- @transitionDuration={{@transitionDuration}}
9
- @disableBackdrop={{@disableBackdrop}}
10
- @disableTransitions={{@disableTransitions}}
11
- @disableFocusTrap={{@disableFocusTrap}}
12
- @focusTrapOptions={{@focusTrapOptions}}
13
- @closeOnOutsideClick={{if this.preventClosing false @closeOnOutsideClick}}
14
- @closeOnEscapeKey={{if this.preventClosing false @closeOnEscapeKey}}
15
- @backdropTransitionName={{@backdropTransitionName}}
16
- @contentTransitionName={{if @transitionName @transitionName (concat "overlay-transition--slide-from-" this.placement)}}
17
- >
18
- {{#let (use-frontile-class "drawer" this.placement this.size part="close-btn") as |closeBtnClass|}}
19
- <div
20
- class={{use-frontile-class "drawer" this.placement this.size}}
21
- tabindex="0"
22
- role="dialog"
23
- aria-labelledby={{this.headerId}}
24
- ...attributes
25
- >
26
- {{#if this.showCloseButton}}
27
- <CloseButton
28
- @onClick={{@onClose}}
29
- @size={{@closeButtonSize}}
30
- class={{closeBtnClass}}
31
- />
32
- {{/if}}
33
-
34
- {{yield (hash
35
- CloseButton=(component "close-button" onClick=@onClose class=closeBtnClass)
36
- Header=(component "drawer/header" labelledById=this.headerId placement=this.placement size=this.size)
37
- Body=(component "drawer/body" placement=this.placement size=this.size)
38
- Footer=(component "drawer/footer" placement=this.placement size=this.size)
39
- headerId=this.headerId
40
- )}}
41
- </div>
42
- {{/let}}
43
- </Overlay>
@@ -1,9 +0,0 @@
1
- ---
2
- url: drawer
3
- ---
4
-
5
- # Drawer
6
-
7
- ## API
8
-
9
- <ArgsTable @of="Drawer" />
@@ -1,94 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { guidFor } from '@ember/object/internals';
3
- import { OverlayArgs } from '../overlay';
4
- import DrawerBody from './body';
5
- import DrawerFooter from './footer';
6
- import DrawerHeader from './header';
7
- import CloseButton from '@frontile/core/addon/components/close-button';
8
-
9
- export interface DrawerArgs extends Omit<OverlayArgs, 'contentTransitionName'> {
10
- /**
11
- * The name of the transition to be used in the Drawer.
12
- *
13
- * @defaultValue 'overlay-transition--slide-from-[placement]'
14
- */
15
- transitionName?: string;
16
-
17
- /**
18
- * If set to false, the close button will not be displayed,
19
- * closeOnOutsideClick will be set to false, and closeOnEscapeKey will also be set
20
- * to false.
21
- *
22
- * @defaultValue true
23
- */
24
- allowClosing?: boolean;
25
-
26
- /**
27
- * If set to false, the close button will not be displayed.
28
- *
29
- * @defaultValue true
30
- */
31
- allowCloseButton?: boolean;
32
-
33
- /**
34
- * The Close Button size.
35
- */
36
- closeButtonSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
37
-
38
- /**
39
- * The Drawer can appear from any side of the screen. The 'placement'
40
- * option allows to choose where it appears from.
41
- *
42
- * @defaultValue 'right'
43
- */
44
- placement?: 'top' | 'bottom' | 'left' | 'right';
45
-
46
- /**
47
- * The Drawer size.
48
- *
49
- * @defaultValue 'md'
50
- */
51
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
52
- }
53
-
54
- export interface DrawerSignature {
55
- Args: DrawerArgs;
56
- Blocks: {
57
- default: [
58
- {
59
- CloseButton: CloseButton;
60
- Header: DrawerHeader;
61
- Body: DrawerBody;
62
- Footer: DrawerFooter;
63
- headerId: string;
64
- }
65
- ];
66
- };
67
- Element: HTMLDivElement | null;
68
- }
69
-
70
- export default class Drawer extends Component<DrawerSignature> {
71
- headerId = `${guidFor(this)}-header`;
72
-
73
- get preventClosing(): boolean {
74
- return this.args.allowClosing === false;
75
- }
76
-
77
- get showCloseButton(): boolean {
78
- return (
79
- this.args.allowClosing !== false && this.args.allowCloseButton !== false
80
- );
81
- }
82
-
83
- get placement(): string {
84
- return this.args.placement || 'right';
85
- }
86
-
87
- get size(): string {
88
- const dir = ['top', 'bottom'].includes(this.placement)
89
- ? 'vertical'
90
- : 'horizontal';
91
-
92
- return `${this.args.size || 'md'}-${dir}`;
93
- }
94
- }
@@ -1,6 +0,0 @@
1
- <div
2
- class={{use-frontile-class "modal" @size part="body"}}
3
- ...attributes
4
- >
5
- {{yield}}
6
- </div>
@@ -1,11 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { ModalArgs } from '.';
3
-
4
- export interface ModalBodyArgs extends Pick<ModalArgs, 'size'> {}
5
-
6
- export interface ModalBodySignature {
7
- Args: ModalBodyArgs;
8
- Element: HTMLDivElement;
9
- }
10
-
11
- export default class ModalBody extends Component<ModalBodySignature> {}
@@ -1,61 +0,0 @@
1
- ---
2
- order: 2
3
- ---
4
-
5
- # Sizes
6
-
7
- Use the `size` argument to set the desired Modal size.
8
-
9
- ```hbs template
10
- {{#each this.sizes as |size|}}
11
- <Button
12
- {{on "click" (fn this.toggle size)}}
13
- >
14
- Open {{size}}
15
- </Button>
16
- {{/each}}
17
-
18
- <Modal
19
- @isOpen={{this.isOpen}}
20
- @size={{this.size}}
21
- @onClose={{this.toggle}}
22
- as |m|
23
- >
24
- <m.Header>Title</m.Header>
25
- <m.Body>
26
- <p>
27
- Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis.
28
- </p>
29
- <p>
30
- Sunt ad dolore quis aute consequat. Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam.
31
- </p>
32
- </m.Body>
33
- <m.Footer>
34
- <Button
35
- @appearance="minimal"
36
- class="mr-4"
37
- {{on "click" this.toggle}}
38
- >
39
- Close
40
- </Button>
41
- </m.Footer>
42
- </Modal>
43
- ```
44
-
45
- ```js component
46
- import Component from '@glimmer/component';
47
- import { tracked } from '@glimmer/tracking';
48
- import { action } from '@ember/object';
49
-
50
- export default class DemoModal extends Component {
51
- sizes = ['xs', 'sm', 'md', 'lg', 'xl', 'full'];
52
-
53
- @tracked isOpen = false;
54
- @tracked size;
55
-
56
- @action toggle(size) {
57
- this.isOpen = !this.isOpen;
58
- this.size = size;
59
- }
60
- }
61
- ```
@@ -1,73 +0,0 @@
1
- ---
2
- order: 1
3
- ---
4
-
5
- # Usage
6
-
7
- Basic Modal usage.
8
-
9
- ```hbs template
10
- <Button
11
- {{on "click" this.toggle}}
12
- >
13
- Open Modal
14
- </Button>
15
-
16
- <Modal
17
- @isOpen={{this.isOpen}}
18
- @onClose={{this.toggle}}
19
- as |m|
20
- >
21
- <m.Header>Title</m.Header>
22
- <m.Body>
23
- <p>Some contents...</p>
24
- <p>Some contents...</p>
25
- <p>Some contents...</p>
26
- </m.Body>
27
- <m.Footer>
28
- <Button
29
- @appearance="minimal"
30
- class="mr-4"
31
- {{on "click" this.toggle}}
32
- >
33
- Cancel
34
- </Button>
35
- <Button
36
- @intent="primary"
37
- disabled={{this.isLoading}}
38
- {{on "click" this.save}}
39
- >
40
- {{if this.isLoading "Loading..." "Save"}}
41
- </Button>
42
- </m.Footer>
43
- </Modal>
44
- ```
45
-
46
- ```js component
47
- import Component from '@glimmer/component';
48
- import { tracked } from '@glimmer/tracking';
49
- import { action } from '@ember/object';
50
- import { later } from '@ember/runloop';
51
-
52
- export default class DemoModal extends Component {
53
- @tracked isOpen = false;
54
- @tracked isLoading = false;
55
-
56
- @action toggle() {
57
- this.isOpen = !this.isOpen;
58
- }
59
-
60
- @action save() {
61
- this.isLoading = true;
62
-
63
- later(
64
- this,
65
- () => {
66
- this.isLoading = false;
67
- this.isOpen = false;
68
- },
69
- 1000
70
- );
71
- }
72
- }
73
- ```
@@ -1,6 +0,0 @@
1
- <div
2
- class={{use-frontile-class "modal" @size part="footer"}}
3
- ...attributes
4
- >
5
- {{yield}}
6
- </div>
@@ -1,11 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { ModalArgs } from '.';
3
-
4
- export interface ModalFooterArgs extends Pick<ModalArgs, 'size'> {}
5
-
6
- export interface ModalFooterSignature {
7
- Args: ModalFooterArgs;
8
- Element: HTMLDivElement;
9
- }
10
-
11
- export default class ModalFooter extends Component<ModalFooterSignature> {}
@@ -1,7 +0,0 @@
1
- <div
2
- id={{@labelledById}}
3
- class={{use-frontile-class "modal" @size part="header"}}
4
- ...attributes
5
- >
6
- {{yield}}
7
- </div>
@@ -1,16 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { ModalArgs } from '.';
3
-
4
- export interface ModalHeaderArgs extends Pick<ModalArgs, 'size'> {
5
- /**
6
- * The id used to reference labelledById in Modal component
7
- */
8
- labelledById: string;
9
- }
10
-
11
- export interface ModalHeaderSignature {
12
- Args: ModalHeaderArgs;
13
- Element: HTMLDivElement;
14
- }
15
-
16
- export default class ModalHeader extends Component<ModalHeaderSignature> {}
@@ -1,43 +0,0 @@
1
- <Overlay
2
- @isOpen={{@isOpen}}
3
- @onClose={{@onClose}}
4
- @onOpen={{@onOpen}}
5
- @didClose={{@didClose}}
6
- @renderInPlace={{@renderInPlace}}
7
- @destinationElementId={{@destinationElementId}}
8
- @transitionDuration={{@transitionDuration}}
9
- @disableBackdrop={{@disableBackdrop}}
10
- @disableTransitions={{@disableTransitions}}
11
- @disableFocusTrap={{@disableFocusTrap}}
12
- @focusTrapOptions={{@focusTrapOptions}}
13
- @closeOnOutsideClick={{if this.preventClosing false @closeOnOutsideClick}}
14
- @closeOnEscapeKey={{if this.preventClosing false @closeOnEscapeKey}}
15
- @backdropTransitionName={{@backdropTransitionName}}
16
- @contentTransitionName={{if @transitionName @transitionName "overlay-transition--zoom"}}
17
- >
18
- {{#let (use-frontile-class "modal" this.size part="close-btn") as |closeBtnClass|}}
19
- <div
20
- class={{use-frontile-class "modal" (if @isCentered "centered") this.size}}
21
- tabindex="0"
22
- role="dialog"
23
- aria-labelledby={{this.headerId}}
24
- ...attributes
25
- >
26
- {{#if this.showCloseButton}}
27
- <CloseButton
28
- @onClick={{@onClose}}
29
- @size={{@closeButtonSize}}
30
- class={{closeBtnClass}}
31
- />
32
- {{/if}}
33
-
34
- {{yield (hash
35
- CloseButton=(component "close-button" onClick=@onClose class=closeBtnClass)
36
- Header=(component "modal/header" labelledById=this.headerId size=this.size)
37
- Body=(component "modal/body" size=this.size)
38
- Footer=(component "modal/footer" size=this.size)
39
- headerId=this.headerId
40
- )}}
41
- </div>
42
- {{/let}}
43
- </Overlay>
@@ -1,9 +0,0 @@
1
- ---
2
- url: modal
3
- ---
4
-
5
- # Modal
6
-
7
- ## API
8
-
9
- <ArgsTable @of="Modal" />
@@ -1,84 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { guidFor } from '@ember/object/internals';
3
- import { OverlayArgs } from '../overlay';
4
- import ModalFooter from './footer';
5
- import ModalBody from './body';
6
- import ModalHeader from './header';
7
- import CloseButton from '@frontile/core/addon/components/close-button';
8
-
9
- export interface ModalArgs extends Omit<OverlayArgs, 'contentTransitionName'> {
10
- /**
11
- * The name of the transition to be used in the modal.
12
- * @defaultValue 'overlay-transition--zoom'
13
- */
14
- transitionName?: string;
15
-
16
- /**
17
- * If set to false, the close button will not be displayed,
18
- * closeOnOutsideClick will be set to false, and closeOnEscapeKey will also be set
19
- * to false.
20
- *
21
- * @defaultValue true
22
- */
23
- allowClosing?: boolean;
24
-
25
- /**
26
- * If set to false, the close button will not be displayed.
27
- *
28
- * @defaultValue true
29
- */
30
- allowCloseButton?: boolean;
31
-
32
- /**
33
- * The Close Button size.
34
- */
35
- closeButtonSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
36
-
37
- /**
38
- * If set to true, the modal will be vertically centered
39
- *
40
- * @defaultValue false
41
- */
42
- isCentered?: boolean;
43
-
44
- /**
45
- * The Modal size.
46
- *
47
- * @defaultValue 'lg'
48
- */
49
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
50
- }
51
-
52
- export interface ModalSignature {
53
- Args: ModalArgs;
54
- Blocks: {
55
- default: [
56
- {
57
- CloseButton: CloseButton;
58
- Header: ModalHeader;
59
- Body: ModalBody;
60
- Footer: ModalFooter;
61
- headerId: string;
62
- }
63
- ];
64
- };
65
- Element: HTMLDivElement | null;
66
- }
67
-
68
- export default class Modal extends Component<ModalSignature> {
69
- headerId = `${guidFor(this)}-header`;
70
-
71
- get preventClosing(): boolean {
72
- return this.args.allowClosing === false;
73
- }
74
-
75
- get showCloseButton(): boolean {
76
- return (
77
- this.args.allowClosing !== false && this.args.allowCloseButton !== false
78
- );
79
- }
80
-
81
- get size(): string {
82
- return this.args.size || 'lg';
83
- }
84
- }