UNPKG

@hhgtech/hhg-components

Version:
117 lines (109 loc) • 6.75 kB
import { D as DEBOUNCED_TIME, j as StyledSliderWrapper, k as StyledSlider } from './index-bd44bcb2.js'; export { l as Accordion, b as Anchor, c as AspectRatio, A as Avatar, B as Breadcrumbs, a as Carousel, f as CentralCarousel, d as Checkbox, g as ChipButton, e as ErrorLabel, I as Input, O as OTP, P as Phone, n as PhoneInput, o as Popover, R as Radio, S as Select, m as emotionCache } from './index-bd44bcb2.js'; export { D as DatePicker } from './index-0861b084.js'; export { T as Text } from './index-0b67696c.js'; import { B as Button } from './index-2d25b0f0.js'; export { B as Button } from './index-2d25b0f0.js'; export { I as Indicator } from './index-08e49d42.js'; export { T as TextArea } from './index-2508cd58.js'; export { M as Modal } from './index-3b8592c9.js'; import { _ as __rest } from './tslib.es6-00ab44b2.js'; import React__default, { useState, useEffect } from 'react'; import { Badge as Badge$1, LoadingOverlay as LoadingOverlay$1, clsx, Title, Text, Button as Button$1 } from '@mantine/core'; import { theme } from './miscTheme.js'; export { S as Spoiler } from './index-d9e2b1d5.js'; import { useDebouncedValue } from '@mantine/hooks'; export { S as Switch } from './index-e1486260.js'; export { M as MantineProvider } from './index-4f530542.js'; export { C as CustomStylesType, F as FontWeight, T as TemplateProvider } from './index-17c85f76.js'; export { M as MAPPED_LOCALE, a as getHeadingStyles, g as getMantineThemeOverride, s as showNotification, t as themeColors, u as useMantineLocale } from './index-3f09210d.js'; export { T as Tabs } from './index-04505e35.js'; import '@hhgtech/icons/other'; import './index-7adf994c.js'; import './constantsDomainLocales.js'; import './Locale-dc1237b9.js'; import './constantsIsProduction.js'; import './index-50aea2c8.js'; import './utils-538169b3.js'; import '@emotion/styled'; import '@mantine/carousel'; import './shared-b07d1eb2.js'; import 'classnames'; import 'uuid'; import './useUniqueId-38cdf062.js'; import './constantsSite.js'; import './index-fe4471f4.js'; import '@emotion/react'; import '@hhgtech/icons/core'; import '@mantine/dates'; import './index-8c40504a.js'; import 'date-fns/locale'; import './constantsRiskScreener.js'; import './index.styles-3adef5f6.js'; import './index-09d9e570.js'; import './translationsContext-18f7b7e0.js'; import 'dayjs'; import '@mantine/notifications'; const Badge = (_a) => { var { color = theme.colors.primaryBase, styles } = _a, rest = __rest(_a, ["color", "styles"]); return (React__default.createElement(Badge$1, Object.assign({ variant: "filled", color: color, styles: Object.assign({ root: { borderRadius: '2px', background: color, textTransform: 'unset', } }, styles) }, rest))); }; function useLockBodyScroll(visible = false) { React__default.useEffect(() => { if (visible) { const originalStyle = window.getComputedStyle(document.body).overflow; document.body.style.overflow = 'hidden'; return () => { document.body.style.overflow = originalStyle; }; } }, [visible]); } const LoadingOverlay = (props) => { useLockBodyScroll(props.visible); return (React__default.createElement(LoadingOverlay$1, Object.assign({ loaderProps: { color: theme.colors.primaryBase, } }, props))); }; const Slider = (_a) => { var { color, withControl, onChange, value, min, max, isStatic, containerClassName, containerStyle } = _a, props = __rest(_a, ["color", "withControl", "onChange", "value", "min", "max", "isStatic", "containerClassName", "containerStyle"]); const [currentValue, setCurrentValue] = useState(value || min || 0); const [debounced] = useDebouncedValue(currentValue, DEBOUNCED_TIME); const increase = () => { setCurrentValue((p) => (max && p === max ? p : p + 1)); }; const decrease = () => { setCurrentValue((p) => (min && p === min ? p : p - 1)); }; useEffect(() => { onChange === null || onChange === void 0 ? void 0 : onChange(debounced); }, [debounced]); useEffect(() => { setCurrentValue(value); }, [value]); return (React__default.createElement(StyledSliderWrapper, { className: containerClassName, style: containerStyle }, withControl && (React__default.createElement(Button, { type: "button", size: "sm", variant: "ghost", onClick: decrease }, React__default.createElement("svg", { width: "10", height: "10", fill: "none", viewBox: "0 0 12 3" }, React__default.createElement("path", { d: "M1 1.004h8", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })))), React__default.createElement(StyledSlider, Object.assign({ thumbSize: 21, labelAlwaysOn: true, radius: "xl", color: color, value: currentValue, onChange: !isStatic ? setCurrentValue : () => null, min: min, max: max }, props, { className: 'hhg-mantine-slider ' + (props.className || '') })), withControl && (React__default.createElement(Button, { type: "button", size: "sm", variant: "ghost", onClick: increase }, React__default.createElement("svg", { width: "16", height: "20", fill: "none", viewBox: "0 0 16 16" }, React__default.createElement("path", { d: "M8 4v8M4 8h8", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })))))); }; var styles = {"container":"MON6sfi","iconContainer":"pS-tJD7","icon":"s3tJ9-5","title":"fNsZr1b","description":"uuxV74v","button":"YohjTDU"}; function Result(props) { const { icon, title, description, button, buttonProps, style, className } = props; const _a = buttonProps || {}, { size = 'lg', variant = 'outline' } = _a, restButtonProps = __rest(_a, ["size", "variant"]); const Icon = icon; return (React__default.createElement("div", { className: clsx('result', styles.container, className), style: style }, Icon && (React__default.createElement("div", { className: clsx('resultIconContainer', styles.iconContainer) }, React__default.createElement(Icon, { className: clsx('resultIcon', styles.icon) }))), React__default.createElement(Title, { order: 3, size: "h3", className: clsx('resultTitle', styles.title) }, title), React__default.createElement(Text, { className: clsx('resultDescription', styles.description) }, description), button && (React__default.createElement(Button$1, Object.assign({}, restButtonProps, { size: size, variant: variant, className: clsx('resultButton', styles.button, restButtonProps.className) }), button)))); } export { Badge, LoadingOverlay, Result, Slider };