@aquera/nile-elements 0.0.1-beta.3 → 0.0.1-beta.5
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.
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/index.d.ts +4 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/index.js +4 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/index.js.map +1 -1
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/internal/tabbable.d.ts +8 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/internal/tabbable.js +65 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/internal/tabbable.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/index.d.ts +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/index.js +2 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/index.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.css.js +23 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.d.ts +27 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.js +127 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/index.d.ts +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/index.js +2 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/index.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.css.js +146 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.d.ts +44 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.js +180 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/index.d.ts +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/index.js +2 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/index.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.css.js +60 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.d.ts +105 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.js +412 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-input/nile-input.css.js +20 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-input/nile-input.css.js.map +1 -1
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/index.d.ts +1 -41
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/index.js +1 -119
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/index.js.map +1 -1
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.css.js +28 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.d.ts +43 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.js +142 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/index.d.ts +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/index.js +2 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/index.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.css.js +121 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.d.ts +62 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.js +173 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/internal/slot.cjs.js +1 -1
- package/dist/internal/slot.cjs.js.map +1 -1
- package/dist/internal/slot.esm.js +1 -1
- package/dist/internal/tabbable.cjs.js +2 -0
- package/dist/internal/tabbable.cjs.js.map +1 -0
- package/dist/internal/tabbable.esm.js +1 -0
- package/dist/nile-auto-complete/index.cjs.js +2 -0
- package/dist/nile-auto-complete/index.cjs.js.map +1 -0
- package/dist/nile-auto-complete/index.esm.js +1 -0
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +2 -0
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -0
- package/dist/nile-auto-complete/nile-auto-complete.css.cjs.js +2 -0
- package/dist/nile-auto-complete/nile-auto-complete.css.cjs.js.map +1 -0
- package/dist/nile-auto-complete/nile-auto-complete.css.esm.js +11 -0
- package/dist/nile-auto-complete/nile-auto-complete.esm.js +21 -0
- package/dist/nile-chip/index.cjs.js +2 -0
- package/dist/nile-chip/index.cjs.js.map +1 -0
- package/dist/nile-chip/index.esm.js +1 -0
- package/dist/nile-chip/nile-chip.cjs.js +2 -0
- package/dist/nile-chip/nile-chip.cjs.js.map +1 -0
- package/dist/nile-chip/nile-chip.css.cjs.js +2 -0
- package/dist/nile-chip/nile-chip.css.cjs.js.map +1 -0
- package/dist/nile-chip/nile-chip.css.esm.js +134 -0
- package/dist/nile-chip/nile-chip.esm.js +46 -0
- package/dist/nile-dropdown/index.cjs.js +2 -0
- package/dist/nile-dropdown/index.cjs.js.map +1 -0
- package/dist/nile-dropdown/index.esm.js +1 -0
- package/dist/nile-dropdown/nile-dropdown.cjs.js +2 -0
- package/dist/nile-dropdown/nile-dropdown.cjs.js.map +1 -0
- package/dist/nile-dropdown/nile-dropdown.css.cjs.js +2 -0
- package/dist/nile-dropdown/nile-dropdown.css.cjs.js.map +1 -0
- package/dist/nile-dropdown/nile-dropdown.css.esm.js +48 -0
- package/dist/nile-dropdown/nile-dropdown.esm.js +33 -0
- package/dist/nile-input/nile-input.css.cjs.js +1 -1
- package/dist/nile-input/nile-input.css.cjs.js.map +1 -1
- package/dist/nile-input/nile-input.css.esm.js +20 -0
- package/dist/nile-menu/index.cjs.js +1 -1
- package/dist/nile-menu/index.cjs.js.map +1 -1
- package/dist/nile-menu/index.esm.js +1 -53
- package/dist/nile-menu/nile-menu.cjs.js +2 -0
- package/dist/nile-menu/nile-menu.cjs.js.map +1 -0
- package/dist/nile-menu/nile-menu.css.cjs.js +2 -0
- package/dist/nile-menu/nile-menu.css.cjs.js.map +1 -0
- package/dist/nile-menu/nile-menu.css.esm.js +16 -0
- package/dist/nile-menu/nile-menu.esm.js +8 -0
- package/dist/nile-menu-item/index.cjs.js +2 -0
- package/dist/nile-menu-item/index.cjs.js.map +1 -0
- package/dist/nile-menu-item/index.esm.js +1 -0
- package/dist/nile-menu-item/nile-menu-item.cjs.js +2 -0
- package/dist/nile-menu-item/nile-menu-item.cjs.js.map +1 -0
- package/dist/nile-menu-item/nile-menu-item.css.cjs.js +2 -0
- package/dist/nile-menu-item/nile-menu-item.css.cjs.js.map +1 -0
- package/dist/nile-menu-item/nile-menu-item.css.esm.js +109 -0
- package/dist/nile-menu-item/nile-menu-item.esm.js +20 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/tabbable.d.ts +8 -0
- package/dist/src/internal/tabbable.js +65 -0
- package/dist/src/internal/tabbable.js.map +1 -0
- package/dist/src/nile-auto-complete/index.d.ts +1 -0
- package/dist/src/nile-auto-complete/index.js +2 -0
- package/dist/src/nile-auto-complete/index.js.map +1 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.css.d.ts +12 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.css.js +23 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.css.js.map +1 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.d.ts +27 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.js +127 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -0
- package/dist/src/nile-chip/index.d.ts +1 -0
- package/dist/src/nile-chip/index.js +2 -0
- package/dist/src/nile-chip/index.js.map +1 -0
- package/dist/src/nile-chip/nile-chip.css.d.ts +12 -0
- package/dist/src/nile-chip/nile-chip.css.js +146 -0
- package/dist/src/nile-chip/nile-chip.css.js.map +1 -0
- package/dist/src/nile-chip/nile-chip.d.ts +44 -0
- package/dist/src/nile-chip/nile-chip.js +180 -0
- package/dist/src/nile-chip/nile-chip.js.map +1 -0
- package/dist/src/nile-dropdown/index.d.ts +1 -0
- package/dist/src/nile-dropdown/index.js +2 -0
- package/dist/src/nile-dropdown/index.js.map +1 -0
- package/dist/src/nile-dropdown/nile-dropdown.css.d.ts +12 -0
- package/dist/src/nile-dropdown/nile-dropdown.css.js +60 -0
- package/dist/src/nile-dropdown/nile-dropdown.css.js.map +1 -0
- package/dist/src/nile-dropdown/nile-dropdown.d.ts +105 -0
- package/dist/src/nile-dropdown/nile-dropdown.js +412 -0
- package/dist/src/nile-dropdown/nile-dropdown.js.map +1 -0
- package/dist/src/nile-input/nile-input.css.js +20 -0
- package/dist/src/nile-input/nile-input.css.js.map +1 -1
- package/dist/src/nile-menu/index.d.ts +1 -41
- package/dist/src/nile-menu/index.js +1 -119
- package/dist/src/nile-menu/index.js.map +1 -1
- package/dist/src/nile-menu/nile-menu.css.d.ts +12 -0
- package/dist/src/nile-menu/nile-menu.css.js +28 -0
- package/dist/src/nile-menu/nile-menu.css.js.map +1 -0
- package/dist/src/nile-menu/nile-menu.d.ts +43 -0
- package/dist/src/nile-menu/nile-menu.js +142 -0
- package/dist/src/nile-menu/nile-menu.js.map +1 -0
- package/dist/src/nile-menu-item/index.d.ts +1 -0
- package/dist/src/nile-menu-item/index.js +2 -0
- package/dist/src/nile-menu-item/index.js.map +1 -0
- package/dist/src/nile-menu-item/nile-menu-item.css.d.ts +12 -0
- package/dist/src/nile-menu-item/nile-menu-item.css.js +121 -0
- package/dist/src/nile-menu-item/nile-menu-item.css.js.map +1 -0
- package/dist/src/nile-menu-item/nile-menu-item.d.ts +62 -0
- package/dist/src/nile-menu-item/nile-menu-item.js +173 -0
- package/dist/src/nile-menu-item/nile-menu-item.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/watch.cjs.js +1 -1
- package/dist/watch.cjs.js.map +1 -1
- package/dist/watch.esm.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/internal/tabbable.ts +81 -0
- package/src/nile-auto-complete/index.ts +1 -0
- package/src/nile-auto-complete/nile-auto-complete.css.ts +25 -0
- package/src/nile-auto-complete/nile-auto-complete.ts +132 -0
- package/src/nile-chip/index.ts +1 -0
- package/src/nile-chip/nile-chip.css.ts +148 -0
- package/src/nile-chip/nile-chip.ts +189 -0
- package/src/nile-dropdown/index.ts +1 -0
- package/src/nile-dropdown/nile-dropdown.css.ts +62 -0
- package/src/nile-dropdown/nile-dropdown.ts +461 -0
- package/src/nile-input/nile-input.css.ts +20 -0
- package/src/nile-menu/index.ts +1 -116
- package/src/nile-menu/nile-menu.css.ts +30 -0
- package/src/nile-menu/nile-menu.ts +169 -0
- package/src/nile-menu-item/index.ts +1 -0
- package/src/nile-menu-item/nile-menu-item.css.ts +123 -0
- package/src/nile-menu-item/nile-menu-item.ts +171 -0
- package/src/nile-menu/nile-menu.scss +0 -0
@@ -0,0 +1,412 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { __decorate } from "tslib";
|
8
|
+
import { html, property } from 'lit-element';
|
9
|
+
import { customElement } from 'lit/decorators.js';
|
10
|
+
import { styles } from './nile-dropdown.css';
|
11
|
+
import { animateTo, stopAnimations } from '../internal/animate';
|
12
|
+
import { classMap } from 'lit/directives/class-map.js';
|
13
|
+
import { query } from 'lit/decorators.js';
|
14
|
+
import { getAnimation, setDefaultAnimation } from '../utilities/animation-registry';
|
15
|
+
import { getTabbableBoundary } from '../internal/tabbable';
|
16
|
+
import { waitForEvent } from '../internal/event';
|
17
|
+
import { watch } from '../internal/watch';
|
18
|
+
import NileElement from '../internal/nile-element';
|
19
|
+
import '../nile-popup';
|
20
|
+
/**
|
21
|
+
* Nile icon component.
|
22
|
+
*
|
23
|
+
* @tag nile-dropdown
|
24
|
+
* @summary Dropdowns expose additional content that "drops down" in a panel.
|
25
|
+
* @dependency nile-popup
|
26
|
+
*
|
27
|
+
* @slot - The dropdown's main content.
|
28
|
+
* @slot trigger - The dropdown's trigger, usually a `<nile-button>` element.
|
29
|
+
*
|
30
|
+
* @event nile-show - Emitted when the dropdown opens.
|
31
|
+
* @event nile-after-show - Emitted after the dropdown opens and all animations are complete.
|
32
|
+
* @event nile-hide - Emitted when the dropdown closes.
|
33
|
+
* @event nile-after-hide - Emitted after the dropdown closes and all animations are complete.
|
34
|
+
*
|
35
|
+
* @csspart base - The component's base wrapper.
|
36
|
+
* @csspart trigger - The container that wraps the trigger.
|
37
|
+
* @csspart panel - The panel that gets shown when the dropdown is open.
|
38
|
+
*
|
39
|
+
* @animation dropdown.show - The animation to use when showing the dropdown.
|
40
|
+
* @animation dropdown.hide - The animation to use when hiding the dropdown.
|
41
|
+
*/
|
42
|
+
let NileDropdown = class NileDropdown extends NileElement {
|
43
|
+
constructor() {
|
44
|
+
super(...arguments);
|
45
|
+
/**
|
46
|
+
* Indicates whether or not the dropdown is open. You can toggle this attribute to show and hide the dropdown, or you
|
47
|
+
* can use the `show()` and `hide()` methods and this attribute will reflect the dropdown's open state.
|
48
|
+
*/
|
49
|
+
this.open = false;
|
50
|
+
/**
|
51
|
+
* The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel
|
52
|
+
* inside of the viewport.
|
53
|
+
*/
|
54
|
+
this.placement = 'bottom-start';
|
55
|
+
/** Disables the dropdown so the panel will not open. */
|
56
|
+
this.disabled = false;
|
57
|
+
/**
|
58
|
+
* By default, the dropdown is closed when an item is selected. This attribute will keep it open instead. Useful for
|
59
|
+
* dropdowns that allow for multiple interactions.
|
60
|
+
*/
|
61
|
+
this.stayOpenOnSelect = false;
|
62
|
+
/** The distance in pixels from which to offset the panel away from its trigger. */
|
63
|
+
this.distance = 0;
|
64
|
+
this.noOpenOnClick = false;
|
65
|
+
/** The distance in pixels from which to offset the panel along its trigger. */
|
66
|
+
this.skidding = 0;
|
67
|
+
/**
|
68
|
+
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
69
|
+
* `overflow: auto|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
70
|
+
*/
|
71
|
+
this.hoist = false;
|
72
|
+
}
|
73
|
+
connectedCallback() {
|
74
|
+
super.connectedCallback();
|
75
|
+
this.handlePanelSelect = this.handlePanelSelect.bind(this);
|
76
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
77
|
+
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
78
|
+
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
79
|
+
if (!this.containingElement) {
|
80
|
+
this.containingElement = this;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
firstUpdated() {
|
84
|
+
this.panel.hidden = !this.open;
|
85
|
+
// If the dropdown is visible on init, update its position
|
86
|
+
if (this.open) {
|
87
|
+
this.addOpenListeners();
|
88
|
+
this.popup.active = true;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
disconnectedCallback() {
|
92
|
+
super.disconnectedCallback();
|
93
|
+
this.removeOpenListeners();
|
94
|
+
this.hide();
|
95
|
+
}
|
96
|
+
focusOnTrigger() {
|
97
|
+
const trigger = this.trigger.assignedElements({ flatten: true })[0];
|
98
|
+
if (typeof trigger?.focus === 'function') {
|
99
|
+
trigger.focus();
|
100
|
+
}
|
101
|
+
}
|
102
|
+
getMenu() {
|
103
|
+
return this.panel.assignedElements({ flatten: true }).find(el => el.tagName.toLowerCase() === 'nile-menu');
|
104
|
+
}
|
105
|
+
handleKeyDown(event) {
|
106
|
+
// Close when escape is pressed inside an open dropdown. We need to listen on the panel itself and stop propagation
|
107
|
+
// in case any ancestors are also listening for this key.
|
108
|
+
if (this.open && event.key === 'Escape') {
|
109
|
+
event.stopPropagation();
|
110
|
+
this.hide();
|
111
|
+
this.focusOnTrigger();
|
112
|
+
}
|
113
|
+
}
|
114
|
+
handleDocumentKeyDown(event) {
|
115
|
+
// Close when escape or tab is pressed
|
116
|
+
if (event.key === 'Escape' && this.open) {
|
117
|
+
event.stopPropagation();
|
118
|
+
this.focusOnTrigger();
|
119
|
+
this.hide();
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
// Handle tabbing
|
123
|
+
if (event.key === 'Tab') {
|
124
|
+
// Tabbing within an open menu should close the dropdown and refocus the trigger
|
125
|
+
if (this.open && document.activeElement?.tagName.toLowerCase() === 'nile-menu-item') {
|
126
|
+
event.preventDefault();
|
127
|
+
this.hide();
|
128
|
+
this.focusOnTrigger();
|
129
|
+
return;
|
130
|
+
}
|
131
|
+
// Tabbing outside of the containing element closes the panel
|
132
|
+
//
|
133
|
+
// If the dropdown is used within a shadow DOM, we need to obtain the activeElement within that shadowRoot,
|
134
|
+
// otherwise `document.activeElement` will only return the name of the parent shadow DOM element.
|
135
|
+
setTimeout(() => {
|
136
|
+
const activeElement = this.containingElement?.getRootNode() instanceof ShadowRoot
|
137
|
+
? document.activeElement?.shadowRoot?.activeElement
|
138
|
+
: document.activeElement;
|
139
|
+
if (!this.containingElement ||
|
140
|
+
activeElement?.closest(this.containingElement.tagName.toLowerCase()) !== this.containingElement) {
|
141
|
+
this.hide();
|
142
|
+
}
|
143
|
+
});
|
144
|
+
}
|
145
|
+
}
|
146
|
+
handleDocumentMouseDown(event) {
|
147
|
+
// Close when clicking outside of the containing element
|
148
|
+
const path = event.composedPath();
|
149
|
+
if (this.containingElement && !path.includes(this.containingElement)) {
|
150
|
+
this.hide();
|
151
|
+
}
|
152
|
+
}
|
153
|
+
handlePanelSelect(event) {
|
154
|
+
const target = event.target;
|
155
|
+
// Hide the dropdown when a menu item is selected
|
156
|
+
if (!this.stayOpenOnSelect && target.tagName.toLowerCase() === 'nile-menu') {
|
157
|
+
this.hide();
|
158
|
+
this.focusOnTrigger();
|
159
|
+
}
|
160
|
+
}
|
161
|
+
handleTriggerClick() {
|
162
|
+
if (this.noOpenOnClick) {
|
163
|
+
return;
|
164
|
+
}
|
165
|
+
if (this.open) {
|
166
|
+
this.hide();
|
167
|
+
}
|
168
|
+
else {
|
169
|
+
this.show();
|
170
|
+
this.focusOnTrigger();
|
171
|
+
}
|
172
|
+
}
|
173
|
+
handleTriggerKeyDown(event) {
|
174
|
+
// When spacebar/enter is pressed, show the panel but don't focus on the menu. This let's the user press the same
|
175
|
+
// key again to hide the menu in case they don't want to make a selection.
|
176
|
+
// if (['Enter'].includes(event.key)) {
|
177
|
+
// event.preventDefault();
|
178
|
+
// this.handleTriggerClick();
|
179
|
+
// return;
|
180
|
+
// }
|
181
|
+
const menu = this.getMenu();
|
182
|
+
if (menu) {
|
183
|
+
const menuItems = menu.getAllItems();
|
184
|
+
const firstMenuItem = menuItems[0];
|
185
|
+
const lastMenuItem = menuItems[menuItems.length - 1];
|
186
|
+
// When up/down is pressed, we make the assumption that the user is familiar with the menu and plans to make a
|
187
|
+
// selection. Rather than toggle the panel, we focus on the menu (if one exists) and activate the first item for
|
188
|
+
// faster navigation.
|
189
|
+
if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {
|
190
|
+
event.preventDefault();
|
191
|
+
// Show the menu if it's not already open
|
192
|
+
if (!this.open) {
|
193
|
+
this.show();
|
194
|
+
}
|
195
|
+
if (menuItems.length > 0) {
|
196
|
+
// Focus on the first/last menu item after showing
|
197
|
+
this.updateComplete.then(() => {
|
198
|
+
if (event.key === 'ArrowDown' || event.key === 'Home') {
|
199
|
+
menu.setCurrentItem(firstMenuItem);
|
200
|
+
firstMenuItem.focus();
|
201
|
+
}
|
202
|
+
if (event.key === 'ArrowUp' || event.key === 'End') {
|
203
|
+
menu.setCurrentItem(lastMenuItem);
|
204
|
+
lastMenuItem.focus();
|
205
|
+
}
|
206
|
+
});
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
handleTriggerKeyUp(event) {
|
212
|
+
// Prevent space from triggering a click event in Firefox
|
213
|
+
if (event.key === ' ') {
|
214
|
+
event.preventDefault();
|
215
|
+
}
|
216
|
+
}
|
217
|
+
handleTriggerSlotChange() {
|
218
|
+
this.updateAccessibleTrigger();
|
219
|
+
}
|
220
|
+
//
|
221
|
+
// Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and
|
222
|
+
// `aria-expanded`. These must be applied to the "accessible trigger" (the tabbable portion of the trigger element
|
223
|
+
// that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,
|
224
|
+
// a child of the slotted element, or an element in the slotted element's shadow root.
|
225
|
+
//
|
226
|
+
// For example, the accessible trigger of an <nile-button> is a <button> located inside its shadow root.
|
227
|
+
//
|
228
|
+
// To determine this, we assume the first tabbable element in the trigger slot is the "accessible trigger."
|
229
|
+
//
|
230
|
+
updateAccessibleTrigger() {
|
231
|
+
const assignedElements = this.trigger.assignedElements({ flatten: true });
|
232
|
+
const accessibleTrigger = assignedElements.find(el => getTabbableBoundary(el).start);
|
233
|
+
let target;
|
234
|
+
if (accessibleTrigger) {
|
235
|
+
switch (accessibleTrigger.tagName.toLowerCase()) {
|
236
|
+
// nile buttons have to update the internal button so it's announced correctly by screen readers
|
237
|
+
case 'nile-button':
|
238
|
+
case 'nile-icon-button':
|
239
|
+
target = accessibleTrigger.button;
|
240
|
+
break;
|
241
|
+
default:
|
242
|
+
target = accessibleTrigger;
|
243
|
+
}
|
244
|
+
target.setAttribute('aria-haspopup', 'true');
|
245
|
+
target.setAttribute('aria-expanded', this.open ? 'true' : 'false');
|
246
|
+
}
|
247
|
+
}
|
248
|
+
/** Shows the dropdown panel. */
|
249
|
+
async show() {
|
250
|
+
if (this.open) {
|
251
|
+
return undefined;
|
252
|
+
}
|
253
|
+
this.open = true;
|
254
|
+
return waitForEvent(this, 'nile-after-show');
|
255
|
+
}
|
256
|
+
/** Hides the dropdown panel */
|
257
|
+
async hide() {
|
258
|
+
if (!this.open) {
|
259
|
+
return undefined;
|
260
|
+
}
|
261
|
+
this.open = false;
|
262
|
+
return waitForEvent(this, 'nile-after-hide');
|
263
|
+
}
|
264
|
+
/**
|
265
|
+
* Instructs the dropdown menu to reposition. Useful when the position or size of the trigger changes when the menu
|
266
|
+
* is activated.
|
267
|
+
*/
|
268
|
+
reposition() {
|
269
|
+
this.popup.reposition();
|
270
|
+
}
|
271
|
+
addOpenListeners() {
|
272
|
+
this.panel.addEventListener('nile-select', this.handlePanelSelect);
|
273
|
+
this.panel.addEventListener('keydown', this.handleKeyDown);
|
274
|
+
document.addEventListener('keydown', this.handleDocumentKeyDown);
|
275
|
+
document.addEventListener('mousedown', this.handleDocumentMouseDown);
|
276
|
+
}
|
277
|
+
removeOpenListeners() {
|
278
|
+
if (this.panel) {
|
279
|
+
this.panel.removeEventListener('nile-select', this.handlePanelSelect);
|
280
|
+
this.panel.removeEventListener('keydown', this.handleKeyDown);
|
281
|
+
}
|
282
|
+
document.removeEventListener('keydown', this.handleDocumentKeyDown);
|
283
|
+
document.removeEventListener('mousedown', this.handleDocumentMouseDown);
|
284
|
+
}
|
285
|
+
async handleOpenChange() {
|
286
|
+
if (this.disabled) {
|
287
|
+
this.open = false;
|
288
|
+
return;
|
289
|
+
}
|
290
|
+
this.updateAccessibleTrigger();
|
291
|
+
if (this.open) {
|
292
|
+
// Show
|
293
|
+
this.emit('nile-show');
|
294
|
+
this.addOpenListeners();
|
295
|
+
await stopAnimations(this);
|
296
|
+
this.panel.hidden = false;
|
297
|
+
this.popup.active = true;
|
298
|
+
const { keyframes, options } = getAnimation(this, 'dropdown.show', { dir: '' });
|
299
|
+
await animateTo(this.popup.popup, keyframes, options);
|
300
|
+
this.emit('nile-after-show');
|
301
|
+
}
|
302
|
+
else {
|
303
|
+
// Hide
|
304
|
+
this.emit('nile-hide');
|
305
|
+
this.removeOpenListeners();
|
306
|
+
await stopAnimations(this);
|
307
|
+
const { keyframes, options } = getAnimation(this, 'dropdown.hide', { dir: '' });
|
308
|
+
await animateTo(this.popup.popup, keyframes, options);
|
309
|
+
this.panel.hidden = true;
|
310
|
+
this.popup.active = false;
|
311
|
+
this.emit('nile-after-hide');
|
312
|
+
}
|
313
|
+
}
|
314
|
+
render() {
|
315
|
+
return html `
|
316
|
+
<nile-popup
|
317
|
+
part="base"
|
318
|
+
id="dropdown"
|
319
|
+
placement=${this.placement}
|
320
|
+
distance=${this.distance}
|
321
|
+
skidding=${this.skidding}
|
322
|
+
strategy=${this.hoist ? 'fixed' : 'absolute'}
|
323
|
+
flip
|
324
|
+
shift
|
325
|
+
auto-size="both"
|
326
|
+
auto-size-padding="10"
|
327
|
+
class=${classMap({
|
328
|
+
dropdown: true,
|
329
|
+
'dropdown--open': this.open
|
330
|
+
})}
|
331
|
+
>
|
332
|
+
<slot
|
333
|
+
name="trigger"
|
334
|
+
slot="anchor"
|
335
|
+
part="trigger"
|
336
|
+
class="dropdown__trigger"
|
337
|
+
@click=${this.handleTriggerClick}
|
338
|
+
@keydown=${this.handleTriggerKeyDown}
|
339
|
+
@keyup=${this.handleTriggerKeyUp}
|
340
|
+
@slotchange=${this.handleTriggerSlotChange}
|
341
|
+
></slot>
|
342
|
+
|
343
|
+
<slot
|
344
|
+
part="panel"
|
345
|
+
class="dropdown__panel"
|
346
|
+
aria-hidden=${this.open ? 'false' : 'true'}
|
347
|
+
aria-labelledby="dropdown"
|
348
|
+
></slot>
|
349
|
+
</nile-popup>
|
350
|
+
`;
|
351
|
+
}
|
352
|
+
};
|
353
|
+
NileDropdown.styles = styles;
|
354
|
+
__decorate([
|
355
|
+
query('.dropdown')
|
356
|
+
], NileDropdown.prototype, "popup", void 0);
|
357
|
+
__decorate([
|
358
|
+
query('.dropdown__trigger')
|
359
|
+
], NileDropdown.prototype, "trigger", void 0);
|
360
|
+
__decorate([
|
361
|
+
query('.dropdown__panel')
|
362
|
+
], NileDropdown.prototype, "panel", void 0);
|
363
|
+
__decorate([
|
364
|
+
property({ type: Boolean, reflect: true })
|
365
|
+
], NileDropdown.prototype, "open", void 0);
|
366
|
+
__decorate([
|
367
|
+
property({ reflect: true })
|
368
|
+
], NileDropdown.prototype, "placement", void 0);
|
369
|
+
__decorate([
|
370
|
+
property({ type: Boolean, reflect: true })
|
371
|
+
], NileDropdown.prototype, "disabled", void 0);
|
372
|
+
__decorate([
|
373
|
+
property({ attribute: 'stay-open-on-select', type: Boolean, reflect: true })
|
374
|
+
], NileDropdown.prototype, "stayOpenOnSelect", void 0);
|
375
|
+
__decorate([
|
376
|
+
property({ attribute: false })
|
377
|
+
], NileDropdown.prototype, "containingElement", void 0);
|
378
|
+
__decorate([
|
379
|
+
property({ type: Number })
|
380
|
+
], NileDropdown.prototype, "distance", void 0);
|
381
|
+
__decorate([
|
382
|
+
property({ type: Boolean })
|
383
|
+
], NileDropdown.prototype, "noOpenOnClick", void 0);
|
384
|
+
__decorate([
|
385
|
+
property({ type: Number })
|
386
|
+
], NileDropdown.prototype, "skidding", void 0);
|
387
|
+
__decorate([
|
388
|
+
property({ type: Boolean })
|
389
|
+
], NileDropdown.prototype, "hoist", void 0);
|
390
|
+
__decorate([
|
391
|
+
watch('open', { waitUntilFirstUpdate: true })
|
392
|
+
], NileDropdown.prototype, "handleOpenChange", null);
|
393
|
+
NileDropdown = __decorate([
|
394
|
+
customElement('nile-dropdown')
|
395
|
+
], NileDropdown);
|
396
|
+
export { NileDropdown };
|
397
|
+
setDefaultAnimation('dropdown.show', {
|
398
|
+
keyframes: [
|
399
|
+
{ opacity: 0, scale: 0.9 },
|
400
|
+
{ opacity: 1, scale: 1 }
|
401
|
+
],
|
402
|
+
options: { duration: 100, easing: 'ease' }
|
403
|
+
});
|
404
|
+
setDefaultAnimation('dropdown.hide', {
|
405
|
+
keyframes: [
|
406
|
+
{ opacity: 1, scale: 1 },
|
407
|
+
{ opacity: 0, scale: 0.9 }
|
408
|
+
],
|
409
|
+
options: { duration: 100, easing: 'ease' }
|
410
|
+
});
|
411
|
+
export default NileDropdown;
|
412
|
+
//# sourceMappingURL=nile-dropdown.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nile-dropdown.js","sourceRoot":"","sources":["../../../src/nile-dropdown/nile-dropdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAa,IAAI,EAAE,QAAQ,EAAiC,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAG,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,mBAAmB,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M,EAAE;CAC3C,CAAC,CAAC;AAEH,eAAe,YAAY,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {LitElement, html, property, CSSResultArray, TemplateResult} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport {styles} from './nile-dropdown.css';\nimport { animateTo, stopAnimations } from '../internal/animate';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { query } from 'lit/decorators.js';\nimport { getAnimation, setDefaultAnimation } from '../utilities/animation-registry';\nimport { getTabbableBoundary } from '../internal/tabbable';\nimport { waitForEvent } from '../internal/event';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\nimport type NileButton from '../nile-button/nile-button';\nimport type NileIconButton from '../nile-icon-button/nile-icon-button';\nimport type { NileMenu } from '../nile-menu';\nimport type { NilePopup } from '../nile-popup';\nimport '../nile-popup';\n\n/**\n * Nile icon component.\n *\n * @tag nile-dropdown\n * @summary Dropdowns expose additional content that \"drops down\" in a panel.\n * @dependency nile-popup\n *\n * @slot - The dropdown's main content.\n * @slot trigger - The dropdown's trigger, usually a `<nile-button>` element.\n *\n * @event nile-show - Emitted when the dropdown opens.\n * @event nile-after-show - Emitted after the dropdown opens and all animations are complete.\n * @event nile-hide - Emitted when the dropdown closes.\n * @event nile-after-hide - Emitted after the dropdown closes and all animations are complete.\n *\n * @csspart base - The component's base wrapper.\n * @csspart trigger - The container that wraps the trigger.\n * @csspart panel - The panel that gets shown when the dropdown is open.\n *\n * @animation dropdown.show - The animation to use when showing the dropdown.\n * @animation dropdown.hide - The animation to use when hiding the dropdown.\n */\n@customElement('nile-dropdown')\nexport class NileDropdown extends NileElement {\n static styles: CSSResultGroup = styles;\n\n @query('.dropdown') popup: NilePopup;\n @query('.dropdown__trigger') trigger: HTMLSlotElement;\n @query('.dropdown__panel') panel: HTMLSlotElement;\n\n\n /**\n * Indicates whether or not the dropdown is open. You can toggle this attribute to show and hide the dropdown, or you\n * can use the `show()` and `hide()` methods and this attribute will reflect the dropdown's open state.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n\n /**\n * The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel\n * inside of the viewport.\n */\n @property({ reflect: true }) placement:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end' = 'bottom-start';\n\n /** Disables the dropdown so the panel will not open. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * By default, the dropdown is closed when an item is selected. This attribute will keep it open instead. Useful for\n * dropdowns that allow for multiple interactions.\n */\n @property({ attribute: 'stay-open-on-select', type: Boolean, reflect: true }) stayOpenOnSelect = false;\n\n /**\n * The dropdown will close when the user interacts outside of this element (e.g. clicking). Useful for composing other\n * components that use a dropdown internally.\n */\n @property({ attribute: false }) containingElement?: HTMLElement;\n\n /** The distance in pixels from which to offset the panel away from its trigger. */\n @property({ type: Number }) distance = 0;\n\n\n @property({ type: Boolean }) noOpenOnClick = false;\n\n /** The distance in pixels from which to offset the panel along its trigger. */\n @property({ type: Number }) skidding = 0;\n\n /**\n * Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n * `overflow: auto|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.\n */\n @property({ type: Boolean }) hoist = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.handlePanelSelect = this.handlePanelSelect.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);\n this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);\n\n if (!this.containingElement) {\n this.containingElement = this;\n }\n }\n\n firstUpdated() {\n this.panel.hidden = !this.open;\n\n // If the dropdown is visible on init, update its position\n if (this.open) {\n this.addOpenListeners();\n this.popup.active = true;\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeOpenListeners();\n this.hide();\n }\n\n focusOnTrigger() {\n const trigger = this.trigger.assignedElements({ flatten: true })[0] as HTMLElement | undefined;\n if (typeof trigger?.focus === 'function') {\n trigger.focus();\n }\n }\n\n getMenu() {\n return this.panel.assignedElements({ flatten: true }).find(el => el.tagName.toLowerCase() === 'nile-menu') as\n | NileMenu\n | undefined;\n }\n\n handleKeyDown(event: KeyboardEvent) {\n // Close when escape is pressed inside an open dropdown. We need to listen on the panel itself and stop propagation\n // in case any ancestors are also listening for this key.\n if (this.open && event.key === 'Escape') {\n event.stopPropagation();\n this.hide();\n this.focusOnTrigger();\n }\n }\n\n handleDocumentKeyDown(event: KeyboardEvent) {\n // Close when escape or tab is pressed\n if (event.key === 'Escape' && this.open) {\n event.stopPropagation();\n this.focusOnTrigger();\n this.hide();\n return;\n }\n\n // Handle tabbing\n if (event.key === 'Tab') {\n // Tabbing within an open menu should close the dropdown and refocus the trigger\n if (this.open && document.activeElement?.tagName.toLowerCase() === 'nile-menu-item') {\n event.preventDefault();\n this.hide();\n this.focusOnTrigger();\n return;\n }\n\n // Tabbing outside of the containing element closes the panel\n //\n // If the dropdown is used within a shadow DOM, we need to obtain the activeElement within that shadowRoot,\n // otherwise `document.activeElement` will only return the name of the parent shadow DOM element.\n setTimeout(() => {\n const activeElement =\n this.containingElement?.getRootNode() instanceof ShadowRoot\n ? document.activeElement?.shadowRoot?.activeElement\n : document.activeElement;\n\n if (\n !this.containingElement ||\n activeElement?.closest(this.containingElement.tagName.toLowerCase()) !== this.containingElement\n ) {\n this.hide();\n }\n });\n }\n }\n\n handleDocumentMouseDown(event: MouseEvent) {\n // Close when clicking outside of the containing element\n const path = event.composedPath();\n if (this.containingElement && !path.includes(this.containingElement)) {\n this.hide();\n }\n }\n\n handlePanelSelect(event: any) {\n const target = event.target as HTMLElement;\n\n // Hide the dropdown when a menu item is selected\n if (!this.stayOpenOnSelect && target.tagName.toLowerCase() === 'nile-menu') {\n this.hide();\n this.focusOnTrigger();\n }\n }\n\n handleTriggerClick() {\n if(this.noOpenOnClick){\n return;\n }\n if (this.open) {\n this.hide();\n } else {\n this.show();\n this.focusOnTrigger();\n }\n }\n\n handleTriggerKeyDown(event: KeyboardEvent) {\n // When spacebar/enter is pressed, show the panel but don't focus on the menu. This let's the user press the same\n // key again to hide the menu in case they don't want to make a selection.\n // if (['Enter'].includes(event.key)) {\n // event.preventDefault();\n // this.handleTriggerClick();\n // return;\n // }\n\n const menu = this.getMenu();\n\n if (menu) {\n const menuItems = menu.getAllItems();\n const firstMenuItem = menuItems[0];\n const lastMenuItem = menuItems[menuItems.length - 1];\n\n // When up/down is pressed, we make the assumption that the user is familiar with the menu and plans to make a\n // selection. Rather than toggle the panel, we focus on the menu (if one exists) and activate the first item for\n // faster navigation.\n if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {\n event.preventDefault();\n\n // Show the menu if it's not already open\n if (!this.open) {\n this.show();\n }\n\n if (menuItems.length > 0) {\n // Focus on the first/last menu item after showing\n this.updateComplete.then(() => {\n if (event.key === 'ArrowDown' || event.key === 'Home') {\n menu.setCurrentItem(firstMenuItem);\n firstMenuItem.focus();\n }\n\n if (event.key === 'ArrowUp' || event.key === 'End') {\n menu.setCurrentItem(lastMenuItem);\n lastMenuItem.focus();\n }\n });\n }\n }\n }\n }\n\n handleTriggerKeyUp(event: KeyboardEvent) {\n // Prevent space from triggering a click event in Firefox\n if (event.key === ' ') {\n event.preventDefault();\n }\n }\n\n handleTriggerSlotChange() {\n this.updateAccessibleTrigger();\n }\n\n //\n // Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and\n // `aria-expanded`. These must be applied to the \"accessible trigger\" (the tabbable portion of the trigger element\n // that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,\n // a child of the slotted element, or an element in the slotted element's shadow root.\n //\n // For example, the accessible trigger of an <nile-button> is a <button> located inside its shadow root.\n //\n // To determine this, we assume the first tabbable element in the trigger slot is the \"accessible trigger.\"\n //\n updateAccessibleTrigger() {\n const assignedElements = this.trigger.assignedElements({ flatten: true }) as HTMLElement[];\n const accessibleTrigger = assignedElements.find(el => getTabbableBoundary(el).start);\n let target: HTMLElement;\n\n if (accessibleTrigger) {\n switch (accessibleTrigger.tagName.toLowerCase()) {\n // nile buttons have to update the internal button so it's announced correctly by screen readers\n case 'nile-button':\n case 'nile-icon-button':\n target = (accessibleTrigger as NileButton | NileIconButton).button;\n break;\n\n default:\n target = accessibleTrigger;\n }\n\n target.setAttribute('aria-haspopup', 'true');\n target.setAttribute('aria-expanded', this.open ? 'true' : 'false');\n }\n }\n\n /** Shows the dropdown panel. */\n async show() {\n if (this.open) {\n return undefined;\n }\n\n this.open = true;\n return waitForEvent(this, 'nile-after-show');\n }\n\n /** Hides the dropdown panel */\n async hide() {\n if (!this.open) {\n return undefined;\n }\n\n this.open = false;\n return waitForEvent(this, 'nile-after-hide');\n }\n\n /**\n * Instructs the dropdown menu to reposition. Useful when the position or size of the trigger changes when the menu\n * is activated.\n */\n reposition() {\n this.popup.reposition();\n }\n\n addOpenListeners() {\n this.panel.addEventListener('nile-select', this.handlePanelSelect);\n this.panel.addEventListener('keydown', this.handleKeyDown);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n document.addEventListener('mousedown', this.handleDocumentMouseDown);\n }\n\n removeOpenListeners() {\n if (this.panel) {\n this.panel.removeEventListener('nile-select', this.handlePanelSelect);\n this.panel.removeEventListener('keydown', this.handleKeyDown);\n }\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n document.removeEventListener('mousedown', this.handleDocumentMouseDown);\n }\n\n @watch('open', { waitUntilFirstUpdate: true })\n async handleOpenChange() {\n if (this.disabled) {\n this.open = false;\n return;\n }\n\n this.updateAccessibleTrigger();\n\n if (this.open) {\n // Show\n this.emit('nile-show');\n this.addOpenListeners();\n\n await stopAnimations(this);\n this.panel.hidden = false;\n this.popup.active = true;\n const { keyframes, options } = getAnimation(this, 'dropdown.show', { dir: '' });\n await animateTo(this.popup.popup, keyframes, options);\n\n this.emit('nile-after-show');\n } else {\n // Hide\n this.emit('nile-hide');\n this.removeOpenListeners();\n\n await stopAnimations(this);\n const { keyframes, options } = getAnimation(this, 'dropdown.hide', { dir: '' });\n await animateTo(this.popup.popup, keyframes, options);\n this.panel.hidden = true;\n this.popup.active = false;\n\n this.emit('nile-after-hide');\n }\n }\n\n render() {\n return html`\n <nile-popup\n part=\"base\"\n id=\"dropdown\"\n placement=${this.placement}\n distance=${this.distance}\n skidding=${this.skidding}\n strategy=${this.hoist ? 'fixed' : 'absolute'}\n flip\n shift\n auto-size=\"both\"\n auto-size-padding=\"10\"\n class=${classMap({\n dropdown: true,\n 'dropdown--open': this.open\n })}\n >\n <slot\n name=\"trigger\"\n slot=\"anchor\"\n part=\"trigger\"\n class=\"dropdown__trigger\"\n @click=${this.handleTriggerClick}\n @keydown=${this.handleTriggerKeyDown}\n @keyup=${this.handleTriggerKeyUp}\n @slotchange=${this.handleTriggerSlotChange}\n ></slot>\n\n <slot\n part=\"panel\"\n class=\"dropdown__panel\"\n aria-hidden=${this.open ? 'false' : 'true'}\n aria-labelledby=\"dropdown\"\n ></slot>\n </nile-popup>\n `;\n }\n}\n\nsetDefaultAnimation('dropdown.show', {\n keyframes: [\n { opacity: 0, scale: 0.9 },\n { opacity: 1, scale: 1 }\n ],\n options: { duration: 100, easing: 'ease' }\n});\n\nsetDefaultAnimation('dropdown.hide', {\n keyframes: [\n { opacity: 1, scale: 1 },\n { opacity: 0, scale: 0.9 }\n ],\n options: { duration: 100, easing: 'ease' }\n});\n\nexport default NileDropdown;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-dropdown': NileDropdown;\n }\n}\n"]}
|
@@ -414,6 +414,26 @@ export const styles = css `
|
|
414
414
|
.input--no-spin-buttons input[type='number'] {
|
415
415
|
-moz-appearance: textfield;
|
416
416
|
}
|
417
|
+
|
418
|
+
:host([no-border]) .input--standard {
|
419
|
+
border: none; /* Remove borders on all sides */
|
420
|
+
box-shadow: 0 0 0 0;
|
421
|
+
}
|
422
|
+
|
423
|
+
:host([no-border]) .input--standard:hover:not(.input--disabled) {
|
424
|
+
border: none; /* Remove borders on all sides */
|
425
|
+
box-shadow: 0 0 0 0;
|
426
|
+
}
|
427
|
+
|
428
|
+
:host([no-border]) .input--standard.input--focused:not(.input--disabled) {
|
429
|
+
border: none; /* Remove borders on all sides */
|
430
|
+
box-shadow: 0 0 0 0;
|
431
|
+
}
|
432
|
+
|
433
|
+
:host([no-border]) .input--standard.input--focused:not(.input--disabled) {
|
434
|
+
border: none; /* Remove borders on all sides */
|
435
|
+
box-shadow: 0 0 0 0;
|
436
|
+
}
|
417
437
|
`;
|
418
438
|
export default [styles];
|
419
439
|
//# sourceMappingURL=nile-input.css.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-input.css.js","sourceRoot":"","sources":["../../../src/nile-input/nile-input.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsZxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * Input CSS\n */\nexport const styles = css`\n :host {\n display: block;\n }\n\n .form-control .form-control__label {\n display: none;\n }\n\n .form-control .form-control__help-text {\n display: none;\n }\n\n /* Label */\n .form-control--has-label .form-control__label {\n display: inline-block;\n color: inherit;\n margin-bottom: 0.125rem;\n }\n\n .form-control--has-label.form-control--small .form-control__label {\n font-size: 0.875rem;\n }\n\n .form-control--has-label.form-control--medium .form-control__label {\n font-size: 1rem;\n }\n\n .form-control--has-label.form-control--large .form-control__label {\n font-size: 1.25rem;\n }\n\n :host([required]) .form-control--has-label .form-control__label::after {\n content: '*';\n margin-inline-start: -2px;\n color: undefined;\n }\n\n /* Help text */\n .form-control--has-help-text .form-control__help-text {\n display: block;\n color: hsl(240 3.8% 46.1%);\n margin-top: 0.125rem;\n }\n\n .form-control--has-help-text.form-control--small .form-control__help-text {\n font-size: 0.75rem;\n }\n\n .form-control--has-help-text.form-control--medium .form-control__help-text {\n font-size: 0.875rem;\n }\n\n .form-control--has-help-text.form-control--large .form-control__help-text {\n font-size: 1rem;\n }\n\n .form-control--has-help-text.form-control--radio-group\n .form-control__help-text {\n margin-top: 0.25rem;\n }\n\n .input {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: stretch;\n justify-content: start;\n position: relative;\n width: 100%;\n font-family: inherit;\n font-weight: 400;\n letter-spacing: normal;\n vertical-align: middle;\n overflow: hidden;\n cursor: text;\n transition: 150ms color, 150ms border, 150ms box-shadow,\n 150ms background-color;\n }\n\n /* Standard inputs */\n .input--standard {\n background-color: hsl(0, 0%, 100%);\n border: solid 1px #c7ced4;\n }\n\n .input--standard:hover:not(.input--disabled) {\n background-color: hsl(0, 0%, 100%);\n border-color: #000000;\n }\n\n .input--standard.input--focused:not(.input--disabled) {\n background-color: hsl(0, 0%, 100%);\n border-color: #005ea6;\n box-shadow: 0 0 0 3px hsl(198.6 88.7% 48.4% / 40%);\n }\n\n .input--standard.input--focused:not(.input--disabled) .input__control {\n color: hsl(240 5.3% 26.1%);\n }\n\n .input--standard.input--disabled {\n background-color: hsl(240 4.8% 95.9%);\n border-color: hsl(240 4.9% 83.9%);\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .input--standard.input--disabled .input__control {\n color: hsl(240 5.9% 10%);\n }\n\n .input--standard.input--disabled .input__control::placeholder {\n color: hsl(240 5.2% 33.9%);\n }\n\n .input--standard.input--warning {\n border-color: #e5bf43;\n }\n\n .input--standard.input--error {\n border-color: #e5434d;\n }\n\n .input--standard.input--success {\n border-color: #43e5c0;\n }\n\n /* Filled inputs */\n .input--filled {\n border: none;\n background-color: hsl(240 4.8% 95.9%);\n color: hsl(240 5.3% 26.1%);\n }\n\n .input--filled:hover:not(.input--disabled) {\n background-color: hsl(240 4.8% 95.9%);\n }\n\n .input--filled.input--focused:not(.input--disabled) {\n background-color: hsl(240 4.8% 95.9%);\n outline: solid 3px hsl(200.4 98% 39.4%);\n outline-offset: 1px;\n }\n\n .input--filled.input--disabled {\n background-color: hsl(240 4.8% 95.9%);\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .input__control {\n flex: 1 1 auto;\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n min-width: 0;\n height: 100%;\n color: hsl(240 5.3% 26.1%);\n border: none;\n background: none;\n box-shadow: none;\n padding: 0;\n margin: 0;\n cursor: inherit;\n -webkit-appearance: none;\n }\n\n .input__control::-webkit-search-decoration,\n .input__control::-webkit-search-cancel-button,\n .input__control::-webkit-search-results-button,\n .input__control::-webkit-search-results-decoration {\n -webkit-appearance: none;\n }\n\n .input__control:-webkit-autofill {\n box-shadow: 0 0 0 3.125rem hsl(0, 0%, 100%) inset !important;\n -webkit-text-fill-color: hsl(198.6 88.7% 48.4%);\n caret-color: hsl(240 5.3% 26.1%);\n }\n\n .input__control:-webkit-autofill:hover {\n box-shadow: 0 0 0 3.125rem hsl(0, 0%, 100%) inset !important;\n -webkit-text-fill-color: hsl(198.6 88.7% 48.4%);\n caret-color: hsl(240 5.3% 26.1%);\n }\n\n .input__control:-webkit-autofill:focus {\n box-shadow: 0 0 0 3.125rem hsl(0, 0%, 100%) inset !important;\n -webkit-text-fill-color: hsl(198.6 88.7% 48.4%);\n caret-color: hsl(240 5.3% 26.1%);\n }\n\n .input__control:-webkit-autofill:active {\n box-shadow: 0 0 0 3.125rem hsl(0, 0%, 100%) inset !important;\n -webkit-text-fill-color: hsl(198.6 88.7% 48.4%);\n caret-color: hsl(240 5.3% 26.1%);\n }\n\n .input--filled .input__control:-webkit-autofill {\n box-shadow: 0 0 0 3.125rem hsl(240 4.8% 95.9%) inset !important;\n }\n\n .input--filled .input__control:-webkit-autofill:hover {\n box-shadow: 0 0 0 3.125rem hsl(240 4.8% 95.9%) inset !important;\n }\n\n .input--filled .input__control:-webkit-autofill:focus {\n box-shadow: 0 0 0 3.125rem hsl(240 4.8% 95.9%) inset !important;\n }\n\n .input--filled .input__control:-webkit-autofill:active {\n box-shadow: 0 0 0 3.125rem hsl(240 4.8% 95.9%) inset !important;\n }\n\n .input__control::placeholder {\n color: hsl(240 3.8% 46.1%);\n user-select: none;\n }\n\n .input:hover:not(.input--disabled) .input__control {\n color: hsl(240 5.3% 26.1%);\n }\n\n .input__control:focus {\n outline: none;\n }\n\n .input__prefix,\n .input__suffix {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n cursor: default;\n }\n\n .input__prefix::slotted(nile-icon) {\n color: hsl(240 3.8% 46.1%);\n }\n\n .input__suffix::slotted(nile-icon) {\n color: hsl(240 3.8% 46.1%);\n }\n\n /*\n * Size modifiers\n */\n\n .input--small {\n border-radius: 0.25rem;\n font-size: 0.875rem;\n height: 1.875rem;\n }\n\n .input--small .input__control {\n height: calc(1.875rem);\n padding: 0 0.75rem;\n }\n\n .input--small .input__clear {\n width: calc(1em + 0.75rem * 2);\n }\n\n .input--small .input__password-toggle {\n width: calc(1em + 0.75rem * 2);\n }\n\n .input--small .input__prefix::slotted(*) {\n margin-inline-start: 0.75rem;\n }\n\n .input--small .input__suffix::slotted(*) {\n margin-inline-end: 0.75rem;\n }\n\n .input--medium {\n border-radius: 0.25rem;\n font-size: 1rem;\n height: 38px;\n }\n\n .input--medium .input__control {\n height: calc(42px - 1px * 2);\n padding: 0 1rem;\n }\n\n .input--medium .input__clear {\n width: calc(1em + 1rem * 2);\n }\n\n .input--medium .input__password-toggle {\n width: calc(1em + 1rem * 2);\n }\n\n .input--medium .input__prefix::slotted(*) {\n margin-inline-start: 1rem;\n }\n\n .input--medium .input__suffix::slotted(*) {\n margin-inline-end: 1rem;\n }\n\n .input--large {\n border-radius: 0.25rem;\n font-size: 1.25rem;\n height: 3.125rem;\n }\n\n .input--large .input__control {\n height: calc(3.125rem - 1px * 2);\n padding: 0 1.25rem;\n }\n\n .input--large .input__clear {\n width: calc(1em + 1.25rem * 2);\n }\n\n .input--large .input__password-toggle {\n width: calc(1em + 1.25rem * 2);\n }\n\n .input--large .input__prefix::slotted(*) {\n margin-inline-start: 1.25rem;\n }\n\n .input--large .input__suffix::slotted(*) {\n margin-inline-end: 1.25rem;\n }\n\n /*\n * Pill modifier\n */\n\n .input--pill.input--small {\n border-radius: 1.875rem;\n }\n\n .input--pill.input--medium {\n border-radius: 2.5rem;\n }\n\n .input--pill.input--large {\n border-radius: 3.125rem;\n }\n\n /*\n * Clearable + Password Toggle\n */\n\n .input__clear {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: inherit;\n color: hsl(240 3.8% 46.1%);\n border: none;\n background: none;\n padding: 0;\n transition: 150ms color;\n cursor: pointer;\n }\n\n .input__password-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: inherit;\n color: hsl(240 3.8% 46.1%);\n border: none;\n background: none;\n padding: 0;\n transition: 150ms color;\n cursor: pointer;\n }\n\n .input__clear:hover {\n color: hsl(240 5.2% 33.9%);\n }\n\n .input__password-toggle:hover {\n color: hsl(240 5.2% 33.9%);\n }\n\n .input__clear:focus,\n .input__password-toggle:focus {\n outline: none;\n }\n\n .input--empty .input__clear {\n visibility: hidden;\n }\n\n /* Don't show the browser's password toggle in Edge */\n ::-ms-reveal {\n display: none;\n }\n\n /* Hide the built-in number spinner */\n .input--no-spin-buttons input[type='number']::-webkit-outer-spin-button,\n .input--no-spin-buttons input[type='number']::-webkit-inner-spin-button {\n -webkit-appearance: none;\n display: none;\n }\n\n .input--no-spin-buttons input[type='number'] {\n -moz-appearance: textfield;\n }\n`;\n\nexport default [styles];\n"]}
|
1
|
+
{"version":3,"file":"nile-input.css.js","sourceRoot":"","sources":["../../../src/nile-input/nile-input.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0axB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * Input CSS\n */\nexport const styles = css`\n :host {\n display: block;\n }\n\n .form-control .form-control__label {\n display: none;\n }\n\n .form-control .form-control__help-text {\n display: none;\n }\n\n /* Label */\n .form-control--has-label .form-control__label {\n display: inline-block;\n color: inherit;\n margin-bottom: 0.125rem;\n }\n\n .form-control--has-label.form-control--small .form-control__label {\n font-size: 0.875rem;\n }\n\n .form-control--has-label.form-control--medium .form-control__label {\n font-size: 1rem;\n }\n\n .form-control--has-label.form-control--large .form-control__label {\n font-size: 1.25rem;\n }\n\n :host([required]) .form-control--has-label .form-control__label::after {\n content: '*';\n margin-inline-start: -2px;\n color: undefined;\n }\n\n /* Help text */\n .form-control--has-help-text .form-control__help-text {\n display: block;\n color: hsl(240 3.8% 46.1%);\n margin-top: 0.125rem;\n }\n\n .form-control--has-help-text.form-control--small .form-control__help-text {\n font-size: 0.75rem;\n }\n\n .form-control--has-help-text.form-control--medium .form-control__help-text {\n font-size: 0.875rem;\n }\n\n .form-control--has-help-text.form-control--large .form-control__help-text {\n font-size: 1rem;\n }\n\n .form-control--has-help-text.form-control--radio-group\n .form-control__help-text {\n margin-top: 0.25rem;\n }\n\n .input {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: stretch;\n justify-content: start;\n position: relative;\n width: 100%;\n font-family: inherit;\n font-weight: 400;\n letter-spacing: normal;\n vertical-align: middle;\n overflow: hidden;\n cursor: text;\n transition: 150ms color, 150ms border, 150ms box-shadow,\n 150ms background-color;\n }\n\n /* Standard inputs */\n .input--standard {\n background-color: hsl(0, 0%, 100%);\n border: solid 1px #c7ced4;\n }\n\n .input--standard:hover:not(.input--disabled) {\n background-color: hsl(0, 0%, 100%);\n border-color: #000000;\n }\n\n .input--standard.input--focused:not(.input--disabled) {\n background-color: hsl(0, 0%, 100%);\n border-color: #005ea6;\n box-shadow: 0 0 0 3px hsl(198.6 88.7% 48.4% / 40%);\n }\n\n .input--standard.input--focused:not(.input--disabled) .input__control {\n color: hsl(240 5.3% 26.1%);\n }\n\n .input--standard.input--disabled {\n background-color: hsl(240 4.8% 95.9%);\n border-color: hsl(240 4.9% 83.9%);\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .input--standard.input--disabled .input__control {\n color: hsl(240 5.9% 10%);\n }\n\n .input--standard.input--disabled .input__control::placeholder {\n color: hsl(240 5.2% 33.9%);\n }\n\n .input--standard.input--warning {\n border-color: #e5bf43;\n }\n\n .input--standard.input--error {\n border-color: #e5434d;\n }\n\n .input--standard.input--success {\n border-color: #43e5c0;\n }\n\n /* Filled inputs */\n .input--filled {\n border: none;\n background-color: hsl(240 4.8% 95.9%);\n color: hsl(240 5.3% 26.1%);\n }\n\n .input--filled:hover:not(.input--disabled) {\n background-color: hsl(240 4.8% 95.9%);\n }\n\n .input--filled.input--focused:not(.input--disabled) {\n background-color: hsl(240 4.8% 95.9%);\n outline: solid 3px hsl(200.4 98% 39.4%);\n outline-offset: 1px;\n }\n\n .input--filled.input--disabled {\n background-color: hsl(240 4.8% 95.9%);\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .input__control {\n flex: 1 1 auto;\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n min-width: 0;\n height: 100%;\n color: hsl(240 5.3% 26.1%);\n border: none;\n background: none;\n box-shadow: none;\n padding: 0;\n margin: 0;\n cursor: inherit;\n -webkit-appearance: none;\n }\n\n .input__control::-webkit-search-decoration,\n .input__control::-webkit-search-cancel-button,\n .input__control::-webkit-search-results-button,\n .input__control::-webkit-search-results-decoration {\n -webkit-appearance: none;\n }\n\n .input__control:-webkit-autofill {\n box-shadow: 0 0 0 3.125rem hsl(0, 0%, 100%) inset !important;\n -webkit-text-fill-color: hsl(198.6 88.7% 48.4%);\n caret-color: hsl(240 5.3% 26.1%);\n }\n\n .input__control:-webkit-autofill:hover {\n box-shadow: 0 0 0 3.125rem hsl(0, 0%, 100%) inset !important;\n -webkit-text-fill-color: hsl(198.6 88.7% 48.4%);\n caret-color: hsl(240 5.3% 26.1%);\n }\n\n .input__control:-webkit-autofill:focus {\n box-shadow: 0 0 0 3.125rem hsl(0, 0%, 100%) inset !important;\n -webkit-text-fill-color: hsl(198.6 88.7% 48.4%);\n caret-color: hsl(240 5.3% 26.1%);\n }\n\n .input__control:-webkit-autofill:active {\n box-shadow: 0 0 0 3.125rem hsl(0, 0%, 100%) inset !important;\n -webkit-text-fill-color: hsl(198.6 88.7% 48.4%);\n caret-color: hsl(240 5.3% 26.1%);\n }\n\n .input--filled .input__control:-webkit-autofill {\n box-shadow: 0 0 0 3.125rem hsl(240 4.8% 95.9%) inset !important;\n }\n\n .input--filled .input__control:-webkit-autofill:hover {\n box-shadow: 0 0 0 3.125rem hsl(240 4.8% 95.9%) inset !important;\n }\n\n .input--filled .input__control:-webkit-autofill:focus {\n box-shadow: 0 0 0 3.125rem hsl(240 4.8% 95.9%) inset !important;\n }\n\n .input--filled .input__control:-webkit-autofill:active {\n box-shadow: 0 0 0 3.125rem hsl(240 4.8% 95.9%) inset !important;\n }\n\n .input__control::placeholder {\n color: hsl(240 3.8% 46.1%);\n user-select: none;\n }\n\n .input:hover:not(.input--disabled) .input__control {\n color: hsl(240 5.3% 26.1%);\n }\n\n .input__control:focus {\n outline: none;\n }\n\n .input__prefix,\n .input__suffix {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n cursor: default;\n }\n\n .input__prefix::slotted(nile-icon) {\n color: hsl(240 3.8% 46.1%);\n }\n\n .input__suffix::slotted(nile-icon) {\n color: hsl(240 3.8% 46.1%);\n }\n\n /*\n * Size modifiers\n */\n\n .input--small {\n border-radius: 0.25rem;\n font-size: 0.875rem;\n height: 1.875rem;\n }\n\n .input--small .input__control {\n height: calc(1.875rem);\n padding: 0 0.75rem;\n }\n\n .input--small .input__clear {\n width: calc(1em + 0.75rem * 2);\n }\n\n .input--small .input__password-toggle {\n width: calc(1em + 0.75rem * 2);\n }\n\n .input--small .input__prefix::slotted(*) {\n margin-inline-start: 0.75rem;\n }\n\n .input--small .input__suffix::slotted(*) {\n margin-inline-end: 0.75rem;\n }\n\n .input--medium {\n border-radius: 0.25rem;\n font-size: 1rem;\n height: 38px;\n }\n\n .input--medium .input__control {\n height: calc(42px - 1px * 2);\n padding: 0 1rem;\n }\n\n .input--medium .input__clear {\n width: calc(1em + 1rem * 2);\n }\n\n .input--medium .input__password-toggle {\n width: calc(1em + 1rem * 2);\n }\n\n .input--medium .input__prefix::slotted(*) {\n margin-inline-start: 1rem;\n }\n\n .input--medium .input__suffix::slotted(*) {\n margin-inline-end: 1rem;\n }\n\n .input--large {\n border-radius: 0.25rem;\n font-size: 1.25rem;\n height: 3.125rem;\n }\n\n .input--large .input__control {\n height: calc(3.125rem - 1px * 2);\n padding: 0 1.25rem;\n }\n\n .input--large .input__clear {\n width: calc(1em + 1.25rem * 2);\n }\n\n .input--large .input__password-toggle {\n width: calc(1em + 1.25rem * 2);\n }\n\n .input--large .input__prefix::slotted(*) {\n margin-inline-start: 1.25rem;\n }\n\n .input--large .input__suffix::slotted(*) {\n margin-inline-end: 1.25rem;\n }\n\n /*\n * Pill modifier\n */\n\n .input--pill.input--small {\n border-radius: 1.875rem;\n }\n\n .input--pill.input--medium {\n border-radius: 2.5rem;\n }\n\n .input--pill.input--large {\n border-radius: 3.125rem;\n }\n\n /*\n * Clearable + Password Toggle\n */\n\n .input__clear {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: inherit;\n color: hsl(240 3.8% 46.1%);\n border: none;\n background: none;\n padding: 0;\n transition: 150ms color;\n cursor: pointer;\n }\n\n .input__password-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: inherit;\n color: hsl(240 3.8% 46.1%);\n border: none;\n background: none;\n padding: 0;\n transition: 150ms color;\n cursor: pointer;\n }\n\n .input__clear:hover {\n color: hsl(240 5.2% 33.9%);\n }\n\n .input__password-toggle:hover {\n color: hsl(240 5.2% 33.9%);\n }\n\n .input__clear:focus,\n .input__password-toggle:focus {\n outline: none;\n }\n\n .input--empty .input__clear {\n visibility: hidden;\n }\n\n /* Don't show the browser's password toggle in Edge */\n ::-ms-reveal {\n display: none;\n }\n\n /* Hide the built-in number spinner */\n .input--no-spin-buttons input[type='number']::-webkit-outer-spin-button,\n .input--no-spin-buttons input[type='number']::-webkit-inner-spin-button {\n -webkit-appearance: none;\n display: none;\n }\n\n .input--no-spin-buttons input[type='number'] {\n -moz-appearance: textfield;\n }\n\n :host([no-border]) .input--standard {\n border: none; /* Remove borders on all sides */\n box-shadow: 0 0 0 0;\n }\n\n :host([no-border]) .input--standard:hover:not(.input--disabled) {\n border: none; /* Remove borders on all sides */\n box-shadow: 0 0 0 0;\n }\n\n :host([no-border]) .input--standard.input--focused:not(.input--disabled) {\n border: none; /* Remove borders on all sides */\n box-shadow: 0 0 0 0;\n }\n\n :host([no-border]) .input--standard.input--focused:not(.input--disabled) {\n border: none; /* Remove borders on all sides */\n box-shadow: 0 0 0 0;\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -1,41 +1 @@
|
|
1
|
-
|
2
|
-
/**
|
3
|
-
* An nile-menu element.
|
4
|
-
*
|
5
|
-
* @fires count-changed - Indicates when the count changes
|
6
|
-
* @slot - This element has a slot
|
7
|
-
* @csspart button - The button
|
8
|
-
*/
|
9
|
-
export declare class NileMenu extends LitElement {
|
10
|
-
static styles: import("lit").CSSResult;
|
11
|
-
/**
|
12
|
-
* Button Lab
|
13
|
-
*/
|
14
|
-
name: string;
|
15
|
-
/**
|
16
|
-
* Button Lab
|
17
|
-
*/
|
18
|
-
icon: string;
|
19
|
-
/**
|
20
|
-
* Button Lab
|
21
|
-
*/
|
22
|
-
isActive: boolean;
|
23
|
-
/**
|
24
|
-
* Displays shorter version
|
25
|
-
*/
|
26
|
-
short: boolean;
|
27
|
-
get buttonClassMap(): {
|
28
|
-
'nds-menu--active': boolean;
|
29
|
-
'nds-menu--short': boolean;
|
30
|
-
};
|
31
|
-
/**
|
32
|
-
* Button Lab
|
33
|
-
*/
|
34
|
-
href: string;
|
35
|
-
render(): import("lit-html").TemplateResult<1>;
|
36
|
-
}
|
37
|
-
declare global {
|
38
|
-
interface HTMLElementTagNameMap {
|
39
|
-
'nile-menu': NileMenu;
|
40
|
-
}
|
41
|
-
}
|
1
|
+
export { NileMenu } from './nile-menu';
|