diff --git a/packages/ui/docs/components/accordion/index.md b/packages/ui/docs/components/accordion/index.md new file mode 100644 index 000000000..e9080bd18 --- /dev/null +++ b/packages/ui/docs/components/accordion/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/accordion/index.md) diff --git a/packages/ui/docs/components/accordion/overview.md b/packages/ui/docs/components/accordion/overview.md new file mode 100644 index 000000000..ff8809ec9 --- /dev/null +++ b/packages/ui/docs/components/accordion/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/accordion/overview.md) diff --git a/packages/ui/docs/components/accordion/reference.md b/packages/ui/docs/components/accordion/reference.md new file mode 100644 index 000000000..fa366e73d --- /dev/null +++ b/packages/ui/docs/components/accordion/reference.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/accordion/reference.md) diff --git a/packages/ui/docs/components/accordion/use-cases.md b/packages/ui/docs/components/accordion/use-cases.md new file mode 100644 index 000000000..ab0a033cf --- /dev/null +++ b/packages/ui/docs/components/accordion/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/accordion/use-cases.md) diff --git a/packages/ui/docs/components/button/examples.md b/packages/ui/docs/components/button/examples.md new file mode 100644 index 000000000..4eec31317 --- /dev/null +++ b/packages/ui/docs/components/button/examples.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/button/examples.md) diff --git a/packages/ui/docs/components/button/index.md b/packages/ui/docs/components/button/index.md new file mode 100644 index 000000000..2f8c7aeba --- /dev/null +++ b/packages/ui/docs/components/button/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/button/index.md) diff --git a/packages/ui/docs/components/button/overview.md b/packages/ui/docs/components/button/overview.md new file mode 100644 index 000000000..c71a6311b --- /dev/null +++ b/packages/ui/docs/components/button/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/button/overview.md) diff --git a/packages/ui/docs/components/button/src/icon.svg.js b/packages/ui/docs/components/button/src/icon.svg.js new file mode 100644 index 000000000..fa20ca7d3 --- /dev/null +++ b/packages/ui/docs/components/button/src/icon.svg.js @@ -0,0 +1,5 @@ +/** + * @param {Function} tag + */ +export default tag => + tag``; diff --git a/packages/ui/docs/components/button/use-cases.md b/packages/ui/docs/components/button/use-cases.md new file mode 100644 index 000000000..77afee3ee --- /dev/null +++ b/packages/ui/docs/components/button/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/button/use-cases.md) diff --git a/packages/ui/docs/components/calendar/index.md b/packages/ui/docs/components/calendar/index.md new file mode 100644 index 000000000..5bcfe6303 --- /dev/null +++ b/packages/ui/docs/components/calendar/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/calendar/index.md) diff --git a/packages/ui/docs/components/calendar/overview.md b/packages/ui/docs/components/calendar/overview.md new file mode 100644 index 000000000..251d49395 --- /dev/null +++ b/packages/ui/docs/components/calendar/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/calendar/overview.md) diff --git a/packages/ui/docs/components/calendar/use-cases.md b/packages/ui/docs/components/calendar/use-cases.md new file mode 100644 index 000000000..4cb05f9e1 --- /dev/null +++ b/packages/ui/docs/components/calendar/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/calendar/use-cases.md) diff --git a/packages/ui/docs/components/checkbox-group/index.md b/packages/ui/docs/components/checkbox-group/index.md new file mode 100644 index 000000000..8b51abd31 --- /dev/null +++ b/packages/ui/docs/components/checkbox-group/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/checkbox-group/index.md) diff --git a/packages/ui/docs/components/checkbox-group/overview.md b/packages/ui/docs/components/checkbox-group/overview.md new file mode 100644 index 000000000..f40efd625 --- /dev/null +++ b/packages/ui/docs/components/checkbox-group/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/checkbox-group/overview.md) diff --git a/packages/ui/docs/components/checkbox-group/use-cases.md b/packages/ui/docs/components/checkbox-group/use-cases.md new file mode 100644 index 000000000..a655a2e51 --- /dev/null +++ b/packages/ui/docs/components/checkbox-group/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/checkbox-group/use-cases.md) diff --git a/packages/ui/docs/components/collapsible/assets/CustomCollapsible.js b/packages/ui/docs/components/collapsible/assets/CustomCollapsible.js new file mode 100644 index 000000000..1bed17454 --- /dev/null +++ b/packages/ui/docs/components/collapsible/assets/CustomCollapsible.js @@ -0,0 +1,113 @@ +import { LionCollapsible } from '@lion/ui/collapsible.js'; + +const EVENT = { + TRANSITION_END: 'transitionend', + TRANSITION_START: 'transitionstart', +}; +/** + * `CustomCollapsible` is a class for custom collapsible element (`` web component). + * @customElement custom-collapsible + */ +// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you. +export class CustomCollapsible extends LionCollapsible { + static get properties() { + return { + transitioning: { + type: Boolean, + reflect: true, + }, + }; + } + + constructor() { + super(); + this.transitioning = false; + } + + connectedCallback() { + super.connectedCallback(); + this._contentNode?.style.setProperty( + 'transition', + 'max-height 0.35s, padding 0.35s, opacity 0.35s', + ); + if (this.opened) { + this._contentNode?.style.setProperty('padding', '12px 0'); + } + } + + /** + * Wait until transition is finished. + * @override + */ + toggle() { + if (!this.transitioning) { + super.toggle(); + } + } + + /** + * Trigger show animation and wait for transition to be finished. + * @param {Object} options - element node and its options + * @param {HTMLElement} options.contentNode + * @override + */ + async _showAnimation({ contentNode }) { + const expectedHeight = await this.__calculateHeight(contentNode); + contentNode.style.setProperty('opacity', '1'); + contentNode.style.setProperty('padding', '12px 0'); + contentNode.style.setProperty('max-height', '0px'); + await new Promise(resolve => requestAnimationFrame(() => resolve())); + contentNode.style.setProperty('max-height', expectedHeight); + await this._waitForTransition({ contentNode }); + } + + /** + * Trigger hide animation and wait for transition to be finished. + * @param {Object} options - element node and its options + * @param {HTMLElement} options.contentNode + * @override + */ + async _hideAnimation({ contentNode }) { + if (this._contentHeight === '0px') { + return; + } + ['opacity', 'padding', 'max-height'].map(prop => contentNode.style.setProperty(prop, '0')); + await this._waitForTransition({ contentNode }); + } + + /** + * Wait until the transition event is finished. + * @param {Object} options - element node and its options + * @param {HTMLElement} options.contentNode + * @returns {Promise} transition event + */ + _waitForTransition({ contentNode }) { + return new Promise(resolve => { + const transitionStarted = () => { + contentNode.removeEventListener(EVENT.TRANSITION_START, transitionStarted); + this.transitioning = true; + }; + contentNode.addEventListener(EVENT.TRANSITION_START, transitionStarted); + + const transitionEnded = () => { + contentNode.removeEventListener(EVENT.TRANSITION_END, transitionEnded); + this.transitioning = false; + resolve(); + }; + contentNode.addEventListener(EVENT.TRANSITION_END, transitionEnded); + }); + } + + /** + * Calculate total content height after collapsible opens + * @param {HTMLElement} contentNode content node + * @private + */ + async __calculateHeight(contentNode) { + contentNode.style.setProperty('max-height', ''); + await new Promise(resolve => requestAnimationFrame(() => resolve())); + return this._contentHeight; // Expected height i.e. actual size once collapsed after animation + } +} + +customElements.define('custom-collapsible', CustomCollapsible); diff --git a/packages/ui/docs/components/collapsible/assets/applyDemoCollapsibleStyles.js b/packages/ui/docs/components/collapsible/assets/applyDemoCollapsibleStyles.js new file mode 100644 index 000000000..caba2de06 --- /dev/null +++ b/packages/ui/docs/components/collapsible/assets/applyDemoCollapsibleStyles.js @@ -0,0 +1,37 @@ +import { css } from 'lit'; + +const applyDemoCollapsibleStyles = () => { + const demoCollapsibleStyles = css` + .demo-custom-collapsible-container { + padding: 16px; + margin: 16px; + border-radius: 4px; + width: 400px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); + } + + .demo-custom-collapsible-body { + padding: 12px 0px; + } + + .demo-custom-collapsible-invoker { + border-width: 0; + border-radius: 2px; + padding: 12px 24px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); + font-weight: bold; + color: #3f51b5; + } + + .demo-custom-collapsible-state-container { + padding: 12px 0; + } + `; + + const styleTag = document.createElement('style'); + styleTag.setAttribute('data-demo-collapsible', ''); + styleTag.textContent = demoCollapsibleStyles.cssText; + document.head.appendChild(styleTag); +}; + +applyDemoCollapsibleStyles(); diff --git a/packages/ui/docs/components/collapsible/examples.md b/packages/ui/docs/components/collapsible/examples.md new file mode 100644 index 000000000..60d162d8a --- /dev/null +++ b/packages/ui/docs/components/collapsible/examples.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/collapsible/examples.md) diff --git a/packages/ui/docs/components/collapsible/index.md b/packages/ui/docs/components/collapsible/index.md new file mode 100644 index 000000000..b5823a2a7 --- /dev/null +++ b/packages/ui/docs/components/collapsible/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/collapsible/index.md) diff --git a/packages/ui/docs/components/collapsible/overview.md b/packages/ui/docs/components/collapsible/overview.md new file mode 100644 index 000000000..dd52cc5a1 --- /dev/null +++ b/packages/ui/docs/components/collapsible/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/collapsible/overview.md) diff --git a/packages/ui/docs/components/collapsible/use-cases.md b/packages/ui/docs/components/collapsible/use-cases.md new file mode 100644 index 000000000..73267fc0e --- /dev/null +++ b/packages/ui/docs/components/collapsible/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/collapsible/use-cases.md) diff --git a/packages/ui/docs/components/combobox/examples.md b/packages/ui/docs/components/combobox/examples.md new file mode 100644 index 000000000..32ba321a6 --- /dev/null +++ b/packages/ui/docs/components/combobox/examples.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/combobox/examples.md) diff --git a/packages/ui/docs/components/combobox/index.md b/packages/ui/docs/components/combobox/index.md new file mode 100644 index 000000000..af16f348b --- /dev/null +++ b/packages/ui/docs/components/combobox/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/combobox/index.md) diff --git a/packages/ui/docs/components/combobox/overview.md b/packages/ui/docs/components/combobox/overview.md new file mode 100644 index 000000000..583489872 --- /dev/null +++ b/packages/ui/docs/components/combobox/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/combobox/overview.md) diff --git a/packages/ui/docs/components/combobox/src/LinkMixin.js b/packages/ui/docs/components/combobox/src/LinkMixin.js new file mode 100644 index 000000000..99378104d --- /dev/null +++ b/packages/ui/docs/components/combobox/src/LinkMixin.js @@ -0,0 +1,60 @@ +import { dedupeMixin } from '@open-wc/dedupe-mixin'; + +/** + * @typedef {import('lit-element').PropertyValues } changedProperties + */ + +/** + * Designed for webcomponents that need to behave like a link. + * For instance, comboboxes that have search result options opening a webpage on click. + * Using an is not a viable alternative, because: + * - no shadow dom (and thus no style encapsulation possibilities) + * - we need to extend from LionOption (and we cannot put the anchor inside + * the focusable element (LionOption which has [role=option])) + */ +const LinkMixinImplementation = superclass => + class extends superclass { + static get properties() { + return { + href: String, + target: String, + }; + } + + constructor() { + super(); + this._nativeAnchor = document.createElement('a'); + } + + connectedCallback() { + super.connectedCallback(); + if (!this.hasAttribute('role')) { + this.setAttribute('role', 'link'); + } + } + + firstUpdated(changedProperties) { + super.firstUpdated(changedProperties); + this.addEventListener('click', this.__navigate); + this.addEventListener('keydown', ({ key }) => { + if (key === ' ' || key === 'Enter') { + this.__navigate(); + } + }); + } + + updated(changedProperties) { + super.updated(changedProperties); + if (changedProperties.has('href')) { + this._nativeAnchor.href = this.href; + } + if (changedProperties.has('target')) { + this._nativeAnchor.target = this.target; + } + } + + __navigate() { + this._nativeAnchor.click(); + } + }; +export const LinkMixin = dedupeMixin(LinkMixinImplementation); diff --git a/packages/ui/docs/components/combobox/src/demo-selection-display.js b/packages/ui/docs/components/combobox/src/demo-selection-display.js new file mode 100644 index 000000000..d5377353a --- /dev/null +++ b/packages/ui/docs/components/combobox/src/demo-selection-display.js @@ -0,0 +1,191 @@ +// eslint-disable-next-line max-classes-per-file +import { LitElement, html, css, nothing } from 'lit'; + +/** + * Disclaimer: this is just an example component demoing the selection display of LionCombobox + * It needs an 'a11y plan' and tests before it could be released + */ + +/** + * @typedef {import('./LionCombobox.js.js.js.js').LionCombobox} LionCombobox + */ + +/** + * Renders the wrapper containing the textbox that triggers the listbox with filtered options. + * Optionally, shows 'chips' that indicate the selection. + * Should be considered an internal/protected web component to be used in conjunction with + * LionCombobox + * + */ +export class DemoSelectionDisplay extends LitElement { + static get properties() { + return { + comboboxElement: Object, + /** + * Can be used to visually indicate the next + */ + removeChipOnNextBackspace: Boolean, + selectedElements: Array, + }; + } + + static get styles() { + return css` + :host { + display: flex; + } + + .combobox__selection { + flex: none; + } + + .combobox__input { + display: block; + } + + .selection-chip { + border-radius: 4px; + background-color: #eee; + padding: 4px; + font-size: 10px; + } + + .selection-chip--highlighted { + background-color: #ccc; + } + + * > ::slotted([slot='_textbox']) { + outline: none; + width: 100%; + height: 100%; + box-sizing: border-box; + border: none; + border-bottom: 1px solid; + } + `; + } + + /** + * @configure FocusMixin + */ + get _inputNode() { + return this.comboboxElement._inputNode; + } + + _computeSelectedElements() { + const { formElements, checkedIndex } = /** @type {LionCombobox} */ (this.comboboxElement); + const checkedIndexes = Array.isArray(checkedIndex) ? checkedIndex : [checkedIndex]; + return formElements.filter((_, i) => checkedIndexes.includes(i)); + } + + get multipleChoice() { + return this.comboboxElement?.multipleChoice; + } + + constructor() { + super(); + + this.selectedElements = []; + + /** @type {EventListener} */ + this.__textboxOnKeyup = this.__textboxOnKeyup.bind(this); + /** @type {EventListener} */ + this.__restoreBackspace = this.__restoreBackspace.bind(this); + } + + /** + * @param {import('lit-element').PropertyValues } changedProperties + */ + firstUpdated(changedProperties) { + super.firstUpdated(changedProperties); + + if (this.multipleChoice) { + this._inputNode.addEventListener('keyup', this.__textboxOnKeyup); + this._inputNode.addEventListener('focusout', this.__restoreBackspace); + } + } + + /** + * @param {import('lit-element').PropertyValues } changedProperties + */ + onComboboxElementUpdated(changedProperties) { + if (changedProperties.has('modelValue')) { + this.selectedElements = this._computeSelectedElements(); + } + } + + /** + * Whenever selectedElements are updated, makes sure that latest added elements + * are shown latest, and deleted elements respect existing order of chips. + */ + __reorderChips() { + const { selectedElements } = this; + if (this.__prevSelectedEls) { + const addedEls = selectedElements.filter(e => !this.__prevSelectedEls.includes(e)); + const deletedEls = this.__prevSelectedEls.filter(e => !selectedElements.includes(e)); + if (addedEls.length) { + this.selectedElements = [...this.__prevSelectedEls, ...addedEls]; + } else if (deletedEls.length) { + deletedEls.forEach(delEl => { + this.__prevSelectedEls.splice(this.__prevSelectedEls.indexOf(delEl), 1); + }); + this.selectedElements = this.__prevSelectedEls; + } + } + this.__prevSelectedEls = this.selectedElements; + } + + /** + * @param {import("@lion/listbox").LionOption} option + * @param {boolean} highlight + */ + // eslint-disable-next-line class-methods-use-this + _selectedElementTemplate(option, highlight) { + return html` + + ${option.value} + + `; + } + + _selectedElementsTemplate() { + if (!this.multipleChoice) { + return nothing; + } + return html` +
+ ${this.selectedElements.map((option, i) => { + const highlight = Boolean( + this.removeChipOnNextBackspace && i === this.selectedElements.length - 1, + ); + return this._selectedElementTemplate(option, highlight); + })} +
+ `; + } + + render() { + return html` ${this._selectedElementsTemplate()} `; + } + + /** + * @param {{ key: string; }} ev + */ + __textboxOnKeyup(ev) { + if (ev.key === 'Backspace') { + if (!this._inputNode.value) { + if (this.removeChipOnNextBackspace && this.selectedElements.length) { + this.selectedElements[this.selectedElements.length - 1].checked = false; + } + this.removeChipOnNextBackspace = true; + } + } else { + this.removeChipOnNextBackspace = false; + } + } + + __restoreBackspace() { + this.removeChipOnNextBackspace = false; + } +} +customElements.define('demo-selection-display', DemoSelectionDisplay); diff --git a/packages/ui/docs/components/combobox/src/gh-combobox/gh-button.js b/packages/ui/docs/components/combobox/src/gh-combobox/gh-button.js new file mode 100644 index 000000000..c24f2d33a --- /dev/null +++ b/packages/ui/docs/components/combobox/src/gh-combobox/gh-button.js @@ -0,0 +1,69 @@ +import { css, html } from 'lit'; +import { LionButton } from '@lion/ui/button.js'; + +export class GhButton extends LionButton { + static get properties() { + return { + value: String, + }; + } + + static get styles() { + return css` + :host { + outline: none; + position: relative; + display: inline-flex; + align-items: center; + padding: 5px 16px; + font-size: 14px; + font-weight: 500; + line-height: 20px; + white-space: nowrap; + vertical-align: middle; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + border: 1px solid; + border-radius: 6px; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + + color: #24292e; + background-color: #fafbfc; + border-color: rgba(27, 31, 35, 0.15); + box-shadow: 0 1px 0 rgba(27, 31, 35, 0.04), inset 0 1px 0 hsla(0, 0%, 100%, 0.25); + transition: background-color 0.2s cubic-bezier(0.3, 0, 0.5, 1); + } + + :host(:hover) { + background-color: #f3f4f6; + transition-duration: 0.1s; + } + + :host ::slotted([slot='before']) { + margin-right: 4px; + } + + /** + * TODO: this doesn't have to be light dom anymore in LionButton, + * just spawning a hidden native button on submit would be enough + */ + :host ::slotted(button) { + position: absolute; + opacity: 0; + } + `; + } + + render() { + return html` + ${this.value} + + `; + } +} +customElements.define('gh-button', GhButton); diff --git a/packages/ui/docs/components/combobox/src/gh-combobox/gh-combobox.js b/packages/ui/docs/components/combobox/src/gh-combobox/gh-combobox.js new file mode 100644 index 000000000..5b40a91f3 --- /dev/null +++ b/packages/ui/docs/components/combobox/src/gh-combobox/gh-combobox.js @@ -0,0 +1,508 @@ +import { css, html } from 'lit'; +import { LionOption } from '@lion/ui/listbox.js'; +import { renderLitAsNode } from '@lion/ui/helpers.js'; +// import { withModalDialogConfig } from '@lion/ui/overlays.js'; +import { LionCombobox } from '@lion/ui/combobox.js'; +import './gh-button.js'; + +export class GhOption extends LionOption { + static get properties() { + return { + category: String, + default: { type: Boolean, reflect: true }, + }; + } + + static get styles() { + return [ + ...super.styles, + css` + :host { + display: flex; + align-items: center; + width: 100%; + padding: 16px; + overflow: hidden; + color: #24292e; + text-align: left; + cursor: pointer; + background-color: #fff; + border: 0; + border-bottom: 1px solid #eaecef; + box-sizing: border-box; + display: flex; + align-items: center; + } + + @media (min-width: 544px) { + :host { + padding-top: 7px; + padding-bottom: 7px; + } + } + + :host([checked]) { + background-color: white; + } + + :host(:hover), + :host([active]), + :host([focused]) { + background-color: #f6f8fa; + } + + .gh-check-icon { + visibility: hidden; + margin-right: 4px; + } + + :host([checked]) .gh-check-icon { + visibility: visible; + } + + .gh-default-badge { + visibility: hidden; + + display: inline-block; + padding: 0 7px; + font-size: 12px; + font-weight: 500; + line-height: 18px; + border-radius: 2em; + background-color: initial !important; + border: 1px solid #e1e4e8; + color: #586069; + border-color: #e1e4e8; + } + + :host([default]) .gh-default-badge { + visibility: visible; + } + + .gh-content { + flex: 1; + } + `, + ]; + } + + render() { + return html` + + + default + `; + } +} +customElements.define('gh-option', GhOption); + +export class GhCombobox extends LionCombobox { + static get properties() { + return { + category: { type: String }, + isDesktop: { type: Boolean, reflect: true, attribute: 'is-desktop' }, + }; + } + + static get styles() { + return [ + ...super.styles, + css` + /** @configure LionCombobox */ + + :host { + font-family: apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, + Apple Color Emoji, Segoe UI Emoji; + font-size: 14px; + } + + .input-group__container { + display: flex; + border-bottom: none; + } + + * > ::slotted([role='listbox']) { + max-height: none; + } + + * > ::slotted([slot='input']) { + padding: 5px 12px; + font-size: 14px; + line-height: 20px; + color: #24292e; + vertical-align: middle; + background-color: #fff; + background-repeat: no-repeat; + background-position: right 8px center; + border: 1px solid #e1e4e8; + border-radius: 6px; + outline: none; + box-shadow: inset 0 1px 0 rgba(225, 228, 232, 0.2); + } + + :host([is-desktop]) { + font-size: 12px; + } + + :host([is-desktop]) ::slotted([slot='input']) { + font-size: 14px; + } + + :host([focused]) ::slotted([slot='input']) { + border-color: #0366d6; + outline: none; + box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.3); + } + + .gh-combobox { + height: auto; + max-height: 480px; + margin-top: 8px; + + position: relative; + z-index: 99; + display: flex; + max-height: 66%; + margin: auto 0; + overflow: hidden; + pointer-events: auto; + flex-direction: column; + background-color: #fff; + border-radius: 12px; + box-shadow: 0 0 18px rgba(27, 31, 35, 0.4); + /* animation: SelectMenu-modal-animation 0.12s cubic-bezier(0, 0.1, 0.1, 1) backwards; */ + } + + :host([is-desktop]) .gh-combobox { + width: 300px; + height: auto; + max-height: 480px; + margin: 8px 0 16px; + font-size: 12px; + border: 1px solid #e1e4e8; + border-radius: 6px; + box-shadow: 0 8px 24px rgba(149, 157, 165, 0.2); + /* animation-name: SelectMenu-modal-animation--sm; */ + } + + .form-field__label { + font-weight: bold; + } + + /** @enhance LionCombobox */ + + .gh-categories { + display: flex; + flex-shrink: 0; + overflow-x: auto; + overflow-y: hidden; + box-shadow: inset 0 -1px 0 #eaecef; + -webkit-overflow-scrolling: touch; + } + + :host([is-desktop]) .gh-categories { + padding: 8px 8px 0; + } + + .gh-categories__btn { + flex: 1; + padding: 8px 16px; + font-size: 12px; + font-weight: 500; + color: #6a737d; + text-align: center; + background-color: initial; + border: 0; + box-shadow: inset 0 -1px 0 #eaecef; + + border-radius: 0; + font-family: inherit; + font-size: inherit; + line-height: inherit; + outline: none; + + cursor: pointer; + } + + .gh-categories__btn:focus { + background-color: #dbedff; + } + + :host([is-desktop]) .gh-categories__btn { + flex: none; + padding: 4px 16px; + border: solid transparent; + border-width: 1px 1px 0; + border-top-left-radius: 6px; + border-top-right-radius: 6px; + } + + .gh-categories__btn[aria-pressed='true'] { + z-index: 1; + color: #24292e; + cursor: default; + box-shadow: 0 0 0 1px #eaecef; + cursor: default; + } + + :host([is-desktop]) .gh-categories__btn { + flex: none; + } + :host([is-desktop]) .gh-categories__btn[aria-pressed='true'] { + border-color: #eaecef; + box-shadow: none; + } + + .gh-section-wrapper { + padding: 16px; + margin: 0; + border-bottom: 1px solid #eaecef; + } + + :host([is-desktop]) .gh-section-wrapper { + padding: 8px; + } + `, + ]; + } + + /** + * @override LionCombobox put all content in an overlay + */ + // eslint-disable-next-line class-methods-use-this + render() { + return html` + + + + `; + } + + /** + * Wrapper with combobox role for the text input that the end user controls the listbox with. + * @type {HTMLElement} + */ + get _comboboxNode() { + if (this.__comboboxNode) { + return this.__comboboxNode; + } + const slot = this.querySelector('[slot="input"]'); + if (slot) { + this.__comboboxNode = slot; + return slot; + } + const slot2 = this._overlayCtrl?.contentWrapperNode.querySelector('[slot="input"]'); + if (slot2) { + this.__comboboxNode = slot2; + return slot2; + } + return null; + } + + /** + * @override LionCombobox: remove selection-display (place it higher up) + */ + // eslint-disable-next-line class-methods-use-this + _inputGroupInputTemplate() { + return html` +
+ +
+ `; + } + + /** + * @override LionCombobox: restore to values FormControlMixin + */ + // eslint-disable-next-line class-methods-use-this + _groupTwoTemplate() { + return html` ${this._inputGroupTemplate()} ${this._feedbackTemplate()} `; + } + + get slots() { + return { + ...super.slots, + 'selection-display': () => + renderLitAsNode(html` + + + + + + `), + }; + } + + get _overlayInvokerNode() { + return this.querySelector('[slot="selection-display"]'); + } + + get _overlayReferenceNode() { + return this._overlayInvokerNode; + } + + get _categoryButtons() { + return Array.from(this.shadowRoot.querySelectorAll('.gh-categories__btn[data-category]')); + } + + constructor() { + super(); + + this.showAllOnEmpty = true; + + /** @type {'branches'|'tags'} */ + this.category = 'branches'; + + this.selectionFollowsFocus = false; + + // Capture mobile OverlayConfig + this.__mobileDropdownComboConfig = this.config; + } + + firstUpdated(changedProperties) { + super.firstUpdated(changedProperties); + + const mql = window.matchMedia('(min-width: 544px)'); + this.isDesktop = mql.matches; + mql.addListener(({ matches }) => { + this.isDesktop = matches; + }); + } + + updated(changedProperties) { + super.updated(changedProperties); + + if (changedProperties.has('category')) { + const cat = this.category; + this._categoryButtons.forEach(btn => { + btn.setAttribute( + 'aria-pressed', + btn.getAttribute('data-category') === cat ? 'true' : 'false', + ); + }); + + this._inputNode.placeholder = + cat === 'branches' ? 'Find or create a branch...' : 'Find a tag'; + + this._handleAutocompletion(); + } + + if (changedProperties.has('opened')) { + // eslint-disable-next-line no-shadow + this._selectionDisplayNode.value = this.modelValue || 'Choose a value...'; + + if (this.opened) { + setTimeout(() => { + this._inputNode.focus(); + }); + } else { + setTimeout(() => { + this._selectionDisplayNode.focus(); + }, 100); + } + } + + if (changedProperties.has('isDesktop')) { + // this.config = this.isDesktop ? this.__mobileDropdownComboConfig : withModalDialogConfig(); + } + } + + // /** + // * @enhance LionCombobox + // * @param {*} option + // * @param {...any} args + // */ + // matchCondition(option, ...args) { + // return super.matchCondition(option, ...args) && option.category === this.category; + // } + + // _defineOverlayConfig() { + // // temp + // return { ...super._defineOverlayConfig(), hidesOnOutsideClick: false }; + // } + + __handleCategory(ev) { + this.category = ev.target.getAttribute('data-category'); + } + + // TODO: overrides below are not safe for override and should be made configurable in Combobox + // basically it should be possible te create a combobox without an overlay + + /** + * @override + */ + _textboxOnKeydown() { + // if (ev.key === 'Tab') { + // this.opened = false; + // } + this.__hasSelection = this._inputNode.value.length !== this._inputNode.selectionStart; + } + + /** + * @enhance OverlayMixin + */ + _setupOpenCloseListeners() { + super._setupOpenCloseListeners(); + this.__toggleOverlay = this.__toggleOverlay.bind(this); + this._overlayInvokerNode.addEventListener('click', this.__toggleOverlay); + } + + __toggleOverlay() { + this.opened = !this.opened; + } + + /** + * @enhance OverlayMixin + */ + _teardownOpenCloseListeners() { + super._teardownOpenCloseListeners(); + this._overlayInvokerNode.removeEventListener('click', this.__toggleOverlay); + } +} +customElements.define('gh-combobox', GhCombobox); diff --git a/packages/ui/docs/components/combobox/src/google-combobox/assets/google-clear-icon.js b/packages/ui/docs/components/combobox/src/google-combobox/assets/google-clear-icon.js new file mode 100644 index 000000000..af73cee2c --- /dev/null +++ b/packages/ui/docs/components/combobox/src/google-combobox/assets/google-clear-icon.js @@ -0,0 +1,9 @@ +import { html } from 'lit'; + +export default html` + + + +`; diff --git a/packages/ui/docs/components/combobox/src/google-combobox/assets/google-search-icon.js b/packages/ui/docs/components/combobox/src/google-combobox/assets/google-search-icon.js new file mode 100644 index 000000000..bd89b44dd --- /dev/null +++ b/packages/ui/docs/components/combobox/src/google-combobox/assets/google-search-icon.js @@ -0,0 +1,9 @@ +import { html } from 'lit'; + +export default html` + + + +`; diff --git a/packages/ui/docs/components/combobox/src/google-combobox/assets/google-voice-search-icon.js b/packages/ui/docs/components/combobox/src/google-combobox/assets/google-voice-search-icon.js new file mode 100644 index 000000000..72bf95009 --- /dev/null +++ b/packages/ui/docs/components/combobox/src/google-combobox/assets/google-voice-search-icon.js @@ -0,0 +1,19 @@ +import { html } from 'lit'; + +export default html` + + + + + + +`; diff --git a/packages/ui/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png b/packages/ui/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png new file mode 100644 index 000000000..333bda937 Binary files /dev/null and b/packages/ui/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png differ diff --git a/packages/ui/docs/components/combobox/src/google-combobox/google-combobox.js b/packages/ui/docs/components/combobox/src/google-combobox/google-combobox.js new file mode 100644 index 000000000..4876b543f --- /dev/null +++ b/packages/ui/docs/components/combobox/src/google-combobox/google-combobox.js @@ -0,0 +1,460 @@ +import { css, html } from 'lit'; +import { LionOption } from '@lion/ui/listbox.js'; +import { renderLitAsNode } from '@lion/ui/helpers.js'; +import { LionCombobox } from '@lion/ui/combobox.js'; +import { LinkMixin } from '../LinkMixin.js'; +import googleSearchIcon from './assets/google-search-icon.js'; +import googleVoiceSearchIcon from './assets/google-voice-search-icon.js'; +import googleClearIcon from './assets/google-clear-icon.js'; + +const googleSearchLogoUrl = new URL('./assets/googlelogo_color_272x92dp.png', import.meta.url).href; + +export class GoogleOption extends LinkMixin(LionOption) { + static get properties() { + return { + imageUrl: { + type: String, + }, + }; + } + + static get styles() { + return [ + ...super.styles, + css` + :host { + position: relative; + padding: 8px 16px; + display: flex; + align-items: center; + background: none; + } + + :host:hover, + :host([active]) { + background: #eee !important; + } + + :host([checked]) { + background: none; + } + + /* :host([active]) { + color: #1867c0 !important; + caret-color: #1867c0 !important; + } */ + + :host { + font-weight: bold; + } + + :host ::slotted(.google-option__highlight) { + font-weight: normal; + } + + .google-option__icon { + height: 20px; + width: 20px; + margin-right: 12px; + fill: var(--icon-color); + } + `, + ]; + } + + /** + * @configure + * @param {string} currentValue + */ + onFilterMatch(currentValue) { + const { innerHTML } = this; + // eslint-disable-next-line no-param-reassign + this.__originalInnerHTML = innerHTML; + const newInnerHTML = innerHTML.replace( + new RegExp(`(${currentValue})`, 'i'), + `$1`, + ); + // For Safari, we need to add a label to the element + this.setAttribute('aria-label', this.textContent); + this.innerHTML = newInnerHTML; + // Alternatively, an extension can add an animation here + this.style.display = ''; + } + + /** + * @configure LionCombobox + */ + onFilterUnmatch() { + this.removeAttribute('aria-label'); + if (this.__originalInnerHTML) { + this.innerHTML = this.__originalInnerHTML; + } + this.style.display = 'none'; + } + + render() { + return html` + ${!this.imageUrl + ? html`
${googleSearchIcon}
` + : html` `} + ${super.render()} + `; + } +} +customElements.define('google-option', GoogleOption); + +export class GoogleCombobox extends LionCombobox { + static get styles() { + return [ + ...super.styles, + css` + /** @configure FormControlMixin */ + + /* ======================= + block | .form-field + ======================= */ + + :host { + font-family: arial, sans-serif; + } + + .form-field__label { + margin-top: 36px; + margin-bottom: 24px; + display: flex; + justify-content: center; + } + + /* ============================== + element | .input-group + ============================== */ + + .input-group { + margin-bottom: 16px; + max-width: 582px; + margin: auto; + } + + .input-group__container { + position: relative; + background: #fff; + display: flex; + border: 1px solid #dfe1e5; + box-shadow: none; + border-radius: 24px; + height: 44px; + } + + .input-group__container:hover, + :host([opened]) .input-group__container { + border-color: rgba(223, 225, 229, 0); + box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28); + } + + :host([opened]) .input-group__container { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + } + + :host([opened]) .input-group__container::before { + content: ''; + position: absolute; + background: white; + left: 0; + right: 0; + height: 10px; + bottom: -10px; + } + + :host([opened]) .input-group__container::after { + content: ''; + position: absolute; + background: #eee; + left: 16px; + right: 16px; + height: 1px; + bottom: 0; + z-index: 3; + } + + .input-group__prefix, + .input-group__suffix { + display: block; + fill: var(--icon-color); + display: flex; + place-items: center; + } + + .input-group__input { + flex: 1; + } + + .input-group__input ::slotted([slot='input']) { + border: transparent; + width: 100%; + } + + /** @configure LionCombobox */ + + /* ======================= + block | .form-field + ======================= */ + + #overlay-content-node-wrapper { + box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28); + border-radius: 0 0 24px 24px; + margin-top: -2px; + padding-top: 6px; + background: white; + } + + * > ::slotted([slot='listbox']) { + margin-bottom: 8px; + background: none; + } + + :host { + --icon-color: #9aa0a6; + } + + /** @enhance LionCombobox */ + + /* =================================== + block | .google-search-clear-btn + =================================== */ + + .google-search-clear-btn { + position: relative; + height: 100%; + align-items: center; + display: none; + } + + .google-search-clear-btn::after { + border-left: 1px solid #dfe1e5; + height: 65%; + right: 0; + content: ''; + margin-right: 10px; + margin-left: 8px; + } + + :host([filled]) .google-search-clear-btn { + display: flex; + } + + * > ::slotted([slot='suffix']), + * > ::slotted([slot='clear-btn']) { + font: inherit; + margin: 0; + border: 0; + outline: 0; + padding: 0; + color: inherit; + background-color: transparent; + text-align: left; + white-space: normal; + overflow: visible; + + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + -webkit-tap-highlight-color: transparent; + + width: 25px; + height: 25px; + cursor: pointer; + } + + * > ::slotted([slot='suffix']) { + margin-right: 20px; + } + + * > ::slotted([slot='prefix']) { + height: 20px; + width: 20px; + margin-left: 12px; + margin-right: 16px; + } + + /* ============================= + block | .google-search-btns + ============================ */ + + .google-search-btns { + display: flex; + justify-content: center; + align-items: center; + } + + .google-search-btns__input-button { + background-image: -webkit-linear-gradient(top, #f8f9fa, #f8f9fa); + background-color: #f8f9fa; + border: 1px solid #f8f9fa; + border-radius: 4px; + color: #3c4043; + font-family: arial, sans-serif; + font-size: 14px; + margin: 11px 4px; + padding: 0 16px; + line-height: 27px; + height: 36px; + min-width: 54px; + text-align: center; + cursor: pointer; + user-select: none; + } + + .google-search-btns__input-button:hover { + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + background-image: -webkit-linear-gradient(top, #f8f8f8, #f1f1f1); + background-color: #f8f8f8; + border: 1px solid #c6c6c6; + color: #222; + } + + .google-search-btns__input-button:focus { + border: 1px solid #4d90fe; + outline: none; + } + + /* =============================== + block | .google-search-report + ============================== */ + + .google-search-report { + display: flex; + align-content: right; + color: #70757a; + font-style: italic; + font-size: 8pt; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + margin-bottom: 8px; + justify-content: flex-end; + margin-right: 20px; + } + + .google-search-report a { + color: inherit; + } + `, + ]; + } + + /** + * @enhance LionCombobox - add google search buttons + */ + _overlayListboxTemplate() { + return html` +
+ + `; + } + + /** + * @enhance FormControlMixin add clear-btn + */ + _inputGroupSuffixTemplate() { + return html` +
+
+ +
+ +
+ `; + } + + _googleSearchBtnsTemplate() { + return html`
+ + +
`; + } + + /** + * @enhance FormControlMixin - add google search buttons + */ + _groupTwoTemplate() { + return html`${super._groupTwoTemplate()} ${!this.opened ? this._googleSearchBtnsTemplate() : ''} `; + } + + get slots() { + return { + ...super.slots, + label: () => renderLitAsNode(html` Google Search`), + prefix: () => renderLitAsNode(html` ${googleSearchIcon} `), + suffix: () => + renderLitAsNode( + html` `, + ), + 'clear-btn': () => + renderLitAsNode( + html` + + `, + ), + }; + } + + /** + * @configure OverlayMixin + */ + get _overlayReferenceNode() { + return /** @type {ShadowRoot} */ (this.shadowRoot).querySelector('.input-group'); + } + + constructor() { + super(); + /** @configure LionCombobox */ + this.autocomplete = 'list'; + /** @configure LionCombobox */ + this.showAllOnEmpty = true; + + this.__resetFocus = this.__resetFocus.bind(this); + this.__clearText = this.__clearText.bind(this); + } + + firstUpdated(changedProperties) { + super.firstUpdated(changedProperties); + + this._overlayContentNode.addEventListener('mouseenter', this.__resetFocus); + } + + /** + * @override LionCombobox - always sync textbox when selected value changes + */ + // eslint-disable-next-line no-unused-vars + _syncToTextboxCondition() { + return true; + } + + _showOverlayCondition(options) { + return this.focused || super._showOverlayCondition(options); + } + + __resetFocus() { + this.activeIndex = -1; + this.checkedIndex = -1; + } + + __clearText() { + this._inputNode.value = ''; + } +} +customElements.define('google-combobox', GoogleCombobox); diff --git a/packages/ui/docs/components/combobox/src/lazyRender.js b/packages/ui/docs/components/combobox/src/lazyRender.js new file mode 100644 index 000000000..8404ab4f0 --- /dev/null +++ b/packages/ui/docs/components/combobox/src/lazyRender.js @@ -0,0 +1,29 @@ +import { directive } from 'lit/directive.js'; +import { AsyncDirective } from 'lit/async-directive.js'; + +/** + * In order to speed up the first meaningful paint, use this directive + * on content that is: + * - (visually) hidden + * - out of the page flow (having position: 'absolute|fixed') + * + * A good practice would be to use it in overlays, + * For hidden tab panels, collapsible content etc. it's also useful + * @example + * + * ${lazyRender( + * largeListOfData.map(entry => html` ${entry} `), + * )} + * + */ +export const lazyRender = directive( + class extends AsyncDirective { + render(tplResult) { + setTimeout(() => { + this.setValue(tplResult); + }); + } + }, +); + +// export const lazyRender = () => {}; diff --git a/packages/ui/docs/components/combobox/src/levenshtein.js b/packages/ui/docs/components/combobox/src/levenshtein.js new file mode 100644 index 000000000..faae33d28 --- /dev/null +++ b/packages/ui/docs/components/combobox/src/levenshtein.js @@ -0,0 +1,95 @@ +/* eslint-disable */ +// https://github.com/gustf/js-levenshtein/blob/master/index.js + +function _min(d0, d1, d2, bx, ay) { + return d0 < d1 || d2 < d1 ? (d0 > d2 ? d2 + 1 : d0 + 1) : bx === ay ? d1 : d1 + 1; +} + +export default function (a, b) { + if (a === b) { + return 0; + } + + if (a.length > b.length) { + var tmp = a; + a = b; + b = tmp; + } + + var la = a.length; + var lb = b.length; + + while (la > 0 && a.charCodeAt(la - 1) === b.charCodeAt(lb - 1)) { + la--; + lb--; + } + + var offset = 0; + + while (offset < la && a.charCodeAt(offset) === b.charCodeAt(offset)) { + offset++; + } + + la -= offset; + lb -= offset; + + if (la === 0 || lb < 3) { + return lb; + } + + var x = 0; + var y; + var d0; + var d1; + var d2; + var d3; + var dd; + var dy; + var ay; + var bx0; + var bx1; + var bx2; + var bx3; + + var vector = []; + + for (y = 0; y < la; y++) { + vector.push(y + 1); + vector.push(a.charCodeAt(offset + y)); + } + + var len = vector.length - 1; + + for (; x < lb - 3; ) { + bx0 = b.charCodeAt(offset + (d0 = x)); + bx1 = b.charCodeAt(offset + (d1 = x + 1)); + bx2 = b.charCodeAt(offset + (d2 = x + 2)); + bx3 = b.charCodeAt(offset + (d3 = x + 3)); + dd = x += 4; + for (y = 0; y < len; y += 2) { + dy = vector[y]; + ay = vector[y + 1]; + d0 = _min(dy, d0, d1, bx0, ay); + d1 = _min(d0, d1, d2, bx1, ay); + d2 = _min(d1, d2, d3, bx2, ay); + dd = _min(d2, d3, dd, bx3, ay); + vector[y] = dd; + d3 = d2; + d2 = d1; + d1 = d0; + d0 = dy; + } + } + + for (; x < lb; ) { + bx0 = b.charCodeAt(offset + (d0 = x)); + dd = ++x; + for (y = 0; y < len; y += 2) { + dy = vector[y]; + vector[y] = dd = _min(dy, d0, dd, bx0, vector[y + 1]); + d0 = dy; + } + } + + return dd; +} diff --git a/packages/ui/docs/components/combobox/src/md-combobox/MdFieldMixin.js b/packages/ui/docs/components/combobox/src/md-combobox/MdFieldMixin.js new file mode 100644 index 000000000..1c813f9c9 --- /dev/null +++ b/packages/ui/docs/components/combobox/src/md-combobox/MdFieldMixin.js @@ -0,0 +1,341 @@ +import { html, css } from 'lit'; +import { dedupeMixin } from '@open-wc/dedupe-mixin'; + +export const MdFieldMixin = dedupeMixin( + superclass => + class extends superclass { + static get styles() { + return [ + ...super.styles, + css` + /** @configure FormControlMixin */ + + /* ======================= + block | .form-field + ======================= */ + + :host { + position: relative; + font-family: 'Roboto', sans-serif; + padding-top: 16px; + } + + /* ========================== + element | .form-field__label + ========================== */ + + .form-field__label ::slotted(label) { + display: block; + color: var(--text-color, #545454); + font-size: 1rem; + line-height: 1.5rem; + } + + :host([disabled]) .form-field__label ::slotted(label) { + color: var(--disabled-text-color, lightgray); + } + + .form-field__label { + position: absolute; + top: 4px; + left: 0; + font: inherit; + pointer-events: none; + width: 100%; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + transform: perspective(100px); + -ms-transform: none; + transform-origin: 0 0; + transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), + color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), + width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); + /* z-index: 1; */ + } + + :host([focused]) .form-field__label, + :host([filled]) .form-field__label { + transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); + width: 133.333333333333333333%; + } + + :host([focused]) .form-field__label { + color: var(--color-primary, royalblue); + } + + /* ============================== + element | .form-field__help-text + ============================== */ + + .form-field__help-text { + visibility: hidden; + margin-top: 8px; + position: relative; + font-size: 0.8em; + display: block; + } + + :host([disabled]) .form-field__help-text ::slotted(*) { + color: var(--disabled-text-color, lightgray); + } + + :host([focused]) .form-field__help-text { + visibility: visible; + } + + :host([shows-feedback-for~='error']) .form-field__help-text { + display: none; + } + + /* ============================== + element | .form-field__feedback + ============================== */ + + .form-field__feedback { + margin-top: 8px; + position: relative; + font-size: 0.8em; + display: block; + } + + :host([shows-feedback-for~='error']) .form-field__feedback { + color: var(--color-error, red); + } + + /* ============================== + element | .input-group + ============================== */ + + .input-group { + display: flex; + } + + /* ============================== + element | .input-group__container + ============================== */ + + .input-group__container { + position: relative; + display: flex; + flex-wrap: wrap; + align-items: stretch; + width: 100%; + } + + /* ============================== + element | .input-group__input + ============================== */ + + .input-group__input { + display: flex; + flex: 1; + position: relative; + } + + /* ============================== + element | [slot="input"] + ============================== */ + + * > ::slotted([slot='input']) { + display: block; + box-sizing: border-box; + flex: 1 1 auto; + width: 1%; + padding: 0.5rem 0; + outline: none; + border: none; + color: var(--primary-text-color, #333333); + background: transparent; + background-clip: padding-box; + font-size: 100%; + } + + :host([disabled]) + .input-group__container + > .input-group__input + ::slotted([slot='input']) { + color: var(--disabled-text-color, lightgray); + } + + /* ============================== + element | .input-group__prefix, + element | .input-group__suffix + ============================== */ + + .input-group__prefix, + .input-group__suffix { + display: flex; + } + + .input-group__prefix ::slotted(*), + .input-group__suffix ::slotted(*) { + align-self: center; + text-align: center; + padding: 0.375rem 0.75rem; + line-height: 1.5; + display: flex; + white-space: nowrap; + margin-bottom: 0; + } + + .input-group__container > .input-group__prefix ::slotted(button), + .input-group__container > .input-group__suffix ::slotted(button) { + height: 100%; + border: none; + background: transparent; + + position: relative; + overflow: hidden; + transform: translate3d(0, 0, 0); + } + + .input-group__container > .input-group__prefix ::slotted(button)::after, + .input-group__container > .input-group__suffix ::slotted(button)::after { + content: ''; + display: block; + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + pointer-events: none; + background-image: radial-gradient(circle, #000 10%, transparent 10.01%); + background-repeat: no-repeat; + background-position: 50%; + transform: scale(10, 10); + opacity: 0; + transition: transform 0.25s, opacity 0.5s; + } + + .input-group__container > .input-group__prefix ::slotted(button:active)::after, + .input-group__container > .input-group__suffix ::slotted(button:active)::after { + transform: scale(0, 0); + opacity: 0.2; + transition: 0s; + } + + /* ==== state | :focus ==== */ + + /* ============================== + element | .input-group__before, + element | .input-group__after + ============================== */ + + .input-group__before, + .input-group__after { + display: flex; + } + + .input-group__before ::slotted(*), + .input-group__after ::slotted(*) { + align-self: center; + text-align: center; + padding: 0.375rem 0.75rem; + line-height: 1.5; + } + + .input-group__before ::slotted(*) { + padding-left: 0; + } + + .input-group__after ::slotted(*) { + padding-right: 0; + } + + /** @enhance FormControlMixin */ + + /* ============================== + element | .md-input__underline + ============================== */ + + .md-input__underline { + position: absolute; + height: 1px; + width: 100%; + background-color: rgba(0, 0, 0, 0.42); + bottom: 0; + } + + :host([disabled]) .md-input__underline { + border-top: 1px var(--disabled-text-color, lightgray) dashed; + background-color: transparent; + } + + :host([shows-feedback-for~='error']) .md-input__underline { + background-color: var(--color-error, red); + } + + /* ============================== + element | .md-input__underline-ripple + ============================== */ + + .md-input__underline-ripple { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 2px; + transform-origin: 50%; + transform: scaleX(0.5); + visibility: hidden; + opacity: 0; + transition: background-color 0.3s cubic-bezier(0.55, 0, 0.55, 0.2); + background-color: var(--color-primary, royalblue); + } + + :host([focused]) .md-input__underline-ripple { + visibility: visible; + opacity: 1; + transform: scaleX(1); + transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), + opacity 0.1s cubic-bezier(0.25, 0.8, 0.25, 1), + background-color 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); + } + + :host([shows-feedback-for~='error']) .md-input__underline-ripple { + background-color: var(--color-error, red); + } + `, + ]; + } + + /** + * @override FormControlMixin + */ + _groupOneTemplate() { + return html``; + } + + /** + * @override FormControlMixin + */ + _inputGroupInputTemplate() { + return html` +
+ ${this._labelTemplate()} + +
+ `; + } + + /** + * @enhance FormControlMixin + */ + _inputGroupTemplate() { + return html` +
+ ${this._inputGroupBeforeTemplate()} +
+ ${this._inputGroupPrefixTemplate()} ${this._inputGroupInputTemplate()} + ${this._inputGroupSuffixTemplate()} +
+ +
+
+ ${this._inputGroupAfterTemplate()} +
+ `; + } + }, +); diff --git a/packages/ui/docs/components/combobox/src/md-combobox/md-combobox.js b/packages/ui/docs/components/combobox/src/md-combobox/md-combobox.js new file mode 100644 index 000000000..81250a5dd --- /dev/null +++ b/packages/ui/docs/components/combobox/src/md-combobox/md-combobox.js @@ -0,0 +1,89 @@ +import { css, html } from 'lit'; +import { LionOption } from '@lion/ui/listbox.js'; +import { LionCombobox } from '@lion/ui/combobox.js'; +import { MdFieldMixin } from './MdFieldMixin.js'; +import './style/md-ripple.js'; +import './style/load-roboto.js'; + +// TODO: insert ink wc here +export class MdOption extends LionOption { + static get styles() { + return [ + ...super.styles, + css` + :host { + position: relative; + padding: 8px; + } + + :host([focused]) { + background: lightgray; + } + + :host([active]) { + color: #1867c0 !important; + caret-color: #1867c0 !important; + } + + :host ::slotted(.md-highlight) { + color: rgba(0, 0, 0, 0.38); + background: #eee; + } + `, + ]; + } + + /** + * @override + * @param {string} matchingString + */ + onFilterMatch(matchingString) { + const { innerHTML } = this; + this.__originalInnerHTML = innerHTML; + this.innerHTML = innerHTML.replace( + new RegExp(`(${matchingString})`, 'i'), + `$1`, + ); + this.style.display = ''; + } + + /** + * @override + */ + onFilterUnmatch() { + if (this.__originalInnerHTML) { + this.innerHTML = this.__originalInnerHTML; + } + this.style.display = 'none'; + } + + render() { + return html` + ${super.render()} + + `; + } +} +customElements.define('md-option', MdOption); + +export class MdCombobox extends MdFieldMixin(LionCombobox) { + static get styles() { + return [ + ...super.styles, + css` + .input-group__container { + display: flex; + border-bottom: none; + } + + * > ::slotted([role='listbox']) { + box-shadow: 0 4px 6px 0 rgba(32, 33, 36, 0.28); + padding-top: 8px; + padding-bottom: 8px; + top: 2px; + } + `, + ]; + } +} +customElements.define('md-combobox', MdCombobox); diff --git a/packages/ui/docs/components/combobox/src/md-combobox/md-input.js b/packages/ui/docs/components/combobox/src/md-combobox/md-input.js new file mode 100644 index 000000000..11e7648ec --- /dev/null +++ b/packages/ui/docs/components/combobox/src/md-combobox/md-input.js @@ -0,0 +1,5 @@ +import { LionInput } from '@lion/ui/input.js'; +import { MdFieldMixin } from './MdFieldMixin.js'; + +export class MdInput extends MdFieldMixin(LionInput) {} +customElements.define('md-input', MdInput); diff --git a/packages/ui/docs/components/combobox/src/md-combobox/style/load-roboto.js b/packages/ui/docs/components/combobox/src/md-combobox/style/load-roboto.js new file mode 100644 index 000000000..182c1aaf4 --- /dev/null +++ b/packages/ui/docs/components/combobox/src/md-combobox/style/load-roboto.js @@ -0,0 +1,6 @@ +// We don't have access to our main index html, so let's add Roboto font like this +const linkNode = document.createElement('link'); +linkNode.href = 'https://fonts.googleapis.com/css?family=Roboto:300,400,500'; +linkNode.rel = 'stylesheet'; +linkNode.type = 'text/css'; +document.head.appendChild(linkNode); diff --git a/packages/ui/docs/components/combobox/src/md-combobox/style/md-ripple.js b/packages/ui/docs/components/combobox/src/md-combobox/style/md-ripple.js new file mode 100644 index 000000000..ea98f6ef0 --- /dev/null +++ b/packages/ui/docs/components/combobox/src/md-combobox/style/md-ripple.js @@ -0,0 +1,81 @@ +import { html, css, LitElement } from 'lit'; + +/** + * Material Design Ripple Element + * + * - should be placed in a 'positioned' context (having positon: (realtive/fixed/absolute)) + */ +class MdRipple extends LitElement { + static get styles() { + return [ + css` + :host { + overflow: hidden; + transition: 0.1s ease-in; + user-select: none; + display: block; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + } + + :host:hover { + cursor: pointer; + } + + #ripple { + background-color: rgba(0, 0, 0, 0.1); + border-radius: 100%; + position: relative; + transform: scale(0); + } + + .animate { + animation: ripple 0.4s linear; + } + + @keyframes ripple { + 100% { + transform: scale(12); + background-color: transparent; + } + } + `, + ]; + } + + render() { + return html`
`; + } + + firstUpdated(c) { + super.firstUpdated(c); + this._ripple = this.shadowRoot.querySelector('#ripple'); + this._ripple.style.cssText = `width: ${this.offsetHeight}px; height: ${this.offsetHeight}px;`; + this.__onRipple = this.__onRipple.bind(this); + this.addEventListener('mousedown', this.__onRipple); + } + + disconnectedCallback() { + this.removeEventListener('mousedown', this.__onRipple); + } + + __onRipple(e) { + this._ripple.classList.remove('animate'); + const rect = this.getBoundingClientRect(); + const offset = { + top: rect.top + document.body.scrollTop, + left: rect.left + document.body.scrollLeft, + }; + this._ripple.style.left = `${ + parseInt(e.pageX - offset.left, 10) - this._ripple.offsetWidth / 2 + }px`; + this._ripple.style.top = `${ + parseInt(e.pageY - offset.top, 10) - this._ripple.offsetHeight / 2 + }px`; + this._ripple.classList.add('animate'); + } +} +customElements.define('md-ripple', MdRipple); diff --git a/packages/ui/docs/components/combobox/src/wa-combobox/wa-combobox.js b/packages/ui/docs/components/combobox/src/wa-combobox/wa-combobox.js new file mode 100644 index 000000000..5c5ff4383 --- /dev/null +++ b/packages/ui/docs/components/combobox/src/wa-combobox/wa-combobox.js @@ -0,0 +1,368 @@ +import { html, css } from 'lit'; +import { renderLitAsNode } from '@lion/ui/helpers.js'; +import { LionOption } from '@lion/ui/listbox.js'; +import { LionCombobox } from '@lion/ui/combobox.js'; + +class WaOption extends LionOption { + static get properties() { + return { + title: String, + text: String, + time: String, + image: String, + isUserText: { attribute: 'is-user-text', reflect: true, type: Boolean }, + isUserTextRead: { attribute: 'is-user-text-read', reflect: true, type: Boolean }, + }; + } + + static get styles() { + return [ + ...super.styles, + css` + :host { + --background-default: white; + --background-default-active: gray; + --secondary: #777; + --secondary-lighter: #aaa; + --chatlist-icon: #aaa; + background-color: var(--background-default); + cursor: pointer; + color: rgb(74, 74, 74); + padding: 0; + transition: max-height 0.4s ease, opacity 0.3s ease; + max-height: 500px; + } + + :host([checked]) { + background-color: #eee; + } + + :host(:hover) { + background-color: #f6f6f6; + } + + .wa-option { + position: relative; + display: flex; + flex-direction: row; + height: 72px; + pointer-events: all; + } + + .wa-option__image { + display: flex; + flex: none; + align-items: center; + margin-top: -1px; + padding: 0 15px 0 13px; + } + + .wa-option__image-inner { + position: relative; + overflow: hidden; + background-color: var(--avatar-background); + border-radius: 50%; + height: 49px; + width: 49px; + } + + .wa-option__image-inner img, + .wa-option__image-inner svg { + width: 100%; + height: 100%; + } + + .wa-option__image-inner-inner { + position: absolute; + top: 0; + z-index: 1; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + } + + .wa-option__content { + display: flex; + flex-basis: auto; + flex-direction: column; + flex-grow: 1; + justify-content: center; + min-width: 0; + border-bottom: 1px solid #eee; + padding-right: 15px; + } + + .wa-option__content-row1 { + display: flex; + align-items: center; + line-height: normal; + text-align: left; + } + + .wa-option__content-row1-title { + display: flex; + flex-grow: 1; + overflow: hidden; + color: var(--primary-strong); + font-weight: 400; + font-size: 17px; + line-height: 21px; + } + + .wa-option__content-row1-time { + line-height: 14px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin-left: 6px; + margin-top: 3px; + + flex: none; + max-width: 100%; + color: var(--secondary-lighter); + font-size: 12px; + line-height: 20px; + } + + .wa-option__content-row2 { + display: flex; + align-items: center; + min-height: 20px; + color: var(--secondary); + font-size: 13px; + line-height: 20px; + margin-top: 2px; + /* color: var(--secondary-stronger); */ + } + + .wa-option__content-row2-text { + flex-grow: 1; + overflow: hidden; + font-weight: 400; + font-size: 14px; + line-height: 20px; + white-space: nowrap; + text-overflow: ellipsis; + } + + .wa-option__content-row2-text-inner { + display: flex; + align-items: flex-start; + } + + .wa-option__content-row2-text-inner-icon { + display: none; + flex: none; + color: var(--chatlist-icon); + vertical-align: top; + margin-right: 2px; + } + + :host([is-user-text]) .wa-option__content-row2-text-inner-icon { + display: inline-block; + } + + :host([is-user-text-read]) .wa-option__content-row2-text-inner-icon { + color: lightblue; + } + /* + .wa-option__content-row2-menu { + } */ + `, + ]; + } + + render() { + return html``; + } + + /** + * @configure LionCombobox + * @param {string} matchingString + */ + onFilterMatch(matchingString) { + this.__originalTitle = this.title; + const newInnerHTML = this.title.replace(new RegExp(`(${matchingString})`, 'i'), `$1`); + const helperNode = document.createElement('div'); + // For Safari, we need to add a label to the element + helperNode.innerHTML = `${newInnerHTML}`; + [this.title] = helperNode.children; + this.style.cssText = ` + max-height: 500px; + opacity: 1; + `; + } + + /** + * @configure LionCombobox + * @param {string} [curValue] + * @param {string} [prevValue] + */ + // eslint-disable-next-line no-unused-vars + onFilterUnmatch() { + if (this.__originalTitle) { + this.title = this.__originalTitle; + } + this.style.cssText = ` + max-height: 0; + opacity: 0; + `; + } +} +customElements.define('wa-option', WaOption); + +class WaCombobox extends LionCombobox { + static get styles() { + return [ + ...super.styles, + css` + :host { + font-family: SF Pro Text, SF Pro Icons, system, -apple-system, system-ui, + BlinkMacSystemFont, Helvetica Neue, Helvetica, Lucida Grande, Kohinoor Devanagari, + sans-serif; + } + + .input-group__container { + display: flex; + border-bottom: none; + } + + * > ::slotted([role='listbox']) { + max-height: none; + } + + * > ::slotted([slot='input']) { + font-size: 14px; + } + + .input-group { + padding: 15px; + background: #f6f6f6; + } + + .input-group__prefix { + margin-right: 20px; + color: #999; + display: flex; + } + + .input-group__container { + border-radius: 18px; + background: white; + padding: 7px; + padding-left: 16px; + } + + /** Undo Popper */ + #overlay-content-node-wrapper { + position: static !important; + width: auto !important; + transform: none !important; + + /* height: 300px; + overflow: scroll; */ + } + `, + ]; + } + + get slots() { + return { + ...super.slots, + prefix: () => + renderLitAsNode( + html` + + `, + ), + }; + } + + constructor() { + super(); + + /** @configure OverlayMixin */ + this.opened = true; + /** @configure LionCombobox */ + this.showAllOnEmpty = true; + /** @configure LionCombobox */ + this.rotateKeyboardNavigation = false; + } +} +customElements.define('wa-combobox', WaCombobox); diff --git a/packages/ui/docs/components/combobox/use-cases.md b/packages/ui/docs/components/combobox/use-cases.md new file mode 100644 index 000000000..238555e99 --- /dev/null +++ b/packages/ui/docs/components/combobox/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/combobox/use-cases.md) diff --git a/packages/ui/docs/components/dialog/index.md b/packages/ui/docs/components/dialog/index.md new file mode 100644 index 000000000..c2c51ff0c --- /dev/null +++ b/packages/ui/docs/components/dialog/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/dialog/index.md) diff --git a/packages/ui/docs/components/dialog/overview.md b/packages/ui/docs/components/dialog/overview.md new file mode 100644 index 000000000..97b95480e --- /dev/null +++ b/packages/ui/docs/components/dialog/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/dialog/overview.md) diff --git a/packages/ui/docs/components/dialog/src/demo-dialog-style.js b/packages/ui/docs/components/dialog/src/demo-dialog-style.js new file mode 100644 index 000000000..33b081365 --- /dev/null +++ b/packages/ui/docs/components/dialog/src/demo-dialog-style.js @@ -0,0 +1,3 @@ +import { css } from 'lit'; + +export default css``; diff --git a/packages/ui/docs/components/dialog/src/demoStyle.js b/packages/ui/docs/components/dialog/src/demoStyle.js new file mode 100644 index 000000000..0be789d4d --- /dev/null +++ b/packages/ui/docs/components/dialog/src/demoStyle.js @@ -0,0 +1,39 @@ +import { css } from 'lit'; + +export const demoStyle = css` + .demo-box { + width: 200px; + background-color: white; + border-radius: 2px; + border: 1px solid grey; + padding: 8px; + } + .demo-box_placements { + display: flex; + flex-direction: column; + margin-top: 20px; + } + lion-dialog { + display: block; + padding: 10px; + margin-bottom: 10px; + } + .close-button { + color: black; + font-size: 28px; + line-height: 28px; + } + .demo-box__column { + display: flex; + flex-direction: column; + } + .demo-dialog--content { + display: block; + position: absolute; + font-size: 16px; + color: white; + background-color: black; + border-radius: 4px; + padding: 8px; + } +`; diff --git a/packages/ui/docs/components/dialog/src/slots-dialog-content.js b/packages/ui/docs/components/dialog/src/slots-dialog-content.js new file mode 100644 index 000000000..6b481427d --- /dev/null +++ b/packages/ui/docs/components/dialog/src/slots-dialog-content.js @@ -0,0 +1,32 @@ +import { LitElement, html, css } from 'lit'; + +class SlotsDialogContent extends LitElement { + static get styles() { + return [ + css` + :host { + background-color: #fff; + } + .actions { + border-top: 2px solid green; + } + `, + ]; + } + + _closeOverlay() { + this.dispatchEvent(new Event('close-overlay', { bubbles: true })); + } + + render() { + return html` +

This content contains an actions slot

+
+ +
+ + `; + } +} + +customElements.define('slots-dialog-content', SlotsDialogContent); diff --git a/packages/ui/docs/components/dialog/src/styled-dialog-content.js b/packages/ui/docs/components/dialog/src/styled-dialog-content.js new file mode 100644 index 000000000..799dae2e8 --- /dev/null +++ b/packages/ui/docs/components/dialog/src/styled-dialog-content.js @@ -0,0 +1,38 @@ +import { LitElement, html, css } from 'lit'; + +class StyledDialogContent extends LitElement { + static get styles() { + return [ + css` + :host { + background-color: #fff; + } + .nice { + font-weight: bold; + color: green; + } + .close-button { + color: black; + font-size: 28px; + line-height: 28px; + } + `, + ]; + } + + _closeOverlay() { + this.dispatchEvent(new Event('close-overlay', { bubbles: true })); + } + + render() { + return html` +

Hello person who opened the dialog!

+
+

Look how nice this dialog looks!

+
+ + `; + } +} + +customElements.define('styled-dialog-content', StyledDialogContent); diff --git a/packages/ui/docs/components/dialog/use-cases.md b/packages/ui/docs/components/dialog/use-cases.md new file mode 100644 index 000000000..f295536ca --- /dev/null +++ b/packages/ui/docs/components/dialog/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/dialog/use-cases.md) diff --git a/packages/ui/docs/components/drawer/index.md b/packages/ui/docs/components/drawer/index.md new file mode 100644 index 000000000..27ad39193 --- /dev/null +++ b/packages/ui/docs/components/drawer/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/drawer/index.md) diff --git a/packages/ui/docs/components/drawer/overview.md b/packages/ui/docs/components/drawer/overview.md new file mode 100644 index 000000000..07d4b8c97 --- /dev/null +++ b/packages/ui/docs/components/drawer/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/drawer/overview.md) diff --git a/packages/ui/docs/components/drawer/src/demoStyle.js b/packages/ui/docs/components/drawer/src/demoStyle.js new file mode 100644 index 000000000..763a89c60 --- /dev/null +++ b/packages/ui/docs/components/drawer/src/demoStyle.js @@ -0,0 +1,71 @@ +import { css } from 'lit'; + +export const demoStyle = css` + .demo-container { + height: 400px; + display: flex; + flex-direction: row; + } + + .demo-container > div { + padding: 8px; + background-color: #f6f8fa; + } + + lion-drawer { + height: 400px; + } + + button { + all: revert !important; + border: 2px solid #000000; + background-color: rgb(239, 239, 239); + } + + .demo-container-top { + height: 400px; + display: flex; + flex-direction: column; + } + + .demo-container-top > div { + padding: 8px; + height: 100%; + background-color: #f6f8fa; + } + + .demo-container-top lion-drawer { + height: auto; + width: 100%; + } + + .demo-container-right { + height: 400px; + display: flex; + flex-direction: row-reverse; + } + + .demo-container-right > div { + padding: 8px; + background-color: #f6f8fa; + } + + .demo-container-right lion-drawer { + height: 400px; + } + + .demo-container-opened { + height: 400px; + display: flex; + flex-direction: row; + } + + .demo-container-opened > div { + padding: 8px; + background-color: #f6f8fa; + } + + .demo-container-opened lion-drawer { + height: 400px; + } +`; diff --git a/packages/ui/docs/components/drawer/use-cases.md b/packages/ui/docs/components/drawer/use-cases.md new file mode 100644 index 000000000..8a01ab3d2 --- /dev/null +++ b/packages/ui/docs/components/drawer/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/drawer/use-cases.md) diff --git a/packages/ui/docs/components/fieldset/index.md b/packages/ui/docs/components/fieldset/index.md new file mode 100644 index 000000000..ecb2013fe --- /dev/null +++ b/packages/ui/docs/components/fieldset/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/fieldset/index.md) diff --git a/packages/ui/docs/components/fieldset/overview.md b/packages/ui/docs/components/fieldset/overview.md new file mode 100644 index 000000000..180587cbf --- /dev/null +++ b/packages/ui/docs/components/fieldset/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/fieldset/overview.md) diff --git a/packages/ui/docs/components/fieldset/use-cases.md b/packages/ui/docs/components/fieldset/use-cases.md new file mode 100644 index 000000000..4453a315c --- /dev/null +++ b/packages/ui/docs/components/fieldset/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/fieldset/use-cases.md) diff --git a/packages/ui/docs/components/form/index.md b/packages/ui/docs/components/form/index.md new file mode 100644 index 000000000..14c7f4b56 --- /dev/null +++ b/packages/ui/docs/components/form/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/form/index.md) diff --git a/packages/ui/docs/components/form/overview.md b/packages/ui/docs/components/form/overview.md new file mode 100644 index 000000000..01f7b6fbb --- /dev/null +++ b/packages/ui/docs/components/form/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/form/overview.md) diff --git a/packages/ui/docs/components/form/use-cases.md b/packages/ui/docs/components/form/use-cases.md new file mode 100644 index 000000000..f30634060 --- /dev/null +++ b/packages/ui/docs/components/form/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/form/use-cases.md) diff --git a/packages/ui/docs/components/icon/assets/bugs/bug01.svg.js b/packages/ui/docs/components/icon/assets/bugs/bug01.svg.js new file mode 100644 index 000000000..aea2228a4 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/bugs/bug01.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/bugs/bug02.svg.js b/packages/ui/docs/components/icon/assets/bugs/bug02.svg.js new file mode 100644 index 000000000..f69a54e44 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/bugs/bug02.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/bugs/bug05.svg.js b/packages/ui/docs/components/icon/assets/bugs/bug05.svg.js new file mode 100644 index 000000000..aa49c4c80 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/bugs/bug05.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/bugs/bug06.svg.js b/packages/ui/docs/components/icon/assets/bugs/bug06.svg.js new file mode 100644 index 000000000..5c59fcbbb --- /dev/null +++ b/packages/ui/docs/components/icon/assets/bugs/bug06.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/bugs/bug08.svg.js b/packages/ui/docs/components/icon/assets/bugs/bug08.svg.js new file mode 100644 index 000000000..3f29f4265 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/bugs/bug08.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/bugs/bug12.svg.js b/packages/ui/docs/components/icon/assets/bugs/bug12.svg.js new file mode 100644 index 000000000..80333cb62 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/bugs/bug12.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/bugs/bug19.svg.js b/packages/ui/docs/components/icon/assets/bugs/bug19.svg.js new file mode 100644 index 000000000..397d9f61a --- /dev/null +++ b/packages/ui/docs/components/icon/assets/bugs/bug19.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/bugs/bug23.svg.js b/packages/ui/docs/components/icon/assets/bugs/bug23.svg.js new file mode 100644 index 000000000..8db0542b8 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/bugs/bug23.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/bugs/bug24.svg.js b/packages/ui/docs/components/icon/assets/bugs/bug24.svg.js new file mode 100644 index 000000000..fe9cdeaa9 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/bugs/bug24.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/iconset-bugs.js b/packages/ui/docs/components/icon/assets/iconset-bugs.js new file mode 100755 index 000000000..b1314dec5 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/iconset-bugs.js @@ -0,0 +1,11 @@ +import bug01 from './bugs/bug01.svg.js'; +import bug02 from './bugs/bug02.svg.js'; +import bug05 from './bugs/bug05.svg.js'; +import bug06 from './bugs/bug06.svg.js'; +import bug08 from './bugs/bug08.svg.js'; +import bug12 from './bugs/bug12.svg.js'; +import bug19 from './bugs/bug19.svg.js'; +import bug23 from './bugs/bug23.svg.js'; +import bug24 from './bugs/bug24.svg.js'; + +export { bug01, bug02, bug05, bug06, bug08, bug12, bug19, bug23, bug24 }; diff --git a/packages/ui/docs/components/icon/assets/iconset-misc.js b/packages/ui/docs/components/icon/assets/iconset-misc.js new file mode 100644 index 000000000..7541a4a01 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/iconset-misc.js @@ -0,0 +1,3 @@ +import arrowLeft from './misc/arrowLeft.svg.js'; + +export { arrowLeft }; diff --git a/packages/ui/docs/components/icon/assets/iconset-space.js b/packages/ui/docs/components/icon/assets/iconset-space.js new file mode 100755 index 000000000..56b4a217b --- /dev/null +++ b/packages/ui/docs/components/icon/assets/iconset-space.js @@ -0,0 +1,31 @@ +import alienSpaceship from './space/aliens-spaceship.svg.js'; +import meteor from './space/meteor.svg.js'; +import moonFlag from './space/moon-flag.svg.js'; +import moon from './space/moon.svg.js'; +import night from './space/night.svg.js'; +import orbit from './space/orbit.svg.js'; +import planet from './space/planet.svg.js'; +import robot from './space/robot.svg.js'; +import rocket from './space/rocket.svg.js'; +import satellite from './space/satellite.svg.js'; +import signal from './space/signal.svg.js'; +import spaceHelmet from './space/space-helmet.svg.js'; +import sun from './space/sun.svg.js'; +import telescope from './space/telescope.svg.js'; + +export { + alienSpaceship, + meteor, + moonFlag, + moon, + night, + orbit, + planet, + robot, + rocket, + satellite, + signal, + spaceHelmet, + sun, + telescope, +}; diff --git a/packages/ui/docs/components/icon/assets/misc/arrowLeft.svg.js b/packages/ui/docs/components/icon/assets/misc/arrowLeft.svg.js new file mode 100644 index 000000000..d23823b45 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/misc/arrowLeft.svg.js @@ -0,0 +1,6 @@ +export default tag => + tag` + + + + `; diff --git a/packages/ui/docs/components/icon/assets/space/aliens-spaceship.svg.js b/packages/ui/docs/components/icon/assets/space/aliens-spaceship.svg.js new file mode 100644 index 000000000..9438a9317 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/aliens-spaceship.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/meteor.svg.js b/packages/ui/docs/components/icon/assets/space/meteor.svg.js new file mode 100644 index 000000000..197133816 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/meteor.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/moon-flag.svg.js b/packages/ui/docs/components/icon/assets/space/moon-flag.svg.js new file mode 100644 index 000000000..9283c4010 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/moon-flag.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/moon.svg.js b/packages/ui/docs/components/icon/assets/space/moon.svg.js new file mode 100644 index 000000000..dbfb92b1c --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/moon.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/night.svg.js b/packages/ui/docs/components/icon/assets/space/night.svg.js new file mode 100644 index 000000000..ba258dac1 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/night.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/orbit.svg.js b/packages/ui/docs/components/icon/assets/space/orbit.svg.js new file mode 100644 index 000000000..e3f26ebb0 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/orbit.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/planet.svg.js b/packages/ui/docs/components/icon/assets/space/planet.svg.js new file mode 100644 index 000000000..2d0283f43 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/planet.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/robot.svg.js b/packages/ui/docs/components/icon/assets/space/robot.svg.js new file mode 100644 index 000000000..73dd887fd --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/robot.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/rocket.svg.js b/packages/ui/docs/components/icon/assets/space/rocket.svg.js new file mode 100644 index 000000000..6d7a1fdc6 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/rocket.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/satellite.svg.js b/packages/ui/docs/components/icon/assets/space/satellite.svg.js new file mode 100644 index 000000000..363059924 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/satellite.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/signal.svg.js b/packages/ui/docs/components/icon/assets/space/signal.svg.js new file mode 100644 index 000000000..8613b0e1f --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/signal.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/space-helmet.svg.js b/packages/ui/docs/components/icon/assets/space/space-helmet.svg.js new file mode 100644 index 000000000..4b7b539ef --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/space-helmet.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/sun.svg.js b/packages/ui/docs/components/icon/assets/space/sun.svg.js new file mode 100644 index 000000000..11a341845 --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/sun.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/assets/space/telescope.svg.js b/packages/ui/docs/components/icon/assets/space/telescope.svg.js new file mode 100644 index 000000000..4fdffb02c --- /dev/null +++ b/packages/ui/docs/components/icon/assets/space/telescope.svg.js @@ -0,0 +1,2 @@ +export default tag => + tag``; diff --git a/packages/ui/docs/components/icon/index.md b/packages/ui/docs/components/icon/index.md new file mode 100644 index 000000000..9ad5a221b --- /dev/null +++ b/packages/ui/docs/components/icon/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/icon/index.md) diff --git a/packages/ui/docs/components/icon/overview.md b/packages/ui/docs/components/icon/overview.md new file mode 100644 index 000000000..985aac84f --- /dev/null +++ b/packages/ui/docs/components/icon/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/icon/overview.md) diff --git a/packages/ui/docs/components/icon/use-cases.md b/packages/ui/docs/components/icon/use-cases.md new file mode 100644 index 000000000..da1f5c94d --- /dev/null +++ b/packages/ui/docs/components/icon/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/icon/use-cases.md) diff --git a/packages/ui/docs/components/index.md b/packages/ui/docs/components/index.md new file mode 100644 index 000000000..a1875dad6 --- /dev/null +++ b/packages/ui/docs/components/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../docs/components/index.md) diff --git a/packages/ui/docs/components/input-amount/index.md b/packages/ui/docs/components/input-amount/index.md new file mode 100644 index 000000000..d7169e590 --- /dev/null +++ b/packages/ui/docs/components/input-amount/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-amount/index.md) diff --git a/packages/ui/docs/components/input-amount/overview.md b/packages/ui/docs/components/input-amount/overview.md new file mode 100644 index 000000000..61a60e843 --- /dev/null +++ b/packages/ui/docs/components/input-amount/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-amount/overview.md) diff --git a/packages/ui/docs/components/input-amount/use-cases.md b/packages/ui/docs/components/input-amount/use-cases.md new file mode 100644 index 000000000..dda15d2e8 --- /dev/null +++ b/packages/ui/docs/components/input-amount/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-amount/use-cases.md) diff --git a/packages/ui/docs/components/input-date/index.md b/packages/ui/docs/components/input-date/index.md new file mode 100644 index 000000000..dde5cb970 --- /dev/null +++ b/packages/ui/docs/components/input-date/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-date/index.md) diff --git a/packages/ui/docs/components/input-date/overview.md b/packages/ui/docs/components/input-date/overview.md new file mode 100644 index 000000000..78c5bc08d --- /dev/null +++ b/packages/ui/docs/components/input-date/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-date/overview.md) diff --git a/packages/ui/docs/components/input-date/use-cases.md b/packages/ui/docs/components/input-date/use-cases.md new file mode 100644 index 000000000..74ce9e7d4 --- /dev/null +++ b/packages/ui/docs/components/input-date/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-date/use-cases.md) diff --git a/packages/ui/docs/components/input-datepicker/index.md b/packages/ui/docs/components/input-datepicker/index.md new file mode 100644 index 000000000..4a2f5b64b --- /dev/null +++ b/packages/ui/docs/components/input-datepicker/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-datepicker/index.md) diff --git a/packages/ui/docs/components/input-datepicker/overview.md b/packages/ui/docs/components/input-datepicker/overview.md new file mode 100644 index 000000000..100c360b0 --- /dev/null +++ b/packages/ui/docs/components/input-datepicker/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-datepicker/overview.md) diff --git a/packages/ui/docs/components/input-datepicker/use-cases.md b/packages/ui/docs/components/input-datepicker/use-cases.md new file mode 100644 index 000000000..774e615a9 --- /dev/null +++ b/packages/ui/docs/components/input-datepicker/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-datepicker/use-cases.md) diff --git a/packages/ui/docs/components/input-email/index.md b/packages/ui/docs/components/input-email/index.md new file mode 100644 index 000000000..e458f8b25 --- /dev/null +++ b/packages/ui/docs/components/input-email/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-email/index.md) diff --git a/packages/ui/docs/components/input-email/overview.md b/packages/ui/docs/components/input-email/overview.md new file mode 100644 index 000000000..9ee862ee1 --- /dev/null +++ b/packages/ui/docs/components/input-email/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-email/overview.md) diff --git a/packages/ui/docs/components/input-email/use-cases.md b/packages/ui/docs/components/input-email/use-cases.md new file mode 100644 index 000000000..a1745df38 --- /dev/null +++ b/packages/ui/docs/components/input-email/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-email/use-cases.md) diff --git a/packages/ui/docs/components/input-iban/index.md b/packages/ui/docs/components/input-iban/index.md new file mode 100644 index 000000000..79f3cb63a --- /dev/null +++ b/packages/ui/docs/components/input-iban/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-iban/index.md) diff --git a/packages/ui/docs/components/input-iban/overview.md b/packages/ui/docs/components/input-iban/overview.md new file mode 100644 index 000000000..e39e8b7b0 --- /dev/null +++ b/packages/ui/docs/components/input-iban/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-iban/overview.md) diff --git a/packages/ui/docs/components/input-iban/use-cases.md b/packages/ui/docs/components/input-iban/use-cases.md new file mode 100644 index 000000000..550452761 --- /dev/null +++ b/packages/ui/docs/components/input-iban/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-iban/use-cases.md) diff --git a/packages/ui/docs/components/input-range/index.md b/packages/ui/docs/components/input-range/index.md new file mode 100644 index 000000000..d98da4230 --- /dev/null +++ b/packages/ui/docs/components/input-range/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-range/index.md) diff --git a/packages/ui/docs/components/input-range/overview.md b/packages/ui/docs/components/input-range/overview.md new file mode 100644 index 000000000..68faa1c3d --- /dev/null +++ b/packages/ui/docs/components/input-range/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-range/overview.md) diff --git a/packages/ui/docs/components/input-range/use-cases.md b/packages/ui/docs/components/input-range/use-cases.md new file mode 100644 index 000000000..23378fe4b --- /dev/null +++ b/packages/ui/docs/components/input-range/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-range/use-cases.md) diff --git a/packages/ui/docs/components/input-stepper/index.md b/packages/ui/docs/components/input-stepper/index.md new file mode 100644 index 000000000..0de447404 --- /dev/null +++ b/packages/ui/docs/components/input-stepper/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-stepper/index.md) diff --git a/packages/ui/docs/components/input-stepper/overview.md b/packages/ui/docs/components/input-stepper/overview.md new file mode 100644 index 000000000..7b7d03759 --- /dev/null +++ b/packages/ui/docs/components/input-stepper/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-stepper/overview.md) diff --git a/packages/ui/docs/components/input-stepper/use-cases.md b/packages/ui/docs/components/input-stepper/use-cases.md new file mode 100644 index 000000000..05e837bf1 --- /dev/null +++ b/packages/ui/docs/components/input-stepper/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-stepper/use-cases.md) diff --git a/packages/ui/docs/components/input-tel-dropdown/examples.md b/packages/ui/docs/components/input-tel-dropdown/examples.md new file mode 100644 index 000000000..fdaa33a5c --- /dev/null +++ b/packages/ui/docs/components/input-tel-dropdown/examples.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-tel-dropdown/examples.md) diff --git a/packages/ui/docs/components/input-tel-dropdown/index.md b/packages/ui/docs/components/input-tel-dropdown/index.md new file mode 100644 index 000000000..13fc56bab --- /dev/null +++ b/packages/ui/docs/components/input-tel-dropdown/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-tel-dropdown/index.md) diff --git a/packages/ui/docs/components/input-tel-dropdown/overview.md b/packages/ui/docs/components/input-tel-dropdown/overview.md new file mode 100644 index 000000000..b718ec4a4 --- /dev/null +++ b/packages/ui/docs/components/input-tel-dropdown/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-tel-dropdown/overview.md) diff --git a/packages/ui/docs/components/input-tel-dropdown/src/intl-input-tel-dropdown.js b/packages/ui/docs/components/input-tel-dropdown/src/intl-input-tel-dropdown.js new file mode 100644 index 000000000..771d7d8ac --- /dev/null +++ b/packages/ui/docs/components/input-tel-dropdown/src/intl-input-tel-dropdown.js @@ -0,0 +1,127 @@ +import { ScopedElementsMixin } from '@open-wc/scoped-elements'; +import { html, css } from 'lit'; +import { ref } from 'lit/directives/ref.js'; +import { repeat } from 'lit/directives/repeat.js'; +import { LionInputTelDropdown } from '@lion/ui/input-tel-dropdown.js'; +import { + IntlSelectRich, + IntlOption, + IntlSeparator, +} from '../../select-rich/src/intl-select-rich.js'; + +/** + * @typedef {import('@lion/ui/input-tel-dropdown/types.js').TemplateDataForDropdownInputTel}TemplateDataForDropdownInputTel + */ + +// Example implementation for https://intl-tel-input.com/ +export class IntlInputTelDropdown extends ScopedElementsMixin(LionInputTelDropdown) { + /** + * @configure LitElement + * @enhance LionInputTelDropdown + */ + static styles = [ + super.styles, + css` + :host, + ::slotted(*) { + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 1.42857143; + color: #333; + } + + :host { + max-width: 300px; + } + + .input-group__container { + width: 100%; + height: 34px; + font-size: 14px; + line-height: 1.42857143; + color: #555; + background-color: #fff; + background-image: none; + border: 1px solid #ccc; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%); + box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%); + -webkit-transition: border-color ease-in-out 0.15s, -webkit-box-shadow ease-in-out 0.15s; + -o-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; + transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; + } + + .input-group__input { + padding: 6px; + box-sizing: border-box; + } + + .input-group__input ::slotted(input) { + border: none; + outline: none; + } + + :host([focused]) .input-group__container { + border-color: #66afe9; + outline: 0; + -webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%), 0 0 8px rgb(102 175 233 / 60%); + box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%), 0 0 8px rgb(102 175 233 / 60%); + } + `, + ]; + + static templates = { + ...(super.templates || {}), + /** + * @param {TemplateDataForDropdownInputTel} templateDataForDropdown + */ + dropdown: templateDataForDropdown => { + const { refs, data } = templateDataForDropdown; + // TODO: once spread directive available, use it per ref (like ref(refs?.dropdown?.ref)) + return html` + + ${data?.regionMetaListPreferred?.length + ? html` ${repeat( + data.regionMetaListPreferred, + regionMeta => regionMeta.regionCode, + regionMeta => + html`${this.templates.dropdownOption(templateDataForDropdown, regionMeta)} `, + )}` + : ''} + ${repeat( + data.regionMetaList, + regionMeta => regionMeta.regionCode, + regionMeta => + html`${this.templates.dropdownOption(templateDataForDropdown, regionMeta)} `, + )} + + `; + }, + /** + * @param {TemplateDataForDropdownInputTel} templateDataForDropdown + * @param {RegionMeta} regionMeta + */ + // eslint-disable-next-line class-methods-use-this + dropdownOption: (templateDataForDropdown, regionMeta) => html` + + + `, + }; + + /** + * @configure ScopedElementsMixin + */ + static scopedElements = { + ...super.scopedElements, + 'intl-select-rich': IntlSelectRich, + 'intl-option': IntlOption, + 'intl-separator': IntlSeparator, + }; +} +customElements.define('intl-input-tel-dropdown', IntlInputTelDropdown); diff --git a/packages/ui/docs/components/input-tel-dropdown/use-cases.md b/packages/ui/docs/components/input-tel-dropdown/use-cases.md new file mode 100644 index 000000000..309cb6779 --- /dev/null +++ b/packages/ui/docs/components/input-tel-dropdown/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-tel-dropdown/use-cases.md) diff --git a/packages/ui/docs/components/input-tel/index.md b/packages/ui/docs/components/input-tel/index.md new file mode 100644 index 000000000..5d10504b0 --- /dev/null +++ b/packages/ui/docs/components/input-tel/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-tel/index.md) diff --git a/packages/ui/docs/components/input-tel/overview.md b/packages/ui/docs/components/input-tel/overview.md new file mode 100644 index 000000000..bda694694 --- /dev/null +++ b/packages/ui/docs/components/input-tel/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-tel/overview.md) diff --git a/packages/ui/docs/components/input-tel/src/h-region-code-table.js b/packages/ui/docs/components/input-tel/src/h-region-code-table.js new file mode 100644 index 000000000..bffe63d2e --- /dev/null +++ b/packages/ui/docs/components/input-tel/src/h-region-code-table.js @@ -0,0 +1,109 @@ +import { LitElement, css, html } from 'lit'; +import { repeat } from 'lit/directives/repeat.js'; +import { ScopedStylesController } from '@lion/ui/core.js'; +import { regionMetaList } from '../../select-rich/src/regionMetaList.js'; + +export class HRegionCodeTable extends LitElement { + static properties = { + regionMeta: Object, + }; + + constructor() { + super(); + /** @type {ScopedStylesController} */ + this.scopedStylesController = new ScopedStylesController(this); + } + + /** + * @param {CSSResult} scope + */ + static scopedStyles(scope) { + return css` + /* Custom input range styling comes here, be aware that this won't work for polyfilled browsers */ + .${scope} .sr-only { + position: absolute; + top: 0; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(100%); + clip: rect(1px, 1px, 1px, 1px); + white-space: nowrap; + border: 0; + margin: 0; + padding: 0; + } + + .${scope} table { + position: relative; + height: 300px; + } + + .${scope} th { + border-left: none; + border-right: none; + position: sticky; + top: -1px; + } + + .${scope} th .backdrop { + background-color: white; + opacity: 0.95; + filter: blur(4px); + position: absolute; + inset: -5px; + } + + .${scope} th .content { + position: relative; + } + + .${scope} td { + border-left: none; + border-right: none; + } + `; + } + + // Render to light dom, so global table styling will be applied + createRenderRoot() { + return this; + } + + render() { + const finalRegionMetaList = this.regionMetaList || regionMetaList; + return html` + + + + + + + + + + + ${repeat( + finalRegionMetaList, + regionMeta => regionMeta.regionCode, + ({ regionCode, countryCode, flagSymbol, nameForLocale }) => + html` + + + + `, + )} + +
+ Region codes +
+ country name + + region code + + country code +
${nameForLocale}${regionCode}${countryCode}
+ `; + } +} +customElements.define('h-region-code-table', HRegionCodeTable); diff --git a/packages/ui/docs/components/input-tel/use-cases.md b/packages/ui/docs/components/input-tel/use-cases.md new file mode 100644 index 000000000..74e1a3eec --- /dev/null +++ b/packages/ui/docs/components/input-tel/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input-tel/use-cases.md) diff --git a/packages/ui/docs/components/input/index.md b/packages/ui/docs/components/input/index.md new file mode 100644 index 000000000..f468563ba --- /dev/null +++ b/packages/ui/docs/components/input/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input/index.md) diff --git a/packages/ui/docs/components/input/overview.md b/packages/ui/docs/components/input/overview.md new file mode 100644 index 000000000..ae57c30e9 --- /dev/null +++ b/packages/ui/docs/components/input/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input/overview.md) diff --git a/packages/ui/docs/components/input/use-cases.md b/packages/ui/docs/components/input/use-cases.md new file mode 100644 index 000000000..f17d3c2f4 --- /dev/null +++ b/packages/ui/docs/components/input/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/input/use-cases.md) diff --git a/packages/ui/docs/components/listbox/index.md b/packages/ui/docs/components/listbox/index.md new file mode 100644 index 000000000..b201a6a71 --- /dev/null +++ b/packages/ui/docs/components/listbox/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/listbox/index.md) diff --git a/packages/ui/docs/components/listbox/overview.md b/packages/ui/docs/components/listbox/overview.md new file mode 100644 index 000000000..4991deda9 --- /dev/null +++ b/packages/ui/docs/components/listbox/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/listbox/overview.md) diff --git a/packages/ui/docs/components/listbox/src/listboxData.js b/packages/ui/docs/components/listbox/src/listboxData.js new file mode 100644 index 000000000..60f89ff59 --- /dev/null +++ b/packages/ui/docs/components/listbox/src/listboxData.js @@ -0,0 +1,65 @@ +export const listboxData = [ + 'Apple', + 'Artichoke', + 'Asparagus', + 'Banana', + 'Beets', + 'Bell pepper', + 'Broccoli', + 'Brussels sprout', + 'Cabbage', + 'Carrot', + 'Cauliflower', + 'Celery', + 'Chard', + 'Chicory', + 'Corn', + 'Cucumber', + 'Daikon', + 'Date', + 'Edamame', + 'Eggplant', + 'Elderberry', + 'Fennel', + 'Fig', + 'Garlic', + 'Grape', + 'Honeydew melon', + 'Iceberg lettuce', + 'Jerusalem artichoke', + 'Kale', + 'Kiwi', + 'Leek', + 'Lemon', + 'Mango', + 'Mangosteen', + 'Melon', + 'Mushroom', + 'Nectarine', + 'Okra', + 'Olive', + 'Onion', + 'Orange', + 'Parship', + 'Pea', + 'Pear', + 'Pineapple', + 'Potato', + 'Pumpkin', + 'Quince', + 'Radish', + 'Rhubarb', + 'Shallot', + 'Spinach', + 'Squash', + 'Strawberry', + 'Sweet potato', + 'Tomato', + 'Turnip', + 'Ugli fruit', + 'Victoria plum', + 'Watercress', + 'Watermelon', + 'Yam', + 'Zucchini', +]; diff --git a/packages/ui/docs/components/listbox/use-cases.md b/packages/ui/docs/components/listbox/use-cases.md new file mode 100644 index 000000000..2bec68ef6 --- /dev/null +++ b/packages/ui/docs/components/listbox/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/listbox/use-cases.md) diff --git a/packages/ui/docs/components/pagination/index.md b/packages/ui/docs/components/pagination/index.md new file mode 100644 index 000000000..0754f20a8 --- /dev/null +++ b/packages/ui/docs/components/pagination/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/pagination/index.md) diff --git a/packages/ui/docs/components/pagination/overview.md b/packages/ui/docs/components/pagination/overview.md new file mode 100644 index 000000000..31fb33457 --- /dev/null +++ b/packages/ui/docs/components/pagination/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/pagination/overview.md) diff --git a/packages/ui/docs/components/pagination/use-cases.md b/packages/ui/docs/components/pagination/use-cases.md new file mode 100644 index 000000000..c51207a81 --- /dev/null +++ b/packages/ui/docs/components/pagination/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/pagination/use-cases.md) diff --git a/packages/ui/docs/components/progress-indicator/assets/my-determinate-progress-bar.js b/packages/ui/docs/components/progress-indicator/assets/my-determinate-progress-bar.js new file mode 100644 index 000000000..01c7da840 --- /dev/null +++ b/packages/ui/docs/components/progress-indicator/assets/my-determinate-progress-bar.js @@ -0,0 +1,30 @@ +import { css, html } from 'lit'; +import { LionProgressIndicator } from '@lion/ui/progress-indicator.js'; + +export class MyDeterminateProgressBar extends LionProgressIndicator { + static get styles() { + return [ + css` + :host { + display: block; + position: relative; + width: 100%; + height: 6px; + overflow: hidden; + background-color: #eee; + } + + .progress__filled { + height: inherit; + background-color: green; + } + `, + ]; + } + + _graphicTemplate() { + return html`
`; + } +} + +customElements.define('my-determinate-progress-bar', MyDeterminateProgressBar); diff --git a/packages/ui/docs/components/progress-indicator/assets/my-indeterminate-progress-spinner.js b/packages/ui/docs/components/progress-indicator/assets/my-indeterminate-progress-spinner.js new file mode 100644 index 000000000..2c78b87b7 --- /dev/null +++ b/packages/ui/docs/components/progress-indicator/assets/my-indeterminate-progress-spinner.js @@ -0,0 +1,55 @@ +import { html, css } from 'lit'; +import { LionProgressIndicator } from '@lion/ui/progress-indicator.js'; + +export class MyIndeterminateProgressSpinner extends LionProgressIndicator { + static get styles() { + return [ + css` + .progress__icon { + display: inline-block; + width: 48px; + height: 48px; + animation: spinner-rotate 2s linear infinite; + } + + .progress__filled { + animation: spinner-dash 1.35s ease-in-out infinite; + fill: none; + stroke-width: 6px; + stroke: var(--primary-color); + } + + @keyframes spinner-rotate { + to { + transform: rotate(360deg); + } + } + + @keyframes spinner-dash { + 0% { + stroke-dasharray: 6, 122; + stroke-dashoffset: 0; + } + 50% { + stroke-dasharray: 100, 28; + stroke-dashoffset: -16; + } + 100% { + stroke-dasharray: 6, 122; + stroke-dashoffset: -127; + } + } + `, + ]; + } + + _graphicTemplate() { + return html` + + + + `; + } +} + +customElements.define('my-indeterminate-progress-spinner', MyIndeterminateProgressSpinner); diff --git a/packages/ui/docs/components/progress-indicator/examples.md b/packages/ui/docs/components/progress-indicator/examples.md new file mode 100644 index 000000000..f70614a14 --- /dev/null +++ b/packages/ui/docs/components/progress-indicator/examples.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/progress-indicator/examples.md) diff --git a/packages/ui/docs/components/progress-indicator/index.md b/packages/ui/docs/components/progress-indicator/index.md new file mode 100644 index 000000000..502bea066 --- /dev/null +++ b/packages/ui/docs/components/progress-indicator/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/progress-indicator/index.md) diff --git a/packages/ui/docs/components/progress-indicator/overview.md b/packages/ui/docs/components/progress-indicator/overview.md new file mode 100644 index 000000000..0c215b58c --- /dev/null +++ b/packages/ui/docs/components/progress-indicator/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/progress-indicator/overview.md) diff --git a/packages/ui/docs/components/radio-group/index.md b/packages/ui/docs/components/radio-group/index.md new file mode 100644 index 000000000..a85027939 --- /dev/null +++ b/packages/ui/docs/components/radio-group/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/radio-group/index.md) diff --git a/packages/ui/docs/components/radio-group/overview.md b/packages/ui/docs/components/radio-group/overview.md new file mode 100644 index 000000000..a5721cc91 --- /dev/null +++ b/packages/ui/docs/components/radio-group/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/radio-group/overview.md) diff --git a/packages/ui/docs/components/radio-group/use-cases.md b/packages/ui/docs/components/radio-group/use-cases.md new file mode 100644 index 000000000..ad9a7b3df --- /dev/null +++ b/packages/ui/docs/components/radio-group/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/radio-group/use-cases.md) diff --git a/packages/ui/docs/components/select-rich/examples.md b/packages/ui/docs/components/select-rich/examples.md new file mode 100644 index 000000000..659cbf21e --- /dev/null +++ b/packages/ui/docs/components/select-rich/examples.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/select-rich/examples.md) diff --git a/packages/ui/docs/components/select-rich/index.md b/packages/ui/docs/components/select-rich/index.md new file mode 100644 index 000000000..a32695f88 --- /dev/null +++ b/packages/ui/docs/components/select-rich/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/select-rich/index.md) diff --git a/packages/ui/docs/components/select-rich/overview.md b/packages/ui/docs/components/select-rich/overview.md new file mode 100644 index 000000000..9ea9e3849 --- /dev/null +++ b/packages/ui/docs/components/select-rich/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/select-rich/overview.md) diff --git a/packages/ui/docs/components/select-rich/src/flagStyles.js b/packages/ui/docs/components/select-rich/src/flagStyles.js new file mode 100644 index 000000000..51bcbfa41 --- /dev/null +++ b/packages/ui/docs/components/select-rich/src/flagStyles.js @@ -0,0 +1,1250 @@ +import { css, unsafeCSS } from 'lit'; + +const flagsImgUrl = unsafeCSS(new URL('./flags.png', import.meta.url).href); +const flagsImg2xUrl = unsafeCSS(new URL('./flags@2x.png', import.meta.url).href); + +export const flagStyles = css` + .iti { + position: relative; + display: inline-block; + } + .iti * { + box-sizing: border-box; + -moz-box-sizing: border-box; + } + .iti__hide { + display: none; + } + .iti__v-hide { + visibility: hidden; + } + .iti input, + .iti input[type='text'], + .iti input[type='tel'] { + position: relative; + z-index: 0; + margin-top: 0 !important; + margin-bottom: 0 !important; + padding-right: 36px; + margin-right: 0; + } + .iti__flag-container { + position: absolute; + top: 0; + bottom: 0; + right: 0; + padding: 1px; + } + .iti__selected-flag { + z-index: 1; + position: relative; + display: flex; + align-items: center; + height: 100%; + padding: 0 6px 0 8px; + } + .iti__arrow { + margin-left: 6px; + width: 0; + height: 0; + border-left: 3px solid transparent; + border-right: 3px solid transparent; + border-top: 4px solid #555; + } + .iti__arrow--up { + border-top: none; + border-bottom: 4px solid #555; + } + .iti__country-list { + position: absolute; + z-index: 2; + list-style: none; + text-align: left; + padding: 0; + margin: 0 0 0 -1px; + box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2); + background-color: white; + border: 1px solid #ccc; + white-space: nowrap; + max-height: 200px; + overflow-y: scroll; + -webkit-overflow-scrolling: touch; + } + .iti__country-list--dropup { + bottom: 100%; + margin-bottom: -1px; + } + @media (max-width: 500px) { + .iti__country-list { + white-space: normal; + } + } + .iti__flag-box { + display: inline-block; + width: 20px; + } + .iti__divider { + padding-bottom: 5px; + margin-bottom: 5px; + border-bottom: 1px solid #ccc; + } + .iti__country { + padding: 5px 10px; + outline: none; + } + .iti__dial-code { + color: #999; + } + .iti__country.iti__highlight { + background-color: rgba(0, 0, 0, 0.05); + } + .iti__flag-box, + .iti__country-name, + .iti__dial-code { + vertical-align: middle; + } + .iti__flag-box, + .iti__country-name { + margin-right: 6px; + } + .iti--allow-dropdown input, + .iti--allow-dropdown input[type='text'], + .iti--allow-dropdown input[type='tel'], + .iti--separate-dial-code input, + .iti--separate-dial-code input[type='text'], + .iti--separate-dial-code input[type='tel'] { + padding-right: 6px; + padding-left: 52px; + margin-left: 0; + } + .iti--allow-dropdown .iti__flag-container, + .iti--separate-dial-code .iti__flag-container { + right: auto; + left: 0; + } + .iti--allow-dropdown .iti__flag-container:hover { + cursor: pointer; + } + .iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag { + background-color: rgba(0, 0, 0, 0.05); + } + .iti--allow-dropdown input[disabled] + .iti__flag-container:hover, + .iti--allow-dropdown input[readonly] + .iti__flag-container:hover { + cursor: default; + } + .iti--allow-dropdown input[disabled] + .iti__flag-container:hover .iti__selected-flag, + .iti--allow-dropdown input[readonly] + .iti__flag-container:hover .iti__selected-flag { + background-color: transparent; + } + .iti--separate-dial-code .iti__selected-flag { + background-color: rgba(0, 0, 0, 0.05); + } + .iti--separate-dial-code .iti__selected-dial-code { + margin-left: 6px; + } + .iti--container { + position: absolute; + top: -1000px; + left: -1000px; + z-index: 1060; + padding: 1px; + } + .iti--container:hover { + cursor: pointer; + } + + .iti-mobile .iti--container { + top: 30px; + bottom: 30px; + left: 30px; + right: 30px; + position: fixed; + } + + .iti-mobile .iti__country-list { + max-height: 100%; + width: 100%; + } + + .iti-mobile .iti__country { + padding: 10px 10px; + line-height: 1.5em; + } + + .iti__flag { + width: 20px; + } + .iti__flag.iti__be { + width: 18px; + } + .iti__flag.iti__ch { + width: 15px; + } + .iti__flag.iti__mc { + width: 19px; + } + .iti__flag.iti__ne { + width: 18px; + } + .iti__flag.iti__np { + width: 13px; + } + .iti__flag.iti__va { + width: 15px; + } + @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { + .iti__flag { + background-size: 5652px 15px; + } + } + .iti__flag.iti__ac { + height: 10px; + background-position: 0px 0px; + } + .iti__flag.iti__ad { + height: 14px; + background-position: -22px 0px; + } + .iti__flag.iti__ae { + height: 10px; + background-position: -44px 0px; + } + .iti__flag.iti__af { + height: 14px; + background-position: -66px 0px; + } + .iti__flag.iti__ag { + height: 14px; + background-position: -88px 0px; + } + .iti__flag.iti__ai { + height: 10px; + background-position: -110px 0px; + } + .iti__flag.iti__al { + height: 15px; + background-position: -132px 0px; + } + .iti__flag.iti__am { + height: 10px; + background-position: -154px 0px; + } + .iti__flag.iti__ao { + height: 14px; + background-position: -176px 0px; + } + .iti__flag.iti__aq { + height: 14px; + background-position: -198px 0px; + } + .iti__flag.iti__ar { + height: 13px; + background-position: -220px 0px; + } + .iti__flag.iti__as { + height: 10px; + background-position: -242px 0px; + } + .iti__flag.iti__at { + height: 14px; + background-position: -264px 0px; + } + .iti__flag.iti__au { + height: 10px; + background-position: -286px 0px; + } + .iti__flag.iti__aw { + height: 14px; + background-position: -308px 0px; + } + .iti__flag.iti__ax { + height: 13px; + background-position: -330px 0px; + } + .iti__flag.iti__az { + height: 10px; + background-position: -352px 0px; + } + .iti__flag.iti__ba { + height: 10px; + background-position: -374px 0px; + } + .iti__flag.iti__bb { + height: 14px; + background-position: -396px 0px; + } + .iti__flag.iti__bd { + height: 12px; + background-position: -418px 0px; + } + .iti__flag.iti__be { + height: 15px; + background-position: -440px 0px; + } + .iti__flag.iti__bf { + height: 14px; + background-position: -460px 0px; + } + .iti__flag.iti__bg { + height: 12px; + background-position: -482px 0px; + } + .iti__flag.iti__bh { + height: 12px; + background-position: -504px 0px; + } + .iti__flag.iti__bi { + height: 12px; + background-position: -526px 0px; + } + .iti__flag.iti__bj { + height: 14px; + background-position: -548px 0px; + } + .iti__flag.iti__bl { + height: 14px; + background-position: -570px 0px; + } + .iti__flag.iti__bm { + height: 10px; + background-position: -592px 0px; + } + .iti__flag.iti__bn { + height: 10px; + background-position: -614px 0px; + } + .iti__flag.iti__bo { + height: 14px; + background-position: -636px 0px; + } + .iti__flag.iti__bq { + height: 14px; + background-position: -658px 0px; + } + .iti__flag.iti__br { + height: 14px; + background-position: -680px 0px; + } + .iti__flag.iti__bs { + height: 10px; + background-position: -702px 0px; + } + .iti__flag.iti__bt { + height: 14px; + background-position: -724px 0px; + } + .iti__flag.iti__bv { + height: 15px; + background-position: -746px 0px; + } + .iti__flag.iti__bw { + height: 14px; + background-position: -768px 0px; + } + .iti__flag.iti__by { + height: 10px; + background-position: -790px 0px; + } + .iti__flag.iti__bz { + height: 14px; + background-position: -812px 0px; + } + .iti__flag.iti__ca { + height: 10px; + background-position: -834px 0px; + } + .iti__flag.iti__cc { + height: 10px; + background-position: -856px 0px; + } + .iti__flag.iti__cd { + height: 15px; + background-position: -878px 0px; + } + .iti__flag.iti__cf { + height: 14px; + background-position: -900px 0px; + } + .iti__flag.iti__cg { + height: 14px; + background-position: -922px 0px; + } + .iti__flag.iti__ch { + height: 15px; + background-position: -944px 0px; + } + .iti__flag.iti__ci { + height: 14px; + background-position: -961px 0px; + } + .iti__flag.iti__ck { + height: 10px; + background-position: -983px 0px; + } + .iti__flag.iti__cl { + height: 14px; + background-position: -1005px 0px; + } + .iti__flag.iti__cm { + height: 14px; + background-position: -1027px 0px; + } + .iti__flag.iti__cn { + height: 14px; + background-position: -1049px 0px; + } + .iti__flag.iti__co { + height: 14px; + background-position: -1071px 0px; + } + .iti__flag.iti__cp { + height: 14px; + background-position: -1093px 0px; + } + .iti__flag.iti__cr { + height: 12px; + background-position: -1115px 0px; + } + .iti__flag.iti__cu { + height: 10px; + background-position: -1137px 0px; + } + .iti__flag.iti__cv { + height: 12px; + background-position: -1159px 0px; + } + .iti__flag.iti__cw { + height: 14px; + background-position: -1181px 0px; + } + .iti__flag.iti__cx { + height: 10px; + background-position: -1203px 0px; + } + .iti__flag.iti__cy { + height: 14px; + background-position: -1225px 0px; + } + .iti__flag.iti__cz { + height: 14px; + background-position: -1247px 0px; + } + .iti__flag.iti__de { + height: 12px; + background-position: -1269px 0px; + } + .iti__flag.iti__dg { + height: 10px; + background-position: -1291px 0px; + } + .iti__flag.iti__dj { + height: 14px; + background-position: -1313px 0px; + } + .iti__flag.iti__dk { + height: 15px; + background-position: -1335px 0px; + } + .iti__flag.iti__dm { + height: 10px; + background-position: -1357px 0px; + } + .iti__flag.iti__do { + height: 14px; + background-position: -1379px 0px; + } + .iti__flag.iti__dz { + height: 14px; + background-position: -1401px 0px; + } + .iti__flag.iti__ea { + height: 14px; + background-position: -1423px 0px; + } + .iti__flag.iti__ec { + height: 14px; + background-position: -1445px 0px; + } + .iti__flag.iti__ee { + height: 13px; + background-position: -1467px 0px; + } + .iti__flag.iti__eg { + height: 14px; + background-position: -1489px 0px; + } + .iti__flag.iti__eh { + height: 10px; + background-position: -1511px 0px; + } + .iti__flag.iti__er { + height: 10px; + background-position: -1533px 0px; + } + .iti__flag.iti__es { + height: 14px; + background-position: -1555px 0px; + } + .iti__flag.iti__et { + height: 10px; + background-position: -1577px 0px; + } + .iti__flag.iti__eu { + height: 14px; + background-position: -1599px 0px; + } + .iti__flag.iti__fi { + height: 12px; + background-position: -1621px 0px; + } + .iti__flag.iti__fj { + height: 10px; + background-position: -1643px 0px; + } + .iti__flag.iti__fk { + height: 10px; + background-position: -1665px 0px; + } + .iti__flag.iti__fm { + height: 11px; + background-position: -1687px 0px; + } + .iti__flag.iti__fo { + height: 15px; + background-position: -1709px 0px; + } + .iti__flag.iti__fr { + height: 14px; + background-position: -1731px 0px; + } + .iti__flag.iti__ga { + height: 15px; + background-position: -1753px 0px; + } + .iti__flag.iti__gb { + height: 10px; + background-position: -1775px 0px; + } + .iti__flag.iti__gd { + height: 12px; + background-position: -1797px 0px; + } + .iti__flag.iti__ge { + height: 14px; + background-position: -1819px 0px; + } + .iti__flag.iti__gf { + height: 14px; + background-position: -1841px 0px; + } + .iti__flag.iti__gg { + height: 14px; + background-position: -1863px 0px; + } + .iti__flag.iti__gh { + height: 14px; + background-position: -1885px 0px; + } + .iti__flag.iti__gi { + height: 10px; + background-position: -1907px 0px; + } + .iti__flag.iti__gl { + height: 14px; + background-position: -1929px 0px; + } + .iti__flag.iti__gm { + height: 14px; + background-position: -1951px 0px; + } + .iti__flag.iti__gn { + height: 14px; + background-position: -1973px 0px; + } + .iti__flag.iti__gp { + height: 14px; + background-position: -1995px 0px; + } + .iti__flag.iti__gq { + height: 14px; + background-position: -2017px 0px; + } + .iti__flag.iti__gr { + height: 14px; + background-position: -2039px 0px; + } + .iti__flag.iti__gs { + height: 10px; + background-position: -2061px 0px; + } + .iti__flag.iti__gt { + height: 13px; + background-position: -2083px 0px; + } + .iti__flag.iti__gu { + height: 11px; + background-position: -2105px 0px; + } + .iti__flag.iti__gw { + height: 10px; + background-position: -2127px 0px; + } + .iti__flag.iti__gy { + height: 12px; + background-position: -2149px 0px; + } + .iti__flag.iti__hk { + height: 14px; + background-position: -2171px 0px; + } + .iti__flag.iti__hm { + height: 10px; + background-position: -2193px 0px; + } + .iti__flag.iti__hn { + height: 10px; + background-position: -2215px 0px; + } + .iti__flag.iti__hr { + height: 10px; + background-position: -2237px 0px; + } + .iti__flag.iti__ht { + height: 12px; + background-position: -2259px 0px; + } + .iti__flag.iti__hu { + height: 10px; + background-position: -2281px 0px; + } + .iti__flag.iti__ic { + height: 14px; + background-position: -2303px 0px; + } + .iti__flag.iti__id { + height: 14px; + background-position: -2325px 0px; + } + .iti__flag.iti__ie { + height: 10px; + background-position: -2347px 0px; + } + .iti__flag.iti__il { + height: 15px; + background-position: -2369px 0px; + } + .iti__flag.iti__im { + height: 10px; + background-position: -2391px 0px; + } + .iti__flag.iti__in { + height: 14px; + background-position: -2413px 0px; + } + .iti__flag.iti__io { + height: 10px; + background-position: -2435px 0px; + } + .iti__flag.iti__iq { + height: 14px; + background-position: -2457px 0px; + } + .iti__flag.iti__ir { + height: 12px; + background-position: -2479px 0px; + } + .iti__flag.iti__is { + height: 15px; + background-position: -2501px 0px; + } + .iti__flag.iti__it { + height: 14px; + background-position: -2523px 0px; + } + .iti__flag.iti__je { + height: 12px; + background-position: -2545px 0px; + } + .iti__flag.iti__jm { + height: 10px; + background-position: -2567px 0px; + } + .iti__flag.iti__jo { + height: 10px; + background-position: -2589px 0px; + } + .iti__flag.iti__jp { + height: 14px; + background-position: -2611px 0px; + } + .iti__flag.iti__ke { + height: 14px; + background-position: -2633px 0px; + } + .iti__flag.iti__kg { + height: 12px; + background-position: -2655px 0px; + } + .iti__flag.iti__kh { + height: 13px; + background-position: -2677px 0px; + } + .iti__flag.iti__ki { + height: 10px; + background-position: -2699px 0px; + } + .iti__flag.iti__km { + height: 12px; + background-position: -2721px 0px; + } + .iti__flag.iti__kn { + height: 14px; + background-position: -2743px 0px; + } + .iti__flag.iti__kp { + height: 10px; + background-position: -2765px 0px; + } + .iti__flag.iti__kr { + height: 14px; + background-position: -2787px 0px; + } + .iti__flag.iti__kw { + height: 10px; + background-position: -2809px 0px; + } + .iti__flag.iti__ky { + height: 10px; + background-position: -2831px 0px; + } + .iti__flag.iti__kz { + height: 10px; + background-position: -2853px 0px; + } + .iti__flag.iti__la { + height: 14px; + background-position: -2875px 0px; + } + .iti__flag.iti__lb { + height: 14px; + background-position: -2897px 0px; + } + .iti__flag.iti__lc { + height: 10px; + background-position: -2919px 0px; + } + .iti__flag.iti__li { + height: 12px; + background-position: -2941px 0px; + } + .iti__flag.iti__lk { + height: 10px; + background-position: -2963px 0px; + } + .iti__flag.iti__lr { + height: 11px; + background-position: -2985px 0px; + } + .iti__flag.iti__ls { + height: 14px; + background-position: -3007px 0px; + } + .iti__flag.iti__lt { + height: 12px; + background-position: -3029px 0px; + } + .iti__flag.iti__lu { + height: 12px; + background-position: -3051px 0px; + } + .iti__flag.iti__lv { + height: 10px; + background-position: -3073px 0px; + } + .iti__flag.iti__ly { + height: 10px; + background-position: -3095px 0px; + } + .iti__flag.iti__ma { + height: 14px; + background-position: -3117px 0px; + } + .iti__flag.iti__mc { + height: 15px; + background-position: -3139px 0px; + } + .iti__flag.iti__md { + height: 10px; + background-position: -3160px 0px; + } + .iti__flag.iti__me { + height: 10px; + background-position: -3182px 0px; + } + .iti__flag.iti__mf { + height: 14px; + background-position: -3204px 0px; + } + .iti__flag.iti__mg { + height: 14px; + background-position: -3226px 0px; + } + .iti__flag.iti__mh { + height: 11px; + background-position: -3248px 0px; + } + .iti__flag.iti__mk { + height: 10px; + background-position: -3270px 0px; + } + .iti__flag.iti__ml { + height: 14px; + background-position: -3292px 0px; + } + .iti__flag.iti__mm { + height: 14px; + background-position: -3314px 0px; + } + .iti__flag.iti__mn { + height: 10px; + background-position: -3336px 0px; + } + .iti__flag.iti__mo { + height: 14px; + background-position: -3358px 0px; + } + .iti__flag.iti__mp { + height: 10px; + background-position: -3380px 0px; + } + .iti__flag.iti__mq { + height: 14px; + background-position: -3402px 0px; + } + .iti__flag.iti__mr { + height: 14px; + background-position: -3424px 0px; + } + .iti__flag.iti__ms { + height: 10px; + background-position: -3446px 0px; + } + .iti__flag.iti__mt { + height: 14px; + background-position: -3468px 0px; + } + .iti__flag.iti__mu { + height: 14px; + background-position: -3490px 0px; + } + .iti__flag.iti__mv { + height: 14px; + background-position: -3512px 0px; + } + .iti__flag.iti__mw { + height: 14px; + background-position: -3534px 0px; + } + .iti__flag.iti__mx { + height: 12px; + background-position: -3556px 0px; + } + .iti__flag.iti__my { + height: 10px; + background-position: -3578px 0px; + } + .iti__flag.iti__mz { + height: 14px; + background-position: -3600px 0px; + } + .iti__flag.iti__na { + height: 14px; + background-position: -3622px 0px; + } + .iti__flag.iti__nc { + height: 10px; + background-position: -3644px 0px; + } + .iti__flag.iti__ne { + height: 15px; + background-position: -3666px 0px; + } + .iti__flag.iti__nf { + height: 10px; + background-position: -3686px 0px; + } + .iti__flag.iti__ng { + height: 10px; + background-position: -3708px 0px; + } + .iti__flag.iti__ni { + height: 12px; + background-position: -3730px 0px; + } + .iti__flag.iti__nl { + height: 14px; + background-position: -3752px 0px; + } + .iti__flag.iti__no { + height: 15px; + background-position: -3774px 0px; + } + .iti__flag.iti__np { + height: 15px; + background-position: -3796px 0px; + } + .iti__flag.iti__nr { + height: 10px; + background-position: -3811px 0px; + } + .iti__flag.iti__nu { + height: 10px; + background-position: -3833px 0px; + } + .iti__flag.iti__nz { + height: 10px; + background-position: -3855px 0px; + } + .iti__flag.iti__om { + height: 10px; + background-position: -3877px 0px; + } + .iti__flag.iti__pa { + height: 14px; + background-position: -3899px 0px; + } + .iti__flag.iti__pe { + height: 14px; + background-position: -3921px 0px; + } + .iti__flag.iti__pf { + height: 14px; + background-position: -3943px 0px; + } + .iti__flag.iti__pg { + height: 15px; + background-position: -3965px 0px; + } + .iti__flag.iti__ph { + height: 10px; + background-position: -3987px 0px; + } + .iti__flag.iti__pk { + height: 14px; + background-position: -4009px 0px; + } + .iti__flag.iti__pl { + height: 13px; + background-position: -4031px 0px; + } + .iti__flag.iti__pm { + height: 14px; + background-position: -4053px 0px; + } + .iti__flag.iti__pn { + height: 10px; + background-position: -4075px 0px; + } + .iti__flag.iti__pr { + height: 14px; + background-position: -4097px 0px; + } + .iti__flag.iti__ps { + height: 10px; + background-position: -4119px 0px; + } + .iti__flag.iti__pt { + height: 14px; + background-position: -4141px 0px; + } + .iti__flag.iti__pw { + height: 13px; + background-position: -4163px 0px; + } + .iti__flag.iti__py { + height: 11px; + background-position: -4185px 0px; + } + .iti__flag.iti__qa { + height: 8px; + background-position: -4207px 0px; + } + .iti__flag.iti__re { + height: 14px; + background-position: -4229px 0px; + } + .iti__flag.iti__ro { + height: 14px; + background-position: -4251px 0px; + } + .iti__flag.iti__rs { + height: 14px; + background-position: -4273px 0px; + } + .iti__flag.iti__ru { + height: 14px; + background-position: -4295px 0px; + } + .iti__flag.iti__rw { + height: 14px; + background-position: -4317px 0px; + } + .iti__flag.iti__sa { + height: 14px; + background-position: -4339px 0px; + } + .iti__flag.iti__sb { + height: 10px; + background-position: -4361px 0px; + } + .iti__flag.iti__sc { + height: 10px; + background-position: -4383px 0px; + } + .iti__flag.iti__sd { + height: 10px; + background-position: -4405px 0px; + } + .iti__flag.iti__se { + height: 13px; + background-position: -4427px 0px; + } + .iti__flag.iti__sg { + height: 14px; + background-position: -4449px 0px; + } + .iti__flag.iti__sh { + height: 10px; + background-position: -4471px 0px; + } + .iti__flag.iti__si { + height: 10px; + background-position: -4493px 0px; + } + .iti__flag.iti__sj { + height: 15px; + background-position: -4515px 0px; + } + .iti__flag.iti__sk { + height: 14px; + background-position: -4537px 0px; + } + .iti__flag.iti__sl { + height: 14px; + background-position: -4559px 0px; + } + .iti__flag.iti__sm { + height: 15px; + background-position: -4581px 0px; + } + .iti__flag.iti__sn { + height: 14px; + background-position: -4603px 0px; + } + .iti__flag.iti__so { + height: 14px; + background-position: -4625px 0px; + } + .iti__flag.iti__sr { + height: 14px; + background-position: -4647px 0px; + } + .iti__flag.iti__ss { + height: 10px; + background-position: -4669px 0px; + } + .iti__flag.iti__st { + height: 10px; + background-position: -4691px 0px; + } + .iti__flag.iti__sv { + height: 12px; + background-position: -4713px 0px; + } + .iti__flag.iti__sx { + height: 14px; + background-position: -4735px 0px; + } + .iti__flag.iti__sy { + height: 14px; + background-position: -4757px 0px; + } + .iti__flag.iti__sz { + height: 14px; + background-position: -4779px 0px; + } + .iti__flag.iti__ta { + height: 10px; + background-position: -4801px 0px; + } + .iti__flag.iti__tc { + height: 10px; + background-position: -4823px 0px; + } + .iti__flag.iti__td { + height: 14px; + background-position: -4845px 0px; + } + .iti__flag.iti__tf { + height: 14px; + background-position: -4867px 0px; + } + .iti__flag.iti__tg { + height: 13px; + background-position: -4889px 0px; + } + .iti__flag.iti__th { + height: 14px; + background-position: -4911px 0px; + } + .iti__flag.iti__tj { + height: 10px; + background-position: -4933px 0px; + } + .iti__flag.iti__tk { + height: 10px; + background-position: -4955px 0px; + } + .iti__flag.iti__tl { + height: 10px; + background-position: -4977px 0px; + } + .iti__flag.iti__tm { + height: 14px; + background-position: -4999px 0px; + } + .iti__flag.iti__tn { + height: 14px; + background-position: -5021px 0px; + } + .iti__flag.iti__to { + height: 10px; + background-position: -5043px 0px; + } + .iti__flag.iti__tr { + height: 14px; + background-position: -5065px 0px; + } + .iti__flag.iti__tt { + height: 12px; + background-position: -5087px 0px; + } + .iti__flag.iti__tv { + height: 10px; + background-position: -5109px 0px; + } + .iti__flag.iti__tw { + height: 14px; + background-position: -5131px 0px; + } + .iti__flag.iti__tz { + height: 14px; + background-position: -5153px 0px; + } + .iti__flag.iti__ua { + height: 14px; + background-position: -5175px 0px; + } + .iti__flag.iti__ug { + height: 14px; + background-position: -5197px 0px; + } + .iti__flag.iti__um { + height: 11px; + background-position: -5219px 0px; + } + .iti__flag.iti__un { + height: 14px; + background-position: -5241px 0px; + } + .iti__flag.iti__us { + height: 11px; + background-position: -5263px 0px; + } + .iti__flag.iti__uy { + height: 14px; + background-position: -5285px 0px; + } + .iti__flag.iti__uz { + height: 10px; + background-position: -5307px 0px; + } + .iti__flag.iti__va { + height: 15px; + background-position: -5329px 0px; + } + .iti__flag.iti__vc { + height: 14px; + background-position: -5346px 0px; + } + .iti__flag.iti__ve { + height: 14px; + background-position: -5368px 0px; + } + .iti__flag.iti__vg { + height: 10px; + background-position: -5390px 0px; + } + .iti__flag.iti__vi { + height: 14px; + background-position: -5412px 0px; + } + .iti__flag.iti__vn { + height: 14px; + background-position: -5434px 0px; + } + .iti__flag.iti__vu { + height: 12px; + background-position: -5456px 0px; + } + .iti__flag.iti__wf { + height: 14px; + background-position: -5478px 0px; + } + .iti__flag.iti__ws { + height: 10px; + background-position: -5500px 0px; + } + .iti__flag.iti__xk { + height: 15px; + background-position: -5522px 0px; + } + .iti__flag.iti__ye { + height: 14px; + background-position: -5544px 0px; + } + .iti__flag.iti__yt { + height: 14px; + background-position: -5566px 0px; + } + .iti__flag.iti__za { + height: 14px; + background-position: -5588px 0px; + } + .iti__flag.iti__zm { + height: 14px; + background-position: -5610px 0px; + } + .iti__flag.iti__zw { + height: 10px; + background-position: -5632px 0px; + } + + .iti__flag { + height: 15px; + box-shadow: 0px 0px 1px 0px #888; + background-image: url(${flagsImgUrl}); + background-repeat: no-repeat; + background-color: #dbdbdb; + background-position: 20px 0; + } + @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { + .iti__flag { + background-image: url(${flagsImg2xUrl}); + } + } + + .iti__flag.iti__np { + background-color: transparent; + } +`; diff --git a/packages/ui/docs/components/select-rich/src/flags.png b/packages/ui/docs/components/select-rich/src/flags.png new file mode 100644 index 000000000..3fa1bec9f Binary files /dev/null and b/packages/ui/docs/components/select-rich/src/flags.png differ diff --git a/packages/ui/docs/components/select-rich/src/flags@2x.png b/packages/ui/docs/components/select-rich/src/flags@2x.png new file mode 100644 index 000000000..7cc3ed3fb Binary files /dev/null and b/packages/ui/docs/components/select-rich/src/flags@2x.png differ diff --git a/packages/ui/docs/components/select-rich/src/intl-select-rich.js b/packages/ui/docs/components/select-rich/src/intl-select-rich.js new file mode 100644 index 000000000..e6bb088cf --- /dev/null +++ b/packages/ui/docs/components/select-rich/src/intl-select-rich.js @@ -0,0 +1,194 @@ +import { html, css, LitElement } from 'lit'; +import { LionSelectRich, LionSelectInvoker } from '@lion/ui/select-rich.js'; +import { LionOption } from '@lion/ui/listbox.js'; +import { flagStyles } from './flagStyles.js'; + +/** + * @typedef {import('@lion/ui/core.js').RenderOptions} RenderOptions + * @typedef {import('@lion/ui/input-tel/types/types.js').RegionAndCountryCode} RegionAndCountryCode + * @typedef {import('@lion/ui/input-tel/types/types.js').TemplateDataForDropdownInputTel} TemplateDataForDropdownInputTel + * @typedef {{countryCode: string; regionCode: string; nameForRegion: string; nameForLocale: string}} RegionMetaList + * @typedef {TemplateDataForDropdownInputTel & {data: {regionMetaList:RegionMetaList}}} TemplateDataForIntlInputTel + */ + +export class IntlOption extends LionOption { + static properties = { regionMeta: { type: Object } }; + + static styles = [ + super.styles, + flagStyles, + css` + :host { + padding: 5px 10px; + outline: none; + } + + :host(:hover), + :host([active]), + :host([checked]) { + background-color: rgba(0, 0, 0, 0.05); + } + `, + ]; + + get _regionCode() { + return this.choiceValue?.toUpperCase(); + } + + render() { + const ctor = /** @type {typeof IntlOption} */ (this.constructor); + return ctor._contentTemplate({ + data: this.regionMeta, + }); + } + + static _contentTemplate({ data: { regionCode, countryCode, nameForLocale, nameForRegion } }) { + return html` +
+
+
+ ${nameForLocale} (${nameForRegion}) + +${countryCode} + `; + } +} +customElements.define('intl-option', IntlOption); + +class IntlSelectInvoker extends LionSelectInvoker { + /** + * @configure LitElement + * @enhance LionSelectInvoker + */ + static styles = [ + super.styles, + flagStyles, + css` + :host { + /** TODO: avoid importants; should actually be configured in overlay */ + width: auto !important; + background-color: transparent; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + } + + #content-wrapper { + display: flex; + align-items: center; + } + `, + ]; + + /** + * @configure SlotMixin + * @override LionSelectInvoker + */ + get slots() { + return {}; + } + + /** + * @override LionSelectInvoker + */ + render() { + const ctor = /** @type {typeof LionSelectInvoker} */ (this.constructor); + return ctor._mainTemplate(this._templateData); + } + + get _templateData() { + return { + data: { selectedElement: this.selectedElement, hostElement: this.hostElement }, + }; + } + + static _mainTemplate(templateData) { + return html`
${this._contentTemplate(templateData)}
`; + } + + static _contentTemplate({ data: { selectedElement, hostElement } }) { + if (!selectedElement) { + return ``; + } + return html` +
+
+ `; + } +} +customElements.define('intl-select-invoker', IntlSelectInvoker); + +export class IntlSeparator extends LitElement { + static styles = [ + css` + :host { + display: block; + padding-bottom: 5px; + margin-bottom: 5px; + border-bottom: 1px solid #ccc; + } + `, + ]; + + /** + * @lifecycle platform + */ + connectedCallback() { + super.connectedCallback(); + this.setAttribute('role', 'separator'); + } +} +customElements.define('intl-separator', IntlSeparator); + +export class IntlSelectRich extends LionSelectRich { + static styles = [ + super.styles, + css` + :host, + ::slotted(*) { + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 1.42857143; + color: #333; + } + + ::slotted([role='listbox']) { + margin-left: -3px; + display: block; + white-space: nowrap; + max-height: 200px; + overflow-y: scroll; + position: absolute; + z-index: 2; + list-style: none; + text-align: left; + padding: 0; + margin: 0 0 0 -1px; + box-shadow: 1px 1px 4px rgb(0 0 0 / 20%); + background-color: white; + border: 1px solid #ccc; + -webkit-overflow-scrolling: touch; + outline: none; + } + + .form-field__group-two, + .input-group, + .input-group__container, + .input-group__input { + height: 100%; + } + `, + ]; + + /** + * @configure ScopedElementsMixin + */ + static scopedElements = { 'intl-select-invoker': IntlSelectInvoker }; + + /** + * @configure SlotMixin + */ + slots = { + ...super.slots, + invoker: () => html``, + }; +} +customElements.define('intl-select-rich', IntlSelectRich); diff --git a/packages/ui/docs/components/select-rich/src/regionMetaList.js b/packages/ui/docs/components/select-rich/src/regionMetaList.js new file mode 100644 index 000000000..6fee46ece --- /dev/null +++ b/packages/ui/docs/components/select-rich/src/regionMetaList.js @@ -0,0 +1,1717 @@ +export const regionMetaList = [ + { + regionCode: 'AC', + countryCode: 247, + flagSymbol: '🇦🇨', + nameForLocale: 'Ascension Island', + nameForRegion: 'Ascension Island', + }, + { + regionCode: 'AD', + countryCode: 376, + flagSymbol: '🇦🇩', + nameForLocale: 'Andorra', + nameForRegion: 'Andorra', + }, + { + regionCode: 'AE', + countryCode: 971, + flagSymbol: '🇦🇪', + nameForLocale: 'United Arab Emirates', + nameForRegion: 'United Arab Emirates', + }, + { + regionCode: 'AF', + countryCode: 93, + flagSymbol: '🇦🇫', + nameForLocale: 'Afghanistan', + nameForRegion: 'Afghanistan', + }, + { + regionCode: 'AG', + countryCode: 1, + flagSymbol: '🇦🇬', + nameForLocale: 'Antigua & Barbuda', + nameForRegion: 'Antigua & Barbuda', + }, + { + regionCode: 'AI', + countryCode: 1, + flagSymbol: '🇦🇮', + nameForLocale: 'Anguilla', + nameForRegion: 'Anguilla', + }, + { + regionCode: 'AL', + countryCode: 355, + flagSymbol: '🇦🇱', + nameForLocale: 'Albania', + nameForRegion: 'Albania', + }, + { + regionCode: 'AM', + countryCode: 374, + flagSymbol: '🇦🇲', + nameForLocale: 'Armenia', + nameForRegion: 'አርሜኒያ', + }, + { + regionCode: 'AO', + countryCode: 244, + flagSymbol: '🇦🇴', + nameForLocale: 'Angola', + nameForRegion: 'Angola', + }, + { + regionCode: 'AR', + countryCode: 54, + flagSymbol: '🇦🇷', + nameForLocale: 'Argentina', + nameForRegion: 'الأرجنتين', + }, + { + regionCode: 'AS', + countryCode: 1, + flagSymbol: '🇦🇸', + nameForLocale: 'American Samoa', + nameForRegion: 'American Samoa', + }, + { + regionCode: 'AT', + countryCode: 43, + flagSymbol: '🇦🇹', + nameForLocale: 'Austria', + nameForRegion: 'Austria', + }, + { + regionCode: 'AU', + countryCode: 61, + flagSymbol: '🇦🇺', + nameForLocale: 'Australia', + nameForRegion: 'Australia', + }, + { + regionCode: 'AW', + countryCode: 297, + flagSymbol: '🇦🇼', + nameForLocale: 'Aruba', + nameForRegion: 'Aruba', + }, + { + regionCode: 'AX', + countryCode: 358, + flagSymbol: '🇦🇽', + nameForLocale: 'Åland Islands', + nameForRegion: 'Åland Islands', + }, + { + regionCode: 'AZ', + countryCode: 994, + flagSymbol: '🇦🇿', + nameForLocale: 'Azerbaijan', + nameForRegion: 'Azerbaijan', + }, + { + regionCode: 'BA', + countryCode: 387, + flagSymbol: '🇧🇦', + nameForLocale: 'Bosnia & Herzegovina', + nameForRegion: 'Bosnia & Herzegovina', + }, + { + regionCode: 'BB', + countryCode: 1, + flagSymbol: '🇧🇧', + nameForLocale: 'Barbados', + nameForRegion: 'Barbados', + }, + { + regionCode: 'BD', + countryCode: 880, + flagSymbol: '🇧🇩', + nameForLocale: 'Bangladesh', + nameForRegion: 'Bangladesh', + }, + { + regionCode: 'BE', + countryCode: 32, + flagSymbol: '🇧🇪', + nameForLocale: 'Belgium', + nameForRegion: 'Belgium', + }, + { + regionCode: 'BF', + countryCode: 226, + flagSymbol: '🇧🇫', + nameForLocale: 'Burkina Faso', + nameForRegion: 'Burkina Faso', + }, + { + regionCode: 'BG', + countryCode: 359, + flagSymbol: '🇧🇬', + nameForLocale: 'Bulgaria', + nameForRegion: 'България', + }, + { + regionCode: 'BH', + countryCode: 973, + flagSymbol: '🇧🇭', + nameForLocale: 'Bahrain', + nameForRegion: 'Bahrain', + }, + { + regionCode: 'BI', + countryCode: 257, + flagSymbol: '🇧🇮', + nameForLocale: 'Burundi', + nameForRegion: 'Burundi', + }, + { + regionCode: 'BJ', + countryCode: 229, + flagSymbol: '🇧🇯', + nameForLocale: 'Benin', + nameForRegion: 'Benin', + }, + { + regionCode: 'BL', + countryCode: 590, + flagSymbol: '🇧🇱', + nameForLocale: 'St. Barthélemy', + nameForRegion: 'St Barthélemy', + }, + { + regionCode: 'BM', + countryCode: 1, + flagSymbol: '🇧🇲', + nameForLocale: 'Bermuda', + nameForRegion: 'Bermuda', + }, + { + regionCode: 'BN', + countryCode: 673, + flagSymbol: '🇧🇳', + nameForLocale: 'Brunei', + nameForRegion: 'ব্রুনেই', + }, + { + regionCode: 'BO', + countryCode: 591, + flagSymbol: '🇧🇴', + nameForLocale: 'Bolivia', + nameForRegion: 'Bolivia', + }, + { + regionCode: 'BQ', + countryCode: 599, + flagSymbol: '🇧🇶', + nameForLocale: 'Caribbean Netherlands', + nameForRegion: 'Caribbean Netherlands', + }, + { + regionCode: 'BR', + countryCode: 55, + flagSymbol: '🇧🇷', + nameForLocale: 'Brazil', + nameForRegion: 'Brazil', + }, + { + regionCode: 'BS', + countryCode: 1, + flagSymbol: '🇧🇸', + nameForLocale: 'Bahamas', + nameForRegion: 'Bahamas', + }, + { + regionCode: 'BT', + countryCode: 975, + flagSymbol: '🇧🇹', + nameForLocale: 'Bhutan', + nameForRegion: 'Bhutan', + }, + { + regionCode: 'BW', + countryCode: 267, + flagSymbol: '🇧🇼', + nameForLocale: 'Botswana', + nameForRegion: 'Botswana', + }, + { + regionCode: 'BY', + countryCode: 375, + flagSymbol: '🇧🇾', + nameForLocale: 'Belarus', + nameForRegion: 'Belarus', + }, + { + regionCode: 'BZ', + countryCode: 501, + flagSymbol: '🇧🇿', + nameForLocale: 'Belize', + nameForRegion: 'Belize', + }, + { + regionCode: 'CA', + countryCode: 1, + flagSymbol: '🇨🇦', + nameForLocale: 'Canada', + nameForRegion: 'Canadà', + }, + { + regionCode: 'CC', + countryCode: 61, + flagSymbol: '🇨🇨', + nameForLocale: 'Cocos (Keeling) Islands', + nameForRegion: 'Cocos (Keeling) Islands', + }, + { + regionCode: 'CD', + countryCode: 243, + flagSymbol: '🇨🇩', + nameForLocale: 'Congo - Kinshasa', + nameForRegion: 'Congo - Kinshasa', + }, + { + regionCode: 'CF', + countryCode: 236, + flagSymbol: '🇨🇫', + nameForLocale: 'Central African Republic', + nameForRegion: 'Central African Republic', + }, + { + regionCode: 'CG', + countryCode: 242, + flagSymbol: '🇨🇬', + nameForLocale: 'Congo - Brazzaville', + nameForRegion: 'Congo - Brazzaville', + }, + { + regionCode: 'CH', + countryCode: 41, + flagSymbol: '🇨🇭', + nameForLocale: 'Switzerland', + nameForRegion: 'Switzerland', + }, + { + regionCode: 'CI', + countryCode: 225, + flagSymbol: '🇨🇮', + nameForLocale: 'Côte d’Ivoire', + nameForRegion: 'Côte d’Ivoire', + }, + { + regionCode: 'CK', + countryCode: 682, + flagSymbol: '🇨🇰', + nameForLocale: 'Cook Islands', + nameForRegion: 'Cook Islands', + }, + { + regionCode: 'CL', + countryCode: 56, + flagSymbol: '🇨🇱', + nameForLocale: 'Chile', + nameForRegion: 'Chile', + }, + { + regionCode: 'CM', + countryCode: 237, + flagSymbol: '🇨🇲', + nameForLocale: 'Cameroon', + nameForRegion: 'Cameroon', + }, + { + regionCode: 'CN', + countryCode: 86, + flagSymbol: '🇨🇳', + nameForLocale: 'China', + nameForRegion: 'China', + }, + { + regionCode: 'CO', + countryCode: 57, + flagSymbol: '🇨🇴', + nameForLocale: 'Colombia', + nameForRegion: 'Colombia', + }, + { + regionCode: 'CR', + countryCode: 506, + flagSymbol: '🇨🇷', + nameForLocale: 'Costa Rica', + nameForRegion: 'Costa Rica', + }, + { + regionCode: 'CU', + countryCode: 53, + flagSymbol: '🇨🇺', + nameForLocale: 'Cuba', + nameForRegion: 'Cuba', + }, + { + regionCode: 'CV', + countryCode: 238, + flagSymbol: '🇨🇻', + nameForLocale: 'Cape Verde', + nameForRegion: 'Cape Verde', + }, + { + regionCode: 'CW', + countryCode: 599, + flagSymbol: '🇨🇼', + nameForLocale: 'Curaçao', + nameForRegion: 'Curaçao', + }, + { + regionCode: 'CX', + countryCode: 61, + flagSymbol: '🇨🇽', + nameForLocale: 'Christmas Island', + nameForRegion: 'Christmas Island', + }, + { + regionCode: 'CY', + countryCode: 357, + flagSymbol: '🇨🇾', + nameForLocale: 'Cyprus', + nameForRegion: 'Cyprus', + }, + { + regionCode: 'CZ', + countryCode: 420, + flagSymbol: '🇨🇿', + nameForLocale: 'Czechia', + nameForRegion: 'Czechia', + }, + { + regionCode: 'DE', + countryCode: 49, + flagSymbol: '🇩🇪', + nameForLocale: 'Germany', + nameForRegion: 'Deutschland', + }, + { + regionCode: 'DJ', + countryCode: 253, + flagSymbol: '🇩🇯', + nameForLocale: 'Djibouti', + nameForRegion: 'Djibouti', + }, + { + regionCode: 'DK', + countryCode: 45, + flagSymbol: '🇩🇰', + nameForLocale: 'Denmark', + nameForRegion: 'Denmark', + }, + { + regionCode: 'DM', + countryCode: 1, + flagSymbol: '🇩🇲', + nameForLocale: 'Dominica', + nameForRegion: 'Dominica', + }, + { + regionCode: 'DO', + countryCode: 1, + flagSymbol: '🇩🇴', + nameForLocale: 'Dominican Republic', + nameForRegion: 'Dominican Republic', + }, + { + regionCode: 'DZ', + countryCode: 213, + flagSymbol: '🇩🇿', + nameForLocale: 'Algeria', + nameForRegion: 'Algeria', + }, + { + regionCode: 'EC', + countryCode: 593, + flagSymbol: '🇪🇨', + nameForLocale: 'Ecuador', + nameForRegion: 'Ecuador', + }, + { + regionCode: 'EE', + countryCode: 372, + flagSymbol: '🇪🇪', + nameForLocale: 'Estonia', + nameForRegion: 'Estonia', + }, + { + regionCode: 'EG', + countryCode: 20, + flagSymbol: '🇪🇬', + nameForLocale: 'Egypt', + nameForRegion: 'Egypt', + }, + { + regionCode: 'EH', + countryCode: 212, + flagSymbol: '🇪🇭', + nameForLocale: 'Western Sahara', + nameForRegion: 'Western Sahara', + }, + { + regionCode: 'ER', + countryCode: 291, + flagSymbol: '🇪🇷', + nameForLocale: 'Eritrea', + nameForRegion: 'Eritrea', + }, + { + regionCode: 'ES', + countryCode: 34, + flagSymbol: '🇪🇸', + nameForLocale: 'Spain', + nameForRegion: 'España', + }, + { + regionCode: 'ET', + countryCode: 251, + flagSymbol: '🇪🇹', + nameForLocale: 'Ethiopia', + nameForRegion: 'Etioopia', + }, + { + regionCode: 'FI', + countryCode: 358, + flagSymbol: '🇫🇮', + nameForLocale: 'Finland', + nameForRegion: 'Suomi', + }, + { + regionCode: 'FJ', + countryCode: 679, + flagSymbol: '🇫🇯', + nameForLocale: 'Fiji', + nameForRegion: 'Fiji', + }, + { + regionCode: 'FK', + countryCode: 500, + flagSymbol: '🇫🇰', + nameForLocale: 'Falkland Islands (Islas Malvinas)', + nameForRegion: 'Falkland Islands (Islas Malvinas)', + }, + { + regionCode: 'FM', + countryCode: 691, + flagSymbol: '🇫🇲', + nameForLocale: 'Micronesia', + nameForRegion: 'Micronesia', + }, + { + regionCode: 'FO', + countryCode: 298, + flagSymbol: '🇫🇴', + nameForLocale: 'Faroe Islands', + nameForRegion: 'Faroe Islands', + }, + { + regionCode: 'FR', + countryCode: 33, + flagSymbol: '🇫🇷', + nameForLocale: 'France', + nameForRegion: 'France', + }, + { + regionCode: 'GA', + countryCode: 241, + flagSymbol: '🇬🇦', + nameForLocale: 'Gabon', + nameForRegion: 'Gabon', + }, + { + regionCode: 'GB', + countryCode: 44, + flagSymbol: '🇬🇧', + nameForLocale: 'United Kingdom', + nameForRegion: 'United Kingdom', + }, + { + regionCode: 'GD', + countryCode: 1, + flagSymbol: '🇬🇩', + nameForLocale: 'Grenada', + nameForRegion: 'Grenada', + }, + { + regionCode: 'GE', + countryCode: 995, + flagSymbol: '🇬🇪', + nameForLocale: 'Georgia', + nameForRegion: 'Georgia', + }, + { + regionCode: 'GF', + countryCode: 594, + flagSymbol: '🇬🇫', + nameForLocale: 'French Guiana', + nameForRegion: 'French Guiana', + }, + { + regionCode: 'GG', + countryCode: 44, + flagSymbol: '🇬🇬', + nameForLocale: 'Guernsey', + nameForRegion: 'Guernsey', + }, + { + regionCode: 'GH', + countryCode: 233, + flagSymbol: '🇬🇭', + nameForLocale: 'Ghana', + nameForRegion: 'Ghana', + }, + { + regionCode: 'GI', + countryCode: 350, + flagSymbol: '🇬🇮', + nameForLocale: 'Gibraltar', + nameForRegion: 'Gibraltar', + }, + { + regionCode: 'GL', + countryCode: 299, + flagSymbol: '🇬🇱', + nameForLocale: 'Greenland', + nameForRegion: 'Greenland', + }, + { + regionCode: 'GM', + countryCode: 220, + flagSymbol: '🇬🇲', + nameForLocale: 'Gambia', + nameForRegion: 'Gambia', + }, + { + regionCode: 'GN', + countryCode: 224, + flagSymbol: '🇬🇳', + nameForLocale: 'Guinea', + nameForRegion: 'Guinea', + }, + { + regionCode: 'GP', + countryCode: 590, + flagSymbol: '🇬🇵', + nameForLocale: 'Guadeloupe', + nameForRegion: 'Guadeloupe', + }, + { + regionCode: 'GQ', + countryCode: 240, + flagSymbol: '🇬🇶', + nameForLocale: 'Equatorial Guinea', + nameForRegion: 'Equatorial Guinea', + }, + { + regionCode: 'GR', + countryCode: 30, + flagSymbol: '🇬🇷', + nameForLocale: 'Greece', + nameForRegion: 'Greece', + }, + { + regionCode: 'GT', + countryCode: 502, + flagSymbol: '🇬🇹', + nameForLocale: 'Guatemala', + nameForRegion: 'Guatemala', + }, + { + regionCode: 'GU', + countryCode: 1, + flagSymbol: '🇬🇺', + nameForLocale: 'Guam', + nameForRegion: 'ગ્વામ', + }, + { + regionCode: 'GW', + countryCode: 245, + flagSymbol: '🇬🇼', + nameForLocale: 'Guinea-Bissau', + nameForRegion: 'Guinea-Bissau', + }, + { + regionCode: 'GY', + countryCode: 592, + flagSymbol: '🇬🇾', + nameForLocale: 'Guyana', + nameForRegion: 'Guyana', + }, + { + regionCode: 'HK', + countryCode: 852, + flagSymbol: '🇭🇰', + nameForLocale: 'Hong Kong', + nameForRegion: 'Hong Kong', + }, + { + regionCode: 'HN', + countryCode: 504, + flagSymbol: '🇭🇳', + nameForLocale: 'Honduras', + nameForRegion: 'Honduras', + }, + { + regionCode: 'HR', + countryCode: 385, + flagSymbol: '🇭🇷', + nameForLocale: 'Croatia', + nameForRegion: 'Hrvatska', + }, + { + regionCode: 'HT', + countryCode: 509, + flagSymbol: '🇭🇹', + nameForLocale: 'Haiti', + nameForRegion: 'Haiti', + }, + { + regionCode: 'HU', + countryCode: 36, + flagSymbol: '🇭🇺', + nameForLocale: 'Hungary', + nameForRegion: 'Magyarország', + }, + { + regionCode: 'ID', + countryCode: 62, + flagSymbol: '🇮🇩', + nameForLocale: 'Indonesia', + nameForRegion: 'Indonesia', + }, + { + regionCode: 'IE', + countryCode: 353, + flagSymbol: '🇮🇪', + nameForLocale: 'Ireland', + nameForRegion: 'Ireland', + }, + { + regionCode: 'IL', + countryCode: 972, + flagSymbol: '🇮🇱', + nameForLocale: 'Israel', + nameForRegion: 'Israel', + }, + { + regionCode: 'IM', + countryCode: 44, + flagSymbol: '🇮🇲', + nameForLocale: 'Isle of Man', + nameForRegion: 'Isle of Man', + }, + { + regionCode: 'IN', + countryCode: 91, + flagSymbol: '🇮🇳', + nameForLocale: 'India', + nameForRegion: 'India', + }, + { + regionCode: 'IO', + countryCode: 246, + flagSymbol: '🇮🇴', + nameForLocale: 'British Indian Ocean Territory', + nameForRegion: 'British Indian Ocean Territory', + }, + { + regionCode: 'IQ', + countryCode: 964, + flagSymbol: '🇮🇶', + nameForLocale: 'Iraq', + nameForRegion: 'Iraq', + }, + { + regionCode: 'IR', + countryCode: 98, + flagSymbol: '🇮🇷', + nameForLocale: 'Iran', + nameForRegion: 'Iran', + }, + { + regionCode: 'IS', + countryCode: 354, + flagSymbol: '🇮🇸', + nameForLocale: 'Iceland', + nameForRegion: 'Iceland', + }, + { + regionCode: 'IT', + countryCode: 39, + flagSymbol: '🇮🇹', + nameForLocale: 'Italy', + nameForRegion: 'Italia', + }, + { + regionCode: 'JE', + countryCode: 44, + flagSymbol: '🇯🇪', + nameForLocale: 'Jersey', + nameForRegion: 'Jersey', + }, + { + regionCode: 'JM', + countryCode: 1, + flagSymbol: '🇯🇲', + nameForLocale: 'Jamaica', + nameForRegion: 'Jamaica', + }, + { + regionCode: 'JO', + countryCode: 962, + flagSymbol: '🇯🇴', + nameForLocale: 'Jordan', + nameForRegion: 'Jordan', + }, + { + regionCode: 'JP', + countryCode: 81, + flagSymbol: '🇯🇵', + nameForLocale: 'Japan', + nameForRegion: 'Japan', + }, + { + regionCode: 'KE', + countryCode: 254, + flagSymbol: '🇰🇪', + nameForLocale: 'Kenya', + nameForRegion: 'Kenya', + }, + { + regionCode: 'KG', + countryCode: 996, + flagSymbol: '🇰🇬', + nameForLocale: 'Kyrgyzstan', + nameForRegion: 'Kyrgyzstan', + }, + { + regionCode: 'KH', + countryCode: 855, + flagSymbol: '🇰🇭', + nameForLocale: 'Cambodia', + nameForRegion: 'Cambodia', + }, + { + regionCode: 'KI', + countryCode: 686, + flagSymbol: '🇰🇮', + nameForLocale: 'Kiribati', + nameForRegion: 'Kiribati', + }, + { + regionCode: 'KM', + countryCode: 269, + flagSymbol: '🇰🇲', + nameForLocale: 'Comoros', + nameForRegion: 'Comoros', + }, + { + regionCode: 'KN', + countryCode: 1, + flagSymbol: '🇰🇳', + nameForLocale: 'St. Kitts & Nevis', + nameForRegion: 'ಸೇಂಟ್ ಕಿಟ್ಸ್ ಮತ್ತು ನೆವಿಸ್', + }, + { + regionCode: 'KP', + countryCode: 850, + flagSymbol: '🇰🇵', + nameForLocale: 'North Korea', + nameForRegion: 'North Korea', + }, + { + regionCode: 'KR', + countryCode: 82, + flagSymbol: '🇰🇷', + nameForLocale: 'South Korea', + nameForRegion: 'South Korea', + }, + { + regionCode: 'KW', + countryCode: 965, + flagSymbol: '🇰🇼', + nameForLocale: 'Kuwait', + nameForRegion: 'Kuwait', + }, + { + regionCode: 'KY', + countryCode: 1, + flagSymbol: '🇰🇾', + nameForLocale: 'Cayman Islands', + nameForRegion: 'Cayman Islands', + }, + { + regionCode: 'KZ', + countryCode: 7, + flagSymbol: '🇰🇿', + nameForLocale: 'Kazakhstan', + nameForRegion: 'Kazakhstan', + }, + { + regionCode: 'LA', + countryCode: 856, + flagSymbol: '🇱🇦', + nameForLocale: 'Laos', + nameForRegion: 'Laos', + }, + { + regionCode: 'LB', + countryCode: 961, + flagSymbol: '🇱🇧', + nameForLocale: 'Lebanon', + nameForRegion: 'Lebanon', + }, + { + regionCode: 'LC', + countryCode: 1, + flagSymbol: '🇱🇨', + nameForLocale: 'St. Lucia', + nameForRegion: 'St Lucia', + }, + { + regionCode: 'LI', + countryCode: 423, + flagSymbol: '🇱🇮', + nameForLocale: 'Liechtenstein', + nameForRegion: 'Liechtenstein', + }, + { + regionCode: 'LK', + countryCode: 94, + flagSymbol: '🇱🇰', + nameForLocale: 'Sri Lanka', + nameForRegion: 'Sri Lanka', + }, + { + regionCode: 'LR', + countryCode: 231, + flagSymbol: '🇱🇷', + nameForLocale: 'Liberia', + nameForRegion: 'Liberia', + }, + { + regionCode: 'LS', + countryCode: 266, + flagSymbol: '🇱🇸', + nameForLocale: 'Lesotho', + nameForRegion: 'Lesotho', + }, + { + regionCode: 'LT', + countryCode: 370, + flagSymbol: '🇱🇹', + nameForLocale: 'Lithuania', + nameForRegion: 'Lietuva', + }, + { + regionCode: 'LU', + countryCode: 352, + flagSymbol: '🇱🇺', + nameForLocale: 'Luxembourg', + nameForRegion: 'Luxembourg', + }, + { + regionCode: 'LV', + countryCode: 371, + flagSymbol: '🇱🇻', + nameForLocale: 'Latvia', + nameForRegion: 'Latvija', + }, + { + regionCode: 'LY', + countryCode: 218, + flagSymbol: '🇱🇾', + nameForLocale: 'Libya', + nameForRegion: 'Libya', + }, + { + regionCode: 'MA', + countryCode: 212, + flagSymbol: '🇲🇦', + nameForLocale: 'Morocco', + nameForRegion: 'Morocco', + }, + { + regionCode: 'MC', + countryCode: 377, + flagSymbol: '🇲🇨', + nameForLocale: 'Monaco', + nameForRegion: 'Monaco', + }, + { + regionCode: 'MD', + countryCode: 373, + flagSymbol: '🇲🇩', + nameForLocale: 'Moldova', + nameForRegion: 'Moldova', + }, + { + regionCode: 'ME', + countryCode: 382, + flagSymbol: '🇲🇪', + nameForLocale: 'Montenegro', + nameForRegion: 'Montenegro', + }, + { + regionCode: 'MF', + countryCode: 590, + flagSymbol: '🇲🇫', + nameForLocale: 'St. Martin', + nameForRegion: 'St Martin', + }, + { + regionCode: 'MG', + countryCode: 261, + flagSymbol: '🇲🇬', + nameForLocale: 'Madagascar', + nameForRegion: 'Madagascar', + }, + { + regionCode: 'MH', + countryCode: 692, + flagSymbol: '🇲🇭', + nameForLocale: 'Marshall Islands', + nameForRegion: 'Marshall Islands', + }, + { + regionCode: 'MK', + countryCode: 389, + flagSymbol: '🇲🇰', + nameForLocale: 'North Macedonia', + nameForRegion: 'North Macedonia', + }, + { + regionCode: 'ML', + countryCode: 223, + flagSymbol: '🇲🇱', + nameForLocale: 'Mali', + nameForRegion: 'മാലി', + }, + { + regionCode: 'MM', + countryCode: 95, + flagSymbol: '🇲🇲', + nameForLocale: 'Myanmar (Burma)', + nameForRegion: 'Myanmar (Burma)', + }, + { + regionCode: 'MN', + countryCode: 976, + flagSymbol: '🇲🇳', + nameForLocale: 'Mongolia', + nameForRegion: 'Mongolia', + }, + { + regionCode: 'MO', + countryCode: 853, + flagSymbol: '🇲🇴', + nameForLocale: 'Macao', + nameForRegion: 'Macao', + }, + { + regionCode: 'MP', + countryCode: 1, + flagSymbol: '🇲🇵', + nameForLocale: 'Northern Mariana Islands', + nameForRegion: 'Northern Mariana Islands', + }, + { + regionCode: 'MQ', + countryCode: 596, + flagSymbol: '🇲🇶', + nameForLocale: 'Martinique', + nameForRegion: 'Martinique', + }, + { + regionCode: 'MR', + countryCode: 222, + flagSymbol: '🇲🇷', + nameForLocale: 'Mauritania', + nameForRegion: 'मॉरिटानिया', + }, + { + regionCode: 'MS', + countryCode: 1, + flagSymbol: '🇲🇸', + nameForLocale: 'Montserrat', + nameForRegion: 'Montserrat', + }, + { + regionCode: 'MT', + countryCode: 356, + flagSymbol: '🇲🇹', + nameForLocale: 'Malta', + nameForRegion: 'Malta', + }, + { + regionCode: 'MU', + countryCode: 230, + flagSymbol: '🇲🇺', + nameForLocale: 'Mauritius', + nameForRegion: 'Mauritius', + }, + { + regionCode: 'MV', + countryCode: 960, + flagSymbol: '🇲🇻', + nameForLocale: 'Maldives', + nameForRegion: 'Maldives', + }, + { + regionCode: 'MW', + countryCode: 265, + flagSymbol: '🇲🇼', + nameForLocale: 'Malawi', + nameForRegion: 'Malawi', + }, + { + regionCode: 'MX', + countryCode: 52, + flagSymbol: '🇲🇽', + nameForLocale: 'Mexico', + nameForRegion: 'Mexico', + }, + { + regionCode: 'MY', + countryCode: 60, + flagSymbol: '🇲🇾', + nameForLocale: 'Malaysia', + nameForRegion: 'Malaysia', + }, + { + regionCode: 'MZ', + countryCode: 258, + flagSymbol: '🇲🇿', + nameForLocale: 'Mozambique', + nameForRegion: 'Mozambique', + }, + { + regionCode: 'NA', + countryCode: 264, + flagSymbol: '🇳🇦', + nameForLocale: 'Namibia', + nameForRegion: 'Namibia', + }, + { + regionCode: 'NC', + countryCode: 687, + flagSymbol: '🇳🇨', + nameForLocale: 'New Caledonia', + nameForRegion: 'New Caledonia', + }, + { + regionCode: 'NE', + countryCode: 227, + flagSymbol: '🇳🇪', + nameForLocale: 'Niger', + nameForRegion: 'Niger', + }, + { + regionCode: 'NF', + countryCode: 672, + flagSymbol: '🇳🇫', + nameForLocale: 'Norfolk Island', + nameForRegion: 'Norfolk Island', + }, + { + regionCode: 'NG', + countryCode: 234, + flagSymbol: '🇳🇬', + nameForLocale: 'Nigeria', + nameForRegion: 'Nigeria', + }, + { + regionCode: 'NI', + countryCode: 505, + flagSymbol: '🇳🇮', + nameForLocale: 'Nicaragua', + nameForRegion: 'Nicaragua', + }, + { + regionCode: 'NL', + countryCode: 31, + flagSymbol: '🇳🇱', + nameForLocale: 'Netherlands', + nameForRegion: 'Nederland', + }, + { + regionCode: 'NO', + countryCode: 47, + flagSymbol: '🇳🇴', + nameForLocale: 'Norway', + nameForRegion: 'Norge', + }, + { + regionCode: 'NP', + countryCode: 977, + flagSymbol: '🇳🇵', + nameForLocale: 'Nepal', + nameForRegion: 'Nepal', + }, + { + regionCode: 'NR', + countryCode: 674, + flagSymbol: '🇳🇷', + nameForLocale: 'Nauru', + nameForRegion: 'Nauru', + }, + { + regionCode: 'NU', + countryCode: 683, + flagSymbol: '🇳🇺', + nameForLocale: 'Niue', + nameForRegion: 'Niue', + }, + { + regionCode: 'NZ', + countryCode: 64, + flagSymbol: '🇳🇿', + nameForLocale: 'New Zealand', + nameForRegion: 'New Zealand', + }, + { + regionCode: 'OM', + countryCode: 968, + flagSymbol: '🇴🇲', + nameForLocale: 'Oman', + nameForRegion: 'Oman', + }, + { + regionCode: 'PA', + countryCode: 507, + flagSymbol: '🇵🇦', + nameForLocale: 'Panama', + nameForRegion: 'Panama', + }, + { + regionCode: 'PE', + countryCode: 51, + flagSymbol: '🇵🇪', + nameForLocale: 'Peru', + nameForRegion: 'Peru', + }, + { + regionCode: 'PF', + countryCode: 689, + flagSymbol: '🇵🇫', + nameForLocale: 'French Polynesia', + nameForRegion: 'French Polynesia', + }, + { + regionCode: 'PG', + countryCode: 675, + flagSymbol: '🇵🇬', + nameForLocale: 'Papua New Guinea', + nameForRegion: 'Papua New Guinea', + }, + { + regionCode: 'PH', + countryCode: 63, + flagSymbol: '🇵🇭', + nameForLocale: 'Philippines', + nameForRegion: 'Philippines', + }, + { + regionCode: 'PK', + countryCode: 92, + flagSymbol: '🇵🇰', + nameForLocale: 'Pakistan', + nameForRegion: 'Pakistan', + }, + { + regionCode: 'PL', + countryCode: 48, + flagSymbol: '🇵🇱', + nameForLocale: 'Poland', + nameForRegion: 'Polska', + }, + { + regionCode: 'PM', + countryCode: 508, + flagSymbol: '🇵🇲', + nameForLocale: 'St. Pierre & Miquelon', + nameForRegion: 'St Pierre & Miquelon', + }, + { + regionCode: 'PR', + countryCode: 1, + flagSymbol: '🇵🇷', + nameForLocale: 'Puerto Rico', + nameForRegion: 'Puerto Rico', + }, + { + regionCode: 'PS', + countryCode: 970, + flagSymbol: '🇵🇸', + nameForLocale: 'Palestine', + nameForRegion: 'Palestine', + }, + { + regionCode: 'PT', + countryCode: 351, + flagSymbol: '🇵🇹', + nameForLocale: 'Portugal', + nameForRegion: 'Portugal', + }, + { + regionCode: 'PW', + countryCode: 680, + flagSymbol: '🇵🇼', + nameForLocale: 'Palau', + nameForRegion: 'Palau', + }, + { + regionCode: 'PY', + countryCode: 595, + flagSymbol: '🇵🇾', + nameForLocale: 'Paraguay', + nameForRegion: 'Paraguay', + }, + { + regionCode: 'QA', + countryCode: 974, + flagSymbol: '🇶🇦', + nameForLocale: 'Qatar', + nameForRegion: 'Qatar', + }, + { + regionCode: 'RE', + countryCode: 262, + flagSymbol: '🇷🇪', + nameForLocale: 'Réunion', + nameForRegion: 'Réunion', + }, + { + regionCode: 'RO', + countryCode: 40, + flagSymbol: '🇷🇴', + nameForLocale: 'Romania', + nameForRegion: 'România', + }, + { + regionCode: 'RS', + countryCode: 381, + flagSymbol: '🇷🇸', + nameForLocale: 'Serbia', + nameForRegion: 'Serbia', + }, + { + regionCode: 'RU', + countryCode: 7, + flagSymbol: '🇷🇺', + nameForLocale: 'Russia', + nameForRegion: 'Россия', + }, + { + regionCode: 'RW', + countryCode: 250, + flagSymbol: '🇷🇼', + nameForLocale: 'Rwanda', + nameForRegion: 'Rwanda', + }, + { + regionCode: 'SA', + countryCode: 966, + flagSymbol: '🇸🇦', + nameForLocale: 'Saudi Arabia', + nameForRegion: 'Saudi Arabia', + }, + { + regionCode: 'SB', + countryCode: 677, + flagSymbol: '🇸🇧', + nameForLocale: 'Solomon Islands', + nameForRegion: 'Solomon Islands', + }, + { + regionCode: 'SC', + countryCode: 248, + flagSymbol: '🇸🇨', + nameForLocale: 'Seychelles', + nameForRegion: 'Seychelles', + }, + { + regionCode: 'SD', + countryCode: 249, + flagSymbol: '🇸🇩', + nameForLocale: 'Sudan', + nameForRegion: 'Sudan', + }, + { + regionCode: 'SE', + countryCode: 46, + flagSymbol: '🇸🇪', + nameForLocale: 'Sweden', + nameForRegion: 'Sweden', + }, + { + regionCode: 'SG', + countryCode: 65, + flagSymbol: '🇸🇬', + nameForLocale: 'Singapore', + nameForRegion: 'Singapore', + }, + { + regionCode: 'SH', + countryCode: 290, + flagSymbol: '🇸🇭', + nameForLocale: 'St. Helena', + nameForRegion: 'Sveta Jelena', + }, + { + regionCode: 'SI', + countryCode: 386, + flagSymbol: '🇸🇮', + nameForLocale: 'Slovenia', + nameForRegion: 'Slovenia', + }, + { + regionCode: 'SJ', + countryCode: 47, + flagSymbol: '🇸🇯', + nameForLocale: 'Svalbard & Jan Mayen', + nameForRegion: 'Svalbard & Jan Mayen', + }, + { + regionCode: 'SK', + countryCode: 421, + flagSymbol: '🇸🇰', + nameForLocale: 'Slovakia', + nameForRegion: 'Slovensko', + }, + { + regionCode: 'SL', + countryCode: 232, + flagSymbol: '🇸🇱', + nameForLocale: 'Sierra Leone', + nameForRegion: 'Sierra Leone', + }, + { + regionCode: 'SM', + countryCode: 378, + flagSymbol: '🇸🇲', + nameForLocale: 'San Marino', + nameForRegion: 'San Marino', + }, + { + regionCode: 'SN', + countryCode: 221, + flagSymbol: '🇸🇳', + nameForLocale: 'Senegal', + nameForRegion: 'Senegal', + }, + { + regionCode: 'SO', + countryCode: 252, + flagSymbol: '🇸🇴', + nameForLocale: 'Somalia', + nameForRegion: 'Somalia', + }, + { + regionCode: 'SR', + countryCode: 597, + flagSymbol: '🇸🇷', + nameForLocale: 'Suriname', + nameForRegion: 'Суринам', + }, + { + regionCode: 'SS', + countryCode: 211, + flagSymbol: '🇸🇸', + nameForLocale: 'South Sudan', + nameForRegion: 'South Sudan', + }, + { + regionCode: 'ST', + countryCode: 239, + flagSymbol: '🇸🇹', + nameForLocale: 'São Tomé & Príncipe', + nameForRegion: 'São Tomé & Príncipe', + }, + { + regionCode: 'SV', + countryCode: 503, + flagSymbol: '🇸🇻', + nameForLocale: 'El Salvador', + nameForRegion: 'El Salvador', + }, + { + regionCode: 'SX', + countryCode: 1, + flagSymbol: '🇸🇽', + nameForLocale: 'Sint Maarten', + nameForRegion: 'Sint Maarten', + }, + { + regionCode: 'SY', + countryCode: 963, + flagSymbol: '🇸🇾', + nameForLocale: 'Syria', + nameForRegion: 'Syria', + }, + { + regionCode: 'SZ', + countryCode: 268, + flagSymbol: '🇸🇿', + nameForLocale: 'Eswatini', + nameForRegion: 'Eswatini', + }, + { + regionCode: 'TA', + countryCode: 290, + flagSymbol: '🇹🇦', + nameForLocale: 'Tristan da Cunha', + nameForRegion: 'டிரிஸ்டன் டா குன்ஹா', + }, + { + regionCode: 'TC', + countryCode: 1, + flagSymbol: '🇹🇨', + nameForLocale: 'Turks & Caicos Islands', + nameForRegion: 'Turks & Caicos Islands', + }, + { + regionCode: 'TD', + countryCode: 235, + flagSymbol: '🇹🇩', + nameForLocale: 'Chad', + nameForRegion: 'Chad', + }, + { + regionCode: 'TG', + countryCode: 228, + flagSymbol: '🇹🇬', + nameForLocale: 'Togo', + nameForRegion: 'Togo', + }, + { + regionCode: 'TH', + countryCode: 66, + flagSymbol: '🇹🇭', + nameForLocale: 'Thailand', + nameForRegion: 'ไทย', + }, + { + regionCode: 'TJ', + countryCode: 992, + flagSymbol: '🇹🇯', + nameForLocale: 'Tajikistan', + nameForRegion: 'Tajikistan', + }, + { + regionCode: 'TK', + countryCode: 690, + flagSymbol: '🇹🇰', + nameForLocale: 'Tokelau', + nameForRegion: 'Tokelau', + }, + { + regionCode: 'TL', + countryCode: 670, + flagSymbol: '🇹🇱', + nameForLocale: 'Timor-Leste', + nameForRegion: 'Timor-Leste', + }, + { + regionCode: 'TM', + countryCode: 993, + flagSymbol: '🇹🇲', + nameForLocale: 'Turkmenistan', + nameForRegion: 'Turkmenistan', + }, + { + regionCode: 'TN', + countryCode: 216, + flagSymbol: '🇹🇳', + nameForLocale: 'Tunisia', + nameForRegion: 'Tunisia', + }, + { + regionCode: 'TO', + countryCode: 676, + flagSymbol: '🇹🇴', + nameForLocale: 'Tonga', + nameForRegion: 'Tonga', + }, + { + regionCode: 'TR', + countryCode: 90, + flagSymbol: '🇹🇷', + nameForLocale: 'Turkey', + nameForRegion: 'Türkiye', + }, + { + regionCode: 'TT', + countryCode: 1, + flagSymbol: '🇹🇹', + nameForLocale: 'Trinidad & Tobago', + nameForRegion: 'Trinidad & Tobago', + }, + { + regionCode: 'TV', + countryCode: 688, + flagSymbol: '🇹🇻', + nameForLocale: 'Tuvalu', + nameForRegion: 'Tuvalu', + }, + { + regionCode: 'TW', + countryCode: 886, + flagSymbol: '🇹🇼', + nameForLocale: 'Taiwan', + nameForRegion: 'Taiwan', + }, + { + regionCode: 'TZ', + countryCode: 255, + flagSymbol: '🇹🇿', + nameForLocale: 'Tanzania', + nameForRegion: 'Tanzania', + }, + { + regionCode: 'UA', + countryCode: 380, + flagSymbol: '🇺🇦', + nameForLocale: 'Ukraine', + nameForRegion: 'Ukraine', + }, + { + regionCode: 'UG', + countryCode: 256, + flagSymbol: '🇺🇬', + nameForLocale: 'Uganda', + nameForRegion: 'Uganda', + }, + { + regionCode: 'US', + countryCode: 1, + flagSymbol: '🇺🇸', + nameForLocale: 'United States', + nameForRegion: 'United States', + }, + { + regionCode: 'UY', + countryCode: 598, + flagSymbol: '🇺🇾', + nameForLocale: 'Uruguay', + nameForRegion: 'Uruguay', + }, + { + regionCode: 'UZ', + countryCode: 998, + flagSymbol: '🇺🇿', + nameForLocale: 'Uzbekistan', + nameForRegion: 'Uzbekistan', + }, + { + regionCode: 'VA', + countryCode: 39, + flagSymbol: '🇻🇦', + nameForLocale: 'Vatican City', + nameForRegion: 'Vatican City', + }, + { + regionCode: 'VC', + countryCode: 1, + flagSymbol: '🇻🇨', + nameForLocale: 'St. Vincent & Grenadines', + nameForRegion: 'St Vincent & the Grenadines', + }, + { + regionCode: 'VE', + countryCode: 58, + flagSymbol: '🇻🇪', + nameForLocale: 'Venezuela', + nameForRegion: 'Venezuela', + }, + { + regionCode: 'VG', + countryCode: 1, + flagSymbol: '🇻🇬', + nameForLocale: 'British Virgin Islands', + nameForRegion: 'British Virgin Islands', + }, + { + regionCode: 'VI', + countryCode: 1, + flagSymbol: '🇻🇮', + nameForLocale: 'U.S. Virgin Islands', + nameForRegion: 'Quần đảo Virgin thuộc Hoa Kỳ', + }, + { + regionCode: 'VN', + countryCode: 84, + flagSymbol: '🇻🇳', + nameForLocale: 'Vietnam', + nameForRegion: 'Vietnam', + }, + { + regionCode: 'VU', + countryCode: 678, + flagSymbol: '🇻🇺', + nameForLocale: 'Vanuatu', + nameForRegion: 'Vanuatu', + }, + { + regionCode: 'WF', + countryCode: 681, + flagSymbol: '🇼🇫', + nameForLocale: 'Wallis & Futuna', + nameForRegion: 'Wallis & Futuna', + }, + { + regionCode: 'WS', + countryCode: 685, + flagSymbol: '🇼🇸', + nameForLocale: 'Samoa', + nameForRegion: 'Samoa', + }, + { + regionCode: 'XK', + countryCode: 383, + flagSymbol: '🇽🇰', + nameForLocale: 'Kosovo', + nameForRegion: 'Kosovo', + }, + { + regionCode: 'YE', + countryCode: 967, + flagSymbol: '🇾🇪', + nameForLocale: 'Yemen', + nameForRegion: 'Yemen', + }, + { + regionCode: 'YT', + countryCode: 262, + flagSymbol: '🇾🇹', + nameForLocale: 'Mayotte', + nameForRegion: 'Mayotte', + }, + { + regionCode: 'ZA', + countryCode: 27, + flagSymbol: '🇿🇦', + nameForLocale: 'South Africa', + nameForRegion: 'South Africa', + }, + { + regionCode: 'ZM', + countryCode: 260, + flagSymbol: '🇿🇲', + nameForLocale: 'Zambia', + nameForRegion: 'Zambia', + }, + { + regionCode: 'ZW', + countryCode: 263, + flagSymbol: '🇿🇼', + nameForLocale: 'Zimbabwe', + nameForRegion: 'Zimbabwe', + }, +]; diff --git a/packages/ui/docs/components/select-rich/use-cases.md b/packages/ui/docs/components/select-rich/use-cases.md new file mode 100644 index 000000000..7ab9a4bbd --- /dev/null +++ b/packages/ui/docs/components/select-rich/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/select-rich/use-cases.md) diff --git a/packages/ui/docs/components/select/index.md b/packages/ui/docs/components/select/index.md new file mode 100644 index 000000000..510c4df69 --- /dev/null +++ b/packages/ui/docs/components/select/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/select/index.md) diff --git a/packages/ui/docs/components/select/overview.md b/packages/ui/docs/components/select/overview.md new file mode 100644 index 000000000..43ac119aa --- /dev/null +++ b/packages/ui/docs/components/select/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/select/overview.md) diff --git a/packages/ui/docs/components/select/use-cases.md b/packages/ui/docs/components/select/use-cases.md new file mode 100644 index 000000000..a31dd2cb1 --- /dev/null +++ b/packages/ui/docs/components/select/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/select/use-cases.md) diff --git a/packages/ui/docs/components/steps/index.md b/packages/ui/docs/components/steps/index.md new file mode 100644 index 000000000..ac395b0fc --- /dev/null +++ b/packages/ui/docs/components/steps/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/steps/index.md) diff --git a/packages/ui/docs/components/steps/overview.md b/packages/ui/docs/components/steps/overview.md new file mode 100644 index 000000000..4ca067f33 --- /dev/null +++ b/packages/ui/docs/components/steps/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/steps/overview.md) diff --git a/packages/ui/docs/components/steps/use-cases.md b/packages/ui/docs/components/steps/use-cases.md new file mode 100644 index 000000000..b099175f0 --- /dev/null +++ b/packages/ui/docs/components/steps/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/steps/use-cases.md) diff --git a/packages/ui/docs/components/switch/index.md b/packages/ui/docs/components/switch/index.md new file mode 100644 index 000000000..876a35e52 --- /dev/null +++ b/packages/ui/docs/components/switch/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/switch/index.md) diff --git a/packages/ui/docs/components/switch/overview.md b/packages/ui/docs/components/switch/overview.md new file mode 100644 index 000000000..36dcbc3a3 --- /dev/null +++ b/packages/ui/docs/components/switch/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/switch/overview.md) diff --git a/packages/ui/docs/components/switch/reference.md b/packages/ui/docs/components/switch/reference.md new file mode 100644 index 000000000..54de976f1 --- /dev/null +++ b/packages/ui/docs/components/switch/reference.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/switch/reference.md) diff --git a/packages/ui/docs/components/switch/use-cases.md b/packages/ui/docs/components/switch/use-cases.md new file mode 100644 index 000000000..eb5854e2b --- /dev/null +++ b/packages/ui/docs/components/switch/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/switch/use-cases.md) diff --git a/packages/ui/docs/components/tabs/examples.md b/packages/ui/docs/components/tabs/examples.md new file mode 100644 index 000000000..581af338c --- /dev/null +++ b/packages/ui/docs/components/tabs/examples.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/tabs/examples.md) diff --git a/packages/ui/docs/components/tabs/index.md b/packages/ui/docs/components/tabs/index.md new file mode 100644 index 000000000..667ee2fd3 --- /dev/null +++ b/packages/ui/docs/components/tabs/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/tabs/index.md) diff --git a/packages/ui/docs/components/tabs/overview.md b/packages/ui/docs/components/tabs/overview.md new file mode 100644 index 000000000..54019bdaa --- /dev/null +++ b/packages/ui/docs/components/tabs/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/tabs/overview.md) diff --git a/packages/ui/docs/components/tabs/src/lea-tab-panel.js b/packages/ui/docs/components/tabs/src/lea-tab-panel.js new file mode 100644 index 000000000..dfe27f1e2 --- /dev/null +++ b/packages/ui/docs/components/tabs/src/lea-tab-panel.js @@ -0,0 +1,24 @@ +import { LitElement, html, css } from 'lit'; + +export class LeaTabPanel extends LitElement { + static get styles() { + return css` + :host { + background-color: #fff; + background-image: linear-gradient(top, #fff, #ddd); + border-radius: 0 2px 2px 2px; + box-shadow: 0 2px 2px #000, 0 -1px 0 #fff inset; + padding: 30px; + } + `; + } + + render() { + return html` + + + `; + } +} + +customElements.define('lea-tab-panel', LeaTabPanel); diff --git a/packages/ui/docs/components/tabs/src/lea-tab.js b/packages/ui/docs/components/tabs/src/lea-tab.js new file mode 100644 index 000000000..752cd5a4d --- /dev/null +++ b/packages/ui/docs/components/tabs/src/lea-tab.js @@ -0,0 +1,45 @@ +import { css, html, LitElement } from 'lit'; + +export class LeaTab extends LitElement { + static get styles() { + return css` + :host { + box-shadow: -4px 0 0 rgba(0, 0, 0, 0.2); + background: #ad1c1c; + background: linear-gradient(220deg, transparent 10px, #ad1c1c 10px); + text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); + color: #fff; + float: left; + font: bold 12px/35px 'Lucida sans', Arial, Helvetica; + height: 35px; + padding: 0 30px; + text-decoration: none; + } + + :host(:hover) { + background: #c93434; + background: linear-gradient(220deg, transparent 10px, #c93434 10px); + } + + :host(:focus) { + border-radius: 4px; + box-shadow: 0 0 8px #9fcaea, 0 0 0 1px #559bd1; + + /* outline: 0; */ + } + + :host([selected]) { + background: #fff; + background: linear-gradient(220deg, transparent 10px, #fff 10px); + text-shadow: none; + color: #333; + } + `; + } + + render() { + return html``; + } +} + +customElements.define('lea-tab', LeaTab); diff --git a/packages/ui/docs/components/tabs/src/lea-tabs.js b/packages/ui/docs/components/tabs/src/lea-tabs.js new file mode 100644 index 000000000..06165f2ec --- /dev/null +++ b/packages/ui/docs/components/tabs/src/lea-tabs.js @@ -0,0 +1,28 @@ +import { css } from 'lit'; +import { LionTabs } from '@lion/ui/tabs.js'; + +export class LeaTabs extends LionTabs { + static get styles() { + return [ + ...super.styles, + css` + :host { + background: #222; + display: block; + padding: 20px; + } + `, + ]; + } + + connectedCallback() { + super.connectedCallback(); + this._setupFeature(); + } + + _setupFeature() { + // being awesome + } +} + +customElements.define('lea-tabs', LeaTabs); diff --git a/packages/ui/docs/components/tabs/use-cases.md b/packages/ui/docs/components/tabs/use-cases.md new file mode 100644 index 000000000..66c5887c0 --- /dev/null +++ b/packages/ui/docs/components/tabs/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/tabs/use-cases.md) diff --git a/packages/ui/docs/components/textarea/index.md b/packages/ui/docs/components/textarea/index.md new file mode 100644 index 000000000..2c7174020 --- /dev/null +++ b/packages/ui/docs/components/textarea/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/textarea/index.md) diff --git a/packages/ui/docs/components/textarea/overview.md b/packages/ui/docs/components/textarea/overview.md new file mode 100644 index 000000000..214a4354a --- /dev/null +++ b/packages/ui/docs/components/textarea/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/textarea/overview.md) diff --git a/packages/ui/docs/components/textarea/use-cases.md b/packages/ui/docs/components/textarea/use-cases.md new file mode 100644 index 000000000..f33a2793c --- /dev/null +++ b/packages/ui/docs/components/textarea/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/textarea/use-cases.md) diff --git a/packages/ui/docs/components/tooltip/examples.md b/packages/ui/docs/components/tooltip/examples.md new file mode 100644 index 000000000..338cb15b9 --- /dev/null +++ b/packages/ui/docs/components/tooltip/examples.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/tooltip/examples.md) diff --git a/packages/ui/docs/components/tooltip/index.md b/packages/ui/docs/components/tooltip/index.md new file mode 100644 index 000000000..cea7c303e --- /dev/null +++ b/packages/ui/docs/components/tooltip/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/tooltip/index.md) diff --git a/packages/ui/docs/components/tooltip/overview.md b/packages/ui/docs/components/tooltip/overview.md new file mode 100644 index 000000000..9735e8d45 --- /dev/null +++ b/packages/ui/docs/components/tooltip/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/tooltip/overview.md) diff --git a/packages/ui/docs/components/tooltip/use-cases.md b/packages/ui/docs/components/tooltip/use-cases.md new file mode 100644 index 000000000..84b509f69 --- /dev/null +++ b/packages/ui/docs/components/tooltip/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/components/tooltip/use-cases.md) diff --git a/packages/ui/docs/fundamentals/index.md b/packages/ui/docs/fundamentals/index.md new file mode 100644 index 000000000..a8c92f8a6 --- /dev/null +++ b/packages/ui/docs/fundamentals/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../docs/fundamentals/index.md) diff --git a/packages/ui/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md b/packages/ui/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md new file mode 100644 index 000000000..cad961a61 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md) diff --git a/packages/ui/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md b/packages/ui/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md new file mode 100644 index 000000000..aa9d01bbc --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md) diff --git a/packages/ui/docs/fundamentals/node-tools/index.md b/packages/ui/docs/fundamentals/node-tools/index.md new file mode 100644 index 000000000..7ed0e87f5 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/fundamentals/node-tools/index.md) diff --git a/packages/ui/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md b/packages/ui/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md new file mode 100644 index 000000000..a3c6fb60b --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md) diff --git a/packages/ui/docs/fundamentals/node-tools/providence-analytics/QueryResult.md b/packages/ui/docs/fundamentals/node-tools/providence-analytics/QueryResult.md new file mode 100644 index 000000000..ff3cbd1f3 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/providence-analytics/QueryResult.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/providence-analytics/QueryResult.md) diff --git a/packages/ui/docs/fundamentals/node-tools/providence-analytics/analyzer.md b/packages/ui/docs/fundamentals/node-tools/providence-analytics/analyzer.md new file mode 100644 index 000000000..e9cccd4c8 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/providence-analytics/analyzer.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/providence-analytics/analyzer.md) diff --git a/packages/ui/docs/fundamentals/node-tools/providence-analytics/assets/_mermaid.svg.js b/packages/ui/docs/fundamentals/node-tools/providence-analytics/assets/_mermaid.svg.js new file mode 100644 index 000000000..189e03117 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/providence-analytics/assets/_mermaid.svg.js @@ -0,0 +1,1202 @@ +import { html } from 'lit-html'; + +/* + +```mermaid +graph TD; + queryConfig-->providence; + ProvidenceConfig-->providence; + providence-->QueryResult; +``` + +*/ +export const providenceFlowSvg = html` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+ + + + + +
+ queryConfig +
+
+
+
+ + + + +
+ providence +
+
+
+
+ + + + +
+ ProvidenceConfig +
+
+
+
+ + + + +
+ QueryResult +
+
+
+
+
+
+
+
`; + +/* + +```mermaid +sequenceDiagram + participant providence + participant InputDataService + participant QueryService + participant ReportService + providence->>InputDataService: Give all search targets, based on 'queryConfig' + InputDataService->>providence: 'InputData' + providence->>QueryService: Run query, based on 'queryConfig' + QueryService->>providence: 'QueryResult' + providence->>ReportService: Give a report, based on 'QueryResult' and 'ProvidenceConfig' + ReportService->>providence: Done... +``` + +*/ +export const providenceInternalFlowSvg = html` + + + + + + + + + providence + + + + + + + InputDataService + + + + + + + QueryService + + + + + + + ReportService + + + + + + + + + + + + + + + + Give all search targets, based on 'queryConfig' + + + + + 'InputData' + + + + + Run query, based on 'queryConfig' + + + + + 'QueryResult' + + + + + Give a report, based on 'QueryResult' and 'ProvidenceConfig' + + + + + Done... + + + + + + providence + + + + + + InputDataService + + + + + + QueryService + + + + + + ReportService + + + +`; diff --git a/packages/ui/docs/fundamentals/node-tools/providence-analytics/dashboard.md b/packages/ui/docs/fundamentals/node-tools/providence-analytics/dashboard.md new file mode 100644 index 000000000..e9ba30bd9 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/providence-analytics/dashboard.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/providence-analytics/dashboard.md) diff --git a/packages/ui/docs/fundamentals/node-tools/providence-analytics/index.md b/packages/ui/docs/fundamentals/node-tools/providence-analytics/index.md new file mode 100644 index 000000000..65f2ffe70 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/providence-analytics/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/providence-analytics/index.md) diff --git a/packages/ui/docs/fundamentals/node-tools/providence-analytics/overview.md b/packages/ui/docs/fundamentals/node-tools/providence-analytics/overview.md new file mode 100644 index 000000000..75ac17416 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/providence-analytics/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/providence-analytics/overview.md) diff --git a/packages/ui/docs/fundamentals/node-tools/publish-docs/index.md b/packages/ui/docs/fundamentals/node-tools/publish-docs/index.md new file mode 100644 index 000000000..774de2bdc --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/publish-docs/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/publish-docs/index.md) diff --git a/packages/ui/docs/fundamentals/node-tools/publish-docs/overview.md b/packages/ui/docs/fundamentals/node-tools/publish-docs/overview.md new file mode 100644 index 000000000..821b2387e --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/publish-docs/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/publish-docs/overview.md) diff --git a/packages/ui/docs/fundamentals/node-tools/remark-extend/index.md b/packages/ui/docs/fundamentals/node-tools/remark-extend/index.md new file mode 100644 index 000000000..2dcee2d51 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/remark-extend/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/remark-extend/index.md) diff --git a/packages/ui/docs/fundamentals/node-tools/remark-extend/overview.md b/packages/ui/docs/fundamentals/node-tools/remark-extend/overview.md new file mode 100644 index 000000000..39d33203c --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/remark-extend/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/remark-extend/overview.md) diff --git a/packages/ui/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md b/packages/ui/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md new file mode 100644 index 000000000..fa24ee81b --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md) diff --git a/packages/ui/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md b/packages/ui/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md new file mode 100644 index 000000000..e751b0df5 --- /dev/null +++ b/packages/ui/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md) diff --git a/packages/ui/docs/fundamentals/rationales/TypeScript.md b/packages/ui/docs/fundamentals/rationales/TypeScript.md new file mode 100644 index 000000000..edc7a8cf0 --- /dev/null +++ b/packages/ui/docs/fundamentals/rationales/TypeScript.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/fundamentals/rationales/TypeScript.md) diff --git a/packages/ui/docs/fundamentals/rationales/index.md b/packages/ui/docs/fundamentals/rationales/index.md new file mode 100644 index 000000000..9d91f2d80 --- /dev/null +++ b/packages/ui/docs/fundamentals/rationales/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/fundamentals/rationales/index.md) diff --git a/packages/ui/docs/fundamentals/rationales/side-effects.md b/packages/ui/docs/fundamentals/rationales/side-effects.md new file mode 100644 index 000000000..f6b8c98e4 --- /dev/null +++ b/packages/ui/docs/fundamentals/rationales/side-effects.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/fundamentals/rationales/side-effects.md) diff --git a/packages/ui/docs/fundamentals/rationales/versioning.md b/packages/ui/docs/fundamentals/rationales/versioning.md new file mode 100644 index 000000000..c4130bb2c --- /dev/null +++ b/packages/ui/docs/fundamentals/rationales/versioning.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/fundamentals/rationales/versioning.md) diff --git a/packages/ui/docs/fundamentals/systems/core/index.md b/packages/ui/docs/fundamentals/systems/core/index.md new file mode 100644 index 000000000..811b1b4a5 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/core/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/core/index.md) diff --git a/packages/ui/docs/fundamentals/systems/core/overview.md b/packages/ui/docs/fundamentals/systems/core/overview.md new file mode 100644 index 000000000..74694a121 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/core/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/core/overview.md) diff --git a/packages/ui/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg b/packages/ui/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg new file mode 100644 index 000000000..a162f4423 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg @@ -0,0 +1 @@ +formattedValueUser(inputElement.input)valuemodelValueserializedValueparserserializerdeserializersyncpreprocesson-blurdelegatesyncformatter5interact123445761. User changes the input 2. Native input syncs with lion-input-date value and gets preprocessed3. Value is parsed to modelValue4. modelValue is formatted to formattedValue and modelValue is serialized to serializedValue 5. User blurs the field. Input gets validated by ValidateMixin6. formattedValue synced back to the value (preventRecursiveTrigger prevents infinite looping)7. Value is delegated back to native input value (what the user sees) “10/30/2010”“10/30/2010”[DateObject] “30-10-2010”“2010-10-30T00:00:00.000Z”“30-10-2010”“30-10-2010”“30-10-2010” @user-input-changed @model-value-changed @formatted-value-changed@serialized-value-changed ! [DateObject]User flow(if errorState = false) \ No newline at end of file diff --git a/packages/ui/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg b/packages/ui/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg new file mode 100644 index 000000000..dc0797b84 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg @@ -0,0 +1 @@ +User flow 2(Unparseable)User(inputElement.input)valuemodelValueserializedValueparserserializerdeserializerdelegatesyncinteract1345541. User changes the input 2. Native input syncs with lion-input-date value and gets preprocessed3. Value is parsed to modelValue but it is unparseable (parser returns undefined)4. modelValue.viewValue, which is the value prior to the parsing step, is synced back to the user. It is also serialized 5. Value is delegated back to native input value (what the user sees)“10%30%2010”“10%30%2010”[Unparseable]“10%30%2010” “10%30%2010” @user-input-changed @model-value-changed @serialized-value-changed !5. On request: serializedValue is deserialized to modelValue, which will again be Unparseable[Unparseable]"{"type":"unparseable","viewValue":"10%30%2010"}"syncpreprocess2 \ No newline at end of file diff --git a/packages/ui/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg b/packages/ui/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg new file mode 100644 index 000000000..00ce1d667 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg @@ -0,0 +1,84 @@ + + + + + + Imperative(programmatic) + formattedValue + User(inputElement.input) + value + modelValue + serializedValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + serializer + + delegate + sync + formatter + + + + changed + + 1 + 2 + 2 + 4 + + 3 + 1. modelValue is changed during runtime 2. modelValue is formatted to formattedValue and modelValue is serialized to serializedValue 3. formattedValue is reflected back to the user through the field value property4. Value is delegated back to native input value (what the user sees) + [DateObject] (day + 1)“30-11-2010”“2010-10-30T00:00:00.000Z” “30-11-2010”“30-10-2010” + @model-value-changed + + diff --git a/packages/ui/docs/fundamentals/systems/form/assets/h-output.js b/packages/ui/docs/fundamentals/systems/form/assets/h-output.js new file mode 100644 index 000000000..dd161464b --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/assets/h-output.js @@ -0,0 +1,155 @@ +import { css, html, LitElement } from 'lit'; +import { LionField } from '@lion/ui/form-core.js'; +import { LionFieldset } from '@lion/ui/fieldset.js'; + +export class HelperOutput extends LitElement { + static properties = { + field: Object, + show: Array, + title: String, + readyPromise: Object, + }; + + static styles = [ + css` + :host { + display: block; + margin-top: 8px; + } + + code { + font-size: 8px; + background-color: #eee; + } + + caption { + position: absolute; + top: 0; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(100%); + clip: rect(1px, 1px, 1px, 1px); + white-space: nowrap; + border: 0; + margin: 0; + padding: 0; + } + + table, + th, + td { + border-bottom: 1px solid rgb(204, 204, 204); + border-image: initial; + padding: 4px; + font-size: 12px; + border-left: none; + border-right: none; + text-align: left; + } + + td { + max-width: 200px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + table { + border-collapse: collapse; + } + + caption { + text-align: left; + } + `, + ]; + + firstUpdated(changedProperties) { + super.firstUpdated(changedProperties); + if (!this.field) { + // Fuzzy logic, but... practical + const prev = this.previousElementSibling; + if (prev instanceof LionField || prev instanceof LionFieldset) { + this.field = prev; + } + } + this.__rerender = this.__rerender.bind(this); + + const storyRoot = this.closest('[mdjs-story-name]') || this.parentElement; + + storyRoot.addEventListener('model-value-changed', this.__rerender); + storyRoot.addEventListener('mousemove', this.__rerender); + // this.field.addEventListener('blur', this.__rerender); + storyRoot.addEventListener('focusin', this.__rerender); + storyRoot.addEventListener('focusout', this.__rerender); + storyRoot.addEventListener('change', this.__rerender); + + if (this.field._inputNode.form) { + this.field._inputNode.form.addEventListener('submit', this.__rerender); + } + + if (this.readyPromise) { + this.readyPromise.then(() => { + this.__rerender(); + }); + } + } + + __rerender() { + setTimeout(() => { + const f = this.field; + this.field = null; + this.field = f; + }); + } + + // eslint-disable-next-line class-methods-use-this + __renderProp(prop) { + const field = this.field || {}; + let resultText = ''; + + if (typeof prop === 'string') { + const p = field[prop]; + if (typeof p === 'boolean') { + return p === true ? '✓' : ''; + } + if (typeof p === 'undefined') { + return html`undefined`; + } + if (typeof p === 'object' && p !== null) { + return JSON.stringify(p); + } + resultText = p; + } else { + resultText = prop.processor(field); + } + + return html`${resultText}`; + } + + constructor() { + super(); + this.title = 'States'; + } + + render() { + const computePropName = prop => (typeof prop === 'string' ? prop : prop.name); + return html` + + + + ${this.show.map(prop => html``)} + + + + ${this.show.map(prop => html``)} + +
+ ${this.title} +
${computePropName(prop)}
${this.__renderProp(prop)}
+ `; + } +} + +customElements.define('h-output', HelperOutput); diff --git a/packages/ui/docs/fundamentals/systems/form/formatting-and-parsing.md b/packages/ui/docs/fundamentals/systems/form/formatting-and-parsing.md new file mode 100644 index 000000000..40164c92e --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/formatting-and-parsing.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/form/formatting-and-parsing.md) diff --git a/packages/ui/docs/fundamentals/systems/form/index.md b/packages/ui/docs/fundamentals/systems/form/index.md new file mode 100644 index 000000000..ae991b559 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/form/index.md) diff --git a/packages/ui/docs/fundamentals/systems/form/interaction-states.md b/packages/ui/docs/fundamentals/systems/form/interaction-states.md new file mode 100644 index 000000000..47297dd55 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/interaction-states.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/form/interaction-states.md) diff --git a/packages/ui/docs/fundamentals/systems/form/model-value.md b/packages/ui/docs/fundamentals/systems/form/model-value.md new file mode 100644 index 000000000..33fce57f5 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/model-value.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/form/model-value.md) diff --git a/packages/ui/docs/fundamentals/systems/form/overview.md b/packages/ui/docs/fundamentals/systems/form/overview.md new file mode 100644 index 000000000..dba9eac9a --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/form/overview.md) diff --git a/packages/ui/docs/fundamentals/systems/form/styling.md b/packages/ui/docs/fundamentals/systems/form/styling.md new file mode 100644 index 000000000..ecf6a4e0f --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/styling.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/form/styling.md) diff --git a/packages/ui/docs/fundamentals/systems/form/use-cases.md b/packages/ui/docs/fundamentals/systems/form/use-cases.md new file mode 100644 index 000000000..e4c247573 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/form/use-cases.md) diff --git a/packages/ui/docs/fundamentals/systems/form/validate.md b/packages/ui/docs/fundamentals/systems/form/validate.md new file mode 100644 index 000000000..2d0fe854f --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/form/validate.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/form/validate.md) diff --git a/packages/ui/docs/fundamentals/systems/icon/index.md b/packages/ui/docs/fundamentals/systems/icon/index.md new file mode 100644 index 000000000..f7bc6dfe8 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/icon/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/icon/index.md) diff --git a/packages/ui/docs/fundamentals/systems/icon/overview.md b/packages/ui/docs/fundamentals/systems/icon/overview.md new file mode 100644 index 000000000..216a2f3ac --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/icon/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/icon/overview.md) diff --git a/packages/ui/docs/fundamentals/systems/index.md b/packages/ui/docs/fundamentals/systems/index.md new file mode 100644 index 000000000..96420e2c4 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/fundamentals/systems/index.md) diff --git a/packages/ui/docs/fundamentals/systems/localize/assets/all-locales.js b/packages/ui/docs/fundamentals/systems/localize/assets/all-locales.js new file mode 100755 index 000000000..7f80e69b7 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/assets/all-locales.js @@ -0,0 +1,437 @@ +export default { + 'af-ZA': 'Afrikaans (South Africa)', + af: 'Afrikaans', + 'ak-GH': 'Akan (Ghana)', + ak: 'Akan', + 'sq-AL': 'Albanian (Albania)', + sq: 'Albanian', + 'am-ET': 'Amharic (Ethiopia)', + am: 'Amharic', + 'ar-DZ': 'Arabic (Algeria)', + 'ar-BH': 'Arabic (Bahrain)', + 'ar-EG': 'Arabic (Egypt)', + 'ar-IQ': 'Arabic (Iraq)', + 'ar-JO': 'Arabic (Jordan)', + 'ar-KW': 'Arabic (Kuwait)', + 'ar-LB': 'Arabic (Lebanon)', + 'ar-LY': 'Arabic (Libya)', + 'ar-MA': 'Arabic (Morocco)', + 'ar-OM': 'Arabic (Oman)', + 'ar-QA': 'Arabic (Qatar)', + 'ar-SA': 'Arabic (Saudi Arabia)', + 'ar-SD': 'Arabic (Sudan)', + 'ar-SY': 'Arabic (Syria)', + 'ar-TN': 'Arabic (Tunisia)', + 'ar-AE': 'Arabic (United Arab Emirates)', + 'ar-YE': 'Arabic (Yemen)', + ar: 'Arabic', + 'hy-AM': 'Armenian (Armenia)', + hy: 'Armenian', + 'as-IN': 'Assamese (India)', + as: 'Assamese', + 'asa-TZ': 'Asu (Tanzania)', + asa: 'Asu', + 'az-Cyrl': 'Azerbaijani (Cyrillic)', + 'az-Cyrl-AZ': 'Azerbaijani (Cyrillic, Azerbaijan)', + 'az-Latn': 'Azerbaijani (Latin)', + 'az-Latn-AZ': 'Azerbaijani (Latin, Azerbaijan)', + az: 'Azerbaijani', + 'bm-ML': 'Bambara (Mali)', + bm: 'Bambara', + 'eu-ES': 'Basque (Spain)', + eu: 'Basque', + 'be-BY': 'Belarusian (Belarus)', + be: 'Belarusian', + 'bem-ZM': 'Bemba (Zambia)', + bem: 'Bemba', + 'bez-TZ': 'Bena (Tanzania)', + bez: 'Bena', + 'bn-BD': 'Bengali (Bangladesh)', + 'bn-IN': 'Bengali (India)', + bn: 'Bengali', + 'bs-BA': 'Bosnian (Bosnia and Herzegovina)', + bs: 'Bosnian', + 'bg-BG': 'Bulgarian (Bulgaria)', + bg: 'Bulgarian', + 'my-MM': 'Burmese (Myanmar [Burma])', + my: 'Burmese', + 'yue-Hant-HK': 'Cantonese (Traditional, Hong Kong SAR China)', + 'ca-ES': 'Catalan (Spain)', + ca: 'Catalan', + 'tzm-Latn': 'Central Morocco Tamazight (Latin)', + 'tzm-Latn-MA': 'Central Morocco Tamazight (Latin, Morocco)', + tzm: 'Central Morocco Tamazight', + 'chr-US': 'Cherokee (United States)', + chr: 'Cherokee', + 'cgg-UG': 'Chiga (Uganda)', + cgg: 'Chiga', + 'zh-Hans': 'Chinese (Simplified Han)', + 'zh-Hans-CN': 'Chinese (Simplified Han, China)', + 'zh-Hans-HK': 'Chinese (Simplified Han, Hong Kong SAR China)', + 'zh-Hans-MO': 'Chinese (Simplified Han, Macau SAR China)', + 'zh-Hans-SG': 'Chinese (Simplified Han, Singapore)', + 'zh-Hant': 'Chinese (Traditional Han)', + 'zh-Hant-HK': 'Chinese (Traditional Han, Hong Kong SAR China)', + 'zh-Hant-MO': 'Chinese (Traditional Han, Macau SAR China)', + 'zh-Hant-TW': 'Chinese (Traditional Han, Taiwan)', + zh: 'Chinese', + 'kw-GB': 'Cornish (United Kingdom)', + kw: 'Cornish', + 'hr-HR': 'Croatian (Croatia)', + hr: 'Croatian', + 'cs-CZ': 'Czech (Czech Republic)', + cs: 'Czech', + 'da-DK': 'Danish (Denmark)', + da: 'Danish', + 'nl-BE': 'Dutch (Belgium)', + 'nl-NL': 'Dutch (Netherlands)', + nl: 'Dutch', + 'ebu-KE': 'Embu (Kenya)', + ebu: 'Embu', + 'en-AS': 'English (American Samoa)', + 'en-AU': 'English (Australia)', + 'en-BE': 'English (Belgium)', + 'en-BZ': 'English (Belize)', + 'en-BW': 'English (Botswana)', + 'en-CA': 'English (Canada)', + 'en-GU': 'English (Guam)', + 'en-HK': 'English (Hong Kong SAR China)', + 'en-IN': 'English (India)', + 'en-IE': 'English (Ireland)', + 'en-IL': 'English (Israel)', + 'en-JM': 'English (Jamaica)', + 'en-MT': 'English (Malta)', + 'en-MH': 'English (Marshall Islands)', + 'en-MU': 'English (Mauritius)', + 'en-NA': 'English (Namibia)', + 'en-NZ': 'English (New Zealand)', + 'en-MP': 'English (Northern Mariana Islands)', + 'en-PK': 'English (Pakistan)', + 'en-PH': 'English (Philippines)', + 'en-SG': 'English (Singapore)', + 'en-ZA': 'English (South Africa)', + 'en-TT': 'English (Trinidad and Tobago)', + 'en-UM': 'English (U.S. Minor Outlying Islands)', + 'en-VI': 'English (U.S. Virgin Islands)', + 'en-GB': 'English (United Kingdom)', + 'en-US': 'English (United States)', + 'en-ZW': 'English (Zimbabwe)', + en: 'English', + eo: 'Esperanto', + 'et-EE': 'Estonian (Estonia)', + et: 'Estonian', + 'ee-GH': 'Ewe (Ghana)', + 'ee-TG': 'Ewe (Togo)', + ee: 'Ewe', + 'fo-FO': 'Faroese (Faroe Islands)', + fo: 'Faroese', + 'fil-PH': 'Filipino (Philippines)', + fil: 'Filipino', + 'fi-FI': 'Finnish (Finland)', + fi: 'Finnish', + 'fr-BE': 'French (Belgium)', + 'fr-BJ': 'French (Benin)', + 'fr-BF': 'French (Burkina Faso)', + 'fr-BI': 'French (Burundi)', + 'fr-CM': 'French (Cameroon)', + 'fr-CA': 'French (Canada)', + 'fr-CF': 'French (Central African Republic)', + 'fr-TD': 'French (Chad)', + 'fr-KM': 'French (Comoros)', + 'fr-CG': 'French (Congo - Brazzaville)', + 'fr-CD': 'French (Congo - Kinshasa)', + 'fr-CI': 'French (Côte d’Ivoire)', + 'fr-DJ': 'French (Djibouti)', + 'fr-GQ': 'French (Equatorial Guinea)', + 'fr-FR': 'French (France)', + 'fr-GA': 'French (Gabon)', + 'fr-GP': 'French (Guadeloupe)', + 'fr-GN': 'French (Guinea)', + 'fr-LU': 'French (Luxembourg)', + 'fr-MG': 'French (Madagascar)', + 'fr-ML': 'French (Mali)', + 'fr-MQ': 'French (Martinique)', + 'fr-MC': 'French (Monaco)', + 'fr-NE': 'French (Niger)', + 'fr-RW': 'French (Rwanda)', + 'fr-RE': 'French (Réunion)', + 'fr-BL': 'French (Saint Barthélemy)', + 'fr-MF': 'French (Saint Martin)', + 'fr-SN': 'French (Senegal)', + 'fr-CH': 'French (Switzerland)', + 'fr-TG': 'French (Togo)', + fr: 'French', + 'ff-SN': 'Fulah (Senegal)', + ff: 'Fulah', + 'gl-ES': 'Galician (Spain)', + gl: 'Galician', + 'lg-UG': 'Ganda (Uganda)', + lg: 'Ganda', + 'ka-GE': 'Georgian (Georgia)', + ka: 'Georgian', + 'de-AT': 'German (Austria)', + 'de-BE': 'German (Belgium)', + 'de-DE': 'German (Germany)', + 'de-LI': 'German (Liechtenstein)', + 'de-LU': 'German (Luxembourg)', + 'de-CH': 'German (Switzerland)', + de: 'German', + 'el-CY': 'Greek (Cyprus)', + 'el-GR': 'Greek (Greece)', + el: 'Greek', + 'gu-IN': 'Gujarati (India)', + gu: 'Gujarati', + 'guz-KE': 'Gusii (Kenya)', + guz: 'Gusii', + 'ha-Latn': 'Hausa (Latin)', + 'ha-Latn-GH': 'Hausa (Latin, Ghana)', + 'ha-Latn-NE': 'Hausa (Latin, Niger)', + 'ha-Latn-NG': 'Hausa (Latin, Nigeria)', + ha: 'Hausa', + 'haw-US': 'Hawaiian (United States)', + haw: 'Hawaiian', + 'he-IL': 'Hebrew (Israel)', + he: 'Hebrew', + 'hi-IN': 'Hindi (India)', + hi: 'Hindi', + 'hu-HU': 'Hungarian (Hungary)', + hu: 'Hungarian', + 'is-IS': 'Icelandic (Iceland)', + is: 'Icelandic', + 'ig-NG': 'Igbo (Nigeria)', + ig: 'Igbo', + 'id-ID': 'Indonesian (Indonesia)', + id: 'Indonesian', + 'ga-IE': 'Irish (Ireland)', + ga: 'Irish', + 'it-IT': 'Italian (Italy)', + 'it-CH': 'Italian (Switzerland)', + it: 'Italian', + 'ja-JP': 'Japanese (Japan)', + ja: 'Japanese', + 'kea-CV': 'Kabuverdianu (Cape Verde)', + kea: 'Kabuverdianu', + 'kab-DZ': 'Kabyle (Algeria)', + kab: 'Kabyle', + 'kl-GL': 'Kalaallisut (Greenland)', + kl: 'Kalaallisut', + 'kln-KE': 'Kalenjin (Kenya)', + kln: 'Kalenjin', + 'kam-KE': 'Kamba (Kenya)', + kam: 'Kamba', + 'kn-IN': 'Kannada (India)', + kn: 'Kannada', + 'kk-Cyrl': 'Kazakh (Cyrillic)', + 'kk-Cyrl-KZ': 'Kazakh (Cyrillic, Kazakhstan)', + kk: 'Kazakh', + 'km-KH': 'Khmer (Cambodia)', + km: 'Khmer', + 'ki-KE': 'Kikuyu (Kenya)', + ki: 'Kikuyu', + 'rw-RW': 'Kinyarwanda (Rwanda)', + rw: 'Kinyarwanda', + 'kok-IN': 'Konkani (India)', + kok: 'Konkani', + 'ko-KR': 'Korean (South Korea)', + ko: 'Korean', + 'khq-ML': 'Koyra Chiini (Mali)', + khq: 'Koyra Chiini', + 'ses-ML': 'Koyraboro Senni (Mali)', + ses: 'Koyraboro Senni', + 'lag-TZ': 'Langi (Tanzania)', + lag: 'Langi', + 'lv-LV': 'Latvian (Latvia)', + lv: 'Latvian', + 'lt-LT': 'Lithuanian (Lithuania)', + lt: 'Lithuanian', + 'luo-KE': 'Luo (Kenya)', + luo: 'Luo', + 'luy-KE': 'Luyia (Kenya)', + luy: 'Luyia', + 'mk-MK': 'Macedonian (Macedonia)', + mk: 'Macedonian', + 'jmc-TZ': 'Machame (Tanzania)', + jmc: 'Machame', + 'kde-TZ': 'Makonde (Tanzania)', + kde: 'Makonde', + 'mg-MG': 'Malagasy (Madagascar)', + mg: 'Malagasy', + 'ms-BN': 'Malay (Brunei)', + 'ms-MY': 'Malay (Malaysia)', + ms: 'Malay', + 'ml-IN': 'Malayalam (India)', + ml: 'Malayalam', + 'mt-MT': 'Maltese (Malta)', + mt: 'Maltese', + 'gv-GB': 'Manx (United Kingdom)', + gv: 'Manx', + 'mr-IN': 'Marathi (India)', + mr: 'Marathi', + 'mas-KE': 'Masai (Kenya)', + 'mas-TZ': 'Masai (Tanzania)', + mas: 'Masai', + 'mer-KE': 'Meru (Kenya)', + mer: 'Meru', + 'mfe-MU': 'Morisyen (Mauritius)', + mfe: 'Morisyen', + 'naq-NA': 'Nama (Namibia)', + naq: 'Nama', + 'ne-IN': 'Nepali (India)', + 'ne-NP': 'Nepali (Nepal)', + ne: 'Nepali', + 'nd-ZW': 'North Ndebele (Zimbabwe)', + nd: 'North Ndebele', + 'nb-NO': 'Norwegian Bokmål (Norway)', + nb: 'Norwegian Bokmål', + 'nn-NO': 'Norwegian Nynorsk (Norway)', + nn: 'Norwegian Nynorsk', + 'nyn-UG': 'Nyankole (Uganda)', + nyn: 'Nyankole', + 'or-IN': 'Oriya (India)', + or: 'Oriya', + 'om-ET': 'Oromo (Ethiopia)', + 'om-KE': 'Oromo (Kenya)', + om: 'Oromo', + 'ps-AF': 'Pashto (Afghanistan)', + ps: 'Pashto', + 'fa-AF': 'Persian (Afghanistan)', + 'fa-IR': 'Persian (Iran)', + fa: 'Persian', + 'pl-PL': 'Polish (Poland)', + pl: 'Polish', + 'pt-BR': 'Portuguese (Brazil)', + 'pt-GW': 'Portuguese (Guinea-Bissau)', + 'pt-MZ': 'Portuguese (Mozambique)', + 'pt-PT': 'Portuguese (Portugal)', + pt: 'Portuguese', + 'pa-Arab': 'Punjabi (Arabic)', + 'pa-Arab-PK': 'Punjabi (Arabic, Pakistan)', + 'pa-Guru': 'Punjabi (Gurmukhi)', + 'pa-Guru-IN': 'Punjabi (Gurmukhi, India)', + pa: 'Punjabi', + 'ro-MD': 'Romanian (Moldova)', + 'ro-RO': 'Romanian (Romania)', + ro: 'Romanian', + 'rm-CH': 'Romansh (Switzerland)', + rm: 'Romansh', + 'rof-TZ': 'Rombo (Tanzania)', + rof: 'Rombo', + 'ru-MD': 'Russian (Moldova)', + 'ru-RU': 'Russian (Russia)', + 'ru-UA': 'Russian (Ukraine)', + ru: 'Russian', + 'rwk-TZ': 'Rwa (Tanzania)', + rwk: 'Rwa', + 'saq-KE': 'Samburu (Kenya)', + saq: 'Samburu', + 'sg-CF': 'Sango (Central African Republic)', + sg: 'Sango', + 'seh-MZ': 'Sena (Mozambique)', + seh: 'Sena', + 'sr-Cyrl': 'Serbian (Cyrillic)', + 'sr-Cyrl-BA': 'Serbian (Cyrillic, Bosnia and Herzegovina)', + 'sr-Cyrl-ME': 'Serbian (Cyrillic, Montenegro)', + 'sr-Cyrl-RS': 'Serbian (Cyrillic, Serbia)', + 'sr-Latn': 'Serbian (Latin)', + 'sr-Latn-BA': 'Serbian (Latin, Bosnia and Herzegovina)', + 'sr-Latn-ME': 'Serbian (Latin, Montenegro)', + 'sr-Latn-RS': 'Serbian (Latin, Serbia)', + sr: 'Serbian', + 'sn-ZW': 'Shona (Zimbabwe)', + sn: 'Shona', + 'ii-CN': 'Sichuan Yi (China)', + ii: 'Sichuan Yi', + 'si-LK': 'Sinhala (Sri Lanka)', + si: 'Sinhala', + 'sk-SK': 'Slovak (Slovakia)', + sk: 'Slovak', + 'sl-SI': 'Slovenian (Slovenia)', + sl: 'Slovenian', + 'xog-UG': 'Soga (Uganda)', + xog: 'Soga', + 'so-DJ': 'Somali (Djibouti)', + 'so-ET': 'Somali (Ethiopia)', + 'so-KE': 'Somali (Kenya)', + 'so-SO': 'Somali (Somalia)', + so: 'Somali', + 'es-AR': 'Spanish (Argentina)', + 'es-BO': 'Spanish (Bolivia)', + 'es-CL': 'Spanish (Chile)', + 'es-CO': 'Spanish (Colombia)', + 'es-CR': 'Spanish (Costa Rica)', + 'es-DO': 'Spanish (Dominican Republic)', + 'es-EC': 'Spanish (Ecuador)', + 'es-SV': 'Spanish (El Salvador)', + 'es-GQ': 'Spanish (Equatorial Guinea)', + 'es-GT': 'Spanish (Guatemala)', + 'es-HN': 'Spanish (Honduras)', + 'es-419': 'Spanish (Latin America)', + 'es-MX': 'Spanish (Mexico)', + 'es-NI': 'Spanish (Nicaragua)', + 'es-PA': 'Spanish (Panama)', + 'es-PY': 'Spanish (Paraguay)', + 'es-PE': 'Spanish (Peru)', + 'es-PR': 'Spanish (Puerto Rico)', + 'es-ES': 'Spanish (Spain)', + 'es-US': 'Spanish (United States)', + 'es-UY': 'Spanish (Uruguay)', + 'es-VE': 'Spanish (Venezuela)', + es: 'Spanish', + 'sw-KE': 'Swahili (Kenya)', + 'sw-TZ': 'Swahili (Tanzania)', + sw: 'Swahili', + 'sv-FI': 'Swedish (Finland)', + 'sv-SE': 'Swedish (Sweden)', + sv: 'Swedish', + 'gsw-CH': 'Swiss German (Switzerland)', + gsw: 'Swiss German', + 'shi-Latn': 'Tachelhit (Latin)', + 'shi-Latn-MA': 'Tachelhit (Latin, Morocco)', + 'shi-Tfng': 'Tachelhit (Tifinagh)', + 'shi-Tfng-MA': 'Tachelhit (Tifinagh, Morocco)', + shi: 'Tachelhit', + 'dav-KE': 'Taita (Kenya)', + dav: 'Taita', + 'ta-IN': 'Tamil (India)', + 'ta-LK': 'Tamil (Sri Lanka)', + ta: 'Tamil', + 'te-IN': 'Telugu (India)', + te: 'Telugu', + 'teo-KE': 'Teso (Kenya)', + 'teo-UG': 'Teso (Uganda)', + teo: 'Teso', + 'th-TH': 'Thai (Thailand)', + th: 'Thai', + 'bo-CN': 'Tibetan (China)', + 'bo-IN': 'Tibetan (India)', + bo: 'Tibetan', + 'ti-ER': 'Tigrinya (Eritrea)', + 'ti-ET': 'Tigrinya (Ethiopia)', + ti: 'Tigrinya', + 'to-TO': 'Tonga (Tonga)', + to: 'Tonga', + 'tr-TR': 'Turkish (Turkey)', + tr: 'Turkish', + 'uk-UA': 'Ukrainian (Ukraine)', + uk: 'Ukrainian', + 'ur-IN': 'Urdu (India)', + 'ur-PK': 'Urdu (Pakistan)', + ur: 'Urdu', + 'uz-Arab': 'Uzbek (Arabic)', + 'uz-Arab-AF': 'Uzbek (Arabic, Afghanistan)', + 'uz-Cyrl': 'Uzbek (Cyrillic)', + 'uz-Cyrl-UZ': 'Uzbek (Cyrillic, Uzbekistan)', + 'uz-Latn': 'Uzbek (Latin)', + 'uz-Latn-UZ': 'Uzbek (Latin, Uzbekistan)', + uz: 'Uzbek', + 'vi-VN': 'Vietnamese (Vietnam)', + vi: 'Vietnamese', + 'vun-TZ': 'Vunjo (Tanzania)', + vun: 'Vunjo', + 'cy-GB': 'Welsh (United Kingdom)', + cy: 'Welsh', + 'yo-NG': 'Yoruba (Nigeria)', + yo: 'Yoruba', + 'zu-ZA': 'Zulu (South Africa)', + zu: 'Zulu', +}; diff --git a/packages/ui/docs/fundamentals/systems/localize/assets/en-AU.js b/packages/ui/docs/fundamentals/systems/localize/assets/en-AU.js new file mode 100644 index 000000000..9300e50da --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/assets/en-AU.js @@ -0,0 +1,6 @@ +import en from './en.js'; + +export default { + ...en, + body: 'I am from Australia', +}; diff --git a/packages/ui/docs/fundamentals/systems/localize/assets/en-GB.js b/packages/ui/docs/fundamentals/systems/localize/assets/en-GB.js new file mode 100644 index 000000000..261ddad38 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/assets/en-GB.js @@ -0,0 +1,6 @@ +import en from './en.js'; + +export default { + ...en, + body: 'I am from England', +}; diff --git a/packages/ui/docs/fundamentals/systems/localize/assets/en-US.js b/packages/ui/docs/fundamentals/systems/localize/assets/en-US.js new file mode 100644 index 000000000..0caa1a031 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/assets/en-US.js @@ -0,0 +1,6 @@ +import en from './en.js'; + +export default { + ...en, + body: 'I am from the USA', +}; diff --git a/packages/ui/docs/fundamentals/systems/localize/assets/en.js b/packages/ui/docs/fundamentals/systems/localize/assets/en.js new file mode 100644 index 000000000..c1ec9eb55 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/assets/en.js @@ -0,0 +1,4 @@ +export default { + header: '{ locale }: Localize message example', + body: 'I am English', +}; diff --git a/packages/ui/docs/fundamentals/systems/localize/assets/nl-BE.js b/packages/ui/docs/fundamentals/systems/localize/assets/nl-BE.js new file mode 100644 index 000000000..2eb8bc771 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/assets/nl-BE.js @@ -0,0 +1,6 @@ +import nl from './nl.js'; + +export default { + ...nl, + body: 'Ik kom uit Belgie', +}; diff --git a/packages/ui/docs/fundamentals/systems/localize/assets/nl-NL.js b/packages/ui/docs/fundamentals/systems/localize/assets/nl-NL.js new file mode 100644 index 000000000..0969817f8 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/assets/nl-NL.js @@ -0,0 +1,6 @@ +import nl from './nl.js'; + +export default { + ...nl, + body: 'Ik kom uit Nederland', +}; diff --git a/packages/ui/docs/fundamentals/systems/localize/assets/nl.js b/packages/ui/docs/fundamentals/systems/localize/assets/nl.js new file mode 100644 index 000000000..e2da5015d --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/assets/nl.js @@ -0,0 +1,4 @@ +export default { + header: '{ locale }: Localize message voorbeeld', + body: 'Ik kom uit Nederland', +}; diff --git a/packages/ui/docs/fundamentals/systems/localize/dates.md b/packages/ui/docs/fundamentals/systems/localize/dates.md new file mode 100644 index 000000000..f1da52e61 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/dates.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/localize/dates.md) diff --git a/packages/ui/docs/fundamentals/systems/localize/index.md b/packages/ui/docs/fundamentals/systems/localize/index.md new file mode 100644 index 000000000..fc8d1702b --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/localize/index.md) diff --git a/packages/ui/docs/fundamentals/systems/localize/numbers.md b/packages/ui/docs/fundamentals/systems/localize/numbers.md new file mode 100644 index 000000000..d11b5c9d0 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/numbers.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/localize/numbers.md) diff --git a/packages/ui/docs/fundamentals/systems/localize/overview.md b/packages/ui/docs/fundamentals/systems/localize/overview.md new file mode 100644 index 000000000..b8c5c783c --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/localize/overview.md) diff --git a/packages/ui/docs/fundamentals/systems/localize/rationale.md b/packages/ui/docs/fundamentals/systems/localize/rationale.md new file mode 100644 index 000000000..a746874a7 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/rationale.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/localize/rationale.md) diff --git a/packages/ui/docs/fundamentals/systems/localize/text.md b/packages/ui/docs/fundamentals/systems/localize/text.md new file mode 100644 index 000000000..1a38a8397 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/text.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/localize/text.md) diff --git a/packages/ui/docs/fundamentals/systems/localize/use-cases.md b/packages/ui/docs/fundamentals/systems/localize/use-cases.md new file mode 100644 index 000000000..319a0c99a --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/localize/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/localize/use-cases.md) diff --git a/packages/ui/docs/fundamentals/systems/overlays/assets/applyDemoOverlayStyles.js b/packages/ui/docs/fundamentals/systems/overlays/assets/applyDemoOverlayStyles.js new file mode 100644 index 000000000..fb9b4e7f9 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/assets/applyDemoOverlayStyles.js @@ -0,0 +1,22 @@ +import { css } from 'lit'; + +const applyDemoOverlayStyles = () => { + const demoOverlaysStyle = css` + .demo-overlay { + background-color: white; + border: 1px solid black; + padding: 10px; + } + + .demo-overlay--blocking { + background-color: lightgrey; + } + `; + + const styleTag = document.createElement('style'); + styleTag.setAttribute('data-demo-global-overlays', ''); + styleTag.textContent = demoOverlaysStyle.cssText; + document.head.appendChild(styleTag); +}; + +applyDemoOverlayStyles(); diff --git a/packages/ui/docs/fundamentals/systems/overlays/assets/demo-overlay-backdrop.js b/packages/ui/docs/fundamentals/systems/overlays/assets/demo-overlay-backdrop.js new file mode 100644 index 000000000..06aa651bf --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/assets/demo-overlay-backdrop.js @@ -0,0 +1,48 @@ +import { css, LitElement } from 'lit'; + +/** + * @typedef {import('../types/OverlayConfig').OverlayConfig} OverlayConfig + */ +class DemoOverlayBackdrop extends LitElement { + static get styles() { + return css` + :host { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1; + background-color: grey; + opacity: 0.3; + display: none; + } + + :host(.local-overlays__backdrop--visible) { + display: block; + } + + :host(.local-overlays__backdrop--animation-in) { + animation: local-overlays-backdrop-fade-in 300ms; + } + + :host(.local-overlays__backdrop--animation-out) { + animation: local-overlays-backdrop-fade-out 300ms; + opacity: 0; + } + + @keyframes local-overlays-backdrop-fade-in { + from { + opacity: 0; + } + } + + @keyframes local-overlays-backdrop-fade-out { + from { + opacity: 0.3; + } + } + `; + } +} +customElements.define('demo-overlay-backdrop', DemoOverlayBackdrop); diff --git a/packages/ui/docs/fundamentals/systems/overlays/assets/demo-overlay-system.js b/packages/ui/docs/fundamentals/systems/overlays/assets/demo-overlay-system.js new file mode 100644 index 000000000..30c1ec87e --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/assets/demo-overlay-system.js @@ -0,0 +1,42 @@ +import { html, LitElement } from 'lit'; +import { OverlayMixin } from '@lion/ui/overlays.js'; + +/** + * @typedef {import('../types/OverlayConfig').OverlayConfig} OverlayConfig + */ +class DemoOverlaySystem extends OverlayMixin(LitElement) { + // eslint-disable-next-line class-methods-use-this + _defineOverlayConfig() { + return /** @type {OverlayConfig} */ ({ + placementMode: 'global', + }); + } + + _setupOpenCloseListeners() { + super._setupOpenCloseListeners(); + + if (this._overlayInvokerNode) { + this._overlayInvokerNode.addEventListener('click', this.toggle); + } + } + + _teardownOpenCloseListeners() { + super._teardownOpenCloseListeners(); + + if (this._overlayInvokerNode) { + this._overlayInvokerNode.removeEventListener('click', this.toggle); + } + } + + render() { + return html` + + +
+ +
+
popup is ${this.opened ? 'opened' : 'closed'}
+ `; + } +} +customElements.define('demo-overlay-system', DemoOverlaySystem); diff --git a/packages/ui/docs/fundamentals/systems/overlays/assets/ref.js b/packages/ui/docs/fundamentals/systems/overlays/assets/ref.js new file mode 100644 index 000000000..fed6d4307 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/assets/ref.js @@ -0,0 +1,38 @@ +import { directive } from 'lit/directive.js'; + +/** + * @typedef {import('@lion/ui/core.js').PropertyPart} PropertyPart + */ + +/** @type {WeakSet} */ +const cache = new WeakSet(); + +/** + * @desc Allows to have references to different parts of your lit template. + * Without it, seperate renders to different nodes would have been needed, leading to more verbose, + * less readable and less performant code. + * Inspired by Angular template refeference variables: + * https://angular.io/guide/template-syntax#ref-vars + * + * @example + * ```js + * const refObj = {}; + * ``` + * ```html + * + * + * + *``` + * + * @param {object} refObj will be used to store reference to attribute names like #myElement + */ +export const ref = directive(refObj => (/** @type {PropertyPart} */ part) => { + if (cache.has(part.committer.element)) { + return; + } + cache.add(part.committer.element); + const attrName = part.committer.name; + const key = attrName.replace(/^#/, ''); + // eslint-disable-next-line no-param-reassign + refObj[key] = part.committer.element; +}); diff --git a/packages/ui/docs/fundamentals/systems/overlays/assets/umbrella-form.js b/packages/ui/docs/fundamentals/systems/overlays/assets/umbrella-form.js new file mode 100644 index 000000000..58d5f7e13 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/assets/umbrella-form.js @@ -0,0 +1,133 @@ +import { LitElement, html } from 'lit'; +import { Required, MinLength } from '@lion/ui/form-core.js'; +import '@lion/ui/define/lion-form.js'; +import '@lion/ui/define/lion-fieldset.js'; +import '@lion/ui/define/lion-input.js'; +import '@lion/ui/define/lion-input-date.js'; +import '@lion/ui/define/lion-input-datepicker.js'; +import '@lion/ui/define/lion-input-amount.js'; +import '@lion/ui/define/lion-input-iban.js'; +import '@lion/ui/define/lion-input-email.js'; +import '@lion/ui/define/lion-checkbox-group.js'; +import '@lion/ui/define/lion-radio-group.js'; +import '@lion/ui/define/lion-select.js'; +import '@lion/ui/define/lion-select-rich.js'; +import '@lion/ui/define/lion-input-range.js'; +import '@lion/ui/define/lion-textarea.js'; +import '@lion/ui/define/lion-button.js'; +import '@lion/ui/define/lion-input-tel.js'; +import '@lion/ui/define/lion-input-tel-dropdown.js'; + +export class UmbrellaForm extends LitElement { + get _lionFormNode() { + return /** @type {import('@lion/ui/form.js').LionForm} */ ( + this.shadowRoot?.querySelector('lion-form') + ); + } + + render() { + return html` + +
+ + + + + + + + + + + + + + + + + + + + + + + + + Red + Hotpink + Teal + + + + + + + + + + + +
+ Submit + { + const lionForm = this._lionFormNode; + lionForm.resetGroup(); + }} + >Reset +
+
+
+ `; + } +} +customElements.define('umbrella-form', UmbrellaForm); diff --git a/packages/ui/docs/fundamentals/systems/overlays/configuration.md b/packages/ui/docs/fundamentals/systems/overlays/configuration.md new file mode 100644 index 000000000..3393610fc --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/configuration.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/overlays/configuration.md) diff --git a/packages/ui/docs/fundamentals/systems/overlays/form-integration.md b/packages/ui/docs/fundamentals/systems/overlays/form-integration.md new file mode 100644 index 000000000..8a593f2f5 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/form-integration.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/overlays/form-integration.md) diff --git a/packages/ui/docs/fundamentals/systems/overlays/index.md b/packages/ui/docs/fundamentals/systems/overlays/index.md new file mode 100644 index 000000000..6f1218712 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/overlays/index.md) diff --git a/packages/ui/docs/fundamentals/systems/overlays/overview.md b/packages/ui/docs/fundamentals/systems/overlays/overview.md new file mode 100644 index 000000000..d3a3ac3f1 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/overlays/overview.md) diff --git a/packages/ui/docs/fundamentals/systems/overlays/rationale.md b/packages/ui/docs/fundamentals/systems/overlays/rationale.md new file mode 100644 index 000000000..c412d4add --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/rationale.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/overlays/rationale.md) diff --git a/packages/ui/docs/fundamentals/systems/overlays/scope.md b/packages/ui/docs/fundamentals/systems/overlays/scope.md new file mode 100644 index 000000000..1012d8b5f --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/scope.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/overlays/scope.md) diff --git a/packages/ui/docs/fundamentals/systems/overlays/use-cases.md b/packages/ui/docs/fundamentals/systems/overlays/use-cases.md new file mode 100644 index 000000000..f82581059 --- /dev/null +++ b/packages/ui/docs/fundamentals/systems/overlays/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/systems/overlays/use-cases.md) diff --git a/packages/ui/docs/fundamentals/tools/ajax/assets/naga.json b/packages/ui/docs/fundamentals/tools/ajax/assets/naga.json new file mode 100644 index 000000000..0445fee3f --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/ajax/assets/naga.json @@ -0,0 +1,9 @@ +{ + "id": "2", + "type": "Polar Bear Dog", + "name": "Naga", + "skin": { + "type": "fur", + "color": "white" + } +} diff --git a/packages/ui/docs/fundamentals/tools/ajax/assets/pabu.json b/packages/ui/docs/fundamentals/tools/ajax/assets/pabu.json new file mode 100644 index 000000000..9c693a143 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/ajax/assets/pabu.json @@ -0,0 +1,9 @@ +{ + "id": "4", + "type": "Fire Ferret", + "name": "Pabu", + "skin": { + "type": "fur", + "color": "red" + } +} diff --git a/packages/ui/docs/fundamentals/tools/ajax/index.md b/packages/ui/docs/fundamentals/tools/ajax/index.md new file mode 100644 index 000000000..0c1ef3b95 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/ajax/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/tools/ajax/index.md) diff --git a/packages/ui/docs/fundamentals/tools/ajax/overview.md b/packages/ui/docs/fundamentals/tools/ajax/overview.md new file mode 100644 index 000000000..e988816e0 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/ajax/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/tools/ajax/overview.md) diff --git a/packages/ui/docs/fundamentals/tools/ajax/use-cases.md b/packages/ui/docs/fundamentals/tools/ajax/use-cases.md new file mode 100644 index 000000000..fd0809178 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/ajax/use-cases.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/tools/ajax/use-cases.md) diff --git a/packages/ui/docs/fundamentals/tools/helpers/action-logger.md b/packages/ui/docs/fundamentals/tools/helpers/action-logger.md new file mode 100644 index 000000000..3c73eb034 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/helpers/action-logger.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/tools/helpers/action-logger.md) diff --git a/packages/ui/docs/fundamentals/tools/helpers/index.md b/packages/ui/docs/fundamentals/tools/helpers/index.md new file mode 100644 index 000000000..4811a99c0 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/helpers/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/tools/helpers/index.md) diff --git a/packages/ui/docs/fundamentals/tools/helpers/overview.md b/packages/ui/docs/fundamentals/tools/helpers/overview.md new file mode 100644 index 000000000..828d6e0db --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/helpers/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/tools/helpers/overview.md) diff --git a/packages/ui/docs/fundamentals/tools/index.md b/packages/ui/docs/fundamentals/tools/index.md new file mode 100644 index 000000000..cef8ef650 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/fundamentals/tools/index.md) diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/.gitignore b/packages/ui/docs/fundamentals/tools/singleton-manager/.gitignore new file mode 100644 index 000000000..2dde2e120 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/.gitignore @@ -0,0 +1 @@ +!**/* diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/demo-app.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/demo-app.js new file mode 100644 index 000000000..057392db9 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/demo-app.js @@ -0,0 +1,93 @@ +import { LitElement, css, html } from 'lit'; + +import './overlayCompatibility.js'; + +import 'page-a/page-a.js'; +import 'page-b/page-b.js'; + +class DemoApp extends LitElement { + constructor() { + super(); + this.page = 'A'; + } + + static get properties() { + return { + page: { type: String }, + }; + } + + static get styles() { + return css` + :host { + display: block; + max-width: 680px; + margin: 0 auto; + } + + nav { + padding: 0 10px 10px 10px; + } + + button { + border: none; + padding: 1rem 2rem; + background: #0069ed; + color: #fff; + font-size: 1rem; + cursor: pointer; + text-align: center; + transition: background 250ms ease-in-out, transform 150ms ease; + } + + button:hover, + button:focus { + background: #0053ba; + } + + button:focus { + outline: 1px solid #fff; + outline-offset: -4px; + } + + button:active { + transform: scale(0.99); + } + + button.active { + background: #33a43f; + } + + h1 { + text-align: center; + } + `; + } + + render() { + return html` +

Demo App

+ + ${this.page === 'A' ? html` ` : html` `} + `; + } +} + +customElements.define('demo-app', DemoApp); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/index.md b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/index.md new file mode 100644 index 000000000..78179d0b1 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../../docs/fundamentals/tools/singleton-manager/example-complex/index.md) diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/index.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/index.js new file mode 100644 index 000000000..fb10ab782 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/index.js @@ -0,0 +1,30 @@ +export class OverlaysManager { + name = 'OverlayManager 1.x'; + + blockBody = false; + + constructor() { + this._setupBlocker(); + } + + _setupBlocker() { + const blocker = document.createElement('div'); + blocker.setAttribute('style', 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 140px; text-align: center;'); + blocker.innerText = `Blocker for ${this.name}`; + + const target = document.getElementById('overlay-target'); + target.appendChild(blocker); + + this.blocker = blocker; + } + + block() { + this.blockBody = true; + this.blocker.style.backgroundColor = '#ff6161'; + } + + unBlock() { + this.blockBody = false; + this.blocker.style.backgroundColor = 'transparent'; + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/instance.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/instance.js new file mode 100644 index 000000000..caecda9ae --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/instance.js @@ -0,0 +1,4 @@ +import { OverlaysManager } from './index.js'; +import { singletonManager } from 'singleton-manager'; + +export const overlays = singletonManager.get('overlays::overlays::1.x') || new OverlaysManager(); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/package.json new file mode 100644 index 000000000..0cbd136ec --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/package.json @@ -0,0 +1,4 @@ +{ + "name": "overlays", + "version": "1.0.0" +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/package.json new file mode 100644 index 000000000..2c77c4dee --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/package.json @@ -0,0 +1,7 @@ +{ + "name": "page-a", + "version": "1.0.0", + "dependencies": { + "overlays": "^1.0.0" + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/page-a.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/page-a.js new file mode 100644 index 000000000..714486f76 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/page-a.js @@ -0,0 +1,35 @@ +import { LitElement, html, css } from 'lit-element'; +import { overlays } from 'overlays/instance.js'; + +export class PageA extends LitElement { + static get styles() { + return css` + :host { + display: block; + padding: 10px; + border: 2px solid #ccc; + } + `; + } + + render() { + return html` +

I am page A

+

Overlays Status:

+

Name: ${overlays.name}

+

Blocked: ${overlays.blockBody}

+ + + + `; + } +} + + +customElements.define('page-a', PageA); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/index.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/index.js new file mode 100644 index 000000000..5c5ae99b9 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/index.js @@ -0,0 +1,30 @@ +export class OverlaysManager { + name = 'OverlayManager 2.x'; + + _blockBody = false; + + constructor() { + this._setupBlocker(); + } + + _setupBlocker() { + const blocker = document.createElement('div'); + blocker.setAttribute('style', 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 140px; text-align: center;'); + blocker.innerText = `Blocker for ${this.name}`; + + const target = document.getElementById('overlay-target'); + target.appendChild(blocker); + + this.blocker = blocker; + } + + blockBody() { + this._blockBody = true; + this.blocker.style.backgroundColor = '#ff6161'; + } + + unBlockBody() { + this._blockBody = false; + this.blocker.style.backgroundColor = 'transparent'; + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/instance.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/instance.js new file mode 100644 index 000000000..c3e546133 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/instance.js @@ -0,0 +1,4 @@ +import { OverlaysManager } from './index.js'; +import { singletonManager } from 'singleton-manager'; + +export const overlays = singletonManager.get('overlays::overlays::2.x') || new OverlaysManager(); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/package.json new file mode 100644 index 000000000..5e83291f8 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/package.json @@ -0,0 +1,4 @@ +{ + "name": "overlays", + "version": "2.0.0" +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/package.json new file mode 100644 index 000000000..cd0fdbef4 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/package.json @@ -0,0 +1,7 @@ +{ + "name": "page-b", + "version": "1.0.0", + "dependencies": { + "overlays": "^2.0.0" + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/page-b.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/page-b.js new file mode 100644 index 000000000..bc65fde08 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/page-b.js @@ -0,0 +1,49 @@ +import { LitElement, html, css } from 'lit-element'; +import { overlays } from 'overlays/instance.js'; + +export class PageB extends LitElement { + getInstance(sym, fallback) { + const ev = new CustomEvent('request-instance', { + detail: { key: sym }, + bubbles: true, + cancelable: true, + composed: true, + }); + this.dispatchEvent(ev); + return ev.detail.instance || fallback(); + } + + connectedCallback() { + super.connectedCallback(); + } + + static get styles() { + return css` + :host { + display: block; + padding: 10px; + border: 2px solid #ccc; + } + `; + } + + render() { + return html` +

I am page B

+

Overlays Status:

+

Name: ${overlays.name}

+

Blocked: ${overlays._blockBody}

+ + + + `; + } +} + +customElements.define('page-b', PageB); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/overlayCompatibility.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/overlayCompatibility.js new file mode 100644 index 000000000..384537215 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/overlayCompatibility.js @@ -0,0 +1,70 @@ +import { OverlaysManager } from 'overlays'; +import { singletonManager } from 'singleton-manager'; +import { OverlaysManager as OverlaysManager2 } from './node_modules/page-b/node_modules/overlays/index.js'; + +let compatibleManager1; +let compatibleManager2; + +const blocker = document.createElement('div'); +blocker.setAttribute( + 'style', + 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 140px; text-align: center;', +); +blocker.innerText = `Shared Blocker for App`; +document.body.appendChild(blocker); + +class CompatibleManager1 extends OverlaysManager { + constructor() { + super(); + this.name = 'Compatible1 from App'; + } + + block(sync = true) { + super.block(); + if (sync) { + compatibleManager2.blockBody(false); + } + } + + unBlock(sync = true) { + super.unBlock(); + if (sync) { + compatibleManager2.unBlockBody(false); + } + } + + _setupBlocker() { + this.blocker = blocker; + } +} + +class CompatibleManager2 extends OverlaysManager2 { + constructor() { + super(); + this.name = 'Compatible2 from App'; + } + + blockBody(sync = true) { + super.blockBody(); + if (sync) { + compatibleManager1.block(); + } + } + + unBlockBody(sync = true) { + super.unBlockBody(); + if (sync) { + compatibleManager1.unBlock(); + } + } + + _setupBlocker() { + this.blocker = blocker; + } +} + +compatibleManager1 = new CompatibleManager1(); +compatibleManager2 = new CompatibleManager2(); + +singletonManager.set('overlays::overlays::1.x', compatibleManager1); +singletonManager.set('overlays::overlays::2.x', compatibleManager2); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/package.json new file mode 100644 index 000000000..5bf693476 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-complex/package.json @@ -0,0 +1,9 @@ +{ + "name": "fail-demo-app", + "version": "1.0.0", + "dependencies": { + "@lion/core": "0.13.6", + "page-a": "^1.0.0", + "page-b": "^1.0.0" + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/demo-app.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/demo-app.js new file mode 100644 index 000000000..802bb6d85 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/demo-app.js @@ -0,0 +1,91 @@ +import { LitElement, css, html } from 'lit'; + +import 'page-a/page-a.js'; +import 'page-b/page-b.js'; + +class DemoApp extends LitElement { + constructor() { + super(); + this.page = 'A'; + } + + static get properties() { + return { + page: { type: String }, + }; + } + + static get styles() { + return css` + :host { + display: block; + max-width: 680px; + margin: 0 auto; + } + + nav { + padding: 0 10px 10px 10px; + } + + button { + border: none; + padding: 1rem 2rem; + background: #0069ed; + color: #fff; + font-size: 1rem; + cursor: pointer; + text-align: center; + transition: background 250ms ease-in-out, transform 150ms ease; + } + + button:hover, + button:focus { + background: #0053ba; + } + + button:focus { + outline: 1px solid #fff; + outline-offset: -4px; + } + + button:active { + transform: scale(0.99); + } + + button.active { + background: #33a43f; + } + + h1 { + text-align: center; + } + `; + } + + render() { + return html` +

Demo App

+ + ${this.page === 'A' ? html` ` : html` `} + `; + } +} + +customElements.define('demo-app', DemoApp); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/index.md b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/index.md new file mode 100644 index 000000000..0ed02b504 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../../docs/fundamentals/tools/singleton-manager/example-fail/index.md) diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/index.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/index.js new file mode 100644 index 000000000..011dff710 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/index.js @@ -0,0 +1,30 @@ +export class OverlaysManager { + name = 'OverlayManager 1.x'; + + blockBody = false; + + constructor() { + this._setupBlocker(); + } + + _setupBlocker() { + const blocker = document.createElement('div'); + blocker.setAttribute('style', 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 180px; text-align: center;'); + blocker.innerText = `Blocker for ${this.name}`; + + const target = document.getElementById('overlay-target'); + target.appendChild(blocker); + + this.blocker = blocker; + } + + block() { + this.blockBody = true; + this.blocker.style.backgroundColor = '#ff6161'; + } + + unBlock() { + this.blockBody = false; + this.blocker.style.backgroundColor = 'transparent'; + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/instance.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/instance.js new file mode 100644 index 000000000..f73ca3b47 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/instance.js @@ -0,0 +1,3 @@ +import { OverlaysManager } from './index.js'; + +export const overlays = new OverlaysManager(); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/package.json new file mode 100644 index 000000000..0cbd136ec --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/package.json @@ -0,0 +1,4 @@ +{ + "name": "overlays", + "version": "1.0.0" +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-a/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-a/package.json new file mode 100644 index 000000000..2c77c4dee --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-a/package.json @@ -0,0 +1,7 @@ +{ + "name": "page-a", + "version": "1.0.0", + "dependencies": { + "overlays": "^1.0.0" + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-a/page-a.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-a/page-a.js new file mode 100644 index 000000000..21fd3dde5 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-a/page-a.js @@ -0,0 +1,34 @@ +import { LitElement, html, css } from 'lit-element'; +import { overlays } from 'overlays/instance.js'; + +export class PageA extends LitElement { + static get styles() { + return css` + :host { + display: block; + padding: 10px; + border: 2px solid #ccc; + } + `; + } + + render() { + return html` +

I am page A

+

Overlays Status:

+

Name: ${overlays.name}

+

Blocked: ${overlays.blockBody}

+ + + + `; + } +} + +customElements.define('page-a', PageA); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/index.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/index.js new file mode 100644 index 000000000..ea2f3b178 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/index.js @@ -0,0 +1,30 @@ +export class OverlaysManager { + name = 'OverlayManager 2.x'; + + _blockBody = false; + + constructor() { + this._setupBlocker(); + } + + _setupBlocker() { + const blocker = document.createElement('div'); + blocker.setAttribute('style', 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 180px; text-align: center;'); + blocker.innerText = `Blocker for ${this.name}`; + + const target = document.getElementById('overlay-target'); + target.appendChild(blocker); + + this.blocker = blocker; + } + + blockBody() { + this._blockBody = true; + this.blocker.style.backgroundColor = '#ff6161'; + } + + unBlockBody() { + this._blockBody = false; + this.blocker.style.backgroundColor = 'transparent'; + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/instance.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/instance.js new file mode 100644 index 000000000..f73ca3b47 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/instance.js @@ -0,0 +1,3 @@ +import { OverlaysManager } from './index.js'; + +export const overlays = new OverlaysManager(); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/package.json new file mode 100644 index 000000000..5e83291f8 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/package.json @@ -0,0 +1,4 @@ +{ + "name": "overlays", + "version": "2.0.0" +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/package.json new file mode 100644 index 000000000..cd0fdbef4 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/package.json @@ -0,0 +1,7 @@ +{ + "name": "page-b", + "version": "1.0.0", + "dependencies": { + "overlays": "^2.0.0" + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/page-b.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/page-b.js new file mode 100644 index 000000000..94a90c0c0 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/page-b.js @@ -0,0 +1,34 @@ +import { LitElement, html, css } from 'lit-element'; +import { overlays } from 'overlays/instance.js'; + +export class PageB extends LitElement { + static get styles() { + return css` + :host { + display: block; + padding: 10px; + border: 2px solid #ccc; + } + `; + } + + render() { + return html` +

I am page B

+

Overlays Status:

+

Name: ${overlays.name}

+

Blocked: ${overlays._blockBody}

+ + + + `; + } +} + +customElements.define('page-b', PageB); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/package.json new file mode 100644 index 000000000..5bf693476 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-fail/package.json @@ -0,0 +1,9 @@ +{ + "name": "fail-demo-app", + "version": "1.0.0", + "dependencies": { + "@lion/core": "0.13.6", + "page-a": "^1.0.0", + "page-b": "^1.0.0" + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/demo-app.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/demo-app.js new file mode 100644 index 000000000..057392db9 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/demo-app.js @@ -0,0 +1,93 @@ +import { LitElement, css, html } from 'lit'; + +import './overlayCompatibility.js'; + +import 'page-a/page-a.js'; +import 'page-b/page-b.js'; + +class DemoApp extends LitElement { + constructor() { + super(); + this.page = 'A'; + } + + static get properties() { + return { + page: { type: String }, + }; + } + + static get styles() { + return css` + :host { + display: block; + max-width: 680px; + margin: 0 auto; + } + + nav { + padding: 0 10px 10px 10px; + } + + button { + border: none; + padding: 1rem 2rem; + background: #0069ed; + color: #fff; + font-size: 1rem; + cursor: pointer; + text-align: center; + transition: background 250ms ease-in-out, transform 150ms ease; + } + + button:hover, + button:focus { + background: #0053ba; + } + + button:focus { + outline: 1px solid #fff; + outline-offset: -4px; + } + + button:active { + transform: scale(0.99); + } + + button.active { + background: #33a43f; + } + + h1 { + text-align: center; + } + `; + } + + render() { + return html` +

Demo App

+ + ${this.page === 'A' ? html` ` : html` `} + `; + } +} + +customElements.define('demo-app', DemoApp); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/index.md b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/index.md new file mode 100644 index 000000000..be7f911ce --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../../docs/fundamentals/tools/singleton-manager/example-success/index.md) diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/index.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/index.js new file mode 100644 index 000000000..fb10ab782 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/index.js @@ -0,0 +1,30 @@ +export class OverlaysManager { + name = 'OverlayManager 1.x'; + + blockBody = false; + + constructor() { + this._setupBlocker(); + } + + _setupBlocker() { + const blocker = document.createElement('div'); + blocker.setAttribute('style', 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 140px; text-align: center;'); + blocker.innerText = `Blocker for ${this.name}`; + + const target = document.getElementById('overlay-target'); + target.appendChild(blocker); + + this.blocker = blocker; + } + + block() { + this.blockBody = true; + this.blocker.style.backgroundColor = '#ff6161'; + } + + unBlock() { + this.blockBody = false; + this.blocker.style.backgroundColor = 'transparent'; + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/instance.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/instance.js new file mode 100644 index 000000000..caecda9ae --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/instance.js @@ -0,0 +1,4 @@ +import { OverlaysManager } from './index.js'; +import { singletonManager } from 'singleton-manager'; + +export const overlays = singletonManager.get('overlays::overlays::1.x') || new OverlaysManager(); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/package.json new file mode 100644 index 000000000..0cbd136ec --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/package.json @@ -0,0 +1,4 @@ +{ + "name": "overlays", + "version": "1.0.0" +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-a/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-a/package.json new file mode 100644 index 000000000..2c77c4dee --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-a/package.json @@ -0,0 +1,7 @@ +{ + "name": "page-a", + "version": "1.0.0", + "dependencies": { + "overlays": "^1.0.0" + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-a/page-a.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-a/page-a.js new file mode 100644 index 000000000..21fd3dde5 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-a/page-a.js @@ -0,0 +1,34 @@ +import { LitElement, html, css } from 'lit-element'; +import { overlays } from 'overlays/instance.js'; + +export class PageA extends LitElement { + static get styles() { + return css` + :host { + display: block; + padding: 10px; + border: 2px solid #ccc; + } + `; + } + + render() { + return html` +

I am page A

+

Overlays Status:

+

Name: ${overlays.name}

+

Blocked: ${overlays.blockBody}

+ + + + `; + } +} + +customElements.define('page-a', PageA); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/index.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/index.js new file mode 100644 index 000000000..a2e56314e --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/index.js @@ -0,0 +1,30 @@ +export class OverlaysManager { + name = 'OverlayManager 2.x'; + + blockBody = false; + + constructor() { + this._setupBlocker(); + } + + _setupBlocker() { + const blocker = document.createElement('div'); + blocker.setAttribute('style', 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 140px; text-align: center;'); + blocker.innerText = `Blocker for ${this.name}`; + + const target = document.getElementById('overlay-target'); + target.appendChild(blocker); + + this.blocker = blocker; + } + + blockingBody() { + this.blockBody = true; + this.blocker.style.backgroundColor = '#ff6161'; + } + + unBlockingBody() { + this.blockBody = false; + this.blocker.style.backgroundColor = 'transparent'; + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/instance.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/instance.js new file mode 100644 index 000000000..c3e546133 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/instance.js @@ -0,0 +1,4 @@ +import { OverlaysManager } from './index.js'; +import { singletonManager } from 'singleton-manager'; + +export const overlays = singletonManager.get('overlays::overlays::2.x') || new OverlaysManager(); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/package.json new file mode 100644 index 000000000..5e83291f8 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/package.json @@ -0,0 +1,4 @@ +{ + "name": "overlays", + "version": "2.0.0" +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/package.json new file mode 100644 index 000000000..cd0fdbef4 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/package.json @@ -0,0 +1,7 @@ +{ + "name": "page-b", + "version": "1.0.0", + "dependencies": { + "overlays": "^2.0.0" + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/page-b.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/page-b.js new file mode 100644 index 000000000..41fa08ad4 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/page-b.js @@ -0,0 +1,34 @@ +import { LitElement, html, css } from 'lit-element'; +import { overlays } from 'overlays/instance.js'; + +export class PageB extends LitElement { + static get styles() { + return css` + :host { + display: block; + padding: 10px; + border: 2px solid #ccc; + } + `; + } + + render() { + return html` +

I am page B

+

Overlays Status:

+

Name: ${overlays.name}

+

Blocked: ${overlays.blockBody}

+ + + + `; + } +} + +customElements.define('page-b', PageB); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/overlayCompatibility.js b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/overlayCompatibility.js new file mode 100644 index 000000000..36a9c73c0 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/overlayCompatibility.js @@ -0,0 +1,23 @@ +import { OverlaysManager } from 'overlays'; +import { singletonManager } from 'singleton-manager'; + +class CompatibleManager extends OverlaysManager { + constructor() { + super(); + this.name = 'Compatible from App'; + this.blocker.innerText = `Blocker for ${this.name}`; + } + + blockingBody() { + this.block(); + } + + unBlockingBody() { + this.unBlock(); + } +} + +const compatibleManager = new CompatibleManager(); + +singletonManager.set('overlays::overlays::1.x', compatibleManager); +singletonManager.set('overlays::overlays::2.x', compatibleManager); diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/package.json b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/package.json new file mode 100644 index 000000000..5bf693476 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/example-success/package.json @@ -0,0 +1,9 @@ +{ + "name": "fail-demo-app", + "version": "1.0.0", + "dependencies": { + "@lion/core": "0.13.6", + "page-a": "^1.0.0", + "page-b": "^1.0.0" + } +} diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/index.md b/packages/ui/docs/fundamentals/tools/singleton-manager/index.md new file mode 100644 index 000000000..c596d52a8 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/tools/singleton-manager/index.md) diff --git a/packages/ui/docs/fundamentals/tools/singleton-manager/overview.md b/packages/ui/docs/fundamentals/tools/singleton-manager/overview.md new file mode 100644 index 000000000..bcb433e30 --- /dev/null +++ b/packages/ui/docs/fundamentals/tools/singleton-manager/overview.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../../docs/fundamentals/tools/singleton-manager/overview.md) diff --git a/packages/ui/docs/guides/how-to/create-a-custom-field.md b/packages/ui/docs/guides/how-to/create-a-custom-field.md new file mode 100644 index 000000000..abf05508a --- /dev/null +++ b/packages/ui/docs/guides/how-to/create-a-custom-field.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/guides/how-to/create-a-custom-field.md) diff --git a/packages/ui/docs/guides/how-to/extend-a-native-input.md b/packages/ui/docs/guides/how-to/extend-a-native-input.md new file mode 100644 index 000000000..732d29738 --- /dev/null +++ b/packages/ui/docs/guides/how-to/extend-a-native-input.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/guides/how-to/extend-a-native-input.md) diff --git a/packages/ui/docs/guides/how-to/get-started.md b/packages/ui/docs/guides/how-to/get-started.md new file mode 100644 index 000000000..c6c257997 --- /dev/null +++ b/packages/ui/docs/guides/how-to/get-started.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/guides/how-to/get-started.md) diff --git a/packages/ui/docs/guides/how-to/index.md b/packages/ui/docs/guides/how-to/index.md new file mode 100644 index 000000000..f277f8c7c --- /dev/null +++ b/packages/ui/docs/guides/how-to/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/guides/how-to/index.md) diff --git a/packages/ui/docs/guides/index.md b/packages/ui/docs/guides/index.md new file mode 100644 index 000000000..fda6dd4b0 --- /dev/null +++ b/packages/ui/docs/guides/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../docs/guides/index.md) diff --git a/packages/ui/docs/guides/principles/definitions-and-terms.md b/packages/ui/docs/guides/principles/definitions-and-terms.md new file mode 100644 index 000000000..6ddd68b5b --- /dev/null +++ b/packages/ui/docs/guides/principles/definitions-and-terms.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/guides/principles/definitions-and-terms.md) diff --git a/packages/ui/docs/guides/principles/index.md b/packages/ui/docs/guides/principles/index.md new file mode 100644 index 000000000..782a0ca05 --- /dev/null +++ b/packages/ui/docs/guides/principles/index.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/guides/principles/index.md) diff --git a/packages/ui/docs/guides/principles/scoped-elements.md b/packages/ui/docs/guides/principles/scoped-elements.md new file mode 100644 index 000000000..fe49e687c --- /dev/null +++ b/packages/ui/docs/guides/principles/scoped-elements.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/guides/principles/scoped-elements.md) diff --git a/packages/ui/docs/guides/principles/styling.md b/packages/ui/docs/guides/principles/styling.md new file mode 100644 index 000000000..b642e31f1 --- /dev/null +++ b/packages/ui/docs/guides/principles/styling.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/guides/principles/styling.md) diff --git a/packages/ui/docs/guides/principles/subclasser-apis.md b/packages/ui/docs/guides/principles/subclasser-apis.md new file mode 100644 index 000000000..62c703759 --- /dev/null +++ b/packages/ui/docs/guides/principles/subclasser-apis.md @@ -0,0 +1 @@ +[=> See Source <=](../../../../../docs/guides/principles/subclasser-apis.md) diff --git a/packages/ui/docs/override.js b/packages/ui/docs/override.js new file mode 100644 index 000000000..552d7c9b9 --- /dev/null +++ b/packages/ui/docs/override.js @@ -0,0 +1,15 @@ +/** + * This will override all md files within the folder to only contain [=> See Source <=](../path/to/source.md) + */ + +import { writeFile } from 'fs/promises'; +import glob from 'glob'; + +const allFiles = glob.sync('**/*.md', { nodir: true }); +const files = allFiles; + +for (const filePath of files) { + const insert = 3 + filePath.match(/\//g).length; + const srcPath = `${'../'.repeat(insert)}docs/${filePath}`; + await writeFile(filePath, `[=> See Source <=](${srcPath})`); +}