npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@synerise/ds-information-card

v0.6.2

Published

InformationCard UI Component for the Synerise Design System

Downloads

611

Readme


id: information-card title: InformationCard

InformationCard UI Component

Information card shows details of an object or entity. It should be used as an additional information (details) provider when user is selecting something using menu or dropdown.

Installation

npm i @synerise/ds-information-card
or
yarn add @synerise/ds-information-card

Development

# lerna bootstrap # install all required reused shared lerna packages
yarn workspace @synerise/ds-information-card lint
yarn workspace @synerise/ds-information-card build

Usage

import InformationCard from '@synerise/ds-information-card';
import Popover from 'antd/popover';

<Popover
  defaultVisible={false}
  placement="right"
  content={() => <InformationCard title="Entity full name" subtitle="entity.id" />}
>
  Entity short name
</Popover>;

Generally, components require being capable of rendering this and usually an additional effort is required to get them to support rendering. See text's menu item element packages/components/menu/src/Elements/Item/Text/Text.tsx.

Note that title and subtitle are required props. For just a single line of text consider using just tooltip or popover.

Usage with dropdown and other components relying on rc-trigger getPopupContainer

Some components render elements via portal, in such a case if tthey are listening for global events like click (for e.g. closing the dropdown) - developer using this component is responsible for proper handling of such a clicks. One of ways is making use of overlayInnerClass popover's class property to later. By default class is ignore-click-outside (so looking for domElement.closest('.ignore-click-outside') to determine whether handler should be skipped should be fine).

Demo

API

| Property | Description | Type | Default | | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------- | ------- | --- | | actionButton | custom jsx element for rendering in action button (bottom-right) | boolean | (() => ReactNode) | - | | actionButtonCallback | default action button callback method | () => void | - | | actionButtonTooltipText | default action button tooltip | string | - | | asTooltip | adjusts the styles to be displayed as a tooltip | boolean | - | | avatarTooltipText | description in a tooltip shown when user (note renderBadge has to be provided) | string | - | | className | custom class name for further styling | string | - | | copyTooltip | subtitle's value to be copied when clicking on the copy button | string | - | | copiedTooltip | feedback to the user once information card's subtitle has been copied | string | - | | descriptionConfig | when information-card's children prop is not provided, defaultTextAreaProps can be used to parametrize default textarea | SubtleTextAreaProps | string | null | - | | footerText | additional feedback info to the user, when set to null - footer is hidden | ReactNode | null | - | | icon | icon (note this needs to be pure SVG icon, it relies on buildBadgeIcon helper) | ReactNode | - | | iconColor | icon color to be applied to icon element | string | - | | notice | additional information shown between subtitle and description section. Can be used for warnings, errors, destructive actions, notices. See buildExtraInfo and alert level there. | ReactNode | - | | renderAdditionalDescription | Render prop for displaying additional content above footer | () => ReactNode | - | | renderBadge | Custom render prop for displaying. If set to null - badge won't be shown. | Function | null | - | | renderFooter | render prop for rendering the bottom part of (by default section with a small text and an optional action button on the right) | () => JSX.Element | - | | subtitle | Second line. Required prop. Can be copied. | string | - | | title | Title of the information-card. Can be copied. | string | - | | actionsMenu | Config for displaying "quick actions" - a button in footer that reveals a menu with links | ActionsMenuProps | - | | propertyListItems | an array of object properties to list, can also include dividers | InformationCardPropertyListItem[] | - | | summaryItems | An array of (label + icon + optional tooltip) summary items to display below properties | InformationCardSummaryItem[] | - |

ActionsMenuProps

Quick actions menu

| Property | Description | Type | Default | | --------------- | ----------------------------------- | -------------------- | --------------- | | items | Array of menu items. See ds-menu | MenuItemProps[] | - | | menuProps | Menu props. See ds-menu | Partial<MenuProps> | - | | buttonLabel | footer button label that shows menu | ReactNode | 'Quick actions' | | navigationLabel | Back to content navigation label | ReactNode | 'Quick actions' |

InformationCardPropertyListItem

Displays a list of properties (label & value)

| Property | Description | Type | Default | | -------- | -------------------------------- | ----------- | ------- | | label | label to display in the list | ReactNode | - | | value | valur to display in the list | ReactNode | - | | type | Back to content navigation label | divider | - |

InformationCardSummaryItem

Displays a list of icons with value and optional tooltip

| Property | Description | Type | Default | | ------------ | ------------------------------ | -------------- | ------- | | icon | Icon to render | ReactNode | - | | label | Label to display | ReactNode | - | | tooltip | Tooltip text | ReactNode | - | | tooltipProps | Tooltip config, see ds-tooltip | TooltipProps | - |

InformationCardTooltip

Displays InformationCard as a tooltip with children node as trigger

| Property | Description | Type | Default | |----------------------|-----------------------------------------|--------------------------------------------------------------------|---------| | informationCardProps | Props for rendering the InformationCard | InformationCardProps | - | | triggerProps | Trigger props. See rc-trigger | Partial<TriggerProps> & { ref?: React.LegacyRef<TriggerHandle> } | - | | children | trigger element | ReactNode | - |