@syscore/ui-library 2.0.0-beta-publish-workflow-beta.16 → 2.0.0-beta-publish-workflow-beta.17
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/client/components/icons/IconUtility.tsx +353 -0
- package/client/components/icons/X.tsx +4 -3
- package/client/components/ui/alert-v02.tsx +2 -6
- package/client/components/ui/button-v01.tsx +2 -12
- package/client/components/ui/button.tsx +39 -3
- package/client/components/ui/dropdown.tsx +2 -12
- package/client/components/ui/navigation.tsx +25 -4
- package/client/components/ui/radio-v01.tsx +84 -0
- package/client/components/ui/search-field-v01.tsx +10 -28
- package/client/components/ui/section-heading.tsx +1 -1
- package/client/components/ui/sign-in-field-v01.tsx +150 -0
- package/client/global.css +354 -73
- package/client/lib/system-icons.ts +1583 -0
- package/client/lib/utility-icons.ts +121 -0
- package/client/ui/Button.stories.tsx +63 -0
- package/client/ui/Colors.stories.tsx +34 -31
- package/client/ui/Icons.stories.tsx +179 -0
- package/client/ui/RadioGroup/RadioGroup.stories.tsx +1 -1
- package/client/ui/RadioV01/RadioV01.stories.tsx +136 -0
- package/client/ui/SearchField/SearchField.stories.tsx +4 -1
- package/client/ui/TextAreaV01/TextAreaV01.stories.tsx +23 -2
- package/client/ui/TextFieldV01/PasswordFieldV01.stories.tsx +25 -11
- package/client/ui/TextFieldV01/SignInFieldV01.stories.tsx +196 -0
- package/dist/client/assets/alert/icon-clear.svg.js +4 -0
- package/dist/client/assets/alert/icon-done.svg.js +4 -0
- package/dist/client/assets/avatar-identity/placeholder-icon.svg.js +4 -0
- package/dist/client/assets/breadcrumb/icon-ellipsis.svg.js +4 -0
- package/dist/client/assets/breadcrumb/icon-home.svg.js +4 -0
- package/dist/client/assets/breadcrumb/icon-separator.svg.js +4 -0
- package/dist/client/assets/button-v01/icon-back.svg.js +4 -0
- package/dist/client/assets/button-v01/icon-check.svg.js +4 -0
- package/dist/client/assets/button-v01/icon-close.svg.js +4 -0
- package/dist/client/assets/button-v01/icon-delete.svg.js +4 -0
- package/dist/client/assets/button-v01/icon-device.svg.js +4 -0
- package/dist/client/assets/dropdown/icon-carrot-contract.svg.js +4 -0
- package/dist/client/assets/dropdown/icon-carrot-expand.svg.js +4 -0
- package/dist/client/assets/dropdown/icon-clear.svg.js +4 -0
- package/dist/client/assets/dropdown/icon-enter.svg.js +4 -0
- package/dist/client/components/icons/AlphaIcon.js +129 -0
- package/dist/client/components/icons/ConceptIcons.js +905 -0
- package/dist/client/components/icons/IconUtility.js +410 -0
- package/dist/client/components/icons/NavAccount.js +37 -0
- package/dist/client/components/icons/NavBullet.js +17 -0
- package/dist/client/components/icons/NavLogo.js +48 -0
- package/dist/client/components/icons/StandardLogo.js +93 -0
- package/dist/client/components/icons/UtilityAccordion.js +27 -0
- package/dist/client/components/icons/UtilityChangeType.js +26 -0
- package/dist/client/components/icons/UtilityCheck.js +28 -0
- package/dist/client/components/icons/UtilityChevronDown.js +39 -0
- package/dist/client/components/icons/UtilityClassification.js +53 -0
- package/dist/client/components/icons/UtilityClearRegular.js +51 -0
- package/dist/client/components/icons/UtilityClose.js +49 -0
- package/dist/client/components/icons/UtilityCompare.js +91 -0
- package/dist/client/components/icons/UtilityDrag.js +89 -0
- package/dist/client/components/icons/UtilityEdit.js +50 -0
- package/dist/client/components/icons/UtilityFeedback.js +38 -0
- package/dist/client/components/icons/UtilityHome.js +34 -0
- package/dist/client/components/icons/UtilityMessage.js +41 -0
- package/dist/client/components/icons/UtilityOptions.js +53 -0
- package/dist/client/components/icons/UtilityPortfolio.js +116 -0
- package/dist/client/components/icons/UtilityReset.js +49 -0
- package/dist/client/components/icons/UtilityRevisionsHide.js +76 -0
- package/dist/client/components/icons/UtilityRevisionsShow.js +56 -0
- package/dist/client/components/icons/UtilitySave.js +38 -0
- package/dist/client/components/icons/UtilityScopeLarge.js +123 -0
- package/dist/client/components/icons/UtilityScoring.js +51 -0
- package/dist/client/components/icons/UtilitySearch.js +46 -0
- package/dist/client/components/icons/UtilityShow.js +49 -0
- package/dist/client/components/icons/UtilitySort.js +63 -0
- package/dist/client/components/icons/UtilityTarget.js +29 -0
- package/dist/client/components/icons/UtilityTargetActive.js +48 -0
- package/dist/client/components/icons/UtilityText.js +59 -0
- package/dist/client/components/icons/UtilityTrash.js +66 -0
- package/dist/client/components/icons/UtilityTriangleInfo.js +38 -0
- package/dist/client/components/icons/X.js +40 -0
- package/dist/client/components/icons/achievement-badges/BadgeCertificationBronze.js +144 -0
- package/dist/client/components/icons/achievement-badges/BadgeCertificationGold.js +144 -0
- package/dist/client/components/icons/achievement-badges/BadgeCertificationPlatinum.js +144 -0
- package/dist/client/components/icons/achievement-badges/BadgeCertificationSilver.js +144 -0
- package/dist/client/components/icons/achievement-badges/BadgeRatingCoworking.js +91 -0
- package/dist/client/components/icons/achievement-badges/BadgeRatingDesign.js +91 -0
- package/dist/client/components/icons/achievement-badges/BadgeRatingEquity.js +91 -0
- package/dist/client/components/icons/achievement-badges/BadgeRatingHealthySafety.js +93 -0
- package/dist/client/components/icons/achievement-badges/BadgeRatingOperations.js +93 -0
- package/dist/client/components/icons/achievement-badges/BadgeRatingPerformance.js +93 -0
- package/dist/client/components/icons/achievement-badges/BadgeRatingRealEstate.js +93 -0
- package/dist/client/components/icons/achievement-badges/BadgeRatingResidential.js +93 -0
- package/dist/client/components/icons/achievement-badges/BadgeRatingWorkforce.js +91 -0
- package/dist/client/components/icons/imperative-badges/BadgeImperativePrimary.js +58 -0
- package/dist/client/components/icons/imperative-badges/BadgeImperativeSecondary.js +69 -0
- package/dist/client/components/icons/provider-badges/BadgeEnterpriseProvider.js +117 -0
- package/dist/client/components/icons/provider-badges/BadgePerformanceTestingProvider.js +124 -0
- package/dist/client/components/icons/provider-badges/BadgeProductProvider.js +117 -0
- package/dist/client/components/icons/provider-badges/BadgeSurveyProvider.js +117 -0
- package/dist/client/components/icons/provider-seals/SealEnterpriseProvider.js +100 -0
- package/dist/client/components/icons/provider-seals/SealPerformanceTestingProvider.js +100 -0
- package/dist/client/components/icons/provider-seals/SealProductProvider.js +98 -0
- package/dist/client/components/icons/provider-seals/SealProviders.js +98 -0
- package/dist/client/components/icons/provider-seals/SealSurveyProvider.js +98 -0
- package/dist/client/components/icons/seals/IWBILogo.js +301 -0
- package/dist/client/components/icons/seals/SealCertification.js +206 -0
- package/dist/client/components/icons/seals/SealCertificationBronze.js +140 -0
- package/dist/client/components/icons/seals/SealCertificationGold.js +140 -0
- package/dist/client/components/icons/seals/SealCertificationPlatinum.js +140 -0
- package/dist/client/components/icons/seals/SealCertificationSilver.js +140 -0
- package/dist/client/components/icons/seals/SealIwbiMember.js +134 -0
- package/dist/client/components/icons/seals/SealRating.js +157 -0
- package/dist/client/components/icons/seals/SealRatingCoworking.js +89 -0
- package/dist/client/components/icons/seals/SealRatingDesign.js +89 -0
- package/dist/client/components/icons/seals/SealRatingEquity.js +89 -0
- package/dist/client/components/icons/seals/SealRatingHealthSafety.js +91 -0
- package/dist/client/components/icons/seals/SealRatingOperations.js +89 -0
- package/dist/client/components/icons/seals/SealRatingPerformance.js +91 -0
- package/dist/client/components/icons/seals/SealRatingRealEstate.js +89 -0
- package/dist/client/components/icons/seals/SealRatingWorkforce.js +89 -0
- package/dist/client/components/icons/seals/SealWell.js +132 -0
- package/dist/client/components/icons/seals/SealWellCertification.js +225 -0
- package/dist/client/components/icons/seals/SealWellCommunity.js +197 -0
- package/dist/client/components/icons/seals/SealWellResidence.js +197 -0
- package/dist/client/components/icons/seals/SealWorksWithWell.js +227 -0
- package/dist/client/components/icons/seals/WaterMarkWWWProducts.js +27 -0
- package/dist/client/components/icons/seals/WaterMarkWellProjects.js +36 -0
- package/dist/client/components/icons/seals/WatermarkMemberOrg.js +24 -0
- package/dist/client/components/ui/accordion.js +326 -0
- package/dist/client/components/ui/alert-dialog-panel.js +156 -0
- package/dist/client/components/ui/alert-dialog.js +103 -0
- package/dist/client/components/ui/alert-v02.js +157 -0
- package/dist/client/components/ui/alert.js +55 -0
- package/dist/client/components/ui/app-bar.js +203 -0
- package/dist/client/components/ui/aspect-ratio.js +5 -0
- package/dist/client/components/ui/avatar-identity.js +93 -0
- package/dist/client/components/ui/avatar.js +56 -0
- package/dist/client/components/ui/back-link.js +27 -0
- package/dist/client/components/ui/banner.js +75 -0
- package/dist/client/components/ui/bottom-navigation.js +127 -0
- package/dist/client/components/ui/breadcrumb-trail.js +137 -0
- package/dist/client/components/ui/breadcrumb.js +91 -0
- package/dist/client/components/ui/button-v01.js +173 -0
- package/dist/client/components/ui/button.js +99 -0
- package/dist/client/components/ui/calendar.js +62 -0
- package/dist/client/components/ui/card.js +177 -0
- package/dist/client/components/ui/carousel.js +198 -0
- package/dist/client/components/ui/centered-page.js +10 -0
- package/dist/client/components/ui/chart.js +239 -0
- package/dist/client/components/ui/checkbox-field.js +39 -0
- package/dist/client/components/ui/checkbox.js +18 -0
- package/dist/client/components/ui/code-badge.js +29 -0
- package/dist/client/components/ui/collapsible.js +9 -0
- package/dist/client/components/ui/command.js +79 -0
- package/dist/client/components/ui/context-menu.js +138 -0
- package/dist/client/components/ui/copy.js +39 -0
- package/dist/client/components/ui/credit-card-preview.js +74 -0
- package/dist/client/components/ui/data-grid.js +156 -0
- package/dist/client/components/ui/date-picker.js +142 -0
- package/dist/client/components/ui/dialog.js +179 -0
- package/dist/client/components/ui/drawer.js +95 -0
- package/dist/client/components/ui/drop-zone.js +87 -0
- package/dist/client/components/ui/dropdown-menu.js +139 -0
- package/dist/client/components/ui/dropdown.js +339 -0
- package/dist/client/components/ui/empty-state.js +76 -0
- package/dist/client/components/ui/field-group.js +32 -0
- package/dist/client/components/ui/file-upload-trigger.js +70 -0
- package/dist/client/components/ui/file-upload.js +171 -0
- package/dist/client/components/ui/footer.js +97 -0
- package/dist/client/components/ui/form.js +109 -0
- package/dist/client/components/ui/height-container.js +41 -0
- package/dist/client/components/ui/hero-section.js +44 -0
- package/dist/client/components/ui/hero-split-image.js +45 -0
- package/dist/client/components/ui/hover-card.js +22 -0
- package/dist/client/components/ui/icon-button.js +30 -0
- package/dist/client/components/ui/inline-notice.js +19 -0
- package/dist/client/components/ui/input-otp.js +46 -0
- package/dist/client/components/ui/input.js +37 -0
- package/dist/client/components/ui/label.js +31 -0
- package/dist/client/components/ui/labeled-divider.js +23 -0
- package/dist/client/components/ui/layout.js +724 -0
- package/dist/client/components/ui/menubar.js +157 -0
- package/dist/client/components/ui/meta-row.js +19 -0
- package/dist/client/components/ui/mobile-nav.js +230 -0
- package/dist/client/components/ui/modal-panel.js +116 -0
- package/dist/client/components/ui/navigation-menu.js +89 -0
- package/dist/client/components/ui/navigation.js +452 -0
- package/dist/client/components/ui/outline-node.js +57 -0
- package/dist/client/components/ui/page-header.js +79 -0
- package/dist/client/components/ui/pagination-v01.js +124 -0
- package/dist/client/components/ui/pagination.js +105 -0
- package/dist/client/components/ui/password-field-v01.js +46 -0
- package/dist/client/components/ui/pill-button.js +34 -0
- package/dist/client/components/ui/popover.js +22 -0
- package/dist/client/components/ui/price-tag.js +20 -0
- package/dist/client/components/ui/profile-avatar.js +92 -0
- package/dist/client/components/ui/progress.js +23 -0
- package/dist/client/components/ui/radio-card.js +30 -0
- package/dist/client/components/ui/radio-group.js +32 -0
- package/dist/client/components/ui/radio-v01.js +58 -0
- package/dist/client/components/ui/resizable.js +32 -0
- package/dist/client/components/ui/resource-thumbnail.js +24 -0
- package/dist/client/components/ui/scroll-area.js +37 -0
- package/dist/client/components/ui/search-field-v01.js +111 -0
- package/dist/client/components/ui/search.js +109 -0
- package/dist/client/components/ui/section-badge.js +22 -0
- package/dist/client/components/ui/section-heading.js +21 -0
- package/dist/client/components/ui/select.js +96 -0
- package/dist/client/components/ui/separator.js +24 -0
- package/dist/client/components/ui/sheet.js +106 -0
- package/dist/client/components/ui/side-nav.js +173 -0
- package/dist/client/components/ui/sidebar.js +580 -0
- package/dist/client/components/ui/sign-in-field-v01.js +107 -0
- package/dist/client/components/ui/skeleton.js +17 -0
- package/dist/client/components/ui/slider.js +20 -0
- package/dist/client/components/ui/social-button.js +34 -0
- package/dist/client/components/ui/standard-navigation.js +454 -0
- package/dist/client/components/ui/status-pill.js +42 -0
- package/dist/client/components/ui/stepper.js +111 -0
- package/dist/client/components/ui/switch-v01.js +39 -0
- package/dist/client/components/ui/switch.js +17 -0
- package/dist/client/components/ui/system-bar.js +76 -0
- package/dist/client/components/ui/table.js +107 -0
- package/dist/client/components/ui/tabs-v01.js +74 -0
- package/dist/client/components/ui/tabs.js +253 -0
- package/dist/client/components/ui/tag-v02.js +85 -0
- package/dist/client/components/ui/tag.js +73 -0
- package/dist/client/components/ui/text-area-v01.js +26 -0
- package/dist/client/components/ui/text-field-v01.js +78 -0
- package/dist/client/components/ui/text-link.js +23 -0
- package/dist/client/components/ui/textarea.js +19 -0
- package/dist/client/components/ui/timeline.js +87 -0
- package/dist/client/components/ui/toast-v01.js +155 -0
- package/dist/client/components/ui/toast.js +88 -0
- package/dist/client/components/ui/toaster.js +22 -0
- package/dist/client/components/ui/toggle.js +56 -0
- package/dist/client/components/ui/tooltip.js +328 -0
- package/dist/client/components/ui/typography.js +119 -0
- package/dist/client/hooks/use-mobile.js +20 -0
- package/dist/client/hooks/use-segmented-control.js +32 -0
- package/dist/client/hooks/use-tabs.js +22 -0
- package/dist/client/hooks/use-toast.js +122 -0
- package/dist/client/lib/concept-colors.js +74 -0
- package/dist/client/lib/concept-icons.js +32 -0
- package/dist/client/lib/utility-icons.js +73 -0
- package/dist/client/lib/utils.js +13 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +156 -0
- package/dist/ui/index.js +774 -0
- package/package.json +9 -6
- package/dist/index.cjs.js +0 -1
- package/dist/index.es.js +0 -18989
- /package/{dist → client}/fonts/FT-Made/FTMade-Regular.otf +0 -0
- /package/{dist → client}/fonts/FT-Made/FTMade-Regular.ttf +0 -0
- /package/{dist → client}/fonts/FT-Made/FTMade-Regular.woff +0 -0
- /package/{dist → client}/fonts/FT-Made/FTMade-Regular.woff2 +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-black.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-blackitalic.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-bold.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-bolditalic.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-extrabold.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-extrabolditalic.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-extralight.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-extralightitalic.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-italic.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-light.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-lightitalic.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-medium.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-mediumitalic.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-regular.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-semibold.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-semibolditalic.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-thin.otf +0 -0
- /package/{dist → client}/fonts/Mazzard-M/mazzardsoftm-thinitalic.otf +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const CodeBadge = React.forwardRef(
|
|
5
|
+
({
|
|
6
|
+
className,
|
|
7
|
+
variant = "theme",
|
|
8
|
+
concept = "community",
|
|
9
|
+
tone = "trail",
|
|
10
|
+
...props
|
|
11
|
+
}, ref) => /* @__PURE__ */ jsx(
|
|
12
|
+
"span",
|
|
13
|
+
{
|
|
14
|
+
ref,
|
|
15
|
+
className: cn(
|
|
16
|
+
"code-badge number-small font-semibold",
|
|
17
|
+
variant === "theme" ? "code-badge--theme" : "code-badge--strategy",
|
|
18
|
+
`code-badge--${concept}`,
|
|
19
|
+
tone === "table" && "code-badge--tone-table",
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
...props
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
CodeBadge.displayName = "CodeBadge";
|
|
27
|
+
export {
|
|
28
|
+
CodeBadge
|
|
29
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
2
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
3
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
4
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
5
|
+
export {
|
|
6
|
+
Collapsible,
|
|
7
|
+
CollapsibleContent,
|
|
8
|
+
CollapsibleTrigger
|
|
9
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Command as Command$1 } from "cmdk";
|
|
4
|
+
import { Search } from "lucide-react";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Dialog, DialogContent } from "./dialog.js";
|
|
7
|
+
const Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Command$1, { ref, className: cn("command", className), ...props }));
|
|
8
|
+
Command.displayName = Command$1.displayName;
|
|
9
|
+
const CommandDialog = ({ children, ...props }) => {
|
|
10
|
+
return /* @__PURE__ */ jsx(Dialog, { ...props, children: /* @__PURE__ */ jsx(DialogContent, { className: "command-dialog-content", children: /* @__PURE__ */ jsx(Command, { children }) }) });
|
|
11
|
+
};
|
|
12
|
+
const CommandInput = React.forwardRef(({ className, icon: Icon = Search, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: cn("command-input-wrapper", className), "cmdk-input-wrapper": "", children: [
|
|
13
|
+
/* @__PURE__ */ jsx(Icon, { className: "icon-4 icon-shrink-0" }),
|
|
14
|
+
/* @__PURE__ */ jsx(
|
|
15
|
+
Command$1.Input,
|
|
16
|
+
{
|
|
17
|
+
ref,
|
|
18
|
+
className: cn("command-input", className),
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
] }));
|
|
23
|
+
CommandInput.displayName = Command$1.Input.displayName;
|
|
24
|
+
const CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
25
|
+
Command$1.List,
|
|
26
|
+
{
|
|
27
|
+
ref,
|
|
28
|
+
className: cn("command-list", className),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
));
|
|
32
|
+
CommandList.displayName = Command$1.List.displayName;
|
|
33
|
+
const CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(Command$1.Empty, { ref, className: "command-empty", ...props }));
|
|
34
|
+
CommandEmpty.displayName = Command$1.Empty.displayName;
|
|
35
|
+
const CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
36
|
+
Command$1.Group,
|
|
37
|
+
{
|
|
38
|
+
ref,
|
|
39
|
+
className: cn("command-group", className),
|
|
40
|
+
...props
|
|
41
|
+
}
|
|
42
|
+
));
|
|
43
|
+
CommandGroup.displayName = Command$1.Group.displayName;
|
|
44
|
+
const CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
45
|
+
Command$1.Separator,
|
|
46
|
+
{
|
|
47
|
+
ref,
|
|
48
|
+
className: cn("command-separator", className),
|
|
49
|
+
...props
|
|
50
|
+
}
|
|
51
|
+
));
|
|
52
|
+
CommandSeparator.displayName = Command$1.Separator.displayName;
|
|
53
|
+
const CommandItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
54
|
+
Command$1.Item,
|
|
55
|
+
{
|
|
56
|
+
ref,
|
|
57
|
+
className: cn("command-item", className),
|
|
58
|
+
...props
|
|
59
|
+
}
|
|
60
|
+
));
|
|
61
|
+
CommandItem.displayName = Command$1.Item.displayName;
|
|
62
|
+
const CommandShortcut = ({
|
|
63
|
+
className,
|
|
64
|
+
...props
|
|
65
|
+
}) => {
|
|
66
|
+
return /* @__PURE__ */ jsx("span", { className: cn("command-shortcut", className), ...props });
|
|
67
|
+
};
|
|
68
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
69
|
+
export {
|
|
70
|
+
Command,
|
|
71
|
+
CommandDialog,
|
|
72
|
+
CommandEmpty,
|
|
73
|
+
CommandGroup,
|
|
74
|
+
CommandInput,
|
|
75
|
+
CommandItem,
|
|
76
|
+
CommandList,
|
|
77
|
+
CommandSeparator,
|
|
78
|
+
CommandShortcut
|
|
79
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
4
|
+
import { Check, Circle, ChevronRight } from "lucide-react";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
const ContextMenu = ContextMenuPrimitive.Root;
|
|
7
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
8
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
9
|
+
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
10
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
11
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
12
|
+
const ContextMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
13
|
+
ContextMenuPrimitive.SubTrigger,
|
|
14
|
+
{
|
|
15
|
+
ref,
|
|
16
|
+
className: cn(
|
|
17
|
+
"context-menu-sub-trigger",
|
|
18
|
+
inset && "context-menu-sub-trigger--inset",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
...props,
|
|
22
|
+
children: [
|
|
23
|
+
children,
|
|
24
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "icon-4" })
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
));
|
|
28
|
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
29
|
+
const ContextMenuSubContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
30
|
+
ContextMenuPrimitive.SubContent,
|
|
31
|
+
{
|
|
32
|
+
ref,
|
|
33
|
+
className: cn("context-menu-sub-content", className),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
));
|
|
37
|
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
38
|
+
const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
39
|
+
ContextMenuPrimitive.Content,
|
|
40
|
+
{
|
|
41
|
+
ref,
|
|
42
|
+
className: cn("context-menu-content", className),
|
|
43
|
+
...props
|
|
44
|
+
}
|
|
45
|
+
) }));
|
|
46
|
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
47
|
+
const ContextMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
48
|
+
ContextMenuPrimitive.Item,
|
|
49
|
+
{
|
|
50
|
+
ref,
|
|
51
|
+
className: cn(
|
|
52
|
+
"context-menu-item",
|
|
53
|
+
inset && "context-menu-item--inset",
|
|
54
|
+
className
|
|
55
|
+
),
|
|
56
|
+
...props
|
|
57
|
+
}
|
|
58
|
+
));
|
|
59
|
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
60
|
+
const ContextMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
61
|
+
ContextMenuPrimitive.CheckboxItem,
|
|
62
|
+
{
|
|
63
|
+
ref,
|
|
64
|
+
className: cn("context-menu-checkbox-item", className),
|
|
65
|
+
checked,
|
|
66
|
+
...props,
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsx("span", { className: "context-menu-item-indicator", children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "icon-4" }) }) }),
|
|
69
|
+
children
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
));
|
|
73
|
+
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
74
|
+
const ContextMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
75
|
+
ContextMenuPrimitive.RadioItem,
|
|
76
|
+
{
|
|
77
|
+
ref,
|
|
78
|
+
className: cn("context-menu-radio-item", className),
|
|
79
|
+
...props,
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "context-menu-item-indicator", children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "icon-2 fill-current" }) }) }),
|
|
82
|
+
children
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
));
|
|
86
|
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
87
|
+
const ContextMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
88
|
+
ContextMenuPrimitive.Label,
|
|
89
|
+
{
|
|
90
|
+
ref,
|
|
91
|
+
className: cn(
|
|
92
|
+
"context-menu-label",
|
|
93
|
+
inset && "context-menu-label--inset",
|
|
94
|
+
className
|
|
95
|
+
),
|
|
96
|
+
...props
|
|
97
|
+
}
|
|
98
|
+
));
|
|
99
|
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
100
|
+
const ContextMenuSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
101
|
+
ContextMenuPrimitive.Separator,
|
|
102
|
+
{
|
|
103
|
+
ref,
|
|
104
|
+
className: cn("context-menu-separator", className),
|
|
105
|
+
...props
|
|
106
|
+
}
|
|
107
|
+
));
|
|
108
|
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
109
|
+
const ContextMenuShortcut = ({
|
|
110
|
+
className,
|
|
111
|
+
...props
|
|
112
|
+
}) => {
|
|
113
|
+
return /* @__PURE__ */ jsx(
|
|
114
|
+
"span",
|
|
115
|
+
{
|
|
116
|
+
className: cn("context-menu-shortcut", className),
|
|
117
|
+
...props
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
122
|
+
export {
|
|
123
|
+
ContextMenu,
|
|
124
|
+
ContextMenuCheckboxItem,
|
|
125
|
+
ContextMenuContent,
|
|
126
|
+
ContextMenuGroup,
|
|
127
|
+
ContextMenuItem,
|
|
128
|
+
ContextMenuLabel,
|
|
129
|
+
ContextMenuPortal,
|
|
130
|
+
ContextMenuRadioGroup,
|
|
131
|
+
ContextMenuRadioItem,
|
|
132
|
+
ContextMenuSeparator,
|
|
133
|
+
ContextMenuShortcut,
|
|
134
|
+
ContextMenuSub,
|
|
135
|
+
ContextMenuSubContent,
|
|
136
|
+
ContextMenuSubTrigger,
|
|
137
|
+
ContextMenuTrigger
|
|
138
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const sizeClass = {
|
|
5
|
+
large: "body-large",
|
|
6
|
+
base: "body-base",
|
|
7
|
+
small: "body-small"
|
|
8
|
+
};
|
|
9
|
+
const Copy = React.forwardRef(
|
|
10
|
+
({
|
|
11
|
+
as: Component = "span",
|
|
12
|
+
tone = "default",
|
|
13
|
+
size = "base",
|
|
14
|
+
weight = "regular",
|
|
15
|
+
align,
|
|
16
|
+
italic = false,
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}, ref) => /* @__PURE__ */ jsx(
|
|
20
|
+
Component,
|
|
21
|
+
{
|
|
22
|
+
ref,
|
|
23
|
+
className: cn(
|
|
24
|
+
sizeClass[size],
|
|
25
|
+
"copy",
|
|
26
|
+
`copy--${tone}`,
|
|
27
|
+
`copy--${weight}`,
|
|
28
|
+
align && `copy--align-${align}`,
|
|
29
|
+
italic && "copy--italic",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
Copy.displayName = "Copy";
|
|
37
|
+
export {
|
|
38
|
+
Copy
|
|
39
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const ChipIcon = () => /* @__PURE__ */ jsxs(
|
|
5
|
+
"svg",
|
|
6
|
+
{
|
|
7
|
+
className: "credit-card-preview__chip",
|
|
8
|
+
viewBox: "0 0 34 26",
|
|
9
|
+
role: "presentation",
|
|
10
|
+
"aria-hidden": "true",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ jsx("rect", { x: "0.5", y: "0.5", width: "33", height: "25", rx: "4.5" }),
|
|
13
|
+
/* @__PURE__ */ jsx("path", { d: "M0.5 8.5h8m17 0h8m-33 9h8m17 0h8" }),
|
|
14
|
+
/* @__PURE__ */ jsx("rect", { x: "8.5", y: "0.5", width: "17", height: "25" })
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
const BrandMark = ({ brand }) => {
|
|
19
|
+
if (brand === "visa") {
|
|
20
|
+
return /* @__PURE__ */ jsx("span", { className: "credit-card-preview__brand credit-card-preview__brand--visa", children: "VISA" });
|
|
21
|
+
}
|
|
22
|
+
if (brand === "mastercard") {
|
|
23
|
+
return /* @__PURE__ */ jsxs(
|
|
24
|
+
"span",
|
|
25
|
+
{
|
|
26
|
+
className: "credit-card-preview__brand credit-card-preview__brand--mastercard",
|
|
27
|
+
"aria-label": "Mastercard",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: "credit-card-preview__mc-circle" }),
|
|
30
|
+
/* @__PURE__ */ jsx("span", { className: "credit-card-preview__mc-circle" })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
const CreditCardPreview = React.forwardRef(
|
|
38
|
+
({
|
|
39
|
+
holderName,
|
|
40
|
+
expiry,
|
|
41
|
+
brand = "visa",
|
|
42
|
+
label = "Credit Card",
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
}, ref) => /* @__PURE__ */ jsxs(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
ref,
|
|
49
|
+
className: cn("credit-card-preview", className),
|
|
50
|
+
role: "img",
|
|
51
|
+
"aria-label": `${label} preview`,
|
|
52
|
+
...props,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: "credit-card-preview__label", children: label }),
|
|
55
|
+
/* @__PURE__ */ jsx(ChipIcon, {}),
|
|
56
|
+
/* @__PURE__ */ jsx("span", { className: "credit-card-preview__number", "aria-hidden": "true", children: [0, 1, 2, 3].map((group) => /* @__PURE__ */ jsx("span", { className: "credit-card-preview__group", children: [0, 1, 2, 3].map((dot) => /* @__PURE__ */ jsx("span", { className: "credit-card-preview__dot" }, dot)) }, group)) }),
|
|
57
|
+
/* @__PURE__ */ jsxs("span", { className: "credit-card-preview__footer", children: [
|
|
58
|
+
/* @__PURE__ */ jsxs("span", { className: "credit-card-preview__identity", children: [
|
|
59
|
+
/* @__PURE__ */ jsx("span", { className: "credit-card-preview__name", children: (holderName == null ? void 0 : holderName.trim()) ? holderName : "Card holder" }),
|
|
60
|
+
/* @__PURE__ */ jsxs("span", { className: "credit-card-preview__expiry", children: [
|
|
61
|
+
"Exp. ",
|
|
62
|
+
(expiry == null ? void 0 : expiry.trim()) ? expiry : "•• / ••"
|
|
63
|
+
] })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsx(BrandMark, { brand })
|
|
66
|
+
] })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
CreditCardPreview.displayName = "CreditCardPreview";
|
|
72
|
+
export {
|
|
73
|
+
CreditCardPreview
|
|
74
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { AgGridReact } from "ag-grid-react";
|
|
4
|
+
import { themeQuartz, ModuleRegistry, AllCommunityModule } from "ag-grid-community";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
ModuleRegistry.registerModules([AllCommunityModule]);
|
|
7
|
+
const dataGridTheme = themeQuartz.withParams({
|
|
8
|
+
fontFamily: "var(--font-mazzard, 'Mazzard Soft M'), sans-serif",
|
|
9
|
+
fontSize: 14,
|
|
10
|
+
foregroundColor: "#1f2430",
|
|
11
|
+
backgroundColor: "#ffffff",
|
|
12
|
+
accentColor: "#0f748a",
|
|
13
|
+
borderColor: "#e3e8ef",
|
|
14
|
+
wrapperBorderRadius: 16,
|
|
15
|
+
headerBackgroundColor: "#f6f8fb",
|
|
16
|
+
headerTextColor: "#6b7280",
|
|
17
|
+
headerFontSize: 12,
|
|
18
|
+
headerFontWeight: 600,
|
|
19
|
+
// The pinned (action) column joins the rest of the row; no divider line.
|
|
20
|
+
pinnedColumnBorder: false,
|
|
21
|
+
rowHoverColor: "#f4f9fd",
|
|
22
|
+
columnBorder: false,
|
|
23
|
+
headerColumnBorder: false,
|
|
24
|
+
// The resize handle stays (the column still drags) but is drawn as a faint tick, not a separator line.
|
|
25
|
+
headerColumnResizeHandleColor: "transparent",
|
|
26
|
+
spacing: 8
|
|
27
|
+
});
|
|
28
|
+
const ALIGN_CLASS = {
|
|
29
|
+
left: void 0,
|
|
30
|
+
center: "data-grid__cell--center",
|
|
31
|
+
right: "data-grid__cell--right"
|
|
32
|
+
};
|
|
33
|
+
function shapeOf(columns) {
|
|
34
|
+
return JSON.stringify(
|
|
35
|
+
columns.map((c) => [
|
|
36
|
+
c.key,
|
|
37
|
+
c.header,
|
|
38
|
+
c.sortable ?? false,
|
|
39
|
+
c.filter ?? false,
|
|
40
|
+
c.resizable ?? true,
|
|
41
|
+
c.width ?? null,
|
|
42
|
+
c.minWidth ?? null,
|
|
43
|
+
c.flex ?? null,
|
|
44
|
+
c.align ?? null,
|
|
45
|
+
c.pinned ?? null,
|
|
46
|
+
c.wrap ?? false,
|
|
47
|
+
Boolean(c.value),
|
|
48
|
+
Boolean(c.cell)
|
|
49
|
+
])
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function DataGrid({
|
|
53
|
+
columns,
|
|
54
|
+
rows,
|
|
55
|
+
getRowId,
|
|
56
|
+
loading = false,
|
|
57
|
+
emptyText = "Nothing to show.",
|
|
58
|
+
quickFilter,
|
|
59
|
+
sort,
|
|
60
|
+
onSortChange,
|
|
61
|
+
onRowClick,
|
|
62
|
+
className,
|
|
63
|
+
"aria-label": ariaLabel
|
|
64
|
+
}) {
|
|
65
|
+
const serverSorted = onSortChange !== void 0;
|
|
66
|
+
const latest = React.useRef(columns);
|
|
67
|
+
latest.current = columns;
|
|
68
|
+
const shape = shapeOf(columns);
|
|
69
|
+
const sortKey = (sort == null ? void 0 : sort.key) ?? null;
|
|
70
|
+
const sortDirection = (sort == null ? void 0 : sort.direction) ?? null;
|
|
71
|
+
const columnDefs = React.useMemo(
|
|
72
|
+
() => latest.current.map((column) => {
|
|
73
|
+
const fixed = column.width !== void 0;
|
|
74
|
+
const find = () => latest.current.find((c) => c.key === column.key);
|
|
75
|
+
return {
|
|
76
|
+
colId: column.key,
|
|
77
|
+
headerName: column.header,
|
|
78
|
+
valueGetter: column.value ? (params) => {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
return params.data ? (_b = (_a = find()) == null ? void 0 : _a.value) == null ? void 0 : _b.call(_a, params.data) : void 0;
|
|
81
|
+
} : void 0,
|
|
82
|
+
cellRenderer: column.cell ? (params) => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return params.data ? (_b = (_a = find()) == null ? void 0 : _a.cell) == null ? void 0 : _b.call(_a, params.data) : null;
|
|
85
|
+
} : void 0,
|
|
86
|
+
sortable: column.sortable ?? false,
|
|
87
|
+
filter: column.filter ?? false,
|
|
88
|
+
resizable: column.resizable ?? true,
|
|
89
|
+
suppressMovable: true,
|
|
90
|
+
width: column.width,
|
|
91
|
+
minWidth: column.minWidth ?? (fixed ? column.width : 96),
|
|
92
|
+
flex: fixed ? void 0 : column.flex ?? 1,
|
|
93
|
+
pinned: column.pinned,
|
|
94
|
+
wrapText: column.wrap ?? false,
|
|
95
|
+
autoHeight: column.wrap ?? false,
|
|
96
|
+
cellClass: column.align ? ALIGN_CLASS[column.align] : void 0,
|
|
97
|
+
headerClass: column.align ? ALIGN_CLASS[column.align] : void 0,
|
|
98
|
+
// Server-sorted data keeps the order it arrived in; the grid only draws the indicator.
|
|
99
|
+
...serverSorted ? {
|
|
100
|
+
comparator: () => 0,
|
|
101
|
+
// Server-side sort has no "no sort": clicking again flips the direction.
|
|
102
|
+
sortingOrder: ["asc", "desc"],
|
|
103
|
+
sort: sortKey === column.key ? sortDirection : null
|
|
104
|
+
} : {}
|
|
105
|
+
};
|
|
106
|
+
}),
|
|
107
|
+
// `shape` stands for the column list; the list itself is a new array on most renders.
|
|
108
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
109
|
+
[shape, serverSorted, sortKey, sortDirection]
|
|
110
|
+
);
|
|
111
|
+
const handleSortChanged = React.useCallback(
|
|
112
|
+
(event) => {
|
|
113
|
+
if (!serverSorted) return;
|
|
114
|
+
const active = event.api.getColumnState().find((state) => state.sort);
|
|
115
|
+
const next = (active == null ? void 0 : active.colId) ? { key: active.colId, direction: active.sort === "desc" ? "desc" : "asc" } : null;
|
|
116
|
+
if ((next == null ? void 0 : next.key) === (sort == null ? void 0 : sort.key) && (next == null ? void 0 : next.direction) === (sort == null ? void 0 : sort.direction)) return;
|
|
117
|
+
if (!next && !sort) return;
|
|
118
|
+
onSortChange == null ? void 0 : onSortChange(next);
|
|
119
|
+
},
|
|
120
|
+
[serverSorted, sort, onSortChange]
|
|
121
|
+
);
|
|
122
|
+
return /* @__PURE__ */ jsx(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
role: "region",
|
|
126
|
+
"aria-label": ariaLabel,
|
|
127
|
+
className: cn(
|
|
128
|
+
"data-grid",
|
|
129
|
+
rows.length === 0 && "data-grid--empty",
|
|
130
|
+
onRowClick && "data-grid--clickable",
|
|
131
|
+
className
|
|
132
|
+
),
|
|
133
|
+
children: /* @__PURE__ */ jsx(
|
|
134
|
+
AgGridReact,
|
|
135
|
+
{
|
|
136
|
+
theme: dataGridTheme,
|
|
137
|
+
rowData: rows,
|
|
138
|
+
columnDefs,
|
|
139
|
+
domLayout: "autoHeight",
|
|
140
|
+
rowHeight: 64,
|
|
141
|
+
headerHeight: 48,
|
|
142
|
+
loading,
|
|
143
|
+
quickFilterText: quickFilter,
|
|
144
|
+
getRowId: getRowId ? (params) => getRowId(params.data) : void 0,
|
|
145
|
+
onSortChanged: handleSortChanged,
|
|
146
|
+
onRowClicked: onRowClick ? (event) => event.data && onRowClick(event.data) : void 0,
|
|
147
|
+
suppressCellFocus: true,
|
|
148
|
+
localeText: { noRowsToShow: emptyText }
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
DataGrid
|
|
156
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { format } from "date-fns";
|
|
4
|
+
import { Calendar } from "./calendar.js";
|
|
5
|
+
import { Popover, PopoverTrigger, PopoverContent } from "./popover.js";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
const DatePicker = React.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
value,
|
|
10
|
+
onChange,
|
|
11
|
+
placeholder = "Select date",
|
|
12
|
+
disabled = false,
|
|
13
|
+
disabledDates,
|
|
14
|
+
fromDate,
|
|
15
|
+
toDate,
|
|
16
|
+
dateFormat = "MMM d, yyyy",
|
|
17
|
+
className,
|
|
18
|
+
align = "start"
|
|
19
|
+
}, ref) => {
|
|
20
|
+
const [open, setOpen] = React.useState(false);
|
|
21
|
+
const handleSelect = (date) => {
|
|
22
|
+
onChange == null ? void 0 : onChange(date);
|
|
23
|
+
setOpen(false);
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
26
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
ref,
|
|
30
|
+
type: "button",
|
|
31
|
+
disabled,
|
|
32
|
+
"aria-haspopup": "dialog",
|
|
33
|
+
"aria-expanded": open,
|
|
34
|
+
className: cn(
|
|
35
|
+
"date-picker-trigger",
|
|
36
|
+
!value && "date-picker-trigger--placeholder",
|
|
37
|
+
disabled && "date-picker-trigger--disabled",
|
|
38
|
+
className
|
|
39
|
+
),
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "date-picker-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
|
|
42
|
+
/* @__PURE__ */ jsx("rect", { x: "1", y: "3", width: "14", height: "12", rx: "2", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
43
|
+
/* @__PURE__ */ jsx("path", { d: "M1 7h14", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
44
|
+
/* @__PURE__ */ jsx("path", { d: "M5 1v4M11 1v4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
45
|
+
] }) }),
|
|
46
|
+
/* @__PURE__ */ jsx("span", { className: "date-picker-value", children: value ? format(value, dateFormat) : placeholder }),
|
|
47
|
+
/* @__PURE__ */ jsx("span", { className: "date-picker-chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
) }),
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
PopoverContent,
|
|
53
|
+
{
|
|
54
|
+
className: "date-picker-popover",
|
|
55
|
+
align,
|
|
56
|
+
sideOffset: 6,
|
|
57
|
+
children: /* @__PURE__ */ jsx(
|
|
58
|
+
Calendar,
|
|
59
|
+
{
|
|
60
|
+
mode: "single",
|
|
61
|
+
selected: value,
|
|
62
|
+
onSelect: handleSelect,
|
|
63
|
+
disabled: disabledDates,
|
|
64
|
+
fromDate,
|
|
65
|
+
toDate,
|
|
66
|
+
initialFocus: true
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
DatePicker.displayName = "DatePicker";
|
|
75
|
+
const DateRangePicker = React.forwardRef(
|
|
76
|
+
({
|
|
77
|
+
value,
|
|
78
|
+
onChange,
|
|
79
|
+
placeholder = "Select date range",
|
|
80
|
+
disabled = false,
|
|
81
|
+
dateFormat = "MMM d, yyyy",
|
|
82
|
+
className,
|
|
83
|
+
align = "start"
|
|
84
|
+
}, ref) => {
|
|
85
|
+
const [open, setOpen] = React.useState(false);
|
|
86
|
+
const label = React.useMemo(() => {
|
|
87
|
+
if (!(value == null ? void 0 : value.from)) return null;
|
|
88
|
+
if (!value.to) return format(value.from, dateFormat);
|
|
89
|
+
return `${format(value.from, dateFormat)} — ${format(value.to, dateFormat)}`;
|
|
90
|
+
}, [value, dateFormat]);
|
|
91
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
92
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
ref,
|
|
96
|
+
type: "button",
|
|
97
|
+
disabled,
|
|
98
|
+
"aria-haspopup": "dialog",
|
|
99
|
+
"aria-expanded": open,
|
|
100
|
+
className: cn(
|
|
101
|
+
"date-picker-trigger",
|
|
102
|
+
!label && "date-picker-trigger--placeholder",
|
|
103
|
+
disabled && "date-picker-trigger--disabled",
|
|
104
|
+
className
|
|
105
|
+
),
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ jsx("span", { className: "date-picker-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
|
|
108
|
+
/* @__PURE__ */ jsx("rect", { x: "1", y: "3", width: "14", height: "12", rx: "2", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
109
|
+
/* @__PURE__ */ jsx("path", { d: "M1 7h14", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
110
|
+
/* @__PURE__ */ jsx("path", { d: "M5 1v4M11 1v4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
111
|
+
] }) }),
|
|
112
|
+
/* @__PURE__ */ jsx("span", { className: "date-picker-value", children: label ?? placeholder }),
|
|
113
|
+
/* @__PURE__ */ jsx("span", { className: "date-picker-chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
) }),
|
|
117
|
+
/* @__PURE__ */ jsx(
|
|
118
|
+
PopoverContent,
|
|
119
|
+
{
|
|
120
|
+
className: "date-picker-popover",
|
|
121
|
+
align,
|
|
122
|
+
sideOffset: 6,
|
|
123
|
+
children: /* @__PURE__ */ jsx(
|
|
124
|
+
Calendar,
|
|
125
|
+
{
|
|
126
|
+
mode: "range",
|
|
127
|
+
selected: value,
|
|
128
|
+
onSelect: onChange,
|
|
129
|
+
numberOfMonths: 2,
|
|
130
|
+
initialFocus: true
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
] });
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
DateRangePicker.displayName = "DateRangePicker";
|
|
139
|
+
export {
|
|
140
|
+
DatePicker,
|
|
141
|
+
DateRangePicker
|
|
142
|
+
};
|