2.7.0 • Published 5 months ago

@highlight-ui/utils-commons v2.7.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

@highlight-ui/utils-commons

Installation

yarn add @highlight-ui/utils-commons

Usage

import utils from '@highlight-ui/utils-commons';

Exported Types

NameDescription
FontFamilyValid FontAwesome family variants
LocaleUsed for internationalization
SizeAllowed size variants
DirectionUsed for positioning elements
ComponentMetadataUsed for specifying required data-attributes for e2e tests
ParsedMetadataSame as ComponentMetadata but every attribute is prefixed with data-*
PropsWithMetadataUtility type for adding metadata to a component's props
OutlineVariantAllowed outlines on input elements
ValidationStatusUsed for specifying validations status for a message or a file

Exported Functions

parseMetadata()

Takes an object and converts all of its properties to valid HTML data attributes.

import utils from '@highlight-ui/utils-commons';

const metadata = {
  firstAttribute: '1',
  secondAttribute: '2',
};

const parsedMetadata = utils.parseMetadata(metadata);

console.log(parsedMetadata);
/*
  Output:
 {
  'data-first-attribute': '1',
  'data-second-attribute': '2',
  }
*/

forkHandlers()

Receives an array of callbacks and returns a function that accepts an event argument that will be passed to every callback in the array.

import utils from '@highlight-ui/utils-commons';

const MyComponent = () => {
  const handleClick = utils.forkHandlers([
    () => {
      console.log('first handler');
    },
    () => {
      console.log('second handler');
    },
    (event) => {
      event.preventDefault();
      console.log('third handler');
    },
  ]);

  return <div onClick={handleClick}>Click Me</div>;
};

withDeprecationWarning()

Higher order component that can be used to show a deprecation message as a warning in the console, with optional further information on how to use a replacement.

PropTypeRequiredDefaultDescription
WrappedComponentReactComponentYesComponent to display console warning about deprecation - when used
migrationGuideLinkstringNonullValid link to a migration guide from deprecated component to alternative
withDeprecationWarning(
  ADeprecatedComponent,
  'https://optional-link-to-a-migration-guide.com',
);

This will show as a warning on the console:

⚠️ Deprecation Warning: ADeprecatedComponent is now deprecated. See https://optional-link-to-a-migration-guide.com for migration guidance.

@highlight-ui/anchor@infinitebrahmanuniverse/nolb-_hig@everything-registry/sub-chunk-395@zalastax/nolb-_hig@highlight-ui/drag-and-drop@highlight-ui/drawer@highlight-ui/dropdown-menu@highlight-ui/empty-state@highlight-ui/file-management@highlight-ui/form-field@highlight-ui/icon@highlight-ui/inline-notification@highlight-ui/input@highlight-ui/layout@highlight-ui/link@highlight-ui/menu@highlight-ui/month-navigation@highlight-ui/pagination@highlight-ui/panel@highlight-ui/tooltip@highlight-ui/typography@highlight-ui/utils-hooks@highlight-ui/button@highlight-ui/card@highlight-ui/checkbox@highlight-ui/circular-progress@highlight-ui/color-picker@highlight-ui/date-time-picker@highlight-ui/dialog@highlight-ui/radio-button@highlight-ui/sandbox-action-bar@highlight-ui/sandbox-collapsible@highlight-ui/sandbox-custom-menu@highlight-ui/sandbox-date-time-picker@highlight-ui/sandbox-form-field@highlight-ui/sandbox-loading-state@highlight-ui/sandbox-menu@highlight-ui/sandbox-multiselect-tag@highlight-ui/sandbox-progress-tracker@highlight-ui/sandbox-search-input@highlight-ui/sandbox-searchable-sub-label-select@highlight-ui/sandbox-select-low-domy@highlight-ui/sandbox-spinner@highlight-ui/sandbox-tag@highlight-ui/sandbox-toggle@highlight-ui/section-card@highlight-ui/select@highlight-ui/skeleton@highlight-ui/tab@highlight-ui/table@highlight-ui/tag@highlight-ui/tag-picker@highlight-ui/tile@highlight-ui/toast@highlight-ui/toggle@highlight-ui/toggle-input@highlight-ui/accordion@highlight-ui/action-bar@highlight-ui/alert@highlight-ui/avatar@highlight-ui/progress-tracker@personio/html-sanitizer
2.7.0

5 months ago

2.4.1

10 months ago

2.4.0

10 months ago

2.6.1

7 months ago

2.4.3

10 months ago

2.6.0

7 months ago

2.4.2

10 months ago

2.4.5

9 months ago

2.6.2

7 months ago

2.4.4

9 months ago

2.6.0-r18.0

8 months ago

2.5.6

7 months ago

2.5.5

7 months ago

2.5.7

7 months ago

2.3.9

10 months ago

2.5.0

9 months ago

2.5.2

8 months ago

2.5.1

8 months ago

2.5.4

8 months ago

2.5.3

8 months ago

2.4.6

9 months ago

2.3.11

10 months ago

2.3.10

10 months ago

2.3.8

1 year ago

2.3.7

1 year ago

2.3.4

1 year ago

2.3.6

1 year ago

2.3.5

1 year ago

2.2.0

1 year ago

2.3.0

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.3.2

1 year ago

2.1.4

1 year ago

2.3.1

1 year ago

2.1.3

1 year ago

2.3.3

1 year ago

2.1.5

1 year ago

2.1.0

1 year ago

2.0.24

1 year ago

2.0.22

1 year ago

2.0.23

1 year ago

2.0.20

1 year ago

2.0.21

1 year ago

2.0.15

2 years ago

2.0.16

2 years ago

2.0.18

2 years ago

2.0.13

2 years ago

2.0.14

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.11

2 years ago

2.0.12

2 years ago

2.0.6

2 years ago

2.0.0-alpha.0

2 years ago

2.0.9

2 years ago

2.0.0-alpha.1

2 years ago

2.0.10

2 years ago

2.0.8

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.14

2 years ago

1.3.10

2 years ago

1.3.13

2 years ago

1.3.11

2 years ago

1.3.12

2 years ago

1.3.9

2 years ago

1.3.8

3 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago