@descope/web-components-ui 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +129 -4
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +129 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/dist/umd/descope-timer-button.js +2 -2
- package/dist/umd/descope-timer-button.js.map +1 -1
- package/dist/umd/descope-timer.js +1 -1
- package/dist/umd/descope-timer.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +32 -32
package/dist/index.esm.js
CHANGED
|
@@ -22587,26 +22587,85 @@ class RawTimerButton extends BaseClass$4 {
|
|
|
22587
22587
|
.wrapper {
|
|
22588
22588
|
display: flex;
|
|
22589
22589
|
flex-direction: column;
|
|
22590
|
-
gap: 0.5em;
|
|
22591
22590
|
align-items: center;
|
|
22592
22591
|
width: 100%;
|
|
22593
22592
|
}
|
|
22594
|
-
|
|
22593
|
+
/* allow timer to grow along the main axis in the wrapper flex container */
|
|
22594
|
+
:host(:not([timer-inside="true"])) .timer {
|
|
22595
22595
|
flex: 1;
|
|
22596
22596
|
}
|
|
22597
|
+
:host([timer-inside="true"]) .timer {
|
|
22598
|
+
flex: 0 0 auto;
|
|
22599
|
+
}
|
|
22597
22600
|
`,
|
|
22598
22601
|
this,
|
|
22599
22602
|
);
|
|
22600
22603
|
|
|
22604
|
+
this.wrapper = this.shadowRoot.querySelector('.wrapper');
|
|
22601
22605
|
this.timer = this.shadowRoot.querySelector('.timer');
|
|
22602
22606
|
this.button = this.shadowRoot.querySelector('.button');
|
|
22607
|
+
this.forwardingSlot = this.shadowRoot.querySelector('.button slot');
|
|
22603
22608
|
|
|
22604
22609
|
this.timer.addEventListener('timer-started', () => this.onTimerStarted());
|
|
22605
22610
|
this.timer.addEventListener('timer-ended', () => this.onTimerEnded());
|
|
22606
22611
|
|
|
22612
|
+
this.syncTimerPlacement();
|
|
22613
|
+
|
|
22607
22614
|
this.button.addEventListener('click', this.onClick.bind(this));
|
|
22608
22615
|
}
|
|
22609
22616
|
|
|
22617
|
+
static get observedAttributes() {
|
|
22618
|
+
return [
|
|
22619
|
+
...(super.observedAttributes || []),
|
|
22620
|
+
'timer-inside',
|
|
22621
|
+
'timer-position',
|
|
22622
|
+
];
|
|
22623
|
+
}
|
|
22624
|
+
|
|
22625
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
22626
|
+
super.attributeChangedCallback?.(name, oldValue, newValue);
|
|
22627
|
+
if (name === 'timer-inside' || name === 'timer-position') {
|
|
22628
|
+
this.syncTimerPlacement();
|
|
22629
|
+
}
|
|
22630
|
+
}
|
|
22631
|
+
|
|
22632
|
+
get #isTimerInside() {
|
|
22633
|
+
return this.getAttribute('timer-inside') === 'true';
|
|
22634
|
+
}
|
|
22635
|
+
|
|
22636
|
+
get #isReversed() {
|
|
22637
|
+
return this.getAttribute('timer-position') === 'end';
|
|
22638
|
+
}
|
|
22639
|
+
|
|
22640
|
+
syncTimerPlacement() {
|
|
22641
|
+
if (this.#isTimerInside) {
|
|
22642
|
+
this.#placeTimerInsideButton(this.#isReversed);
|
|
22643
|
+
} else {
|
|
22644
|
+
this.#placeTimerOutsideButton();
|
|
22645
|
+
}
|
|
22646
|
+
}
|
|
22647
|
+
|
|
22648
|
+
#placeTimerInsideButton(reversed) {
|
|
22649
|
+
if (reversed) {
|
|
22650
|
+
// timer after label text (right)
|
|
22651
|
+
if (this.timer.previousSibling !== this.forwardingSlot) {
|
|
22652
|
+
this.button.appendChild(this.timer);
|
|
22653
|
+
}
|
|
22654
|
+
} else {
|
|
22655
|
+
// timer before label text (left) — matches default outside position (above/before button)
|
|
22656
|
+
if (this.timer.nextSibling !== this.forwardingSlot) {
|
|
22657
|
+
this.button.insertBefore(this.timer, this.forwardingSlot);
|
|
22658
|
+
}
|
|
22659
|
+
}
|
|
22660
|
+
}
|
|
22661
|
+
|
|
22662
|
+
#placeTimerOutsideButton() {
|
|
22663
|
+
// move timer back as a wrapper sibling, before the button so flex-column puts it above
|
|
22664
|
+
if (this.timer.parentElement !== this.wrapper) {
|
|
22665
|
+
this.wrapper.insertBefore(this.timer, this.button);
|
|
22666
|
+
}
|
|
22667
|
+
}
|
|
22668
|
+
|
|
22610
22669
|
set onclick(val) {
|
|
22611
22670
|
this.button.onclick = val;
|
|
22612
22671
|
}
|
|
@@ -22654,8 +22713,26 @@ class RawTimerButton extends BaseClass$4 {
|
|
|
22654
22713
|
}
|
|
22655
22714
|
}
|
|
22656
22715
|
|
|
22657
|
-
const {
|
|
22658
|
-
host:
|
|
22716
|
+
const {
|
|
22717
|
+
host: host$4,
|
|
22718
|
+
nestedTimer,
|
|
22719
|
+
nestedButton,
|
|
22720
|
+
timerInsideNotReversed,
|
|
22721
|
+
timerInsideReversed,
|
|
22722
|
+
} = {
|
|
22723
|
+
host: { selector: () => ':host' },
|
|
22724
|
+
nestedTimer: { selector: () => ':host([timer-inside="true"]) .timer' },
|
|
22725
|
+
nestedButton: {
|
|
22726
|
+
selector: () => ':host([timer-inside="true"]) .button',
|
|
22727
|
+
},
|
|
22728
|
+
timerInsideNotReversed: {
|
|
22729
|
+
selector: () =>
|
|
22730
|
+
':host([timer-inside="true"]:not([timer-position="end"])) .timer',
|
|
22731
|
+
},
|
|
22732
|
+
timerInsideReversed: {
|
|
22733
|
+
selector: () => ':host([timer-inside="true"][timer-position="end"]) .timer',
|
|
22734
|
+
},
|
|
22735
|
+
};
|
|
22659
22736
|
|
|
22660
22737
|
const TimerButtonClass = compose$1(
|
|
22661
22738
|
createStyleMixin$1({
|
|
@@ -22664,6 +22741,30 @@ const TimerButtonClass = compose$1(
|
|
|
22664
22741
|
flexDirection: {},
|
|
22665
22742
|
hostWidth: { ...host$4, property: 'width' },
|
|
22666
22743
|
hostDirection: { ...host$4, property: 'direction' },
|
|
22744
|
+
timerTextColor: {
|
|
22745
|
+
...nestedTimer,
|
|
22746
|
+
property: TimerClass.cssVarList.textColor,
|
|
22747
|
+
},
|
|
22748
|
+
timerIconColor: {
|
|
22749
|
+
...nestedTimer,
|
|
22750
|
+
property: TimerClass.cssVarList.iconColor,
|
|
22751
|
+
},
|
|
22752
|
+
timerHostWidth: {
|
|
22753
|
+
...nestedTimer,
|
|
22754
|
+
property: TimerClass.cssVarList.hostWidth,
|
|
22755
|
+
},
|
|
22756
|
+
buttonLabelSpacing: {
|
|
22757
|
+
...nestedButton,
|
|
22758
|
+
property: ButtonClass.cssVarList.labelSpacing,
|
|
22759
|
+
},
|
|
22760
|
+
timerInsideGapEnd: {
|
|
22761
|
+
...timerInsideNotReversed,
|
|
22762
|
+
property: 'margin-inline-end',
|
|
22763
|
+
},
|
|
22764
|
+
timerInsideGapStart: {
|
|
22765
|
+
...timerInsideReversed,
|
|
22766
|
+
property: 'margin-inline-start',
|
|
22767
|
+
},
|
|
22667
22768
|
},
|
|
22668
22769
|
}),
|
|
22669
22770
|
draggableMixin$1,
|
|
@@ -22679,11 +22780,35 @@ const timerButton = {
|
|
|
22679
22780
|
|
|
22680
22781
|
_horizontal: {
|
|
22681
22782
|
[vars$S.flexDirection]: 'row',
|
|
22783
|
+
timerPosition: {
|
|
22784
|
+
end: {
|
|
22785
|
+
[vars$S.flexDirection]: 'row-reverse',
|
|
22786
|
+
},
|
|
22787
|
+
},
|
|
22788
|
+
},
|
|
22789
|
+
|
|
22790
|
+
timerPosition: {
|
|
22791
|
+
end: {
|
|
22792
|
+
[vars$S.flexDirection]: 'column-reverse',
|
|
22793
|
+
},
|
|
22682
22794
|
},
|
|
22683
22795
|
|
|
22684
22796
|
_fullWidth: {
|
|
22685
22797
|
[vars$S.hostWidth]: '100%',
|
|
22686
22798
|
},
|
|
22799
|
+
|
|
22800
|
+
_timerInside: {
|
|
22801
|
+
[vars$S.timerTextColor]: 'currentColor',
|
|
22802
|
+
[vars$S.timerIconColor]: 'currentColor',
|
|
22803
|
+
[vars$S.timerHostWidth]: 'auto',
|
|
22804
|
+
[vars$S.buttonLabelSpacing]: '0',
|
|
22805
|
+
[vars$S.timerInsideGapEnd]: `var(${vars$S.gap})`,
|
|
22806
|
+
timerPosition: {
|
|
22807
|
+
end: {
|
|
22808
|
+
[vars$S.timerInsideGapStart]: `var(${vars$S.gap})`,
|
|
22809
|
+
},
|
|
22810
|
+
},
|
|
22811
|
+
},
|
|
22687
22812
|
};
|
|
22688
22813
|
|
|
22689
22814
|
var timerButton$1 = /*#__PURE__*/Object.freeze({
|