UNPKG

@utrecht/component-library-react

Version:

React component library bundle for the Municipality of Utrecht based on the NL Design System architecture

121 lines (116 loc) 3.99 kB
import css from '@utrecht/vega-visualization-css/dist/index.mjs'; import _defineProperty from '@babel/runtime/helpers/defineProperty'; import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties'; import { jsx } from 'react/jsx-runtime'; import clsx from 'clsx'; import { Vega } from 'react-vega'; var insertStyle = function insertStyle(css) { if (typeof document !== 'undefined') { var head = document.head || document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.appendChild(document.createTextNode(css)); head.appendChild(style); } }; var _excluded = ["actions", "className", "config", "label"]; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } var defaultConfig = { font: 'var(--utrecht-vega-visualization-font-family, var(--utrecht-document-font-family))', title: { fontSize: 20, anchor: 'start', offset: 32, subtitleFontSize: 16 }, range: { category: { scheme: 'set1' } }, axis: { labelFontSize: 16, titleFontSize: 16, labelFontWeight: 'bold', titleFontWeight: 'normal', labelAngle: 0, ticks: false, labelPadding: 12, domainColor: 'var(--utrecht-vega-visualization-axis-domain-color, black)', gridColor: 'var(--utrecht-vega-visualization-axis-grid-color, gray)', tickColor: 'var(--utrecht-vega-visualization-axis-tick-color, black)' }, axisY: { titleAngle: 0, titleX: 0, titleY: 7, titleAlign: 'left', titleFontWeight: 'bold', domain: false }, legend: { labelFontSize: 16, titleFontSize: 16 }, bar: { width: { band: 0.85 } }, view: { stroke: null }, padding: { left: 20, top: 20, right: 25, bottom: 20 }, locale: { number: { decimal: ',', thousands: '.', grouping: [3], currency: ['', "\xA0\u20AC"] }, time: { dateTime: '%a %e %B %Y %X', date: '%d-%m-%Y', time: '%H:%M:%S', periods: ['AM', 'PM'], days: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], shortDays: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], months: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], shortMonths: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'] } } }; var VegaVisualization = function VegaVisualization(_ref) { var _ref$actions = _ref.actions, actions = _ref$actions === void 0 ? false : _ref$actions, className = _ref.className, config = _ref.config, label = _ref.label, restProps = _objectWithoutProperties(_ref, _excluded); return jsx("div", { className: clsx('utrecht-vega-visualization', className), role: "img", "aria-label": label, children: jsx("div", { "aria-hidden": true, children: jsx(Vega, _objectSpread(_objectSpread({}, restProps), {}, { actions: actions, renderer: 'svg', config: _objectSpread(_objectSpread({}, defaultConfig), config) })) }) }); }; /** * @license EUPL-1.2 * Copyright (c) 2020-2024 Frameless B.V. * Copyright (c) 2021-2024 Gemeente Utrecht */ insertStyle(css); export { VegaVisualization }; //# sourceMappingURL=VegaVisualization.mjs.map