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: 4 additions & 0 deletions frameworks/projects/Style/src/main/resources/defaults.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ CheckBox
{
IStyleSkin: ClassReference("org.apache.royale.style.skins.CheckBoxSkin");
}
Status
{
IStyleSkin: ClassReference("org.apache.royale.style.skins.StatusSkin");
}
Dropdown
{
IStyleSkin: ClassReference("org.apache.royale.style.skins.DropdownSkin");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<component id="View" class="org.apache.royale.style.View"/>
<component id="Container" class="org.apache.royale.style.Container"/>
<component id="CheckBox" class="org.apache.royale.style.CheckBox"/>
<component id="Status" class="org.apache.royale.style.Status"/>
<component id="Divider" class="org.apache.royale.style.Divider"/>
<component id="Dropdown" class="org.apache.royale.style.Dropdown"/>
<component id="Tab" class="org.apache.royale.style.Tab"/>
Expand Down Expand Up @@ -71,7 +72,6 @@
<component id="Tree" class="org.apache.royale.style.Tree"/>
<component id="DataItemRenderer" class="org.apache.royale.style.DataItemRenderer"/>
<component id="ListItemRenderer" class="org.apache.royale.style.renderers.ListItemRenderer"/>

<component id="ListController" class="org.apache.royale.style.beads.ListController"/>
<component id="ListModel" class="org.apache.royale.style.beads.ListModel"/>
<component id="ListView" class="org.apache.royale.style.beads.ListView"/>
Expand Down Expand Up @@ -301,6 +301,7 @@

<component id="CheckBoxSkin" class="org.apache.royale.style.skins.CheckBoxSkin"/>
<component id="RadioSkin" class="org.apache.royale.style.skins.RadioSkin"/>
<component id="StatusSkin" class="org.apache.royale.style.skins.StatusSkin"/>
<component id="BadgeSkin" class="org.apache.royale.style.skins.BadgeSkin"/>
<component id="DividerSkin" class="org.apache.royale.style.skins.DividerSkin"/>
<component id="LinkSkin" class="org.apache.royale.style.skins.LinkSkin"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// //////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// //////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style
{
COMPILE::JS
{
import org.apache.royale.core.WrappedHTMLElement;
}
import org.apache.royale.style.elements.Span;
import org.apache.royale.debugging.assert;

/**
* Displays a small status indicator dot with an inner highlight.
*/

public class Status extends StyleUIBase
{

public function Status()
{
super();
}

COMPILE::JS
private var span:Span;

COMPILE::JS
override protected function createElement():WrappedHTMLElement
{
var elem:WrappedHTMLElement = super.createElement();
span = new Span();
addElement(span);
return elem;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// //////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// //////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.skins
{
import org.apache.royale.style.StyleSkin;
import org.apache.royale.style.Status;
import org.apache.royale.core.IStrand;
import org.apache.royale.style.stylebeads.background.BackgroundColor;
import org.apache.royale.style.stylebeads.border.BorderRadius;
import org.apache.royale.style.stylebeads.border.Outline;
import org.apache.royale.style.stylebeads.layout.Display;
import org.apache.royale.style.stylebeads.layout.Overflow;
import org.apache.royale.style.stylebeads.layout.Position;
import org.apache.royale.style.stylebeads.layout.Left;
import org.apache.royale.style.stylebeads.layout.Top;
import org.apache.royale.style.stylebeads.sizing.HeightStyle;
import org.apache.royale.style.stylebeads.sizing.WidthStyle;
import org.apache.royale.style.stylebeads.typography.VerticalAlign;
import org.apache.royale.style.stylebeads.effects.OpacityStyle;
import org.apache.royale.style.colors.ColorSwatch;
import org.apache.royale.style.colors.ThemeColorSet;
import org.apache.royale.style.util.ThemeManager;

public class StatusSkin extends StyleSkin
{
public function StatusSkin()
{
super();
}

private function get host():Status
{
return _strand as Status;
}
// Currently using the simplest implementation.
// There are additional styling options available for the status indicator
// (e.g. different animations, and visual effects)
// clsses:
// <span class="relative inline-block h-2 w-2 overflow-hidden animate-bounce rounded-full bg-[#3abff8] shadow-[0_2.8px_3.5px_-0.7px_rgba(15,23,42,0.22)] after:absolute after:left-[18%] after:top-[16%] after:h-[38%] after:w-[38%] after:rounded-full after:bg-white/60 after:blur-[1.4px] after:content-['']"></span>
// <span class="relative inline-flex h-2 w-2 overflow-hidden rounded-full bg-[#f87272] shadow-[0_2.8px_3.5px_-0.7px_rgba(15,23,42,0.22)] after:absolute after:left-[18%] after:top-[16%] after:h-[38%] after:w-[38%] after:rounded-full after:bg-white/60 after:blur-[1.4px] after:content-['']"></span>
override public function set strand(value:IStrand):void
{
super.strand = value;
if (_styles)
return;
var colorSet:ThemeColorSet = ThemeManager.instance.activeTheme.themeColorSet;
var baseColor:ColorSwatch = (host.theme && host.theme != "default") ? colorSet.getSwatch(host.theme, 600) : colorSet.getSwatch(ThemeColorSet.NEUTRAL, 300);
var heightWidth:String = computeSize(getSize(), host.unit);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using unit is probably wrong because this will not work for anything other than rem.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the computeSize function, so I assumed it would handle different units correctly. Is there a specific case where this breaks that I should account for?

_styles = [
new Position("relative"),
new Display("inline-block"),
new HeightStyle(heightWidth),
new WidthStyle(heightWidth),
new Overflow("hidden"),
new BorderRadius("9999px"),
new VerticalAlign("middle"),
new BackgroundColor(baseColor),
];

host.setStyles(_styles);
}
private function getSize():Number
{
switch (host.size)
{
case "xs":
return 4;
case "sm":
return 6;
case "md":
return 9;
case "lg":
return 11;
case "xl":
return 13;
default:
return 9;
}
}
}
}