nitro-web 0.0.45 → 0.0.47
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/components/partials/element/accordion.tsx +28 -16
- package/components/partials/element/button.tsx +4 -4
- package/components/partials/form/field-currency.tsx +1 -1
- package/components/partials/form/field-date.tsx +3 -1
- package/components/partials/form/field.tsx +5 -6
- package/components/partials/form/select.tsx +5 -5
- package/package.json +1 -1
- package/types/util.d.ts +6 -0
- package/types/util.d.ts.map +1 -1
- package/util.js +21 -0
|
@@ -3,21 +3,16 @@ import { css } from 'twin.macro'
|
|
|
3
3
|
import { IsFirstRender } from 'nitro-web'
|
|
4
4
|
|
|
5
5
|
type AccordionProps = {
|
|
6
|
-
|
|
6
|
+
ariaControls?: string // pass to add aria-controls attribute to the accordion
|
|
7
|
+
children: React.ReactNode // first child is the header, second child is the contents
|
|
7
8
|
className?: string
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
classNameWhenExpanded?: string // handy for group styling
|
|
10
|
+
expanded?: boolean // initial value (or controlled value if onChange is passed)
|
|
11
|
+
onChange?: (event: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>, index: number) => void
|
|
12
|
+
// called when the header is clicked
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
export function Accordion({ children, className, expanded, onChange }: AccordionProps) {
|
|
13
|
-
/**
|
|
14
|
-
* @param {rxjs} children - first child is the header, second child is the contents
|
|
15
|
-
* <Accordion>
|
|
16
|
-
* <div>Header</div><div>Contents</div>
|
|
17
|
-
* </Accordion>
|
|
18
|
-
* @param {boolean} <expanded> - initial value (or controlled value if onChange is passed)
|
|
19
|
-
* @param {function} <onChange> - called when the header is clicked
|
|
20
|
-
*/
|
|
15
|
+
export function Accordion({ ariaControls, children, className, classNameWhenExpanded, expanded, onChange }: AccordionProps) {
|
|
21
16
|
const [preState, setPreState] = useState(expanded)
|
|
22
17
|
const [state, setState] = useState(expanded)
|
|
23
18
|
const [height, setHeight] = useState('auto')
|
|
@@ -28,9 +23,17 @@ export function Accordion({ children, className, expanded, onChange }: Accordion
|
|
|
28
23
|
height: 0;
|
|
29
24
|
overflow: hidden;
|
|
30
25
|
transition: height ease 0.2s;
|
|
26
|
+
a, button {
|
|
27
|
+
visibility: hidden; /* removes from tab order */
|
|
28
|
+
transition: visibility 0s 0.2s;
|
|
29
|
+
}
|
|
31
30
|
}
|
|
32
|
-
&.is-expanded >
|
|
31
|
+
&.is-expanded > *:last-child {
|
|
33
32
|
height: ${height.replace('-', '')};
|
|
33
|
+
a, button {
|
|
34
|
+
visibility: visible;
|
|
35
|
+
transition: visibility 0s;
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
38
|
`
|
|
36
39
|
|
|
@@ -60,9 +63,9 @@ export function Accordion({ children, className, expanded, onChange }: Accordion
|
|
|
60
63
|
return () => timeout && clearTimeout(timeout)
|
|
61
64
|
}, [height])
|
|
62
65
|
|
|
63
|
-
const onClick = function(e: React.MouseEvent<HTMLDivElement>) {
|
|
66
|
+
const onClick = function(e: React.MouseEvent<HTMLDivElement>|React.KeyboardEvent<HTMLDivElement>) {
|
|
64
67
|
// Click came from inside the accordion header/summary
|
|
65
|
-
if (e.currentTarget.children[0].contains(e.target as
|
|
68
|
+
if (e.currentTarget.children[0].contains(e.target as HTMLElement) || e.currentTarget.children[0] == e.target) {
|
|
66
69
|
if (onChange) {
|
|
67
70
|
onChange(e, getElementIndex(e.currentTarget))
|
|
68
71
|
} else {
|
|
@@ -77,11 +80,20 @@ export function Accordion({ children, className, expanded, onChange }: Accordion
|
|
|
77
80
|
return index
|
|
78
81
|
}
|
|
79
82
|
|
|
83
|
+
const onKeyDown = function(e: React.KeyboardEvent<HTMLDivElement>) {
|
|
84
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
85
|
+
onClick(e)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
80
89
|
return (
|
|
81
90
|
<div
|
|
82
91
|
ref={el}
|
|
83
|
-
|
|
92
|
+
aria-controls={ariaControls}
|
|
93
|
+
aria-expanded={ariaControls ? state : undefined}
|
|
94
|
+
class={['accordion', className, state ? `is-expanded ${classNameWhenExpanded}` : '', 'nitro-accordion'].filter(o => o).join(' ')}
|
|
84
95
|
onClick={onClick}
|
|
96
|
+
onKeyDown={onKeyDown}
|
|
85
97
|
css={style}
|
|
86
98
|
>
|
|
87
99
|
{children}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { twMerge } from '
|
|
1
|
+
import { twMerge } from 'nitro-web'
|
|
2
2
|
import { ChevronDown, ChevronUp } from 'lucide-react'
|
|
3
3
|
|
|
4
4
|
type Button = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
@@ -42,9 +42,9 @@ export function Button({
|
|
|
42
42
|
// Button sizes
|
|
43
43
|
const sizes = {
|
|
44
44
|
xs: 'px-2 py-1 px-button-x-xs py-button-y-xs text-xs rounded',
|
|
45
|
-
sm: 'px-2.5 py-1.5 px-button-x-sm py-button-y-sm text-sm rounded-md',
|
|
46
|
-
md: 'px-3 py-
|
|
47
|
-
lg: 'px-3.5 py-2.5 px-button-x-lg py-button-y-lg text-sm rounded-md',
|
|
45
|
+
sm: 'px-2.5 py-1.5 px-button-x-sm py-button-y-sm text-sm text-sm-button rounded-md',
|
|
46
|
+
md: 'px-3 py-[0.58rem] px-button-x-md py-button-y-md text-sm text-sm-button rounded-md', // default
|
|
47
|
+
lg: 'px-3.5 py-2.5 px-button-x-lg py-button-y-lg text-sm text-sm-button rounded-md',
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const contentLayout = `gap-x-1.5 ${iconPosition == 'none' ? '' : 'inline-flex items-center justify-center'}`
|
|
@@ -148,7 +148,7 @@ export function FieldCurrency({ config, currency='nzd', onChange, value, default
|
|
|
148
148
|
defaultValue={defaultValue}
|
|
149
149
|
/>
|
|
150
150
|
<span
|
|
151
|
-
class={`absolute top-
|
|
151
|
+
class={`absolute top-0 bottom-0 left-3 inline-flex items-center select-none text-gray-500 text-sm text-sm-input ${dollars !== null && settings.prefix == '$' ? 'text-foreground' : ''}`}
|
|
152
152
|
>
|
|
153
153
|
{settings.prefix || settings.suffix}
|
|
154
154
|
</span>
|
|
@@ -121,7 +121,9 @@ export function FieldDate({
|
|
|
121
121
|
{
|
|
122
122
|
prefix &&
|
|
123
123
|
// Similar classNames to the input.tsx:IconWrapper()
|
|
124
|
-
<span className="
|
|
124
|
+
<span className="z-[0] col-start-1 row-start-1 self-center select-none justify-self-start text-sm text-sm-input ml-3">
|
|
125
|
+
{prefix}
|
|
126
|
+
</span>
|
|
125
127
|
}
|
|
126
128
|
<input
|
|
127
129
|
{...props}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import { css } from 'twin.macro'
|
|
3
|
-
import { twMerge } from 'tailwind-merge'
|
|
4
3
|
import { util, FieldCurrency, FieldCurrencyProps, FieldColor, FieldColorProps, FieldDate, FieldDateProps } from 'nitro-web'
|
|
5
4
|
import { Errors, type Error } from 'nitro-web/types'
|
|
6
5
|
import {
|
|
@@ -141,11 +140,11 @@ function FieldContainer({ children, className, error }: { children: React.ReactN
|
|
|
141
140
|
function getInputClasses({ error, Icon, iconPos, type }: { error: Error, Icon?: React.ReactNode, iconPos: string, type?: string }) {
|
|
142
141
|
const pl = 'pl-3 pl-input-x'
|
|
143
142
|
const pr = 'pr-3 pr-input-x'
|
|
144
|
-
const py = 'py-
|
|
143
|
+
const py = 'py-[0.58rem] py-input-y'
|
|
145
144
|
const plWithIcon = type == 'color' ? 'pl-9' : 'pl-8' // was sm:pl-8 pl-8, etc
|
|
146
145
|
const prWithIcon = type == 'color' ? 'pr-9' : 'pr-8'
|
|
147
146
|
return (
|
|
148
|
-
`block ${py} col-start-1 row-start-1 w-full rounded-md bg-white text-sm
|
|
147
|
+
`block ${py} col-start-1 row-start-1 w-full rounded-md bg-white text-sm text-sm-input outline outline-1 -outline-offset-1 ` +
|
|
149
148
|
'placeholder:text-input-placeholder focus:outline focus:outline-2 focus:-outline-offset-2 ' +
|
|
150
149
|
(iconPos == 'right' && Icon ? `${pl} ${prWithIcon} ` : (Icon ? `${plWithIcon} ${pr} ` : `${pl} ${pr} `)) +
|
|
151
150
|
(error
|
|
@@ -161,11 +160,11 @@ function IconWrapper({ icon, iconPos, ...props }: IconWrapperProps) {
|
|
|
161
160
|
!!icon &&
|
|
162
161
|
<div
|
|
163
162
|
{...props}
|
|
164
|
-
className={
|
|
165
|
-
'
|
|
163
|
+
className={
|
|
164
|
+
'z-[0] size-[14px] col-start-1 row-start-1 self-center text-[#c6c8ce] select-none ' +
|
|
166
165
|
(iconPos == 'right' ? 'justify-self-end mr-3 ' : 'justify-self-start ml-3 ') +
|
|
167
166
|
props.className || ''
|
|
168
|
-
|
|
167
|
+
}
|
|
169
168
|
>{icon}</div>
|
|
170
169
|
)
|
|
171
170
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from 'twin.macro'
|
|
2
|
-
import { twMerge } from '
|
|
2
|
+
import { twMerge } from 'nitro-web'
|
|
3
3
|
import ReactSelect, { components, ControlProps, createFilter, OptionProps, SingleValueProps } from 'react-select'
|
|
4
4
|
import { ClearIndicatorProps, DropdownIndicatorProps, MultiValueRemoveProps } from 'react-select'
|
|
5
5
|
import { ChevronUpDownIcon, CheckCircleIcon, XMarkIcon } from '@heroicons/react/20/solid'
|
|
@@ -237,11 +237,11 @@ const selectStyles = {
|
|
|
237
237
|
// Based off https://www.jussivirtanen.fi/writing/styling-react-select-with-tailwind
|
|
238
238
|
// Input container
|
|
239
239
|
control: {
|
|
240
|
-
base: 'rounded-md bg-white hover:cursor-pointer text-sm
|
|
240
|
+
base: 'rounded-md bg-white hover:cursor-pointer text-sm text-sm-input outline outline-1 -outline-offset-1 outline-input-border',
|
|
241
241
|
focus: 'outline-2 -outline-offset-2 outline-input-border-focus',
|
|
242
242
|
error: 'outline-danger',
|
|
243
243
|
},
|
|
244
|
-
valueContainer: 'py-
|
|
244
|
+
valueContainer: 'py-[0.58rem] px-3 py-input-y px-input-x gap-1',
|
|
245
245
|
// Input container objects
|
|
246
246
|
input: {
|
|
247
247
|
base: 'text-input',
|
|
@@ -261,8 +261,8 @@ const selectStyles = {
|
|
|
261
261
|
indicatorsContainer: 'p-1 px-2 gap-1',
|
|
262
262
|
indicatorSeparator: 'py-0.5 before:content-[""] before:block before:bg-gray-100 before:w-px before:h-full',
|
|
263
263
|
// Dropdown menu
|
|
264
|
-
menu: 'mt-1.5 border border-dropdown-ul-border bg-white rounded-md text-sm overflow-hidden shadow-dropdown-ul',
|
|
265
|
-
groupHeading: 'ml-3 mt-2 mb-1 text-gray-500 text-sm',
|
|
264
|
+
menu: 'mt-1.5 border border-dropdown-ul-border bg-white rounded-md text-sm text-sm-input overflow-hidden shadow-dropdown-ul',
|
|
265
|
+
groupHeading: 'ml-3 mt-2 mb-1 text-gray-500 text-sm text-sm-input',
|
|
266
266
|
noOptionsMessage: 'm-1 text-gray-500 p-2 bg-gray-50 border border-dashed border-gray-200 rounded-sm',
|
|
267
267
|
option: {
|
|
268
268
|
base: 'relative px-3 py-2 !flex items-center gap-2 cursor-default',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
6
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|
package/types/util.d.ts
CHANGED
|
@@ -622,6 +622,12 @@ export function toArray<T>(variable: T | undefined): (T extends any[] ? T : T[])
|
|
|
622
622
|
* @returns {string}
|
|
623
623
|
*/
|
|
624
624
|
export function trim(string: string): string;
|
|
625
|
+
/**
|
|
626
|
+
* Merge tailwind classes, but ignore classes that shouldn't be merged, and intended as an override
|
|
627
|
+
* @param {...string} args
|
|
628
|
+
* @returns {string}
|
|
629
|
+
*/
|
|
630
|
+
export function twMerge(...args: string[]): string;
|
|
625
631
|
/**
|
|
626
632
|
* Capitalize the first letter of a string
|
|
627
633
|
* @param {string} string
|
package/types/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../util.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../util.js"],"names":[],"mappings":"AAkBA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BC;AAED;;;GAGG;AACH,yBAFa,OAAO,OAAO,EAAE,WAAW,CAevC;AAED;;;;;GAKG;AACH,8BAJW,MAAM,cACN;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,GACrB,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,+BALW,MAAM,oBACN,OAAO,gBACP,OAAO,GACL,MAAM,CAelB;AAED;;;;;GAKG;AACH,sCAJW,MAAM,wBACN,OAAO,GACL,MAAM,CAMlB;AAED;;;;GAIG;AACH,sCAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;GAIG;AACH,iCAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;GAMG;AACH,gCALW,MAAM,aACN,MAAM,oBACN,MAAM,GACJ,MAAM,CAUlB;AAED;;;;GAIG;AACH,0CAHW,MAAM,GACJ,MAAM,CAMlB;AAED;;;;;;;;;;;GAWG;AACH,2BAVW,MAAM,GAAC,IAAI,WACX,MAAM,aACN,MAAM,GACJ,MAAM,CAsBlB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,gDAbW,MAAM,YACN;IACN,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,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K,GAAC,UAAU,EAAE,GAAC,UAAU,GAAC,eAAe,GAAC,MAAM,GAAC,GAAG;;;;oBAqNxD,CAAC,MAAM,EAAE,MAAM,CAAC;;;;kBAChB;IAAC,UAAU,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAA;CAAC;;;;oBAgZpC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC"}
|
package/util.js
CHANGED
|
@@ -2,6 +2,7 @@ import _axios from 'axios'
|
|
|
2
2
|
import axiosRetry from 'axios-retry'
|
|
3
3
|
import dateformat from 'dateformat'
|
|
4
4
|
import { loadStripe } from '@stripe/stripe-js/pure.js' // pure removes ping
|
|
5
|
+
import { twMerge as _twMerge } from 'tailwind-merge'
|
|
5
6
|
|
|
6
7
|
/** @type {{[key: string]: {[key: string]: string|true}}} */
|
|
7
8
|
let queryObjectCache = {}
|
|
@@ -1540,6 +1541,26 @@ export function trim (string) {
|
|
|
1540
1541
|
return string.trim().replace(/\n\s+\n/g, '\n\n')
|
|
1541
1542
|
}
|
|
1542
1543
|
|
|
1544
|
+
/**
|
|
1545
|
+
* Merge tailwind classes, but ignore classes that shouldn't be merged, and intended as an override
|
|
1546
|
+
* @param {...string} args
|
|
1547
|
+
* @returns {string}
|
|
1548
|
+
*/
|
|
1549
|
+
export function twMerge(...args) {
|
|
1550
|
+
const ignoredClasses = /** @type {string[]} */([])
|
|
1551
|
+
const ignoreClasses = ['text-sm-button', 'text-sm-input']
|
|
1552
|
+
const classes = args.filter(Boolean).join(' ').split(' ')
|
|
1553
|
+
|
|
1554
|
+
const filteredClasses = classes.filter(c => {
|
|
1555
|
+
if (ignoreClasses.includes(c)) {
|
|
1556
|
+
ignoredClasses.push(c)
|
|
1557
|
+
return false
|
|
1558
|
+
}
|
|
1559
|
+
return true
|
|
1560
|
+
})
|
|
1561
|
+
return _twMerge(...filteredClasses) + ' ' + ignoredClasses.join(' ')
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1543
1564
|
/**
|
|
1544
1565
|
* Capitalize the first letter of a string
|
|
1545
1566
|
* @param {string} string
|