@gbmtech/aurora-ui 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/button.cjs +1 -1
- package/dist/cjs/components/button.cjs.map +1 -1
- package/dist/cjs/components/command.cjs.map +1 -1
- package/dist/cjs/components/date-picker.cjs +1 -1
- package/dist/cjs/components/date-picker.cjs.map +1 -1
- package/dist/cjs/components/input-password.cjs +1 -1
- package/dist/cjs/components/input-password.cjs.map +1 -1
- package/dist/cjs/components/input.cjs +1 -1
- package/dist/cjs/components/input.cjs.map +1 -1
- package/dist/cjs/components/mask-input.cjs.map +1 -1
- package/dist/cjs/components/time-picker-input.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/lib/utils.cjs.map +1 -1
- package/dist/cjs/primitive/input.cjs +2 -0
- package/dist/cjs/primitive/input.cjs.map +1 -0
- package/dist/cjs/utils/phosphor-icon-map.cjs.map +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.js.map +1 -1
- package/dist/esm/components/command.js.map +1 -1
- package/dist/esm/components/date-picker.js +1 -1
- package/dist/esm/components/date-picker.js.map +1 -1
- package/dist/esm/components/input-password.js +1 -1
- package/dist/esm/components/input-password.js.map +1 -1
- package/dist/esm/components/input.js +1 -1
- package/dist/esm/components/input.js.map +1 -1
- package/dist/esm/components/mask-input.js.map +1 -1
- package/dist/esm/components/time-picker-input.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/lib/utils.js.map +1 -1
- package/dist/esm/primitive/input.js +2 -0
- package/dist/esm/primitive/input.js.map +1 -0
- package/dist/esm/utils/phosphor-icon-map.js.map +1 -1
- package/dist/types/components/button.d.ts +10 -2
- package/dist/types/components/button.d.ts.map +1 -1
- package/dist/types/components/command.d.ts +1 -1
- package/dist/types/components/command.d.ts.map +1 -1
- package/dist/types/components/date-picker.d.ts +1 -2
- package/dist/types/components/date-picker.d.ts.map +1 -1
- package/dist/types/components/input-password.d.ts +5 -2
- package/dist/types/components/input-password.d.ts.map +1 -1
- package/dist/types/components/input.d.ts +37 -2
- package/dist/types/components/input.d.ts.map +1 -1
- package/dist/types/components/mask-input.d.ts +3 -2
- package/dist/types/components/mask-input.d.ts.map +1 -1
- package/dist/types/components/time-picker-input.d.ts +4 -3
- package/dist/types/components/time-picker-input.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/utils.d.ts +3 -10
- package/dist/types/lib/utils.d.ts.map +1 -1
- package/dist/types/primitive/input.d.ts +66 -0
- package/dist/types/primitive/input.d.ts.map +1 -0
- package/package.json +2 -1
- package/dist/cjs/components/ui/time-picker-input.cjs +0 -3
- package/dist/cjs/components/ui/time-picker-input.cjs.map +0 -1
- package/dist/cjs/components/ui/time-picker.cjs +0 -3
- package/dist/cjs/components/ui/time-picker.cjs.map +0 -1
- package/dist/esm/components/ui/time-picker-input.js +0 -3
- package/dist/esm/components/ui/time-picker-input.js.map +0 -1
- package/dist/esm/components/ui/time-picker.js +0 -3
- package/dist/esm/components/ui/time-picker.js.map +0 -1
- package/dist/types/components/ui/time-picker-input.d.ts +0 -12
- package/dist/types/components/ui/time-picker.d.ts +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\input-password.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/input-password.tsx"],"sourcesContent":["\r\n\r\nimport { Eye, EyeSlash } from '@phosphor-icons/react/dist/ssr'\r\nimport {
|
|
1
|
+
{"version":3,"file":"components\\input-password.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/input-password.tsx"],"sourcesContent":["\r\n\r\nimport { Eye, EyeSlash } from '@phosphor-icons/react/dist/ssr'\r\nimport {\r\n ComponentProps,\r\n JSX,\r\n MouseEventHandler,\r\n useCallback,\r\n useState,\r\n} from 'react'\r\n\r\nimport * as InputPrimitive from '@/primitive/input'\r\n\r\nimport { Spinner } from '@/components/spinner'\r\nimport { VariantProps } from '../lib/utils'\r\nimport { Button } from './button'\r\nimport { inputVariants } from './input'\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Variant: InputPassword\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst { input, root } = inputVariants()\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: InputPassword\r\n * -------------------------------------------------------------------------- */\r\n\r\nfunction InputPassword({\r\n className,\r\n disabled,\r\n loaderPosition,\r\n loading,\r\n prefix,\r\n readOnly,\r\n spinner,\r\n suffix,\r\n ...props\r\n}: ComponentProps<typeof InputPrimitive.Root> &\r\n Omit<ComponentProps<typeof InputPrimitive.Field>, 'prefix' | 'type'> &\r\n VariantProps<typeof inputVariants>): JSX.Element {\r\n const [type, setType] = useState<'password' | 'text'>('password')\r\n\r\n const togglePasswordVisibility = useCallback<\r\n MouseEventHandler<HTMLButtonElement>\r\n >(() => {\r\n setType(prev => (prev === 'password' ? 'text' : 'password'))\r\n }, [])\r\n\r\n return (\r\n <InputPrimitive.Root\r\n className={root({ className: [!suffix && 'pr-1.5', className] })}\r\n data-slot=\"input-password\"\r\n disabled={disabled}\r\n loaderPosition={loaderPosition}\r\n loading={loading}\r\n prefix={prefix}\r\n readOnly={readOnly}\r\n spinner={spinner || <Spinner />}\r\n suffix={suffix}\r\n >\r\n <InputPrimitive.Field\r\n autoCapitalize=\"none\"\r\n className={input()}\r\n data-slot=\"input-password-item\"\r\n type={type}\r\n {...props}\r\n />\r\n <Button\r\n aria-label={type === 'password' ? 'Show password' : 'Hide password'}\r\n className=\"size-7 rounded-full focus-visible:not-disabled:bg-input focus-visible:ring-0\"\r\n data-slot=\"input-password-toggle\"\r\n disabled={disabled}\r\n prefix={type === 'password' ? <EyeSlash /> : <Eye />}\r\n size=\"icon\"\r\n variant=\"ghost\"\r\n onClick={togglePasswordVisibility}\r\n />\r\n </InputPrimitive.Root>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Exports\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport { InputPassword }\r\n"],"names":["input","root","inputVariants","InputPassword","className","disabled","loaderPosition","loading","prefix","readOnly","spinner","suffix","props","type","setType","useState","togglePasswordVisibility","useCallback","prev","InputPrimitive","Spinner","Button","EyeSlash","Eye"],"mappings":";+OAsBA,GAAM,CAAEA,MAAAA,CAAK,CAAEC,KAAAA,CAAI,CAAE,CAAGC,GAAAA,EAAAA,aAAAA,IAMxB,SAASC,EAAc,CACrBC,UAAAA,CAAS,CACTC,SAAAA,CAAQ,CACRC,eAAAA,CAAc,CACdC,QAAAA,CAAO,CACPC,OAAAA,CAAM,CACNC,SAAAA,CAAQ,CACRC,QAAAA,CAAO,CACPC,OAAAA,CAAM,CACN,GAAGC,EAG+B,EAClC,GAAM,CAACC,EAAMC,EAAQ,CAAGC,GAAAA,EAAAA,QAAAA,EAA8B,YAEhDC,EAA2BC,GAAAA,EAAAA,WAAAA,EAE/B,KACAH,EAAQI,GAASA,aAAAA,EAAsB,OAAS,WAClD,EAAG,EAAE,EAEL,MACE,WAACC,EAAAA,IAAmB,EAClB,UAAWlB,EAAK,CAAE,UAAW,CAAC,CAACU,GAAU,SAAUP,EAAU,GAC7D,YAAU,iBACV,SAAUC,EACV,eAAgBC,EAChB,QAASC,EACT,OAAQC,EACR,SAAUC,EACV,QAASC,GAAW,UAACU,EAAAA,OAAOA,CAAAA,CAAAA,GAC5B,OAAQT,E,UAER,UAACQ,EAAAA,KAAoB,EACnB,eAAe,OACf,UAAWnB,IACX,YAAU,sBACV,KAAMa,EACL,GAAGD,CAAK,GAEX,UAACS,EAAAA,MAAMA,CAAAA,CACL,aAAYR,aAAAA,EAAsB,gBAAkB,gBACpD,UAAU,+EACV,YAAU,wBACV,SAAUR,EACV,OAAQQ,aAAAA,EAAsB,UAACS,EAAAA,QAAQA,CAAAA,CAAAA,GAAM,UAACC,EAAAA,GAAGA,CAAAA,CAAAA,GACjD,KAAK,OACL,QAAQ,QACR,QAASP,C,KAIjB,Q"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import*as
|
|
2
|
+
import*as t from"react/jsx-runtime";import*as i from"../lib/utils.js";import*as e from"../primitive/input.js";import*as n from"./spinner.js";let r=(0,i.tv)({slots:{root:"flex h-12 w-full items-center gap-4 rounded-md border border-zinc-200 bg-background px-4 ring-offset-background placeholder:text-zinc-400 focus-within:outline-none focus-within:ring-2 focus-within:ring-gbm-sky focus-within:ring-offset-2 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",input:"peer h-full w-full flex-1 overflow-hidden bg-transparent text-base outline-none placeholder:text-zinc-400"}}),{input:o,root:s}=r();function a({className:i,disabled:r,loaderPosition:a,loading:l,prefix:d,readOnly:u,spinner:p,suffix:f,...c}){return(0,t.jsx)(e.Root,{className:s({className:i}),"data-slot":"input",disabled:r,loaderPosition:a,loading:l,prefix:d,readOnly:u,spinner:p||(0,t.jsx)(n.Spinner,{}),suffix:f,children:(0,t.jsx)(e.Field,{className:o(),"data-slot":"input-item",...c})})}export{a as Input,r as inputVariants};
|
|
3
3
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/input.tsx"],"sourcesContent":["\r\n\r\nimport { ComponentProps, JSX, ReactNode } from 'react'\r\n\r\nimport {
|
|
1
|
+
{"version":3,"file":"components\\input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/input.tsx"],"sourcesContent":["\r\n\r\nimport { ComponentProps, JSX, ReactNode } from 'react'\r\n\r\nimport { VariantProps, tv } from '@/lib/utils'\r\nimport * as InputPrimitive from '@/primitive/input'\r\nimport { Spinner } from './spinner'\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Variant: Input\r\n * -------------------------------------------------------------------------- */\r\n\r\nconst inputVariants = tv({\r\n slots: {\r\n root: 'flex h-12 w-full items-center gap-4 rounded-md border border-zinc-200 bg-background px-4 ring-offset-background placeholder:text-zinc-400 focus-within:outline-none focus-within:ring-2 focus-within:ring-gbm-sky focus-within:ring-offset-2 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',\r\n input:\r\n 'peer h-full w-full flex-1 overflow-hidden bg-transparent text-base outline-none placeholder:text-zinc-400',\r\n },\r\n})\r\n\r\nconst { input, root } = inputVariants()\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: Input\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport type InputProps = Omit<ComponentProps<'input'>, 'prefix'> & {\r\n prefix?: ReactNode\r\n suffix?: ReactNode\r\n inputClassName?: string\r\n loaderPosition?: 'prefix' | 'suffix'\r\n loading?: boolean\r\n spinner?: ReactNode\r\n}\r\n\r\nfunction Input({\r\n className,\r\n disabled,\r\n loaderPosition,\r\n loading,\r\n prefix,\r\n readOnly,\r\n spinner,\r\n suffix,\r\n ...props\r\n}: ComponentProps<typeof InputPrimitive.Root> &\r\n Omit<ComponentProps<typeof InputPrimitive.Field>, 'prefix' | 'type'> &\r\n VariantProps<typeof inputVariants> & {\r\n type?:\r\n | 'date'\r\n | 'datetime-local'\r\n | 'email'\r\n | 'file'\r\n | 'month'\r\n | 'number'\r\n | 'password'\r\n | 'search'\r\n | 'tel'\r\n | 'text'\r\n | 'time'\r\n | 'url'\r\n | 'week'\r\n }): JSX.Element {\r\n return (\r\n <InputPrimitive.Root\r\n className={root({ className })}\r\n data-slot=\"input\"\r\n disabled={disabled}\r\n loaderPosition={loaderPosition}\r\n loading={loading}\r\n prefix={prefix}\r\n readOnly={readOnly}\r\n spinner={spinner || <Spinner />}\r\n suffix={suffix}\r\n >\r\n <InputPrimitive.Field\r\n className={input()}\r\n data-slot=\"input-item\"\r\n {...props}\r\n />\r\n </InputPrimitive.Root>\r\n )\r\n}\r\n\r\nexport { Input, inputVariants }\r\n"],"names":["inputVariants","tv","input","root","Input","className","disabled","loaderPosition","loading","prefix","readOnly","spinner","suffix","props","InputPrimitive","Spinner"],"mappings":";6IAYA,IAAMA,EAAgBC,GAAAA,EAAAA,EAAAA,EAAG,CACvB,MAAO,CACL,KAAM,uTACN,MACE,2GACJ,CACF,GAEM,CAAEC,MAAAA,CAAK,CAAEC,KAAAA,CAAI,CAAE,CAAGH,IAexB,SAASI,EAAM,CACbC,UAAAA,CAAS,CACTC,SAAAA,CAAQ,CACRC,eAAAA,CAAc,CACdC,QAAAA,CAAO,CACPC,OAAAA,CAAM,CACNC,SAAAA,CAAQ,CACRC,QAAAA,CAAO,CACPC,OAAAA,CAAM,CACN,GAAGC,EAkBF,EACD,MACE,UAACC,EAAAA,IAAmB,EAClB,UAAWX,EAAK,CAAEE,UAAAA,CAAU,GAC5B,YAAU,QACV,SAAUC,EACV,eAAgBC,EAChB,QAASC,EACT,OAAQC,EACR,SAAUC,EACV,QAASC,GAAW,UAACI,EAAAA,OAAOA,CAAAA,CAAAA,GAC5B,OAAQH,E,SAER,UAACE,EAAAA,KAAoB,EACnB,UAAWZ,IACX,YAAU,aACT,GAAGW,CAAK,IAIjB,Q"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\mask-input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/mask-input.tsx"],"sourcesContent":["\r\n\r\nimport {
|
|
1
|
+
{"version":3,"file":"components\\mask-input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/mask-input.tsx"],"sourcesContent":["\r\n\r\nimport { ComponentProps, useEffect, useState } from 'react'\r\n\r\nimport { cn } from '@/lib/utils'\r\nimport { Input } from './input'\r\n\r\ninterface MaskInputProps\r\n extends Omit<ComponentProps<typeof Input>, 'value' | 'onChange'> {\r\n value: number | undefined\r\n onChange: (value: number) => void\r\n decimals?: number\r\n}\r\n\r\nfunction MaskInput({\r\n value,\r\n onChange,\r\n decimals = 3,\r\n className,\r\n ...rest\r\n}: MaskInputProps) {\r\n const scale = 10 ** decimals\r\n const [rawDigits, setRawDigits] = useState('')\r\n\r\n useEffect(() => {\r\n if (typeof value === 'number' && !Number.isNaN(value)) {\r\n const digits = Math.round(value * scale).toString()\r\n setRawDigits(digits)\r\n }\r\n }, [value, scale])\r\n\r\n function formatToMaskedValue(digits: string) {\r\n const number = Number(digits) / scale\r\n\r\n return new Intl.NumberFormat('pt-BR', {\r\n style: 'decimal',\r\n minimumFractionDigits: decimals,\r\n maximumFractionDigits: decimals,\r\n }).format(number)\r\n }\r\n\r\n function handleChange(e: React.ChangeEvent<HTMLInputElement>) {\r\n const input = e.target.value\r\n const digitsOnly = input.replace(/\\D/g, '')\r\n\r\n const parsed = Number(digitsOnly) / scale\r\n\r\n setRawDigits(digitsOnly)\r\n onChange(parsed)\r\n }\r\n\r\n return (\r\n <Input\r\n value={formatToMaskedValue(rawDigits)}\r\n onChange={handleChange}\r\n className={cn('h-12', className)}\r\n {...rest}\r\n />\r\n )\r\n}\r\n\r\nexport { MaskInput }\r\n"],"names":["MaskInput","value","onChange","decimals","className","rest","scale","rawDigits","setRawDigits","useState","useEffect","Number","Math","Input","formatToMaskedValue","digits","number","Intl","e","digitsOnly","input","parsed","cn"],"mappings":";2HAcA,SAASA,EAAU,CACjBC,MAAAA,CAAK,CACLC,SAAAA,CAAQ,CACRC,SAAAA,EAAW,CAAC,CACZC,UAAAA,CAAS,CACT,GAAGC,EACY,EACf,IAAMC,EAAQ,IAAMH,EACd,CAACI,EAAWC,EAAa,CAAGC,GAAAA,EAAAA,QAAAA,EAAS,UAE3CC,GAAAA,EAAAA,SAAAA,EAAU,KACa,UAAjB,OAAOT,GAAuBU,OAAO,KAAK,CAACV,IAE7CO,EADeI,KAAK,KAAK,CAACX,EAAQK,GAAO,QAAQ,GAGrD,EAAG,CAACL,EAAOK,EAAM,EAuBf,UAACO,EAAAA,KAAKA,CAAAA,CACJ,MAAOC,SAtBkBC,CAAc,EACzC,IAAMC,EAASL,OAAOI,GAAUT,EAEhC,OAAO,IAAIW,KAAK,YAAY,CAAC,QAAS,CACpC,MAAO,UACP,sBAAuBd,EACvB,sBAAuBA,CACzB,GAAG,MAAM,CAACa,EACZ,EAc+BT,GAC3B,SAbJ,SAAsBW,CAAsC,EAE1D,IAAMC,EAAaC,EADH,MAAM,CAAC,KAAK,CACH,OAAO,CAAC,MAAO,IAElCC,EAASV,OAAOQ,GAAcb,EAEpCE,EAAaW,GACbjB,EAASmB,EACX,EAMI,UAAWC,GAAAA,EAAAA,EAAAA,EAAG,OAAQlB,GACrB,GAAGC,CAAI,EAGd,Q"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\time-picker-input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/time-picker-input.tsx"],"sourcesContent":["\r\n\r\nimport React from 'react'\r\n\r\nimport { cn } from '../lib/utils'\r\nimport {\r\n TimePickerType,\r\n getArrowByType,\r\n getDateByType,\r\n setDateByType,\r\n} from '../utils/time-picker'\r\n\r\nimport { Input } from './input'\r\n\r\nexport interface TimePickerInputProps
|
|
1
|
+
{"version":3,"file":"components\\time-picker-input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/time-picker-input.tsx"],"sourcesContent":["\r\n\r\nimport React, { ComponentProps } from 'react'\r\n\r\nimport { cn } from '../lib/utils'\r\nimport {\r\n TimePickerType,\r\n getArrowByType,\r\n getDateByType,\r\n setDateByType,\r\n} from '../utils/time-picker'\r\n\r\nimport { Input } from './input'\r\n\r\nexport interface TimePickerInputProps extends ComponentProps<typeof Input> {\r\n picker: TimePickerType\r\n date: Date | undefined\r\n setDate: (date: Date | undefined) => void\r\n onRightFocus?: () => void\r\n onLeftFocus?: () => void\r\n}\r\n\r\nconst TimePickerInput = React.forwardRef<\r\n HTMLInputElement,\r\n TimePickerInputProps\r\n>(\r\n (\r\n {\r\n className,\r\n type = 'tel',\r\n value,\r\n id,\r\n name,\r\n date = new Date(new Date().setHours(0, 0, 0, 0)),\r\n setDate,\r\n onChange,\r\n onKeyDown,\r\n picker,\r\n onLeftFocus,\r\n onRightFocus,\r\n ...props\r\n },\r\n ref\r\n ) => {\r\n const [flag, setFlag] = React.useState<boolean>(false)\r\n\r\n React.useEffect(() => {\r\n if (flag) {\r\n const timer = setTimeout(() => {\r\n setFlag(false)\r\n }, 2000)\r\n\r\n return () => clearTimeout(timer)\r\n }\r\n }, [flag])\r\n\r\n const calculatedValue = React.useMemo(\r\n () => getDateByType(date, picker),\r\n [date, picker]\r\n )\r\n\r\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (e.key === 'Tab') return\r\n e.preventDefault()\r\n if (e.key === 'ArrowRight') onRightFocus?.()\r\n if (e.key === 'ArrowLeft') onLeftFocus?.()\r\n if (['ArrowUp', 'ArrowDown'].includes(e.key)) {\r\n const step = e.key === 'ArrowUp' ? 1 : -1\r\n const newValue = getArrowByType(calculatedValue, step, picker)\r\n if (flag) setFlag(false)\r\n const tempDate = new Date(date)\r\n setDate(setDateByType(tempDate, newValue, picker))\r\n }\r\n if (e.key >= '0' && e.key <= '9') {\r\n const newValue = !flag\r\n ? '0' + e.key\r\n : calculatedValue.slice(1, 2) + e.key\r\n if (flag) onRightFocus?.()\r\n setFlag(prev => !prev)\r\n const tempDate = new Date(date)\r\n setDate(setDateByType(tempDate, newValue, picker))\r\n }\r\n }\r\n\r\n return (\r\n <Input\r\n ref={ref}\r\n id={id || picker}\r\n name={name || picker}\r\n className={cn(\r\n 'w-[52px] text-center font-mono tabular-nums caret-transparent [&::-webkit-inner-spin-button]:appearance-none',\r\n className\r\n )}\r\n value={value || calculatedValue}\r\n onChange={e => {\r\n e.preventDefault()\r\n onChange?.(e)\r\n }}\r\n type={type}\r\n inputMode=\"decimal\"\r\n onKeyDown={e => {\r\n onKeyDown?.(e)\r\n handleKeyDown(e)\r\n }}\r\n {...props}\r\n />\r\n )\r\n }\r\n)\r\n\r\nTimePickerInput.displayName = 'TimePickerInput'\r\n\r\nexport { TimePickerInput }\r\n"],"names":["TimePickerInput","React","className","type","value","id","name","date","Date","setDate","onChange","onKeyDown","picker","onLeftFocus","onRightFocus","props","ref","flag","setFlag","timer","setTimeout","clearTimeout","calculatedValue","getDateByType","handleKeyDown","e","step","newValue","getArrowByType","tempDate","setDateByType","prev","Input","cn"],"mappings":";qKAsBA,IAAMA,EAAkBC,EAAAA,OAAAA,CAAAA,UAAgB,CAItC,CACE,CACEC,UAAAA,CAAS,CACTC,KAAAA,EAAO,KAAK,CACZC,MAAAA,CAAK,CACLC,GAAAA,CAAE,CACFC,KAAAA,CAAI,CACJC,KAAAA,EAAO,IAAIC,KAAK,IAAIA,OAAO,QAAQ,CAAC,EAAG,EAAG,EAAG,GAAG,CAChDC,QAAAA,CAAO,CACPC,SAAAA,CAAQ,CACRC,UAAAA,CAAS,CACTC,OAAAA,CAAM,CACNC,YAAAA,CAAW,CACXC,aAAAA,CAAY,CACZ,GAAGC,EACJ,CACDC,KAEA,GAAM,CAACC,EAAMC,EAAQ,CAAGjB,EAAAA,OAAAA,CAAAA,QAAc,CAAU,IAEhDA,EAAAA,OAAAA,CAAAA,SAAe,CAAC,KACd,GAAIgB,EAAM,CACR,IAAME,EAAQC,WAAW,KACvBF,EAAQ,GACV,EAAG,KAEH,MAAO,IAAMG,aAAaF,EAC5B,CACF,EAAG,CAACF,EAAK,EAET,IAAMK,EAAkBrB,EAAAA,OAAAA,CAAAA,OAAa,CACnC,IAAMsB,GAAAA,EAAAA,aAAAA,EAAchB,EAAMK,GAC1B,CAACL,EAAMK,EAAO,EAGVY,EAAgB,IACpB,GAAIC,QAAAA,EAAE,GAAG,EAIT,GAHAA,EAAE,cAAc,GACZA,eAAAA,EAAE,GAAG,EAAmBX,MACxBW,cAAAA,EAAE,GAAG,EAAkBZ,MACvB,CAAC,UAAW,YAAY,CAAC,QAAQ,CAACY,EAAE,GAAG,EAAG,CAC5C,IAAMC,EAAOD,YAAAA,EAAE,GAAG,CAAiB,EAAI,GACjCE,EAAWC,GAAAA,EAAAA,cAAAA,EAAeN,EAAiBI,EAAMd,EACnDK,CAAAA,GAAMC,EAAQ,IAClB,IAAMW,EAAW,IAAIrB,KAAKD,GAC1BE,EAAQqB,GAAAA,EAAAA,aAAAA,EAAcD,EAAUF,EAAUf,GAC5C,CACA,GAAIa,EAAE,GAAG,EAAI,KAAOA,EAAE,GAAG,EAAI,IAAK,CAChC,IAAME,EAAW,EAEbL,EAAgB,KAAK,CAAC,EAAG,GAAKG,EAAE,GAAG,CADnC,IAAMA,EAAE,GAAG,CAEXR,GAAMH,MACVI,EAAQa,GAAQ,CAACA,GACjB,IAAMF,EAAW,IAAIrB,KAAKD,GAC1BE,EAAQqB,GAAAA,EAAAA,aAAAA,EAAcD,EAAUF,EAAUf,GAC5C,EACF,EAEA,MACE,UAACoB,EAAAA,KAAKA,CAAAA,CACJ,IAAKhB,EACL,GAAIX,GAAMO,EACV,KAAMN,GAAQM,EACd,UAAWqB,GAAAA,EAAAA,EAAAA,EACT,+GACA/B,GAEF,MAAOE,GAASkB,EAChB,SAAUG,IACRA,EAAE,cAAc,GAChBf,IAAWe,EACb,EACA,KAAMtB,EACN,UAAU,UACV,UAAWsB,IACTd,IAAYc,GACZD,EAAcC,EAChB,EACC,GAAGV,CAAK,EAGf,EAGFf,CAAAA,EAAgB,WAAW,CAAG,yB"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./components/alert-dialog.js";export*from"./components/dialog.js";export*from"./components/button.js";export*from"./components/input-password.js";export*from"./components/input.js";export*from"./components/tokens-grid.js";export*from"./components/tooltip.js";export*from"./components/switch.js";export*from"./components/label.js";export*from"./components/checkbox.js";export*from"./components/breadcrumb.js";export*from"./components/tabs/index.js";export*from"./components/form.js";export*from"./components/dropdown-menu.js";export*from"./components/multi-select.js";export*from"./components/select.js";export*from"./components/table.js";export*from"./components/table-expandable.js";export*from"./components/textarea.js";export*from"./components/calendar.js";export*from"./components/date-picker.js";export*from"./components/date-picker-with-range.js";export*from"./components/date-picker-with-time.js";export*from"./components/date-time-picker-with-range.js";export*from"./components/title.js";export*from"./components/page-layout/index.js";export*from"./components/pagination.js";export*from"./components/skeleton.js";export*from"./components/separator.js";export*from"./components/input-otp.js";export*from"./components/combobox.js";export*from"./components/mask-input.js";export*from"./components/scroll-area.js";export*from"./utils/phosphor-icon-map.js";
|
|
1
|
+
export*from"./components/alert-dialog.js";export*from"./components/dialog.js";export*from"./components/button.js";export*from"./components/input-password.js";export*from"./components/input.js";export*from"./components/tokens-grid.js";export*from"./components/tooltip.js";export*from"./components/switch.js";export*from"./components/label.js";export*from"./components/checkbox.js";export*from"./components/breadcrumb.js";export*from"./components/tabs/index.js";export*from"./components/form.js";export*from"./components/dropdown-menu.js";export*from"./components/multi-select.js";export*from"./components/select.js";export*from"./components/table.js";export*from"./components/table-expandable.js";export*from"./components/textarea.js";export*from"./components/calendar.js";export*from"./components/date-picker.js";export*from"./components/date-picker-with-range.js";export*from"./components/date-picker-with-time.js";export*from"./components/date-time-picker-with-range.js";export*from"./components/title.js";export*from"./components/page-layout/index.js";export*from"./components/pagination.js";export*from"./components/skeleton.js";export*from"./components/separator.js";export*from"./components/input-otp.js";export*from"./components/combobox.js";export*from"./components/mask-input.js";export*from"./components/scroll-area.js";export*from"./utils/phosphor-icon-map.js";export*from"./lib/utils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib\\utils.js","sources":["webpack://@gbmtech/aurora-ui/./src/lib/utils.ts"],"sourcesContent":["import type { ClassValue } from
|
|
1
|
+
{"version":3,"file":"lib\\utils.js","sources":["webpack://@gbmtech/aurora-ui/./src/lib/utils.ts"],"sourcesContent":["import type { ClassValue } from 'clsx'\r\n\r\nimport { clsx } from 'clsx'\r\nimport { twMerge } from 'tailwind-merge'\r\n\r\nexport function cn(...inputs: ClassValue[]): string {\r\n return twMerge(clsx(inputs))\r\n}\r\n\r\nexport type { VariantProps } from 'tailwind-variants'\r\nexport { tv } from 'tailwind-variants'\r\n"],"names":["cn","inputs","twMerge","clsx"],"mappings":"4FAKO,SAASA,EAAG,GAAGC,CAAoB,EACxC,MAAOC,AAAAA,GAAAA,EAAAA,OAAAA,AAAAA,EAAQC,AAAAA,GAAAA,EAAAA,IAAAA,AAAAA,EAAKF,GACtB,C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as e from"react/jsx-runtime";import*as t from"@radix-ui/react-compose-refs";import*as r from"@radix-ui/react-context";import*as i from"react";let n="Input",[o,a]=(0,r.createContextScope)(n),[u,p]=o(n);function s(t){let{__scopeInput:r,children:n,disabled:o,loaderPosition:a="prefix",loading:p,prefix:s,readOnly:d,spinner:l,suffix:c,...f}=t,m=(0,i.useRef)(null);return(0,e.jsx)(u,{disabled:o,inputRef:m,readOnly:d,scope:r,children:(0,e.jsxs)("div",{"data-disabled":o,"data-readonly":d,role:"presentation",onPointerDown:e=>{let t=e.target;if("input"===t.tagName.toLowerCase()||t.closest("input, a"))return void e.stopPropagation();let r=m.current;if(r){if(document.activeElement===r)return void e.preventDefault();requestAnimationFrame(()=>{if("file"===r.type)return void r.click();document.activeElement!==r&&r.focus()})}},...f,children:[p&&"prefix"===a?l:s,n,p&&"suffix"===a?l:c]})})}function d({__scopeInput:r,...i}){let{disabled:n,inputRef:o,readOnly:a}=p("InputField",r),u=(0,t.useComposedRefs)(o);return(0,e.jsx)("input",{ref:u,disabled:n,readOnly:a,type:"text",...i})}export{d as Field,s as Input,d as InputField,s as Root,a as createInputScope};
|
|
2
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitive\\input.js","sources":["webpack://@gbmtech/aurora-ui/./src/primitive/input.tsx"],"sourcesContent":["import type { Scope } from '@radix-ui/react-context'\nimport type {\n ComponentProps,\n JSX,\n PointerEventHandler,\n PropsWithChildren,\n ReactNode,\n RefObject,\n} from 'react'\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs'\nimport { createContextScope } from '@radix-ui/react-context'\nimport { useRef } from 'react'\n\n/* -----------------------------------------------------------------------------\n * Component: Input\n * -------------------------------------------------------------------------- */\n\nconst INPUT_NAME = 'Input'\n\n/**\n * Type for adding scope to component props\n */\ntype ScopedProps<P> = P & {\n /**\n * Scope for the Input component context\n */\n __scopeInput?: Scope\n}\n\nconst [createInputContext, createInputScope] = createContextScope(INPUT_NAME)\n\n/**\n * Context value for the Input component\n */\ninterface InputContextValue {\n /**\n * Reference to the input element\n */\n inputRef: RefObject<HTMLInputElement | null>\n\n /**\n * Whether the input is disabled\n */\n disabled?: boolean\n\n /**\n * Whether the input is in read-only mode\n */\n readOnly?: boolean\n}\n\nconst [InputContextProvider, useInputContext] =\n createInputContext<InputContextValue>(INPUT_NAME)\n\n/**\n * Props for styling and appearance of the Input component\n */\ninterface InputVisualProps {\n /**\n * CSS class name for the input container\n */\n className?: string\n\n /**\n * Element to display before the input\n */\n prefix?: ReactNode\n\n /**\n * Custom spinner element for loading state\n */\n spinner?: ReactNode\n\n /**\n * Element to display after the input\n */\n suffix?: ReactNode\n}\n\n/**\n * Props for the behavior and state of the Input component\n */\ninterface InputBehaviorProps {\n /**\n * Whether the input is disabled\n */\n disabled?: boolean\n\n /**\n * Position of the loading spinner - either before or after the input\n */\n loaderPosition?: 'prefix' | 'suffix'\n\n /**\n * Whether the input is in the loading state\n */\n loading?: boolean\n\n /**\n * Whether the input is in read-only mode\n */\n readOnly?: boolean\n}\n\n/**\n * Combined props for the Input component\n */\ntype InputProps = PropsWithChildren<InputBehaviorProps & InputVisualProps>\n\nfunction Input(inputProps: ScopedProps<InputProps>): JSX.Element {\n const {\n __scopeInput,\n children,\n disabled,\n loaderPosition = 'prefix',\n loading,\n prefix,\n readOnly,\n spinner,\n suffix,\n ...props\n } = inputProps\n\n /**\n * Reference to the input element\n */\n const inputRef = useRef<HTMLInputElement>(null)\n\n /**\n * Handles pointer down events on the input container\n * Focuses the input element when clicking on the container\n *\n * @param event - The pointer event object\n */\n const handlePointerDown: PointerEventHandler<HTMLDivElement> = event => {\n const target = event.target as HTMLElement\n\n // Skip handling when clicking directly on input or links\n // This prevents interference with native input/link behavior\n if (\n target.tagName.toLowerCase() === 'input' ||\n target.closest('input, a')\n ) {\n event.stopPropagation()\n\n return\n }\n\n const inputElement = inputRef.current\n\n if (!inputElement) {\n return\n }\n\n // Key solution: If input already has focus, only prevent default behavior\n // This prevents the focus from being lost when clicking on the container padding\n // and eliminates the flickering effect\n if (document.activeElement === inputElement) {\n event.preventDefault()\n\n return\n }\n\n // Only attempt to focus the input if it's not already focused\n requestAnimationFrame(() => {\n // Special handling for file inputs - trigger the file selection dialog\n if (inputElement.type === 'file') {\n inputElement.click()\n\n return\n }\n\n // Only focus the input if it doesn't already have focus\n // This avoids unnecessary re-focusing which can cause UI flickers\n if (document.activeElement !== inputElement) {\n inputElement.focus()\n }\n })\n }\n\n return (\n <InputContextProvider\n disabled={disabled}\n inputRef={inputRef}\n readOnly={readOnly}\n scope={__scopeInput}\n >\n <div\n data-disabled={disabled}\n data-readonly={readOnly}\n role=\"presentation\"\n onPointerDown={handlePointerDown}\n {...props}\n >\n {loading && loaderPosition === 'prefix' ? spinner : prefix}\n {children}\n {loading && loaderPosition === 'suffix' ? spinner : suffix}\n </div>\n </InputContextProvider>\n )\n}\n\n/* -----------------------------------------------------------------------------\n * Component: InputField\n * -------------------------------------------------------------------------- */\n\nconst INPUT_FIELD_NAME = 'InputField'\n\n/**\n * Props for the InputField component\n */\ntype InputFieldProps = ComponentProps<'input'>\n\nfunction InputField({\n __scopeInput,\n ...props\n}: ScopedProps<InputFieldProps>): JSX.Element {\n /**\n * Context values from parent Input component\n */\n const { disabled, inputRef, readOnly } = useInputContext(\n INPUT_FIELD_NAME,\n __scopeInput\n )\n\n /**\n * Combined ref that syncs with the parent's inputRef\n */\n const composedInputRef = useComposedRefs(inputRef)\n\n return (\n <input\n ref={composedInputRef}\n disabled={disabled}\n readOnly={readOnly}\n type=\"text\"\n {...props}\n />\n )\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n createInputScope,\n InputField as Field,\n Input,\n InputField,\n Input as Root,\n}\n"],"names":["INPUT_NAME","createInputContext","createInputScope","createContextScope","InputContextProvider","useInputContext","Input","inputProps","__scopeInput","children","disabled","loaderPosition","loading","prefix","readOnly","spinner","suffix","props","inputRef","useRef","event","target","inputElement","document","requestAnimationFrame","InputField","composedInputRef","useComposedRefs"],"mappings":"qJAkBA,IAAMA,EAAa,QAYb,CAACC,EAAoBC,EAAiB,CAAGC,AAAAA,GAAAA,EAAAA,kBAAAA,AAAAA,EAAmBH,GAsB5D,CAACI,EAAsBC,EAAgB,CAC3CJ,EAAsCD,GAyDxC,SAASM,EAAMC,CAAmC,EAChD,GAAM,CACJC,aAAAA,CAAY,CACZC,SAAAA,CAAQ,CACRC,SAAAA,CAAQ,CACRC,eAAAA,EAAiB,QAAQ,CACzBC,QAAAA,CAAO,CACPC,OAAAA,CAAM,CACNC,SAAAA,CAAQ,CACRC,QAAAA,CAAO,CACPC,OAAAA,CAAM,CACN,GAAGC,EACJ,CAAGV,EAKEW,EAAWC,AAAAA,GAAAA,EAAAA,MAAAA,AAAAA,EAAyB,MAsD1C,MACE,UAACf,EAAAA,CACC,SAAUM,EACV,SAAUQ,EACV,SAAUJ,EACV,MAAON,E,SAEP,WAAC,OACC,gBAAeE,EACf,gBAAeI,EACf,KAAK,eACL,cAzDyDM,AAAAA,IAC7D,IAAMC,EAASD,EAAM,MAAM,CAI3B,GACEC,AAAiC,UAAjCA,EAAO,OAAO,CAAC,WAAW,IAC1BA,EAAO,OAAO,CAAC,YACf,YACAD,EAAM,eAAe,GAKvB,IAAME,EAAeJ,EAAS,OAAO,CAErC,GAAKI,GAOL,GAAIC,SAAS,aAAa,GAAKD,EAAc,YAC3CF,EAAM,cAAc,GAMtBI,sBAAsB,KAEpB,GAAIF,AAAsB,SAAtBA,EAAa,IAAI,CAAa,YAChCA,EAAa,KAAK,EAOhBC,CAAAA,SAAS,aAAa,GAAKD,GAC7BA,EAAa,KAAK,EAEtB,GACF,EAcO,GAAGL,CAAK,C,UAERL,GAAWD,AAAmB,WAAnBA,EAA8BI,EAAUF,EACnDJ,EACAG,GAAWD,AAAmB,WAAnBA,EAA8BI,EAAUC,E,IAI5D,CAaA,SAASS,EAAW,CAClBjB,aAAAA,CAAY,CACZ,GAAGS,EAC0B,EAI7B,GAAM,CAAEP,SAAAA,CAAQ,CAAEQ,SAAAA,CAAQ,CAAEJ,SAAAA,CAAQ,CAAE,CAAGT,EAdlB,aAgBrBG,GAMIkB,EAAmBC,AAAAA,GAAAA,EAAAA,eAAAA,AAAAA,EAAgBT,GAEzC,MACE,UAAC,SACC,IAAKQ,EACL,SAAUhB,EACV,SAAUI,EACV,KAAK,OACJ,GAAGG,CAAK,A,EAGf,Q"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils\\phosphor-icon-map.js","sources":["webpack://@gbmtech/aurora-ui/./src/utils/phosphor-icon-map.tsx"],"sourcesContent":["import { IconWeight } from '@phosphor-icons/react'\r\nimport {\r\n Boat,\r\n Briefcase,\r\n Broadcast,\r\n Bus,\r\n House,\r\n ListPlus,\r\n Package,\r\n SquaresFour,\r\n Stack,\r\n Suitcase,\r\n SuitcaseSimple,\r\n Train,\r\n TrainRegional,\r\n Waves,\r\n} from '@phosphor-icons/react/dist/ssr'\r\n\r\nimport { Rumo } from '../components/icons/rumo'\r\nimport { VLI } from '../components/icons/vli'\r\n\r\ntype PhosphorIconMapOptions = {\r\n size?: number\r\n weight?: IconWeight\r\n}\r\n\r\nexport function PhosphorIconMap(\r\n icon: string,\r\n { size = 28, weight = 'duotone' }: PhosphorIconMapOptions = {}
|
|
1
|
+
{"version":3,"file":"utils\\phosphor-icon-map.js","sources":["webpack://@gbmtech/aurora-ui/./src/utils/phosphor-icon-map.tsx"],"sourcesContent":["import { IconWeight } from '@phosphor-icons/react'\r\nimport {\r\n Boat,\r\n Briefcase,\r\n Broadcast,\r\n Bus,\r\n House,\r\n ListPlus,\r\n Package,\r\n SquaresFour,\r\n Stack,\r\n Suitcase,\r\n SuitcaseSimple,\r\n Train,\r\n TrainRegional,\r\n Waves,\r\n} from '@phosphor-icons/react/dist/ssr'\r\n\r\nimport { Rumo } from '../components/icons/rumo'\r\nimport { VLI } from '../components/icons/vli'\r\n\r\ntype PhosphorIconMapOptions = {\r\n size?: number\r\n weight?: IconWeight\r\n}\r\n\r\nexport function PhosphorIconMap(\r\n icon: string,\r\n { size = 28, weight = 'duotone' }: PhosphorIconMapOptions = {}\r\n) {\r\n const iconMap = {\r\n Bus,\r\n Boat,\r\n Stack,\r\n Broadcast,\r\n Train,\r\n House,\r\n TrainRegional,\r\n Suitcase,\r\n Package,\r\n SquaresFour,\r\n ListPlus,\r\n SuitcaseSimple,\r\n Rumo,\r\n Waves,\r\n Briefcase,\r\n VLI,\r\n }\r\n\r\n const IconComponent = iconMap[icon as keyof typeof iconMap]\r\n\r\n if (!IconComponent) {\r\n return null\r\n }\r\n\r\n return <IconComponent size={size} weight={weight} />\r\n}\r\n"],"names":["PhosphorIconMap","icon","size","weight","IconComponent","iconMap","Bus","Boat","Stack","Broadcast","Train","House","TrainRegional","Suitcase","Package","SquaresFour","ListPlus","SuitcaseSimple","Rumo","Waves","Briefcase","VLI"],"mappings":"gLA0BO,SAASA,EACdC,CAAY,CACZ,CAAEC,KAAAA,EAAO,EAAE,CAAEC,OAAAA,EAAS,SAAS,CAA0B,CAAG,CAAC,CAAC,EAqB9D,IAAMC,EAAgBC,AAnBN,CACdC,IAAGA,EAAAA,GAAAA,CACHC,KAAIA,EAAAA,IAAAA,CACJC,MAAKA,EAAAA,KAAAA,CACLC,UAASA,EAAAA,SAAAA,CACTC,MAAKA,EAAAA,KAAAA,CACLC,MAAKA,EAAAA,KAAAA,CACLC,cAAaA,EAAAA,aAAAA,CACbC,SAAQA,EAAAA,QAAAA,CACRC,QAAOA,EAAAA,OAAAA,CACPC,YAAWA,EAAAA,WAAAA,CACXC,SAAQA,EAAAA,QAAAA,CACRC,eAAcA,EAAAA,cAAAA,CACdC,KAAIA,EAAAA,IAAAA,CACJC,MAAKA,EAAAA,KAAAA,CACLC,UAASA,EAAAA,SAAAA,CACTC,IAAGA,EAAAA,GAAAA,AACL,CAE6B,CAACpB,EAA6B,QAE3D,AAAKG,EAIE,UAACA,EAAAA,CAAc,KAAMF,EAAM,OAAQC,C,GAHjC,IAIX,Q"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
1
|
+
import { ComponentProps, JSX, ReactNode } from 'react';
|
|
2
2
|
import type { VariantProps } from '../lib/utils';
|
|
3
3
|
declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
variant: {
|
|
@@ -76,6 +76,14 @@ declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
76
76
|
export type ButtonProps = ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
77
77
|
asChild?: boolean;
|
|
78
78
|
};
|
|
79
|
-
declare function Button({ className,
|
|
79
|
+
declare function Button({ children, className, disabled, loaderPosition, loading, prefix, size, spinner, suffix, variant, asChild, rounded, ...props }: Omit<ComponentProps<'button'>, 'prefix'> & VariantProps<typeof buttonVariants> & {
|
|
80
|
+
loaderPosition?: 'prefix' | 'suffix';
|
|
81
|
+
loading?: boolean;
|
|
82
|
+
prefix?: ReactNode;
|
|
83
|
+
spinner?: ReactNode;
|
|
84
|
+
suffix?: ReactNode;
|
|
85
|
+
asChild?: boolean;
|
|
86
|
+
rounded?: boolean;
|
|
87
|
+
}): JSX.Element;
|
|
80
88
|
export { Button, buttonVariants };
|
|
81
89
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAKhD,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4UAmClB,CAAA;AAMF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,GAChD,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAEH,iBAAS,MAAM,CAAC,EACd,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,cAAc,EACd,OAAO,EACP,MAAM,EACN,IAAI,EACJ,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,GACzC,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,cAAc,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,GAAG,CAAC,OAAO,CAqBhB;AAMD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command as CommandPrimitive } from 'cmdk';
|
|
2
|
-
import { ComponentProps } from 'react';
|
|
2
|
+
import { ComponentProps, JSX } from 'react';
|
|
3
3
|
import { Dialog } from './dialog';
|
|
4
4
|
declare function Command({ className, ...props }: ComponentProps<typeof CommandPrimitive>): JSX.Element;
|
|
5
5
|
declare function CommandDialog({ children, ...props }: ComponentProps<typeof Dialog>): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/components/command.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/components/command.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAI3C,OAAO,EAAE,MAAM,EAAiD,MAAM,UAAU,CAAA;AAMhF,iBAAS,OAAO,CAAC,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,GAAG,GAAG,CAAC,OAAO,CAWvD;AAMD,iBAAS,aAAa,CAAC,EACrB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAmB7C;AAMD,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAc7D;AAMD,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,OAAO,CAW5D;AAMD,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAQ7D;AAMD,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAW7D;AAMD,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,OAAO,CAQjE;AAMD,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,OAAO,CAW5D;AAMD,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAWtC;AAMD,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,CAAA"}
|
|
@@ -3,9 +3,8 @@ interface DatePickerProps {
|
|
|
3
3
|
placeholder?: string;
|
|
4
4
|
className?: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
hasTimePicker?: boolean;
|
|
7
6
|
onChange?: (date: Date | undefined) => void;
|
|
8
7
|
}
|
|
9
|
-
declare function DatePicker({ date, placeholder, className, disabled,
|
|
8
|
+
declare function DatePicker({ date, placeholder, className, disabled, onChange, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export { DatePicker };
|
|
11
10
|
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker.tsx"],"names":[],"mappings":"AAWA,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;CAC5C;AAMD,iBAAS,UAAU,CAAC,EAClB,IAAI,EACJ,WAAW,EACX,SAAS,EACT,QAAgB,EAChB,QAAQ,GACT,EAAE,eAAe,2CAqCjB;AAMD,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ComponentProps, JSX } from 'react';
|
|
2
|
+
import * as InputPrimitive from '../primitive/input';
|
|
3
|
+
import { VariantProps } from '../lib/utils';
|
|
4
|
+
import { inputVariants } from './input';
|
|
5
|
+
declare function InputPassword({ className, disabled, loaderPosition, loading, prefix, readOnly, spinner, suffix, ...props }: ComponentProps<typeof InputPrimitive.Root> & Omit<ComponentProps<typeof InputPrimitive.Field>, 'prefix' | 'type'> & VariantProps<typeof inputVariants>): JSX.Element;
|
|
3
6
|
export { InputPassword };
|
|
4
7
|
//# sourceMappingURL=input-password.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-password.d.ts","sourceRoot":"","sources":["../../../src/components/input-password.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input-password.d.ts","sourceRoot":"","sources":["../../../src/components/input-password.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,cAAc,EACd,GAAG,EAIJ,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAA;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAYvC,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,cAAc,EACd,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,GAC3C,IAAI,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,GACpE,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG,GAAG,CAAC,OAAO,CAwCjD;AAMD,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
import { ComponentProps, JSX, ReactNode } from 'react';
|
|
2
|
+
import { VariantProps } from '../lib/utils';
|
|
3
|
+
import * as InputPrimitive from '../primitive/input';
|
|
4
|
+
declare const inputVariants: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
[key: string]: {
|
|
6
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
7
|
+
input?: import("tailwind-variants").ClassValue;
|
|
8
|
+
root?: import("tailwind-variants").ClassValue;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
[x: string]: {
|
|
13
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
14
|
+
input?: import("tailwind-variants").ClassValue;
|
|
15
|
+
root?: import("tailwind-variants").ClassValue;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
} | {}, {
|
|
19
|
+
root: string;
|
|
20
|
+
input: string;
|
|
21
|
+
}, undefined, {
|
|
22
|
+
[key: string]: {
|
|
23
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
24
|
+
input?: import("tailwind-variants").ClassValue;
|
|
25
|
+
root?: import("tailwind-variants").ClassValue;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
} | {}, {
|
|
29
|
+
root: string;
|
|
30
|
+
input: string;
|
|
31
|
+
}, import("tailwind-variants").TVReturnType<unknown, {
|
|
32
|
+
root: string;
|
|
33
|
+
input: string;
|
|
34
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
2
35
|
export type InputProps = Omit<ComponentProps<'input'>, 'prefix'> & {
|
|
3
36
|
prefix?: ReactNode;
|
|
4
37
|
suffix?: ReactNode;
|
|
@@ -7,6 +40,8 @@ export type InputProps = Omit<ComponentProps<'input'>, 'prefix'> & {
|
|
|
7
40
|
loading?: boolean;
|
|
8
41
|
spinner?: ReactNode;
|
|
9
42
|
};
|
|
10
|
-
declare function Input({ className,
|
|
11
|
-
|
|
43
|
+
declare function Input({ className, disabled, loaderPosition, loading, prefix, readOnly, spinner, suffix, ...props }: ComponentProps<typeof InputPrimitive.Root> & Omit<ComponentProps<typeof InputPrimitive.Field>, 'prefix' | 'type'> & VariantProps<typeof inputVariants> & {
|
|
44
|
+
type?: 'date' | 'datetime-local' | 'email' | 'file' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
|
45
|
+
}): JSX.Element;
|
|
46
|
+
export { Input, inputVariants };
|
|
12
47
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/components/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/components/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAM,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAA;AAOnD,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAMjB,CAAA;AAQF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,GAAG;IACjE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,QAAQ,EACR,cAAc,EACd,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,GAC3C,IAAI,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,GACpE,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IACnC,IAAI,CAAC,EACD,MAAM,GACN,gBAAgB,GAChB,OAAO,GACP,MAAM,GACN,OAAO,GACP,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,CAAA;CACX,GAAG,GAAG,CAAC,OAAO,CAoBhB;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { Input } from './input';
|
|
3
|
+
interface MaskInputProps extends Omit<ComponentProps<typeof Input>, 'value' | 'onChange'> {
|
|
3
4
|
value: number | undefined;
|
|
4
5
|
onChange: (value: number) => void;
|
|
5
6
|
decimals?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask-input.d.ts","sourceRoot":"","sources":["../../../src/components/mask-input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mask-input.d.ts","sourceRoot":"","sources":["../../../src/components/mask-input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAA;AAG3D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,UAAU,cACR,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAChE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,QAAQ,EACR,QAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACR,EAAE,cAAc,2CAuChB;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
2
|
import { TimePickerType } from '../utils/time-picker';
|
|
3
|
-
|
|
3
|
+
import { Input } from './input';
|
|
4
|
+
export interface TimePickerInputProps extends ComponentProps<typeof Input> {
|
|
4
5
|
picker: TimePickerType;
|
|
5
6
|
date: Date | undefined;
|
|
6
7
|
setDate: (date: Date | undefined) => void;
|
|
7
8
|
onRightFocus?: () => void;
|
|
8
9
|
onLeftFocus?: () => void;
|
|
9
10
|
}
|
|
10
|
-
declare const TimePickerInput: React.ForwardRefExoticComponent<TimePickerInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
11
|
+
declare const TimePickerInput: React.ForwardRefExoticComponent<Omit<TimePickerInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
11
12
|
export { TimePickerInput };
|
|
12
13
|
//# sourceMappingURL=time-picker-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-picker-input.d.ts","sourceRoot":"","sources":["../../../src/components/time-picker-input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"time-picker-input.d.ts","sourceRoot":"","sources":["../../../src/components/time-picker-input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG7C,OAAO,EACL,cAAc,EAIf,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,OAAO,KAAK,CAAC;IACxE,MAAM,EAAE,cAAc,CAAA;IACtB,IAAI,EAAE,IAAI,GAAG,SAAS,CAAA;IACtB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;CACzB;AAED,QAAA,MAAM,eAAe,4GAsFpB,CAAA;AAID,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qCAAqC,CAAA;AACnD,cAAc,oCAAoC,CAAA;AAClD,cAAc,0CAA0C,CAAA;AACxD,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AAExC,cAAc,2BAA2B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qCAAqC,CAAA;AACnD,cAAc,oCAAoC,CAAA;AAClD,cAAc,0CAA0C,CAAA;AACxD,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AAExC,cAAc,2BAA2B,CAAA;AACzC,cAAc,aAAa,CAAA"}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import type { ClassValue } from
|
|
2
|
-
/**
|
|
3
|
-
* Combines class names using `clsx` and merges them using `tailwind-merge`.
|
|
4
|
-
* This ensures optimized class name handling for conditional and Tailwind-based classes.
|
|
5
|
-
*
|
|
6
|
-
* @param inputs - List of class names or conditional class name objects.
|
|
7
|
-
* @returns A single optimized string of class names.
|
|
8
|
-
*/
|
|
1
|
+
import type { ClassValue } from 'clsx';
|
|
9
2
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
10
|
-
export type { VariantProps } from
|
|
11
|
-
export { tv } from
|
|
3
|
+
export type { VariantProps } from 'tailwind-variants';
|
|
4
|
+
export { tv } from 'tailwind-variants';
|
|
12
5
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAKtC,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD;AAED,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Scope } from '@radix-ui/react-context';
|
|
2
|
+
import type { ComponentProps, JSX, PropsWithChildren, ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Type for adding scope to component props
|
|
5
|
+
*/
|
|
6
|
+
type ScopedProps<P> = P & {
|
|
7
|
+
/**
|
|
8
|
+
* Scope for the Input component context
|
|
9
|
+
*/
|
|
10
|
+
__scopeInput?: Scope;
|
|
11
|
+
};
|
|
12
|
+
declare const createInputScope: import("@radix-ui/react-context").CreateScope;
|
|
13
|
+
/**
|
|
14
|
+
* Props for styling and appearance of the Input component
|
|
15
|
+
*/
|
|
16
|
+
interface InputVisualProps {
|
|
17
|
+
/**
|
|
18
|
+
* CSS class name for the input container
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Element to display before the input
|
|
23
|
+
*/
|
|
24
|
+
prefix?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Custom spinner element for loading state
|
|
27
|
+
*/
|
|
28
|
+
spinner?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Element to display after the input
|
|
31
|
+
*/
|
|
32
|
+
suffix?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Props for the behavior and state of the Input component
|
|
36
|
+
*/
|
|
37
|
+
interface InputBehaviorProps {
|
|
38
|
+
/**
|
|
39
|
+
* Whether the input is disabled
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Position of the loading spinner - either before or after the input
|
|
44
|
+
*/
|
|
45
|
+
loaderPosition?: 'prefix' | 'suffix';
|
|
46
|
+
/**
|
|
47
|
+
* Whether the input is in the loading state
|
|
48
|
+
*/
|
|
49
|
+
loading?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the input is in read-only mode
|
|
52
|
+
*/
|
|
53
|
+
readOnly?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Combined props for the Input component
|
|
57
|
+
*/
|
|
58
|
+
type InputProps = PropsWithChildren<InputBehaviorProps & InputVisualProps>;
|
|
59
|
+
declare function Input(inputProps: ScopedProps<InputProps>): JSX.Element;
|
|
60
|
+
/**
|
|
61
|
+
* Props for the InputField component
|
|
62
|
+
*/
|
|
63
|
+
type InputFieldProps = ComponentProps<'input'>;
|
|
64
|
+
declare function InputField({ __scopeInput, ...props }: ScopedProps<InputFieldProps>): JSX.Element;
|
|
65
|
+
export { createInputScope, InputField as Field, Input, InputField, Input as Root, };
|
|
66
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/primitive/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,EACV,cAAc,EACd,GAAG,EAEH,iBAAiB,EACjB,SAAS,EAEV,MAAM,OAAO,CAAA;AAYd;;GAEG;AACH,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAA;CACrB,CAAA;AAED,QAAA,MAA2B,gBAAgB,+CAAkC,CAAA;AAyB7E;;GAEG;AACH,UAAU,gBAAgB;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAA;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;AAED;;GAEG;AACH,UAAU,kBAAkB;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,cAAc,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAEpC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;GAEG;AACH,KAAK,UAAU,GAAG,iBAAiB,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,CAAA;AAE1E,iBAAS,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,OAAO,CA2F/D;AAQD;;GAEG;AACH,KAAK,eAAe,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;AAE9C,iBAAS,UAAU,CAAC,EAClB,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC,OAAO,CAuB5C;AAMD,OAAO,EACL,gBAAgB,EAChB,UAAU,IAAI,KAAK,EACnB,KAAK,EACL,UAAU,EACV,KAAK,IAAI,IAAI,GACd,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gbmtech/aurora-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"@phosphor-icons/react": "^2.0.9",
|
|
48
48
|
"@radix-ui/react-alert-dialog": "^1.1.4",
|
|
49
49
|
"@radix-ui/react-checkbox": "^1.0.4",
|
|
50
|
+
"@radix-ui/react-compose-refs": "^1.1.2",
|
|
50
51
|
"@radix-ui/react-context": "^1.1.2",
|
|
51
52
|
"@radix-ui/react-dialog": "^1.1.10",
|
|
52
53
|
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var _ in t)__webpack_require__.o(t,_)&&!__webpack_require__.o(e,_)&&Object.defineProperty(e,_,{enumerable:!0,get:t[_]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{TimePickerInput:()=>TimePickerInput});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),external_react_namespaceObject=require("react"),utils_cjs_namespaceObject=require("../../lib/utils.cjs"),time_picker_cjs_namespaceObject=require("../../utils/time-picker.cjs"),external_input_cjs_namespaceObject=require("../input.cjs"),TimePickerInput=(0,external_react_namespaceObject.forwardRef)(({className:e,type:t="tel",value:_,id:r,name:a,date:c=new Date(new Date().setHours(0,0,0,0)),setDate:n,onChange:i,onKeyDown:p,picker:s,onLeftFocus:u,onRightFocus:o,...m},b)=>{let[l,k]=(0,external_react_namespaceObject.useState)(!1);(0,external_react_namespaceObject.useEffect)(()=>{if(l){let e=setTimeout(()=>{k(!1)},2e3);return()=>clearTimeout(e)}},[l]);let j=(0,external_react_namespaceObject.useMemo)(()=>(0,time_picker_cjs_namespaceObject.getDateByType)(c,s),[c,s]),w=e=>{if("Tab"!==e.key){if(e.preventDefault(),"ArrowRight"===e.key&&o?.(),"ArrowLeft"===e.key&&u?.(),["ArrowUp","ArrowDown"].includes(e.key)){let t="ArrowUp"===e.key?1:-1,_=(0,time_picker_cjs_namespaceObject.getArrowByType)(j,t,s);l&&k(!1);let r=new Date(c);n((0,time_picker_cjs_namespaceObject.setDateByType)(r,_,s))}if(e.key>="0"&&e.key<="9"){let t=l?j.slice(1,2)+e.key:"0"+e.key;l&&o?.(),k(e=>!e);let _=new Date(c);n((0,time_picker_cjs_namespaceObject.setDateByType)(_,t,s))}}};return(0,jsx_runtime_namespaceObject.jsx)(external_input_cjs_namespaceObject.Input,{ref:b,id:r||s,name:a||s,className:(0,utils_cjs_namespaceObject.cn)("w-[52px] text-center font-mono tabular-nums caret-transparent [&::-webkit-inner-spin-button]:appearance-none",e),value:_||j,onChange:e=>{e.preventDefault(),i?.(e)},type:t,inputMode:"decimal",onKeyDown:e=>{p?.(e),w(e)},...m})});for(var __webpack_i__ in TimePickerInput.displayName="TimePickerInput",exports.TimePickerInput=__webpack_exports__.TimePickerInput,__webpack_exports__)-1===["TimePickerInput"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
3
|
-
//# sourceMappingURL=time-picker-input.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components\\ui\\time-picker-input.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/ui/time-picker-input.tsx"],"sourcesContent":["\r\n\r\nimport {\r\n type InputHTMLAttributes,\r\n type KeyboardEvent,\r\n forwardRef,\r\n useEffect,\r\n useMemo,\r\n useState,\r\n} from 'react'\r\n\r\nimport { cn } from '../../lib/utils'\r\nimport {\r\n type TimePickerType,\r\n getArrowByType,\r\n getDateByType,\r\n setDateByType,\r\n} from '../../utils/time-picker'\r\nimport { Input } from '../input'\r\n\r\nexport interface TimePickerInputProps\r\n extends InputHTMLAttributes<HTMLInputElement> {\r\n picker: TimePickerType\r\n date: Date | undefined\r\n setDate: (date: Date | undefined) => void\r\n onRightFocus?: () => void\r\n onLeftFocus?: () => void\r\n}\r\n\r\nconst TimePickerInput = forwardRef<HTMLInputElement, TimePickerInputProps>(\r\n (\r\n {\r\n className,\r\n type = 'tel',\r\n value,\r\n id,\r\n name,\r\n date = new Date(new Date().setHours(0, 0, 0, 0)),\r\n setDate,\r\n onChange,\r\n onKeyDown,\r\n picker,\r\n onLeftFocus,\r\n onRightFocus,\r\n ...props\r\n },\r\n ref\r\n ) => {\r\n const [flag, setFlag] = useState<boolean>(false)\r\n\r\n useEffect(() => {\r\n if (flag) {\r\n const timer = setTimeout(() => {\r\n setFlag(false)\r\n }, 2000)\r\n\r\n return () => clearTimeout(timer)\r\n }\r\n }, [flag])\r\n\r\n const calculatedValue = useMemo(\r\n () => getDateByType(date, picker),\r\n [date, picker]\r\n )\r\n\r\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\r\n if (e.key === 'Tab') return\r\n e.preventDefault()\r\n if (e.key === 'ArrowRight') onRightFocus?.()\r\n if (e.key === 'ArrowLeft') onLeftFocus?.()\r\n if (['ArrowUp', 'ArrowDown'].includes(e.key)) {\r\n const step = e.key === 'ArrowUp' ? 1 : -1\r\n const newValue = getArrowByType(calculatedValue, step, picker)\r\n if (flag) setFlag(false)\r\n const tempDate = new Date(date)\r\n setDate(setDateByType(tempDate, newValue, picker))\r\n }\r\n if (e.key >= '0' && e.key <= '9') {\r\n const newValue = !flag\r\n ? '0' + e.key\r\n : calculatedValue.slice(1, 2) + e.key\r\n if (flag) onRightFocus?.()\r\n setFlag(prev => !prev)\r\n const tempDate = new Date(date)\r\n setDate(setDateByType(tempDate, newValue, picker))\r\n }\r\n }\r\n\r\n return (\r\n <Input\r\n ref={ref}\r\n id={id || picker}\r\n name={name || picker}\r\n className={cn(\r\n 'w-[52px] text-center font-mono tabular-nums caret-transparent [&::-webkit-inner-spin-button]:appearance-none',\r\n className\r\n )}\r\n value={value || calculatedValue}\r\n onChange={e => {\r\n e.preventDefault()\r\n onChange?.(e)\r\n }}\r\n type={type}\r\n inputMode=\"decimal\"\r\n onKeyDown={e => {\r\n onKeyDown?.(e)\r\n handleKeyDown(e)\r\n }}\r\n {...props}\r\n />\r\n )\r\n }\r\n)\r\n\r\nTimePickerInput.displayName = 'TimePickerInput'\r\n\r\nexport { TimePickerInput }\r\n"],"names":["TimePickerInput","forwardRef","className","type","value","id","name","date","Date","setDate","onChange","onKeyDown","picker","onLeftFocus","onRightFocus","props","ref","flag","setFlag","useState","useEffect","timer","setTimeout","clearTimeout","calculatedValue","useMemo","getDateByType","handleKeyDown","e","step","newValue","getArrowByType","tempDate","setDateByType","prev","Input","cn"],"mappings":";0lCA6BMA,gBAAkBC,GAAAA,+BAAAA,UAAAA,EACtB,CACE,CACEC,UAAAA,CAAS,CACTC,KAAAA,EAAO,KAAK,CACZC,MAAAA,CAAK,CACLC,GAAAA,CAAE,CACFC,KAAAA,CAAI,CACJC,KAAAA,EAAO,IAAIC,KAAK,IAAIA,OAAO,QAAQ,CAAC,EAAG,EAAG,EAAG,GAAG,CAChDC,QAAAA,CAAO,CACPC,SAAAA,CAAQ,CACRC,UAAAA,CAAS,CACTC,OAAAA,CAAM,CACNC,YAAAA,CAAW,CACXC,aAAAA,CAAY,CACZ,GAAGC,EACJ,CACDC,KAEA,GAAM,CAACC,EAAMC,EAAQ,CAAGC,GAAAA,+BAAAA,QAAAA,EAAkB,IAE1CC,GAAAA,+BAAAA,SAAAA,EAAU,KACR,GAAIH,EAAM,CACR,IAAMI,EAAQC,WAAW,KACvBJ,EAAQ,GACV,EAAG,KAEH,MAAO,IAAMK,aAAaF,EAC5B,CACF,EAAG,CAACJ,EAAK,EAET,IAAMO,EAAkBC,GAAAA,+BAAAA,OAAAA,EACtB,IAAMC,GAAAA,gCAAAA,aAAAA,EAAcnB,EAAMK,GAC1B,CAACL,EAAMK,EAAO,EAGVe,EAAgB,IACpB,GAAIC,QAAAA,EAAE,GAAG,EAIT,GAHAA,EAAE,cAAc,GACZA,eAAAA,EAAE,GAAG,EAAmBd,MACxBc,cAAAA,EAAE,GAAG,EAAkBf,MACvB,CAAC,UAAW,YAAY,CAAC,QAAQ,CAACe,EAAE,GAAG,EAAG,CAC5C,IAAMC,EAAOD,YAAAA,EAAE,GAAG,CAAiB,EAAI,GACjCE,EAAWC,GAAAA,gCAAAA,cAAAA,EAAeP,EAAiBK,EAAMjB,EACnDK,CAAAA,GAAMC,EAAQ,IAClB,IAAMc,EAAW,IAAIxB,KAAKD,GAC1BE,EAAQwB,GAAAA,gCAAAA,aAAAA,EAAcD,EAAUF,EAAUlB,GAC5C,CACA,GAAIgB,EAAE,GAAG,EAAI,KAAOA,EAAE,GAAG,EAAI,IAAK,CAChC,IAAME,EAAW,EAEbN,EAAgB,KAAK,CAAC,EAAG,GAAKI,EAAE,GAAG,CADnC,IAAMA,EAAE,GAAG,CAEXX,GAAMH,MACVI,EAAQgB,GAAQ,CAACA,GACjB,IAAMF,EAAW,IAAIxB,KAAKD,GAC1BE,EAAQwB,GAAAA,gCAAAA,aAAAA,EAAcD,EAAUF,EAAUlB,GAC5C,EACF,EAEA,MACE,oCAACuB,mCAAAA,KAAKA,CAAAA,CACJ,IAAKnB,EACL,GAAIX,GAAMO,EACV,KAAMN,GAAQM,EACd,UAAWwB,GAAAA,0BAAAA,EAAAA,EACT,+GACAlC,GAEF,MAAOE,GAASoB,EAChB,SAAUI,IACRA,EAAE,cAAc,GAChBlB,IAAWkB,EACb,EACA,KAAMzB,EACN,UAAU,UACV,UAAWyB,IACTjB,IAAYiB,GACZD,EAAcC,EAChB,EACC,GAAGb,CAAK,EAGf,G,yBAGFf,gBAAgB,WAAW,CAAG,kB"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{TimePicker:()=>TimePicker});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),ssr_namespaceObject=require("@phosphor-icons/react/dist/ssr"),external_react_namespaceObject=require("react"),external_label_cjs_namespaceObject=require("../label.cjs"),external_time_picker_input_cjs_namespaceObject=require("./time-picker-input.cjs");function TimePicker({date:e,setDate:_}){let r=external_react_namespaceObject.useRef(null),c=external_react_namespaceObject.useRef(null),t=external_react_namespaceObject.useRef(null);return(0,jsx_runtime_namespaceObject.jsxs)("div",{className:"flex items-end gap-2",children:[(0,jsx_runtime_namespaceObject.jsxs)("div",{className:"grid gap-1 text-center",children:[(0,jsx_runtime_namespaceObject.jsx)(external_label_cjs_namespaceObject.Label,{htmlFor:"hours",className:"text-xs",children:"Horas"}),(0,jsx_runtime_namespaceObject.jsx)(external_time_picker_input_cjs_namespaceObject.TimePickerInput,{picker:"hours",date:e,setDate:_,ref:c,onRightFocus:()=>r.current?.focus()})]}),(0,jsx_runtime_namespaceObject.jsxs)("div",{className:"grid gap-1 text-center",children:[(0,jsx_runtime_namespaceObject.jsx)(external_label_cjs_namespaceObject.Label,{htmlFor:"minutes",className:"text-xs",children:"Minutos"}),(0,jsx_runtime_namespaceObject.jsx)(external_time_picker_input_cjs_namespaceObject.TimePickerInput,{picker:"minutes",date:e,setDate:_,ref:r,onLeftFocus:()=>c.current?.focus(),onRightFocus:()=>t.current?.focus()})]}),(0,jsx_runtime_namespaceObject.jsx)("div",{className:"flex h-12 items-center",children:(0,jsx_runtime_namespaceObject.jsx)(ssr_namespaceObject.Clock,{size:16,className:"ml-2"})})]})}for(var __webpack_i__ in exports.TimePicker=__webpack_exports__.TimePicker,__webpack_exports__)-1===["TimePicker"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
3
|
-
//# sourceMappingURL=time-picker.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components\\ui\\time-picker.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/ui/time-picker.tsx"],"sourcesContent":["\r\n\r\nimport { Clock } from '@phosphor-icons/react/dist/ssr'\r\nimport * as React from 'react'\r\n\r\nimport { Label } from '../label'\r\nimport { TimePickerInput } from './time-picker-input'\r\n\r\ninterface TimePickerProps {\r\n date: Date | undefined\r\n setDate: (date: Date | undefined) => void\r\n}\r\n\r\nexport function TimePicker({ date, setDate }: TimePickerProps) {\r\n const minuteRef = React.useRef<HTMLInputElement>(null)\r\n const hourRef = React.useRef<HTMLInputElement>(null)\r\n const secondRef = React.useRef<HTMLInputElement>(null)\r\n\r\n return (\r\n <div className=\"flex items-end gap-2\">\r\n <div className=\"grid gap-1 text-center\">\r\n <Label htmlFor=\"hours\" className=\"text-xs\">\r\n Horas\r\n </Label>\r\n <TimePickerInput\r\n picker=\"hours\"\r\n date={date}\r\n setDate={setDate}\r\n ref={hourRef}\r\n onRightFocus={() => minuteRef.current?.focus()}\r\n />\r\n </div>\r\n\r\n <div className=\"grid gap-1 text-center\">\r\n <Label htmlFor=\"minutes\" className=\"text-xs\">\r\n Minutos\r\n </Label>\r\n <TimePickerInput\r\n picker=\"minutes\"\r\n date={date}\r\n setDate={setDate}\r\n ref={minuteRef}\r\n onLeftFocus={() => hourRef.current?.focus()}\r\n onRightFocus={() => secondRef.current?.focus()}\r\n />\r\n </div>\r\n\r\n <div className=\"flex h-12 items-center\">\r\n <Clock size={16} className=\"ml-2\" />\r\n </div>\r\n </div>\r\n )\r\n}\r\n"],"names":["TimePicker","date","setDate","minuteRef","React","hourRef","secondRef","Label","TimePickerInput","Clock"],"mappings":";gmCAaO,SAASA,WAAW,CAAEC,KAAAA,CAAI,CAAEC,QAAAA,CAAO,CAAmB,EAC3D,IAAMC,EAAYC,+BAAAA,MAAY,CAAmB,MAC3CC,EAAUD,+BAAAA,MAAY,CAAmB,MACzCE,EAAYF,+BAAAA,MAAY,CAAmB,MAEjD,MACE,qCAAC,OAAI,UAAU,uB,UACb,qCAAC,OAAI,UAAU,yB,UACb,oCAACG,mCAAAA,KAAKA,CAAAA,CAAC,QAAQ,QAAQ,UAAU,U,SAAU,O,GAG3C,oCAACC,+CAAAA,eAAeA,CAAAA,CACd,OAAO,QACP,KAAMP,EACN,QAASC,EACT,IAAKG,EACL,aAAc,IAAMF,EAAU,OAAO,EAAE,O,MAI3C,qCAAC,OAAI,UAAU,yB,UACb,oCAACI,mCAAAA,KAAKA,CAAAA,CAAC,QAAQ,UAAU,UAAU,U,SAAU,S,GAG7C,oCAACC,+CAAAA,eAAeA,CAAAA,CACd,OAAO,UACP,KAAMP,EACN,QAASC,EACT,IAAKC,EACL,YAAa,IAAME,EAAQ,OAAO,EAAE,QACpC,aAAc,IAAMC,EAAU,OAAO,EAAE,O,MAI3C,oCAAC,OAAI,UAAU,yB,SACb,oCAACG,oBAAAA,KAAKA,CAAAA,CAAC,KAAM,GAAI,UAAU,M,OAInC,C"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import*as e from"react/jsx-runtime";import*as t from"react";import*as r from"../../lib/utils.js";import*as a from"../../utils/time-picker.js";import*as n from"../input.js";let i=(0,t.forwardRef)(({className:i,type:o="tel",value:s,id:p,name:m,date:u=new Date(new Date().setHours(0,0,0,0)),setDate:l,onChange:y,onKeyDown:f,picker:c,onLeftFocus:w,onRightFocus:k,...D},T)=>{let[d,A]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(d){let e=setTimeout(()=>{A(!1)},2e3);return()=>clearTimeout(e)}},[d]);let b=(0,t.useMemo)(()=>(0,a.getDateByType)(u,c),[u,c]),j=e=>{if("Tab"!==e.key){if(e.preventDefault(),"ArrowRight"===e.key&&k?.(),"ArrowLeft"===e.key&&w?.(),["ArrowUp","ArrowDown"].includes(e.key)){let t="ArrowUp"===e.key?1:-1,r=(0,a.getArrowByType)(b,t,c);d&&A(!1);let n=new Date(u);l((0,a.setDateByType)(n,r,c))}if(e.key>="0"&&e.key<="9"){let t=d?b.slice(1,2)+e.key:"0"+e.key;d&&k?.(),A(e=>!e);let r=new Date(u);l((0,a.setDateByType)(r,t,c))}}};return(0,e.jsx)(n.Input,{ref:T,id:p||c,name:m||c,className:(0,r.cn)("w-[52px] text-center font-mono tabular-nums caret-transparent [&::-webkit-inner-spin-button]:appearance-none",i),value:s||b,onChange:e=>{e.preventDefault(),y?.(e)},type:o,inputMode:"decimal",onKeyDown:e=>{f?.(e),j(e)},...D})});i.displayName="TimePickerInput";export{i as TimePickerInput};
|
|
3
|
-
//# sourceMappingURL=time-picker-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components\\ui\\time-picker-input.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/ui/time-picker-input.tsx"],"sourcesContent":["\r\n\r\nimport {\r\n type InputHTMLAttributes,\r\n type KeyboardEvent,\r\n forwardRef,\r\n useEffect,\r\n useMemo,\r\n useState,\r\n} from 'react'\r\n\r\nimport { cn } from '../../lib/utils'\r\nimport {\r\n type TimePickerType,\r\n getArrowByType,\r\n getDateByType,\r\n setDateByType,\r\n} from '../../utils/time-picker'\r\nimport { Input } from '../input'\r\n\r\nexport interface TimePickerInputProps\r\n extends InputHTMLAttributes<HTMLInputElement> {\r\n picker: TimePickerType\r\n date: Date | undefined\r\n setDate: (date: Date | undefined) => void\r\n onRightFocus?: () => void\r\n onLeftFocus?: () => void\r\n}\r\n\r\nconst TimePickerInput = forwardRef<HTMLInputElement, TimePickerInputProps>(\r\n (\r\n {\r\n className,\r\n type = 'tel',\r\n value,\r\n id,\r\n name,\r\n date = new Date(new Date().setHours(0, 0, 0, 0)),\r\n setDate,\r\n onChange,\r\n onKeyDown,\r\n picker,\r\n onLeftFocus,\r\n onRightFocus,\r\n ...props\r\n },\r\n ref\r\n ) => {\r\n const [flag, setFlag] = useState<boolean>(false)\r\n\r\n useEffect(() => {\r\n if (flag) {\r\n const timer = setTimeout(() => {\r\n setFlag(false)\r\n }, 2000)\r\n\r\n return () => clearTimeout(timer)\r\n }\r\n }, [flag])\r\n\r\n const calculatedValue = useMemo(\r\n () => getDateByType(date, picker),\r\n [date, picker]\r\n )\r\n\r\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\r\n if (e.key === 'Tab') return\r\n e.preventDefault()\r\n if (e.key === 'ArrowRight') onRightFocus?.()\r\n if (e.key === 'ArrowLeft') onLeftFocus?.()\r\n if (['ArrowUp', 'ArrowDown'].includes(e.key)) {\r\n const step = e.key === 'ArrowUp' ? 1 : -1\r\n const newValue = getArrowByType(calculatedValue, step, picker)\r\n if (flag) setFlag(false)\r\n const tempDate = new Date(date)\r\n setDate(setDateByType(tempDate, newValue, picker))\r\n }\r\n if (e.key >= '0' && e.key <= '9') {\r\n const newValue = !flag\r\n ? '0' + e.key\r\n : calculatedValue.slice(1, 2) + e.key\r\n if (flag) onRightFocus?.()\r\n setFlag(prev => !prev)\r\n const tempDate = new Date(date)\r\n setDate(setDateByType(tempDate, newValue, picker))\r\n }\r\n }\r\n\r\n return (\r\n <Input\r\n ref={ref}\r\n id={id || picker}\r\n name={name || picker}\r\n className={cn(\r\n 'w-[52px] text-center font-mono tabular-nums caret-transparent [&::-webkit-inner-spin-button]:appearance-none',\r\n className\r\n )}\r\n value={value || calculatedValue}\r\n onChange={e => {\r\n e.preventDefault()\r\n onChange?.(e)\r\n }}\r\n type={type}\r\n inputMode=\"decimal\"\r\n onKeyDown={e => {\r\n onKeyDown?.(e)\r\n handleKeyDown(e)\r\n }}\r\n {...props}\r\n />\r\n )\r\n }\r\n)\r\n\r\nTimePickerInput.displayName = 'TimePickerInput'\r\n\r\nexport { TimePickerInput }\r\n"],"names":["TimePickerInput","forwardRef","className","type","value","id","name","date","Date","setDate","onChange","onKeyDown","picker","onLeftFocus","onRightFocus","props","ref","flag","setFlag","useState","useEffect","timer","setTimeout","clearTimeout","calculatedValue","useMemo","getDateByType","handleKeyDown","e","step","newValue","getArrowByType","tempDate","setDateByType","prev","Input","cn"],"mappings":";4KA6BA,IAAMA,EAAkBC,GAAAA,EAAAA,UAAAA,EACtB,CACE,CACEC,UAAAA,CAAS,CACTC,KAAAA,EAAO,KAAK,CACZC,MAAAA,CAAK,CACLC,GAAAA,CAAE,CACFC,KAAAA,CAAI,CACJC,KAAAA,EAAO,IAAIC,KAAK,IAAIA,OAAO,QAAQ,CAAC,EAAG,EAAG,EAAG,GAAG,CAChDC,QAAAA,CAAO,CACPC,SAAAA,CAAQ,CACRC,UAAAA,CAAS,CACTC,OAAAA,CAAM,CACNC,YAAAA,CAAW,CACXC,aAAAA,CAAY,CACZ,GAAGC,EACJ,CACDC,KAEA,GAAM,CAACC,EAAMC,EAAQ,CAAGC,GAAAA,EAAAA,QAAAA,EAAkB,IAE1CC,GAAAA,EAAAA,SAAAA,EAAU,KACR,GAAIH,EAAM,CACR,IAAMI,EAAQC,WAAW,KACvBJ,EAAQ,GACV,EAAG,KAEH,MAAO,IAAMK,aAAaF,EAC5B,CACF,EAAG,CAACJ,EAAK,EAET,IAAMO,EAAkBC,GAAAA,EAAAA,OAAAA,EACtB,IAAMC,GAAAA,EAAAA,aAAAA,EAAcnB,EAAMK,GAC1B,CAACL,EAAMK,EAAO,EAGVe,EAAgB,IACpB,GAAIC,QAAAA,EAAE,GAAG,EAIT,GAHAA,EAAE,cAAc,GACZA,eAAAA,EAAE,GAAG,EAAmBd,MACxBc,cAAAA,EAAE,GAAG,EAAkBf,MACvB,CAAC,UAAW,YAAY,CAAC,QAAQ,CAACe,EAAE,GAAG,EAAG,CAC5C,IAAMC,EAAOD,YAAAA,EAAE,GAAG,CAAiB,EAAI,GACjCE,EAAWC,GAAAA,EAAAA,cAAAA,EAAeP,EAAiBK,EAAMjB,EACnDK,CAAAA,GAAMC,EAAQ,IAClB,IAAMc,EAAW,IAAIxB,KAAKD,GAC1BE,EAAQwB,GAAAA,EAAAA,aAAAA,EAAcD,EAAUF,EAAUlB,GAC5C,CACA,GAAIgB,EAAE,GAAG,EAAI,KAAOA,EAAE,GAAG,EAAI,IAAK,CAChC,IAAME,EAAW,EAEbN,EAAgB,KAAK,CAAC,EAAG,GAAKI,EAAE,GAAG,CADnC,IAAMA,EAAE,GAAG,CAEXX,GAAMH,MACVI,EAAQgB,GAAQ,CAACA,GACjB,IAAMF,EAAW,IAAIxB,KAAKD,GAC1BE,EAAQwB,GAAAA,EAAAA,aAAAA,EAAcD,EAAUF,EAAUlB,GAC5C,EACF,EAEA,MACE,UAACuB,EAAAA,KAAKA,CAAAA,CACJ,IAAKnB,EACL,GAAIX,GAAMO,EACV,KAAMN,GAAQM,EACd,UAAWwB,GAAAA,EAAAA,EAAAA,EACT,+GACAlC,GAEF,MAAOE,GAASoB,EAChB,SAAUI,IACRA,EAAE,cAAc,GAChBlB,IAAWkB,EACb,EACA,KAAMzB,EACN,UAAU,UACV,UAAWyB,IACTjB,IAAYiB,GACZD,EAAcC,EAChB,EACC,GAAGb,CAAK,EAGf,EAGFf,CAAAA,EAAgB,WAAW,CAAG,yB"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import*as e from"react/jsx-runtime";import*as s from"@phosphor-icons/react/dist/ssr";import*as r from"react";import*as t from"../label.js";import*as i from"./time-picker-input.js";function c({date:c,setDate:a}){let o=r.useRef(null),l=r.useRef(null),n=r.useRef(null);return(0,e.jsxs)("div",{className:"flex items-end gap-2",children:[(0,e.jsxs)("div",{className:"grid gap-1 text-center",children:[(0,e.jsx)(t.Label,{htmlFor:"hours",className:"text-xs",children:"Horas"}),(0,e.jsx)(i.TimePickerInput,{picker:"hours",date:c,setDate:a,ref:l,onRightFocus:()=>o.current?.focus()})]}),(0,e.jsxs)("div",{className:"grid gap-1 text-center",children:[(0,e.jsx)(t.Label,{htmlFor:"minutes",className:"text-xs",children:"Minutos"}),(0,e.jsx)(i.TimePickerInput,{picker:"minutes",date:c,setDate:a,ref:o,onLeftFocus:()=>l.current?.focus(),onRightFocus:()=>n.current?.focus()})]}),(0,e.jsx)("div",{className:"flex h-12 items-center",children:(0,e.jsx)(s.Clock,{size:16,className:"ml-2"})})]})}export{c as TimePicker};
|
|
3
|
-
//# sourceMappingURL=time-picker.js.map
|