@helpdice/ui 1.7.4 → 1.7.5

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.
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var useTheme = require('components/use-theme');
7
- var styles = require('components/input/styles');
8
6
 
9
7
  function _arrayLikeToArray(r, a) {
10
8
  (null == a || a > r.length) && (a = r.length);
@@ -14,6 +12,14 @@ function _arrayLikeToArray(r, a) {
14
12
  function _arrayWithHoles(r) {
15
13
  if (Array.isArray(r)) return r;
16
14
  }
15
+ function _defineProperty(e, r, t) {
16
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
17
+ value: t,
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true
21
+ }) : e[r] = t, e;
22
+ }
17
23
  function _iterableToArrayLimit(r, l) {
18
24
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
19
25
  if (null != t) {
@@ -41,9 +47,53 @@ function _iterableToArrayLimit(r, l) {
41
47
  function _nonIterableRest() {
42
48
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43
49
  }
50
+ function ownKeys(e, r) {
51
+ var t = Object.keys(e);
52
+ if (Object.getOwnPropertySymbols) {
53
+ var o = Object.getOwnPropertySymbols(e);
54
+ r && (o = o.filter(function (r) {
55
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
56
+ })), t.push.apply(t, o);
57
+ }
58
+ return t;
59
+ }
60
+ function _objectSpread2(e) {
61
+ for (var r = 1; r < arguments.length; r++) {
62
+ var t = null != arguments[r] ? arguments[r] : {};
63
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
64
+ _defineProperty(e, r, t[r]);
65
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
66
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
67
+ });
68
+ }
69
+ return e;
70
+ }
44
71
  function _slicedToArray(r, e) {
45
72
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
46
73
  }
74
+ function _toPrimitive(t, r) {
75
+ if ("object" != typeof t || !t) return t;
76
+ var e = t[Symbol.toPrimitive];
77
+ if (void 0 !== e) {
78
+ var i = e.call(t, r);
79
+ if ("object" != typeof i) return i;
80
+ throw new TypeError("@@toPrimitive must return a primitive value.");
81
+ }
82
+ return ("string" === r ? String : Number)(t);
83
+ }
84
+ function _toPropertyKey(t) {
85
+ var i = _toPrimitive(t, "string");
86
+ return "symbol" == typeof i ? i : i + "";
87
+ }
88
+ function _typeof(o) {
89
+ "@babel/helpers - typeof";
90
+
91
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
92
+ return typeof o;
93
+ } : function (o) {
94
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
95
+ }, _typeof(o);
96
+ }
47
97
  function _unsupportedIterableToArray(r, a) {
48
98
  if (r) {
49
99
  if ("string" == typeof r) return _arrayLikeToArray(r, a);
@@ -1844,6 +1894,287 @@ var countries = [
1844
1894
  }
1845
1895
  ];
1846
1896
 
1897
+ var defaultFont = {
1898
+ sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
1899
+ mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
1900
+ prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
1901
+ };
1902
+ var defaultBreakpoints = {
1903
+ xs: {
1904
+ min: '0',
1905
+ max: '650px'
1906
+ },
1907
+ sm: {
1908
+ min: '650px',
1909
+ max: '900px'
1910
+ },
1911
+ md: {
1912
+ min: '900px',
1913
+ max: '1280px'
1914
+ },
1915
+ lg: {
1916
+ min: '1280px',
1917
+ max: '1920px'
1918
+ },
1919
+ xl: {
1920
+ min: '1920px',
1921
+ max: '10000px'
1922
+ }
1923
+ };
1924
+ var defaultLayout = {
1925
+ gap: '16pt',
1926
+ gapNegative: '-16pt',
1927
+ gapHalf: '8pt',
1928
+ gapHalfNegative: '-8pt',
1929
+ gapQuarter: '4pt',
1930
+ gapQuarterNegative: '-4pt',
1931
+ pageMargin: '16pt',
1932
+ pageWidth: '750pt',
1933
+ pageWidthWithMargin: '782pt',
1934
+ breakpointMobile: defaultBreakpoints.xs.max,
1935
+ breakpointTablet: defaultBreakpoints.sm.max,
1936
+ radius: '6px',
1937
+ unit: '16px'
1938
+ };
1939
+
1940
+ var palette$1 = {
1941
+ accents_1: '#fafafa',
1942
+ accents_2: '#eaeaea',
1943
+ accents_3: '#999',
1944
+ accents_4: '#888',
1945
+ accents_5: '#666',
1946
+ accents_6: '#444',
1947
+ accents_7: '#333',
1948
+ accents_8: '#111',
1949
+ background: '#fff',
1950
+ foreground: '#000',
1951
+ selection: '#79ffe1',
1952
+ secondary: '#666',
1953
+ code: '#f81ce5',
1954
+ border: '#eaeaea',
1955
+ error: '#e00',
1956
+ errorLight: '#ff1a1a',
1957
+ errorLighter: '#f7d4d6',
1958
+ errorDark: '#c50000',
1959
+ success: '#0070f3',
1960
+ successLight: '#3291ff',
1961
+ successLighter: '#d3e5ff',
1962
+ successDark: '#0761d1',
1963
+ warning: '#f5a623',
1964
+ warningLight: '#f7b955',
1965
+ warningLighter: '#ffefcf',
1966
+ warningDark: '#ab570a',
1967
+ cyan: '#50e3c2',
1968
+ cyanLighter: '#aaffec',
1969
+ cyanLight: '#79ffe1',
1970
+ cyanDark: '#29bc9b',
1971
+ violet: '#7928ca',
1972
+ violetLighter: '#e3d7fc',
1973
+ violetLight: '#8a63d2',
1974
+ violetDark: '#4c2889',
1975
+ purple: '#f81ce5',
1976
+ alert: '#ff0080',
1977
+ magenta: '#eb367f',
1978
+ link: '#0070f3'
1979
+ };
1980
+ var expressiveness$1 = {
1981
+ linkStyle: 'none',
1982
+ linkHoverStyle: 'none',
1983
+ dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
1984
+ scrollerStart: 'rgba(255, 255, 255, 1)',
1985
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
1986
+ shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
1987
+ shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
1988
+ shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
1989
+ portalOpacity: 0.25
1990
+ };
1991
+ var font$1 = defaultFont;
1992
+ var breakpoints$1 = defaultBreakpoints;
1993
+ var layout$1 = defaultLayout;
1994
+ var themes$1 = {
1995
+ type: 'light',
1996
+ font: font$1,
1997
+ layout: layout$1,
1998
+ palette: palette$1,
1999
+ breakpoints: breakpoints$1,
2000
+ expressiveness: expressiveness$1
2001
+ };
2002
+
2003
+ var palette = {
2004
+ accents_1: '#111',
2005
+ accents_2: '#333',
2006
+ accents_3: '#444',
2007
+ accents_4: '#666',
2008
+ accents_5: '#888',
2009
+ accents_6: '#999',
2010
+ accents_7: '#eaeaea',
2011
+ accents_8: '#fafafa',
2012
+ background: '#000',
2013
+ foreground: '#fff',
2014
+ selection: '#f81ce5',
2015
+ secondary: '#888',
2016
+ code: '#79ffe1',
2017
+ border: '#333',
2018
+ error: '#e00',
2019
+ errorLighter: '#f7d4d6',
2020
+ errorLight: '#ff1a1a',
2021
+ errorDark: '#c50000',
2022
+ success: '#0070f3',
2023
+ successLighter: '#d3e5ff',
2024
+ successLight: '#3291ff',
2025
+ successDark: '#0761d1',
2026
+ warning: '#f5a623',
2027
+ warningLighter: '#ffefcf',
2028
+ warningLight: '#f7b955',
2029
+ warningDark: '#ab570a',
2030
+ cyan: '#50e3c2',
2031
+ cyanLighter: '#aaffec',
2032
+ cyanLight: '#79ffe1',
2033
+ cyanDark: '#29bc9b',
2034
+ violet: '#7928ca',
2035
+ violetLighter: '#e3d7fc',
2036
+ violetLight: '#8a63d2',
2037
+ violetDark: '#4c2889',
2038
+ purple: '#f81ce5',
2039
+ alert: '#ff0080',
2040
+ magenta: '#eb367f',
2041
+ link: '#3291ff'
2042
+ };
2043
+ var expressiveness = {
2044
+ linkStyle: 'none',
2045
+ linkHoverStyle: 'none',
2046
+ dropdownBoxShadow: '0 0 0 1px #333',
2047
+ scrollerStart: 'rgba(255, 255, 255, 1)',
2048
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
2049
+ shadowSmall: '0 0 0 1px #333',
2050
+ shadowMedium: '0 0 0 1px #333',
2051
+ shadowLarge: '0 0 0 1px #333',
2052
+ portalOpacity: 0.75
2053
+ };
2054
+ var font = defaultFont;
2055
+ var breakpoints = defaultBreakpoints;
2056
+ var layout = defaultLayout;
2057
+ var themes = {
2058
+ type: 'dark',
2059
+ font: font,
2060
+ layout: layout,
2061
+ palette: palette,
2062
+ breakpoints: breakpoints,
2063
+ expressiveness: expressiveness
2064
+ };
2065
+
2066
+ var isObject = function isObject(target) {
2067
+ return target && _typeof(target) === 'object';
2068
+ };
2069
+ var _deepDuplicable = function deepDuplicable(source, target) {
2070
+ if (!isObject(target) || !isObject(source)) return source;
2071
+ var sourceKeys = Object.keys(source);
2072
+ var result = {};
2073
+ for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
2074
+ var key = _sourceKeys[_i];
2075
+ var sourceValue = source[key];
2076
+ var targetValue = target[key];
2077
+ if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
2078
+ result[key] = targetValue.concat(sourceValue);
2079
+ } else if (isObject(sourceValue) && isObject(targetValue)) {
2080
+ result[key] = _deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
2081
+ } else if (targetValue) {
2082
+ result[key] = targetValue;
2083
+ } else {
2084
+ result[key] = sourceValue;
2085
+ }
2086
+ }
2087
+ return result;
2088
+ };
2089
+ var getPresets = function getPresets() {
2090
+ return [themes$1, themes];
2091
+ };
2092
+ var getPresetStaticTheme = function getPresetStaticTheme() {
2093
+ return themes$1;
2094
+ };
2095
+ var isAvailableThemeType = function isAvailableThemeType(type) {
2096
+ if (!type) return false;
2097
+ var presetThemes = getPresets();
2098
+ var hasType = presetThemes.find(function (theme) {
2099
+ return theme.type === type;
2100
+ });
2101
+ return !hasType;
2102
+ };
2103
+ var isPresetTheme = function isPresetTheme(themeOrType) {
2104
+ if (!themeOrType) return false;
2105
+ var isType = typeof themeOrType === 'string';
2106
+ var type = isType ? themeOrType : themeOrType.type;
2107
+ return !isAvailableThemeType(type);
2108
+ };
2109
+ var hasUserCustomTheme = function hasUserCustomTheme() {
2110
+ var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
2111
+ return !!themes.find(function (item) {
2112
+ return isAvailableThemeType(item.type);
2113
+ });
2114
+ };
2115
+ var create = function create(base, custom) {
2116
+ if (!isAvailableThemeType(custom.type)) {
2117
+ throw new Error('Duplicate or unavailable theme type');
2118
+ }
2119
+ return _deepDuplicable(base, custom);
2120
+ };
2121
+ var createFromDark = function createFromDark(custom) {
2122
+ return create(themes, custom);
2123
+ };
2124
+ var createFromLight = function createFromLight(custom) {
2125
+ return create(themes$1, custom);
2126
+ };
2127
+ var Themes = {
2128
+ isPresetTheme: isPresetTheme,
2129
+ isAvailableThemeType: isAvailableThemeType,
2130
+ hasUserCustomTheme: hasUserCustomTheme,
2131
+ getPresets: getPresets,
2132
+ getPresetStaticTheme: getPresetStaticTheme,
2133
+ create: create,
2134
+ createFromDark: createFromDark,
2135
+ createFromLight: createFromLight
2136
+ };
2137
+
2138
+ /* "use client" */
2139
+
2140
+ var defaultTheme = Themes.getPresetStaticTheme();
2141
+ var ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
2142
+ var useTheme = function useTheme() {
2143
+ return React.useContext(ThemeContext);
2144
+ };
2145
+
2146
+ var getColors = function getColors(palette, status) {
2147
+ var colors = {
2148
+ "default": {
2149
+ color: palette.foreground,
2150
+ borderColor: palette.border,
2151
+ hoverBorder: palette.accents_5
2152
+ },
2153
+ secondary: {
2154
+ color: palette.foreground,
2155
+ borderColor: palette.secondary,
2156
+ hoverBorder: palette.secondary
2157
+ },
2158
+ success: {
2159
+ color: palette.foreground,
2160
+ borderColor: palette.successLight,
2161
+ hoverBorder: palette.success
2162
+ },
2163
+ warning: {
2164
+ color: palette.foreground,
2165
+ borderColor: palette.warningLight,
2166
+ hoverBorder: palette.warning
2167
+ },
2168
+ error: {
2169
+ color: palette.error,
2170
+ borderColor: palette.error,
2171
+ hoverBorder: palette.errorDark
2172
+ }
2173
+ };
2174
+ if (!status) return colors["default"];
2175
+ return colors[status];
2176
+ };
2177
+
1847
2178
  var PhoneInput = function PhoneInput(_ref) {
1848
2179
  var onChange = _ref.onChange,
1849
2180
  _ref$value = _ref.value,
@@ -1879,7 +2210,7 @@ var PhoneInput = function PhoneInput(_ref) {
1879
2210
  setSearchTerm = _useState0[1];
1880
2211
  var dropdownRef = React.useRef(null);
1881
2212
  var _useMemo = React.useMemo(function () {
1882
- return styles.getColors(theme.palette, _color);
2213
+ return getColors(theme.palette, _color);
1883
2214
  }, [theme.palette]),
1884
2215
  borderColor = _useMemo.borderColor,
1885
2216
  hoverBorder = _useMemo.hoverBorder;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { InputTypes } from 'components/input';
2
+ import { InputTypes } from '../input';
3
3
  type PhoneInputProps = {
4
4
  onChange: (data: string) => void;
5
5
  value?: string;
package/dist/index.js CHANGED
@@ -4,8 +4,6 @@ var React = require('react');
4
4
  var reactDom = require('react-dom');
5
5
  var reactDom$1 = require('@floating-ui/react-dom');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
- var useTheme$1 = require('components/use-theme');
8
- var styles = require('components/input/styles');
9
7
  var reactSyntaxHighlighter = require('react-syntax-highlighter');
10
8
  var prism = require('react-syntax-highlighter/dist/cjs/styles/prism');
11
9
  var require$$0 = require('react-is');
@@ -36362,7 +36360,7 @@ var PhoneInput = function PhoneInput(_ref) {
36362
36360
  placeholder = _ref$placeholder === void 0 ? 'Enter phone number' : _ref$placeholder,
36363
36361
  _ref$color = _ref.color,
36364
36362
  _color = _ref$color === void 0 ? 'default' : _ref$color;
36365
- var theme = useTheme$1();
36363
+ var theme = useTheme();
36366
36364
  var defaultValue = country ? countries.findIndex(function (cn) {
36367
36365
  return cn.code == country;
36368
36366
  }) : 103;
@@ -36388,7 +36386,7 @@ var PhoneInput = function PhoneInput(_ref) {
36388
36386
  setSearchTerm = _useState0[1];
36389
36387
  var dropdownRef = React.useRef(null);
36390
36388
  var _useMemo = React.useMemo(function () {
36391
- return styles.getColors(theme.palette, _color);
36389
+ return getColors$8(theme.palette, _color);
36392
36390
  }, [theme.palette]),
36393
36391
  borderColor = _useMemo.borderColor,
36394
36392
  hoverBorder = _useMemo.hoverBorder;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { InputTypes } from 'components/input';
2
+ import { InputTypes } from '../input';
3
3
  type PhoneInputProps = {
4
4
  onChange: (data: string) => void;
5
5
  value?: string;
@@ -2,8 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _JSXStyle from "../styled-jsx.es.js";
3
3
  import React, { useState, useRef, useEffect, useMemo } from 'react';
4
4
  import countries from './countries.json';
5
- import useTheme from 'components/use-theme';
6
- import { getColors } from 'components/input/styles';
5
+ import useTheme from '../use-theme';
6
+ import { getColors } from '../input/styles';
7
7
  var PhoneInput = function PhoneInput(_ref) {
8
8
  var onChange = _ref.onChange,
9
9
  _ref$value = _ref.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpdice/ui",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "unpkg": "dist/index.min.js",
@@ -57,7 +57,6 @@
57
57
  "@babel/preset-env": "^7.14.7",
58
58
  "@babel/preset-react": "^7.14.5",
59
59
  "@babel/preset-typescript": "^7.14.5",
60
- "@helpdice/pro": "D:\\Github\\pro\\build",
61
60
  "@mapbox/rehype-prism": "^0.9.0",
62
61
  "@mdx-js/loader": "^3.1.0",
63
62
  "@mdx-js/react": "^3.1.0",
@@ -101,6 +100,7 @@
101
100
  "dependencies": {
102
101
  "@floating-ui/react-dom": "^2.1.3",
103
102
  "@helpdice/icons": "^1.1.2",
103
+ "@helpdice/pro": "D:\\Github\\build",
104
104
  "@mapbox/rehype-prism": "^0.9.0",
105
105
  "@types/hoist-non-react-statics": "^3.3.6",
106
106
  "@types/styled-components": "^5.1.34",