@sproutsocial/seeds-react-visually-hidden 1.0.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/.eslintignore ADDED
@@ -0,0 +1,6 @@
1
+ # Node modules
2
+ node_modules/
3
+
4
+ # Build output
5
+ dist/
6
+ coverage/
package/.eslintrc.js ADDED
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ["eslint-config-seeds/racine"],
4
+ };
@@ -0,0 +1,21 @@
1
+ yarn run v1.22.22
2
+ $ tsup --dts
3
+ CLI Building entry: src/index.ts
4
+ CLI Using tsconfig: tsconfig.json
5
+ CLI tsup v8.0.2
6
+ CLI Using tsup config: /home/runner/work/seeds/seeds/seeds-react/seeds-react-visually-hidden/tsup.config.ts
7
+ CLI Target: es2022
8
+ CLI Cleaning output folder
9
+ CJS Build start
10
+ ESM Build start
11
+ CJS dist/index.js 2.14 KB
12
+ CJS dist/index.js.map 877.00 B
13
+ CJS ⚡️ Build success in 68ms
14
+ ESM dist/esm/index.js 418.00 B
15
+ ESM dist/esm/index.js.map 757.00 B
16
+ ESM ⚡️ Build success in 72ms
17
+ DTS Build start
18
+ DTS ⚡️ Build success in 18179ms
19
+ DTS dist/index.d.ts 237.00 B
20
+ DTS dist/index.d.mts 237.00 B
21
+ Done in 22.01s.
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @sproutsocial/seeds-react-visually-hidden
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - e839317: Migrate VisuallyHidden to seeds-react-visually-hidden
@@ -0,0 +1,15 @@
1
+ // src/VisuallyHidden.tsx
2
+ import styled from "styled-components";
3
+ import { visuallyHidden } from "@sproutsocial/seeds-react-mixins";
4
+ import "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var StyledVisuallyHidden = styled.span`
7
+ ${visuallyHidden}
8
+ `;
9
+ var VisuallyHidden = (props) => {
10
+ return /* @__PURE__ */ jsx(StyledVisuallyHidden, { ...props });
11
+ };
12
+ export {
13
+ VisuallyHidden
14
+ };
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/VisuallyHidden.tsx"],"sourcesContent":["import styled from \"styled-components\";\nimport { visuallyHidden } from \"@sproutsocial/seeds-react-mixins\";\nimport type { HTMLAttributes } from \"react\";\nimport React from \"react\";\n\nexport interface VisuallyHiddenProps extends HTMLAttributes<HTMLSpanElement> {}\n\nconst StyledVisuallyHidden = styled.span<VisuallyHiddenProps>`\n ${visuallyHidden}\n`;\n\nexport const VisuallyHidden: React.FC<VisuallyHiddenProps> = (props) => {\n return <StyledVisuallyHidden {...props} />;\n};\n"],"mappings":";AAAA,OAAO,YAAY;AACnB,SAAS,sBAAsB;AAE/B,OAAkB;AAST;AALT,IAAM,uBAAuB,OAAO;AAAA,IAChC,cAAc;AAAA;AAGX,IAAM,iBAAgD,CAAC,UAAU;AACtE,SAAO,oBAAC,wBAAsB,GAAG,OAAO;AAC1C;","names":[]}
@@ -0,0 +1,7 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+
3
+ interface VisuallyHiddenProps extends HTMLAttributes<HTMLSpanElement> {
4
+ }
5
+ declare const VisuallyHidden: React.FC<VisuallyHiddenProps>;
6
+
7
+ export { VisuallyHidden, type VisuallyHiddenProps };
@@ -0,0 +1,7 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+
3
+ interface VisuallyHiddenProps extends HTMLAttributes<HTMLSpanElement> {
4
+ }
5
+ declare const VisuallyHidden: React.FC<VisuallyHiddenProps>;
6
+
7
+ export { VisuallyHidden, type VisuallyHiddenProps };
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ VisuallyHidden: () => VisuallyHidden
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+
37
+ // src/VisuallyHidden.tsx
38
+ var import_styled_components = __toESM(require("styled-components"));
39
+ var import_seeds_react_mixins = require("@sproutsocial/seeds-react-mixins");
40
+ var import_react = require("react");
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var StyledVisuallyHidden = import_styled_components.default.span`
43
+ ${import_seeds_react_mixins.visuallyHidden}
44
+ `;
45
+ var VisuallyHidden = (props) => {
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledVisuallyHidden, { ...props });
47
+ };
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ VisuallyHidden
51
+ });
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/VisuallyHidden.tsx"],"sourcesContent":["export * from \"./VisuallyHidden\";\n","import styled from \"styled-components\";\nimport { visuallyHidden } from \"@sproutsocial/seeds-react-mixins\";\nimport type { HTMLAttributes } from \"react\";\nimport React from \"react\";\n\nexport interface VisuallyHiddenProps extends HTMLAttributes<HTMLSpanElement> {}\n\nconst StyledVisuallyHidden = styled.span<VisuallyHiddenProps>`\n ${visuallyHidden}\n`;\n\nexport const VisuallyHidden: React.FC<VisuallyHiddenProps> = (props) => {\n return <StyledVisuallyHidden {...props} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAAmB;AACnB,gCAA+B;AAE/B,mBAAkB;AAST;AALT,IAAM,uBAAuB,yBAAAA,QAAO;AAAA,IAChC,wCAAc;AAAA;AAGX,IAAM,iBAAgD,CAAC,UAAU;AACtE,SAAO,4CAAC,wBAAsB,GAAG,OAAO;AAC1C;","names":["styled"]}
package/jest.config.js ADDED
@@ -0,0 +1,9 @@
1
+ const baseConfig = require("@sproutsocial/seeds-testing");
2
+
3
+ /** * @type {import('jest').Config} */
4
+ const config = {
5
+ ...baseConfig,
6
+ displayName: "seeds-react-visually-hidden",
7
+ };
8
+
9
+ module.exports = config;
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@sproutsocial/seeds-react-visually-hidden",
3
+ "version": "1.0.0",
4
+ "description": "Seeds React VisuallyHidden",
5
+ "author": "Sprout Social, Inc.",
6
+ "license": "MIT",
7
+ "main": "dist/index.js",
8
+ "module": "dist/esm/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "scripts": {
11
+ "build": "tsup --dts",
12
+ "build:debug": "tsup --dts --metafile",
13
+ "dev": "tsup --watch --dts",
14
+ "clean": "rm -rf .turbo dist",
15
+ "clean:modules": "rm -rf node_modules",
16
+ "typecheck": "tsc --noEmit",
17
+ "test": "jest",
18
+ "test:watch": "jest --watch --coverage=false"
19
+ },
20
+ "dependencies": {
21
+ "@sproutsocial/seeds-react-theme": "^*",
22
+ "@sproutsocial/seeds-react-system-props": "^*",
23
+ "@sproutsocial/seeds-react-mixins": "^*"
24
+ },
25
+ "devDependencies": {
26
+ "@types/react": "^18.0.0",
27
+ "@types/styled-components": "^5.1.26",
28
+ "@sproutsocial/eslint-config-seeds": "*",
29
+ "react": "^18.0.0",
30
+ "styled-components": "^5.2.3",
31
+ "tsup": "^8.0.2",
32
+ "typescript": "^5.6.2",
33
+ "@sproutsocial/seeds-tsconfig": "*",
34
+ "@sproutsocial/seeds-testing": "*",
35
+ "@sproutsocial/seeds-react-testing-library": "*"
36
+ },
37
+ "peerDependencies": {
38
+ "styled-components": "^5.2.3"
39
+ },
40
+ "engines": {
41
+ "node": ">=18"
42
+ }
43
+ }
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { VisuallyHidden } from "./VisuallyHidden";
4
+ import { Text } from "@sproutsocial/seeds-react-text";
5
+
6
+ const meta: Meta<typeof VisuallyHidden> = {
7
+ title: "Components/Visually Hidden",
8
+ component: VisuallyHidden,
9
+ };
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof VisuallyHidden>;
13
+
14
+ export const Default: Story = {
15
+ render: (args) => (
16
+ // @ts-ignore
17
+ <Text {...args}>
18
+ The VisuallyHidden component is used to hide text visually but still make
19
+ it accessible to screen readers. This is often used for screen reader only
20
+ text, such as labels for icons or interactive elements that require a
21
+ textual description to make sense for non-sighted users. See code for
22
+ example.
23
+ <VisuallyHidden>
24
+ This text is hidden visually but accessible by screen readers.
25
+ </VisuallyHidden>
26
+ </Text>
27
+ ),
28
+ };
@@ -0,0 +1,14 @@
1
+ import styled from "styled-components";
2
+ import { visuallyHidden } from "@sproutsocial/seeds-react-mixins";
3
+ import type { HTMLAttributes } from "react";
4
+ import React from "react";
5
+
6
+ export interface VisuallyHiddenProps extends HTMLAttributes<HTMLSpanElement> {}
7
+
8
+ const StyledVisuallyHidden = styled.span<VisuallyHiddenProps>`
9
+ ${visuallyHidden}
10
+ `;
11
+
12
+ export const VisuallyHidden: React.FC<VisuallyHiddenProps> = (props) => {
13
+ return <StyledVisuallyHidden {...props} />;
14
+ };
@@ -0,0 +1,30 @@
1
+ import { render, screen } from "@sproutsocial/seeds-react-testing-library";
2
+ import { VisuallyHidden } from "../VisuallyHidden";
3
+
4
+ describe("VisuallyHidden", () => {
5
+ it("renders without crashing", () => {
6
+ render(<VisuallyHidden>Hidden Content</VisuallyHidden>);
7
+ const element = screen.getByText("Hidden Content");
8
+ expect(element).toBeInTheDocument();
9
+ });
10
+
11
+ it("applies visually hidden styles", () => {
12
+ render(<VisuallyHidden>Hidden Content</VisuallyHidden>);
13
+ const element = screen.getByText("Hidden Content");
14
+ expect(element).toHaveStyle(`
15
+ position: absolute;
16
+ width: 1px;
17
+ height: 1px;
18
+ margin: -1px;
19
+ padding: 0;
20
+ overflow: hidden;
21
+ border: 0;
22
+ `);
23
+ });
24
+
25
+ it("forwards additional props", () => {
26
+ render(<VisuallyHidden aria-label="hidden">Hidden Content</VisuallyHidden>);
27
+ const element = screen.getByText("Hidden Content");
28
+ expect(element).toHaveAttribute("aria-label", "hidden");
29
+ });
30
+ });
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import { VisuallyHidden } from "../VisuallyHidden";
3
+
4
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
5
+ function VisuallyHiddenTypes() {
6
+ return (
7
+ <>
8
+ <VisuallyHidden>Content</VisuallyHidden>
9
+ {/* @ts-expect-error - test that invalid prop is rejected */}
10
+ <VisuallyHidden invalidProp="invalid">Content</VisuallyHidden>
11
+ </>
12
+ );
13
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./VisuallyHidden";
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@sproutsocial/seeds-tsconfig/bundler/dom/library-monorepo",
3
+ "compilerOptions": {
4
+ "jsx": "react-jsx",
5
+ "module": "esnext"
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules", "dist", "coverage"]
9
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig((options) => ({
4
+ entry: ["src/index.ts"],
5
+ format: ["cjs", "esm"],
6
+ clean: true,
7
+ legacyOutput: true,
8
+ dts: options.dts,
9
+ external: ["react"],
10
+ sourcemap: true,
11
+ metafile: options.metafile,
12
+ }));