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

@gomdle/solid-gomdle-ui

v0.3.3

Published

UI components for SolidJs

Downloads

92

Readme

UI for SolidJs

Installing

npm install @gomdle/solid-gomdle-ui

Button

import { Button } from "@gomdle/solid-gomdle-ui";
import { FaSolidCheck } from "solid-icons/fa";

// default button
<Button label="Search" onClick={onClick} />

// button with bordered, no background color
<Button outlined label="Search" />

// button with no bordered, no background color
<Button text label="Search" />

// submit button with icon
<Button type="submit"
	icon={<FaSolidCheck class="inline"/>}
	label="Sign In"
	disabled={loading()}
/>

Select Button

import { SelectButton } from "@gomdle/solid-gomdle-ui";
import { FaSolidBox } from "solid-icons/fa";

const options = [
	{value: 'A', label: 'Apple'},
	{value: 'B', label: 'Banana'},
	{value: 'C', label: 'Cacao'},
	{value: '?', icon: <FaSolidBox/>},
];

const [selected, setSelected] = createSignal(options[0].value);

<SelectButton
	value={selected()}
	options={options}
	onChange={e => setSelected(e.value)}
/>

Calendar

import { Calendar, Month } from "@gomdle/solid-gomdle-ui";

const [selected, setSelected] = createSignal(new Date());
const month = () => new Month(selected());

<Calendar
	month={month()}
	selected={selected()}
	onClickOnDate={setSelected}
/>

DatePicker

import { DatePicker } from '@gomdle/solid-gomdle-ui';

const [value, setValue] = createSignal(new Date());

<DatePicker
	value={value()}
	onChange={e => setValue(e.value)}
/>

<DatePicker
	view="month"
	value={value()}
	onChange={e => setValue(e.value)}
/>

InputSwitch

import { InputSwitch } from "@gomdle/solid-gomdle-ui";

const [showSecretValues, setSecretValues] = createSignal(false);

<label>
	<InputSwitch
		class='mr-2 align-text-bottom'
		checked={showFullStats()}
		onChange={(e) => setShowFullStats(e.value)}
	/>
	show secret values
</label>

InputText

import { InputText } from "@gomdle/solid-gomdle-ui";

const [signinData, setSigninData] = createSignal({userid: '', passwd: ''});

// default input text
<InputText
	name="userid"
	placeholder="Insert Your ID"
	value={signinData().userid}
	onChange={e => setSigninData(data => ({...data, userid: e.value}))}
/>

// password type
<InputText
	type="password"
	name="passwd"
	value={signinData().passwd}
	onChange={e => setSigninData(data => ({...data, passwd: e.value}))}
/>

InputNumber

import { InputNumber } from "@gomdle/solid-gomdle-ui";

<InputNumber
	name="price"
	value={orderData().price}
	min={0}
	onChange={e => setOrderData(orderData => ({...orderData, price: e.value}))}
/>

InputSelect

import { InputSelect } from "@gomdle/solid-gomdle-ui";

const PriceTypes = [
	{ label: 'Fixed Price', value: 'limited' },
	{ label: 'Market Price', value: 'unlimited' },
];

<InputSelect
	name="price_type"
	value={inputs().price_type}
	options={PriceTypes}
	onChange={e => setInputs(orderData => ({...orderData, price_type: e.value}))}
/>

Dialog

import { Dialog } from "@gomdle/solid-gomdle-ui";

<Dialog
	visible={showDialog()}
	header="Dialog"
	style={{ width: '20rem' }}
	onClose={() => setShowDialog(false)}
>
	<div>
		Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
	</div>
</Dialog>

ConfirmDialog

import { ConfirmDialog } from "@gomdle/solid-gomdle-ui";

<ConfirmDialog
	visible={showDialog()}
	message="Are you sure?"
	onAccept={() => console.log("You said you\'are sure")}
	onReject={() => setShowDialog(false)}
/>

DataTable

DataTable component is implemented on Tanstack Headless Table. You may need to npm install @tanstack/solid-table.

import { createColumnHelper } from '@tanstack/solid-table';
import { DataTable } from '@gomdle/solid-gomdle-ui';

const [selection, setSelection] = createSignal<number[]>([]); 

const columnHelper = createColumnHelper<TableRowData>();
const columns = [
	columnHelper.display({
		header: 'Date',
		cell: ({row: {original: rowData}}) => formatDate(rowData.date),
		size: 100,
		meta: { class: 'text-left' }
	}),
	columnHelper.accessor('sales', {
		header: 'Sales',
		cell: ctx => ctx.getValue()?.toLocaleString(),
		size: 60,
		meta: { class: 'text-center' }
	}),
	// ...
];

<DataTable stripedRows gridLines
	class="border border-gray-300 text-nowrap text-[0.75rem]"
	columns={columns}
	data={data()}
	selection={selection()}
	onRowClick={(data, rowIndex) => setSelection([rowIndex])}
	onRowDoubleClick={(data, rowIndex) => console.log(`double click on data[${rowIndex}]`)}
	rowClass={rowData => (rowData.sales >= 1000000 ? 'font-bold' : undefined)}
/>