@cryptlex/web-components 5.2.0 → 5.3.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data-table/data-table-filter.d.ts +27 -0
- package/dist/components/data-table/data-table-filter.js +2 -0
- package/dist/components/data-table/data-table-filter.js.map +1 -0
- package/dist/components/data-table/data-table.d.ts +72 -0
- package/dist/components/data-table/data-table.js +2 -0
- package/dist/components/data-table/data-table.js.map +1 -0
- package/dist/components/data-table/table-commons.d.ts +56 -0
- package/dist/components/data-table/table-commons.js +2 -0
- package/dist/components/data-table/table-commons.js.map +1 -0
- package/dist/components/inputs/checkbox.d.ts +8 -0
- package/dist/components/inputs/checkbox.js +2 -0
- package/dist/components/inputs/checkbox.js.map +1 -0
- package/dist/components/inputs/date-picker.d.ts +11 -0
- package/dist/components/inputs/date-picker.js +2 -0
- package/dist/components/inputs/date-picker.js.map +1 -0
- package/dist/components/inputs/datefield.d.ts +14 -0
- package/dist/components/inputs/datefield.js +2 -0
- package/dist/components/inputs/datefield.js.map +1 -0
- package/dist/components/inputs/field.d.ts +20 -0
- package/dist/components/inputs/field.js +2 -0
- package/dist/components/inputs/field.js.map +1 -0
- package/dist/components/inputs/id-search.d.ts +20 -0
- package/dist/components/inputs/id-search.js +2 -0
- package/dist/components/inputs/id-search.js.map +1 -0
- package/dist/components/inputs/input-otp.d.ts +7 -0
- package/dist/components/inputs/input-otp.js +2 -0
- package/dist/components/inputs/input-otp.js.map +1 -0
- package/dist/components/inputs/multi-select.d.ts +16 -0
- package/dist/components/inputs/multi-select.js +2 -0
- package/dist/components/inputs/multi-select.js.map +1 -0
- package/dist/components/inputs/numberfield.d.ts +6 -0
- package/dist/components/inputs/numberfield.js +2 -0
- package/dist/components/inputs/numberfield.js.map +1 -0
- package/dist/components/inputs/searchfield.d.ts +5 -0
- package/dist/components/inputs/searchfield.js +2 -0
- package/dist/components/inputs/searchfield.js.map +1 -0
- package/dist/components/inputs/select-options.d.ts +8 -0
- package/dist/components/inputs/select-options.js +2 -0
- package/dist/components/inputs/select-options.js.map +1 -0
- package/dist/components/inputs/select.d.ts +17 -0
- package/dist/components/inputs/select.js +2 -0
- package/dist/components/inputs/select.js.map +1 -0
- package/dist/components/inputs/textfield.d.ts +7 -0
- package/dist/components/inputs/textfield.js +2 -0
- package/dist/components/inputs/textfield.js.map +1 -0
- package/dist/components/key-value-card/key-value-card.d.ts +17 -0
- package/dist/components/key-value-card/key-value-card.js +2 -0
- package/dist/components/key-value-card/key-value-card.js.map +1 -0
- package/dist/components/ui/alert.d.ts +8 -0
- package/dist/components/ui/alert.js +2 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.js +2 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +1 -0
- package/dist/components/ui/badge.js +2 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumbs.d.ts +10 -0
- package/dist/components/ui/breadcrumbs.js +2 -0
- package/dist/components/ui/breadcrumbs.js.map +1 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +2 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +16 -0
- package/dist/components/ui/calendar.js +2 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +7 -0
- package/dist/components/ui/card.js +2 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dialog.js +2 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/disclosure.d.ts +18 -0
- package/dist/components/ui/disclosure.js +2 -0
- package/dist/components/ui/disclosure.js.map +1 -0
- package/dist/components/ui/list-box.d.ts +5 -0
- package/dist/components/ui/list-box.js +2 -0
- package/dist/components/ui/list-box.js.map +1 -0
- package/dist/components/ui/loader.d.ts +5 -0
- package/dist/components/ui/loader.js +2 -0
- package/dist/components/ui/loader.js.map +1 -0
- package/dist/components/ui/menu.d.ts +24 -0
- package/dist/components/ui/menu.js +2 -0
- package/dist/components/ui/menu.js.map +1 -0
- package/dist/components/ui/popover.d.ts +4 -0
- package/dist/components/ui/popover.js +2 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +52 -0
- package/dist/components/ui/sidebar.js +2 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +1 -0
- package/dist/components/ui/skeleton.js +2 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/sonner.js +2 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/table.d.ts +8 -0
- package/dist/components/ui/table.js +2 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +5 -0
- package/dist/components/ui/tabs.js +2 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/timeline.d.ts +15 -0
- package/dist/components/ui/timeline.js +2 -0
- package/dist/components/ui/timeline.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +4 -0
- package/dist/components/ui/tooltip.js +2 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/utils/form-context.d.ts +4 -0
- package/dist/utils/form-context.js +2 -0
- package/dist/utils/form-context.js.map +1 -0
- package/dist/utils/form-hook.d.ts +23 -0
- package/dist/utils/form-hook.js +2 -0
- package/dist/utils/form-hook.js.map +1 -0
- package/dist/utils/primitives.d.ts +44 -0
- package/dist/utils/primitives.js +2 -0
- package/dist/utils/primitives.js.map +1 -0
- package/dist/utils/resource-names.d.ts +11 -0
- package/dist/utils/resource-names.js +2 -0
- package/dist/utils/resource-names.js.map +1 -0
- package/dist/utils/use-mobile.d.ts +1 -0
- package/dist/utils/use-mobile.js +2 -0
- package/dist/utils/use-mobile.js.map +1 -0
- package/package.json +16 -8
- package/lib/components/data-table/data-table-filter.tsx +0 -220
- package/lib/components/data-table/data-table.tsx +0 -593
- package/lib/components/data-table/table-commons.tsx +0 -233
- package/lib/components/inputs/checkbox.tsx +0 -72
- package/lib/components/inputs/date-picker.tsx +0 -130
- package/lib/components/inputs/datefield.tsx +0 -109
- package/lib/components/inputs/field.tsx +0 -106
- package/lib/components/inputs/id-search.tsx +0 -83
- package/lib/components/inputs/input-otp.tsx +0 -63
- package/lib/components/inputs/multi-select.tsx +0 -62
- package/lib/components/inputs/numberfield.tsx +0 -110
- package/lib/components/inputs/searchfield.tsx +0 -87
- package/lib/components/inputs/select-options.tsx +0 -303
- package/lib/components/inputs/select.tsx +0 -140
- package/lib/components/inputs/textfield.tsx +0 -96
- package/lib/components/key-value-card/key-value-card.tsx +0 -115
- package/lib/components/ui/alert.tsx +0 -32
- package/lib/components/ui/avatar.tsx +0 -22
- package/lib/components/ui/badge.tsx +0 -19
- package/lib/components/ui/breadcrumbs.tsx +0 -104
- package/lib/components/ui/button.tsx +0 -66
- package/lib/components/ui/calendar.tsx +0 -220
- package/lib/components/ui/card.tsx +0 -58
- package/lib/components/ui/dialog.tsx +0 -172
- package/lib/components/ui/disclosure.tsx +0 -113
- package/lib/components/ui/list-box.tsx +0 -86
- package/lib/components/ui/loader.tsx +0 -10
- package/lib/components/ui/menu.tsx +0 -168
- package/lib/components/ui/popover.tsx +0 -37
- package/lib/components/ui/sidebar.tsx +0 -552
- package/lib/components/ui/skeleton.tsx +0 -7
- package/lib/components/ui/sonner.tsx +0 -26
- package/lib/components/ui/table.tsx +0 -79
- package/lib/components/ui/tabs.tsx +0 -82
- package/lib/components/ui/timeline.tsx +0 -52
- package/lib/components/ui/tooltip.tsx +0 -30
- package/lib/tokens.scss +0 -89
- package/lib/utils/form-context.tsx +0 -7
- package/lib/utils/form-hook.tsx +0 -33
- package/lib/utils/primitives.ts +0 -68
- package/lib/utils/resource-names.tsx +0 -245
- package/lib/utils/use-mobile.tsx +0 -21
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{convertCamelCaseToTitleCase as n}from"./primitives.js";import{createContext as i,use as l}from"react";import"clsx";const t={"product.displayName":"Product"},f=["access-token","account","activation","activation-log","admin-role","audit-log","automated-email","automated-email-event-log","card","feature-flag","invoice","license","license-template","maintenance-policy","organization","plan","product","product-version","profile","release","release-channel","release-file","release-platform","report","role","role-claim","saml-configuration","segment","sending-domain","setting","tag","team-member","trial","trial-policy","user","user-group","webhook","webhook-event-log","webhook-trigger","reseller","oidc-configuration","organization-claim","reseller-claim"],y={account:"Your organization account.",product:"Products are the software products you want to license",license:"Licenses represent a purchase of your software. These can be linked to customers, and the license key is required to use the product.","access-token":"Access Tokens are used to authenticate your API requests.",activation:"Activations, also known as devices/machines/seats are the devices consuming licenses.","activation-log":"Activation Log is a log entry of activation/deactivation of a particular license.",trial:"Trial/Trial Activation is a device that has activated a trial of your product.","audit-log":"Audit logs contain all the changes made to your account.","automated-email":"Automated Email allow you to send marketing emails based on events on the linked product.","automated-email-event-log":"Automated email event log is the log of all the automated email events for your product.",card:"The payment card for your account.","feature-flag":"Feature flags define features that make up tiers for your products.",invoice:"","license-template":"License templates are a blueprint for the licenses you create for your customers and prevent repetition when creating licenses.","maintenance-policy":"Maintenance policies represent support contracts and can be linked to licenses.",plan:"","product-version":"Product Versions are sets of Feature Flags that define the tiers of your products.","release-channel":"Release channel is the release channel for your product.","release-file":"Release files are files within your created releases.","release-platform":'Release Platforms differentiate the target platform for your release. Common platforms include "Windows", "macOS", and "Linux".',release:"Releases help you to manage different versions of your app, and secure distribute it to licensed users.",report:"Analytics data for your account","role-claim":"",role:"Roles define permissions for your team.","saml-configuration":"",segment:"Sets of filters that can be saved to filter resources.","trial-policy":"Trial policies are templates for creating trials for your products.","webhook-event-log":"Webhook Event Logs are logs of events that have occured on webhooks.","webhook-trigger":"",webhook:"Webhooks are HTTP callbacks which are triggered by specific events.",organization:"",profile:"",setting:"",tag:"Tags allow you to manage your licenses and customers on the dashboard.","team-member":"Team members can access the account based on their roles.",user:"A user refers to your customer whom you want to license your product.","sending-domain":"Allows Cryptlex to send emails on your behalf using your From Email address","admin-role":"Roles that have type admin","user-group":"Groups of users that you can assign licenses to.",reseller:"Resellers allow you to delegate user management to third parties or partners","oidc-configuration":"","organization-claim":"","reseller-claim":""},a={id:"ID",createdAt:"Creation Date",scopes:"Permissions",updatedAt:"Last Updated",expiresAt:"Expiration Date",lastSeenAt:"Last Seen",os:"OS",osVersion:"OS Version",key:"License Key",vmName:"VM Name",container:"Container",allowedIpRange:"Allowed IP Range",allowedIpRanges:"Allowed IP Ranges",allowedIpAddresses:"Allowed IP Addresses",disallowedIpAddresses:"Disallowed IP Addresses",allowVmActivation:"Allow VM Activation",disableGeoLocation:"Disable Geolocation","user.id":"User ID",userId:"User",productId:"Product",downloads:"Total Downloads",claims:"Permissions",googleSsoEnabled:"Google Login Enabled",lastAttemptedAt:"Last Attempt Date",url:"URL","trialPolicy.name":"Trial Policy Name","licensePolicy.name":"License Template Name",licensePolicy:"License Template",eventLog:"Audit Log",cc:"CC Recepients",bcc:"BCC Recepients",ipAddress:"IP Address",resellerId:"Reseller",productVersionId:"Product Version",releaseId:"Release",maintenancePolicyId:"Maintenance Policy",webhookId:"Webhook",automatedEmailId:"Automated Email","location.countryName":"Country","location.ipAddress":"IP Address","location.countryCode":"Country",organizationId:"Organization","address.country":"Country","address.addressLine1":"Address Line 1","address.addressLine2":"Address Line 2",responseStatusCode:"HTTP Status Code",resourceId:"Resource ID",Sso:"SAML SSO 2.0","reseller.name":"Reseller",sendingDomain:"Email Sending Domain"};function c(e,o){return o!=="admin-portal"&&e in t?t[e]:e in a?a[e]:n(e)}const r=i("admin-portal");function h({projectName:e,children:o}){return s(r.Provider,{value:e,children:o})}function d(){return l(r)}function A(){const e=d();return o=>c(o,e)}export{h as ProjectProvider,y as RESOURCE_DEFINITIONS,f as RESOURCE_NAMES,d as useProjectName,A as useResourceFormatter};
|
|
2
|
+
//# sourceMappingURL=resource-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-names.js","sources":["../../lib/utils/resource-names.tsx"],"sourcesContent":["import { convertCamelCaseToTitleCase, type CtxPortals } from \"lib/utils/primitives\";\nimport { createContext, use } from \"react\";\n\n// Display names specific to customer and reseller portal\nconst OTHER_PORTALS_DISPLAY_NAME: Record<string, string> = {\n \"product.displayName\": \"Product\",\n};\n\n/** Resource Name should ALWAYS be in singular form */\nexport const RESOURCE_NAMES = [\n \"access-token\",\n \"account\",\n \"activation\",\n \"activation-log\",\n \"admin-role\",\n \"audit-log\",\n \"automated-email\",\n \"automated-email-event-log\",\n \"card\",\n \"feature-flag\",\n \"invoice\",\n \"license\",\n \"license-template\",\n \"maintenance-policy\",\n \"organization\",\n \"plan\",\n \"product\",\n \"product-version\",\n \"profile\",\n \"release\",\n \"release-channel\",\n \"release-file\",\n \"release-platform\",\n \"report\",\n \"role\",\n \"role-claim\",\n \"saml-configuration\",\n \"segment\",\n \"sending-domain\",\n \"setting\",\n \"tag\",\n \"team-member\",\n \"trial\",\n \"trial-policy\",\n \"user\",\n \"user-group\",\n \"webhook\",\n \"webhook-event-log\",\n \"webhook-trigger\",\n \"reseller\",\n \"oidc-configuration\",\n \"organization-claim\",\n \"reseller-claim\",\n] as const;\nexport type ResourceName = (typeof RESOURCE_NAMES)[number];\nexport const RESOURCE_DEFINITIONS: Record<ResourceName, string> = {\n account: \"Your organization account.\",\n product: \"Products are the software products you want to license\",\n license:\n \"Licenses represent a purchase of your software. These can be linked to customers, and the license key is required to use the product.\",\n \"access-token\": \"Access Tokens are used to authenticate your API requests.\",\n activation:\n \"Activations, also known as devices/machines/seats are the devices consuming licenses.\",\n \"activation-log\":\n \"Activation Log is a log entry of activation/deactivation of a particular license.\",\n trial:\n \"Trial/Trial Activation is a device that has activated a trial of your product.\",\n \"audit-log\": \"Audit logs contain all the changes made to your account.\",\n \"automated-email\":\n \"Automated Email allow you to send marketing emails based on events on the linked product.\",\n \"automated-email-event-log\":\n \"Automated email event log is the log of all the automated email events for your product.\",\n card: \"The payment card for your account.\",\n \"feature-flag\":\n \"Feature flags define features that make up tiers for your products.\",\n invoice: \"\",\n \"license-template\":\n \"License templates are a blueprint for the licenses you create for your customers and prevent repetition when creating licenses.\",\n \"maintenance-policy\":\n \"Maintenance policies represent support contracts and can be linked to licenses.\",\n plan: \"\",\n \"product-version\":\n \"Product Versions are sets of Feature Flags that define the tiers of your products.\",\n \"release-channel\": \"Release channel is the release channel for your product.\",\n \"release-file\": \"Release files are files within your created releases.\",\n \"release-platform\":\n 'Release Platforms differentiate the target platform for your release. Common platforms include \"Windows\", \"macOS\", and \"Linux\".',\n release:\n \"Releases help you to manage different versions of your app, and secure distribute it to licensed users.\",\n report: \"Analytics data for your account\",\n \"role-claim\": \"\",\n role: \"Roles define permissions for your team.\",\n \"saml-configuration\": \"\",\n segment: \"Sets of filters that can be saved to filter resources.\",\n \"trial-policy\":\n \"Trial policies are templates for creating trials for your products.\",\n \"webhook-event-log\":\n \"Webhook Event Logs are logs of events that have occured on webhooks.\",\n \"webhook-trigger\": \"\",\n webhook:\n \"Webhooks are HTTP callbacks which are triggered by specific events.\",\n organization: \"\",\n profile: \"\",\n setting: \"\",\n tag: \"Tags allow you to manage your licenses and customers on the dashboard.\",\n \"team-member\": \"Team members can access the account based on their roles.\",\n user: \"A user refers to your customer whom you want to license your product.\",\n \"sending-domain\":\n \"Allows Cryptlex to send emails on your behalf using your From Email address\",\n \"admin-role\": \"Roles that have type admin\",\n \"user-group\": \"Groups of users that you can assign licenses to.\",\n reseller:\n \"Resellers allow you to delegate user management to third parties or partners\",\n \"oidc-configuration\": \"\",\n \"organization-claim\": \"\",\n \"reseller-claim\": \"\",\n};\n\nconst RESOURCE_DISPLAY_NAMES: Record<string, string> = {\n id: \"ID\",\n createdAt: \"Creation Date\",\n scopes: \"Permissions\",\n updatedAt: \"Last Updated\",\n expiresAt: \"Expiration Date\",\n lastSeenAt: \"Last Seen\",\n os: \"OS\",\n osVersion: \"OS Version\",\n key: \"License Key\",\n vmName: \"VM Name\",\n container: \"Container\",\n allowedIpRange: \"Allowed IP Range\",\n allowedIpRanges: \"Allowed IP Ranges\",\n allowedIpAddresses: \"Allowed IP Addresses\",\n disallowedIpAddresses: \"Disallowed IP Addresses\",\n allowVmActivation: \"Allow VM Activation\",\n disableGeoLocation: \"Disable Geolocation\",\n \"user.id\": \"User ID\",\n userId: \"User\",\n productId: \"Product\",\n downloads: \"Total Downloads\",\n claims: \"Permissions\",\n googleSsoEnabled: \"Google Login Enabled\",\n lastAttemptedAt: \"Last Attempt Date\",\n url: \"URL\",\n \"trialPolicy.name\": \"Trial Policy Name\",\n \"licensePolicy.name\": \"License Template Name\",\n licensePolicy: \"License Template\",\n eventLog: \"Audit Log\",\n cc: \"CC Recepients\",\n bcc: \"BCC Recepients\",\n ipAddress: \"IP Address\",\n resellerId: \"Reseller\",\n productVersionId: \"Product Version\",\n releaseId: \"Release\",\n maintenancePolicyId: \"Maintenance Policy\",\n webhookId: \"Webhook\",\n automatedEmailId: \"Automated Email\",\n \"location.countryName\": \"Country\",\n \"location.ipAddress\": \"IP Address\",\n \"location.countryCode\": \"Country\",\n organizationId: \"Organization\",\n \"address.country\": \"Country\",\n \"address.addressLine1\": \"Address Line 1\",\n \"address.addressLine2\": \"Address Line 2\",\n responseStatusCode: \"HTTP Status Code\",\n resourceId: \"Resource ID\",\n Sso: \"SAML SSO 2.0\",\n \"reseller.name\": \"Reseller\",\n sendingDomain: \"Email Sending Domain\",\n};\n\nfunction getResourceDisplayName(\n resourceName: string,\n portal: CtxPortals,\n) {\n if (portal !== \"admin-portal\" && resourceName in OTHER_PORTALS_DISPLAY_NAME) {\n return OTHER_PORTALS_DISPLAY_NAME[resourceName];\n } else if (resourceName in RESOURCE_DISPLAY_NAMES) {\n return RESOURCE_DISPLAY_NAMES[resourceName];\n } else {\n return convertCamelCaseToTitleCase(resourceName);\n }\n}\n\nconst ProjectContext = createContext<CtxPortals>('admin-portal');\n\nexport function ProjectProvider({ projectName, children }: { projectName: CtxPortals; children: React.ReactNode; }) {\n return (\n <ProjectContext.Provider value={projectName}>\n {children}\n </ProjectContext.Provider>\n );\n}\n\nexport function useProjectName(): CtxPortals {\n return use(ProjectContext);\n}\n\nexport function useResourceFormatter(): (resourceName: string) => string {\n const portal = useProjectName();\n return (resourceName: string) => getResourceDisplayName(resourceName, portal);\n}"],"names":["OTHER_PORTALS_DISPLAY_NAME","RESOURCE_NAMES","RESOURCE_DEFINITIONS","RESOURCE_DISPLAY_NAMES","getResourceDisplayName","resourceName","portal","convertCamelCaseToTitleCase","ProjectContext","createContext","ProjectProvider","projectName","children","useProjectName","use","useResourceFormatter"],"mappings":"kKAIA,MAAMA,EAAqD,CACvD,sBAAuB,SAC3B,EAGaC,EAAiB,CAC1B,eACA,UACA,aACA,iBACA,aACA,YACA,kBACA,4BACA,OACA,eACA,UACA,UACA,mBACA,qBACA,eACA,OACA,UACA,kBACA,UACA,UACA,kBACA,eACA,mBACA,SACA,OACA,aACA,qBACA,UACA,iBACA,UACA,MACA,cACA,QACA,eACA,OACA,aACA,UACA,oBACA,kBACA,WACA,qBACA,qBACA,gBACJ,EAEaC,EAAqD,CAC9D,QAAS,6BACT,QAAS,yDACT,QACI,wIACJ,eAAgB,4DAChB,WACI,wFACJ,iBACI,oFACJ,MACI,iFACJ,YAAa,2DACb,kBACI,4FACJ,4BACI,2FACJ,KAAM,qCACN,eACI,sEACJ,QAAS,GACT,mBACI,kIACJ,qBACI,kFACJ,KAAM,GACN,kBACI,qFACJ,kBAAmB,2DACnB,eAAgB,wDAChB,mBACI,kIACJ,QACI,0GACJ,OAAQ,kCACR,aAAc,GACd,KAAM,0CACN,qBAAsB,GACtB,QAAS,yDACT,eACI,sEACJ,oBACI,uEACJ,kBAAmB,GACnB,QACI,sEACJ,aAAc,GACd,QAAS,GACT,QAAS,GACT,IAAK,yEACL,cAAe,4DACf,KAAM,wEACN,iBACI,8EACJ,aAAc,6BACd,aAAc,mDACd,SACI,+EACJ,qBAAsB,GACtB,qBAAsB,GACtB,iBAAkB,EACtB,EAEMC,EAAiD,CACnD,GAAI,KACJ,UAAW,gBACX,OAAQ,cACR,UAAW,eACX,UAAW,kBACX,WAAY,YACZ,GAAI,KACJ,UAAW,aACX,IAAK,cACL,OAAQ,UACR,UAAW,YACX,eAAgB,mBAChB,gBAAiB,oBACjB,mBAAoB,uBACpB,sBAAuB,0BACvB,kBAAmB,sBACnB,mBAAoB,sBACpB,UAAW,UACX,OAAQ,OACR,UAAW,UACX,UAAW,kBACX,OAAQ,cACR,iBAAkB,uBAClB,gBAAiB,oBACjB,IAAK,MACL,mBAAoB,oBACpB,qBAAsB,wBACtB,cAAe,mBACf,SAAU,YACV,GAAI,gBACJ,IAAK,iBACL,UAAW,aACX,WAAY,WACZ,iBAAkB,kBAClB,UAAW,UACX,oBAAqB,qBACrB,UAAW,UACX,iBAAkB,kBAClB,uBAAwB,UACxB,qBAAsB,aACtB,uBAAwB,UACxB,eAAgB,eAChB,kBAAmB,UACnB,uBAAwB,iBACxB,uBAAwB,iBACxB,mBAAoB,mBACpB,WAAY,cACZ,IAAK,eACL,gBAAiB,WACjB,cAAe,sBACnB,EAEA,SAASC,EACLC,EACAC,EACF,CACE,OAAIA,IAAW,gBAAkBD,KAAgBL,EACtCA,EAA2BK,CAAY,EACvCA,KAAgBF,EAChBA,EAAuBE,CAAY,EAEnCE,EAA4BF,CAAY,CAEvD,CAEA,MAAMG,EAAiBC,EAA0B,cAAc,EAExD,SAASC,EAAgB,CAAE,YAAAC,EAAa,SAAAC,GAAqE,CAChH,SACKJ,EAAe,SAAf,CAAwB,MAAOG,EAC3B,SAAAC,EACL,CAER,CAEO,SAASC,GAA6B,CACzC,OAAOC,EAAIN,CAAc,CAC7B,CAEO,SAASO,GAAyD,CACrE,MAAMT,EAASO,EAAA,EACf,OAAQR,GAAyBD,EAAuBC,EAAcC,CAAM,CAChF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsMobile(): boolean;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useState as s,useEffect as r}from"react";const e=768;function c(){const[o,n]=s(void 0);return r(()=>{const t=window.matchMedia(`(max-width: ${e-1}px)`),i=()=>{n(window.innerWidth<e)};return t.addEventListener("change",i),n(window.innerWidth<e),()=>t.removeEventListener("change",i)},[]),!!o}export{c as useIsMobile};
|
|
2
|
+
//# sourceMappingURL=use-mobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mobile.js","sources":["../../lib/utils/use-mobile.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile() {\n\tconst [isMobile, setIsMobile] = useState<boolean | undefined>(\n\t\tundefined,\n\t);\n\n\tuseEffect(() => {\n\t\tconst mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n\t\tconst onChange = () => {\n\t\t\tsetIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n\t\t};\n\t\tmql.addEventListener(\"change\", onChange);\n\t\tsetIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n\t\treturn () => mql.removeEventListener(\"change\", onChange);\n\t}, []);\n\n\treturn !!isMobile;\n}\n"],"names":["MOBILE_BREAKPOINT","useIsMobile","isMobile","setIsMobile","useState","useEffect","mql","onChange"],"mappings":"gDAEA,MAAMA,EAAoB,IAEnB,SAASC,GAAc,CAC7B,KAAM,CAACC,EAAUC,CAAW,EAAIC,EAC/B,MAAA,EAGD,OAAAC,EAAU,IAAM,CACf,MAAMC,EAAM,OAAO,WAAW,eAAeN,EAAoB,CAAC,KAAK,EACjEO,EAAW,IAAM,CACtBJ,EAAY,OAAO,WAAaH,CAAiB,CAClD,EACA,OAAAM,EAAI,iBAAiB,SAAUC,CAAQ,EACvCJ,EAAY,OAAO,WAAaH,CAAiB,EAC1C,IAAMM,EAAI,oBAAoB,SAAUC,CAAQ,CACxD,EAAG,CAAA,CAAE,EAEE,CAAC,CAACL,CACV"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cryptlex/web-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0-alpha",
|
|
4
4
|
"description": "React component library for Cryptlex web applications",
|
|
5
5
|
"author": "Cryptlex",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"private": false,
|
|
8
8
|
"exports": {
|
|
9
9
|
"./components/*": {
|
|
10
|
-
"import": "./
|
|
10
|
+
"import": "./dist/components/*"
|
|
11
11
|
},
|
|
12
12
|
"./utils/*": {
|
|
13
|
-
"import": "./
|
|
13
|
+
"import": "./dist/utils/*"
|
|
14
14
|
},
|
|
15
15
|
"./index.css": "./lib/index.css",
|
|
16
16
|
"./tokens.css": "./lib/tokens.css",
|
|
@@ -19,7 +19,12 @@
|
|
|
19
19
|
"./utilities.css": "./lib/utilities.css"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"
|
|
22
|
+
"dist",
|
|
23
|
+
"./lib/index.css",
|
|
24
|
+
"./lib/tokens.css",
|
|
25
|
+
"./lib/theme.css",
|
|
26
|
+
"./lib/base.css",
|
|
27
|
+
"./lib/utilities.css"
|
|
23
28
|
],
|
|
24
29
|
"repository": {
|
|
25
30
|
"type": "git",
|
|
@@ -41,7 +46,7 @@
|
|
|
41
46
|
"@dnd-kit/core": "6.3.1",
|
|
42
47
|
"@dnd-kit/sortable": "10.0.0",
|
|
43
48
|
"@dnd-kit/utilities": "3.2.2",
|
|
44
|
-
"@internationalized/date": "
|
|
49
|
+
"@internationalized/date": "3.8.2",
|
|
45
50
|
"@tanstack/react-form": "1.6.3",
|
|
46
51
|
"@tanstack/react-query": "5.62.3",
|
|
47
52
|
"@tanstack/react-table": "8.20.5",
|
|
@@ -61,6 +66,7 @@
|
|
|
61
66
|
"tw-animate-css": "1.3.0"
|
|
62
67
|
},
|
|
63
68
|
"devDependencies": {
|
|
69
|
+
"@rollup/plugin-node-resolve": "16.0.1",
|
|
64
70
|
"@storybook/addon-docs": "9.0.18",
|
|
65
71
|
"@storybook/addon-links": "9.0.18",
|
|
66
72
|
"@storybook/addon-onboarding": "9.0.18",
|
|
@@ -70,17 +76,19 @@
|
|
|
70
76
|
"@types/node": "^22.7.8",
|
|
71
77
|
"@types/react": "^19.1.0",
|
|
72
78
|
"@types/react-dom": "^19.1.0",
|
|
73
|
-
"@vitejs/plugin-react": "
|
|
79
|
+
"@vitejs/plugin-react": "4.7.0",
|
|
80
|
+
"rollup-preserve-directives": "1.1.3",
|
|
74
81
|
"sass": "1.80.6",
|
|
75
82
|
"storybook": "9.0.18",
|
|
76
83
|
"typescript": "5.8.3",
|
|
77
84
|
"typescript-eslint": "8.38.0",
|
|
78
85
|
"vite": "7.0.6",
|
|
79
|
-
"vite-
|
|
86
|
+
"vite-plugin-dts": "4.5.4",
|
|
87
|
+
"vite-tsconfig-paths": "5.1.4",
|
|
80
88
|
"zod": "3.25.20"
|
|
81
89
|
},
|
|
82
90
|
"scripts": {
|
|
83
|
-
"build": "tsc",
|
|
91
|
+
"build": "tsc && vite build",
|
|
84
92
|
"lint": "eslint .",
|
|
85
93
|
"storybook": "storybook dev -p 6006 --no-open",
|
|
86
94
|
"build:storybook": "storybook build",
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import type { CalendarDateTime } from "@internationalized/date";
|
|
2
|
-
import { useDataTable, type OperationKeys } from "lib/components/data-table/data-table";
|
|
3
|
-
import { type ApiFilters } from "lib/components/data-table/table-commons";
|
|
4
|
-
import { TfDatePicker } from "lib/components/inputs/date-picker";
|
|
5
|
-
import { TfIdSearchInput } from "lib/components/inputs/id-search";
|
|
6
|
-
import type { MultiSelectProps } from "lib/components/inputs/multi-select";
|
|
7
|
-
import { Button } from "lib/components/ui/button";
|
|
8
|
-
import { EasyMenu, MenuItem } from "lib/components/ui/menu";
|
|
9
|
-
import { Popover, PopoverTrigger } from "lib/components/ui/popover";
|
|
10
|
-
import { useAppForm } from "lib/utils/form-hook";
|
|
11
|
-
import { cn } from "lib/utils/primitives";
|
|
12
|
-
import { useResourceFormatter } from "lib/utils/resource-names";
|
|
13
|
-
import { Filter, Trash } from "lucide-react";
|
|
14
|
-
import { useRef } from "react";
|
|
15
|
-
|
|
16
|
-
export const FILTER_COMPARISON_OPERATORS = [
|
|
17
|
-
'eq',
|
|
18
|
-
'ne',
|
|
19
|
-
'cn',
|
|
20
|
-
'nc',
|
|
21
|
-
'sw',
|
|
22
|
-
'ew',
|
|
23
|
-
'in',
|
|
24
|
-
'nin',
|
|
25
|
-
'gt',
|
|
26
|
-
'gte',
|
|
27
|
-
'lt',
|
|
28
|
-
'lte',
|
|
29
|
-
] as const;
|
|
30
|
-
export type FilterComparisonOperator =
|
|
31
|
-
(typeof FILTER_COMPARISON_OPERATORS)[number];
|
|
32
|
-
|
|
33
|
-
export const COMPARISON_OPERATOR_LABELS: Record<
|
|
34
|
-
FilterComparisonOperator,
|
|
35
|
-
string
|
|
36
|
-
> = {
|
|
37
|
-
eq: 'equal to',
|
|
38
|
-
ne: 'not equal to',
|
|
39
|
-
cn: 'contains',
|
|
40
|
-
nc: 'does not contain',
|
|
41
|
-
sw: 'starts with',
|
|
42
|
-
ew: 'ends with',
|
|
43
|
-
in: 'includes',
|
|
44
|
-
nin: 'does not include',
|
|
45
|
-
gt: 'greater than',
|
|
46
|
-
gte: 'greater than or equal to',
|
|
47
|
-
lt: 'less than',
|
|
48
|
-
lte: 'less than or equal to',
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
type BaseLocalFilter<T extends FilterType, V> = {
|
|
52
|
-
id: string;
|
|
53
|
-
type: T;
|
|
54
|
-
property: string;
|
|
55
|
-
operator: FilterComparisonOperator;
|
|
56
|
-
value: V | undefined;
|
|
57
|
-
displayValue?: string;
|
|
58
|
-
};
|
|
59
|
-
type EnumLocalFilter = BaseLocalFilter<'enum', Set<string | number>>;
|
|
60
|
-
type IdLocalFilter = BaseLocalFilter<'id', string>;
|
|
61
|
-
type BoolLocalFilter = BaseLocalFilter<'bool', boolean>;
|
|
62
|
-
type StringLocalFilter = BaseLocalFilter<'string', string>;
|
|
63
|
-
type DateLocalFilter = BaseLocalFilter<'date', CalendarDateTime>;
|
|
64
|
-
type IdSearchLocalFilter = BaseLocalFilter<'id-search', Set<string | number>>;
|
|
65
|
-
|
|
66
|
-
type LocalFilter = EnumLocalFilter
|
|
67
|
-
| IdLocalFilter
|
|
68
|
-
| BoolLocalFilter
|
|
69
|
-
| StringLocalFilter
|
|
70
|
-
| DateLocalFilter
|
|
71
|
-
| IdSearchLocalFilter;
|
|
72
|
-
|
|
73
|
-
export type FilterConfig =
|
|
74
|
-
| { type: 'enum'; options: MultiSelectProps['items'] }
|
|
75
|
-
| { type: 'id-search'; search: () => Promise<{ id: string; name: string }[]> }
|
|
76
|
-
| { type: 'id' }
|
|
77
|
-
| { type: 'bool' }
|
|
78
|
-
| { type: 'string' }
|
|
79
|
-
| { type: 'date' }
|
|
80
|
-
|
|
81
|
-
export type FilterType = FilterConfig['type'];
|
|
82
|
-
|
|
83
|
-
const FilterOperations: Record<FilterType, FilterComparisonOperator[]> = {
|
|
84
|
-
'bool': ['eq'],
|
|
85
|
-
'enum': ['in', 'nin'],
|
|
86
|
-
'id': ['in', 'nin'],
|
|
87
|
-
'id-search': ['in', 'nin'],
|
|
88
|
-
'string': ['eq', 'ne', 'cn', 'nc', 'sw', 'ew', 'in', 'nin'],
|
|
89
|
-
'date': ['lt', 'gt'],
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export type FiltersConfig<TOperation extends OperationKeys> = Required<Record<keyof ApiFilters<TOperation>, FilterConfig>>
|
|
93
|
-
|
|
94
|
-
export function DataTableFilter({ className, ...props }: React.ComponentProps<'section'>) {
|
|
95
|
-
const { filters, query, setFilters, filterConfig } = useDataTable();
|
|
96
|
-
// TODO focus
|
|
97
|
-
// const localFilterRefs = useRef([]);
|
|
98
|
-
const addFilterButtonRef = useRef<HTMLButtonElement>(null);
|
|
99
|
-
|
|
100
|
-
const resourceFormatter = useResourceFormatter();
|
|
101
|
-
|
|
102
|
-
const DEFAULT_VALUES: { filters: LocalFilter[] } = {
|
|
103
|
-
// TODO, initialize with filters from tableState
|
|
104
|
-
filters: []
|
|
105
|
-
};
|
|
106
|
-
const form = useAppForm({
|
|
107
|
-
defaultValues: DEFAULT_VALUES,
|
|
108
|
-
onSubmit: ({ value }) => {
|
|
109
|
-
// TODO, instead of generic transformation, use type based tranform()
|
|
110
|
-
setFilters(value.filters.map(lf => { return { [lf.property]: { [lf.operator]: [lf.value] } } }))
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
// More reason to hate TS https://github.com/Microsoft/TypeScript/issues/12870
|
|
115
|
-
const filterKeys = Object.keys(filterConfig).sort();
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<section {...props} className={cn("flex gap-icon items-center", className)}>
|
|
119
|
-
<PopoverTrigger onOpenChange={(o) => {
|
|
120
|
-
// Set filters when the popover closes
|
|
121
|
-
if (!o) {
|
|
122
|
-
form.handleSubmit();
|
|
123
|
-
} else {
|
|
124
|
-
addFilterButtonRef.current?.focus();
|
|
125
|
-
}
|
|
126
|
-
}}>
|
|
127
|
-
<Button active={filters.length > 0} isDisabled={query.isPending || filterKeys.length === 0} type="button" size={'icon'} variant={'neutral'}><Filter /></Button>
|
|
128
|
-
{/* TODO, icon maps with dynamic imports? */}
|
|
129
|
-
{/* TODO open popover with form for property specific filter */}
|
|
130
|
-
{/* TODO, icons here??? */}
|
|
131
|
-
<Popover className="w-full p-icon">
|
|
132
|
-
{/* const h3Styles = "body mb-icon text-muted-foreground"; */}
|
|
133
|
-
{/* <h3 className={h3Styles}>{isFiltersActive ? "Active filters" : "Add filters"}</h3> */}
|
|
134
|
-
<form onSubmit={(e) => { e.preventDefault(); }} className="flex flex-col gap-icon max-h-table overflow-auto ">
|
|
135
|
-
<form.Field mode="array" name={"filters"}>
|
|
136
|
-
{
|
|
137
|
-
(field) => {
|
|
138
|
-
return <>
|
|
139
|
-
{field.state.value.map((lf, i) => {
|
|
140
|
-
return (
|
|
141
|
-
<div key={lf.id} className="flex gap-icon items-center justify-normal">
|
|
142
|
-
<span className="text-sm">{resourceFormatter(lf.property)}</span>
|
|
143
|
-
<form.AppField
|
|
144
|
-
key={lf.id}
|
|
145
|
-
name={`filters[${i}].operator`}
|
|
146
|
-
>
|
|
147
|
-
{(sf) => (<sf.TfSingleSelect items={FilterOperations[lf.type].map(op => ({ id: op, label: <>{COMPARISON_OPERATOR_LABELS[op]}</> }))} />)}
|
|
148
|
-
</form.AppField>
|
|
149
|
-
|
|
150
|
-
{lf.type === 'bool' && <form.AppField name={`filters[${i}].value`}>{(sf) => (<sf.TfCheckbox />)}</form.AppField>}
|
|
151
|
-
{lf.type === 'date' && <form.AppField name={`filters[${i}].value`}>{(_) => (<TfDatePicker />)}</form.AppField>}
|
|
152
|
-
{lf.type === 'id' && <form.AppField name={`filters[${i}].value`}>{(sf) => (<sf.TfTextField />)}</form.AppField>}
|
|
153
|
-
{lf.type === 'string' && <form.AppField name={`filters[${i}].value`}>{(sf) => (<sf.TfTextField />)}</form.AppField>}
|
|
154
|
-
{/* @ts-ignore */}
|
|
155
|
-
{lf.type === 'enum' && <form.AppField name={`filters[${i}].value`}>{(sf) => (<sf.TfMultiSelect items={filterConfig[lf.property].options} />)}</form.AppField>}
|
|
156
|
-
{/* @ts-ignore */}
|
|
157
|
-
{lf.type === 'id-search' && <form.AppField name={`filters[${i}].value`}>{(_) => (<TfIdSearchInput multiple accessor="id" searchFn={filterConfig[lf.property].search} />)}</form.AppField>}
|
|
158
|
-
|
|
159
|
-
<Button type="button" variant="destructive" size="icon" onPress={() => field.removeValue(i)}><Trash /></Button>
|
|
160
|
-
</div>
|
|
161
|
-
)
|
|
162
|
-
})}
|
|
163
|
-
<div className="flex w-full items-center justify-end gap-2 not-first:mt-icon">
|
|
164
|
-
<EasyMenu label="Add Filter">
|
|
165
|
-
{filterKeys.map(k => <MenuItem key={k} onAction={() => {
|
|
166
|
-
//@ts-ignore
|
|
167
|
-
const type = filterConfig[k].type as FilterType;
|
|
168
|
-
|
|
169
|
-
const defaultValue = (t: FilterType) => {
|
|
170
|
-
// TODO, ensure exhaustive???
|
|
171
|
-
switch (t) {
|
|
172
|
-
case 'bool':
|
|
173
|
-
return true;
|
|
174
|
-
case 'string':
|
|
175
|
-
return '';
|
|
176
|
-
case 'date':
|
|
177
|
-
return new Date().toISOString();
|
|
178
|
-
case 'id':
|
|
179
|
-
return '';
|
|
180
|
-
case 'id-search':
|
|
181
|
-
return [] as string[];
|
|
182
|
-
case 'enum':
|
|
183
|
-
return [] as string[];
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const newFilter: LocalFilter = {
|
|
188
|
-
id: `${k}-${Date.now()}`,
|
|
189
|
-
operator: FilterOperations[type][0],
|
|
190
|
-
//@ts-ignore
|
|
191
|
-
value: defaultValue(type),
|
|
192
|
-
type: type,
|
|
193
|
-
property: k,
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
field.pushValue(newFilter);
|
|
197
|
-
// TODO Focus to ref
|
|
198
|
-
|
|
199
|
-
}} className="dropdown-item">{resourceFormatter(k)}</MenuItem>)}
|
|
200
|
-
</EasyMenu>
|
|
201
|
-
{field.state.value.length > 0 ? (
|
|
202
|
-
<Button
|
|
203
|
-
type="button"
|
|
204
|
-
variant="neutral"
|
|
205
|
-
onPress={() => { field.setValue([]) }}
|
|
206
|
-
>
|
|
207
|
-
Reset filters
|
|
208
|
-
</Button>
|
|
209
|
-
) : null}
|
|
210
|
-
</div>
|
|
211
|
-
</>
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
</form.Field >
|
|
215
|
-
</form>
|
|
216
|
-
</Popover>
|
|
217
|
-
</PopoverTrigger>
|
|
218
|
-
</section>
|
|
219
|
-
);
|
|
220
|
-
};
|