@stableflow/pay-ui 0.0.1-beta-82ede460a5-20260923
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/autocomplete/index.d.ts +27 -0
- package/dist/autocomplete/index.js +229 -0
- package/dist/autocomplete/index.js.map +1 -0
- package/dist/button/index.d.ts +28 -0
- package/dist/button/index.js +83 -0
- package/dist/button/index.js.map +1 -0
- package/dist/card/index.d.ts +7 -0
- package/dist/card/index.js +8 -0
- package/dist/card/index.js.map +1 -0
- package/dist/checkbox/index.d.ts +11 -0
- package/dist/checkbox/index.js +54 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/chunk-6OV2OZVR.js +34 -0
- package/dist/chunk-6OV2OZVR.js.map +1 -0
- package/dist/chunk-AIJAGS5R.js +223 -0
- package/dist/chunk-AIJAGS5R.js.map +1 -0
- package/dist/chunk-DON56HU7.js +113 -0
- package/dist/chunk-DON56HU7.js.map +1 -0
- package/dist/chunk-FXENEWNN.js +7 -0
- package/dist/chunk-FXENEWNN.js.map +1 -0
- package/dist/chunk-J5TQGGEN.js +57 -0
- package/dist/chunk-J5TQGGEN.js.map +1 -0
- package/dist/chunk-MJ36QLY3.js +23 -0
- package/dist/chunk-MJ36QLY3.js.map +1 -0
- package/dist/chunk-NZGSPYWG.js +34 -0
- package/dist/chunk-NZGSPYWG.js.map +1 -0
- package/dist/chunk-OGSFVQK2.js +34 -0
- package/dist/chunk-OGSFVQK2.js.map +1 -0
- package/dist/chunk-R46DAHYR.js +14 -0
- package/dist/chunk-R46DAHYR.js.map +1 -0
- package/dist/chunk-R4BKHISR.js +34 -0
- package/dist/chunk-R4BKHISR.js.map +1 -0
- package/dist/chunk-RUOUGZWI.js +73 -0
- package/dist/chunk-RUOUGZWI.js.map +1 -0
- package/dist/chunk-SE7Z4ZYP.js +34 -0
- package/dist/chunk-SE7Z4ZYP.js.map +1 -0
- package/dist/chunk-TUEV2KLC.js +11 -0
- package/dist/chunk-TUEV2KLC.js.map +1 -0
- package/dist/chunk-VAPGLPZ5.js +184 -0
- package/dist/chunk-VAPGLPZ5.js.map +1 -0
- package/dist/date-range-picker/index.d.ts +42 -0
- package/dist/date-range-picker/index.js +272 -0
- package/dist/date-range-picker/index.js.map +1 -0
- package/dist/dialog/index.d.ts +7 -0
- package/dist/dialog/index.js +116 -0
- package/dist/dialog/index.js.map +1 -0
- package/dist/drawer/index.d.ts +17 -0
- package/dist/drawer/index.js +15 -0
- package/dist/drawer/index.js.map +1 -0
- package/dist/dropdown/index.d.ts +29 -0
- package/dist/dropdown/index.js +198 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/icons/alert.d.ts +6 -0
- package/dist/icons/alert.js +9 -0
- package/dist/icons/alert.js.map +1 -0
- package/dist/icons/all-networks.d.ts +6 -0
- package/dist/icons/all-networks.js +30 -0
- package/dist/icons/all-networks.js.map +1 -0
- package/dist/icons/arrow-down.d.ts +6 -0
- package/dist/icons/arrow-down.js +9 -0
- package/dist/icons/arrow-down.js.map +1 -0
- package/dist/icons/back.d.ts +6 -0
- package/dist/icons/back.js +47 -0
- package/dist/icons/back.js.map +1 -0
- package/dist/icons/bonus.d.ts +6 -0
- package/dist/icons/bonus.js +33 -0
- package/dist/icons/bonus.js.map +1 -0
- package/dist/icons/book.d.ts +6 -0
- package/dist/icons/book.js +30 -0
- package/dist/icons/book.js.map +1 -0
- package/dist/icons/calendar.d.ts +6 -0
- package/dist/icons/calendar.js +33 -0
- package/dist/icons/calendar.js.map +1 -0
- package/dist/icons/cash.d.ts +6 -0
- package/dist/icons/cash.js +33 -0
- package/dist/icons/cash.js.map +1 -0
- package/dist/icons/check.d.ts +6 -0
- package/dist/icons/check.js +9 -0
- package/dist/icons/check.js.map +1 -0
- package/dist/icons/chevron.d.ts +6 -0
- package/dist/icons/chevron.js +33 -0
- package/dist/icons/chevron.js.map +1 -0
- package/dist/icons/close.d.ts +6 -0
- package/dist/icons/close.js +9 -0
- package/dist/icons/close.js.map +1 -0
- package/dist/icons/cloud.d.ts +6 -0
- package/dist/icons/cloud.js +33 -0
- package/dist/icons/cloud.js.map +1 -0
- package/dist/icons/code.d.ts +6 -0
- package/dist/icons/code.js +36 -0
- package/dist/icons/code.js.map +1 -0
- package/dist/icons/copy.d.ts +6 -0
- package/dist/icons/copy.js +33 -0
- package/dist/icons/copy.js.map +1 -0
- package/dist/icons/database.d.ts +6 -0
- package/dist/icons/database.js +33 -0
- package/dist/icons/database.js.map +1 -0
- package/dist/icons/delete.d.ts +6 -0
- package/dist/icons/delete.js +33 -0
- package/dist/icons/delete.js.map +1 -0
- package/dist/icons/download.d.ts +6 -0
- package/dist/icons/download.js +30 -0
- package/dist/icons/download.js.map +1 -0
- package/dist/icons/duration.d.ts +6 -0
- package/dist/icons/duration.js +36 -0
- package/dist/icons/duration.js.map +1 -0
- package/dist/icons/email.d.ts +6 -0
- package/dist/icons/email.js +30 -0
- package/dist/icons/email.js.map +1 -0
- package/dist/icons/expense-user.d.ts +6 -0
- package/dist/icons/expense-user.js +33 -0
- package/dist/icons/expense-user.js.map +1 -0
- package/dist/icons/expense.d.ts +6 -0
- package/dist/icons/expense.js +30 -0
- package/dist/icons/expense.js.map +1 -0
- package/dist/icons/eye.d.ts +8 -0
- package/dist/icons/eye.js +59 -0
- package/dist/icons/eye.js.map +1 -0
- package/dist/icons/fee.d.ts +6 -0
- package/dist/icons/fee.js +34 -0
- package/dist/icons/fee.js.map +1 -0
- package/dist/icons/field-error.d.ts +6 -0
- package/dist/icons/field-error.js +40 -0
- package/dist/icons/field-error.js.map +1 -0
- package/dist/icons/flask.d.ts +6 -0
- package/dist/icons/flask.js +33 -0
- package/dist/icons/flask.js.map +1 -0
- package/dist/icons/google.d.ts +6 -0
- package/dist/icons/google.js +54 -0
- package/dist/icons/google.js.map +1 -0
- package/dist/icons/grants.d.ts +6 -0
- package/dist/icons/grants.js +33 -0
- package/dist/icons/grants.js.map +1 -0
- package/dist/icons/guard.d.ts +6 -0
- package/dist/icons/guard.js +33 -0
- package/dist/icons/guard.js.map +1 -0
- package/dist/icons/history.d.ts +6 -0
- package/dist/icons/history.js +33 -0
- package/dist/icons/history.js.map +1 -0
- package/dist/icons/import-file.d.ts +6 -0
- package/dist/icons/import-file.js +30 -0
- package/dist/icons/import-file.js.map +1 -0
- package/dist/icons/key.d.ts +6 -0
- package/dist/icons/key.js +34 -0
- package/dist/icons/key.js.map +1 -0
- package/dist/icons/kol-mkt.d.ts +6 -0
- package/dist/icons/kol-mkt.js +33 -0
- package/dist/icons/kol-mkt.js.map +1 -0
- package/dist/icons/link.d.ts +9 -0
- package/dist/icons/link.js +85 -0
- package/dist/icons/link.js.map +1 -0
- package/dist/icons/loading.d.ts +6 -0
- package/dist/icons/loading.js +9 -0
- package/dist/icons/loading.js.map +1 -0
- package/dist/icons/lock.d.ts +6 -0
- package/dist/icons/lock.js +33 -0
- package/dist/icons/lock.js.map +1 -0
- package/dist/icons/logout.d.ts +6 -0
- package/dist/icons/logout.js +33 -0
- package/dist/icons/logout.js.map +1 -0
- package/dist/icons/meno.d.ts +6 -0
- package/dist/icons/meno.js +33 -0
- package/dist/icons/meno.js.map +1 -0
- package/dist/icons/menu.d.ts +6 -0
- package/dist/icons/menu.js +33 -0
- package/dist/icons/menu.js.map +1 -0
- package/dist/icons/money.d.ts +6 -0
- package/dist/icons/money.js +33 -0
- package/dist/icons/money.js.map +1 -0
- package/dist/icons/more.d.ts +6 -0
- package/dist/icons/more.js +30 -0
- package/dist/icons/more.js.map +1 -0
- package/dist/icons/node.d.ts +6 -0
- package/dist/icons/node.js +33 -0
- package/dist/icons/node.js.map +1 -0
- package/dist/icons/office.d.ts +6 -0
- package/dist/icons/office.js +33 -0
- package/dist/icons/office.js.map +1 -0
- package/dist/icons/operations.d.ts +6 -0
- package/dist/icons/operations.js +33 -0
- package/dist/icons/operations.js.map +1 -0
- package/dist/icons/otc-treasury.d.ts +6 -0
- package/dist/icons/otc-treasury.js +33 -0
- package/dist/icons/otc-treasury.js.map +1 -0
- package/dist/icons/outsourcing.d.ts +6 -0
- package/dist/icons/outsourcing.js +33 -0
- package/dist/icons/outsourcing.js.map +1 -0
- package/dist/icons/overview.d.ts +6 -0
- package/dist/icons/overview.js +33 -0
- package/dist/icons/overview.js.map +1 -0
- package/dist/icons/pay.d.ts +6 -0
- package/dist/icons/pay.js +36 -0
- package/dist/icons/pay.js.map +1 -0
- package/dist/icons/payment.d.ts +6 -0
- package/dist/icons/payment.js +33 -0
- package/dist/icons/payment.js.map +1 -0
- package/dist/icons/payout-status.d.ts +8 -0
- package/dist/icons/payout-status.js +92 -0
- package/dist/icons/payout-status.js.map +1 -0
- package/dist/icons/payroll.d.ts +6 -0
- package/dist/icons/payroll.js +62 -0
- package/dist/icons/payroll.js.map +1 -0
- package/dist/icons/pen.d.ts +6 -0
- package/dist/icons/pen.js +33 -0
- package/dist/icons/pen.js.map +1 -0
- package/dist/icons/plus.d.ts +6 -0
- package/dist/icons/plus.js +33 -0
- package/dist/icons/plus.js.map +1 -0
- package/dist/icons/processing.d.ts +6 -0
- package/dist/icons/processing.js +34 -0
- package/dist/icons/processing.js.map +1 -0
- package/dist/icons/procurement.d.ts +6 -0
- package/dist/icons/procurement.js +33 -0
- package/dist/icons/procurement.js.map +1 -0
- package/dist/icons/question.d.ts +6 -0
- package/dist/icons/question.js +30 -0
- package/dist/icons/question.js.map +1 -0
- package/dist/icons/receipt.d.ts +6 -0
- package/dist/icons/receipt.js +30 -0
- package/dist/icons/receipt.js.map +1 -0
- package/dist/icons/records.d.ts +8 -0
- package/dist/icons/records.js +63 -0
- package/dist/icons/records.js.map +1 -0
- package/dist/icons/refresh.d.ts +6 -0
- package/dist/icons/refresh.js +33 -0
- package/dist/icons/refresh.js.map +1 -0
- package/dist/icons/reimbursement.d.ts +6 -0
- package/dist/icons/reimbursement.js +33 -0
- package/dist/icons/reimbursement.js.map +1 -0
- package/dist/icons/remove.d.ts +6 -0
- package/dist/icons/remove.js +50 -0
- package/dist/icons/remove.js.map +1 -0
- package/dist/icons/request.d.ts +6 -0
- package/dist/icons/request.js +30 -0
- package/dist/icons/request.js.map +1 -0
- package/dist/icons/reset-password.d.ts +6 -0
- package/dist/icons/reset-password.js +33 -0
- package/dist/icons/reset-password.js.map +1 -0
- package/dist/icons/search.d.ts +6 -0
- package/dist/icons/search.js +9 -0
- package/dist/icons/search.js.map +1 -0
- package/dist/icons/setting.d.ts +6 -0
- package/dist/icons/setting.js +33 -0
- package/dist/icons/setting.js.map +1 -0
- package/dist/icons/settings.d.ts +6 -0
- package/dist/icons/settings.js +30 -0
- package/dist/icons/settings.js.map +1 -0
- package/dist/icons/shield.d.ts +6 -0
- package/dist/icons/shield.js +33 -0
- package/dist/icons/shield.js.map +1 -0
- package/dist/icons/success.d.ts +6 -0
- package/dist/icons/success.js +34 -0
- package/dist/icons/success.js.map +1 -0
- package/dist/icons/support.d.ts +6 -0
- package/dist/icons/support.js +33 -0
- package/dist/icons/support.js.map +1 -0
- package/dist/icons/swap.d.ts +6 -0
- package/dist/icons/swap.js +42 -0
- package/dist/icons/swap.js.map +1 -0
- package/dist/icons/team.d.ts +6 -0
- package/dist/icons/team.js +33 -0
- package/dist/icons/team.js.map +1 -0
- package/dist/icons/to-right.d.ts +6 -0
- package/dist/icons/to-right.js +35 -0
- package/dist/icons/to-right.js.map +1 -0
- package/dist/icons/types.d.ts +8 -0
- package/dist/icons/types.js +1 -0
- package/dist/icons/types.js.map +1 -0
- package/dist/icons/up.d.ts +8 -0
- package/dist/icons/up.js +59 -0
- package/dist/icons/up.js.map +1 -0
- package/dist/icons/wallet.d.ts +6 -0
- package/dist/icons/wallet.js +42 -0
- package/dist/icons/wallet.js.map +1 -0
- package/dist/icons/webhooks.d.ts +6 -0
- package/dist/icons/webhooks.js +30 -0
- package/dist/icons/webhooks.js.map +1 -0
- package/dist/input-number/index.d.ts +10 -0
- package/dist/input-number/index.js +55 -0
- package/dist/input-number/index.js.map +1 -0
- package/dist/overlay/index.d.ts +48 -0
- package/dist/overlay/index.js +41 -0
- package/dist/overlay/index.js.map +1 -0
- package/dist/pagination/index.d.ts +11 -0
- package/dist/pagination/index.js +55 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/search-input/index.d.ts +13 -0
- package/dist/search-input/index.js +60 -0
- package/dist/search-input/index.js.map +1 -0
- package/dist/skeleton/index.d.ts +7 -0
- package/dist/skeleton/index.js +8 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/switch/index.d.ts +14 -0
- package/dist/switch/index.js +79 -0
- package/dist/switch/index.js.map +1 -0
- package/dist/table/index.d.ts +29 -0
- package/dist/table/index.js +95 -0
- package/dist/table/index.js.map +1 -0
- package/dist/toast/index.d.ts +21 -0
- package/dist/toast/index.js +85 -0
- package/dist/toast/index.js.map +1 -0
- package/dist/tooltip/index.d.ts +17 -0
- package/dist/tooltip/index.js +104 -0
- package/dist/tooltip/index.js.map +1 -0
- package/dist/types-DNElDQZ9.d.ts +23 -0
- package/dist/use-floating-position-aNqQwkre.d.ts +33 -0
- package/package.json +111 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/switch/Switch.tsx","../../src/switch/config.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { motion, type HTMLMotionProps } from \"motion/react\";\nimport { IconLoading } from \"../icons/loading\";\nimport { cn } from \"../lib/cn\";\nimport { SWITCH_THUMB_TRAVEL_PX } from \"./config\";\n\nexport type SwitchProps = Omit<\n HTMLMotionProps<\"button\">,\n \"onChange\" | \"role\" | \"aria-checked\" | \"children\" | \"animate\" | \"initial\" | \"transition\"\n> & {\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n loading?: boolean;\n};\n\nexport function Switch(props: SwitchProps) {\n const {\n checked,\n defaultChecked = false,\n onCheckedChange,\n disabled,\n loading = false,\n className,\n type = \"button\",\n onClick,\n ...restProps\n } = props;\n const [uncontrolledChecked, setUncontrolledChecked] = useState(defaultChecked);\n const isChecked = checked ?? uncontrolledChecked;\n const isDisabled = Boolean(disabled);\n\n const toggle = () => {\n const nextChecked = !isChecked;\n if (checked === undefined) setUncontrolledChecked(nextChecked);\n onCheckedChange?.(nextChecked);\n };\n\n return (\n <motion.button\n type={type}\n role=\"switch\"\n aria-checked={isChecked}\n aria-busy={loading || undefined}\n disabled={isDisabled || loading}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented || loading || isDisabled) return;\n toggle();\n }}\n className={cn(\n \"relative h-5 w-[34px] shrink-0 cursor-pointer rounded-full border border-[#e3e3e3] bg-[#F6F6F6] p-[1px] outline-none select-none transition-colors aria-checked:bg-[#6284F5]\",\n (isDisabled || loading) && \"pointer-events-none cursor-not-allowed\",\n isDisabled && \"opacity-30\",\n loading && \"opacity-100\",\n className,\n )}\n {...restProps}\n >\n <motion.span\n aria-hidden\n initial={false}\n animate={{ x: isChecked ? SWITCH_THUMB_TRAVEL_PX : 0 }}\n transition={{ type: \"spring\", stiffness: 500, damping: 32 }}\n className={cn(\n \"absolute top-[1px] left-[1px] flex size-4 items-center justify-center\",\n loading ? \"rounded-full bg-white/75\" : \"rounded-full border border-[#d9d9d9] bg-white\",\n )}\n >\n {loading ? <IconLoading className=\"size-3.25 shrink-0 animate-spin text-[#909090]\" /> : null}\n </motion.span>\n </motion.button>\n );\n}\n\nexport default Switch;\n","export const SWITCH_THUMB_TRAVEL_PX = 13;\n"],"mappings":";;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,cAAoC;;;ACDtC,IAAM,yBAAyB;;;ADqEnB;AArDZ,SAAS,OAAO,OAAoB;AACzC,QAAM;AAAA,IACJ;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAS,cAAc;AAC7E,QAAM,YAAY,WAAW;AAC7B,QAAM,aAAa,QAAQ,QAAQ;AAEnC,QAAM,SAAS,MAAM;AACnB,UAAM,cAAc,CAAC;AACrB,QAAI,YAAY,OAAW,wBAAuB,WAAW;AAC7D,sBAAkB,WAAW;AAAA,EAC/B;AAEA,SACE;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,gBAAc;AAAA,MACd,aAAW,WAAW;AAAA,MACtB,UAAU,cAAc;AAAA,MACxB,SAAS,CAAC,UAAU;AAClB,kBAAU,KAAK;AACf,YAAI,MAAM,oBAAoB,WAAW,WAAY;AACrD,eAAO;AAAA,MACT;AAAA,MACA,WAAW;AAAA,QACT;AAAA,SACC,cAAc,YAAY;AAAA,QAC3B,cAAc;AAAA,QACd,WAAW;AAAA,QACX;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA,QAAC,OAAO;AAAA,QAAP;AAAA,UACC,eAAW;AAAA,UACX,SAAS;AAAA,UACT,SAAS,EAAE,GAAG,YAAY,yBAAyB,EAAE;AAAA,UACrD,YAAY,EAAE,MAAM,UAAU,WAAW,KAAK,SAAS,GAAG;AAAA,UAC1D,WAAW;AAAA,YACT;AAAA,YACA,UAAU,6BAA6B;AAAA,UACzC;AAAA,UAEC,oBAAU,oBAAC,eAAY,WAAU,kDAAiD,IAAK;AAAA;AAAA,MAC1F;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type TableProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
columns: string;
|
|
6
|
+
scrollClassName?: string;
|
|
7
|
+
toolbar?: ReactNode;
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare function Table(props: TableProps): react.JSX.Element;
|
|
12
|
+
type TableHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
13
|
+
declare function TableHeader(props: TableHeaderProps): react.JSX.Element;
|
|
14
|
+
type TableBodyProps = HTMLAttributes<HTMLDivElement>;
|
|
15
|
+
declare function TableBody(props: TableBodyProps): react.JSX.Element;
|
|
16
|
+
type TableRowProps = HTMLAttributes<HTMLDivElement>;
|
|
17
|
+
declare function TableRow(props: TableRowProps): react.JSX.Element;
|
|
18
|
+
type TableHeadProps = HTMLAttributes<HTMLDivElement>;
|
|
19
|
+
declare function TableHead(props: TableHeadProps): react.JSX.Element;
|
|
20
|
+
type TableCellProps = HTMLAttributes<HTMLDivElement>;
|
|
21
|
+
declare function TableCell(props: TableCellProps): react.JSX.Element;
|
|
22
|
+
|
|
23
|
+
declare const TABLE_SKELETON_ROWS = 3;
|
|
24
|
+
declare function TableSkeletonRows({ cells, rows }: {
|
|
25
|
+
cells: number;
|
|
26
|
+
rows?: number;
|
|
27
|
+
}): react.JSX.Element;
|
|
28
|
+
|
|
29
|
+
export { TABLE_SKELETON_ROWS, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, TableSkeletonRows };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Skeleton
|
|
3
|
+
} from "../chunk-R46DAHYR.js";
|
|
4
|
+
import {
|
|
5
|
+
Card
|
|
6
|
+
} from "../chunk-MJ36QLY3.js";
|
|
7
|
+
import {
|
|
8
|
+
fontSans
|
|
9
|
+
} from "../chunk-FXENEWNN.js";
|
|
10
|
+
import {
|
|
11
|
+
cn
|
|
12
|
+
} from "../chunk-TUEV2KLC.js";
|
|
13
|
+
|
|
14
|
+
// src/table/Table.tsx
|
|
15
|
+
import { createContext, useContext } from "react";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var TableContext = createContext(null);
|
|
18
|
+
function useTableContext() {
|
|
19
|
+
const context = useContext(TableContext);
|
|
20
|
+
if (!context) throw new Error("Table compound components must be used within Table.");
|
|
21
|
+
return context;
|
|
22
|
+
}
|
|
23
|
+
function columnsStyle(columns) {
|
|
24
|
+
return { gridTemplateColumns: columns };
|
|
25
|
+
}
|
|
26
|
+
function Table(props) {
|
|
27
|
+
const { columns, className, scrollClassName, toolbar, footer, children, style, ...restProps } = props;
|
|
28
|
+
return /* @__PURE__ */ jsx(TableContext.Provider, { value: { columns }, children: /* @__PURE__ */ jsxs(Card, { className: cn("flex min-h-0 flex-col overflow-hidden p-5", className), style, ...restProps, children: [
|
|
29
|
+
toolbar ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: toolbar }) : null,
|
|
30
|
+
/* @__PURE__ */ jsx("div", { className: cn("min-h-0 flex-1 overflow-auto [scrollbar-gutter:stable]", scrollClassName), children: /* @__PURE__ */ jsx("div", { className: "min-w-full", children }) }),
|
|
31
|
+
footer ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: footer }) : null
|
|
32
|
+
] }) });
|
|
33
|
+
}
|
|
34
|
+
function TableHeader(props) {
|
|
35
|
+
const { className, style, ...restProps } = props;
|
|
36
|
+
const { columns } = useTableContext();
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: cn(
|
|
41
|
+
"sticky top-0 z-10 grid w-full min-w-min border-b border-black/10 bg-[#FDFDFD] text-sm font-medium text-[#aaa] capitalize",
|
|
42
|
+
fontSans,
|
|
43
|
+
className
|
|
44
|
+
),
|
|
45
|
+
style: { ...columnsStyle(columns), ...style },
|
|
46
|
+
...restProps
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function TableBody(props) {
|
|
51
|
+
const { className, ...restProps } = props;
|
|
52
|
+
return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...restProps });
|
|
53
|
+
}
|
|
54
|
+
function TableRow(props) {
|
|
55
|
+
const { className, style, ...restProps } = props;
|
|
56
|
+
const { columns } = useTableContext();
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: cn(
|
|
61
|
+
"grid w-full min-w-min border-b border-black/10 text-sm font-medium text-black last:border-b-0",
|
|
62
|
+
fontSans,
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
style: { ...columnsStyle(columns), ...style },
|
|
66
|
+
...restProps
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function TableHead(props) {
|
|
71
|
+
const { className, ...restProps } = props;
|
|
72
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex min-w-0 items-center px-2 py-3.5 first:pl-0 last:pr-0", className), ...restProps });
|
|
73
|
+
}
|
|
74
|
+
function TableCell(props) {
|
|
75
|
+
const { className, ...restProps } = props;
|
|
76
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex min-w-0 items-center px-2 py-3.5 first:pl-0 last:pr-0", className), ...restProps });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/table/TableSkeletonRows.tsx
|
|
80
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
81
|
+
var TABLE_SKELETON_ROWS = 3;
|
|
82
|
+
function TableSkeletonRows({ cells, rows = TABLE_SKELETON_ROWS }) {
|
|
83
|
+
return /* @__PURE__ */ jsx2(TableBody, { "aria-busy": "true", "aria-label": "Loading", children: Array.from({ length: rows }, (_, row) => /* @__PURE__ */ jsx2(TableRow, { children: Array.from({ length: cells }, (_2, cell) => /* @__PURE__ */ jsx2(TableCell, { children: /* @__PURE__ */ jsx2(Skeleton, { className: "h-4 w-full" }) }, cell)) }, row)) });
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
TABLE_SKELETON_ROWS,
|
|
87
|
+
Table,
|
|
88
|
+
TableBody,
|
|
89
|
+
TableCell,
|
|
90
|
+
TableHead,
|
|
91
|
+
TableHeader,
|
|
92
|
+
TableRow,
|
|
93
|
+
TableSkeletonRows
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/table/Table.tsx","../../src/table/TableSkeletonRows.tsx"],"sourcesContent":["import type { CSSProperties, HTMLAttributes, ReactNode } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport { Card } from \"../card/Card\";\nimport { cn } from \"../lib/cn\";\nimport { fontSans } from \"../lib/font\";\n\ntype TableContextValue = { columns: string };\n\nconst TableContext = createContext<TableContextValue | null>(null);\n\nfunction useTableContext() {\n const context = useContext(TableContext);\n if (!context) throw new Error(\"Table compound components must be used within Table.\");\n return context;\n}\n\nfunction columnsStyle(columns: string): CSSProperties {\n return { gridTemplateColumns: columns };\n}\n\nexport type TableProps = HTMLAttributes<HTMLDivElement> & {\n columns: string;\n scrollClassName?: string;\n toolbar?: ReactNode;\n footer?: ReactNode;\n children?: ReactNode;\n};\n\nexport function Table(props: TableProps) {\n const { columns, className, scrollClassName, toolbar, footer, children, style, ...restProps } = props;\n\n return (\n <TableContext.Provider value={{ columns }}>\n <Card className={cn(\"flex min-h-0 flex-col overflow-hidden p-5\", className)} style={style} {...restProps}>\n {toolbar ? <div className=\"shrink-0\">{toolbar}</div> : null}\n <div className={cn(\"min-h-0 flex-1 overflow-auto [scrollbar-gutter:stable]\", scrollClassName)}>\n <div className=\"min-w-full\">{children}</div>\n </div>\n {footer ? <div className=\"shrink-0\">{footer}</div> : null}\n </Card>\n </TableContext.Provider>\n );\n}\n\nexport type TableHeaderProps = HTMLAttributes<HTMLDivElement>;\n\nexport function TableHeader(props: TableHeaderProps) {\n const { className, style, ...restProps } = props;\n const { columns } = useTableContext();\n return (\n <div\n className={cn(\n \"sticky top-0 z-10 grid w-full min-w-min border-b border-black/10 bg-[#FDFDFD] text-sm font-medium text-[#aaa] capitalize\",\n fontSans,\n className,\n )}\n style={{ ...columnsStyle(columns), ...style }}\n {...restProps}\n />\n );\n}\n\nexport type TableBodyProps = HTMLAttributes<HTMLDivElement>;\n\nexport function TableBody(props: TableBodyProps) {\n const { className, ...restProps } = props;\n return <div className={cn(\"w-full\", className)} {...restProps} />;\n}\n\nexport type TableRowProps = HTMLAttributes<HTMLDivElement>;\n\nexport function TableRow(props: TableRowProps) {\n const { className, style, ...restProps } = props;\n const { columns } = useTableContext();\n return (\n <div\n className={cn(\n \"grid w-full min-w-min border-b border-black/10 text-sm font-medium text-black last:border-b-0\",\n fontSans,\n className,\n )}\n style={{ ...columnsStyle(columns), ...style }}\n {...restProps}\n />\n );\n}\n\nexport type TableHeadProps = HTMLAttributes<HTMLDivElement>;\n\nexport function TableHead(props: TableHeadProps) {\n const { className, ...restProps } = props;\n return (\n <div className={cn(\"flex min-w-0 items-center px-2 py-3.5 first:pl-0 last:pr-0\", className)} {...restProps} />\n );\n}\n\nexport type TableCellProps = HTMLAttributes<HTMLDivElement>;\n\nexport function TableCell(props: TableCellProps) {\n const { className, ...restProps } = props;\n return (\n <div className={cn(\"flex min-w-0 items-center px-2 py-3.5 first:pl-0 last:pr-0\", className)} {...restProps} />\n );\n}\n\nexport default Table;\n","import { Skeleton } from \"../skeleton/Skeleton\";\nimport { TableBody, TableCell, TableRow } from \"./Table\";\n\nexport const TABLE_SKELETON_ROWS = 3;\n\nexport function TableSkeletonRows({ cells, rows = TABLE_SKELETON_ROWS }: { cells: number; rows?: number }) {\n return (\n <TableBody aria-busy=\"true\" aria-label=\"Loading\">\n {Array.from({ length: rows }, (_, row) => (\n <TableRow key={row}>\n {Array.from({ length: cells }, (_, cell) => (\n <TableCell key={cell}>\n <Skeleton className=\"h-4 w-full\" />\n </TableCell>\n ))}\n </TableRow>\n ))}\n </TableBody>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,SAAS,eAAe,kBAAkB;AAgCpC,SACa,KADb;AAzBN,IAAM,eAAe,cAAwC,IAAI;AAEjE,SAAS,kBAAkB;AACzB,QAAM,UAAU,WAAW,YAAY;AACvC,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,sDAAsD;AACpF,SAAO;AACT;AAEA,SAAS,aAAa,SAAgC;AACpD,SAAO,EAAE,qBAAqB,QAAQ;AACxC;AAUO,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,SAAS,WAAW,iBAAiB,SAAS,QAAQ,UAAU,OAAO,GAAG,UAAU,IAAI;AAEhG,SACE,oBAAC,aAAa,UAAb,EAAsB,OAAO,EAAE,QAAQ,GACtC,+BAAC,QAAK,WAAW,GAAG,6CAA6C,SAAS,GAAG,OAAe,GAAG,WAC5F;AAAA,cAAU,oBAAC,SAAI,WAAU,YAAY,mBAAQ,IAAS;AAAA,IACvD,oBAAC,SAAI,WAAW,GAAG,0DAA0D,eAAe,GAC1F,8BAAC,SAAI,WAAU,cAAc,UAAS,GACxC;AAAA,IACC,SAAS,oBAAC,SAAI,WAAU,YAAY,kBAAO,IAAS;AAAA,KACvD,GACF;AAEJ;AAIO,SAAS,YAAY,OAAyB;AACnD,QAAM,EAAE,WAAW,OAAO,GAAG,UAAU,IAAI;AAC3C,QAAM,EAAE,QAAQ,IAAI,gBAAgB;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAO,EAAE,GAAG,aAAa,OAAO,GAAG,GAAG,MAAM;AAAA,MAC3C,GAAG;AAAA;AAAA,EACN;AAEJ;AAIO,SAAS,UAAU,OAAuB;AAC/C,QAAM,EAAE,WAAW,GAAG,UAAU,IAAI;AACpC,SAAO,oBAAC,SAAI,WAAW,GAAG,UAAU,SAAS,GAAI,GAAG,WAAW;AACjE;AAIO,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,WAAW,OAAO,GAAG,UAAU,IAAI;AAC3C,QAAM,EAAE,QAAQ,IAAI,gBAAgB;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAO,EAAE,GAAG,aAAa,OAAO,GAAG,GAAG,MAAM;AAAA,MAC3C,GAAG;AAAA;AAAA,EACN;AAEJ;AAIO,SAAS,UAAU,OAAuB;AAC/C,QAAM,EAAE,WAAW,GAAG,UAAU,IAAI;AACpC,SACE,oBAAC,SAAI,WAAW,GAAG,8DAA8D,SAAS,GAAI,GAAG,WAAW;AAEhH;AAIO,SAAS,UAAU,OAAuB;AAC/C,QAAM,EAAE,WAAW,GAAG,UAAU,IAAI;AACpC,SACE,oBAAC,SAAI,WAAW,GAAG,8DAA8D,SAAS,GAAI,GAAG,WAAW;AAEhH;;;AC3Fc,gBAAAA,YAAA;AATP,IAAM,sBAAsB;AAE5B,SAAS,kBAAkB,EAAE,OAAO,OAAO,oBAAoB,GAAqC;AACzG,SACE,gBAAAA,KAAC,aAAU,aAAU,QAAO,cAAW,WACpC,gBAAM,KAAK,EAAE,QAAQ,KAAK,GAAG,CAAC,GAAG,QAChC,gBAAAA,KAAC,YACE,gBAAM,KAAK,EAAE,QAAQ,MAAM,GAAG,CAACC,IAAG,SACjC,gBAAAD,KAAC,aACC,0BAAAA,KAAC,YAAS,WAAU,cAAa,KADnB,IAEhB,CACD,KALY,GAMf,CACD,GACH;AAEJ;","names":["jsx","_"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
declare const ToastType: {
|
|
5
|
+
readonly Success: "success";
|
|
6
|
+
readonly Error: "error";
|
|
7
|
+
readonly Info: "info";
|
|
8
|
+
readonly Pending: "pending";
|
|
9
|
+
readonly Notice: "notice";
|
|
10
|
+
};
|
|
11
|
+
type ToastType = (typeof ToastType)[keyof typeof ToastType];
|
|
12
|
+
type ToastProps = {
|
|
13
|
+
type: ToastType;
|
|
14
|
+
title: ReactNode;
|
|
15
|
+
text?: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
closeToast?: () => void;
|
|
18
|
+
};
|
|
19
|
+
declare function Toast(props: ToastProps): react.JSX.Element;
|
|
20
|
+
|
|
21
|
+
export { Toast, type ToastProps, ToastType, ToastType as ToastTypeName };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IconAlert
|
|
3
|
+
} from "../chunk-NZGSPYWG.js";
|
|
4
|
+
import {
|
|
5
|
+
IconCheck
|
|
6
|
+
} from "../chunk-6OV2OZVR.js";
|
|
7
|
+
import {
|
|
8
|
+
IconClose
|
|
9
|
+
} from "../chunk-J5TQGGEN.js";
|
|
10
|
+
import {
|
|
11
|
+
IconLoading
|
|
12
|
+
} from "../chunk-SE7Z4ZYP.js";
|
|
13
|
+
import {
|
|
14
|
+
fontSans
|
|
15
|
+
} from "../chunk-FXENEWNN.js";
|
|
16
|
+
import {
|
|
17
|
+
cn
|
|
18
|
+
} from "../chunk-TUEV2KLC.js";
|
|
19
|
+
|
|
20
|
+
// src/toast/Toast.tsx
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
var ToastType = {
|
|
23
|
+
Success: "success",
|
|
24
|
+
Error: "error",
|
|
25
|
+
Info: "info",
|
|
26
|
+
Pending: "pending",
|
|
27
|
+
Notice: "notice"
|
|
28
|
+
};
|
|
29
|
+
var badgeClassName = {
|
|
30
|
+
[ToastType.Success]: "bg-[#84a20f]",
|
|
31
|
+
[ToastType.Error]: "bg-[#ff5656]",
|
|
32
|
+
[ToastType.Info]: "bg-[#007AFF]",
|
|
33
|
+
[ToastType.Pending]: "bg-[#FF9500]",
|
|
34
|
+
[ToastType.Notice]: "bg-[#606060]"
|
|
35
|
+
};
|
|
36
|
+
function Toast(props) {
|
|
37
|
+
const { type, title, text, className, closeToast } = props;
|
|
38
|
+
return /* @__PURE__ */ jsxs(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: cn(
|
|
42
|
+
"w-[316px] rounded-xl border border-[#e0e0e0] bg-[#fdfdfd] px-3 py-3.5 shadow-[0_0_20px_0_rgba(0,0,0,0.06)] max-md:w-[calc(100vw-32px)]",
|
|
43
|
+
className
|
|
44
|
+
),
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
|
|
47
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 items-start gap-1.5 text-sm font-semibold leading-normal text-black", fontSans), children: [
|
|
48
|
+
/* @__PURE__ */ jsxs(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: cn(
|
|
52
|
+
"flex size-3.5 shrink-0 translate-y-1 items-center justify-center rounded-full text-white",
|
|
53
|
+
badgeClassName[type]
|
|
54
|
+
),
|
|
55
|
+
children: [
|
|
56
|
+
type === ToastType.Success ? /* @__PURE__ */ jsx(IconCheck, { className: "size-1.5 shrink-0" }) : null,
|
|
57
|
+
type === ToastType.Error ? /* @__PURE__ */ jsx(IconClose, { className: "size-1.5 shrink-0" }) : null,
|
|
58
|
+
type === ToastType.Info || type === ToastType.Notice ? /* @__PURE__ */ jsx(IconAlert, { className: "size-1.5 shrink-0" }) : null,
|
|
59
|
+
type === ToastType.Pending ? /* @__PURE__ */ jsx(IconLoading, { className: "size-2 shrink-0 animate-spin" }) : null
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsx("div", { children: title })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
"button",
|
|
67
|
+
{
|
|
68
|
+
type: "button",
|
|
69
|
+
className: "mt-0 shrink-0 cursor-pointer border-0 bg-transparent p-0 text-black",
|
|
70
|
+
onClick: closeToast,
|
|
71
|
+
"aria-label": "Close",
|
|
72
|
+
children: /* @__PURE__ */ jsx(IconClose, { className: "size-2" })
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] }),
|
|
76
|
+
text ? /* @__PURE__ */ jsx("div", { className: cn("mt-2.5 flex items-center gap-1 text-xs font-medium leading-normal text-[#606060]", fontSans), children: /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: text }) }) : null
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
Toast,
|
|
83
|
+
ToastType
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/toast/Toast.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { IconAlert } from \"../icons/alert\";\nimport { IconCheck } from \"../icons/check\";\nimport { IconClose } from \"../icons/close\";\nimport { IconLoading } from \"../icons/loading\";\nimport { cn } from \"../lib/cn\";\nimport { fontSans } from \"../lib/font\";\n\nexport const ToastType = {\n Success: \"success\",\n Error: \"error\",\n Info: \"info\",\n Pending: \"pending\",\n Notice: \"notice\",\n} as const;\nexport type ToastType = (typeof ToastType)[keyof typeof ToastType];\n\nexport type ToastProps = {\n type: ToastType;\n title: ReactNode;\n text?: ReactNode;\n className?: string;\n closeToast?: () => void;\n};\n\nconst badgeClassName: Record<ToastType, string> = {\n [ToastType.Success]: \"bg-[#84a20f]\",\n [ToastType.Error]: \"bg-[#ff5656]\",\n [ToastType.Info]: \"bg-[#007AFF]\",\n [ToastType.Pending]: \"bg-[#FF9500]\",\n [ToastType.Notice]: \"bg-[#606060]\",\n};\n\nexport function Toast(props: ToastProps) {\n const { type, title, text, className, closeToast } = props;\n\n return (\n <div\n className={cn(\n \"w-[316px] rounded-xl border border-[#e0e0e0] bg-[#fdfdfd] px-3 py-3.5 shadow-[0_0_20px_0_rgba(0,0,0,0.06)] max-md:w-[calc(100vw-32px)]\",\n className,\n )}\n >\n <div className=\"flex items-start justify-between gap-2\">\n <div className={cn(\"flex min-w-0 items-start gap-1.5 text-sm font-semibold leading-normal text-black\", fontSans)}>\n <div\n className={cn(\n \"flex size-3.5 shrink-0 translate-y-1 items-center justify-center rounded-full text-white\",\n badgeClassName[type],\n )}\n >\n {type === ToastType.Success ? <IconCheck className=\"size-1.5 shrink-0\" /> : null}\n {type === ToastType.Error ? <IconClose className=\"size-1.5 shrink-0\" /> : null}\n {type === ToastType.Info || type === ToastType.Notice ? <IconAlert className=\"size-1.5 shrink-0\" /> : null}\n {type === ToastType.Pending ? <IconLoading className=\"size-2 shrink-0 animate-spin\" /> : null}\n </div>\n <div>{title}</div>\n </div>\n <button\n type=\"button\"\n className=\"mt-0 shrink-0 cursor-pointer border-0 bg-transparent p-0 text-black\"\n onClick={closeToast}\n aria-label=\"Close\"\n >\n <IconClose className=\"size-2\" />\n </button>\n </div>\n {text ? (\n <div className={cn(\"mt-2.5 flex items-center gap-1 text-xs font-medium leading-normal text-[#606060]\", fontSans)}>\n <div className=\"min-w-0 flex-1\">{text}</div>\n </div>\n ) : null}\n </div>\n );\n}\n\nexport default Toast;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6CU,SAMgC,KANhC;AArCH,IAAM,YAAY;AAAA,EACvB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AACV;AAWA,IAAM,iBAA4C;AAAA,EAChD,CAAC,UAAU,OAAO,GAAG;AAAA,EACrB,CAAC,UAAU,KAAK,GAAG;AAAA,EACnB,CAAC,UAAU,IAAI,GAAG;AAAA,EAClB,CAAC,UAAU,OAAO,GAAG;AAAA,EACrB,CAAC,UAAU,MAAM,GAAG;AACtB;AAEO,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,MAAM,OAAO,MAAM,WAAW,WAAW,IAAI;AAErD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MAEA;AAAA,6BAAC,SAAI,WAAU,0CACb;AAAA,+BAAC,SAAI,WAAW,GAAG,oFAAoF,QAAQ,GAC7G;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW;AAAA,kBACT;AAAA,kBACA,eAAe,IAAI;AAAA,gBACrB;AAAA,gBAEC;AAAA,2BAAS,UAAU,UAAU,oBAAC,aAAU,WAAU,qBAAoB,IAAK;AAAA,kBAC3E,SAAS,UAAU,QAAQ,oBAAC,aAAU,WAAU,qBAAoB,IAAK;AAAA,kBACzE,SAAS,UAAU,QAAQ,SAAS,UAAU,SAAS,oBAAC,aAAU,WAAU,qBAAoB,IAAK;AAAA,kBACrG,SAAS,UAAU,UAAU,oBAAC,eAAY,WAAU,gCAA+B,IAAK;AAAA;AAAA;AAAA,YAC3F;AAAA,YACA,oBAAC,SAAK,iBAAM;AAAA,aACd;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,WAAU;AAAA,cACV,SAAS;AAAA,cACT,cAAW;AAAA,cAEX,8BAAC,aAAU,WAAU,UAAS;AAAA;AAAA,UAChC;AAAA,WACF;AAAA,QACC,OACC,oBAAC,SAAI,WAAW,GAAG,oFAAoF,QAAQ,GAC7G,8BAAC,SAAI,WAAU,kBAAkB,gBAAK,GACxC,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { c as FloatingSide } from '../use-floating-position-aNqQwkre.js';
|
|
4
|
+
|
|
5
|
+
type TooltipProps = {
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
leaveDelay?: number;
|
|
9
|
+
side?: FloatingSide;
|
|
10
|
+
className?: string;
|
|
11
|
+
triggerClassName?: string;
|
|
12
|
+
};
|
|
13
|
+
declare function Tooltip(props: TooltipProps): react.JSX.Element;
|
|
14
|
+
|
|
15
|
+
declare const TOOLTIP_LEAVE_DELAY_MS = 0;
|
|
16
|
+
|
|
17
|
+
export { TOOLTIP_LEAVE_DELAY_MS, Tooltip, type TooltipProps };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FLOATING_ALIGN,
|
|
3
|
+
FLOATING_SIDE,
|
|
4
|
+
useFloatingPosition
|
|
5
|
+
} from "../chunk-VAPGLPZ5.js";
|
|
6
|
+
import {
|
|
7
|
+
floatingLayerZIndex
|
|
8
|
+
} from "../chunk-RUOUGZWI.js";
|
|
9
|
+
import {
|
|
10
|
+
fontSans
|
|
11
|
+
} from "../chunk-FXENEWNN.js";
|
|
12
|
+
import {
|
|
13
|
+
cn
|
|
14
|
+
} from "../chunk-TUEV2KLC.js";
|
|
15
|
+
|
|
16
|
+
// src/tooltip/Tooltip.tsx
|
|
17
|
+
import { useEffect, useRef, useState } from "react";
|
|
18
|
+
import { createPortal } from "react-dom";
|
|
19
|
+
|
|
20
|
+
// src/tooltip/config.ts
|
|
21
|
+
var TOOLTIP_LEAVE_DELAY_MS = 0;
|
|
22
|
+
|
|
23
|
+
// src/tooltip/Tooltip.tsx
|
|
24
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
25
|
+
function Tooltip(props) {
|
|
26
|
+
const {
|
|
27
|
+
content,
|
|
28
|
+
children,
|
|
29
|
+
leaveDelay = TOOLTIP_LEAVE_DELAY_MS,
|
|
30
|
+
side = FLOATING_SIDE.Top,
|
|
31
|
+
className,
|
|
32
|
+
triggerClassName
|
|
33
|
+
} = props;
|
|
34
|
+
const triggerRef = useRef(null);
|
|
35
|
+
const panelRef = useRef(null);
|
|
36
|
+
const leaveTimerRef = useRef(null);
|
|
37
|
+
const [open, setOpen] = useState(false);
|
|
38
|
+
const panelStyle = useFloatingPosition({
|
|
39
|
+
open,
|
|
40
|
+
triggerRef,
|
|
41
|
+
panelRef,
|
|
42
|
+
side,
|
|
43
|
+
align: FLOATING_ALIGN.Center,
|
|
44
|
+
offset: 8
|
|
45
|
+
});
|
|
46
|
+
const clearLeaveTimer = () => {
|
|
47
|
+
if (leaveTimerRef.current == null) return;
|
|
48
|
+
window.clearTimeout(leaveTimerRef.current);
|
|
49
|
+
leaveTimerRef.current = null;
|
|
50
|
+
};
|
|
51
|
+
const show = () => {
|
|
52
|
+
clearLeaveTimer();
|
|
53
|
+
setOpen(true);
|
|
54
|
+
};
|
|
55
|
+
const hide = () => {
|
|
56
|
+
clearLeaveTimer();
|
|
57
|
+
if (leaveDelay <= 0) {
|
|
58
|
+
setOpen(false);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
leaveTimerRef.current = window.setTimeout(() => {
|
|
62
|
+
setOpen(false);
|
|
63
|
+
leaveTimerRef.current = null;
|
|
64
|
+
}, leaveDelay);
|
|
65
|
+
};
|
|
66
|
+
useEffect(() => () => clearLeaveTimer(), []);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!open) return;
|
|
69
|
+
const onScroll = () => {
|
|
70
|
+
clearLeaveTimer();
|
|
71
|
+
setOpen(false);
|
|
72
|
+
};
|
|
73
|
+
window.addEventListener("scroll", onScroll, true);
|
|
74
|
+
return () => window.removeEventListener("scroll", onScroll, true);
|
|
75
|
+
}, [open]);
|
|
76
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
77
|
+
/* @__PURE__ */ jsx("span", { ref: triggerRef, className: cn("inline-flex max-w-full", triggerClassName), onMouseEnter: show, onMouseLeave: hide, children }),
|
|
78
|
+
open && content && typeof document !== "undefined" ? createPortal(
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
ref: panelRef,
|
|
83
|
+
role: "tooltip",
|
|
84
|
+
style: { ...panelStyle, zIndex: floatingLayerZIndex() },
|
|
85
|
+
className: cn(
|
|
86
|
+
"rounded-[12px] border border-[#E0E0E0] bg-[#FDFDFD] px-[15px] py-2.5 text-sm font-normal leading-normal text-black shadow-[0_0_20px_0_rgba(0,0,0,0.06)]",
|
|
87
|
+
fontSans,
|
|
88
|
+
leaveDelay <= 0 && "pointer-events-none",
|
|
89
|
+
className
|
|
90
|
+
),
|
|
91
|
+
onMouseEnter: leaveDelay > 0 ? show : void 0,
|
|
92
|
+
onMouseLeave: leaveDelay > 0 ? hide : void 0,
|
|
93
|
+
children: content
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
document.body
|
|
97
|
+
) : null
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
TOOLTIP_LEAVE_DELAY_MS,
|
|
102
|
+
Tooltip
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tooltip/Tooltip.tsx","../../src/tooltip/config.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../lib/cn\";\nimport { fontSans } from \"../lib/font\";\nimport { floatingLayerZIndex } from \"../overlay/stack\";\nimport { FLOATING_ALIGN, FLOATING_SIDE, type FloatingSide, useFloatingPosition } from \"../overlay/use-floating-position\";\nimport { TOOLTIP_LEAVE_DELAY_MS } from \"./config\";\n\nexport type TooltipProps = {\n content: ReactNode;\n children: ReactNode;\n leaveDelay?: number;\n side?: FloatingSide;\n className?: string;\n triggerClassName?: string;\n};\n\nexport function Tooltip(props: TooltipProps) {\n const {\n content,\n children,\n leaveDelay = TOOLTIP_LEAVE_DELAY_MS,\n side = FLOATING_SIDE.Top,\n className,\n triggerClassName,\n } = props;\n const triggerRef = useRef<HTMLSpanElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const leaveTimerRef = useRef<number | null>(null);\n const [open, setOpen] = useState(false);\n const panelStyle = useFloatingPosition({\n open,\n triggerRef,\n panelRef,\n side,\n align: FLOATING_ALIGN.Center,\n offset: 8,\n });\n\n const clearLeaveTimer = () => {\n if (leaveTimerRef.current == null) return;\n window.clearTimeout(leaveTimerRef.current);\n leaveTimerRef.current = null;\n };\n\n const show = () => {\n clearLeaveTimer();\n setOpen(true);\n };\n\n const hide = () => {\n clearLeaveTimer();\n if (leaveDelay <= 0) {\n setOpen(false);\n return;\n }\n leaveTimerRef.current = window.setTimeout(() => {\n setOpen(false);\n leaveTimerRef.current = null;\n }, leaveDelay);\n };\n\n useEffect(() => () => clearLeaveTimer(), []);\n\n useEffect(() => {\n if (!open) return;\n const onScroll = () => {\n clearLeaveTimer();\n setOpen(false);\n };\n window.addEventListener(\"scroll\", onScroll, true);\n return () => window.removeEventListener(\"scroll\", onScroll, true);\n }, [open]);\n\n return (\n <>\n <span ref={triggerRef} className={cn(\"inline-flex max-w-full\", triggerClassName)} onMouseEnter={show} onMouseLeave={hide}>\n {children}\n </span>\n {open && content && typeof document !== \"undefined\"\n ? createPortal(\n <div\n ref={panelRef}\n role=\"tooltip\"\n style={{ ...panelStyle, zIndex: floatingLayerZIndex() }}\n className={cn(\n \"rounded-[12px] border border-[#E0E0E0] bg-[#FDFDFD] px-[15px] py-2.5 text-sm font-normal leading-normal text-black shadow-[0_0_20px_0_rgba(0,0,0,0.06)]\",\n fontSans,\n leaveDelay <= 0 && \"pointer-events-none\",\n className,\n )}\n onMouseEnter={leaveDelay > 0 ? show : undefined}\n onMouseLeave={leaveDelay > 0 ? hide : undefined}\n >\n {content}\n </div>,\n document.body,\n )\n : null}\n </>\n );\n}\n\nexport default Tooltip;\n","export const TOOLTIP_LEAVE_DELAY_MS = 0;\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,oBAAoB;;;ACFtB,IAAM,yBAAyB;;;AD4ElC,mBACE,KADF;AA1DG,SAAS,QAAQ,OAAqB;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,OAAO,cAAc;AAAA,IACrB;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,aAAa,OAAwB,IAAI;AAC/C,QAAM,WAAW,OAAuB,IAAI;AAC5C,QAAM,gBAAgB,OAAsB,IAAI;AAChD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,aAAa,oBAAoB;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,eAAe;AAAA,IACtB,QAAQ;AAAA,EACV,CAAC;AAED,QAAM,kBAAkB,MAAM;AAC5B,QAAI,cAAc,WAAW,KAAM;AACnC,WAAO,aAAa,cAAc,OAAO;AACzC,kBAAc,UAAU;AAAA,EAC1B;AAEA,QAAM,OAAO,MAAM;AACjB,oBAAgB;AAChB,YAAQ,IAAI;AAAA,EACd;AAEA,QAAM,OAAO,MAAM;AACjB,oBAAgB;AAChB,QAAI,cAAc,GAAG;AACnB,cAAQ,KAAK;AACb;AAAA,IACF;AACA,kBAAc,UAAU,OAAO,WAAW,MAAM;AAC9C,cAAQ,KAAK;AACb,oBAAc,UAAU;AAAA,IAC1B,GAAG,UAAU;AAAA,EACf;AAEA,YAAU,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3C,YAAU,MAAM;AACd,QAAI,CAAC,KAAM;AACX,UAAM,WAAW,MAAM;AACrB,sBAAgB;AAChB,cAAQ,KAAK;AAAA,IACf;AACA,WAAO,iBAAiB,UAAU,UAAU,IAAI;AAChD,WAAO,MAAM,OAAO,oBAAoB,UAAU,UAAU,IAAI;AAAA,EAClE,GAAG,CAAC,IAAI,CAAC;AAET,SACE,iCACE;AAAA,wBAAC,UAAK,KAAK,YAAY,WAAW,GAAG,0BAA0B,gBAAgB,GAAG,cAAc,MAAM,cAAc,MACjH,UACH;AAAA,IACC,QAAQ,WAAW,OAAO,aAAa,cACpC;AAAA,MACE;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,MAAK;AAAA,UACL,OAAO,EAAE,GAAG,YAAY,QAAQ,oBAAoB,EAAE;AAAA,UACtD,WAAW;AAAA,YACT;AAAA,YACA;AAAA,YACA,cAAc,KAAK;AAAA,YACnB;AAAA,UACF;AAAA,UACA,cAAc,aAAa,IAAI,OAAO;AAAA,UACtC,cAAc,aAAa,IAAI,OAAO;AAAA,UAErC;AAAA;AAAA,MACH;AAAA,MACA,SAAS;AAAA,IACX,IACA;AAAA,KACN;AAEJ;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type OverlayChromeProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
mask?: boolean;
|
|
10
|
+
maskClassName?: string;
|
|
11
|
+
closeOnMaskClick?: boolean;
|
|
12
|
+
cardClassName?: string;
|
|
13
|
+
panelClassName?: string;
|
|
14
|
+
titleClassName?: string;
|
|
15
|
+
closeClassName?: string;
|
|
16
|
+
contentClassName?: string;
|
|
17
|
+
closeIcon?: ReactNode;
|
|
18
|
+
headerAction?: ReactNode;
|
|
19
|
+
/** Sit in the wallet-portal z-index band, above ordinary dialog and drawer layers. */
|
|
20
|
+
elevated?: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type { OverlayChromeProps as O };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RefObject, CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
declare const FLOATING_SIDE: {
|
|
4
|
+
readonly Top: "top";
|
|
5
|
+
readonly TopLeft: "top-left";
|
|
6
|
+
readonly TopRight: "top-right";
|
|
7
|
+
readonly Right: "right";
|
|
8
|
+
readonly RightTop: "right-top";
|
|
9
|
+
readonly RightBottom: "right-bottom";
|
|
10
|
+
readonly Bottom: "bottom";
|
|
11
|
+
readonly BottomLeft: "bottom-left";
|
|
12
|
+
readonly BottomRight: "bottom-right";
|
|
13
|
+
readonly Left: "left";
|
|
14
|
+
readonly LeftTop: "left-top";
|
|
15
|
+
readonly LeftBottom: "left-bottom";
|
|
16
|
+
};
|
|
17
|
+
type FloatingSide = (typeof FLOATING_SIDE)[keyof typeof FLOATING_SIDE];
|
|
18
|
+
declare const FLOATING_ALIGN: {
|
|
19
|
+
readonly Start: "start";
|
|
20
|
+
readonly Center: "center";
|
|
21
|
+
readonly End: "end";
|
|
22
|
+
};
|
|
23
|
+
type FloatingAlign = (typeof FLOATING_ALIGN)[keyof typeof FLOATING_ALIGN];
|
|
24
|
+
declare function useFloatingPosition(options: {
|
|
25
|
+
open: boolean;
|
|
26
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
27
|
+
panelRef: RefObject<HTMLElement | null>;
|
|
28
|
+
side?: FloatingSide;
|
|
29
|
+
align?: FloatingAlign;
|
|
30
|
+
offset?: number;
|
|
31
|
+
}): CSSProperties;
|
|
32
|
+
|
|
33
|
+
export { FLOATING_ALIGN as F, FLOATING_SIDE as a, type FloatingAlign as b, type FloatingSide as c, useFloatingPosition as u };
|
package/package.json
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stableflow/pay-ui",
|
|
3
|
+
"version": "0.0.1-beta-82ede460a5-20260923",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./autocomplete": {
|
|
14
|
+
"types": "./dist/autocomplete/index.d.ts",
|
|
15
|
+
"import": "./dist/autocomplete/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./button": {
|
|
18
|
+
"types": "./dist/button/index.d.ts",
|
|
19
|
+
"import": "./dist/button/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./card": {
|
|
22
|
+
"types": "./dist/card/index.d.ts",
|
|
23
|
+
"import": "./dist/card/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./checkbox": {
|
|
26
|
+
"types": "./dist/checkbox/index.d.ts",
|
|
27
|
+
"import": "./dist/checkbox/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./date-range-picker": {
|
|
30
|
+
"types": "./dist/date-range-picker/index.d.ts",
|
|
31
|
+
"import": "./dist/date-range-picker/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./dialog": {
|
|
34
|
+
"types": "./dist/dialog/index.d.ts",
|
|
35
|
+
"import": "./dist/dialog/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./drawer": {
|
|
38
|
+
"types": "./dist/drawer/index.d.ts",
|
|
39
|
+
"import": "./dist/drawer/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./dropdown": {
|
|
42
|
+
"types": "./dist/dropdown/index.d.ts",
|
|
43
|
+
"import": "./dist/dropdown/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./input-number": {
|
|
46
|
+
"types": "./dist/input-number/index.d.ts",
|
|
47
|
+
"import": "./dist/input-number/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./overlay": {
|
|
50
|
+
"types": "./dist/overlay/index.d.ts",
|
|
51
|
+
"import": "./dist/overlay/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./pagination": {
|
|
54
|
+
"types": "./dist/pagination/index.d.ts",
|
|
55
|
+
"import": "./dist/pagination/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./search-input": {
|
|
58
|
+
"types": "./dist/search-input/index.d.ts",
|
|
59
|
+
"import": "./dist/search-input/index.js"
|
|
60
|
+
},
|
|
61
|
+
"./skeleton": {
|
|
62
|
+
"types": "./dist/skeleton/index.d.ts",
|
|
63
|
+
"import": "./dist/skeleton/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./switch": {
|
|
66
|
+
"types": "./dist/switch/index.d.ts",
|
|
67
|
+
"import": "./dist/switch/index.js"
|
|
68
|
+
},
|
|
69
|
+
"./table": {
|
|
70
|
+
"types": "./dist/table/index.d.ts",
|
|
71
|
+
"import": "./dist/table/index.js"
|
|
72
|
+
},
|
|
73
|
+
"./toast": {
|
|
74
|
+
"types": "./dist/toast/index.d.ts",
|
|
75
|
+
"import": "./dist/toast/index.js"
|
|
76
|
+
},
|
|
77
|
+
"./tooltip": {
|
|
78
|
+
"types": "./dist/tooltip/index.d.ts",
|
|
79
|
+
"import": "./dist/tooltip/index.js"
|
|
80
|
+
},
|
|
81
|
+
"./icons/*": {
|
|
82
|
+
"types": "./dist/icons/*.d.ts",
|
|
83
|
+
"import": "./dist/icons/*.js"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"react": "^19.0.0",
|
|
88
|
+
"react-dom": "^19.0.0"
|
|
89
|
+
},
|
|
90
|
+
"dependencies": {
|
|
91
|
+
"class-variance-authority": "^0.7.1",
|
|
92
|
+
"clsx": "^2.1.1",
|
|
93
|
+
"date-fns": "^4.4.0",
|
|
94
|
+
"motion": "^13.0.0",
|
|
95
|
+
"tailwind-merge": "^3.6.0"
|
|
96
|
+
},
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"@types/node": "^26.6.2",
|
|
99
|
+
"@types/react": "^19.1.9",
|
|
100
|
+
"@types/react-dom": "^19.1.7",
|
|
101
|
+
"react": "^19.1.1",
|
|
102
|
+
"react-dom": "^19.1.1",
|
|
103
|
+
"tsup": "^8.5.0",
|
|
104
|
+
"typescript": "^5.9.2",
|
|
105
|
+
"vitest": "^4.1.10"
|
|
106
|
+
},
|
|
107
|
+
"scripts": {
|
|
108
|
+
"build": "tsup",
|
|
109
|
+
"test": "vitest run"
|
|
110
|
+
}
|
|
111
|
+
}
|