nitro-web 0.0.122 → 0.0.123
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,6 +5,7 @@ import { ListFilterIcon } from 'lucide-react'
|
|
|
5
5
|
|
|
6
6
|
type CommonProps = {
|
|
7
7
|
label?: string
|
|
8
|
+
size?: 'full' | 'half' | 'third' | 'quarter' | 'fifth'
|
|
8
9
|
rowClassName?: string
|
|
9
10
|
}
|
|
10
11
|
export type FilterType = (
|
|
@@ -123,6 +124,15 @@ export const Filters = forwardRef<FiltersHandleType, FiltersProps>(({
|
|
|
123
124
|
const queryStr = queryString(omit(stateRef.current, includePagination ? [] : ['page']))
|
|
124
125
|
navigate(locationRef.current.pathname + queryStr, { replace: true })
|
|
125
126
|
}
|
|
127
|
+
|
|
128
|
+
function getBasisWidth(size: 'full' | 'half' | 'third' | 'quarter' | 'fifth') {
|
|
129
|
+
// Need to splay out the classnames for tailwind to work
|
|
130
|
+
if (size == 'full') return 'w-full'
|
|
131
|
+
else if (size == 'half') return 'shrink basis-[calc(50%-8px)]'
|
|
132
|
+
else if (size == 'third') return 'shrink basis-[calc(33.33%-8px)]'
|
|
133
|
+
else if (size == 'quarter') return 'shrink basis-[calc(25%-8px)]'
|
|
134
|
+
else if (size == 'fifth') return 'shrink basis-[calc(20%-8px)]'
|
|
135
|
+
}
|
|
126
136
|
|
|
127
137
|
return (
|
|
128
138
|
<Elements.Dropdown
|
|
@@ -141,10 +151,10 @@ export const Filters = forwardRef<FiltersHandleType, FiltersProps>(({
|
|
|
141
151
|
This div shouldnt produce a page scrollbar when the dropdown is closed.
|
|
142
152
|
But should be visibile if allowedOverflow is true.
|
|
143
153
|
</div> */}
|
|
144
|
-
<div class={twMerge(`flex flex-wrap gap-
|
|
154
|
+
<div class={twMerge(`flex flex-wrap gap-[16px] p-[16px] pb-6 ${dropdownFiltersClassName || ''}`)}>
|
|
145
155
|
{
|
|
146
|
-
filters?.map(({label, rowClassName, ...filter}, i) => (
|
|
147
|
-
<div key={i} class={twMerge(
|
|
156
|
+
filters?.map(({label, size='full', rowClassName, ...filter}, i) => (
|
|
157
|
+
<div key={i} class={twMerge(getBasisWidth(size), rowClassName || '')}>
|
|
148
158
|
<div class="flex justify-between">
|
|
149
159
|
<label for={filter.id || filter.name}>{label || camelCaseToTitle(filter.name)}</label>
|
|
150
160
|
<a href="#" class="label font-normal text-secondary underline" onClick={(e) => reset(e, filter)}>Reset</a>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.123",
|
|
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 🚀",
|