UNPKG

@tapie-kr/inspire-react

Version:

React Component Collection for INSPIRE

26 lines (22 loc) 1.48 kB
'use client'; /* eslint-disable */ /* * INSPIRE : Creative Kit * React Component Collection for INSPIRE * * This file is generated automatically. Do not modify it manually * Generated at : 2025. 3. 4. 오후 6:18:13 * @tapie-kr/inspire-react version: 0.2.15 * * (c) 2025 TAPIE. All rights reserved. * MIT License */ 'use strict'; var jsxRuntime = require('react/jsx-runtime'); var styles_css = require('./styles.css.js'); var index = require('../../miscellaneous/layout/HStack/index.js'); var index_esm = require('../../../node_modules/@js-temporal/polyfill/dist/index.esm.js'); var React = require('react'); var types = require('../../../lib/layout/types.js'); function DatetimePicker(props){const{value,onChange,...rest}=props;const inputRef=React.useRef(null);const handleOpen=()=>{inputRef.current?.showPicker?.();inputRef.current?.click();};const handleChange=event=>{const inputValue=event.target.value;if(!inputValue){onChange?.(undefined);return}try{onChange?.(index_esm.Temporal.PlainDateTime.from(inputValue));}catch{console.error("Invalid date format:",inputValue);}};return jsxRuntime.jsx(index.HStack,{fullWidth:true,tag:"label",className:styles_css.base,justify:types.StackJustify.BETWEEN,onClick:handleOpen,children:jsxRuntime.jsx("input",{ref:inputRef,className:styles_css.input,type:"datetime-local",value:value?value.toString():"",onChange:handleChange,onClick:event=>event.stopPropagation(),...rest})})} exports.DatetimePicker = DatetimePicker;