UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

58 lines 3.3 kB
import { jsx as _jsx, jsxs as _jsxs } from "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/>. */ import { useState } from 'react'; import { Typography } from '../../typography'; import { DatePicker } from '../DatePicker'; export const DatePickerWithTimeZoneBothMode = () => { var _a; const [selectedDate, setSelectedDate] = useState( // Every day is Christmas in Needle :) new Date('2025-12-24')); const [selectedTimeZone, setSelectedTimeZone] = useState('America/New_York'); return (_jsxs("div", { style: { maxWidth: '400px', padding: '20px' }, children: [_jsx(Typography, { variant: "title-4", style: { marginBottom: '16px' }, children: "DatePicker with TimeZone (Both Mode)" }), _jsx(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." }), _jsx(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, } }), _jsxs("div", { style: { backgroundColor: 'var(--theme-color-neutral-bg-default)', borderRadius: '4px', display: 'flex', flexDirection: 'column', marginTop: '24px', padding: '16px', }, children: [_jsx(Typography, { variant: "label", children: "Selected Values:" }), _jsxs(Typography, { variant: "body-small", children: [_jsx("strong", { children: "Date: " }), (_a = selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.toISOString()) !== null && _a !== void 0 ? _a : 'None'] }), _jsxs(Typography, { variant: "body-small", children: [_jsx("strong", { children: "Timezone:" }), " ", selectedTimeZone || 'None'] })] })] })); }; export default DatePickerWithTimeZoneBothMode; //# sourceMappingURL=date-picker-with-timezone-both-mode.story.js.map