@noya-app/noya-designsystem 0.0.13 → 0.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noya-app/noya-designsystem",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -12,11 +12,11 @@
12
12
  "@dnd-kit/core": "3.1.1",
13
13
  "@dnd-kit/modifiers": "3.0.0",
14
14
  "@dnd-kit/sortable": "4.0.0",
15
- "@noya-app/noya-colorpicker": "0.0.7",
16
- "@noya-app/noya-utils": "0.0.10",
17
- "@noya-app/noya-geometry": "0.0.11",
18
- "@noya-app/noya-icons": "0.0.4",
19
- "@noya-app/noya-keymap": "0.0.6",
15
+ "@noya-app/noya-colorpicker": "0.0.8",
16
+ "@noya-app/noya-utils": "0.0.11",
17
+ "@noya-app/noya-geometry": "0.0.12",
18
+ "@noya-app/noya-icons": "0.0.5",
19
+ "@noya-app/noya-keymap": "0.0.7",
20
20
  "@radix-ui/primitive": "^1.0.0",
21
21
  "@radix-ui/react-avatar": "^1.0.1",
22
22
  "@radix-ui/react-compose-refs": "^1.0.0",
@@ -4,21 +4,21 @@ import React, {
4
4
  forwardRef,
5
5
  ReactNode,
6
6
  useCallback,
7
- } from 'react';
8
- import styled from 'styled-components';
9
- import { Tooltip } from './Tooltip';
7
+ } from "react";
8
+ import styled from "styled-components";
9
+ import { Tooltip } from "./Tooltip";
10
10
 
11
11
  type ButtonVariant =
12
- | 'normal'
13
- | 'primary'
14
- | 'secondary'
15
- | 'secondaryBright'
16
- | 'white'
17
- | 'thin'
18
- | 'floating'
19
- | 'none';
12
+ | "normal"
13
+ | "primary"
14
+ | "secondary"
15
+ | "secondaryBright"
16
+ | "white"
17
+ | "thin"
18
+ | "floating"
19
+ | "none";
20
20
 
21
- type ButtonSize = 'normal' | 'large';
21
+ type ButtonSize = "normal" | "large";
22
22
 
23
23
  /* ----------------------------------------------------------------------------
24
24
  * Element
@@ -28,98 +28,98 @@ export const ButtonElement = styled.button<{
28
28
  active: boolean;
29
29
  variant: ButtonVariant;
30
30
  size: ButtonSize;
31
- flex?: CSSProperties['flex'];
31
+ flex?: CSSProperties["flex"];
32
32
  }>(({ theme, active, disabled, variant, size, flex }) => ({
33
- ...(size === 'large' ? theme.textStyles.heading4 : theme.textStyles.small),
34
- textDecoration: 'none',
35
- lineHeight: '1',
36
- flex: flex ?? '0 0 auto',
37
- position: 'relative',
38
- border: '0',
39
- outline: 'none',
40
- WebkitAppRegion: 'no-drag',
41
- userSelect: 'none',
42
- minWidth: variant === 'normal' ? '31px' : undefined,
43
- textAlign: 'left',
44
- borderRadius: '4px',
45
- paddingTop: variant === 'none' ? '0px' : '4px',
46
- paddingRight: variant === 'none' ? '0px' : variant === 'thin' ? '1px' : '6px',
47
- paddingBottom: variant === 'none' ? '0px' : '4px',
48
- paddingLeft: variant === 'none' ? '0px' : variant === 'thin' ? '1px' : '6px',
49
- ...(size === 'large' && {
50
- paddingTop: '12px',
51
- paddingRight: '16px',
52
- paddingBottom: '12px',
53
- paddingLeft: '16px',
33
+ ...(size === "large" ? theme.textStyles.heading4 : theme.textStyles.small),
34
+ textDecoration: "none",
35
+ lineHeight: "1",
36
+ flex: flex ?? "0 0 auto",
37
+ position: "relative",
38
+ border: "0",
39
+ outline: "none",
40
+ WebkitAppRegion: "no-drag",
41
+ userSelect: "none",
42
+ minWidth: variant === "normal" ? "31px" : undefined,
43
+ textAlign: "left",
44
+ borderRadius: "4px",
45
+ paddingTop: variant === "none" ? "0px" : "4px",
46
+ paddingRight: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
47
+ paddingBottom: variant === "none" ? "0px" : "4px",
48
+ paddingLeft: variant === "none" ? "0px" : variant === "thin" ? "1px" : "8px",
49
+ ...(size === "large" && {
50
+ paddingTop: "12px",
51
+ paddingRight: "16px",
52
+ paddingBottom: "12px",
53
+ paddingLeft: "16px",
54
54
  }),
55
55
  background: active
56
56
  ? theme.colors.primary
57
- : variant === 'none' || variant === 'thin'
58
- ? 'transparent'
59
- : theme.colors.inputBackground,
60
- color: active ? 'white' : theme.colors.text,
57
+ : variant === "none" || variant === "thin"
58
+ ? "transparent"
59
+ : theme.colors.inputBackground,
60
+ color: active ? "white" : theme.colors.text,
61
61
  opacity: disabled ? 0.25 : 1,
62
- '&:focus': {
62
+ "&:focus": {
63
63
  boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${theme.colors.primary}`,
64
64
  },
65
- '&:hover': {
65
+ "&:hover": {
66
66
  background: theme.colors.inputBackgroundLight,
67
67
  },
68
- '&:active': {
68
+ "&:active": {
69
69
  background: theme.colors.activeBackground,
70
70
  },
71
- ...(variant === 'primary' && {
71
+ ...(variant === "primary" && {
72
72
  background: theme.colors.primary,
73
- color: 'white',
74
- '&:hover': {
73
+ color: "white",
74
+ "&:hover": {
75
75
  background: theme.colors.primaryLight,
76
76
  },
77
- '&:active': {
77
+ "&:active": {
78
78
  background: theme.colors.primary,
79
79
  },
80
80
  }),
81
- ...(variant === 'secondary' && {
81
+ ...(variant === "secondary" && {
82
82
  background: theme.colors.secondary,
83
- color: 'white',
84
- '&:hover': {
83
+ color: "white",
84
+ "&:hover": {
85
85
  background: theme.colors.secondaryLight,
86
86
  },
87
- '&:active': {
87
+ "&:active": {
88
88
  background: theme.colors.secondary,
89
89
  },
90
90
  }),
91
- ...(variant === 'secondaryBright' && {
92
- background: '#0ab557',
93
- color: 'white',
94
- '&:hover': {
91
+ ...(variant === "secondaryBright" && {
92
+ background: "#0ab557",
93
+ color: "white",
94
+ "&:hover": {
95
95
  opacity: 0.8,
96
96
  },
97
- '&:active': {
97
+ "&:active": {
98
98
  opacity: 0.9,
99
99
  },
100
100
  }),
101
- ...(variant === 'white' && {
102
- background: 'white',
103
- '&:hover': {
101
+ ...(variant === "white" && {
102
+ background: "white",
103
+ "&:hover": {
104
104
  opacity: 0.8,
105
105
  },
106
- '&:active': {
106
+ "&:active": {
107
107
  opacity: 0.9,
108
108
  },
109
109
  }),
110
- ...(variant === 'floating' && {
111
- background: 'white',
110
+ ...(variant === "floating" && {
111
+ background: "white",
112
112
  color: theme.colors.text,
113
- boxShadow: '0 1px 2px rgba(0, 0, 0, 0.1)',
114
- fontSize: '12px',
115
- padding: '0px 4px',
113
+ boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
114
+ fontSize: "12px",
115
+ padding: "0px 4px",
116
116
  }),
117
- display: 'flex',
118
- alignItems: 'center',
119
- justifyContent: 'center',
117
+ display: "flex",
118
+ alignItems: "center",
119
+ justifyContent: "center",
120
120
 
121
- '& *': {
122
- pointerEvents: 'none',
121
+ "& *": {
122
+ pointerEvents: "none",
123
123
  },
124
124
  }));
125
125
 
@@ -130,14 +130,14 @@ export const ButtonElement = styled.button<{
130
130
  const ButtonContent = styled.span(({ theme }) => ({
131
131
  // Line height of small text - maybe figure out better way to ensure
132
132
  // icons don't have a smaller height
133
- minHeight: '19px',
134
- display: 'flex',
135
- alignItems: 'center',
136
- flex: '1',
137
- justifyContent: 'center',
133
+ minHeight: "19px",
134
+ display: "flex",
135
+ alignItems: "center",
136
+ flex: "1",
137
+ justifyContent: "center",
138
138
 
139
139
  // Helps with alignment with the default small text
140
- lineHeight: '15px',
140
+ lineHeight: "15px",
141
141
  }));
142
142
 
143
143
  /* ----------------------------------------------------------------------------
@@ -146,7 +146,9 @@ const ButtonContent = styled.span(({ theme }) => ({
146
146
 
147
147
  export interface ButtonRootProps {
148
148
  id?: string;
149
- flex?: CSSProperties['flex'];
149
+ className?: string;
150
+ style?: CSSProperties;
151
+ flex?: CSSProperties["flex"];
150
152
  tabIndex?: number;
151
153
  children: ReactNode;
152
154
  active?: boolean;
@@ -166,24 +168,28 @@ export interface ButtonRootProps {
166
168
  export const Button = forwardRef(function Button(
167
169
  {
168
170
  id,
171
+ className,
172
+ style,
169
173
  flex,
170
174
  tabIndex,
171
175
  tooltip,
172
176
  active = false,
173
177
  disabled = false,
174
- variant = 'normal',
175
- size = 'normal',
178
+ variant = "normal",
179
+ size = "normal",
176
180
  contentStyle,
177
181
  onClick,
178
182
  children,
179
183
  ...rest // Propagate any other props so this component works as a Slot
180
184
  }: ButtonRootProps,
181
- forwardedRef: ForwardedRef<HTMLButtonElement>,
185
+ forwardedRef: ForwardedRef<HTMLButtonElement>
182
186
  ) {
183
187
  const buttonElement = (
184
188
  <ButtonElement
185
189
  ref={forwardedRef}
186
190
  id={id}
191
+ className={className}
192
+ style={style}
187
193
  flex={flex}
188
194
  tabIndex={tabIndex}
189
195
  active={active}