@thecb/components 7.0.1-beta.1 → 7.0.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -301,6 +301,21 @@ interface CollapsibleSectionProps {
301
301
  declare const CollapsibleSection: React.FC<Expand<CollapsibleSectionProps> &
302
302
  React.HTMLAttributes<HTMLElement>>;
303
303
 
304
+ interface CopyableProps {
305
+ text: string;
306
+ initialPopoverContent?: string;
307
+ copiedPopoverContent?: string;
308
+ copiedPopoverContentDuration?: number;
309
+ withPopover?: boolean;
310
+ popoverID?: number;
311
+ popoverMinWidth?: string;
312
+ onCopy?: () => void;
313
+ extraStyles?: string;
314
+ }
315
+
316
+ declare const Copyable: React.FC<Expand<CopyableProps> &
317
+ React.HTMLAttributes<HTMLElement>>;
318
+
304
319
  interface EditableTableProps {
305
320
  title?: string;
306
321
  renderItem?: (items: any[]) => JSX.Element;
@@ -334,6 +349,30 @@ interface FooterWithSubfooterProps {
334
349
  declare const FooterWithSubfooter: React.FC<Expand<FooterWithSubfooterProps> &
335
350
  React.HTMLAttributes<HTMLElement>>;
336
351
 
352
+ interface PopoverProps {
353
+ triggerText?: string | JSX.Element;
354
+ content?: string | JSX.Element;
355
+ hasIcon?: boolean;
356
+ iconHelpText?: string; // for screen-readers, required if using an icon for trigger
357
+ popoverID?: number;
358
+ popoverFocus?: boolean;
359
+ extraStyles?: string;
360
+ textExtraStyles?: string;
361
+ minWidth?: string;
362
+ maxWidth?: string;
363
+ height?: string;
364
+ position?: { top: string; right: string; bottom: string; left: string };
365
+ arrowPosition?: {
366
+ arrowTop: string;
367
+ arrowRight: string;
368
+ arrowBottom: string;
369
+ arrowLeft: string;
370
+ };
371
+ }
372
+
373
+ declare const Popover: React.FC<Expand<PopoverProps> &
374
+ React.HTMLAttributes<HTMLElement>>;
375
+
337
376
  interface DefaultPageTemplateProps {
338
377
  content: JSX.Element;
339
378
  header?: JSX.Element;
@@ -348,5 +387,5 @@ interface DefaultPageTemplateProps {
348
387
  declare const DefaultPageTemplate: React.FC<Expand<DefaultPageTemplateProps> &
349
388
  React.HTMLAttributes<HTMLElement>>;
350
389
 
351
- export { Box, BoxProps, ButtonWithAction, ButtonWithActionProps, ButtonWithLink, ButtonWithLinkProps, Card, CardProps, Center, CenterProps, Cluster, ClusterProps, CollapsibleSection, CollapsibleSectionProps, Cover, CoverProps, DefaultPageTemplate, DefaultPageTemplateProps, EditableTable, EditableTableProps, ExternalLink, ExternalLinkProps, FooterWithSubfooter, FooterWithSubfooterProps, InternalLink, InternalLinkProps, NavFooter, NavFooterProps, NavHeader, NavHeaderProps, NavTabs, NavTabsProps, Paragraph, ParagraphProps, Stack, StackProps, Switcher, SwitcherProps, TableListItem, TableListItemProps, Text, TextProps, Title, TitleProps };
390
+ export { Box, BoxProps, ButtonWithAction, ButtonWithActionProps, ButtonWithLink, ButtonWithLinkProps, Card, CardProps, Center, CenterProps, Cluster, ClusterProps, CollapsibleSection, CollapsibleSectionProps, Copyable, CopyableProps, Cover, CoverProps, DefaultPageTemplate, DefaultPageTemplateProps, EditableTable, EditableTableProps, ExternalLink, ExternalLinkProps, FooterWithSubfooter, FooterWithSubfooterProps, InternalLink, InternalLinkProps, NavFooter, NavFooterProps, NavHeader, NavHeaderProps, NavTabs, NavTabsProps, Paragraph, ParagraphProps, Popover, PopoverProps, Stack, StackProps, Switcher, SwitcherProps, TableListItem, TableListItemProps, Text, TextProps, Title, TitleProps };
352
391
  //# sourceMappingURL=index.d.ts.map
package/dist/index.esm.js CHANGED
@@ -22866,7 +22866,7 @@ var Popover = function Popover(_ref) {
22866
22866
  tabIndex: popoverFocus && popoverOpen ? "0" : "-1",
22867
22867
  minWidth: minWidth,
22868
22868
  maxWidth: maxWidth,
22869
- extraStyles: "\n display: ".concat(popoverOpen ? "block" : "none", "; \n position: absolute; \n top: ").concat(top, "; \n right: ").concat(right, "; \n bottom: ").concat(bottom, "; \n left: ").concat(left, ";\n height: ").concat(height, "\n ")
22869
+ extraStyles: "\n display: ".concat(popoverOpen ? "block" : "none", "; \n position: absolute; \n top: ").concat(top, "; \n right: ").concat(right, "; \n bottom: ").concat(bottom, "; \n left: ").concat(left, ";\n height: ").concat(height, ";\n ")
22870
22870
  }, /*#__PURE__*/React.createElement(Paragraph$1, null, content), /*#__PURE__*/React.createElement(Box, {
22871
22871
  padding: "0",
22872
22872
  extraStyles: "position: absolute; content: \"\"; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid rgba(255, 255, 255, 0.85); filter: drop-shadow(2px 8px 14px black); bottom: ".concat(arrowBottom, "; right: ").concat(arrowRight, "; top: ").concat(arrowTop, "; left: ").concat(arrowLeft, ";")
@@ -37531,6 +37531,135 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
37531
37531
 
37532
37532
  var CollapsibleSection$1 = themeComponent(CollapsibleSection, "CollapsibleSection", fallbackValues$z);
37533
37533
 
37534
+ var ClipboardIcon = function ClipboardIcon(_ref) {
37535
+ var themeValues = _ref.themeValues;
37536
+ return /*#__PURE__*/React.createElement("svg", {
37537
+ width: "24",
37538
+ height: "24",
37539
+ viewBox: "0 0 24 24",
37540
+ fill: "none",
37541
+ xmlns: "http://www.w3.org/2000/svg"
37542
+ }, /*#__PURE__*/React.createElement("mask", {
37543
+ id: "mask0_1104_623",
37544
+ style: {
37545
+ maskType: "alpha"
37546
+ },
37547
+ maskUnits: "userSpaceOnUse",
37548
+ x: "4",
37549
+ y: "2",
37550
+ width: "16",
37551
+ height: "18"
37552
+ }, /*#__PURE__*/React.createElement("path", {
37553
+ "fill-rule": "evenodd",
37554
+ "clip-rule": "evenodd",
37555
+ d: "M9.83929 3.43753H14.1607V5.59825H9.83929L9.83929 3.43753ZM8.75893 3.43753C8.75893 2.84087 9.24262 2.35718 9.83929 2.35718H14.1607C14.7574 2.35718 15.2411 2.84087 15.2411 3.43753V5.59825C15.2411 6.19491 14.7574 6.67861 14.1607 6.67861H9.83929C9.24262 6.67861 8.75893 6.19491 8.75893 5.59825V3.43753ZM6.59821 3.70762H7.94866V5.32816H6.59821C6.29988 5.32816 6.05804 5.57001 6.05804 5.86834V17.4822C6.05804 17.7805 6.29988 18.0224 6.59821 18.0224H17.4018C17.7001 18.0224 17.942 17.7805 17.942 17.4822V5.86834C17.942 5.57001 17.7001 5.32816 17.4018 5.32816H16.0513V3.70762H17.4018C18.5951 3.70762 19.5625 4.67501 19.5625 5.86834V17.4822C19.5625 18.6755 18.5951 19.6429 17.4018 19.6429H6.59821C5.40488 19.6429 4.4375 18.6755 4.4375 17.4822V5.86834C4.4375 4.67501 5.40488 3.70762 6.59821 3.70762Z",
37556
+ fill: themeValues.singleIconColor
37557
+ })), /*#__PURE__*/React.createElement("g", {
37558
+ mask: "url(#mask0_1104_623)"
37559
+ }, /*#__PURE__*/React.createElement("rect", {
37560
+ width: "24",
37561
+ height: "24",
37562
+ fill: themeValues.singleIconColor
37563
+ })));
37564
+ };
37565
+
37566
+ var ClipboardIcon$1 = themeComponent(ClipboardIcon, "Icons", fallbackValues$2, "primary");
37567
+
37568
+ /*
37569
+ This component will render `text` and a clipboard icon. When hovered, a popover with content `initialPopoverContent` will be displayed.
37570
+ When clicked, `text` will be copied to the clipboard, the popover content will change to `copiedPopoverContent` for `copiedPopoverContentDuration` milliseconds,
37571
+ and the `onCopy` callback will be executed.
37572
+ */
37573
+
37574
+ var CopyableText = function CopyableText(_ref) {
37575
+ var text = _ref.text,
37576
+ onClick = _ref.onClick;
37577
+ return /*#__PURE__*/React.createElement(ButtonWithAction, {
37578
+ "data-testid": "copyable-trigger",
37579
+ contentOverride: true,
37580
+ action: onClick,
37581
+ variant: "ghost",
37582
+ extraStyles: "padding: 0; margin: 0; min-height: initial; min-width: initial"
37583
+ }, /*#__PURE__*/React.createElement(Stack, {
37584
+ direction: "row",
37585
+ childGap: "0.25rem"
37586
+ }, /*#__PURE__*/React.createElement(Text$1, null, text), /*#__PURE__*/React.createElement(ClipboardIcon$1, null)));
37587
+ };
37588
+
37589
+ var Copyable = function Copyable(_ref2) {
37590
+ var text = _ref2.text,
37591
+ onCopy = _ref2.onCopy,
37592
+ _ref2$initialPopoverC = _ref2.initialPopoverContent,
37593
+ initialPopoverContent = _ref2$initialPopoverC === void 0 ? "Click to copy to clipboard" : _ref2$initialPopoverC,
37594
+ _ref2$copiedPopoverCo = _ref2.copiedPopoverContent,
37595
+ copiedPopoverContent = _ref2$copiedPopoverCo === void 0 ? "Copied!" : _ref2$copiedPopoverCo,
37596
+ _ref2$withPopover = _ref2.withPopover,
37597
+ withPopover = _ref2$withPopover === void 0 ? true : _ref2$withPopover,
37598
+ _ref2$popoverMinWidth = _ref2.popoverMinWidth,
37599
+ popoverMinWidth = _ref2$popoverMinWidth === void 0 ? "210px" : _ref2$popoverMinWidth,
37600
+ _ref2$copiedPopoverCo2 = _ref2.copiedPopoverContentDuration,
37601
+ copiedPopoverContentDuration = _ref2$copiedPopoverCo2 === void 0 ? 1000 : _ref2$copiedPopoverCo2,
37602
+ _ref2$popoverID = _ref2.popoverID,
37603
+ popoverID = _ref2$popoverID === void 0 ? 0 : _ref2$popoverID,
37604
+ extraStyles = _ref2.extraStyles;
37605
+ var popoverPosition = {
37606
+ top: "-65px",
37607
+ right: "auto",
37608
+ bottom: "auto",
37609
+ left: "50%"
37610
+ };
37611
+ var popoverArrowPosition = {
37612
+ arrowTop: "auto",
37613
+ arrowRight: "auto",
37614
+ arrowBottom: "-8px",
37615
+ arrowLeft: "calc(50% - 4px)" // Popover arrow is 8px wide. This places the middle of the arrow in the middle of the popover.
37616
+
37617
+ };
37618
+
37619
+ var _useState = useState(initialPopoverContent),
37620
+ _useState2 = _slicedToArray(_useState, 2),
37621
+ popoverContent = _useState2[0],
37622
+ setPopoverContent = _useState2[1];
37623
+
37624
+ var _useState3 = useState(undefined),
37625
+ _useState4 = _slicedToArray(_useState3, 2),
37626
+ timer = _useState4[0],
37627
+ setTimer = _useState4[1];
37628
+
37629
+ var onClick = function onClick() {
37630
+ setPopoverContent(copiedPopoverContent);
37631
+ navigator.clipboard.writeText(text)["catch"](function (e) {
37632
+ return console.error(e);
37633
+ });
37634
+ onCopy === null || onCopy === void 0 ? void 0 : onCopy();
37635
+
37636
+ if (timer) {
37637
+ clearTimeout(timer);
37638
+ }
37639
+
37640
+ setTimer(setTimeout(function () {
37641
+ setPopoverContent(initialPopoverContent);
37642
+ setTimer(undefined);
37643
+ }, copiedPopoverContentDuration));
37644
+ };
37645
+
37646
+ return withPopover ? /*#__PURE__*/React.createElement(Popover$1, {
37647
+ minWidth: popoverMinWidth,
37648
+ position: popoverPosition,
37649
+ arrowPosition: popoverArrowPosition,
37650
+ popoverID: popoverID,
37651
+ extraStyles: "> button#btnPopover".concat(popoverID, " { margin: 0 }; #Disclosed").concat(popoverID, " { transform: translateX(-50%); }; ").concat(extraStyles),
37652
+ triggerText: CopyableText({
37653
+ text: text,
37654
+ onClick: onClick
37655
+ }),
37656
+ content: popoverContent
37657
+ }) : CopyableText({
37658
+ text: text,
37659
+ onClick: onClick
37660
+ });
37661
+ };
37662
+
37534
37663
  var EditNameForm = function EditNameForm(_ref) {
37535
37664
  var fields = _ref.fields,
37536
37665
  actions = _ref.actions,
@@ -46697,5 +46826,5 @@ var SidebarStackContent = function SidebarStackContent(_ref) {
46697
46826
 
46698
46827
  var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$M));
46699
46828
 
46700
- export { AccountNumberImage, AccountsAddIcon$1 as AccountsAddIcon, AccountsIcon$1 as AccountsIcon, AccountsIconSmall$1 as AccountsIconSmall, AchReturnIcon, AddObligation$1 as AddObligation, AddressForm, Alert$1 as Alert, AllocatedIcon, AmountCallout$1 as AmountCallout, AutopayOnIcon, BankIcon, Box, BoxWithShadow$1 as BoxWithShadow, Breadcrumbs as Breadcrumb, ButtonWithAction, ButtonWithLink, CalendarIcon, Card$1 as Card, CarrotIcon$1 as CarrotIcon, CashIcon, Center, CenterSingle$1 as CenterSingle, CenterStack$1 as CenterStack, ChangePasswordForm, ChargebackIcon, ChargebackReversalIcon, CheckIcon, Checkbox$1 as Checkbox, CheckboxList$1 as CheckboxList, CheckmarkIcon, ChevronIcon$1 as ChevronIcon, Cluster, CollapsibleSection$1 as CollapsibleSection, CountryDropdown, Cover, CustomerSearchIcon, DefaultPageTemplate, Detail$1 as Detail, DisplayBox$1 as DisplayBox, DisplayCard, Dropdown$1 as Dropdown, DuplicateIcon, EditNameForm, EditableList, EditableTable, EmailForm, EmptyCartIcon$1 as EmptyCartIcon, ErroredIcon, ExternalLink, ExternalLinkIcon, FailedIcon, FooterWithSubfooter$1 as FooterWithSubfooter, ForgotPasswordForm, ForgotPasswordIcon$1 as ForgotPasswordIcon, FormContainer$1 as FormContainer, FormFooterPanel$1 as FormFooterPanel, FormInput$1 as FormInput, FormInputColumn, FormInputRow, FormSelect$1 as FormSelect, FormattedAddress$1 as FormattedAddress, FormattedCreditCard$1 as FormattedCreditCard, Frame, GenericCard, GenericCardLarge, GoToEmailIcon$1 as GoToEmailIcon, Grid, HamburgerButton, Heading$1 as Heading, HighlightTabRow$1 as HighlightTabRow, IconAdd, IconQuitLarge, Imposter, InternalLink, InternalUserInfoForm, Jumbo$1 as Jumbo, LabeledAmount$1 as LabeledAmount, LineItem$1 as LineItem, Loading, LoadingLine, LoginForm, Modal$1 as Modal, Module$1 as Module, Motion, NavFooter, NavHeader, NavMenuDesktop$1 as NavMenuDesktop, NavMenuMobile$1 as NavMenuMobile, NavTabs, NoCustomerResultsIcon, NoPaymentResultsIcon, NotFoundIcon, Obligation, iconsMap as ObligationIcons, Pagination, Paragraph$1 as Paragraph, PartialAmountForm, PasswordRequirements, PaymentButtonBar, PaymentDetails$1 as PaymentDetails, PaymentFormACH, PaymentFormCard$1 as PaymentFormCard, PaymentIcon, PaymentMethodAddIcon$1 as PaymentMethodAddIcon, PaymentMethodIcon$1 as PaymentMethodIcon, PaymentSearchIcon, PaymentsIconSmall$1 as PaymentsIconSmall, PendingIcon, PeriscopeDashboardIframe, PeriscopeFailedIcon, PhoneForm, Placeholder$1 as Placeholder, Popover$1 as Popover, ProcessingFee$1 as ProcessingFee, ProfileIcon$1 as ProfileIcon, ProfileIconSmall$1 as ProfileIconSmall, PropertiesAddIcon$1 as PropertiesAddIcon, PropertiesIconSmall$1 as PropertiesIconSmall, RadioButton$2 as RadioButton, RadioSection$1 as RadioSection, Reel, RefundIcon, RegistrationForm, RejectedIcon, RejectedVelocityIcon, ResetConfirmationForm$1 as ResetConfirmationForm, ResetPasswordForm, ResetPasswordIcon, ResetPasswordSuccess, RoutingNumberImage, SearchIcon, SearchableSelect$1 as SearchableSelect, SettingsIconSmall$1 as SettingsIconSmall, ShoppingCartIcon, Sidebar, SidebarSingleContent$1 as SidebarSingleContent, SidebarStackContent$1 as SidebarStackContent, SolidDivider$1 as SolidDivider, Spinner$2 as Spinner, Stack, FormStateDropdown as StateProvinceDropdown, StatusUnknownIcon, SuccessfulIcon, Switcher, TabSidebar$1 as TabSidebar, TableListItem, Tabs$1 as Tabs, TermsAndConditions, TermsAndConditionsModal$1 as TermsAndConditionsModal, Text$1 as Text, Timeout$1 as Timeout, TimeoutImage, Title$1 as Title, ToggleSwitch$1 as ToggleSwitch, TrashIcon$1 as TrashIcon, TypeaheadInput, VerifiedEmailIcon$1 as VerifiedEmailIcon, VoidedIcon, WalletIcon$1 as WalletIcon, WarningIconXS, WelcomeModule$1 as WelcomeModule, WorkflowTile, cardRegistry, index$5 as constants, createPartialAmountFormState, index$4 as util, withWindowSize };
46829
+ export { AccountNumberImage, AccountsAddIcon$1 as AccountsAddIcon, AccountsIcon$1 as AccountsIcon, AccountsIconSmall$1 as AccountsIconSmall, AchReturnIcon, AddObligation$1 as AddObligation, AddressForm, Alert$1 as Alert, AllocatedIcon, AmountCallout$1 as AmountCallout, AutopayOnIcon, BankIcon, Box, BoxWithShadow$1 as BoxWithShadow, Breadcrumbs as Breadcrumb, ButtonWithAction, ButtonWithLink, CalendarIcon, Card$1 as Card, CarrotIcon$1 as CarrotIcon, CashIcon, Center, CenterSingle$1 as CenterSingle, CenterStack$1 as CenterStack, ChangePasswordForm, ChargebackIcon, ChargebackReversalIcon, CheckIcon, Checkbox$1 as Checkbox, CheckboxList$1 as CheckboxList, CheckmarkIcon, ChevronIcon$1 as ChevronIcon, Cluster, CollapsibleSection$1 as CollapsibleSection, Copyable, CountryDropdown, Cover, CustomerSearchIcon, DefaultPageTemplate, Detail$1 as Detail, DisplayBox$1 as DisplayBox, DisplayCard, Dropdown$1 as Dropdown, DuplicateIcon, EditNameForm, EditableList, EditableTable, EmailForm, EmptyCartIcon$1 as EmptyCartIcon, ErroredIcon, ExternalLink, ExternalLinkIcon, FailedIcon, FooterWithSubfooter$1 as FooterWithSubfooter, ForgotPasswordForm, ForgotPasswordIcon$1 as ForgotPasswordIcon, FormContainer$1 as FormContainer, FormFooterPanel$1 as FormFooterPanel, FormInput$1 as FormInput, FormInputColumn, FormInputRow, FormSelect$1 as FormSelect, FormattedAddress$1 as FormattedAddress, FormattedCreditCard$1 as FormattedCreditCard, Frame, GenericCard, GenericCardLarge, GoToEmailIcon$1 as GoToEmailIcon, Grid, HamburgerButton, Heading$1 as Heading, HighlightTabRow$1 as HighlightTabRow, IconAdd, IconQuitLarge, Imposter, InternalLink, InternalUserInfoForm, Jumbo$1 as Jumbo, LabeledAmount$1 as LabeledAmount, LineItem$1 as LineItem, Loading, LoadingLine, LoginForm, Modal$1 as Modal, Module$1 as Module, Motion, NavFooter, NavHeader, NavMenuDesktop$1 as NavMenuDesktop, NavMenuMobile$1 as NavMenuMobile, NavTabs, NoCustomerResultsIcon, NoPaymentResultsIcon, NotFoundIcon, Obligation, iconsMap as ObligationIcons, Pagination, Paragraph$1 as Paragraph, PartialAmountForm, PasswordRequirements, PaymentButtonBar, PaymentDetails$1 as PaymentDetails, PaymentFormACH, PaymentFormCard$1 as PaymentFormCard, PaymentIcon, PaymentMethodAddIcon$1 as PaymentMethodAddIcon, PaymentMethodIcon$1 as PaymentMethodIcon, PaymentSearchIcon, PaymentsIconSmall$1 as PaymentsIconSmall, PendingIcon, PeriscopeDashboardIframe, PeriscopeFailedIcon, PhoneForm, Placeholder$1 as Placeholder, Popover$1 as Popover, ProcessingFee$1 as ProcessingFee, ProfileIcon$1 as ProfileIcon, ProfileIconSmall$1 as ProfileIconSmall, PropertiesAddIcon$1 as PropertiesAddIcon, PropertiesIconSmall$1 as PropertiesIconSmall, RadioButton$2 as RadioButton, RadioSection$1 as RadioSection, Reel, RefundIcon, RegistrationForm, RejectedIcon, RejectedVelocityIcon, ResetConfirmationForm$1 as ResetConfirmationForm, ResetPasswordForm, ResetPasswordIcon, ResetPasswordSuccess, RoutingNumberImage, SearchIcon, SearchableSelect$1 as SearchableSelect, SettingsIconSmall$1 as SettingsIconSmall, ShoppingCartIcon, Sidebar, SidebarSingleContent$1 as SidebarSingleContent, SidebarStackContent$1 as SidebarStackContent, SolidDivider$1 as SolidDivider, Spinner$2 as Spinner, Stack, FormStateDropdown as StateProvinceDropdown, StatusUnknownIcon, SuccessfulIcon, Switcher, TabSidebar$1 as TabSidebar, TableListItem, Tabs$1 as Tabs, TermsAndConditions, TermsAndConditionsModal$1 as TermsAndConditionsModal, Text$1 as Text, Timeout$1 as Timeout, TimeoutImage, Title$1 as Title, ToggleSwitch$1 as ToggleSwitch, TrashIcon$1 as TrashIcon, TypeaheadInput, VerifiedEmailIcon$1 as VerifiedEmailIcon, VoidedIcon, WalletIcon$1 as WalletIcon, WarningIconXS, WelcomeModule$1 as WelcomeModule, WorkflowTile, cardRegistry, index$5 as constants, createPartialAmountFormState, index$4 as util, withWindowSize };
46701
46830
  //# sourceMappingURL=index.esm.js.map