@grandbazar/ui-baza 1.2.5 → 1.2.7
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/dist/index.cjs +24 -11
- package/dist/index.d.ts +5 -6
- package/dist/index.js +24 -11
- package/dist/style.css +19 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,6 +45,12 @@ function createRange(start, length) {
|
|
|
45
45
|
return Array.from({ length }, (_, index) => start + index);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
function omit(object, ...keys) {
|
|
49
|
+
const omitKeys = new Set(keys.map((key) => key.trim()).filter(Boolean));
|
|
50
|
+
const filteredEntries = Object.entries(object).filter(([key]) => !omitKeys.has(key));
|
|
51
|
+
return Object.fromEntries(filteredEntries);
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
const badge = "_badge_p5h5n_2";
|
|
49
55
|
const primary$3 = "_primary_p5h5n_9";
|
|
50
56
|
const secondary$4 = "_secondary_p5h5n_13";
|
|
@@ -2316,10 +2322,10 @@ function RadioButton({ className, label, ...props }) {
|
|
|
2316
2322
|
|
|
2317
2323
|
const DEFAULT_CUSTOM_SEARCH_BUTTON_WIDTH = 64;
|
|
2318
2324
|
|
|
2319
|
-
const textFieldAreaWrapper = "
|
|
2320
|
-
const textFieldAreaLabel = "
|
|
2321
|
-
const textFieldAreaLabelSuffix = "
|
|
2322
|
-
const textFieldArea = "
|
|
2325
|
+
const textFieldAreaWrapper = "_textFieldAreaWrapper_ry59j_2";
|
|
2326
|
+
const textFieldAreaLabel = "_textFieldAreaLabel_ry59j_15";
|
|
2327
|
+
const textFieldAreaLabelSuffix = "_textFieldAreaLabelSuffix_ry59j_25";
|
|
2328
|
+
const textFieldArea = "_textFieldArea_ry59j_2";
|
|
2323
2329
|
const styles$b = {
|
|
2324
2330
|
textFieldAreaWrapper: textFieldAreaWrapper,
|
|
2325
2331
|
textFieldAreaLabel: textFieldAreaLabel,
|
|
@@ -2353,9 +2359,9 @@ function TextFieldArea({
|
|
|
2353
2359
|
] }) : textFieldArea;
|
|
2354
2360
|
}
|
|
2355
2361
|
|
|
2356
|
-
const textFieldInputWrapper = "
|
|
2357
|
-
const textFieldInputLabel = "
|
|
2358
|
-
const textFieldInput = "
|
|
2362
|
+
const textFieldInputWrapper = "_textFieldInputWrapper_1pc8k_2";
|
|
2363
|
+
const textFieldInputLabel = "_textFieldInputLabel_1pc8k_10";
|
|
2364
|
+
const textFieldInput = "_textFieldInput_1pc8k_2";
|
|
2359
2365
|
const styles$a = {
|
|
2360
2366
|
textFieldInputWrapper: textFieldInputWrapper,
|
|
2361
2367
|
textFieldInputLabel: textFieldInputLabel,
|
|
@@ -2431,14 +2437,15 @@ const styles$7 = {
|
|
|
2431
2437
|
|
|
2432
2438
|
function Search(props) {
|
|
2433
2439
|
const searchId = React.useId();
|
|
2434
|
-
const { onChange, value, className,
|
|
2440
|
+
const { onChange, value, className, mode, onReset, ...inputProps } = props;
|
|
2441
|
+
const sanitizedInputProps = omit(inputProps, "buttonWidth", "onSearch");
|
|
2435
2442
|
const inputField = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2436
2443
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2437
2444
|
TextField.Input,
|
|
2438
2445
|
{
|
|
2439
|
-
|
|
2446
|
+
...sanitizedInputProps,
|
|
2440
2447
|
value,
|
|
2441
|
-
onChange: (e) => onChange
|
|
2448
|
+
onChange: (e) => onChange(e.target.value),
|
|
2442
2449
|
id: `search-input-${searchId}`
|
|
2443
2450
|
}
|
|
2444
2451
|
),
|
|
@@ -2448,7 +2455,13 @@ function Search(props) {
|
|
|
2448
2455
|
className: styles$7.icon,
|
|
2449
2456
|
"aria-label": "clear search",
|
|
2450
2457
|
role: "button",
|
|
2451
|
-
onClick: () =>
|
|
2458
|
+
onClick: () => {
|
|
2459
|
+
if (onReset) {
|
|
2460
|
+
onReset();
|
|
2461
|
+
} else {
|
|
2462
|
+
onChange("");
|
|
2463
|
+
}
|
|
2464
|
+
},
|
|
2452
2465
|
"data-element": "icon"
|
|
2453
2466
|
}
|
|
2454
2467
|
)
|
package/dist/index.d.ts
CHANGED
|
@@ -458,14 +458,14 @@ export declare function RadioButton({ className, label, ...props }: TRadioButton
|
|
|
458
458
|
|
|
459
459
|
/**
|
|
460
460
|
* Search renders a search input field with icon and clear button.
|
|
461
|
-
* Supports
|
|
461
|
+
* Supports TextField.Input props and two modes: default and custom.
|
|
462
462
|
*
|
|
463
463
|
* @param value - Current search query value
|
|
464
464
|
* @param onChange - Callback fired when input value changes
|
|
465
|
-
* @param
|
|
465
|
+
* @param onReset - Optional callback fired when clear button is clicked
|
|
466
466
|
* @param mode - Display mode: 'default' (inline icon) or 'custom' (separate search button)
|
|
467
467
|
* @param onSearch - (only for mode='custom') Callback fired when search button is clicked
|
|
468
|
-
* @param
|
|
468
|
+
* @param buttonWidth - (only for mode='custom') Width of the search button in pixels
|
|
469
469
|
*/
|
|
470
470
|
export declare function Search(props: TSearchProps): JSX.Element;
|
|
471
471
|
|
|
@@ -783,11 +783,10 @@ declare type TRadioButtonProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
783
783
|
ref?: React.RefObject<HTMLInputElement | null>;
|
|
784
784
|
};
|
|
785
785
|
|
|
786
|
-
declare type TSearchBaseProps = {
|
|
786
|
+
declare type TSearchBaseProps = Omit<ComponentProps<typeof TextField.Input>, 'value' | 'onChange' | 'id'> & {
|
|
787
787
|
value: string;
|
|
788
788
|
onChange: (value: string) => void;
|
|
789
|
-
|
|
790
|
-
className?: string;
|
|
789
|
+
onReset?: VoidFunction;
|
|
791
790
|
};
|
|
792
791
|
|
|
793
792
|
declare type TSearchCustomProps = TSearchBaseProps & {
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,12 @@ function createRange(start, length) {
|
|
|
41
41
|
return Array.from({ length }, (_, index) => start + index);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
function omit(object, ...keys) {
|
|
45
|
+
const omitKeys = new Set(keys.map((key) => key.trim()).filter(Boolean));
|
|
46
|
+
const filteredEntries = Object.entries(object).filter(([key]) => !omitKeys.has(key));
|
|
47
|
+
return Object.fromEntries(filteredEntries);
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
const badge = "_badge_p5h5n_2";
|
|
45
51
|
const primary$3 = "_primary_p5h5n_9";
|
|
46
52
|
const secondary$4 = "_secondary_p5h5n_13";
|
|
@@ -2312,10 +2318,10 @@ function RadioButton({ className, label, ...props }) {
|
|
|
2312
2318
|
|
|
2313
2319
|
const DEFAULT_CUSTOM_SEARCH_BUTTON_WIDTH = 64;
|
|
2314
2320
|
|
|
2315
|
-
const textFieldAreaWrapper = "
|
|
2316
|
-
const textFieldAreaLabel = "
|
|
2317
|
-
const textFieldAreaLabelSuffix = "
|
|
2318
|
-
const textFieldArea = "
|
|
2321
|
+
const textFieldAreaWrapper = "_textFieldAreaWrapper_ry59j_2";
|
|
2322
|
+
const textFieldAreaLabel = "_textFieldAreaLabel_ry59j_15";
|
|
2323
|
+
const textFieldAreaLabelSuffix = "_textFieldAreaLabelSuffix_ry59j_25";
|
|
2324
|
+
const textFieldArea = "_textFieldArea_ry59j_2";
|
|
2319
2325
|
const styles$b = {
|
|
2320
2326
|
textFieldAreaWrapper: textFieldAreaWrapper,
|
|
2321
2327
|
textFieldAreaLabel: textFieldAreaLabel,
|
|
@@ -2349,9 +2355,9 @@ function TextFieldArea({
|
|
|
2349
2355
|
] }) : textFieldArea;
|
|
2350
2356
|
}
|
|
2351
2357
|
|
|
2352
|
-
const textFieldInputWrapper = "
|
|
2353
|
-
const textFieldInputLabel = "
|
|
2354
|
-
const textFieldInput = "
|
|
2358
|
+
const textFieldInputWrapper = "_textFieldInputWrapper_1pc8k_2";
|
|
2359
|
+
const textFieldInputLabel = "_textFieldInputLabel_1pc8k_10";
|
|
2360
|
+
const textFieldInput = "_textFieldInput_1pc8k_2";
|
|
2355
2361
|
const styles$a = {
|
|
2356
2362
|
textFieldInputWrapper: textFieldInputWrapper,
|
|
2357
2363
|
textFieldInputLabel: textFieldInputLabel,
|
|
@@ -2427,14 +2433,15 @@ const styles$7 = {
|
|
|
2427
2433
|
|
|
2428
2434
|
function Search(props) {
|
|
2429
2435
|
const searchId = useId();
|
|
2430
|
-
const { onChange, value, className,
|
|
2436
|
+
const { onChange, value, className, mode, onReset, ...inputProps } = props;
|
|
2437
|
+
const sanitizedInputProps = omit(inputProps, "buttonWidth", "onSearch");
|
|
2431
2438
|
const inputField = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2432
2439
|
/* @__PURE__ */ jsx(
|
|
2433
2440
|
TextField.Input,
|
|
2434
2441
|
{
|
|
2435
|
-
|
|
2442
|
+
...sanitizedInputProps,
|
|
2436
2443
|
value,
|
|
2437
|
-
onChange: (e) => onChange
|
|
2444
|
+
onChange: (e) => onChange(e.target.value),
|
|
2438
2445
|
id: `search-input-${searchId}`
|
|
2439
2446
|
}
|
|
2440
2447
|
),
|
|
@@ -2444,7 +2451,13 @@ function Search(props) {
|
|
|
2444
2451
|
className: styles$7.icon,
|
|
2445
2452
|
"aria-label": "clear search",
|
|
2446
2453
|
role: "button",
|
|
2447
|
-
onClick: () =>
|
|
2454
|
+
onClick: () => {
|
|
2455
|
+
if (onReset) {
|
|
2456
|
+
onReset();
|
|
2457
|
+
} else {
|
|
2458
|
+
onChange("");
|
|
2459
|
+
}
|
|
2460
|
+
},
|
|
2448
2461
|
"data-element": "icon"
|
|
2449
2462
|
}
|
|
2450
2463
|
)
|
package/dist/style.css
CHANGED
|
@@ -1306,7 +1306,7 @@ textarea {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
}
|
|
1308
1308
|
@layer ui_baza_components {
|
|
1309
|
-
.
|
|
1309
|
+
._textFieldAreaWrapper_ry59j_2 {
|
|
1310
1310
|
display: flex;
|
|
1311
1311
|
position: relative;
|
|
1312
1312
|
flex-grow: 1;
|
|
@@ -1319,31 +1319,35 @@ textarea {
|
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
1321
|
|
|
1322
|
-
.
|
|
1323
|
-
z-index:
|
|
1322
|
+
._textFieldAreaLabel_ry59j_15 {
|
|
1323
|
+
z-index: 0;
|
|
1324
1324
|
position: absolute;
|
|
1325
1325
|
left: 0;
|
|
1326
1326
|
transform-origin: left;
|
|
1327
1327
|
color: var(--color-neutral-540);
|
|
1328
|
+
pointer-events: none;
|
|
1328
1329
|
transition: inherit;
|
|
1329
1330
|
}
|
|
1330
1331
|
|
|
1331
|
-
.
|
|
1332
|
-
z-index:
|
|
1332
|
+
._textFieldAreaLabelSuffix_ry59j_25 {
|
|
1333
|
+
z-index: 0;
|
|
1333
1334
|
position: absolute;
|
|
1334
1335
|
right: 0;
|
|
1335
1336
|
transform-origin: right;
|
|
1336
1337
|
color: var(--color-neutral-540);
|
|
1337
1338
|
font-variant-numeric: tabular-nums;
|
|
1339
|
+
pointer-events: none;
|
|
1338
1340
|
transition: inherit;
|
|
1339
1341
|
}
|
|
1340
1342
|
|
|
1341
|
-
.
|
|
1343
|
+
._textFieldAreaWrapper_ry59j_2:has(._textFieldArea_ry59j_2:disabled) ._textFieldAreaLabel_ry59j_15 {
|
|
1342
1344
|
color: var(--color-neutral-340);
|
|
1343
1345
|
}
|
|
1344
1346
|
|
|
1345
|
-
.
|
|
1347
|
+
._textFieldArea_ry59j_2 {
|
|
1346
1348
|
--text-area-min-height: 80px;
|
|
1349
|
+
z-index: 1;
|
|
1350
|
+
position: relative;
|
|
1347
1351
|
|
|
1348
1352
|
flex-grow: 1;
|
|
1349
1353
|
min-height: var(--text-area-min-height);
|
|
@@ -1365,7 +1369,7 @@ textarea {
|
|
|
1365
1369
|
}
|
|
1366
1370
|
}
|
|
1367
1371
|
@layer ui_baza_components {
|
|
1368
|
-
.
|
|
1372
|
+
._textFieldInputWrapper_1pc8k_2 {
|
|
1369
1373
|
display: flex;
|
|
1370
1374
|
position: relative;
|
|
1371
1375
|
flex-grow: 1;
|
|
@@ -1373,20 +1377,23 @@ textarea {
|
|
|
1373
1377
|
transition: inherit;
|
|
1374
1378
|
}
|
|
1375
1379
|
|
|
1376
|
-
.
|
|
1377
|
-
z-index:
|
|
1380
|
+
._textFieldInputLabel_1pc8k_10 {
|
|
1381
|
+
z-index: 0;
|
|
1378
1382
|
position: absolute;
|
|
1379
1383
|
left: 0;
|
|
1380
1384
|
transform-origin: left;
|
|
1381
1385
|
color: var(--color-neutral-540);
|
|
1386
|
+
pointer-events: none;
|
|
1382
1387
|
transition: inherit;
|
|
1383
1388
|
}
|
|
1384
1389
|
|
|
1385
|
-
.
|
|
1390
|
+
._textFieldInputWrapper_1pc8k_2:has(._textFieldInput_1pc8k_2:disabled) ._textFieldInputLabel_1pc8k_10 {
|
|
1386
1391
|
color: var(--color-neutral-340);
|
|
1387
1392
|
}
|
|
1388
1393
|
|
|
1389
|
-
.
|
|
1394
|
+
._textFieldInput_1pc8k_2 {
|
|
1395
|
+
z-index: 1;
|
|
1396
|
+
position: relative;
|
|
1390
1397
|
flex-grow: 1;
|
|
1391
1398
|
color: var(--color-neutral);
|
|
1392
1399
|
caret-color: var(--color-accent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grandbazar/ui-baza",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "A lightweight and modular UI kit for building modern, accessible web interfaces. Designed for flexibility, scalability, and developer happiness.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|