@geckoui/geckoui 0.0.1-beta0 → 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 +25 -11
- package/dist/index.mjs +25 -11
- package/dist/styles.css +7 -9
- 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
|
@@ -376,11 +376,18 @@ var BaseFilePickerHandler = class {
|
|
|
376
376
|
newFile.editableName = newFile.name;
|
|
377
377
|
newFile.path || (newFile.path = path);
|
|
378
378
|
if (this.accept !== "*") {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
379
|
+
const acceptTypes = this.accept.split(",").map((t) => t.trim());
|
|
380
|
+
const valid = acceptTypes.some((acceptType) => {
|
|
381
|
+
if (acceptType.startsWith(".")) {
|
|
382
|
+
return newFile.name.toLowerCase().endsWith(acceptType.toLowerCase());
|
|
383
|
+
}
|
|
384
|
+
if (acceptType.endsWith("/*")) {
|
|
385
|
+
const baseType = acceptType.slice(0, -2);
|
|
386
|
+
return newFile.type.startsWith(baseType + "/");
|
|
387
|
+
}
|
|
388
|
+
return newFile.type === acceptType;
|
|
389
|
+
});
|
|
390
|
+
if (!valid) return data;
|
|
384
391
|
}
|
|
385
392
|
newFile.preview = URL.createObjectURL(newFile);
|
|
386
393
|
data.push(newFile);
|
|
@@ -499,7 +506,7 @@ var WebkitFilePickerHandler_default = WebkitFilePickerHandler;
|
|
|
499
506
|
var FileOnlyPickerHandler = class extends BaseFilePickerHandler_default {
|
|
500
507
|
onDrop(items) {
|
|
501
508
|
return __async(this, null, function* () {
|
|
502
|
-
const files = Array.from(items != null ? items : []).map((item) => item.getAsFile()).filter((file) => Boolean(file)
|
|
509
|
+
const files = Array.from(items != null ? items : []).map((item) => item.getAsFile()).filter((file) => Boolean(file));
|
|
503
510
|
const data = this.oldFiles;
|
|
504
511
|
for (const file of files) {
|
|
505
512
|
yield this.addFileIfValid(file, data);
|
|
@@ -4071,7 +4078,9 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
4071
4078
|
placeholder,
|
|
4072
4079
|
placeholderClassName,
|
|
4073
4080
|
children,
|
|
4074
|
-
handleChange
|
|
4081
|
+
handleChange,
|
|
4082
|
+
onChange,
|
|
4083
|
+
clearable
|
|
4075
4084
|
} = useSelect();
|
|
4076
4085
|
const id = (0, import_react29.useId)();
|
|
4077
4086
|
const { hasValue, handleInputChange, handleKeyboardInteraction } = useSelectTrigger();
|
|
@@ -4080,6 +4089,7 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
4080
4089
|
e.stopPropagation();
|
|
4081
4090
|
if (disabled) return;
|
|
4082
4091
|
if (multiple) {
|
|
4092
|
+
onChange == null ? void 0 : onChange([]);
|
|
4083
4093
|
return;
|
|
4084
4094
|
}
|
|
4085
4095
|
handleChange(void 0);
|
|
@@ -4163,7 +4173,7 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
4163
4173
|
)
|
|
4164
4174
|
] }),
|
|
4165
4175
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "GeckoUISelectButton__icons", children: [
|
|
4166
|
-
|
|
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" }) }),
|
|
4167
4177
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4168
4178
|
DynamicComponentRenderer_default,
|
|
4169
4179
|
{
|
|
@@ -4427,7 +4437,8 @@ var Select = (props) => {
|
|
|
4427
4437
|
onChange,
|
|
4428
4438
|
closeMenuOnSelect = !multiple,
|
|
4429
4439
|
placement = "bottom-start",
|
|
4430
|
-
floatingStrategy
|
|
4440
|
+
floatingStrategy,
|
|
4441
|
+
clearable = false
|
|
4431
4442
|
} = _a, rest = __objRest(_a, [
|
|
4432
4443
|
"disabled",
|
|
4433
4444
|
"inputRef",
|
|
@@ -4439,7 +4450,8 @@ var Select = (props) => {
|
|
|
4439
4450
|
"onChange",
|
|
4440
4451
|
"closeMenuOnSelect",
|
|
4441
4452
|
"placement",
|
|
4442
|
-
"floatingStrategy"
|
|
4453
|
+
"floatingStrategy",
|
|
4454
|
+
"clearable"
|
|
4443
4455
|
]);
|
|
4444
4456
|
const [open, setOpen] = (0, import_react32.useState)(false);
|
|
4445
4457
|
const [keyword, setKeyword] = (0, import_react32.useState)("");
|
|
@@ -4530,7 +4542,9 @@ var Select = (props) => {
|
|
|
4530
4542
|
isEmpty,
|
|
4531
4543
|
children,
|
|
4532
4544
|
toggleMenu,
|
|
4533
|
-
menuScrollContainerRef
|
|
4545
|
+
menuScrollContainerRef,
|
|
4546
|
+
onChange,
|
|
4547
|
+
clearable
|
|
4534
4548
|
}, rest),
|
|
4535
4549
|
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
4536
4550
|
"div",
|
package/dist/index.mjs
CHANGED
|
@@ -273,11 +273,18 @@ var BaseFilePickerHandler = class {
|
|
|
273
273
|
newFile.editableName = newFile.name;
|
|
274
274
|
newFile.path || (newFile.path = path);
|
|
275
275
|
if (this.accept !== "*") {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
276
|
+
const acceptTypes = this.accept.split(",").map((t) => t.trim());
|
|
277
|
+
const valid = acceptTypes.some((acceptType) => {
|
|
278
|
+
if (acceptType.startsWith(".")) {
|
|
279
|
+
return newFile.name.toLowerCase().endsWith(acceptType.toLowerCase());
|
|
280
|
+
}
|
|
281
|
+
if (acceptType.endsWith("/*")) {
|
|
282
|
+
const baseType = acceptType.slice(0, -2);
|
|
283
|
+
return newFile.type.startsWith(baseType + "/");
|
|
284
|
+
}
|
|
285
|
+
return newFile.type === acceptType;
|
|
286
|
+
});
|
|
287
|
+
if (!valid) return data;
|
|
281
288
|
}
|
|
282
289
|
newFile.preview = URL.createObjectURL(newFile);
|
|
283
290
|
data.push(newFile);
|
|
@@ -396,7 +403,7 @@ var WebkitFilePickerHandler_default = WebkitFilePickerHandler;
|
|
|
396
403
|
var FileOnlyPickerHandler = class extends BaseFilePickerHandler_default {
|
|
397
404
|
onDrop(items) {
|
|
398
405
|
return __async(this, null, function* () {
|
|
399
|
-
const files = Array.from(items != null ? items : []).map((item) => item.getAsFile()).filter((file) => Boolean(file)
|
|
406
|
+
const files = Array.from(items != null ? items : []).map((item) => item.getAsFile()).filter((file) => Boolean(file));
|
|
400
407
|
const data = this.oldFiles;
|
|
401
408
|
for (const file of files) {
|
|
402
409
|
yield this.addFileIfValid(file, data);
|
|
@@ -3968,7 +3975,9 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
3968
3975
|
placeholder,
|
|
3969
3976
|
placeholderClassName,
|
|
3970
3977
|
children,
|
|
3971
|
-
handleChange
|
|
3978
|
+
handleChange,
|
|
3979
|
+
onChange,
|
|
3980
|
+
clearable
|
|
3972
3981
|
} = useSelect();
|
|
3973
3982
|
const id = useId5();
|
|
3974
3983
|
const { hasValue, handleInputChange, handleKeyboardInteraction } = useSelectTrigger();
|
|
@@ -3977,6 +3986,7 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
3977
3986
|
e.stopPropagation();
|
|
3978
3987
|
if (disabled) return;
|
|
3979
3988
|
if (multiple) {
|
|
3989
|
+
onChange == null ? void 0 : onChange([]);
|
|
3980
3990
|
return;
|
|
3981
3991
|
}
|
|
3982
3992
|
handleChange(void 0);
|
|
@@ -4060,7 +4070,7 @@ function SelectButton({ prefix, suffix, className }) {
|
|
|
4060
4070
|
)
|
|
4061
4071
|
] }),
|
|
4062
4072
|
/* @__PURE__ */ jsxs22("div", { className: "GeckoUISelectButton__icons", children: [
|
|
4063
|
-
|
|
4073
|
+
hasValue && !disabled && clearable && /* @__PURE__ */ jsx43("button", { className: "GeckoUISelectButton__clear-button", type: "button", onClick: handleClear, children: /* @__PURE__ */ jsx43("div", { className: "GeckoUI-icon__clear" }) }),
|
|
4064
4074
|
/* @__PURE__ */ jsx43(
|
|
4065
4075
|
DynamicComponentRenderer_default,
|
|
4066
4076
|
{
|
|
@@ -4324,7 +4334,8 @@ var Select = (props) => {
|
|
|
4324
4334
|
onChange,
|
|
4325
4335
|
closeMenuOnSelect = !multiple,
|
|
4326
4336
|
placement = "bottom-start",
|
|
4327
|
-
floatingStrategy
|
|
4337
|
+
floatingStrategy,
|
|
4338
|
+
clearable = false
|
|
4328
4339
|
} = _a, rest = __objRest(_a, [
|
|
4329
4340
|
"disabled",
|
|
4330
4341
|
"inputRef",
|
|
@@ -4336,7 +4347,8 @@ var Select = (props) => {
|
|
|
4336
4347
|
"onChange",
|
|
4337
4348
|
"closeMenuOnSelect",
|
|
4338
4349
|
"placement",
|
|
4339
|
-
"floatingStrategy"
|
|
4350
|
+
"floatingStrategy",
|
|
4351
|
+
"clearable"
|
|
4340
4352
|
]);
|
|
4341
4353
|
const [open, setOpen] = useState10(false);
|
|
4342
4354
|
const [keyword, setKeyword] = useState10("");
|
|
@@ -4427,7 +4439,9 @@ var Select = (props) => {
|
|
|
4427
4439
|
isEmpty,
|
|
4428
4440
|
children,
|
|
4429
4441
|
toggleMenu,
|
|
4430
|
-
menuScrollContainerRef
|
|
4442
|
+
menuScrollContainerRef,
|
|
4443
|
+
onChange,
|
|
4444
|
+
clearable
|
|
4431
4445
|
}, rest),
|
|
4432
4446
|
children: /* @__PURE__ */ jsxs24(
|
|
4433
4447
|
"div",
|
package/dist/styles.css
CHANGED
|
@@ -2190,15 +2190,13 @@
|
|
|
2190
2190
|
background: rgb(var(--gecko-ui-scrollbar-thumb-hover));
|
|
2191
2191
|
}
|
|
2192
2192
|
.GeckoUISelectMenu__items {
|
|
2193
|
-
scrollbar-gutter: stable;
|
|
2193
|
+
scrollbar-gutter: stable overlay;
|
|
2194
2194
|
display: flex;
|
|
2195
2195
|
flex-direction: column;
|
|
2196
2196
|
gap: 1px;
|
|
2197
2197
|
overflow-y: auto;
|
|
2198
2198
|
overscroll-behavior: contain;
|
|
2199
|
-
padding
|
|
2200
|
-
padding-bottom: 0.5rem;
|
|
2201
|
-
padding-left: 0.5rem;
|
|
2199
|
+
padding: 0.5rem;
|
|
2202
2200
|
}
|
|
2203
2201
|
.GeckoUISelectMenu--with-dropdown-search {
|
|
2204
2202
|
max-height: 260px;
|
|
@@ -3237,7 +3235,7 @@
|
|
|
3237
3235
|
--gecko-ui-border-focus: 163 163 163;
|
|
3238
3236
|
--gecko-ui-border-hover: 212 212 212;
|
|
3239
3237
|
--gecko-ui-border-disabled: 235 235 235;
|
|
3240
|
-
--gecko-ui-scrollbar-track: 0 0 0
|
|
3238
|
+
--gecko-ui-scrollbar-track: 0 0 0;
|
|
3241
3239
|
--gecko-ui-scrollbar-thumb: 209 213 219;
|
|
3242
3240
|
--gecko-ui-scrollbar-thumb-hover: 156 163 175;
|
|
3243
3241
|
}
|
|
@@ -3258,12 +3256,12 @@
|
|
|
3258
3256
|
--gecko-ui-text-placeholder: 115 115 115;
|
|
3259
3257
|
--gecko-ui-text-inverse: 23 23 23;
|
|
3260
3258
|
--gecko-ui-text-muted: 163 163 163;
|
|
3261
|
-
--gecko-ui-border-primary:
|
|
3262
|
-
--gecko-ui-border-secondary:
|
|
3259
|
+
--gecko-ui-border-primary: 90 90 90;
|
|
3260
|
+
--gecko-ui-border-secondary: 90 90 90;
|
|
3263
3261
|
--gecko-ui-border-focus: 115 115 115;
|
|
3264
3262
|
--gecko-ui-border-hover: 163 163 163;
|
|
3265
|
-
--gecko-ui-border-disabled:
|
|
3266
|
-
--gecko-ui-scrollbar-track: 0 0 0
|
|
3263
|
+
--gecko-ui-border-disabled: 45 45 45;
|
|
3264
|
+
--gecko-ui-scrollbar-track: 0 0 0;
|
|
3267
3265
|
--gecko-ui-scrollbar-thumb: 75 85 99;
|
|
3268
3266
|
--gecko-ui-scrollbar-thumb-hover: 107 114 128;
|
|
3269
3267
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geckoui/geckoui",
|
|
3
|
-
"version": "
|
|
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
|
+
}
|