property-practice-ui 0.0.2 → 0.0.4

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/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "property-practice-ui",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "private": false,
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.mjs",
9
+ "types": "./dist/index.d.ts",
6
10
  "exports": {
7
11
  ".": "./src/index.ts",
8
- "./types": "./types/index.ts",
12
+ "./types": "./src/types/index.ts",
9
13
  "./atoms": "./src/atoms/index.ts",
10
14
  "./molecules": "./src/molecules/index.ts"
11
15
  },
@@ -39,23 +43,27 @@
39
43
  "storybook": "^9.0.16",
40
44
  "tailwindcss": "^3.4.17",
41
45
  "tsconfig-paths": "^4.2.0",
46
+ "tsup": "^8.5.0",
42
47
  "typescript": "^5.8.3",
43
48
  "vitest": "^3.2.4"
44
49
  },
45
50
  "dependencies": {
51
+ "@headlessui/react": "^2.2.8",
52
+ "@heroicons/react": "^2.2.0",
46
53
  "axios": "^1.12.2",
47
54
  "framer-motion": "^12.23.2",
48
- "next": "15.3.6",
55
+ "next": "16.0.10",
56
+ "property-practice-icons": "^0.0.2",
49
57
  "react-hook-form": "^7.62.0",
50
58
  "react-icons": "^5.5.0",
51
59
  "styled-components": "^6.1.19",
52
- "tailwind-variants": "^1.0.0",
53
- "@heroicons/react": "^2.2.0",
54
- "tailwind-merge": "^3.3.1"
60
+ "tailwind-merge": "^3.3.1",
61
+ "tailwind-variants": "^1.0.0"
55
62
  },
56
63
  "scripts": {
57
64
  "storybook": "storybook dev -p 6006",
58
65
  "build-storybook": "storybook build",
66
+ "build:package": "tsup",
59
67
  "test": "jest",
60
68
  "format": "prettier --write \"**/*.@(js|jsx|mjs|ts|tsx)\"",
61
69
  "lint": ""
@@ -0,0 +1,106 @@
1
+ import {
2
+ Button,
3
+ Dialog as DefaultDialog,
4
+ DialogPanel,
5
+ DialogTitle,
6
+ Transition,
7
+ } from "@headlessui/react";
8
+ import { Fragment, ReactNode } from "react";
9
+
10
+ interface MyModalProps {
11
+ open: boolean;
12
+ onClose: () => void;
13
+ children?: ReactNode;
14
+ title?: string;
15
+ buttonText?: string;
16
+ buttonHandler?: () => void;
17
+ secondaryText?: string;
18
+ secondaryHandler?: () => void;
19
+ }
20
+
21
+ export const Dialog = ({
22
+ open,
23
+ onClose,
24
+ children,
25
+ title = "Payment successful",
26
+ buttonText = "Continue",
27
+ buttonHandler,
28
+ secondaryText,
29
+ secondaryHandler,
30
+ }: MyModalProps) => {
31
+ return (
32
+ <Transition appear show={open} as={Fragment}>
33
+ <DefaultDialog
34
+ open={open}
35
+ as="div"
36
+ className="relative z-10 focus:outline-none"
37
+ onClose={onClose}
38
+ __demoMode
39
+ >
40
+ <Transition.Child
41
+ as={Fragment}
42
+ enter="ease-out duration-300"
43
+ leave="ease-in duration-500"
44
+ enterFrom="opacity-0"
45
+ enterTo="opacity-100"
46
+ leaveFrom="opacity-100"
47
+ leaveTo="opacity-0"
48
+ >
49
+ <div className="fixed inset-0 bg-black/30" />
50
+ </Transition.Child>
51
+ <div className="fixed inset-0 z-10 w-screen overflow-y-auto">
52
+ <div className="flex min-h-full items-center justify-center p-4">
53
+ <DialogPanel
54
+ transition
55
+ className="w-full max-w-md rounded-lg bg-white dark:bg-white/5 p-6 backdrop-blur-1xl duration-300 ease-out"
56
+ style={{ maxWidth: "515px" }}
57
+ >
58
+ <div className="flex justify-between items-center mb-2">
59
+ <DialogTitle
60
+ as="h3"
61
+ className="text-2xl pb-3 font-bold dark:text-white text-center w-full"
62
+ >
63
+ {title}
64
+ </DialogTitle>
65
+ <button
66
+ type="button"
67
+ onClick={onClose}
68
+ aria-label="Close"
69
+ className="text-gray-300 hover:text-gray-300 text-xl font-bold focus:outline-none px-2"
70
+ style={{ lineHeight: 1 }}
71
+ >
72
+ ×
73
+ </button>
74
+ </div>
75
+ {children}
76
+ <div
77
+ className={`${
78
+ secondaryHandler && secondaryText
79
+ ? "flex justify-center mt-4 gap-4"
80
+ : "mt-4"
81
+ }`}
82
+ >
83
+ {buttonHandler && (
84
+ <Button
85
+ className="inline-flex items-center gap-2 rounded-md bg-gray-700 px-3 py-1.5 text-sm/6 font-semibold text-white shadow-inner shadow-white/10 focus:not-data-focus:outline-none data-focus:outline data-focus:outline-white data-hover:bg-gray-600 data-open:bg-gray-700"
86
+ onClick={buttonHandler}
87
+ >
88
+ {buttonText}
89
+ </Button>
90
+ )}
91
+ {secondaryHandler && secondaryText && (
92
+ <Button
93
+ className="bg-gray-200 text-gray-800 px-4 py-2 w-24 rounded hover:bg-gray-300"
94
+ onClick={secondaryHandler}
95
+ >
96
+ {secondaryText}
97
+ </Button>
98
+ )}
99
+ </div>
100
+ </DialogPanel>
101
+ </div>
102
+ </div>
103
+ </DefaultDialog>
104
+ </Transition>
105
+ );
106
+ }
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { Dropdown } from '@repo/property-practice-ui';
3
+ import { Dropdown } from 'property-practice-ui';
4
4
  import { Option } from '../../types';
5
5
 
6
6
  interface FilterProps<T extends string | number> {
@@ -1,6 +1,6 @@
1
- import { MenuItem, MenuSubItem } from '../../types/menuItem';
2
1
  import Link from 'next/link';
3
2
  import { tv } from 'tailwind-variants';
3
+ import { MenuItem, MenuSubItem } from '../types/menuItem';
4
4
 
5
5
  interface Props {
6
6
  direction: 'horizontal' | 'vertical';
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { useEffect, useState } from 'react';
4
- import { OrderType } from '../../../types/orderType';
4
+ import { OrderType } from '../../types/orderType';
5
5
 
6
6
  interface SortByProps {
7
7
  value: OrderType;
@@ -1,5 +1,5 @@
1
1
  import { tv } from 'tailwind-variants';
2
- import { TableListItem as TableListItemType } from '../../types';
2
+ import type { TableListItemType } from '../types/tableListItem';
3
3
 
4
4
  const itemContainer = tv({
5
5
  base: 'rounded-2xl mb-2 px-8 py-3 flex flex-wrap items-center justify-between gap-4',
@@ -1,14 +1,14 @@
1
1
  'use client';
2
2
 
3
3
  import Link from 'next/link';
4
- import { useEffect, useMemo, useState } from 'react';
5
- import { tv } from 'tailwind-variants';
6
- import AppDialog from '../../../../../apps/admin-frontend/components/dialog';
7
4
  import {
8
5
  ClockIcon,
9
6
  HomeIcon,
10
7
  TrashIcon,
11
- } from '../../../../property-practice-icons/src';
8
+ } from 'property-practice-icons';
9
+ import { useEffect, useMemo, useState } from 'react';
10
+ import { tv } from 'tailwind-variants';
11
+ import { Dialog } from '../Dialog/Dialog';
12
12
  import { TableHeaderConfig } from '../Table/Table';
13
13
 
14
14
  type PaginationOptionsType = {
@@ -92,7 +92,7 @@ const RowCell = ({
92
92
  <p className="text-base font-medium text-gray-400 flex items-center gap-1">
93
93
  {header.filterAccessor === 'formattedAddress' && <HomeIcon />}
94
94
  {header.filterAccessor === 'formattedAddress' ? (
95
- <span className="truncate max-w-[200px] block">
95
+ <span className="break-words max-w-[200px] block">
96
96
  {item[header.filterAccessor]}
97
97
  </span>
98
98
  ) : header.filterAccessor === 'status' ? (
@@ -119,7 +119,7 @@ const DeleteDialog = ({
119
119
  onConfirm: () => void;
120
120
  isDeleting: boolean;
121
121
  }) => (
122
- <AppDialog
122
+ <Dialog
123
123
  open={open}
124
124
  onClose={onClose}
125
125
  title="Delete Transaction"
@@ -135,7 +135,7 @@ const DeleteDialog = ({
135
135
  property from the list (soft delete).
136
136
  </p>
137
137
  </div>
138
- </AppDialog>
138
+ </Dialog>
139
139
  );
140
140
 
141
141
  export const TableRow = ({
@@ -1,32 +1,23 @@
1
1
  'use client';
2
2
 
3
- import { useMemo, useState } from 'react';
4
- import {
5
- TransactionTypeEnum,
6
- TransactionTypeEnumType,
7
- } from '../../../../property-practice-dtos';
3
+ import { useState } from 'react';
4
+ import { Option } from '../../types';
8
5
 
9
- interface TabsProps {
10
- saleData: any[];
11
- leaseData: any[];
12
- defaultTab?: TransactionTypeEnumType;
13
- onTabChange?: (tab: TransactionTypeEnumType) => void;
6
+ interface TabsProps <T>{
7
+ defaultTab: T;
8
+ onTabChange?: (tab: T) => void;
9
+ options: Option<T>[]
14
10
  }
15
11
 
16
- export const Tabs = ({
17
- saleData,
18
- leaseData,
19
- defaultTab = TransactionTypeEnum.enum.SALE,
12
+ export const Tabs = <T extends string | number>({
13
+ defaultTab,
20
14
  onTabChange,
21
- }: TabsProps) => {
22
- const [tab, setTab] = useState<TransactionTypeEnumType>(defaultTab);
15
+ options
16
+ }: TabsProps<T>) => {
17
+ const [tab, setTab] = useState<T>(defaultTab);
23
18
 
24
- const displayedData = useMemo(
25
- () => (tab === TransactionTypeEnum.enum.SALE ? saleData : leaseData),
26
- [tab, saleData, leaseData],
27
- );
28
19
 
29
- const handleTabChange = (newTab: TransactionTypeEnumType) => {
20
+ const handleTabChange = (newTab: T) => {
30
21
  setTab(newTab);
31
22
  onTabChange?.(newTab);
32
23
  };
@@ -35,18 +26,18 @@ export const Tabs = ({
35
26
  <div className="flex flex-col gap-4">
36
27
  <div className="px-4 border-b border-gray-300 bg-white">
37
28
  <div className="flex gap-x-10 py-3">
38
- {Object.values(TransactionTypeEnum.enum).map((type) => (
29
+ {options.map(({label, value}) => (
39
30
  <button
40
- key={type}
31
+ key={value}
41
32
  type="button"
42
- onClick={() => handleTabChange(type as TransactionTypeEnumType)}
33
+ onClick={() => handleTabChange(value)}
43
34
  className={`text-base font-semibold cursor-pointer px-6 py-2 rounded-t-lg border-b-4 transition-colors duration-200 ${
44
- tab === type
35
+ tab === value
45
36
  ? 'border-blue-600 text-[#033c89]'
46
37
  : 'border-transparent text-gray-400 dark:text-[#033c89]'
47
38
  }`}
48
39
  >
49
- {type.charAt(0).toUpperCase() + type.slice(1).toLowerCase()}
40
+ {label.charAt(0).toUpperCase() + label.slice(1).toLowerCase()}
50
41
  </button>
51
42
  ))}
52
43
  </div>
@@ -1,8 +1,6 @@
1
- 'use client';
2
-
3
1
  import { useEffect } from 'react';
4
2
  import { tv } from 'tailwind-variants';
5
- import { ToastType } from '../../types';
3
+ import { ToastType } from '../types/toast';
6
4
 
7
5
  interface Props {
8
6
  visible?: boolean;
@@ -1,7 +1,5 @@
1
- 'use client';
2
-
3
- import { useEffect, useState } from 'react';
4
1
  import { motion, useAnimation } from 'framer-motion';
2
+ import { useEffect, useState } from 'react';
5
3
  import { tv } from 'tailwind-variants';
6
4
 
7
5
  export const navbar = tv({
package/src/index.ts CHANGED
@@ -1,6 +1,4 @@
1
- export { default as FileUpload } from './components/FileUpload';
2
1
  export { Filter } from './components/Filter/Filter';
3
- export { default as ModeSwitch } from './components/ModeSwitch';
4
2
  export { default as NavMenu } from './components/NavMenu';
5
3
  export { Search } from './components/SearchBar/Search';
6
4
  export { SortBy } from './components/SortBy/SortBy';
@@ -16,4 +14,3 @@ export { default as TopMenu } from './components/TopMenu';
16
14
  export * from './molecules';
17
15
  export * from './organism';
18
16
  export * from './templates';
19
-
@@ -1,6 +1,6 @@
1
1
  import { createContext, ReactNode, useContext, useState } from 'react';
2
- import { ToastType } from '../../../types';
3
2
  import Toast from '../../components/Toast';
3
+ import type { ToastType } from '../../types/toast';
4
4
 
5
5
  type ShowToastInput = {
6
6
  type?: ToastType;
@@ -1,3 +1,4 @@
1
+ import { ComponentProps } from 'react';
1
2
  import styled from 'styled-components';
2
3
  import { ExtendedButton, Header, TermsCheckbox } from '../../atoms';
3
4
  import { ContactForm } from '../../organism';
@@ -75,7 +76,7 @@ interface ContactProps {
75
76
  termsVariant?: 'primary' | 'secondary' | 'subtle';
76
77
  buttonArrowVariant?: 'brand' | 'teal' | 'blue';
77
78
  buttonTextBgVariant?: 'primary' | 'secondary' | 'tertiary' | 'subtle' | 'blue' | 'brand' | 'light' | 'transparent';
78
- buttonTextVariant?: ComponentTextColor;
79
+ buttonTextVariant?: ComponentProps<typeof ExtendedButton>['textVariant'];
79
80
  }
80
81
 
81
82
  export const Contact = ({
@@ -1,3 +1,4 @@
1
+ import { ComponentProps } from 'react';
1
2
  import styled from 'styled-components';
2
3
  import { Header } from '../../atoms';
3
4
  import { ProductInfo } from '../../molecules';
@@ -45,7 +46,7 @@ interface OtherProductsProps {
45
46
  productTitleColor?: ComponentTextColor;
46
47
  productButtonArrowVariant?: 'brand' | 'teal' | 'blue';
47
48
  productButtonTextBgVariant?: 'primary' | 'secondary' | 'tertiary' | 'subtle' | 'blue' | 'brand' | 'light' | 'transparent';
48
- productButtonTextVariant?: ComponentTextColor;
49
+ productButtonTextVariant?: ComponentProps<typeof ProductInfo>['buttonTextVariant'];
49
50
  }
50
51
 
51
52
  export const OtherProducts = ({
@@ -0,0 +1,6 @@
1
+ export * from './inputAttributes';
2
+ export * from './menuItem';
3
+ export * from './orderType';
4
+ export * from './tableListItem';
5
+ export * from './toast';
6
+
@@ -1,4 +1,4 @@
1
- export type TableListItem = {
1
+ export type TableListItemType = {
2
2
  title: string;
3
3
  status?: string;
4
4
  date: Date;
package/tsconfig.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "extends": "@repo/typescript-config/react-library.json",
3
3
  "compilerOptions": {
4
- "outDir": "dist"
4
+ "outDir": "dist",
5
+ "rootDir": "src"
5
6
  },
6
7
  "include": ["src"],
7
8
  "exclude": ["node_modules", "dist", ".storybook"]
package/tsup.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: ["./src/index.ts"],
5
+ splitting: true,
6
+ clean: true,
7
+ outDir: 'dist',
8
+ tsconfig: './tsconfig.json',
9
+ dts: true,
10
+ format: ['cjs', 'esm'],
11
+ })