@widergy/energy-ui 3.125.1 → 3.126.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.
- package/CHANGELOG.md +7 -0
- package/dist/components/UTChip/README.md +208 -0
- package/dist/components/UTChip/UTChip.mdx +11 -0
- package/dist/components/UTChip/UTChip.stories.js +385 -0
- package/dist/components/UTChip/constants.js +27 -0
- package/dist/components/UTChip/index.js +74 -0
- package/dist/components/UTChip/styles.module.scss +106 -0
- package/dist/components/UTChip/utils.js +114 -0
- package/dist/components/UTLabel/constants.js +43 -31
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.126.0](https://github.com/widergy/energy-ui/compare/v3.125.1...v3.126.0) (2025-12-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [PDI-552] utchip ([#737](https://github.com/widergy/energy-ui/issues/737)) ([e5d37e6](https://github.com/widergy/energy-ui/commit/e5d37e659c96542f4fdca9beee63b31306e1e47f))
|
|
7
|
+
|
|
1
8
|
## [3.125.1](https://github.com/widergy/energy-ui/compare/v3.125.0...v3.125.1) (2025-12-17)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# UTChip Component
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`UTChip` is a compact, interactive component used to display information or actions in a condensed format. Chips are commonly used for tags, filters, selections, or quick actions. They can be interactive (clickable) or static, and support various visual states including active, disabled, and different variants.
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Description |
|
|
10
|
+
|------|------|---------|-------------|
|
|
11
|
+
| `active` | `bool` | `false` | Indicates whether the chip is in an active state. Affects styling and colors. |
|
|
12
|
+
| `adornment` | `shape` | `undefined` | Optional decorative element displayed before the text. See [Adornments](#adornments) section. |
|
|
13
|
+
| `children` | `string` | Required | The text content displayed inside the chip. |
|
|
14
|
+
| `dataTestId` | `string` | `undefined` | Test ID for testing purposes. |
|
|
15
|
+
| `disabled` | `bool` | `false` | Disables the chip, preventing interactions and changing its appearance. |
|
|
16
|
+
| `isDragging` | `bool` | `false` | Indicates whether the chip is being dragged or moved. Useful for drag and drop interactions. |
|
|
17
|
+
| `onClick` | `func` | `undefined` | Callback function triggered when the chip is clicked. If provided, the chip becomes interactive and displays a close button. |
|
|
18
|
+
| `onClose` | `func` | `undefined` | Callback function triggered when the close button (X) is clicked. Only displayed if `onClick` is provided. |
|
|
19
|
+
| `size` | `oneOf(['medium', 'small'])` | `'medium'` | The size of the chip. Affects padding and text size. |
|
|
20
|
+
| `variant` | `oneOf(['default', 'outline'])` | `'default'` | Visual style variant. `default` uses filled background, `outline` uses border-only style. |
|
|
21
|
+
|
|
22
|
+
## Adornments
|
|
23
|
+
|
|
24
|
+
Chips can display optional decorative elements before the text. The `adornment` prop accepts an object with the following structure:
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
{
|
|
28
|
+
type: 'icon' | 'avatar' | 'image',
|
|
29
|
+
props: { /* component-specific props */ }
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Adornment Types
|
|
34
|
+
|
|
35
|
+
| Type | Component | Description | Example Props |
|
|
36
|
+
|------|-----------|-------------|----------------|
|
|
37
|
+
| `icon` | `UTIcon` | Displays an icon from the icon library. | `{ name: 'IconCheck', size: 20 }` |
|
|
38
|
+
| `avatar` | `UTAvatar` | Displays a user avatar. | `{ src: 'url', alt: 'User Name' }` |
|
|
39
|
+
| `image` | `img` | Displays a custom image. | `{ src: 'url', alt: 'Image' }` |
|
|
40
|
+
|
|
41
|
+
## Variants
|
|
42
|
+
|
|
43
|
+
### Default Variant
|
|
44
|
+
Filled background with solid colors. Best for primary actions or selections.
|
|
45
|
+
|
|
46
|
+
### Outline Variant
|
|
47
|
+
Border-only style with transparent background. Best for secondary actions or filters.
|
|
48
|
+
|
|
49
|
+
## Sizes
|
|
50
|
+
|
|
51
|
+
### Medium (default)
|
|
52
|
+
Standard size suitable for most use cases.
|
|
53
|
+
|
|
54
|
+
### Small
|
|
55
|
+
Compact size for space-constrained layouts.
|
|
56
|
+
|
|
57
|
+
## Color Themes
|
|
58
|
+
|
|
59
|
+
The chip's colors change based on its state:
|
|
60
|
+
|
|
61
|
+
- **Active + Default variant**: Light background with negative (red) close button
|
|
62
|
+
- **Active + Outline variant**: Accent-colored border with primary (blue) close button
|
|
63
|
+
- **Inactive**: Gray text and close button
|
|
64
|
+
- **Disabled**: Gray appearance, no interactions
|
|
65
|
+
|
|
66
|
+
## Usage Examples
|
|
67
|
+
|
|
68
|
+
### Basic Chip
|
|
69
|
+
```jsx
|
|
70
|
+
<UTChip>Basic Chip</UTChip>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Interactive Chip with Close Button
|
|
74
|
+
```jsx
|
|
75
|
+
<UTChip
|
|
76
|
+
onClick={() => console.log('Chip clicked')}
|
|
77
|
+
onClose={() => console.log('Chip closed')}
|
|
78
|
+
>
|
|
79
|
+
Closeable Chip
|
|
80
|
+
</UTChip>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Active Chip
|
|
84
|
+
```jsx
|
|
85
|
+
<UTChip active>
|
|
86
|
+
Active Chip
|
|
87
|
+
</UTChip>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Chip with Icon Adornment
|
|
91
|
+
```jsx
|
|
92
|
+
<UTChip
|
|
93
|
+
adornment={{
|
|
94
|
+
type: 'icon',
|
|
95
|
+
props: { name: 'IconCheck' }
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
Chip with Icon
|
|
99
|
+
</UTChip>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Chip with Avatar Adornment
|
|
103
|
+
```jsx
|
|
104
|
+
<UTChip
|
|
105
|
+
adornment={{
|
|
106
|
+
type: 'avatar',
|
|
107
|
+
props: { src: 'avatar-url', alt: 'User' }
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
User Chip
|
|
111
|
+
</UTChip>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Chip with Image Adornment
|
|
115
|
+
```jsx
|
|
116
|
+
<UTChip
|
|
117
|
+
adornment={{
|
|
118
|
+
type: 'image',
|
|
119
|
+
props: { src: 'image-url', alt: 'Image' }
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
Image Chip
|
|
123
|
+
</UTChip>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Small Outline Variant
|
|
127
|
+
```jsx
|
|
128
|
+
<UTChip
|
|
129
|
+
size="small"
|
|
130
|
+
variant="outline"
|
|
131
|
+
onClick={() => {}}
|
|
132
|
+
onClose={() => {}}
|
|
133
|
+
>
|
|
134
|
+
Filter Tag
|
|
135
|
+
</UTChip>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Disabled Chip
|
|
139
|
+
```jsx
|
|
140
|
+
<UTChip disabled>
|
|
141
|
+
Disabled Chip
|
|
142
|
+
</UTChip>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Dragging Chip
|
|
146
|
+
```jsx
|
|
147
|
+
<UTChip
|
|
148
|
+
isDragging={true}
|
|
149
|
+
onClick={() => console.log('Chip clicked')}
|
|
150
|
+
onClose={() => console.log('Chip closed')}
|
|
151
|
+
>
|
|
152
|
+
Draggable Chip
|
|
153
|
+
</UTChip>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Multiple Chips (Tag List)
|
|
157
|
+
```jsx
|
|
158
|
+
const tags = ['React', 'JavaScript', 'UI'];
|
|
159
|
+
|
|
160
|
+
{tags.map(tag => (
|
|
161
|
+
<UTChip
|
|
162
|
+
key={tag}
|
|
163
|
+
onClick={() => selectTag(tag)}
|
|
164
|
+
onClose={() => removeTag(tag)}
|
|
165
|
+
>
|
|
166
|
+
{tag}
|
|
167
|
+
</UTChip>
|
|
168
|
+
))}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Behavior
|
|
172
|
+
|
|
173
|
+
### Interactive Behavior
|
|
174
|
+
- When `onClick` is provided, the chip becomes interactive and displays a close button (X)
|
|
175
|
+
- The close button triggers the `onClose` callback
|
|
176
|
+
- The chip's appearance changes based on the `active` state
|
|
177
|
+
|
|
178
|
+
### Text Sizing
|
|
179
|
+
- Text size automatically adjusts based on the `size` prop:
|
|
180
|
+
- `medium`: Uses `body` text variant
|
|
181
|
+
- `small`: Uses `small` text variant
|
|
182
|
+
|
|
183
|
+
### Styling
|
|
184
|
+
- The component uses CSS modules for styling
|
|
185
|
+
- Classes are applied dynamically based on props: `size`, `variant`, `active`, and `disabled`
|
|
186
|
+
- Adornments are styled to fit within the chip's layout
|
|
187
|
+
|
|
188
|
+
## Accessibility
|
|
189
|
+
|
|
190
|
+
- Use `dataTestId` for testing and accessibility testing
|
|
191
|
+
- Ensure the chip text is descriptive and meaningful
|
|
192
|
+
- When used as a filter or selection, provide clear visual feedback with the `active` state
|
|
193
|
+
- Disabled chips should have appropriate visual indication
|
|
194
|
+
|
|
195
|
+
## Related Components
|
|
196
|
+
|
|
197
|
+
- **UTLabel**: Used internally for text rendering
|
|
198
|
+
- **UTButton**: Used internally for the close button
|
|
199
|
+
- **UTIcon**: Used for icon adornments
|
|
200
|
+
- **UTAvatar**: Used for avatar adornments
|
|
201
|
+
- **UTTouchableWithoutFeedback**: Used for interactive container when `onClick` is provided
|
|
202
|
+
|
|
203
|
+
## Notes
|
|
204
|
+
|
|
205
|
+
- The component is memoized for performance optimization
|
|
206
|
+
- Adornment props are merged with default props specific to each adornment type
|
|
207
|
+
- The close button only appears when `onClick` is provided
|
|
208
|
+
- Color themes are automatically managed based on the `active` and `variant` states
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithImageAdornment = exports.WithIconAdornment = exports.WithAvatarAdornment = exports.TagList = exports.SmallOutlineInteractive = exports.Small = exports.OutlineActive = exports.Outline = exports.InteractiveActive = exports.Interactive = exports.FilterChips = exports.Dragging = exports.Disabled = exports.Default = exports.AllVariants = exports.Active = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _constants = require("./constants");
|
|
9
|
+
var _ = _interopRequireDefault(require("."));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
var _default = exports.default = {
|
|
12
|
+
args: {
|
|
13
|
+
children: 'Chip Label'
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
active: {
|
|
17
|
+
control: 'boolean',
|
|
18
|
+
description: 'Indica si el chip está en estado activo.',
|
|
19
|
+
table: {
|
|
20
|
+
defaultValue: {
|
|
21
|
+
summary: 'false'
|
|
22
|
+
},
|
|
23
|
+
type: {
|
|
24
|
+
summary: 'bool'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
adornment: {
|
|
29
|
+
control: 'object',
|
|
30
|
+
description: 'Elemento decorativo opcional que se muestra antes del texto. Puede ser un icono, avatar o imagen.',
|
|
31
|
+
table: {
|
|
32
|
+
defaultValue: {
|
|
33
|
+
summary: 'undefined'
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
summary: 'object'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
children: {
|
|
41
|
+
control: 'text',
|
|
42
|
+
description: 'Contenido de texto que se muestra dentro del chip.',
|
|
43
|
+
table: {
|
|
44
|
+
defaultValue: {
|
|
45
|
+
summary: 'undefined'
|
|
46
|
+
},
|
|
47
|
+
type: {
|
|
48
|
+
summary: 'string'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
dataTestId: {
|
|
53
|
+
control: 'text',
|
|
54
|
+
description: 'ID para testing y propósitos de accesibilidad.',
|
|
55
|
+
table: {
|
|
56
|
+
defaultValue: {
|
|
57
|
+
summary: 'undefined'
|
|
58
|
+
},
|
|
59
|
+
type: {
|
|
60
|
+
summary: 'string'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
disabled: {
|
|
65
|
+
control: 'boolean',
|
|
66
|
+
description: 'Desactiva el chip, previniendo interacciones y cambiando su apariencia.',
|
|
67
|
+
table: {
|
|
68
|
+
defaultValue: {
|
|
69
|
+
summary: 'false'
|
|
70
|
+
},
|
|
71
|
+
type: {
|
|
72
|
+
summary: 'bool'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
isDragging: {
|
|
77
|
+
control: 'boolean',
|
|
78
|
+
description: 'Indica si el chip está siendo arrastrado o movido. Útil para interacciones de drag and drop.',
|
|
79
|
+
table: {
|
|
80
|
+
defaultValue: {
|
|
81
|
+
summary: 'false'
|
|
82
|
+
},
|
|
83
|
+
type: {
|
|
84
|
+
summary: 'bool'
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
onClick: {
|
|
89
|
+
control: {
|
|
90
|
+
type: 'inline-radio'
|
|
91
|
+
},
|
|
92
|
+
options: ['undefined', 'function'],
|
|
93
|
+
mapping: {
|
|
94
|
+
undefined,
|
|
95
|
+
function: () => alert('Chip clicked')
|
|
96
|
+
},
|
|
97
|
+
description: 'Función callback que se ejecuta cuando se hace clic en el chip. Si se proporciona, el chip se vuelve interactivo y muestra un botón de cerrar.',
|
|
98
|
+
table: {
|
|
99
|
+
defaultValue: {
|
|
100
|
+
summary: 'undefined'
|
|
101
|
+
},
|
|
102
|
+
type: {
|
|
103
|
+
summary: 'func'
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
onClose: {
|
|
108
|
+
control: {
|
|
109
|
+
type: 'inline-radio'
|
|
110
|
+
},
|
|
111
|
+
options: ['undefined', 'function'],
|
|
112
|
+
mapping: {
|
|
113
|
+
undefined,
|
|
114
|
+
function: () => alert('Chip closed')
|
|
115
|
+
},
|
|
116
|
+
description: 'Función callback que se ejecuta cuando se hace clic en el botón de cerrar (X). Solo se muestra si onClick está definido.',
|
|
117
|
+
table: {
|
|
118
|
+
defaultValue: {
|
|
119
|
+
summary: 'undefined'
|
|
120
|
+
},
|
|
121
|
+
type: {
|
|
122
|
+
summary: 'func'
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
size: {
|
|
127
|
+
control: 'select',
|
|
128
|
+
description: 'Tamaño del chip. Afecta el padding y el tamaño del texto.',
|
|
129
|
+
options: Object.values(_constants.CHIP_SIZES),
|
|
130
|
+
table: {
|
|
131
|
+
defaultValue: {
|
|
132
|
+
summary: _constants.CHIP_SIZES.MEDIUM
|
|
133
|
+
},
|
|
134
|
+
type: {
|
|
135
|
+
summary: "'".concat(_constants.CHIP_SIZES.MEDIUM, "' | '").concat(_constants.CHIP_SIZES.SMALL, "'")
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
variant: {
|
|
140
|
+
control: 'select',
|
|
141
|
+
description: 'Variante visual del chip. "default" usa fondo relleno, "outline" usa solo borde.',
|
|
142
|
+
options: Object.values(_constants.CHIP_VARIANT),
|
|
143
|
+
table: {
|
|
144
|
+
defaultValue: {
|
|
145
|
+
summary: _constants.CHIP_VARIANT.DEFAULT
|
|
146
|
+
},
|
|
147
|
+
type: {
|
|
148
|
+
summary: "'".concat(_constants.CHIP_VARIANT.DEFAULT, "' | '").concat(_constants.CHIP_VARIANT.OUTLINE, "'")
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
component: _.default,
|
|
154
|
+
parameters: {
|
|
155
|
+
docs: {
|
|
156
|
+
description: {
|
|
157
|
+
component: 'UTChip es un componente compacto e interactivo usado para mostrar información o acciones en un formato condensado. Se usa comúnmente para tags, filtros, selecciones o acciones rápidas.'
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
title: 'Energy-UI/UTChip'
|
|
162
|
+
};
|
|
163
|
+
const Default = exports.Default = {
|
|
164
|
+
args: {
|
|
165
|
+
active: false,
|
|
166
|
+
adornment: {
|
|
167
|
+
type: _constants.ADORNMENT_TYPES.ICON,
|
|
168
|
+
props: {
|
|
169
|
+
name: 'IconCircleCheck'
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
disabled: false,
|
|
173
|
+
isDragging: false,
|
|
174
|
+
onClick: undefined,
|
|
175
|
+
onClose: undefined,
|
|
176
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
177
|
+
variant: _constants.CHIP_VARIANT.DEFAULT
|
|
178
|
+
},
|
|
179
|
+
name: 'Playground'
|
|
180
|
+
};
|
|
181
|
+
const Active = exports.Active = {
|
|
182
|
+
args: {
|
|
183
|
+
active: true,
|
|
184
|
+
disabled: false,
|
|
185
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
186
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
187
|
+
isDragging: false
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const Disabled = exports.Disabled = {
|
|
191
|
+
args: {
|
|
192
|
+
active: false,
|
|
193
|
+
disabled: true,
|
|
194
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
195
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
196
|
+
isDragging: false
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
const Small = exports.Small = {
|
|
200
|
+
args: {
|
|
201
|
+
active: false,
|
|
202
|
+
disabled: false,
|
|
203
|
+
size: _constants.CHIP_SIZES.SMALL,
|
|
204
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
205
|
+
isDragging: false
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const Outline = exports.Outline = {
|
|
209
|
+
args: {
|
|
210
|
+
active: false,
|
|
211
|
+
disabled: false,
|
|
212
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
213
|
+
variant: _constants.CHIP_VARIANT.OUTLINE,
|
|
214
|
+
isDragging: false
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const OutlineActive = exports.OutlineActive = {
|
|
218
|
+
args: {
|
|
219
|
+
active: true,
|
|
220
|
+
disabled: false,
|
|
221
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
222
|
+
variant: _constants.CHIP_VARIANT.OUTLINE,
|
|
223
|
+
isDragging: false
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
const Interactive = exports.Interactive = {
|
|
227
|
+
args: {
|
|
228
|
+
active: false,
|
|
229
|
+
disabled: false,
|
|
230
|
+
onClick: () => alert('Chip clicked'),
|
|
231
|
+
onClose: () => alert('Chip closed'),
|
|
232
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
233
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
234
|
+
isDragging: false
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
const InteractiveActive = exports.InteractiveActive = {
|
|
238
|
+
args: {
|
|
239
|
+
active: true,
|
|
240
|
+
disabled: false,
|
|
241
|
+
onClick: () => alert('Chip clicked'),
|
|
242
|
+
onClose: () => alert('Chip closed'),
|
|
243
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
244
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
245
|
+
isDragging: false
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
const WithIconAdornment = exports.WithIconAdornment = {
|
|
249
|
+
args: {
|
|
250
|
+
active: false,
|
|
251
|
+
adornment: {
|
|
252
|
+
type: _constants.ADORNMENT_TYPES.ICON,
|
|
253
|
+
props: {
|
|
254
|
+
name: 'IconCircleCheck'
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
disabled: false,
|
|
258
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
259
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
260
|
+
isDragging: false
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const WithAvatarAdornment = exports.WithAvatarAdornment = {
|
|
264
|
+
args: {
|
|
265
|
+
active: false,
|
|
266
|
+
adornment: {
|
|
267
|
+
type: _constants.ADORNMENT_TYPES.AVATAR,
|
|
268
|
+
props: {
|
|
269
|
+
initials: 'JD'
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
children: 'John Doe',
|
|
273
|
+
disabled: false,
|
|
274
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
275
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
276
|
+
isDragging: false
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const WithImageAdornment = exports.WithImageAdornment = {
|
|
280
|
+
args: {
|
|
281
|
+
active: false,
|
|
282
|
+
adornment: {
|
|
283
|
+
type: _constants.ADORNMENT_TYPES.IMAGE,
|
|
284
|
+
props: {
|
|
285
|
+
src: 'https://widergy.com/wp-content/uploads/2021/12/cropped-favicon-32x32.png'
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
disabled: false,
|
|
289
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
290
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
291
|
+
isDragging: false
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const SmallOutlineInteractive = exports.SmallOutlineInteractive = {
|
|
295
|
+
args: {
|
|
296
|
+
active: false,
|
|
297
|
+
disabled: false,
|
|
298
|
+
onClick: () => alert('Filter clicked'),
|
|
299
|
+
onClose: () => alert('Filter removed'),
|
|
300
|
+
size: _constants.CHIP_SIZES.SMALL,
|
|
301
|
+
variant: _constants.CHIP_VARIANT.OUTLINE,
|
|
302
|
+
isDragging: false
|
|
303
|
+
},
|
|
304
|
+
name: 'Small Outline Interactive'
|
|
305
|
+
};
|
|
306
|
+
const Dragging = exports.Dragging = {
|
|
307
|
+
args: {
|
|
308
|
+
active: false,
|
|
309
|
+
disabled: false,
|
|
310
|
+
isDragging: true,
|
|
311
|
+
onClick: () => alert('Chip clicked'),
|
|
312
|
+
onClose: () => alert('Chip closed'),
|
|
313
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
314
|
+
variant: _constants.CHIP_VARIANT.DEFAULT
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
const AllVariants = exports.AllVariants = {
|
|
318
|
+
render: () => /*#__PURE__*/_react.default.createElement("div", {
|
|
319
|
+
style: {
|
|
320
|
+
display: 'flex',
|
|
321
|
+
gap: '8px',
|
|
322
|
+
flexWrap: 'wrap'
|
|
323
|
+
}
|
|
324
|
+
}, /*#__PURE__*/_react.default.createElement(_.default, {
|
|
325
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
326
|
+
size: _constants.CHIP_SIZES.MEDIUM
|
|
327
|
+
}, "Default Medium"), /*#__PURE__*/_react.default.createElement(_.default, {
|
|
328
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
329
|
+
size: _constants.CHIP_SIZES.SMALL
|
|
330
|
+
}, "Default Small"), /*#__PURE__*/_react.default.createElement(_.default, {
|
|
331
|
+
variant: _constants.CHIP_VARIANT.OUTLINE,
|
|
332
|
+
size: _constants.CHIP_SIZES.MEDIUM
|
|
333
|
+
}, "Outline Medium"), /*#__PURE__*/_react.default.createElement(_.default, {
|
|
334
|
+
variant: _constants.CHIP_VARIANT.OUTLINE,
|
|
335
|
+
size: _constants.CHIP_SIZES.SMALL
|
|
336
|
+
}, "Outline Small"), /*#__PURE__*/_react.default.createElement(_.default, {
|
|
337
|
+
active: true,
|
|
338
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
339
|
+
size: _constants.CHIP_SIZES.MEDIUM
|
|
340
|
+
}, "Active Default"), /*#__PURE__*/_react.default.createElement(_.default, {
|
|
341
|
+
active: true,
|
|
342
|
+
variant: _constants.CHIP_VARIANT.OUTLINE,
|
|
343
|
+
size: _constants.CHIP_SIZES.MEDIUM
|
|
344
|
+
}, "Active Outline"), /*#__PURE__*/_react.default.createElement(_.default, {
|
|
345
|
+
disabled: true,
|
|
346
|
+
variant: _constants.CHIP_VARIANT.DEFAULT,
|
|
347
|
+
size: _constants.CHIP_SIZES.MEDIUM
|
|
348
|
+
}, "Disabled"))
|
|
349
|
+
};
|
|
350
|
+
const TagList = exports.TagList = {
|
|
351
|
+
render: () => {
|
|
352
|
+
const tags = ['React', 'JavaScript', 'UI Components'];
|
|
353
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
354
|
+
style: {
|
|
355
|
+
display: 'flex',
|
|
356
|
+
gap: '8px',
|
|
357
|
+
flexWrap: 'wrap'
|
|
358
|
+
}
|
|
359
|
+
}, tags.map(tag => /*#__PURE__*/_react.default.createElement(_.default, {
|
|
360
|
+
key: tag,
|
|
361
|
+
onClick: () => alert("Selected: ".concat(tag)),
|
|
362
|
+
onClose: () => alert("Removed: ".concat(tag)),
|
|
363
|
+
size: _constants.CHIP_SIZES.SMALL,
|
|
364
|
+
variant: _constants.CHIP_VARIANT.OUTLINE
|
|
365
|
+
}, tag)));
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
const FilterChips = exports.FilterChips = {
|
|
369
|
+
render: () => {
|
|
370
|
+
const filters = ['Active', 'Pending', 'Completed'];
|
|
371
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
372
|
+
style: {
|
|
373
|
+
display: 'flex',
|
|
374
|
+
gap: '8px',
|
|
375
|
+
flexWrap: 'wrap'
|
|
376
|
+
}
|
|
377
|
+
}, filters.map((filter, index) => /*#__PURE__*/_react.default.createElement(_.default, {
|
|
378
|
+
key: filter,
|
|
379
|
+
active: index === 0,
|
|
380
|
+
onClick: () => alert("Filter: ".concat(filter)),
|
|
381
|
+
size: _constants.CHIP_SIZES.MEDIUM,
|
|
382
|
+
variant: _constants.CHIP_VARIANT.DEFAULT
|
|
383
|
+
}, filter)));
|
|
384
|
+
}
|
|
385
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CHIP_VARIANT = exports.CHIP_SIZES = exports.ADORNMENT_TYPES = exports.ADORNMENT_COMPONENT_MAPPER = void 0;
|
|
7
|
+
var _UTIcon = _interopRequireDefault(require("../UTIcon"));
|
|
8
|
+
var _UTAvatar = _interopRequireDefault(require("../UTAvatar"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const CHIP_VARIANT = exports.CHIP_VARIANT = {
|
|
11
|
+
DEFAULT: 'default',
|
|
12
|
+
OUTLINE: 'outline'
|
|
13
|
+
};
|
|
14
|
+
const CHIP_SIZES = exports.CHIP_SIZES = {
|
|
15
|
+
MEDIUM: 'medium',
|
|
16
|
+
SMALL: 'small'
|
|
17
|
+
};
|
|
18
|
+
const ADORNMENT_TYPES = exports.ADORNMENT_TYPES = {
|
|
19
|
+
ICON: 'icon',
|
|
20
|
+
AVATAR: 'avatar',
|
|
21
|
+
IMAGE: 'image'
|
|
22
|
+
};
|
|
23
|
+
const ADORNMENT_COMPONENT_MAPPER = exports.ADORNMENT_COMPONENT_MAPPER = {
|
|
24
|
+
[ADORNMENT_TYPES.ICON]: _UTIcon.default,
|
|
25
|
+
[ADORNMENT_TYPES.AVATAR]: _UTAvatar.default,
|
|
26
|
+
[ADORNMENT_TYPES.IMAGE]: 'img'
|
|
27
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTButton = _interopRequireDefault(require("../UTButton"));
|
|
10
|
+
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
var _constants = require("./constants");
|
|
13
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
|
+
const UTChip = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
active,
|
|
20
|
+
adornment,
|
|
21
|
+
children,
|
|
22
|
+
dataTestId,
|
|
23
|
+
disabled,
|
|
24
|
+
isDragging,
|
|
25
|
+
onClick,
|
|
26
|
+
onClose,
|
|
27
|
+
size = _constants.CHIP_SIZES.MEDIUM,
|
|
28
|
+
variant = _constants.CHIP_VARIANT.DEFAULT
|
|
29
|
+
} = _ref;
|
|
30
|
+
const {
|
|
31
|
+
Adornment,
|
|
32
|
+
adornmentProps,
|
|
33
|
+
buttonProps,
|
|
34
|
+
Container,
|
|
35
|
+
containerProps,
|
|
36
|
+
labelProps
|
|
37
|
+
} = (0, _utils.getItemsProps)({
|
|
38
|
+
active,
|
|
39
|
+
adornment,
|
|
40
|
+
dataTestId,
|
|
41
|
+
disabled,
|
|
42
|
+
isDragging,
|
|
43
|
+
onClick,
|
|
44
|
+
size,
|
|
45
|
+
variant
|
|
46
|
+
});
|
|
47
|
+
const handleClose = onClose ? e => {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
onClose(e);
|
|
50
|
+
} : undefined;
|
|
51
|
+
return /*#__PURE__*/_react.default.createElement(Container, _extends({
|
|
52
|
+
className: "\n ".concat(_stylesModule.default.chipContainer, "\n ").concat(_stylesModule.default[size], "\n ").concat(_stylesModule.default[variant], "\n ").concat(active ? _stylesModule.default.active : '', "\n ").concat(disabled ? _stylesModule.default.disabled : '', "\n ").concat(isDragging ? _stylesModule.default.dragging : '', "\n ").concat(onClick && !disabled ? _stylesModule.default.interactive : _stylesModule.default.nonInteractive, "\n ")
|
|
53
|
+
}, containerProps), Adornment && /*#__PURE__*/_react.default.createElement(Adornment, adornmentProps), /*#__PURE__*/_react.default.createElement(_UTLabel.default, labelProps, children), handleClose && /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({}, buttonProps, {
|
|
54
|
+
Icon: "IconX",
|
|
55
|
+
onClick: handleClose,
|
|
56
|
+
size: "small",
|
|
57
|
+
variant: "text"
|
|
58
|
+
})));
|
|
59
|
+
};
|
|
60
|
+
UTChip.propTypes = {
|
|
61
|
+
active: _propTypes.bool,
|
|
62
|
+
adornment: (0, _propTypes.shape)({
|
|
63
|
+
props: _propTypes.object,
|
|
64
|
+
type: (0, _propTypes.oneOf)([_constants.ADORNMENT_TYPES.ICON, _constants.ADORNMENT_TYPES.AVATAR, _constants.ADORNMENT_TYPES.IMAGE])
|
|
65
|
+
}),
|
|
66
|
+
dataTestId: _propTypes.string,
|
|
67
|
+
disabled: _propTypes.bool,
|
|
68
|
+
isDragging: _propTypes.bool,
|
|
69
|
+
onClick: _propTypes.func,
|
|
70
|
+
onClose: _propTypes.func,
|
|
71
|
+
size: (0, _propTypes.oneOf)([_constants.CHIP_SIZES.MEDIUM, _constants.CHIP_SIZES.SMALL]),
|
|
72
|
+
variant: (0, _propTypes.oneOf)([_constants.CHIP_VARIANT.DEFAULT, _constants.CHIP_VARIANT.OUTLINE])
|
|
73
|
+
};
|
|
74
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(UTChip);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
.chipContainer {
|
|
2
|
+
align-items: center;
|
|
3
|
+
border-style: solid;
|
|
4
|
+
border-radius: 30px;
|
|
5
|
+
border-width: 1px;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
grid-gap: 8px;
|
|
9
|
+
transition:
|
|
10
|
+
background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
11
|
+
box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
12
|
+
border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
13
|
+
color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
14
|
+
opacity 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
15
|
+
width: fit-content;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.small {
|
|
19
|
+
padding: 4px 8px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.medium {
|
|
23
|
+
padding: 8px 12px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.interactive {
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.nonInteractive {
|
|
31
|
+
cursor: default;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.default {
|
|
35
|
+
background-color: var(--light03);
|
|
36
|
+
border-color: transparent;
|
|
37
|
+
|
|
38
|
+
&:not(.disabled) {
|
|
39
|
+
&:hover {
|
|
40
|
+
background-color: var(--light04);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.interactive {
|
|
44
|
+
&:active {
|
|
45
|
+
background-color: var(--light05);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.dragging {
|
|
50
|
+
background-color: var(--light01);
|
|
51
|
+
box-shadow: 0 4px 4px 0px rgba(0, 0, 0, 0.25);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:not(.dragging) {
|
|
55
|
+
&.active {
|
|
56
|
+
background-color: var(--actionAccent04);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.disabled {
|
|
62
|
+
background-color: var(--light03);
|
|
63
|
+
opacity: 0.5;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.outline {
|
|
68
|
+
background-color: transparent;
|
|
69
|
+
border-color: var(--light04);
|
|
70
|
+
|
|
71
|
+
&:not(.disabled) {
|
|
72
|
+
&:hover {
|
|
73
|
+
background-color: var(--light02);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.interactive {
|
|
77
|
+
&:active {
|
|
78
|
+
background-color: var(--light03);
|
|
79
|
+
border-color: transparent;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&.dragging {
|
|
84
|
+
background-color: var(--light01);
|
|
85
|
+
box-shadow: 0 4px 4px 0px rgba(0, 0, 0, 0.25);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:not(.dragging) {
|
|
89
|
+
&.active {
|
|
90
|
+
background-color: var(--actionAccent01);
|
|
91
|
+
border-color: var(--actionAccent02);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&.disabled {
|
|
97
|
+
border-color: var(--light04);
|
|
98
|
+
opacity: 0.5;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.imageAdornment {
|
|
103
|
+
height: 24px;
|
|
104
|
+
object-fit: cover;
|
|
105
|
+
width: 24px;
|
|
106
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTextVariant = exports.getTextColorTheme = exports.getItemsProps = exports.getDefaultAdornmentProps = exports.getButtonColorTheme = void 0;
|
|
7
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
8
|
+
var _Palette = require("../../constants/Palette");
|
|
9
|
+
var _constants = require("../UTLabel/constants");
|
|
10
|
+
var _UTTouchableWithoutFeedback = _interopRequireDefault(require("../UTTouchableWithoutFeedback"));
|
|
11
|
+
var _constants2 = require("./constants");
|
|
12
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const getTextColorTheme = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
active,
|
|
17
|
+
disabled,
|
|
18
|
+
isDragging,
|
|
19
|
+
variant
|
|
20
|
+
} = _ref;
|
|
21
|
+
if (active && !disabled && !isDragging) return variant === _constants2.CHIP_VARIANT.DEFAULT ? _Palette.COLOR_THEMES.light : _Palette.COLOR_THEMES.accent;
|
|
22
|
+
return _Palette.COLOR_THEMES.gray;
|
|
23
|
+
};
|
|
24
|
+
exports.getTextColorTheme = getTextColorTheme;
|
|
25
|
+
const getButtonColorTheme = _ref2 => {
|
|
26
|
+
let {
|
|
27
|
+
active,
|
|
28
|
+
disabled,
|
|
29
|
+
isDragging,
|
|
30
|
+
variant
|
|
31
|
+
} = _ref2;
|
|
32
|
+
if (active && !disabled && !isDragging) return variant === _constants2.CHIP_VARIANT.DEFAULT ? _Palette.COLOR_THEMES.negative : _Palette.COLOR_THEMES.primary;
|
|
33
|
+
return _Palette.COLOR_THEMES.gray;
|
|
34
|
+
};
|
|
35
|
+
exports.getButtonColorTheme = getButtonColorTheme;
|
|
36
|
+
const getTextVariant = size => size === _constants2.CHIP_SIZES.SMALL ? _constants.VARIANTS_NAMES.SMALL : _constants.VARIANTS_NAMES.BODY;
|
|
37
|
+
exports.getTextVariant = getTextVariant;
|
|
38
|
+
const getDefaultAdornmentProps = _ref3 => {
|
|
39
|
+
var _adornment$props;
|
|
40
|
+
let {
|
|
41
|
+
active,
|
|
42
|
+
adornment,
|
|
43
|
+
disabled,
|
|
44
|
+
isDragging,
|
|
45
|
+
variant
|
|
46
|
+
} = _ref3;
|
|
47
|
+
if ((0, _isEmpty.default)(adornment) || !adornment.type) return {};
|
|
48
|
+
if (adornment.type === _constants2.ADORNMENT_TYPES.ICON) return {
|
|
49
|
+
...adornment.props,
|
|
50
|
+
colorTheme: getTextColorTheme({
|
|
51
|
+
active,
|
|
52
|
+
disabled,
|
|
53
|
+
isDragging,
|
|
54
|
+
variant
|
|
55
|
+
}),
|
|
56
|
+
size: 20
|
|
57
|
+
};
|
|
58
|
+
if (adornment.type === _constants2.ADORNMENT_TYPES.AVATAR) return {
|
|
59
|
+
...adornment.props,
|
|
60
|
+
size: 'small'
|
|
61
|
+
};
|
|
62
|
+
if (adornment.type === _constants2.ADORNMENT_TYPES.IMAGE) return {
|
|
63
|
+
...adornment.props,
|
|
64
|
+
className: "".concat(_stylesModule.default.imageAdornment, " ").concat(((_adornment$props = adornment.props) === null || _adornment$props === void 0 ? void 0 : _adornment$props.className) || '')
|
|
65
|
+
};
|
|
66
|
+
return {};
|
|
67
|
+
};
|
|
68
|
+
exports.getDefaultAdornmentProps = getDefaultAdornmentProps;
|
|
69
|
+
const getItemsProps = _ref4 => {
|
|
70
|
+
let {
|
|
71
|
+
active,
|
|
72
|
+
adornment,
|
|
73
|
+
dataTestId,
|
|
74
|
+
disabled,
|
|
75
|
+
isDragging,
|
|
76
|
+
onClick,
|
|
77
|
+
size,
|
|
78
|
+
variant
|
|
79
|
+
} = _ref4;
|
|
80
|
+
return {
|
|
81
|
+
Adornment: adornment !== null && adornment !== void 0 && adornment.type ? _constants2.ADORNMENT_COMPONENT_MAPPER[adornment === null || adornment === void 0 ? void 0 : adornment.type] : null,
|
|
82
|
+
adornmentProps: getDefaultAdornmentProps({
|
|
83
|
+
active,
|
|
84
|
+
adornment,
|
|
85
|
+
disabled,
|
|
86
|
+
variant
|
|
87
|
+
}),
|
|
88
|
+
Container: onClick && !disabled ? _UTTouchableWithoutFeedback.default : 'div',
|
|
89
|
+
containerProps: onClick && !disabled ? {
|
|
90
|
+
onClick,
|
|
91
|
+
dataTestId
|
|
92
|
+
} : {
|
|
93
|
+
'data-testid': dataTestId
|
|
94
|
+
},
|
|
95
|
+
labelProps: {
|
|
96
|
+
colorTheme: getTextColorTheme({
|
|
97
|
+
active,
|
|
98
|
+
disabled,
|
|
99
|
+
isDragging,
|
|
100
|
+
variant
|
|
101
|
+
}),
|
|
102
|
+
variant: getTextVariant(size)
|
|
103
|
+
},
|
|
104
|
+
buttonProps: {
|
|
105
|
+
colorTheme: getButtonColorTheme({
|
|
106
|
+
active,
|
|
107
|
+
disabled,
|
|
108
|
+
isDragging,
|
|
109
|
+
variant
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
exports.getItemsProps = getItemsProps;
|
|
@@ -3,43 +3,55 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WEIGHTS = exports.VARIANTS_SIZES = exports.VARIANTS_LINE_HEIGHT = exports.VARIANTS = exports.DEFAULT_PROPS = void 0;
|
|
6
|
+
exports.WEIGHTS = exports.VARIANTS_SIZES = exports.VARIANTS_NAMES = exports.VARIANTS_LINE_HEIGHT = exports.VARIANTS = exports.DEFAULT_PROPS = void 0;
|
|
7
7
|
var _Palette = require("../../constants/Palette");
|
|
8
|
+
const VARIANTS_NAMES = exports.VARIANTS_NAMES = {
|
|
9
|
+
TITLE1: 'title1',
|
|
10
|
+
TITLE2: 'title2',
|
|
11
|
+
TITLE3: 'title3',
|
|
12
|
+
SUBTITLE1: 'subtitle1',
|
|
13
|
+
SUBTITLE2: 'subtitle2',
|
|
14
|
+
BODY: 'body',
|
|
15
|
+
SMALL: 'small',
|
|
16
|
+
XSMALL: 'xsmall',
|
|
17
|
+
TH: 'th',
|
|
18
|
+
TD: 'td'
|
|
19
|
+
};
|
|
8
20
|
const VARIANTS = exports.VARIANTS = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
[VARIANTS_NAMES.TITLE1]: 'h1',
|
|
22
|
+
[VARIANTS_NAMES.TITLE2]: 'h2',
|
|
23
|
+
[VARIANTS_NAMES.TITLE3]: 'h3',
|
|
24
|
+
[VARIANTS_NAMES.SUBTITLE1]: 'h4',
|
|
25
|
+
[VARIANTS_NAMES.SUBTITLE2]: 'h5',
|
|
26
|
+
[VARIANTS_NAMES.BODY]: 'div',
|
|
27
|
+
[VARIANTS_NAMES.SMALL]: 'div',
|
|
28
|
+
[VARIANTS_NAMES.XSMALL]: 'div',
|
|
29
|
+
[VARIANTS_NAMES.TH]: 'th',
|
|
30
|
+
[VARIANTS_NAMES.TD]: 'td'
|
|
19
31
|
};
|
|
20
32
|
const VARIANTS_SIZES = exports.VARIANTS_SIZES = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
[VARIANTS_NAMES.TITLE1]: '1.875rem',
|
|
34
|
+
[VARIANTS_NAMES.TITLE2]: '1.5rem',
|
|
35
|
+
[VARIANTS_NAMES.TITLE3]: '1.375rem',
|
|
36
|
+
[VARIANTS_NAMES.SUBTITLE1]: '1.125rem',
|
|
37
|
+
[VARIANTS_NAMES.SUBTITLE2]: '1rem',
|
|
38
|
+
[VARIANTS_NAMES.BODY]: '1rem',
|
|
39
|
+
[VARIANTS_NAMES.SMALL]: '0.875rem',
|
|
40
|
+
[VARIANTS_NAMES.XSMALL]: '0.75rem',
|
|
41
|
+
[VARIANTS_NAMES.TH]: '1rem',
|
|
42
|
+
[VARIANTS_NAMES.TD]: '1rem'
|
|
31
43
|
};
|
|
32
44
|
const VARIANTS_LINE_HEIGHT = exports.VARIANTS_LINE_HEIGHT = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
[VARIANTS_NAMES.TITLE1]: '100%',
|
|
46
|
+
[VARIANTS_NAMES.TITLE2]: '100%',
|
|
47
|
+
[VARIANTS_NAMES.TITLE3]: '100%',
|
|
48
|
+
[VARIANTS_NAMES.SUBTITLE1]: '100%',
|
|
49
|
+
[VARIANTS_NAMES.SUBTITLE2]: '1.375rem',
|
|
50
|
+
[VARIANTS_NAMES.BODY]: '1.375rem',
|
|
51
|
+
[VARIANTS_NAMES.SMALL]: '1.25rem',
|
|
52
|
+
[VARIANTS_NAMES.XSMALL]: '1.125rem',
|
|
53
|
+
[VARIANTS_NAMES.TH]: '1.375rem',
|
|
54
|
+
[VARIANTS_NAMES.TD]: '1.375rem'
|
|
43
55
|
};
|
|
44
56
|
const WEIGHTS = exports.WEIGHTS = {
|
|
45
57
|
thin: 100,
|