@blakesteve/roster 4.10.0 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -11
- package/dist/{Table-C1JbdA7q.js → Table-D-C0ivz2.js} +2 -2
- package/dist/{Table-CoQRmik0.cjs → Table-pfb9MJtO.cjs} +2 -2
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +11 -1
- package/dist/components/molecules/RadioGroup/RadioGroup.d.ts +128 -0
- package/dist/components/molecules/RadioGroup/radio-group-variants.d.ts +99 -0
- package/dist/data-table.cjs.js +1 -1
- package/dist/data-table.es.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/meta.json +3 -3
- package/dist/roster.cjs.js +3 -3
- package/dist/roster.css +1 -1
- package/dist/roster.es.js +4525 -4158
- package/dist/{utils-C7BfXGiM.cjs → utils-B4q42wBM.cjs} +1 -1
- package/dist/{utils-hNxf9HpA.js → utils-koxKGlVV.js} +19 -1
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The radio control itself.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately the same shape as `checkboxVariants`: the same three sizes, the
|
|
5
|
+
* same eight color schemes, the same `--roster-control-border` hairline when
|
|
6
|
+
* unchecked and the same `-ink` token on the mark. A radio and a checkbox on
|
|
7
|
+
* one form should differ in what they mean, not in how heavy their edges look.
|
|
8
|
+
*
|
|
9
|
+
* Two things differ. `rounded-full`, and the mark is a dot rather than a
|
|
10
|
+
* glyph — it reads `currentColor`, so the `-ink` token that guarantees
|
|
11
|
+
* contrast on each fill does the work here too. There is also no `soft`
|
|
12
|
+
* variant: `Checkbox` carries eight more compound rows for one, and
|
|
13
|
+
* `CheckboxGroup` surfaces only `colorScheme` to its consumers, so this
|
|
14
|
+
* follows the group rather than the atom.
|
|
15
|
+
*
|
|
16
|
+
* The 44x44 target is built in rather than left to the consumer. Same
|
|
17
|
+
* pseudo-element technique as `Checkbox`, for the same reason and with the
|
|
18
|
+
* same two consequences: `before:` generates no layout box, so the circle
|
|
19
|
+
* keeps its exact dimensions, and the target overhangs the box on all four
|
|
20
|
+
* sides, which means an `overflow: hidden` ancestor clips it and a tightly
|
|
21
|
+
* spaced column overlaps it. The size is stated as `size-11` rather than as a
|
|
22
|
+
* negative inset per size, because `inset` on an absolutely positioned
|
|
23
|
+
* pseudo-element resolves against the PADDING box: an inset measured from each
|
|
24
|
+
* circle's outer width lands 2px short at every size, once for each 1px of
|
|
25
|
+
* border, and looks correct in the source while measuring 42.
|
|
26
|
+
*/
|
|
27
|
+
export declare const radioVariants: (props?: ({
|
|
28
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
29
|
+
checked?: boolean | null | undefined;
|
|
30
|
+
colorScheme?: "primary" | "orange" | "teal" | "purple" | "amber" | "success" | "error" | "neutral" | null | undefined;
|
|
31
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
32
|
+
/**
|
|
33
|
+
* The dot inside the circle.
|
|
34
|
+
*
|
|
35
|
+
* `bg-current` rather than a color of its own, so it inherits the `-ink` token
|
|
36
|
+
* the control resolved for whichever fill it is sitting on. Sized to roughly
|
|
37
|
+
* 40% of the circle at every size — 6/16, 8/20, 10/24 — which is where a radio
|
|
38
|
+
* reads as a radio rather than as a filled dot or a faint speck.
|
|
39
|
+
*/
|
|
40
|
+
export declare const radioDotVariants: (props?: ({
|
|
41
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
42
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
43
|
+
/**
|
|
44
|
+
* One option.
|
|
45
|
+
*
|
|
46
|
+
* The rule the spacing rests on: **an option's box contains its own target.** A
|
|
47
|
+
* 44px target that can not reach past the option it belongs to can not reach
|
|
48
|
+
* into the one beside it either, at any gap, including zero. That is what lets
|
|
49
|
+
* the gaps be small.
|
|
50
|
+
*
|
|
51
|
+
* One layout covers every case, and the arithmetic is why. The radio is
|
|
52
|
+
* `self-start`, so it sits on the label's first line, and it needs no nudge to
|
|
53
|
+
* land there: the type scale and the size scale agree at every step — 16px
|
|
54
|
+
* line-height against a 16px circle at `sm`, 20 against 20 at `md`, 24 against
|
|
55
|
+
* 24 at `lg` — so the top of the circle and the top of the first line are the
|
|
56
|
+
* same edge. The padding is then whatever closes the gap to 44,
|
|
57
|
+
* `(44 - line-height) / 2`, which puts the radio's center at exactly 22px from
|
|
58
|
+
* the row's top at every size. The target spans the row and nothing else.
|
|
59
|
+
*
|
|
60
|
+
* That single rule holds for a one-line option, an option whose label wraps,
|
|
61
|
+
* and an option with a description, which is why there is no longer a branch
|
|
62
|
+
* for the last of those. Two earlier versions had one and both were wrong in a
|
|
63
|
+
* case they did not cover: a symmetric padding let a described row's target
|
|
64
|
+
* overhang its own top edge by 2 to 6px, and centering a plain row floated the
|
|
65
|
+
* radio into the middle of a two-line label — correct for one line, visibly
|
|
66
|
+
* wrong for two, on text a consumer supplies and can not control the width of.
|
|
67
|
+
*
|
|
68
|
+
* `horizontal` applies the same rule across instead of down, where the binding
|
|
69
|
+
* constraint is width rather than height: two radios less than 44px apart
|
|
70
|
+
* overlap however tall their boxes are. `min-w-11` guarantees it even for a
|
|
71
|
+
* one-character label.
|
|
72
|
+
*/
|
|
73
|
+
export declare const radioOptionVariants: (props?: ({
|
|
74
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
75
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
76
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
77
|
+
/**
|
|
78
|
+
* The options' container.
|
|
79
|
+
*
|
|
80
|
+
* `vertical` is the default because a radio group holds one answer, and options
|
|
81
|
+
* read as alternatives to each other when they are stacked. `horizontal` is for
|
|
82
|
+
* the short scannable set, two or three one-word answers that would otherwise
|
|
83
|
+
* spend three rows of a wide form, and it wraps rather than overflowing:
|
|
84
|
+
* a row of options that runs off the side of a phone is worse than the column
|
|
85
|
+
* it replaced.
|
|
86
|
+
*
|
|
87
|
+
* There is no `columns` prop. `CheckboxGroup` has one because it is the
|
|
88
|
+
* long-list control and a filter list of twenty wants the width; a radio group
|
|
89
|
+
* with that many options wants a `Select`.
|
|
90
|
+
*
|
|
91
|
+
* The gaps are small, and can be, because each option already contains its own
|
|
92
|
+
* target and its own padding. Across, they are larger than down: a horizontal
|
|
93
|
+
* gap separates two whole options rather than two stacked rows, and at the
|
|
94
|
+
* vertical scale two options sat 0 to 4px apart and read as one control.
|
|
95
|
+
*/
|
|
96
|
+
export declare const radioGroupOptionsVariants: (props?: ({
|
|
97
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
98
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
99
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
package/dist/data-table.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-pfb9MJtO.cjs"),p=require("react"),r=require("@tanstack/react-table"),o=require("./utils-B4q42wBM.cjs"),R=r.tableFeatures({rowSortingFeature:r.rowSortingFeature,rowPaginationFeature:r.rowPaginationFeature,sortedRowModel:r.createSortedRowModel(),paginatedRowModel:r.createPaginatedRowModel(),sortFns:r.sortFns});function f({columns:a,data:i,className:l,tableClassName:x,paginationClassName:c,variant:u="default",size:g="md",hoverable:m=!1}){const[d,j]=p.useState([]),t=r.useTable({features:R,data:i,columns:a,onSortingChange:j,state:{sorting:d},initialState:{pagination:{pageIndex:0,pageSize:10}}});return e.jsxRuntimeExports.jsxs("div",{className:o.cn("rst:font-ui rst:flex rst:flex-col rst:gap-4",l),children:[e.jsxRuntimeExports.jsxs(e.Table,{variant:u,size:g,hoverable:m,className:x,children:[e.jsxRuntimeExports.jsx(e.TableHeader,{children:t.getHeaderGroups().map(n=>e.jsxRuntimeExports.jsx(e.TableRow,{children:n.headers.map(s=>e.jsxRuntimeExports.jsx(e.TableHead,{children:s.isPlaceholder?null:e.jsxRuntimeExports.jsxs("div",{className:o.cn("rst:flex rst:items-center rst:gap-2 rst:transition-opacity",s.column.getCanSort()&&"rst:cursor-pointer rst:select-none rst:opacity-80 rst:hover:opacity-100"),onClick:s.column.getToggleSortingHandler(),children:[r.flexRender(s.column.columnDef.header,s.getContext()),s.column.getCanSort()&&e.jsxRuntimeExports.jsx("span",{className:"rst:w-4 rst:flex rst:justify-center rst:text-primary-500",children:s.column.getIsSorted()==="asc"?e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faCaretUp}):s.column.getIsSorted()==="desc"?e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faCaretDown}):null})]})},s.id))},n.id))}),e.jsxRuntimeExports.jsx(e.TableBody,{children:t.getRowModel().rows?.length?t.getRowModel().rows.map(n=>e.jsxRuntimeExports.jsx(e.TableRow,{children:n.getAllCells().map(s=>e.jsxRuntimeExports.jsx(e.TableCell,{children:r.flexRender(s.column.columnDef.cell,s.getContext())},s.id))},n.id)):e.jsxRuntimeExports.jsx(e.TableRow,{children:e.jsxRuntimeExports.jsx(e.TableCell,{colSpan:a.length,className:"rst:h-24 rst:text-center rst:text-gray-500 rst:dark:text-gray-400 rst:italic",children:"No results found."})})})]}),e.jsxRuntimeExports.jsxs("div",{className:o.cn("rst:flex rst:flex-col rst:sm:flex-row rst:items-center rst:justify-between rst:gap-4 rst:px-2",c),children:[e.jsxRuntimeExports.jsxs("div",{className:"rst:text-sm rst:font-medium rst:text-gray-500 rst:dark:text-gray-400",children:["Page"," ",e.jsxRuntimeExports.jsx("strong",{className:"rst:text-gray-900 rst:dark:text-gray-100",children:t.state.pagination.pageIndex+1})," ","of"," ",e.jsxRuntimeExports.jsx("strong",{className:"rst:text-gray-900 rst:dark:text-gray-100",children:t.getPageCount()})]}),e.jsxRuntimeExports.jsxs("div",{className:"rst:flex rst:items-center rst:space-x-2",children:[e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),"aria-label":"Go to first page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAnglesLeft})}),e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),"aria-label":"Go to previous page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAngleLeft})}),e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),"aria-label":"Go to next page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAngleRight})}),e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.setPageIndex(t.getPageCount()-1),disabled:!t.getCanNextPage(),"aria-label":"Go to last page",children:e.jsxRuntimeExports.jsx(e.FontAwesomeIcon,{icon:e.faAnglesRight})})]})]})]})}exports.DataTable=f;
|
package/dist/data-table.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { j as e, T as C, a as S, b as l, c as P, F as a, f as w, d as y, e as v, g as c, B as n, h as N, i as R, k as T, l as k } from "./Table-
|
|
2
|
+
import { j as e, T as C, a as S, b as l, c as P, F as a, f as w, d as y, e as v, g as c, B as n, h as N, i as R, k as T, l as k } from "./Table-D-C0ivz2.js";
|
|
3
3
|
import { useState as F } from "react";
|
|
4
4
|
import { tableFeatures as I, sortFns as A, rowPaginationFeature as M, rowSortingFeature as z, createPaginatedRowModel as D, createSortedRowModel as G, useTable as H, flexRender as g } from "@tanstack/react-table";
|
|
5
|
-
import { c as o } from "./utils-
|
|
5
|
+
import { c as o } from "./utils-koxKGlVV.js";
|
|
6
6
|
const B = I({
|
|
7
7
|
rowSortingFeature: z,
|
|
8
8
|
rowPaginationFeature: M,
|
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ export * from './components/molecules/Pullquote/Pullquote';
|
|
|
54
54
|
export * from './components/molecules/Pullquote/pullquote-variants';
|
|
55
55
|
export * from './components/molecules/CheckboxGroup/CheckboxGroup';
|
|
56
56
|
export * from './components/molecules/CheckboxGroup/checkbox-group-variants';
|
|
57
|
+
export * from './components/molecules/RadioGroup/RadioGroup';
|
|
58
|
+
export * from './components/molecules/RadioGroup/radio-group-variants';
|
|
57
59
|
export * from './components/molecules/Breadcrumbs/Breadcrumbs';
|
|
58
60
|
export * from './components/molecules/Breadcrumbs/breadcrumb-variants';
|
|
59
61
|
export * from './components/molecules/CallToAction/CallToAction';
|
package/dist/meta.json
CHANGED