@felleslosninger/minid-elements 0.0.99 → 0.0.101
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/dist/components/alert.component.d.ts +2 -6
- package/dist/components/alert.component.d.ts.map +1 -1
- package/dist/components/alert.js +18 -58
- package/dist/components/alert.js.map +1 -1
- package/dist/components/button.component.d.ts +0 -1
- package/dist/components/button.component.d.ts.map +1 -1
- package/dist/components/button.js +4 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/checkbox.component.d.ts +46 -6
- package/dist/components/checkbox.component.d.ts.map +1 -1
- package/dist/components/checkbox.js +115 -87
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code-input.component.d.ts +16 -15
- package/dist/components/code-input.component.d.ts.map +1 -1
- package/dist/components/code-input.js +105 -105
- package/dist/components/code-input.js.map +1 -1
- package/dist/components/combobox.component.d.ts +7 -10
- package/dist/components/combobox.component.d.ts.map +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/dialog.js +2 -2
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropdown.component.d.ts +47 -3
- package/dist/components/dropdown.component.d.ts.map +1 -1
- package/dist/components/dropdown.js +262 -29
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/link.js.map +1 -1
- package/dist/components/menu-item.component.d.ts +3 -0
- package/dist/components/menu-item.component.d.ts.map +1 -1
- package/dist/components/menu-item.js +20 -2
- package/dist/components/menu-item.js.map +1 -1
- package/dist/components/menu.component.d.ts +1 -1
- package/dist/components/menu.component.d.ts.map +1 -1
- package/dist/components/menu.js +5 -5
- package/dist/components/menu.js.map +1 -1
- package/dist/components/phone-input.component.d.ts +5 -3
- package/dist/components/phone-input.component.d.ts.map +1 -1
- package/dist/components/phone-input.js +23 -35
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/popup.component.d.ts +0 -1
- package/dist/components/popup.component.d.ts.map +1 -1
- package/dist/components/popup.js +1 -23
- package/dist/components/popup.js.map +1 -1
- package/dist/components/search.js +1 -1
- package/dist/components/search.js.map +1 -1
- package/dist/components/spinner.component.d.ts.map +1 -1
- package/dist/components/spinner.js +9 -1
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/step-indicator.component.d.ts +14 -0
- package/dist/components/step-indicator.component.d.ts.map +1 -0
- package/dist/components/step-indicator.js +58 -0
- package/dist/components/step-indicator.js.map +1 -0
- package/dist/components/textfield.component.d.ts +1 -0
- package/dist/components/textfield.component.d.ts.map +1 -1
- package/dist/components/textfield.js +9 -7
- package/dist/components/textfield.js.map +1 -1
- package/dist/designsystemet-tailwind.css +1 -1
- package/dist/events/events.d.ts +2 -0
- package/dist/events/events.d.ts.map +1 -0
- package/dist/events/mid-select.d.ts +10 -0
- package/dist/events/mid-select.d.ts.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mixins/form-controller.mixin.d.ts.map +1 -1
- package/dist/mixins/form-controller.mixin.js +0 -3
- package/dist/mixins/form-controller.mixin.js.map +1 -1
- package/dist/mixins/tailwind.mixin.js +2 -2
- package/package.json +17 -13
package/dist/components/popup.js
CHANGED
|
@@ -6,9 +6,6 @@ import { styled } from "../mixins/tailwind.mixin.js";
|
|
|
6
6
|
import { offsetParent } from "composed-offset-position";
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __typeError = (msg) => {
|
|
10
|
-
throw TypeError(msg);
|
|
11
|
-
};
|
|
12
9
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
13
10
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
14
11
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -17,10 +14,6 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
17
14
|
if (kind && result) __defProp(target, key, result);
|
|
18
15
|
return result;
|
|
19
16
|
};
|
|
20
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
21
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
22
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
23
|
-
var _MinidPopup_instances, handleAnchorClick_fn;
|
|
24
17
|
function isVirtualElement(e) {
|
|
25
18
|
return e !== null && typeof e === "object" && "getBoundingClientRect" in e && ("contextElement" in e ? e instanceof Element : true);
|
|
26
19
|
}
|
|
@@ -129,7 +122,6 @@ const styles = [
|
|
|
129
122
|
let MinidPopup = class extends styled(LitElement, styles) {
|
|
130
123
|
constructor() {
|
|
131
124
|
super(...arguments);
|
|
132
|
-
__privateAdd(this, _MinidPopup_instances);
|
|
133
125
|
this.anchorEl = null;
|
|
134
126
|
this.anchor = "";
|
|
135
127
|
this.active = false;
|
|
@@ -432,11 +424,7 @@ let MinidPopup = class extends styled(LitElement, styles) {
|
|
|
432
424
|
}
|
|
433
425
|
render() {
|
|
434
426
|
return html`
|
|
435
|
-
<slot
|
|
436
|
-
name="anchor"
|
|
437
|
-
@slotchange=${this.handleAnchorChange}
|
|
438
|
-
@click=${__privateMethod(this, _MinidPopup_instances, handleAnchorClick_fn)}
|
|
439
|
-
></slot>
|
|
427
|
+
<slot name="anchor" @slotchange=${this.handleAnchorChange}></slot>
|
|
440
428
|
|
|
441
429
|
<span
|
|
442
430
|
part="hover-bridge"
|
|
@@ -465,16 +453,6 @@ let MinidPopup = class extends styled(LitElement, styles) {
|
|
|
465
453
|
`;
|
|
466
454
|
}
|
|
467
455
|
};
|
|
468
|
-
_MinidPopup_instances = /* @__PURE__ */ new WeakSet();
|
|
469
|
-
handleAnchorClick_fn = function() {
|
|
470
|
-
this.dispatchEvent(
|
|
471
|
-
new CustomEvent("mid-anchor-click", {
|
|
472
|
-
bubbles: true,
|
|
473
|
-
composed: true,
|
|
474
|
-
detail: { id: this.id }
|
|
475
|
-
})
|
|
476
|
-
);
|
|
477
|
-
};
|
|
478
456
|
__decorateClass([
|
|
479
457
|
query(".popup")
|
|
480
458
|
], MinidPopup.prototype, "popup", 2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popup.js","sources":["../../src/components/popup.component.ts"],"sourcesContent":["/*\n\nCopyright (c) 2020 A Beautiful Site, LLC\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n offset,\n platform,\n shift,\n size,\n} from '@floating-ui/dom';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { css, html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport { offsetParent } from 'composed-offset-position';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-popup': MinidPopup;\n }\n}\n\nexport interface VirtualElement {\n getBoundingClientRect: () => DOMRect;\n contextElement?: Element;\n}\n\nfunction isVirtualElement(e: unknown): e is VirtualElement {\n return (\n e !== null &&\n typeof e === 'object' &&\n 'getBoundingClientRect' in e &&\n ('contextElement' in e ? e instanceof Element : true)\n );\n}\n\nconst styles = [\n css`\n :host {\n --arrow-color: white;\n --arrow-border-color: transparent;\n --arrow-size: 6px;\n\n /*\n These properties are computed to account for the arrow's dimensions after being rotated 45º. The constant\n 0.7071 is derived from sin(45), which is the diagonal size of the arrow's container after rotating.\n */\n --arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);\n --arrow-padding-offset: calc(\n var(--arrow-size-diagonal) - var(--arrow-size)\n );\n\n display: contents;\n }\n\n .popup {\n position: absolute;\n isolation: isolate;\n max-width: var(--auto-size-available-width, none);\n max-height: var(--auto-size-available-height, none);\n z-index: 900;\n }\n\n .popup--fixed {\n position: fixed;\n }\n\n .popup:not(.popup--active) {\n display: none;\n }\n\n .popup__arrow {\n position: absolute;\n width: calc(var(--arrow-size-diagonal) * 2);\n height: calc(var(--arrow-size-diagonal) * 2);\n border: 1px solid var(--arrow-border-color);\n border-left-color: transparent;\n border-top-color: transparent;\n rotate: 45deg;\n background: var(--arrow-color);\n z-index: 901;\n }\n\n /* Hover bridge */\n .popup-hover-bridge:not(.popup-hover-bridge--visible) {\n display: none;\n }\n\n .popup-hover-bridge {\n position: fixed;\n z-index: calc(900 - 1);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n clip-path: polygon(\n var(--hover-bridge-top-left-x, 0) var(--hover-bridge-top-left-y, 0),\n var(--hover-bridge-top-right-x, 0) var(--hover-bridge-top-right-y, 0),\n var(--hover-bridge-bottom-right-x, 0)\n var(--hover-bridge-bottom-right-y, 0),\n var(--hover-bridge-bottom-left-x, 0)\n var(--hover-bridge-bottom-left-y, 0)\n );\n }\n\n :host([data-current-placement^='top']) .popup {\n transform-origin: bottom;\n }\n\n :host([data-current-placement^='bottom']) .popup {\n transform-origin: top;\n }\n\n :host([data-current-placement^='left']) .popup {\n transform-origin: right;\n }\n\n :host([data-current-placement^='right']) .popup {\n transform-origin: left;\n }\n\n :host([data-current-placement^='top']) .popup__arrow {\n transform: rotate(0deg);\n }\n\n :host([data-current-placement^='bottom']) .popup__arrow {\n transform: rotate(180deg);\n }\n\n :host([data-current-placement^='left']) .popup__arrow {\n transform: rotate(-90deg);\n }\n\n :host([data-current-placement^='right']) .popup__arrow {\n transform: rotate(90deg);\n }\n `,\n];\n\n/**\n * @summary Popup is a utility that lets you declaratively anchor \"popup\" containers to another element.\n * @documentation https://shoelace.style/components/popup\n * @status stable\n * @since 2.0\n *\n * @event mid-reposition - Emitted when the popup is repositioned. This event can fire a lot, so avoid putting expensive\n * operations in your listener or consider debouncing it.\n *\n * @slot - The popup's content.\n * @slot anchor - The element the popup will be anchored to. If the anchor lives outside of the popup, you can use the\n * `anchor` attribute or property instead.\n *\n * @csspart arrow - The arrow's container. Avoid setting `top|bottom|left|right` properties, as these values are\n * assigned dynamically as the popup moves. This is most useful for applying a background color to match the popup, and\n * maybe a border or box shadow.\n * @csspart popup - The popup's container. Useful for setting a background color, box shadow, etc.\n * @csspart hover-bridge - The hover bridge element. Only available when the `hover-bridge` option is enabled.\n *\n * @cssproperty [--arrow-size=6px] - The size of the arrow. Note that an arrow won't be shown unless the `arrow`\n * attribute is used.\n * @cssproperty [--arrow-color=white] - The color of the arrow.\n * @cssproperty [--arrow-border-color=transparent] - The color for the arrow border\n * @cssproperty [--auto-size-available-width] - A read-only custom property that determines the amount of width the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n * @cssproperty [--auto-size-available-height] - A read-only custom property that determines the amount of height the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n */\n\n@customElement('mid-popup')\nexport class MinidPopup extends styled(LitElement, styles) {\n private anchorEl: Element | VirtualElement | null = null;\n private cleanup?: ReturnType<typeof autoUpdate>;\n\n /**\n * A reference to the internal popup container. Useful for animating and styling the popup with JavaScript.\n */\n @query('.popup')\n popup!: HTMLElement;\n\n @query('.popup__arrow')\n private arrowEl!: HTMLElement;\n\n /**\n * The element the popup will be anchored to. If the anchor lives outside of the popup, you can provide the anchor\n * element `id`, a DOM element reference, or a `VirtualElement`. If the anchor lives inside the popup, use the\n * `anchor` slot instead.\n */\n @property()\n anchor: Element | string | VirtualElement = '';\n\n /**\n * Activates the positioning logic and shows the popup. When this attribute is removed, the positioning logic is torn\n * down and the popup will be hidden.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The preferred placement of the popup. Note that the actual placement will vary as configured to keep the\n * panel inside of the viewport.\n */\n @property({ reflect: true })\n 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' = 'top';\n\n /**\n * Determines how the popup is positioned. The `absolute` strategy works well in most cases, but if overflow is\n * clipped, using a `fixed` position strategy can often workaround it.\n */\n @property({ reflect: true })\n strategy: 'absolute' | 'fixed' = 'absolute';\n\n /**\n * The distance in pixels from which to offset the panel away from its anchor.\n */\n @property({ type: Number })\n distance = 0;\n\n /**\n * The distance in pixels from which to offset the panel along its anchor.\n */\n @property({ type: Number })\n skidding = 0;\n\n /**\n * Attaches an arrow to the popup. The arrow's size and color can be customized using the `--arrow-size` and\n * `--arrow-color` custom properties. For additional customizations, you can also target the arrow using\n * `::part(arrow)` in your stylesheet.\n */\n @property({ type: Boolean })\n arrow = false;\n\n /**\n * The placement of the arrow. The default is `anchor`, which will align the arrow as close to the center of the\n * anchor as possible, considering available space and `arrow-padding`. A value of `start`, `end`, or `center` will\n * align the arrow to the start, end, or center of the popover instead.\n */\n @property({ attribute: 'arrow-placement' })\n arrowPlacement: 'start' | 'end' | 'center' | 'anchor' = 'anchor';\n\n /**\n * The amount of padding between the arrow and the edges of the popup. If the popup has a border-radius, for example,\n * this will prevent it from overflowing the corners.\n */\n @property({ attribute: 'arrow-padding', type: Number })\n arrowPadding = 10;\n\n /**\n * When set, placement of the popup will flip to the opposite site to keep it in view. You can use\n * `flipFallbackPlacements` to further configure how the fallback placement is determined.\n */\n @property({ type: Boolean })\n flip = false;\n\n /**\n * If the preferred placement doesn't fit, popup will be tested in these fallback placements until one fits. Must be a\n * string of any number of placements separated by a space, e.g. \"top bottom left\". If no placement fits, the flip\n * fallback strategy will be used instead.\n */\n @property({\n attribute: 'flip-fallback-placements',\n converter: {\n fromAttribute: (value: string) => {\n return value\n .split(' ')\n .map((p) => p.trim())\n .filter((p) => p !== '');\n },\n toAttribute: (value: []) => {\n return value.join(' ');\n },\n },\n })\n flipFallbackPlacements = '';\n\n /**\n * When neither the preferred placement nor the fallback placements fit, this value will be used to determine whether\n * the popup should be positioned using the best available fit based on available space or as it was initially\n * preferred.\n */\n @property({ attribute: 'flip-fallback-strategy' })\n flipFallbackStrategy: 'best-fit' | 'initial' = 'best-fit';\n\n /**\n * The flip boundary describes clipping element(s) that overflow will be checked relative to when flipping. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n flipBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the flip behavior will occur.\n */\n @property({ attribute: 'flip-padding', type: Number })\n flipPadding = 0;\n\n /**\n * Moves the popup along the axis to keep it in view when clipped.\n */\n @property({ type: Boolean })\n shift = false;\n\n /**\n * The shift boundary describes clipping element(s) that overflow will be checked relative to when shifting. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n shiftBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the shift behavior will occur.\n */\n @property({ attribute: 'shift-padding', type: Number })\n shiftPadding = 0;\n\n /** When set, this will cause the popup to automatically resize itself to prevent it from overflowing. */\n @property({ attribute: 'auto-size' }) autoSize?:\n | 'horizontal'\n | 'vertical'\n | 'both';\n\n /**\n * Syncs the popup's width or height to that of the anchor element.\n */\n @property()\n sync?: 'width' | 'height' | 'both';\n\n /**\n * The auto-size boundary describes clipping element(s) that overflow will be checked relative to when resizing. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n autoSizeBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the auto-size behavior will occur.\n */\n @property({ attribute: 'auto-size-padding', type: Number }) autoSizePadding =\n 0;\n\n /**\n * When a gap exists between the anchor and the popup element, this option will add a \"hover bridge\" that fills the\n * gap using an invisible element. This makes listening for events such as `mouseenter` and `mouseleave` more sane\n * because the pointer never technically leaves the element. The hover bridge will only be drawn when the popover is\n * active.\n */\n @property({ attribute: 'hover-bridge', type: Boolean }) hoverBridge = false;\n\n async connectedCallback() {\n super.connectedCallback();\n\n // Start the positioner after the first update\n await this.updateComplete;\n this.start();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.stop();\n }\n\n async updated(changedProps: Map<string, unknown>) {\n super.updated(changedProps);\n\n // Start or stop the positioner when active changes\n if (changedProps.has('active')) {\n if (this.active) {\n this.start();\n } else {\n this.stop();\n }\n }\n\n // Update the anchor when anchor changes\n if (changedProps.has('anchor')) {\n this.handleAnchorChange();\n }\n\n // All other properties will trigger a reposition when active\n if (this.active) {\n await this.updateComplete;\n this.reposition();\n }\n }\n\n private async handleAnchorChange() {\n await this.stop();\n\n if (this.anchor && typeof this.anchor === 'string') {\n // Locate the anchor by id\n const root = this.getRootNode() as Document | ShadowRoot;\n this.anchorEl = root.getElementById(this.anchor);\n } else if (\n this.anchor instanceof Element ||\n isVirtualElement(this.anchor)\n ) {\n // Use the anchor's reference\n this.anchorEl = this.anchor;\n } else {\n // Look for a slotted anchor\n this.anchorEl = this.querySelector<HTMLElement>('[slot=\"anchor\"]');\n }\n\n // If the anchor is a <slot>, we'll use the first assigned element as the target since slots use `display: contents`\n // and positioning can't be calculated on them\n if (this.anchorEl instanceof HTMLSlotElement) {\n this.anchorEl = this.anchorEl.assignedElements({\n flatten: true,\n })[0] as HTMLElement;\n }\n\n // If the anchor is valid, start it up\n if (this.anchorEl && this.active) {\n this.start();\n }\n }\n\n private start() {\n // We can't start the positioner without an anchor\n if (!this.anchorEl) {\n return;\n }\n\n this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {\n this.reposition();\n });\n }\n\n private async stop(): Promise<void> {\n return new Promise((resolve) => {\n if (this.cleanup) {\n this.cleanup();\n this.cleanup = undefined;\n this.removeAttribute('data-current-placement');\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n requestAnimationFrame(() => resolve());\n } else {\n resolve();\n }\n });\n }\n\n /** Forces the popup to recalculate and reposition itself. */\n reposition() {\n // Nothing to do if the popup is inactive or the anchor doesn't exist\n if (!this.active || !this.anchorEl) {\n return;\n }\n\n //\n // NOTE: Floating UI middlewares are order dependent: https://floating-ui.com/docs/middleware\n //\n const middleware = [\n // The offset middleware goes first\n offset({ mainAxis: this.distance, crossAxis: this.skidding }),\n ];\n\n // First we sync width/height\n if (this.sync) {\n middleware.push(\n size({\n apply: ({ rects }) => {\n const syncWidth = this.sync === 'width' || this.sync === 'both';\n const syncHeight = this.sync === 'height' || this.sync === 'both';\n this.popup.style.width = syncWidth\n ? `${rects.reference.width}px`\n : '';\n this.popup.style.height = syncHeight\n ? `${rects.reference.height}px`\n : '';\n },\n })\n );\n } else {\n // Cleanup styles if we're not matching width/height\n this.popup.style.width = '';\n this.popup.style.height = '';\n }\n\n // Then we flip\n if (this.flip) {\n middleware.push(\n flip({\n boundary: this.flipBoundary,\n // @ts-expect-error - We're converting a string attribute to an array here\n fallbackPlacements: this.flipFallbackPlacements,\n fallbackStrategy:\n this.flipFallbackStrategy === 'best-fit'\n ? 'bestFit'\n : 'initialPlacement',\n padding: this.flipPadding,\n })\n );\n }\n\n // Then we shift\n if (this.shift) {\n middleware.push(\n shift({\n boundary: this.shiftBoundary,\n padding: this.shiftPadding,\n })\n );\n }\n\n // Now we adjust the size as needed\n if (this.autoSize) {\n middleware.push(\n size({\n boundary: this.autoSizeBoundary,\n padding: this.autoSizePadding,\n apply: ({ availableWidth, availableHeight }) => {\n if (this.autoSize === 'vertical' || this.autoSize === 'both') {\n this.style.setProperty(\n '--auto-size-available-height',\n `${availableHeight}px`\n );\n } else {\n this.style.removeProperty('--auto-size-available-height');\n }\n\n if (this.autoSize === 'horizontal' || this.autoSize === 'both') {\n this.style.setProperty(\n '--auto-size-available-width',\n `${availableWidth}px`\n );\n } else {\n this.style.removeProperty('--auto-size-available-width');\n }\n },\n })\n );\n } else {\n // Cleanup styles if we're no longer using auto-size\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n }\n\n // Finally, we add an arrow\n if (this.arrow) {\n middleware.push(\n arrow({\n element: this.arrowEl,\n padding: this.arrowPadding,\n })\n );\n }\n\n //\n // Use custom positioning logic if the strategy is absolute. Otherwise, fall back to the default logic.\n //\n // More info: https://github.com/shoelace-style/shoelace/issues/1135\n //\n const getOffsetParent =\n this.strategy === 'absolute'\n ? (element: Element) => platform.getOffsetParent(element, offsetParent)\n : platform.getOffsetParent;\n\n computePosition(this.anchorEl, this.popup, {\n placement: this.placement,\n middleware,\n strategy: this.strategy,\n platform: {\n ...platform,\n getOffsetParent,\n },\n }).then(({ x, y, middlewareData, placement }) => {\n //\n // Even though we have our own localization utility, it uses different heuristics to determine RTL. Because of\n // that, we'll use the same approach that Floating UI uses.\n //\n // Source: https://github.com/floating-ui/floating-ui/blob/cb3b6ab07f95275730d3e6e46c702f8d4908b55c/packages/dom/src/utils/getDocumentRect.ts#L31\n //\n const isRtl = this.matches(':dir(rtl)');\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]]!;\n\n this.setAttribute('data-current-placement', placement);\n\n Object.assign(this.popup.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n\n if (this.arrow) {\n const arrowX = middlewareData.arrow!.x;\n const arrowY = middlewareData.arrow!.y;\n let top = '';\n let right = '';\n let bottom = '';\n let left = '';\n\n if (this.arrowPlacement === 'start') {\n // Start\n const value =\n typeof arrowX === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n top =\n typeof arrowY === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n right = isRtl ? value : '';\n left = isRtl ? '' : value;\n } else if (this.arrowPlacement === 'end') {\n // End\n const value =\n typeof arrowX === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n right = isRtl ? '' : value;\n left = isRtl ? value : '';\n bottom =\n typeof arrowY === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n } else if (this.arrowPlacement === 'center') {\n // Center\n left =\n typeof arrowX === 'number'\n ? `calc(50% - var(--arrow-size-diagonal))`\n : '';\n top =\n typeof arrowY === 'number'\n ? `calc(50% - var(--arrow-size-diagonal))`\n : '';\n } else {\n // Anchor (default)\n left = typeof arrowX === 'number' ? `${arrowX}px` : '';\n top = typeof arrowY === 'number' ? `${arrowY}px` : '';\n }\n\n Object.assign(this.arrowEl.style, {\n top,\n right,\n bottom,\n left,\n [staticSide]: 'calc(var(--arrow-size-diagonal) * -1)',\n });\n }\n });\n\n // Wait until the new position is drawn before updating the hover bridge, otherwise it can get out of sync\n requestAnimationFrame(() => this.updateHoverBridge());\n\n this.dispatchEvent(new Event('mid-reposition'));\n }\n\n private updateHoverBridge = () => {\n if (this.hoverBridge && this.anchorEl) {\n const anchorRect = this.anchorEl.getBoundingClientRect();\n const popupRect = this.popup.getBoundingClientRect();\n const isVertical =\n this.placement.includes('top') || this.placement.includes('bottom');\n let topLeftX = 0;\n let topLeftY = 0;\n let topRightX = 0;\n let topRightY = 0;\n let bottomLeftX = 0;\n let bottomLeftY = 0;\n let bottomRightX = 0;\n let bottomRightY = 0;\n\n if (isVertical) {\n if (anchorRect.top < popupRect.top) {\n // Anchor is above\n topLeftX = anchorRect.left;\n topLeftY = anchorRect.bottom;\n topRightX = anchorRect.right;\n topRightY = anchorRect.bottom;\n\n bottomLeftX = popupRect.left;\n bottomLeftY = popupRect.top;\n bottomRightX = popupRect.right;\n bottomRightY = popupRect.top;\n } else {\n // Anchor is below\n topLeftX = popupRect.left;\n topLeftY = popupRect.bottom;\n topRightX = popupRect.right;\n topRightY = popupRect.bottom;\n\n bottomLeftX = anchorRect.left;\n bottomLeftY = anchorRect.top;\n bottomRightX = anchorRect.right;\n bottomRightY = anchorRect.top;\n }\n } else {\n if (anchorRect.left < popupRect.left) {\n // Anchor is on the left\n topLeftX = anchorRect.right;\n topLeftY = anchorRect.top;\n topRightX = popupRect.left;\n topRightY = popupRect.top;\n\n bottomLeftX = anchorRect.right;\n bottomLeftY = anchorRect.bottom;\n bottomRightX = popupRect.left;\n bottomRightY = popupRect.bottom;\n } else {\n // Anchor is on the right\n topLeftX = popupRect.right;\n topLeftY = popupRect.top;\n topRightX = anchorRect.left;\n topRightY = anchorRect.top;\n\n bottomLeftX = popupRect.right;\n bottomLeftY = popupRect.bottom;\n bottomRightX = anchorRect.left;\n bottomRightY = anchorRect.bottom;\n }\n }\n\n this.style.setProperty('--hover-bridge-top-left-x', `${topLeftX}px`);\n this.style.setProperty('--hover-bridge-top-left-y', `${topLeftY}px`);\n this.style.setProperty('--hover-bridge-top-right-x', `${topRightX}px`);\n this.style.setProperty('--hover-bridge-top-right-y', `${topRightY}px`);\n this.style.setProperty(\n '--hover-bridge-bottom-left-x',\n `${bottomLeftX}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-left-y',\n `${bottomLeftY}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-right-x',\n `${bottomRightX}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-right-y',\n `${bottomRightY}px`\n );\n }\n };\n\n #handleAnchorClick() {\n // to make sure clicking another element's anchor closes current element's dropdown menu\n this.dispatchEvent(\n new CustomEvent('mid-anchor-click', {\n bubbles: true,\n composed: true,\n detail: { id: this.id },\n })\n );\n }\n\n render() {\n return html`\n <slot\n name=\"anchor\"\n @slotchange=${this.handleAnchorChange}\n @click=${this.#handleAnchorClick}\n ></slot>\n\n <span\n part=\"hover-bridge\"\n class=${classMap({\n 'popup-hover-bridge': true,\n 'popup-hover-bridge--visible': this.hoverBridge && this.active,\n })}\n ></span>\n\n <div\n part=\"popup\"\n class=${classMap({\n popup: true,\n 'popup--active': this.active,\n 'popup--fixed': this.strategy === 'fixed',\n 'popup--has-arrow': this.arrow,\n })}\n >\n <slot></slot>\n ${this.arrow\n ? html`<div\n part=\"arrow\"\n class=\"popup__arrow\"\n role=\"presentation\"\n ></div>`\n : ''}\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,uBAAA;AAuCA,SAAS,iBAAiB,GAAiC;AAEvD,SAAA,MAAM,QACN,OAAO,MAAM,YACb,2BAA2B,MAC1B,oBAAoB,IAAI,aAAa,UAAU;AAEpD;AAEA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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QA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GAtJf,WAuJX,WAAA,iBAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,WAAW,iBAAiB,MAAM,OAAQ,CAAA;AAAA,GA5J3C,WA6JX,WAAA,gBAAA,CAAA;AAGsC,gBAAA;AAAA,EAArC,SAAS,EAAE,WAAW,YAAa,CAAA;AAAA,GAhKzB,WAgK2B,WAAA,YAAA,CAAA;AAStC,gBAAA;AAAA,EADC,SAAS;AAAA,GAxKC,WAyKX,WAAA,QAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GAhLf,WAiLX,WAAA,oBAAA,CAAA;AAK4D,gBAAA;AAAA,EAA3D,SAAS,EAAE,WAAW,qBAAqB,MAAM,OAAQ,CAAA;AAAA,GAtL/C,WAsLiD,WAAA,mBAAA,CAAA;AASJ,gBAAA;AAAA,EAAvD,SAAS,EAAE,WAAW,gBAAgB,MAAM,QAAS,CAAA;AAAA,GA/L3C,WA+L6C,WAAA,eAAA,CAAA;AA/L7C,aAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,UAAA;"}
|
|
1
|
+
{"version":3,"file":"popup.js","sources":["../../src/components/popup.component.ts"],"sourcesContent":["/*\n\nCopyright (c) 2020 A Beautiful Site, LLC\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n offset,\n platform,\n shift,\n size,\n} from '@floating-ui/dom';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { css, html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport { offsetParent } from 'composed-offset-position';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-popup': MinidPopup;\n }\n}\n\nexport interface VirtualElement {\n getBoundingClientRect: () => DOMRect;\n contextElement?: Element;\n}\n\nfunction isVirtualElement(e: unknown): e is VirtualElement {\n return (\n e !== null &&\n typeof e === 'object' &&\n 'getBoundingClientRect' in e &&\n ('contextElement' in e ? e instanceof Element : true)\n );\n}\n\nconst styles = [\n css`\n :host {\n --arrow-color: white;\n --arrow-border-color: transparent;\n --arrow-size: 6px;\n\n /*\n These properties are computed to account for the arrow's dimensions after being rotated 45º. The constant\n 0.7071 is derived from sin(45), which is the diagonal size of the arrow's container after rotating.\n */\n --arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);\n --arrow-padding-offset: calc(\n var(--arrow-size-diagonal) - var(--arrow-size)\n );\n\n display: contents;\n }\n\n .popup {\n position: absolute;\n isolation: isolate;\n max-width: var(--auto-size-available-width, none);\n max-height: var(--auto-size-available-height, none);\n z-index: 900;\n }\n\n .popup--fixed {\n position: fixed;\n }\n\n .popup:not(.popup--active) {\n display: none;\n }\n\n .popup__arrow {\n position: absolute;\n width: calc(var(--arrow-size-diagonal) * 2);\n height: calc(var(--arrow-size-diagonal) * 2);\n border: 1px solid var(--arrow-border-color);\n border-left-color: transparent;\n border-top-color: transparent;\n rotate: 45deg;\n background: var(--arrow-color);\n z-index: 901;\n }\n\n /* Hover bridge */\n .popup-hover-bridge:not(.popup-hover-bridge--visible) {\n display: none;\n }\n\n .popup-hover-bridge {\n position: fixed;\n z-index: calc(900 - 1);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n clip-path: polygon(\n var(--hover-bridge-top-left-x, 0) var(--hover-bridge-top-left-y, 0),\n var(--hover-bridge-top-right-x, 0) var(--hover-bridge-top-right-y, 0),\n var(--hover-bridge-bottom-right-x, 0)\n var(--hover-bridge-bottom-right-y, 0),\n var(--hover-bridge-bottom-left-x, 0)\n var(--hover-bridge-bottom-left-y, 0)\n );\n }\n\n :host([data-current-placement^='top']) .popup {\n transform-origin: bottom;\n }\n\n :host([data-current-placement^='bottom']) .popup {\n transform-origin: top;\n }\n\n :host([data-current-placement^='left']) .popup {\n transform-origin: right;\n }\n\n :host([data-current-placement^='right']) .popup {\n transform-origin: left;\n }\n\n :host([data-current-placement^='top']) .popup__arrow {\n transform: rotate(0deg);\n }\n\n :host([data-current-placement^='bottom']) .popup__arrow {\n transform: rotate(180deg);\n }\n\n :host([data-current-placement^='left']) .popup__arrow {\n transform: rotate(-90deg);\n }\n\n :host([data-current-placement^='right']) .popup__arrow {\n transform: rotate(90deg);\n }\n `,\n];\n\n/**\n * @summary Popup is a utility that lets you declaratively anchor \"popup\" containers to another element.\n * @documentation https://shoelace.style/components/popup\n * @status stable\n * @since 2.0\n *\n * @event mid-reposition - Emitted when the popup is repositioned. This event can fire a lot, so avoid putting expensive\n * operations in your listener or consider debouncing it.\n *\n * @slot - The popup's content.\n * @slot anchor - The element the popup will be anchored to. If the anchor lives outside of the popup, you can use the\n * `anchor` attribute or property instead.\n *\n * @csspart arrow - The arrow's container. Avoid setting `top|bottom|left|right` properties, as these values are\n * assigned dynamically as the popup moves. This is most useful for applying a background color to match the popup, and\n * maybe a border or box shadow.\n * @csspart popup - The popup's container. Useful for setting a background color, box shadow, etc.\n * @csspart hover-bridge - The hover bridge element. Only available when the `hover-bridge` option is enabled.\n *\n * @cssproperty [--arrow-size=6px] - The size of the arrow. Note that an arrow won't be shown unless the `arrow`\n * attribute is used.\n * @cssproperty [--arrow-color=white] - The color of the arrow.\n * @cssproperty [--arrow-border-color=transparent] - The color for the arrow border\n * @cssproperty [--auto-size-available-width] - A read-only custom property that determines the amount of width the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n * @cssproperty [--auto-size-available-height] - A read-only custom property that determines the amount of height the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n */\n\n@customElement('mid-popup')\nexport class MinidPopup extends styled(LitElement, styles) {\n private anchorEl: Element | VirtualElement | null = null;\n private cleanup?: ReturnType<typeof autoUpdate>;\n\n /**\n * A reference to the internal popup container. Useful for animating and styling the popup with JavaScript.\n */\n @query('.popup')\n popup!: HTMLElement;\n\n @query('.popup__arrow')\n private arrowEl!: HTMLElement;\n\n /**\n * The element the popup will be anchored to. If the anchor lives outside of the popup, you can provide the anchor\n * element `id`, a DOM element reference, or a `VirtualElement`. If the anchor lives inside the popup, use the\n * `anchor` slot instead.\n */\n @property()\n anchor: Element | string | VirtualElement = '';\n\n /**\n * Activates the positioning logic and shows the popup. When this attribute is removed, the positioning logic is torn\n * down and the popup will be hidden.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The preferred placement of the popup. Note that the actual placement will vary as configured to keep the\n * panel inside of the viewport.\n */\n @property({ reflect: true })\n 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' = 'top';\n\n /**\n * Determines how the popup is positioned. The `absolute` strategy works well in most cases, but if overflow is\n * clipped, using a `fixed` position strategy can often workaround it.\n */\n @property({ reflect: true })\n strategy: 'absolute' | 'fixed' = 'absolute';\n\n /**\n * The distance in pixels from which to offset the panel away from its anchor.\n */\n @property({ type: Number })\n distance = 0;\n\n /**\n * The distance in pixels from which to offset the panel along its anchor.\n */\n @property({ type: Number })\n skidding = 0;\n\n /**\n * Attaches an arrow to the popup. The arrow's size and color can be customized using the `--arrow-size` and\n * `--arrow-color` custom properties. For additional customizations, you can also target the arrow using\n * `::part(arrow)` in your stylesheet.\n */\n @property({ type: Boolean })\n arrow = false;\n\n /**\n * The placement of the arrow. The default is `anchor`, which will align the arrow as close to the center of the\n * anchor as possible, considering available space and `arrow-padding`. A value of `start`, `end`, or `center` will\n * align the arrow to the start, end, or center of the popover instead.\n */\n @property({ attribute: 'arrow-placement' })\n arrowPlacement: 'start' | 'end' | 'center' | 'anchor' = 'anchor';\n\n /**\n * The amount of padding between the arrow and the edges of the popup. If the popup has a border-radius, for example,\n * this will prevent it from overflowing the corners.\n */\n @property({ attribute: 'arrow-padding', type: Number })\n arrowPadding = 10;\n\n /**\n * When set, placement of the popup will flip to the opposite site to keep it in view. You can use\n * `flipFallbackPlacements` to further configure how the fallback placement is determined.\n */\n @property({ type: Boolean })\n flip = false;\n\n /**\n * If the preferred placement doesn't fit, popup will be tested in these fallback placements until one fits. Must be a\n * string of any number of placements separated by a space, e.g. \"top bottom left\". If no placement fits, the flip\n * fallback strategy will be used instead.\n */\n @property({\n attribute: 'flip-fallback-placements',\n converter: {\n fromAttribute: (value: string) => {\n return value\n .split(' ')\n .map((p) => p.trim())\n .filter((p) => p !== '');\n },\n toAttribute: (value: []) => {\n return value.join(' ');\n },\n },\n })\n flipFallbackPlacements = '';\n\n /**\n * When neither the preferred placement nor the fallback placements fit, this value will be used to determine whether\n * the popup should be positioned using the best available fit based on available space or as it was initially\n * preferred.\n */\n @property({ attribute: 'flip-fallback-strategy' })\n flipFallbackStrategy: 'best-fit' | 'initial' = 'best-fit';\n\n /**\n * The flip boundary describes clipping element(s) that overflow will be checked relative to when flipping. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n flipBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the flip behavior will occur.\n */\n @property({ attribute: 'flip-padding', type: Number })\n flipPadding = 0;\n\n /**\n * Moves the popup along the axis to keep it in view when clipped.\n */\n @property({ type: Boolean })\n shift = false;\n\n /**\n * The shift boundary describes clipping element(s) that overflow will be checked relative to when shifting. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n shiftBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the shift behavior will occur.\n */\n @property({ attribute: 'shift-padding', type: Number })\n shiftPadding = 0;\n\n /** When set, this will cause the popup to automatically resize itself to prevent it from overflowing. */\n @property({ attribute: 'auto-size' }) autoSize?:\n | 'horizontal'\n | 'vertical'\n | 'both';\n\n /**\n * Syncs the popup's width or height to that of the anchor element.\n */\n @property()\n sync?: 'width' | 'height' | 'both';\n\n /**\n * The auto-size boundary describes clipping element(s) that overflow will be checked relative to when resizing. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n autoSizeBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the auto-size behavior will occur.\n */\n @property({ attribute: 'auto-size-padding', type: Number }) autoSizePadding =\n 0;\n\n /**\n * When a gap exists between the anchor and the popup element, this option will add a \"hover bridge\" that fills the\n * gap using an invisible element. This makes listening for events such as `mouseenter` and `mouseleave` more sane\n * because the pointer never technically leaves the element. The hover bridge will only be drawn when the popover is\n * active.\n */\n @property({ attribute: 'hover-bridge', type: Boolean }) hoverBridge = false;\n\n async connectedCallback() {\n super.connectedCallback();\n\n // Start the positioner after the first update\n await this.updateComplete;\n this.start();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.stop();\n }\n\n async updated(changedProps: Map<string, unknown>) {\n super.updated(changedProps);\n\n // Start or stop the positioner when active changes\n if (changedProps.has('active')) {\n if (this.active) {\n this.start();\n } else {\n this.stop();\n }\n }\n\n // Update the anchor when anchor changes\n if (changedProps.has('anchor')) {\n this.handleAnchorChange();\n }\n\n // All other properties will trigger a reposition when active\n if (this.active) {\n await this.updateComplete;\n this.reposition();\n }\n }\n\n private async handleAnchorChange() {\n await this.stop();\n\n if (this.anchor && typeof this.anchor === 'string') {\n // Locate the anchor by id\n const root = this.getRootNode() as Document | ShadowRoot;\n this.anchorEl = root.getElementById(this.anchor);\n } else if (\n this.anchor instanceof Element ||\n isVirtualElement(this.anchor)\n ) {\n // Use the anchor's reference\n this.anchorEl = this.anchor;\n } else {\n // Look for a slotted anchor\n this.anchorEl = this.querySelector<HTMLElement>('[slot=\"anchor\"]');\n }\n\n // If the anchor is a <slot>, we'll use the first assigned element as the target since slots use `display: contents`\n // and positioning can't be calculated on them\n if (this.anchorEl instanceof HTMLSlotElement) {\n this.anchorEl = this.anchorEl.assignedElements({\n flatten: true,\n })[0] as HTMLElement;\n }\n\n // If the anchor is valid, start it up\n if (this.anchorEl && this.active) {\n this.start();\n }\n }\n\n private start() {\n // We can't start the positioner without an anchor\n if (!this.anchorEl) {\n return;\n }\n\n this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {\n this.reposition();\n });\n }\n\n private async stop(): Promise<void> {\n return new Promise((resolve) => {\n if (this.cleanup) {\n this.cleanup();\n this.cleanup = undefined;\n this.removeAttribute('data-current-placement');\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n requestAnimationFrame(() => resolve());\n } else {\n resolve();\n }\n });\n }\n\n /** Forces the popup to recalculate and reposition itself. */\n reposition() {\n // Nothing to do if the popup is inactive or the anchor doesn't exist\n if (!this.active || !this.anchorEl) {\n return;\n }\n\n //\n // NOTE: Floating UI middlewares are order dependent: https://floating-ui.com/docs/middleware\n //\n const middleware = [\n // The offset middleware goes first\n offset({ mainAxis: this.distance, crossAxis: this.skidding }),\n ];\n\n // First we sync width/height\n if (this.sync) {\n middleware.push(\n size({\n apply: ({ rects }) => {\n const syncWidth = this.sync === 'width' || this.sync === 'both';\n const syncHeight = this.sync === 'height' || this.sync === 'both';\n this.popup.style.width = syncWidth\n ? `${rects.reference.width}px`\n : '';\n this.popup.style.height = syncHeight\n ? `${rects.reference.height}px`\n : '';\n },\n })\n );\n } else {\n // Cleanup styles if we're not matching width/height\n this.popup.style.width = '';\n this.popup.style.height = '';\n }\n\n // Then we flip\n if (this.flip) {\n middleware.push(\n flip({\n boundary: this.flipBoundary,\n // @ts-expect-error - We're converting a string attribute to an array here\n fallbackPlacements: this.flipFallbackPlacements,\n fallbackStrategy:\n this.flipFallbackStrategy === 'best-fit'\n ? 'bestFit'\n : 'initialPlacement',\n padding: this.flipPadding,\n })\n );\n }\n\n // Then we shift\n if (this.shift) {\n middleware.push(\n shift({\n boundary: this.shiftBoundary,\n padding: this.shiftPadding,\n })\n );\n }\n\n // Now we adjust the size as needed\n if (this.autoSize) {\n middleware.push(\n size({\n boundary: this.autoSizeBoundary,\n padding: this.autoSizePadding,\n apply: ({ availableWidth, availableHeight }) => {\n if (this.autoSize === 'vertical' || this.autoSize === 'both') {\n this.style.setProperty(\n '--auto-size-available-height',\n `${availableHeight}px`\n );\n } else {\n this.style.removeProperty('--auto-size-available-height');\n }\n\n if (this.autoSize === 'horizontal' || this.autoSize === 'both') {\n this.style.setProperty(\n '--auto-size-available-width',\n `${availableWidth}px`\n );\n } else {\n this.style.removeProperty('--auto-size-available-width');\n }\n },\n })\n );\n } else {\n // Cleanup styles if we're no longer using auto-size\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n }\n\n // Finally, we add an arrow\n if (this.arrow) {\n middleware.push(\n arrow({\n element: this.arrowEl,\n padding: this.arrowPadding,\n })\n );\n }\n\n //\n // Use custom positioning logic if the strategy is absolute. Otherwise, fall back to the default logic.\n //\n // More info: https://github.com/shoelace-style/shoelace/issues/1135\n //\n const getOffsetParent =\n this.strategy === 'absolute'\n ? (element: Element) => platform.getOffsetParent(element, offsetParent)\n : platform.getOffsetParent;\n\n computePosition(this.anchorEl, this.popup, {\n placement: this.placement,\n middleware,\n strategy: this.strategy,\n platform: {\n ...platform,\n getOffsetParent,\n },\n }).then(({ x, y, middlewareData, placement }) => {\n //\n // Even though we have our own localization utility, it uses different heuristics to determine RTL. Because of\n // that, we'll use the same approach that Floating UI uses.\n //\n // Source: https://github.com/floating-ui/floating-ui/blob/cb3b6ab07f95275730d3e6e46c702f8d4908b55c/packages/dom/src/utils/getDocumentRect.ts#L31\n //\n const isRtl = this.matches(':dir(rtl)');\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]]!;\n\n this.setAttribute('data-current-placement', placement);\n\n Object.assign(this.popup.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n\n if (this.arrow) {\n const arrowX = middlewareData.arrow!.x;\n const arrowY = middlewareData.arrow!.y;\n let top = '';\n let right = '';\n let bottom = '';\n let left = '';\n\n if (this.arrowPlacement === 'start') {\n // Start\n const value =\n typeof arrowX === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n top =\n typeof arrowY === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n right = isRtl ? value : '';\n left = isRtl ? '' : value;\n } else if (this.arrowPlacement === 'end') {\n // End\n const value =\n typeof arrowX === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n right = isRtl ? '' : value;\n left = isRtl ? value : '';\n bottom =\n typeof arrowY === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n } else if (this.arrowPlacement === 'center') {\n // Center\n left =\n typeof arrowX === 'number'\n ? `calc(50% - var(--arrow-size-diagonal))`\n : '';\n top =\n typeof arrowY === 'number'\n ? `calc(50% - var(--arrow-size-diagonal))`\n : '';\n } else {\n // Anchor (default)\n left = typeof arrowX === 'number' ? `${arrowX}px` : '';\n top = typeof arrowY === 'number' ? `${arrowY}px` : '';\n }\n\n Object.assign(this.arrowEl.style, {\n top,\n right,\n bottom,\n left,\n [staticSide]: 'calc(var(--arrow-size-diagonal) * -1)',\n });\n }\n });\n\n // Wait until the new position is drawn before updating the hover bridge, otherwise it can get out of sync\n requestAnimationFrame(() => this.updateHoverBridge());\n\n this.dispatchEvent(new Event('mid-reposition'));\n }\n\n private updateHoverBridge = () => {\n if (this.hoverBridge && this.anchorEl) {\n const anchorRect = this.anchorEl.getBoundingClientRect();\n const popupRect = this.popup.getBoundingClientRect();\n const isVertical =\n this.placement.includes('top') || this.placement.includes('bottom');\n let topLeftX = 0;\n let topLeftY = 0;\n let topRightX = 0;\n let topRightY = 0;\n let bottomLeftX = 0;\n let bottomLeftY = 0;\n let bottomRightX = 0;\n let bottomRightY = 0;\n\n if (isVertical) {\n if (anchorRect.top < popupRect.top) {\n // Anchor is above\n topLeftX = anchorRect.left;\n topLeftY = anchorRect.bottom;\n topRightX = anchorRect.right;\n topRightY = anchorRect.bottom;\n\n bottomLeftX = popupRect.left;\n bottomLeftY = popupRect.top;\n bottomRightX = popupRect.right;\n bottomRightY = popupRect.top;\n } else {\n // Anchor is below\n topLeftX = popupRect.left;\n topLeftY = popupRect.bottom;\n topRightX = popupRect.right;\n topRightY = popupRect.bottom;\n\n bottomLeftX = anchorRect.left;\n bottomLeftY = anchorRect.top;\n bottomRightX = anchorRect.right;\n bottomRightY = anchorRect.top;\n }\n } else {\n if (anchorRect.left < popupRect.left) {\n // Anchor is on the left\n topLeftX = anchorRect.right;\n topLeftY = anchorRect.top;\n topRightX = popupRect.left;\n topRightY = popupRect.top;\n\n bottomLeftX = anchorRect.right;\n bottomLeftY = anchorRect.bottom;\n bottomRightX = popupRect.left;\n bottomRightY = popupRect.bottom;\n } else {\n // Anchor is on the right\n topLeftX = popupRect.right;\n topLeftY = popupRect.top;\n topRightX = anchorRect.left;\n topRightY = anchorRect.top;\n\n bottomLeftX = popupRect.right;\n bottomLeftY = popupRect.bottom;\n bottomRightX = anchorRect.left;\n bottomRightY = anchorRect.bottom;\n }\n }\n\n this.style.setProperty('--hover-bridge-top-left-x', `${topLeftX}px`);\n this.style.setProperty('--hover-bridge-top-left-y', `${topLeftY}px`);\n this.style.setProperty('--hover-bridge-top-right-x', `${topRightX}px`);\n this.style.setProperty('--hover-bridge-top-right-y', `${topRightY}px`);\n this.style.setProperty(\n '--hover-bridge-bottom-left-x',\n `${bottomLeftX}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-left-y',\n `${bottomLeftY}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-right-x',\n `${bottomRightX}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-right-y',\n `${bottomRightY}px`\n );\n }\n };\n\n render() {\n return html`\n <slot name=\"anchor\" @slotchange=${this.handleAnchorChange}></slot>\n\n <span\n part=\"hover-bridge\"\n class=${classMap({\n 'popup-hover-bridge': true,\n 'popup-hover-bridge--visible': this.hoverBridge && this.active,\n })}\n ></span>\n\n <div\n part=\"popup\"\n class=${classMap({\n popup: true,\n 'popup--active': this.active,\n 'popup--fixed': this.strategy === 'fixed',\n 'popup--has-arrow': this.arrow,\n })}\n >\n <slot></slot>\n ${this.arrow\n ? html`<div\n part=\"arrow\"\n class=\"popup__arrow\"\n role=\"presentation\"\n ></div>`\n : ''}\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuCA,SAAS,iBAAiB,GAAiC;AAEvD,SAAA,MAAM,QACN,OAAO,MAAM,YACb,2BAA2B,MAC1B,oBAAoB,IAAI,aAAa,UAAU;AAEpD;AAEA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AAAA,GA9IhB,WA+IX,WAAA,SAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GAtJf,WAuJX,WAAA,iBAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,WAAW,iBAAiB,MAAM,OAAQ,CAAA;AAAA,GA5J3C,WA6JX,WAAA,gBAAA,CAAA;AAGsC,gBAAA;AAAA,EAArC,SAAS,EAAE,WAAW,YAAa,CAAA;AAAA,GAhKzB,WAgK2B,WAAA,YAAA,CAAA;AAStC,gBAAA;AAAA,EADC,SAAS;AAAA,GAxKC,WAyKX,WAAA,QAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GAhLf,WAiLX,WAAA,oBAAA,CAAA;AAK4D,gBAAA;AAAA,EAA3D,SAAS,EAAE,WAAW,qBAAqB,MAAM,OAAQ,CAAA;AAAA,GAtL/C,WAsLiD,WAAA,mBAAA,CAAA;AASJ,gBAAA;AAAA,EAAvD,SAAS,EAAE,WAAW,gBAAgB,MAAM,QAAS,CAAA;AAAA,GA/L3C,WA+L6C,WAAA,eAAA,CAAA;AA/L7C,aAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,UAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sources":["../../src/components/search.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport './textfield.component';\nimport './icon/icon.component';\nimport './button.component.ts';\nimport { live } from 'lit/directives/live.js';\nimport { MinidTextfield } from './textfield.component.ts';\nimport { debounce } from '../internal/debounce.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-search': MinidSearch;\n }\n}\n\n/**\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-clear - Emitted when the input value is cleared\n * @event mid-focus - Emitted when input element is focused\n * @event mid-blur - Emitted when focus moves away from input element\n */\n@customElement('mid-search')\nexport class MinidSearch extends styled(LitElement) {\n @query('mid-textfield')\n textField!: MinidTextfield;\n\n @property()\n size: 'sm' | 'md' | 'lg' = 'md';\n\n @property()\n label = '';\n\n @property()\n placeholder = '';\n\n @property()\n value = '';\n\n /**\n * Debounce the `mid-input` event by a number of milliseconds\n */\n @property({ type: Number, reflect: true })\n debounce = 0;\n\n private handleInput = () => {\n this.value = this.textField.value;\n this.dispatchEvent(\n new Event('mid-input', { composed: true, bubbles: true })\n );\n };\n\n focus() {\n this.textField.focus();\n }\n\n override render() {\n return html`\n <mid-textfield\n .value=${live(this.value)}\n type=\"search\"\n size=${this.size}\n label=${this.label}\n placeholder=${this.placeholder}\n @mid-input=${debounce(this.handleInput, this.debounce, {\n stopPropagation: true,\n })}\n clearable\n >\n <mid-icon\n slot=\"prefix\"\n class=\"
|
|
1
|
+
{"version":3,"file":"search.js","sources":["../../src/components/search.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport './textfield.component';\nimport './icon/icon.component';\nimport './button.component.ts';\nimport { live } from 'lit/directives/live.js';\nimport { MinidTextfield } from './textfield.component.ts';\nimport { debounce } from '../internal/debounce.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-search': MinidSearch;\n }\n}\n\n/**\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-clear - Emitted when the input value is cleared\n * @event mid-focus - Emitted when input element is focused\n * @event mid-blur - Emitted when focus moves away from input element\n */\n@customElement('mid-search')\nexport class MinidSearch extends styled(LitElement) {\n @query('mid-textfield')\n textField!: MinidTextfield;\n\n @property()\n size: 'sm' | 'md' | 'lg' = 'md';\n\n @property()\n label = '';\n\n @property()\n placeholder = '';\n\n @property()\n value = '';\n\n /**\n * Debounce the `mid-input` event by a number of milliseconds\n */\n @property({ type: Number, reflect: true })\n debounce = 0;\n\n private handleInput = () => {\n this.value = this.textField.value;\n this.dispatchEvent(\n new Event('mid-input', { composed: true, bubbles: true })\n );\n };\n\n focus() {\n this.textField.focus();\n }\n\n override render() {\n return html`\n <mid-textfield\n .value=${live(this.value)}\n type=\"search\"\n size=${this.size}\n label=${this.label}\n placeholder=${this.placeholder}\n @mid-input=${debounce(this.handleInput, this.debounce, {\n stopPropagation: true,\n })}\n clearable\n >\n <mid-icon\n slot=\"prefix\"\n class=\"size-6\"\n library=\"system\"\n name=\"magnifying-glass\"\n >\n </mid-icon>\n </mid-textfield>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,IAAM,cAAN,cAA0B,OAAO,UAAU,EAAE;AAAA,EAA7C,cAAA;AAAA,UAAA,GAAA,SAAA;AAKsB,SAAA,OAAA;AAGnB,SAAA,QAAA;AAGM,SAAA,cAAA;AAGN,SAAA,QAAA;AAMG,SAAA,WAAA;AAEX,SAAQ,cAAc,MAAM;AACrB,WAAA,QAAQ,KAAK,UAAU;AACvB,WAAA;AAAA,QACH,IAAI,MAAM,aAAa,EAAE,UAAU,MAAM,SAAS,KAAM,CAAA;AAAA,MAC1D;AAAA,IACF;AAAA,EAAA;AAAA,EAEA,QAAQ;AACN,SAAK,UAAU,MAAM;AAAA,EAAA;AAAA,EAGd,SAAS;AACT,WAAA;AAAA;AAAA,iBAEM,KAAK,KAAK,KAAK,CAAC;AAAA;AAAA,eAElB,KAAK,IAAI;AAAA,gBACR,KAAK,KAAK;AAAA,sBACJ,KAAK,WAAW;AAAA,qBACjB,SAAS,KAAK,aAAa,KAAK,UAAU;AAAA,MACrD,iBAAiB;AAAA,IAAA,CAClB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAaV;AAtDE,gBAAA;AAAA,EADC,MAAM,eAAe;AAAA,GADX,YAEX,WAAA,aAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS;AAAA,GAJC,YAKX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS;AAAA,GAPC,YAQX,WAAA,SAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS;AAAA,GAVC,YAWX,WAAA,eAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS;AAAA,GAbC,YAcX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAM,CAAA;AAAA,GAnB9B,YAoBX,WAAA,YAAA,CAAA;AApBW,cAAN,gBAAA;AAAA,EADN,cAAc,YAAY;AAAA,GACd,WAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.component.d.ts","sourceRoot":"","sources":["../../src/components/spinner.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAG5C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,YAAY,CAAC;KAC7B;CACF;;AAUD;;GAEG;AACH,qBACa,YAAa,SAAQ,iBAA0B;IACjD,MAAM;
|
|
1
|
+
{"version":3,"file":"spinner.component.d.ts","sourceRoot":"","sources":["../../src/components/spinner.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAG5C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,YAAY,CAAC;KAC7B;CACF;;AAUD;;GAEG;AACH,qBACa,YAAa,SAAQ,iBAA0B;IACjD,MAAM;CA6BhB"}
|
|
@@ -25,6 +25,15 @@ let MinidSpinner = class extends styled(LitElement, styles) {
|
|
|
25
25
|
height="1em"
|
|
26
26
|
viewBox="0 0 50 50"
|
|
27
27
|
>
|
|
28
|
+
<circle
|
|
29
|
+
opacity="0.2"
|
|
30
|
+
stroke="currentColor"
|
|
31
|
+
cx="25"
|
|
32
|
+
cy="25"
|
|
33
|
+
r="20"
|
|
34
|
+
fill="none"
|
|
35
|
+
stroke-width="5"
|
|
36
|
+
></circle>
|
|
28
37
|
<circle
|
|
29
38
|
class="animate-dash"
|
|
30
39
|
cx="25"
|
|
@@ -33,7 +42,6 @@ let MinidSpinner = class extends styled(LitElement, styles) {
|
|
|
33
42
|
fill="none"
|
|
34
43
|
stroke-width="5"
|
|
35
44
|
stroke="currentColor"
|
|
36
|
-
stroke-linecap="round"
|
|
37
45
|
></circle>
|
|
38
46
|
</svg>
|
|
39
47
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","sources":["../../src/components/spinner.component.ts"],"sourcesContent":["import { customElement } from 'lit/decorators.js';\nimport { css, html, LitElement } from 'lit';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-spinner': MinidSpinner;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: inline-flex;\n }\n `,\n];\n\n/**\n * Size and color can be adjusted with `font-size` and `color` css properties\n */\n@customElement('mid-spinner')\nexport class MinidSpinner extends styled(LitElement, styles) {\n override render() {\n return html`\n <svg\n class=\"animate-spin-slow\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 50 50\"\n >\n <circle\n
|
|
1
|
+
{"version":3,"file":"spinner.js","sources":["../../src/components/spinner.component.ts"],"sourcesContent":["import { customElement } from 'lit/decorators.js';\nimport { css, html, LitElement } from 'lit';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-spinner': MinidSpinner;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: inline-flex;\n }\n `,\n];\n\n/**\n * Size and color can be adjusted with `font-size` and `color` css properties\n */\n@customElement('mid-spinner')\nexport class MinidSpinner extends styled(LitElement, styles) {\n override render() {\n return html`\n <svg\n class=\"animate-spin-slow\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 50 50\"\n >\n <circle\n opacity=\"0.2\"\n stroke=\"currentColor\"\n cx=\"25\"\n cy=\"25\"\n r=\"20\"\n fill=\"none\"\n stroke-width=\"5\"\n ></circle>\n <circle\n class=\"animate-dash\"\n cx=\"25\"\n cy=\"25\"\n r=\"20\"\n fill=\"none\"\n stroke-width=\"5\"\n stroke=\"currentColor\"\n ></circle>\n </svg>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAUA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAKF;AAMO,IAAM,eAAN,cAA2B,OAAO,YAAY,MAAM,EAAE;AAAA,EAClD,SAAS;AACT,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AA4BX;AA9Ba,eAAN,gBAAA;AAAA,EADN,cAAc,aAAa;AAAA,GACf,YAAA;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLElementTagNameMap {
|
|
4
|
+
'mid-step-indicator': MinidStepIndicator;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare const MinidStepIndicator_base: typeof LitElement;
|
|
8
|
+
export declare class MinidStepIndicator extends MinidStepIndicator_base {
|
|
9
|
+
steps: number;
|
|
10
|
+
current: number;
|
|
11
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=step-indicator.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-indicator.component.d.ts","sourceRoot":"","sources":["../../src/components/step-indicator.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAK5C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,kBAAkB,CAAC;KAC1C;CACF;;AAWD,qBACa,kBAAmB,SAAQ,uBAA0B;IAEhE,KAAK,SAAK;IAGV,OAAO,SAAK;IAEH,MAAM;CAgBhB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { css, LitElement, html } from "lit";
|
|
2
|
+
import { styled } from "../mixins/tailwind.mixin.js";
|
|
3
|
+
import { property, customElement } from "lit/decorators.js";
|
|
4
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
+
if (kind && result) __defProp(target, key, result);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
const styles = [
|
|
16
|
+
css`
|
|
17
|
+
:host {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
}
|
|
21
|
+
`
|
|
22
|
+
];
|
|
23
|
+
let MinidStepIndicator = class extends styled(LitElement, styles) {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.steps = 0;
|
|
27
|
+
this.current = 0;
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
return html`
|
|
31
|
+
<ul class="flex space-x-2">
|
|
32
|
+
${Array.from({ length: this.steps }).map((_, index) => {
|
|
33
|
+
const step = index + 1;
|
|
34
|
+
return html`<li
|
|
35
|
+
class="${classMap({
|
|
36
|
+
"bg-accent-surface-active": step < this.current,
|
|
37
|
+
"bg-accent-base": step === this.current,
|
|
38
|
+
"bg-accent": step > this.current
|
|
39
|
+
})} border-accent rounded-full border p-1.5"
|
|
40
|
+
></li>`;
|
|
41
|
+
})}
|
|
42
|
+
</ul>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
__decorateClass([
|
|
47
|
+
property({ type: Number })
|
|
48
|
+
], MinidStepIndicator.prototype, "steps", 2);
|
|
49
|
+
__decorateClass([
|
|
50
|
+
property({ type: Number })
|
|
51
|
+
], MinidStepIndicator.prototype, "current", 2);
|
|
52
|
+
MinidStepIndicator = __decorateClass([
|
|
53
|
+
customElement("mid-step-indicator")
|
|
54
|
+
], MinidStepIndicator);
|
|
55
|
+
export {
|
|
56
|
+
MinidStepIndicator
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=step-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-indicator.js","sources":["../../src/components/step-indicator.component.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { styled } from '../mixins/tailwind.mixin';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-step-indicator': MinidStepIndicator;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: flex;\n justify-content: center;\n }\n `,\n];\n\n@customElement('mid-step-indicator')\nexport class MinidStepIndicator extends styled(LitElement, styles) {\n @property({ type: Number })\n steps = 0;\n\n @property({ type: Number })\n current = 0;\n\n override render() {\n return html`\n <ul class=\"flex space-x-2\">\n ${Array.from({ length: this.steps }).map((_, index) => {\n const step = index + 1;\n return html`<li\n class=\"${classMap({\n 'bg-accent-surface-active': step < this.current,\n 'bg-accent-base': step === this.current,\n 'bg-accent': step > this.current,\n })} border-accent rounded-full border p-1.5\"\n ></li>`;\n })}\n </ul>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAWA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAMF;AAGO,IAAM,qBAAN,cAAiC,OAAO,YAAY,MAAM,EAAE;AAAA,EAA5D,cAAA;AAAA,UAAA,GAAA,SAAA;AAEG,SAAA,QAAA;AAGE,SAAA,UAAA;AAAA,EAAA;AAAA,EAED,SAAS;AACT,WAAA;AAAA;AAAA,UAED,MAAM,KAAK,EAAE,QAAQ,KAAK,MAAO,CAAA,EAAE,IAAI,CAAC,GAAG,UAAU;AACrD,YAAM,OAAO,QAAQ;AACd,aAAA;AAAA,qBACI,SAAS;AAAA,QAChB,4BAA4B,OAAO,KAAK;AAAA,QACxC,kBAAkB,SAAS,KAAK;AAAA,QAChC,aAAa,OAAO,KAAK;AAAA,MAAA,CAC1B,CAAC;AAAA;AAAA,IAAA,CAEL,CAAC;AAAA;AAAA;AAAA,EAAA;AAIV;AArBE,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GADf,mBAEX,WAAA,SAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GAJf,mBAKX,WAAA,WAAA,CAAA;AALW,qBAAN,gBAAA;AAAA,EADN,cAAc,oBAAoB;AAAA,GACtB,kBAAA;"}
|
|
@@ -28,6 +28,7 @@ declare const MinidTextfield_base: import('../types/mixin-constructor.ts').Const
|
|
|
28
28
|
export declare class MinidTextfield extends MinidTextfield_base {
|
|
29
29
|
private readonly inputId;
|
|
30
30
|
private readonly descriptionId;
|
|
31
|
+
private readonly validationId;
|
|
31
32
|
private readonly hasSlotControler;
|
|
32
33
|
private initialValue;
|
|
33
34
|
input: HTMLInputElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textfield.component.d.ts","sourceRoot":"","sources":["../../src/components/textfield.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;AAg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B,GAChB,OAAO,GACP,MAAM,GACN,OAAO,GACP,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,CAAU;IAEpB;;SAEK;IAEL,SAAS,UAAS;IAElB;;;OAGG;IAEH,cAAc,UAAS;IAEvB;;;OAGG;IAEH,eAAe,UAAS;IAGxB,QAAQ,UAAS;IAGjB,QAAQ,UAAS;IAEjB;;OAEG;IAEH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,SAAS,UAAS;IAGlB,QAAQ,UAAS;IAEjB,MAAM,KAAK,qBAAqB,qDAO/B;IAED,IAAI,gBAAgB,qBAEnB;;IAUQ,iBAAiB,IAAI,IAAI;IAKlC,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,gBAAgB;IAmBxB,KAAK;IAKL,gBAAgB;IAKhB,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAKlC,iBAAiB;IAIR,MAAM;CA+JhB"}
|
|
@@ -53,6 +53,7 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
53
53
|
nextUniqueId++;
|
|
54
54
|
this.inputId = `mid-textfield-input-${nextUniqueId}`;
|
|
55
55
|
this.descriptionId = `mid-textfield-description-${nextUniqueId}`;
|
|
56
|
+
this.validationId = `mid-textfield-validation-${nextUniqueId}`;
|
|
56
57
|
}
|
|
57
58
|
static get formControlValidators() {
|
|
58
59
|
return [
|
|
@@ -153,7 +154,7 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
153
154
|
"text-body-sm": sm,
|
|
154
155
|
"text-body-md": md,
|
|
155
156
|
"text-body-lg": lg
|
|
156
|
-
})}"
|
|
157
|
+
})} max-w-full"
|
|
157
158
|
>
|
|
158
159
|
<label
|
|
159
160
|
for="${this.inputId}"
|
|
@@ -197,8 +198,10 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
197
198
|
<input
|
|
198
199
|
id="${this.inputId}"
|
|
199
200
|
class="${classMap({
|
|
201
|
+
"w-full": !isClearIconVisible,
|
|
202
|
+
"w-[calc(100%-var(--spacing)*7)]": isClearIconVisible,
|
|
200
203
|
"[&::-webkit-search-cancel-button]:appearance-none": this.type === "search"
|
|
201
|
-
})} input grow focus-visible:outline-0"
|
|
204
|
+
})} input grow overflow-clip focus-visible:outline-0"
|
|
202
205
|
part="input"
|
|
203
206
|
.value=${live(this.value)}
|
|
204
207
|
?disabled=${this.disabled}
|
|
@@ -207,7 +210,7 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
207
210
|
autocomplete=${ifDefined(this.autocomplete)}
|
|
208
211
|
type=${this.type === "password" && this.passwordvisible ? "text" : this.type}
|
|
209
212
|
aria-describedby="${this.descriptionId}"
|
|
210
|
-
aria-errormessage="
|
|
213
|
+
aria-errormessage="${this.validationId}"
|
|
211
214
|
placeholder=${ifDefined(this.placeholder)}
|
|
212
215
|
minlength=${ifDefined(this.minlength)}
|
|
213
216
|
maxlength=${ifDefined(this.maxlength)}
|
|
@@ -262,11 +265,10 @@ let MinidTextfield = class extends FormControlMixin(
|
|
|
262
265
|
</span>
|
|
263
266
|
</div>
|
|
264
267
|
<div
|
|
265
|
-
class="
|
|
266
|
-
|
|
267
|
-
})} text-danger-subtle mt-2 flex gap-1"
|
|
268
|
-
id="error-message"
|
|
268
|
+
class="text-danger-subtle mt-2 flex gap-1"
|
|
269
|
+
id="${this.validationId}"
|
|
269
270
|
aria-live="polite"
|
|
271
|
+
?hidden=${!this.invalidmessage}
|
|
270
272
|
>
|
|
271
273
|
<mid-icon
|
|
272
274
|
name="xmark-octagon-fill"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textfield.js","sources":["../../src/components/textfield.component.ts"],"sourcesContent":["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { stringConverter } from '../internal/string-converter';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styled } from '../mixins/tailwind.mixin.ts';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { HasSlotController } from '../internal/slot';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport {\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n requiredValidator,\n} from '../mixins/validators';\nimport { watch } from '../internal/watch';\nimport './icon/icon.component.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-textfield': MinidTextfield;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n `,\n];\n\nlet nextUniqueId = 0;\n\n/**\n *\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-clear - Emitted when the input value is cleared\n * @event mid-focus - Emitted when input element is focused\n * @event mid-blur - Emitted when focus moves away from input element\n * @event {detail: { validity: ValidityState }} mid-invalid-hide - Emitted when the error message should be hidden\n * @event {detail: { validity: ValidityState }} mid-invalid-show - Emitted when the error message should be shown\n *\n * @slot prefix - Used for decoration to the left of the input\n * @slot suffix - Used for decoration to the right of the input\n * @slot label - The input's label. Alternatively, you can use the `label` attribute.\n *\n * @csspart base - The input's wrapper that has the input field styling.\n * @csspart input - The internal `<input>` element.\n * @csspart field - The element that wraps the label, input, and help text.\n * @csspart clear-button - The clear button\n * @csspart password-toggle-button - The button for toggling password visibility\n */\n@customElement('mid-textfield')\nexport class MinidTextfield extends FormControlMixin(\n styled(LitElement, styles)\n) {\n private readonly inputId!: string;\n private readonly descriptionId!: string;\n private readonly hasSlotControler = new HasSlotController(this, 'label');\n private initialValue = '';\n\n @query('.input')\n input!: HTMLInputElement;\n\n @property()\n label = '';\n\n @property()\n description = '';\n\n @property()\n value = '';\n\n @property()\n size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ converter: stringConverter })\n placeholder?: string;\n\n /**\n * Autofocus the input field on page load\n */\n @property({ type: Boolean })\n autofocus = false;\n\n /**\n * User agent autocomplete hint\n */\n @property()\n autocomplete?: AutoFill;\n\n /**\n * The minimum length of input that will be considered valid.\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * The maximum length of input that will be considered valid.\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * The input's minimum value. Only applies to date and number input types.\n */\n @property()\n min?: number | string;\n\n /**\n * The input's maximum value. Only applies to date and number input types.\n */\n @property()\n max?: number | string;\n\n /**\n * Error message to display when the input is invalid, also activates invalid styling\n */\n @property()\n invalidmessage = '';\n\n @property()\n type:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'file'\n | 'month'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week' = 'text';\n\n /**\n * Adds a clear button when the input is not empty.\n * */\n @property({ type: Boolean })\n clearable = false;\n\n /**\n * Adds a button to toggle the password's visibility.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordtoggle = false;\n\n /**\n * Determines wether the password is currently visible.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordvisible = false;\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n readonly = false;\n\n /**\n * A regular expression pattern to validate input against.\n */\n @property()\n pattern?: string;\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * Visually hides `label` and `description` (still available for screen readers)\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n @state()\n hasFocus = false;\n\n static get formControlValidators() {\n return [\n requiredValidator,\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n ];\n }\n\n get validationTarget() {\n return this.input;\n }\n\n constructor() {\n super();\n nextUniqueId++;\n this.inputId = `mid-textfield-input-${nextUniqueId}`;\n this.descriptionId = `mid-textfield-description-${nextUniqueId}`;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.initialValue = this.value;\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n if (event.key === 'Enter' && !hasModifier) {\n setTimeout(() => {\n //\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form.requestSubmit();\n }\n });\n }\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.dispatchEvent(\n new Event('mid-blur', { bubbles: true, composed: true })\n );\n }\n\n private handleChange() {\n this.value = this.input.value;\n this.dispatchEvent(\n new Event('mid-change', { bubbles: true, composed: true })\n );\n }\n\n private handleInput() {\n this.value = this.input.value;\n this.setValue(this.value);\n this.dispatchEvent(\n new Event('mid-input', { bubbles: true, composed: true })\n );\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private handlePasswordToggle() {\n this.passwordvisible = !this.passwordvisible;\n }\n\n private handleClearClick(event: MouseEvent) {\n event.preventDefault();\n\n if (this.value !== '') {\n this.value = '';\n this.dispatchEvent(\n new Event('mid-clear', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-input', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-change', { composed: true, bubbles: true })\n );\n }\n\n this.input.focus();\n }\n\n focus() {\n this.hasFocus = true;\n this.input.focus();\n }\n\n resetFormControl() {\n this.invalidmessage = '';\n this.value = this.initialValue;\n }\n\n forceError(message?: string): void {\n super.forceError(message);\n }\n\n @watch('value')\n handleValueUpdate() {\n this.setValue(this.value);\n }\n\n override render() {\n const lg = this.size === 'lg';\n const md = this.size === 'md';\n const sm = this.size === 'sm';\n\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n const hasClearIcon = this.clearable && !this.disabled && !this.readonly;\n const isClearIconVisible =\n hasClearIcon && (typeof this.value === 'number' || this.value.length > 0);\n\n return html`\n <div\n part=\"field\"\n class=\"${classMap({\n 'opacity-disabled': this.disabled,\n 'text-body-sm': sm,\n 'text-body-md': md,\n 'text-body-lg': lg,\n })}\"\n >\n <label\n for=\"${this.inputId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n })} mb-2 inline-flex items-center gap-1 font-medium\"\n >\n ${this.readonly\n ? html`<mid-icon\n class=\"size-5\"\n library=\"system\"\n name=\"padlock-locked-fill\"\n ></mid-icon>`\n : nothing}\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n ${this.description\n ? html`\n <div\n id=\"${this.descriptionId}\"\n part=\"description\"\n class=\"${classMap({\n 'sr-only': this.hidelabel,\n })} text-neutral-subtle mb-2\"\n >\n ${this.description}\n </div>\n `\n : nothing}\n <div\n part=\"base\"\n class=\"${classMap({\n 'border-neutral': !this.invalidmessage && !this.readonly,\n 'border-danger': this.invalidmessage && !this.readonly,\n 'border-neutral-subtle': this.readonly,\n 'bg-neutral-surface-tinted': this.readonly,\n 'bg-neutral-surface': !this.readonly,\n border: !this.invalidmessage,\n 'border-2': this.invalidmessage,\n })} focus-within:focus-ring flex h-12 items-center rounded-md px-3\"\n >\n <span class=\"slotted:!mr-2 slotted:rounded flex items-center\">\n <slot name=\"prefix\"></slot>\n </span>\n <input\n id=\"${this.inputId}\"\n class=\"${classMap({\n '[&::-webkit-search-cancel-button]:appearance-none':\n this.type === 'search',\n })} input grow focus-visible:outline-0\"\n part=\"input\"\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?autofocus=${this.autofocus}\n autocomplete=${ifDefined(this.autocomplete as any)}\n type=${this.type === 'password' && this.passwordvisible\n ? 'text'\n : this.type}\n aria-describedby=\"${this.descriptionId}\"\n aria-errormessage=\"error-message\"\n placeholder=${ifDefined(this.placeholder)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n pattern=${ifDefined(this.pattern)}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n @keydown=${this.handleKeydown}\n />\n ${isClearIconVisible\n ? html`\n <button\n part=\"clear-button\"\n type=\"button\"\n class=\"focus-visible:focus-ring ml-2 flex items-center justify-center rounded-sm\"\n aria-label=\"Tøm\"\n @click=${this.handleClearClick}\n >\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"xmark\"\n ></mid-icon>\n </button>\n `\n : ''}\n ${this.passwordtoggle && !this.disabled\n ? html`\n <button\n part=\"password-toggle-button\"\n type=\"button\"\n class=\"ml-2 flex items-center justify-center rounded-sm\"\n aria-label=${this.passwordvisible\n ? 'skjul passord'\n : 'vis passord'}\n @click=${this.handlePasswordToggle}\n tabindex=\"-1\"\n >\n ${this.passwordvisible\n ? html` <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye-slash\"\n ></mid-icon>`\n : html`\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye\"\n ></mid-icon>\n `}\n </button>\n `\n : ''}\n <span part=\"suffix\" class=\"slotted:!ml-2 slotted:rounded\">\n <slot name=\"suffix\"></slot>\n </span>\n </div>\n <div\n class=\"${classMap({\n hidden: !this.invalidmessage,\n })} text-danger-subtle mt-2 flex gap-1\"\n id=\"error-message\"\n aria-live=\"polite\"\n >\n <mid-icon\n name=\"xmark-octagon-fill\"\n class=\"mt-1 min-h-5 min-w-5\"\n ></mid-icon>\n ${this.invalidmessage}\n </div>\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAKF;AAEA,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S,EAAE,MAAM,QAAS,CAAA;AAAA,GA9FhB,eA+FX,WAAA,kBAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GArGhB,eAsGX,WAAA,mBAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAM,CAAA;AAAA,GAxG/B,eAyGX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAM,CAAA;AAAA,GA3G/B,eA4GX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS;AAAA,GAjHC,eAkHX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GAvHhB,eAwHX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GA7HhB,eA8HX,WAAA,aAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAM;AAAA,GAhII,eAiIX,WAAA,YAAA,CAAA;AAgHA,gBAAA;AAAA,EADC,MAAM,OAAO;AAAA,GAhPH,eAiPX,WAAA,qBAAA,CAAA;AAjPW,iBAAN,gBAAA;AAAA,EADN,cAAc,eAAe;AAAA,GACjB,cAAA;"}
|
|
1
|
+
{"version":3,"file":"textfield.js","sources":["../../src/components/textfield.component.ts"],"sourcesContent":["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { stringConverter } from '../internal/string-converter';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styled } from '../mixins/tailwind.mixin.ts';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { HasSlotController } from '../internal/slot';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport {\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n requiredValidator,\n} from '../mixins/validators';\nimport { watch } from '../internal/watch';\nimport './icon/icon.component.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-textfield': MinidTextfield;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n `,\n];\n\nlet nextUniqueId = 0;\n\n/**\n *\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-clear - Emitted when the input value is cleared\n * @event mid-focus - Emitted when input element is focused\n * @event mid-blur - Emitted when focus moves away from input element\n * @event {detail: { validity: ValidityState }} mid-invalid-hide - Emitted when the error message should be hidden\n * @event {detail: { validity: ValidityState }} mid-invalid-show - Emitted when the error message should be shown\n *\n * @slot prefix - Used for decoration to the left of the input\n * @slot suffix - Used for decoration to the right of the input\n * @slot label - The input's label. Alternatively, you can use the `label` attribute.\n *\n * @csspart base - The input's wrapper that has the input field styling.\n * @csspart input - The internal `<input>` element.\n * @csspart field - The element that wraps the label, input, and help text.\n * @csspart clear-button - The clear button\n * @csspart password-toggle-button - The button for toggling password visibility\n */\n@customElement('mid-textfield')\nexport class MinidTextfield extends FormControlMixin(\n styled(LitElement, styles)\n) {\n private readonly inputId!: string;\n private readonly descriptionId!: string;\n private readonly validationId!: string;\n private readonly hasSlotControler = new HasSlotController(this, 'label');\n private initialValue = '';\n\n @query('.input')\n input!: HTMLInputElement;\n\n @property()\n label = '';\n\n @property()\n description = '';\n\n @property()\n value = '';\n\n @property()\n size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ converter: stringConverter })\n placeholder?: string;\n\n /**\n * Autofocus the input field on page load\n */\n @property({ type: Boolean })\n autofocus = false;\n\n /**\n * User agent autocomplete hint\n */\n @property()\n autocomplete?: AutoFill;\n\n /**\n * The minimum length of input that will be considered valid.\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * The maximum length of input that will be considered valid.\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * The input's minimum value. Only applies to date and number input types.\n */\n @property()\n min?: number | string;\n\n /**\n * The input's maximum value. Only applies to date and number input types.\n */\n @property()\n max?: number | string;\n\n /**\n * Error message to display when the input is invalid, also activates invalid styling\n */\n @property()\n invalidmessage = '';\n\n @property()\n type:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'file'\n | 'month'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week' = 'text';\n\n /**\n * Adds a clear button when the input is not empty.\n * */\n @property({ type: Boolean })\n clearable = false;\n\n /**\n * Adds a button to toggle the password's visibility.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordtoggle = false;\n\n /**\n * Determines wether the password is currently visible.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordvisible = false;\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n readonly = false;\n\n /**\n * A regular expression pattern to validate input against.\n */\n @property()\n pattern?: string;\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * Visually hides `label` and `description` (still available for screen readers)\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n @state()\n hasFocus = false;\n\n static get formControlValidators() {\n return [\n requiredValidator,\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n ];\n }\n\n get validationTarget() {\n return this.input;\n }\n\n constructor() {\n super();\n nextUniqueId++;\n this.inputId = `mid-textfield-input-${nextUniqueId}`;\n this.descriptionId = `mid-textfield-description-${nextUniqueId}`;\n this.validationId = `mid-textfield-validation-${nextUniqueId}`;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.initialValue = this.value;\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n if (event.key === 'Enter' && !hasModifier) {\n setTimeout(() => {\n //\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form.requestSubmit();\n }\n });\n }\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.dispatchEvent(\n new Event('mid-blur', { bubbles: true, composed: true })\n );\n }\n\n private handleChange() {\n this.value = this.input.value;\n this.dispatchEvent(\n new Event('mid-change', { bubbles: true, composed: true })\n );\n }\n\n private handleInput() {\n this.value = this.input.value;\n this.setValue(this.value);\n this.dispatchEvent(\n new Event('mid-input', { bubbles: true, composed: true })\n );\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private handlePasswordToggle() {\n this.passwordvisible = !this.passwordvisible;\n }\n\n private handleClearClick(event: MouseEvent) {\n event.preventDefault();\n\n if (this.value !== '') {\n this.value = '';\n this.dispatchEvent(\n new Event('mid-clear', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-input', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-change', { composed: true, bubbles: true })\n );\n }\n\n this.input.focus();\n }\n\n focus() {\n this.hasFocus = true;\n this.input.focus();\n }\n\n resetFormControl() {\n this.invalidmessage = '';\n this.value = this.initialValue;\n }\n\n forceError(message?: string): void {\n super.forceError(message);\n }\n\n @watch('value')\n handleValueUpdate() {\n this.setValue(this.value);\n }\n\n override render() {\n const lg = this.size === 'lg';\n const md = this.size === 'md';\n const sm = this.size === 'sm';\n\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n const hasClearIcon = this.clearable && !this.disabled && !this.readonly;\n const isClearIconVisible =\n hasClearIcon && (typeof this.value === 'number' || this.value.length > 0);\n\n return html`\n <div\n part=\"field\"\n class=\"${classMap({\n 'opacity-disabled': this.disabled,\n 'text-body-sm': sm,\n 'text-body-md': md,\n 'text-body-lg': lg,\n })} max-w-full\"\n >\n <label\n for=\"${this.inputId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n })} mb-2 inline-flex items-center gap-1 font-medium\"\n >\n ${this.readonly\n ? html`<mid-icon\n class=\"size-5\"\n library=\"system\"\n name=\"padlock-locked-fill\"\n ></mid-icon>`\n : nothing}\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n ${this.description\n ? html`\n <div\n id=\"${this.descriptionId}\"\n part=\"description\"\n class=\"${classMap({\n 'sr-only': this.hidelabel,\n })} text-neutral-subtle mb-2\"\n >\n ${this.description}\n </div>\n `\n : nothing}\n <div\n part=\"base\"\n class=\"${classMap({\n 'border-neutral': !this.invalidmessage && !this.readonly,\n 'border-danger': this.invalidmessage && !this.readonly,\n 'border-neutral-subtle': this.readonly,\n 'bg-neutral-surface-tinted': this.readonly,\n 'bg-neutral-surface': !this.readonly,\n border: !this.invalidmessage,\n 'border-2': this.invalidmessage,\n })} focus-within:focus-ring flex h-12 items-center rounded-md px-3\"\n >\n <span class=\"slotted:!mr-2 slotted:rounded flex items-center\">\n <slot name=\"prefix\"></slot>\n </span>\n <input\n id=\"${this.inputId}\"\n class=\"${classMap({\n 'w-full': !isClearIconVisible,\n 'w-[calc(100%-var(--spacing)*7)]': isClearIconVisible,\n '[&::-webkit-search-cancel-button]:appearance-none':\n this.type === 'search',\n })} input grow overflow-clip focus-visible:outline-0\"\n part=\"input\"\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?autofocus=${this.autofocus}\n autocomplete=${ifDefined(this.autocomplete as any)}\n type=${this.type === 'password' && this.passwordvisible\n ? 'text'\n : this.type}\n aria-describedby=\"${this.descriptionId}\"\n aria-errormessage=\"${this.validationId}\"\n placeholder=${ifDefined(this.placeholder)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n pattern=${ifDefined(this.pattern)}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n @keydown=${this.handleKeydown}\n />\n ${isClearIconVisible\n ? html`\n <button\n part=\"clear-button\"\n type=\"button\"\n class=\"focus-visible:focus-ring ml-2 flex items-center justify-center rounded-sm\"\n aria-label=\"Tøm\"\n @click=${this.handleClearClick}\n >\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"xmark\"\n ></mid-icon>\n </button>\n `\n : ''}\n ${this.passwordtoggle && !this.disabled\n ? html`\n <button\n part=\"password-toggle-button\"\n type=\"button\"\n class=\"ml-2 flex items-center justify-center rounded-sm\"\n aria-label=${this.passwordvisible\n ? 'skjul passord'\n : 'vis passord'}\n @click=${this.handlePasswordToggle}\n tabindex=\"-1\"\n >\n ${this.passwordvisible\n ? html` <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye-slash\"\n ></mid-icon>`\n : html`\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye\"\n ></mid-icon>\n `}\n </button>\n `\n : ''}\n <span part=\"suffix\" class=\"slotted:!ml-2 slotted:rounded\">\n <slot name=\"suffix\"></slot>\n </span>\n </div>\n <div\n class=\"text-danger-subtle mt-2 flex gap-1\"\n id=\"${this.validationId}\"\n aria-live=\"polite\"\n ?hidden=${!this.invalidmessage}\n >\n <mid-icon\n name=\"xmark-octagon-fill\"\n class=\"mt-1 min-h-5 min-w-5\"\n ></mid-icon>\n ${this.invalidmessage}\n </div>\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAKF;AAEA,IAAI,eAAe;AAuBZ,IAAM,iBAAN,cAA6B;AAAA,EAClC,OAAO,YAAY,MAAM;AAC3B,EAAE;AAAA,EA+IA,cAAc;AACN,UAAA;AA5IR,SAAiB,mBAAmB,IAAI,kBAAkB,MAAM,OAAO;AACvE,SAAQ,eAAe;AAMf,SAAA,QAAA;AAGM,SAAA,cAAA;AAG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X,WAAA,mBAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAM,CAAA;AAAA,GAzG/B,eA0GX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAM,CAAA;AAAA,GA5G/B,eA6GX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS;AAAA,GAlHC,eAmHX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GAxHhB,eAyHX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GA9HhB,eA+HX,WAAA,aAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAM;AAAA,GAjII,eAkIX,WAAA,YAAA,CAAA;AAiHA,gBAAA;AAAA,EADC,MAAM,OAAO;AAAA,GAlPH,eAmPX,WAAA,qBAAA,CAAA;AAnPW,iBAAN,gBAAA;AAAA,EADN,cAAc,eAAe;AAAA,GACjB,cAAA;"}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
--font-*: initial;
|
|
22
22
|
--font-sans: 'Inter', 'Arial', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
23
23
|
--font-sans--font-feature-settings: 'cv05' 1;
|
|
24
|
-
--font-mono: IBM Plex Mono;
|
|
24
|
+
--font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
|
|
25
25
|
--text-heading-2xl--font-weight: 500;
|
|
26
26
|
--text-heading-2xl--line-height: 1.3;
|
|
27
27
|
--text-heading-2xl: 3.75rem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events/events.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MinidMenuItem } from '../components/menu-item.component';
|
|
2
|
+
export type MidSelectEvent = CustomEvent<{
|
|
3
|
+
item: MinidMenuItem;
|
|
4
|
+
}>;
|
|
5
|
+
declare global {
|
|
6
|
+
interface GlobalEventHandlersEventMap {
|
|
7
|
+
'mid-select': MidSelectEvent;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=mid-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mid-select.d.ts","sourceRoot":"","sources":["../../src/events/mid-select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAElE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,2BAA2B;QACnC,YAAY,EAAE,cAAc,CAAC;KAC9B;CACF"}
|