Socket
Socket
Sign inDemoInstall

@eccenca/gui-elements

Package Overview
Dependencies
308
Maintainers
2
Versions
84
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @eccenca/gui-elements

GUI elements based on other libraries, usable in React application, written in Typescript.


Version published
Weekly downloads
154
decreased by-63.42%
Maintainers
2
Created
Weekly downloads
 

Changelog

Source

[23.6.0] - 2024-04-17

Added

  • <BreadcrumbList/>, <MultiSuggestField/>, <Notification/>, <Select/>, <Tabs/>
    • data-test-id (and data-testid as alias of it): can be defined to add test ids to the DOM elements
    • wrapperProps: can be defined by using div attributes, and if given a div element with wrap the component. This wrapper is also used for test ids because the underlaying BlueprintJS components do not forward data attributes to the DOM.
    • if a test id is used on <Select/> or <MultiSuggestField/> then the toggle button, the dropdown and the search filter get automatically their own test id, suffixed by _togger, _drowpdown and _searchinput.
  • <CodeMirror />:
    • Added support for N-triples and Mathematica modes.
    • Allow direct access to the underlying code mirror instance.
    • Allow to register a scroll handler.
    • Support code folding for some modes, e.g. xml, json.
  • <Modal/>, <SimpleDialog/>, <AlertDialog/>
    • data-test-id (and data-testid as alias of it): can be defined to add test ids to the DOM elements
  • <MultiSuggestField />
    • selectedItems can be used to set default selected items
  • new use hook
    • useApplicationHeaderOverModals: forces the application header to be displayed over modal backgrounds
  • ClassNames now forwards all BlueprintJS CSS class names
    • import { ClassNames } from "@eccenca/gui-elements";
      export const bpButtonClass = ClassNames.Blueprint.BUTTON;
      
  • new icons: state-locked, state-unlocked, application-notification

Fixed

  • <Card />
    • fix styles for selected=true, allow it without interactive functionality on card element
    • align colors with active menu items
  • <MultiSuggestField />
    • reset the list of options when the query is cleared but nothing from the list is selected
    • add the created element to the list of filtered elements immediately after its creation
    • block input if disabled property is set
  • <TagList />
    • vertical alignment fixed in nowrap containers and for tags with icons

Changed

  • BlueprintJS libraries was updated to v5
    • Popover2 lib was removed because we can now again use the internal component from core lib again
  • <ApplicationContainer />
    • <OverlaysProvider /> from BlueprintJS is now used
    • @see https://github.com/palantir/blueprint/wiki/Overlay2-migration
  • <Tag />
    • included icons are always limited to the height of the text label

Deprecated

  • <Button />
    • interface AnchorOrButtonProps is currently exported together with the component but it will be removed with the next major version
    • there won't be a replacement or alternate interface because ButtonProps should be enough
  • <BreadcrumbList/>
    • property htmlUlProps: this is going to be removed because the BlueprintJS Breadcrumbs component does not support native ul attributes. The element provides a new wrapperProps property.
  • <MultiSuggestField />
    • static usage of data-test-id="clear-all-items" for the clearance button is deprecated, will be replaced by a test id later that is created from the given test id for the component plus a _clearance suffix

Readme

Source

eccenca GUI elements

Collection of React elements based on Palantir BlueprintJS and IBM Carbon, used for eccenca Corporate Memory applications.

Usage

Installation

We provide a package via npmjs registry, install it by:

yarn add @eccenca/gui-elements

It could be also included as Git submodule to your projects and used via yarn link or yarn workspaces.

As long as IBM Carbon does not support TypeScript it is necessary to install @types/carbon-components-react as development dependency:

yarn add --dev @types/carbon-components-react

Inclusion

  • To include SCSS styles for all basic components add @import "~@eccenca/gui-elements/index"; into your main SCSS file.
  • To use extensions and special Corporate Memory components the include of @eccenca/gui-elements/extensions and @eccenca/gui-elements/cmem is necessary
  • To include only the default configuration add @import "~@eccenca/gui-elements/src/configuration/variables; into your SCSS file.

Configuration

All configuration variables can be set before importing the full library or the default configuration but for the main changes you should need to change only a few parameters:

  • Basic colors
    • $eccgui-color-primary: color for very important buttons and switches
    • $eccgui-color-primary-contrast: readable text color used on primary color areas
    • $eccgui-color-accent: color for most conformation buttons, links, etc
    • $eccgui-color-accent-contrast: readable text color used on accent color areas
    • $eccgui-color-applicationheader-text
    • $eccgui-color-applicationheader-background
    • $eccgui-color-workspace-text
    • $eccgui-color-workspace-background
  • Basic sizes
    • $eccgui-size-typo-base: size including absolute unit, currently only px is supported
    • $eccgui-size-typo-base-lineheight: only ratio to font size, no unit!
    • $eccgui-size-type-levelratio: ratio without unit! used to calculate different text sizes based on $eccgui-size-typo-base
    • $eccgui-size-block-whitespace: white space between block level elements, currently only px is supported

Development

Running tests

Run the Jest tests with yarn test, for test coverage information run yarn test:coverage. You can check easily code for code errors by yarn compile (JS/Typescript) and yarn compile-scss (SASS).

If you run Jest tests in your app using our library you need to install @babel/plugin-transform-runtime as development dependeny and add it to your Babel plugins configuration.

Running Storybook

All story source files are kept in the respective components, extensions and cmem folders, using *.stories.tsx file name pattern. Run the storybook by

yarn install
yarn storybook

If you want to include Jest test results into the Storybook, run yarn test:generate-output before yarn storybook. If the stories and the tests share exactly the compononent name in the file names, e.g. Button.stories.tsx and Button., then tests are included automazically when the test output is available. In case the file names cannot match by pattern then test file names need to be configured in the stories:

Default.parameters = {
    jest: "MyTestFile.test.tsx",
};

Naming conventions

  • Use a *Props suffix for component interfaces.
  • Use a *Utils suffix for objects providing helper functions to compoents. Name should start with a lowercase letter.

Don't forget to export them. They need to be available via simple import from @eccenca/gui-elements.

Example: if you have your SimpleComponent then provide at least SimpleComponentProps, maybe simpleComponentUtils.

Use via yalc

If necessary you can use yalc to develop gui elements and your application side by side.

  1. Install yalc globally via npm or yarn
  2. Checkout @eccenca/gui-elements
  3. Inside gui elements folder: yalc publish --push
  4. Inside your applications folder: yalc link @eccenca/gui-elements
  5. After updates to the gui elements: yarn build:all && yalc push

Process for pull requests and publishing releases

  1. feature/* and bugfix/* branches are merged into develop via pull request
  2. release/*branch is created from develop via GitHub interface, there will be created a pull request automatically
  3. PR from release branch into main need to be approved
    • this will lead to a published package of the release

License

Apache License, Version 2.0, January 2004

Keywords

FAQs

Last updated on 17 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc