@arbor-education/design-system.components 0.1.2 → 0.1.3
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/.changeset/neat-experts-repair.md +2 -0
- package/.changeset/slick-places-grin.md +5 -0
- package/.changeset/sunny-cars-sell.md +2 -0
- package/.changeset/tough-facts-check.md +5 -0
- package/.changeset/true-rats-add.md +5 -0
- package/.github/workflows/chromatic.yml +2 -1
- package/.github/workflows/release.yml +124 -0
- package/CHANGELOG.md +0 -1
- package/bin/createComponent.sh +39 -9
- package/dist/components/dropdown/Dropdown.d.ts +1 -0
- package/dist/components/dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/DropdownContent.d.ts +1 -0
- package/dist/components/dropdown/DropdownContent.d.ts.map +1 -1
- package/dist/components/dropdown/DropdownContent.js +3 -2
- package/dist/components/dropdown/DropdownContent.js.map +1 -1
- package/dist/components/formField/FormField.d.ts +8 -0
- package/dist/components/formField/FormField.d.ts.map +1 -1
- package/dist/components/formField/FormField.js +3 -1
- package/dist/components/formField/FormField.js.map +1 -1
- package/dist/components/formField/FormField.stories.d.ts.map +1 -1
- package/dist/components/formField/FormField.stories.js +5 -0
- package/dist/components/formField/FormField.stories.js.map +1 -1
- package/dist/components/formField/FormField.test.js +11 -1
- package/dist/components/formField/FormField.test.js.map +1 -1
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.d.ts +12 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.d.ts.map +1 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.js +17 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.js.map +1 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.d.ts +10 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.d.ts.map +1 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.js +24 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.js.map +1 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.test.d.ts +2 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.test.d.ts.map +1 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.test.js +88 -0
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.test.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.d.ts +11 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.js +43 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.stories.d.ts +161 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.stories.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.stories.js +172 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.stories.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.test.d.ts +2 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.test.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.test.js +93 -0
- package/dist/components/formField/inputs/dropdown/Dropdown.test.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/buttons/dropdownButton/DropdownButton.d.ts +11 -0
- package/dist/components/formField/inputs/dropdown/buttons/dropdownButton/DropdownButton.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/buttons/dropdownButton/DropdownButton.js +15 -0
- package/dist/components/formField/inputs/dropdown/buttons/dropdownButton/DropdownButton.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/DropdownItemRenderer.d.ts +10 -0
- package/dist/components/formField/inputs/dropdown/items/DropdownItemRenderer.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/DropdownItemRenderer.js +12 -0
- package/dist/components/formField/inputs/dropdown/items/DropdownItemRenderer.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownItem/DropdownItem.d.ts +9 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownItem/DropdownItem.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownItem/DropdownItem.js +17 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownItem/DropdownItem.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownMultiLineItem/DropdownMultiLineItem.d.ts +7 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownMultiLineItem/DropdownMultiLineItem.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownMultiLineItem/DropdownMultiLineItem.js +16 -0
- package/dist/components/formField/inputs/dropdown/items/dropdownMultiLineItem/DropdownMultiLineItem.js.map +1 -0
- package/dist/components/formField/inputs/dropdown/wrapper/DropdownWrapper.d.ts +16 -0
- package/dist/components/formField/inputs/dropdown/wrapper/DropdownWrapper.d.ts.map +1 -0
- package/dist/components/formField/inputs/dropdown/wrapper/DropdownWrapper.js +73 -0
- package/dist/components/formField/inputs/dropdown/wrapper/DropdownWrapper.js.map +1 -0
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.d.ts +10 -6
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.d.ts.map +1 -1
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js +10 -6
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js.map +1 -1
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.test.js +1 -1
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.test.js.map +1 -1
- package/dist/components/heading/HeadingInnerContainer.d.ts +5 -0
- package/dist/components/heading/HeadingInnerContainer.d.ts.map +1 -0
- package/dist/components/heading/HeadingInnerContainer.js +7 -0
- package/dist/components/heading/HeadingInnerContainer.js.map +1 -0
- package/dist/components/icon/Icon.d.ts +0 -1
- package/dist/components/icon/Icon.d.ts.map +1 -1
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/icon/Icon.js.map +1 -1
- package/dist/components/searchBar/SearchBar.d.ts +8 -0
- package/dist/components/searchBar/SearchBar.d.ts.map +1 -0
- package/dist/components/searchBar/SearchBar.js +38 -0
- package/dist/components/searchBar/SearchBar.js.map +1 -0
- package/dist/components/searchBar/SearchBar.test.d.ts +2 -0
- package/dist/components/searchBar/SearchBar.test.d.ts.map +1 -0
- package/dist/components/searchBar/SearchBar.test.js +36 -0
- package/dist/components/searchBar/SearchBar.test.js.map +1 -0
- package/dist/components/slideover/Slideover.d.ts +1 -0
- package/dist/components/slideover/Slideover.d.ts.map +1 -1
- package/dist/components/slideover/Slideover.js +2 -2
- package/dist/components/slideover/Slideover.js.map +1 -1
- package/dist/components/table/HideColumnsDropdown.d.ts +9 -0
- package/dist/components/table/HideColumnsDropdown.d.ts.map +1 -0
- package/dist/components/table/HideColumnsDropdown.js +33 -0
- package/dist/components/table/HideColumnsDropdown.js.map +1 -0
- package/dist/components/table/Table.d.ts +14 -0
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/Table.js +8 -3
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.stories.d.ts +3 -0
- package/dist/components/table/Table.stories.d.ts.map +1 -1
- package/dist/components/table/Table.stories.js +53 -1
- package/dist/components/table/Table.stories.js.map +1 -1
- package/dist/components/table/Table.test.js +132 -0
- package/dist/components/table/Table.test.js.map +1 -1
- package/dist/components/table/TableHeader.d.ts +3 -0
- package/dist/components/table/TableHeader.d.ts.map +1 -1
- package/dist/components/table/TableHeader.js +4 -3
- package/dist/components/table/TableHeader.js.map +1 -1
- package/dist/index.css +93 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css +229 -0
- package/package.json +2 -1
- package/src/components/dropdown/DropdownContent.tsx +4 -2
- package/src/components/formField/FormField.stories.tsx +17 -0
- package/src/components/formField/FormField.test.tsx +13 -1
- package/src/components/formField/FormField.tsx +10 -0
- package/src/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.tsx +29 -0
- package/src/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.test.tsx +121 -0
- package/src/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.tsx +53 -0
- package/src/components/formField/inputs/colourPickerDropdown/colourPickerDropdown.scss +12 -0
- package/src/components/formField/inputs/selectDropdown/SelectDropdown.test.tsx +1 -1
- package/src/components/formField/inputs/selectDropdown/SelectDropdown.tsx +55 -41
- package/src/components/heading/heading.scss +1 -0
- package/src/components/icon/Icon.tsx +1 -2
- package/src/components/searchBar/SearchBar.test.tsx +40 -0
- package/src/components/searchBar/SearchBar.tsx +97 -0
- package/src/components/searchBar/searchBar.scss +69 -0
- package/src/components/slideover/Slideover.tsx +10 -5
- package/src/components/table/HideColumnsDropdown.tsx +57 -0
- package/src/components/table/Table.stories.tsx +96 -2
- package/src/components/table/Table.test.tsx +240 -0
- package/src/components/table/Table.tsx +10 -1
- package/src/components/table/TableHeader.tsx +8 -0
- package/src/components/table/table.scss +22 -0
- package/src/index.scss +24 -22
- package/src/index.ts +1 -0
- package/.github/workflows/changeset-version.yml +0 -39
- package/.github/workflows/merge-version-packages-pr.yml +0 -31
- package/.github/workflows/production-build.yml +0 -130
- package/release/design-system.components.tgz +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# IMPORTANT: Keep this workflow filename unchanged for npm OIDC trusted publishing to work
|
|
2
|
+
|
|
3
|
+
name: Design System Components Release
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write # Required to push tags and create releases
|
|
7
|
+
pull-requests: read # Required for changelog generation
|
|
8
|
+
id-token: write # Required for OIDC authentication
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
schedule:
|
|
12
|
+
- cron: '0 7 * * 1-5' # 7 AM UTC, Monday-Friday
|
|
13
|
+
workflow_dispatch: # Allow manual trigger
|
|
14
|
+
|
|
15
|
+
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
release:
|
|
19
|
+
name: Release
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout Repo
|
|
23
|
+
uses: actions/checkout@v6
|
|
24
|
+
with:
|
|
25
|
+
persist-credentials: false
|
|
26
|
+
|
|
27
|
+
- name: Setup Node.js
|
|
28
|
+
uses: actions/setup-node@v4
|
|
29
|
+
with:
|
|
30
|
+
node-version-file: ".nvmrc"
|
|
31
|
+
registry-url: 'https://registry.npmjs.org'
|
|
32
|
+
cache: "yarn"
|
|
33
|
+
|
|
34
|
+
- name: Install yarn
|
|
35
|
+
run: npm install yarn -g
|
|
36
|
+
- name: Install dependencies
|
|
37
|
+
run: yarn install --prefer-offline --frozen-lockfile
|
|
38
|
+
|
|
39
|
+
- name: Upgrade npm for Trusted Publishing (OIDC)
|
|
40
|
+
run: npm install -g npm@latest
|
|
41
|
+
|
|
42
|
+
- name: Set up default git user
|
|
43
|
+
uses: fregante/setup-git-user@v1
|
|
44
|
+
|
|
45
|
+
- name: Version packages
|
|
46
|
+
id: version
|
|
47
|
+
env:
|
|
48
|
+
GITHUB_TOKEN: ${{ secrets.ARBOR_AUTOMATION_ORG_GHA_TOKEN }}
|
|
49
|
+
run: |
|
|
50
|
+
npx changeset version
|
|
51
|
+
if git diff --quiet package.json; then
|
|
52
|
+
echo "No version bump in package.json"
|
|
53
|
+
echo "changed=false" >> $GITHUB_OUTPUT
|
|
54
|
+
else
|
|
55
|
+
echo "Version bump detected, committing..."
|
|
56
|
+
echo "changed=true" >> $GITHUB_OUTPUT
|
|
57
|
+
git add .
|
|
58
|
+
git commit -m "chore: version packages"
|
|
59
|
+
git remote set-url origin https://x-access-token:${{ env.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
|
60
|
+
git push
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
- name: Publish to npm
|
|
64
|
+
if: steps.version.outputs.changed == 'true'
|
|
65
|
+
run: npm publish
|
|
66
|
+
|
|
67
|
+
- name: Get changelog for current release
|
|
68
|
+
if: steps.version.outputs.changed == 'true'
|
|
69
|
+
id: get-changelog
|
|
70
|
+
run: |
|
|
71
|
+
changelog=$(python "${GITHUB_WORKSPACE}/.github/workflows/scripts/python/changelog_utils.py")
|
|
72
|
+
echo "changelog<<EOF" >> $GITHUB_ENV
|
|
73
|
+
echo "$changelog" >> $GITHUB_ENV
|
|
74
|
+
echo "EOF" >> $GITHUB_ENV
|
|
75
|
+
|
|
76
|
+
- name: Get version
|
|
77
|
+
if: steps.version.outputs.changed == 'true'
|
|
78
|
+
id: get-version
|
|
79
|
+
run: |
|
|
80
|
+
version=$(node -p "require('./package.json').version")
|
|
81
|
+
echo "version=${version}" >> $GITHUB_OUTPUT
|
|
82
|
+
|
|
83
|
+
- name: Create tarball
|
|
84
|
+
if: steps.version.outputs.changed == 'true'
|
|
85
|
+
run: |
|
|
86
|
+
mkdir -p release
|
|
87
|
+
npm pack
|
|
88
|
+
mv *.tgz release/design-system.components.tgz
|
|
89
|
+
|
|
90
|
+
- name: Create GitHub Release
|
|
91
|
+
if: steps.version.outputs.changed == 'true'
|
|
92
|
+
env:
|
|
93
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
94
|
+
run: |
|
|
95
|
+
version="${{ steps.get-version.outputs.version }}"
|
|
96
|
+
git tag -a "${version}" -m "Release ${version}"
|
|
97
|
+
git push origin "${version}"
|
|
98
|
+
|
|
99
|
+
gh release create "${version}" \
|
|
100
|
+
--repo "arbor-education/design-system.components" \
|
|
101
|
+
--title "${version}" \
|
|
102
|
+
--notes "${{ env.changelog }}" \
|
|
103
|
+
"./release/design-system.components.tgz"
|
|
104
|
+
|
|
105
|
+
- name: Send Slack Success Message
|
|
106
|
+
if: steps.version.outputs.changed == 'true'
|
|
107
|
+
uses: rtCamp/action-slack-notify@v2
|
|
108
|
+
env:
|
|
109
|
+
SLACK_COLOR: good
|
|
110
|
+
SLACK_MESSAGE: "https://github.com/arbor-education/design-system.components/blob/main/CHANGELOG.md\n\nChangelog summary:\n\n${{ env.changelog }}"
|
|
111
|
+
SLACK_TITLE: "We have a new version of Design System Components: ${{ steps.get-version.outputs.version }}"
|
|
112
|
+
MSG_MINIMAL: true
|
|
113
|
+
SLACK_WEBHOOK: ${{ secrets.ARBOR_FRONTEND_RELEASE_SLACK_WEBHOOK }}
|
|
114
|
+
|
|
115
|
+
- name: Send Slack Failure Message
|
|
116
|
+
if: ${{ failure() }}
|
|
117
|
+
uses: rtCamp/action-slack-notify@v2
|
|
118
|
+
env:
|
|
119
|
+
SLACK_COLOR: bad
|
|
120
|
+
SLACK_MESSAGE: "Investigate why this failed @frontend-firefighter https://github.com/arbor-education/design-system.components/actions/runs/${{ github.run_id }}"
|
|
121
|
+
SLACK_TITLE: ":x: Error creating design system components release :sob:"
|
|
122
|
+
SLACK_LINK_NAMES: true
|
|
123
|
+
MSG_MINIMAL: true
|
|
124
|
+
SLACK_WEBHOOK: ${{ secrets.ARBOR_FRONTEND_RELEASE_SLACK_WEBHOOK }}
|
package/CHANGELOG.md
CHANGED
package/bin/createComponent.sh
CHANGED
|
@@ -26,8 +26,14 @@ uncapitalize() {
|
|
|
26
26
|
echo "$1" | awk '{print tolower(substr($0,1,1)) substr($0,2)}'
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
# Convert to kebab-case
|
|
30
|
+
kebabcase() {
|
|
31
|
+
echo "$1" | sed 's/\([A-Z]\)/-\1/g' | sed 's/^-//' | tr '[:upper:]' '[:lower:]'
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
CAPITALIZED_NAME=$(capitalize "$COMPONENT_NAME") # → "Button"
|
|
30
35
|
LOWERCASED_NAME=$(uncapitalize "$COMPONENT_NAME") # → "button"
|
|
36
|
+
KEBAB_CASED_NAME=$(kebabcase "$COMPONENT_NAME") # → "button" or "multi-word"
|
|
31
37
|
|
|
32
38
|
COMPONENT_DIR="$SCRIPT_DIR/../src/components/$LOWERCASED_NAME"
|
|
33
39
|
INDEX_FILE_PATH="$SCRIPT_DIR/../src/index.ts"
|
|
@@ -39,14 +45,33 @@ mkdir -p "$COMPONENT_DIR"
|
|
|
39
45
|
|
|
40
46
|
# Create component file
|
|
41
47
|
cat <<EOF > "$COMPONENT_DIR/$CAPITALIZED_NAME.tsx"
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
import classNames from 'classnames';
|
|
49
|
+
|
|
50
|
+
type ${CAPITALIZED_NAME}Props = {
|
|
51
|
+
className?: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const ${CAPITALIZED_NAME} = (props: ${CAPITALIZED_NAME}Props) => {
|
|
55
|
+
const {
|
|
56
|
+
className,
|
|
57
|
+
} = props;
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
className={classNames(
|
|
62
|
+
'ds-${KEBAB_CASED_NAME}',
|
|
63
|
+
className,
|
|
64
|
+
)}
|
|
65
|
+
>
|
|
66
|
+
Hello I'm a ${CAPITALIZED_NAME}!
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
44
69
|
};
|
|
45
70
|
EOF
|
|
46
71
|
|
|
47
72
|
# Create test file
|
|
48
73
|
cat <<EOF > "$COMPONENT_DIR/$CAPITALIZED_NAME.test.tsx"
|
|
49
|
-
import { expect, test } from
|
|
74
|
+
import { expect, test } from 'vitest';
|
|
50
75
|
import { render, screen } from '@testing-library/react';
|
|
51
76
|
import { ${CAPITALIZED_NAME} } from './${CAPITALIZED_NAME}';
|
|
52
77
|
import '@testing-library/jest-dom/vitest';
|
|
@@ -78,19 +103,24 @@ EOF
|
|
|
78
103
|
|
|
79
104
|
# Create SCSS file
|
|
80
105
|
cat <<EOF > "$COMPONENT_DIR/$LOWERCASED_NAME.scss"
|
|
81
|
-
|
|
106
|
+
.ds-${KEBAB_CASED_NAME} {
|
|
82
107
|
/* styles go here */
|
|
83
108
|
}
|
|
84
109
|
EOF
|
|
85
110
|
|
|
86
111
|
# Append component export line to index.ts
|
|
87
112
|
INDEX_FILE_PATH="${SCRIPT_DIR}/../src/index.ts"
|
|
88
|
-
EXPORT_LINE="export { ${CAPITALIZED_NAME} } from
|
|
113
|
+
EXPORT_LINE="export { ${CAPITALIZED_NAME} } from 'Components/${LOWERCASED_NAME}/${CAPITALIZED_NAME}';"
|
|
89
114
|
|
|
90
115
|
echo "$EXPORT_LINE" >> "$INDEX_FILE_PATH"
|
|
91
116
|
|
|
92
|
-
#
|
|
117
|
+
# Insert SCSS import line before the last line in index.scss
|
|
93
118
|
STYLES_INDEX_PATH="${SCRIPT_DIR}/../src/index.scss"
|
|
94
|
-
SCSS_IMPORT_LINE="@use \"
|
|
95
|
-
|
|
96
|
-
|
|
119
|
+
SCSS_IMPORT_LINE="@use \"components/${LOWERCASED_NAME}/${LOWERCASED_NAME}.scss\";"
|
|
120
|
+
|
|
121
|
+
# Read all lines except the last, append new import, then append the last line
|
|
122
|
+
TOTAL_LINES=$(wc -l < "$STYLES_INDEX_PATH" | tr -d ' ')
|
|
123
|
+
head -n $((TOTAL_LINES - 1)) "$STYLES_INDEX_PATH" > "$STYLES_INDEX_PATH.tmp"
|
|
124
|
+
echo "$SCSS_IMPORT_LINE" >> "$STYLES_INDEX_PATH.tmp"
|
|
125
|
+
tail -n 1 "$STYLES_INDEX_PATH" >> "$STYLES_INDEX_PATH.tmp"
|
|
126
|
+
mv "$STYLES_INDEX_PATH.tmp" "$STYLES_INDEX_PATH"
|
|
@@ -8,6 +8,7 @@ export declare const Dropdown: {
|
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
portalProps?: DropdownMenu.DropdownMenuPortalProps;
|
|
10
10
|
contentProps?: DropdownMenu.DropdownMenuContentProps;
|
|
11
|
+
className?: string;
|
|
11
12
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
Item: (props: DropdownMenu.DropdownMenuItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
SelectItem: (props: import("./items/DropdownSelectItem").DropdowSelectItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAMxC,eAAO,MAAM,QAAQ;YAAW,YAAY,CAAC,iBAAiB
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAMxC,eAAO,MAAM,QAAQ;YAAW,YAAY,CAAC,iBAAiB;;;;;;;;;;;;CAO7D,CAAC"}
|
|
@@ -3,6 +3,7 @@ type DropdownContentProps = {
|
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
portalProps?: DropdownMenu.DropdownMenuPortalProps;
|
|
5
5
|
contentProps?: DropdownMenu.DropdownMenuContentProps;
|
|
6
|
+
className?: string;
|
|
6
7
|
};
|
|
7
8
|
export declare const DropdownContent: (props: DropdownContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownContent.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/DropdownContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DropdownContent.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/DropdownContent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIxC,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,YAAY,CAAC,uBAAuB,CAAC;IACnD,YAAY,CAAC,EAAE,YAAY,CAAC,wBAAwB,CAAC;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,oBAAoB,4CAW1D,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
2
3
|
import { DropdownMenu } from 'radix-ui';
|
|
3
4
|
import { useContext } from 'react';
|
|
4
5
|
import { PopupParentContext } from '../../utils/PopupParentContext';
|
|
5
6
|
export const DropdownContent = (props) => {
|
|
6
|
-
const { children, portalProps, contentProps } = props;
|
|
7
|
+
const { children, portalProps, contentProps, className = '' } = props;
|
|
7
8
|
const popupParentRef = useContext(PopupParentContext);
|
|
8
|
-
return (_jsx(DropdownMenu.Portal, { ...portalProps, container: popupParentRef.current, children: _jsx(DropdownMenu.Content, { align: "start", ...contentProps, className:
|
|
9
|
+
return (_jsx(DropdownMenu.Portal, { ...portalProps, container: popupParentRef.current, children: _jsx(DropdownMenu.Content, { align: "start", ...contentProps, className: classNames('ds-dropdown__content', className), children: children }) }));
|
|
9
10
|
};
|
|
10
11
|
//# sourceMappingURL=DropdownContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownContent.js","sourceRoot":"","sources":["../../../src/components/dropdown/DropdownContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownContent.js","sourceRoot":"","sources":["../../../src/components/dropdown/DropdownContent.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAS9D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC7D,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IACtE,MAAM,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEtD,OAAO,CACL,KAAC,YAAY,CAAC,MAAM,OAAK,WAAW,EAAE,SAAS,EAAE,cAAc,CAAC,OAAO,YACrE,KAAC,YAAY,CAAC,OAAO,IAAC,KAAK,EAAC,OAAO,KAAK,YAAY,EAAE,SAAS,EAAE,UAAU,CAAC,sBAAsB,EAAE,SAAS,CAAC,YAC3G,QAAQ,GACY,GACH,CACvB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type TextInputProps } from './inputs/text/TextInput';
|
|
2
2
|
import { type TextAreaProps } from './inputs/textArea/TextArea';
|
|
3
3
|
import { type NumberInputProps } from './inputs/number/NumberInput';
|
|
4
|
+
import { type ColourPickerDropdownProps } from './inputs/colourPickerDropdown/ColourPickerDropdown';
|
|
5
|
+
import { type SelectDropdownInputProps } from './inputs/selectDropdown/SelectDropdown';
|
|
4
6
|
type FormFieldProps = {
|
|
5
7
|
className?: string;
|
|
6
8
|
label?: string;
|
|
@@ -18,6 +20,12 @@ type FormFieldProps = {
|
|
|
18
20
|
} | {
|
|
19
21
|
inputType?: 'number';
|
|
20
22
|
inputProps?: NumberInputProps;
|
|
23
|
+
} | {
|
|
24
|
+
inputType?: 'colourPicker';
|
|
25
|
+
inputProps?: ColourPickerDropdownProps;
|
|
26
|
+
} | {
|
|
27
|
+
inputType?: 'selectDropdown';
|
|
28
|
+
inputProps?: SelectDropdownInputProps;
|
|
21
29
|
});
|
|
22
30
|
export declare const FormField: (props: FormFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/components/formField/FormField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/components/formField/FormField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAwB,KAAK,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC1H,OAAO,EAAkB,KAAK,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAEvG,KAAK,cAAc,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,CACA;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,cAAc,CAAA;CAAE,GACnD;IAAE,SAAS,CAAC,EAAE,UAAU,CAAC;IAAC,UAAU,CAAC,EAAE,aAAa,CAAA;CAAE,GACtD;IAAE,SAAS,CAAC,EAAE,QAAQ,CAAC;IAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAAE,GACvD;IAAE,SAAS,CAAC,EAAE,cAAc,CAAC;IAAC,UAAU,CAAC,EAAE,yBAAyB,CAAA;CAAE,GACtE;IAAE,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAAC,UAAU,CAAC,EAAE,wBAAwB,CAAA;CAAE,CAC1E,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,4CA8D9C,CAAC"}
|
|
@@ -5,6 +5,8 @@ import { Icon } from '../icon/Icon';
|
|
|
5
5
|
import { TextInput } from './inputs/text/TextInput';
|
|
6
6
|
import { TextArea } from './inputs/textArea/TextArea';
|
|
7
7
|
import { NumberInput } from './inputs/number/NumberInput';
|
|
8
|
+
import { ColourPickerDropdown } from './inputs/colourPickerDropdown/ColourPickerDropdown';
|
|
9
|
+
import { SelectDropdown } from './inputs/selectDropdown/SelectDropdown';
|
|
8
10
|
export const FormField = (props) => {
|
|
9
11
|
const { className, label, id, inputType = 'text', helperLinkText, helperLinkUrl, errorText, inputProps, fieldDescription } = props;
|
|
10
12
|
const classes = classNames('ds-form-field', className);
|
|
@@ -21,6 +23,6 @@ export const FormField = (props) => {
|
|
|
21
23
|
'hasError': !!errorText,
|
|
22
24
|
'aria-invalid': !!errorText,
|
|
23
25
|
};
|
|
24
|
-
return (_jsxs("div", { className: classes, children: [label && (_jsx(Label, { htmlFor: id, children: label })), fieldDescription && (_jsx("span", { id: `${id}-description`, className: "ds-form-field__description", children: fieldDescription })), inputType === 'text' && (_jsx(TextInput, { ...sharedProps, ...inputProps })), inputType === 'textarea' && (_jsx(TextArea, { ...sharedProps, ...inputProps })), inputType === 'number' && (_jsx(NumberInput, { ...sharedProps, ...inputProps })), ((helperLinkText && helperLinkUrl) || errorText) && (_jsxs("div", { className: "ds-form-field__message", children: [errorText && (_jsxs("span", { className: "ds-form-field__message--error", id: `${id}-error`, children: [_jsx(Icon, { size: 12, name: "triangle-alert" }), errorText] })), helperLinkText && helperLinkUrl && (_jsxs("a", { href: helperLinkUrl, "aria-label": `${label} helper link`, className: "ds-form-field__message--helper", children: [helperLinkText, ' ', _jsx(Icon, { size: 12, name: "arrow-up-right" })] }))] }))] }));
|
|
26
|
+
return (_jsxs("div", { className: classes, children: [label && (_jsx(Label, { htmlFor: id, children: label })), fieldDescription && (_jsx("span", { id: `${id}-description`, className: "ds-form-field__description", children: fieldDescription })), inputType === 'text' && (_jsx(TextInput, { ...sharedProps, ...inputProps })), inputType === 'textarea' && (_jsx(TextArea, { ...sharedProps, ...inputProps })), inputType === 'number' && (_jsx(NumberInput, { ...sharedProps, ...inputProps })), inputType === 'colourPicker' && (_jsx(ColourPickerDropdown, { ...sharedProps, ...inputProps })), inputType === 'selectDropdown' && (_jsx(SelectDropdown, { ...sharedProps, ...inputProps })), ((helperLinkText && helperLinkUrl) || errorText) && (_jsxs("div", { className: "ds-form-field__message", children: [errorText && (_jsxs("span", { className: "ds-form-field__message--error", id: `${id}-error`, children: [_jsx(Icon, { size: 12, name: "triangle-alert" }), errorText] })), helperLinkText && helperLinkUrl && (_jsxs("a", { href: helperLinkUrl, "aria-label": `${label} helper link`, className: "ds-form-field__message--helper", children: [helperLinkText, ' ', _jsx(Icon, { size: 12, name: "arrow-up-right" })] }))] }))] }));
|
|
25
27
|
};
|
|
26
28
|
//# sourceMappingURL=FormField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/formField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAuB,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAsB,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAyB,MAAM,6BAA6B,CAAC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ts","sourceRoot":"","sources":["../../../src/components/formField/FormField.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAGhC,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDnB,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAGnC,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"FormField.stories.d.ts","sourceRoot":"","sources":["../../../src/components/formField/FormField.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAGhC,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDnB,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAGnC,eAAO,MAAM,WAAW,EAAE,KAqEzB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -71,6 +71,11 @@ export const FormExample = {
|
|
|
71
71
|
placeholder: 'Enter a lovely message',
|
|
72
72
|
} }), _jsx(FormField, { id: "age", label: "Age", inputType: "number", inputProps: {
|
|
73
73
|
placeholder: 'Enter your age',
|
|
74
|
+
} }), _jsx(FormField, { id: "colour-dropdown", label: "Colour", inputType: "colourPicker", inputProps: {
|
|
75
|
+
onChange: fn(),
|
|
76
|
+
} }), _jsx(FormField, { id: "select-dropdown", label: "Select", inputType: "selectDropdown", inputProps: {
|
|
77
|
+
options: [{ label: 'Option 1', value: 'option1' }, { label: 'Option 2', value: 'option2' }, { label: 'Option 3', value: 'option3' }],
|
|
78
|
+
onSelectionChange: fn(),
|
|
74
79
|
} })] })),
|
|
75
80
|
};
|
|
76
81
|
export default meta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.stories.js","sourceRoot":"","sources":["../../../src/components/formField/FormField.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,IAAI,GAA2B;IACnC,KAAK,EAAE,sBAAsB;IAC7B,SAAS,EAAE,SAAS;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,UAAU,EAAE;YACV,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,EAAE,EAAE;SACf;QACD,cAAc,EAAE,kBAAkB;QAClC,aAAa,EAAE,wBAAwB;QACvC,SAAS,EAAE,yBAAyB;QACpC,gBAAgB,EAAE,6CAA6C;QAC/D,SAAS,EAAE,MAAM;KAClB;IACD,QAAQ,EAAE;QACR,gBAAgB,EAAE;YAChB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,kBAAkB;SAChC;QACD,eAAe,EAAE;YACf,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,iBAAiB;SAC/B;QACD,WAAW,EAAE;YACX,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,YAAY;SAC1B;QACD,kBAAkB,EAAE;YAClB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,mBAAmB;SACjC;QACD,WAAW,EAAE;YACX,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CA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GACD,EACF,KAAC,SAAS,IACR,EAAE,EAAC,KAAK,EACR,KAAK,EAAC,KAAK,EACX,SAAS,EAAC,QAAQ,EAClB,UAAU,EAAE;oBACV,WAAW,EAAE,gBAAgB;iBAC9B,GACD,IACE,CACP;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"FormField.stories.js","sourceRoot":"","sources":["../../../src/components/formField/FormField.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,IAAI,GAA2B;IACnC,KAAK,EAAE,sBAAsB;IAC7B,SAAS,EAAE,SAAS;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,UAAU,EAAE;YACV,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,EAAE,EAAE;SACf;QACD,cAAc,EAAE,kBAAkB;QAClC,aAAa,EAAE,wBAAwB;QACvC,SAAS,EAAE,yBAAyB;QACpC,gBAAgB,EAAE,6CAA6C;QAC/D,SAAS,EAAE,MAAM;KAClB;IACD,QAAQ,EAAE;QACR,gBAAgB,EAAE;YAChB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,kBAAkB;SAChC;QACD,eAAe,EAAE;YACf,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,iBAAiB;SAC/B;QACD,WAAW,EAAE;YACX,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,YAAY;SAC1B;QACD,kBAAkB,EAAE;YAClB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,mBAAmB;SACjC;QACD,WAAW,EAAE;YACX,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC;YACvC,WAAW,EAAE,YAAY;S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AE,EAAC,KAAK,EACR,KAAK,EAAC,KAAK,EACX,SAAS,EAAC,QAAQ,EAClB,UAAU,EAAE;oBACV,WAAW,EAAE,gBAAgB;iBAC9B,GACD,EACF,KAAC,SAAS,IACR,EAAE,EAAC,iBAAiB,EACpB,KAAK,EAAC,QAAQ,EACd,SAAS,EAAC,cAAc,EACxB,UAAU,EAAE;oBACV,QAAQ,EAAE,EAAE,EAAE;iBACf,GACD,EACF,KAAC,SAAS,IACR,EAAE,EAAC,iBAAiB,EACpB,KAAK,EAAC,QAAQ,EACd,SAAS,EAAC,gBAAgB,EAC1B,UAAU,EAAE;oBACV,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;oBACpI,iBAAiB,EAAE,EAAE,EAAE;iBACxB,GACD,IACE,CACP;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { expect, test, describe } from 'vitest';
|
|
|
3
3
|
import { FormField } from './FormField';
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
5
|
import '@testing-library/jest-dom/vitest';
|
|
6
|
-
describe('
|
|
6
|
+
describe('FormField component', () => {
|
|
7
7
|
test('renders a form field', () => {
|
|
8
8
|
render(_jsx(FormField, { inputType: "text", label: "Email", id: "niceid" }));
|
|
9
9
|
expect(screen.getByLabelText('Email')).toBeInTheDocument();
|
|
@@ -38,5 +38,15 @@ describe('Input component', () => {
|
|
|
38
38
|
const input = screen.getByPlaceholderText('Enter a number');
|
|
39
39
|
expect(input).toHaveClass('ds-number-input');
|
|
40
40
|
});
|
|
41
|
+
test('renders a colour picker dropdown when inputType is colourPicker', () => {
|
|
42
|
+
render(_jsx(FormField, { id: "niceid", inputType: "colourPicker" }));
|
|
43
|
+
const input = screen.getByRole('button');
|
|
44
|
+
expect(input.textContent).toContain('Toggle colour picker.');
|
|
45
|
+
});
|
|
46
|
+
test('renders a select dropdown when inputType is selectDropdown', () => {
|
|
47
|
+
render(_jsx(FormField, { id: "niceid", inputType: "selectDropdown", inputProps: { options: [{ label: 'Option 1', value: 'option1' }] } }));
|
|
48
|
+
const input = screen.getByRole('button');
|
|
49
|
+
expect(input.textContent).toContain('Select');
|
|
50
|
+
});
|
|
41
51
|
});
|
|
42
52
|
//# sourceMappingURL=FormField.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.test.js","sourceRoot":"","sources":["../../../src/components/formField/FormField.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,kCAAkC,CAAC;AAE1C,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"FormField.test.js","sourceRoot":"","sources":["../../../src/components/formField/FormField.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,kCAAkC,CAAC;AAE1C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,KAAC,SAAS,IAAC,SAAS,EAAC,MAAM,EAAC,KAAK,EAAC,OAAO,EAAC,EAAE,EAAC,QAAQ,GAAG,CAAC,CAAC;QACjE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,O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,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACtE,MAAM,CAAC,KAAC,SAAS,IAAC,EAAE,EAAC,QAAQ,EAAC,SAAS,EAAC,gBAAgB,EAAC,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,GAAI,CAAC,CAAC;QACjI,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ColorResult } from '@uiw/color-convert';
|
|
2
|
+
export type ColourPickerDropdownProps = {
|
|
3
|
+
'value'?: string;
|
|
4
|
+
'onChange'?: (value: ColorResult) => void;
|
|
5
|
+
'hasError'?: boolean;
|
|
6
|
+
'disabled'?: boolean;
|
|
7
|
+
'id'?: string;
|
|
8
|
+
'aria-describedBy'?: string;
|
|
9
|
+
'aria-invalid'?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const ColourPickerDropdown: ({ value, onChange, hasError, disabled, id, "aria-describedBy": ariaDescribedBy, "aria-invalid": ariaInvalid }: ColourPickerDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=ColourPickerDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColourPickerDropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,+GAA2H,yBAAyB,4CAoCxL,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Dropdown } from '../../../dropdown/Dropdown';
|
|
3
|
+
import { Button } from '../../../button/Button';
|
|
4
|
+
import { Sketch } from '@uiw/react-color';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
export const ColourPickerDropdown = ({ value = '#3cad51', onChange, hasError, disabled, id, 'aria-describedBy': ariaDescribedBy, 'aria-invalid': ariaInvalid }) => {
|
|
7
|
+
const [selectedColour, setSelectedColour] = useState(value);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setSelectedColour(value);
|
|
10
|
+
}, [value]);
|
|
11
|
+
const handleOnChange = (value) => {
|
|
12
|
+
setSelectedColour(value.hex);
|
|
13
|
+
onChange?.(value);
|
|
14
|
+
};
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx("input", { type: "hidden", name: id, value: selectedColour }), _jsxs(Dropdown, { children: [_jsx(Dropdown.Trigger, { disabled: disabled, className: "ds-colour-picker-dropdown__trigger", children: _jsxs(Button, { variant: "dropdown", iconRightName: "chevron-down", error: hasError, id: id, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, children: [_jsx("span", { className: "sr-only", children: "Toggle colour picker." }), _jsx("div", { style: { backgroundColor: selectedColour }, className: "ds-colour-picker-dropdown__preview", children: _jsxs("span", { className: "sr-only", children: ["current colour:", ' ', selectedColour] }) })] }) }), _jsx(Dropdown.Content, { className: "ds-colour-picker-dropdown__content", children: _jsx(Sketch, { style: { boxShadow: 'none', border: 0 }, disableAlpha: true, color: selectedColour, onChange: handleOnChange }) })] })] }));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=ColourPickerDropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColourPickerDropdown.js","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAY5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAE,KAAK,GAAG,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,kBAAkB,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAA6B,EAAE,EAAE;IAC3L,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5D,SAAS,CAAC,GAAG,EAAE;QACb,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,cAAc,GAAG,CAAC,KAAkB,EAAE,EAAE;QAC5C,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,CACL,8BACE,gBAAO,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,cAAc,GAAI,EACxD,MAAC,QAAQ,eACP,KAAC,QAAQ,CAAC,OAAO,IAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,oCAAoC,YAClF,MAAC,MAAM,IAAC,OAAO,EAAC,UAAU,EAAC,aAAa,EAAC,cAAc,EAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,sBAAoB,eAAe,kBAAgB,WAAW,aAC3I,eAAM,SAAS,EAAC,SAAS,sCAElB,EACP,cAAK,KAAK,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,SAAS,EAAC,oCAAoC,YAC7F,gBAAM,SAAS,EAAC,SAAS,gCAEtB,GAAG,EACH,cAAc,IACV,GACH,IACC,GACQ,EACnB,KAAC,QAAQ,CAAC,OAAO,IAAC,SAAS,EAAC,oCAAoC,YAC9D,KAAC,MAAM,IAAC,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,YAAY,QAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,GAAI,GAChG,IACV,IACV,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ value, onChange, hasError, disabled, id, "aria-describedBy": ariaDescribedBy, "aria-invalid": ariaInvalid }: import("./ColourPickerDropdown").ColourPickerDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<typeof meta>;
|
|
9
|
+
export declare const Default: Story;
|
|
10
|
+
//# sourceMappingURL=ColourPickerDropdown.stories.d.ts.map
|
package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColourPickerDropdown.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,QAAA,MAAM,IAAI;;;;CAImC,CAAC;AAE9C,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAerB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ColourPickerDropdown } from './ColourPickerDropdown';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Components/FormField/Inputs/ColourPickerDropdown',
|
|
4
|
+
component: ColourPickerDropdown,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
export const Default = {
|
|
9
|
+
args: {
|
|
10
|
+
value: '#3cad51',
|
|
11
|
+
onChange: (value) => { console.log(value); },
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
value: {
|
|
15
|
+
control: 'color',
|
|
16
|
+
description: 'The colour to display in the preview',
|
|
17
|
+
},
|
|
18
|
+
onChange: {
|
|
19
|
+
action: 'changed',
|
|
20
|
+
description: 'The function to call when the colour is changed',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=ColourPickerDropdown.stories.js.map
|
package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColourPickerDropdown.stories.js","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,kDAAkD;IACzD,SAAS,EAAE,oBAAoB;IAC/B,IAAI,EAAE,CAAC,UAAU,CAAC;CACyB,CAAC;AAE9C,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,CAAC,KAAkB,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC1D;IACD,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,sCAAsC;SACpD;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,SAAS;YACjB,WAAW,EAAE,iDAAiD;SAC/D;KACF;CACF,CAAC"}
|
package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColourPickerDropdown.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|