@react-pakistan/util-functions 2.0.2 → 3.0.1
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/constants/api-methods.d.mts +13 -0
- package/constants/api-methods.mjs +1 -0
- package/constants/cache-time.d.mts +7 -0
- package/constants/cache-time.mjs +1 -0
- package/constants/countries-timezones.d.mts +8 -0
- package/constants/countries-timezones.mjs +1 -0
- package/constants/currencies.d.mts +14 -0
- package/constants/currencies.mjs +1 -0
- package/constants/dial-codes.d.mts +9 -0
- package/constants/dial-codes.mjs +1 -0
- package/constants/layout-direction.d.mts +6 -0
- package/constants/layout-direction.mjs +1 -0
- package/constants/react-pakistan-meta.d.mts +32 -0
- package/constants/react-pakistan-meta.mjs +1 -0
- package/constants/react-pakistan.d.mts +15 -0
- package/constants/react-pakistan.mjs +12 -0
- package/constants/select-value-delimiter.d.mts +12 -0
- package/constants/select-value-delimiter.mjs +1 -0
- package/constants/social-media-colors.d.mts +40 -0
- package/constants/social-media-colors.mjs +1 -0
- package/constants/social-media-sizes.d.mts +323 -0
- package/constants/social-media-sizes.mjs +1 -0
- package/constants/user-roles.d.mts +7 -0
- package/constants/user-roles.mjs +1 -0
- package/factory/generic-component-factory.d.mts +78 -0
- package/factory/generic-component-factory.mjs +1 -0
- package/factory/generic-module-factory.d.mts +80 -0
- package/factory/generic-module-factory.mjs +1 -0
- package/general/basic-get.d.mts +8 -0
- package/general/basic-get.mjs +1 -0
- package/general/basic-post.d.mts +8 -0
- package/general/basic-post.mjs +1 -0
- package/general/calculate-pages.d.mts +9 -0
- package/general/calculate-pages.mjs +1 -0
- package/general/camel-to-sentence-case.d.mts +12 -0
- package/general/camel-to-sentence-case.mjs +1 -0
- package/general/check-even-odd-length.d.mts +13 -0
- package/general/check-even-odd-length.mjs +1 -0
- package/general/clear-cache.d.mts +10 -0
- package/general/clear-cache.mjs +1 -0
- package/general/cnic-formatter.d.mts +20 -0
- package/general/cnic-formatter.mjs +1 -0
- package/general/convert-url-to-base64.d.mts +57 -0
- package/general/convert-url-to-base64.mjs +1 -0
- package/general/countries.d.mts +268 -0
- package/general/countries.mjs +1 -0
- package/general/create-date.d.mts +12 -0
- package/general/create-date.js +1 -1
- package/general/create-date.mjs +1 -0
- package/general/crypto.d.mts +11 -0
- package/general/crypto.mjs +1 -0
- package/general/currencies.d.mts +2 -0
- package/general/currencies.mjs +0 -0
- package/general/delete-image-from-private-supabase.d.mts +16 -0
- package/general/delete-image-from-private-supabase.mjs +1 -0
- package/general/delete-image-from-public-supabase.d.mts +16 -0
- package/general/delete-image-from-public-supabase.mjs +1 -0
- package/general/download-from-url.d.mts +8 -0
- package/general/download-from-url.mjs +1 -0
- package/general/dynamic-page-limit.d.mts +12 -0
- package/general/dynamic-page-limit.mjs +1 -0
- package/general/enum-to-text.d.mts +8 -0
- package/general/enum-to-text.mjs +1 -0
- package/general/fetch-data.d.mts +25 -0
- package/general/fetch-data.mjs +1 -0
- package/general/fetch-supabase-image.d.mts +16 -0
- package/general/fetch-supabase-image.mjs +1 -0
- package/general/fetch-supabase-private-assets.d.mts +15 -0
- package/general/fetch-supabase-private-assets.mjs +1 -0
- package/general/format-date.d.mts +18 -0
- package/general/format-date.mjs +1 -0
- package/general/format-number.d.mts +16 -0
- package/general/format-number.mjs +1 -0
- package/general/format-phone-display.d.mts +9 -0
- package/general/format-phone-display.js +1 -1
- package/general/format-phone-display.mjs +1 -0
- package/general/format-phone.d.mts +13 -0
- package/general/format-phone.d.ts +1 -3
- package/general/format-phone.js +1 -1
- package/general/format-phone.mjs +1 -0
- package/general/format-pricing.d.mts +8 -0
- package/general/format-pricing.mjs +1 -0
- package/general/format-secs.d.mts +8 -0
- package/general/format-secs.mjs +1 -0
- package/general/format-time.d.mts +11 -0
- package/general/format-time.mjs +1 -0
- package/general/format-value.d.mts +8 -0
- package/general/format-value.mjs +1 -0
- package/general/full-month-range.d.mts +13 -0
- package/general/full-month-range.mjs +1 -0
- package/general/full-year-range.d.mts +12 -0
- package/general/full-year-range.mjs +1 -0
- package/general/generate-article-schema.d.mts +50 -0
- package/general/generate-article-schema.mjs +1 -0
- package/general/generate-blog-schema.d.mts +37 -0
- package/general/generate-blog-schema.mjs +1 -0
- package/general/generate-book-schema.d.mts +58 -0
- package/general/generate-book-schema.mjs +1 -0
- package/general/generate-breadcrumb-schema.d.mts +40 -0
- package/general/generate-breadcrumb-schema.mjs +1 -0
- package/general/generate-carousel-schema.d.mts +52 -0
- package/general/generate-carousel-schema.mjs +1 -0
- package/general/generate-course-schema.d.mts +53 -0
- package/general/generate-course-schema.mjs +1 -0
- package/general/generate-dataset-schema.d.mts +65 -0
- package/general/generate-dataset-schema.mjs +1 -0
- package/general/generate-discussion-forum-schema.d.mts +39 -0
- package/general/generate-discussion-forum-schema.mjs +1 -0
- package/general/generate-education-schema.d.mts +68 -0
- package/general/generate-education-schema.mjs +1 -0
- package/general/generate-employer-aggregate-rating-schema.d.mts +29 -0
- package/general/generate-employer-aggregate-rating-schema.mjs +1 -0
- package/general/generate-event-schema.d.mts +63 -0
- package/general/generate-event-schema.mjs +1 -0
- package/general/generate-faq-schema.d.mts +32 -0
- package/general/generate-faq-schema.mjs +1 -0
- package/general/generate-grid.d.mts +17 -0
- package/general/generate-grid.mjs +1 -0
- package/general/generate-image-metadata-schema.d.mts +36 -0
- package/general/generate-image-metadata-schema.mjs +1 -0
- package/general/generate-job-posting-schema.d.mts +49 -0
- package/general/generate-job-posting-schema.mjs +1 -0
- package/general/generate-local-business-schema.d.mts +42 -0
- package/general/generate-local-business-schema.mjs +1 -0
- package/general/generate-math-solver-schema.d.mts +45 -0
- package/general/generate-math-solver-schema.mjs +1 -0
- package/general/generate-movie-carousel-schema.d.mts +51 -0
- package/general/generate-movie-carousel-schema.mjs +1 -0
- package/general/generate-organization-schema.d.mts +49 -0
- package/general/generate-organization-schema.mjs +1 -0
- package/general/generate-profile-page-schema.d.mts +37 -0
- package/general/generate-profile-page-schema.mjs +1 -0
- package/general/generate-qa-page-schema.d.mts +34 -0
- package/general/generate-qa-page-schema.mjs +1 -0
- package/general/generate-recipe-schema.d.mts +49 -0
- package/general/generate-recipe-schema.mjs +1 -0
- package/general/generate-ref.d.mts +11 -0
- package/general/generate-ref.js +1 -1
- package/general/generate-ref.mjs +1 -0
- package/general/generate-review-snippet-schema.d.mts +52 -0
- package/general/generate-review-snippet-schema.mjs +1 -0
- package/general/generate-shopping-loyalty-program-schema.d.mts +38 -0
- package/general/generate-shopping-loyalty-program-schema.mjs +1 -0
- package/general/generate-shopping-merchant-listing-schema.d.mts +53 -0
- package/general/generate-shopping-merchant-listing-schema.mjs +1 -0
- package/general/generate-shopping-merchant-return-policy-schema.d.mts +32 -0
- package/general/generate-shopping-merchant-return-policy-schema.mjs +1 -0
- package/general/generate-shopping-merchant-shipping-policy-schema.d.mts +36 -0
- package/general/generate-shopping-merchant-shipping-policy-schema.mjs +1 -0
- package/general/generate-shopping-overview-schema.d.mts +52 -0
- package/general/generate-shopping-overview-schema.mjs +1 -0
- package/general/generate-shopping-product-snippet-schema.d.mts +57 -0
- package/general/generate-shopping-product-snippet-schema.mjs +1 -0
- package/general/generate-shopping-variants-schema.d.mts +46 -0
- package/general/generate-shopping-variants-schema.mjs +1 -0
- package/general/generate-software-app-schema.d.mts +62 -0
- package/general/generate-software-app-schema.mjs +1 -0
- package/general/generate-speakable-schema.d.mts +64 -0
- package/general/generate-speakable-schema.mjs +1 -0
- package/general/generate-subscription-schema.d.mts +60 -0
- package/general/generate-subscription-schema.mjs +1 -0
- package/general/generate-vacation-rental-schema.d.mts +67 -0
- package/general/generate-vacation-rental-schema.mjs +1 -0
- package/general/generate-video-schema.d.mts +75 -0
- package/general/generate-video-schema.mjs +1 -0
- package/general/generic-cache.d.mts +193 -0
- package/general/generic-cache.mjs +1 -0
- package/general/get-available-page-limit.d.mts +11 -0
- package/general/get-available-page-limit.mjs +1 -0
- package/general/get-calendar-current-month.d.mts +15 -0
- package/general/get-calendar-current-month.js +1 -1
- package/general/get-calendar-current-month.mjs +1 -0
- package/general/get-calendar-dates.d.mts +15 -0
- package/general/get-calendar-dates.js +1 -1
- package/general/get-calendar-dates.mjs +1 -0
- package/general/get-calendar-next-month.d.mts +17 -0
- package/general/get-calendar-next-month.js +1 -1
- package/general/get-calendar-next-month.mjs +1 -0
- package/general/get-calendar-previous-month.d.mts +17 -0
- package/general/get-calendar-previous-month.js +1 -1
- package/general/get-calendar-previous-month.mjs +1 -0
- package/general/get-current-year.d.mts +7 -0
- package/general/get-current-year.mjs +1 -0
- package/general/get-day-name.d.mts +10 -0
- package/general/get-day-name.mjs +1 -0
- package/general/get-dial-code.d.mts +8 -0
- package/general/get-dial-code.mjs +1 -0
- package/general/get-full-name.d.mts +13 -0
- package/general/get-full-name.mjs +1 -0
- package/general/get-href.d.mts +11 -0
- package/general/get-href.mjs +1 -0
- package/general/get-month-name.d.mts +10 -0
- package/general/get-month-name.mjs +1 -0
- package/general/get-month-number.d.mts +15 -0
- package/general/get-month-number.mjs +1 -0
- package/general/get-number-of-days-in-month.d.mts +13 -0
- package/general/get-number-of-days-in-month.js +1 -1
- package/general/get-number-of-days-in-month.mjs +1 -0
- package/general/get-pathname.d.mts +11 -0
- package/general/get-pathname.mjs +1 -0
- package/general/get-week-day.d.mts +8 -0
- package/general/get-week-day.js +1 -1
- package/general/get-week-day.mjs +1 -0
- package/general/image-url-to-base64.d.mts +9 -0
- package/general/image-url-to-base64.mjs +1 -0
- package/general/is-created-or-updated.d.mts +13 -0
- package/general/is-created-or-updated.mjs +1 -0
- package/general/is-next-button-disabled.d.mts +9 -0
- package/general/is-next-button-disabled.mjs +1 -0
- package/general/is-odd.d.mts +11 -0
- package/general/is-odd.mjs +1 -0
- package/general/is-previous-button-disabled.d.mts +8 -0
- package/general/is-previous-button-disabled.mjs +1 -0
- package/general/linear-gradients.d.mts +14 -0
- package/general/linear-gradients.mjs +1 -0
- package/general/multi-part-search.d.mts +22 -0
- package/general/multi-part-search.mjs +1 -0
- package/general/normalize-phone.d.mts +15 -0
- package/general/normalize-phone.js +1 -1
- package/general/normalize-phone.mjs +1 -0
- package/general/parse-frontmatter.d.mts +36 -0
- package/general/parse-frontmatter.mjs +2 -0
- package/general/remove-data-image-prefix.d.mts +8 -0
- package/general/remove-data-image-prefix.mjs +1 -0
- package/general/repeat-times.d.mts +15 -0
- package/general/repeat-times.mjs +1 -0
- package/general/resolve-anchor-link.d.mts +13 -0
- package/general/resolve-anchor-link.mjs +1 -0
- package/general/resolve-current-date.d.mts +12 -0
- package/general/resolve-current-date.mjs +1 -0
- package/general/resolve-grid.d.mts +14 -0
- package/general/resolve-grid.mjs +1 -0
- package/general/resolve-initials.d.mts +12 -0
- package/general/resolve-initials.mjs +1 -0
- package/general/set-timezone.d.mts +9 -0
- package/general/set-timezone.d.ts +1 -3
- package/general/set-timezone.js +1 -1
- package/general/set-timezone.mjs +1 -0
- package/general/slugify.d.mts +12 -0
- package/general/slugify.mjs +1 -0
- package/general/text-to-enum.d.mts +8 -0
- package/general/text-to-enum.mjs +1 -0
- package/general/text-to-sentence-case.d.mts +12 -0
- package/general/text-to-sentence-case.mjs +1 -0
- package/general/time-out.d.mts +12 -0
- package/general/time-out.mjs +1 -0
- package/general/time-zones.d.mts +11 -0
- package/general/time-zones.mjs +1 -0
- package/general/truncate-text.d.mts +14 -0
- package/general/truncate-text.mjs +1 -0
- package/general/type.d.mts +8 -0
- package/general/type.mjs +0 -0
- package/general/upload-blob-to-private-supabase.d.mts +24 -0
- package/general/upload-blob-to-private-supabase.mjs +1 -0
- package/general/upload-blob-to-public-supabase.d.mts +24 -0
- package/general/upload-blob-to-public-supabase.mjs +1 -0
- package/general/upload-image-to-private-supabase.d.mts +26 -0
- package/general/upload-image-to-private-supabase.mjs +1 -0
- package/general/upload-image-to-public-supabase.d.mts +26 -0
- package/general/upload-image-to-public-supabase.mjs +1 -0
- package/general/url-to-sentence-case.d.mts +12 -0
- package/general/url-to-sentence-case.mjs +1 -0
- package/general/validate-comment.d.mts +14 -0
- package/general/validate-comment.mjs +1 -0
- package/general/validate-email.d.mts +15 -0
- package/general/validate-email.mjs +1 -0
- package/general/validate-form.d.mts +18 -0
- package/general/validate-form.mjs +1 -0
- package/general/validate-name.d.mts +14 -0
- package/general/validate-name.mjs +1 -0
- package/hooks/use-change.d.mts +11 -0
- package/hooks/use-change.mjs +1 -0
- package/hooks/use-debounce.d.mts +10 -0
- package/hooks/use-debounce.mjs +1 -0
- package/hooks/use-fetch.d.mts +42 -0
- package/hooks/use-fetch.mjs +1 -0
- package/hooks/use-force-render.d.mts +14 -0
- package/hooks/use-force-render.mjs +1 -0
- package/hooks/use-ip-geo-location.d.mts +12 -0
- package/hooks/use-ip-geo-location.mjs +1 -0
- package/hooks/use-is-mobile.d.mts +8 -0
- package/hooks/use-is-mobile.mjs +1 -0
- package/hooks/use-module-entity-v2.d.mts +105 -0
- package/hooks/use-module-entity-v2.mjs +1 -0
- package/hooks/use-module-entity.d.mts +98 -0
- package/hooks/use-module-entity.mjs +1 -0
- package/hooks/use-phone-formatter.d.mts +17 -0
- package/hooks/use-phone-formatter.d.ts +1 -3
- package/hooks/use-phone-formatter.js +1 -1
- package/hooks/use-phone-formatter.mjs +1 -0
- package/hooks/use-position.d.mts +29 -0
- package/hooks/use-position.mjs +1 -0
- package/hooks/use-rtl.d.mts +46 -0
- package/hooks/use-rtl.mjs +1 -0
- package/hooks/use-sticky.d.mts +13 -0
- package/hooks/use-sticky.mjs +1 -0
- package/hooks/use-toggle-state.d.mts +14 -0
- package/hooks/use-toggle-state.mjs +1 -0
- package/hooks/use-window-event-listener.d.mts +9 -0
- package/hooks/use-window-event-listener.mjs +1 -0
- package/hooks/with-seo.d.mts +19 -0
- package/hooks/with-seo.mjs +1 -0
- package/local-storage/get-storage-value.d.mts +5 -0
- package/local-storage/get-storage-value.mjs +1 -0
- package/local-storage/remove-storage-value.d.mts +3 -0
- package/local-storage/remove-storage-value.mjs +1 -0
- package/local-storage/set-storage-value.d.mts +3 -0
- package/local-storage/set-storage-value.mjs +1 -0
- package/local-storage/type.d.mts +3 -0
- package/local-storage/type.mjs +0 -0
- package/npm.d.d.mts +2 -0
- package/npm.d.mjs +0 -0
- package/package.json +1 -10
- package/edu-pilot-pro/types/academics.d.ts +0 -2
- package/edu-pilot-pro/types/academics.js +0 -1
- package/edu-pilot-pro/types/admission.d.ts +0 -878
- package/edu-pilot-pro/types/admission.js +0 -1
- package/edu-pilot-pro/types/communication.d.ts +0 -2
- package/edu-pilot-pro/types/communication.js +0 -1
- package/edu-pilot-pro/types/enums.d.ts +0 -413
- package/edu-pilot-pro/types/enums.js +0 -1
- package/edu-pilot-pro/types/finance.d.ts +0 -2
- package/edu-pilot-pro/types/finance.js +0 -1
- package/edu-pilot-pro/types/index.d.ts +0 -2
- package/edu-pilot-pro/types/index.js +0 -1
- package/edu-pilot-pro/types/user-management.d.ts +0 -2
- package/edu-pilot-pro/types/user-management.js +0 -1
- package/stellar-solution/types/common.d.ts +0 -26
- package/stellar-solution/types/common.js +0 -1
- package/stellar-solution/types/erp.d.ts +0 -305
- package/stellar-solution/types/erp.js +0 -1
- package/stellar-solution/types/index.d.ts +0 -3
- package/stellar-solution/types/index.js +0 -1
- package/stellar-solution/types/pos.d.ts +0 -179
- package/stellar-solution/types/pos.js +0 -1
- package/storybook/generate-sitemap.d.ts +0 -16
- package/storybook/generate-sitemap.js +0 -17
- package/storybook/preview.d.ts +0 -148
- package/storybook/preview.js +0 -1
- package/storybook/react-design-story-script.d.ts +0 -12
- package/storybook/react-design-story-script.js +0 -5
- package/storybook/react-emoji-collection.d.ts +0 -13
- package/storybook/react-emoji-collection.js +0 -11
- package/storybook/react-emoji-story-script.d.ts +0 -12
- package/storybook/react-emoji-story-script.js +0 -5
- package/storybook/react-emoji-story-template.d.ts +0 -14
- package/storybook/react-emoji-story-template.js +0 -46
- package/storybook/react-icon-collection.d.ts +0 -13
- package/storybook/react-icon-collection.js +0 -11
- package/storybook/react-icon-story-script.d.ts +0 -12
- package/storybook/react-icon-story-script.js +0 -5
- package/storybook/react-icon-story-template.d.ts +0 -13
- package/storybook/react-icon-story-template.js +0 -46
- package/storybook/react-logo-collection.d.ts +0 -13
- package/storybook/react-logo-collection.js +0 -11
- package/storybook/react-logo-story-script.d.ts +0 -12
- package/storybook/react-logo-story-script.js +0 -5
- package/storybook/react-logo-story-template.d.ts +0 -13
- package/storybook/react-logo-story-template.js +0 -46
- package/storybook/react-pakistan-theme.d.ts +0 -25
- package/storybook/react-pakistan-theme.js +0 -1
- package/storybook/responsive-args.d.ts +0 -22
- package/storybook/responsive-args.js +0 -1
- package/storybook/responsive-component.d.ts +0 -33
- package/storybook/responsive-component.js +0 -37
- package/storybook/responsive-screens.d.ts +0 -108
- package/storybook/responsive-screens.js +0 -1
- package/storybook/theme.d.ts +0 -96
- package/storybook/theme.js +0 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
declare enum SOCIAL_MEDIA_POST_TYPES {
|
|
2
|
+
FACEBOOK_COVER_PHOTO = "FACEBOOK_COVER_PHOTO",
|
|
3
|
+
FACEBOOK_EVENT_COVER = "FACEBOOK_EVENT_COVER",
|
|
4
|
+
FACEBOOK_PROFILE_PHOTO = "FACEBOOK_PROFILE_PHOTO",
|
|
5
|
+
FACEBOOK_POST_SHARE = "FACEBOOK_POST_SHARE",
|
|
6
|
+
FACEBOOK_STORIES = "FACEBOOK_STORIES",
|
|
7
|
+
INSTAGRAM_PROFILE_PHOTO = "INSTAGRAM_PROFILE_PHOTO",
|
|
8
|
+
INSTAGRAM_PHOTO_SHARE = "INSTAGRAM_PHOTO_SHARE",
|
|
9
|
+
INSTAGRAM_STORIES = "INSTAGRAM_STORIES",
|
|
10
|
+
LINKEDIN_PROFILE_PHOTO = "LINKEDIN_PROFILE_PHOTO",
|
|
11
|
+
LINKEDIN_PROFILE_BACKGROUND = "LINKEDIN_PROFILE_BACKGROUND",
|
|
12
|
+
LINKEDIN_COMPANY_LOGO = "LINKEDIN_COMPANY_LOGO",
|
|
13
|
+
LINKEDIN_COMPANY_COVER = "LINKEDIN_COMPANY_COVER",
|
|
14
|
+
LINKEDIN_SHARED_IMAGE = "LINKEDIN_SHARED_IMAGE",
|
|
15
|
+
LINKEDIN_SHARED_IMAGE_LINK = "LINKEDIN_SHARED_IMAGE_LINK",
|
|
16
|
+
PINTEREST_PROFILE_PHOTO = "PINTEREST_PROFILE_PHOTO",
|
|
17
|
+
PINTEREST_BOARD_COVER = "PINTEREST_BOARD_COVER",
|
|
18
|
+
PINTEREST_SHARED_PIN = "PINTEREST_SHARED_PIN",
|
|
19
|
+
PINTEREST_PROFILE_COVER = "PINTEREST_PROFILE_COVER",
|
|
20
|
+
SNAPCHAT_SHARED_IMAGE = "SNAPCHAT_SHARED_IMAGE",
|
|
21
|
+
TWITTER_HEADER = "TWITTER_HEADER",
|
|
22
|
+
TWITTER_PROFILE_PHOTO = "TWITTER_PROFILE_PHOTO",
|
|
23
|
+
TWITTER_POST_SHARE = "TWITTER_POST_SHARE",
|
|
24
|
+
YOUTUBE_CHANNEL_PROFILE = "YOUTUBE_CHANNEL_PROFILE",
|
|
25
|
+
YOUTUBE_CHANNEL_COVER = "YOUTUBE_CHANNEL_COVER"
|
|
26
|
+
}
|
|
27
|
+
declare const SOCIAL_MEDIA_POST_SIZES: {
|
|
28
|
+
FACEBOOK_COVER_PHOTO: {
|
|
29
|
+
height: string;
|
|
30
|
+
width: string;
|
|
31
|
+
};
|
|
32
|
+
FACEBOOK_EVENT_COVER: {
|
|
33
|
+
height: string;
|
|
34
|
+
width: string;
|
|
35
|
+
};
|
|
36
|
+
FACEBOOK_PROFILE_PHOTO: {
|
|
37
|
+
height: string;
|
|
38
|
+
width: string;
|
|
39
|
+
};
|
|
40
|
+
FACEBOOK_POST_SHARE: {
|
|
41
|
+
height: string;
|
|
42
|
+
width: string;
|
|
43
|
+
};
|
|
44
|
+
FACEBOOK_STORIES: {
|
|
45
|
+
height: string;
|
|
46
|
+
width: string;
|
|
47
|
+
};
|
|
48
|
+
INSTAGRAM_PROFILE_PHOTO: {
|
|
49
|
+
height: string;
|
|
50
|
+
width: string;
|
|
51
|
+
};
|
|
52
|
+
INSTAGRAM_PHOTO_SHARE: {
|
|
53
|
+
height: string;
|
|
54
|
+
width: string;
|
|
55
|
+
};
|
|
56
|
+
INSTAGRAM_STORIES: {
|
|
57
|
+
height: string;
|
|
58
|
+
width: string;
|
|
59
|
+
};
|
|
60
|
+
LINKEDIN_PROFILE_PHOTO: {
|
|
61
|
+
height: string;
|
|
62
|
+
width: string;
|
|
63
|
+
};
|
|
64
|
+
LINKEDIN_PROFILE_BACKGROUND: {
|
|
65
|
+
height: string;
|
|
66
|
+
width: string;
|
|
67
|
+
};
|
|
68
|
+
LINKEDIN_COMPANY_LOGO: {
|
|
69
|
+
height: string;
|
|
70
|
+
width: string;
|
|
71
|
+
};
|
|
72
|
+
LINKEDIN_COMPANY_COVER: {
|
|
73
|
+
height: string;
|
|
74
|
+
width: string;
|
|
75
|
+
};
|
|
76
|
+
LINKEDIN_SHARED_IMAGE: {
|
|
77
|
+
height: string;
|
|
78
|
+
width: string;
|
|
79
|
+
};
|
|
80
|
+
LINKEDIN_SHARED_IMAGE_LINK: {
|
|
81
|
+
height: string;
|
|
82
|
+
width: string;
|
|
83
|
+
};
|
|
84
|
+
PINTEREST_PROFILE_PHOTO: {
|
|
85
|
+
height: string;
|
|
86
|
+
width: string;
|
|
87
|
+
};
|
|
88
|
+
PINTEREST_BOARD_COVER: {
|
|
89
|
+
height: string;
|
|
90
|
+
width: string;
|
|
91
|
+
};
|
|
92
|
+
PINTEREST_SHARED_PIN: {
|
|
93
|
+
height: string;
|
|
94
|
+
width: string;
|
|
95
|
+
};
|
|
96
|
+
PINTEREST_PROFILE_COVER: {
|
|
97
|
+
height: string;
|
|
98
|
+
width: string;
|
|
99
|
+
};
|
|
100
|
+
SNAPCHAT_SHARED_IMAGE: {
|
|
101
|
+
height: string;
|
|
102
|
+
width: string;
|
|
103
|
+
};
|
|
104
|
+
TWITTER_HEADER: {
|
|
105
|
+
height: string;
|
|
106
|
+
width: string;
|
|
107
|
+
};
|
|
108
|
+
TWITTER_PROFILE_PHOTO: {
|
|
109
|
+
height: string;
|
|
110
|
+
width: string;
|
|
111
|
+
};
|
|
112
|
+
TWITTER_POST_SHARE: {
|
|
113
|
+
height: string;
|
|
114
|
+
width: string;
|
|
115
|
+
};
|
|
116
|
+
YOUTUBE_CHANNEL_PROFILE: {
|
|
117
|
+
height: string;
|
|
118
|
+
width: string;
|
|
119
|
+
};
|
|
120
|
+
YOUTUBE_CHANNEL_COVER: {
|
|
121
|
+
height: string;
|
|
122
|
+
width: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
declare enum MOBILE_PLATFORM_TYPES {
|
|
126
|
+
ANDROID = "android",
|
|
127
|
+
IOS = "ios",
|
|
128
|
+
WINDOWS = "windows"
|
|
129
|
+
}
|
|
130
|
+
declare const MOBILE_PLATFORM_MEDIA_SIZES: {
|
|
131
|
+
android: {
|
|
132
|
+
appIcons: {
|
|
133
|
+
googlePlay: {
|
|
134
|
+
height: string;
|
|
135
|
+
width: string;
|
|
136
|
+
};
|
|
137
|
+
xxhdpi: {
|
|
138
|
+
height: string;
|
|
139
|
+
width: string;
|
|
140
|
+
};
|
|
141
|
+
xhdpi: {
|
|
142
|
+
height: string;
|
|
143
|
+
width: string;
|
|
144
|
+
};
|
|
145
|
+
hdpi: {
|
|
146
|
+
height: string;
|
|
147
|
+
width: string;
|
|
148
|
+
};
|
|
149
|
+
mdpi: {
|
|
150
|
+
height: string;
|
|
151
|
+
width: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
actionBarIcons: {
|
|
155
|
+
xxhdpi: {
|
|
156
|
+
height: string;
|
|
157
|
+
width: string;
|
|
158
|
+
};
|
|
159
|
+
xhdpi: {
|
|
160
|
+
height: string;
|
|
161
|
+
width: string;
|
|
162
|
+
};
|
|
163
|
+
hdpi: {
|
|
164
|
+
height: string;
|
|
165
|
+
width: string;
|
|
166
|
+
};
|
|
167
|
+
mdpi: {
|
|
168
|
+
height: string;
|
|
169
|
+
width: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
smallContextualIcons: {
|
|
173
|
+
xxhdpi: {
|
|
174
|
+
height: string;
|
|
175
|
+
width: string;
|
|
176
|
+
};
|
|
177
|
+
xhdpi: {
|
|
178
|
+
height: string;
|
|
179
|
+
width: string;
|
|
180
|
+
};
|
|
181
|
+
hdpi: {
|
|
182
|
+
height: string;
|
|
183
|
+
width: string;
|
|
184
|
+
};
|
|
185
|
+
mdpi: {
|
|
186
|
+
height: string;
|
|
187
|
+
width: string;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
notificationIcons: {
|
|
191
|
+
xxhdpi: {
|
|
192
|
+
height: string;
|
|
193
|
+
width: string;
|
|
194
|
+
};
|
|
195
|
+
xhdpi: {
|
|
196
|
+
height: string;
|
|
197
|
+
width: string;
|
|
198
|
+
};
|
|
199
|
+
hdpi: {
|
|
200
|
+
height: string;
|
|
201
|
+
width: string;
|
|
202
|
+
};
|
|
203
|
+
mdpi: {
|
|
204
|
+
height: string;
|
|
205
|
+
width: string;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
ios: {
|
|
210
|
+
appIcons: {
|
|
211
|
+
xxxxxlarge: {
|
|
212
|
+
height: string;
|
|
213
|
+
width: string;
|
|
214
|
+
};
|
|
215
|
+
xxxxlarge: {
|
|
216
|
+
height: string;
|
|
217
|
+
width: string;
|
|
218
|
+
};
|
|
219
|
+
xxxlarge: {
|
|
220
|
+
height: string;
|
|
221
|
+
width: string;
|
|
222
|
+
};
|
|
223
|
+
xxlarge: {
|
|
224
|
+
height: string;
|
|
225
|
+
width: string;
|
|
226
|
+
};
|
|
227
|
+
xlarge: {
|
|
228
|
+
height: string;
|
|
229
|
+
width: string;
|
|
230
|
+
};
|
|
231
|
+
large: {
|
|
232
|
+
height: string;
|
|
233
|
+
width: string;
|
|
234
|
+
};
|
|
235
|
+
medium: {
|
|
236
|
+
height: string;
|
|
237
|
+
width: string;
|
|
238
|
+
};
|
|
239
|
+
small: {
|
|
240
|
+
height: string;
|
|
241
|
+
width: string;
|
|
242
|
+
};
|
|
243
|
+
xsmall: {
|
|
244
|
+
height: string;
|
|
245
|
+
width: string;
|
|
246
|
+
};
|
|
247
|
+
xxsmall: {
|
|
248
|
+
height: string;
|
|
249
|
+
width: string;
|
|
250
|
+
};
|
|
251
|
+
xxxsmall: {
|
|
252
|
+
height: string;
|
|
253
|
+
width: string;
|
|
254
|
+
};
|
|
255
|
+
xxxxsmall: {
|
|
256
|
+
height: string;
|
|
257
|
+
width: string;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
toolBarNavBarIcons: {
|
|
261
|
+
large: {
|
|
262
|
+
height: string;
|
|
263
|
+
width: string;
|
|
264
|
+
};
|
|
265
|
+
small: {
|
|
266
|
+
height: string;
|
|
267
|
+
width: string;
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
tabBarIcons: {
|
|
271
|
+
large: {
|
|
272
|
+
height: string;
|
|
273
|
+
width: string;
|
|
274
|
+
};
|
|
275
|
+
small: {
|
|
276
|
+
height: string;
|
|
277
|
+
width: string;
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
appleWatchNotificationCenterIcons: {
|
|
281
|
+
large: {
|
|
282
|
+
height: string;
|
|
283
|
+
width: string;
|
|
284
|
+
};
|
|
285
|
+
small: {
|
|
286
|
+
height: string;
|
|
287
|
+
width: string;
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
appleWatchLongLookNotificationIcons: {
|
|
291
|
+
largeWatch: {
|
|
292
|
+
height: string;
|
|
293
|
+
width: string;
|
|
294
|
+
};
|
|
295
|
+
smallWatch: {
|
|
296
|
+
height: string;
|
|
297
|
+
width: string;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
appleWatchMenuIcons: {
|
|
302
|
+
largeWatch: {
|
|
303
|
+
height: string;
|
|
304
|
+
width: string;
|
|
305
|
+
};
|
|
306
|
+
smallWatch: {
|
|
307
|
+
height: string;
|
|
308
|
+
width: string;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
appleWatchCompanionIcons: {
|
|
312
|
+
large: {
|
|
313
|
+
height: string;
|
|
314
|
+
width: string;
|
|
315
|
+
};
|
|
316
|
+
small: {
|
|
317
|
+
height: string;
|
|
318
|
+
width: string;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
export { MOBILE_PLATFORM_MEDIA_SIZES, MOBILE_PLATFORM_TYPES, SOCIAL_MEDIA_POST_SIZES, SOCIAL_MEDIA_POST_TYPES };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var E=(h=>(h.FACEBOOK_COVER_PHOTO="FACEBOOK_COVER_PHOTO",h.FACEBOOK_EVENT_COVER="FACEBOOK_EVENT_COVER",h.FACEBOOK_PROFILE_PHOTO="FACEBOOK_PROFILE_PHOTO",h.FACEBOOK_POST_SHARE="FACEBOOK_POST_SHARE",h.FACEBOOK_STORIES="FACEBOOK_STORIES",h.INSTAGRAM_PROFILE_PHOTO="INSTAGRAM_PROFILE_PHOTO",h.INSTAGRAM_PHOTO_SHARE="INSTAGRAM_PHOTO_SHARE",h.INSTAGRAM_STORIES="INSTAGRAM_STORIES",h.LINKEDIN_PROFILE_PHOTO="LINKEDIN_PROFILE_PHOTO",h.LINKEDIN_PROFILE_BACKGROUND="LINKEDIN_PROFILE_BACKGROUND",h.LINKEDIN_COMPANY_LOGO="LINKEDIN_COMPANY_LOGO",h.LINKEDIN_COMPANY_COVER="LINKEDIN_COMPANY_COVER",h.LINKEDIN_SHARED_IMAGE="LINKEDIN_SHARED_IMAGE",h.LINKEDIN_SHARED_IMAGE_LINK="LINKEDIN_SHARED_IMAGE_LINK",h.PINTEREST_PROFILE_PHOTO="PINTEREST_PROFILE_PHOTO",h.PINTEREST_BOARD_COVER="PINTEREST_BOARD_COVER",h.PINTEREST_SHARED_PIN="PINTEREST_SHARED_PIN",h.PINTEREST_PROFILE_COVER="PINTEREST_PROFILE_COVER",h.SNAPCHAT_SHARED_IMAGE="SNAPCHAT_SHARED_IMAGE",h.TWITTER_HEADER="TWITTER_HEADER",h.TWITTER_PROFILE_PHOTO="TWITTER_PROFILE_PHOTO",h.TWITTER_POST_SHARE="TWITTER_POST_SHARE",h.YOUTUBE_CHANNEL_PROFILE="YOUTUBE_CHANNEL_PROFILE",h.YOUTUBE_CHANNEL_COVER="YOUTUBE_CHANNEL_COVER",h))(E||{});const i={FACEBOOK_COVER_PHOTO:{height:"360px",width:"820px"},FACEBOOK_EVENT_COVER:{height:"1080px",width:"1920px"},FACEBOOK_PROFILE_PHOTO:{height:"400px",width:"400px"},FACEBOOK_POST_SHARE:{height:"630px",width:"1200px"},FACEBOOK_STORIES:{height:"1920px",width:"1080px"},INSTAGRAM_PROFILE_PHOTO:{height:"400px",width:"400px"},INSTAGRAM_PHOTO_SHARE:{height:"1080px",width:"1080px"},INSTAGRAM_STORIES:{height:"1920px",width:"1080px"},LINKEDIN_PROFILE_PHOTO:{height:"400px",width:"400px"},LINKEDIN_PROFILE_BACKGROUND:{height:"396px",width:"1584px"},LINKEDIN_COMPANY_LOGO:{height:"300px",width:"300px"},LINKEDIN_COMPANY_COVER:{height:"768px",width:"1536px"},LINKEDIN_SHARED_IMAGE:{height:"736px",width:"1200px"},LINKEDIN_SHARED_IMAGE_LINK:{height:"628px",width:"1200px"},PINTEREST_PROFILE_PHOTO:{height:"400px",width:"400px"},PINTEREST_BOARD_COVER:{height:"600px",width:"600px"},PINTEREST_SHARED_PIN:{height:"900px",width:"600px"},PINTEREST_PROFILE_COVER:{height:"1080px",width:"1920px"},SNAPCHAT_SHARED_IMAGE:{height:"1920px",width:"1080px"},TWITTER_HEADER:{height:"500px",width:"1500px"},TWITTER_PROFILE_PHOTO:{height:"400px",width:"400px"},TWITTER_POST_SHARE:{height:"630px",width:"1200px"},YOUTUBE_CHANNEL_PROFILE:{height:"800px",width:"800px"},YOUTUBE_CHANNEL_COVER:{height:"423px",width:"1546px"}};var p=(x=>(x.ANDROID="android",x.IOS="ios",x.WINDOWS="windows",x))(p||{});const O={android:{appIcons:{googlePlay:{height:"512px",width:"512px"},xxhdpi:{height:"144px",width:"144px"},xhdpi:{height:"96px",width:"96px"},hdpi:{height:"72px",width:"72px"},mdpi:{height:"48px",width:"48px"}},actionBarIcons:{xxhdpi:{height:"96px",width:"96px"},xhdpi:{height:"64px",width:"64px"},hdpi:{height:"48px",width:"48px"},mdpi:{height:"32px",width:"32px"}},smallContextualIcons:{xxhdpi:{height:"48px",width:"48px"},xhdpi:{height:"32px",width:"32px"},hdpi:{height:"24px",width:"24px"},mdpi:{height:"16px",width:"16px"}},notificationIcons:{xxhdpi:{height:"72px",width:"72px"},xhdpi:{height:"48px",width:"48px"},hdpi:{height:"36px",width:"36px"},mdpi:{height:"24px",width:"24px"}}},ios:{appIcons:{xxxxxlarge:{height:"1024px",width:"1024px"},xxxxlarge:{height:"512px",width:"512px"},xxxlarge:{height:"228px",width:"228px"},xxlarge:{height:"180px",width:"180px"},xlarge:{height:"152px",width:"152px"},large:{height:"120px",width:"120px"},medium:{height:"87px",width:"87px"},small:{height:"80px",width:"80px"},xsmall:{height:"76px",width:"76px"},xxsmall:{height:"58px",width:"58px"},xxxsmall:{height:"40px",width:"40px"},xxxxsmall:{height:"29px",width:"29px"}},toolBarNavBarIcons:{large:{height:"44px",width:"44px"},small:{height:"22px",width:"22px"}},tabBarIcons:{large:{height:"50px",width:"50px"},small:{height:"25px",width:"25px"}},appleWatchNotificationCenterIcons:{large:{height:"36px",width:"36px"},small:{height:"29px",width:"29px"}},appleWatchLongLookNotificationIcons:{largeWatch:{height:"196px",width:"196px"},smallWatch:{height:"172px",width:"172px"}}},appleWatchMenuIcons:{largeWatch:{height:"80px",width:"80px"},smallWatch:{height:"70px",width:"70px"}},appleWatchCompanionIcons:{large:{height:"87px",width:"87px"},small:{height:"58px",width:"58px"}}};export{O as MOBILE_PLATFORM_MEDIA_SIZES,p as MOBILE_PLATFORM_TYPES,i as SOCIAL_MEDIA_POST_SIZES,E as SOCIAL_MEDIA_POST_TYPES};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var A=(e=>(e.ADMIN="Admin",e.MANAGER="Manager",e.USER="User",e))(A||{});export{A as USER_ROLES};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { TableColumn, HeaderAction, COMPONENT_TYPE, RowAction } from '@appcorp/shadcn/components/enhanced-table';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generic Component Factory
|
|
6
|
+
*
|
|
7
|
+
* Reusable UI components for CRUD modules with customizable configuration.
|
|
8
|
+
* Generates tables, forms, drawers, and other common UI patterns.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare const DRAWER_TYPES: {
|
|
12
|
+
FORM_DRAWER: string;
|
|
13
|
+
FILTER_DRAWER: string;
|
|
14
|
+
VIEW_DRAWER: string;
|
|
15
|
+
MORE_ACTIONS_DRAWER: string;
|
|
16
|
+
};
|
|
17
|
+
interface ComponentConfig {
|
|
18
|
+
cancelLabel?: string;
|
|
19
|
+
drawerDescription?: string;
|
|
20
|
+
drawerFormTitle: string;
|
|
21
|
+
drawerFormDescription: string;
|
|
22
|
+
drawerViewTitle: string;
|
|
23
|
+
drawerViewDescription: string;
|
|
24
|
+
drawerFilterTitle: string;
|
|
25
|
+
drawerFilterDescription: string;
|
|
26
|
+
drawerMoreActionsTitle: string;
|
|
27
|
+
drawerMoreActionsDescription: string;
|
|
28
|
+
filterContent: React.ReactNode;
|
|
29
|
+
filterDrawerValue?: string;
|
|
30
|
+
formContent: React.ReactNode;
|
|
31
|
+
formDrawerValue?: string;
|
|
32
|
+
moduleName: string;
|
|
33
|
+
moreActionsContent: React.ReactNode;
|
|
34
|
+
numberOfFilters?: number;
|
|
35
|
+
onClearFilters: () => void;
|
|
36
|
+
saveLabel?: string;
|
|
37
|
+
searchPlaceholder: string;
|
|
38
|
+
size?: 'small' | 'medium' | 'large' | 'full';
|
|
39
|
+
tableColumns: TableColumn[];
|
|
40
|
+
tableDescription: string;
|
|
41
|
+
tableTitle: string;
|
|
42
|
+
viewContent: React.ReactNode;
|
|
43
|
+
viewDrawerValue?: string;
|
|
44
|
+
}
|
|
45
|
+
interface TableBodyCol {
|
|
46
|
+
key?: string | string[];
|
|
47
|
+
componentType: COMPONENT_TYPE | string;
|
|
48
|
+
textFormatter?: (value: unknown, row: unknown) => React.ReactNode;
|
|
49
|
+
}
|
|
50
|
+
interface GenericTableProps {
|
|
51
|
+
config: ComponentConfig;
|
|
52
|
+
context: any;
|
|
53
|
+
headerActions?: HeaderAction[];
|
|
54
|
+
iconMap?: Record<string, any>;
|
|
55
|
+
rowActions?: any[];
|
|
56
|
+
tableBodyCols: TableBodyCol[];
|
|
57
|
+
}
|
|
58
|
+
declare const GenericTable: FC<GenericTableProps>;
|
|
59
|
+
interface GenericDrawerProps {
|
|
60
|
+
config: ComponentConfig;
|
|
61
|
+
context: any;
|
|
62
|
+
formContent?: React.ReactNode;
|
|
63
|
+
viewContent?: React.ReactNode;
|
|
64
|
+
filterContent?: React.ReactNode;
|
|
65
|
+
moreActionsContent?: React.ReactNode;
|
|
66
|
+
}
|
|
67
|
+
declare const GenericDrawer: FC<GenericDrawerProps>;
|
|
68
|
+
interface GenericModulePageProps {
|
|
69
|
+
context: any;
|
|
70
|
+
headerActions?: HeaderAction[];
|
|
71
|
+
iconMap?: Record<string, any>;
|
|
72
|
+
overrideConfig: ComponentConfig;
|
|
73
|
+
rowActions?: RowAction[];
|
|
74
|
+
tableBodyCols: TableBodyCol[];
|
|
75
|
+
}
|
|
76
|
+
declare const createGenericModulePage: () => React.FC<GenericModulePageProps>;
|
|
77
|
+
|
|
78
|
+
export { type ComponentConfig, DRAWER_TYPES, GenericDrawer, GenericTable, type TableBodyCol, createGenericModulePage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import t,{useMemo as F}from"react";import{calculatePages as G}from"../general/calculate-pages";import{getAvailablePageLimits as k}from"../general/get-available-page-limit";import{isNextButtonDisabled as Y}from"../general/is-next-button-disabled";import{isPreviousButtonDisabled as z}from"../general/is-previous-button-disabled";import{useRTL as g}from"../hooks/use-rtl";import{EnhancedTable as $}from"@appcorp/shadcn/components/enhanced-table";import{Toaster as j}from"@appcorp/shadcn/components/ui/sonner";import{DrawerGeneric as K}from"@appcorp/shadcn/components/drawer-generic";import{EnhancedDrawerHeader as D}from"@appcorp/shadcn/components/enhanced-drawer-header";import{EnhancedDrawerFooter as R,DRAWER_FOOTER_COMPONENT_TYPE as b}from"@appcorp/shadcn/components/enhanced-drawer-footer";const A={FORM_DRAWER:"FORM_DRAWER",FILTER_DRAWER:"FILTER_DRAWER",VIEW_DRAWER:"VIEW_DRAWER",MORE_ACTIONS_DRAWER:"MORE_ACTIONS_DRAWER"},Q=({config:r,context:e,headerActions:n,rowActions:c,tableBodyCols:o})=>{const s=g(),w=F(()=>r.tableColumns.map(a=>({label:a.label,width:a.width})),[r.tableColumns]),i=G(e.state.count,e.state.pageLimit),C=F(()=>n||e.headerActions||[],[n,e.headerActions]),l=F(()=>Object.keys(e.state).filter(a=>a.startsWith("filter")?e.state[a]!==void 0&&e.state[a]!==""&&e.state[a]!==null&&e.state[a]!==!1:!1).length,[e.state]);return t.createElement("div",{className:`space-y-4 ${s?"rtl":"ltr"}`,dir:s?"rtl":"ltr"},t.createElement($,{currentPage:Number(e.state.currentPage),handleNextOnClick:e.handlePageChange,handleOnSelect:e.handlePageLimitChange,handlePreviousOnClick:()=>e.handlePageChange(e.state.currentPage-1),handleSearchInput:(a,d)=>e.handleSearch?.(d),headerActions:C,isNextDisabled:Y(e.state.currentPage,i),isPreviousDisabled:z(e.state.currentPage),listOptions:k(e.state.count),loading:e.listLoading,nodeSelectKey:"pageLimit",numberOfFilters:l,onClearFilters:r.onClearFilters,pageLimit:e.state.pageLimit,rowActions:c||e.rowActions||[],searchDisabled:!1,searchEnabled:!0,searchId:`${r.moduleName.toLowerCase()}-search`,searchPlaceholder:r.searchPlaceholder,searchValue:e.state.searchQuery,tableBodyCols:o,tableBodyRows:e.state.items,tableDescription:r.tableDescription,tableHeading:r.tableTitle,tableHeadItems:w,totalPages:Number(i)}))},q=({config:r,context:e,formContent:n,viewContent:c,filterContent:o,moreActionsContent:s})=>{const w=g(),i=e.closeDrawer||e.handleCloseDrawer,{disableSaveButton:C,drawer:l}=e.state,a=l===A.FORM_DRAWER,d=l===A.VIEW_DRAWER,m=l===A.FILTER_DRAWER,p=l===A.MORE_ACTIONS_DRAWER,T=a||d||m||p,h=r.drawerFormTitle,f=r.drawerFormDescription,E=r.drawerViewTitle,y=r.drawerViewDescription,P=r.drawerFilterTitle,O=r.drawerFilterDescription,N=r.drawerMoreActionsTitle,M=r.drawerMoreActionsDescription,u=e.state.errors??{},_=a?t.createElement(D,{title:h,description:f}):null,W=d?t.createElement(D,{title:E,description:y}):null,v=m?t.createElement(D,{title:P,description:O}):null,L=p?t.createElement(D,{title:N,description:M}):null,S=a?t.createElement(R,{applyFilters:()=>{},clearFilters:()=>{},closeDrawer:i,disableSaveButton:C,drawerType:b.FORM_DRAWER,errors:u,handleSubmit:e.handleSubmit,updateLoading:e.updateLoading??!1}):null,H=d?t.createElement(R,{applyFilters:()=>{},clearFilters:()=>{},closeDrawer:i,disableSaveButton:!1,drawerType:b.VIEW_DRAWER,errors:u,handleSubmit:()=>{},updateLoading:!1}):null,I=m?t.createElement(R,{applyFilters:e.applyFilters??(()=>{}),clearFilters:e.clearFilters??(()=>{}),closeDrawer:i,disableSaveButton:!1,drawerType:b.FILTER_DRAWER,errors:u,handleSubmit:e.handleSubmit??(()=>{}),updateLoading:!1}):null,B=p?t.createElement(R,{applyFilters:()=>{},clearFilters:()=>{},closeDrawer:i,disableSaveButton:!1,drawerType:b.MORE_ACTIONS_DRAWER,errors:u,handleSubmit:()=>{},updateLoading:!1}):null;return t.createElement(K,{direction:w?"left":"right",filterDrawer:m?o:null,filterDrawerFooter:I,filterDrawerHeader:v,formDrawer:a?n:null,formDrawerFooter:S,formDrawerHeader:_,moreActionsDrawer:p?s:null,moreActionsDrawerFooter:B,moreActionsDrawerHeader:L,onOpenChange:V=>!V&&i(),open:T,viewDrawer:d?c:null,viewDrawerFooter:H,viewDrawerHeader:W,width:r.size??"small"})},we=()=>({context:e,headerActions:n,iconMap:c,overrideConfig:o,rowActions:s,tableBodyCols:w})=>t.createElement("div",{className:"space-y-6"},t.createElement(Q,{config:o,context:e,tableBodyCols:w,headerActions:n,rowActions:s,iconMap:c}),t.createElement(q,{config:o,context:e,filterContent:o.filterContent,formContent:o.formContent,moreActionsContent:o.moreActionsContent,viewContent:o.viewContent}),t.createElement(j,null));export{A as DRAWER_TYPES,q as GenericDrawer,Q as GenericTable,we as createGenericModulePage};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generic Module Factory - Minimal Version
|
|
5
|
+
*
|
|
6
|
+
* Provides reusable reducer and context structure for CRUD modules.
|
|
7
|
+
* API integration is handled by individual modules for maximum flexibility.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface ModuleConfig<T = any> {
|
|
11
|
+
name: string;
|
|
12
|
+
displayName: string;
|
|
13
|
+
initialState: T;
|
|
14
|
+
drawerTypes: Record<string, string>;
|
|
15
|
+
hooks?: {
|
|
16
|
+
onFormValidation?: (data: any) => Promise<boolean>;
|
|
17
|
+
onBeforeSubmit?: (data: any) => Promise<any>;
|
|
18
|
+
onAfterSubmit?: (state: any, response: any) => Promise<void>;
|
|
19
|
+
customActions?: Record<string, (state: any, payload?: any) => any>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
interface GenericModuleContext<T = any> {
|
|
23
|
+
state: T;
|
|
24
|
+
dispatch: React.Dispatch<any>;
|
|
25
|
+
}
|
|
26
|
+
declare const GENERIC_ACTION_TYPES: {
|
|
27
|
+
readonly RESET_FORM: "RESET_FORM";
|
|
28
|
+
readonly SET_CURRENT_PAGE: "SET_CURRENT_PAGE";
|
|
29
|
+
readonly SET_PAGE_LIMIT: "SET_PAGE_LIMIT";
|
|
30
|
+
readonly SET_SEARCH_QUERY: "SET_SEARCH_QUERY";
|
|
31
|
+
readonly SET_DRAWER: "SET_DRAWER";
|
|
32
|
+
readonly SET_ITEMS: "SET_ITEMS";
|
|
33
|
+
readonly SET_FORM_DATA: "SET_FORM_DATA";
|
|
34
|
+
readonly SET_DISABLE_SAVE_BUTTON: "SET_DISABLE_SAVE_BUTTON";
|
|
35
|
+
readonly SET_INPUT_FIELD: "SET_INPUT_FIELD";
|
|
36
|
+
readonly SET_ERRORS: "SET_ERRORS";
|
|
37
|
+
readonly SET_FILTERS: "SET_FILTERS";
|
|
38
|
+
};
|
|
39
|
+
declare const createGenericReducer: <T>(config: ModuleConfig<T>) => (state: T, action: any) => T;
|
|
40
|
+
declare const createGenericModuleHook: <T>(config: ModuleConfig<T>) => () => GenericModuleContextWithHandlers<T>;
|
|
41
|
+
declare const createGenericModuleProvider: <T>(config: ModuleConfig<T>) => {
|
|
42
|
+
Provider: React.FC<{
|
|
43
|
+
children: React.ReactNode;
|
|
44
|
+
}>;
|
|
45
|
+
useContext: () => GenericModuleContextWithHandlers<T>;
|
|
46
|
+
Context: React.Context<GenericModuleContextWithHandlers<T> | undefined>;
|
|
47
|
+
};
|
|
48
|
+
interface GenericModuleContextWithHandlers<T = any> extends GenericModuleContext<T> {
|
|
49
|
+
handleSearch?: (query: string) => void;
|
|
50
|
+
handlePageChange?: (page: number) => void;
|
|
51
|
+
handlePageLimitChange?: (limit: number) => void;
|
|
52
|
+
handleCloseDrawer?: () => void;
|
|
53
|
+
handleSubmit?: (data: any) => void;
|
|
54
|
+
}
|
|
55
|
+
declare const createGenericHandlers: <T>(dispatch: React.Dispatch<any>) => Omit<GenericModuleContextWithHandlers<T>, "state" | "dispatch">;
|
|
56
|
+
declare const createGenericModule: <T>(config: ModuleConfig<T>) => {
|
|
57
|
+
reducer: (state: T, action: any) => T;
|
|
58
|
+
Provider: React.FC<{
|
|
59
|
+
children: React.ReactNode;
|
|
60
|
+
}>;
|
|
61
|
+
useContext: () => GenericModuleContextWithHandlers<T>;
|
|
62
|
+
config: ModuleConfig<T>;
|
|
63
|
+
actionTypes: {
|
|
64
|
+
readonly RESET_FORM: "RESET_FORM";
|
|
65
|
+
readonly SET_CURRENT_PAGE: "SET_CURRENT_PAGE";
|
|
66
|
+
readonly SET_PAGE_LIMIT: "SET_PAGE_LIMIT";
|
|
67
|
+
readonly SET_SEARCH_QUERY: "SET_SEARCH_QUERY";
|
|
68
|
+
readonly SET_DRAWER: "SET_DRAWER";
|
|
69
|
+
readonly SET_ITEMS: "SET_ITEMS";
|
|
70
|
+
readonly SET_FORM_DATA: "SET_FORM_DATA";
|
|
71
|
+
readonly SET_DISABLE_SAVE_BUTTON: "SET_DISABLE_SAVE_BUTTON";
|
|
72
|
+
readonly SET_INPUT_FIELD: "SET_INPUT_FIELD";
|
|
73
|
+
readonly SET_ERRORS: "SET_ERRORS";
|
|
74
|
+
readonly SET_FILTERS: "SET_FILTERS";
|
|
75
|
+
};
|
|
76
|
+
initialState: T;
|
|
77
|
+
createHandlers: <T_1>(dispatch: React.Dispatch<any>) => Omit<GenericModuleContextWithHandlers<T_1>, "state" | "dispatch">;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export { GENERIC_ACTION_TYPES, type GenericModuleContext, type GenericModuleContextWithHandlers, type ModuleConfig, createGenericHandlers, createGenericModule, createGenericModuleHook, createGenericModuleProvider, createGenericReducer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import i,{useReducer as E}from"react";const t={RESET_FORM:"RESET_FORM",SET_CURRENT_PAGE:"SET_CURRENT_PAGE",SET_PAGE_LIMIT:"SET_PAGE_LIMIT",SET_SEARCH_QUERY:"SET_SEARCH_QUERY",SET_DRAWER:"SET_DRAWER",SET_ITEMS:"SET_ITEMS",SET_FORM_DATA:"SET_FORM_DATA",SET_DISABLE_SAVE_BUTTON:"SET_DISABLE_SAVE_BUTTON",SET_INPUT_FIELD:"SET_INPUT_FIELD",SET_ERRORS:"SET_ERRORS",SET_FILTERS:"SET_FILTERS"},d=n=>(e,r)=>{switch(r.type){case t.RESET_FORM:{const a=e;return{...e,...n.initialState,count:a.count,currentPage:a.currentPage,items:a.items,pageLimit:a.pageLimit,searchQuery:a.searchQuery}}case t.SET_CURRENT_PAGE:return{...e,currentPage:r.payload.currentPage};case t.SET_PAGE_LIMIT:return{...e,pageLimit:r.payload.pageLimit};case t.SET_SEARCH_QUERY:return{...e,searchQuery:r.payload.searchQuery};case t.SET_DRAWER:return{...e,drawer:r.payload.drawer};case t.SET_ITEMS:return{...e,items:r.payload.items,count:r.payload.count};case t.SET_FORM_DATA:return{...e,...r.payload.form};case t.SET_DISABLE_SAVE_BUTTON:return{...e,disableSaveButton:r.payload.disabled};case t.SET_INPUT_FIELD:return{...e,[r.payload.key]:r.payload.value};case t.SET_ERRORS:return{...e,errors:r.payload.errors};case t.SET_FILTERS:return{...e,...r.payload.filters};default:return e}},s=n=>()=>{const[e,r]=E(d(n),n.initialState),a=T(r);return{state:e,dispatch:r,...a}},c=n=>{const e=i.createContext(void 0);return{Provider:({children:o})=>{const u=s(n)();return i.createElement(e.Provider,{value:u},o)},useContext:()=>{const o=i.useContext(e);if(o===void 0)throw new Error(`useGenericModuleContext must be used within GenericProvider for ${n.name}`);return o},Context:e}},T=n=>({handleSearch:e=>{n({type:t.SET_SEARCH_QUERY,payload:{searchQuery:e}})},handlePageChange:e=>{n({type:t.SET_CURRENT_PAGE,payload:{currentPage:e}})},handlePageLimitChange:e=>{n({type:t.SET_PAGE_LIMIT,payload:{pageLimit:e}})},handleCloseDrawer:()=>{n({type:t.SET_DRAWER,payload:{drawer:null}})}}),_=n=>{const e=d(n),{Provider:r,useContext:a}=c(n);return{reducer:e,Provider:r,useContext:a,config:n,actionTypes:t,initialState:n.initialState,createHandlers:T}};export{t as GENERIC_ACTION_TYPES,T as createGenericHandlers,_ as createGenericModule,s as createGenericModuleHook,c as createGenericModuleProvider,d as createGenericReducer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=s=>async(e={})=>{const n=e.headers?e.headers:{};return n["Content-Type"]="application/json",(await fetch(s,{headers:n,method:"GET",...e})).json()};export{a as basicGet};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a curried POST request to the given URL with a JSON payload.
|
|
3
|
+
* @param url - The request URL.
|
|
4
|
+
* @returns A curried function accepting payload and options, returning a JSON promise.
|
|
5
|
+
*/
|
|
6
|
+
declare const basicPost: (url: string) => any;
|
|
7
|
+
|
|
8
|
+
export { basicPost };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=s=>(a,e={})=>async()=>{const n=e.headers?e.headers:{};return n["Content-Type"]="application/json",(await fetch(s,{method:"POST",...e,body:JSON.stringify(a),headers:n})).json()};export{t as basicPost};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the total number of pages given a record count and page limit.
|
|
3
|
+
* @param count - Total number of records.
|
|
4
|
+
* @param pageLimit - Number of records per page.
|
|
5
|
+
* @returns The total number of pages.
|
|
6
|
+
*/
|
|
7
|
+
declare const calculatePages: (count: number, pageLimit: number) => number;
|
|
8
|
+
|
|
9
|
+
export { calculatePages };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c=(e,a)=>Math.ceil(e/a);export{c as calculatePages};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A util function to convert camel case into sentence case
|
|
3
|
+
*
|
|
4
|
+
* @param str - string provided to convert camel case into sentence case - taimoorKhan
|
|
5
|
+
* @returns string in sentence case - Taimoor Khan
|
|
6
|
+
* @author Taimoor Khan
|
|
7
|
+
* @remarks
|
|
8
|
+
*/
|
|
9
|
+
/** End file docs */
|
|
10
|
+
declare const camelToSentenceCase: (str: string) => string;
|
|
11
|
+
|
|
12
|
+
export { camelToSentenceCase };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=n=>n.replace(/([A-Z])/g," $1").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");export{r as camelToSentenceCase};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A util function to check if provided array length
|
|
3
|
+
* is even or odd.
|
|
4
|
+
*
|
|
5
|
+
* @param arr - arr provided array which will be checked for its length to be either odd or even
|
|
6
|
+
* @returns even or odd number
|
|
7
|
+
* @author Taimoor Khan
|
|
8
|
+
* @remarks Taimoor Khan Resume v3
|
|
9
|
+
*/
|
|
10
|
+
/** End file docs */
|
|
11
|
+
declare const checkEvenOddLength: (arr: Array<any>) => number;
|
|
12
|
+
|
|
13
|
+
export { checkEvenOddLength };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=e=>e.length%2===0?2:1;export{n as checkEvenOddLength};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface Params {
|
|
2
|
+
LS_KEYS: Record<string, string>;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Clears specified localStorage entries and reloads the window.
|
|
6
|
+
* @param params.LS_KEYS - A record of localStorage keys to remove.
|
|
7
|
+
*/
|
|
8
|
+
declare const clearCache: ({ LS_KEYS }: Params) => void;
|
|
9
|
+
|
|
10
|
+
export { clearCache };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=({LS_KEYS:e})=>{Object.keys(e).forEach(a=>{localStorage.removeItem(e[a])}),window.location.reload()};export{o as clearCache};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface FormatCnicOptions {
|
|
2
|
+
separator?: string;
|
|
3
|
+
allowLoose?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Formats a CNIC number string into 5-7-1 digit groups with an optional separator.
|
|
7
|
+
* @param value - The CNIC value (string, number, null, or undefined).
|
|
8
|
+
* @param opts.separator - Separator between groups (default '-').
|
|
9
|
+
* @param opts.allowLoose - If true, allows formatting incomplete CNICs.
|
|
10
|
+
* @returns The formatted CNIC string, or null if invalid.
|
|
11
|
+
*/
|
|
12
|
+
declare const formatCnic: (value: string | number | null | undefined, opts?: FormatCnicOptions) => string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Checks whether a value is a valid 13-digit CNIC.
|
|
15
|
+
* @param value - The CNIC value (string, number, null, or undefined).
|
|
16
|
+
* @returns True if the value is a valid 13-digit CNIC.
|
|
17
|
+
*/
|
|
18
|
+
declare const isValidCnic: (value: string | number | null | undefined) => boolean;
|
|
19
|
+
|
|
20
|
+
export { formatCnic, isValidCnic };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=(()=>{const n={};for(let t=0;t<=9;t++)n[String.fromCharCode(1632+t)]=String(t);for(let t=0;t<=9;t++)n[String.fromCharCode(1776+t)]=String(t);return n})(),s=n=>n.replace(/./g,t=>a[t]??t),d=(n,t={})=>{if(n==null)return null;const e=t.separator??"-";let r=String(n);if(r=r.trim(),r.length===0)return null;const i=s(r).replace(/[^0-9]/g,"");if(i.length===0||!t.allowLoose&&i.length!==13)return null;const g=i.slice(0,5),c=i.slice(5,12),l=i.slice(12);return[g,c,l].filter(o=>o&&o.length>0).join(e)},p=n=>{if(n==null)return!1;const t=String(n);return s(t).replace(/[^0-9]/g,"").length===13};export{d as formatCnic,p as isValidCnic};
|