Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into structure-enhance…
Browse files Browse the repository at this point in the history
…ments
  • Loading branch information
nitrogenous committed Mar 13, 2024
2 parents 9129ad0 + f1b8237 commit b324773
Show file tree
Hide file tree
Showing 70 changed files with 4,164 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ tsconfig.tsbuildinfo
# misc
.DS_Store
*.pem
*.code-workspace

# debug
npm-debug.log*
Expand Down
8 changes: 8 additions & 0 deletions components/doc/badge/severitydoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export function SeverityDoc(props) {
<Badge value="4" severity="info"></Badge>
<Badge value="12" severity="warning"></Badge>
<Badge value="3" severity="danger"></Badge>
<Badge value="7" severity="secondary"></Badge>
<Badge value="5" severity="contrast"></Badge>
`,
javascript: `
import React from 'react';
Expand All @@ -23,6 +25,8 @@ export default function SeverityDemo() {
<Badge value="4" severity="info"></Badge >
<Badge value="12" severity="warning"></Badge>
<Badge value="3" severity="danger"></Badge>
<Badge value="7" severity="secondary"></Badge>
<Badge value="5" severity="contrast"></Badge>
</div>
);
}
Expand All @@ -39,6 +43,8 @@ export default function SeverityDemo() {
<Badge value="4" severity="info"></Badge >
<Badge value="12" severity="warning"></Badge>
<Badge value="3" severity="danger"></Badge>
<Badge value="7" severity="secondary"></Badge>
<Badge value="5" severity="contrast"></Badge>
</div>
);
}
Expand All @@ -58,6 +64,8 @@ export default function SeverityDemo() {
<Badge value="4" severity="info"></Badge>
<Badge value="12" severity="warning"></Badge>
<Badge value="3" severity="danger"></Badge>
<Badge value="7" severity="secondary"></Badge>
<Badge value="5" severity="contrast"></Badge>
</div>
<DocSectionCode code={code} />
</>
Expand Down
308 changes: 303 additions & 5 deletions components/doc/common/apidoc/index.json

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions components/doc/message/severitydoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export function SeverityDoc(props) {
<Message severity="success" text="Success Message" />
<Message severity="warn" text="Warning Message" />
<Message severity="error" text="Error Message" />
<Message severity="secondary" text="Secondary Message" />
<Message severity="contrast" text="Contrast Message" />
`,
javascript: `
import React from 'react';
Expand All @@ -21,6 +23,8 @@ export default function SeverityDemo() {
<Message severity="info" text="Info Message" />
<Message severity="warn" text="Warning Message" />
<Message severity="error" text="Error Message" />
<Message severity="secondary" text="Secondary Message" />
<Message severity="contrast" text="Contrast Message" />
</div>
)
}
Expand All @@ -36,6 +40,8 @@ export default function SeverityDemo() {
<Message severity="info" text="Info Message" />
<Message severity="warn" text="Warning Message" />
<Message severity="error" text="Error Message" />
<Message severity="secondary" text="Secondary Message" />
<Message severity="contrast" text="Contrast Message" />
</div>
)
}
Expand All @@ -54,6 +60,8 @@ export default function SeverityDemo() {
<Message severity="info" text="Info Message" />
<Message severity="warn" text="Warning Message" />
<Message severity="error" text="Error Message" />
<Message severity="secondary" text="Secondary Message" />
<Message severity="contrast" text="Contrast Message" />
</div>
<DocSectionCode code={code} />
</>
Expand Down
2 changes: 2 additions & 0 deletions components/doc/message/theming/tailwinddoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default function UnstyledDemo() {
<Message severity="success" text="Success Message" />
<Message severity="warn" text="Warning Message" />
<Message severity="error" text="Error Message" />
<Message severity="secondary" text="Secondary Message" />
<Message severity="contrast" text="Contrast Message" />
</div>
)
}
Expand Down
10 changes: 9 additions & 1 deletion components/doc/messages/severitydoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export function SeverityDoc(props) {
{ sticky: true, severity: 'info', summary: 'Info', detail: 'Message Content', closable: false },
{ sticky: true, severity: 'success', summary: 'Success', detail: 'Message Content', closable: false },
{ sticky: true, severity: 'warn', summary: 'Warning', detail: 'Message Content', closable: false },
{ sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content', closable: false }
{ sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content', closable: false },
{ sticky: true, severity: 'secondary', summary: 'Secondary', detail: 'Message Content', closable: false },
{ sticky: true, severity: 'contrast', summary: 'Contrast', detail: 'Message Content', closable: false }
]);
}
});
Expand All @@ -26,6 +28,8 @@ msgs.current.show([
{sticky: true, severity: 'success', summary: 'Success', detail: 'Message Content', closable: false},
{sticky: true, severity: 'warn', summary: 'Warning', detail: 'Message Content', closable: false},
{sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content', closable: false}
{sticky: true, severity: 'secondary', summary: 'Secondary', detail: 'Message Content', closable: false}
{sticky: true, severity: 'contrast', summary: 'Contrast', detail: 'Message Content', closable: false}
]);
`,
javascript: `
Expand All @@ -44,6 +48,8 @@ export default function SeverityDemo() {
{ sticky: true, severity: 'success', summary: 'Success', detail: 'Message Content', closable: false },
{ sticky: true, severity: 'warn', summary: 'Warning', detail: 'Message Content', closable: false },
{ sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content', closable: false }
{ sticky: true, severity: 'secondary', summary: 'Secondary', detail: 'Message Content', closable: false }
{ sticky: true, severity: 'contrast', summary: 'Contrast', detail: 'Message Content', closable: false }
]);
}
});
Expand All @@ -68,6 +74,8 @@ export default function SeverityDemo() {
{sticky: true, severity: 'success', summary: 'Success', detail: 'Message Content'},
{sticky: true, severity: 'warn', summary: 'Warning', detail: 'Message Content'},
{sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content'}
{sticky: true, severity: 'secondary', summary: 'Secondary', detail: 'Message Content'}
{sticky: true, severity: 'contrast', summary: 'Contrast', detail: 'Message Content'}
]);
});
Expand Down
26 changes: 26 additions & 0 deletions components/doc/metergroup/accessibilitydoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { DevelopmentSection } from '@/components/doc/common/developmentsection';
import { DocSectionCode } from '@/components/doc/common/docsectioncode';
import { DocSectionText } from '@/components/doc/common/docsectiontext';
import Link from 'next/link';

export function AccessibilityDoc() {
const code = {
basic: `
<span id="dd1">Options</span>
<MultiSelect aria-labelledby="dd1" />
<MultiSelect aria-label="Options" />
`
};

return (
<DocSectionText id="accessibility" label="Accessibility">
<h3>Screen Reader</h3>
<p>
MeterGroup component uses <i>meter</i> role in addition to the <i>aria-valuemin</i>, <i>aria-valuemax</i> and <i>aria-valuenow</i> attributes. Value to describe the component can be defined using <i>aria-labelledby</i> prop.
</p>
<h3>Keyboard Support</h3>
<p>Component does not include any interactive elements.</p>
</DocSectionText>
);
}
55 changes: 55 additions & 0 deletions components/doc/metergroup/basicdoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { DocSectionCode } from '@/components/doc/common/docsectioncode';
import { DocSectionText } from '@/components/doc/common/docsectiontext';
import { MeterGroup } from '@/components/lib/metergroup/MeterGroup';

export function BasicDoc(props) {
const code = {
basic: `
<MeterGroup values={values} />
`,
javascript: `
import React, { useEffect, useRef } from 'react';
import { MeterGroup } from 'primereact/metergroup';
export default function BasicDemo() {
const values = [{ label: 'Space used', value: 15 }];
return (
<div className="card flex justify-content-center">
<MeterGroup values={values} />
</div>
)
}
`,
typescript: `
import React, { useEffect, useRef } from 'react';
import { MeterGroup } from 'primereact/metergroup';
export default function BasicDemo() {
const values = [{ label: 'Space used', value: 15 }];
return (
<div className="card flex justify-content-center">
<MeterGroup values={values} />
</div>
)
}
`
};

const values = [{ label: 'Space used', value: 15 }];

return (
<>
<DocSectionText {...props}>
<p>
MeterGroup requires a <i>value</i> as the data to display where each item in the collection should be a type of <i>MeterItem</i>.
</p>
</DocSectionText>
<div className="card">
<MeterGroup values={values} />
</div>
<DocSectionCode code={code} />
</>
);
}
68 changes: 68 additions & 0 deletions components/doc/metergroup/icondoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { DocSectionCode } from '@/components/doc/common/docsectioncode';
import { DocSectionText } from '@/components/doc/common/docsectiontext';
import { MeterGroup } from '@/components/lib/metergroup/MeterGroup';

export function IconDoc(props) {
const code = {
basic: `
<MeterGroup values={values} />
`,
javascript: `
import React, { useEffect, useRef } from 'react';
import { MeterGroup } from 'primereact/metergroup';
export default function IconDemo() {
const values = [
{ label: 'Apps', color: '#34d399', value: 16, icon: 'pi pi-table' },
{ label: 'Messages', color: '#fbbf24', value: 8, icon: 'pi pi-inbox' },
{ label: 'Media', color: '#60a5fa', value: 24, icon: 'pi pi-image' },
{ label: 'System', color: '#c084fc', value: 10, icon: 'pi pi-cog' }
];
return (
<div className="card flex justify-content-center">
<MeterGroup values={values} />
</div>
)
}
`,
typescript: `
import React, { useEffect, useRef } from 'react';
import { MeterGroup } from 'primereact/metergroup';
export default function IconDemo() {
const values = [
{ label: 'Apps', color: '#34d399', value: 16, icon: 'pi pi-table' },
{ label: 'Messages', color: '#fbbf24', value: 8, icon: 'pi pi-inbox' },
{ label: 'Media', color: '#60a5fa', value: 24, icon: 'pi pi-image' },
{ label: 'System', color: '#c084fc', value: 10, icon: 'pi pi-cog' }
];
return (
<div className="card flex justify-content-center">
<MeterGroup values={values} />
</div>
)
}
`
};

const values = [
{ label: 'Apps', color: '#34d399', value: 16, icon: 'pi pi-table' },
{ label: 'Messages', color: '#fbbf24', value: 8, icon: 'pi pi-inbox' },
{ label: 'Media', color: '#60a5fa', value: 24, icon: 'pi pi-image' },
{ label: 'System', color: '#c084fc', value: 10, icon: 'pi pi-cog' }
];

return (
<>
<DocSectionText {...props}>
<p>Icons can be displayed next to the labels instead of the default marker.</p>
</DocSectionText>
<div className="card">
<MeterGroup values={values} />
</div>
<DocSectionCode code={code} />
</>
);
}
17 changes: 17 additions & 0 deletions components/doc/metergroup/importdoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { DocSectionCode } from '@/components/doc/common/docsectioncode';
import { DocSectionText } from '@/components/doc/common/docsectiontext';

export function ImportDoc(props) {
const code = {
basic: `
import { MeterGroup } from 'primereact/metergroup';
`
};

return (
<>
<DocSectionText {...props}></DocSectionText>
<DocSectionCode code={code} hideToggleCode import hideCodeSandbox hideStackBlitz />
</>
);
}
71 changes: 71 additions & 0 deletions components/doc/metergroup/labeldoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { DocSectionCode } from '@/components/doc/common/docsectioncode';
import { DocSectionText } from '@/components/doc/common/docsectiontext';
import { MeterGroup } from '@/components/lib/metergroup/MeterGroup';

export function LabelDoc(props) {
const code = {
basic: `
<MeterGroup values={values} labelPosition="start" labelOrientation="vertical" />
`,
javascript: `
import React, { useEffect, useRef } from 'react';
import { MeterGroup } from 'primereact/metergroup';
export default function LabelDemo() {
const values = [
{ label: 'Apps', color: '#34d399', value: 16 },
{ label: 'Messages', color: '#fbbf24', value: 8 },
{ label: 'Media', color: '#60a5fa', value: 24 },
{ label: 'System', color: '#c084fc', value: 10 }
];
return (
<div className="card flex justify-content-center">
<MeterGroup values={values} labelPosition="start" labelOrientation="vertical" />
</div>
)
}
`,
typescript: `
import React, { useEffect, useRef } from 'react';
import { MeterGroup } from 'primereact/metergroup';
export default function LabelDemo() {
const values = [
{ label: 'Apps', color: '#34d399', value: 16 },
{ label: 'Messages', color: '#fbbf24', value: 8 },
{ label: 'Media', color: '#60a5fa', value: 24 },
{ label: 'System', color: '#c084fc', value: 10 }
];
return (
<div className="card flex justify-content-center">
<MeterGroup values={values} labelPosition="start" labelOrientation="vertical" />
</div>
)
}
`
};

const values = [
{ label: 'Apps', color: '#34d399', value: 16 },
{ label: 'Messages', color: '#fbbf24', value: 8 },
{ label: 'Media', color: '#60a5fa', value: 24 },
{ label: 'System', color: '#c084fc', value: 10 }
];

return (
<>
<DocSectionText {...props}>
<p>
The position of the labels relative to the meters is defined using the <i>labelPosition</i> property. The default orientation of the labels is horizontal, and the vertical alternative is available through the{' '}
<i>labelOrientation</i> option.
</p>
</DocSectionText>
<div className="card">
<MeterGroup values={values} labelPosition="start" labelOrientation="vertical" />
</div>
<DocSectionCode code={code} />
</>
);
}
Loading

0 comments on commit b324773

Please sign in to comment.