pixelize-design-library 2.3.1-beta.9 → 2.3.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/.cursor/TASK-SETUP.md +43 -0
- package/.cursor/agents/be-impl.md +37 -0
- package/.cursor/agents/fe-impl.md +39 -0
- package/.cursor/agents/task-plan.md +56 -0
- package/.cursor/agents/test-create.md +31 -0
- package/.cursor/agents/test-exec.md +26 -0
- package/.cursor/hooks/task-hint.env +1 -0
- package/.cursor/hooks/task-skill-nudge.sh +71 -0
- package/.cursor/hooks/task-slash-guard.sh +31 -0
- package/.cursor/hooks.json +13 -0
- package/.cursor/modules/account-management/MODULE.md +16 -0
- package/.cursor/modules/buttons/MODULE.md +13 -0
- package/.cursor/modules/cards/MODULE.md +13 -0
- package/.cursor/modules/charts/MODULE.md +13 -0
- package/.cursor/modules/common/MODULE.md +13 -0
- package/.cursor/modules/contact-auth/MODULE.md +13 -0
- package/.cursor/modules/data-display/MODULE.md +18 -0
- package/.cursor/modules/feedback/MODULE.md +14 -0
- package/.cursor/modules/form/MODULE.md +13 -0
- package/.cursor/modules/inputs-basic/MODULE.md +13 -0
- package/.cursor/modules/inputs-date-file/MODULE.md +19 -0
- package/.cursor/modules/inputs-select/MODULE.md +14 -0
- package/.cursor/modules/inputs-toggle/MODULE.md +13 -0
- package/.cursor/modules/kanban/MODULE.md +14 -0
- package/.cursor/modules/layout-navigation/MODULE.md +14 -0
- package/.cursor/modules/overlays/MODULE.md +13 -0
- package/.cursor/modules/playground/MODULE.md +15 -0
- package/.cursor/modules/table/MODULE.md +15 -0
- package/.cursor/modules/theme/MODULE.md +15 -0
- package/.cursor/modules/types-exports/MODULE.md +17 -0
- package/.cursor/modules/utility-ui/MODULE.md +15 -0
- package/.cursor/modules/utils-hooks/MODULE.md +13 -0
- package/.cursor/pixelize-task-statusline.sh +64 -0
- package/.cursor/plans/blocked/.gitkeep +0 -0
- package/.cursor/plans/current.md +35 -0
- package/.cursor/plans/done/.gitkeep +0 -0
- package/.cursor/rules +31 -0
- package/.cursor/skills/task/SKILL.md +167 -0
- package/CLAUDE.md +122 -0
- package/dist/Components/Card/PaymentCard/PaymentCard.d.ts +1 -1
- package/dist/Components/Card/PaymentCard/PaymentCard.js +3 -3
- package/dist/Components/Card/PaymentCard/PaymentCardProps.d.ts +1 -0
- package/dist/Components/CopyButton/CopyButton.d.ts +22 -0
- package/dist/Components/CopyButton/CopyButton.js +126 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.d.ts +4 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.js +182 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.test.d.ts +1 -0
- package/dist/Components/CustomModulesTable/CustomModulesTable.test.js +84 -0
- package/dist/Components/CustomModulesTable/CustomModulesTableProps.d.ts +54 -0
- package/dist/Components/CustomModulesTable/CustomModulesTableProps.js +2 -0
- package/dist/Components/CustomModulesTable/DeleteModuleModal.d.ts +4 -0
- package/dist/Components/CustomModulesTable/DeleteModuleModal.js +33 -0
- package/dist/Components/CustomModulesTable/EditModuleModal.d.ts +4 -0
- package/dist/Components/CustomModulesTable/EditModuleModal.js +63 -0
- package/dist/Components/Dropdown/DropDown.js +110 -28
- package/dist/Components/Dropdown/Dropdown.test.d.ts +1 -0
- package/dist/Components/Dropdown/Dropdown.test.js +102 -0
- package/dist/Components/Dropdown/DropdownProps.d.ts +4 -1
- package/dist/Components/EmptyState/EmptyState.d.ts +4 -0
- package/dist/Components/EmptyState/EmptyState.js +65 -0
- package/dist/Components/EmptyState/EmptyStateProps.d.ts +28 -0
- package/dist/Components/EmptyState/EmptyStateProps.js +2 -0
- package/dist/Components/FieldSelectModal/FieldSelectModal.d.ts +26 -0
- package/dist/Components/FieldSelectModal/FieldSelectModal.js +107 -0
- package/dist/Components/FilePreview/FilePreview.d.ts +6 -0
- package/dist/Components/FilePreview/FilePreview.js +190 -0
- package/dist/Components/FilePreview/FilePreviewProps.d.ts +26 -0
- package/dist/Components/FilePreview/FilePreviewProps.js +2 -0
- package/dist/Components/LazyWrapper/LazyWrapper.d.ts +10 -0
- package/dist/Components/LazyWrapper/LazyWrapper.js +50 -0
- package/dist/Components/MoreItems/MoreItems.d.ts +4 -0
- package/dist/Components/MoreItems/MoreItems.js +35 -0
- package/dist/Components/MoreItems/MoreItemsProps.d.ts +29 -0
- package/dist/Components/MoreItems/MoreItemsProps.js +2 -0
- package/dist/Components/OrgSwitcher/OrgSwitcher.d.ts +4 -0
- package/dist/Components/OrgSwitcher/OrgSwitcher.js +121 -0
- package/dist/Components/OrgSwitcher/OrgSwitcherProps.d.ts +41 -0
- package/dist/Components/OrgSwitcher/OrgSwitcherProps.js +25 -0
- package/dist/Components/OrganizationDetails/CreateOrgModal.d.ts +4 -0
- package/dist/Components/OrganizationDetails/CreateOrgModal.js +122 -0
- package/dist/Components/OrganizationDetails/DeleteOrgModal.d.ts +4 -0
- package/dist/Components/OrganizationDetails/DeleteOrgModal.js +29 -0
- package/dist/Components/OrganizationDetails/OrganizationDetails.d.ts +4 -0
- package/dist/Components/OrganizationDetails/OrganizationDetails.js +264 -0
- package/dist/Components/OrganizationDetails/OrganizationDetails.test.d.ts +1 -0
- package/dist/Components/OrganizationDetails/OrganizationDetails.test.js +122 -0
- package/dist/Components/OrganizationDetails/OrganizationDetailsProps.d.ts +88 -0
- package/dist/Components/OrganizationDetails/OrganizationDetailsProps.js +2 -0
- package/dist/Components/PdfViewer/PdfViewer.d.ts +15 -0
- package/dist/Components/PdfViewer/PdfViewer.js +29 -0
- package/dist/Components/RolesPermission/DeleteRoleModal.d.ts +4 -0
- package/dist/Components/RolesPermission/DeleteRoleModal.js +29 -0
- package/dist/Components/RolesPermission/RolesPermission.d.ts +4 -0
- package/dist/Components/RolesPermission/RolesPermission.js +243 -0
- package/dist/Components/RolesPermission/RolesPermission.test.d.ts +1 -0
- package/dist/Components/RolesPermission/RolesPermission.test.js +150 -0
- package/dist/Components/RolesPermission/RolesPermissionProps.d.ts +117 -0
- package/dist/Components/RolesPermission/RolesPermissionProps.js +2 -0
- package/dist/Components/ScrollToTop/ScrollToTop.d.ts +19 -0
- package/dist/Components/ScrollToTop/ScrollToTop.js +104 -0
- package/dist/Components/SideBar/components/OtherApps.test.js +3 -2
- package/dist/Components/SignInActivityTable/SignInActivityTable.d.ts +4 -0
- package/dist/Components/SignInActivityTable/SignInActivityTable.js +95 -0
- package/dist/Components/SignInActivityTable/SignInActivityTable.test.d.ts +1 -0
- package/dist/Components/SignInActivityTable/SignInActivityTable.test.js +63 -0
- package/dist/Components/SignInActivityTable/SignInActivityTableProps.d.ts +21 -0
- package/dist/Components/SignInActivityTable/SignInActivityTableProps.js +2 -0
- package/dist/Components/StageProgress/StageItem.d.ts +4 -0
- package/dist/Components/StageProgress/StageItem.js +137 -0
- package/dist/Components/StageProgress/StageProgress.d.ts +4 -0
- package/dist/Components/StageProgress/StageProgress.js +59 -0
- package/dist/Components/StageProgress/StageProgressProps.d.ts +85 -0
- package/dist/Components/StageProgress/StageProgressProps.js +27 -0
- package/dist/Components/StageProgress/StepperStage.d.ts +4 -0
- package/dist/Components/StageProgress/StepperStage.js +78 -0
- package/dist/Components/Table/Table.js +66 -45
- package/dist/Components/Table/TableProps.d.ts +4 -2
- package/dist/Components/Table/components/Pagination.js +1 -1
- package/dist/Components/Table/components/TableBody.js +15 -12
- package/dist/Components/Table/components/TableBody.virtualize.test.js +13 -3
- package/dist/Components/Table/components/TableHeader.d.ts +1 -1
- package/dist/Components/Table/components/TableHeader.js +9 -9
- package/dist/Components/Table/hooks/useTable.d.ts +1 -0
- package/dist/Components/Table/hooks/useTable.js +21 -8
- package/dist/Components/Table/settings/ManageColumns.test.js +1 -0
- package/dist/Components/Tag/Tag.d.ts +3 -11
- package/dist/Components/Tag/Tag.js +10 -2
- package/dist/Components/Tag/Tag.styles.d.ts +2 -2
- package/dist/Components/Tag/Tag.styles.js +58 -33
- package/dist/Components/Tag/Tag.test.d.ts +1 -0
- package/dist/Components/Tag/Tag.test.js +68 -0
- package/dist/Components/Tag/TagProps.d.ts +13 -0
- package/dist/Components/Tag/TagProps.js +2 -0
- package/dist/Components/UpgradeButton/UpgradeButton.d.ts +4 -0
- package/dist/Components/UpgradeButton/UpgradeButton.js +73 -0
- package/dist/Components/UpgradeButton/UpgradeButtonProps.d.ts +43 -0
- package/dist/Components/UpgradeButton/UpgradeButtonProps.js +2 -0
- package/dist/Components/UserDetails/AddUserModal.d.ts +4 -0
- package/dist/Components/UserDetails/AddUserModal.js +218 -0
- package/dist/Components/UserDetails/ChangeRoleModal.d.ts +4 -0
- package/dist/Components/UserDetails/ChangeRoleModal.js +150 -0
- package/dist/Components/UserDetails/DeactivateConfirmModal.d.ts +4 -0
- package/dist/Components/UserDetails/DeactivateConfirmModal.js +34 -0
- package/dist/Components/UserDetails/UserDetails.d.ts +4 -0
- package/dist/Components/UserDetails/UserDetails.js +263 -0
- package/dist/Components/UserDetails/UserDetails.test.d.ts +1 -0
- package/dist/Components/UserDetails/UserDetails.test.js +129 -0
- package/dist/Components/UserDetails/UserDetailsProps.d.ts +151 -0
- package/dist/Components/UserDetails/UserDetailsProps.js +2 -0
- package/dist/Theme/componentStyles.d.ts +1 -1
- package/dist/Theme/index.d.ts +4 -4
- package/dist/Theme/index.js +4 -4
- package/dist/index.d.ts +23 -1
- package/dist/index.js +37 -2
- package/package.json +2 -2
- package/.claude/settings.local.json +0 -44
- package/coverage/clover.xml +0 -638
- package/coverage/coverage-final.json +0 -20
- package/coverage/lcov-report/Table/CompactSelect.tsx.html +0 -379
- package/coverage/lcov-report/Table/Components/ActiveFilters.tsx.html +0 -514
- package/coverage/lcov-report/Table/Components/HeaderActions.tsx.html +0 -373
- package/coverage/lcov-report/Table/Components/Pagination.tsx.html +0 -574
- package/coverage/lcov-report/Table/Components/TableActions.tsx.html +0 -574
- package/coverage/lcov-report/Table/Components/TableBody.tsx.html +0 -1027
- package/coverage/lcov-report/Table/Components/TableFilters.tsx.html +0 -397
- package/coverage/lcov-report/Table/Components/TableHeader.tsx.html +0 -1060
- package/coverage/lcov-report/Table/Components/TableLoading.tsx.html +0 -361
- package/coverage/lcov-report/Table/Components/TableSearch.tsx.html +0 -337
- package/coverage/lcov-report/Table/Components/index.html +0 -266
- package/coverage/lcov-report/Table/Components/useDebounce.ts.html +0 -178
- package/coverage/lcov-report/Table/Components/useTable.ts.html +0 -778
- package/coverage/lcov-report/Table/LeftFilterPane.tsx.html +0 -1810
- package/coverage/lcov-report/Table/SelectOperationControls.tsx.html +0 -178
- package/coverage/lcov-report/Table/Table.tsx.html +0 -1567
- package/coverage/lcov-report/Table/TableProps.tsx.html +0 -658
- package/coverage/lcov-report/Table/TableSettings/ManageColumns.tsx.html +0 -619
- package/coverage/lcov-report/Table/TableSettings/TableFilters.tsx.html +0 -229
- package/coverage/lcov-report/Table/TableSettings/TableSettings.tsx.html +0 -532
- package/coverage/lcov-report/Table/TableSettings/index.html +0 -146
- package/coverage/lcov-report/Table/TableToDo.tsx.html +0 -973
- package/coverage/lcov-report/Table/TextOperationControls.tsx.html +0 -271
- package/coverage/lcov-report/Table/filterTypes.ts.html +0 -97
- package/coverage/lcov-report/Table/index.html +0 -176
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -146
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov.info +0 -1836
- package/dist/Assets/defaultLogo.tsx +0 -31
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Utility UI
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Generic standalone UI helpers: CopyButton, ScrollToTop, LazyWrapper, MoreItems, EmptyState, PdfViewer, FilePreview, FieldSelectModal, ProfilePhotoViewer, StageProgress.
|
|
6
|
+
|
|
7
|
+
## Key paths
|
|
8
|
+
|
|
9
|
+
- `src/Components/CopyButton/`, `ScrollToTop/`, `LazyWrapper/`, `MoreItems/`, `EmptyState/`, `PdfViewer/`, `FilePreview/`, `FieldSelectModal/`, `ProfilePhotoViewer/`, `StageProgress/`
|
|
10
|
+
|
|
11
|
+
## Key rules
|
|
12
|
+
|
|
13
|
+
- FilePreview also exports `FilePreviewTrigger`; StageProgress also exports `StageItem` (StepperStage is internal)
|
|
14
|
+
- LazyWrapper wraps lazy/Suspense loading; ScrollToTop is a scroll-position helper — keep them framework-agnostic (props in, events out)
|
|
15
|
+
- Single-file components (CopyButton, ScrollToTop, LazyWrapper, PdfViewer, FieldSelectModal) have no colocated Props file — types are inline
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Utils & Hooks
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Shared utilities and hooks: debounce, table helpers, preferences.
|
|
6
|
+
|
|
7
|
+
## Key paths
|
|
8
|
+
|
|
9
|
+
- `src/Utils/table.ts`, `src/Hooks/usePreferences.ts`, `src/services/feedback.ts`
|
|
10
|
+
|
|
11
|
+
## Key rules
|
|
12
|
+
|
|
13
|
+
- `debounce` exported from index.ts
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Local status line only — never sent to the model. See .cursor/TASK-SETUP.md
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
STATE_FILE="${HOME}/.cursor/pixelize-skill-session-state.json"
|
|
6
|
+
|
|
7
|
+
payload=$(cat)
|
|
8
|
+
dir=$(echo "$payload" | jq -r ".cwd // .workspace.current_dir // empty")
|
|
9
|
+
session_id=$(echo "$payload" | jq -r ".session_id // empty")
|
|
10
|
+
base=$(basename "$dir")
|
|
11
|
+
|
|
12
|
+
show_no_skill_warning=false
|
|
13
|
+
if [[ -n "$session_id" && -f "$STATE_FILE" ]]; then
|
|
14
|
+
if jq -e --arg id "$session_id" '.[$id].chatting_without_skill == true' "$STATE_FILE" >/dev/null 2>&1; then
|
|
15
|
+
show_no_skill_warning=true
|
|
16
|
+
fi
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
case "$base" in
|
|
20
|
+
account-frontend|account-service)
|
|
21
|
+
line1="/ → task (Account FE + BE)"
|
|
22
|
+
line2=""
|
|
23
|
+
;;
|
|
24
|
+
crm-frontend|crm-service)
|
|
25
|
+
line1="/ → task (this repo)"
|
|
26
|
+
line2="/ → crm-task (CRM FE + BE)"
|
|
27
|
+
;;
|
|
28
|
+
social-frontend|social-service)
|
|
29
|
+
line1="/ → task (this repo)"
|
|
30
|
+
line2="/ → social-task (Social FE + BE)"
|
|
31
|
+
;;
|
|
32
|
+
tickets-frontend)
|
|
33
|
+
line1="/ → task (this repo)"
|
|
34
|
+
line2="/ → tickets-task"
|
|
35
|
+
;;
|
|
36
|
+
crm-mobile)
|
|
37
|
+
line1="/ → task (this repo)"
|
|
38
|
+
line2="/ → crm-mobile-task"
|
|
39
|
+
;;
|
|
40
|
+
Micro-Components)
|
|
41
|
+
line1="/ → task (this repo)"
|
|
42
|
+
line2="/ → design-task"
|
|
43
|
+
;;
|
|
44
|
+
hrms)
|
|
45
|
+
line1="/ → task (this repo)"
|
|
46
|
+
line2="/ → hrms-task (HRMS FE + BE)"
|
|
47
|
+
;;
|
|
48
|
+
*)
|
|
49
|
+
line1="Open a Pixelize repo root for / → task"
|
|
50
|
+
line2=""
|
|
51
|
+
;;
|
|
52
|
+
esac
|
|
53
|
+
|
|
54
|
+
if [[ "$show_no_skill_warning" == "true" ]]; then
|
|
55
|
+
echo -e "\033[1;33m\033[7m ⚠ CHATTING WITHOUT TASK SKILL — use / menu ⚠ \033[0m"
|
|
56
|
+
echo -e "\033[1;33m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
echo -e "\033[1;33m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
|
|
60
|
+
echo -e "\033[1;33m FEATURE WORK → $line1\033[0m"
|
|
61
|
+
if [ -n "$line2" ]; then
|
|
62
|
+
echo -e "\033[1;33m Full pipeline → $line2\033[0m"
|
|
63
|
+
fi
|
|
64
|
+
echo -e "\033[1;33m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Fix Dropdown menu viewport overflow
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
When the Dropdown trigger sits near a screen edge (e.g. far right), the portaled menu currently renders off-screen. It should reposition to stay fully visible within the viewport.
|
|
6
|
+
|
|
7
|
+
## Type
|
|
8
|
+
|
|
9
|
+
fix
|
|
10
|
+
|
|
11
|
+
## Scope
|
|
12
|
+
|
|
13
|
+
- In scope: `src/Components/Dropdown/DropDown.tsx` positioning logic
|
|
14
|
+
- Out of scope: visual restyle, new props API, other select components
|
|
15
|
+
- Agents needed: fe-impl
|
|
16
|
+
|
|
17
|
+
## Root cause
|
|
18
|
+
|
|
19
|
+
`updateMenuPos` sets `top = r.bottom, left = r.left` with no viewport clamping. The `position="fixed"` portaled menu overflows when the trigger is near the right/bottom edge.
|
|
20
|
+
|
|
21
|
+
## Tasks
|
|
22
|
+
|
|
23
|
+
### Component (fe-impl)
|
|
24
|
+
|
|
25
|
+
- [ ] Clamp horizontal position: right-align to trigger and clamp to viewport (8px gutter) when overflowing the right edge; clamp left edge too.
|
|
26
|
+
- [ ] Clamp vertical position: flip above the trigger when the menu would overflow the bottom and there is more space above; otherwise clamp.
|
|
27
|
+
- [ ] Measure the rendered menu (width/height) via the menu ref so clamping uses real dimensions; recompute on open, scroll, resize.
|
|
28
|
+
|
|
29
|
+
### Tests
|
|
30
|
+
|
|
31
|
+
- [ ] Jest test for Dropdown: opens, renders options, repositions left when trigger near right edge.
|
|
32
|
+
|
|
33
|
+
## Risks / assumptions
|
|
34
|
+
|
|
35
|
+
- Uses viewport (window.innerWidth/Height) — fixed positioning, correct for portal-to-body.
|
|
File without changes
|
package/.cursor/rules
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
## Session start
|
|
2
|
+
- Always read CLAUDE.md before starting any task
|
|
3
|
+
- Always read MODULE.md before touching a component family (`.cursor/modules/<domain>/MODULE.md`)
|
|
4
|
+
- Read one similar existing component before implementing
|
|
5
|
+
- Never invent a new pattern if one already exists
|
|
6
|
+
|
|
7
|
+
## Implementation
|
|
8
|
+
- Components live in `src/Components/<Name>/`
|
|
9
|
+
- Public API via `src/index.ts` only
|
|
10
|
+
- Demo pages in `src/Pages/` for playground — not published
|
|
11
|
+
- Never add CRM/app-specific API calls to library components
|
|
12
|
+
- Use theme tokens from `src/Theme/` — no hardcoded brand colors
|
|
13
|
+
- Add Jest tests for new behavior (`*.test.tsx`)
|
|
14
|
+
- Keep changes minimal — no scope creep
|
|
15
|
+
|
|
16
|
+
## Output quality
|
|
17
|
+
- Never create placeholder files unless explicitly asked
|
|
18
|
+
- Never use fake data, lorem ipsum, example.com, or demo seeds
|
|
19
|
+
- Never leave TODO comments — implement fully or report blocked
|
|
20
|
+
- Production-ready components with loading/error states where applicable
|
|
21
|
+
|
|
22
|
+
## Branch rules
|
|
23
|
+
- Always branch from **develop** — never from main
|
|
24
|
+
- Feature work: `feature/<domain>-<short-description>`
|
|
25
|
+
- Bug fixes: `fix/<domain>-<short-description>`
|
|
26
|
+
- Never commit directly to main
|
|
27
|
+
|
|
28
|
+
## Commit rules
|
|
29
|
+
- Never commit without explicit user confirmation
|
|
30
|
+
- Never run git push under any condition
|
|
31
|
+
- Never add Cursor co-author lines
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: task
|
|
3
|
+
description: >-
|
|
4
|
+
Runs the Pixelize Design Library dev pipeline: task-plan → fe-impl → test-create → test-exec → review gate → commit. Use when the user invokes @task, /task, or requests component library delivery.
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Task Pipeline — Pixelize Design Library
|
|
9
|
+
|
|
10
|
+
Single library repo **Micro-Components** (`pixelize-design-library`). Module docs: `.cursor/modules/<domain>/MODULE.md`.
|
|
11
|
+
|
|
12
|
+
Run phases in order. Do not skip unless user opts out.
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
- [ ] 1. Task plan (agent: task-plan)
|
|
16
|
+
- [ ] 2. Implementation (agents: fe-impl + be-impl, parallel when both needed)
|
|
17
|
+
- [ ] 3a. Test creation (agent: test-create)
|
|
18
|
+
- [ ] 3b. Test execution (agent: test-exec)
|
|
19
|
+
- [ ] 4. Review gate (orchestrator — show diff, wait for user)
|
|
20
|
+
- [ ] 5. Commit (orchestrator only)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Before Starting
|
|
26
|
+
|
|
27
|
+
1. Read CLAUDE.md
|
|
28
|
+
2. Confirm user goal — feat / fix / refactor / chore
|
|
29
|
+
3. Tell user which phases apply
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Phase 1 — Task Plan
|
|
34
|
+
|
|
35
|
+
Agent: task-plan → `.cursor/agents/task-plan.md`
|
|
36
|
+
|
|
37
|
+
- Read `.cursor/modules/<domain>/MODULE.md` for touched component families
|
|
38
|
+
- Plan saved to `.cursor/plans/current.md`
|
|
39
|
+
- If current.md already exists — read it first, user may be resuming
|
|
40
|
+
|
|
41
|
+
Gate: do not start phase 2 until plan has concrete tasks.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Phase 2 — Implementation
|
|
46
|
+
|
|
47
|
+
| Plan says | Action |
|
|
48
|
+
|-----------|--------|
|
|
49
|
+
| Library only | Invoke fe-impl only |
|
|
50
|
+
| Both | Rare — fe-impl + test agents |
|
|
51
|
+
|
|
52
|
+
Pass `.cursor/plans/current.md` to each agent.
|
|
53
|
+
|
|
54
|
+
If blocked mid-task:
|
|
55
|
+
- Save progress to `.cursor/plans/blocked/<task-name>.md` with exact blocker details
|
|
56
|
+
- Stop pipeline and report to user
|
|
57
|
+
|
|
58
|
+
Gate: all required agents must report Done or Blocked before phase 3.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Phase 3 — Tests
|
|
63
|
+
|
|
64
|
+
3a: test-create → `.cursor/agents/test-create.md`
|
|
65
|
+
3b: test-exec → `.cursor/agents/test-exec.md`
|
|
66
|
+
|
|
67
|
+
Jest: `npm test` from repo root.
|
|
68
|
+
|
|
69
|
+
Gate: do not proceed to review if tests failed and not explicitly waived by user.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Phase 4 — Review Gate
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git status
|
|
77
|
+
git diff
|
|
78
|
+
git diff --staged
|
|
79
|
+
git log -5 --oneline
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Run git status/diff. STOP and wait for user approval.
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
CHANGES READY TO COMMIT
|
|
86
|
+
|
|
87
|
+
Backend:
|
|
88
|
+
- path/to/file — what changed
|
|
89
|
+
|
|
90
|
+
Frontend:
|
|
91
|
+
- path/to/component — what changed
|
|
92
|
+
|
|
93
|
+
Tests:
|
|
94
|
+
- path/to/test — what it covers
|
|
95
|
+
|
|
96
|
+
MODULE.md updates:
|
|
97
|
+
- path/to/MODULE.md
|
|
98
|
+
|
|
99
|
+
Excluded:
|
|
100
|
+
- none
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
STOP. Wait for: "yes" / "commit" / "looks good" / "go ahead"
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## Phase 5 — Commit
|
|
107
|
+
|
|
108
|
+
### Commit message format
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
<type>(<module>): <concise imperative title>
|
|
112
|
+
|
|
113
|
+
Backend:
|
|
114
|
+
- <specific change — file context>
|
|
115
|
+
|
|
116
|
+
Frontend:
|
|
117
|
+
- <specific change — file context>
|
|
118
|
+
|
|
119
|
+
Tests:
|
|
120
|
+
- <what is covered and where>
|
|
121
|
+
|
|
122
|
+
Config:
|
|
123
|
+
- <migrations, registry changes, config updates>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Commit steps
|
|
127
|
+
|
|
128
|
+
1. Scan diff — if .env or secrets found, warn user and ask if they want to include. Commit only on confirmation.
|
|
129
|
+
2. git add relevant files — state any exclusions clearly
|
|
130
|
+
3. git commit using HEREDOC — never add Cursor attribution lines
|
|
131
|
+
4. If Cursor injects co-author lines — amend immediately if unpushed
|
|
132
|
+
5. Verify: git status + git log -1 --format=full
|
|
133
|
+
6. Show commit hash to user
|
|
134
|
+
7. Move `.cursor/plans/current.md` → `.cursor/plans/done/<YYYY-MM-DD>-<title>.md`
|
|
135
|
+
|
|
136
|
+
Never run git push under any condition.
|
|
137
|
+
|
|
138
|
+
### Commit safety
|
|
139
|
+
|
|
140
|
+
- Never --no-verify unless user explicitly requests
|
|
141
|
+
- Never force-push any branch
|
|
142
|
+
- Nothing staged → skip commit, report clearly
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Final Report
|
|
147
|
+
|
|
148
|
+
| Phase | Status | Notes |
|
|
149
|
+
| -------- | -------------- | --------------------------------- |
|
|
150
|
+
| 1 Plan | done / skipped | saved to .cursor/plans/current.md |
|
|
151
|
+
| 2 Impl | fe / be / both | done / blocked |
|
|
152
|
+
| 3 Tests | create / exec | pass / fail / blocked |
|
|
153
|
+
| 4 Review | approved | confirmed by user |
|
|
154
|
+
| 5 Commit | done / skipped | hash if committed |
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## User Opt-outs
|
|
159
|
+
|
|
160
|
+
| User says | Effect |
|
|
161
|
+
| ------------- | ----------------------------------------- |
|
|
162
|
+
| "plan only" | Stop after phase 1 |
|
|
163
|
+
| "no tests" | Skip phase 3 — confirm with user first |
|
|
164
|
+
| "no commit" | Stop after phase 4 review |
|
|
165
|
+
| "commit only" | Phase 4+5 only — still show diff and wait |
|
|
166
|
+
| "skip review" | Go straight to commit — confirm with user |
|
|
167
|
+
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Pixelize Design Library — Agent Guide
|
|
2
|
+
|
|
3
|
+
Rules for AI assistants working in **Micro-Components** (npm: `pixelize-design-library`).
|
|
4
|
+
|
|
5
|
+
## 1. App name and purpose
|
|
6
|
+
|
|
7
|
+
**Pixelize Design Library** — shared React UI component library and theme system for all Pixelize frontends. Published to npm; local Vite playground demos components in `src/Pages/`.
|
|
8
|
+
|
|
9
|
+
## 2. Stack
|
|
10
|
+
|
|
11
|
+
| Layer | Technology | Version |
|
|
12
|
+
| ------------- | ----------------------------------- | -------------- |
|
|
13
|
+
| Framework | React + TypeScript | 18.3.1 / 5.9.3 |
|
|
14
|
+
| UI base | Chakra UI + Emotion + Framer Motion | 2.8.2 |
|
|
15
|
+
| Build | `tsc` → `dist/` + CSS copy | — |
|
|
16
|
+
| Dev | Vite playground | 6.2.0 |
|
|
17
|
+
| Styling | Tailwind + global CSS | 3.4.17 |
|
|
18
|
+
| Tests | Jest + Testing Library | 29.7.0 |
|
|
19
|
+
| Package | `pixelize-design-library` | 2.2.x |
|
|
20
|
+
|
|
21
|
+
Not a monorepo — single package, one `package.json`.
|
|
22
|
+
|
|
23
|
+
## 3. Repo relationship
|
|
24
|
+
|
|
25
|
+
| Repo / package | Role |
|
|
26
|
+
| --------------------------- | ------------------------------------------------- |
|
|
27
|
+
| **Micro-Components** (here) | Source of `pixelize-design-library` npm package |
|
|
28
|
+
| **crm-frontend** | Consumer — `npm run pixelize` to update |
|
|
29
|
+
| **account-frontend** | Consumer |
|
|
30
|
+
| **social-frontend** | Consumer |
|
|
31
|
+
| **tickets-frontend** | Consumer |
|
|
32
|
+
| **crm-mobile** | Consumer (native-base overlap — check mobile) |
|
|
33
|
+
| **pixelize-authenticator** | Companion auth UI package (separate repo) |
|
|
34
|
+
|
|
35
|
+
No backend API in this repo. Demo pages may call dev APIs for playground only.
|
|
36
|
+
|
|
37
|
+
## 4. Folder structure (2 levels)
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Micro-Components/
|
|
41
|
+
├── package.json, tsconfig.json, vite.config.ts
|
|
42
|
+
├── src/
|
|
43
|
+
│ ├── index.ts public exports (~80)
|
|
44
|
+
│ ├── withTheme.tsx HOC wrapper
|
|
45
|
+
│ ├── Components/ 73 component families
|
|
46
|
+
│ ├── Theme/ 8 brand presets + useCustomTheme
|
|
47
|
+
│ ├── Pages/ 49 Vite demo/playground pages
|
|
48
|
+
│ ├── Utils/, Hooks/, services/, types/
|
|
49
|
+
│ └── App.tsx, Layout.tsx playground shell
|
|
50
|
+
├── dist/ publish output (gitignored)
|
|
51
|
+
└── .cursor/modules/ MODULE.md per component domain (22 domains)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 5. Dev commands
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm start # Vite playground
|
|
58
|
+
npm run build # tsc + copy CSS → dist/
|
|
59
|
+
npm test # Jest
|
|
60
|
+
npm run test:watch
|
|
61
|
+
npm run remove # strip dev artifacts from dist before publish
|
|
62
|
+
npm run package # version patch + build + publish
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 6. Module / component pattern
|
|
66
|
+
|
|
67
|
+
Follow the **Table** or **KanbanBoard** pattern for complex components:
|
|
68
|
+
|
|
69
|
+
| Step | Path |
|
|
70
|
+
| ---- | ---- |
|
|
71
|
+
| Component | `src/Components/<Name>/` |
|
|
72
|
+
| Subcomponents | `src/Components/<Name>/Components/` or nested folders |
|
|
73
|
+
| Props/types | `<Name>Props.ts` or colocated types |
|
|
74
|
+
| Tests | `*.test.tsx` next to component |
|
|
75
|
+
| Stories | `*.stories.tsx` (where present) |
|
|
76
|
+
| Demo page | `src/Pages/<name>.tsx` |
|
|
77
|
+
| Public export | add to `src/index.ts` |
|
|
78
|
+
| Module doc | `.cursor/modules/<domain>/MODULE.md` |
|
|
79
|
+
|
|
80
|
+
Read `.cursor/modules/<domain>/MODULE.md` before touching a component family.
|
|
81
|
+
|
|
82
|
+
## 7. Publishing integration
|
|
83
|
+
|
|
84
|
+
- **Exports:** every public component must be exported from `src/index.ts`
|
|
85
|
+
- **Peers:** React 18, Chakra, Emotion — consumers install alongside library
|
|
86
|
+
- **Build:** `npm run build` compiles to `dist/`; never edit `dist/` directly
|
|
87
|
+
- **Version:** patch releases via `npm run package`; CI publishes on merge to `develop`
|
|
88
|
+
- **Breaking changes:** require version bump + consumer update in frontends
|
|
89
|
+
|
|
90
|
+
## 8. Checklist — adding a new component
|
|
91
|
+
|
|
92
|
+
1. Read similar component + `.cursor/modules/<domain>/MODULE.md`
|
|
93
|
+
2. Create `src/Components/<Name>/` with component + props
|
|
94
|
+
3. Add demo page in `src/Pages/` if needed
|
|
95
|
+
4. Export from `src/index.ts`
|
|
96
|
+
5. Add Jest tests (`*.test.tsx`)
|
|
97
|
+
6. Update `.cursor/modules/<domain>/MODULE.md`
|
|
98
|
+
7. Verify playground: `npm start`
|
|
99
|
+
8. After merge to develop: consumers run `npm run pixelize` in their frontend
|
|
100
|
+
|
|
101
|
+
## 9. Do
|
|
102
|
+
|
|
103
|
+
- Match existing Chakra + design token patterns in `src/Theme/`
|
|
104
|
+
- Keep components framework-agnostic where possible (props in, events out)
|
|
105
|
+
- Add tests for new behavior
|
|
106
|
+
- Use `useCustomTheme` / theme tokens — no hardcoded brand colors
|
|
107
|
+
- Branch from **feature/cursor-ai-setup** or **develop**
|
|
108
|
+
|
|
109
|
+
## 10. Don't
|
|
110
|
+
|
|
111
|
+
- Don't add app-specific business logic (CRM entities, API calls) to library components
|
|
112
|
+
- Don't break existing exports without semver major bump
|
|
113
|
+
- Don't edit `dist/` — always change `src/` and rebuild
|
|
114
|
+
- Don't skip `index.ts` export for public components
|
|
115
|
+
- Don't introduce a second component pattern without team agreement
|
|
116
|
+
- Don't commit npm tokens or `.env` secrets
|
|
117
|
+
|
|
118
|
+
## Task pipeline
|
|
119
|
+
|
|
120
|
+
- **Feature work:** invoke via **`/` menu → `task`** (not by typing `/task` in the message).
|
|
121
|
+
- Cross-repo: **`/ → design-task**`.
|
|
122
|
+
- One-time status line + hook details: [.cursor/TASK-SETUP.md](.cursor/TASK-SETUP.md).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaymentCardProps } from "./PaymentCardProps";
|
|
3
|
-
declare const PaymentCard: ({ plan, isActive, isNextUpgrade, billingCycle, onSelect, onHover, buttonLoading, isLoading, }: PaymentCardProps) => React.JSX.Element;
|
|
3
|
+
declare const PaymentCard: ({ plan, isActive, isNextUpgrade, billingCycle, onSelect, onHover, buttonLoading, isLoading, isRenewal, }: PaymentCardProps) => React.JSX.Element;
|
|
4
4
|
export default PaymentCard;
|
|
@@ -52,9 +52,9 @@ var getCardStyles = function (isActive, isNextUpgrade, popular, theme) {
|
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
54
|
var PaymentCard = function (_a) {
|
|
55
|
-
var plan = _a.plan, _b = _a.isActive, isActive = _b === void 0 ? false : _b, _c = _a.isNextUpgrade, isNextUpgrade = _c === void 0 ? false : _c, billingCycle = _a.billingCycle, onSelect = _a.onSelect, onHover = _a.onHover, buttonLoading = _a.buttonLoading, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d;
|
|
55
|
+
var plan = _a.plan, _b = _a.isActive, isActive = _b === void 0 ? false : _b, _c = _a.isNextUpgrade, isNextUpgrade = _c === void 0 ? false : _c, billingCycle = _a.billingCycle, onSelect = _a.onSelect, onHover = _a.onHover, buttonLoading = _a.buttonLoading, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, _e = _a.isRenewal, isRenewal = _e === void 0 ? false : _e;
|
|
56
56
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
57
|
-
var
|
|
57
|
+
var _f = getCardStyles(isActive, isNextUpgrade, !!plan.popular, theme), badgeText = _f.badgeText, badgeColor = _f.badgeColor, buttonColor = _f.buttonColor, buttonColor50 = _f.buttonColor50;
|
|
58
58
|
var variantStyles = plan.buttonVariant === "outline"
|
|
59
59
|
? {
|
|
60
60
|
borderColor: buttonColor,
|
|
@@ -93,7 +93,7 @@ var PaymentCard = function (_a) {
|
|
|
93
93
|
react_1.default.createElement(react_2.Text, { fontSize: "0.7rem", fontWeight: "normal", color: theme.colors.gray[600] }, plan.tax)))),
|
|
94
94
|
plan.priceDescription && (react_1.default.createElement(react_2.Text, { color: theme.colors.green[800], mt: 2 }, plan === null || plan === void 0 ? void 0 : plan.priceDescription)),
|
|
95
95
|
react_1.default.createElement(react_2.Text, { color: theme.colors.gray[600], mt: 2 }, plan.description)),
|
|
96
|
-
!isActive && plan.buttonText && (react_1.default.createElement(Button_1.default, __assign({ isLoading: plan.plan_id === buttonLoading, loadingText: plan.buttonLoadingText, width: "full", variant: plan.buttonVariant, size: "lg", onClick: function () { return onSelect === null || onSelect === void 0 ? void 0 : onSelect(plan.plan_id); }, onMouseEnter: function () { return onHover === null || onHover === void 0 ? void 0 : onHover(plan.plan_id, "button", true); }, onMouseLeave: function () { return onHover === null || onHover === void 0 ? void 0 : onHover(plan.plan_id, "button", false); } }, variantStyles), plan.buttonText)),
|
|
96
|
+
((!isActive && plan.buttonText) || isRenewal) && (react_1.default.createElement(Button_1.default, __assign({ isLoading: plan.plan_id === buttonLoading, loadingText: plan.buttonLoadingText, width: "full", variant: plan.buttonVariant, size: "lg", onClick: function () { return onSelect === null || onSelect === void 0 ? void 0 : onSelect(plan.plan_id); }, onMouseEnter: function () { return onHover === null || onHover === void 0 ? void 0 : onHover(plan.plan_id, "button", true); }, onMouseLeave: function () { return onHover === null || onHover === void 0 ? void 0 : onHover(plan.plan_id, "button", false); } }, variantStyles), plan.buttonText)),
|
|
97
97
|
react_1.default.createElement(react_2.VStack, { align: "start", spacing: 3, mt: 6 }, plan.features.map(function (feature, i) { return (react_1.default.createElement(react_2.Flex, { key: i, align: "center" },
|
|
98
98
|
react_1.default.createElement(react_2.Icon, { as: lucide_react_1.Check, color: theme.colors.green[500], mr: 2 }),
|
|
99
99
|
react_1.default.createElement(react_2.Text, { fontSize: "sm" }, feature))); })))))));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface CopyButtonProps {
|
|
3
|
+
/** Text to write to the clipboard. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** "icon" floating icon button, "button" icon + text, "menu-item" full-width row. */
|
|
6
|
+
variant?: "icon" | "button" | "menu-item";
|
|
7
|
+
/** Visible label for "button" / "menu-item" variants. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Label shown briefly after a successful copy. */
|
|
10
|
+
copiedLabel?: string;
|
|
11
|
+
/** Tooltip text (icon variant). */
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
/** ms to keep the "copied" state. */
|
|
14
|
+
feedbackDuration?: number;
|
|
15
|
+
/** Icon px size. */
|
|
16
|
+
iconSize?: number;
|
|
17
|
+
size?: "xs" | "sm" | "md";
|
|
18
|
+
/** Called after a successful copy. */
|
|
19
|
+
onCopy?: (value: string) => void;
|
|
20
|
+
}
|
|
21
|
+
declare const CopyButton: React.FC<CopyButtonProps>;
|
|
22
|
+
export default CopyButton;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
45
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
47
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48
|
+
function step(op) {
|
|
49
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
50
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
51
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
52
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
53
|
+
switch (op[0]) {
|
|
54
|
+
case 0: case 1: t = op; break;
|
|
55
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
56
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
57
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
58
|
+
default:
|
|
59
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
60
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
61
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
62
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
63
|
+
if (t[2]) _.ops.pop();
|
|
64
|
+
_.trys.pop(); continue;
|
|
65
|
+
}
|
|
66
|
+
op = body.call(thisArg, _);
|
|
67
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
68
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
72
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
73
|
+
};
|
|
74
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
+
var react_1 = __importStar(require("react"));
|
|
76
|
+
var react_2 = require("@chakra-ui/react");
|
|
77
|
+
var lucide_react_1 = require("lucide-react");
|
|
78
|
+
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
79
|
+
var ToolTip_1 = __importDefault(require("../ToolTip/ToolTip"));
|
|
80
|
+
var CopyButton = function (_a) {
|
|
81
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
82
|
+
var value = _a.value, _o = _a.variant, variant = _o === void 0 ? "icon" : _o, _p = _a.label, label = _p === void 0 ? "Copy" : _p, _q = _a.copiedLabel, copiedLabel = _q === void 0 ? "Copied!" : _q, _r = _a.tooltip, tooltip = _r === void 0 ? "Copy" : _r, _s = _a.feedbackDuration, feedbackDuration = _s === void 0 ? 1500 : _s, _t = _a.iconSize, iconSize = _t === void 0 ? 16 : _t, _u = _a.size, size = _u === void 0 ? "sm" : _u, onCopy = _a.onCopy;
|
|
83
|
+
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
84
|
+
var _v = (0, react_1.useState)(false), copied = _v[0], setCopied = _v[1];
|
|
85
|
+
var timer = (0, react_1.useRef)();
|
|
86
|
+
(0, react_1.useEffect)(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
87
|
+
var handleCopy = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
|
+
var _a;
|
|
89
|
+
return __generator(this, function (_b) {
|
|
90
|
+
switch (_b.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
_b.label = 1;
|
|
94
|
+
case 1:
|
|
95
|
+
_b.trys.push([1, 3, , 4]);
|
|
96
|
+
return [4 /*yield*/, navigator.clipboard.writeText(value)];
|
|
97
|
+
case 2:
|
|
98
|
+
_b.sent();
|
|
99
|
+
setCopied(true);
|
|
100
|
+
onCopy === null || onCopy === void 0 ? void 0 : onCopy(value);
|
|
101
|
+
clearTimeout(timer.current);
|
|
102
|
+
timer.current = setTimeout(function () { return setCopied(false); }, feedbackDuration);
|
|
103
|
+
return [3 /*break*/, 4];
|
|
104
|
+
case 3:
|
|
105
|
+
_a = _b.sent();
|
|
106
|
+
return [3 /*break*/, 4];
|
|
107
|
+
case 4: return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}); };
|
|
111
|
+
var accent = theme.colors.primary[500];
|
|
112
|
+
var success = (_d = (_c = (_b = theme.colors.semantic) === null || _b === void 0 ? void 0 : _b.success) === null || _c === void 0 ? void 0 : _c[500]) !== null && _d !== void 0 ? _d : "#16A34A";
|
|
113
|
+
if (variant === "menu-item") {
|
|
114
|
+
return (react_1.default.createElement(react_2.Flex, { align: "center", gap: "0.5rem", px: "12px", py: "8px", width: "100%", cursor: "pointer", borderRadius: "6px", transition: "background 0.15s ease", _hover: { bg: (_f = (_e = theme.colors.gray) === null || _e === void 0 ? void 0 : _e[100]) !== null && _f !== void 0 ? _f : "#F1F5F9" }, onClick: handleCopy },
|
|
115
|
+
copied ? react_1.default.createElement(lucide_react_1.Check, { size: iconSize, color: success }) : react_1.default.createElement(lucide_react_1.Copy, { size: iconSize, color: accent }),
|
|
116
|
+
react_1.default.createElement(react_2.Box, { fontSize: "14px", fontWeight: 500, color: copied ? success : accent }, copied ? copiedLabel : label)));
|
|
117
|
+
}
|
|
118
|
+
if (variant === "button") {
|
|
119
|
+
return (react_1.default.createElement(react_2.Flex, { as: "button", align: "center", gap: "6px", px: "12px", py: "6px", borderRadius: "8px", border: "1px solid", borderColor: copied ? success : (_h = (_g = theme.colors.gray) === null || _g === void 0 ? void 0 : _g[200]) !== null && _h !== void 0 ? _h : "#E2E8F0", bg: "transparent", color: copied ? success : (_k = (_j = theme.colors.gray) === null || _j === void 0 ? void 0 : _j[700]) !== null && _k !== void 0 ? _k : "#2D3748", fontSize: "14px", fontWeight: 500, transition: "all 0.15s ease", _hover: { borderColor: accent, color: accent }, onClick: handleCopy },
|
|
120
|
+
copied ? react_1.default.createElement(lucide_react_1.Check, { size: iconSize }) : react_1.default.createElement(lucide_react_1.Copy, { size: iconSize }),
|
|
121
|
+
react_1.default.createElement(react_2.Text, null, copied ? copiedLabel : label)));
|
|
122
|
+
}
|
|
123
|
+
return (react_1.default.createElement(ToolTip_1.default, { label: copied ? copiedLabel : tooltip, placement: "top" },
|
|
124
|
+
react_1.default.createElement(react_2.IconButton, { "aria-label": tooltip, size: size, variant: "ghost", onClick: handleCopy, color: copied ? success : (_m = (_l = theme.colors.gray) === null || _l === void 0 ? void 0 : _l[500]) !== null && _m !== void 0 ? _m : "#718096", _hover: { color: accent, bg: theme.colors.primary[50] }, icon: copied ? react_1.default.createElement(lucide_react_1.Check, { size: iconSize }) : react_1.default.createElement(lucide_react_1.Copy, { size: iconSize }) })));
|
|
125
|
+
};
|
|
126
|
+
exports.default = CopyButton;
|