tabler-react-2 0.1.90 → 0.1.92
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/input/dropdown.js
CHANGED
|
@@ -44,6 +44,17 @@ var DropdownInput = exports.DropdownInput = function DropdownInput(_ref) {
|
|
|
44
44
|
// Allow aliasing: pass either `values` or `items`
|
|
45
45
|
var values = ivalues || items || [];
|
|
46
46
|
|
|
47
|
+
// Helper: extract text from label or dropdownText for filtering
|
|
48
|
+
var getLabelText = function getLabelText(val) {
|
|
49
|
+
var _val$dropdownText;
|
|
50
|
+
var node = (_val$dropdownText = val.dropdownText) !== null && _val$dropdownText !== void 0 ? _val$dropdownText : val.label;
|
|
51
|
+
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
52
|
+
var children = _react.Children.toArray(node);
|
|
53
|
+
return children.map(function (child) {
|
|
54
|
+
return typeof child === "string" ? child : "";
|
|
55
|
+
}).join("");
|
|
56
|
+
};
|
|
57
|
+
|
|
47
58
|
// When loading, show a Button in a container with an optional label.
|
|
48
59
|
if (loading) {
|
|
49
60
|
return /*#__PURE__*/_react["default"].createElement(_index.Util.Col, null, showLabel && label && /*#__PURE__*/_react["default"].createElement("label", {
|
|
@@ -92,17 +103,15 @@ var DropdownInput = exports.DropdownInput = function DropdownInput(_ref) {
|
|
|
92
103
|
setSelectedValue(matchedValue);
|
|
93
104
|
}, [value, values]);
|
|
94
105
|
|
|
95
|
-
// Filter values based on the search query
|
|
106
|
+
// Filter values based on the search query using getLabelText
|
|
96
107
|
(0, _react.useEffect)(function () {
|
|
97
108
|
setFilteredValues(values.filter(function (val) {
|
|
98
|
-
return
|
|
109
|
+
return getLabelText(val).toLowerCase().includes(searchQuery.toLowerCase());
|
|
99
110
|
}));
|
|
100
111
|
}, [searchQuery, values]);
|
|
101
112
|
var handleSelection = function handleSelection(val) {
|
|
102
113
|
setSelectedValue(val);
|
|
103
|
-
if (onChange)
|
|
104
|
-
onChange(val);
|
|
105
|
-
}
|
|
114
|
+
if (onChange) onChange(val);
|
|
106
115
|
};
|
|
107
116
|
|
|
108
117
|
// The main dropdown markup.
|
|
@@ -123,6 +132,7 @@ var DropdownInput = exports.DropdownInput = function DropdownInput(_ref) {
|
|
|
123
132
|
return setSearchQuery(value);
|
|
124
133
|
}
|
|
125
134
|
})), filteredValues.map(function (val, index) {
|
|
135
|
+
var _val$dropdownText2;
|
|
126
136
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
127
137
|
key: index,
|
|
128
138
|
className: "dropdown-item".concat(selectedValue && selectedValue.id === val.id ? " active" : ""),
|
|
@@ -132,7 +142,7 @@ var DropdownInput = exports.DropdownInput = function DropdownInput(_ref) {
|
|
|
132
142
|
style: {
|
|
133
143
|
cursor: "pointer"
|
|
134
144
|
}
|
|
135
|
-
}, val.dropdownText
|
|
145
|
+
}, (_val$dropdownText2 = val.dropdownText) !== null && _val$dropdownText2 !== void 0 ? _val$dropdownText2 : val.label);
|
|
136
146
|
}), filteredValues.length === 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
137
147
|
className: "dropdown-item text-muted"
|
|
138
148
|
}, "No results found")));
|
package/dist/timeline/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
11
|
var i = function i(Icon) {
|
|
12
|
+
return typeof Icon === "function" ? /*#__PURE__*/_react["default"].createElement(Icon, null) : Icon;
|
|
12
13
|
var isComponent = typeof Icon === "function" || /*#__PURE__*/_react["default"].isValidElement(Icon);
|
|
13
14
|
console.log(isComponent, typeof Icon === "function", /*#__PURE__*/_react["default"].isValidElement(Icon), Icon);
|
|
14
15
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isComponent ? /*#__PURE__*/_react["default"].createElement(Icon, null) : Icon);
|
package/docs/package.json
CHANGED
|
@@ -39,7 +39,7 @@ The `DropdownInput` component is used to select an option from a list of options
|
|
|
39
39
|
values={[
|
|
40
40
|
{ id: 1, label: "Sam" },
|
|
41
41
|
{ id: 2, label: "Bob" },
|
|
42
|
-
{ id: 3, label:
|
|
42
|
+
{ id: 3, label: <b>John</b> },
|
|
43
43
|
]}
|
|
44
44
|
onChange={(value) => alert(`Selected value: ${JSON.stringify(value)}`)}
|
|
45
45
|
/>
|
|
@@ -4,7 +4,12 @@ title: Timeline
|
|
|
4
4
|
|
|
5
5
|
import { Timeline } from "../../components/LoadableTabler";
|
|
6
6
|
import { Excerpt } from "../../components/Excerpt.jsx";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
IconBrandTwitter,
|
|
9
|
+
IconCheck,
|
|
10
|
+
IconMessage,
|
|
11
|
+
IconUser,
|
|
12
|
+
} from "@tabler/icons-react";
|
|
8
13
|
|
|
9
14
|
Timeline is a component that displays a list of events. Used to communicate a series of related events, usually in a chronological order.
|
|
10
15
|
|
|
@@ -43,19 +48,19 @@ The `events` prop is an array of objects that define the events to display. Each
|
|
|
43
48
|
<Timeline
|
|
44
49
|
events={[
|
|
45
50
|
{
|
|
46
|
-
icon: IconCheck
|
|
51
|
+
icon: <IconCheck />,
|
|
47
52
|
time: "10 hrs ago",
|
|
48
53
|
title: "+1150 Followers",
|
|
49
54
|
description: "Joined the community",
|
|
50
55
|
},
|
|
51
56
|
{
|
|
52
|
-
icon: IconMessage
|
|
57
|
+
icon: <IconMessage />,
|
|
53
58
|
time: "1 hr ago",
|
|
54
59
|
title: "New message",
|
|
55
60
|
description: "You have 1 new message",
|
|
56
61
|
},
|
|
57
62
|
{
|
|
58
|
-
icon: IconUser
|
|
63
|
+
icon: <IconUser />,
|
|
59
64
|
time: "1 hr ago",
|
|
60
65
|
title: "New user",
|
|
61
66
|
description: "You have 1 new user",
|
|
@@ -64,3 +69,90 @@ The `events` prop is an array of objects that define the events to display. Each
|
|
|
64
69
|
/>
|
|
65
70
|
</div>
|
|
66
71
|
</Excerpt>
|
|
72
|
+
|
|
73
|
+
```jsx
|
|
74
|
+
<Timeline
|
|
75
|
+
events={[
|
|
76
|
+
{
|
|
77
|
+
icon: <IconCheck />,
|
|
78
|
+
time: "10 hrs ago",
|
|
79
|
+
title: "+1150 Followers",
|
|
80
|
+
description: "Joined the community",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
icon: <IconMessage />,
|
|
84
|
+
time: "1 hr ago",
|
|
85
|
+
title: "New message",
|
|
86
|
+
description: "You have 1 new message",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
icon: <IconUser />,
|
|
90
|
+
time: "1 hr ago",
|
|
91
|
+
title: "New user",
|
|
92
|
+
description: "You have 1 new user",
|
|
93
|
+
},
|
|
94
|
+
]}
|
|
95
|
+
/>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Colors
|
|
99
|
+
|
|
100
|
+
You can set the color of the icon using the `iconBgColor` prop to any of the [colors](/utilities/colors).
|
|
101
|
+
|
|
102
|
+
<Excerpt>
|
|
103
|
+
<div style={{ width: 400 }}>
|
|
104
|
+
<Timeline
|
|
105
|
+
dense
|
|
106
|
+
events={[
|
|
107
|
+
{
|
|
108
|
+
icon: <IconBrandTwitter />,
|
|
109
|
+
time: "10 hrs ago",
|
|
110
|
+
title: "+1150 Followers",
|
|
111
|
+
description: "New Twitter followers",
|
|
112
|
+
iconBgColor: "twitter",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
icon: <IconMessage />,
|
|
116
|
+
time: "1 hr ago",
|
|
117
|
+
title: "New message",
|
|
118
|
+
description: "You have 1 new message",
|
|
119
|
+
iconBgColor: "red",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
icon: <IconUser />,
|
|
123
|
+
time: "1 hr ago",
|
|
124
|
+
title: "New user",
|
|
125
|
+
description: "You have 1 new user",
|
|
126
|
+
},
|
|
127
|
+
]}
|
|
128
|
+
/>
|
|
129
|
+
</div>
|
|
130
|
+
</Excerpt>
|
|
131
|
+
|
|
132
|
+
```jsx
|
|
133
|
+
<Timeline
|
|
134
|
+
dense
|
|
135
|
+
events={[
|
|
136
|
+
{
|
|
137
|
+
icon: <IconBrandTwitter />,
|
|
138
|
+
time: "10 hrs ago",
|
|
139
|
+
title: "+1150 Followers",
|
|
140
|
+
description: "New Twitter followers",
|
|
141
|
+
iconBgColor: "twitter",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
icon: <IconMessage />,
|
|
145
|
+
time: "1 hr ago",
|
|
146
|
+
title: "New message",
|
|
147
|
+
description: "You have 1 new message",
|
|
148
|
+
iconBgColor: "red",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
icon: <IconUser />,
|
|
152
|
+
time: "1 hr ago",
|
|
153
|
+
title: "New user",
|
|
154
|
+
description: "You have 1 new user",
|
|
155
|
+
},
|
|
156
|
+
]}
|
|
157
|
+
/>
|
|
158
|
+
```
|