|
1 | | -import caretLeftRegular from '@phosphor-icons/core/assets/regular/caret-left.svg'; |
2 | | -import caretRightRegular from '@phosphor-icons/core/assets/regular/caret-right.svg'; |
3 | 1 | import type { ComponentInterface, EventEmitter } from '@stencil/core'; |
4 | 2 | import { Component, Element, Event, Host, Method, Prop, State, Watch, h, writeTask } from '@stencil/core'; |
5 | 3 | import { startFocusVisible } from '@utils/focus-visible'; |
@@ -1519,7 +1517,7 @@ export class Datetime implements ComponentInterface { |
1519 | 1517 | * is disabled or readonly. |
1520 | 1518 | */ |
1521 | 1519 | const isButtonDisabled = disabled || readonly; |
1522 | | - const confirmFill = theme === 'ionic' ? 'solid' : undefined; |
| 1520 | + const confirmFill = theme === 'ionic' ? 'solid' : 'clear'; |
1523 | 1521 | const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null; |
1524 | 1522 | if (!hasSlottedButtons && !showDefaultButtons && !showClearButton) { |
1525 | 1523 | return; |
@@ -1547,41 +1545,41 @@ export class Datetime implements ComponentInterface { |
1547 | 1545 | }} |
1548 | 1546 | > |
1549 | 1547 | <slot name="buttons"> |
1550 | | - <ion-buttons> |
| 1548 | + {showDefaultButtons && ( |
| 1549 | + <ion-button |
| 1550 | + id="cancel-button" |
| 1551 | + fill="clear" |
| 1552 | + color={this.color} |
| 1553 | + onClick={() => this.cancel(true)} |
| 1554 | + disabled={isButtonDisabled} |
| 1555 | + > |
| 1556 | + {this.cancelText} |
| 1557 | + </ion-button> |
| 1558 | + )} |
| 1559 | + <div class="datetime-action-buttons-container"> |
| 1560 | + {showClearButton && ( |
| 1561 | + <ion-button |
| 1562 | + id="clear-button" |
| 1563 | + fill="clear" |
| 1564 | + color={this.color} |
| 1565 | + onClick={() => clearButtonClick()} |
| 1566 | + disabled={isButtonDisabled} |
| 1567 | + > |
| 1568 | + {this.clearText} |
| 1569 | + </ion-button> |
| 1570 | + )} |
1551 | 1571 | {showDefaultButtons && ( |
1552 | 1572 | <ion-button |
1553 | | - id="cancel-button" |
| 1573 | + id="confirm-button" |
| 1574 | + fill={confirmFill} |
1554 | 1575 | color={this.color} |
1555 | | - onClick={() => this.cancel(true)} |
| 1576 | + onClick={() => this.confirm(true)} |
1556 | 1577 | disabled={isButtonDisabled} |
1557 | 1578 | > |
1558 | | - {this.cancelText} |
| 1579 | + {this.doneText} |
1559 | 1580 | </ion-button> |
1560 | 1581 | )} |
1561 | | - <div class="datetime-action-buttons-container"> |
1562 | | - {showClearButton && ( |
1563 | | - <ion-button |
1564 | | - id="clear-button" |
1565 | | - color={this.color} |
1566 | | - onClick={() => clearButtonClick()} |
1567 | | - disabled={isButtonDisabled} |
1568 | | - > |
1569 | | - {this.clearText} |
1570 | | - </ion-button> |
1571 | | - )} |
1572 | | - {showDefaultButtons && ( |
1573 | | - <ion-button |
1574 | | - id="confirm-button" |
1575 | | - color={this.color} |
1576 | | - onClick={() => this.confirm(true)} |
1577 | | - disabled={isButtonDisabled} |
1578 | | - fill={confirmFill} |
1579 | | - > |
1580 | | - {this.doneText} |
1581 | | - </ion-button> |
1582 | | - )} |
1583 | | - </div> |
1584 | | - </ion-buttons> |
| 1582 | + </div> |
1585 | 1583 | </slot> |
1586 | 1584 | </div> |
1587 | 1585 | </div> |
@@ -2156,28 +2154,26 @@ export class Datetime implements ComponentInterface { |
2156 | 2154 | </div> |
2157 | 2155 |
|
2158 | 2156 | <div class="calendar-next-prev"> |
2159 | | - <ion-buttons> |
2160 | | - <ion-button aria-label="Previous month" disabled={prevMonthDisabled} onClick={() => this.prevMonth()}> |
2161 | | - <ion-icon |
2162 | | - dir={hostDir} |
2163 | | - aria-hidden="true" |
2164 | | - slot="icon-only" |
2165 | | - icon={datetimePreviousIcon} |
2166 | | - lazy={false} |
2167 | | - flipRtl |
2168 | | - ></ion-icon> |
2169 | | - </ion-button> |
2170 | | - <ion-button aria-label="Next month" disabled={nextMonthDisabled} onClick={() => this.nextMonth()}> |
2171 | | - <ion-icon |
2172 | | - dir={hostDir} |
2173 | | - aria-hidden="true" |
2174 | | - slot="icon-only" |
2175 | | - icon={datetimeNextIcon} |
2176 | | - lazy={false} |
2177 | | - flipRtl |
2178 | | - ></ion-icon> |
2179 | | - </ion-button> |
2180 | | - </ion-buttons> |
| 2157 | + <ion-button aria-label="Previous month" fill="clear" disabled={prevMonthDisabled} onClick={() => this.prevMonth()}> |
| 2158 | + <ion-icon |
| 2159 | + dir={hostDir} |
| 2160 | + aria-hidden="true" |
| 2161 | + slot="icon-only" |
| 2162 | + icon={datetimePreviousIcon} |
| 2163 | + lazy={false} |
| 2164 | + flipRtl |
| 2165 | + ></ion-icon> |
| 2166 | + </ion-button> |
| 2167 | + <ion-button aria-label="Next month" fill="clear" disabled={nextMonthDisabled} onClick={() => this.nextMonth()}> |
| 2168 | + <ion-icon |
| 2169 | + dir={hostDir} |
| 2170 | + aria-hidden="true" |
| 2171 | + slot="icon-only" |
| 2172 | + icon={datetimeNextIcon} |
| 2173 | + lazy={false} |
| 2174 | + flipRtl |
| 2175 | + ></ion-icon> |
| 2176 | + </ion-button> |
2181 | 2177 | </div> |
2182 | 2178 | </div> |
2183 | 2179 | <div class="calendar-days-of-week" aria-hidden="true"> |
@@ -2621,45 +2617,19 @@ export class Datetime implements ComponentInterface { |
2621 | 2617 | } |
2622 | 2618 |
|
2623 | 2619 | /** |
2624 | | - * Get the icon to use for the next icon. |
2625 | | - * Otherwise, use the icon set in the config. |
| 2620 | + * Get the next month icon from the config. |
2626 | 2621 | * If no icon is set in the config, use the default icon. |
2627 | 2622 | */ |
2628 | 2623 | get datetimeNextIcon(): string { |
2629 | | - // Determine the theme and map to default icons |
2630 | | - const theme = getIonTheme(this); |
2631 | | - const defaultIcons = { |
2632 | | - ios: chevronForward, |
2633 | | - ionic: caretRightRegular, |
2634 | | - md: chevronForward, |
2635 | | - }; |
2636 | | - |
2637 | | - // Get the default icon based on the theme, falling back to 'md' icon if necessary |
2638 | | - const defaultIcon = defaultIcons[theme] || defaultIcons.md; |
2639 | | - |
2640 | | - // Return the configured datetime next icon or the default icon |
2641 | | - return config.get('datetimeNextIcon', defaultIcon); |
| 2624 | + return config.get('datetimeNextIcon', chevronForward); |
2642 | 2625 | } |
2643 | 2626 |
|
2644 | 2627 | /** |
2645 | | - * Get the icon to use for the previous icon. |
2646 | | - * Otherwise, use the icon set in the config. |
| 2628 | + * Get the previous month icon from the config. |
2647 | 2629 | * If no icon is set in the config, use the default icon. |
2648 | 2630 | */ |
2649 | 2631 | get datetimePreviousIcon(): string { |
2650 | | - // Determine the theme and map to default icons |
2651 | | - const theme = getIonTheme(this); |
2652 | | - const defaultIcons = { |
2653 | | - ios: chevronBack, |
2654 | | - ionic: caretLeftRegular, |
2655 | | - md: chevronBack, |
2656 | | - }; |
2657 | | - |
2658 | | - // Get the default icon based on the theme, falling back to 'md' icon if necessary |
2659 | | - const defaultIcon = defaultIcons[theme] || defaultIcons.md; |
2660 | | - |
2661 | | - // Return the configured datetime previous icon or the default icon |
2662 | | - return config.get('datetimePreviousIcon', defaultIcon); |
| 2632 | + return config.get('datetimePreviousIcon', chevronBack); |
2663 | 2633 | } |
2664 | 2634 |
|
2665 | 2635 | /** |
|
0 commit comments