nitro-web 0.0.124 → 0.0.125
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.
|
@@ -5,7 +5,7 @@ import { ListFilterIcon } from 'lucide-react'
|
|
|
5
5
|
|
|
6
6
|
type CommonProps = {
|
|
7
7
|
label?: string
|
|
8
|
-
|
|
8
|
+
width?: 'full' | 'half' | 'third' | 'quarter' | 'fifth'
|
|
9
9
|
rowClassName?: string
|
|
10
10
|
}
|
|
11
11
|
export type FilterType = (
|
|
@@ -125,13 +125,13 @@ export const Filters = forwardRef<FiltersHandleType, FiltersProps>(({
|
|
|
125
125
|
navigate(locationRef.current.pathname + queryStr, { replace: true })
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
function getBasisWidth(
|
|
128
|
+
function getBasisWidth(width: 'full' | 'half' | 'third' | 'quarter' | 'fifth') {
|
|
129
129
|
// Need to splay out the classnames for tailwind to work
|
|
130
|
-
if (
|
|
131
|
-
else if (
|
|
132
|
-
else if (
|
|
133
|
-
else if (
|
|
134
|
-
else if (
|
|
130
|
+
if (width == 'full') return 'w-full'
|
|
131
|
+
else if (width == 'half') return 'shrink basis-[calc(50%-8px)]'
|
|
132
|
+
else if (width == 'third') return 'shrink basis-[calc(33.33%-8px)]'
|
|
133
|
+
else if (width == 'quarter') return 'shrink basis-[calc(25%-8px)]'
|
|
134
|
+
else if (width == 'fifth') return 'shrink basis-[calc(20%-8px)]'
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
return (
|
|
@@ -153,8 +153,8 @@ export const Filters = forwardRef<FiltersHandleType, FiltersProps>(({
|
|
|
153
153
|
</div> */}
|
|
154
154
|
<div class={twMerge(`flex flex-wrap gap-[16px] p-[16px] pb-6 ${dropdownFiltersClassName || ''}`)}>
|
|
155
155
|
{
|
|
156
|
-
filters?.map(({label,
|
|
157
|
-
<div key={i} class={twMerge(getBasisWidth(
|
|
156
|
+
filters?.map(({label, width='full', rowClassName, ...filter}, i) => (
|
|
157
|
+
<div key={i} class={twMerge(getBasisWidth(width), rowClassName || '')}>
|
|
158
158
|
<div class="flex justify-between">
|
|
159
159
|
<label for={filter.id || filter.name}>{label || camelCaseToTitle(filter.name)}</label>
|
|
160
160
|
<a href="#" class="label font-normal text-secondary underline" onClick={(e) => reset(e, filter)}>Reset</a>
|
|
@@ -73,7 +73,7 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
73
73
|
{
|
|
74
74
|
type: 'select',
|
|
75
75
|
name: 'status',
|
|
76
|
-
|
|
76
|
+
width: 'half',
|
|
77
77
|
options: [
|
|
78
78
|
{ label: 'Pending', value: 'pending' },
|
|
79
79
|
{ label: 'Approved', value: 'approved' },
|
|
@@ -85,7 +85,8 @@ export function Styleguide({ className, elements, children, currencies }: Styleg
|
|
|
85
85
|
name: 'color',
|
|
86
86
|
label: 'Half column',
|
|
87
87
|
placeholder: 'Select color...',
|
|
88
|
-
rowClassName: '
|
|
88
|
+
rowClassName: 'italic', // for custom styling
|
|
89
|
+
width: 'half',
|
|
89
90
|
},
|
|
90
91
|
]
|
|
91
92
|
return filters
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.125",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
6
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|