@nysds/components 1.21.1-alpha-1 → 1.22.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/custom-elements.json +1794 -1170
- package/dist/.vscode/vscode.css-custom-data.json +115 -0
- package/dist/.vscode/vscode.html-custom-data.json +116 -61
- package/dist/custom-elements.json +1791 -1119
- package/dist/{nys-icon.library-CwuPZJAc.js → nys-icon.library-BZ3jVyhP.js} +2 -2
- package/dist/{nys-icon.library-D_YvOGLH.js.map → nys-icon.library-BZ3jVyhP.js.map} +1 -1
- package/dist/{nys-icon.library-Bi_7DKlD-BEL9M8Q4.js → nys-icon.library-DYsQ8Tiv-DYS-TkV2.js} +12 -4
- package/dist/nys-icon.library-DYsQ8Tiv-DYS-TkV2.js.map +1 -0
- package/dist/nysds.es.js +5422 -4579
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +479 -457
- package/dist/nysds.js.map +1 -1
- package/dist/packages/codegen/src/index.d.ts +16 -0
- package/dist/packages/codegen/src/manifest/components.d.ts +5 -0
- package/dist/packages/codegen/src/manifest/filters.d.ts +5 -0
- package/dist/packages/codegen/src/manifest/form-control.d.ts +5 -0
- package/dist/packages/codegen/src/manifest/load.d.ts +10 -0
- package/dist/packages/codegen/src/manifest/naming.d.ts +6 -0
- package/dist/packages/codegen/src/manifest/packages.d.ts +5 -0
- package/dist/packages/codegen/src/manifest/types.d.ts +6 -0
- package/dist/packages/codegen/src/transform/index.d.ts +19 -0
- package/dist/packages/codegen/src/transform/parse.d.ts +18 -0
- package/dist/packages/codegen/src/transform/shared.d.ts +61 -0
- package/dist/packages/codegen/src/transform/to-angular.d.ts +6 -0
- package/dist/packages/codegen/src/transform/to-jsx.d.ts +6 -0
- package/dist/packages/internals/src/form-control-mixin.d.ts +16 -0
- package/dist/packages/internals/src/form-events.d.ts +22 -0
- package/dist/packages/internals/src/index.d.ts +2 -1
- package/dist/packages/internals/src/types.d.ts +6 -0
- package/dist/packages/mcp-server/src/lib/cem-parser.d.ts +12 -0
- package/dist/packages/mcp-server/src/lib/framework-snippets.d.ts +35 -0
- package/dist/packages/mcp-server/src/lib/framework-usage.d.ts +19 -0
- package/dist/packages/mcp-server/src/lib/frameworks-data.d.ts +18 -0
- package/dist/packages/mcp-server/src/resources/frameworks.d.ts +14 -0
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +12 -0
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +9 -1
- package/dist/packages/nys-alert/src/nys-alert.d.ts +39 -1
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +16 -0
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +14 -2
- package/dist/packages/nys-badge/src/nys-badge.d.ts +18 -0
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +29 -3
- package/dist/packages/nys-button/src/nys-button.d.ts +35 -4
- package/dist/packages/nys-card/src/nys-card.d.ts +72 -0
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +77 -7
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +46 -0
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +51 -6
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +44 -2
- package/dist/packages/nys-divider/src/nys-divider.d.ts +9 -0
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +17 -0
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +10 -0
- package/dist/packages/nys-fileinput/src/index.d.ts +1 -0
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +42 -6
- package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +9 -1
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +18 -0
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +36 -55
- package/dist/packages/nys-icon/src/nys-icon.d.ts +18 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +38 -1
- package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +6 -0
- package/dist/packages/nys-label/src/nys-label.d.ts +3 -1
- package/dist/packages/nys-modal/src/nys-modal.d.ts +26 -2
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +21 -2
- package/dist/packages/nys-processlist/src/nys-processlist.d.ts +16 -0
- package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +1 -1
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +29 -5
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +66 -4
- package/dist/packages/nys-select/src/nys-select.d.ts +22 -4
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +8 -0
- package/dist/packages/nys-stepper/src/nys-step.d.ts +8 -1
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +8 -0
- package/dist/packages/nys-tab/src/nys-tab.d.ts +22 -3
- package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +12 -0
- package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +2 -0
- package/dist/packages/nys-table/src/nys-table.d.ts +39 -2
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +47 -4
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +42 -4
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +37 -3
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +13 -0
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +13 -0
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +28 -19
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +14 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +11 -0
- package/dist/packages/nys-video/src/nys-video.d.ts +14 -1
- package/package.json +32 -27
- package/dist/nys-icon.library-Bi_7DKlD-BEL9M8Q4.js.map +0 -1
- package/dist/nys-icon.library-Bi_7DKlD-YSs5zqZy.js +0 -698
- package/dist/nys-icon.library-Bi_7DKlD-YSs5zqZy.js.map +0 -1
- package/dist/nys-icon.library-CwuPZJAc.js.map +0 -1
- package/dist/nys-icon.library-D_YvOGLH.js +0 -696
- package/packages/react/NysAccordion.d.ts +0 -75
- package/packages/react/NysAccordion.js +0 -24
- package/packages/react/NysAccordionItem.d.ts +0 -82
- package/packages/react/NysAccordionItem.js +0 -43
- package/packages/react/NysAlert.d.ts +0 -102
- package/packages/react/NysAlert.js +0 -61
- package/packages/react/NysAvatar.d.ts +0 -88
- package/packages/react/NysAvatar.js +0 -40
- package/packages/react/NysBacktotop.d.ts +0 -57
- package/packages/react/NysBacktotop.js +0 -23
- package/packages/react/NysBadge.d.ts +0 -78
- package/packages/react/NysBadge.js +0 -42
- package/packages/react/NysBreadcrumbItem.d.ts +0 -72
- package/packages/react/NysBreadcrumbItem.js +0 -42
- package/packages/react/NysBreadcrumbs.d.ts +0 -89
- package/packages/react/NysBreadcrumbs.js +0 -50
- package/packages/react/NysButton.d.ts +0 -171
- package/packages/react/NysButton.js +0 -83
- package/packages/react/NysCard.d.ts +0 -110
- package/packages/react/NysCard.js +0 -61
- package/packages/react/NysCheckbox.d.ts +0 -145
- package/packages/react/NysCheckbox.js +0 -78
- package/packages/react/NysCheckboxgroup.d.ts +0 -88
- package/packages/react/NysCheckboxgroup.js +0 -46
- package/packages/react/NysCombobox.d.ts +0 -126
- package/packages/react/NysCombobox.js +0 -66
- package/packages/react/NysDatepicker.d.ts +0 -128
- package/packages/react/NysDatepicker.js +0 -76
- package/packages/react/NysDivider.d.ts +0 -54
- package/packages/react/NysDivider.js +0 -22
- package/packages/react/NysDropdownMenu.d.ts +0 -59
- package/packages/react/NysDropdownMenu.js +0 -23
- package/packages/react/NysDropdownMenuItem.d.ts +0 -75
- package/packages/react/NysDropdownMenuItem.js +0 -47
- package/packages/react/NysErrorMessage.d.ts +0 -60
- package/packages/react/NysErrorMessage.js +0 -24
- package/packages/react/NysFileItem.d.ts +0 -69
- package/packages/react/NysFileItem.js +0 -37
- package/packages/react/NysFileinput.d.ts +0 -130
- package/packages/react/NysFileinput.js +0 -74
- package/packages/react/NysGlobalFooter.d.ts +0 -77
- package/packages/react/NysGlobalFooter.js +0 -32
- package/packages/react/NysGlobalHeader.d.ts +0 -85
- package/packages/react/NysGlobalHeader.js +0 -34
- package/packages/react/NysIcon.d.ts +0 -75
- package/packages/react/NysIcon.js +0 -50
- package/packages/react/NysIconlist.d.ts +0 -54
- package/packages/react/NysIconlist.js +0 -22
- package/packages/react/NysIconlistitem.d.ts +0 -59
- package/packages/react/NysIconlistitem.js +0 -22
- package/packages/react/NysLabel.d.ts +0 -81
- package/packages/react/NysLabel.js +0 -40
- package/packages/react/NysModal.d.ts +0 -90
- package/packages/react/NysModal.js +0 -50
- package/packages/react/NysOption.d.ts +0 -66
- package/packages/react/NysOption.js +0 -25
- package/packages/react/NysPagination.d.ts +0 -72
- package/packages/react/NysPagination.js +0 -45
- package/packages/react/NysProcesslist.d.ts +0 -65
- package/packages/react/NysProcesslist.js +0 -25
- package/packages/react/NysProcesslistitem.d.ts +0 -61
- package/packages/react/NysProcesslistitem.js +0 -35
- package/packages/react/NysRadiobutton.d.ts +0 -132
- package/packages/react/NysRadiobutton.js +0 -72
- package/packages/react/NysRadiogroup.d.ts +0 -104
- package/packages/react/NysRadiogroup.js +0 -62
- package/packages/react/NysSelect.d.ts +0 -119
- package/packages/react/NysSelect.js +0 -67
- package/packages/react/NysSkipnav.d.ts +0 -54
- package/packages/react/NysSkipnav.js +0 -22
- package/packages/react/NysStep.d.ts +0 -73
- package/packages/react/NysStep.js +0 -40
- package/packages/react/NysStepper.d.ts +0 -67
- package/packages/react/NysStepper.js +0 -26
- package/packages/react/NysTab.d.ts +0 -90
- package/packages/react/NysTab.js +0 -39
- package/packages/react/NysTabgroup.d.ts +0 -76
- package/packages/react/NysTabgroup.js +0 -22
- package/packages/react/NysTable.d.ts +0 -80
- package/packages/react/NysTable.js +0 -41
- package/packages/react/NysTabpanel.d.ts +0 -70
- package/packages/react/NysTabpanel.js +0 -21
- package/packages/react/NysTextarea.d.ts +0 -141
- package/packages/react/NysTextarea.js +0 -79
- package/packages/react/NysTextinput.d.ts +0 -144
- package/packages/react/NysTextinput.js +0 -83
- package/packages/react/NysToggle.d.ts +0 -102
- package/packages/react/NysToggle.js +0 -59
- package/packages/react/NysTooltip.d.ts +0 -60
- package/packages/react/NysTooltip.js +0 -24
- package/packages/react/NysUnavFooter.d.ts +0 -61
- package/packages/react/NysUnavFooter.js +0 -21
- package/packages/react/NysUnavHeader.d.ts +0 -98
- package/packages/react/NysUnavHeader.js +0 -56
- package/packages/react/NysVerticalnav.d.ts +0 -67
- package/packages/react/NysVerticalnav.js +0 -26
- package/packages/react/NysVerticalnavGroup.d.ts +0 -76
- package/packages/react/NysVerticalnavGroup.js +0 -43
- package/packages/react/NysVideo.d.ts +0 -83
- package/packages/react/NysVideo.js +0 -53
- package/packages/react/README.md +0 -92
- package/packages/react/index.d.ts +0 -49
- package/packages/react/index.js +0 -49
- package/packages/react/nysds-jsx.d.ts +0 -1998
- package/packages/react/react-utils.js +0 -40
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
|
-
import "../../dist/nysds.es.js";
|
|
3
|
-
import { useEventListener, useProperties } from "./react-utils.js";
|
|
4
|
-
|
|
5
|
-
export const NysCard = forwardRef((props, forwardedRef) => {
|
|
6
|
-
const ref = useRef(null);
|
|
7
|
-
const {
|
|
8
|
-
inset,
|
|
9
|
-
elevated,
|
|
10
|
-
id,
|
|
11
|
-
preheading,
|
|
12
|
-
heading,
|
|
13
|
-
headingLevel,
|
|
14
|
-
subheading,
|
|
15
|
-
description,
|
|
16
|
-
href,
|
|
17
|
-
target,
|
|
18
|
-
onClick,
|
|
19
|
-
...filteredProps
|
|
20
|
-
} = props;
|
|
21
|
-
|
|
22
|
-
/** Event listeners - run once */
|
|
23
|
-
useEventListener(ref, "nys-click", props.onNysClick);
|
|
24
|
-
useEventListener(ref, "nys-focus", props.onNysFocus);
|
|
25
|
-
useEventListener(ref, "nys-blur", props.onNysBlur);
|
|
26
|
-
|
|
27
|
-
/** Properties - run whenever a property has changed */
|
|
28
|
-
useProperties(ref, "onClick", props.onClick);
|
|
29
|
-
|
|
30
|
-
return React.createElement(
|
|
31
|
-
"nys-card",
|
|
32
|
-
{
|
|
33
|
-
ref: (node) => {
|
|
34
|
-
ref.current = node;
|
|
35
|
-
if (typeof forwardedRef === "function") {
|
|
36
|
-
forwardedRef(node);
|
|
37
|
-
} else if (forwardedRef) {
|
|
38
|
-
forwardedRef.current = node;
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
...filteredProps,
|
|
42
|
-
id: props.id,
|
|
43
|
-
preheading: props.preheading,
|
|
44
|
-
heading: props.heading,
|
|
45
|
-
headingLevel: props.headingLevel,
|
|
46
|
-
subheading: props.subheading,
|
|
47
|
-
description: props.description,
|
|
48
|
-
href: props.href,
|
|
49
|
-
target: props.target,
|
|
50
|
-
class: props.className,
|
|
51
|
-
exportparts: props.exportparts,
|
|
52
|
-
for: props.htmlFor,
|
|
53
|
-
part: props.part,
|
|
54
|
-
tabindex: props.tabIndex,
|
|
55
|
-
inset: props.inset ? true : undefined,
|
|
56
|
-
elevated: props.elevated ? true : undefined,
|
|
57
|
-
style: { ...props.style },
|
|
58
|
-
},
|
|
59
|
-
props.children,
|
|
60
|
-
);
|
|
61
|
-
});
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
NysCheckbox as NysCheckboxElement,
|
|
4
|
-
CustomEvent,
|
|
5
|
-
Event,
|
|
6
|
-
} from "../../dist/nysds.es.js";
|
|
7
|
-
|
|
8
|
-
export type { NysCheckboxElement, CustomEvent, Event };
|
|
9
|
-
|
|
10
|
-
export interface NysCheckboxProps extends Pick<
|
|
11
|
-
React.AllHTMLAttributes<HTMLElement>,
|
|
12
|
-
| "children"
|
|
13
|
-
| "dir"
|
|
14
|
-
| "hidden"
|
|
15
|
-
| "id"
|
|
16
|
-
| "lang"
|
|
17
|
-
| "slot"
|
|
18
|
-
| "style"
|
|
19
|
-
| "title"
|
|
20
|
-
| "translate"
|
|
21
|
-
| "onClick"
|
|
22
|
-
| "onFocus"
|
|
23
|
-
| "onBlur"
|
|
24
|
-
> {
|
|
25
|
-
/** Whether checkbox is checked. */
|
|
26
|
-
checked?: boolean;
|
|
27
|
-
|
|
28
|
-
/** Prevents interaction. */
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
|
|
31
|
-
/** Marks as required. Validates that checkbox is checked. */
|
|
32
|
-
required?: boolean;
|
|
33
|
-
|
|
34
|
-
/** Shows error message when true. */
|
|
35
|
-
showError?: boolean;
|
|
36
|
-
|
|
37
|
-
/** Internal: Set by parent checkboxgroup. Do not set manually. */
|
|
38
|
-
groupExist?: boolean;
|
|
39
|
-
|
|
40
|
-
/** Renders as tile with larger clickable area. Apply to group for consistency. */
|
|
41
|
-
tile?: boolean;
|
|
42
|
-
|
|
43
|
-
/** undefined */
|
|
44
|
-
other?: boolean;
|
|
45
|
-
|
|
46
|
-
/** undefined */
|
|
47
|
-
showOtherError?: boolean;
|
|
48
|
-
|
|
49
|
-
/** Suppress the internal visible `<nys-label>` (use with `labelledby` for
|
|
50
|
-
table cells). */
|
|
51
|
-
hideLabel?: boolean;
|
|
52
|
-
|
|
53
|
-
/** Visible label text. Required for accessibility. */
|
|
54
|
-
label?: NysCheckboxElement["label"];
|
|
55
|
-
|
|
56
|
-
/** Helper text below label. Use slot for custom HTML. */
|
|
57
|
-
description?: NysCheckboxElement["description"];
|
|
58
|
-
|
|
59
|
-
/** Unique identifier. Auto-generated if not provided. */
|
|
60
|
-
id?: NysCheckboxElement["id"];
|
|
61
|
-
|
|
62
|
-
/** Name for form submission. Use same name for grouped checkboxes. */
|
|
63
|
-
name?: NysCheckboxElement["name"];
|
|
64
|
-
|
|
65
|
-
/** Value submitted when checked. */
|
|
66
|
-
value?: NysCheckboxElement["value"];
|
|
67
|
-
|
|
68
|
-
/** Form `id` to associate with when checkbox is outside form element. */
|
|
69
|
-
form?: NysCheckboxElement["form"];
|
|
70
|
-
|
|
71
|
-
/** Error message text. Shown only when `showError` is true. */
|
|
72
|
-
errorMessage?: NysCheckboxElement["errorMessage"];
|
|
73
|
-
|
|
74
|
-
/** Tooltip text shown on hover/focus of info icon. */
|
|
75
|
-
tooltip?: NysCheckboxElement["tooltip"];
|
|
76
|
-
|
|
77
|
-
/** Checkbox size: `sm` (24px) or `md` (32px, default). */
|
|
78
|
-
size?: NysCheckboxElement["size"];
|
|
79
|
-
|
|
80
|
-
/** Id of an element in the host's light-DOM tree to borrow the accessible name
|
|
81
|
-
from (e.g. a table column `<th>`). Enables labelling a checkbox that has no
|
|
82
|
-
visible label of its own. */
|
|
83
|
-
labelledby?: NysCheckboxElement["labelledby"];
|
|
84
|
-
|
|
85
|
-
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
86
|
-
className?: string;
|
|
87
|
-
|
|
88
|
-
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
89
|
-
exportparts?: string;
|
|
90
|
-
|
|
91
|
-
/** Used for labels to link them with their inputs (using input id). */
|
|
92
|
-
htmlFor?: string;
|
|
93
|
-
|
|
94
|
-
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
95
|
-
key?: number | string;
|
|
96
|
-
|
|
97
|
-
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
98
|
-
part?: string;
|
|
99
|
-
|
|
100
|
-
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
101
|
-
ref?: any;
|
|
102
|
-
|
|
103
|
-
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
104
|
-
tabIndex?: number;
|
|
105
|
-
|
|
106
|
-
/** Fired when checked state changes. Detail: `{id, checked, name, value}`. */
|
|
107
|
-
onNysChange?: (event: CustomEvent) => void;
|
|
108
|
-
|
|
109
|
-
/** Fired when "other" text input value changes. Detail: `{id, name, value}`. */
|
|
110
|
-
onNysOtherInput?: (event: CustomEvent) => void;
|
|
111
|
-
|
|
112
|
-
/** Fired when checkbox gains focus. */
|
|
113
|
-
onNysFocus?: (event: CustomEvent) => void;
|
|
114
|
-
|
|
115
|
-
/** Fired when checkbox loses focus. */
|
|
116
|
-
onNysBlur?: (event: CustomEvent) => void;
|
|
117
|
-
|
|
118
|
-
/** undefined */
|
|
119
|
-
onNysError?: (event: CustomEvent) => void;
|
|
120
|
-
|
|
121
|
-
/** undefined */
|
|
122
|
-
onNysErrorClear?: (event: CustomEvent) => void;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Checkbox for binary choices or multi-select options.
|
|
127
|
-
* ---
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* ### **Events:**
|
|
131
|
-
* - **nys-change** - Fired when checked state changes. Detail: `{id, checked, name, value}`.
|
|
132
|
-
* - **nys-other-input** - Fired when "other" text input value changes. Detail: `{id, name, value}`.
|
|
133
|
-
* - **nys-focus** - Fired when checkbox gains focus.
|
|
134
|
-
* - **nys-blur** - Fired when checkbox loses focus.
|
|
135
|
-
* - **nys-error**
|
|
136
|
-
* - **nys-error-clear**
|
|
137
|
-
*
|
|
138
|
-
* ### **Methods:**
|
|
139
|
-
* - **checkValidity(): _boolean_** - Functions
|
|
140
|
-
* --------------------------------------------------------------------------
|
|
141
|
-
*
|
|
142
|
-
* ### **Slots:**
|
|
143
|
-
* - **description** - Custom HTML description content.
|
|
144
|
-
*/
|
|
145
|
-
export const NysCheckbox: React.ForwardRefExoticComponent<NysCheckboxProps>;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
|
-
import "../../dist/nysds.es.js";
|
|
3
|
-
import { useEventListener } from "./react-utils.js";
|
|
4
|
-
|
|
5
|
-
export const NysCheckbox = forwardRef((props, forwardedRef) => {
|
|
6
|
-
const ref = useRef(null);
|
|
7
|
-
const {
|
|
8
|
-
checked,
|
|
9
|
-
disabled,
|
|
10
|
-
required,
|
|
11
|
-
showError,
|
|
12
|
-
groupExist,
|
|
13
|
-
tile,
|
|
14
|
-
other,
|
|
15
|
-
showOtherError,
|
|
16
|
-
hideLabel,
|
|
17
|
-
label,
|
|
18
|
-
description,
|
|
19
|
-
id,
|
|
20
|
-
name,
|
|
21
|
-
value,
|
|
22
|
-
form,
|
|
23
|
-
errorMessage,
|
|
24
|
-
tooltip,
|
|
25
|
-
size,
|
|
26
|
-
labelledby,
|
|
27
|
-
...filteredProps
|
|
28
|
-
} = props;
|
|
29
|
-
|
|
30
|
-
/** Event listeners - run once */
|
|
31
|
-
useEventListener(ref, "nys-change", props.onNysChange);
|
|
32
|
-
useEventListener(ref, "nys-other-input", props.onNysOtherInput);
|
|
33
|
-
useEventListener(ref, "nys-focus", props.onNysFocus);
|
|
34
|
-
useEventListener(ref, "nys-blur", props.onNysBlur);
|
|
35
|
-
useEventListener(ref, "nys-error", props.onNysError);
|
|
36
|
-
useEventListener(ref, "nys-error-clear", props.onNysErrorClear);
|
|
37
|
-
|
|
38
|
-
return React.createElement(
|
|
39
|
-
"nys-checkbox",
|
|
40
|
-
{
|
|
41
|
-
ref: (node) => {
|
|
42
|
-
ref.current = node;
|
|
43
|
-
if (typeof forwardedRef === "function") {
|
|
44
|
-
forwardedRef(node);
|
|
45
|
-
} else if (forwardedRef) {
|
|
46
|
-
forwardedRef.current = node;
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
...filteredProps,
|
|
50
|
-
label: props.label,
|
|
51
|
-
description: props.description,
|
|
52
|
-
id: props.id,
|
|
53
|
-
name: props.name,
|
|
54
|
-
value: props.value,
|
|
55
|
-
form: props.form,
|
|
56
|
-
errorMessage: props.errorMessage,
|
|
57
|
-
tooltip: props.tooltip,
|
|
58
|
-
size: props.size,
|
|
59
|
-
labelledby: props.labelledby,
|
|
60
|
-
class: props.className,
|
|
61
|
-
exportparts: props.exportparts,
|
|
62
|
-
for: props.htmlFor,
|
|
63
|
-
part: props.part,
|
|
64
|
-
tabindex: props.tabIndex,
|
|
65
|
-
checked: props.checked ? true : undefined,
|
|
66
|
-
disabled: props.disabled ? true : undefined,
|
|
67
|
-
required: props.required ? true : undefined,
|
|
68
|
-
showError: props.showError ? true : undefined,
|
|
69
|
-
groupExist: props.groupExist ? true : undefined,
|
|
70
|
-
tile: props.tile ? true : undefined,
|
|
71
|
-
other: props.other ? true : undefined,
|
|
72
|
-
showOtherError: props.showOtherError ? true : undefined,
|
|
73
|
-
hideLabel: props.hideLabel ? true : undefined,
|
|
74
|
-
style: { ...props.style },
|
|
75
|
-
},
|
|
76
|
-
props.children,
|
|
77
|
-
);
|
|
78
|
-
});
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { NysCheckboxgroup as NysCheckboxgroupElement } from "../../dist/nysds.es.js";
|
|
3
|
-
|
|
4
|
-
export type { NysCheckboxgroupElement };
|
|
5
|
-
|
|
6
|
-
export interface NysCheckboxgroupProps extends Pick<
|
|
7
|
-
React.AllHTMLAttributes<HTMLElement>,
|
|
8
|
-
| "children"
|
|
9
|
-
| "dir"
|
|
10
|
-
| "hidden"
|
|
11
|
-
| "id"
|
|
12
|
-
| "lang"
|
|
13
|
-
| "slot"
|
|
14
|
-
| "style"
|
|
15
|
-
| "title"
|
|
16
|
-
| "translate"
|
|
17
|
-
| "onClick"
|
|
18
|
-
| "onFocus"
|
|
19
|
-
| "onBlur"
|
|
20
|
-
> {
|
|
21
|
-
/** Requires at least one checkbox to be checked. */
|
|
22
|
-
required?: boolean;
|
|
23
|
-
|
|
24
|
-
/** Shows "Optional" flag. */
|
|
25
|
-
optional?: boolean;
|
|
26
|
-
|
|
27
|
-
/** Shows error message when true. */
|
|
28
|
-
showError?: boolean;
|
|
29
|
-
|
|
30
|
-
/** Renders all checkboxes as tiles with larger clickable area. */
|
|
31
|
-
tile?: boolean;
|
|
32
|
-
|
|
33
|
-
/** Unique identifier. Auto-generated if not provided. */
|
|
34
|
-
id?: NysCheckboxgroupElement["id"];
|
|
35
|
-
|
|
36
|
-
/** Name for form submission. Set on group, not individual checkboxes. */
|
|
37
|
-
name?: NysCheckboxgroupElement["name"];
|
|
38
|
-
|
|
39
|
-
/** Error message text. Shown only when `showError` is true. */
|
|
40
|
-
errorMessage?: NysCheckboxgroupElement["errorMessage"];
|
|
41
|
-
|
|
42
|
-
/** Visible label text for the group. */
|
|
43
|
-
label?: NysCheckboxgroupElement["label"];
|
|
44
|
-
|
|
45
|
-
/** Helper text below label. Use slot for custom HTML. */
|
|
46
|
-
description?: NysCheckboxgroupElement["description"];
|
|
47
|
-
|
|
48
|
-
/** Tooltip text shown on hover/focus of info icon. */
|
|
49
|
-
tooltip?: NysCheckboxgroupElement["tooltip"];
|
|
50
|
-
|
|
51
|
-
/** Form `id` to associate with. Applied to all children. */
|
|
52
|
-
form?: NysCheckboxgroupElement["form"];
|
|
53
|
-
|
|
54
|
-
/** Checkbox size for all children: `sm` (24px) or `md` (32px, default). */
|
|
55
|
-
size?: NysCheckboxgroupElement["size"];
|
|
56
|
-
|
|
57
|
-
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
58
|
-
className?: string;
|
|
59
|
-
|
|
60
|
-
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
61
|
-
exportparts?: string;
|
|
62
|
-
|
|
63
|
-
/** Used for labels to link them with their inputs (using input id). */
|
|
64
|
-
htmlFor?: string;
|
|
65
|
-
|
|
66
|
-
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
67
|
-
key?: number | string;
|
|
68
|
-
|
|
69
|
-
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
70
|
-
part?: string;
|
|
71
|
-
|
|
72
|
-
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
73
|
-
ref?: any;
|
|
74
|
-
|
|
75
|
-
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
76
|
-
tabIndex?: number;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Container for grouping checkboxes as a single form control.
|
|
81
|
-
* ---
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* ### **Slots:**
|
|
85
|
-
* - _default_ - Default slot for `nys-checkbox` elements.
|
|
86
|
-
* - **description** - Custom HTML description content.
|
|
87
|
-
*/
|
|
88
|
-
export const NysCheckboxgroup: React.ForwardRefExoticComponent<NysCheckboxgroupProps>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
|
-
import "../../dist/nysds.es.js";
|
|
3
|
-
|
|
4
|
-
export const NysCheckboxgroup = forwardRef((props, forwardedRef) => {
|
|
5
|
-
const {
|
|
6
|
-
required,
|
|
7
|
-
optional,
|
|
8
|
-
showError,
|
|
9
|
-
tile,
|
|
10
|
-
id,
|
|
11
|
-
name,
|
|
12
|
-
errorMessage,
|
|
13
|
-
label,
|
|
14
|
-
description,
|
|
15
|
-
tooltip,
|
|
16
|
-
form,
|
|
17
|
-
size,
|
|
18
|
-
...filteredProps
|
|
19
|
-
} = props;
|
|
20
|
-
|
|
21
|
-
return React.createElement(
|
|
22
|
-
"nys-checkboxgroup",
|
|
23
|
-
{
|
|
24
|
-
...filteredProps,
|
|
25
|
-
id: props.id,
|
|
26
|
-
name: props.name,
|
|
27
|
-
errorMessage: props.errorMessage,
|
|
28
|
-
label: props.label,
|
|
29
|
-
description: props.description,
|
|
30
|
-
tooltip: props.tooltip,
|
|
31
|
-
form: props.form,
|
|
32
|
-
size: props.size,
|
|
33
|
-
class: props.className,
|
|
34
|
-
exportparts: props.exportparts,
|
|
35
|
-
for: props.htmlFor,
|
|
36
|
-
part: props.part,
|
|
37
|
-
tabindex: props.tabIndex,
|
|
38
|
-
required: props.required ? true : undefined,
|
|
39
|
-
optional: props.optional ? true : undefined,
|
|
40
|
-
showError: props.showError ? true : undefined,
|
|
41
|
-
tile: props.tile ? true : undefined,
|
|
42
|
-
style: { ...props.style },
|
|
43
|
-
},
|
|
44
|
-
props.children,
|
|
45
|
-
);
|
|
46
|
-
});
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
NysCombobox as NysComboboxElement,
|
|
4
|
-
CustomEvent,
|
|
5
|
-
Event,
|
|
6
|
-
} from "../../dist/nysds.es.js";
|
|
7
|
-
|
|
8
|
-
export type { NysComboboxElement, CustomEvent, Event };
|
|
9
|
-
|
|
10
|
-
export interface NysComboboxProps extends Pick<
|
|
11
|
-
React.AllHTMLAttributes<HTMLElement>,
|
|
12
|
-
| "children"
|
|
13
|
-
| "dir"
|
|
14
|
-
| "hidden"
|
|
15
|
-
| "id"
|
|
16
|
-
| "lang"
|
|
17
|
-
| "slot"
|
|
18
|
-
| "style"
|
|
19
|
-
| "title"
|
|
20
|
-
| "translate"
|
|
21
|
-
| "onClick"
|
|
22
|
-
| "onFocus"
|
|
23
|
-
| "onBlur"
|
|
24
|
-
> {
|
|
25
|
-
/** undefined */
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
|
|
28
|
-
/** undefined */
|
|
29
|
-
required?: boolean;
|
|
30
|
-
|
|
31
|
-
/** undefined */
|
|
32
|
-
optional?: boolean;
|
|
33
|
-
|
|
34
|
-
/** undefined */
|
|
35
|
-
inverted?: boolean;
|
|
36
|
-
|
|
37
|
-
/** undefined */
|
|
38
|
-
showError?: boolean;
|
|
39
|
-
|
|
40
|
-
/** undefined */
|
|
41
|
-
id?: NysComboboxElement["id"];
|
|
42
|
-
|
|
43
|
-
/** undefined */
|
|
44
|
-
name?: NysComboboxElement["name"];
|
|
45
|
-
|
|
46
|
-
/** undefined */
|
|
47
|
-
label?: NysComboboxElement["label"];
|
|
48
|
-
|
|
49
|
-
/** undefined */
|
|
50
|
-
description?: NysComboboxElement["description"];
|
|
51
|
-
|
|
52
|
-
/** undefined */
|
|
53
|
-
value?: NysComboboxElement["value"];
|
|
54
|
-
|
|
55
|
-
/** undefined */
|
|
56
|
-
tooltip?: NysComboboxElement["tooltip"];
|
|
57
|
-
|
|
58
|
-
/** undefined */
|
|
59
|
-
form?: NysComboboxElement["form"];
|
|
60
|
-
|
|
61
|
-
/** undefined */
|
|
62
|
-
width?: NysComboboxElement["width"];
|
|
63
|
-
|
|
64
|
-
/** undefined */
|
|
65
|
-
errorMessage?: NysComboboxElement["errorMessage"];
|
|
66
|
-
|
|
67
|
-
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
68
|
-
className?: string;
|
|
69
|
-
|
|
70
|
-
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
71
|
-
exportparts?: string;
|
|
72
|
-
|
|
73
|
-
/** Used for labels to link them with their inputs (using input id). */
|
|
74
|
-
htmlFor?: string;
|
|
75
|
-
|
|
76
|
-
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
77
|
-
key?: number | string;
|
|
78
|
-
|
|
79
|
-
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
80
|
-
part?: string;
|
|
81
|
-
|
|
82
|
-
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
83
|
-
ref?: any;
|
|
84
|
-
|
|
85
|
-
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
86
|
-
tabIndex?: number;
|
|
87
|
-
|
|
88
|
-
/** Fired on input change. Detail: `{ id, value }`. */
|
|
89
|
-
onNysInput?: (event: CustomEvent) => void;
|
|
90
|
-
|
|
91
|
-
/** Fired when combobox receives focus. */
|
|
92
|
-
onNysFocus?: (event: CustomEvent) => void;
|
|
93
|
-
|
|
94
|
-
/** Fired when combobox loses focus. */
|
|
95
|
-
onNysBlur?: (event: CustomEvent) => void;
|
|
96
|
-
|
|
97
|
-
/** Fired when selection changes. Detail: `{ id, value }`. */
|
|
98
|
-
onNysChange?: (event: CustomEvent) => void;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* `<nys-combobox>` is a form-enabled combo box combining text input with a filterable dropdown.
|
|
103
|
-
*
|
|
104
|
-
* Features:
|
|
105
|
-
* - Type to filter options
|
|
106
|
-
* - Keyboard navigation (Arrow keys, Enter, Escape)
|
|
107
|
-
* - Mouse and keyboard interaction
|
|
108
|
-
* - Clears non-selected text on blur
|
|
109
|
-
* - Clear button when value is selected
|
|
110
|
-
* - Integrates with forms via ElementInternals
|
|
111
|
-
* - Supports native <option> and <optgroup> elements
|
|
112
|
-
* - Accessible per W3C ARIA Authoring Practices
|
|
113
|
-
* ---
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* ### **Events:**
|
|
117
|
-
* - **nys-input** - Fired on input change. Detail: `{ id, value }`.
|
|
118
|
-
* - **nys-focus** - Fired when combobox receives focus.
|
|
119
|
-
* - **nys-blur** - Fired when combobox loses focus.
|
|
120
|
-
* - **nys-change** - Fired when selection changes. Detail: `{ id, value }`.
|
|
121
|
-
*
|
|
122
|
-
* ### **Slots:**
|
|
123
|
-
* - **description** - Optional custom description content below the label.
|
|
124
|
-
* - **default** - Options (<option>, <optgroup>) to populate the dropdown
|
|
125
|
-
*/
|
|
126
|
-
export const NysCombobox: React.ForwardRefExoticComponent<NysComboboxProps>;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
|
-
import "../../dist/nysds.es.js";
|
|
3
|
-
import { useEventListener } from "./react-utils.js";
|
|
4
|
-
|
|
5
|
-
export const NysCombobox = forwardRef((props, forwardedRef) => {
|
|
6
|
-
const ref = useRef(null);
|
|
7
|
-
const {
|
|
8
|
-
disabled,
|
|
9
|
-
required,
|
|
10
|
-
optional,
|
|
11
|
-
inverted,
|
|
12
|
-
showError,
|
|
13
|
-
id,
|
|
14
|
-
name,
|
|
15
|
-
label,
|
|
16
|
-
description,
|
|
17
|
-
value,
|
|
18
|
-
tooltip,
|
|
19
|
-
form,
|
|
20
|
-
width,
|
|
21
|
-
errorMessage,
|
|
22
|
-
...filteredProps
|
|
23
|
-
} = props;
|
|
24
|
-
|
|
25
|
-
/** Event listeners - run once */
|
|
26
|
-
useEventListener(ref, "nys-input", props.onNysInput);
|
|
27
|
-
useEventListener(ref, "nys-focus", props.onNysFocus);
|
|
28
|
-
useEventListener(ref, "nys-blur", props.onNysBlur);
|
|
29
|
-
useEventListener(ref, "nys-change", props.onNysChange);
|
|
30
|
-
|
|
31
|
-
return React.createElement(
|
|
32
|
-
"nys-combobox",
|
|
33
|
-
{
|
|
34
|
-
ref: (node) => {
|
|
35
|
-
ref.current = node;
|
|
36
|
-
if (typeof forwardedRef === "function") {
|
|
37
|
-
forwardedRef(node);
|
|
38
|
-
} else if (forwardedRef) {
|
|
39
|
-
forwardedRef.current = node;
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
...filteredProps,
|
|
43
|
-
id: props.id,
|
|
44
|
-
name: props.name,
|
|
45
|
-
label: props.label,
|
|
46
|
-
description: props.description,
|
|
47
|
-
value: props.value,
|
|
48
|
-
tooltip: props.tooltip,
|
|
49
|
-
form: props.form,
|
|
50
|
-
width: props.width,
|
|
51
|
-
errorMessage: props.errorMessage,
|
|
52
|
-
class: props.className,
|
|
53
|
-
exportparts: props.exportparts,
|
|
54
|
-
for: props.htmlFor,
|
|
55
|
-
part: props.part,
|
|
56
|
-
tabindex: props.tabIndex,
|
|
57
|
-
disabled: props.disabled ? true : undefined,
|
|
58
|
-
required: props.required ? true : undefined,
|
|
59
|
-
optional: props.optional ? true : undefined,
|
|
60
|
-
inverted: props.inverted ? true : undefined,
|
|
61
|
-
showError: props.showError ? true : undefined,
|
|
62
|
-
style: { ...props.style },
|
|
63
|
-
},
|
|
64
|
-
props.children,
|
|
65
|
-
);
|
|
66
|
-
});
|