@geckoui/geckoui 1.0.0 → 1.1.0
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/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +12 -5
- package/dist/index.mjs +12 -5
- package/package.json +11 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 GeckoUI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -20,6 +20,18 @@ pnpm add @geckoui/geckoui
|
|
|
20
20
|
yarn add @geckoui/geckoui
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
## Install react-hook-form for form components
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install react-hook-form
|
|
27
|
+
|
|
28
|
+
# or
|
|
29
|
+
pnpm add react-hook-form
|
|
30
|
+
|
|
31
|
+
# or
|
|
32
|
+
yarn add react-hook-form
|
|
33
|
+
```
|
|
34
|
+
|
|
23
35
|
## Quick Start
|
|
24
36
|
|
|
25
37
|
### 1. Import Styles
|
package/dist/index.d.mts
CHANGED
|
@@ -2378,6 +2378,11 @@ interface BaseSelectProps extends PropsWithChildren, SelectButtonProps {
|
|
|
2378
2378
|
* If you pass `SelectEmpty` as children, this will set to true
|
|
2379
2379
|
* */
|
|
2380
2380
|
hideDefaultEmptyUI?: boolean;
|
|
2381
|
+
/**
|
|
2382
|
+
* If true, a clear button will be shown to clear the selected value
|
|
2383
|
+
* Default is false
|
|
2384
|
+
* */
|
|
2385
|
+
clearable?: boolean;
|
|
2381
2386
|
}
|
|
2382
2387
|
interface SingleSelectProps<T> extends BaseSelectProps {
|
|
2383
2388
|
/**
|
|
@@ -2510,6 +2515,10 @@ interface SelectContextProps<T> extends Pick<BaseSelectProps, "disabled" | "pref
|
|
|
2510
2515
|
* Used internally for scrolling focused options into view
|
|
2511
2516
|
* */
|
|
2512
2517
|
menuScrollContainerRef: RefObject<HTMLDivElement | null>;
|
|
2518
|
+
/**
|
|
2519
|
+
* Callback to be called when the value changes
|
|
2520
|
+
* */
|
|
2521
|
+
onChange?: (value: T | T[]) => void;
|
|
2513
2522
|
}
|
|
2514
2523
|
|
|
2515
2524
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2378,6 +2378,11 @@ interface BaseSelectProps extends PropsWithChildren, SelectButtonProps {
|
|
|
2378
2378
|
* If you pass `SelectEmpty` as children, this will set to true
|
|
2379
2379
|
* */
|
|
2380
2380
|
hideDefaultEmptyUI?: boolean;
|
|
2381
|
+
/**
|
|
2382
|
+
* If true, a clear button will be shown to clear the selected value
|
|
2383
|
+
* Default is false
|
|
2384
|
+
* */
|
|
2385
|
+
clearable?: boolean;
|
|
2381
2386
|
}
|
|
2382
2387
|
interface SingleSelectProps<T> extends BaseSelectProps {
|
|
2383
2388
|
/**
|
|
@@ -2510,6 +2515,10 @@ interface SelectContextProps<T> extends Pick<BaseSelectProps, "disabled" | "pref
|
|
|
2510
2515
|
* Used internally for scrolling focused options into view
|
|
2511
2516
|
* */
|
|
2512
2517
|
menuScrollContainerRef: RefObject<HTMLDivElement | null>;
|
|
2518
|
+
/**
|
|
2519
|
+
* Callback to be called when the value changes
|
|
2520
|
+
* */
|
|
2521
|
+
onChange?: (value: T | T[]) => void;
|
|
2513
2522
|
}
|
|
2514
2523
|
|
|
2515
2524
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4078,7 +4078,9 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
4078
4078
|
placeholder,
|
|
4079
4079
|
placeholderClassName,
|
|
4080
4080
|
children,
|
|
4081
|
-
handleChange
|
|
4081
|
+
handleChange,
|
|
4082
|
+
onChange,
|
|
4083
|
+
clearable
|
|
4082
4084
|
} = useSelect();
|
|
4083
4085
|
const id = (0, import_react29.useId)();
|
|
4084
4086
|
const { hasValue, handleInputChange, handleKeyboardInteraction } = useSelectTrigger();
|
|
@@ -4087,6 +4089,7 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
4087
4089
|
e.stopPropagation();
|
|
4088
4090
|
if (disabled) return;
|
|
4089
4091
|
if (multiple) {
|
|
4092
|
+
onChange == null ? void 0 : onChange([]);
|
|
4090
4093
|
return;
|
|
4091
4094
|
}
|
|
4092
4095
|
handleChange(void 0);
|
|
@@ -4170,7 +4173,7 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
4170
4173
|
)
|
|
4171
4174
|
] }),
|
|
4172
4175
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "GeckoUISelectButton__icons", children: [
|
|
4173
|
-
|
|
4176
|
+
hasValue && !disabled && clearable && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { className: "GeckoUISelectButton__clear-button", type: "button", onClick: handleClear, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "GeckoUI-icon__clear" }) }),
|
|
4174
4177
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4175
4178
|
DynamicComponentRenderer_default,
|
|
4176
4179
|
{
|
|
@@ -4434,7 +4437,8 @@ var Select = (props) => {
|
|
|
4434
4437
|
onChange,
|
|
4435
4438
|
closeMenuOnSelect = !multiple,
|
|
4436
4439
|
placement = "bottom-start",
|
|
4437
|
-
floatingStrategy
|
|
4440
|
+
floatingStrategy,
|
|
4441
|
+
clearable = false
|
|
4438
4442
|
} = _a, rest = __objRest(_a, [
|
|
4439
4443
|
"disabled",
|
|
4440
4444
|
"inputRef",
|
|
@@ -4446,7 +4450,8 @@ var Select = (props) => {
|
|
|
4446
4450
|
"onChange",
|
|
4447
4451
|
"closeMenuOnSelect",
|
|
4448
4452
|
"placement",
|
|
4449
|
-
"floatingStrategy"
|
|
4453
|
+
"floatingStrategy",
|
|
4454
|
+
"clearable"
|
|
4450
4455
|
]);
|
|
4451
4456
|
const [open, setOpen] = (0, import_react32.useState)(false);
|
|
4452
4457
|
const [keyword, setKeyword] = (0, import_react32.useState)("");
|
|
@@ -4537,7 +4542,9 @@ var Select = (props) => {
|
|
|
4537
4542
|
isEmpty,
|
|
4538
4543
|
children,
|
|
4539
4544
|
toggleMenu,
|
|
4540
|
-
menuScrollContainerRef
|
|
4545
|
+
menuScrollContainerRef,
|
|
4546
|
+
onChange,
|
|
4547
|
+
clearable
|
|
4541
4548
|
}, rest),
|
|
4542
4549
|
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
4543
4550
|
"div",
|
package/dist/index.mjs
CHANGED
|
@@ -3975,7 +3975,9 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
3975
3975
|
placeholder,
|
|
3976
3976
|
placeholderClassName,
|
|
3977
3977
|
children,
|
|
3978
|
-
handleChange
|
|
3978
|
+
handleChange,
|
|
3979
|
+
onChange,
|
|
3980
|
+
clearable
|
|
3979
3981
|
} = useSelect();
|
|
3980
3982
|
const id = useId5();
|
|
3981
3983
|
const { hasValue, handleInputChange, handleKeyboardInteraction } = useSelectTrigger();
|
|
@@ -3984,6 +3986,7 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
3984
3986
|
e.stopPropagation();
|
|
3985
3987
|
if (disabled) return;
|
|
3986
3988
|
if (multiple) {
|
|
3989
|
+
onChange == null ? void 0 : onChange([]);
|
|
3987
3990
|
return;
|
|
3988
3991
|
}
|
|
3989
3992
|
handleChange(void 0);
|
|
@@ -4067,7 +4070,7 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
4067
4070
|
)
|
|
4068
4071
|
] }),
|
|
4069
4072
|
/* @__PURE__ */ jsxs22("div", { className: "GeckoUISelectButton__icons", children: [
|
|
4070
|
-
|
|
4073
|
+
hasValue && !disabled && clearable && /* @__PURE__ */ jsx43("button", { className: "GeckoUISelectButton__clear-button", type: "button", onClick: handleClear, children: /* @__PURE__ */ jsx43("div", { className: "GeckoUI-icon__clear" }) }),
|
|
4071
4074
|
/* @__PURE__ */ jsx43(
|
|
4072
4075
|
DynamicComponentRenderer_default,
|
|
4073
4076
|
{
|
|
@@ -4331,7 +4334,8 @@ var Select = (props) => {
|
|
|
4331
4334
|
onChange,
|
|
4332
4335
|
closeMenuOnSelect = !multiple,
|
|
4333
4336
|
placement = "bottom-start",
|
|
4334
|
-
floatingStrategy
|
|
4337
|
+
floatingStrategy,
|
|
4338
|
+
clearable = false
|
|
4335
4339
|
} = _a, rest = __objRest(_a, [
|
|
4336
4340
|
"disabled",
|
|
4337
4341
|
"inputRef",
|
|
@@ -4343,7 +4347,8 @@ var Select = (props) => {
|
|
|
4343
4347
|
"onChange",
|
|
4344
4348
|
"closeMenuOnSelect",
|
|
4345
4349
|
"placement",
|
|
4346
|
-
"floatingStrategy"
|
|
4350
|
+
"floatingStrategy",
|
|
4351
|
+
"clearable"
|
|
4347
4352
|
]);
|
|
4348
4353
|
const [open, setOpen] = useState10(false);
|
|
4349
4354
|
const [keyword, setKeyword] = useState10("");
|
|
@@ -4434,7 +4439,9 @@ var Select = (props) => {
|
|
|
4434
4439
|
isEmpty,
|
|
4435
4440
|
children,
|
|
4436
4441
|
toggleMenu,
|
|
4437
|
-
menuScrollContainerRef
|
|
4442
|
+
menuScrollContainerRef,
|
|
4443
|
+
onChange,
|
|
4444
|
+
clearable
|
|
4438
4445
|
}, rest),
|
|
4439
4446
|
children: /* @__PURE__ */ jsxs24(
|
|
4440
4447
|
"div",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geckoui/geckoui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"**/*.css"
|
|
6
6
|
],
|
|
@@ -36,18 +36,8 @@
|
|
|
36
36
|
"access": "public",
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"import:css": "node scripts/import-css.js",
|
|
41
|
-
"build": "pnpm run import:css && tsup",
|
|
42
|
-
"dev": "pnpm run import:css && tsup --watch",
|
|
43
|
-
"lint": "eslint src/",
|
|
44
|
-
"typecheck": "tsc --noEmit",
|
|
45
|
-
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,scss}\"",
|
|
46
|
-
"prepublishOnly": "pnpm run build && cp ../../README.md ./README.md",
|
|
47
|
-
"postpublish": "rm ./README.md"
|
|
48
|
-
},
|
|
49
39
|
"peerDependencies": {
|
|
50
|
-
"react": "^19.2.
|
|
40
|
+
"react": "^19.2.1",
|
|
51
41
|
"react-dom": "^19.2.0"
|
|
52
42
|
},
|
|
53
43
|
"devDependencies": {
|
|
@@ -99,5 +89,13 @@
|
|
|
99
89
|
"sonner": "^2.0.7",
|
|
100
90
|
"tailwind-merge": "^2.6.0",
|
|
101
91
|
"unified": "^11.0.5"
|
|
92
|
+
},
|
|
93
|
+
"scripts": {
|
|
94
|
+
"import:css": "node scripts/import-css.js",
|
|
95
|
+
"build": "pnpm run import:css && tsup",
|
|
96
|
+
"dev": "pnpm run import:css && tsup --watch",
|
|
97
|
+
"lint": "eslint src/",
|
|
98
|
+
"typecheck": "tsc --noEmit",
|
|
99
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,scss}\""
|
|
102
100
|
}
|
|
103
|
-
}
|
|
101
|
+
}
|