bref-ui 0.1.7 → 0.1.9

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
@@ -1,12 +1,12 @@
1
- # Bref: a truly Svelte-esque UI Component Library
1
+ # Bref: a Svelte UI Component Library
2
2
 
3
3
  **[Live Demo](https://feuersteiner.github.io/bref/)**
4
4
 
5
- Bref is a Svelte UI component library designed to be minimal, flexible, and easy to use.
6
- Think of it as, what if `Shadcn/ui` was built specifically for Svelte, used only CSS styling and no Tailwind CSS, fully embracing Svelte's unique capabilities and idioms.
5
+ Bref is a Svelte UI component library designed to be minimal, flexible, and easy to use. It uses Svelte's built-in scoped CSS for styling, no external CSS frameworks required.
7
6
 
8
7
  ## What We Promise
9
8
 
9
+ - **Pure CSS with scoped styles**: Uses Svelte's native styling system for clean, maintainable components
10
10
  - **Base UI components with escape hatches**: Access raw CSS properties when you need full control
11
11
  - **Clear naming conventions**: Component names resemble HTML as much as possible to avoid confusion
12
12
  - **Section-based components**: For more complex UI needs like navbars, modals, and cards
@@ -32,11 +32,7 @@ npm install bref-ui
32
32
 
33
33
  ## Why Bref?
34
34
 
35
- There are excellent Svelte component libraries out there. [Flowbite Svelte](https://github.com/themesberg/flowbite-svelte) and [shadcn-svelte](https://github.com/huntabyte/shadcn-svelte) are doing great work, and you should check them out.
36
-
37
- Bref takes a different approach:
38
-
39
- - **Pure CSS**: Uses Svelte's built-in scoped styling instead of Tailwind CSS. If you chose Svelte for its elegant styling solution, Bref keeps that promise.
35
+ - **Scoped CSS**: Uses Svelte's built-in scoped styling, each component's styles are encapsulated and won't leak or conflict.
40
36
  - **Minimal**: Only essential components, nothing extra.
41
37
  - **Flexible**: Use as an npm package or copy components directly into your project with our CLI tool (WIP).
42
38
  - **Batteries included theming**: Just provide your base colors and we handle the rest (see below).
@@ -2,7 +2,16 @@
2
2
  import type { TreeNodeProps } from './types.js';
3
3
  import Icon from '../icon/icon.svelte';
4
4
  import TreeNode from './tree-node.svelte';
5
- const { node, level, size, onSelect, selectedIds, filledIcon, wide }: TreeNodeProps = $props();
5
+ const {
6
+ node,
7
+ level,
8
+ size,
9
+ onSelect,
10
+ selectedIds,
11
+ filledIcon,
12
+ wide,
13
+ expandOnSelect
14
+ }: TreeNodeProps = $props();
6
15
 
7
16
  let expanded: boolean = $state(false);
8
17
  let selected: boolean = $derived(selectedIds?.has(node.id) ?? false);
@@ -14,7 +23,12 @@
14
23
  if (hasChildren) expanded = !expanded;
15
24
  };
16
25
 
17
- const handleSelect = () => onSelect(node.id);
26
+ const handleSelect = () => {
27
+ onSelect(node.id);
28
+ if (expandOnSelect && hasChildren) expanded = true;
29
+ };
30
+
31
+ const nextLevel = $derived(level + 1);
18
32
  </script>
19
33
 
20
34
  <!-- svelte-ignore a11y_click_events_have_key_events -->
@@ -48,7 +62,16 @@
48
62
 
49
63
  {#if expanded && hasChildren}
50
64
  {#each node.children as child (child.id)}
51
- <TreeNode node={child} level={level + 1} {size} {onSelect} {selectedIds} {filledIcon} {wide} />
65
+ <TreeNode
66
+ node={child}
67
+ level={nextLevel}
68
+ {size}
69
+ {onSelect}
70
+ {selectedIds}
71
+ {filledIcon}
72
+ {wide}
73
+ {expandOnSelect}
74
+ />
52
75
  {/each}
53
76
  {/if}
54
77
 
@@ -2,12 +2,29 @@
2
2
  import type { TreeViewProps } from './types.js';
3
3
  import TreeNode from './tree-node.svelte';
4
4
 
5
- let { data, size = 'medium', onSelect, selectedIds, wide, filledIcon }: TreeViewProps = $props();
5
+ let {
6
+ data,
7
+ size = 'medium',
8
+ onSelect,
9
+ selectedIds,
10
+ wide,
11
+ filledIcon,
12
+ expandOnSelect
13
+ }: TreeViewProps = $props();
6
14
  </script>
7
15
 
8
16
  <div role="tree" class={size} class:wide>
9
17
  {#each data as node (node.id)}
10
- <TreeNode {node} level={0} {size} {onSelect} {selectedIds} {wide} {filledIcon} />
18
+ <TreeNode
19
+ {node}
20
+ level={0}
21
+ {size}
22
+ {onSelect}
23
+ {selectedIds}
24
+ {wide}
25
+ {filledIcon}
26
+ {expandOnSelect}
27
+ />
11
28
  {/each}
12
29
  </div>
13
30
 
@@ -12,6 +12,7 @@ export interface BaseTreeProps {
12
12
  size?: Size;
13
13
  filledIcon?: IconProps['filled'];
14
14
  wide?: boolean;
15
+ expandOnSelect?: boolean;
15
16
  }
16
17
  export interface TreeViewProps extends BaseTreeProps {
17
18
  data: NodeDataProps[];
@@ -24,7 +24,14 @@
24
24
  <div class="container">
25
25
  <Logo />
26
26
  <div class="content">
27
- <TreeView wide size="small" {selectedIds} {onSelect} data={PAGES.map(pageToNode)} />
27
+ <TreeView
28
+ wide
29
+ size="small"
30
+ {selectedIds}
31
+ {onSelect}
32
+ data={PAGES.map(pageToNode)}
33
+ expandOnSelect
34
+ />
28
35
  </div>
29
36
  <Footer />
30
37
  </div>
@@ -60,12 +60,6 @@ export const PAGES = [
60
60
  description: 'Multi-line text area input fields with labels and placeholders',
61
61
  href: '/text-inputs/area-text-input',
62
62
  icon: 'notes'
63
- },
64
- {
65
- title: 'Multi Author',
66
- description: 'Input field for adding multiple authors for highlighting and collaboration',
67
- href: '/text-inputs/multi-author',
68
- icon: 'group'
69
63
  }
70
64
  ]
71
65
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bref-ui",
3
- "version": "0.1.7",
4
- "description": "A truly Svelte-esque UI component library - minimal, flexible, pure CSS, no Tailwind",
3
+ "version": "0.1.9",
4
+ "description": "A Svelte UI component library using scoped CSS - minimal and flexible",
5
5
  "license": "MIT",
6
6
  "author": "feuerstein",
7
7
  "repository": {