zcomponents-ui 1.2.2 → 1.2.4

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,7 +1,5 @@
1
1
  # 📘 zComponents — Growing React Component Library
2
2
 
3
- **Lightweight, typed, customizable UI building blocks for React.**
4
-
5
3
  ![npm version](<https://img.shields.io/npm/v/zcomponents-ui?color=rgb(25,150,90)&style=flat-square>)
6
4
  ![npm downloads](https://img.shields.io/npm/dm/zcomponents-ui?color=blue&style=flat-square)
7
5
  ![license](https://img.shields.io/npm/l/zcomponents-ui?style=flat-square)
@@ -9,157 +7,100 @@
9
7
 
10
8
  ---
11
9
 
12
- # 🎯 ZDrop Dropdown / Select Component
13
-
14
- ### ✔ Flexible option model
15
-
16
- Support for `string`, `number`, and full `object` entries.
17
-
18
- ### ✔ Full control over rendering
19
-
20
- Perfect for tagging systems, chips, advanced UI states.
21
-
22
- ### ✔ Flexible behavior and layout adaptation
23
-
24
- Boundary detection, list height limit, smart direction switching.
25
-
26
- ### ✔ Custom search logic
27
-
28
- Inject your own filter function with full access to options.
10
+ **zComponents UI** is a lightweight React component library focused on **flexible dropdowns and selection components**, built with TypeScript and zero external dependencies.
29
11
 
30
- ---
31
-
32
- ## 🟩 Zero Dependencies
12
+ 👉 Full documentation and live examples are available in Storybook.
33
13
 
34
- `zcomponents-ui` is built with **zero external dependencies**.
14
+ 🔗 **Storybook:**
15
+ https://piotrnowoslawski.github.io/zComponents
35
16
 
36
17
  ---
37
18
 
38
- ## 📚 Storybook Documentation
19
+ ## Features
39
20
 
40
- All components in the **zComponents UI Library** come with interactive examples and full API documentation.
41
-
42
- 🔗 **Live Storybook:**
43
- https://piotrnowoslawski.github.io/zComponents
44
-
45
- The Storybook is deployed automatically from `main` using GitHub Pages.
21
+ - Written in **TypeScript**
22
+ - ✅ **Zero dependencies**
23
+ - SCSS Modules styling
24
+ - ✅ Type-safe APIs
25
+ - ✅ Designed for advanced UI use cases
26
+ - Interactive Storybook documentation
46
27
 
47
28
  ---
48
29
 
49
- # 🚀 Installation
30
+ ## 📦 Installation
50
31
 
51
32
  ```bash
52
- npm install zcomponents
33
+ npm install zcomponents-ui
34
+ # or
35
+ yarn add zcomponents-ui
36
+ # or
37
+ pnpm add zcomponents-ui
53
38
  ```
54
39
 
55
40
  ---
56
41
 
57
- # 📦 Quick Usage
58
-
59
- ```tsx
60
- import { ZDrop } from "zcomponents-ui";
42
+ ## 🎯 Components Overview
61
43
 
62
- const options = ["Hiroshi", "Harper", "Karl"];
44
+ ### ZDrop
63
45
 
64
- export default () => (
65
- <ZDrop
66
- name="survivor"
67
- options={options}
68
- placeholder="Pick someone"
69
- onChange={(val) => console.log(val)}
70
- />
71
- );
72
- ```
46
+ Advanced dropdown / select component with full control over behavior and rendering.
73
47
 
74
- ---
48
+ **What it does:**
75
49
 
76
- # 🔍 Search
50
+ - Single & multiple select
51
+ - Searchable options
52
+ - Supports primitive and object-based options
53
+ - Smart dropdown positioning (top / bottom)
54
+ - Automatic list height adjustment
55
+ - Custom renderers for options, values, and toggle
56
+ - Type-safe value handling
77
57
 
78
- ### Built-in search
79
-
80
- ```tsx
81
- isSearchable;
82
- ```
83
-
84
- ### Custom search
85
-
86
- ```tsx
87
- searchFilter={({ options, currentValue, labelKey }) =>
88
- options.filter((o) =>
89
- String(o[labelKey]).toLowerCase().includes(currentValue.toLowerCase())
90
- )
91
- }
92
- ```
58
+ 👉 Best for forms, filters, and complex selects.
93
59
 
94
60
  ---
95
61
 
96
- # 🧠 Object Options Example
62
+ ### ZDropButton
97
63
 
98
- ```tsx
99
- <ZDrop
100
- name="survivor"
101
- options={[{ id: 1, name: "Hiroshi" }]}
102
- valueKey="id" // default: "value"
103
- labelKey="name" // default: "label"
104
- shouldReturnObjectOnChange
105
- />
106
- ```
64
+ Button-based dropdown built with the **Compound Components** pattern.
107
65
 
108
- ---
66
+ **What it does:**
109
67
 
110
- # 🎨 Customize Everything
68
+ - Dropdown menu triggered by button
69
+ - Supports title and/or icon as toggle
70
+ - Custom dropdown content structure
71
+ - Optional search input
72
+ - Flexible content positioning
73
+ - List items as actions or links
74
+ - Fully controlled selection logic
111
75
 
112
- ```tsx
113
- optionRenderer={(option, isSelected) => (
114
- <div className={isSelected ? "selected" : ""}>{option}</div>
115
- )}
116
- ```
117
-
118
- ```tsx
119
- valueRenderer={({option, onRemove }) => (
120
- <span onClick={onRemove} style={{ marginRight: 8 }}>
121
- ❌ {option}
122
- </span>
123
- )};
124
- ```
76
+ 👉 Best for menus, navigation, and action selectors.
125
77
 
126
78
  ---
127
79
 
128
- # 📚 Props (Short)
80
+ ## 🎨 Styling
81
+
82
+ Default styles are provided as a single CSS file:
129
83
 
130
84
  ```ts
131
- valueKey?: string; // default: "value"
132
- labelKey?: string; // default: "label"
133
- isSearchable?: boolean;
134
- searchFilter?: SearchFilter;
135
- isMultiple?: boolean;
136
- isDisabled?: boolean;
137
- valueRenderer?: ValueRenderer;
138
- optionRenderer?: OptionRenderer;
139
- expandToggleRenderer?: ExpandToggleRenderer;
85
+ import "zcomponents-ui/styles.css";
140
86
  ```
141
87
 
142
- ---
143
-
144
- # 🔌 React Hook Form Integration (Short Note)
88
+ Styles are intentionally minimal and easy to override using:
145
89
 
146
- ## Features
90
+ - custom CSS
91
+ - SCSS Modules
92
+ - utility frameworks (e.g. Tailwind)
147
93
 
148
- - Full compatibility with rules, mode, reValidateMode
149
-
150
- - Works with Yup / Zod through RHF resolvers
151
-
152
- - Supports value mapping via
94
+ ---
153
95
 
154
- - onChangeTransform (ZDrop → RHF)
96
+ ## 📚 Documentation
155
97
 
156
- - valueSelector (RHF ZDrop)
98
+ Full API documentation, examples, and usage patterns are available in Storybook:
157
99
 
158
- - Customizable error rendering
100
+ 🔗 **https://piotrnowoslawski.github.io/zComponents**
159
101
 
160
- 📌 Use ZDropField when working with forms.
161
- 📌 Use ZDrop standalone for uncontrolled usage.
102
+ ---
162
103
 
163
- # 📄 License
104
+ ## 📄 License
164
105
 
165
106
  MIT © Piotr Nowosławski
@@ -83,7 +83,7 @@ interface ZDropWithReferenceElementProps extends ZDropBaseProps {
83
83
  interface ZDropWithAutoHeightProps extends ZDropBaseProps {
84
84
  referenceElementClassName?: never;
85
85
  positionToReferenceElement?: never;
86
- isAutoHeightEnabled?: boolean;
86
+ isAutoHeightEnabled?: true;
87
87
  autoHeightPosition?: "top" | "bottom";
88
88
  }
89
89
  type ZDropProps = ZDropWithReferenceElementProps | ZDropWithAutoHeightProps;
@@ -80,7 +80,7 @@ export interface ZDropWithReferenceElementProps extends ZDropBaseProps {
80
80
  export interface ZDropWithAutoHeightProps extends ZDropBaseProps {
81
81
  referenceElementClassName?: never;
82
82
  positionToReferenceElement?: never;
83
- isAutoHeightEnabled?: boolean;
83
+ isAutoHeightEnabled?: true;
84
84
  autoHeightPosition?: "top" | "bottom";
85
85
  }
86
86
  export type ZDropProps = ZDropWithReferenceElementProps | ZDropWithAutoHeightProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcomponents-ui",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Customizable React dropdown component (TypeScript + SCSS Modules).",
5
5
  "author": "Piotr Nowosławski",
6
6
  "license": "MIT",