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

@claudebernard/news-element

v0.1.50

Published

An element providing Claude Bernard's latest news about health.

Downloads

135

Readme

elements

An element providing Claude Bernard's latest news about health.

Documentation

See the full documentation for Lit at docs.claudebernard.fr.

You can play with a full demo.

Installation

npm install --save @claudebernard/news-element

Usage

Angular

Import as ES modules in the app.module.ts file.

import '@claudebernard/news-element';

In the html file that will use the custom element :

<bcb-news [hideHeader]="true" (onNewsClicked)="handleClick($event)"></bcb-news>

To test click event :

handleClick(news) {
    alert(news.detail.data.newsTitle);
}

Vue.js

Import as ES modules in the App.vue file.

import '@claudebernard/news-element';

In the html file that will use the custom element :

<bcb-news id="bcb-news" :hideHeader="true"></bcb-news>

To paste in App.vue or in the file that will use the custom element :

<script setup lang="ts">
import { onMounted } from 'vue'

const handleClick = (event) => {
  alert(event.detail.data.newsTitle);
} 

// To test click event :

onMounted(() => {
  const el = document.getElementById('bcb-news');
  el.addEventListener('onNewsClicked', (e) => {
    handleClick(e);
  });
});
</script>

React

Import as ES modules in the App.tsx file. Don't forget to do 'npm install' after importing '@lit-labs/react'.

import {BcbNews} from '@claudebernard/news-element';
import {createComponent} from '@lit-labs/react';
import React, { useState } from 'react'

To paste in App.tsx file or in the file that will use the custom element :

export const BcbNewsReact = createComponent({
  react: React,
  tagName: 'bcb-news',
  elementClass: BcbNews, 
  events: {
    onNewsClicked: 'onNewsClicked'
  }
});

To paste in the return part of the .tsx file :

<BcbNewsReact hideHeader={true} onNewsClicked={(news) => handleClick(news)}></BcbNewsReact>

To test click event :

const handleClick = (news) => {
  alert(news.detail.data.newsTitle)
}

Vanilla JS :

Import as ES modules in the App.js file.

import '@claudebernard/news-element';

To paste in the html part of the file that will use the custom element :

<bcb-news id="bcb-news" hideHeader></bcb-news>

To test click event :

let bcbNewsComponent = document.getElementById('bcb-news');
bcbNewsComponent.addEventListener('onNewsClicked', function(event) {
  alert(event.detail.data.newsTitle);
});

Attributes

| Name | Type | Default | Description | |---------------|----------|-------------|---------------------------------------------------------------| | url | string | | The URL to call the Claude Bernard API. | | `productCode` | `string` | | To use if you want to display all the news for a specific product. | | newsCount | number | 5 | The number of news to display. | | viewMode | string | carousel | The style of the custom element, "static" is the other possible value. | | imageReverse| boolean| false | The position of the picture. Default left, right if true. | | hideNewsType| boolean| false | To display or not the type of the news. | | dateFormat | string | DD/MM/YYYY| The date format to use. | | hideHeader | boolean| false | To display or not a header above the custom element. | | showImage | boolean| false | To display or not the image associated to the custom element. | | hideMoreLabel| boolean| false | To display or not the text to redirect to another page. | | hideLabNews | boolean| false | To display or not the news with laboratory type. | | labNewsCount| number | 1 | The number of laboratory news to display. Only is hideLabNews is false. | | navigation | | | Coming soon. |

Events

| Name | Description | |-----------------|----------------------------------------------------| | onNewsClicked | The action to be done when clicking on the custom element. |

Browser support

Browsers without native custom element support require a polyfill.

  • [*] Chrome
  • [*] Firefox
  • [*] Safari
  • [*] Microsoft Edge

Custom element checklist

  • [] Public documentation (docs portal)
  • [*] Functional on Angular, React, Vue
  • [] Unit tested
  • [] Code quality
  • [] Changelog with semantic release
  • [] Available in offline mode
  • [] Best practices compliant
  • [] Validated by QA
  • [] Publicly available
  • [] Based on FHIR
  • [] Example on storybook
  • [] Available demo
  • [] i18n
  • [] Browser support section
  • [] EOL section

Contributing

Read through our contributing guidelines to learn about our submission process, coding rules, and more.

License

Copyright of Cegedim. See LICENSE for details.