UNPKG

material.font.features

Version:

Material UI component for displaying opentype font features.

59 lines (58 loc) 3.42 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var jsx_runtime_1 = require("react/jsx-runtime"); var react_1 = __importDefault(require("react")); var react_autobind_1 = __importDefault(require("react-autobind")); var ToggleButton_1 = __importDefault(require("@mui/material/ToggleButton")); var ToggleButtonGroup_1 = __importDefault(require("@mui/material/ToggleButtonGroup")); var Typography_1 = __importDefault(require("@mui/material/Typography")); var AlternateStylePicker = /** @class */ (function (_super) { __extends(AlternateStylePicker, _super); function AlternateStylePicker(props) { var _this = _super.call(this, props) || this; (0, react_autobind_1.default)(_this); return _this; } AlternateStylePicker.prototype.render = function () { var _this = this; return (0, jsx_runtime_1.jsxs)("span", __assign({ style: { display: 'flex', gap: 9, alignItems: 'center' } }, { children: [(0, jsx_runtime_1.jsx)(ToggleButtonGroup_1.default, __assign({ value: this.props.value, exclusive: true, onChange: function (e, value) { if (value === null || value === undefined) return; _this.props.onChange(value); }, "aria-label": this.props.description }, { children: this.props.options.map(function (option, index) { return (0, jsx_runtime_1.jsx)(ToggleButton_1.default, __assign({ value: index, "aria-label": option }, { children: (0, jsx_runtime_1.jsx)(Typography_1.default, { children: (0, jsx_runtime_1.jsx)("span", __assign({ style: { fontFamily: _this.props.fontFamily, fontFeatureSettings: "\"".concat(_this.props.tag, "\" ").concat(index) } }, { children: _this.props.character })) }) }), option); }) })), (0, jsx_runtime_1.jsx)(Typography_1.default, { children: this.props.description })] })); }; AlternateStylePicker.defaultProps = {}; return AlternateStylePicker; }(react_1.default.PureComponent)); exports.default = AlternateStylePicker;