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

@gold.au/table

v1.0.0

Published

Used to display tabular data

Downloads

11

Readme

@gold.au/table

Used to display tabular data

Contents


Install

yarn add @gold.au/table
npm install @gold.au/table

⬆ back to top


Dependency graph

/table
└─ /core

⬆ back to top


Tests

The visual test: https://auds.service.gov.au/packages/table/tests/site/

⬆ back to top


Release History

  • v0.2.1 - Update core package dependency to use the latest version
  • v0.2.0 - Refactor sass, first cell header option
  • v0.1.3 - Remove pancake js plugin from package json
  • v0.1.2 - Utilise the font-variant property for numeric table cells
  • v0.1.1 - Update font for numerical cells
  • v0.1.0 - 💥 Initial version

⬆ back to top


License

Copyright (c) Commonwealth of Australia. Licensed under MIT.

⬆ back to top

};

Usage

⬆ back to top


React

Usage:

import AUtable, {AUtableResponsiveWrapper, AUtableCaption, AUtableCell, AUtableHead, AUtableHeader, AUtableBody, AUtableRow} from '@gold.au/table';

//simple example
<AUtable 
	caption="Population of Australian states and territories, December 2015"
	headers={[
		{title: "Location",   key: "location"},
		{title: "Population", key: "population", type: 'numeric'}
	]}
	data={[
		{population: "7,670,700",     location: "New South Wales"},
		{location: "Victoria",        population: "5,996,400"},
		{location: "Tasmania",        population: "514,400"}
	]}
/>


//complex example
<AUtable
	caption="Example table"
	headers={[
						{title: "Name",      width: '50', key: "name" },
						{title: "Interests", width: '20', key: "interests", render: ( data, row ) => (<ul> {data.map(( data ) => (<li key={data}>{ data }</li>))}</ul>)},
						{title: "Actions",   width: '20', render: ( data, row ) => (
							<span><a href="#">Remove {row.name}</a> | <a href="#"> Update {row.name}</a></span>
							)},
						{title: "Age",       width: '10', key: "age",type: "numeric"},
					]}
	data = {[
					{name: "Bob Davidson",   age: "48", interests: ["photography", "reading"]},
					{name: "Jane Williamson",  age: "25", interests: ["basketball", "exercise", "hockey"]},
					{name: "Sally Robertson", age: "35", interests: ["Road trips", "Painting"]}
				]}
/>

//Using individual components
<table className="au-table">
	<AUtableHead>
		<AUtableRow>
			<AUtableHeader type="text" title="Location"/>
			<AUtableHeader type="numeric" title="Population"/>
			<AUtableHeader type="numeric" title="Change over previous year %"/>
		</AUtableRow>
	</AUtableHead>
	<AUtableBody>
		<AUtableRow>
			<AUtableCell data="New South Wales" type="text" />
			<AUtableCell data="7,670,700" type="numeric"/>
			<AUtableCell data="3.1%" type="numeric"/>
		</AUtableRow>
		<AUtableRow>
			<AUtableCell data="Victoria" type="text" />
			<AUtableCell data="5,996,400" type="numeric" className="bold-cell" />
			<AUtableCell data="2.5%" type="numeric"/>
		</AUtableRow>
	</AUtableBody>
</table>

All props:

<AUTable
	caption="Population of Australian states and territories, December 2015"
	headers={[]}               {/* The table headers */}
	data={[]}                  {/* The table body data */}
	firstCellIsHeader={true}   {/* Is first cell in table body rows a header*}
	striped={true}             {/* Striped version of the table*/}
	className=""               {/*An additional class, optional*/}
	/>

<AUtableBody 
className=""                 {/*An additional class, optional*/}
/>

<AUtableHead 
className=""                 {/*An additional class, optional*/}
/>

<AUtableHeader /
title="Population"           {/*The title of the column/header*/}
type="numeric"               {/*The type of the column data, 'numeric' for right align, 'text' for left aligned*/}
width="75"                   {/*Width of the header/column. Can be either 25, 33, 50 or 75*/}
scope="col"                  {/*Scope of the header, can be either row or column*/}
className=""                 {/*An additional class, optional*/}
>

<AUtableCell 
data="7,950,500"             {/*The cell data*/}
type="numeric"               {/*The type of the column data, 'numeric' for right align, 'text' for left aligned*/}
className=""                 {/*An additional class, optional*/}
/>

<AUtableRow 
className=""                 {/*An additional class, optional*/}
/>

<AUtableCaption 
tableCaption="Dates and amounts"     {/*Title of the table*/}
className=""                         {/*An additional class, optional*/}
/>

// Table wrapper for responsive tables
<AUtableResponsiveWrapper /> 

/>