@pushwoosh/dumb-components 1.1.120 → 1.1.122
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/Button/RemoveButton.d.ts +2 -0
- package/Button/RemoveButton.js +10 -0
- package/Button/ai-documentation.md +19 -5
- package/Button/index.d.ts +1 -0
- package/Button/index.js +2 -1
- package/Button/styles.d.ts +1 -0
- package/Button/styles.js +6 -1
- package/Calendar/helpers.js +1 -1
- package/DateTimePicker/helpers.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CloseIcon } from '@pushwoosh/kit-icons';
|
|
3
|
+
import { RemoveButtonBox } from './styles';
|
|
4
|
+
export function RemoveButton(props) {
|
|
5
|
+
return React.createElement(RemoveButtonBox, {
|
|
6
|
+
...props
|
|
7
|
+
}, React.createElement(CloseIcon, {
|
|
8
|
+
size: "small"
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
## Overview
|
|
7
7
|
|
|
8
|
-
**Component:** Button, GhostButton
|
|
9
|
-
**Import Path:** `import { Button, GhostButton } from '@pushwoosh/dumb-components'`
|
|
10
|
-
**Files:** Button.tsx, GhostButton.tsx, types.ts, styles.ts, maps.ts, index.ts
|
|
8
|
+
**Component:** Button, GhostButton, RemoveButton
|
|
9
|
+
**Import Path:** `import { Button, GhostButton, RemoveButton } from '@pushwoosh/dumb-components'`
|
|
10
|
+
**Files:** Button.tsx, GhostButton.tsx, RemoveButton.tsx, types.ts, styles.ts, maps.ts, index.ts
|
|
11
11
|
**Type:** UI Component / Form Component
|
|
12
|
-
**Description:** Versatile button component with loading states, icons, and multiple styling variants. Also includes a minimal GhostButton for unstyled interactions.
|
|
12
|
+
**Description:** Versatile button component with loading states, icons, and multiple styling variants. Also includes a minimal GhostButton for unstyled interactions and a RemoveButton for compact "close/remove" affordances.
|
|
13
13
|
|
|
14
14
|
## TypeScript Interface
|
|
15
15
|
|
|
@@ -46,7 +46,7 @@ type ButtonPropsWithAsTag<AS extends keyof HTMLElementTagNameMap> =
|
|
|
46
46
|
|
|
47
47
|
**Import:**
|
|
48
48
|
```typescript
|
|
49
|
-
import { Button, GhostButton } from '@pushwoosh/dumb-components';
|
|
49
|
+
import { Button, GhostButton, RemoveButton } from '@pushwoosh/dumb-components';
|
|
50
50
|
import type {
|
|
51
51
|
ButtonPropsWithoutAs,
|
|
52
52
|
ButtonPropsWithAsTag,
|
|
@@ -163,6 +163,20 @@ const CustomButton = styled(GhostButton)`
|
|
|
163
163
|
`;
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
## RemoveButton Usage
|
|
167
|
+
|
|
168
|
+
A compact icon-only button with a built-in `CloseIcon` intended for "remove" / "dismiss" affordances. It has fixed `16x16` size and switches its color to `DANGER_HOVER` / `DANGER_PRESSED` on interaction.
|
|
169
|
+
|
|
170
|
+
**Props:** accepts all native `<button>` props except `ref` and `children` (the icon is rendered internally).
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
<RemoveButton
|
|
174
|
+
type="button"
|
|
175
|
+
aria-label="Remove item"
|
|
176
|
+
onClick={() => handleRemove(item.id)}
|
|
177
|
+
/>
|
|
178
|
+
```
|
|
179
|
+
|
|
166
180
|
## Props Reference
|
|
167
181
|
|
|
168
182
|
| Prop | Type | Default | Description |
|
package/Button/index.d.ts
CHANGED
package/Button/index.js
CHANGED
package/Button/styles.d.ts
CHANGED
package/Button/styles.js
CHANGED
|
@@ -85,6 +85,10 @@ export const ButtonBoxSecondaryShapeField = styled(ButtonBox).withConfig({
|
|
|
85
85
|
displayName: "ButtonBoxSecondaryShapeField",
|
|
86
86
|
componentId: "sc-qltvdl-15"
|
|
87
87
|
})(["height:", ";padding:0 calc(6px - 1px);font-weight:", ";", ";"], UnitSize.FIELD_HEIGHT, FontWeight.MEDIUM, /* sc-custom "display: none;" */secondaryShapeColors);
|
|
88
|
+
export const RemoveButtonBox = styled.button.withConfig({
|
|
89
|
+
displayName: "RemoveButtonBox",
|
|
90
|
+
componentId: "sc-qltvdl-16"
|
|
91
|
+
})(["width:", ";height:", ";padding:0;appearance:none !important;border:none;background:transparent;cursor:pointer;color:", ";&:hover{color:", ";}&:active{color:", ";}"], UnitSize.ICON_SMALL, UnitSize.ICON_SMALL, Color.PHANTOM, Color.DANGER_HOVER, Color.DANGER_PRESSED);
|
|
88
92
|
ButtonBox.displayName = 'ButtonBox';
|
|
89
93
|
ButtonIcon.displayName = 'ButtonIcon';
|
|
90
94
|
ButtonContent.displayName = 'ButtonContent';
|
|
@@ -100,4 +104,5 @@ ButtonBoxPrimaryShapeField.displayName = 'ButtonBoxPrimaryShapeField';
|
|
|
100
104
|
ButtonBoxSecondaryGhostCompact.displayName = 'ButtonBoxSecondaryGhostCompact';
|
|
101
105
|
ButtonBoxSecondaryGhostField.displayName = 'ButtonBoxSecondaryGhostField';
|
|
102
106
|
ButtonBoxSecondaryShapeCompact.displayName = 'ButtonBoxSecondaryShapeCompact';
|
|
103
|
-
ButtonBoxSecondaryShapeField.displayName = 'ButtonBoxSecondaryShapeField';
|
|
107
|
+
ButtonBoxSecondaryShapeField.displayName = 'ButtonBoxSecondaryShapeField';
|
|
108
|
+
RemoveButtonBox.displayName = 'RemoveButtonBox';
|
package/Calendar/helpers.js
CHANGED
|
@@ -65,7 +65,7 @@ export const differenceInDays = (ds1, ds2) => {
|
|
|
65
65
|
};
|
|
66
66
|
export const monthName = (month, monthFormat = 'long') => {
|
|
67
67
|
const date = new Date(2023, month - 1, 1);
|
|
68
|
-
return date.toLocaleString('
|
|
68
|
+
return date.toLocaleString('en-US', {
|
|
69
69
|
month: monthFormat
|
|
70
70
|
});
|
|
71
71
|
};
|
|
@@ -33,7 +33,7 @@ export const differenceInDays = (d1, d2) => {
|
|
|
33
33
|
};
|
|
34
34
|
export const monthName = (month, monthFormat = 'long') => {
|
|
35
35
|
const date = new Date(2023, month - 1, 1);
|
|
36
|
-
return date.toLocaleString('
|
|
36
|
+
return date.toLocaleString('en-US', {
|
|
37
37
|
month: monthFormat
|
|
38
38
|
});
|
|
39
39
|
};
|