Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ const config: Config = {
{ name: 'twitter:image', content: 'https://developer.sailpoint.com/img/SailPoint-Logo-OG.png' },

// Content Security Policy
{ 'http-equiv': 'Content-Security-Policy', content: "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://code.jquery.com https://www.googletagmanager.com https://cdn.jsdelivr.net https://cdn.cookielaw.org https://googleads.g.doubleclick.net; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://p.typekit.net https://use.typekit.net; img-src 'self' data: https: http:; font-src 'self' data: https://cdn.jsdelivr.net https://use.typekit.net https://cdnjs.cloudflare.com; connect-src 'self' http://localhost:3000 https://nug87yusrg.execute-api.us-east-1.amazonaws.com https://*.algolia.net https://*.algolianet.com https://www.googletagmanager.com https://www.google.com https://analytics.google.com https://developer.sailpoint.com https://cdn.cookielaw.org https://stats.g.doubleclick.net https://googleads.g.doubleclick.net https://*.api.identitynow.com https://*.api.identitynow-demo.com; frame-src 'self' https://www.googletagmanager.com https://www.youtube.com https://play.vidyard.com; worker-src 'self' blob:;" },
{ 'http-equiv': 'Content-Security-Policy',
content: "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://code.jquery.com https://www.googletagmanager.com https://cdn.jsdelivr.net https://cdn.cookielaw.org https://googleads.g.doubleclick.net; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://p.typekit.net https://use.typekit.net; img-src 'self' data: https: http:; font-src 'self' data: https://cdn.jsdelivr.net https://use.typekit.net https://cdnjs.cloudflare.com; connect-src 'self' http://localhost:3000 https://nug87yusrg.execute-api.us-east-1.amazonaws.com https://o2352gowwy55a4vviyswr76lxu0ednjs.lambda-url.us-east-2.on.aws https://*.algolia.net https://*.algolianet.com https://www.googletagmanager.com https://www.google.com https://analytics.google.com https://developer.sailpoint.com https://cdn.cookielaw.org https://stats.g.doubleclick.net https://googleads.g.doubleclick.net https://*.api.identitynow.com https://*.api.identitynow-demo.com; frame-src 'self' https://www.googletagmanager.com https://www.youtube.com https://play.vidyard.com; worker-src 'self' blob:;" },

],
algolia: {
appId: 'TB01H1DFAM',
Expand Down
1 change: 1 addition & 0 deletions navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const navbarConfig = {
{ label: 'CLI', to: '/docs/tools/cli' },
{ label: 'Escaping Tool Formatter', to: '/tools/escaping-tool-formatter' },
{ label: 'JSON Path Evaluator', to: '/tools/json-path-evaluator' },
{ label: 'XPath Evaluator', to: '/tools/xpath-evaluator' },
{ label: 'Rule Development Kit', to: '/docs/tools/rule-development-kit' },
{ label: 'UI Development Kit', to: '/docs/tools/ui-development-kit' },
{ label: 'Velocity PlayGround', to: '/tools/velocity-playground' },
Expand Down
112 changes: 112 additions & 0 deletions src/components/xpath/ImplementationDropdown/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import React, { useState, FocusEvent, ChangeEvent } from 'react';
import FormControl from '@mui/material/FormControl';
import InputLabel from '@mui/material/InputLabel';
import Select from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem';
import { useColorMode } from '@docusaurus/theme-common';
import { createTheme, ThemeProvider } from '@mui/material/styles';

// Define prop types
interface ImplementationDropdownProps {
implementation: string;
onImplementationChange: (value: string) => void;
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
}

const ImplementationDropdown: React.FC<ImplementationDropdownProps> = ({
implementation,
onImplementationChange,
onFocus,
onBlur,
}) => {
const { colorMode } = useColorMode();
const [isFocused, setIsFocused] = useState<boolean>(false);
const [expanded, setExpanded] = useState<boolean>(false);

const theme = createTheme({
components: {
MuiOutlinedInput: {
styleOverrides: {
root: {
'& .MuiOutlinedInput-notchedOutline': {
borderColor: colorMode === 'dark' ? '#ffffff' : 'initial',
borderWidth: 1,
},
'&.Mui-focused .MuiOutlinedInput-notchedOutline': {
borderColor: colorMode === 'dark' ? 'rgb(115,200,235)' : 'rgb(4,125,246)',
},
'&:hover .MuiOutlinedInput-notchedOutline': {
borderColor: colorMode === 'dark' ? 'rgb(115,200,235)' : 'rgb(4,125,246)',
},
},
},
},
MuiSelect: {
styleOverrides: {
icon: {
color: colorMode === 'dark' ? '#ffffff' : 'black',
},
},
},
},
});

const handleChange = (event: ChangeEvent<{ value: unknown }>) => {
onImplementationChange(event.target.value as string);
};

// Handle focus and blur state changes
const handleFocus = (event: FocusEvent<HTMLInputElement>) => {
setIsFocused(true);
if (onFocus) onFocus(event);
};

const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
setIsFocused(false);
if (onBlur) onBlur(event);
};

// Handle dropdown expanded state
const handleDropdownOpen = () => setExpanded(true);
const handleDropdownClose = () => setExpanded(false);

return (
<ThemeProvider theme={theme}>
<FormControl sx={{ m: 1, minWidth: 220, maxWidth: 220 }}>
<InputLabel
id="implementation-dropdown-label"
sx={{
'&.Mui-focused': {
color: isFocused ? (colorMode === 'dark' ? 'rgb(115,200,235)' : 'rgb(4,125,246)') : 'initial',
},
}}
>
Implementation
</InputLabel>

<Select
value={implementation}
onChange={handleChange}
onFocus={handleFocus}
onBlur={handleBlur}
label="Implementation"
labelId="implementation-dropdown-label"
id="implementation-dropdown-select"
onOpen={handleDropdownOpen}
onClose={handleDropdownClose}
aria-expanded={expanded}
sx={{
'& .MuiSelect-select': {
color: isFocused || expanded ? (colorMode === 'dark' ? 'rgb(115,200,235)' : 'rgb(4,125,246)') : 'initial',
},
}}
>
<MenuItem value="XPath">XPath</MenuItem>
</Select>
</FormControl>
</ThemeProvider>
);
};

export default ImplementationDropdown;
64 changes: 64 additions & 0 deletions src/components/xpath/InputTerminal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from 'react';
import AceEditor from 'react-ace';
import 'ace-builds/src-noconflict/mode-xml';
import 'ace-builds/src-noconflict/mode-text';
import 'ace-builds/src-noconflict/theme-github_dark';
import 'ace-builds/src-noconflict/theme-github_light_default';
import 'ace-builds/src-noconflict/ext-language_tools';
import { useColorMode } from '@docusaurus/theme-common';
import styles from '../../../pages/tools/xpath.module.css';

// Ensure ace is properly configured
declare const ace: any;
if (typeof ace !== 'undefined' && ace.config) {
ace.config.setModuleUrl(
'ace/mode/xml_worker',
new URL(
'https://ajaxorg.github.io/ace-builds/src-noconflict/worker-xml.js'
).toString(),
);
}

interface InputTerminalProps {
fontSize: string;
value: string;
onChange: (value: string) => void;
hasXmlParseError?: boolean;
mode?: 'xml' | 'text'; // 🔄 new optional mode prop
}

const InputTerminal: React.FC<InputTerminalProps> = ({
fontSize,
value,
onChange,
hasXmlParseError = false,
mode = 'xml',
}) => {
const { colorMode } = useColorMode();

const terminalClass = hasXmlParseError
? styles.inputTerminalContainer
: styles.terminalContainerDefault;

return (
<div className="col">
<h2>Inputs</h2>
<AceEditor
className={terminalClass}
mode={mode}
theme={colorMode === 'dark' ? 'github_dark' : 'github_light_default'}
value={value}
onChange={onChange}
fontSize={`${fontSize}px`}
width="auto"
showPrintMargin={false}
editorProps={{ $blockScrolling: true }}
setOptions={{
fontFamily: 'monospace',
}}
/>
</div>
);
};

export default InputTerminal;
54 changes: 54 additions & 0 deletions src/components/xpath/ResultTerminal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from 'react';
import AceEditor from 'react-ace';
import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/mode-text';
import 'ace-builds/src-noconflict/theme-github_dark';
import 'ace-builds/src-noconflict/theme-github_light_default';
import 'ace-builds/src-noconflict/ext-language_tools';
import { useColorMode } from '@docusaurus/theme-common';
import styles from '../../../pages/tools/xpath.module.css';

// Ensure ace is properly configured
declare const ace: any;
if (typeof ace !== 'undefined' && ace.config) {
ace.config.setModuleUrl(
'ace/mode/json_worker',
new URL(
'https://ajaxorg.github.io/ace-builds/src-noconflict/worker-json.js'
).toString(),
);
}

// Props interface with optional `mode`
interface ResultTerminalProps {
result: string;
fontSize: string;
mode?: 'json' | 'text';
}

const ResultTerminal: React.FC<ResultTerminalProps> = ({ result, fontSize, mode = 'json' }) => {
const { colorMode } = useColorMode();

return (
<div className="col" style={{ marginBottom: 50 }}>
<h2>Evaluation results</h2>

<AceEditor
className={styles.terminalContainerDefault}
mode={mode}
theme={colorMode === 'dark' ? 'github_dark' : 'github_light_default'}
value={result}
readOnly
fontSize={`${fontSize}px`}
width="auto"
showPrintMargin={false}
editorProps={{ $blockScrolling: true }}
setOptions={{
fontFamily: 'monospace',
}}
/>
</div>
);
};

export default ResultTerminal;
114 changes: 114 additions & 0 deletions src/components/xpath/TerminalFontSizeDropdown/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import React, { useState, ChangeEvent, FocusEvent } from 'react';
import FormControl from '@mui/material/FormControl';
import InputLabel from '@mui/material/InputLabel';
import Select from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { useColorMode } from '@docusaurus/theme-common';

// Define props interface
interface TerminalFontSizeDropdownProps {
fontSize: string;
onFontSizeChange: (value: string) => void;
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
}

const TerminalFontSizeDropdown: React.FC<TerminalFontSizeDropdownProps> = ({
fontSize,
onFontSizeChange,
onFocus,
onBlur,
}) => {
const { colorMode } = useColorMode();
const [isFocused, setIsFocused] = useState<boolean>(false);
const [expanded, setExpanded] = useState<boolean>(false);

const theme = createTheme({
components: {
MuiOutlinedInput: {
styleOverrides: {
root: {
'& .MuiOutlinedInput-notchedOutline': {
borderColor: colorMode === 'dark' ? '#ffffff' : 'initial',
borderWidth: 1,
},
'&.Mui-focused .MuiOutlinedInput-notchedOutline': {
borderColor: colorMode === 'dark' ? 'rgb(115,200,235)' : 'rgb(4,125,246)',
},
'&:hover .MuiOutlinedInput-notchedOutline': {
borderColor: colorMode === 'dark' ? 'rgb(115,200,235)' : 'rgb(4,125,246)',
},
},
},
},
MuiSelect: {
styleOverrides: {
icon: {
color: colorMode === 'dark' ? '#ffffff' : 'black',
},
},
},
},
});

const handleChange = (event: ChangeEvent<{ value: unknown }>) => {
onFontSizeChange(event.target.value as string);
};

// Handle focus and blur state changes
const handleFocus = (event: FocusEvent<HTMLInputElement>) => {
setIsFocused(true);
if (onFocus) onFocus(event);
};

const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
setIsFocused(false);
if (onBlur) onBlur(event);
};

// Handle dropdown expanded state
const handleDropdownOpen = () => setExpanded(true);
const handleDropdownClose = () => setExpanded(false);

return (
<ThemeProvider theme={theme}>
<FormControl sx={{ m: 1, minWidth: 220, maxWidth: 220 }}>
<InputLabel
id="terminal-font-size-label"
sx={{
'&.Mui-focused': {
color: isFocused ? (colorMode === 'dark' ? 'rgb(115,200,235)' : 'rgb(4,125,246)') : 'initial',
},
}}
>
Terminal Font Size
</InputLabel>
<Select
labelId="terminal-font-size-label"
id="terminal-font-size-select"
value={fontSize}
label="Terminal Font Size"
onChange={handleChange}
onFocus={handleFocus}
onBlur={handleBlur}
onOpen={handleDropdownOpen}
onClose={handleDropdownClose}
aria-expanded={expanded}
sx={{
'& .MuiSelect-select': {
color: isFocused || expanded ? (colorMode === 'dark' ? 'rgb(115,200,235)' : 'rgb(4,125,246)') : 'initial',
},
}}
>
<MenuItem value="12">Small</MenuItem>
<MenuItem value="16">Medium</MenuItem>
<MenuItem value="18">Large</MenuItem>
<MenuItem value="24">Extra Large</MenuItem>
</Select>
</FormControl>
</ThemeProvider>
);
};

export default TerminalFontSizeDropdown;
Loading
Loading