@noya-app/noya-designsystem 0.1.9 → 0.1.10

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.mjs CHANGED
@@ -114,94 +114,104 @@ var Tooltip = memo2(function Tooltip2({ children, content }) {
114
114
  });
115
115
 
116
116
  // src/components/Button.tsx
117
- var ButtonElement = styled4.button(({ theme, active, disabled, variant, size: size2, flex }) => ({
118
- ...size2 === "large" ? theme.textStyles.heading4 : theme.textStyles.small,
119
- textDecoration: "none",
120
- lineHeight: "1",
121
- flex: flex ?? "0 0 auto",
122
- position: "relative",
123
- border: "0",
124
- outline: "none",
125
- WebkitAppRegion: "no-drag",
126
- userSelect: "none",
127
- minWidth: variant === "normal" ? "31px" : void 0,
128
- textAlign: "left",
129
- borderRadius: "4px",
130
- paddingTop: variant === "none" ? "0px" : "4px",
131
- paddingRight: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
132
- paddingBottom: variant === "none" ? "0px" : "4px",
133
- paddingLeft: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
134
- ...size2 === "large" && {
135
- paddingTop: "12px",
136
- paddingRight: "16px",
137
- paddingBottom: "12px",
138
- paddingLeft: "16px"
139
- },
140
- background: active ? theme.colors.primary : variant === "primaryGradient" ? `linear-gradient(90deg, ${theme.colors.primary}, ${theme.colors.primaryLight})` : variant === "none" || variant === "thin" ? "transparent" : theme.colors.inputBackground,
141
- color: active ? "white" : theme.colors.text,
142
- opacity: disabled ? 0.25 : 1,
143
- "&:focus": {
144
- boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${theme.colors.primary}`
145
- },
146
- "&:hover": {
147
- background: variant === "primaryGradient" || active ? theme.colors.primaryLight : theme.colors.inputBackgroundLight
148
- },
149
- "&:active": {
150
- background: variant === "primaryGradient" ? theme.colors.primary : theme.colors.activeBackground
151
- },
152
- ...variant === "primary" && {
153
- background: theme.colors.primary,
154
- color: "white",
155
- "&:hover": {
156
- background: theme.colors.primaryLight
117
+ var ButtonElement = styled4.button(
118
+ ({
119
+ theme,
120
+ active,
121
+ disabled,
122
+ variant,
123
+ size: size2,
124
+ flex,
125
+ defaultBackground = theme.colors.inputBackground
126
+ }) => ({
127
+ ...size2 === "large" ? theme.textStyles.heading4 : theme.textStyles.small,
128
+ textDecoration: "none",
129
+ lineHeight: "1",
130
+ flex: flex ?? "0 0 auto",
131
+ position: "relative",
132
+ border: "0",
133
+ outline: "none",
134
+ WebkitAppRegion: "no-drag",
135
+ userSelect: "none",
136
+ minWidth: variant === "normal" ? "31px" : void 0,
137
+ textAlign: "left",
138
+ borderRadius: "4px",
139
+ paddingTop: variant === "none" ? "0px" : "4px",
140
+ paddingRight: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
141
+ paddingBottom: variant === "none" ? "0px" : "4px",
142
+ paddingLeft: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
143
+ ...size2 === "large" && {
144
+ paddingTop: "12px",
145
+ paddingRight: "16px",
146
+ paddingBottom: "12px",
147
+ paddingLeft: "16px"
157
148
  },
158
- "&:active": {
159
- background: theme.colors.primary
160
- }
161
- },
162
- ...variant === "secondary" && {
163
- background: theme.colors.secondary,
164
- color: "white",
165
- "&:hover": {
166
- background: theme.colors.secondaryLight
149
+ background: active ? theme.colors.primary : variant === "primaryGradient" ? `linear-gradient(90deg, ${theme.colors.primary}, ${theme.colors.primaryLight})` : variant === "none" || variant === "thin" ? "transparent" : defaultBackground,
150
+ color: active ? "white" : theme.colors.text,
151
+ opacity: disabled ? 0.25 : 1,
152
+ "&:focus": {
153
+ boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${theme.colors.primary}`
167
154
  },
168
- "&:active": {
169
- background: theme.colors.secondary
170
- }
171
- },
172
- ...variant === "secondaryBright" && {
173
- background: "#0ab557",
174
- color: "white",
175
155
  "&:hover": {
176
- opacity: 0.8
156
+ background: variant === "primaryGradient" || active ? theme.colors.primaryLight : theme.colors.inputBackgroundLight
177
157
  },
178
158
  "&:active": {
179
- opacity: 0.9
180
- }
181
- },
182
- ...variant === "white" && {
183
- background: "white",
184
- "&:hover": {
185
- opacity: 0.8
159
+ background: variant === "primaryGradient" || active ? theme.colors.primary : theme.colors.activeBackground
186
160
  },
187
- "&:active": {
188
- opacity: 0.9
161
+ ...variant === "primary" && {
162
+ background: theme.colors.primary,
163
+ color: "white",
164
+ "&:hover": {
165
+ background: theme.colors.primaryLight
166
+ },
167
+ "&:active": {
168
+ background: theme.colors.primary
169
+ }
170
+ },
171
+ ...variant === "secondary" && {
172
+ background: theme.colors.secondary,
173
+ color: "white",
174
+ "&:hover": {
175
+ background: theme.colors.secondaryLight
176
+ },
177
+ "&:active": {
178
+ background: theme.colors.secondary
179
+ }
180
+ },
181
+ ...variant === "secondaryBright" && {
182
+ background: "#0ab557",
183
+ color: "white",
184
+ "&:hover": {
185
+ opacity: 0.8
186
+ },
187
+ "&:active": {
188
+ opacity: 0.9
189
+ }
190
+ },
191
+ ...variant === "white" && {
192
+ background: "white",
193
+ "&:hover": {
194
+ opacity: 0.8
195
+ },
196
+ "&:active": {
197
+ opacity: 0.9
198
+ }
199
+ },
200
+ ...variant === "floating" && {
201
+ background: "white",
202
+ color: theme.colors.text,
203
+ boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
204
+ fontSize: "12px",
205
+ padding: "0px 4px"
206
+ },
207
+ display: "flex",
208
+ alignItems: "center",
209
+ justifyContent: "center",
210
+ "& *": {
211
+ pointerEvents: "none"
189
212
  }
190
- },
191
- ...variant === "floating" && {
192
- background: "white",
193
- color: theme.colors.text,
194
- boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
195
- fontSize: "12px",
196
- padding: "0px 4px"
197
- },
198
- display: "flex",
199
- alignItems: "center",
200
- justifyContent: "center",
201
- "& *": {
202
- pointerEvents: "none"
203
- }
204
- }));
213
+ })
214
+ );
205
215
  var ButtonContent = styled4.span(({ theme }) => ({
206
216
  // Line height of small text - maybe figure out better way to ensure
207
217
  // icons don't have a smaller height
@@ -225,6 +235,7 @@ var Button = forwardRef(function Button2({
225
235
  variant = "normal",
226
236
  size: size2 = "normal",
227
237
  contentStyle,
238
+ defaultBackground,
228
239
  onClick,
229
240
  children,
230
241
  ...rest
@@ -243,6 +254,7 @@ var Button = forwardRef(function Button2({
243
254
  disabled,
244
255
  variant,
245
256
  size: size2,
257
+ defaultBackground,
246
258
  onClick,
247
259
  onDoubleClick: useCallback((event) => {
248
260
  event.stopPropagation();
@@ -875,7 +887,7 @@ var styles = {
875
887
  separatorStyle: ({ theme }) => ({
876
888
  height: "1px",
877
889
  backgroundColor: theme.colors.divider,
878
- margin: "4px 8px"
890
+ margin: "4px -4px"
879
891
  }),
880
892
  itemStyle: ({
881
893
  theme,
@@ -888,7 +900,7 @@ var styles = {
888
900
  userSelect: "none",
889
901
  cursor: "pointer",
890
902
  borderRadius: "3px",
891
- padding: "4px 8px",
903
+ padding: "6px 8px",
892
904
  ...disabled && {
893
905
  color: theme.colors.textDisabled
894
906
  },
@@ -1019,7 +1031,16 @@ var DropdownMenuItem = memo7(function ContextMenuItem({
1019
1031
  }
1020
1032
  const element = /* @__PURE__ */ React12.createElement(ItemElement, { disabled, onSelect: handleSelectItem }, indented && /* @__PURE__ */ React12.createElement(Spacer.Horizontal, { size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET }), icon && /* @__PURE__ */ React12.createElement(React12.Fragment, null, icon, /* @__PURE__ */ React12.createElement(Spacer.Horizontal, { size: 8 })), children, shortcut && /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(Spacer.Horizontal, null), /* @__PURE__ */ React12.createElement(Spacer.Horizontal, { size: 24 }), /* @__PURE__ */ React12.createElement(KeyboardShortcut, { shortcut })), items && items.length > 0 && /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(Spacer.Horizontal, null), /* @__PURE__ */ React12.createElement(Spacer.Horizontal, { size: 16 }), /* @__PURE__ */ React12.createElement(ChevronRightIcon, null)));
1021
1033
  if (items && items.length > 0) {
1022
- return /* @__PURE__ */ React12.createElement(DropdownMenuRoot, { isNested: true, items, onSelect }, element);
1034
+ return /* @__PURE__ */ React12.createElement(
1035
+ DropdownMenuRoot,
1036
+ {
1037
+ isNested: true,
1038
+ items,
1039
+ onSelect,
1040
+ alignOffset: -5
1041
+ },
1042
+ element
1043
+ );
1023
1044
  } else {
1024
1045
  return element;
1025
1046
  }
@@ -1034,7 +1055,12 @@ var DropdownMenuRoot = forwardRef4(function DropdownMenuRoot2({
1034
1055
  shouldBindKeyboardShortcuts,
1035
1056
  onOpenChange,
1036
1057
  open,
1037
- onCloseAutoFocus
1058
+ onCloseAutoFocus,
1059
+ side,
1060
+ sideOffset = 4,
1061
+ align,
1062
+ alignOffset,
1063
+ collisionPadding = 8
1038
1064
  }, forwardedRef) {
1039
1065
  const hasCheckedItem = items.some(
1040
1066
  (item) => item !== SEPARATOR_ITEM && item.checked
@@ -1051,9 +1077,12 @@ var DropdownMenuRoot = forwardRef4(function DropdownMenuRoot2({
1051
1077
  return /* @__PURE__ */ React12.createElement(RootComponent, { onOpenChange, open }, /* @__PURE__ */ React12.createElement(TriggerComponent, { ref: forwardedRef, asChild: true }, children), /* @__PURE__ */ React12.createElement(RadixDropdownMenu.Portal, null, /* @__PURE__ */ React12.createElement(
1052
1078
  ContentComponent,
1053
1079
  {
1054
- sideOffset: 4,
1080
+ side,
1081
+ sideOffset,
1082
+ align,
1083
+ alignOffset,
1055
1084
  style: contentStyle,
1056
- collisionPadding: 8,
1085
+ collisionPadding,
1057
1086
  ...{ onCloseAutoFocus }
1058
1087
  },
1059
1088
  items.map(