@symbo.ls/uikit 2.11.96 → 2.11.97

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/dist/index.cjs.js CHANGED
@@ -4345,7 +4345,7 @@ var require_inherit = __commonJS({
4345
4345
  }
4346
4346
  return parentState;
4347
4347
  };
4348
- var getChildStateInKey4 = (stateKey, parentState, options = {}) => {
4348
+ var getChildStateInKey4 = (stateKey, parentState, options) => {
4349
4349
  const arr = stateKey.split("/");
4350
4350
  const arrLength = arr.length - 1;
4351
4351
  for (let i = 0; i < arrLength; i++) {
@@ -4525,7 +4525,7 @@ var require_updateState = __commonJS({
4525
4525
  preventUpdate: options.preventHoistElementUpdate,
4526
4526
  overwrite: !options.replace
4527
4527
  });
4528
- const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
4528
+ const hasNotUpdated = !options.preventUpdate || !options.preventHoistElementUpdate;
4529
4529
  if (!options.preventStateUpdateListener && hasNotUpdated) {
4530
4530
  (0, import_event.triggerEventOnUpdate)("stateUpdated", obj, element, options);
4531
4531
  }
@@ -4541,7 +4541,7 @@ var require_updateState = __commonJS({
4541
4541
  };
4542
4542
  var applyElementUpdate = (state, obj, options) => {
4543
4543
  const element = state.__element;
4544
- if (options.preventUpdate !== true) {
4544
+ if (!options.preventUpdate) {
4545
4545
  element.update({}, {
4546
4546
  ...options,
4547
4547
  updateByState: true
@@ -14673,9 +14673,6 @@ var DialogFooter = {
14673
14673
  }
14674
14674
  };
14675
14675
 
14676
- // Datepicker/index.js
14677
- var import_headless_datepicker = __toESM(require_headless_datepicker());
14678
-
14679
14676
  // Datepicker/days.js
14680
14677
  var DatePickerDay = {
14681
14678
  extend: Button,
@@ -14719,119 +14716,41 @@ var DatePickerDay = {
14719
14716
  }
14720
14717
  }
14721
14718
  };
14722
- var DatePickerGrid = {
14719
+
14720
+ // Datepicker/weekdays.js
14721
+ var DatePickerWeekDays = {
14723
14722
  extend: Grid,
14724
14723
  props: {
14724
+ overflow: "hidden",
14725
+ padding: "- Z A",
14726
+ width: "100%",
14725
14727
  columns: "repeat(7, 1fr)",
14726
- minWidth: "100%",
14727
14728
  gap: "W2",
14728
- padding: "- Z"
14729
- },
14730
- childExtend: DatePickerDay,
14731
- $setStateCollection: (el, s) => {
14732
- return s.days;
14733
- },
14734
- on: {
14735
- render: (el, state) => {
14736
- const { key } = el;
14737
- const isSelected = state.parent.parent.activeMonth === parseInt(key);
14738
- if (isSelected) {
14739
- window.requestAnimationFrame(() => {
14740
- el.parent.parent.node.scrollTo({
14741
- left: el.node.offsetLeft,
14742
- behavior: "smooth"
14743
- });
14744
- });
14729
+ style: {
14730
+ button: {
14731
+ padding: "0"
14745
14732
  }
14746
14733
  }
14747
- }
14748
- };
14749
-
14750
- // Datepicker/years.js
14751
- var DatePickerYears = {
14752
- tag: "aside",
14753
- props: {
14754
- overflow: "hidden",
14755
- position: "relative",
14756
- ":before": {
14757
- content: '""',
14758
- boxSize: "A1 100%",
14759
- position: "absolute",
14760
- top: "0",
14761
- left: "0",
14762
- background: "linear-gradient(to bottom, var(--theme-tertiary-dark-background) 0%, transparent 100%)",
14763
- zIndex: "10"
14764
- },
14765
- ":after": {
14766
- content: '""',
14767
- boxSize: "B 100%",
14768
- position: "absolute",
14769
- bottom: "0",
14770
- left: "0",
14771
- background: "linear-gradient(to top, var(--theme-tertiary-dark-background) 0%, transparent 100%)"
14772
- }
14773
14734
  },
14774
- Flex: {
14735
+ childExtend: {
14736
+ tag: "span",
14737
+ extend: Flex,
14775
14738
  props: {
14776
- flow: "column",
14777
- gap: "B",
14778
- padding: "A Z A1 B1",
14779
- maxHeight: "100%",
14780
- overflow: "hidden auto",
14781
- "::-webkit-scrollbar": { display: "none" }
14782
- },
14783
- childExtend: {
14784
- extend: Button,
14785
- props: ({ state, text }) => ({
14786
- fontSize: "Y1",
14787
- color: "white",
14788
- opacity: ".4",
14789
- background: "transparent",
14790
- transition: "opacity .25s ease",
14791
- isSelected: state.activeYear === text,
14792
- ".isSelected": { opacity: "1" },
14793
- ":hover": { opacity: "1" }
14794
- }),
14795
- on: {
14796
- click: (event, element, state) => state.update({ activeYear: element.text }),
14797
- render: (el, state) => {
14798
- const { props: props7 } = el;
14799
- const { isSelected } = props7;
14800
- if (isSelected) {
14801
- window.requestAnimationFrame(() => {
14802
- el.parent.parent.node.scrollTop = el.node.offsetTop - 100;
14803
- });
14804
- }
14805
- }
14806
- }
14807
- },
14808
- $setCollection: ({ state }) => {
14809
- const { yearRange } = state;
14810
- if (yearRange) {
14811
- const [start, end] = yearRange;
14812
- const yearsArray = new Array(end + 1 - start).fill(void 0).map((v, k) => {
14813
- return { text: start + k };
14814
- }).reverse();
14815
- return yearsArray;
14816
- }
14817
- return [
14818
- { text: "2023" },
14819
- { text: "2022" },
14820
- { text: "2021" },
14821
- { text: "2020" },
14822
- { text: "2019" },
14823
- { text: "2018" },
14824
- { text: "2017" },
14825
- { text: "2016" },
14826
- { text: "2015" },
14827
- { text: "2014" },
14828
- { text: "2013" },
14829
- { text: "2012" },
14830
- { text: "2012" },
14831
- { text: "2012" }
14832
- ];
14739
+ fontSize: "Y1",
14740
+ textTransform: "capitalize",
14741
+ align: "center center",
14742
+ ":nth-child(7n-1), &:nth-child(7n)": { opacity: ".5" }
14833
14743
  }
14834
- }
14744
+ },
14745
+ ...[
14746
+ { text: "Mo" },
14747
+ { text: "Tu" },
14748
+ { text: "We" },
14749
+ { text: "Th" },
14750
+ { text: "Fr" },
14751
+ { text: "Sa" },
14752
+ { text: "Su" }
14753
+ ]
14835
14754
  };
14836
14755
 
14837
14756
  // Datepicker/months.js
@@ -14841,7 +14760,7 @@ var DatePickerMonthsSlider = {
14841
14760
  position: "relative",
14842
14761
  overflow: "hidden",
14843
14762
  alignItems: "center",
14844
- padding: "- - B -",
14763
+ padding: "- - A2 -",
14845
14764
  maxWidth: `${272 / 16}em`,
14846
14765
  boxSizing: "border-box",
14847
14766
  ":before": {
@@ -14866,8 +14785,9 @@ var DatePickerMonthsSlider = {
14866
14785
  },
14867
14786
  style: {
14868
14787
  "> button": {
14869
- width: "16px",
14870
- height: "16px",
14788
+ padding: "0",
14789
+ width: "A",
14790
+ height: "A",
14871
14791
  position: "absolute",
14872
14792
  zIndex: "35",
14873
14793
  background: "transparent",
@@ -14903,7 +14823,8 @@ var DatePickerMonthsSlider = {
14903
14823
  Flex: {
14904
14824
  props: {
14905
14825
  flex: "1",
14906
- overflow: "auto hidden",
14826
+ overflow: "hidden",
14827
+ style: { scrollSnapType: "x mandatory" },
14907
14828
  "::-webkit-scrollbar": { display: "none" }
14908
14829
  },
14909
14830
  childExtend: {
@@ -14913,6 +14834,7 @@ var DatePickerMonthsSlider = {
14913
14834
  textAlign: "center",
14914
14835
  boxSizing: "content-box",
14915
14836
  minWidth: "272px",
14837
+ style: { scrollSnapAlign: "center" },
14916
14838
  isSelected: state.activeMonth === parseInt(key),
14917
14839
  ".isSelected": { opacity: "1" }
14918
14840
  }),
@@ -14920,18 +14842,19 @@ var DatePickerMonthsSlider = {
14920
14842
  update: (el, state) => {
14921
14843
  const { props: props7 } = el;
14922
14844
  const { isSelected } = props7;
14845
+ console.log(isSelected);
14923
14846
  if (isSelected) {
14924
14847
  window.requestAnimationFrame(() => {
14925
14848
  el.parent.parent.node.scrollTo({
14926
14849
  left: el.node.offsetLeft,
14927
- behavior: "smooth"
14850
+ behavior: state.initialized ? "smooth" : "instant"
14928
14851
  });
14929
14852
  });
14930
14853
  }
14931
14854
  }
14932
14855
  }
14933
14856
  },
14934
- $setCollection: ({ state, parent }) => {
14857
+ $setPropsCollection: ({ state, parent }) => {
14935
14858
  return [
14936
14859
  { text: "January" },
14937
14860
  { text: "February" },
@@ -14974,38 +14897,87 @@ var DatePickerMonthsSlider = {
14974
14897
  }
14975
14898
  };
14976
14899
 
14977
- // Datepicker/weekdays.js
14978
- var DatePickerWeekDays = {
14979
- extend: Grid,
14900
+ // Datepicker/years.js
14901
+ var DatePickerYears = {
14902
+ tag: "aside",
14980
14903
  props: {
14981
14904
  overflow: "hidden",
14982
- padding: "- Z Z",
14983
- width: "100%",
14984
- columns: "repeat(7, 1fr)",
14985
- gap: "W2"
14905
+ position: "relative",
14906
+ style: {
14907
+ button: {
14908
+ padding: "0"
14909
+ }
14910
+ },
14911
+ ":before": {
14912
+ content: '""',
14913
+ boxSize: "A1 100%",
14914
+ position: "absolute",
14915
+ top: "0",
14916
+ left: "0",
14917
+ background: "linear-gradient(to bottom, var(--theme-tertiary-dark-background) 0%, transparent 100%)",
14918
+ zIndex: "10"
14919
+ },
14920
+ ":after": {
14921
+ content: '""',
14922
+ boxSize: "B 100%",
14923
+ position: "absolute",
14924
+ bottom: "0",
14925
+ left: "0",
14926
+ background: "linear-gradient(to top, var(--theme-tertiary-dark-background) 0%, transparent 100%)"
14927
+ }
14986
14928
  },
14987
- childExtend: {
14988
- tag: "span",
14989
- extend: Flex,
14929
+ if: ({ state }) => state.yearRange,
14930
+ Flex: {
14990
14931
  props: {
14991
- fontSize: "Y1",
14992
- textTransform: "capitalize",
14993
- align: "center center",
14994
- ":nth-child(7n-1), &:nth-child(7n)": { opacity: ".5" }
14932
+ flow: "column",
14933
+ gap: "B",
14934
+ padding: "A Z A1 B",
14935
+ maxHeight: "100%",
14936
+ overflow: "hidden auto",
14937
+ "::-webkit-scrollbar": { display: "none" }
14938
+ },
14939
+ childExtend: {
14940
+ extend: Button,
14941
+ props: ({ state, text }) => ({
14942
+ fontSize: "Y1",
14943
+ color: "white",
14944
+ opacity: ".4",
14945
+ background: "transparent",
14946
+ transition: "opacity .25s ease",
14947
+ isSelected: state.activeYear === text,
14948
+ ".isSelected": { opacity: "1" },
14949
+ ":hover": { opacity: "1" }
14950
+ }),
14951
+ on: {
14952
+ click: (event, element, state) => state.update({
14953
+ activeYear: element.text
14954
+ }, { isHoisted: true }),
14955
+ render: (el, state) => {
14956
+ const { props: props7 } = el;
14957
+ const { isSelected } = props7;
14958
+ if (!isSelected)
14959
+ return;
14960
+ window.requestAnimationFrame(() => {
14961
+ el.parent.parent.node.scrollTop = el.node.offsetTop - 100;
14962
+ });
14963
+ }
14964
+ }
14965
+ },
14966
+ $setPropsCollection: (element) => {
14967
+ const { yearRange } = element.state;
14968
+ if (!yearRange)
14969
+ return;
14970
+ const [start, end] = yearRange;
14971
+ const yearsArray = new Array(end + 1 - start).fill(void 0).map((v, k) => {
14972
+ return { text: start + k };
14973
+ }).reverse();
14974
+ return yearsArray;
14995
14975
  }
14996
- },
14997
- ...[
14998
- { text: "Mo" },
14999
- { text: "Tu" },
15000
- { text: "We" },
15001
- { text: "Th" },
15002
- { text: "Fr" },
15003
- { text: "Sa" },
15004
- { text: "Su" }
15005
- ]
14976
+ }
15006
14977
  };
15007
14978
 
15008
- // Datepicker/index.js
14979
+ // Datepicker/grid.js
14980
+ var import_headless_datepicker = __toESM(require_headless_datepicker());
15009
14981
  var calendar = new import_headless_datepicker.HeadlessDatepicker.Calendar({
15010
14982
  calendarMode: "exact"
15011
14983
  });
@@ -15018,10 +14990,31 @@ var extractMonthDays = (data) => {
15018
14990
  });
15019
14991
  return result;
15020
14992
  };
14993
+ var DatePickerGrid = {
14994
+ extend: Grid,
14995
+ props: {
14996
+ columns: "repeat(7, 1fr)",
14997
+ minWidth: "100%",
14998
+ gap: "W2",
14999
+ padding: "- Z",
15000
+ style: { scrollSnapAlign: "center" }
15001
+ },
15002
+ childExtend: DatePickerDay,
15003
+ $setStateCollection: (el, s) => s.days
15004
+ };
15021
15005
  var DatePickerGridContainer = {
15022
15006
  props: {
15023
- maxWidth: `${272 / 16}em`,
15007
+ maxWidth: "F3+B",
15024
15008
  position: "relative",
15009
+ content: {
15010
+ overflow: "hidden",
15011
+ style: { scrollSnapType: "x mandatory" }
15012
+ },
15013
+ style: {
15014
+ button: {
15015
+ padding: "0"
15016
+ }
15017
+ },
15025
15018
  ":before": {
15026
15019
  content: '""',
15027
15020
  position: "absolute",
@@ -15039,13 +15032,13 @@ var DatePickerGridContainer = {
15039
15032
  right: "0",
15040
15033
  top: "0",
15041
15034
  zIndex: "30"
15042
- },
15043
- content: {
15044
- overflow: "auto hidden"
15045
15035
  }
15046
15036
  },
15047
15037
  state: (el, s) => {
15048
15038
  const state = el.parent.state;
15039
+ console.warn(state);
15040
+ if (!state.activeYear)
15041
+ return;
15049
15042
  return new Array(12).fill(void 0).map((v, k) => {
15050
15043
  const year = state.activeYear;
15051
15044
  const month = k + 1;
@@ -15058,59 +15051,68 @@ var DatePickerGridContainer = {
15058
15051
  };
15059
15052
  });
15060
15053
  },
15061
- content: {
15062
- extend: Flex,
15063
- childExtend: DatePickerGrid,
15054
+ Flex: {
15055
+ props: {},
15056
+ childExtend: {
15057
+ extend: DatePickerGrid,
15058
+ on: {
15059
+ render: (el, state) => {
15060
+ const { key } = el;
15061
+ const isSelected = state.parent.parent.activeMonth === parseInt(key);
15062
+ if (isSelected) {
15063
+ window.requestAnimationFrame(() => {
15064
+ el.parent.parent.node.scrollTo({
15065
+ left: el.node.offsetLeft,
15066
+ behavior: state.initialized ? "smooth" : "instant"
15067
+ });
15068
+ });
15069
+ }
15070
+ }
15071
+ }
15072
+ },
15064
15073
  $setStateCollection: (el, s) => s.parse()
15065
15074
  }
15066
15075
  };
15076
+
15077
+ // Datepicker/index.js
15067
15078
  var DatePicker = {
15068
15079
  extend: [Dialog, Flex],
15069
- state: {
15070
- yearRange: [1993, 2023],
15071
- activeYear: 1993,
15072
- activeMonth: 8,
15073
- activeDay: 14
15080
+ state: ({ props: props7 }) => {
15081
+ const date = /* @__PURE__ */ new Date();
15082
+ const activeYear = date.getFullYear();
15083
+ const activeMonth = date.getMonth();
15084
+ const activeDay = date.getDate();
15085
+ console.log({
15086
+ yearRange: props7.yearRange || [activeYear - 30, activeYear],
15087
+ activeYear: props7.activeYear || activeYear,
15088
+ activeMonth: props7.activeMonth || activeMonth,
15089
+ activeDay: props7.activeDay || activeDay,
15090
+ selectedDay: props7.selectedDay || null
15091
+ });
15092
+ return {
15093
+ yearRange: props7.yearRange || [activeYear - 30, activeYear],
15094
+ activeYear: props7.activeYear || activeYear,
15095
+ activeMonth: props7.activeMonth || activeMonth,
15096
+ activeDay: props7.activeDay || activeDay,
15097
+ selectedDay: props7.selectedDay || null
15098
+ };
15074
15099
  },
15075
15100
  props: {
15076
15101
  width: "fit-content",
15077
15102
  margin: "0",
15103
+ userSelect: "none",
15078
15104
  maxHeight: "G+B2"
15079
15105
  },
15080
- DatePickerYears: {
15081
- style: {
15082
- button: {
15083
- padding: "0"
15084
- }
15085
- }
15086
- },
15106
+ DatePickerYears: {},
15087
15107
  Flex: {
15088
15108
  props: {
15089
15109
  flow: "column",
15090
- padding: "20px - - -",
15110
+ padding: "A1 - - -",
15091
15111
  position: "relative"
15092
15112
  },
15093
- DatePickerMonthsSlider: {
15094
- style: {
15095
- button: {
15096
- padding: "0"
15097
- }
15098
- }
15099
- },
15100
- DatePickerWeekDays: {
15101
- style: {
15102
- button: {
15103
- padding: "0"
15104
- }
15105
- }
15106
- },
15107
- DatePickerGridContainer: {
15108
- style: {
15109
- button: {
15110
- padding: "0"
15111
- }
15112
- }
15113
- },
15113
+ DatePickerMonthsSlider: {},
15114
+ DatePickerWeekDays: {},
15115
+ DatePickerGridContainer: {},
15114
15116
  DialogFooter: {}
15115
15117
  }
15116
15118
  };