@apia/theme 0.3.3 → 0.3.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.
package/LICENSE.md CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) [year] [fullname]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/cleanDist.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "cleanDist": 0.006456232710121412
3
+ }
package/dist/index.d.ts CHANGED
@@ -210,7 +210,7 @@ type TColorDefinition = TColorDefinitionPrimitive & {
210
210
  declare global {
211
211
  interface Window {
212
212
  currentPalette: TParsedPalette;
213
- customPalette?: TPalette;
213
+ customPalettes?: TPalette[];
214
214
  defaultPalette?: TPalette;
215
215
  }
216
216
  }
@@ -376,7 +376,7 @@ declare function getSpacingLayouts(): {
376
376
  interface TThemeProvider {
377
377
  children: ReactNode;
378
378
  customTheme?: () => Omit<Theme, 'palette'>;
379
- customPalette?: TCustomPalette;
379
+ customPalette?: () => TCustomPalette | undefined;
380
380
  themeModifier?: TThemeModifier;
381
381
  }
382
382
  declare const ApiaThemeProvider: ({ children, customTheme, customPalette, themeModifier, }: TThemeProvider) => react.JSX.Element;
@@ -387,4 +387,4 @@ declare module 'theme-ui' {
387
387
  }
388
388
  }
389
389
 
390
- export { ApiaThemeProvider, CustomTheme, TColorDefinition, TPalette, TParsedPalette, TSpacingLayout, TThemeModifier, applyStatesGetColor, focusOutline, getColorState, getColorStates, getColorsAndStatesByDefinition, getColorsAndStatesByPath, getColorsByDefinition, getColorsByPath, getOneColorState, getSpacingLayouts, getVariant, injectStyles, makeStyledComponent, parsePalette, responsive, smallButton, spacing, spacingLayouts, useMainTheme };
390
+ export { ApiaThemeProvider, CustomTheme, TColorDefinition, TCustomPalette, TPalette, TParsedPalette, TSpacingLayout, TThemeModifier, applyStatesGetColor, focusOutline, getColorState, getColorStates, getColorsAndStatesByDefinition, getColorsAndStatesByPath, getColorsByDefinition, getColorsByPath, getOneColorState, getSpacingLayouts, getVariant, injectStyles, makeStyledComponent, parsePalette, responsive, smallButton, spacing, spacingLayouts, useMainTheme };
package/dist/index.js CHANGED
@@ -201,10 +201,10 @@ const defaultPalette = {
201
201
  main: "#fff"
202
202
  },
203
203
  primary: {
204
- main: "#00496c",
205
- light: "#fcfcfc"
204
+ main: "#00496c"
206
205
  },
207
206
  secondary: {
207
+ light: "#fcfcfc",
208
208
  main: "#6c757d"
209
209
  },
210
210
  spacing: (index) => {
@@ -735,7 +735,7 @@ const components$1 = (theme) => {
735
735
  color: palette.text.primary,
736
736
  evenRowsBackgroundColor: palette.background.paper,
737
737
  additionalInfoButton: {
738
- backgroundColor: palette.primary.light,
738
+ backgroundColor: palette.secondary.light,
739
739
  color: "#4e4e4e",
740
740
  borderColor: "transparent"
741
741
  },
@@ -805,13 +805,18 @@ const components$1 = (theme) => {
805
805
  backgroundColor: "",
806
806
  borderColor: ""
807
807
  }
808
+ },
809
+ desktop: {
810
+ windowElement: {
811
+ color: ""
812
+ }
808
813
  }
809
814
  };
810
815
  };
811
816
 
812
817
  var __defProp$o = Object.defineProperty;
813
- var __defProps$d = Object.defineProperties;
814
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
818
+ var __defProps$e = Object.defineProperties;
819
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
815
820
  var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
816
821
  var __hasOwnProp$o = Object.prototype.hasOwnProperty;
817
822
  var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
@@ -827,7 +832,7 @@ var __spreadValues$o = (a, b) => {
827
832
  }
828
833
  return a;
829
834
  };
830
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
835
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
831
836
  const white = "white";
832
837
  function getSelectedColors(palette) {
833
838
  return palette.getColorStates(
@@ -850,7 +855,7 @@ function getThemeColorsObject(theme) {
850
855
  const colors = merge(
851
856
  {},
852
857
  {
853
- palette: __spreadProps$d(__spreadValues$o({}, theme.palette), {
858
+ palette: __spreadProps$e(__spreadValues$o({}, theme.palette), {
854
859
  lightenColor: void 0,
855
860
  darkenColor: void 0,
856
861
  getContrastText: void 0,
@@ -875,7 +880,7 @@ function getThemeColorsObject(theme) {
875
880
  borderColor: theme.palette.border.section,
876
881
  color: theme.palette.primary.contrastText
877
882
  },
878
- close: __spreadProps$d(__spreadValues$o({}, applyStatesGetColor(
883
+ close: __spreadProps$e(__spreadValues$o({}, applyStatesGetColor(
879
884
  {
880
885
  color: theme.palette.text.primary,
881
886
  backgroundColor: theme.palette.background.paper
@@ -887,7 +892,7 @@ function getThemeColorsObject(theme) {
887
892
  collapsibleAsidePanelTitle: {
888
893
  color: theme.palette.text.primary
889
894
  },
890
- deletableInputButton: __spreadProps$d(__spreadValues$o({}, applyStatesGetColor(
895
+ deletableInputButton: __spreadProps$e(__spreadValues$o({}, applyStatesGetColor(
891
896
  {
892
897
  backgroundColor: "transparent",
893
898
  color: theme.palette.secondary.main
@@ -1354,7 +1359,11 @@ const alerts = {
1354
1359
  fontWeight: "normal",
1355
1360
  gap: spacing(3),
1356
1361
  width: "100%",
1357
- wordBreak: "break-word"
1362
+ wordBreak: "break-word",
1363
+ ul: {
1364
+ listStyle: "disc",
1365
+ ml: "20px"
1366
+ }
1358
1367
  },
1359
1368
  ".notification__trace": {
1360
1369
  maxWidth: "100%",
@@ -1394,8 +1403,8 @@ const alerts = {
1394
1403
  };
1395
1404
 
1396
1405
  var __defProp$m = Object.defineProperty;
1397
- var __defProps$c = Object.defineProperties;
1398
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
1406
+ var __defProps$d = Object.defineProperties;
1407
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
1399
1408
  var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
1400
1409
  var __hasOwnProp$m = Object.prototype.hasOwnProperty;
1401
1410
  var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
@@ -1411,7 +1420,7 @@ var __spreadValues$m = (a, b) => {
1411
1420
  }
1412
1421
  return a;
1413
1422
  };
1414
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
1423
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
1415
1424
  const buttons = {
1416
1425
  inherit: {
1417
1426
  color: "inherit",
@@ -1430,7 +1439,7 @@ const buttons = {
1430
1439
  alignItems: "center",
1431
1440
  width: "100%"
1432
1441
  }, getColorsAndStatesByPath("buttons.collapsibleAsidePanelTitle")),
1433
- primary: __spreadProps$c(__spreadValues$m({
1442
+ primary: __spreadProps$d(__spreadValues$m({
1434
1443
  borderWidth: "2px",
1435
1444
  borderStyle: "solid",
1436
1445
  variant: "text.default",
@@ -1518,7 +1527,7 @@ const buttons = {
1518
1527
  variant: "buttons.accordion",
1519
1528
  border: "none"
1520
1529
  }, getColorsAndStatesByPath("buttons.accordionPrimary")),
1521
- icon: __spreadProps$c(__spreadValues$m({
1530
+ icon: __spreadProps$d(__spreadValues$m({
1522
1531
  display: "flex",
1523
1532
  justifyContent: "center",
1524
1533
  alignItems: "center",
@@ -1773,7 +1782,125 @@ const transitions = {
1773
1782
  }
1774
1783
  };
1775
1784
 
1785
+ const menu = {
1786
+ ".szh-menu": (theme) => ({
1787
+ margin: "0",
1788
+ padding: "0.5rem 0",
1789
+ listStyle: "none",
1790
+ boxSizing: "border-box",
1791
+ width: "max-content",
1792
+ zIndex: "contextMenu",
1793
+ border: "1px solid #656565",
1794
+ backgroundColor: theme.palette.background.paper,
1795
+ userSelect: "none",
1796
+ color: theme.palette.text.primary,
1797
+ // 'var(--theme-ui-colors-palette-text-primary)',
1798
+ borderRadius: "0.25rem",
1799
+ boxShadow: "0 3px 7px rgba(0, 0, 0, 0.133), 0 0.6px 2px rgba(0, 0, 0, 0.1)",
1800
+ minWidth: "10rem"
1801
+ }),
1802
+ ".szh-menu__arrow": (theme) => ({
1803
+ boxSizing: "border-box",
1804
+ width: "0.75rem",
1805
+ height: "0.75rem",
1806
+ backgroundColor: theme.palette.background.paper,
1807
+ border: "1px solid transparent",
1808
+ borderLeftColor: "rgba(0, 0, 0, 0.1)",
1809
+ borderTopColor: "rgba(0, 0, 0, 0.1)",
1810
+ zIndex: -1
1811
+ }),
1812
+ ".szh-menu__arrow--dir-left": {
1813
+ right: "-0.375rem",
1814
+ transform: "translateY(-50%) rotate(135deg)"
1815
+ },
1816
+ ".szh-menu__arrow--dir-right": {
1817
+ left: "-0.375rem",
1818
+ transform: "translateY(-50%) rotate(-45deg)"
1819
+ },
1820
+ ".szh-menu__arrow--dir-top": {
1821
+ bottom: "-0.375rem",
1822
+ transform: "translateX(-50%) rotate(-135deg)"
1823
+ },
1824
+ ".szh-menu__arrow--dir-bottom": {
1825
+ top: "-0.375rem",
1826
+ transform: "translateX(-50%) rotate(45deg)"
1827
+ },
1828
+ ".szh-menu__item": {
1829
+ cursor: "pointer",
1830
+ display: "flex",
1831
+ alignItems: "center",
1832
+ position: "relative",
1833
+ padding: "0.375rem 1.5rem",
1834
+ paddingLeft: "2.2rem"
1835
+ },
1836
+ ".szh-menu__item--hover": (theme) => ({
1837
+ backgroundColor: theme.palette.background.default
1838
+ }),
1839
+ ".szh-menu__item--focusable": {
1840
+ cursor: "default"
1841
+ },
1842
+ ".szh-menu__item--disabled": {
1843
+ cursor: "default",
1844
+ color: "#ccc"
1845
+ },
1846
+ ".szh-menu__group": { boxSizing: "border-box" },
1847
+ ".szh-menu__radio-group": {
1848
+ margin: "0",
1849
+ padding: "0",
1850
+ listStyle: "none"
1851
+ },
1852
+ ".szh-menu__divider": {
1853
+ height: "1px",
1854
+ margin: "0.5rem 0",
1855
+ backgroundColor: "rgba(0, 0, 0, 0.12)"
1856
+ },
1857
+ ".szh-menu-button": { boxSizing: "border-box" },
1858
+ ".szh-menu-container--itemTransition .szh-menu__item": {
1859
+ transitionProperty: "background-color, color",
1860
+ transitionDuration: "0.15s",
1861
+ transitionTimingFunction: "ease-in-out"
1862
+ },
1863
+ ".szh-menu__item--type-radio": { paddingLeft: "2.2rem" },
1864
+ ".szh-menu__item--type-radio::before": {
1865
+ content: '"\u25CB"',
1866
+ position: "absolute",
1867
+ left: "0.8rem",
1868
+ top: "0.55rem",
1869
+ fontSize: "0.8rem"
1870
+ },
1871
+ ".szh-menu__item--type-radio.szh-menu__item--checked::before": {
1872
+ content: '"\u25CF"'
1873
+ },
1874
+ ".szh-menu__item--type-checkbox": { paddingLeft: "2.2rem" },
1875
+ ".szh-menu__item--type-checkbox::before": {
1876
+ position: "absolute",
1877
+ left: "0.8rem"
1878
+ },
1879
+ ".szh-menu__item--type-checkbox.szh-menu__item--checked::before": {
1880
+ content: '"\u2714"'
1881
+ },
1882
+ ".szh-menu__submenu>.szh-menu__item": { paddingRight: "2.5rem" },
1883
+ ".szh-menu__submenu>.szh-menu__item::after": {
1884
+ content: '"\u276F"',
1885
+ position: "absolute",
1886
+ right: "1rem"
1887
+ },
1888
+ ".szh-menu__header": {
1889
+ color: "#888",
1890
+ fontSize: "0.8rem",
1891
+ padding: "0.2rem 1.5rem",
1892
+ textTransform: "uppercase"
1893
+ },
1894
+ ".szh-menu__item--anchor,\n.szh-menu__item--anchor:hover,\n.szh-menu__item--anchor:focus,\n.szh-menu__item--anchor:active": (theme) => ({
1895
+ paddingLeft: "2.2rem",
1896
+ textDecoration: "none",
1897
+ color: theme.palette.text.primary
1898
+ })
1899
+ };
1900
+
1776
1901
  var __defProp$l = Object.defineProperty;
1902
+ var __defProps$c = Object.defineProperties;
1903
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
1777
1904
  var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
1778
1905
  var __hasOwnProp$l = Object.prototype.hasOwnProperty;
1779
1906
  var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
@@ -1789,7 +1916,8 @@ var __spreadValues$l = (a, b) => {
1789
1916
  }
1790
1917
  return a;
1791
1918
  };
1792
- const root = __spreadValues$l({
1919
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
1920
+ const root = __spreadValues$l(__spreadProps$c(__spreadValues$l({}, menu), {
1793
1921
  height: "100%",
1794
1922
  "*": {
1795
1923
  fontFamily: "body",
@@ -1910,8 +2038,18 @@ const root = __spreadValues$l({
1910
2038
  },
1911
2039
  ".hidden": {
1912
2040
  display: "none"
2041
+ },
2042
+ ".field__withError": {
2043
+ borderLeftStyle: "solid",
2044
+ borderLeftWidth: "4px",
2045
+ borderLeftColor: "danger"
2046
+ },
2047
+ ".field__touched": {
2048
+ borderStyle: "solid",
2049
+ borderWidth: "1px",
2050
+ borderColor: "touchedBorderColor"
1913
2051
  }
1914
- }, transitions);
2052
+ }), transitions);
1915
2053
 
1916
2054
  const baseTheme = () => {
1917
2055
  return {
@@ -1960,7 +2098,10 @@ const baseTheme = () => {
1960
2098
  tabs: "",
1961
2099
  panel: "rgba(50, 50, 105, 0.15) 0px 2px 5px 0px, rgba(0, 0, 0, 0.05) 0px 1px 1px 0px",
1962
2100
  tableFilters: "3px 3px 3px rgba(0,0,0,0.2)",
1963
- toolbar: "3px 3px 3px rgba(0,0,0,0.1)"
2101
+ toolbar: "3px 3px 3px rgba(0,0,0,0.1)",
2102
+ desktop: {
2103
+ windowElement: "rgba(50, 50, 93, 0.25) 0px 30px 60px -12px, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px"
2104
+ }
1964
2105
  },
1965
2106
  space: [0, 2, 4, 8, 12, 16, 24, 32, 40, 48, 64, 80, 96, 112, 128],
1966
2107
  sizes: {
@@ -2640,7 +2781,7 @@ const apiaApi = {
2640
2781
  const confirm = {
2641
2782
  display: "flex",
2642
2783
  flexDirection: "column",
2643
- gap: spacing$1(5),
2784
+ gap: spacing$1(6),
2644
2785
  width: "100%",
2645
2786
  ".confirm__content": {
2646
2787
  overflow: "auto",
@@ -2666,7 +2807,6 @@ const confirm = {
2666
2807
  };
2667
2808
 
2668
2809
  const buttonsBar = {
2669
- flexBasis: "20%",
2670
2810
  flexDirection: "row",
2671
2811
  display: "flex",
2672
2812
  justifyContent: "flex-end",
@@ -2735,6 +2875,7 @@ const modals = __spreadProps$5(__spreadValues$b({
2735
2875
  overflow: "auto",
2736
2876
  width: "100%",
2737
2877
  flexBasis: "100%",
2878
+ flexDirection: "column",
2738
2879
  flexShrink: 1,
2739
2880
  display: "flex",
2740
2881
  justifyContent: "stretch",
@@ -2917,7 +3058,7 @@ var __spreadValues$9 = (a, b) => {
2917
3058
  return a;
2918
3059
  };
2919
3060
  var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
2920
- const primary$3 = (theme) => {
3061
+ const primary$4 = (theme) => {
2921
3062
  return __spreadProps$3(__spreadValues$9({
2922
3063
  variant: "colors.tables.primary",
2923
3064
  width: "100%",
@@ -3228,7 +3369,6 @@ const accordion$1 = {
3228
3369
  }
3229
3370
  }),
3230
3371
  ".responsiveTable__accordionElement__content": {
3231
- maxHeight: "300px",
3232
3372
  display: "flex",
3233
3373
  flexDirection: "column",
3234
3374
  "& > div": {
@@ -3649,7 +3789,7 @@ const tables = (theme) => {
3649
3789
  return {
3650
3790
  accordion: accordion$1,
3651
3791
  information,
3652
- primary: primary$3(theme),
3792
+ primary: primary$4(theme),
3653
3793
  print,
3654
3794
  responsive: responsive(theme),
3655
3795
  secondary,
@@ -3717,7 +3857,7 @@ var __spreadValues$6 = (a, b) => {
3717
3857
  }
3718
3858
  return a;
3719
3859
  };
3720
- const primary$2 = (theme) => {
3860
+ const primary$3 = (theme) => {
3721
3861
  return {
3722
3862
  /* PREPEND HERE */
3723
3863
  position: "relative",
@@ -3833,7 +3973,20 @@ const primary$2 = (theme) => {
3833
3973
  };
3834
3974
 
3835
3975
  const trees = {
3976
+ primary: primary$3
3977
+ };
3978
+
3979
+ const primary$2 = {
3980
+ background: "white",
3981
+ border: "1px solid #ccc",
3982
+ p: 3,
3983
+ zIndex: "tooltip"
3984
+ /* PREPEND HERE */
3985
+ };
3986
+
3987
+ const tooltips = {
3836
3988
  primary: primary$2
3989
+ /* PREPEND HERE */
3837
3990
  };
3838
3991
 
3839
3992
  var __defProp$5 = Object.defineProperty;
@@ -4145,7 +4298,7 @@ const accordion = {
4145
4298
  borderRadius: "3px"
4146
4299
  },
4147
4300
  ".accordion__item__content": {
4148
- background: "palette.primary.light",
4301
+ background: "palette.secondary.light",
4149
4302
  '[data-variant="link"]': {
4150
4303
  px: 0
4151
4304
  },
@@ -4167,7 +4320,8 @@ const common = (theme) => {
4167
4320
  modals,
4168
4321
  tables: tables(theme),
4169
4322
  components,
4170
- trees
4323
+ trees,
4324
+ tooltips
4171
4325
  /* PREPEND HERE */
4172
4326
  };
4173
4327
  };
@@ -4353,7 +4507,14 @@ const ApiaThemeProvider = ({
4353
4507
  customPalette,
4354
4508
  themeModifier
4355
4509
  }) => {
4356
- const theme = useMainTheme(customTheme, customPalette, themeModifier);
4510
+ const parsedCustomPalette = useMemo(() => {
4511
+ return customPalette == null ? void 0 : customPalette();
4512
+ }, [customPalette]);
4513
+ const theme = useMainTheme(
4514
+ customTheme,
4515
+ parsedCustomPalette,
4516
+ themeModifier
4517
+ );
4357
4518
  logTheme(theme);
4358
4519
  return /* @__PURE__ */ jsx(ThemeProvider, { theme, children });
4359
4520
  };