@veracity/vui 1.7.0-beta.3 → 1.7.0-redesign.0

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.
Files changed (79) hide show
  1. package/dist/cjs/accordion/accordion.d.ts +1 -1
  2. package/dist/cjs/accordion/accordion.d.ts.map +1 -1
  3. package/dist/cjs/accordion/accordion.js +7 -7
  4. package/dist/cjs/accordion/accordion.types.d.ts +0 -15
  5. package/dist/cjs/accordion/accordion.types.d.ts.map +1 -1
  6. package/dist/cjs/accordion/accordionItem.d.ts.map +1 -1
  7. package/dist/cjs/accordion/accordionItem.js +4 -4
  8. package/dist/cjs/accordion/accordionItemArrow.d.ts +1 -1
  9. package/dist/cjs/accordion/accordionItemArrow.d.ts.map +1 -1
  10. package/dist/cjs/accordion/accordionItemArrow.js +3 -10
  11. package/dist/cjs/accordion/index.d.ts +0 -1
  12. package/dist/cjs/accordion/index.d.ts.map +1 -1
  13. package/dist/cjs/accordion/index.js +0 -1
  14. package/dist/cjs/button/button.d.ts.map +1 -1
  15. package/dist/cjs/button/button.js +3 -3
  16. package/dist/cjs/index.d.ts +0 -1
  17. package/dist/cjs/index.d.ts.map +1 -1
  18. package/dist/cjs/index.js +0 -1
  19. package/dist/esm/accordion/accordion.d.ts +1 -1
  20. package/dist/esm/accordion/accordion.d.ts.map +1 -1
  21. package/dist/esm/accordion/accordion.js +6 -6
  22. package/dist/esm/accordion/accordion.types.d.ts +0 -15
  23. package/dist/esm/accordion/accordion.types.d.ts.map +1 -1
  24. package/dist/esm/accordion/accordionItem.d.ts.map +1 -1
  25. package/dist/esm/accordion/accordionItem.js +4 -4
  26. package/dist/esm/accordion/accordionItemArrow.d.ts +1 -1
  27. package/dist/esm/accordion/accordionItemArrow.d.ts.map +1 -1
  28. package/dist/esm/accordion/accordionItemArrow.js +3 -10
  29. package/dist/esm/accordion/index.d.ts +0 -1
  30. package/dist/esm/accordion/index.d.ts.map +1 -1
  31. package/dist/esm/accordion/index.js +0 -1
  32. package/dist/esm/button/button.d.ts.map +1 -1
  33. package/dist/esm/button/button.js +3 -3
  34. package/dist/esm/index.d.ts +0 -1
  35. package/dist/esm/index.d.ts.map +1 -1
  36. package/dist/esm/index.js +0 -1
  37. package/package.json +1 -1
  38. package/src/accordion/accordion.tsx +7 -18
  39. package/src/accordion/accordion.types.ts +7 -16
  40. package/src/accordion/accordionItem.tsx +5 -23
  41. package/src/accordion/accordionItemArrow.tsx +3 -13
  42. package/src/accordion/index.ts +0 -1
  43. package/src/button/button.tsx +4 -2
  44. package/src/index.ts +0 -1
  45. package/dist/cjs/accordion/accordionItemHorizontal.d.ts +0 -5
  46. package/dist/cjs/accordion/accordionItemHorizontal.d.ts.map +0 -1
  47. package/dist/cjs/accordion/accordionItemHorizontal.js +0 -70
  48. package/dist/cjs/copyToClipboard/copyToClipboard.d.ts +0 -12
  49. package/dist/cjs/copyToClipboard/copyToClipboard.d.ts.map +0 -1
  50. package/dist/cjs/copyToClipboard/copyToClipboard.js +0 -36
  51. package/dist/cjs/copyToClipboard/copyToClipboard.types.d.ts +0 -9
  52. package/dist/cjs/copyToClipboard/copyToClipboard.types.d.ts.map +0 -1
  53. package/dist/cjs/copyToClipboard/copyToClipboard.types.js +0 -2
  54. package/dist/cjs/copyToClipboard/index.d.ts +0 -5
  55. package/dist/cjs/copyToClipboard/index.d.ts.map +0 -1
  56. package/dist/cjs/copyToClipboard/index.js +0 -25
  57. package/dist/cjs/copyToClipboard/useCopyToClipboard.d.ts +0 -5
  58. package/dist/cjs/copyToClipboard/useCopyToClipboard.d.ts.map +0 -1
  59. package/dist/cjs/copyToClipboard/useCopyToClipboard.js +0 -17
  60. package/dist/esm/accordion/accordionItemHorizontal.d.ts +0 -5
  61. package/dist/esm/accordion/accordionItemHorizontal.d.ts.map +0 -1
  62. package/dist/esm/accordion/accordionItemHorizontal.js +0 -29
  63. package/dist/esm/copyToClipboard/copyToClipboard.d.ts +0 -12
  64. package/dist/esm/copyToClipboard/copyToClipboard.d.ts.map +0 -1
  65. package/dist/esm/copyToClipboard/copyToClipboard.js +0 -19
  66. package/dist/esm/copyToClipboard/copyToClipboard.types.d.ts +0 -9
  67. package/dist/esm/copyToClipboard/copyToClipboard.types.d.ts.map +0 -1
  68. package/dist/esm/copyToClipboard/copyToClipboard.types.js +0 -1
  69. package/dist/esm/copyToClipboard/index.d.ts +0 -5
  70. package/dist/esm/copyToClipboard/index.d.ts.map +0 -1
  71. package/dist/esm/copyToClipboard/index.js +0 -4
  72. package/dist/esm/copyToClipboard/useCopyToClipboard.d.ts +0 -5
  73. package/dist/esm/copyToClipboard/useCopyToClipboard.d.ts.map +0 -1
  74. package/dist/esm/copyToClipboard/useCopyToClipboard.js +0 -14
  75. package/src/accordion/accordionItemHorizontal.tsx +0 -96
  76. package/src/copyToClipboard/copyToClipboard.tsx +0 -36
  77. package/src/copyToClipboard/copyToClipboard.types.ts +0 -10
  78. package/src/copyToClipboard/index.ts +0 -4
  79. package/src/copyToClipboard/useCopyToClipboard.ts +0 -15
@@ -10,18 +10,7 @@ import { useAccordionContext } from './context'
10
10
 
11
11
  /** An accordion item. */
12
12
  export const AccordionItem = (props: AccordionItemProps) => {
13
- const {
14
- className,
15
- children,
16
- collapsed,
17
- content,
18
- disabled,
19
- id,
20
- itemTitleHoverBg = 'blue.10',
21
- title,
22
- onToggle,
23
- ...rest
24
- } = omitThemingProps(props)
13
+ const { className, children, id, content, disabled, title, collapsed, onToggle, ...rest } = omitThemingProps(props)
25
14
  const [collapsedInternal, setIsCollapsedInternal] = useState<boolean>(false)
26
15
 
27
16
  const styles = useStyleConfig('Accordion', useAccordionContext())
@@ -44,27 +33,20 @@ export const AccordionItem = (props: AccordionItemProps) => {
44
33
  disabled={disabled}
45
34
  flexDirection="column"
46
35
  h="auto"
36
+ hoverBg="blue.10"
47
37
  id={`${id}`}
48
- p={0}
49
38
  w="100%"
39
+ {...styles.item}
50
40
  {...rest}
51
41
  >
52
- <Box
53
- cursor={disabled ? 'not-allowed' : 'pointer'}
54
- hoverBg={itemTitleHoverBg}
55
- justifyContent="space-between"
56
- onClick={toggle}
57
- px={2}
58
- w="100%"
59
- {...styles.item}
60
- >
42
+ <Box cursor={disabled ? 'not-allowed' : 'pointer'} justifyContent="space-between" onClick={toggle} w="100%">
61
43
  <Box fontWeight={typeof title === 'string' ? '500' : 'inherit'}>{title}</Box>
62
44
  <Box>
63
45
  <AccordionItemArrow collapsed={collapsedInternal} />
64
46
  </Box>
65
47
  </Box>
66
48
  {!collapsedInternal && (
67
- <Box mb={2} mt={2} px={2} py={1} w="100%">
49
+ <Box mb={2} mt={2} w="100%">
68
50
  {children ?? content}
69
51
  </Box>
70
52
  )}
@@ -3,19 +3,9 @@ import React from 'react'
3
3
  import Icon from '../icon'
4
4
  import { AccordionItemArrowProps } from './accordion.types'
5
5
 
6
- const names = {
7
- horizontal: {
8
- collapsed: 'falChevronRight',
9
- expanded: 'falChevronLeft'
10
- },
11
- vertical: {
12
- collapsed: 'falChevronDown',
13
- expanded: 'falChevronUp'
14
- }
6
+ const AccordionItemArrow = (props: AccordionItemArrowProps) => {
7
+ const { collapsed } = props
8
+ return <Icon name={collapsed ? 'falChevronDown' : 'falChevronUp'} size="xs" />
15
9
  }
16
10
 
17
- const AccordionItemArrow = ({ collapsed, orientation = 'vertical' }: AccordionItemArrowProps) => (
18
- <Icon name={names[orientation][collapsed ? 'collapsed' : 'expanded']} size="xs" />
19
- )
20
-
21
11
  export default React.memo(AccordionItemArrow)
@@ -1,5 +1,4 @@
1
1
  export * from './accordion'
2
2
  export * from './accordionItem'
3
- export * from './accordionItemHorizontal'
4
3
  export { default } from './accordion'
5
4
  export * from './accordion.types'
@@ -135,7 +135,7 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
135
135
  focusRing={3}
136
136
  h={h}
137
137
  pl={pl}
138
- pr={isDropDown ? 0 : pr}
138
+ pr={pr}
139
139
  ref={ref}
140
140
  type="button"
141
141
  variant={variant}
@@ -152,16 +152,18 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
152
152
 
153
153
  <Content>
154
154
  {isString(icon) ? <ButtonIcon name={icon} /> : icon}
155
+
155
156
  {!icon && (
156
157
  <>
157
158
  {isString(iconLeft) ? <ButtonIcon mr={isDropDown ? 0 : iconLeftMr} name={iconLeft} /> : iconLeft}
158
159
 
159
160
  {children ?? (isReactText(text) ? <ButtonText {...{ isTruncated, text }} /> : text)}
160
161
 
162
+ {isDropDown && <ButtonIcon name="falAngleDown" />}
163
+
161
164
  {isString(iconRight) ? <ButtonIcon ml={iconRightMl} name={iconRight} /> : iconRight}
162
165
  </>
163
166
  )}
164
- {isDropDown && <ButtonIcon name="falAngleDown" />}
165
167
  </Content>
166
168
  </ButtonBase>
167
169
  </ButtonProvider>
package/src/index.ts CHANGED
@@ -6,7 +6,6 @@ export * from './buttonGroup'
6
6
  export * from './buttonToggleGroup'
7
7
  export * from './card'
8
8
  export * from './checkbox'
9
- export * from './copyToClipboard'
10
9
  export * from './core'
11
10
  export * from './dialog'
12
11
  export * from './divider'
@@ -1,5 +0,0 @@
1
- import { AccordionItemProps } from './accordion.types';
2
- /** An accordion item (horizontal orientation). */
3
- export declare const AccordionItemHorizontal: (props: AccordionItemProps) => JSX.Element;
4
- export default AccordionItemHorizontal;
5
- //# sourceMappingURL=accordionItemHorizontal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accordionItemHorizontal.d.ts","sourceRoot":"","sources":["../../../src/accordion/accordionItemHorizontal.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAItD,kDAAkD;AAClD,eAAO,MAAM,uBAAuB,UAAW,kBAAkB,gBAmFhE,CAAA;AAED,eAAe,uBAAuB,CAAA"}
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.AccordionItemHorizontal = void 0;
41
- const react_1 = __importStar(require("react"));
42
- const box_1 = __importDefault(require("../box"));
43
- const core_1 = require("../core");
44
- const utils_1 = require("../utils");
45
- const accordionItemArrow_1 = __importDefault(require("./accordionItemArrow"));
46
- const context_1 = require("./context");
47
- /** An accordion item (horizontal orientation). */
48
- const AccordionItemHorizontal = (props) => {
49
- const _a = (0, core_1.omitThemingProps)(props), { className, children, collapsed, content, disabled, id, itemTitleHoverBg = 'blue.10', title, onToggle } = _a, rest = __rest(_a, ["className", "children", "collapsed", "content", "disabled", "id", "itemTitleHoverBg", "title", "onToggle"]);
50
- const [collapsedInternal, setIsCollapsedInternal] = (0, react_1.useState)(false);
51
- const styles = (0, core_1.useStyleConfig)('Accordion', (0, context_1.useAccordionContext)());
52
- (0, react_1.useEffect)(() => {
53
- setIsCollapsedInternal(!!collapsed);
54
- }, [collapsed]);
55
- const toggle = () => {
56
- if (!disabled) {
57
- onToggle === null || onToggle === void 0 ? void 0 : onToggle({ id, collapsed: !collapsedInternal });
58
- setIsCollapsedInternal(!collapsedInternal);
59
- }
60
- };
61
- const cursor = disabled ? 'not-allowed' : 'pointer';
62
- const fontWeight = typeof title === 'string' ? '500' : 'inherit';
63
- return (react_1.default.createElement(box_1.default, Object.assign({ alignItems: collapsedInternal ? 'normal' : 'baseline', bg: disabled ? 'disabled.bg' : undefined, borderRight: "1px solid grey.40", className: (0, utils_1.cs)('vui-accordion-item-horizontal', className), color: disabled ? 'disabled.color' : undefined, column: true, cursor: disabled ? 'not-allowed' : undefined, id: `${id}`, maxW: collapsedInternal ? styles.item.minH : 'auto', minW: styles.item.minH, p: 0, transitionDuration: "0ms", userSelect: disabled ? 'none' : undefined }, rest),
64
- react_1.default.createElement(box_1.default, Object.assign({}, styles.item, { cursor: cursor, hoverBg: itemTitleHoverBg, justifyContent: "space-between", minH: styles.item.minH, onClick: toggle, p: styles.item.pt, w: "100%" }),
65
- !collapsedInternal && react_1.default.createElement(box_1.default, { fontWeight: fontWeight }, title),
66
- react_1.default.createElement(accordionItemArrow_1.default, { collapsed: collapsedInternal, orientation: "horizontal" })),
67
- !collapsedInternal ? (react_1.default.createElement(box_1.default, { p: styles.item.pt, pt: 0, transitionDuration: "0ms" }, children !== null && children !== void 0 ? children : content)) : (react_1.default.createElement(box_1.default, { cursor: cursor, flexDirection: "row-reverse", fontWeight: fontWeight, mb: styles.item.minH, mt: styles.item.pt, onClick: toggle, transform: "rotate(-90deg)", transitionDuration: "0ms", whiteSpace: "nowrap" }, title))));
68
- };
69
- exports.AccordionItemHorizontal = AccordionItemHorizontal;
70
- exports.default = exports.AccordionItemHorizontal;
@@ -1,12 +0,0 @@
1
- import { CopyToClipboardProps } from './copyToClipboard.types';
2
- /**
3
- * A helper button component.
4
- *
5
- * Copies the provided text to clipboard.
6
- *
7
- * Copying is available only for a secure environment (https://), otherwise the button is disabled.
8
- *
9
- */
10
- export declare const CopyToClipboard: import("../core").VuiComponent<"button", CopyToClipboardProps>;
11
- export default CopyToClipboard;
12
- //# sourceMappingURL=copyToClipboard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/copyToClipboard/copyToClipboard.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAG9D;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,gEAiB1B,CAAA;AAEF,eAAe,eAAe,CAAA"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.CopyToClipboard = void 0;
18
- const react_1 = __importDefault(require("react"));
19
- const button_1 = __importDefault(require("../button"));
20
- const core_1 = require("../core");
21
- const utils_1 = require("../utils");
22
- const useCopyToClipboard_1 = require("./useCopyToClipboard");
23
- /**
24
- * A helper button component.
25
- *
26
- * Copies the provided text to clipboard.
27
- *
28
- * Copying is available only for a secure environment (https://), otherwise the button is disabled.
29
- *
30
- */
31
- exports.CopyToClipboard = (0, core_1.vui)((props, ref) => {
32
- const { disabled, copyText, className, size = 'xs', variant = 'text' } = props, rest = __rest(props, ["disabled", "copyText", "className", "size", "variant"]);
33
- const { copy, isCopyDisabled } = (0, useCopyToClipboard_1.useCopyToClipboard)(copyText);
34
- return (react_1.default.createElement(button_1.default, Object.assign({ className: (0, utils_1.cs)('vui-copy-to-clipboard', className), disabled: disabled || isCopyDisabled, icon: "falCopy", onClick: () => copy(), ref: ref, size: size, variant: variant }, rest)));
35
- });
36
- exports.default = exports.CopyToClipboard;
@@ -1,9 +0,0 @@
1
- import { SystemProps } from '../system';
2
- import { ThemingProps } from '../theme';
3
- export declare type CopyToClipboardProps = SystemProps & ThemingProps<'Button'> & {
4
- /** Text string for copying */
5
- copyText: string;
6
- /** Button size @default "xs" */
7
- size?: 'xs' | 'sm' | 'md' | 'lg';
8
- };
9
- //# sourceMappingURL=copyToClipboard.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copyToClipboard.types.d.ts","sourceRoot":"","sources":["../../../src/copyToClipboard/copyToClipboard.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,oBAAY,oBAAoB,GAAG,WAAW,GAC5C,YAAY,CAAC,QAAQ,CAAC,GAAG;IACvB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CACjC,CAAA"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export * from './copyToClipboard';
2
- export { default } from './copyToClipboard';
3
- export * from './copyToClipboard.types';
4
- export * from './useCopyToClipboard';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/copyToClipboard/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.default = void 0;
21
- __exportStar(require("./copyToClipboard"), exports);
22
- var copyToClipboard_1 = require("./copyToClipboard");
23
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(copyToClipboard_1).default; } });
24
- __exportStar(require("./copyToClipboard.types"), exports);
25
- __exportStar(require("./useCopyToClipboard"), exports);
@@ -1,5 +0,0 @@
1
- export declare const useCopyToClipboard: (copyText: string) => {
2
- copy: () => void;
3
- isCopyDisabled: boolean;
4
- };
5
- //# sourceMappingURL=useCopyToClipboard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/copyToClipboard/useCopyToClipboard.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,aAAc,MAAM;;;CAYlD,CAAA"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCopyToClipboard = void 0;
4
- const toast_1 = require("../toast");
5
- const useCopyToClipboard = (copyText) => {
6
- var _a, _b;
7
- const { showSuccess, showError } = (0, toast_1.useToast)();
8
- const isCopyDisabled = !((_b = (_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : _a.clipboard) === null || _b === void 0 ? void 0 : _b.writeText);
9
- const copy = () => {
10
- var _a, _b, _c;
11
- if (!isCopyDisabled) {
12
- (_c = (_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : (_b = _a.clipboard).writeText) === null || _c === void 0 ? void 0 : _c.call(_b, copyText).then(() => showSuccess(`Copied to clipboard: ${copyText}`)).catch(() => showError('Copy failed'));
13
- }
14
- };
15
- return { copy, isCopyDisabled };
16
- };
17
- exports.useCopyToClipboard = useCopyToClipboard;
@@ -1,5 +0,0 @@
1
- import { AccordionItemProps } from './accordion.types';
2
- /** An accordion item (horizontal orientation). */
3
- export declare const AccordionItemHorizontal: (props: AccordionItemProps) => JSX.Element;
4
- export default AccordionItemHorizontal;
5
- //# sourceMappingURL=accordionItemHorizontal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accordionItemHorizontal.d.ts","sourceRoot":"","sources":["../../../src/accordion/accordionItemHorizontal.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAItD,kDAAkD;AAClD,eAAO,MAAM,uBAAuB,UAAW,kBAAkB,gBAmFhE,CAAA;AAED,eAAe,uBAAuB,CAAA"}
@@ -1,29 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import Box from '../box';
3
- import { omitThemingProps, useStyleConfig } from '../core';
4
- import { cs } from '../utils';
5
- import AccordionItemArrow from './accordionItemArrow';
6
- import { useAccordionContext } from './context';
7
- /** An accordion item (horizontal orientation). */
8
- export const AccordionItemHorizontal = (props) => {
9
- const { className, children, collapsed, content, disabled, id, itemTitleHoverBg = 'blue.10', title, onToggle, ...rest } = omitThemingProps(props);
10
- const [collapsedInternal, setIsCollapsedInternal] = useState(false);
11
- const styles = useStyleConfig('Accordion', useAccordionContext());
12
- useEffect(() => {
13
- setIsCollapsedInternal(!!collapsed);
14
- }, [collapsed]);
15
- const toggle = () => {
16
- if (!disabled) {
17
- onToggle?.({ id, collapsed: !collapsedInternal });
18
- setIsCollapsedInternal(!collapsedInternal);
19
- }
20
- };
21
- const cursor = disabled ? 'not-allowed' : 'pointer';
22
- const fontWeight = typeof title === 'string' ? '500' : 'inherit';
23
- return (React.createElement(Box, { alignItems: collapsedInternal ? 'normal' : 'baseline', bg: disabled ? 'disabled.bg' : undefined, borderRight: "1px solid grey.40", className: cs('vui-accordion-item-horizontal', className), color: disabled ? 'disabled.color' : undefined, column: true, cursor: disabled ? 'not-allowed' : undefined, id: `${id}`, maxW: collapsedInternal ? styles.item.minH : 'auto', minW: styles.item.minH, p: 0, transitionDuration: "0ms", userSelect: disabled ? 'none' : undefined, ...rest },
24
- React.createElement(Box, { ...styles.item, cursor: cursor, hoverBg: itemTitleHoverBg, justifyContent: "space-between", minH: styles.item.minH, onClick: toggle, p: styles.item.pt, w: "100%" },
25
- !collapsedInternal && React.createElement(Box, { fontWeight: fontWeight }, title),
26
- React.createElement(AccordionItemArrow, { collapsed: collapsedInternal, orientation: "horizontal" })),
27
- !collapsedInternal ? (React.createElement(Box, { p: styles.item.pt, pt: 0, transitionDuration: "0ms" }, children ?? content)) : (React.createElement(Box, { cursor: cursor, flexDirection: "row-reverse", fontWeight: fontWeight, mb: styles.item.minH, mt: styles.item.pt, onClick: toggle, transform: "rotate(-90deg)", transitionDuration: "0ms", whiteSpace: "nowrap" }, title))));
28
- };
29
- export default AccordionItemHorizontal;
@@ -1,12 +0,0 @@
1
- import { CopyToClipboardProps } from './copyToClipboard.types';
2
- /**
3
- * A helper button component.
4
- *
5
- * Copies the provided text to clipboard.
6
- *
7
- * Copying is available only for a secure environment (https://), otherwise the button is disabled.
8
- *
9
- */
10
- export declare const CopyToClipboard: import("../core").VuiComponent<"button", CopyToClipboardProps>;
11
- export default CopyToClipboard;
12
- //# sourceMappingURL=copyToClipboard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/copyToClipboard/copyToClipboard.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAG9D;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,gEAiB1B,CAAA;AAEF,eAAe,eAAe,CAAA"}
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import Button from '../button';
3
- import { vui } from '../core';
4
- import { cs } from '../utils';
5
- import { useCopyToClipboard } from './useCopyToClipboard';
6
- /**
7
- * A helper button component.
8
- *
9
- * Copies the provided text to clipboard.
10
- *
11
- * Copying is available only for a secure environment (https://), otherwise the button is disabled.
12
- *
13
- */
14
- export const CopyToClipboard = vui((props, ref) => {
15
- const { disabled, copyText, className, size = 'xs', variant = 'text', ...rest } = props;
16
- const { copy, isCopyDisabled } = useCopyToClipboard(copyText);
17
- return (React.createElement(Button, { className: cs('vui-copy-to-clipboard', className), disabled: disabled || isCopyDisabled, icon: "falCopy", onClick: () => copy(), ref: ref, size: size, variant: variant, ...rest }));
18
- });
19
- export default CopyToClipboard;
@@ -1,9 +0,0 @@
1
- import { SystemProps } from '../system';
2
- import { ThemingProps } from '../theme';
3
- export declare type CopyToClipboardProps = SystemProps & ThemingProps<'Button'> & {
4
- /** Text string for copying */
5
- copyText: string;
6
- /** Button size @default "xs" */
7
- size?: 'xs' | 'sm' | 'md' | 'lg';
8
- };
9
- //# sourceMappingURL=copyToClipboard.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copyToClipboard.types.d.ts","sourceRoot":"","sources":["../../../src/copyToClipboard/copyToClipboard.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,oBAAY,oBAAoB,GAAG,WAAW,GAC5C,YAAY,CAAC,QAAQ,CAAC,GAAG;IACvB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CACjC,CAAA"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export * from './copyToClipboard';
2
- export { default } from './copyToClipboard';
3
- export * from './copyToClipboard.types';
4
- export * from './useCopyToClipboard';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/copyToClipboard/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA"}
@@ -1,4 +0,0 @@
1
- export * from './copyToClipboard';
2
- export { default } from './copyToClipboard';
3
- export * from './copyToClipboard.types';
4
- export * from './useCopyToClipboard';
@@ -1,5 +0,0 @@
1
- export declare const useCopyToClipboard: (copyText: string) => {
2
- copy: () => void;
3
- isCopyDisabled: boolean;
4
- };
5
- //# sourceMappingURL=useCopyToClipboard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/copyToClipboard/useCopyToClipboard.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,aAAc,MAAM;;;CAYlD,CAAA"}
@@ -1,14 +0,0 @@
1
- import { useToast } from '../toast';
2
- export const useCopyToClipboard = (copyText) => {
3
- const { showSuccess, showError } = useToast();
4
- const isCopyDisabled = !window?.navigator?.clipboard?.writeText;
5
- const copy = () => {
6
- if (!isCopyDisabled) {
7
- window?.navigator?.clipboard
8
- .writeText?.(copyText)
9
- .then(() => showSuccess(`Copied to clipboard: ${copyText}`))
10
- .catch(() => showError('Copy failed'));
11
- }
12
- };
13
- return { copy, isCopyDisabled };
14
- };
@@ -1,96 +0,0 @@
1
- import React, { useEffect, useState } from 'react'
2
-
3
- import Box from '../box'
4
- import { omitThemingProps, useStyleConfig } from '../core'
5
- import { cs } from '../utils'
6
- import { AccordionItemProps } from './accordion.types'
7
- import AccordionItemArrow from './accordionItemArrow'
8
- import { useAccordionContext } from './context'
9
-
10
- /** An accordion item (horizontal orientation). */
11
- export const AccordionItemHorizontal = (props: AccordionItemProps) => {
12
- const {
13
- className,
14
- children,
15
- collapsed,
16
- content,
17
- disabled,
18
- id,
19
- itemTitleHoverBg = 'blue.10',
20
- title,
21
- onToggle,
22
- ...rest
23
- } = omitThemingProps(props)
24
- const [collapsedInternal, setIsCollapsedInternal] = useState<boolean>(false)
25
-
26
- const styles = useStyleConfig('Accordion', useAccordionContext())
27
-
28
- useEffect(() => {
29
- setIsCollapsedInternal(!!collapsed)
30
- }, [collapsed])
31
-
32
- const toggle = () => {
33
- if (!disabled) {
34
- onToggle?.({ id, collapsed: !collapsedInternal })
35
- setIsCollapsedInternal(!collapsedInternal)
36
- }
37
- }
38
-
39
- const cursor = disabled ? 'not-allowed' : 'pointer'
40
- const fontWeight = typeof title === 'string' ? '500' : 'inherit'
41
-
42
- return (
43
- <Box
44
- alignItems={collapsedInternal ? 'normal' : 'baseline'}
45
- bg={disabled ? 'disabled.bg' : undefined}
46
- borderRight="1px solid grey.40"
47
- className={cs('vui-accordion-item-horizontal', className)}
48
- color={disabled ? 'disabled.color' : undefined}
49
- column
50
- cursor={disabled ? 'not-allowed' : undefined}
51
- id={`${id}`}
52
- maxW={collapsedInternal ? styles.item.minH : 'auto'}
53
- minW={styles.item.minH}
54
- p={0}
55
- transitionDuration="0ms"
56
- userSelect={disabled ? 'none' : undefined}
57
- {...rest}
58
- >
59
- <Box
60
- {...styles.item}
61
- cursor={cursor}
62
- hoverBg={itemTitleHoverBg}
63
- justifyContent="space-between"
64
- minH={styles.item.minH}
65
- onClick={toggle}
66
- p={styles.item.pt}
67
- w="100%"
68
- >
69
- {!collapsedInternal && <Box fontWeight={fontWeight}>{title}</Box>}
70
- <AccordionItemArrow collapsed={collapsedInternal} orientation="horizontal" />
71
- </Box>
72
-
73
- {!collapsedInternal ? (
74
- <Box p={styles.item.pt} pt={0} transitionDuration="0ms">
75
- {children ?? content}
76
- </Box>
77
- ) : (
78
- <Box
79
- cursor={cursor}
80
- flexDirection="row-reverse"
81
- fontWeight={fontWeight}
82
- mb={styles.item.minH}
83
- mt={styles.item.pt}
84
- onClick={toggle}
85
- transform="rotate(-90deg)"
86
- transitionDuration="0ms"
87
- whiteSpace="nowrap"
88
- >
89
- {title}
90
- </Box>
91
- )}
92
- </Box>
93
- )
94
- }
95
-
96
- export default AccordionItemHorizontal
@@ -1,36 +0,0 @@
1
- import React from 'react'
2
-
3
- import Button from '../button'
4
- import { vui } from '../core'
5
- import { cs } from '../utils'
6
- import { CopyToClipboardProps } from './copyToClipboard.types'
7
- import { useCopyToClipboard } from './useCopyToClipboard'
8
-
9
- /**
10
- * A helper button component.
11
- *
12
- * Copies the provided text to clipboard.
13
- *
14
- * Copying is available only for a secure environment (https://), otherwise the button is disabled.
15
- *
16
- */
17
- export const CopyToClipboard = vui<'button', CopyToClipboardProps>((props, ref) => {
18
- const { disabled, copyText, className, size = 'xs', variant = 'text', ...rest } = props
19
-
20
- const { copy, isCopyDisabled } = useCopyToClipboard(copyText)
21
-
22
- return (
23
- <Button
24
- className={cs('vui-copy-to-clipboard', className)}
25
- disabled={disabled || isCopyDisabled}
26
- icon="falCopy"
27
- onClick={() => copy()}
28
- ref={ref}
29
- size={size}
30
- variant={variant}
31
- {...rest}
32
- />
33
- )
34
- })
35
-
36
- export default CopyToClipboard
@@ -1,10 +0,0 @@
1
- import { SystemProps } from '../system'
2
- import { ThemingProps } from '../theme'
3
-
4
- export type CopyToClipboardProps = SystemProps &
5
- ThemingProps<'Button'> & {
6
- /** Text string for copying */
7
- copyText: string
8
- /** Button size @default "xs" */
9
- size?: 'xs' | 'sm' | 'md' | 'lg'
10
- }
@@ -1,4 +0,0 @@
1
- export * from './copyToClipboard'
2
- export { default } from './copyToClipboard'
3
- export * from './copyToClipboard.types'
4
- export * from './useCopyToClipboard'