@lion/ui 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/icon/src/icons.js +14 -2
- package/components/icon/test/hammer.svg.js +5 -2
- package/components/icon/test/heart.svg.js +5 -2
- package/components/icon/test/lion-icon.test.js +10 -4
- package/components/input-stepper/src/LionInputStepper.js +10 -10
- package/components/localize/src/getLocalizeManager.js +16 -10
- package/components/localize/test/getLocalizeManager.test.js +15 -7
- package/components/localize/test/side-effect-free-entrypoint.test.js +9 -3
- package/components/overlays/src/singleton.js +14 -4
- package/components/select-rich/src/LionSelectRich.js +4 -2
- package/components/select-rich/test/lion-select-rich.test.js +376 -1
- package/custom-elements.json +55 -13
- package/dist-types/components/icon/src/LionIcon.d.ts +1 -1
- package/dist-types/components/icon/src/LionIcon.d.ts.map +1 -1
- package/dist-types/components/icon/src/icons.d.ts +2 -1
- package/dist-types/components/icon/src/icons.d.ts.map +1 -1
- package/dist-types/components/icon/test/hammer.svg.d.ts +1 -1
- package/dist-types/components/icon/test/hammer.svg.d.ts.map +1 -1
- package/dist-types/components/icon/test/heart.svg.d.ts +1 -1
- package/dist-types/components/icon/test/heart.svg.d.ts.map +1 -1
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts +4 -4
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts.map +1 -1
- package/dist-types/components/localize/src/getLocalizeManager.d.ts +2 -58
- package/dist-types/components/localize/src/getLocalizeManager.d.ts.map +1 -1
- package/dist-types/components/localize/test/getLocalizeManager.test.d.ts +4 -1
- package/dist-types/components/localize/test/getLocalizeManager.test.d.ts.map +1 -1
- package/dist-types/components/localize/test/side-effect-free-entrypoint.test.d.ts +4 -0
- package/dist-types/components/localize/test/side-effect-free-entrypoint.test.d.ts.map +1 -1
- package/dist-types/components/overlays/src/singleton.d.ts.map +1 -1
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/components/select-rich/test/lion-select-rich.test.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/form/use-cases.md +2 -2
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/api-table.md +2 -0
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/listbox/use-cases.md +1 -1
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select/use-cases.md +1 -1
- package/docs/components/select-rich/use-cases.md +16 -2
- package/docs/components/tabs/examples.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/rationales/accessibility.md +1 -1
- package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/validate.md +2 -2
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/create-a-form.md +4 -4
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/package.json +2 -2
|
@@ -6,7 +6,8 @@ import { LionOption } from '@lion/ui/listbox.js';
|
|
|
6
6
|
import '@lion/ui/define/lion-select-rich.js';
|
|
7
7
|
import '@lion/ui/define/lion-listbox.js';
|
|
8
8
|
import '@lion/ui/define/lion-option.js';
|
|
9
|
-
import
|
|
9
|
+
import '@lion/ui/define/lion-tabs.js';
|
|
10
|
+
import { LitElement, nothing } from 'lit';
|
|
10
11
|
import sinon from 'sinon';
|
|
11
12
|
import {
|
|
12
13
|
fixture as _fixture,
|
|
@@ -16,7 +17,9 @@ import {
|
|
|
16
17
|
defineCE,
|
|
17
18
|
expect,
|
|
18
19
|
html,
|
|
20
|
+
waitUntil,
|
|
19
21
|
} from '@open-wc/testing';
|
|
22
|
+
import { cache } from 'lit/directives/cache.js';
|
|
20
23
|
|
|
21
24
|
import { isActiveElement } from '../../core/test-helpers/isActiveElement.js';
|
|
22
25
|
|
|
@@ -724,6 +727,378 @@ describe('lion-select-rich', () => {
|
|
|
724
727
|
});
|
|
725
728
|
});
|
|
726
729
|
|
|
730
|
+
describe('Render from `lit` `cache`', () => {
|
|
731
|
+
describe('when `lion-option` is set by `.choiceValue` property with and no `checked` attribute', () => {
|
|
732
|
+
it('should display the second option', async () => {
|
|
733
|
+
const colours = [
|
|
734
|
+
{
|
|
735
|
+
label: 'Red',
|
|
736
|
+
value: 'red',
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
label: 'Blue',
|
|
740
|
+
value: 'blue',
|
|
741
|
+
},
|
|
742
|
+
];
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Note, inactive tab content is **destroyed** on every tab switch.
|
|
746
|
+
*/
|
|
747
|
+
class Wrapper extends LitElement {
|
|
748
|
+
static properties = {
|
|
749
|
+
...super.properties,
|
|
750
|
+
activeTabIndex: { type: Number },
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
constructor() {
|
|
754
|
+
super();
|
|
755
|
+
this.activeTabIndex = 0;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* @param {number} index
|
|
760
|
+
*/
|
|
761
|
+
changeActiveTabIndex(index) {
|
|
762
|
+
this.activeTabIndex = index;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
render() {
|
|
766
|
+
const changeActiveTabIndexRef = this.changeActiveTabIndex.bind(this);
|
|
767
|
+
return html`
|
|
768
|
+
<lion-tabs>
|
|
769
|
+
<button slot="tab" class="first-button" @click=${() => changeActiveTabIndexRef(0)}>
|
|
770
|
+
Info
|
|
771
|
+
</button>
|
|
772
|
+
<p slot="panel">
|
|
773
|
+
${cache(
|
|
774
|
+
this.activeTabIndex === 0
|
|
775
|
+
? html`<lion-select-rich name="favoriteColor" label="Favorite color">
|
|
776
|
+
${colours.map(
|
|
777
|
+
colour =>
|
|
778
|
+
html`<lion-option .choiceValue="${colour.value}"
|
|
779
|
+
>${colour.label}</lion-option
|
|
780
|
+
>`,
|
|
781
|
+
)}
|
|
782
|
+
</lion-select-rich>`
|
|
783
|
+
: nothing,
|
|
784
|
+
)}
|
|
785
|
+
</p>
|
|
786
|
+
<button slot="tab" class="second-button" @click=${() => changeActiveTabIndexRef(1)}>
|
|
787
|
+
Work
|
|
788
|
+
</button>
|
|
789
|
+
<p slot="panel">Info page with lots of information about us.</p>
|
|
790
|
+
</lion-tabs>
|
|
791
|
+
`;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
const wrapperFixture = /** @type {(arg: TemplateResult) => Promise<Wrapper>} */ (_fixture);
|
|
796
|
+
const tagString = defineCE(Wrapper);
|
|
797
|
+
const wrapperTag = unsafeStatic(tagString);
|
|
798
|
+
const wrapperElement = /** @type {Wrapper} */ (
|
|
799
|
+
await wrapperFixture(html`<${wrapperTag}></${wrapperTag}>`)
|
|
800
|
+
);
|
|
801
|
+
await wrapperElement.updateComplete;
|
|
802
|
+
const wrapperElementShadowRoot = wrapperElement.shadowRoot;
|
|
803
|
+
/**
|
|
804
|
+
* @returns { HTMLElement | null | undefined }
|
|
805
|
+
*/
|
|
806
|
+
const getFirstButton = () => wrapperElementShadowRoot?.querySelector('.first-button');
|
|
807
|
+
/**
|
|
808
|
+
* @returns { HTMLElement | null | undefined }
|
|
809
|
+
*/
|
|
810
|
+
const getSecondButton = () => wrapperElementShadowRoot?.querySelector('.second-button');
|
|
811
|
+
/**
|
|
812
|
+
* @returns { HTMLElement | null | undefined }
|
|
813
|
+
*/
|
|
814
|
+
const getInvoker = () => wrapperElementShadowRoot?.querySelector('lion-select-invoker');
|
|
815
|
+
/**
|
|
816
|
+
* @returns { boolean }
|
|
817
|
+
*/
|
|
818
|
+
const isSelectRichRendered = () => !!getInvoker()?.shadowRoot?.childNodes.length;
|
|
819
|
+
/**
|
|
820
|
+
* @returns { string | undefined }
|
|
821
|
+
*/
|
|
822
|
+
const getSelectedColourLabel = () =>
|
|
823
|
+
getInvoker()?.shadowRoot?.querySelector('#content-wrapper')?.textContent?.trim();
|
|
824
|
+
const getDialog = () =>
|
|
825
|
+
wrapperElementShadowRoot
|
|
826
|
+
?.querySelector('lion-select-rich')
|
|
827
|
+
?.shadowRoot?.querySelector('dialog');
|
|
828
|
+
const isDialogVisible = () =>
|
|
829
|
+
// @ts-ignore
|
|
830
|
+
getDialog()?.checkVisibility() === true &&
|
|
831
|
+
getDialog()?.querySelector('#overlay-content-node-wrapper[data-popper-placement]');
|
|
832
|
+
await waitUntil(isSelectRichRendered);
|
|
833
|
+
getInvoker()?.click();
|
|
834
|
+
await waitUntil(isDialogVisible);
|
|
835
|
+
const optionBlue = /** @type { HTMLElement | undefined } */ (
|
|
836
|
+
wrapperElementShadowRoot?.querySelectorAll('lion-option')
|
|
837
|
+
)?.[1];
|
|
838
|
+
optionBlue?.click();
|
|
839
|
+
await waitUntil(() => !isDialogVisible());
|
|
840
|
+
const selectedColourLabelBeforeTabSwitch = getSelectedColourLabel();
|
|
841
|
+
expect(selectedColourLabelBeforeTabSwitch).to.equal('Blue');
|
|
842
|
+
getSecondButton()?.click();
|
|
843
|
+
await waitUntil(() => !isSelectRichRendered());
|
|
844
|
+
getFirstButton()?.click();
|
|
845
|
+
await waitUntil(isSelectRichRendered);
|
|
846
|
+
const selectedColourAfterTabSwitch = getSelectedColourLabel();
|
|
847
|
+
expect(selectedColourAfterTabSwitch).to.equal('Blue');
|
|
848
|
+
});
|
|
849
|
+
});
|
|
850
|
+
describe('when `lion-option` is set by `.choiceValue` property and `checked` attribute', () => {
|
|
851
|
+
it('should display the second option', async () => {
|
|
852
|
+
const colours = [
|
|
853
|
+
{
|
|
854
|
+
label: 'Red',
|
|
855
|
+
value: 'red',
|
|
856
|
+
checked: true,
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
label: 'Blue',
|
|
860
|
+
value: 'blue',
|
|
861
|
+
checked: false,
|
|
862
|
+
},
|
|
863
|
+
];
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* Note, inactive tab content is **destroyed** on every tab switch.
|
|
867
|
+
*/
|
|
868
|
+
class Wrapper extends LitElement {
|
|
869
|
+
static properties = {
|
|
870
|
+
...super.properties,
|
|
871
|
+
activeTabIndex: { type: Number },
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
constructor() {
|
|
875
|
+
super();
|
|
876
|
+
this.activeTabIndex = 0;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* @param {number} index
|
|
881
|
+
*/
|
|
882
|
+
changeActiveTabIndex(index) {
|
|
883
|
+
this.activeTabIndex = index;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
render() {
|
|
887
|
+
const changeActiveTabIndexRef = this.changeActiveTabIndex.bind(this);
|
|
888
|
+
return html`
|
|
889
|
+
<lion-tabs>
|
|
890
|
+
<button slot="tab" class="first-button" @click=${() => changeActiveTabIndexRef(0)}>
|
|
891
|
+
Info
|
|
892
|
+
</button>
|
|
893
|
+
<p slot="panel">
|
|
894
|
+
${cache(
|
|
895
|
+
this.activeTabIndex === 0
|
|
896
|
+
? html`<lion-select-rich name="favoriteColor" label="Favorite color">
|
|
897
|
+
${colours.map(
|
|
898
|
+
colour =>
|
|
899
|
+
html`<lion-option
|
|
900
|
+
.choiceValue="${colour.value}"
|
|
901
|
+
checked="${colour.checked || nothing}"
|
|
902
|
+
>${colour.label}</lion-option
|
|
903
|
+
>`,
|
|
904
|
+
)}
|
|
905
|
+
</lion-select-rich>`
|
|
906
|
+
: nothing,
|
|
907
|
+
)}
|
|
908
|
+
</p>
|
|
909
|
+
<button slot="tab" class="second-button" @click=${() => changeActiveTabIndexRef(1)}>
|
|
910
|
+
Work
|
|
911
|
+
</button>
|
|
912
|
+
<p slot="panel">Info page with lots of information about us.</p>
|
|
913
|
+
</lion-tabs>
|
|
914
|
+
`;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
const wrapperFixture = /** @type {(arg: TemplateResult) => Promise<Wrapper>} */ (_fixture);
|
|
919
|
+
const tagString = defineCE(Wrapper);
|
|
920
|
+
const wrapperTag = unsafeStatic(tagString);
|
|
921
|
+
const wrapperElement = /** @type {Wrapper} */ (
|
|
922
|
+
await wrapperFixture(html`<${wrapperTag}></${wrapperTag}>`)
|
|
923
|
+
);
|
|
924
|
+
await wrapperElement.updateComplete;
|
|
925
|
+
const wrapperElementShadowRoot = wrapperElement.shadowRoot;
|
|
926
|
+
/**
|
|
927
|
+
* @returns { HTMLElement | null | undefined }
|
|
928
|
+
*/
|
|
929
|
+
const getFirstButton = () => wrapperElementShadowRoot?.querySelector('.first-button');
|
|
930
|
+
/**
|
|
931
|
+
* @returns { HTMLElement | null | undefined }
|
|
932
|
+
*/
|
|
933
|
+
const getSecondButton = () => wrapperElementShadowRoot?.querySelector('.second-button');
|
|
934
|
+
/**
|
|
935
|
+
* @returns { HTMLElement | null | undefined }
|
|
936
|
+
*/
|
|
937
|
+
const getInvoker = () => wrapperElementShadowRoot?.querySelector('lion-select-invoker');
|
|
938
|
+
/**
|
|
939
|
+
* @returns { boolean }
|
|
940
|
+
*/
|
|
941
|
+
const isSelectRichRendered = () => !!getInvoker()?.shadowRoot?.childNodes.length;
|
|
942
|
+
/**
|
|
943
|
+
* @returns { string | undefined }
|
|
944
|
+
*/
|
|
945
|
+
const getSelectedColourLabel = () =>
|
|
946
|
+
getInvoker()?.shadowRoot?.querySelector('#content-wrapper')?.textContent?.trim();
|
|
947
|
+
const getDialog = () =>
|
|
948
|
+
wrapperElementShadowRoot
|
|
949
|
+
?.querySelector('lion-select-rich')
|
|
950
|
+
?.shadowRoot?.querySelector('dialog');
|
|
951
|
+
const isDialogVisible = () =>
|
|
952
|
+
// @ts-ignore
|
|
953
|
+
getDialog()?.checkVisibility() === true &&
|
|
954
|
+
getDialog()?.querySelector('#overlay-content-node-wrapper[data-popper-placement]');
|
|
955
|
+
await waitUntil(isSelectRichRendered);
|
|
956
|
+
getInvoker()?.click();
|
|
957
|
+
await waitUntil(isDialogVisible);
|
|
958
|
+
const optionBlue = /** @type { HTMLElement | undefined } */ (
|
|
959
|
+
wrapperElementShadowRoot?.querySelectorAll('lion-option')
|
|
960
|
+
)?.[1];
|
|
961
|
+
optionBlue?.click();
|
|
962
|
+
await waitUntil(() => !isDialogVisible());
|
|
963
|
+
const selectedColourLabelBeforeTabSwitch = getSelectedColourLabel();
|
|
964
|
+
expect(selectedColourLabelBeforeTabSwitch).to.equal('Blue');
|
|
965
|
+
getSecondButton()?.click();
|
|
966
|
+
await waitUntil(() => !isSelectRichRendered());
|
|
967
|
+
getFirstButton()?.click();
|
|
968
|
+
await waitUntil(isSelectRichRendered);
|
|
969
|
+
const selectedColourAfterTabSwitch = getSelectedColourLabel();
|
|
970
|
+
expect(selectedColourAfterTabSwitch).to.equal('Blue');
|
|
971
|
+
});
|
|
972
|
+
});
|
|
973
|
+
describe('when `lion-option` is set by `.modelValue` property', () => {
|
|
974
|
+
it('should display the second option', async () => {
|
|
975
|
+
const colours = [
|
|
976
|
+
{
|
|
977
|
+
label: 'Red',
|
|
978
|
+
value: 'red',
|
|
979
|
+
checked: true,
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
label: 'Blue',
|
|
983
|
+
value: 'blue',
|
|
984
|
+
checked: false,
|
|
985
|
+
},
|
|
986
|
+
];
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Note, inactive tab content is **destroyed** on every tab switch.
|
|
990
|
+
*/
|
|
991
|
+
class Wrapper extends LitElement {
|
|
992
|
+
static properties = {
|
|
993
|
+
...super.properties,
|
|
994
|
+
activeTabIndex: { type: Number },
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
constructor() {
|
|
998
|
+
super();
|
|
999
|
+
this.activeTabIndex = 0;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* @param {number} index
|
|
1004
|
+
*/
|
|
1005
|
+
changeActiveTabIndex(index) {
|
|
1006
|
+
this.activeTabIndex = index;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
render() {
|
|
1010
|
+
const changeActiveTabIndexRef = this.changeActiveTabIndex.bind(this);
|
|
1011
|
+
return html`
|
|
1012
|
+
<lion-tabs>
|
|
1013
|
+
<button slot="tab" class="first-button" @click=${() => changeActiveTabIndexRef(0)}>
|
|
1014
|
+
Info
|
|
1015
|
+
</button>
|
|
1016
|
+
<p slot="panel">
|
|
1017
|
+
${cache(
|
|
1018
|
+
this.activeTabIndex === 0
|
|
1019
|
+
? html`<lion-select-rich name="favoriteColor" label="Favorite color">
|
|
1020
|
+
${colours.map(
|
|
1021
|
+
colour =>
|
|
1022
|
+
html`<lion-option
|
|
1023
|
+
@model-value-changed=${(/** @type {Event} */ ev) => {
|
|
1024
|
+
const lionOption = /** @type {LionOption} */ (ev.target);
|
|
1025
|
+
// eslint-disable-next-line no-param-reassign
|
|
1026
|
+
colour.checked = lionOption.modelValue.checked;
|
|
1027
|
+
}}
|
|
1028
|
+
.modelValue=${{ value: colour.value, checked: colour.checked }}
|
|
1029
|
+
>${colour.label}</lion-option
|
|
1030
|
+
>`,
|
|
1031
|
+
)}
|
|
1032
|
+
</lion-select-rich>`
|
|
1033
|
+
: nothing,
|
|
1034
|
+
)}
|
|
1035
|
+
</p>
|
|
1036
|
+
<button slot="tab" class="second-button" @click=${() => changeActiveTabIndexRef(1)}>
|
|
1037
|
+
Work
|
|
1038
|
+
</button>
|
|
1039
|
+
<p slot="panel">Info page with lots of information about us.</p>
|
|
1040
|
+
</lion-tabs>
|
|
1041
|
+
`;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
const wrapperFixture = /** @type {(arg: TemplateResult) => Promise<Wrapper>} */ (_fixture);
|
|
1046
|
+
const tagString = defineCE(Wrapper);
|
|
1047
|
+
const wrapperTag = unsafeStatic(tagString);
|
|
1048
|
+
const wrapperElement = /** @type {Wrapper} */ (
|
|
1049
|
+
await wrapperFixture(html`<${wrapperTag}></${wrapperTag}>`)
|
|
1050
|
+
);
|
|
1051
|
+
await wrapperElement.updateComplete;
|
|
1052
|
+
const wrapperElementShadowRoot = wrapperElement.shadowRoot;
|
|
1053
|
+
/**
|
|
1054
|
+
* @returns { HTMLElement | null | undefined }
|
|
1055
|
+
*/
|
|
1056
|
+
const getFirstButton = () => wrapperElementShadowRoot?.querySelector('.first-button');
|
|
1057
|
+
/**
|
|
1058
|
+
* @returns { HTMLElement | null | undefined }
|
|
1059
|
+
*/
|
|
1060
|
+
const getSecondButton = () => wrapperElementShadowRoot?.querySelector('.second-button');
|
|
1061
|
+
/**
|
|
1062
|
+
* @returns { HTMLElement | null | undefined }
|
|
1063
|
+
*/
|
|
1064
|
+
const getInvoker = () => wrapperElementShadowRoot?.querySelector('lion-select-invoker');
|
|
1065
|
+
/**
|
|
1066
|
+
* @returns { boolean }
|
|
1067
|
+
*/
|
|
1068
|
+
const isSelectRichRendered = () => !!getInvoker()?.shadowRoot?.childNodes.length;
|
|
1069
|
+
/**
|
|
1070
|
+
* @returns { string | undefined }
|
|
1071
|
+
*/
|
|
1072
|
+
const getSelectedColourLabel = () =>
|
|
1073
|
+
getInvoker()?.shadowRoot?.querySelector('#content-wrapper')?.textContent?.trim();
|
|
1074
|
+
const getDialog = () =>
|
|
1075
|
+
wrapperElementShadowRoot
|
|
1076
|
+
?.querySelector('lion-select-rich')
|
|
1077
|
+
?.shadowRoot?.querySelector('dialog');
|
|
1078
|
+
const isDialogVisible = () =>
|
|
1079
|
+
// @ts-ignore
|
|
1080
|
+
getDialog()?.checkVisibility() === true &&
|
|
1081
|
+
getDialog()?.querySelector('#overlay-content-node-wrapper[data-popper-placement]');
|
|
1082
|
+
await waitUntil(isSelectRichRendered);
|
|
1083
|
+
getInvoker()?.click();
|
|
1084
|
+
await waitUntil(isDialogVisible);
|
|
1085
|
+
const optionBlue = /** @type { HTMLElement | undefined } */ (
|
|
1086
|
+
wrapperElementShadowRoot?.querySelectorAll('lion-option')
|
|
1087
|
+
)?.[1];
|
|
1088
|
+
optionBlue?.click();
|
|
1089
|
+
await waitUntil(() => !isDialogVisible());
|
|
1090
|
+
const selectedColourLabelBeforeTabSwitch = getSelectedColourLabel();
|
|
1091
|
+
expect(selectedColourLabelBeforeTabSwitch).to.equal('Blue');
|
|
1092
|
+
getSecondButton()?.click();
|
|
1093
|
+
await waitUntil(() => !isSelectRichRendered());
|
|
1094
|
+
getFirstButton()?.click();
|
|
1095
|
+
await waitUntil(isSelectRichRendered);
|
|
1096
|
+
const selectedColourAfterTabSwitch = getSelectedColourLabel();
|
|
1097
|
+
expect(selectedColourAfterTabSwitch).to.equal('Blue');
|
|
1098
|
+
});
|
|
1099
|
+
});
|
|
1100
|
+
});
|
|
1101
|
+
|
|
727
1102
|
describe('Teardown', () => {
|
|
728
1103
|
it('correctly removes event listeners when disconnected from dom', async () => {
|
|
729
1104
|
const el = await fixture(html`
|
package/custom-elements.json
CHANGED
|
@@ -98245,6 +98245,12 @@
|
|
|
98245
98245
|
"module": "components/form-core/src/LionField.js"
|
|
98246
98246
|
}
|
|
98247
98247
|
},
|
|
98248
|
+
{
|
|
98249
|
+
"kind": "method",
|
|
98250
|
+
"name": "_decrement",
|
|
98251
|
+
"description": "Decrement the value based on given step or default step value is 1",
|
|
98252
|
+
"privacy": "protected"
|
|
98253
|
+
},
|
|
98248
98254
|
{
|
|
98249
98255
|
"kind": "method",
|
|
98250
98256
|
"name": "_decrementorSignTemplate",
|
|
@@ -98467,6 +98473,12 @@
|
|
|
98467
98473
|
"module": "components/form-core/src/LionField.js"
|
|
98468
98474
|
}
|
|
98469
98475
|
},
|
|
98476
|
+
{
|
|
98477
|
+
"kind": "method",
|
|
98478
|
+
"name": "_increment",
|
|
98479
|
+
"description": "Increment the value based on given step or default step value is 1",
|
|
98480
|
+
"privacy": "protected"
|
|
98481
|
+
},
|
|
98470
98482
|
{
|
|
98471
98483
|
"kind": "method",
|
|
98472
98484
|
"name": "_incrementorSignTemplate",
|
|
@@ -99183,12 +99195,6 @@
|
|
|
99183
99195
|
"module": "components/form-core/src/LionField.js"
|
|
99184
99196
|
}
|
|
99185
99197
|
},
|
|
99186
|
-
{
|
|
99187
|
-
"kind": "method",
|
|
99188
|
-
"name": "__decrement",
|
|
99189
|
-
"description": "Decrement the value based on given step or default step value is 1",
|
|
99190
|
-
"privacy": "private"
|
|
99191
|
-
},
|
|
99192
99198
|
{
|
|
99193
99199
|
"kind": "method",
|
|
99194
99200
|
"name": "__delegateReadOnly",
|
|
@@ -99400,12 +99406,6 @@
|
|
|
99400
99406
|
"module": "components/form-core/src/LionField.js"
|
|
99401
99407
|
}
|
|
99402
99408
|
},
|
|
99403
|
-
{
|
|
99404
|
-
"kind": "method",
|
|
99405
|
-
"name": "__increment",
|
|
99406
|
-
"description": "Increment the value based on given step or default step value is 1",
|
|
99407
|
-
"privacy": "private"
|
|
99408
|
-
},
|
|
99409
99409
|
{
|
|
99410
99410
|
"kind": "method",
|
|
99411
99411
|
"name": "__initSlots",
|
|
@@ -120038,11 +120038,16 @@
|
|
|
120038
120038
|
"kind": "function",
|
|
120039
120039
|
"name": "getLocalizeManager",
|
|
120040
120040
|
"description": "Side-effect-free alternative for `localize` (the globally shared instance of LocalizeManager).\nWhen this function is imported, no side-effect happened yet, i.e. no global instance was registered yet.\nThe side effect-free approach generates:\n- smaller, optimized bundles\n- a predictable loading order, that allows for:\n - deduping strategies when multiple instances of the localizeManager are on a page\n - providing a customized extension of LocalizeManager\n\nUse it like this:\n\n```js\nfunction myFunction() {\n // note that 'localizeManager' is the same as former 'localize'\n const localizeManager = getLocalizeManger();\n // ...\n}\n```\n\nIn a class, we advise a shared instance:\n```js\nclass MyClass {\n constructor() {\n this._localizeManager = getLocalizeManger();\n }\n // ...\n}\n```\n\nMake sure to always call this method inside a function or class (otherwise side effects are created)\n\nDo you want to register your own LocalizeManager?\nMake sure it's registered before anyone called `getLocalizeManager()`\n\n```js\nimport { singletonManager } from 'singleton-manager';\nimport { getLocalizeManger } from '@lion/ui/localize-no-side-effects.js';\n\n// First register your own LocalizeManager (for deduping or other reasons)\nsingletonManager.set('lion/ui::localize::0.x', class MyLocalizeManager extends LocalizeManager {});\n\n// Now, all your code gets the right instance\nfunction myFuntion() {\n const localizeManager = getLocalizeManager();\n // ...\n}\n\nclass myClass() {\n constructor() {\n this._localizeManager = getLocalizeManager();\n // ...\n }\n}\n```",
|
|
120041
|
+
"deprecated": "Use `localize` directly instead (as this is always side-effect free now)",
|
|
120041
120042
|
"return": {
|
|
120042
120043
|
"type": {
|
|
120043
120044
|
"text": "LocalizeManager"
|
|
120044
120045
|
}
|
|
120045
120046
|
}
|
|
120047
|
+
},
|
|
120048
|
+
{
|
|
120049
|
+
"kind": "function",
|
|
120050
|
+
"name": "getLocalizeManagerLazily"
|
|
120046
120051
|
}
|
|
120047
120052
|
],
|
|
120048
120053
|
"exports": [
|
|
@@ -120050,7 +120055,7 @@
|
|
|
120050
120055
|
"kind": "js",
|
|
120051
120056
|
"name": "getLocalizeManager",
|
|
120052
120057
|
"declaration": {
|
|
120053
|
-
"name": "
|
|
120058
|
+
"name": "getLocalizeManagerLazily",
|
|
120054
120059
|
"module": "components/localize/src/getLocalizeManager.js"
|
|
120055
120060
|
}
|
|
120056
120061
|
}
|
|
@@ -149469,6 +149474,14 @@
|
|
|
149469
149474
|
}
|
|
149470
149475
|
],
|
|
149471
149476
|
"exports": [
|
|
149477
|
+
{
|
|
149478
|
+
"kind": "js",
|
|
149479
|
+
"name": "lazifyInstantiation",
|
|
149480
|
+
"declaration": {
|
|
149481
|
+
"name": "lazifyInstantiation",
|
|
149482
|
+
"module": "./lazifyInstantiation.js"
|
|
149483
|
+
}
|
|
149484
|
+
},
|
|
149472
149485
|
{
|
|
149473
149486
|
"kind": "js",
|
|
149474
149487
|
"name": "SingletonManagerClass",
|
|
@@ -153148,6 +153161,35 @@
|
|
|
153148
153161
|
}
|
|
153149
153162
|
]
|
|
153150
153163
|
},
|
|
153164
|
+
{
|
|
153165
|
+
"kind": "javascript-module",
|
|
153166
|
+
"path": "../singleton-manager/src/lazifyInstantiation.js",
|
|
153167
|
+
"declarations": [
|
|
153168
|
+
{
|
|
153169
|
+
"kind": "function",
|
|
153170
|
+
"name": "lazifyInstantiation",
|
|
153171
|
+
"parameters": [
|
|
153172
|
+
{
|
|
153173
|
+
"name": "registerSingleton"
|
|
153174
|
+
}
|
|
153175
|
+
],
|
|
153176
|
+
"description": "Lazifies the instantiation of singletons. It does so by wrapping the singleton in a Proxy, which delays\ninstantiation until one of its members gets called/set for the first time.\nThis is important in cases where a singleton needs to be overridden on an app level:\nlet's say there are two versions of",
|
|
153177
|
+
"type": {
|
|
153178
|
+
"text": "<T>(func: () => T) => T"
|
|
153179
|
+
}
|
|
153180
|
+
}
|
|
153181
|
+
],
|
|
153182
|
+
"exports": [
|
|
153183
|
+
{
|
|
153184
|
+
"kind": "js",
|
|
153185
|
+
"name": "lazifyInstantiation",
|
|
153186
|
+
"declaration": {
|
|
153187
|
+
"name": "lazifyInstantiation",
|
|
153188
|
+
"module": "../singleton-manager/src/lazifyInstantiation.js"
|
|
153189
|
+
}
|
|
153190
|
+
}
|
|
153191
|
+
]
|
|
153192
|
+
},
|
|
153151
153193
|
{
|
|
153152
153194
|
"kind": "javascript-module",
|
|
153153
153195
|
"path": "../../node_modules/lit-html/node/directives/ref.js",
|
|
@@ -62,7 +62,7 @@ export class LionIcon extends LitElement {
|
|
|
62
62
|
*/
|
|
63
63
|
protected _renderSvg(svgObject: TemplateResult | typeof nothing): void;
|
|
64
64
|
/** @protected */
|
|
65
|
-
protected get _iconManager():
|
|
65
|
+
protected get _iconManager(): import("./IconManager.js").IconManager;
|
|
66
66
|
/**
|
|
67
67
|
* @param {string} prevIconId
|
|
68
68
|
* @protected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LionIcon.d.ts","sourceRoot":"","sources":["../../../../components/icon/src/LionIcon.js"],"names":[],"mappings":"AA6BA;;;;GAIG;AACH;IACE;QAEI;;;WAGG;;;;QAIH;;;WAGG;;;;;;QAMH;;;WAGG;;;;;MAMN;IAED,+CA6BC;IAaD;;;OAGG;IACH,oDAA4F;IAb1F,kBAAmB;IACnB,eAAgB;IAChB;;;OAGG;IACH,cAAoB;IAqBtB,+CAEC;IASD;;;;OAIG;IACH,0FAOC;IAED;;OAEG;IACH,uFAEC;IAED,iBAAiB;IACjB,kCAOC;IAED;;;OAGG;IACH,gCAHW,cAAc,iBAAU,QASlC;IAED,iBAAiB;IAEjB,
|
|
1
|
+
{"version":3,"file":"LionIcon.d.ts","sourceRoot":"","sources":["../../../../components/icon/src/LionIcon.js"],"names":[],"mappings":"AA6BA;;;;GAIG;AACH;IACE;QAEI;;;WAGG;;;;QAIH;;;WAGG;;;;;;QAMH;;;WAGG;;;;;MAMN;IAED,+CA6BC;IAaD;;;OAGG;IACH,oDAA4F;IAb1F,kBAAmB;IACnB,eAAgB;IAChB;;;OAGG;IACH,cAAoB;IAqBtB,+CAEC;IASD;;;;OAIG;IACH,0FAOC;IAED;;OAEG;IACH,uFAEC;IAED,iBAAiB;IACjB,kCAOC;IAED;;;OAGG;IACH,gCAHW,cAAc,iBAAU,QASlC;IAED,iBAAiB;IAEjB,qEAEC;IAED;;;OAGG;IACH,uCAHW,MAAM,iBAyBhB;CACF;6BA9MY,OAAO,KAAK,EAAE,cAAc;0CACZ,oBAAoB,WAAY,MAAM,EAAE,KAAK,MAAM,KAAK,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../../components/icon/src/icons.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../../components/icon/src/icons.js"],"names":[],"mappings":"AAeA,gCAAyD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hammer.svg.d.ts","sourceRoot":"","sources":["../../../../components/icon/test/hammer.svg.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hammer.svg.d.ts","sourceRoot":"","sources":["../../../../components/icon/test/hammer.svg.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heart.svg.d.ts","sourceRoot":"","sources":["../../../../components/icon/test/heart.svg.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"heart.svg.d.ts","sourceRoot":"","sources":["../../../../components/icon/test/heart.svg.js"],"names":[],"mappings":""}
|
|
@@ -36,14 +36,14 @@ export class LionInputStepper extends LionInputStepper_base {
|
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
38
|
* Increment the value based on given step or default step value is 1
|
|
39
|
-
* @
|
|
39
|
+
* @protected
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
protected _increment(): void;
|
|
42
42
|
/**
|
|
43
43
|
* Decrement the value based on given step or default step value is 1
|
|
44
|
-
* @
|
|
44
|
+
* @protected
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
protected _decrement(): void;
|
|
47
47
|
/**
|
|
48
48
|
* @protected
|
|
49
49
|
* @param {Event} ev
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LionInputStepper.d.ts","sourceRoot":"","sources":["../../../../components/input-stepper/src/LionInputStepper.js"],"names":[],"mappings":";AAMA;;GAEG;AAEH;;;;GAIG;AACH;IACE,wFAsBC;IAED,kBAAkB;IAClB,6BAkBC;IAED,kGAGE;IAEF;;OAEG;IACH,2BAEC;IAQC,iCAAiC;IACjC,2BAAyB;IACzB,+BAA6B;IAC7B,YAAmB;IACnB,YAAmB;IACnB;;;OAGG;IACH;;MAA0B;IAC1B,aAAa;IACb;;;;MAIC;IAwKH;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"LionInputStepper.d.ts","sourceRoot":"","sources":["../../../../components/input-stepper/src/LionInputStepper.js"],"names":[],"mappings":";AAMA;;GAEG;AAEH;;;;GAIG;AACH;IACE,wFAsBC;IAED,kBAAkB;IAClB,6BAkBC;IAED,kGAGE;IAEF;;OAEG;IACH,2BAEC;IAQC,iCAAiC;IACjC,2BAAyB;IACzB,+BAA6B;IAC7B,YAAmB;IACnB,YAAmB;IACnB;;;OAGG;IACH;;MAA0B;IAC1B,aAAa;IACb;;;;MAIC;IAwKH;;;OAGG;IACH,6BAgBC;IAED;;;OAGG;IACH,6BAgBC;IA2HD;;;OAGG;IAEH,6BAHW,KAAK,QAQf;IAED;;;;;;;;;;;;OAYG;IAEH,6BAHW,KAAK,QASf;IArWD,0BAeC;IAED,6BAGC;IA0CD;;;;MAMC;IAED;;;OAGG;IACH,+BASC;IAED;;;;OAIG;IACH,yBAQC;IAED;;;OAGG;IACH,oCAeC;IAED;;OAEG;IACH,wCAoBC;IAZK,gCAA2D;IAcjE;;;;;OAKG;IACH,kBAMC;IA8CD;;;;OAIG;IACH,iCAWC;IAED;;;;OAIG;IACH,iCAWC;IAED;;;;OAIG;IACH,qCAGC;IAED;;;;OAIG;IAEH,sCAJa,SAAO,OAAO,KAAK,EAAE,cAAc,CAM/C;IAED;;;;OAIG;IAEH,sCAJa,SAAO,OAAO,KAAK,EAAE,cAAc,CAM/C;IAED;;;;OAIG;IACH,kCAHa,OAAO,KAAK,EAAE,cAAc,CAgBxC;IAED;;;;OAIG;IACH,kCAHa,OAAO,KAAK,EAAE,cAAc,CAgBxC;IAED,iBAAiB;IACjB,sEAYC;CAmCF;4BArcY,OAAO,KAAK,EAAE,aAAa"}
|
|
@@ -1,60 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* When this function is imported, no side-effect happened yet, i.e. no global instance was registered yet.
|
|
4
|
-
* The side effect-free approach generates:
|
|
5
|
-
* - smaller, optimized bundles
|
|
6
|
-
* - a predictable loading order, that allows for:
|
|
7
|
-
* - deduping strategies when multiple instances of the localizeManager are on a page
|
|
8
|
-
* - providing a customized extension of LocalizeManager
|
|
9
|
-
*
|
|
10
|
-
* Use it like this:
|
|
11
|
-
*
|
|
12
|
-
* ```js
|
|
13
|
-
* function myFunction() {
|
|
14
|
-
* // note that 'localizeManager' is the same as former 'localize'
|
|
15
|
-
* const localizeManager = getLocalizeManger();
|
|
16
|
-
* // ...
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* In a class, we advise a shared instance:
|
|
21
|
-
* ```js
|
|
22
|
-
* class MyClass {
|
|
23
|
-
* constructor() {
|
|
24
|
-
* this._localizeManager = getLocalizeManger();
|
|
25
|
-
* }
|
|
26
|
-
* // ...
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* Make sure to always call this method inside a function or class (otherwise side effects are created)
|
|
31
|
-
*
|
|
32
|
-
* Do you want to register your own LocalizeManager?
|
|
33
|
-
* Make sure it's registered before anyone called `getLocalizeManager()`
|
|
34
|
-
*
|
|
35
|
-
* ```js
|
|
36
|
-
* import { singletonManager } from 'singleton-manager';
|
|
37
|
-
* import { getLocalizeManger } from '@lion/ui/localize-no-side-effects.js';
|
|
38
|
-
*
|
|
39
|
-
* // First register your own LocalizeManager (for deduping or other reasons)
|
|
40
|
-
* singletonManager.set('lion/ui::localize::0.x', class MyLocalizeManager extends LocalizeManager {});
|
|
41
|
-
*
|
|
42
|
-
* // Now, all your code gets the right instance
|
|
43
|
-
* function myFuntion() {
|
|
44
|
-
* const localizeManager = getLocalizeManager();
|
|
45
|
-
* // ...
|
|
46
|
-
* }
|
|
47
|
-
*
|
|
48
|
-
* class myClass() {
|
|
49
|
-
* constructor() {
|
|
50
|
-
* this._localizeManager = getLocalizeManager();
|
|
51
|
-
* // ...
|
|
52
|
-
* }
|
|
53
|
-
* }
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* @returns {LocalizeManager}
|
|
57
|
-
*/
|
|
58
|
-
export function getLocalizeManager(): LocalizeManager;
|
|
1
|
+
export { getLocalizeManagerLazily as getLocalizeManager };
|
|
2
|
+
declare function getLocalizeManagerLazily(): LocalizeManager;
|
|
59
3
|
import { LocalizeManager } from "./LocalizeManager.js";
|
|
60
4
|
//# sourceMappingURL=getLocalizeManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocalizeManager.d.ts","sourceRoot":"","sources":["../../../../components/localize/src/getLocalizeManager.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getLocalizeManager.d.ts","sourceRoot":"","sources":["../../../../components/localize/src/getLocalizeManager.js"],"names":[],"mappings":";AA2EA,6DAEC"}
|