labellife-design-tool 2.1.5 → 2.1.7

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.
@@ -1708,7 +1708,7 @@ function parseDateFromFormat(dateStr, format) {
1708
1708
  return new Date();
1709
1709
  }
1710
1710
 
1711
- // ── Default single-field dialog ──────────────────────────────────────
1711
+ // ── Default single-field dialog (full-page overlay) ──────────────────
1712
1712
  var SingleFieldDialog = function SingleFieldDialog(_ref) {
1713
1713
  var field = _ref.field,
1714
1714
  onSubmit = _ref.onSubmit,
@@ -1730,6 +1730,10 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
1730
1730
  var promptText = custom.promptText || custom.placeholder || 'Please provide input';
1731
1731
  var dateFormat = custom.dateFormat || 'MM-DD-YYYY';
1732
1732
  var isRequired = custom.required === true;
1733
+ var logoUrl = config.logoUrl || null;
1734
+ var headerText = config.headerText || null;
1735
+ var accentColor = config.accentColor || '#0d83cd';
1736
+ var progressPct = Math.round((currentIndex + 1) / totalCount * 100);
1733
1737
  react.useEffect(function () {
1734
1738
  setValue('');
1735
1739
  setImagePreview(null);
@@ -1757,11 +1761,25 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
1757
1761
  }
1758
1762
  };
1759
1763
  var handleKeyDown = function handleKeyDown(e) {
1760
- if (e.key === 'Enter') {
1761
- handleSubmit();
1762
- }
1764
+ if (e.key === 'Enter' && inputType !== 'image') handleSubmit();
1763
1765
  };
1764
1766
  var renderInput = function renderInput() {
1767
+ var sharedSx = _objectSpread2({
1768
+ mt: 1,
1769
+ '& .MuiOutlinedInput-root': {
1770
+ borderRadius: '8px',
1771
+ fontSize: 22,
1772
+ '& fieldset': {
1773
+ borderColor: '#d0d5dd'
1774
+ },
1775
+ '&:hover fieldset': {
1776
+ borderColor: accentColor
1777
+ },
1778
+ '&.Mui-focused fieldset': {
1779
+ borderColor: accentColor
1780
+ }
1781
+ }
1782
+ }, config.inputStyle);
1765
1783
  switch (inputType) {
1766
1784
  case 'date':
1767
1785
  return /*#__PURE__*/jsxRuntime.jsx(material.TextField, {
@@ -1773,13 +1791,10 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
1773
1791
  },
1774
1792
  onKeyDown: handleKeyDown,
1775
1793
  autoFocus: true,
1776
- size: "small",
1777
- sx: _objectSpread2({
1778
- mt: 1
1779
- }, config.inputStyle),
1780
1794
  InputLabelProps: {
1781
1795
  shrink: true
1782
- }
1796
+ },
1797
+ sx: sharedSx
1783
1798
  });
1784
1799
  case 'integer':
1785
1800
  return /*#__PURE__*/jsxRuntime.jsx(material.TextField, {
@@ -1788,20 +1803,15 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
1788
1803
  value: value,
1789
1804
  onChange: function onChange(e) {
1790
1805
  var v = e.target.value;
1791
- if (v === '' || /^-?\d*$/.test(v)) {
1792
- setValue(v);
1793
- }
1806
+ if (v === '' || /^-?\d*$/.test(v)) setValue(v);
1794
1807
  },
1795
1808
  onKeyDown: handleKeyDown,
1796
1809
  autoFocus: true,
1797
- size: "small",
1798
1810
  placeholder: "0",
1799
1811
  inputProps: {
1800
1812
  step: 1
1801
1813
  },
1802
- sx: _objectSpread2({
1803
- mt: 1
1804
- }, config.inputStyle)
1814
+ sx: sharedSx
1805
1815
  });
1806
1816
  case 'image':
1807
1817
  return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
@@ -1821,13 +1831,13 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
1821
1831
  display: 'flex',
1822
1832
  flexDirection: 'column',
1823
1833
  alignItems: 'center',
1824
- gap: 1.5
1834
+ gap: 2
1825
1835
  },
1826
1836
  children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
1827
1837
  sx: {
1828
1838
  width: '100%',
1829
- maxHeight: 220,
1830
- borderRadius: 1,
1839
+ maxHeight: 260,
1840
+ borderRadius: '10px',
1831
1841
  overflow: 'hidden',
1832
1842
  border: '1px solid #e0e0e0',
1833
1843
  display: 'flex',
@@ -1840,20 +1850,21 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
1840
1850
  alt: "Preview",
1841
1851
  style: {
1842
1852
  maxWidth: '100%',
1843
- maxHeight: 220,
1853
+ maxHeight: 260,
1844
1854
  objectFit: 'contain'
1845
1855
  }
1846
1856
  })
1847
1857
  }), /*#__PURE__*/jsxRuntime.jsx(material.Button, {
1848
1858
  variant: "outlined",
1849
- size: "small",
1850
1859
  onClick: function onClick() {
1851
1860
  var _fileInputRef$current;
1852
1861
  return (_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 ? void 0 : _fileInputRef$current.click();
1853
1862
  },
1854
1863
  sx: {
1855
1864
  textTransform: 'none',
1856
- fontSize: 12
1865
+ fontSize: 13,
1866
+ borderRadius: '8px',
1867
+ borderColor: '#d0d5dd'
1857
1868
  },
1858
1869
  children: t('inputFieldsDialog.changeImage', 'Change Image')
1859
1870
  })]
@@ -1863,28 +1874,28 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
1863
1874
  return (_fileInputRef$current2 = fileInputRef.current) === null || _fileInputRef$current2 === void 0 ? void 0 : _fileInputRef$current2.click();
1864
1875
  },
1865
1876
  sx: {
1866
- border: '2px dashed #ccc',
1867
- borderRadius: '8px',
1868
- p: 3,
1877
+ border: '2px dashed #d0d5dd',
1878
+ borderRadius: '10px',
1879
+ p: 4,
1869
1880
  textAlign: 'center',
1870
1881
  cursor: 'pointer',
1871
1882
  transition: 'all 0.2s ease',
1872
1883
  '&:hover': {
1873
- borderColor: '#0d83cd',
1874
- backgroundColor: 'rgba(13,131,205,0.04)'
1884
+ borderColor: accentColor,
1885
+ backgroundColor: 'rgba(13,131,205,0.03)'
1875
1886
  }
1876
1887
  },
1877
1888
  children: [/*#__PURE__*/jsxRuntime.jsx(CloudUploadIcon, {
1878
1889
  sx: {
1879
- fontSize: 36,
1880
- color: '#999',
1881
- mb: 1
1890
+ fontSize: 40,
1891
+ color: '#bbb',
1892
+ mb: 1.5
1882
1893
  }
1883
1894
  }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
1884
1895
  variant: "body2",
1885
1896
  sx: {
1886
- color: '#666',
1887
- fontSize: 13
1897
+ color: '#888',
1898
+ fontSize: 14
1888
1899
  },
1889
1900
  children: t('inputFieldsDialog.uploadImage', 'Click to select an image')
1890
1901
  })]
@@ -1901,77 +1912,157 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
1901
1912
  },
1902
1913
  onKeyDown: handleKeyDown,
1903
1914
  autoFocus: true,
1904
- size: "small",
1905
1915
  placeholder: custom.placeholder || '',
1906
- sx: _objectSpread2({
1907
- mt: 1
1908
- }, config.inputStyle)
1916
+ sx: sharedSx
1909
1917
  });
1910
1918
  }
1911
1919
  };
1912
- return /*#__PURE__*/jsxRuntime.jsxs(material.Dialog, {
1913
- open: true,
1914
- maxWidth: "sm",
1915
- fullWidth: true,
1916
- PaperProps: {
1917
- sx: _objectSpread2({
1918
- borderRadius: 2
1919
- }, config.dialogStyle)
1920
- },
1921
- children: [/*#__PURE__*/jsxRuntime.jsxs(material.DialogTitle, {
1920
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
1921
+ sx: _objectSpread2({
1922
+ position: 'fixed',
1923
+ inset: 0,
1924
+ zIndex: 9999,
1925
+ backgroundColor: '#f7f8fa',
1926
+ display: 'flex',
1927
+ flexDirection: 'column'
1928
+ }, config.dialogStyle),
1929
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
1930
+ sx: {
1931
+ height: 4,
1932
+ backgroundColor: '#e4e7ec',
1933
+ flexShrink: 0
1934
+ },
1935
+ children: /*#__PURE__*/jsxRuntime.jsx(material.Box, {
1936
+ sx: {
1937
+ height: '100%',
1938
+ width: "".concat(progressPct, "%"),
1939
+ backgroundColor: accentColor,
1940
+ transition: 'width 0.4s ease'
1941
+ }
1942
+ })
1943
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
1922
1944
  sx: _objectSpread2({
1923
- fontSize: 16,
1924
- fontWeight: 600,
1925
- pb: 0
1945
+ backgroundColor: '#fff',
1946
+ borderBottom: '1px solid #f0f0f0',
1947
+ display: 'flex',
1948
+ alignItems: 'center',
1949
+ justifyContent: 'center',
1950
+ px: 4,
1951
+ py: 1.75,
1952
+ flexShrink: 0
1926
1953
  }, config.titleStyle),
1927
- children: [t('inputFieldsDialog.title', 'Input Required'), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
1928
- variant: "caption",
1954
+ children: /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
1929
1955
  sx: {
1930
- display: 'block',
1931
- color: '#999',
1932
- mt: 0.5
1956
+ display: 'flex',
1957
+ alignItems: 'center',
1958
+ gap: 1.5
1933
1959
  },
1934
- children: t('inputFieldsDialog.stepIndicator', 'Field {current} of {total}').replace('{current}', currentIndex + 1).replace('{total}', totalCount)
1935
- })]
1936
- }), /*#__PURE__*/jsxRuntime.jsxs(material.DialogContent, {
1937
- sx: {
1938
- pt: 2
1939
- },
1940
- children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
1941
- variant: "body1",
1942
- sx: _objectSpread2({
1943
- mb: 1,
1944
- fontWeight: 500
1945
- }, config.promptStyle),
1946
- children: promptText
1947
- }), renderInput()]
1948
- }), /*#__PURE__*/jsxRuntime.jsxs(material.DialogActions, {
1960
+ children: [logoUrl && /*#__PURE__*/jsxRuntime.jsx("img", {
1961
+ src: logoUrl,
1962
+ alt: "Logo",
1963
+ style: {
1964
+ maxHeight: 36,
1965
+ maxWidth: 200,
1966
+ objectFit: 'contain'
1967
+ }
1968
+ }), (headerText || !logoUrl) && /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
1969
+ sx: {
1970
+ fontWeight: 700,
1971
+ fontSize: 17,
1972
+ color: '#1a1a1a',
1973
+ letterSpacing: '-0.2px'
1974
+ },
1975
+ children: headerText || 'LabelLife'
1976
+ })]
1977
+ })
1978
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
1949
1979
  sx: {
1950
- px: 3,
1951
- pb: 2
1980
+ flex: 1,
1981
+ display: 'flex',
1982
+ alignItems: 'center',
1983
+ justifyContent: 'center',
1984
+ p: {
1985
+ xs: 3,
1986
+ sm: 5
1987
+ },
1988
+ overflowY: 'auto'
1952
1989
  },
1953
- children: [!isRequired && /*#__PURE__*/jsxRuntime.jsx(material.Button, {
1954
- onClick: function onClick() {
1955
- return onSkip(field.id);
1990
+ children: /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
1991
+ sx: {
1992
+ width: '100%',
1993
+ maxWidth: 750
1956
1994
  },
1957
- sx: _objectSpread2({
1958
- textTransform: 'none',
1959
- color: '#999'
1960
- }, config.skipButtonStyle),
1961
- children: config.skipButtonText || t('inputFieldsDialog.skip', 'Skip')
1962
- }), /*#__PURE__*/jsxRuntime.jsx(material.Button, {
1963
- onClick: handleSubmit,
1964
- variant: "contained",
1965
- disabled: isRequired && !value,
1966
- sx: _objectSpread2({
1967
- textTransform: 'none',
1968
- backgroundColor: '#0d83cd',
1969
- '&:hover': {
1970
- backgroundColor: '#0a6eb3'
1971
- }
1972
- }, config.submitButtonStyle),
1973
- children: config.submitButtonText || t('inputFieldsDialog.submit', 'Confirm')
1974
- })]
1995
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
1996
+ sx: {
1997
+ display: 'block',
1998
+ fontSize: 18,
1999
+ color: '#999',
2000
+ fontWeight: 500,
2001
+ mb: 1.5,
2002
+ letterSpacing: '0.2px'
2003
+ },
2004
+ children: t('inputFieldsDialog.stepIndicator', 'Field {current} of {total}').replace('{current}', currentIndex + 1).replace('{total}', totalCount)
2005
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
2006
+ sx: _objectSpread2({
2007
+ fontSize: {
2008
+ xs: 33,
2009
+ sm: 39
2010
+ },
2011
+ fontWeight: 700,
2012
+ color: '#111827',
2013
+ lineHeight: 1.3,
2014
+ mb: 4.5
2015
+ }, config.promptStyle),
2016
+ children: promptText
2017
+ }), renderInput(), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
2018
+ sx: {
2019
+ display: 'flex',
2020
+ alignItems: 'center',
2021
+ gap: 2,
2022
+ mt: 4.5
2023
+ },
2024
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Button, {
2025
+ variant: "contained",
2026
+ onClick: handleSubmit,
2027
+ disabled: isRequired && !value,
2028
+ sx: _objectSpread2({
2029
+ textTransform: 'none',
2030
+ fontWeight: 600,
2031
+ fontSize: 21,
2032
+ px: 5,
2033
+ py: 1.65,
2034
+ borderRadius: '10px',
2035
+ backgroundColor: accentColor,
2036
+ boxShadow: 'none',
2037
+ '&:hover': {
2038
+ backgroundColor: '#0a6eb3',
2039
+ boxShadow: 'none'
2040
+ }
2041
+ }, config.submitButtonStyle),
2042
+ children: config.submitButtonText || t('inputFieldsDialog.submit', 'Continue')
2043
+ }), !isRequired && /*#__PURE__*/jsxRuntime.jsx(material.Button, {
2044
+ variant: "outlined",
2045
+ onClick: function onClick() {
2046
+ return onSkip(field.id);
2047
+ },
2048
+ sx: _objectSpread2({
2049
+ textTransform: 'none',
2050
+ fontWeight: 500,
2051
+ fontSize: 21,
2052
+ px: 4.5,
2053
+ py: 1.65,
2054
+ borderRadius: '10px',
2055
+ color: '#555',
2056
+ borderColor: '#d0d5dd',
2057
+ '&:hover': {
2058
+ borderColor: '#aaa',
2059
+ backgroundColor: 'rgba(0,0,0,0.02)'
2060
+ }
2061
+ }, config.skipButtonStyle),
2062
+ children: config.skipButtonText || t('inputFieldsDialog.skip', 'Do it later')
2063
+ })]
2064
+ })]
2065
+ })
1975
2066
  })]
1976
2067
  });
1977
2068
  };