UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

62 lines 3.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DatePickerWithTimeZoneBothMode = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); /** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ const react_1 = require("react"); const typography_1 = require("../../typography"); const DatePicker_1 = require("../DatePicker"); const DatePickerWithTimeZoneBothMode = () => { var _a; const [selectedDate, setSelectedDate] = (0, react_1.useState)( // Every day is Christmas in Needle :) new Date('2025-12-24')); const [selectedTimeZone, setSelectedTimeZone] = (0, react_1.useState)('America/New_York'); return ((0, jsx_runtime_1.jsxs)("div", { style: { maxWidth: '400px', padding: '20px' }, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: "title-4", style: { marginBottom: '16px' }, children: "DatePicker with TimeZone (Both Mode)" }), (0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: "body-medium", style: { marginBottom: '24px' }, children: "This example shows the DatePicker with the TimeZonePicker in \"both\" mode, displaying both UTC offsets and city-based timezones in separate sections." }), (0, jsx_runtime_1.jsx)(DatePicker_1.DatePicker, { textInputProps: { label: 'Select Date and Time with Timezone', }, timePickerProps: { format: 'hh:mm', }, timeZonePickerProps: { mode: 'both', onChange: (tz) => { setSelectedTimeZone(tz); }, value: selectedTimeZone, }, reactDatePickerProps: { dateFormat: 'yyyy-MM-dd hh:mm', onChange: (date) => { setSelectedDate(date); }, selected: selectedDate, showTimeInput: true, } }), (0, jsx_runtime_1.jsxs)("div", { style: { backgroundColor: 'var(--theme-color-neutral-bg-default)', borderRadius: '4px', display: 'flex', flexDirection: 'column', marginTop: '24px', padding: '16px', }, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: "label", children: "Selected Values:" }), (0, jsx_runtime_1.jsxs)(typography_1.Typography, { variant: "body-small", children: [(0, jsx_runtime_1.jsx)("strong", { children: "Date: " }), (_a = selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.toISOString()) !== null && _a !== void 0 ? _a : 'None'] }), (0, jsx_runtime_1.jsxs)(typography_1.Typography, { variant: "body-small", children: [(0, jsx_runtime_1.jsx)("strong", { children: "Timezone:" }), " ", selectedTimeZone || 'None'] })] })] })); }; exports.DatePickerWithTimeZoneBothMode = DatePickerWithTimeZoneBothMode; exports.default = exports.DatePickerWithTimeZoneBothMode; //# sourceMappingURL=date-picker-with-timezone-both-mode.story.js.map