// Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 import { VerticalBox } from "./layouts.slint"; import { Button } from "./button.slint"; import { FluentPalette, FluentFontSettings, Icons } from "styling.slint"; import { MenuBorder } from "./components.slint"; import { Date, DatePickerBase } from "../common/datepicker_base.slint"; export { Date } export component DatePicker { in property title: "Select date"; in property cancel-text: "Cancel"; in property ok-text: "Ok"; in property date <=> base.date; in property input-title: "Enter date"; in property input-placeholder-text: "mm/dd/yyyy"; in property input-format: "%m/%d/%Y"; callback canceled(); callback accepted(/* current-date */ Date); min-width: content-layer.min-width; min-height: content-layer.min-height; background-layer := MenuBorder { } content-layer := VerticalBox { padding-left: 0; padding-right: 0; base := DatePickerBase { title: root.title; input-title: root.input-title; input-placeholder-text: root.input-placeholder-text; input-format: root.input-format; style: { border-brush: FluentPalette.border, padding: 8px, calendar-style: { spacing: 8px, delegate-style: { font-size: FluentFontSettings.body-strong.font-size, font-weight: FluentFontSettings.body-strong.font-weight, foreground: FluentPalette.foreground, state-brush: FluentPalette.state, background-selected: FluentPalette.accent-background, foreground-selected: FluentPalette.accent-foreground, state-brush-selected: FluentPalette.state-secondary, border-color-today: FluentPalette.accent-background, foreground-today: FluentPalette.accent-background, state-brush-today: FluentPalette.state, } }, icon-button-style: { foreground: FluentPalette.foreground, state-brush: FluentPalette.state, icon-size: 12px, }, current-day-style: { font-size: FluentFontSettings.title.font-size, font-weight: FluentFontSettings.title.font-weight, foreground: FluentPalette.foreground, }, title-style: { font-size: FluentFontSettings.body.font-size, font-weight: FluentFontSettings.body.font-weight, foreground: FluentPalette.foreground, }, previous-icon: Icons.arrow-back, next-icon: Icons.arrow-forward, drop-down-icon: Icons.dropdown, input-icon: Icons.edit, calendar-icon: Icons.calendar, selection-button-style: { foreground: FluentPalette.foreground, state-brush: FluentPalette.state, icon-size: 8px, font-size: FluentFontSettings.body.font-size, font-weight: FluentFontSettings.body.font-weight } }; } HorizontalLayout { spacing: 8px; padding-left: 8px; padding-right: 8px; Rectangle { } Button { text: root.cancel-text; clicked => { root.canceled(); } } Button { text: root.ok-text; enabled: base.ok-enabled(); clicked => { root.accepted(base.get-current-date()); } } } } }