@trendyol/baklava 2.0.0-beta.42 → 2.0.0-beta.43

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.
Files changed (34) hide show
  1. package/dist/baklava-react.d.ts +19 -15
  2. package/dist/baklava-react.d.ts.map +1 -1
  3. package/dist/baklava-react.js +1 -1
  4. package/dist/baklava-react.js.map +3 -3
  5. package/dist/baklava.d.ts +11 -9
  6. package/dist/baklava.d.ts.map +1 -1
  7. package/dist/baklava.js +1 -1
  8. package/dist/chunk-5VLVLBWY.js +2 -0
  9. package/dist/chunk-5VLVLBWY.js.map +7 -0
  10. package/dist/{chunk-SI4AOUS5.js → chunk-FFIDELPT.js} +3 -3
  11. package/dist/{chunk-SI4AOUS5.js.map → chunk-FFIDELPT.js.map} +0 -0
  12. package/dist/chunk-JDM44V27.js +20 -0
  13. package/dist/chunk-JDM44V27.js.map +7 -0
  14. package/dist/chunk-WFBCOT52.js +20 -0
  15. package/dist/chunk-WFBCOT52.js.map +7 -0
  16. package/dist/components/alert/bl-alert.js +1 -1
  17. package/dist/components/input/bl-input.js +1 -1
  18. package/dist/components/pagination/bl-pagination.js +1 -1
  19. package/dist/components/radio-group/bl-radio-group.d.ts +50 -0
  20. package/dist/components/radio-group/bl-radio-group.d.ts.map +1 -0
  21. package/dist/components/radio-group/bl-radio-group.js +2 -0
  22. package/dist/components/radio-group/bl-radio-group.js.map +7 -0
  23. package/dist/components/radio-group/bl-radio-group.test.d.ts +2 -0
  24. package/dist/components/radio-group/bl-radio-group.test.d.ts.map +1 -0
  25. package/dist/components/radio-group/radio/bl-radio.d.ts +60 -0
  26. package/dist/components/radio-group/radio/bl-radio.d.ts.map +1 -0
  27. package/dist/components/radio-group/radio/bl-radio.js +2 -0
  28. package/dist/components/radio-group/radio/bl-radio.js.map +7 -0
  29. package/dist/components/radio-group/radio/bl-radio.test.d.ts +2 -0
  30. package/dist/components/radio-group/radio/bl-radio.test.d.ts.map +1 -0
  31. package/dist/custom-elements.json +231 -0
  32. package/package.json +2 -2
  33. package/dist/chunk-HF5CPTQT.js +0 -20
  34. package/dist/chunk-HF5CPTQT.js.map +0 -7
@@ -0,0 +1,50 @@
1
+ import { CSSResultGroup, LitElement, TemplateResult } from 'lit';
2
+ import 'element-internals-polyfill';
3
+ import BlRadio from './radio/bl-radio';
4
+ export declare const blRadioGroupTag = "bl-radio-group";
5
+ export declare const blChangeEventName = "bl-radio-change";
6
+ declare const BlRadioGroup_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & typeof LitElement;
7
+ /**
8
+ * @tag bl-radio-group
9
+ * @summary Baklava Button component
10
+ *
11
+ * @cssproperty --bl-radio-direction - Can be used for showing radio options as columns instead of rows. Options are `row` or `column`
12
+ */
13
+ export default class BlRadioGroup extends BlRadioGroup_base {
14
+ static get styles(): CSSResultGroup;
15
+ /**
16
+ * Sets the radio group label
17
+ */
18
+ label: string;
19
+ /**
20
+ * Set and gets the actual value of the field
21
+ */
22
+ value: string;
23
+ /**
24
+ * Sets option as required
25
+ */
26
+ required: boolean;
27
+ get options(): BlRadio[];
28
+ get availableOptions(): BlRadio[];
29
+ updated(changedProperties: Map<string, unknown>): void;
30
+ /**
31
+ * Fires when radio group value changed
32
+ */
33
+ private onChange;
34
+ private focusedOptionIndex;
35
+ private handleOptionChecked;
36
+ private handleKeyDown;
37
+ connectedCallback(): void;
38
+ private handleFocus;
39
+ render(): TemplateResult;
40
+ }
41
+ declare global {
42
+ interface HTMLElementTagNameMap {
43
+ [blRadioGroupTag]: BlRadioGroup;
44
+ }
45
+ interface HTMLElementEventMap {
46
+ [blChangeEventName]: CustomEvent<string>;
47
+ }
48
+ }
49
+ export {};
50
+ //# sourceMappingURL=bl-radio-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bl-radio-group.d.ts","sourceRoot":"","sources":["../../../src/components/radio-group/bl-radio-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAEvE,OAAO,4BAA4B,CAAC;AAGpC,OAAO,OAAuB,MAAM,kBAAkB,CAAC;AAEvD,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAEhD,eAAO,MAAM,iBAAiB,oBAAoB,CAAC;;AAEnD;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,iBAA4B;IACpE,MAAM,KAAK,MAAM,IAAI,cAAc,CAElC;IAED;;OAEG;IAEH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,QAAQ,UAAS;IAEjB,IAAI,OAAO,IAAI,OAAO,EAAE,CAEvB;IAED,IAAI,gBAAgB,IAAI,OAAO,EAAE,CAEhC;IAED,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAOtD;;OAEG;IACuB,OAAO,CAAC,QAAQ,CAA0B;IAEpE,OAAO,CAAC,kBAAkB,CAAK;IAE/B,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,aAAa;IA6BrB,iBAAiB,IAAI,IAAI;IAQzB,OAAO,CAAC,WAAW;IAInB,MAAM,IAAI,cAAc;CAYzB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,CAAC,eAAe,CAAC,EAAE,YAAY,CAAC;KACjC;IACD,UAAU,mBAAmB;QAC3B,CAAC,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;KAC1C;CACF"}
@@ -0,0 +1,2 @@
1
+ import{d as a,e as b,f as c}from"../../chunk-WFBCOT52.js";import"../../chunk-5VLVLBWY.js";import"../../chunk-ENFFFE4I.js";import"../../chunk-72IJCTLJ.js";import"../../chunk-23UFIOHV.js";import"../../chunk-HG7OBTQS.js";import"../../chunk-NZ3RGSR6.js";export{b as blChangeEventName,a as blRadioGroupTag,c as default};
2
+ //# sourceMappingURL=bl-radio-group.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bl-radio-group.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bl-radio-group.test.d.ts","sourceRoot":"","sources":["../../../src/components/radio-group/bl-radio-group.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,60 @@
1
+ import { CSSResultGroup, LitElement, TemplateResult } from 'lit';
2
+ export declare const blRadioTag = "bl-radio";
3
+ export declare const blCheckedEventName = "bl-checked";
4
+ /**
5
+ * @tag bl-radio
6
+ * @summary Baklava Radio Option component
7
+ */
8
+ export default class BlRadio extends LitElement {
9
+ static get styles(): CSSResultGroup;
10
+ name: string;
11
+ value: string;
12
+ /**
13
+ * Sets option as disabled
14
+ */
15
+ disabled: boolean;
16
+ private selected;
17
+ /**
18
+ * Fires when radio is checked
19
+ */
20
+ private onChecked;
21
+ /**
22
+ * Fires when radio is blurred
23
+ */
24
+ private onFocus;
25
+ /**
26
+ * Fires when radio is blurred
27
+ */
28
+ private onBlur;
29
+ /**
30
+ * Sets this option selected
31
+ */
32
+ select(): void;
33
+ /**
34
+ * Readonly property to determine if option is currently checked
35
+ */
36
+ get checked(): boolean;
37
+ private radioElement;
38
+ /**
39
+ * Focuses this option
40
+ */
41
+ focus(): void;
42
+ /**
43
+ * Blurs from this option
44
+ */
45
+ blur(): void;
46
+ private handleFieldValueChange;
47
+ private field;
48
+ connectedCallback(): void;
49
+ disconnectedCallback(): void;
50
+ render(): TemplateResult;
51
+ }
52
+ declare global {
53
+ interface HTMLElementTagNameMap {
54
+ [blRadioTag]: BlRadio;
55
+ }
56
+ interface HTMLElementEventMap {
57
+ [blCheckedEventName]: CustomEvent<string>;
58
+ }
59
+ }
60
+ //# sourceMappingURL=bl-radio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bl-radio.d.ts","sourceRoot":"","sources":["../../../../src/components/radio-group/radio/bl-radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AASvE,eAAO,MAAM,UAAU,aAAa,CAAC;AAErC,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAE/C;;;GAGG;AAEH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,UAAU;IAC7C,MAAM,KAAK,MAAM,IAAI,cAAc,CAElC;IAGD,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IAEH,QAAQ,UAAS;IAGR,OAAO,CAAC,QAAQ,CAAS;IAElC;;OAEG;IACkB,OAAO,CAAC,SAAS,CAA0B;IAEhE;;OAEG;IACiB,OAAO,CAAC,OAAO,CAA0B;IAE7D;;OAEG;IACe,OAAO,CAAC,MAAM,CAA0B;IAE1D;;OAEG;IACH,MAAM;IAKN;;OAEG;IACH,IAAI,OAAO,YAEV;IAEsB,OAAO,CAAC,YAAY,CAAc;IAEzD;;OAEG;IACH,KAAK;IAML;;OAEG;IACF,IAAI;IAKL,OAAO,CAAC,sBAAsB,CAG7B;IAED,OAAO,CAAC,KAAK,CAAsB;IAEnC,iBAAiB,IAAI,IAAI;IAYzB,oBAAoB,IAAI,IAAI;IAK5B,MAAM,IAAI,cAAc;CAiBzB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;KACvB;IACD,UAAU,mBAAmB;QAC3B,CAAC,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;KAC1C;CACF"}
@@ -0,0 +1,2 @@
1
+ import{a,b,c}from"../../../chunk-WFBCOT52.js";import"../../../chunk-5VLVLBWY.js";import"../../../chunk-ENFFFE4I.js";import"../../../chunk-72IJCTLJ.js";import"../../../chunk-23UFIOHV.js";import"../../../chunk-HG7OBTQS.js";import"../../../chunk-NZ3RGSR6.js";export{b as blCheckedEventName,a as blRadioTag,c as default};
2
+ //# sourceMappingURL=bl-radio.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bl-radio.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bl-radio.test.d.ts","sourceRoot":"","sources":["../../../../src/components/radio-group/radio/bl-radio.test.ts"],"names":[],"mappings":""}
@@ -888,6 +888,122 @@
888
888
  }
889
889
  ]
890
890
  },
891
+ {
892
+ "kind": "javascript-module",
893
+ "path": "src/components/radio-group/bl-radio-group.ts",
894
+ "declarations": [
895
+ {
896
+ "kind": "variable",
897
+ "name": "blRadioGroupTag",
898
+ "type": {
899
+ "text": "string"
900
+ },
901
+ "default": "'bl-radio-group'"
902
+ },
903
+ {
904
+ "kind": "variable",
905
+ "name": "blChangeEventName",
906
+ "type": {
907
+ "text": "string"
908
+ },
909
+ "default": "'bl-radio-change'"
910
+ },
911
+ {
912
+ "kind": "class",
913
+ "description": "",
914
+ "name": "BlRadioGroup",
915
+ "cssProperties": [
916
+ {
917
+ "description": "Can be used for showing radio options as columns instead of rows. Options are `row` or `column`",
918
+ "name": "--bl-radio-direction"
919
+ }
920
+ ],
921
+ "events": [
922
+ {
923
+ "type": {
924
+ "text": "CustomEvent<string>"
925
+ },
926
+ "description": "Fires when radio group value changed",
927
+ "name": "bl-radio-change"
928
+ }
929
+ ],
930
+ "attributes": [
931
+ {
932
+ "name": "label",
933
+ "type": {
934
+ "text": "string"
935
+ },
936
+ "description": "Sets the radio group label",
937
+ "fieldName": "label"
938
+ },
939
+ {
940
+ "name": "value",
941
+ "type": {
942
+ "text": "string"
943
+ },
944
+ "default": "''",
945
+ "description": "Set and gets the actual value of the field",
946
+ "fieldName": "value"
947
+ },
948
+ {
949
+ "name": "required",
950
+ "type": {
951
+ "text": "boolean"
952
+ },
953
+ "default": "false",
954
+ "description": "Sets option as required",
955
+ "fieldName": "required"
956
+ }
957
+ ],
958
+ "mixins": [
959
+ {
960
+ "name": "FormControlMixin",
961
+ "package": "@open-wc/form-control"
962
+ }
963
+ ],
964
+ "superclass": {
965
+ "name": "LitElement",
966
+ "package": "lit"
967
+ },
968
+ "tagName": "bl-radio-group",
969
+ "summary": "Baklava Button component",
970
+ "customElement": true
971
+ }
972
+ ],
973
+ "exports": [
974
+ {
975
+ "kind": "js",
976
+ "name": "blRadioGroupTag",
977
+ "declaration": {
978
+ "name": "blRadioGroupTag",
979
+ "module": "src/components/radio-group/bl-radio-group.ts"
980
+ }
981
+ },
982
+ {
983
+ "kind": "js",
984
+ "name": "blChangeEventName",
985
+ "declaration": {
986
+ "name": "blChangeEventName",
987
+ "module": "src/components/radio-group/bl-radio-group.ts"
988
+ }
989
+ },
990
+ {
991
+ "kind": "js",
992
+ "name": "default",
993
+ "declaration": {
994
+ "name": "BlRadioGroup",
995
+ "module": "src/components/radio-group/bl-radio-group.ts"
996
+ }
997
+ },
998
+ {
999
+ "kind": "custom-element-definition",
1000
+ "declaration": {
1001
+ "name": "BlRadioGroup",
1002
+ "module": "src/components/radio-group/bl-radio-group.ts"
1003
+ }
1004
+ }
1005
+ ]
1006
+ },
891
1007
  {
892
1008
  "kind": "javascript-module",
893
1009
  "path": "src/components/select/bl-select.ts",
@@ -1109,6 +1225,121 @@
1109
1225
  }
1110
1226
  ]
1111
1227
  },
1228
+ {
1229
+ "kind": "javascript-module",
1230
+ "path": "src/components/radio-group/radio/bl-radio.ts",
1231
+ "declarations": [
1232
+ {
1233
+ "kind": "variable",
1234
+ "name": "blRadioTag",
1235
+ "type": {
1236
+ "text": "string"
1237
+ },
1238
+ "default": "'bl-radio'"
1239
+ },
1240
+ {
1241
+ "kind": "variable",
1242
+ "name": "blCheckedEventName",
1243
+ "type": {
1244
+ "text": "string"
1245
+ },
1246
+ "default": "'bl-checked'"
1247
+ },
1248
+ {
1249
+ "kind": "class",
1250
+ "description": "",
1251
+ "name": "BlRadio",
1252
+ "events": [
1253
+ {
1254
+ "type": {
1255
+ "text": "CustomEvent<string>"
1256
+ },
1257
+ "description": "Fires when radio is checked",
1258
+ "name": "bl-checked"
1259
+ },
1260
+ {
1261
+ "type": {
1262
+ "text": "CustomEvent<string>"
1263
+ },
1264
+ "description": "Fires when radio is blurred",
1265
+ "name": "bl-focus"
1266
+ },
1267
+ {
1268
+ "type": {
1269
+ "text": "CustomEvent<string>"
1270
+ },
1271
+ "description": "Fires when radio is blurred",
1272
+ "name": "bl-blur"
1273
+ }
1274
+ ],
1275
+ "attributes": [
1276
+ {
1277
+ "name": "name",
1278
+ "type": {
1279
+ "text": "string"
1280
+ },
1281
+ "fieldName": "name"
1282
+ },
1283
+ {
1284
+ "name": "value",
1285
+ "type": {
1286
+ "text": "string"
1287
+ },
1288
+ "fieldName": "value"
1289
+ },
1290
+ {
1291
+ "name": "disabled",
1292
+ "type": {
1293
+ "text": "boolean"
1294
+ },
1295
+ "default": "false",
1296
+ "description": "Sets option as disabled",
1297
+ "fieldName": "disabled"
1298
+ }
1299
+ ],
1300
+ "superclass": {
1301
+ "name": "LitElement",
1302
+ "package": "lit"
1303
+ },
1304
+ "tagName": "bl-radio",
1305
+ "summary": "Baklava Radio Option component",
1306
+ "customElement": true
1307
+ }
1308
+ ],
1309
+ "exports": [
1310
+ {
1311
+ "kind": "js",
1312
+ "name": "blRadioTag",
1313
+ "declaration": {
1314
+ "name": "blRadioTag",
1315
+ "module": "src/components/radio-group/radio/bl-radio.ts"
1316
+ }
1317
+ },
1318
+ {
1319
+ "kind": "js",
1320
+ "name": "blCheckedEventName",
1321
+ "declaration": {
1322
+ "name": "blCheckedEventName",
1323
+ "module": "src/components/radio-group/radio/bl-radio.ts"
1324
+ }
1325
+ },
1326
+ {
1327
+ "kind": "js",
1328
+ "name": "default",
1329
+ "declaration": {
1330
+ "name": "BlRadio",
1331
+ "module": "src/components/radio-group/radio/bl-radio.ts"
1332
+ }
1333
+ },
1334
+ {
1335
+ "kind": "custom-element-definition",
1336
+ "declaration": {
1337
+ "name": "BlRadio",
1338
+ "module": "src/components/radio-group/radio/bl-radio.ts"
1339
+ }
1340
+ }
1341
+ ]
1342
+ },
1112
1343
  {
1113
1344
  "kind": "javascript-module",
1114
1345
  "path": "src/components/select/option/bl-select-option.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trendyol/baklava",
3
- "version": "2.0.0-beta.42",
3
+ "version": "2.0.0-beta.43",
4
4
  "description": "Trendyol Baklava Design System",
5
5
  "main": "dist/baklava.js",
6
6
  "module": "dist/baklava.js",
@@ -62,7 +62,7 @@
62
62
  "@lit-labs/react": "^1.0.7",
63
63
  "@open-wc/form-control": "^0.4.1",
64
64
  "@open-wc/form-helpers": "^0.1.2",
65
- "element-internals-polyfill": "^1.1.11",
65
+ "element-internals-polyfill": "^1.1.15",
66
66
  "lit": "^2.2.3"
67
67
  },
68
68
  "engines": {
@@ -1,20 +0,0 @@
1
- import{a as ht}from"./chunk-KQBKSEYJ.js";import{a as K}from"./chunk-2TVOKUHE.js";import{a as dt}from"./chunk-ENFFFE4I.js";import{a as Z}from"./chunk-23UFIOHV.js";import{a as ot,b as q,f as st,g as nt,h as E,i as lt,j as ct}from"./chunk-HG7OBTQS.js";import{a as f}from"./chunk-NZ3RGSR6.js";var d=function(l,o,s,r){if(s==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof o=="function"?l!==o||!r:!o.has(l))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?r:s==="a"?r.call(l):r?r.value:o.get(l)},C=function(l,o,s,r,g){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!g)throw new TypeError("Private accessor was defined without a setter");if(typeof o=="function"?l!==o||!g:!o.has(l))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?g.call(l,s):g?g.value=s:o.set(l,s),s};function ut(l){var o,s,r,g,F,S,A,W,I,R,O,$,L,P,_,D,H,G;class Q extends l{constructor(...n){super(...n),o.add(this),this.internals=this.attachInternals(),s.set(this,!1),r.set(this,!1),g.set(this,!1),F.set(this,void 0),S.set(this,void 0),W.set(this,""),I.set(this,()=>{C(this,g,!0,"f"),C(this,s,!0,"f"),d(this,o,"m",_).call(this)}),R.set(this,()=>{C(this,s,!1,"f"),d(this,o,"m",D).call(this,this.shouldFormValueUpdate()?d(this,W,"f"):""),!this.validity.valid&&d(this,g,"f")&&C(this,r,!0,"f");let c=d(this,o,"m",_).call(this);this.validationMessageCallback&&this.validationMessageCallback(c?this.internals.validationMessage:"")}),O.set(this,()=>{var c;C(this,r,!0,"f"),d(this,o,"m",_).call(this),(c=this===null||this===void 0?void 0:this.validationMessageCallback)===null||c===void 0||c.call(this,this.showError?this.internals.validationMessage:"")}),$.set(this,void 0),L.set(this,!1),P.set(this,Promise.resolve()),this.addEventListener("focus",d(this,I,"f")),this.addEventListener("blur",d(this,R,"f")),this.addEventListener("invalid",d(this,O,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let n=this.validators.map(y=>y.attribute),c=super.observedAttributes||[];return[...new Set([...c,...n])]}static getValidator(n){return this.validators.find(c=>c.attribute===n)||null}get form(){return this.internals.form}get showError(){return d(this,o,"m",_).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(n,c,w){var y;(y=super.attributeChangedCallback)===null||y===void 0||y.call(this,n,c,w),this.constructor.getValidator(n)&&this.validationTarget&&this.setValue(d(this,W,"f"))}setValue(n){var c;C(this,r,!1,"f"),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,""),C(this,W,n,"f");let y=this.shouldFormValueUpdate()?n:null;this.internals.setFormValue(y),d(this,o,"m",D).call(this,y),this.valueChangedCallback&&this.valueChangedCallback(y),d(this,o,"m",_).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(n=>n(d(this,P,"f")))}formResetCallback(){var n,c;C(this,g,!1,"f"),C(this,r,!1,"f"),d(this,o,"m",_).call(this),(n=this.resetFormControl)===null||n===void 0||n.call(this),(c=this.validationMessageCallback)===null||c===void 0||c.call(this,d(this,o,"m",_).call(this)?this.validationMessage:"")}}return s=new WeakMap,r=new WeakMap,g=new WeakMap,F=new WeakMap,S=new WeakMap,W=new WeakMap,I=new WeakMap,R=new WeakMap,O=new WeakMap,$=new WeakMap,L=new WeakMap,P=new WeakMap,o=new WeakSet,A=function(){let n=this.getRootNode(),c=`${this.localName}[name="${this.getAttribute("name")}"]`;return n.querySelectorAll(c)},_=function(){if(this.hasAttribute("disabled"))return!1;let n=d(this,r,"f")||d(this,g,"f")&&!this.validity.valid&&!d(this,s,"f");return n&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),n},D=function(n){let c=this.constructor,w={},y=c.validators,U=[];d(this,L,"f")||(C(this,P,new Promise(k=>{C(this,$,k,"f")}),"f"),C(this,L,!0,"f")),d(this,F,"f")&&(d(this,F,"f").abort(),C(this,S,d(this,F,"f"),"f"));let V=new AbortController;C(this,F,V,"f");let x,Y=!1;!y.length||(y.forEach(k=>{let N=k.key||"customError",z=k.isValid(this,n,V.signal);z instanceof Promise?(U.push(z),z.then(J=>{J!=null&&(w[N]=!J,x=d(this,o,"m",G).call(this,k,n),d(this,o,"m",H).call(this,w,x))})):(w[N]=!z,this.validity[N]!==!z&&(Y=!0),z||(x=d(this,o,"m",G).call(this,k,n)))}),Promise.allSettled(U).then(()=>{var k;V!=null&&V.signal.aborted||(C(this,L,!1,"f"),(k=d(this,$,"f"))===null||k===void 0||k.call(this))}),Y&&d(this,o,"m",H).call(this,w,x))},H=function(n,c){if(this.validationTarget)this.internals.setValidity(n,c,this.validationTarget);else{if(this.internals.setValidity(n,c),this.internals.validity.valid)return;let w=0,y=setInterval(()=>{w>=100||this.validity.valid?clearInterval(y):this.validationTarget&&(this.internals.setValidity(this.validity,c,this.validationTarget),clearInterval(y)),w+=1},0)}},G=function(n,c){if(this.validityCallback){let w=this.validityCallback(n.key||"customError");if(w)return w}return n.message instanceof Function?n.message(this,c):n.message},Q}var pt=l=>{if(l.reportValidity()){let o=new Event("submit",{cancelable:!0});l.dispatchEvent(o),o.defaultPrevented||l.submit()}else return};var Et=["valueMissing","typeMismatch","tooLong","tooShort","rangeUnderflow","rangeOverflow","badInput","customError"],mt=Et.map(l=>({key:l,isValid(o){return o.validationTarget?!o.validationTarget.validity[l]:!0}}));(function(){"use strict";let l=new WeakMap,o=new WeakMap,s=new WeakMap,r=new WeakMap,g=new WeakMap,F=new WeakMap,S=new WeakMap,A=new WeakMap,W=new WeakMap,I=new WeakMap,R=new WeakMap,O=new WeakMap,$=new WeakMap,L=new WeakMap,P={attributes:!0,attributeFilter:["disabled"]},_=new MutationObserver(e=>{for(let t of e){let a=t.target;if(a.constructor.formAssociated){let i=a.hasAttribute("disabled");a.toggleAttribute("internals-disabled",i),i?a.setAttribute("aria-disabled","true"):a.removeAttribute("aria-disabled"),a.formDisabledCallback&&a.formDisabledCallback.apply(a,[i])}}}),D=e=>{s.get(e).forEach(a=>{a.remove()}),s.set(e,[])},H=(e,t)=>{let a=document.createElement("input");return a.type="hidden",a.name=e.getAttribute("name"),e.after(a),s.get(t).push(a),a},G=(e,t)=>{s.set(t,[]);let a=e.hasAttribute("disabled");e.toggleAttribute("internals-disabled",a),_.observe(e,P)},Q=(e,t)=>{if(t.length){Array.from(t).forEach(i=>i.addEventListener("click",e.focus.bind(e)));let a=t[0].id;t[0].id||(a=`${t[0].htmlFor}_Label`,t[0].id=a),e.setAttribute("aria-labelledby",a)}},T=e=>{let t=Array.from(e.elements).filter(u=>u.validity).map(u=>u.validity.valid),a=A.get(e)||[],i=Array.from(a).filter(u=>u.isConnected).map(u=>r.get(u).validity.valid),p=[...t,...i].includes(!1);e.toggleAttribute("internals-invalid",p),e.toggleAttribute("internals-valid",!p)},n=e=>{T(V(e.target))},c=e=>{T(V(e.target))},w=e=>{let t=e.target,a=A.get(t);t.noValidate||a.size&&(Array.from(a).reverse().map(u=>r.get(u).reportValidity()).includes(!1)?(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault()):L.get(t)&&L.get(t).call(t,e)===!1&&e.preventDefault())},y=e=>{let t=A.get(e.target);t&&t.size&&t.forEach(a=>{a.constructor.formAssociated&&a.formResetCallback&&a.formResetCallback.apply(a)})},U=(e,t,a)=>{if(t){t.onsubmit&&(L.set(t,t.onsubmit.bind(t)),t.onsubmit=null);let i=A.get(t);if(i)i.add(e);else{let p=new Set;p.add(e),A.set(t,p),t.addEventListener("submit",w),t.addEventListener("reset",y),t.addEventListener("input",n),t.addEventListener("change",c)}F.set(t,{ref:e,internals:a}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),T(t)}},V=e=>{let t=e.parentNode;return t&&t.tagName!=="FORM"&&(t=V(t)),t},x=(e,t,a=DOMException)=>{if(!e.constructor.formAssociated)throw new a(t)},Y=(e,t,a)=>{let i=A.get(e);return i&&i.size&&i.forEach(p=>{r.get(p)[a]()||(t=!1)}),t},k=e=>{if(e.constructor.formAssociated){let t=r.get(e),{labels:a,form:i}=t;Q(e,a),U(e,i,t)}},N={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},z=(e,t)=>{for(let a in N){t[a]=null;let i=null,p=N[a];Object.defineProperty(t,a,{get(){return i},set(u){i=u,e.isConnected?e.setAttribute(p,u):I.set(e,t)}})}};class et{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}let J=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),vt=(e,t,a)=>(e.valid=bt(t),Object.keys(t).forEach(i=>e[i]=t[i]),a&&T(a),e),bt=e=>{let t=!0;for(let a in e)a!=="valid"&&e[a]!==!1&&(t=!1);return t};function at(e){let t=r.get(e),{form:a}=t;U(e,a,t),Q(e,t.labels)}function j(e){e.forEach(t=>{let{addedNodes:a,removedNodes:i}=t,p=Array.from(a),u=Array.from(i);p.forEach(m=>{if(r.has(m)&&m.constructor.formAssociated&&at(m),I.has(m)){let v=I.get(m);Object.keys(N).filter(M=>v[M]!==null).forEach(M=>{m.setAttribute(N[M],v[M])}),I.delete(m)}if(m.localName==="form"){let v=A.get(m),b=document.createTreeWalker(m,NodeFilter.SHOW_ELEMENT,{acceptNode(rt){return r.has(rt)&&!v&&!v.has(rt)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),M=b.nextNode();for(;M;)at(M),M=b.nextNode()}}),u.forEach(m=>{let v=r.get(m);v&&s.get(v)&&D(v),S.has(m)&&S.get(m).disconnect()})})}function gt(e){e.forEach(t=>{let{removedNodes:a}=t;a.forEach(i=>{let p=$.get(t.target);r.has(i)&&k(i),p.disconnect()})})}let yt=e=>{let t=new MutationObserver(gt);t.observe(e,{childList:!0}),$.set(e,t)};new MutationObserver(j);let B={childList:!0,subtree:!0},tt=new WeakMap;class X extends Set{static get isPolyfilled(){return!0}constructor(t){if(super(),!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");tt.set(this,t)}add(t){if(!/^--/.test(t)||typeof t!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);let a=super.add(t),i=tt.get(this);return i.toggleAttribute(`state${t}`,!0),i.part&&i.part.add(`state${t}`),a}clear(){for(let[t]of this.entries())this.delete(t);super.clear()}delete(t){let a=super.delete(t),i=tt.get(this);return i.toggleAttribute(`state${t}`,!1),i.part&&i.part.remove(`state${t}`),a}}class it{constructor(t){if(!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");let a=t.getRootNode(),i=new et;this.states=new X(t),l.set(this,t),o.set(this,i),r.set(t,this),z(t,this),G(t,this),Object.seal(this),k(t),a instanceof DocumentFragment&&yt(a)}static get isPolyfilled(){return!0}checkValidity(){let t=l.get(this);if(x(t,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;let a=o.get(this);if(!a.valid){let i=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});t.dispatchEvent(i)}return a.valid}get form(){let t=l.get(this);x(t,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let a;return t.constructor.formAssociated===!0&&(a=V(t)),a}get labels(){let t=l.get(this);x(t,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");let a=t.getAttribute("id"),i=t.getRootNode();return i&&a?i.querySelectorAll(`[for=${a}]`):[]}reportValidity(){let t=l.get(this);if(x(t,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;let a=this.checkValidity(),i=O.get(this);if(i&&!t.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!a&&i&&(t.focus(),i.focus()),a}setFormValue(t){let a=l.get(this);if(x(a,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),D(this),t!=null&&!(t instanceof FormData)){if(a.getAttribute("name")){let i=H(a,this);i.value=t}}else t!=null&&t instanceof FormData&&Array.from(t).reverse().forEach(([i,p])=>{if(typeof p=="string"){let u=H(a,this);u.name=i,u.value=p}});W.set(a,t)}setValidity(t,a,i){let p=l.get(this);if(x(p,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!t)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");O.set(this,i);let u=o.get(this),m={};for(let M in t)m[M]=t[M];Object.keys(m).length===0&&J(u);let v={...u,...m};delete v.valid;let{valid:b}=vt(u,v,this.form);if(!b&&!a)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");g.set(this,b?"":a),p.toggleAttribute("internals-invalid",!b),p.toggleAttribute("internals-valid",b),p.setAttribute("aria-invalid",`${!b}`)}get shadowRoot(){let t=l.get(this),a=R.get(t);return a||null}get validationMessage(){let t=l.get(this);return x(t,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),g.get(this)}get validity(){let t=l.get(this);return x(t,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),o.get(this)}get willValidate(){let t=l.get(this);return x(t,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(t.disabled||t.hasAttribute("disabled")||t.hasAttribute("readonly"))}}function wt(){if(!window.ElementInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}let t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(t,e);let a=new e;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(i=>i in a.internals)}if(wt()){if(!window.CustomStateSet){window.CustomStateSet=X;let e=HTMLElement.prototype.attachInternals;HTMLElement.prototype.attachInternals=function(...t){let a=e.call(this,t);return a.states=new X(this),a}}}else{let e=function(...v){let b=i.apply(this,v),M=new MutationObserver(j);return R.set(this,b),window.ShadyDOM?M.observe(this,B):M.observe(b,B),S.set(this,M),b},t=function(...v){let b=u.apply(this,v);return Y(this,b,"checkValidity")},a=function(...v){let b=m.apply(this,v);return Y(this,b,"reportValidity")};window.ElementInternals=it,HTMLElement.prototype.attachInternals=function(){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.");if(r.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new it(this)};let i=Element.prototype.attachShadow;Element.prototype.attachShadow=e,new MutationObserver(j).observe(document.documentElement,B);let u=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=t;let m=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=a,window.CustomStateSet||(window.CustomStateSet=X)}})();var Mt=ot`:host{display:inline-block;width:200px;position:relative;--bl-input-padding-vertical:var(--bl-size-2xs);--bl-input-padding-horizontal:var(--bl-size-xs);--bl-input-border-color:var(--bl-color-border);--bl-input-icon-color:var(--bl-color-content-tertiary);--bl-input-text-color:var(--bl-color-content-primary);--bl-input-height:var(--bl-size-2xl)}input{outline:0;box-sizing:border-box;height:var(--bl-input-height);border:solid 1px var(--bl-input-border-color);width:100%;font:var(--bl-font-title-3-regular);padding:0 var(--bl-input-padding-horizontal);margin:0;border-radius:4px;color:var(--bl-input-text-color)}bl-icon{position:absolute;top:var(--bl-input-padding-vertical);right:var(--bl-input-padding-horizontal);font-size:var(--bl-size-m);z-index:1;color:var(--bl-input-icon-color)}input:focus{--bl-input-border-color:var(--bl-color-primary)}:host([label-fixed]) bl-icon{top:calc(var(--bl-input-padding-vertical) + var(--bl-size-m))}input:focus ~ bl-icon{--bl-input-icon-color:var(--bl-color-primary)}:host ::placeholder{color:var(--bl-color-content-tertiary)}:host([label]) ::placeholder{color:transparent;transition:color ease-out .4s}:host input:focus::placeholder,:host([label-fixed]) ::placeholder{color:var(--bl-color-content-tertiary)}input:disabled{background-color:var(--bl-color-primary-background);--bl-input-text-color:var(--bl-color-content-tertiary)}input.dirty:invalid{--bl-input-border-color:var(--bl-color-danger)}input.has-icon{padding-right:calc(var(--bl-size-xs) * 2 + var(--bl-size-m))}.error-icon,.invalid-text{display:none}label{position:absolute;top:var(--bl-input-padding-vertical);left:var(--bl-input-padding-horizontal);transition:all ease-in .2s;pointer-events:none;font:var(--bl-font-title-3-regular);color:var(--bl-color-content-tertiary);padding:0}:where(input:focus,input.has-value) ~ label{top:0;left:var(--bl-size-2xs);transform:translateY(-50%);font:var(--bl-font-caption);color:var(--bl-color-content-secondary);padding:0 var(--bl-size-3xs);background-color:var(--bl-color-primary-background);pointer-events:initial}:host([label-fixed]){padding-top:var(--bl-size-m)}:host([label-fixed]) label{top:0;left:0;transition:none;transform:none;pointer-events:initial;font:var(--bl-font-caption);color:var(--bl-color-content-secondary);padding:0}.dirty:invalid ~ label{color:var(--bl-color-danger)}.invalid-text,.help-text{font:var(--bl-font-title-4-regular);padding:var(--bl-size-3xs) var(--bl-input-padding-horizontal);margin:0}.invalid-text{color:var(--bl-color-danger)}.help-text{color:var(--bl-color-content-secondary)}.error-icon{color:var(--bl-color-danger)}.dirty:invalid ~ .invalid-text{display:block}.dirty:invalid ~ .help-text{display:none}.dirty:invalid ~ .error-icon{display:inline-block}.dirty:invalid ~ .custom-icon ~ .error-icon{display:none}.dirty:invalid ~ .custom-icon{--bl-input-icon-color:var(--bl-color-danger)}:host([size='large']){--bl-input-height:var(--bl-size-3xl);--bl-input-padding-vertical:var(--bl-size-xs);--bl-input-padding-horizontal:var(--bl-size-m)}`,ft=Mt;var h=class extends ut(st){constructor(){super(...arguments);this.type="text";this.value="";this.required=!1;this.size="medium";this.disabled=!1;this.labelFixed=!1;this.onKeydown=s=>{s.code==="Enter"&&this.form&&pt(this.form)};this.onError=()=>{this.onInvalid(this.internals.validity)};this.dirty=!1}static get styles(){return[ft]}connectedCallback(){var s;super.connectedCallback(),this.addEventListener("keydown",this.onKeydown),this.addEventListener("invalid",this.onError),(s=this.internals.form)==null||s.addEventListener("submit",()=>{this.reportValidity()})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.onKeydown),this.removeEventListener("invalid",this.onError)}validityCallback(){var s;return this.customInvalidText||((s=this.validationTarget)==null?void 0:s.validationMessage)}reportValidity(){return this.dirty=!0,this.checkValidity()}valueChangedCallback(s){this.value=s}inputHandler(s){let r=s.target.value;this.setValue(r),this.onInput(r)}changeHandler(s){let r=s.target.value;this.dirty=!0,this.setValue(r),this.onChange(r)}firstUpdated(){this.setValue(this.value)}render(){let s=this.checkValidity()?"":q`<p class="invalid-text">${this.validationMessage}</p>`,r=this.helpText?q`<p class="help-text">${this.helpText}</p>`:"",g=this.icon?q` <bl-icon class="custom-icon" name="${this.icon}"></bl-icon>`:"",F=this.label?q`<label>${this.label}</label>`:"",S={dirty:this.dirty,"has-icon":this.icon||this.dirty&&!this.checkValidity(),"has-value":this.value!==null&&this.value!==""};return q`
2
- <input
3
- type=${this.type}
4
- class=${dt(S)}
5
- .value=${ht(this.value)}
6
- placeholder="${K(this.placeholder)}"
7
- minlength="${K(this.minlength)}"
8
- maxlength="${K(this.maxlength)}"
9
- min="${K(this.min)}"
10
- max="${K(this.max)}"
11
- ?required=${this.required}
12
- ?disabled=${this.disabled}
13
- @change=${this.changeHandler}
14
- @input=${this.inputHandler}
15
- />
16
- ${F} ${g}
17
- <bl-icon class="error-icon" name="alert"></bl-icon>
18
- ${s} ${r}
19
- `}};h.formControlValidators=mt,f([ct("input")],h.prototype,"validationTarget",2),f([E({})],h.prototype,"type",2),f([E({})],h.prototype,"label",2),f([E({})],h.prototype,"placeholder",2),f([E()],h.prototype,"value",2),f([E({type:Boolean})],h.prototype,"required",2),f([E({type:Number})],h.prototype,"minlength",2),f([E({type:Number})],h.prototype,"maxlength",2),f([E({type:Number})],h.prototype,"min",2),f([E({type:Number})],h.prototype,"max",2),f([E({type:String})],h.prototype,"icon",2),f([E({type:String,reflect:!0})],h.prototype,"size",2),f([E({type:Boolean,reflect:!0})],h.prototype,"disabled",2),f([E({type:Boolean,attribute:"label-fixed"})],h.prototype,"labelFixed",2),f([E({type:String,attribute:"invalid-text"})],h.prototype,"customInvalidText",2),f([E({type:String,attribute:"help-text"})],h.prototype,"helpText",2),f([Z("bl-change")],h.prototype,"onChange",2),f([Z("bl-input")],h.prototype,"onInput",2),f([Z("bl-invalid")],h.prototype,"onInvalid",2),f([lt()],h.prototype,"dirty",2),h=f([nt("bl-input")],h);export{h as a};
20
- //# sourceMappingURL=chunk-HF5CPTQT.js.map