tabler-react-2 0.1.96 → 0.1.98
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.js +12 -0
- package/dist/input/input.js +20 -4
- package/dist/offcanvas/index.js +171 -0
- package/dist/provider/tabler.js +2 -2
- package/docs/package.json +1 -1
- package/docs/src/config/sidebar.yml +2 -0
- package/docs/src/docs/changelog.mdx +8 -0
- package/docs/src/docs/components/enclosed-select-group.mdx +16 -20
- package/docs/src/docs/components/input.mdx +63 -0
- package/docs/src/docs/components/typography.mdx +0 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -192,5 +192,17 @@ Object.keys(_index18).forEach(function (key) {
|
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
194
|
});
|
|
195
|
+
var _index19 = require("./offcanvas/index");
|
|
196
|
+
Object.keys(_index19).forEach(function (key) {
|
|
197
|
+
if (key === "default" || key === "__esModule") return;
|
|
198
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
199
|
+
if (key in exports && exports[key] === _index19[key]) return;
|
|
200
|
+
Object.defineProperty(exports, key, {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
get: function get() {
|
|
203
|
+
return _index19[key];
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
});
|
|
195
207
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
196
208
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
package/dist/input/input.js
CHANGED
|
@@ -9,7 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _spinner = require("../spinner");
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
var _excluded = ["type", "label", "placeholder", "value", "onChange", "onRawChange", "onInput", "icon", "iconPos", "loader", "separated", "prependedText", "appendedText", "appendedLinkText", "appendedLinkHref", "appendedLinkOnClick", "datalistItems", "variant", "size", "noMargin", "inputProps"];
|
|
12
|
+
var _excluded = ["type", "label", "placeholder", "value", "onChange", "onRawChange", "onInput", "icon", "iconPos", "loader", "separated", "prependedText", "appendedText", "appendedLinkText", "appendedLinkHref", "appendedLinkOnClick", "datalistItems", "variant", "size", "noMargin", "inputProps", "helpText", "helpTextPlacement", "helpPrompt", "required", "hint", "labelDescription"];
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
@@ -49,6 +49,12 @@ var Input = exports.Input = function Input(_ref) {
|
|
|
49
49
|
_ref$noMargin = _ref.noMargin,
|
|
50
50
|
noMargin = _ref$noMargin === void 0 ? false : _ref$noMargin,
|
|
51
51
|
inputProps = _ref.inputProps,
|
|
52
|
+
helpText = _ref.helpText,
|
|
53
|
+
helpTextPlacement = _ref.helpTextPlacement,
|
|
54
|
+
helpPrompt = _ref.helpPrompt,
|
|
55
|
+
required = _ref.required,
|
|
56
|
+
hint = _ref.hint,
|
|
57
|
+
labelDescription = _ref.labelDescription,
|
|
52
58
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
53
59
|
// State for managing uncontrolled input value
|
|
54
60
|
var _useState = (0, _react.useState)(controlledValue),
|
|
@@ -92,8 +98,16 @@ var Input = exports.Input = function Input(_ref) {
|
|
|
92
98
|
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
93
99
|
className: "".concat(noMargin ? "" : "mb-3")
|
|
94
100
|
}, props), label && /*#__PURE__*/_react["default"].createElement("label", {
|
|
95
|
-
className: "form-label"
|
|
96
|
-
}, label
|
|
101
|
+
className: "form-label ".concat(required ? "required" : "")
|
|
102
|
+
}, label, helpText && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, " ", /*#__PURE__*/_react["default"].createElement("span", {
|
|
103
|
+
"class": "form-help",
|
|
104
|
+
"data-bs-toggle": "popover",
|
|
105
|
+
"data-bs-placement": helpTextPlacement || "top",
|
|
106
|
+
"data-bs-html": "true",
|
|
107
|
+
"data-bs-content": helpText
|
|
108
|
+
}, helpPrompt || "?")), labelDescription && /*#__PURE__*/_react["default"].createElement("span", {
|
|
109
|
+
className: "form-label-description"
|
|
110
|
+
}, labelDescription)), separated ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
97
111
|
className: "row g-2"
|
|
98
112
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
99
113
|
className: "col"
|
|
@@ -145,7 +159,9 @@ var Input = exports.Input = function Input(_ref) {
|
|
|
145
159
|
key: index,
|
|
146
160
|
value: item
|
|
147
161
|
});
|
|
148
|
-
})))
|
|
162
|
+
}))), hint && /*#__PURE__*/_react["default"].createElement("div", {
|
|
163
|
+
className: "form-hint"
|
|
164
|
+
}, hint));
|
|
149
165
|
};
|
|
150
166
|
Input.propTypes = {
|
|
151
167
|
type: _propTypes["default"].string,
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useOffcanvas = exports.Offcanvas = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _button = require("../button");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
13
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
var Offcanvas = exports.Offcanvas = /*#__PURE__*/_react["default"].memo(function (_ref) {
|
|
27
|
+
var show = _ref.show,
|
|
28
|
+
onHide = _ref.onHide,
|
|
29
|
+
position = _ref.position,
|
|
30
|
+
children = _ref.children;
|
|
31
|
+
// backdrop style
|
|
32
|
+
var backdropStyle = (0, _react.useMemo)(function () {
|
|
33
|
+
return {
|
|
34
|
+
position: "fixed",
|
|
35
|
+
top: 0,
|
|
36
|
+
left: 0,
|
|
37
|
+
width: "100vw",
|
|
38
|
+
height: "100vh",
|
|
39
|
+
backgroundColor: "rgba(0,0,0,0.1)",
|
|
40
|
+
zIndex: 999
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
// offcanvas container style
|
|
45
|
+
var containerStyle = (0, _react.useMemo)(function () {
|
|
46
|
+
var base = {
|
|
47
|
+
position: "fixed",
|
|
48
|
+
backgroundColor: "#fff",
|
|
49
|
+
boxShadow: "0 0.5rem 1rem rgba(0,0,0,0.15)",
|
|
50
|
+
transition: "transform 0.3s ease-out",
|
|
51
|
+
zIndex: 1000,
|
|
52
|
+
padding: 20,
|
|
53
|
+
overflow: "auto"
|
|
54
|
+
};
|
|
55
|
+
switch (position) {
|
|
56
|
+
case "end":
|
|
57
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
58
|
+
top: 0,
|
|
59
|
+
bottom: 0,
|
|
60
|
+
right: 0,
|
|
61
|
+
width: "300px",
|
|
62
|
+
transform: show ? "translateX(0)" : "translateX(100%)"
|
|
63
|
+
});
|
|
64
|
+
case "top":
|
|
65
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
66
|
+
left: 0,
|
|
67
|
+
right: 0,
|
|
68
|
+
top: 0,
|
|
69
|
+
height: "300px",
|
|
70
|
+
transform: show ? "translateY(0)" : "translateY(-100%)"
|
|
71
|
+
});
|
|
72
|
+
case "bottom":
|
|
73
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
74
|
+
left: 0,
|
|
75
|
+
right: 0,
|
|
76
|
+
bottom: 0,
|
|
77
|
+
height: "300px",
|
|
78
|
+
transform: show ? "translateY(0)" : "translateY(100%)"
|
|
79
|
+
});
|
|
80
|
+
case "start":
|
|
81
|
+
default:
|
|
82
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
83
|
+
top: 0,
|
|
84
|
+
bottom: 0,
|
|
85
|
+
left: 0,
|
|
86
|
+
width: "300px",
|
|
87
|
+
transform: show ? "translateX(0)" : "translateX(-100%)"
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}, [position, show]);
|
|
91
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, show && /*#__PURE__*/_react["default"].createElement("div", {
|
|
92
|
+
style: backdropStyle,
|
|
93
|
+
onClick: onHide
|
|
94
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
95
|
+
style: containerStyle,
|
|
96
|
+
role: "dialog",
|
|
97
|
+
"aria-hidden": !show
|
|
98
|
+
}, children));
|
|
99
|
+
});
|
|
100
|
+
Offcanvas.displayName = "Offcanvas";
|
|
101
|
+
Offcanvas.propTypes = {
|
|
102
|
+
/** Show or hide the offcanvas */
|
|
103
|
+
show: _propTypes["default"].bool.isRequired,
|
|
104
|
+
/** Callback when the backdrop is clicked */
|
|
105
|
+
onHide: _propTypes["default"].func.isRequired,
|
|
106
|
+
/** Position: 'start' (left), 'end' (right), 'top', or 'bottom' */
|
|
107
|
+
position: _propTypes["default"].oneOf(["start", "end", "top", "bottom"]),
|
|
108
|
+
/** Content inside the offcanvas */
|
|
109
|
+
children: _propTypes["default"].node
|
|
110
|
+
};
|
|
111
|
+
Offcanvas.defaultProps = {
|
|
112
|
+
position: "start",
|
|
113
|
+
children: null
|
|
114
|
+
};
|
|
115
|
+
var useOffcanvas = exports.useOffcanvas = function useOffcanvas() {
|
|
116
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
117
|
+
var _useState = (0, _react.useState)({
|
|
118
|
+
show: false,
|
|
119
|
+
resolve: null,
|
|
120
|
+
content: options.content || null,
|
|
121
|
+
position: options.position || "start"
|
|
122
|
+
}),
|
|
123
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
124
|
+
state = _useState2[0],
|
|
125
|
+
setState = _useState2[1];
|
|
126
|
+
var offcanvas = (0, _react.useCallback)(function () {
|
|
127
|
+
var newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
128
|
+
return new Promise(function (resolve) {
|
|
129
|
+
setState(function (prev) {
|
|
130
|
+
var _newOptions$content, _newOptions$position;
|
|
131
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
132
|
+
show: true,
|
|
133
|
+
resolve: resolve,
|
|
134
|
+
content: (_newOptions$content = newOptions.content) !== null && _newOptions$content !== void 0 ? _newOptions$content : prev.content,
|
|
135
|
+
position: (_newOptions$position = newOptions.position) !== null && _newOptions$position !== void 0 ? _newOptions$position : prev.position
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}, []);
|
|
140
|
+
var close = (0, _react.useCallback)(function () {
|
|
141
|
+
if (state.resolve) {
|
|
142
|
+
state.resolve();
|
|
143
|
+
}
|
|
144
|
+
setState(function (prev) {
|
|
145
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
146
|
+
show: false,
|
|
147
|
+
resolve: null
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}, [state.resolve]);
|
|
151
|
+
var OffcanvasElement = /*#__PURE__*/_react["default"].createElement(Offcanvas, _extends({
|
|
152
|
+
show: state.show,
|
|
153
|
+
onHide: close,
|
|
154
|
+
position: state.position
|
|
155
|
+
}, options.offcanvasProps || {}), /*#__PURE__*/_react["default"].createElement(_button.Button, {
|
|
156
|
+
type: "button",
|
|
157
|
+
className: "btn-close",
|
|
158
|
+
"aria-label": "Close",
|
|
159
|
+
onClick: close,
|
|
160
|
+
style: {
|
|
161
|
+
position: "absolute",
|
|
162
|
+
top: 10,
|
|
163
|
+
right: 10
|
|
164
|
+
}
|
|
165
|
+
}), state.content);
|
|
166
|
+
return {
|
|
167
|
+
offcanvas: offcanvas,
|
|
168
|
+
OffcanvasElement: OffcanvasElement,
|
|
169
|
+
close: close
|
|
170
|
+
};
|
|
171
|
+
};
|
package/dist/provider/tabler.js
CHANGED
|
@@ -34,11 +34,11 @@ var TablerProvider = exports.TablerProvider = function TablerProvider(_ref3) {
|
|
|
34
34
|
fallbackAnchor = _ref3$fallbackAnchor === void 0 ? true : _ref3$fallbackAnchor;
|
|
35
35
|
(0, _react.useEffect)(function () {
|
|
36
36
|
var script1 = document.createElement("script");
|
|
37
|
-
script1.src = "https://cdn.jsdelivr.net/npm/@tabler/core@1.
|
|
37
|
+
script1.src = "https://cdn.jsdelivr.net/npm/@tabler/core@1.2.0/dist/js/tabler.min.js";
|
|
38
38
|
script1.async = true;
|
|
39
39
|
var link = document.createElement("link");
|
|
40
40
|
link.rel = "stylesheet";
|
|
41
|
-
link.href = "https://cdn.jsdelivr.net/npm/@tabler/core@1.
|
|
41
|
+
link.href = "https://cdn.jsdelivr.net/npm/@tabler/core@1.2.0/dist/css/tabler.min.css";
|
|
42
42
|
var script2 = document.createElement("script");
|
|
43
43
|
script2.textContent = "window.USE_FALLBACK_ANCHOR = ".concat(fallbackAnchor, ";");
|
|
44
44
|
document.head.appendChild(link);
|
package/docs/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Changelog
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 0.1.97
|
|
6
|
+
|
|
7
|
+
- Added `helpText`, `helpTextPlacement`, `helpPrompt`, `required`, `hint`, and `labelDescription` props to the `Input` component.
|
|
8
|
+
- Updated the `TablerProvider` component to use the latest version of the Tabler core library. (migrated from `1.0.0-beta17` to `1.2.0`)
|
|
@@ -11,22 +11,16 @@ Enclosed Select Groups are used to mask radio and checkbox inputs in boxes with
|
|
|
11
11
|
## Signature
|
|
12
12
|
|
|
13
13
|
export const ControlledEnclosedSelectGroup = (props) => {
|
|
14
|
-
const [
|
|
14
|
+
const [value, setValue] = useState(props.value);
|
|
15
15
|
return (
|
|
16
16
|
<>
|
|
17
17
|
<EnclosedSelectGroup
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
setSelectValue(v);
|
|
18
|
+
{...props}
|
|
19
|
+
value={value}
|
|
20
|
+
onChange={(d) => {
|
|
21
|
+
setValue(d);
|
|
22
|
+
props.onChange && props.onChange(d);
|
|
24
23
|
}}
|
|
25
|
-
items={[
|
|
26
|
-
{ value: "one", content: <b>One</b> },
|
|
27
|
-
{ value: "two", content: "Two" },
|
|
28
|
-
{ value: "three", content: "Three" },
|
|
29
|
-
]}
|
|
30
24
|
/>
|
|
31
25
|
</>
|
|
32
26
|
);
|
|
@@ -95,11 +89,7 @@ The `multiple` prop can be used to allow multiple items to be selected.
|
|
|
95
89
|
{ value: "two", label: "Two" },
|
|
96
90
|
{ value: "three", label: "Three" },
|
|
97
91
|
]}
|
|
98
|
-
value={[
|
|
99
|
-
{
|
|
100
|
-
value: "one",
|
|
101
|
-
},
|
|
102
|
-
]}
|
|
92
|
+
value={[{ value: "one" }]}
|
|
103
93
|
onChange={console.log}
|
|
104
94
|
multiple
|
|
105
95
|
/>
|
|
@@ -112,7 +102,11 @@ The `multiple` prop can be used to allow multiple items to be selected.
|
|
|
112
102
|
{ value: "two", label: "Two" },
|
|
113
103
|
{ value: "three", label: "Three" },
|
|
114
104
|
]}
|
|
115
|
-
value={[
|
|
105
|
+
value={[
|
|
106
|
+
{
|
|
107
|
+
value: "one",
|
|
108
|
+
},
|
|
109
|
+
]}
|
|
116
110
|
onChange={console.log}
|
|
117
111
|
multiple
|
|
118
112
|
/>
|
|
@@ -129,9 +123,10 @@ The `direction` prop can be used to change the direction of the items.
|
|
|
129
123
|
{ value: "two", label: "Two" },
|
|
130
124
|
{ value: "three", label: "Three" },
|
|
131
125
|
]}
|
|
132
|
-
value={
|
|
126
|
+
value={[]}
|
|
133
127
|
onChange={console.log}
|
|
134
128
|
direction="column"
|
|
129
|
+
multiple
|
|
135
130
|
/>
|
|
136
131
|
</Excerpt>
|
|
137
132
|
|
|
@@ -142,8 +137,9 @@ The `direction` prop can be used to change the direction of the items.
|
|
|
142
137
|
{ value: "two", label: "Two" },
|
|
143
138
|
{ value: "three", label: "Three" },
|
|
144
139
|
]}
|
|
145
|
-
value={
|
|
140
|
+
value={[]}
|
|
146
141
|
onChange={console.log}
|
|
147
142
|
direction="column"
|
|
143
|
+
multiple
|
|
148
144
|
/>
|
|
149
145
|
```
|
|
@@ -40,6 +40,12 @@ import { Input } from "tabler-react-2";
|
|
|
40
40
|
| `variant` | No | [color](/utilities/colors) | | The color variant of the button. |
|
|
41
41
|
| `size` | No | [`sm`, `md`, `lg`] | `md` | The size of the button. |
|
|
42
42
|
| `inputProps` | No | Object | | The props to be passed to the input. |
|
|
43
|
+
| `helpText` | No | String | | The help text to be shown below the label. |
|
|
44
|
+
| `helpTextPlacement` | No | String | `top` | The placement of the help text. |
|
|
45
|
+
| `helpPrompt` | No | String | `?` | The prompt to be shown in the field's label. |
|
|
46
|
+
| `required` | No | Boolean | | Whether the input is required. |
|
|
47
|
+
| `hint` | No | String | | The hint to be shown below the input. |
|
|
48
|
+
| `labelDescription` | No | String | | The description to be shown to the right of the label. |
|
|
43
49
|
|
|
44
50
|
## Basic Usage
|
|
45
51
|
|
|
@@ -428,3 +434,60 @@ You can supply a list of items to the `datalistItems` prop to show a datalist. T
|
|
|
428
434
|
```
|
|
429
435
|
|
|
430
436
|
This is different than a DropdownInput because the datalist is not exclusive, meaning the user can use a value that is not in the list.
|
|
437
|
+
|
|
438
|
+
## Help Text
|
|
439
|
+
|
|
440
|
+
You can supply a `helpText` prop to the `Input` component to show a help text below the label.
|
|
441
|
+
|
|
442
|
+
<Excerpt>
|
|
443
|
+
<Input
|
|
444
|
+
label="Input"
|
|
445
|
+
placeholder="Type here..."
|
|
446
|
+
helpText="This is some help text"
|
|
447
|
+
helpPrompt="?"
|
|
448
|
+
/>
|
|
449
|
+
</Excerpt>
|
|
450
|
+
|
|
451
|
+
```jsx
|
|
452
|
+
<Input
|
|
453
|
+
label="Input"
|
|
454
|
+
placeholder="Type here..."
|
|
455
|
+
helpText="This is some help text"
|
|
456
|
+
/>
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
## Required
|
|
460
|
+
|
|
461
|
+
You can supply a `required` prop to the `Input` component to show a red asterisk next to the label.
|
|
462
|
+
|
|
463
|
+
<Excerpt>
|
|
464
|
+
<Input label="Input" placeholder="Type here..." required />
|
|
465
|
+
</Excerpt>
|
|
466
|
+
|
|
467
|
+
```jsx
|
|
468
|
+
<Input label="Input" placeholder="Type here..." required />
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
## Hint
|
|
472
|
+
|
|
473
|
+
You can supply a `hint` prop to the `Input` component to show a hint below the input.
|
|
474
|
+
|
|
475
|
+
<Excerpt>
|
|
476
|
+
<Input label="Input" placeholder="Type here..." hint="This is a hint" />
|
|
477
|
+
</Excerpt>
|
|
478
|
+
|
|
479
|
+
```jsx
|
|
480
|
+
<Input label="Input" placeholder="Type here..." hint="This is a hint" />
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
## Label Description
|
|
484
|
+
|
|
485
|
+
You can supply a `labelDescription` prop to the `Input` component to show a description to the right of the label.
|
|
486
|
+
|
|
487
|
+
<Excerpt>
|
|
488
|
+
<Input label="Input" placeholder="Type here..." labelDescription="37/100" />
|
|
489
|
+
</Excerpt>
|
|
490
|
+
|
|
491
|
+
```jsx
|
|
492
|
+
<Input label="Input" placeholder="Type here..." labelDescription="37/100" />
|
|
493
|
+
```
|