runeforge 0.0.13 → 0.0.14

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 CHANGED
@@ -69,6 +69,7 @@ Runeforge provides a set of composable, metadata-driven components for building
69
69
  - Svelte 5 (runes mode)
70
70
  - Tailwind CSS 4
71
71
  - DaisyUI 5
72
+ - Cally
72
73
 
73
74
  ---
74
75
 
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" generics="T extends object = Record<string, unknown>">
2
+ import 'cally';
2
3
  import Avatar from '../Avatar.svelte';
3
4
  import Label from '../form/Label.svelte';
4
5
  import Select from '../form/Select.svelte';
@@ -1,3 +1,4 @@
1
+ import 'cally';
1
2
  import type { FieldDefinition } from '../../types/crud.js';
2
3
  declare function $$render<T extends object = Record<string, unknown>>(): {
3
4
  props: {
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" generics="T extends object">
2
+ import 'cally';
2
3
  import Label from '../form/Label.svelte';
3
4
  import Button from '../form/Button.svelte';
4
5
  import { getIconSet } from '../../icons/context.js';
@@ -106,14 +107,33 @@
106
107
  {dateRange.from || '…'} → {dateRange.to || '…'}
107
108
  </p>
108
109
  {/if}
110
+ {#if filter.hasActive(column.attribute)}
111
+ <Button variant="ghost" class="btn-sm mt-2 w-full" onclick={clear}>
112
+ {strings.clearFilter}
113
+ </Button>
114
+ {/if}
109
115
  {:else}
110
- <input
111
- type="text"
112
- class="input input-bordered input-sm w-full"
113
- placeholder={strings.filterPlaceholder}
114
- value={filter.textFor(column.attribute)}
115
- oninput={(e) => setText(e.currentTarget.value)}
116
- />
116
+ <div class="relative">
117
+ <input
118
+ type="text"
119
+ class={['input input-bordered input-sm w-full', filter.hasActive(column.attribute) && 'pr-7']}
120
+ placeholder={strings.filterPlaceholder}
121
+ value={filter.textFor(column.attribute)}
122
+ oninput={(e) => setText(e.currentTarget.value)}
123
+ />
124
+ {#if filter.hasActive(column.attribute)}
125
+ {@const Icon = icons.clear}
126
+ <Button
127
+ variant="ghost"
128
+ class="btn-xs btn-square btn-circle absolute top-1/2 right-1 -translate-y-1/2"
129
+ aria-label={strings.clearFilter}
130
+ title={strings.clearFilter}
131
+ onclick={clear}
132
+ >
133
+ <Icon class="size-3" />
134
+ </Button>
135
+ {/if}
136
+ </div>
117
137
 
118
138
  {#if entries.length > 0 && entries.length < maxCheckboxValues}
119
139
  <div class="mt-2 flex max-h-60 flex-col gap-1 overflow-y-auto">
@@ -133,10 +153,4 @@
133
153
  </div>
134
154
  {/if}
135
155
  {/if}
136
-
137
- {#if filter.hasActive(column.attribute)}
138
- <Button variant="ghost" class="btn-sm mt-2 w-full" onclick={clear}>
139
- {strings.clearFilter}
140
- </Button>
141
- {/if}
142
156
  </div>
@@ -1,3 +1,4 @@
1
+ import 'cally';
1
2
  import type { DistinctEntry } from '../../types/table.js';
2
3
  import type { FilterState } from './state.svelte.js';
3
4
  import type { ColumnDefinition } from '../../types/crud.js';
@@ -0,0 +1,6 @@
1
+ <script lang="ts">
2
+ let { size = '1em', class: cls = '' }: { size?: string | number; class?: string } = $props();
3
+ </script>
4
+ <svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 16 16" fill="currentColor" class={cls}>
5
+ <path d="M2.146 2.146a.5.5 0 0 1 .708 0L8 7.293l5.146-5.147a.5.5 0 1 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854a.5.5 0 0 1 0-.708z"/>
6
+ </svg>
@@ -0,0 +1,7 @@
1
+ type $$ComponentProps = {
2
+ size?: string | number;
3
+ class?: string;
4
+ };
5
+ declare const Clear: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type Clear = ReturnType<typeof Clear>;
7
+ export default Clear;
@@ -10,7 +10,7 @@
10
10
  * setIconSet(bootstrapIconSet);
11
11
  */
12
12
  import * as Icons from 'svelte-bootstrap-icons';
13
- const { ChevronExpand, CaretUpFill, CaretDownFill, Funnel, FunnelFill, Plus, Eye, PencilSquare, Trash3, HouseDoor, Folder, EyeSlash, } = Icons;
13
+ const { ChevronExpand, CaretUpFill, CaretDownFill, Funnel, FunnelFill, Plus, Eye, PencilSquare, Trash3, HouseDoor, Folder, EyeSlash, X, } = Icons;
14
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
15
  function asIcon(c) { return c; }
16
16
  export const bootstrapIconSet = {
@@ -19,6 +19,7 @@ export const bootstrapIconSet = {
19
19
  sortDesc: asIcon(CaretDownFill),
20
20
  filter: asIcon(Funnel),
21
21
  filterActive: asIcon(FunnelFill),
22
+ clear: asIcon(X),
22
23
  create: asIcon(Plus),
23
24
  view: asIcon(Eye),
24
25
  edit: asIcon(PencilSquare),
@@ -3,6 +3,7 @@ import SortAsc from '../defaults/SortAsc.svelte';
3
3
  import SortDesc from '../defaults/SortDesc.svelte';
4
4
  import Filter from '../defaults/Filter.svelte';
5
5
  import FilterActive from '../defaults/FilterActive.svelte';
6
+ import Clear from '../defaults/Clear.svelte';
6
7
  import Create from '../defaults/Create.svelte';
7
8
  import View from '../defaults/View.svelte';
8
9
  import Edit from '../defaults/Edit.svelte';
@@ -17,6 +18,7 @@ export const defaultIconSet = {
17
18
  sortDesc: SortDesc,
18
19
  filter: Filter,
19
20
  filterActive: FilterActive,
21
+ clear: Clear,
20
22
  create: Create,
21
23
  view: View,
22
24
  edit: Edit,
@@ -9,6 +9,7 @@ export interface CRUDIconSet {
9
9
  sortDesc: IconComponent;
10
10
  filter: IconComponent;
11
11
  filterActive: IconComponent;
12
+ clear: IconComponent;
12
13
  create: IconComponent;
13
14
  view: IconComponent;
14
15
  edit: IconComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runeforge",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "SvelteKit toolkit for building metadata-driven CRUD interfaces with tables, forms, and actions",
5
5
  "license": "MIT",
6
6
  "author": "Ezequiel Puerta",
@@ -37,6 +37,9 @@
37
37
  "svelte": "^5.0.0",
38
38
  "tailwindcss": "^4.0.0"
39
39
  },
40
+ "dependencies": {
41
+ "cally": "^0.9.2"
42
+ },
40
43
  "devDependencies": {
41
44
  "@eslint/js": "^10.0.1",
42
45
  "@playwright/test": "^1.60.0",