@ikatec/nebula-react 0.0.1-alpha.21 → 0.0.1-alpha.23

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.d.mts CHANGED
@@ -248,21 +248,22 @@ declare const Tag: React$1.ForwardRefExoticComponent<TagProps & React$1.RefAttri
248
248
  interface CreateStyledSelectProps extends Omit<Props, 'isDisabled'> {
249
249
  icon?: React.ReactNode;
250
250
  disabled?: boolean;
251
+ isError?: boolean;
251
252
  }
252
253
  declare const StyledSelect: {
253
- ({ icon, disabled, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
254
+ ({ icon, disabled, isError, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
254
255
  displayName: string;
255
256
  };
256
257
  declare const StyledCreatable: {
257
- ({ icon, disabled, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
258
+ ({ icon, disabled, isError, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
258
259
  displayName: string;
259
260
  };
260
261
  declare const StyledAsync: {
261
- ({ icon, disabled, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
262
+ ({ icon, disabled, isError, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
262
263
  displayName: string;
263
264
  };
264
265
  declare const StyledAsyncCreatable: {
265
- ({ icon, disabled, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
266
+ ({ icon, disabled, isError, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
266
267
  displayName: string;
267
268
  };
268
269
 
package/dist/index.d.ts CHANGED
@@ -248,21 +248,22 @@ declare const Tag: React$1.ForwardRefExoticComponent<TagProps & React$1.RefAttri
248
248
  interface CreateStyledSelectProps extends Omit<Props, 'isDisabled'> {
249
249
  icon?: React.ReactNode;
250
250
  disabled?: boolean;
251
+ isError?: boolean;
251
252
  }
252
253
  declare const StyledSelect: {
253
- ({ icon, disabled, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
254
+ ({ icon, disabled, isError, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
254
255
  displayName: string;
255
256
  };
256
257
  declare const StyledCreatable: {
257
- ({ icon, disabled, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
258
+ ({ icon, disabled, isError, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
258
259
  displayName: string;
259
260
  };
260
261
  declare const StyledAsync: {
261
- ({ icon, disabled, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
262
+ ({ icon, disabled, isError, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
262
263
  displayName: string;
263
264
  };
264
265
  declare const StyledAsyncCreatable: {
265
- ({ icon, disabled, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
266
+ ({ icon, disabled, isError, ...props }: CreateStyledSelectProps): react_jsx_runtime.JSX.Element;
266
267
  displayName: string;
267
268
  };
268
269
 
package/dist/index.js CHANGED
@@ -1378,7 +1378,14 @@ var Tag = React8__namespace.forwardRef(
1378
1378
  );
1379
1379
  Tag.displayName = "Tag";
1380
1380
  var DropdownIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: "16px" }) });
1381
- var ClearIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(X, { size: "16px" }) });
1381
+ var ClearIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(
1382
+ Select.components.ClearIndicator,
1383
+ {
1384
+ ...props,
1385
+ className: cn(props.className, "cursor-pointer"),
1386
+ children: /* @__PURE__ */ jsxRuntime.jsx(X, { size: "16px" })
1387
+ }
1388
+ );
1382
1389
  var MultiValueRemove = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.MultiValueRemove, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(CircleX, { size: "16px" }) });
1383
1390
  var Option = (props) => {
1384
1391
  const { isSelected, data, innerRef, innerProps } = props;
@@ -1398,13 +1405,11 @@ var Option = (props) => {
1398
1405
  hover:text-inputSelect-focus-text
1399
1406
  hover:bg-listItem-background-hover
1400
1407
  bg-listItem-background-default
1401
- `,
1402
- isSelected ? `
1403
- text-inputSelect-focus-text
1404
- font-semibold
1405
- bg-listItem-background-hover` : `
1406
1408
  text-inputSelect-default-text
1407
- `
1409
+ `,
1410
+ {
1411
+ "text-inputSelect-focus-text font-semibold bg-listItem-background-hover": isSelected
1412
+ }
1408
1413
  ),
1409
1414
  children: [
1410
1415
  isSelected && /* @__PURE__ */ jsxRuntime.jsx(Check, { size: "16px" }),
@@ -1413,71 +1418,84 @@ var Option = (props) => {
1413
1418
  }
1414
1419
  );
1415
1420
  };
1416
- var controlStyles = (state) => cn([
1417
- `
1418
- border
1419
- bg-inputSelect-default-background
1420
- rounded-[20px]
1421
- px-4
1422
- w-full
1423
- min-h-10
1424
- transition
1425
- `,
1426
- {
1427
- "border-inputSelect-focus-border text-inputSelect-focus-text ring-[3px] ring-inputSelect-focus-border": state.isFocused,
1428
- "border-inputSelect-default-border text-inputSelect-default-text": !state.isFocused,
1429
- "bg-inputText-background-disabled": state.isDisabled
1430
- }
1431
- ]);
1421
+ var controlStyles = ({ isDisabled, isFocused }, isError) => {
1422
+ return cn(
1423
+ "flex w-full items-center border bg-inputSelect-default-background rounded-[20px] px-4 min-h-10 transition",
1424
+ {
1425
+ "ring-[3px] border-inputSelect-focus-border text-inputSelect-focus-text ring-inputSelect-focus-border": isFocused,
1426
+ "border-inputSelect-danger-border text-inputSelect-danger-icon": isError,
1427
+ "border-inputSelect-default-border text-inputSelect-default-text": !isFocused && !isError,
1428
+ "bg-inputText-background-disabled": isDisabled,
1429
+ "ring-button-danger-border-focus": isError && isFocused
1430
+ }
1431
+ );
1432
+ };
1432
1433
  var placeholderStyles = "text-inputSelect-default-text text-sm";
1433
1434
  var selectInputStyles = "p-0";
1434
1435
  var valueContainerStyles = "gap-1";
1435
1436
  var singleValueStyles = "text-inputSelect-active-text text-sm";
1436
- var multiValueStyles = "border rounded-full items-center px-2 py-0.2 gap-1.5 text-xs border-inputSelect-default-border";
1437
- var multiValueLabelStyles = "leading-6 px-2 py-0.2";
1437
+ var multiValueStyles = "border rounded-full items-center gap-1.5 text-xs border-inputSelect-default-border h-6 px-2";
1438
+ var multiValueLabelStyles = "";
1438
1439
  var indicatorsContainerStyles = "";
1439
1440
  var clearIndicatorStyles = "text-inputSelect-default-icon mr-2";
1440
1441
  var dropdownIndicatorStyles = "text-inputSelect-default-icon";
1441
- var menuStyles = "mt-2 border bg-inputSelect-default-background rounded-2xl overflow-hidden shadow-md shadow-dropdownMenu-shadow";
1442
+ var menuStyles = "mt-2 z-[1000] rounded-2xl border border-dropdownMenu-border bg-dropdownMenu-background shadow-dropdownMenu-shadow shadow-sm outline-none overflow-hidden";
1442
1443
  var groupHeadingStyles = "ml-3 mt-2 mb-1 text-inputSelect-default-text text-sm";
1443
1444
  var noOptionsMessageStyles = "p-2 text-inputSelect-default-text";
1444
1445
  var createStyledSelect = (BaseSelect, displayName) => {
1445
1446
  const StyledSelect2 = ({
1446
1447
  icon,
1447
1448
  disabled = false,
1449
+ isError = false,
1448
1450
  ...props
1449
1451
  }) => {
1450
1452
  const { messages: messages8 } = useNebulaI18n();
1453
+ const customClassNames = React8.useMemo(() => {
1454
+ return {
1455
+ control: (props2) => controlStyles(props2, isError),
1456
+ placeholder: () => placeholderStyles,
1457
+ input: () => selectInputStyles,
1458
+ valueContainer: () => valueContainerStyles,
1459
+ singleValue: () => singleValueStyles,
1460
+ multiValue: () => multiValueStyles,
1461
+ multiValueLabel: () => multiValueLabelStyles,
1462
+ indicatorsContainer: () => indicatorsContainerStyles,
1463
+ clearIndicator: () => clearIndicatorStyles,
1464
+ dropdownIndicator: () => dropdownIndicatorStyles,
1465
+ menu: () => menuStyles,
1466
+ groupHeading: () => groupHeadingStyles,
1467
+ noOptionsMessage: () => noOptionsMessageStyles
1468
+ };
1469
+ }, [isError]);
1470
+ const customComponents = React8.useMemo(
1471
+ () => ({
1472
+ DropdownIndicator,
1473
+ ClearIndicator,
1474
+ MultiValueRemove,
1475
+ Option,
1476
+ Control: ({ children, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.Control, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nebula-ds flex w-full items-center", children: [
1477
+ icon && /* @__PURE__ */ jsxRuntime.jsx(
1478
+ "span",
1479
+ {
1480
+ className: cn("mr-2", {
1481
+ "text-inputSelect-default-icon": !isError,
1482
+ "text-inputSelect-danger-icon": isError
1483
+ }),
1484
+ children: icon
1485
+ }
1486
+ ),
1487
+ children
1488
+ ] }) })
1489
+ }),
1490
+ [icon, isError]
1491
+ );
1451
1492
  return /* @__PURE__ */ jsxRuntime.jsx(
1452
1493
  BaseSelect,
1453
1494
  {
1454
1495
  unstyled: true,
1455
1496
  isDisabled: disabled,
1456
- components: {
1457
- DropdownIndicator,
1458
- ClearIndicator,
1459
- MultiValueRemove,
1460
- Option,
1461
- Control: ({ children, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.Control, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nebula-ds flex w-full items-center", children: [
1462
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nebula-ds text-inputSelect-default-icon pr-2", children: icon }),
1463
- children
1464
- ] }) })
1465
- },
1466
- classNames: {
1467
- control: (state) => cn(controlStyles(state)),
1468
- placeholder: () => placeholderStyles,
1469
- input: () => selectInputStyles,
1470
- valueContainer: () => valueContainerStyles,
1471
- singleValue: () => singleValueStyles,
1472
- multiValue: () => multiValueStyles,
1473
- multiValueLabel: () => multiValueLabelStyles,
1474
- indicatorsContainer: () => indicatorsContainerStyles,
1475
- clearIndicator: () => clearIndicatorStyles,
1476
- dropdownIndicator: () => dropdownIndicatorStyles,
1477
- menu: () => menuStyles,
1478
- groupHeading: () => groupHeadingStyles,
1479
- noOptionsMessage: () => noOptionsMessageStyles
1480
- },
1497
+ components: customComponents,
1498
+ classNames: customClassNames,
1481
1499
  noOptionsMessage: () => /* @__PURE__ */ jsxRuntime.jsx("p", { children: messages8.inputSelect.noOptions }),
1482
1500
  ...props
1483
1501
  }
package/dist/index.mjs CHANGED
@@ -1342,7 +1342,14 @@ var Tag = React8.forwardRef(
1342
1342
  );
1343
1343
  Tag.displayName = "Tag";
1344
1344
  var DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(ChevronDown, { size: "16px" }) });
1345
- var ClearIndicator = (props) => /* @__PURE__ */ jsx(components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsx(X, { size: "16px" }) });
1345
+ var ClearIndicator = (props) => /* @__PURE__ */ jsx(
1346
+ components.ClearIndicator,
1347
+ {
1348
+ ...props,
1349
+ className: cn(props.className, "cursor-pointer"),
1350
+ children: /* @__PURE__ */ jsx(X, { size: "16px" })
1351
+ }
1352
+ );
1346
1353
  var MultiValueRemove = (props) => /* @__PURE__ */ jsx(components.MultiValueRemove, { ...props, children: /* @__PURE__ */ jsx(CircleX, { size: "16px" }) });
1347
1354
  var Option = (props) => {
1348
1355
  const { isSelected, data, innerRef, innerProps } = props;
@@ -1362,13 +1369,11 @@ var Option = (props) => {
1362
1369
  hover:text-inputSelect-focus-text
1363
1370
  hover:bg-listItem-background-hover
1364
1371
  bg-listItem-background-default
1365
- `,
1366
- isSelected ? `
1367
- text-inputSelect-focus-text
1368
- font-semibold
1369
- bg-listItem-background-hover` : `
1370
1372
  text-inputSelect-default-text
1371
- `
1373
+ `,
1374
+ {
1375
+ "text-inputSelect-focus-text font-semibold bg-listItem-background-hover": isSelected
1376
+ }
1372
1377
  ),
1373
1378
  children: [
1374
1379
  isSelected && /* @__PURE__ */ jsx(Check, { size: "16px" }),
@@ -1377,71 +1382,84 @@ var Option = (props) => {
1377
1382
  }
1378
1383
  );
1379
1384
  };
1380
- var controlStyles = (state) => cn([
1381
- `
1382
- border
1383
- bg-inputSelect-default-background
1384
- rounded-[20px]
1385
- px-4
1386
- w-full
1387
- min-h-10
1388
- transition
1389
- `,
1390
- {
1391
- "border-inputSelect-focus-border text-inputSelect-focus-text ring-[3px] ring-inputSelect-focus-border": state.isFocused,
1392
- "border-inputSelect-default-border text-inputSelect-default-text": !state.isFocused,
1393
- "bg-inputText-background-disabled": state.isDisabled
1394
- }
1395
- ]);
1385
+ var controlStyles = ({ isDisabled, isFocused }, isError) => {
1386
+ return cn(
1387
+ "flex w-full items-center border bg-inputSelect-default-background rounded-[20px] px-4 min-h-10 transition",
1388
+ {
1389
+ "ring-[3px] border-inputSelect-focus-border text-inputSelect-focus-text ring-inputSelect-focus-border": isFocused,
1390
+ "border-inputSelect-danger-border text-inputSelect-danger-icon": isError,
1391
+ "border-inputSelect-default-border text-inputSelect-default-text": !isFocused && !isError,
1392
+ "bg-inputText-background-disabled": isDisabled,
1393
+ "ring-button-danger-border-focus": isError && isFocused
1394
+ }
1395
+ );
1396
+ };
1396
1397
  var placeholderStyles = "text-inputSelect-default-text text-sm";
1397
1398
  var selectInputStyles = "p-0";
1398
1399
  var valueContainerStyles = "gap-1";
1399
1400
  var singleValueStyles = "text-inputSelect-active-text text-sm";
1400
- var multiValueStyles = "border rounded-full items-center px-2 py-0.2 gap-1.5 text-xs border-inputSelect-default-border";
1401
- var multiValueLabelStyles = "leading-6 px-2 py-0.2";
1401
+ var multiValueStyles = "border rounded-full items-center gap-1.5 text-xs border-inputSelect-default-border h-6 px-2";
1402
+ var multiValueLabelStyles = "";
1402
1403
  var indicatorsContainerStyles = "";
1403
1404
  var clearIndicatorStyles = "text-inputSelect-default-icon mr-2";
1404
1405
  var dropdownIndicatorStyles = "text-inputSelect-default-icon";
1405
- var menuStyles = "mt-2 border bg-inputSelect-default-background rounded-2xl overflow-hidden shadow-md shadow-dropdownMenu-shadow";
1406
+ var menuStyles = "mt-2 z-[1000] rounded-2xl border border-dropdownMenu-border bg-dropdownMenu-background shadow-dropdownMenu-shadow shadow-sm outline-none overflow-hidden";
1406
1407
  var groupHeadingStyles = "ml-3 mt-2 mb-1 text-inputSelect-default-text text-sm";
1407
1408
  var noOptionsMessageStyles = "p-2 text-inputSelect-default-text";
1408
1409
  var createStyledSelect = (BaseSelect, displayName) => {
1409
1410
  const StyledSelect2 = ({
1410
1411
  icon,
1411
1412
  disabled = false,
1413
+ isError = false,
1412
1414
  ...props
1413
1415
  }) => {
1414
1416
  const { messages: messages8 } = useNebulaI18n();
1417
+ const customClassNames = useMemo(() => {
1418
+ return {
1419
+ control: (props2) => controlStyles(props2, isError),
1420
+ placeholder: () => placeholderStyles,
1421
+ input: () => selectInputStyles,
1422
+ valueContainer: () => valueContainerStyles,
1423
+ singleValue: () => singleValueStyles,
1424
+ multiValue: () => multiValueStyles,
1425
+ multiValueLabel: () => multiValueLabelStyles,
1426
+ indicatorsContainer: () => indicatorsContainerStyles,
1427
+ clearIndicator: () => clearIndicatorStyles,
1428
+ dropdownIndicator: () => dropdownIndicatorStyles,
1429
+ menu: () => menuStyles,
1430
+ groupHeading: () => groupHeadingStyles,
1431
+ noOptionsMessage: () => noOptionsMessageStyles
1432
+ };
1433
+ }, [isError]);
1434
+ const customComponents = useMemo(
1435
+ () => ({
1436
+ DropdownIndicator,
1437
+ ClearIndicator,
1438
+ MultiValueRemove,
1439
+ Option,
1440
+ Control: ({ children, ...rest }) => /* @__PURE__ */ jsx(components.Control, { ...rest, children: /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex w-full items-center", children: [
1441
+ icon && /* @__PURE__ */ jsx(
1442
+ "span",
1443
+ {
1444
+ className: cn("mr-2", {
1445
+ "text-inputSelect-default-icon": !isError,
1446
+ "text-inputSelect-danger-icon": isError
1447
+ }),
1448
+ children: icon
1449
+ }
1450
+ ),
1451
+ children
1452
+ ] }) })
1453
+ }),
1454
+ [icon, isError]
1455
+ );
1415
1456
  return /* @__PURE__ */ jsx(
1416
1457
  BaseSelect,
1417
1458
  {
1418
1459
  unstyled: true,
1419
1460
  isDisabled: disabled,
1420
- components: {
1421
- DropdownIndicator,
1422
- ClearIndicator,
1423
- MultiValueRemove,
1424
- Option,
1425
- Control: ({ children, ...rest }) => /* @__PURE__ */ jsx(components.Control, { ...rest, children: /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex w-full items-center", children: [
1426
- icon && /* @__PURE__ */ jsx("span", { className: "nebula-ds text-inputSelect-default-icon pr-2", children: icon }),
1427
- children
1428
- ] }) })
1429
- },
1430
- classNames: {
1431
- control: (state) => cn(controlStyles(state)),
1432
- placeholder: () => placeholderStyles,
1433
- input: () => selectInputStyles,
1434
- valueContainer: () => valueContainerStyles,
1435
- singleValue: () => singleValueStyles,
1436
- multiValue: () => multiValueStyles,
1437
- multiValueLabel: () => multiValueLabelStyles,
1438
- indicatorsContainer: () => indicatorsContainerStyles,
1439
- clearIndicator: () => clearIndicatorStyles,
1440
- dropdownIndicator: () => dropdownIndicatorStyles,
1441
- menu: () => menuStyles,
1442
- groupHeading: () => groupHeadingStyles,
1443
- noOptionsMessage: () => noOptionsMessageStyles
1444
- },
1461
+ components: customComponents,
1462
+ classNames: customClassNames,
1445
1463
  noOptionsMessage: () => /* @__PURE__ */ jsx("p", { children: messages8.inputSelect.noOptions }),
1446
1464
  ...props
1447
1465
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikatec/nebula-react",
3
- "version": "0.0.1-alpha.21",
3
+ "version": "0.0.1-alpha.23",
4
4
  "description": "React components",
5
5
  "publishConfig": {
6
6
  "access": "public"