|
| 1 | +import caretLeftRegular from '@phosphor-icons/core/assets/regular/caret-left.svg'; |
| 2 | +import caretRightRegular from '@phosphor-icons/core/assets/regular/caret-right.svg'; |
1 | 3 | import type { ComponentInterface, EventEmitter } from '@stencil/core'; |
2 | 4 | import { Component, Element, Event, Host, Method, Prop, State, Watch, h, writeTask } from '@stencil/core'; |
3 | 5 | import { startFocusVisible } from '@utils/focus-visible'; |
@@ -2627,19 +2629,45 @@ export class Datetime implements ComponentInterface { |
2627 | 2629 | } |
2628 | 2630 |
|
2629 | 2631 | /** |
2630 | | - * Get the next month icon from the config. |
| 2632 | + * Get the icon to use for the next icon. |
| 2633 | + * Otherwise, use the icon set in the config. |
2631 | 2634 | * If no icon is set in the config, use the default icon. |
2632 | 2635 | */ |
2633 | 2636 | get datetimeNextIcon(): string { |
2634 | | - return config.get('datetimeNextIcon', chevronForward); |
| 2637 | + // Determine the theme and map to default icons |
| 2638 | + const theme = getIonTheme(this); |
| 2639 | + const defaultIcons = { |
| 2640 | + ios: chevronForward, |
| 2641 | + ionic: caretRightRegular, |
| 2642 | + md: chevronForward, |
| 2643 | + }; |
| 2644 | + |
| 2645 | + // Get the default icon based on the theme, falling back to 'md' icon if necessary |
| 2646 | + const defaultIcon = defaultIcons[theme] || defaultIcons.md; |
| 2647 | + |
| 2648 | + // Return the configured datetime next icon or the default icon |
| 2649 | + return config.get('datetimeNextIcon', defaultIcon); |
2635 | 2650 | } |
2636 | 2651 |
|
2637 | 2652 | /** |
2638 | | - * Get the previous month icon from the config. |
| 2653 | + * Get the icon to use for the previous icon. |
| 2654 | + * Otherwise, use the icon set in the config. |
2639 | 2655 | * If no icon is set in the config, use the default icon. |
2640 | 2656 | */ |
2641 | 2657 | get datetimePreviousIcon(): string { |
2642 | | - return config.get('datetimePreviousIcon', chevronBack); |
| 2658 | + // Determine the theme and map to default icons |
| 2659 | + const theme = getIonTheme(this); |
| 2660 | + const defaultIcons = { |
| 2661 | + ios: chevronBack, |
| 2662 | + ionic: caretLeftRegular, |
| 2663 | + md: chevronBack, |
| 2664 | + }; |
| 2665 | + |
| 2666 | + // Get the default icon based on the theme, falling back to 'md' icon if necessary |
| 2667 | + const defaultIcon = defaultIcons[theme] || defaultIcons.md; |
| 2668 | + |
| 2669 | + // Return the configured datetime previous icon or the default icon |
| 2670 | + return config.get('datetimePreviousIcon', defaultIcon); |
2643 | 2671 | } |
2644 | 2672 |
|
2645 | 2673 | /** |
|
0 commit comments