Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Menu Component #2933

Merged
merged 138 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
7b79502
feat: add kirby-floating directive
NillerW Jan 23, 2023
0cae35b
chore: made floatingdirective accessible for programical use
NillerW Jan 24, 2023
808da47
chore: fix bad import
NillerW Jan 24, 2023
47b5a80
chore: seperate floatDirective into own PR
NillerW Jan 24, 2023
e0ac01d
feat: initial work for actionlist
NillerW Jan 26, 2023
10df911
chore: updated package-lock
NillerW Jan 26, 2023
0764ef5
chore: updated package-lock
NillerW Jan 26, 2023
c874f58
chore: updated package-lock
NillerW Jan 27, 2023
aac98a3
feat: add isDisabled input to floating directive
NillerW Jan 27, 2023
6805f01
chore: run install to properly symlink core package
RasmusKjeldgaard Jan 27, 2023
00fb04d
Merge branch 'develop' into component/2744-popup-component
RasmusKjeldgaard Jan 27, 2023
dc218ec
chore: sync package lock
RasmusKjeldgaard Jan 27, 2023
07c6a9b
chore: cherry pick package-lock from working branch
RasmusKjeldgaard Jan 27, 2023
6909f62
feat: add focus trigger. Add 'close on' functionality'
NillerW Feb 2, 2023
5bf9447
merge: component/2744-popup-component into branch
NillerW Feb 2, 2023
d916f48
feat: action list
NillerW Feb 9, 2023
756cbb8
chore: move init of placement variable
NillerW Feb 9, 2023
fa24ff5
chore: add strategy as an input
NillerW Feb 9, 2023
c5000c7
chore: change triggers to only allow for array
NillerW Feb 9, 2023
7532e3d
chore: add documentation for inputs
NillerW Feb 9, 2023
f2d8d8b
chore: merge develop into branch
NillerW Feb 21, 2023
cec22b2
chore: move location of action-list
NillerW Feb 21, 2023
147430b
chore: rename action-list to menu
NillerW Feb 22, 2023
dde9a32
feat: add option for user provided button
NillerW Feb 23, 2023
1e7700c
chore: update floating directive
NillerW Feb 27, 2023
f7e976d
chore: update floating directive
NillerW Feb 27, 2023
658e17c
chore: add tests for floating directive
NillerW Mar 6, 2023
2614ce3
chore: merge with develop
NillerW Mar 6, 2023
89b2537
chore: add floating and portal directives to path
NillerW Mar 6, 2023
7299273
chore: secondary entries
NillerW Mar 6, 2023
f9ce524
chore secondary entry
NillerW Mar 6, 2023
5ca32c5
chore: added handling for autoUpdate when reference changes
NillerW Mar 6, 2023
43c0ed9
Merge branch 'develop' into component/2744-popup-component
NillerW Mar 7, 2023
2d2bfe0
feat: add option for custom button for menu
NillerW Mar 7, 2023
093d392
Merge branch 'develop' into component/2744-popup-component
NillerW Mar 7, 2023
ba5365c
Merge branch 'component/2744-popup-component' of gh_basic:kirbydesign…
NillerW Mar 7, 2023
689b54f
chore: merge with floating directive branch
NillerW Mar 7, 2023
c4e9962
chore: merge with develop
NillerW Mar 7, 2023
192b42d
chore: merge with develop
NillerW Mar 8, 2023
8c0217c
chore: clean
NillerW Mar 8, 2023
a829f0f
chore: clean up
NillerW Mar 8, 2023
0c5ca11
chore: fix merge mistake
NillerW Mar 8, 2023
8471451
chore: add secondart entry
NillerW Mar 8, 2023
5f38ae0
chore: fix template issue
NillerW Mar 8, 2023
fc2345a
fix: import
NillerW Mar 8, 2023
2ac4396
fix: typo
NillerW Mar 8, 2023
a075c64
fix: template issue
NillerW Mar 8, 2023
7c7069e
fix: review comments
NillerW Mar 9, 2023
a5431da
chore: change default size of offset
NillerW Mar 9, 2023
45a9fcf
fix: limit document event listen to open menu. Fix document ref not b…
NillerW Mar 9, 2023
5eb0da4
Merge branch 'develop' into component/2744-action-list
NillerW Mar 9, 2023
4d7fcbf
chore: add example of menu with portal
NillerW Mar 9, 2023
8328e37
fix: add missing attribute description
NillerW Mar 9, 2023
2aefd66
Merge branch 'component/2744-action-list' of gh_basic:kirbydesign/des…
NillerW Mar 9, 2023
c4cc3d5
chore: add extra documentation for menu portal
NillerW Mar 10, 2023
ab84496
chore: remove example not relevant for menu
NillerW Mar 10, 2023
b6c66ff
Merge branch 'develop' into component/2744-action-list
NillerW Mar 13, 2023
905e029
fix: content not placed correctly in safari
NillerW Mar 14, 2023
458dc20
chore: add attentionLevel as input
NillerW Mar 20, 2023
f08a949
feat: add auto find of portal outlet
NillerW Mar 21, 2023
2d008d9
Merge branch 'component/2744-action-list' of gh_basic:kirbydesign/des…
NillerW Mar 21, 2023
1a010ad
Merge branch 'develop' into component/2744-action-list
NillerW Mar 21, 2023
cc2c841
chore: add attentionLevel to menu doc
NillerW Mar 21, 2023
6b5bc60
chore: change default closeOnSelect to false
NillerW Mar 21, 2023
0617fa5
chore: add link to item in menu doc
NillerW Mar 21, 2023
3a7bea6
chore: added documentation for menu
NillerW Mar 21, 2023
c5dc4a5
chore: fix tests
NillerW Mar 21, 2023
ef9bdcc
Merge branch 'component/2744-action-list' of gh_basic:kirbydesign/des…
NillerW Mar 21, 2023
b92d068
chore: merge
NillerW Mar 21, 2023
57ebf27
added example for portal
kodeaben Mar 22, 2023
5e1ba95
Write additional tests
mark-drastrup Mar 23, 2023
b20e419
Merge branch 'component/2744-action-list' of https://github.com/kirby…
mark-drastrup Mar 23, 2023
18c0447
added min-width
kodeaben Mar 23, 2023
6f45545
Write additional tests
mark-drastrup Mar 23, 2023
3dfaf20
Merge branch 'component/2744-action-list' of https://github.com/kirby…
mark-drastrup Mar 23, 2023
6c7ca7a
Fix wrong offset between button and menu
mark-drastrup Mar 23, 2023
65848d8
Remove the icon size input
mark-drastrup Mar 23, 2023
3b862a1
Remove the themeColor input
mark-drastrup Mar 23, 2023
7ec3ce6
fixed item default small
kodeaben Mar 23, 2023
1df8948
added tests for trigger
kodeaben Mar 23, 2023
09e3a13
feat: add kirby-floating directive
NillerW Jan 23, 2023
ab36ce4
chore: made floatingdirective accessible for programical use
NillerW Jan 24, 2023
6a21291
chore: fix bad import
NillerW Jan 24, 2023
14a208d
chore: seperate floatDirective into own PR
NillerW Jan 24, 2023
5be5de9
feat: initial work for actionlist
NillerW Jan 26, 2023
b48a5a3
feat: add isDisabled input to floating directive
NillerW Jan 27, 2023
be5b23e
Add inline styles for minWidth
mark-drastrup Mar 24, 2023
944e686
feat: add focus trigger. Add 'close on' functionality'
NillerW Feb 2, 2023
006564a
feat: action list
NillerW Feb 9, 2023
ffdd66b
Update cookbook documentation
mark-drastrup Mar 24, 2023
72a0fbe
chore: move location of action-list
NillerW Feb 21, 2023
e4326ab
chore: rename action-list to menu
NillerW Feb 22, 2023
0df3662
feat: add option for user provided button
NillerW Feb 23, 2023
c7fe87d
feat: add option for custom button for menu
NillerW Mar 7, 2023
18069dd
Update test for minWidth
mark-drastrup Mar 24, 2023
b95eb68
chore: change triggers to only allow for array
NillerW Feb 9, 2023
1d339f9
chore: add documentation for inputs
NillerW Feb 9, 2023
0c4ca12
chore: add tests for floating directive
NillerW Mar 6, 2023
9beadd4
chore: add floating and portal directives to path
NillerW Mar 6, 2023
e667430
chore: secondary entries
NillerW Mar 6, 2023
e7e2ca4
chore secondary entry
NillerW Mar 6, 2023
f4ca3c9
chore: added handling for autoUpdate when reference changes
NillerW Mar 6, 2023
db14dd7
chore: clean
NillerW Mar 8, 2023
acbe46d
chore: clean up
NillerW Mar 8, 2023
147edd2
chore: fix merge mistake
NillerW Mar 8, 2023
cf6229f
chore: add secondart entry
NillerW Mar 8, 2023
1e9e683
chore: fix template issue
NillerW Mar 8, 2023
a6574bd
fix: import
NillerW Mar 8, 2023
731c038
fix: typo
NillerW Mar 8, 2023
aa3d032
fix: template issue
NillerW Mar 8, 2023
c58a8ec
fix: review comments
NillerW Mar 9, 2023
e5ab2d4
chore: change default size of offset
NillerW Mar 9, 2023
1fe3fef
fix: limit document event listen to open menu. Fix document ref not b…
NillerW Mar 9, 2023
5ab0191
chore: add example of menu with portal
NillerW Mar 9, 2023
95a958c
fix: add missing attribute description
NillerW Mar 9, 2023
2fdd2aa
chore: add extra documentation for menu portal
NillerW Mar 10, 2023
898c008
chore: remove example not relevant for menu
NillerW Mar 10, 2023
ab6868a
fix: content not placed correctly in safari
NillerW Mar 14, 2023
8329654
chore: add attentionLevel as input
NillerW Mar 20, 2023
fa80b34
feat: add auto find of portal outlet
NillerW Mar 21, 2023
b81f907
chore: add attentionLevel to menu doc
NillerW Mar 21, 2023
baa1b5f
chore: change default closeOnSelect to false
NillerW Mar 21, 2023
f5bd2db
chore: add link to item in menu doc
NillerW Mar 21, 2023
54d7ff3
chore: added documentation for menu
NillerW Mar 21, 2023
8bf2aa4
chore: fix tests
NillerW Mar 21, 2023
2c78540
Write additional tests
mark-drastrup Mar 23, 2023
c499445
added example for portal
kodeaben Mar 22, 2023
569fbfd
Write additional tests
mark-drastrup Mar 23, 2023
b9e3137
added min-width
kodeaben Mar 23, 2023
88b6731
Fix wrong offset between button and menu
mark-drastrup Mar 23, 2023
fd721bc
Remove the icon size input
mark-drastrup Mar 23, 2023
d86512d
Remove the themeColor input
mark-drastrup Mar 23, 2023
6a4acd2
fixed item default small
kodeaben Mar 23, 2023
baec3a5
added tests for trigger
kodeaben Mar 23, 2023
925937a
rebased
kodeaben Mar 24, 2023
becc610
made public
kodeaben Mar 24, 2023
5c3a30f
Merge branch 'component/2744-action-list' of https://github.com/kirby…
mark-drastrup Mar 24, 2023
519913a
Update the cookbook
mark-drastrup Mar 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Component } from '@angular/core';

const config = {
selector: 'cookbook-menu-custom-placement-example',
template: `<kirby-menu [placement]="'bottom-end'">
<kirby-item [selectable]="true">
<h3>Action 1</h3>
</kirby-item>
<kirby-item [selectable]="true">
<h3>Action 2</h3>
</kirby-item>
</kirby-menu>`,
};

@Component({
selector: config.selector,
template: config.template,
})
export class MenuCustomPlacementExampleComponent {
template: string = config.template;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Component } from '@angular/core';

const config = {
selector: 'cookbook-menu-hover-trigger-example',
template: `<kirby-menu [triggers]="['hover']">
<kirby-item [selectable]="true">
<h3>Action 1</h3>
</kirby-item>
<kirby-item [selectable]="true">
<h3>Action 2</h3>
</kirby-item>
</kirby-menu>`,
};

@Component({
selector: config.selector,
template: config.template,
})
export class MenuHoverTriggerExampleComponent {
template: string = config.template;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ import { MenuAdvancedExampleComponent } from './examples/advanced';
import { MenuSelectableExampleComponent } from './examples/selectable';
import { MenuCustomButtonExampleComponent } from '~/app/examples/menu-example/examples/customButton';
import { MenuPortalExampleComponent } from '~/app/examples/menu-example/examples/portal';
import { MenuCustomPlacementExampleComponent } from '~/app/examples/menu-example/examples/customPlacement';
import { MenuHoverTriggerExampleComponent } from '~/app/examples/menu-example/examples/hoverTrigger';

const COMPONENT_DECLARATIONS = [
MenuDefaultExampleComponent,
MenuAdvancedExampleComponent,
MenuSelectableExampleComponent,
MenuCustomButtonExampleComponent,
MenuPortalExampleComponent,
MenuCustomPlacementExampleComponent,
MenuHoverTriggerExampleComponent,
];

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ <h3>Portal</h3>
. It is your task to provide a reference to the DOM element for which you want to portal the
menu content into. This can example be achieved by using:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This can for example be achieved by using"

<code>document.getElementsByTagName(outletTag)[0] as HTMLElement</code>
. Here outlet tag references a known tag in the DOM, for which there should only exists one.
This could for example be one of the top elements in the DOM. This is not generalized, since
each project may have different tags for which they want the content to be placed under. This
approach is also to prevent the need for adjusting the DOM with an extra base element, when the
need for portal arises.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Her er et bud på en anden formulering:

In some cases, like when using the menu inside an item, you might experience that the menu doesn't show when clicked. This is due to the menu being placed in a "lower" part of the stacking context.

To solve this, we need to move the menu further up, and we do this by using a "portal".
When using a portal, we tell the DOM to attach out menu to a specific element. Which element to attatch the menu to depends on the architecture of your application, but a rule of thumb is to pick an element which only exists once in the DOM

</p>
<strong>
<em>
Expand Down Expand Up @@ -70,6 +75,28 @@ <h2>Menu: Advanced item</h2>
</div>
</div>

<div class="page-example">
<div>
<h2>Menu: Placement</h2>
<cookbook-example-viewer [html]="menuPlacementExample.template">
<cookbook-menu-custom-placement-example
#menuPlacementExample
></cookbook-menu-custom-placement-example>
</cookbook-example-viewer>
</div>
</div>

<div class="page-example">
<div>
<h2>Menu: Hover trigger</h2>
<cookbook-example-viewer [html]="menuHoverTriggerExample.template">
<cookbook-menu-hover-trigger-example
#menuHoverTriggerExample
></cookbook-menu-hover-trigger-example>
</cookbook-example-viewer>
</div>
</div>

<div class="page-example">
<div>
<h2>Menu: Custom button</h2>
Expand Down