musae 0.3.14-beta.4 → 0.4.0

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.
Files changed (143) hide show
  1. package/dist/components/breadcrumb/breadcrumb.cjs +1 -1
  2. package/dist/components/breadcrumb/breadcrumb.mjs +1 -1
  3. package/dist/components/button/button.cjs +33 -37
  4. package/dist/components/button/button.mjs +33 -37
  5. package/dist/components/calendar/calendar.cjs +7 -1
  6. package/dist/components/calendar/calendar.mjs +7 -1
  7. package/dist/components/calendar/contribution.cjs +112 -27
  8. package/dist/components/calendar/contribution.d.ts +2 -6
  9. package/dist/components/calendar/contribution.mjs +113 -28
  10. package/dist/components/checkbox/styles.cjs +4 -2
  11. package/dist/components/checkbox/styles.d.ts +2 -0
  12. package/dist/components/checkbox/styles.mjs +4 -2
  13. package/dist/components/config/context.cjs +2 -1
  14. package/dist/components/config/context.mjs +2 -1
  15. package/dist/components/config/provider.cjs +4 -2
  16. package/dist/components/config/provider.mjs +4 -2
  17. package/dist/components/divider/divider.cjs +5 -3
  18. package/dist/components/divider/divider.mjs +5 -3
  19. package/dist/components/form/field/error.cjs +4 -6
  20. package/dist/components/form/field/error.mjs +4 -6
  21. package/dist/components/form/field/field.cjs +10 -22
  22. package/dist/components/form/field/field.d.ts +1 -1
  23. package/dist/components/form/field/field.mjs +10 -22
  24. package/dist/components/form/field/layout.cjs +33 -19
  25. package/dist/components/form/field/layout.d.ts +6 -1
  26. package/dist/components/form/field/layout.mjs +32 -18
  27. package/dist/components/form/field/support.cjs +30 -0
  28. package/dist/components/form/field/support.d.ts +5 -0
  29. package/dist/components/form/field/support.mjs +28 -0
  30. package/dist/components/form/item.cjs +4 -1
  31. package/dist/components/form/item.d.ts +1 -1
  32. package/dist/components/form/item.mjs +4 -1
  33. package/dist/components/icon/icons/image/looks-six.cjs +1 -1
  34. package/dist/components/icon/icons/image/looks-six.mjs +1 -1
  35. package/dist/components/icon/icons/mock/loading.cjs +1 -1
  36. package/dist/components/icon/icons/mock/loading.mjs +1 -1
  37. package/dist/components/input/input.cjs +46 -31
  38. package/dist/components/input/input.d.ts +14 -1
  39. package/dist/components/input/input.mjs +47 -32
  40. package/dist/components/menu/group.cjs +1 -4
  41. package/dist/components/menu/group.mjs +1 -4
  42. package/dist/components/menu/item.cjs +2 -0
  43. package/dist/components/menu/item.mjs +2 -0
  44. package/dist/components/pagination/pagination.cjs +1 -1
  45. package/dist/components/pagination/pagination.mjs +1 -1
  46. package/dist/components/picker/picker.cjs +5 -1
  47. package/dist/components/picker/picker.mjs +5 -1
  48. package/dist/components/popconfirm/popconfirm.cjs +29 -7
  49. package/dist/components/popconfirm/popconfirm.d.ts +2 -2
  50. package/dist/components/popconfirm/popconfirm.mjs +29 -7
  51. package/dist/components/popover/popover.cjs +4 -2
  52. package/dist/components/popover/popover.d.ts +1 -0
  53. package/dist/components/popover/popover.mjs +4 -2
  54. package/dist/components/popper/dropdown.cjs +7 -7
  55. package/dist/components/popper/dropdown.mjs +7 -7
  56. package/dist/components/popper/hooks.cjs +2 -0
  57. package/dist/components/popper/hooks.mjs +2 -0
  58. package/dist/components/quote/styles.cjs +9 -0
  59. package/dist/components/quote/styles.d.ts +1 -0
  60. package/dist/components/quote/styles.mjs +9 -0
  61. package/dist/components/radio/radio.cjs +16 -7
  62. package/dist/components/radio/radio.mjs +16 -7
  63. package/dist/components/rate/rate.cjs +19 -0
  64. package/dist/components/rate/rate.mjs +19 -0
  65. package/dist/components/rich-text-editor/dropdown.cjs +22 -2
  66. package/dist/components/rich-text-editor/dropdown.d.ts +1 -1
  67. package/dist/components/rich-text-editor/dropdown.mjs +22 -2
  68. package/dist/components/rich-text-editor/hooks.cjs +15 -0
  69. package/dist/components/rich-text-editor/hooks.d.ts +9 -0
  70. package/dist/components/rich-text-editor/hooks.mjs +15 -0
  71. package/dist/components/rich-text-editor/index.cjs +5 -6
  72. package/dist/components/rich-text-editor/index.mjs +3 -4
  73. package/dist/components/rich-text-editor/plugins/check-list/index.cjs +0 -2
  74. package/dist/components/rich-text-editor/plugins/check-list/index.mjs +0 -2
  75. package/dist/components/rich-text-editor/plugins/controlled-state/index.cjs +2 -1
  76. package/dist/components/rich-text-editor/plugins/controlled-state/index.mjs +2 -1
  77. package/dist/components/rich-text-editor/plugins/markdown-shortcut/index.cjs +4 -5
  78. package/dist/components/rich-text-editor/plugins/markdown-shortcut/index.d.ts +1 -1
  79. package/dist/components/rich-text-editor/plugins/markdown-shortcut/index.mjs +4 -3
  80. package/dist/components/rich-text-editor/plugins/toolbar/hooks.cjs +14 -9
  81. package/dist/components/rich-text-editor/plugins/toolbar/hooks.d.ts +1 -1
  82. package/dist/components/rich-text-editor/plugins/toolbar/hooks.mjs +11 -6
  83. package/dist/components/rich-text-editor/plugins/toolbar/index.cjs +15 -6
  84. package/dist/components/rich-text-editor/plugins/toolbar/index.mjs +16 -7
  85. package/dist/components/rich-text-editor/rich-text-editor.cjs +111 -25
  86. package/dist/components/rich-text-editor/rich-text-editor.mjs +109 -23
  87. package/dist/components/select/select.cjs +5 -2
  88. package/dist/components/select/select.d.ts +1 -1
  89. package/dist/components/select/select.mjs +5 -2
  90. package/dist/components/select/selector.cjs +4 -2
  91. package/dist/components/select/selector.mjs +4 -2
  92. package/dist/components/skeleton/skeleton.cjs +4 -22
  93. package/dist/components/skeleton/skeleton.mjs +4 -22
  94. package/dist/components/switch/switch.cjs +15 -6
  95. package/dist/components/switch/switch.mjs +15 -6
  96. package/dist/components/table/body.cjs +9 -14
  97. package/dist/components/table/body.mjs +9 -14
  98. package/dist/components/table/header/header.cjs +9 -1
  99. package/dist/components/table/header/header.mjs +9 -1
  100. package/dist/components/table/table.cjs +1 -1
  101. package/dist/components/table/table.mjs +1 -1
  102. package/dist/components/textarea/textarea.cjs +1 -1
  103. package/dist/components/textarea/textarea.mjs +1 -1
  104. package/dist/components/theme/hooks.cjs +1 -1
  105. package/dist/components/theme/hooks.mjs +1 -1
  106. package/dist/components/timeline/timeline.cjs +3 -3
  107. package/dist/components/timeline/timeline.mjs +3 -3
  108. package/dist/components/tooltip/tooltip.cjs +4 -0
  109. package/dist/components/tooltip/tooltip.mjs +4 -0
  110. package/dist/components/tour/tour.cjs +1 -1
  111. package/dist/components/tour/tour.mjs +1 -1
  112. package/dist/components/transfer/list.cjs +8 -4
  113. package/dist/components/transfer/list.mjs +8 -4
  114. package/dist/components/upload/upload.cjs +2 -2
  115. package/dist/components/upload/upload.mjs +2 -2
  116. package/dist/components/upload/uploaded-item.cjs +5 -2
  117. package/dist/components/upload/uploaded-item.mjs +5 -2
  118. package/dist/components/upload/uploaded-list.cjs +4 -0
  119. package/dist/components/upload/uploaded-list.mjs +4 -0
  120. package/dist/hooks/use-class-names.component.cjs +23 -0
  121. package/dist/hooks/use-class-names.component.d.ts +5 -0
  122. package/dist/hooks/use-class-names.component.mjs +23 -0
  123. package/dist/hooks/use-class-names.d.ts +0 -5
  124. package/dist/locale/locales/en_US.cjs +11 -0
  125. package/dist/locale/locales/en_US.mjs +11 -0
  126. package/dist/locale/locales/zh_CN.cjs +11 -0
  127. package/dist/locale/locales/zh_CN.mjs +11 -0
  128. package/dist/styles.css +1910 -1829
  129. package/dist/types/calendar.d.ts +40 -0
  130. package/dist/types/config.d.ts +5 -0
  131. package/dist/types/form.d.ts +5 -0
  132. package/dist/types/locale.d.ts +9 -0
  133. package/dist/types/picker.d.ts +6 -0
  134. package/dist/types/popconfirm.d.ts +7 -2
  135. package/dist/types/popover.d.ts +6 -0
  136. package/dist/types/rich-text-editor.d.ts +1 -0
  137. package/dist/types/select.d.ts +6 -0
  138. package/dist/types/tag.d.ts +2 -2
  139. package/dist/types/upload.d.ts +1 -1
  140. package/dist/utils/class-name.cjs +1 -2
  141. package/dist/utils/class-name.d.ts +0 -10
  142. package/dist/utils/class-name.mjs +1 -2
  143. package/package.json +5 -5
@@ -38,7 +38,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
38
38
  color: theme$1.colors["on-surface-variant"]
39
39
  })),
40
40
  navigations: {
41
- className: "musaex-e8uvvx musaex-78zum5 musaex-1a02dak"
41
+ className: "musaex-p8vts musaex-j8pfrn musaex-3ct3a4 musaex-78zum5 musaex-1a02dak"
42
42
  }
43
43
  };
44
44
  return /*#__PURE__*/React.createElement("nav", {
@@ -36,7 +36,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
36
36
  color: theme.colors["on-surface-variant"]
37
37
  })),
38
38
  navigations: {
39
- className: "musaex-e8uvvx musaex-78zum5 musaex-1a02dak"
39
+ className: "musaex-p8vts musaex-j8pfrn musaex-3ct3a4 musaex-78zum5 musaex-1a02dak"
40
40
  }
41
41
  };
42
42
  return /*#__PURE__*/React.createElement("nav", {
@@ -17,21 +17,36 @@ var color = require('@aiszlab/fuzzy/color');
17
17
  var _excluded = ["children", "className", "style", "color", "size", "variant", "shape", "disabled", "ripple", "type", "onClick", "prefix", "suffix"];
18
18
  var styles = {
19
19
  button: {
20
- position: "musaex-1n2onr6",
21
- overflow: "musaex-b3r6kr",
22
- overflowX: null,
23
- overflowY: null,
24
20
  display: "musaex-3nfvp2",
25
21
  alignItems: "musaex-6s0dn4",
26
22
  justifyContent: "musaex-l56j7k",
27
23
  gap: "musaex-1lsrmdg",
28
24
  rowGap: null,
29
25
  columnGap: null,
30
- whiteSpace: "musaex-uxw1ft",
31
26
  transitionProperty: "musaex-fagghw",
32
27
  transitionDuration: "musaex-1d8287x",
33
28
  willChange: "musaex-19v51jg",
34
- flexShrink: "musaex-2lah0s",
29
+ borderWidth: "musaex-1628nlo",
30
+ borderInlineWidth: null,
31
+ borderInlineStartWidth: null,
32
+ borderLeftWidth: null,
33
+ borderInlineEndWidth: null,
34
+ borderRightWidth: null,
35
+ borderBlockWidth: null,
36
+ borderTopWidth: null,
37
+ borderBottomWidth: null,
38
+ backgroundColor: "musaex-jbqb8w",
39
+ overflow: "musaex-b3r6kr",
40
+ overflowX: null,
41
+ overflowY: null,
42
+ whiteSpace: "musaex-uxw1ft",
43
+ textOverflow: "musaex-lyipyv",
44
+ cursor: "musaex-1ypdohk",
45
+ fontFamily: "musaex-jb2p0i",
46
+ $$css: true
47
+ },
48
+ ripple: {
49
+ position: "musaex-1n2onr6",
35
50
  $$css: true
36
51
  },
37
52
  small: {
@@ -111,8 +126,7 @@ var styles = {
111
126
  },
112
127
  filled: function filled(props) {
113
128
  return [{
114
- border: "musaex-1gs6z28",
115
- borderWidth: null,
129
+ borderWidth: "musaex-1628nlo",
116
130
  borderInlineWidth: null,
117
131
  borderInlineStartWidth: null,
118
132
  borderLeftWidth: null,
@@ -121,27 +135,9 @@ var styles = {
121
135
  borderBlockWidth: null,
122
136
  borderTopWidth: null,
123
137
  borderBottomWidth: null,
124
- borderStyle: null,
125
- borderInlineStyle: null,
126
- borderInlineStartStyle: null,
127
- borderLeftStyle: null,
128
- borderInlineEndStyle: null,
129
- borderRightStyle: null,
130
- borderBlockStyle: null,
131
- borderTopStyle: null,
132
- borderBottomStyle: null,
133
- borderColor: null,
134
- borderInlineColor: null,
135
- borderInlineStartColor: null,
136
- borderLeftColor: null,
137
- borderInlineEndColor: null,
138
- borderRightColor: null,
139
- borderBlockColor: null,
140
- borderTopColor: null,
141
- borderBottomColor: null,
142
138
  backgroundColor: "musaex-q1mx2j",
143
139
  color: "musaex-19dipnz",
144
- boxShadow: "musaex-1nadr2t",
140
+ ":hover_boxShadow": "musaex-1nadr2t",
145
141
  $$css: true
146
142
  }, {
147
143
  "--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
@@ -178,22 +174,22 @@ var styles = {
178
174
  borderTopColor: null,
179
175
  borderBottomColor: null,
180
176
  color: "musaex-19dipnz",
181
- backgroundColor: "musaex-rl4t6d",
177
+ ":hover_backgroundColor": "musaex-1vkaft9",
182
178
  $$css: true
183
179
  }, {
184
180
  "--borderColor": props.color != null ? props.color : "initial",
185
181
  "--color": props.color != null ? props.color : "initial",
186
- "--1e2mv7m": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
182
+ "--b6ve2z": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
187
183
  }];
188
184
  },
189
185
  text: function text(props) {
190
186
  return [{
191
187
  color: "musaex-19dipnz",
192
- backgroundColor: "musaex-rl4t6d",
188
+ ":hover_backgroundColor": "musaex-1vkaft9",
193
189
  $$css: true
194
190
  }, {
195
191
  "--color": props.color != null ? props.color : "initial",
196
- "--1e2mv7m": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
192
+ "--b6ve2z": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
197
193
  }];
198
194
  },
199
195
  disabled: function disabled(props) {
@@ -257,7 +253,7 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
257
253
  clear = _useButton.clear,
258
254
  ripples = _useButton.ripples;
259
255
  var styled = {
260
- button: stylex.default.props(styles.button, theme.typography.label[size],
256
+ button: stylex.default.props(styles.button, ripple$1 && styles.ripple, theme.typography.label[size],
261
257
  // size
262
258
  styles[size],
263
259
  // variant
@@ -266,18 +262,18 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
266
262
  color: theme$1.colors["on-".concat(color$1)]
267
263
  }), variant === "outlined" && styles.outlined({
268
264
  color: theme$1.colors[color$1],
269
- hoveredBackgroundColor: color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.thin)
265
+ hoveredBackgroundColor: color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.thin, true)
270
266
  }), variant === "text" && styles.text({
271
267
  color: theme$1.colors[color$1],
272
- hoveredBackgroundColor: color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.thin)
268
+ hoveredBackgroundColor: color.hexToRgba(theme$1.colors.primary, tokens_stylex.OPACITY.thin, true)
273
269
  }),
274
270
  // shape
275
271
  styles[shape],
276
272
  // disabled
277
273
  disabled && styles.disabled({
278
- backgroundColor: variant === "filled" ? color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.medium) : "transparent",
279
- color: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker),
280
- outlineColor: variant === "outlined" ? color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker) : null
274
+ backgroundColor: variant === "filled" ? color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.medium, true) : "transparent",
275
+ color: color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, true),
276
+ outlineColor: variant === "outlined" ? color.hexToRgba(theme$1.colors["on-surface"], tokens_stylex.OPACITY.thicker, true) : null
281
277
  }))
282
278
  };
283
279
  return /*#__PURE__*/React.createElement("button", _objectSpread({
@@ -15,21 +15,36 @@ import { hexToRgba } from '@aiszlab/fuzzy/color';
15
15
  var _excluded = ["children", "className", "style", "color", "size", "variant", "shape", "disabled", "ripple", "type", "onClick", "prefix", "suffix"];
16
16
  var styles = {
17
17
  button: {
18
- position: "musaex-1n2onr6",
19
- overflow: "musaex-b3r6kr",
20
- overflowX: null,
21
- overflowY: null,
22
18
  display: "musaex-3nfvp2",
23
19
  alignItems: "musaex-6s0dn4",
24
20
  justifyContent: "musaex-l56j7k",
25
21
  gap: "musaex-1lsrmdg",
26
22
  rowGap: null,
27
23
  columnGap: null,
28
- whiteSpace: "musaex-uxw1ft",
29
24
  transitionProperty: "musaex-fagghw",
30
25
  transitionDuration: "musaex-1d8287x",
31
26
  willChange: "musaex-19v51jg",
32
- flexShrink: "musaex-2lah0s",
27
+ borderWidth: "musaex-1628nlo",
28
+ borderInlineWidth: null,
29
+ borderInlineStartWidth: null,
30
+ borderLeftWidth: null,
31
+ borderInlineEndWidth: null,
32
+ borderRightWidth: null,
33
+ borderBlockWidth: null,
34
+ borderTopWidth: null,
35
+ borderBottomWidth: null,
36
+ backgroundColor: "musaex-jbqb8w",
37
+ overflow: "musaex-b3r6kr",
38
+ overflowX: null,
39
+ overflowY: null,
40
+ whiteSpace: "musaex-uxw1ft",
41
+ textOverflow: "musaex-lyipyv",
42
+ cursor: "musaex-1ypdohk",
43
+ fontFamily: "musaex-jb2p0i",
44
+ $$css: true
45
+ },
46
+ ripple: {
47
+ position: "musaex-1n2onr6",
33
48
  $$css: true
34
49
  },
35
50
  small: {
@@ -109,8 +124,7 @@ var styles = {
109
124
  },
110
125
  filled: function filled(props) {
111
126
  return [{
112
- border: "musaex-1gs6z28",
113
- borderWidth: null,
127
+ borderWidth: "musaex-1628nlo",
114
128
  borderInlineWidth: null,
115
129
  borderInlineStartWidth: null,
116
130
  borderLeftWidth: null,
@@ -119,27 +133,9 @@ var styles = {
119
133
  borderBlockWidth: null,
120
134
  borderTopWidth: null,
121
135
  borderBottomWidth: null,
122
- borderStyle: null,
123
- borderInlineStyle: null,
124
- borderInlineStartStyle: null,
125
- borderLeftStyle: null,
126
- borderInlineEndStyle: null,
127
- borderRightStyle: null,
128
- borderBlockStyle: null,
129
- borderTopStyle: null,
130
- borderBottomStyle: null,
131
- borderColor: null,
132
- borderInlineColor: null,
133
- borderInlineStartColor: null,
134
- borderLeftColor: null,
135
- borderInlineEndColor: null,
136
- borderRightColor: null,
137
- borderBlockColor: null,
138
- borderTopColor: null,
139
- borderBottomColor: null,
140
136
  backgroundColor: "musaex-q1mx2j",
141
137
  color: "musaex-19dipnz",
142
- boxShadow: "musaex-1nadr2t",
138
+ ":hover_boxShadow": "musaex-1nadr2t",
143
139
  $$css: true
144
140
  }, {
145
141
  "--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
@@ -176,22 +172,22 @@ var styles = {
176
172
  borderTopColor: null,
177
173
  borderBottomColor: null,
178
174
  color: "musaex-19dipnz",
179
- backgroundColor: "musaex-rl4t6d",
175
+ ":hover_backgroundColor": "musaex-1vkaft9",
180
176
  $$css: true
181
177
  }, {
182
178
  "--borderColor": props.color != null ? props.color : "initial",
183
179
  "--color": props.color != null ? props.color : "initial",
184
- "--1e2mv7m": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
180
+ "--b6ve2z": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
185
181
  }];
186
182
  },
187
183
  text: function text(props) {
188
184
  return [{
189
185
  color: "musaex-19dipnz",
190
- backgroundColor: "musaex-rl4t6d",
186
+ ":hover_backgroundColor": "musaex-1vkaft9",
191
187
  $$css: true
192
188
  }, {
193
189
  "--color": props.color != null ? props.color : "initial",
194
- "--1e2mv7m": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
190
+ "--b6ve2z": props.hoveredBackgroundColor != null ? props.hoveredBackgroundColor : "initial"
195
191
  }];
196
192
  },
197
193
  disabled: function disabled(props) {
@@ -255,7 +251,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
255
251
  clear = _useButton.clear,
256
252
  ripples = _useButton.ripples;
257
253
  var styled = {
258
- button: _stylex.props(styles.button, typography.label[size],
254
+ button: _stylex.props(styles.button, ripple && styles.ripple, typography.label[size],
259
255
  // size
260
256
  styles[size],
261
257
  // variant
@@ -264,18 +260,18 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
264
260
  color: theme.colors["on-".concat(color)]
265
261
  }), variant === "outlined" && styles.outlined({
266
262
  color: theme.colors[color],
267
- hoveredBackgroundColor: hexToRgba(theme.colors.primary, OPACITY.thin)
263
+ hoveredBackgroundColor: hexToRgba(theme.colors.primary, OPACITY.thin, true)
268
264
  }), variant === "text" && styles.text({
269
265
  color: theme.colors[color],
270
- hoveredBackgroundColor: hexToRgba(theme.colors.primary, OPACITY.thin)
266
+ hoveredBackgroundColor: hexToRgba(theme.colors.primary, OPACITY.thin, true)
271
267
  }),
272
268
  // shape
273
269
  styles[shape],
274
270
  // disabled
275
271
  disabled && styles.disabled({
276
- backgroundColor: variant === "filled" ? hexToRgba(theme.colors["on-surface"], OPACITY.medium) : "transparent",
277
- color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker),
278
- outlineColor: variant === "outlined" ? hexToRgba(theme.colors["on-surface"], OPACITY.thicker) : null
272
+ backgroundColor: variant === "filled" ? hexToRgba(theme.colors["on-surface"], OPACITY.medium, true) : "transparent",
273
+ color: hexToRgba(theme.colors["on-surface"], OPACITY.thicker, true),
274
+ outlineColor: variant === "outlined" ? hexToRgba(theme.colors["on-surface"], OPACITY.thicker, true) : null
279
275
  }))
280
276
  };
281
277
  return /*#__PURE__*/React.createElement("button", _objectSpread({
@@ -70,6 +70,9 @@ var Calendar = function Calendar(_ref) {
70
70
  })),
71
71
  heading: {
72
72
  className: "musaex-98rzlu musaex-78zum5 musaex-l56j7k"
73
+ },
74
+ body: {
75
+ className: "musaex-1mwwwfo"
73
76
  }
74
77
  };
75
78
  return /*#__PURE__*/React.createElement("div", {
@@ -101,7 +104,10 @@ var Calendar = function Calendar(_ref) {
101
104
  prefix: /*#__PURE__*/React.createElement(keyboardDoubleArrowRight.default, null),
102
105
  onClick: toNextYear,
103
106
  shape: "circular"
104
- })), /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, headCells)), /*#__PURE__*/React.createElement("tbody", null, dateCells)));
107
+ })), /*#__PURE__*/React.createElement("table", {
108
+ className: styled.body.className,
109
+ style: styled.body.style
110
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, headCells)), /*#__PURE__*/React.createElement("tbody", null, dateCells)));
105
111
  };
106
112
 
107
113
  exports.default = Calendar;
@@ -68,6 +68,9 @@ var Calendar = function Calendar(_ref) {
68
68
  })),
69
69
  heading: {
70
70
  className: "musaex-98rzlu musaex-78zum5 musaex-l56j7k"
71
+ },
72
+ body: {
73
+ className: "musaex-1mwwwfo"
71
74
  }
72
75
  };
73
76
  return /*#__PURE__*/React.createElement("div", {
@@ -99,7 +102,10 @@ var Calendar = function Calendar(_ref) {
99
102
  prefix: /*#__PURE__*/React.createElement(KeyboardDoubleArrowRight, null),
100
103
  onClick: toNextYear,
101
104
  shape: "circular"
102
- })), /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, headCells)), /*#__PURE__*/React.createElement("tbody", null, dateCells)));
105
+ })), /*#__PURE__*/React.createElement("table", {
106
+ className: styled.body.className,
107
+ style: styled.body.style
108
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, headCells)), /*#__PURE__*/React.createElement("tbody", null, dateCells)));
103
109
  };
104
110
 
105
111
  export { Calendar as default };
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
 
3
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
3
4
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
5
  var dayjs = require('dayjs');
5
6
  var React = require('react');
@@ -9,7 +10,10 @@ var theme = require('../theme/theme.cjs');
9
10
  var tooltip = require('../tooltip/tooltip.cjs');
10
11
  var relax = require('@aiszlab/relax');
11
12
  var date = require('../../utils/date.cjs');
13
+ var color = require('@aiszlab/fuzzy/color');
14
+ var useLocale = require('../../locale/use-locale.cjs');
12
15
 
16
+ var FORMAT = "YYYY-MM-DD";
13
17
  var styles = {
14
18
  calendar: {
15
19
  variables: function variables(props) {
@@ -27,7 +31,7 @@ var styles = {
27
31
  $$css: true
28
32
  },
29
33
  scrollable: {
30
- maxWidth: "musaex-193iq5w",
34
+ maxWidth: "musaex-1t8xbu",
31
35
  overflow: "musaex-ysyzu8",
32
36
  overflowX: null,
33
37
  overflowY: null,
@@ -110,6 +114,45 @@ var styles = {
110
114
  right: null,
111
115
  $$css: true
112
116
  }
117
+ },
118
+ legend: {
119
+ "default": {
120
+ paddingBlock: "musaex-1i37kmv",
121
+ paddingTop: null,
122
+ paddingBottom: null,
123
+ paddingInline: "musaex-1mavw9y",
124
+ paddingStart: null,
125
+ paddingLeft: null,
126
+ paddingEnd: null,
127
+ paddingRight: null,
128
+ display: "musaex-78zum5",
129
+ justifyContent: "musaex-13a6bvl",
130
+ $$css: true
131
+ }
132
+ },
133
+ levels: {
134
+ "default": {
135
+ display: "musaex-78zum5",
136
+ gap: "musaex-90xh4w",
137
+ rowGap: null,
138
+ columnGap: null,
139
+ alignItems: "musaex-6s0dn4",
140
+ $$css: true
141
+ },
142
+ level: {
143
+ width: "musaex-1mg4jku",
144
+ height: "musaex-sahybl",
145
+ borderRadius: "musaex-llun4g",
146
+ borderStartStartRadius: null,
147
+ borderStartEndRadius: null,
148
+ borderEndStartRadius: null,
149
+ borderEndEndRadius: null,
150
+ borderTopLeftRadius: null,
151
+ borderTopRightRadius: null,
152
+ borderBottomLeftRadius: null,
153
+ borderBottomRightRadius: null,
154
+ $$css: true
155
+ }
113
156
  }
114
157
  };
115
158
  /**
@@ -118,13 +161,19 @@ var styles = {
118
161
  * inspired by github
119
162
  */
120
163
  var ContributionCalendar = function ContributionCalendar(_ref) {
121
- var year = _ref.year;
122
- _ref.gaps;
123
- var _ref$dataSource = _ref.dataSource,
124
- dataSource = _ref$dataSource === void 0 ? [] : _ref$dataSource;
164
+ var year = _ref.year,
165
+ _ref$contributions = _ref.contributions,
166
+ contributions = _ref$contributions === void 0 ? [] : _ref$contributions,
167
+ _ref$levels = _ref.levels,
168
+ levels = _ref$levels === void 0 ? 5 : _ref$levels,
169
+ _ref$gap = _ref.gap,
170
+ gap = _ref$gap === void 0 ? 5 : _ref$gap;
125
171
  var theme$1 = hooks.useTheme();
172
+ var _useLocale = useLocale.useLocale("contribution-calendar"),
173
+ _useLocale2 = _slicedToArray(_useLocale, 1),
174
+ locale = _useLocale2[0];
126
175
  var _useMemo = React.useMemo(function () {
127
- var _to = relax.min([dayjs().subtract(1, "day"), dayjs("".concat(year, "-12-31"))], function (_value) {
176
+ var _to = relax.min([dayjs().subtract(1, "days").startOf("days"), dayjs("".concat(year, "-12-31"))], function (_value) {
128
177
  return _value.valueOf();
129
178
  });
130
179
  var _from = _to.subtract(1, "year").add(1, "day");
@@ -157,19 +206,18 @@ var ContributionCalendar = function ContributionCalendar(_ref) {
157
206
  return prev;
158
207
  }, []);
159
208
  }, [from, start, columns]);
160
- var heats = React.useMemo(function () {
161
- return dataSource.reduce(function (prev, _ref2) {
162
- var _ref3 = _slicedToArray(_ref2, 2),
163
- date = _ref3[0],
164
- count = _ref3[1];
165
- return prev.set(date, count);
209
+ var _contributions = React.useMemo(function () {
210
+ return contributions.reduce(function (prev, _ref2) {
211
+ var contributedAt = _ref2.contributedAt,
212
+ count = _ref2.count;
213
+ return prev.set(contributedAt.format(FORMAT), count);
166
214
  }, new Map());
167
- }, [dataSource]);
215
+ }, [contributions]);
168
216
  var styled = {
169
- scrollable: stylex.default.props(styles.calendar.scrollable),
170
- calendar: stylex.default.props(styles.calendar.variables({
217
+ scrollable: stylex.default.props(styles.calendar.variables({
171
218
  color: theme$1.colors.primary
172
- }), styles.calendar["default"]),
219
+ }), styles.calendar.scrollable),
220
+ calendar: stylex.default.props(styles.calendar["default"]),
173
221
  cell: stylex.default.props(styles.cell["default"]),
174
222
  weekday: {
175
223
  cell: stylex.default.props(styles.weekday.cell, theme.typography.body.small),
@@ -179,8 +227,27 @@ var ContributionCalendar = function ContributionCalendar(_ref) {
179
227
  cell: stylex.default.props(styles.month.cell, theme.typography.body.small),
180
228
  "default": stylex.default.props(styles.month["default"]),
181
229
  leading: stylex.default.props(styles.month.cell, theme.typography.body.small, styles.month.leading)
182
- }
230
+ },
231
+ legend: stylex.default.props(styles.legend["default"], theme.typography.label.medium),
232
+ levels: stylex.default.props(styles.levels["default"]),
233
+ level: stylex.default.props(styles.levels.level)
183
234
  };
235
+ // how to get different levels
236
+ // convert primary color into hsla color
237
+ // use `s` change to get different levels
238
+ var _hexToHsla = color.hexToHsla(theme$1.colors.primary),
239
+ h = _hexToHsla[0];
240
+ var _levels = Array.from({
241
+ length: levels - 1
242
+ }).map(function (_, index) {
243
+ return gap * index;
244
+ });
245
+ var heatStep = Math.floor(100 / Math.max(_levels.length, 1));
246
+ var _heats = Array.from({
247
+ length: levels
248
+ }).map(function (_, index) {
249
+ return "hsl(".concat([h, index * heatStep + "%", "80%"].join(","), ")");
250
+ });
184
251
  return /*#__PURE__*/React.createElement("div", {
185
252
  className: styled.scrollable.className,
186
253
  style: styled.scrollable.style
@@ -190,10 +257,10 @@ var ContributionCalendar = function ContributionCalendar(_ref) {
190
257
  }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
191
258
  className: styled.month.leading.className,
192
259
  style: styled.month.leading.style
193
- }, "W/M"), months.map(function (_ref4, _key, _months) {
194
- var start = _ref4.start,
195
- end = _ref4.end,
196
- month = _ref4.month;
260
+ }, "W/M"), months.map(function (_ref3, _key, _months) {
261
+ var start = _ref3.start,
262
+ end = _ref3.end,
263
+ month = _ref3.month;
197
264
  var colSpan = end - start;
198
265
  if (colSpan === 0) return null;
199
266
  // render headers
@@ -223,9 +290,10 @@ var ContributionCalendar = function ContributionCalendar(_ref) {
223
290
  }, [1, 3, 5].includes(weekday) && (/*#__PURE__*/React.createElement("span", null, dayjs().day(weekday).format("ddd"))))), Array.from({
224
291
  length: columns
225
292
  }).map(function (_, column) {
293
+ var _contributions$get;
226
294
  var gap = column * 7 + weekday;
227
295
  var _at = start.add(gap, "day");
228
- if (column === 0 && !_at.isAfter(from)) {
296
+ if (column === 0 && _at.isBefore(from)) {
229
297
  return /*#__PURE__*/React.createElement("td", {
230
298
  key: column
231
299
  });
@@ -235,17 +303,34 @@ var ContributionCalendar = function ContributionCalendar(_ref) {
235
303
  key: column
236
304
  });
237
305
  }
238
- var date = _at.format("YYYY-MM-DD");
239
- var count = heats.get(date);
306
+ var date = _at.format(FORMAT);
307
+ var count = (_contributions$get = _contributions.get(date)) !== null && _contributions$get !== void 0 ? _contributions$get : 0;
308
+ var levelAt = relax.clamp(Math.ceil(count / gap), 0, levels);
240
309
  return /*#__PURE__*/React.createElement(tooltip.default, {
241
310
  key: column,
242
- title: "".concat(count, " contributions at ").concat(_at.format("YYYY-MM-DD"))
311
+ title: relax.toFunction(locale.contribution)(count, date)
243
312
  }, /*#__PURE__*/React.createElement("td", {
244
313
  className: styled.cell.className,
245
- style: styled.cell.style
314
+ style: _objectSpread(_objectSpread({}, styled.cell.style), {}, {
315
+ backgroundColor: _heats[levelAt]
316
+ })
246
317
  }));
247
318
  }));
248
- }))));
319
+ }))), /*#__PURE__*/React.createElement("div", {
320
+ className: styled.legend.className,
321
+ style: styled.legend.style
322
+ }, /*#__PURE__*/React.createElement("div", {
323
+ className: styled.levels.className,
324
+ style: styled.levels.style
325
+ }, /*#__PURE__*/React.createElement("span", null, locale.less), _heats.map(function (color) {
326
+ return /*#__PURE__*/React.createElement("div", {
327
+ className: styled.level.className,
328
+ key: color,
329
+ style: _objectSpread(_objectSpread({}, styled.level.style), {}, {
330
+ backgroundColor: color
331
+ })
332
+ });
333
+ }), /*#__PURE__*/React.createElement("span", null, locale.more))));
249
334
  };
250
335
 
251
336
  exports.default = ContributionCalendar;
@@ -1,13 +1,9 @@
1
1
  import React from "react";
2
- interface Props {
3
- year: number;
4
- gaps?: number[];
5
- dataSource?: [string, number][];
6
- }
2
+ import { ContributionCalendarProps } from "musae/types/calendar";
7
3
  /**
8
4
  * @description
9
5
  * contribution calendar
10
6
  * inspired by github
11
7
  */
12
- declare const ContributionCalendar: ({ year, gaps, dataSource }: Props) => React.JSX.Element;
8
+ declare const ContributionCalendar: ({ year, contributions, levels, gap, }: ContributionCalendarProps) => React.JSX.Element;
13
9
  export default ContributionCalendar;