tabler-react-2 0.1.96 → 0.1.97

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.
@@ -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), separated ? /*#__PURE__*/_react["default"].createElement("div", {
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,
@@ -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.0.0-beta17/dist/js/tabler.min.js";
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.0.0-beta17/dist/css/tabler.min.css";
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
@@ -22,7 +22,7 @@
22
22
  "react": "^18.2.0",
23
23
  "react-dom": "^18.2.0",
24
24
  "styled-components": "^6.1.15",
25
- "tabler-react-2": "^0.1.95"
25
+ "tabler-react-2": "^0.1.96"
26
26
  },
27
27
  "devDependencies": {},
28
28
  "keywords": [
@@ -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 [selectValue, setSelectValue] = useState();
14
+ const [value, setValue] = useState(props.value);
15
15
  return (
16
16
  <>
17
17
  <EnclosedSelectGroup
18
- multiple
19
- direction="column"
20
- value={selectValue}
21
- onChange={(v) => {
22
- console.log(v);
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={null}
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={null}
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,23 @@ 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
+ />
448
+ </Excerpt>
449
+
450
+ ```jsx
451
+ <Input
452
+ label="Input"
453
+ placeholder="Type here..."
454
+ helpText="This is some help text"
455
+ />
456
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabler-react-2",
3
- "version": "0.1.96",
3
+ "version": "0.1.97",
4
4
  "description": "A react implementation of Tabler ui",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {