-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,4 +47,7 @@ graphql.config.* | |
.graphqlconfig | ||
schema.graphql | ||
.tamagui | ||
.turbo | ||
.turbo | ||
dist | ||
|
||
**/types/**/*.d.ts.map |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './usePopoverState'; | ||
//# sourceMappingURL=index.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="react" /> | ||
export declare const usePopoverState: (defaultOpen?: boolean) => { | ||
open: boolean; | ||
onOpenChange: import("react").Dispatch<import("react").SetStateAction<boolean>>; | ||
defaultOpen: boolean; | ||
}; | ||
//# sourceMappingURL=usePopoverState.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { DialogProps, SizeTokens } from 'tamagui'; | ||
import { ReactNode } from 'react'; | ||
import { LmDialogActions } from './LmDialogActions'; | ||
import { LmDialogContent } from './LmDialogContent'; | ||
type LmDialogProps = DialogProps & { | ||
trigger?: ReactNode; | ||
title?: string; | ||
description?: string; | ||
hideCloseButton?: boolean; | ||
fullScreen?: boolean; | ||
contentPadding?: SizeTokens; | ||
dialogHeight?: string | number; | ||
dialogWidth?: string | number; | ||
}; | ||
export declare function LmDialog({ children, trigger, title, description, hideCloseButton, fullScreen, contentPadding, dialogWidth, dialogHeight, ...dialogProps }: LmDialogProps): JSX.Element; | ||
export declare namespace LmDialog { | ||
var Actions: typeof LmDialogActions; | ||
var Content: typeof LmDialogContent; | ||
} | ||
export {}; | ||
//# sourceMappingURL=LmDialog.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="react" /> | ||
import { SizeTokens, XStackProps } from 'tamagui'; | ||
export type LmDialogActionsProps = XStackProps & { | ||
contentPadding?: SizeTokens; | ||
}; | ||
export declare function LmDialogActions({ children, contentPadding, ...rest }: LmDialogActionsProps): JSX.Element; | ||
//# sourceMappingURL=LmDialogActions.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="react" /> | ||
import { SizeTokens, YStackProps } from 'tamagui'; | ||
export type LmDialogContentProps = YStackProps & { | ||
contentPadding?: SizeTokens; | ||
}; | ||
export declare function LmDialogContent({ children, contentPadding, ...rest }: LmDialogContentProps): JSX.Element; | ||
//# sourceMappingURL=LmDialogContent.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { PopoverContentProps, PopoverProps } from 'tamagui'; | ||
import { ReactNode } from 'react'; | ||
import { LmSheetProps } from './LmSheet'; | ||
export type LmPopoverProps = PopoverProps & { | ||
trigger?: ReactNode; | ||
hideArrow?: boolean; | ||
contentProps?: PopoverContentProps; | ||
isBouncy?: boolean; | ||
sheetProps?: LmSheetProps; | ||
}; | ||
export declare function LmPopover({ trigger, children, hideArrow, contentProps, isBouncy, sheetProps, ...popoverProps }: LmPopoverProps): JSX.Element; | ||
//# sourceMappingURL=LmPopover.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ScrollViewProps } from 'tamagui'; | ||
import { PropsWithChildren } from 'react'; | ||
import { SheetProps } from '@tamagui/sheet/src/types'; | ||
export type LmSheetProps = PropsWithChildren<SheetProps & { | ||
hideHandle?: boolean; | ||
fullScreen?: boolean; | ||
enableScroll?: boolean; | ||
scrollviewProps?: ScrollViewProps; | ||
}>; | ||
export declare function LmSheet({ hideHandle, children, fullScreen, snapPoints, enableScroll, scrollviewProps, ...sheetProps }: LmSheetProps): JSX.Element; | ||
//# sourceMappingURL=LmSheet.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from './LmPopover'; | ||
export * from './LmDialog'; | ||
export * from './LmSheet'; | ||
//# sourceMappingURL=index.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist/ | ||
.DS_Store | ||
THUMBS_DB | ||
node_modules/ | ||
types/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,101 @@ | ||
import DateTimePickerModal from 'react-native-modal-datetime-picker' | ||
import {LmDatepickerProps} from './datepickerTypes' | ||
import {LmFormFieldContainer} from '../../../core/src/form' | ||
import {useId, useState} from 'react' | ||
import {Button, Input, XGroup, XStack} from 'tamagui' | ||
import {Platform} from 'react-native' | ||
import {getLocaleDate} from '../dateHelper' | ||
import {Calendar} from 'tamagui-phosphor-icons' | ||
import {OnDatesChangeProps, START_DATE} from '@datepicker-react/hooks' | ||
import { LmDatepickerProps } from './datepickerTypes' | ||
import { LmFormFieldContainer } from '@tamagui-extras/form' | ||
import { useId, useState } from 'react' | ||
import { Button, Input, XGroup, XStack } from 'tamagui' | ||
import { Platform } from 'react-native' | ||
import { getLocaleDate } from '../dateHelper' | ||
import { Calendar } from 'tamagui-phosphor-icons' | ||
import { OnDatesChangeProps, START_DATE } from '@datepicker-react/hooks' | ||
|
||
export function LmDatepicker({ | ||
numberOfMonths, | ||
isRangePicker, | ||
onChange, | ||
labelFunctions, | ||
startDate = null, | ||
endDate = null, | ||
required, | ||
error, | ||
helperText, | ||
label, | ||
labelProps, | ||
labelInline, | ||
}: LmDatepickerProps) { | ||
const id = useId() | ||
const [startOpen, startOpenChange] = useState(false) | ||
const [endOpen, endOpenChange] = useState(false) | ||
const [state, setState] = useState<OnDatesChangeProps>({ | ||
startDate: startDate, | ||
endDate: endDate, | ||
focusedInput: START_DATE, | ||
}) | ||
return ( | ||
<LmFormFieldContainer | ||
id={id} | ||
error={error} | ||
required={required} | ||
labelProps={labelProps} | ||
label={label} | ||
labelInline={labelInline} | ||
helperText={helperText} | ||
> | ||
<XStack space width={Platform.OS === 'web' ? 'fit-content' : undefined}> | ||
<XGroup> | ||
<XGroup.Item> | ||
<Input | ||
width={'$12'} | ||
value={state.startDate ? getLocaleDate({date: state.startDate}) : ''} | ||
></Input> | ||
</XGroup.Item> | ||
<XGroup.Item> | ||
<Button onPress={() => startOpenChange((state) => !state)} icon={<Calendar/>}/> | ||
</XGroup.Item> | ||
</XGroup> | ||
{isRangePicker && ( | ||
<XGroup> | ||
<XGroup.Item> | ||
<Input | ||
width={'$12'} | ||
value={state.endDate ? getLocaleDate({date: state.endDate}) : ''} | ||
/> | ||
</XGroup.Item> | ||
<XGroup.Item> | ||
<Button onPress={() => endOpenChange((state) => !state)} icon={<Calendar/>}/> | ||
</XGroup.Item> | ||
</XGroup> | ||
)} | ||
</XStack> | ||
{startOpen && ( | ||
<DateTimePickerModal | ||
date={state.startDate ?? undefined} | ||
isVisible={startOpen} | ||
mode={'date'} | ||
onConfirm={(date) => { | ||
setState((old) => ({ | ||
...old, | ||
startDate: date ?? null, | ||
})) | ||
startOpenChange(false) | ||
}} | ||
onCancel={() => startOpenChange(false)} | ||
/> | ||
)} | ||
{endOpen && ( | ||
<DateTimePickerModal | ||
date={state.endDate ?? undefined} | ||
isVisible={endOpen} | ||
mode={'date'} | ||
onConfirm={(date) => { | ||
setState((old) => ({ | ||
...old, | ||
endDate: date ?? null, | ||
})) | ||
startOpenChange(false) | ||
}} | ||
onCancel={() => endOpenChange(false)} | ||
/> | ||
)} | ||
</LmFormFieldContainer> | ||
) | ||
numberOfMonths, | ||
isRangePicker, | ||
onChange, | ||
labelFunctions, | ||
startDate = null, | ||
endDate = null, | ||
required, | ||
error, | ||
helperText, | ||
label, | ||
labelProps, | ||
labelInline, | ||
}: LmDatepickerProps) { | ||
const id = useId() | ||
const [startOpen, startOpenChange] = useState(false) | ||
const [endOpen, endOpenChange] = useState(false) | ||
const [state, setState] = useState<OnDatesChangeProps>({ | ||
startDate: startDate, | ||
endDate: endDate, | ||
focusedInput: START_DATE, | ||
}) | ||
return ( | ||
<LmFormFieldContainer | ||
id={id} | ||
error={error} | ||
required={required} | ||
labelProps={labelProps} | ||
label={label} | ||
labelInline={labelInline} | ||
helperText={helperText} | ||
> | ||
<XStack space width={Platform.OS === 'web' ? 'fit-content' : undefined}> | ||
<XGroup> | ||
<XGroup.Item> | ||
<Input | ||
width={'$12'} | ||
value={state.startDate ? getLocaleDate({ date: state.startDate }) : ''} | ||
></Input> | ||
</XGroup.Item> | ||
<XGroup.Item> | ||
<Button onPress={() => startOpenChange((state) => !state)} icon={<Calendar />} /> | ||
</XGroup.Item> | ||
</XGroup> | ||
{isRangePicker && ( | ||
<XGroup> | ||
<XGroup.Item> | ||
<Input | ||
width={'$12'} | ||
value={state.endDate ? getLocaleDate({ date: state.endDate }) : ''} | ||
/> | ||
</XGroup.Item> | ||
<XGroup.Item> | ||
<Button onPress={() => endOpenChange((state) => !state)} icon={<Calendar />} /> | ||
</XGroup.Item> | ||
</XGroup> | ||
)} | ||
</XStack> | ||
{startOpen && ( | ||
<DateTimePickerModal | ||
date={state.startDate ?? undefined} | ||
isVisible={startOpen} | ||
mode={'date'} | ||
onConfirm={(date) => { | ||
setState((old) => ({ | ||
...old, | ||
startDate: date ?? null, | ||
})) | ||
startOpenChange(false) | ||
}} | ||
onCancel={() => startOpenChange(false)} | ||
/> | ||
)} | ||
{endOpen && ( | ||
<DateTimePickerModal | ||
date={state.endDate ?? undefined} | ||
isVisible={endOpen} | ||
mode={'date'} | ||
onConfirm={(date) => { | ||
setState((old) => ({ | ||
...old, | ||
endDate: date ?? null, | ||
})) | ||
startOpenChange(false) | ||
}} | ||
onCancel={() => endOpenChange(false)} | ||
/> | ||
)} | ||
</LmFormFieldContainer> | ||
) | ||
} |