@solexllc/usx-react 0.3.1 → 0.4.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 +132 -0
- package/dist/index.cjs +181 -182
- package/dist/index.js +181 -182
- package/package.json +6 -5
- package/src/assets.ts +16 -0
- package/src/components/alert/Alert.tsx +4 -3
- package/src/components/alert/alert.django.html +2 -3
- package/src/components/alert/config.json +15 -4
- package/src/components/banner/Banner.tsx +8 -6
- package/src/components/banner/banner.django.html +4 -5
- package/src/components/banner/config.json +5 -1
- package/src/components/button/Button.tsx +1 -1
- package/src/components/button/button.django.html +2 -2
- package/src/components/button/config.json +14 -6
- package/src/components/code/Code.tsx +4 -27
- package/src/components/code/code.django.html +3 -9
- package/src/components/code/config.json +4 -0
- package/src/components/copy-to-clipboard/CopyToClipboard.tsx +35 -24
- package/src/components/copy-to-clipboard/config.json +14 -7
- package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +14 -14
- package/src/components/footer/Footer.tsx +26 -6
- package/src/components/footer/config.json +4 -0
- package/src/components/footer/footer.django.html +10 -9
- package/src/components/header/Branding.tsx +9 -6
- package/src/components/header/Header.tsx +3 -1
- package/src/components/header/config.json +4 -0
- package/src/components/header/header.django.html +5 -26
- package/src/components/header/header.html +10 -10
- package/src/components/icon/Icon.tsx +6 -3
- package/src/components/icon/config.json +12 -6
- package/src/components/icon/icon.django.html +6 -4
- package/src/components/image/Image.tsx +8 -4
- package/src/components/image/config.json +10 -2
- package/src/components/image/image.django.html +8 -6
- package/src/components/layout/config.json +9 -9
- package/src/components/layout/layout.django.html +1 -1
- package/src/components/spinner/Spinner.tsx +18 -25
- package/src/components/spinner/config.json +4 -0
- package/src/components/spinner/spinner.django.html +4 -6
- package/src/components/tooltip/Tooltip.tsx +4 -2
- package/src/components/tooltip/config.json +7 -2
- package/src/components/tooltip/tooltip.django.html +1 -1
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
"template": "spinner/spinner.django.html",
|
|
4
4
|
"version": 1,
|
|
5
5
|
"props": {
|
|
6
|
+
"staticBaseUrl": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "Optional asset base for this component. A non-empty value overrides window.usxBaseUrl in React or STATIC_URL in Django; otherwise the global base or / is used. Asset filenames remain separate."
|
|
9
|
+
},
|
|
6
10
|
"size": {
|
|
7
11
|
"type": "select",
|
|
8
12
|
"options": [
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
{% load
|
|
1
|
+
{% load components %}
|
|
2
2
|
{# Django template for Spinner #}
|
|
3
3
|
<span role="status" aria-live="polite" class="usx-spinner{% if className %} {{ className }}{% endif %}">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
{% if screenReaderLabel %}<span class="usa-sr-only">{{ screenReaderLabel }}</span>{% endif %}
|
|
8
|
-
{% if label %}<span class="usa-label usx-label">{{ label }}</span>{% endif %}
|
|
4
|
+
{% icon name="spinner" source="usx" size=size|default:3 color=color staticBaseUrl=staticBaseUrl staticUrlPrefix=staticUrlPrefix %}{% endicon %}
|
|
5
|
+
{% if screenReaderLabel %}{% label screenReaderOnly=True %}{{ screenReaderLabel }}{% endlabel %}{% endif %}
|
|
6
|
+
{% if label %}{% label %}{{ label }}{% endlabel %}{% endif %}
|
|
9
7
|
</span>
|
|
@@ -2,10 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
|
|
4
4
|
export interface TooltipProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
5
|
-
label:
|
|
5
|
+
label: React.ReactNode;
|
|
6
6
|
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
className?: string;
|
|
9
|
+
bodyClassName?: string;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
const Tooltip: React.FC<TooltipProps> = ({
|
|
@@ -13,6 +14,7 @@ const Tooltip: React.FC<TooltipProps> = ({
|
|
|
13
14
|
position = 'top',
|
|
14
15
|
children,
|
|
15
16
|
className = '',
|
|
17
|
+
bodyClassName = '',
|
|
16
18
|
...props
|
|
17
19
|
}) => {
|
|
18
20
|
const validPositions = ['top', 'bottom', 'left', 'right'] as const;
|
|
@@ -21,7 +23,7 @@ const Tooltip: React.FC<TooltipProps> = ({
|
|
|
21
23
|
<span className={classNames('usx-tooltip', className)} {...props}>
|
|
22
24
|
{children}
|
|
23
25
|
<span
|
|
24
|
-
className={
|
|
26
|
+
className={classNames('usa-tooltip__body', `usa-tooltip__body--${normalizedPosition}`, bodyClassName)}
|
|
25
27
|
role="tooltip"
|
|
26
28
|
>
|
|
27
29
|
{label}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"version": 1,
|
|
5
5
|
"props": {
|
|
6
6
|
"label": {
|
|
7
|
-
"type": "
|
|
7
|
+
"type": "slot",
|
|
8
8
|
"default": "Tooltip text",
|
|
9
|
-
"description": "
|
|
9
|
+
"description": "Content displayed inside the tooltip body. Accepts text or composed content, such as React nodes or a Django template fragment."
|
|
10
10
|
},
|
|
11
11
|
"position": {
|
|
12
12
|
"type": "select",
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
"type": "string",
|
|
29
29
|
"default": "",
|
|
30
30
|
"description": "Additional CSS classes to apply to the tooltip wrapper."
|
|
31
|
+
},
|
|
32
|
+
"bodyClassName": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"default": "",
|
|
35
|
+
"description": "Additional CSS classes to apply to the tooltip body."
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{# Django template for Tooltip #}
|
|
2
2
|
<span class="usx-tooltip{% if className %} {{ className }}{% endif %}">
|
|
3
3
|
{% if children %}{{ children|safe }}{% endif %}
|
|
4
|
-
<span class="usa-tooltip__body usa-tooltip__body--{{ position|default:'top' }}" role="tooltip">{{ label|default:"Tooltip text" }}</span>
|
|
4
|
+
<span class="usa-tooltip__body usa-tooltip__body--{{ position|default:'top' }}{% if bodyClassName %} {{ bodyClassName }}{% endif %}" role="tooltip">{{ label|default:"Tooltip text" }}</span>
|
|
5
5
|
</span>
|