fontdue-js 0.1.0-alpha21 → 0.1.0-alpha24

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 (59) hide show
  1. package/dist/__generated__/CartOrderApplyCouponMutation.graphql.js +9 -2
  2. package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.js +9 -2
  3. package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.js +9 -2
  4. package/dist/__generated__/CartOrderUpdateMutation.graphql.js +9 -2
  5. package/dist/__generated__/CartQuery.graphql.js +9 -2
  6. package/dist/__generated__/CartStateApplyCouponMutation.graphql.js +9 -2
  7. package/dist/__generated__/CartStateRemoveDiscountMutation.graphql.js +9 -2
  8. package/dist/__generated__/CartStateUpdateMutation.graphql.js +9 -2
  9. package/dist/__generated__/CartTotals_order.graphql.d.ts +1 -0
  10. package/dist/__generated__/CartTotals_order.graphql.js +7 -1
  11. package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.js +9 -2
  12. package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.js +9 -2
  13. package/dist/__generated__/PrecartAddToCartMutation.graphql.js +9 -2
  14. package/dist/__generated__/StoreModalCartQuery.graphql.js +9 -2
  15. package/dist/__generated__/StoreModalReviewCompleteOrderMutation.graphql.js +9 -2
  16. package/dist/__generated__/StoreModalReviewQuery.graphql.js +9 -2
  17. package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.js +9 -2
  18. package/dist/__generated__/TypeTesterData_typeTester.graphql.d.ts +1 -0
  19. package/dist/__generated__/TypeTesterData_typeTester.graphql.js +48 -40
  20. package/dist/__generated__/TypeTesterFloatingToolbar_testers.graphql.d.ts +16 -0
  21. package/dist/__generated__/TypeTesterFloatingToolbar_testers.graphql.js +44 -0
  22. package/dist/__generated__/TypeTestersIDQuery.graphql.js +62 -14
  23. package/dist/__generated__/TypeTestersSlugQuery.graphql.js +62 -14
  24. package/dist/__generated__/TypeTesters_collection.graphql.d.ts +7 -1
  25. package/dist/__generated__/TypeTesters_collection.graphql.js +32 -4
  26. package/dist/components/Cart/CartTotals.js +3 -3
  27. package/dist/components/Icons/Align.d.ts +4 -0
  28. package/dist/components/Icons/Align.js +63 -0
  29. package/dist/components/TypeTester/TypeTesterAlignButtons.d.ts +8 -0
  30. package/dist/components/TypeTester/TypeTesterAlignButtons.js +39 -0
  31. package/dist/components/TypeTester/TypeTesterContent.d.ts +6 -2
  32. package/dist/components/TypeTester/TypeTesterContent.js +22 -6
  33. package/dist/components/TypeTester/TypeTesterContext.d.ts +51 -7
  34. package/dist/components/TypeTester/TypeTesterContext.js +119 -9
  35. package/dist/components/TypeTester/TypeTesterFeatures.d.ts +1 -2
  36. package/dist/components/TypeTester/TypeTesterFeatures.js +86 -19
  37. package/dist/components/TypeTester/TypeTesterFeaturesButton.js +1 -1
  38. package/dist/components/TypeTester/TypeTesterFloatingToolbar.d.ts +8 -0
  39. package/dist/components/TypeTester/TypeTesterFloatingToolbar.js +88 -0
  40. package/dist/components/TypeTester/TypeTesterStandalone.d.ts +4 -0
  41. package/dist/components/TypeTester/TypeTesterStandalone.js +19 -7
  42. package/dist/components/TypeTester/TypeTesterState.d.ts +4 -5
  43. package/dist/components/TypeTester/TypeTesterState.js +63 -67
  44. package/dist/components/TypeTester/TypeTesterStyleSelect.js +4 -2
  45. package/dist/components/TypeTester/TypeTesterStyleSelectData.d.ts +1 -1
  46. package/dist/components/TypeTester/TypeTesterStyleSelectData.js +3 -1
  47. package/dist/components/TypeTester/TypeTesterToolbar.d.ts +9 -0
  48. package/dist/components/TypeTester/TypeTesterToolbar.js +57 -0
  49. package/dist/components/TypeTester/index.d.ts +8 -5
  50. package/dist/components/TypeTester/index.js +51 -52
  51. package/dist/components/TypeTester/types.d.ts +1 -0
  52. package/dist/components/TypeTester/useTypeTesterStyler.d.ts +3 -1
  53. package/dist/components/TypeTester/useTypeTesterStyler.js +5 -3
  54. package/dist/components/TypeTesterData/index.js +2 -1
  55. package/dist/components/TypeTesters/index.d.ts +3 -0
  56. package/dist/components/TypeTesters/index.js +66 -18
  57. package/fontdue.css +53 -4
  58. package/fontdue.css.map +1 -1
  59. package/package.json +1 -1
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactRelay = require("react-relay");
11
+
12
+ var _ConfigContext = _interopRequireDefault(require("../ConfigContext"));
13
+
14
+ var _TypeTesterContext = require("./TypeTesterContext");
15
+
16
+ var _TypeTesterFeatures = _interopRequireDefault(require("./TypeTesterFeatures"));
17
+
18
+ var _TypeTesterToolbar = _interopRequireDefault(require("./TypeTesterToolbar"));
19
+
20
+ var _TypeTesterFloatingToolbar_testers;
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
+
28
+ const TypeTesterFloatingToolbar = ({
29
+ testers: testersData,
30
+ features,
31
+ onToolbarOpenClose
32
+ }) => {
33
+ var _testersData$find, _config$typeTester, _config$typeTester2;
34
+
35
+ const config = (0, _react.useContext)(_ConfigContext.default);
36
+ const {
37
+ testers
38
+ } = (0, _react.useContext)(_TypeTesterContext.TypeTesterContext);
39
+ const id = Object.keys(testers).find(id => testers[id].focused);
40
+ const [open, setOpen] = (0, _react.useState)(false); // when focus is lost, we lose the latest id, but we don't want to immediately
41
+ // un-render the toolbar for that id because there's a transition to hide the
42
+ // toolbar. so this keeps the tools rendered with the last non-null id
43
+
44
+ const [activeId, setActiveId] = (0, _react.useState)(id);
45
+ (0, _react.useEffect)(() => {
46
+ if (id) {
47
+ setActiveId(id);
48
+ setOpen(true); // always open if we get a new id
49
+ }
50
+ }, [id]);
51
+ (0, _react.useEffect)(() => {
52
+ let observer = new IntersectionObserver(entries => {
53
+ const entry = entries[0];
54
+ if (!entry.isIntersecting) setOpen(false);
55
+ if (entry.isIntersecting) setOpen(true);
56
+ });
57
+ const typeTesterElement = document.querySelector("[data-type-tester-id=\"".concat(activeId, "\"]"));
58
+ if (!typeTesterElement) return;
59
+ observer.observe(typeTesterElement);
60
+ return () => {
61
+ observer.disconnect();
62
+ };
63
+ }, [activeId]);
64
+ (0, _react.useEffect)(() => {
65
+ onToolbarOpenClose === null || onToolbarOpenClose === void 0 ? void 0 : onToolbarOpenClose(open);
66
+ }, [onToolbarOpenClose, open]);
67
+ const fontStyle = (_testersData$find = testersData.find(tester => tester.id === activeId)) === null || _testersData$find === void 0 ? void 0 : _testersData$find.fontStyle;
68
+ return /*#__PURE__*/_react.default.createElement("div", {
69
+ className: "type-tester__floating-toolbar",
70
+ onMouseDown: e => e.preventDefault(),
71
+ "data-open": activeId && open
72
+ }, activeId && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TypeTesterToolbar.default, {
73
+ id: activeId,
74
+ features: features,
75
+ config: (_config$typeTester = config.typeTester) !== null && _config$typeTester !== void 0 ? _config$typeTester : {}
76
+ }), features && fontStyle && /*#__PURE__*/_react.default.createElement(_TypeTesterFeatures.default, {
77
+ id: activeId,
78
+ features: features,
79
+ fontStyle: fontStyle,
80
+ config: (_config$typeTester2 = config.typeTester) !== null && _config$typeTester2 !== void 0 ? _config$typeTester2 : {}
81
+ })));
82
+ };
83
+
84
+ var _default = (0, _reactRelay.createFragmentContainer)(TypeTesterFloatingToolbar, {
85
+ testers: _TypeTesterFloatingToolbar_testers !== void 0 ? _TypeTesterFloatingToolbar_testers : (_TypeTesterFloatingToolbar_testers = require("../../__generated__/TypeTesterFloatingToolbar_testers.graphql"), _TypeTesterFloatingToolbar_testers.hash && _TypeTesterFloatingToolbar_testers.hash !== "5554933cac70854b361575a5ed0af8ac" && console.error("The definition of 'TypeTesterFloatingToolbar_testers' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterFloatingToolbar_testers)
86
+ });
87
+
88
+ exports.default = _default;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Alignment } from './types';
2
3
  interface TypeTesterStandalone {
3
4
  familyName: string;
4
5
  styleName: string;
@@ -7,7 +8,10 @@ interface TypeTesterStandalone {
7
8
  features?: string;
8
9
  content?: string;
9
10
  direction?: string;
11
+ alignment?: Alignment;
10
12
  autofit?: string;
13
+ onFocus?: () => void;
14
+ onBlur?: () => void;
11
15
  }
12
16
  declare const TypeTesterStandalone: React.FC<TypeTesterStandalone>;
13
17
  export default TypeTesterStandalone;
@@ -28,8 +28,11 @@ const TypeTesterStandalone = ({
28
28
  direction,
29
29
  features,
30
30
  lineHeight,
31
+ alignment,
31
32
  fontSize,
32
- autofit
33
+ autofit,
34
+ onFocus,
35
+ onBlur
33
36
  }) => {
34
37
  const environment = (0, _reactRelay.useRelayEnvironment)();
35
38
  return /*#__PURE__*/_react.default.createElement(_reactRelay.QueryRenderer, {
@@ -46,19 +49,28 @@ const TypeTesterStandalone = ({
46
49
 
47
50
  return /*#__PURE__*/_react.default.createElement(_reactStaticContainer.default, {
48
51
  shouldUpdate: props
49
- }, props && /*#__PURE__*/_react.default.createElement(_TypeTesterContext.default, null, /*#__PURE__*/_react.default.createElement(_index.default, {
52
+ }, props && /*#__PURE__*/_react.default.createElement(_TypeTesterContext.default, {
53
+ testers: {
54
+ standalone: {
55
+ content: content !== null && content !== void 0 ? content : 'The quick brown fox...',
56
+ autofit: parseBool(autofit),
57
+ size: fontSize ? parseFloat(fontSize) : 72,
58
+ lineHeight: lineHeight ? parseFloat(lineHeight) : 1,
59
+ alignment: alignment !== null && alignment !== void 0 ? alignment : 'left'
60
+ }
61
+ }
62
+ }, /*#__PURE__*/_react.default.createElement(_index.default, {
63
+ id: "standalone",
50
64
  fontStyleId: (_props$viewer$fontSty = (_props$viewer = props.viewer) === null || _props$viewer === void 0 ? void 0 : (_props$viewer$fontSty2 = _props$viewer.fontStyle) === null || _props$viewer$fontSty2 === void 0 ? void 0 : _props$viewer$fontSty2.id) !== null && _props$viewer$fontSty !== void 0 ? _props$viewer$fontSty : null,
51
65
  features: (_features$split = features === null || features === void 0 ? void 0 : features.split(',')) !== null && _features$split !== void 0 ? _features$split : [],
52
- content: content !== null && content !== void 0 ? content : 'The quick brown fox...',
53
- size: fontSize ? parseFloat(fontSize) : 72,
54
- lineHeight: lineHeight ? parseFloat(lineHeight) : 1,
55
66
  direction: direction === 'rtl' ? 'rtl' : 'ltr',
56
- autofit: parseBool(autofit),
57
67
  productId: "TODO",
58
68
  config: {
59
69
  groupEdit: false,
60
70
  buyButton: false
61
- }
71
+ },
72
+ onFocus: onFocus,
73
+ onBlur: onBlur
62
74
  })));
63
75
  }
64
76
  });
@@ -1,9 +1,6 @@
1
- import { Content, Size, LineHeight } from './types';
1
+ import { Content, Size, LineHeight, Alignment } from './types';
2
2
  interface TypeTesterStateProps {
3
- autofit: boolean;
4
- initialContent: string;
5
- initialSize: Size;
6
- initialLineHeight: LineHeight;
3
+ id: string;
7
4
  }
8
5
  interface TypeTesterState {
9
6
  autofit: boolean;
@@ -22,6 +19,8 @@ interface TypeTesterState {
22
19
  toggleFeature: (value: string) => void;
23
20
  featuresOpen: boolean;
24
21
  toggleFeaturesOpen: (value?: boolean) => void;
22
+ alignment: Alignment;
23
+ setAlignment: (value: Alignment) => void;
25
24
  }
26
25
  declare const useTypeTesterState: (props: TypeTesterStateProps) => TypeTesterState;
27
26
  export default useTypeTesterState;
@@ -7,89 +7,73 @@ exports.default = void 0;
7
7
 
8
8
  var _react = require("react");
9
9
 
10
- var _draftJs = require("draft-js");
11
-
12
10
  var _TypeTesterContext = require("./TypeTesterContext");
13
11
 
12
+ var _ConfigContext = _interopRequireDefault(require("../ConfigContext"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
14
16
  const useTypeTesterState = ({
15
- autofit,
16
- initialContent,
17
- initialSize,
18
- initialLineHeight
17
+ id
19
18
  }) => {
19
+ var _config$typeTester$to, _config$typeTester;
20
+
21
+ const config = (0, _react.useContext)(_ConfigContext.default);
20
22
  const {
21
- content: groupContent,
22
- size: groupSize,
23
- features: groupFeatures,
24
- mode,
23
+ testers,
24
+ globalFeaturesOpen,
25
25
  dispatch
26
26
  } = (0, _react.useContext)(_TypeTesterContext.TypeTesterContext);
27
- const [content, setContent] = (0, _react.useState)(_draftJs.EditorState.createWithContent(_draftJs.ContentState.createFromText(initialContent)));
28
- const [contentEdited, setContentEdited] = (0, _react.useState)(false);
29
- const [autofitState, setAutofit] = (0, _react.useState)(autofit);
30
- const [size, setSize] = (0, _react.useState)(initialSize);
31
- const [lineHeight, setLineHeight] = (0, _react.useState)(initialLineHeight);
32
- const [focused, setFocused] = (0, _react.useState)(false);
33
- const [features, setFeatures] = (0, _react.useState)([]);
34
- const [featuresOpen, setFeaturesOpen] = (0, _react.useState)(false);
35
- (0, _react.useEffect)(() => {
36
- if (!focused && groupSize) {
37
- setSize(groupSize);
38
- }
39
- }, [groupSize, focused]);
40
- (0, _react.useEffect)(() => {
41
- if (!focused && groupContent) {
42
- setContent(groupContent);
43
- }
44
- }, [groupContent, focused]);
45
- (0, _react.useEffect)(() => {
46
- if (!focused && groupFeatures) {
47
- setFeatures(groupFeatures);
48
- }
49
- }, [groupFeatures, focused]);
27
+ const toolsPosition = (_config$typeTester$to = config === null || config === void 0 ? void 0 : (_config$typeTester = config.typeTester) === null || _config$typeTester === void 0 ? void 0 : _config$typeTester.toolsPosition) !== null && _config$typeTester$to !== void 0 ? _config$typeTester$to : 'inline';
28
+ const {
29
+ content,
30
+ contentEdited,
31
+ size,
32
+ features,
33
+ focused,
34
+ featuresOpen,
35
+ autofit,
36
+ lineHeight,
37
+ alignment
38
+ } = testers[id];
50
39
  return {
51
- autofit: autofitState,
40
+ autofit,
52
41
  content,
53
42
  setContent: value => {
54
- const newContent = value.getCurrentContent(); // prevent broadcasting changes if the content didn't change. without this,
55
- // changes happen if the editor selection updates which is not desirable
56
-
57
- if (content.getCurrentContent() !== newContent) {
58
- setContentEdited(true);
59
-
60
- const copy = _draftJs.EditorState.createWithContent(value.getCurrentContent());
61
-
62
- dispatch({
63
- type: 'SET_CONTENT',
64
- value: mode === 'group' ? copy : null
65
- });
66
- }
67
-
68
- setContent(value);
43
+ dispatch({
44
+ type: 'SET_CONTENT',
45
+ id,
46
+ value
47
+ });
69
48
  },
70
49
  contentEdited,
71
50
  size,
72
- setSize: (value, options = {
73
- auto: false
74
- }) => {
51
+ setSize: value => {
75
52
  dispatch({
76
53
  type: 'SET_SIZE',
77
- value: mode === 'group' ? value : null
54
+ value,
55
+ id
78
56
  });
79
-
80
- if (options.auto === false) {
81
- // auto here means the size was set automatically
82
- setAutofit(false);
83
- }
84
-
85
- setSize(value);
86
57
  },
87
58
  lineHeight,
88
- setLineHeight,
59
+ setLineHeight: value => dispatch({
60
+ type: 'SET_LINE_HEIGHT',
61
+ value,
62
+ id
63
+ }),
64
+ alignment,
65
+ setAlignment: value => dispatch({
66
+ type: 'SET_ALIGNMENT',
67
+ value,
68
+ id
69
+ }),
89
70
  focused,
90
71
  setFocused: value => {
91
- if (value === false) setFeaturesOpen(false);
92
- setFocused(value);
72
+ dispatch({
73
+ type: 'SET_FOCUSED',
74
+ value,
75
+ id
76
+ });
93
77
  },
94
78
  features,
95
79
  toggleFeature: feature => {
@@ -103,12 +87,24 @@ const useTypeTesterState = ({
103
87
 
104
88
  dispatch({
105
89
  type: 'SET_FEATURES',
106
- value: mode === 'group' ? value : null
90
+ value,
91
+ id
107
92
  });
108
- setFeatures(value);
109
93
  },
110
- featuresOpen,
111
- toggleFeaturesOpen: value => setFeaturesOpen(open => value !== null && value !== void 0 ? value : !open)
94
+ featuresOpen: toolsPosition === 'floating' ? globalFeaturesOpen : featuresOpen,
95
+ toggleFeaturesOpen: value => {
96
+ if (toolsPosition === 'floating') {
97
+ dispatch({
98
+ type: 'TOGGLE_GLOBAL_FEATURES_OPEN'
99
+ });
100
+ } else {
101
+ dispatch({
102
+ type: 'SET_FEATURES_OPEN',
103
+ value: value !== null && value !== void 0 ? value : !featuresOpen,
104
+ id
105
+ });
106
+ }
107
+ }
112
108
  };
113
109
  };
114
110
 
@@ -35,7 +35,8 @@ const TypeTesterStyleSelect = ({
35
35
  }, /*#__PURE__*/_react.default.createElement(_DownArrow.default, null), NBSP, selectedFamily.name), /*#__PURE__*/_react.default.createElement("select", {
36
36
  value: selectedFamily.id,
37
37
  onChange: e => onSelectFamilyId(e.target.value),
38
- className: "type-tester-select__select"
38
+ className: "type-tester-select__select",
39
+ onClick: e => e.stopPropagation()
39
40
  }, families.map(({
40
41
  id,
41
42
  name
@@ -49,7 +50,8 @@ const TypeTesterStyleSelect = ({
49
50
  }, /*#__PURE__*/_react.default.createElement(_DownArrow.default, null), " ", selectedFontStyle.name), /*#__PURE__*/_react.default.createElement("select", {
50
51
  value: selectedFontStyleId,
51
52
  onChange: e => onSelectFontStyleId(e.target.value),
52
- className: "type-tester-select__select"
53
+ className: "type-tester-select__select",
54
+ onClick: e => e.stopPropagation()
53
55
  }, selectedFamily.fontStyles.map(({
54
56
  id,
55
57
  name
@@ -3,7 +3,7 @@ import { TypeTesterStyleSelectData_viewer } from '../../__generated__/TypeTester
3
3
  import { TypeTesterConfig } from '.';
4
4
  interface TypeTesterStyleSelectDataProps {
5
5
  fontStyle: TypeTesterStyleSelectData_fontStyle;
6
- viewer: TypeTesterStyleSelectData_viewer;
6
+ viewer: TypeTesterStyleSelectData_viewer | null;
7
7
  onSelectFontStyleId: (value: string) => void;
8
8
  config: TypeTesterConfig;
9
9
  }
@@ -50,7 +50,9 @@ const TypeTesterStyleSelectData = ({
50
50
  onSelectFontStyleId,
51
51
  config
52
52
  }) => {
53
- const familyData = viewer.families && viewer.families.edges && viewer.families.edges.map(edge => edge && edge.node).filter(_utils.notEmpty);
53
+ var _viewer$families, _viewer$families$edge;
54
+
55
+ const familyData = viewer === null || viewer === void 0 ? void 0 : (_viewer$families = viewer.families) === null || _viewer$families === void 0 ? void 0 : (_viewer$families$edge = _viewer$families.edges) === null || _viewer$families$edge === void 0 ? void 0 : _viewer$families$edge.map(edge => edge.node).filter(_utils.notEmpty);
54
56
  const handleSelectFamilyId = (0, _react.useCallback)(id => {
55
57
  const family = familyData && familyData.find(family => family.id === id);
56
58
  if (!family) return;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { TypeTesterConfig } from '.';
3
+ interface TypeTesterToolbar_props {
4
+ id: string;
5
+ features: readonly string[] | null | undefined;
6
+ config: TypeTesterConfig;
7
+ }
8
+ declare const TypeTesterToolbar: React.FC<TypeTesterToolbar_props>;
9
+ export default TypeTesterToolbar;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _TypeTesterFeaturesButton = _interopRequireDefault(require("./TypeTesterFeaturesButton"));
11
+
12
+ var _TypeTesterEditAll = _interopRequireDefault(require("./TypeTesterEditAll"));
13
+
14
+ var _TypeTesterSlider = _interopRequireDefault(require("./TypeTesterSlider"));
15
+
16
+ var _TypeTesterInput = _interopRequireDefault(require("./TypeTesterInput"));
17
+
18
+ var _TypeTesterState = _interopRequireDefault(require("./TypeTesterState"));
19
+
20
+ var _TypeTesterAlignButtons = _interopRequireDefault(require("./TypeTesterAlignButtons"));
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
+
26
+ const TypeTesterToolbar = ({
27
+ id,
28
+ features,
29
+ config
30
+ }) => {
31
+ var _config$min, _config$max, _config$min2, _config$max2;
32
+
33
+ const props = (0, _TypeTesterState.default)({
34
+ id
35
+ });
36
+ return /*#__PURE__*/_react.default.createElement("div", {
37
+ className: "type-tester__toolbar__tools",
38
+ onMouseDown: e => e.preventDefault()
39
+ }, /*#__PURE__*/_react.default.createElement("div", {
40
+ className: "type-tester__slider"
41
+ }, config.textInput && /*#__PURE__*/_react.default.createElement(_TypeTesterInput.default, {
42
+ min: (_config$min = config.min) !== null && _config$min !== void 0 ? _config$min : 10,
43
+ max: (_config$max = config.max) !== null && _config$max !== void 0 ? _config$max : 200,
44
+ value: props.size,
45
+ onChange: props.setSize
46
+ }), /*#__PURE__*/_react.default.createElement(_TypeTesterSlider.default, {
47
+ min: (_config$min2 = config.min) !== null && _config$min2 !== void 0 ? _config$min2 : 10,
48
+ max: (_config$max2 = config.max) !== null && _config$max2 !== void 0 ? _config$max2 : 200,
49
+ value: props.size,
50
+ onChange: props.setSize
51
+ })), Boolean(features === null || features === void 0 ? void 0 : features.length) && /*#__PURE__*/_react.default.createElement(_TypeTesterFeaturesButton.default, props), config.alignmentButtons && /*#__PURE__*/_react.default.createElement(_TypeTesterAlignButtons.default, props), config.groupEdit && /*#__PURE__*/_react.default.createElement(_TypeTesterEditAll.default, _extends({}, props, {
52
+ config: config
53
+ })));
54
+ };
55
+
56
+ var _default = TypeTesterToolbar;
57
+ exports.default = _default;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Alignment } from './types';
2
3
  export interface TypeTesterConfig {
3
4
  min?: number;
4
5
  max?: number;
@@ -9,6 +10,7 @@ export interface TypeTesterConfig {
9
10
  initialMode?: 'group' | 'local';
10
11
  groupEdit?: boolean;
11
12
  shy?: false | true | 'hover' | 'focus';
13
+ toolsPosition?: 'inline' | 'floating';
12
14
  selectButtonStyle?: 'inline' | 'outlined';
13
15
  selectButtonLabel?: string;
14
16
  truncate?: boolean;
@@ -18,17 +20,18 @@ export interface TypeTesterConfig {
18
20
  openTypeFeatures?: {
19
21
  columns?: string[][];
20
22
  };
23
+ alignmentButtons?: boolean;
24
+ initialAlignment?: Alignment;
21
25
  }
22
26
  export interface TypeTesterBaseProps {
27
+ id: string;
23
28
  productId: string;
24
- content: string;
25
- size: number;
26
- lineHeight: number;
27
29
  direction: 'ltr' | 'rtl';
28
30
  onSelectFontStyleId: (value: string) => void;
29
- features: ReadonlyArray<string> | null;
30
- autofit: boolean;
31
+ features?: readonly string[] | null;
31
32
  config?: TypeTesterConfig;
33
+ onFocus?: () => void;
34
+ onBlur?: () => void;
32
35
  }
33
36
  export interface TypeTesterWrapperProps extends Omit<TypeTesterBaseProps, 'onSelectFontStyleId'> {
34
37
  fontStyleId: string | null;