tabler-react-2 0.1.85 → 0.1.86

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.
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ 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); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.TablerProvider = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
14
+ 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."); }
15
+ 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; } }
16
+ 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; }
17
+ 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; } }
18
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
19
+ var generateCSSVariables = function generateCSSVariables(theme) {
20
+ return theme ? Object.entries(theme).map(function (_ref) {
21
+ var _ref2 = _slicedToArray(_ref, 2),
22
+ key = _ref2[0],
23
+ value = _ref2[1];
24
+ return "--tblr-".concat(key, ": ").concat(value, ";");
25
+ }).join("\n") : "";
26
+ };
27
+ var TablerProvider = exports.TablerProvider = function TablerProvider(_ref3) {
28
+ var children = _ref3.children,
29
+ _ref3$colorScheme = _ref3.colorScheme,
30
+ colorScheme = _ref3$colorScheme === void 0 ? "light" : _ref3$colorScheme,
31
+ _ref3$theme = _ref3.theme,
32
+ themeColors = _ref3$theme === void 0 ? {} : _ref3$theme;
33
+ (0, _react.useEffect)(function () {
34
+ var script1 = document.createElement("script");
35
+ script1.src = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta17/dist/js/tabler.min.js";
36
+ script1.async = true;
37
+ var link = document.createElement("link");
38
+ link.rel = "stylesheet";
39
+ link.href = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta17/dist/css/tabler.min.css";
40
+ var script2 = document.createElement("script");
41
+ script2.textContent = "window.USE_FALLBACK_ANCHOR = true;";
42
+ document.head.appendChild(link);
43
+ document.head.appendChild(script1);
44
+ document.head.appendChild(script2);
45
+ return function () {
46
+ document.head.removeChild(link);
47
+ document.head.removeChild(script1);
48
+ document.head.removeChild(script2);
49
+ };
50
+ }, []);
51
+ (0, _react.useEffect)(function () {
52
+ if (colorScheme === "dark") {
53
+ document.body.classList.add("theme-dark");
54
+ } else {
55
+ document.body.classList.remove("theme-dark");
56
+ }
57
+ }, [colorScheme]);
58
+ (0, _react.useEffect)(function () {
59
+ var styleTag = document.createElement("style");
60
+ styleTag.innerHTML = "\n :root {\n ".concat(generateCSSVariables(themeColors || {}), "\n }\n ");
61
+ document.head.appendChild(styleTag);
62
+ return function () {
63
+ document.head.removeChild(styleTag);
64
+ };
65
+ }, [themeColors]);
66
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children);
67
+ };
68
+ TablerProvider.propTypes = {
69
+ children: _propTypes["default"].node.isRequired,
70
+ colorScheme: _propTypes["default"].oneOf(["light", "dark"]),
71
+ themeColors: _propTypes["default"].shape({
72
+ light: _propTypes["default"].object,
73
+ dark: _propTypes["default"].object
74
+ })
75
+ };
@@ -38,7 +38,7 @@ var Ribbon = exports.Ribbon = function Ribbon(_ref2) {
38
38
  _ref2$content = _ref2.content,
39
39
  content = _ref2$content === void 0 ? /*#__PURE__*/_react["default"].createElement(IconStar, null) : _ref2$content,
40
40
  shape = _ref2.shape;
41
- var color = passedColor || passedVariant || "primary";
41
+ var color = passedVariant || passedColor || "primary";
42
42
  return /*#__PURE__*/_react["default"].createElement("div", null, children, /*#__PURE__*/_react["default"].createElement("div", {
43
43
  className: (0, _classnames["default"])("ribbon", "ribbon-".concat(position), "bg-".concat(color), shape && "ribbon-".concat(shape))
44
44
  }, content));
package/docs/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "react": "^18.2.0",
22
22
  "react-dom": "^18.2.0",
23
23
  "styled-components": "^6.1.15",
24
- "tabler-react-2": "0.1.83"
24
+ "tabler-react-2": "0.1.85"
25
25
  },
26
26
  "devDependencies": {},
27
27
  "keywords": [
@@ -153,3 +153,6 @@ export const Typography = {
153
153
  U,
154
154
  Special,
155
155
  };
156
+ export const TablerProvider = loadable(() =>
157
+ import("tabler-react-2").then((mod) => mod.TablerProvider)
158
+ );
@@ -28,6 +28,8 @@
28
28
  link: "/components/modals"
29
29
  - label: "Ribbons"
30
30
  link: "/components/ribbons"
31
+ - label: "Spinners"
32
+ link: "/components/spinners"
31
33
  - label: "Utilities"
32
34
  items:
33
35
  - label: "Colors"
@@ -4,6 +4,7 @@ title: Ribbons
4
4
 
5
5
  import { Ribbon, Card } from "../../components/LoadableTabler";
6
6
  import { Excerpt } from "../../components/Excerpt.jsx";
7
+ import { IconAerialLift } from "@tabler/icons-react";
7
8
 
8
9
  You can assign a ribbon to a card to display a small badge.
9
10
 
@@ -19,7 +20,7 @@ import { Ribbon } from "tabler-react-2";
19
20
 
20
21
  | Prop | Required | Type | Default | Description |
21
22
  | ---------- | -------- | -------------------------- | ------- | --------------------------------------------------- |
22
- | `variant` | No | [Color](/utilities/colors) | | The color variant of the ribbon. |
23
+ | `variant` | No | [Color](/utilities/colors) | primary | The color variant of the ribbon. |
23
24
  | `color` | No | [Color](/utilities/colors) | | The color variant of the ribbon. Alias of `variant` |
24
25
  | `content` | No | React.ReactNode | | The content to display in the ribbon. |
25
26
  | `position` | No | String | | The position of the ribbon. |
@@ -30,19 +31,21 @@ The `Ribbon` component is used to display a ribbon.
30
31
 
31
32
  <Excerpt>
32
33
  <Card style={{ minWidth: 150, maxWidth: 250 }}>
33
- <Ribbon>Ribbon</Ribbon>
34
+ Ribbon
35
+ <Ribbon />
34
36
  </Card>
35
37
  </Excerpt>
36
38
 
37
39
  ```jsx
38
40
  <Card>
39
- <Ribbon>Ribbon</Ribbon>
41
+ Ribbon
42
+ <Ribbon />
40
43
  </Card>
41
44
  ```
42
45
 
43
46
  ## Variants
44
47
 
45
- You can pass a `color` prop to the `Ribbon` component to change the color of the ribbon.
48
+ You can pass a `variant` prop to the `Ribbon` component to change the color of the ribbon.
46
49
 
47
50
  <Excerpt f>
48
51
  {[
@@ -57,16 +60,88 @@ You can pass a `color` prop to the `Ribbon` component to change the color of the
57
60
  "purple",
58
61
  ].map((color) => (
59
62
  <Card key={color} style={{ minWidth: 150, maxWidth: 250 }}>
60
- <Ribbon variant={color}>{color}</Ribbon>
63
+ {color}
64
+ <Ribbon variant={color} />
61
65
  </Card>
62
66
  ))}
63
67
  </Excerpt>
64
68
 
65
69
  ```jsx
66
70
  <Card>
67
- <Ribbon variant="primary">primary</Ribbon>
71
+ primary
72
+ <Ribbon variant="primary" />
68
73
  </Card>
69
74
  <Card>
70
- <Ribbon variant="secondary">secondary</Ribbon>
75
+ secondary
76
+ <Ribbon variant="secondary" />
77
+ </Card>
78
+ ```
79
+
80
+ ## Positions
81
+
82
+ You can pass a `position` prop to the `Ribbon` component to change the position of the ribbon.
83
+
84
+ <Excerpt f>
85
+ {["top", "start", "end"].map((pos) => (
86
+ <Card
87
+ key={pos}
88
+ style={{ minWidth: 150, maxWidth: 250, textAlign: "center" }}
89
+ >
90
+ <Ribbon position={pos}>{pos}</Ribbon>
91
+ </Card>
92
+ ))}
93
+ </Excerpt>
94
+
95
+ ```jsx
96
+ <Card>
97
+ <Ribbon position="top">top</Ribbon>
98
+ </Card>
99
+ <Card>
100
+ <Ribbon position="start">start</Ribbon>
101
+ </Card>
102
+ <Card>
103
+ <Ribbon position="end">end</Ribbon>
104
+ </Card>
105
+ ```
106
+
107
+ ## Shapes
108
+
109
+ You can pass a `shape` prop to the `Ribbon` component to change the shape of the ribbon.
110
+
111
+ <Excerpt f>
112
+ <Card style={{ minWidth: 150, maxWidth: 250 }}>
113
+ <span>Bookmark</span>
114
+ <Ribbon shape="bookmark" />
115
+ </Card>
116
+ <Card style={{ minWidth: 150, maxWidth: 250 }}>
117
+ <span>Normal</span>
118
+ <Ribbon />
119
+ </Card>
120
+ </Excerpt>
121
+
122
+ ```jsx
123
+ <Card>
124
+ <span>Ribbon</span>
125
+ <Ribbon shape="bookmark" />
126
+ </Card>
127
+ <Card>
128
+ <span>Ribbon</span>
129
+ <Ribbon />
130
+ </Card>
131
+ ```
132
+
133
+ ## Custom Content
134
+
135
+ You can pass a `content` prop to the `Ribbon` component to change the content of the ribbon.
136
+
137
+ <Excerpt>
138
+ <Card style={{ minWidth: 150, maxWidth: 250 }}>
139
+ <Ribbon content={<IconAerialLift />}>Ribbon</Ribbon>
140
+ </Card>
141
+ </Excerpt>
142
+
143
+ ```jsx
144
+ <Card>
145
+ <Ribbon content={<IconAerialLift />}>Ribbon</Ribbon>
71
146
  </Card>
72
147
  ```
@@ -0,0 +1,76 @@
1
+ ---
2
+ title: Spinners
3
+ ---
4
+
5
+ import { Spinner } from "../../components/LoadableTabler";
6
+ import { Excerpt } from "../../components/Excerpt.jsx";
7
+
8
+ Spinners are used to indicate that something is loading.
9
+
10
+ ## Signature
11
+
12
+ ```jsx
13
+ import { Spinner } from "tabler-react-2";
14
+
15
+ <Spinner {...props}>{children}</Spinner>;
16
+ ```
17
+
18
+ ### Props
19
+
20
+ | Prop | Required | Type | Default | Description |
21
+ | --------- | -------- | -------------------------- | ------- | -------------------------------------------------- |
22
+ | `size` | No | [`sm` \| `lg`] | `lg` | The size of the spinner. |
23
+ | `color` | No | [Color](/utilities/colors) | | The color variant of the spinner. |
24
+ | `variant` | No | String | | The color variant of the spinner. Alias of `color` |
25
+
26
+ ## Basic Usage
27
+
28
+ The `Spinner` component is used to display a spinner.
29
+
30
+ <Excerpt>
31
+ <Spinner />
32
+ </Excerpt>
33
+
34
+ ```jsx
35
+ <Spinner />
36
+ ```
37
+
38
+ ## Sizes
39
+
40
+ You can pass a `size` prop to the `Spinner` component to change the size of the spinner.
41
+
42
+ <Excerpt f>
43
+ {["sm", "lg"].map((size) => (
44
+ <Spinner key={size} size={size} />
45
+ ))}
46
+ </Excerpt>
47
+
48
+ ```jsx
49
+ <Spinner size="sm" />
50
+ <Spinner size="lg" />
51
+ ```
52
+
53
+ ## Variant
54
+
55
+ You can pass a `color` prop to the `Spinner` component to change the color of the spinner.
56
+
57
+ <Excerpt f>
58
+ {[
59
+ "primary",
60
+ "secondary",
61
+ "success",
62
+ "danger",
63
+ "warning",
64
+ "info",
65
+ "light",
66
+ "dark",
67
+ "purple",
68
+ ].map((color) => (
69
+ <Spinner key={color} variant={color} />
70
+ ))}
71
+ </Excerpt>
72
+
73
+ ```jsx
74
+ <Spinner variant="primary" />
75
+ <Spinner variant="secondary" />
76
+ ```
@@ -1,79 +1,34 @@
1
1
  ---
2
- title: 'Getting started'
3
- description: Learn how to get started with Rocket Docs.
2
+ title: "Getting started"
3
+ description: Learn how to get started with Tabler React 2
4
4
  ---
5
5
 
6
- > Rocket Docs is ready for Gatsby v5. New projects will use the new version!
6
+ Welcome to Tabler React 2! This guide will help you get started with the library and its components.
7
7
 
8
- The best way to start is by using our starter:
8
+ ## Installation
9
9
 
10
- ```bash
11
- npx gatsby new rocketdocs https://github.com/jpedroschmitz/gatsby-starter-rocketdocs
12
- ```
13
-
14
- But, if you prefer, you can install and configure manually.
15
-
16
- #### Using Yarn:
10
+ To install Tabler React 2, you can use npm or yarn.
17
11
 
18
12
  ```bash
19
- yarn add @rocketseat/gatsby-theme-docs
13
+ npm install tabler-react-2 @tabler/icons-react
20
14
  ```
21
15
 
22
- #### Using NPM:
23
-
24
16
  ```bash
25
- npm i @rocketseat/gatsby-theme-docs
17
+ yarn add tabler-react-2 @tabler/icons-react
26
18
  ```
27
19
 
28
- ## Theme Options
29
-
30
- | Key | Default | Required | Description |
31
- | ------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
32
- | basePath | / | No | Root url for all docs |
33
- | configPath | config | No | Location of config files |
34
- | docsPath | docs | No | The site description for SEO and social (FB, Twitter) tags |
35
- | homePath | - | No | Location of home file |
36
- | githubUrl | - | - | Deprecated in favor of `repositoryUrl` |
37
- | repositoryUrl | - | No | The complete URL of your repository (supports GitHub, GitLab and Bitbucket). Example: `https://github/jpedroschmitz/rocketdocs` |
38
- | baseDir | - | No | If your Gatsby site does not live in the root of your project directory/git repo, pass the subdirectory name here (ex: `docs`) |
39
- | withMdx | true | No | If necessary, you can add your own MDX options to the theme. To do so, make sure you turn this option to false and include `gatsby-plugin-mdx` on your `gatsby-config` |
40
- | branch | main | No | Default branch of the repository |
20
+ ## Usage
41
21
 
42
- <br />
22
+ To use Tabler React 2, you need to wrap your application with the `TablerProvider` component. This component provides the necessary CSS and JavaScript files for Tabler React 2.
43
23
 
44
- > Note: When adding a BitBucket link on the `repositoryUrl` option, don't add the `src/<branch>` to it.
45
- > Example of correct link: <br /> `https://bitbucket.org/jpedroschmitz/rocketdocs`
24
+ ```jsx
25
+ import { TablerProvider } from "tabler-react-2";
46
26
 
47
- ## Example usage
48
-
49
- ```js title=gatsby-config.js
50
- module.exports = {
51
- siteMetadata: {
52
- siteTitle: `@rocketseat/gatsby-theme-docs`,
53
- defaultTitle: `@rocketseat/gatsby-theme-docs`,
54
- siteTitleShort: `gatsby-theme-docs`,
55
- siteDescription: `Out of the box Gatsby Theme for creating documentation websites easily and quickly`,
56
- siteUrl: `https://rocketdocs.netlify.app`,
57
- siteAuthor: `@jpedroschmitz`,
58
- siteImage: `/banner.png`,
59
- siteLanguage: `en`,
60
- themeColor: `#8257E6`,
61
- basePath: `/`,
62
- },
63
- plugins: [
64
- {
65
- resolve: `@rocketseat/gatsby-theme-docs`,
66
- options: {
67
- basePath: `/`,
68
- configPath: `src/config`,
69
- docsPath: `src/docs`,
70
- homePath: `src/home`,
71
- repositoryUrl: `https://github.com/jpedroschmitz/rocketdocs`,
72
- baseDir: `examples/gatsby-theme-docs`,
73
- },
74
- },
75
- ],
76
- };
27
+ function App() {
28
+ return (
29
+ <TablerProvider>
30
+ <YourApp />
31
+ </TablerProvider>
32
+ );
33
+ }
77
34
  ```
78
-
79
- Once you have installed the dependencies you will need to create the [navigation](/usage/navigation) and [documentation](/usage/creating-docs) files.
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: "Themes"
3
+ ---
4
+
5
+ import { TablerProvider } from "../components/LoadableTabler";
6
+ import { Excerpt } from "../components/Excerpt.jsx";
7
+
8
+ Tabler React 2 provides a light and dark theme. You can use the `TablerProvider` component to set the theme.
9
+
10
+ ## Light theme
11
+
12
+ The light theme is the default theme. It provides a light and dark theme.
13
+
14
+ <Excerpt>
15
+ <TablerProvider>
16
+ <div style={{ padding: 20 }}>
17
+ <h1>Hello, world!</h1>
18
+ </div>
19
+ </TablerProvider>
20
+ </Excerpt>
21
+
22
+ ```jsx
23
+ <TablerProvider>
24
+ <div style={{ padding: 20 }}>
25
+ <h1>Hello, world!</h1>
26
+ </div>
27
+ </TablerProvider>
28
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabler-react-2",
3
- "version": "0.1.85",
3
+ "version": "0.1.86",
4
4
  "description": "A react implementation of Tabler ui",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {