@loja-integrada/admin-components 0.9.8 → 0.9.9
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/README.md +12 -8
- package/dist/Forms/Checkbox/Checkbox.d.ts +21 -1
- package/dist/Forms/Checkbox/Checkbox.stories.d.ts +1 -0
- package/dist/Forms/Input/Input.d.ts +2 -2
- package/dist/Icons/icons-path/Link.d.ts +2 -0
- package/dist/Icons/icons-path/index.d.ts +1 -0
- package/dist/admin-components.cjs.development.js +31 -7
- package/dist/admin-components.cjs.development.js.map +1 -1
- package/dist/admin-components.cjs.production.min.js +1 -1
- package/dist/admin-components.cjs.production.min.js.map +1 -1
- package/dist/admin-components.esm.js +31 -7
- package/dist/admin-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/Components/Table/Table.tsx +1 -1
- package/src/Forms/Checkbox/Checkbox.stories.tsx +6 -0
- package/src/Forms/Checkbox/Checkbox.tsx +81 -44
- package/src/Forms/Input/Input.tsx +2 -2
- package/src/Icons/icons-path/Link.tsx +9 -0
- package/src/Icons/icons-path/index.ts +2 -0
package/README.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
Components for Loja Integrada admin.
|
|
4
4
|
[https://lojaintegrada.github.io/admin-components/](https://lojaintegrada.github.io/admin-components/)
|
|
5
5
|
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
yarn add @loja-integrada/admin-components
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import { Button } from '@loja-integrada/admin-components'
|
|
14
|
+
|
|
15
|
+
<Button></Button>
|
|
16
|
+
```
|
|
17
|
+
|
|
6
18
|
## Comamnds
|
|
7
19
|
|
|
8
20
|
### Storybook
|
|
@@ -45,14 +57,6 @@ Deploy to GitHub Pages is automatic after deploy to NPM
|
|
|
45
57
|
This project works with both Jest or Cypress Components.
|
|
46
58
|
Use `.spec.` for Cypress and `.test.` for Jest
|
|
47
59
|
|
|
48
|
-
## Usage
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
import { Button } from '@loja-integrada/admin-components'
|
|
52
|
-
|
|
53
|
-
<Button></Button>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
60
|
### Bundle analysis
|
|
57
61
|
|
|
58
62
|
Calculates the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `yarn size` and visulize it with `yarn analyze`.
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { InputHelpTextProps } from '../InputHelpText';
|
|
2
3
|
export declare const Checkbox: React.MemoExoticComponent<React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>>;
|
|
3
|
-
export interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
export interface CheckboxProps extends InputHelpTextProps, React.InputHTMLAttributes<HTMLInputElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Custom class name
|
|
7
|
+
* */
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Text label of the checkbox
|
|
11
|
+
* */
|
|
4
12
|
label?: string | React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Checkbox box isn't selected nwither unselected
|
|
15
|
+
* @default false
|
|
16
|
+
* */
|
|
5
17
|
indeterminate?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Item align
|
|
20
|
+
* @default 'center'
|
|
21
|
+
* */
|
|
6
22
|
boxAlign?: 'start' | 'end' | 'center' | 'baseline' | 'stretch';
|
|
23
|
+
/**
|
|
24
|
+
* Error message to display
|
|
25
|
+
* */
|
|
26
|
+
errorMessage?: string;
|
|
7
27
|
}
|
|
@@ -5,6 +5,7 @@ export default _default;
|
|
|
5
5
|
export declare const Default: Story<CheckboxProps>;
|
|
6
6
|
export declare const Indeterminate: Story<CheckboxProps>;
|
|
7
7
|
export declare const Disabled: Story<CheckboxProps>;
|
|
8
|
+
export declare const Error: Story<CheckboxProps>;
|
|
8
9
|
export declare const DisabledChecked: Story<CheckboxProps>;
|
|
9
10
|
export declare const DisabledIndeterminate: Story<CheckboxProps>;
|
|
10
11
|
export declare const WithOnChange: Story<CheckboxProps>;
|
|
@@ -25,12 +25,12 @@ export interface InputProps extends InputLabelProps, InputHelpTextProps, Omit<Re
|
|
|
25
25
|
sufix?: React.ReactNode | string | null;
|
|
26
26
|
/**
|
|
27
27
|
* Set visibility of input prefix border
|
|
28
|
-
* @default
|
|
28
|
+
* @default true
|
|
29
29
|
* */
|
|
30
30
|
prefixBorder?: boolean;
|
|
31
31
|
/**
|
|
32
32
|
* Set visibility of input sufix border
|
|
33
|
-
* @default
|
|
33
|
+
* @default true
|
|
34
34
|
* */
|
|
35
35
|
sufixBorder?: boolean;
|
|
36
36
|
}
|
|
@@ -350,6 +350,14 @@ var InfoCircle = function InfoCircle() {
|
|
|
350
350
|
});
|
|
351
351
|
};
|
|
352
352
|
|
|
353
|
+
var Link = function Link() {
|
|
354
|
+
return React__default.createElement("path", {
|
|
355
|
+
fillRule: "evenodd",
|
|
356
|
+
clipRule: "evenodd",
|
|
357
|
+
d: "M10.5645 7.44624c-.301-.301-.78701-.301-1.08701 0-.301.301-.301.787 0 1.088l.74501.747c.34.34.526.79196.526 1.27096-.001.482-.189.933-.53 1.271l-3.82701 3.811c-1.106 1.103-2.91 1.102-4.016 0-.54-.539-.838-1.256-.838-2.02 0-.765.298-1.482.838-2.022l2.038-2.03096c.3-.3.302-.786.002-1.088-.299-.301-.786-.301-1.087-.002l-2.038 2.03196c-.833.83-1.29 1.933-1.29 3.111 0 1.177.457 2.281 1.29 3.112.854.849 1.973 1.274 3.093 1.274 1.12-.001 2.24-.425 3.093-1.273l3.82701-3.812c.632-.63.982-1.468.983-2.361.001-.89096-.346-1.72996-.977-2.36196l-.745-.746Zm6.154.057-2.31 2.314c-.301.30096-.787.30096-1.088 0-.3-.301-.3-.788 0-1.089l2.311-2.313c1.111-1.112 1.111-2.922 0-4.033-1.121-1.122-2.926-1.122-4.038-.01l-3.83001 3.835c-.7.701-.7 1.84 0 2.54l.75.752c.301.3.301.78696 0 1.08796-.149.15-.345.225-.543.225-.197 0-.393-.075-.544-.225l-.75-.75196c-1.299-1.3-1.299-3.416 0-4.716l3.83001-3.835c1.71-1.712 4.493-1.712 6.203 0 1.719 1.722 1.719 4.508.009 6.219Z"
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
|
|
353
361
|
var Loading = function Loading() {
|
|
354
362
|
return React__default.createElement("path", {
|
|
355
363
|
fillRule: "evenodd",
|
|
@@ -527,6 +535,7 @@ var icons = {
|
|
|
527
535
|
plusCircle: PlusCircle,
|
|
528
536
|
print: Print,
|
|
529
537
|
infoCircle: InfoCircle,
|
|
538
|
+
link: Link,
|
|
530
539
|
loading: Loading,
|
|
531
540
|
pix: Pix,
|
|
532
541
|
search: Search,
|
|
@@ -1594,16 +1603,23 @@ var DropdownWithFowardRef = /*#__PURE__*/React__default.forwardRef(DropdownCompo
|
|
|
1594
1603
|
var Dropdown = /*#__PURE__*/React__default.memo(DropdownWithFowardRef);
|
|
1595
1604
|
|
|
1596
1605
|
var CheckboxComponent = function CheckboxComponent(_ref, ref) {
|
|
1597
|
-
var
|
|
1606
|
+
var _ref$className = _ref.className,
|
|
1607
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1608
|
+
label = _ref.label,
|
|
1598
1609
|
id = _ref.id,
|
|
1599
1610
|
name = _ref.name,
|
|
1600
1611
|
onChange = _ref.onChange,
|
|
1601
1612
|
checked = _ref.checked,
|
|
1602
1613
|
disabled = _ref.disabled,
|
|
1603
|
-
indeterminate = _ref.indeterminate,
|
|
1614
|
+
_ref$indeterminate = _ref.indeterminate,
|
|
1615
|
+
indeterminate = _ref$indeterminate === void 0 ? false : _ref$indeterminate,
|
|
1604
1616
|
_ref$boxAlign = _ref.boxAlign,
|
|
1605
1617
|
boxAlign = _ref$boxAlign === void 0 ? 'center' : _ref$boxAlign,
|
|
1606
|
-
|
|
1618
|
+
helpText = _ref.helpText,
|
|
1619
|
+
_ref$hasError = _ref.hasError,
|
|
1620
|
+
hasError = _ref$hasError === void 0 ? false : _ref$hasError,
|
|
1621
|
+
errorMessage = _ref.errorMessage,
|
|
1622
|
+
props = _objectWithoutPropertiesLoose(_ref, ["className", "label", "id", "name", "onChange", "checked", "disabled", "indeterminate", "boxAlign", "helpText", "hasError", "errorMessage"]);
|
|
1607
1623
|
|
|
1608
1624
|
var inputRef = React__default.useRef(null);
|
|
1609
1625
|
var inputId = id || name;
|
|
@@ -1617,6 +1633,7 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
|
|
|
1617
1633
|
setIsIndeterminate = _React$useState2[1];
|
|
1618
1634
|
|
|
1619
1635
|
var isCenterBoxAlign = boxAlign === 'center';
|
|
1636
|
+
var hasErrorState = hasError || !!errorMessage;
|
|
1620
1637
|
React__default.useEffect(function () {
|
|
1621
1638
|
setIsChecked(!!checked);
|
|
1622
1639
|
if (checked) setIsIndeterminate(false);
|
|
@@ -1636,7 +1653,7 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
|
|
|
1636
1653
|
|
|
1637
1654
|
var checkboxIconClasses = "transition duration-200 ease-in-out " + (isChecked || isIndeterminate ? 'scale-100' : 'scale-0');
|
|
1638
1655
|
var checkboxIconContainerClasses = "border border-card-stroke transition duration-200 ease-in-out\n " + (disabled ? 'bg-base-4' : isChecked || isIndeterminate ? 'bg-primary border-primary' : 'bg-base-1') + "\n " + (isCenterBoxAlign ? 'items-center' : '') + "\n rounded w-4 h-4 flex justify-center m-px\n ";
|
|
1639
|
-
var checkboxLabelClasses = "ml-1 input-label text-f6 tracking-4 leading-6 " + (disabled ? 'text-inverted-2' : '');
|
|
1656
|
+
var checkboxLabelClasses = "ml-1 input-label text-f6 tracking-4 leading-6 " + (hasErrorState ? 'text-danger' : disabled ? 'text-inverted-2' : '');
|
|
1640
1657
|
var alignOptions = {
|
|
1641
1658
|
start: 'items-start',
|
|
1642
1659
|
end: 'items-end',
|
|
@@ -1644,7 +1661,14 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
|
|
|
1644
1661
|
baseline: 'items-baseline',
|
|
1645
1662
|
stretch: 'items-stretch'
|
|
1646
1663
|
};
|
|
1647
|
-
|
|
1664
|
+
var HelpTextComponent = React__default.createElement(InputHelpText, {
|
|
1665
|
+
helpText: errorMessage || helpText,
|
|
1666
|
+
hasError: hasErrorState,
|
|
1667
|
+
className: "mt-2"
|
|
1668
|
+
});
|
|
1669
|
+
return React__default.createElement("div", {
|
|
1670
|
+
className: "inline-block " + className
|
|
1671
|
+
}, React__default.createElement("label", {
|
|
1648
1672
|
htmlFor: inputId,
|
|
1649
1673
|
className: "inline-flex " + alignOptions[boxAlign] + " cursor-pointer"
|
|
1650
1674
|
}, React__default.createElement("span", {
|
|
@@ -1678,7 +1702,7 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
|
|
|
1678
1702
|
fill: "white"
|
|
1679
1703
|
})))), React__default.createElement("span", {
|
|
1680
1704
|
className: checkboxLabelClasses
|
|
1681
|
-
}, label));
|
|
1705
|
+
}, label)), HelpTextComponent);
|
|
1682
1706
|
};
|
|
1683
1707
|
|
|
1684
1708
|
var CheckboxWithFowardRef = /*#__PURE__*/React__default.forwardRef(CheckboxComponent);
|
|
@@ -1867,7 +1891,7 @@ var TableComponent = function TableComponent(_ref2) {
|
|
|
1867
1891
|
}));
|
|
1868
1892
|
})), React__default.createElement("tbody", Object.assign({}, getTableBodyProps(), {
|
|
1869
1893
|
className: "text-sm text-on-base"
|
|
1870
|
-
}), isLoading ? React__default.createElement("tr", null, Array(columnsLength).fill(0).map(function (key) {
|
|
1894
|
+
}), isLoading ? React__default.createElement("tr", null, Array(columnsLength).fill(0).map(function (_, key) {
|
|
1871
1895
|
return React__default.createElement("td", {
|
|
1872
1896
|
key: key,
|
|
1873
1897
|
className: "" + TdClasses
|