@bloomneo/uikit 1.5.0
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/CHANGELOG.md +222 -0
- package/LICENSE +21 -0
- package/README.md +513 -0
- package/bin/commands/build.js +232 -0
- package/bin/commands/bundle.js +587 -0
- package/bin/commands/create.js +768 -0
- package/bin/commands/deploy.js +533 -0
- package/bin/commands/generate.js +673 -0
- package/bin/commands/optimize.js +198 -0
- package/bin/commands/prerender.js +306 -0
- package/bin/commands/serve.js +216 -0
- package/bin/templates/fbca/README.md.template +130 -0
- package/bin/templates/fbca/docs/QUICKSTART_FBCA.md +368 -0
- package/bin/templates/fbca/docs/UIKIT_CLI_GUIDE.md +574 -0
- package/bin/templates/fbca/docs/UIKIT_COMPOSITE_UI_SYSTEM.md +649 -0
- package/bin/templates/fbca/docs/UIKIT_LLM_GUIDE.md +2055 -0
- package/bin/templates/fbca/docs/UIKIT_THEME_GUIDE.md +359 -0
- package/bin/templates/fbca/package.json.template +41 -0
- package/bin/templates/fbca/public/favicon.svg +10 -0
- package/bin/templates/fbca/public/hero_fbca.svg +1 -0
- package/bin/templates/fbca/src/utils/asset.ts +6 -0
- package/bin/templates/fbca/src/web/App.tsx.template +20 -0
- package/bin/templates/fbca/src/web/features/auth/pages/index.tsx.template +157 -0
- package/bin/templates/fbca/src/web/features/docs/pages/[...slug].tsx.template +83 -0
- package/bin/templates/fbca/src/web/features/gallery/hooks/useGallery.ts.template +74 -0
- package/bin/templates/fbca/src/web/features/gallery/pages/index.tsx.template +136 -0
- package/bin/templates/fbca/src/web/features/main/components/CTASection.tsx.template +43 -0
- package/bin/templates/fbca/src/web/features/main/pages/About.tsx.template +374 -0
- package/bin/templates/fbca/src/web/features/main/pages/index.tsx.template +214 -0
- package/bin/templates/fbca/src/web/index.html.template +15 -0
- package/bin/templates/fbca/src/web/lib/page-router.tsx.template +134 -0
- package/bin/templates/fbca/src/web/main.tsx.template +14 -0
- package/bin/templates/fbca/src/web/shared/components/Footer.tsx.template +57 -0
- package/bin/templates/fbca/src/web/shared/components/Header.tsx.template +91 -0
- package/bin/templates/fbca/src/web/shared/components/SEO.tsx.template +24 -0
- package/bin/templates/fbca/src/web/shared/components/index.ts.template +3 -0
- package/bin/templates/fbca/src/web/shared/hooks/useSEO.ts.template +85 -0
- package/bin/templates/fbca/src/web/shared/utils/asset.ts +6 -0
- package/bin/templates/fbca/src/web/styles/index.css.template +8 -0
- package/bin/templates/fbca/src/web/utils/asset.ts +6 -0
- package/bin/templates/fbca/tsconfig.json.template +32 -0
- package/bin/templates/fbca/tsconfig.node.json.template +10 -0
- package/bin/templates/fbca/vite.config.ts.template +38 -0
- package/bin/templates/generate/component/component.tsx.template +79 -0
- package/bin/templates/generate/component/index.ts.template +2 -0
- package/bin/templates/generate/component/types.ts.template +58 -0
- package/bin/templates/generate/feature/index.ts.template +14 -0
- package/bin/templates/generate/feature/list-page.tsx.template +34 -0
- package/bin/templates/generate/feature/main-component.tsx.template +37 -0
- package/bin/templates/generate/feature/main-page.tsx.template +30 -0
- package/bin/templates/generate/feature/types.ts.template +34 -0
- package/bin/templates/generate/hook/hook.ts.template +35 -0
- package/bin/templates/generate/index.css.template +10 -0
- package/bin/templates/generate/main.tsx.template +10 -0
- package/bin/templates/generate/page/index.ts.template +2 -0
- package/bin/templates/generate/page/page.tsx.template +86 -0
- package/bin/templates/generate/theme/README.md +31 -0
- package/bin/templates/generate/theme/theme.js.template +155 -0
- package/bin/templates/multi/README.md.template +120 -0
- package/bin/templates/multi/docs/QUICKSTART_MULTI.md +334 -0
- package/bin/templates/multi/docs/UIKIT_CLI_GUIDE.md +574 -0
- package/bin/templates/multi/docs/UIKIT_COMPOSITE_UI_SYSTEM.md +649 -0
- package/bin/templates/multi/docs/UIKIT_LLM_GUIDE.md +2055 -0
- package/bin/templates/multi/docs/UIKIT_THEME_GUIDE.md +359 -0
- package/bin/templates/multi/index.html.template +58 -0
- package/bin/templates/multi/package.json.template +35 -0
- package/bin/templates/multi/public/favicon.svg +10 -0
- package/bin/templates/multi/public/hero_multi.svg +1 -0
- package/bin/templates/multi/src/App.tsx.template +92 -0
- package/bin/templates/multi/src/components/Footer.tsx.template +58 -0
- package/bin/templates/multi/src/components/Header.tsx.template +103 -0
- package/bin/templates/multi/src/components/SEO.tsx.template +19 -0
- package/bin/templates/multi/src/components/index.ts.template +3 -0
- package/bin/templates/multi/src/hooks/useSEO.ts.template +38 -0
- package/bin/templates/multi/src/index.css.template +7 -0
- package/bin/templates/multi/src/main.tsx.template +14 -0
- package/bin/templates/multi/src/pages/About.tsx.template +276 -0
- package/bin/templates/multi/src/pages/Components.tsx.template +288 -0
- package/bin/templates/multi/src/pages/Contact.tsx.template +348 -0
- package/bin/templates/multi/src/pages/Dashboard.tsx.template +306 -0
- package/bin/templates/multi/src/pages/ErrorPage.tsx.template +37 -0
- package/bin/templates/multi/src/pages/Home.tsx.template +201 -0
- package/bin/templates/multi/src/pages/Login.tsx.template +148 -0
- package/bin/templates/multi/src/pages/Themes.tsx.template +207 -0
- package/bin/templates/multi/src/router.tsx.template +34 -0
- package/bin/templates/multi/src/utils/asset.ts +6 -0
- package/bin/templates/multi/tsconfig.json.template +30 -0
- package/bin/templates/multi/tsconfig.node.json +22 -0
- package/bin/templates/multi/vite.config.ts.template +36 -0
- package/bin/templates/single/README.md.template +131 -0
- package/bin/templates/single/docs/QUICKSTART_SINGLE.md +259 -0
- package/bin/templates/single/docs/UIKIT_CLI_GUIDE.md +574 -0
- package/bin/templates/single/docs/UIKIT_COMPOSITE_UI_SYSTEM.md +649 -0
- package/bin/templates/single/docs/UIKIT_LLM_GUIDE.md +2055 -0
- package/bin/templates/single/docs/UIKIT_THEME_GUIDE.md +359 -0
- package/bin/templates/single/index.html.template +37 -0
- package/bin/templates/single/package.json.template +34 -0
- package/bin/templates/single/public/favicon.svg +10 -0
- package/bin/templates/single/public/hero.svg +1 -0
- package/bin/templates/single/src/App.tsx.template +233 -0
- package/bin/templates/single/src/index.css.template +7 -0
- package/bin/templates/single/src/main.tsx.template +14 -0
- package/bin/templates/single/src/styles/fonts.css +99 -0
- package/bin/templates/single/src/utils/asset.ts +6 -0
- package/bin/templates/single/tsconfig.json +31 -0
- package/bin/templates/single/tsconfig.node.json +22 -0
- package/bin/templates/single/vite.config.ts.template +36 -0
- package/bin/templates/spa/README.md.template +105 -0
- package/bin/templates/spa/components/SEO.tsx.template +19 -0
- package/bin/templates/spa/docs/QUICKSTART_SPA.md +300 -0
- package/bin/templates/spa/docs/UIKIT_CLI_GUIDE.md +574 -0
- package/bin/templates/spa/docs/UIKIT_COMPOSITE_UI_SYSTEM.md +649 -0
- package/bin/templates/spa/docs/UIKIT_LLM_GUIDE.md +2055 -0
- package/bin/templates/spa/docs/UIKIT_THEME_GUIDE.md +359 -0
- package/bin/templates/spa/hooks/useSEO.ts.template +38 -0
- package/bin/templates/spa/index.html.template +58 -0
- package/bin/templates/spa/package.json.template +35 -0
- package/bin/templates/spa/public/favicon.svg +15 -0
- package/bin/templates/spa/public/hero_spa.svg +1 -0
- package/bin/templates/spa/src/App.tsx.template +659 -0
- package/bin/templates/spa/src/index.css.template +7 -0
- package/bin/templates/spa/src/main.tsx.template +14 -0
- package/bin/templates/spa/src/utils/asset.ts +6 -0
- package/bin/templates/spa/tsconfig.json.template +30 -0
- package/bin/templates/spa/tsconfig.node.json +22 -0
- package/bin/templates/spa/vite.config.ts.template +36 -0
- package/bin/uikit.js +133 -0
- package/cookbook/README.md +20 -0
- package/cookbook/crud-page.tsx +99 -0
- package/cookbook/dashboard.tsx +89 -0
- package/cookbook/delete-flow.tsx +59 -0
- package/cookbook/login.tsx +85 -0
- package/cookbook/settings.tsx +113 -0
- package/dist/Combination-C0DFrmJW.js +674 -0
- package/dist/Combination-C0DFrmJW.js.map +1 -0
- package/dist/accordion.js +284 -0
- package/dist/accordion.js.map +1 -0
- package/dist/admin.js +429 -0
- package/dist/admin.js.map +1 -0
- package/dist/alert.js +67 -0
- package/dist/alert.js.map +1 -0
- package/dist/auth.js +178 -0
- package/dist/auth.js.map +1 -0
- package/dist/avatar.js +249 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.js +40 -0
- package/dist/badge.js.map +1 -0
- package/dist/blank.js +80 -0
- package/dist/blank.js.map +1 -0
- package/dist/breadcrumb.js +104 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/button.js +50 -0
- package/dist/button.js.map +1 -0
- package/dist/calendar.js +2785 -0
- package/dist/calendar.js.map +1 -0
- package/dist/card.js +91 -0
- package/dist/card.js.map +1 -0
- package/dist/check-DXouwtzp.js +12 -0
- package/dist/check-DXouwtzp.js.map +1 -0
- package/dist/checkbox.js +268 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chevron-down-BORJtX8F.js +14 -0
- package/dist/chevron-down-BORJtX8F.js.map +1 -0
- package/dist/chevron-left-C1pkx4AF.js +14 -0
- package/dist/chevron-left-C1pkx4AF.js.map +1 -0
- package/dist/chevron-right-pz9eCjj-.js +14 -0
- package/dist/chevron-right-pz9eCjj-.js.map +1 -0
- package/dist/circle-DHOdTDQh.js +14 -0
- package/dist/circle-DHOdTDQh.js.map +1 -0
- package/dist/collapsible.js +35 -0
- package/dist/collapsible.js.map +1 -0
- package/dist/command.js +481 -0
- package/dist/command.js.map +1 -0
- package/dist/confirm-dialog.js +129 -0
- package/dist/confirm-dialog.js.map +1 -0
- package/dist/container.js +334 -0
- package/dist/container.js.map +1 -0
- package/dist/createLucideIcon-B45kRl5r.js +80 -0
- package/dist/createLucideIcon-B45kRl5r.js.map +1 -0
- package/dist/data-table.js +574 -0
- package/dist/data-table.js.map +1 -0
- package/dist/detail-page.js +454 -0
- package/dist/detail-page.js.map +1 -0
- package/dist/dialog.js +137 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dropdown-menu.js +424 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/ellipsis-BhAoKPVk.js +16 -0
- package/dist/ellipsis-BhAoKPVk.js.map +1 -0
- package/dist/empty-state.js +54 -0
- package/dist/empty-state.js.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/eye-DDKoW0KS.js +46 -0
- package/dist/eye-DDKoW0KS.js.map +1 -0
- package/dist/fonts/caveat-cyrillic-400-normal.woff +0 -0
- package/dist/fonts/caveat-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/caveat-cyrillic-700-normal.woff +0 -0
- package/dist/fonts/caveat-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/caveat-cyrillic-ext-400-normal.woff +0 -0
- package/dist/fonts/caveat-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/caveat-cyrillic-ext-700-normal.woff +0 -0
- package/dist/fonts/caveat-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/fonts/caveat-latin-400-normal.woff +0 -0
- package/dist/fonts/caveat-latin-400-normal.woff2 +0 -0
- package/dist/fonts/caveat-latin-700-normal.woff +0 -0
- package/dist/fonts/caveat-latin-700-normal.woff2 +0 -0
- package/dist/fonts/caveat-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/caveat-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/caveat-latin-ext-700-normal.woff +0 -0
- package/dist/fonts/caveat-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/crimson-text-latin-400-normal.woff +0 -0
- package/dist/fonts/crimson-text-latin-400-normal.woff2 +0 -0
- package/dist/fonts/crimson-text-latin-600-normal.woff +0 -0
- package/dist/fonts/crimson-text-latin-600-normal.woff2 +0 -0
- package/dist/fonts/crimson-text-latin-700-normal.woff +0 -0
- package/dist/fonts/crimson-text-latin-700-normal.woff2 +0 -0
- package/dist/fonts/crimson-text-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/crimson-text-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/crimson-text-latin-ext-600-normal.woff +0 -0
- package/dist/fonts/crimson-text-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/crimson-text-latin-ext-700-normal.woff +0 -0
- package/dist/fonts/crimson-text-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/crimson-text-vietnamese-400-normal.woff +0 -0
- package/dist/fonts/crimson-text-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/crimson-text-vietnamese-600-normal.woff +0 -0
- package/dist/fonts/crimson-text-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/crimson-text-vietnamese-700-normal.woff +0 -0
- package/dist/fonts/crimson-text-vietnamese-700-normal.woff2 +0 -0
- package/dist/fonts/dm-serif-display-latin-400-normal.woff +0 -0
- package/dist/fonts/dm-serif-display-latin-400-normal.woff2 +0 -0
- package/dist/fonts/dm-serif-display-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/dm-serif-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/libre-baskerville-latin-400-normal.woff +0 -0
- package/dist/fonts/libre-baskerville-latin-400-normal.woff2 +0 -0
- package/dist/fonts/libre-baskerville-latin-700-normal.woff +0 -0
- package/dist/fonts/libre-baskerville-latin-700-normal.woff2 +0 -0
- package/dist/fonts/libre-baskerville-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/libre-baskerville-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/libre-baskerville-latin-ext-700-normal.woff +0 -0
- package/dist/fonts/libre-baskerville-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/montserrat-cyrillic-400-normal.woff +0 -0
- package/dist/fonts/montserrat-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/montserrat-cyrillic-500-normal.woff +0 -0
- package/dist/fonts/montserrat-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/montserrat-cyrillic-600-normal.woff +0 -0
- package/dist/fonts/montserrat-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/montserrat-cyrillic-ext-400-normal.woff +0 -0
- package/dist/fonts/montserrat-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/montserrat-cyrillic-ext-500-normal.woff +0 -0
- package/dist/fonts/montserrat-cyrillic-ext-500-normal.woff2 +0 -0
- package/dist/fonts/montserrat-cyrillic-ext-600-normal.woff +0 -0
- package/dist/fonts/montserrat-cyrillic-ext-600-normal.woff2 +0 -0
- package/dist/fonts/montserrat-latin-400-normal.woff +0 -0
- package/dist/fonts/montserrat-latin-400-normal.woff2 +0 -0
- package/dist/fonts/montserrat-latin-500-normal.woff +0 -0
- package/dist/fonts/montserrat-latin-500-normal.woff2 +0 -0
- package/dist/fonts/montserrat-latin-600-normal.woff +0 -0
- package/dist/fonts/montserrat-latin-600-normal.woff2 +0 -0
- package/dist/fonts/montserrat-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/montserrat-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/montserrat-latin-ext-500-normal.woff +0 -0
- package/dist/fonts/montserrat-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/montserrat-latin-ext-600-normal.woff +0 -0
- package/dist/fonts/montserrat-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/montserrat-vietnamese-400-normal.woff +0 -0
- package/dist/fonts/montserrat-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/montserrat-vietnamese-500-normal.woff +0 -0
- package/dist/fonts/montserrat-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/montserrat-vietnamese-600-normal.woff +0 -0
- package/dist/fonts/montserrat-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/playfair-display-cyrillic-400-normal.woff +0 -0
- package/dist/fonts/playfair-display-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/playfair-display-cyrillic-500-normal.woff +0 -0
- package/dist/fonts/playfair-display-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/playfair-display-latin-400-normal.woff +0 -0
- package/dist/fonts/playfair-display-latin-400-normal.woff2 +0 -0
- package/dist/fonts/playfair-display-latin-500-normal.woff +0 -0
- package/dist/fonts/playfair-display-latin-500-normal.woff2 +0 -0
- package/dist/fonts/playfair-display-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/playfair-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/playfair-display-latin-ext-500-normal.woff +0 -0
- package/dist/fonts/playfair-display-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/playfair-display-vietnamese-400-normal.woff +0 -0
- package/dist/fonts/playfair-display-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/playfair-display-vietnamese-500-normal.woff +0 -0
- package/dist/fonts/playfair-display-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/poppins-devanagari-400-normal.woff +0 -0
- package/dist/fonts/poppins-devanagari-400-normal.woff2 +0 -0
- package/dist/fonts/poppins-devanagari-500-normal.woff +0 -0
- package/dist/fonts/poppins-devanagari-500-normal.woff2 +0 -0
- package/dist/fonts/poppins-devanagari-600-normal.woff +0 -0
- package/dist/fonts/poppins-devanagari-600-normal.woff2 +0 -0
- package/dist/fonts/poppins-latin-400-normal.woff +0 -0
- package/dist/fonts/poppins-latin-400-normal.woff2 +0 -0
- package/dist/fonts/poppins-latin-500-normal.woff +0 -0
- package/dist/fonts/poppins-latin-500-normal.woff2 +0 -0
- package/dist/fonts/poppins-latin-600-normal.woff +0 -0
- package/dist/fonts/poppins-latin-600-normal.woff2 +0 -0
- package/dist/fonts/poppins-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/poppins-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/poppins-latin-ext-500-normal.woff +0 -0
- package/dist/fonts/poppins-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/poppins-latin-ext-600-normal.woff +0 -0
- package/dist/fonts/poppins-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/rubik-arabic-400-normal.woff +0 -0
- package/dist/fonts/rubik-arabic-400-normal.woff2 +0 -0
- package/dist/fonts/rubik-arabic-500-normal.woff +0 -0
- package/dist/fonts/rubik-arabic-500-normal.woff2 +0 -0
- package/dist/fonts/rubik-cyrillic-400-normal.woff +0 -0
- package/dist/fonts/rubik-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/rubik-cyrillic-500-normal.woff +0 -0
- package/dist/fonts/rubik-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/rubik-cyrillic-ext-400-normal.woff +0 -0
- package/dist/fonts/rubik-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/rubik-cyrillic-ext-500-normal.woff +0 -0
- package/dist/fonts/rubik-cyrillic-ext-500-normal.woff2 +0 -0
- package/dist/fonts/rubik-hebrew-400-normal.woff +0 -0
- package/dist/fonts/rubik-hebrew-400-normal.woff2 +0 -0
- package/dist/fonts/rubik-hebrew-500-normal.woff +0 -0
- package/dist/fonts/rubik-hebrew-500-normal.woff2 +0 -0
- package/dist/fonts/rubik-latin-400-normal.woff +0 -0
- package/dist/fonts/rubik-latin-400-normal.woff2 +0 -0
- package/dist/fonts/rubik-latin-500-normal.woff +0 -0
- package/dist/fonts/rubik-latin-500-normal.woff2 +0 -0
- package/dist/fonts/rubik-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/rubik-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/rubik-latin-ext-500-normal.woff +0 -0
- package/dist/fonts/rubik-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/source-serif-pro-cyrillic-400-normal.woff +0 -0
- package/dist/fonts/source-serif-pro-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/source-serif-pro-cyrillic-ext-400-normal.woff +0 -0
- package/dist/fonts/source-serif-pro-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/source-serif-pro-greek-400-normal.woff +0 -0
- package/dist/fonts/source-serif-pro-greek-400-normal.woff2 +0 -0
- package/dist/fonts/source-serif-pro-latin-400-normal.woff +0 -0
- package/dist/fonts/source-serif-pro-latin-400-normal.woff2 +0 -0
- package/dist/fonts/source-serif-pro-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/source-serif-pro-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/source-serif-pro-vietnamese-400-normal.woff +0 -0
- package/dist/fonts/source-serif-pro-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-latin-400-normal.woff +0 -0
- package/dist/fonts/space-grotesk-latin-400-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-latin-600-normal.woff +0 -0
- package/dist/fonts/space-grotesk-latin-600-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-latin-700-normal.woff +0 -0
- package/dist/fonts/space-grotesk-latin-700-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/space-grotesk-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-latin-ext-600-normal.woff +0 -0
- package/dist/fonts/space-grotesk-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-latin-ext-700-normal.woff +0 -0
- package/dist/fonts/space-grotesk-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-vietnamese-400-normal.woff +0 -0
- package/dist/fonts/space-grotesk-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-vietnamese-600-normal.woff +0 -0
- package/dist/fonts/space-grotesk-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-vietnamese-700-normal.woff +0 -0
- package/dist/fonts/space-grotesk-vietnamese-700-normal.woff2 +0 -0
- package/dist/fonts/work-sans-latin-400-normal.woff +0 -0
- package/dist/fonts/work-sans-latin-400-normal.woff2 +0 -0
- package/dist/fonts/work-sans-latin-500-normal.woff +0 -0
- package/dist/fonts/work-sans-latin-500-normal.woff2 +0 -0
- package/dist/fonts/work-sans-latin-ext-400-normal.woff +0 -0
- package/dist/fonts/work-sans-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/work-sans-latin-ext-500-normal.woff +0 -0
- package/dist/fonts/work-sans-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/work-sans-vietnamese-400-normal.woff +0 -0
- package/dist/fonts/work-sans-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/work-sans-vietnamese-500-normal.woff +0 -0
- package/dist/fonts/work-sans-vietnamese-500-normal.woff2 +0 -0
- package/dist/footer.js +308 -0
- package/dist/footer.js.map +1 -0
- package/dist/form-field.js +69 -0
- package/dist/form-field.js.map +1 -0
- package/dist/form.js +732 -0
- package/dist/form.js.map +1 -0
- package/dist/format.js +112 -0
- package/dist/format.js.map +1 -0
- package/dist/fouc.js +28 -0
- package/dist/fouc.js.map +1 -0
- package/dist/header.js +289 -0
- package/dist/header.js.map +1 -0
- package/dist/hooks.js +13 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hover-card.js +210 -0
- package/dist/hover-card.js.map +1 -0
- package/dist/index-0ioNhtNM.js +11 -0
- package/dist/index-0ioNhtNM.js.map +1 -0
- package/dist/index-1QHKgw6D.js +55 -0
- package/dist/index-1QHKgw6D.js.map +1 -0
- package/dist/index-B6sSWi7l.js +747 -0
- package/dist/index-B6sSWi7l.js.map +1 -0
- package/dist/index-BCjJQGh8.js +71 -0
- package/dist/index-BCjJQGh8.js.map +1 -0
- package/dist/index-BGQepRFJ.js +28 -0
- package/dist/index-BGQepRFJ.js.map +1 -0
- package/dist/index-BVRIAMfe.js +37 -0
- package/dist/index-BVRIAMfe.js.map +1 -0
- package/dist/index-BY7PeRJA.js +145 -0
- package/dist/index-BY7PeRJA.js.map +1 -0
- package/dist/index-BZPx6jYI.js +9 -0
- package/dist/index-BZPx6jYI.js.map +1 -0
- package/dist/index-Ba4eHUBD.js +243 -0
- package/dist/index-Ba4eHUBD.js.map +1 -0
- package/dist/index-Bke1qZdk.js +35 -0
- package/dist/index-Bke1qZdk.js.map +1 -0
- package/dist/index-C0UREtMP.js +60 -0
- package/dist/index-C0UREtMP.js.map +1 -0
- package/dist/index-CCKe-Mpx.js +7 -0
- package/dist/index-CCKe-Mpx.js.map +1 -0
- package/dist/index-DFZozV_h.js +69 -0
- package/dist/index-DFZozV_h.js.map +1 -0
- package/dist/index-DFi6WydO.js +180 -0
- package/dist/index-DFi6WydO.js.map +1 -0
- package/dist/index-DQH6odE9.js +83 -0
- package/dist/index-DQH6odE9.js.map +1 -0
- package/dist/index-EO5flKM3.js +119 -0
- package/dist/index-EO5flKM3.js.map +1 -0
- package/dist/index-Lf7yDOXW.js +615 -0
- package/dist/index-Lf7yDOXW.js.map +1 -0
- package/dist/index-dhIqEbxW.js +1541 -0
- package/dist/index-dhIqEbxW.js.map +1 -0
- package/dist/index-pWhlqjff.js +32 -0
- package/dist/index-pWhlqjff.js.map +1 -0
- package/dist/index-rKs9bXHr.js +7 -0
- package/dist/index-rKs9bXHr.js.map +1 -0
- package/dist/index-xqkGMOJ8.js +14 -0
- package/dist/index-xqkGMOJ8.js.map +1 -0
- package/dist/index.js +247 -0
- package/dist/index.js.map +1 -0
- package/dist/input.js +22 -0
- package/dist/input.js.map +1 -0
- package/dist/label.js +36 -0
- package/dist/label.js.map +1 -0
- package/dist/layout-wrapper.js +208 -0
- package/dist/layout-wrapper.js.map +1 -0
- package/dist/llms.txt +1140 -0
- package/dist/menu-DBhEanGo.js +16 -0
- package/dist/menu-DBhEanGo.js.map +1 -0
- package/dist/menubar.js +565 -0
- package/dist/menubar.js.map +1 -0
- package/dist/mobile.js +183 -0
- package/dist/mobile.js.map +1 -0
- package/dist/motion.js +119 -0
- package/dist/motion.js.map +1 -0
- package/dist/page-header.js +47 -0
- package/dist/page-header.js.map +1 -0
- package/dist/page.js +214 -0
- package/dist/page.js.map +1 -0
- package/dist/pagination.js +121 -0
- package/dist/pagination.js.map +1 -0
- package/dist/platform.js +194 -0
- package/dist/platform.js.map +1 -0
- package/dist/popover.js +263 -0
- package/dist/popover.js.map +1 -0
- package/dist/popup.js +335 -0
- package/dist/popup.js.map +1 -0
- package/dist/progress.js +108 -0
- package/dist/progress.js.map +1 -0
- package/dist/radio-group.js +272 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/safe-area.js +42 -0
- package/dist/safe-area.js.map +1 -0
- package/dist/search-CpUwRnG-.js +15 -0
- package/dist/search-CpUwRnG-.js.map +1 -0
- package/dist/select.js +985 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.js +45 -0
- package/dist/separator.js.map +1 -0
- package/dist/sheet.js +127 -0
- package/dist/sheet.js.map +1 -0
- package/dist/skeleton.js +16 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/slider.js +485 -0
- package/dist/slider.js.map +1 -0
- package/dist/sonner.js +52 -0
- package/dist/sonner.js.map +1 -0
- package/dist/styles/fonts.css +253 -0
- package/dist/styles.css +2 -0
- package/dist/switch.js +155 -0
- package/dist/switch.js.map +1 -0
- package/dist/tab-bar.js +110 -0
- package/dist/tab-bar.js.map +1 -0
- package/dist/table.js +115 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.js +218 -0
- package/dist/tabs.js.map +1 -0
- package/dist/textarea.js +19 -0
- package/dist/textarea.js.map +1 -0
- package/dist/theme-provider.js +154 -0
- package/dist/theme-provider.js.map +1 -0
- package/dist/themes.js +873 -0
- package/dist/themes.js.map +1 -0
- package/dist/toast.js +63 -0
- package/dist/toast.js.map +1 -0
- package/dist/toggle.js +70 -0
- package/dist/toggle.js.map +1 -0
- package/dist/tooltip.js +375 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/types/App.d.ts +3 -0
- package/dist/types/App.d.ts.map +1 -0
- package/dist/types/components/layouts/admin.d.ts +117 -0
- package/dist/types/components/layouts/admin.d.ts.map +1 -0
- package/dist/types/components/layouts/auth.d.ts +17 -0
- package/dist/types/components/layouts/auth.d.ts.map +1 -0
- package/dist/types/components/layouts/blank.d.ts +63 -0
- package/dist/types/components/layouts/blank.d.ts.map +1 -0
- package/dist/types/components/layouts/layout-wrapper.d.ts +130 -0
- package/dist/types/components/layouts/layout-wrapper.d.ts.map +1 -0
- package/dist/types/components/layouts/mobile.d.ts +91 -0
- package/dist/types/components/layouts/mobile.d.ts.map +1 -0
- package/dist/types/components/layouts/page.d.ts +181 -0
- package/dist/types/components/layouts/page.d.ts.map +1 -0
- package/dist/types/components/layouts/popup.d.ts +100 -0
- package/dist/types/components/layouts/popup.d.ts.map +1 -0
- package/dist/types/components/sections/container.d.ts +79 -0
- package/dist/types/components/sections/container.d.ts.map +1 -0
- package/dist/types/components/sections/footer.d.ts +128 -0
- package/dist/types/components/sections/footer.d.ts.map +1 -0
- package/dist/types/components/sections/header.d.ts +72 -0
- package/dist/types/components/sections/header.d.ts.map +1 -0
- package/dist/types/components/sections/safe-area.d.ts +46 -0
- package/dist/types/components/sections/safe-area.d.ts.map +1 -0
- package/dist/types/components/sections/tab-bar.d.ts +61 -0
- package/dist/types/components/sections/tab-bar.d.ts.map +1 -0
- package/dist/types/components/ui/accordion.d.ts +8 -0
- package/dist/types/components/ui/accordion.d.ts.map +1 -0
- package/dist/types/components/ui/alert.d.ts +10 -0
- package/dist/types/components/ui/alert.d.ts.map +1 -0
- package/dist/types/components/ui/avatar.d.ts +7 -0
- package/dist/types/components/ui/avatar.d.ts.map +1 -0
- package/dist/types/components/ui/badge.d.ts +10 -0
- package/dist/types/components/ui/badge.d.ts.map +1 -0
- package/dist/types/components/ui/breadcrumb.d.ts +12 -0
- package/dist/types/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/types/components/ui/button.d.ts +11 -0
- package/dist/types/components/ui/button.d.ts.map +1 -0
- package/dist/types/components/ui/calendar.d.ts +9 -0
- package/dist/types/components/ui/calendar.d.ts.map +1 -0
- package/dist/types/components/ui/card.d.ts +10 -0
- package/dist/types/components/ui/card.d.ts.map +1 -0
- package/dist/types/components/ui/checkbox.d.ts +5 -0
- package/dist/types/components/ui/checkbox.d.ts.map +1 -0
- package/dist/types/components/ui/collapsible.d.ts +6 -0
- package/dist/types/components/ui/collapsible.d.ts.map +1 -0
- package/dist/types/components/ui/command.d.ts +19 -0
- package/dist/types/components/ui/command.d.ts.map +1 -0
- package/dist/types/components/ui/confirm-dialog.d.ts +72 -0
- package/dist/types/components/ui/confirm-dialog.d.ts.map +1 -0
- package/dist/types/components/ui/data-table.d.ts +211 -0
- package/dist/types/components/ui/data-table.d.ts.map +1 -0
- package/dist/types/components/ui/detail-page.d.ts +119 -0
- package/dist/types/components/ui/detail-page.d.ts.map +1 -0
- package/dist/types/components/ui/dialog.d.ts +16 -0
- package/dist/types/components/ui/dialog.d.ts.map +1 -0
- package/dist/types/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/types/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/types/components/ui/empty-state.d.ts +30 -0
- package/dist/types/components/ui/empty-state.d.ts.map +1 -0
- package/dist/types/components/ui/form-field.d.ts +57 -0
- package/dist/types/components/ui/form-field.d.ts.map +1 -0
- package/dist/types/components/ui/form.d.ts +185 -0
- package/dist/types/components/ui/form.d.ts.map +1 -0
- package/dist/types/components/ui/hover-card.d.ts +7 -0
- package/dist/types/components/ui/hover-card.d.ts.map +1 -0
- package/dist/types/components/ui/input.d.ts +4 -0
- package/dist/types/components/ui/input.d.ts.map +1 -0
- package/dist/types/components/ui/label.d.ts +5 -0
- package/dist/types/components/ui/label.d.ts.map +1 -0
- package/dist/types/components/ui/menubar.d.ts +27 -0
- package/dist/types/components/ui/menubar.d.ts.map +1 -0
- package/dist/types/components/ui/motion.d.ts +130 -0
- package/dist/types/components/ui/motion.d.ts.map +1 -0
- package/dist/types/components/ui/page-header.d.ts +45 -0
- package/dist/types/components/ui/page-header.d.ts.map +1 -0
- package/dist/types/components/ui/pagination.d.ts +14 -0
- package/dist/types/components/ui/pagination.d.ts.map +1 -0
- package/dist/types/components/ui/popover.d.ts +8 -0
- package/dist/types/components/ui/popover.d.ts.map +1 -0
- package/dist/types/components/ui/progress.d.ts +5 -0
- package/dist/types/components/ui/progress.d.ts.map +1 -0
- package/dist/types/components/ui/radio-group.d.ts +6 -0
- package/dist/types/components/ui/radio-group.d.ts.map +1 -0
- package/dist/types/components/ui/select.d.ts +16 -0
- package/dist/types/components/ui/select.d.ts.map +1 -0
- package/dist/types/components/ui/separator.d.ts +5 -0
- package/dist/types/components/ui/separator.d.ts.map +1 -0
- package/dist/types/components/ui/sheet.d.ts +14 -0
- package/dist/types/components/ui/sheet.d.ts.map +1 -0
- package/dist/types/components/ui/skeleton.d.ts +3 -0
- package/dist/types/components/ui/skeleton.d.ts.map +1 -0
- package/dist/types/components/ui/slider.d.ts +5 -0
- package/dist/types/components/ui/slider.d.ts.map +1 -0
- package/dist/types/components/ui/sonner.d.ts +4 -0
- package/dist/types/components/ui/sonner.d.ts.map +1 -0
- package/dist/types/components/ui/switch.d.ts +5 -0
- package/dist/types/components/ui/switch.d.ts.map +1 -0
- package/dist/types/components/ui/table.d.ts +11 -0
- package/dist/types/components/ui/table.d.ts.map +1 -0
- package/dist/types/components/ui/tabs.d.ts +8 -0
- package/dist/types/components/ui/tabs.d.ts.map +1 -0
- package/dist/types/components/ui/textarea.d.ts +4 -0
- package/dist/types/components/ui/textarea.d.ts.map +1 -0
- package/dist/types/components/ui/toast.d.ts +70 -0
- package/dist/types/components/ui/toast.d.ts.map +1 -0
- package/dist/types/components/ui/toggle.d.ts +10 -0
- package/dist/types/components/ui/toggle.d.ts.map +1 -0
- package/dist/types/components/ui/tooltip.d.ts +8 -0
- package/dist/types/components/ui/tooltip.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +14 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/useApi.d.ts +38 -0
- package/dist/types/hooks/useApi.d.ts.map +1 -0
- package/dist/types/hooks/useBreakpoint.d.ts +35 -0
- package/dist/types/hooks/useBreakpoint.d.ts.map +1 -0
- package/dist/types/hooks/useDataTable.d.ts +59 -0
- package/dist/types/hooks/useDataTable.d.ts.map +1 -0
- package/dist/types/hooks/useMediaQuery.d.ts +12 -0
- package/dist/types/hooks/useMediaQuery.d.ts.map +1 -0
- package/dist/types/hooks/useStorage.d.ts +35 -0
- package/dist/types/hooks/useStorage.d.ts.map +1 -0
- package/dist/types/index.d.ts +75 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/errors.d.ts +37 -0
- package/dist/types/lib/errors.d.ts.map +1 -0
- package/dist/types/lib/format.d.ts +80 -0
- package/dist/types/lib/format.d.ts.map +1 -0
- package/dist/types/lib/fouc.d.ts +64 -0
- package/dist/types/lib/fouc.d.ts.map +1 -0
- package/dist/types/lib/platform.d.ts +156 -0
- package/dist/types/lib/platform.d.ts.map +1 -0
- package/dist/types/lib/utils.d.ts +14 -0
- package/dist/types/lib/utils.d.ts.map +1 -0
- package/dist/types/main.d.ts +2 -0
- package/dist/types/main.d.ts.map +1 -0
- package/dist/types/themes/index.d.ts +499 -0
- package/dist/types/themes/index.d.ts.map +1 -0
- package/dist/types/themes/presets/base.d.ts +108 -0
- package/dist/types/themes/presets/base.d.ts.map +1 -0
- package/dist/types/themes/presets/elegant.d.ts +108 -0
- package/dist/types/themes/presets/elegant.d.ts.map +1 -0
- package/dist/types/themes/presets/metro.d.ts +114 -0
- package/dist/types/themes/presets/metro.d.ts.map +1 -0
- package/dist/types/themes/presets/studio.d.ts +115 -0
- package/dist/types/themes/presets/studio.d.ts.map +1 -0
- package/dist/types/themes/presets/vivid.d.ts +115 -0
- package/dist/types/themes/presets/vivid.d.ts.map +1 -0
- package/dist/types/themes/theme-provider.d.ts +122 -0
- package/dist/types/themes/theme-provider.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +813 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/uikit.css +1 -0
- package/dist/useDataTable-CPiBpEg-.js +254 -0
- package/dist/useDataTable-CPiBpEg-.js.map +1 -0
- package/dist/utils-CwJPJKOE.js +2278 -0
- package/dist/utils-CwJPJKOE.js.map +1 -0
- package/dist/utils.js +5 -0
- package/dist/utils.js.map +1 -0
- package/dist/wrapper.js +13 -0
- package/dist/wrapper.js.map +1 -0
- package/dist/x-BxwubQiM.js +15 -0
- package/dist/x-BxwubQiM.js.map +1 -0
- package/examples/README.md +18 -0
- package/examples/button.tsx +16 -0
- package/examples/confirm-dialog.tsx +44 -0
- package/examples/data-table.tsx +35 -0
- package/examples/dialog.tsx +34 -0
- package/examples/empty-state.tsx +13 -0
- package/examples/form-field.tsx +22 -0
- package/examples/format.tsx +19 -0
- package/examples/page-header.tsx +17 -0
- package/examples/skeleton.tsx +12 -0
- package/examples/theme-provider.tsx +33 -0
- package/examples/toast.tsx +32 -0
- package/examples/use-breakpoint.tsx +17 -0
- package/llms.txt +1140 -0
- package/package.json +430 -0
package/dist/form.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sources":["../node_modules/lucide-react/dist/esm/icons/circle-alert.js","../node_modules/lucide-react/dist/esm/icons/circle-check.js","../node_modules/react-hook-form/dist/index.esm.mjs","../src/components/ui/form.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.468.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst CircleAlert = createLucideIcon(\"CircleAlert\", [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"line\", { x1: \"12\", x2: \"12\", y1: \"8\", y2: \"12\", key: \"1pkeuh\" }],\n [\"line\", { x1: \"12\", x2: \"12.01\", y1: \"16\", y2: \"16\", key: \"4dfq90\" }]\n]);\n\nexport { CircleAlert as default };\n//# sourceMappingURL=circle-alert.js.map\n","/**\n * @license lucide-react v0.468.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst CircleCheck = createLucideIcon(\"CircleCheck\", [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"m9 12 2 2 4-4\", key: \"dzmm74\" }]\n]);\n\nexport { CircleCheck as default };\n//# sourceMappingURL=circle-check.js.map\n","import React from 'react';\n\nvar isCheckBoxInput = (element) => element.type === 'checkbox';\n\nvar isDateObject = (value) => value instanceof Date;\n\nvar isNullOrUndefined = (value) => value == null;\n\nconst isObjectType = (value) => typeof value === 'object';\nvar isObject = (value) => !isNullOrUndefined(value) &&\n !Array.isArray(value) &&\n isObjectType(value) &&\n !isDateObject(value);\n\nvar getEventValue = (event) => isObject(event) && event.target\n ? isCheckBoxInput(event.target)\n ? event.target.checked\n : event.target.value\n : event;\n\nvar getNodeParentName = (name) => name.substring(0, name.search(/\\.\\d+(\\.|$)/)) || name;\n\nvar isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));\n\nvar isPlainObject = (tempObject) => {\n const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;\n return (isObject(prototypeCopy) && prototypeCopy.hasOwnProperty('isPrototypeOf'));\n};\n\nvar isWeb = typeof window !== 'undefined' &&\n typeof window.HTMLElement !== 'undefined' &&\n typeof document !== 'undefined';\n\nfunction cloneObject(data) {\n let copy;\n const isArray = Array.isArray(data);\n const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;\n if (data instanceof Date) {\n copy = new Date(data);\n }\n else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&\n (isArray || isObject(data))) {\n copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));\n if (!isArray && !isPlainObject(data)) {\n copy = data;\n }\n else {\n for (const key in data) {\n if (data.hasOwnProperty(key)) {\n copy[key] = cloneObject(data[key]);\n }\n }\n }\n }\n else {\n return data;\n }\n return copy;\n}\n\nvar isKey = (value) => /^\\w*$/.test(value);\n\nvar isUndefined = (val) => val === undefined;\n\nvar compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];\n\nvar stringToPath = (input) => compact(input.replace(/[\"|']|\\]/g, '').split(/\\.|\\[/));\n\nvar get = (object, path, defaultValue) => {\n if (!path || !isObject(object)) {\n return defaultValue;\n }\n const result = (isKey(path) ? [path] : stringToPath(path)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);\n return isUndefined(result) || result === object\n ? isUndefined(object[path])\n ? defaultValue\n : object[path]\n : result;\n};\n\nvar isBoolean = (value) => typeof value === 'boolean';\n\nvar set = (object, path, value) => {\n let index = -1;\n const tempPath = isKey(path) ? [path] : stringToPath(path);\n const length = tempPath.length;\n const lastIndex = length - 1;\n while (++index < length) {\n const key = tempPath[index];\n let newValue = value;\n if (index !== lastIndex) {\n const objValue = object[key];\n newValue =\n isObject(objValue) || Array.isArray(objValue)\n ? objValue\n : !isNaN(+tempPath[index + 1])\n ? []\n : {};\n }\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return;\n }\n object[key] = newValue;\n object = object[key];\n }\n};\n\nconst EVENTS = {\n BLUR: 'blur',\n FOCUS_OUT: 'focusout',\n CHANGE: 'change',\n};\nconst VALIDATION_MODE = {\n onBlur: 'onBlur',\n onChange: 'onChange',\n onSubmit: 'onSubmit',\n onTouched: 'onTouched',\n all: 'all',\n};\nconst INPUT_VALIDATION_RULES = {\n max: 'max',\n min: 'min',\n maxLength: 'maxLength',\n minLength: 'minLength',\n pattern: 'pattern',\n required: 'required',\n validate: 'validate',\n};\n\nconst HookFormContext = React.createContext(null);\nHookFormContext.displayName = 'HookFormContext';\n/**\n * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.\n *\n * @remarks\n * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)\n *\n * @returns return all useForm methods\n *\n * @example\n * ```tsx\n * function App() {\n * const methods = useForm();\n * const onSubmit = data => console.log(data);\n *\n * return (\n * <FormProvider {...methods} >\n * <form onSubmit={methods.handleSubmit(onSubmit)}>\n * <NestedInput />\n * <input type=\"submit\" />\n * </form>\n * </FormProvider>\n * );\n * }\n *\n * function NestedInput() {\n * const { register } = useFormContext(); // retrieve all hook methods\n * return <input {...register(\"test\")} />;\n * }\n * ```\n */\nconst useFormContext = () => React.useContext(HookFormContext);\n/**\n * A provider component that propagates the `useForm` methods to all children components via [React Context](https://reactjs.org/docs/context.html) API. To be used with {@link useFormContext}.\n *\n * @remarks\n * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)\n *\n * @param props - all useForm methods\n *\n * @example\n * ```tsx\n * function App() {\n * const methods = useForm();\n * const onSubmit = data => console.log(data);\n *\n * return (\n * <FormProvider {...methods} >\n * <form onSubmit={methods.handleSubmit(onSubmit)}>\n * <NestedInput />\n * <input type=\"submit\" />\n * </form>\n * </FormProvider>\n * );\n * }\n *\n * function NestedInput() {\n * const { register } = useFormContext(); // retrieve all hook methods\n * return <input {...register(\"test\")} />;\n * }\n * ```\n */\nconst FormProvider = (props) => {\n const { children, ...data } = props;\n return (React.createElement(HookFormContext.Provider, { value: data }, children));\n};\n\nvar getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {\n const result = {\n defaultValues: control._defaultValues,\n };\n for (const key in formState) {\n Object.defineProperty(result, key, {\n get: () => {\n const _key = key;\n if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {\n control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;\n }\n localProxyFormState && (localProxyFormState[_key] = true);\n return formState[_key];\n },\n });\n }\n return result;\n};\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n\n/**\n * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.\n *\n * @remarks\n * [API](https://react-hook-form.com/docs/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly)\n *\n * @param props - include options on specify fields to subscribe. {@link UseFormStateReturn}\n *\n * @example\n * ```tsx\n * function App() {\n * const { register, handleSubmit, control } = useForm({\n * defaultValues: {\n * firstName: \"firstName\"\n * }});\n * const { dirtyFields } = useFormState({\n * control\n * });\n * const onSubmit = (data) => console.log(data);\n *\n * return (\n * <form onSubmit={handleSubmit(onSubmit)}>\n * <input {...register(\"firstName\")} placeholder=\"First Name\" />\n * {dirtyFields.firstName && <p>Field is dirty.</p>}\n * <input type=\"submit\" />\n * </form>\n * );\n * }\n * ```\n */\nfunction useFormState(props) {\n const methods = useFormContext();\n const { control = methods.control, disabled, name, exact } = props || {};\n const [formState, updateFormState] = React.useState(control._formState);\n const _localProxyFormState = React.useRef({\n isDirty: false,\n isLoading: false,\n dirtyFields: false,\n touchedFields: false,\n validatingFields: false,\n isValidating: false,\n isValid: false,\n errors: false,\n });\n useIsomorphicLayoutEffect(() => control._subscribe({\n name,\n formState: _localProxyFormState.current,\n exact,\n callback: (formState) => {\n !disabled &&\n updateFormState({\n ...control._formState,\n ...formState,\n });\n },\n }), [name, disabled, exact]);\n React.useEffect(() => {\n _localProxyFormState.current.isValid && control._setValid(true);\n }, [control]);\n return React.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);\n}\n\nvar isString = (value) => typeof value === 'string';\n\nvar generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {\n if (isString(names)) {\n isGlobal && _names.watch.add(names);\n return get(formValues, names, defaultValue);\n }\n if (Array.isArray(names)) {\n return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName),\n get(formValues, fieldName)));\n }\n isGlobal && (_names.watchAll = true);\n return formValues;\n};\n\nvar isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);\n\nfunction deepEqual(object1, object2, _internal_visited = new WeakSet()) {\n if (isPrimitive(object1) || isPrimitive(object2)) {\n return object1 === object2;\n }\n if (isDateObject(object1) && isDateObject(object2)) {\n return object1.getTime() === object2.getTime();\n }\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n if (keys1.length !== keys2.length) {\n return false;\n }\n if (_internal_visited.has(object1) || _internal_visited.has(object2)) {\n return true;\n }\n _internal_visited.add(object1);\n _internal_visited.add(object2);\n for (const key of keys1) {\n const val1 = object1[key];\n if (!keys2.includes(key)) {\n return false;\n }\n if (key !== 'ref') {\n const val2 = object2[key];\n if ((isDateObject(val1) && isDateObject(val2)) ||\n (isObject(val1) && isObject(val2)) ||\n (Array.isArray(val1) && Array.isArray(val2))\n ? !deepEqual(val1, val2, _internal_visited)\n : val1 !== val2) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * Custom hook to subscribe to field change and isolate re-rendering at the component level.\n *\n * @remarks\n *\n * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)\n *\n * @example\n * ```tsx\n * const { control } = useForm();\n * const values = useWatch({\n * name: \"fieldName\"\n * control,\n * })\n * ```\n */\nfunction useWatch(props) {\n const methods = useFormContext();\n const { control = methods.control, name, defaultValue, disabled, exact, compute, } = props || {};\n const _defaultValue = React.useRef(defaultValue);\n const _compute = React.useRef(compute);\n const _computeFormValues = React.useRef(undefined);\n _compute.current = compute;\n const defaultValueMemo = React.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);\n const [value, updateValue] = React.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);\n useIsomorphicLayoutEffect(() => control._subscribe({\n name,\n formState: {\n values: true,\n },\n exact,\n callback: (formState) => {\n if (!disabled) {\n const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);\n if (_compute.current) {\n const computedFormValues = _compute.current(formValues);\n if (!deepEqual(computedFormValues, _computeFormValues.current)) {\n updateValue(computedFormValues);\n _computeFormValues.current = computedFormValues;\n }\n }\n else {\n updateValue(formValues);\n }\n }\n },\n }), [control, disabled, name, exact]);\n React.useEffect(() => control._removeUnmounted());\n return value;\n}\n\n/**\n * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.\n *\n * @remarks\n * [API](https://react-hook-form.com/docs/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)\n *\n * @param props - the path name to the form field value, and validation rules.\n *\n * @returns field properties, field and form state. {@link UseControllerReturn}\n *\n * @example\n * ```tsx\n * function Input(props) {\n * const { field, fieldState, formState } = useController(props);\n * return (\n * <div>\n * <input {...field} placeholder={props.name} />\n * <p>{fieldState.isTouched && \"Touched\"}</p>\n * <p>{formState.isSubmitted ? \"submitted\" : \"\"}</p>\n * </div>\n * );\n * }\n * ```\n */\nfunction useController(props) {\n const methods = useFormContext();\n const { name, disabled, control = methods.control, shouldUnregister, defaultValue, } = props;\n const isArrayField = isNameInFieldArray(control._names.array, name);\n const defaultValueMemo = React.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);\n const value = useWatch({\n control,\n name,\n defaultValue: defaultValueMemo,\n exact: true,\n });\n const formState = useFormState({\n control,\n name,\n exact: true,\n });\n const _props = React.useRef(props);\n const _registerProps = React.useRef(control.register(name, {\n ...props.rules,\n value,\n ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),\n }));\n _props.current = props;\n const fieldState = React.useMemo(() => Object.defineProperties({}, {\n invalid: {\n enumerable: true,\n get: () => !!get(formState.errors, name),\n },\n isDirty: {\n enumerable: true,\n get: () => !!get(formState.dirtyFields, name),\n },\n isTouched: {\n enumerable: true,\n get: () => !!get(formState.touchedFields, name),\n },\n isValidating: {\n enumerable: true,\n get: () => !!get(formState.validatingFields, name),\n },\n error: {\n enumerable: true,\n get: () => get(formState.errors, name),\n },\n }), [formState, name]);\n const onChange = React.useCallback((event) => _registerProps.current.onChange({\n target: {\n value: getEventValue(event),\n name: name,\n },\n type: EVENTS.CHANGE,\n }), [name]);\n const onBlur = React.useCallback(() => _registerProps.current.onBlur({\n target: {\n value: get(control._formValues, name),\n name: name,\n },\n type: EVENTS.BLUR,\n }), [name, control._formValues]);\n const ref = React.useCallback((elm) => {\n const field = get(control._fields, name);\n if (field && elm) {\n field._f.ref = {\n focus: () => elm.focus && elm.focus(),\n select: () => elm.select && elm.select(),\n setCustomValidity: (message) => elm.setCustomValidity(message),\n reportValidity: () => elm.reportValidity(),\n };\n }\n }, [control._fields, name]);\n const field = React.useMemo(() => ({\n name,\n value,\n ...(isBoolean(disabled) || formState.disabled\n ? { disabled: formState.disabled || disabled }\n : {}),\n onChange,\n onBlur,\n ref,\n }), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);\n React.useEffect(() => {\n const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;\n control.register(name, {\n ..._props.current.rules,\n ...(isBoolean(_props.current.disabled)\n ? { disabled: _props.current.disabled }\n : {}),\n });\n const updateMounted = (name, value) => {\n const field = get(control._fields, name);\n if (field && field._f) {\n field._f.mount = value;\n }\n };\n updateMounted(name, true);\n if (_shouldUnregisterField) {\n const value = cloneObject(get(control._options.defaultValues, name));\n set(control._defaultValues, name, value);\n if (isUndefined(get(control._formValues, name))) {\n set(control._formValues, name, value);\n }\n }\n !isArrayField && control.register(name);\n return () => {\n (isArrayField\n ? _shouldUnregisterField && !control._state.action\n : _shouldUnregisterField)\n ? control.unregister(name)\n : updateMounted(name, false);\n };\n }, [name, control, isArrayField, shouldUnregister]);\n React.useEffect(() => {\n control._setDisabledField({\n disabled,\n name,\n });\n }, [disabled, name, control]);\n return React.useMemo(() => ({\n field,\n formState,\n fieldState,\n }), [field, formState, fieldState]);\n}\n\n/**\n * Component based on `useController` hook to work with controlled component.\n *\n * @remarks\n * [API](https://react-hook-form.com/docs/usecontroller/controller) • [Demo](https://codesandbox.io/s/react-hook-form-v6-controller-ts-jwyzw) • [Video](https://www.youtube.com/watch?v=N2UNk_UCVyA)\n *\n * @param props - the path name to the form field value, and validation rules.\n *\n * @returns provide field handler functions, field and form state.\n *\n * @example\n * ```tsx\n * function App() {\n * const { control } = useForm<FormValues>({\n * defaultValues: {\n * test: \"\"\n * }\n * });\n *\n * return (\n * <form>\n * <Controller\n * control={control}\n * name=\"test\"\n * render={({ field: { onChange, onBlur, value, ref }, formState, fieldState }) => (\n * <>\n * <input\n * onChange={onChange} // send value to hook form\n * onBlur={onBlur} // notify when input is touched\n * value={value} // return updated value\n * ref={ref} // set ref for focus management\n * />\n * <p>{formState.isSubmitted ? \"submitted\" : \"\"}</p>\n * <p>{fieldState.isTouched ? \"touched\" : \"\"}</p>\n * </>\n * )}\n * />\n * </form>\n * );\n * }\n * ```\n */\nconst Controller = (props) => props.render(useController(props));\n\nconst flatten = (obj) => {\n const output = {};\n for (const key of Object.keys(obj)) {\n if (isObjectType(obj[key]) && obj[key] !== null) {\n const nested = flatten(obj[key]);\n for (const nestedKey of Object.keys(nested)) {\n output[`${key}.${nestedKey}`] = nested[nestedKey];\n }\n }\n else {\n output[key] = obj[key];\n }\n }\n return output;\n};\n\nconst POST_REQUEST = 'post';\n/**\n * Form component to manage submission.\n *\n * @param props - to setup submission detail. {@link FormProps}\n *\n * @returns form component or headless render prop.\n *\n * @example\n * ```tsx\n * function App() {\n * const { control, formState: { errors } } = useForm();\n *\n * return (\n * <Form action=\"/api\" control={control}>\n * <input {...register(\"name\")} />\n * <p>{errors?.root?.server && 'Server error'}</p>\n * <button>Submit</button>\n * </Form>\n * );\n * }\n * ```\n */\nfunction Form(props) {\n const methods = useFormContext();\n const [mounted, setMounted] = React.useState(false);\n const { control = methods.control, onSubmit, children, action, method = POST_REQUEST, headers, encType, onError, render, onSuccess, validateStatus, ...rest } = props;\n const submit = async (event) => {\n let hasError = false;\n let type = '';\n await control.handleSubmit(async (data) => {\n const formData = new FormData();\n let formDataJson = '';\n try {\n formDataJson = JSON.stringify(data);\n }\n catch (_a) { }\n const flattenFormValues = flatten(control._formValues);\n for (const key in flattenFormValues) {\n formData.append(key, flattenFormValues[key]);\n }\n if (onSubmit) {\n await onSubmit({\n data,\n event,\n method,\n formData,\n formDataJson,\n });\n }\n if (action) {\n try {\n const shouldStringifySubmissionData = [\n headers && headers['Content-Type'],\n encType,\n ].some((value) => value && value.includes('json'));\n const response = await fetch(String(action), {\n method,\n headers: {\n ...headers,\n ...(encType && encType !== 'multipart/form-data'\n ? { 'Content-Type': encType }\n : {}),\n },\n body: shouldStringifySubmissionData ? formDataJson : formData,\n });\n if (response &&\n (validateStatus\n ? !validateStatus(response.status)\n : response.status < 200 || response.status >= 300)) {\n hasError = true;\n onError && onError({ response });\n type = String(response.status);\n }\n else {\n onSuccess && onSuccess({ response });\n }\n }\n catch (error) {\n hasError = true;\n onError && onError({ error });\n }\n }\n })(event);\n if (hasError && props.control) {\n props.control._subjects.state.next({\n isSubmitSuccessful: false,\n });\n props.control.setError('root.server', {\n type,\n });\n }\n };\n React.useEffect(() => {\n setMounted(true);\n }, []);\n return render ? (React.createElement(React.Fragment, null, render({\n submit,\n }))) : (React.createElement(\"form\", { noValidate: mounted, action: action, method: method, encType: encType, onSubmit: submit, ...rest }, children));\n}\n\nvar appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria\n ? {\n ...errors[name],\n types: {\n ...(errors[name] && errors[name].types ? errors[name].types : {}),\n [type]: message || true,\n },\n }\n : {};\n\nvar convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);\n\nvar createSubject = () => {\n let _observers = [];\n const next = (value) => {\n for (const observer of _observers) {\n observer.next && observer.next(value);\n }\n };\n const subscribe = (observer) => {\n _observers.push(observer);\n return {\n unsubscribe: () => {\n _observers = _observers.filter((o) => o !== observer);\n },\n };\n };\n const unsubscribe = () => {\n _observers = [];\n };\n return {\n get observers() {\n return _observers;\n },\n next,\n subscribe,\n unsubscribe,\n };\n};\n\nvar isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;\n\nvar isFileInput = (element) => element.type === 'file';\n\nvar isFunction = (value) => typeof value === 'function';\n\nvar isHTMLElement = (value) => {\n if (!isWeb) {\n return false;\n }\n const owner = value ? value.ownerDocument : 0;\n return (value instanceof\n (owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement));\n};\n\nvar isMultipleSelect = (element) => element.type === `select-multiple`;\n\nvar isRadioInput = (element) => element.type === 'radio';\n\nvar isRadioOrCheckbox = (ref) => isRadioInput(ref) || isCheckBoxInput(ref);\n\nvar live = (ref) => isHTMLElement(ref) && ref.isConnected;\n\nfunction baseGet(object, updatePath) {\n const length = updatePath.slice(0, -1).length;\n let index = 0;\n while (index < length) {\n object = isUndefined(object) ? index++ : object[updatePath[index++]];\n }\n return object;\n}\nfunction isEmptyArray(obj) {\n for (const key in obj) {\n if (obj.hasOwnProperty(key) && !isUndefined(obj[key])) {\n return false;\n }\n }\n return true;\n}\nfunction unset(object, path) {\n const paths = Array.isArray(path)\n ? path\n : isKey(path)\n ? [path]\n : stringToPath(path);\n const childObject = paths.length === 1 ? object : baseGet(object, paths);\n const index = paths.length - 1;\n const key = paths[index];\n if (childObject) {\n delete childObject[key];\n }\n if (index !== 0 &&\n ((isObject(childObject) && isEmptyObject(childObject)) ||\n (Array.isArray(childObject) && isEmptyArray(childObject)))) {\n unset(object, paths.slice(0, -1));\n }\n return object;\n}\n\nvar objectHasFunction = (data) => {\n for (const key in data) {\n if (isFunction(data[key])) {\n return true;\n }\n }\n return false;\n};\n\nfunction markFieldsDirty(data, fields = {}) {\n const isParentNodeArray = Array.isArray(data);\n if (isObject(data) || isParentNodeArray) {\n for (const key in data) {\n if (Array.isArray(data[key]) ||\n (isObject(data[key]) && !objectHasFunction(data[key]))) {\n fields[key] = Array.isArray(data[key]) ? [] : {};\n markFieldsDirty(data[key], fields[key]);\n }\n else if (!isNullOrUndefined(data[key])) {\n fields[key] = true;\n }\n }\n }\n return fields;\n}\nfunction getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues) {\n const isParentNodeArray = Array.isArray(data);\n if (isObject(data) || isParentNodeArray) {\n for (const key in data) {\n if (Array.isArray(data[key]) ||\n (isObject(data[key]) && !objectHasFunction(data[key]))) {\n if (isUndefined(formValues) ||\n isPrimitive(dirtyFieldsFromValues[key])) {\n dirtyFieldsFromValues[key] = Array.isArray(data[key])\n ? markFieldsDirty(data[key], [])\n : { ...markFieldsDirty(data[key]) };\n }\n else {\n getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);\n }\n }\n else {\n dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);\n }\n }\n }\n return dirtyFieldsFromValues;\n}\nvar getDirtyFields = (defaultValues, formValues) => getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));\n\nconst defaultResult = {\n value: false,\n isValid: false,\n};\nconst validResult = { value: true, isValid: true };\nvar getCheckboxValue = (options) => {\n if (Array.isArray(options)) {\n if (options.length > 1) {\n const values = options\n .filter((option) => option && option.checked && !option.disabled)\n .map((option) => option.value);\n return { value: values, isValid: !!values.length };\n }\n return options[0].checked && !options[0].disabled\n ? // @ts-expect-error expected to work in the browser\n options[0].attributes && !isUndefined(options[0].attributes.value)\n ? isUndefined(options[0].value) || options[0].value === ''\n ? validResult\n : { value: options[0].value, isValid: true }\n : validResult\n : defaultResult;\n }\n return defaultResult;\n};\n\nvar getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => isUndefined(value)\n ? value\n : valueAsNumber\n ? value === ''\n ? NaN\n : value\n ? +value\n : value\n : valueAsDate && isString(value)\n ? new Date(value)\n : setValueAs\n ? setValueAs(value)\n : value;\n\nconst defaultReturn = {\n isValid: false,\n value: null,\n};\nvar getRadioValue = (options) => Array.isArray(options)\n ? options.reduce((previous, option) => option && option.checked && !option.disabled\n ? {\n isValid: true,\n value: option.value,\n }\n : previous, defaultReturn)\n : defaultReturn;\n\nfunction getFieldValue(_f) {\n const ref = _f.ref;\n if (isFileInput(ref)) {\n return ref.files;\n }\n if (isRadioInput(ref)) {\n return getRadioValue(_f.refs).value;\n }\n if (isMultipleSelect(ref)) {\n return [...ref.selectedOptions].map(({ value }) => value);\n }\n if (isCheckBoxInput(ref)) {\n return getCheckboxValue(_f.refs).value;\n }\n return getFieldValueAs(isUndefined(ref.value) ? _f.ref.value : ref.value, _f);\n}\n\nvar getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {\n const fields = {};\n for (const name of fieldsNames) {\n const field = get(_fields, name);\n field && set(fields, name, field._f);\n }\n return {\n criteriaMode,\n names: [...fieldsNames],\n fields,\n shouldUseNativeValidation,\n };\n};\n\nvar isRegex = (value) => value instanceof RegExp;\n\nvar getRuleValue = (rule) => isUndefined(rule)\n ? rule\n : isRegex(rule)\n ? rule.source\n : isObject(rule)\n ? isRegex(rule.value)\n ? rule.value.source\n : rule.value\n : rule;\n\nvar getValidationModes = (mode) => ({\n isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,\n isOnBlur: mode === VALIDATION_MODE.onBlur,\n isOnChange: mode === VALIDATION_MODE.onChange,\n isOnAll: mode === VALIDATION_MODE.all,\n isOnTouch: mode === VALIDATION_MODE.onTouched,\n});\n\nconst ASYNC_FUNCTION = 'AsyncFunction';\nvar hasPromiseValidation = (fieldReference) => !!fieldReference &&\n !!fieldReference.validate &&\n !!((isFunction(fieldReference.validate) &&\n fieldReference.validate.constructor.name === ASYNC_FUNCTION) ||\n (isObject(fieldReference.validate) &&\n Object.values(fieldReference.validate).find((validateFunction) => validateFunction.constructor.name === ASYNC_FUNCTION)));\n\nvar hasValidation = (options) => options.mount &&\n (options.required ||\n options.min ||\n options.max ||\n options.maxLength ||\n options.minLength ||\n options.pattern ||\n options.validate);\n\nvar isWatched = (name, _names, isBlurEvent) => !isBlurEvent &&\n (_names.watchAll ||\n _names.watch.has(name) ||\n [..._names.watch].some((watchName) => name.startsWith(watchName) &&\n /^\\.\\w+/.test(name.slice(watchName.length))));\n\nconst iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {\n for (const key of fieldsNames || Object.keys(fields)) {\n const field = get(fields, key);\n if (field) {\n const { _f, ...currentField } = field;\n if (_f) {\n if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {\n return true;\n }\n else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {\n return true;\n }\n else {\n if (iterateFieldsByAction(currentField, action)) {\n break;\n }\n }\n }\n else if (isObject(currentField)) {\n if (iterateFieldsByAction(currentField, action)) {\n break;\n }\n }\n }\n }\n return;\n};\n\nfunction schemaErrorLookup(errors, _fields, name) {\n const error = get(errors, name);\n if (error || isKey(name)) {\n return {\n error,\n name,\n };\n }\n const names = name.split('.');\n while (names.length) {\n const fieldName = names.join('.');\n const field = get(_fields, fieldName);\n const foundError = get(errors, fieldName);\n if (field && !Array.isArray(field) && name !== fieldName) {\n return { name };\n }\n if (foundError && foundError.type) {\n return {\n name: fieldName,\n error: foundError,\n };\n }\n if (foundError && foundError.root && foundError.root.type) {\n return {\n name: `${fieldName}.root`,\n error: foundError.root,\n };\n }\n names.pop();\n }\n return {\n name,\n };\n}\n\nvar shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {\n updateFormState(formStateData);\n const { name, ...formState } = formStateData;\n return (isEmptyObject(formState) ||\n Object.keys(formState).length >= Object.keys(_proxyFormState).length ||\n Object.keys(formState).find((key) => _proxyFormState[key] ===\n (!isRoot || VALIDATION_MODE.all)));\n};\n\nvar shouldSubscribeByName = (name, signalName, exact) => !name ||\n !signalName ||\n name === signalName ||\n convertToArrayPayload(name).some((currentName) => currentName &&\n (exact\n ? currentName === signalName\n : currentName.startsWith(signalName) ||\n signalName.startsWith(currentName)));\n\nvar skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {\n if (mode.isOnAll) {\n return false;\n }\n else if (!isSubmitted && mode.isOnTouch) {\n return !(isTouched || isBlurEvent);\n }\n else if (isSubmitted ? reValidateMode.isOnBlur : mode.isOnBlur) {\n return !isBlurEvent;\n }\n else if (isSubmitted ? reValidateMode.isOnChange : mode.isOnChange) {\n return isBlurEvent;\n }\n return true;\n};\n\nvar unsetEmptyArray = (ref, name) => !compact(get(ref, name)).length && unset(ref, name);\n\nvar updateFieldArrayRootError = (errors, error, name) => {\n const fieldArrayErrors = convertToArrayPayload(get(errors, name));\n set(fieldArrayErrors, 'root', error[name]);\n set(errors, name, fieldArrayErrors);\n return errors;\n};\n\nvar isMessage = (value) => isString(value);\n\nfunction getValidateError(result, ref, type = 'validate') {\n if (isMessage(result) ||\n (Array.isArray(result) && result.every(isMessage)) ||\n (isBoolean(result) && !result)) {\n return {\n type,\n message: isMessage(result) ? result : '',\n ref,\n };\n }\n}\n\nvar getValueAndMessage = (validationData) => isObject(validationData) && !isRegex(validationData)\n ? validationData\n : {\n value: validationData,\n message: '',\n };\n\nvar validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {\n const { ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, } = field._f;\n const inputValue = get(formValues, name);\n if (!mount || disabledFieldNames.has(name)) {\n return {};\n }\n const inputRef = refs ? refs[0] : ref;\n const setCustomValidity = (message) => {\n if (shouldUseNativeValidation && inputRef.reportValidity) {\n inputRef.setCustomValidity(isBoolean(message) ? '' : message || '');\n inputRef.reportValidity();\n }\n };\n const error = {};\n const isRadio = isRadioInput(ref);\n const isCheckBox = isCheckBoxInput(ref);\n const isRadioOrCheckbox = isRadio || isCheckBox;\n const isEmpty = ((valueAsNumber || isFileInput(ref)) &&\n isUndefined(ref.value) &&\n isUndefined(inputValue)) ||\n (isHTMLElement(ref) && ref.value === '') ||\n inputValue === '' ||\n (Array.isArray(inputValue) && !inputValue.length);\n const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);\n const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {\n const message = exceedMax ? maxLengthMessage : minLengthMessage;\n error[name] = {\n type: exceedMax ? maxType : minType,\n message,\n ref,\n ...appendErrorsCurry(exceedMax ? maxType : minType, message),\n };\n };\n if (isFieldArray\n ? !Array.isArray(inputValue) || !inputValue.length\n : required &&\n ((!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue))) ||\n (isBoolean(inputValue) && !inputValue) ||\n (isCheckBox && !getCheckboxValue(refs).isValid) ||\n (isRadio && !getRadioValue(refs).isValid))) {\n const { value, message } = isMessage(required)\n ? { value: !!required, message: required }\n : getValueAndMessage(required);\n if (value) {\n error[name] = {\n type: INPUT_VALIDATION_RULES.required,\n message,\n ref: inputRef,\n ...appendErrorsCurry(INPUT_VALIDATION_RULES.required, message),\n };\n if (!validateAllFieldCriteria) {\n setCustomValidity(message);\n return error;\n }\n }\n }\n if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) {\n let exceedMax;\n let exceedMin;\n const maxOutput = getValueAndMessage(max);\n const minOutput = getValueAndMessage(min);\n if (!isNullOrUndefined(inputValue) && !isNaN(inputValue)) {\n const valueNumber = ref.valueAsNumber ||\n (inputValue ? +inputValue : inputValue);\n if (!isNullOrUndefined(maxOutput.value)) {\n exceedMax = valueNumber > maxOutput.value;\n }\n if (!isNullOrUndefined(minOutput.value)) {\n exceedMin = valueNumber < minOutput.value;\n }\n }\n else {\n const valueDate = ref.valueAsDate || new Date(inputValue);\n const convertTimeToDate = (time) => new Date(new Date().toDateString() + ' ' + time);\n const isTime = ref.type == 'time';\n const isWeek = ref.type == 'week';\n if (isString(maxOutput.value) && inputValue) {\n exceedMax = isTime\n ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value)\n : isWeek\n ? inputValue > maxOutput.value\n : valueDate > new Date(maxOutput.value);\n }\n if (isString(minOutput.value) && inputValue) {\n exceedMin = isTime\n ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value)\n : isWeek\n ? inputValue < minOutput.value\n : valueDate < new Date(minOutput.value);\n }\n }\n if (exceedMax || exceedMin) {\n getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);\n if (!validateAllFieldCriteria) {\n setCustomValidity(error[name].message);\n return error;\n }\n }\n }\n if ((maxLength || minLength) &&\n !isEmpty &&\n (isString(inputValue) || (isFieldArray && Array.isArray(inputValue)))) {\n const maxLengthOutput = getValueAndMessage(maxLength);\n const minLengthOutput = getValueAndMessage(minLength);\n const exceedMax = !isNullOrUndefined(maxLengthOutput.value) &&\n inputValue.length > +maxLengthOutput.value;\n const exceedMin = !isNullOrUndefined(minLengthOutput.value) &&\n inputValue.length < +minLengthOutput.value;\n if (exceedMax || exceedMin) {\n getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);\n if (!validateAllFieldCriteria) {\n setCustomValidity(error[name].message);\n return error;\n }\n }\n }\n if (pattern && !isEmpty && isString(inputValue)) {\n const { value: patternValue, message } = getValueAndMessage(pattern);\n if (isRegex(patternValue) && !inputValue.match(patternValue)) {\n error[name] = {\n type: INPUT_VALIDATION_RULES.pattern,\n message,\n ref,\n ...appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message),\n };\n if (!validateAllFieldCriteria) {\n setCustomValidity(message);\n return error;\n }\n }\n }\n if (validate) {\n if (isFunction(validate)) {\n const result = await validate(inputValue, formValues);\n const validateError = getValidateError(result, inputRef);\n if (validateError) {\n error[name] = {\n ...validateError,\n ...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message),\n };\n if (!validateAllFieldCriteria) {\n setCustomValidity(validateError.message);\n return error;\n }\n }\n }\n else if (isObject(validate)) {\n let validationResult = {};\n for (const key in validate) {\n if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {\n break;\n }\n const validateError = getValidateError(await validate[key](inputValue, formValues), inputRef, key);\n if (validateError) {\n validationResult = {\n ...validateError,\n ...appendErrorsCurry(key, validateError.message),\n };\n setCustomValidity(validateError.message);\n if (validateAllFieldCriteria) {\n error[name] = validationResult;\n }\n }\n }\n if (!isEmptyObject(validationResult)) {\n error[name] = {\n ref: inputRef,\n ...validationResult,\n };\n if (!validateAllFieldCriteria) {\n return error;\n }\n }\n }\n }\n setCustomValidity(true);\n return error;\n};\n\nconst defaultOptions = {\n mode: VALIDATION_MODE.onSubmit,\n reValidateMode: VALIDATION_MODE.onChange,\n shouldFocusError: true,\n};\nfunction createFormControl(props = {}) {\n let _options = {\n ...defaultOptions,\n ...props,\n };\n let _formState = {\n submitCount: 0,\n isDirty: false,\n isReady: false,\n isLoading: isFunction(_options.defaultValues),\n isValidating: false,\n isSubmitted: false,\n isSubmitting: false,\n isSubmitSuccessful: false,\n isValid: false,\n touchedFields: {},\n dirtyFields: {},\n validatingFields: {},\n errors: _options.errors || {},\n disabled: _options.disabled || false,\n };\n let _fields = {};\n let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values)\n ? cloneObject(_options.defaultValues || _options.values) || {}\n : {};\n let _formValues = _options.shouldUnregister\n ? {}\n : cloneObject(_defaultValues);\n let _state = {\n action: false,\n mount: false,\n watch: false,\n };\n let _names = {\n mount: new Set(),\n disabled: new Set(),\n unMount: new Set(),\n array: new Set(),\n watch: new Set(),\n };\n let delayErrorCallback;\n let timer = 0;\n const _proxyFormState = {\n isDirty: false,\n dirtyFields: false,\n validatingFields: false,\n touchedFields: false,\n isValidating: false,\n isValid: false,\n errors: false,\n };\n let _proxySubscribeFormState = {\n ..._proxyFormState,\n };\n const _subjects = {\n array: createSubject(),\n state: createSubject(),\n };\n const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;\n const debounce = (callback) => (wait) => {\n clearTimeout(timer);\n timer = setTimeout(callback, wait);\n };\n const _setValid = async (shouldUpdateValid) => {\n if (!_options.disabled &&\n (_proxyFormState.isValid ||\n _proxySubscribeFormState.isValid ||\n shouldUpdateValid)) {\n const isValid = _options.resolver\n ? isEmptyObject((await _runSchema()).errors)\n : await executeBuiltInValidation(_fields, true);\n if (isValid !== _formState.isValid) {\n _subjects.state.next({\n isValid,\n });\n }\n }\n };\n const _updateIsValidating = (names, isValidating) => {\n if (!_options.disabled &&\n (_proxyFormState.isValidating ||\n _proxyFormState.validatingFields ||\n _proxySubscribeFormState.isValidating ||\n _proxySubscribeFormState.validatingFields)) {\n (names || Array.from(_names.mount)).forEach((name) => {\n if (name) {\n isValidating\n ? set(_formState.validatingFields, name, isValidating)\n : unset(_formState.validatingFields, name);\n }\n });\n _subjects.state.next({\n validatingFields: _formState.validatingFields,\n isValidating: !isEmptyObject(_formState.validatingFields),\n });\n }\n };\n const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {\n if (args && method && !_options.disabled) {\n _state.action = true;\n if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {\n const fieldValues = method(get(_fields, name), args.argA, args.argB);\n shouldSetValues && set(_fields, name, fieldValues);\n }\n if (shouldUpdateFieldsAndState &&\n Array.isArray(get(_formState.errors, name))) {\n const errors = method(get(_formState.errors, name), args.argA, args.argB);\n shouldSetValues && set(_formState.errors, name, errors);\n unsetEmptyArray(_formState.errors, name);\n }\n if ((_proxyFormState.touchedFields ||\n _proxySubscribeFormState.touchedFields) &&\n shouldUpdateFieldsAndState &&\n Array.isArray(get(_formState.touchedFields, name))) {\n const touchedFields = method(get(_formState.touchedFields, name), args.argA, args.argB);\n shouldSetValues && set(_formState.touchedFields, name, touchedFields);\n }\n if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {\n _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);\n }\n _subjects.state.next({\n name,\n isDirty: _getDirty(name, values),\n dirtyFields: _formState.dirtyFields,\n errors: _formState.errors,\n isValid: _formState.isValid,\n });\n }\n else {\n set(_formValues, name, values);\n }\n };\n const updateErrors = (name, error) => {\n set(_formState.errors, name, error);\n _subjects.state.next({\n errors: _formState.errors,\n });\n };\n const _setErrors = (errors) => {\n _formState.errors = errors;\n _subjects.state.next({\n errors: _formState.errors,\n isValid: false,\n });\n };\n const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {\n const field = get(_fields, name);\n if (field) {\n const defaultValue = get(_formValues, name, isUndefined(value) ? get(_defaultValues, name) : value);\n isUndefined(defaultValue) ||\n (ref && ref.defaultChecked) ||\n shouldSkipSetValueAs\n ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f))\n : setFieldValue(name, defaultValue);\n _state.mount && _setValid();\n }\n };\n const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {\n let shouldUpdateField = false;\n let isPreviousDirty = false;\n const output = {\n name,\n };\n if (!_options.disabled) {\n if (!isBlurEvent || shouldDirty) {\n if (_proxyFormState.isDirty || _proxySubscribeFormState.isDirty) {\n isPreviousDirty = _formState.isDirty;\n _formState.isDirty = output.isDirty = _getDirty();\n shouldUpdateField = isPreviousDirty !== output.isDirty;\n }\n const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);\n isPreviousDirty = !!get(_formState.dirtyFields, name);\n isCurrentFieldPristine\n ? unset(_formState.dirtyFields, name)\n : set(_formState.dirtyFields, name, true);\n output.dirtyFields = _formState.dirtyFields;\n shouldUpdateField =\n shouldUpdateField ||\n ((_proxyFormState.dirtyFields ||\n _proxySubscribeFormState.dirtyFields) &&\n isPreviousDirty !== !isCurrentFieldPristine);\n }\n if (isBlurEvent) {\n const isPreviousFieldTouched = get(_formState.touchedFields, name);\n if (!isPreviousFieldTouched) {\n set(_formState.touchedFields, name, isBlurEvent);\n output.touchedFields = _formState.touchedFields;\n shouldUpdateField =\n shouldUpdateField ||\n ((_proxyFormState.touchedFields ||\n _proxySubscribeFormState.touchedFields) &&\n isPreviousFieldTouched !== isBlurEvent);\n }\n }\n shouldUpdateField && shouldRender && _subjects.state.next(output);\n }\n return shouldUpdateField ? output : {};\n };\n const shouldRenderByError = (name, isValid, error, fieldState) => {\n const previousFieldError = get(_formState.errors, name);\n const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) &&\n isBoolean(isValid) &&\n _formState.isValid !== isValid;\n if (_options.delayError && error) {\n delayErrorCallback = debounce(() => updateErrors(name, error));\n delayErrorCallback(_options.delayError);\n }\n else {\n clearTimeout(timer);\n delayErrorCallback = null;\n error\n ? set(_formState.errors, name, error)\n : unset(_formState.errors, name);\n }\n if ((error ? !deepEqual(previousFieldError, error) : previousFieldError) ||\n !isEmptyObject(fieldState) ||\n shouldUpdateValid) {\n const updatedFormState = {\n ...fieldState,\n ...(shouldUpdateValid && isBoolean(isValid) ? { isValid } : {}),\n errors: _formState.errors,\n name,\n };\n _formState = {\n ..._formState,\n ...updatedFormState,\n };\n _subjects.state.next(updatedFormState);\n }\n };\n const _runSchema = async (name) => {\n _updateIsValidating(name, true);\n const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));\n _updateIsValidating(name);\n return result;\n };\n const executeSchemaAndUpdateState = async (names) => {\n const { errors } = await _runSchema(names);\n if (names) {\n for (const name of names) {\n const error = get(errors, name);\n error\n ? set(_formState.errors, name, error)\n : unset(_formState.errors, name);\n }\n }\n else {\n _formState.errors = errors;\n }\n return errors;\n };\n const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {\n valid: true,\n }) => {\n for (const name in fields) {\n const field = fields[name];\n if (field) {\n const { _f, ...fieldValue } = field;\n if (_f) {\n const isFieldArrayRoot = _names.array.has(_f.name);\n const isPromiseFunction = field._f && hasPromiseValidation(field._f);\n if (isPromiseFunction && _proxyFormState.validatingFields) {\n _updateIsValidating([name], true);\n }\n const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);\n if (isPromiseFunction && _proxyFormState.validatingFields) {\n _updateIsValidating([name]);\n }\n if (fieldError[_f.name]) {\n context.valid = false;\n if (shouldOnlyCheckValid) {\n break;\n }\n }\n !shouldOnlyCheckValid &&\n (get(fieldError, _f.name)\n ? isFieldArrayRoot\n ? updateFieldArrayRootError(_formState.errors, fieldError, _f.name)\n : set(_formState.errors, _f.name, fieldError[_f.name])\n : unset(_formState.errors, _f.name));\n }\n !isEmptyObject(fieldValue) &&\n (await executeBuiltInValidation(fieldValue, shouldOnlyCheckValid, context));\n }\n }\n return context.valid;\n };\n const _removeUnmounted = () => {\n for (const name of _names.unMount) {\n const field = get(_fields, name);\n field &&\n (field._f.refs\n ? field._f.refs.every((ref) => !live(ref))\n : !live(field._f.ref)) &&\n unregister(name);\n }\n _names.unMount = new Set();\n };\n const _getDirty = (name, data) => !_options.disabled &&\n (name && data && set(_formValues, name, data),\n !deepEqual(getValues(), _defaultValues));\n const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {\n ...(_state.mount\n ? _formValues\n : isUndefined(defaultValue)\n ? _defaultValues\n : isString(names)\n ? { [names]: defaultValue }\n : defaultValue),\n }, isGlobal, defaultValue);\n const _getFieldArray = (name) => compact(get(_state.mount ? _formValues : _defaultValues, name, _options.shouldUnregister ? get(_defaultValues, name, []) : []));\n const setFieldValue = (name, value, options = {}) => {\n const field = get(_fields, name);\n let fieldValue = value;\n if (field) {\n const fieldReference = field._f;\n if (fieldReference) {\n !fieldReference.disabled &&\n set(_formValues, name, getFieldValueAs(value, fieldReference));\n fieldValue =\n isHTMLElement(fieldReference.ref) && isNullOrUndefined(value)\n ? ''\n : value;\n if (isMultipleSelect(fieldReference.ref)) {\n [...fieldReference.ref.options].forEach((optionRef) => (optionRef.selected = fieldValue.includes(optionRef.value)));\n }\n else if (fieldReference.refs) {\n if (isCheckBoxInput(fieldReference.ref)) {\n fieldReference.refs.forEach((checkboxRef) => {\n if (!checkboxRef.defaultChecked || !checkboxRef.disabled) {\n if (Array.isArray(fieldValue)) {\n checkboxRef.checked = !!fieldValue.find((data) => data === checkboxRef.value);\n }\n else {\n checkboxRef.checked =\n fieldValue === checkboxRef.value || !!fieldValue;\n }\n }\n });\n }\n else {\n fieldReference.refs.forEach((radioRef) => (radioRef.checked = radioRef.value === fieldValue));\n }\n }\n else if (isFileInput(fieldReference.ref)) {\n fieldReference.ref.value = '';\n }\n else {\n fieldReference.ref.value = fieldValue;\n if (!fieldReference.ref.type) {\n _subjects.state.next({\n name,\n values: cloneObject(_formValues),\n });\n }\n }\n }\n }\n (options.shouldDirty || options.shouldTouch) &&\n updateTouchAndDirty(name, fieldValue, options.shouldTouch, options.shouldDirty, true);\n options.shouldValidate && trigger(name);\n };\n const setValues = (name, value, options) => {\n for (const fieldKey in value) {\n if (!value.hasOwnProperty(fieldKey)) {\n return;\n }\n const fieldValue = value[fieldKey];\n const fieldName = name + '.' + fieldKey;\n const field = get(_fields, fieldName);\n (_names.array.has(name) ||\n isObject(fieldValue) ||\n (field && !field._f)) &&\n !isDateObject(fieldValue)\n ? setValues(fieldName, fieldValue, options)\n : setFieldValue(fieldName, fieldValue, options);\n }\n };\n const setValue = (name, value, options = {}) => {\n const field = get(_fields, name);\n const isFieldArray = _names.array.has(name);\n const cloneValue = cloneObject(value);\n set(_formValues, name, cloneValue);\n if (isFieldArray) {\n _subjects.array.next({\n name,\n values: cloneObject(_formValues),\n });\n if ((_proxyFormState.isDirty ||\n _proxyFormState.dirtyFields ||\n _proxySubscribeFormState.isDirty ||\n _proxySubscribeFormState.dirtyFields) &&\n options.shouldDirty) {\n _subjects.state.next({\n name,\n dirtyFields: getDirtyFields(_defaultValues, _formValues),\n isDirty: _getDirty(name, cloneValue),\n });\n }\n }\n else {\n field && !field._f && !isNullOrUndefined(cloneValue)\n ? setValues(name, cloneValue, options)\n : setFieldValue(name, cloneValue, options);\n }\n isWatched(name, _names) && _subjects.state.next({ ..._formState, name });\n _subjects.state.next({\n name: _state.mount ? name : undefined,\n values: cloneObject(_formValues),\n });\n };\n const onChange = async (event) => {\n _state.mount = true;\n const target = event.target;\n let name = target.name;\n let isFieldValueUpdated = true;\n const field = get(_fields, name);\n const _updateIsFieldValueUpdated = (fieldValue) => {\n isFieldValueUpdated =\n Number.isNaN(fieldValue) ||\n (isDateObject(fieldValue) && isNaN(fieldValue.getTime())) ||\n deepEqual(fieldValue, get(_formValues, name, fieldValue));\n };\n const validationModeBeforeSubmit = getValidationModes(_options.mode);\n const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);\n if (field) {\n let error;\n let isValid;\n const fieldValue = target.type\n ? getFieldValue(field._f)\n : getEventValue(event);\n const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;\n const shouldSkipValidation = (!hasValidation(field._f) &&\n !_options.resolver &&\n !get(_formState.errors, name) &&\n !field._f.deps) ||\n skipValidation(isBlurEvent, get(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);\n const watched = isWatched(name, _names, isBlurEvent);\n set(_formValues, name, fieldValue);\n if (isBlurEvent) {\n if (!target || !target.readOnly) {\n field._f.onBlur && field._f.onBlur(event);\n delayErrorCallback && delayErrorCallback(0);\n }\n }\n else if (field._f.onChange) {\n field._f.onChange(event);\n }\n const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);\n const shouldRender = !isEmptyObject(fieldState) || watched;\n !isBlurEvent &&\n _subjects.state.next({\n name,\n type: event.type,\n values: cloneObject(_formValues),\n });\n if (shouldSkipValidation) {\n if (_proxyFormState.isValid || _proxySubscribeFormState.isValid) {\n if (_options.mode === 'onBlur') {\n if (isBlurEvent) {\n _setValid();\n }\n }\n else if (!isBlurEvent) {\n _setValid();\n }\n }\n return (shouldRender &&\n _subjects.state.next({ name, ...(watched ? {} : fieldState) }));\n }\n !isBlurEvent && watched && _subjects.state.next({ ..._formState });\n if (_options.resolver) {\n const { errors } = await _runSchema([name]);\n _updateIsFieldValueUpdated(fieldValue);\n if (isFieldValueUpdated) {\n const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);\n const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);\n error = errorLookupResult.error;\n name = errorLookupResult.name;\n isValid = isEmptyObject(errors);\n }\n }\n else {\n _updateIsValidating([name], true);\n error = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];\n _updateIsValidating([name]);\n _updateIsFieldValueUpdated(fieldValue);\n if (isFieldValueUpdated) {\n if (error) {\n isValid = false;\n }\n else if (_proxyFormState.isValid ||\n _proxySubscribeFormState.isValid) {\n isValid = await executeBuiltInValidation(_fields, true);\n }\n }\n }\n if (isFieldValueUpdated) {\n field._f.deps &&\n trigger(field._f.deps);\n shouldRenderByError(name, isValid, error, fieldState);\n }\n }\n };\n const _focusInput = (ref, key) => {\n if (get(_formState.errors, key) && ref.focus) {\n ref.focus();\n return 1;\n }\n return;\n };\n const trigger = async (name, options = {}) => {\n let isValid;\n let validationResult;\n const fieldNames = convertToArrayPayload(name);\n if (_options.resolver) {\n const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);\n isValid = isEmptyObject(errors);\n validationResult = name\n ? !fieldNames.some((name) => get(errors, name))\n : isValid;\n }\n else if (name) {\n validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {\n const field = get(_fields, fieldName);\n return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);\n }))).every(Boolean);\n !(!validationResult && !_formState.isValid) && _setValid();\n }\n else {\n validationResult = isValid = await executeBuiltInValidation(_fields);\n }\n _subjects.state.next({\n ...(!isString(name) ||\n ((_proxyFormState.isValid || _proxySubscribeFormState.isValid) &&\n isValid !== _formState.isValid)\n ? {}\n : { name }),\n ...(_options.resolver || !name ? { isValid } : {}),\n errors: _formState.errors,\n });\n options.shouldFocus &&\n !validationResult &&\n iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);\n return validationResult;\n };\n const getValues = (fieldNames) => {\n const values = {\n ...(_state.mount ? _formValues : _defaultValues),\n };\n return isUndefined(fieldNames)\n ? values\n : isString(fieldNames)\n ? get(values, fieldNames)\n : fieldNames.map((name) => get(values, name));\n };\n const getFieldState = (name, formState) => ({\n invalid: !!get((formState || _formState).errors, name),\n isDirty: !!get((formState || _formState).dirtyFields, name),\n error: get((formState || _formState).errors, name),\n isValidating: !!get(_formState.validatingFields, name),\n isTouched: !!get((formState || _formState).touchedFields, name),\n });\n const clearErrors = (name) => {\n name &&\n convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));\n _subjects.state.next({\n errors: name ? _formState.errors : {},\n });\n };\n const setError = (name, error, options) => {\n const ref = (get(_fields, name, { _f: {} })._f || {}).ref;\n const currentError = get(_formState.errors, name) || {};\n // Don't override existing error messages elsewhere in the object tree.\n const { ref: currentRef, message, type, ...restOfErrorTree } = currentError;\n set(_formState.errors, name, {\n ...restOfErrorTree,\n ...error,\n ref,\n });\n _subjects.state.next({\n name,\n errors: _formState.errors,\n isValid: false,\n });\n options && options.shouldFocus && ref && ref.focus && ref.focus();\n };\n const watch = (name, defaultValue) => isFunction(name)\n ? _subjects.state.subscribe({\n next: (payload) => 'values' in payload &&\n name(_getWatch(undefined, defaultValue), payload),\n })\n : _getWatch(name, defaultValue, true);\n const _subscribe = (props) => _subjects.state.subscribe({\n next: (formState) => {\n if (shouldSubscribeByName(props.name, formState.name, props.exact) &&\n shouldRenderFormState(formState, props.formState || _proxyFormState, _setFormState, props.reRenderRoot)) {\n props.callback({\n values: { ..._formValues },\n ..._formState,\n ...formState,\n defaultValues: _defaultValues,\n });\n }\n },\n }).unsubscribe;\n const subscribe = (props) => {\n _state.mount = true;\n _proxySubscribeFormState = {\n ..._proxySubscribeFormState,\n ...props.formState,\n };\n return _subscribe({\n ...props,\n formState: _proxySubscribeFormState,\n });\n };\n const unregister = (name, options = {}) => {\n for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {\n _names.mount.delete(fieldName);\n _names.array.delete(fieldName);\n if (!options.keepValue) {\n unset(_fields, fieldName);\n unset(_formValues, fieldName);\n }\n !options.keepError && unset(_formState.errors, fieldName);\n !options.keepDirty && unset(_formState.dirtyFields, fieldName);\n !options.keepTouched && unset(_formState.touchedFields, fieldName);\n !options.keepIsValidating &&\n unset(_formState.validatingFields, fieldName);\n !_options.shouldUnregister &&\n !options.keepDefaultValue &&\n unset(_defaultValues, fieldName);\n }\n _subjects.state.next({\n values: cloneObject(_formValues),\n });\n _subjects.state.next({\n ..._formState,\n ...(!options.keepDirty ? {} : { isDirty: _getDirty() }),\n });\n !options.keepIsValid && _setValid();\n };\n const _setDisabledField = ({ disabled, name, }) => {\n if ((isBoolean(disabled) && _state.mount) ||\n !!disabled ||\n _names.disabled.has(name)) {\n disabled ? _names.disabled.add(name) : _names.disabled.delete(name);\n }\n };\n const register = (name, options = {}) => {\n let field = get(_fields, name);\n const disabledIsDefined = isBoolean(options.disabled) || isBoolean(_options.disabled);\n set(_fields, name, {\n ...(field || {}),\n _f: {\n ...(field && field._f ? field._f : { ref: { name } }),\n name,\n mount: true,\n ...options,\n },\n });\n _names.mount.add(name);\n if (field) {\n _setDisabledField({\n disabled: isBoolean(options.disabled)\n ? options.disabled\n : _options.disabled,\n name,\n });\n }\n else {\n updateValidAndValue(name, true, options.value);\n }\n return {\n ...(disabledIsDefined\n ? { disabled: options.disabled || _options.disabled }\n : {}),\n ...(_options.progressive\n ? {\n required: !!options.required,\n min: getRuleValue(options.min),\n max: getRuleValue(options.max),\n minLength: getRuleValue(options.minLength),\n maxLength: getRuleValue(options.maxLength),\n pattern: getRuleValue(options.pattern),\n }\n : {}),\n name,\n onChange,\n onBlur: onChange,\n ref: (ref) => {\n if (ref) {\n register(name, options);\n field = get(_fields, name);\n const fieldRef = isUndefined(ref.value)\n ? ref.querySelectorAll\n ? ref.querySelectorAll('input,select,textarea')[0] || ref\n : ref\n : ref;\n const radioOrCheckbox = isRadioOrCheckbox(fieldRef);\n const refs = field._f.refs || [];\n if (radioOrCheckbox\n ? refs.find((option) => option === fieldRef)\n : fieldRef === field._f.ref) {\n return;\n }\n set(_fields, name, {\n _f: {\n ...field._f,\n ...(radioOrCheckbox\n ? {\n refs: [\n ...refs.filter(live),\n fieldRef,\n ...(Array.isArray(get(_defaultValues, name)) ? [{}] : []),\n ],\n ref: { type: fieldRef.type, name },\n }\n : { ref: fieldRef }),\n },\n });\n updateValidAndValue(name, false, undefined, fieldRef);\n }\n else {\n field = get(_fields, name, {});\n if (field._f) {\n field._f.mount = false;\n }\n (_options.shouldUnregister || options.shouldUnregister) &&\n !(isNameInFieldArray(_names.array, name) && _state.action) &&\n _names.unMount.add(name);\n }\n },\n };\n };\n const _focusError = () => _options.shouldFocusError &&\n iterateFieldsByAction(_fields, _focusInput, _names.mount);\n const _disableForm = (disabled) => {\n if (isBoolean(disabled)) {\n _subjects.state.next({ disabled });\n iterateFieldsByAction(_fields, (ref, name) => {\n const currentField = get(_fields, name);\n if (currentField) {\n ref.disabled = currentField._f.disabled || disabled;\n if (Array.isArray(currentField._f.refs)) {\n currentField._f.refs.forEach((inputRef) => {\n inputRef.disabled = currentField._f.disabled || disabled;\n });\n }\n }\n }, 0, false);\n }\n };\n const handleSubmit = (onValid, onInvalid) => async (e) => {\n let onValidError = undefined;\n if (e) {\n e.preventDefault && e.preventDefault();\n e.persist &&\n e.persist();\n }\n let fieldValues = cloneObject(_formValues);\n _subjects.state.next({\n isSubmitting: true,\n });\n if (_options.resolver) {\n const { errors, values } = await _runSchema();\n _formState.errors = errors;\n fieldValues = cloneObject(values);\n }\n else {\n await executeBuiltInValidation(_fields);\n }\n if (_names.disabled.size) {\n for (const name of _names.disabled) {\n unset(fieldValues, name);\n }\n }\n unset(_formState.errors, 'root');\n if (isEmptyObject(_formState.errors)) {\n _subjects.state.next({\n errors: {},\n });\n try {\n await onValid(fieldValues, e);\n }\n catch (error) {\n onValidError = error;\n }\n }\n else {\n if (onInvalid) {\n await onInvalid({ ..._formState.errors }, e);\n }\n _focusError();\n setTimeout(_focusError);\n }\n _subjects.state.next({\n isSubmitted: true,\n isSubmitting: false,\n isSubmitSuccessful: isEmptyObject(_formState.errors) && !onValidError,\n submitCount: _formState.submitCount + 1,\n errors: _formState.errors,\n });\n if (onValidError) {\n throw onValidError;\n }\n };\n const resetField = (name, options = {}) => {\n if (get(_fields, name)) {\n if (isUndefined(options.defaultValue)) {\n setValue(name, cloneObject(get(_defaultValues, name)));\n }\n else {\n setValue(name, options.defaultValue);\n set(_defaultValues, name, cloneObject(options.defaultValue));\n }\n if (!options.keepTouched) {\n unset(_formState.touchedFields, name);\n }\n if (!options.keepDirty) {\n unset(_formState.dirtyFields, name);\n _formState.isDirty = options.defaultValue\n ? _getDirty(name, cloneObject(get(_defaultValues, name)))\n : _getDirty();\n }\n if (!options.keepError) {\n unset(_formState.errors, name);\n _proxyFormState.isValid && _setValid();\n }\n _subjects.state.next({ ..._formState });\n }\n };\n const _reset = (formValues, keepStateOptions = {}) => {\n const updatedValues = formValues ? cloneObject(formValues) : _defaultValues;\n const cloneUpdatedValues = cloneObject(updatedValues);\n const isEmptyResetValues = isEmptyObject(formValues);\n const values = isEmptyResetValues ? _defaultValues : cloneUpdatedValues;\n if (!keepStateOptions.keepDefaultValues) {\n _defaultValues = updatedValues;\n }\n if (!keepStateOptions.keepValues) {\n if (keepStateOptions.keepDirtyValues) {\n const fieldsToCheck = new Set([\n ..._names.mount,\n ...Object.keys(getDirtyFields(_defaultValues, _formValues)),\n ]);\n for (const fieldName of Array.from(fieldsToCheck)) {\n get(_formState.dirtyFields, fieldName)\n ? set(values, fieldName, get(_formValues, fieldName))\n : setValue(fieldName, get(values, fieldName));\n }\n }\n else {\n if (isWeb && isUndefined(formValues)) {\n for (const name of _names.mount) {\n const field = get(_fields, name);\n if (field && field._f) {\n const fieldReference = Array.isArray(field._f.refs)\n ? field._f.refs[0]\n : field._f.ref;\n if (isHTMLElement(fieldReference)) {\n const form = fieldReference.closest('form');\n if (form) {\n form.reset();\n break;\n }\n }\n }\n }\n }\n if (keepStateOptions.keepFieldsRef) {\n for (const fieldName of _names.mount) {\n setValue(fieldName, get(values, fieldName));\n }\n }\n else {\n _fields = {};\n }\n }\n _formValues = _options.shouldUnregister\n ? keepStateOptions.keepDefaultValues\n ? cloneObject(_defaultValues)\n : {}\n : cloneObject(values);\n _subjects.array.next({\n values: { ...values },\n });\n _subjects.state.next({\n values: { ...values },\n });\n }\n _names = {\n mount: keepStateOptions.keepDirtyValues ? _names.mount : new Set(),\n unMount: new Set(),\n array: new Set(),\n disabled: new Set(),\n watch: new Set(),\n watchAll: false,\n focus: '',\n };\n _state.mount =\n !_proxyFormState.isValid ||\n !!keepStateOptions.keepIsValid ||\n !!keepStateOptions.keepDirtyValues;\n _state.watch = !!_options.shouldUnregister;\n _subjects.state.next({\n submitCount: keepStateOptions.keepSubmitCount\n ? _formState.submitCount\n : 0,\n isDirty: isEmptyResetValues\n ? false\n : keepStateOptions.keepDirty\n ? _formState.isDirty\n : !!(keepStateOptions.keepDefaultValues &&\n !deepEqual(formValues, _defaultValues)),\n isSubmitted: keepStateOptions.keepIsSubmitted\n ? _formState.isSubmitted\n : false,\n dirtyFields: isEmptyResetValues\n ? {}\n : keepStateOptions.keepDirtyValues\n ? keepStateOptions.keepDefaultValues && _formValues\n ? getDirtyFields(_defaultValues, _formValues)\n : _formState.dirtyFields\n : keepStateOptions.keepDefaultValues && formValues\n ? getDirtyFields(_defaultValues, formValues)\n : keepStateOptions.keepDirty\n ? _formState.dirtyFields\n : {},\n touchedFields: keepStateOptions.keepTouched\n ? _formState.touchedFields\n : {},\n errors: keepStateOptions.keepErrors ? _formState.errors : {},\n isSubmitSuccessful: keepStateOptions.keepIsSubmitSuccessful\n ? _formState.isSubmitSuccessful\n : false,\n isSubmitting: false,\n defaultValues: _defaultValues,\n });\n };\n const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues)\n ? formValues(_formValues)\n : formValues, keepStateOptions);\n const setFocus = (name, options = {}) => {\n const field = get(_fields, name);\n const fieldReference = field && field._f;\n if (fieldReference) {\n const fieldRef = fieldReference.refs\n ? fieldReference.refs[0]\n : fieldReference.ref;\n if (fieldRef.focus) {\n fieldRef.focus();\n options.shouldSelect &&\n isFunction(fieldRef.select) &&\n fieldRef.select();\n }\n }\n };\n const _setFormState = (updatedFormState) => {\n _formState = {\n ..._formState,\n ...updatedFormState,\n };\n };\n const _resetDefaultValues = () => isFunction(_options.defaultValues) &&\n _options.defaultValues().then((values) => {\n reset(values, _options.resetOptions);\n _subjects.state.next({\n isLoading: false,\n });\n });\n const methods = {\n control: {\n register,\n unregister,\n getFieldState,\n handleSubmit,\n setError,\n _subscribe,\n _runSchema,\n _focusError,\n _getWatch,\n _getDirty,\n _setValid,\n _setFieldArray,\n _setDisabledField,\n _setErrors,\n _getFieldArray,\n _reset,\n _resetDefaultValues,\n _removeUnmounted,\n _disableForm,\n _subjects,\n _proxyFormState,\n get _fields() {\n return _fields;\n },\n get _formValues() {\n return _formValues;\n },\n get _state() {\n return _state;\n },\n set _state(value) {\n _state = value;\n },\n get _defaultValues() {\n return _defaultValues;\n },\n get _names() {\n return _names;\n },\n set _names(value) {\n _names = value;\n },\n get _formState() {\n return _formState;\n },\n get _options() {\n return _options;\n },\n set _options(value) {\n _options = {\n ..._options,\n ...value,\n };\n },\n },\n subscribe,\n trigger,\n register,\n handleSubmit,\n watch,\n setValue,\n getValues,\n reset,\n resetField,\n clearErrors,\n unregister,\n setError,\n setFocus,\n getFieldState,\n };\n return {\n ...methods,\n formControl: methods,\n };\n}\n\nvar generateId = () => {\n if (typeof crypto !== 'undefined' && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n const d = typeof performance === 'undefined' ? Date.now() : performance.now() * 1000;\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16 + d) % 16 | 0;\n return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);\n });\n};\n\nvar getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined(options.shouldFocus)\n ? options.focusName ||\n `${name}.${isUndefined(options.focusIndex) ? index : options.focusIndex}.`\n : '';\n\nvar appendAt = (data, value) => [\n ...data,\n ...convertToArrayPayload(value),\n];\n\nvar fillEmptyArray = (value) => Array.isArray(value) ? value.map(() => undefined) : undefined;\n\nfunction insert(data, index, value) {\n return [\n ...data.slice(0, index),\n ...convertToArrayPayload(value),\n ...data.slice(index),\n ];\n}\n\nvar moveArrayAt = (data, from, to) => {\n if (!Array.isArray(data)) {\n return [];\n }\n if (isUndefined(data[to])) {\n data[to] = undefined;\n }\n data.splice(to, 0, data.splice(from, 1)[0]);\n return data;\n};\n\nvar prependAt = (data, value) => [\n ...convertToArrayPayload(value),\n ...convertToArrayPayload(data),\n];\n\nfunction removeAtIndexes(data, indexes) {\n let i = 0;\n const temp = [...data];\n for (const index of indexes) {\n temp.splice(index - i, 1);\n i++;\n }\n return compact(temp).length ? temp : [];\n}\nvar removeArrayAt = (data, index) => isUndefined(index)\n ? []\n : removeAtIndexes(data, convertToArrayPayload(index).sort((a, b) => a - b));\n\nvar swapArrayAt = (data, indexA, indexB) => {\n [data[indexA], data[indexB]] = [data[indexB], data[indexA]];\n};\n\nvar updateAt = (fieldValues, index, value) => {\n fieldValues[index] = value;\n return fieldValues;\n};\n\n/**\n * A custom hook that exposes convenient methods to perform operations with a list of dynamic inputs that need to be appended, updated, removed etc. • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn) • [Video](https://youtu.be/4MrbfGSFY2A)\n *\n * @remarks\n * [API](https://react-hook-form.com/docs/usefieldarray) • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn)\n *\n * @param props - useFieldArray props\n *\n * @returns methods - functions to manipulate with the Field Arrays (dynamic inputs) {@link UseFieldArrayReturn}\n *\n * @example\n * ```tsx\n * function App() {\n * const { register, control, handleSubmit, reset, trigger, setError } = useForm({\n * defaultValues: {\n * test: []\n * }\n * });\n * const { fields, append } = useFieldArray({\n * control,\n * name: \"test\"\n * });\n *\n * return (\n * <form onSubmit={handleSubmit(data => console.log(data))}>\n * {fields.map((item, index) => (\n * <input key={item.id} {...register(`test.${index}.firstName`)} />\n * ))}\n * <button type=\"button\" onClick={() => append({ firstName: \"bill\" })}>\n * append\n * </button>\n * <input type=\"submit\" />\n * </form>\n * );\n * }\n * ```\n */\nfunction useFieldArray(props) {\n const methods = useFormContext();\n const { control = methods.control, name, keyName = 'id', shouldUnregister, rules, } = props;\n const [fields, setFields] = React.useState(control._getFieldArray(name));\n const ids = React.useRef(control._getFieldArray(name).map(generateId));\n const _fieldIds = React.useRef(fields);\n const _actioned = React.useRef(false);\n _fieldIds.current = fields;\n control._names.array.add(name);\n React.useMemo(() => rules &&\n control.register(name, rules), [control, rules, name]);\n useIsomorphicLayoutEffect(() => control._subjects.array.subscribe({\n next: ({ values, name: fieldArrayName, }) => {\n if (fieldArrayName === name || !fieldArrayName) {\n const fieldValues = get(values, name);\n if (Array.isArray(fieldValues)) {\n setFields(fieldValues);\n ids.current = fieldValues.map(generateId);\n }\n }\n },\n }).unsubscribe, [control, name]);\n const updateValues = React.useCallback((updatedFieldArrayValues) => {\n _actioned.current = true;\n control._setFieldArray(name, updatedFieldArrayValues);\n }, [control, name]);\n const append = (value, options) => {\n const appendValue = convertToArrayPayload(cloneObject(value));\n const updatedFieldArrayValues = appendAt(control._getFieldArray(name), appendValue);\n control._names.focus = getFocusFieldName(name, updatedFieldArrayValues.length - 1, options);\n ids.current = appendAt(ids.current, appendValue.map(generateId));\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._setFieldArray(name, updatedFieldArrayValues, appendAt, {\n argA: fillEmptyArray(value),\n });\n };\n const prepend = (value, options) => {\n const prependValue = convertToArrayPayload(cloneObject(value));\n const updatedFieldArrayValues = prependAt(control._getFieldArray(name), prependValue);\n control._names.focus = getFocusFieldName(name, 0, options);\n ids.current = prependAt(ids.current, prependValue.map(generateId));\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._setFieldArray(name, updatedFieldArrayValues, prependAt, {\n argA: fillEmptyArray(value),\n });\n };\n const remove = (index) => {\n const updatedFieldArrayValues = removeArrayAt(control._getFieldArray(name), index);\n ids.current = removeArrayAt(ids.current, index);\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n !Array.isArray(get(control._fields, name)) &&\n set(control._fields, name, undefined);\n control._setFieldArray(name, updatedFieldArrayValues, removeArrayAt, {\n argA: index,\n });\n };\n const insert$1 = (index, value, options) => {\n const insertValue = convertToArrayPayload(cloneObject(value));\n const updatedFieldArrayValues = insert(control._getFieldArray(name), index, insertValue);\n control._names.focus = getFocusFieldName(name, index, options);\n ids.current = insert(ids.current, index, insertValue.map(generateId));\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._setFieldArray(name, updatedFieldArrayValues, insert, {\n argA: index,\n argB: fillEmptyArray(value),\n });\n };\n const swap = (indexA, indexB) => {\n const updatedFieldArrayValues = control._getFieldArray(name);\n swapArrayAt(updatedFieldArrayValues, indexA, indexB);\n swapArrayAt(ids.current, indexA, indexB);\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._setFieldArray(name, updatedFieldArrayValues, swapArrayAt, {\n argA: indexA,\n argB: indexB,\n }, false);\n };\n const move = (from, to) => {\n const updatedFieldArrayValues = control._getFieldArray(name);\n moveArrayAt(updatedFieldArrayValues, from, to);\n moveArrayAt(ids.current, from, to);\n updateValues(updatedFieldArrayValues);\n setFields(updatedFieldArrayValues);\n control._setFieldArray(name, updatedFieldArrayValues, moveArrayAt, {\n argA: from,\n argB: to,\n }, false);\n };\n const update = (index, value) => {\n const updateValue = cloneObject(value);\n const updatedFieldArrayValues = updateAt(control._getFieldArray(name), index, updateValue);\n ids.current = [...updatedFieldArrayValues].map((item, i) => !item || i === index ? generateId() : ids.current[i]);\n updateValues(updatedFieldArrayValues);\n setFields([...updatedFieldArrayValues]);\n control._setFieldArray(name, updatedFieldArrayValues, updateAt, {\n argA: index,\n argB: updateValue,\n }, true, false);\n };\n const replace = (value) => {\n const updatedFieldArrayValues = convertToArrayPayload(cloneObject(value));\n ids.current = updatedFieldArrayValues.map(generateId);\n updateValues([...updatedFieldArrayValues]);\n setFields([...updatedFieldArrayValues]);\n control._setFieldArray(name, [...updatedFieldArrayValues], (data) => data, {}, true, false);\n };\n React.useEffect(() => {\n control._state.action = false;\n isWatched(name, control._names) &&\n control._subjects.state.next({\n ...control._formState,\n });\n if (_actioned.current &&\n (!getValidationModes(control._options.mode).isOnSubmit ||\n control._formState.isSubmitted) &&\n !getValidationModes(control._options.reValidateMode).isOnSubmit) {\n if (control._options.resolver) {\n control._runSchema([name]).then((result) => {\n const error = get(result.errors, name);\n const existingError = get(control._formState.errors, name);\n if (existingError\n ? (!error && existingError.type) ||\n (error &&\n (existingError.type !== error.type ||\n existingError.message !== error.message))\n : error && error.type) {\n error\n ? set(control._formState.errors, name, error)\n : unset(control._formState.errors, name);\n control._subjects.state.next({\n errors: control._formState.errors,\n });\n }\n });\n }\n else {\n const field = get(control._fields, name);\n if (field &&\n field._f &&\n !(getValidationModes(control._options.reValidateMode).isOnSubmit &&\n getValidationModes(control._options.mode).isOnSubmit)) {\n validateField(field, control._names.disabled, control._formValues, control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error) => !isEmptyObject(error) &&\n control._subjects.state.next({\n errors: updateFieldArrayRootError(control._formState.errors, error, name),\n }));\n }\n }\n }\n control._subjects.state.next({\n name,\n values: cloneObject(control._formValues),\n });\n control._names.focus &&\n iterateFieldsByAction(control._fields, (ref, key) => {\n if (control._names.focus &&\n key.startsWith(control._names.focus) &&\n ref.focus) {\n ref.focus();\n return 1;\n }\n return;\n });\n control._names.focus = '';\n control._setValid();\n _actioned.current = false;\n }, [fields, name, control]);\n React.useEffect(() => {\n !get(control._formValues, name) && control._setFieldArray(name);\n return () => {\n const updateMounted = (name, value) => {\n const field = get(control._fields, name);\n if (field && field._f) {\n field._f.mount = value;\n }\n };\n control._options.shouldUnregister || shouldUnregister\n ? control.unregister(name)\n : updateMounted(name, false);\n };\n }, [name, control, keyName, shouldUnregister]);\n return {\n swap: React.useCallback(swap, [updateValues, name, control]),\n move: React.useCallback(move, [updateValues, name, control]),\n prepend: React.useCallback(prepend, [updateValues, name, control]),\n append: React.useCallback(append, [updateValues, name, control]),\n remove: React.useCallback(remove, [updateValues, name, control]),\n insert: React.useCallback(insert$1, [updateValues, name, control]),\n update: React.useCallback(update, [updateValues, name, control]),\n replace: React.useCallback(replace, [updateValues, name, control]),\n fields: React.useMemo(() => fields.map((field, index) => ({\n ...field,\n [keyName]: ids.current[index] || generateId(),\n })), [fields, keyName]),\n };\n}\n\n/**\n * Custom hook to manage the entire form.\n *\n * @remarks\n * [API](https://react-hook-form.com/docs/useform) • [Demo](https://codesandbox.io/s/react-hook-form-get-started-ts-5ksmm) • [Video](https://www.youtube.com/watch?v=RkXv4AXXC_4)\n *\n * @param props - form configuration and validation parameters.\n *\n * @returns methods - individual functions to manage the form state. {@link UseFormReturn}\n *\n * @example\n * ```tsx\n * function App() {\n * const { register, handleSubmit, watch, formState: { errors } } = useForm();\n * const onSubmit = data => console.log(data);\n *\n * console.log(watch(\"example\"));\n *\n * return (\n * <form onSubmit={handleSubmit(onSubmit)}>\n * <input defaultValue=\"test\" {...register(\"example\")} />\n * <input {...register(\"exampleRequired\", { required: true })} />\n * {errors.exampleRequired && <span>This field is required</span>}\n * <button>Submit</button>\n * </form>\n * );\n * }\n * ```\n */\nfunction useForm(props = {}) {\n const _formControl = React.useRef(undefined);\n const _values = React.useRef(undefined);\n const [formState, updateFormState] = React.useState({\n isDirty: false,\n isValidating: false,\n isLoading: isFunction(props.defaultValues),\n isSubmitted: false,\n isSubmitting: false,\n isSubmitSuccessful: false,\n isValid: false,\n submitCount: 0,\n dirtyFields: {},\n touchedFields: {},\n validatingFields: {},\n errors: props.errors || {},\n disabled: props.disabled || false,\n isReady: false,\n defaultValues: isFunction(props.defaultValues)\n ? undefined\n : props.defaultValues,\n });\n if (!_formControl.current) {\n if (props.formControl) {\n _formControl.current = {\n ...props.formControl,\n formState,\n };\n if (props.defaultValues && !isFunction(props.defaultValues)) {\n props.formControl.reset(props.defaultValues, props.resetOptions);\n }\n }\n else {\n const { formControl, ...rest } = createFormControl(props);\n _formControl.current = {\n ...rest,\n formState,\n };\n }\n }\n const control = _formControl.current.control;\n control._options = props;\n useIsomorphicLayoutEffect(() => {\n const sub = control._subscribe({\n formState: control._proxyFormState,\n callback: () => updateFormState({ ...control._formState }),\n reRenderRoot: true,\n });\n updateFormState((data) => ({\n ...data,\n isReady: true,\n }));\n control._formState.isReady = true;\n return sub;\n }, [control]);\n React.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);\n React.useEffect(() => {\n if (props.mode) {\n control._options.mode = props.mode;\n }\n if (props.reValidateMode) {\n control._options.reValidateMode = props.reValidateMode;\n }\n }, [control, props.mode, props.reValidateMode]);\n React.useEffect(() => {\n if (props.errors) {\n control._setErrors(props.errors);\n control._focusError();\n }\n }, [control, props.errors]);\n React.useEffect(() => {\n props.shouldUnregister &&\n control._subjects.state.next({\n values: control._getWatch(),\n });\n }, [control, props.shouldUnregister]);\n React.useEffect(() => {\n if (control._proxyFormState.isDirty) {\n const isDirty = control._getDirty();\n if (isDirty !== formState.isDirty) {\n control._subjects.state.next({\n isDirty,\n });\n }\n }\n }, [control, formState.isDirty]);\n React.useEffect(() => {\n if (props.values && !deepEqual(props.values, _values.current)) {\n control._reset(props.values, {\n keepFieldsRef: true,\n ...control._options.resetOptions,\n });\n _values.current = props.values;\n updateFormState((state) => ({ ...state }));\n }\n else {\n control._resetDefaultValues();\n }\n }, [control, props.values]);\n React.useEffect(() => {\n if (!control._state.mount) {\n control._setValid();\n control._state.mount = true;\n }\n if (control._state.watch) {\n control._state.watch = false;\n control._subjects.state.next({ ...control._formState });\n }\n control._removeUnmounted();\n });\n _formControl.current.formState = getProxyFormState(formState, control);\n return _formControl.current;\n}\n\nexport { Controller, Form, FormProvider, appendErrors, createFormControl, get, set, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch };\n//# sourceMappingURL=index.esm.mjs.map\n","/**\n * Unified Form System - Simple Components + React Hook Form Integration\n * @module @bloomneo/uikit\n * @file src/components/ui/form.tsx\n */\n\nimport * as React from 'react';\nimport { forwardRef, useState, useCallback } from 'react';\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from \"react-hook-form\";\nimport { cn } from '@/lib/utils';\nimport { Input } from '@/components/ui/input';\nimport { Textarea } from '@/components/ui/textarea';\nimport { Button } from '@/components/ui/button';\nimport { Label } from '@/components/ui/label';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { \n Select, \n SelectContent, \n SelectItem, \n SelectTrigger, \n SelectValue \n} from '@/components/ui/select';\nimport { \n AlertCircle, \n CheckCircle2, \n Eye, \n EyeOff\n} from 'lucide-react';\n\n// =============================================================================\n// UTILITY HOOKS\n// =============================================================================\n\n/**\n * Debounced hook for smooth validation\n */\nconst useDebounce = <T,>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n React.useEffect(() => {\n const handler = setTimeout(() => setDebouncedValue(value), delay);\n return () => clearTimeout(handler);\n }, [value, delay]);\n\n return debouncedValue;\n};\n\n/**\n * Password strength calculation\n */\nconst calculatePasswordStrength = (password: string): {\n score: number;\n label: string;\n color: string;\n} => {\n if (!password) return { score: 0, label: '', color: '' };\n \n let score = 0;\n \n if (password.length >= 8) score += 25;\n if (password.length >= 12) score += 25;\n if (/[a-z]/.test(password)) score += 10;\n if (/[A-Z]/.test(password)) score += 10;\n if (/\\d/.test(password)) score += 15;\n if (/[^a-zA-Z\\d]/.test(password)) score += 15;\n \n if (score < 30) return { score, label: 'Weak', color: 'text-destructive' };\n if (score < 60) return { score, label: 'Medium', color: 'text-orange-600' };\n return { score, label: 'Strong', color: 'text-green-600' };\n};\n\n// =============================================================================\n// REACT HOOK FORM INTEGRATION (Advanced Usage)\n// =============================================================================\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\n {} as FormFieldContextValue\n);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\");\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>(\n {} as FormItemContextValue\n);\n\nfunction FormItem({ className, ...props }: React.ComponentProps<\"div\">) {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div\n data-slot=\"form-item\"\n className={cn(\"grid gap-2\", className)}\n {...props}\n />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n data-slot=\"form-label\"\n data-error={!!error}\n className={cn(\"data-[error=true]:text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormControl({ ...props }: React.ComponentProps<typeof Slot>) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={\n !error\n ? `${formDescriptionId}`\n : `${formDescriptionId} ${formMessageId}`\n }\n aria-invalid={!!error}\n {...props}\n />\n );\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n data-slot=\"form-description\"\n id={formDescriptionId}\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<\"p\">) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? \"\") : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n data-slot=\"form-message\"\n id={formMessageId}\n className={cn(\"text-destructive text-sm\", className)}\n {...props}\n >\n {body}\n </p>\n );\n}\n\n// =============================================================================\n// SIMPLE FORM COMPONENTS (Recommended for 90% of use cases)\n// =============================================================================\n\n/**\n * Validated Input - Form input with built-in validation and enhanced features\n */\nexport interface ValidatedInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {\n // Standard React Props\n value?: string;\n onChange?: (value: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n \n // HTML5 Standard Props\n type?: 'text' | 'email' | 'password' | 'tel' | 'url' | 'number';\n required?: boolean;\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n \n // UI Props\n label?: string;\n placeholder?: string;\n disabled?: boolean;\n \n // Enhanced Features\n showPasswordStrength?: boolean;\n showPasswordToggle?: boolean;\n}\n\nconst ValidatedInput = forwardRef<HTMLInputElement, ValidatedInputProps>(({\n value = '',\n onChange,\n onFocus,\n onBlur,\n type = 'text',\n required = false,\n minLength,\n maxLength,\n pattern,\n label,\n placeholder,\n disabled = false,\n showPasswordStrength = false,\n showPasswordToggle = true,\n className,\n ...props\n}, ref) => {\n const [inputValue, setInputValue] = useState(value);\n const [showPassword, setShowPassword] = useState(false);\n const [touched, setTouched] = useState(false);\n const [isValid, setIsValid] = useState(true);\n const [errorMessage, setErrorMessage] = useState('');\n \n // ✅ Sync internal state with external value changes\n React.useEffect(() => {\n setInputValue(value || '');\n }, [value]);\n \n const debouncedValue = useDebounce(inputValue, 300);\n\n const validateValue = useCallback((val: string): { isValid: boolean; message: string } => {\n if (required && !val.trim()) {\n return { isValid: false, message: 'This field is required' };\n }\n\n if (!val.trim() && !required) {\n return { isValid: true, message: '' };\n }\n\n if (minLength && val.length < minLength) {\n return { isValid: false, message: `Minimum ${minLength} characters required` };\n }\n if (maxLength && val.length > maxLength) {\n return { isValid: false, message: `Maximum ${maxLength} characters allowed` };\n }\n\n if (type === 'email' && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(val)) {\n return { isValid: false, message: 'Please enter a valid email address' };\n }\n if (type === 'url' && !/^https?:\\/\\/.+\\..+/.test(val)) {\n return { isValid: false, message: 'Please enter a valid URL' };\n }\n if (type === 'tel' && !/^[\\+]?[1-9][\\d]{0,15}$/.test(val)) {\n return { isValid: false, message: 'Please enter a valid phone number' };\n }\n\n if (pattern && !new RegExp(pattern).test(val)) {\n return { isValid: false, message: 'Please match the required format' };\n }\n\n return { isValid: true, message: '' };\n }, [required, minLength, maxLength, type, pattern]);\n\n React.useEffect(() => {\n if (touched) {\n const result = validateValue(debouncedValue);\n setIsValid(result.isValid);\n setErrorMessage(result.message);\n }\n }, [debouncedValue, validateValue, touched]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n setInputValue(newValue);\n onChange?.(newValue);\n if (!touched) setTouched(true);\n };\n\n const handleBlur = () => {\n setTouched(true);\n const result = validateValue(inputValue);\n setIsValid(result.isValid);\n setErrorMessage(result.message);\n onBlur?.();\n };\n\n const actualType = type === 'password' && showPassword ? 'text' : type;\n const hasError = touched && !isValid;\n const hasSuccess = touched && isValid && inputValue;\n const passwordStrength = type === 'password' && showPasswordStrength ? calculatePasswordStrength(inputValue) : null;\n\n return (\n <div className=\"space-y-2\">\n {label && (\n <Label \n className={cn(\n 'text-foreground',\n required && \"after:content-['*'] after:ml-0.5 after:text-destructive\"\n )}\n >\n {label}\n </Label>\n )}\n\n <div className=\"relative\">\n <Input\n {...props}\n ref={ref}\n type={actualType}\n value={inputValue}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={onFocus}\n placeholder={placeholder}\n disabled={disabled}\n className={cn(\n 'bg-background border-border text-foreground',\n hasError && 'border-destructive focus:border-destructive',\n hasSuccess && 'border-green-500',\n (type === 'password' && showPasswordToggle) && 'pr-10',\n className\n )}\n />\n\n {type === 'password' && showPasswordToggle && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent\"\n onClick={() => setShowPassword(!showPassword)}\n tabIndex={-1}\n >\n {showPassword ? <EyeOff className=\"h-4 w-4\" /> : <Eye className=\"h-4 w-4\" />}\n </Button>\n )}\n\n {touched && inputValue && !showPasswordToggle && (\n <div className=\"absolute right-3 top-2.5\">\n {isValid ? (\n <CheckCircle2 className=\"h-4 w-4 text-green-500\" />\n ) : (\n <AlertCircle className=\"h-4 w-4 text-destructive\" />\n )}\n </div>\n )}\n </div>\n\n {passwordStrength && inputValue && (\n <div className=\"space-y-1\">\n <div className=\"flex justify-between text-xs\">\n <span className=\"text-muted-foreground\">Password strength</span>\n <span className={passwordStrength.color}>{passwordStrength.label}</span>\n </div>\n <div className=\"w-full bg-muted rounded-full h-1.5\">\n <div \n className={cn(\n 'h-1.5 rounded-full transition-all duration-300',\n passwordStrength.score < 30 && 'bg-destructive',\n passwordStrength.score >= 30 && passwordStrength.score < 60 && 'bg-orange-500',\n passwordStrength.score >= 60 && 'bg-green-500'\n )}\n style={{ width: `${passwordStrength.score}%` }}\n />\n </div>\n </div>\n )}\n\n {hasError && errorMessage && (\n <div className=\"flex items-center gap-1 text-sm text-destructive\">\n <AlertCircle className=\"h-3 w-3\" />\n {errorMessage}\n </div>\n )}\n </div>\n );\n});\n\nValidatedInput.displayName = 'ValidatedInput';\n\n/**\n * Validated Textarea - Form textarea with built-in validation and enhanced features\n */\nexport interface ValidatedTextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange'> {\n value?: string;\n onChange?: (value: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n required?: boolean;\n minLength?: number;\n maxLength?: number;\n label?: string;\n placeholder?: string;\n disabled?: boolean;\n rows?: number;\n showCharCount?: boolean;\n}\n\nconst ValidatedTextarea = forwardRef<HTMLTextAreaElement, ValidatedTextareaProps>(({\n value = '',\n onChange,\n onFocus,\n onBlur,\n required = false,\n minLength,\n maxLength,\n label,\n placeholder,\n disabled = false,\n rows = 3,\n showCharCount = true,\n className,\n ...props\n}, ref) => {\n const [inputValue, setInputValue] = useState(value);\n const [touched, setTouched] = useState(false);\n const [isValid, setIsValid] = useState(true);\n const [errorMessage, setErrorMessage] = useState('');\n\n // ✅ Sync internal state with external value changes\n React.useEffect(() => {\n setInputValue(value || '');\n }, [value]);\n\n const debouncedValue = useDebounce(inputValue, 300);\n\n const validateValue = useCallback((val: string): { isValid: boolean; message: string } => {\n if (required && !val.trim()) {\n return { isValid: false, message: 'This field is required' };\n }\n if (!val.trim() && !required) {\n return { isValid: true, message: '' };\n }\n if (minLength && val.length < minLength) {\n return { isValid: false, message: `Minimum ${minLength} characters required` };\n }\n if (maxLength && val.length > maxLength) {\n return { isValid: false, message: `Maximum ${maxLength} characters allowed` };\n }\n return { isValid: true, message: '' };\n }, [required, minLength, maxLength]);\n\n React.useEffect(() => {\n if (touched) {\n const result = validateValue(debouncedValue);\n setIsValid(result.isValid);\n setErrorMessage(result.message);\n }\n }, [debouncedValue, validateValue, touched]);\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n const newValue = e.target.value;\n if (maxLength && newValue.length > maxLength) return;\n \n setInputValue(newValue);\n onChange?.(newValue);\n if (!touched) setTouched(true);\n };\n\n const handleBlur = () => {\n setTouched(true);\n const result = validateValue(inputValue);\n setIsValid(result.isValid);\n setErrorMessage(result.message);\n onBlur?.();\n };\n\n const hasError = touched && !isValid;\n const hasSuccess = touched && isValid && inputValue;\n\n return (\n <div className=\"space-y-2\">\n {label && (\n <Label \n className={cn(\n 'text-foreground',\n required && \"after:content-['*'] after:ml-0.5 after:text-destructive\"\n )}\n >\n {label}\n </Label>\n )}\n\n <Textarea\n {...props}\n ref={ref}\n value={inputValue}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={onFocus}\n placeholder={placeholder}\n disabled={disabled}\n rows={rows}\n className={cn(\n 'bg-background border-border text-foreground',\n hasError && 'border-destructive focus:border-destructive',\n hasSuccess && 'border-green-500',\n className\n )}\n />\n\n {(showCharCount && maxLength) && (\n <div className=\"text-xs text-muted-foreground text-right\">\n {inputValue.length} / {maxLength}\n </div>\n )}\n\n {hasError && errorMessage && (\n <div className=\"flex items-center gap-1 text-sm text-destructive\">\n <AlertCircle className=\"h-3 w-3\" />\n {errorMessage}\n </div>\n )}\n </div>\n );\n});\n\nValidatedTextarea.displayName = 'ValidatedTextarea';\n\n/**\n * Validated Select - Form select with built-in validation\n */\nexport interface ValidatedSelectProps {\n value?: string;\n onChange?: (value: string) => void;\n required?: boolean;\n disabled?: boolean;\n label?: string;\n placeholder?: string;\n options: Array<{ label: string; value: string; disabled?: boolean }>;\n clearable?: boolean;\n className?: string;\n}\n\nconst ValidatedSelect = forwardRef<HTMLDivElement, ValidatedSelectProps>(({\n value = '',\n onChange,\n required = false,\n disabled = false,\n label,\n placeholder = 'Select an option...',\n options,\n clearable = false,\n className,\n}, ref) => {\n const [selectValue, setSelectValue] = useState(value);\n const [touched, setTouched] = useState(false);\n const [isValid, setIsValid] = useState(true);\n const [errorMessage, setErrorMessage] = useState('');\n\n // ✅ Sync internal state with external value changes\n React.useEffect(() => {\n setSelectValue(value || '');\n }, [value]);\n\n const validateValue = useCallback((val: string): { isValid: boolean; message: string } => {\n if (required && !val) {\n return { isValid: false, message: 'Please select an option' };\n }\n return { isValid: true, message: '' };\n }, [required]);\n\n const handleValueChange = (newValue: string) => {\n setTouched(true);\n setSelectValue(newValue);\n const result = validateValue(newValue);\n setIsValid(result.isValid);\n setErrorMessage(result.message);\n onChange?.(newValue);\n };\n\n const hasError = touched && !isValid;\n\n return (\n <div className=\"space-y-2\" ref={ref}>\n {label && (\n <Label \n className={cn(\n 'text-foreground',\n required && \"after:content-['*'] after:ml-0.5 after:text-destructive\"\n )}\n >\n {label}\n </Label>\n )}\n\n <Select\n value={selectValue}\n onValueChange={handleValueChange}\n disabled={disabled}\n >\n <SelectTrigger\n className={cn(\n 'bg-background border-border text-foreground',\n hasError && 'border-destructive focus:border-destructive',\n className\n )}\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent className=\"bg-popover border-border\">\n {clearable && selectValue && (\n <SelectItem value=\"\" className=\"text-muted-foreground\">\n Clear selection\n </SelectItem>\n )}\n {options.map((option) => (\n <SelectItem\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n className=\"text-foreground\"\n >\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n {hasError && errorMessage && (\n <div className=\"flex items-center gap-1 text-sm text-destructive\">\n <AlertCircle className=\"h-3 w-3\" />\n {errorMessage}\n </div>\n )}\n </div>\n );\n});\n\nValidatedSelect.displayName = 'ValidatedSelect';\n\n/**\n * Validated Checkbox - Form checkbox with built-in validation\n */\nexport interface ValidatedCheckboxProps {\n checked?: boolean;\n onChange?: (checked: boolean) => void;\n required?: boolean;\n disabled?: boolean;\n label: string;\n description?: string;\n className?: string;\n}\n\nconst ValidatedCheckbox = forwardRef<HTMLDivElement, ValidatedCheckboxProps>(({\n checked = false,\n onChange,\n required = false,\n disabled = false,\n label,\n description,\n className,\n}, ref) => {\n const [checkedValue, setCheckedValue] = useState(checked);\n const [touched, setTouched] = useState(false);\n const [isValid, setIsValid] = useState(true);\n const [errorMessage, setErrorMessage] = useState('');\n\n // ✅ Sync internal state with external value changes\n React.useEffect(() => {\n setCheckedValue(checked || false);\n }, [checked]);\n\n const validateValue = useCallback((val: boolean): { isValid: boolean; message: string } => {\n if (required && !val) {\n return { isValid: false, message: 'This field is required' };\n }\n return { isValid: true, message: '' };\n }, [required]);\n\n const handleChange = (newChecked: boolean) => {\n setTouched(true);\n setCheckedValue(newChecked);\n const result = validateValue(newChecked);\n setIsValid(result.isValid);\n setErrorMessage(result.message);\n onChange?.(newChecked);\n };\n\n const hasError = touched && !isValid;\n\n return (\n <div className={cn('space-y-2', className)} ref={ref}>\n <div className=\"flex items-start space-x-2\">\n <Checkbox\n checked={checkedValue}\n onCheckedChange={handleChange}\n disabled={disabled}\n className=\"mt-0.5\"\n />\n <div className=\"space-y-1 flex-1\">\n <Label \n className={cn(\n 'text-sm font-medium leading-none text-foreground cursor-pointer',\n required && \"after:content-['*'] after:ml-0.5 after:text-destructive\"\n )}\n >\n {label}\n </Label>\n {description && (\n <p className=\"text-xs text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n </div>\n\n {hasError && errorMessage && (\n <div className=\"flex items-center gap-1 text-sm text-destructive ml-6\">\n <AlertCircle className=\"h-3 w-3\" />\n {errorMessage}\n </div>\n )}\n </div>\n );\n});\n\nValidatedCheckbox.displayName = 'ValidatedCheckbox';\n\n/**\n * Form Actions - Submit/Cancel buttons with loading states\n */\nexport interface FormActionsProps {\n submitText?: string;\n cancelText?: string;\n showCancel?: boolean;\n loading?: boolean;\n disabled?: boolean;\n onCancel?: () => void;\n align?: 'left' | 'center' | 'right';\n className?: string;\n}\n\nconst FormActions = forwardRef<HTMLDivElement, FormActionsProps>(({\n submitText = 'Submit',\n cancelText = 'Cancel',\n showCancel = false,\n loading = false,\n disabled = false,\n onCancel,\n align = 'right',\n className,\n}, ref) => {\n return (\n <div \n ref={ref}\n className={cn(\n 'flex gap-2',\n align === 'left' && 'justify-start',\n align === 'center' && 'justify-center',\n align === 'right' && 'justify-end',\n className\n )}\n >\n {showCancel && (\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={onCancel}\n disabled={loading}\n className=\"border-border\"\n >\n {cancelText}\n </Button>\n )}\n \n <Button\n type=\"submit\"\n disabled={loading || disabled}\n className=\"min-w-24 bg-primary text-primary-foreground\"\n >\n {loading ? (\n <div className=\"flex items-center gap-2\">\n <div className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\" />\n Loading...\n </div>\n ) : (\n submitText\n )}\n </Button>\n </div>\n );\n});\n\nFormActions.displayName = 'FormActions';\n\n// =============================================================================\n// EXPORTS\n// =============================================================================\n\nexport {\n // React Hook Form (Advanced)\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n \n // Simple Form Components (Recommended for 90% of use cases)\n ValidatedInput,\n ValidatedTextarea,\n ValidatedSelect,\n ValidatedCheckbox,\n FormActions,\n\n};\n\n/**\n * @llm-usage Validated Form Examples (Recommended for 90% of cases)\n * \n * Basic form with validation:\n * ```jsx\n * const [email, setEmail] = useState('');\n * const [password, setPassword] = useState('');\n * \n * <form onSubmit={handleSubmit}>\n * <ValidatedInput\n * type=\"email\"\n * required\n * label=\"Email Address\"\n * value={email}\n * onChange={setEmail}\n * placeholder=\"Enter your email\"\n * />\n * \n * <ValidatedInput\n * type=\"password\"\n * required\n * minLength={8}\n * label=\"Password\"\n * value={password}\n * onChange={setPassword}\n * showPasswordStrength\n * showPasswordToggle\n * />\n * \n * <FormActions\n * submitText=\"Sign In\"\n * showCancel\n * loading={isLoading}\n * onCancel={() => router.back()}\n * />\n * </form>\n * ```\n * \n * Advanced React Hook Form usage (10% of cases):\n * ```jsx\n * import { useForm } from 'react-hook-form';\n * import { zodResolver } from '@hookform/resolvers/zod';\n * \n * const form = useForm({\n * resolver: zodResolver(schema)\n * });\n * \n * <Form {...form}>\n * <form onSubmit={form.handleSubmit(onSubmit)}>\n * <FormField\n * control={form.control}\n * name=\"email\"\n * render={({ field }) => (\n * <FormItem>\n * <FormLabel>Email</FormLabel>\n * <FormControl>\n * <Input {...field} />\n * </FormControl>\n * <FormMessage />\n * </FormItem>\n * )}\n * />\n * </form>\n * </Form>\n * ```\n * \n * @llm-rule Use ValidatedInput for form fields that need validation\n * @llm-rule Use Input (from shadcn) for search boxes, filters, and basic styling\n * @llm-rule ValidatedInput provides: validation, password strength, character counting, error states\n * @llm-rule Input provides: basic styling and controlled input behavior\n */"],"names":["CircleAlert","createLucideIcon","CircleCheck","isCheckBoxInput","element","isDateObject","value","isNullOrUndefined","isObjectType","isObject","getEventValue","event","getNodeParentName","name","isNameInFieldArray","names","isPlainObject","tempObject","prototypeCopy","isWeb","cloneObject","data","copy","isArray","isFileListInstance","key","isKey","isUndefined","val","compact","stringToPath","input","get","object","path","defaultValue","result","isBoolean","set","index","tempPath","length","lastIndex","newValue","objValue","EVENTS","VALIDATION_MODE","HookFormContext","React","useFormContext","FormProvider","props","children","getProxyFormState","formState","control","localProxyFormState","isRoot","_key","useIsomorphicLayoutEffect","useFormState","methods","disabled","exact","updateFormState","_localProxyFormState","isString","generateWatchOutput","_names","formValues","isGlobal","fieldName","isPrimitive","deepEqual","object1","object2","_internal_visited","keys1","keys2","val1","val2","useWatch","compute","_defaultValue","_compute","_computeFormValues","defaultValueMemo","updateValue","computedFormValues","useController","shouldUnregister","isArrayField","_props","_registerProps","fieldState","onChange","onBlur","ref","elm","field","message","_shouldUnregisterField","updateMounted","Controller","useDebounce","delay","debouncedValue","setDebouncedValue","useState","handler","calculatePasswordStrength","password","score","Form","FormFieldContext","FormField","jsx","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","id","FormItem","className","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","body","ValidatedInput","forwardRef","onFocus","type","required","minLength","maxLength","pattern","label","placeholder","showPasswordStrength","showPasswordToggle","inputValue","setInputValue","showPassword","setShowPassword","touched","setTouched","isValid","setIsValid","errorMessage","setErrorMessage","validateValue","useCallback","handleChange","e","handleBlur","actualType","hasError","hasSuccess","passwordStrength","jsxs","Input","Button","EyeOff","Eye","CheckCircle2","AlertCircle","ValidatedTextarea","rows","showCharCount","Textarea","ValidatedSelect","options","clearable","selectValue","setSelectValue","handleValueChange","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","option","ValidatedCheckbox","checked","description","checkedValue","setCheckedValue","newChecked","Checkbox","FormActions","submitText","cancelText","showCancel","loading","onCancel","align"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAcC,GAAiB,eAAe;AAAA,EAClD,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,KAAK,UAAU;AAAA,EACzD,CAAC,QAAQ,EAAE,IAAI,MAAM,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,KAAK,SAAQ,CAAE;AAAA,EACjE,CAAC,QAAQ,EAAE,IAAI,MAAM,IAAI,SAAS,IAAI,MAAM,IAAI,MAAM,KAAK,SAAQ,CAAE;AACvE,CAAC;ACbD;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMC,KAAcD,GAAiB,eAAe;AAAA,EAClD,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,KAAK,UAAU;AAAA,EACzD,CAAC,QAAQ,EAAE,GAAG,iBAAiB,KAAK,SAAQ,CAAE;AAChD,CAAC;ACVD,IAAIE,KAAkB,CAACC,MAAYA,EAAQ,SAAS,YAEhDC,IAAe,CAACC,MAAUA,aAAiB,MAE3CC,IAAoB,CAACD,MAAUA,KAAS;AAE5C,MAAME,KAAe,CAACF,MAAU,OAAOA,KAAU;AACjD,IAAIG,IAAW,CAACH,MAAU,CAACC,EAAkBD,CAAK,KAC9C,CAAC,MAAM,QAAQA,CAAK,KACpBE,GAAaF,CAAK,KAClB,CAACD,EAAaC,CAAK,GAEnBI,KAAgB,CAACC,MAAUF,EAASE,CAAK,KAAKA,EAAM,SAClDR,GAAgBQ,EAAM,MAAM,IACxBA,EAAM,OAAO,UACbA,EAAM,OAAO,QACjBA,GAEFC,KAAoB,CAACC,MAASA,EAAK,UAAU,GAAGA,EAAK,OAAO,aAAa,CAAC,KAAKA,GAE/EC,KAAqB,CAACC,GAAOF,MAASE,EAAM,IAAIH,GAAkBC,CAAI,CAAC,GAEvEG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AAC,IAAQ;AAAA,EACR,WAAAhF;AACF,GAAG3B,MAEC,gBAAAuE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAvE;AAAA,IACA,WAAW4B;AAAA,MACT;AAAA,MACA+E,MAAU,UAAU;AAAA,MACpBA,MAAU,YAAY;AAAA,MACtBA,MAAU,WAAW;AAAA,MACrBhF;AAAA,IAAA;AAAA,IAGD,UAAA;AAAA,MAAA6E,KACC,gBAAArF;AAAA,QAACsD;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,SAASiC;AAAA,UACT,UAAUD;AAAA,UACV,WAAU;AAAA,UAET,UAAAF;AAAA,QAAA;AAAA,MAAA;AAAA,MAIL,gBAAApF;AAAA,QAACsD;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAUgC,KAAW5I;AAAA,UACrB,WAAU;AAAA,UAET,UAAA4I,IACC,gBAAAlC,EAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,YAAA,gBAAApD,EAAC,OAAA,EAAI,WAAU,iFAAA,CAAiF;AAAA,YAAE;AAAA,UAAA,EAAA,CAEpG,IAEAmF;AAAA,QAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAAA,CAGL;AAEDD,GAAY,cAAc;","x_google_ignoreList":[0,1,2]}
|
package/dist/format.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
function w(n, e = {}) {
|
|
3
|
+
if (n == null || Number.isNaN(n)) return "";
|
|
4
|
+
const {
|
|
5
|
+
currency: t = "USD",
|
|
6
|
+
locale: o = "en-US",
|
|
7
|
+
minimumFractionDigits: r = 2,
|
|
8
|
+
maximumFractionDigits: i = 2
|
|
9
|
+
} = e;
|
|
10
|
+
return new Intl.NumberFormat(o, {
|
|
11
|
+
style: "currency",
|
|
12
|
+
currency: t,
|
|
13
|
+
minimumFractionDigits: r,
|
|
14
|
+
maximumFractionDigits: i
|
|
15
|
+
}).format(n);
|
|
16
|
+
}
|
|
17
|
+
function S(n, e = {}) {
|
|
18
|
+
if (n == null || Number.isNaN(n)) return "";
|
|
19
|
+
const {
|
|
20
|
+
locale: t = "en-US",
|
|
21
|
+
minimumFractionDigits: o = 0,
|
|
22
|
+
maximumFractionDigits: r = 2,
|
|
23
|
+
percent: i = !1
|
|
24
|
+
} = e;
|
|
25
|
+
return new Intl.NumberFormat(t, {
|
|
26
|
+
style: i ? "percent" : "decimal",
|
|
27
|
+
minimumFractionDigits: o,
|
|
28
|
+
maximumFractionDigits: r
|
|
29
|
+
}).format(n);
|
|
30
|
+
}
|
|
31
|
+
const h = {
|
|
32
|
+
short: { year: "numeric", month: "numeric", day: "numeric" },
|
|
33
|
+
medium: { year: "numeric", month: "short", day: "numeric" },
|
|
34
|
+
long: { year: "numeric", month: "long", day: "numeric" },
|
|
35
|
+
full: { weekday: "long", year: "numeric", month: "long", day: "numeric" },
|
|
36
|
+
datetime: {
|
|
37
|
+
year: "numeric",
|
|
38
|
+
month: "short",
|
|
39
|
+
day: "numeric",
|
|
40
|
+
hour: "numeric",
|
|
41
|
+
minute: "numeric"
|
|
42
|
+
},
|
|
43
|
+
time: { hour: "numeric", minute: "numeric" }
|
|
44
|
+
};
|
|
45
|
+
function f(n) {
|
|
46
|
+
if (n == null) return null;
|
|
47
|
+
const e = n instanceof Date ? n : new Date(n);
|
|
48
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
49
|
+
}
|
|
50
|
+
function y(n, e = {}) {
|
|
51
|
+
const t = f(n);
|
|
52
|
+
if (!t) return "";
|
|
53
|
+
const { locale: o = "en-US", preset: r = "medium" } = e;
|
|
54
|
+
return new Intl.DateTimeFormat(o, h[r]).format(t);
|
|
55
|
+
}
|
|
56
|
+
const g = [
|
|
57
|
+
["year", 3600 * 24 * 365],
|
|
58
|
+
["month", 3600 * 24 * 30],
|
|
59
|
+
["week", 3600 * 24 * 7],
|
|
60
|
+
["day", 3600 * 24],
|
|
61
|
+
["hour", 3600],
|
|
62
|
+
["minute", 60],
|
|
63
|
+
["second", 1]
|
|
64
|
+
];
|
|
65
|
+
function N(n, e = {}) {
|
|
66
|
+
const t = f(n);
|
|
67
|
+
if (!t) return "";
|
|
68
|
+
const { locale: o = "en-US", now: r = Date.now() } = e, i = typeof r == "number" ? r : r.getTime(), m = Math.round((t.getTime() - i) / 1e3), u = Math.abs(m);
|
|
69
|
+
for (const [a, c] of g)
|
|
70
|
+
if (u >= c || a === "second") {
|
|
71
|
+
const d = Math.round(m / c);
|
|
72
|
+
return new Intl.RelativeTimeFormat(o, { numeric: "auto" }).format(d, a);
|
|
73
|
+
}
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
const l = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
77
|
+
function T(n, e = {}) {
|
|
78
|
+
if (n == null || Number.isNaN(n)) return "";
|
|
79
|
+
const { decimals: t = 1, binary: o = !1 } = e, r = o ? 1024 : 1e3;
|
|
80
|
+
if (n === 0) return "0 B";
|
|
81
|
+
const i = Math.min(Math.floor(Math.log(Math.abs(n)) / Math.log(r)), l.length - 1);
|
|
82
|
+
return (n / Math.pow(r, i)).toFixed(t) + " " + l[i];
|
|
83
|
+
}
|
|
84
|
+
function b({
|
|
85
|
+
date: n,
|
|
86
|
+
mode: e = "relative",
|
|
87
|
+
updateInterval: t = 6e4,
|
|
88
|
+
locale: o,
|
|
89
|
+
preset: r,
|
|
90
|
+
...i
|
|
91
|
+
}) {
|
|
92
|
+
const [, m] = s.useReducer((c) => c + 1, 0);
|
|
93
|
+
s.useEffect(() => {
|
|
94
|
+
if (e !== "relative") return;
|
|
95
|
+
const c = window.setInterval(() => m(), t);
|
|
96
|
+
return () => window.clearInterval(c);
|
|
97
|
+
}, [e, t]);
|
|
98
|
+
const u = e === "relative" ? N(n, o ? { locale: o } : void 0) : y(n, { locale: o, preset: r }), a = (() => {
|
|
99
|
+
const c = f(n);
|
|
100
|
+
return c ? c.toISOString() : void 0;
|
|
101
|
+
})();
|
|
102
|
+
return s.createElement("time", { dateTime: a, ...i }, u);
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
b as Time,
|
|
106
|
+
T as formatBytes,
|
|
107
|
+
w as formatCurrency,
|
|
108
|
+
y as formatDate,
|
|
109
|
+
S as formatNumber,
|
|
110
|
+
N as timeAgo
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sources":["../src/lib/format.ts"],"sourcesContent":["/**\n * Locale-aware formatters for @bloomneo/uikit.\n *\n * Thin, zero-dependency wrappers around the platform `Intl.*` APIs and the\n * Web `Date` constructor. Importing this module never pulls in another\n * library; the only cost is the formatter functions themselves.\n *\n * Every formatter is safe to call with `null` / `undefined` — it returns an\n * empty string instead of crashing — so cell renderers and inline JSX can use\n * them without defensive null checks.\n */\n\nimport * as React from 'react';\n\nexport type Nullable<T> = T | null | undefined;\n\nexport interface FormatCurrencyOptions {\n /** ISO 4217 currency code. Default: \"USD\". */\n currency?: string;\n /** BCP 47 locale tag. Default: \"en-US\". */\n locale?: string;\n /** Minimum fraction digits. Default: 2. */\n minimumFractionDigits?: number;\n /** Maximum fraction digits. Default: 2. */\n maximumFractionDigits?: number;\n}\n\n/** Format a number as currency. Returns \"\" for null/undefined/NaN. */\nexport function formatCurrency(\n value: Nullable<number>,\n options: FormatCurrencyOptions = {}\n): string {\n if (value == null || Number.isNaN(value)) return '';\n const {\n currency = 'USD',\n locale = 'en-US',\n minimumFractionDigits = 2,\n maximumFractionDigits = 2,\n } = options;\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits,\n maximumFractionDigits,\n }).format(value);\n}\n\nexport interface FormatNumberOptions {\n locale?: string;\n minimumFractionDigits?: number;\n maximumFractionDigits?: number;\n /** Render as percentage (multiplies by 100). Default: false. */\n percent?: boolean;\n}\n\n/** Format a plain number with locale grouping. */\nexport function formatNumber(\n value: Nullable<number>,\n options: FormatNumberOptions = {}\n): string {\n if (value == null || Number.isNaN(value)) return '';\n const {\n locale = 'en-US',\n minimumFractionDigits = 0,\n maximumFractionDigits = 2,\n percent = false,\n } = options;\n return new Intl.NumberFormat(locale, {\n style: percent ? 'percent' : 'decimal',\n minimumFractionDigits,\n maximumFractionDigits,\n }).format(value);\n}\n\nexport type DateInput = Nullable<Date | string | number>;\n\nexport interface FormatDateOptions {\n locale?: string;\n /** Intl.DateTimeFormat options, or one of the named presets. */\n preset?: 'short' | 'medium' | 'long' | 'full' | 'datetime' | 'time';\n}\n\nconst DATE_PRESETS: Record<NonNullable<FormatDateOptions['preset']>, Intl.DateTimeFormatOptions> = {\n short: { year: 'numeric', month: 'numeric', day: 'numeric' },\n medium: { year: 'numeric', month: 'short', day: 'numeric' },\n long: { year: 'numeric', month: 'long', day: 'numeric' },\n full: { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' },\n datetime: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n time: { hour: 'numeric', minute: 'numeric' },\n};\n\nfunction toDate(input: DateInput): Date | null {\n if (input == null) return null;\n const d = input instanceof Date ? input : new Date(input);\n return Number.isNaN(d.getTime()) ? null : d;\n}\n\n/** Format a date with a sensible preset. */\nexport function formatDate(input: DateInput, options: FormatDateOptions = {}): string {\n const date = toDate(input);\n if (!date) return '';\n const { locale = 'en-US', preset = 'medium' } = options;\n return new Intl.DateTimeFormat(locale, DATE_PRESETS[preset]).format(date);\n}\n\nconst RELATIVE_THRESHOLDS: Array<[Intl.RelativeTimeFormatUnit, number]> = [\n ['year', 60 * 60 * 24 * 365],\n ['month', 60 * 60 * 24 * 30],\n ['week', 60 * 60 * 24 * 7],\n ['day', 60 * 60 * 24],\n ['hour', 60 * 60],\n ['minute', 60],\n ['second', 1],\n];\n\nexport interface TimeAgoOptions {\n locale?: string;\n /** Reference point. Default: Date.now(). */\n now?: Date | number;\n}\n\n/**\n * Returns a relative time string like \"3 minutes ago\" or \"in 2 days\".\n * Uses Intl.RelativeTimeFormat for proper locale support.\n */\nexport function timeAgo(input: DateInput, options: TimeAgoOptions = {}): string {\n const date = toDate(input);\n if (!date) return '';\n const { locale = 'en-US', now = Date.now() } = options;\n const nowMs = typeof now === 'number' ? now : now.getTime();\n const diffSeconds = Math.round((date.getTime() - nowMs) / 1000);\n const absSeconds = Math.abs(diffSeconds);\n\n for (const [unit, secondsInUnit] of RELATIVE_THRESHOLDS) {\n if (absSeconds >= secondsInUnit || unit === 'second') {\n const value = Math.round(diffSeconds / secondsInUnit);\n return new Intl.RelativeTimeFormat(locale, { numeric: 'auto' }).format(value, unit);\n }\n }\n return '';\n}\n\nconst BYTE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\n\nexport interface FormatBytesOptions {\n /** Number of decimal places. Default: 1. */\n decimals?: number;\n /** Use binary (1024) or decimal (1000) base. Default: decimal. */\n binary?: boolean;\n}\n\n/** Format a byte count as a human-readable string (\"1.4 MB\", \"512 KB\"). */\nexport function formatBytes(value: Nullable<number>, options: FormatBytesOptions = {}): string {\n if (value == null || Number.isNaN(value)) return '';\n const { decimals = 1, binary = false } = options;\n const base = binary ? 1024 : 1000;\n if (value === 0) return '0 B';\n const i = Math.min(Math.floor(Math.log(Math.abs(value)) / Math.log(base)), BYTE_UNITS.length - 1);\n const scaled = value / Math.pow(base, i);\n return scaled.toFixed(decimals) + ' ' + BYTE_UNITS[i];\n}\n\n/* ------------------------------------------------------------------------- */\n/* <Time /> — auto-updating relative timestamp */\n/* ------------------------------------------------------------------------- */\n\nexport interface TimeProps extends Omit<React.HTMLAttributes<HTMLTimeElement>, 'children'> {\n /** Timestamp to format. */\n date: DateInput;\n /** \"relative\" → \"3 minutes ago\"; \"absolute\" → \"Jan 5, 2026\". Default: \"relative\". */\n mode?: 'relative' | 'absolute';\n /** Update interval in milliseconds for relative mode. Default: 60_000. */\n updateInterval?: number;\n /** Locale tag. */\n locale?: string;\n /** Preset for absolute mode. */\n preset?: FormatDateOptions['preset'];\n}\n\n/**\n * `<Time />` renders a `<time>` element whose contents update on an interval\n * (relative mode) or once (absolute mode). Use this in chat threads, activity\n * feeds, dashboards — anywhere you want \"5 minutes ago\" to become \"6 minutes\n * ago\" without re-rendering the parent.\n */\nexport function Time({\n date,\n mode = 'relative',\n updateInterval = 60_000,\n locale,\n preset,\n ...rest\n}: TimeProps): React.JSX.Element {\n const [, force] = React.useReducer((n: number) => n + 1, 0);\n\n React.useEffect(() => {\n if (mode !== 'relative') return;\n const id = window.setInterval(() => force(), updateInterval);\n return () => window.clearInterval(id);\n }, [mode, updateInterval]);\n\n const text =\n mode === 'relative'\n ? timeAgo(date, locale ? { locale } : undefined)\n : formatDate(date, { locale, preset });\n\n const iso = (() => {\n const d = toDate(date);\n return d ? d.toISOString() : undefined;\n })();\n\n return React.createElement('time', { dateTime: iso, ...rest }, text);\n}\n"],"names":["formatCurrency","value","options","currency","locale","minimumFractionDigits","maximumFractionDigits","formatNumber","percent","DATE_PRESETS","toDate","input","d","formatDate","date","preset","RELATIVE_THRESHOLDS","timeAgo","now","nowMs","diffSeconds","absSeconds","unit","secondsInUnit","BYTE_UNITS","formatBytes","decimals","binary","base","Time","mode","updateInterval","rest","force","React","n","id","text","iso"],"mappings":";AA4BO,SAASA,EACdC,GACAC,IAAiC,IACzB;AACR,MAAID,KAAS,QAAQ,OAAO,MAAMA,CAAK,EAAG,QAAO;AACjD,QAAM;AAAA,IACJ,UAAAE,IAAW;AAAA,IACX,QAAAC,IAAS;AAAA,IACT,uBAAAC,IAAwB;AAAA,IACxB,uBAAAC,IAAwB;AAAA,EAAA,IACtBJ;AACJ,SAAO,IAAI,KAAK,aAAaE,GAAQ;AAAA,IACnC,OAAO;AAAA,IACP,UAAAD;AAAA,IACA,uBAAAE;AAAA,IACA,uBAAAC;AAAA,EAAA,CACD,EAAE,OAAOL,CAAK;AACjB;AAWO,SAASM,EACdN,GACAC,IAA+B,IACvB;AACR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CAAI,CAAC,GAAGJ,EAAW,SAAS,CAAC;AAEhG,UADevB,IAAQ,KAAK,IAAI2B,GAAM,CAAC,GACzB,QAAQF,CAAQ,IAAI,MAAMF,EAAW,CAAC;AACtD;AAyBO,SAASK,EAAK;AAAA,EACnB,MAAAf;AAAA,EACA,MAAAgB,IAAO;AAAA,EACP,gBAAAC,IAAiB;AAAA,EACjB,QAAA3B;AAAA,EACA,QAAAW;AAAA,EACA,GAAGiB;AACL,GAAiC;AAC/B,QAAM,CAAA,EAAGC,CAAK,IAAIC,EAAM,WAAW,CAACC,MAAcA,IAAI,GAAG,CAAC;AAE1D,EAAAD,EAAM,UAAU,MAAM;AACpB,QAAIJ,MAAS,WAAY;AACzB,UAAMM,IAAK,OAAO,YAAY,MAAMH,EAAA,GAASF,CAAc;AAC3D,WAAO,MAAM,OAAO,cAAcK,CAAE;AAAA,EACtC,GAAG,CAACN,GAAMC,CAAc,CAAC;AAEzB,QAAMM,IACJP,MAAS,aACLb,EAAQH,GAAMV,IAAS,EAAE,QAAAA,EAAA,IAAW,MAAS,IAC7CS,EAAWC,GAAM,EAAE,QAAAV,GAAQ,QAAAW,GAAQ,GAEnCuB,KAAO,MAAM;AACjB,UAAM1B,IAAIF,EAAOI,CAAI;AACrB,WAAOF,IAAIA,EAAE,YAAA,IAAgB;AAAA,EAC/B,GAAA;AAEA,SAAOsB,EAAM,cAAc,QAAQ,EAAE,UAAUI,GAAK,GAAGN,EAAA,GAAQK,CAAI;AACrE;"}
|
package/dist/fouc.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function d(e = {}) {
|
|
2
|
+
const t = e.storageKey ?? "uikit-theme", r = e.defaultTheme ?? "base", c = e.defaultMode ?? "light", a = e.detectSystem ?? !0;
|
|
3
|
+
return [
|
|
4
|
+
"(function(){try{",
|
|
5
|
+
"var k=" + JSON.stringify(t) + ";",
|
|
6
|
+
"var dt=" + JSON.stringify(r) + ";",
|
|
7
|
+
"var dm=" + JSON.stringify(c) + ";",
|
|
8
|
+
"var ds=" + (a ? "true" : "false") + ";",
|
|
9
|
+
"var t=dt,m=dm;",
|
|
10
|
+
"var s=null;try{s=localStorage.getItem(k);}catch(e){}",
|
|
11
|
+
'if(s){try{var p=JSON.parse(s);if(p&&p.theme)t=p.theme;if(p&&(p.mode==="light"||p.mode==="dark"))m=p.mode;}catch(e){}}',
|
|
12
|
+
'else if(ds&&window.matchMedia){m=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";}',
|
|
13
|
+
"var r=document.documentElement;",
|
|
14
|
+
"var cl=r.classList;",
|
|
15
|
+
'cl.remove("light","dark");',
|
|
16
|
+
'for(var i=cl.length-1;i>=0;i--){var c=cl[i];if(c.indexOf("theme-")===0)cl.remove(c);}',
|
|
17
|
+
'cl.add(m);cl.add("theme-"+t);',
|
|
18
|
+
"}catch(e){}})();"
|
|
19
|
+
].join("");
|
|
20
|
+
}
|
|
21
|
+
function i(e = {}) {
|
|
22
|
+
return "<script>" + d(e) + "<\/script>";
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
d as foucScript,
|
|
26
|
+
i as foucScriptTag
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=fouc.js.map
|
package/dist/fouc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fouc.js","sources":["../src/lib/fouc.ts"],"sourcesContent":["/**\n * FOUC (Flash of Unstyled Content) prevention helper for @bloomneo/uikit themes.\n *\n * The problem: <ThemeProvider> can only apply theme classes once React mounts.\n * On first paint the page briefly renders with the default theme (sky blue),\n * then snaps to the user's theme. Visible flash on every load.\n *\n * The fix: run a tiny script BEFORE the React bundle parses, reading the\n * persisted theme out of localStorage and writing the matching classes onto\n * <html> synchronously. By the time React mounts, the DOM is already correct.\n *\n * Usage in plain Vite / CRA:\n *\n * // index.html\n * <head>\n * <script>{`__BLOOMNEO_UIKIT_FOUC__`}</script>\n * </head>\n *\n * Or copy the output of `foucScript()` directly into a literal <script> tag.\n *\n * Usage in Next.js (app router):\n *\n * // app/layout.tsx\n * import { foucScript } from '@bloomneo/uikit/fouc';\n *\n * export default function RootLayout({ children }) {\n * return (\n * <html>\n * <head>\n * <script dangerouslySetInnerHTML={{ __html: foucScript() }} />\n * </head>\n * <body>{children}</body>\n * </html>\n * );\n * }\n *\n * Both forms must be passed the same `storageKey` and `defaultTheme` /\n * `defaultMode` you give to <ThemeProvider>, otherwise the inline script and\n * the React provider will disagree on first paint.\n */\n\nexport interface FoucScriptOptions {\n /** Storage key used by ThemeProvider. Default: \"uikit-theme\" */\n storageKey?: string;\n /** Theme to fall back to when nothing is stored. Default: \"base\" */\n defaultTheme?: string;\n /** Mode to fall back to when nothing is stored. Default: \"light\" */\n defaultMode?: 'light' | 'dark';\n /** Whether to honor `prefers-color-scheme` when no value is stored. Default: true */\n detectSystem?: boolean;\n}\n\n/**\n * Returns a self-contained JavaScript snippet (no imports, no globals) that\n * applies the persisted theme + mode classes onto <html> synchronously.\n *\n * The snippet is intentionally tiny (~600 bytes minified) and uses no template\n * literals so it can be safely embedded in HTML without escaping pitfalls.\n */\nexport function foucScript(options: FoucScriptOptions = {}): string {\n const storageKey = options.storageKey ?? 'uikit-theme';\n const defaultTheme = options.defaultTheme ?? 'base';\n const defaultMode = options.defaultMode ?? 'light';\n const detectSystem = options.detectSystem ?? true;\n\n // Build the script as a string. Avoid template literals inside the snippet\n // so it can be embedded in HTML without escaping.\n return [\n '(function(){try{',\n 'var k=' + JSON.stringify(storageKey) + ';',\n 'var dt=' + JSON.stringify(defaultTheme) + ';',\n 'var dm=' + JSON.stringify(defaultMode) + ';',\n 'var ds=' + (detectSystem ? 'true' : 'false') + ';',\n 'var t=dt,m=dm;',\n 'var s=null;try{s=localStorage.getItem(k);}catch(e){}',\n 'if(s){try{var p=JSON.parse(s);if(p&&p.theme)t=p.theme;if(p&&(p.mode===\"light\"||p.mode===\"dark\"))m=p.mode;}catch(e){}}',\n 'else if(ds&&window.matchMedia){m=window.matchMedia(\"(prefers-color-scheme: dark)\").matches?\"dark\":\"light\";}',\n 'var r=document.documentElement;',\n 'var cl=r.classList;',\n 'cl.remove(\"light\",\"dark\");',\n 'for(var i=cl.length-1;i>=0;i--){var c=cl[i];if(c.indexOf(\"theme-\")===0)cl.remove(c);}',\n 'cl.add(m);cl.add(\"theme-\"+t);',\n '}catch(e){}})();',\n ].join('');\n}\n\n/**\n * Convenience: returns the full <script> tag string. Use when concatenating\n * into raw HTML rather than via React's `dangerouslySetInnerHTML`.\n */\nexport function foucScriptTag(options: FoucScriptOptions = {}): string {\n return '<script>' + foucScript(options) + '</script>';\n}\n"],"names":["foucScript","options","storageKey","defaultTheme","defaultMode","detectSystem","foucScriptTag"],"mappings":"AA2DO,SAASA,EAAWC,IAA6B,IAAY;AAClE,QAAMC,IAAaD,EAAQ,cAAc,eACnCE,IAAeF,EAAQ,gBAAgB,QACvCG,IAAcH,EAAQ,eAAe,SACrCI,IAAeJ,EAAQ,gBAAgB;AAI7C,SAAO;AAAA,IACL;AAAA,IACA,WAAW,KAAK,UAAUC,CAAU,IAAI;AAAA,IACxC,YAAY,KAAK,UAAUC,CAAY,IAAI;AAAA,IAC3C,YAAY,KAAK,UAAUC,CAAW,IAAI;AAAA,IAC1C,aAAaC,IAAe,SAAS,WAAW;AAAA,IAChD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,EAAE;AACX;AAMO,SAASC,EAAcL,IAA6B,IAAY;AACrE,SAAO,aAAaD,EAAWC,CAAO,IAAI;AAC5C;"}
|