@shibui-ui/ui 1.24.1 → 1.25.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/dist/components/atoms/index.d.ts +45 -16
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/molecules/index.d.ts +20 -1
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +17 -1
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/index.d.ts +3 -82
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -80
- package/dist/index.js.map +1 -1
- package/dist/index10.js +82 -18
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +84 -69
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +40 -26
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +16 -39
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +29 -44
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +16 -117
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +48 -40
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +41 -25
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +76 -49
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +19 -39
- package/dist/index19.js.map +1 -1
- package/dist/index194.js +94 -24
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +2 -2
- package/dist/index197.js +2 -24
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +74 -2
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +64 -35
- package/dist/index199.js.map +1 -1
- package/dist/index20.js +21 -41
- package/dist/index20.js.map +1 -1
- package/dist/index200.js +2 -2
- package/dist/index201.js +54 -13
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +2 -2
- package/dist/index203.js +2 -2
- package/dist/index204.js +143 -157
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +43 -24
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +51 -2
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +2 -11
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +33 -2
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +2 -91
- package/dist/index209.js.map +1 -1
- package/dist/index21.js +90 -26
- package/dist/index21.js.map +1 -1
- package/dist/index210.js +6 -2
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +2 -41
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +260 -2
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +16 -5
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +2 -2
- package/dist/index215.js +2 -35
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +59 -42
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +32 -2
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +2 -85
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +2 -2
- package/dist/index22.js +41 -48
- package/dist/index22.js.map +1 -1
- package/dist/index220.js +73 -65
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +81 -2
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +2 -10
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +133 -2
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +2 -26
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +2 -2
- package/dist/index226.js +66 -12
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +97 -2
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +2 -2
- package/dist/index229.js +62 -24
- package/dist/index229.js.map +1 -1
- package/dist/index23.js +50 -94
- package/dist/index23.js.map +1 -1
- package/dist/index230.js +2 -2
- package/dist/index231.js +2 -2
- package/dist/index232.js +12 -2
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +5 -16
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +2 -2
- package/dist/index235.js +11 -9
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +2 -2
- package/dist/index237.js +76 -34
- package/dist/index237.js.map +1 -1
- package/dist/index238.js +2 -2
- package/dist/index239.js +2 -27
- package/dist/index239.js.map +1 -1
- package/dist/index24.js +37 -34
- package/dist/index24.js.map +1 -1
- package/dist/index240.js +39 -2
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +2 -34
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +235 -12
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +82 -2
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +2 -9
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +94 -2
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +2 -5
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +268 -2
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +2 -36
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +21 -2
- package/dist/index249.js.map +1 -1
- package/dist/index25.js +51 -32
- package/dist/index25.js.map +1 -1
- package/dist/index250.js +2 -31
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +9 -2
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +2 -19
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +15 -2
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +2 -2
- package/dist/index255.js +135 -69
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +2 -11
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +5 -2
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +2 -78
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +9 -2
- package/dist/index259.js.map +1 -1
- package/dist/index26.js +31 -236
- package/dist/index26.js.map +1 -1
- package/dist/index260.js +2 -32
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +2 -2
- package/dist/index262.js +92 -9
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +59 -2
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +2 -16
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +41 -2
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +2 -16
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +34 -9
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +8 -54
- package/dist/index268.js.map +1 -1
- package/dist/index269.js +2 -2
- package/dist/index27.js +27 -58
- package/dist/index27.js.map +1 -1
- package/dist/index270.js +42 -7
- package/dist/index270.js.map +1 -1
- package/dist/index271.js +2 -2
- package/dist/index272.js +2 -34
- package/dist/index272.js.map +1 -1
- package/dist/index273.js +16 -2
- package/dist/index273.js.map +1 -1
- package/dist/index274.js +9 -2
- package/dist/index274.js.map +1 -1
- package/dist/index275.js +6 -13
- package/dist/index275.js.map +1 -1
- package/dist/index276.js +2 -2
- package/dist/index277.js +8 -15
- package/dist/index277.js.map +1 -1
- package/dist/index278.js +2 -2
- package/dist/index279.js +55 -2
- package/dist/index279.js.map +1 -1
- package/dist/index28.js +247 -24
- package/dist/index28.js.map +1 -1
- package/dist/index280.js +2 -42
- package/dist/index280.js.map +1 -1
- package/dist/index281.js +2 -100
- package/dist/index281.js.map +1 -1
- package/dist/index282.js +20 -2
- package/dist/index282.js.map +1 -1
- package/dist/index283.js +2 -97
- package/dist/index283.js.map +1 -1
- package/dist/index284.js +33 -2
- package/dist/index284.js.map +1 -1
- package/dist/index285.js +6 -27
- package/dist/index285.js.map +1 -1
- package/dist/index286.js +2 -2
- package/dist/index287.js +9 -44
- package/dist/index287.js.map +1 -1
- package/dist/index288.js +2 -2
- package/dist/index289.js +2 -33
- package/dist/index289.js.map +1 -1
- package/dist/index29.js +249 -39
- package/dist/index29.js.map +1 -1
- package/dist/index290.js +36 -2
- package/dist/index290.js.map +1 -1
- package/dist/index291.js +2 -57
- package/dist/index291.js.map +1 -1
- package/dist/index292.js +24 -2
- package/dist/index292.js.map +1 -1
- package/dist/index293.js +2 -2
- package/dist/index294.js +26 -247
- package/dist/index294.js.map +1 -1
- package/dist/index295.js +2 -2
- package/dist/index296.js +2 -72
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +42 -2
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +7 -56
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +2 -133
- package/dist/index299.js.map +1 -1
- package/dist/index30.js +32 -19
- package/dist/index30.js.map +1 -1
- package/dist/index300.js +30 -2
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +2 -12
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +34 -2
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +2 -162
- package/dist/index303.js.map +1 -1
- package/dist/index304.js +26 -42
- package/dist/index304.js.map +1 -1
- package/dist/index305.js +2 -81
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +10 -2
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +2 -71
- package/dist/index307.js.map +1 -1
- package/dist/index308.js +2 -2
- package/dist/index309.js +19 -2
- package/dist/index309.js.map +1 -1
- package/dist/index31.js +96 -11
- package/dist/index31.js.map +1 -1
- package/dist/index310.js +2 -81
- package/dist/index310.js.map +1 -1
- package/dist/index311.js +2 -2
- package/dist/index312.js +42 -2
- package/dist/index312.js.map +1 -1
- package/dist/index313.js +2 -74
- package/dist/index313.js.map +1 -1
- package/dist/index314.js +25 -67
- package/dist/index314.js.map +1 -1
- package/dist/index315.js +2 -2
- package/dist/index316.js +9 -17
- package/dist/index316.js.map +1 -1
- package/dist/index317.js +2 -2
- package/dist/index318.js +84 -32
- package/dist/index318.js.map +1 -1
- package/dist/index319.js +2 -2
- package/dist/index32.js +40 -48
- package/dist/index32.js.map +1 -1
- package/dist/index320.js +68 -77
- package/dist/index320.js.map +1 -1
- package/dist/index321.js +2 -2
- package/dist/index322.js +12 -148
- package/dist/index322.js.map +1 -1
- package/dist/index323.js +1 -1
- package/dist/index324.js +28 -6
- package/dist/index324.js.map +1 -1
- package/dist/index325.js +2 -2
- package/dist/index326.js +78 -87
- package/dist/index326.js.map +1 -1
- package/dist/index327.js +2 -2
- package/dist/index328.js +78 -2
- package/dist/index328.js.map +1 -1
- package/dist/index329.js +2 -237
- package/dist/index329.js.map +1 -1
- package/dist/index33.js +20 -56
- package/dist/index33.js.map +1 -1
- package/dist/index330.js +11 -6
- package/dist/index330.js.map +1 -1
- package/dist/index331.js +2 -2
- package/dist/index332.js +18 -59
- package/dist/index332.js.map +1 -1
- package/dist/index333.js +2 -2
- package/dist/index334.js +12 -5
- package/dist/index334.js.map +1 -1
- package/dist/index335.js +2 -2
- package/dist/index336.js +2 -15
- package/dist/index336.js.map +1 -1
- package/dist/index337.js +88 -2
- package/dist/index337.js.map +1 -1
- package/dist/index338.js +24 -2
- package/dist/index338.js.map +1 -1
- package/dist/index339.js +2 -92
- package/dist/index339.js.map +1 -1
- package/dist/index34.js +59 -35
- package/dist/index34.js.map +1 -1
- package/dist/index340.js +42 -14
- package/dist/index340.js.map +1 -1
- package/dist/index341.js +2 -2
- package/dist/index342.js +22 -80
- package/dist/index342.js.map +1 -1
- package/dist/index343.js +2 -2
- package/dist/index344.js +2 -18
- package/dist/index344.js.map +1 -1
- package/dist/index345.js +16 -2
- package/dist/index345.js.map +1 -1
- package/dist/index346.js +2 -268
- package/dist/index346.js.map +1 -1
- package/dist/index347.js +176 -2
- package/dist/index347.js.map +1 -1
- package/dist/index348.js +2 -2
- package/dist/index349.js +35 -39
- package/dist/index349.js.map +1 -1
- package/dist/index35.js +101 -28
- package/dist/index35.js.map +1 -1
- package/dist/index350.js +3 -3
- package/dist/index350.js.map +1 -1
- package/dist/index351.js +2 -2
- package/dist/index352.js +19 -26
- package/dist/index352.js.map +1 -1
- package/dist/index357.js +26 -19
- package/dist/index357.js.map +1 -1
- package/dist/index36.js +115 -33
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +41 -115
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +34 -246
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +30 -137
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +26 -84
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +26 -400
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +28 -77
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +23 -26
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +36 -33
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +62 -16
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +138 -21
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +129 -22
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +41 -19
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +11 -82
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +56 -279
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +21 -34
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +280 -33
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +74 -94
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +66 -41
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +333 -62
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +96 -256
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +38 -130
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +251 -50
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +144 -115
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +93 -183
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +33 -339
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +2 -2
- package/dist/index60.js +102 -66
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +73 -179
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +117 -97
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +113 -263
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +258 -251
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +177 -79
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +261 -140
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +183 -100
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +28 -89
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +20 -161
- package/dist/index69.js.map +1 -1
- package/dist/index7.js +394 -32
- package/dist/index7.js.map +1 -1
- package/dist/index70.js +190 -53
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +204 -112
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +2 -2
- package/dist/index73.js +89 -28
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +126 -63
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +122 -111
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +67 -64
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +112 -88
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +87 -16
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +151 -79
- package/dist/index79.js.map +1 -1
- package/dist/index8.js +25 -127
- package/dist/index8.js.map +1 -1
- package/dist/index80.js +104 -186
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +59 -20
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +17 -129
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +88 -217
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +64 -112
- package/dist/index84.js.map +1 -1
- package/dist/index9.js +30 -45
- package/dist/index9.js.map +1 -1
- package/dist/src/components/atoms/index.d.ts +45 -16
- package/dist/src/components/atoms/index.d.ts.map +1 -1
- package/dist/src/components/molecules/index.d.ts +20 -1
- package/dist/src/components/molecules/index.d.ts.map +1 -1
- package/dist/src/components/organisms/index.d.ts +17 -1
- package/dist/src/components/organisms/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -82
- package/dist/src/index.d.ts.map +1 -1
- package/dist/tokens.css +353 -7
- package/dist/vite.config.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index60.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { unsafeCSS, css, LitElement } from "lit";
|
|
2
2
|
import { property, customElement } from "lit/decorators.js";
|
|
3
|
-
import { paginationTemplate } from "./index305.js";
|
|
4
|
-
import paginationCss from "./index306.js";
|
|
5
3
|
import sharedTokens from "./index196.js";
|
|
4
|
+
import modalCss from "./index219.js";
|
|
5
|
+
import { modalTemplate } from "./index220.js";
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
8
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -13,99 +13,135 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
13
|
if (kind && result) __defProp(target, key, result);
|
|
14
14
|
return result;
|
|
15
15
|
};
|
|
16
|
-
let
|
|
16
|
+
let LibModal = class extends LitElement {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
-
this.
|
|
20
|
-
this.itemsPerPage = 10;
|
|
21
|
-
this.currentPage = 1;
|
|
22
|
-
this.siblings = 1;
|
|
19
|
+
this.open = false;
|
|
23
20
|
this.size = "md";
|
|
24
21
|
this.variant = "default";
|
|
22
|
+
this._animate = "scale";
|
|
25
23
|
this.dark = false;
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (e.key === "
|
|
34
|
-
e.
|
|
35
|
-
this.
|
|
36
|
-
}
|
|
37
|
-
if (e.key === "Home") {
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
this._changePage(1);
|
|
40
|
-
}
|
|
41
|
-
if (e.key === "End") {
|
|
42
|
-
e.preventDefault();
|
|
43
|
-
this._changePage(this.totalPages);
|
|
24
|
+
this.heading = "";
|
|
25
|
+
this.subtitle = "";
|
|
26
|
+
this.iconTone = null;
|
|
27
|
+
this.footerInfo = "";
|
|
28
|
+
this.noBackdropClose = false;
|
|
29
|
+
this._prevFocus = null;
|
|
30
|
+
this._onKeydown = (e) => {
|
|
31
|
+
if (e.key === "Escape" && this.open) {
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
this._close("escape");
|
|
44
34
|
}
|
|
45
35
|
};
|
|
46
36
|
}
|
|
47
|
-
/* ──
|
|
48
|
-
get totalPages() {
|
|
49
|
-
return Math.max(1, Math.ceil(this.totalItems / this.itemsPerPage));
|
|
50
|
-
}
|
|
51
|
-
/* ── Cambio de página ── */
|
|
52
|
-
_changePage(page) {
|
|
53
|
-
if (page < 1 || page > this.totalPages || page === this.currentPage) return;
|
|
54
|
-
const prev = this.currentPage;
|
|
55
|
-
this.currentPage = page;
|
|
56
|
-
this.dispatchEvent(new CustomEvent("ui-lib-page-change", {
|
|
57
|
-
detail: { page: this.currentPage, prev },
|
|
58
|
-
bubbles: true,
|
|
59
|
-
composed: true
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
37
|
+
/* ── Lifecycle ──────────────────────────────────────────── */
|
|
62
38
|
connectedCallback() {
|
|
63
39
|
super.connectedCallback();
|
|
64
|
-
|
|
40
|
+
document.addEventListener("keydown", this._onKeydown, true);
|
|
65
41
|
}
|
|
66
42
|
disconnectedCallback() {
|
|
67
43
|
super.disconnectedCallback();
|
|
68
|
-
|
|
44
|
+
document.removeEventListener("keydown", this._onKeydown, true);
|
|
45
|
+
if (this.open) document.body.style.overflow = "";
|
|
46
|
+
}
|
|
47
|
+
updated(changed) {
|
|
48
|
+
if (!changed.has("open")) return;
|
|
49
|
+
if (this.open) {
|
|
50
|
+
this._prevFocus = document.activeElement;
|
|
51
|
+
document.body.style.overflow = "hidden";
|
|
52
|
+
requestAnimationFrame(() => this._focusFirst());
|
|
53
|
+
} else {
|
|
54
|
+
document.body.style.overflow = "";
|
|
55
|
+
if (this._prevFocus instanceof HTMLElement) {
|
|
56
|
+
this._prevFocus.focus();
|
|
57
|
+
}
|
|
58
|
+
this._prevFocus = null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/* ── API pública ────────────────────────────────────────── */
|
|
62
|
+
/** Cierra el modal programáticamente. */
|
|
63
|
+
close() {
|
|
64
|
+
this._close("button");
|
|
65
|
+
}
|
|
66
|
+
/* ── Helpers privados ───────────────────────────────────── */
|
|
67
|
+
_close(reason) {
|
|
68
|
+
this.open = false;
|
|
69
|
+
this.dispatchEvent(
|
|
70
|
+
new CustomEvent("ui-lib-modal-close", {
|
|
71
|
+
detail: { reason },
|
|
72
|
+
bubbles: true,
|
|
73
|
+
composed: true
|
|
74
|
+
})
|
|
75
|
+
);
|
|
69
76
|
}
|
|
77
|
+
_onBackdropClick(e) {
|
|
78
|
+
if (!this.noBackdropClose && e.target === e.currentTarget) {
|
|
79
|
+
this._close("backdrop");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
_focusFirst() {
|
|
83
|
+
const panel = this.renderRoot.querySelector(".mo-panel");
|
|
84
|
+
if (!panel) return;
|
|
85
|
+
const focusable = panel.querySelector(
|
|
86
|
+
'button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
87
|
+
);
|
|
88
|
+
focusable == null ? void 0 : focusable.focus();
|
|
89
|
+
}
|
|
90
|
+
/* ── Render ─────────────────────────────────────────────── */
|
|
70
91
|
render() {
|
|
71
|
-
return
|
|
92
|
+
return modalTemplate({
|
|
93
|
+
open: this.open,
|
|
94
|
+
size: this.size,
|
|
95
|
+
variant: this.variant,
|
|
96
|
+
_animate: this._animate,
|
|
97
|
+
dark: this.dark,
|
|
98
|
+
heading: this.heading,
|
|
99
|
+
subtitle: this.subtitle,
|
|
100
|
+
iconTone: this.iconTone,
|
|
101
|
+
footerInfo: this.footerInfo,
|
|
102
|
+
onClose: () => this._close("button"),
|
|
103
|
+
onBackdropClick: (e) => this._onBackdropClick(e)
|
|
104
|
+
});
|
|
72
105
|
}
|
|
73
106
|
};
|
|
74
|
-
|
|
107
|
+
LibModal.styles = [
|
|
75
108
|
css`${unsafeCSS(sharedTokens)}`,
|
|
76
|
-
css`${unsafeCSS(
|
|
109
|
+
css`${unsafeCSS(modalCss)}`
|
|
77
110
|
];
|
|
78
111
|
__decorateClass([
|
|
79
|
-
property({ type:
|
|
80
|
-
],
|
|
81
|
-
__decorateClass([
|
|
82
|
-
property({ type: Number, attribute: "items-per-page" })
|
|
83
|
-
], LibPagination.prototype, "itemsPerPage", 2);
|
|
84
|
-
__decorateClass([
|
|
85
|
-
property({ type: Number, attribute: "current-page", reflect: true })
|
|
86
|
-
], LibPagination.prototype, "currentPage", 2);
|
|
112
|
+
property({ type: Boolean, reflect: true })
|
|
113
|
+
], LibModal.prototype, "open", 2);
|
|
87
114
|
__decorateClass([
|
|
88
|
-
property({ type:
|
|
89
|
-
],
|
|
115
|
+
property({ type: String, reflect: true })
|
|
116
|
+
], LibModal.prototype, "size", 2);
|
|
90
117
|
__decorateClass([
|
|
91
118
|
property({ type: String, reflect: true })
|
|
92
|
-
],
|
|
119
|
+
], LibModal.prototype, "variant", 2);
|
|
93
120
|
__decorateClass([
|
|
94
121
|
property({ type: String, reflect: true })
|
|
95
|
-
],
|
|
122
|
+
], LibModal.prototype, "_animate", 2);
|
|
96
123
|
__decorateClass([
|
|
97
124
|
property({ type: Boolean, reflect: true })
|
|
98
|
-
],
|
|
125
|
+
], LibModal.prototype, "dark", 2);
|
|
126
|
+
__decorateClass([
|
|
127
|
+
property({ type: String })
|
|
128
|
+
], LibModal.prototype, "heading", 2);
|
|
129
|
+
__decorateClass([
|
|
130
|
+
property({ type: String })
|
|
131
|
+
], LibModal.prototype, "subtitle", 2);
|
|
132
|
+
__decorateClass([
|
|
133
|
+
property({ type: String, attribute: "icon-tone" })
|
|
134
|
+
], LibModal.prototype, "iconTone", 2);
|
|
99
135
|
__decorateClass([
|
|
100
|
-
property({ type:
|
|
101
|
-
],
|
|
136
|
+
property({ type: String, attribute: "footer-info" })
|
|
137
|
+
], LibModal.prototype, "footerInfo", 2);
|
|
102
138
|
__decorateClass([
|
|
103
|
-
property({ type:
|
|
104
|
-
],
|
|
105
|
-
|
|
106
|
-
customElement("lib-
|
|
107
|
-
],
|
|
139
|
+
property({ type: Boolean, attribute: "no-backdrop-close" })
|
|
140
|
+
], LibModal.prototype, "noBackdropClose", 2);
|
|
141
|
+
LibModal = __decorateClass([
|
|
142
|
+
customElement("lib-modal")
|
|
143
|
+
], LibModal);
|
|
108
144
|
export {
|
|
109
|
-
|
|
145
|
+
LibModal
|
|
110
146
|
};
|
|
111
147
|
//# sourceMappingURL=index60.js.map
|
package/dist/index60.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index60.js","sources":["../src/components/molecules/pagination/lib-pagination.component.ts"],"sourcesContent":["import { LitElement, css, unsafeCSS, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { paginationTemplate } from './lib-pagination.html';\nimport paginationCss from './lib-pagination.css?inline';\nimport sharedTokens from '../../../styles/shared/tokens.css?inline';\nimport type { PaginationSize, PaginationVariant } from './lib-pagination.types';\n\n/**\n * lib-pagination — Paginación Shibui\n *\n * @prop total-items — Total de registros\n * @prop items-per-page — Registros por página (default 10)\n * @prop current-page — Página activa (1-indexed, default 1)\n * @prop siblings — Páginas visibles a cada lado de la actual (default 1)\n * @prop size — 'sm' | 'md' | 'lg' (default 'md')\n * @prop variant — 'default' | 'outline' | 'ghost'\n * @prop dark — Tema oscuro\n * @prop show-info — Muestra \"X–Y de Z resultados\"\n * @prop aria-label — Etiqueta accesible del nav (default 'Paginación')\n *\n * @fires ui-lib-page-change — { detail: { page: number, prev: number } }\n *\n * @readonly totalPages — Número total de páginas calculado\n */\n@customElement('lib-pagination')\nexport class LibPagination extends LitElement {\n static override styles = [\n css`${unsafeCSS(sharedTokens)}`,\n css`${unsafeCSS(paginationCss)}`,\n ];\n\n @property({ type: Number, attribute: 'total-items' })\n totalItems = 0;\n\n @property({ type: Number, attribute: 'items-per-page' })\n itemsPerPage = 10;\n\n @property({ type: Number, attribute: 'current-page', reflect: true })\n currentPage = 1;\n\n /** Páginas visibles a cada lado de la página actual antes de los ellipsis */\n @property({ type: Number })\n siblings = 1;\n\n @property({ type: String, reflect: true })\n size: PaginationSize = 'md';\n\n @property({ type: String, reflect: true })\n variant: PaginationVariant = 'default';\n\n @property({ type: Boolean, reflect: true })\n dark = false;\n\n @property({ type: Boolean, attribute: 'show-info' })\n showInfo = false;\n\n @property({ type: String, attribute: 'aria-label' })\n override ariaLabel = 'Paginación';\n\n /* ── Computed ── */\n get totalPages(): number {\n return Math.max(1, Math.ceil(this.totalItems / this.itemsPerPage));\n }\n\n /* ── Cambio de página ── */\n _changePage(page: number): void {\n if (page < 1 || page > this.totalPages || page === this.currentPage) return;\n const prev = this.currentPage;\n this.currentPage = page;\n this.dispatchEvent(new CustomEvent('ui-lib-page-change', {\n detail: { page: this.currentPage, prev },\n bubbles: true,\n composed: true,\n }));\n }\n\n /* ── Teclado en el nav ── */\n private _onKeyDown = (e: KeyboardEvent): void => {\n if (e.key === 'ArrowLeft') { e.preventDefault(); this._changePage(this.currentPage - 1); }\n if (e.key === 'ArrowRight') { e.preventDefault(); this._changePage(this.currentPage + 1); }\n if (e.key === 'Home') { e.preventDefault(); this._changePage(1); }\n if (e.key === 'End') { e.preventDefault(); this._changePage(this.totalPages); }\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('keydown', this._onKeyDown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this._onKeyDown);\n }\n\n protected override render(): TemplateResult {\n return paginationTemplate(this);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'lib-pagination': LibPagination;\n }\n}"],"names":[],"mappings":";;;;;;;;;;;;;;;AAyBO,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AAOL,SAAA,aAAa;AAGb,SAAA,eAAe;AAGf,SAAA,cAAc;AAId,SAAA,WAAW;AAGX,SAAA,OAAuB;AAGvB,SAAA,UAA6B;AAG7B,SAAA,OAAO;AAGP,SAAA,WAAW;AAGX,SAAS,YAAY;AAoBrB,SAAQ,aAAa,CAAC,MAA2B;AAC/C,UAAI,EAAE,QAAQ,aAAc;AAAE,UAAE,eAAA;AAAkB,aAAK,YAAY,K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W,kBAAkB;AAAA,GAT5C,cAUX,WAAA,gBAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,gBAAgB,SAAS,MAAM;AAAA,GAZzD,cAaX,WAAA,eAAA,CAAA;AAIA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAhBf,cAiBX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM;AAAA,GAnB9B,cAoBX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM;AAAA,GAtB9B,cAuBX,WAAA,WAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GAzB/B,cA0BX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,WAAW,aAAa;AAAA,GA5BxC,cA6BX,WAAA,YAAA,CAAA;AAGS,gBAAA;AAAA,EADR,SAAS,EAAE,MAAM,QAAQ,WAAW,cAAc;AAAA,GA/BxC,cAgCF,WAAA,aAAA,CAAA;AAhCE,gBAAN,gBAAA;AAAA,EADN,cAAc,gBAAgB;AAAA,GAClB,aAAA;"}
|
|
1
|
+
{"version":3,"file":"index60.js","sources":["../src/components/molecules/modal/lib-modal.component.ts"],"sourcesContent":["import { LitElement, css, unsafeCSS, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport sharedTokens from '../../../styles/shared/tokens.css?inline';\nimport modalCss from './lib-modal.css?inline';\nimport { modalTemplate } from './lib-modal.html';\nimport { ModalAnimate, ModalCloseEventDetail, ModalIconTone, ModalSize, ModalVariant } from './lib-modal.types';\n\n\n/**\n * @element lib-modal\n *\n * Diálogo bloqueante con backdrop difuminado. Seis tamaños, tres variantes\n * de panel, tres animaciones de entrada y soporte de surface oscura.\n *\n * ## Uso básico\n * ```html\n * <lib-modal heading=\"Editar componente\" open>\n * <p>Contenido del cuerpo.</p>\n * <div slot=\"footer\">\n * <button class=\"mo-btn mo-btn-ghost\">Cancelar</button>\n * <button class=\"mo-btn mo-btn-primary\">Guardar</button>\n * </div>\n * </lib-modal>\n * ```\n *\n * ## Con ícono y subtítulo\n * ```html\n * <lib-modal heading=\"Nuevo componente\" subtitle=\"Shibui DS · añadir\" icon-tone=\"kaki\">\n * <ph-plus slot=\"icon\" weight=\"bold\"></ph-plus>\n * ...\n * </lib-modal>\n * ```\n *\n * ## Control de apertura\n * ```ts\n * modal.open = true;\n * modal.addEventListener('ui-lib-modal-close', e => {\n * console.log(e.detail.reason); // 'button' | 'backdrop' | 'escape'\n * modal.open = false;\n * });\n * ```\n *\n * @prop {boolean} open — Abre el modal. Reflected.\n * @prop {ModalSize} size — xs · sm · md · lg · xl · full (default md).\n * @prop {ModalVariant} variant — default · editorial · danger.\n * @prop {ModalAnimate} _animate — scale · slide-up · slide-down.\n * @prop {boolean} dark — Surface oscura.\n * @prop {string} heading — Título del modal (requerido para a11y).\n * @prop {string} subtitle — Subtítulo mono debajo del título.\n * @prop {ModalIconTone|null} icon-tone — Tono del ícono. Si es null no se renderiza el wrapper.\n * @prop {string} footer-info — Texto secundario izquierda en el footer.\n * @prop {boolean} no-backdrop-close — Desactiva el cierre al hacer click en el backdrop.\n *\n * @slot — Cuerpo del modal (secciones, formularios, contenido libre).\n * @slot icon — Contenido del ícono del header (visible solo si icon-tone no es null).\n * @slot footer — Acciones del footer (botones).\n *\n * @csspart backdrop — Capa de fondo difuminada.\n * @csspart panel-wrap — Contenedor animado (tamaño + animación).\n * @csspart panel — El panel blanco real.\n * @csspart header — Zona del header.\n * @csspart icon — Wrapper del ícono.\n * @csspart close-btn — Botón ×.\n * @csspart body — Zona scrollable del cuerpo.\n * @csspart footer — Zona del footer.\n *\n * @fires ui-lib-modal-close — Emitido cuando el modal se cierra. Detail: { reason }.\n */\n@customElement('lib-modal')\nexport class LibModal extends LitElement {\n static override styles = [\n css`${unsafeCSS(sharedTokens)}`,\n css`${unsafeCSS(modalCss)}`,\n ];\n\n /* ── Props ─────────────────────────────────────────────── */\n\n @property({ type: Boolean, reflect: true })\n open: boolean = false;\n\n @property({ type: String, reflect: true })\n size: ModalSize = 'md';\n\n @property({ type: String, reflect: true })\n variant: ModalVariant = 'default';\n\n @property({ type: String, reflect: true })\n _animate: ModalAnimate = 'scale';\n\n @property({ type: Boolean, reflect: true })\n dark: boolean = false;\n\n /** Título del modal — requerido para accesibilidad (aria-labelledby). */\n @property({ type: String })\n heading: string = '';\n\n @property({ type: String })\n subtitle: string = '';\n\n /**\n * Tono del ícono del header.\n * Acepta: 'default' | 'kaki' | 'celadon' | 'error' | 'info' | null.\n * Cuando es null no se renderiza el wrapper del ícono.\n */\n @property({ type: String, attribute: 'icon-tone' })\n iconTone: ModalIconTone | null = null;\n\n @property({ type: String, attribute: 'footer-info' })\n footerInfo: string = '';\n\n /** Desactiva el cierre al hacer click fuera del panel. */\n @property({ type: Boolean, attribute: 'no-backdrop-close' })\n noBackdropClose: boolean = false;\n\n /* ── Estado interno ─────────────────────────────────────── */\n\n /** Elemento con foco antes de abrir — se restaura al cerrar. */\n private _prevFocus: Element | null = null;\n\n /** Handler de Escape vinculado para poder desregistrarlo. */\n private readonly _onKeydown = (e: KeyboardEvent): void => {\n if (e.key === 'Escape' && this.open) {\n e.stopPropagation();\n this._close('escape');\n }\n };\n\n /* ── Lifecycle ──────────────────────────────────────────── */\n\n override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('keydown', this._onKeydown, true);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('keydown', this._onKeydown, true);\n // Restaurar scroll si el componente se desmonta mientras está abierto\n if (this.open) document.body.style.overflow = '';\n }\n\n override updated(changed: Map<string, unknown>): void {\n if (!changed.has('open')) return;\n\n if (this.open) {\n this._prevFocus = document.activeElement;\n document.body.style.overflow = 'hidden';\n // Foco al primer elemento interactivo tras el render\n requestAnimationFrame(() => this._focusFirst());\n } else {\n document.body.style.overflow = '';\n // Restaurar foco al trigger original\n if (this._prevFocus instanceof HTMLElement) {\n this._prevFocus.focus();\n }\n this._prevFocus = null;\n }\n }\n\n /* ── API pública ────────────────────────────────────────── */\n\n /** Cierra el modal programáticamente. */\n close(): void {\n this._close('button');\n }\n\n /* ── Helpers privados ───────────────────────────────────── */\n\n private _close(reason: ModalCloseEventDetail['reason']): void {\n this.open = false;\n this.dispatchEvent(\n new CustomEvent<ModalCloseEventDetail>('ui-lib-modal-close', {\n detail: { reason },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _onBackdropClick(e: MouseEvent): void {\n // Solo cierra si el click es directamente sobre el backdrop\n if (!this.noBackdropClose && e.target === e.currentTarget) {\n this._close('backdrop');\n }\n }\n\n private _focusFirst(): void {\n const panel = this.renderRoot.querySelector('.mo-panel');\n if (!panel) return;\n const focusable = panel.querySelector<HTMLElement>(\n 'button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])',\n );\n focusable?.focus();\n }\n\n /* ── Render ─────────────────────────────────────────────── */\n\n override render(): TemplateResult {\n return modalTemplate({\n open: this.open,\n size: this.size,\n variant: this.variant,\n _animate: this._animate,\n dark: this.dark,\n heading: this.heading,\n subtitle: this.subtitle,\n iconTone: this.iconTone,\n footerInfo: this.footerInfo,\n onClose: () => this._close('button'),\n onBackdropClick: (e) => this._onBackdropClick(e),\n });\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'lib-modal': LibModal;\n }\n}\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAqEO,IAAM,WAAN,cAAuB,WAAW;AAAA,EAAlC,cAAA;AAAA,UAAA,GAAA,SAAA;AASL,SAAA,OAAgB;AAGhB,SAAA,OAAkB;AAGlB,SAAA,UAAwB;AAGxB,SAAA,WAAyB;AAGzB,SAAA,OAAgB;AAIhB,SAAA,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AAQ;AAAA,GAxBf,SAyBX,WAAA,WAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GA3Bf,SA4BX,WAAA,YAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,aAAa;AAAA,GAnCvC,SAoCX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,eAAe;AAAA,GAtCzC,SAuCX,WAAA,cAAA,CAAA;AAIA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,WAAW,qBAAqB;AAAA,GA1ChD,SA2CX,WAAA,mBAAA,CAAA;AA3CW,WAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,QAAA;"}
|
package/dist/index61.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { unsafeCSS, css, LitElement
|
|
2
|
-
import { property,
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { unsafeCSS, css, LitElement } from "lit";
|
|
2
|
+
import { property, customElement } from "lit/decorators.js";
|
|
3
|
+
import { paginationTemplate } from "./index221.js";
|
|
4
|
+
import paginationCss from "./index222.js";
|
|
5
5
|
import sharedTokens from "./index196.js";
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -13,205 +13,99 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
13
|
if (kind && result) __defProp(target, key, result);
|
|
14
14
|
return result;
|
|
15
15
|
};
|
|
16
|
-
let
|
|
16
|
+
let LibPagination = class extends LitElement {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
19
|
+
this.totalItems = 0;
|
|
20
|
+
this.itemsPerPage = 10;
|
|
21
|
+
this.currentPage = 1;
|
|
22
|
+
this.siblings = 1;
|
|
23
|
+
this.size = "md";
|
|
24
|
+
this.variant = "default";
|
|
22
25
|
this.dark = false;
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
this.showInfo = false;
|
|
27
|
+
this.ariaLabel = "Paginación";
|
|
28
|
+
this._onKeyDown = (e) => {
|
|
29
|
+
if (e.key === "ArrowLeft") {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
this._changePage(this.currentPage - 1);
|
|
32
|
+
}
|
|
33
|
+
if (e.key === "ArrowRight") {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
this._changePage(this.currentPage + 1);
|
|
36
|
+
}
|
|
37
|
+
if (e.key === "Home") {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
this._changePage(1);
|
|
40
|
+
}
|
|
41
|
+
if (e.key === "End") {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
this._changePage(this.totalPages);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
33
46
|
}
|
|
34
|
-
/* ──
|
|
35
|
-
|
|
36
|
-
this.
|
|
37
|
-
requestAnimationFrame(() => this._positionInk());
|
|
47
|
+
/* ── Computed ── */
|
|
48
|
+
get totalPages() {
|
|
49
|
+
return Math.max(1, Math.ceil(this.totalItems / this.itemsPerPage));
|
|
38
50
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
/* ── Cambio de página ── */
|
|
52
|
+
_changePage(page) {
|
|
53
|
+
if (page < 1 || page > this.totalPages || page === this.currentPage) return;
|
|
54
|
+
const prev = this.currentPage;
|
|
55
|
+
this.currentPage = page;
|
|
56
|
+
this.dispatchEvent(new CustomEvent("ui-lib-page-change", {
|
|
57
|
+
detail: { page: this.currentPage, prev },
|
|
58
|
+
bubbles: true,
|
|
59
|
+
composed: true
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
connectedCallback() {
|
|
63
|
+
super.connectedCallback();
|
|
64
|
+
this.addEventListener("keydown", this._onKeyDown);
|
|
45
65
|
}
|
|
46
66
|
disconnectedCallback() {
|
|
47
|
-
var _a;
|
|
48
67
|
super.disconnectedCallback();
|
|
49
|
-
(
|
|
50
|
-
this._ro = null;
|
|
51
|
-
}
|
|
52
|
-
/* ── Ink bar ── */
|
|
53
|
-
_positionInk() {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
const noInkVariants = [
|
|
56
|
-
"pill",
|
|
57
|
-
"card",
|
|
58
|
-
"outline",
|
|
59
|
-
"vertical"
|
|
60
|
-
];
|
|
61
|
-
if (noInkVariants.includes(this.variant)) return;
|
|
62
|
-
const list = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector(".tb-list");
|
|
63
|
-
const activeTab = (_b = this.shadowRoot) == null ? void 0 : _b.querySelector(".tb-tab.is-active");
|
|
64
|
-
if (!list || !activeTab) return;
|
|
65
|
-
const listRect = list.getBoundingClientRect();
|
|
66
|
-
const tabRect = activeTab.getBoundingClientRect();
|
|
67
|
-
this._inkLeft = tabRect.left - listRect.left;
|
|
68
|
-
this._inkWidth = tabRect.width;
|
|
69
|
-
}
|
|
70
|
-
_setupResizeObserver() {
|
|
71
|
-
var _a;
|
|
72
|
-
const list = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector(".tb-list");
|
|
73
|
-
if (!list) return;
|
|
74
|
-
this._ro = new ResizeObserver(() => this._positionInk());
|
|
75
|
-
this._ro.observe(list);
|
|
68
|
+
this.removeEventListener("keydown", this._onKeyDown);
|
|
76
69
|
}
|
|
77
|
-
/* ── Tab activation ── */
|
|
78
|
-
_activateTab(id) {
|
|
79
|
-
var _a;
|
|
80
|
-
if (id === this.active) return;
|
|
81
|
-
const prev = this.active;
|
|
82
|
-
this.active = id;
|
|
83
|
-
if (this.scrollable) {
|
|
84
|
-
const tab = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector(
|
|
85
|
-
`[data-id="${id}"]`
|
|
86
|
-
);
|
|
87
|
-
tab == null ? void 0 : tab.scrollIntoView({
|
|
88
|
-
inline: "nearest",
|
|
89
|
-
block: "nearest",
|
|
90
|
-
behavior: "smooth"
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
this.dispatchEvent(
|
|
94
|
-
new CustomEvent("ui-lib-tab-change", {
|
|
95
|
-
detail: { id, prev },
|
|
96
|
-
bubbles: true,
|
|
97
|
-
composed: true
|
|
98
|
-
})
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
_handleClick(e) {
|
|
102
|
-
var _a;
|
|
103
|
-
const targetId = e.target.id;
|
|
104
|
-
console.log("target:", e.target.id);
|
|
105
|
-
const tabs = Array.from(
|
|
106
|
-
((_a = this.shadowRoot) == null ? void 0 : _a.querySelectorAll(
|
|
107
|
-
".tb-tab:not(.is-disabled)"
|
|
108
|
-
)) ?? []
|
|
109
|
-
);
|
|
110
|
-
const selectedTab = tabs.find((tab) => tab.id === targetId);
|
|
111
|
-
console.log(selectedTab);
|
|
112
|
-
if (!selectedTab) return;
|
|
113
|
-
this._activateTab((selectedTab == null ? void 0 : selectedTab.dataset["id"]) ?? "");
|
|
114
|
-
selectedTab.focus();
|
|
115
|
-
}
|
|
116
|
-
/* ── Keyboard navigation ── */
|
|
117
|
-
_handleKey(e) {
|
|
118
|
-
var _a;
|
|
119
|
-
const isVertical = this.variant === "vertical";
|
|
120
|
-
const tabs = Array.from(
|
|
121
|
-
((_a = this.shadowRoot) == null ? void 0 : _a.querySelectorAll(
|
|
122
|
-
".tb-tab:not(.is-disabled)"
|
|
123
|
-
)) ?? []
|
|
124
|
-
);
|
|
125
|
-
const current = tabs.findIndex((t) => t.dataset["id"] === this.active);
|
|
126
|
-
let next = -1;
|
|
127
|
-
if (e.key === "ArrowRight" && !isVertical || e.key === "ArrowDown" && isVertical) {
|
|
128
|
-
e.preventDefault();
|
|
129
|
-
next = (current + 1) % tabs.length;
|
|
130
|
-
} else if (e.key === "ArrowLeft" && !isVertical || e.key === "ArrowUp" && isVertical) {
|
|
131
|
-
e.preventDefault();
|
|
132
|
-
next = (current - 1 + tabs.length) % tabs.length;
|
|
133
|
-
} else if (e.key === "Home") {
|
|
134
|
-
e.preventDefault();
|
|
135
|
-
next = 0;
|
|
136
|
-
} else if (e.key === "End") {
|
|
137
|
-
e.preventDefault();
|
|
138
|
-
next = tabs.length - 1;
|
|
139
|
-
}
|
|
140
|
-
if (next >= 0) {
|
|
141
|
-
const target = tabs[next];
|
|
142
|
-
if (target == null ? void 0 : target.dataset["id"]) {
|
|
143
|
-
this._activateTab(target.dataset["id"]);
|
|
144
|
-
target.focus();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
/* ── renderItem (LibListModel) — fallback para modo loading ── */
|
|
149
|
-
renderItem(item) {
|
|
150
|
-
return html`<button class="tb-tab">${item.label}</button>`;
|
|
151
|
-
}
|
|
152
|
-
/* ── Render principal ── */
|
|
153
70
|
render() {
|
|
154
|
-
|
|
155
|
-
console.log(
|
|
156
|
-
"lib-tabs render, items:",
|
|
157
|
-
(_a = this.items) == null ? void 0 : _a.length,
|
|
158
|
-
"active:",
|
|
159
|
-
this.active
|
|
160
|
-
);
|
|
161
|
-
return tabsTemplate(this);
|
|
71
|
+
return paginationTemplate(this);
|
|
162
72
|
}
|
|
163
73
|
};
|
|
164
|
-
|
|
165
|
-
css
|
|
166
|
-
|
|
167
|
-
`,
|
|
168
|
-
css`
|
|
169
|
-
${unsafeCSS(tabsCss)}
|
|
170
|
-
`
|
|
74
|
+
LibPagination.styles = [
|
|
75
|
+
css`${unsafeCSS(sharedTokens)}`,
|
|
76
|
+
css`${unsafeCSS(paginationCss)}`
|
|
171
77
|
];
|
|
172
78
|
__decorateClass([
|
|
173
|
-
property({ type:
|
|
174
|
-
],
|
|
79
|
+
property({ type: Number, attribute: "total-items" })
|
|
80
|
+
], LibPagination.prototype, "totalItems", 2);
|
|
175
81
|
__decorateClass([
|
|
176
|
-
property({ type:
|
|
177
|
-
],
|
|
178
|
-
__decorateClass([
|
|
179
|
-
property({ type: String, reflect: true })
|
|
180
|
-
], LibTabs.prototype, "size", 2);
|
|
82
|
+
property({ type: Number, attribute: "items-per-page" })
|
|
83
|
+
], LibPagination.prototype, "itemsPerPage", 2);
|
|
181
84
|
__decorateClass([
|
|
182
|
-
property({ type:
|
|
183
|
-
],
|
|
85
|
+
property({ type: Number, attribute: "current-page", reflect: true })
|
|
86
|
+
], LibPagination.prototype, "currentPage", 2);
|
|
184
87
|
__decorateClass([
|
|
185
|
-
property({ type:
|
|
186
|
-
],
|
|
88
|
+
property({ type: Number })
|
|
89
|
+
], LibPagination.prototype, "siblings", 2);
|
|
187
90
|
__decorateClass([
|
|
188
|
-
property({ type:
|
|
189
|
-
],
|
|
91
|
+
property({ type: String, reflect: true })
|
|
92
|
+
], LibPagination.prototype, "size", 2);
|
|
190
93
|
__decorateClass([
|
|
191
|
-
property({ type:
|
|
192
|
-
],
|
|
94
|
+
property({ type: String, reflect: true })
|
|
95
|
+
], LibPagination.prototype, "variant", 2);
|
|
193
96
|
__decorateClass([
|
|
194
97
|
property({ type: Boolean, reflect: true })
|
|
195
|
-
],
|
|
98
|
+
], LibPagination.prototype, "dark", 2);
|
|
196
99
|
__decorateClass([
|
|
197
|
-
property({ type:
|
|
198
|
-
],
|
|
100
|
+
property({ type: Boolean, attribute: "show-info" })
|
|
101
|
+
], LibPagination.prototype, "showInfo", 2);
|
|
199
102
|
__decorateClass([
|
|
200
103
|
property({ type: String, attribute: "aria-label" })
|
|
201
|
-
],
|
|
202
|
-
__decorateClass([
|
|
203
|
-
|
|
204
|
-
],
|
|
205
|
-
__decorateClass([
|
|
206
|
-
state()
|
|
207
|
-
], LibTabs.prototype, "_inkLeft", 2);
|
|
208
|
-
__decorateClass([
|
|
209
|
-
state()
|
|
210
|
-
], LibTabs.prototype, "_inkWidth", 2);
|
|
211
|
-
LibTabs = __decorateClass([
|
|
212
|
-
customElement("lib-tabs")
|
|
213
|
-
], LibTabs);
|
|
104
|
+
], LibPagination.prototype, "ariaLabel", 2);
|
|
105
|
+
LibPagination = __decorateClass([
|
|
106
|
+
customElement("lib-pagination")
|
|
107
|
+
], LibPagination);
|
|
214
108
|
export {
|
|
215
|
-
|
|
109
|
+
LibPagination
|
|
216
110
|
};
|
|
217
111
|
//# sourceMappingURL=index61.js.map
|
package/dist/index61.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index61.js","sources":["../src/components/molecules/tabs/lib-tabs.component.ts"],"sourcesContent":["import { html, css, unsafeCSS, TemplateResult, LitElement } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tabsTemplate } from \"./lib-tabs.html\";\nimport tabsCss from \"./lib-tabs.css?inline\";\nimport sharedTokens from \"../../../styles/shared/tokens.css?inline\";\nimport type {\n TabItem,\n TabsVariant,\n TabsColor,\n TabsSize,\n} from \"./lib-tabs.types\";\n\n/**\n * lib-tabs — Componente de pestañas Shibui (SG-60)\n *\n * @prop variant — 'underline' | 'pill' | 'card' | 'outline' | 'vertical'\n * @prop color — 'kaki' | 'celadon'\n * @prop size — 'sm' | 'md' | 'lg'\n * @prop dark — surface oscura\n * @prop kintsugi — ink bar animada dorada\n * @prop glitch — efecto RGB split en tab activo\n * @prop scroll — overflow-x scroll en la lista\n * @prop full — tabs en grid de columnas iguales\n * @prop active — id del tab activo\n * @prop items — array de TabItem\n *\n * Panels: cada TabItem con id=\"X\" se muestra via <slot name=\"X\">.\n * El usuario añade <div slot=\"X\">contenido</div> como hijo de lib-tabs.\n *\n * @fires ui-lib-tab-change — {detail: { id: string; prev: string }}\n */\n@customElement(\"lib-tabs\")\nexport class LibTabs extends LitElement {\n static override styles = [\n css`\n ${unsafeCSS(sharedTokens)}\n `,\n css`\n ${unsafeCSS(tabsCss)}\n `,\n ];\n\n @property({ type: String, reflect: true })\n variant: TabsVariant = \"underline\";\n\n @property({ type: String, reflect: true })\n color: TabsColor | \"\" = \"\";\n\n @property({ type: String, reflect: true })\n size: TabsSize | \"\" = \"\";\n\n @property({ type: Boolean, reflect: true })\n dark = false;\n\n @property({ type: Boolean, reflect: true })\n kintsugi = false;\n\n @property({ type: Boolean, reflect: true })\n glitch = false;\n\n @property({ type: Boolean, reflect: true, attribute: \"scroll\" })\n scrollable = false;\n\n @property({ type: Boolean, reflect: true })\n full = false;\n\n @property({ type: String, reflect: true })\n active = \"\";\n\n /** aria-label para el tablist */\n @property({ type: String, attribute: \"aria-label\" })\n override ariaLabel = \"\";\n\n @property({ type: Array, hasChanged: () => true })\n items: TabItem[] = [];\n\n /* ── Internal state para la ink bar ── */\n @state() _inkLeft = 0;\n @state() _inkWidth = 0;\n\n private _ro: ResizeObserver | null = null;\n\n /* ── Lifecycle ── */\n\n override firstUpdated(): void {\n this._setupResizeObserver();\n // Aseguramos que el primer tab activo tiene ink bar correcta\n requestAnimationFrame((): void => this._positionInk());\n }\n\n override updated(changed: Map<string, unknown>): void {\n super.updated?.(changed);\n if (\n changed.has(\"active\") ||\n changed.has(\"items\") ||\n changed.has(\"variant\")\n ) {\n requestAnimationFrame((): void => this._positionInk());\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._ro?.disconnect();\n this._ro = null;\n }\n\n /* ── Ink bar ── */\n\n private _positionInk(): void {\n /* Solo aplica a variantes con ink bar */\n const noInkVariants: TabsVariant[] = [\n \"pill\",\n \"card\",\n \"outline\",\n \"vertical\",\n ];\n if (noInkVariants.includes(this.variant)) return;\n\n const list = this.shadowRoot?.querySelector<HTMLElement>(\".tb-list\");\n const activeTab =\n this.shadowRoot?.querySelector<HTMLElement>(\".tb-tab.is-active\");\n if (!list || !activeTab) return;\n\n const listRect = list.getBoundingClientRect();\n const tabRect = activeTab.getBoundingClientRect();\n this._inkLeft = tabRect.left - listRect.left;\n this._inkWidth = tabRect.width;\n }\n\n private _setupResizeObserver(): void {\n const list = this.shadowRoot?.querySelector<HTMLElement>(\".tb-list\");\n if (!list) return;\n this._ro = new ResizeObserver((): void => this._positionInk());\n this._ro.observe(list);\n }\n\n /* ── Tab activation ── */\n\n private _activateTab(id: string): void {\n if (id === this.active) return;\n const prev = this.active;\n this.active = id;\n\n /* Scroll tab into view si está en modo scrollable */\n if (this.scrollable) {\n const tab = this.shadowRoot?.querySelector<HTMLElement>(\n `[data-id=\"${id}\"]`,\n );\n tab?.scrollIntoView({\n inline: \"nearest\",\n block: \"nearest\",\n behavior: \"smooth\",\n });\n }\n\n this.dispatchEvent(\n new CustomEvent(\"ui-lib-tab-change\", {\n detail: { id, prev },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n _handleClick(e: CustomEvent): void {\n const targetId = (e.target as HTMLElement).id;\n console.log(\"target:\", (e.target as HTMLElement).id);\n\n const tabs = Array.from(\n this.shadowRoot?.querySelectorAll<HTMLButtonElement>(\n \".tb-tab:not(.is-disabled)\",\n ) ?? [],\n );\n\n const selectedTab = tabs.find((tab) => tab.id === targetId);\n console.log(selectedTab);\n\n if (!selectedTab) return; // Si no lo encuentra, abortamos la función\n\n this._activateTab(selectedTab?.dataset[\"id\"] ?? \"\");\n selectedTab.focus();\n }\n\n /* ── Keyboard navigation ── */\n\n _handleKey(e: KeyboardEvent): void {\n const isVertical = this.variant === \"vertical\";\n const tabs = Array.from(\n this.shadowRoot?.querySelectorAll<HTMLButtonElement>(\n \".tb-tab:not(.is-disabled)\",\n ) ?? [],\n );\n const current = tabs.findIndex((t) => t.dataset[\"id\"] === this.active);\n\n let next = -1;\n\n if (\n (e.key === \"ArrowRight\" && !isVertical) ||\n (e.key === \"ArrowDown\" && isVertical)\n ) {\n e.preventDefault();\n next = (current + 1) % tabs.length;\n } else if (\n (e.key === \"ArrowLeft\" && !isVertical) ||\n (e.key === \"ArrowUp\" && isVertical)\n ) {\n e.preventDefault();\n next = (current - 1 + tabs.length) % tabs.length;\n } else if (e.key === \"Home\") {\n e.preventDefault();\n next = 0;\n } else if (e.key === \"End\") {\n e.preventDefault();\n next = tabs.length - 1;\n }\n\n if (next >= 0) {\n const target = tabs[next];\n if (target?.dataset[\"id\"]) {\n this._activateTab(target.dataset[\"id\"]);\n target.focus();\n }\n }\n }\n\n /* ── renderItem (LibListModel) — fallback para modo loading ── */\n protected renderItem(item: TabItem): TemplateResult {\n return html`<button class=\"tb-tab\">${item.label}</button>`;\n }\n\n /* ── Render principal ── */\n protected override render(): TemplateResult {\n console.log(\n \"lib-tabs render, items:\",\n this.items?.length,\n \"active:\",\n this.active,\n );\n\n return tabsTemplate(this);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"lib-tabs\": LibTabs;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgCO,IAAM,UAAN,cAAsB,WAAW;AAAA,EAAjC,cAAA;AAAA,UAAA,GAAA,SAAA;AAWL,SAAA,UAAuB;AAGvB,SAAA,QAAwB;AAGxB,SAAA,OAAsB;AAGtB,SAAA,OAAO;AAGP,SAAA,WAAW;AAGX,SAAA,SAAS;AAGT,SAAA,aAAa;AAGb,SAAA,OAAO;AAGP,SAAA,SAAS;AAIT,SAAS,YAAY;AAGrB,SAAA,QAAmB,CAAA;AAGV,SAAA,WAAW;AACX,SAAA,YAAY;AAErB,SAAQ,MAA6B;AAAA,EAAA;AAAA;AAAA,EAI5B,eAAqB;AAC5B,SAAK,qBAAA;AAEL,0BAAsB,MAAY,KAAK,cAAc;AAAA,EACvD;AAAA,EAES,QAAQ,SAAqC;;AACpD,gBAAM,YAAN,8BAAgB;AAChB,QACE,QAAQ,IAAI,QAAQ,KACpB,QAAQ,IAAI,OAAO,KACnB,QAAQ,IAAI,SAAS,GACrB;AACA,4BAAsB,MAAY,KAAK,cAAc;AAAA,IACvD;AAAA,EACF;AAAA,EAES,uBAA6B;;AACpC,UAAM,qBAAA;AACN,eAAK,QAAL,mBAAU;AACV,SAAK,MAAM;AAAA,EACb;AAAA;AAAA,E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AM,OAAO,YAAY,MAAM,MAAM;AAAA,GAzCtC,QA0CX,WAAA,SAAA,CAAA;AAGS,gBAAA;AAAA,EAAR,MAAA;AAAM,GA7CI,QA6CF,WAAA,YAAA,CAAA;AACA,gBAAA;AAAA,EAAR,MAAA;AAAM,GA9CI,QA8CF,WAAA,aAAA,CAAA;AA9CE,UAAN,gBAAA;AAAA,EADN,cAAc,UAAU;AAAA,GACZ,OAAA;"}
|
|
1
|
+
{"version":3,"file":"index61.js","sources":["../src/components/molecules/pagination/lib-pagination.component.ts"],"sourcesContent":["import { LitElement, css, unsafeCSS, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { paginationTemplate } from './lib-pagination.html';\nimport paginationCss from './lib-pagination.css?inline';\nimport sharedTokens from '../../../styles/shared/tokens.css?inline';\nimport type { PaginationSize, PaginationVariant } from './lib-pagination.types';\n\n/**\n * lib-pagination — Paginación Shibui\n *\n * @prop total-items — Total de registros\n * @prop items-per-page — Registros por página (default 10)\n * @prop current-page — Página activa (1-indexed, default 1)\n * @prop siblings — Páginas visibles a cada lado de la actual (default 1)\n * @prop size — 'sm' | 'md' | 'lg' (default 'md')\n * @prop variant — 'default' | 'outline' | 'ghost'\n * @prop dark — Tema oscuro\n * @prop show-info — Muestra \"X–Y de Z resultados\"\n * @prop aria-label — Etiqueta accesible del nav (default 'Paginación')\n *\n * @fires ui-lib-page-change — { detail: { page: number, prev: number } }\n *\n * @readonly totalPages — Número total de páginas calculado\n */\n@customElement('lib-pagination')\nexport class LibPagination extends LitElement {\n static override styles = [\n css`${unsafeCSS(sharedTokens)}`,\n css`${unsafeCSS(paginationCss)}`,\n ];\n\n @property({ type: Number, attribute: 'total-items' })\n totalItems = 0;\n\n @property({ type: Number, attribute: 'items-per-page' })\n itemsPerPage = 10;\n\n @property({ type: Number, attribute: 'current-page', reflect: true })\n currentPage = 1;\n\n /** Páginas visibles a cada lado de la página actual antes de los ellipsis */\n @property({ type: Number })\n siblings = 1;\n\n @property({ type: String, reflect: true })\n size: PaginationSize = 'md';\n\n @property({ type: String, reflect: true })\n variant: PaginationVariant = 'default';\n\n @property({ type: Boolean, reflect: true })\n dark = false;\n\n @property({ type: Boolean, attribute: 'show-info' })\n showInfo = false;\n\n @property({ type: String, attribute: 'aria-label' })\n override ariaLabel = 'Paginación';\n\n /* ── Computed ── */\n get totalPages(): number {\n return Math.max(1, Math.ceil(this.totalItems / this.itemsPerPage));\n }\n\n /* ── Cambio de página ── */\n _changePage(page: number): void {\n if (page < 1 || page > this.totalPages || page === this.currentPage) return;\n const prev = this.currentPage;\n this.currentPage = page;\n this.dispatchEvent(new CustomEvent('ui-lib-page-change', {\n detail: { page: this.currentPage, prev },\n bubbles: true,\n composed: true,\n }));\n }\n\n /* ── Teclado en el nav ── */\n private _onKeyDown = (e: KeyboardEvent): void => {\n if (e.key === 'ArrowLeft') { e.preventDefault(); this._changePage(this.currentPage - 1); }\n if (e.key === 'ArrowRight') { e.preventDefault(); this._changePage(this.currentPage + 1); }\n if (e.key === 'Home') { e.preventDefault(); this._changePage(1); }\n if (e.key === 'End') { e.preventDefault(); this._changePage(this.totalPages); }\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('keydown', this._onKeyDown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this._onKeyDown);\n }\n\n protected override render(): TemplateResult {\n return paginationTemplate(this);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'lib-pagination': LibPagination;\n }\n}"],"names":[],"mappings":";;;;;;;;;;;;;;;AAyBO,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AAOL,SAAA,aAAa;AAGb,SAAA,eAAe;AAGf,SAAA,cAAc;AAId,SAAA,WAAW;AAGX,SAAA,OAAuB;AAGvB,SAAA,UAA6B;AAG7B,SAAA,OAAO;AAGP,SAAA,WAAW;AAGX,SAAS,YAAY;AAoBrB,SAAQ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