@ixfx/components 0.14.7 → 0.15.1
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/bundle/index.d.ts +102 -3
- package/bundle/index.js +574 -247
- package/bundle/style.css +2 -82
- package/dist/{button-BYuf72aR.d.ts → button-N92DKoWb.d.ts} +7 -0
- package/dist/{button-B7mgqtxR.js → button-ikByJJPN.js} +29 -8
- package/dist/button.d.ts +1 -1
- package/dist/button.js +1 -1
- package/dist/{colour-picker-BCMU7W7R.js → colour-picker-DwAa6RDh.js} +73 -9
- package/dist/colour-picker.d.ts +1 -1
- package/dist/colour-picker.js +1 -1
- package/dist/form-BGZK3jZd.d.ts +54 -0
- package/dist/form-CY0nibZ5.js +418 -0
- package/dist/form.d.ts +1 -13
- package/dist/form.js +1 -1
- package/dist/{index-tq6f8007.d.ts → index-DN2BWctP.d.ts} +3 -0
- package/dist/index.d.ts +54 -6
- package/dist/index.js +138 -8
- package/dist/style.css +2 -82
- package/dist/{tab-list-CexFFg6O.d.ts → tab-list-Df371rqw.d.ts} +1 -0
- package/dist/tab-list-R_bGbDvO.js +766 -0
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.js +1 -673
- package/docs-user/button.md +1 -0
- package/docs-user/colour-picker.md +19 -0
- package/docs-user/form.md +97 -4
- package/docs-user/index.json +2 -2
- package/docs-user/multicol-list.md +1 -1
- package/docs-user/tabs.md +30 -0
- package/package.json +2 -1
- package/dist/form-CsXJX15p.js +0 -62
package/bundle/style.css
CHANGED
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
--radius-m: 4px;
|
|
44
44
|
--radius-l: 6px;
|
|
45
45
|
--radius-xl: 8px;
|
|
46
|
-
--shadow-m: light-dark(
|
|
47
|
-
--shadow-l:
|
|
46
|
+
--shadow-m: 0 3px 10px light-dark(#0000001a, #0000004d);
|
|
47
|
+
--shadow-l: 0 4px 20px light-dark(#00000026, #00000080);
|
|
48
48
|
--disabled-opacity: .5;
|
|
49
49
|
--transition: .15s ease-out;
|
|
50
50
|
--prominence-idle-opacity: light-dark(.55, .6);
|
|
@@ -96,83 +96,3 @@
|
|
|
96
96
|
ixfx-grouped-item-lister {
|
|
97
97
|
display: block;
|
|
98
98
|
}
|
|
99
|
-
ixfx-form {
|
|
100
|
-
display: block;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
ixfx-form-group {
|
|
104
|
-
display: block;
|
|
105
|
-
container-type: inline-size;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
ixfx-form-group fieldset {
|
|
109
|
-
gap: var(--space-m) var(--space-l);
|
|
110
|
-
margin: 0;
|
|
111
|
-
border: 0;
|
|
112
|
-
grid-template-columns: 1fr;
|
|
113
|
-
min-inline-size: 0;
|
|
114
|
-
margin-block-start: var(--space-m);
|
|
115
|
-
margin-block-end: var(--space-m);
|
|
116
|
-
padding: 0;
|
|
117
|
-
display: grid;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
ixfx-form-group fieldset > legend:empty {
|
|
121
|
-
display: none;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
ixfx-form-group fieldset > legend {
|
|
125
|
-
font-weight: var(--font-weight-bold);
|
|
126
|
-
grid-column: 1 / -1;
|
|
127
|
-
margin-block-start: var(--space-m);
|
|
128
|
-
margin-block-end: var(--space-s);
|
|
129
|
-
padding: 0;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
ixfx-form-group fieldset > :not(ixfx-form-part) {
|
|
133
|
-
grid-column: 1 / -1;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
ixfx-form-part {
|
|
137
|
-
grid-column: 1 / -1;
|
|
138
|
-
grid-template-columns: 1fr;
|
|
139
|
-
align-items: start;
|
|
140
|
-
display: grid;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
ixfx-form-part > label {
|
|
144
|
-
font-size: var(--ixfx-form-label-font-size, var(--text-s));
|
|
145
|
-
font-weight: var(--ixfx-form-label-font-weight, inherit);
|
|
146
|
-
font-family: var(--ixfx-form-label-font-family, inherit);
|
|
147
|
-
color: var(--ixfx-form-label-color, inherit);
|
|
148
|
-
text-transform: var(--ixfx-form-label-text-transform, uppercase);
|
|
149
|
-
padding-bottom: var(--space-xs);
|
|
150
|
-
grid-area: 1 / 1;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
ixfx-form-part > input, ixfx-form-part > select, ixfx-form-part > textarea {
|
|
154
|
-
grid-area: 2 / 1;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
@container (width >= 30rem) {
|
|
158
|
-
ixfx-form-group fieldset {
|
|
159
|
-
grid-template-columns: max-content 1fr;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
ixfx-form-part {
|
|
163
|
-
grid-column: 1 / -1;
|
|
164
|
-
grid-template-columns: subgrid;
|
|
165
|
-
align-items: baseline;
|
|
166
|
-
display: grid;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
ixfx-form-part > label {
|
|
170
|
-
padding-right: var(--space-xs);
|
|
171
|
-
grid-area: 1 / 1;
|
|
172
|
-
padding-bottom: 0;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
ixfx-form-part > input, ixfx-form-part > select, ixfx-form-part > textarea {
|
|
176
|
-
grid-area: 1 / 2;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
@@ -43,6 +43,13 @@ declare class ButtonElement extends LitElement {
|
|
|
43
43
|
* attribute).
|
|
44
44
|
*/
|
|
45
45
|
value: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* What clicking does inside a `<form>` (including `ixfx-form`): `submit`
|
|
48
|
+
* submits it, `reset` resets it. The default, `button`, does nothing.
|
|
49
|
+
*/
|
|
50
|
+
type: `button` | `submit` | `reset`;
|
|
51
|
+
static formAssociated: boolean;
|
|
52
|
+
formDisabledCallback(disabled: boolean): void;
|
|
46
53
|
protected _renderIcon(): typeof nothing | import("lit").TemplateResult<1>;
|
|
47
54
|
protected render(): import("lit").TemplateResult<1>;
|
|
48
55
|
static styles: import("lit").CSSResult[];
|
|
@@ -123,16 +123,33 @@ let ButtonElement = class ButtonElement extends LitElement {
|
|
|
123
123
|
this.subtle = false;
|
|
124
124
|
this.toggleable = false;
|
|
125
125
|
this.value = false;
|
|
126
|
+
this.type = `button`;
|
|
127
|
+
this.#internals = this.attachInternals?.();
|
|
128
|
+
this.#formDisabled = false;
|
|
126
129
|
this.#handleClick = () => {
|
|
127
|
-
if (
|
|
128
|
-
this.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
if (this.disabled || this.#formDisabled) return;
|
|
131
|
+
if (this.toggleable) {
|
|
132
|
+
this.value = !this.value;
|
|
133
|
+
this.dispatchEvent(new CustomEvent(`toggle`, {
|
|
134
|
+
detail: { value: this.value },
|
|
135
|
+
bubbles: true,
|
|
136
|
+
composed: true
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
const form = this.#internals?.form ?? this.closest(`form`);
|
|
140
|
+
if (this.type === `submit`) form?.requestSubmit();
|
|
141
|
+
else if (this.type === `reset`) form?.reset();
|
|
134
142
|
};
|
|
135
143
|
}
|
|
144
|
+
static {
|
|
145
|
+
this.formAssociated = true;
|
|
146
|
+
}
|
|
147
|
+
#internals;
|
|
148
|
+
#formDisabled;
|
|
149
|
+
formDisabledCallback(disabled) {
|
|
150
|
+
this.#formDisabled = disabled;
|
|
151
|
+
this.requestUpdate();
|
|
152
|
+
}
|
|
136
153
|
#handleClick;
|
|
137
154
|
_renderIcon() {
|
|
138
155
|
if (this.hideIcon || !this.icon) return nothing;
|
|
@@ -143,7 +160,7 @@ let ButtonElement = class ButtonElement extends LitElement {
|
|
|
143
160
|
render() {
|
|
144
161
|
this.hasIcon = !this.hideIcon && !!this.icon;
|
|
145
162
|
const label = this.hideLabel ? nothing : html`<span class="button-label"><slot></slot></span>`;
|
|
146
|
-
return html`<button ?disabled=${this.disabled} @click=${this.#handleClick}>${this._renderIcon()}${label}</button>`;
|
|
163
|
+
return html`<button ?disabled=${this.disabled || this.#formDisabled} @click=${this.#handleClick}>${this._renderIcon()}${label}</button>`;
|
|
147
164
|
}
|
|
148
165
|
static {
|
|
149
166
|
this.styles = [prominenceStyles, buttonStyles];
|
|
@@ -178,6 +195,10 @@ __decorate([property({
|
|
|
178
195
|
type: Boolean,
|
|
179
196
|
reflect: true
|
|
180
197
|
})], ButtonElement.prototype, "value", void 0);
|
|
198
|
+
__decorate([property({
|
|
199
|
+
type: String,
|
|
200
|
+
reflect: true
|
|
201
|
+
})], ButtonElement.prototype, "type", void 0);
|
|
181
202
|
ButtonElement = __decorate([safeCustomElement(`ixfx-button`)], ButtonElement);
|
|
182
203
|
//#endregion
|
|
183
204
|
export { buttonStyles as n, ButtonElement as t };
|
package/dist/button.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ButtonElementEventMap, t as ButtonElement } from "./button-
|
|
1
|
+
import { n as ButtonElementEventMap, t as ButtonElement } from "./button-N92DKoWb.js";
|
|
2
2
|
export { ButtonElement, ButtonElementEventMap };
|
package/dist/button.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ButtonElement } from "./button-
|
|
1
|
+
import { t as ButtonElement } from "./button-ikByJJPN.js";
|
|
2
2
|
export { ButtonElement };
|
|
@@ -595,6 +595,7 @@ let ColourPickerPopup = class ColourPickerPopup extends LitElement {
|
|
|
595
595
|
this.size = `medium`;
|
|
596
596
|
this._isOpen = false;
|
|
597
597
|
this._everOpened = false;
|
|
598
|
+
this._hasAction = false;
|
|
598
599
|
this._pendingL = this.l;
|
|
599
600
|
this._pendingC = this.c;
|
|
600
601
|
this._pendingH = this.h;
|
|
@@ -662,6 +663,9 @@ let ColourPickerPopup = class ColourPickerPopup extends LitElement {
|
|
|
662
663
|
this._popupEl.hidePopover();
|
|
663
664
|
} catch {}
|
|
664
665
|
};
|
|
666
|
+
this._onActionSlotChange = (e) => {
|
|
667
|
+
this._hasAction = e.target.assignedNodes().length > 0;
|
|
668
|
+
};
|
|
665
669
|
this._onSwatchClick = async () => {
|
|
666
670
|
if (!this._everOpened) {
|
|
667
671
|
this._everOpened = true;
|
|
@@ -714,6 +718,11 @@ let ColourPickerPopup = class ColourPickerPopup extends LitElement {
|
|
|
714
718
|
const swatch = this.shadowRoot?.querySelector(`.swatch`);
|
|
715
719
|
if (swatch) swatch.style.background = swatchBackground(this.l, this.c, this.h, this.a);
|
|
716
720
|
}
|
|
721
|
+
close() {
|
|
722
|
+
try {
|
|
723
|
+
this._popupEl.hidePopover();
|
|
724
|
+
} catch {}
|
|
725
|
+
}
|
|
717
726
|
_dispatchInput() {
|
|
718
727
|
const detail = {
|
|
719
728
|
l: this.l,
|
|
@@ -779,11 +788,14 @@ let ColourPickerPopup = class ColourPickerPopup extends LitElement {
|
|
|
779
788
|
@input=${this._onPickerInput}
|
|
780
789
|
@change=${this._onPickerChange}
|
|
781
790
|
></ixfx-colour-picker>
|
|
782
|
-
|
|
783
|
-
<
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
791
|
+
<div class="footer" ?hidden=${this.mode !== `confirm` && !this._hasAction}>
|
|
792
|
+
<slot name="action" @slotchange=${this._onActionSlotChange}></slot>
|
|
793
|
+
${this.mode === `confirm` ? html`
|
|
794
|
+
<button class="confirm-btn" @click=${this._onConfirm} aria-label="Confirm colour" title="Confirm colour">
|
|
795
|
+
${unsafeHTML(ICON_CHECK)}
|
|
796
|
+
</button>
|
|
797
|
+
` : nothing}
|
|
798
|
+
</div>
|
|
787
799
|
` : nothing}
|
|
788
800
|
</div>
|
|
789
801
|
`;
|
|
@@ -831,11 +843,22 @@ let ColourPickerPopup = class ColourPickerPopup extends LitElement {
|
|
|
831
843
|
min-width: var(--cp-popup-min-width);
|
|
832
844
|
min-height: var(--cp-popup-min-height);
|
|
833
845
|
|
|
834
|
-
/* CSS anchor positioning — position-anchor set via inline style in JS
|
|
846
|
+
/* CSS anchor positioning — position-anchor set via inline style in JS.
|
|
847
|
+
Preferred: centred horizontally below the swatch. Fallbacks: above,
|
|
848
|
+
then right/left of the swatch, vertically centred.
|
|
849
|
+
Centring uses anchor-center (not translate) so the browser's overflow
|
|
850
|
+
check for the fallbacks sees the popup's real position. */
|
|
835
851
|
position: fixed;
|
|
836
|
-
|
|
837
|
-
|
|
852
|
+
top: anchor(bottom);
|
|
853
|
+
bottom: 0;
|
|
854
|
+
left: 0;
|
|
855
|
+
right: 0;
|
|
856
|
+
width: max-content;
|
|
857
|
+
height: max-content;
|
|
858
|
+
justify-self: unsafe anchor-center;
|
|
859
|
+
align-self: start;
|
|
838
860
|
margin-block-start: 4px;
|
|
861
|
+
position-try-fallbacks: --cp-above, --cp-right, --cp-left;
|
|
839
862
|
|
|
840
863
|
padding: var(--space-l);
|
|
841
864
|
z-index: 100;
|
|
@@ -847,6 +870,30 @@ let ColourPickerPopup = class ColourPickerPopup extends LitElement {
|
|
|
847
870
|
transition: opacity 0.12s ease, scale 0.12s ease;
|
|
848
871
|
}
|
|
849
872
|
|
|
873
|
+
@position-try --cp-above {
|
|
874
|
+
inset: 0;
|
|
875
|
+
bottom: anchor(top);
|
|
876
|
+
justify-self: unsafe anchor-center;
|
|
877
|
+
align-self: end;
|
|
878
|
+
margin: 0 0 4px;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
@position-try --cp-right {
|
|
882
|
+
inset: 0;
|
|
883
|
+
left: anchor(right);
|
|
884
|
+
justify-self: start;
|
|
885
|
+
align-self: anchor-center;
|
|
886
|
+
margin: 0 0 0 4px;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
@position-try --cp-left {
|
|
890
|
+
inset: 0;
|
|
891
|
+
right: anchor(left);
|
|
892
|
+
justify-self: end;
|
|
893
|
+
align-self: anchor-center;
|
|
894
|
+
margin: 0 4px 0 0;
|
|
895
|
+
}
|
|
896
|
+
|
|
850
897
|
.popup:popover-open {
|
|
851
898
|
opacity: 1;
|
|
852
899
|
scale: 1;
|
|
@@ -857,11 +904,27 @@ let ColourPickerPopup = class ColourPickerPopup extends LitElement {
|
|
|
857
904
|
display: block;
|
|
858
905
|
}
|
|
859
906
|
|
|
907
|
+
.footer {
|
|
908
|
+
display: flex;
|
|
909
|
+
align-items: center;
|
|
910
|
+
gap: var(--space-s);
|
|
911
|
+
margin-block-start: var(--space-s);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
.footer[hidden] {
|
|
915
|
+
display: none;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
.footer slot[name='action'] {
|
|
919
|
+
display: flex;
|
|
920
|
+
align-items: center;
|
|
921
|
+
gap: var(--space-s);
|
|
922
|
+
}
|
|
923
|
+
|
|
860
924
|
.confirm-btn {
|
|
861
925
|
display: flex;
|
|
862
926
|
align-items: center;
|
|
863
927
|
justify-content: center;
|
|
864
|
-
margin-block-start: var(--space-s);
|
|
865
928
|
margin-inline-start: auto;
|
|
866
929
|
width: 1.8em;
|
|
867
930
|
height: 1.8em;
|
|
@@ -927,6 +990,7 @@ __decorate([property({
|
|
|
927
990
|
__decorate([property({ type: String })], ColourPickerPopup.prototype, "size", void 0);
|
|
928
991
|
__decorate([state()], ColourPickerPopup.prototype, "_isOpen", void 0);
|
|
929
992
|
__decorate([state()], ColourPickerPopup.prototype, "_everOpened", void 0);
|
|
993
|
+
__decorate([state()], ColourPickerPopup.prototype, "_hasAction", void 0);
|
|
930
994
|
__decorate([query(`.popup`)], ColourPickerPopup.prototype, "_popupEl", void 0);
|
|
931
995
|
__decorate([query(`ixfx-colour-picker`)], ColourPickerPopup.prototype, "_pickerEl", void 0);
|
|
932
996
|
ColourPickerPopup = __decorate([safeCustomElement(`ixfx-colour-picker-popup`)], ColourPickerPopup);
|
package/dist/colour-picker.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ColourPickerInputEvent, i as ColourPickerEventDetail, n as ColourPicker, o as OklchValue, r as ColourPickerChangeEvent, t as ColourPickerPopup } from "./index-
|
|
1
|
+
import { a as ColourPickerInputEvent, i as ColourPickerEventDetail, n as ColourPicker, o as OklchValue, r as ColourPickerChangeEvent, t as ColourPickerPopup } from "./index-DN2BWctP.js";
|
|
2
2
|
export { ColourPicker, type ColourPickerChangeEvent, type ColourPickerEventDetail, type ColourPickerInputEvent, ColourPickerPopup, type OklchValue };
|
package/dist/colour-picker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ColourPicker, t as ColourPickerPopup } from "./colour-picker-
|
|
1
|
+
import { n as ColourPicker, t as ColourPickerPopup } from "./colour-picker-DwAa6RDh.js";
|
|
2
2
|
export { ColourPicker, ColourPickerPopup };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
//#region src/form/form-values.d.ts
|
|
3
|
+
type CollectFormValuesOptions = {
|
|
4
|
+
/** Return numbers (or `null` when empty) for `number` and `range` inputs, instead of strings. */
|
|
5
|
+
typed?: boolean;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/form/form.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Wraps its content in a native `<form>`, so submit, Enter-to-submit,
|
|
11
|
+
* validation, `FormData` and `form.elements` behave as they do for any form.
|
|
12
|
+
* Submitting never navigates: listen for the standard `submit` event.
|
|
13
|
+
*/
|
|
14
|
+
declare class FormElement extends LitElement {
|
|
15
|
+
/** Label justification in the wide layout. Groups can override. */
|
|
16
|
+
labelAlign: `left` | `right`;
|
|
17
|
+
/** Skip validation when submitting (like `<form novalidate>`). `reportValidity()` still validates. */
|
|
18
|
+
noValidate: boolean;
|
|
19
|
+
private _form?;
|
|
20
|
+
private _observer?;
|
|
21
|
+
protected createRenderRoot(): this;
|
|
22
|
+
/** The native form element that holds the content. */
|
|
23
|
+
get form(): HTMLFormElement;
|
|
24
|
+
/** Native controls in the form. Components with their own shadow root are not included. */
|
|
25
|
+
get elements(): HTMLFormControlsCollection;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
protected updated(): void;
|
|
29
|
+
/** Moves everything into the native form. Nodes (not just elements) move so Lit's markers stay with their content. */
|
|
30
|
+
private _adoptChildren;
|
|
31
|
+
/**
|
|
32
|
+
* Browsers only submit on Enter when the form has a native submit button
|
|
33
|
+
* or a single text field. Cover the other cases (e.g. an `ixfx-button`).
|
|
34
|
+
*/
|
|
35
|
+
private readonly _onKeydown;
|
|
36
|
+
/** Validates (unless `novalidate`), then fires `submit`. */
|
|
37
|
+
requestSubmit(): void;
|
|
38
|
+
/** Resets native controls. Components with their own shadow root are not reset. */
|
|
39
|
+
reset(): void;
|
|
40
|
+
/** True if all native controls are valid. Shows nothing. */
|
|
41
|
+
checkValidity(): boolean;
|
|
42
|
+
/** True if all native controls are valid. Otherwise shows the browser's message on the first invalid one. */
|
|
43
|
+
reportValidity(): boolean;
|
|
44
|
+
/** Values of all named controls, including components with their own shadow root. Numbers are strings unless `typed`. */
|
|
45
|
+
getValues(options?: CollectFormValuesOptions): Record<string, unknown>;
|
|
46
|
+
setValues(data: Record<string, unknown>): void;
|
|
47
|
+
}
|
|
48
|
+
declare global {
|
|
49
|
+
interface HTMLElementTagNameMap {
|
|
50
|
+
'ixfx-form': FormElement;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { FormElement as t };
|