@infonomic/uikit 5.30.0 → 5.32.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/README.md +3 -29
- package/dist/components/forms/checkbox-group.d.ts +2 -0
- package/dist/components/forms/checkbox-group.d.ts.map +1 -1
- package/dist/components/forms/checkbox-group.js +4 -2
- package/dist/widgets/datepicker/datepicker.js +11 -11
- package/package.json +1 -1
- package/src/components/forms/checkbox-group.tsx +8 -1
- package/src/widgets/datepicker/datepicker.stories.tsx +2 -0
- package/src/widgets/datepicker/datepicker.tsx +11 -11
package/README.md
CHANGED
|
@@ -52,11 +52,12 @@ And then in your application in a global.css or other root CSS file...
|
|
|
52
52
|
|
|
53
53
|
```css
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
* colors, scales, utils etc., which can be
|
|
55
|
+
* Optional reset and core styles including var system for
|
|
56
|
+
* breakpoints, colors, scales, utils etc., which can be
|
|
57
57
|
* integrated with Tailwind (colors, breakpoints etc.) via
|
|
58
58
|
* Tailwind theme configuration.
|
|
59
59
|
*/
|
|
60
|
+
@import '@infonomic/uikit/reset.css';
|
|
60
61
|
@import '@infonomic/uikit/styles.css';
|
|
61
62
|
|
|
62
63
|
/**
|
|
@@ -98,33 +99,6 @@ Here's an example Tailwind CSS integration. Note that we have our own reset, and
|
|
|
98
99
|
|
|
99
100
|
@custom-variant dark (&:is(.dark *));
|
|
100
101
|
|
|
101
|
-
/*
|
|
102
|
-
Set the utility class in Tailwind to match our own, as for now
|
|
103
|
-
at least, we add the 'container' class attribute to our container
|
|
104
|
-
component - which conflicts with Tailwind's own container utility.
|
|
105
|
-
*/
|
|
106
|
-
@utility container {
|
|
107
|
-
width: 100%;
|
|
108
|
-
padding: 0 16px;
|
|
109
|
-
margin: 0 auto;
|
|
110
|
-
max-width: 960px;
|
|
111
|
-
|
|
112
|
-
/* Large */
|
|
113
|
-
@media (min-width: 1050px) {
|
|
114
|
-
max-width: 1024px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/* X-Large */
|
|
118
|
-
@media (min-width: 1230px) {
|
|
119
|
-
max-width: 1190px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/* 2X-Large */
|
|
123
|
-
@media (min-width: 1500px) {
|
|
124
|
-
max-width: 1400px;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
102
|
@theme {
|
|
129
103
|
--breakpoint-*: initial;
|
|
130
104
|
--breakpoint-sm: 640px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../../src/components/forms/checkbox-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../../src/components/forms/checkbox-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC3C,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CAC7C;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgEtD,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
|
+
import classnames from "classnames";
|
|
4
5
|
import { Checkbox } from "./checkbox.js";
|
|
5
|
-
const CheckboxGroup = ({ groupName, checkBoxes, defaultValues, controlledValue, disabled = false, onChange })=>{
|
|
6
|
+
const CheckboxGroup = ({ groupName, className, checkBoxClasses, checkBoxes, defaultValues, controlledValue, disabled = false, onChange })=>{
|
|
6
7
|
let initialValue = [];
|
|
7
8
|
if (void 0 !== controlledValue && controlledValue.length > 0) initialValue = controlledValue.split(',');
|
|
8
9
|
else if (void 0 !== defaultValues) initialValue = defaultValues;
|
|
@@ -28,11 +29,12 @@ const CheckboxGroup = ({ groupName, checkBoxes, defaultValues, controlledValue,
|
|
|
28
29
|
onChange?.(s);
|
|
29
30
|
};
|
|
30
31
|
return /*#__PURE__*/ jsx("div", {
|
|
31
|
-
className:
|
|
32
|
+
className: classnames('infonomic-checkbox-group', className),
|
|
32
33
|
children: checkBoxes.map((cb)=>/*#__PURE__*/ jsx(Checkbox, {
|
|
33
34
|
id: `${groupName}-${cb.id}`,
|
|
34
35
|
name: `${groupName}-${cb.id}`,
|
|
35
36
|
label: cb.label,
|
|
37
|
+
checkBoxClasses: checkBoxClasses,
|
|
36
38
|
checked: selected.includes(cb.id),
|
|
37
39
|
disabled: disabled,
|
|
38
40
|
onCheckedChange: (checked)=>handleCheckboxChange(cb.id, checked)
|
|
@@ -47,7 +47,7 @@ function DatePicker({ id, name, label, required, initialValue, mode = 'datetime'
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
return /*#__PURE__*/ jsxs("div", {
|
|
50
|
-
className: classnames(datepicker_module.container, containerClassName),
|
|
50
|
+
className: classnames('infonomic-datepicker-container', datepicker_module.container, containerClassName),
|
|
51
51
|
children: [
|
|
52
52
|
/*#__PURE__*/ jsx("div", {
|
|
53
53
|
style: {
|
|
@@ -65,8 +65,8 @@ function DatePicker({ id, name, label, required, initialValue, mode = 'datetime'
|
|
|
65
65
|
intent: intent,
|
|
66
66
|
inputSize: inputSize,
|
|
67
67
|
ref: inputRef,
|
|
68
|
-
className: classnames(datepicker_module.input, inputClassName),
|
|
69
|
-
inputWrapperClassName: classnames(datepicker_module["input-wrapper"], inputWrapperClassName),
|
|
68
|
+
className: classnames('infonomic-datepicker-input', datepicker_module.input, inputClassName),
|
|
69
|
+
inputWrapperClassName: classnames('infonomic-datepicker-input-wrapper', datepicker_module["input-wrapper"], inputWrapperClassName),
|
|
70
70
|
onKeyDown: handleOnKeyDown,
|
|
71
71
|
onClick: (e)=>{
|
|
72
72
|
e.preventDefault();
|
|
@@ -134,10 +134,10 @@ function DatePicker({ id, name, label, required, initialValue, mode = 'datetime'
|
|
|
134
134
|
/*#__PURE__*/ jsx(Popover.Portal, {
|
|
135
135
|
children: /*#__PURE__*/ jsxs(Popover.Content, {
|
|
136
136
|
sideOffset: 5,
|
|
137
|
-
className: classnames(datepicker_module.content, contentClassName),
|
|
137
|
+
className: classnames('infonomic-datepicker-content', datepicker_module.content, contentClassName),
|
|
138
138
|
children: [
|
|
139
139
|
/*#__PURE__*/ jsxs("div", {
|
|
140
|
-
className: datepicker_module["content-components"],
|
|
140
|
+
className: classnames('infonomic-datepicker-content-components', datepicker_module["content-components"]),
|
|
141
141
|
children: [
|
|
142
142
|
/*#__PURE__*/ jsx("div", {
|
|
143
143
|
ref: calendarRef,
|
|
@@ -195,20 +195,20 @@ function DatePicker({ id, name, label, required, initialValue, mode = 'datetime'
|
|
|
195
195
|
]
|
|
196
196
|
}),
|
|
197
197
|
/*#__PURE__*/ jsxs("div", {
|
|
198
|
-
className: datepicker_module["status-and-actions"],
|
|
198
|
+
className: classnames('infonomic-datepicker-status-and-actions', datepicker_module["status-and-actions"]),
|
|
199
199
|
children: [
|
|
200
200
|
/*#__PURE__*/ jsx("div", {
|
|
201
|
-
className: datepicker_module["content-status"],
|
|
201
|
+
className: classnames('infonomic-datepicker-content-status', datepicker_module["content-status"]),
|
|
202
202
|
children: date ? format(date, 'datetime' === mode ? 'PPPp' : 'PPP') : 'No date selected'
|
|
203
203
|
}),
|
|
204
204
|
/*#__PURE__*/ jsxs("div", {
|
|
205
|
-
className: datepicker_module["content-actions"],
|
|
205
|
+
className: classnames('infonomic-datepicker-content-actions', datepicker_module["content-actions"]),
|
|
206
206
|
children: [
|
|
207
207
|
/*#__PURE__*/ jsx("div", {
|
|
208
208
|
children: /*#__PURE__*/ jsx(Button, {
|
|
209
209
|
variant: "outlined",
|
|
210
210
|
size: "sm",
|
|
211
|
-
className: datepicker_module["content-actions-button"],
|
|
211
|
+
className: classnames('infonomic-datepicker-content-actions-button', datepicker_module["content-actions-button"]),
|
|
212
212
|
onClick: ()=>{
|
|
213
213
|
const today = new Date();
|
|
214
214
|
setDate(today);
|
|
@@ -227,7 +227,7 @@ function DatePicker({ id, name, label, required, initialValue, mode = 'datetime'
|
|
|
227
227
|
/*#__PURE__*/ jsx(Button, {
|
|
228
228
|
size: "sm",
|
|
229
229
|
intent: "noeffect",
|
|
230
|
-
className: datepicker_module["content-actions-button"],
|
|
230
|
+
className: classnames('infonomic-datepicker-content-actions-button', datepicker_module["content-actions-button"]),
|
|
231
231
|
onClick: ()=>{
|
|
232
232
|
setIsOpen(false);
|
|
233
233
|
},
|
|
@@ -236,7 +236,7 @@ function DatePicker({ id, name, label, required, initialValue, mode = 'datetime'
|
|
|
236
236
|
/*#__PURE__*/ jsx(Button, {
|
|
237
237
|
variant: "outlined",
|
|
238
238
|
size: "sm",
|
|
239
|
-
className: datepicker_module["content-actions-button"],
|
|
239
|
+
className: classnames('infonomic-datepicker-content-actions-button', datepicker_module["content-actions-button"]),
|
|
240
240
|
onClick: ()=>{
|
|
241
241
|
setIsOpen(false);
|
|
242
242
|
handleOnDateChange(date);
|
package/package.json
CHANGED
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
import type React from 'react'
|
|
4
4
|
import { useEffect, useState } from 'react'
|
|
5
5
|
|
|
6
|
+
import cx from 'classnames'
|
|
7
|
+
|
|
6
8
|
import { Checkbox } from './checkbox.js'
|
|
7
9
|
|
|
8
10
|
export interface CheckboxGroupProps {
|
|
9
11
|
groupName: string
|
|
12
|
+
className?: string
|
|
13
|
+
checkBoxClasses?: string,
|
|
10
14
|
checkBoxes: { id: string; label: string }[]
|
|
11
15
|
defaultValues?: string[]
|
|
12
16
|
controlledValue?: string
|
|
@@ -16,6 +20,8 @@ export interface CheckboxGroupProps {
|
|
|
16
20
|
|
|
17
21
|
export const CheckboxGroup: React.FC<CheckboxGroupProps> = ({
|
|
18
22
|
groupName,
|
|
23
|
+
className,
|
|
24
|
+
checkBoxClasses,
|
|
19
25
|
checkBoxes,
|
|
20
26
|
defaultValues,
|
|
21
27
|
controlledValue,
|
|
@@ -61,13 +67,14 @@ export const CheckboxGroup: React.FC<CheckboxGroupProps> = ({
|
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
return (
|
|
64
|
-
<div className=
|
|
70
|
+
<div className={cx('infonomic-checkbox-group', className)}>
|
|
65
71
|
{checkBoxes.map((cb) => (
|
|
66
72
|
<Checkbox
|
|
67
73
|
key={cb.id}
|
|
68
74
|
id={`${groupName}-${cb.id}`}
|
|
69
75
|
name={`${groupName}-${cb.id}`}
|
|
70
76
|
label={cb.label}
|
|
77
|
+
checkBoxClasses={checkBoxClasses}
|
|
71
78
|
checked={selected.includes(cb.id)}
|
|
72
79
|
disabled={disabled}
|
|
73
80
|
onCheckedChange={(checked) => handleCheckboxChange(cb.id, checked)}
|
|
@@ -19,6 +19,7 @@ export const Default = (): React.JSX.Element => {
|
|
|
19
19
|
onDateChange={handleDateChange}
|
|
20
20
|
id="published_on"
|
|
21
21
|
name="published_on"
|
|
22
|
+
yearsInPast={70}
|
|
22
23
|
variant="outlined"
|
|
23
24
|
helpText="Select published on date."
|
|
24
25
|
/>
|
|
@@ -32,6 +33,7 @@ export const Default = (): React.JSX.Element => {
|
|
|
32
33
|
id="published_on"
|
|
33
34
|
name="published_on"
|
|
34
35
|
variant="outlined"
|
|
36
|
+
yearsInPast={70}
|
|
35
37
|
helpText="Select published on date."
|
|
36
38
|
/>
|
|
37
39
|
</div>
|
|
@@ -136,7 +136,7 @@ export function DatePicker({
|
|
|
136
136
|
})
|
|
137
137
|
|
|
138
138
|
return (
|
|
139
|
-
<div className={cx(styles.container, containerClassName)}>
|
|
139
|
+
<div className={cx('infonomic-datepicker-container', styles.container, containerClassName)}>
|
|
140
140
|
<div style={{ display: 'flex', alignItems: 'center', gap: 'var(--spacing-8)' }}>
|
|
141
141
|
<Input
|
|
142
142
|
id={id}
|
|
@@ -148,8 +148,8 @@ export function DatePicker({
|
|
|
148
148
|
intent={intent}
|
|
149
149
|
inputSize={inputSize}
|
|
150
150
|
ref={inputRef}
|
|
151
|
-
className={cx(styles.input, inputClassName)}
|
|
152
|
-
inputWrapperClassName={cx(styles['input-wrapper'], inputWrapperClassName)}
|
|
151
|
+
className={cx('infonomic-datepicker-input', styles.input, inputClassName)}
|
|
152
|
+
inputWrapperClassName={cx('infonomic-datepicker-input-wrapper', styles['input-wrapper'], inputWrapperClassName)}
|
|
153
153
|
onKeyDown={handleOnKeyDown}
|
|
154
154
|
onClick={(e) => {
|
|
155
155
|
e.preventDefault()
|
|
@@ -200,8 +200,8 @@ export function DatePicker({
|
|
|
200
200
|
</div>
|
|
201
201
|
</Popover.Trigger>
|
|
202
202
|
<Popover.Portal>
|
|
203
|
-
<Popover.Content sideOffset={5} className={cx(styles.content, contentClassName)}>
|
|
204
|
-
<div className={styles['content-components']}>
|
|
203
|
+
<Popover.Content sideOffset={5} className={cx('infonomic-datepicker-content', styles.content, contentClassName)}>
|
|
204
|
+
<div className={cx('infonomic-datepicker-content-components', styles['content-components'])}>
|
|
205
205
|
<div ref={calendarRef}>
|
|
206
206
|
<Calendar
|
|
207
207
|
mode="single"
|
|
@@ -270,16 +270,16 @@ export function DatePicker({
|
|
|
270
270
|
</div>
|
|
271
271
|
)}
|
|
272
272
|
</div>
|
|
273
|
-
<div className={styles['status-and-actions']}>
|
|
274
|
-
<div className={styles['content-status']}>
|
|
273
|
+
<div className={cx('infonomic-datepicker-status-and-actions', styles['status-and-actions'])}>
|
|
274
|
+
<div className={cx('infonomic-datepicker-content-status', styles['content-status'])}>
|
|
275
275
|
{date ? format(date, mode === 'datetime' ? 'PPPp' : 'PPP') : 'No date selected'}
|
|
276
276
|
</div>
|
|
277
|
-
<div className={styles['content-actions']}>
|
|
277
|
+
<div className={cx('infonomic-datepicker-content-actions', styles['content-actions'])}>
|
|
278
278
|
<div>
|
|
279
279
|
<Button
|
|
280
280
|
variant="outlined"
|
|
281
281
|
size="sm"
|
|
282
|
-
className={styles['content-actions-button']}
|
|
282
|
+
className={cx('infonomic-datepicker-content-actions-button', styles['content-actions-button'])}
|
|
283
283
|
onClick={() => {
|
|
284
284
|
const today = new Date()
|
|
285
285
|
setDate(today)
|
|
@@ -294,7 +294,7 @@ export function DatePicker({
|
|
|
294
294
|
<Button
|
|
295
295
|
size="sm"
|
|
296
296
|
intent="noeffect"
|
|
297
|
-
className={styles['content-actions-button']}
|
|
297
|
+
className={cx('infonomic-datepicker-content-actions-button', styles['content-actions-button'])}
|
|
298
298
|
onClick={() => {
|
|
299
299
|
setIsOpen(false)
|
|
300
300
|
}}
|
|
@@ -304,7 +304,7 @@ export function DatePicker({
|
|
|
304
304
|
<Button
|
|
305
305
|
variant="outlined"
|
|
306
306
|
size="sm"
|
|
307
|
-
className={styles['content-actions-button']}
|
|
307
|
+
className={cx('infonomic-datepicker-content-actions-button', styles['content-actions-button'])}
|
|
308
308
|
onClick={() => {
|
|
309
309
|
setIsOpen(false)
|
|
310
310
|
handleOnDateChange(date)
|