@syscore/ui-library 2.0.0-beta-publish-workflow-beta.16 → 2.0.0-beta-publish-workflow-beta.18
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 +363 -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,73 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const getStatusClass = (status, colorScheme = "light") => {
|
|
5
|
+
return `status-tag tag--${colorScheme}-${status}`;
|
|
6
|
+
};
|
|
7
|
+
const Tag = React.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
children,
|
|
10
|
+
variant = "text",
|
|
11
|
+
active = false,
|
|
12
|
+
status,
|
|
13
|
+
colorScheme = "light",
|
|
14
|
+
className,
|
|
15
|
+
minWidth,
|
|
16
|
+
minHeight,
|
|
17
|
+
style,
|
|
18
|
+
onClick,
|
|
19
|
+
...props
|
|
20
|
+
}, ref) => {
|
|
21
|
+
const mergedStyle = {
|
|
22
|
+
minWidth,
|
|
23
|
+
minHeight,
|
|
24
|
+
...style
|
|
25
|
+
};
|
|
26
|
+
if (status) {
|
|
27
|
+
const statusClass = getStatusClass(status, colorScheme);
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
onClick,
|
|
33
|
+
className: cn("overline-medium", statusClass, className),
|
|
34
|
+
style: mergedStyle,
|
|
35
|
+
...props,
|
|
36
|
+
children
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
if (variant === "code") {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
onClick,
|
|
46
|
+
className: cn("tag-code", className),
|
|
47
|
+
style: mergedStyle,
|
|
48
|
+
...props,
|
|
49
|
+
children: /* @__PURE__ */ jsx("span", { className: "number-small font-semibold", style: { color: "inherit" }, children })
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
ref,
|
|
57
|
+
onClick,
|
|
58
|
+
className: cn(
|
|
59
|
+
"tag-general body-small",
|
|
60
|
+
active ? "tag-general--active" : "tag-general--inactive",
|
|
61
|
+
className
|
|
62
|
+
),
|
|
63
|
+
style: mergedStyle,
|
|
64
|
+
...props,
|
|
65
|
+
children
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
Tag.displayName = "Tag";
|
|
71
|
+
export {
|
|
72
|
+
Tag
|
|
73
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const TextAreaV01 = React.forwardRef(
|
|
5
|
+
({
|
|
6
|
+
className,
|
|
7
|
+
focused,
|
|
8
|
+
disabled,
|
|
9
|
+
placeholder = "Tell us what you think",
|
|
10
|
+
...props
|
|
11
|
+
}, ref) => /* @__PURE__ */ jsx(
|
|
12
|
+
"textarea",
|
|
13
|
+
{
|
|
14
|
+
ref,
|
|
15
|
+
className: cn("text-area-v01 font-mazzardSoft", className),
|
|
16
|
+
"data-focus": focused ? "true" : void 0,
|
|
17
|
+
disabled,
|
|
18
|
+
placeholder,
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
TextAreaV01.displayName = "TextAreaV01";
|
|
24
|
+
export {
|
|
25
|
+
TextAreaV01
|
|
26
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const TextFieldV01 = React.forwardRef(
|
|
5
|
+
({
|
|
6
|
+
className,
|
|
7
|
+
label,
|
|
8
|
+
helperText,
|
|
9
|
+
error = false,
|
|
10
|
+
warning = false,
|
|
11
|
+
typeahead,
|
|
12
|
+
focused,
|
|
13
|
+
action,
|
|
14
|
+
disabled,
|
|
15
|
+
readOnly,
|
|
16
|
+
value,
|
|
17
|
+
defaultValue,
|
|
18
|
+
placeholder = "Placeholder",
|
|
19
|
+
onChange,
|
|
20
|
+
id,
|
|
21
|
+
...props
|
|
22
|
+
}, ref) => {
|
|
23
|
+
const generated = React.useId();
|
|
24
|
+
const inputId = id ?? generated;
|
|
25
|
+
const isControlled = value !== void 0;
|
|
26
|
+
const [internal, setInternal] = React.useState(
|
|
27
|
+
() => defaultValue ?? ""
|
|
28
|
+
);
|
|
29
|
+
const current = isControlled ? String(value ?? "") : internal;
|
|
30
|
+
const handleChange = (event) => {
|
|
31
|
+
if (!isControlled) setInternal(event.target.value);
|
|
32
|
+
onChange == null ? void 0 : onChange(event);
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ jsxs(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: cn("text-field-v01 font-mazzardSoft", className),
|
|
38
|
+
"data-filled": current !== "" ? "true" : void 0,
|
|
39
|
+
"data-error": error ? "true" : void 0,
|
|
40
|
+
"data-warning": warning && !error ? "true" : void 0,
|
|
41
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
42
|
+
"data-readonly": readOnly ? "true" : void 0,
|
|
43
|
+
"data-focus": focused ? "true" : void 0,
|
|
44
|
+
"data-typeahead": typeahead ? "true" : void 0,
|
|
45
|
+
children: [
|
|
46
|
+
label != null && label !== "" ? /* @__PURE__ */ jsx("div", { className: "text-field-v01-label", children: /* @__PURE__ */ jsx("span", { className: "text-field-v01-label-text overline-medium", children: label }) }) : null,
|
|
47
|
+
/* @__PURE__ */ jsxs("div", { className: "text-field-v01-cell", children: [
|
|
48
|
+
focused && current === "" ? /* @__PURE__ */ jsx("span", { className: "text-field-v01-caret", "aria-hidden": true }) : null,
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
"input",
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
id: inputId,
|
|
54
|
+
className: "text-field-v01-input",
|
|
55
|
+
disabled,
|
|
56
|
+
readOnly,
|
|
57
|
+
placeholder,
|
|
58
|
+
value: isControlled ? value : internal,
|
|
59
|
+
onChange: handleChange,
|
|
60
|
+
"aria-invalid": error || void 0,
|
|
61
|
+
"aria-describedby": helperText ? `${inputId}-helper` : void 0,
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
focused && current !== "" ? /* @__PURE__ */ jsx("span", { className: "text-field-v01-caret", "aria-hidden": true }) : null,
|
|
66
|
+
typeahead ? /* @__PURE__ */ jsx("span", { className: "text-field-v01-typeahead", children: typeahead }) : null,
|
|
67
|
+
action
|
|
68
|
+
] }),
|
|
69
|
+
helperText != null && helperText !== "" ? /* @__PURE__ */ jsx("div", { className: "text-field-v01-helper", id: `${inputId}-helper`, children: helperText }) : null
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
TextFieldV01.displayName = "TextFieldV01";
|
|
76
|
+
export {
|
|
77
|
+
TextFieldV01
|
|
78
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const TextLink = React.forwardRef(
|
|
5
|
+
({ as: Component = "button", emphasis = "default", className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6
|
+
Component,
|
|
7
|
+
{
|
|
8
|
+
ref,
|
|
9
|
+
className: cn("inline-link", `inline-link--${emphasis}`, className),
|
|
10
|
+
...Component === "button" ? { type: props.type ?? "button" } : null,
|
|
11
|
+
...props
|
|
12
|
+
}
|
|
13
|
+
)
|
|
14
|
+
);
|
|
15
|
+
TextLink.displayName = "TextLink";
|
|
16
|
+
const LegalNote = React.forwardRef(
|
|
17
|
+
({ children, className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("legal-note", className), ...props, children: /* @__PURE__ */ jsx("span", { className: "legal-note__text", children }) })
|
|
18
|
+
);
|
|
19
|
+
LegalNote.displayName = "LegalNote";
|
|
20
|
+
export {
|
|
21
|
+
LegalNote,
|
|
22
|
+
TextLink
|
|
23
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const Textarea = React.forwardRef(
|
|
5
|
+
({ className, ...props }, ref) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"textarea",
|
|
8
|
+
{
|
|
9
|
+
className: cn("textarea body-base", className),
|
|
10
|
+
ref,
|
|
11
|
+
...props
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
Textarea.displayName = "Textarea";
|
|
17
|
+
export {
|
|
18
|
+
Textarea
|
|
19
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const TimelineContext = React.createContext({
|
|
5
|
+
direction: "vertical",
|
|
6
|
+
side: "alternate",
|
|
7
|
+
align: "center",
|
|
8
|
+
density: "default"
|
|
9
|
+
});
|
|
10
|
+
const Timeline = React.forwardRef(
|
|
11
|
+
({
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
direction = "vertical",
|
|
15
|
+
side = "alternate",
|
|
16
|
+
align = "center",
|
|
17
|
+
density = "default",
|
|
18
|
+
...props
|
|
19
|
+
}, ref) => /* @__PURE__ */ jsx(TimelineContext.Provider, { value: { direction, side, align, density }, children: /* @__PURE__ */ jsx(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
ref,
|
|
23
|
+
className: cn(
|
|
24
|
+
"timeline",
|
|
25
|
+
direction === "horizontal" && "timeline--horizontal",
|
|
26
|
+
`timeline--side-${side}`,
|
|
27
|
+
`timeline--align-${align}`,
|
|
28
|
+
density === "compact" && "timeline--compact",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props,
|
|
32
|
+
children
|
|
33
|
+
}
|
|
34
|
+
) })
|
|
35
|
+
);
|
|
36
|
+
Timeline.displayName = "Timeline";
|
|
37
|
+
const TimelineItem = React.forwardRef(
|
|
38
|
+
({
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
dotColor,
|
|
42
|
+
size = "small",
|
|
43
|
+
fillDot = false,
|
|
44
|
+
hideDot = false,
|
|
45
|
+
icon,
|
|
46
|
+
opposite,
|
|
47
|
+
...props
|
|
48
|
+
}, ref) => {
|
|
49
|
+
const { align } = React.useContext(TimelineContext);
|
|
50
|
+
return /* @__PURE__ */ jsxs(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
ref,
|
|
54
|
+
className: cn(
|
|
55
|
+
"timeline-item",
|
|
56
|
+
`timeline-item--size-${size}`,
|
|
57
|
+
fillDot && "timeline-item--fill-dot",
|
|
58
|
+
hideDot && "timeline-item--hide-dot",
|
|
59
|
+
align === "start" && "timeline-item--align-start",
|
|
60
|
+
className
|
|
61
|
+
),
|
|
62
|
+
...props,
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx("div", { className: "timeline-item-opposite", children: opposite }),
|
|
65
|
+
/* @__PURE__ */ jsxs("div", { className: "timeline-item-stem", children: [
|
|
66
|
+
/* @__PURE__ */ jsx("div", { className: "timeline-item-stem-line timeline-item-stem-line--before" }),
|
|
67
|
+
!hideDot && /* @__PURE__ */ jsx(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: "timeline-item-dot",
|
|
71
|
+
style: dotColor ? { backgroundColor: dotColor, borderColor: dotColor } : void 0,
|
|
72
|
+
children: icon && /* @__PURE__ */ jsx("span", { className: "timeline-item-dot-icon", children: icon })
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsx("div", { className: "timeline-item-stem-line timeline-item-stem-line--after" })
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ jsx("div", { className: "timeline-item-body", children })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
TimelineItem.displayName = "TimelineItem";
|
|
84
|
+
export {
|
|
85
|
+
Timeline,
|
|
86
|
+
TimelineItem
|
|
87
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { ButtonV01 } from "./button-v01.js";
|
|
6
|
+
import { AvatarIdentity } from "./avatar-identity.js";
|
|
7
|
+
import iconDone from "../../assets/alert/icon-done.svg.js";
|
|
8
|
+
import iconClear from "../../assets/alert/icon-clear.svg.js";
|
|
9
|
+
const toastV01Variants = cva("toast-v01 font-mazzardSoft", {
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
solid: "toast-v01--solid",
|
|
13
|
+
subtle: "toast-v01--subtle",
|
|
14
|
+
outline: "toast-v01--outline"
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
large: "toast-v01--large",
|
|
18
|
+
small: "toast-v01--small"
|
|
19
|
+
},
|
|
20
|
+
color: {
|
|
21
|
+
default: "toast-v01--default",
|
|
22
|
+
success: "toast-v01--success",
|
|
23
|
+
error: "toast-v01--error"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "solid",
|
|
28
|
+
size: "large",
|
|
29
|
+
color: "default"
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
function MaskIcon({ src, className }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
className: cn("toast-v01-mask-icon", className),
|
|
37
|
+
style: {
|
|
38
|
+
WebkitMaskImage: `url("${src}")`,
|
|
39
|
+
maskImage: `url("${src}")`
|
|
40
|
+
},
|
|
41
|
+
"aria-hidden": true
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
const ToastV01 = React.forwardRef(
|
|
46
|
+
({
|
|
47
|
+
className,
|
|
48
|
+
variant = "solid",
|
|
49
|
+
size = "large",
|
|
50
|
+
color = "default",
|
|
51
|
+
indicator = "icon",
|
|
52
|
+
action = true,
|
|
53
|
+
title,
|
|
54
|
+
description,
|
|
55
|
+
confirmLabel = "Confirm",
|
|
56
|
+
cancelLabel = "Cancel",
|
|
57
|
+
onConfirm,
|
|
58
|
+
onCancel,
|
|
59
|
+
onDismiss,
|
|
60
|
+
icon,
|
|
61
|
+
avatar,
|
|
62
|
+
avatarSrc,
|
|
63
|
+
avatarAlt,
|
|
64
|
+
children,
|
|
65
|
+
...props
|
|
66
|
+
}, ref) => {
|
|
67
|
+
const isLarge = size !== "small";
|
|
68
|
+
const showDescription = isLarge && description != null && description !== "";
|
|
69
|
+
const showCancel = isLarge && action;
|
|
70
|
+
const heading = title ?? children;
|
|
71
|
+
const indicatorNode = indicator === "avatar" ? avatar ?? /* @__PURE__ */ jsx(
|
|
72
|
+
AvatarIdentity,
|
|
73
|
+
{
|
|
74
|
+
className: "toast-v01-avatar",
|
|
75
|
+
size: "medium",
|
|
76
|
+
variant: avatarSrc ? "image" : "placeholder",
|
|
77
|
+
src: avatarSrc,
|
|
78
|
+
alt: avatarAlt,
|
|
79
|
+
showText: false
|
|
80
|
+
}
|
|
81
|
+
) : icon ?? /* @__PURE__ */ jsx("span", { className: "toast-v01-indicator", children: /* @__PURE__ */ jsx(MaskIcon, { src: iconDone, className: "toast-v01-icon-done" }) });
|
|
82
|
+
const dismissButton = /* @__PURE__ */ jsx(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
className: "toast-v01-dismiss",
|
|
87
|
+
"aria-label": "Dismiss",
|
|
88
|
+
onClick: onDismiss,
|
|
89
|
+
children: /* @__PURE__ */ jsx(MaskIcon, { src: iconClear, className: "toast-v01-icon-clear" })
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
const confirmButton = /* @__PURE__ */ jsx(
|
|
93
|
+
ButtonV01,
|
|
94
|
+
{
|
|
95
|
+
type: "button",
|
|
96
|
+
size: "small",
|
|
97
|
+
typeVariant: "utility",
|
|
98
|
+
hierarchy: "primary",
|
|
99
|
+
appearance: "solid",
|
|
100
|
+
context: "general",
|
|
101
|
+
className: "toast-v01-button",
|
|
102
|
+
onClick: onConfirm,
|
|
103
|
+
children: confirmLabel
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
const cancelButton = /* @__PURE__ */ jsx(
|
|
107
|
+
ButtonV01,
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
size: "small",
|
|
111
|
+
typeVariant: "utility",
|
|
112
|
+
hierarchy: "tertiary",
|
|
113
|
+
appearance: "stroke",
|
|
114
|
+
theme: "light",
|
|
115
|
+
context: "general",
|
|
116
|
+
className: "toast-v01-button toast-v01-button--cancel",
|
|
117
|
+
onClick: onCancel,
|
|
118
|
+
children: cancelLabel
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
return /* @__PURE__ */ jsxs(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
ref,
|
|
125
|
+
role: "status",
|
|
126
|
+
"aria-live": "polite",
|
|
127
|
+
className: cn(toastV01Variants({ variant, size, color }), className),
|
|
128
|
+
...props,
|
|
129
|
+
children: [
|
|
130
|
+
indicatorNode,
|
|
131
|
+
isLarge ? /* @__PURE__ */ jsxs("div", { className: "toast-v01-content", children: [
|
|
132
|
+
/* @__PURE__ */ jsxs("div", { className: "toast-v01-heading", children: [
|
|
133
|
+
/* @__PURE__ */ jsx("h5", { className: "toast-v01-title", children: heading }),
|
|
134
|
+
dismissButton
|
|
135
|
+
] }),
|
|
136
|
+
showDescription ? /* @__PURE__ */ jsx("div", { className: "toast-v01-description", children: description }) : null,
|
|
137
|
+
action ? /* @__PURE__ */ jsxs("div", { className: "toast-v01-actions", children: [
|
|
138
|
+
confirmButton,
|
|
139
|
+
showCancel ? cancelButton : null
|
|
140
|
+
] }) : null
|
|
141
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
142
|
+
/* @__PURE__ */ jsx("h5", { className: "toast-v01-title", children: heading }),
|
|
143
|
+
action ? confirmButton : null,
|
|
144
|
+
dismissButton
|
|
145
|
+
] })
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
ToastV01.displayName = "ToastV01";
|
|
152
|
+
export {
|
|
153
|
+
ToastV01,
|
|
154
|
+
toastV01Variants
|
|
155
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { X } from "lucide-react";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
const ToastProvider = ToastPrimitives.Provider;
|
|
8
|
+
const ToastViewport = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
9
|
+
ToastPrimitives.Viewport,
|
|
10
|
+
{
|
|
11
|
+
ref,
|
|
12
|
+
className: cn("toast-viewport", className),
|
|
13
|
+
...props
|
|
14
|
+
}
|
|
15
|
+
));
|
|
16
|
+
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
17
|
+
const toastVariants = cva(
|
|
18
|
+
"toast",
|
|
19
|
+
{
|
|
20
|
+
variants: {
|
|
21
|
+
variant: {
|
|
22
|
+
default: "toast--default",
|
|
23
|
+
destructive: "toast--destructive"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "default"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
const Toast = React.forwardRef(({ className, variant, ...props }, ref) => {
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
ToastPrimitives.Root,
|
|
34
|
+
{
|
|
35
|
+
ref,
|
|
36
|
+
className: cn(toastVariants({ variant }), className),
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
42
|
+
const ToastAction = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
43
|
+
ToastPrimitives.Action,
|
|
44
|
+
{
|
|
45
|
+
ref,
|
|
46
|
+
className: cn("toast-action", className),
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
));
|
|
50
|
+
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
51
|
+
const ToastClose = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
52
|
+
ToastPrimitives.Close,
|
|
53
|
+
{
|
|
54
|
+
ref,
|
|
55
|
+
className: cn("toast-close", className),
|
|
56
|
+
"toast-close": "",
|
|
57
|
+
...props,
|
|
58
|
+
children: /* @__PURE__ */ jsx(X, { className: "icon-4" })
|
|
59
|
+
}
|
|
60
|
+
));
|
|
61
|
+
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
62
|
+
const ToastTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
63
|
+
ToastPrimitives.Title,
|
|
64
|
+
{
|
|
65
|
+
ref,
|
|
66
|
+
className: cn("toast-title", className),
|
|
67
|
+
...props
|
|
68
|
+
}
|
|
69
|
+
));
|
|
70
|
+
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
71
|
+
const ToastDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
72
|
+
ToastPrimitives.Description,
|
|
73
|
+
{
|
|
74
|
+
ref,
|
|
75
|
+
className: cn("toast-description", className),
|
|
76
|
+
...props
|
|
77
|
+
}
|
|
78
|
+
));
|
|
79
|
+
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
80
|
+
export {
|
|
81
|
+
Toast,
|
|
82
|
+
ToastAction,
|
|
83
|
+
ToastClose,
|
|
84
|
+
ToastDescription,
|
|
85
|
+
ToastProvider,
|
|
86
|
+
ToastTitle,
|
|
87
|
+
ToastViewport
|
|
88
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useToast } from "../../hooks/use-toast.js";
|
|
3
|
+
import { ToastProvider, Toast, ToastTitle, ToastDescription, ToastClose, ToastViewport } from "./toast.js";
|
|
4
|
+
function Toaster() {
|
|
5
|
+
const { toasts } = useToast();
|
|
6
|
+
return /* @__PURE__ */ jsxs(ToastProvider, { children: [
|
|
7
|
+
toasts.map(function({ id, title, description, action, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsxs(Toast, { ...props, children: [
|
|
9
|
+
/* @__PURE__ */ jsxs("div", { className: "toast-content", children: [
|
|
10
|
+
title && /* @__PURE__ */ jsx(ToastTitle, { children: title }),
|
|
11
|
+
description && /* @__PURE__ */ jsx(ToastDescription, { children: description })
|
|
12
|
+
] }),
|
|
13
|
+
action,
|
|
14
|
+
/* @__PURE__ */ jsx(ToastClose, {})
|
|
15
|
+
] }, id);
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ jsx(ToastViewport, {})
|
|
18
|
+
] });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
Toaster
|
|
22
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { useSegmentedControl } from "../../hooks/use-segmented-control.js";
|
|
6
|
+
cva("toggle", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "toggle--default",
|
|
10
|
+
outline: "toggle--outline"
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
default: "toggle--size-default",
|
|
14
|
+
sm: "toggle--size-sm",
|
|
15
|
+
lg: "toggle--size-lg"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: "default",
|
|
20
|
+
size: "default"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const SegmentedControlInner = React.forwardRef(
|
|
24
|
+
({ className, options, value, defaultValue, onValueChange, ...props }, ref) => {
|
|
25
|
+
var _a;
|
|
26
|
+
const { value: selectedValue, onValueChange: handleValueChange } = useSegmentedControl({
|
|
27
|
+
value,
|
|
28
|
+
defaultValue: defaultValue ?? ((_a = options[0]) == null ? void 0 : _a.value),
|
|
29
|
+
onValueChange
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("segmented-control", className), ...props, children: options.map((option) => {
|
|
32
|
+
const isActive = selectedValue === option.value;
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
"button",
|
|
35
|
+
{
|
|
36
|
+
className: cn(
|
|
37
|
+
"segmented-control-button body-small",
|
|
38
|
+
isActive ? "segmented-control-button--active" : "segmented-control-button--inactive"
|
|
39
|
+
),
|
|
40
|
+
onClick: () => handleValueChange(option.value),
|
|
41
|
+
type: "button",
|
|
42
|
+
"data-active": isActive,
|
|
43
|
+
children: option.label
|
|
44
|
+
},
|
|
45
|
+
option.value
|
|
46
|
+
);
|
|
47
|
+
}) });
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
SegmentedControlInner.displayName = "SegmentedControl";
|
|
51
|
+
const SegmentedControl = SegmentedControlInner;
|
|
52
|
+
const Toggle = SegmentedControl;
|
|
53
|
+
export {
|
|
54
|
+
SegmentedControl,
|
|
55
|
+
Toggle
|
|
56
|
+
};
|