@tecsinapse/cortex-react 1.9.24-beta.0 → 1.9.25-beta.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.
|
@@ -5,6 +5,7 @@ var React = require('react');
|
|
|
5
5
|
var io5 = require('react-icons/io5');
|
|
6
6
|
var index = require('../Popover/index.js');
|
|
7
7
|
var context = require('./context.js');
|
|
8
|
+
var clsx = require('clsx');
|
|
8
9
|
|
|
9
10
|
const { button } = cortexCore.selectVariants();
|
|
10
11
|
const SelectTrigger = ({
|
|
@@ -23,7 +24,8 @@ const SelectTrigger = ({
|
|
|
23
24
|
return labelExtractor(value);
|
|
24
25
|
}, [label, value]);
|
|
25
26
|
const { className } = rest;
|
|
26
|
-
|
|
27
|
+
const hasValue = Array.isArray(value) ? value.length > 0 : !!value;
|
|
28
|
+
return /* @__PURE__ */ React.createElement(index.Popover.Trigger, { disabled }, /* @__PURE__ */ React.createElement("div", { className: "w-full gap-mili" }, /* @__PURE__ */ React.createElement(
|
|
27
29
|
"button",
|
|
28
30
|
{
|
|
29
31
|
className: button({ className }),
|
|
@@ -31,9 +33,27 @@ const SelectTrigger = ({
|
|
|
31
33
|
role: "button",
|
|
32
34
|
...rest
|
|
33
35
|
},
|
|
34
|
-
/* @__PURE__ */ React.createElement(
|
|
36
|
+
/* @__PURE__ */ React.createElement(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: clsx({ "mt-mili": hasValue && label }),
|
|
40
|
+
"data-testid": "select-placeholder"
|
|
41
|
+
},
|
|
42
|
+
_placeholder
|
|
43
|
+
),
|
|
35
44
|
/* @__PURE__ */ React.createElement(io5.IoChevronDownOutline, null)
|
|
36
|
-
)
|
|
45
|
+
), hasValue && label ? /* @__PURE__ */ React.createElement(
|
|
46
|
+
"label",
|
|
47
|
+
{
|
|
48
|
+
htmlFor: "select-trigger",
|
|
49
|
+
className: clsx(
|
|
50
|
+
"ml-centi",
|
|
51
|
+
cortexCore.labelStyle({ intent: "default", placeholder })
|
|
52
|
+
),
|
|
53
|
+
"data-testid": "input-label"
|
|
54
|
+
},
|
|
55
|
+
label
|
|
56
|
+
) : /* @__PURE__ */ React.createElement(React.Fragment, null)));
|
|
37
57
|
};
|
|
38
58
|
|
|
39
59
|
exports.SelectTrigger = SelectTrigger;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { selectVariants } from '@tecsinapse/cortex-core';
|
|
1
|
+
import { selectVariants, labelStyle } from '@tecsinapse/cortex-core';
|
|
2
2
|
import React__default, { useContext, useMemo } from 'react';
|
|
3
3
|
import { IoChevronDownOutline } from 'react-icons/io5';
|
|
4
4
|
import { Popover } from '../Popover/index.js';
|
|
5
5
|
import { SelectContext } from './context.js';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
|
|
7
8
|
const { button } = selectVariants();
|
|
8
9
|
const SelectTrigger = ({
|
|
@@ -21,7 +22,8 @@ const SelectTrigger = ({
|
|
|
21
22
|
return labelExtractor(value);
|
|
22
23
|
}, [label, value]);
|
|
23
24
|
const { className } = rest;
|
|
24
|
-
|
|
25
|
+
const hasValue = Array.isArray(value) ? value.length > 0 : !!value;
|
|
26
|
+
return /* @__PURE__ */ React__default.createElement(Popover.Trigger, { disabled }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full gap-mili" }, /* @__PURE__ */ React__default.createElement(
|
|
25
27
|
"button",
|
|
26
28
|
{
|
|
27
29
|
className: button({ className }),
|
|
@@ -29,9 +31,27 @@ const SelectTrigger = ({
|
|
|
29
31
|
role: "button",
|
|
30
32
|
...rest
|
|
31
33
|
},
|
|
32
|
-
/* @__PURE__ */ React__default.createElement(
|
|
34
|
+
/* @__PURE__ */ React__default.createElement(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
className: clsx({ "mt-mili": hasValue && label }),
|
|
38
|
+
"data-testid": "select-placeholder"
|
|
39
|
+
},
|
|
40
|
+
_placeholder
|
|
41
|
+
),
|
|
33
42
|
/* @__PURE__ */ React__default.createElement(IoChevronDownOutline, null)
|
|
34
|
-
)
|
|
43
|
+
), hasValue && label ? /* @__PURE__ */ React__default.createElement(
|
|
44
|
+
"label",
|
|
45
|
+
{
|
|
46
|
+
htmlFor: "select-trigger",
|
|
47
|
+
className: clsx(
|
|
48
|
+
"ml-centi",
|
|
49
|
+
labelStyle({ intent: "default", placeholder })
|
|
50
|
+
),
|
|
51
|
+
"data-testid": "input-label"
|
|
52
|
+
},
|
|
53
|
+
label
|
|
54
|
+
) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null)));
|
|
35
55
|
};
|
|
36
56
|
|
|
37
57
|
export { SelectTrigger };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.25-beta.0",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-dom": ">=18.0.0",
|
|
49
49
|
"tailwind": ">=3.3.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "966914868091fb267bff357e328d3d84aadc8c40"
|
|
52
52
|
}
|