@donotdev/expo 0.0.1 → 0.0.2
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/__tests__/components/atomic.test.js +1 -0
- package/dist/__tests__/providers/ExpoAppProviders.test.js +1 -0
- package/dist/__tests__/setup.js +1 -0
- package/dist/__tests__/test-utils.js +1 -0
- package/dist/atomic/Accordion/index.js +1 -0
- package/dist/atomic/Alert/index.js +1 -0
- package/dist/atomic/AlertDialog/index.js +1 -0
- package/dist/atomic/Avatar/index.js +1 -0
- package/dist/atomic/Badge/index.js +1 -0
- package/dist/atomic/Blockquote/index.js +1 -0
- package/dist/atomic/Button/index.js +1 -0
- package/dist/atomic/Calendar/index.js +1 -0
- package/dist/atomic/CallToAction/index.js +1 -0
- package/dist/atomic/Card/index.js +1 -0
- package/dist/atomic/Checkbox/index.js +1 -0
- package/dist/atomic/Collapsible/index.js +1 -0
- package/dist/atomic/Combobox/index.js +1 -0
- package/dist/atomic/Command/index.js +1 -0
- package/dist/atomic/CommandDialog/index.js +1 -0
- package/dist/atomic/ContextMenu/index.js +1 -0
- package/dist/atomic/CopyToClipboard/index.js +1 -0
- package/dist/atomic/DescriptionList/index.js +1 -0
- package/dist/atomic/Dialog/index.js +1 -0
- package/dist/atomic/DropdownMenu/index.js +1 -0
- package/dist/atomic/DualCard/index.js +1 -0
- package/dist/atomic/FeatureFallback/index.js +1 -0
- package/dist/atomic/FileButton/index.js +1 -0
- package/dist/atomic/Grid/index.js +1 -0
- package/dist/atomic/HeroSection/index.js +1 -0
- package/dist/atomic/HoverCard/index.js +1 -0
- package/dist/atomic/Icons/index.js +1 -0
- package/dist/atomic/InfiniteScroll/index.js +1 -0
- package/dist/atomic/Input/index.js +1 -0
- package/dist/atomic/Label/index.js +1 -0
- package/dist/atomic/List/index.js +1 -0
- package/dist/atomic/NavigationMenu/index.js +1 -0
- package/dist/atomic/Pagination/index.js +1 -0
- package/dist/atomic/PasswordInput/index.js +1 -0
- package/dist/atomic/Popover/index.js +1 -0
- package/dist/atomic/Portal/index.js +1 -0
- package/dist/atomic/PortalButton/index.js +1 -0
- package/dist/atomic/Progress/index.js +1 -0
- package/dist/atomic/RadioGroup/index.js +1 -0
- package/dist/atomic/RangeInput/index.js +1 -0
- package/dist/atomic/Rating/index.js +1 -0
- package/dist/atomic/ScrollArea/index.js +1 -0
- package/dist/atomic/Section/index.js +1 -0
- package/dist/atomic/Select/index.js +1 -0
- package/dist/atomic/Separator/index.js +1 -0
- package/dist/atomic/Sheet/index.js +1 -0
- package/dist/atomic/Skeleton/index.js +1 -0
- package/dist/atomic/Slider/index.js +1 -0
- package/dist/atomic/Slot/index.js +1 -0
- package/dist/atomic/Spinner/index.js +1 -0
- package/dist/atomic/Stack/index.js +1 -0
- package/dist/atomic/Stepper/index.js +1 -0
- package/dist/atomic/Switch/index.js +1 -0
- package/dist/atomic/Table/index.js +1 -0
- package/dist/atomic/Tabs/index.js +1 -0
- package/dist/atomic/Tag/index.js +1 -0
- package/dist/atomic/Text/index.js +1 -0
- package/dist/atomic/Textarea/index.js +1 -0
- package/dist/atomic/Toaster/index.js +1 -0
- package/dist/atomic/Toggle/index.js +1 -0
- package/dist/atomic/ToggleGroup/index.js +1 -0
- package/dist/atomic/Tooltip/index.js +1 -0
- package/dist/atomic/VideoPlayer/index.js +1 -0
- package/dist/atomic/VisuallyHidden/index.js +1 -0
- package/dist/atomic/index.js +1 -0
- package/dist/crud/components/DateFilter.js +1 -0
- package/dist/crud/components/DisplayFieldRenderer.js +1 -0
- package/dist/crud/components/EntityCardList.d.ts.map +1 -1
- package/dist/crud/components/EntityCardList.js +1 -0
- package/dist/crud/components/EntityDisplayRenderer.js +1 -0
- package/dist/crud/components/EntityFilters.js +1 -0
- package/dist/crud/components/EntityFormRenderer.d.ts +1 -3
- package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityFormRenderer.js +1 -0
- package/dist/crud/components/EntityList.d.ts.map +1 -1
- package/dist/crud/components/EntityList.js +1 -0
- package/dist/crud/components/FormFieldRenderer.js +1 -0
- package/dist/crud/components/FormLayout.js +1 -0
- package/dist/crud/components/index.js +1 -0
- package/dist/crud/contexts/UploadContext.js +1 -0
- package/dist/crud/forms/hooks/useEntityForm.js +1 -0
- package/dist/crud/hooks/useUnsavedChangesWarning.d.ts +7 -14
- package/dist/crud/hooks/useUnsavedChangesWarning.d.ts.map +1 -1
- package/dist/crud/hooks/useUnsavedChangesWarning.js +1 -0
- package/dist/crud/index.d.ts +1 -1
- package/dist/crud/index.d.ts.map +1 -1
- package/dist/crud/index.js +1 -0
- package/dist/crud/stores/index.js +1 -0
- package/dist/features/auth/components/AuthPartnerButton.js +1 -0
- package/dist/features/auth/components/ConfirmDeleteDialog.js +1 -0
- package/dist/features/auth/components/FeatureGuard.js +1 -0
- package/dist/features/auth/components/GoogleOneTap.js +1 -0
- package/dist/features/auth/components/LoginModal.js +1 -0
- package/dist/features/auth/components/MultipleAuthProviders.js +1 -0
- package/dist/features/auth/components/ReauthDialog.js +1 -0
- package/dist/features/auth/components/index.js +1 -0
- package/dist/features/auth/hooks/index.js +1 -0
- package/dist/features/auth/hooks/useAuthState.js +1 -0
- package/dist/features/auth/hooks/useCanAccess.js +1 -0
- package/dist/features/auth/hooks/useHasRole.js +1 -0
- package/dist/features/auth/hooks/useUserRole.js +1 -0
- package/dist/features/auth/index.js +1 -0
- package/dist/features/billing/components/ProductCard.js +1 -0
- package/dist/features/billing/components/SecurityNotice.js +1 -0
- package/dist/features/billing/components/StripeCheckoutButton.js +1 -0
- package/dist/features/billing/components/SubscriptionManager.js +1 -0
- package/dist/features/billing/components/index.js +1 -0
- package/dist/features/billing/index.js +1 -0
- package/dist/features/index.js +1 -0
- package/dist/features/oauth/components/MultipleOAuthProviders.js +1 -0
- package/dist/features/oauth/components/OAuthConnectionModal.js +1 -0
- package/dist/features/oauth/components/OAuthFallback.js +1 -0
- package/dist/features/oauth/components/OAuthPartnerButton.js +1 -0
- package/dist/features/oauth/components/index.js +1 -0
- package/dist/features/oauth/index.js +1 -0
- package/dist/firebase/authPersistence.js +1 -0
- package/dist/firebase/index.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/providers/ExpoAppProviders.js +1 -0
- package/dist/routing/components.js +1 -0
- package/dist/routing/hooks.d.ts +1 -1
- package/dist/routing/hooks.d.ts.map +1 -1
- package/dist/routing/hooks.js +1 -0
- package/dist/routing/index.js +1 -0
- package/dist/routing/utils/useFormStoreSafe.d.ts +5 -5
- package/dist/routing/utils/useFormStoreSafe.d.ts.map +1 -1
- package/dist/routing/utils/useFormStoreSafe.js +1 -0
- package/dist/storage/AsyncStorageStrategy.js +1 -0
- package/dist/storage/zustandAsyncStorage.js +1 -0
- package/dist/theme/ThemeProvider.js +1 -0
- package/dist/theme/index.js +1 -0
- package/dist/theme/tokens.js +1 -0
- package/dist/utils/constants.js +1 -0
- package/dist/utils/helpers.js +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/theme-helpers.js +1 -0
- package/dist/utils/useAuthSafe.js +1 -0
- package/dist/utils/variants.js +1 -0
- package/package.json +20 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n,jsxs as y}from"react/jsx-runtime";import{describe as d,it as o,expect as t,vi as c}from"vitest";import{render as l,fireEvent as h}from"@testing-library/react-native";import T from"../../atomic/Button";import s from"../../atomic/Text";import g from"../../atomic/Card";import a from"../../atomic/Input";import B from"../../atomic/Stack";d("Atomic Components",()=>{d("Button",()=>{o("renders without crashing",()=>{const{getByText:e}=l(n(T,{children:"Test Button"}));t(e("Test Button")).toBeTruthy()}),o("calls onPress when pressed",()=>{const e=c.fn(),{getByText:r}=l(n(T,{onPress:e,children:"Click me"})),i=r("Click me");h.press(i),t(e).toHaveBeenCalledTimes(1)}),o("does not call onPress when disabled",()=>{const e=c.fn(),{getByText:r}=l(n(T,{onPress:e,disabled:!0,children:"Disabled Button"})),i=r("Disabled Button");h.press(i),t(e).not.toHaveBeenCalled()}),o("shows loading state correctly",()=>{const{getByText:e,queryByText:r}=l(n(T,{loading:!0,loadingText:"Loading...",children:"Original Text"}));t(e("Loading...")).toBeTruthy(),t(r("Original Text")).toBeNull()}),o("does not call onPress when loading",()=>{const e=c.fn(),{getByText:r}=l(n(T,{onPress:e,loading:!0,children:"Loading Button"})),i=r("Loading Button");h.press(i),t(e).not.toHaveBeenCalled()})}),d("Text",()=>{o("renders text content",()=>{const{getByText:e}=l(n(s,{children:"Hello World"}));t(e("Hello World")).toBeTruthy()}),o("renders with different levels",()=>{const{getByText:e}=l(n(s,{level:"h1",children:"Heading"}));t(e("Heading")).toBeTruthy()})}),d("Card",()=>{o("renders card with title",()=>{const{getByText:e}=l(n(g,{title:"Card Title",children:"Content"}));t(e("Card Title")).toBeTruthy(),t(e("Content")).toBeTruthy()})}),d("Input",()=>{o("renders input with placeholder",()=>{const{getByPlaceholderText:e}=l(n(a,{placeholder:"Enter text"}));t(e("Enter text")).toBeTruthy()}),o("renders input with label",()=>{const{getByText:e}=l(n(a,{label:"Name"}));t(e("Name")).toBeTruthy()}),o("calls onChangeText when text changes",()=>{const e=c.fn(),{getByPlaceholderText:r}=l(n(a,{placeholder:"Enter text",onChangeText:e})),i=r("Enter text");h.changeText(i,"Hello"),t(e).toHaveBeenCalledWith("Hello"),t(e).toHaveBeenCalledTimes(1)}),o("displays error message when provided",()=>{const{getByText:e}=l(n(a,{label:"Email",error:"Invalid email format"}));t(e("Invalid email format")).toBeTruthy()}),o("shows required indicator when required",()=>{const{getByText:e}=l(n(a,{label:"Name",required:!0})),r=e("Name");t(r).toBeTruthy()}),o("does not call onChangeText when disabled",()=>{const e=c.fn(),{getByPlaceholderText:r}=l(n(a,{placeholder:"Enter text",onChangeText:e,disabled:!0})),i=r("Enter text");h.changeText(i,"Hello"),t(e).not.toHaveBeenCalled()})}),d("Stack",()=>{o("renders children",()=>{const{getByText:e}=l(y(B,{children:[n(s,{children:"Item 1"}),n(s,{children:"Item 2"})]}));t(e("Item 1")).toBeTruthy(),t(e("Item 2")).toBeTruthy()}),o("applies gap spacing correctly",()=>{const{UNSAFE_getByType:e}=l(y(B,{gap:20,children:[n(s,{children:"Item 1"}),n(s,{children:"Item 2"})]})),r=e(B);t(r.props.gap).toBe(20)}),o("handles direction prop correctly",()=>{const{UNSAFE_getByType:e}=l(y(B,{direction:"row",children:[n(s,{children:"Item 1"}),n(s,{children:"Item 2"})]})),r=e(B);t(r.props.direction).toBe("row")})}),d("Card",()=>{o("renders card with title and content",()=>{const{getByText:e}=l(n(g,{title:"Card Title",children:"Card Content"}));t(e("Card Title")).toBeTruthy(),t(e("Card Content")).toBeTruthy()}),o("renders card with subtitle when provided",()=>{const{getByText:e}=l(n(g,{title:"Title",subtitle:"Subtitle",children:"Content"}));t(e("Subtitle")).toBeTruthy()}),o("renders card without title when not provided",()=>{const{getByText:e,queryByText:r}=l(n(g,{children:"Content only"}));t(e("Content only")).toBeTruthy(),t(r(/Title/i)).toBeNull()})}),d("Text",()=>{o("applies correct level styling",()=>{const{UNSAFE_getByType:e}=l(n(s,{level:"h1",children:"Heading"})),r=e(s);t(r.props.level).toBe("h1")}),o("renders with different levels correctly",()=>{["h1","h2","h3","h4","body","small","caption"].forEach(e=>{const{getByText:r,unmount:i}=l(y(s,{level:e,children:["Test ",e]}));t(r(`Test ${e}`)).toBeTruthy(),i()})})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{describe as a,it as r,expect as t,beforeEach as c,vi as l}from"vitest";import{render as o}from"@testing-library/react-native";import{ExpoAppProviders as i,getZustandAsyncStorage as m}from"../../providers/ExpoAppProviders";import{getStorageManager as g}from"@donotdev/core";import{Text as n}from"react-native";a("ExpoAppProviders",()=>{c(()=>{l.clearAllMocks(),delete globalThis._DNDEV_CONFIG_}),r("renders children",()=>{const{getByText:e}=o(s(i,{children:s(n,{children:"Test Content"})}));t(e("Test Content")).toBeTruthy()}),r("initializes platform detection",async()=>{o(s(i,{children:s(n,{children:"Test"})})),await new Promise(e=>setTimeout(e,10)),t(globalThis._DNDEV_CONFIG_).toBeDefined(),t(globalThis._DNDEV_CONFIG_.platform).toBe("expo")}),r("sets AsyncStorageStrategy in StorageManager",async()=>{o(s(i,{userId:"user123",children:s(n,{children:"Test"})})),await new Promise(d=>setTimeout(d,10));const e=g();t(e).toBeDefined()}),r("handles userId prop",async()=>{o(s(i,{userId:"user123",children:s(n,{children:"Test"})})),await new Promise(e=>setTimeout(e,10)),t(globalThis._DNDEV_CONFIG_).toBeDefined()})}),a("getZustandAsyncStorage",()=>{r("returns zustandAsyncStorage instance",()=>{const e=m();t(e).toBeDefined(),t(e.getItem).toBeDefined(),t(e.setItem).toBeDefined(),t(e.removeItem).toBeDefined()})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"react";jest.mock("react-native",()=>{const t=require("react");return{View:t.forwardRef(({children:e,...s},r)=>t.createElement("View",{...s,ref:r},e)),Text:t.forwardRef(({children:e,...s},r)=>t.createElement("Text",{...s,ref:r},e)),TouchableOpacity:t.forwardRef(({children:e,onPress:s,...r},n)=>t.createElement("TouchableOpacity",{...r,ref:n,onPress:s},e)),ScrollView:t.forwardRef(({children:e,...s},r)=>t.createElement("ScrollView",{...s,ref:r},e)),TextInput:t.forwardRef((e,s)=>t.createElement("TextInput",{...e,ref:s})),Modal:({children:e,...s})=>t.createElement("Modal",s,e),ActivityIndicator:e=>t.createElement("ActivityIndicator",e),Switch:e=>t.createElement("Switch",e),Image:t.forwardRef((e,s)=>t.createElement("Image",{...e,ref:s})),Platform:{OS:"ios",select:jest.fn(e=>e.ios||e.default)},Linking:{openURL:jest.fn(()=>Promise.resolve())},Clipboard:{setString:jest.fn(()=>Promise.resolve()),getString:jest.fn(()=>Promise.resolve(""))},StyleSheet:{create:jest.fn(e=>e),absoluteFill:{}},Animated:{View:"Animated.View",Value:jest.fn(()=>({setValue:jest.fn(),addListener:jest.fn(),removeListener:jest.fn()})),timing:jest.fn(()=>({start:jest.fn(e=>e?.())}))}}}),jest.mock("@react-native-async-storage/async-storage",()=>{const t=new Map;return{__esModule:!0,default:{getItem:jest.fn(e=>Promise.resolve(t.get(e)||null)),setItem:jest.fn((e,s)=>(t.set(e,s),Promise.resolve())),removeItem:jest.fn(e=>(t.delete(e),Promise.resolve())),getAllKeys:jest.fn(()=>Promise.resolve(Array.from(t.keys()))),multiRemove:jest.fn(e=>(e.forEach(s=>t.delete(s)),Promise.resolve())),clear:jest.fn(()=>(t.clear(),Promise.resolve()))}}}),jest.mock("expo-router",()=>({useRouter:jest.fn(()=>({push:jest.fn(),replace:jest.fn(),back:jest.fn(),setParams:jest.fn()})),useLocalSearchParams:jest.fn(()=>({})),usePathname:jest.fn(()=>"/"),useSegments:jest.fn(()=>[]),Link:"Link",useNavigation:jest.fn(()=>({navigate:jest.fn(),goBack:jest.fn()}))})),jest.mock("expo-av",()=>({Video:"Video",ResizeMode:{CONTAIN:"contain",COVER:"cover",STRETCH:"stretch"}})),jest.mock("expo-clipboard",()=>({setStringAsync:jest.fn(()=>Promise.resolve()),getStringAsync:jest.fn(()=>Promise.resolve(""))})),jest.mock("expo-document-picker",()=>({getDocumentAsync:jest.fn(()=>Promise.resolve({canceled:!1,assets:[{uri:"file://test.pdf",name:"test.pdf",mimeType:"application/pdf",size:1024}]}))})),jest.mock("@react-native-community/datetimepicker",()=>({default:"DateTimePicker"})),jest.mock("react-native-safe-area-context",()=>({SafeAreaProvider:({children:t})=>t,useSafeAreaInsets:jest.fn(()=>({top:0,bottom:0,left:0,right:0}))})),jest.mock("firebase/auth",()=>({getAuth:jest.fn(()=>({})),initializeAuth:jest.fn(()=>({})),getReactNativePersistence:jest.fn(()=>({}))})),jest.mock("firebase/app",()=>({getApp:jest.fn(()=>({}))})),jest.mock("@tanstack/react-query",()=>({QueryClient:jest.fn(()=>({})),QueryClientProvider:({children:t})=>t})),beforeEach(()=>{delete globalThis._DNDEV_CONFIG_,delete globalThis._DNDEV_STORES_});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"@react-native-async-storage/async-storage";function c(){const t=new Map;return{getItem:async e=>t.get(e)||null,setItem:async(e,s)=>{t.set(e,s)},removeItem:async e=>{t.delete(e)},getAllKeys:async()=>Array.from(t.keys()),multiRemove:async e=>{e.forEach(s=>t.delete(s))},clear:async()=>{t.clear()},multiGet:async e=>e.map(s=>[s,t.get(s)||null]),multiSet:async e=>{e.forEach(([s,a])=>t.set(s,a))}}}function l(){jest.clearAllMocks(),delete globalThis._DNDEV_CONFIG_,delete globalThis._DNDEV_STORES_}function n(t){return new Promise(e=>setTimeout(e,t))}export{c as createMockAsyncStorage,l as resetMocks,n as waitFor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useState as C}from"react";import{TouchableOpacity as j,View as a}from"react-native";import{useTheme as w}from"../../theme";import d from"../Text";const V=({type:n="single",collapsible:g=!1,defaultValue:p,value:c,onValueChange:v,items:m,style:y,testID:e})=>{const{theme:s}=w(),h={borderBottomWidth:1,borderBottomColor:s.colors.border},f={paddingVertical:s.spacing.md,paddingHorizontal:s.spacing.md,flexDirection:"row",justifyContent:"space-between",alignItems:"center"},b={paddingHorizontal:s.spacing.md,paddingBottom:s.spacing.md},[$,x]=C(()=>p||(n==="multiple"?[]:"")),r=c??$,B=c!==void 0,D=t=>n==="single"?r===t:Array.isArray(r)&&r.includes(t),I=t=>{let i;if(n==="single"){if(r===t&&!g)return;i=r===t?"":t}else{const o=Array.isArray(r)?r:[];i=o.includes(t)?o.filter(A=>A!==t):[...o,t]}B||x(i),v?.(i)};return l(a,{style:y,testID:e,children:m.map((t,i)=>{const o=D(t.value);return u(a,{style:[h,i===m.length-1&&{borderBottomWidth:0}],testID:e?`${e}-item-${t.value}`:void 0,children:[u(j,{onPress:()=>I(t.value),style:f,activeOpacity:.7,testID:e?`${e}-trigger-${t.value}`:void 0,children:[l(a,{style:{flex:1},children:typeof t.trigger=="string"?l(d,{level:"h4",children:t.trigger}):t.trigger}),l(d,{level:"body",variant:"muted",children:o?"\u25BC":"\u25B6"})]}),o&&l(a,{style:b,testID:e?`${e}-content-${t.value}`:void 0,children:typeof t.content=="string"?l(d,{level:"body",children:t.content}):t.content})]},t.value)})})};var O=V;export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as d,jsxs as p}from"react/jsx-runtime";import{View as u}from"react-native";import{THEME_VARIANT as n}from"../../utils/constants";import{mergeStyles as g}from"../../utils/helpers";import{useTheme as b}from"../../theme";import f from"../Stack";import l from"../Text";const a={DEFAULT:n.MUTED,ERROR:"error",WARNING:n.WARNING,SUCCESS:n.SUCCESS,INFO:"info"},h={padding:16,borderRadius:8,borderWidth:1};function v(o){const{theme:c}=b(),r=c.colors,t={muted:{bg:r.muted,border:r.border,title:r.foreground,description:r.mutedForeground},error:{bg:r.destructive+"14",border:r.destructive+"40",title:r.destructive,description:r.destructive},warning:{bg:r.warning+"14",border:r.warning+"40",title:r.warningForeground,description:r.warning},success:{bg:r.success+"14",border:r.success+"40",title:r.success,description:r.success},info:{bg:r.primary+"14",border:r.primary+"40",title:r.primary,description:r.primary}},e=t[o]??t.muted;return{container:{backgroundColor:e.bg,borderColor:e.border},title:{color:e.title},description:{color:e.description}}}const y=({variant:o=a.DEFAULT,hideIcon:c,title:r,description:t,children:e,style:m,testID:i})=>{const s=v(o);return d(u,{style:g(h,s.container,m),testID:i,children:p(f,{gap:4,children:[r&&d(l,{level:"h4",style:s.title,testID:i?`${i}-title`:void 0,children:r}),t&&d(l,{level:"small",style:s.description,testID:i?`${i}-description`:void 0,children:t}),e]})})};var A=y;export{a as ALERT_VARIANT,A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as r,Fragment as R}from"react/jsx-runtime";import{useState as T}from"react";import{Modal as k,TouchableOpacity as a}from"react-native";import{mergeStyles as L}from"../../utils/helpers";import{useTheme as S}from"../../theme";import n from"../Stack";import p from"../Text";import v from"../Button";const q={flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)",justifyContent:"center",alignItems:"center"},A={borderRadius:12,padding:24,maxWidth:"90%",shadowOffset:{width:0,height:4},shadowOpacity:.3,shadowRadius:8,elevation:8},F=({trigger:s,title:f,description:d,cancelLabel:g="Cancel",confirmLabel:u,actionLabel:y="Confirm",onCancel:b,onAction:I,open:l,onOpenChange:c,style:D,testID:t})=>{const{theme:h}=S(),C={...A,backgroundColor:h.colors.background,shadowColor:h.colors.foreground},[$,m]=T(!1),i=l!==void 0,w=i?l:$,O=()=>{i||m(!0),c?.(!0)},e=()=>{i||m(!1),c?.(!1)},P=()=>{b?.(),e()},x=()=>{I?.(),e()};return r(R,{children:[s&&o(a,{onPress:O,testID:t?`${t}-trigger`:void 0,children:s}),o(k,{visible:w,transparent:!0,animationType:"fade",onRequestClose:e,testID:t,children:o(a,{style:q,activeOpacity:1,onPress:e,testID:t?`${t}-overlay`:void 0,children:o(a,{activeOpacity:1,onPress:j=>j.stopPropagation(),style:L(C,D),testID:t?`${t}-content`:void 0,children:r(n,{gap:16,children:[r(n,{gap:4,testID:t?`${t}-header`:void 0,children:[o(p,{level:"h3",testID:t?`${t}-title`:void 0,children:f}),d&&o(p,{level:"body",variant:"muted",testID:t?`${t}-description`:void 0,children:d})]}),r(n,{direction:"row",gap:8,justify:"flex-end",testID:t?`${t}-footer`:void 0,children:[o(v,{variant:"outline",onPress:P,testID:t?`${t}-cancel`:void 0,children:g}),o(v,{variant:"destructive",onPress:x,testID:t?`${t}-action`:void 0,children:u||y})]})]})})})})]})};var M=F;export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as l,jsxs as g}from"react/jsx-runtime";import{Image as p,View as y}from"react-native";import{useState as b,useEffect as v}from"react";import{mergeStyles as I}from"../../utils/helpers";import{useTheme as w}from"../../theme";import j from"../Text";const x=({src:r,fallback:a,size:e=40,children:m,style:n,testID:t})=>{const[o,s]=b(!1),{theme:d}=w(),i=d.colors;v(()=>{s(!1)},[r]);const c=!r||o,f={width:e,height:e,borderRadius:e/2,backgroundColor:i.muted,alignItems:"center",justifyContent:"center",overflow:"hidden"},u={width:e,height:e},h={fontSize:e*.4,fontWeight:"600",color:i.mutedForeground};return g(y,{style:I(f,n),testID:t,children:[r&&!o?l(p,{source:{uri:r},style:u,onError:()=>{s(!0)},testID:t?`${t}-image`:void 0}):null,c&&l(j,{level:"body",style:h,testID:t?`${t}-fallback`:void 0,children:a}),m]})};var D=x;export{D as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as d}from"react/jsx-runtime";import{View as s}from"react-native";import{THEME_VARIANT as i}from"../../utils/constants";import{mergeStyles as c}from"../../utils/helpers";import{useTheme as u}from"../../theme";import g from"../Text";const a={...i,OUTLINE:"outline"},l={paddingHorizontal:8,paddingVertical:4,borderRadius:12,alignSelf:"flex-start"};function b(o){const{theme:n}=u(),r=n.colors,t={default:{bg:r.muted,text:r.foreground},muted:{bg:r.mutedForeground,text:r.background},primary:{bg:r.primary,text:r.primaryForeground},secondary:{bg:r.secondary,text:r.secondaryForeground},accent:{bg:r.accent,text:r.accentForeground},success:{bg:r.success,text:r.successForeground},warning:{bg:r.warning,text:r.warningForeground},destructive:{bg:r.destructive,text:r.destructiveForeground},outline:{bg:"transparent",text:r.foreground,borderColor:r.border,borderWidth:1}},e=t[o]??t.default;return{container:{backgroundColor:e.bg,...e.borderColor?{borderColor:e.borderColor,borderWidth:e.borderWidth}:{}},text:{color:e.text}}}const m=({children:o,variant:n=a.DEFAULT,style:r,testID:t})=>{const e=b(n);return d(s,{style:c(l,e.container,r),testID:t,children:d(g,{level:"caption",style:e.text,testID:t?`${t}-text`:void 0,children:o})})};var x=m;export{a as BADGE_VARIANT,x as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as d}from"react/jsx-runtime";import{View as v}from"react-native";import{mergeStyles as b}from"../../utils/helpers";import{useTheme as h}from"../../theme";import s from"../Stack";import e from"../Text";const n={DEFAULT:"default",EDITORIAL:"editorial",TESTIMONIAL:"testimonial"},g={padding:16,borderLeftWidth:4,borderRadius:8},y=({children:m,author:i,source:a,cite:l,variant:u=n.DEFAULT,style:c,testID:t})=>{const{theme:p}=h(),r=p.colors,f={default:{backgroundColor:r.muted,borderLeftColor:r.primary},editorial:{backgroundColor:r.background,borderLeftColor:r.mutedForeground,paddingLeft:20},testimonial:{backgroundColor:r.primary+"14",borderLeftColor:r.primary,padding:20,borderRadius:12}}[u];return o(v,{style:b(g,f,c),testID:t,children:d(s,{gap:8,children:[o(e,{level:"body",style:{fontStyle:"italic"},testID:t?`${t}-quote`:void 0,children:m}),(i||a)&&d(s,{gap:2,testID:t?`${t}-attribution`:void 0,children:[i&&d(e,{level:"small",variant:"muted",testID:t?`${t}-author`:void 0,children:["\u2014 ",i]}),a&&o(e,{level:"caption",variant:"muted",testID:t?`${t}-source`:void 0,children:a})]}),l&&o(e,{level:"caption",variant:"muted",style:{fontStyle:"italic"},testID:t?`${t}-cite`:void 0,children:l})]})})};var I=y;export{n as BLOCKQUOTE_VARIANT,I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as a,Fragment as u}from"react/jsx-runtime";import{TouchableOpacity as V,ActivityIndicator as B,View as d}from"react-native";import{THEME_VARIANT as E}from"../../utils/constants";import{mergeStyles as N}from"../../utils/helpers";import{getButtonVariants as O,getButtonTextVariants as H}from"../../utils/variants";import{useTheme as j}from"../../theme";import y from"../Text";const v={...E,GHOST:"ghost",OUTLINE:"outline",LINK:"link"},C={opacity:.5},L=({children:f,variant:c=v.DEFAULT,icon:n,iconEnd:b,disabled:g=!1,loading:m=!1,loadingText:h,progress:o,fullWidth:T,onPress:I,style:x,testID:i})=>{const{theme:t}=j(),w=O(t),A=H(t),D=w[c],r=A[c],p={paddingHorizontal:t.spacing.md,paddingVertical:t.spacing.sm,borderRadius:t.radius.interactive,alignItems:"center",justifyContent:"center",minHeight:t.interactive.touchTarget,flexDirection:n?"row":void 0,gap:n?t.spacing.sm:void 0};T&&(p.width="100%");const R=()=>{if(m)return a(d,{style:{flexDirection:"row",alignItems:"center",gap:t.spacing.sm},children:[e(B,{color:r?.color,size:"small",testID:i?`${i}-loading`:void 0}),h&&e(y,{level:"body",style:r,children:h})]});const s=n||null,l=e(y,{level:"body",style:r,testID:i?`${i}-text`:void 0,children:f});return s&&b?a(u,{children:[l,s]}):s?a(u,{children:[s,l]}):l};return a(V,{style:N(p,D,g&&C,x),onPress:I,disabled:g||m,activeOpacity:.7,testID:i,children:[R(),o!==void 0&&o>0&&o<100&&e(d,{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"rgba(0,0,0,0.1)",borderBottomLeftRadius:t.radius.interactive,borderBottomRightRadius:t.radius.interactive,overflow:"hidden"},children:e(d,{style:{height:"100%",width:`${o}%`,backgroundColor:r?.color||t.colors.primary}})})]})};var k=L;export{v as BUTTON_VARIANT,k as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as m,jsxs as u}from"react/jsx-runtime";import{useState as D}from"react";import{View as c}from"react-native";import f from"@react-native-community/datetimepicker";import"../../utils/helpers";import"../Stack";import"../Text";import v from"../Button";const x=({value:e=new Date,onSelect:o,minDate:i,maxDate:s,mode:n="date",style:l,testID:t})=>{const[p,a]=D(!1),d=(h,r)=>{a(!1),r&&o&&o(r)};return u(c,{style:l,testID:t,children:[m(v,{variant:"outline",onPress:()=>a(!0),testID:t?`${t}-trigger`:void 0,children:e.toLocaleDateString()}),p&&m(f,{value:e,mode:n,display:"default",minimumDate:i,maximumDate:s,onChange:d,testID:t?`${t}-picker`:void 0})]})};var g=x;export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n,jsxs as o}from"react/jsx-runtime";import{View as g}from"react-native";import{mergeStyles as h}from"../../utils/helpers";import{useTheme as y}from"../../theme";import d from"../Stack";import c from"../Text";const I={padding:32,alignItems:"center"},x=e=>{switch(e){case"start":return{alignItems:"flex-start"};case"end":return{alignItems:"flex-end"};default:return{alignItems:"center"}}},v={default:"background",primary:"primary",accent:"accent",muted:"muted"},b=({title:e,subtitle:i,primaryAction:a,secondaryAction:s,tone:l="default",children:m,align:r="center",style:u,testID:t})=>{const{theme:f}=y(),p=l!=="default"?{backgroundColor:f.colors[v[l]]}:{};return n(g,{style:h(I,x(r),p,u),testID:t,children:m||o(d,{gap:16,align:r==="center"?"center":r==="start"?"flex-start":"flex-end",children:[e&&n(c,{level:"h2",testID:t?`${t}-title`:void 0,children:e}),i&&n(c,{level:"body",variant:"muted",testID:t?`${t}-subtitle`:void 0,children:i}),(a||s)&&o(d,{direction:"row",gap:12,testID:t?`${t}-actions`:void 0,children:[a,s]})]})})};var D=b;export{D as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as c}from"react/jsx-runtime";import{View as x,TouchableOpacity as C}from"react-native";import{SURFACE_VARIANT as O}from"../../utils/constants";import{mergeStyles as g}from"../../utils/helpers";import{getSurfaceVariants as T}from"../../utils/variants";import{useTheme as R}from"../../theme";import s from"../Stack";import i from"../Text";function v(e){return e?typeof e=="string"?r(i,{level:"small",testID:"card-content-text",children:e}):Array.isArray(e)?r(s,{gap:4,testID:"card-content-list",children:e.map((t,l)=>r(i,{level:"small",testID:`card-content-item-${l}`,children:t},l))}):e:null}function S({title:e,subtitle:t}){return!e&&!t?null:c(s,{gap:2,testID:"card-header",children:[e&&r(i,{level:"h4",testID:"card-title",children:e}),t&&r(i,{level:"small",variant:"muted",testID:"card-subtitle",children:t})]})}const V=({icon:e,title:t,subtitle:l,content:o,footer:D,variant:I=O.DEFAULT,clickable:y,elevated:n,onPress:d,children:b,style:m,testID:h})=>{const{theme:a}=R(),p=T(a)[I],w=o?v(o):b,u={padding:a.spacing.md,borderRadius:a.radius.surface,shadowColor:a.colors.foreground,shadowOffset:{width:0,height:n?4:2},shadowOpacity:n?a.opacity.subtle*2:a.opacity.subtle,shadowRadius:n?8:4,elevation:n?6:2},A=t||l||e?c(s,{direction:"row",gap:a.spacing.sm,align:"center",testID:"card-header",children:[e,c(s,{gap:2,flex:1,children:[t&&r(i,{level:"h4",testID:"card-title",children:t}),l&&r(i,{level:"small",variant:"muted",testID:"card-subtitle",children:l})]})]}):null,f=c(s,{gap:a.spacing.sm,children:[A,w,D]});return y||d?r(C,{style:g(u,p,m),onPress:d,activeOpacity:.7,testID:h,children:f}):r(x,{style:g(u,p,m),testID:h,children:f})};var j=V;export{j as default,v as renderCardContent,S as renderCardHeader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as l}from"react/jsx-runtime";import{TouchableOpacity as k,View as n}from"react-native";import{CONTROL_VARIANT as I}from"../../utils/constants";import{mergeStyles as D}from"../../utils/helpers";import{useTheme as T}from"../../theme";import w from"../Stack";import c from"../Text";const h=20,O=2,R={width:h,height:h,borderWidth:O,borderRadius:4,alignItems:"center",justifyContent:"center"},$={opacity:.5},j=({checked:i=!1,disabled:a=!1,variant:W=I.DEFAULT,onCheckedChange:d,label:m,children:b,required:p,style:g,testID:r})=>{const{theme:y}=T(),e=y.colors,u={backgroundColor:e.primary,borderColor:e.primary},v={backgroundColor:"transparent",borderColor:e.border},f={width:6,height:10,borderBottomWidth:2,borderRightWidth:2,borderColor:e.background,transform:[{rotate:"45deg"}],marginTop:-2},C=()=>{!a&&d&&d(!i)},s=o(k,{style:D(R,i?u:v,a&&$,g),onPress:C,disabled:a,activeOpacity:.7,testID:r,children:i&&o(n,{style:f,testID:r?`${r}-checkmark`:void 0})}),t=m||b;return t?l(w,{direction:"row",align:"center",gap:8,testID:r?`${r}-container`:void 0,children:[s,typeof t=="string"?l(c,{level:"body",testID:r?`${r}-label`:void 0,children:[t,p&&o(c,{level:"body",variant:"destructive",children:" *"})]}):o(n,{testID:r?`${r}-label`:void 0,children:t})]}):s};var x=j;export{x as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as a}from"react/jsx-runtime";import{useState as b}from"react";import{TouchableOpacity as w,View as d}from"react-native";import{mergeStyles as D}from"../../utils/helpers";import O from"../Stack";import x from"../Text";const S={overflow:"hidden"},$={paddingTop:8},j=({trigger:c,children:p,open:i,onOpenChange:m,defaultOpen:u=!1,disabled:o=!1,showIcon:f=!1,iconStyle:g="plus-minus",style:h,testID:t})=>{const[v,y]=b(u),s=i!==void 0,e=s?i:v,I=()=>{if(o)return;const l=!e;s||y(l),m?.(l)},n=f?g==="plus-minus"?e?"\u2212":"+":e?"\u25BC":"\u25B6":null;return a(d,{style:D(S,h),testID:t,children:[r(w,{onPress:I,disabled:o,activeOpacity:.7,testID:t?`${t}-trigger`:void 0,children:a(O,{direction:"row",align:"center",gap:8,children:[c,n&&r(x,{level:"body",variant:"muted",testID:t?`${t}-icon`:void 0,children:n})]})}),e&&r(d,{style:$,testID:t?`${t}-content`:void 0,children:p})]})};var B=j;export{B as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t,jsxs as d,Fragment as ie}from"react/jsx-runtime";import{useState as w,useMemo as z,useRef as le,useCallback as g,useEffect as ne}from"react";import{View as x,Modal as se,Pressable as E,TextInput as de,TouchableOpacity as I,ScrollView as ce,ActivityIndicator as ue}from"react-native";import{CONTROL_VARIANT as he}from"../../utils/constants";import{useTheme as pe}from"../../theme";import N from"../Stack";import c from"../Text";function me(a,n){const[T,h]=w(a);return ne(()=>{const s=setTimeout(()=>h(a),n);return()=>clearTimeout(s)},[a,n]),T}const be=({value:a,onValueChange:n,placeholder:T="Search...",options:h=[],disabled:s=!1,isLoading:H=!1,variant:ye=he.DEFAULT,emptyMessage:j="No results found",multiple:p=!1,creatable:F=!1,createLabel:M="Create",clearable:q=!1,label:k,required:_,style:U,testID:o,onOpenChange:y,allowCreate:X,onCreateOption:D,renderOption:V,maxHeight:Y=300,debounce:Z=150})=>{const{theme:r}=pe(),[u,A]=w(!1),[m,v]=w(""),S=me(m,Z),B=le(null),[f,G]=w({x:0,y:0,width:0,height:0}),J=F||X,L=g(()=>{s||B.current?.measureInWindow((e,l,R,ae)=>{G({x:e,y:l,width:R,height:ae}),A(!0),y?.(!0)})},[s,y]),i=g(()=>{A(!1),v(""),y?.(!1)},[y]),b=z(()=>a?Array.isArray(a)?a:[a]:[],[a]),O=z(()=>{if(!S)return h;const e=S.toLowerCase();return h.filter(l=>l.label.toLowerCase().includes(e)||l.description?.toLowerCase().includes(e))},[h,S]),$=g(e=>{if(p){const l=b.includes(e)?b.filter(R=>R!==e):[...b,e];n?.(l)}else n?.(e),i()},[p,b,n,i]),K=g(()=>{const e=m.trim();e&&(D?D(e):$(e),v(""),p||i())},[m,D,$,p,i]),Q=g(()=>{n?.(p?[]:""),v(""),i()},[p,n,i]),C=h.find(e=>e.value===(Array.isArray(a)?a[0]:a)),W=J&&m.trim()&&O.length===0,ee={minHeight:r.interactive.touchTarget,paddingHorizontal:r.spacing.md,borderWidth:1,borderColor:u?r.colors.ring:r.colors.border,borderRadius:r.radius.interactive||r.radius.md,backgroundColor:r.colors.card,flexDirection:"row",alignItems:"center"},re={flex:1,fontSize:r.typography.fontSize.base,lineHeight:r.typography.fontSize.base*r.typography.lineHeight.base,color:r.colors.foreground,paddingVertical:0},oe={position:"absolute",top:f.y+f.height+4,left:f.x,width:f.width,backgroundColor:r.colors.popover,borderRadius:r.radius.floating||r.radius.md,borderWidth:1,borderColor:r.colors.border,maxHeight:Y,shadowColor:r.colors.foreground,shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:8,elevation:8},P={paddingHorizontal:r.spacing.md,paddingVertical:r.spacing.md,borderBottomWidth:1,borderBottomColor:r.colors.border},te={backgroundColor:r.colors.muted};return d(x,{style:U,testID:o,children:[k&&d(c,{level:"small",style:{marginBottom:4},testID:o?`${o}-label`:void 0,children:[k,_&&t(c,{level:"small",variant:"destructive",children:" *"})]}),d(x,{ref:B,collapsable:!1,style:[ee,s&&{opacity:.5}],testID:o?`${o}-trigger`:void 0,children:[t(de,{style:re,placeholder:C&&!u?C.label:T,placeholderTextColor:C&&!u?r.colors.foreground:r.colors.mutedForeground,value:m,onChangeText:v,onFocus:L,editable:!s,accessibilityRole:"combobox",accessibilityState:{expanded:u,disabled:s},testID:o?`${o}-input`:void 0}),d(N,{direction:"row",align:"center",gap:4,children:[q&&C&&t(I,{onPress:Q,hitSlop:8,testID:o?`${o}-clear`:void 0,children:t(c,{level:"body",variant:"muted",children:"\u2715"})}),t(I,{onPress:()=>u?i():L(),hitSlop:8,disabled:s,children:t(c,{level:"body",variant:"muted",children:u?"\u25B2":"\u25BC"})})]})]}),t(se,{visible:u,transparent:!0,animationType:"none",onRequestClose:i,statusBarTranslucent:!0,children:t(E,{style:{flex:1},onPress:i,testID:o?`${o}-backdrop`:void 0,children:d(E,{style:oe,onPress:()=>{},testID:o?`${o}-dropdown`:void 0,children:[H&&t(x,{style:{paddingVertical:r.spacing.md,alignItems:"center"},children:t(ue,{color:r.colors.primary})}),!H&&t(ce,{keyboardShouldPersistTaps:"handled",nestedScrollEnabled:!0,children:O.length===0&&!W?t(x,{style:P,children:t(c,{level:"body",variant:"muted",children:j})}):d(ie,{children:[O.map(e=>{const l=b.includes(e.value);return t(I,{style:[P,l&&te,e.disabled&&{opacity:r.opacity.subtle}],onPress:()=>!e.disabled&&$(e.value),disabled:e.disabled,activeOpacity:.7,testID:o?`${o}-option-${e.value}`:void 0,children:V?V(e,l):d(N,{gap:2,children:[e.content??t(c,{level:"body",children:e.label}),e.description&&t(c,{level:"caption",variant:"muted",children:e.description})]})},e.value)}),W&&t(I,{style:P,onPress:K,activeOpacity:.7,testID:o?`${o}-create`:void 0,children:d(c,{level:"body",variant:"muted",children:[M,' "',m.trim(),'"']})})]})})]})})})]})};var ge=be;export{ge as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as l,jsxs as s}from"react/jsx-runtime";import{useState as I,useMemo as u}from"react";import{View as d,ScrollView as x,TouchableOpacity as v}from"react-native";import"../../utils/helpers";import g from"../Stack";import a from"../Text";import C from"../Input";import L from"../Separator";const p={paddingHorizontal:12,paddingVertical:10,flexDirection:"row",alignItems:"center",gap:8},S={paddingHorizontal:12,paddingVertical:8},V=({placeholder:f="Search...",emptyMessage:b="No results found.",groups:n=[],items:c=[],onClose:O,style:y,testID:i})=>{const[o,$]=I(""),m=u(()=>{if(!o)return n;const e=o.toLowerCase();return n.map(t=>({...t,items:t.items.filter(r=>r.label.toLowerCase().includes(e)||r.description?.toLowerCase().includes(e))})).filter(t=>t.items.length>0)},[n,o]),h=u(()=>{if(!o)return c;const e=o.toLowerCase();return c.filter(t=>t.label.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[c,o]),w=[...m.flatMap(e=>e.items),...h];return l(d,{style:y,testID:i,children:s(g,{gap:8,children:[l(C,{placeholder:f,value:o,onChangeText:$,testID:i?`${i}-search`:void 0}),l(x,{style:{maxHeight:400},children:s(g,{gap:4,children:[m.map((e,t)=>s(d,{testID:i?`${i}-group-${t}`:void 0,children:[e.separator&&t>0&&l(L,{testID:i?`${i}-separator-${t}`:void 0}),e.heading&&l(d,{style:S,testID:i?`${i}-heading-${t}`:void 0,children:l(a,{level:"small",variant:"muted",children:e.heading})}),e.items.map((r,D)=>s(v,{style:p,onPress:()=>!r.disabled&&r.onSelect?.(),disabled:r.disabled,activeOpacity:.7,testID:i?`${i}-item-${t}-${D}`:void 0,children:[r.icon,s(d,{style:{flex:1},children:[l(a,{level:"body",children:r.label}),r.description&&l(a,{level:"caption",variant:"muted",children:r.description})]}),r.badge,r.shortcut&&l(a,{level:"caption",variant:"muted",children:r.shortcut})]},r.value||r.label))]},t)),h.map((e,t)=>s(v,{style:p,onPress:()=>!e.disabled&&e.onSelect?.(),disabled:e.disabled,activeOpacity:.7,testID:i?`${i}-standalone-item-${t}`:void 0,children:[e.icon,s(d,{style:{flex:1},children:[l(a,{level:"body",children:e.label}),e.description&&l(a,{level:"caption",variant:"muted",children:e.description})]}),e.badge]},e.value||e.label)),w.length===0&&l(d,{style:p,testID:i?`${i}-empty`:void 0,children:l(a,{level:"body",variant:"muted",children:b})})]})})]})})};var H=V;export{H as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as g}from"react/jsx-runtime";import{useState as u,createContext as h,useContext as v}from"react";import{View as x}from"react-native";import D from"../Dialog";import I from"../Command";const l=h(null),j=()=>v(l)?.close||(()=>{}),P=({open:s,onOpenChange:o,trigger:m,description:d,children:p,footer:i,testID:e,...c})=>{const[C,n]=u(!1),t=s!==void 0,f=t?s:C,$=()=>{t||n(!0),o?.(!0)},a=()=>{t||n(!1),o?.(!1)};return r(l.Provider,{value:{close:a},children:g(D,{trigger:m,open:f,onOpenChange:o,title:"Command Palette",description:d,testID:e,children:[p||r(I,{...c,onClose:a,testID:e?`${e}-command`:void 0}),i&&r(x,{testID:e?`${e}-footer`:void 0,children:i})]})})};var O=P;export{O as default,j as useCommandDialogClose};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as d}from"react/jsx-runtime";import{useState as n}from"react";import{View as p,TouchableOpacity as s,Modal as b,StyleSheet as f}from"react-native";import"../../utils/helpers";import{useTheme as u}from"../../theme";import $ from"../Stack";import D from"../Text";import I from"../Separator";const w={paddingHorizontal:12,paddingVertical:10,flexDirection:"row",alignItems:"center",gap:8},x=({trigger:c,items:m=[],style:h,testID:e})=>{const{theme:i}=u(),[v,r]=n(!1),y={backgroundColor:i.colors.popover,borderRadius:i.radius.floating,borderWidth:1,borderColor:i.colors.border,shadowColor:i.colors.foreground,shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:4,elevation:5,minWidth:200},[l,g]=n({x:0,y:0});return d(p,{style:h,testID:e,children:[o(s,{onLongPress:t=>{g({x:t.nativeEvent.pageX,y:t.nativeEvent.pageY}),r(!0)},activeOpacity:.7,testID:e?`${e}-trigger`:void 0,children:c}),o(b,{visible:v,transparent:!0,animationType:"fade",onRequestClose:()=>r(!1),testID:e?`${e}-modal`:void 0,children:o(s,{style:f.absoluteFill,activeOpacity:1,onPress:()=>r(!1),testID:e?`${e}-overlay`:void 0,children:o(p,{style:[y,{position:"absolute",left:l.x-100,top:l.y-50}],testID:e?`${e}-menu`:void 0,children:o($,{gap:0,children:m.map((t,a)=>t.separator?o(I,{testID:e?`${e}-separator-${a}`:void 0},`separator-${a}`):d(s,{style:w,onPress:()=>{t.onSelect?.(),r(!1)},disabled:t.disabled,activeOpacity:.7,testID:e?`${e}-item-${a}`:void 0,children:[t.icon,o(D,{level:"body",style:t.disabled?{opacity:.5}:void 0,children:t.label})]},t.value||t.label))})})})})]})};var O=x;export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useState as d}from"react";import*as y from"expo-clipboard";import"react-native";import"../../utils/helpers";import f from"../Button";import h from"../Text";const x=({text:t,children:e,variant:i="ghost",onCopy:s,tooltipText:a="Copy to clipboard",copiedTooltipText:p="Copied!",style:m,testID:n,...c})=>{const[l,o]=d(!1);return r(f,{variant:i,onPress:async()=>{try{await y.setStringAsync(t),o(!0),s?.(t),setTimeout(()=>o(!1),2e3)}catch{__DEV__}},style:m,testID:n,...c,children:e||r(h,{level:"body",children:l?p:a})})};var u=x;export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as l,jsxs as h}from"react/jsx-runtime";import{View as r}from"react-native";import"../../utils/helpers";import{useTheme as p}from"../../theme";import"../Stack";import d from"../Text";const v={paddingVertical:8,borderBottomWidth:1},f={flexDirection:"row",justifyContent:"space-between",alignItems:"center"},u=({items:i,children:s,orientation:n="vertical",style:a,testID:t})=>{const{theme:m}=p(),c={borderBottomColor:m.colors.border};return s?l(r,{style:a,testID:t,children:s}):i?l(r,{style:a,testID:t,children:i.map((o,e)=>h(r,{style:[v,c,n==="horizontal"&&f,e===i.length-1&&{borderBottomWidth:0}],testID:t?`${t}-item-${e}`:void 0,children:[l(d,{level:"body",variant:"muted",testID:t?`${t}-label-${e}`:void 0,children:o.label}),l(r,{style:n==="horizontal"&&{flex:1,alignItems:"flex-end"},children:typeof o.value=="string"?l(d,{level:"body",testID:t?`${t}-value-${e}`:void 0,children:o.value}):o.value})]},e))}):null};var y=u;export{y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as d,Fragment as T}from"react/jsx-runtime";import{useState as j,cloneElement as k,isValidElement as A}from"react";import{Modal as E,TouchableOpacity as h,View as I,useWindowDimensions as S}from"react-native";import{SURFACE_VARIANT as F}from"../../utils/constants";import{mergeStyles as V}from"../../utils/helpers";import{useTheme as U}from"../../theme";import m from"../Stack";import w from"../Text";import f from"../Button";const q={flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)",justifyContent:"center",alignItems:"center"},z=(r,o)=>{switch(r){case"form":return{width:Math.min(400,o*.9)};case"text":return{width:Math.min(600,o*.9)};case"image":return{width:Math.min(800,o*.95)};case"code":return{width:Math.min(900,o*.95)};case"full":return{width:"95%",height:"95%"};default:return{width:"auto",maxWidth:"90%"}}},H=({trigger:r,title:o,description:l,children:D,open:u,onOpenChange:v,contentSize:y="auto",variant:W=F.DEFAULT,actions:i,footer:n,style:$,closeText:b="Close",testID:t})=>{const{theme:s}=U(),{width:C}=S(),[x,g]=j(!1),c=u!==void 0,P=c?u:x,p=()=>{c||g(!0),v?.(!0)},a=()=>{c||g(!1),v?.(!1)},O=z(y,C),M={backgroundColor:s.colors.card,borderRadius:s.radius.surface,padding:s.spacing.lg,maxHeight:"90%",shadowColor:s.colors.foreground,shadowOffset:{width:0,height:4},shadowOpacity:.3,shadowRadius:8,elevation:8};return d(T,{children:[r&&(A(r)?k(r,{onPress:p,testID:t?`${t}-trigger`:void 0}):e(h,{onPress:p,testID:t?`${t}-trigger`:void 0,children:r})),e(E,{visible:P,transparent:!0,animationType:"fade",onRequestClose:a,testID:t,children:e(h,{style:q,activeOpacity:1,onPress:a,testID:t?`${t}-overlay`:void 0,children:e(h,{activeOpacity:1,onPress:R=>R.stopPropagation(),style:V(M,O,$),testID:t?`${t}-content`:void 0,children:d(m,{gap:16,children:[(o||l)&&d(m,{gap:4,testID:t?`${t}-header`:void 0,children:[o&&e(w,{level:"h3",testID:t?`${t}-title`:void 0,children:o}),l&&e(w,{level:"body",variant:"muted",testID:t?`${t}-description`:void 0,children:l})]}),e(I,{testID:t?`${t}-body`:void 0,children:D}),n&&e(I,{testID:t?`${t}-footer`:void 0,children:n}),!n&&i&&d(m,{direction:"row",gap:12,justify:"flex-end",testID:t?`${t}-actions`:void 0,children:[i.cancel&&e(f,{variant:"outline",onPress:()=>{i.cancel?.onClick?.(),a()},testID:t?`${t}-cancel`:void 0,children:i.cancel.label}),i.confirm&&e(f,{variant:i.confirm.variant||"default",onPress:()=>{i.confirm?.onClick?.()},testID:t?`${t}-confirm`:void 0,children:i.confirm.label})]}),!n&&!i&&e(f,{variant:"outline",onPress:a,testID:t?`${t}-close`:void 0,children:b})]})})})})]})};var L=H;export{L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as h}from"react/jsx-runtime";import{useState as C}from"react";import{View as p,TouchableOpacity as f,ScrollView as W}from"react-native";import{mergeStyles as V}from"../../utils/helpers";import{useTheme as j}from"../../theme";import k from"../Stack";import P from"../Text";import R from"../Separator";const T={borderRadius:8,borderWidth:1,shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:4,elevation:5,minWidth:200},z={paddingHorizontal:12,paddingVertical:10,flexDirection:"row",alignItems:"center",gap:8},H=({trigger:g,children:v,items:b=[],content:u,contentWidth:s,contentAlign:n="start",open:d,onOpenChange:l,style:y,testID:t})=>{const{theme:i}=j(),w={...T,backgroundColor:i.colors.background,borderColor:i.colors.border,shadowColor:i.colors.foreground},[$,c]=C(!1),r=d!==void 0,m=r?d:$,x=()=>{const e=!m;r||c(e),l?.(e)},D=()=>{r||c(!1),l?.(!1)},I=g||v,O=n==="end"?{alignSelf:"flex-end"}:n==="center"?{alignSelf:"center"}:{alignSelf:"flex-start"},S=s?{width:s,minWidth:void 0}:{};return h(p,{style:y,testID:t,children:[o(f,{onPress:x,activeOpacity:.7,testID:t?`${t}-trigger`:void 0,children:I}),m&&o(p,{style:V(w,O,S),testID:t?`${t}-menu`:void 0,children:o(W,{children:u||o(k,{gap:0,children:b.map((e,a)=>e.separator?o(R,{testID:t?`${t}-separator-${a}`:void 0},`separator-${a}`):h(f,{style:z,onPress:()=>{e.onSelect?.(),D()},disabled:e.disabled,activeOpacity:.7,testID:t?`${t}-item-${a}`:void 0,children:[e.icon,o(P,{level:"body",style:e.disabled?{opacity:.5}:void 0,children:e.label})]},e.value||e.label))})})})]})};var A=H;export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as C}from"react/jsx-runtime";import{View as i,TouchableOpacity as h}from"react-native";import{SURFACE_VARIANT as w}from"../../utils/constants";import"../../utils/helpers";import"../../utils/variants";import{useTheme as x}from"../../theme";import"../Card";import A from"../Separator";import"../Stack";import f from"../Card";const $={flexDirection:"column"},O=({leftTitle:m,leftSubtitle:p,leftContent:v,leftCTA:u,rightTitle:y,rightSubtitle:D,rightContent:I,rightCTA:g,variant:s=w.DEFAULT,elevated:T=!1,children:l,onClick:r,style:o,testID:t})=>{const{theme:n}=x(),a=T?{shadowColor:n.colors.foreground,shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12,elevation:8}:{},b={flexDirection:"row",gap:n.spacing.md};if(l){const d=e(i,{style:[a],testID:t,children:l});return r?e(h,{onPress:r,activeOpacity:.7,style:o,testID:t?`${t}-button`:void 0,children:d}):e(i,{style:o,children:d})}const c=C(i,{style:[b,$,a],testID:t,children:[e(i,{style:{flex:1},testID:t?`${t}-left`:void 0,children:e(f,{title:m,subtitle:p,content:v,variant:s,testID:t?`${t}-left-card`:void 0,children:u})}),e(A,{orientation:"vertical",testID:t?`${t}-separator`:void 0}),e(i,{style:{flex:1},testID:t?`${t}-right`:void 0,children:e(f,{title:y,subtitle:D,content:I,variant:s,testID:t?`${t}-right-card`:void 0,children:g})})]});return r?e(h,{onPress:r,activeOpacity:.7,style:o,testID:t?`${t}-button`:void 0,children:c}):e(i,{style:o,children:c})};var j=O;export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as p}from"react/jsx-runtime";import{Component as u}from"react";import{View as i}from"react-native";import n from"../Text";import v from"../Stack";import f from"../Card";import D from"../Button";const d=({children:r,featureName:a,message:o,icon:s,showActionButton:m=!1,actionButtonText:h="Go Back",helpText:l,style:c,testID:t})=>r?e(i,{style:c,testID:t,children:r}):e(i,{style:[{alignItems:"center",justifyContent:"center"},c],testID:t,children:e(f,{testID:t?`${t}-card`:void 0,children:p(v,{gap:12,align:"center",children:[s&&e(i,{testID:t?`${t}-icon`:void 0,children:s}),a&&e(n,{level:"h3",testID:t?`${t}-feature-name`:void 0,children:a}),o&&e(n,{level:"body",variant:"muted",testID:t?`${t}-message`:void 0,children:o}),l&&e(n,{level:"caption",variant:"muted",testID:t?`${t}-help`:void 0,children:l}),m&&e(D,{variant:"outline",testID:t?`${t}-action`:void 0,children:h})]})})});class I extends u{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(a,o){}render(){return this.state.hasError?e(d,{children:this.props.fallback}):this.props.children}}const y=(r,a)=>{const o=s=>e(I,{fallback:a,children:e(r,{...s})});return o.displayName=`withFeatureFallback(${r.displayName||r.name||"Component"})`,o};var $=d;export{$ as default,y as withFeatureFallback};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import"react";import"react-native";import*as l from"expo-document-picker";import"../../utils/helpers";import n from"../Button";const y=({onFileSelect:s,accept:i,multiple:a=!1,children:o,style:c,testID:m,...p})=>r(n,{onPress:async()=>{try{const t=await l.getDocumentAsync({type:i?.join(","),multiple:a});!t.canceled&&t.assets&&t.assets.forEach(e=>{s?.({uri:e.uri,name:e.name||"file",type:e.mimeType||"application/octet-stream",size:e.size||0})})}catch{__DEV__}},style:c,testID:m,...p,children:o});var f=y;export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as f}from"react/jsx-runtime";import p from"react";import{View as d,useWindowDimensions as y}from"react-native";import{mergeStyles as h}from"../../utils/helpers";const m=[768,1024,1440],w={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"},g={start:"flex-start",center:"center",end:"flex-end","space-between":"space-between","space-around":"space-around"},D=({cols:e=1,gap:t=16,align:r,justify:n,children:s,style:a,testID:l})=>{const{width:i}=y(),o=typeof e=="number"?e:i<m[0]?e[0]:i<m[1]?e[1]:i<m[2]?e[2]:e[3],u={flexDirection:"row",flexWrap:"wrap",marginHorizontal:-(t/2),...r&&{alignItems:w[r]},...n&&{justifyContent:g[n]}},x=`${100/o}%`;return f(d,{style:h(u,a),testID:l,children:p.Children.map(s,c=>p.isValidElement(c)?f(d,{style:{width:x,paddingHorizontal:t/2,marginBottom:t},children:c}):c)})},I={auto:"auto",start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"},S={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"},b=({name:e,children:t,alignSelf:r,justifySelf:n,overflow:s,min:a,style:l,testID:i})=>{const o={...r&&{alignSelf:I[r]},...n&&{alignSelf:S[n]},...s&&s!=="auto"&&{overflow:s},...a!==void 0&&typeof a=="number"&&{minWidth:a}};return f(d,{style:h(o,l),testID:i,children:t})};var j=D;export{b as GridArea,j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as c}from"react/jsx-runtime";import{View as a}from"react-native";import{mergeStyles as f}from"../../utils/helpers";import g from"../Stack";import d from"../Text";import h from"../Badge";const p={padding:48,alignItems:"center",justifyContent:"center"},u=r=>{switch(r){case"start":return{alignItems:"flex-start"};case"end":return{alignItems:"flex-end"};default:return{alignItems:"center"}}},v=({badge:r,title:s,subtitle:l,fullHeight:m=!1,align:i="center",variant:x="primary",children:n,style:o,testID:t})=>e(a,{style:f(p,u(i),m&&{minHeight:"100%"},o),testID:t,children:c(g,{gap:16,align:i==="center"?"center":i==="start"?"flex-start":"flex-end",children:[r&&e(h,{variant:"primary",testID:t?`${t}-badge`:void 0,children:r}),s&&e(d,{level:"h1",testID:t?`${t}-title`:void 0,children:s}),l&&e(d,{level:"h3",variant:"muted",testID:t?`${t}-subtitle`:void 0,children:l}),n&&e(a,{testID:t?`${t}-children`:void 0,children:n})]})});var I=v;export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as g}from"react/jsx-runtime";import"react";import"react-native";import"../../utils/helpers";import l from"../Popover";const d=({trigger:e,children:t,content:n,open:i,onOpenChange:o,align:r,side:s,sideOffset:p,style:a,testID:f})=>g(l,{trigger:e,content:n,open:i,onOpenChange:o,align:r,side:s,sideOffset:p,style:a,testID:f,children:t});var m=d;export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as m,jsx as e}from"react/jsx-runtime";import"react-native";import{MaterialIcons as n}from"@expo/vector-icons";const i=({name:o,size:s=24,color:a="#111827",component:t,style:r,testID:l})=>t?e(m,{children:t}):e(n,{name:o||"help-outline",size:s,color:a,style:r,testID:l});var c=i;export{c as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as g}from"react/jsx-runtime";import{useRef as u}from"react";import{ScrollView as v}from"react-native";import{mergeStyles as x}from"../../utils/helpers";import y from"../Spinner";import l from"../Stack";const S=({loading:o=!1,hasMore:s=!1,onLoadMore:r,threshold:n=200,children:i,style:a,testID:t,...m})=>{const c=u(null);return e(v,{ref:c,onScroll:f=>{if(!s||o||!r)return;const{layoutMeasurement:h,contentOffset:d,contentSize:p}=f.nativeEvent;p.height-(h.height+d.y)<n&&r()},scrollEventThrottle:16,style:x({flex:1},a),testID:t,...m,children:g(l,{gap:8,children:[i,o&&e(l,{align:"center",testID:t?`${t}-loading`:void 0,children:e(y,{})})]})})};var I=S;export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,jsxs as n}from"react/jsx-runtime";import{TextInput as x,View as a}from"react-native";import{mergeStyles as m}from"../../utils/helpers";import{useTheme as S}from"../../theme";import s from"../Text";import I from"../Stack";function z(e){return{container:{minHeight:e.interactive.touchTarget,paddingHorizontal:e.spacing.md,paddingVertical:e.spacing.sm,borderWidth:1,borderColor:e.colors.border,borderRadius:e.radius.md,backgroundColor:e.colors.input},text:{fontSize:e.typography.fontSize.base,lineHeight:e.typography.fontSize.base*e.typography.lineHeight.base,color:e.colors.foreground},label:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,color:e.colors.mutedForeground,marginBottom:e.spacing.sm/2},error:{fontSize:e.typography.fontSize.xs,color:e.colors.destructive,marginTop:e.spacing.sm/2},errorContainer:{borderColor:e.colors.destructive},placeholderColor:e.colors.mutedForeground}}const C=({label:e,placeholder:g,icon:o,iconEnd:c=!1,disabled:d=!1,required:h=!1,error:l,containerStyle:y,inputStyle:u,name:$,type:T,checked:H,max:W,min:j,step:k,style:f,testID:t,...v})=>{const{theme:p}=S(),r=z(p),b=!!l;return n(I,{gap:p.spacing.sm/2,style:y,testID:t,children:[e&&n(s,{level:"small",style:r.label,testID:t?`${t}-label`:void 0,children:[e,h&&i(s,{level:"small",variant:"destructive",children:" *"})]}),n(a,{style:m(r.container,b&&r.errorContainer,d&&{opacity:.5},o?{flexDirection:"row",alignItems:"center"}:void 0),testID:t?`${t}-container`:void 0,children:[o&&!c&&i(a,{style:{marginRight:8},testID:t?`${t}-icon`:void 0,children:o}),i(x,{style:m(r.text,o?{flex:1}:void 0,u,f),placeholder:g,placeholderTextColor:r.placeholderColor,editable:!d,...v,testID:t?`${t}-input`:void 0}),o&&c&&i(a,{style:{marginLeft:8},testID:t?`${t}-icon`:void 0,children:o})]}),l&&i(s,{level:"caption",variant:"destructive",style:r.error,testID:t?`${t}-error`:void 0,children:l})]})};var D=C;export{D as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as f}from"react/jsx-runtime";import{View as o}from"react-native";import{mergeStyles as h}from"../../utils/helpers";import{useTheme as p}from"../../theme";import u from"../Stack";import s from"../Text";const v={fontSize:14,fontWeight:"500"},g={fontWeight:"400"},D=({children:l,icon:t,iconEnd:i=!1,plain:n=!1,required:c=!1,style:m,testID:e})=>{const{theme:d}=p(),a={color:d.colors.foreground};return f(u,{direction:"row",align:"center",gap:4,testID:e,children:[t&&!i&&r(o,{testID:e?`${e}-icon`:void 0,children:t}),r(s,{level:"small",style:h(v,a,n&&g,m),children:l}),t&&i&&r(o,{testID:e?`${e}-icon`:void 0,children:t}),c&&r(s,{level:"small",variant:"destructive",testID:e?`${e}-required`:void 0,children:"*"})]})};var I=D;export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as p}from"react/jsx-runtime";import{View as n}from"react-native";import{mergeStyles as f}from"../../utils/helpers";import{useTheme as I}from"../../theme";import y from"../Stack";import h from"../Text";const R={flexDirection:"row",alignItems:"flex-start"},j={width:6,height:6,borderRadius:3,marginTop:8,marginRight:8},w={compact:2,default:4,comfortable:8},T={compact:0,default:0,comfortable:4},V=({items:u=[],ordered:v=!1,icon:a,density:d="default",children:m,gap:b,style:c,testID:o})=>{const{theme:x}=I(),D={backgroundColor:x.colors.mutedForeground},g=b??w[d],i=T[d];return m?r(y,{gap:g,style:f(i?{paddingVertical:i}:void 0,c),testID:o,children:m}):r(y,{gap:g,style:f(i?{paddingVertical:i}:void 0,c),testID:o,children:u.map((t,s)=>{let e,l;return typeof t=="string"?(e=t,l=a):typeof t=="object"&&t!==null&&"content"in t?(e=t.content,l=t.icon||a):e=t,p(n,{style:R,testID:o?`${o}-item-${s}`:void 0,children:[v?p(h,{level:"body",variant:"muted",style:{marginRight:8},children:[s+1,"."]}):l?r(n,{style:{marginRight:8},children:l}):r(n,{style:[j,D]}),typeof e=="string"?r(h,{level:"body",style:{flex:1},children:e}):r(n,{style:{flex:1},children:e})]},s)})})};var S=V;export{S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,Fragment as f,jsxs as b}from"react/jsx-runtime";import{View as g,TouchableOpacity as x}from"react-native";import"../../utils/helpers";import{useTheme as D}from"../../theme";import I from"../Stack";import $ from"../Text";const n={paddingHorizontal:16,paddingVertical:12,flexDirection:"row",alignItems:"center",gap:8},w=({items:s=[],value:d,onValueChange:m,vertical:c=!1,orientation:p,LinkComponent:r,children:v,style:h,testID:t})=>{const{theme:u}=D(),y=c||p==="vertical",a={borderBottomWidth:2,borderBottomColor:u.colors.primary};return i(g,{style:h,testID:t,children:v||i(I,{direction:y?"column":"row",gap:0,children:s.map(e=>{const o=d===e.value,l=b(f,{children:[e.icon,i($,{level:"body",variant:o?"primary":"default",style:e.disabled?{opacity:.5}:void 0,children:e.label})]});return r&&e.href?i(r,{href:e.href,style:[n,o&&a],testID:t?`${t}-item-${e.value}`:void 0,children:l},e.value):i(x,{style:[n,o&&a],onPress:()=>{e.onPress?.(),m?.(e.value)},disabled:e.disabled,activeOpacity:.7,testID:t?`${t}-item-${e.value}`:void 0,children:l},e.value)})})})};var j=w;export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as l,jsxs as x}from"react/jsx-runtime";import{useMemo as M}from"react";import"react-native";import"../../utils/helpers";import P from"../Stack";import d from"../Button";import $ from"../Text";const w=({currentPage:i,totalPages:s,onPageChange:c,maxVisible:n=5,showNavigation:v=!0,previousLabel:b="Previous",nextLabel:f="Next",pageSize:p,total:h,itemsPerPagePlaceholder:S,showingLabel:m,style:D,testID:e})=>{const I=(()=>{const r=[],a=Math.floor(n/2);let t=Math.max(1,i-a),o=Math.min(s,t+n-1);o-t<n-1&&(t=Math.max(1,o-n+1)),t>1&&(r.push(1),t>2&&r.push("..."));for(let u=t;u<=o;u++)r.push(u);return o<s&&(o<s-1&&r.push("..."),r.push(s)),r})(),g=M(()=>{if(!m||!p||!h)return null;const r=(i-1)*p+1,a=Math.min(i*p,h);return m.replace("{from}",String(r)).replace("{to}",String(a)).replace("{total}",String(h))},[m,p,h,i]);return x(P,{gap:8,style:D,testID:e,children:[x(P,{direction:"row",align:"center",gap:8,children:[v&&l(d,{variant:"outline",onPress:()=>c(i-1),disabled:i===1,testID:e?`${e}-previous`:void 0,children:b}),I.map((r,a)=>{if(r==="...")return l($,{level:"body",variant:"muted",testID:e?`${e}-ellipsis-${a}`:void 0,children:"..."},`ellipsis-${a}`);const t=r;return l(d,{variant:t===i?"primary":"outline",onPress:()=>c(t),testID:e?`${e}-page-${t}`:void 0,children:t},t)}),v&&l(d,{variant:"outline",onPress:()=>c(i+1),disabled:i===s,testID:e?`${e}-next`:void 0,children:f})]}),g&&l($,{level:"caption",variant:"muted",testID:e?`${e}-showing`:void 0,children:g})]})};var y=w;export{y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as a}from"react/jsx-runtime";import{useState as C}from"react";import{TextInput as z,View as D,TouchableOpacity as I}from"react-native";import{mergeStyles as u}from"../../utils/helpers";import{useTheme as T}from"../../theme";import i from"../Text";import E from"../Stack";function $(e){return{container:{minHeight:e.interactive.touchTarget,paddingHorizontal:e.spacing.md,paddingVertical:e.spacing.sm,borderWidth:1,borderColor:e.colors.border,borderRadius:e.radius.md,backgroundColor:e.colors.input,flexDirection:"row",alignItems:"center"},text:{fontSize:e.typography.fontSize.base,lineHeight:e.typography.fontSize.base*e.typography.lineHeight.base,color:e.colors.foreground,flex:1},toggleButton:{padding:e.spacing.sm/2,marginLeft:e.spacing.sm},label:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,color:e.colors.mutedForeground,marginBottom:e.spacing.sm/2},error:{fontSize:e.typography.fontSize.xs,color:e.colors.destructive,marginTop:e.spacing.sm/2},errorContainer:{borderColor:e.colors.destructive},placeholderColor:e.colors.mutedForeground}}const H=({visible:e,onVisibilityChange:s,label:c,error:l,required:h,disabled:d=!1,containerStyle:y,inputStyle:f,name:V,type:W,checked:j,max:k,min:w,step:P,style:b,testID:t,...p})=>{const[v,x]=C(!1),n=e??v,F=!!l,S=()=>{const g=!n;s?s(g):x(g)},{theme:m}=T(),r=$(m);return a(E,{gap:m.spacing.sm/2,style:y,testID:t,children:[c&&a(i,{level:"small",style:r.label,testID:t?`${t}-label`:void 0,children:[c,h&&o(i,{level:"small",variant:"destructive",children:" *"})]}),a(D,{style:u(r.container,F&&r.errorContainer,d&&{opacity:.5}),testID:t?`${t}-container`:void 0,children:[o(z,{style:u(r.text,f,b),placeholder:p.placeholder,placeholderTextColor:r.placeholderColor,secureTextEntry:!n,editable:!d,...p,testID:t?`${t}-input`:void 0}),o(I,{onPress:S,style:r.toggleButton,testID:t?`${t}-toggle`:void 0,children:o(i,{level:"body",variant:"muted",children:n?"\u{1F441}\uFE0F":"\u{1F441}\uFE0F\u200D\u{1F5E8}\uFE0F"})})]}),l&&o(i,{level:"caption",variant:"destructive",style:r.error,testID:t?`${t}-error`:void 0,children:l})]})};var B=H;export{B as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,Fragment as A,jsxs as m}from"react/jsx-runtime";import{useState as R}from"react";import{View as g,TouchableOpacity as p}from"react-native";import{FLOATING_VARIANT as f}from"../../utils/constants";import{useTheme as D}from"../../theme";const C=f,P=({trigger:h,children:u,content:b,open:a,onOpenChange:v,side:o="bottom",align:s="center",sideOffset:r=4,modal:I=!1,variant:V=f.DEFAULT,style:O,testID:e})=>{const{theme:t}=D(),[y,w]=R(!1),n=a!==void 0,d=n?a:y,l=()=>{const c=!d;n||w(c),v?.(c)},T={backgroundColor:t.colors.popover,borderRadius:t.radius.floating||t.radius.md,padding:t.spacing.md,borderWidth:1,borderColor:t.colors.border,shadowColor:t.colors.foreground,shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:4,elevation:5,position:"absolute",zIndex:t.zIndex.dropdown,marginTop:o==="bottom"?r:0,marginBottom:o==="top"?r:0,marginLeft:o==="right"?r:0,marginRight:o==="left"?r:0,...s==="start"&&{alignSelf:"flex-start"},...s==="end"&&{alignSelf:"flex-end"},...s==="center"&&{alignSelf:"center"}},x=h||u;return m(g,{style:O,testID:e,children:[i(p,{onPress:l,activeOpacity:.7,testID:e?`${e}-trigger`:void 0,children:x}),d&&m(A,{children:[I&&i(p,{style:{position:"absolute",top:-9999,left:-9999,right:-9999,bottom:-9999},onPress:l,activeOpacity:1,testID:e?`${e}-overlay`:void 0}),i(g,{style:T,testID:e?`${e}-content`:void 0,children:b})]})]})};var S=P;export{C as POPOVER_VARIANT,S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as a,jsx as t}from"react/jsx-runtime";import"react-native";const e=({children:r,container:i})=>t(a,{children:r});var o=e;export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,Fragment as d,jsxs as m}from"react/jsx-runtime";import{useState as p}from"react";import{Modal as f,TouchableOpacity as r}from"react-native";import"../../utils/helpers";import y from"../Button";const h={flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)",justifyContent:"center",alignItems:"center"},u={backgroundColor:"#ffffff",borderRadius:12,padding:24,maxWidth:"90%",maxHeight:"90%"},g=({portalContent:a,children:s,style:n,testID:t,...i})=>{const[l,o]=p(!1);return m(d,{children:[e(y,{onPress:()=>o(!0),style:n,testID:t,...i,children:s}),e(f,{visible:l,transparent:!0,animationType:"fade",onRequestClose:()=>o(!1),testID:t?`${t}-modal`:void 0,children:e(r,{style:h,activeOpacity:1,onPress:()=>o(!1),testID:t?`${t}-overlay`:void 0,children:e(r,{activeOpacity:1,onPress:c=>c.stopPropagation(),style:u,testID:t?`${t}-content`:void 0,children:a})})})]})};var v=g;export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as d,jsxs as f}from"react/jsx-runtime";import{View as s}from"react-native";import{mergeStyles as g}from"../../utils/helpers";import{useTheme as p}from"../../theme";const y={height:8,borderRadius:4,overflow:"hidden"},v={height:"100%",borderRadius:4},x=({value:t=0,max:a=100,variant:l="default",getValueLabel:i,children:m,style:c,testID:r})=>{const{theme:u}=p(),e=u.colors,o={default:e.primary,primary:e.primary,success:e.success,warning:e.warning,destructive:e.destructive},n=Math.min(Math.max(t/a*100,0),100),h=o[l]||o.default,b=i?i(t,a):void 0;return f(s,{testID:r,children:[d(s,{style:g(y,{backgroundColor:e.muted},c),accessibilityRole:"progressbar",accessibilityValue:{min:0,max:a,now:t,text:b},testID:r?`${r}-track`:void 0,children:d(s,{style:[v,{width:`${n}%`,backgroundColor:h}],testID:r?`${r}-bar`:void 0})}),m]})};var w=x;export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,jsxs as d}from"react/jsx-runtime";import{View as a,TouchableOpacity as C}from"react-native";import{CONTROL_VARIANT as D}from"../../utils/constants";import"../../utils/helpers";import{useTheme as I}from"../../theme";import w from"../Stack";import R from"../Text";const l=20,T=2,x={flexDirection:"row",alignItems:"center",gap:8},O={width:l,height:l,borderRadius:l/2,borderWidth:T,alignItems:"center",justifyContent:"center"},$={opacity:.5},j=({value:n,onValueChange:c,items:m=[],variant:V=D.DEFAULT,disabled:p=!1,orientation:u="vertical",required:q=!1,children:h,style:v,testID:r})=>{const{theme:y}=I(),o=y.colors,b={borderColor:o.primary},f={borderColor:o.border},g={width:10,height:10,borderRadius:5,backgroundColor:o.primary};return i(a,{accessibilityRole:"radiogroup",style:v,testID:r,children:d(w,{gap:8,direction:u==="horizontal"?"row":"column",children:[m.map(e=>{const s=n===e.value,t=p||e.disabled;return d(C,{onPress:()=>!t&&c?.(e.value),disabled:t,activeOpacity:.7,style:x,testID:r?`${r}-item-${e.value}`:void 0,children:[i(a,{style:[O,s?b:f,t&&$],children:s&&i(a,{style:g,testID:r?`${r}-indicator-${e.value}`:void 0})}),i(R,{level:"body",style:t?{opacity:.5}:void 0,children:e.label})]},e.value)}),h]})})};var A=j;export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,jsxs as c}from"react/jsx-runtime";import{View as v}from"react-native";import"../../utils/helpers";import r from"../Input";import y from"../Button";import f from"../Stack";const D={flexDirection:"row",gap:8,alignItems:"flex-end"},g=({label:s,minPlaceholder:p="Min",maxPlaceholder:x="Max",minValue:l="",maxValue:t="",actualMin:$,actualMax:M,disabled:a=!1,min:T,max:C,placeholder:n,required:j=!1,step:k,onChange:d,onClear:h,children:u,style:m,testID:e})=>{const b=l||t;return c(f,{gap:8,style:a?{...m,opacity:.5}:m,testID:e,children:[s&&i(r,{label:s,value:`${l||""} - ${t||""}`,editable:!1,testID:e?`${e}-label`:void 0}),c(v,{style:D,testID:e?`${e}-inputs`:void 0,children:[i(r,{placeholder:n||p,value:l,onChangeText:o=>!a&&d(o,t),keyboardType:"numeric",editable:!a,containerStyle:{flex:1},testID:e?`${e}-min`:void 0}),i(r,{placeholder:n||x,value:t,onChangeText:o=>!a&&d(l,o),keyboardType:"numeric",editable:!a,containerStyle:{flex:1},testID:e?`${e}-max`:void 0}),i(y,{variant:"ghost",onPress:h,disabled:a||!b,testID:e?`${e}-clear`:void 0,children:"\xD7"})]}),u]})};var I=g;export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s,jsxs as I}from"react/jsx-runtime";import{TouchableOpacity as A,View as D,StyleSheet as N}from"react-native";import{CONTROL_VARIANT as O}from"../../utils/constants";import{mergeStyles as R}from"../../utils/helpers";import"../Stack";import l from"../Text";const c=24,d=N.create({container:{flexDirection:"row",alignItems:"center",gap:4},star:{width:c,height:c}}),f={default:"#f59e0b",muted:"#9ca3af",primary:"#3b82f6",secondary:"#6366f1",accent:"#8b5cf6",success:"#10b981",warning:"#f59e0b",destructive:"#ef4444"};function S(e,t){return t>=e?"filled":t>=e-.5?"half":"empty"}const T=({value:e=0,onChange:t,max:m=5,readonly:u=!1,disabled:y=!1,variant:h=O.WARNING,showValue:p=!1,children:b,style:v,testID:a})=>{const g=f[h]||f.warning,i=!u&&!y&&!!t,w=o=>{i&&t?.(o)};return I(D,{style:R(d.container,v),testID:a,children:[Array.from({length:m}).map((o,x)=>{const r=x+1,n=S(r,e);return s(A,{onPress:()=>w(r),disabled:!i,activeOpacity:.7,testID:a?`${a}-star-${r}`:void 0,children:s(l,{level:"body",style:{...d.star,color:n==="empty"?"#d1d5db":g},children:n==="filled"?"\u2605":"\u2606"})},r)}),p&&s(l,{level:"body",variant:"muted",testID:a?`${a}-value`:void 0,children:e.toFixed(1)}),b]})};var j=T;export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,Fragment as i}from"react/jsx-runtime";import{ScrollView as c}from"react-native";import{mergeStyles as n}from"../../utils/helpers";const m=({children:r,showHorizontal:l,showVertical:t,style:s,testID:e,...a})=>o(c,{style:n({flex:1},s),testID:e,showsHorizontalScrollIndicator:l,showsVerticalScrollIndicator:t,...a,children:r}),h=({children:r})=>o(i,{children:r});var d=m;export{h as ScrollBar,d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useState as C}from"react";import{View as d,TouchableOpacity as V}from"react-native";import{mergeStyles as B}from"../../utils/helpers";import i from"../Stack";import c from"../Text";import P from"../Separator";const T={paddingVertical:16},k={start:"flex-start",center:"center",end:"flex-end"},q=({title:o,subtitle:a,children:y,showSeparator:D=!1,separator:p,collapsible:n=!1,defaultCollapsed:I=!0,tone:A="default",align:m,open:v,onOpenChange:b,defaultOpen:h,actions:s,style:x,testID:t})=>{const $=h!==void 0?!h:I,[w,O]=C(n?$:!1),f=v!==void 0,l=f?!v:w,j=p!==void 0?p:D,S=()=>{const u=!l;f||O(u),b?.(!u)},g=r(i,{gap:4,testID:t?`${t}-header`:void 0,children:[r(i,{direction:"row",align:"center",justify:"space-between",children:[r(i,{gap:4,style:{flex:1},children:[o&&r(i,{direction:"row",align:"center",gap:8,style:m?{alignSelf:k[m]}:void 0,children:[e(c,{level:"h2",testID:t?`${t}-title`:void 0,children:o}),n&&e(c,{level:"body",variant:"muted",children:l?"\u25B6":"\u25BC"})]}),a&&e(c,{level:"small",variant:"muted",testID:t?`${t}-subtitle`:void 0,children:a})]}),s&&!l&&e(d,{testID:t?`${t}-actions`:void 0,children:s})]}),j&&e(P,{testID:t?`${t}-separator`:void 0})]});return e(d,{style:B(T,x),testID:t,children:r(i,{gap:12,children:[(o||a||s)&&(n?e(V,{onPress:S,activeOpacity:.7,testID:t?`${t}-toggle`:void 0,children:g}):g),!l&&e(d,{testID:t?`${t}-content`:void 0,children:y})]})})};var z=q;export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,jsxs as v}from"react/jsx-runtime";import{useState as O,useRef as T,useCallback as x,useMemo as D}from"react";import{Animated as u,Dimensions as ce,FlatList as ue,Modal as pe,Pressable as Q,TextInput as he,TouchableOpacity as U,View as w}from"react-native";import{useTheme as ge}from"../../theme";import p from"../Text";function X(o){return o.length>0&&o[0]!=null&&"options"in o[0]}function me(o){if(o.length===0)return[];if(X(o)){const l=[];for(const a of o){l.push({type:"group",label:a.label});for(const c of a.options)l.push({type:"option",option:c})}return l}return o.map(l=>({type:"option",option:l}))}function be(o){return o.length===0?[]:X(o)?o.flatMap(l=>l.options):o}function ye(o,l){if(!l)return o;const a=l.toLowerCase(),c=[];let h=null,g=!1;for(const y of o)y.type==="group"?(h=y,g=!1):(y.option.label.toLowerCase().includes(a)||(y.option.description?.toLowerCase().includes(a)??!1))&&(h&&!g&&(c.push(h),g=!0),c.push(y));return c}const fe=({value:o,onValueChange:l,placeholder:a="Select an option...",options:c=[],disabled:h=!1,label:g,required:y,style:_,testID:n,searchable:I=!1,searchPlaceholder:Z="Search...",multiple:m=!1,maxHeight:H=300,emptyMessage:ee="No results found",onOpenChange:V})=>{const{theme:e}=ge(),[z,P]=O(!1),[k,B]=O(""),[b,oe]=O({x:0,y:0,width:0,height:0}),C=T(new u.Value(0)).current,f=T(new u.Value(-8)).current,W=T(null),R=T(null),s=D(()=>o?Array.isArray(o)?o:[o]:[],[o]),F=D(()=>be(c),[c]),j=D(()=>me(c),[c]),L=D(()=>ye(j,k),[j,k]),$=D(()=>{if(s.length===0)return a;if(!m)return F.find(r=>r.value===s[0])?.label??a;const t=s.map(r=>F.find(d=>d.value===r)?.label).filter(Boolean);return t.length===0?a:t.length<=2?t.join(", "):`${t[0]}, ${t[1]} +${t.length-2}`},[s,F,a,m]),te=s.length>0&&$!==a,N=ce.get("window").height,M=N-(b.y+b.height),q=M<H+20&&b.y>M,re=x(()=>{W.current&&W.current.measureInWindow((t,r,d,de)=>{oe({x:t,y:r,width:d,height:de}),P(!0),V?.(!0),B(""),u.parallel([u.timing(C,{toValue:1,duration:e.duration.fast,useNativeDriver:!0}),u.timing(f,{toValue:0,duration:e.duration.fast,useNativeDriver:!0})]).start(()=>{I&&setTimeout(()=>R.current?.focus(),50)})})},[C,f,e.duration.fast,I,V]),S=x(()=>{u.parallel([u.timing(C,{toValue:0,duration:e.duration.fast,useNativeDriver:!0}),u.timing(f,{toValue:-8,duration:e.duration.fast,useNativeDriver:!0})]).start(()=>{P(!1),V?.(!1),B("")})},[C,f,e.duration.fast,V]),A=x(t=>{if(m){const r=s.includes(t)?s.filter(d=>d!==t):[...s,t];l?.(r)}else l?.(t),S()},[m,s,l,S]),ie={minHeight:e.interactive.touchTarget,paddingHorizontal:e.spacing.md,paddingVertical:10,borderWidth:1,borderColor:e.colors.border,borderRadius:e.radius.interactive||e.radius.md,backgroundColor:e.colors.card,flexDirection:"row",justifyContent:"space-between",alignItems:"center"},le={position:"absolute",width:b.width,start:b.x,...q?{bottom:N-b.y+4}:{top:b.y+b.height+4},maxHeight:H,backgroundColor:e.colors.popover,borderRadius:e.radius.floating||e.radius.md,borderWidth:1,borderColor:e.colors.border,shadowColor:e.colors.foreground,shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12,elevation:8,overflow:"hidden"},ne={paddingHorizontal:e.spacing.md,paddingVertical:e.spacing.sm,borderBottomWidth:1,borderBottomColor:e.colors.border,fontSize:e.typography.fontSize.sm,color:e.colors.foreground},E={paddingHorizontal:e.spacing.md,paddingVertical:e.spacing.sm+2,flexDirection:"row",alignItems:"center"},K={paddingHorizontal:e.spacing.md,paddingTop:e.spacing.sm+2,paddingBottom:4},Y=18,G={width:Y,height:Y,borderRadius:4,borderWidth:1.5,borderColor:e.colors.border,alignItems:"center",justifyContent:"center",marginEnd:e.spacing.sm},J={backgroundColor:e.colors.primary,borderColor:e.colors.primary},ae=x((t,r)=>t.type==="group"?`group-${r}`:`option-${t.option.value}`,[]),se=x(({item:t})=>{if(t.type==="group")return i(w,{style:K,children:i(p,{level:"caption",style:{color:e.colors.mutedForeground,fontWeight:e.typography.fontWeight.semibold,textTransform:"uppercase",letterSpacing:.5},children:t.label})});const{option:r}=t,d=s.includes(r.value);return v(U,{style:[E,d&&!m&&{backgroundColor:e.colors.muted},r.disabled&&{opacity:e.opacity.subtle}],onPress:()=>!r.disabled&&A(r.value),disabled:r.disabled,activeOpacity:.6,accessibilityRole:"menuitem",accessibilityState:{selected:d,disabled:r.disabled},testID:n?`${n}-option-${r.value}`:void 0,children:[m&&i(w,{style:[G,d&&J],children:d&&i(p,{level:"caption",style:{color:e.colors.primaryForeground,fontSize:12,lineHeight:14},children:"\u2713"})}),v(w,{style:{flex:1},children:[i(p,{level:"body",style:{color:e.colors.popoverForeground},children:r.label}),r.description&&i(p,{level:"caption",style:{color:e.colors.mutedForeground,marginTop:2},children:r.description})]}),!m&&d&&i(p,{level:"body",style:{color:e.colors.primary,marginStart:e.spacing.sm},children:"\u2713"})]})},[s,m,A,e,n,K,E,G,J]);return v(w,{style:_,testID:n,children:[g&&v(p,{level:"small",style:{marginBottom:4},testID:n?`${n}-label`:void 0,children:[g,y&&i(p,{level:"small",variant:"destructive",children:" *"})]}),i(w,{ref:W,collapsable:!1,children:v(U,{style:[ie,h&&{opacity:e.opacity.muted}],onPress:()=>!h&&re(),disabled:h,activeOpacity:.7,accessibilityRole:"button",accessibilityState:{expanded:z,disabled:h},accessibilityLabel:g?`${g}: ${$}`:$,testID:n?`${n}-trigger`:void 0,children:[i(p,{level:"body",style:{color:te?e.colors.foreground:e.colors.mutedForeground,flex:1},children:$}),i(p,{level:"body",style:{color:e.colors.mutedForeground},children:z?"\u25B2":"\u25BC"})]})}),i(pe,{visible:z,transparent:!0,animationType:"none",onRequestClose:S,statusBarTranslucent:!0,children:i(Q,{style:{flex:1,backgroundColor:"transparent"},onPress:S,accessibilityRole:"none",children:i(u.View,{style:[le,{opacity:C,transform:[{translateY:q?u.multiply(f,-1):f}]}],accessibilityRole:"menu",testID:n?`${n}-dropdown`:void 0,children:v(Q,{children:[I&&i(he,{ref:R,style:ne,value:k,onChangeText:B,placeholder:Z,placeholderTextColor:e.colors.mutedForeground,autoCorrect:!1,autoCapitalize:"none",returnKeyType:"done",testID:n?`${n}-search`:void 0}),L.length===0?i(w,{style:{paddingHorizontal:e.spacing.md,paddingVertical:e.spacing.md},children:i(p,{level:"body",style:{color:e.colors.mutedForeground},children:ee})}):i(ue,{data:L,keyExtractor:ae,renderItem:se,style:{maxHeight:H-(I?44:0)},keyboardShouldPersistTaps:"handled",bounces:!1})]})})})})]})};var ve=fe;export{ve as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as m}from"react/jsx-runtime";import{View as t,StyleSheet as u}from"react-native";import{mergeStyles as c}from"../../utils/helpers";import b from"../Text";const o={HORIZONTAL:"horizontal",VERTICAL:"vertical"},r=u.create({horizontal:{height:1,width:"100%",backgroundColor:"#e5e7eb"},vertical:{width:1,height:"100%",backgroundColor:"#e5e7eb"},inlineContainer:{flexDirection:"row",alignItems:"center",width:"100%",gap:12},inlineLine:{flex:1,height:1,backgroundColor:"#e5e7eb"}}),d={default:"#e5e7eb",muted:"#9ca3af",primary:"#3b82f6",accent:"#8b5cf6"},f=({orientation:n=o.HORIZONTAL,variant:h="default",children:a,style:l,testID:s})=>{const i=d[h]||d.default;return a&&n===o.HORIZONTAL?m(t,{style:c(r.inlineContainer,l),testID:s,children:[e(t,{style:[r.inlineLine,{backgroundColor:i}]}),e(b,{level:"small",variant:"muted",children:a}),e(t,{style:[r.inlineLine,{backgroundColor:i}]})]}):e(t,{style:c(r[n],{backgroundColor:i},l),testID:s})};var g=f;export{o as SEPARATOR_ORIENTATION,g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as a,Fragment as x}from"react/jsx-runtime";import{useState as A}from"react";import{Modal as L,TouchableOpacity as f,View as d,StyleSheet as O}from"react-native";import{SURFACE_VARIANT as b}from"../../utils/constants";import{mergeStyles as S}from"../../utils/helpers";import{useTheme as B}from"../../theme";import g from"../Stack";import v from"../Text";import E from"../Button";const F=b,P={flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)"},V=(s,i,o,l)=>{const r={backgroundColor:i.card,padding:l,shadowColor:i.foreground,shadowOffset:{width:0,height:-2},shadowOpacity:.25,shadowRadius:8,elevation:8};switch(s){case"top":return{...r,position:"absolute",top:0,left:0,right:0,borderBottomLeftRadius:o,borderBottomRightRadius:o};case"bottom":return{...r,position:"absolute",bottom:0,left:0,right:0,borderTopLeftRadius:o,borderTopRightRadius:o};case"left":return{...r,position:"absolute",left:0,top:0,bottom:0,width:"80%",borderTopRightRadius:o,borderBottomRightRadius:o};default:return{...r,position:"absolute",right:0,top:0,bottom:0,width:"80%",borderTopLeftRadius:o,borderBottomLeftRadius:o}}},j=({trigger:s,title:i,description:o,children:l,open:r,onOpenChange:u,side:y="right",showOverlay:R=!0,footer:n,variant:_=b.DEFAULT,closeLabel:I="Close",style:D,testID:t})=>{const{theme:h}=B(),[w,m]=A(!1),c=r!==void 0,T=c?r:w,$=()=>{c||m(!0),u?.(!0)},p=()=>{c||m(!1),u?.(!1)},C=V(y,h.colors,h.radius.surface,h.spacing.lg);return a(x,{children:[s&&e(f,{onPress:$,testID:t?`${t}-trigger`:void 0,children:s}),e(L,{visible:T,transparent:!0,animationType:"slide",onRequestClose:p,testID:t,children:a(d,{style:P,testID:t?`${t}-overlay`:void 0,children:[R&&e(f,{style:O.absoluteFill,activeOpacity:1,onPress:p,testID:t?`${t}-overlay-touch`:void 0}),e(d,{style:S(C,D),testID:t?`${t}-content`:void 0,children:a(g,{gap:16,style:{flex:1},children:[(i||o)&&a(g,{gap:4,testID:t?`${t}-header`:void 0,children:[i&&e(v,{level:"h3",testID:t?`${t}-title`:void 0,children:i}),o&&e(v,{level:"body",variant:"muted",testID:t?`${t}-description`:void 0,children:o})]}),e(d,{style:{flex:1},testID:t?`${t}-body`:void 0,children:l}),n&&e(d,{testID:t?`${t}-footer`:void 0,children:n}),!n&&e(E,{variant:"outline",onPress:p,testID:t?`${t}-close`:void 0,children:I})]})})]})})]})};var k=j;export{F as SHEET_VARIANT,k as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as h}from"react/jsx-runtime";import{View as c,Animated as e}from"react-native";import{useEffect as f,useRef as v}from"react";import{mergeStyles as y}from"../../utils/helpers";const m={text:{height:16,width:"100%"},heading:{height:24,width:"100%"},avatar:{height:40,width:40,borderRadius:20},button:{height:44,width:"100%"},card:{height:128,width:"100%"},image:{height:192,width:"100%"},custom:{width:"100%"}},V={backgroundColor:"#e5e7eb",borderRadius:4},b=({variant:t="pulse",size:n="custom",width:g,height:l,lines:s=1,style:p,testID:i})=>{const a=v(new e.Value(0)).current;f(()=>{(t==="pulse"||t==="shimmer")&&e.loop(e.sequence([e.timing(a,{toValue:1,duration:1e3,useNativeDriver:!0}),e.timing(a,{toValue:0,duration:1e3,useNativeDriver:!0})])).start()},[t,a]);const u=a.interpolate({inputRange:[0,1],outputRange:t==="pulse"?[.5,1]:[.3,.7]}),r=m[n]??m.custom,w={width:g??r.width,height:l??r.height},d=y(V,r,w,p);return s>1&&n==="text"?h(c,{testID:i,children:Array.from({length:s}).map((R,o)=>h(e.View,{style:[d,{opacity:t==="none"?1:u},o<s-1&&{marginBottom:8}],testID:i?`${i}-line-${o}`:void 0},o))}):h(e.View,{style:[d,{opacity:t==="none"?1:u}],testID:i})};var D=b;export{D as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,jsxs as c}from"react/jsx-runtime";import{useState as O,useRef as l,useCallback as D}from"react";import{View as s,PanResponder as X}from"react-native";import{CONTROL_VARIANT as z}from"../../utils/constants";import{useTheme as B}from"../../theme";import F from"../Stack";import G from"../Text";const M={default:"#3b82f6",muted:"#9ca3af",primary:"#3b82f6",secondary:"#6366f1",accent:"#8b5cf6",success:"#10b981",warning:"#f59e0b",destructive:"#ef4444"},H=({value:S,defaultValue:C,min:e=0,max:n=100,step:d=1,onValueChange:m,variant:k=z.DEFAULT,disabled:u=!1,orientation:W="horizontal",minStepsBetweenThumbs:_,inverted:T=!1,showValue:$=!1,children:E,style:h,testID:t})=>{const{theme:L}=B(),f=M[k]||M.default,[P,V]=O(C??e),p=S??P,v=l(0),b=D(a=>{const r=Math.min(n,Math.max(e,a));return Math.round((r-e)/d)*d+e},[e,n,d]),g=D((a,r)=>{const N=Math.max(0,Math.min(1,(a-r)/v.current)),x=b(e+N*(n-e));V(x),m?.(x)},[e,n,b,m]),y=l(null),R=l(0),A=l(X.create({onStartShouldSetPanResponder:()=>!u,onMoveShouldSetPanResponder:()=>!u,onPanResponderGrant:a=>{y.current?.measureInWindow(r=>{R.current=r,g(a.nativeEvent.pageX,r)})},onPanResponderMove:a=>{g(a.nativeEvent.pageX,R.current)}})).current,j=a=>{v.current=a.nativeEvent.layout.width},w=(p-e)/(n-e)*100,I=T?100-w:w,o=20;return c(F,{gap:8,style:u?{...h,opacity:.5}:h,testID:t,children:[c(s,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[c(s,{ref:y,onLayout:j,style:{flex:1,height:o,justifyContent:"center"},...A.panHandlers,testID:t?`${t}-track`:void 0,children:[i(s,{style:{height:4,backgroundColor:L.colors.border,borderRadius:2}}),i(s,{style:{position:"absolute",left:0,height:4,width:`${I}%`,backgroundColor:f,borderRadius:2},testID:t?`${t}-fill`:void 0}),i(s,{style:{position:"absolute",left:`${I}%`,marginLeft:-o/2,width:o,height:o,borderRadius:o/2,backgroundColor:f},testID:t?`${t}-thumb`:void 0})]}),$&&i(G,{level:"body",variant:"muted",testID:t?`${t}-value`:void 0,children:p})]}),E]})};var U=H;export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{View as p,StyleSheet as a}from"react-native";import{mergeStyles as n}from"../../utils/helpers";const f=({children:e,style:r,...s})=>{if(typeof e=="object"&&e!==null&&"props"in e){const t=e.props||{},l=n(t.style,a.flatten(r));return{...e,props:{...t,...s,style:l}}}return o(p,{style:r,...s,children:e})};var i=f;export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{ActivityIndicator as n,View as u}from"react-native";import{THEME_VARIANT as d}from"../../utils/constants";import{mergeStyles as y}from"../../utils/helpers";import{useTheme as p}from"../../theme";const f={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.3)",alignItems:"center",justifyContent:"center",zIndex:9999},g=({overlay:c=!1,variant:m=d.PRIMARY,size:r="small",style:o,testID:s})=>{const{theme:l}=p(),t=l.colors,a={default:t.mutedForeground,muted:t.mutedForeground,primary:t.primary,secondary:t.secondary,accent:t.accent,success:t.success,warning:t.warning,destructive:t.destructive},i=a[m]||a.primary;return c?e(u,{style:y(f,o),testID:s,children:e(n,{size:r,color:i})}):e(n,{size:r,color:i,style:o,testID:s})};var I=g;export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";import{View as A}from"react-native";import{mergeStyles as N}from"../../utils/helpers";const a={ROW:"row",COLUMN:"column"},n={START:"flex-start",CENTER:"center",END:"flex-end",STRETCH:"stretch",BASELINE:"baseline"},l={START:"flex-start",CENTER:"center",END:"flex-end",SPACE_BETWEEN:"space-between",SPACE_AROUND:"space-around",SPACE_EVENLY:"space-evenly"},x=({children:o,direction:E=a.COLUMN,align:T=n.STRETCH,justify:f=l.START,gap:i=0,wrap:c,flex:r,centered:s,style:C,overflow:t,testID:S})=>{const e={flexDirection:E,alignItems:s?"center":T,justifyContent:s?"center":f,gap:i};return c&&(e.flexWrap="wrap"),r!==void 0&&(e.flex=r),t&&t!=="auto"&&(e.overflow=t),p(A,{style:N(e,C),testID:S,children:o})};var R=x;export{n as STACK_ALIGN,a as STACK_DIRECTION,l as STACK_JUSTIFY,R as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n,jsxs as i}from"react/jsx-runtime";import{useState as C}from"react";import{View as d}from"react-native";import{THEME_VARIANT as T}from"../../utils/constants";import"../../utils/helpers";import l from"../Stack";import a from"../Text";import u from"../Button";import j from"../Card";const N={width:32,height:32,borderRadius:16,backgroundColor:"#e5e7eb",alignItems:"center",justifyContent:"center"},k={backgroundColor:"#3b82f6"},A=({steps:o,defaultStep:v=0,showStepNumbers:b=!0,showNavigation:I=!1,showStepInfo:y=!1,stepInfoTemplate:p,previousLabel:D="Previous",nextLabel:$="Next",variant:P=T.DEFAULT,onStepChange:m,style:w,testID:t})=>{const[e,f]=C(v),S=()=>{if(e>0){const r=e-1;f(r),m?.(r)}},x=()=>{if(e<o.length-1){const r=e+1;f(r),m?.(r)}},s=o[e];return s?n(d,{style:w,testID:t,children:i(l,{gap:16,children:[n(l,{direction:"row",align:"center",gap:8,testID:t?`${t}-indicators`:void 0,children:o.map((r,h)=>{const c=h===e,g=h<e;return i(d,{style:{flex:1,alignItems:"center"},children:[n(d,{style:[N,c&&k,g&&{backgroundColor:"#10b981"}],testID:t?`${t}-indicator-${r.number}`:void 0,children:b&&n(a,{level:"caption",style:{color:c||g?"#ffffff":"#6b7280"},children:r.number})}),r.title&&n(a,{level:"caption",variant:c?"primary":"muted",style:{marginTop:4},children:r.title})]},r.number)})}),y&&n(a,{level:"small",variant:"muted",testID:t?`${t}-info`:void 0,children:p?p.replace("{current}",String(e+1)).replace("{total}",String(o.length)):`Step ${e+1} of ${o.length}`}),n(j,{testID:t?`${t}-content`:void 0,children:i(l,{gap:8,children:[n(a,{level:"h3",children:s.title}),s.content]})}),I&&i(l,{direction:"row",gap:8,justify:"space-between",testID:t?`${t}-navigation`:void 0,children:[n(u,{variant:"outline",onPress:S,disabled:e===0,testID:t?`${t}-previous`:void 0,children:D}),n(u,{variant:"primary",onPress:x,disabled:e===o.length-1,testID:t?`${t}-next`:void 0,children:$})]})]})}):null};var E=A;export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as a,jsxs as p}from"react/jsx-runtime";import{Switch as g}from"react-native";import{CONTROL_VARIANT as y}from"../../utils/constants";import"../../utils/helpers";import{useTheme as f}from"../../theme";import k from"../Stack";import c from"../Text";function C(){const{theme:t}=f(),e=t.colors;return{default:{true:e.primary,false:e.border},primary:{true:e.primary,false:e.border},secondary:{true:e.secondary,false:e.border},accent:{true:e.accent,false:e.border},success:{true:e.success,false:e.border},warning:{true:e.warning,false:e.border},destructive:{true:e.destructive,false:e.border},muted:{true:e.mutedForeground,false:e.border}}}const D=({checked:t=!1,disabled:e=!1,variant:b=y.DEFAULT,onCheckedChange:h,label:l,uncheckedLabel:o,checkedLabel:s,required:w=!1,children:i,style:n,testID:r})=>{const{theme:v}=f(),u=C(),d=u[b]??u.default,m=a(g,{value:t,onValueChange:h,disabled:e,trackColor:{false:d.false,true:d.true},thumbColor:v.colors.background,ios_backgroundColor:d.false,style:n,testID:r});return l||o||s||i?p(k,{direction:"row",align:"center",gap:8,style:n,testID:r?`${r}-container`:void 0,children:[o&&!t&&a(c,{level:"small",variant:"muted",testID:r?`${r}-unchecked-label`:void 0,children:o}),l&&a(c,{level:"body",testID:r?`${r}-label`:void 0,children:l}),m,s&&t&&a(c,{level:"small",variant:"muted",testID:r?`${r}-checked-label`:void 0,children:s}),i]}):m};var I=D;export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as u}from"react/jsx-runtime";import{useState as c,useMemo as ie}from"react";import{View as h,ScrollView as ne,TouchableOpacity as W}from"react-native";import{mergeStyles as se}from"../../utils/helpers";import{useTheme as B}from"../../theme";import T from"../Stack";import L from"../Text";import V from"../Checkbox";import de from"../Input";import le from"../Pagination";function ce({children:f,style:y,testID:g}){const{theme:d}=B(),$={borderWidth:1,borderColor:d.colors.border,borderRadius:d.radius.surface,overflow:"hidden"};return r(h,{style:se($,y),testID:g,children:f})}function he({data:f,columns:y,sortable:g=!1,selectable:d=!1,searchable:$=!1,pagination:S=!1,currentPage:H,pageSize:j,total:w,onPageChange:O,onPageSizeChange:me,loading:pe=!1,onSort:M,onSelect:C,onSearch:x,onRowClick:A,onRowPress:K,showingLabel:N,paginationPreviousLabel:U,paginationNextLabel:X,paginationItemsPerPagePlaceholder:be,gridLines:Y=!1,style:Z,testID:t}){const{theme:i}=B(),R=K||A,q={borderWidth:1,borderColor:i.colors.border,borderRadius:i.radius.surface,overflow:"hidden"},E={flexDirection:"row",backgroundColor:i.colors.muted,borderBottomWidth:1,borderBottomColor:i.colors.border,paddingVertical:i.spacing.md,paddingHorizontal:i.spacing.md},F={flexDirection:"row",borderBottomWidth:1,borderBottomColor:i.colors.border,paddingVertical:i.spacing.md,paddingHorizontal:i.spacing.md},v={flex:1,paddingHorizontal:i.spacing.sm,...Y&&{borderRightWidth:1,borderRightColor:i.colors.border}},[G,J]=c(1),[Q,ue]=c(10),[D,_]=c(""),[l,ee]=c(null),[m,te]=c("asc"),[P,k]=c(new Set),z=H??G,p=j??Q,I=ie(()=>{let e=[...f];return D&&x&&x(D),l&&g&&e.sort((o,a)=>{const n=String(o[l]??""),s=String(a[l]??"");return n<s?m==="asc"?-1:1:n>s?m==="asc"?1:-1:0}),e},[f,D,l,m,g,x]),b=S?I.slice((z-1)*p,z*p):I,oe=Math.ceil(S&&w?w/p:I.length/p),re=e=>{if(!g)return;const o=l===e&&m==="asc"?"desc":"asc";ee(e),te(o),M?.(e,o)},ae=e=>{if(!d)return;const o=new Set(P);o.has(e)?o.delete(e):o.add(e),k(o);const a=Array.from(o).map(n=>I[n]).filter(n=>n!==void 0);C?.(a)};return u(T,{gap:16,style:Z,testID:t,children:[$&&r(de,{placeholder:"Search...",value:D,onChangeText:_,testID:t?`${t}-search`:void 0}),u(h,{style:q,testID:t?`${t}-table`:void 0,children:[u(h,{style:E,testID:t?`${t}-header`:void 0,children:[d&&r(h,{style:v,testID:t?`${t}-header-checkbox`:void 0,children:r(V,{checked:P.size===b.length&&b.length>0,onCheckedChange:e=>{if(e){const o=new Set(b.map((a,n)=>n));k(o),C?.(b)}else k(new Set),C?.([])},testID:t?`${t}-select-all`:void 0})}),y.map(e=>r(W,{style:[v,{flex:e.width?0:1}],onPress:()=>e.sortable&&re(e.key),disabled:!e.sortable,activeOpacity:e.sortable?.7:1,testID:t?`${t}-header-${e.key}`:void 0,children:u(T,{direction:"row",align:"center",gap:4,children:[r(L,{level:"body",variant:"muted",style:{fontWeight:"600"},children:e.title}),e.sortable&&l===e.key&&r(L,{level:"caption",variant:"muted",children:m==="asc"?"\u2191":"\u2193"})]})},e.key))]}),r(ne,{testID:t?`${t}-body`:void 0,children:b.map((e,o)=>u(W,{style:F,onPress:()=>R?.(e),activeOpacity:R?.7:1,testID:t?`${t}-row-${o}`:void 0,children:[d&&r(h,{style:v,testID:t?`${t}-checkbox-${o}`:void 0,children:r(V,{checked:P.has(o),onCheckedChange:()=>ae(o),testID:t?`${t}-select-${o}`:void 0})}),y.map(a=>{const n=a.dataIndex?e[a.dataIndex]:void 0,s=a.render?a.render(n,e,o):n;return r(h,{style:[v,{flex:a.width?0:1}],testID:t?`${t}-cell-${o}-${a.key}`:void 0,children:typeof s=="string"||typeof s=="number"?r(L,{level:"body",children:s}):s},a.key)})]},o))})]}),S&&r(le,{currentPage:z,totalPages:oe,onPageChange:e=>{J(e),O?.(e)},pageSize:p,total:w,showingLabel:N,previousLabel:U,nextLabel:X,testID:t?`${t}-pagination`:void 0})]})}var ge=ce;export{he as DataTable,ge as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as a,jsxs as E}from"react/jsx-runtime";import{useState as R}from"react";import{View as l,TouchableOpacity as S}from"react-native";import{THEME_VARIANT as W}from"../../utils/constants";import{useTheme as z}from"../../theme";import H from"../Text";const O={start:"flex-start",center:"center",end:"flex-end"},F={start:"flex-start",center:"center",end:"flex-end","space-between":"space-between"},L=({defaultValue:f,value:n,onValueChange:g,items:i,variant:_=W.DEFAULT,gap:s,align:y,justify:h,center:d=!1,orientation:x="horizontal",style:D,listStyle:I,contentStyle:B,testID:t})=>{const{theme:r}=z(),[C,V]=R(()=>f||i[0]?.value||""),c=d?"center":y,m=d?"center":h,o=x==="vertical",w={flexDirection:o?"column":"row",borderBottomWidth:o?0:1,borderBottomColor:o?void 0:r.colors.border,...o&&{borderRightWidth:1,borderRightColor:r.colors.border},...s!==void 0&&{gap:s},...c&&{alignItems:O[c]},...m&&{justifyContent:F[m]},...I},T={paddingHorizontal:r.spacing.md,paddingVertical:r.spacing.md,borderBottomWidth:2,borderBottomColor:"transparent"},$={borderBottomColor:r.colors.primary},j={padding:r.spacing.md,...B},p=n!==void 0,b=p?n:C,A=e=>{p||V(e),g?.(e)},u=i.find(e=>e.value===b);return E(l,{style:D,testID:t,children:[a(l,{style:w,testID:t?`${t}-list`:void 0,children:i.map(e=>{const v=e.value===b;return a(S,{style:[T,v&&$],onPress:()=>!e.disabled&&A(e.value),disabled:e.disabled,activeOpacity:.7,testID:t?`${t}-trigger-${e.value}`:void 0,children:typeof e.label=="string"?a(H,{level:"body",variant:v?"primary":"muted",style:e.disabled?{opacity:.5}:void 0,children:e.label}):e.label},e.value)})}),u&&a(l,{style:j,testID:t?`${t}-content`:void 0,children:u.content})]})};var M=L;export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as h}from"react/jsx-runtime";import{TouchableOpacity as c,View as y,StyleSheet as a}from"react-native";import{mergeStyles as D}from"../../utils/helpers";import"../Stack";import s from"../Text";const f={DEFAULT:"default",OUTLINE:"outline",ACCENT:"accent"},x={paddingHorizontal:8,paddingVertical:4,borderRadius:12,alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:4},C=a.create({default:{backgroundColor:"#f3f4f6"},outline:{backgroundColor:"transparent",borderWidth:1,borderColor:"#d1d5db"},accent:{backgroundColor:"#8b5cf6"}}),I=a.create({sm:{paddingHorizontal:6,paddingVertical:2},md:{paddingHorizontal:8,paddingVertical:4},lg:{paddingHorizontal:12,paddingVertical:6}}),T=a.create({default:{color:"#111827"},outline:{color:"#111827"},accent:{color:"#ffffff"}}),A={opacity:.5},V=({children:p,variant:o=f.DEFAULT,size:m="md",interactive:g=!1,onClick:i,onRemove:d,disabled:r=!1,style:b,testID:t})=>{const u=C[o],v=I[m],l=T[o],n=h(y,{style:D(x,u,v,r&&A,b),testID:t,children:[e(s,{level:"caption",style:l,testID:t?`${t}-text`:void 0,children:p}),d&&e(c,{onPress:d,disabled:r,testID:t?`${t}-remove`:void 0,children:e(s,{level:"caption",style:l,children:"\xD7"})})]});return g&&i?e(c,{onPress:i,disabled:r,activeOpacity:.7,testID:t?`${t}-button`:void 0,children:n}):n};var z=V;export{f as TAG_VARIANT,z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{Text as S}from"react-native";import{THEME_VARIANT as z}from"../../utils/constants";import{mergeStyles as u}from"../../utils/helpers";import{useTheme as H}from"../../theme";import"../../utils/theme-helpers";const n={...z,CODE:"code"},a={H1:"h1",H2:"h2",H3:"h3",H4:"h4",BODY:"body",SMALL:"small",CAPTION:"caption"};function b(t){return{h1:{fontSize:t.typography.fontSize["3xl"],fontWeight:t.typography.fontWeight.bold,lineHeight:t.typography.fontSize["3xl"]*t.typography.lineHeight.base},h2:{fontSize:t.typography.fontSize["2xl"],fontWeight:t.typography.fontWeight.semibold,lineHeight:t.typography.fontSize["2xl"]*t.typography.lineHeight.base},h3:{fontSize:t.typography.fontSize.xl,fontWeight:t.typography.fontWeight.semibold,lineHeight:t.typography.fontSize.xl*t.typography.lineHeight.base},h4:{fontSize:t.typography.fontSize.lg,fontWeight:t.typography.fontWeight.semibold,lineHeight:t.typography.fontSize.lg*t.typography.lineHeight.base},body:{fontSize:t.typography.fontSize.base,lineHeight:t.typography.fontSize.base*t.typography.lineHeight.base},small:{fontSize:t.typography.fontSize.sm,lineHeight:t.typography.fontSize.sm*t.typography.lineHeight.base},caption:{fontSize:t.typography.fontSize.xs,lineHeight:t.typography.fontSize.xs*t.typography.lineHeight.base}}}function x(t){return{default:{color:t.colors.foreground},muted:{color:t.colors.mutedForeground},primary:{color:t.colors.primary},secondary:{color:t.colors.secondary},accent:{color:t.colors.accent},success:{color:t.colors.success},warning:{color:t.colors.warning},destructive:{color:t.colors.destructive},code:{fontFamily:"monospace",backgroundColor:t.colors.muted,paddingHorizontal:t.spacing.sm/2,paddingVertical:t.spacing.sm/4,borderRadius:t.radius.md/3}}}const T={start:"left",center:"center",end:"right"},W={normal:"400",medium:"500",semibold:"600",bold:"700"},A=({level:t=a.BODY,variant:l=n.DEFAULT,align:o,weight:i,italic:p,children:g,style:s,testID:h})=>{const{theme:r}=H(),y=b(r),c=x(r),f=y[t],d=c[l],e={};return o&&(e.textAlign=T[o]),i&&(e.fontWeight=W[i]),p&&(e.fontStyle="italic"),m(S,{style:u(f,d,e,s),testID:h,children:g})};var E=A;export{a as TEXT_LEVEL,n as TEXT_VARIANT,E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as d}from"react/jsx-runtime";import{TextInput as y,View as f}from"react-native";import{mergeStyles as c}from"../../utils/helpers";import{useTheme as b}from"../../theme";import l from"../Text";import v from"../Stack";function S(e){return{container:{minHeight:100,paddingHorizontal:e.spacing.md,paddingVertical:e.spacing.sm,borderWidth:1,borderColor:e.colors.border,borderRadius:e.radius.md,backgroundColor:e.colors.input},text:{fontSize:e.typography.fontSize.base,lineHeight:e.typography.fontSize.base*e.typography.lineHeight.base,color:e.colors.foreground,textAlignVertical:"top"},label:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,color:e.colors.mutedForeground,marginBottom:e.spacing.sm/2},error:{fontSize:e.typography.fontSize.xs,color:e.colors.destructive,marginTop:e.spacing.sm/2},errorContainer:{borderColor:e.colors.destructive},placeholderColor:e.colors.mutedForeground}}const x=({label:e,error:i,containerStyle:p,inputStyle:m,disabled:n=!1,required:g=!1,name:C,style:h,testID:r,...a})=>{const{theme:s}=b(),t=S(s),u=!!i;return d(v,{gap:s.spacing.sm/2,style:p,testID:r,children:[e&&d(l,{level:"small",style:t.label,testID:r?`${r}-label`:void 0,children:[e,g&&o(l,{level:"small",variant:"destructive",children:" *"})]}),o(f,{style:c(t.container,u&&t.errorContainer,n&&{opacity:.5}),testID:r?`${r}-container`:void 0,children:o(y,{style:c(t.text,m,h),placeholder:a.placeholder,placeholderTextColor:t.placeholderColor,multiline:!0,editable:!n,...a,testID:r?`${r}-input`:void 0})}),i&&o(l,{level:"caption",variant:"destructive",style:t.error,testID:r?`${r}-error`:void 0,children:i})]})};var z=x;export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as y,jsx as t,jsxs as p}from"react/jsx-runtime";import{useState as b,useCallback as w,useEffect as v}from"react";import{View as l,TouchableOpacity as k}from"react-native";import{mergeStyles as x}from"../../utils/helpers";import{useTheme as C}from"../../theme";import T from"../Stack";import d from"../Text";import I from"../Button";let P=0,i=[];const m=new Set,u=()=>{m.forEach(o=>o())},g=o=>{const r=`toast-${++P}`,a={...o,id:r};i=[...i,a],u();const e=o.duration||5e3;return setTimeout(()=>{i=i.filter(n=>n.id!==r),u()},e),{id:r,dismiss:()=>h(r)}},h=o=>{i=i.filter(r=>r.id!==o),u()},f=()=>{const[o,r]=b(i);v(()=>{const e=()=>r(i);return m.add(e),e(),()=>{m.delete(e)}},[]);const a=w(e=>{h(e)},[]);return{toasts:o,toast:g,dismiss:a}},S=({children:o})=>t(y,{children:o}),j=({children:o,onPress:r})=>t(I,{variant:"ghost",onPress:r,children:o});function E(){const{theme:o}=C(),{toasts:r,dismiss:a}=f(),e={backgroundColor:o.colors.foreground,borderRadius:o.radius.surface,padding:o.spacing.md,marginBottom:o.spacing.sm,shadowColor:o.colors.foreground,shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:4,elevation:5,minWidth:300,maxWidth:"90%"},n={default:{backgroundColor:o.colors.foreground},success:{backgroundColor:o.colors.success},error:{backgroundColor:o.colors.destructive},warning:{backgroundColor:o.colors.warning},info:{backgroundColor:o.colors.primary}},c=s=>s==="warning"?o.colors.warningForeground:o.colors.background;return t(l,{style:{position:"absolute",top:50,left:0,right:0,alignItems:"center",zIndex:o.zIndex.toast},pointerEvents:"box-none",children:r.map(s=>p(l,{style:x(e,n[s.type||"default"]),children:[p(T,{gap:o.spacing.sm,children:[s.title&&t(d,{level:"body",style:{color:c(s.type)},children:s.title}),s.description&&t(d,{level:"small",style:{color:c(s.type),opacity:.9},children:s.description}),s.action&&t(l,{children:s.action})]}),t(k,{onPress:()=>a(s.id),style:{position:"absolute",top:o.spacing.sm,right:o.spacing.sm},children:t(d,{level:"body",style:{color:c(s.type)},children:"\xD7"})})]},s.id))})}var O=E;export{j as ToastAction,S as ToastProvider,O as default,g as toast,f as useToast};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{useState as p}from"react";import{TouchableOpacity as C,StyleSheet as k}from"react-native";import{THEME_VARIANT as y}from"../../utils/constants";import{mergeStyles as h}from"../../utils/helpers";const S={paddingHorizontal:12,paddingVertical:8,borderRadius:8,alignItems:"center",justifyContent:"center",minHeight:40},r=k.create({default:{backgroundColor:"#f3f4f6"},pressed:{backgroundColor:"#e5e7eb"},primary:{backgroundColor:"#3b82f6"},secondary:{backgroundColor:"#6366f1"},accent:{backgroundColor:"#8b5cf6"},success:{backgroundColor:"#10b981"},warning:{backgroundColor:"#f59e0b"},destructive:{backgroundColor:"#ef4444"},muted:{backgroundColor:"#9ca3af"},outline:{backgroundColor:"transparent",borderWidth:1,borderColor:"#d1d5db"},disabled:{opacity:.5}}),v=({pressed:t,defaultPressed:d,onPressedChange:s,variant:n=y.DEFAULT,disabled:e=!1,children:c,style:i,testID:l})=>{const[b,u]=p(d??!1),o=t??b,f=()=>{if(!e){const a=!o;u(a),s?.(a)}},g=o&&r[n]||r.default;return m(C,{style:h(S,g,e&&r.disabled,i),onPress:f,disabled:e,activeOpacity:.7,testID:l,children:c})};var A=v;export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as y,jsxs as p}from"react/jsx-runtime";import{View as v,StyleSheet as g}from"react-native";import{mergeStyles as h}from"../../utils/helpers";import"../Stack";import x from"../Toggle";const A=g.create({container:{flexDirection:"row",gap:4}}),D=({type:r="single",value:a,onValueChange:s,items:l=[],variant:n="default",size:S="md",children:o,style:d,testID:t})=>{const m=e=>r==="single"?a===e:Array.isArray(a)&&a.includes(e),u=e=>{if(s)if(r==="single")s(a===e?"":e);else{const i=Array.isArray(a)?a:[],c=i.includes(e)?i.filter(f=>f!==e):[...i,e];s(c)}};return p(v,{style:h(A.container,d),testID:t,children:[l.map(e=>y(x,{pressed:m(e.value),onPressedChange:()=>u(e.value),disabled:e.disabled,variant:n==="outline"?"secondary":"default",testID:t?`${t}-item-${e.value}`:void 0,children:e.label},e.value)),o]})};var b=D;export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as g,Fragment as p}from"react/jsx-runtime";import{useState as f}from"react";import{View as s,TouchableOpacity as u}from"react-native";import{FLOATING_VARIANT as h}from"../../utils/constants";import{useTheme as b}from"../../theme";import v from"../Text";const x=t=>{switch(t){case"top":return{bottom:"100%",marginBottom:4};case"right":return{left:"100%",marginLeft:4};case"bottom":return{top:"100%",marginTop:4};case"left":return{right:"100%",marginRight:4}}},y=({content:t,children:a,side:l="bottom",align:n="center",variant:D=h.DEFAULT,style:c,testID:e})=>{const{theme:r}=b(),[d,i]=f(!1),m={backgroundColor:r.colors.foreground,paddingHorizontal:r.spacing.sm,paddingVertical:4,borderRadius:r.radius.floating||6,position:"absolute",zIndex:r.zIndex.tooltip};return g(s,{style:c,testID:e,children:[o(u,{onLongPress:()=>i(!0),onPressOut:()=>i(!1),activeOpacity:.7,testID:e?`${e}-trigger`:void 0,children:a}),d&&o(s,{style:[m,x(l),n==="start"&&{alignSelf:"flex-start"},n==="end"&&{alignSelf:"flex-end"},n==="center"&&{alignSelf:"center"}],testID:e?`${e}-content`:void 0,children:typeof t=="string"?o(v,{level:"caption",style:{color:r.colors.background},children:t}):t})]})},I=({children:t})=>o(p,{children:t});var T=y;export{I as TooltipProvider,T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{Video as m,ResizeMode as t}from"expo-av";import{View as n,StyleSheet as p}from"react-native";import{mergeStyles as y}from"../../utils/helpers";const c=({source:e,autoplay:i=!1,loop:a=!1,muted:l=!1,resizeMode:s="contain",style:u,testID:o})=>{const d=typeof e=="string"?{uri:e}:{uri:e.uri};return r(n,{style:y({width:"100%",height:200},u),testID:o,children:r(m,{source:d,shouldPlay:i,isLooping:a,isMuted:l,resizeMode:s==="contain"?t.CONTAIN:s==="cover"?t.COVER:t.STRETCH,style:p.absoluteFill,testID:o?`${o}-video`:void 0})})};var f=c;export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as d}from"react/jsx-runtime";import{View as r,StyleSheet as o}from"react-native";const a=o.create({hidden:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",borderWidth:0}}),h=({children:e,style:t,...i})=>d(r,{style:[a.hidden,t],...i,children:e});var n=h;export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as a}from"./Button";import{BUTTON_VARIANT as o}from"./Button";import{default as r,renderCardContent as t,renderCardHeader as s}from"./Card";import{default as e}from"./Input";import{default as m}from"./Stack";import{STACK_DIRECTION as f,STACK_ALIGN as i,STACK_JUSTIFY as l}from"./Stack";import{default as d}from"./Text";import{TEXT_VARIANT as p,TEXT_LEVEL as u}from"./Text";import{default as T}from"./Alert";import{ALERT_VARIANT as A}from"./Alert";import{default as n}from"./Avatar";import{default as C}from"./Badge";import{BADGE_VARIANT as I}from"./Badge";import{default as R}from"./Checkbox";import{default as S}from"./Separator";import{SEPARATOR_ORIENTATION as E}from"./Separator";import{default as N}from"./Switch";import{default as _}from"./Label";import{default as c}from"./List";import{default as V}from"./Progress";import{default as O}from"./Skeleton";import{default as P}from"./Spinner";import{default as g}from"./Textarea";import{default as D}from"./PasswordInput";import{default as b}from"./Tag";import{TAG_VARIANT as L}from"./Tag";import{default as B}from"./Blockquote";import{BLOCKQUOTE_VARIANT as G}from"./Blockquote";import{default as v}from"./Section";import{default as F}from"./Slot";import{default as K}from"./VisuallyHidden";import{default as x}from"./RadioGroup";import{default as H}from"./RangeInput";import{default as k}from"./Rating";import{default as U}from"./Slider";import{default as w}from"./Toggle";import{default as h}from"./ToggleGroup";import{default as y}from"./Accordion";import{default as Q}from"./Collapsible";import{default as X,GridArea as M}from"./Grid";import{default as j}from"./Pagination";import{default as q}from"./Dialog";import{default as J,SHEET_VARIANT as W}from"./Sheet";import{default as $}from"./Select";import{default as Y}from"./Tabs";import{default as z,TooltipProvider as Z}from"./Tooltip";import{default as aa}from"./AlertDialog";import{default as oa}from"./Stepper";import{default as ra}from"./DescriptionList";import{default as ta,POPOVER_VARIANT as sa}from"./Popover";import{default as ea}from"./CopyToClipboard";import{default as ma}from"./DualCard";import{default as fa}from"./CallToAction";import{default as ia}from"./HeroSection";import{default as la}from"./Combobox";import{default as da}from"./Command";import{default as pa}from"./CommandDialog";import{useCommandDialogClose as ua}from"./CommandDialog";import{default as Ta}from"./ContextMenu";import{default as Aa}from"./DropdownMenu";import{default as na}from"./HoverCard";import{default as Ca}from"./NavigationMenu";import{default as Ia,DataTable as Ra}from"./Table";import{default as Sa,ScrollBar as Ea}from"./ScrollArea";import{default as Na}from"./Portal";import{default as _a}from"./PortalButton";import{default as ca}from"./FileButton";import{default as Va,withFeatureFallback as Oa}from"./FeatureFallback";import{default as Pa}from"./InfiniteScroll";import{default as ga}from"./VideoPlayer";import{default as Da}from"./Calendar";import{default as ba,ToastProvider as La,ToastAction as Ba}from"./Toaster";import{default as Ga}from"./Icons";export{A as ALERT_VARIANT,y as Accordion,T as Alert,aa as AlertDialog,n as Avatar,I as BADGE_VARIANT,G as BLOCKQUOTE_VARIANT,o as BUTTON_VARIANT,C as Badge,B as Blockquote,a as Button,Da as Calendar,fa as CallToAction,r as Card,R as Checkbox,Q as Collapsible,la as Combobox,da as Command,pa as CommandDialog,Ta as ContextMenu,ea as CopyToClipboard,Ra as DataTable,ra as DescriptionList,q as Dialog,Aa as DropdownMenu,ma as DualCard,Va as FeatureFallback,ca as FileButton,X as Grid,M as GridArea,ia as HeroSection,na as HoverCard,Ga as Icon,Pa as InfiniteScroll,e as Input,_ as Label,c as List,Ca as NavigationMenu,sa as POPOVER_VARIANT,j as Pagination,D as PasswordInput,ta as Popover,Na as Portal,_a as PortalButton,V as Progress,x as RadioGroup,H as RangeInput,k as Rating,E as SEPARATOR_ORIENTATION,W as SHEET_VARIANT,i as STACK_ALIGN,f as STACK_DIRECTION,l as STACK_JUSTIFY,Sa as ScrollArea,Ea as ScrollBar,v as Section,$ as Select,S as Separator,J as Sheet,O as Skeleton,U as Slider,F as Slot,P as Spinner,m as Stack,oa as Stepper,N as Switch,L as TAG_VARIANT,u as TEXT_LEVEL,p as TEXT_VARIANT,Ia as Table,Y as Tabs,b as Tag,d as Text,g as Textarea,Ba as ToastAction,La as ToastProvider,ba as Toaster,w as Toggle,h as ToggleGroup,z as Tooltip,Z as TooltipProvider,ga as VideoPlayer,K as VisuallyHidden,t as renderCardContent,s as renderCardHeader,ua as useCommandDialogClose,Oa as withFeatureFallback};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as l,jsxs as S}from"react/jsx-runtime";import{useState as F,useMemo as K}from"react";import{Button as c,Calendar as L,Sheet as V,Text as C,Stack as v}from"../../atomic";import{formatDate as N}from"@donotdev/core";function P({label:f,fieldType:R,value:i,onChange:D,tCrud:d,locale:Y="en",testID:e}){const[y,s]=F(!1),[I,$]=F(null),T=K(()=>i?typeof i=="object"&&i!==null&&"min"in i?{min:i.min||"",max:i.max||""}:{min:"",max:""}:{min:"",max:""},[i]),M=t=>{if(!t)return"";try{const n=new Date(t+"T00:00:00");return N(n,Y)}catch{return t}},b=()=>{const t=new Date;t.setHours(0,0,0,0);const n=t.getFullYear(),p=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),m=`${n}-${p}-${r}`,o=new Date(t);o.setDate(o.getDate()-1);const h=o.getFullYear(),x=String(o.getMonth()+1).padStart(2,"0"),W=String(o.getDate()).padStart(2,"0"),k=`${h}-${x}-${W}`,g=new Date(t);g.setDate(g.getDate()-7);const B=g.getFullYear(),H=String(g.getMonth()+1).padStart(2,"0"),q=String(g.getDate()).padStart(2,"0"),z=`${B}-${H}-${q}`,u=new Date(t);u.setDate(u.getDate()-30);const A=u.getFullYear(),E=String(u.getMonth()+1).padStart(2,"0"),G=String(u.getDate()).padStart(2,"0"),J=`${A}-${E}-${G}`;return{today:m,yesterday:k,last7Days:z,last30Days:J}},a=T,j=b(),O=!!(a?.min||a?.max),w=t=>{const n=t==="start",p=n?a?.min:a?.max;return S(v,{gap:16,style:{padding:16},children:[l(v,{direction:"row",gap:8,style:{flexWrap:"wrap"},children:(n?["today","yesterday","last7Days","last30Days"]:["today","yesterday","last7Days","last30Days"]).map(r=>{const m=j[r];return l(c,{variant:"outline",onPress:()=>{D({min:n?m:a?.min||"",max:n?a?.max||"":m}),s(!1)},testID:e?`${e}-preset-${r}`:void 0,children:d(`filter.${r}`,{defaultValue:r})},r)})}),l(L,{value:p?new Date(p+"T00:00:00"):void 0,onSelect:r=>{if(!r)return;const m=r.getFullYear(),o=String(r.getMonth()+1).padStart(2,"0"),h=String(r.getDate()).padStart(2,"0"),x=`${m}-${o}-${h}`;D({min:n?x:a?.min||"",max:n?a?.max||"":x}),s(!1)},testID:e?`${e}-calendar-${t}`:void 0}),l(c,{variant:"ghost",onPress:()=>{D({min:n?"":a?.min||"",max:n&&a?.max||""}),s(!1)},testID:e?`${e}-clear-${t}`:void 0,children:d("filter.clear",{defaultValue:"Clear"})})]})};return S(v,{direction:"row",align:"center",gap:8,testID:e,children:[S(C,{level:"small",variant:"muted",style:{minWidth:80},children:[f,":"]}),l(V,{trigger:l(c,{variant:"outline",onPress:()=>{$("start"),s(!0)},style:{flex:1},testID:e?`${e}-min-trigger`:void 0,children:a?.min?M(a.min):d("filter.min",{defaultValue:"Min"})}),title:`${f} - ${d("filter.min",{defaultValue:"Min"})}`,open:y&&I==="start",onOpenChange:t=>{s(t),t||$(null)},testID:e?`${e}-min-sheet`:void 0,children:w("start")}),l(C,{level:"small",variant:"muted",children:"\u2013"}),l(V,{trigger:l(c,{variant:"outline",onPress:()=>{$("end"),s(!0)},style:{flex:1},testID:e?`${e}-max-trigger`:void 0,children:a?.max?M(a.max):d("filter.max",{defaultValue:"Max"})}),title:`${f} - ${d("filter.max",{defaultValue:"Max"})}`,open:y&&I==="end",onOpenChange:t=>{s(t),t||$(null)},testID:e?`${e}-max-sheet`:void 0,children:w("end")}),l(c,{variant:"ghost",onPress:()=>{D(void 0)},disabled:!O,testID:e?`${e}-clear-all`:void 0,children:"\xD7"})]})}var Q=P;export{P as DateFilter,Q as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as a,jsxs as s}from"react/jsx-runtime";import{View as c}from"react-native";import{Text as n,Stack as y}from"../../atomic";import{handleError as d}from"@donotdev/core";import{translateFieldLabel as u}from"@donotdev/crud";import{getDisplayFormatter as g}from"@donotdev/crud";function m(e,t,o,i){const r=i?.compact??!1;if(e==null||e==="")return r?"\u2014":a(n,{variant:"muted",children:"\u2014"});const l=g(t.type);if(l)try{return l(e,t,o,i)}catch(f){return d(f,{userMessage:`Error formatting field "${t.label||t.name}"`,context:{fieldType:t.type,fieldName:t.label||"unknown",operation:"display_format"},severity:"warning"}),r?String(e):a(n,{variant:"muted",children:String(e)})}return d(new Error(`Display formatter not registered for field type: ${t.type}`),{userMessage:`Field type "${t.type}" is missing display formatter`,context:{fieldType:t.type,fieldName:t.label||"unknown",operation:"display_format"},severity:"warning"}),r?String(e):a(n,{variant:"muted",children:String(e)})}function p({name:e,config:t,value:o,t:i}){const r=m(o,t,i,{compact:!1}),l=u(e,t,i);return s(y,{direction:"row",align:"center",gap:8,style:{paddingVertical:8},children:[s(n,{level:"small",variant:"muted",style:{minWidth:120},children:[l,":"]}),a(c,{style:{flex:1},children:typeof r=="string"?a(n,{level:"body",children:r}):r})]})}var h=p;export{p as DisplayFieldRenderer,h as default,m as formatValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCardList.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityCardList.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"EntityCardList.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityCardList.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AA2BH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAmB,EACnB,SAA0B,EAAE,2BAA2B;AACvD,MAAM,EACN,WAAmB,GACpB,EAAE,mBAAmB,2CAuPrB;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as i,jsxs as u}from"react/jsx-runtime";import{useMemo as p,useCallback as x}from"react";import{View as N,TouchableOpacity as J,Image as K}from"react-native";import{Grid as Q,Card as U,Stack as n,Text as g,Spinner as W,Section as E,Button as X}from"../../atomic";import{useTranslation as I,getListCardFieldNames as Y}from"@donotdev/core";import{useNavigate as Z}from"../../routing";import{useTheme as _}from"../../theme";import{translateFieldLabel as ee,useCrudCardList as te,useEntityFavorites as ie,useCrudFilters as A}from"@donotdev/crud";import{EntityFilters as le,matchesFilter as ae}from"./EntityFilters";import{formatValue as re}from"./DisplayFieldRenderer";function B({entity:t,basePath:P,onClick:y,cols:z=[1,2,3,4],staleTime:D=1e3*60*30,filter:v,hideFilters:G=!1}){const S=Z(),{theme:r}=_(),$=P??`/${t.collection}`,{data:M,loading:j}=te(t,{staleTime:D}),F=M?.items||[],{isFavorite:R,toggleFavorite:ne,favoritesFilter:O}=ie({collection:t.collection}),{showFavoritesOnly:o,setShowFavoritesOnly:q}=A({collection:t.collection}),{filters:w}=A({collection:t.collection}),T=x(e=>Object.keys(w).length===0?!0:Object.entries(w).every(([a,l])=>{const f=e[a],b=t.fields[a]?.type||"text";return ae(f,l,b)}),[w,t.fields]),c=p(()=>{let e=F;return e=e.filter(T),o&&(e=e.filter(O)),v&&(e=e.filter(v)),e},[F,T,o,O,v]),{t:C}=I([t.namespace,"crud"]),{t:s}=I("crud"),H=x(e=>{y?y(e):S(`${$}/${e}`)},[$,S,y]),d=p(()=>Y(t),[t]),m=p(()=>{const e=d.filter(a=>{const l=t.fields[a];return l?.type==="image"||l?.type==="images"});return e.length>0?e[0]:Object.keys(t.fields).filter(a=>{const l=t.fields[a];return l?.type==="image"||l?.type==="images"})[0]||null},[d,t.fields]),k=p(()=>d.filter(e=>e!==m),[d,m]),L=C("name",{defaultValue:t.name});return u(n,{gap:r.spacing.md,children:[!G&&i(E,{title:s("filters.title",{entity:L,defaultValue:`Browse ${L} - Filters`}),collapsible:!0,defaultCollapsed:!1,children:u(n,{gap:r.spacing.md,children:[i(X,{variant:o?"primary":"outline",onPress:()=>q(!o),children:o?s("favorites.showAll",{defaultValue:"Show All"}):s("favorites.showFavorites",{defaultValue:"Show Favorites"})}),i(le,{entity:t,data:F,fieldsToFilter:d})]})}),i(E,{title:j?s("results.title.fetching",{defaultValue:"Fetching..."}):s("results.title.count",{count:c.length,defaultValue:c.length===1?"Found 1 occurrence":`Found ${c.length} occurrences`}),collapsible:!0,defaultCollapsed:!1,children:j?i(n,{align:"center",justify:"center",style:{padding:r.spacing.lg},children:i(W,{})}):c.length===0?u(n,{align:"center",justify:"center",style:{padding:r.spacing.lg},children:[i(g,{level:"h3",variant:"muted",children:s("emptyState.title",{defaultValue:`No ${t.name.toLowerCase()} found`})}),i(g,{variant:"muted",children:s("emptyState.description",{defaultValue:`No ${t.name.toLowerCase()} available at this time.`})})]}):i(Q,{cols:z,children:c.map(e=>{const a=m?e[m]:null,l=typeof a=="string"?a:null,f=k[0],b=f?e[f]:e.id,oe=R(e.id);return i(J,{onPress:()=>H(e.id),activeOpacity:.7,children:i(U,{title:String(b||""),variant:"default",testID:`card-${e.id}`,children:u(n,{gap:r.spacing.sm,children:[l&&i(N,{style:{width:"100%",aspectRatio:16/9,borderRadius:r.radius.surface,overflow:"hidden",backgroundColor:r.colors.muted},children:i(K,{source:{uri:l},style:{width:"100%",height:"100%"},resizeMode:"cover"})}),i(n,{gap:r.spacing.sm,children:k.slice(1,4).map(h=>{const V=t.fields[h];return V?u(N,{children:[i(g,{level:"small",variant:"muted",children:ee(h,V,C)}),i(g,{children:re(e[h],V,C,{compact:!0})})]},h):null})})]})})},e.id)})})})]})}var se=B;export{B as EntityCardList,se as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n,jsxs as $}from"react/jsx-runtime";import{useEffect as q,useState as p,useMemo as z}from"react";import{Stack as f,Spinner as B,Text as v}from"../../atomic";import{useTranslation as b,isFieldVisible as G}from"@donotdev/core";import{DisplayFieldRenderer as H}from"./DisplayFieldRenderer";import{useCrud as J}from"@donotdev/crud";import{useAuthSafe as L}from"../../utils/useAuthSafe";function E({entity:i,id:o,t:A,style:c,loadingMessage:_,notFoundMessage:D,viewerRole:S,testID:y}){const j=L("userRole"),g=S??j,{get:m,loading:F,data:I,error:R,isAvailable:h}=J(i),[w,u]=p(!1),[x,l]=p(null),[M,d]=p(null),{t:k}=b([i.namespace,"crud"]),{t:O}=b("crud"),T=A||k;q(()=>{if(!o){d(null),l(null),u(!1);return}if(!h||!m)return;let r=!1;return u(!0),l(null),m(o).then(e=>{r||(u(!1),e?(d(e),l(null)):(d(null),l(new Error("Entity not found"))))}).catch(e=>{r||(u(!1),l(e instanceof Error?e:new Error(String(e))),d(null))}),()=>{r=!0}},[o,m,h]);const s=I||M,a=R||x,V=F||w||!o,C=z(()=>s?Object.entries(i.fields).filter(([r,e])=>{if(!G(e.visibility,g)||e.visibility==="hidden")return!1;const t=s[r];return!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0||typeof t=="object"&&!Array.isArray(t)&&t!==null&&Object.keys(t).length===0)}):[],[i.fields,g,s]);return V?n(f,{style:c,testID:y,children:n(B,{overlay:!0})}):a||!s?n(f,{align:"center",justify:"center",style:c,testID:y,children:$(f,{gap:8,children:[n(v,{level:"h3",variant:"muted",children:D||O("errors.notFound",{defaultValue:`${i.name} not found`})}),a&&n(v,{level:"body",variant:"destructive",children:a instanceof Error?a.message:String(a)})]})}):n(f,{gap:16,style:c,testID:y,children:C.map(([r,e])=>n(H,{name:r,config:e,value:s[r],t:T},r))})}var Z=E;export{E as EntityDisplayRenderer,Z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as v,jsxs as S}from"react/jsx-runtime";import{useMemo as I}from"react";import{Button as O,Combobox as B,RangeInput as M,Slider as _,Stack as T}from"../../atomic";import{DateFilter as P}from"./DateFilter";import{useTranslation as j,handleError as R}from"@donotdev/core";import{translateFieldLabel as q}from"@donotdev/crud";import{getFilterType as w,isFilterable as N}from"@donotdev/crud";import{useCrudFilters as z}from"@donotdev/crud";import{useCrudCardList as G}from"@donotdev/crud";function H(r,i,u){if(!i)return!0;if(Array.isArray(i))return i.length===0?!0:i.some(p=>String(r)===String(p));if(typeof i=="object"&&"min"in i){const p=w(u),b=p==="range"&&(u==="date"||u==="datetime-local"||u==="timestamp");if(b){const t=r instanceof Date?r:new Date(r);if(isNaN(t.getTime()))return!0;const a=t.toISOString().split("T")[0],n=i.min,c=i.max;return n&&c?a>=n&&a<=c:n?a>=n:c?a<=c:!0}if(p==="range"&&!b){const t=Number(r),a=i.min?Number(i.min):void 0,n=i.max?Number(i.max):void 0;return a!==void 0&&n!==void 0?t>=a&&t<=n:a!==void 0?t>=a:n!==void 0?t<=n:!0}}return typeof i=="string"?String(r).toLowerCase().includes(i.toLowerCase()):!0}function A({entity:r,data:i,fieldsToFilter:u,variant:p="inline",style:b,testID:t}){const{t:a,i18n:n}=j("crud"),{t:c}=j([r.namespace,"crud"]),h=n?.language||"en",{data:L}=G(r,{enabled:!i}),D=i??(L?.items||[]),{filters:o,setFilters:d}=z({collection:r.collection}),C=I(()=>u?u.filter(e=>{const m=r.fields[e];return m&&N(m.type)}):Object.keys(r.fields).filter(e=>{const m=r.fields[e];return m&&N(m.type)}),[r.fields,u]),V=I(()=>C.length===0?null:C.map(e=>{const m=r.fields[e];if(!m)return null;const $=q(e,m,c),f=m.type||"text",x=w(f);if(!x)return R(new Error(`Field type "${f}" not registered in field type registry`),{userMessage:`Field type "${f}" is missing from registry`,context:{fieldType:f,fieldName:e,operation:"filter_ui_render"},severity:"warning"}),null;const F=x==="range"&&(f==="date"||f==="datetime-local"||f==="timestamp"),k=x==="range"&&!F,E=x==="select",g=o[e];if(E){const s=Array.from(new Set(D.map(l=>l[e]).filter(Boolean)));return v(B,{label:$,value:g,onValueChange:l=>{d({...o,[e]:l})},options:s.map(l=>({value:String(l),label:String(l)})),testID:t?`${t}-${e}`:void 0},e)}if(F)return v(P,{label:$,fieldType:f,value:g,onChange:s=>{if(s)d({...o,[e]:s});else{const{[e]:l,...y}=o;d(y)}},tCrud:a,locale:h,testID:t?`${t}-${e}`:void 0},e);if(k){const s=typeof g=="object"&&g!==null&&"min"in g?g:{min:"",max:""};return S(T,{gap:8,testID:t?`${t}-${e}`:void 0,children:[v(M,{label:$,minValue:s.min,maxValue:s.max,onChange:(l,y)=>{d({...o,[e]:{min:l,max:y}})},onClear:()=>{const{[e]:l,...y}=o;d(y)},testID:t?`${t}-${e}-range`:void 0}),v(_,{value:s.min?Number(s.min):0,onValueChange:l=>{d({...o,[e]:{...s,min:String(l)}})},testID:t?`${t}-${e}-slider`:void 0})]},e)}return null}),[C,r.fields,o,d,D,c,a,h,t]);return S(T,{gap:16,style:b,testID:t,children:[V,Object.keys(o).length>0&&v(O,{variant:"outline",onPress:()=>{d({})},testID:t?`${t}-clear`:void 0,children:a("filter.clearAll",{defaultValue:"Clear all filters"})})]})}var J=A;export{A as EntityFilters,J as default,H as matchesFilter};
|
|
@@ -37,8 +37,6 @@ export interface EntityFormRendererProps<T extends Record<string, unknown> = Rec
|
|
|
37
37
|
viewerRole?: ViewerRole;
|
|
38
38
|
/** Form operation type */
|
|
39
39
|
operation?: 'create' | 'edit';
|
|
40
|
-
/** Enable auto-save */
|
|
41
|
-
autoSave?: boolean;
|
|
42
40
|
/** Optional form ID */
|
|
43
41
|
formId?: string;
|
|
44
42
|
/** Cancel button text */
|
|
@@ -61,6 +59,6 @@ export interface EntityFormRendererProps<T extends Record<string, unknown> = Rec
|
|
|
61
59
|
/**
|
|
62
60
|
* EntityFormRenderer - Renders a form from entity definition
|
|
63
61
|
*/
|
|
64
|
-
export declare function EntityFormRenderer<T extends Record<string, any> = any>({ entity, onSubmit, t, style, submitText, loading, defaultValues, submitVariant, secondaryButtonText, secondaryButtonVariant, onSecondarySubmit, viewerRole: viewerRoleProp, operation,
|
|
62
|
+
export declare function EntityFormRenderer<T extends Record<string, any> = any>({ entity, onSubmit, t, style, submitText, loading, defaultValues, submitVariant, secondaryButtonText, secondaryButtonVariant, onSecondarySubmit, viewerRole: viewerRoleProp, operation, formId: externalFormId, cancelText, cancelPath, successPath, onCancel, warnOnUnsavedChanges, unsavedChangesMessage, hideVisibilityInfo, testID, }: EntityFormRendererProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
65
63
|
export default EntityFormRenderer;
|
|
66
64
|
//# sourceMappingURL=EntityFormRenderer.d.ts.map
|